wicked-crew 0.3.2 → 0.4.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.
Files changed (44) hide show
  1. package/dist/api/elicitation-cache.d.ts +93 -0
  2. package/dist/api/elicitation-cache.d.ts.map +1 -0
  3. package/dist/api/elicitation-cache.js +128 -0
  4. package/dist/api/elicitation-cache.js.map +1 -0
  5. package/dist/api/evidence.d.ts +37 -38
  6. package/dist/api/evidence.d.ts.map +1 -1
  7. package/dist/api/evidence.js +40 -36
  8. package/dist/api/evidence.js.map +1 -1
  9. package/dist/api/gate-cache.d.ts +29 -13
  10. package/dist/api/gate-cache.d.ts.map +1 -1
  11. package/dist/api/gate-cache.js +82 -36
  12. package/dist/api/gate-cache.js.map +1 -1
  13. package/dist/api/requirements.d.ts +12 -3
  14. package/dist/api/requirements.d.ts.map +1 -1
  15. package/dist/api/requirements.js +34 -37
  16. package/dist/api/requirements.js.map +1 -1
  17. package/dist/api/routes.d.ts +2 -1
  18. package/dist/api/routes.d.ts.map +1 -1
  19. package/dist/api/routes.js +388 -41
  20. package/dist/api/routes.js.map +1 -1
  21. package/dist/api/server.d.ts.map +1 -1
  22. package/dist/api/server.js +13 -6
  23. package/dist/api/server.js.map +1 -1
  24. package/dist/core/adapter.d.ts +94 -6
  25. package/dist/core/adapter.d.ts.map +1 -1
  26. package/dist/core/adapter.js +386 -86
  27. package/dist/core/adapter.js.map +1 -1
  28. package/dist/core/exec.d.ts +37 -0
  29. package/dist/core/exec.d.ts.map +1 -0
  30. package/dist/core/exec.js +97 -0
  31. package/dist/core/exec.js.map +1 -0
  32. package/dist/core/repoPaths.d.ts +37 -0
  33. package/dist/core/repoPaths.d.ts.map +1 -0
  34. package/dist/core/repoPaths.js +48 -0
  35. package/dist/core/repoPaths.js.map +1 -0
  36. package/dist/core/types.d.ts +81 -2
  37. package/dist/core/types.d.ts.map +1 -1
  38. package/dist/core/types.js.map +1 -1
  39. package/dist/studio/assets/index-Ci_R6ARr.js +423 -0
  40. package/dist/studio/assets/index-Dio_c1Q3.css +32 -0
  41. package/dist/studio/index.html +2 -2
  42. package/package.json +14 -13
  43. package/dist/studio/assets/index-CjUiA3ex.css +0 -32
  44. package/dist/studio/assets/index-DlHYzFvv.js +0 -420
@@ -1,420 +0,0 @@
1
- var JC=Object.defineProperty;var eE=(t,e,r)=>e in t?JC(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var i0=(t,e,r)=>eE(t,typeof e!="symbol"?e+"":e,r);(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 s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&n(o)}).observe(document,{childList:!0,subtree:!0});function r(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function n(i){if(i.ep)return;i.ep=!0;const s=r(i);fetch(i.href,s)}})();function Vc(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Xf={exports:{}},jo={},Kf={exports:{}},Ct={};/**
2
- * @license React
3
- * react.production.min.js
4
- *
5
- * Copyright (c) Facebook, Inc. and its affiliates.
6
- *
7
- * This source code is licensed under the MIT license found in the
8
- * LICENSE file in the root directory of this source tree.
9
- */var a0;function tE(){if(a0)return Ct;a0=1;var t=Symbol.for("react.element"),e=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),s=Symbol.for("react.provider"),o=Symbol.for("react.context"),a=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),u=Symbol.for("react.memo"),c=Symbol.for("react.lazy"),h=Symbol.iterator;function v(j){return j===null||typeof j!="object"?null:(j=h&&j[h]||j["@@iterator"],typeof j=="function"?j:null)}var d={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},x=Object.assign,w={};function g(j,G,$){this.props=j,this.context=G,this.refs=w,this.updater=$||d}g.prototype.isReactComponent={},g.prototype.setState=function(j,G){if(typeof j!="object"&&typeof j!="function"&&j!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,j,G,"setState")},g.prototype.forceUpdate=function(j){this.updater.enqueueForceUpdate(this,j,"forceUpdate")};function m(){}m.prototype=g.prototype;function y(j,G,$){this.props=j,this.context=G,this.refs=w,this.updater=$||d}var b=y.prototype=new m;b.constructor=y,x(b,g.prototype),b.isPureReactComponent=!0;var S=Array.isArray,N=Object.prototype.hasOwnProperty,E={current:null},T={key:!0,ref:!0,__self:!0,__source:!0};function k(j,G,$){var ee,ae={},ie=null,K=null;if(G!=null)for(ee in G.ref!==void 0&&(K=G.ref),G.key!==void 0&&(ie=""+G.key),G)N.call(G,ee)&&!T.hasOwnProperty(ee)&&(ae[ee]=G[ee]);var q=arguments.length-2;if(q===1)ae.children=$;else if(1<q){for(var Y=Array(q),X=0;X<q;X++)Y[X]=arguments[X+2];ae.children=Y}if(j&&j.defaultProps)for(ee in q=j.defaultProps,q)ae[ee]===void 0&&(ae[ee]=q[ee]);return{$$typeof:t,type:j,key:ie,ref:K,props:ae,_owner:E.current}}function L(j,G){return{$$typeof:t,type:j.type,key:G,ref:j.ref,props:j.props,_owner:j._owner}}function A(j){return typeof j=="object"&&j!==null&&j.$$typeof===t}function I(j){var G={"=":"=0",":":"=2"};return"$"+j.replace(/[=:]/g,function($){return G[$]})}var M=/\/+/g;function B(j,G){return typeof j=="object"&&j!==null&&j.key!=null?I(""+j.key):G.toString(36)}function D(j,G,$,ee,ae){var ie=typeof j;(ie==="undefined"||ie==="boolean")&&(j=null);var K=!1;if(j===null)K=!0;else switch(ie){case"string":case"number":K=!0;break;case"object":switch(j.$$typeof){case t:case e:K=!0}}if(K)return K=j,ae=ae(K),j=ee===""?"."+B(K,0):ee,S(ae)?($="",j!=null&&($=j.replace(M,"$&/")+"/"),D(ae,G,$,"",function(X){return X})):ae!=null&&(A(ae)&&(ae=L(ae,$+(!ae.key||K&&K.key===ae.key?"":(""+ae.key).replace(M,"$&/")+"/")+j)),G.push(ae)),1;if(K=0,ee=ee===""?".":ee+":",S(j))for(var q=0;q<j.length;q++){ie=j[q];var Y=ee+B(ie,q);K+=D(ie,G,$,Y,ae)}else if(Y=v(j),typeof Y=="function")for(j=Y.call(j),q=0;!(ie=j.next()).done;)ie=ie.value,Y=ee+B(ie,q++),K+=D(ie,G,$,Y,ae);else if(ie==="object")throw G=String(j),Error("Objects are not valid as a React child (found: "+(G==="[object Object]"?"object with keys {"+Object.keys(j).join(", ")+"}":G)+"). If you meant to render a collection of children, use an array instead.");return K}function H(j,G,$){if(j==null)return j;var ee=[],ae=0;return D(j,ee,"","",function(ie){return G.call($,ie,ae++)}),ee}function U(j){if(j._status===-1){var G=j._result;G=G(),G.then(function($){(j._status===0||j._status===-1)&&(j._status=1,j._result=$)},function($){(j._status===0||j._status===-1)&&(j._status=2,j._result=$)}),j._status===-1&&(j._status=0,j._result=G)}if(j._status===1)return j._result.default;throw j._result}var z={current:null},W={transition:null},F={ReactCurrentDispatcher:z,ReactCurrentBatchConfig:W,ReactCurrentOwner:E};function P(){throw Error("act(...) is not supported in production builds of React.")}return Ct.Children={map:H,forEach:function(j,G,$){H(j,function(){G.apply(this,arguments)},$)},count:function(j){var G=0;return H(j,function(){G++}),G},toArray:function(j){return H(j,function(G){return G})||[]},only:function(j){if(!A(j))throw Error("React.Children.only expected to receive a single React element child.");return j}},Ct.Component=g,Ct.Fragment=r,Ct.Profiler=i,Ct.PureComponent=y,Ct.StrictMode=n,Ct.Suspense=l,Ct.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=F,Ct.act=P,Ct.cloneElement=function(j,G,$){if(j==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+j+".");var ee=x({},j.props),ae=j.key,ie=j.ref,K=j._owner;if(G!=null){if(G.ref!==void 0&&(ie=G.ref,K=E.current),G.key!==void 0&&(ae=""+G.key),j.type&&j.type.defaultProps)var q=j.type.defaultProps;for(Y in G)N.call(G,Y)&&!T.hasOwnProperty(Y)&&(ee[Y]=G[Y]===void 0&&q!==void 0?q[Y]:G[Y])}var Y=arguments.length-2;if(Y===1)ee.children=$;else if(1<Y){q=Array(Y);for(var X=0;X<Y;X++)q[X]=arguments[X+2];ee.children=q}return{$$typeof:t,type:j.type,key:ae,ref:ie,props:ee,_owner:K}},Ct.createContext=function(j){return j={$$typeof:o,_currentValue:j,_currentValue2:j,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},j.Provider={$$typeof:s,_context:j},j.Consumer=j},Ct.createElement=k,Ct.createFactory=function(j){var G=k.bind(null,j);return G.type=j,G},Ct.createRef=function(){return{current:null}},Ct.forwardRef=function(j){return{$$typeof:a,render:j}},Ct.isValidElement=A,Ct.lazy=function(j){return{$$typeof:c,_payload:{_status:-1,_result:j},_init:U}},Ct.memo=function(j,G){return{$$typeof:u,type:j,compare:G===void 0?null:G}},Ct.startTransition=function(j){var G=W.transition;W.transition={};try{j()}finally{W.transition=G}},Ct.unstable_act=P,Ct.useCallback=function(j,G){return z.current.useCallback(j,G)},Ct.useContext=function(j){return z.current.useContext(j)},Ct.useDebugValue=function(){},Ct.useDeferredValue=function(j){return z.current.useDeferredValue(j)},Ct.useEffect=function(j,G){return z.current.useEffect(j,G)},Ct.useId=function(){return z.current.useId()},Ct.useImperativeHandle=function(j,G,$){return z.current.useImperativeHandle(j,G,$)},Ct.useInsertionEffect=function(j,G){return z.current.useInsertionEffect(j,G)},Ct.useLayoutEffect=function(j,G){return z.current.useLayoutEffect(j,G)},Ct.useMemo=function(j,G){return z.current.useMemo(j,G)},Ct.useReducer=function(j,G,$){return z.current.useReducer(j,G,$)},Ct.useRef=function(j){return z.current.useRef(j)},Ct.useState=function(j){return z.current.useState(j)},Ct.useSyncExternalStore=function(j,G,$){return z.current.useSyncExternalStore(j,G,$)},Ct.useTransition=function(){return z.current.useTransition()},Ct.version="18.3.1",Ct}var s0;function Hv(){return s0||(s0=1,Kf.exports=tE()),Kf.exports}/**
10
- * @license React
11
- * react-jsx-runtime.production.min.js
12
- *
13
- * Copyright (c) Facebook, Inc. and its affiliates.
14
- *
15
- * This source code is licensed under the MIT license found in the
16
- * LICENSE file in the root directory of this source tree.
17
- */var o0;function rE(){if(o0)return jo;o0=1;var t=Hv(),e=Symbol.for("react.element"),r=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,i=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function o(a,l,u){var c,h={},v=null,d=null;u!==void 0&&(v=""+u),l.key!==void 0&&(v=""+l.key),l.ref!==void 0&&(d=l.ref);for(c in l)n.call(l,c)&&!s.hasOwnProperty(c)&&(h[c]=l[c]);if(a&&a.defaultProps)for(c in l=a.defaultProps,l)h[c]===void 0&&(h[c]=l[c]);return{$$typeof:e,type:a,key:v,ref:d,props:h,_owner:i.current}}return jo.Fragment=r,jo.jsx=o,jo.jsxs=o,jo}var l0;function nE(){return l0||(l0=1,Xf.exports=rE()),Xf.exports}var _=nE(),ne=Hv();const Fu=Vc(ne);var zu={},Qf={exports:{}},an={},Zf={exports:{}},Jf={};/**
18
- * @license React
19
- * scheduler.production.min.js
20
- *
21
- * Copyright (c) Facebook, Inc. and its affiliates.
22
- *
23
- * This source code is licensed under the MIT license found in the
24
- * LICENSE file in the root directory of this source tree.
25
- */var u0;function iE(){return u0||(u0=1,(function(t){function e(W,F){var P=W.length;W.push(F);e:for(;0<P;){var j=P-1>>>1,G=W[j];if(0<i(G,F))W[j]=F,W[P]=G,P=j;else break e}}function r(W){return W.length===0?null:W[0]}function n(W){if(W.length===0)return null;var F=W[0],P=W.pop();if(P!==F){W[0]=P;e:for(var j=0,G=W.length,$=G>>>1;j<$;){var ee=2*(j+1)-1,ae=W[ee],ie=ee+1,K=W[ie];if(0>i(ae,P))ie<G&&0>i(K,ae)?(W[j]=K,W[ie]=P,j=ie):(W[j]=ae,W[ee]=P,j=ee);else if(ie<G&&0>i(K,P))W[j]=K,W[ie]=P,j=ie;else break e}}return F}function i(W,F){var P=W.sortIndex-F.sortIndex;return P!==0?P:W.id-F.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;t.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();t.unstable_now=function(){return o.now()-a}}var l=[],u=[],c=1,h=null,v=3,d=!1,x=!1,w=!1,g=typeof setTimeout=="function"?setTimeout:null,m=typeof clearTimeout=="function"?clearTimeout:null,y=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function b(W){for(var F=r(u);F!==null;){if(F.callback===null)n(u);else if(F.startTime<=W)n(u),F.sortIndex=F.expirationTime,e(l,F);else break;F=r(u)}}function S(W){if(w=!1,b(W),!x)if(r(l)!==null)x=!0,U(N);else{var F=r(u);F!==null&&z(S,F.startTime-W)}}function N(W,F){x=!1,w&&(w=!1,m(k),k=-1),d=!0;var P=v;try{for(b(F),h=r(l);h!==null&&(!(h.expirationTime>F)||W&&!I());){var j=h.callback;if(typeof j=="function"){h.callback=null,v=h.priorityLevel;var G=j(h.expirationTime<=F);F=t.unstable_now(),typeof G=="function"?h.callback=G:h===r(l)&&n(l),b(F)}else n(l);h=r(l)}if(h!==null)var $=!0;else{var ee=r(u);ee!==null&&z(S,ee.startTime-F),$=!1}return $}finally{h=null,v=P,d=!1}}var E=!1,T=null,k=-1,L=5,A=-1;function I(){return!(t.unstable_now()-A<L)}function M(){if(T!==null){var W=t.unstable_now();A=W;var F=!0;try{F=T(!0,W)}finally{F?B():(E=!1,T=null)}}else E=!1}var B;if(typeof y=="function")B=function(){y(M)};else if(typeof MessageChannel<"u"){var D=new MessageChannel,H=D.port2;D.port1.onmessage=M,B=function(){H.postMessage(null)}}else B=function(){g(M,0)};function U(W){T=W,E||(E=!0,B())}function z(W,F){k=g(function(){W(t.unstable_now())},F)}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(W){W.callback=null},t.unstable_continueExecution=function(){x||d||(x=!0,U(N))},t.unstable_forceFrameRate=function(W){0>W||125<W?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):L=0<W?Math.floor(1e3/W):5},t.unstable_getCurrentPriorityLevel=function(){return v},t.unstable_getFirstCallbackNode=function(){return r(l)},t.unstable_next=function(W){switch(v){case 1:case 2:case 3:var F=3;break;default:F=v}var P=v;v=F;try{return W()}finally{v=P}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(W,F){switch(W){case 1:case 2:case 3:case 4:case 5:break;default:W=3}var P=v;v=W;try{return F()}finally{v=P}},t.unstable_scheduleCallback=function(W,F,P){var j=t.unstable_now();switch(typeof P=="object"&&P!==null?(P=P.delay,P=typeof P=="number"&&0<P?j+P:j):P=j,W){case 1:var G=-1;break;case 2:G=250;break;case 5:G=1073741823;break;case 4:G=1e4;break;default:G=5e3}return G=P+G,W={id:c++,callback:F,priorityLevel:W,startTime:P,expirationTime:G,sortIndex:-1},P>j?(W.sortIndex=P,e(u,W),r(l)===null&&W===r(u)&&(w?(m(k),k=-1):w=!0,z(S,P-j))):(W.sortIndex=G,e(l,W),x||d||(x=!0,U(N))),W},t.unstable_shouldYield=I,t.unstable_wrapCallback=function(W){var F=v;return function(){var P=v;v=F;try{return W.apply(this,arguments)}finally{v=P}}}})(Jf)),Jf}var c0;function aE(){return c0||(c0=1,Zf.exports=iE()),Zf.exports}/**
26
- * @license React
27
- * react-dom.production.min.js
28
- *
29
- * Copyright (c) Facebook, Inc. and its affiliates.
30
- *
31
- * This source code is licensed under the MIT license found in the
32
- * LICENSE file in the root directory of this source tree.
33
- */var h0;function sE(){if(h0)return an;h0=1;var t=Hv(),e=aE();function r(f){for(var p="https://reactjs.org/docs/error-decoder.html?invariant="+f,C=1;C<arguments.length;C++)p+="&args[]="+encodeURIComponent(arguments[C]);return"Minified React error #"+f+"; visit "+p+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var n=new Set,i={};function s(f,p){o(f,p),o(f+"Capture",p)}function o(f,p){for(i[f]=p,f=0;f<p.length;f++)n.add(p[f])}var a=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),l=Object.prototype.hasOwnProperty,u=/^[: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]*$/,c={},h={};function v(f){return l.call(h,f)?!0:l.call(c,f)?!1:u.test(f)?h[f]=!0:(c[f]=!0,!1)}function d(f,p,C,R){if(C!==null&&C.type===0)return!1;switch(typeof p){case"function":case"symbol":return!0;case"boolean":return R?!1:C!==null?!C.acceptsBooleans:(f=f.toLowerCase().slice(0,5),f!=="data-"&&f!=="aria-");default:return!1}}function x(f,p,C,R){if(p===null||typeof p>"u"||d(f,p,C,R))return!0;if(R)return!1;if(C!==null)switch(C.type){case 3:return!p;case 4:return p===!1;case 5:return isNaN(p);case 6:return isNaN(p)||1>p}return!1}function w(f,p,C,R,O,V,Q){this.acceptsBooleans=p===2||p===3||p===4,this.attributeName=R,this.attributeNamespace=O,this.mustUseProperty=C,this.propertyName=f,this.type=p,this.sanitizeURL=V,this.removeEmptyString=Q}var g={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(f){g[f]=new w(f,0,!1,f,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(f){var p=f[0];g[p]=new w(p,1,!1,f[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(f){g[f]=new w(f,2,!1,f.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(f){g[f]=new w(f,2,!1,f,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(f){g[f]=new w(f,3,!1,f.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(f){g[f]=new w(f,3,!0,f,null,!1,!1)}),["capture","download"].forEach(function(f){g[f]=new w(f,4,!1,f,null,!1,!1)}),["cols","rows","size","span"].forEach(function(f){g[f]=new w(f,6,!1,f,null,!1,!1)}),["rowSpan","start"].forEach(function(f){g[f]=new w(f,5,!1,f.toLowerCase(),null,!1,!1)});var m=/[\-:]([a-z])/g;function y(f){return f[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(f){var p=f.replace(m,y);g[p]=new w(p,1,!1,f,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(f){var p=f.replace(m,y);g[p]=new w(p,1,!1,f,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(f){var p=f.replace(m,y);g[p]=new w(p,1,!1,f,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(f){g[f]=new w(f,1,!1,f.toLowerCase(),null,!1,!1)}),g.xlinkHref=new w("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(f){g[f]=new w(f,1,!1,f.toLowerCase(),null,!0,!0)});function b(f,p,C,R){var O=g.hasOwnProperty(p)?g[p]:null;(O!==null?O.type!==0:R||!(2<p.length)||p[0]!=="o"&&p[0]!=="O"||p[1]!=="n"&&p[1]!=="N")&&(x(p,C,O,R)&&(C=null),R||O===null?v(p)&&(C===null?f.removeAttribute(p):f.setAttribute(p,""+C)):O.mustUseProperty?f[O.propertyName]=C===null?O.type===3?!1:"":C:(p=O.attributeName,R=O.attributeNamespace,C===null?f.removeAttribute(p):(O=O.type,C=O===3||O===4&&C===!0?"":""+C,R?f.setAttributeNS(R,p,C):f.setAttribute(p,C))))}var S=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,N=Symbol.for("react.element"),E=Symbol.for("react.portal"),T=Symbol.for("react.fragment"),k=Symbol.for("react.strict_mode"),L=Symbol.for("react.profiler"),A=Symbol.for("react.provider"),I=Symbol.for("react.context"),M=Symbol.for("react.forward_ref"),B=Symbol.for("react.suspense"),D=Symbol.for("react.suspense_list"),H=Symbol.for("react.memo"),U=Symbol.for("react.lazy"),z=Symbol.for("react.offscreen"),W=Symbol.iterator;function F(f){return f===null||typeof f!="object"?null:(f=W&&f[W]||f["@@iterator"],typeof f=="function"?f:null)}var P=Object.assign,j;function G(f){if(j===void 0)try{throw Error()}catch(C){var p=C.stack.trim().match(/\n( *(at )?)/);j=p&&p[1]||""}return`
34
- `+j+f}var $=!1;function ee(f,p){if(!f||$)return"";$=!0;var C=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(p)if(p=function(){throw Error()},Object.defineProperty(p.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(p,[])}catch(we){var R=we}Reflect.construct(f,[],p)}else{try{p.call()}catch(we){R=we}f.call(p.prototype)}else{try{throw Error()}catch(we){R=we}f()}}catch(we){if(we&&R&&typeof we.stack=="string"){for(var O=we.stack.split(`
35
- `),V=R.stack.split(`
36
- `),Q=O.length-1,le=V.length-1;1<=Q&&0<=le&&O[Q]!==V[le];)le--;for(;1<=Q&&0<=le;Q--,le--)if(O[Q]!==V[le]){if(Q!==1||le!==1)do if(Q--,le--,0>le||O[Q]!==V[le]){var fe=`
37
- `+O[Q].replace(" at new "," at ");return f.displayName&&fe.includes("<anonymous>")&&(fe=fe.replace("<anonymous>",f.displayName)),fe}while(1<=Q&&0<=le);break}}}finally{$=!1,Error.prepareStackTrace=C}return(f=f?f.displayName||f.name:"")?G(f):""}function ae(f){switch(f.tag){case 5:return G(f.type);case 16:return G("Lazy");case 13:return G("Suspense");case 19:return G("SuspenseList");case 0:case 2:case 15:return f=ee(f.type,!1),f;case 11:return f=ee(f.type.render,!1),f;case 1:return f=ee(f.type,!0),f;default:return""}}function ie(f){if(f==null)return null;if(typeof f=="function")return f.displayName||f.name||null;if(typeof f=="string")return f;switch(f){case T:return"Fragment";case E:return"Portal";case L:return"Profiler";case k:return"StrictMode";case B:return"Suspense";case D:return"SuspenseList"}if(typeof f=="object")switch(f.$$typeof){case I:return(f.displayName||"Context")+".Consumer";case A:return(f._context.displayName||"Context")+".Provider";case M:var p=f.render;return f=f.displayName,f||(f=p.displayName||p.name||"",f=f!==""?"ForwardRef("+f+")":"ForwardRef"),f;case H:return p=f.displayName||null,p!==null?p:ie(f.type)||"Memo";case U:p=f._payload,f=f._init;try{return ie(f(p))}catch{}}return null}function K(f){var p=f.type;switch(f.tag){case 24:return"Cache";case 9:return(p.displayName||"Context")+".Consumer";case 10:return(p._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return f=p.render,f=f.displayName||f.name||"",p.displayName||(f!==""?"ForwardRef("+f+")":"ForwardRef");case 7:return"Fragment";case 5:return p;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ie(p);case 8:return p===k?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof p=="function")return p.displayName||p.name||null;if(typeof p=="string")return p}return null}function q(f){switch(typeof f){case"boolean":case"number":case"string":case"undefined":return f;case"object":return f;default:return""}}function Y(f){var p=f.type;return(f=f.nodeName)&&f.toLowerCase()==="input"&&(p==="checkbox"||p==="radio")}function X(f){var p=Y(f)?"checked":"value",C=Object.getOwnPropertyDescriptor(f.constructor.prototype,p),R=""+f[p];if(!f.hasOwnProperty(p)&&typeof C<"u"&&typeof C.get=="function"&&typeof C.set=="function"){var O=C.get,V=C.set;return Object.defineProperty(f,p,{configurable:!0,get:function(){return O.call(this)},set:function(Q){R=""+Q,V.call(this,Q)}}),Object.defineProperty(f,p,{enumerable:C.enumerable}),{getValue:function(){return R},setValue:function(Q){R=""+Q},stopTracking:function(){f._valueTracker=null,delete f[p]}}}}function J(f){f._valueTracker||(f._valueTracker=X(f))}function re(f){if(!f)return!1;var p=f._valueTracker;if(!p)return!0;var C=p.getValue(),R="";return f&&(R=Y(f)?f.checked?"true":"false":f.value),f=R,f!==C?(p.setValue(f),!0):!1}function ce(f){if(f=f||(typeof document<"u"?document:void 0),typeof f>"u")return null;try{return f.activeElement||f.body}catch{return f.body}}function de(f,p){var C=p.checked;return P({},p,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:C??f._wrapperState.initialChecked})}function Re(f,p){var C=p.defaultValue==null?"":p.defaultValue,R=p.checked!=null?p.checked:p.defaultChecked;C=q(p.value!=null?p.value:C),f._wrapperState={initialChecked:R,initialValue:C,controlled:p.type==="checkbox"||p.type==="radio"?p.checked!=null:p.value!=null}}function Pe(f,p){p=p.checked,p!=null&&b(f,"checked",p,!1)}function _e(f,p){Pe(f,p);var C=q(p.value),R=p.type;if(C!=null)R==="number"?(C===0&&f.value===""||f.value!=C)&&(f.value=""+C):f.value!==""+C&&(f.value=""+C);else if(R==="submit"||R==="reset"){f.removeAttribute("value");return}p.hasOwnProperty("value")?Le(f,p.type,C):p.hasOwnProperty("defaultValue")&&Le(f,p.type,q(p.defaultValue)),p.checked==null&&p.defaultChecked!=null&&(f.defaultChecked=!!p.defaultChecked)}function ke(f,p,C){if(p.hasOwnProperty("value")||p.hasOwnProperty("defaultValue")){var R=p.type;if(!(R!=="submit"&&R!=="reset"||p.value!==void 0&&p.value!==null))return;p=""+f._wrapperState.initialValue,C||p===f.value||(f.value=p),f.defaultValue=p}C=f.name,C!==""&&(f.name=""),f.defaultChecked=!!f._wrapperState.initialChecked,C!==""&&(f.name=C)}function Le(f,p,C){(p!=="number"||ce(f.ownerDocument)!==f)&&(C==null?f.defaultValue=""+f._wrapperState.initialValue:f.defaultValue!==""+C&&(f.defaultValue=""+C))}var Ee=Array.isArray;function Ie(f,p,C,R){if(f=f.options,p){p={};for(var O=0;O<C.length;O++)p["$"+C[O]]=!0;for(C=0;C<f.length;C++)O=p.hasOwnProperty("$"+f[C].value),f[C].selected!==O&&(f[C].selected=O),O&&R&&(f[C].defaultSelected=!0)}else{for(C=""+q(C),p=null,O=0;O<f.length;O++){if(f[O].value===C){f[O].selected=!0,R&&(f[O].defaultSelected=!0);return}p!==null||f[O].disabled||(p=f[O])}p!==null&&(p.selected=!0)}}function Oe(f,p){if(p.dangerouslySetInnerHTML!=null)throw Error(r(91));return P({},p,{value:void 0,defaultValue:void 0,children:""+f._wrapperState.initialValue})}function De(f,p){var C=p.value;if(C==null){if(C=p.children,p=p.defaultValue,C!=null){if(p!=null)throw Error(r(92));if(Ee(C)){if(1<C.length)throw Error(r(93));C=C[0]}p=C}p==null&&(p=""),C=p}f._wrapperState={initialValue:q(C)}}function We(f,p){var C=q(p.value),R=q(p.defaultValue);C!=null&&(C=""+C,C!==f.value&&(f.value=C),p.defaultValue==null&&f.defaultValue!==C&&(f.defaultValue=C)),R!=null&&(f.defaultValue=""+R)}function Ye(f){var p=f.textContent;p===f._wrapperState.initialValue&&p!==""&&p!==null&&(f.value=p)}function ge(f){switch(f){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function Ce(f,p){return f==null||f==="http://www.w3.org/1999/xhtml"?ge(p):f==="http://www.w3.org/2000/svg"&&p==="foreignObject"?"http://www.w3.org/1999/xhtml":f}var Ae,Fe=(function(f){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(p,C,R,O){MSApp.execUnsafeLocalFunction(function(){return f(p,C,R,O)})}:f})(function(f,p){if(f.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in f)f.innerHTML=p;else{for(Ae=Ae||document.createElement("div"),Ae.innerHTML="<svg>"+p.valueOf().toString()+"</svg>",p=Ae.firstChild;f.firstChild;)f.removeChild(f.firstChild);for(;p.firstChild;)f.appendChild(p.firstChild)}});function me(f,p){if(p){var C=f.firstChild;if(C&&C===f.lastChild&&C.nodeType===3){C.nodeValue=p;return}}f.textContent=p}var Z={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},te=["Webkit","ms","Moz","O"];Object.keys(Z).forEach(function(f){te.forEach(function(p){p=p+f.charAt(0).toUpperCase()+f.substring(1),Z[p]=Z[f]})});function oe(f,p,C){return p==null||typeof p=="boolean"||p===""?"":C||typeof p!="number"||p===0||Z.hasOwnProperty(f)&&Z[f]?(""+p).trim():p+"px"}function ue(f,p){f=f.style;for(var C in p)if(p.hasOwnProperty(C)){var R=C.indexOf("--")===0,O=oe(C,p[C],R);C==="float"&&(C="cssFloat"),R?f.setProperty(C,O):f[C]=O}}var se=P({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function he(f,p){if(p){if(se[f]&&(p.children!=null||p.dangerouslySetInnerHTML!=null))throw Error(r(137,f));if(p.dangerouslySetInnerHTML!=null){if(p.children!=null)throw Error(r(60));if(typeof p.dangerouslySetInnerHTML!="object"||!("__html"in p.dangerouslySetInnerHTML))throw Error(r(61))}if(p.style!=null&&typeof p.style!="object")throw Error(r(62))}}function pe(f,p){if(f.indexOf("-")===-1)return typeof p.is=="string";switch(f){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 be=null;function Se(f){return f=f.target||f.srcElement||window,f.correspondingUseElement&&(f=f.correspondingUseElement),f.nodeType===3?f.parentNode:f}var Te=null,Ne=null,He=null;function ze(f){if(f=So(f)){if(typeof Te!="function")throw Error(r(280));var p=f.stateNode;p&&(p=eu(p),Te(f.stateNode,f.type,p))}}function Ge(f){Ne?He?He.push(f):He=[f]:Ne=f}function st(){if(Ne){var f=Ne,p=He;if(He=Ne=null,ze(f),p)for(f=0;f<p.length;f++)ze(p[f])}}function Je(f,p){return f(p)}function qe(){}var vt=!1;function Ze(f,p,C){if(vt)return f(p,C);vt=!0;try{return Je(f,p,C)}finally{vt=!1,(Ne!==null||He!==null)&&(qe(),st())}}function Qe(f,p){var C=f.stateNode;if(C===null)return null;var R=eu(C);if(R===null)return null;C=R[p];e:switch(p){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(R=!R.disabled)||(f=f.type,R=!(f==="button"||f==="input"||f==="select"||f==="textarea")),f=!R;break e;default:f=!1}if(f)return null;if(C&&typeof C!="function")throw Error(r(231,p,typeof C));return C}var wt=!1;if(a)try{var lt={};Object.defineProperty(lt,"passive",{get:function(){wt=!0}}),window.addEventListener("test",lt,lt),window.removeEventListener("test",lt,lt)}catch{wt=!1}function gt(f,p,C,R,O,V,Q,le,fe){var we=Array.prototype.slice.call(arguments,3);try{p.apply(C,we)}catch(je){this.onError(je)}}var xt=!1,Rt=null,Ot=!1,Tt=null,Nr={onError:function(f){xt=!0,Rt=f}};function Ir(f,p,C,R,O,V,Q,le,fe){xt=!1,Rt=null,gt.apply(Nr,arguments)}function cr(f,p,C,R,O,V,Q,le,fe){if(Ir.apply(this,arguments),xt){if(xt){var we=Rt;xt=!1,Rt=null}else throw Error(r(198));Ot||(Ot=!0,Tt=we)}}function Mt(f){var p=f,C=f;if(f.alternate)for(;p.return;)p=p.return;else{f=p;do p=f,(p.flags&4098)!==0&&(C=p.return),f=p.return;while(f)}return p.tag===3?C:null}function Qt(f){if(f.tag===13){var p=f.memoizedState;if(p===null&&(f=f.alternate,f!==null&&(p=f.memoizedState)),p!==null)return p.dehydrated}return null}function $r(f){if(Mt(f)!==f)throw Error(r(188))}function ar(f){var p=f.alternate;if(!p){if(p=Mt(f),p===null)throw Error(r(188));return p!==f?null:f}for(var C=f,R=p;;){var O=C.return;if(O===null)break;var V=O.alternate;if(V===null){if(R=O.return,R!==null){C=R;continue}break}if(O.child===V.child){for(V=O.child;V;){if(V===C)return $r(O),f;if(V===R)return $r(O),p;V=V.sibling}throw Error(r(188))}if(C.return!==R.return)C=O,R=V;else{for(var Q=!1,le=O.child;le;){if(le===C){Q=!0,C=O,R=V;break}if(le===R){Q=!0,R=O,C=V;break}le=le.sibling}if(!Q){for(le=V.child;le;){if(le===C){Q=!0,C=V,R=O;break}if(le===R){Q=!0,R=V,C=O;break}le=le.sibling}if(!Q)throw Error(r(189))}}if(C.alternate!==R)throw Error(r(190))}if(C.tag!==3)throw Error(r(188));return C.stateNode.current===C?f:p}function Wn(f){return f=ar(f),f!==null?Dn(f):null}function Dn(f){if(f.tag===5||f.tag===6)return f;for(f=f.child;f!==null;){var p=Dn(f);if(p!==null)return p;f=f.sibling}return null}var An=e.unstable_scheduleCallback,ha=e.unstable_cancelCallback,fa=e.unstable_shouldYield,qa=e.unstable_requestPaint,Ht=e.unstable_now,ro=e.unstable_getCurrentPriorityLevel,cn=e.unstable_ImmediatePriority,ai=e.unstable_UserBlockingPriority,bn=e.unstable_NormalPriority,wi=e.unstable_LowPriority,_i=e.unstable_IdlePriority,Zt=null,nt=null;function kt(f){if(nt&&typeof nt.onCommitFiberRoot=="function")try{nt.onCommitFiberRoot(Zt,f,void 0,(f.current.flags&128)===128)}catch{}}var tr=Math.clz32?Math.clz32:ph,hr=Math.log,hn=Math.LN2;function ph(f){return f>>>=0,f===0?32:31-(hr(f)/hn|0)|0}var no=64,Ya=4194304;function io(f){switch(f&-f){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: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&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return f&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return f}}function jl(f,p){var C=f.pendingLanes;if(C===0)return 0;var R=0,O=f.suspendedLanes,V=f.pingedLanes,Q=C&268435455;if(Q!==0){var le=Q&~O;le!==0?R=io(le):(V&=Q,V!==0&&(R=io(V)))}else Q=C&~O,Q!==0?R=io(Q):V!==0&&(R=io(V));if(R===0)return 0;if(p!==0&&p!==R&&(p&O)===0&&(O=R&-R,V=p&-p,O>=V||O===16&&(V&4194240)!==0))return p;if((R&4)!==0&&(R|=C&16),p=f.entangledLanes,p!==0)for(f=f.entanglements,p&=R;0<p;)C=31-tr(p),O=1<<C,R|=f[C],p&=~O;return R}function y2(f,p){switch(f){case 1:case 2:case 4:return p+250;case 8:case 16:case 32:case 64: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 p+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function x2(f,p){for(var C=f.suspendedLanes,R=f.pingedLanes,O=f.expirationTimes,V=f.pendingLanes;0<V;){var Q=31-tr(V),le=1<<Q,fe=O[Q];fe===-1?((le&C)===0||(le&R)!==0)&&(O[Q]=y2(le,p)):fe<=p&&(f.expiredLanes|=le),V&=~le}}function vh(f){return f=f.pendingLanes&-1073741825,f!==0?f:f&1073741824?1073741824:0}function Ig(){var f=no;return no<<=1,(no&4194240)===0&&(no=64),f}function gh(f){for(var p=[],C=0;31>C;C++)p.push(f);return p}function ao(f,p,C){f.pendingLanes|=p,p!==536870912&&(f.suspendedLanes=0,f.pingedLanes=0),f=f.eventTimes,p=31-tr(p),f[p]=C}function b2(f,p){var C=f.pendingLanes&~p;f.pendingLanes=p,f.suspendedLanes=0,f.pingedLanes=0,f.expiredLanes&=p,f.mutableReadLanes&=p,f.entangledLanes&=p,p=f.entanglements;var R=f.eventTimes;for(f=f.expirationTimes;0<C;){var O=31-tr(C),V=1<<O;p[O]=0,R[O]=-1,f[O]=-1,C&=~V}}function mh(f,p){var C=f.entangledLanes|=p;for(f=f.entanglements;C;){var R=31-tr(C),O=1<<R;O&p|f[R]&p&&(f[R]|=p),C&=~O}}var Ft=0;function Og(f){return f&=-f,1<f?4<f?(f&268435455)!==0?16:536870912:4:1}var Bg,yh,jg,Fg,zg,xh=!1,Fl=[],Si=null,Ci=null,Ei=null,so=new Map,oo=new Map,ki=[],w2="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 submit".split(" ");function Hg(f,p){switch(f){case"focusin":case"focusout":Si=null;break;case"dragenter":case"dragleave":Ci=null;break;case"mouseover":case"mouseout":Ei=null;break;case"pointerover":case"pointerout":so.delete(p.pointerId);break;case"gotpointercapture":case"lostpointercapture":oo.delete(p.pointerId)}}function lo(f,p,C,R,O,V){return f===null||f.nativeEvent!==V?(f={blockedOn:p,domEventName:C,eventSystemFlags:R,nativeEvent:V,targetContainers:[O]},p!==null&&(p=So(p),p!==null&&yh(p)),f):(f.eventSystemFlags|=R,p=f.targetContainers,O!==null&&p.indexOf(O)===-1&&p.push(O),f)}function _2(f,p,C,R,O){switch(p){case"focusin":return Si=lo(Si,f,p,C,R,O),!0;case"dragenter":return Ci=lo(Ci,f,p,C,R,O),!0;case"mouseover":return Ei=lo(Ei,f,p,C,R,O),!0;case"pointerover":var V=O.pointerId;return so.set(V,lo(so.get(V)||null,f,p,C,R,O)),!0;case"gotpointercapture":return V=O.pointerId,oo.set(V,lo(oo.get(V)||null,f,p,C,R,O)),!0}return!1}function Ug(f){var p=da(f.target);if(p!==null){var C=Mt(p);if(C!==null){if(p=C.tag,p===13){if(p=Qt(C),p!==null){f.blockedOn=p,zg(f.priority,function(){jg(C)});return}}else if(p===3&&C.stateNode.current.memoizedState.isDehydrated){f.blockedOn=C.tag===3?C.stateNode.containerInfo:null;return}}}f.blockedOn=null}function zl(f){if(f.blockedOn!==null)return!1;for(var p=f.targetContainers;0<p.length;){var C=wh(f.domEventName,f.eventSystemFlags,p[0],f.nativeEvent);if(C===null){C=f.nativeEvent;var R=new C.constructor(C.type,C);be=R,C.target.dispatchEvent(R),be=null}else return p=So(C),p!==null&&yh(p),f.blockedOn=C,!1;p.shift()}return!0}function Wg(f,p,C){zl(f)&&C.delete(p)}function S2(){xh=!1,Si!==null&&zl(Si)&&(Si=null),Ci!==null&&zl(Ci)&&(Ci=null),Ei!==null&&zl(Ei)&&(Ei=null),so.forEach(Wg),oo.forEach(Wg)}function uo(f,p){f.blockedOn===p&&(f.blockedOn=null,xh||(xh=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,S2)))}function co(f){function p(O){return uo(O,f)}if(0<Fl.length){uo(Fl[0],f);for(var C=1;C<Fl.length;C++){var R=Fl[C];R.blockedOn===f&&(R.blockedOn=null)}}for(Si!==null&&uo(Si,f),Ci!==null&&uo(Ci,f),Ei!==null&&uo(Ei,f),so.forEach(p),oo.forEach(p),C=0;C<ki.length;C++)R=ki[C],R.blockedOn===f&&(R.blockedOn=null);for(;0<ki.length&&(C=ki[0],C.blockedOn===null);)Ug(C),C.blockedOn===null&&ki.shift()}var Xa=S.ReactCurrentBatchConfig,Hl=!0;function C2(f,p,C,R){var O=Ft,V=Xa.transition;Xa.transition=null;try{Ft=1,bh(f,p,C,R)}finally{Ft=O,Xa.transition=V}}function E2(f,p,C,R){var O=Ft,V=Xa.transition;Xa.transition=null;try{Ft=4,bh(f,p,C,R)}finally{Ft=O,Xa.transition=V}}function bh(f,p,C,R){if(Hl){var O=wh(f,p,C,R);if(O===null)jh(f,p,R,Ul,C),Hg(f,R);else if(_2(O,f,p,C,R))R.stopPropagation();else if(Hg(f,R),p&4&&-1<w2.indexOf(f)){for(;O!==null;){var V=So(O);if(V!==null&&Bg(V),V=wh(f,p,C,R),V===null&&jh(f,p,R,Ul,C),V===O)break;O=V}O!==null&&R.stopPropagation()}else jh(f,p,R,null,C)}}var Ul=null;function wh(f,p,C,R){if(Ul=null,f=Se(R),f=da(f),f!==null)if(p=Mt(f),p===null)f=null;else if(C=p.tag,C===13){if(f=Qt(p),f!==null)return f;f=null}else if(C===3){if(p.stateNode.current.memoizedState.isDehydrated)return p.tag===3?p.stateNode.containerInfo:null;f=null}else p!==f&&(f=null);return Ul=f,null}function Vg(f){switch(f){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"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 1;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"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(ro()){case cn:return 1;case ai:return 4;case bn:case wi:return 16;case _i:return 536870912;default:return 16}default:return 16}}var Ti=null,_h=null,Wl=null;function $g(){if(Wl)return Wl;var f,p=_h,C=p.length,R,O="value"in Ti?Ti.value:Ti.textContent,V=O.length;for(f=0;f<C&&p[f]===O[f];f++);var Q=C-f;for(R=1;R<=Q&&p[C-R]===O[V-R];R++);return Wl=O.slice(f,1<R?1-R:void 0)}function Vl(f){var p=f.keyCode;return"charCode"in f?(f=f.charCode,f===0&&p===13&&(f=13)):f=p,f===10&&(f=13),32<=f||f===13?f:0}function $l(){return!0}function Gg(){return!1}function fn(f){function p(C,R,O,V,Q){this._reactName=C,this._targetInst=O,this.type=R,this.nativeEvent=V,this.target=Q,this.currentTarget=null;for(var le in f)f.hasOwnProperty(le)&&(C=f[le],this[le]=C?C(V):V[le]);return this.isDefaultPrevented=(V.defaultPrevented!=null?V.defaultPrevented:V.returnValue===!1)?$l:Gg,this.isPropagationStopped=Gg,this}return P(p.prototype,{preventDefault:function(){this.defaultPrevented=!0;var C=this.nativeEvent;C&&(C.preventDefault?C.preventDefault():typeof C.returnValue!="unknown"&&(C.returnValue=!1),this.isDefaultPrevented=$l)},stopPropagation:function(){var C=this.nativeEvent;C&&(C.stopPropagation?C.stopPropagation():typeof C.cancelBubble!="unknown"&&(C.cancelBubble=!0),this.isPropagationStopped=$l)},persist:function(){},isPersistent:$l}),p}var Ka={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(f){return f.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Sh=fn(Ka),ho=P({},Ka,{view:0,detail:0}),k2=fn(ho),Ch,Eh,fo,Gl=P({},ho,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Th,button:0,buttons:0,relatedTarget:function(f){return f.relatedTarget===void 0?f.fromElement===f.srcElement?f.toElement:f.fromElement:f.relatedTarget},movementX:function(f){return"movementX"in f?f.movementX:(f!==fo&&(fo&&f.type==="mousemove"?(Ch=f.screenX-fo.screenX,Eh=f.screenY-fo.screenY):Eh=Ch=0,fo=f),Ch)},movementY:function(f){return"movementY"in f?f.movementY:Eh}}),qg=fn(Gl),T2=P({},Gl,{dataTransfer:0}),N2=fn(T2),R2=P({},ho,{relatedTarget:0}),kh=fn(R2),L2=P({},Ka,{animationName:0,elapsedTime:0,pseudoElement:0}),D2=fn(L2),A2=P({},Ka,{clipboardData:function(f){return"clipboardData"in f?f.clipboardData:window.clipboardData}}),M2=fn(A2),P2=P({},Ka,{data:0}),Yg=fn(P2),I2={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},O2={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"},B2={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function j2(f){var p=this.nativeEvent;return p.getModifierState?p.getModifierState(f):(f=B2[f])?!!p[f]:!1}function Th(){return j2}var F2=P({},ho,{key:function(f){if(f.key){var p=I2[f.key]||f.key;if(p!=="Unidentified")return p}return f.type==="keypress"?(f=Vl(f),f===13?"Enter":String.fromCharCode(f)):f.type==="keydown"||f.type==="keyup"?O2[f.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Th,charCode:function(f){return f.type==="keypress"?Vl(f):0},keyCode:function(f){return f.type==="keydown"||f.type==="keyup"?f.keyCode:0},which:function(f){return f.type==="keypress"?Vl(f):f.type==="keydown"||f.type==="keyup"?f.keyCode:0}}),z2=fn(F2),H2=P({},Gl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Xg=fn(H2),U2=P({},ho,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Th}),W2=fn(U2),V2=P({},Ka,{propertyName:0,elapsedTime:0,pseudoElement:0}),$2=fn(V2),G2=P({},Gl,{deltaX:function(f){return"deltaX"in f?f.deltaX:"wheelDeltaX"in f?-f.wheelDeltaX:0},deltaY:function(f){return"deltaY"in f?f.deltaY:"wheelDeltaY"in f?-f.wheelDeltaY:"wheelDelta"in f?-f.wheelDelta:0},deltaZ:0,deltaMode:0}),q2=fn(G2),Y2=[9,13,27,32],Nh=a&&"CompositionEvent"in window,po=null;a&&"documentMode"in document&&(po=document.documentMode);var X2=a&&"TextEvent"in window&&!po,Kg=a&&(!Nh||po&&8<po&&11>=po),Qg=" ",Zg=!1;function Jg(f,p){switch(f){case"keyup":return Y2.indexOf(p.keyCode)!==-1;case"keydown":return p.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function em(f){return f=f.detail,typeof f=="object"&&"data"in f?f.data:null}var Qa=!1;function K2(f,p){switch(f){case"compositionend":return em(p);case"keypress":return p.which!==32?null:(Zg=!0,Qg);case"textInput":return f=p.data,f===Qg&&Zg?null:f;default:return null}}function Q2(f,p){if(Qa)return f==="compositionend"||!Nh&&Jg(f,p)?(f=$g(),Wl=_h=Ti=null,Qa=!1,f):null;switch(f){case"paste":return null;case"keypress":if(!(p.ctrlKey||p.altKey||p.metaKey)||p.ctrlKey&&p.altKey){if(p.char&&1<p.char.length)return p.char;if(p.which)return String.fromCharCode(p.which)}return null;case"compositionend":return Kg&&p.locale!=="ko"?null:p.data;default:return null}}var Z2={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 tm(f){var p=f&&f.nodeName&&f.nodeName.toLowerCase();return p==="input"?!!Z2[f.type]:p==="textarea"}function rm(f,p,C,R){Ge(R),p=Ql(p,"onChange"),0<p.length&&(C=new Sh("onChange","change",null,C,R),f.push({event:C,listeners:p}))}var vo=null,go=null;function J2(f){bm(f,0)}function ql(f){var p=rs(f);if(re(p))return f}function eC(f,p){if(f==="change")return p}var nm=!1;if(a){var Rh;if(a){var Lh="oninput"in document;if(!Lh){var im=document.createElement("div");im.setAttribute("oninput","return;"),Lh=typeof im.oninput=="function"}Rh=Lh}else Rh=!1;nm=Rh&&(!document.documentMode||9<document.documentMode)}function am(){vo&&(vo.detachEvent("onpropertychange",sm),go=vo=null)}function sm(f){if(f.propertyName==="value"&&ql(go)){var p=[];rm(p,go,f,Se(f)),Ze(J2,p)}}function tC(f,p,C){f==="focusin"?(am(),vo=p,go=C,vo.attachEvent("onpropertychange",sm)):f==="focusout"&&am()}function rC(f){if(f==="selectionchange"||f==="keyup"||f==="keydown")return ql(go)}function nC(f,p){if(f==="click")return ql(p)}function iC(f,p){if(f==="input"||f==="change")return ql(p)}function aC(f,p){return f===p&&(f!==0||1/f===1/p)||f!==f&&p!==p}var Mn=typeof Object.is=="function"?Object.is:aC;function mo(f,p){if(Mn(f,p))return!0;if(typeof f!="object"||f===null||typeof p!="object"||p===null)return!1;var C=Object.keys(f),R=Object.keys(p);if(C.length!==R.length)return!1;for(R=0;R<C.length;R++){var O=C[R];if(!l.call(p,O)||!Mn(f[O],p[O]))return!1}return!0}function om(f){for(;f&&f.firstChild;)f=f.firstChild;return f}function lm(f,p){var C=om(f);f=0;for(var R;C;){if(C.nodeType===3){if(R=f+C.textContent.length,f<=p&&R>=p)return{node:C,offset:p-f};f=R}e:{for(;C;){if(C.nextSibling){C=C.nextSibling;break e}C=C.parentNode}C=void 0}C=om(C)}}function um(f,p){return f&&p?f===p?!0:f&&f.nodeType===3?!1:p&&p.nodeType===3?um(f,p.parentNode):"contains"in f?f.contains(p):f.compareDocumentPosition?!!(f.compareDocumentPosition(p)&16):!1:!1}function cm(){for(var f=window,p=ce();p instanceof f.HTMLIFrameElement;){try{var C=typeof p.contentWindow.location.href=="string"}catch{C=!1}if(C)f=p.contentWindow;else break;p=ce(f.document)}return p}function Dh(f){var p=f&&f.nodeName&&f.nodeName.toLowerCase();return p&&(p==="input"&&(f.type==="text"||f.type==="search"||f.type==="tel"||f.type==="url"||f.type==="password")||p==="textarea"||f.contentEditable==="true")}function sC(f){var p=cm(),C=f.focusedElem,R=f.selectionRange;if(p!==C&&C&&C.ownerDocument&&um(C.ownerDocument.documentElement,C)){if(R!==null&&Dh(C)){if(p=R.start,f=R.end,f===void 0&&(f=p),"selectionStart"in C)C.selectionStart=p,C.selectionEnd=Math.min(f,C.value.length);else if(f=(p=C.ownerDocument||document)&&p.defaultView||window,f.getSelection){f=f.getSelection();var O=C.textContent.length,V=Math.min(R.start,O);R=R.end===void 0?V:Math.min(R.end,O),!f.extend&&V>R&&(O=R,R=V,V=O),O=lm(C,V);var Q=lm(C,R);O&&Q&&(f.rangeCount!==1||f.anchorNode!==O.node||f.anchorOffset!==O.offset||f.focusNode!==Q.node||f.focusOffset!==Q.offset)&&(p=p.createRange(),p.setStart(O.node,O.offset),f.removeAllRanges(),V>R?(f.addRange(p),f.extend(Q.node,Q.offset)):(p.setEnd(Q.node,Q.offset),f.addRange(p)))}}for(p=[],f=C;f=f.parentNode;)f.nodeType===1&&p.push({element:f,left:f.scrollLeft,top:f.scrollTop});for(typeof C.focus=="function"&&C.focus(),C=0;C<p.length;C++)f=p[C],f.element.scrollLeft=f.left,f.element.scrollTop=f.top}}var oC=a&&"documentMode"in document&&11>=document.documentMode,Za=null,Ah=null,yo=null,Mh=!1;function hm(f,p,C){var R=C.window===C?C.document:C.nodeType===9?C:C.ownerDocument;Mh||Za==null||Za!==ce(R)||(R=Za,"selectionStart"in R&&Dh(R)?R={start:R.selectionStart,end:R.selectionEnd}:(R=(R.ownerDocument&&R.ownerDocument.defaultView||window).getSelection(),R={anchorNode:R.anchorNode,anchorOffset:R.anchorOffset,focusNode:R.focusNode,focusOffset:R.focusOffset}),yo&&mo(yo,R)||(yo=R,R=Ql(Ah,"onSelect"),0<R.length&&(p=new Sh("onSelect","select",null,p,C),f.push({event:p,listeners:R}),p.target=Za)))}function Yl(f,p){var C={};return C[f.toLowerCase()]=p.toLowerCase(),C["Webkit"+f]="webkit"+p,C["Moz"+f]="moz"+p,C}var Ja={animationend:Yl("Animation","AnimationEnd"),animationiteration:Yl("Animation","AnimationIteration"),animationstart:Yl("Animation","AnimationStart"),transitionend:Yl("Transition","TransitionEnd")},Ph={},fm={};a&&(fm=document.createElement("div").style,"AnimationEvent"in window||(delete Ja.animationend.animation,delete Ja.animationiteration.animation,delete Ja.animationstart.animation),"TransitionEvent"in window||delete Ja.transitionend.transition);function Xl(f){if(Ph[f])return Ph[f];if(!Ja[f])return f;var p=Ja[f],C;for(C in p)if(p.hasOwnProperty(C)&&C in fm)return Ph[f]=p[C];return f}var dm=Xl("animationend"),pm=Xl("animationiteration"),vm=Xl("animationstart"),gm=Xl("transitionend"),mm=new Map,ym="abort auxClick 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(" ");function Ni(f,p){mm.set(f,p),s(p,[f])}for(var Ih=0;Ih<ym.length;Ih++){var Oh=ym[Ih],lC=Oh.toLowerCase(),uC=Oh[0].toUpperCase()+Oh.slice(1);Ni(lC,"on"+uC)}Ni(dm,"onAnimationEnd"),Ni(pm,"onAnimationIteration"),Ni(vm,"onAnimationStart"),Ni("dblclick","onDoubleClick"),Ni("focusin","onFocus"),Ni("focusout","onBlur"),Ni(gm,"onTransitionEnd"),o("onMouseEnter",["mouseout","mouseover"]),o("onMouseLeave",["mouseout","mouseover"]),o("onPointerEnter",["pointerout","pointerover"]),o("onPointerLeave",["pointerout","pointerover"]),s("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),s("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),s("onBeforeInput",["compositionend","keypress","textInput","paste"]),s("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),s("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),s("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var xo="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(" "),cC=new Set("cancel close invalid load scroll toggle".split(" ").concat(xo));function xm(f,p,C){var R=f.type||"unknown-event";f.currentTarget=C,cr(R,p,void 0,f),f.currentTarget=null}function bm(f,p){p=(p&4)!==0;for(var C=0;C<f.length;C++){var R=f[C],O=R.event;R=R.listeners;e:{var V=void 0;if(p)for(var Q=R.length-1;0<=Q;Q--){var le=R[Q],fe=le.instance,we=le.currentTarget;if(le=le.listener,fe!==V&&O.isPropagationStopped())break e;xm(O,le,we),V=fe}else for(Q=0;Q<R.length;Q++){if(le=R[Q],fe=le.instance,we=le.currentTarget,le=le.listener,fe!==V&&O.isPropagationStopped())break e;xm(O,le,we),V=fe}}}if(Ot)throw f=Tt,Ot=!1,Tt=null,f}function Yt(f,p){var C=p[Vh];C===void 0&&(C=p[Vh]=new Set);var R=f+"__bubble";C.has(R)||(wm(p,f,2,!1),C.add(R))}function Bh(f,p,C){var R=0;p&&(R|=4),wm(C,f,R,p)}var Kl="_reactListening"+Math.random().toString(36).slice(2);function bo(f){if(!f[Kl]){f[Kl]=!0,n.forEach(function(C){C!=="selectionchange"&&(cC.has(C)||Bh(C,!1,f),Bh(C,!0,f))});var p=f.nodeType===9?f:f.ownerDocument;p===null||p[Kl]||(p[Kl]=!0,Bh("selectionchange",!1,p))}}function wm(f,p,C,R){switch(Vg(p)){case 1:var O=C2;break;case 4:O=E2;break;default:O=bh}C=O.bind(null,p,C,f),O=void 0,!wt||p!=="touchstart"&&p!=="touchmove"&&p!=="wheel"||(O=!0),R?O!==void 0?f.addEventListener(p,C,{capture:!0,passive:O}):f.addEventListener(p,C,!0):O!==void 0?f.addEventListener(p,C,{passive:O}):f.addEventListener(p,C,!1)}function jh(f,p,C,R,O){var V=R;if((p&1)===0&&(p&2)===0&&R!==null)e:for(;;){if(R===null)return;var Q=R.tag;if(Q===3||Q===4){var le=R.stateNode.containerInfo;if(le===O||le.nodeType===8&&le.parentNode===O)break;if(Q===4)for(Q=R.return;Q!==null;){var fe=Q.tag;if((fe===3||fe===4)&&(fe=Q.stateNode.containerInfo,fe===O||fe.nodeType===8&&fe.parentNode===O))return;Q=Q.return}for(;le!==null;){if(Q=da(le),Q===null)return;if(fe=Q.tag,fe===5||fe===6){R=V=Q;continue e}le=le.parentNode}}R=R.return}Ze(function(){var we=V,je=Se(C),Ue=[];e:{var Be=mm.get(f);if(Be!==void 0){var et=Sh,it=f;switch(f){case"keypress":if(Vl(C)===0)break e;case"keydown":case"keyup":et=z2;break;case"focusin":it="focus",et=kh;break;case"focusout":it="blur",et=kh;break;case"beforeblur":case"afterblur":et=kh;break;case"click":if(C.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":et=qg;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":et=N2;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":et=W2;break;case dm:case pm:case vm:et=D2;break;case gm:et=$2;break;case"scroll":et=k2;break;case"wheel":et=q2;break;case"copy":case"cut":case"paste":et=M2;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":et=Xg}var ot=(p&4)!==0,lr=!ot&&f==="scroll",ye=ot?Be!==null?Be+"Capture":null:Be;ot=[];for(var ve=we,xe;ve!==null;){xe=ve;var $e=xe.stateNode;if(xe.tag===5&&$e!==null&&(xe=$e,ye!==null&&($e=Qe(ve,ye),$e!=null&&ot.push(wo(ve,$e,xe)))),lr)break;ve=ve.return}0<ot.length&&(Be=new et(Be,it,null,C,je),Ue.push({event:Be,listeners:ot}))}}if((p&7)===0){e:{if(Be=f==="mouseover"||f==="pointerover",et=f==="mouseout"||f==="pointerout",Be&&C!==be&&(it=C.relatedTarget||C.fromElement)&&(da(it)||it[si]))break e;if((et||Be)&&(Be=je.window===je?je:(Be=je.ownerDocument)?Be.defaultView||Be.parentWindow:window,et?(it=C.relatedTarget||C.toElement,et=we,it=it?da(it):null,it!==null&&(lr=Mt(it),it!==lr||it.tag!==5&&it.tag!==6)&&(it=null)):(et=null,it=we),et!==it)){if(ot=qg,$e="onMouseLeave",ye="onMouseEnter",ve="mouse",(f==="pointerout"||f==="pointerover")&&(ot=Xg,$e="onPointerLeave",ye="onPointerEnter",ve="pointer"),lr=et==null?Be:rs(et),xe=it==null?Be:rs(it),Be=new ot($e,ve+"leave",et,C,je),Be.target=lr,Be.relatedTarget=xe,$e=null,da(je)===we&&(ot=new ot(ye,ve+"enter",it,C,je),ot.target=xe,ot.relatedTarget=lr,$e=ot),lr=$e,et&&it)t:{for(ot=et,ye=it,ve=0,xe=ot;xe;xe=es(xe))ve++;for(xe=0,$e=ye;$e;$e=es($e))xe++;for(;0<ve-xe;)ot=es(ot),ve--;for(;0<xe-ve;)ye=es(ye),xe--;for(;ve--;){if(ot===ye||ye!==null&&ot===ye.alternate)break t;ot=es(ot),ye=es(ye)}ot=null}else ot=null;et!==null&&_m(Ue,Be,et,ot,!1),it!==null&&lr!==null&&_m(Ue,lr,it,ot,!0)}}e:{if(Be=we?rs(we):window,et=Be.nodeName&&Be.nodeName.toLowerCase(),et==="select"||et==="input"&&Be.type==="file")var ut=eC;else if(tm(Be))if(nm)ut=iC;else{ut=rC;var ht=tC}else(et=Be.nodeName)&&et.toLowerCase()==="input"&&(Be.type==="checkbox"||Be.type==="radio")&&(ut=nC);if(ut&&(ut=ut(f,we))){rm(Ue,ut,C,je);break e}ht&&ht(f,Be,we),f==="focusout"&&(ht=Be._wrapperState)&&ht.controlled&&Be.type==="number"&&Le(Be,"number",Be.value)}switch(ht=we?rs(we):window,f){case"focusin":(tm(ht)||ht.contentEditable==="true")&&(Za=ht,Ah=we,yo=null);break;case"focusout":yo=Ah=Za=null;break;case"mousedown":Mh=!0;break;case"contextmenu":case"mouseup":case"dragend":Mh=!1,hm(Ue,C,je);break;case"selectionchange":if(oC)break;case"keydown":case"keyup":hm(Ue,C,je)}var ft;if(Nh)e:{switch(f){case"compositionstart":var mt="onCompositionStart";break e;case"compositionend":mt="onCompositionEnd";break e;case"compositionupdate":mt="onCompositionUpdate";break e}mt=void 0}else Qa?Jg(f,C)&&(mt="onCompositionEnd"):f==="keydown"&&C.keyCode===229&&(mt="onCompositionStart");mt&&(Kg&&C.locale!=="ko"&&(Qa||mt!=="onCompositionStart"?mt==="onCompositionEnd"&&Qa&&(ft=$g()):(Ti=je,_h="value"in Ti?Ti.value:Ti.textContent,Qa=!0)),ht=Ql(we,mt),0<ht.length&&(mt=new Yg(mt,f,null,C,je),Ue.push({event:mt,listeners:ht}),ft?mt.data=ft:(ft=em(C),ft!==null&&(mt.data=ft)))),(ft=X2?K2(f,C):Q2(f,C))&&(we=Ql(we,"onBeforeInput"),0<we.length&&(je=new Yg("onBeforeInput","beforeinput",null,C,je),Ue.push({event:je,listeners:we}),je.data=ft))}bm(Ue,p)})}function wo(f,p,C){return{instance:f,listener:p,currentTarget:C}}function Ql(f,p){for(var C=p+"Capture",R=[];f!==null;){var O=f,V=O.stateNode;O.tag===5&&V!==null&&(O=V,V=Qe(f,C),V!=null&&R.unshift(wo(f,V,O)),V=Qe(f,p),V!=null&&R.push(wo(f,V,O))),f=f.return}return R}function es(f){if(f===null)return null;do f=f.return;while(f&&f.tag!==5);return f||null}function _m(f,p,C,R,O){for(var V=p._reactName,Q=[];C!==null&&C!==R;){var le=C,fe=le.alternate,we=le.stateNode;if(fe!==null&&fe===R)break;le.tag===5&&we!==null&&(le=we,O?(fe=Qe(C,V),fe!=null&&Q.unshift(wo(C,fe,le))):O||(fe=Qe(C,V),fe!=null&&Q.push(wo(C,fe,le)))),C=C.return}Q.length!==0&&f.push({event:p,listeners:Q})}var hC=/\r\n?/g,fC=/\u0000|\uFFFD/g;function Sm(f){return(typeof f=="string"?f:""+f).replace(hC,`
38
- `).replace(fC,"")}function Zl(f,p,C){if(p=Sm(p),Sm(f)!==p&&C)throw Error(r(425))}function Jl(){}var Fh=null,zh=null;function Hh(f,p){return f==="textarea"||f==="noscript"||typeof p.children=="string"||typeof p.children=="number"||typeof p.dangerouslySetInnerHTML=="object"&&p.dangerouslySetInnerHTML!==null&&p.dangerouslySetInnerHTML.__html!=null}var Uh=typeof setTimeout=="function"?setTimeout:void 0,dC=typeof clearTimeout=="function"?clearTimeout:void 0,Cm=typeof Promise=="function"?Promise:void 0,pC=typeof queueMicrotask=="function"?queueMicrotask:typeof Cm<"u"?function(f){return Cm.resolve(null).then(f).catch(vC)}:Uh;function vC(f){setTimeout(function(){throw f})}function Wh(f,p){var C=p,R=0;do{var O=C.nextSibling;if(f.removeChild(C),O&&O.nodeType===8)if(C=O.data,C==="/$"){if(R===0){f.removeChild(O),co(p);return}R--}else C!=="$"&&C!=="$?"&&C!=="$!"||R++;C=O}while(C);co(p)}function Ri(f){for(;f!=null;f=f.nextSibling){var p=f.nodeType;if(p===1||p===3)break;if(p===8){if(p=f.data,p==="$"||p==="$!"||p==="$?")break;if(p==="/$")return null}}return f}function Em(f){f=f.previousSibling;for(var p=0;f;){if(f.nodeType===8){var C=f.data;if(C==="$"||C==="$!"||C==="$?"){if(p===0)return f;p--}else C==="/$"&&p++}f=f.previousSibling}return null}var ts=Math.random().toString(36).slice(2),Vn="__reactFiber$"+ts,_o="__reactProps$"+ts,si="__reactContainer$"+ts,Vh="__reactEvents$"+ts,gC="__reactListeners$"+ts,mC="__reactHandles$"+ts;function da(f){var p=f[Vn];if(p)return p;for(var C=f.parentNode;C;){if(p=C[si]||C[Vn]){if(C=p.alternate,p.child!==null||C!==null&&C.child!==null)for(f=Em(f);f!==null;){if(C=f[Vn])return C;f=Em(f)}return p}f=C,C=f.parentNode}return null}function So(f){return f=f[Vn]||f[si],!f||f.tag!==5&&f.tag!==6&&f.tag!==13&&f.tag!==3?null:f}function rs(f){if(f.tag===5||f.tag===6)return f.stateNode;throw Error(r(33))}function eu(f){return f[_o]||null}var $h=[],ns=-1;function Li(f){return{current:f}}function Xt(f){0>ns||(f.current=$h[ns],$h[ns]=null,ns--)}function $t(f,p){ns++,$h[ns]=f.current,f.current=p}var Di={},Or=Li(Di),Jr=Li(!1),pa=Di;function is(f,p){var C=f.type.contextTypes;if(!C)return Di;var R=f.stateNode;if(R&&R.__reactInternalMemoizedUnmaskedChildContext===p)return R.__reactInternalMemoizedMaskedChildContext;var O={},V;for(V in C)O[V]=p[V];return R&&(f=f.stateNode,f.__reactInternalMemoizedUnmaskedChildContext=p,f.__reactInternalMemoizedMaskedChildContext=O),O}function en(f){return f=f.childContextTypes,f!=null}function tu(){Xt(Jr),Xt(Or)}function km(f,p,C){if(Or.current!==Di)throw Error(r(168));$t(Or,p),$t(Jr,C)}function Tm(f,p,C){var R=f.stateNode;if(p=p.childContextTypes,typeof R.getChildContext!="function")return C;R=R.getChildContext();for(var O in R)if(!(O in p))throw Error(r(108,K(f)||"Unknown",O));return P({},C,R)}function ru(f){return f=(f=f.stateNode)&&f.__reactInternalMemoizedMergedChildContext||Di,pa=Or.current,$t(Or,f),$t(Jr,Jr.current),!0}function Nm(f,p,C){var R=f.stateNode;if(!R)throw Error(r(169));C?(f=Tm(f,p,pa),R.__reactInternalMemoizedMergedChildContext=f,Xt(Jr),Xt(Or),$t(Or,f)):Xt(Jr),$t(Jr,C)}var oi=null,nu=!1,Gh=!1;function Rm(f){oi===null?oi=[f]:oi.push(f)}function yC(f){nu=!0,Rm(f)}function Ai(){if(!Gh&&oi!==null){Gh=!0;var f=0,p=Ft;try{var C=oi;for(Ft=1;f<C.length;f++){var R=C[f];do R=R(!0);while(R!==null)}oi=null,nu=!1}catch(O){throw oi!==null&&(oi=oi.slice(f+1)),An(cn,Ai),O}finally{Ft=p,Gh=!1}}return null}var as=[],ss=0,iu=null,au=0,wn=[],_n=0,va=null,li=1,ui="";function ga(f,p){as[ss++]=au,as[ss++]=iu,iu=f,au=p}function Lm(f,p,C){wn[_n++]=li,wn[_n++]=ui,wn[_n++]=va,va=f;var R=li;f=ui;var O=32-tr(R)-1;R&=~(1<<O),C+=1;var V=32-tr(p)+O;if(30<V){var Q=O-O%5;V=(R&(1<<Q)-1).toString(32),R>>=Q,O-=Q,li=1<<32-tr(p)+O|C<<O|R,ui=V+f}else li=1<<V|C<<O|R,ui=f}function qh(f){f.return!==null&&(ga(f,1),Lm(f,1,0))}function Yh(f){for(;f===iu;)iu=as[--ss],as[ss]=null,au=as[--ss],as[ss]=null;for(;f===va;)va=wn[--_n],wn[_n]=null,ui=wn[--_n],wn[_n]=null,li=wn[--_n],wn[_n]=null}var dn=null,pn=null,Jt=!1,Pn=null;function Dm(f,p){var C=kn(5,null,null,0);C.elementType="DELETED",C.stateNode=p,C.return=f,p=f.deletions,p===null?(f.deletions=[C],f.flags|=16):p.push(C)}function Am(f,p){switch(f.tag){case 5:var C=f.type;return p=p.nodeType!==1||C.toLowerCase()!==p.nodeName.toLowerCase()?null:p,p!==null?(f.stateNode=p,dn=f,pn=Ri(p.firstChild),!0):!1;case 6:return p=f.pendingProps===""||p.nodeType!==3?null:p,p!==null?(f.stateNode=p,dn=f,pn=null,!0):!1;case 13:return p=p.nodeType!==8?null:p,p!==null?(C=va!==null?{id:li,overflow:ui}:null,f.memoizedState={dehydrated:p,treeContext:C,retryLane:1073741824},C=kn(18,null,null,0),C.stateNode=p,C.return=f,f.child=C,dn=f,pn=null,!0):!1;default:return!1}}function Xh(f){return(f.mode&1)!==0&&(f.flags&128)===0}function Kh(f){if(Jt){var p=pn;if(p){var C=p;if(!Am(f,p)){if(Xh(f))throw Error(r(418));p=Ri(C.nextSibling);var R=dn;p&&Am(f,p)?Dm(R,C):(f.flags=f.flags&-4097|2,Jt=!1,dn=f)}}else{if(Xh(f))throw Error(r(418));f.flags=f.flags&-4097|2,Jt=!1,dn=f}}}function Mm(f){for(f=f.return;f!==null&&f.tag!==5&&f.tag!==3&&f.tag!==13;)f=f.return;dn=f}function su(f){if(f!==dn)return!1;if(!Jt)return Mm(f),Jt=!0,!1;var p;if((p=f.tag!==3)&&!(p=f.tag!==5)&&(p=f.type,p=p!=="head"&&p!=="body"&&!Hh(f.type,f.memoizedProps)),p&&(p=pn)){if(Xh(f))throw Pm(),Error(r(418));for(;p;)Dm(f,p),p=Ri(p.nextSibling)}if(Mm(f),f.tag===13){if(f=f.memoizedState,f=f!==null?f.dehydrated:null,!f)throw Error(r(317));e:{for(f=f.nextSibling,p=0;f;){if(f.nodeType===8){var C=f.data;if(C==="/$"){if(p===0){pn=Ri(f.nextSibling);break e}p--}else C!=="$"&&C!=="$!"&&C!=="$?"||p++}f=f.nextSibling}pn=null}}else pn=dn?Ri(f.stateNode.nextSibling):null;return!0}function Pm(){for(var f=pn;f;)f=Ri(f.nextSibling)}function os(){pn=dn=null,Jt=!1}function Qh(f){Pn===null?Pn=[f]:Pn.push(f)}var xC=S.ReactCurrentBatchConfig;function Co(f,p,C){if(f=C.ref,f!==null&&typeof f!="function"&&typeof f!="object"){if(C._owner){if(C=C._owner,C){if(C.tag!==1)throw Error(r(309));var R=C.stateNode}if(!R)throw Error(r(147,f));var O=R,V=""+f;return p!==null&&p.ref!==null&&typeof p.ref=="function"&&p.ref._stringRef===V?p.ref:(p=function(Q){var le=O.refs;Q===null?delete le[V]:le[V]=Q},p._stringRef=V,p)}if(typeof f!="string")throw Error(r(284));if(!C._owner)throw Error(r(290,f))}return f}function ou(f,p){throw f=Object.prototype.toString.call(p),Error(r(31,f==="[object Object]"?"object with keys {"+Object.keys(p).join(", ")+"}":f))}function Im(f){var p=f._init;return p(f._payload)}function Om(f){function p(ye,ve){if(f){var xe=ye.deletions;xe===null?(ye.deletions=[ve],ye.flags|=16):xe.push(ve)}}function C(ye,ve){if(!f)return null;for(;ve!==null;)p(ye,ve),ve=ve.sibling;return null}function R(ye,ve){for(ye=new Map;ve!==null;)ve.key!==null?ye.set(ve.key,ve):ye.set(ve.index,ve),ve=ve.sibling;return ye}function O(ye,ve){return ye=zi(ye,ve),ye.index=0,ye.sibling=null,ye}function V(ye,ve,xe){return ye.index=xe,f?(xe=ye.alternate,xe!==null?(xe=xe.index,xe<ve?(ye.flags|=2,ve):xe):(ye.flags|=2,ve)):(ye.flags|=1048576,ve)}function Q(ye){return f&&ye.alternate===null&&(ye.flags|=2),ye}function le(ye,ve,xe,$e){return ve===null||ve.tag!==6?(ve=Wf(xe,ye.mode,$e),ve.return=ye,ve):(ve=O(ve,xe),ve.return=ye,ve)}function fe(ye,ve,xe,$e){var ut=xe.type;return ut===T?je(ye,ve,xe.props.children,$e,xe.key):ve!==null&&(ve.elementType===ut||typeof ut=="object"&&ut!==null&&ut.$$typeof===U&&Im(ut)===ve.type)?($e=O(ve,xe.props),$e.ref=Co(ye,ve,xe),$e.return=ye,$e):($e=Du(xe.type,xe.key,xe.props,null,ye.mode,$e),$e.ref=Co(ye,ve,xe),$e.return=ye,$e)}function we(ye,ve,xe,$e){return ve===null||ve.tag!==4||ve.stateNode.containerInfo!==xe.containerInfo||ve.stateNode.implementation!==xe.implementation?(ve=Vf(xe,ye.mode,$e),ve.return=ye,ve):(ve=O(ve,xe.children||[]),ve.return=ye,ve)}function je(ye,ve,xe,$e,ut){return ve===null||ve.tag!==7?(ve=Ca(xe,ye.mode,$e,ut),ve.return=ye,ve):(ve=O(ve,xe),ve.return=ye,ve)}function Ue(ye,ve,xe){if(typeof ve=="string"&&ve!==""||typeof ve=="number")return ve=Wf(""+ve,ye.mode,xe),ve.return=ye,ve;if(typeof ve=="object"&&ve!==null){switch(ve.$$typeof){case N:return xe=Du(ve.type,ve.key,ve.props,null,ye.mode,xe),xe.ref=Co(ye,null,ve),xe.return=ye,xe;case E:return ve=Vf(ve,ye.mode,xe),ve.return=ye,ve;case U:var $e=ve._init;return Ue(ye,$e(ve._payload),xe)}if(Ee(ve)||F(ve))return ve=Ca(ve,ye.mode,xe,null),ve.return=ye,ve;ou(ye,ve)}return null}function Be(ye,ve,xe,$e){var ut=ve!==null?ve.key:null;if(typeof xe=="string"&&xe!==""||typeof xe=="number")return ut!==null?null:le(ye,ve,""+xe,$e);if(typeof xe=="object"&&xe!==null){switch(xe.$$typeof){case N:return xe.key===ut?fe(ye,ve,xe,$e):null;case E:return xe.key===ut?we(ye,ve,xe,$e):null;case U:return ut=xe._init,Be(ye,ve,ut(xe._payload),$e)}if(Ee(xe)||F(xe))return ut!==null?null:je(ye,ve,xe,$e,null);ou(ye,xe)}return null}function et(ye,ve,xe,$e,ut){if(typeof $e=="string"&&$e!==""||typeof $e=="number")return ye=ye.get(xe)||null,le(ve,ye,""+$e,ut);if(typeof $e=="object"&&$e!==null){switch($e.$$typeof){case N:return ye=ye.get($e.key===null?xe:$e.key)||null,fe(ve,ye,$e,ut);case E:return ye=ye.get($e.key===null?xe:$e.key)||null,we(ve,ye,$e,ut);case U:var ht=$e._init;return et(ye,ve,xe,ht($e._payload),ut)}if(Ee($e)||F($e))return ye=ye.get(xe)||null,je(ve,ye,$e,ut,null);ou(ve,$e)}return null}function it(ye,ve,xe,$e){for(var ut=null,ht=null,ft=ve,mt=ve=0,Cr=null;ft!==null&&mt<xe.length;mt++){ft.index>mt?(Cr=ft,ft=null):Cr=ft.sibling;var Pt=Be(ye,ft,xe[mt],$e);if(Pt===null){ft===null&&(ft=Cr);break}f&&ft&&Pt.alternate===null&&p(ye,ft),ve=V(Pt,ve,mt),ht===null?ut=Pt:ht.sibling=Pt,ht=Pt,ft=Cr}if(mt===xe.length)return C(ye,ft),Jt&&ga(ye,mt),ut;if(ft===null){for(;mt<xe.length;mt++)ft=Ue(ye,xe[mt],$e),ft!==null&&(ve=V(ft,ve,mt),ht===null?ut=ft:ht.sibling=ft,ht=ft);return Jt&&ga(ye,mt),ut}for(ft=R(ye,ft);mt<xe.length;mt++)Cr=et(ft,ye,mt,xe[mt],$e),Cr!==null&&(f&&Cr.alternate!==null&&ft.delete(Cr.key===null?mt:Cr.key),ve=V(Cr,ve,mt),ht===null?ut=Cr:ht.sibling=Cr,ht=Cr);return f&&ft.forEach(function(Hi){return p(ye,Hi)}),Jt&&ga(ye,mt),ut}function ot(ye,ve,xe,$e){var ut=F(xe);if(typeof ut!="function")throw Error(r(150));if(xe=ut.call(xe),xe==null)throw Error(r(151));for(var ht=ut=null,ft=ve,mt=ve=0,Cr=null,Pt=xe.next();ft!==null&&!Pt.done;mt++,Pt=xe.next()){ft.index>mt?(Cr=ft,ft=null):Cr=ft.sibling;var Hi=Be(ye,ft,Pt.value,$e);if(Hi===null){ft===null&&(ft=Cr);break}f&&ft&&Hi.alternate===null&&p(ye,ft),ve=V(Hi,ve,mt),ht===null?ut=Hi:ht.sibling=Hi,ht=Hi,ft=Cr}if(Pt.done)return C(ye,ft),Jt&&ga(ye,mt),ut;if(ft===null){for(;!Pt.done;mt++,Pt=xe.next())Pt=Ue(ye,Pt.value,$e),Pt!==null&&(ve=V(Pt,ve,mt),ht===null?ut=Pt:ht.sibling=Pt,ht=Pt);return Jt&&ga(ye,mt),ut}for(ft=R(ye,ft);!Pt.done;mt++,Pt=xe.next())Pt=et(ft,ye,mt,Pt.value,$e),Pt!==null&&(f&&Pt.alternate!==null&&ft.delete(Pt.key===null?mt:Pt.key),ve=V(Pt,ve,mt),ht===null?ut=Pt:ht.sibling=Pt,ht=Pt);return f&&ft.forEach(function(ZC){return p(ye,ZC)}),Jt&&ga(ye,mt),ut}function lr(ye,ve,xe,$e){if(typeof xe=="object"&&xe!==null&&xe.type===T&&xe.key===null&&(xe=xe.props.children),typeof xe=="object"&&xe!==null){switch(xe.$$typeof){case N:e:{for(var ut=xe.key,ht=ve;ht!==null;){if(ht.key===ut){if(ut=xe.type,ut===T){if(ht.tag===7){C(ye,ht.sibling),ve=O(ht,xe.props.children),ve.return=ye,ye=ve;break e}}else if(ht.elementType===ut||typeof ut=="object"&&ut!==null&&ut.$$typeof===U&&Im(ut)===ht.type){C(ye,ht.sibling),ve=O(ht,xe.props),ve.ref=Co(ye,ht,xe),ve.return=ye,ye=ve;break e}C(ye,ht);break}else p(ye,ht);ht=ht.sibling}xe.type===T?(ve=Ca(xe.props.children,ye.mode,$e,xe.key),ve.return=ye,ye=ve):($e=Du(xe.type,xe.key,xe.props,null,ye.mode,$e),$e.ref=Co(ye,ve,xe),$e.return=ye,ye=$e)}return Q(ye);case E:e:{for(ht=xe.key;ve!==null;){if(ve.key===ht)if(ve.tag===4&&ve.stateNode.containerInfo===xe.containerInfo&&ve.stateNode.implementation===xe.implementation){C(ye,ve.sibling),ve=O(ve,xe.children||[]),ve.return=ye,ye=ve;break e}else{C(ye,ve);break}else p(ye,ve);ve=ve.sibling}ve=Vf(xe,ye.mode,$e),ve.return=ye,ye=ve}return Q(ye);case U:return ht=xe._init,lr(ye,ve,ht(xe._payload),$e)}if(Ee(xe))return it(ye,ve,xe,$e);if(F(xe))return ot(ye,ve,xe,$e);ou(ye,xe)}return typeof xe=="string"&&xe!==""||typeof xe=="number"?(xe=""+xe,ve!==null&&ve.tag===6?(C(ye,ve.sibling),ve=O(ve,xe),ve.return=ye,ye=ve):(C(ye,ve),ve=Wf(xe,ye.mode,$e),ve.return=ye,ye=ve),Q(ye)):C(ye,ve)}return lr}var ls=Om(!0),Bm=Om(!1),lu=Li(null),uu=null,us=null,Zh=null;function Jh(){Zh=us=uu=null}function ef(f){var p=lu.current;Xt(lu),f._currentValue=p}function tf(f,p,C){for(;f!==null;){var R=f.alternate;if((f.childLanes&p)!==p?(f.childLanes|=p,R!==null&&(R.childLanes|=p)):R!==null&&(R.childLanes&p)!==p&&(R.childLanes|=p),f===C)break;f=f.return}}function cs(f,p){uu=f,Zh=us=null,f=f.dependencies,f!==null&&f.firstContext!==null&&((f.lanes&p)!==0&&(tn=!0),f.firstContext=null)}function Sn(f){var p=f._currentValue;if(Zh!==f)if(f={context:f,memoizedValue:p,next:null},us===null){if(uu===null)throw Error(r(308));us=f,uu.dependencies={lanes:0,firstContext:f}}else us=us.next=f;return p}var ma=null;function rf(f){ma===null?ma=[f]:ma.push(f)}function jm(f,p,C,R){var O=p.interleaved;return O===null?(C.next=C,rf(p)):(C.next=O.next,O.next=C),p.interleaved=C,ci(f,R)}function ci(f,p){f.lanes|=p;var C=f.alternate;for(C!==null&&(C.lanes|=p),C=f,f=f.return;f!==null;)f.childLanes|=p,C=f.alternate,C!==null&&(C.childLanes|=p),C=f,f=f.return;return C.tag===3?C.stateNode:null}var Mi=!1;function nf(f){f.updateQueue={baseState:f.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Fm(f,p){f=f.updateQueue,p.updateQueue===f&&(p.updateQueue={baseState:f.baseState,firstBaseUpdate:f.firstBaseUpdate,lastBaseUpdate:f.lastBaseUpdate,shared:f.shared,effects:f.effects})}function hi(f,p){return{eventTime:f,lane:p,tag:0,payload:null,callback:null,next:null}}function Pi(f,p,C){var R=f.updateQueue;if(R===null)return null;if(R=R.shared,(Lt&2)!==0){var O=R.pending;return O===null?p.next=p:(p.next=O.next,O.next=p),R.pending=p,ci(f,C)}return O=R.interleaved,O===null?(p.next=p,rf(R)):(p.next=O.next,O.next=p),R.interleaved=p,ci(f,C)}function cu(f,p,C){if(p=p.updateQueue,p!==null&&(p=p.shared,(C&4194240)!==0)){var R=p.lanes;R&=f.pendingLanes,C|=R,p.lanes=C,mh(f,C)}}function zm(f,p){var C=f.updateQueue,R=f.alternate;if(R!==null&&(R=R.updateQueue,C===R)){var O=null,V=null;if(C=C.firstBaseUpdate,C!==null){do{var Q={eventTime:C.eventTime,lane:C.lane,tag:C.tag,payload:C.payload,callback:C.callback,next:null};V===null?O=V=Q:V=V.next=Q,C=C.next}while(C!==null);V===null?O=V=p:V=V.next=p}else O=V=p;C={baseState:R.baseState,firstBaseUpdate:O,lastBaseUpdate:V,shared:R.shared,effects:R.effects},f.updateQueue=C;return}f=C.lastBaseUpdate,f===null?C.firstBaseUpdate=p:f.next=p,C.lastBaseUpdate=p}function hu(f,p,C,R){var O=f.updateQueue;Mi=!1;var V=O.firstBaseUpdate,Q=O.lastBaseUpdate,le=O.shared.pending;if(le!==null){O.shared.pending=null;var fe=le,we=fe.next;fe.next=null,Q===null?V=we:Q.next=we,Q=fe;var je=f.alternate;je!==null&&(je=je.updateQueue,le=je.lastBaseUpdate,le!==Q&&(le===null?je.firstBaseUpdate=we:le.next=we,je.lastBaseUpdate=fe))}if(V!==null){var Ue=O.baseState;Q=0,je=we=fe=null,le=V;do{var Be=le.lane,et=le.eventTime;if((R&Be)===Be){je!==null&&(je=je.next={eventTime:et,lane:0,tag:le.tag,payload:le.payload,callback:le.callback,next:null});e:{var it=f,ot=le;switch(Be=p,et=C,ot.tag){case 1:if(it=ot.payload,typeof it=="function"){Ue=it.call(et,Ue,Be);break e}Ue=it;break e;case 3:it.flags=it.flags&-65537|128;case 0:if(it=ot.payload,Be=typeof it=="function"?it.call(et,Ue,Be):it,Be==null)break e;Ue=P({},Ue,Be);break e;case 2:Mi=!0}}le.callback!==null&&le.lane!==0&&(f.flags|=64,Be=O.effects,Be===null?O.effects=[le]:Be.push(le))}else et={eventTime:et,lane:Be,tag:le.tag,payload:le.payload,callback:le.callback,next:null},je===null?(we=je=et,fe=Ue):je=je.next=et,Q|=Be;if(le=le.next,le===null){if(le=O.shared.pending,le===null)break;Be=le,le=Be.next,Be.next=null,O.lastBaseUpdate=Be,O.shared.pending=null}}while(!0);if(je===null&&(fe=Ue),O.baseState=fe,O.firstBaseUpdate=we,O.lastBaseUpdate=je,p=O.shared.interleaved,p!==null){O=p;do Q|=O.lane,O=O.next;while(O!==p)}else V===null&&(O.shared.lanes=0);ba|=Q,f.lanes=Q,f.memoizedState=Ue}}function Hm(f,p,C){if(f=p.effects,p.effects=null,f!==null)for(p=0;p<f.length;p++){var R=f[p],O=R.callback;if(O!==null){if(R.callback=null,R=C,typeof O!="function")throw Error(r(191,O));O.call(R)}}}var Eo={},$n=Li(Eo),ko=Li(Eo),To=Li(Eo);function ya(f){if(f===Eo)throw Error(r(174));return f}function af(f,p){switch($t(To,p),$t(ko,f),$t($n,Eo),f=p.nodeType,f){case 9:case 11:p=(p=p.documentElement)?p.namespaceURI:Ce(null,"");break;default:f=f===8?p.parentNode:p,p=f.namespaceURI||null,f=f.tagName,p=Ce(p,f)}Xt($n),$t($n,p)}function hs(){Xt($n),Xt(ko),Xt(To)}function Um(f){ya(To.current);var p=ya($n.current),C=Ce(p,f.type);p!==C&&($t(ko,f),$t($n,C))}function sf(f){ko.current===f&&(Xt($n),Xt(ko))}var rr=Li(0);function fu(f){for(var p=f;p!==null;){if(p.tag===13){var C=p.memoizedState;if(C!==null&&(C=C.dehydrated,C===null||C.data==="$?"||C.data==="$!"))return p}else if(p.tag===19&&p.memoizedProps.revealOrder!==void 0){if((p.flags&128)!==0)return p}else if(p.child!==null){p.child.return=p,p=p.child;continue}if(p===f)break;for(;p.sibling===null;){if(p.return===null||p.return===f)return null;p=p.return}p.sibling.return=p.return,p=p.sibling}return null}var of=[];function lf(){for(var f=0;f<of.length;f++)of[f]._workInProgressVersionPrimary=null;of.length=0}var du=S.ReactCurrentDispatcher,uf=S.ReactCurrentBatchConfig,xa=0,nr=null,gr=null,_r=null,pu=!1,No=!1,Ro=0,bC=0;function Br(){throw Error(r(321))}function cf(f,p){if(p===null)return!1;for(var C=0;C<p.length&&C<f.length;C++)if(!Mn(f[C],p[C]))return!1;return!0}function hf(f,p,C,R,O,V){if(xa=V,nr=p,p.memoizedState=null,p.updateQueue=null,p.lanes=0,du.current=f===null||f.memoizedState===null?CC:EC,f=C(R,O),No){V=0;do{if(No=!1,Ro=0,25<=V)throw Error(r(301));V+=1,_r=gr=null,p.updateQueue=null,du.current=kC,f=C(R,O)}while(No)}if(du.current=mu,p=gr!==null&&gr.next!==null,xa=0,_r=gr=nr=null,pu=!1,p)throw Error(r(300));return f}function ff(){var f=Ro!==0;return Ro=0,f}function Gn(){var f={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return _r===null?nr.memoizedState=_r=f:_r=_r.next=f,_r}function Cn(){if(gr===null){var f=nr.alternate;f=f!==null?f.memoizedState:null}else f=gr.next;var p=_r===null?nr.memoizedState:_r.next;if(p!==null)_r=p,gr=f;else{if(f===null)throw Error(r(310));gr=f,f={memoizedState:gr.memoizedState,baseState:gr.baseState,baseQueue:gr.baseQueue,queue:gr.queue,next:null},_r===null?nr.memoizedState=_r=f:_r=_r.next=f}return _r}function Lo(f,p){return typeof p=="function"?p(f):p}function df(f){var p=Cn(),C=p.queue;if(C===null)throw Error(r(311));C.lastRenderedReducer=f;var R=gr,O=R.baseQueue,V=C.pending;if(V!==null){if(O!==null){var Q=O.next;O.next=V.next,V.next=Q}R.baseQueue=O=V,C.pending=null}if(O!==null){V=O.next,R=R.baseState;var le=Q=null,fe=null,we=V;do{var je=we.lane;if((xa&je)===je)fe!==null&&(fe=fe.next={lane:0,action:we.action,hasEagerState:we.hasEagerState,eagerState:we.eagerState,next:null}),R=we.hasEagerState?we.eagerState:f(R,we.action);else{var Ue={lane:je,action:we.action,hasEagerState:we.hasEagerState,eagerState:we.eagerState,next:null};fe===null?(le=fe=Ue,Q=R):fe=fe.next=Ue,nr.lanes|=je,ba|=je}we=we.next}while(we!==null&&we!==V);fe===null?Q=R:fe.next=le,Mn(R,p.memoizedState)||(tn=!0),p.memoizedState=R,p.baseState=Q,p.baseQueue=fe,C.lastRenderedState=R}if(f=C.interleaved,f!==null){O=f;do V=O.lane,nr.lanes|=V,ba|=V,O=O.next;while(O!==f)}else O===null&&(C.lanes=0);return[p.memoizedState,C.dispatch]}function pf(f){var p=Cn(),C=p.queue;if(C===null)throw Error(r(311));C.lastRenderedReducer=f;var R=C.dispatch,O=C.pending,V=p.memoizedState;if(O!==null){C.pending=null;var Q=O=O.next;do V=f(V,Q.action),Q=Q.next;while(Q!==O);Mn(V,p.memoizedState)||(tn=!0),p.memoizedState=V,p.baseQueue===null&&(p.baseState=V),C.lastRenderedState=V}return[V,R]}function Wm(){}function Vm(f,p){var C=nr,R=Cn(),O=p(),V=!Mn(R.memoizedState,O);if(V&&(R.memoizedState=O,tn=!0),R=R.queue,vf(qm.bind(null,C,R,f),[f]),R.getSnapshot!==p||V||_r!==null&&_r.memoizedState.tag&1){if(C.flags|=2048,Do(9,Gm.bind(null,C,R,O,p),void 0,null),Sr===null)throw Error(r(349));(xa&30)!==0||$m(C,p,O)}return O}function $m(f,p,C){f.flags|=16384,f={getSnapshot:p,value:C},p=nr.updateQueue,p===null?(p={lastEffect:null,stores:null},nr.updateQueue=p,p.stores=[f]):(C=p.stores,C===null?p.stores=[f]:C.push(f))}function Gm(f,p,C,R){p.value=C,p.getSnapshot=R,Ym(p)&&Xm(f)}function qm(f,p,C){return C(function(){Ym(p)&&Xm(f)})}function Ym(f){var p=f.getSnapshot;f=f.value;try{var C=p();return!Mn(f,C)}catch{return!0}}function Xm(f){var p=ci(f,1);p!==null&&jn(p,f,1,-1)}function Km(f){var p=Gn();return typeof f=="function"&&(f=f()),p.memoizedState=p.baseState=f,f={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Lo,lastRenderedState:f},p.queue=f,f=f.dispatch=SC.bind(null,nr,f),[p.memoizedState,f]}function Do(f,p,C,R){return f={tag:f,create:p,destroy:C,deps:R,next:null},p=nr.updateQueue,p===null?(p={lastEffect:null,stores:null},nr.updateQueue=p,p.lastEffect=f.next=f):(C=p.lastEffect,C===null?p.lastEffect=f.next=f:(R=C.next,C.next=f,f.next=R,p.lastEffect=f)),f}function Qm(){return Cn().memoizedState}function vu(f,p,C,R){var O=Gn();nr.flags|=f,O.memoizedState=Do(1|p,C,void 0,R===void 0?null:R)}function gu(f,p,C,R){var O=Cn();R=R===void 0?null:R;var V=void 0;if(gr!==null){var Q=gr.memoizedState;if(V=Q.destroy,R!==null&&cf(R,Q.deps)){O.memoizedState=Do(p,C,V,R);return}}nr.flags|=f,O.memoizedState=Do(1|p,C,V,R)}function Zm(f,p){return vu(8390656,8,f,p)}function vf(f,p){return gu(2048,8,f,p)}function Jm(f,p){return gu(4,2,f,p)}function ey(f,p){return gu(4,4,f,p)}function ty(f,p){if(typeof p=="function")return f=f(),p(f),function(){p(null)};if(p!=null)return f=f(),p.current=f,function(){p.current=null}}function ry(f,p,C){return C=C!=null?C.concat([f]):null,gu(4,4,ty.bind(null,p,f),C)}function gf(){}function ny(f,p){var C=Cn();p=p===void 0?null:p;var R=C.memoizedState;return R!==null&&p!==null&&cf(p,R[1])?R[0]:(C.memoizedState=[f,p],f)}function iy(f,p){var C=Cn();p=p===void 0?null:p;var R=C.memoizedState;return R!==null&&p!==null&&cf(p,R[1])?R[0]:(f=f(),C.memoizedState=[f,p],f)}function ay(f,p,C){return(xa&21)===0?(f.baseState&&(f.baseState=!1,tn=!0),f.memoizedState=C):(Mn(C,p)||(C=Ig(),nr.lanes|=C,ba|=C,f.baseState=!0),p)}function wC(f,p){var C=Ft;Ft=C!==0&&4>C?C:4,f(!0);var R=uf.transition;uf.transition={};try{f(!1),p()}finally{Ft=C,uf.transition=R}}function sy(){return Cn().memoizedState}function _C(f,p,C){var R=ji(f);if(C={lane:R,action:C,hasEagerState:!1,eagerState:null,next:null},oy(f))ly(p,C);else if(C=jm(f,p,C,R),C!==null){var O=qr();jn(C,f,R,O),uy(C,p,R)}}function SC(f,p,C){var R=ji(f),O={lane:R,action:C,hasEagerState:!1,eagerState:null,next:null};if(oy(f))ly(p,O);else{var V=f.alternate;if(f.lanes===0&&(V===null||V.lanes===0)&&(V=p.lastRenderedReducer,V!==null))try{var Q=p.lastRenderedState,le=V(Q,C);if(O.hasEagerState=!0,O.eagerState=le,Mn(le,Q)){var fe=p.interleaved;fe===null?(O.next=O,rf(p)):(O.next=fe.next,fe.next=O),p.interleaved=O;return}}catch{}finally{}C=jm(f,p,O,R),C!==null&&(O=qr(),jn(C,f,R,O),uy(C,p,R))}}function oy(f){var p=f.alternate;return f===nr||p!==null&&p===nr}function ly(f,p){No=pu=!0;var C=f.pending;C===null?p.next=p:(p.next=C.next,C.next=p),f.pending=p}function uy(f,p,C){if((C&4194240)!==0){var R=p.lanes;R&=f.pendingLanes,C|=R,p.lanes=C,mh(f,C)}}var mu={readContext:Sn,useCallback:Br,useContext:Br,useEffect:Br,useImperativeHandle:Br,useInsertionEffect:Br,useLayoutEffect:Br,useMemo:Br,useReducer:Br,useRef:Br,useState:Br,useDebugValue:Br,useDeferredValue:Br,useTransition:Br,useMutableSource:Br,useSyncExternalStore:Br,useId:Br,unstable_isNewReconciler:!1},CC={readContext:Sn,useCallback:function(f,p){return Gn().memoizedState=[f,p===void 0?null:p],f},useContext:Sn,useEffect:Zm,useImperativeHandle:function(f,p,C){return C=C!=null?C.concat([f]):null,vu(4194308,4,ty.bind(null,p,f),C)},useLayoutEffect:function(f,p){return vu(4194308,4,f,p)},useInsertionEffect:function(f,p){return vu(4,2,f,p)},useMemo:function(f,p){var C=Gn();return p=p===void 0?null:p,f=f(),C.memoizedState=[f,p],f},useReducer:function(f,p,C){var R=Gn();return p=C!==void 0?C(p):p,R.memoizedState=R.baseState=p,f={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:f,lastRenderedState:p},R.queue=f,f=f.dispatch=_C.bind(null,nr,f),[R.memoizedState,f]},useRef:function(f){var p=Gn();return f={current:f},p.memoizedState=f},useState:Km,useDebugValue:gf,useDeferredValue:function(f){return Gn().memoizedState=f},useTransition:function(){var f=Km(!1),p=f[0];return f=wC.bind(null,f[1]),Gn().memoizedState=f,[p,f]},useMutableSource:function(){},useSyncExternalStore:function(f,p,C){var R=nr,O=Gn();if(Jt){if(C===void 0)throw Error(r(407));C=C()}else{if(C=p(),Sr===null)throw Error(r(349));(xa&30)!==0||$m(R,p,C)}O.memoizedState=C;var V={value:C,getSnapshot:p};return O.queue=V,Zm(qm.bind(null,R,V,f),[f]),R.flags|=2048,Do(9,Gm.bind(null,R,V,C,p),void 0,null),C},useId:function(){var f=Gn(),p=Sr.identifierPrefix;if(Jt){var C=ui,R=li;C=(R&~(1<<32-tr(R)-1)).toString(32)+C,p=":"+p+"R"+C,C=Ro++,0<C&&(p+="H"+C.toString(32)),p+=":"}else C=bC++,p=":"+p+"r"+C.toString(32)+":";return f.memoizedState=p},unstable_isNewReconciler:!1},EC={readContext:Sn,useCallback:ny,useContext:Sn,useEffect:vf,useImperativeHandle:ry,useInsertionEffect:Jm,useLayoutEffect:ey,useMemo:iy,useReducer:df,useRef:Qm,useState:function(){return df(Lo)},useDebugValue:gf,useDeferredValue:function(f){var p=Cn();return ay(p,gr.memoizedState,f)},useTransition:function(){var f=df(Lo)[0],p=Cn().memoizedState;return[f,p]},useMutableSource:Wm,useSyncExternalStore:Vm,useId:sy,unstable_isNewReconciler:!1},kC={readContext:Sn,useCallback:ny,useContext:Sn,useEffect:vf,useImperativeHandle:ry,useInsertionEffect:Jm,useLayoutEffect:ey,useMemo:iy,useReducer:pf,useRef:Qm,useState:function(){return pf(Lo)},useDebugValue:gf,useDeferredValue:function(f){var p=Cn();return gr===null?p.memoizedState=f:ay(p,gr.memoizedState,f)},useTransition:function(){var f=pf(Lo)[0],p=Cn().memoizedState;return[f,p]},useMutableSource:Wm,useSyncExternalStore:Vm,useId:sy,unstable_isNewReconciler:!1};function In(f,p){if(f&&f.defaultProps){p=P({},p),f=f.defaultProps;for(var C in f)p[C]===void 0&&(p[C]=f[C]);return p}return p}function mf(f,p,C,R){p=f.memoizedState,C=C(R,p),C=C==null?p:P({},p,C),f.memoizedState=C,f.lanes===0&&(f.updateQueue.baseState=C)}var yu={isMounted:function(f){return(f=f._reactInternals)?Mt(f)===f:!1},enqueueSetState:function(f,p,C){f=f._reactInternals;var R=qr(),O=ji(f),V=hi(R,O);V.payload=p,C!=null&&(V.callback=C),p=Pi(f,V,O),p!==null&&(jn(p,f,O,R),cu(p,f,O))},enqueueReplaceState:function(f,p,C){f=f._reactInternals;var R=qr(),O=ji(f),V=hi(R,O);V.tag=1,V.payload=p,C!=null&&(V.callback=C),p=Pi(f,V,O),p!==null&&(jn(p,f,O,R),cu(p,f,O))},enqueueForceUpdate:function(f,p){f=f._reactInternals;var C=qr(),R=ji(f),O=hi(C,R);O.tag=2,p!=null&&(O.callback=p),p=Pi(f,O,R),p!==null&&(jn(p,f,R,C),cu(p,f,R))}};function cy(f,p,C,R,O,V,Q){return f=f.stateNode,typeof f.shouldComponentUpdate=="function"?f.shouldComponentUpdate(R,V,Q):p.prototype&&p.prototype.isPureReactComponent?!mo(C,R)||!mo(O,V):!0}function hy(f,p,C){var R=!1,O=Di,V=p.contextType;return typeof V=="object"&&V!==null?V=Sn(V):(O=en(p)?pa:Or.current,R=p.contextTypes,V=(R=R!=null)?is(f,O):Di),p=new p(C,V),f.memoizedState=p.state!==null&&p.state!==void 0?p.state:null,p.updater=yu,f.stateNode=p,p._reactInternals=f,R&&(f=f.stateNode,f.__reactInternalMemoizedUnmaskedChildContext=O,f.__reactInternalMemoizedMaskedChildContext=V),p}function fy(f,p,C,R){f=p.state,typeof p.componentWillReceiveProps=="function"&&p.componentWillReceiveProps(C,R),typeof p.UNSAFE_componentWillReceiveProps=="function"&&p.UNSAFE_componentWillReceiveProps(C,R),p.state!==f&&yu.enqueueReplaceState(p,p.state,null)}function yf(f,p,C,R){var O=f.stateNode;O.props=C,O.state=f.memoizedState,O.refs={},nf(f);var V=p.contextType;typeof V=="object"&&V!==null?O.context=Sn(V):(V=en(p)?pa:Or.current,O.context=is(f,V)),O.state=f.memoizedState,V=p.getDerivedStateFromProps,typeof V=="function"&&(mf(f,p,V,C),O.state=f.memoizedState),typeof p.getDerivedStateFromProps=="function"||typeof O.getSnapshotBeforeUpdate=="function"||typeof O.UNSAFE_componentWillMount!="function"&&typeof O.componentWillMount!="function"||(p=O.state,typeof O.componentWillMount=="function"&&O.componentWillMount(),typeof O.UNSAFE_componentWillMount=="function"&&O.UNSAFE_componentWillMount(),p!==O.state&&yu.enqueueReplaceState(O,O.state,null),hu(f,C,O,R),O.state=f.memoizedState),typeof O.componentDidMount=="function"&&(f.flags|=4194308)}function fs(f,p){try{var C="",R=p;do C+=ae(R),R=R.return;while(R);var O=C}catch(V){O=`
39
- Error generating stack: `+V.message+`
40
- `+V.stack}return{value:f,source:p,stack:O,digest:null}}function xf(f,p,C){return{value:f,source:null,stack:C??null,digest:p??null}}function bf(f,p){try{console.error(p.value)}catch(C){setTimeout(function(){throw C})}}var TC=typeof WeakMap=="function"?WeakMap:Map;function dy(f,p,C){C=hi(-1,C),C.tag=3,C.payload={element:null};var R=p.value;return C.callback=function(){Eu||(Eu=!0,If=R),bf(f,p)},C}function py(f,p,C){C=hi(-1,C),C.tag=3;var R=f.type.getDerivedStateFromError;if(typeof R=="function"){var O=p.value;C.payload=function(){return R(O)},C.callback=function(){bf(f,p)}}var V=f.stateNode;return V!==null&&typeof V.componentDidCatch=="function"&&(C.callback=function(){bf(f,p),typeof R!="function"&&(Oi===null?Oi=new Set([this]):Oi.add(this));var Q=p.stack;this.componentDidCatch(p.value,{componentStack:Q!==null?Q:""})}),C}function vy(f,p,C){var R=f.pingCache;if(R===null){R=f.pingCache=new TC;var O=new Set;R.set(p,O)}else O=R.get(p),O===void 0&&(O=new Set,R.set(p,O));O.has(C)||(O.add(C),f=HC.bind(null,f,p,C),p.then(f,f))}function gy(f){do{var p;if((p=f.tag===13)&&(p=f.memoizedState,p=p!==null?p.dehydrated!==null:!0),p)return f;f=f.return}while(f!==null);return null}function my(f,p,C,R,O){return(f.mode&1)===0?(f===p?f.flags|=65536:(f.flags|=128,C.flags|=131072,C.flags&=-52805,C.tag===1&&(C.alternate===null?C.tag=17:(p=hi(-1,1),p.tag=2,Pi(C,p,1))),C.lanes|=1),f):(f.flags|=65536,f.lanes=O,f)}var NC=S.ReactCurrentOwner,tn=!1;function Gr(f,p,C,R){p.child=f===null?Bm(p,null,C,R):ls(p,f.child,C,R)}function yy(f,p,C,R,O){C=C.render;var V=p.ref;return cs(p,O),R=hf(f,p,C,R,V,O),C=ff(),f!==null&&!tn?(p.updateQueue=f.updateQueue,p.flags&=-2053,f.lanes&=~O,fi(f,p,O)):(Jt&&C&&qh(p),p.flags|=1,Gr(f,p,R,O),p.child)}function xy(f,p,C,R,O){if(f===null){var V=C.type;return typeof V=="function"&&!Uf(V)&&V.defaultProps===void 0&&C.compare===null&&C.defaultProps===void 0?(p.tag=15,p.type=V,by(f,p,V,R,O)):(f=Du(C.type,null,R,p,p.mode,O),f.ref=p.ref,f.return=p,p.child=f)}if(V=f.child,(f.lanes&O)===0){var Q=V.memoizedProps;if(C=C.compare,C=C!==null?C:mo,C(Q,R)&&f.ref===p.ref)return fi(f,p,O)}return p.flags|=1,f=zi(V,R),f.ref=p.ref,f.return=p,p.child=f}function by(f,p,C,R,O){if(f!==null){var V=f.memoizedProps;if(mo(V,R)&&f.ref===p.ref)if(tn=!1,p.pendingProps=R=V,(f.lanes&O)!==0)(f.flags&131072)!==0&&(tn=!0);else return p.lanes=f.lanes,fi(f,p,O)}return wf(f,p,C,R,O)}function wy(f,p,C){var R=p.pendingProps,O=R.children,V=f!==null?f.memoizedState:null;if(R.mode==="hidden")if((p.mode&1)===0)p.memoizedState={baseLanes:0,cachePool:null,transitions:null},$t(ps,vn),vn|=C;else{if((C&1073741824)===0)return f=V!==null?V.baseLanes|C:C,p.lanes=p.childLanes=1073741824,p.memoizedState={baseLanes:f,cachePool:null,transitions:null},p.updateQueue=null,$t(ps,vn),vn|=f,null;p.memoizedState={baseLanes:0,cachePool:null,transitions:null},R=V!==null?V.baseLanes:C,$t(ps,vn),vn|=R}else V!==null?(R=V.baseLanes|C,p.memoizedState=null):R=C,$t(ps,vn),vn|=R;return Gr(f,p,O,C),p.child}function _y(f,p){var C=p.ref;(f===null&&C!==null||f!==null&&f.ref!==C)&&(p.flags|=512,p.flags|=2097152)}function wf(f,p,C,R,O){var V=en(C)?pa:Or.current;return V=is(p,V),cs(p,O),C=hf(f,p,C,R,V,O),R=ff(),f!==null&&!tn?(p.updateQueue=f.updateQueue,p.flags&=-2053,f.lanes&=~O,fi(f,p,O)):(Jt&&R&&qh(p),p.flags|=1,Gr(f,p,C,O),p.child)}function Sy(f,p,C,R,O){if(en(C)){var V=!0;ru(p)}else V=!1;if(cs(p,O),p.stateNode===null)bu(f,p),hy(p,C,R),yf(p,C,R,O),R=!0;else if(f===null){var Q=p.stateNode,le=p.memoizedProps;Q.props=le;var fe=Q.context,we=C.contextType;typeof we=="object"&&we!==null?we=Sn(we):(we=en(C)?pa:Or.current,we=is(p,we));var je=C.getDerivedStateFromProps,Ue=typeof je=="function"||typeof Q.getSnapshotBeforeUpdate=="function";Ue||typeof Q.UNSAFE_componentWillReceiveProps!="function"&&typeof Q.componentWillReceiveProps!="function"||(le!==R||fe!==we)&&fy(p,Q,R,we),Mi=!1;var Be=p.memoizedState;Q.state=Be,hu(p,R,Q,O),fe=p.memoizedState,le!==R||Be!==fe||Jr.current||Mi?(typeof je=="function"&&(mf(p,C,je,R),fe=p.memoizedState),(le=Mi||cy(p,C,le,R,Be,fe,we))?(Ue||typeof Q.UNSAFE_componentWillMount!="function"&&typeof Q.componentWillMount!="function"||(typeof Q.componentWillMount=="function"&&Q.componentWillMount(),typeof Q.UNSAFE_componentWillMount=="function"&&Q.UNSAFE_componentWillMount()),typeof Q.componentDidMount=="function"&&(p.flags|=4194308)):(typeof Q.componentDidMount=="function"&&(p.flags|=4194308),p.memoizedProps=R,p.memoizedState=fe),Q.props=R,Q.state=fe,Q.context=we,R=le):(typeof Q.componentDidMount=="function"&&(p.flags|=4194308),R=!1)}else{Q=p.stateNode,Fm(f,p),le=p.memoizedProps,we=p.type===p.elementType?le:In(p.type,le),Q.props=we,Ue=p.pendingProps,Be=Q.context,fe=C.contextType,typeof fe=="object"&&fe!==null?fe=Sn(fe):(fe=en(C)?pa:Or.current,fe=is(p,fe));var et=C.getDerivedStateFromProps;(je=typeof et=="function"||typeof Q.getSnapshotBeforeUpdate=="function")||typeof Q.UNSAFE_componentWillReceiveProps!="function"&&typeof Q.componentWillReceiveProps!="function"||(le!==Ue||Be!==fe)&&fy(p,Q,R,fe),Mi=!1,Be=p.memoizedState,Q.state=Be,hu(p,R,Q,O);var it=p.memoizedState;le!==Ue||Be!==it||Jr.current||Mi?(typeof et=="function"&&(mf(p,C,et,R),it=p.memoizedState),(we=Mi||cy(p,C,we,R,Be,it,fe)||!1)?(je||typeof Q.UNSAFE_componentWillUpdate!="function"&&typeof Q.componentWillUpdate!="function"||(typeof Q.componentWillUpdate=="function"&&Q.componentWillUpdate(R,it,fe),typeof Q.UNSAFE_componentWillUpdate=="function"&&Q.UNSAFE_componentWillUpdate(R,it,fe)),typeof Q.componentDidUpdate=="function"&&(p.flags|=4),typeof Q.getSnapshotBeforeUpdate=="function"&&(p.flags|=1024)):(typeof Q.componentDidUpdate!="function"||le===f.memoizedProps&&Be===f.memoizedState||(p.flags|=4),typeof Q.getSnapshotBeforeUpdate!="function"||le===f.memoizedProps&&Be===f.memoizedState||(p.flags|=1024),p.memoizedProps=R,p.memoizedState=it),Q.props=R,Q.state=it,Q.context=fe,R=we):(typeof Q.componentDidUpdate!="function"||le===f.memoizedProps&&Be===f.memoizedState||(p.flags|=4),typeof Q.getSnapshotBeforeUpdate!="function"||le===f.memoizedProps&&Be===f.memoizedState||(p.flags|=1024),R=!1)}return _f(f,p,C,R,V,O)}function _f(f,p,C,R,O,V){_y(f,p);var Q=(p.flags&128)!==0;if(!R&&!Q)return O&&Nm(p,C,!1),fi(f,p,V);R=p.stateNode,NC.current=p;var le=Q&&typeof C.getDerivedStateFromError!="function"?null:R.render();return p.flags|=1,f!==null&&Q?(p.child=ls(p,f.child,null,V),p.child=ls(p,null,le,V)):Gr(f,p,le,V),p.memoizedState=R.state,O&&Nm(p,C,!0),p.child}function Cy(f){var p=f.stateNode;p.pendingContext?km(f,p.pendingContext,p.pendingContext!==p.context):p.context&&km(f,p.context,!1),af(f,p.containerInfo)}function Ey(f,p,C,R,O){return os(),Qh(O),p.flags|=256,Gr(f,p,C,R),p.child}var Sf={dehydrated:null,treeContext:null,retryLane:0};function Cf(f){return{baseLanes:f,cachePool:null,transitions:null}}function ky(f,p,C){var R=p.pendingProps,O=rr.current,V=!1,Q=(p.flags&128)!==0,le;if((le=Q)||(le=f!==null&&f.memoizedState===null?!1:(O&2)!==0),le?(V=!0,p.flags&=-129):(f===null||f.memoizedState!==null)&&(O|=1),$t(rr,O&1),f===null)return Kh(p),f=p.memoizedState,f!==null&&(f=f.dehydrated,f!==null)?((p.mode&1)===0?p.lanes=1:f.data==="$!"?p.lanes=8:p.lanes=1073741824,null):(Q=R.children,f=R.fallback,V?(R=p.mode,V=p.child,Q={mode:"hidden",children:Q},(R&1)===0&&V!==null?(V.childLanes=0,V.pendingProps=Q):V=Au(Q,R,0,null),f=Ca(f,R,C,null),V.return=p,f.return=p,V.sibling=f,p.child=V,p.child.memoizedState=Cf(C),p.memoizedState=Sf,f):Ef(p,Q));if(O=f.memoizedState,O!==null&&(le=O.dehydrated,le!==null))return RC(f,p,Q,R,le,O,C);if(V){V=R.fallback,Q=p.mode,O=f.child,le=O.sibling;var fe={mode:"hidden",children:R.children};return(Q&1)===0&&p.child!==O?(R=p.child,R.childLanes=0,R.pendingProps=fe,p.deletions=null):(R=zi(O,fe),R.subtreeFlags=O.subtreeFlags&14680064),le!==null?V=zi(le,V):(V=Ca(V,Q,C,null),V.flags|=2),V.return=p,R.return=p,R.sibling=V,p.child=R,R=V,V=p.child,Q=f.child.memoizedState,Q=Q===null?Cf(C):{baseLanes:Q.baseLanes|C,cachePool:null,transitions:Q.transitions},V.memoizedState=Q,V.childLanes=f.childLanes&~C,p.memoizedState=Sf,R}return V=f.child,f=V.sibling,R=zi(V,{mode:"visible",children:R.children}),(p.mode&1)===0&&(R.lanes=C),R.return=p,R.sibling=null,f!==null&&(C=p.deletions,C===null?(p.deletions=[f],p.flags|=16):C.push(f)),p.child=R,p.memoizedState=null,R}function Ef(f,p){return p=Au({mode:"visible",children:p},f.mode,0,null),p.return=f,f.child=p}function xu(f,p,C,R){return R!==null&&Qh(R),ls(p,f.child,null,C),f=Ef(p,p.pendingProps.children),f.flags|=2,p.memoizedState=null,f}function RC(f,p,C,R,O,V,Q){if(C)return p.flags&256?(p.flags&=-257,R=xf(Error(r(422))),xu(f,p,Q,R)):p.memoizedState!==null?(p.child=f.child,p.flags|=128,null):(V=R.fallback,O=p.mode,R=Au({mode:"visible",children:R.children},O,0,null),V=Ca(V,O,Q,null),V.flags|=2,R.return=p,V.return=p,R.sibling=V,p.child=R,(p.mode&1)!==0&&ls(p,f.child,null,Q),p.child.memoizedState=Cf(Q),p.memoizedState=Sf,V);if((p.mode&1)===0)return xu(f,p,Q,null);if(O.data==="$!"){if(R=O.nextSibling&&O.nextSibling.dataset,R)var le=R.dgst;return R=le,V=Error(r(419)),R=xf(V,R,void 0),xu(f,p,Q,R)}if(le=(Q&f.childLanes)!==0,tn||le){if(R=Sr,R!==null){switch(Q&-Q){case 4:O=2;break;case 16:O=8;break;case 64: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:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:O=32;break;case 536870912:O=268435456;break;default:O=0}O=(O&(R.suspendedLanes|Q))!==0?0:O,O!==0&&O!==V.retryLane&&(V.retryLane=O,ci(f,O),jn(R,f,O,-1))}return Hf(),R=xf(Error(r(421))),xu(f,p,Q,R)}return O.data==="$?"?(p.flags|=128,p.child=f.child,p=UC.bind(null,f),O._reactRetry=p,null):(f=V.treeContext,pn=Ri(O.nextSibling),dn=p,Jt=!0,Pn=null,f!==null&&(wn[_n++]=li,wn[_n++]=ui,wn[_n++]=va,li=f.id,ui=f.overflow,va=p),p=Ef(p,R.children),p.flags|=4096,p)}function Ty(f,p,C){f.lanes|=p;var R=f.alternate;R!==null&&(R.lanes|=p),tf(f.return,p,C)}function kf(f,p,C,R,O){var V=f.memoizedState;V===null?f.memoizedState={isBackwards:p,rendering:null,renderingStartTime:0,last:R,tail:C,tailMode:O}:(V.isBackwards=p,V.rendering=null,V.renderingStartTime=0,V.last=R,V.tail=C,V.tailMode=O)}function Ny(f,p,C){var R=p.pendingProps,O=R.revealOrder,V=R.tail;if(Gr(f,p,R.children,C),R=rr.current,(R&2)!==0)R=R&1|2,p.flags|=128;else{if(f!==null&&(f.flags&128)!==0)e:for(f=p.child;f!==null;){if(f.tag===13)f.memoizedState!==null&&Ty(f,C,p);else if(f.tag===19)Ty(f,C,p);else if(f.child!==null){f.child.return=f,f=f.child;continue}if(f===p)break e;for(;f.sibling===null;){if(f.return===null||f.return===p)break e;f=f.return}f.sibling.return=f.return,f=f.sibling}R&=1}if($t(rr,R),(p.mode&1)===0)p.memoizedState=null;else switch(O){case"forwards":for(C=p.child,O=null;C!==null;)f=C.alternate,f!==null&&fu(f)===null&&(O=C),C=C.sibling;C=O,C===null?(O=p.child,p.child=null):(O=C.sibling,C.sibling=null),kf(p,!1,O,C,V);break;case"backwards":for(C=null,O=p.child,p.child=null;O!==null;){if(f=O.alternate,f!==null&&fu(f)===null){p.child=O;break}f=O.sibling,O.sibling=C,C=O,O=f}kf(p,!0,C,null,V);break;case"together":kf(p,!1,null,null,void 0);break;default:p.memoizedState=null}return p.child}function bu(f,p){(p.mode&1)===0&&f!==null&&(f.alternate=null,p.alternate=null,p.flags|=2)}function fi(f,p,C){if(f!==null&&(p.dependencies=f.dependencies),ba|=p.lanes,(C&p.childLanes)===0)return null;if(f!==null&&p.child!==f.child)throw Error(r(153));if(p.child!==null){for(f=p.child,C=zi(f,f.pendingProps),p.child=C,C.return=p;f.sibling!==null;)f=f.sibling,C=C.sibling=zi(f,f.pendingProps),C.return=p;C.sibling=null}return p.child}function LC(f,p,C){switch(p.tag){case 3:Cy(p),os();break;case 5:Um(p);break;case 1:en(p.type)&&ru(p);break;case 4:af(p,p.stateNode.containerInfo);break;case 10:var R=p.type._context,O=p.memoizedProps.value;$t(lu,R._currentValue),R._currentValue=O;break;case 13:if(R=p.memoizedState,R!==null)return R.dehydrated!==null?($t(rr,rr.current&1),p.flags|=128,null):(C&p.child.childLanes)!==0?ky(f,p,C):($t(rr,rr.current&1),f=fi(f,p,C),f!==null?f.sibling:null);$t(rr,rr.current&1);break;case 19:if(R=(C&p.childLanes)!==0,(f.flags&128)!==0){if(R)return Ny(f,p,C);p.flags|=128}if(O=p.memoizedState,O!==null&&(O.rendering=null,O.tail=null,O.lastEffect=null),$t(rr,rr.current),R)break;return null;case 22:case 23:return p.lanes=0,wy(f,p,C)}return fi(f,p,C)}var Ry,Tf,Ly,Dy;Ry=function(f,p){for(var C=p.child;C!==null;){if(C.tag===5||C.tag===6)f.appendChild(C.stateNode);else if(C.tag!==4&&C.child!==null){C.child.return=C,C=C.child;continue}if(C===p)break;for(;C.sibling===null;){if(C.return===null||C.return===p)return;C=C.return}C.sibling.return=C.return,C=C.sibling}},Tf=function(){},Ly=function(f,p,C,R){var O=f.memoizedProps;if(O!==R){f=p.stateNode,ya($n.current);var V=null;switch(C){case"input":O=de(f,O),R=de(f,R),V=[];break;case"select":O=P({},O,{value:void 0}),R=P({},R,{value:void 0}),V=[];break;case"textarea":O=Oe(f,O),R=Oe(f,R),V=[];break;default:typeof O.onClick!="function"&&typeof R.onClick=="function"&&(f.onclick=Jl)}he(C,R);var Q;C=null;for(we in O)if(!R.hasOwnProperty(we)&&O.hasOwnProperty(we)&&O[we]!=null)if(we==="style"){var le=O[we];for(Q in le)le.hasOwnProperty(Q)&&(C||(C={}),C[Q]="")}else we!=="dangerouslySetInnerHTML"&&we!=="children"&&we!=="suppressContentEditableWarning"&&we!=="suppressHydrationWarning"&&we!=="autoFocus"&&(i.hasOwnProperty(we)?V||(V=[]):(V=V||[]).push(we,null));for(we in R){var fe=R[we];if(le=O!=null?O[we]:void 0,R.hasOwnProperty(we)&&fe!==le&&(fe!=null||le!=null))if(we==="style")if(le){for(Q in le)!le.hasOwnProperty(Q)||fe&&fe.hasOwnProperty(Q)||(C||(C={}),C[Q]="");for(Q in fe)fe.hasOwnProperty(Q)&&le[Q]!==fe[Q]&&(C||(C={}),C[Q]=fe[Q])}else C||(V||(V=[]),V.push(we,C)),C=fe;else we==="dangerouslySetInnerHTML"?(fe=fe?fe.__html:void 0,le=le?le.__html:void 0,fe!=null&&le!==fe&&(V=V||[]).push(we,fe)):we==="children"?typeof fe!="string"&&typeof fe!="number"||(V=V||[]).push(we,""+fe):we!=="suppressContentEditableWarning"&&we!=="suppressHydrationWarning"&&(i.hasOwnProperty(we)?(fe!=null&&we==="onScroll"&&Yt("scroll",f),V||le===fe||(V=[])):(V=V||[]).push(we,fe))}C&&(V=V||[]).push("style",C);var we=V;(p.updateQueue=we)&&(p.flags|=4)}},Dy=function(f,p,C,R){C!==R&&(p.flags|=4)};function Ao(f,p){if(!Jt)switch(f.tailMode){case"hidden":p=f.tail;for(var C=null;p!==null;)p.alternate!==null&&(C=p),p=p.sibling;C===null?f.tail=null:C.sibling=null;break;case"collapsed":C=f.tail;for(var R=null;C!==null;)C.alternate!==null&&(R=C),C=C.sibling;R===null?p||f.tail===null?f.tail=null:f.tail.sibling=null:R.sibling=null}}function jr(f){var p=f.alternate!==null&&f.alternate.child===f.child,C=0,R=0;if(p)for(var O=f.child;O!==null;)C|=O.lanes|O.childLanes,R|=O.subtreeFlags&14680064,R|=O.flags&14680064,O.return=f,O=O.sibling;else for(O=f.child;O!==null;)C|=O.lanes|O.childLanes,R|=O.subtreeFlags,R|=O.flags,O.return=f,O=O.sibling;return f.subtreeFlags|=R,f.childLanes=C,p}function DC(f,p,C){var R=p.pendingProps;switch(Yh(p),p.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return jr(p),null;case 1:return en(p.type)&&tu(),jr(p),null;case 3:return R=p.stateNode,hs(),Xt(Jr),Xt(Or),lf(),R.pendingContext&&(R.context=R.pendingContext,R.pendingContext=null),(f===null||f.child===null)&&(su(p)?p.flags|=4:f===null||f.memoizedState.isDehydrated&&(p.flags&256)===0||(p.flags|=1024,Pn!==null&&(jf(Pn),Pn=null))),Tf(f,p),jr(p),null;case 5:sf(p);var O=ya(To.current);if(C=p.type,f!==null&&p.stateNode!=null)Ly(f,p,C,R,O),f.ref!==p.ref&&(p.flags|=512,p.flags|=2097152);else{if(!R){if(p.stateNode===null)throw Error(r(166));return jr(p),null}if(f=ya($n.current),su(p)){R=p.stateNode,C=p.type;var V=p.memoizedProps;switch(R[Vn]=p,R[_o]=V,f=(p.mode&1)!==0,C){case"dialog":Yt("cancel",R),Yt("close",R);break;case"iframe":case"object":case"embed":Yt("load",R);break;case"video":case"audio":for(O=0;O<xo.length;O++)Yt(xo[O],R);break;case"source":Yt("error",R);break;case"img":case"image":case"link":Yt("error",R),Yt("load",R);break;case"details":Yt("toggle",R);break;case"input":Re(R,V),Yt("invalid",R);break;case"select":R._wrapperState={wasMultiple:!!V.multiple},Yt("invalid",R);break;case"textarea":De(R,V),Yt("invalid",R)}he(C,V),O=null;for(var Q in V)if(V.hasOwnProperty(Q)){var le=V[Q];Q==="children"?typeof le=="string"?R.textContent!==le&&(V.suppressHydrationWarning!==!0&&Zl(R.textContent,le,f),O=["children",le]):typeof le=="number"&&R.textContent!==""+le&&(V.suppressHydrationWarning!==!0&&Zl(R.textContent,le,f),O=["children",""+le]):i.hasOwnProperty(Q)&&le!=null&&Q==="onScroll"&&Yt("scroll",R)}switch(C){case"input":J(R),ke(R,V,!0);break;case"textarea":J(R),Ye(R);break;case"select":case"option":break;default:typeof V.onClick=="function"&&(R.onclick=Jl)}R=O,p.updateQueue=R,R!==null&&(p.flags|=4)}else{Q=O.nodeType===9?O:O.ownerDocument,f==="http://www.w3.org/1999/xhtml"&&(f=ge(C)),f==="http://www.w3.org/1999/xhtml"?C==="script"?(f=Q.createElement("div"),f.innerHTML="<script><\/script>",f=f.removeChild(f.firstChild)):typeof R.is=="string"?f=Q.createElement(C,{is:R.is}):(f=Q.createElement(C),C==="select"&&(Q=f,R.multiple?Q.multiple=!0:R.size&&(Q.size=R.size))):f=Q.createElementNS(f,C),f[Vn]=p,f[_o]=R,Ry(f,p,!1,!1),p.stateNode=f;e:{switch(Q=pe(C,R),C){case"dialog":Yt("cancel",f),Yt("close",f),O=R;break;case"iframe":case"object":case"embed":Yt("load",f),O=R;break;case"video":case"audio":for(O=0;O<xo.length;O++)Yt(xo[O],f);O=R;break;case"source":Yt("error",f),O=R;break;case"img":case"image":case"link":Yt("error",f),Yt("load",f),O=R;break;case"details":Yt("toggle",f),O=R;break;case"input":Re(f,R),O=de(f,R),Yt("invalid",f);break;case"option":O=R;break;case"select":f._wrapperState={wasMultiple:!!R.multiple},O=P({},R,{value:void 0}),Yt("invalid",f);break;case"textarea":De(f,R),O=Oe(f,R),Yt("invalid",f);break;default:O=R}he(C,O),le=O;for(V in le)if(le.hasOwnProperty(V)){var fe=le[V];V==="style"?ue(f,fe):V==="dangerouslySetInnerHTML"?(fe=fe?fe.__html:void 0,fe!=null&&Fe(f,fe)):V==="children"?typeof fe=="string"?(C!=="textarea"||fe!=="")&&me(f,fe):typeof fe=="number"&&me(f,""+fe):V!=="suppressContentEditableWarning"&&V!=="suppressHydrationWarning"&&V!=="autoFocus"&&(i.hasOwnProperty(V)?fe!=null&&V==="onScroll"&&Yt("scroll",f):fe!=null&&b(f,V,fe,Q))}switch(C){case"input":J(f),ke(f,R,!1);break;case"textarea":J(f),Ye(f);break;case"option":R.value!=null&&f.setAttribute("value",""+q(R.value));break;case"select":f.multiple=!!R.multiple,V=R.value,V!=null?Ie(f,!!R.multiple,V,!1):R.defaultValue!=null&&Ie(f,!!R.multiple,R.defaultValue,!0);break;default:typeof O.onClick=="function"&&(f.onclick=Jl)}switch(C){case"button":case"input":case"select":case"textarea":R=!!R.autoFocus;break e;case"img":R=!0;break e;default:R=!1}}R&&(p.flags|=4)}p.ref!==null&&(p.flags|=512,p.flags|=2097152)}return jr(p),null;case 6:if(f&&p.stateNode!=null)Dy(f,p,f.memoizedProps,R);else{if(typeof R!="string"&&p.stateNode===null)throw Error(r(166));if(C=ya(To.current),ya($n.current),su(p)){if(R=p.stateNode,C=p.memoizedProps,R[Vn]=p,(V=R.nodeValue!==C)&&(f=dn,f!==null))switch(f.tag){case 3:Zl(R.nodeValue,C,(f.mode&1)!==0);break;case 5:f.memoizedProps.suppressHydrationWarning!==!0&&Zl(R.nodeValue,C,(f.mode&1)!==0)}V&&(p.flags|=4)}else R=(C.nodeType===9?C:C.ownerDocument).createTextNode(R),R[Vn]=p,p.stateNode=R}return jr(p),null;case 13:if(Xt(rr),R=p.memoizedState,f===null||f.memoizedState!==null&&f.memoizedState.dehydrated!==null){if(Jt&&pn!==null&&(p.mode&1)!==0&&(p.flags&128)===0)Pm(),os(),p.flags|=98560,V=!1;else if(V=su(p),R!==null&&R.dehydrated!==null){if(f===null){if(!V)throw Error(r(318));if(V=p.memoizedState,V=V!==null?V.dehydrated:null,!V)throw Error(r(317));V[Vn]=p}else os(),(p.flags&128)===0&&(p.memoizedState=null),p.flags|=4;jr(p),V=!1}else Pn!==null&&(jf(Pn),Pn=null),V=!0;if(!V)return p.flags&65536?p:null}return(p.flags&128)!==0?(p.lanes=C,p):(R=R!==null,R!==(f!==null&&f.memoizedState!==null)&&R&&(p.child.flags|=8192,(p.mode&1)!==0&&(f===null||(rr.current&1)!==0?mr===0&&(mr=3):Hf())),p.updateQueue!==null&&(p.flags|=4),jr(p),null);case 4:return hs(),Tf(f,p),f===null&&bo(p.stateNode.containerInfo),jr(p),null;case 10:return ef(p.type._context),jr(p),null;case 17:return en(p.type)&&tu(),jr(p),null;case 19:if(Xt(rr),V=p.memoizedState,V===null)return jr(p),null;if(R=(p.flags&128)!==0,Q=V.rendering,Q===null)if(R)Ao(V,!1);else{if(mr!==0||f!==null&&(f.flags&128)!==0)for(f=p.child;f!==null;){if(Q=fu(f),Q!==null){for(p.flags|=128,Ao(V,!1),R=Q.updateQueue,R!==null&&(p.updateQueue=R,p.flags|=4),p.subtreeFlags=0,R=C,C=p.child;C!==null;)V=C,f=R,V.flags&=14680066,Q=V.alternate,Q===null?(V.childLanes=0,V.lanes=f,V.child=null,V.subtreeFlags=0,V.memoizedProps=null,V.memoizedState=null,V.updateQueue=null,V.dependencies=null,V.stateNode=null):(V.childLanes=Q.childLanes,V.lanes=Q.lanes,V.child=Q.child,V.subtreeFlags=0,V.deletions=null,V.memoizedProps=Q.memoizedProps,V.memoizedState=Q.memoizedState,V.updateQueue=Q.updateQueue,V.type=Q.type,f=Q.dependencies,V.dependencies=f===null?null:{lanes:f.lanes,firstContext:f.firstContext}),C=C.sibling;return $t(rr,rr.current&1|2),p.child}f=f.sibling}V.tail!==null&&Ht()>vs&&(p.flags|=128,R=!0,Ao(V,!1),p.lanes=4194304)}else{if(!R)if(f=fu(Q),f!==null){if(p.flags|=128,R=!0,C=f.updateQueue,C!==null&&(p.updateQueue=C,p.flags|=4),Ao(V,!0),V.tail===null&&V.tailMode==="hidden"&&!Q.alternate&&!Jt)return jr(p),null}else 2*Ht()-V.renderingStartTime>vs&&C!==1073741824&&(p.flags|=128,R=!0,Ao(V,!1),p.lanes=4194304);V.isBackwards?(Q.sibling=p.child,p.child=Q):(C=V.last,C!==null?C.sibling=Q:p.child=Q,V.last=Q)}return V.tail!==null?(p=V.tail,V.rendering=p,V.tail=p.sibling,V.renderingStartTime=Ht(),p.sibling=null,C=rr.current,$t(rr,R?C&1|2:C&1),p):(jr(p),null);case 22:case 23:return zf(),R=p.memoizedState!==null,f!==null&&f.memoizedState!==null!==R&&(p.flags|=8192),R&&(p.mode&1)!==0?(vn&1073741824)!==0&&(jr(p),p.subtreeFlags&6&&(p.flags|=8192)):jr(p),null;case 24:return null;case 25:return null}throw Error(r(156,p.tag))}function AC(f,p){switch(Yh(p),p.tag){case 1:return en(p.type)&&tu(),f=p.flags,f&65536?(p.flags=f&-65537|128,p):null;case 3:return hs(),Xt(Jr),Xt(Or),lf(),f=p.flags,(f&65536)!==0&&(f&128)===0?(p.flags=f&-65537|128,p):null;case 5:return sf(p),null;case 13:if(Xt(rr),f=p.memoizedState,f!==null&&f.dehydrated!==null){if(p.alternate===null)throw Error(r(340));os()}return f=p.flags,f&65536?(p.flags=f&-65537|128,p):null;case 19:return Xt(rr),null;case 4:return hs(),null;case 10:return ef(p.type._context),null;case 22:case 23:return zf(),null;case 24:return null;default:return null}}var wu=!1,Fr=!1,MC=typeof WeakSet=="function"?WeakSet:Set,tt=null;function ds(f,p){var C=f.ref;if(C!==null)if(typeof C=="function")try{C(null)}catch(R){sr(f,p,R)}else C.current=null}function Nf(f,p,C){try{C()}catch(R){sr(f,p,R)}}var Ay=!1;function PC(f,p){if(Fh=Hl,f=cm(),Dh(f)){if("selectionStart"in f)var C={start:f.selectionStart,end:f.selectionEnd};else e:{C=(C=f.ownerDocument)&&C.defaultView||window;var R=C.getSelection&&C.getSelection();if(R&&R.rangeCount!==0){C=R.anchorNode;var O=R.anchorOffset,V=R.focusNode;R=R.focusOffset;try{C.nodeType,V.nodeType}catch{C=null;break e}var Q=0,le=-1,fe=-1,we=0,je=0,Ue=f,Be=null;t:for(;;){for(var et;Ue!==C||O!==0&&Ue.nodeType!==3||(le=Q+O),Ue!==V||R!==0&&Ue.nodeType!==3||(fe=Q+R),Ue.nodeType===3&&(Q+=Ue.nodeValue.length),(et=Ue.firstChild)!==null;)Be=Ue,Ue=et;for(;;){if(Ue===f)break t;if(Be===C&&++we===O&&(le=Q),Be===V&&++je===R&&(fe=Q),(et=Ue.nextSibling)!==null)break;Ue=Be,Be=Ue.parentNode}Ue=et}C=le===-1||fe===-1?null:{start:le,end:fe}}else C=null}C=C||{start:0,end:0}}else C=null;for(zh={focusedElem:f,selectionRange:C},Hl=!1,tt=p;tt!==null;)if(p=tt,f=p.child,(p.subtreeFlags&1028)!==0&&f!==null)f.return=p,tt=f;else for(;tt!==null;){p=tt;try{var it=p.alternate;if((p.flags&1024)!==0)switch(p.tag){case 0:case 11:case 15:break;case 1:if(it!==null){var ot=it.memoizedProps,lr=it.memoizedState,ye=p.stateNode,ve=ye.getSnapshotBeforeUpdate(p.elementType===p.type?ot:In(p.type,ot),lr);ye.__reactInternalSnapshotBeforeUpdate=ve}break;case 3:var xe=p.stateNode.containerInfo;xe.nodeType===1?xe.textContent="":xe.nodeType===9&&xe.documentElement&&xe.removeChild(xe.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch($e){sr(p,p.return,$e)}if(f=p.sibling,f!==null){f.return=p.return,tt=f;break}tt=p.return}return it=Ay,Ay=!1,it}function Mo(f,p,C){var R=p.updateQueue;if(R=R!==null?R.lastEffect:null,R!==null){var O=R=R.next;do{if((O.tag&f)===f){var V=O.destroy;O.destroy=void 0,V!==void 0&&Nf(p,C,V)}O=O.next}while(O!==R)}}function _u(f,p){if(p=p.updateQueue,p=p!==null?p.lastEffect:null,p!==null){var C=p=p.next;do{if((C.tag&f)===f){var R=C.create;C.destroy=R()}C=C.next}while(C!==p)}}function Rf(f){var p=f.ref;if(p!==null){var C=f.stateNode;switch(f.tag){case 5:f=C;break;default:f=C}typeof p=="function"?p(f):p.current=f}}function My(f){var p=f.alternate;p!==null&&(f.alternate=null,My(p)),f.child=null,f.deletions=null,f.sibling=null,f.tag===5&&(p=f.stateNode,p!==null&&(delete p[Vn],delete p[_o],delete p[Vh],delete p[gC],delete p[mC])),f.stateNode=null,f.return=null,f.dependencies=null,f.memoizedProps=null,f.memoizedState=null,f.pendingProps=null,f.stateNode=null,f.updateQueue=null}function Py(f){return f.tag===5||f.tag===3||f.tag===4}function Iy(f){e:for(;;){for(;f.sibling===null;){if(f.return===null||Py(f.return))return null;f=f.return}for(f.sibling.return=f.return,f=f.sibling;f.tag!==5&&f.tag!==6&&f.tag!==18;){if(f.flags&2||f.child===null||f.tag===4)continue e;f.child.return=f,f=f.child}if(!(f.flags&2))return f.stateNode}}function Lf(f,p,C){var R=f.tag;if(R===5||R===6)f=f.stateNode,p?C.nodeType===8?C.parentNode.insertBefore(f,p):C.insertBefore(f,p):(C.nodeType===8?(p=C.parentNode,p.insertBefore(f,C)):(p=C,p.appendChild(f)),C=C._reactRootContainer,C!=null||p.onclick!==null||(p.onclick=Jl));else if(R!==4&&(f=f.child,f!==null))for(Lf(f,p,C),f=f.sibling;f!==null;)Lf(f,p,C),f=f.sibling}function Df(f,p,C){var R=f.tag;if(R===5||R===6)f=f.stateNode,p?C.insertBefore(f,p):C.appendChild(f);else if(R!==4&&(f=f.child,f!==null))for(Df(f,p,C),f=f.sibling;f!==null;)Df(f,p,C),f=f.sibling}var Rr=null,On=!1;function Ii(f,p,C){for(C=C.child;C!==null;)Oy(f,p,C),C=C.sibling}function Oy(f,p,C){if(nt&&typeof nt.onCommitFiberUnmount=="function")try{nt.onCommitFiberUnmount(Zt,C)}catch{}switch(C.tag){case 5:Fr||ds(C,p);case 6:var R=Rr,O=On;Rr=null,Ii(f,p,C),Rr=R,On=O,Rr!==null&&(On?(f=Rr,C=C.stateNode,f.nodeType===8?f.parentNode.removeChild(C):f.removeChild(C)):Rr.removeChild(C.stateNode));break;case 18:Rr!==null&&(On?(f=Rr,C=C.stateNode,f.nodeType===8?Wh(f.parentNode,C):f.nodeType===1&&Wh(f,C),co(f)):Wh(Rr,C.stateNode));break;case 4:R=Rr,O=On,Rr=C.stateNode.containerInfo,On=!0,Ii(f,p,C),Rr=R,On=O;break;case 0:case 11:case 14:case 15:if(!Fr&&(R=C.updateQueue,R!==null&&(R=R.lastEffect,R!==null))){O=R=R.next;do{var V=O,Q=V.destroy;V=V.tag,Q!==void 0&&((V&2)!==0||(V&4)!==0)&&Nf(C,p,Q),O=O.next}while(O!==R)}Ii(f,p,C);break;case 1:if(!Fr&&(ds(C,p),R=C.stateNode,typeof R.componentWillUnmount=="function"))try{R.props=C.memoizedProps,R.state=C.memoizedState,R.componentWillUnmount()}catch(le){sr(C,p,le)}Ii(f,p,C);break;case 21:Ii(f,p,C);break;case 22:C.mode&1?(Fr=(R=Fr)||C.memoizedState!==null,Ii(f,p,C),Fr=R):Ii(f,p,C);break;default:Ii(f,p,C)}}function By(f){var p=f.updateQueue;if(p!==null){f.updateQueue=null;var C=f.stateNode;C===null&&(C=f.stateNode=new MC),p.forEach(function(R){var O=WC.bind(null,f,R);C.has(R)||(C.add(R),R.then(O,O))})}}function Bn(f,p){var C=p.deletions;if(C!==null)for(var R=0;R<C.length;R++){var O=C[R];try{var V=f,Q=p,le=Q;e:for(;le!==null;){switch(le.tag){case 5:Rr=le.stateNode,On=!1;break e;case 3:Rr=le.stateNode.containerInfo,On=!0;break e;case 4:Rr=le.stateNode.containerInfo,On=!0;break e}le=le.return}if(Rr===null)throw Error(r(160));Oy(V,Q,O),Rr=null,On=!1;var fe=O.alternate;fe!==null&&(fe.return=null),O.return=null}catch(we){sr(O,p,we)}}if(p.subtreeFlags&12854)for(p=p.child;p!==null;)jy(p,f),p=p.sibling}function jy(f,p){var C=f.alternate,R=f.flags;switch(f.tag){case 0:case 11:case 14:case 15:if(Bn(p,f),qn(f),R&4){try{Mo(3,f,f.return),_u(3,f)}catch(ot){sr(f,f.return,ot)}try{Mo(5,f,f.return)}catch(ot){sr(f,f.return,ot)}}break;case 1:Bn(p,f),qn(f),R&512&&C!==null&&ds(C,C.return);break;case 5:if(Bn(p,f),qn(f),R&512&&C!==null&&ds(C,C.return),f.flags&32){var O=f.stateNode;try{me(O,"")}catch(ot){sr(f,f.return,ot)}}if(R&4&&(O=f.stateNode,O!=null)){var V=f.memoizedProps,Q=C!==null?C.memoizedProps:V,le=f.type,fe=f.updateQueue;if(f.updateQueue=null,fe!==null)try{le==="input"&&V.type==="radio"&&V.name!=null&&Pe(O,V),pe(le,Q);var we=pe(le,V);for(Q=0;Q<fe.length;Q+=2){var je=fe[Q],Ue=fe[Q+1];je==="style"?ue(O,Ue):je==="dangerouslySetInnerHTML"?Fe(O,Ue):je==="children"?me(O,Ue):b(O,je,Ue,we)}switch(le){case"input":_e(O,V);break;case"textarea":We(O,V);break;case"select":var Be=O._wrapperState.wasMultiple;O._wrapperState.wasMultiple=!!V.multiple;var et=V.value;et!=null?Ie(O,!!V.multiple,et,!1):Be!==!!V.multiple&&(V.defaultValue!=null?Ie(O,!!V.multiple,V.defaultValue,!0):Ie(O,!!V.multiple,V.multiple?[]:"",!1))}O[_o]=V}catch(ot){sr(f,f.return,ot)}}break;case 6:if(Bn(p,f),qn(f),R&4){if(f.stateNode===null)throw Error(r(162));O=f.stateNode,V=f.memoizedProps;try{O.nodeValue=V}catch(ot){sr(f,f.return,ot)}}break;case 3:if(Bn(p,f),qn(f),R&4&&C!==null&&C.memoizedState.isDehydrated)try{co(p.containerInfo)}catch(ot){sr(f,f.return,ot)}break;case 4:Bn(p,f),qn(f);break;case 13:Bn(p,f),qn(f),O=f.child,O.flags&8192&&(V=O.memoizedState!==null,O.stateNode.isHidden=V,!V||O.alternate!==null&&O.alternate.memoizedState!==null||(Pf=Ht())),R&4&&By(f);break;case 22:if(je=C!==null&&C.memoizedState!==null,f.mode&1?(Fr=(we=Fr)||je,Bn(p,f),Fr=we):Bn(p,f),qn(f),R&8192){if(we=f.memoizedState!==null,(f.stateNode.isHidden=we)&&!je&&(f.mode&1)!==0)for(tt=f,je=f.child;je!==null;){for(Ue=tt=je;tt!==null;){switch(Be=tt,et=Be.child,Be.tag){case 0:case 11:case 14:case 15:Mo(4,Be,Be.return);break;case 1:ds(Be,Be.return);var it=Be.stateNode;if(typeof it.componentWillUnmount=="function"){R=Be,C=Be.return;try{p=R,it.props=p.memoizedProps,it.state=p.memoizedState,it.componentWillUnmount()}catch(ot){sr(R,C,ot)}}break;case 5:ds(Be,Be.return);break;case 22:if(Be.memoizedState!==null){Hy(Ue);continue}}et!==null?(et.return=Be,tt=et):Hy(Ue)}je=je.sibling}e:for(je=null,Ue=f;;){if(Ue.tag===5){if(je===null){je=Ue;try{O=Ue.stateNode,we?(V=O.style,typeof V.setProperty=="function"?V.setProperty("display","none","important"):V.display="none"):(le=Ue.stateNode,fe=Ue.memoizedProps.style,Q=fe!=null&&fe.hasOwnProperty("display")?fe.display:null,le.style.display=oe("display",Q))}catch(ot){sr(f,f.return,ot)}}}else if(Ue.tag===6){if(je===null)try{Ue.stateNode.nodeValue=we?"":Ue.memoizedProps}catch(ot){sr(f,f.return,ot)}}else if((Ue.tag!==22&&Ue.tag!==23||Ue.memoizedState===null||Ue===f)&&Ue.child!==null){Ue.child.return=Ue,Ue=Ue.child;continue}if(Ue===f)break e;for(;Ue.sibling===null;){if(Ue.return===null||Ue.return===f)break e;je===Ue&&(je=null),Ue=Ue.return}je===Ue&&(je=null),Ue.sibling.return=Ue.return,Ue=Ue.sibling}}break;case 19:Bn(p,f),qn(f),R&4&&By(f);break;case 21:break;default:Bn(p,f),qn(f)}}function qn(f){var p=f.flags;if(p&2){try{e:{for(var C=f.return;C!==null;){if(Py(C)){var R=C;break e}C=C.return}throw Error(r(160))}switch(R.tag){case 5:var O=R.stateNode;R.flags&32&&(me(O,""),R.flags&=-33);var V=Iy(f);Df(f,V,O);break;case 3:case 4:var Q=R.stateNode.containerInfo,le=Iy(f);Lf(f,le,Q);break;default:throw Error(r(161))}}catch(fe){sr(f,f.return,fe)}f.flags&=-3}p&4096&&(f.flags&=-4097)}function IC(f,p,C){tt=f,Fy(f)}function Fy(f,p,C){for(var R=(f.mode&1)!==0;tt!==null;){var O=tt,V=O.child;if(O.tag===22&&R){var Q=O.memoizedState!==null||wu;if(!Q){var le=O.alternate,fe=le!==null&&le.memoizedState!==null||Fr;le=wu;var we=Fr;if(wu=Q,(Fr=fe)&&!we)for(tt=O;tt!==null;)Q=tt,fe=Q.child,Q.tag===22&&Q.memoizedState!==null?Uy(O):fe!==null?(fe.return=Q,tt=fe):Uy(O);for(;V!==null;)tt=V,Fy(V),V=V.sibling;tt=O,wu=le,Fr=we}zy(f)}else(O.subtreeFlags&8772)!==0&&V!==null?(V.return=O,tt=V):zy(f)}}function zy(f){for(;tt!==null;){var p=tt;if((p.flags&8772)!==0){var C=p.alternate;try{if((p.flags&8772)!==0)switch(p.tag){case 0:case 11:case 15:Fr||_u(5,p);break;case 1:var R=p.stateNode;if(p.flags&4&&!Fr)if(C===null)R.componentDidMount();else{var O=p.elementType===p.type?C.memoizedProps:In(p.type,C.memoizedProps);R.componentDidUpdate(O,C.memoizedState,R.__reactInternalSnapshotBeforeUpdate)}var V=p.updateQueue;V!==null&&Hm(p,V,R);break;case 3:var Q=p.updateQueue;if(Q!==null){if(C=null,p.child!==null)switch(p.child.tag){case 5:C=p.child.stateNode;break;case 1:C=p.child.stateNode}Hm(p,Q,C)}break;case 5:var le=p.stateNode;if(C===null&&p.flags&4){C=le;var fe=p.memoizedProps;switch(p.type){case"button":case"input":case"select":case"textarea":fe.autoFocus&&C.focus();break;case"img":fe.src&&(C.src=fe.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(p.memoizedState===null){var we=p.alternate;if(we!==null){var je=we.memoizedState;if(je!==null){var Ue=je.dehydrated;Ue!==null&&co(Ue)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(r(163))}Fr||p.flags&512&&Rf(p)}catch(Be){sr(p,p.return,Be)}}if(p===f){tt=null;break}if(C=p.sibling,C!==null){C.return=p.return,tt=C;break}tt=p.return}}function Hy(f){for(;tt!==null;){var p=tt;if(p===f){tt=null;break}var C=p.sibling;if(C!==null){C.return=p.return,tt=C;break}tt=p.return}}function Uy(f){for(;tt!==null;){var p=tt;try{switch(p.tag){case 0:case 11:case 15:var C=p.return;try{_u(4,p)}catch(fe){sr(p,C,fe)}break;case 1:var R=p.stateNode;if(typeof R.componentDidMount=="function"){var O=p.return;try{R.componentDidMount()}catch(fe){sr(p,O,fe)}}var V=p.return;try{Rf(p)}catch(fe){sr(p,V,fe)}break;case 5:var Q=p.return;try{Rf(p)}catch(fe){sr(p,Q,fe)}}}catch(fe){sr(p,p.return,fe)}if(p===f){tt=null;break}var le=p.sibling;if(le!==null){le.return=p.return,tt=le;break}tt=p.return}}var OC=Math.ceil,Su=S.ReactCurrentDispatcher,Af=S.ReactCurrentOwner,En=S.ReactCurrentBatchConfig,Lt=0,Sr=null,fr=null,Lr=0,vn=0,ps=Li(0),mr=0,Po=null,ba=0,Cu=0,Mf=0,Io=null,rn=null,Pf=0,vs=1/0,di=null,Eu=!1,If=null,Oi=null,ku=!1,Bi=null,Tu=0,Oo=0,Of=null,Nu=-1,Ru=0;function qr(){return(Lt&6)!==0?Ht():Nu!==-1?Nu:Nu=Ht()}function ji(f){return(f.mode&1)===0?1:(Lt&2)!==0&&Lr!==0?Lr&-Lr:xC.transition!==null?(Ru===0&&(Ru=Ig()),Ru):(f=Ft,f!==0||(f=window.event,f=f===void 0?16:Vg(f.type)),f)}function jn(f,p,C,R){if(50<Oo)throw Oo=0,Of=null,Error(r(185));ao(f,C,R),((Lt&2)===0||f!==Sr)&&(f===Sr&&((Lt&2)===0&&(Cu|=C),mr===4&&Fi(f,Lr)),nn(f,R),C===1&&Lt===0&&(p.mode&1)===0&&(vs=Ht()+500,nu&&Ai()))}function nn(f,p){var C=f.callbackNode;x2(f,p);var R=jl(f,f===Sr?Lr:0);if(R===0)C!==null&&ha(C),f.callbackNode=null,f.callbackPriority=0;else if(p=R&-R,f.callbackPriority!==p){if(C!=null&&ha(C),p===1)f.tag===0?yC(Vy.bind(null,f)):Rm(Vy.bind(null,f)),pC(function(){(Lt&6)===0&&Ai()}),C=null;else{switch(Og(R)){case 1:C=cn;break;case 4:C=ai;break;case 16:C=bn;break;case 536870912:C=_i;break;default:C=bn}C=Zy(C,Wy.bind(null,f))}f.callbackPriority=p,f.callbackNode=C}}function Wy(f,p){if(Nu=-1,Ru=0,(Lt&6)!==0)throw Error(r(327));var C=f.callbackNode;if(gs()&&f.callbackNode!==C)return null;var R=jl(f,f===Sr?Lr:0);if(R===0)return null;if((R&30)!==0||(R&f.expiredLanes)!==0||p)p=Lu(f,R);else{p=R;var O=Lt;Lt|=2;var V=Gy();(Sr!==f||Lr!==p)&&(di=null,vs=Ht()+500,_a(f,p));do try{FC();break}catch(le){$y(f,le)}while(!0);Jh(),Su.current=V,Lt=O,fr!==null?p=0:(Sr=null,Lr=0,p=mr)}if(p!==0){if(p===2&&(O=vh(f),O!==0&&(R=O,p=Bf(f,O))),p===1)throw C=Po,_a(f,0),Fi(f,R),nn(f,Ht()),C;if(p===6)Fi(f,R);else{if(O=f.current.alternate,(R&30)===0&&!BC(O)&&(p=Lu(f,R),p===2&&(V=vh(f),V!==0&&(R=V,p=Bf(f,V))),p===1))throw C=Po,_a(f,0),Fi(f,R),nn(f,Ht()),C;switch(f.finishedWork=O,f.finishedLanes=R,p){case 0:case 1:throw Error(r(345));case 2:Sa(f,rn,di);break;case 3:if(Fi(f,R),(R&130023424)===R&&(p=Pf+500-Ht(),10<p)){if(jl(f,0)!==0)break;if(O=f.suspendedLanes,(O&R)!==R){qr(),f.pingedLanes|=f.suspendedLanes&O;break}f.timeoutHandle=Uh(Sa.bind(null,f,rn,di),p);break}Sa(f,rn,di);break;case 4:if(Fi(f,R),(R&4194240)===R)break;for(p=f.eventTimes,O=-1;0<R;){var Q=31-tr(R);V=1<<Q,Q=p[Q],Q>O&&(O=Q),R&=~V}if(R=O,R=Ht()-R,R=(120>R?120:480>R?480:1080>R?1080:1920>R?1920:3e3>R?3e3:4320>R?4320:1960*OC(R/1960))-R,10<R){f.timeoutHandle=Uh(Sa.bind(null,f,rn,di),R);break}Sa(f,rn,di);break;case 5:Sa(f,rn,di);break;default:throw Error(r(329))}}}return nn(f,Ht()),f.callbackNode===C?Wy.bind(null,f):null}function Bf(f,p){var C=Io;return f.current.memoizedState.isDehydrated&&(_a(f,p).flags|=256),f=Lu(f,p),f!==2&&(p=rn,rn=C,p!==null&&jf(p)),f}function jf(f){rn===null?rn=f:rn.push.apply(rn,f)}function BC(f){for(var p=f;;){if(p.flags&16384){var C=p.updateQueue;if(C!==null&&(C=C.stores,C!==null))for(var R=0;R<C.length;R++){var O=C[R],V=O.getSnapshot;O=O.value;try{if(!Mn(V(),O))return!1}catch{return!1}}}if(C=p.child,p.subtreeFlags&16384&&C!==null)C.return=p,p=C;else{if(p===f)break;for(;p.sibling===null;){if(p.return===null||p.return===f)return!0;p=p.return}p.sibling.return=p.return,p=p.sibling}}return!0}function Fi(f,p){for(p&=~Mf,p&=~Cu,f.suspendedLanes|=p,f.pingedLanes&=~p,f=f.expirationTimes;0<p;){var C=31-tr(p),R=1<<C;f[C]=-1,p&=~R}}function Vy(f){if((Lt&6)!==0)throw Error(r(327));gs();var p=jl(f,0);if((p&1)===0)return nn(f,Ht()),null;var C=Lu(f,p);if(f.tag!==0&&C===2){var R=vh(f);R!==0&&(p=R,C=Bf(f,R))}if(C===1)throw C=Po,_a(f,0),Fi(f,p),nn(f,Ht()),C;if(C===6)throw Error(r(345));return f.finishedWork=f.current.alternate,f.finishedLanes=p,Sa(f,rn,di),nn(f,Ht()),null}function Ff(f,p){var C=Lt;Lt|=1;try{return f(p)}finally{Lt=C,Lt===0&&(vs=Ht()+500,nu&&Ai())}}function wa(f){Bi!==null&&Bi.tag===0&&(Lt&6)===0&&gs();var p=Lt;Lt|=1;var C=En.transition,R=Ft;try{if(En.transition=null,Ft=1,f)return f()}finally{Ft=R,En.transition=C,Lt=p,(Lt&6)===0&&Ai()}}function zf(){vn=ps.current,Xt(ps)}function _a(f,p){f.finishedWork=null,f.finishedLanes=0;var C=f.timeoutHandle;if(C!==-1&&(f.timeoutHandle=-1,dC(C)),fr!==null)for(C=fr.return;C!==null;){var R=C;switch(Yh(R),R.tag){case 1:R=R.type.childContextTypes,R!=null&&tu();break;case 3:hs(),Xt(Jr),Xt(Or),lf();break;case 5:sf(R);break;case 4:hs();break;case 13:Xt(rr);break;case 19:Xt(rr);break;case 10:ef(R.type._context);break;case 22:case 23:zf()}C=C.return}if(Sr=f,fr=f=zi(f.current,null),Lr=vn=p,mr=0,Po=null,Mf=Cu=ba=0,rn=Io=null,ma!==null){for(p=0;p<ma.length;p++)if(C=ma[p],R=C.interleaved,R!==null){C.interleaved=null;var O=R.next,V=C.pending;if(V!==null){var Q=V.next;V.next=O,R.next=Q}C.pending=R}ma=null}return f}function $y(f,p){do{var C=fr;try{if(Jh(),du.current=mu,pu){for(var R=nr.memoizedState;R!==null;){var O=R.queue;O!==null&&(O.pending=null),R=R.next}pu=!1}if(xa=0,_r=gr=nr=null,No=!1,Ro=0,Af.current=null,C===null||C.return===null){mr=1,Po=p,fr=null;break}e:{var V=f,Q=C.return,le=C,fe=p;if(p=Lr,le.flags|=32768,fe!==null&&typeof fe=="object"&&typeof fe.then=="function"){var we=fe,je=le,Ue=je.tag;if((je.mode&1)===0&&(Ue===0||Ue===11||Ue===15)){var Be=je.alternate;Be?(je.updateQueue=Be.updateQueue,je.memoizedState=Be.memoizedState,je.lanes=Be.lanes):(je.updateQueue=null,je.memoizedState=null)}var et=gy(Q);if(et!==null){et.flags&=-257,my(et,Q,le,V,p),et.mode&1&&vy(V,we,p),p=et,fe=we;var it=p.updateQueue;if(it===null){var ot=new Set;ot.add(fe),p.updateQueue=ot}else it.add(fe);break e}else{if((p&1)===0){vy(V,we,p),Hf();break e}fe=Error(r(426))}}else if(Jt&&le.mode&1){var lr=gy(Q);if(lr!==null){(lr.flags&65536)===0&&(lr.flags|=256),my(lr,Q,le,V,p),Qh(fs(fe,le));break e}}V=fe=fs(fe,le),mr!==4&&(mr=2),Io===null?Io=[V]:Io.push(V),V=Q;do{switch(V.tag){case 3:V.flags|=65536,p&=-p,V.lanes|=p;var ye=dy(V,fe,p);zm(V,ye);break e;case 1:le=fe;var ve=V.type,xe=V.stateNode;if((V.flags&128)===0&&(typeof ve.getDerivedStateFromError=="function"||xe!==null&&typeof xe.componentDidCatch=="function"&&(Oi===null||!Oi.has(xe)))){V.flags|=65536,p&=-p,V.lanes|=p;var $e=py(V,le,p);zm(V,$e);break e}}V=V.return}while(V!==null)}Yy(C)}catch(ut){p=ut,fr===C&&C!==null&&(fr=C=C.return);continue}break}while(!0)}function Gy(){var f=Su.current;return Su.current=mu,f===null?mu:f}function Hf(){(mr===0||mr===3||mr===2)&&(mr=4),Sr===null||(ba&268435455)===0&&(Cu&268435455)===0||Fi(Sr,Lr)}function Lu(f,p){var C=Lt;Lt|=2;var R=Gy();(Sr!==f||Lr!==p)&&(di=null,_a(f,p));do try{jC();break}catch(O){$y(f,O)}while(!0);if(Jh(),Lt=C,Su.current=R,fr!==null)throw Error(r(261));return Sr=null,Lr=0,mr}function jC(){for(;fr!==null;)qy(fr)}function FC(){for(;fr!==null&&!fa();)qy(fr)}function qy(f){var p=Qy(f.alternate,f,vn);f.memoizedProps=f.pendingProps,p===null?Yy(f):fr=p,Af.current=null}function Yy(f){var p=f;do{var C=p.alternate;if(f=p.return,(p.flags&32768)===0){if(C=DC(C,p,vn),C!==null){fr=C;return}}else{if(C=AC(C,p),C!==null){C.flags&=32767,fr=C;return}if(f!==null)f.flags|=32768,f.subtreeFlags=0,f.deletions=null;else{mr=6,fr=null;return}}if(p=p.sibling,p!==null){fr=p;return}fr=p=f}while(p!==null);mr===0&&(mr=5)}function Sa(f,p,C){var R=Ft,O=En.transition;try{En.transition=null,Ft=1,zC(f,p,C,R)}finally{En.transition=O,Ft=R}return null}function zC(f,p,C,R){do gs();while(Bi!==null);if((Lt&6)!==0)throw Error(r(327));C=f.finishedWork;var O=f.finishedLanes;if(C===null)return null;if(f.finishedWork=null,f.finishedLanes=0,C===f.current)throw Error(r(177));f.callbackNode=null,f.callbackPriority=0;var V=C.lanes|C.childLanes;if(b2(f,V),f===Sr&&(fr=Sr=null,Lr=0),(C.subtreeFlags&2064)===0&&(C.flags&2064)===0||ku||(ku=!0,Zy(bn,function(){return gs(),null})),V=(C.flags&15990)!==0,(C.subtreeFlags&15990)!==0||V){V=En.transition,En.transition=null;var Q=Ft;Ft=1;var le=Lt;Lt|=4,Af.current=null,PC(f,C),jy(C,f),sC(zh),Hl=!!Fh,zh=Fh=null,f.current=C,IC(C),qa(),Lt=le,Ft=Q,En.transition=V}else f.current=C;if(ku&&(ku=!1,Bi=f,Tu=O),V=f.pendingLanes,V===0&&(Oi=null),kt(C.stateNode),nn(f,Ht()),p!==null)for(R=f.onRecoverableError,C=0;C<p.length;C++)O=p[C],R(O.value,{componentStack:O.stack,digest:O.digest});if(Eu)throw Eu=!1,f=If,If=null,f;return(Tu&1)!==0&&f.tag!==0&&gs(),V=f.pendingLanes,(V&1)!==0?f===Of?Oo++:(Oo=0,Of=f):Oo=0,Ai(),null}function gs(){if(Bi!==null){var f=Og(Tu),p=En.transition,C=Ft;try{if(En.transition=null,Ft=16>f?16:f,Bi===null)var R=!1;else{if(f=Bi,Bi=null,Tu=0,(Lt&6)!==0)throw Error(r(331));var O=Lt;for(Lt|=4,tt=f.current;tt!==null;){var V=tt,Q=V.child;if((tt.flags&16)!==0){var le=V.deletions;if(le!==null){for(var fe=0;fe<le.length;fe++){var we=le[fe];for(tt=we;tt!==null;){var je=tt;switch(je.tag){case 0:case 11:case 15:Mo(8,je,V)}var Ue=je.child;if(Ue!==null)Ue.return=je,tt=Ue;else for(;tt!==null;){je=tt;var Be=je.sibling,et=je.return;if(My(je),je===we){tt=null;break}if(Be!==null){Be.return=et,tt=Be;break}tt=et}}}var it=V.alternate;if(it!==null){var ot=it.child;if(ot!==null){it.child=null;do{var lr=ot.sibling;ot.sibling=null,ot=lr}while(ot!==null)}}tt=V}}if((V.subtreeFlags&2064)!==0&&Q!==null)Q.return=V,tt=Q;else e:for(;tt!==null;){if(V=tt,(V.flags&2048)!==0)switch(V.tag){case 0:case 11:case 15:Mo(9,V,V.return)}var ye=V.sibling;if(ye!==null){ye.return=V.return,tt=ye;break e}tt=V.return}}var ve=f.current;for(tt=ve;tt!==null;){Q=tt;var xe=Q.child;if((Q.subtreeFlags&2064)!==0&&xe!==null)xe.return=Q,tt=xe;else e:for(Q=ve;tt!==null;){if(le=tt,(le.flags&2048)!==0)try{switch(le.tag){case 0:case 11:case 15:_u(9,le)}}catch(ut){sr(le,le.return,ut)}if(le===Q){tt=null;break e}var $e=le.sibling;if($e!==null){$e.return=le.return,tt=$e;break e}tt=le.return}}if(Lt=O,Ai(),nt&&typeof nt.onPostCommitFiberRoot=="function")try{nt.onPostCommitFiberRoot(Zt,f)}catch{}R=!0}return R}finally{Ft=C,En.transition=p}}return!1}function Xy(f,p,C){p=fs(C,p),p=dy(f,p,1),f=Pi(f,p,1),p=qr(),f!==null&&(ao(f,1,p),nn(f,p))}function sr(f,p,C){if(f.tag===3)Xy(f,f,C);else for(;p!==null;){if(p.tag===3){Xy(p,f,C);break}else if(p.tag===1){var R=p.stateNode;if(typeof p.type.getDerivedStateFromError=="function"||typeof R.componentDidCatch=="function"&&(Oi===null||!Oi.has(R))){f=fs(C,f),f=py(p,f,1),p=Pi(p,f,1),f=qr(),p!==null&&(ao(p,1,f),nn(p,f));break}}p=p.return}}function HC(f,p,C){var R=f.pingCache;R!==null&&R.delete(p),p=qr(),f.pingedLanes|=f.suspendedLanes&C,Sr===f&&(Lr&C)===C&&(mr===4||mr===3&&(Lr&130023424)===Lr&&500>Ht()-Pf?_a(f,0):Mf|=C),nn(f,p)}function Ky(f,p){p===0&&((f.mode&1)===0?p=1:(p=Ya,Ya<<=1,(Ya&130023424)===0&&(Ya=4194304)));var C=qr();f=ci(f,p),f!==null&&(ao(f,p,C),nn(f,C))}function UC(f){var p=f.memoizedState,C=0;p!==null&&(C=p.retryLane),Ky(f,C)}function WC(f,p){var C=0;switch(f.tag){case 13:var R=f.stateNode,O=f.memoizedState;O!==null&&(C=O.retryLane);break;case 19:R=f.stateNode;break;default:throw Error(r(314))}R!==null&&R.delete(p),Ky(f,C)}var Qy;Qy=function(f,p,C){if(f!==null)if(f.memoizedProps!==p.pendingProps||Jr.current)tn=!0;else{if((f.lanes&C)===0&&(p.flags&128)===0)return tn=!1,LC(f,p,C);tn=(f.flags&131072)!==0}else tn=!1,Jt&&(p.flags&1048576)!==0&&Lm(p,au,p.index);switch(p.lanes=0,p.tag){case 2:var R=p.type;bu(f,p),f=p.pendingProps;var O=is(p,Or.current);cs(p,C),O=hf(null,p,R,f,O,C);var V=ff();return p.flags|=1,typeof O=="object"&&O!==null&&typeof O.render=="function"&&O.$$typeof===void 0?(p.tag=1,p.memoizedState=null,p.updateQueue=null,en(R)?(V=!0,ru(p)):V=!1,p.memoizedState=O.state!==null&&O.state!==void 0?O.state:null,nf(p),O.updater=yu,p.stateNode=O,O._reactInternals=p,yf(p,R,f,C),p=_f(null,p,R,!0,V,C)):(p.tag=0,Jt&&V&&qh(p),Gr(null,p,O,C),p=p.child),p;case 16:R=p.elementType;e:{switch(bu(f,p),f=p.pendingProps,O=R._init,R=O(R._payload),p.type=R,O=p.tag=$C(R),f=In(R,f),O){case 0:p=wf(null,p,R,f,C);break e;case 1:p=Sy(null,p,R,f,C);break e;case 11:p=yy(null,p,R,f,C);break e;case 14:p=xy(null,p,R,In(R.type,f),C);break e}throw Error(r(306,R,""))}return p;case 0:return R=p.type,O=p.pendingProps,O=p.elementType===R?O:In(R,O),wf(f,p,R,O,C);case 1:return R=p.type,O=p.pendingProps,O=p.elementType===R?O:In(R,O),Sy(f,p,R,O,C);case 3:e:{if(Cy(p),f===null)throw Error(r(387));R=p.pendingProps,V=p.memoizedState,O=V.element,Fm(f,p),hu(p,R,null,C);var Q=p.memoizedState;if(R=Q.element,V.isDehydrated)if(V={element:R,isDehydrated:!1,cache:Q.cache,pendingSuspenseBoundaries:Q.pendingSuspenseBoundaries,transitions:Q.transitions},p.updateQueue.baseState=V,p.memoizedState=V,p.flags&256){O=fs(Error(r(423)),p),p=Ey(f,p,R,C,O);break e}else if(R!==O){O=fs(Error(r(424)),p),p=Ey(f,p,R,C,O);break e}else for(pn=Ri(p.stateNode.containerInfo.firstChild),dn=p,Jt=!0,Pn=null,C=Bm(p,null,R,C),p.child=C;C;)C.flags=C.flags&-3|4096,C=C.sibling;else{if(os(),R===O){p=fi(f,p,C);break e}Gr(f,p,R,C)}p=p.child}return p;case 5:return Um(p),f===null&&Kh(p),R=p.type,O=p.pendingProps,V=f!==null?f.memoizedProps:null,Q=O.children,Hh(R,O)?Q=null:V!==null&&Hh(R,V)&&(p.flags|=32),_y(f,p),Gr(f,p,Q,C),p.child;case 6:return f===null&&Kh(p),null;case 13:return ky(f,p,C);case 4:return af(p,p.stateNode.containerInfo),R=p.pendingProps,f===null?p.child=ls(p,null,R,C):Gr(f,p,R,C),p.child;case 11:return R=p.type,O=p.pendingProps,O=p.elementType===R?O:In(R,O),yy(f,p,R,O,C);case 7:return Gr(f,p,p.pendingProps,C),p.child;case 8:return Gr(f,p,p.pendingProps.children,C),p.child;case 12:return Gr(f,p,p.pendingProps.children,C),p.child;case 10:e:{if(R=p.type._context,O=p.pendingProps,V=p.memoizedProps,Q=O.value,$t(lu,R._currentValue),R._currentValue=Q,V!==null)if(Mn(V.value,Q)){if(V.children===O.children&&!Jr.current){p=fi(f,p,C);break e}}else for(V=p.child,V!==null&&(V.return=p);V!==null;){var le=V.dependencies;if(le!==null){Q=V.child;for(var fe=le.firstContext;fe!==null;){if(fe.context===R){if(V.tag===1){fe=hi(-1,C&-C),fe.tag=2;var we=V.updateQueue;if(we!==null){we=we.shared;var je=we.pending;je===null?fe.next=fe:(fe.next=je.next,je.next=fe),we.pending=fe}}V.lanes|=C,fe=V.alternate,fe!==null&&(fe.lanes|=C),tf(V.return,C,p),le.lanes|=C;break}fe=fe.next}}else if(V.tag===10)Q=V.type===p.type?null:V.child;else if(V.tag===18){if(Q=V.return,Q===null)throw Error(r(341));Q.lanes|=C,le=Q.alternate,le!==null&&(le.lanes|=C),tf(Q,C,p),Q=V.sibling}else Q=V.child;if(Q!==null)Q.return=V;else for(Q=V;Q!==null;){if(Q===p){Q=null;break}if(V=Q.sibling,V!==null){V.return=Q.return,Q=V;break}Q=Q.return}V=Q}Gr(f,p,O.children,C),p=p.child}return p;case 9:return O=p.type,R=p.pendingProps.children,cs(p,C),O=Sn(O),R=R(O),p.flags|=1,Gr(f,p,R,C),p.child;case 14:return R=p.type,O=In(R,p.pendingProps),O=In(R.type,O),xy(f,p,R,O,C);case 15:return by(f,p,p.type,p.pendingProps,C);case 17:return R=p.type,O=p.pendingProps,O=p.elementType===R?O:In(R,O),bu(f,p),p.tag=1,en(R)?(f=!0,ru(p)):f=!1,cs(p,C),hy(p,R,O),yf(p,R,O,C),_f(null,p,R,!0,f,C);case 19:return Ny(f,p,C);case 22:return wy(f,p,C)}throw Error(r(156,p.tag))};function Zy(f,p){return An(f,p)}function VC(f,p,C,R){this.tag=f,this.key=C,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=p,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=R,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function kn(f,p,C,R){return new VC(f,p,C,R)}function Uf(f){return f=f.prototype,!(!f||!f.isReactComponent)}function $C(f){if(typeof f=="function")return Uf(f)?1:0;if(f!=null){if(f=f.$$typeof,f===M)return 11;if(f===H)return 14}return 2}function zi(f,p){var C=f.alternate;return C===null?(C=kn(f.tag,p,f.key,f.mode),C.elementType=f.elementType,C.type=f.type,C.stateNode=f.stateNode,C.alternate=f,f.alternate=C):(C.pendingProps=p,C.type=f.type,C.flags=0,C.subtreeFlags=0,C.deletions=null),C.flags=f.flags&14680064,C.childLanes=f.childLanes,C.lanes=f.lanes,C.child=f.child,C.memoizedProps=f.memoizedProps,C.memoizedState=f.memoizedState,C.updateQueue=f.updateQueue,p=f.dependencies,C.dependencies=p===null?null:{lanes:p.lanes,firstContext:p.firstContext},C.sibling=f.sibling,C.index=f.index,C.ref=f.ref,C}function Du(f,p,C,R,O,V){var Q=2;if(R=f,typeof f=="function")Uf(f)&&(Q=1);else if(typeof f=="string")Q=5;else e:switch(f){case T:return Ca(C.children,O,V,p);case k:Q=8,O|=8;break;case L:return f=kn(12,C,p,O|2),f.elementType=L,f.lanes=V,f;case B:return f=kn(13,C,p,O),f.elementType=B,f.lanes=V,f;case D:return f=kn(19,C,p,O),f.elementType=D,f.lanes=V,f;case z:return Au(C,O,V,p);default:if(typeof f=="object"&&f!==null)switch(f.$$typeof){case A:Q=10;break e;case I:Q=9;break e;case M:Q=11;break e;case H:Q=14;break e;case U:Q=16,R=null;break e}throw Error(r(130,f==null?f:typeof f,""))}return p=kn(Q,C,p,O),p.elementType=f,p.type=R,p.lanes=V,p}function Ca(f,p,C,R){return f=kn(7,f,R,p),f.lanes=C,f}function Au(f,p,C,R){return f=kn(22,f,R,p),f.elementType=z,f.lanes=C,f.stateNode={isHidden:!1},f}function Wf(f,p,C){return f=kn(6,f,null,p),f.lanes=C,f}function Vf(f,p,C){return p=kn(4,f.children!==null?f.children:[],f.key,p),p.lanes=C,p.stateNode={containerInfo:f.containerInfo,pendingChildren:null,implementation:f.implementation},p}function GC(f,p,C,R,O){this.tag=p,this.containerInfo=f,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=gh(0),this.expirationTimes=gh(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=gh(0),this.identifierPrefix=R,this.onRecoverableError=O,this.mutableSourceEagerHydrationData=null}function $f(f,p,C,R,O,V,Q,le,fe){return f=new GC(f,p,C,le,fe),p===1?(p=1,V===!0&&(p|=8)):p=0,V=kn(3,null,null,p),f.current=V,V.stateNode=f,V.memoizedState={element:R,isDehydrated:C,cache:null,transitions:null,pendingSuspenseBoundaries:null},nf(V),f}function qC(f,p,C){var R=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:E,key:R==null?null:""+R,children:f,containerInfo:p,implementation:C}}function Jy(f){if(!f)return Di;f=f._reactInternals;e:{if(Mt(f)!==f||f.tag!==1)throw Error(r(170));var p=f;do{switch(p.tag){case 3:p=p.stateNode.context;break e;case 1:if(en(p.type)){p=p.stateNode.__reactInternalMemoizedMergedChildContext;break e}}p=p.return}while(p!==null);throw Error(r(171))}if(f.tag===1){var C=f.type;if(en(C))return Tm(f,C,p)}return p}function e0(f,p,C,R,O,V,Q,le,fe){return f=$f(C,R,!0,f,O,V,Q,le,fe),f.context=Jy(null),C=f.current,R=qr(),O=ji(C),V=hi(R,O),V.callback=p??null,Pi(C,V,O),f.current.lanes=O,ao(f,O,R),nn(f,R),f}function Mu(f,p,C,R){var O=p.current,V=qr(),Q=ji(O);return C=Jy(C),p.context===null?p.context=C:p.pendingContext=C,p=hi(V,Q),p.payload={element:f},R=R===void 0?null:R,R!==null&&(p.callback=R),f=Pi(O,p,Q),f!==null&&(jn(f,O,Q,V),cu(f,O,Q)),Q}function Pu(f){if(f=f.current,!f.child)return null;switch(f.child.tag){case 5:return f.child.stateNode;default:return f.child.stateNode}}function t0(f,p){if(f=f.memoizedState,f!==null&&f.dehydrated!==null){var C=f.retryLane;f.retryLane=C!==0&&C<p?C:p}}function Gf(f,p){t0(f,p),(f=f.alternate)&&t0(f,p)}function YC(){return null}var r0=typeof reportError=="function"?reportError:function(f){console.error(f)};function qf(f){this._internalRoot=f}Iu.prototype.render=qf.prototype.render=function(f){var p=this._internalRoot;if(p===null)throw Error(r(409));Mu(f,p,null,null)},Iu.prototype.unmount=qf.prototype.unmount=function(){var f=this._internalRoot;if(f!==null){this._internalRoot=null;var p=f.containerInfo;wa(function(){Mu(null,f,null,null)}),p[si]=null}};function Iu(f){this._internalRoot=f}Iu.prototype.unstable_scheduleHydration=function(f){if(f){var p=Fg();f={blockedOn:null,target:f,priority:p};for(var C=0;C<ki.length&&p!==0&&p<ki[C].priority;C++);ki.splice(C,0,f),C===0&&Ug(f)}};function Yf(f){return!(!f||f.nodeType!==1&&f.nodeType!==9&&f.nodeType!==11)}function Ou(f){return!(!f||f.nodeType!==1&&f.nodeType!==9&&f.nodeType!==11&&(f.nodeType!==8||f.nodeValue!==" react-mount-point-unstable "))}function n0(){}function XC(f,p,C,R,O){if(O){if(typeof R=="function"){var V=R;R=function(){var we=Pu(Q);V.call(we)}}var Q=e0(p,R,f,0,null,!1,!1,"",n0);return f._reactRootContainer=Q,f[si]=Q.current,bo(f.nodeType===8?f.parentNode:f),wa(),Q}for(;O=f.lastChild;)f.removeChild(O);if(typeof R=="function"){var le=R;R=function(){var we=Pu(fe);le.call(we)}}var fe=$f(f,0,!1,null,null,!1,!1,"",n0);return f._reactRootContainer=fe,f[si]=fe.current,bo(f.nodeType===8?f.parentNode:f),wa(function(){Mu(p,fe,C,R)}),fe}function Bu(f,p,C,R,O){var V=C._reactRootContainer;if(V){var Q=V;if(typeof O=="function"){var le=O;O=function(){var fe=Pu(Q);le.call(fe)}}Mu(p,Q,f,O)}else Q=XC(C,p,f,O,R);return Pu(Q)}Bg=function(f){switch(f.tag){case 3:var p=f.stateNode;if(p.current.memoizedState.isDehydrated){var C=io(p.pendingLanes);C!==0&&(mh(p,C|1),nn(p,Ht()),(Lt&6)===0&&(vs=Ht()+500,Ai()))}break;case 13:wa(function(){var R=ci(f,1);if(R!==null){var O=qr();jn(R,f,1,O)}}),Gf(f,1)}},yh=function(f){if(f.tag===13){var p=ci(f,134217728);if(p!==null){var C=qr();jn(p,f,134217728,C)}Gf(f,134217728)}},jg=function(f){if(f.tag===13){var p=ji(f),C=ci(f,p);if(C!==null){var R=qr();jn(C,f,p,R)}Gf(f,p)}},Fg=function(){return Ft},zg=function(f,p){var C=Ft;try{return Ft=f,p()}finally{Ft=C}},Te=function(f,p,C){switch(p){case"input":if(_e(f,C),p=C.name,C.type==="radio"&&p!=null){for(C=f;C.parentNode;)C=C.parentNode;for(C=C.querySelectorAll("input[name="+JSON.stringify(""+p)+'][type="radio"]'),p=0;p<C.length;p++){var R=C[p];if(R!==f&&R.form===f.form){var O=eu(R);if(!O)throw Error(r(90));re(R),_e(R,O)}}}break;case"textarea":We(f,C);break;case"select":p=C.value,p!=null&&Ie(f,!!C.multiple,p,!1)}},Je=Ff,qe=wa;var KC={usingClientEntryPoint:!1,Events:[So,rs,eu,Ge,st,Ff]},Bo={findFiberByHostInstance:da,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},QC={bundleType:Bo.bundleType,version:Bo.version,rendererPackageName:Bo.rendererPackageName,rendererConfig:Bo.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:S.ReactCurrentDispatcher,findHostInstanceByFiber:function(f){return f=Wn(f),f===null?null:f.stateNode},findFiberByHostInstance:Bo.findFiberByHostInstance||YC,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var ju=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ju.isDisabled&&ju.supportsFiber)try{Zt=ju.inject(QC),nt=ju}catch{}}return an.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=KC,an.createPortal=function(f,p){var C=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Yf(p))throw Error(r(200));return qC(f,p,null,C)},an.createRoot=function(f,p){if(!Yf(f))throw Error(r(299));var C=!1,R="",O=r0;return p!=null&&(p.unstable_strictMode===!0&&(C=!0),p.identifierPrefix!==void 0&&(R=p.identifierPrefix),p.onRecoverableError!==void 0&&(O=p.onRecoverableError)),p=$f(f,1,!1,null,null,C,!1,R,O),f[si]=p.current,bo(f.nodeType===8?f.parentNode:f),new qf(p)},an.findDOMNode=function(f){if(f==null)return null;if(f.nodeType===1)return f;var p=f._reactInternals;if(p===void 0)throw typeof f.render=="function"?Error(r(188)):(f=Object.keys(f).join(","),Error(r(268,f)));return f=Wn(p),f=f===null?null:f.stateNode,f},an.flushSync=function(f){return wa(f)},an.hydrate=function(f,p,C){if(!Ou(p))throw Error(r(200));return Bu(null,f,p,!0,C)},an.hydrateRoot=function(f,p,C){if(!Yf(f))throw Error(r(405));var R=C!=null&&C.hydratedSources||null,O=!1,V="",Q=r0;if(C!=null&&(C.unstable_strictMode===!0&&(O=!0),C.identifierPrefix!==void 0&&(V=C.identifierPrefix),C.onRecoverableError!==void 0&&(Q=C.onRecoverableError)),p=e0(p,null,f,1,C??null,O,!1,V,Q),f[si]=p.current,bo(f),R)for(f=0;f<R.length;f++)C=R[f],O=C._getVersion,O=O(C._source),p.mutableSourceEagerHydrationData==null?p.mutableSourceEagerHydrationData=[C,O]:p.mutableSourceEagerHydrationData.push(C,O);return new Iu(p)},an.render=function(f,p,C){if(!Ou(p))throw Error(r(200));return Bu(null,f,p,!1,C)},an.unmountComponentAtNode=function(f){if(!Ou(f))throw Error(r(40));return f._reactRootContainer?(wa(function(){Bu(null,null,f,!1,function(){f._reactRootContainer=null,f[si]=null})}),!0):!1},an.unstable_batchedUpdates=Ff,an.unstable_renderSubtreeIntoContainer=function(f,p,C,R){if(!Ou(C))throw Error(r(200));if(f==null||f._reactInternals===void 0)throw Error(r(38));return Bu(f,p,C,!1,R)},an.version="18.3.1-next-f1338f8080-20240426",an}var f0;function oE(){if(f0)return Qf.exports;f0=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(),Qf.exports=sE(),Qf.exports}var d0;function lE(){if(d0)return zu;d0=1;var t=oE();return zu.createRoot=t.createRoot,zu.hydrateRoot=t.hydrateRoot,zu}var uE=lE();const ed={};function ew(){const t=ed==null?void 0:ed.VITE_API_HOST;return typeof t=="string"&&t.length>0?t:void 0}function tw(){const t=ew();return t?`http://${t}/api/v1`:`${window.location.origin}/api/v1`}function rw(){const t=ew();return t?`ws://${t}`:`${window.location.protocol==="https:"?"wss":"ws"}://${window.location.host}`}const nw=t=>`${rw()}/ws/terminals/${encodeURIComponent(t)}`;async function bt(t,e){const r=(e==null?void 0:e.body)!==void 0&&(e==null?void 0:e.body)!==null?{"Content-Type":"application/json",...e==null?void 0:e.headers}:{...e==null?void 0:e.headers},n=await fetch(`${tw()}${t}`,{...e,headers:r});if(!n.ok){const i=await n.text();let s;try{const o=JSON.parse(i),a=o.error??o.message??i;s=typeof a=="string"?a:JSON.stringify(a)}catch{s=i}throw s||(s=n.statusText||String(n.status)),new Error(`API ${n.status}: ${s}`)}return n.json()}async function cE(t){var s;const e=await fetch(`${tw()}/runs/${encodeURIComponent(t)}/evidence`);if(!e.ok){const o=await e.text();let a=o;try{const l=JSON.parse(o);typeof l.error=="string"&&(a=l.error)}catch{}throw new Error(`API ${e.status}: ${a||e.statusText||String(e.status)}`)}const r=((s=/filename="([^"]+)"/.exec(e.headers.get("Content-Disposition")??""))==null?void 0:s[1])??`${t.replace(/[^A-Za-z0-9._-]/g,"_").slice(0,128)}-evidence.json`,n=URL.createObjectURL(await e.blob()),i=document.createElement("a");i.href=n,i.download=r,document.body.appendChild(i),i.click(),i.remove(),setTimeout(()=>URL.revokeObjectURL(n),0)}const at={listRuns:()=>bt("/runs"),getRun:t=>bt(`/runs/${encodeURIComponent(t)}`),launchRun:t=>bt("/runs",{method:"POST",body:JSON.stringify(t)}),confirmGate:(t,e)=>bt(`/runs/${encodeURIComponent(t)}/gate`,{method:"POST",body:JSON.stringify(e)}),cancelRun:t=>bt(`/runs/${encodeURIComponent(t)}/cancel`,{method:"POST"}),resumeRun:t=>bt(`/runs/${encodeURIComponent(t)}/resume`,{method:"POST"}),getUnitOutput:(t,e)=>bt(`/runs/${encodeURIComponent(t)}/units/${encodeURIComponent(e)}/output`),getGate:t=>bt(`/runs/${encodeURIComponent(t)}/gate`),getRoster:()=>bt("/roster"),listRepos:()=>bt("/repos"),registerRepo:(t,e)=>bt("/repos",{method:"POST",body:JSON.stringify({name:t,rootPath:e})}),cloneAndRegisterRepo:(t,e,r)=>bt("/repos",{method:"POST",body:JSON.stringify({name:t,gitUrl:e,...r?{rootPath:r}:{}})}),getOnboardRun:t=>bt(`/repos/${encodeURIComponent(t)}/onboard`),rerunOnboarding:t=>bt(`/repos/${encodeURIComponent(t)}/onboard`,{method:"POST"}),getHealth:()=>bt("/health"),openTerminal:t=>bt("/terminals",{method:"POST",body:JSON.stringify(t)}),resizeTerminal:(t,e,r)=>bt(`/terminals/${encodeURIComponent(t)}/resize`,{method:"POST",body:JSON.stringify({cols:e,rows:r})}),closeTerminal:t=>bt(`/terminals/${encodeURIComponent(t)}/close`,{method:"POST"}),injectMessage:(t,e,r)=>bt(`/runs/${encodeURIComponent(t)}/inject`,{method:"POST",body:JSON.stringify({message:e,target:r})}),listWorkflows:()=>bt("/workflows"),getWorkflow:t=>bt(`/workflows/${encodeURIComponent(t)}`),createWorkflow:t=>bt("/workflows",{method:"POST",body:JSON.stringify(t)}),saveScript:(t,e,r)=>bt("/scripts",{method:"POST",body:JSON.stringify({name:t,content:e,lang:r})}),listRequirements:(t,e)=>{const r=new URLSearchParams;return e.q&&r.set("q",e.q),e.risk&&r.set("risk",e.risk),e.category&&r.set("category",e.category),e.domain&&r.set("domain",e.domain),r.set("offset",String(e.offset??0)),r.set("limit",String(e.limit??50)),bt(`/repos/${encodeURIComponent(t)}/requirements?${r.toString()}`)},getRequirement:(t,e)=>bt(`/repos/${encodeURIComponent(t)}/requirements/${encodeURIComponent(e)}`),patchRequirement:(t,e,r)=>bt(`/repos/${encodeURIComponent(t)}/requirements/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)}),getDomainGraph:()=>bt("/domain-graph"),getRepoGraph:(t,e)=>{const r=new URLSearchParams;e!=null&&e.focus&&r.set("focus",e.focus),e!=null&&e.limit&&r.set("limit",String(e.limit));const n=r.size>0?`?${r.toString()}`:"";return bt(`/repos/${encodeURIComponent(t)}/graph${n}`)},getBlastRadius:(t,e)=>bt(`/repos/${encodeURIComponent(t)}/graph/blast-radius?name=${encodeURIComponent(e)}`),getRepoGitHistory:t=>bt(`/repos/${encodeURIComponent(t)}/git-history`),getRepoContributors:t=>bt(`/repos/${encodeURIComponent(t)}/contributors`),getRepoDomainGraph:t=>bt(`/repos/${encodeURIComponent(t)}/domain-graph`),listPolicies:()=>bt("/governance/policies"),listConformanceRules:()=>bt("/governance/rules"),getCoverageReport:()=>bt("/governance/coverage"),listClaims:()=>bt("/governance/claims"),upsertPolicy:t=>bt("/governance/policies",{method:"POST",body:JSON.stringify(t)}),upsertConformanceRule:t=>bt("/governance/rules",{method:"POST",body:JSON.stringify(t)}),recallRulesPreview:t=>{const e=new URLSearchParams;for(const[i,s]of Object.entries(t))s&&e.set(i,s);const r=e.toString(),n=r?`?${r}`:"";return bt(`/governance/rules/preview${n}`)},getSettings:()=>bt("/settings"),updateSettings:t=>bt("/settings",{method:"PUT",body:JSON.stringify(t)})},p0=t=>{let e;const r=new Set,n=(u,c)=>{const h=typeof u=="function"?u(e):u;if(!Object.is(h,e)){const v=e;e=c??(typeof h!="object"||h===null)?h:Object.assign({},e,h),r.forEach(d=>d(e,v))}},i=()=>e,a={setState:n,getState:i,getInitialState:()=>l,subscribe:u=>(r.add(u),()=>r.delete(u))},l=e=t(n,i,a);return a},hE=(t=>t?p0(t):p0),fE=t=>t;function dE(t,e=fE){const r=Fu.useSyncExternalStore(t.subscribe,Fu.useCallback(()=>e(t.getState()),[t,e]),Fu.useCallback(()=>e(t.getInitialState()),[t,e]));return Fu.useDebugValue(r),r}const v0=t=>{const e=hE(t),r=n=>dE(e,n);return Object.assign(r,e),r},qs=(t=>t?v0(t):v0),ei=qs(t=>({gates:{},setGate:e=>t(r=>({gates:{...r.gates,[e.runId]:e}})),clearGate:e=>t(r=>{if(!(e in r.gates))return r;const n={...r.gates};return delete n[e],{gates:n}}),ingest:e=>{const r=typeof e.session=="string"?e.session:void 0;r!==void 0&&t(n=>{switch(e.type){case"awaitingHuman":return typeof e.ord=="number"&&typeof e.prompt=="string"?{gates:{...n.gates,[r]:{runId:r,ord:e.ord,prompt:e.prompt,lifecycle:"open",receivedAt:Date.now()}}}:n;case"resumed":case"sessionCompleted":case"runCancelled":case"sessionFailed":{if(!(r in n.gates))return n;const i={...n.gates};return delete i[r],{gates:i}}default:return n}})},reconcile:e=>t(r=>{const n=new Set(e),i={};let s=!1;for(const[o,a]of Object.entries(r.gates))n.has(o)?i[o]=a:s=!0;return s?{gates:i}:r})})),g0=5e4,pE=new Set(["cliOutputDelta","heartbeat"]),Ec=qs(t=>({byRun:{},ingest:e=>{const r=typeof e.session=="string"?e.session:void 0;r!==void 0&&(pE.has(e.type)||t(n=>{const s=[...n.byRun[r]??[],e];return s.length>g0&&s.splice(0,s.length-g0),{byRun:{...n.byRun,[r]:s}}}))},clear:e=>t(r=>{if(!(e in r.byRun))return r;const n={...r.byRun};return delete n[e],{byRun:n}})})),Uv=qs(t=>({entries:[],seq:0,record:e=>t(r=>{const n=r.seq+1;return{seq:n,entries:[...r.entries,{...e,seq:n,ts:Date.now()}]}})})),vE=[{value:"30d",label:"30d"},{value:"60d",label:"60d"},{value:"90d",label:"90d"}];function gE(t,e){const r=e==="30d"?30:e==="60d"?60:90;return t.slice(0,r)}function Wv(t="30d"){const[e,r]=ne.useState(t),n=ne.useCallback(i=>gE(i,e),[e]);return{range:e,setRange:r,filter:n}}const mE={fontFamily:"monospace"};function Vv({value:t,onChange:e}){return _.jsx("div",{role:"group","aria-label":"Time range",style:{display:"flex",gap:"4px"},children:vE.map(({value:r,label:n})=>_.jsx("button",{type:"button","aria-pressed":t===r,onClick:()=>e(r),style:{padding:"3px 8px",borderRadius:"5px",fontSize:"10px",fontWeight:600,...mE,cursor:"pointer",border:"1px solid",borderColor:t===r?"rgba(121,192,255,0.5)":"rgba(230,237,243,0.1)",background:t===r?"rgba(121,192,255,0.12)":"transparent",color:t===r?"#79c0ff":"rgba(230,237,243,0.4)",transition:"all 0.15s"},children:n},r))})}const Hu=new Set(["planning","distributing","executing","awaiting_human"]),yE=new Set(["awaitingHuman","gateEscalated","stepFailed","sessionFailed","crashRecoveryRedrive","unitDone","workflowSelected","acpFallback"]),St={fontFamily:"monospace"},Ls={background:"#1b222e",border:"1px solid rgba(230,237,243,0.08)",borderRadius:"12px"},Ra={fontSize:"10px",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.1em",color:"rgba(230,237,243,0.4)",fontFamily:"monospace",margin:0},xE={pending:"rgba(230,237,243,0.18)",distributed:"#79c0ff",done:"#3fb950",rejected:"#f85149"},bE={distributed:!0};function cl(t,e){return t.length>e?`${t.slice(0,e)}…`:t}function lv(t){const e=t.session.problem;return e.length>0?cl(e,32):t.session.id.slice(0,8)}function wE(t){return t<.01?"<$0.01":`$${t.toFixed(2)}`}function _E(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}k`:String(t)}const iw={awaitingHuman:{icon:"🔒",label:"Gate decision required",borderColor:"rgba(255,218,25,0.35)",textColor:"#ffda19",badgeColor:"rgba(255,218,25,0.12)"},gateEscalated:{icon:"⬆",label:"Gate escalated to human",borderColor:"rgba(121,192,255,0.3)",textColor:"#79c0ff",badgeColor:"rgba(121,192,255,0.08)"},stepFailed:{icon:"✕",label:"Step failed",borderColor:"rgba(248,81,73,0.3)",textColor:"#f85149",badgeColor:"rgba(248,81,73,0.08)"},sessionFailed:{icon:"✕",label:"Session failed",borderColor:"rgba(248,81,73,0.3)",textColor:"#f85149",badgeColor:"rgba(248,81,73,0.08)"},crashRecoveryRedrive:{icon:"↻",label:"Crash recovery redrive",borderColor:"rgba(248,81,73,0.2)",textColor:"rgba(248,81,73,0.8)",badgeColor:"rgba(248,81,73,0.06)"},unitDone:{icon:"✓",label:"Unit complete",borderColor:"rgba(63,185,80,0.2)",textColor:"#3fb950",badgeColor:"rgba(63,185,80,0.06)"},workflowSelected:{icon:"◈",label:"Workflow selected",borderColor:"rgba(167,139,250,0.25)",textColor:"#a78bfa",badgeColor:"rgba(167,139,250,0.06)"},acpFallback:{icon:"⚠",label:"ACP degraded — single-shot fallback",borderColor:"rgba(248,81,73,0.2)",textColor:"rgba(248,81,73,0.75)",badgeColor:"rgba(248,81,73,0.05)"}},aw={icon:"·",label:"Event",borderColor:"rgba(230,237,243,0.08)",textColor:"#e6edf3",badgeColor:"rgba(230,237,243,0.04)"};function SE({runId:t,ord:e,prompt:r,sessionLbl:n,onApprove:i,onReject:s}){const[o,a]=ne.useState(""),[l,u]=ne.useState(!1),[c,h]=ne.useState(!1),v=ne.useCallback(async x=>{u(!0);try{await x()}catch{}finally{u(!1)}},[]),d=iw.awaitingHuman??aw;return _.jsxs("div",{style:{background:"#161c26",border:`1px solid ${d.borderColor}`,borderRadius:"10px",padding:"14px 16px"},children:[_.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:"4px"},children:[_.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"7px"},children:[_.jsx("span",{style:{color:d.textColor,fontSize:"13px"},children:d.icon}),_.jsx("span",{style:{fontSize:"12px",fontWeight:600,color:d.textColor,...St},children:d.label})]}),_.jsx("span",{style:{fontSize:"10px",color:"rgba(230,237,243,0.4)",...St,flexShrink:0,marginLeft:"8px"},children:n})]}),_.jsxs("p",{style:{fontSize:"11px",color:"rgba(230,237,243,0.45)",...St,margin:"0 0 8px"},children:[t.slice(0,8),typeof e=="number"?` · before unit #${e}`:""]}),r&&_.jsx("p",{style:{fontSize:"12px",color:"rgba(230,237,243,0.7)",...St,margin:"0 0 10px",lineHeight:1.5,display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"},children:r}),c&&_.jsx("textarea",{style:{width:"100%",background:"#0f1419",border:"1px solid rgba(230,237,243,0.14)",borderRadius:"6px",color:"#e6edf3",fontSize:"12px",...St,padding:"6px 8px",resize:"vertical",marginBottom:"10px",boxSizing:"border-box",outline:"none"},rows:2,placeholder:"Steer / amendment for the next unit…",value:o,onChange:x=>a(x.target.value),disabled:l}),_.jsxs("div",{style:{display:"flex",gap:"6px",flexWrap:"wrap"},children:[_.jsx("button",{type:"button",disabled:l,onClick:()=>void v(()=>i(t)),style:{background:"#3fb950",color:"#0d1117",border:"none",borderRadius:"6px",padding:"5px 12px",fontSize:"11px",fontWeight:700,...St,cursor:l?"not-allowed":"pointer",opacity:l?.5:1},children:"Approve"}),_.jsx("button",{type:"button",disabled:l,onClick:()=>{c?o.trim()&&v(()=>i(t,o.trim())):h(!0)},style:{background:c&&o.trim()?"#ffda19":"rgba(255,218,25,0.12)",color:c&&o.trim()?"#0d1117":"#ffda19",border:"1px solid rgba(255,218,25,0.3)",borderRadius:"6px",padding:"5px 12px",fontSize:"11px",fontWeight:600,...St,cursor:l?"not-allowed":"pointer",opacity:l?.5:1},children:c&&o.trim()?"Send steer":"Approve + steer"}),_.jsx("button",{type:"button",disabled:l,onClick:()=>void v(()=>s(t)),style:{background:"rgba(248,81,73,0.1)",color:"#f85149",border:"1px solid rgba(248,81,73,0.3)",borderRadius:"6px",padding:"5px 12px",fontSize:"11px",fontWeight:600,...St,cursor:l?"not-allowed":"pointer",opacity:l?.5:1},children:"Reject"})]})]})}function CE({type:t,sessionId:e,sessionLbl:r,ord:n,detail:i}){const s=iw[t]??aw;return _.jsxs("div",{style:{background:s.badgeColor,border:`1px solid ${s.borderColor}`,borderRadius:"8px",padding:"8px 12px",display:"flex",alignItems:"flex-start",gap:"8px"},children:[_.jsx("span",{style:{color:s.textColor,fontSize:"12px",lineHeight:"18px",flexShrink:0},children:s.icon}),_.jsxs("div",{style:{flex:1,minWidth:0},children:[_.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:"8px"},children:[_.jsxs("span",{style:{fontSize:"11px",fontWeight:600,color:s.textColor,...St},children:[s.label,typeof n=="number"?` · unit #${n}`:""]}),_.jsx("span",{style:{fontSize:"10px",color:"rgba(230,237,243,0.3)",...St,flexShrink:0},children:e.slice(0,6)})]}),i&&_.jsx("p",{style:{fontSize:"11px",color:"rgba(230,237,243,0.55)",...St,margin:"2px 0 0",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:i,children:cl(i,80)}),!i&&_.jsx("p",{style:{fontSize:"10px",color:"rgba(230,237,243,0.3)",...St,margin:"2px 0 0"},children:r})]})]})}function EE({view:t,onSelect:e}){const{session:r,units:n}=t,i=lv(t),s=r.id,o=r.status==="awaiting_human";return _.jsxs("button",{type:"button",style:{display:"flex",alignItems:"flex-start",gap:"10px",padding:"10px 12px",background:"#1b222e",border:"1px solid rgba(230,237,243,0.07)",borderRadius:"10px",cursor:"pointer",transition:"border-color 0.15s",width:"100%",textAlign:"left"},onClick:()=>e(s),onMouseEnter:a=>{a.currentTarget.style.borderColor="rgba(230,237,243,0.18)"},onMouseLeave:a=>{a.currentTarget.style.borderColor="rgba(230,237,243,0.07)"},children:[_.jsx("span",{style:{width:"7px",height:"7px",borderRadius:"50%",background:o?"#ffda19":"#79c0ff",flexShrink:0,marginTop:"5px",boxShadow:o?"0 0 6px rgba(255,218,25,0.5)":"0 0 6px rgba(121,192,255,0.4)"}}),_.jsxs("div",{style:{flex:1,minWidth:0},children:[_.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"6px",gap:"8px"},children:[_.jsx("span",{style:{fontSize:"11px",fontWeight:600,color:"#e6edf3",...St,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:i}),_.jsxs("span",{style:{fontSize:"10px",color:"rgba(230,237,243,0.35)",...St,flexShrink:0},children:[s.slice(0,6)," · Open chat →"]})]}),_.jsx("div",{style:{display:"flex",gap:"4px",flexWrap:"wrap"},children:n.length===0?_.jsx("span",{style:{fontSize:"10px",color:"rgba(230,237,243,0.3)",...St},children:"planning…"}):n.map(a=>{const l=["completed","cancelled","failed"].includes(r.status),u=l&&a.status==="distributed"?"rgba(230,237,243,0.18)":xE[a.status]??"rgba(230,237,243,0.18)",c=bE[a.status]===!0&&!l;return _.jsx("span",{title:`unit #${a.ord} — ${a.stage??"?"} — ${a.status}`,style:{display:"inline-block",width:"8px",height:"8px",borderRadius:"50%",background:u,flexShrink:0,animation:c?"pulse 1.5s ease-in-out infinite":"none"}},a.ord)})})]})]})}function kE({activeRuns:t}){const[e,r]=ne.useState(""),[n,i]=ne.useState("__all__"),[s,o]=ne.useState(!1),[a,l]=ne.useState(!1),u=ne.useRef(null),c=ne.useRef(null);ne.useEffect(()=>()=>{c.current&&clearTimeout(c.current)},[]);const h=ne.useCallback(async()=>{var d;const v=e.trim();if(!(!v||t.length===0)){o(!0);try{if(n==="__all__"){const w=(await Promise.allSettled(t.map(g=>at.injectMessage(g.session.id,v,"all")))).filter(g=>g.status==="rejected").length;if(w>0)throw new Error(`${w} inject(s) failed`)}else await at.injectMessage(n,v,"all");r(""),l(!0),c.current=setTimeout(()=>l(!1),2500),(d=u.current)==null||d.focus()}finally{o(!1)}}},[e,n,t]);return _.jsxs("div",{children:[_.jsx("p",{style:{...Ra,marginBottom:"10px"},children:"Send to agents"}),_.jsx("div",{style:{...Ls,padding:"14px 16px"},children:t.length===0?_.jsx("p",{style:{fontSize:"11px",color:"rgba(230,237,243,0.3)",...St},children:"No active sessions"}):_.jsxs(_.Fragment,{children:[_.jsx("div",{style:{display:"flex",gap:"8px",marginBottom:"8px",flexWrap:"wrap"},children:_.jsxs("select",{value:n,onChange:v=>i(v.target.value),disabled:s,style:{background:"#0f1419",border:"1px solid rgba(230,237,243,0.14)",borderRadius:"6px",color:"#e6edf3",fontSize:"11px",...St,padding:"4px 8px",cursor:"pointer",outline:"none",flexShrink:0},children:[_.jsx("option",{value:"__all__",children:"All active agents"}),t.map(v=>_.jsxs("option",{value:v.session.id,children:[cl(v.session.problem||v.session.id,30)," (",v.session.id.slice(0,6),")"]},v.session.id))]})}),_.jsx("textarea",{ref:u,value:e,onChange:v=>r(v.target.value),onKeyDown:v=>{v.key==="Enter"&&(v.ctrlKey||v.metaKey)&&h()},disabled:s,placeholder:"Message to inject into the agent's context… (Ctrl+Enter to send)",rows:3,style:{width:"100%",background:"#0f1419",border:"1px solid rgba(230,237,243,0.14)",borderRadius:"6px",color:"#e6edf3",fontSize:"12px",...St,padding:"8px 10px",resize:"vertical",outline:"none",boxSizing:"border-box",marginBottom:"8px"}}),_.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px"},children:[_.jsx("button",{type:"button",disabled:s||!e.trim(),onClick:()=>void h(),style:{background:e.trim()?"#79c0ff":"rgba(121,192,255,0.15)",color:e.trim()?"#0d1117":"rgba(121,192,255,0.45)",border:"none",borderRadius:"6px",padding:"6px 14px",fontSize:"11px",fontWeight:700,...St,cursor:s||!e.trim()?"not-allowed":"pointer",transition:"all 0.15s"},children:s?"Sending…":"Send"}),a&&_.jsx("span",{style:{fontSize:"11px",color:"#3fb950",...St},children:"✓ Injected"}),_.jsx("span",{style:{fontSize:"10px",color:"rgba(230,237,243,0.25)",...St},children:"Ctrl+Enter"})]})]})})]})}function TE({runs:t,onSelectRun:e,onApproveGate:r,onRejectGate:n,navigate:i}){const s=Ec(k=>k.byRun),o=ei(k=>k.gates),a=ei(k=>k.clearGate),l=Uv(k=>k.record),{range:u,setRange:c,filter:h}=Wv("30d"),v=ne.useMemo(()=>h(t),[t,h]),d=ne.useMemo(()=>v.filter(k=>Hu.has(k.session.status)),[v]),x=ne.useMemo(()=>{let k=0,L=0,A=0,I=!1;for(const M of d){const B=s[M.session.id]??[];for(const D of B)D.type==="cliUsage"&&(typeof D.inputTokens=="number"&&(k+=D.inputTokens),typeof D.outputTokens=="number"&&(L+=D.outputTokens),typeof D.costUsd=="number"&&(A+=D.costUsd,I=!0))}return{totalTokens:k+L,totalCost:I?A:null}},[s,d]),w=ne.useMemo(()=>v.reduce((k,L)=>k+L.units.filter(A=>A.status==="distributed").length,0),[v]),g=ne.useCallback(async(k,L)=>{await at.confirmGate(k,{approve:!0,...L?{amend:L}:{}}),l({runId:k,action:L?"approve-with-steer":"approve",...L?{amend:L}:{}}),a(k),r(k,L)},[a,l,r]),m=ne.useCallback(async k=>{await at.confirmGate(k,{approve:!1}),l({runId:k,action:"reject"}),a(k),n(k)},[a,l,n]),y=ne.useMemo(()=>{const k=[];for(const L of d){const A=L.session.id,I=lv(L),B=(s[A]??[]).slice(-30);for(const D of B){if(D.type==="awaitingHuman"||!yE.has(D.type))continue;let H;if(D.type==="stepFailed"&&typeof D.detail=="string")H=D.detail;else if(D.type==="sessionFailed"&&typeof D.message=="string")H=D.message;else if(D.type==="workflowSelected"&&typeof D.workflowId=="string")H=`workflow: ${D.workflowId}`;else if(D.type==="acpFallback"){const U=typeof D.reason=="string"?D.reason:"";H=[typeof D.cliKey=="string"?D.cliKey:"",U].filter(Boolean).join(" — ")}else D.type==="crashRecoveryRedrive"&&typeof D.attempt=="number"&&(H=`attempt #${D.attempt}`);k.push({key:`${A}-${D.type}-${typeof D.ord=="number"?D.ord:0}-${k.length}`,sessionId:A,sessionLbl:I,type:D.type,...typeof D.ord=="number"?{ord:D.ord}:{},...H!==void 0?{detail:H}:{}})}}return k.reverse(),k},[s,d]),b=ne.useMemo(()=>Object.values(o).sort((k,L)=>L.receivedAt-k.receivedAt),[o]),S=ne.useMemo(()=>v.filter(k=>!k.session.workflow_id||k.session.workflow_id==="chat").slice().reverse(),[v]),N=ne.useMemo(()=>v.filter(k=>!!k.session.workflow_id&&k.session.workflow_id!=="chat"),[v]),E=ne.useMemo(()=>N.filter(k=>Hu.has(k.session.status)),[N]),T=ne.useMemo(()=>v.filter(k=>k.session.status==="completed").slice(-5).reverse(),[v]);return _.jsxs("div",{style:{color:"#e6edf3",...St},children:[_.jsx("style",{children:`
41
- @keyframes pulse {
42
- 0%, 100% { opacity: 1; }
43
- 50% { opacity: 0.4; }
44
- }
45
- `}),_.jsxs("div",{style:{maxWidth:"1100px",margin:"0 auto",padding:"28px 32px"},children:[_.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"24px",gap:"16px",flexWrap:"wrap"},children:[_.jsxs("div",{children:[_.jsx("h1",{style:{fontSize:"20px",fontWeight:600,color:"#e6edf3",margin:0,...St},children:"wicked-crew studio"}),_.jsx("p",{style:{fontSize:"11px",color:"rgba(230,237,243,0.38)",margin:"4px 0 0",...St},children:"cross-session control"})]}),_.jsxs("div",{style:{display:"flex",gap:"20px",flexWrap:"wrap",alignItems:"center"},children:[_.jsx(Vv,{value:u,onChange:c}),_.jsx(Uu,{label:"Active sessions",value:String(d.length),color:"#79c0ff"}),_.jsx(Uu,{label:"Units in-flight",value:String(w),color:"#79c0ff"}),_.jsx(Uu,{label:"Cost",value:x.totalCost!==null?wE(x.totalCost):"—",color:x.totalCost!==null?"#3fb950":"rgba(230,237,243,0.3)"}),_.jsx(Uu,{label:"Tokens",value:x.totalTokens>0?_E(x.totalTokens):"—",color:x.totalTokens>0?"#e6edf3":"rgba(230,237,243,0.3)"})]})]}),b.length>0&&_.jsxs("div",{style:{marginBottom:"24px"},children:[_.jsx("p",{style:{...Ra,marginBottom:"10px"},children:"Gate inbox"}),_.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:b.map(k=>{const L=t.find(I=>I.session.id===k.runId),A=L?lv(L):k.runId.slice(0,8);return _.jsx(SE,{runId:k.runId,ord:k.ord,prompt:k.prompt,sessionLbl:A,onApprove:g,onReject:m},`gate-${k.runId}-${k.ord??"x"}`)})})]}),_.jsxs("div",{style:{display:"grid",gridTemplateColumns:"2fr 1fr 1.5fr",gap:"16px",marginBottom:"28px",alignItems:"start"},children:[_.jsxs("div",{style:{...Ls,padding:"16px 20px"},children:[_.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"12px"},children:[_.jsx("p",{style:Ra,children:"Runs"}),_.jsx("button",{type:"button",onClick:()=>i("/runs/new"),style:{background:"#ffda19",color:"#0d1117",border:"none",borderRadius:"6px",padding:"4px 12px",fontSize:"11px",fontWeight:700,...St,cursor:"pointer",flexShrink:0},children:"Do Work"})]}),N.length===0?_.jsx("p",{style:{fontSize:"11px",color:"rgba(230,237,243,0.3)",...St,fontStyle:"italic"},children:"No work sessions yet"}):_.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[...E,...N.filter(k=>!Hu.has(k.session.status)).slice(-3).reverse()].slice(0,5).map(k=>_.jsx(EE,{view:k,onSelect:e},k.session.id))}),N.length>5&&_.jsx("button",{type:"button",onClick:()=>i("/work"),style:{fontSize:"11px",color:"#79c0ff",...St,background:"none",border:"none",cursor:"pointer",padding:"8px 0 0",display:"block"},children:"view all →"})]}),_.jsxs("div",{style:{...Ls,padding:"16px 20px"},children:[_.jsx("p",{style:{...Ra,marginBottom:"12px"},children:"Campaigns"}),_.jsxs("div",{"data-testid":"campaign-dag-stub",style:{border:"1px dashed rgba(230,237,243,0.15)",borderRadius:"8px",padding:"12px",background:"#161c26"},children:[_.jsx("p",{style:{fontSize:"11px",fontWeight:600,color:"rgba(230,237,243,0.55)",...St,margin:"0 0 4px"},children:"Campaign DAG"}),_.jsx("p",{style:{fontSize:"10px",color:"rgba(230,237,243,0.35)",...St,margin:0,lineHeight:1.5},children:"Pending core's Campaign primitive + RunFinished events (§4.3)."})]})]}),_.jsxs("div",{style:{...Ls,padding:"16px 20px"},children:[_.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"12px"},children:[_.jsx("p",{style:Ra,children:"Chats"}),_.jsx("button",{type:"button",onClick:()=>i("/chat/new"),style:{background:"rgba(121,192,255,0.12)",color:"#79c0ff",border:"1px solid rgba(121,192,255,0.25)",borderRadius:"6px",padding:"4px 10px",fontSize:"11px",fontWeight:600,...St,cursor:"pointer",flexShrink:0},children:"New Chat"})]}),S.length===0?_.jsx("p",{style:{fontSize:"11px",color:"rgba(230,237,243,0.3)",...St,fontStyle:"italic"},children:"No chats yet"}):_.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:S.slice(0,4).map(k=>_.jsxs("button",{type:"button",onClick:()=>e(k.session.id),style:{display:"flex",alignItems:"center",gap:"8px",padding:"6px 8px",background:"transparent",border:"1px solid rgba(230,237,243,0.06)",borderRadius:"8px",cursor:"pointer",textAlign:"left",width:"100%"},onMouseEnter:L=>{L.currentTarget.style.background="rgba(230,237,243,0.03)"},onMouseLeave:L=>{L.currentTarget.style.background="transparent"},children:[_.jsx("span",{style:{width:"7px",height:"7px",borderRadius:"50%",flexShrink:0,background:Hu.has(k.session.status)?"#79c0ff":k.session.status==="completed"?"#3fb950":"rgba(230,237,243,0.25)"}}),_.jsx("span",{style:{fontSize:"11px",color:"#e6edf3",...St,flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:cl(k.session.problem||k.session.id,28)})]},k.session.id))}),S.length>4&&_.jsx("button",{type:"button",onClick:()=>i("/chats"),style:{fontSize:"11px",color:"#79c0ff",...St,background:"none",border:"none",cursor:"pointer",padding:"8px 0 0",display:"block"},children:"view all →"})]})]}),b.length===0&&d.length>0&&_.jsxs("div",{style:{marginBottom:"28px"},children:[_.jsx("p",{style:{...Ra,marginBottom:"10px"},children:"Agent activity"}),_.jsxs("div",{style:{...Ls,padding:"14px",maxHeight:"220px",overflowY:"auto",display:"flex",flexDirection:"column",gap:"8px"},children:[y.slice(0,5).map(k=>_.jsx(CE,{type:k.type,sessionId:k.sessionId,sessionLbl:k.sessionLbl,...k.ord!==void 0?{ord:k.ord}:{},...k.detail!==void 0?{detail:k.detail}:{}},k.key)),y.length===0&&_.jsx("p",{style:{fontSize:"12px",color:"rgba(230,237,243,0.28)",...St,textAlign:"center",padding:"12px 0"},children:"Waiting for events…"})]})]}),T.length>0&&_.jsxs("div",{style:{marginBottom:"28px"},children:[_.jsx("p",{style:{...Ra,marginBottom:"10px"},children:"Sessions review"}),_.jsx("div",{style:{...Ls,padding:"4px 0",display:"flex",flexDirection:"column"},children:T.map((k,L)=>_.jsxs("button",{type:"button",onClick:()=>e(k.session.id),style:{display:"flex",alignItems:"center",gap:"10px",padding:"8px 16px",background:"transparent",border:"none",borderTop:L===0?"none":"1px solid rgba(230,237,243,0.05)",cursor:"pointer",textAlign:"left",width:"100%"},onMouseEnter:A=>{A.currentTarget.style.background="rgba(230,237,243,0.03)"},onMouseLeave:A=>{A.currentTarget.style.background="transparent"},children:[_.jsx("span",{style:{width:"7px",height:"7px",borderRadius:"50%",flexShrink:0,background:"#3fb950"}}),_.jsx("span",{style:{fontSize:"12px",color:"#e6edf3",...St,flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:cl(k.session.problem||k.session.id,60)}),_.jsx("span",{style:{fontSize:"10px",color:"rgba(230,237,243,0.3)",...St,flexShrink:0},children:k.session.id.slice(0,8)}),_.jsx("span",{style:{fontSize:"10px",color:"rgba(121,192,255,0.5)",...St,flexShrink:0},children:"→"})]},k.session.id))})]}),_.jsx(kE,{activeRuns:d})]})]})}function Uu({label:t,value:e,color:r}){return _.jsxs("div",{style:{textAlign:"right"},children:[_.jsx("p",{style:{fontSize:"10px",color:"rgba(230,237,243,0.38)",...St,margin:0},children:t}),_.jsx("p",{style:{fontSize:"16px",fontWeight:600,color:r,...St,margin:"2px 0 0"},children:e})]})}const NE=t=>["completed","failed","cancelled"].includes(t);function RE({runs:t,onSelect:e,navigate:r}){const[n,i]=ne.useState(""),{range:s,setRange:o,filter:a}=Wv("30d"),l=ne.useMemo(()=>t.filter(d=>!d.session.workflow_id||d.session.workflow_id==="chat"),[t]),u=ne.useMemo(()=>a(l),[l,a]),c=ne.useMemo(()=>u.filter(d=>!NE(d.session.status)),[u]),h=ne.useMemo(()=>{if(u.length===0)return"—";const x=u.reduce((w,g)=>w+g.units.length,0)/u.length;return x%1===0?String(x):x.toFixed(1)},[u]),v=ne.useMemo(()=>n?u.filter(d=>d.session.problem.toLowerCase().includes(n.toLowerCase())):u,[u,n]);return _.jsxs("div",{className:"flex flex-col gap-6",style:{color:"#e6edf3"},children:[_.jsxs("div",{className:"px-8 pt-8 pb-4 flex items-center justify-between gap-4",children:[_.jsx("h1",{className:"text-2xl font-semibold font-mono",children:"Chats"}),_.jsxs("div",{className:"flex items-center gap-3",children:[_.jsx(Vv,{value:s,onChange:o}),_.jsx("input",{type:"text",placeholder:"Search chats…",value:n,onChange:d=>i(d.target.value),className:"rounded-xl px-4 py-2 text-sm font-mono outline-none",style:{background:"#1b222e",border:"1px solid rgba(230,237,243,0.12)",color:"#e6edf3",width:"220px"}}),_.jsx("button",{type:"button",onClick:()=>r("/chat/new"),className:"rounded-lg px-4 py-2 text-sm font-semibold font-mono shrink-0",style:{background:"#ffda19",color:"#0d1117"},children:"New Chat"})]})]}),_.jsx("div",{className:"px-8 grid grid-cols-3 gap-4",children:[{label:"Total Chats",value:String(u.length),accent:void 0},{label:"Active",value:String(c.length),accent:"#79c0ff"},{label:"Avg Units",value:h,accent:"#a78bfa"}].map(d=>_.jsxs("div",{className:"rounded-2xl px-6 py-4",style:{background:"#1b222e",border:"1px solid rgba(230,237,243,0.07)"},children:[_.jsx("p",{className:"text-xs font-mono uppercase tracking-widest",style:{color:"rgba(230,237,243,0.4)"},children:d.label}),_.jsx("p",{className:"text-3xl font-semibold mt-1",style:{color:d.accent??"#e6edf3"},children:d.value})]},d.label))}),_.jsx("div",{className:"px-8 pb-8 flex flex-col gap-2",children:v.length===0?_.jsxs("div",{className:"rounded-2xl p-10 text-center",style:{background:"#1b222e",border:"1px solid rgba(230,237,243,0.07)"},children:[_.jsx("p",{className:"text-base font-mono font-semibold mb-3",children:"No chat sessions yet"}),_.jsx("p",{className:"text-sm font-mono",style:{color:"rgba(230,237,243,0.45)"},children:"Chat sessions let you explore your repos, ask questions, and get answers without kicking off a full build workflow."}),_.jsx("p",{className:"mt-5",children:_.jsx("button",{type:"button",onClick:()=>r("/chat/new"),className:"text-sm font-mono hover:underline",style:{color:"#79c0ff",background:"none",border:"none",cursor:"pointer"},children:"Click New Chat to start"})})]}):v.map(d=>_.jsxs("button",{type:"button",onClick:()=>e(d.session.id),className:"w-full text-left rounded-2xl px-5 py-4 transition-colors",style:{background:"#1b222e",border:"1px solid rgba(230,237,243,0.07)"},children:[_.jsx("p",{className:"text-sm font-mono truncate",children:d.session.problem}),_.jsxs("p",{className:"text-xs mt-1 font-mono",style:{color:"rgba(230,237,243,0.35)"},children:[d.session.id.slice(0,8)," · ",d.session.status]})]},d.session.id))})]})}function Ms(t){return`${(t*100).toFixed(1)}%`}function LE({coverage:t,threshold:e}){const r=t>=e;return _.jsx("span",{className:"inline-flex items-center gap-1 rounded px-2 py-0.5 text-xs font-semibold font-mono",style:{background:r?"rgba(63,185,80,0.12)":"rgba(248,81,73,0.12)",color:r?"#3fb950":"#f85149",border:`1px solid ${r?"rgba(63,185,80,0.3)":"rgba(248,81,73,0.3)"}`},children:r?"GATE PASS":"GATE FAIL"})}function DE({report:t}){const e=[{label:"Total nodes",value:String(t.total)},{label:"Behavior-bearing",value:String(t.behavior_bearing)},{label:"Resolved",value:String(t.resolved)},{label:"Risk-flagged",value:String(t.risk_flagged)},{label:"Unaccounted",value:String(t.unaccounted)},{label:"Coverage",value:Ms(t.coverage)},{label:"Resolved rate",value:Ms(t.resolved_rate)},{label:"Mean confidence",value:Ms(t.mean_confidence)},{label:"Threshold",value:Ms(t.resolve_threshold)}];return _.jsx("div",{className:"grid grid-cols-3 gap-2 sm:grid-cols-5",children:e.map(({label:r,value:n})=>_.jsxs("div",{className:"rounded p-2 text-center",style:{border:"1px solid rgba(230,237,243,0.07)",background:"#1b222e"},children:[_.jsx("p",{className:"text-[11px]",style:{color:"rgba(230,237,243,0.4)"},children:r}),_.jsx("p",{className:"text-sm font-semibold",style:{color:"#e6edf3"},children:n})]},r))})}function AE({apps:t}){return t.length===0?_.jsx("p",{className:"text-xs",style:{color:"rgba(230,237,243,0.4)"},children:"No per-app data."}):_.jsxs("table",{className:"w-full text-[11px]",children:[_.jsx("thead",{children:_.jsxs("tr",{className:"border-b text-left",style:{borderColor:"rgba(230,237,243,0.08)",color:"rgba(230,237,243,0.4)"},children:[_.jsx("th",{className:"py-1 pr-3 font-medium",children:"App"}),_.jsx("th",{className:"py-1 pr-3 font-medium text-right",children:"Behavior-bearing"}),_.jsx("th",{className:"py-1 pr-3 font-medium text-right",children:"Resolved"}),_.jsx("th",{className:"py-1 pr-3 font-medium text-right",children:"Risk"}),_.jsx("th",{className:"py-1 pr-3 font-medium text-right",children:"Unaccounted"}),_.jsx("th",{className:"py-1 font-medium text-right",children:"Coverage"})]})}),_.jsx("tbody",{children:t.map(e=>_.jsxs("tr",{className:"border-b",style:{borderColor:"rgba(230,237,243,0.06)"},children:[_.jsx("td",{className:"py-1 pr-3 font-mono",style:{color:"rgba(230,237,243,0.7)"},children:e.app}),_.jsx("td",{className:"py-1 pr-3 text-right",style:{color:"rgba(230,237,243,0.6)"},children:e.behavior_bearing}),_.jsx("td",{className:"py-1 pr-3 text-right",style:{color:"#3fb950"},children:e.resolved}),_.jsx("td",{className:"py-1 pr-3 text-right",style:{color:"#ffda19"},children:e.risk_flagged}),_.jsx("td",{className:"py-1 pr-3 text-right",style:{color:"#f85149"},children:e.unaccounted}),_.jsx("td",{className:"py-1 text-right font-semibold",style:{color:"#e6edf3"},children:Ms(e.coverage)})]},e.app))})]})}function Wu({col:t,active:e,dir:r,onSort:n,children:i}){return _.jsxs("button",{type:"button",onClick:()=>n(t),className:"font-medium transition-colors",style:{color:e===t?"#79c0ff":"rgba(230,237,243,0.4)"},children:[i,e===t?r==="asc"?" ▲":" ▼":""]})}function ME({nodes:t}){const[e,r]=ne.useState(""),[n,i]=ne.useState("file"),[s,o]=ne.useState("asc"),[a,l]=ne.useState(""),[u,c]=ne.useState(""),h=ne.useMemo(()=>[...new Set(t.map(g=>g.kind??"").filter(Boolean))].sort(),[t]),v=ne.useMemo(()=>[...new Set(t.map(g=>g.app??"").filter(Boolean))].sort(),[t]),d=ne.useCallback(g=>{g===n?o(m=>m==="asc"?"desc":"asc"):(i(g),o("asc"))},[n]),x=ne.useMemo(()=>{let g=t;if(e){const m=e.toLowerCase();g=g.filter(y=>(y.name??"").toLowerCase().includes(m)||(y.file??"").toLowerCase().includes(m)||(y.symbol_id??"").toLowerCase().includes(m))}return a&&(g=g.filter(m=>m.kind===a)),u&&(g=g.filter(m=>m.app===u)),[...g].sort((m,y)=>{const b=n==="name"?m.name??m.symbol_id:m[n]??"",S=n==="name"?y.name??y.symbol_id:y[n]??"";return s==="asc"?b.localeCompare(S):S.localeCompare(b)})},[t,e,a,u,n,s]),w={background:"#161c26",border:"1px solid rgba(230,237,243,0.1)",color:"#e6edf3"};return t.length===0?_.jsx("p",{className:"text-xs",style:{color:"#3fb950"},children:"No unaccounted nodes — gate is satisfied."}):_.jsxs("div",{className:"flex flex-col gap-2",children:[_.jsxs("div",{className:"flex flex-wrap gap-2",children:[_.jsx("input",{type:"text","aria-label":"Search by name, file, or symbol id",placeholder:"Search name / file / id…",value:e,onChange:g=>r(g.target.value),className:"rounded px-2 py-1 text-[11px] w-48 focus:outline-none",style:w}),_.jsxs("select",{"aria-label":"Filter by kind",value:a,onChange:g=>l(g.target.value),className:"rounded px-2 py-1 text-[11px] focus:outline-none",style:w,children:[_.jsx("option",{value:"",children:"All kinds"}),h.map(g=>_.jsx("option",{value:g,children:g},g))]}),_.jsxs("select",{"aria-label":"Filter by app",value:u,onChange:g=>c(g.target.value),className:"rounded px-2 py-1 text-[11px] focus:outline-none",style:w,children:[_.jsx("option",{value:"",children:"All apps"}),v.map(g=>_.jsx("option",{value:g,children:g},g))]}),_.jsxs("span",{className:"ml-auto text-[11px]",style:{color:"rgba(230,237,243,0.4)"},children:[x.length," / ",t.length," hole",t.length!==1?"s":""]})]}),_.jsxs("table",{className:"w-full text-[11px]",children:[_.jsx("thead",{children:_.jsxs("tr",{className:"border-b",style:{borderColor:"rgba(230,237,243,0.08)"},children:[_.jsx("th",{className:"py-1 pr-3",children:_.jsx(Wu,{col:"name",active:n,dir:s,onSort:d,children:"Name"})}),_.jsx("th",{className:"py-1 pr-3",children:_.jsx(Wu,{col:"kind",active:n,dir:s,onSort:d,children:"Kind"})}),_.jsx("th",{className:"py-1 pr-3",children:_.jsx(Wu,{col:"app",active:n,dir:s,onSort:d,children:"App"})}),_.jsx("th",{className:"py-1",children:_.jsx(Wu,{col:"file",active:n,dir:s,onSort:d,children:"File"})})]})}),_.jsx("tbody",{children:x.map(g=>_.jsxs("tr",{className:"border-b",style:{borderColor:"rgba(230,237,243,0.06)"},children:[_.jsx("td",{className:"py-1 pr-3 font-mono",style:{color:"rgba(230,237,243,0.7)"},children:g.name??g.symbol_id}),_.jsx("td",{className:"py-1 pr-3",style:{color:"rgba(230,237,243,0.45)"},children:g.kind??"—"}),_.jsx("td",{className:"py-1 pr-3",style:{color:"rgba(230,237,243,0.45)"},children:g.app??"—"}),_.jsx("td",{className:"py-1",style:{color:"rgba(230,237,243,0.35)"},title:g.file,children:_.jsx("div",{className:"truncate max-w-xs",children:g.file??"—"})})]},g.symbol_id))})]})]})}function sw(){const[t,e]=ne.useState(null),[r,n]=ne.useState(!0),[i,s]=ne.useState(null),o=ne.useCallback(async()=>{n(!0),s(null);try{const{report:a}=await at.getCoverageReport();e(a)}catch(a){s(a instanceof Error?a.message:String(a))}finally{n(!1)}},[]);return ne.useEffect(()=>{o()},[o]),_.jsxs("div",{className:"flex flex-col gap-4",children:[_.jsxs("div",{className:"flex items-center justify-between",children:[_.jsx("h2",{className:"text-sm font-semibold",style:{color:"#e6edf3"},children:"Coverage gate"}),_.jsx("button",{type:"button",onClick:()=>void o(),disabled:r,className:"rounded px-2 py-1 text-[11px] disabled:opacity-50",style:{border:"1px solid rgba(230,237,243,0.1)",color:"rgba(230,237,243,0.6)"},children:r?"Loading…":"Refresh"})]}),i&&_.jsx("p",{className:"rounded px-3 py-2 text-xs",style:{background:"rgba(248,81,73,0.08)",color:"#f85149"},children:i}),!r&&!i&&t===null&&_.jsxs("p",{className:"text-xs",style:{color:"rgba(230,237,243,0.4)"},children:["No coverage data — run"," ",_.jsx("code",{className:"font-mono",style:{color:"rgba(230,237,243,0.6)"},children:"wicked-core rules ingest"})," ","to populate."]}),t&&_.jsxs(_.Fragment,{children:[_.jsxs("div",{className:"flex items-center gap-3",children:[_.jsx("span",{className:"text-2xl font-bold",style:{color:"#e6edf3"},children:Ms(t.coverage)}),_.jsx(LE,{coverage:t.coverage,threshold:t.resolve_threshold})]}),_.jsx(DE,{report:t}),t.per_app.length>0&&_.jsxs("section",{className:"flex flex-col gap-1",children:[_.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-wider font-mono",style:{color:"rgba(230,237,243,0.4)"},children:"Per-app"}),_.jsx(AE,{apps:t.per_app})]}),_.jsxs("section",{className:"flex flex-col gap-2",children:[_.jsxs("p",{className:"text-[11px] font-semibold uppercase tracking-wider font-mono",style:{color:"rgba(230,237,243,0.4)"},children:["Coverage holes (",t.unaccounted,")"]}),_.jsx(ME,{nodes:t.unaccounted_nodes})]})]})]})}function PE(t){if(!t)return null;const r={active:"#3fb950",proposed:"#ffda19",deprecated:"#f85149"}[t]??"rgba(230,237,243,0.5)";return _.jsx("span",{className:"inline-flex rounded px-1.5 py-0.5 text-[10px] font-semibold font-mono",style:{background:"rgba(230,237,243,0.06)",color:r},children:t})}function IE({id:t,req:e}){var i,s,o,a,l;const[r,n]=ne.useState(!1);return _.jsxs("div",{className:"rounded",style:{border:"1px solid rgba(230,237,243,0.07)"},children:[_.jsxs("button",{type:"button",onClick:()=>n(u=>!u),className:"w-full flex items-start gap-2 px-3 py-2 text-left transition-colors",style:{background:"transparent"},onMouseEnter:u=>{u.currentTarget.style.background="rgba(230,237,243,0.03)"},onMouseLeave:u=>{u.currentTarget.style.background="transparent"},children:[_.jsx("span",{className:"mt-0.5 shrink-0 text-[10px]",style:{color:"rgba(230,237,243,0.25)"},children:r?"▾":"▸"}),_.jsxs("div",{className:"flex-1 min-w-0",children:[_.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[_.jsx("span",{className:"font-mono text-[10px]",style:{color:"rgba(230,237,243,0.35)"},children:t}),_.jsx("span",{className:"text-[11px] font-medium truncate",style:{color:"#e6edf3"},children:e.title}),PE(e.status),e.disposition&&_.jsx("span",{className:"text-[10px] italic",style:{color:"rgba(230,237,243,0.4)"},children:e.disposition})]}),!r&&e.description&&_.jsx("p",{className:"text-[10px] truncate mt-0.5",style:{color:"rgba(230,237,243,0.4)"},children:e.description})]}),_.jsxs("span",{className:"shrink-0 text-[10px] font-mono",style:{color:"rgba(230,237,243,0.25)"},children:[((i=e.business_rules)==null?void 0:i.length)??0,"br · ",((s=e.validations)==null?void 0:s.length)??0,"val"]})]}),r&&_.jsxs("div",{className:"px-4 pb-3 flex flex-col gap-2 text-[10px]",style:{background:"#0f1419"},children:[e.description&&_.jsx("p",{style:{color:"rgba(230,237,243,0.55)"},children:e.description}),(((o=e.business_rules)==null?void 0:o.length)??0)>0&&_.jsxs("div",{children:[_.jsx("p",{className:"font-semibold uppercase tracking-wider mb-1 font-mono",style:{color:"rgba(230,237,243,0.35)"},children:"Business rules"}),_.jsx("ul",{className:"flex flex-col gap-0.5",children:(e.business_rules??[]).map(u=>_.jsxs("li",{className:"flex items-start gap-1.5",children:[_.jsx("span",{className:"font-mono shrink-0",style:{color:"rgba(230,237,243,0.25)"},children:u.id}),_.jsx("span",{style:{color:"rgba(230,237,243,0.65)"},children:u.statement}),_.jsxs("span",{className:"ml-auto shrink-0 font-mono",style:{color:"rgba(230,237,243,0.3)"},children:[(u.confidence*100).toFixed(0),"%"]})]},u.id))})]}),(((a=e.validations)==null?void 0:a.length)??0)>0&&_.jsxs("div",{children:[_.jsx("p",{className:"font-semibold uppercase tracking-wider mb-1 font-mono",style:{color:"rgba(230,237,243,0.35)"},children:"Validations"}),_.jsx("ul",{className:"flex flex-col gap-0.5",children:(e.validations??[]).map(u=>_.jsxs("li",{className:"flex items-start gap-1.5",children:[_.jsx("span",{className:"font-mono shrink-0",style:{color:"rgba(230,237,243,0.25)"},children:u.id}),_.jsx("span",{style:{color:"rgba(230,237,243,0.65)"},children:u.statement})]},u.id))})]}),(((l=e.error_paths)==null?void 0:l.length)??0)>0&&_.jsxs("div",{children:[_.jsx("p",{className:"font-semibold uppercase tracking-wider mb-1 font-mono",style:{color:"rgba(248,81,73,0.6)"},children:"Error paths"}),_.jsx("ul",{className:"flex flex-col gap-0.5",children:(e.error_paths??[]).map(u=>_.jsxs("li",{className:"flex items-start gap-1.5",children:[_.jsx("span",{className:"font-mono shrink-0",style:{color:"rgba(230,237,243,0.25)"},children:u.id}),_.jsx("span",{style:{color:"#f85149"},children:u.statement})]},u.id))})]})]})]})}function OE({name:t,domain:e}){const[r,n]=ne.useState(!0),i=Object.keys(e.requirements??{}),s=Object.keys(e.entities??{});return _.jsxs("div",{className:"rounded-lg overflow-hidden",style:{border:"1px solid rgba(230,237,243,0.08)"},children:[_.jsxs("button",{type:"button",onClick:()=>n(o=>!o),className:"w-full flex items-center gap-2 px-4 py-2.5 text-left transition-colors",style:{background:"#1b222e",borderBottom:"1px solid rgba(230,237,243,0.07)"},onMouseEnter:o=>{o.currentTarget.style.background="#1f2937"},onMouseLeave:o=>{o.currentTarget.style.background="#1b222e"},children:[_.jsx("span",{className:"text-[10px]",style:{color:"rgba(230,237,243,0.35)"},children:r?"▾":"▸"}),_.jsx("span",{className:"font-semibold text-[12px]",style:{color:"#e6edf3"},children:t}),_.jsxs("span",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.35)"},children:[i.length," req · ",s.length," entity"]}),e.cluster_id!==void 0&&_.jsxs("span",{className:"ml-auto text-[10px] font-mono",style:{color:"rgba(230,237,243,0.25)"},children:["cluster ",e.cluster_id]})]}),r&&_.jsxs("div",{className:"p-3 flex flex-col gap-2",style:{background:"#161c26"},children:[e.description&&_.jsx("p",{className:"text-[10px] italic",style:{color:"rgba(230,237,243,0.4)"},children:e.description}),i.length>0&&_.jsx("div",{className:"flex flex-col gap-1",children:i.map(o=>_.jsx(IE,{id:o,req:e.requirements[o]},o))}),s.length>0&&_.jsxs("div",{children:[_.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider mb-1 font-mono",style:{color:"rgba(230,237,243,0.35)"},children:"Entities"}),_.jsx("div",{className:"flex flex-wrap gap-1",children:s.map(o=>{var a;return _.jsx("span",{title:(a=e.entities[o])==null?void 0:a.description,className:"rounded px-2 py-0.5 text-[10px] font-mono",style:{background:"rgba(230,237,243,0.06)",color:"rgba(230,237,243,0.6)"},children:o},o)})})]})]})]})}function BE(){const[t,e]=ne.useState(null),[r,n]=ne.useState(!0),[i,s]=ne.useState(null),[o,a]=ne.useState(""),l=ne.useCallback(async()=>{n(!0),s(null);try{const{graph:h}=await at.getDomainGraph();e(h)}catch(h){s(h instanceof Error?h.message:String(h))}finally{n(!1)}},[]);if(ne.useEffect(()=>{l()},[l]),r)return _.jsx("p",{className:"text-xs",style:{color:"rgba(230,237,243,0.4)"},children:"Loading domain model…"});if(i)return _.jsx("p",{className:"rounded px-2 py-1 text-xs",style:{background:"rgba(248,81,73,0.08)",color:"#f85149"},children:i});if(!t)return _.jsxs("div",{className:"flex flex-col gap-2",children:[_.jsx("p",{className:"text-sm",style:{color:"rgba(230,237,243,0.5)"},children:"No domain model found."}),_.jsxs("p",{className:"text-[10px]",style:{color:"rgba(230,237,243,0.4)"},children:["Run"," ",_.jsx("span",{className:"font-mono rounded px-1",style:{background:"rgba(230,237,243,0.06)",color:"rgba(230,237,243,0.6)"},children:"wicked-core domain-graph"})," ","to generate"," ",_.jsx("span",{className:"font-mono",style:{color:"rgba(230,237,243,0.5)"},children:".wicked-estate/requirements/requirements_graph.json"}),"."]})]});const u=o.toLowerCase(),c=Object.keys(t.domains??{}).filter(h=>{var d;if(!u)return!0;const v=t.domains[h];return h.toLowerCase().includes(u)||(d=v.description)!=null&&d.toLowerCase().includes(u)?!0:Object.entries(v.requirements??{}).some(([x,w])=>{var g,m;return x.toLowerCase().includes(u)||((g=w.title)==null?void 0:g.toLowerCase().includes(u))||((m=w.description)==null?void 0:m.toLowerCase().includes(u))})});return _.jsxs("div",{className:"flex flex-col gap-4",children:[_.jsxs("div",{className:"flex items-center gap-3",children:[_.jsx("h2",{className:"text-sm font-semibold",style:{color:"#e6edf3"},children:"Domain Model"}),_.jsxs("span",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.35)"},children:["schema ",t.metadata.schema_version," · ",Object.keys(t.domains).length," domains"]}),_.jsx("input",{"aria-label":"Search domains and requirements",type:"search",placeholder:"Search…",value:o,onChange:h=>a(h.target.value),className:"ml-auto rounded px-2 py-0.5 text-[11px] w-40 focus:outline-none",style:{background:"#161c26",border:"1px solid rgba(230,237,243,0.1)",color:"#e6edf3"}}),_.jsx("button",{type:"button",onClick:()=>void l(),className:"text-[10px] hover:underline",style:{color:"rgba(230,237,243,0.4)"},children:"Refresh"})]}),c.length===0?_.jsx("p",{className:"text-xs",style:{color:"rgba(230,237,243,0.4)"},children:"No domains match your search."}):_.jsx("div",{className:"flex flex-col gap-3",children:c.map(h=>_.jsx(OE,{name:h,domain:t.domains[h]},h))}),t.metadata.source&&_.jsxs("p",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.25)"},children:["Source: ",_.jsx("span",{children:t.metadata.source})]})]})}function jE({onSelect:t}){const e=ei(n=>n.gates),r=Object.values(e);return r.length===0?_.jsx(_.Fragment,{}):_.jsx("div",{className:"fixed bottom-4 right-4 flex flex-col gap-2 z-50","data-testid":"gate-notification",children:r.map(n=>_.jsxs("button",{type:"button",onClick:()=>t(n.runId),"data-testid":"gate-toast","data-run-id":n.runId,className:"w-72 rounded-xl p-3 text-left transition-all",style:{background:"#1b222e",border:"1px solid rgba(255,218,25,0.35)",boxShadow:"0 8px 24px rgba(0,0,0,0.4)"},onMouseEnter:i=>{i.currentTarget.style.borderColor="rgba(255,218,25,0.55)"},onMouseLeave:i=>{i.currentTarget.style.borderColor="rgba(255,218,25,0.35)"},children:[_.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[_.jsx("span",{className:"w-1.5 h-1.5 rounded-full animate-pulse",style:{background:"#ffda19"}}),_.jsx("p",{className:"text-xs font-semibold",style:{color:"#ffda19"},children:"Run awaiting human"})]}),_.jsxs("p",{className:"text-[11px] font-mono",style:{color:"rgba(230,237,243,0.4)"},children:[n.runId.slice(0,8)," · before unit #",n.ord]}),n.prompt&&_.jsx("p",{className:"mt-1 text-xs line-clamp-2",style:{color:"rgba(230,237,243,0.6)"},children:n.prompt}),_.jsx("p",{className:"mt-1.5 text-[11px] font-mono",style:{color:"#79c0ff"},children:"Review →"})]},n.runId))})}const $v=qs(t=>({status:"connecting",setStatus:e=>t({status:e})})),td=10;function rd(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():Array.from({length:36},(t,e)=>[8,13,18,23].includes(e)?"-":Math.floor(Math.random()*16).toString(16)).join("")}const uc=qs(t=>({notifications:[],markRead:e=>t(r=>{const n=r.notifications.findIndex(o=>o.id===e);if(n===-1)return r;const i=r.notifications[n];if(!i||i.read)return r;const s=[...r.notifications];return s[n]={...i,read:!0},{notifications:s}}),markAllRead:()=>t(e=>e.notifications.every(r=>r.read)?e:{notifications:e.notifications.map(r=>({...r,read:!0}))}),ingest:e=>{const r=typeof e.session=="string"?e.session:void 0;r!==void 0&&t(n=>{switch(e.type){case"awaitingHuman":return{notifications:[{id:rd(),kind:"gate",runId:r,message:typeof e.prompt=="string"&&e.prompt?e.prompt:"Run is awaiting human review",ts:Date.now(),read:!1},...n.notifications].slice(0,td)};case"sessionFailed":return{notifications:[{id:rd(),kind:"run_failed",runId:r,message:typeof e.message=="string"&&e.message?e.message:"Run failed",ts:Date.now(),read:!1},...n.notifications].slice(0,td)};case"agentMessage":return{notifications:[{id:rd(),kind:"steer_requested",runId:r,message:typeof e.message=="string"&&e.message?e.message:"Agent is requesting direction",ts:Date.now(),read:!1},...n.notifications].slice(0,td)};default:return n}})}})),mn={muted:"rgba(230,237,243,0.55)",faint:"rgba(230,237,243,0.3)",hover:"rgba(0,0,0,0.2)",accent:"#ffda19",accentInk:"#0d1117",link:"#79c0ff",danger:"#f85149"};function FE(t){switch(t){case"gate":return"Awaiting review";case"run_failed":return"Run failed";case"steer_requested":return"Steer requested";default:return"Notification"}}function m0(t){switch(t){case"gate":return mn.accent;case"run_failed":return mn.danger;case"steer_requested":return mn.link;default:return mn.muted}}function zE(t){const e=Date.now()-t;return e<6e4?"just now":e<36e5?`${Math.floor(e/6e4)}m ago`:`${Math.floor(e/36e5)}h ago`}function HE(){return _.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0,children:_.jsx("path",{d:"M12 22c1.1 0 2-.9 2-2h-4c0 1.1.9 2 2 2zm6-6V11c0-3.07-1.64-5.64-4.5-6.32V4c0-.83-.67-1.5-1.5-1.5s-1.5.67-1.5 1.5v.68C7.63 5.36 6 7.92 6 11v5l-2 2v1h16v-1l-2-2z"})})}function UE({navigate:t,collapsed:e=!1}){const r=uc(c=>c.notifications),n=uc(c=>c.markRead),i=uc(c=>c.markAllRead),[s,o]=ne.useState(!1),a=ne.useRef(null),l=r.filter(c=>!c.read).length;ne.useEffect(()=>{if(!s)return;function c(h){a.current&&!a.current.contains(h.target)&&o(!1)}return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[s]);function u(c,h){n(c),o(!1),t(`/runs/${encodeURIComponent(h)}`)}return _.jsxs("div",{ref:a,style:{position:"relative"},children:[_.jsxs("button",{type:"button","aria-label":l>0?`${l} unread notification${l>1?"s":""}`:"Notifications","aria-expanded":s,"aria-haspopup":"true",title:"Notifications",onClick:()=>o(c=>!c),className:"relative flex items-center rounded transition-opacity hover:opacity-70",style:{gap:e?0:"6px",justifyContent:e?"center":"flex-start",width:e?"28px":"auto",height:"28px",color:l>0?mn.accent:mn.faint,background:"transparent",padding:e?0:"0 6px 0 4px"},children:[_.jsx(HE,{}),!e&&_.jsx("span",{style:{fontSize:"11px",fontFamily:"monospace",color:mn.faint},children:"Notifications"}),l>0&&_.jsx("span",{"aria-hidden":!0,className:"absolute -top-0.5 -right-0.5 flex items-center justify-center rounded-full text-[9px] font-bold",style:{minWidth:"14px",height:"14px",padding:"0 2px",background:mn.accent,color:mn.accentInk},children:l>9?"9+":l})]}),s&&_.jsxs("div",{role:"menu","aria-label":"Notifications",style:{position:"absolute",top:"calc(100% + 6px)",left:0,zIndex:200,background:"#1b222e",border:"1px solid rgba(230,237,243,0.12)",borderRadius:"10px",minWidth:"280px",maxWidth:"320px",boxShadow:"0 8px 32px rgba(0,0,0,0.5)",overflow:"hidden"},children:[_.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"10px 14px 8px",borderBottom:"1px solid rgba(230,237,243,0.08)"},children:[_.jsx("span",{style:{fontSize:"10px",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.1em",color:"rgba(230,237,243,0.4)",fontFamily:"monospace"},children:"Notifications"}),l>0&&_.jsx("button",{type:"button",onClick:i,style:{background:"transparent",border:"none",cursor:"pointer",fontSize:"10px",fontFamily:"monospace",color:mn.link,padding:0},children:"Mark all read"})]}),r.length===0?_.jsx("p",{style:{padding:"16px 14px",fontSize:"11px",fontFamily:"monospace",color:mn.faint,margin:0},children:"No notifications"}):_.jsx("ul",{style:{listStyle:"none",margin:0,padding:0},children:r.map(c=>_.jsx("li",{children:_.jsxs("button",{type:"button",role:"menuitem",onClick:()=>u(c.id,c.runId),className:"focus-visible:outline focus-visible:outline-2 focus-visible:outline-[#79c0ff]",style:{width:"100%",textAlign:"left",background:c.read?"transparent":"rgba(255,218,25,0.04)",border:"none",borderBottom:"1px solid rgba(230,237,243,0.06)",padding:"10px 14px",cursor:"pointer",display:"block"},onMouseEnter:h=>{h.currentTarget.style.background=mn.hover},onMouseLeave:h=>{h.currentTarget.style.background=c.read?"transparent":"rgba(255,218,25,0.04)"},children:[_.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"3px"},children:[_.jsxs("span",{style:{fontSize:"10px",fontWeight:600,fontFamily:"monospace",color:m0(c.kind),display:"flex",alignItems:"center",gap:"4px"},children:[!c.read&&_.jsx("span",{style:{width:"5px",height:"5px",borderRadius:"50%",background:m0(c.kind),display:"inline-block",flexShrink:0}}),FE(c.kind)]}),_.jsx("span",{style:{fontSize:"9px",fontFamily:"monospace",color:"rgba(230,237,243,0.3)",whiteSpace:"nowrap",marginLeft:"8px"},children:zE(c.ts)})]}),_.jsx("p",{style:{fontSize:"11px",color:"rgba(230,237,243,0.65)",margin:"0 0 3px",overflow:"hidden",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical"},children:c.message}),_.jsxs("span",{style:{fontSize:"10px",fontFamily:"monospace",color:mn.link},children:[c.runId.slice(0,8)," → Review"]})]})},c.id))})]})]})}function WE(t){switch(t){case"completed":return"#3fb950";case"failed":return"#f85149";case"cancelled":return"rgba(230,237,243,0.25)";case"awaiting_human":return"#ffda19";default:return"#79c0ff"}}const y0=35;function Gi({view:t,selectedRunId:e,onSelect:r}){const{session:n,units:i}=t,s=e===n.id,o=n.problem.length>y0?n.problem.slice(0,y0)+"…":n.problem,a=i.length,l=n.status==="awaiting_human"||n.status==="executing"||n.status==="distributing"||n.status==="planning";return _.jsxs("button",{type:"button","data-testid":"run-link","data-run-id":n.id,"data-status":n.status,onClick:()=>r(n.id),className:`w-full text-left px-3 py-2 rounded-md focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-white/20 ${s?"bg-black/35":"bg-transparent hover:bg-black/20 focus-visible:bg-black/20"}`,children:[_.jsxs("div",{className:"flex items-center gap-2",children:[_.jsx("span",{className:"flex-1 truncate text-xs leading-tight font-mono",style:{color:s?"#e6edf3":"rgba(230,237,243,0.7)"},title:n.problem,children:o}),_.jsx("span",{className:`w-2 h-2 rounded-full shrink-0 ${l?"animate-pulse":""}`,style:{background:WE(n.status)}})]}),_.jsxs("p",{className:"text-[10px] mt-0.5 font-mono",style:{color:"rgba(230,237,243,0.3)"},children:[a," task",a===1?"":"s"," · ",n.id.slice(0,8)]})]})}const VE=[{label:"Coverage",path:"/coverage"},{label:"Domain",path:"/domain"},{label:"Workflows",path:"/workflows"},{label:"Policies",path:"/policies"},{label:"Rules",path:"/rules"},{label:"System",path:"/system"}];function $E({onNavigate:t,onClose:e}){const r=ne.useRef(null);return ne.useEffect(()=>{function n(i){r.current&&!r.current.contains(i.target)&&e()}return document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[e]),_.jsx("div",{ref:r,className:"absolute bottom-full left-0 mb-1 w-44 rounded-lg py-1 z-50",style:{background:"#1b222e",border:"1px solid rgba(230,237,243,0.1)",boxShadow:"0 8px 24px rgba(0,0,0,0.4)"},role:"menu",children:VE.map(n=>_.jsx("button",{type:"button",role:"menuitem",onClick:()=>{t(n.path),e()},className:"w-full text-left px-3 py-2 text-xs font-mono transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-white/20 hover:bg-white/[0.06] hover:text-[#e6edf3] focus-visible:bg-white/[0.06] focus-visible:text-[#e6edf3]",style:{color:"rgba(230,237,243,0.6)"},children:n.label},n.path))})}function GE({size:t=28,className:e=""}){return _.jsxs("svg",{width:t,height:t,viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:e,children:[_.jsx("rect",{width:"32",height:"32",rx:"7",fill:"#ffda19"}),_.jsx("path",{d:"M6 10L10.5 24L16 13L21.5 24L26 10",stroke:"#0d1117",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round"})]})}const ur={bg:"#1c4053",border:"rgba(0,0,0,0.25)",ink:"#e6edf3",muted:"rgba(230,237,243,0.55)",faint:"rgba(230,237,243,0.3)",hover:"rgba(0,0,0,0.2)",active:"rgba(0,0,0,0.35)",accent:"#ffda19",link:"#79c0ff"},ms=4;function qE(){return _.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0,children:_.jsx("path",{d:"M13 2 3 14h9l-1 8 10-12h-9l1-8z"})})}function YE(){return _.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0,children:_.jsx("path",{d:"M20 2H4C2.9 2 2 2.9 2 4v18l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2z"})})}function XE(){return _.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0,children:_.jsx("path",{d:"M19 11h-6V5a1 1 0 0 0-2 0v6H5a1 1 0 0 0 0 2h6v6a1 1 0 0 0 2 0v-6h6a1 1 0 0 0 0-2z"})})}function KE(){return _.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5","aria-hidden":!0,children:[_.jsx("circle",{cx:"10",cy:"10",r:"7"}),_.jsx("line",{x1:"15.5",y1:"15.5",x2:"21",y2:"21"})]})}function nd({icon:t,label:e,testId:r,onClick:n,collapsed:i}){return _.jsxs("button",{type:"button","data-testid":r,onClick:n,"aria-label":e,title:e,className:`flex items-center gap-2 rounded text-sm font-semibold transition-opacity hover:opacity-70 ${i?"w-9 h-9 justify-center mx-auto":"w-full px-2 py-1.5"}`,style:{color:ur.accent,background:"transparent"},children:[t,!i&&_.jsx("span",{children:e})]})}function id({label:t,asLink:e,onClick:r,withSearch:n,searchActive:i,onToggleSearch:s}){const o=_.jsxs("span",{className:"text-[10px] font-semibold uppercase tracking-widest font-mono select-none",style:{color:e?ur.link:ur.muted},children:[t,e&&_.jsx("span",{className:"ml-1 opacity-70",children:"›"})]});return _.jsxs("div",{className:"flex items-center px-3 pt-3 pb-1",children:[e&&r?_.jsx("button",{type:"button",onClick:r,className:"transition-opacity hover:opacity-80",style:{background:"transparent"},children:o}):o,n&&_.jsx("button",{type:"button",onClick:s,"aria-label":"Search",className:"ml-auto transition-opacity hover:opacity-100",style:{color:i?ur.accent:ur.faint},children:_.jsx(KE,{})})]})}function QE(){const t=$v(c=>c.status),[e,r]=ne.useState(!1),[n,i]=ne.useState(null),[s,o]=ne.useState(!1),a=ne.useRef(null);ne.useEffect(()=>{e&&(i(null),o(!1),at.getHealth().then(c=>i(c)).catch(()=>o(!0)))},[e]),ne.useEffect(()=>{if(!e)return;function c(h){a.current&&!a.current.contains(h.target)&&r(!1)}return document.addEventListener("click",c),()=>document.removeEventListener("click",c)},[e]);const l=t==="connected"?"#3fb950":t==="connecting"?"#ffda19":"#f85149",u=t==="connected"?"Connected":t==="connecting"?"Connecting":"Disconnected";return _.jsxs("div",{ref:a,style:{position:"relative"},children:[_.jsxs("button",{type:"button",onClick:()=>r(c=>!c),title:"Connection status",style:{display:"flex",alignItems:"center",gap:"5px",background:"rgba(0,0,0,0.25)",border:"1px solid rgba(230,237,243,0.1)",borderRadius:"20px",padding:"2px 8px 2px 6px",cursor:"pointer"},children:[_.jsx("span",{style:{width:"7px",height:"7px",borderRadius:"50%",background:l,flexShrink:0,boxShadow:t==="connected"?`0 0 5px ${l}`:"none"}}),_.jsx("span",{style:{fontSize:"10px",fontFamily:"monospace",color:l,whiteSpace:"nowrap"},children:u}),_.jsx("span",{style:{fontSize:"9px",color:"rgba(230,237,243,0.35)",marginLeft:"1px"},children:"▾"})]}),e&&_.jsxs("div",{style:{position:"absolute",top:"calc(100% + 6px)",left:0,zIndex:100,background:"#1b222e",border:"1px solid rgba(230,237,243,0.12)",borderRadius:"10px",padding:"12px 14px",minWidth:"220px",boxShadow:"0 8px 32px rgba(0,0,0,0.5)"},children:[_.jsx("p",{style:{fontSize:"10px",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.1em",color:"rgba(230,237,243,0.4)",marginBottom:"8px",fontFamily:"monospace"},children:"Health checks"}),_.jsx(Fo,{label:"WebSocket",ok:t==="connected",detail:u}),s?_.jsx(Fo,{label:"API server",ok:!1,detail:"unreachable"}):n?_.jsxs(_.Fragment,{children:[_.jsx(Fo,{label:"API server",ok:n.status==="ok",detail:n.status}),_.jsx(Fo,{label:"wicked-core",ok:!0,detail:n.version})]}):_.jsx(Fo,{label:"API server",ok:null,detail:"checking…"})]})]})}function Fo({label:t,ok:e,detail:r}){const n=e===null?"·":e?"✓":"✗",i=e===null?"rgba(230,237,243,0.3)":e?"#3fb950":"#f85149";return _.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"5px"},children:[_.jsx("span",{style:{width:"12px",fontSize:"11px",color:i,fontFamily:"monospace",flexShrink:0},children:n}),_.jsx("span",{style:{fontSize:"11px",color:"#e6edf3",fontFamily:"monospace",flex:1},children:t}),_.jsx("span",{style:{fontSize:"10px",color:"rgba(230,237,243,0.45)",fontFamily:"monospace"},children:r})]})}function ZE({runs:t,selectedRunId:e,onSelectRun:r,navigate:n}){const[i,s]=ne.useState(!1),[o,a]=ne.useState(!1),[l,u]=ne.useState(!1),[c,h]=ne.useState(!1),[v,d]=ne.useState(""),[x,w]=ne.useState([]),g=!i||o;ne.useEffect(()=>{let T=!1,k=!1;function L(){k||(k=!0,at.listRepos().then(({repos:I})=>{if(T)return;const M=[...I].sort((B,D)=>D.registered_at-B.registered_at);w(M)}).catch(()=>{}).finally(()=>{k=!1}))}L();const A=setInterval(L,5e3);return()=>{T=!0,clearInterval(A)}},[]);const m=[],y=[];for(const T of t)!T.session.workflow_id||T.session.workflow_id==="chat"?m.push(T):y.push(T);const b=v.trim().toLowerCase(),S=b?x.filter(T=>T.name.toLowerCase().includes(b)):x,N=b?m.filter(T=>T.session.problem.toLowerCase().includes(b)):m,E=b?y.filter(T=>T.session.problem.toLowerCase().includes(b)):y;return _.jsxs("div",{className:`flex flex-col shrink-0 transition-all duration-200 ${g?"w-[280px]":"w-14"}`,style:{background:ur.bg,borderRight:`1px solid ${ur.border}`},onMouseEnter:()=>{i&&a(!0)},onMouseLeave:()=>a(!1),children:[_.jsxs("div",{className:"flex items-center gap-2 px-4 pt-5 pb-3 shrink-0",children:[_.jsx("button",{type:"button",onClick:()=>n("/"),className:"shrink-0","aria-label":"Home",children:_.jsx(GE,{size:26})}),g&&_.jsx("button",{type:"button",onClick:()=>n("/"),className:"flex-1 text-left text-sm font-semibold font-mono truncate transition-opacity hover:opacity-70",style:{color:ur.ink,background:"transparent"},children:"wicked-crew studio"}),_.jsx("button",{type:"button",onClick:()=>s(T=>!T),"aria-label":i?"Expand sidebar":"Collapse sidebar",className:`text-xs font-mono shrink-0 leading-none ${g?"ml-auto":""}`,style:{color:ur.faint},children:i?"»":"«"})]}),g&&_.jsx("div",{className:"px-4 pt-1 pb-3",children:_.jsx(QE,{})}),_.jsx("div",{className:g?"px-4 pb-2":"flex justify-center pb-2",children:_.jsx(UE,{navigate:n,collapsed:!g})}),_.jsxs("div",{className:`flex flex-col ${g?"px-5 pt-1 pb-1 gap-1":"px-2 items-center gap-2 mt-1"}`,children:[_.jsx(nd,{icon:_.jsx(qE,{}),label:"Do Work",testId:"new-run",onClick:()=>n("/runs/new"),collapsed:!g}),_.jsx(nd,{icon:_.jsx(YE,{}),label:"New Chat",onClick:()=>n("/chat/new"),collapsed:!g}),_.jsx(nd,{icon:_.jsx(XE,{}),label:"New Repository",onClick:()=>n("/repos/new"),collapsed:!g})]}),_.jsx("div",{className:"flex-1 overflow-y-auto flex flex-col min-h-0 mt-2",children:g?_.jsxs(_.Fragment,{children:[c&&_.jsx("div",{className:"px-4 pb-2",children:_.jsx("input",{type:"text",value:v,onChange:T=>d(T.target.value),placeholder:"Search…",autoFocus:!0,className:"w-full bg-transparent text-xs font-mono outline-none border-b",style:{color:ur.ink,borderColor:ur.faint,caretColor:ur.accent}})}),_.jsx(id,{label:"Repositories",withSearch:!0,searchActive:c,onToggleSearch:()=>{h(T=>!T),c&&d("")}}),_.jsx(ad,{empty:"No repositories yet",viewAllPath:"/repos",navigate:n,children:S.slice(0,ms).map(T=>_.jsxs("button",{type:"button",onClick:()=>n(`/repo-detail/${encodeURIComponent(T.id)}`),title:T.root_path,className:"w-full text-left px-3 py-2 rounded-md transition-colors",style:{background:"transparent"},onMouseEnter:k=>{k.currentTarget.style.background=ur.hover},onMouseLeave:k=>{k.currentTarget.style.background="transparent"},children:[_.jsx("div",{className:"flex items-center gap-2",children:_.jsx("span",{className:"flex-1 truncate text-xs leading-tight font-mono",style:{color:"rgba(230,237,243,0.7)"},children:T.name})}),_.jsx("p",{className:"text-[10px] mt-0.5 font-mono truncate",style:{color:"rgba(230,237,243,0.3)"},children:T.root_path})]},T.id))}),S.length>ms&&_.jsx(sd,{onClick:()=>n("/repos")}),_.jsx(id,{label:"Chats"}),_.jsx(ad,{empty:"No chats yet",viewAllPath:"/chats",navigate:n,children:N.slice(0,ms).map(T=>_.jsx(Gi,{view:T,selectedRunId:e,onSelect:r},T.session.id))}),N.length>ms&&_.jsx(sd,{onClick:()=>n("/chats")}),_.jsx(id,{label:"Work"}),_.jsx(ad,{empty:"No work yet",viewAllPath:"/work",navigate:n,children:E.slice(0,ms).map(T=>_.jsx(Gi,{view:T,selectedRunId:e,onSelect:r},T.session.id))}),E.length>ms&&_.jsx(sd,{onClick:()=>n("/work")})]}):_.jsx("div",{className:"px-2 flex flex-col gap-0.5 mt-1",children:t.map(T=>_.jsx("button",{type:"button",onClick:()=>r(T.session.id),"aria-label":T.session.problem,title:T.session.problem,className:"w-9 h-9 mx-auto flex items-center justify-center rounded-md transition-colors",style:{background:e===T.session.id?ur.active:"transparent"},onMouseEnter:k=>{e!==T.session.id&&(k.currentTarget.style.background=ur.hover)},onMouseLeave:k=>{e!==T.session.id&&(k.currentTarget.style.background="transparent")},children:_.jsx(JE,{status:T.session.status})},T.session.id))})}),_.jsx("div",{className:`px-2 pb-3 shrink-0 ${g?"":"flex flex-col items-center gap-1"}`,children:_.jsxs("div",{className:"relative",children:[_.jsxs("button",{type:"button",onClick:()=>u(T=>!T),onMouseDown:T=>T.stopPropagation(),"aria-label":"Settings",className:`rounded transition-colors ${g?"w-full flex items-center gap-2 px-2 py-1.5 text-xs":"w-9 h-9 flex items-center justify-center text-base"}`,style:{color:ur.faint},onMouseEnter:T=>{T.currentTarget.style.background=ur.hover,T.currentTarget.style.color=ur.ink},onMouseLeave:T=>{T.currentTarget.style.background="",T.currentTarget.style.color=ur.faint},children:[_.jsx("span",{children:"⚙"}),g&&_.jsxs(_.Fragment,{children:[_.jsx("span",{children:"Settings"}),_.jsx("span",{className:"ml-auto text-[10px] font-mono",style:{color:"rgba(230,237,243,0.25)"},children:"v0.2.1"})]})]}),l&&_.jsx($E,{onNavigate:n,onClose:()=>u(!1)})]})})]})}function ad({children:t,empty:e,viewAllPath:r,navigate:n}){const i=Array.isArray(t)?t.filter(Boolean):t?[t]:[];return _.jsx("div",{className:"px-2 flex flex-col gap-0.5",children:i.length===0?_.jsx("button",{type:"button",onClick:()=>n(r),className:"px-2 py-1 text-left text-[11px] italic font-mono transition-opacity hover:opacity-70",style:{color:ur.faint},children:e}):i})}function sd({onClick:t}){return _.jsx("button",{type:"button",onClick:t,className:"mx-4 mb-1 text-left text-[11px] font-mono transition-opacity hover:opacity-80",style:{color:ur.link},children:"view all"})}function JE({status:t}){const e=t==="completed"?"#3fb950":t==="failed"?"#f85149":t==="cancelled"?"rgba(230,237,243,0.25)":t==="awaiting_human"?"#ffda19":"#79c0ff",r=t==="awaiting_human"||t==="executing"||t==="distributing"||t==="planning";return _.jsx("span",{className:`w-2.5 h-2.5 rounded-full ${r?"animate-pulse":""}`,style:{background:e}})}const ek={deny:"#f85149",allow_with_conditions:"#ffda19",allow:"#3fb950"},tk={high:"#f85149",medium:"#ffda19",low:"rgba(230,237,243,0.4)"},rk={id:"",kind:"output",applies_to:[],effect:"deny",trigger:{contains:""},obligations:[],criteria:"",severity:"high",rule:""};function nk({policy:t,onEdit:e}){return _.jsxs("tr",{className:"text-[11px]",style:{borderBottom:"1px solid rgba(230,237,243,0.06)"},children:[_.jsx("td",{className:"px-3 py-2 font-mono",style:{color:"rgba(230,237,243,0.7)"},children:t.id}),_.jsx("td",{className:"px-3 py-2",style:{color:"rgba(230,237,243,0.45)"},children:t.kind}),_.jsx("td",{className:"px-3 py-2",children:_.jsx("span",{className:"inline-flex rounded px-1.5 py-0.5 text-[10px] font-semibold font-mono",style:{background:"rgba(230,237,243,0.06)",color:ek[t.effect]??"rgba(230,237,243,0.5)"},children:t.effect})}),_.jsx("td",{className:"px-3 py-2 text-[11px] font-semibold",style:{color:tk[t.severity]??"rgba(230,237,243,0.5)"},children:t.severity}),_.jsx("td",{className:"px-3 py-2 truncate max-w-xs",style:{color:"rgba(230,237,243,0.5)"},children:t.rule}),_.jsx("td",{className:"px-3 py-2",children:_.jsx("button",{type:"button",onClick:()=>e(t),className:"text-[10px] hover:underline",style:{color:"#79c0ff"},children:"Edit"})})]})}function ik(){const[t,e]=ne.useState([]),[r,n]=ne.useState(!0),[i,s]=ne.useState(null),[o,a]=ne.useState(""),[l,u]=ne.useState("idle"),[c,h]=ne.useState(null),[v,d]=ne.useState(null),x=ne.useCallback(async()=>{n(!0),s(null);try{const{policies:y}=await at.listPolicies();e(y)}catch(y){s(y instanceof Error?y.message:String(y))}finally{n(!1)}},[]);ne.useEffect(()=>{x()},[x]);const w=y=>{a(JSON.stringify(y??rk,null,2)),d(null),u("idle"),h(null)},g=y=>{a(y);try{JSON.parse(y),d(null)}catch(b){d(b instanceof Error?b.message:String(b))}},m=async()=>{if(v)return;let y;try{y=JSON.parse(o)}catch(b){d(b instanceof Error?b.message:String(b));return}u("saving"),h(null);try{await at.upsertPolicy(y),u("ok"),await x()}catch(b){u("error"),h(b instanceof Error?b.message:String(b))}};return _.jsxs("div",{className:"flex flex-col gap-4",children:[_.jsxs("div",{className:"flex items-center gap-3",children:[_.jsx("h2",{className:"text-sm font-semibold",style:{color:"#e6edf3"},children:"Policies"}),_.jsx("button",{type:"button",onClick:()=>void x(),className:"text-[10px] hover:underline",style:{color:"rgba(230,237,243,0.4)"},children:"Refresh"}),_.jsx("button",{type:"button",onClick:()=>w(),className:"ml-auto rounded px-2 py-1 text-[11px] font-semibold",style:{background:"#ffda19",color:"#0d1117"},children:"+ New policy"})]}),i&&_.jsx("p",{className:"rounded px-2 py-1 text-xs",style:{background:"rgba(248,81,73,0.08)",color:"#f85149"},children:i}),r?_.jsx("p",{className:"text-xs",style:{color:"rgba(230,237,243,0.4)"},children:"Loading policies…"}):_.jsx("div",{className:"overflow-x-auto rounded",style:{border:"1px solid rgba(230,237,243,0.08)"},children:_.jsxs("table",{className:"w-full text-[11px]",children:[_.jsx("thead",{children:_.jsxs("tr",{className:"text-[10px] uppercase tracking-wider",style:{borderBottom:"1px solid rgba(230,237,243,0.08)",background:"#0f1419",color:"rgba(230,237,243,0.4)"},children:[_.jsx("th",{className:"px-3 py-2 text-left",children:"ID"}),_.jsx("th",{className:"px-3 py-2 text-left",children:"Kind"}),_.jsx("th",{className:"px-3 py-2 text-left",children:"Effect"}),_.jsx("th",{className:"px-3 py-2 text-left",children:"Severity"}),_.jsx("th",{className:"px-3 py-2 text-left",children:"Rule"}),_.jsx("th",{className:"px-3 py-2"})]})}),_.jsx("tbody",{children:t.length===0?_.jsx("tr",{children:_.jsx("td",{colSpan:6,className:"px-3 py-4 text-center text-xs",style:{color:"rgba(230,237,243,0.35)"},children:"No policies registered."})}):t.map(y=>_.jsx(nk,{policy:y,onEdit:w},y.id))})]})}),o!==""&&_.jsxs("div",{className:"flex flex-col gap-2 rounded p-3",style:{border:"1px solid rgba(255,218,25,0.25)",background:"rgba(255,218,25,0.04)"},children:[_.jsxs("div",{className:"flex items-center gap-2",children:[_.jsx("span",{className:"text-[11px] font-semibold",style:{color:"#ffda19"},children:"Policy JSON"}),_.jsx("button",{type:"button",onClick:()=>{a(""),u("idle")},className:"ml-auto text-[10px] hover:underline",style:{color:"rgba(230,237,243,0.4)"},children:"Cancel"})]}),_.jsx("textarea",{"aria-label":"Policy JSON editor",value:o,onChange:y=>g(y.target.value),spellCheck:!1,className:"rounded p-2 font-mono text-[10px] focus:outline-none min-h-[200px] resize-y",style:{background:"#0d1117",color:"#e6edf3",border:"1px solid rgba(230,237,243,0.1)"}}),v&&_.jsx("p",{className:"text-[10px]",style:{color:"#f85149"},children:v}),_.jsxs("div",{className:"flex items-center gap-2",children:[_.jsx("button",{type:"button",onClick:()=>void m(),disabled:!!v||l==="saving",className:"rounded px-3 py-1 text-[11px] font-semibold disabled:opacity-50",style:{background:"#3fb950",color:"#0d1117"},children:l==="saving"?"Saving…":"Save policy"}),l==="ok"&&_.jsx("span",{className:"text-[10px]",style:{color:"#3fb950"},children:"Saved."}),l==="error"&&_.jsx("span",{className:"text-[10px]",style:{color:"#f85149"},children:c})]})]})]})}const ak=new Set(["completed","cancelled","failed"]);function sk(t){const e=t*1e3,r=Math.floor((Date.now()-e)/(1e3*60*60*24));return r<1?"registered today":r===1?"registered yesterday":r<30?`registered ${r} days ago`:`registered ${new Date(e).toLocaleDateString("en-US",{month:"short",year:"numeric"})}`}const Vu={background:"#0f1419",border:"1px solid rgba(230,237,243,0.14)",color:"#e6edf3",borderRadius:"6px",padding:"6px 10px",fontSize:"12px",fontFamily:"var(--wk-font-mono, monospace)",outline:"none",width:"100%"};function od({label:t,value:e,hint:r}){return _.jsxs("div",{className:"rounded-2xl p-5 flex flex-col gap-1",style:{background:"#1b222e",border:"1px solid rgba(230,237,243,0.07)"},children:[_.jsx("p",{className:"text-[10px] font-mono uppercase tracking-widest",style:{color:"rgba(230,237,243,0.4)"},children:t}),_.jsx("p",{className:"text-3xl font-mono font-bold",style:{color:"#e6edf3"},children:e}),r&&_.jsx("p",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.35)"},children:r})]})}function ok({onSelectRun:t,autoShowRegister:e,navigate:r}){const[n,i]=ne.useState([]),[s,o]=ne.useState([]),[a,l]=ne.useState(!0),[u,c]=ne.useState(null),[h,v]=ne.useState(""),[d,x]=ne.useState(0),[w,g]=ne.useState({}),[m,y]=ne.useState({}),[b,S]=ne.useState(e??!1),[N,E]=ne.useState("local"),[T,k]=ne.useState(""),[L,A]=ne.useState(""),[I,M]=ne.useState(""),[B,D]=ne.useState(""),[H,U]=ne.useState(null),[z,W]=ne.useState(!1),F=ne.useRef(!1);ne.useEffect(()=>{l(!0),Promise.all([at.listRepos(),at.listRuns()]).then(([{repos:K},{runs:q}])=>{i(K),o(q)}).catch(K=>c(K instanceof Error?K.message:String(K))).finally(()=>l(!1))},[]),ne.useEffect(()=>{if(n.length===0){x(0);return}let K=!1;return Promise.all(n.map(q=>at.getRepoGraph(q.id).then(({graph:Y})=>Y!=null).catch(()=>!1))).then(q=>{K||x(q.filter(Boolean).length)}),()=>{K=!0}},[n]);function P(K){if(F.current)return;const q=K.replace(/\.git$/,"").split(/[/\\:]/).filter(Boolean).pop()??"";q&&k(q)}async function j(K){g(q=>({...q,[K]:!0})),y(q=>({...q,[K]:""}));try{const{runId:q}=await at.rerunOnboarding(K);t==null||t(q)}catch(q){y(Y=>({...Y,[K]:q instanceof Error?q.message:String(q)}))}finally{g(q=>({...q,[K]:!1}))}}async function G(){const K=T.trim(),q=N==="remote",Y=q?I.trim():L.trim();if(!(!K||!Y)){U(null),W(!0);try{const{repo:X}=q?await at.cloneAndRegisterRepo(K,Y,B.trim()||void 0):await at.registerRepo(K,Y);i(J=>[...J,X]),S(!1),k(""),A(""),M(""),D(""),E("local"),F.current=!1,r("/repo-detail/"+encodeURIComponent(X.id))}catch(X){U(X instanceof Error?X.message:String(X))}finally{W(!1)}}}const $=!!(T.trim()&&(N==="remote"?I.trim():L.trim())),ee=s.filter(K=>!ak.has(K.session.status)),ae=h.trim()===""?n:n.filter(K=>K.name.toLowerCase().includes(h.trim().toLowerCase()));function ie(K){return ee.filter(q=>q.session.repo_ref===K).length}return _.jsxs("div",{className:"h-full overflow-y-auto",children:[_.jsxs("div",{className:"px-8 pt-8 pb-4",children:[_.jsxs("div",{className:"flex items-center gap-3 mb-5",children:[_.jsx("h1",{className:"text-base font-bold font-mono flex-1",style:{color:"#e6edf3",letterSpacing:"-0.01em"},children:"Repositories"}),_.jsx("input",{style:{background:"#1b222e",border:"1px solid rgba(230,237,243,0.12)",color:"#e6edf3",borderRadius:"6px",padding:"6px 12px",fontSize:"12px",fontFamily:"var(--wk-font-mono, monospace)",outline:"none",width:"200px"},placeholder:"Search repos…",value:h,onChange:K=>v(K.target.value)}),_.jsx("button",{type:"button",onClick:()=>{b?(S(!1),r("/repos")):(S(!0),r("/repos/new"))},className:"shrink-0 rounded-lg px-4 py-1.5 text-xs font-semibold font-mono",style:{background:b?"rgba(230,237,243,0.1)":"#ffda19",color:b?"#e6edf3":"#0d1117"},children:b?"Cancel":"+ Add Repository"})]}),b&&_.jsxs("div",{className:"flex flex-col gap-3 rounded-2xl p-5 mb-5",style:{background:"#1b222e",border:"1px solid rgba(230,237,243,0.08)"},children:[_.jsx("div",{role:"group","aria-label":"Repository source",className:"flex gap-1",children:["local","remote"].map(K=>_.jsx("button",{type:"button","aria-pressed":N===K,onClick:()=>E(K),className:"rounded-md px-3 py-1 text-[11px] font-mono font-medium transition-colors",style:N===K?{background:"rgba(230,237,243,0.12)",color:"#e6edf3"}:{color:"rgba(230,237,243,0.4)"},children:K==="local"?"Local path":"Remote URL"},K))}),_.jsx("input",{style:Vu,placeholder:"Repo name",value:T,onChange:K=>{k(K.target.value),F.current=!!K.target.value.trim()}}),N==="local"?_.jsx("input",{style:Vu,placeholder:"Absolute path to git repo",value:L,onChange:K=>{A(K.target.value),P(K.target.value)}}):_.jsxs(_.Fragment,{children:[_.jsx("input",{style:Vu,placeholder:"https://github.com/org/repo or git@github.com:org/repo",value:I,onChange:K=>{M(K.target.value),P(K.target.value)}}),_.jsxs("div",{className:"flex flex-col gap-1",children:[_.jsx("label",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.4)"},children:"Clone to (optional)"}),_.jsx("input",{style:Vu,placeholder:`~/.wicked/repos/${T||"<name>"}`,value:B,onChange:K=>D(K.target.value)})]})]}),_.jsx("p",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.4)"},children:N==="remote"?`Clones to ${B.trim()||`~/.wicked/repos/${T||"<name>"}`}, then runs the onboarding workflow as a governed run.`:"Runs the onboarding workflow (index → annotate → domain) as a governed run."}),H&&_.jsx("p",{className:"text-[11px] font-mono",style:{color:"#f85149"},children:H}),_.jsx("button",{type:"button",onClick:()=>void G(),disabled:z||!$,className:"self-start rounded-lg px-4 py-1.5 text-[11px] font-semibold font-mono disabled:opacity-50",style:{background:"#ffda19",color:"#0d1117"},children:z?N==="remote"?"Cloning…":"Registering…":N==="remote"?"Clone & onboard":"Register & onboard"})]})]}),_.jsxs("div",{className:"px-8 pb-10",children:[!a&&!u&&_.jsxs("div",{className:"grid grid-cols-3 gap-4 mb-6",children:[_.jsx(od,{label:"Total Repos",value:n.length,hint:"registered with wicked-crew"}),_.jsx(od,{label:"Active Runs",value:ee.length,hint:ee.length===1?"1 run in progress":`${ee.length} runs in progress`}),_.jsx(od,{label:"Tracked",value:d,hint:"onboarded and graph-indexed"})]}),a?_.jsx("p",{className:"text-xs font-mono",style:{color:"rgba(230,237,243,0.4)"},children:"Loading repositories…"}):u?_.jsx("p",{className:"text-xs font-mono",style:{color:"#f85149"},children:u}):n.length===0?_.jsx("div",{className:"flex flex-col items-center justify-center py-24 text-center",children:_.jsxs("div",{className:"rounded-2xl p-10 flex flex-col items-center gap-4",style:{background:"#1b222e",border:"1px solid rgba(230,237,243,0.07)",maxWidth:420},children:[_.jsx("p",{className:"text-2xl font-mono font-bold",style:{color:"rgba(230,237,243,0.15)"},children:"No repositories"}),_.jsx("p",{className:"text-sm font-mono",style:{color:"rgba(230,237,243,0.45)"},children:"Register a local git repo or clone a remote one. wicked-crew will index it, annotate the domain model, and keep the knowledge graph up to date."}),_.jsx("button",{type:"button",onClick:()=>S(!0),className:"rounded-lg px-5 py-2 text-xs font-semibold font-mono mt-2",style:{background:"#ffda19",color:"#0d1117"},children:"+ Add Repository"})]})}):ae.length===0?_.jsxs("p",{className:"text-xs font-mono",style:{color:"rgba(230,237,243,0.4)"},children:["No repos match “",h,"”."]}):_.jsx("div",{className:"grid grid-cols-2 gap-4",children:ae.map(K=>{const q=ie(K.id),Y=w[K.id]??!1,X=m[K.id];return _.jsxs("div",{className:"rounded-2xl p-5 flex flex-col gap-3 cursor-pointer transition-colors",style:{background:"#1b222e",border:"1px solid rgba(230,237,243,0.08)"},onClick:()=>r("/repo-detail/"+encodeURIComponent(K.id)),role:"button",tabIndex:0,onKeyDown:J=>{(J.key==="Enter"||J.key===" ")&&r("/repo-detail/"+encodeURIComponent(K.id))},children:[_.jsxs("div",{className:"flex items-start justify-between gap-2",children:[_.jsxs("div",{className:"flex-1 min-w-0",children:[_.jsx("p",{className:"text-sm font-bold font-mono truncate",style:{color:"#e6edf3"},children:K.name}),_.jsx("p",{className:"text-[11px] font-mono mt-0.5 truncate",style:{color:"rgba(230,237,243,0.4)"},title:K.root_path,children:K.root_path})]}),_.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[q>0&&_.jsxs("span",{className:"rounded-full px-2 py-0.5 text-[10px] font-mono font-semibold",style:{background:"rgba(63,185,80,0.15)",color:"#3fb950"},children:[q," active"]}),_.jsx("span",{className:"rounded-full px-2 py-0.5 text-[10px] font-mono",style:{background:"rgba(121,192,255,0.12)",color:"#79c0ff"},children:K.default_branch})]})]}),_.jsx("p",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.3)"},children:sk(K.registered_at)}),X&&_.jsx("p",{className:"text-[11px] font-mono",style:{color:"#f85149"},children:X}),_.jsxs("div",{className:"flex items-center justify-between mt-auto",onClick:J=>J.stopPropagation(),onKeyDown:J=>J.stopPropagation(),role:"presentation",children:[_.jsx("button",{type:"button",onClick:()=>r("/repo-detail/"+encodeURIComponent(K.id)),className:"text-xs font-mono hover:underline",style:{color:"#79c0ff"},children:"View →"}),_.jsx("button",{type:"button",disabled:Y,onClick:()=>void j(K.id),className:"rounded-md px-3 py-1 text-[11px] font-mono disabled:opacity-50",style:{background:"rgba(230,237,243,0.07)",color:"rgba(230,237,243,0.6)",border:"1px solid rgba(230,237,243,0.08)"},children:Y?"Starting…":"Onboard"})]})]},K.id)})})]})]})}const Xe={canvas2:"#121826",surface:"#151b2c",surface2:"#161d2f",ink:"#e6edf3",muted:"rgba(230,237,243,0.6)",faint:"rgba(230,237,243,0.35)",hairline:"rgba(230,237,243,0.08)",hairlineS:"rgba(230,237,243,0.14)",ok:"#3fb950",deny:"#f85149",link:"#79c0ff",accent:"#ffda19"},Ea=50;function lk({repoId:t,repoName:e,onClose:r,onNavigateComponent:n}){const[i,s]=ne.useState(""),[o,a]=ne.useState("all"),[l,u]=ne.useState("functional"),[c,h]=ne.useState(0),[v,d]=ne.useState(null),[x,w]=ne.useState(null),[g,m]=ne.useState(null),y=ne.useRef(null),b=ne.useCallback((L,A,I,M)=>{const B={offset:M,limit:Ea};L.trim()!==""&&(B.q=L.trim()),A!=="all"&&(B.risk=A),I!=="all"&&(B.category=I),at.listRequirements(t,B).then(D=>{d(D),w(null)}).catch(D=>w(D instanceof Error?D.message:String(D)))},[t]);ne.useEffect(()=>(y.current!==null&&clearTimeout(y.current),y.current=setTimeout(()=>b(i,o,l,c),250),()=>{y.current!==null&&clearTimeout(y.current)}),[i,o,l,c,b]);function S(L){a(L),h(0)}function N(L){u(L),h(0)}function E(L){d(A=>A===null?A:{...A,items:A.items.map(I=>I.key===L.key?{...I,...uk(L)}:I)})}const T=v!==null?Math.max(1,Math.ceil(v.total/Ea)):1,k=Math.floor(c/Ea)+1;return _.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{background:"rgba(0,0,0,0.6)"},children:_.jsxs("div",{className:"w-[92vw] h-[92vh] rounded-2xl flex flex-col overflow-hidden border",style:{background:Xe.surface,border:`1px solid ${Xe.hairlineS}`},children:[_.jsxs("div",{className:"flex items-center gap-3 px-5 py-3 border-b shrink-0",style:{borderColor:Xe.hairline,background:Xe.canvas2},children:[_.jsx("span",{className:"font-mono text-sm font-semibold",style:{color:Xe.ink},children:e}),_.jsx("span",{className:"font-mono text-[11px] px-2 py-0.5 rounded",style:{background:Xe.surface2,color:Xe.muted},children:"requirements"}),v!==null&&_.jsx("span",{className:"font-mono text-[11px]",style:{color:Xe.faint},children:v.total===v.corpus?`${v.corpus} total`:`${v.total} matching · ${v.corpus} total`}),_.jsx("button",{type:"button",onClick:r,"aria-label":"Close requirements",className:"ml-auto text-lg px-2",style:{color:Xe.muted},children:"×"})]}),_.jsxs("div",{className:"flex items-center gap-3 px-5 py-2.5 border-b shrink-0",style:{borderColor:Xe.hairline},children:[_.jsx("input",{type:"text",value:i,onChange:L=>{s(L.target.value),h(0)},placeholder:"Search requirements (server-side: id, domain, title, description)…",className:"flex-1 text-[12px] font-mono px-3 py-1.5 rounded-lg border outline-none",style:{border:`1px solid ${Xe.hairlineS}`,background:Xe.canvas2,color:Xe.ink}}),_.jsx("div",{className:"flex items-center gap-1",role:"group","aria-label":"Category filter",children:["functional","config-data","all"].map(L=>_.jsx("button",{type:"button",onClick:()=>N(L),"aria-pressed":l===L,className:"px-2.5 py-1 rounded-lg text-[11px] font-mono font-semibold",style:{background:l===L?Xe.surface2:"transparent",color:l===L?Xe.ink:Xe.faint,border:`1px solid ${l===L?Xe.hairlineS:"transparent"}`},children:L==="functional"?"Functional":L==="config-data"?"Config & data":"All"},L))}),_.jsx("div",{className:"w-px h-4",style:{background:Xe.hairline}}),_.jsx("div",{className:"flex items-center gap-1",role:"group","aria-label":"Risk filter",children:["all","risk","no-risk"].map(L=>_.jsx("button",{type:"button",onClick:()=>S(L),"aria-pressed":o===L,className:"px-2.5 py-1 rounded-lg text-[11px] font-mono font-semibold",style:{background:o===L?L==="risk"?"rgba(248,81,73,0.18)":Xe.surface2:"transparent",color:o===L?L==="risk"?Xe.deny:Xe.ink:Xe.faint,border:`1px solid ${o===L?Xe.hairlineS:"transparent"}`},children:L==="all"?"All":L==="risk"?"Risk":"No risk"},L))})]}),_.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[_.jsxs("div",{className:"flex-1 overflow-y-auto",children:[x!==null?_.jsx("p",{className:"text-[12px] font-mono p-6",style:{color:Xe.deny},children:x}):v===null?_.jsx("p",{className:"text-[12px] font-mono p-6",style:{color:Xe.faint},children:"Loading…"}):v.items.length===0?_.jsx("p",{className:"text-[12px] font-mono p-6",style:{color:Xe.faint},children:"No requirements match."}):_.jsx("div",{className:"divide-y",style:{borderColor:Xe.hairline},children:v.items.map(L=>_.jsx(ck,{req:L,selected:g===L.key,onSelect:()=>m(L.key)},L.key))}),v!==null&&v.total>Ea&&_.jsxs("div",{className:"flex items-center justify-center gap-4 py-3",children:[_.jsx("button",{type:"button",disabled:c===0,onClick:()=>h(Math.max(0,c-Ea)),className:"text-[11px] font-mono px-3 py-1 rounded disabled:opacity-40",style:{color:Xe.link},children:"← Prev"}),_.jsxs("span",{className:"text-[11px] font-mono",style:{color:Xe.faint},children:["page ",k," of ",T]}),_.jsx("button",{type:"button",disabled:c+Ea>=v.total,onClick:()=>h(c+Ea),className:"text-[11px] font-mono px-3 py-1 rounded disabled:opacity-40",style:{color:Xe.link},children:"Next →"})]})]}),g!==null&&_.jsx(hk,{repoId:t,reqKey:g,onClose:()=>m(null),onSaved:E,onNavigateComponent:n})]})]})})}function uk(t){return{key:t.key,domain:t.domain,reqId:t.reqId,title:t.title,category:t.category,statement:t.statement,status:t.status,risk:t.risk,riskSource:t.riskSource,edited:t.edited}}function ck({req:t,selected:e,onSelect:r}){return _.jsxs("button",{type:"button",onClick:r,className:"w-full text-left px-5 py-2.5 flex items-center gap-3 shrink-0",style:{background:e?Xe.canvas2:"transparent",borderColor:Xe.hairline},children:[_.jsx("span",{className:"text-[10px] font-mono shrink-0 w-16",style:{color:Xe.faint},children:t.reqId}),_.jsxs("span",{className:"flex-1 min-w-0",children:[_.jsx("span",{className:"block text-[12px] truncate",style:{color:Xe.ink},children:t.title}),t.statement.trim()!==""&&_.jsx("span",{className:"block text-[11px] truncate",style:{color:Xe.muted},children:t.statement.trim()}),_.jsx("span",{className:"block text-[10px] font-mono truncate",style:{color:Xe.faint},children:t.domain})]}),t.edited&&_.jsx("span",{className:"text-[9px] uppercase font-mono px-1.5 py-0.5 rounded shrink-0",style:{background:Xe.surface2,color:Xe.link},children:"edited"}),t.risk&&_.jsxs("span",{className:"text-[9px] uppercase font-semibold font-mono px-1.5 py-0.5 rounded shrink-0",style:{background:"rgba(248,81,73,0.15)",color:Xe.deny},title:t.riskSource==="operator"?"Marked risk by operator":"Risk derived from business rules",children:["risk",t.riskSource==="operator"?" ●":""]}),_.jsx("span",{className:"text-[9px] uppercase font-mono px-1.5 py-0.5 rounded shrink-0",style:{background:t.status==="active"?"rgba(63,185,80,0.12)":t.status==="deprecated"?"rgba(248,81,73,0.12)":Xe.surface2,color:t.status==="active"?Xe.ok:t.status==="deprecated"?Xe.deny:Xe.muted},children:t.status})]})}function hk({repoId:t,reqKey:e,onClose:r,onSaved:n,onNavigateComponent:i}){const[s,o]=ne.useState(null),[a,l]=ne.useState(""),[u,c]=ne.useState(""),[h,v]=ne.useState("active"),[d,x]=ne.useState(!1),[w,g]=ne.useState(null),[m,y]=ne.useState(null);ne.useEffect(()=>{o(null),g(null),y(null),at.getRequirement(t,e).then(({requirement:N})=>{o(N),l(N.title),c(N.notes),v(N.status==="deprecated"||N.status==="review"?N.status:"active")}).catch(N=>y(N instanceof Error?N.message:String(N)))},[t,e]);function b(N){if(s===null)return;const E={...N};a!==s.title&&(E.title=a),u!==s.notes&&(E.notes=u),h!==s.status&&(E.status=h),Object.keys(E).length!==0&&(x(!0),y(null),at.patchRequirement(t,e,E).then(({requirement:T})=>{o(T),l(T.title),c(T.notes),v(T.status==="deprecated"||T.status==="review"?T.status:"active"),n(T),g(Date.now())}).catch(T=>y(T instanceof Error?T.message:String(T))).finally(()=>x(!1)))}function S(){s!==null&&(x(!0),y(null),at.patchRequirement(t,e,{risk:!s.risk}).then(({requirement:N})=>{o(N),n(N),g(Date.now())}).catch(N=>y(N instanceof Error?N.message:String(N))).finally(()=>x(!1)))}return _.jsxs("div",{className:"w-[420px] shrink-0 border-l flex flex-col",style:{borderColor:Xe.hairlineS,background:Xe.surface2},children:[_.jsxs("div",{className:"px-4 py-2.5 border-b flex items-center gap-2 shrink-0",style:{borderColor:Xe.hairline,background:Xe.canvas2},children:[_.jsx("span",{className:"text-[11px] font-mono truncate",style:{color:Xe.ink},children:e}),_.jsx("button",{type:"button",onClick:r,"aria-label":"Close requirement editor",className:"ml-auto text-sm px-1 shrink-0",style:{color:Xe.muted},children:"×"})]}),m!==null&&_.jsx("p",{className:"text-[11px] font-mono px-4 py-2",style:{color:Xe.deny},children:m}),s===null&&m===null?_.jsx("p",{className:"text-[11px] font-mono px-4 py-3",style:{color:Xe.faint},children:"Loading…"}):s!==null?_.jsxs("div",{className:"flex-1 overflow-y-auto px-4 py-3 flex flex-col gap-3",children:[_.jsxs("label",{className:"flex flex-col gap-1",children:[_.jsx("span",{className:"text-[10px] font-mono uppercase",style:{color:Xe.faint},children:"Title"}),_.jsx("input",{type:"text",value:a,onChange:N=>l(N.target.value),className:"text-[12px] font-mono px-3 py-1.5 rounded-lg border outline-none",style:{border:`1px solid ${Xe.hairlineS}`,background:Xe.canvas2,color:Xe.ink}})]}),s.title!==s.sourceTitle&&_.jsxs("p",{className:"text-[10px] font-mono",style:{color:Xe.faint},children:["source title: ",s.sourceTitle]}),_.jsxs("div",{children:[_.jsx("span",{className:"text-[10px] font-mono uppercase",style:{color:Xe.faint},children:"Description (source)"}),_.jsx("p",{className:"text-[11px] mt-1 whitespace-pre-wrap",style:{color:Xe.muted},children:s.description===""?"(none recorded)":s.description.slice(0,1200)})]}),_.jsxs("label",{className:"flex flex-col gap-1",children:[_.jsx("span",{className:"text-[10px] font-mono uppercase",style:{color:Xe.faint},children:"Notes (operator)"}),_.jsx("textarea",{value:u,onChange:N=>c(N.target.value),rows:4,className:"text-[11px] font-mono px-3 py-1.5 rounded-lg border outline-none resize-y",style:{border:`1px solid ${Xe.hairlineS}`,background:Xe.canvas2,color:Xe.ink}})]}),_.jsxs("div",{className:"flex items-center gap-3",children:[_.jsxs("label",{className:"flex items-center gap-2",children:[_.jsx("span",{className:"text-[10px] font-mono uppercase",style:{color:Xe.faint},children:"Status"}),_.jsxs("select",{value:h,onChange:N=>v(N.target.value),className:"text-[11px] font-mono px-2 py-1 rounded-lg border outline-none",style:{border:`1px solid ${Xe.hairlineS}`,background:Xe.canvas2,color:Xe.ink},children:[_.jsx("option",{value:"active",children:"active"}),_.jsx("option",{value:"review",children:"review"}),_.jsx("option",{value:"deprecated",children:"deprecated"})]})]}),_.jsx("button",{type:"button",onClick:S,disabled:d,className:"text-[11px] font-mono font-semibold px-3 py-1 rounded-lg disabled:opacity-50",style:{background:s.risk?"rgba(248,81,73,0.18)":Xe.canvas2,color:s.risk?Xe.deny:Xe.muted,border:`1px solid ${Xe.hairlineS}`},children:s.risk?"⚑ Risk (clear)":"⚑ Mark as risk"})]}),s.riskSource==="data"&&_.jsx("p",{className:"text-[10px] font-mono",style:{color:Xe.faint},children:"risk derived from business rules — an operator toggle overrides it"}),s.businessRules.length>0&&_.jsxs("div",{children:[_.jsx("span",{className:"text-[10px] font-mono uppercase",style:{color:Xe.faint},children:"Business rules"}),_.jsx("ol",{className:"mt-1 flex flex-col gap-1.5",children:s.businessRules.map((N,E)=>{const T=N,k=typeof T.statement=="string"?T.statement.trim():"",L=k!==""?k:JSON.stringify(N),A=typeof T.confidence=="number"?T.confidence:null;return _.jsxs("li",{className:"text-[11px] leading-snug",style:{color:Xe.ink},children:[L,A!==null&&_.jsxs("span",{className:"text-[9px] font-mono ml-1.5",style:{color:Xe.faint},children:["conf ",A]})]},E)})})]}),_.jsxs("div",{className:"text-[10px] font-mono flex gap-3 flex-wrap",style:{color:Xe.faint},children:[_.jsxs("span",{children:[s.ruleCount," rules"]}),_.jsxs("span",{children:[s.componentCount," components"]}),_.jsxs("span",{children:[s.validationCount," validations"]}),_.jsxs("span",{children:[s.errorPathCount," error paths"]})]}),s.legacyComponents.length>0&&_.jsxs("div",{children:[_.jsx("span",{className:"text-[10px] font-mono uppercase",style:{color:Xe.faint},children:"Components"}),_.jsx("ul",{className:"mt-1 flex flex-col gap-0.5",children:s.legacyComponents.map((N,E)=>{const T=typeof N=="string"?N:JSON.stringify(N),k=typeof N=="string"?N.includes("#")?N.split("#")[1]:N:"";return _.jsx("li",{className:"text-[10px] font-mono truncate",children:i!==void 0&&k!==""?_.jsxs("button",{type:"button",onClick:()=>i(k),className:"hover:underline text-left truncate w-full",style:{color:Xe.link},title:`Open ${T} in the code graph`,children:[T," →"]}):_.jsx("span",{style:{color:Xe.muted},children:T})},E)})})]}),_.jsxs("div",{className:"flex items-center gap-3 mt-1",children:[_.jsx("button",{type:"button",onClick:()=>b(),disabled:d,className:"px-4 py-1.5 rounded-lg text-[12px] font-mono font-semibold disabled:opacity-50",style:{background:Xe.accent,color:"#0d1117"},children:d?"Saving…":"Save"}),w!==null&&!d&&_.jsx("span",{className:"text-[10px] font-mono",style:{color:Xe.ok},children:"saved ✓"})]})]}):null]})}const fk=new Set(["completed","failed","cancelled"]);function dk({repoId:t,onSelectRun:e,navigate:r,onOpenGraph:n}){const[i,s]=ne.useState(!1),[o,a]=ne.useState(null),[l,u]=ne.useState([]),[c,h]=ne.useState(null),[v,d]=ne.useState(null),[x,w]=ne.useState(null),[g,m]=ne.useState(!0),[y,b]=ne.useState(null),[S,N]=ne.useState(!1),[E,T]=ne.useState(!1),[k,L]=ne.useState(null);if(ne.useEffect(()=>{let z=!1;return m(!0),b(null),N(!1),d(null),w(null),Promise.all([at.listRepos().then(({repos:W})=>W.find(F=>F.id===t)??null),at.listRuns().then(({runs:W})=>W.filter(F=>F.session.repo_ref===t)).catch(()=>[]),at.getRepoGraph(t).then(({graph:W})=>W).catch(()=>null)]).then(([W,F,P])=>{z||(a(W),u(F),h(P))}).catch(W=>{z||b(W instanceof Error?W.message:"Failed to load repo")}).finally(()=>{z||m(!1)}),at.getRepoGitHistory(t).then(({commits:W})=>{z||d(W)}).catch(()=>{}),at.getRepoContributors(t).then(({contributors:W})=>{z||w(W)}).catch(()=>{}),()=>{z=!0}},[t]),g)return _.jsx("div",{className:"p-8 font-mono text-sm",style:{color:"rgba(230,237,243,0.4)"},children:"Loading…"});if(y)return _.jsx("div",{className:"p-8 font-mono text-sm",style:{color:"#f85149"},children:y});if(!o)return _.jsx("div",{className:"p-8 font-mono text-sm",style:{color:"#f85149"},children:"Repo not found."});const A=l.filter(z=>!fk.has(z.session.status)),I=l.filter(z=>z.session.status==="completed"),M=l.filter(z=>z.session.status==="failed"||z.session.status==="cancelled"),B=c?[...c.nodes].filter(z=>z.file&&!z.file.startsWith("node_modules/")).sort((z,W)=>W.inDeg-z.inDeg).slice(0,5):[],D=S?l:l.slice(0,10),H=c==null?void 0:c.stats;async function U(){T(!0),L(null);try{const{runId:z}=await at.rerunOnboarding(t);e(z)}catch(z){L(z instanceof Error?z.message:String(z))}finally{T(!1)}}return _.jsxs("div",{className:"flex flex-col gap-6 p-8",style:{color:"#e6edf3"},children:[_.jsxs("div",{className:"flex flex-col gap-3",children:[_.jsx("button",{type:"button",onClick:()=>r("/repos"),className:"text-xs font-mono self-start transition-opacity hover:opacity-70",style:{color:"rgba(230,237,243,0.4)"},children:"← Repositories"}),_.jsxs("div",{className:"flex items-start gap-4 flex-wrap",children:[_.jsxs("div",{className:"flex-1 min-w-0",children:[_.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[_.jsx("h1",{className:"text-2xl font-semibold font-mono",children:o.name}),_.jsx("button",{type:"button",onClick:()=>void U(),disabled:E,className:"px-3 py-1 rounded-lg text-xs font-semibold font-mono transition-opacity disabled:opacity-50",style:{background:"#ffda19",color:"#0d1117"},children:E?"Starting…":"↺ Run Onboarding"}),_.jsx("button",{type:"button",onClick:()=>n(),className:"px-3 py-1 rounded-lg text-xs font-semibold font-mono transition-opacity hover:opacity-80",style:{background:"rgba(121,192,255,0.12)",color:"#79c0ff",border:"1px solid rgba(121,192,255,0.2)"},children:"Open Graph →"}),_.jsx("button",{type:"button",onClick:()=>s(!0),className:"px-3 py-1 rounded-lg text-xs font-semibold font-mono transition-opacity hover:opacity-80",style:{background:"rgba(63,185,80,0.12)",color:"#3fb950",border:"1px solid rgba(63,185,80,0.2)"},children:"Open Requirements →"})]}),k&&_.jsx("p",{className:"text-[11px] font-mono mt-1",style:{color:"#f85149"},children:k}),_.jsx("p",{className:"text-xs font-mono mt-1 break-all",style:{color:"rgba(230,237,243,0.4)"},children:o.root_path}),o.git_url&&(/^https?:\/\//i.test(o.git_url)?_.jsx("a",{href:o.git_url,target:"_blank",rel:"noopener noreferrer",className:"text-[11px] font-mono mt-0.5 block truncate hover:underline",style:{color:"#79c0ff"},title:o.git_url,children:o.git_url}):_.jsx("span",{className:"text-[11px] font-mono mt-0.5 block truncate",style:{color:"#79c0ff"},title:o.git_url,children:o.git_url}))]}),_.jsx("span",{className:"shrink-0 mt-1 rounded px-2 py-0.5 text-[11px] font-mono",style:{background:"rgba(121,192,255,0.12)",color:"#79c0ff",border:"1px solid rgba(121,192,255,0.2)"},children:o.default_branch})]})]}),_.jsx("div",{className:"grid grid-cols-4 gap-4",children:[{label:"Total Runs",value:l.length,accent:void 0},{label:"Active",value:A.length,accent:A.length>0?"#79c0ff":void 0},{label:"Completed",value:I.length,accent:I.length>0?"#3fb950":void 0},{label:"Failed",value:M.length,accent:M.length>0?"#f85149":void 0}].map(z=>_.jsxs("div",{className:"rounded-2xl px-6 py-4",style:{background:"#1b222e",border:"1px solid rgba(230,237,243,0.07)"},children:[_.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-widest font-mono",style:{color:"rgba(230,237,243,0.4)"},children:z.label}),_.jsx("p",{className:"text-3xl font-semibold mt-1",style:{color:z.accent??"#e6edf3"},children:z.value})]},z.label))}),A.length>0&&_.jsx(ys,{title:"Active Now",children:_.jsx("div",{className:"flex flex-col gap-1",children:A.map(z=>_.jsx(Gi,{view:z,selectedRunId:null,onSelect:e},z.session.id))})}),_.jsxs("div",{className:"grid gap-6 grid-cols-1 md:grid-cols-2",children:[_.jsxs("div",{className:"flex flex-col gap-6",children:[l.length>0&&_.jsxs(ys,{title:"Work & Chats",children:[_.jsx("div",{className:"flex flex-col gap-1",children:D.map(z=>_.jsx(Gi,{view:z,selectedRunId:null,onSelect:e},z.session.id))}),l.length>10&&_.jsx("button",{type:"button",onClick:()=>N(z=>!z),className:"mt-3 text-xs font-mono hover:underline",style:{color:"rgba(230,237,243,0.4)"},children:S?"↑ show less":`↓ show all ${l.length} runs`})]}),_.jsx(ys,{title:"Code Hotspots",children:B.length===0?_.jsx("p",{className:"text-sm font-mono italic",style:{color:"rgba(230,237,243,0.35)"},children:"Graph not yet indexed — run onboarding to build it."}):_.jsxs("div",{className:"flex flex-col gap-2",children:[B.map((z,W)=>_.jsxs("div",{className:"flex items-center gap-3 px-3 py-2 rounded-lg",style:{background:"#161c26",border:"1px solid rgba(230,237,243,0.05)"},children:[_.jsx("span",{className:"text-[10px] font-mono w-4 text-right shrink-0",style:{color:"rgba(230,237,243,0.3)"},children:W+1}),_.jsx("span",{className:"flex-1 text-xs font-mono truncate",style:{color:"rgba(230,237,243,0.75)"},title:z.file,children:z.file}),_.jsxs("span",{className:"shrink-0 text-[10px] font-mono px-2 py-0.5 rounded",style:{background:"rgba(121,192,255,0.12)",color:"#79c0ff"},children:[z.inDeg," edges"]}),_.jsx("button",{type:"button",onClick:()=>n(),className:"shrink-0 text-[10px] font-mono hover:underline",style:{color:"rgba(230,237,243,0.4)"},children:"→ Graph"})]},z.id)),_.jsx("button",{type:"button",onClick:()=>n(),className:"mt-2 self-start text-xs font-mono hover:underline",style:{color:"#79c0ff"},children:"Open full graph →"})]})})]}),_.jsxs("div",{className:"flex flex-col gap-6",children:[_.jsx(ys,{title:"Code Graph",children:H?_.jsxs("div",{className:"flex flex-col gap-3",children:[[{label:"Symbols",value:H.nodeCount},{label:"Edges",value:H.edgeCount},{label:"Files indexed",value:H.fileCount}].map(z=>_.jsxs("div",{className:"flex items-center justify-between",children:[_.jsx("span",{className:"text-xs font-mono",style:{color:"rgba(230,237,243,0.5)"},children:z.label}),_.jsx("span",{className:"text-sm font-semibold font-mono",style:{color:"#e6edf3"},children:z.value.toLocaleString()})]},z.label)),_.jsx("button",{type:"button",onClick:()=>n(),className:"mt-2 self-start text-xs font-mono hover:underline",style:{color:"#79c0ff"},children:"Browse full graph →"})]}):_.jsx("p",{className:"text-sm font-mono italic",style:{color:"rgba(230,237,243,0.35)"},children:"No graph yet — run onboarding to index this repo."})}),_.jsx(ys,{title:"Git History",children:v===null?_.jsx(pk,{count:6,widths:["w-14","w-16","flex-1","w-12"]}):v.length===0?_.jsx("p",{className:"text-sm font-mono italic",style:{color:"rgba(230,237,243,0.35)"},children:"No commits yet."}):_.jsx("div",{className:"flex flex-col gap-2",children:v.map(z=>_.jsxs("div",{className:"flex items-start gap-2 min-w-0",children:[o.git_url&&/^https:\/\//i.test(o.git_url)?_.jsx("a",{href:`${o.git_url.replace(/\.git$/,"")}/commit/${z.sha}`,target:"_blank",rel:"noopener noreferrer",className:"shrink-0 text-[10px] font-mono hover:underline",style:{color:"#79c0ff",marginTop:"1px"},children:z.shortSha}):_.jsx("span",{className:"shrink-0 text-[10px] font-mono",style:{color:"#79c0ff",marginTop:"1px"},children:z.shortSha}),_.jsx("span",{className:"shrink-0 text-[9px] font-mono truncate max-w-[80px]",style:{color:"rgba(230,237,243,0.45)"},title:z.author,children:z.author}),_.jsx("span",{className:"flex-1 text-[10px] font-mono truncate",style:{color:"rgba(230,237,243,0.8)"},title:z.message,children:z.message.length>72?`${z.message.slice(0,72)}…`:z.message}),_.jsx("span",{className:"shrink-0 text-[9px] font-mono",style:{color:"rgba(230,237,243,0.3)"},children:z.date})]},z.sha))})}),_.jsx(ys,{title:"Contributors",children:x===null?_.jsx(vk,{count:4}):x.length===0?_.jsx("p",{className:"text-sm font-mono italic",style:{color:"rgba(230,237,243,0.35)"},children:"No contributors found."}):_.jsx("div",{className:"flex flex-col gap-2",children:x.map((z,W)=>{const F=z.name.split(" ").map(P=>P[0]??"").join("").slice(0,2).toUpperCase();return _.jsxs("div",{className:"flex items-center gap-2",children:[_.jsx("span",{className:"shrink-0 w-6 h-6 rounded-full flex items-center justify-center text-[9px] font-bold font-mono",style:{background:"rgba(121,192,255,0.15)",color:"#79c0ff"},children:F}),_.jsx("span",{className:"flex-1 text-xs font-mono truncate",style:{color:"rgba(230,237,243,0.8)"},children:z.name}),_.jsxs("span",{className:"shrink-0 text-[10px] font-mono",style:{color:"rgba(230,237,243,0.4)"},children:[z.commits," commit",z.commits!==1?"s":""]})]},`${z.email}-${z.name}-${W}`)})})})]})]}),i&&o&&_.jsx(lk,{repoId:t,repoName:o.name,onClose:()=>s(!1),onNavigateComponent:z=>{s(!1),n(z)}})]})}const ow="rgba(230,237,243,0.06)";function uv({className:t}){return _.jsx("span",{className:`inline-block rounded animate-pulse ${t}`,style:{background:ow}})}function pk({count:t,widths:e}){return _.jsx("div",{className:"flex flex-col gap-2.5",children:Array.from({length:t},(r,n)=>_.jsx("div",{className:"flex items-center gap-2 min-w-0",style:{opacity:Math.max(.15,1-n*.12)},children:e.map((i,s)=>_.jsx(uv,{className:`h-2.5 ${i}`},s))},n))})}function vk({count:t}){return _.jsx("div",{className:"flex flex-col gap-2.5",children:Array.from({length:t},(e,r)=>_.jsxs("div",{className:"flex items-center gap-2",style:{opacity:Math.max(.15,1-r*.18)},children:[_.jsx("span",{className:"shrink-0 w-6 h-6 rounded-full animate-pulse",style:{background:ow}}),_.jsx(uv,{className:"h-2.5 w-28"}),_.jsx(uv,{className:"h-2 w-14 ml-auto"})]},r))})}function ys({title:t,children:e}){return _.jsxs("div",{className:"rounded-2xl p-6",style:{background:"#1b222e",border:"1px solid rgba(230,237,243,0.07)"},children:[_.jsx("h2",{className:"text-[10px] font-semibold uppercase tracking-widest mb-4 font-mono",style:{color:"rgba(230,237,243,0.4)"},children:t}),e]})}function cv(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 gk(t){if(Array.isArray(t))return t}function mk(t){if(Array.isArray(t))return cv(t)}function aa(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function yk(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,uw(n.key),n)}}function sa(t,e,r){return e&&yk(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function ln(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=Gv(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(l){throw l},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
46
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var s,o=!0,a=!1;return{s:function(){r=r.call(t)},n:function(){var l=r.next();return o=l.done,l},e:function(l){a=!0,s=l},f:function(){try{o||r.return==null||r.return()}finally{if(a)throw s}}}}function lw(t,e,r){return(e=uw(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function xk(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function bk(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,i,s,o,a=[],l=!0,u=!1;try{if(s=(r=r.call(t)).next,e===0){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=s.call(r)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(c){u=!0,i=c}finally{try{if(!l&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw i}}return a}}function wk(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
47
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _k(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
48
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function vr(t,e){return gk(t)||bk(t,e)||Gv(t,e)||wk()}function kc(t){return mk(t)||xk(t)||Gv(t)||_k()}function Sk(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 uw(t){var e=Sk(t,"string");return typeof e=="symbol"?e:e+""}function br(t){"@babel/helpers - typeof";return br=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},br(t)}function Gv(t,e){if(t){if(typeof t=="string")return cv(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)?cv(t,e):void 0}}var yr=typeof window>"u"?null:window,x0=yr?yr.navigator:null;yr&&yr.document;var Ck=br(""),cw=br({}),Ek=br(function(){}),kk=typeof HTMLElement>"u"?"undefined":br(HTMLElement),Sl=function(e){return e&&e.instanceString&&ir(e.instanceString)?e.instanceString():null},ct=function(e){return e!=null&&br(e)==Ck},ir=function(e){return e!=null&&br(e)===Ek},Wt=function(e){return!yn(e)&&(Array.isArray?Array.isArray(e):e!=null&&e instanceof Array)},At=function(e){return e!=null&&br(e)===cw&&!Wt(e)&&e.constructor===Object},Tk=function(e){return e!=null&&br(e)===cw},Ke=function(e){return e!=null&&br(e)===br(1)&&!isNaN(e)},Nk=function(e){return Ke(e)&&Math.floor(e)===e},Tc=function(e){if(kk!=="undefined")return e!=null&&e instanceof HTMLElement},yn=function(e){return Cl(e)||hw(e)},Cl=function(e){return Sl(e)==="collection"&&e._private.single},hw=function(e){return Sl(e)==="collection"&&!e._private.single},qv=function(e){return Sl(e)==="core"},fw=function(e){return Sl(e)==="stylesheet"},Rk=function(e){return Sl(e)==="event"},Zi=function(e){return e==null?!0:!!(e===""||e.match(/^\s+$/))},Lk=function(e){return typeof HTMLElement>"u"?!1:e instanceof HTMLElement},Dk=function(e){return At(e)&&Ke(e.x1)&&Ke(e.x2)&&Ke(e.y1)&&Ke(e.y2)},Ak=function(e){return Tk(e)&&ir(e.then)},Mk=function(){return x0&&x0.userAgent.match(/msie|trident|edge/i)},Hs=function(e,r){r||(r=function(){if(arguments.length===1)return arguments[0];if(arguments.length===0)return"undefined";for(var s=[],o=0;o<arguments.length;o++)s.push(arguments[o]);return s.join("$")});var n=function(){var s=this,o=arguments,a,l=r.apply(s,o),u=n.cache;return(a=u[l])||(a=u[l]=e.apply(s,o)),a};return n.cache={},n},Yv=Hs(function(t){return t.replace(/([A-Z])/g,function(e){return"-"+e.toLowerCase()})}),$c=Hs(function(t){return t.replace(/(-\w)/g,function(e){return e[1].toUpperCase()})}),dw=Hs(function(t,e){return t+e[0].toUpperCase()+e.substring(1)},function(t,e){return t+"$"+e}),b0=function(e){return Zi(e)?e:e.charAt(0).toUpperCase()+e.substring(1)},qi=function(e,r){return e.slice(-1*r.length)===r},xr="(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))",Pk="rgb[a]?\\(("+xr+"[%]?)\\s*,\\s*("+xr+"[%]?)\\s*,\\s*("+xr+"[%]?)(?:\\s*,\\s*("+xr+"))?\\)",Ik="rgb[a]?\\((?:"+xr+"[%]?)\\s*,\\s*(?:"+xr+"[%]?)\\s*,\\s*(?:"+xr+"[%]?)(?:\\s*,\\s*(?:"+xr+"))?\\)",Ok="hsl[a]?\\(("+xr+")\\s*,\\s*("+xr+"[%])\\s*,\\s*("+xr+"[%])(?:\\s*,\\s*("+xr+"))?\\)",Bk="hsl[a]?\\((?:"+xr+")\\s*,\\s*(?:"+xr+"[%])\\s*,\\s*(?:"+xr+"[%])(?:\\s*,\\s*(?:"+xr+"))?\\)",jk="\\#[0-9a-fA-F]{3}",Fk="\\#[0-9a-fA-F]{6}",pw=function(e,r){return e<r?-1:e>r?1:0},zk=function(e,r){return-1*pw(e,r)},pt=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),s=0;s<i.length;s++){var o=i[s];t[o]=n[o]}}return t},Hk=function(e){if(!(!(e.length===4||e.length===7)||e[0]!=="#")){var r=e.length===4,n,i,s,o=16;return r?(n=parseInt(e[1]+e[1],o),i=parseInt(e[2]+e[2],o),s=parseInt(e[3]+e[3],o)):(n=parseInt(e[1]+e[2],o),i=parseInt(e[3]+e[4],o),s=parseInt(e[5]+e[6],o)),[n,i,s]}},Uk=function(e){var r,n,i,s,o,a,l,u;function c(x,w,g){return g<0&&(g+=1),g>1&&(g-=1),g<1/6?x+(w-x)*6*g:g<1/2?w:g<2/3?x+(w-x)*(2/3-g)*6:x}var h=new RegExp("^"+Ok+"$").exec(e);if(h){if(n=parseInt(h[1]),n<0?n=(360- -1*n%360)%360:n>360&&(n=n%360),n/=360,i=parseFloat(h[2]),i<0||i>100||(i=i/100,s=parseFloat(h[3]),s<0||s>100)||(s=s/100,o=h[4],o!==void 0&&(o=parseFloat(o),o<0||o>1)))return;if(i===0)a=l=u=Math.round(s*255);else{var v=s<.5?s*(1+i):s+i-s*i,d=2*s-v;a=Math.round(255*c(d,v,n+1/3)),l=Math.round(255*c(d,v,n)),u=Math.round(255*c(d,v,n-1/3))}r=[a,l,u,o]}return r},Wk=function(e){var r,n=new RegExp("^"+Pk+"$").exec(e);if(n){r=[];for(var i=[],s=1;s<=3;s++){var o=n[s];if(o[o.length-1]==="%"&&(i[s]=!0),o=parseFloat(o),i[s]&&(o=o/100*255),o<0||o>255)return;r.push(Math.floor(o))}var a=i[1]||i[2]||i[3],l=i[1]&&i[2]&&i[3];if(a&&!l)return;var u=n[4];if(u!==void 0){if(u=parseFloat(u),u<0||u>1)return;r.push(u)}}return r},Vk=function(e){return $k[e.toLowerCase()]},vw=function(e){return(Wt(e)?e:null)||Vk(e)||Hk(e)||Wk(e)||Uk(e)},$k={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]},gw=function(e){for(var r=e.map,n=e.keys,i=n.length,s=0;s<i;s++){var o=n[s];if(At(o))throw Error("Tried to set map with object key");s<n.length-1?(r[o]==null&&(r[o]={}),r=r[o]):r[o]=e.value}},mw=function(e){for(var r=e.map,n=e.keys,i=n.length,s=0;s<i;s++){var o=n[s];if(At(o))throw Error("Tried to get map with object key");if(r=r[o],r==null)return r}return r},$u=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function El(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var ld,w0;function kl(){if(w0)return ld;w0=1;function t(e){var r=typeof e;return e!=null&&(r=="object"||r=="function")}return ld=t,ld}var ud,_0;function Gk(){if(_0)return ud;_0=1;var t=typeof $u=="object"&&$u&&$u.Object===Object&&$u;return ud=t,ud}var cd,S0;function Gc(){if(S0)return cd;S0=1;var t=Gk(),e=typeof self=="object"&&self&&self.Object===Object&&self,r=t||e||Function("return this")();return cd=r,cd}var hd,C0;function qk(){if(C0)return hd;C0=1;var t=Gc(),e=function(){return t.Date.now()};return hd=e,hd}var fd,E0;function Yk(){if(E0)return fd;E0=1;var t=/\s/;function e(r){for(var n=r.length;n--&&t.test(r.charAt(n)););return n}return fd=e,fd}var dd,k0;function Xk(){if(k0)return dd;k0=1;var t=Yk(),e=/^\s+/;function r(n){return n&&n.slice(0,t(n)+1).replace(e,"")}return dd=r,dd}var pd,T0;function Xv(){if(T0)return pd;T0=1;var t=Gc(),e=t.Symbol;return pd=e,pd}var vd,N0;function Kk(){if(N0)return vd;N0=1;var t=Xv(),e=Object.prototype,r=e.hasOwnProperty,n=e.toString,i=t?t.toStringTag:void 0;function s(o){var a=r.call(o,i),l=o[i];try{o[i]=void 0;var u=!0}catch{}var c=n.call(o);return u&&(a?o[i]=l:delete o[i]),c}return vd=s,vd}var gd,R0;function Qk(){if(R0)return gd;R0=1;var t=Object.prototype,e=t.toString;function r(n){return e.call(n)}return gd=r,gd}var md,L0;function yw(){if(L0)return md;L0=1;var t=Xv(),e=Kk(),r=Qk(),n="[object Null]",i="[object Undefined]",s=t?t.toStringTag:void 0;function o(a){return a==null?a===void 0?i:n:s&&s in Object(a)?e(a):r(a)}return md=o,md}var yd,D0;function Zk(){if(D0)return yd;D0=1;function t(e){return e!=null&&typeof e=="object"}return yd=t,yd}var xd,A0;function Tl(){if(A0)return xd;A0=1;var t=yw(),e=Zk(),r="[object Symbol]";function n(i){return typeof i=="symbol"||e(i)&&t(i)==r}return xd=n,xd}var bd,M0;function Jk(){if(M0)return bd;M0=1;var t=Xk(),e=kl(),r=Tl(),n=NaN,i=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,o=/^0o[0-7]+$/i,a=parseInt;function l(u){if(typeof u=="number")return u;if(r(u))return n;if(e(u)){var c=typeof u.valueOf=="function"?u.valueOf():u;u=e(c)?c+"":c}if(typeof u!="string")return u===0?u:+u;u=t(u);var h=s.test(u);return h||o.test(u)?a(u.slice(2),h?2:8):i.test(u)?n:+u}return bd=l,bd}var wd,P0;function e3(){if(P0)return wd;P0=1;var t=kl(),e=qk(),r=Jk(),n="Expected a function",i=Math.max,s=Math.min;function o(a,l,u){var c,h,v,d,x,w,g=0,m=!1,y=!1,b=!0;if(typeof a!="function")throw new TypeError(n);l=r(l)||0,t(u)&&(m=!!u.leading,y="maxWait"in u,v=y?i(r(u.maxWait)||0,l):v,b="trailing"in u?!!u.trailing:b);function S(B){var D=c,H=h;return c=h=void 0,g=B,d=a.apply(H,D),d}function N(B){return g=B,x=setTimeout(k,l),m?S(B):d}function E(B){var D=B-w,H=B-g,U=l-D;return y?s(U,v-H):U}function T(B){var D=B-w,H=B-g;return w===void 0||D>=l||D<0||y&&H>=v}function k(){var B=e();if(T(B))return L(B);x=setTimeout(k,E(B))}function L(B){return x=void 0,b&&c?S(B):(c=h=void 0,d)}function A(){x!==void 0&&clearTimeout(x),g=0,c=w=h=x=void 0}function I(){return x===void 0?d:L(e())}function M(){var B=e(),D=T(B);if(c=arguments,h=this,w=B,D){if(x===void 0)return N(w);if(y)return clearTimeout(x),x=setTimeout(k,l),S(w)}return x===void 0&&(x=setTimeout(k,l)),d}return M.cancel=A,M.flush=I,M}return wd=o,wd}var t3=e3(),Nl=El(t3),_d=yr?yr.performance:null,xw=_d&&_d.now?function(){return _d.now()}:function(){return Date.now()},r3=(function(){if(yr){if(yr.requestAnimationFrame)return function(t){yr.requestAnimationFrame(t)};if(yr.mozRequestAnimationFrame)return function(t){yr.mozRequestAnimationFrame(t)};if(yr.webkitRequestAnimationFrame)return function(t){yr.webkitRequestAnimationFrame(t)};if(yr.msRequestAnimationFrame)return function(t){yr.msRequestAnimationFrame(t)}}return function(t){t&&setTimeout(function(){t(xw())},1e3/60)}})(),Nc=function(e){return r3(e)},gi=xw,Ma=9261,bw=65599,Ds=5381,ww=function(e){for(var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Ma,n=r,i;i=e.next(),!i.done;)n=n*bw+i.value|0;return n},hl=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Ma;return r*bw+e|0},fl=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Ds;return(r<<5)+r+e|0},n3=function(e,r){return e*2097152+r},Ui=function(e){return e[0]*2097152+e[1]},Gu=function(e,r){return[hl(e[0],r[0]),fl(e[1],r[1])]},I0=function(e,r){var n={value:0,done:!1},i=0,s=e.length,o={next:function(){return i<s?n.value=e[i++]:n.done=!0,n}};return ww(o,r)},ja=function(e,r){var n={value:0,done:!1},i=0,s=e.length,o={next:function(){return i<s?n.value=e.charCodeAt(i++):n.done=!0,n}};return ww(o,r)},_w=function(){return i3(arguments)},i3=function(e){for(var r,n=0;n<e.length;n++){var i=e[n];n===0?r=ja(i):r=ja(i,r)}return r};function a3(t,e,r,n,i){var s=i*Math.PI/180,o=Math.cos(s)*(t-r)-Math.sin(s)*(e-n)+r,a=Math.sin(s)*(t-r)+Math.cos(s)*(e-n)+n;return{x:o,y:a}}var s3=function(e,r,n,i,s,o){return{x:(e-n)*s+n,y:(r-i)*o+i}};function o3(t,e,r){if(r===0)return t;var n=(e.x1+e.x2)/2,i=(e.y1+e.y2)/2,s=e.w/e.h,o=1/s,a=a3(t.x,t.y,n,i,r),l=s3(a.x,a.y,n,i,s,o);return{x:l.x,y:l.y}}var O0=!0,l3=console.warn!=null,u3=console.trace!=null,Kv=Number.MAX_SAFE_INTEGER||9007199254740991,Sw=function(){return!0},Rc=function(){return!1},B0=function(){return 0},Qv=function(){},er=function(e){throw new Error(e)},Cw=function(e){if(e!==void 0)O0=!!e;else return O0},jt=function(e){Cw()&&(l3?console.warn(e):(console.log(e),u3&&console.trace()))},c3=function(e){return pt({},e)},Jn=function(e){return e==null?e:Wt(e)?e.slice():At(e)?c3(e):e},h3=function(e){return e.slice()},Ew=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},f3={},kw=function(){return f3},Mr=function(e){var r=Object.keys(e);return function(n){for(var i={},s=0;s<r.length;s++){var o=r[s],a=n==null?void 0:n[o];i[o]=a===void 0?e[o]:a}return i}},Ji=function(e,r,n){for(var i=e.length-1;i>=0;i--)e[i]===r&&e.splice(i,1)},Zv=function(e){e.splice(0,e.length)},d3=function(e,r){for(var n=0;n<r.length;n++){var i=r[n];e.push(i)}},Xr=function(e,r,n){return n&&(r=dw(n,r)),e[r]},Zn=function(e,r,n,i){n&&(r=dw(n,r)),e[r]=i},p3=(function(){function t(){aa(this,t),this._obj={}}return sa(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]}}])})(),vi=typeof Map<"u"?Map:p3,v3="undefined",g3=(function(){function t(e){if(aa(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 sa(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)}}])})(),Ys=(typeof Set>"u"?"undefined":br(Set))!==v3?Set:g3,qc=function(e,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(e===void 0||r===void 0||!qv(e)){er("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"){er("An element must be of type `nodes` or `edges`; you specified `"+i+"`");return}this.length=1,this[0]=this;var s=this._private={cy:e,single:!0,data:r.data||{},position:r.position||{x:0,y:0},autoWidth:void 0,autoHeight:void 0,autoPadding:void 0,compoundBoundsClean:!1,listeners:[],group:i,style:{},rstyle:{},styleCxts:[],styleKeys:{},removed:!0,selected:!!r.selected,selectable:r.selectable===void 0?!0:!!r.selectable,locked:!!r.locked,grabbed:!1,grabbable:r.grabbable===void 0?!0:!!r.grabbable,pannable:r.pannable===void 0?i==="edges":!!r.pannable,active:!1,classes:new Ys,animation:{current:[],queue:[]},rscratch:{},scratch:r.scratch||{},edges:[],children:[],parent:r.parent&&r.parent.isNode()?r.parent:null,traversalCache:{},backgrounding:!1,bbCache:null,bbCacheShift:{x:0,y:0},bodyBounds:null,overlayBounds:null,labelBounds:{all:null,source:null,target:null,main:null},arrowBounds:{source:null,target:null,"mid-source":null,"mid-target":null}};if(s.position.x==null&&(s.position.x=0),s.position.y==null&&(s.position.y=0),r.renderedPosition){var o=r.renderedPosition,a=e.pan(),l=e.zoom();s.position={x:(o.x-a.x)/l,y:(o.y-a.y)/l}}var u=[];Wt(r.classes)?u=r.classes:ct(r.classes)&&(u=r.classes.split(/\s+/));for(var c=0,h=u.length;c<h;c++){var v=u[c];!v||v===""||s.classes.add(v)}this.createEmitter(),(n===void 0||n)&&this.restore();var d=r.style||r.css;d&&(jt("Setting a `style` bypass at element creation should be done only when absolutely necessary. Try to use the stylesheet instead."),this.style(d))},j0=function(e){return e={bfs:e.bfs||!e.dfs,dfs:e.dfs||!e.bfs},function(n,i,s){var o;At(n)&&!yn(n)&&(o=n,n=o.roots||o.root,i=o.visit,s=o.directed),s=arguments.length===2&&!ir(i)?i:s,i=ir(i)?i:function(){};for(var a=this._private.cy,l=n=ct(n)?this.filter(n):n,u=[],c=[],h={},v={},d={},x=0,w,g=this.byGroup(),m=g.nodes,y=g.edges,b=0;b<l.length;b++){var S=l[b],N=S.id();S.isNode()&&(u.unshift(S),e.bfs&&(d[N]=!0,c.push(S)),v[N]=0)}for(var E=function(){var B=e.bfs?u.shift():u.pop(),D=B.id();if(e.dfs){if(d[D])return 0;d[D]=!0,c.push(B)}var H=v[D],U=h[D],z=U!=null?U.source():null,W=U!=null?U.target():null,F=U==null?void 0:B.same(z)?W[0]:z[0],P;if(P=i(B,U,F,x++,H),P===!0)return w=B,1;if(P===!1)return 1;for(var j=B.connectedEdges().filter(function(ie){return(!s||ie.source().same(B))&&y.has(ie)}),G=0;G<j.length;G++){var $=j[G],ee=$.connectedNodes().filter(function(ie){return!ie.same(B)&&m.has(ie)}),ae=ee.id();ee.length!==0&&!d[ae]&&(ee=ee[0],u.push(ee),e.bfs&&(d[ae]=!0,c.push(ee)),h[ae]=$,v[ae]=v[D]+1)}},T;u.length!==0&&(T=E(),!(T!==0&&T===1)););for(var k=a.collection(),L=0;L<c.length;L++){var A=c[L],I=h[A.id()];I!=null&&k.push(I),k.push(A)}return{path:a.collection(k),found:a.collection(w)}}},dl={breadthFirstSearch:j0({bfs:!0}),depthFirstSearch:j0({dfs:!0})};dl.bfs=dl.breadthFirstSearch;dl.dfs=dl.depthFirstSearch;var cc={exports:{}},m3=cc.exports,F0;function y3(){return F0||(F0=1,(function(t,e){(function(){var r,n,i,s,o,a,l,u,c,h,v,d,x,w,g;i=Math.floor,h=Math.min,n=function(m,y){return m<y?-1:m>y?1:0},c=function(m,y,b,S,N){var E;if(b==null&&(b=0),N==null&&(N=n),b<0)throw new Error("lo must be non-negative");for(S==null&&(S=m.length);b<S;)E=i((b+S)/2),N(y,m[E])<0?S=E:b=E+1;return[].splice.apply(m,[b,b-b].concat(y)),y},a=function(m,y,b){return b==null&&(b=n),m.push(y),w(m,0,m.length-1,b)},o=function(m,y){var b,S;return y==null&&(y=n),b=m.pop(),m.length?(S=m[0],m[0]=b,g(m,0,y)):S=b,S},u=function(m,y,b){var S;return b==null&&(b=n),S=m[0],m[0]=y,g(m,0,b),S},l=function(m,y,b){var S;return b==null&&(b=n),m.length&&b(m[0],y)<0&&(S=[m[0],y],y=S[0],m[0]=S[1],g(m,0,b)),y},s=function(m,y){var b,S,N,E,T,k;for(y==null&&(y=n),E=(function(){k=[];for(var L=0,A=i(m.length/2);0<=A?L<A:L>A;0<=A?L++:L--)k.push(L);return k}).apply(this).reverse(),T=[],S=0,N=E.length;S<N;S++)b=E[S],T.push(g(m,b,y));return T},x=function(m,y,b){var S;if(b==null&&(b=n),S=m.indexOf(y),S!==-1)return w(m,0,S,b),g(m,S,b)},v=function(m,y,b){var S,N,E,T,k;if(b==null&&(b=n),N=m.slice(0,y),!N.length)return N;for(s(N,b),k=m.slice(y),E=0,T=k.length;E<T;E++)S=k[E],l(N,S,b);return N.sort(b).reverse()},d=function(m,y,b){var S,N,E,T,k,L,A,I,M;if(b==null&&(b=n),y*10<=m.length){if(E=m.slice(0,y).sort(b),!E.length)return E;for(N=E[E.length-1],A=m.slice(y),T=0,L=A.length;T<L;T++)S=A[T],b(S,N)<0&&(c(E,S,0,null,b),E.pop(),N=E[E.length-1]);return E}for(s(m,b),M=[],k=0,I=h(y,m.length);0<=I?k<I:k>I;0<=I?++k:--k)M.push(o(m,b));return M},w=function(m,y,b,S){var N,E,T;for(S==null&&(S=n),N=m[b];b>y;){if(T=b-1>>1,E=m[T],S(N,E)<0){m[b]=E,b=T;continue}break}return m[b]=N},g=function(m,y,b){var S,N,E,T,k;for(b==null&&(b=n),N=m.length,k=y,E=m[y],S=2*y+1;S<N;)T=S+1,T<N&&!(b(m[S],m[T])<0)&&(S=T),m[y]=m[S],y=S,S=2*y+1;return m[y]=E,w(m,k,y,b)},r=(function(){m.push=a,m.pop=o,m.replace=u,m.pushpop=l,m.heapify=s,m.updateItem=x,m.nlargest=v,m.nsmallest=d;function m(y){this.cmp=y??n,this.nodes=[]}return m.prototype.push=function(y){return a(this.nodes,y,this.cmp)},m.prototype.pop=function(){return o(this.nodes,this.cmp)},m.prototype.peek=function(){return this.nodes[0]},m.prototype.contains=function(y){return this.nodes.indexOf(y)!==-1},m.prototype.replace=function(y){return u(this.nodes,y,this.cmp)},m.prototype.pushpop=function(y){return l(this.nodes,y,this.cmp)},m.prototype.heapify=function(){return s(this.nodes,this.cmp)},m.prototype.updateItem=function(y){return x(this.nodes,y,this.cmp)},m.prototype.clear=function(){return this.nodes=[]},m.prototype.empty=function(){return this.nodes.length===0},m.prototype.size=function(){return this.nodes.length},m.prototype.clone=function(){var y;return y=new m,y.nodes=this.nodes.slice(0),y},m.prototype.toArray=function(){return this.nodes.slice(0)},m.prototype.insert=m.prototype.push,m.prototype.top=m.prototype.peek,m.prototype.front=m.prototype.peek,m.prototype.has=m.prototype.contains,m.prototype.copy=m.prototype.clone,m})(),(function(m,y){return t.exports=y()})(this,function(){return r})}).call(m3)})(cc)),cc.exports}var Sd,z0;function x3(){return z0||(z0=1,Sd=y3()),Sd}var b3=x3(),Rl=El(b3),w3=Mr({root:null,weight:function(e){return 1},directed:!1}),_3={dijkstra:function(e){if(!At(e)){var r=arguments;e={root:r[0],weight:r[1],directed:r[2]}}var n=w3(e),i=n.root,s=n.weight,o=n.directed,a=this,l=s,u=ct(i)?this.filter(i)[0]:i[0],c={},h={},v={},d=this.byGroup(),x=d.nodes,w=d.edges;w.unmergeBy(function(H){return H.isLoop()});for(var g=function(U){return c[U.id()]},m=function(U,z){c[U.id()]=z,y.updateItem(U)},y=new Rl(function(H,U){return g(H)-g(U)}),b=0;b<x.length;b++){var S=x[b];c[S.id()]=S.same(u)?0:1/0,y.push(S)}for(var N=function(U,z){for(var W=(o?U.edgesTo(z):U.edgesWith(z)).intersect(w),F=1/0,P,j=0;j<W.length;j++){var G=W[j],$=l(G);($<F||!P)&&(F=$,P=G)}return{edge:P,dist:F}};y.size()>0;){var E=y.pop(),T=g(E),k=E.id();if(v[k]=T,T!==1/0)for(var L=E.neighborhood().intersect(x),A=0;A<L.length;A++){var I=L[A],M=I.id(),B=N(E,I),D=T+B.dist;D<g(I)&&(m(I,D),h[M]={node:E,edge:B.edge})}}return{distanceTo:function(U){var z=ct(U)?x.filter(U)[0]:U[0];return v[z.id()]},pathTo:function(U){var z=ct(U)?x.filter(U)[0]:U[0],W=[],F=z,P=F.id();if(z.length>0)for(W.unshift(z);h[P];){var j=h[P];W.unshift(j.edge),W.unshift(j.node),F=j.node,P=F.id()}return a.spawn(W)}}}},S3={kruskal:function(e){e=e||function(b){return 1};for(var r=this.byGroup(),n=r.nodes,i=r.edges,s=n.length,o=new Array(s),a=n,l=function(S){for(var N=0;N<o.length;N++){var E=o[N];if(E.has(S))return N}},u=0;u<s;u++)o[u]=this.spawn(n[u]);for(var c=i.sort(function(b,S){return e(b)-e(S)}),h=0;h<c.length;h++){var v=c[h],d=v.source()[0],x=v.target()[0],w=l(d),g=l(x),m=o[w],y=o[g];w!==g&&(a.merge(v),m.merge(y),o.splice(g,1))}return a}},C3=Mr({root:null,goal:null,weight:function(e){return 1},heuristic:function(e){return 0},directed:!1}),E3={aStar:function(e){var r=this.cy(),n=C3(e),i=n.root,s=n.goal,o=n.heuristic,a=n.directed,l=n.weight;i=r.collection(i)[0],s=r.collection(s)[0];var u=i.id(),c=s.id(),h={},v={},d={},x=new Rl(function(P,j){return v[P.id()]-v[j.id()]}),w=new Ys,g={},m={},y=function(j,G){x.push(j),w.add(G)},b,S,N=function(){b=x.pop(),S=b.id(),w.delete(S)},E=function(j){return w.has(j)};y(i,u),h[u]=0,v[u]=o(i);for(var T=0;x.size()>0;){if(N(),T++,S===c){for(var k=[],L=s,A=c,I=m[A];k.unshift(L),I!=null&&k.unshift(I),L=g[A],L!=null;)A=L.id(),I=m[A];return{found:!0,distance:h[S],path:this.spawn(k),steps:T}}d[S]=!0;for(var M=b._private.edges,B=0;B<M.length;B++){var D=M[B];if(this.hasElementWithId(D.id())&&!(a&&D.data("source")!==S)){var H=D.source(),U=D.target(),z=H.id()!==S?H:U,W=z.id();if(this.hasElementWithId(W)&&!d[W]){var F=h[S]+l(D);if(!E(W)){h[W]=F,v[W]=F+o(z),y(z,W),g[W]=b,m[W]=D;continue}F<h[W]&&(h[W]=F,v[W]=F+o(z),g[W]=b,m[W]=D)}}}}return{found:!1,distance:void 0,path:void 0,steps:T}}},k3=Mr({weight:function(e){return 1},directed:!1}),T3={floydWarshall:function(e){for(var r=this.cy(),n=k3(e),i=n.weight,s=n.directed,o=i,a=this.byGroup(),l=a.nodes,u=a.edges,c=l.length,h=c*c,v=function($){return l.indexOf($)},d=function($){return l[$]},x=new Array(h),w=0;w<h;w++){var g=w%c,m=(w-g)/c;m===g?x[w]=0:x[w]=1/0}for(var y=new Array(h),b=new Array(h),S=0;S<u.length;S++){var N=u[S],E=N.source()[0],T=N.target()[0];if(E!==T){var k=v(E),L=v(T),A=k*c+L,I=o(N);if(x[A]>I&&(x[A]=I,y[A]=L,b[A]=N),!s){var M=L*c+k;!s&&x[M]>I&&(x[M]=I,y[M]=k,b[M]=N)}}}for(var B=0;B<c;B++)for(var D=0;D<c;D++)for(var H=D*c+B,U=0;U<c;U++){var z=D*c+U,W=B*c+U;x[H]+x[W]<x[z]&&(x[z]=x[H]+x[W],y[z]=y[H])}var F=function($){return(ct($)?r.filter($):$)[0]},P=function($){return v(F($))},j={distance:function($,ee){var ae=P($),ie=P(ee);return x[ae*c+ie]},path:function($,ee){var ae=P($),ie=P(ee),K=d(ae);if(ae===ie)return K.collection();if(y[ae*c+ie]==null)return r.collection();var q=r.collection(),Y=ae,X;for(q.merge(K);ae!==ie;)Y=ae,ae=y[ae*c+ie],X=b[Y*c+ae],q.merge(X),q.merge(d(ae));return q}};return j}},N3=Mr({weight:function(e){return 1},directed:!1,root:null}),R3={bellmanFord:function(e){var r=this,n=N3(e),i=n.weight,s=n.directed,o=n.root,a=i,l=this,u=this.cy(),c=this.byGroup(),h=c.edges,v=c.nodes,d=v.length,x=new vi,w=!1,g=[];o=u.collection(o)[0],h.unmergeBy(function(_e){return _e.isLoop()});for(var m=h.length,y=function(ke){var Le=x.get(ke.id());return Le||(Le={},x.set(ke.id(),Le)),Le},b=function(ke){return(ct(ke)?u.$(ke):ke)[0]},S=function(ke){return y(b(ke)).dist},N=function(ke){for(var Le=arguments.length>1&&arguments[1]!==void 0?arguments[1]:o,Ee=b(ke),Ie=[],Oe=Ee;;){if(Oe==null)return r.spawn();var De=y(Oe),We=De.edge,Ye=De.pred;if(Ie.unshift(Oe[0]),Oe.same(Le)&&Ie.length>0)break;We!=null&&Ie.unshift(We),Oe=Ye}return l.spawn(Ie)},E=0;E<d;E++){var T=v[E],k=y(T);T.same(o)?k.dist=0:k.dist=1/0,k.pred=null,k.edge=null}for(var L=!1,A=function(ke,Le,Ee,Ie,Oe,De){var We=Ie.dist+De;We<Oe.dist&&!Ee.same(Ie.edge)&&(Oe.dist=We,Oe.pred=ke,Oe.edge=Ee,L=!0)},I=1;I<d;I++){L=!1;for(var M=0;M<m;M++){var B=h[M],D=B.source(),H=B.target(),U=a(B),z=y(D),W=y(H);A(D,H,B,z,W,U),s||A(H,D,B,W,z,U)}if(!L)break}if(L)for(var F=[],P=0;P<m;P++){var j=h[P],G=j.source(),$=j.target(),ee=a(j),ae=y(G).dist,ie=y($).dist;if(ae+ee<ie||!s&&ie+ee<ae)if(w||(jt("Graph contains a negative weight cycle for Bellman-Ford"),w=!0),e.findNegativeWeightCycles!==!1){var K=[];ae+ee<ie&&K.push(G),!s&&ie+ee<ae&&K.push($);for(var q=K.length,Y=0;Y<q;Y++){var X=K[Y],J=[X];J.push(y(X).edge);for(var re=y(X).pred;J.indexOf(re)===-1;)J.push(re),J.push(y(re).edge),re=y(re).pred;J=J.slice(J.indexOf(re));for(var ce=J[0].id(),de=0,Re=2;Re<J.length;Re+=2)J[Re].id()<ce&&(ce=J[Re].id(),de=Re);J=J.slice(de).concat(J.slice(0,de)),J.push(J[0]);var Pe=J.map(function(_e){return _e.id()}).join(",");F.indexOf(Pe)===-1&&(g.push(l.spawn(J)),F.push(Pe))}}else break}return{distanceTo:S,pathTo:N,hasNegativeWeightCycle:w,negativeWeightCycles:g}}},L3=Math.sqrt(2),D3=function(e,r,n){n.length===0&&er("Karger-Stein must be run on a connected (sub)graph");for(var i=n[e],s=i[1],o=i[2],a=r[s],l=r[o],u=n,c=u.length-1;c>=0;c--){var h=u[c],v=h[1],d=h[2];(r[v]===a&&r[d]===l||r[v]===l&&r[d]===a)&&u.splice(c,1)}for(var x=0;x<u.length;x++){var w=u[x];w[1]===l?(u[x]=w.slice(),u[x][1]=a):w[2]===l&&(u[x]=w.slice(),u[x][2]=a)}for(var g=0;g<r.length;g++)r[g]===l&&(r[g]=a);return u},Cd=function(e,r,n,i){for(;n>i;){var s=Math.floor(Math.random()*r.length);r=D3(s,e,r),n--}return r},A3={kargerStein:function(){var e=this,r=this.byGroup(),n=r.nodes,i=r.edges;i.unmergeBy(function(W){return W.isLoop()});var s=n.length,o=i.length,a=Math.ceil(Math.pow(Math.log(s)/Math.LN2,2)),l=Math.floor(s/L3);if(s<2){er("At least 2 nodes are required for Karger-Stein algorithm");return}for(var u=[],c=0;c<o;c++){var h=i[c];u.push([c,n.indexOf(h.source()),n.indexOf(h.target())])}for(var v=1/0,d=[],x=new Array(s),w=new Array(s),g=new Array(s),m=function(F,P){for(var j=0;j<s;j++)P[j]=F[j]},y=0;y<=a;y++){for(var b=0;b<s;b++)w[b]=b;var S=Cd(w,u.slice(),s,l),N=S.slice();m(w,g);var E=Cd(w,S,l,2),T=Cd(g,N,l,2);E.length<=T.length&&E.length<v?(v=E.length,d=E,m(w,x)):T.length<=E.length&&T.length<v&&(v=T.length,d=T,m(g,x))}for(var k=this.spawn(d.map(function(W){return i[W[0]]})),L=this.spawn(),A=this.spawn(),I=x[0],M=0;M<x.length;M++){var B=x[M],D=n[M];B===I?L.merge(D):A.merge(D)}var H=function(F){var P=e.spawn();return F.forEach(function(j){P.merge(j),j.connectedEdges().forEach(function(G){e.contains(G)&&!k.contains(G)&&P.merge(G)})}),P},U=[H(L),H(A)],z={cut:k,components:U,partition1:L,partition2:A};return z}},Ed,M3=function(e){return{x:e.x,y:e.y}},Yc=function(e,r,n){return{x:e.x*r+n.x,y:e.y*r+n.y}},Tw=function(e,r,n){return{x:(e.x-n.x)/r,y:(e.y-n.y)/r}},Ps=function(e){return{x:e[0],y:e[1]}},P3=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,s=r;s<n;s++){var o=e[s];isFinite(o)&&(i=Math.min(o,i))}return i},I3=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,s=r;s<n;s++){var o=e[s];isFinite(o)&&(i=Math.max(o,i))}return i},O3=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,s=0,o=r;o<n;o++){var a=e[o];isFinite(a)&&(i+=a,s++)}return i/s},B3=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,s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0;i?e=e.slice(r,n):(n<e.length&&e.splice(n,e.length-n),r>0&&e.splice(0,r));for(var a=0,l=e.length-1;l>=0;l--){var u=e[l];o?isFinite(u)||(e[l]=-1/0,a++):e.splice(l,1)}s&&e.sort(function(v,d){return v-d});var c=e.length,h=Math.floor(c/2);return c%2!==0?e[h+1+a]:(e[h-1+a]+e[h+a])/2},j3=function(e){return Math.PI*e/180},qu=function(e,r){return Math.atan2(r,e)-Math.PI/2},Jv=Math.log2||function(t){return Math.log(t)/Math.log(2)},eg=function(e){return e>0?1:e<0?-1:0},Fa=function(e,r){return Math.sqrt(La(e,r))},La=function(e,r){var n=r.x-e.x,i=r.y-e.y;return n*n+i*i},F3=function(e){for(var r=e.length,n=0,i=0;i<r;i++)n+=e[i];for(var s=0;s<r;s++)e[s]=e[s]/n;return e},Er=function(e,r,n,i){return(1-i)*(1-i)*e+2*(1-i)*i*r+i*i*n},Bs=function(e,r,n,i){return{x:Er(e.x,r.x,n.x,i),y:Er(e.y,r.y,n.y,i)}},z3=function(e,r,n,i){var s={x:r.x-e.x,y:r.y-e.y},o=Fa(e,r),a={x:s.x/o,y:s.y/o};return n=n??0,i=i??n*o,{x:e.x+a.x*i,y:e.y+a.y*i}},pl=function(e,r,n){return Math.max(e,Math.min(n,r))},Qr=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}}},H3=function(e){return{x1:e.x1,x2:e.x2,w:e.w,y1:e.y1,y2:e.y2,h:e.h}},U3=function(e){e.x1=1/0,e.y1=1/0,e.x2=-1/0,e.y2=-1/0,e.w=0,e.h=0},W3=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},Nw=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},hc=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},fc=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[0],n,i,s,o;if(r.length===1)n=i=s=o=r[0];else if(r.length===2)n=s=r[0],o=i=r[1];else if(r.length===4){var a=vr(r,4);n=a[0],i=a[1],s=a[2],o=a[3]}return e.x1-=o,e.x2+=i,e.y1-=n,e.y2+=s,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},H0=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},tg=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)},Yi=function(e,r,n){return e.x1<=r&&r<=e.x2&&e.y1<=n&&n<=e.y2},U0=function(e,r){return Yi(e,r.x,r.y)},Rw=function(e,r){return Yi(e,r.x1,r.y1)&&Yi(e,r.x2,r.y2)},V3=(Ed=Math.hypot)!==null&&Ed!==void 0?Ed:function(t,e){return Math.sqrt(t*t+e*e)};function $3(t,e){if(t.length<3)throw new Error("Need at least 3 vertices");var r=function(k,L){return{x:k.x+L.x,y:k.y+L.y}},n=function(k,L){return{x:k.x-L.x,y:k.y-L.y}},i=function(k,L){return{x:k.x*L,y:k.y*L}},s=function(k,L){return k.x*L.y-k.y*L.x},o=function(k){var L=V3(k.x,k.y);return L===0?{x:0,y:0}:{x:k.x/L,y:k.y/L}},a=function(k){for(var L=0,A=0;A<k.length;A++){var I=k[A],M=k[(A+1)%k.length];L+=I.x*M.y-M.x*I.y}return L/2},l=function(k,L,A,I){var M=n(L,k),B=n(I,A),D=s(M,B);if(Math.abs(D)<1e-9)return r(k,i(M,.5));var H=s(n(A,k),B)/D;return r(k,i(M,H))},u=t.map(function(T){return{x:T.x,y:T.y}});a(u)<0&&u.reverse();for(var c=u.length,h=[],v=0;v<c;v++){var d=u[v],x=u[(v+1)%c],w=n(x,d),g=o({x:w.y,y:-w.x});h.push(g)}for(var m=h.map(function(T,k){var L=r(u[k],i(T,e)),A=r(u[(k+1)%c],i(T,e));return{p1:L,p2:A}}),y=[],b=0;b<c;b++){var S=m[(b-1+c)%c],N=m[b],E=l(S.p1,S.p2,N.p1,N.p2);y.push(E)}return y}function G3(t,e,r,n,i,s){var o=tT(t,e,r,n,i),a=$3(o,s),l=Qr();return a.forEach(function(u){return Nw(l,u.x,u.y)}),l}var Lw=function(e,r,n,i,s,o,a){var l=arguments.length>7&&arguments[7]!==void 0?arguments[7]:"auto",u=l==="auto"?ea(s,o):l,c=s/2,h=o/2;u=Math.min(u,c,h);var v=u!==c,d=u!==h,x;if(v){var w=n-c+u-a,g=i-h-a,m=n+c-u+a,y=g;if(x=Xi(e,r,n,i,w,g,m,y,!1),x.length>0)return x}if(d){var b=n+c+a,S=i-h+u-a,N=b,E=i+h-u+a;if(x=Xi(e,r,n,i,b,S,N,E,!1),x.length>0)return x}if(v){var T=n-c+u-a,k=i+h+a,L=n+c-u+a,A=k;if(x=Xi(e,r,n,i,T,k,L,A,!1),x.length>0)return x}if(d){var I=n-c-a,M=i-h+u-a,B=I,D=i+h-u+a;if(x=Xi(e,r,n,i,I,M,B,D,!1),x.length>0)return x}var H;{var U=n-c+u,z=i-h+u;if(H=el(e,r,n,i,U,z,u+a),H.length>0&&H[0]<=U&&H[1]<=z)return[H[0],H[1]]}{var W=n+c-u,F=i-h+u;if(H=el(e,r,n,i,W,F,u+a),H.length>0&&H[0]>=W&&H[1]<=F)return[H[0],H[1]]}{var P=n+c-u,j=i+h-u;if(H=el(e,r,n,i,P,j,u+a),H.length>0&&H[0]>=P&&H[1]>=j)return[H[0],H[1]]}{var G=n-c+u,$=i+h-u;if(H=el(e,r,n,i,G,$,u+a),H.length>0&&H[0]<=G&&H[1]>=$)return[H[0],H[1]]}return[]},q3=function(e,r,n,i,s,o,a){var l=a,u=Math.min(n,s),c=Math.max(n,s),h=Math.min(i,o),v=Math.max(i,o);return u-l<=e&&e<=c+l&&h-l<=r&&r<=v+l},Y3=function(e,r,n,i,s,o,a,l,u){var c={x1:Math.min(n,a,s)-u,x2:Math.max(n,a,s)+u,y1:Math.min(i,l,o)-u,y2:Math.max(i,l,o)+u};return!(e<c.x1||e>c.x2||r<c.y1||r>c.y2)},X3=function(e,r,n,i){n-=i;var s=r*r-4*e*n;if(s<0)return[];var o=Math.sqrt(s),a=2*e,l=(-r+o)/a,u=(-r-o)/a;return[l,u]},K3=function(e,r,n,i,s){var o=1e-5;e===0&&(e=o),r/=e,n/=e,i/=e;var a,l,u,c,h,v,d,x;if(l=(3*n-r*r)/9,u=-(27*i)+r*(9*n-2*(r*r)),u/=54,a=l*l*l+u*u,s[1]=0,d=r/3,a>0){h=u+Math.sqrt(a),h=h<0?-Math.pow(-h,1/3):Math.pow(h,1/3),v=u-Math.sqrt(a),v=v<0?-Math.pow(-v,1/3):Math.pow(v,1/3),s[0]=-d+h+v,d+=(h+v)/2,s[4]=s[2]=-d,d=Math.sqrt(3)*(-v+h)/2,s[3]=d,s[5]=-d;return}if(s[5]=s[3]=0,a===0){x=u<0?-Math.pow(-u,1/3):Math.pow(u,1/3),s[0]=-d+2*x,s[4]=s[2]=-(x+d);return}l=-l,c=l*l*l,c=Math.acos(u/Math.sqrt(c)),x=2*Math.sqrt(l),s[0]=-d+x*Math.cos(c/3),s[2]=-d+x*Math.cos((c+2*Math.PI)/3),s[4]=-d+x*Math.cos((c+4*Math.PI)/3)},Q3=function(e,r,n,i,s,o,a,l){var u=1*n*n-4*n*s+2*n*a+4*s*s-4*s*a+a*a+i*i-4*i*o+2*i*l+4*o*o-4*o*l+l*l,c=9*n*s-3*n*n-3*n*a-6*s*s+3*s*a+9*i*o-3*i*i-3*i*l-6*o*o+3*o*l,h=3*n*n-6*n*s+n*a-n*e+2*s*s+2*s*e-a*e+3*i*i-6*i*o+i*l-i*r+2*o*o+2*o*r-l*r,v=1*n*s-n*n+n*e-s*e+i*o-i*i+i*r-o*r,d=[];K3(u,c,h,v,d);for(var x=1e-7,w=[],g=0;g<6;g+=2)Math.abs(d[g+1])<x&&d[g]>=0&&d[g]<=1&&w.push(d[g]);w.push(1),w.push(0);for(var m=-1,y,b,S,N=0;N<w.length;N++)y=Math.pow(1-w[N],2)*n+2*(1-w[N])*w[N]*s+w[N]*w[N]*a,b=Math.pow(1-w[N],2)*i+2*(1-w[N])*w[N]*o+w[N]*w[N]*l,S=Math.pow(y-e,2)+Math.pow(b-r,2),m>=0?S<m&&(m=S):m=S;return m},Z3=function(e,r,n,i,s,o){var a=[e-n,r-i],l=[s-n,o-i],u=l[0]*l[0]+l[1]*l[1],c=a[0]*a[0]+a[1]*a[1],h=a[0]*l[0]+a[1]*l[1],v=h*h/u;return h<0?c:v>u?(e-s)*(e-s)+(r-o)*(r-o):c-v},on=function(e,r,n){for(var i,s,o,a,l,u=0,c=0;c<n.length/2;c++)if(i=n[c*2],s=n[c*2+1],c+1<n.length/2?(o=n[(c+1)*2],a=n[(c+1)*2+1]):(o=n[(c+1-n.length/2)*2],a=n[(c+1-n.length/2)*2+1]),!(i==e&&o==e))if(i>=e&&e>=o||i<=e&&e<=o)l=(e-i)/(o-i)*(a-s)+s,l>r&&u++;else continue;return u%2!==0},mi=function(e,r,n,i,s,o,a,l,u){var c=new Array(n.length),h;l[0]!=null?(h=Math.atan(l[1]/l[0]),l[0]<0?h=h+Math.PI/2:h=-h-Math.PI/2):h=l;for(var v=Math.cos(-h),d=Math.sin(-h),x=0;x<c.length/2;x++)c[x*2]=o/2*(n[x*2]*v-n[x*2+1]*d),c[x*2+1]=a/2*(n[x*2+1]*v+n[x*2]*d),c[x*2]+=i,c[x*2+1]+=s;var w;if(u>0){var g=Dc(c,-u);w=Lc(g)}else w=c;return on(e,r,w)},J3=function(e,r,n,i,s,o,a,l){for(var u=new Array(n.length*2),c=0;c<l.length;c++){var h=l[c];u[c*4+0]=h.startX,u[c*4+1]=h.startY,u[c*4+2]=h.stopX,u[c*4+3]=h.stopY;var v=Math.pow(h.cx-e,2)+Math.pow(h.cy-r,2);if(v<=Math.pow(h.radius,2))return!0}return on(e,r,u)},Lc=function(e){for(var r=new Array(e.length/2),n,i,s,o,a,l,u,c,h=0;h<e.length/4;h++){n=e[h*4],i=e[h*4+1],s=e[h*4+2],o=e[h*4+3],h<e.length/4-1?(a=e[(h+1)*4],l=e[(h+1)*4+1],u=e[(h+1)*4+2],c=e[(h+1)*4+3]):(a=e[0],l=e[1],u=e[2],c=e[3]);var v=Xi(n,i,s,o,a,l,u,c,!0);r[h*2]=v[0],r[h*2+1]=v[1]}return r},Dc=function(e,r){for(var n=new Array(e.length*2),i,s,o,a,l=0;l<e.length/2;l++){i=e[l*2],s=e[l*2+1],l<e.length/2-1?(o=e[(l+1)*2],a=e[(l+1)*2+1]):(o=e[0],a=e[1]);var u=a-s,c=-(o-i),h=Math.sqrt(u*u+c*c),v=u/h,d=c/h;n[l*4]=i+v*r,n[l*4+1]=s+d*r,n[l*4+2]=o+v*r,n[l*4+3]=a+d*r}return n},eT=function(e,r,n,i,s,o){var a=n-e,l=i-r;a/=s,l/=o;var u=Math.sqrt(a*a+l*l),c=u-1;if(c<0)return[];var h=c/u;return[(n-e)*h+e,(i-r)*h+r]},Ia=function(e,r,n,i,s,o,a){return e-=s,r-=o,e/=n/2+a,r/=i/2+a,e*e+r*r<=1},el=function(e,r,n,i,s,o,a){var l=[n-e,i-r],u=[e-s,r-o],c=l[0]*l[0]+l[1]*l[1],h=2*(u[0]*l[0]+u[1]*l[1]),v=u[0]*u[0]+u[1]*u[1]-a*a,d=h*h-4*c*v;if(d<0)return[];var x=(-h+Math.sqrt(d))/(2*c),w=(-h-Math.sqrt(d))/(2*c),g=Math.min(x,w),m=Math.max(x,w),y=[];if(g>=0&&g<=1&&y.push(g),m>=0&&m<=1&&y.push(m),y.length===0)return[];var b=y[0]*l[0]+e,S=y[0]*l[1]+r;if(y.length>1){if(y[0]==y[1])return[b,S];var N=y[1]*l[0]+e,E=y[1]*l[1]+r;return[b,S,N,E]}else return[b,S]},kd=function(e,r,n){return r<=e&&e<=n||n<=e&&e<=r?e:e<=r&&r<=n||n<=r&&r<=e?r:n},Xi=function(e,r,n,i,s,o,a,l,u){var c=e-s,h=n-e,v=a-s,d=r-o,x=i-r,w=l-o,g=v*d-w*c,m=h*d-x*c,y=w*h-v*x;if(y!==0){var b=g/y,S=m/y,N=.001,E=0-N,T=1+N;return E<=b&&b<=T&&E<=S&&S<=T?[e+b*h,r+b*x]:u?[e+b*h,r+b*x]:[]}else return g===0||m===0?kd(e,n,a)===a?[a,l]:kd(e,n,s)===s?[s,o]:kd(s,a,n)===n?[n,i]:[]:[]},tT=function(e,r,n,i,s){var o=[],a=i/2,l=s/2,u=r,c=n;o.push({x:u+a*e[0],y:c+l*e[1]});for(var h=1;h<e.length/2;h++)o.push({x:u+a*e[h*2],y:c+l*e[h*2+1]});return o},vl=function(e,r,n,i,s,o,a,l){var u=[],c,h=new Array(n.length),v=!0;o==null&&(v=!1);var d;if(v){for(var x=0;x<h.length/2;x++)h[x*2]=n[x*2]*o+i,h[x*2+1]=n[x*2+1]*a+s;if(l>0){var w=Dc(h,-l);d=Lc(w)}else d=h}else d=n;for(var g,m,y,b,S=0;S<d.length/2;S++)g=d[S*2],m=d[S*2+1],S<d.length/2-1?(y=d[(S+1)*2],b=d[(S+1)*2+1]):(y=d[0],b=d[1]),c=Xi(e,r,i,s,g,m,y,b),c.length!==0&&u.push(c[0],c[1]);return u},rT=function(e,r,n,i,s,o,a,l,u){var c=[],h,v=new Array(n.length*2);u.forEach(function(y,b){b===0?(v[v.length-2]=y.startX,v[v.length-1]=y.startY):(v[b*4-2]=y.startX,v[b*4-1]=y.startY),v[b*4]=y.stopX,v[b*4+1]=y.stopY,h=el(e,r,i,s,y.cx,y.cy,y.radius),h.length!==0&&c.push(h[0],h[1])});for(var d=0;d<v.length/4;d++)h=Xi(e,r,i,s,v[d*4],v[d*4+1],v[d*4+2],v[d*4+3],!1),h.length!==0&&c.push(h[0],h[1]);if(c.length>2){for(var x=[c[0],c[1]],w=Math.pow(x[0]-e,2)+Math.pow(x[1]-r,2),g=1;g<c.length/2;g++){var m=Math.pow(c[g*2]-e,2)+Math.pow(c[g*2+1]-r,2);m<=w&&(x[0]=c[g*2],x[1]=c[g*2+1],w=m)}return x}return c},Yu=function(e,r,n){var i=[e[0]-r[0],e[1]-r[1]],s=Math.sqrt(i[0]*i[0]+i[1]*i[1]),o=(s-n)/s;return o<0&&(o=1e-5),[r[0]+o*i[0],r[1]+o*i[1]]},Yr=function(e,r){var n=hv(e,r);return n=Dw(n),n},Dw=function(e){for(var r,n,i=e.length/2,s=1/0,o=1/0,a=-1/0,l=-1/0,u=0;u<i;u++)r=e[2*u],n=e[2*u+1],s=Math.min(s,r),a=Math.max(a,r),o=Math.min(o,n),l=Math.max(l,n);for(var c=2/(a-s),h=2/(l-o),v=0;v<i;v++)r=e[2*v]=e[2*v]*c,n=e[2*v+1]=e[2*v+1]*h,s=Math.min(s,r),a=Math.max(a,r),o=Math.min(o,n),l=Math.max(l,n);if(o<-1)for(var d=0;d<i;d++)n=e[2*d+1]=e[2*d+1]+(-1-o);return e},hv=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 s=new Array(e*2),o,a=0;a<e;a++)o=a*n+i,s[2*a]=Math.cos(o),s[2*a+1]=Math.sin(-o);return s},ea=function(e,r){return Math.min(e/4,r/4,8)},Aw=function(e,r){return Math.min(e/10,r/10,8)},rg=function(){return 8},nT=function(e,r,n){return[e-2*r+n,2*(r-e),e]},fv=function(e,r){return{heightOffset:Math.min(15,.05*r),widthOffset:Math.min(100,.25*e),ctrlPtOffsetPct:.05}};function Td(t,e){function r(h){for(var v=[],d=0;d<h.length;d++){var x=h[d],w=h[(d+1)%h.length],g={x:w.x-x.x,y:w.y-x.y},m={x:-g.y,y:g.x},y=Math.sqrt(m.x*m.x+m.y*m.y);v.push({x:m.x/y,y:m.y/y})}return v}function n(h,v){var d=1/0,x=-1/0,w=ln(h),g;try{for(w.s();!(g=w.n()).done;){var m=g.value,y=m.x*v.x+m.y*v.y;d=Math.min(d,y),x=Math.max(x,y)}}catch(b){w.e(b)}finally{w.f()}return{min:d,max:x}}function i(h,v){return!(h.max<v.min||v.max<h.min)}var s=[].concat(kc(r(t)),kc(r(e))),o=ln(s),a;try{for(o.s();!(a=o.n()).done;){var l=a.value,u=n(t,l),c=n(e,l);if(!i(u,c))return!1}}catch(h){o.e(h)}finally{o.f()}return!0}var iT=Mr({dampingFactor:.8,precision:1e-6,iterations:200,weight:function(e){return 1}}),aT={pageRank:function(e){for(var r=iT(e),n=r.dampingFactor,i=r.precision,s=r.iterations,o=r.weight,a=this._private.cy,l=this.byGroup(),u=l.nodes,c=l.edges,h=u.length,v=h*h,d=c.length,x=new Array(v),w=new Array(h),g=(1-n)/h,m=0;m<h;m++){for(var y=0;y<h;y++){var b=m*h+y;x[b]=0}w[m]=0}for(var S=0;S<d;S++){var N=c[S],E=N.data("source"),T=N.data("target");if(E!==T){var k=u.indexOfId(E),L=u.indexOfId(T),A=o(N),I=L*h+k;x[I]+=A,w[k]+=A}}for(var M=1/h+g,B=0;B<h;B++)if(w[B]===0)for(var D=0;D<h;D++){var H=D*h+B;x[H]=M}else for(var U=0;U<h;U++){var z=U*h+B;x[z]=x[z]/w[B]+g}for(var W=new Array(h),F=new Array(h),P,j=0;j<h;j++)W[j]=1;for(var G=0;G<s;G++){for(var $=0;$<h;$++)F[$]=0;for(var ee=0;ee<h;ee++)for(var ae=0;ae<h;ae++){var ie=ee*h+ae;F[ee]+=x[ie]*W[ae]}F3(F),P=W,W=F,F=P;for(var K=0,q=0;q<h;q++){var Y=P[q]-W[q];K+=Y*Y}if(K<i)break}var X={rank:function(re){return re=a.collection(re)[0],W[u.indexOf(re)]}};return X}},W0=Mr({root:null,weight:function(e){return 1},directed:!1,alpha:0}),js={degreeCentralityNormalized:function(e){e=W0(e);var r=this.cy(),n=this.nodes(),i=n.length;if(e.directed){for(var c={},h={},v=0,d=0,x=0;x<i;x++){var w=n[x],g=w.id();e.root=w;var m=this.degreeCentrality(e);v<m.indegree&&(v=m.indegree),d<m.outdegree&&(d=m.outdegree),c[g]=m.indegree,h[g]=m.outdegree}return{indegree:function(b){return v==0?0:(ct(b)&&(b=r.filter(b)),c[b.id()]/v)},outdegree:function(b){return d===0?0:(ct(b)&&(b=r.filter(b)),h[b.id()]/d)}}}else{for(var s={},o=0,a=0;a<i;a++){var l=n[a];e.root=l;var u=this.degreeCentrality(e);o<u.degree&&(o=u.degree),s[l.id()]=u.degree}return{degree:function(b){return o===0?0:(ct(b)&&(b=r.filter(b)),s[b.id()]/o)}}}},degreeCentrality:function(e){e=W0(e);var r=this.cy(),n=this,i=e,s=i.root,o=i.weight,a=i.directed,l=i.alpha;if(s=r.collection(s)[0],a){for(var d=s.connectedEdges(),x=d.filter(function(E){return E.target().same(s)&&n.has(E)}),w=d.filter(function(E){return E.source().same(s)&&n.has(E)}),g=x.length,m=w.length,y=0,b=0,S=0;S<x.length;S++)y+=o(x[S]);for(var N=0;N<w.length;N++)b+=o(w[N]);return{indegree:Math.pow(g,1-l)*Math.pow(y,l),outdegree:Math.pow(m,1-l)*Math.pow(b,l)}}else{for(var u=s.connectedEdges().intersection(n),c=u.length,h=0,v=0;v<u.length;v++)h+=o(u[v]);return{degree:Math.pow(c,1-l)*Math.pow(h,l)}}}};js.dc=js.degreeCentrality;js.dcn=js.degreeCentralityNormalised=js.degreeCentralityNormalized;var V0=Mr({harmonic:!0,weight:function(){return 1},directed:!1,root:null}),Fs={closenessCentralityNormalized:function(e){for(var r=V0(e),n=r.harmonic,i=r.weight,s=r.directed,o=this.cy(),a={},l=0,u=this.nodes(),c=this.floydWarshall({weight:i,directed:s}),h=0;h<u.length;h++){for(var v=0,d=u[h],x=0;x<u.length;x++)if(h!==x){var w=c.distance(d,u[x]);n?v+=1/w:v+=w}n||(v=1/v),l<v&&(l=v),a[d.id()]=v}return{closeness:function(m){return l==0?0:(ct(m)?m=o.filter(m)[0].id():m=m.id(),a[m]/l)}}},closenessCentrality:function(e){var r=V0(e),n=r.root,i=r.weight,s=r.directed,o=r.harmonic;n=this.filter(n)[0];for(var a=this.dijkstra({root:n,weight:i,directed:s}),l=0,u=this.nodes(),c=0;c<u.length;c++){var h=u[c];if(!h.same(n)){var v=a.distanceTo(h);o?l+=1/v:l+=v}}return o?l:1/l}};Fs.cc=Fs.closenessCentrality;Fs.ccn=Fs.closenessCentralityNormalised=Fs.closenessCentralityNormalized;var sT=Mr({weight:null,directed:!1}),dv={betweennessCentrality:function(e){for(var r=sT(e),n=r.directed,i=r.weight,s=i!=null,o=this.cy(),a=this.nodes(),l={},u={},c=0,h={set:function(b,S){u[b]=S,S>c&&(c=S)},get:function(b){return u[b]}},v=0;v<a.length;v++){var d=a[v],x=d.id();n?l[x]=d.outgoers().nodes():l[x]=d.openNeighborhood().nodes(),h.set(x,0)}for(var w=function(){for(var b=a[g].id(),S=[],N={},E={},T={},k=new Rl(function(ee,ae){return T[ee]-T[ae]}),L=0;L<a.length;L++){var A=a[L].id();N[A]=[],E[A]=0,T[A]=1/0}for(E[b]=1,T[b]=0,k.push(b);!k.empty();){var I=k.pop();if(S.push(I),s)for(var M=0;M<l[I].length;M++){var B=l[I][M],D=o.getElementById(I),H=void 0;D.edgesTo(B).length>0?H=D.edgesTo(B)[0]:H=B.edgesTo(D)[0];var U=i(H);B=B.id(),T[B]>T[I]+U&&(T[B]=T[I]+U,k.nodes.indexOf(B)<0?k.push(B):k.updateItem(B),E[B]=0,N[B]=[]),T[B]==T[I]+U&&(E[B]=E[B]+E[I],N[B].push(I))}else for(var z=0;z<l[I].length;z++){var W=l[I][z].id();T[W]==1/0&&(k.push(W),T[W]=T[I]+1),T[W]==T[I]+1&&(E[W]=E[W]+E[I],N[W].push(I))}}for(var F={},P=0;P<a.length;P++)F[a[P].id()]=0;for(;S.length>0;){for(var j=S.pop(),G=0;G<N[j].length;G++){var $=N[j][G];F[$]=F[$]+E[$]/E[j]*(1+F[j])}j!=a[g].id()&&h.set(j,h.get(j)+F[j])}},g=0;g<a.length;g++)w();var m={betweenness:function(b){var S=o.collection(b).id();return h.get(S)},betweennessNormalized:function(b){if(c==0)return 0;var S=o.collection(b).id();return h.get(S)/c}};return m.betweennessNormalised=m.betweennessNormalized,m}};dv.bc=dv.betweennessCentrality;var oT=Mr({expandFactor:2,inflateFactor:2,multFactor:1,maxIterations:20,attributes:[function(t){return 1}]}),lT=function(e){return oT(e)},uT=function(e,r){for(var n=0,i=0;i<r.length;i++)n+=r[i](e);return n},cT=function(e,r,n){for(var i=0;i<r;i++)e[i*r+i]=n},Mw=function(e,r){for(var n,i=0;i<r;i++){n=0;for(var s=0;s<r;s++)n+=e[s*r+i];for(var o=0;o<r;o++)e[o*r+i]=e[o*r+i]/n}},hT=function(e,r,n){for(var i=new Array(n*n),s=0;s<n;s++){for(var o=0;o<n;o++)i[s*n+o]=0;for(var a=0;a<n;a++)for(var l=0;l<n;l++)i[s*n+l]+=e[s*n+a]*r[a*n+l]}return i},fT=function(e,r,n){for(var i=e.slice(0),s=1;s<n;s++)e=hT(e,i,r);return e},dT=function(e,r,n){for(var i=new Array(r*r),s=0;s<r*r;s++)i[s]=Math.pow(e[s],n);return Mw(i,r),i},pT=function(e,r,n,i){for(var s=0;s<n;s++){var o=Math.round(e[s]*Math.pow(10,i))/Math.pow(10,i),a=Math.round(r[s]*Math.pow(10,i))/Math.pow(10,i);if(o!==a)return!1}return!0},vT=function(e,r,n,i){for(var s=[],o=0;o<r;o++){for(var a=[],l=0;l<r;l++)Math.round(e[o*r+l]*1e3)/1e3>0&&a.push(n[l]);a.length!==0&&s.push(i.collection(a))}return s},gT=function(e,r){for(var n=0;n<e.length;n++)if(!r[n]||e[n].id()!==r[n].id())return!1;return!0},mT=function(e){for(var r=0;r<e.length;r++)for(var n=0;n<e.length;n++)r!=n&&gT(e[r],e[n])&&e.splice(n,1);return e},$0=function(e){for(var r=this.nodes(),n=this.edges(),i=this.cy(),s=lT(e),o={},a=0;a<r.length;a++)o[r[a].id()]=a;for(var l=r.length,u=l*l,c=new Array(u),h,v=0;v<u;v++)c[v]=0;for(var d=0;d<n.length;d++){var x=n[d],w=o[x.source().id()],g=o[x.target().id()],m=uT(x,s.attributes);c[w*l+g]+=m,c[g*l+w]+=m}cT(c,l,s.multFactor),Mw(c,l);for(var y=!0,b=0;y&&b<s.maxIterations;)y=!1,h=fT(c,l,s.expandFactor),c=dT(h,l,s.inflateFactor),pT(c,h,u,4)||(y=!0),b++;var S=vT(c,l,r,i);return S=mT(S),S},yT={markovClustering:$0,mcl:$0},xT=function(e){return e},Pw=function(e,r){return Math.abs(r-e)},G0=function(e,r,n){return e+Pw(r,n)},q0=function(e,r,n){return e+Math.pow(n-r,2)},bT=function(e){return Math.sqrt(e)},wT=function(e,r,n){return Math.max(e,Pw(r,n))},zo=function(e,r,n,i,s){for(var o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:xT,a=i,l,u,c=0;c<e;c++)l=r(c),u=n(c),a=s(a,l,u);return o(a)},Us={euclidean:function(e,r,n){return e>=2?zo(e,r,n,0,q0,bT):zo(e,r,n,0,G0)},squaredEuclidean:function(e,r,n){return zo(e,r,n,0,q0)},manhattan:function(e,r,n){return zo(e,r,n,0,G0)},max:function(e,r,n){return zo(e,r,n,-1/0,wT)}};Us["squared-euclidean"]=Us.squaredEuclidean;Us.squaredeuclidean=Us.squaredEuclidean;function Xc(t,e,r,n,i,s){var o;return ir(t)?o=t:o=Us[t]||Us.euclidean,e===0&&ir(t)?o(i,s):o(e,r,n,i,s)}var _T=Mr({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),ng=function(e){return _T(e)},Ac=function(e,r,n,i,s){var o=s!=="kMedoids",a=o?function(h){return n[h]}:function(h){return i[h](n)},l=function(v){return i[v](r)},u=n,c=r;return Xc(e,i.length,a,l,u,c)},Nd=function(e,r,n){for(var i=n.length,s=new Array(i),o=new Array(i),a=new Array(r),l=null,u=0;u<i;u++)s[u]=e.min(n[u]).value,o[u]=e.max(n[u]).value;for(var c=0;c<r;c++){l=[];for(var h=0;h<i;h++)l[h]=Math.random()*(o[h]-s[h])+s[h];a[c]=l}return a},Iw=function(e,r,n,i,s){for(var o=1/0,a=0,l=0;l<r.length;l++){var u=Ac(n,e,r[l],i,s);u<o&&(o=u,a=l)}return a},Ow=function(e,r,n){for(var i=[],s=null,o=0;o<r.length;o++)s=r[o],n[s.id()]===e&&i.push(s);return i},ST=function(e,r,n){return Math.abs(r-e)<=n},CT=function(e,r,n){for(var i=0;i<e.length;i++)for(var s=0;s<e[i].length;s++){var o=Math.abs(e[i][s]-r[i][s]);if(o>n)return!1}return!0},ET=function(e,r,n){for(var i=0;i<n;i++)if(e===r[i])return!0;return!1},Y0=function(e,r){var n=new Array(r);if(e.length<50)for(var i=0;i<r;i++){for(var s=e[Math.floor(Math.random()*e.length)];ET(s,n,i);)s=e[Math.floor(Math.random()*e.length)];n[i]=s}else for(var o=0;o<r;o++)n[o]=e[Math.floor(Math.random()*e.length)];return n},X0=function(e,r,n){for(var i=0,s=0;s<r.length;s++)i+=Ac("manhattan",r[s],e,n,"kMedoids");return i},kT=function(e){var r=this.cy(),n=this.nodes(),i=null,s=ng(e),o=new Array(s.k),a={},l;s.testMode?typeof s.testCentroids=="number"?(s.testCentroids,l=Nd(n,s.k,s.attributes)):br(s.testCentroids)==="object"?l=s.testCentroids:l=Nd(n,s.k,s.attributes):l=Nd(n,s.k,s.attributes);for(var u=!0,c=0;u&&c<s.maxIterations;){for(var h=0;h<n.length;h++)i=n[h],a[i.id()]=Iw(i,l,s.distance,s.attributes,"kMeans");u=!1;for(var v=0;v<s.k;v++){var d=Ow(v,n,a);if(d.length!==0){for(var x=s.attributes.length,w=l[v],g=new Array(x),m=new Array(x),y=0;y<x;y++){m[y]=0;for(var b=0;b<d.length;b++)i=d[b],m[y]+=s.attributes[y](i);g[y]=m[y]/d.length,ST(g[y],w[y],s.sensitivityThreshold)||(u=!0)}l[v]=g,o[v]=r.collection(d)}}c++}return o},TT=function(e){var r=this.cy(),n=this.nodes(),i=null,s=ng(e),o=new Array(s.k),a,l={},u,c=new Array(s.k);s.testMode?typeof s.testCentroids=="number"||(br(s.testCentroids)==="object"?a=s.testCentroids:a=Y0(n,s.k)):a=Y0(n,s.k);for(var h=!0,v=0;h&&v<s.maxIterations;){for(var d=0;d<n.length;d++)i=n[d],l[i.id()]=Iw(i,a,s.distance,s.attributes,"kMedoids");h=!1;for(var x=0;x<a.length;x++){var w=Ow(x,n,l);if(w.length!==0){c[x]=X0(a[x],w,s.attributes);for(var g=0;g<w.length;g++)u=X0(w[g],w,s.attributes),u<c[x]&&(c[x]=u,a[x]=w[g],h=!0);o[x]=r.collection(w)}}v++}return o},NT=function(e,r,n,i,s){for(var o,a,l=0;l<r.length;l++)for(var u=0;u<e.length;u++)i[l][u]=Math.pow(n[l][u],s.m);for(var c=0;c<e.length;c++)for(var h=0;h<s.attributes.length;h++){o=0,a=0;for(var v=0;v<r.length;v++)o+=i[v][c]*s.attributes[h](r[v]),a+=i[v][c];e[c][h]=o/a}},RT=function(e,r,n,i,s){for(var o=0;o<e.length;o++)r[o]=e[o].slice();for(var a,l,u,c=2/(s.m-1),h=0;h<n.length;h++)for(var v=0;v<i.length;v++){a=0;for(var d=0;d<n.length;d++)l=Ac(s.distance,i[v],n[h],s.attributes,"cmeans"),u=Ac(s.distance,i[v],n[d],s.attributes,"cmeans"),a+=Math.pow(l/u,c);e[v][h]=1/a}},LT=function(e,r,n,i){for(var s=new Array(n.k),o=0;o<s.length;o++)s[o]=[];for(var a,l,u=0;u<r.length;u++){a=-1/0,l=-1;for(var c=0;c<r[0].length;c++)r[u][c]>a&&(a=r[u][c],l=c);s[l].push(e[u])}for(var h=0;h<s.length;h++)s[h]=i.collection(s[h]);return s},K0=function(e){var r=this.cy(),n=this.nodes(),i=ng(e),s,o,a,l,u;l=new Array(n.length);for(var c=0;c<n.length;c++)l[c]=new Array(i.k);a=new Array(n.length);for(var h=0;h<n.length;h++)a[h]=new Array(i.k);for(var v=0;v<n.length;v++){for(var d=0,x=0;x<i.k;x++)a[v][x]=Math.random(),d+=a[v][x];for(var w=0;w<i.k;w++)a[v][w]=a[v][w]/d}o=new Array(i.k);for(var g=0;g<i.k;g++)o[g]=new Array(i.attributes.length);u=new Array(n.length);for(var m=0;m<n.length;m++)u[m]=new Array(i.k);for(var y=!0,b=0;y&&b<i.maxIterations;)y=!1,NT(o,n,a,u,i),RT(a,l,o,n,i),CT(a,l,i.sensitivityThreshold)||(y=!0),b++;return s=LT(n,a,i,r),{clusters:s,degreeOfMembership:a}},DT={kMeans:kT,kMedoids:TT,fuzzyCMeans:K0,fcm:K0},AT=Mr({distance:"euclidean",linkage:"min",mode:"threshold",threshold:1/0,addDendrogram:!1,dendrogramDepth:0,attributes:[]}),MT={single:"min",complete:"max"},PT=function(e){var r=AT(e),n=MT[r.linkage];return n!=null&&(r.linkage=n),r},Q0=function(e,r,n,i,s){for(var o=0,a=1/0,l,u=s.attributes,c=function(L,A){return Xc(s.distance,u.length,function(I){return u[I](L)},function(I){return u[I](A)},L,A)},h=0;h<e.length;h++){var v=e[h].key,d=n[v][i[v]];d<a&&(o=v,a=d)}if(s.mode==="threshold"&&a>=s.threshold||s.mode==="dendrogram"&&e.length===1)return!1;var x=r[o],w=r[i[o]],g;s.mode==="dendrogram"?g={left:x,right:w,key:x.key}:g={value:x.value.concat(w.value),key:x.key},e[x.index]=g,e.splice(w.index,1),r[x.key]=g;for(var m=0;m<e.length;m++){var y=e[m];x.key===y.key?l=1/0:s.linkage==="min"?(l=n[x.key][y.key],n[x.key][y.key]>n[w.key][y.key]&&(l=n[w.key][y.key])):s.linkage==="max"?(l=n[x.key][y.key],n[x.key][y.key]<n[w.key][y.key]&&(l=n[w.key][y.key])):s.linkage==="mean"?l=(n[x.key][y.key]*x.size+n[w.key][y.key]*w.size)/(x.size+w.size):s.mode==="dendrogram"?l=c(y.value,x.value):l=c(y.value[0],x.value[0]),n[x.key][y.key]=n[y.key][x.key]=l}for(var b=0;b<e.length;b++){var S=e[b].key;if(i[S]===x.key||i[S]===w.key){for(var N=S,E=0;E<e.length;E++){var T=e[E].key;n[S][T]<n[S][N]&&(N=T)}i[S]=N}e[b].index=b}return x.key=w.key=x.index=w.index=null,!0},Is=function(e,r,n){e&&(e.value?r.push(e.value):(e.left&&Is(e.left,r),e.right&&Is(e.right,r)))},pv=function(e,r){if(!e)return"";if(e.left&&e.right){var n=pv(e.left,r),i=pv(e.right,r),s=r.add({group:"nodes",data:{id:n+","+i}});return r.add({group:"edges",data:{source:n,target:s.id()}}),r.add({group:"edges",data:{source:i,target:s.id()}}),s.id()}else if(e.value)return e.value.id()},vv=function(e,r,n){if(!e)return[];var i=[],s=[],o=[];return r===0?(e.left&&Is(e.left,i),e.right&&Is(e.right,s),o=i.concat(s),[n.collection(o)]):r===1?e.value?[n.collection(e.value)]:(e.left&&Is(e.left,i),e.right&&Is(e.right,s),[n.collection(i),n.collection(s)]):e.value?[n.collection(e.value)]:(e.left&&(i=vv(e.left,r-1,n)),e.right&&(s=vv(e.right,r-1,n)),i.concat(s))},Z0=function(e){for(var r=this.cy(),n=this.nodes(),i=PT(e),s=i.attributes,o=function(b,S){return Xc(i.distance,s.length,function(N){return s[N](b)},function(N){return s[N](S)},b,S)},a=[],l=[],u=[],c=[],h=0;h<n.length;h++){var v={value:i.mode==="dendrogram"?n[h]:[n[h]],key:h,index:h};a[h]=v,c[h]=v,l[h]=[],u[h]=0}for(var d=0;d<a.length;d++)for(var x=0;x<=d;x++){var w=void 0;i.mode==="dendrogram"?w=d===x?1/0:o(a[d].value,a[x].value):w=d===x?1/0:o(a[d].value[0],a[x].value[0]),l[d][x]=w,l[x][d]=w,w<l[d][u[d]]&&(u[d]=x)}for(var g=Q0(a,c,l,u,i);g;)g=Q0(a,c,l,u,i);var m;return i.mode==="dendrogram"?(m=vv(a[0],i.dendrogramDepth,r),i.addDendrogram&&pv(a[0],r)):(m=new Array(a.length),a.forEach(function(y,b){y.key=y.index=null,m[b]=r.collection(y.value)})),m},IT={hierarchicalClustering:Z0,hca:Z0},OT=Mr({distance:"euclidean",preference:"median",damping:.8,maxIterations:1e3,minIterations:100,attributes:[]}),BT=function(e){var r=e.damping,n=e.preference;.5<=r&&r<1||er("Damping must range on [0.5, 1). Got: ".concat(r));var i=["median","mean","min","max"];return i.some(function(s){return s===n})||Ke(n)||er("Preference must be one of [".concat(i.map(function(s){return"'".concat(s,"'")}).join(", "),"] or a number. Got: ").concat(n)),OT(e)},jT=function(e,r,n,i){var s=function(a,l){return i[l](a)};return-Xc(e,i.length,function(o){return s(r,o)},function(o){return s(n,o)},r,n)},FT=function(e,r){var n=null;return r==="median"?n=B3(e):r==="mean"?n=O3(e):r==="min"?n=P3(e):r==="max"?n=I3(e):n=r,n},zT=function(e,r,n){for(var i=[],s=0;s<e;s++)r[s*e+s]+n[s*e+s]>0&&i.push(s);return i},J0=function(e,r,n){for(var i=[],s=0;s<e;s++){for(var o=-1,a=-1/0,l=0;l<n.length;l++){var u=n[l];r[s*e+u]>a&&(o=u,a=r[s*e+u])}o>0&&i.push(o)}for(var c=0;c<n.length;c++)i[n[c]]=n[c];return i},HT=function(e,r,n){for(var i=J0(e,r,n),s=0;s<n.length;s++){for(var o=[],a=0;a<i.length;a++)i[a]===n[s]&&o.push(a);for(var l=-1,u=-1/0,c=0;c<o.length;c++){for(var h=0,v=0;v<o.length;v++)h+=r[o[v]*e+o[c]];h>u&&(l=c,u=h)}n[s]=o[l]}return i=J0(e,r,n),i},ex=function(e){for(var r=this.cy(),n=this.nodes(),i=BT(e),s={},o=0;o<n.length;o++)s[n[o].id()]=o;var a,l,u,c,h,v;a=n.length,l=a*a,u=new Array(l);for(var d=0;d<l;d++)u[d]=-1/0;for(var x=0;x<a;x++)for(var w=0;w<a;w++)x!==w&&(u[x*a+w]=jT(i.distance,n[x],n[w],i.attributes));c=FT(u,i.preference);for(var g=0;g<a;g++)u[g*a+g]=c;h=new Array(l);for(var m=0;m<l;m++)h[m]=0;v=new Array(l);for(var y=0;y<l;y++)v[y]=0;for(var b=new Array(a),S=new Array(a),N=new Array(a),E=0;E<a;E++)b[E]=0,S[E]=0,N[E]=0;for(var T=new Array(a*i.minIterations),k=0;k<T.length;k++)T[k]=0;var L;for(L=0;L<i.maxIterations;L++){for(var A=0;A<a;A++){for(var I=-1/0,M=-1/0,B=-1,D=0,H=0;H<a;H++)b[H]=h[A*a+H],D=v[A*a+H]+u[A*a+H],D>=I?(M=I,I=D,B=H):D>M&&(M=D);for(var U=0;U<a;U++)h[A*a+U]=(1-i.damping)*(u[A*a+U]-I)+i.damping*b[U];h[A*a+B]=(1-i.damping)*(u[A*a+B]-M)+i.damping*b[B]}for(var z=0;z<a;z++){for(var W=0,F=0;F<a;F++)b[F]=v[F*a+z],S[F]=Math.max(0,h[F*a+z]),W+=S[F];W-=S[z],S[z]=h[z*a+z],W+=S[z];for(var P=0;P<a;P++)v[P*a+z]=(1-i.damping)*Math.min(0,W-S[P])+i.damping*b[P];v[z*a+z]=(1-i.damping)*(W-S[z])+i.damping*b[z]}for(var j=0,G=0;G<a;G++){var $=v[G*a+G]+h[G*a+G]>0?1:0;T[L%i.minIterations*a+G]=$,j+=$}if(j>0&&(L>=i.minIterations-1||L==i.maxIterations-1)){for(var ee=0,ae=0;ae<a;ae++){N[ae]=0;for(var ie=0;ie<i.minIterations;ie++)N[ae]+=T[ie*a+ae];(N[ae]===0||N[ae]===i.minIterations)&&ee++}if(ee===a)break}}for(var K=zT(a,h,v),q=HT(a,u,K),Y={},X=0;X<K.length;X++)Y[K[X]]=[];for(var J=0;J<n.length;J++){var re=s[n[J].id()],ce=q[re];ce!=null&&Y[ce].push(n[J])}for(var de=new Array(K.length),Re=0;Re<K.length;Re++)de[Re]=r.collection(Y[K[Re]]);return de},UT={affinityPropagation:ex,ap:ex},WT=Mr({root:void 0,directed:!1}),VT={hierholzer:function(e){if(!At(e)){var r=arguments;e={root:r[0],directed:r[1]}}var n=WT(e),i=n.root,s=n.directed,o=this,a=!1,l,u,c;i&&(c=ct(i)?this.filter(i)[0].id():i[0].id());var h={},v={};s?o.forEach(function(y){var b=y.id();if(y.isNode()){var S=y.indegree(!0),N=y.outdegree(!0),E=S-N,T=N-S;E==1?l?a=!0:l=b:T==1?u?a=!0:u=b:(T>1||E>1)&&(a=!0),h[b]=[],y.outgoers().forEach(function(k){k.isEdge()&&h[b].push(k.id())})}else v[b]=[void 0,y.target().id()]}):o.forEach(function(y){var b=y.id();if(y.isNode()){var S=y.degree(!0);S%2&&(l?u?a=!0:u=b:l=b),h[b]=[],y.connectedEdges().forEach(function(N){return h[b].push(N.id())})}else v[b]=[y.source().id(),y.target().id()]});var d={found:!1,trail:void 0};if(a)return d;if(u&&l)if(s){if(c&&u!=c)return d;c=u}else{if(c&&u!=c&&l!=c)return d;c||(c=u)}else c||(c=o[0].id());var x=function(b){for(var S=b,N=[b],E,T,k;h[S].length;)E=h[S].shift(),T=v[E][0],k=v[E][1],S!=k?(h[k]=h[k].filter(function(L){return L!=E}),S=k):!s&&S!=T&&(h[T]=h[T].filter(function(L){return L!=E}),S=T),N.unshift(E),N.unshift(S);return N},w=[],g=[];for(g=x(c);g.length!=1;)h[g[0]].length==0?(w.unshift(o.getElementById(g.shift())),w.unshift(o.getElementById(g.shift()))):g=x(g.shift()).concat(g);w.unshift(o.getElementById(g.shift()));for(var m in h)if(h[m].length)return d;return d.found=!0,d.trail=this.spawn(w,!0),d}},Xu=function(){var e=this,r={},n=0,i=0,s=[],o=[],a={},l=function(v,d){for(var x=o.length-1,w=[],g=e.spawn();o[x].x!=v||o[x].y!=d;)w.push(o.pop().edge),x--;w.push(o.pop().edge),w.forEach(function(m){var y=m.connectedNodes().intersection(e);g.merge(m),y.forEach(function(b){var S=b.id(),N=b.connectedEdges().intersection(e);g.merge(b),r[S].cutVertex?g.merge(N.filter(function(E){return E.isLoop()})):g.merge(N)})}),s.push(g)},u=function(v,d,x){v===x&&(i+=1),r[d]={id:n,low:n++,cutVertex:!1};var w=e.getElementById(d).connectedEdges().intersection(e);if(w.size()===0)s.push(e.spawn(e.getElementById(d)));else{var g,m,y,b;w.forEach(function(S){g=S.source().id(),m=S.target().id(),y=g===d?m:g,y!==x&&(b=S.id(),a[b]||(a[b]=!0,o.push({x:d,y,edge:S})),y in r?r[d].low=Math.min(r[d].low,r[y].id):(u(v,y,d),r[d].low=Math.min(r[d].low,r[y].low),r[d].id<=r[y].low&&(r[d].cutVertex=!0,l(d,y))))})}};e.forEach(function(h){if(h.isNode()){var v=h.id();v in r||(i=0,u(v,v),r[v].cutVertex=i>1)}});var c=Object.keys(r).filter(function(h){return r[h].cutVertex}).map(function(h){return e.getElementById(h)});return{cut:e.spawn(c),components:s}},$T={hopcroftTarjanBiconnected:Xu,htbc:Xu,htb:Xu,hopcroftTarjanBiconnectedComponents:Xu},Ku=function(){var e=this,r={},n=0,i=[],s=[],o=e.spawn(e),a=function(u){s.push(u),r[u]={index:n,low:n++,explored:!1};var c=e.getElementById(u).connectedEdges().intersection(e);if(c.forEach(function(w){var g=w.target().id();g!==u&&(g in r||a(g),r[g].explored||(r[u].low=Math.min(r[u].low,r[g].low)))}),r[u].index===r[u].low){for(var h=e.spawn();;){var v=s.pop();if(h.merge(e.getElementById(v)),r[v].low=r[u].index,r[v].explored=!0,v===u)break}var d=h.edgesWith(h),x=h.merge(d);i.push(x),o=o.difference(x)}};return e.forEach(function(l){if(l.isNode()){var u=l.id();u in r||a(u)}}),{cut:o,components:i}},GT={tarjanStronglyConnected:Ku,tsc:Ku,tscc:Ku,tarjanStronglyConnectedComponents:Ku},Bw={};[dl,_3,S3,E3,T3,R3,A3,aT,js,Fs,dv,yT,DT,IT,UT,VT,$T,GT].forEach(function(t){pt(Bw,t)});/*!
49
- Embeddable Minimum Strictly-Compliant Promises/A+ 1.1.1 Thenable
50
- Copyright (c) 2013-2014 Ralf S. Engelschall (http://engelschall.com)
51
- Licensed under The MIT License (http://opensource.org/licenses/MIT)
52
- */var jw=0,Fw=1,zw=2,Un=function(e){if(!(this instanceof Un))return new Un(e);this.id="Thenable/1.0.7",this.state=jw,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))};Un.prototype={fulfill:function(e){return tx(this,Fw,"fulfillValue",e)},reject:function(e){return tx(this,zw,"rejectReason",e)},then:function(e,r){var n=this,i=new Un;return n.onFulfilled.push(nx(e,i,"fulfill")),n.onRejected.push(nx(r,i,"reject")),Hw(n),i.proxy}};var tx=function(e,r,n,i){return e.state===jw&&(e.state=r,e[n]=i,Hw(e)),e},Hw=function(e){e.state===Fw?rx(e,"onFulfilled",e.fulfillValue):e.state===zw&&rx(e,"onRejected",e.rejectReason)},rx=function(e,r,n){if(e[r].length!==0){var i=e[r];e[r]=[];var s=function(){for(var a=0;a<i.length;a++)i[a](n)};typeof setImmediate=="function"?setImmediate(s):setTimeout(s,0)}},nx=function(e,r,n){return function(i){if(typeof e!="function")r[n].call(r,i);else{var s;try{s=e(i)}catch(o){r.reject(o);return}Uw(r,s)}}},Uw=function(e,r){if(e===r||e.proxy===r){e.reject(new TypeError("cannot resolve promise with itself"));return}var n;if(br(r)==="object"&&r!==null||typeof r=="function")try{n=r.then}catch(s){e.reject(s);return}if(typeof n=="function"){var i=!1;try{n.call(r,function(s){i||(i=!0,s===r?e.reject(new TypeError("circular thenable chain")):Uw(e,s))},function(s){i||(i=!0,e.reject(s))})}catch(s){i||e.reject(s)}return}e.fulfill(r)};Un.all=function(t){return new Un(function(e,r){for(var n=new Array(t.length),i=0,s=function(l,u){n[l]=u,i++,i===t.length&&e(n)},o=0;o<t.length;o++)(function(a){var l=t[a],u=l!=null&&l.then!=null;if(u)l.then(function(h){s(a,h)},function(h){r(h)});else{var c=l;s(a,c)}})(o)})};Un.resolve=function(t){return new Un(function(e,r){e(t)})};Un.reject=function(t){return new Un(function(e,r){r(t)})};var Xs=typeof Promise<"u"?Promise:Un,gv=function(e,r,n){var i=qv(e),s=!i,o=this._private=pt({duration:1e3},r,n);if(o.target=e,o.style=o.style||o.css,o.started=!1,o.playing=!1,o.hooked=!1,o.applying=!1,o.progress=0,o.completes=[],o.frames=[],o.complete&&ir(o.complete)&&o.completes.push(o.complete),s){var a=e.position();o.startPosition=o.startPosition||{x:a.x,y:a.y},o.startStyle=o.startStyle||e.cy().style().getAnimationStartStyle(e,o.style)}if(i){var l=e.pan();o.startPan={x:l.x,y:l.y},o.startZoom=e.zoom()}this.length=1,this[0]=this},za=gv.prototype;pt(za,{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),yn(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(u,c){var h=e[u];h!=null&&(e[u]=e[c],e[c]=h)};if(n("zoom","startZoom"),n("pan","startPan"),n("position","startPosition"),e.style)for(var i=0;i<e.style.length;i++){var s=e.style[i],o=s.name,a=e.startStyle[o];e.startStyle[o]=s,e.style[i]=a}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 Xs(function(i,s){n.push(function(){i()})})}});za.complete=za.completed;za.run=za.play;za.running=za.playing;var qT={animated:function(){return function(){var r=this,n=r.length!==void 0,i=n?r:[r],s=this._private.cy||this;if(!s.styleEnabled())return!1;var o=i[0];if(o)return o._private.animation.current.length>0}},clearQueue:function(){return function(){var r=this,n=r.length!==void 0,i=n?r:[r],s=this._private.cy||this;if(!s.styleEnabled())return this;for(var o=0;o<i.length;o++){var a=i[o];a._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,s=i.length!==void 0,o=s?i:[i],a=this._private.cy||this,l=!s,u=!l;if(!a.styleEnabled())return this;var c=a.style();r=pt({},r,n);var h=Object.keys(r).length===0;if(h)return new gv(o[0],r);switch(r.duration===void 0&&(r.duration=400),r.duration){case"slow":r.duration=600;break;case"fast":r.duration=200;break}if(u&&(r.style=c.getPropsList(r.style||r.css),r.css=void 0),u&&r.renderedPosition!=null){var v=r.renderedPosition,d=a.pan(),x=a.zoom();r.position=Tw(v,x,d)}if(l&&r.panBy!=null){var w=r.panBy,g=a.pan();r.pan={x:g.x+w.x,y:g.y+w.y}}var m=r.center||r.centre;if(l&&m!=null){var y=a.getCenterPan(m.eles,r.zoom);y!=null&&(r.pan=y)}if(l&&r.fit!=null){var b=r.fit,S=a.getFitViewport(b.eles||b.boundingBox,b.padding);S!=null&&(r.pan=S.pan,r.zoom=S.zoom)}if(l&&At(r.zoom)){var N=a.getZoomedViewport(r.zoom);N!=null?(N.zoomed&&(r.zoom=N.zoom),N.panned&&(r.pan=N.pan)):r.zoom=null}return new gv(o[0],r)}},animate:function(){return function(r,n){var i=this,s=i.length!==void 0,o=s?i:[i],a=this._private.cy||this;if(!a.styleEnabled())return this;n&&(r=pt({},r,n));for(var l=0;l<o.length;l++){var u=o[l],c=u.animated()&&(r.queue===void 0||r.queue),h=u.animation(r,c?{queue:!0}:void 0);h.play()}return this}},stop:function(){return function(r,n){var i=this,s=i.length!==void 0,o=s?i:[i],a=this._private.cy||this;if(!a.styleEnabled())return this;for(var l=0;l<o.length;l++){for(var u=o[l],c=u._private,h=c.animation.current,v=0;v<h.length;v++){var d=h[v],x=d._private;n&&(x.duration=0)}r&&(c.animation.queue=[]),n||(c.animation.current=[])}return a.notify("draw"),this}}},Rd,ix;function Kc(){if(ix)return Rd;ix=1;var t=Array.isArray;return Rd=t,Rd}var Ld,ax;function YT(){if(ax)return Ld;ax=1;var t=Kc(),e=Tl(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n=/^\w*$/;function i(s,o){if(t(s))return!1;var a=typeof s;return a=="number"||a=="symbol"||a=="boolean"||s==null||e(s)?!0:n.test(s)||!r.test(s)||o!=null&&s in Object(o)}return Ld=i,Ld}var Dd,sx;function XT(){if(sx)return Dd;sx=1;var t=yw(),e=kl(),r="[object AsyncFunction]",n="[object Function]",i="[object GeneratorFunction]",s="[object Proxy]";function o(a){if(!e(a))return!1;var l=t(a);return l==n||l==i||l==r||l==s}return Dd=o,Dd}var Ad,ox;function KT(){if(ox)return Ad;ox=1;var t=Gc(),e=t["__core-js_shared__"];return Ad=e,Ad}var Md,lx;function QT(){if(lx)return Md;lx=1;var t=KT(),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 Md=r,Md}var Pd,ux;function ZT(){if(ux)return Pd;ux=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 Pd=r,Pd}var Id,cx;function JT(){if(cx)return Id;cx=1;var t=XT(),e=QT(),r=kl(),n=ZT(),i=/[\\^$.*+?()[\]{}|]/g,s=/^\[object .+?Constructor\]$/,o=Function.prototype,a=Object.prototype,l=o.toString,u=a.hasOwnProperty,c=RegExp("^"+l.call(u).replace(i,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function h(v){if(!r(v)||e(v))return!1;var d=t(v)?c:s;return d.test(n(v))}return Id=h,Id}var Od,hx;function eN(){if(hx)return Od;hx=1;function t(e,r){return e==null?void 0:e[r]}return Od=t,Od}var Bd,fx;function ig(){if(fx)return Bd;fx=1;var t=JT(),e=eN();function r(n,i){var s=e(n,i);return t(s)?s:void 0}return Bd=r,Bd}var jd,dx;function Qc(){if(dx)return jd;dx=1;var t=ig(),e=t(Object,"create");return jd=e,jd}var Fd,px;function tN(){if(px)return Fd;px=1;var t=Qc();function e(){this.__data__=t?t(null):{},this.size=0}return Fd=e,Fd}var zd,vx;function rN(){if(vx)return zd;vx=1;function t(e){var r=this.has(e)&&delete this.__data__[e];return this.size-=r?1:0,r}return zd=t,zd}var Hd,gx;function nN(){if(gx)return Hd;gx=1;var t=Qc(),e="__lodash_hash_undefined__",r=Object.prototype,n=r.hasOwnProperty;function i(s){var o=this.__data__;if(t){var a=o[s];return a===e?void 0:a}return n.call(o,s)?o[s]:void 0}return Hd=i,Hd}var Ud,mx;function iN(){if(mx)return Ud;mx=1;var t=Qc(),e=Object.prototype,r=e.hasOwnProperty;function n(i){var s=this.__data__;return t?s[i]!==void 0:r.call(s,i)}return Ud=n,Ud}var Wd,yx;function aN(){if(yx)return Wd;yx=1;var t=Qc(),e="__lodash_hash_undefined__";function r(n,i){var s=this.__data__;return this.size+=this.has(n)?0:1,s[n]=t&&i===void 0?e:i,this}return Wd=r,Wd}var Vd,xx;function sN(){if(xx)return Vd;xx=1;var t=tN(),e=rN(),r=nN(),n=iN(),i=aN();function s(o){var a=-1,l=o==null?0:o.length;for(this.clear();++a<l;){var u=o[a];this.set(u[0],u[1])}}return s.prototype.clear=t,s.prototype.delete=e,s.prototype.get=r,s.prototype.has=n,s.prototype.set=i,Vd=s,Vd}var $d,bx;function oN(){if(bx)return $d;bx=1;function t(){this.__data__=[],this.size=0}return $d=t,$d}var Gd,wx;function Ww(){if(wx)return Gd;wx=1;function t(e,r){return e===r||e!==e&&r!==r}return Gd=t,Gd}var qd,_x;function Zc(){if(_x)return qd;_x=1;var t=Ww();function e(r,n){for(var i=r.length;i--;)if(t(r[i][0],n))return i;return-1}return qd=e,qd}var Yd,Sx;function lN(){if(Sx)return Yd;Sx=1;var t=Zc(),e=Array.prototype,r=e.splice;function n(i){var s=this.__data__,o=t(s,i);if(o<0)return!1;var a=s.length-1;return o==a?s.pop():r.call(s,o,1),--this.size,!0}return Yd=n,Yd}var Xd,Cx;function uN(){if(Cx)return Xd;Cx=1;var t=Zc();function e(r){var n=this.__data__,i=t(n,r);return i<0?void 0:n[i][1]}return Xd=e,Xd}var Kd,Ex;function cN(){if(Ex)return Kd;Ex=1;var t=Zc();function e(r){return t(this.__data__,r)>-1}return Kd=e,Kd}var Qd,kx;function hN(){if(kx)return Qd;kx=1;var t=Zc();function e(r,n){var i=this.__data__,s=t(i,r);return s<0?(++this.size,i.push([r,n])):i[s][1]=n,this}return Qd=e,Qd}var Zd,Tx;function fN(){if(Tx)return Zd;Tx=1;var t=oN(),e=lN(),r=uN(),n=cN(),i=hN();function s(o){var a=-1,l=o==null?0:o.length;for(this.clear();++a<l;){var u=o[a];this.set(u[0],u[1])}}return s.prototype.clear=t,s.prototype.delete=e,s.prototype.get=r,s.prototype.has=n,s.prototype.set=i,Zd=s,Zd}var Jd,Nx;function dN(){if(Nx)return Jd;Nx=1;var t=ig(),e=Gc(),r=t(e,"Map");return Jd=r,Jd}var ep,Rx;function pN(){if(Rx)return ep;Rx=1;var t=sN(),e=fN(),r=dN();function n(){this.size=0,this.__data__={hash:new t,map:new(r||e),string:new t}}return ep=n,ep}var tp,Lx;function vN(){if(Lx)return tp;Lx=1;function t(e){var r=typeof e;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?e!=="__proto__":e===null}return tp=t,tp}var rp,Dx;function Jc(){if(Dx)return rp;Dx=1;var t=vN();function e(r,n){var i=r.__data__;return t(n)?i[typeof n=="string"?"string":"hash"]:i.map}return rp=e,rp}var np,Ax;function gN(){if(Ax)return np;Ax=1;var t=Jc();function e(r){var n=t(this,r).delete(r);return this.size-=n?1:0,n}return np=e,np}var ip,Mx;function mN(){if(Mx)return ip;Mx=1;var t=Jc();function e(r){return t(this,r).get(r)}return ip=e,ip}var ap,Px;function yN(){if(Px)return ap;Px=1;var t=Jc();function e(r){return t(this,r).has(r)}return ap=e,ap}var sp,Ix;function xN(){if(Ix)return sp;Ix=1;var t=Jc();function e(r,n){var i=t(this,r),s=i.size;return i.set(r,n),this.size+=i.size==s?0:1,this}return sp=e,sp}var op,Ox;function bN(){if(Ox)return op;Ox=1;var t=pN(),e=gN(),r=mN(),n=yN(),i=xN();function s(o){var a=-1,l=o==null?0:o.length;for(this.clear();++a<l;){var u=o[a];this.set(u[0],u[1])}}return s.prototype.clear=t,s.prototype.delete=e,s.prototype.get=r,s.prototype.has=n,s.prototype.set=i,op=s,op}var lp,Bx;function wN(){if(Bx)return lp;Bx=1;var t=bN(),e="Expected a function";function r(n,i){if(typeof n!="function"||i!=null&&typeof i!="function")throw new TypeError(e);var s=function(){var o=arguments,a=i?i.apply(this,o):o[0],l=s.cache;if(l.has(a))return l.get(a);var u=n.apply(this,o);return s.cache=l.set(a,u)||l,u};return s.cache=new(r.Cache||t),s}return r.Cache=t,lp=r,lp}var up,jx;function _N(){if(jx)return up;jx=1;var t=wN(),e=500;function r(n){var i=t(n,function(o){return s.size===e&&s.clear(),o}),s=i.cache;return i}return up=r,up}var cp,Fx;function Vw(){if(Fx)return cp;Fx=1;var t=_N(),e=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,r=/\\(\\)?/g,n=t(function(i){var s=[];return i.charCodeAt(0)===46&&s.push(""),i.replace(e,function(o,a,l,u){s.push(l?u.replace(r,"$1"):a||o)}),s});return cp=n,cp}var hp,zx;function $w(){if(zx)return hp;zx=1;function t(e,r){for(var n=-1,i=e==null?0:e.length,s=Array(i);++n<i;)s[n]=r(e[n],n,e);return s}return hp=t,hp}var fp,Hx;function SN(){if(Hx)return fp;Hx=1;var t=Xv(),e=$w(),r=Kc(),n=Tl(),i=t?t.prototype:void 0,s=i?i.toString:void 0;function o(a){if(typeof a=="string")return a;if(r(a))return e(a,o)+"";if(n(a))return s?s.call(a):"";var l=a+"";return l=="0"&&1/a==-1/0?"-0":l}return fp=o,fp}var dp,Ux;function Gw(){if(Ux)return dp;Ux=1;var t=SN();function e(r){return r==null?"":t(r)}return dp=e,dp}var pp,Wx;function qw(){if(Wx)return pp;Wx=1;var t=Kc(),e=YT(),r=Vw(),n=Gw();function i(s,o){return t(s)?s:e(s,o)?[s]:r(n(s))}return pp=i,pp}var vp,Vx;function ag(){if(Vx)return vp;Vx=1;var t=Tl();function e(r){if(typeof r=="string"||t(r))return r;var n=r+"";return n=="0"&&1/r==-1/0?"-0":n}return vp=e,vp}var gp,$x;function CN(){if($x)return gp;$x=1;var t=qw(),e=ag();function r(n,i){i=t(i,n);for(var s=0,o=i.length;n!=null&&s<o;)n=n[e(i[s++])];return s&&s==o?n:void 0}return gp=r,gp}var mp,Gx;function EN(){if(Gx)return mp;Gx=1;var t=CN();function e(r,n,i){var s=r==null?void 0:t(r,n);return s===void 0?i:s}return mp=e,mp}var kN=EN(),TN=El(kN),yp,qx;function NN(){if(qx)return yp;qx=1;var t=ig(),e=(function(){try{var r=t(Object,"defineProperty");return r({},"",{}),r}catch{}})();return yp=e,yp}var xp,Yx;function RN(){if(Yx)return xp;Yx=1;var t=NN();function e(r,n,i){n=="__proto__"&&t?t(r,n,{configurable:!0,enumerable:!0,value:i,writable:!0}):r[n]=i}return xp=e,xp}var bp,Xx;function LN(){if(Xx)return bp;Xx=1;var t=RN(),e=Ww(),r=Object.prototype,n=r.hasOwnProperty;function i(s,o,a){var l=s[o];(!(n.call(s,o)&&e(l,a))||a===void 0&&!(o in s))&&t(s,o,a)}return bp=i,bp}var wp,Kx;function DN(){if(Kx)return wp;Kx=1;var t=9007199254740991,e=/^(?:0|[1-9]\d*)$/;function r(n,i){var s=typeof n;return i=i??t,!!i&&(s=="number"||s!="symbol"&&e.test(n))&&n>-1&&n%1==0&&n<i}return wp=r,wp}var _p,Qx;function AN(){if(Qx)return _p;Qx=1;var t=LN(),e=qw(),r=DN(),n=kl(),i=ag();function s(o,a,l,u){if(!n(o))return o;a=e(a,o);for(var c=-1,h=a.length,v=h-1,d=o;d!=null&&++c<h;){var x=i(a[c]),w=l;if(x==="__proto__"||x==="constructor"||x==="prototype")return o;if(c!=v){var g=d[x];w=u?u(g,x,d):void 0,w===void 0&&(w=n(g)?g:r(a[c+1])?[]:{})}t(d,x,w),d=d[x]}return o}return _p=s,_p}var Sp,Zx;function MN(){if(Zx)return Sp;Zx=1;var t=AN();function e(r,n,i){return r==null?r:t(r,n,i)}return Sp=e,Sp}var PN=MN(),IN=El(PN),Cp,Jx;function ON(){if(Jx)return Cp;Jx=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 Cp=t,Cp}var Ep,e1;function BN(){if(e1)return Ep;e1=1;var t=$w(),e=ON(),r=Kc(),n=Tl(),i=Vw(),s=ag(),o=Gw();function a(l){return r(l)?t(l,s):n(l)?[l]:e(i(o(l)))}return Ep=a,Ep}var jN=BN(),FN=El(jN),zN={data:function(e){var r={field:"data",bindingEvent:"data",allowBinding:!1,allowSetting:!1,allowGetting:!1,settingEvent:"data",settingTriggersEvent:!1,triggerFnName:"trigger",immutableKeys:{},updateStyle:!1,beforeGet:function(i){},beforeSet:function(i,s){},onSet:function(i){},canSet:function(i){return!0}};return e=pt({},r,e),function(i,s){var o=e,a=this,l=a.length!==void 0,u=l?a:[a],c=l?a[0]:a;if(ct(i)){var h=i.indexOf(".")!==-1,v=h&&FN(i);if(o.allowGetting&&s===void 0){var d;return c&&(o.beforeGet(c),v&&c._private[o.field][i]===void 0?d=TN(c._private[o.field],v):d=c._private[o.field][i]),d}else if(o.allowSetting&&s!==void 0){var x=!o.immutableKeys[i];if(x){var w=lw({},i,s);o.beforeSet(a,w);for(var g=0,m=u.length;g<m;g++){var y=u[g];o.canSet(y)&&(v&&c._private[o.field][i]===void 0?IN(y._private[o.field],v,s):y._private[o.field][i]=s)}o.updateStyle&&a.updateStyle(),o.onSet(a),o.settingTriggersEvent&&a[o.triggerFnName](o.settingEvent)}}}else if(o.allowSetting&&At(i)){var b=i,S,N,E=Object.keys(b);o.beforeSet(a,b);for(var T=0;T<E.length;T++){S=E[T],N=b[S];var k=!o.immutableKeys[S];if(k)for(var L=0;L<u.length;L++){var A=u[L];o.canSet(A)&&(A._private[o.field][S]=N)}}o.updateStyle&&a.updateStyle(),o.onSet(a),o.settingTriggersEvent&&a[o.triggerFnName](o.settingEvent)}else if(o.allowBinding&&ir(i)){var I=i;a.on(o.bindingEvent,I)}else if(o.allowGetting&&i===void 0){var M;return c&&(o.beforeGet(c),M=c._private[o.field]),M}return a}},removeData:function(e){var r={field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!1,immutableKeys:{}};return e=pt({},r,e),function(i){var s=e,o=this,a=o.length!==void 0,l=a?o:[o];if(ct(i)){for(var u=i.split(/\s+/),c=u.length,h=0;h<c;h++){var v=u[h];if(!Zi(v)){var d=!s.immutableKeys[v];if(d)for(var x=0,w=l.length;x<w;x++)l[x]._private[s.field][v]=void 0}}s.triggerEvent&&o[s.triggerFnName](s.event)}else if(i===void 0){for(var g=0,m=l.length;g<m;g++)for(var y=l[g]._private[s.field],b=Object.keys(y),S=0;S<b.length;S++){var N=b[S],E=!s.immutableKeys[N];E&&(y[N]=void 0)}s.triggerEvent&&o[s.triggerFnName](s.event)}return o}}},HN={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 s=this,o=Array.prototype.slice.call(arguments,0);return new Xs(function(a,l){var u=function(d){s.off.apply(s,h),a(d)},c=o.concat([u]),h=c.concat([]);s.on.apply(s,c)})}}},Bt={};[qT,zN,HN].forEach(function(t){pt(Bt,t)});var UN={animate:Bt.animate(),animation:Bt.animation(),animated:Bt.animated(),clearQueue:Bt.clearQueue(),delay:Bt.delay(),delayAnimation:Bt.delayAnimation(),stop:Bt.stop()},dc={classes:function(e){var r=this;if(e===void 0){var n=[];return r[0]._private.classes.forEach(function(x){return n.push(x)}),n}else Wt(e)||(e=(e||"").match(/\S+/g)||[]);for(var i=[],s=new Ys(e),o=0;o<r.length;o++){for(var a=r[o],l=a._private,u=l.classes,c=!1,h=0;h<e.length;h++){var v=e[h],d=u.has(v);if(!d){c=!0;break}}c||(c=u.size!==e.length),c&&(l.classes=s,i.push(a))}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){Wt(e)||(e=e.match(/\S+/g)||[]);for(var n=this,i=r===void 0,s=[],o=0,a=n.length;o<a;o++)for(var l=n[o],u=l._private.classes,c=!1,h=0;h<e.length;h++){var v=e[h],d=u.has(v),x=!1;r||i&&!d?(u.add(v),x=!0):(!r||i&&d)&&(u.delete(v),x=!0),!c&&x&&(s.push(l),c=!0)}return s.length>0&&this.spawn(s).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}};dc.className=dc.classNames=dc.classes;var Dt={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:`"(?:\\\\"|[^"])*"|'(?:\\\\'|[^'])*'`,number:xr,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};Dt.variable="(?:[\\w-.]|(?:\\\\"+Dt.metaChar+"))+";Dt.className="(?:[\\w-]|(?:\\\\"+Dt.metaChar+"))+";Dt.value=Dt.string+"|"+Dt.number;Dt.id=Dt.variable;(function(){var t,e,r;for(t=Dt.comparatorOp.split("|"),r=0;r<t.length;r++)e=t[r],Dt.comparatorOp+="|@"+e;for(t=Dt.comparatorOp.split("|"),r=0;r<t.length;r++)e=t[r],!(e.indexOf("!")>=0)&&e!=="="&&(Dt.comparatorOp+="|\\!"+e)})();var zt=function(){return{checks:[]}},rt={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},mv=[{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 zk(t.selector,e.selector)}),WN=(function(){for(var t={},e,r=0;r<mv.length;r++)e=mv[r],t[e.selector]=e.matches;return t})(),VN=function(e,r){return WN[e](r)},$N="("+mv.map(function(t){return t.selector}).join("|")+")",xs=function(e){return e.replace(new RegExp("\\\\("+Dt.metaChar+")","g"),function(r,n){return n})},Wi=function(e,r,n){e[e.length-1]=n},yv=[{name:"group",query:!0,regex:"("+Dt.group+")",populate:function(e,r,n){var i=vr(n,1),s=i[0];r.checks.push({type:rt.GROUP,value:s==="*"?s:s+"s"})}},{name:"state",query:!0,regex:$N,populate:function(e,r,n){var i=vr(n,1),s=i[0];r.checks.push({type:rt.STATE,value:s})}},{name:"id",query:!0,regex:"\\#("+Dt.id+")",populate:function(e,r,n){var i=vr(n,1),s=i[0];r.checks.push({type:rt.ID,value:xs(s)})}},{name:"className",query:!0,regex:"\\.("+Dt.className+")",populate:function(e,r,n){var i=vr(n,1),s=i[0];r.checks.push({type:rt.CLASS,value:xs(s)})}},{name:"dataExists",query:!0,regex:"\\[\\s*("+Dt.variable+")\\s*\\]",populate:function(e,r,n){var i=vr(n,1),s=i[0];r.checks.push({type:rt.DATA_EXIST,field:xs(s)})}},{name:"dataCompare",query:!0,regex:"\\[\\s*("+Dt.variable+")\\s*("+Dt.comparatorOp+")\\s*("+Dt.value+")\\s*\\]",populate:function(e,r,n){var i=vr(n,3),s=i[0],o=i[1],a=i[2],l=new RegExp("^"+Dt.string+"$").exec(a)!=null;l?a=a.substring(1,a.length-1):a=parseFloat(a),r.checks.push({type:rt.DATA_COMPARE,field:xs(s),operator:o,value:a})}},{name:"dataBool",query:!0,regex:"\\[\\s*("+Dt.boolOp+")\\s*("+Dt.variable+")\\s*\\]",populate:function(e,r,n){var i=vr(n,2),s=i[0],o=i[1];r.checks.push({type:rt.DATA_BOOL,field:xs(o),operator:s})}},{name:"metaCompare",query:!0,regex:"\\[\\[\\s*("+Dt.meta+")\\s*("+Dt.comparatorOp+")\\s*("+Dt.number+")\\s*\\]\\]",populate:function(e,r,n){var i=vr(n,3),s=i[0],o=i[1],a=i[2];r.checks.push({type:rt.META_COMPARE,field:xs(s),operator:o,value:parseFloat(a)})}},{name:"nextQuery",separator:!0,regex:Dt.separator,populate:function(e,r){var n=e.currentSubject,i=e.edgeCount,s=e.compoundCount,o=e[e.length-1];n!=null&&(o.subject=n,e.currentSubject=null),o.edgeCount=i,o.compoundCount=s,e.edgeCount=0,e.compoundCount=0;var a=e[e.length++]=zt();return a}},{name:"directedEdge",separator:!0,regex:Dt.directedEdge,populate:function(e,r){if(e.currentSubject==null){var n=zt(),i=r,s=zt();return n.checks.push({type:rt.DIRECTED_EDGE,source:i,target:s}),Wi(e,r,n),e.edgeCount++,s}else{var o=zt(),a=r,l=zt();return o.checks.push({type:rt.NODE_SOURCE,source:a,target:l}),Wi(e,r,o),e.edgeCount++,l}}},{name:"undirectedEdge",separator:!0,regex:Dt.undirectedEdge,populate:function(e,r){if(e.currentSubject==null){var n=zt(),i=r,s=zt();return n.checks.push({type:rt.UNDIRECTED_EDGE,nodes:[i,s]}),Wi(e,r,n),e.edgeCount++,s}else{var o=zt(),a=r,l=zt();return o.checks.push({type:rt.NODE_NEIGHBOR,node:a,neighbor:l}),Wi(e,r,o),l}}},{name:"child",separator:!0,regex:Dt.child,populate:function(e,r){if(e.currentSubject==null){var n=zt(),i=zt(),s=e[e.length-1];return n.checks.push({type:rt.CHILD,parent:s,child:i}),Wi(e,r,n),e.compoundCount++,i}else if(e.currentSubject===r){var o=zt(),a=e[e.length-1],l=zt(),u=zt(),c=zt(),h=zt();return o.checks.push({type:rt.COMPOUND_SPLIT,left:a,right:l,subject:u}),u.checks=r.checks,r.checks=[{type:rt.TRUE}],h.checks.push({type:rt.TRUE}),l.checks.push({type:rt.PARENT,parent:h,child:c}),Wi(e,a,o),e.currentSubject=u,e.compoundCount++,c}else{var v=zt(),d=zt(),x=[{type:rt.PARENT,parent:v,child:d}];return v.checks=r.checks,r.checks=x,e.compoundCount++,d}}},{name:"descendant",separator:!0,regex:Dt.descendant,populate:function(e,r){if(e.currentSubject==null){var n=zt(),i=zt(),s=e[e.length-1];return n.checks.push({type:rt.DESCENDANT,ancestor:s,descendant:i}),Wi(e,r,n),e.compoundCount++,i}else if(e.currentSubject===r){var o=zt(),a=e[e.length-1],l=zt(),u=zt(),c=zt(),h=zt();return o.checks.push({type:rt.COMPOUND_SPLIT,left:a,right:l,subject:u}),u.checks=r.checks,r.checks=[{type:rt.TRUE}],h.checks.push({type:rt.TRUE}),l.checks.push({type:rt.ANCESTOR,ancestor:h,descendant:c}),Wi(e,a,o),e.currentSubject=u,e.compoundCount++,c}else{var v=zt(),d=zt(),x=[{type:rt.ANCESTOR,ancestor:v,descendant:d}];return v.checks=r.checks,r.checks=x,e.compoundCount++,d}}},{name:"subject",modifier:!0,regex:Dt.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],s=i==null?null:i.type;s===rt.DIRECTED_EDGE?i.type=rt.NODE_TARGET:s===rt.UNDIRECTED_EDGE&&(i.type=rt.NODE_NEIGHBOR,i.node=i.nodes[1],i.neighbor=i.nodes[0],i.nodes=null)}}];yv.forEach(function(t){return t.regexObj=new RegExp("^"+t.regex)});var GN=function(e){for(var r,n,i,s=0;s<yv.length;s++){var o=yv[s],a=o.name,l=e.match(o.regexObj);if(l!=null){n=l,r=o,i=a;var u=l[0];e=e.substring(u.length);break}}return{expr:r,match:n,name:i,remaining:e}},qN=function(e){var r=e.match(/^\s+/);if(r){var n=r[0];e=e.substring(n.length)}return e},YN=function(e){var r=this,n=r.inputText=e,i=r[0]=zt();for(r.length=1,n=qN(n);;){var s=GN(n);if(s.expr==null)return jt("The selector `"+e+"`is invalid"),!1;var o=s.match.slice(1),a=s.expr.populate(r,i,o);if(a===!1)return!1;if(a!=null&&(i=a),n=s.remaining,n.match(/^\s*$/))break}var l=r[r.length-1];r.currentSubject!=null&&(l.subject=r.currentSubject),l.edgeCount=r.edgeCount,l.compoundCount=r.compoundCount;for(var u=0;u<r.length;u++){var c=r[u];if(c.compoundCount>0&&c.edgeCount>0)return jt("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(c.edgeCount>1)return jt("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;c.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},XN=function(){if(this.toStringCache!=null)return this.toStringCache;for(var e=function(c){return c??""},r=function(c){return ct(c)?'"'+c+'"':e(c)},n=function(c){return" "+c+" "},i=function(c,h){var v=c.type,d=c.value;switch(v){case rt.GROUP:{var x=e(d);return x.substring(0,x.length-1)}case rt.DATA_COMPARE:{var w=c.field,g=c.operator;return"["+w+n(e(g))+r(d)+"]"}case rt.DATA_BOOL:{var m=c.operator,y=c.field;return"["+e(m)+y+"]"}case rt.DATA_EXIST:{var b=c.field;return"["+b+"]"}case rt.META_COMPARE:{var S=c.operator,N=c.field;return"[["+N+n(e(S))+r(d)+"]]"}case rt.STATE:return d;case rt.ID:return"#"+d;case rt.CLASS:return"."+d;case rt.PARENT:case rt.CHILD:return s(c.parent,h)+n(">")+s(c.child,h);case rt.ANCESTOR:case rt.DESCENDANT:return s(c.ancestor,h)+" "+s(c.descendant,h);case rt.COMPOUND_SPLIT:{var E=s(c.left,h),T=s(c.subject,h),k=s(c.right,h);return E+(E.length>0?" ":"")+T+k}case rt.TRUE:return""}},s=function(c,h){return c.checks.reduce(function(v,d,x){return v+(h===c&&x===0?"$":"")+i(d,h)},"")},o="",a=0;a<this.length;a++){var l=this[a];o+=s(l,l.subject),this.length>1&&a<this.length-1&&(o+=", ")}return this.toStringCache=o,o},KN={parse:YN,toString:XN},Yw=function(e,r,n){var i,s=ct(e),o=Ke(e),a=ct(n),l,u,c=!1,h=!1,v=!1;switch(r.indexOf("!")>=0&&(r=r.replace("!",""),h=!0),r.indexOf("@")>=0&&(r=r.replace("@",""),c=!0),(s||a||c)&&(l=!s&&!o?"":""+e,u=""+n),c&&(e=l=l.toLowerCase(),n=u=u.toLowerCase()),r){case"*=":i=l.indexOf(u)>=0;break;case"$=":i=l.indexOf(u,l.length-u.length)>=0;break;case"^=":i=l.indexOf(u)===0;break;case"=":i=e===n;break;case">":v=!0,i=e>n;break;case">=":v=!0,i=e>=n;break;case"<":v=!0,i=e<n;break;case"<=":v=!0,i=e<=n;break;default:i=!1;break}return h&&(e!=null||!v)&&(i=!i),i},QN=function(e,r){switch(r){case"?":return!!e;case"!":return!e;case"^":return e===void 0}},ZN=function(e){return e!==void 0},sg=function(e,r){return e.data(r)},JN=function(e,r){return e[r]()},or=[],Kt=function(e,r){return e.checks.every(function(n){return or[n.type](n,r)})};or[rt.GROUP]=function(t,e){var r=t.value;return r==="*"||r===e.group()};or[rt.STATE]=function(t,e){var r=t.value;return VN(r,e)};or[rt.ID]=function(t,e){var r=t.value;return e.id()===r};or[rt.CLASS]=function(t,e){var r=t.value;return e.hasClass(r)};or[rt.META_COMPARE]=function(t,e){var r=t.field,n=t.operator,i=t.value;return Yw(JN(e,r),n,i)};or[rt.DATA_COMPARE]=function(t,e){var r=t.field,n=t.operator,i=t.value;return Yw(sg(e,r),n,i)};or[rt.DATA_BOOL]=function(t,e){var r=t.field,n=t.operator;return QN(sg(e,r),n)};or[rt.DATA_EXIST]=function(t,e){var r=t.field;return t.operator,ZN(sg(e,r))};or[rt.UNDIRECTED_EDGE]=function(t,e){var r=t.nodes[0],n=t.nodes[1],i=e.source(),s=e.target();return Kt(r,i)&&Kt(n,s)||Kt(n,i)&&Kt(r,s)};or[rt.NODE_NEIGHBOR]=function(t,e){return Kt(t.node,e)&&e.neighborhood().some(function(r){return r.isNode()&&Kt(t.neighbor,r)})};or[rt.DIRECTED_EDGE]=function(t,e){return Kt(t.source,e.source())&&Kt(t.target,e.target())};or[rt.NODE_SOURCE]=function(t,e){return Kt(t.source,e)&&e.outgoers().some(function(r){return r.isNode()&&Kt(t.target,r)})};or[rt.NODE_TARGET]=function(t,e){return Kt(t.target,e)&&e.incomers().some(function(r){return r.isNode()&&Kt(t.source,r)})};or[rt.CHILD]=function(t,e){return Kt(t.child,e)&&Kt(t.parent,e.parent())};or[rt.PARENT]=function(t,e){return Kt(t.parent,e)&&e.children().some(function(r){return Kt(t.child,r)})};or[rt.DESCENDANT]=function(t,e){return Kt(t.descendant,e)&&e.ancestors().some(function(r){return Kt(t.ancestor,r)})};or[rt.ANCESTOR]=function(t,e){return Kt(t.ancestor,e)&&e.descendants().some(function(r){return Kt(t.descendant,r)})};or[rt.COMPOUND_SPLIT]=function(t,e){return Kt(t.subject,e)&&Kt(t.left,e)&&Kt(t.right,e)};or[rt.TRUE]=function(){return!0};or[rt.COLLECTION]=function(t,e){var r=t.value;return r.has(e)};or[rt.FILTER]=function(t,e){var r=t.value;return r(e)};var eR=function(e){var r=this;if(r.length===1&&r[0].checks.length===1&&r[0].checks[0].type===rt.ID)return e.getElementById(r[0].checks[0].value).collection();var n=function(s){for(var o=0;o<r.length;o++){var a=r[o];if(Kt(a,s))return!0}return!1};return r.text()==null&&(n=function(){return!0}),e.filter(n)},tR=function(e){for(var r=this,n=0;n<r.length;n++){var i=r[n];if(Kt(i,e))return!0}return!1},rR={matches:tR,filter:eR},ta=function(e){this.inputText=e,this.currentSubject=null,this.compoundCount=0,this.edgeCount=0,this.length=0,e==null||ct(e)&&e.match(/^\s*$/)||(yn(e)?this.addQuery({checks:[{type:rt.COLLECTION,value:e.collection()}]}):ir(e)?this.addQuery({checks:[{type:rt.FILTER,value:e}]}):ct(e)?this.parse(e)||(this.invalid=!0):er("A selector must be created from a string; found "))},ra=ta.prototype;[KN,rR].forEach(function(t){return pt(ra,t)});ra.text=function(){return this.inputText};ra.size=function(){return this.length};ra.eq=function(t){return this[t]};ra.sameText=function(t){return!this.invalid&&!t.invalid&&this.text()===t.text()};ra.addQuery=function(t){this[this.length++]=t};ra.selector=ra.toString;var Ki={allAre:function(e){var r=new ta(e);return this.every(function(n){return r.matches(n)})},is:function(e){var r=new ta(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())})}};Ki.allAreNeighbours=Ki.allAreNeighbors;Ki.has=Ki.contains;Ki.equal=Ki.equals=Ki.same;var Ln=function(e,r){return function(i,s,o,a){var l=i,u=this,c;if(l==null?c="":yn(l)&&l.length===1&&(c=l.id()),u.length===1&&c){var h=u[0]._private,v=h.traversalCache=h.traversalCache||{},d=v[r]=v[r]||[],x=ja(c),w=d[x];return w||(d[x]=e.call(u,i,s,o,a))}else return e.call(u,i,s,o,a)}},Ws={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 s=this[i],o=s._private.parent;o&&r.push(o)}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 s=n[i];r.push(s)}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],s=i.parents();r=r||s,r=r.intersect(s)}return r.filter(e)},orphans:function(e){return this.stdFilter(function(r){return r.isOrphan()}).filter(e)},nonorphans:function(e){return this.stdFilter(function(r){return r.isChild()}).filter(e)},children:Ln(function(t){for(var e=[],r=0;r<this.length;r++)for(var n=this[r],i=n._private.children,s=0;s<i.length;s++)e.push(i[s]);return this.spawn(e,!0).filter(t)},"children"),siblings:function(e){return this.parent().children().not(this).filter(e)},isParent:function(){var e=this[0];if(e)return e.isNode()&&e._private.children.length!==0},isChildless:function(){var e=this[0];if(e)return e.isNode()&&e._private.children.length===0},isChild:function(){var e=this[0];if(e)return e.isNode()&&e._private.parent!=null},isOrphan:function(){var e=this[0];if(e)return e.isNode()&&e._private.parent==null},descendants:function(e){var r=[];function n(i){for(var s=0;s<i.length;s++){var o=i[s];r.push(o),o.children().nonempty()&&n(o.children())}}return n(this.children()),this.spawn(r,!0).filter(e)}};function og(t,e,r,n){for(var i=[],s=new Ys,o=t.cy(),a=o.hasCompoundNodes(),l=0;l<t.length;l++){var u=t[l];r?i.push(u):a&&n(i,s,u)}for(;i.length>0;){var c=i.shift();e(c),s.add(c.id()),a&&n(i,s,c)}return t}function Xw(t,e,r){if(r.isParent())for(var n=r._private.children,i=0;i<n.length;i++){var s=n[i];e.has(s.id())||t.push(s)}}Ws.forEachDown=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return og(this,t,e,Xw)};function Kw(t,e,r){if(r.isChild()){var n=r._private.parent;e.has(n.id())||t.push(n)}}Ws.forEachUp=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return og(this,t,e,Kw)};function nR(t,e,r){Kw(t,e,r),Xw(t,e,r)}Ws.forEachUpAndDown=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return og(this,t,e,nR)};Ws.ancestors=Ws.parents;var gl,Qw;gl=Qw={data:Bt.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:Bt.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:Bt.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Bt.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:Bt.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:Bt.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}};gl.attr=gl.data;gl.removeAttr=gl.removeData;var iR=Qw,eh={};function kp(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],s=i._private.edges,o=0;o<s.length;o++){var a=s[o];!e&&a.isLoop()||(n+=t(i,a))}return n}else return}}pt(eh,{degree:kp(function(t,e){return e.source().same(e.target())?2:1}),indegree:kp(function(t,e){return e.target().same(t)?1:0}),outdegree:kp(function(t,e){return e.source().same(t)?1:0})});function bs(t,e){return function(r){for(var n,i=this.nodes(),s=0;s<i.length;s++){var o=i[s],a=o[t](r);a!==void 0&&(n===void 0||e(a,n))&&(n=a)}return n}}pt(eh,{minDegree:bs("degree",function(t,e){return t<e}),maxDegree:bs("degree",function(t,e){return t>e}),minIndegree:bs("indegree",function(t,e){return t<e}),maxIndegree:bs("indegree",function(t,e){return t>e}),minOutdegree:bs("outdegree",function(t,e){return t<e}),maxOutdegree:bs("outdegree",function(t,e){return t>e})});pt(eh,{totalDegree:function(e){for(var r=0,n=this.nodes(),i=0;i<n.length;i++)r+=n[i].degree(e);return r}});var zn,Zw,Jw=function(e,r,n){for(var i=0;i<e.length;i++){var s=e[i];if(!s.locked()){var o=s._private.position,a={x:r.x!=null?r.x-o.x:0,y:r.y!=null?r.y-o.y:0};s.isParent()&&!(a.x===0&&a.y===0)&&s.children().shift(a,n),s.dirtyBoundingBoxCache()}}},t1={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){Jw(e,r,!1)},onSet:function(e){e.dirtyCompoundBoundsCache()},canSet:function(e){return!e.locked()}};zn=Zw={position:Bt.data(t1),silentPosition:Bt.data(pt({},t1,{allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!1,beforeSet:function(e,r){Jw(e,r,!0)},onSet:function(e){e.dirtyCompoundBoundsCache()}})),positions:function(e,r){if(At(e))r?this.silentPosition(e):this.position(e);else if(ir(e)){var n=e,i=this.cy();i.startBatch();for(var s=0;s<this.length;s++){var o=this[s],a=void 0;(a=n(o,s))&&(r?o.silentPosition(a):o.position(a))}i.endBatch()}return this},silentPositions:function(e){return this.positions(e,!0)},shift:function(e,r,n){var i;if(At(e)?(i={x:Ke(e.x)?e.x:0,y:Ke(e.y)?e.y:0},n=r):ct(e)&&Ke(r)&&(i={x:0,y:0},i[e]=r),i!=null){var s=this.cy();s.startBatch();for(var o=0;o<this.length;o++){var a=this[o];if(!(s.hasCompoundNodes()&&a.isChild()&&a.ancestors().anySame(this))){var l=a.position(),u={x:l.x+i.x,y:l.y+i.y};n?a.silentPosition(u):a.position(u)}}s.endBatch()}return this},silentShift:function(e,r){return At(e)?this.shift(e,!0):ct(e)&&Ke(r)&&this.shift(e,r,!0),this},renderedPosition:function(e,r){var n=this[0],i=this.cy(),s=i.zoom(),o=i.pan(),a=At(e)?e:void 0,l=a!==void 0||r!==void 0&&ct(e);if(n&&n.isNode())if(l)for(var u=0;u<this.length;u++){var c=this[u];r!==void 0?c.position(e,(r-o[e])/s):a!==void 0&&c.position(Tw(a,s,o))}else{var h=n.position();return a=Yc(h,s,o),e===void 0?a:a[e]}else if(!l)return;return this},relativePosition:function(e,r){var n=this[0],i=this.cy(),s=At(e)?e:void 0,o=s!==void 0||r!==void 0&&ct(e),a=i.hasCompoundNodes();if(n&&n.isNode())if(o)for(var l=0;l<this.length;l++){var u=this[l],c=a?u.parent():null,h=c&&c.length>0,v=h;h&&(c=c[0]);var d=v?c.position():{x:0,y:0};r!==void 0?u.position(e,r+d[e]):s!==void 0&&u.position({x:s.x+d.x,y:s.y+d.y})}else{var x=n.position(),w=a?n.parent():null,g=w&&w.length>0,m=g;g&&(w=w[0]);var y=m?w.position():{x:0,y:0};return s={x:x.x-y.x,y:x.y-y.y},e===void 0?s:s[e]}else if(!o)return;return this}};zn.modelPosition=zn.point=zn.position;zn.modelPositions=zn.points=zn.positions;zn.renderedPoint=zn.renderedPosition;zn.relativePoint=zn.relativePosition;var aR=Zw,Vs=function(e){switch(e){case"left":case"right-inside":return"left";case"right":case"left-inside":return"right";default:return"center"}},$s=function(e){switch(e){case"top":case"bottom-inside":return"top";case"bottom":case"top-inside":return"bottom";default:return"center"}},sR=function(e){switch(e){case"left":return"right";case"right":return"left";case"left-inside":return"left";case"right-inside":return"right";default:return"center"}},zs,oa;zs=oa={};oa.renderedBoundingBox=function(t){var e=this.boundingBox(t),r=this.cy(),n=r.zoom(),i=r.pan(),s=e.x1*n+i.x,o=e.x2*n+i.x,a=e.y1*n+i.y,l=e.y2*n+i.y;return{x1:s,x2:o,y1:a,y2:l,w:o-s,h:l-a}};oa.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)};oa.updateCompoundBounds=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,e=this.cy();if(!e.styleEnabled()||!e.hasCompoundNodes())return this;if(!t&&e.batching())return this;function r(o){if(!o.isParent())return;var a=o._private,l=o.children(),u=o.pstyle("compound-sizing-wrt-labels").value==="include",c={width:{val:o.pstyle("min-width").pfValue,left:o.pstyle("min-width-bias-left"),right:o.pstyle("min-width-bias-right")},height:{val:o.pstyle("min-height").pfValue,top:o.pstyle("min-height-bias-top"),bottom:o.pstyle("min-height-bias-bottom")}},h=l.boundingBox({includeLabels:u,includeOverlays:!1,useCache:!1}),v=a.position;(h.w===0||h.h===0)&&(h={w:o.pstyle("width").pfValue,h:o.pstyle("height").pfValue},h.x1=v.x-h.w/2,h.x2=v.x+h.w/2,h.y1=v.y-h.h/2,h.y2=v.y+h.h/2);function d(L,A,I){var M=0,B=0,D=A+I;return L>0&&D>0&&(M=A/D*L,B=I/D*L),{biasDiff:M,biasComplementDiff:B}}function x(L,A,I,M){if(I.units==="%")switch(M){case"width":return L>0?I.pfValue*L:0;case"height":return A>0?I.pfValue*A:0;case"average":return L>0&&A>0?I.pfValue*(L+A)/2:0;case"min":return L>0&&A>0?L>A?I.pfValue*A:I.pfValue*L:0;case"max":return L>0&&A>0?L>A?I.pfValue*L:I.pfValue*A:0;default:return 0}else return I.units==="px"?I.pfValue:0}var w=c.width.left.value;c.width.left.units==="px"&&c.width.val>0&&(w=w*100/c.width.val);var g=c.width.right.value;c.width.right.units==="px"&&c.width.val>0&&(g=g*100/c.width.val);var m=c.height.top.value;c.height.top.units==="px"&&c.height.val>0&&(m=m*100/c.height.val);var y=c.height.bottom.value;c.height.bottom.units==="px"&&c.height.val>0&&(y=y*100/c.height.val);var b=d(c.width.val-h.w,w,g),S=b.biasDiff,N=b.biasComplementDiff,E=d(c.height.val-h.h,m,y),T=E.biasDiff,k=E.biasComplementDiff;a.autoPadding=x(h.w,h.h,o.pstyle("padding"),o.pstyle("padding-relative-to").value),a.autoWidth=Math.max(h.w,c.width.val),v.x=(-S+h.x1+h.x2+N)/2,a.autoHeight=Math.max(h.h,c.height.val),v.y=(-T+h.y1+h.y2+k)/2}for(var n=0;n<this.length;n++){var i=this[n],s=i._private;(!s.compoundBoundsClean||t)&&(r(i),e.batching()||(s.compoundBoundsClean=!0))}return this};var Nn=function(e){return e===1/0||e===-1/0?0:e},Fn=function(e,r,n,i,s){i-r===0||s-n===0||r==null||n==null||i==null||s==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=s>e.y2?s:e.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1)},$i=function(e,r){return r==null?e:Fn(e,r.x1,r.y1,r.x2,r.y2)},Ho=function(e,r,n){return Xr(e,r,n)},Qu=function(e,r,n){if(!r.cy().headless()){var i=r._private,s=i.rstyle,o=s.arrowWidth/2,a=r.pstyle(n+"-arrow-shape").value,l,u;if(a!=="none"){n==="source"?(l=s.srcX,u=s.srcY):n==="target"?(l=s.tgtX,u=s.tgtY):(l=s.midX,u=s.midY);var c=i.arrowBounds=i.arrowBounds||{},h=c[n]=c[n]||{};h.x1=l-o,h.y1=u-o,h.x2=l+o,h.y2=u+o,h.w=h.x2-h.x1,h.h=h.y2-h.y1,hc(h,1),Fn(e,h.x1,h.y1,h.x2,h.y2)}}},Tp=function(e,r,n){if(!r.cy().headless()){var i;n?i=n+"-":i="";var s=r._private,o=s.rstyle,a=r.pstyle(i+"label").strValue;if(a){var l=r.pstyle("text-halign"),u=r.pstyle("text-valign"),c=Ho(o,"labelWidth",n),h=Ho(o,"labelHeight",n),v=Ho(o,"labelX",n),d=Ho(o,"labelY",n),x=r.pstyle(i+"text-margin-x").pfValue,w=r.pstyle(i+"text-margin-y").pfValue,g=r.isEdge(),m=r.pstyle(i+"text-rotation"),y=r.pstyle("text-outline-width").pfValue,b=r.pstyle("text-border-width").pfValue,S=b/2,N=r.pstyle("text-background-padding").pfValue,E=2,T=h,k=c,L=k/2,A=T/2,I,M,B,D;if(g)I=v-L,M=v+L,B=d-A,D=d+A;else{switch(Vs(l.value)){case"left":I=v-k,M=v;break;case"center":I=v-L,M=v+L;break;case"right":I=v,M=v+k;break}switch($s(u.value)){case"top":B=d-T,D=d;break;case"center":B=d-A,D=d+A;break;case"bottom":B=d,D=d+T;break}}var H=x-Math.max(y,S)-N-E,U=x+Math.max(y,S)+N+E,z=w-Math.max(y,S)-N-E,W=w+Math.max(y,S)+N+E;I+=H,M+=U,B+=z,D+=W;var F=n||"main",P=s.labelBounds,j=P[F]=P[F]||{};j.x1=I,j.y1=B,j.x2=M,j.y2=D,j.w=M-I,j.h=D-B,j.leftPad=H,j.rightPad=U,j.topPad=z,j.botPad=W;var G=g&&m.strValue==="autorotate",$=m.pfValue!=null&&m.pfValue!==0;if(G||$){var ee=G?Ho(s.rstyle,"labelAngle",n):m.pfValue,ae=Math.cos(ee),ie=Math.sin(ee),K=(I+M)/2,q=(B+D)/2;if(!g){switch(Vs(l.value)){case"left":K=M;break;case"right":K=I;break}switch($s(u.value)){case"top":q=D;break;case"bottom":q=B;break}}var Y=function(_e,ke){return _e=_e-K,ke=ke-q,{x:_e*ae-ke*ie+K,y:_e*ie+ke*ae+q}},X=Y(I,B),J=Y(I,D),re=Y(M,B),ce=Y(M,D);I=Math.min(X.x,J.x,re.x,ce.x),M=Math.max(X.x,J.x,re.x,ce.x),B=Math.min(X.y,J.y,re.y,ce.y),D=Math.max(X.y,J.y,re.y,ce.y)}var de=F+"Rot",Re=P[de]=P[de]||{};Re.x1=I,Re.y1=B,Re.x2=M,Re.y2=D,Re.w=M-I,Re.h=D-B,Fn(e,I,B,M,D),Fn(s.labelBounds.all,I,B,M,D)}return e}},r1=function(e,r){if(!r.cy().headless()){var n=r.pstyle("outline-opacity").value,i=r.pstyle("outline-width").value,s=r.pstyle("outline-offset").value,o=i+s;e_(e,r,n,o,"outside",o/2)}},e_=function(e,r,n,i,s,o){if(!(n===0||i<=0||s==="inside")){var a=r.cy(),l=a.renderer(),u=l.nodeShapes[l.getNodeShape(r)];if(u){var c=r.position(),h=c.x,v=c.y,d=r.width(),x=r.height();if(u.hasMiterBounds){s==="center"&&(i/=2);var w=u.miterBounds(h,v,d,x,i);$i(e,w)}else o!=null&&o>0&&fc(e,[o,o,o,o])}}},oR=function(e,r){if(!r.cy().headless()){var n=r.pstyle("border-opacity").value,i=r.pstyle("border-width").pfValue,s=r.pstyle("border-position").value;e_(e,r,n,i,s)}},lR=function(e,r){var n=e._private.cy,i=n.styleEnabled(),s=n.headless(),o=Qr(),a=e._private,l=e.isNode(),u=e.isEdge(),c,h,v,d,x,w,g=a.rstyle,m=l&&i?e.pstyle("bounds-expansion").pfValue:[0],y=function(Pe){return Pe.pstyle("display").value!=="none"},b=!i||y(e)&&(!u||y(e.source())&&y(e.target()));if(b){var S=0,N=0;i&&r.includeOverlays&&(S=e.pstyle("overlay-opacity").value,S!==0&&(N=e.pstyle("overlay-padding").value));var E=0,T=0;i&&r.includeUnderlays&&(E=e.pstyle("underlay-opacity").value,E!==0&&(T=e.pstyle("underlay-padding").value));var k=Math.max(N,T),L=0,A=0;if(i&&(L=e.pstyle("width").pfValue,A=L/2),l&&r.includeNodes){var I=e.position();x=I.x,w=I.y;var M=e.outerWidth(),B=M/2,D=e.outerHeight(),H=D/2;c=x-B,h=x+B,v=w-H,d=w+H,Fn(o,c,v,h,d),i&&r1(o,e),i&&r.includeOutlines&&!s&&r1(o,e),i&&oR(o,e)}else if(u&&r.includeEdges)if(i&&!s){var U=e.pstyle("curve-style").strValue;if(c=Math.min(g.srcX,g.midX,g.tgtX),h=Math.max(g.srcX,g.midX,g.tgtX),v=Math.min(g.srcY,g.midY,g.tgtY),d=Math.max(g.srcY,g.midY,g.tgtY),c-=A,h+=A,v-=A,d+=A,Fn(o,c,v,h,d),U==="haystack"){var z=g.haystackPts;if(z&&z.length===2){if(c=z[0].x,v=z[0].y,h=z[1].x,d=z[1].y,c>h){var W=c;c=h,h=W}if(v>d){var F=v;v=d,d=F}Fn(o,c-A,v-A,h+A,d+A)}}else if(U==="bezier"||U==="unbundled-bezier"||qi(U,"segments")||qi(U,"taxi")){var P;switch(U){case"bezier":case"unbundled-bezier":P=g.bezierPts;break;case"segments":case"taxi":case"round-segments":case"round-taxi":P=g.linePts;break}if(P!=null)for(var j=0;j<P.length;j++){var G=P[j];c=G.x-A,h=G.x+A,v=G.y-A,d=G.y+A,Fn(o,c,v,h,d)}}}else{var $=e.source(),ee=$.position(),ae=e.target(),ie=ae.position();if(c=ee.x,h=ie.x,v=ee.y,d=ie.y,c>h){var K=c;c=h,h=K}if(v>d){var q=v;v=d,d=q}c-=A,h+=A,v-=A,d+=A,Fn(o,c,v,h,d)}if(i&&r.includeEdges&&u&&(Qu(o,e,"mid-source"),Qu(o,e,"mid-target"),Qu(o,e,"source"),Qu(o,e,"target")),i){var Y=e.pstyle("ghost").value==="yes";if(Y){var X=e.pstyle("ghost-offset-x").pfValue,J=e.pstyle("ghost-offset-y").pfValue;Fn(o,o.x1+X,o.y1+J,o.x2+X,o.y2+J)}}var re=a.bodyBounds=a.bodyBounds||{};H0(re,o),fc(re,m),hc(re,1),i&&(c=o.x1,h=o.x2,v=o.y1,d=o.y2,Fn(o,c-k,v-k,h+k,d+k));var ce=a.overlayBounds=a.overlayBounds||{};H0(ce,o),fc(ce,m),hc(ce,1);var de=a.labelBounds=a.labelBounds||{};de.all!=null?U3(de.all):de.all=Qr(),i&&r.includeLabels&&(r.includeMainLabels&&Tp(o,e,null),u&&(r.includeSourceLabels&&Tp(o,e,"source"),r.includeTargetLabels&&Tp(o,e,"target")))}return o.x1=Nn(o.x1),o.y1=Nn(o.y1),o.x2=Nn(o.x2),o.y2=Nn(o.y2),o.w=Nn(o.x2-o.x1),o.h=Nn(o.y2-o.y1),o.w>0&&o.h>0&&b&&(fc(o,m),hc(o,1)),o},t_=function(e){var r=0,n=function(o){return(o?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},r_=function(e){var r=function(a){return Math.round(a)};if(e.isEdge()){var n=e.source().position(),i=e.target().position();return I0([r(n.x),r(n.y),r(i.x),r(i.y)])}else{var s=e.position();return I0([r(s.x),r(s.y)])}},n1=function(e,r){var n=e._private,i,s=e.isEdge(),o=r==null?i1:t_(r),a=o===i1;if(n.bbCache==null?(i=lR(e,ml),n.bbCache=i,n.bbCachePosKey=r_(e)):i=n.bbCache,!a){var l=e.isNode();i=Qr(),(r.includeNodes&&l||r.includeEdges&&!l)&&(r.includeOverlays?$i(i,n.overlayBounds):$i(i,n.bodyBounds)),r.includeLabels&&(r.includeMainLabels&&(!s||r.includeSourceLabels&&r.includeTargetLabels)?$i(i,n.labelBounds.all):(r.includeMainLabels&&$i(i,n.labelBounds.mainRot),r.includeSourceLabels&&$i(i,n.labelBounds.sourceRot),r.includeTargetLabels&&$i(i,n.labelBounds.targetRot))),i.w=i.x2-i.x1,i.h=i.y2-i.y1}return i},ml={includeNodes:!0,includeEdges:!0,includeLabels:!0,includeMainLabels:!0,includeSourceLabels:!0,includeTargetLabels:!0,includeOverlays:!0,includeUnderlays:!0,includeOutlines:!0,useCache:!0},i1=t_(ml),a1=Mr(ml);oa.boundingBox=function(t){var e,r=t===void 0||t.useCache===void 0||t.useCache===!0,n=Hs(function(c){var h=c._private;return h.bbCache==null||h.styleDirty||h.bbCachePosKey!==r_(c)},function(c){return c.id()});if(r&&this.length===1&&!n(this[0]))t===void 0?t=ml:t=a1(t),e=n1(this[0],t);else{e=Qr(),t=t||ml;var i=a1(t),s=this,o=s.cy(),a=o.styleEnabled();this.edges().forEach(n),this.nodes().forEach(n),a&&this.recalculateRenderedStyle(r),this.updateCompoundBounds(!r);for(var l=0;l<s.length;l++){var u=s[l];n(u)&&u.dirtyBoundingBoxCache(),$i(e,n1(u,i))}}return e.x1=Nn(e.x1),e.y1=Nn(e.y1),e.x2=Nn(e.x2),e.y2=Nn(e.y2),e.w=Nn(e.x2-e.x1),e.h=Nn(e.y2-e.y1),e};oa.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};oa.boundingBoxAt=function(t){var e=this.nodes(),r=this.cy(),n=r.hasCompoundNodes(),i=r.collection();if(n&&(i=e.filter(function(u){return u.isParent()}),e=e.not(i)),At(t)){var s=t;t=function(){return s}}var o=function(c,h){return c._private.bbAtOldPos=t(c,h)},a=function(c){return c._private.bbAtOldPos};r.startBatch(),e.forEach(o).silentPositions(t),n&&(i.dirtyCompoundBoundsCache(),i.dirtyBoundingBoxCache(),i.updateCompoundBounds(!0));var l=H3(this.boundingBox({useCache:!1}));return e.silentPositions(a),n&&(i.dirtyCompoundBoundsCache(),i.dirtyBoundingBoxCache(),i.updateCompoundBounds(!0)),r.endBatch(),l};zs.boundingbox=zs.bb=zs.boundingBox;zs.renderedBoundingbox=zs.renderedBoundingBox;var uR=oa,tl,Ll;tl=Ll={};var n_=function(e){e.uppercaseName=b0(e.name),e.autoName="auto"+e.uppercaseName,e.labelName="label"+e.uppercaseName,e.outerName="outer"+e.uppercaseName,e.uppercaseOuterName=b0(e.outerName),tl[e.name]=function(){var n=this[0],i=n._private,s=i.cy,o=s._private.styleEnabled;if(n)if(o){if(n.isParent())return n.updateCompoundBounds(),i[e.autoName]||0;var a=n.pstyle(e.name);switch(a.strValue){case"label":return n.recalculateRenderedStyle(),i.rstyle[e.labelName]||0;default:return a.pfValue}}else return 1},tl["outer"+e.uppercaseName]=function(){var n=this[0],i=n._private,s=i.cy,o=s._private.styleEnabled;if(n)if(o){var a=n[e.name](),l=n.pstyle("border-position").value,u;l==="center"?u=n.pstyle("border-width").pfValue:l==="outside"?u=2*n.pstyle("border-width").pfValue:u=0;var c=2*n.padding();return a+u+c}else return 1},tl["rendered"+e.uppercaseName]=function(){var n=this[0];if(n){var i=n[e.name]();return i*this.cy().zoom()}},tl["rendered"+e.uppercaseOuterName]=function(){var n=this[0];if(n){var i=n[e.outerName]();return i*this.cy().zoom()}}};n_({name:"width"});n_({name:"height"});Ll.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};Ll.paddedHeight=function(){var t=this[0];return t.height()+2*t.padding()};Ll.paddedWidth=function(){var t=this[0];return t.width()+2*t.padding()};var cR=Ll,hR=function(e,r){if(e.isEdge()&&e.takesUpSpace())return r(e)},fR=function(e,r){if(e.isEdge()&&e.takesUpSpace()){var n=e.cy();return Yc(r(e),n.zoom(),n.pan())}},dR=function(e,r){if(e.isEdge()&&e.takesUpSpace()){var n=e.cy(),i=n.pan(),s=n.zoom();return r(e).map(function(o){return Yc(o,s,i)})}},pR=function(e){return e.renderer().getControlPoints(e)},vR=function(e){return e.renderer().getSegmentPoints(e)},gR=function(e){return e.renderer().getSourceEndpoint(e)},mR=function(e){return e.renderer().getTargetEndpoint(e)},yR=function(e){return e.renderer().getEdgeMidpoint(e)},s1={controlPoints:{get:pR,mult:!0},segmentPoints:{get:vR,mult:!0},sourceEndpoint:{get:gR},targetEndpoint:{get:mR},midpoint:{get:yR}},xR=function(e){return"rendered"+e[0].toUpperCase()+e.substr(1)},bR=Object.keys(s1).reduce(function(t,e){var r=s1[e],n=xR(e);return t[e]=function(){return hR(this,r.get)},r.mult?t[n]=function(){return dR(this,r.get)}:t[n]=function(){return fR(this,r.get)},t},{}),wR=pt({},aR,uR,cR,bR);/*!
53
- Event object based on jQuery events, MIT license
54
-
55
- https://jquery.org/license/
56
- https://tldrlegal.com/license/mit-license
57
- https://github.com/jquery/jquery/blob/master/src/event.js
58
- */var i_=function(e,r){this.recycle(e,r)};function Uo(){return!1}function Zu(){return!0}i_.prototype={instanceString:function(){return"event"},recycle:function(e,r){if(this.isImmediatePropagationStopped=this.isPropagationStopped=this.isDefaultPrevented=Uo,e!=null&&e.preventDefault?(this.type=e.type,this.isDefaultPrevented=e.defaultPrevented?Zu:Uo):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(),s=this.cy.pan();this.renderedPosition={x:n.x*i+s.x,y:n.y*i+s.y}}this.timeStamp=e&&e.timeStamp||Date.now()},preventDefault:function(){this.isDefaultPrevented=Zu;var e=this.originalEvent;e&&e.preventDefault&&e.preventDefault()},stopPropagation:function(){this.isPropagationStopped=Zu;var e=this.originalEvent;e&&e.stopPropagation&&e.stopPropagation()},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=Zu,this.stopPropagation()},isDefaultPrevented:Uo,isPropagationStopped:Uo,isImmediatePropagationStopped:Uo};var a_=/^([^.]+)(\.(?:[^.]+))?$/,_R=".*",s_={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},o1=Object.keys(s_),SR={};function th(){for(var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:SR,e=arguments.length>1?arguments[1]:void 0,r=0;r<o1.length;r++){var n=o1[r];this[n]=t[n]||s_[n]}this.context=e||this.context,this.listeners=[],this.emitting=0}var na=th.prototype,o_=function(e,r,n,i,s,o,a){ir(i)&&(s=i,i=null),a&&(o==null?o=a:o=pt({},o,a));for(var l=Wt(n)?n:n.split(/\s+/),u=0;u<l.length;u++){var c=l[u];if(!Zi(c)){var h=c.match(a_);if(h){var v=h[1],d=h[2]?h[2]:null,x=r(e,c,v,d,i,s,o);if(x===!1)break}}}},l1=function(e,r){return e.addEventFields(e.context,r),new i_(r.type,r)},CR=function(e,r,n){if(Rk(n)){r(e,n);return}else if(At(n)){r(e,l1(e,n));return}for(var i=Wt(n)?n:n.split(/\s+/),s=0;s<i.length;s++){var o=i[s];if(!Zi(o)){var a=o.match(a_);if(a){var l=a[1],u=a[2]?a[2]:null,c=l1(e,{type:l,namespace:u,target:e.context});r(e,c)}}}};na.on=na.addListener=function(t,e,r,n,i){return o_(this,function(s,o,a,l,u,c,h){ir(c)&&s.listeners.push({event:o,callback:c,type:a,namespace:l,qualifier:u,conf:h})},t,e,r,n,i),this};na.one=function(t,e,r,n){return this.on(t,e,r,n,{one:!0})};na.removeListener=na.off=function(t,e,r,n){var i=this;this.emitting!==0&&(this.listeners=h3(this.listeners));for(var s=this.listeners,o=function(u){var c=s[u];o_(i,function(h,v,d,x,w,g){if((c.type===d||t==="*")&&(!x&&c.namespace!==".*"||c.namespace===x)&&(!w||h.qualifierCompare(c.qualifier,w))&&(!g||c.callback===g))return s.splice(u,1),!1},t,e,r,n)},a=s.length-1;a>=0;a--)o(a);return this};na.removeAllListeners=function(){return this.removeListener("*")};na.emit=na.trigger=function(t,e,r){var n=this.listeners,i=n.length;return this.emitting++,Wt(e)||(e=[e]),CR(this,function(s,o){r!=null&&(n=[{event:o.event,type:o.type,namespace:o.namespace,callback:r}],i=n.length);for(var a=function(){var c=n[l];if(c.type===o.type&&(!c.namespace||c.namespace===o.namespace||c.namespace===_R)&&s.eventMatches(s.context,c,o)){var h=[o];e!=null&&d3(h,e),s.beforeEmit(s.context,c,o),c.conf&&c.conf.one&&(s.listeners=s.listeners.filter(function(x){return x!==c}));var v=s.callbackContext(s.context,c,o),d=c.callback.apply(v,h);s.afterEmit(s.context,c,o),d===!1&&(o.stopPropagation(),o.preventDefault())}},l=0;l<i;l++)a();s.bubble(s.context)&&!o.isPropagationStopped()&&s.parent(s.context).emit(o,e)},t),this.emitting--,this};var ER={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&&Cl(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()}},Ju=function(e){return ct(e)?new ta(e):e},l_={createEmitter:function(){for(var e=0;e<this.length;e++){var r=this[e],n=r._private;n.emitter||(n.emitter=new th(ER,r))}return this},emitter:function(){return this._private.emitter},on:function(e,r,n){for(var i=Ju(r),s=0;s<this.length;s++){var o=this[s];o.emitter().on(e,i,n)}return this},removeListener:function(e,r,n){for(var i=Ju(r),s=0;s<this.length;s++){var o=this[s];o.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=Ju(r),s=0;s<this.length;s++){var o=this[s];o.emitter().one(e,i,n)}return this},once:function(e,r,n){for(var i=Ju(r),s=0;s<this.length;s++){var o=this[s];o.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}};Bt.eventAliasesOn(l_);var u_={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(ct(e)||yn(e))return new ta(e).filter(this);if(ir(e)){for(var n=this.spawn(),i=this,s=0;s<i.length;s++){var o=i[s],a=r?e.apply(r,[o,s,i]):e(o,s,i);a&&n.push(o)}return n}return this.spawn()},not:function(e){if(e){ct(e)&&(e=this.filter(e));for(var r=this.spawn(),n=0;n<this.length;n++){var i=this[n],s=e.has(i);s||r.push(i)}return r}else return this},absoluteComplement:function(){var e=this.cy();return e.mutableElements().not(this)},intersect:function(e){if(ct(e)){var r=e;return this.filter(r)}for(var n=this.spawn(),i=this,s=e,o=this.length<e.length,a=o?i:s,l=o?s:i,u=0;u<a.length;u++){var c=a[u];l.has(c)&&n.push(c)}return n},xor:function(e){var r=this._private.cy;ct(e)&&(e=r.$(e));var n=this.spawn(),i=this,s=e,o=function(l,u){for(var c=0;c<l.length;c++){var h=l[c],v=h._private.data.id,d=u.hasElementWithId(v);d||n.push(h)}};return o(i,s),o(s,i),n},diff:function(e){var r=this._private.cy;ct(e)&&(e=r.$(e));var n=this.spawn(),i=this.spawn(),s=this.spawn(),o=this,a=e,l=function(c,h,v){for(var d=0;d<c.length;d++){var x=c[d],w=x._private.data.id,g=h.hasElementWithId(w);g?s.merge(x):v.push(x)}};return l(o,a,n),l(a,o,i),{left:n,right:i,both:s}},add:function(e){var r=this._private.cy;if(!e)return this;if(ct(e)){var n=e;e=r.mutableElements().filter(n)}for(var i=this.spawnSelf(),s=0;s<e.length;s++){var o=e[s],a=!this.has(o);a&&i.push(o)}return i},merge:function(e){var r=this._private,n=r.cy;if(!e)return this;if(e&&ct(e)){var i=e;e=n.mutableElements().filter(i)}for(var s=r.map,o=0;o<e.length;o++){var a=e[o],l=a._private.data.id,u=!s.has(l);if(u){var c=this.length++;this[c]=a,s.set(l,{ele:a,index:c})}}return this},unmergeAt:function(e){var r=this[e],n=r.id(),i=this._private,s=i.map;this[e]=void 0,s.delete(n);var o=e===this.length-1;if(this.length>1&&!o){var a=this.length-1,l=this[a],u=l._private.data.id;this[a]=void 0,this[e]=l,s.set(u,{ele:l,index:e})}return this.length--,this},unmergeOne:function(e){e=e[0];var r=this._private,n=e._private.data.id,i=r.map,s=i.get(n);if(!s)return this;var o=s.index;return this.unmergeAt(o),this},unmerge:function(e){var r=this._private.cy;if(!e)return this;if(e&&ct(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,s=0;s<i.length;s++){var o=i[s],a=r?e.apply(r,[o,s,i]):e(o,s,i);n.push(a)}return n},reduce:function(e,r){for(var n=r,i=this,s=0;s<i.length;s++)n=e(n,i[s],s,i);return n},max:function(e,r){for(var n=-1/0,i,s=this,o=0;o<s.length;o++){var a=s[o],l=r?e.apply(r,[a,o,s]):e(a,o,s);l>n&&(n=l,i=a)}return{value:n,ele:i}},min:function(e,r){for(var n=1/0,i,s=this,o=0;o<s.length;o++){var a=s[o],l=r?e.apply(r,[a,o,s]):e(a,o,s);l<n&&(n=l,i=a)}return{value:n,ele:i}}},It=u_;It.u=It["|"]=It["+"]=It.union=It.or=It.add;It["\\"]=It["!"]=It["-"]=It.difference=It.relativeComplement=It.subtract=It.not;It.n=It["&"]=It["."]=It.and=It.intersection=It.intersect;It["^"]=It["(+)"]=It["(-)"]=It.symmetricDifference=It.symdiff=It.xor;It.fnFilter=It.filterFn=It.stdFilter=It.filter;It.complement=It.abscomp=It.absoluteComplement;var kR={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}},c_=function(e,r){var n=e.cy(),i=n.hasCompoundNodes();function s(c){var h=c.pstyle("z-compound-depth");return h.value==="auto"?i?c.zDepth():0:h.value==="bottom"?-1:h.value==="top"?Kv:0}var o=s(e)-s(r);if(o!==0)return o;function a(c){var h=c.pstyle("z-index-compare");return h.value==="auto"&&c.isNode()?1:0}var l=a(e)-a(r);if(l!==0)return l;var u=e.pstyle("z-index").value-r.pstyle("z-index").value;return u!==0?u:e.poolIndex()-r.poolIndex()},Mc={forEach:function(e,r){if(ir(e))for(var n=this.length,i=0;i<n;i++){var s=this[i],o=r?e.apply(r,[s,i,this]):e(s,i,this);if(o===!1)break}return this},toArray:function(){for(var e=[],r=0;r<this.length;r++)e.push(this[r]);return e},slice:function(e,r){var n=[],i=this.length;r==null&&(r=i),e==null&&(e=0),e<0&&(e=i+e),r<0&&(r=i+r);for(var s=e;s>=0&&s<r&&s<i;s++)n.push(this[s]);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(!ir(e))return this;var r=this.toArray().sort(e);return this.spawn(r)},sortByZIndex:function(){return this.sort(c_)},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:Kv-1}else{var s=r.source,o=r.target,a=s.zDepth(),l=o.zDepth();return Math.max(a,l,0)}}}};Mc.each=Mc.forEach;var TR=function(){var e="undefined",r=(typeof Symbol>"u"?"undefined":br(Symbol))!=e&&br(Symbol.iterator)!=e;r&&(Mc[Symbol.iterator]=function(){var n=this,i={value:void 0,done:!1},s=0,o=this.length;return lw({next:function(){return s<o?i.value=n[s++]:(i.value=void 0,i.done=!0),i}},Symbol.iterator,function(){return this})})};TR();var NR=Mr({nodeDimensionsIncludeLabels:!1}),pc={layoutDimensions:function(e){e=NR(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(N){return!N.isParent()}),s=this.cy(),o=r.eles,a=function(E){return E.id()},l=Hs(n,a);e.emit({type:"layoutstart",layout:e}),e.animations=[];var u=function(E,T,k){var L={x:T.x1+T.w/2,y:T.y1+T.h/2},A={x:(k.x-L.x)*E,y:(k.y-L.y)*E};return{x:L.x+A.x,y:L.y+A.y}},c=r.spacingFactor&&r.spacingFactor!==1,h=function(){if(!c)return null;for(var E=Qr(),T=0;T<i.length;T++){var k=i[T],L=l(k,T);Nw(E,L.x,L.y)}return E},v=h(),d=Hs(function(N,E){var T=l(N,E);if(c){var k=Math.abs(r.spacingFactor);T=u(k,v,T)}return r.transform!=null&&(T=r.transform(N,T)),T},a);if(r.animate){for(var x=0;x<i.length;x++){var w=i[x],g=d(w,x),m=r.animateFilter==null||r.animateFilter(w,x);if(m){var y=w.animation({position:g,duration:r.animationDuration,easing:r.animationEasing});e.animations.push(y)}else w.position(g)}if(r.fit){var b=s.animation({fit:{boundingBox:o.boundingBoxAt(d),padding:r.padding},duration:r.animationDuration,easing:r.animationEasing});e.animations.push(b)}else if(r.zoom!==void 0&&r.pan!==void 0){var S=s.animation({zoom:r.zoom,pan:r.pan,duration:r.animationDuration,easing:r.animationEasing});e.animations.push(S)}e.animations.forEach(function(N){return N.play()}),e.one("layoutready",r.ready),e.emit({type:"layoutready",layout:e}),Xs.all(e.animations.map(function(N){return N.promise()})).then(function(){e.one("layoutstop",r.stop),e.emit({type:"layoutstop",layout:e})})}else i.positions(d),r.fit&&s.fit(r.eles,r.padding),r.zoom!=null&&s.zoom(r.zoom),r.pan&&s.pan(r.pan),e.one("layoutready",r.ready),e.emit({type:"layoutready",layout:e}),e.one("layoutstop",r.stop),e.emit({type:"layoutstop",layout:e});return this},layout:function(e){var r=this.cy();return r.makeLayout(pt({},e,{eles:this}))}};pc.createLayout=pc.makeLayout=pc.layout;function h_(t,e,r){var n=r._private,i=n.styleCache=n.styleCache||[],s;return(s=i[t])!=null||(s=i[t]=e(r)),s}function rh(t,e){return t=ja(t),function(n){return h_(t,e,n)}}function nh(t,e){t=ja(t);var r=function(i){return e.call(i)};return function(){var i=this[0];if(i)return h_(t,r,i)}}var Dr={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(s){return s._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(),s=this;e=!!(e||e===void 0),i&&(s=this.spawnSelf().merge(this.descendants()).merge(this.parents()));var o=s;return e?o.emitAndNotify("style"):o.emit("style"),s.forEach(function(a){return a._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 s=n._private.style[e];return s??(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,s=n.style();if(At(e)){var o=e;s.applyBypass(this,o,i),this.emitAndNotify("style")}else if(ct(e))if(r===void 0){var a=this[0];return a?s.getStylePropertyValue(a,e):void 0}else s.applyBypass(this,e,r,i),this.emitAndNotify("style");else if(e===void 0){var l=this[0];return l?s.getRawStyle(l):void 0}return this},removeStyle:function(e){var r=this.cy();if(!r.styleEnabled())return this;var n=!1,i=r.style(),s=this;if(e===void 0)for(var o=0;o<s.length;o++){var a=s[o];i.removeAllBypasses(a,n)}else{e=e.split(/\s+/);for(var l=0;l<s.length;l++){var u=s[l];i.removeBypasses(u,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,s=n.pstyle("opacity").value;if(!r)return s;var o=i.data.parent?n.parents():null;if(o)for(var a=0;a<o.length;a++){var l=o[a],u=l.pstyle("opacity").value;s=u*s}return s}},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 Np(t,e){var r=t._private,n=r.data.parent?t.parents():null;if(n)for(var i=0;i<n.length;i++){var s=n[i];if(!e(s))return!1}return!0}function lg(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 s=this[0],o=i.hasCompoundNodes();if(s){var a=s._private;if(!e(s))return!1;if(s.isNode())return!o||Np(s,n);var l=a.source,u=a.target;return r(l)&&(!o||Np(l,r))&&(l===u||r(u)&&(!o||Np(u,r)))}}}var Ks=rh("eleTakesUpSpace",function(t){return t.pstyle("display").value==="element"&&t.width()!==0&&(t.isNode()?t.height()!==0:!0)});Dr.takesUpSpace=nh("takesUpSpace",lg({ok:Ks}));var RR=rh("eleInteractive",function(t){return t.pstyle("events").value==="yes"&&t.pstyle("visibility").value==="visible"&&Ks(t)}),LR=rh("parentInteractive",function(t){return t.pstyle("visibility").value==="visible"&&Ks(t)});Dr.interactive=nh("interactive",lg({ok:RR,parentOk:LR,edgeOkViaNode:Ks}));Dr.noninteractive=function(){var t=this[0];if(t)return!t.interactive()};var DR=rh("eleVisible",function(t){return t.pstyle("visibility").value==="visible"&&t.pstyle("opacity").pfValue!==0&&Ks(t)}),AR=Ks;Dr.visible=nh("visible",lg({ok:DR,edgeOkViaNode:AR}));Dr.hidden=function(){var t=this[0];if(t)return!t.visible()};Dr.isBundledBezier=nh("isBundledBezier",function(){return this.cy().styleEnabled()?!this.removed()&&this.pstyle("curve-style").value==="bezier"&&this.takesUpSpace():!1});Dr.bypass=Dr.css=Dr.style;Dr.renderedCss=Dr.renderedStyle;Dr.removeBypass=Dr.removeCss=Dr.removeStyle;Dr.pstyle=Dr.parsedStyle;var Qi={};function u1(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&&ir(e[0])){var s=e[0];this.on(t.event,s)}else if(e.length===0||e.length===1&&Wt(e[0])){for(var o=e.length===1?e[0]:null,a=0;a<this.length;a++){var l=this[a],u=!t.ableField||l._private[t.ableField],c=l._private[t.field]!=t.value;if(t.overrideAble){var h=t.overrideAble(l);if(h!==void 0&&(u=h,!h))return this}u&&(l._private[t.field]=t.value,c&&r.push(l))}var v=this.spawn(r);v.updateStyle(),v.emit(t.event),o&&v.emit(o)}return this}}function Qs(t){Qi[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]}},Qi[t.on]=u1({event:t.on,field:t.field,ableField:t.ableField,overrideAble:t.overrideAble,value:!0}),Qi[t.off]=u1({event:t.off,field:t.field,ableField:t.ableField,overrideAble:t.overrideAble,value:!1})}Qs({field:"locked",overrideField:function(e){return e.cy().autolock()?!0:void 0},on:"lock",off:"unlock"});Qs({field:"grabbable",overrideField:function(e){return e.cy().autoungrabify()||e.pannable()?!1:void 0},on:"grabify",off:"ungrabify"});Qs({field:"selected",ableField:"selectable",overrideAble:function(e){return e.cy().autounselectify()?!1:void 0},on:"select",off:"unselect"});Qs({field:"selectable",overrideField:function(e){return e.cy().autounselectify()?!1:void 0},on:"selectify",off:"unselectify"});Qi.deselect=Qi.unselect;Qi.grabbed=function(){var t=this[0];if(t)return t._private.grabbed};Qs({field:"active",on:"activate",off:"unactivate"});Qs({field:"pannable",on:"panify",off:"unpanify"});Qi.inactive=function(){var t=this[0];if(t)return!t._private.active};var Hr={},c1=function(e){return function(n){for(var i=this,s=[],o=0;o<i.length;o++){var a=i[o];if(a.isNode()){for(var l=!1,u=a.connectedEdges(),c=0;c<u.length;c++){var h=u[c],v=h.source(),d=h.target();if(e.noIncomingEdges&&d===a&&v!==a||e.noOutgoingEdges&&v===a&&d!==a){l=!0;break}}l||s.push(a)}}return this.spawn(s,!0).filter(n)}},h1=function(e){return function(r){for(var n=this,i=[],s=0;s<n.length;s++){var o=n[s];if(o.isNode())for(var a=o.connectedEdges(),l=0;l<a.length;l++){var u=a[l],c=u.source(),h=u.target();e.outgoing&&c===o?(i.push(u),i.push(h)):e.incoming&&h===o&&(i.push(u),i.push(c))}}return this.spawn(i,!0).filter(r)}},f1=function(e){return function(r){for(var n=this,i=[],s={};;){var o=e.outgoing?n.outgoers():n.incomers();if(o.length===0)break;for(var a=!1,l=0;l<o.length;l++){var u=o[l],c=u.id();s[c]||(s[c]=!0,i.push(u),a=!0)}if(!a)break;n=o}return this.spawn(i,!0).filter(r)}};Hr.clearTraversalCache=function(){for(var t=0;t<this.length;t++)this[t]._private.traversalCache=null};pt(Hr,{roots:c1({noIncomingEdges:!0}),leaves:c1({noOutgoingEdges:!0}),outgoers:Ln(h1({outgoing:!0}),"outgoers"),successors:f1({outgoing:!0}),incomers:Ln(h1({incoming:!0}),"incomers"),predecessors:f1({})});pt(Hr,{neighborhood:Ln(function(t){for(var e=[],r=this.nodes(),n=0;n<r.length;n++)for(var i=r[n],s=i.connectedEdges(),o=0;o<s.length;o++){var a=s[o],l=a.source(),u=a.target(),c=i===l?u:l;c.length>0&&e.push(c[0]),e.push(a[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)}});Hr.neighbourhood=Hr.neighborhood;Hr.closedNeighbourhood=Hr.closedNeighborhood;Hr.openNeighbourhood=Hr.openNeighborhood;pt(Hr,{source:Ln(function(e){var r=this[0],n;return r&&(n=r._private.source||r.cy().collection()),n&&e?n.filter(e):n},"source"),target:Ln(function(e){var r=this[0],n;return r&&(n=r._private.target||r.cy().collection()),n&&e?n.filter(e):n},"target"),sources:d1({attr:"source"}),targets:d1({attr:"target"})});function d1(t){return function(r){for(var n=[],i=0;i<this.length;i++){var s=this[i],o=s._private[t.attr];o&&n.push(o)}return this.spawn(n,!0).filter(r)}}pt(Hr,{edgesWith:Ln(p1(),"edgesWith"),edgesTo:Ln(p1({thisIsSrc:!0}),"edgesTo")});function p1(t){return function(r){var n=[],i=this._private.cy,s=t||{};ct(r)&&(r=i.$(r));for(var o=0;o<r.length;o++)for(var a=r[o]._private.edges,l=0;l<a.length;l++){var u=a[l],c=u._private.data,h=this.hasElementWithId(c.source)&&r.hasElementWithId(c.target),v=r.hasElementWithId(c.source)&&this.hasElementWithId(c.target),d=h||v;d&&((s.thisIsSrc||s.thisIsTgt)&&(s.thisIsSrc&&!h||s.thisIsTgt&&!v)||n.push(u))}return this.spawn(n,!0)}}pt(Hr,{connectedEdges:Ln(function(t){for(var e=[],r=this,n=0;n<r.length;n++){var i=r[n];if(i.isNode())for(var s=i._private.edges,o=0;o<s.length;o++){var a=s[o];e.push(a)}}return this.spawn(e,!0).filter(t)},"connectedEdges"),connectedNodes:Ln(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:Ln(v1(),"parallelEdges"),codirectedEdges:Ln(v1({codirected:!0}),"codirectedEdges")});function v1(t){var e={codirected:!1};return t=pt({},e,t),function(n){for(var i=[],s=this.edges(),o=t,a=0;a<s.length;a++)for(var l=s[a],u=l._private,c=u.source,h=c._private.data.id,v=u.data.target,d=c._private.edges,x=0;x<d.length;x++){var w=d[x],g=w._private.data,m=g.target,y=g.source,b=m===v&&y===h,S=h===m&&v===y;(o.codirected&&b||!o.codirected&&(b||S))&&i.push(w)}return this.spawn(i,!0).filter(n)}}pt(Hr,{components:function(e){var r=this,n=r.cy(),i=n.collection(),s=e==null?r.nodes():e.nodes(),o=[];e!=null&&s.empty()&&(s=e.sources());var a=function(c,h){i.merge(c),s.unmerge(c),h.merge(c)};if(s.empty())return r.spawn();var l=function(){var c=n.collection();o.push(c);var h=s[0];a(h,c),r.bfs({directed:!1,roots:h,visit:function(d){return a(d,c)}}),c.forEach(function(v){v.connectedEdges().forEach(function(d){r.has(d)&&c.has(d.source())&&c.has(d.target())&&c.merge(d)})})};do l();while(s.length>0);return o},component:function(){var e=this[0];return e.cy().mutableElements().components(e)[0]}});Hr.componentsOf=Hr.components;var Ar=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){er("A collection must have a reference to the core");return}var s=new vi,o=!1;if(!r)r=[];else if(r.length>0&&At(r[0])&&!Cl(r[0])){o=!0;for(var a=[],l=new Ys,u=0,c=r.length;u<c;u++){var h=r[u];h.data==null&&(h.data={});var v=h.data;if(v.id==null)v.id=Ew();else if(e.hasElementWithId(v.id)||l.has(v.id))continue;var d=new qc(e,h,!1);a.push(d),l.add(v.id)}r=a}this.length=0;for(var x=0,w=r.length;x<w;x++){var g=r[x][0];if(g!=null){var m=g._private.data.id;(!n||!s.has(m))&&(n&&s.set(m,{index:this.length,ele:g}),this[this.length]=g,this.length++)}}this._private={eles:this,cy:e,get map(){return this.lazyMap==null&&this.rebuildMap(),this.lazyMap},set map(y){this.lazyMap=y},rebuildMap:function(){for(var b=this.lazyMap=new vi,S=this.eles,N=0;N<S.length;N++){var E=S[N];b.set(E.id(),{index:N,ele:E})}}},n&&(this._private.map=s),o&&!i&&this.restore()},qt=qc.prototype=Ar.prototype=Object.create(Array.prototype);qt.instanceString=function(){return"collection"};qt.spawn=function(t,e){return new Ar(this.cy(),t,e)};qt.spawnSelf=function(){return this.spawn(this)};qt.cy=function(){return this._private.cy};qt.renderer=function(){return this._private.cy.renderer()};qt.element=function(){return this[0]};qt.collection=function(){return hw(this)?this:new Ar(this._private.cy,[this])};qt.unique=function(){return new Ar(this._private.cy,this,!0)};qt.hasElementWithId=function(t){return t=""+t,this._private.map.has(t)};qt.getElementById=function(t){t=""+t;var e=this._private.cy,r=this._private.map.get(t);return r?r.ele:new Ar(e)};qt.$id=qt.getElementById;qt.poolIndex=function(){var t=this._private.cy,e=t._private.elements,r=this[0]._private.data.id;return e._private.map.get(r).index};qt.indexOf=function(t){var e=t[0]._private.data.id;return this._private.map.get(e).index};qt.indexOfId=function(t){return t=""+t,this._private.map.get(t).index};qt.json=function(t){var e=this.element(),r=this.cy();if(e==null&&t)return this;if(e!=null){var n=e._private;if(At(t)){if(r.startBatch(),t.data){e.data(t.data);var i=n.data;if(e.isEdge()){var s=!1,o={},a=t.data.source,l=t.data.target;a!=null&&a!=i.source&&(o.source=""+a,s=!0),l!=null&&l!=i.target&&(o.target=""+l,s=!0),s&&(e=e.move(o))}else{var u="parent"in t.data,c=t.data.parent;u&&(c!=null||i.parent!=null)&&c!=i.parent&&(c===void 0&&(c=null),c!=null&&(c=""+c),e=e.move({parent:c}))}}t.position&&e.position(t.position);var h=function(w,g,m){var y=t[w];y!=null&&y!==n[w]&&(y?e[g]():e[m]())};return h("removed","remove","restore"),h("selected","select","unselect"),h("selectable","selectify","unselectify"),h("locked","lock","unlock"),h("grabbable","grabify","ungrabify"),h("pannable","panify","unpanify"),t.classes!=null&&e.classes(t.classes),r.endBatch(),this}else if(t===void 0){var v={data:Jn(n.data),position:Jn(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};v.classes="";var d=0;return n.classes.forEach(function(x){return v.classes+=d++===0?x:" "+x}),v}}};qt.jsons=function(){for(var t=[],e=0;e<this.length;e++){var r=this[e],n=r.json();t.push(n)}return t};qt.clone=function(){for(var t=this.cy(),e=[],r=0;r<this.length;r++){var n=this[r],i=n.json(),s=new qc(t,i,!1);e.push(s)}return new Ar(t,e)};qt.copy=qt.clone;qt.restore=function(){for(var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=this,n=r.cy(),i=n._private,s=[],o=[],a,l=0,u=r.length;l<u;l++){var c=r[l];e&&!c.removed()||(c.isNode()?s.push(c):o.push(c))}a=s.concat(o);var h,v=function(){a.splice(h,1),h--};for(h=0;h<a.length;h++){var d=a[h],x=d._private,w=x.data;if(d.clearTraversalCache(),!(!e&&!x.removed)){if(w.id===void 0)w.id=Ew();else if(Ke(w.id))w.id=""+w.id;else if(Zi(w.id)||!ct(w.id)){er("Can not create element with invalid string ID `"+w.id+"`"),v();continue}else if(n.hasElementWithId(w.id)){er("Can not create second element with ID `"+w.id+"`"),v();continue}}var g=w.id;if(d.isNode()){var m=x.position;m.x==null&&(m.x=0),m.y==null&&(m.y=0)}if(d.isEdge()){for(var y=d,b=["source","target"],S=b.length,N=!1,E=0;E<S;E++){var T=b[E],k=w[T];Ke(k)&&(k=w[T]=""+w[T]),k==null||k===""?(er("Can not create edge `"+g+"` with unspecified "+T),N=!0):n.hasElementWithId(k)||(er("Can not create edge `"+g+"` with nonexistent "+T+" `"+k+"`"),N=!0)}if(N){v();continue}var L=n.getElementById(w.source),A=n.getElementById(w.target);L.same(A)?L._private.edges.push(y):(L._private.edges.push(y),A._private.edges.push(y)),y._private.source=L,y._private.target=A}x.map=new vi,x.map.set(g,{ele:d,index:0}),x.removed=!1,e&&n.addToPool(d)}for(var I=0;I<s.length;I++){var M=s[I],B=M._private.data;Ke(B.parent)&&(B.parent=""+B.parent);var D=B.parent,H=D!=null;if(H||M._private.parent){var U=M._private.parent?n.collection().merge(M._private.parent):n.getElementById(D);if(U.empty())B.parent=void 0;else if(U[0].removed())jt("Node added with missing parent, reference to parent removed"),B.parent=void 0,M._private.parent=null;else{for(var z=!1,W=U;!W.empty();){if(M.same(W)){z=!0,B.parent=void 0;break}W=W.parent()}z||(U[0]._private.children.push(M),M._private.parent=U[0],i.hasCompoundNodes=!0)}}}if(a.length>0){for(var F=a.length===r.length?r:new Ar(n,a),P=0;P<F.length;P++){var j=F[P];j.isNode()||(j.parallelEdges().clearTraversalCache(),j.source().clearTraversalCache(),j.target().clearTraversalCache())}var G;i.hasCompoundNodes?G=n.collection().merge(F).merge(F.connectedNodes()).merge(F.parent()):G=F,G.dirtyCompoundBoundsCache().dirtyBoundingBoxCache().updateStyle(t),t?F.emitAndNotify("add"):e&&F.emit("add")}return r};qt.removed=function(){var t=this[0];return t&&t._private.removed};qt.inside=function(){var t=this[0];return t&&!t._private.removed};qt.remove=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=this,n=[],i={},s=r._private.cy;function o(D){for(var H=D._private.edges,U=0;U<H.length;U++)l(H[U])}function a(D){for(var H=D._private.children,U=0;U<H.length;U++)l(H[U])}function l(D){var H=i[D.id()];e&&D.removed()||H||(i[D.id()]=!0,D.isNode()?(n.push(D),o(D),a(D)):n.unshift(D))}for(var u=0,c=r.length;u<c;u++){var h=r[u];l(h)}function v(D,H){var U=D._private.edges;Ji(U,H),D.clearTraversalCache()}function d(D){D.clearTraversalCache()}var x=[];x.ids={};function w(D,H){H=H[0],D=D[0];var U=D._private.children,z=D.id();Ji(U,H),H._private.parent=null,x.ids[z]||(x.ids[z]=!0,x.push(D))}r.dirtyCompoundBoundsCache(),e&&s.removeFromPool(n);for(var g=0;g<n.length;g++){var m=n[g];if(m.isEdge()){var y=m.source()[0],b=m.target()[0];v(y,m),v(b,m);for(var S=m.parallelEdges(),N=0;N<S.length;N++){var E=S[N];d(E),E.isBundledBezier()&&E.dirtyBoundingBoxCache()}}else{var T=m.parent();T.length!==0&&w(T,m)}e&&(m._private.removed=!0)}var k=s._private.elements;s._private.hasCompoundNodes=!1;for(var L=0;L<k.length;L++){var A=k[L];if(A.isParent()){s._private.hasCompoundNodes=!0;break}}var I=new Ar(this.cy(),n);I.size()>0&&(t?I.emitAndNotify("remove"):e&&I.emit("remove"));for(var M=0;M<x.length;M++){var B=x[M];(!e||!B.removed())&&B.updateStyle()}return I};qt.move=function(t){var e=this._private.cy,r=this,n=!1,i=!1,s=function(x){return x==null?x:""+x};if(t.source!==void 0||t.target!==void 0){var o=s(t.source),a=s(t.target),l=o!=null&&e.hasElementWithId(o),u=a!=null&&e.hasElementWithId(a);(l||u)&&(e.batch(function(){r.remove(n,i),r.emitAndNotify("moveout");for(var d=0;d<r.length;d++){var x=r[d],w=x._private.data;x.isEdge()&&(l&&(w.source=o),u&&(w.target=a))}r.restore(n,i)}),r.emitAndNotify("move"))}else if(t.parent!==void 0){var c=s(t.parent),h=c===null||e.hasElementWithId(c);if(h){var v=c===null?void 0:c;e.batch(function(){var d=r.remove(n,i);d.emitAndNotify("moveout");for(var x=0;x<r.length;x++){var w=r[x],g=w._private.data;w.isNode()&&(g.parent=v)}d.restore(n,i)}),r.emitAndNotify("move")}}return this};[Bw,UN,dc,Ki,Ws,iR,eh,wR,l_,u_,kR,Mc,pc,Dr,Qi,Hr].forEach(function(t){pt(qt,t)});var MR={add:function(e){var r,n=this;if(yn(e)){var i=e;if(i._private.cy===n)r=i.restore();else{for(var s=[],o=0;o<i.length;o++){var a=i[o];s.push(a.json())}r=new Ar(n,s)}}else if(Wt(e)){var l=e;r=new Ar(n,l)}else if(At(e)&&(Wt(e.nodes)||Wt(e.edges))){for(var u=e,c=[],h=["nodes","edges"],v=0,d=h.length;v<d;v++){var x=h[v],w=u[x];if(Wt(w))for(var g=0,m=w.length;g<m;g++){var y=pt({group:x},w[g]);c.push(y)}}r=new Ar(n,c)}else{var b=e;r=new qc(n,b).collection()}return r},remove:function(e){if(!yn(e)){if(ct(e)){var r=e;e=this.$(r)}}return e.remove()}};/*! Bezier curve function generator. Copyright Gaetan Renaudeau. MIT License: http://en.wikipedia.org/wiki/MIT_License */function PR(t,e,r,n){var i=4,s=.001,o=1e-7,a=10,l=11,u=1/(l-1),c=typeof Float32Array<"u";if(arguments.length!==4)return!1;for(var h=0;h<4;++h)if(typeof arguments[h]!="number"||isNaN(arguments[h])||!isFinite(arguments[h]))return!1;t=Math.min(t,1),r=Math.min(r,1),t=Math.max(t,0),r=Math.max(r,0);var v=c?new Float32Array(l):new Array(l);function d(A,I){return 1-3*I+3*A}function x(A,I){return 3*I-6*A}function w(A){return 3*A}function g(A,I,M){return((d(I,M)*A+x(I,M))*A+w(I))*A}function m(A,I,M){return 3*d(I,M)*A*A+2*x(I,M)*A+w(I)}function y(A,I){for(var M=0;M<i;++M){var B=m(I,t,r);if(B===0)return I;var D=g(I,t,r)-A;I-=D/B}return I}function b(){for(var A=0;A<l;++A)v[A]=g(A*u,t,r)}function S(A,I,M){var B,D,H=0;do D=I+(M-I)/2,B=g(D,t,r)-A,B>0?M=D:I=D;while(Math.abs(B)>o&&++H<a);return D}function N(A){for(var I=0,M=1,B=l-1;M!==B&&v[M]<=A;++M)I+=u;--M;var D=(A-v[M])/(v[M+1]-v[M]),H=I+D*u,U=m(H,t,r);return U>=s?y(A,H):U===0?H:S(A,I,I+u)}var E=!1;function T(){E=!0,(t!==e||r!==n)&&b()}var k=function(I){return E||T(),t===e&&r===n?I:I===0?0:I===1?1:g(N(I),e,n)};k.getControlPoints=function(){return[{x:t,y:e},{x:r,y:n}]};var L="generateBezier("+[t,e,r,n]+")";return k.toString=function(){return L},k}/*! Runge-Kutta spring physics function generator. Adapted from Framer.js, copyright Koen Bok. MIT License: http://en.wikipedia.org/wiki/MIT_License */var IR=(function(){function t(n){return-n.tension*n.x-n.friction*n.v}function e(n,i,s){var o={x:n.x+s.dx*i,v:n.v+s.dv*i,tension:n.tension,friction:n.friction};return{dx:o.v,dv:t(o)}}function r(n,i){var s={dx:n.v,dv:t(n)},o=e(n,i*.5,s),a=e(n,i*.5,o),l=e(n,i,a),u=1/6*(s.dx+2*(o.dx+a.dx)+l.dx),c=1/6*(s.dv+2*(o.dv+a.dv)+l.dv);return n.x=n.x+u*i,n.v=n.v+c*i,n}return function n(i,s,o){var a={x:-1,v:0,tension:null,friction:null},l=[0],u=0,c=1/1e4,h=16/1e3,v,d,x;for(i=parseFloat(i)||500,s=parseFloat(s)||20,o=o||null,a.tension=i,a.friction=s,v=o!==null,v?(u=n(i,s),d=u/o*h):d=h;x=r(x||a,d),l.push(1+x.x),u+=16,Math.abs(x.x)>c&&Math.abs(x.v)>c;);return v?function(w){return l[w*(l.length-1)|0]}:u}})(),Gt=function(e,r,n,i){var s=PR(e,r,n,i);return function(o,a,l){return o+(a-o)*s(l)}},vc={linear:function(e,r,n){return e+(r-e)*n},ease:Gt(.25,.1,.25,1),"ease-in":Gt(.42,0,1,1),"ease-out":Gt(0,0,.58,1),"ease-in-out":Gt(.42,0,.58,1),"ease-in-sine":Gt(.47,0,.745,.715),"ease-out-sine":Gt(.39,.575,.565,1),"ease-in-out-sine":Gt(.445,.05,.55,.95),"ease-in-quad":Gt(.55,.085,.68,.53),"ease-out-quad":Gt(.25,.46,.45,.94),"ease-in-out-quad":Gt(.455,.03,.515,.955),"ease-in-cubic":Gt(.55,.055,.675,.19),"ease-out-cubic":Gt(.215,.61,.355,1),"ease-in-out-cubic":Gt(.645,.045,.355,1),"ease-in-quart":Gt(.895,.03,.685,.22),"ease-out-quart":Gt(.165,.84,.44,1),"ease-in-out-quart":Gt(.77,0,.175,1),"ease-in-quint":Gt(.755,.05,.855,.06),"ease-out-quint":Gt(.23,1,.32,1),"ease-in-out-quint":Gt(.86,0,.07,1),"ease-in-expo":Gt(.95,.05,.795,.035),"ease-out-expo":Gt(.19,1,.22,1),"ease-in-out-expo":Gt(1,0,0,1),"ease-in-circ":Gt(.6,.04,.98,.335),"ease-out-circ":Gt(.075,.82,.165,1),"ease-in-out-circ":Gt(.785,.135,.15,.86),spring:function(e,r,n){if(n===0)return vc.linear;var i=IR(e,r,n);return function(s,o,a){return s+(o-s)*i(a)}},"cubic-bezier":Gt};function g1(t,e,r,n,i){if(n===1||e===r)return r;var s=i(e,r,n);return t==null||((t.roundValue||t.color)&&(s=Math.round(s)),t.min!==void 0&&(s=Math.max(s,t.min)),t.max!==void 0&&(s=Math.min(s,t.max))),s}function m1(t,e){return t.pfValue!=null||t.value!=null?t.pfValue!=null&&(e==null||e.type.units!=="%")?t.pfValue:t.value:t}function ws(t,e,r,n,i){var s=i!=null?i.type:null;r<0?r=0:r>1&&(r=1);var o=m1(t,i),a=m1(e,i);if(Ke(o)&&Ke(a))return g1(s,o,a,r,n);if(Wt(o)&&Wt(a)){for(var l=[],u=0;u<a.length;u++){var c=o[u],h=a[u];if(c!=null&&h!=null){var v=g1(s,c,h,r,n);l.push(v)}else l.push(h)}return l}}function OR(t,e,r,n){var i=!n,s=t._private,o=e._private,a=o.easing,l=o.startTime,u=n?t:t.cy(),c=u.style();if(!o.easingImpl)if(a==null)o.easingImpl=vc.linear;else{var h;if(ct(a)){var v=c.parse("transition-timing-function",a);h=v.value}else h=a;var d,x;ct(h)?(d=h,x=[]):(d=h[1],x=h.slice(2).map(function(F){return+F})),x.length>0?(d==="spring"&&x.push(o.duration),o.easingImpl=vc[d].apply(null,x)):o.easingImpl=vc[d]}var w=o.easingImpl,g;if(o.duration===0?g=1:g=(r-l)/o.duration,o.applying&&(g=o.progress),g<0?g=0:g>1&&(g=1),o.delay==null){var m=o.startPosition,y=o.position;if(y&&i&&!t.locked()){var b={};Wo(m.x,y.x)&&(b.x=ws(m.x,y.x,g,w)),Wo(m.y,y.y)&&(b.y=ws(m.y,y.y,g,w)),t.position(b)}var S=o.startPan,N=o.pan,E=s.pan,T=N!=null&&n;T&&(Wo(S.x,N.x)&&(E.x=ws(S.x,N.x,g,w)),Wo(S.y,N.y)&&(E.y=ws(S.y,N.y,g,w)),t.emit("pan"));var k=o.startZoom,L=o.zoom,A=L!=null&&n;A&&(Wo(k,L)&&(s.zoom=pl(s.minZoom,ws(k,L,g,w),s.maxZoom)),t.emit("zoom")),(T||A)&&t.emit("viewport");var I=o.style;if(I&&I.length>0&&i){for(var M=0;M<I.length;M++){var B=I[M],D=B.name,H=B,U=o.startStyle[D],z=c.properties[U.name],W=ws(U,H,g,w,z);c.overrideBypass(t,D,W)}t.emit("style")}}return o.progress=g,g}function Wo(t,e){return t==null||e==null?!1:Ke(t)&&Ke(e)?!0:!!(t&&e)}function BR(t,e,r,n){var i=e._private;i.started=!0,i.startTime=r-i.progress*i.duration}function y1(t,e){var r=e._private.aniEles,n=[];function i(c,h){var v=c._private,d=v.animation.current,x=v.animation.queue,w=!1;if(d.length===0){var g=x.shift();g&&d.push(g)}for(var m=function(E){for(var T=E.length-1;T>=0;T--){var k=E[T];k()}E.splice(0,E.length)},y=d.length-1;y>=0;y--){var b=d[y],S=b._private;if(S.stopped){d.splice(y,1),S.hooked=!1,S.playing=!1,S.started=!1,m(S.frames);continue}!S.playing&&!S.applying||(S.playing&&S.applying&&(S.applying=!1),S.started||BR(c,b,t),OR(c,b,t,h),S.applying&&(S.applying=!1),m(S.frames),S.step!=null&&S.step(t),b.completed()&&(d.splice(y,1),S.hooked=!1,S.playing=!1,S.started=!1,m(S.completes)),w=!0)}return!h&&d.length===0&&x.length===0&&n.push(c),w}for(var s=!1,o=0;o<r.length;o++){var a=r[o],l=i(a);s=s||l}var u=i(e,!0);(s||u)&&(r.length>0?e.notify("draw",r):e.notify("draw")),r.unmerge(n),e.emit("step")}var jR={animate:Bt.animate(),animation:Bt.animation(),animated:Bt.animated(),clearQueue:Bt.clearQueue(),delay:Bt.delay(),delayAnimation:Bt.delayAnimation(),stop:Bt.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&&Nc(function(s){y1(s,e),r()})}var n=e.renderer();n&&n.beforeRender?n.beforeRender(function(s,o){y1(o,e)},n.beforeRenderPriorities.animations):r()}},FR={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&&Cl(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}},ec=function(e){return ct(e)?new ta(e):e},f_={createEmitter:function(){var e=this._private;return e.emitter||(e.emitter=new th(FR,this)),this},emitter:function(){return this._private.emitter},on:function(e,r,n){return this.emitter().on(e,ec(r),n),this},removeListener:function(e,r,n){return this.emitter().removeListener(e,ec(r),n),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(e,r,n){return this.emitter().one(e,ec(r),n),this},once:function(e,r,n){return this.emitter().one(e,ec(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}};Bt.eventAliasesOn(f_);var xv={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)}};xv.jpeg=xv.jpg;var gc={layout:function(e){var r=this;if(e==null){er("Layout options must be specified to make a layout");return}if(e.name==null){er("A `name` must be specified to make a layout");return}var n=e.name,i=r.extension("layout",n);if(i==null){er("No such layout `"+n+"` found. Did you forget to import it and `cytoscape.use()` it?");return}var s;ct(e.eles)?s=r.$(e.eles):s=e.eles!=null?e.eles:r.$();var o=new i(pt({},e,{cy:r,eles:s}));return o}};gc.createLayout=gc.makeLayout=gc.layout;var zR={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 s=this.renderer();this.destroyed()||!s||s.notify(e,r)}},notifications:function(e){var r=this._private;return e===void 0?r.notificationsEnabled:(r.notificationsEnabled=!!e,this)},noNotifications:function(e){this.notifications(!1),e(),this.notifications(!0)},batching:function(){return this._private.batchCount>0},startBatch:function(){var e=this._private;return e.batchCount==null&&(e.batchCount=0),e.batchCount===0&&(e.batchStyleEles=this.collection(),e.batchNotifications={}),e.batchCount++,this},endBatch:function(){var e=this._private;if(e.batchCount===0)return this;if(e.batchCount--,e.batchCount===0){e.batchStyleEles.updateStyle();var r=this.renderer();Object.keys(e.batchNotifications).forEach(function(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 s=n[i],o=e[s],a=r.getElementById(s);a.data(o)}})}},HR=Mr({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]}),bv={renderTo:function(e,r,n,i){var s=this._private.renderer;return s.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){er("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=HR(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)}};bv.invalidateDimensions=bv.resize;var mc={collection:function(e,r){return ct(e)?this.$(e):yn(e)?e.collection():Wt(e)?(r||(r={}),new Ar(this,e,r.unique,r.removed)):new Ar(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}};mc.elements=mc.filter=mc.$;var Tr={},il="t",UR="f";Tr.apply=function(t){for(var e=this,r=e._private,n=r.cy,i=n.collection(),s=0;s<t.length;s++){var o=t[s],a=e.getContextMeta(o);if(!a.empty){var l=e.getContextStyle(a),u=e.applyContextStyle(a,l,o);o._private.appliedInitStyle?e.updateTransitions(o,u.diffProps):o._private.appliedInitStyle=!0;var c=e.updateStyleHints(o);c&&i.push(o)}}return i};Tr.getPropertiesDiff=function(t,e){var r=this,n=r._private.propDiffs=r._private.propDiffs||{},i=t+"-"+e,s=n[i];if(s)return s;for(var o=[],a={},l=0;l<r.length;l++){var u=r[l],c=t[l]===il,h=e[l]===il,v=c!==h,d=u.mappedProperties.length>0;if(v||h&&d){var x=void 0;v&&d||v?x=u.properties:d&&(x=u.mappedProperties);for(var w=0;w<x.length;w++){for(var g=x[w],m=g.name,y=!1,b=l+1;b<r.length;b++){var S=r[b],N=e[b]===il;if(N&&(y=S.properties[g.name]!=null,y))break}!a[m]&&!y&&(a[m]=!0,o.push(m))}}}return n[i]=o,o};Tr.getContextMeta=function(t){for(var e=this,r="",n,i=t._private.styleCxtKey||"",s=0;s<e.length;s++){var o=e[s],a=o.selector&&o.selector.matches(t);a?r+=il:r+=UR}return n=e.getPropertiesDiff(i,r),t._private.styleCxtKey=r,{key:r,diffPropNames:n,empty:n.length===0}};Tr.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}},s=0;s<r.length;s++){var o=r[s],a=e[s]===il;if(a)for(var l=0;l<o.properties.length;l++){var u=o.properties[l];i[u.name]=u}}return n[e]=i,i};Tr.applyContextStyle=function(t,e,r){for(var n=this,i=t.diffPropNames,s={},o=n.types,a=0;a<i.length;a++){var l=i[a],u=e[l],c=r.pstyle(l);if(!u)if(c)c.bypass?u={name:l,deleteBypassed:!0}:u={name:l,delete:!0};else continue;if(c!==u){if(u.mapped===o.fn&&c!=null&&c.mapping!=null&&c.mapping.value===u.value){var h=c.mapping,v=h.fnValue=u.value(r);if(v===h.prevFnValue)continue}var d=s[l]={prev:c};n.applyParsedProperty(r,u),d.next=r.pstyle(l),d.next&&d.next.bypass&&(d.next=d.next.bypassed)}}return{diffProps:s}};Tr.updateStyleHints=function(t){var e=t._private,r=this,n=r.propertyGroupNames,i=r.propertyGroupKeys,s=function(re,ce,de){return r.getPropertiesHash(re,ce,de)},o=e.styleKey;if(t.removed())return!1;var a=e.group==="nodes",l=t._private.style;n=Object.keys(l);for(var u=0;u<i.length;u++){var c=i[u];e.styleKeys[c]=[Ma,Ds]}for(var h=function(re,ce){return e.styleKeys[ce][0]=hl(re,e.styleKeys[ce][0])},v=function(re,ce){return e.styleKeys[ce][1]=fl(re,e.styleKeys[ce][1])},d=function(re,ce){h(re,ce),v(re,ce)},x=function(re,ce){for(var de=0;de<re.length;de++){var Re=re.charCodeAt(de);h(Re,ce),v(Re,ce)}},w=2e9,g=function(re){return-128<re&&re<128&&Math.floor(re)!==re?w-(re*1024|0):re},m=0;m<n.length;m++){var y=n[m],b=l[y];if(b!=null){var S=this.properties[y],N=S.type,E=S.groupKey,T=void 0;S.hashOverride!=null?T=S.hashOverride(t,b):b.pfValue!=null&&(T=b.pfValue);var k=S.enums==null?b.value:null,L=T!=null,A=k!=null,I=L||A,M=b.units;if(N.number&&I&&!N.multiple){var B=L?T:k;d(g(B),E),!L&&M!=null&&x(M,E)}else x(b.strValue,E)}}for(var D=[Ma,Ds],H=0;H<i.length;H++){var U=i[H],z=e.styleKeys[U];D[0]=hl(z[0],D[0]),D[1]=fl(z[1],D[1])}e.styleKey=n3(D[0],D[1]);var W=e.styleKeys;e.labelDimsKey=Ui(W.labelDimensions);var F=s(t,["label"],W.labelDimensions);if(e.labelKey=Ui(F),e.labelStyleKey=Ui(Gu(W.commonLabel,F)),!a){var P=s(t,["source-label"],W.labelDimensions);e.sourceLabelKey=Ui(P),e.sourceLabelStyleKey=Ui(Gu(W.commonLabel,P));var j=s(t,["target-label"],W.labelDimensions);e.targetLabelKey=Ui(j),e.targetLabelStyleKey=Ui(Gu(W.commonLabel,j))}if(a){var G=e.styleKeys,$=G.nodeBody,ee=G.nodeBorder,ae=G.nodeOutline,ie=G.backgroundImage,K=G.compound,q=G.pie,Y=G.stripe,X=[$,ee,ae,ie,K,q,Y].filter(function(J){return J!=null}).reduce(Gu,[Ma,Ds]);e.nodeKey=Ui(X),e.hasPie=q!=null&&q[0]!==Ma&&q[1]!==Ds,e.hasStripe=Y!=null&&Y[0]!==Ma&&Y[1]!==Ds}return o!==e.styleKey};Tr.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};Tr.applyParsedProperty=function(t,e){var r=this,n=e,i=t._private.style,s,o=r.types,a=r.properties[n.name].type,l=n.bypass,u=i[n.name],c=u&&u.bypass,h=t._private,v="mapping",d=function($){return $==null?null:$.pfValue!=null?$.pfValue:$.value},x=function(){var $=d(u),ee=d(n);r.checkTriggers(t,n.name,$,ee)};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",l)),n.delete)return i[n.name]=void 0,x(),!0;if(n.deleteBypassed)return u?u.bypass?(u.bypassed=void 0,x(),!0):!1:(x(),!0);if(n.deleteBypass)return u?u.bypass?(i[n.name]=u.bypassed,x(),!0):!1:(x(),!0);var w=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 o.mapData:{for(var g=n.field.split("."),m=h.data,y=0;y<g.length&&m;y++){var b=g[y];m=m[b]}if(m==null)return w(),!1;var S;if(Ke(m)){var N=n.fieldMax-n.fieldMin;N===0?S=0:S=(m-n.fieldMin)/N}else return jt("Do not use continuous mappers without specifying numeric data (i.e. `"+n.field+": "+m+"` for `"+t.id()+"` is non-numeric)"),!1;if(S<0?S=0:S>1&&(S=1),a.color){var E=n.valueMin[0],T=n.valueMax[0],k=n.valueMin[1],L=n.valueMax[1],A=n.valueMin[2],I=n.valueMax[2],M=n.valueMin[3]==null?1:n.valueMin[3],B=n.valueMax[3]==null?1:n.valueMax[3],D=[Math.round(E+(T-E)*S),Math.round(k+(L-k)*S),Math.round(A+(I-A)*S),Math.round(M+(B-M)*S)];s={bypass:n.bypass,name:n.name,value:D,strValue:"rgb("+D[0]+", "+D[1]+", "+D[2]+")"}}else if(a.number){var H=n.valueMin+(n.valueMax-n.valueMin)*S;s=this.parse(n.name,H,n.bypass,v)}else return!1;if(!s)return w(),!1;s.mapping=n,n=s;break}case o.data:{for(var U=n.field.split("."),z=h.data,W=0;W<U.length&&z;W++){var F=U[W];z=z[F]}if(z!=null&&(s=this.parse(n.name,z,n.bypass,v)),!s)return w(),!1;s.mapping=n,n=s;break}case o.fn:{var P=n.value,j=n.fnValue!=null?n.fnValue:P(t);if(n.prevFnValue=j,j==null)return jt("Custom function mappers may not return null (i.e. `"+n.name+"` for ele `"+t.id()+"` is null)"),!1;if(s=this.parse(n.name,j,n.bypass,v),!s)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;s.mapping=Jn(n),n=s;break}case void 0:break;default:return!1}return l?(c?n.bypassed=u.bypassed:n.bypassed=u,i[n.name]=n):c?u.bypassed=n:i[n.name]=n,x(),!0};Tr.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,s=Object.keys(i),o=0;o<s.length;o++){var a=s[o],l=i[a];l!=null&&(l.bypass?l.bypassed=null:i[a]=null)}}};Tr.update=function(){var t=this._private.cy,e=t.mutableElements();e.updateStyle()};Tr.updateTransitions=function(t,e){var r=this,n=t._private,i=t.pstyle("transition-property").value,s=t.pstyle("transition-duration").pfValue,o=t.pstyle("transition-delay").pfValue;if(i.length>0&&s>0){for(var a={},l=!1,u=0;u<i.length;u++){var c=i[u],h=t.pstyle(c),v=e[c];if(v){var d=v.prev,x=d,w=v.next!=null?v.next:h,g=!1,m=void 0,y=1e-6;x&&(Ke(x.pfValue)&&Ke(w.pfValue)?(g=w.pfValue-x.pfValue,m=x.pfValue+y*g):Ke(x.value)&&Ke(w.value)?(g=w.value-x.value,m=x.value+y*g):Wt(x.value)&&Wt(w.value)&&(g=x.value[0]!==w.value[0]||x.value[1]!==w.value[1]||x.value[2]!==w.value[2],m=x.strValue),g&&(a[c]=w.strValue,this.applyBypass(t,c,m),l=!0))}}if(!l)return;n.transitioning=!0,new Xs(function(b){o>0?t.delayAnimation(o).play().promise().then(b):b()}).then(function(){return t.animation({style:a,duration:s,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)};Tr.checkTrigger=function(t,e,r,n,i,s){var o=this.properties[e],a=i(o);t.removed()||a!=null&&a(r,n,t)&&s(o)};Tr.checkZOrderTrigger=function(t,e,r,n){var i=this;this.checkTrigger(t,e,r,n,function(s){return s.triggersZOrder},function(){i._private.cy.notify("zorder",t)})};Tr.checkBoundsTrigger=function(t,e,r,n){this.checkTrigger(t,e,r,n,function(i){return i.triggersBounds},function(i){t.dirtyCompoundBoundsCache(),t.dirtyBoundingBoxCache()})};Tr.checkConnectedEdgesBoundsTrigger=function(t,e,r,n){this.checkTrigger(t,e,r,n,function(i){return i.triggersBoundsOfConnectedEdges},function(i){t.connectedEdges().forEach(function(s){s.dirtyBoundingBoxCache()})})};Tr.checkParallelEdgesBoundsTrigger=function(t,e,r,n){this.checkTrigger(t,e,r,n,function(i){return i.triggersBoundsOfParallelEdges},function(i){t.parallelEdges().forEach(function(s){s.dirtyBoundingBoxCache()})})};Tr.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 Dl={};Dl.applyBypass=function(t,e,r,n){var i=this,s=[],o=!0;if(e==="*"||e==="**"){if(r!==void 0)for(var a=0;a<i.properties.length;a++){var l=i.properties[a],u=l.name,c=this.parse(u,r,!0);c&&s.push(c)}}else if(ct(e)){var h=this.parse(e,r,!0);h&&s.push(h)}else if(At(e)){var v=e;n=r;for(var d=Object.keys(v),x=0;x<d.length;x++){var w=d[x],g=v[w];if(g===void 0&&(g=v[$c(w)]),g!==void 0){var m=this.parse(w,g,!0);m&&s.push(m)}}}else return!1;if(s.length===0)return!1;for(var y=!1,b=0;b<t.length;b++){for(var S=t[b],N={},E=void 0,T=0;T<s.length;T++){var k=s[T];if(n){var L=S.pstyle(k.name);E=N[k.name]={prev:L}}y=this.applyParsedProperty(S,Jn(k))||y,n&&(E.next=S.pstyle(k.name))}y&&this.updateStyleHints(S),n&&this.updateTransitions(S,N,o)}return y};Dl.overrideBypass=function(t,e,r){e=Yv(e);for(var n=0;n<t.length;n++){var i=t[n],s=i._private.style[e],o=this.properties[e].type,a=o.color,l=o.mutiple,u=s?s.pfValue!=null?s.pfValue:s.value:null;!s||!s.bypass?this.applyBypass(i,e,r):(s.value=r,s.pfValue!=null&&(s.pfValue=r),a?s.strValue="rgb("+r.join(",")+")":l?s.strValue=r.join(" "):s.strValue=""+r,this.updateStyleHints(i)),this.checkTriggers(i,e,u,r)}};Dl.removeAllBypasses=function(t,e){return this.removeBypasses(t,this.propertyNames,e)};Dl.removeBypasses=function(t,e,r){for(var n=!0,i=0;i<t.length;i++){for(var s=t[i],o={},a=0;a<e.length;a++){var l=e[a],u=this.properties[l],c=s.pstyle(u.name);if(!(!c||!c.bypass)){var h="",v=this.parse(l,h,!0),d=o[u.name]={prev:c};this.applyParsedProperty(s,v),d.next=s.pstyle(u.name)}}this.updateStyleHints(s),r&&this.updateTransitions(s,o,n)}};var ug={};ug.getEmSizeInPixels=function(){var t=this.containerCss("font-size");return t!=null?parseFloat(t):1};ug.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 ti={};ti.getRenderedStyle=function(t,e){return e?this.getStylePropertyValue(t,e,!0):this.getRawStyle(t,!0)};ti.getRawStyle=function(t,e){var r=this;if(t=t[0],t){for(var n={},i=0;i<r.properties.length;i++){var s=r.properties[i],o=r.getStylePropertyValue(t,s.name,e);o!=null&&(n[s.name]=o,n[$c(s.name)]=o)}return n}};ti.getIndexedStyle=function(t,e,r,n){var i=t.pstyle(e)[r][n];return i??t.cy().style().getDefaultProperty(e)[r][0]};ti.getStylePropertyValue=function(t,e,r){var n=this;if(t=t[0],t){var i=n.properties[e];i.alias&&(i=i.pointsTo);var s=i.type,o=t.pstyle(i.name);if(o){var a=o.value,l=o.units,u=o.strValue;if(r&&s.number&&a!=null&&Ke(a)){var c=t.cy().zoom(),h=function(g){return g*c},v=function(g,m){return h(g)+m},d=Wt(a),x=d?l.every(function(w){return w!=null}):l!=null;return x?d?a.map(function(w,g){return v(w,l[g])}).join(" "):v(a,l):d?a.map(function(w){return ct(w)?w:""+h(w)}).join(" "):""+h(a)}else if(u!=null)return u}return null}};ti.getAnimationStartStyle=function(t,e){for(var r={},n=0;n<e.length;n++){var i=e[n],s=i.name,o=t.pstyle(s);o!==void 0&&(At(o)?o=this.parse(s,o.strValue):o=this.parse(s,o)),o&&(r[s]=o)}return r};ti.getPropsList=function(t){var e=this,r=[],n=t,i=e.properties;if(n)for(var s=Object.keys(n),o=0;o<s.length;o++){var a=s[o],l=n[a],u=i[a]||i[Yv(a)],c=this.parse(u.name,l);c&&r.push(c)}return r};ti.getNonDefaultPropertiesHash=function(t,e,r){var n=r.slice(),i,s,o,a,l,u;for(l=0;l<e.length;l++)if(i=e[l],s=t.pstyle(i,!1),s!=null)if(s.pfValue!=null)n[0]=hl(a,n[0]),n[1]=fl(a,n[1]);else for(o=s.strValue,u=0;u<o.length;u++)a=o.charCodeAt(u),n[0]=hl(a,n[0]),n[1]=fl(a,n[1]);return n};ti.getPropertiesHash=ti.getNonDefaultPropertiesHash;var ih={};ih.appendFromJson=function(t){for(var e=this,r=0;r<t.length;r++){var n=t[r],i=n.selector,s=n.style||n.css,o=Object.keys(s);e.selector(i);for(var a=0;a<o.length;a++){var l=o[a],u=s[l];e.css(l,u)}}return e};ih.fromJson=function(t){var e=this;return e.resetToDefault(),e.appendFromJson(t),e};ih.json=function(){for(var t=[],e=this.defaultLength;e<this.length;e++){for(var r=this[e],n=r.selector,i=r.properties,s={},o=0;o<i.length;o++){var a=i[o];s[a.name]=a.strValue}t.push({selector:n?n.toString():"core",style:s})}return t};var cg={};cg.appendFromString=function(t){var e=this,r=this,n=""+t,i,s,o;n=n.replace(/[/][*](\s|.)+?[*][/]/g,"");function a(){n.length>i.length?n=n.substr(i.length):n=""}function l(){s.length>o.length?s=s.substr(o.length):s=""}for(;;){var u=n.match(/^\s*$/);if(u)break;var c=n.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!c){jt("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+n);break}i=c[0];var h=c[1];if(h!=="core"){var v=new ta(h);if(v.invalid){jt("Skipping parsing of block: Invalid selector found in string stylesheet: "+h),a();continue}}var d=c[2],x=!1;s=d;for(var w=[];;){var g=s.match(/^\s*$/);if(g)break;var m=s.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!m){jt("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+d),x=!0;break}o=m[0];var y=m[1],b=m[2],S=e.properties[y];if(!S){jt("Skipping property: Invalid property name in: "+o),l();continue}var N=r.parse(y,b);if(!N){jt("Skipping property: Invalid property definition in: "+o),l();continue}w.push({name:y,val:b}),l()}if(x){a();break}r.selector(h);for(var E=0;E<w.length;E++){var T=w[E];r.css(T.name,T.val)}a()}return r};cg.fromString=function(t){var e=this;return e.resetToDefault(),e.appendFromString(t),e};var pr={};(function(){var t=xr,e=Ik,r=Bk,n=jk,i=Fk,s=function(J){return"^"+J+"\\s*\\(\\s*([\\w\\.]+)\\s*\\)$"},o=function(J){var re=t+"|\\w+|"+e+"|"+r+"|"+n+"|"+i;return"^"+J+"\\s*\\(([\\w\\.]+)\\s*\\,\\s*("+t+")\\s*\\,\\s*("+t+")\\s*,\\s*("+re+")\\s*\\,\\s*("+re+")\\)$"},a=[`^url\\s*\\(\\s*['"]?(.+?)['"]?\\s*\\)$`,"^(none)$","^(.+)$"];pr.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","top-inside","center","bottom","bottom-inside"]},halign:{enums:["left","left-inside","center","right","right-inside"]},justification:{enums:["left","center","right","auto"]},textMetrics:{enums:["font","glyph"]},text:{string:!0},data:{mapping:!0,regex:s("data")},layoutData:{mapping:!0,regex:s("layoutData")},scratch:{mapping:!0,regex:s("scratch")},mapData:{mapping:!0,regex:o("mapData")},mapLayoutData:{mapping:!0,regex:o("mapLayoutData")},mapScratch:{mapping:!0,regex:o("mapScratch")},fn:{mapping:!0,fn:!0},url:{regexes:a,singleRegexMatchValue:!0},urls:{regexes:a,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,re){switch(J.length){case 2:return re[0]!=="deg"&&re[0]!=="rad"&&re[1]!=="deg"&&re[1]!=="rad";case 1:return ct(J[0])||re[0]==="deg"||re[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 re=J.length;return re===1||re===2||re===4}}};var l={zeroNonZero:function(J,re){return(J==null||re==null)&&J!==re||J==0&&re!=0?!0:J!=0&&re==0},any:function(J,re){return J!=re},emptyNonEmpty:function(J,re){var ce=Zi(J),de=Zi(re);return ce&&!de||!ce&&de}},u=pr.types,c=[{name:"label",type:u.text,triggersBounds:l.any,triggersZOrder:l.emptyNonEmpty},{name:"text-rotation",type:u.textRotation,triggersBounds:l.any},{name:"text-margin-x",type:u.bidirectionalSize,triggersBounds:l.any},{name:"text-margin-y",type:u.bidirectionalSize,triggersBounds:l.any}],h=[{name:"source-label",type:u.text,triggersBounds:l.any},{name:"source-text-rotation",type:u.textRotation,triggersBounds:l.any},{name:"source-text-margin-x",type:u.bidirectionalSize,triggersBounds:l.any},{name:"source-text-margin-y",type:u.bidirectionalSize,triggersBounds:l.any},{name:"source-text-offset",type:u.size,triggersBounds:l.any}],v=[{name:"target-label",type:u.text,triggersBounds:l.any},{name:"target-text-rotation",type:u.textRotation,triggersBounds:l.any},{name:"target-text-margin-x",type:u.bidirectionalSize,triggersBounds:l.any},{name:"target-text-margin-y",type:u.bidirectionalSize,triggersBounds:l.any},{name:"target-text-offset",type:u.size,triggersBounds:l.any}],d=[{name:"font-family",type:u.fontFamily,triggersBounds:l.any},{name:"font-style",type:u.fontStyle,triggersBounds:l.any},{name:"font-weight",type:u.fontWeight,triggersBounds:l.any},{name:"font-size",type:u.size,triggersBounds:l.any},{name:"text-transform",type:u.textTransform,triggersBounds:l.any},{name:"text-wrap",type:u.textWrap,triggersBounds:l.any},{name:"text-overflow-wrap",type:u.textOverflowWrap,triggersBounds:l.any},{name:"text-max-width",type:u.size,triggersBounds:l.any},{name:"text-outline-width",type:u.size,triggersBounds:l.any},{name:"line-height",type:u.positiveNumber,triggersBounds:l.any}],x=[{name:"text-valign",type:u.valign,triggersBounds:l.any},{name:"text-halign",type:u.halign,triggersBounds:l.any},{name:"color",type:u.color},{name:"text-outline-color",type:u.color},{name:"text-outline-opacity",type:u.zeroOneNumber},{name:"text-background-color",type:u.color},{name:"text-background-opacity",type:u.zeroOneNumber},{name:"text-background-padding",type:u.size,triggersBounds:l.any},{name:"text-border-opacity",type:u.zeroOneNumber},{name:"text-border-color",type:u.color},{name:"text-border-width",type:u.size,triggersBounds:l.any},{name:"text-border-style",type:u.borderStyle,triggersBounds:l.any},{name:"text-background-shape",type:u.textBackgroundShape,triggersBounds:l.any},{name:"text-justification",type:u.justification},{name:"text-metrics",type:u.textMetrics},{name:"box-select-labels",type:u.bool,triggersBounds:l.any}],w=[{name:"events",type:u.bool,triggersZOrder:l.any},{name:"text-events",type:u.bool,triggersZOrder:l.any},{name:"box-selection",type:u.boxSelection,triggersZOrder:l.any}],g=[{name:"display",type:u.display,triggersZOrder:l.any,triggersBounds:l.any,triggersBoundsOfConnectedEdges:l.any,triggersBoundsOfParallelEdges:function(J,re,ce){return J===re?!1:ce.pstyle("curve-style").value==="bezier"}},{name:"visibility",type:u.visibility,triggersZOrder:l.any},{name:"opacity",type:u.zeroOneNumber,triggersZOrder:l.zeroNonZero},{name:"text-opacity",type:u.zeroOneNumber},{name:"min-zoomed-font-size",type:u.size},{name:"z-compound-depth",type:u.zCompoundDepth,triggersZOrder:l.any},{name:"z-index-compare",type:u.zIndexCompare,triggersZOrder:l.any},{name:"z-index",type:u.number,triggersZOrder:l.any}],m=[{name:"overlay-padding",type:u.size,triggersBounds:l.any},{name:"overlay-color",type:u.color},{name:"overlay-opacity",type:u.zeroOneNumber,triggersBounds:l.zeroNonZero},{name:"overlay-shape",type:u.overlayShape,triggersBounds:l.any},{name:"overlay-corner-radius",type:u.cornerRadius}],y=[{name:"underlay-padding",type:u.size,triggersBounds:l.any},{name:"underlay-color",type:u.color},{name:"underlay-opacity",type:u.zeroOneNumber,triggersBounds:l.zeroNonZero},{name:"underlay-shape",type:u.overlayShape,triggersBounds:l.any},{name:"underlay-corner-radius",type:u.cornerRadius}],b=[{name:"transition-property",type:u.propList},{name:"transition-duration",type:u.time},{name:"transition-delay",type:u.time},{name:"transition-timing-function",type:u.easing}],S=function(J,re){return re.value==="label"?-J.poolIndex():re.pfValue},N=[{name:"height",type:u.nodeSize,triggersBounds:l.any,hashOverride:S},{name:"width",type:u.nodeSize,triggersBounds:l.any,hashOverride:S},{name:"shape",type:u.nodeShape,triggersBounds:l.any},{name:"shape-polygon-points",type:u.polygonPointList,triggersBounds:l.any},{name:"corner-radius",type:u.cornerRadius},{name:"background-color",type:u.color},{name:"background-fill",type:u.fill},{name:"background-opacity",type:u.zeroOneNumber},{name:"background-blacken",type:u.nOneOneNumber},{name:"background-gradient-stop-colors",type:u.colors},{name:"background-gradient-stop-positions",type:u.percentages},{name:"background-gradient-direction",type:u.gradientDirection},{name:"padding",type:u.sizeMaybePercent,triggersBounds:l.any},{name:"padding-relative-to",type:u.paddingRelativeTo,triggersBounds:l.any},{name:"bounds-expansion",type:u.boundsExpansion,triggersBounds:l.any}],E=[{name:"border-color",type:u.color},{name:"border-opacity",type:u.zeroOneNumber},{name:"border-width",type:u.size,triggersBounds:l.any},{name:"border-style",type:u.borderStyle},{name:"border-cap",type:u.lineCap},{name:"border-join",type:u.lineJoin},{name:"border-dash-pattern",type:u.numbers},{name:"border-dash-offset",type:u.number},{name:"border-position",type:u.linePosition}],T=[{name:"outline-color",type:u.color},{name:"outline-opacity",type:u.zeroOneNumber},{name:"outline-width",type:u.size,triggersBounds:l.any},{name:"outline-style",type:u.borderStyle},{name:"outline-offset",type:u.size,triggersBounds:l.any}],k=[{name:"background-image",type:u.urls},{name:"background-image-crossorigin",type:u.bgCrossOrigin},{name:"background-image-opacity",type:u.zeroOneNumbers},{name:"background-image-containment",type:u.bgContainment},{name:"background-image-smoothing",type:u.bools},{name:"background-position-x",type:u.bgPos},{name:"background-position-y",type:u.bgPos},{name:"background-width-relative-to",type:u.bgRelativeTo},{name:"background-height-relative-to",type:u.bgRelativeTo},{name:"background-repeat",type:u.bgRepeat},{name:"background-fit",type:u.bgFit},{name:"background-clip",type:u.bgClip},{name:"background-width",type:u.bgWH},{name:"background-height",type:u.bgWH},{name:"background-offset-x",type:u.bgPos},{name:"background-offset-y",type:u.bgPos}],L=[{name:"position",type:u.position,triggersBounds:l.any},{name:"compound-sizing-wrt-labels",type:u.compoundIncludeLabels,triggersBounds:l.any},{name:"min-width",type:u.size,triggersBounds:l.any},{name:"min-width-bias-left",type:u.sizeMaybePercent,triggersBounds:l.any},{name:"min-width-bias-right",type:u.sizeMaybePercent,triggersBounds:l.any},{name:"min-height",type:u.size,triggersBounds:l.any},{name:"min-height-bias-top",type:u.sizeMaybePercent,triggersBounds:l.any},{name:"min-height-bias-bottom",type:u.sizeMaybePercent,triggersBounds:l.any}],A=[{name:"line-style",type:u.lineStyle},{name:"line-color",type:u.color},{name:"line-fill",type:u.fill},{name:"line-cap",type:u.lineCap},{name:"line-opacity",type:u.zeroOneNumber},{name:"line-dash-pattern",type:u.numbers},{name:"line-dash-offset",type:u.number},{name:"line-outline-width",type:u.size},{name:"line-outline-color",type:u.color},{name:"line-gradient-stop-colors",type:u.colors},{name:"line-gradient-stop-positions",type:u.percentages},{name:"curve-style",type:u.curveStyle,triggersBounds:l.any,triggersBoundsOfParallelEdges:function(J,re){return J===re?!1:J==="bezier"||re==="bezier"}},{name:"haystack-radius",type:u.zeroOneNumber,triggersBounds:l.any},{name:"source-endpoint",type:u.edgeEndpoint,triggersBounds:l.any},{name:"target-endpoint",type:u.edgeEndpoint,triggersBounds:l.any},{name:"control-point-step-size",type:u.size,triggersBounds:l.any},{name:"control-point-distances",type:u.bidirectionalSizes,triggersBounds:l.any},{name:"control-point-weights",type:u.numbers,triggersBounds:l.any},{name:"segment-distances",type:u.bidirectionalSizes,triggersBounds:l.any},{name:"segment-weights",type:u.numbers,triggersBounds:l.any},{name:"segment-radii",type:u.numbers,triggersBounds:l.any},{name:"radius-type",type:u.radiusType,triggersBounds:l.any},{name:"taxi-turn",type:u.bidirectionalSizeMaybePercent,triggersBounds:l.any},{name:"taxi-turn-min-distance",type:u.size,triggersBounds:l.any},{name:"taxi-direction",type:u.axisDirection,triggersBounds:l.any},{name:"taxi-radius",type:u.number,triggersBounds:l.any},{name:"edge-distances",type:u.edgeDistances,triggersBounds:l.any},{name:"arrow-scale",type:u.positiveNumber,triggersBounds:l.any},{name:"loop-direction",type:u.angle,triggersBounds:l.any},{name:"loop-sweep",type:u.angle,triggersBounds:l.any},{name:"source-distance-from-node",type:u.size,triggersBounds:l.any},{name:"target-distance-from-node",type:u.size,triggersBounds:l.any}],I=[{name:"ghost",type:u.bool,triggersBounds:l.any},{name:"ghost-offset-x",type:u.bidirectionalSize,triggersBounds:l.any},{name:"ghost-offset-y",type:u.bidirectionalSize,triggersBounds:l.any},{name:"ghost-opacity",type:u.zeroOneNumber}],M=[{name:"selection-box-color",type:u.color},{name:"selection-box-opacity",type:u.zeroOneNumber},{name:"selection-box-border-color",type:u.color},{name:"selection-box-border-width",type:u.size},{name:"active-bg-color",type:u.color},{name:"active-bg-opacity",type:u.zeroOneNumber},{name:"active-bg-size",type:u.size},{name:"outside-texture-bg-color",type:u.color},{name:"outside-texture-bg-opacity",type:u.zeroOneNumber}],B=[];pr.pieBackgroundN=16,B.push({name:"pie-size",type:u.sizeMaybePercent}),B.push({name:"pie-hole",type:u.sizeMaybePercent}),B.push({name:"pie-start-angle",type:u.angle});for(var D=1;D<=pr.pieBackgroundN;D++)B.push({name:"pie-"+D+"-background-color",type:u.color}),B.push({name:"pie-"+D+"-background-size",type:u.percent}),B.push({name:"pie-"+D+"-background-opacity",type:u.zeroOneNumber});var H=[];pr.stripeBackgroundN=16,H.push({name:"stripe-size",type:u.sizeMaybePercent}),H.push({name:"stripe-direction",type:u.axisDirectionPrimary});for(var U=1;U<=pr.stripeBackgroundN;U++)H.push({name:"stripe-"+U+"-background-color",type:u.color}),H.push({name:"stripe-"+U+"-background-size",type:u.percent}),H.push({name:"stripe-"+U+"-background-opacity",type:u.zeroOneNumber});var z=[],W=pr.arrowPrefixes=["source","mid-source","target","mid-target"];[{name:"arrow-shape",type:u.arrowShape,triggersBounds:l.any},{name:"arrow-color",type:u.color},{name:"arrow-fill",type:u.arrowFill},{name:"arrow-width",type:u.arrowWidth}].forEach(function(X){W.forEach(function(J){var re=J+"-"+X.name,ce=X.type,de=X.triggersBounds;z.push({name:re,type:ce,triggersBounds:de})})},{});var F=pr.properties=[].concat(w,b,g,m,y,I,x,d,c,h,v,N,E,T,k,B,H,L,A,z,M),P=pr.propertyGroups={behavior:w,transition:b,visibility:g,overlay:m,underlay:y,ghost:I,commonLabel:x,labelDimensions:d,mainLabel:c,sourceLabel:h,targetLabel:v,nodeBody:N,nodeBorder:E,nodeOutline:T,backgroundImage:k,pie:B,stripe:H,compound:L,edgeLine:A,edgeArrow:z,core:M},j=pr.propertyGroupNames={},G=pr.propertyGroupKeys=Object.keys(P);G.forEach(function(X){j[X]=P[X].map(function(J){return J.name}),P[X].forEach(function(J){return J.groupKey=X})});var $=pr.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"}];pr.propertyNames=F.map(function(X){return X.name});for(var ee=0;ee<F.length;ee++){var ae=F[ee];F[ae.name]=ae}for(var ie=0;ie<$.length;ie++){var K=$[ie],q=F[K.pointsTo],Y={name:K.name,alias:!0,pointsTo:q};F.push(Y),F[K.name]=Y}})();pr.getDefaultProperty=function(t){return this.getDefaultProperties()[t]};pr.getDefaultProperties=function(){var t=this._private;if(t.defaultProperties!=null)return t.defaultProperties;for(var e=pt({"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","text-metrics":"font","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(l,u){for(var c=1;c<=pr.pieBackgroundN;c++){var h=u.name.replace("{{i}}",c),v=u.value;l[h]=v}return l},{}),{"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(l,u){for(var c=1;c<=pr.stripeBackgroundN;c++){var h=u.name.replace("{{i}}",c),v=u.value;l[h]=v}return l},{}),{"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(l,u){return pr.arrowPrefixes.forEach(function(c){var h=c+"-"+u.name,v=u.value;l[h]=v}),l},{})),r={},n=0;n<this.properties.length;n++){var i=this.properties[n];if(!i.pointsTo){var s=i.name,o=e[s],a=this.parse(s,o);r[s]=a}}return t.defaultProperties=r,t.defaultProperties};pr.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 ah={};ah.parse=function(t,e,r,n){var i=this;if(ir(e))return i.parseImplWarn(t,e,r,n);var s=n==="mapping"||n===!0||n===!1||n==null?"dontcare":n,o=r?"t":"f",a=""+e,l=_w(t,a,o,s),u=i.propCache=i.propCache||[],c;return(c=u[l])||(c=u[l]=i.parseImplWarn(t,e,r,n)),(r||n==="mapping")&&(c=Jn(c),c&&(c.value=Jn(c.value))),c};ah.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};ah.parseImpl=function(t,e,r,n){var i=this;t=Yv(t);var s=i.properties[t],o=e,a=i.types;if(!s||e===void 0)return null;s.alias&&(s=s.pointsTo,t=s.name);var l=ct(e);l&&(e=e.trim());var u=s.type;if(!u)return null;if(r&&(e===""||e===null))return{name:t,value:e,bypass:!0,deleteBypass:!0};if(ir(e))return{name:t,value:e,strValue:"fn",mapped:a.fn,bypass:r};var c,h;if(!(!l||n||e.length<7||e[1]!=="a")){if(e.length>=7&&e[0]==="d"&&(c=new RegExp(a.data.regex).exec(e))){if(r)return!1;var v=a.data;return{name:t,value:c,strValue:""+e,mapped:v,field:c[1],bypass:r}}else if(e.length>=10&&e[0]==="m"&&(h=new RegExp(a.mapData.regex).exec(e))){if(r||u.multiple)return!1;var d=a.mapData;if(!(u.color||u.number))return!1;var x=this.parse(t,h[4]);if(!x||x.mapped)return!1;var w=this.parse(t,h[5]);if(!w||w.mapped)return!1;if(x.pfValue===w.pfValue||x.strValue===w.strValue)return jt("`"+t+": "+e+"` is not a valid mapper because the output range is zero; converting to `"+t+": "+x.strValue+"`"),this.parse(t,x.strValue);if(u.color){var g=x.value,m=w.value,y=g[0]===m[0]&&g[1]===m[1]&&g[2]===m[2]&&(g[3]===m[3]||(g[3]==null||g[3]===1)&&(m[3]==null||m[3]===1));if(y)return!1}return{name:t,value:h,strValue:""+e,mapped:d,field:h[1],fieldMin:parseFloat(h[2]),fieldMax:parseFloat(h[3]),valueMin:x.value,valueMax:w.value,bypass:r}}}if(u.multiple&&n!=="multiple"){var b;if(l?b=e.split(/\s+/):Wt(e)?b=e:b=[e],u.evenMultiple&&b.length%2!==0)return null;for(var S=[],N=[],E=[],T="",k=!1,L=0;L<b.length;L++){var A=i.parse(t,b[L],r,"multiple");k=k||ct(A.value),S.push(A.value),E.push(A.pfValue!=null?A.pfValue:A.value),N.push(A.units),T+=(L>0?" ":"")+A.strValue}return u.validate&&!u.validate(S,N)?null:u.singleEnum&&k?S.length===1&&ct(S[0])?{name:t,value:S[0],strValue:S[0],bypass:r}:null:{name:t,value:S,pfValue:E,strValue:T,bypass:r,units:N}}var I=function(){for(var Y=0;Y<u.enums.length;Y++){var X=u.enums[Y];if(X===e)return{name:t,value:e,strValue:""+e,bypass:r}}return null};if(u.number){var M,B="px";if(u.units&&(M=u.units),u.implicitUnits&&(B=u.implicitUnits),!u.unitless)if(l){var D="px|em"+(u.allowPercent?"|\\%":"");M&&(D=M);var H=e.match("^("+xr+")("+D+")?$");H&&(e=H[1],M=H[2]||B)}else(!M||u.implicitUnits)&&(M=B);if(e=parseFloat(e),isNaN(e)&&u.enums===void 0)return null;if(isNaN(e)&&u.enums!==void 0)return e=o,I();if(u.integer&&!Nk(e)||u.min!==void 0&&(e<u.min||u.strictMin&&e===u.min)||u.max!==void 0&&(e>u.max||u.strictMax&&e===u.max))return null;var U={name:t,value:e,strValue:""+e+(M||""),units:M,bypass:r};return u.unitless||M!=="px"&&M!=="em"?U.pfValue=e:U.pfValue=M==="px"||!M?e:this.getEmSizeInPixels()*e,(M==="ms"||M==="s")&&(U.pfValue=M==="ms"?e:1e3*e),(M==="deg"||M==="rad")&&(U.pfValue=M==="rad"?e:j3(e)),M==="%"&&(U.pfValue=e/100),U}else if(u.propList){var z=[],W=""+e;if(W!=="none"){for(var F=W.split(/\s*,\s*|\s+/),P=0;P<F.length;P++){var j=F[P].trim();i.properties[j]?z.push(j):jt("`"+j+"` is not a valid property name")}if(z.length===0)return null}return{name:t,value:z,strValue:z.length===0?"none":z.join(" "),bypass:r}}else if(u.color){var G=vw(e);return G?{name:t,value:G,pfValue:G,strValue:"rgb("+G[0]+","+G[1]+","+G[2]+")",bypass:r}:null}else if(u.regex||u.regexes){if(u.enums){var $=I();if($)return $}for(var ee=u.regexes?u.regexes:[u.regex],ae=0;ae<ee.length;ae++){var ie=new RegExp(ee[ae]),K=ie.exec(e);if(K)return{name:t,value:u.singleRegexMatchValue?K[1]:K,strValue:""+e,bypass:r}}return null}else return u.string?{name:t,value:""+e,strValue:""+e,bypass:r}:u.enums?I():null};var kr=function(e){if(!(this instanceof kr))return new kr(e);if(!qv(e)){er("A style must have a core reference");return}this._private={cy:e,coreStyle:{}},this.length=0,this.resetToDefault()},Ur=kr.prototype;Ur.instanceString=function(){return"style"};Ur.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 s=i[0]._private;s.styleDirty=!0,s.appliedInitStyle=!1}),this};Ur.resetToDefault=function(){return this.clear(),this.addDefaultStylesheet(),this};Ur.core=function(t){return this._private.coreStyle[t]||this.getDefaultProperty(t)};Ur.selector=function(t){var e=t==="core"?null:new ta(t),r=this.length++;return this[r]={selector:e,properties:[],mappedProperties:[],index:r},this};Ur.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],s=r[i.name];s===void 0&&(s=r[$c(i.name)]),s!==void 0&&this.cssRule(i.name,s)}else e.length===2&&this.cssRule(e[0],e[1]);return this};Ur.style=Ur.css;Ur.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};Ur.append=function(t){return fw(t)?t.appendToStyle(this):Wt(t)?this.appendFromJson(t):ct(t)&&this.appendFromString(t),this};kr.fromJson=function(t,e){var r=new kr(t);return r.fromJson(e),r};kr.fromString=function(t,e){return new kr(t).fromString(e)};[Tr,Dl,ug,ti,ih,cg,pr,ah].forEach(function(t){pt(Ur,t)});kr.types=Ur.types;kr.properties=Ur.properties;kr.propertyGroups=Ur.propertyGroups;kr.propertyGroupNames=Ur.propertyGroupNames;kr.propertyGroupKeys=Ur.propertyGroupKeys;var WR={style:function(e){if(e){var r=this.setStyle(e);r.update()}return this._private.style},setStyle:function(e){var r=this._private;return fw(e)?r.style=e.generateStyle(this):Wt(e)?r.style=kr.fromJson(this,e):ct(e)?r.style=kr.fromString(this,e):r.style=kr(this),r.style},updateStyle:function(){this.mutableElements().updateStyle()}},VR="single",Ha={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=VR),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,s,o,a;switch(e.length){case 0:return r;case 1:if(ct(e[0]))return n=e[0],r[n];if(At(e[0])){if(!this._private.panningEnabled)return this;s=e[0],o=s.x,a=s.y,Ke(o)&&(r.x=o),Ke(a)&&(r.y=a),this.emit("pan viewport")}break;case 2:if(!this._private.panningEnabled)return this;n=e[0],i=e[1],(n==="x"||n==="y")&&Ke(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,s,o,a,l,u;if(!this._private.panningEnabled)return this;switch(n.length){case 1:At(e)&&(a=n[0],l=a.x,u=a.y,Ke(l)&&(i.x+=l),Ke(u)&&(i.y+=u),this.emit("pan viewport"));break;case 2:s=e,o=r,(s==="x"||s==="y")&&Ke(o)&&(i[s]+=o),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(Ke(e)&&r===void 0&&(r=e,e=void 0),!(!this._private.panningEnabled||!this._private.zoomingEnabled)){var n;if(ct(e)){var i=e;e=this.$(i)}else if(Dk(e)){var s=e;n={x1:s.x1,y1:s.y1,x2:s.x2,y2:s.y2},n.w=n.x2-n.x1,n.h=n.y2-n.y1}else yn(e)||(e=this.mutableElements());if(!(yn(e)&&e.empty())){n=n||e.boundingBox();var o=this.width(),a=this.height(),l;if(r=Ke(r)?r:0,!isNaN(o)&&!isNaN(a)&&o>0&&a>0&&!isNaN(n.w)&&!isNaN(n.h)&&n.w>0&&n.h>0){l=Math.min((o-2*r)/n.w,(a-2*r)/n.h),l=l>this._private.maxZoom?this._private.maxZoom:l,l=l<this._private.minZoom?this._private.minZoom:l;var u={x:(o-l*(n.x1+n.x2))/2,y:(a-l*(n.y1+n.y2))/2};return{zoom:l,pan:u}}}}},zoomRange:function(e,r){var n=this._private;if(r==null){var i=e;e=i.min,r=i.max}return Ke(e)&&Ke(r)&&e<=r?(n.minZoom=e,n.maxZoom=r):Ke(e)&&r===void 0&&e<=n.maxZoom?n.minZoom=e:Ke(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,s,o,a=!1;if(r.zoomingEnabled||(a=!0),Ke(e)?o=e:At(e)&&(o=e.level,e.position!=null?s=Yc(e.position,i,n):e.renderedPosition!=null&&(s=e.renderedPosition),s!=null&&!r.panningEnabled&&(a=!0)),o=o>r.maxZoom?r.maxZoom:o,o=o<r.minZoom?r.minZoom:o,a||!Ke(o)||o===i||s!=null&&(!Ke(s.x)||!Ke(s.y)))return null;if(s!=null){var l=n,u=i,c=o,h={x:-c/u*(s.x-l.x)+s.x,y:-c/u*(s.y-l.y)+s.y};return{zoomed:!0,panned:!0,zoom:c,pan:h}}else return{zoomed:!0,panned:!1,zoom:o,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,s=[],o=!1,a=!1;if(!e)return this;if(Ke(e.zoom)||(n=!1),At(e.pan)||(i=!1),!n&&!i)return this;if(n){var l=e.zoom;l<r.minZoom||l>r.maxZoom||!r.zoomingEnabled?o=!0:(r.zoom=l,s.push("zoom"))}if(i&&(!o||!e.cancelOnFailedZoom)&&r.panningEnabled){var u=e.pan;Ke(u.x)&&(r.pan.x=u.x,a=!1),Ke(u.y)&&(r.pan.y=u.y,a=!1),a||s.push("pan")}return s.length>0&&(s.push("viewport"),this.emit(s.join(" ")),this.notify("viewport")),this},center:function(e){var r=this.getCenterPan(e);return r&&(this._private.pan=r,this.emit("pan viewport"),this.notify("viewport")),this},getCenterPan:function(e,r){if(this._private.panningEnabled){if(ct(e)){var n=e;e=this.mutableElements().filter(n)}else yn(e)||(e=this.mutableElements());if(e.length!==0){var i=e.boundingBox(),s=this.width(),o=this.height();r=r===void 0?this._private.zoom:r;var a={x:(s-r*(i.x1+i.x2))/2,y:(o-r*(i.y1+i.y2))/2};return a}}},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),s=function(a){return parseFloat(i.getPropertyValue(a))};return{width:r.clientWidth-s("padding-left")-s("padding-right"),height:r.clientHeight-s("padding-top")-s("padding-bottom")}})():{width:1,height:1})},width:function(){return this.size().width},height:function(){return this.size().height},extent:function(){var e=this._private.pan,r=this._private.zoom,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}};Ha.centre=Ha.center;Ha.autolockNodes=Ha.autolock;Ha.autoungrabifyNodes=Ha.autoungrabify;var yl={data:Bt.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeData:Bt.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),scratch:Bt.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Bt.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0})};yl.attr=yl.data;yl.removeAttr=yl.removeData;var xl=function(e){var r=this;e=pt({},e);var n=e.container;n&&!Tc(n)&&Tc(n[0])&&(n=n[0]);var i=n?n._cyreg:null;i=i||{},i&&i.cy&&(i.cy.destroy(),i={});var s=i.readies=i.readies||[];n&&(n._cyreg=i),i.cy=r;var o=yr!==void 0&&n!==void 0&&!e.headless,a=e;a.layout=pt({name:o?"grid":"null"},a.layout),a.renderer=pt({name:o?"canvas":"null"},a.renderer);var l=function(x,w,g){return w!==void 0?w:g!==void 0?g:x},u=this._private={container:n,ready:!1,options:a,elements:new Ar(this),listeners:[],aniEles:new Ar(this),data:a.data||{},scratch:{},layout:null,renderer:null,destroyed:!1,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:l(!0,a.zoomingEnabled),userZoomingEnabled:l(!0,a.userZoomingEnabled),panningEnabled:l(!0,a.panningEnabled),userPanningEnabled:l(!0,a.userPanningEnabled),boxSelectionEnabled:l(!0,a.boxSelectionEnabled),autolock:l(!1,a.autolock,a.autolockNodes),autoungrabify:l(!1,a.autoungrabify,a.autoungrabifyNodes),autounselectify:l(!1,a.autounselectify),styleEnabled:a.styleEnabled===void 0?o:a.styleEnabled,zoom:Ke(a.zoom)?a.zoom:1,pan:{x:At(a.pan)&&Ke(a.pan.x)?a.pan.x:0,y:At(a.pan)&&Ke(a.pan.y)?a.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:!1,multiClickDebounceTime:l(250,a.multiClickDebounceTime)};this.createEmitter(),this.selectionType(a.selectionType),this.zoomRange({min:a.minZoom,max:a.maxZoom});var c=function(x,w){var g=x.some(Ak);if(g)return Xs.all(x).then(w);w(x)};u.styleEnabled&&r.setStyle([]);var h=pt({},a,a.renderer);r.initRenderer(h);var v=function(x,w,g){r.notifications(!1);var m=r.mutableElements();m.length>0&&m.remove(),x!=null&&(At(x)||Wt(x))&&r.add(x),r.one("layoutready",function(b){r.notifications(!0),r.emit(b),r.one("load",w),r.emitAndNotify("load")}).one("layoutstop",function(){r.one("done",g),r.emit("done")});var y=pt({},r._private.options.layout);y.eles=r.elements(),r.layout(y).run()};c([a.style,a.elements],function(d){var x=d[0],w=d[1];u.styleEnabled&&r.style().append(x),v(w,function(){r.startAnimationLoop(),u.ready=!0,ir(a.ready)&&r.on("ready",a.ready);for(var g=0;g<s.length;g++){var m=s[g];r.on("ready",m)}i&&(i.readies=[]),r.emit("ready")},a.done)})},Pc=xl.prototype;pt(Pc,{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 yr;var r=this._private.container.ownerDocument;return r===void 0||r==null?yr:r.defaultView||yr},mount:function(e){if(e!=null){var r=this,n=r._private,i=n.options;return!Tc(e)&&Tc(e[0])&&(e=e[0]),r.stopAnimationLoop(),r.destroyRenderer(),n.container=e,n.styleEnabled=!0,r.invalidateSize(),r.initRenderer(pt({},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 Jn(this._private.options)},json:function(e){var r=this,n=r._private,i=r.mutableElements(),s=function(S){return r.getElementById(S.id())};if(At(e)){if(r.startBatch(),e.elements){var o={},a=function(S,N){for(var E=[],T=[],k=0;k<S.length;k++){var L=S[k];if(!L.data.id){jt("cy.json() cannot handle elements without an ID attribute");continue}var A=""+L.data.id,I=r.getElementById(A);o[A]=!0,I.length!==0?T.push({ele:I,json:L}):(N&&(L.group=N),E.push(L))}r.add(E);for(var M=0;M<T.length;M++){var B=T[M],D=B.ele,H=B.json;D.json(H)}};if(Wt(e.elements))a(e.elements);else for(var l=["nodes","edges"],u=0;u<l.length;u++){var c=l[u],h=e.elements[c];Wt(h)&&a(h,c)}var v=r.collection();i.filter(function(b){return!o[b.id()]}).forEach(function(b){b.isParent()?v.merge(b):b.remove()}),v.forEach(function(b){return b.children().move({parent:null})}),v.forEach(function(b){return s(b).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 d=["minZoom","maxZoom","zoomingEnabled","userZoomingEnabled","panningEnabled","userPanningEnabled","boxSelectionEnabled","autolock","autoungrabify","autounselectify","multiClickDebounceTime"],x=0;x<d.length;x++){var w=d[x];e[w]!=null&&r[w](e[w])}return r.endBatch(),this}else{var g=!!e,m={};g?m.elements=this.elements().map(function(b){return b.json()}):(m.elements={},i.forEach(function(b){var S=b.group();m.elements[S]||(m.elements[S]=[]),m.elements[S].push(b.json())})),this._private.styleEnabled&&(m.style=r.style().json()),m.data=Jn(r.data());var y=n.options;return m.zoomingEnabled=n.zoomingEnabled,m.userZoomingEnabled=n.userZoomingEnabled,m.zoom=n.zoom,m.minZoom=n.minZoom,m.maxZoom=n.maxZoom,m.panningEnabled=n.panningEnabled,m.userPanningEnabled=n.userPanningEnabled,m.pan=Jn(n.pan),m.boxSelectionEnabled=n.boxSelectionEnabled,m.renderer=Jn(y.renderer),m.hideEdgesOnViewport=y.hideEdgesOnViewport,m.textureOnViewport=y.textureOnViewport,m.wheelSensitivity=y.wheelSensitivity,m.motionBlur=y.motionBlur,m.multiClickDebounceTime=y.multiClickDebounceTime,m}}});Pc.$id=Pc.getElementById;[MR,jR,f_,xv,gc,zR,bv,mc,WR,Ha,yl].forEach(function(t){pt(Pc,t)});var $R={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}},GR={maximal:!1,acyclic:!1},_s=function(e){return e.scratch("breadthfirst")},x1=function(e,r){return e.scratch("breadthfirst",r)};function d_(t){this.options=pt({},$R,GR,t)}d_.prototype.run=function(){var t=this.options,e=t.cy,r=t.eles,n=r.nodes().filter(function(Le){return Le.isChildless()}),i=r,s=t.directed,o=t.acyclic||t.maximal||t.maximalAdjustments>0,a=!!t.boundingBox,l=Qr(a?t.boundingBox:structuredClone(e.extent())),u;if(yn(t.roots))u=t.roots;else if(Wt(t.roots)){for(var c=[],h=0;h<t.roots.length;h++){var v=t.roots[h],d=e.getElementById(v);c.push(d)}u=e.collection(c)}else if(ct(t.roots))u=e.$(t.roots);else if(s)u=n.roots();else{var x=r.components();u=e.collection();for(var w=function(){var Ee=x[g],Ie=Ee.maxDegree(!1),Oe=Ee.filter(function(De){return De.degree(!1)===Ie});u=u.add(Oe)},g=0;g<x.length;g++)w()}var m=[],y={},b=function(Ee,Ie){m[Ie]==null&&(m[Ie]=[]);var Oe=m[Ie].length;m[Ie].push(Ee),x1(Ee,{index:Oe,depth:Ie})},S=function(Ee,Ie){var Oe=_s(Ee),De=Oe.depth,We=Oe.index;m[De][We]=null,Ee.isChildless()&&b(Ee,Ie)};i.bfs({roots:u,directed:t.directed,visit:function(Ee,Ie,Oe,De,We){var Ye=Ee[0],ge=Ye.id();Ye.isChildless()&&b(Ye,We),y[ge]=!0}});for(var N=[],E=0;E<n.length;E++){var T=n[E];y[T.id()]||N.push(T)}var k=function(Ee){for(var Ie=m[Ee],Oe=0;Oe<Ie.length;Oe++){var De=Ie[Oe];if(De==null){Ie.splice(Oe,1),Oe--;continue}x1(De,{depth:Ee,index:Oe})}},L=function(Ee,Ie){for(var Oe=_s(Ee),De=Ee.incomers().filter(function(me){return me.isNode()&&r.has(me)}),We=-1,Ye=Ee.id(),ge=0;ge<De.length;ge++){var Ce=De[ge],Ae=_s(Ce);We=Math.max(We,Ae.depth)}if(Oe.depth<=We){if(!t.acyclic&&Ie[Ye])return null;var Fe=We+1;return S(Ee,Fe),Ie[Ye]=Fe,!0}return!1};if(s&&o){var A=[],I={},M=function(Ee){return A.push(Ee)},B=function(){return A.shift()};for(n.forEach(function(Le){return A.push(Le)});A.length>0;){var D=B(),H=L(D,I);if(H)D.outgoers().filter(function(Le){return Le.isNode()&&r.has(Le)}).forEach(M);else if(H===null){jt("Detected double maximal shift for node `"+D.id()+"`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");break}}}var U=0;if(t.avoidOverlap)for(var z=0;z<n.length;z++){var W=n[z],F=W.layoutDimensions(t),P=F.w,j=F.h;U=Math.max(U,P,j)}var G={},$=function(Ee){if(G[Ee.id()])return G[Ee.id()];for(var Ie=_s(Ee).depth,Oe=Ee.neighborhood(),De=0,We=0,Ye=0;Ye<Oe.length;Ye++){var ge=Oe[Ye];if(!(ge.isEdge()||ge.isParent()||!n.has(ge))){var Ce=_s(ge);if(Ce!=null){var Ae=Ce.index,Fe=Ce.depth;if(!(Ae==null||Fe==null)){var me=m[Fe].length;Fe<Ie&&(De+=Ae/me,We++)}}}}return We=Math.max(1,We),De=De/We,We===0&&(De=0),G[Ee.id()]=De,De},ee=function(Ee,Ie){var Oe=$(Ee),De=$(Ie),We=Oe-De;return We===0?pw(Ee.id(),Ie.id()):We};t.depthSort!==void 0&&(ee=t.depthSort);for(var ae=m.length,ie=0;ie<ae;ie++)m[ie].sort(ee),k(ie);for(var K=[],q=0;q<N.length;q++)K.push(N[q]);var Y=function(){for(var Ee=0;Ee<ae;Ee++)k(Ee)};K.length&&(m.unshift(K),ae=m.length,Y());for(var X=0,J=0;J<ae;J++)X=Math.max(m[J].length,X);var re={x:l.x1+l.w/2,y:l.y1+l.h/2},ce=n.reduce(function(Le,Ee){return(function(Ie){return{w:Le.w===-1?Ie.w:(Le.w+Ie.w)/2,h:Le.h===-1?Ie.h:(Le.h+Ie.h)/2}})(Ee.boundingBox({includeLabels:t.nodeDimensionsIncludeLabels}))},{w:-1,h:-1}),de=Math.max(ae===1?0:a?(l.h-t.padding*2-ce.h)/(ae-1):(l.h-t.padding*2-ce.h)/(ae+1),U),Re=m.reduce(function(Le,Ee){return Math.max(Le,Ee.length)},0),Pe=function(Ee){var Ie=_s(Ee),Oe=Ie.depth,De=Ie.index;if(t.circle){var We=Math.min(l.w/2/ae,l.h/2/ae);We=Math.max(We,U);var Ye=We*Oe+We-(ae>0&&m[0].length<=3?We/2:0),ge=2*Math.PI/m[Oe].length*De;return Oe===0&&m[0].length===1&&(Ye=1),{x:re.x+Ye*Math.cos(ge),y:re.y+Ye*Math.sin(ge)}}else{var Ce=m[Oe].length,Ae=Math.max(Ce===1?0:a?(l.w-t.padding*2-ce.w)/((t.grid?Re:Ce)-1):(l.w-t.padding*2-ce.w)/((t.grid?Re:Ce)+1),U),Fe={x:re.x+(De+1-(Ce+1)/2)*Ae,y:re.y+(Oe+1-(ae+1)/2)*de};return Fe}},_e={downward:0,leftward:90,upward:180,rightward:-90};Object.keys(_e).indexOf(t.direction)===-1&&er("Invalid direction '".concat(t.direction,"' specified for breadthfirst layout. Valid values are: ").concat(Object.keys(_e).join(", ")));var ke=function(Ee){return o3(Pe(Ee),l,_e[t.direction])};return r.nodes().layoutPositions(this,t,ke),this};var qR={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 p_(t){this.options=pt({},qR,t)}p_.prototype.run=function(){var t=this.options,e=t,r=t.cy,n=e.eles,i=e.counterclockwise!==void 0?!e.counterclockwise:e.clockwise,s=n.nodes().not(":parent");e.sort&&(s=s.sort(e.sort));for(var o=Qr(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()}),a={x:o.x1+o.w/2,y:o.y1+o.h/2},l=e.sweep===void 0?2*Math.PI-2*Math.PI/s.length:e.sweep,u=l/Math.max(1,s.length-1),c,h=0,v=0;v<s.length;v++){var d=s[v],x=d.layoutDimensions(e),w=x.w,g=x.h;h=Math.max(h,w,g)}if(Ke(e.radius)?c=e.radius:s.length<=1?c=0:c=Math.min(o.h,o.w)/2-h,s.length>1&&e.avoidOverlap){h*=1.75;var m=Math.cos(u)-Math.cos(0),y=Math.sin(u)-Math.sin(0),b=Math.sqrt(h*h/(m*m+y*y));c=Math.max(b,c)}var S=function(E,T){var k=e.startAngle+T*u*(i?1:-1),L=c*Math.cos(k),A=c*Math.sin(k),I={x:a.x+L,y:a.y+A};return I};return n.nodes().layoutPositions(this,e,S),this};var YR={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 v_(t){this.options=pt({},YR,t)}v_.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,s=i.nodes().not(":parent"),o=Qr(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()}),a={x:o.x1+o.w/2,y:o.y1+o.h/2},l=[],u=0,c=0;c<s.length;c++){var h=s[c],v=void 0;v=e.concentric(h),l.push({value:v,node:h}),h._private.scratch.concentric=v}s.updateStyle();for(var d=0;d<s.length;d++){var x=s[d],w=x.layoutDimensions(e);u=Math.max(u,w.w,w.h)}l.sort(function(de,Re){return Re.value-de.value});for(var g=e.levelWidth(s),m=[[]],y=m[0],b=0;b<l.length;b++){var S=l[b];if(y.length>0){var N=Math.abs(y[0].value-S.value);N>=g&&(y=[],m.push(y))}y.push(S)}var E=u+e.minNodeSpacing;if(!e.avoidOverlap){var T=m.length>0&&m[0].length>1,k=Math.min(o.w,o.h)/2-E,L=k/(m.length+T?1:0);E=Math.min(E,L)}for(var A=0,I=0;I<m.length;I++){var M=m[I],B=e.sweep===void 0?2*Math.PI-2*Math.PI/M.length:e.sweep,D=M.dTheta=B/Math.max(1,M.length-1);if(M.length>1&&e.avoidOverlap){var H=Math.cos(D)-Math.cos(0),U=Math.sin(D)-Math.sin(0),z=Math.sqrt(E*E/(H*H+U*U));A=Math.max(z,A)}M.r=A,A+=E}if(e.equidistant){for(var W=0,F=0,P=0;P<m.length;P++){var j=m[P],G=j.r-F;W=Math.max(W,G)}F=0;for(var $=0;$<m.length;$++){var ee=m[$];$===0&&(F=ee.r),ee.r=F,F+=W}}for(var ae={},ie=0;ie<m.length;ie++)for(var K=m[ie],q=K.dTheta,Y=K.r,X=0;X<K.length;X++){var J=K[X],re=e.startAngle+(r?1:-1)*q*X,ce={x:a.x+Y*Math.cos(re),y:a.y+Y*Math.sin(re)};ae[J.node.id()]=ce}return i.nodes().layoutPositions(this,e,function(de){var Re=de.id();return ae[Re]}),this};var Rp,XR={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 sh(t){this.options=pt({},XR,t),this.options.layout=this;var e=this.options.eles.nodes(),r=this.options.eles.edges(),n=r.filter(function(i){var s=i.source().data("id"),o=i.target().data("id"),a=e.some(function(u){return u.data("id")===s}),l=e.some(function(u){return u.data("id")===o});return!a||!l});this.options.eles=this.options.eles.not(n)}sh.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?Rp=!0:Rp=!1;var n=KR(e,r,t);Rp&&ZR(n),t.randomize&&JR(n);var i=gi(),s=function(){eL(n,e,t),t.fit===!0&&e.fit(t.padding)},o=function(v){return!(r.stopped||v>=t.numIter||(tL(n,t),n.temperature=n.temperature*t.coolingFactor,n.temperature<t.minTemp))},a=function(){if(t.animate===!0||t.animate===!1)s(),r.one("layoutstop",t.stop),r.emit({type:"layoutstop",layout:r});else{var v=t.eles.nodes(),d=m_(n,t,v);v.layoutPositions(r,t,d)}},l=0,u=!0;if(t.animate===!0){var c=function(){for(var v=0;u&&v<t.refresh;)u=o(l),l++,v++;if(!u)w1(n,t),a();else{var d=gi();d-i>=t.animationThreshold&&s(),Nc(c)}};c()}else{for(;u;)u=o(l),l++;w1(n,t),a()}return this};sh.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this};sh.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var KR=function(e,r,n){for(var i=n.eles.edges(),s=n.eles.nodes(),o=Qr(n.boundingBox?n.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),a={isCompound:e.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:s.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:i.size(),temperature:n.initialTemp,clientWidth:o.w,clientHeight:o.h,boundingBox:o},l=n.eles.components(),u={},c=0;c<l.length;c++)for(var h=l[c],v=0;v<h.length;v++){var d=h[v];u[d.id()]=c}for(var c=0;c<a.nodeSize;c++){var x=s[c],w=x.layoutDimensions(n),g={};g.isLocked=x.locked(),g.id=x.data("id"),g.parentId=x.data("parent"),g.cmptId=u[x.id()],g.children=[],g.positionX=x.position("x"),g.positionY=x.position("y"),g.offsetX=0,g.offsetY=0,g.height=w.w,g.width=w.h,g.maxX=g.positionX+g.width/2,g.minX=g.positionX-g.width/2,g.maxY=g.positionY+g.height/2,g.minY=g.positionY-g.height/2,g.padLeft=parseFloat(x.style("padding")),g.padRight=parseFloat(x.style("padding")),g.padTop=parseFloat(x.style("padding")),g.padBottom=parseFloat(x.style("padding")),g.nodeRepulsion=ir(n.nodeRepulsion)?n.nodeRepulsion(x):n.nodeRepulsion,a.layoutNodes.push(g),a.idToIndex[g.id]=c}for(var m=[],y=0,b=-1,S=[],c=0;c<a.nodeSize;c++){var x=a.layoutNodes[c],N=x.parentId;N!=null?a.layoutNodes[a.idToIndex[N]].children.push(x.id):(m[++b]=x.id,S.push(x.id))}for(a.graphSet.push(S);y<=b;){var E=m[y++],T=a.idToIndex[E],d=a.layoutNodes[T],k=d.children;if(k.length>0){a.graphSet.push(k);for(var c=0;c<k.length;c++)m[++b]=k[c]}}for(var c=0;c<a.graphSet.length;c++)for(var L=a.graphSet[c],v=0;v<L.length;v++){var A=a.idToIndex[L[v]];a.indexToGraph[A]=c}for(var c=0;c<a.edgeSize;c++){var I=i[c],M={};M.id=I.data("id"),M.sourceId=I.data("source"),M.targetId=I.data("target");var B=ir(n.idealEdgeLength)?n.idealEdgeLength(I):n.idealEdgeLength,D=ir(n.edgeElasticity)?n.edgeElasticity(I):n.edgeElasticity,H=a.idToIndex[M.sourceId],U=a.idToIndex[M.targetId],z=a.indexToGraph[H],W=a.indexToGraph[U];if(z!=W){for(var F=QR(M.sourceId,M.targetId,a),P=a.graphSet[F],j=0,g=a.layoutNodes[H];P.indexOf(g.id)===-1;)g=a.layoutNodes[a.idToIndex[g.parentId]],j++;for(g=a.layoutNodes[U];P.indexOf(g.id)===-1;)g=a.layoutNodes[a.idToIndex[g.parentId]],j++;B*=j*n.nestingFactor}M.idealLength=B,M.elasticity=D,a.layoutEdges.push(M)}return a},QR=function(e,r,n){var i=g_(e,r,0,n);return 2>i.count?0:i.graph},g_=function(e,r,n,i){var s=i.graphSet[n];if(-1<s.indexOf(e)&&-1<s.indexOf(r))return{count:2,graph:n};for(var o=0,a=0;a<s.length;a++){var l=s[a],u=i.idToIndex[l],c=i.layoutNodes[u].children;if(c.length!==0){var h=i.indexToGraph[i.idToIndex[c[0]]],v=g_(e,r,h,i);if(v.count!==0)if(v.count===1){if(o++,o===2)break}else return v}}return{count:o,graph:n}},ZR,JR=function(e,r){for(var n=e.clientWidth,i=e.clientHeight,s=0;s<e.nodeSize;s++){var o=e.layoutNodes[s];o.children.length===0&&!o.isLocked&&(o.positionX=Math.random()*n,o.positionY=Math.random()*i)}},m_=function(e,r,n){var i=e.boundingBox,s={x1:1/0,x2:-1/0,y1:1/0,y2:-1/0};return r.boundingBox&&(n.forEach(function(o){var a=e.layoutNodes[e.idToIndex[o.data("id")]];s.x1=Math.min(s.x1,a.positionX),s.x2=Math.max(s.x2,a.positionX),s.y1=Math.min(s.y1,a.positionY),s.y2=Math.max(s.y2,a.positionY)}),s.w=s.x2-s.x1,s.h=s.y2-s.y1),function(o,a){var l=e.layoutNodes[e.idToIndex[o.data("id")]];if(r.boundingBox){var u=s.w===0?.5:(l.positionX-s.x1)/s.w,c=s.h===0?.5:(l.positionY-s.y1)/s.h;return{x:i.x1+u*i.w,y:i.y1+c*i.h}}else return{x:l.positionX,y:l.positionY}}},eL=function(e,r,n){var i=n.layout,s=n.eles.nodes(),o=m_(e,n,s);s.positions(o),e.ready!==!0&&(e.ready=!0,i.one("layoutready",n.ready),i.emit({type:"layoutready",layout:this}))},tL=function(e,r,n){rL(e,r),aL(e),sL(e,r),oL(e),lL(e)},rL=function(e,r){for(var n=0;n<e.graphSet.length;n++)for(var i=e.graphSet[n],s=i.length,o=0;o<s;o++)for(var a=e.layoutNodes[e.idToIndex[i[o]]],l=o+1;l<s;l++){var u=e.layoutNodes[e.idToIndex[i[l]]];nL(a,u,e,r)}},b1=function(e){return-e+2*e*Math.random()},nL=function(e,r,n,i){var s=e.cmptId,o=r.cmptId;if(!(s!==o&&!n.isCompound)){var a=r.positionX-e.positionX,l=r.positionY-e.positionY,u=1;a===0&&l===0&&(a=b1(u),l=b1(u));var c=iL(e,r,a,l);if(c>0)var h=i.nodeOverlap*c,v=Math.sqrt(a*a+l*l),d=h*a/v,x=h*l/v;else var w=Ic(e,a,l),g=Ic(r,-1*a,-1*l),m=g.x-w.x,y=g.y-w.y,b=m*m+y*y,v=Math.sqrt(b),h=(e.nodeRepulsion+r.nodeRepulsion)/b,d=h*m/v,x=h*y/v;e.isLocked||(e.offsetX-=d,e.offsetY-=x),r.isLocked||(r.offsetX+=d,r.offsetY+=x)}},iL=function(e,r,n,i){if(n>0)var s=e.maxX-r.minX;else var s=r.maxX-e.minX;if(i>0)var o=e.maxY-r.minY;else var o=r.maxY-e.minY;return s>=0&&o>=0?Math.sqrt(s*s+o*o):0},Ic=function(e,r,n){var i=e.positionX,s=e.positionY,o=e.height||1,a=e.width||1,l=n/r,u=o/a,c={};return r===0&&0<n||r===0&&0>n?(c.x=i,c.y=s+o/2,c):0<r&&-1*u<=l&&l<=u?(c.x=i+a/2,c.y=s+a*n/2/r,c):0>r&&-1*u<=l&&l<=u?(c.x=i-a/2,c.y=s-a*n/2/r,c):0<n&&(l<=-1*u||l>=u)?(c.x=i+o*r/2/n,c.y=s+o/2,c):(0>n&&(l<=-1*u||l>=u)&&(c.x=i-o*r/2/n,c.y=s-o/2),c)},aL=function(e,r){for(var n=0;n<e.edgeSize;n++){var i=e.layoutEdges[n],s=e.idToIndex[i.sourceId],o=e.layoutNodes[s],a=e.idToIndex[i.targetId],l=e.layoutNodes[a],u=l.positionX-o.positionX,c=l.positionY-o.positionY;if(!(u===0&&c===0)){var h=Ic(o,u,c),v=Ic(l,-1*u,-1*c),d=v.x-h.x,x=v.y-h.y,w=Math.sqrt(d*d+x*x),g=Math.pow(i.idealLength-w,2)/i.elasticity;if(w!==0)var m=g*d/w,y=g*x/w;else var m=0,y=0;o.isLocked||(o.offsetX+=m,o.offsetY+=y),l.isLocked||(l.offsetX-=m,l.offsetY-=y)}}},sL=function(e,r){if(r.gravity!==0)for(var n=1,i=0;i<e.graphSet.length;i++){var s=e.graphSet[i],o=s.length;if(i===0)var a=e.clientHeight/2,l=e.clientWidth/2;else var u=e.layoutNodes[e.idToIndex[s[0]]],c=e.layoutNodes[e.idToIndex[u.parentId]],a=c.positionX,l=c.positionY;for(var h=0;h<o;h++){var v=e.layoutNodes[e.idToIndex[s[h]]];if(!v.isLocked){var d=a-v.positionX,x=l-v.positionY,w=Math.sqrt(d*d+x*x);if(w>n){var g=r.gravity*d/w,m=r.gravity*x/w;v.offsetX+=g,v.offsetY+=m}}}}},oL=function(e,r){var n=[],i=0,s=-1;for(n.push.apply(n,e.graphSet[0]),s+=e.graphSet[0].length;i<=s;){var o=n[i++],a=e.idToIndex[o],l=e.layoutNodes[a],u=l.children;if(0<u.length&&!l.isLocked){for(var c=l.offsetX,h=l.offsetY,v=0;v<u.length;v++){var d=e.layoutNodes[e.idToIndex[u[v]]];d.offsetX+=c,d.offsetY+=h,n[++s]=u[v]}l.offsetX=0,l.offsetY=0}}},lL=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 s=uL(i.offsetX,i.offsetY,e.temperature);i.positionX+=s.x,i.positionY+=s.y,i.offsetX=0,i.offsetY=0,i.minX=i.positionX-i.width,i.maxX=i.positionX+i.width,i.minY=i.positionY-i.height,i.maxY=i.positionY+i.height,y_(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)}},uL=function(e,r,n){var i=Math.sqrt(e*e+r*r);if(i>n)var s={x:n*e/i,y:n*r/i};else var s={x:e,y:r};return s},y_=function(e,r){var n=e.parentId;if(n!=null){var i=r.layoutNodes[r.idToIndex[n]],s=!1;if((i.maxX==null||e.maxX+i.padRight>i.maxX)&&(i.maxX=e.maxX+i.padRight,s=!0),(i.minX==null||e.minX-i.padLeft<i.minX)&&(i.minX=e.minX-i.padLeft,s=!0),(i.maxY==null||e.maxY+i.padBottom>i.maxY)&&(i.maxY=e.maxY+i.padBottom,s=!0),(i.minY==null||e.minY-i.padTop<i.minY)&&(i.minY=e.minY-i.padTop,s=!0),s)return y_(i,r)}},w1=function(e,r){for(var n=e.layoutNodes,i=[],s=0;s<n.length;s++){var o=n[s],a=o.cmptId,l=i[a]=i[a]||[];l.push(o)}for(var u=0,s=0;s<i.length;s++){var c=i[s];if(c){c.x1=1/0,c.x2=-1/0,c.y1=1/0,c.y2=-1/0;for(var h=0;h<c.length;h++){var v=c[h];c.x1=Math.min(c.x1,v.positionX-v.width/2),c.x2=Math.max(c.x2,v.positionX+v.width/2),c.y1=Math.min(c.y1,v.positionY-v.height/2),c.y2=Math.max(c.y2,v.positionY+v.height/2)}c.w=c.x2-c.x1,c.h=c.y2-c.y1,u+=c.w*c.h}}i.sort(function(y,b){return b.w*b.h-y.w*y.h});for(var d=0,x=0,w=0,g=0,m=Math.sqrt(u)*e.clientWidth/e.clientHeight,s=0;s<i.length;s++){var c=i[s];if(c){for(var h=0;h<c.length;h++){var v=c[h];v.isLocked||(v.positionX+=d-c.x1,v.positionY+=x-c.y1)}d+=c.w+r.componentSpacing,w+=c.w+r.componentSpacing,g=Math.max(g,c.h),w>m&&(x+=g+r.componentSpacing,d=0,w=0,g=0)}}},cL={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 x_(t){this.options=pt({},cL,t)}x_.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 s=Qr(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()});if(s.h===0||s.w===0)n.nodes().layoutPositions(this,e,function($){return{x:s.x1,y:s.y1}});else{var o=i.size(),a=Math.sqrt(o*s.h/s.w),l=Math.round(a),u=Math.round(s.w/s.h*a),c=function(ee){if(ee==null)return Math.min(l,u);var ae=Math.min(l,u);ae==l?l=ee:u=ee},h=function(ee){if(ee==null)return Math.max(l,u);var ae=Math.max(l,u);ae==l?l=ee:u=ee},v=e.rows,d=e.cols!=null?e.cols:e.columns;if(v!=null&&d!=null)l=v,u=d;else if(v!=null&&d==null)l=v,u=Math.ceil(o/l);else if(v==null&&d!=null)u=d,l=Math.ceil(o/u);else if(u*l>o){var x=c(),w=h();(x-1)*w>=o?c(x-1):(w-1)*x>=o&&h(w-1)}else for(;u*l<o;){var g=c(),m=h();(m+1)*g>=o?h(m+1):c(g+1)}var y=s.w/u,b=s.h/l;if(e.condense&&(y=0,b=0),e.avoidOverlap)for(var S=0;S<i.length;S++){var N=i[S],E=N._private.position;(E.x==null||E.y==null)&&(E.x=0,E.y=0);var T=N.layoutDimensions(e),k=e.avoidOverlapPadding,L=T.w+k,A=T.h+k;y=Math.max(y,L),b=Math.max(b,A)}for(var I={},M=function(ee,ae){return!!I["c-"+ee+"-"+ae]},B=function(ee,ae){I["c-"+ee+"-"+ae]=!0},D=0,H=0,U=function(){H++,H>=u&&(H=0,D++)},z={},W=0;W<i.length;W++){var F=i[W],P=e.position(F);if(P&&(P.row!==void 0||P.col!==void 0)){var j={row:P.row,col:P.col};if(j.col===void 0)for(j.col=0;M(j.row,j.col);)j.col++;else if(j.row===void 0)for(j.row=0;M(j.row,j.col);)j.row++;z[F.id()]=j,B(j.row,j.col)}}var G=function(ee,ae){var ie,K;if(ee.locked()||ee.isParent())return!1;var q=z[ee.id()];if(q)ie=q.col*y+y/2+s.x1,K=q.row*b+b/2+s.y1;else{for(;M(D,H);)U();ie=H*y+y/2+s.x1,K=D*b+b/2+s.y1,B(D,H),U()}return{x:ie,y:K}};i.layoutPositions(this,e,G)}return this};var hL={ready:function(){},stop:function(){}};function hg(t){this.options=pt({},hL,t)}hg.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};hg.prototype.stop=function(){return this};var fL={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 b_(t){this.options=pt({},fL,t)}b_.prototype.run=function(){var t=this.options,e=t.eles,r=e.nodes(),n=ir(t.positions);function i(s){if(t.positions==null)return M3(s.position());if(n)return t.positions(s);var o=t.positions[s._private.data.id];return o??null}return r.layoutPositions(this,t,function(s,o){var a=i(s);return s.locked()||a==null?!1:a}),this};var dL={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 w_(t){this.options=pt({},dL,t)}w_.prototype.run=function(){var t=this.options,e=t.cy,r=t.eles,n=Qr(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),i=function(o,a){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 pL=[{name:"breadthfirst",impl:d_},{name:"circle",impl:p_},{name:"concentric",impl:v_},{name:"cose",impl:sh},{name:"grid",impl:x_},{name:"null",impl:hg},{name:"preset",impl:b_},{name:"random",impl:w_}];function __(t){this.options=t,this.notifications=0}var _1=function(){},S1=function(){throw new Error("A headless instance can not render images")};__.prototype={recalculateRenderedStyle:_1,notify:function(){this.notifications++},init:_1,isHeadless:function(){return!0},png:S1,jpg:S1};var fg={};fg.arrowShapeWidth=.3;fg.registerArrowShapes=function(){var t=this.arrowShapes={},e=this,r=function(u,c,h,v,d,x,w){var g=d.x-h/2-w,m=d.x+h/2+w,y=d.y-h/2-w,b=d.y+h/2+w,S=g<=u&&u<=m&&y<=c&&c<=b;return S},n=function(u,c,h,v,d){var x=u*Math.cos(v)-c*Math.sin(v),w=u*Math.sin(v)+c*Math.cos(v),g=x*h,m=w*h,y=g+d.x,b=m+d.y;return{x:y,y:b}},i=function(u,c,h,v){for(var d=[],x=0;x<u.length;x+=2){var w=u[x],g=u[x+1];d.push(n(w,g,c,h,v))}return d},s=function(u){for(var c=[],h=0;h<u.length;h++){var v=u[h];c.push(v.x,v.y)}return c},o=function(u){return u.pstyle("width").pfValue*u.pstyle("arrow-scale").pfValue*2},a=function(u,c){ct(c)&&(c=t[c]),t[u]=pt({name:u,points:[-.15,-.3,.15,-.3,.15,.3,-.15,.3],collide:function(v,d,x,w,g,m){var y=s(i(this.points,x+2*m,w,g)),b=on(v,d,y);return b},roughCollide:r,draw:function(v,d,x,w){var g=i(this.points,d,x,w);e.arrowShapeImpl("polygon")(v,g)},spacing:function(v){return 0},gap:o},c)};a("none",{collide:Rc,roughCollide:Rc,draw:Qv,spacing:B0,gap:B0}),a("triangle",{points:[-.15,-.3,0,0,.15,-.3]}),a("arrow","triangle"),a("triangle-backcurve",{points:t.triangle.points,controlPoint:[0,-.15],roughCollide:r,draw:function(u,c,h,v,d){var x=i(this.points,c,h,v),w=this.controlPoint,g=n(w[0],w[1],c,h,v);e.arrowShapeImpl(this.name)(u,x,g)},gap:function(u){return o(u)*.8}}),a("triangle-tee",{points:[0,0,.15,-.3,-.15,-.3,0,0],pointsTee:[-.15,-.4,-.15,-.5,.15,-.5,.15,-.4],collide:function(u,c,h,v,d,x,w){var g=s(i(this.points,h+2*w,v,d)),m=s(i(this.pointsTee,h+2*w,v,d)),y=on(u,c,g)||on(u,c,m);return y},draw:function(u,c,h,v,d){var x=i(this.points,c,h,v),w=i(this.pointsTee,c,h,v);e.arrowShapeImpl(this.name)(u,x,w)}}),a("circle-triangle",{radius:.15,pointsTr:[0,-.15,.15,-.45,-.15,-.45,0,-.15],collide:function(u,c,h,v,d,x,w){var g=d,m=Math.pow(g.x-u,2)+Math.pow(g.y-c,2)<=Math.pow((h+2*w)*this.radius,2),y=s(i(this.points,h+2*w,v,d));return on(u,c,y)||m},draw:function(u,c,h,v,d){var x=i(this.pointsTr,c,h,v);e.arrowShapeImpl(this.name)(u,x,v.x,v.y,this.radius*c)},spacing:function(u){return e.getArrowWidth(u.pstyle("width").pfValue,u.pstyle("arrow-scale").value)*this.radius}}),a("triangle-cross",{points:[0,0,.15,-.3,-.15,-.3,0,0],baseCrossLinePts:[-.15,-.4,-.15,-.4,.15,-.4,.15,-.4],crossLinePts:function(u,c){var h=this.baseCrossLinePts.slice(),v=c/u,d=3,x=5;return h[d]=h[d]-v,h[x]=h[x]-v,h},collide:function(u,c,h,v,d,x,w){var g=s(i(this.points,h+2*w,v,d)),m=s(i(this.crossLinePts(h,x),h+2*w,v,d)),y=on(u,c,g)||on(u,c,m);return y},draw:function(u,c,h,v,d){var x=i(this.points,c,h,v),w=i(this.crossLinePts(c,d),c,h,v);e.arrowShapeImpl(this.name)(u,x,w)}}),a("vee",{points:[-.15,-.3,0,0,.15,-.3,0,-.15],gap:function(u){return o(u)*.525}}),a("circle",{radius:.15,collide:function(u,c,h,v,d,x,w){var g=d,m=Math.pow(g.x-u,2)+Math.pow(g.y-c,2)<=Math.pow((h+2*w)*this.radius,2);return m},draw:function(u,c,h,v,d){e.arrowShapeImpl(this.name)(u,v.x,v.y,this.radius*c)},spacing:function(u){return e.getArrowWidth(u.pstyle("width").pfValue,u.pstyle("arrow-scale").value)*this.radius}}),a("tee",{points:[-.15,0,-.15,-.1,.15,-.1,.15,0],spacing:function(u){return 1},gap:function(u){return 1}}),a("square",{points:[-.15,0,.15,0,.15,-.3,-.15,-.3]}),a("diamond",{points:[-.15,-.15,0,-.3,.15,-.15,0,0],gap:function(u){return u.pstyle("width").pfValue*u.pstyle("arrow-scale").value}}),a("chevron",{points:[0,0,-.15,-.15,-.1,-.2,0,-.1,.1,-.2,.15,-.15],gap:function(u){return .95*u.pstyle("width").pfValue*u.pstyle("arrow-scale").value}})};var Va={};Va.projectIntoViewport=function(t,e){var r=this.cy,n=this.findContainerClientCoords(),i=n[0],s=n[1],o=n[4],a=r.pan(),l=r.zoom(),u=((t-i)/o-a.x)/l,c=((e-s)/o-a.y)/l;return[u,c]};Va.findContainerClientCoords=function(){if(this.containerBB)return this.containerBB;var t=this.container,e=t.getBoundingClientRect(),r=this.cy.window().getComputedStyle(t),n=function(m){return parseFloat(r.getPropertyValue(m))},i={left:n("padding-left"),right:n("padding-right"),top:n("padding-top"),bottom:n("padding-bottom")},s={left:n("border-left-width"),right:n("border-right-width"),top:n("border-top-width"),bottom:n("border-bottom-width")},o=t.clientWidth,a=t.clientHeight,l=i.left+i.right,u=i.top+i.bottom,c=s.left+s.right,h=e.width/(o+c),v=o-l,d=a-u,x=e.left+i.left+s.left,w=e.top+i.top+s.top;return this.containerBB=[x,w,v,d,h]};Va.invalidateContainerClientCoordsCache=function(){this.containerBB=null};Va.findNearestElement=function(t,e,r,n){return this.findNearestElements(t,e,r,n)[0]};Va.findNearestElements=function(t,e,r,n){var i=this,s=this,o=s.getCachedZSortedEles(),a=[],l=s.cy.zoom(),u=s.cy.hasCompoundNodes(),c=(n?24:8)/l,h=(n?8:2)/l,v=(n?8:2)/l,d=1/0,x,w;r&&(o=o.interactive);function g(T,k){if(T.isNode()){if(w)return;w=T,a.push(T)}if(T.isEdge()&&(k==null||k<d))if(x){if(x.pstyle("z-compound-depth").value===T.pstyle("z-compound-depth").value&&x.pstyle("z-compound-depth").value===T.pstyle("z-compound-depth").value){for(var L=0;L<a.length;L++)if(a[L].isEdge()){a[L]=T,x=T,d=k??d;break}}}else a.push(T),x=T,d=k??d}function m(T){var k=T.outerWidth()+2*h,L=T.outerHeight()+2*h,A=k/2,I=L/2,M=T.position(),B=T.pstyle("corner-radius").value==="auto"?"auto":T.pstyle("corner-radius").pfValue,D=T._private.rscratch;if(M.x-A<=t&&t<=M.x+A&&M.y-I<=e&&e<=M.y+I){var H=s.nodeShapes[i.getNodeShape(T)];if(H.checkPoint(t,e,0,k,L,M.x,M.y,B,D))return g(T,0),!0}}function y(T){var k=T._private,L=k.rscratch,A=T.pstyle("width").pfValue,I=T.pstyle("arrow-scale").value,M=A/2+c,B=M*M,D=M*2,W=k.source,F=k.target,H;if(L.edgeType==="segments"||L.edgeType==="straight"||L.edgeType==="haystack"){for(var U=L.allpts,z=0;z+3<U.length;z+=2)if(q3(t,e,U[z],U[z+1],U[z+2],U[z+3],D)&&B>(H=Z3(t,e,U[z],U[z+1],U[z+2],U[z+3])))return g(T,H),!0}else if(L.edgeType==="bezier"||L.edgeType==="multibezier"||L.edgeType==="self"||L.edgeType==="compound"){for(var U=L.allpts,z=0;z+5<L.allpts.length;z+=4)if(Y3(t,e,U[z],U[z+1],U[z+2],U[z+3],U[z+4],U[z+5],D)&&B>(H=Q3(t,e,U[z],U[z+1],U[z+2],U[z+3],U[z+4],U[z+5])))return g(T,H),!0}for(var W=W||k.source,F=F||k.target,P=i.getArrowWidth(A,I),j=[{name:"source",x:L.arrowStartX,y:L.arrowStartY,angle:L.srcArrowAngle},{name:"target",x:L.arrowEndX,y:L.arrowEndY,angle:L.tgtArrowAngle},{name:"mid-source",x:L.midX,y:L.midY,angle:L.midsrcArrowAngle},{name:"mid-target",x:L.midX,y:L.midY,angle:L.midtgtArrowAngle}],z=0;z<j.length;z++){var G=j[z],$=s.arrowShapes[T.pstyle(G.name+"-arrow-shape").value],ee=T.pstyle("width").pfValue;if($.roughCollide(t,e,P,G.angle,{x:G.x,y:G.y},ee,c)&&$.collide(t,e,P,G.angle,{x:G.x,y:G.y},ee,c))return g(T),!0}u&&a.length>0&&(m(W),m(F))}function b(T,k,L){return Xr(T,k,L)}function S(T,k){var L=T._private,A=v,I;k?I=k+"-":I="",T.boundingBox();var M=L.labelBounds[k||"main"],B=T.pstyle(I+"label").value,D=T.pstyle("text-events").strValue==="yes";if(!(!D||!B)){var H=b(L.rscratch,"labelX",k),U=b(L.rscratch,"labelY",k),z=b(L.rscratch,"labelAngle",k),W=T.pstyle(I+"text-margin-x").pfValue,F=T.pstyle(I+"text-margin-y").pfValue,P=M.x1-A-W,j=M.x2+A-W,G=M.y1-A-F,$=M.y2+A-F;if(z){var ee=Math.cos(z),ae=Math.sin(z),ie=function(ce,de){return ce=ce-H,de=de-U,{x:ce*ee-de*ae+H,y:ce*ae+de*ee+U}},K=ie(P,G),q=ie(P,$),Y=ie(j,G),X=ie(j,$),J=[K.x+W,K.y+F,Y.x+W,Y.y+F,X.x+W,X.y+F,q.x+W,q.y+F];if(on(t,e,J))return g(T),!0}else if(Yi(M,t,e))return g(T),!0}}for(var N=o.length-1;N>=0;N--){var E=o[N];E.isNode()?m(E)||S(E):y(E)||S(E)||S(E,"source")||S(E,"target")}return a};Va.getAllInBox=function(t,e,r,n){var i=this.getCachedZSortedEles().interactive,s=this.cy.zoom(),o=2/s,a=[],l=Math.min(t,r),u=Math.max(t,r),c=Math.min(e,n),h=Math.max(e,n);t=l,r=u,e=c,n=h;var v=Qr({x1:t,y1:e,x2:r,y2:n}),d=[{x:v.x1,y:v.y1},{x:v.x2,y:v.y1},{x:v.x2,y:v.y2},{x:v.x1,y:v.y2}],x=[[d[0],d[1]],[d[1],d[2]],[d[2],d[3]],[d[3],d[0]]];function w(ce,de,Re){return Xr(ce,de,Re)}function g(ce,de){var Re=ce._private,Pe=o,_e="";ce.boundingBox();var ke=Re.labelBounds.main;if(!ke)return null;var Le=w(Re.rscratch,"labelX",de),Ee=w(Re.rscratch,"labelY",de),Ie=w(Re.rscratch,"labelAngle",de),Oe=ce.pstyle(_e+"text-margin-x").pfValue,De=ce.pstyle(_e+"text-margin-y").pfValue,We=ke.x1-Pe-Oe,Ye=ke.x2+Pe-Oe,ge=ke.y1-Pe-De,Ce=ke.y2+Pe-De;if(Ie){var Ae=Math.cos(Ie),Fe=Math.sin(Ie),me=function(te,oe){return te=te-Le,oe=oe-Ee,{x:te*Ae-oe*Fe+Le,y:te*Fe+oe*Ae+Ee}};return[me(We,ge),me(Ye,ge),me(Ye,Ce),me(We,Ce)]}else return[{x:We,y:ge},{x:Ye,y:ge},{x:Ye,y:Ce},{x:We,y:Ce}]}function m(ce,de,Re,Pe){function _e(ke,Le,Ee){return(Ee.y-ke.y)*(Le.x-ke.x)>(Le.y-ke.y)*(Ee.x-ke.x)}return _e(ce,Re,Pe)!==_e(de,Re,Pe)&&_e(ce,de,Re)!==_e(ce,de,Pe)}for(var y=0;y<i.length;y++){var b=i[y];if(b.isNode()){var S=b,N=S.pstyle("text-events").strValue==="yes",E=S.pstyle("box-selection").strValue,T=S.pstyle("box-select-labels").strValue==="yes";if(E==="none")continue;var k=(E==="overlap"||T)&&N,L=S.boundingBox({includeNodes:!0,includeEdges:!1,includeLabels:k});if(E==="contain"){var A=!1;if(T&&N){var I=g(S);I&&Td(I,d)&&(a.push(S),A=!0)}!A&&Rw(v,L)&&a.push(S)}else if(E==="overlap"&&tg(v,L)){var M=S.boundingBox({includeNodes:!0,includeEdges:!0,includeLabels:!1,includeMainLabels:!1,includeSourceLabels:!1,includeTargetLabels:!1}),B=[{x:M.x1,y:M.y1},{x:M.x2,y:M.y1},{x:M.x2,y:M.y2},{x:M.x1,y:M.y2}];if(Td(B,d))a.push(S);else{var D=g(S);D&&Td(D,d)&&a.push(S)}}}else{var H=b,U=H._private,z=U.rscratch,W=H.pstyle("box-selection").strValue;if(W==="none")continue;if(W==="contain"){if(z.startX!=null&&z.startY!=null&&!Yi(v,z.startX,z.startY)||z.endX!=null&&z.endY!=null&&!Yi(v,z.endX,z.endY))continue;if(z.edgeType==="bezier"||z.edgeType==="multibezier"||z.edgeType==="self"||z.edgeType==="compound"||z.edgeType==="segments"||z.edgeType==="haystack"){for(var F=U.rstyle.bezierPts||U.rstyle.linePts||U.rstyle.haystackPts,P=!0,j=0;j<F.length;j++)if(!U0(v,F[j])){P=!1;break}P&&a.push(H)}else z.edgeType==="straight"&&a.push(H)}else if(W==="overlap"){var G=!1;if(z.startX!=null&&z.startY!=null&&z.endX!=null&&z.endY!=null&&(Yi(v,z.startX,z.startY)||Yi(v,z.endX,z.endY)))a.push(H),G=!0;else if(!G&&z.edgeType==="haystack"){for(var $=U.rstyle.haystackPts,ee=0;ee<$.length;ee++)if(U0(v,$[ee])){a.push(H),G=!0;break}}if(!G){var ae=U.rstyle.bezierPts||U.rstyle.linePts||U.rstyle.haystackPts;if((!ae||ae.length<2)&&z.edgeType==="straight"&&z.startX!=null&&z.startY!=null&&z.endX!=null&&z.endY!=null&&(ae=[{x:z.startX,y:z.startY},{x:z.endX,y:z.endY}]),!ae||ae.length<2)continue;for(var ie=0;ie<ae.length-1;ie++){for(var K=ae[ie],q=ae[ie+1],Y=0;Y<x.length;Y++){var X=vr(x[Y],2),J=X[0],re=X[1];if(m(K,q,J,re)){a.push(H),G=!0;break}}if(G)break}}}}}return a};var Oc={};Oc.calculateArrowAngles=function(t){var e=t._private.rscratch,r=e.edgeType==="haystack",n=e.edgeType==="bezier",i=e.edgeType==="multibezier",s=e.edgeType==="segments",o=e.edgeType==="compound",a=e.edgeType==="self",l,u,c,h,v,d,m,y;if(r?(c=e.haystackPts[0],h=e.haystackPts[1],v=e.haystackPts[2],d=e.haystackPts[3]):(c=e.arrowStartX,h=e.arrowStartY,v=e.arrowEndX,d=e.arrowEndY),m=e.midX,y=e.midY,s)l=c-e.segpts[0],u=h-e.segpts[1];else if(i||o||a||n){var x=e.allpts,w=Er(x[0],x[2],x[4],.1),g=Er(x[1],x[3],x[5],.1);l=c-w,u=h-g}else l=c-m,u=h-y;e.srcArrowAngle=qu(l,u);var m=e.midX,y=e.midY;if(r&&(m=(c+v)/2,y=(h+d)/2),l=v-c,u=d-h,s){var x=e.allpts;if(x.length/2%2===0){var b=x.length/2,S=b-2;l=x[b]-x[S],u=x[b+1]-x[S+1]}else if(e.isRound)l=e.midVector[1],u=-e.midVector[0];else{var b=x.length/2-1,S=b-2;l=x[b]-x[S],u=x[b+1]-x[S+1]}}else if(i||o||a){var x=e.allpts,N=e.ctrlpts,E,T,k,L;if(N.length/2%2===0){var A=x.length/2-1,I=A+2,M=I+2;E=Er(x[A],x[I],x[M],0),T=Er(x[A+1],x[I+1],x[M+1],0),k=Er(x[A],x[I],x[M],1e-4),L=Er(x[A+1],x[I+1],x[M+1],1e-4)}else{var I=x.length/2-1,A=I-2,M=I+2;E=Er(x[A],x[I],x[M],.4999),T=Er(x[A+1],x[I+1],x[M+1],.4999),k=Er(x[A],x[I],x[M],.5),L=Er(x[A+1],x[I+1],x[M+1],.5)}l=k-E,u=L-T}if(e.midtgtArrowAngle=qu(l,u),e.midDispX=l,e.midDispY=u,l*=-1,u*=-1,s){var x=e.allpts;if(x.length/2%2!==0){if(!e.isRound){var b=x.length/2-1,B=b+2;l=-(x[B]-x[b]),u=-(x[B+1]-x[b+1])}}}if(e.midsrcArrowAngle=qu(l,u),s)l=v-e.segpts[e.segpts.length-2],u=d-e.segpts[e.segpts.length-1];else if(i||o||a||n){var x=e.allpts,D=x.length,w=Er(x[D-6],x[D-4],x[D-2],.9),g=Er(x[D-5],x[D-3],x[D-1],.9);l=v-w,u=d-g}else l=v-m,u=d-y;e.tgtArrowAngle=qu(l,u)};Oc.getArrowWidth=Oc.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 wv,_v,Kn={},Tn={},C1,E1,Pa,yc,pi,ka,Da,Yn,Ss,tc,S_,C_,Sv,Cv,k1,T1=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)},vL=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},gL=function(e,r,n,i,s){if(e!==k1?T1(r,e,Kn):vL(Tn,Kn),T1(r,n,Tn),C1=Kn.nx*Tn.ny-Kn.ny*Tn.nx,E1=Kn.nx*Tn.nx-Kn.ny*-Tn.ny,pi=Math.asin(Math.max(-1,Math.min(1,C1))),Math.abs(pi)<1e-6){wv=r.x,_v=r.y,Da=Ss=0;return}Pa=1,yc=!1,E1<0?pi<0?pi=Math.PI+pi:(pi=Math.PI-pi,Pa=-1,yc=!0):pi>0&&(Pa=-1,yc=!0),r.radius!==void 0?Ss=r.radius:Ss=i,ka=pi/2,tc=Math.min(Kn.len/2,Tn.len/2),s?(Yn=Math.abs(Math.cos(ka)*Ss/Math.sin(ka)),Yn>tc?(Yn=tc,Da=Math.abs(Yn*Math.sin(ka)/Math.cos(ka))):Da=Ss):(Yn=Math.min(tc,Ss),Da=Math.abs(Yn*Math.sin(ka)/Math.cos(ka))),Sv=r.x+Tn.nx*Yn,Cv=r.y+Tn.ny*Yn,wv=Sv-Tn.ny*Da*Pa,_v=Cv+Tn.nx*Da*Pa,S_=r.x+Kn.nx*Yn,C_=r.y+Kn.ny*Yn,k1=r};function E_(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 dg(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}:(gL(t,e,r,n,i),{cx:wv,cy:_v,radius:Da,startX:S_,startY:C_,stopX:Sv,stopY:Cv,startAngle:Kn.ang+Math.PI/2*Pa,endAngle:Tn.ang-Math.PI/2*Pa,counterClockwise:yc})}var bl=.01,mL=Math.sqrt(2*bl),Wr={};Wr.findMidptPtsEtc=function(t,e){var r=e.posPts,n=e.intersectionPts,i=e.vectorNormInverse,s,o=t.pstyle("source-endpoint"),a=t.pstyle("target-endpoint"),l=o.units!=null&&a.units!=null,u=function(N,E,T,k){var L=k-E,A=T-N,I=Math.sqrt(A*A+L*L);return{x:-L/I,y:A/I}},c=t.pstyle("edge-distances").value;switch(c){case"node-position":s=r;break;case"intersection":s=n;break;case"endpoints":{if(l){var h=this.manualEndptToPx(t.source()[0],o),v=vr(h,2),d=v[0],x=v[1],w=this.manualEndptToPx(t.target()[0],a),g=vr(w,2),m=g[0],y=g[1],b={x1:d,y1:x,x2:m,y2:y};i=u(d,x,m,y),s=b}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).")),s=n;break}}return{midptPts:s,vectorNormInverse:i}};Wr.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 s=Math.random()*2*Math.PI;i.source={x:Math.cos(s),y:Math.sin(s)},s=Math.random()*2*Math.PI,i.target={x:Math.cos(s),y:Math.sin(s)}}var o=n.source,a=n.target,l=o.position(),u=a.position(),c=o.width(),h=a.width(),v=o.height(),d=a.height(),x=r.pstyle("haystack-radius").value,w=x/2;i.haystackPts=i.allpts=[i.source.x*c*w+l.x,i.source.y*v*w+l.y,i.target.x*h*w+u.x,i.target.y*d*w+u.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)}};Wr.findSegmentsPoints=function(t,e){var r=t._private.rscratch,n=t.pstyle("segment-weights"),i=t.pstyle("segment-distances"),s=t.pstyle("segment-radii"),o=t.pstyle("radius-type"),a=Math.min(n.pfValue.length,i.pfValue.length),l=s.pfValue[s.pfValue.length-1],u=o.pfValue[o.pfValue.length-1];r.edgeType="segments",r.segpts=[],r.radii=[],r.isArcRadius=[];for(var c=0;c<a;c++){var h=n.pfValue[c],v=i.pfValue[c],d=1-h,x=h,w=this.findMidptPtsEtc(t,e),g=w.midptPts,m=w.vectorNormInverse,y={x:g.x1*d+g.x2*x,y:g.y1*d+g.y2*x};r.segpts.push(y.x+m.x*v,y.y+m.y*v),r.radii.push(s.pfValue[c]!==void 0?s.pfValue[c]:l),r.isArcRadius.push((o.pfValue[c]!==void 0?o.pfValue[c]:u)==="arc-radius")}};Wr.findLoopPoints=function(t,e,r,n){var i=t._private.rscratch,s=e.dirCounts,o=e.srcPos,a=t.pstyle("control-point-distances"),l=a?a.pfValue[0]:void 0,u=t.pstyle("loop-direction").pfValue,c=t.pstyle("loop-sweep").pfValue,h=t.pstyle("control-point-step-size").pfValue;i.edgeType="self";var v=r,d=h;n&&(v=0,d=l);var x=u-Math.PI/2,w=x-c/2,g=x+c/2,m=u+"_"+c;v=s[m]===void 0?s[m]=0:++s[m],i.ctrlpts=[o.x+Math.cos(w)*1.4*d*(v/3+1),o.y+Math.sin(w)*1.4*d*(v/3+1),o.x+Math.cos(g)*1.4*d*(v/3+1),o.y+Math.sin(g)*1.4*d*(v/3+1)]};Wr.findCompoundLoopPoints=function(t,e,r,n){var i=t._private.rscratch;i.edgeType="compound";var s=e.srcPos,o=e.tgtPos,a=e.srcW,l=e.srcH,u=e.tgtW,c=e.tgtH,h=t.pstyle("control-point-step-size").pfValue,v=t.pstyle("control-point-distances"),d=v?v.pfValue[0]:void 0,x=r,w=h;n&&(x=0,w=d);var g=50,m={x:s.x-a/2,y:s.y-l/2},y={x:o.x-u/2,y:o.y-c/2},b={x:Math.min(m.x,y.x),y:Math.min(m.y,y.y)},S=.5,N=Math.max(S,Math.log(a*bl)),E=Math.max(S,Math.log(u*bl));i.ctrlpts=[b.x,b.y-(1+Math.pow(g,1.12)/100)*w*(x/3+1)*N,b.x-(1+Math.pow(g,1.12)/100)*w*(x/3+1)*E,b.y]};Wr.findStraightEdgePoints=function(t){t._private.rscratch.edgeType="straight"};Wr.findBezierPoints=function(t,e,r,n,i){var s=t._private.rscratch,o=t.pstyle("control-point-step-size").pfValue,a=t.pstyle("control-point-distances"),l=t.pstyle("control-point-weights"),u=a&&l?Math.min(a.value.length,l.value.length):1,c=a?a.pfValue[0]:void 0,h=l.value[0],v=n;s.edgeType=v?"multibezier":"bezier",s.ctrlpts=[];for(var d=0;d<u;d++){var x=(.5-e.eles.length/2+r)*o*(i?-1:1),w=void 0,g=eg(x);v&&(c=a?a.pfValue[d]:o,h=l.value[d]),n?w=c:w=c!==void 0?g*c:void 0;var m=w!==void 0?w:x,y=1-h,b=h,S=this.findMidptPtsEtc(t,e),N=S.midptPts,E=S.vectorNormInverse,T={x:N.x1*y+N.x2*b,y:N.y1*y+N.y2*b};s.ctrlpts.push(T.x+E.x*m,T.y+E.y*m)}};Wr.findTaxiPoints=function(t,e){var r=t._private.rscratch;r.edgeType="segments";var n="vertical",i="horizontal",s="leftward",o="rightward",a="downward",l="upward",u="auto",c=e.posPts,h=e.srcW,v=e.srcH,d=e.tgtW,x=e.tgtH,w=t.pstyle("edge-distances").value,g=w!=="node-position",m=t.pstyle("taxi-direction").value,y=m,b=t.pstyle("taxi-turn"),S=b.units==="%",N=b.pfValue,E=N<0,T=t.pstyle("taxi-turn-min-distance").pfValue,k=g?(h+d)/2:0,L=g?(v+x)/2:0,A=c.x2-c.x1,I=c.y2-c.y1,M=function(oe,ue){return oe>0?Math.max(oe-ue,0):Math.min(oe+ue,0)},B=M(A,k),D=M(I,L),H=!1;y===u?m=Math.abs(B)>Math.abs(D)?i:n:y===l||y===a?(m=n,H=!0):(y===s||y===o)&&(m=i,H=!0);var U=m===n,z=U?D:B,W=U?I:A,F=eg(W),P=!1;!(H&&(S||E))&&(y===a&&W<0||y===l&&W>0||y===s&&W>0||y===o&&W<0)&&(F*=-1,z=F*Math.abs(z),P=!0);var j;if(S){var G=N<0?1+N:N;j=G*z}else{var $=N<0?z:0;j=$+N*F}var ee=function(oe){return Math.abs(oe)<T||Math.abs(oe)>=Math.abs(z)},ae=ee(j),ie=ee(Math.abs(z)-Math.abs(j)),K=ae||ie;if(K&&!P)if(U){var q=Math.abs(W)<=v/2,Y=Math.abs(A)<=d/2;if(q){var X=(c.x1+c.x2)/2,J=c.y1,re=c.y2;r.segpts=[X,J,X,re]}else if(Y){var ce=(c.y1+c.y2)/2,de=c.x1,Re=c.x2;r.segpts=[de,ce,Re,ce]}else r.segpts=[c.x1,c.y2]}else{var Pe=Math.abs(W)<=h/2,_e=Math.abs(I)<=x/2;if(Pe){var ke=(c.y1+c.y2)/2,Le=c.x1,Ee=c.x2;r.segpts=[Le,ke,Ee,ke]}else if(_e){var Ie=(c.x1+c.x2)/2,Oe=c.y1,De=c.y2;r.segpts=[Ie,Oe,Ie,De]}else r.segpts=[c.x2,c.y1]}else if(U){var We=c.y1+j+(g?v/2*F:0),Ye=c.x1,ge=c.x2;r.segpts=[Ye,We,ge,We]}else{var Ce=c.x1+j+(g?h/2*F:0),Ae=c.y1,Fe=c.y2;r.segpts=[Ce,Ae,Ce,Fe]}if(r.isRound){var me=t.pstyle("taxi-radius").value,Z=t.pstyle("radius-type").value[0]==="arc-radius";r.radii=new Array(r.segpts.length/2).fill(me),r.isArcRadius=new Array(r.segpts.length/2).fill(Z)}};Wr.tryToCorrectInvalidPoints=function(t,e){var r=t._private.rscratch;if(r.edgeType==="bezier"){var n=e.srcPos,i=e.tgtPos,s=e.srcW,o=e.srcH,a=e.tgtW,l=e.tgtH,u=e.srcShape,c=e.tgtShape,h=e.srcCornerRadius,v=e.tgtCornerRadius,d=e.srcRs,x=e.tgtRs,w=!Ke(r.startX)||!Ke(r.startY),g=!Ke(r.arrowStartX)||!Ke(r.arrowStartY),m=!Ke(r.endX)||!Ke(r.endY),y=!Ke(r.arrowEndX)||!Ke(r.arrowEndY),b=3,S=this.getArrowWidth(t.pstyle("width").pfValue,t.pstyle("arrow-scale").value)*this.arrowShapeWidth,N=b*S,E=Fa({x:r.ctrlpts[0],y:r.ctrlpts[1]},{x:r.startX,y:r.startY}),T=E<N,k=Fa({x:r.ctrlpts[0],y:r.ctrlpts[1]},{x:r.endX,y:r.endY}),L=k<N,A=!1;if(w||g||T){A=!0;var I={x:r.ctrlpts[0]-n.x,y:r.ctrlpts[1]-n.y},M=Math.sqrt(I.x*I.x+I.y*I.y),B={x:I.x/M,y:I.y/M},D=Math.max(s,o),H={x:r.ctrlpts[0]+B.x*2*D,y:r.ctrlpts[1]+B.y*2*D},U=u.intersectLine(n.x,n.y,s,o,H.x,H.y,0,h,d);T?(r.ctrlpts[0]=r.ctrlpts[0]+B.x*(N-E),r.ctrlpts[1]=r.ctrlpts[1]+B.y*(N-E)):(r.ctrlpts[0]=U[0]+B.x*N,r.ctrlpts[1]=U[1]+B.y*N)}if(m||y||L){A=!0;var z={x:r.ctrlpts[0]-i.x,y:r.ctrlpts[1]-i.y},W=Math.sqrt(z.x*z.x+z.y*z.y),F={x:z.x/W,y:z.y/W},P=Math.max(s,o),j={x:r.ctrlpts[0]+F.x*2*P,y:r.ctrlpts[1]+F.y*2*P},G=c.intersectLine(i.x,i.y,a,l,j.x,j.y,0,v,x);L?(r.ctrlpts[0]=r.ctrlpts[0]+F.x*(N-k),r.ctrlpts[1]=r.ctrlpts[1]+F.y*(N-k)):(r.ctrlpts[0]=G[0]+F.x*N,r.ctrlpts[1]=G[1]+F.y*N)}A&&this.findEndpoints(t)}};Wr.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=Er(e.allpts[n],e.allpts[n+2],e.allpts[n+4],i),e.midY=Er(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 s=2;s+3<e.allpts.length;s+=2){var o=e.radii[s/2-1],a=e.isArcRadius[s/2-1];e.roundCorners.push(dg({x:e.allpts[s-2],y:e.allpts[s-1]},{x:e.allpts[s],y:e.allpts[s+1],radius:o},{x:e.allpts[s+2],y:e.allpts[s+3]},o,a))}}if(e.segpts.length%4===0){var l=e.segpts.length/2,u=l-2;e.midX=(e.segpts[u]+e.segpts[l])/2,e.midY=(e.segpts[u+1]+e.segpts[l+1])/2}else{var c=e.segpts.length/2-1;if(!e.isRound)e.midX=e.segpts[c],e.midY=e.segpts[c+1];else{var h={x:e.segpts[c],y:e.segpts[c+1]},v=e.roundCorners[c/2];if(v.radius===0){var d={x:e.segpts[c+2],y:e.segpts[c+3]};e.midX=h.x,e.midY=h.y,e.midVector=[h.y-d.y,d.x-h.x]}else{var x=[h.x-v.cx,h.y-v.cy],w=v.radius/Math.sqrt(Math.pow(x[0],2)+Math.pow(x[1],2));x=x.map(function(g){return g*w}),e.midX=v.cx+x[0],e.midY=v.cy+x[1],e.midVector=x}}}}};Wr.checkForInvalidEdgeWarning=function(t){var e=t[0]._private.rscratch;e.nodesOverlap||Ke(e.startX)&&Ke(e.startY)&&Ke(e.endX)&&Ke(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."))};Wr.findEdgeControlPoints=function(t){var e=this;if(!(!t||t.length===0)){for(var r=this,n=r.cy,i=n.hasCompoundNodes(),s=new vi,o=function(L,A){return[].concat(kc(L),[A?1:0]).join("-")},a=[],l=[],u=0;u<t.length;u++){var c=t[u],h=c._private,v=c.pstyle("curve-style").value;if(!(c.removed()||!c.takesUpSpace())){if(v==="haystack"){l.push(c);continue}var d=v==="unbundled-bezier"||qi(v,"segments")||v==="straight"||v==="straight-triangle"||qi(v,"taxi"),x=v==="unbundled-bezier"||v==="bezier",w=h.source,g=h.target,m=w.poolIndex(),y=g.poolIndex(),b=[m,y].sort(),S=o(b,d),N=s.get(S);N==null&&(N={eles:[]},a.push({pairId:b,edgeIsUnbundled:d}),s.set(S,N)),N.eles.push(c),d&&(N.hasUnbundled=!0),x&&(N.hasBezier=!0)}}for(var E=function(){var L=a[T],A=L.pairId,I=L.edgeIsUnbundled,M=o(A,I),B=s.get(M),D;if(!B.hasUnbundled){var H=B.eles[0].parallelEdges().filter(function(Z){return Z.isBundledBezier()});Zv(B.eles),H.forEach(function(Z){return B.eles.push(Z)}),B.eles.sort(function(Z,te){return Z.poolIndex()-te.poolIndex()})}var U=B.eles[0],z=U.source(),W=U.target();if(z.poolIndex()>W.poolIndex()){var F=z;z=W,W=F}var P=B.srcPos=z.position(),j=B.tgtPos=W.position(),G=B.srcW=z.outerWidth(),$=B.srcH=z.outerHeight(),ee=B.tgtW=W.outerWidth(),ae=B.tgtH=W.outerHeight(),ie=B.srcShape=r.nodeShapes[e.getNodeShape(z)],K=B.tgtShape=r.nodeShapes[e.getNodeShape(W)],q=B.srcCornerRadius=z.pstyle("corner-radius").value==="auto"?"auto":z.pstyle("corner-radius").pfValue,Y=B.tgtCornerRadius=W.pstyle("corner-radius").value==="auto"?"auto":W.pstyle("corner-radius").pfValue,X=B.tgtRs=W._private.rscratch,J=B.srcRs=z._private.rscratch;B.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var re=0;re<B.eles.length;re++){var ce=B.eles[re],de=ce[0]._private.rscratch,Re=ce.pstyle("curve-style").value,Pe=Re==="unbundled-bezier"||qi(Re,"segments")||qi(Re,"taxi"),_e=!z.same(ce.source());if(!B.calculatedIntersection&&z!==W&&(B.hasBezier||B.hasUnbundled)){B.calculatedIntersection=!0;var ke=ie.intersectLine(P.x,P.y,G,$,j.x,j.y,0,q,J),Le=B.srcIntn=ke,Ee=K.intersectLine(j.x,j.y,ee,ae,P.x,P.y,0,Y,X),Ie=B.tgtIntn=Ee,Oe=B.intersectionPts={x1:ke[0],x2:Ee[0],y1:ke[1],y2:Ee[1]},De=B.posPts={x1:P.x,x2:j.x,y1:P.y,y2:j.y},We=Ee[1]-ke[1],Ye=Ee[0]-ke[0],ge=Math.sqrt(Ye*Ye+We*We);Ke(ge)&&ge>=mL||(ge=Math.sqrt(Math.max(Ye*Ye,bl)+Math.max(We*We,bl)));var Ce=B.vector={x:Ye,y:We},Ae=B.vectorNorm={x:Ce.x/ge,y:Ce.y/ge},Fe={x:-Ae.y,y:Ae.x};B.nodesOverlap=!Ke(ge)||K.checkPoint(ke[0],ke[1],0,ee,ae,j.x,j.y,Y,X)||ie.checkPoint(Ee[0],Ee[1],0,G,$,P.x,P.y,q,J),B.vectorNormInverse=Fe,D={nodesOverlap:B.nodesOverlap,dirCounts:B.dirCounts,calculatedIntersection:!0,hasBezier:B.hasBezier,hasUnbundled:B.hasUnbundled,eles:B.eles,srcPos:j,srcRs:X,tgtPos:P,tgtRs:J,srcW:ee,srcH:ae,tgtW:G,tgtH:$,srcIntn:Ie,tgtIntn:Le,srcShape:K,tgtShape:ie,posPts:{x1:De.x2,y1:De.y2,x2:De.x1,y2:De.y1},intersectionPts:{x1:Oe.x2,y1:Oe.y2,x2:Oe.x1,y2:Oe.y1},vector:{x:-Ce.x,y:-Ce.y},vectorNorm:{x:-Ae.x,y:-Ae.y},vectorNormInverse:{x:-Fe.x,y:-Fe.y}}}var me=_e?D:B;de.nodesOverlap=me.nodesOverlap,de.srcIntn=me.srcIntn,de.tgtIntn=me.tgtIntn,de.isRound=Re.startsWith("round"),i&&(z.isParent()||z.isChild()||W.isParent()||W.isChild())&&(z.parents().anySame(W)||W.parents().anySame(z)||z.same(W)&&z.isParent())?e.findCompoundLoopPoints(ce,me,re,Pe):z===W?e.findLoopPoints(ce,me,re,Pe):Re.endsWith("segments")?e.findSegmentsPoints(ce,me):Re.endsWith("taxi")?e.findTaxiPoints(ce,me):Re==="straight"||!Pe&&B.eles.length%2===1&&re===Math.floor(B.eles.length/2)?e.findStraightEdgePoints(ce):e.findBezierPoints(ce,me,re,Pe,_e),e.findEndpoints(ce),e.tryToCorrectInvalidPoints(ce,me),e.checkForInvalidEdgeWarning(ce),e.storeAllpts(ce),e.storeEdgeProjections(ce),e.calculateArrowAngles(ce),e.recalculateEdgeLabelProjections(ce),e.calculateLabelAngles(ce)}},T=0;T<a.length;T++)E();this.findHaystackPoints(l)}};function k_(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}}Wr.getSegmentPoints=function(t){var e=t[0]._private.rscratch;this.recalculateRenderedStyle(t);var r=e.edgeType;if(r==="segments")return k_(e.segpts)};Wr.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 k_(e.ctrlpts)};Wr.getEdgeMidpoint=function(t){var e=t[0]._private.rscratch;return this.recalculateRenderedStyle(t),{x:e.midX,y:e.midY}};var Al={};Al.manualEndptToPx=function(t,e){var r=this,n=t.position(),i=t.outerWidth(),s=t.outerHeight(),o=t._private.rscratch;if(e.value.length===2){var a=[e.pfValue[0],e.pfValue[1]];return e.units[0]==="%"&&(a[0]=a[0]*i),e.units[1]==="%"&&(a[1]=a[1]*s),a[0]+=n.x,a[1]+=n.y,a}else{var l=e.pfValue[0];l=-Math.PI/2+l;var u=2*Math.max(i,s),c=[n.x+Math.cos(l)*u,n.y+Math.sin(l)*u];return r.nodeShapes[this.getNodeShape(t)].intersectLine(n.x,n.y,i,s,c[0],c[1],0,t.pstyle("corner-radius").value==="auto"?"auto":t.pstyle("corner-radius").pfValue,o)}};Al.findEndpoints=function(t){var e,r,n,i,s=this,o,a=t.source()[0],l=t.target()[0],u=a.position(),c=l.position(),h=t.pstyle("target-arrow-shape").value,v=t.pstyle("source-arrow-shape").value,d=t.pstyle("target-distance-from-node").pfValue,x=t.pstyle("source-distance-from-node").pfValue,w=a._private.rscratch,g=l._private.rscratch,m=t.pstyle("curve-style").value,y=t._private.rscratch,b=y.edgeType,S=qi(m,"taxi"),N=b==="self"||b==="compound",E=b==="bezier"||b==="multibezier"||N,T=b!=="bezier",k=b==="straight"||b==="segments",L=b==="segments",A=E||T||k,I=N||S,M=t.pstyle("source-endpoint"),B=I?"outside-to-node":M.value,D=a.pstyle("corner-radius").value==="auto"?"auto":a.pstyle("corner-radius").pfValue,H=t.pstyle("target-endpoint"),U=I?"outside-to-node":H.value,z=l.pstyle("corner-radius").value==="auto"?"auto":l.pstyle("corner-radius").pfValue;y.srcManEndpt=M,y.tgtManEndpt=H;var W,F,P,j,G=(e=(H==null||(r=H.pfValue)===null||r===void 0?void 0:r.length)===2?H.pfValue:null)!==null&&e!==void 0?e:[0,0],$=(n=(M==null||(i=M.pfValue)===null||i===void 0?void 0:i.length)===2?M.pfValue:null)!==null&&n!==void 0?n:[0,0];if(E){var ee=[y.ctrlpts[0],y.ctrlpts[1]],ae=T?[y.ctrlpts[y.ctrlpts.length-2],y.ctrlpts[y.ctrlpts.length-1]]:ee;W=ae,F=ee}else if(k){var ie=L?y.segpts.slice(0,2):[c.x+G[0],c.y+G[1]],K=L?y.segpts.slice(y.segpts.length-2):[u.x+$[0],u.y+$[1]];W=K,F=ie}if(U==="inside-to-node")o=[c.x,c.y];else if(H.units)o=this.manualEndptToPx(l,H);else if(U==="outside-to-line")o=y.tgtIntn;else if(U==="outside-to-node"||U==="outside-to-node-or-label"?P=W:(U==="outside-to-line"||U==="outside-to-line-or-label")&&(P=[u.x,u.y]),o=s.nodeShapes[this.getNodeShape(l)].intersectLine(c.x,c.y,l.outerWidth(),l.outerHeight(),P[0],P[1],0,z,g),U==="outside-to-node-or-label"||U==="outside-to-line-or-label"){var q=l._private.rscratch,Y=q.labelWidth,X=q.labelHeight,J=q.labelX,re=q.labelY,ce=Y/2,de=X/2,Re=l.pstyle("text-valign").value;Re=$s(Re),Re==="top"?re-=de:Re==="bottom"&&(re+=de);var Pe=l.pstyle("text-halign").value;Pe=Vs(Pe),Pe==="left"?J-=ce:Pe==="right"&&(J+=ce);var _e=vl(P[0],P[1],[J-ce,re-de,J+ce,re-de,J+ce,re+de,J-ce,re+de],c.x,c.y);if(_e.length>0){var ke=u,Le=La(ke,Ps(o)),Ee=La(ke,Ps(_e)),Ie=Le;if(Ee<Le&&(o=_e,Ie=Ee),_e.length>2){var Oe=La(ke,{x:_e[2],y:_e[3]});Oe<Ie&&(o=[_e[2],_e[3]])}}}var De=Yu(o,W,s.arrowShapes[h].spacing(t)+d),We=Yu(o,W,s.arrowShapes[h].gap(t)+d);if(y.endX=We[0],y.endY=We[1],y.arrowEndX=De[0],y.arrowEndY=De[1],B==="inside-to-node")o=[u.x,u.y];else if(M.units)o=this.manualEndptToPx(a,M);else if(B==="outside-to-line")o=y.srcIntn;else if(B==="outside-to-node"||B==="outside-to-node-or-label"?j=F:(B==="outside-to-line"||B==="outside-to-line-or-label")&&(j=[c.x,c.y]),o=s.nodeShapes[this.getNodeShape(a)].intersectLine(u.x,u.y,a.outerWidth(),a.outerHeight(),j[0],j[1],0,D,w),B==="outside-to-node-or-label"||B==="outside-to-line-or-label"){var Ye=a._private.rscratch,ge=Ye.labelWidth,Ce=Ye.labelHeight,Ae=Ye.labelX,Fe=Ye.labelY,me=ge/2,Z=Ce/2,te=a.pstyle("text-valign").value;te=$s(te),te==="top"?Fe-=Z:te==="bottom"&&(Fe+=Z);var oe=a.pstyle("text-halign").value;oe=Vs(oe),oe==="left"?Ae-=me:oe==="right"&&(Ae+=me);var ue=vl(j[0],j[1],[Ae-me,Fe-Z,Ae+me,Fe-Z,Ae+me,Fe+Z,Ae-me,Fe+Z],u.x,u.y);if(ue.length>0){var se=c,he=La(se,Ps(o)),pe=La(se,Ps(ue)),be=he;if(pe<he&&(o=[ue[0],ue[1]],be=pe),ue.length>2){var Se=La(se,{x:ue[2],y:ue[3]});Se<be&&(o=[ue[2],ue[3]])}}}var Te=Yu(o,F,s.arrowShapes[v].spacing(t)+x),Ne=Yu(o,F,s.arrowShapes[v].gap(t)+x);y.startX=Ne[0],y.startY=Ne[1],y.arrowStartX=Te[0],y.arrowStartY=Te[1],A&&(!Ke(y.startX)||!Ke(y.startY)||!Ke(y.endX)||!Ke(y.endY)?y.badLine=!0:y.badLine=!1)};Al.getSourceEndpoint=function(t){var e=t[0]._private.rscratch;switch(this.recalculateRenderedStyle(t),e.edgeType){case"haystack":return{x:e.haystackPts[0],y:e.haystackPts[1]};default:return{x:e.arrowStartX,y:e.arrowStartY}}};Al.getTargetEndpoint=function(t){var e=t[0]._private.rscratch;switch(this.recalculateRenderedStyle(t),e.edgeType){case"haystack":return{x:e.haystackPts[2],y:e.haystackPts[3]};default:return{x:e.arrowEndX,y:e.arrowEndY}}};var pg={};function yL(t,e,r){for(var n=function(u,c,h,v){return Er(u,c,h,v)},i=e._private,s=i.rstyle.bezierPts,o=0;o<t.bezierProjPcts.length;o++){var a=t.bezierProjPcts[o];s.push({x:n(r[0],r[2],r[4],a),y:n(r[1],r[3],r[5],a)})}}pg.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)yL(this,t,r.allpts.slice(i,i+6))}else if(n==="segments")for(var s=e.rstyle.linePts=[],i=0;i+1<r.allpts.length;i+=2)s.push({x:r.allpts[i],y:r.allpts[i+1]});else if(n==="haystack"){var o=r.haystackPts;e.rstyle.haystackPts=[{x:o[0],y:o[1]},{x:o[2],y:o[3]}]}e.rstyle.arrowWidth=this.getArrowWidth(t.pstyle("width").pfValue,t.pstyle("arrow-scale").value)*this.arrowShapeWidth};pg.recalculateEdgeProjections=function(t){this.findEdgeControlPoints(t)};var ri={};ri.recalculateNodeLabelProjection=function(t){var e=t.pstyle("label").strValue;if(!Zi(e)){var r,n,i=t._private,s=t.width(),o=t.height(),a=t.padding(),l=t.position(),u=t.pstyle("text-halign").strValue,c=t.pstyle("text-valign").strValue,h=i.rscratch,v=i.rstyle;switch(u){case"left":r=l.x-s/2-a;break;case"left-inside":r=l.x-s/2+a;break;case"right":r=l.x+s/2+a;break;case"right-inside":r=l.x+s/2-a;break;default:r=l.x}switch(c){case"top":n=l.y-o/2-a;break;case"top-inside":n=l.y-o/2+a;break;case"bottom":n=l.y+o/2+a;break;case"bottom-inside":n=l.y+o/2-a;break;default:n=l.y}h.labelX=r,h.labelY=n,v.labelX=r,v.labelY=n,this.calculateLabelAngles(t),this.applyLabelDimensions(t)}};var T_=function(e,r){var n=Math.atan(r/e);return e===0&&n<0&&(n=n*-1),n},N_=function(e,r){var n=r.x-e.x,i=r.y-e.y;return T_(n,i)},xL=function(e,r,n,i){var s=pl(0,i-.001,1),o=pl(0,i+.001,1),a=Bs(e,r,n,s),l=Bs(e,r,n,o);return N_(a,l)};ri.recalculateEdgeLabelProjections=function(t){var e,r=t._private,n=r.rscratch,i=this,s={mid:t.pstyle("label").strValue,source:t.pstyle("source-label").strValue,target:t.pstyle("target-label").strValue};if(s.mid||s.source||s.target){e={x:n.midX,y:n.midY};var o=function(h,v,d){Zn(r.rscratch,h,v,d),Zn(r.rstyle,h,v,d)};o("labelX",null,e.x),o("labelY",null,e.y);var a=T_(n.midDispX,n.midDispY);o("labelAutoAngle",null,a);var l=function(){if(l.cache)return l.cache;for(var h=[],v=0;v+5<n.allpts.length;v+=4){var d={x:n.allpts[v],y:n.allpts[v+1]},x={x:n.allpts[v+2],y:n.allpts[v+3]},w={x:n.allpts[v+4],y:n.allpts[v+5]};h.push({p0:d,p1:x,p2:w,startDist:0,length:0,segments:[]})}var g=r.rstyle.bezierPts,m=i.bezierProjPcts.length;function y(T,k,L,A,I){var M=Fa(k,L),B=T.segments[T.segments.length-1],D={p0:k,p1:L,t0:A,t1:I,startDist:B?B.startDist+B.length:0,length:M};T.segments.push(D),T.length+=M}for(var b=0;b<h.length;b++){var S=h[b],N=h[b-1];N&&(S.startDist=N.startDist+N.length),y(S,S.p0,g[b*m],0,i.bezierProjPcts[0]);for(var E=0;E<m-1;E++)y(S,g[b*m+E],g[b*m+E+1],i.bezierProjPcts[E],i.bezierProjPcts[E+1]);y(S,g[b*m+m-1],S.p2,i.bezierProjPcts[m-1],1)}return l.cache=h},u=function(h){var v,d=h==="source";if(s[h]){var x=t.pstyle(h+"-text-offset").pfValue;switch(n.edgeType){case"self":case"compound":case"bezier":case"multibezier":{for(var w=l(),g,m=0,y=0,b=0;b<w.length;b++){for(var S=w[d?b:w.length-1-b],N=0;N<S.segments.length;N++){var E=S.segments[d?N:S.segments.length-1-N],T=b===w.length-1&&N===S.segments.length-1;if(m=y,y+=E.length,y>=x||T){g={cp:S,segment:E};break}}if(g)break}var k=g.cp,L=g.segment,A=(x-m)/L.length,I=L.t1-L.t0,M=d?L.t0+I*A:L.t1-I*A;M=pl(0,M,1),e=Bs(k.p0,k.p1,k.p2,M),v=xL(k.p0,k.p1,k.p2,M);break}case"straight":case"segments":case"haystack":{for(var B=0,D,H,U,z,W=n.allpts.length,F=0;F+3<W&&(d?(U={x:n.allpts[F],y:n.allpts[F+1]},z={x:n.allpts[F+2],y:n.allpts[F+3]}):(U={x:n.allpts[W-2-F],y:n.allpts[W-1-F]},z={x:n.allpts[W-4-F],y:n.allpts[W-3-F]}),D=Fa(U,z),H=B,B+=D,!(B>=x));F+=2);var P=x-H,j=P/D;j=pl(0,j,1),e=z3(U,z,j),v=N_(U,z);break}}o("labelX",h,e.x),o("labelY",h,e.y),o("labelAutoAngle",h,v)}};u("source"),u("target"),this.applyLabelDimensions(t)}};ri.applyLabelDimensions=function(t){this.applyPrefixedLabelDimensions(t),t.isEdge()&&(this.applyPrefixedLabelDimensions(t,"source"),this.applyPrefixedLabelDimensions(t,"target"))};ri.applyPrefixedLabelDimensions=function(t,e){var r=t._private,n=this.getLabelText(t,e),i=ja(n,t._private.labelDimsKey);if(Xr(r.rscratch,"prefixedLabelDimsKey",e)!==i){Zn(r.rscratch,"prefixedLabelDimsKey",e,i);var s=this.calculateLabelDimensions(t,n),o=t.pstyle("line-height").pfValue,a=t.pstyle("font-size").pfValue,l=t.pstyle("text-wrap").strValue,u=Xr(r.rscratch,"labelWrapCachedLines",e)||[],c=l!=="wrap"?1:Math.max(u.length,1),h=a*o,v=s.width,d=s.height+(c-1)*(o-1)*a;Zn(r.rstyle,"labelWidth",e,v),Zn(r.rscratch,"labelWidth",e,v),Zn(r.rstyle,"labelHeight",e,d),Zn(r.rscratch,"labelHeight",e,d),Zn(r.rscratch,"labelLineHeight",e,h),Zn(r.rscratch,"labelActualDescent",e,s.labelActualDescent)}};ri.getLabelText=function(t,e){var r=t._private,n=e?e+"-":"",i=t.pstyle(n+"label").strValue,s=t.pstyle("text-transform").value,o=function($,ee){return ee?(Zn(r.rscratch,$,e,ee),ee):Xr(r.rscratch,$,e)};if(!i)return"";s=="none"||(s=="uppercase"?i=i.toUpperCase():s=="lowercase"&&(i=i.toLowerCase()));var a=t.pstyle("text-wrap").value;if(a==="wrap"){var l=o("labelKey");if(l!=null&&o("labelWrapKey")===l)return o("labelWrapCachedText");for(var u="​",c=i.split(`
59
- `),h=t.pstyle("text-max-width").pfValue,v=t.pstyle("text-overflow-wrap").value,d=v==="anywhere",x=[],w=/[\s\u200b]+|$/g,g=0;g<c.length;g++){var m=c[g],y=this.calculateLabelDimensions(t,m),b=y.width;if(d){var S=m.split("").join(u);m=S}if(b>h){var N=m.matchAll(w),E="",T=0,k=ln(N),L;try{for(k.s();!(L=k.n()).done;){var A=L.value,I=A[0],M=m.substring(T,A.index);T=A.index+I.length;var B=E.length===0?M:E+M+I,D=this.calculateLabelDimensions(t,B),H=D.width;H<=h?E+=M+I:(E&&x.push(E),E=M+I)}}catch(G){k.e(G)}finally{k.f()}E.match(/^[\s\u200b]+$/)||x.push(E)}else x.push(m)}o("labelWrapCachedLines",x),i=o("labelWrapCachedText",x.join(`
60
- `)),o("labelWrapKey",l)}else if(a==="ellipsis"){var U=t.pstyle("text-max-width").pfValue,z="",W="…",F=!1;if(this.calculateLabelDimensions(t,i).width<U)return i;for(var P=0;P<i.length;P++){var j=this.calculateLabelDimensions(t,z+i[P]+W).width;if(j>U)break;z+=i[P],P===i.length-1&&(F=!0)}return F||(z+=W),z}return i};ri.getLabelJustification=function(t){var e=t.pstyle("text-justification").strValue,r=t.pstyle("text-halign").strValue;return e==="auto"?t.isNode()?sR(r):"center":e};ri.calculateLabelDimensions=function(t,e){var r=this,n=r.cy.window(),i=n.document,s=0,o=t.pstyle("font-style").strValue,a=t.pstyle("font-size").pfValue,l=t.pstyle("font-family").strValue,u=t.pstyle("font-weight").strValue,c=t.pstyle("text-metrics").strValue||"font",h=this.labelCalcCanvas,v=this.labelCalcCanvasContext;if(!h){h=this.labelCalcCanvas=i.createElement("canvas"),v=this.labelCalcCanvasContext=h.getContext("2d");var d=h.style;d.position="absolute",d.left="-9999px",d.top="-9999px",d.zIndex="-1",d.visibility="hidden",d.pointerEvents="none"}v.font="".concat(o," ").concat(u," ").concat(a,"px ").concat(l);for(var x=0,w=0,g=e.split(`
61
- `),m=g.length,y=0,b=0,S=0;S<m;S++){var N=g[S],E=v.measureText(N),T=Math.ceil(E.width),k=a;c==="glyph"&&(S===0&&(b=E.actualBoundingBoxAscent),S===m-1&&(y=E.actualBoundingBoxDescent)),x=Math.max(T,x),w+=k}return c==="glyph"&&(w-=a-b-y),x+=s,w+=s,{width:x,height:w,labelActualAscent:b,labelActualDescent:y}};ri.calculateLabelAngle=function(t,e){var r=t._private,n=r.rscratch,i=t.isEdge(),s=e?e+"-":"",o=t.pstyle(s+"text-rotation"),a=o.strValue;return a==="none"?0:i&&a==="autorotate"?n.labelAutoAngle:a==="autorotate"?0:o.pfValue};ri.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 R_={},N1=28,R1=!1;R_.getNodeShape=function(t){var e=this,r=t.pstyle("shape").value;if(r==="cutrectangle"&&(t.width()<N1||t.height()<N1))return R1||(jt("The `cutrectangle` node shape can not be used at small sizes so `rectangle` is used instead"),R1=!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 oh={};oh.registerCalculationListeners=function(){var t=this.cy,e=t.collection(),r=this,n=function(o){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(e.merge(o),a)for(var l=0;l<o.length;l++){var u=o[l],c=u._private,h=c.rstyle;h.clean=!1,h.cleanConnected=!1}};r.binder(t).on("bounds.* dirty.*",function(o){var a=o.target;n(a)}).on("style.* background.*",function(o){var a=o.target;n(a,!1)});var i=function(o){if(o){var a=r.onUpdateEleCalcsFns;e.cleanStyle();for(var l=0;l<e.length;l++){var u=e[l],c=u._private.rstyle;u.isNode()&&!c.cleanConnected&&(n(u.connectedEdges()),c.cleanConnected=!0)}if(a)for(var h=0;h<a.length;h++){var v=a[h];v(o,e)}r.recalculateRenderedStyle(e),e=t.collection()}};r.flushRenderedStyleQueue=function(){i(!0)},r.beforeRender(i,r.beforeRenderPriorities.eleCalcs)};oh.onUpdateEleCalcs=function(t){var e=this.onUpdateEleCalcsFns=this.onUpdateEleCalcsFns||[];e.push(t)};oh.recalculateRenderedStyle=function(t,e){var r=function(S){return S._private.rstyle.cleanConnected};if(t.length!==0){var n=[],i=[];if(!this.destroyed){e===void 0&&(e=!0);for(var s=0;s<t.length;s++){var o=t[s],a=o._private,l=a.rstyle;o.isEdge()&&(!r(o.source())||!r(o.target()))&&(l.clean=!1),o.isEdge()&&o.isBundledBezier()&&o.parallelEdges().some(function(b){return!b._private.rstyle.clean&&b.isBundledBezier()})&&(l.clean=!1),!(e&&l.clean||o.removed())&&o.pstyle("display").value!=="none"&&(a.group==="nodes"?i.push(o):n.push(o),l.clean=!0)}for(var u=0;u<i.length;u++){var c=i[u],h=c._private,v=h.rstyle,d=c.position();this.recalculateNodeLabelProjection(c),v.nodeX=d.x,v.nodeY=d.y,v.nodeW=c.pstyle("width").pfValue,v.nodeH=c.pstyle("height").pfValue}this.recalculateEdgeProjections(n);for(var x=0;x<n.length;x++){var w=n[x],g=w._private,m=g.rstyle,y=g.rscratch;m.srcX=y.arrowStartX,m.srcY=y.arrowStartY,m.tgtX=y.arrowEndX,m.tgtY=y.arrowEndY,m.midX=y.midX,m.midY=y.midY,m.labelAngle=y.labelAngle,m.sourceLabelAngle=y.sourceLabelAngle,m.targetLabelAngle=y.targetLabelAngle}}}};var lh={};lh.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)}}};lh.invalidateCachedZSortedEles=function(){this.cachedZSortedEles=null};lh.getCachedZSortedEles=function(t){if(t||!this.cachedZSortedEles){var e=this.cy.mutableElements().toArray();e.sort(c_),e.interactive=e.filter(function(r){return r.interactive()}),this.cachedZSortedEles=e,this.updateCachedGrabbedEles()}else e=this.cachedZSortedEles;return e};var L_={};[Va,Oc,Wr,Al,pg,ri,R_,oh,lh].forEach(function(t){pt(L_,t)});var D_={};D_.getCachedImage=function(t,e,r){var n=this,i=n.imageCache=n.imageCache||{},s=i[t];if(s)return s.image.complete||s.image.addEventListener("load",r),s.image;s=i[t]=i[t]||{};var o=s.image=new Image;o.addEventListener("load",r),o.addEventListener("error",function(){o.error=!0});var a="data:",l=t.substring(0,a.length).toLowerCase()===a;return l||(e=e==="null"?null:e,o.crossOrigin=e),o.src=t,o};var A_=function(e,r){var n=e[0];!n||n._private.grabbed===r||(n._private.grabbed=r,e.updateStyle(!1))},bL=function(e){A_(e,!0)},wL=function(e){A_(e,!1)},Zs={};Zs.registerBinding=function(t,e,r,n){var i=Array.prototype.slice.apply(arguments,[1]);if(Array.isArray(t)){for(var s=[],o=0;o<t.length;o++){var a=t[o];if(a!==void 0){var l=this.binder(a);s.push(l.on.apply(l,i))}}return s}var l=this.binder(t);return l.on.apply(l,i)};Zs.binder=function(t){var e=this,r=e.cy.window(),n=t===r||t===r.document||t===r.document.body||Lk(t);if(e.supportsPassiveEvents==null){var i=!1;try{var s=Object.defineProperty({},"passive",{get:function(){return i=!0,!0}});r.addEventListener("test",null,s)}catch{}e.supportsPassiveEvents=i}var o=function(l,u,c){var h=Array.prototype.slice.call(arguments);return n&&e.supportsPassiveEvents&&(h[2]={capture:c??!1,passive:!1,once:!1}),e.bindings.push({target:t,args:h}),(t.addEventListener||t.on).apply(t,h),this};return{on:o,addEventListener:o,addListener:o,bind:o}};Zs.nodeIsDraggable=function(t){return t&&t.isNode()&&!t.locked()&&t.grabbable()};Zs.nodeIsGrabbable=function(t){return this.nodeIsDraggable(t)&&t.interactive()};Zs.load=function(){var t=this,e=t.cy.window(),r=function(Z){return Z.selected()},n=function(Z){var te=Z.getRootNode();if(te&&te.nodeType===11&&te.host!==void 0)return te},i=function(Z,te,oe,ue){Z==null&&(Z=t.cy);for(var se=0;se<te.length;se++){var he=te[se];Z.emit({originalEvent:oe,type:he,position:ue})}},s=function(Z){return Z.shiftKey||Z.metaKey||Z.ctrlKey},o=function(Z,te){var oe=!0;if(t.cy.hasCompoundNodes()&&Z&&Z.pannable())for(var ue=0;te&&ue<te.length;ue++){var Z=te[ue];if(Z.isNode()&&Z.isParent()&&!Z.pannable()){oe=!1;break}}else oe=!0;return oe},a=function(Z){Z[0]._private.rscratch.inDragLayer=!0},l=function(Z){Z[0]._private.rscratch.inDragLayer=!1},u=function(Z){Z[0]._private.rscratch.isGrabTarget=!0},c=function(Z){Z[0]._private.rscratch.isGrabTarget=!1},h=function(Z,te){var oe=te.addToList,ue=oe.has(Z);!ue&&Z.grabbable()&&!Z.locked()&&(oe.merge(Z),bL(Z))},v=function(Z,te){if(Z.cy().hasCompoundNodes()&&!(te.inDragLayer==null&&te.addToList==null)){var oe=Z.descendants();te.inDragLayer&&(oe.forEach(a),oe.connectedEdges().forEach(a)),te.addToList&&h(oe,te)}},d=function(Z,te){te=te||{};var oe=Z.cy().hasCompoundNodes();te.inDragLayer&&(Z.forEach(a),Z.neighborhood().stdFilter(function(ue){return!oe||ue.isEdge()}).forEach(a)),te.addToList&&Z.forEach(function(ue){h(ue,te)}),v(Z,te),g(Z,{inDragLayer:te.inDragLayer}),t.updateCachedGrabbedEles()},x=d,w=function(Z){Z&&(t.getCachedZSortedEles().forEach(function(te){wL(te),l(te),c(te)}),t.updateCachedGrabbedEles())},g=function(Z,te){if(!(te.inDragLayer==null&&te.addToList==null)&&Z.cy().hasCompoundNodes()){var oe=Z.ancestors().orphans();if(!oe.same(Z)){var ue=oe.descendants().spawnSelf().merge(oe).unmerge(Z).unmerge(Z.descendants()),se=ue.connectedEdges();te.inDragLayer&&(se.forEach(a),ue.forEach(a)),te.addToList&&ue.forEach(function(he){h(he,te)})}}},m=function(){document.activeElement!=null&&document.activeElement.blur!=null&&document.activeElement.blur()},y=typeof MutationObserver<"u",b=typeof ResizeObserver<"u";y?(t.removeObserver=new MutationObserver(function(me){for(var Z=0;Z<me.length;Z++){var te=me[Z],oe=te.removedNodes;if(oe)for(var ue=0;ue<oe.length;ue++){var se=oe[ue];if(se===t.container){t.destroy();break}}}}),t.container.parentNode&&t.removeObserver.observe(t.container.parentNode,{childList:!0})):t.registerBinding(t.container,"DOMNodeRemoved",function(me){t.destroy()});var S=Nl(function(){t.cy.resize()},100);y&&(t.styleObserver=new MutationObserver(S),t.styleObserver.observe(t.container,{attributes:!0})),t.registerBinding(e,"resize",S),b&&(t.resizeObserver=new ResizeObserver(S),t.resizeObserver.observe(t.container));var N=function(Z,te){for(;Z!=null;)te(Z),Z=Z.parentNode},E=function(){t.invalidateContainerClientCoordsCache()};N(t.container,function(me){t.registerBinding(me,"transitionend",E),t.registerBinding(me,"animationend",E),t.registerBinding(me,"scroll",E)}),t.registerBinding(t.container,"contextmenu",function(me){me.preventDefault()});var T=function(){return t.selection[4]!==0},k=function(Z){for(var te=t.findContainerClientCoords(),oe=te[0],ue=te[1],se=te[2],he=te[3],pe=Z.touches?Z.touches:[Z],be=!1,Se=0;Se<pe.length;Se++){var Te=pe[Se];if(oe<=Te.clientX&&Te.clientX<=oe+se&&ue<=Te.clientY&&Te.clientY<=ue+he){be=!0;break}}if(!be)return!1;for(var Ne=t.container,He=Z.target,ze=He.parentNode,Ge=!1;ze;){if(ze===Ne){Ge=!0;break}ze=ze.parentNode}return!!Ge};t.registerBinding(t.container,"mousedown",function(Z){if(k(Z)&&!(t.hoverData.which===1&&Z.which!==1)){Z.preventDefault(),m(),t.hoverData.capture=!0,t.hoverData.which=Z.which;var te=t.cy,oe=[Z.clientX,Z.clientY],ue=t.projectIntoViewport(oe[0],oe[1]),se=t.selection,he=t.findNearestElements(ue[0],ue[1],!0,!1),pe=he[0],be=t.dragData.possibleDragElements;t.hoverData.mdownPos=ue,t.hoverData.mdownGPos=oe;var Se=function(st){return{originalEvent:Z,type:st,position:{x:ue[0],y:ue[1]}}},Te=function(){t.hoverData.tapholdCancelled=!1,clearTimeout(t.hoverData.tapholdTimeout),t.hoverData.tapholdTimeout=setTimeout(function(){if(!t.hoverData.tapholdCancelled){var st=t.hoverData.down;st?st.emit(Se("taphold")):te.emit(Se("taphold"))}},t.tapholdDuration)};if(Z.which==3){t.hoverData.cxtStarted=!0;var Ne={originalEvent:Z,type:"cxttapstart",position:{x:ue[0],y:ue[1]}};pe?(pe.activate(),pe.emit(Ne),t.hoverData.down=pe):te.emit(Ne),t.hoverData.downTime=new Date().getTime(),t.hoverData.cxtDragged=!1}else if(Z.which==1){pe&&pe.activate();{if(pe!=null&&t.nodeIsGrabbable(pe)){var He=function(st){st.emit(Se("grab"))};if(u(pe),!pe.selected())be=t.dragData.possibleDragElements=te.collection(),x(pe,{addToList:be}),pe.emit(Se("grabon")).emit(Se("grab"));else{be=t.dragData.possibleDragElements=te.collection();var ze=te.$(function(Ge){return Ge.isNode()&&Ge.selected()&&t.nodeIsGrabbable(Ge)});d(ze,{addToList:be}),pe.emit(Se("grabon")),ze.forEach(He)}t.redrawHint("eles",!0),t.redrawHint("drag",!0)}t.hoverData.down=pe,t.hoverData.downs=he,t.hoverData.downTime=new Date().getTime()}i(pe,["mousedown","tapstart","vmousedown"],Z,{x:ue[0],y:ue[1]}),pe==null?(se[4]=1,t.data.bgActivePosistion={x:ue[0],y:ue[1]},t.redrawHint("select",!0),t.redraw()):pe.pannable()&&(se[4]=1),Te()}se[0]=se[2]=ue[0],se[1]=se[3]=ue[1]}},!1);var L=n(t.container);t.registerBinding([e,L],"mousemove",function(Z){var te=t.hoverData.capture;if(!(!te&&!k(Z))){var oe=!1,ue=t.cy,se=ue.zoom(),he=[Z.clientX,Z.clientY],pe=t.projectIntoViewport(he[0],he[1]),be=t.hoverData.mdownPos,Se=t.hoverData.mdownGPos,Te=t.selection,Ne=null;!t.hoverData.draggingEles&&!t.hoverData.dragging&&!t.hoverData.selecting&&(Ne=t.findNearestElement(pe[0],pe[1],!0,!1));var He=t.hoverData.last,ze=t.hoverData.down,Ge=[pe[0]-Te[2],pe[1]-Te[3]],st=t.dragData.possibleDragElements,Je;if(Se){var qe=he[0]-Se[0],vt=qe*qe,Ze=he[1]-Se[1],Qe=Ze*Ze,wt=vt+Qe;t.hoverData.isOverThresholdDrag=Je=wt>=t.desktopTapThreshold2}var lt=s(Z);Je&&(t.hoverData.tapholdCancelled=!0);var gt=function(){var ar=t.hoverData.dragDelta=t.hoverData.dragDelta||[];ar.length===0?(ar.push(Ge[0]),ar.push(Ge[1])):(ar[0]+=Ge[0],ar[1]+=Ge[1])};oe=!0,i(Ne,["mousemove","vmousemove","tapdrag"],Z,{x:pe[0],y:pe[1]});var xt=function(ar){return{originalEvent:Z,type:ar,position:{x:pe[0],y:pe[1]}}},Rt=function(){t.data.bgActivePosistion=void 0,t.hoverData.selecting||ue.emit(xt("boxstart")),Te[4]=1,t.hoverData.selecting=!0,t.redrawHint("select",!0),t.redraw()};if(t.hoverData.which===3){if(Je){var Ot=xt("cxtdrag");ze?ze.emit(Ot):ue.emit(Ot),t.hoverData.cxtDragged=!0,(!t.hoverData.cxtOver||Ne!==t.hoverData.cxtOver)&&(t.hoverData.cxtOver&&t.hoverData.cxtOver.emit(xt("cxtdragout")),t.hoverData.cxtOver=Ne,Ne&&Ne.emit(xt("cxtdragover")))}}else if(t.hoverData.dragging){if(oe=!0,ue.panningEnabled()&&ue.userPanningEnabled()){var Tt;if(t.hoverData.justStartedPan){var Nr=t.hoverData.mdownPos;Tt={x:(pe[0]-Nr[0])*se,y:(pe[1]-Nr[1])*se},t.hoverData.justStartedPan=!1}else Tt={x:Ge[0]*se,y:Ge[1]*se};ue.panBy(Tt),ue.emit(xt("dragpan")),t.hoverData.dragged=!0}pe=t.projectIntoViewport(Z.clientX,Z.clientY)}else if(Te[4]==1&&(ze==null||ze.pannable())){if(Je){if(!t.hoverData.dragging&&ue.boxSelectionEnabled()&&(lt||!ue.panningEnabled()||!ue.userPanningEnabled()))Rt();else if(!t.hoverData.selecting&&ue.panningEnabled()&&ue.userPanningEnabled()){var Ir=o(ze,t.hoverData.downs);Ir&&(t.hoverData.dragging=!0,t.hoverData.justStartedPan=!0,Te[4]=0,t.data.bgActivePosistion=Ps(be),t.redrawHint("select",!0),t.redraw())}ze&&ze.pannable()&&ze.active()&&ze.unactivate()}}else{if(ze&&ze.pannable()&&ze.active()&&ze.unactivate(),(!ze||!ze.grabbed())&&Ne!=He&&(He&&i(He,["mouseout","tapdragout"],Z,{x:pe[0],y:pe[1]}),Ne&&i(Ne,["mouseover","tapdragover"],Z,{x:pe[0],y:pe[1]}),t.hoverData.last=Ne),ze)if(Je){if(ue.boxSelectionEnabled()&&lt)ze&&ze.grabbed()&&(w(st),ze.emit(xt("freeon")),st.emit(xt("free")),t.dragData.didDrag&&(ze.emit(xt("dragfreeon")),st.emit(xt("dragfree")))),Rt();else if(ze&&ze.grabbed()&&t.nodeIsDraggable(ze)){var cr=!t.dragData.didDrag;cr&&t.redrawHint("eles",!0),t.dragData.didDrag=!0,t.hoverData.draggingEles||d(st,{inDragLayer:!0});var Mt={x:0,y:0};if(Ke(Ge[0])&&Ke(Ge[1])&&(Mt.x+=Ge[0],Mt.y+=Ge[1],cr)){var Qt=t.hoverData.dragDelta;Qt&&Ke(Qt[0])&&Ke(Qt[1])&&(Mt.x+=Qt[0],Mt.y+=Qt[1])}t.hoverData.draggingEles=!0,st.silentShift(Mt).emit(xt("position")).emit(xt("drag")),t.redrawHint("drag",!0),t.redraw()}}else gt();oe=!0}if(Te[2]=pe[0],Te[3]=pe[1],oe)return Z.stopPropagation&&Z.stopPropagation(),Z.preventDefault&&Z.preventDefault(),!1}},!1);var A,I,M;t.registerBinding(e,"mouseup",function(Z){if(!(t.hoverData.which===1&&Z.which!==1&&t.hoverData.capture)){var te=t.hoverData.capture;if(te){t.hoverData.capture=!1;var oe=t.cy,ue=t.projectIntoViewport(Z.clientX,Z.clientY),se=t.selection,he=t.findNearestElement(ue[0],ue[1],!0,!1),pe=t.dragData.possibleDragElements,be=t.hoverData.down,Se=s(Z);t.data.bgActivePosistion&&(t.redrawHint("select",!0),t.redraw()),t.hoverData.tapholdCancelled=!0,t.data.bgActivePosistion=void 0,be&&be.unactivate();var Te=function(qe){return{originalEvent:Z,type:qe,position:{x:ue[0],y:ue[1]}}};if(t.hoverData.which===3){var Ne=Te("cxttapend");if(be?be.emit(Ne):oe.emit(Ne),!t.hoverData.cxtDragged){var He=Te("cxttap");be?be.emit(He):oe.emit(He)}t.hoverData.cxtDragged=!1,t.hoverData.which=null}else if(t.hoverData.which===1){if(i(he,["mouseup","tapend","vmouseup"],Z,{x:ue[0],y:ue[1]}),!t.dragData.didDrag&&!t.hoverData.dragged&&!t.hoverData.selecting&&!t.hoverData.isOverThresholdDrag&&(i(be,["click","tap","vclick"],Z,{x:ue[0],y:ue[1]}),I=!1,Z.timeStamp-M<=oe.multiClickDebounceTime()?(A&&clearTimeout(A),I=!0,M=null,i(be,["dblclick","dbltap","vdblclick"],Z,{x:ue[0],y:ue[1]})):(A=setTimeout(function(){I||i(be,["oneclick","onetap","voneclick"],Z,{x:ue[0],y:ue[1]})},oe.multiClickDebounceTime()),M=Z.timeStamp)),be==null&&!t.dragData.didDrag&&!t.hoverData.selecting&&!t.hoverData.dragged&&!s(Z)&&(oe.$(r).unselect(["tapunselect"]),pe.length>0&&t.redrawHint("eles",!0),t.dragData.possibleDragElements=pe=oe.collection()),he==be&&!t.dragData.didDrag&&!t.hoverData.selecting&&he!=null&&he._private.selectable&&(t.hoverData.dragging||(oe.selectionType()==="additive"||Se?he.selected()?he.unselect(["tapunselect"]):he.select(["tapselect"]):Se||(oe.$(r).unmerge(he).unselect(["tapunselect"]),he.select(["tapselect"]))),t.redrawHint("eles",!0)),t.hoverData.selecting){var ze=oe.collection(t.getAllInBox(se[0],se[1],se[2],se[3]));t.redrawHint("select",!0),ze.length>0&&t.redrawHint("eles",!0),oe.emit(Te("boxend"));var Ge=function(qe){return qe.selectable()&&!qe.selected()};oe.selectionType()==="additive"||Se||oe.$(r).unmerge(ze).unselect(),ze.emit(Te("box")).stdFilter(Ge).select().emit(Te("boxselect")),t.redraw()}if(t.hoverData.dragging&&(t.hoverData.dragging=!1,t.redrawHint("select",!0),t.redrawHint("eles",!0),t.redraw()),!se[4]){t.redrawHint("drag",!0),t.redrawHint("eles",!0);var st=be&&be.grabbed();w(pe),st&&(be.emit(Te("freeon")),pe.emit(Te("free")),t.dragData.didDrag&&(be.emit(Te("dragfreeon")),pe.emit(Te("dragfree"))))}}se[4]=0,t.hoverData.down=null,t.hoverData.cxtStarted=!1,t.hoverData.draggingEles=!1,t.hoverData.selecting=!1,t.hoverData.isOverThresholdDrag=!1,t.dragData.didDrag=!1,t.hoverData.dragged=!1,t.hoverData.dragDelta=[],t.hoverData.mdownPos=null,t.hoverData.mdownGPos=null,t.hoverData.which=null}}},!1);var B=[],D=4,H,U=1e5,z=function(Z,te){for(var oe=0;oe<Z.length;oe++)if(Z[oe]%te!==0)return!1;return!0},W=function(Z){for(var te=Math.abs(Z[0]),oe=1;oe<Z.length;oe++)if(Math.abs(Z[oe])!==te)return!1;return!0},F=function(Z){var te=!1,oe=Z.deltaY;if(oe==null&&(Z.wheelDeltaY!=null?oe=Z.wheelDeltaY/4:Z.wheelDelta!=null&&(oe=Z.wheelDelta/4)),oe!==0){if(H==null)if(B.length>=D){var ue=B;if(H=z(ue,5),!H){var se=Math.abs(ue[0]);H=W(ue)&&se>5}if(H)for(var he=0;he<ue.length;he++)U=Math.min(Math.abs(ue[he]),U)}else B.push(oe),te=!0;else H&&(U=Math.min(Math.abs(oe),U));if(!t.scrollingPage){var pe=t.cy,be=pe.zoom(),Se=pe.pan(),Te=t.projectIntoViewport(Z.clientX,Z.clientY),Ne=[Te[0]*be+Se.x,Te[1]*be+Se.y];if(t.hoverData.draggingEles||t.hoverData.dragging||t.hoverData.cxtStarted||T()){Z.preventDefault();return}if(pe.panningEnabled()&&pe.userPanningEnabled()&&pe.zoomingEnabled()&&pe.userZoomingEnabled()){Z.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 He;te&&Math.abs(oe)>5&&(oe=eg(oe)*5),He=oe/-250,H&&(He/=U,He*=3),He=He*t.wheelSensitivity;var ze=Z.deltaMode===1;ze&&(He*=33);var Ge=pe.zoom()*Math.pow(10,He);Z.type==="gesturechange"&&(Ge=t.gestureStartZoom*Z.scale),pe.zoom({level:Ge,renderedPosition:{x:Ne[0],y:Ne[1]}}),pe.emit({type:Z.type==="gesturechange"?"pinchzoom":"scrollzoom",originalEvent:Z,position:{x:Te[0],y:Te[1]}})}}}};t.registerBinding(t.container,"wheel",F,!0),t.registerBinding(e,"scroll",function(Z){t.scrollingPage=!0,clearTimeout(t.scrollingPageTimeout),t.scrollingPageTimeout=setTimeout(function(){t.scrollingPage=!1},250)},!0),t.registerBinding(t.container,"gesturestart",function(Z){t.gestureStartZoom=t.cy.zoom(),t.hasTouchStarted||Z.preventDefault()},!0),t.registerBinding(t.container,"gesturechange",function(me){t.hasTouchStarted||F(me)},!0),t.registerBinding(t.container,"mouseout",function(Z){var te=t.projectIntoViewport(Z.clientX,Z.clientY);t.cy.emit({originalEvent:Z,type:"mouseout",position:{x:te[0],y:te[1]}})},!1),t.registerBinding(t.container,"mouseover",function(Z){var te=t.projectIntoViewport(Z.clientX,Z.clientY);t.cy.emit({originalEvent:Z,type:"mouseover",position:{x:te[0],y:te[1]}})},!1);var P,j,G,$,ee,ae,ie,K,q,Y,X,J,re,ce=function(Z,te,oe,ue){return Math.sqrt((oe-Z)*(oe-Z)+(ue-te)*(ue-te))},de=function(Z,te,oe,ue){return(oe-Z)*(oe-Z)+(ue-te)*(ue-te)},Re;t.registerBinding(t.container,"touchstart",Re=function(Z){if(t.hasTouchStarted=!0,!!k(Z)){m(),t.touchData.capture=!0,t.data.bgActivePosistion=void 0;var te=t.cy,oe=t.touchData.now,ue=t.touchData.earlier;if(Z.touches[0]){var se=t.projectIntoViewport(Z.touches[0].clientX,Z.touches[0].clientY);oe[0]=se[0],oe[1]=se[1]}if(Z.touches[1]){var se=t.projectIntoViewport(Z.touches[1].clientX,Z.touches[1].clientY);oe[2]=se[0],oe[3]=se[1]}if(Z.touches[2]){var se=t.projectIntoViewport(Z.touches[2].clientX,Z.touches[2].clientY);oe[4]=se[0],oe[5]=se[1]}var he=function(lt){return{originalEvent:Z,type:lt,position:{x:oe[0],y:oe[1]}}};if(Z.touches[1]){t.touchData.singleTouchMoved=!0,w(t.dragData.touchDragEles);var pe=t.findContainerClientCoords();q=pe[0],Y=pe[1],X=pe[2],J=pe[3],P=Z.touches[0].clientX-q,j=Z.touches[0].clientY-Y,G=Z.touches[1].clientX-q,$=Z.touches[1].clientY-Y,re=0<=P&&P<=X&&0<=G&&G<=X&&0<=j&&j<=J&&0<=$&&$<=J;var be=te.pan(),Se=te.zoom();ee=ce(P,j,G,$),ae=de(P,j,G,$),ie=[(P+G)/2,(j+$)/2],K=[(ie[0]-be.x)/Se,(ie[1]-be.y)/Se];var Te=200,Ne=Te*Te;if(ae<Ne&&!Z.touches[2]){var He=t.findNearestElement(oe[0],oe[1],!0,!0),ze=t.findNearestElement(oe[2],oe[3],!0,!0);He&&He.isNode()?(He.activate().emit(he("cxttapstart")),t.touchData.start=He):ze&&ze.isNode()?(ze.activate().emit(he("cxttapstart")),t.touchData.start=ze):te.emit(he("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(Z.touches[2])te.boxSelectionEnabled()&&Z.preventDefault();else if(!Z.touches[1]){if(Z.touches[0]){var Ge=t.findNearestElements(oe[0],oe[1],!0,!0),st=Ge[0];if(st!=null&&(st.activate(),t.touchData.start=st,t.touchData.starts=Ge,t.nodeIsGrabbable(st))){var Je=t.dragData.touchDragEles=te.collection(),qe=null;t.redrawHint("eles",!0),t.redrawHint("drag",!0),st.selected()?(qe=te.$(function(wt){return wt.selected()&&t.nodeIsGrabbable(wt)}),d(qe,{addToList:Je})):x(st,{addToList:Je}),u(st),st.emit(he("grabon")),qe?qe.forEach(function(wt){wt.emit(he("grab"))}):st.emit(he("grab"))}i(st,["touchstart","tapstart","vmousedown"],Z,{x:oe[0],y:oe[1]}),st==null&&(t.data.bgActivePosistion={x:se[0],y:se[1]},t.redrawHint("select",!0),t.redraw()),t.touchData.singleTouchMoved=!1,t.touchData.singleTouchStartTime=+new Date,clearTimeout(t.touchData.tapholdTimeout),t.touchData.tapholdTimeout=setTimeout(function(){t.touchData.singleTouchMoved===!1&&!t.pinching&&!t.touchData.selecting&&i(t.touchData.start,["taphold"],Z,{x:oe[0],y:oe[1]})},t.tapholdDuration)}}if(Z.touches.length>=1){for(var vt=t.touchData.startPosition=[null,null,null,null,null,null],Ze=0;Ze<oe.length;Ze++)vt[Ze]=ue[Ze]=oe[Ze];var Qe=Z.touches[0];t.touchData.startGPosition=[Qe.clientX,Qe.clientY]}}},!1);var Pe;t.registerBinding(e,"touchmove",Pe=function(Z){var te=t.touchData.capture;if(!(!te&&!k(Z))){var oe=t.selection,ue=t.cy,se=t.touchData.now,he=t.touchData.earlier,pe=ue.zoom();if(Z.touches[0]){var be=t.projectIntoViewport(Z.touches[0].clientX,Z.touches[0].clientY);se[0]=be[0],se[1]=be[1]}if(Z.touches[1]){var be=t.projectIntoViewport(Z.touches[1].clientX,Z.touches[1].clientY);se[2]=be[0],se[3]=be[1]}if(Z.touches[2]){var be=t.projectIntoViewport(Z.touches[2].clientX,Z.touches[2].clientY);se[4]=be[0],se[5]=be[1]}var Se=function(Ya){return{originalEvent:Z,type:Ya,position:{x:se[0],y:se[1]}}},Te=t.touchData.startGPosition,Ne;if(te&&Z.touches[0]&&Te){for(var He=[],ze=0;ze<se.length;ze++)He[ze]=se[ze]-he[ze];var Ge=Z.touches[0].clientX-Te[0],st=Ge*Ge,Je=Z.touches[0].clientY-Te[1],qe=Je*Je,vt=st+qe;Ne=vt>=t.touchTapThreshold2}if(te&&t.touchData.cxt){Z.preventDefault();var Ze=Z.touches[0].clientX-q,Qe=Z.touches[0].clientY-Y,wt=Z.touches[1].clientX-q,lt=Z.touches[1].clientY-Y,gt=de(Ze,Qe,wt,lt),xt=gt/ae,Rt=150,Ot=Rt*Rt,Tt=1.5,Nr=Tt*Tt;if(xt>=Nr||gt>=Ot){t.touchData.cxt=!1,t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);var Ir=Se("cxttapend");t.touchData.start?(t.touchData.start.unactivate().emit(Ir),t.touchData.start=null):ue.emit(Ir)}}if(te&&t.touchData.cxt){var Ir=Se("cxtdrag");t.data.bgActivePosistion=void 0,t.redrawHint("select",!0),t.touchData.start?t.touchData.start.emit(Ir):ue.emit(Ir),t.touchData.start&&(t.touchData.start._private.grabbed=!1),t.touchData.cxtDragged=!0;var cr=t.findNearestElement(se[0],se[1],!0,!0);(!t.touchData.cxtOver||cr!==t.touchData.cxtOver)&&(t.touchData.cxtOver&&t.touchData.cxtOver.emit(Se("cxtdragout")),t.touchData.cxtOver=cr,cr&&cr.emit(Se("cxtdragover")))}else if(te&&Z.touches[2]&&ue.boxSelectionEnabled())Z.preventDefault(),t.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,t.touchData.selecting||ue.emit(Se("boxstart")),t.touchData.selecting=!0,t.touchData.didSelect=!0,oe[4]=1,!oe||oe.length===0||oe[0]===void 0?(oe[0]=(se[0]+se[2]+se[4])/3,oe[1]=(se[1]+se[3]+se[5])/3,oe[2]=(se[0]+se[2]+se[4])/3+1,oe[3]=(se[1]+se[3]+se[5])/3+1):(oe[2]=(se[0]+se[2]+se[4])/3,oe[3]=(se[1]+se[3]+se[5])/3),t.redrawHint("select",!0),t.redraw();else if(te&&Z.touches[1]&&!t.touchData.didSelect&&ue.zoomingEnabled()&&ue.panningEnabled()&&ue.userZoomingEnabled()&&ue.userPanningEnabled()){Z.preventDefault(),t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);var Mt=t.dragData.touchDragEles;if(Mt){t.redrawHint("drag",!0);for(var Qt=0;Qt<Mt.length;Qt++){var $r=Mt[Qt]._private;$r.grabbed=!1,$r.rscratch.inDragLayer=!1}}var ar=t.touchData.start,Ze=Z.touches[0].clientX-q,Qe=Z.touches[0].clientY-Y,wt=Z.touches[1].clientX-q,lt=Z.touches[1].clientY-Y,Wn=ce(Ze,Qe,wt,lt),Dn=Wn/ee;if(re){var An=Ze-P,ha=Qe-j,fa=wt-G,qa=lt-$,Ht=(An+fa)/2,ro=(ha+qa)/2,cn=ue.zoom(),ai=cn*Dn,bn=ue.pan(),wi=K[0]*cn+bn.x,_i=K[1]*cn+bn.y,Zt={x:-ai/cn*(wi-bn.x-Ht)+wi,y:-ai/cn*(_i-bn.y-ro)+_i};if(ar&&ar.active()){var Mt=t.dragData.touchDragEles;w(Mt),t.redrawHint("drag",!0),t.redrawHint("eles",!0),ar.unactivate().emit(Se("freeon")),Mt.emit(Se("free")),t.dragData.didDrag&&(ar.emit(Se("dragfreeon")),Mt.emit(Se("dragfree")))}ue.viewport({zoom:ai,pan:Zt,cancelOnFailedZoom:!0}),ue.emit(Se("pinchzoom")),ee=Wn,P=Ze,j=Qe,G=wt,$=lt,t.pinching=!0}if(Z.touches[0]){var be=t.projectIntoViewport(Z.touches[0].clientX,Z.touches[0].clientY);se[0]=be[0],se[1]=be[1]}if(Z.touches[1]){var be=t.projectIntoViewport(Z.touches[1].clientX,Z.touches[1].clientY);se[2]=be[0],se[3]=be[1]}if(Z.touches[2]){var be=t.projectIntoViewport(Z.touches[2].clientX,Z.touches[2].clientY);se[4]=be[0],se[5]=be[1]}}else if(Z.touches[0]&&!t.touchData.didSelect){var nt=t.touchData.start,kt=t.touchData.last,cr;if(!t.hoverData.draggingEles&&!t.swipePanning&&(cr=t.findNearestElement(se[0],se[1],!0,!0)),te&&nt!=null&&Z.preventDefault(),te&&nt!=null&&t.nodeIsDraggable(nt))if(Ne){var Mt=t.dragData.touchDragEles,tr=!t.dragData.didDrag;tr&&d(Mt,{inDragLayer:!0}),t.dragData.didDrag=!0;var hr={x:0,y:0};if(Ke(He[0])&&Ke(He[1])&&(hr.x+=He[0],hr.y+=He[1],tr)){t.redrawHint("eles",!0);var hn=t.touchData.dragDelta;hn&&Ke(hn[0])&&Ke(hn[1])&&(hr.x+=hn[0],hr.y+=hn[1])}t.hoverData.draggingEles=!0,Mt.silentShift(hr).emit(Se("position")).emit(Se("drag")),t.redrawHint("drag",!0),t.touchData.startPosition[0]==he[0]&&t.touchData.startPosition[1]==he[1]&&t.redrawHint("eles",!0),t.redraw()}else{var hn=t.touchData.dragDelta=t.touchData.dragDelta||[];hn.length===0?(hn.push(He[0]),hn.push(He[1])):(hn[0]+=He[0],hn[1]+=He[1])}if(i(nt||cr,["touchmove","tapdrag","vmousemove"],Z,{x:se[0],y:se[1]}),(!nt||!nt.grabbed())&&cr!=kt&&(kt&&kt.emit(Se("tapdragout")),cr&&cr.emit(Se("tapdragover"))),t.touchData.last=cr,te)for(var Qt=0;Qt<se.length;Qt++)se[Qt]&&t.touchData.startPosition[Qt]&&Ne&&(t.touchData.singleTouchMoved=!0);if(te&&(nt==null||nt.pannable())&&ue.panningEnabled()&&ue.userPanningEnabled()){var ph=o(nt,t.touchData.starts);ph&&(Z.preventDefault(),t.data.bgActivePosistion||(t.data.bgActivePosistion=Ps(t.touchData.startPosition)),t.swipePanning?(ue.panBy({x:He[0]*pe,y:He[1]*pe}),ue.emit(Se("dragpan"))):Ne&&(t.swipePanning=!0,ue.panBy({x:Ge*pe,y:Je*pe}),ue.emit(Se("dragpan")),nt&&(nt.unactivate(),t.redrawHint("select",!0),t.touchData.start=null)));var be=t.projectIntoViewport(Z.touches[0].clientX,Z.touches[0].clientY);se[0]=be[0],se[1]=be[1]}}for(var ze=0;ze<se.length;ze++)he[ze]=se[ze];te&&Z.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(Z){var te=t.touchData.start;t.touchData.capture=!1,te&&te.unactivate()});var ke,Le,Ee,Ie;if(t.registerBinding(e,"touchend",ke=function(Z){var te=t.touchData.start,oe=t.touchData.capture;if(oe)Z.touches.length===0&&(t.touchData.capture=!1),Z.preventDefault();else return;var ue=t.selection;t.swipePanning=!1,t.hoverData.draggingEles=!1;var se=t.cy,he=se.zoom(),pe=t.touchData.now,be=t.touchData.earlier;if(Z.touches[0]){var Se=t.projectIntoViewport(Z.touches[0].clientX,Z.touches[0].clientY);pe[0]=Se[0],pe[1]=Se[1]}if(Z.touches[1]){var Se=t.projectIntoViewport(Z.touches[1].clientX,Z.touches[1].clientY);pe[2]=Se[0],pe[3]=Se[1]}if(Z.touches[2]){var Se=t.projectIntoViewport(Z.touches[2].clientX,Z.touches[2].clientY);pe[4]=Se[0],pe[5]=Se[1]}var Te=function(Ot){return{originalEvent:Z,type:Ot,position:{x:pe[0],y:pe[1]}}};te&&te.unactivate();var Ne;if(t.touchData.cxt){if(Ne=Te("cxttapend"),te?te.emit(Ne):se.emit(Ne),!t.touchData.cxtDragged){var He=Te("cxttap");te?te.emit(He):se.emit(He)}t.touchData.start&&(t.touchData.start._private.grabbed=!1),t.touchData.cxt=!1,t.touchData.start=null,t.redraw();return}if(!Z.touches[2]&&se.boxSelectionEnabled()&&t.touchData.selecting){t.touchData.selecting=!1;var ze=se.collection(t.getAllInBox(ue[0],ue[1],ue[2],ue[3]));ue[0]=void 0,ue[1]=void 0,ue[2]=void 0,ue[3]=void 0,ue[4]=0,t.redrawHint("select",!0),se.emit(Te("boxend"));var Ge=function(Ot){return Ot.selectable()&&!Ot.selected()};ze.emit(Te("box")).stdFilter(Ge).select().emit(Te("boxselect")),ze.nonempty()&&t.redrawHint("eles",!0),t.redraw()}if(te!=null&&te.unactivate(),Z.touches[2])t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);else if(!Z.touches[1]){if(!Z.touches[0]){if(!Z.touches[0]){t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);var st=t.dragData.touchDragEles;if(te!=null){var Je=te._private.grabbed;w(st),t.redrawHint("drag",!0),t.redrawHint("eles",!0),Je&&(te.emit(Te("freeon")),st.emit(Te("free")),t.dragData.didDrag&&(te.emit(Te("dragfreeon")),st.emit(Te("dragfree")))),i(te,["touchend","tapend","vmouseup","tapdragout"],Z,{x:pe[0],y:pe[1]}),te.unactivate(),t.touchData.start=null}else{var qe=t.findNearestElement(pe[0],pe[1],!0,!0);i(qe,["touchend","tapend","vmouseup","tapdragout"],Z,{x:pe[0],y:pe[1]})}var vt=t.touchData.startPosition[0]-pe[0],Ze=vt*vt,Qe=t.touchData.startPosition[1]-pe[1],wt=Qe*Qe,lt=Ze+wt,gt=lt*he*he;t.touchData.singleTouchMoved||(te||se.$(":selected").unselect(["tapunselect"]),i(te,["tap","vclick"],Z,{x:pe[0],y:pe[1]}),Le=!1,Z.timeStamp-Ie<=se.multiClickDebounceTime()?(Ee&&clearTimeout(Ee),Le=!0,Ie=null,i(te,["dbltap","vdblclick"],Z,{x:pe[0],y:pe[1]})):(Ee=setTimeout(function(){Le||i(te,["onetap","voneclick"],Z,{x:pe[0],y:pe[1]})},se.multiClickDebounceTime()),Ie=Z.timeStamp)),te!=null&&!t.dragData.didDrag&&te._private.selectable&&gt<t.touchTapThreshold2&&!t.pinching&&(se.selectionType()==="single"?(se.$(r).unmerge(te).unselect(["tapunselect"]),te.select(["tapselect"])):te.selected()?te.unselect(["tapunselect"]):te.select(["tapselect"]),t.redrawHint("eles",!0)),t.touchData.singleTouchMoved=!0}}}for(var xt=0;xt<pe.length;xt++)be[xt]=pe[xt];t.dragData.didDrag=!1,Z.touches.length===0&&(t.touchData.dragDelta=[],t.touchData.startPosition=[null,null,null,null,null,null],t.touchData.startGPosition=null,t.touchData.didSelect=!1),Z.touches.length<2&&(Z.touches.length===1&&(t.touchData.startGPosition=[Z.touches[0].clientX,Z.touches[0].clientY]),t.pinching=!1,t.redrawHint("eles",!0),t.redraw())},!1),typeof TouchEvent>"u"){var Oe=[],De=function(Z){return{clientX:Z.clientX,clientY:Z.clientY,force:1,identifier:Z.pointerId,pageX:Z.pageX,pageY:Z.pageY,radiusX:Z.width/2,radiusY:Z.height/2,screenX:Z.screenX,screenY:Z.screenY,target:Z.target}},We=function(Z){return{event:Z,touch:De(Z)}},Ye=function(Z){Oe.push(We(Z))},ge=function(Z){for(var te=0;te<Oe.length;te++){var oe=Oe[te];if(oe.event.pointerId===Z.pointerId){Oe.splice(te,1);return}}},Ce=function(Z){var te=Oe.filter(function(oe){return oe.event.pointerId===Z.pointerId})[0];te.event=Z,te.touch=De(Z)},Ae=function(Z){Z.touches=Oe.map(function(te){return te.touch})},Fe=function(Z){return Z.pointerType==="mouse"||Z.pointerType===4};t.registerBinding(t.container,"pointerdown",function(me){Fe(me)||(me.preventDefault(),Ye(me),Ae(me),Re(me))}),t.registerBinding(t.container,"pointerup",function(me){Fe(me)||(ge(me),Ae(me),ke(me))}),t.registerBinding(t.container,"pointercancel",function(me){Fe(me)||(ge(me),Ae(me),_e(me))}),t.registerBinding(t.container,"pointermove",function(me){Fe(me)||(me.preventDefault(),Ce(me),Ae(me),Pe(me))})}};var yi={};yi.generatePolygon=function(t,e){return this.nodeShapes[t]={renderer:this,name:t,points:e,draw:function(n,i,s,o,a,l){this.renderer.nodeShapeImpl("polygon",n,i,s,o,a,this.points)},intersectLine:function(n,i,s,o,a,l,u,c){return vl(a,l,this.points,n,i,s/2,o/2,u)},checkPoint:function(n,i,s,o,a,l,u,c){return mi(n,i,this.points,l,u,o,a,[0,-1],s)},hasMiterBounds:t!=="rectangle",miterBounds:function(n,i,s,o,a,l){return G3(this.points,n,i,s,o,a)}}};yi.generateEllipse=function(){return this.nodeShapes.ellipse={renderer:this,name:"ellipse",draw:function(e,r,n,i,s,o){this.renderer.nodeShapeImpl(this.name,e,r,n,i,s)},intersectLine:function(e,r,n,i,s,o,a,l){return eT(s,o,e,r,n/2+a,i/2+a)},checkPoint:function(e,r,n,i,s,o,a,l){return Ia(e,r,i,s,o,a,n)}}};yi.generateRoundPolygon=function(t,e){return this.nodeShapes[t]={renderer:this,name:t,points:e,getOrCreateCorners:function(n,i,s,o,a,l,u){if(l[u]!==void 0&&l[u+"-cx"]===n&&l[u+"-cy"]===i)return l[u];l[u]=new Array(e.length/2),l[u+"-cx"]=n,l[u+"-cy"]=i;var c=s/2,h=o/2;a=a==="auto"?Aw(s,o):a;for(var v=new Array(e.length/2),d=0;d<e.length/2;d++)v[d]={x:n+c*e[d*2],y:i+h*e[d*2+1]};var x,w,g,m,y=v.length;for(w=v[y-1],x=0;x<y;x++)g=v[x%y],m=v[(x+1)%y],l[u][x]=dg(w,g,m,a),w=g,g=m;return l[u]},draw:function(n,i,s,o,a,l,u){this.renderer.nodeShapeImpl("round-polygon",n,i,s,o,a,this.points,this.getOrCreateCorners(i,s,o,a,l,u,"drawCorners"))},intersectLine:function(n,i,s,o,a,l,u,c,h){return rT(a,l,this.points,n,i,s,o,u,this.getOrCreateCorners(n,i,s,o,c,h,"corners"))},checkPoint:function(n,i,s,o,a,l,u,c,h){return J3(n,i,this.points,l,u,o,a,this.getOrCreateCorners(l,u,o,a,c,h,"corners"))}}};yi.generateRoundRectangle=function(){return this.nodeShapes["round-rectangle"]=this.nodeShapes.roundrectangle={renderer:this,name:"round-rectangle",points:Yr(4,0),draw:function(e,r,n,i,s,o){this.renderer.nodeShapeImpl(this.name,e,r,n,i,s,this.points,o)},intersectLine:function(e,r,n,i,s,o,a,l){return Lw(s,o,e,r,n,i,a,l)},checkPoint:function(e,r,n,i,s,o,a,l){var u=i/2,c=s/2;l=l==="auto"?ea(i,s):l,l=Math.min(u,c,l);var h=l*2;return!!(mi(e,r,this.points,o,a,i,s-h,[0,-1],n)||mi(e,r,this.points,o,a,i-h,s,[0,-1],n)||Ia(e,r,h,h,o-u+l,a-c+l,n)||Ia(e,r,h,h,o+u-l,a-c+l,n)||Ia(e,r,h,h,o+u-l,a+c-l,n)||Ia(e,r,h,h,o-u+l,a+c-l,n))}}};yi.generateCutRectangle=function(){return this.nodeShapes["cut-rectangle"]=this.nodeShapes.cutrectangle={renderer:this,name:"cut-rectangle",cornerLength:rg(),points:Yr(4,0),draw:function(e,r,n,i,s,o){this.renderer.nodeShapeImpl(this.name,e,r,n,i,s,null,o)},generateCutTrianglePts:function(e,r,n,i,s){var o=s==="auto"?this.cornerLength:s,a=r/2,l=e/2,u=n-l,c=n+l,h=i-a,v=i+a;return{topLeft:[u,h+o,u+o,h,u+o,h+o],topRight:[c-o,h,c,h+o,c-o,h+o],bottomRight:[c,v-o,c-o,v,c-o,v-o],bottomLeft:[u+o,v,u,v-o,u+o,v-o]}},intersectLine:function(e,r,n,i,s,o,a,l){var u=this.generateCutTrianglePts(n+2*a,i+2*a,e,r,l),c=[].concat.apply([],[u.topLeft.splice(0,4),u.topRight.splice(0,4),u.bottomRight.splice(0,4),u.bottomLeft.splice(0,4)]);return vl(s,o,c,e,r)},checkPoint:function(e,r,n,i,s,o,a,l){var u=l==="auto"?this.cornerLength:l;if(mi(e,r,this.points,o,a,i,s-2*u,[0,-1],n)||mi(e,r,this.points,o,a,i-2*u,s,[0,-1],n))return!0;var c=this.generateCutTrianglePts(i,s,o,a);return on(e,r,c.topLeft)||on(e,r,c.topRight)||on(e,r,c.bottomRight)||on(e,r,c.bottomLeft)}}};yi.generateBarrel=function(){return this.nodeShapes.barrel={renderer:this,name:"barrel",points:Yr(4,0),draw:function(e,r,n,i,s,o){this.renderer.nodeShapeImpl(this.name,e,r,n,i,s)},intersectLine:function(e,r,n,i,s,o,a,l){var u=.15,c=.5,h=.85,v=this.generateBarrelBezierPts(n+2*a,i+2*a,e,r),d=function(g){var m=Bs({x:g[0],y:g[1]},{x:g[2],y:g[3]},{x:g[4],y:g[5]},u),y=Bs({x:g[0],y:g[1]},{x:g[2],y:g[3]},{x:g[4],y:g[5]},c),b=Bs({x:g[0],y:g[1]},{x:g[2],y:g[3]},{x:g[4],y:g[5]},h);return[g[0],g[1],m.x,m.y,y.x,y.y,b.x,b.y,g[4],g[5]]},x=[].concat(d(v.topLeft),d(v.topRight),d(v.bottomRight),d(v.bottomLeft));return vl(s,o,x,e,r)},generateBarrelBezierPts:function(e,r,n,i){var s=r/2,o=e/2,a=n-o,l=n+o,u=i-s,c=i+s,h=fv(e,r),v=h.heightOffset,d=h.widthOffset,x=h.ctrlPtOffsetPct*e,w={topLeft:[a,u+v,a+x,u,a+d,u],topRight:[l-d,u,l-x,u,l,u+v],bottomRight:[l,c-v,l-x,c,l-d,c],bottomLeft:[a+d,c,a+x,c,a,c-v]};return w.topLeft.isTop=!0,w.topRight.isTop=!0,w.bottomLeft.isBottom=!0,w.bottomRight.isBottom=!0,w},checkPoint:function(e,r,n,i,s,o,a,l){var u=fv(i,s),c=u.heightOffset,h=u.widthOffset;if(mi(e,r,this.points,o,a,i,s-2*c,[0,-1],n)||mi(e,r,this.points,o,a,i-2*h,s,[0,-1],n))return!0;for(var v=this.generateBarrelBezierPts(i,s,o,a),d=function(k,L,A){var I=A[4],M=A[2],B=A[0],D=A[5],H=A[1],U=Math.min(I,B),z=Math.max(I,B),W=Math.min(D,H),F=Math.max(D,H);if(U<=k&&k<=z&&W<=L&&L<=F){var P=nT(I,M,B),j=X3(P[0],P[1],P[2],k),G=j.filter(function($){return 0<=$&&$<=1});if(G.length>0)return G[0]}return null},x=Object.keys(v),w=0;w<x.length;w++){var g=x[w],m=v[g],y=d(e,r,m);if(y!=null){var b=m[5],S=m[3],N=m[1],E=Er(b,S,N,y);if(m.isTop&&E<=r||m.isBottom&&r<=E)return!0}}return!1}}};yi.generateBottomRoundrectangle=function(){return this.nodeShapes["bottom-round-rectangle"]=this.nodeShapes.bottomroundrectangle={renderer:this,name:"bottom-round-rectangle",points:Yr(4,0),draw:function(e,r,n,i,s,o){this.renderer.nodeShapeImpl(this.name,e,r,n,i,s,this.points,o)},intersectLine:function(e,r,n,i,s,o,a,l){var u=e-(n/2+a),c=r-(i/2+a),h=c,v=e+(n/2+a),d=Xi(s,o,e,r,u,c,v,h,!1);return d.length>0?d:Lw(s,o,e,r,n,i,a,l)},checkPoint:function(e,r,n,i,s,o,a,l){l=l==="auto"?ea(i,s):l;var u=2*l;if(mi(e,r,this.points,o,a,i,s-u,[0,-1],n)||mi(e,r,this.points,o,a,i-u,s,[0,-1],n))return!0;var c=i/2+2*n,h=s/2+2*n,v=[o-c,a-h,o-c,a,o+c,a,o+c,a-h];return!!(on(e,r,v)||Ia(e,r,u,u,o+i/2-l,a+s/2-l,n)||Ia(e,r,u,u,o-i/2+l,a+s/2-l,n))}}};yi.registerNodeShapes=function(){var t=this.nodeShapes={},e=this;this.generateEllipse(),this.generatePolygon("triangle",Yr(3,0)),this.generateRoundPolygon("round-triangle",Yr(3,0)),this.generatePolygon("rectangle",Yr(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",Yr(5,0)),this.generateRoundPolygon("round-pentagon",Yr(5,0)),this.generatePolygon("hexagon",Yr(6,0)),this.generateRoundPolygon("round-hexagon",Yr(6,0)),this.generatePolygon("heptagon",Yr(7,0)),this.generateRoundPolygon("round-heptagon",Yr(7,0)),this.generatePolygon("octagon",Yr(8,0)),this.generateRoundPolygon("round-octagon",Yr(8,0));var n=new Array(20);{var i=hv(5,0),s=hv(5,Math.PI/5),o=.5*(3-Math.sqrt(5));o*=1.57;for(var a=0;a<s.length/2;a++)s[a*2]*=o,s[a*2+1]*=o;for(var a=0;a<20/4;a++)n[a*4]=i[a*2],n[a*4+1]=i[a*2+1],n[a*4+2]=s[a*2],n[a*4+3]=s[a*2+1]}n=Dw(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 l=[-1,-1,.25,-1,1,0,.25,1,-1,1];this.generatePolygon("tag",l),this.generateRoundPolygon("round-tag",l)}t.makePolygon=function(u){var c=u.join("$"),h="polygon-"+c,v;return(v=this[h])?v:e.generatePolygon(h,u)}};var Ml={};Ml.timeToRender=function(){return this.redrawTotalTime/this.redrawCount};Ml.redraw=function(t){t=t||kw();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};Ml.beforeRender=function(t,e){if(!this.destroyed){e==null&&er("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 L1=function(e,r,n){for(var i=e.beforeRenderCallbacks,s=0;s<i.length;s++)i[s].fn(r,n)};Ml.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){L1(t,!0,i);var s=gi();t.render(t.renderOptions);var o=t.lastDrawTime=gi();t.averageRedrawTime===void 0&&(t.averageRedrawTime=o-s),t.redrawCount===void 0&&(t.redrawCount=0),t.redrawCount++,t.redrawTotalTime===void 0&&(t.redrawTotalTime=0);var a=o-s;t.redrawTotalTime+=a,t.lastRedrawTime=a,t.averageRedrawTime=t.averageRedrawTime/2+a/2,t.requestedFrame=!1}else L1(t,!1,i);t.skipFrame=!1,Nc(r)}};Nc(r)}};var _L=function(e){this.init(e)},M_=_L,Js=M_.prototype;Js.clientFunctions=["redrawHint","render","renderTo","matchCanvasSize","nodeShapeImpl","arrowShapeImpl"];Js.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,s=i.head,o="__________cytoscape_stylesheet",a="__________cytoscape_container",l=i.getElementById(o)!=null;if(r.className.indexOf(a)<0&&(r.className=(r.className||"")+" "+a),!l){var u=i.createElement("style");u.id=o,u.textContent="."+a+" { position: relative; }",s.insertBefore(u,s.children[0])}var c=n.getComputedStyle(r),h=c.getPropertyValue("position");h==="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=Ke(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()};Js.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()}};Js.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{}};Js.isHeadless=function(){return!1};[fg,L_,D_,Zs,yi,Ml].forEach(function(t){pt(Js,t)});var Lp=1e3/60,P_={setupDequeueing:function(e){return function(){var n=this,i=this.renderer;if(!n.dequeueingSetup){n.dequeueingSetup=!0;var s=Nl(function(){i.redrawHint("eles",!0),i.redrawHint("drag",!0),i.redraw()},e.deqRedrawThreshold),o=function(u,c){var h=gi(),v=i.averageRedrawTime,d=i.lastRedrawTime,x=[],w=i.cy.extent(),g=i.getPixelRatio();for(u||i.flushRenderedStyleQueue();;){var m=gi(),y=m-h,b=m-c;if(d<Lp){var S=Lp-(u?v:0);if(b>=e.deqFastCost*S)break}else if(u){if(y>=e.deqCost*d||y>=e.deqAvgCost*v)break}else if(b>=e.deqNoDrawCost*Lp)break;var N=e.deq(n,g,w);if(N.length>0)for(var E=0;E<N.length;E++)x.push(N[E]);else break}x.length>0&&(e.onDeqd(n,x),!u&&e.shouldRedraw(n,x,g,w)&&s())},a=e.priority||Qv;i.beforeRender(o,a(n))}}}},SL=(function(){function t(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Rc;aa(this,t),this.idsByKey=new vi,this.keyForId=new vi,this.cachesByLvl=new vi,this.lvls=[],this.getKey=e,this.doesEleInvalidateKey=r}return sa(t,[{key:"getIdsFor",value:function(r){r==null&&er("Can not get id list for null key");var n=this.idsByKey,i=this.idsByKey.get(r);return i||(i=new Ys,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),s=this.getKey(r);this.deleteIdForKey(i,n),this.addIdForKey(s,n),this.keyForId.set(n,s)}},{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),s=this.getKey(r);return i!==s}},{key:"isInvalid",value:function(r){return this.keyHasChangedFor(r)||this.doesEleInvalidateKey(r)}},{key:"getCachesAt",value:function(r){var n=this.cachesByLvl,i=this.lvls,s=n.get(r);return s||(s=new vi,n.set(r,s),i.push(r)),s}},{key:"getCache",value:function(r,n){return this.getCachesAt(n).get(r)}},{key:"get",value:function(r,n){var i=this.getKey(r),s=this.getCache(i,n);return s!=null&&this.updateKeyMappingFor(r),s}},{key:"getForCachedKey",value:function(r,n){var i=this.keyForId.get(r.id()),s=this.getCache(i,n);return s}},{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 s=this.getKey(r);this.setCache(s,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 s=this.doesEleInvalidateKey(r);return s&&this.invalidateKey(i),s||this.getNumberOfIdsForKey(i)===0}}])})(),D1=25,rc=50,xc=-4,Ev=3,I_=7.99,CL=8,EL=1024,kL=1024,TL=1024,NL=.2,RL=.8,LL=10,DL=.15,AL=.1,ML=.9,PL=.9,IL=100,OL=1,Os={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},BL=Mr({getKey:null,doesEleInvalidateKey:Rc,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:Sw,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),rl=function(e,r){var n=this;n.renderer=e,n.onDequeues=[];var i=BL(r);pt(n,i),n.lookup=new SL(i.getKey,i.doesEleInvalidateKey),n.setupDequeueing()},wr=rl.prototype;wr.reasons=Os;wr.getTextureQueue=function(t){var e=this;return e.eleImgCaches=e.eleImgCaches||{},e.eleImgCaches[t]=e.eleImgCaches[t]||[]};wr.getRetiredTextureQueue=function(t){var e=this,r=e.eleImgCaches.retired=e.eleImgCaches.retired||{},n=r[t]=r[t]||[];return n};wr.getElementQueue=function(){var t=this,e=t.eleCacheQueue=t.eleCacheQueue||new Rl(function(r,n){return n.reqs-r.reqs});return e};wr.getElementKeyToQueue=function(){var t=this,e=t.eleKeyToCacheQueue=t.eleKeyToCacheQueue||{};return e};wr.getElement=function(t,e,r,n,i){var s=this,o=this.renderer,a=o.cy.zoom(),l=this.lookup;if(!e||e.w===0||e.h===0||isNaN(e.w)||isNaN(e.h)||!t.visible()||t.removed()||!s.allowEdgeTxrCaching&&t.isEdge()||!s.allowParentTxrCaching&&t.isParent())return null;if(n==null&&(n=Math.ceil(Jv(a*r))),n<xc)n=xc;else if(a>=I_||n>Ev)return null;var u=Math.pow(2,n),c=e.h*u,h=e.w*u,v=o.eleTextBiggerThanMin(t,u);if(!this.isVisible(t,v))return null;var d=l.get(t,n);if(d&&d.invalidated&&(d.invalidated=!1,d.texture.invalidatedWidth-=d.width),d)return d;var x;if(c<=D1?x=D1:c<=rc?x=rc:x=Math.ceil(c/rc)*rc,c>TL||h>kL)return null;var w=s.getTextureQueue(x),g=w[w.length-2],m=function(){return s.recycleTexture(x,h)||s.addTexture(x,h)};g||(g=w[w.length-1]),g||(g=m()),g.width-g.usedWidth<h&&(g=m());for(var y=function(U){return U&&U.scaledLabelShown===v},b=i&&i===Os.dequeue,S=i&&i===Os.highQuality,N=i&&i===Os.downscale,E,T=n+1;T<=Ev;T++){var k=l.get(t,T);if(k){E=k;break}}var L=E&&E.level===n+1?E:null,A=function(){g.context.drawImage(L.texture.canvas,L.x,0,L.width,L.height,g.usedWidth,0,h,c)};if(g.context.setTransform(1,0,0,1,0,0),g.context.clearRect(g.usedWidth,0,h,x),y(L))A();else if(y(E))if(S){for(var I=E.level;I>n;I--)L=s.getElement(t,e,r,I,Os.downscale);A()}else return s.queueElement(t,E.level-1),E;else{var M;if(!b&&!S&&!N)for(var B=n-1;B>=xc;B--){var D=l.get(t,B);if(D){M=D;break}}if(y(M))return s.queueElement(t,n),M;g.context.translate(g.usedWidth,0),g.context.scale(u,u),this.drawElement(g.context,t,e,v,!1),g.context.scale(1/u,1/u),g.context.translate(-g.usedWidth,0)}return d={x:g.usedWidth,texture:g,level:n,scale:u,width:h,height:c,scaledLabelShown:v},g.usedWidth+=Math.ceil(h+CL),g.eleCaches.push(d),l.set(t,n,d),s.checkTextureFullness(g),d};wr.invalidateElements=function(t){for(var e=0;e<t.length;e++)this.invalidateElement(t[e])};wr.invalidateElement=function(t){var e=this,r=e.lookup,n=[],i=r.isInvalid(t);if(i){for(var s=xc;s<=Ev;s++){var o=r.getForCachedKey(t,s);o&&n.push(o)}var a=r.invalidate(t);if(a)for(var l=0;l<n.length;l++){var u=n[l],c=u.texture;c.invalidatedWidth+=u.width,u.invalidated=!0,e.checkTextureUtility(c)}e.removeFromQueue(t)}};wr.checkTextureUtility=function(t){t.invalidatedWidth>=NL*t.width&&this.retireTexture(t)};wr.checkTextureFullness=function(t){var e=this,r=e.getTextureQueue(t.height);t.usedWidth/t.width>RL&&t.fullnessChecks>=LL?Ji(r,t):t.fullnessChecks++};wr.retireTexture=function(t){var e=this,r=t.height,n=e.getTextureQueue(r),i=this.lookup;Ji(n,t),t.retired=!0;for(var s=t.eleCaches,o=0;o<s.length;o++){var a=s[o];i.deleteCache(a.key,a.level)}Zv(s);var l=e.getRetiredTextureQueue(r);l.push(t)};wr.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(EL,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};wr.recycleTexture=function(t,e){for(var r=this,n=r.getTextureQueue(t),i=r.getRetiredTextureQueue(t),s=0;s<i.length;s++){var o=i[s];if(o.width>=e)return o.retired=!1,o.usedWidth=0,o.invalidatedWidth=0,o.fullnessChecks=0,Zv(o.eleCaches),o.context.setTransform(1,0,0,1,0,0),o.context.clearRect(0,0,o.width,o.height),Ji(i,o),n.push(o),o}};wr.queueElement=function(t,e){var r=this,n=r.getElementQueue(),i=r.getElementKeyToQueue(),s=this.getKey(t),o=i[s];if(o)o.level=Math.max(o.level,e),o.eles.merge(t),o.reqs++,n.updateItem(o);else{var a={eles:t.spawn().merge(t),level:e,reqs:1,key:s};n.push(a),i[s]=a}};wr.dequeue=function(t){for(var e=this,r=e.getElementQueue(),n=e.getElementKeyToQueue(),i=[],s=e.lookup,o=0;o<OL&&r.size()>0;o++){var a=r.pop(),l=a.key,u=a.eles[0],c=s.hasCache(u,a.level);if(n[l]=null,c)continue;i.push(a);var h=e.getBoundingBox(u);e.getElement(u,h,t,a.level,Os.dequeue)}return i};wr.removeFromQueue=function(t){var e=this,r=e.getElementQueue(),n=e.getElementKeyToQueue(),i=this.getKey(t),s=n[i];s!=null&&(s.eles.length===1?(s.reqs=Kv,r.updateItem(s),r.pop(),n[i]=null):s.eles.unmerge(t))};wr.onDequeue=function(t){this.onDequeues.push(t)};wr.offDequeue=function(t){Ji(this.onDequeues,t)};wr.setupDequeueing=P_.setupDequeueing({deqRedrawThreshold:IL,deqCost:DL,deqAvgCost:AL,deqNoDrawCost:ML,deqFastCost:PL,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 s=0;s<r.length;s++)for(var o=r[s].eles,a=0;a<o.length;a++){var l=o[a].boundingBox();if(tg(l,i))return!0}return!1},priority:function(e){return e.renderer.beforeRenderPriorities.eleTxrDeq}});var jL=1,al=-4,Bc=2,FL=3.99,zL=50,HL=50,UL=.15,WL=.1,VL=.9,$L=.9,GL=1,A1=250,qL=4e3*4e3,M1=32767,YL=!0,O_=function(e){var r=this,n=r.renderer=e,i=n.cy;r.layersByLevel={},r.firstGet=!0,r.lastInvalidationTime=gi()-2*A1,r.skipping=!1,r.eleTxrDeqs=i.collection(),r.scheduleElementRefinement=Nl(function(){r.refineElementTextures(r.eleTxrDeqs),r.eleTxrDeqs.unmerge(r.eleTxrDeqs)},HL),n.beforeRender(function(o,a){a-r.lastInvalidationTime<=A1?r.skipping=!0:r.skipping=!1},n.beforeRenderPriorities.lyrTxrSkip);var s=function(a,l){return l.reqs-a.reqs};r.layersQueue=new Rl(s),r.setupDequeueing()},Pr=O_.prototype,P1=0,XL=Math.pow(2,53)-1;Pr.makeLayer=function(t,e){var r=Math.pow(2,e),n=Math.ceil(t.w*r),i=Math.ceil(t.h*r),s=this.renderer.makeOffscreenCanvas(n,i),o={id:P1=++P1%XL,bb:t,level:e,width:n,height:i,canvas:s,context:s.getContext("2d"),eles:[],elesQueue:[],reqs:0},a=o.context,l=-o.bb.x1,u=-o.bb.y1;return a.scale(r,r),a.translate(l,u),o};Pr.getLayers=function(t,e,r){var n=this,i=n.renderer,s=i.cy,o=s.zoom(),a=n.firstGet;if(n.firstGet=!1,r==null){if(r=Math.ceil(Jv(o*e)),r<al)r=al;else if(o>=FL||r>Bc)return null}n.validateLayersElesOrdering(r,t);var l=n.layersByLevel,u=Math.pow(2,r),c=l[r]=l[r]||[],h,v=n.levelIsComplete(r,t),d,x=function(){var A=function(H){if(n.validateLayersElesOrdering(H,t),n.levelIsComplete(H,t))return d=l[H],!0},I=function(H){if(!d)for(var U=r+H;al<=U&&U<=Bc&&!A(U);U+=H);};I(1),I(-1);for(var M=c.length-1;M>=0;M--){var B=c[M];B.invalid&&Ji(c,B)}};if(!v)x();else return c;var w=function(){if(!h){h=Qr();for(var A=0;A<t.length;A++)W3(h,t[A].boundingBox())}return h},g=function(A){A=A||{};var I=A.after;w();var M=Math.ceil(h.w*u),B=Math.ceil(h.h*u);if(M>M1||B>M1)return null;var D=M*B;if(D>qL)return null;var H=n.makeLayer(h,r);if(I!=null){var U=c.indexOf(I)+1;c.splice(U,0,H)}else(A.insert===void 0||A.insert)&&c.unshift(H);return H};if(n.skipping&&!a)return null;for(var m=null,y=t.length/jL,b=!a,S=0;S<t.length;S++){var N=t[S],E=N._private.rscratch,T=E.imgLayerCaches=E.imgLayerCaches||{},k=T[r];if(k){m=k;continue}if((!m||m.eles.length>=y||!Rw(m.bb,N.boundingBox()))&&(m=g({insert:!0,after:m}),!m))return null;d||b?n.queueLayer(m,N):n.drawEleInLayer(m,N,r,e),m.eles.push(N),T[r]=m}return d||(b?null:c)};Pr.getEleLevelForLayerLevel=function(t,e){return t};Pr.drawEleInLayer=function(t,e,r,n){var i=this,s=this.renderer,o=t.context,a=e.boundingBox();a.w===0||a.h===0||!e.visible()||(r=i.getEleLevelForLayerLevel(r,n),s.setImgSmoothing(o,!1),s.drawCachedElement(o,e,null,null,r,YL),s.setImgSmoothing(o,!0))};Pr.levelIsComplete=function(t,e){var r=this,n=r.layersByLevel[t];if(!n||n.length===0)return!1;for(var i=0,s=0;s<n.length;s++){var o=n[s];if(o.reqs>0||o.invalid)return!1;i+=o.eles.length}return i===e.length};Pr.validateLayersElesOrdering=function(t,e){var r=this.layersByLevel[t];if(r)for(var n=0;n<r.length;n++){for(var i=r[n],s=-1,o=0;o<e.length;o++)if(i.eles[0]===e[o]){s=o;break}if(s<0){this.invalidateLayer(i);continue}for(var a=s,o=0;o<i.eles.length;o++)if(i.eles[o]!==e[a+o]){this.invalidateLayer(i);break}}};Pr.updateElementsInLayers=function(t,e){for(var r=this,n=Cl(t[0]),i=0;i<t.length;i++)for(var s=n?null:t[i],o=n?t[i]:t[i].ele,a=o._private.rscratch,l=a.imgLayerCaches=a.imgLayerCaches||{},u=al;u<=Bc;u++){var c=l[u];c&&(s&&r.getEleLevelForLayerLevel(c.level)!==s.level||e(c,o,s))}};Pr.haveLayers=function(){for(var t=this,e=!1,r=al;r<=Bc;r++){var n=t.layersByLevel[r];if(n&&n.length>0){e=!0;break}}return e};Pr.invalidateElements=function(t){var e=this;t.length!==0&&(e.lastInvalidationTime=gi(),!(t.length===0||!e.haveLayers())&&e.updateElementsInLayers(t,function(n,i,s){e.invalidateLayer(n)}))};Pr.invalidateLayer=function(t){if(this.lastInvalidationTime=gi(),!t.invalid){var e=t.level,r=t.eles,n=this.layersByLevel[e];Ji(n,t),t.elesQueue=[],t.invalid=!0,t.replacement&&(t.replacement.invalid=!0);for(var i=0;i<r.length;i++){var s=r[i]._private.rscratch.imgLayerCaches;s&&(s[e]=null)}}};Pr.refineElementTextures=function(t){var e=this;e.updateElementsInLayers(t,function(n,i,s){var o=n.replacement;if(o||(o=n.replacement=e.makeLayer(n.bb,n.level),o.replaces=n,o.eles=n.eles),!o.reqs)for(var a=0;a<o.eles.length;a++)e.queueLayer(o,o.eles[a])})};Pr.enqueueElementRefinement=function(t){this.eleTxrDeqs.merge(t),this.scheduleElementRefinement()};Pr.queueLayer=function(t,e){var r=this,n=r.layersQueue,i=t.elesQueue,s=i.hasId=i.hasId||{};if(!t.replacement){if(e){if(s[e.id()])return;i.push(e),s[e.id()]=!0}t.reqs?(t.reqs++,n.updateItem(t)):(t.reqs=1,n.push(t))}};Pr.dequeue=function(t){for(var e=this,r=e.layersQueue,n=[],i=0;i<GL&&r.size()!==0;){var s=r.peek();if(s.replacement){r.pop();continue}if(s.replaces&&s!==s.replaces.replacement){r.pop();continue}if(s.invalid){r.pop();continue}var o=s.elesQueue.shift();o&&(e.drawEleInLayer(s,o,s.level,t),i++),n.length===0&&n.push(!0),s.elesQueue.length===0&&(r.pop(),s.reqs=0,s.replaces&&e.applyLayerReplacement(s),e.requestRedraw())}return n};Pr.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 s=0;s<t.eles.length;s++){var o=t.eles[s]._private,a=o.imgLayerCaches=o.imgLayerCaches||{};a&&(a[t.level]=t)}e.requestRedraw()}};Pr.requestRedraw=Nl(function(){var t=this.renderer;t.redrawHint("eles",!0),t.redrawHint("drag",!0),t.redraw()},100);Pr.setupDequeueing=P_.setupDequeueing({deqRedrawThreshold:zL,deqCost:UL,deqAvgCost:WL,deqNoDrawCost:VL,deqFastCost:$L,deq:function(e,r){return e.dequeue(r)},onDeqd:Qv,shouldRedraw:Sw,priority:function(e){return e.renderer.beforeRenderPriorities.lyrTxrDeq}});var B_={},I1;function KL(t,e){for(var r=0;r<e.length;r++){var n=e[r];t.lineTo(n.x,n.y)}}function QL(t,e,r){for(var n,i=0;i<e.length;i++){var s=e[i];i===0&&(n=s),t.lineTo(s.x,s.y)}t.quadraticCurveTo(r.x,r.y,n.x,n.y)}function O1(t,e,r){t.beginPath&&t.beginPath();for(var n=e,i=0;i<n.length;i++){var s=n[i];t.lineTo(s.x,s.y)}var o=r,a=r[0];t.moveTo(a.x,a.y);for(var i=1;i<o.length;i++){var s=o[i];t.lineTo(s.x,s.y)}t.closePath&&t.closePath()}function ZL(t,e,r,n,i){t.beginPath&&t.beginPath(),t.arc(r,n,i,0,Math.PI*2,!1);var s=e,o=s[0];t.moveTo(o.x,o.y);for(var a=0;a<s.length;a++){var l=s[a];t.lineTo(l.x,l.y)}t.closePath&&t.closePath()}function JL(t,e,r,n){t.arc(e,r,n,0,Math.PI*2,!1)}B_.arrowShapeImpl=function(t){return(I1||(I1={polygon:KL,"triangle-backcurve":QL,"triangle-tee":O1,"circle-triangle":ZL,"triangle-cross":O1,circle:JL}))[t]};var ni={};ni.drawElement=function(t,e,r,n,i,s){var o=this;e.isNode()?o.drawNode(t,e,r,n,i,s):o.drawEdge(t,e,r,n,i,s)};ni.drawElementOverlay=function(t,e){var r=this;e.isNode()?r.drawNodeOverlay(t,e):r.drawEdgeOverlay(t,e)};ni.drawElementUnderlay=function(t,e){var r=this;e.isNode()?r.drawNodeUnderlay(t,e):r.drawEdgeUnderlay(t,e)};ni.drawCachedElementPortion=function(t,e,r,n,i,s,o,a){var l=this,u=r.getBoundingBox(e);if(!(u.w===0||u.h===0)){var c=r.getElement(e,u,n,i,s);if(c!=null){var h=a(l,e);if(h===0)return;var v=o(l,e),d=u.x1,x=u.y1,w=u.w,g=u.h,m,y,b,S,N;if(v!==0){var E=r.getRotationPoint(e);b=E.x,S=E.y,t.translate(b,S),t.rotate(v),N=l.getImgSmoothing(t),N||l.setImgSmoothing(t,!0);var T=r.getRotationOffset(e);m=T.x,y=T.y}else m=d,y=x;var k;h!==1&&(k=t.globalAlpha,t.globalAlpha=k*h),t.drawImage(c.texture.canvas,c.x,0,c.width,c.height,m,y,w,g),h!==1&&(t.globalAlpha=k),v!==0&&(t.rotate(-v),t.translate(-b,-S),N||l.setImgSmoothing(t,!1))}else r.drawElement(t,e)}};var eD=function(){return 0},tD=function(e,r){return e.getTextAngle(r,null)},rD=function(e,r){return e.getTextAngle(r,"source")},nD=function(e,r){return e.getTextAngle(r,"target")},iD=function(e,r){return r.effectiveOpacity()},Dp=function(e,r){return r.pstyle("text-opacity").pfValue*r.effectiveOpacity()};ni.drawCachedElement=function(t,e,r,n,i,s){var o=this,a=o.data,l=a.eleTxrCache,u=a.lblTxrCache,c=a.slbTxrCache,h=a.tlbTxrCache,v=e.boundingBox(),d=s===!0?l.reasons.highQuality:null;if(!(v.w===0||v.h===0||!e.visible())&&(!n||tg(v,n))){var x=e.isEdge(),w=e.element()._private.rscratch.badLine;o.drawElementUnderlay(t,e),o.drawCachedElementPortion(t,e,l,r,i,d,eD,iD),(!x||!w)&&o.drawCachedElementPortion(t,e,u,r,i,d,tD,Dp),x&&!w&&(o.drawCachedElementPortion(t,e,c,r,i,d,rD,Dp),o.drawCachedElementPortion(t,e,h,r,i,d,nD,Dp)),o.drawElementOverlay(t,e)}};ni.drawElements=function(t,e){for(var r=this,n=0;n<e.length;n++){var i=e[n];r.drawElement(t,i)}};ni.drawCachedElements=function(t,e,r,n){for(var i=this,s=0;s<e.length;s++){var o=e[s];i.drawCachedElement(t,o,r,n)}};ni.drawCachedNodes=function(t,e,r,n){for(var i=this,s=0;s<e.length;s++){var o=e[s];o.isNode()&&i.drawCachedElement(t,o,r,n)}};ni.drawLayeredElements=function(t,e,r,n){var i=this,s=i.data.lyrTxrCache.getLayers(e,r);if(s)for(var o=0;o<s.length;o++){var a=s[o],l=a.bb;l.w===0||l.h===0||t.drawImage(a.canvas,l.x1,l.y1,l.w,l.h)}else i.drawCachedElements(t,e,r,n)};var xi={};xi.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,s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,o=this,a=e._private.rscratch;if(!(s&&!e.visible())&&!(a.badLine||a.allpts==null||isNaN(a.allpts[0]))){var l;r&&(l=r,t.translate(-l.x1,-l.y1));var u=s?e.pstyle("opacity").value:1,c=s?e.pstyle("line-opacity").value:1,h=e.pstyle("curve-style").value,v=e.pstyle("line-style").value,d=e.pstyle("width").pfValue,x=e.pstyle("line-cap").value,w=e.pstyle("line-outline-width").value,g=e.pstyle("line-outline-color").value,m=u*c,y=u*c,b=function(){var H=arguments.length>0&&arguments[0]!==void 0?arguments[0]:m;h==="straight-triangle"?(o.eleStrokeStyle(t,e,H),o.drawEdgeTrianglePath(e,t,a.allpts)):(t.lineWidth=d,t.lineCap=x,o.eleStrokeStyle(t,e,H),o.drawEdgePath(e,t,a.allpts,v),t.lineCap="butt")},S=function(){var H=arguments.length>0&&arguments[0]!==void 0?arguments[0]:m;if(t.lineWidth=d+w,t.lineCap=x,w>0)o.colorStrokeStyle(t,g[0],g[1],g[2],H);else{t.lineCap="butt";return}h==="straight-triangle"?o.drawEdgeTrianglePath(e,t,a.allpts):(o.drawEdgePath(e,t,a.allpts,v),t.lineCap="butt")},N=function(){i&&o.drawEdgeOverlay(t,e)},E=function(){i&&o.drawEdgeUnderlay(t,e)},T=function(){var H=arguments.length>0&&arguments[0]!==void 0?arguments[0]:y;o.drawArrowheads(t,e,H)},k=function(){o.drawElementText(t,e,null,n)};t.lineJoin="round";var L=e.pstyle("ghost").value==="yes";if(L){var A=e.pstyle("ghost-offset-x").pfValue,I=e.pstyle("ghost-offset-y").pfValue,M=e.pstyle("ghost-opacity").value,B=m*M;t.translate(A,I),b(B),T(B),t.translate(-A,-I)}else S();E(),b(),T(),N(),k(),r&&t.translate(l.x1,l.y1)}};var j_=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 s=this,o=s.usePaths(),a=n._private.rscratch,l=n.pstyle("".concat(e,"-padding")).pfValue,u=2*l,c=n.pstyle("".concat(e,"-color")).value;r.lineWidth=u,a.edgeType==="self"&&!o?r.lineCap="butt":r.lineCap="round",s.colorStrokeStyle(r,c[0],c[1],c[2],i),s.drawEdgePath(n,r,a.allpts,"solid")}}}};xi.drawEdgeOverlay=j_("overlay");xi.drawEdgeUnderlay=j_("underlay");xi.drawEdgePath=function(t,e,r,n){var i=t._private.rscratch,s=e,o,a=!1,l=this.usePaths(),u=t.pstyle("line-dash-pattern").pfValue,c=t.pstyle("line-dash-offset").pfValue;if(l){var h=r.join("$"),v=i.pathCacheKey&&i.pathCacheKey===h;v?(o=e=i.pathCache,a=!0):(o=e=new Path2D,i.pathCacheKey=h,i.pathCache=o)}if(s.setLineDash)switch(n){case"dotted":s.setLineDash([1,1]);break;case"dashed":s.setLineDash(u),s.lineDashOffset=c;break;case"solid":s.setLineDash([]);break}if(!a&&!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 d=2;d+3<r.length;d+=4)e.quadraticCurveTo(r[d],r[d+1],r[d+2],r[d+3]);break;case"straight":case"haystack":for(var x=2;x+1<r.length;x+=2)e.lineTo(r[x],r[x+1]);break;case"segments":if(i.isRound){var w=ln(i.roundCorners),g;try{for(w.s();!(g=w.n()).done;){var m=g.value;E_(e,m)}}catch(b){w.e(b)}finally{w.f()}e.lineTo(r[r.length-2],r[r.length-1])}else for(var y=2;y+1<r.length;y+=2)e.lineTo(r[y],r[y+1]);break}e=s,l?e.stroke(o):e.stroke(),e.setLineDash&&e.setLineDash([])};xi.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 s=[r[i+2]-r[i],r[i+3]-r[i+1]],o=Math.sqrt(s[0]*s[0]+s[1]*s[1]),a=[s[1]/o,-s[0]/o],l=[a[0]*n/2,a[1]*n/2];e.beginPath(),e.moveTo(r[i]-l[0],r[i+1]-l[1]),e.lineTo(r[i]+l[0],r[i+1]+l[1]),e.lineTo(r[i+2],r[i+3]),e.closePath(),e.fill()}};xi.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)};xi.drawArrowhead=function(t,e,r,n,i,s,o){if(!(isNaN(n)||n==null||isNaN(i)||i==null||isNaN(s)||s==null)){var a=this,l=e.pstyle(r+"-arrow-shape").value;if(l!=="none"){var u=e.pstyle(r+"-arrow-fill").value==="hollow"?"both":"filled",c=e.pstyle(r+"-arrow-fill").value,h=e.pstyle("width").pfValue,v=e.pstyle(r+"-arrow-width"),d=v.value==="match-line"?h:v.pfValue;v.units==="%"&&(d*=h);var x=e.pstyle("opacity").value;o===void 0&&(o=x);var w=t.globalCompositeOperation;(o!==1||c==="hollow")&&(t.globalCompositeOperation="destination-out",a.colorFillStyle(t,255,255,255,1),a.colorStrokeStyle(t,255,255,255,1),a.drawArrowShape(e,t,u,h,l,d,n,i,s),t.globalCompositeOperation=w);var g=e.pstyle(r+"-arrow-color").value;a.colorFillStyle(t,g[0],g[1],g[2],o),a.colorStrokeStyle(t,g[0],g[1],g[2],o),a.drawArrowShape(e,t,c,h,l,d,n,i,s)}}};xi.drawArrowShape=function(t,e,r,n,i,s,o,a,l){var u=this,c=this.usePaths()&&i!=="triangle-cross",h=!1,v,d=e,x={x:o,y:a},w=t.pstyle("arrow-scale").value,g=this.getArrowWidth(n,w),m=u.arrowShapes[i];if(c){var y=u.arrowPathCache=u.arrowPathCache||[],b=ja(i),S=y[b];S!=null?(v=e=S,h=!0):(v=e=new Path2D,y[b]=v)}h||(e.beginPath&&e.beginPath(),c?m.draw(e,1,0,{x:0,y:0},1):m.draw(e,g,l,x,n),e.closePath&&e.closePath()),e=d,c&&(e.translate(o,a),e.rotate(l),e.scale(g,g)),(r==="filled"||r==="both")&&(c?e.fill(v):e.fill()),(r==="hollow"||r==="both")&&(e.lineWidth=s/(c?g:1),e.lineJoin="miter",c?e.stroke(v):e.stroke()),c&&(e.scale(1/g,1/g),e.rotate(-l),e.translate(-o,-a))};var vg={};vg.safeDrawImage=function(t,e,r,n,i,s,o,a,l,u){if(!(i<=0||s<=0||l<=0||u<=0))try{t.drawImage(e,r,n,i,s,o,a,l,u)}catch(c){jt(c)}};vg.drawInscribedImage=function(t,e,r,n,i){var s=this,o=r.position(),a=o.x,l=o.y,u=r.cy().style(),c=u.getIndexedStyle.bind(u),h=c(r,"background-fit","value",n),v=c(r,"background-repeat","value",n),d=r.width(),x=r.height(),w=r.padding()*2,g=d+(c(r,"background-width-relative-to","value",n)==="inner"?0:w),m=x+(c(r,"background-height-relative-to","value",n)==="inner"?0:w),y=r._private.rscratch,b=c(r,"background-clip","value",n),S=b==="node",N=c(r,"background-image-opacity","value",n)*i,E=c(r,"background-image-smoothing","value",n),T=r.pstyle("corner-radius").value;T!=="auto"&&(T=r.pstyle("corner-radius").pfValue);var k=e.width||e.cachedW,L=e.height||e.cachedH;(k==null||L==null)&&(document.body.appendChild(e),k=e.cachedW=e.width||e.offsetWidth,L=e.cachedH=e.height||e.offsetHeight,document.body.removeChild(e));var A=k,I=L;if(c(r,"background-width","value",n)!=="auto"&&(c(r,"background-width","units",n)==="%"?A=c(r,"background-width","pfValue",n)*g:A=c(r,"background-width","pfValue",n)),c(r,"background-height","value",n)!=="auto"&&(c(r,"background-height","units",n)==="%"?I=c(r,"background-height","pfValue",n)*m:I=c(r,"background-height","pfValue",n)),!(A===0||I===0)){if(h==="contain"){var M=Math.min(g/A,m/I);A*=M,I*=M}else if(h==="cover"){var M=Math.max(g/A,m/I);A*=M,I*=M}var B=a-g/2,D=c(r,"background-position-x","units",n),H=c(r,"background-position-x","pfValue",n);D==="%"?B+=(g-A)*H:B+=H;var U=c(r,"background-offset-x","units",n),z=c(r,"background-offset-x","pfValue",n);U==="%"?B+=(g-A)*z:B+=z;var W=l-m/2,F=c(r,"background-position-y","units",n),P=c(r,"background-position-y","pfValue",n);F==="%"?W+=(m-I)*P:W+=P;var j=c(r,"background-offset-y","units",n),G=c(r,"background-offset-y","pfValue",n);j==="%"?W+=(m-I)*G:W+=G,y.pathCache&&(B-=a,W-=l,a=0,l=0);var $=t.globalAlpha;t.globalAlpha=N;var ee=s.getImgSmoothing(t),ae=!1;if(E==="no"&&ee?(s.setImgSmoothing(t,!1),ae=!0):E==="yes"&&!ee&&(s.setImgSmoothing(t,!0),ae=!0),v==="no-repeat")S&&(t.save(),y.pathCache?t.clip(y.pathCache):(s.nodeShapes[s.getNodeShape(r)].draw(t,a,l,g,m,T,y),t.clip())),s.safeDrawImage(t,e,0,0,k,L,B,W,A,I),S&&t.restore();else{var ie=t.createPattern(e,v);t.fillStyle=ie,s.nodeShapes[s.getNodeShape(r)].draw(t,a,l,g,m,T,y),t.translate(B,W),t.fill(),t.translate(-B,-W)}t.globalAlpha=$,ae&&s.setImgSmoothing(t,ee)}};var $a={};$a.eleTextBiggerThanMin=function(t,e){if(!e){var r=t.cy().zoom(),n=this.getPixelRatio(),i=Math.ceil(Jv(r*n));e=Math.pow(2,i)}var s=t.pstyle("font-size").pfValue*e,o=t.pstyle("min-zoomed-font-size").pfValue;return!(s<o)};$a.drawElementText=function(t,e,r,n,i){var s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,o=this;if(n==null){if(s&&!o.eleTextBiggerThanMin(e))return}else if(n===!1)return;if(e.isNode()){var a=e.pstyle("label");if(!a||!a.value)return;var l=o.getLabelJustification(e),u=e.pstyle("text-metrics").strValue==="glyph";t.textAlign=l,t.textBaseline=u?"alphabetic":"bottom"}else{var c=e.element()._private.rscratch.badLine,h=e.pstyle("label"),v=e.pstyle("source-label"),d=e.pstyle("target-label");if(c||(!h||!h.value)&&(!v||!v.value)&&(!d||!d.value))return;t.textAlign="center",t.textBaseline="bottom"}var x=!r,w;r&&(w=r,t.translate(-w.x1,-w.y1)),i==null?(o.drawText(t,e,null,x,s),e.isEdge()&&(o.drawText(t,e,"source",x,s),o.drawText(t,e,"target",x,s))):o.drawText(t,e,i,x,s),r&&t.translate(w.x1,w.y1)};$a.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};$a.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",s=e.pstyle("font-family").strValue,o=e.pstyle("font-weight").strValue,a=r?e.effectiveOpacity()*e.pstyle("text-opacity").value:1,l=e.pstyle("text-outline-opacity").value*a,u=e.pstyle("color").value,c=e.pstyle("text-outline-color").value;t.font=n+" "+o+" "+i+" "+s,t.lineJoin="round",this.colorFillStyle(t,u[0],u[1],u[2],a),this.colorStrokeStyle(t,c[0],c[1],c[2],l)};function aD(t,e,r,n,i){var s=Math.min(n,i),o=s/2,a=e+n/2,l=r+i/2;t.beginPath(),t.arc(a,l,o,0,Math.PI*2),t.closePath()}function B1(t,e,r,n,i){var s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:5,o=Math.min(s,n/2,i/2);t.beginPath(),t.moveTo(e+o,r),t.lineTo(e+n-o,r),t.quadraticCurveTo(e+n,r,e+n,r+o),t.lineTo(e+n,r+i-o),t.quadraticCurveTo(e+n,r+i,e+n-o,r+i),t.lineTo(e+o,r+i),t.quadraticCurveTo(e,r+i,e,r+i-o),t.lineTo(e,r+o),t.quadraticCurveTo(e,r,e+o,r),t.closePath()}$a.getTextAngle=function(t,e){var r,n=t._private,i=n.rscratch,s=e?e+"-":"",o=t.pstyle(s+"text-rotation");if(o.strValue==="autorotate"){var a=Xr(i,"labelAngle",e);r=t.isEdge()?a:0}else o.strValue==="none"?r=0:r=o.pfValue;return r};$a.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,s=e._private,o=s.rscratch,a=i?e.effectiveOpacity():1;if(!(i&&(a===0||e.pstyle("text-opacity").value===0))){r==="main"&&(r=null);var l=Xr(o,"labelX",r),u=Xr(o,"labelY",r),c,h,v=this.getLabelText(e,r);if(v!=null&&v!==""&&!isNaN(l)&&!isNaN(u)){this.setupTextStyle(t,e,i);var d=r?r+"-":"",x=Xr(o,"labelWidth",r),w=Xr(o,"labelHeight",r),g=Xr(o,"labelActualDescent",r),m=e.pstyle(d+"text-margin-x").pfValue,y=e.pstyle(d+"text-margin-y").pfValue,b=e.isEdge(),S=e.pstyle("text-halign").value,N=e.pstyle("text-valign").value;b&&(S="center",N="center"),l+=m,u+=y;var E;n?E=this.getTextAngle(e,r):E=0,E!==0&&(c=l,h=u,t.translate(c,h),t.rotate(E),l=0,u=0);var T=Vs(S),k=$s(N);switch(k){case"top":break;case"center":u+=w/2;break;case"bottom":u+=w;break}var L=e.pstyle("text-background-opacity").value,A=e.pstyle("text-border-opacity").value,I=e.pstyle("text-border-width").pfValue,M=e.pstyle("text-background-padding").pfValue,B=e.pstyle("text-background-shape").strValue,D=B==="round-rectangle"||B==="roundrectangle",H=B==="circle",U=2;if(L>0||I>0&&A>0){var z=t.fillStyle,W=t.strokeStyle,F=t.lineWidth,P=e.pstyle("text-background-color").value,j=e.pstyle("text-border-color").value,G=e.pstyle("text-border-style").value,$=L>0,ee=I>0&&A>0,ae=l-M;switch(T){case"left":ae-=x;break;case"center":ae-=x/2;break}var ie=u-w-M,K=x+2*M,q=w+2*M;if($&&(t.fillStyle="rgba(".concat(P[0],",").concat(P[1],",").concat(P[2],",").concat(L*a,")")),ee&&(t.strokeStyle="rgba(".concat(j[0],",").concat(j[1],",").concat(j[2],",").concat(A*a,")"),t.lineWidth=I,t.setLineDash))switch(G){case"dotted":t.setLineDash([1,1]);break;case"dashed":t.setLineDash([4,2]);break;case"double":t.lineWidth=I/4,t.setLineDash([]);break;case"solid":default:t.setLineDash([]);break}if(D?(t.beginPath(),B1(t,ae,ie,K,q,U)):H?(t.beginPath(),aD(t,ae,ie,K,q)):(t.beginPath(),t.rect(ae,ie,K,q)),$&&t.fill(),ee&&t.stroke(),ee&&G==="double"){var Y=I/2;t.beginPath(),D?B1(t,ae+Y,ie+Y,K-2*Y,q-2*Y,U):t.rect(ae+Y,ie+Y,K-2*Y,q-2*Y),t.stroke()}t.fillStyle=z,t.strokeStyle=W,t.lineWidth=F,t.setLineDash&&t.setLineDash([])}var X=2*e.pstyle("text-outline-width").pfValue;if(X>0&&(t.lineWidth=X),u-=g,e.pstyle("text-wrap").value==="wrap"){var J=Xr(o,"labelWrapCachedLines",r),re=Xr(o,"labelLineHeight",r),ce=x/2,de=this.getLabelJustification(e);switch(de==="auto"||(T==="left"?de==="left"?l+=-x:de==="center"&&(l+=-ce):T==="center"?de==="left"?l+=-ce:de==="right"&&(l+=ce):T==="right"&&(de==="center"?l+=ce:de==="right"&&(l+=x))),k){case"top":u-=(J.length-1)*re;break;case"center":case"bottom":u-=(J.length-1)*re;break}for(var Re=0;Re<J.length;Re++)X>0&&t.strokeText(J[Re],l,u),t.fillText(J[Re],l,u),u+=re}else X>0&&t.strokeText(v,l,u),t.fillText(v,l,u);E!==0&&(t.rotate(-E),t.translate(-c,-h))}}};var la={};la.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,s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,o=this,a,l,u=e._private,c=u.rscratch,h=e.position();if(!(!Ke(h.x)||!Ke(h.y))&&!(s&&!e.visible())){var v=s?e.effectiveOpacity():1,d=o.usePaths(),x,w=!1,g=e.padding();a=e.width()+2*g,l=e.height()+2*g;var m;r&&(m=r,t.translate(-m.x1,-m.y1));for(var y=e.pstyle("background-image"),b=y.value,S=new Array(b.length),N=new Array(b.length),E=0,T=0;T<b.length;T++){var k=b[T],L=S[T]=k!=null&&k!=="none";if(L){var A=e.cy().style().getIndexedStyle(e,"background-image-crossorigin","value",T);E++,N[T]=o.getCachedImage(k,A,function(){u.backgroundTimestamp=Date.now(),e.emitAndNotify("background")})}}var I=e.pstyle("background-blacken").value,M=e.pstyle("border-width").pfValue,B=e.pstyle("background-opacity").value*v,D=e.pstyle("border-color").value,H=e.pstyle("border-style").value,U=e.pstyle("border-join").value,z=e.pstyle("border-cap").value,W=e.pstyle("border-position").value,F=e.pstyle("border-dash-pattern").pfValue,P=e.pstyle("border-dash-offset").pfValue,j=e.pstyle("border-opacity").value*v,G=e.pstyle("outline-width").pfValue,$=e.pstyle("outline-color").value,ee=e.pstyle("outline-style").value,ae=e.pstyle("outline-opacity").value*v,ie=e.pstyle("outline-offset").value,K=e.pstyle("corner-radius").value;K!=="auto"&&(K=e.pstyle("corner-radius").pfValue);var q=function(){var Z=arguments.length>0&&arguments[0]!==void 0?arguments[0]:B;o.eleFillStyle(t,e,Z)},Y=function(){var Z=arguments.length>0&&arguments[0]!==void 0?arguments[0]:j;o.colorStrokeStyle(t,D[0],D[1],D[2],Z)},X=function(){var Z=arguments.length>0&&arguments[0]!==void 0?arguments[0]:ae;o.colorStrokeStyle(t,$[0],$[1],$[2],Z)},J=function(Z,te,oe,ue){var se=o.nodePathCache=o.nodePathCache||[],he=_w(oe==="polygon"?oe+","+ue.join(","):oe,""+te,""+Z,""+K),pe=se[he],be,Se=!1;return pe!=null?(be=pe,Se=!0,c.pathCache=be):(be=new Path2D,se[he]=c.pathCache=be),{path:be,cacheHit:Se}},re=e.pstyle("shape").strValue,ce=e.pstyle("shape-polygon-points").pfValue;if(d){t.translate(h.x,h.y);var de=J(a,l,re,ce);x=de.path,w=de.cacheHit}var Re=function(){if(!w){var Z=h;d&&(Z={x:0,y:0}),o.nodeShapes[o.getNodeShape(e)].draw(x||t,Z.x,Z.y,a,l,K,c)}d?t.fill(x):t.fill()},Pe=function(){for(var Z=arguments.length>0&&arguments[0]!==void 0?arguments[0]:v,te=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,oe=u.backgrounding,ue=0,se=0;se<N.length;se++){var he=e.cy().style().getIndexedStyle(e,"background-image-containment","value",se);if(te&&he==="over"||!te&&he==="inside"){ue++;continue}S[se]&&N[se].complete&&!N[se].error&&(ue++,o.drawInscribedImage(t,N[se],e,se,Z))}u.backgrounding=ue!==E,oe!==u.backgrounding&&e.updateStyle(!1)},_e=function(){var Z=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,te=arguments.length>1&&arguments[1]!==void 0?arguments[1]:v;o.hasPie(e)&&(o.drawPie(t,e,te),Z&&(d||o.nodeShapes[o.getNodeShape(e)].draw(t,h.x,h.y,a,l,K,c)))},ke=function(){var Z=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,te=arguments.length>1&&arguments[1]!==void 0?arguments[1]:v;o.hasStripe(e)&&(t.save(),d?t.clip(c.pathCache):(o.nodeShapes[o.getNodeShape(e)].draw(t,h.x,h.y,a,l,K,c),t.clip()),o.drawStripe(t,e,te),t.restore(),Z&&(d||o.nodeShapes[o.getNodeShape(e)].draw(t,h.x,h.y,a,l,K,c)))},Le=function(){var Z=arguments.length>0&&arguments[0]!==void 0?arguments[0]:v,te=(I>0?I:-I)*Z,oe=I>0?0:255;I!==0&&(o.colorFillStyle(t,oe,oe,oe,te),d?t.fill(x):t.fill())},Ee=function(){if(M>0){if(t.lineWidth=M,t.lineCap=z,t.lineJoin=U,t.setLineDash)switch(H){case"dotted":t.setLineDash([1,1]);break;case"dashed":t.setLineDash(F),t.lineDashOffset=P;break;case"solid":case"double":t.setLineDash([]);break}if(W!=="center"){if(t.save(),t.lineWidth*=2,W==="inside")d?t.clip(x):t.clip();else{var Z=new Path2D;Z.rect(-a/2-M,-l/2-M,a+2*M,l+2*M),Z.addPath(x),t.clip(Z,"evenodd")}d?t.stroke(x):t.stroke(),t.restore()}else d?t.stroke(x):t.stroke();if(H==="double"){t.lineWidth=M/3;var te=t.globalCompositeOperation;t.globalCompositeOperation="destination-out",d?t.stroke(x):t.stroke(),t.globalCompositeOperation=te}t.setLineDash&&t.setLineDash([])}},Ie=function(){if(G>0){if(t.lineWidth=G,t.lineCap="butt",t.setLineDash)switch(ee){case"dotted":t.setLineDash([1,1]);break;case"dashed":t.setLineDash([4,2]);break;case"solid":case"double":t.setLineDash([]);break}var Z=h;d&&(Z={x:0,y:0});var te=o.getNodeShape(e),oe=M;W==="inside"&&(oe=0),W==="outside"&&(oe*=2);var ue=(a+oe+(G+ie))/a,se=(l+oe+(G+ie))/l,he=a*ue,pe=l*se,be=o.nodeShapes[te].points,Se;if(d){var Te=J(he,pe,te,be);Se=Te.path}if(te==="ellipse")o.drawEllipsePath(Se||t,Z.x,Z.y,he,pe);else if(["round-diamond","round-heptagon","round-hexagon","round-octagon","round-pentagon","round-polygon","round-triangle","round-tag"].includes(te)){var Ne=0,He=0,ze=0;te==="round-diamond"?Ne=(oe+ie+G)*1.4:te==="round-heptagon"?(Ne=(oe+ie+G)*1.075,ze=-(oe/2+ie+G)/35):te==="round-hexagon"?Ne=(oe+ie+G)*1.12:te==="round-pentagon"?(Ne=(oe+ie+G)*1.13,ze=-(oe/2+ie+G)/15):te==="round-tag"?(Ne=(oe+ie+G)*1.12,He=(oe/2+G+ie)*.07):te==="round-triangle"&&(Ne=(oe+ie+G)*(Math.PI/2),ze=-(oe+ie/2+G)/Math.PI),Ne!==0&&(ue=(a+Ne)/a,he=a*ue,["round-hexagon","round-tag"].includes(te)||(se=(l+Ne)/l,pe=l*se)),K=K==="auto"?Aw(he,pe):K;for(var Ge=he/2,st=pe/2,Je=K+(oe+G+ie)/2,qe=new Array(be.length/2),vt=new Array(be.length/2),Ze=0;Ze<be.length/2;Ze++)qe[Ze]={x:Z.x+He+Ge*be[Ze*2],y:Z.y+ze+st*be[Ze*2+1]};var Qe,wt,lt,gt,xt=qe.length;for(wt=qe[xt-1],Qe=0;Qe<xt;Qe++)lt=qe[Qe%xt],gt=qe[(Qe+1)%xt],vt[Qe]=dg(wt,lt,gt,Je),wt=lt,lt=gt;o.drawRoundPolygonPath(Se||t,Z.x+He,Z.y+ze,a*ue,l*se,be,vt)}else if(["roundrectangle","round-rectangle"].includes(te))K=K==="auto"?ea(he,pe):K,o.drawRoundRectanglePath(Se||t,Z.x,Z.y,he,pe,K+(oe+G+ie)/2);else if(["cutrectangle","cut-rectangle"].includes(te))K=K==="auto"?rg():K,o.drawCutRectanglePath(Se||t,Z.x,Z.y,he,pe,null,K+(oe+G+ie)/4);else if(["bottomroundrectangle","bottom-round-rectangle"].includes(te))K=K==="auto"?ea(he,pe):K,o.drawBottomRoundRectanglePath(Se||t,Z.x,Z.y,he,pe,K+(oe+G+ie)/2);else if(te==="barrel")o.drawBarrelPath(Se||t,Z.x,Z.y,he,pe);else if(te.startsWith("polygon")||["rhomboid","right-rhomboid","round-tag","tag","vee"].includes(te)){var Rt=(oe+G+ie)/a;be=Lc(Dc(be,Rt)),o.drawPolygonPath(Se||t,Z.x,Z.y,a,l,be)}else{var Ot=(oe+G+ie)/a;be=Lc(Dc(be,-Ot)),o.drawPolygonPath(Se||t,Z.x,Z.y,a,l,be)}if(d?t.stroke(Se):t.stroke(),ee==="double"){t.lineWidth=oe/3;var Tt=t.globalCompositeOperation;t.globalCompositeOperation="destination-out",d?t.stroke(Se):t.stroke(),t.globalCompositeOperation=Tt}t.setLineDash&&t.setLineDash([])}},Oe=function(){i&&o.drawNodeOverlay(t,e,h,a,l)},De=function(){i&&o.drawNodeUnderlay(t,e,h,a,l)},We=function(){o.drawElementText(t,e,null,n)},Ye=e.pstyle("ghost").value==="yes";if(Ye){var ge=e.pstyle("ghost-offset-x").pfValue,Ce=e.pstyle("ghost-offset-y").pfValue,Ae=e.pstyle("ghost-opacity").value,Fe=Ae*v;t.translate(ge,Ce),X(),Ie(),q(Ae*B),Re(),Pe(Fe,!0),Y(Ae*j),Ee(),_e(I!==0||M!==0),ke(I!==0||M!==0),Pe(Fe,!1),Le(Fe),t.translate(-ge,-Ce)}d&&t.translate(-h.x,-h.y),De(),d&&t.translate(h.x,h.y),X(),Ie(),q(),Re(),Pe(v,!0),Y(),Ee(),_e(I!==0||M!==0),ke(I!==0||M!==0),Pe(v,!1),Le(),d&&t.translate(-h.x,-h.y),We(),Oe(),r&&t.translate(m.x1,m.y1)}};var F_=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(r,n,i,s,o){var a=this;if(n.visible()){var l=n.pstyle("".concat(e,"-padding")).pfValue,u=n.pstyle("".concat(e,"-opacity")).value,c=n.pstyle("".concat(e,"-color")).value,h=n.pstyle("".concat(e,"-shape")).value,v=n.pstyle("".concat(e,"-corner-radius")).value;if(u>0){if(i=i||n.position(),s==null||o==null){var d=n.padding();s=n.width()+2*d,o=n.height()+2*d}a.colorFillStyle(r,c[0],c[1],c[2],u),a.nodeShapes[h].draw(r,i.x,i.y,s+l*2,o+l*2,v),r.fill()}}}};la.drawNodeOverlay=F_("overlay");la.drawNodeUnderlay=F_("underlay");la.hasPie=function(t){return t=t[0],t._private.hasPie};la.hasStripe=function(t){return t=t[0],t._private.hasStripe};la.drawPie=function(t,e,r,n){e=e[0],n=n||e.position();var i=e.cy().style(),s=e.pstyle("pie-size"),o=e.pstyle("pie-hole"),a=e.pstyle("pie-start-angle").pfValue,l=n.x,u=n.y,c=e.width(),h=e.height(),v=Math.min(c,h)/2,d,x=0,w=this.usePaths();if(w&&(l=0,u=0),s.units==="%"?v=v*s.pfValue:s.pfValue!==void 0&&(v=s.pfValue/2),o.units==="%"?d=v*o.pfValue:o.pfValue!==void 0&&(d=o.pfValue/2),!(d>=v))for(var g=1;g<=i.pieBackgroundN;g++){var m=e.pstyle("pie-"+g+"-background-size").value,y=e.pstyle("pie-"+g+"-background-color").value,b=e.pstyle("pie-"+g+"-background-opacity").value*r,S=m/100;S+x>1&&(S=1-x);var N=1.5*Math.PI+2*Math.PI*x;N+=a;var E=2*Math.PI*S,T=N+E;m===0||x>=1||x+S>1||(d===0?(t.beginPath(),t.moveTo(l,u),t.arc(l,u,v,N,T),t.closePath()):(t.beginPath(),t.arc(l,u,v,N,T),t.arc(l,u,d,T,N,!0),t.closePath()),this.colorFillStyle(t,y[0],y[1],y[2],b),t.fill(),x+=S)}};la.drawStripe=function(t,e,r,n){e=e[0],n=n||e.position();var i=e.cy().style(),s=n.x,o=n.y,a=e.width(),l=e.height(),u=0,c=this.usePaths();t.save();var h=e.pstyle("stripe-direction").value,v=e.pstyle("stripe-size");switch(h){case"vertical":break;case"righward":t.rotate(-Math.PI/2);break}var d=a,x=l;v.units==="%"?(d=d*v.pfValue,x=x*v.pfValue):v.pfValue!==void 0&&(d=v.pfValue,x=v.pfValue),c&&(s=0,o=0),o-=d/2,s-=x/2;for(var w=1;w<=i.stripeBackgroundN;w++){var g=e.pstyle("stripe-"+w+"-background-size").value,m=e.pstyle("stripe-"+w+"-background-color").value,y=e.pstyle("stripe-"+w+"-background-opacity").value*r,b=g/100;b+u>1&&(b=1-u),!(g===0||u>=1||u+b>1)&&(t.beginPath(),t.rect(s,o+x*u,d,x*b),t.closePath(),this.colorFillStyle(t,m[0],m[1],m[2],y),t.fill(),u+=b)}t.restore()};var Zr={},sD=100;Zr.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};Zr.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};Zr.createGradientStyleFor=function(t,e,r,n,i){var s,o=this.usePaths(),a=r.pstyle(e+"-gradient-stop-colors").value,l=r.pstyle(e+"-gradient-stop-positions").pfValue;if(n==="radial-gradient")if(r.isEdge()){var u=r.sourceEndpoint(),c=r.targetEndpoint(),h=r.midpoint(),v=Fa(u,h),d=Fa(c,h);s=t.createRadialGradient(h.x,h.y,0,h.x,h.y,Math.max(v,d))}else{var x=o?{x:0,y:0}:r.position(),w=r.paddedWidth(),g=r.paddedHeight();s=t.createRadialGradient(x.x,x.y,0,x.x,x.y,Math.max(w,g))}else if(r.isEdge()){var m=r.sourceEndpoint(),y=r.targetEndpoint();s=t.createLinearGradient(m.x,m.y,y.x,y.y)}else{var b=o?{x:0,y:0}:r.position(),S=r.paddedWidth(),N=r.paddedHeight(),E=S/2,T=N/2,k=r.pstyle("background-gradient-direction").value;switch(k){case"to-bottom":s=t.createLinearGradient(b.x,b.y-T,b.x,b.y+T);break;case"to-top":s=t.createLinearGradient(b.x,b.y+T,b.x,b.y-T);break;case"to-left":s=t.createLinearGradient(b.x+E,b.y,b.x-E,b.y);break;case"to-right":s=t.createLinearGradient(b.x-E,b.y,b.x+E,b.y);break;case"to-bottom-right":case"to-right-bottom":s=t.createLinearGradient(b.x-E,b.y-T,b.x+E,b.y+T);break;case"to-top-right":case"to-right-top":s=t.createLinearGradient(b.x-E,b.y+T,b.x+E,b.y-T);break;case"to-bottom-left":case"to-left-bottom":s=t.createLinearGradient(b.x+E,b.y-T,b.x-E,b.y+T);break;case"to-top-left":case"to-left-top":s=t.createLinearGradient(b.x+E,b.y+T,b.x-E,b.y-T);break}}if(!s)return null;for(var L=l.length===a.length,A=a.length,I=0;I<A;I++)s.addColorStop(L?l[I]:I/(A-1),"rgba("+a[I][0]+","+a[I][1]+","+a[I][2]+","+i+")");return s};Zr.gradientFillStyle=function(t,e,r,n){var i=this.createGradientStyleFor(t,"background",e,r,n);if(!i)return null;t.fillStyle=i};Zr.colorFillStyle=function(t,e,r,n,i){t.fillStyle="rgba("+e+","+r+","+n+","+i+")"};Zr.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)}};Zr.gradientStrokeStyle=function(t,e,r,n){var i=this.createGradientStyleFor(t,"line",e,r,n);if(!i)return null;t.strokeStyle=i};Zr.colorStrokeStyle=function(t,e,r,n,i){t.strokeStyle="rgba("+e+","+r+","+n+","+i+")"};Zr.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)}};Zr.matchCanvasSize=function(t){var e=this,r=e.data,n=e.findContainerClientCoords(),i=n[2],s=n[3],o=e.getPixelRatio(),a=e.motionBlurPxRatio;(t===e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_NODE]||t===e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_DRAG])&&(o=a);var l=i*o,u=s*o,c;if(!(l===e.canvasWidth&&u===e.canvasHeight)){e.fontCaches=null;var h=r.canvasContainer;h.style.width=i+"px",h.style.height=s+"px";for(var v=0;v<e.CANVAS_LAYERS;v++)c=r.canvases[v],c.width=l,c.height=u,c.style.width=i+"px",c.style.height=s+"px";for(var v=0;v<e.BUFFER_COUNT;v++)c=r.bufferCanvases[v],c.width=l,c.height=u,c.style.width=i+"px",c.style.height=s+"px";e.textureMult=1,o<=1&&(c=r.bufferCanvases[e.TEXTURE_BUFFER],e.textureMult=2,c.width=l*e.textureMult,c.height=u*e.textureMult),e.canvasWidth=l,e.canvasHeight=u,e.pixelRatio=o}};Zr.renderTo=function(t,e,r,n){this.render({forcedContext:t,forcedZoom:e,forcedPan:r,drawAllLayers:!0,forcedPxRatio:n})};Zr.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])};Zr.render=function(t){var e=this;t=t||kw();var r=e.cy,n=t.forcedContext,i=t.drawAllLayers,s=t.drawOnlyNodeLayer,o=t.forcedZoom,a=t.forcedPan,l=t.forcedPxRatio===void 0?this.getPixelRatio():t.forcedPxRatio,u=e.data,c=u.canvasNeedsRedraw,h=e.textureOnViewport&&!n&&(e.pinching||e.hoverData.dragging||e.swipePanning||e.data.wheelZooming),v=t.motionBlur!==void 0?t.motionBlur:e.motionBlur,d=e.motionBlurPxRatio,x=r.hasCompoundNodes(),w=e.hoverData.draggingEles,g=!!(e.hoverData.selecting||e.touchData.selecting);v=v&&!n&&e.motionBlurEnabled&&!g;var m=v;n||(e.prevPxRatio!==l&&(e.invalidateContainerClientCoordsCache(),e.matchCanvasSize(e.container),e.redrawHint("eles",!0),e.redrawHint("drag",!0)),e.prevPxRatio=l),!n&&e.motionBlurTimeout&&clearTimeout(e.motionBlurTimeout),v&&(e.mbFrames==null&&(e.mbFrames=0),e.mbFrames++,e.mbFrames<3&&(m=!1),e.mbFrames>e.minMbLowQualFrames&&(e.motionBlurPxRatio=e.mbPxRBlurry)),e.clearingMotionBlur&&(e.motionBlurPxRatio=1),e.textureDrawLastFrame&&!h&&(c[e.NODE]=!0,c[e.SELECT_BOX]=!0);var y=r.style(),b=r.zoom(),S=o!==void 0?o:b,N=r.pan(),E={x:N.x,y:N.y},T={zoom:b,pan:{x:N.x,y:N.y}},k=e.prevViewport,L=k===void 0||T.zoom!==k.zoom||T.pan.x!==k.pan.x||T.pan.y!==k.pan.y;!L&&!(w&&!x)&&(e.motionBlurPxRatio=1),a&&(E=a),S*=l,E.x*=l,E.y*=l;var A=e.getCachedZSortedEles();function I(Y,X,J,re,ce){var de=Y.globalCompositeOperation;Y.globalCompositeOperation="destination-out",e.colorFillStyle(Y,255,255,255,e.motionBlurTransparency),Y.fillRect(X,J,re,ce),Y.globalCompositeOperation=de}function M(Y,X){var J,re,ce,de;!e.clearingMotionBlur&&(Y===u.bufferContexts[e.MOTIONBLUR_BUFFER_NODE]||Y===u.bufferContexts[e.MOTIONBLUR_BUFFER_DRAG])?(J={x:N.x*d,y:N.y*d},re=b*d,ce=e.canvasWidth*d,de=e.canvasHeight*d):(J=E,re=S,ce=e.canvasWidth,de=e.canvasHeight),Y.setTransform(1,0,0,1,0,0),X==="motionBlur"?I(Y,0,0,ce,de):!n&&(X===void 0||X)&&Y.clearRect(0,0,ce,de),i||(Y.translate(J.x,J.y),Y.scale(re,re)),a&&Y.translate(a.x,a.y),o&&Y.scale(o,o)}if(h||(e.textureDrawLastFrame=!1),h){if(e.textureDrawLastFrame=!0,!e.textureCache){e.textureCache={},e.textureCache.bb=r.mutableElements().boundingBox(),e.textureCache.texture=e.data.bufferCanvases[e.TEXTURE_BUFFER];var B=e.data.bufferContexts[e.TEXTURE_BUFFER];B.setTransform(1,0,0,1,0,0),B.clearRect(0,0,e.canvasWidth*e.textureMult,e.canvasHeight*e.textureMult),e.render({forcedContext:B,drawOnlyNodeLayer:!0,forcedPxRatio:l*e.textureMult});var T=e.textureCache.viewport={zoom:r.zoom(),pan:r.pan(),width:e.canvasWidth,height:e.canvasHeight};T.mpan={x:(0-T.pan.x)/T.zoom,y:(0-T.pan.y)/T.zoom}}c[e.DRAG]=!1,c[e.NODE]=!1;var D=u.contexts[e.NODE],H=e.textureCache.texture,T=e.textureCache.viewport;D.setTransform(1,0,0,1,0,0),v?I(D,0,0,T.width,T.height):D.clearRect(0,0,T.width,T.height);var U=y.core("outside-texture-bg-color").value,z=y.core("outside-texture-bg-opacity").value;e.colorFillStyle(D,U[0],U[1],U[2],z),D.fillRect(0,0,T.width,T.height);var b=r.zoom();M(D,!1),D.clearRect(T.mpan.x,T.mpan.y,T.width/T.zoom/l,T.height/T.zoom/l),D.drawImage(H,T.mpan.x,T.mpan.y,T.width/T.zoom/l,T.height/T.zoom/l)}else e.textureOnViewport&&!n&&(e.textureCache=null);var W=r.extent(),F=e.pinching||e.hoverData.dragging||e.swipePanning||e.data.wheelZooming||e.hoverData.draggingEles||e.cy.animated(),P=e.hideEdgesOnViewport&&F,j=[];if(j[e.NODE]=!c[e.NODE]&&v&&!e.clearedForMotionBlur[e.NODE]||e.clearingMotionBlur,j[e.NODE]&&(e.clearedForMotionBlur[e.NODE]=!0),j[e.DRAG]=!c[e.DRAG]&&v&&!e.clearedForMotionBlur[e.DRAG]||e.clearingMotionBlur,j[e.DRAG]&&(e.clearedForMotionBlur[e.DRAG]=!0),c[e.NODE]||i||s||j[e.NODE]){var G=v&&!j[e.NODE]&&d!==1,D=n||(G?e.data.bufferContexts[e.MOTIONBLUR_BUFFER_NODE]:u.contexts[e.NODE]),$=v&&!G?"motionBlur":void 0;M(D,$),P?e.drawCachedNodes(D,A.nondrag,l,W):e.drawLayeredElements(D,A.nondrag,l,W),e.debug&&e.drawDebugPoints(D,A.nondrag),!i&&!v&&(c[e.NODE]=!1)}if(!s&&(c[e.DRAG]||i||j[e.DRAG])){var G=v&&!j[e.DRAG]&&d!==1,D=n||(G?e.data.bufferContexts[e.MOTIONBLUR_BUFFER_DRAG]:u.contexts[e.DRAG]);M(D,v&&!G?"motionBlur":void 0),P?e.drawCachedNodes(D,A.drag,l,W):e.drawCachedElements(D,A.drag,l,W),e.debug&&e.drawDebugPoints(D,A.drag),!i&&!v&&(c[e.DRAG]=!1)}if(this.drawSelectionRectangle(t,M),v&&d!==1){var ee=u.contexts[e.NODE],ae=e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_NODE],ie=u.contexts[e.DRAG],K=e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_DRAG],q=function(X,J,re){X.setTransform(1,0,0,1,0,0),re||!m?X.clearRect(0,0,e.canvasWidth,e.canvasHeight):I(X,0,0,e.canvasWidth,e.canvasHeight);var ce=d;X.drawImage(J,0,0,e.canvasWidth*ce,e.canvasHeight*ce,0,0,e.canvasWidth,e.canvasHeight)};(c[e.NODE]||j[e.NODE])&&(q(ee,ae,j[e.NODE]),c[e.NODE]=!1),(c[e.DRAG]||j[e.DRAG])&&(q(ie,K,j[e.DRAG]),c[e.DRAG]=!1)}e.prevViewport=T,e.clearingMotionBlur&&(e.clearingMotionBlur=!1,e.motionBlurCleared=!0,e.motionBlur=!0),v&&(e.motionBlurTimeout=setTimeout(function(){e.motionBlurTimeout=null,e.clearedForMotionBlur[e.NODE]=!1,e.clearedForMotionBlur[e.DRAG]=!1,e.motionBlur=!1,e.clearingMotionBlur=!h,e.mbFrames=0,c[e.NODE]=!0,c[e.DRAG]=!0,e.redraw()},sD)),n||r.emit("render")};var Vo;Zr.drawSelectionRectangle=function(t,e){var r=this,n=r.cy,i=r.data,s=n.style(),o=t.drawOnlyNodeLayer,a=t.drawAllLayers,l=i.canvasNeedsRedraw,u=t.forcedContext;if(r.showFps||!o&&l[r.SELECT_BOX]&&!a){var c=u||i.contexts[r.SELECT_BOX];if(e(c),r.selection[4]==1&&(r.hoverData.selecting||r.touchData.selecting)){var h=r.cy.zoom(),v=s.core("selection-box-border-width").value/h;c.lineWidth=v,c.fillStyle="rgba("+s.core("selection-box-color").value[0]+","+s.core("selection-box-color").value[1]+","+s.core("selection-box-color").value[2]+","+s.core("selection-box-opacity").value+")",c.fillRect(r.selection[0],r.selection[1],r.selection[2]-r.selection[0],r.selection[3]-r.selection[1]),v>0&&(c.strokeStyle="rgba("+s.core("selection-box-border-color").value[0]+","+s.core("selection-box-border-color").value[1]+","+s.core("selection-box-border-color").value[2]+","+s.core("selection-box-opacity").value+")",c.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 h=r.cy.zoom(),d=i.bgActivePosistion;c.fillStyle="rgba("+s.core("active-bg-color").value[0]+","+s.core("active-bg-color").value[1]+","+s.core("active-bg-color").value[2]+","+s.core("active-bg-opacity").value+")",c.beginPath(),c.arc(d.x,d.y,s.core("active-bg-size").pfValue/h,0,2*Math.PI),c.fill()}var x=r.lastRedrawTime;if(r.showFps&&x){x=Math.round(x);var w=Math.round(1e3/x),g="1 frame = "+x+" ms = "+w+" fps";if(c.setTransform(1,0,0,1,0,0),c.fillStyle="rgba(255, 0, 0, 0.75)",c.strokeStyle="rgba(255, 0, 0, 0.75)",c.font="30px Arial",!Vo){var m=c.measureText(g);Vo=m.actualBoundingBoxAscent}c.fillText(g,0,Vo);var y=60;c.strokeRect(0,Vo+10,250,20),c.fillRect(0,Vo+10,250*Math.min(w/y,1),20)}a||(l[r.SELECT_BOX]=!1)}};function j1(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 oD(t,e,r){var n=j1(t,t.VERTEX_SHADER,e),i=j1(t,t.FRAGMENT_SHADER,r),s=t.createProgram();if(t.attachShader(s,n),t.attachShader(s,i),t.linkProgram(s),!t.getProgramParameter(s,t.LINK_STATUS))throw new Error("Could not initialize shaders");return s}function lD(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 gg(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 uD(t){var e=t.pixelRatio,r=t.cy.zoom();return r*e}function cD(t,e,r,n,i){var s=n*r+e.x,o=i*r+e.y;return o=Math.round(t.canvasHeight-o),[s,o]}function hD(t,e){return e.picking?!0: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 fD(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 Ta(t,e,r){var n=t[0]/255,i=t[1]/255,s=t[2]/255,o=e,a=r||new Array(4);return a[0]=n*o,a[1]=i*o,a[2]=s*o,a[3]=o,a}function Cs(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 dD(t){return t[0]+(t[1]<<8)+(t[2]<<16)+(t[3]<<24)}function pD(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 z_(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 H_(t,e,r){switch(e){case t.FLOAT:return new Float32Array(r);case t.INT:return new Int32Array(r)}}function vD(t,e,r,n,i,s){switch(e){case t.FLOAT:return new Float32Array(r.buffer,s*n,i);case t.INT:return new Int32Array(r.buffer,s*n,i)}}function gD(t,e,r,n){var i=z_(t,e),s=vr(i,2),o=s[0],a=s[1],l=H_(t,a,n),u=t.createBuffer();return t.bindBuffer(t.ARRAY_BUFFER,u),t.bufferData(t.ARRAY_BUFFER,l,t.STATIC_DRAW),a===t.FLOAT?t.vertexAttribPointer(r,o,a,!1,0,0):a===t.INT&&t.vertexAttribIPointer(r,o,a,0,0),t.enableVertexAttribArray(r),t.bindBuffer(t.ARRAY_BUFFER,null),u}function Xn(t,e,r,n){var i=z_(t,r),s=vr(i,3),o=s[0],a=s[1],l=s[2],u=H_(t,a,e*o),c=o*l,h=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,h),t.bufferData(t.ARRAY_BUFFER,e*c,t.DYNAMIC_DRAW),t.enableVertexAttribArray(n),a===t.FLOAT?t.vertexAttribPointer(n,o,a,!1,c,0):a===t.INT&&t.vertexAttribIPointer(n,o,a,c,0),t.vertexAttribDivisor(n,1),t.bindBuffer(t.ARRAY_BUFFER,null);for(var v=new Array(e),d=0;d<e;d++)v[d]=vD(t,a,u,c,o,d);return h.dataArray=u,h.stride=c,h.size=o,h.getView=function(x){return v[x]},h.setPoint=function(x,w,g){var m=v[x];m[0]=w,m[1]=g},h.bufferSubData=function(x){t.bindBuffer(t.ARRAY_BUFFER,h),x?t.bufferSubData(t.ARRAY_BUFFER,0,u,0,x*o):t.bufferSubData(t.ARRAY_BUFFER,0,u)},h}function mD(t,e,r){for(var n=9,i=new Float32Array(e*n),s=new Array(e),o=0;o<e;o++){var a=o*n*4;s[o]=new Float32Array(i.buffer,a,n)}var l=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,l),t.bufferData(t.ARRAY_BUFFER,i.byteLength,t.DYNAMIC_DRAW);for(var u=0;u<3;u++){var c=r+u;t.enableVertexAttribArray(c),t.vertexAttribPointer(c,3,t.FLOAT,!1,36,u*12),t.vertexAttribDivisor(c,1)}return t.bindBuffer(t.ARRAY_BUFFER,null),l.getMatrixView=function(h){return s[h]},l.setData=function(h,v){s[v].set(h,0)},l.bufferSubData=function(){t.bindBuffer(t.ARRAY_BUFFER,l),t.bufferSubData(t.ARRAY_BUFFER,0,i)},l}function yD(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 F1=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 Ap(){var t=new F1(9);return F1!=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 z1(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 xD(t,e,r){var n=e[0],i=e[1],s=e[2],o=e[3],a=e[4],l=e[5],u=e[6],c=e[7],h=e[8],v=r[0],d=r[1],x=r[2],w=r[3],g=r[4],m=r[5],y=r[6],b=r[7],S=r[8];return t[0]=v*n+d*o+x*u,t[1]=v*i+d*a+x*c,t[2]=v*s+d*l+x*h,t[3]=w*n+g*o+m*u,t[4]=w*i+g*a+m*c,t[5]=w*s+g*l+m*h,t[6]=y*n+b*o+S*u,t[7]=y*i+b*a+S*c,t[8]=y*s+b*l+S*h,t}function bc(t,e,r){var n=e[0],i=e[1],s=e[2],o=e[3],a=e[4],l=e[5],u=e[6],c=e[7],h=e[8],v=r[0],d=r[1];return t[0]=n,t[1]=i,t[2]=s,t[3]=o,t[4]=a,t[5]=l,t[6]=v*n+d*o+u,t[7]=v*i+d*a+c,t[8]=v*s+d*l+h,t}function H1(t,e,r){var n=e[0],i=e[1],s=e[2],o=e[3],a=e[4],l=e[5],u=e[6],c=e[7],h=e[8],v=Math.sin(r),d=Math.cos(r);return t[0]=d*n+v*o,t[1]=d*i+v*a,t[2]=d*s+v*l,t[3]=d*o-v*n,t[4]=d*a-v*i,t[5]=d*l-v*s,t[6]=u,t[7]=c,t[8]=h,t}function kv(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 bD(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 wD=(function(){function t(e,r,n,i){aa(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 sa(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,s=this.texHeight,o=this.texSize,a=s/i,l=n*a,u=i*a;return l>o&&(a=o/n,l=n*a,u=i*a),{scale:a,texW:l,texH:u}}},{key:"draw",value:function(r,n,i){var s=this;if(this.locked)throw new Error("can't draw, atlas is locked");var o=this.texSize,a=this.texRows,l=this.texHeight,u=this.getScale(n),c=u.scale,h=u.texW,v=u.texH,d=function(b,S){if(i&&S){var N=S.context,E=b.x,T=b.row,k=E,L=l*T;N.save(),N.translate(k,L),N.scale(c,c),i(N,n),N.restore()}},x=[null,null],w=function(){d(s.freePointer,s.canvas),x[0]={x:s.freePointer.x,y:s.freePointer.row*l,w:h,h:v},x[1]={x:s.freePointer.x+h,y:s.freePointer.row*l,w:0,h:v},s.freePointer.x+=h,s.freePointer.x==o&&(s.freePointer.x=0,s.freePointer.row++)},g=function(){var b=s.scratch,S=s.canvas;b.clear(),d({x:0,row:0},b);var N=o-s.freePointer.x,E=h-N,T=l;{var k=s.freePointer.x,L=s.freePointer.row*l,A=N;S.context.drawImage(b,0,0,A,T,k,L,A,T),x[0]={x:k,y:L,w:A,h:v}}{var I=N,M=(s.freePointer.row+1)*l,B=E;S&&S.context.drawImage(b,I,0,B,T,0,M,B,T),x[1]={x:0,y:M,w:B,h:v}}s.freePointer.x=E,s.freePointer.row++},m=function(){s.freePointer.x=0,s.freePointer.row++};if(this.freePointer.x+h<=o)w();else{if(this.freePointer.row>=a-1)return!1;this.freePointer.x===o?(m(),w()):this.enableWrapping?g():(m(),w())}return this.keyToLocation.set(r,x),this.needsBuffer=!0,x}},{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,s=this.getScale(r),o=s.texW;return this.freePointer.x+o>n?this.freePointer.row<i-1:!0}},{key:"bufferIfNeeded",value:function(r){this.texture||(this.texture=pD(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}}])})(),_D=(function(){function t(e,r,n,i){aa(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 sa(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,s=this.createTextureCanvas;return new wD(r,n,i,s)}},{key:"_getScratchCanvas",value:function(){if(!this.scratch){var r=this.r,n=this.texSize,i=this.texRows,s=this.createTextureCanvas,o=Math.floor(n/i);this.scratch=s(r,n,o,"scratch")}return this.scratch}},{key:"draw",value:function(r,n,i){var s=this.styleKeyToAtlas.get(r);return s||(s=this.atlases[this.atlases.length-1],(!s||!s.canFit(n))&&(s&&s.lock(),s=this._createAtlas(),this.atlases.push(s)),s.draw(r,n,i),this.styleKeyToAtlas.set(r,s)),s}},{key:"getAtlas",value:function(r){return this.styleKeyToAtlas.get(r)}},{key:"hasAtlas",value:function(r){return this.styleKeyToAtlas.has(r)}},{key:"markKeyForGC",value:function(r){this.markedKeys.add(r)}},{key:"gc",value:function(){var r=this,n=this.markedKeys;if(n.size===0){console.log("nothing to garbage collect");return}var i=[],s=new Map,o=null,a=ln(this.atlases),l;try{var u=function(){var h=l.value,v=h.getKeys(),d=SD(n,v);if(d.size===0)return i.push(h),v.forEach(function(N){return s.set(N,h)}),1;o||(o=r._createAtlas(),i.push(o));var x=ln(v),w;try{for(x.s();!(w=x.n()).done;){var g=w.value;if(!d.has(g)){var m=h.getOffsets(g),y=vr(m,2),b=y[0],S=y[1];o.canFit({w:b.w+S.w,h:b.h})||(o.lock(),o=r._createAtlas(),i.push(o)),h.canvas&&(r._copyTextureToNewAtlas(g,h,o),s.set(g,o))}}}catch(N){x.e(N)}finally{x.f()}h.dispose()};for(a.s();!(l=a.n()).done;)u()}catch(c){a.e(c)}finally{a.f()}this.atlases=i,this.styleKeyToAtlas=s,this.markedKeys=new Set}},{key:"_copyTextureToNewAtlas",value:function(r,n,i){var s=n.getOffsets(r),o=vr(s,2),a=o[0],l=o[1];if(l.w===0)i.draw(r,a,function(v){v.drawImage(n.canvas,a.x,a.y,a.w,a.h,0,0,a.w,a.h)});else{var u=this._getScratchCanvas();u.clear(),u.context.drawImage(n.canvas,a.x,a.y,a.w,a.h,0,0,a.w,a.h),u.context.drawImage(n.canvas,l.x,l.y,l.w,l.h,a.w,0,l.w,l.h);var c=a.w+l.w,h=a.h;i.draw(r,{w:c,h},function(v){v.drawImage(u,0,0,c,h,0,0,c,h)})}}},{key:"getCounts",value:function(){return{keyCount:this.styleKeyToAtlas.size,atlasCount:new Set(this.styleKeyToAtlas.values()).size}}}])})();function SD(t,e){return t.intersection?t.intersection(e):new Set(kc(t).filter(function(r){return e.has(r)}))}var CD=(function(){function t(e,r){aa(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 sa(t,[{key:"getAtlasSize",value:function(){return this.atlasSize}},{key:"addAtlasCollection",value:function(r,n){var i=this.globalOptions,s=i.webglTexSize,o=i.createTextureCanvas,a=n.texRows,l=this._cacheScratchCanvas(o),u=new _D(this.r,s,a,l);this.collections.set(r,u)}},{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 s=this.collections.get(i),o=pt({type:r,atlasCollection:s},n);this.renderTypes.set(r,o)}},{key:"getRenderTypeOpts",value:function(r){return this.renderTypes.get(r)}},{key:"getAtlasCollection",value:function(r){return this.collections.get(r)}},{key:"_cacheScratchCanvas",value:function(r){var n=-1,i=-1,s=null;return function(o,a,l,u){return u?((!s||a!=n||l!=i)&&(n=a,i=l,s=r(o,a,l)),s):r(o,a,l)}}},{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]:{},s=i.forceRedraw,o=s===void 0?!1:s,a=i.filterEle,l=a===void 0?function(){return!0}:a,u=i.filterType,c=u===void 0?function(){return!0}:u,h=!1,v=!1,d=ln(r),x;try{for(d.s();!(x=d.n()).done;){var w=x.value;if(l(w)){var g=ln(this.renderTypes.values()),m;try{var y=function(){var S=m.value,N=S.type;if(c(N)){var E=n.collections.get(S.collection),T=S.getKey(w),k=Array.isArray(T)?T:[T];if(o)k.forEach(function(M){return E.markKeyForGC(M)}),v=!0;else{var L=S.getID?S.getID(w):w.id(),A=n._key(N,L),I=n.typeAndIdToKey.get(A);I!==void 0&&!fD(k,I)&&(h=!0,n.typeAndIdToKey.delete(A),I.forEach(function(M){return E.markKeyForGC(M)}))}}};for(g.s();!(m=g.n()).done;)y()}catch(b){g.e(b)}finally{g.f()}}}}catch(b){d.e(b)}finally{d.f()}return v&&(this.gc(),h=!1),h}},{key:"gc",value:function(){var r=ln(this.collections.values()),n;try{for(r.s();!(n=r.n()).done;){var i=n.value;i.gc()}}catch(s){r.e(s)}finally{r.f()}}},{key:"getOrCreateAtlas",value:function(r,n,i,s){var o=this.renderTypes.get(n),a=this.collections.get(o.collection),l=!1,u=a.draw(s,i,function(v){o.drawClipped?(v.save(),v.beginPath(),v.rect(0,0,i.w,i.h),v.clip(),o.drawElement(v,r,i,!0,!0),v.restore()):o.drawElement(v,r,i,!0,!0),l=!0});if(l){var c=o.getID?o.getID(r):r.id(),h=this._key(n,c);this.typeAndIdToKey.has(h)?this.typeAndIdToKey.get(h).push(s):this.typeAndIdToKey.set(h,[s])}return u}},{key:"getAtlasInfo",value:function(r,n){var i=this,s=this.renderTypes.get(n),o=s.getKey(r),a=Array.isArray(o)?o:[o];return a.map(function(l){var u=s.getBoundingBox(r,l),c=i.getOrCreateAtlas(r,n,u,l),h=c.getOffsets(l),v=vr(h,2),d=v[0],x=v[1];return{atlas:c,tex:d,tex1:d,tex2:x,bb:u}})}},{key:"getDebugInfo",value:function(){var r=[],n=ln(this.collections),i;try{for(n.s();!(i=n.n()).done;){var s=vr(i.value,2),o=s[0],a=s[1],l=a.getCounts(),u=l.keyCount,c=l.atlasCount;r.push({type:o,keyCount:u,atlasCount:c})}}catch(h){n.e(h)}finally{n.f()}return r}}])})(),ED=(function(){function t(e){aa(this,t),this.globalOptions=e,this.atlasSize=e.webglTexSize,this.maxAtlasesPerBatch=e.webglTexPerBatch,this.batchAtlases=[]}return sa(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}}])})(),kD=`
62
- float circleSD(vec2 p, float r) {
63
- return distance(vec2(0), p) - r; // signed distance
64
- }
65
- `,TD=`
66
- float rectangleSD(vec2 p, vec2 b) {
67
- vec2 d = abs(p)-b;
68
- return distance(vec2(0),max(d,0.0)) + min(max(d.x,d.y),0.0);
69
- }
70
- `,ND=`
71
- float roundRectangleSD(vec2 p, vec2 b, vec4 cr) {
72
- cr.xy = (p.x > 0.0) ? cr.xy : cr.zw;
73
- cr.x = (p.y > 0.0) ? cr.x : cr.y;
74
- vec2 q = abs(p) - b + cr.x;
75
- return min(max(q.x, q.y), 0.0) + distance(vec2(0), max(q, 0.0)) - cr.x;
76
- }
77
- `,RD=`
78
- float ellipseSD(vec2 p, vec2 ab) {
79
- p = abs( p ); // symmetry
80
-
81
- // find root with Newton solver
82
- vec2 q = ab*(p-ab);
83
- float w = (q.x<q.y)? 1.570796327 : 0.0;
84
- for( int i=0; i<5; i++ ) {
85
- vec2 cs = vec2(cos(w),sin(w));
86
- vec2 u = ab*vec2( cs.x,cs.y);
87
- vec2 v = ab*vec2(-cs.y,cs.x);
88
- w = w + dot(p-u,v)/(dot(p-u,u)+dot(v,v));
89
- }
90
-
91
- // compute final point and distance
92
- float d = length(p-ab*vec2(cos(w),sin(w)));
93
-
94
- // return signed distance
95
- return (dot(p/ab,p/ab)>1.0) ? d : -d;
96
- }
97
- `,sl={SCREEN:{name:"screen",screen:!0},PICKING:{name:"picking",picking:!0}},jc={IGNORE:1,USE_BB:2},Mp=0,U1=1,W1=2,Pp=3,Es=4,nc=5,$o=6,Go=7,LD=(function(){function t(e,r,n){aa(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=lD,this.atlasManager=new CD(e,n),this.batchManager=new ED(n),this.simpleShapeOptions=new Map,this.program=this._createShaderProgram(sl.SCREEN),this.pickingProgram=this._createShaderProgram(sl.PICKING),this.vao=this._createVAO()}return sa(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,s=this.atlasManager;return i?s.invalidate(r,{filterType:function(a){return a===i},forceRedraw:!0}):s.invalidate(r)}},{key:"gc",value:function(){this.atlasManager.gc()}},{key:"_createShaderProgram",value:function(r){var n=this.gl,i=`#version 300 es
98
- precision highp float;
99
-
100
- uniform mat3 uPanZoomMatrix;
101
- uniform int uAtlasSize;
102
-
103
- // instanced
104
- in vec2 aPosition; // a vertex from the unit square
105
-
106
- in mat3 aTransform; // used to transform verticies, eg into a bounding box
107
- in int aVertType; // the type of thing we are rendering
108
-
109
- // the z-index that is output when using picking mode
110
- in vec4 aIndex;
111
-
112
- // For textures
113
- in int aAtlasId; // which shader unit/atlas to use
114
- in vec4 aTex; // x/y/w/h of texture in atlas
115
-
116
- // for edges
117
- in vec4 aPointAPointB;
118
- in vec4 aPointCPointD;
119
- in vec2 aLineWidth; // also used for node border width
120
-
121
- // simple shapes
122
- in vec4 aCornerRadius; // for round-rectangle [top-right, bottom-right, top-left, bottom-left]
123
- in vec4 aColor; // also used for edges
124
- in vec4 aBorderColor; // aLineWidth is used for border width
125
-
126
- // output values passed to the fragment shader
127
- out vec2 vTexCoord;
128
- out vec4 vColor;
129
- out vec2 vPosition;
130
- // flat values are not interpolated
131
- flat out int vAtlasId;
132
- flat out int vVertType;
133
- flat out vec2 vTopRight;
134
- flat out vec2 vBotLeft;
135
- flat out vec4 vCornerRadius;
136
- flat out vec4 vBorderColor;
137
- flat out vec2 vBorderWidth;
138
- flat out vec4 vIndex;
139
-
140
- void main(void) {
141
- int vid = gl_VertexID;
142
- vec2 position = aPosition; // TODO make this a vec3, simplifies some code below
143
-
144
- if(aVertType == `.concat(Mp,`) {
145
- float texX = aTex.x; // texture coordinates
146
- float texY = aTex.y;
147
- float texW = aTex.z;
148
- float texH = aTex.w;
149
-
150
- if(vid == 1 || vid == 2 || vid == 4) {
151
- texX += texW;
152
- }
153
- if(vid == 2 || vid == 4 || vid == 5) {
154
- texY += texH;
155
- }
156
-
157
- float d = float(uAtlasSize);
158
- vTexCoord = vec2(texX / d, texY / d); // tex coords must be between 0 and 1
159
-
160
- gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);
161
- }
162
- else if(aVertType == `).concat(Es," || aVertType == ").concat(Go,`
163
- || aVertType == `).concat(nc," || aVertType == ").concat($o,`) { // simple shapes
164
-
165
- // the bounding box is needed by the fragment shader
166
- vBotLeft = (aTransform * vec3(0, 0, 1)).xy; // flat
167
- vTopRight = (aTransform * vec3(1, 1, 1)).xy; // flat
168
- vPosition = (aTransform * vec3(position, 1)).xy; // will be interpolated
169
-
170
- // calculations are done in the fragment shader, just pass these along
171
- vColor = aColor;
172
- vCornerRadius = aCornerRadius;
173
- vBorderColor = aBorderColor;
174
- vBorderWidth = aLineWidth;
175
-
176
- gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);
177
- }
178
- else if(aVertType == `).concat(U1,`) {
179
- vec2 source = aPointAPointB.xy;
180
- vec2 target = aPointAPointB.zw;
181
-
182
- // adjust the geometry so that the line is centered on the edge
183
- position.y = position.y - 0.5;
184
-
185
- // stretch the unit square into a long skinny rectangle
186
- vec2 xBasis = target - source;
187
- vec2 yBasis = normalize(vec2(-xBasis.y, xBasis.x));
188
- vec2 point = source + xBasis * position.x + yBasis * aLineWidth[0] * position.y;
189
-
190
- gl_Position = vec4(uPanZoomMatrix * vec3(point, 1.0), 1.0);
191
- vColor = aColor;
192
- }
193
- else if(aVertType == `).concat(W1,`) {
194
- vec2 pointA = aPointAPointB.xy;
195
- vec2 pointB = aPointAPointB.zw;
196
- vec2 pointC = aPointCPointD.xy;
197
- vec2 pointD = aPointCPointD.zw;
198
-
199
- // adjust the geometry so that the line is centered on the edge
200
- position.y = position.y - 0.5;
201
-
202
- vec2 p0, p1, p2, pos;
203
- if(position.x == 0.0) { // The left side of the unit square
204
- p0 = pointA;
205
- p1 = pointB;
206
- p2 = pointC;
207
- pos = position;
208
- } else { // The right side of the unit square, use same approach but flip the geometry upside down
209
- p0 = pointD;
210
- p1 = pointC;
211
- p2 = pointB;
212
- pos = vec2(0.0, -position.y);
213
- }
214
-
215
- vec2 p01 = p1 - p0;
216
- vec2 p12 = p2 - p1;
217
- vec2 p21 = p1 - p2;
218
-
219
- // Find the normal vector.
220
- vec2 tangent = normalize(normalize(p12) + normalize(p01));
221
- vec2 normal = vec2(-tangent.y, tangent.x);
222
-
223
- // Find the vector perpendicular to p0 -> p1.
224
- vec2 p01Norm = normalize(vec2(-p01.y, p01.x));
225
-
226
- // Determine the bend direction.
227
- float sigma = sign(dot(p01 + p21, normal));
228
- float width = aLineWidth[0];
229
-
230
- if(sign(pos.y) == -sigma) {
231
- // This is an intersecting vertex. Adjust the position so that there's no overlap.
232
- vec2 point = 0.5 * width * normal * -sigma / dot(normal, p01Norm);
233
- gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);
234
- } else {
235
- // This is a non-intersecting vertex. Treat it like a mitre join.
236
- vec2 point = 0.5 * width * normal * sigma * dot(normal, p01Norm);
237
- gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);
238
- }
239
-
240
- vColor = aColor;
241
- }
242
- else if(aVertType == `).concat(Pp,` && vid < 3) {
243
- // massage the first triangle into an edge arrow
244
- if(vid == 0)
245
- position = vec2(-0.15, -0.3);
246
- if(vid == 1)
247
- position = vec2( 0.0, 0.0);
248
- if(vid == 2)
249
- position = vec2( 0.15, -0.3);
250
-
251
- gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);
252
- vColor = aColor;
253
- }
254
- else {
255
- gl_Position = vec4(2.0, 0.0, 0.0, 1.0); // discard vertex by putting it outside webgl clip space
256
- }
257
-
258
- vAtlasId = aAtlasId;
259
- vVertType = aVertType;
260
- vIndex = aIndex;
261
- }
262
- `),s=this.batchManager.getIndexArray(),o=`#version 300 es
263
- precision highp float;
264
-
265
- // declare texture unit for each texture atlas in the batch
266
- `.concat(s.map(function(u){return"uniform sampler2D uTexture".concat(u,";")}).join(`
267
- `),`
268
-
269
- uniform vec4 uBGColor;
270
- uniform float uZoom;
271
-
272
- in vec2 vTexCoord;
273
- in vec4 vColor;
274
- in vec2 vPosition; // model coordinates
275
-
276
- flat in int vAtlasId;
277
- flat in vec4 vIndex;
278
- flat in int vVertType;
279
- flat in vec2 vTopRight;
280
- flat in vec2 vBotLeft;
281
- flat in vec4 vCornerRadius;
282
- flat in vec4 vBorderColor;
283
- flat in vec2 vBorderWidth;
284
-
285
- out vec4 outColor;
286
-
287
- `).concat(kD,`
288
- `).concat(TD,`
289
- `).concat(ND,`
290
- `).concat(RD,`
291
-
292
- vec4 blend(vec4 top, vec4 bot) { // blend colors with premultiplied alpha
293
- return vec4(
294
- top.rgb + (bot.rgb * (1.0 - top.a)),
295
- top.a + (bot.a * (1.0 - top.a))
296
- );
297
- }
298
-
299
- vec4 distInterp(vec4 cA, vec4 cB, float d) { // interpolate color using Signed Distance
300
- // scale to the zoom level so that borders don't look blurry when zoomed in
301
- // note 1.5 is an aribitrary value chosen because it looks good
302
- return mix(cA, cB, 1.0 - smoothstep(0.0, 1.5 / uZoom, abs(d)));
303
- }
304
-
305
- void main(void) {
306
- if(vVertType == `).concat(Mp,`) {
307
- // look up the texel from the texture unit
308
- `).concat(s.map(function(u){return"if(vAtlasId == ".concat(u,") outColor = texture(uTexture").concat(u,", vTexCoord);")}).join(`
309
- else `),`
310
- }
311
- else if(vVertType == `).concat(Pp,`) {
312
- // mimics how canvas renderer uses context.globalCompositeOperation = 'destination-out';
313
- outColor = blend(vColor, uBGColor);
314
- outColor.a = 1.0; // make opaque, masks out line under arrow
315
- }
316
- else if(vVertType == `).concat(Es,` && vBorderWidth == vec2(0.0)) { // simple rectangle with no border
317
- outColor = vColor; // unit square is already transformed to the rectangle, nothing else needs to be done
318
- }
319
- else if(vVertType == `).concat(Es," || vVertType == ").concat(Go,`
320
- || vVertType == `).concat(nc," || vVertType == ").concat($o,`) { // use SDF
321
-
322
- float outerBorder = vBorderWidth[0];
323
- float innerBorder = vBorderWidth[1];
324
- float borderPadding = outerBorder * 2.0;
325
- float w = vTopRight.x - vBotLeft.x - borderPadding;
326
- float h = vTopRight.y - vBotLeft.y - borderPadding;
327
- vec2 b = vec2(w/2.0, h/2.0); // half width, half height
328
- vec2 p = vPosition - vec2(vTopRight.x - b[0] - outerBorder, vTopRight.y - b[1] - outerBorder); // translate to center
329
-
330
- float d; // signed distance
331
- if(vVertType == `).concat(Es,`) {
332
- d = rectangleSD(p, b);
333
- } else if(vVertType == `).concat(Go,` && w == h) {
334
- d = circleSD(p, b.x); // faster than ellipse
335
- } else if(vVertType == `).concat(Go,`) {
336
- d = ellipseSD(p, b);
337
- } else {
338
- d = roundRectangleSD(p, b, vCornerRadius.wzyx);
339
- }
340
-
341
- // use the distance to interpolate a color to smooth the edges of the shape, doesn't need multisampling
342
- // we must smooth colors inwards, because we can't change pixels outside the shape's bounding box
343
- if(d > 0.0) {
344
- if(d > outerBorder) {
345
- discard;
346
- } else {
347
- outColor = distInterp(vBorderColor, vec4(0), d - outerBorder);
348
- }
349
- } else {
350
- if(d > innerBorder) {
351
- vec4 outerColor = outerBorder == 0.0 ? vec4(0) : vBorderColor;
352
- vec4 innerBorderColor = blend(vBorderColor, vColor);
353
- outColor = distInterp(innerBorderColor, outerColor, d);
354
- }
355
- else {
356
- vec4 outerColor;
357
- if(innerBorder == 0.0 && outerBorder == 0.0) {
358
- outerColor = vec4(0);
359
- } else if(innerBorder == 0.0) {
360
- outerColor = vBorderColor;
361
- } else {
362
- outerColor = blend(vBorderColor, vColor);
363
- }
364
- outColor = distInterp(vColor, outerColor, d - innerBorder);
365
- }
366
- }
367
- }
368
- else {
369
- outColor = vColor;
370
- }
371
-
372
- `).concat(r.picking?`if(outColor.a == 0.0) discard;
373
- else outColor = vIndex;`:"",`
374
- }
375
- `),a=oD(n,i,o);a.aPosition=n.getAttribLocation(a,"aPosition"),a.aIndex=n.getAttribLocation(a,"aIndex"),a.aVertType=n.getAttribLocation(a,"aVertType"),a.aTransform=n.getAttribLocation(a,"aTransform"),a.aAtlasId=n.getAttribLocation(a,"aAtlasId"),a.aTex=n.getAttribLocation(a,"aTex"),a.aPointAPointB=n.getAttribLocation(a,"aPointAPointB"),a.aPointCPointD=n.getAttribLocation(a,"aPointCPointD"),a.aLineWidth=n.getAttribLocation(a,"aLineWidth"),a.aColor=n.getAttribLocation(a,"aColor"),a.aCornerRadius=n.getAttribLocation(a,"aCornerRadius"),a.aBorderColor=n.getAttribLocation(a,"aBorderColor"),a.uPanZoomMatrix=n.getUniformLocation(a,"uPanZoomMatrix"),a.uAtlasSize=n.getUniformLocation(a,"uAtlasSize"),a.uBGColor=n.getUniformLocation(a,"uBGColor"),a.uZoom=n.getUniformLocation(a,"uZoom"),a.uTextures=[];for(var l=0;l<this.batchManager.getMaxAtlasesPerBatch();l++)a.uTextures.push(n.getUniformLocation(a,"uTexture".concat(l)));return a}},{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,s=this.program,o=i.createVertexArray();return i.bindVertexArray(o),gD(i,"vec2",s.aPosition,r),this.transformBuffer=mD(i,n,s.aTransform),this.indexBuffer=Xn(i,n,"vec4",s.aIndex),this.vertTypeBuffer=Xn(i,n,"int",s.aVertType),this.atlasIdBuffer=Xn(i,n,"int",s.aAtlasId),this.texBuffer=Xn(i,n,"vec4",s.aTex),this.pointAPointBBuffer=Xn(i,n,"vec4",s.aPointAPointB),this.pointCPointDBuffer=Xn(i,n,"vec4",s.aPointCPointD),this.lineWidthBuffer=Xn(i,n,"vec2",s.aLineWidth),this.colorBuffer=Xn(i,n,"vec4",s.aColor),this.cornerRadiusBuffer=Xn(i,n,"vec4",s.aCornerRadius),this.borderColorBuffer=Xn(i,n,"vec4",s.aBorderColor),i.bindVertexArray(null),o}},{key:"buffers",get:function(){var r=this;return this._buffers||(this._buffers=Object.keys(this).filter(function(n){return qi(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]:sl.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 s=this.atlasManager,o=this.batchManager,a=s.getRenderTypeOpts(i);if(this._isVisible(r,a)&&!(r.isEdge()&&!this._isValidEdge(r))){if(this.renderTarget.picking&&a.getTexPickingMode){var l=a.getTexPickingMode(r);if(l===jc.IGNORE)return;if(l==jc.USE_BB){this.drawPickingRectangle(r,n,i);return}}var u=s.getAtlasInfo(r,i),c=ln(u),h;try{for(c.s();!(h=c.n()).done;){var v=h.value,d=v.atlas,x=v.tex1,w=v.tex2;o.canAddToCurrentBatch(d)||this.endBatch();for(var g=o.getAtlasIndexForBatch(d),m=0,y=[[x,!0],[w,!1]];m<y.length;m++){var b=vr(y[m],2),S=b[0],N=b[1];if(S.w!=0){var E=this.instanceCount;this.vertTypeBuffer.getView(E)[0]=Mp;var T=this.indexBuffer.getView(E);Cs(n,T);var k=this.atlasIdBuffer.getView(E);k[0]=g;var L=this.texBuffer.getView(E);L[0]=S.x,L[1]=S.y,L[2]=S.w,L[3]=S.h;var A=this.transformBuffer.getMatrixView(E);this.setTransformMatrix(r,A,a,v,N),this.instanceCount++,N||this.wrappedCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}catch(I){c.e(I)}finally{c.f()}}}},{key:"setTransformMatrix",value:function(r,n,i,s){var o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,a=0;if(i.shapeProps&&i.shapeProps.padding&&(a=r.pstyle(i.shapeProps.padding).pfValue),s){var l=s.bb,u=s.tex1,c=s.tex2,h=u.w/(u.w+c.w);o||(h=1-h);var v=this._getAdjustedBB(l,a,o,h);this._applyTransformMatrix(n,v,i,r)}else{var d=i.getBoundingBox(r),x=this._getAdjustedBB(d,a,!0,1);this._applyTransformMatrix(n,x,i,r)}}},{key:"_applyTransformMatrix",value:function(r,n,i,s){var o,a;z1(r);var l=i.getRotation?i.getRotation(s):0;if(l!==0){var u=i.getRotationPoint(s),c=u.x,h=u.y;bc(r,r,[c,h]),H1(r,r,l);var v=i.getRotationOffset(s);o=v.x+(n.xOffset||0),a=v.y+(n.yOffset||0)}else o=n.x1,a=n.y1;bc(r,r,[o,a]),kv(r,r,[n.w,n.h])}},{key:"_getAdjustedBB",value:function(r,n,i,s){var o=r.x1,a=r.y1,l=r.w,u=r.h,c=r.yOffset;n&&(o-=n,a-=n,l+=2*n,u+=2*n);var h=0,v=l*s;return i&&s<1?l=v:!i&&s<1&&(h=l-v,o+=h,l=v),{x1:o,y1:a,w:l,h:u,xOffset:h,yOffset:c}}},{key:"drawPickingRectangle",value:function(r,n,i){var s=this.atlasManager.getRenderTypeOpts(i),o=this.instanceCount;this.vertTypeBuffer.getView(o)[0]=Es;var a=this.indexBuffer.getView(o);Cs(n,a);var l=this.colorBuffer.getView(o);Ta([0,0,0],1,l);var u=this.transformBuffer.getMatrixView(o);this.setTransformMatrix(r,u,s),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}},{key:"drawNode",value:function(r,n,i){var s=this.simpleShapeOptions.get(i);if(this._isVisible(r,s)){var o=s.shapeProps,a=this._getVertTypeForShape(r,o.shape);if(a===void 0||s.isSimple&&!s.isSimple(r,this.renderTarget)){this.drawTexture(r,n,i);return}var l=this.instanceCount;if(this.vertTypeBuffer.getView(l)[0]=a,a===nc||a===$o){var u=s.getBoundingBox(r),c=this._getCornerRadius(r,o.radius,u),h=this.cornerRadiusBuffer.getView(l);h[0]=c,h[1]=c,h[2]=c,h[3]=c,a===$o&&(h[0]=0,h[2]=0)}var v=this.indexBuffer.getView(l);Cs(n,v);var d=this.renderTarget.picking?1:i==="node-body"?r.effectiveOpacity():1,x=this.renderTarget.picking?1:r.pstyle(o.opacity).value*d,w=r.pstyle(o.color).value,g=this.colorBuffer.getView(l);Ta(w,x,g);var m=this.lineWidthBuffer.getView(l);if(m[0]=0,m[1]=0,o.border){var y=r.pstyle("border-width").value;if(y>0){var b=r.pstyle("border-color").value,S=d*r.pstyle("border-opacity").value,N=this.borderColorBuffer.getView(l);Ta(b,S,N);var E=r.pstyle("border-position").value;if(E==="inside")m[0]=0,m[1]=-y;else if(E==="outside")m[0]=y,m[1]=0;else{var T=y/2;m[0]=T,m[1]=-T}}}var k=this.transformBuffer.getMatrixView(l);this.setTransformMatrix(r,k,s),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 Es;case"ellipse":return Go;case"roundrectangle":case"round-rectangle":return nc;case"bottom-round-rectangle":return $o;default:return}}},{key:"_getCornerRadius",value:function(r,n,i){var s=i.w,o=i.h;if(r.pstyle(n).value==="auto")return ea(s,o);var a=r.pstyle(n).pfValue,l=s/2,u=o/2;return Math.min(a,u,l)}},{key:"drawEdgeArrow",value:function(r,n,i){if(r.visible()){var s=r._private.rscratch,o,a,l;if(i==="source"?(o=s.arrowStartX,a=s.arrowStartY,l=s.srcArrowAngle):(o=s.arrowEndX,a=s.arrowEndY,l=s.tgtArrowAngle),!(isNaN(o)||o==null||isNaN(a)||a==null||isNaN(l)||l==null)){var u=r.pstyle(i+"-arrow-shape").value;if(u!=="none"){var c=r.pstyle(i+"-arrow-color").value,h=r.pstyle("opacity").value,v=r.pstyle("line-opacity").value,d=h*v,x=r.pstyle("width").pfValue,w=r.pstyle("arrow-scale").value,g=this.r.getArrowWidth(x,w),m=this.instanceCount,y=this.transformBuffer.getMatrixView(m);z1(y),bc(y,y,[o,a]),kv(y,y,[g,g]),H1(y,y,l),this.vertTypeBuffer.getView(m)[0]=Pp;var b=this.indexBuffer.getView(m);Cs(n,b);var S=this.colorBuffer.getView(m);Ta(c,d,S),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 s=r.pstyle("opacity").value,o=r.pstyle("line-opacity").value,a=r.pstyle("width").pfValue,l=r.pstyle("line-color").value,u=s*o;if(i.length/2+this.instanceCount>this.maxInstances&&this.endBatch(),i.length==4){var c=this.instanceCount;this.vertTypeBuffer.getView(c)[0]=U1;var h=this.indexBuffer.getView(c);Cs(n,h);var v=this.colorBuffer.getView(c);Ta(l,u,v);var d=this.lineWidthBuffer.getView(c);d[0]=a;var x=this.pointAPointBBuffer.getView(c);x[0]=i[0],x[1]=i[1],x[2]=i[2],x[3]=i[3],this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}else for(var w=0;w<i.length-2;w+=2){var g=this.instanceCount;this.vertTypeBuffer.getView(g)[0]=W1;var m=this.indexBuffer.getView(g);Cs(n,m);var y=this.colorBuffer.getView(g);Ta(l,u,y);var b=this.lineWidthBuffer.getView(g);b[0]=a;var S=i[w-2],N=i[w-1],E=i[w],T=i[w+1],k=i[w+2],L=i[w+3],A=i[w+4],I=i[w+5];w==0&&(S=2*E-k+.001,N=2*T-L+.001),w==i.length-4&&(A=2*k-E+.001,I=2*L-T+.001);var M=this.pointAPointBBuffer.getView(g);M[0]=S,M[1]=N,M[2]=E,M[3]=T;var B=this.pointCPointDBuffer.getView(g);B[0]=k,B[1]=L,B[2]=A,B[3]=I,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 s=this._getNumSegments(r);return this._getCurveSegmentPoints(i,s)}}},{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),s=0;s<=n;s++)if(s==0)i[0]=r[0],i[1]=r[1];else if(s==n)i[s*2]=r[r.length-2],i[s*2+1]=r[r.length-1];else{var o=s/n;this._setCurvePoint(r,o,i,s*2)}return i}},{key:"_setCurvePoint",value:function(r,n,i,s){if(r.length<=2)i[s]=r[0],i[s+1]=r[1];else{for(var o=Array(r.length-2),a=0;a<o.length;a+=2){var l=(1-n)*r[a]+n*r[a+2],u=(1-n)*r[a+1]+n*r[a+3];o[a]=l,o[a+1]=u}return this._setCurvePoint(o,n,i,s)}}},{key:"endBatch",value:function(){var r=this.gl,n=this.vao,i=this.vertexCount,s=this.instanceCount;if(s!==0){var o=this.renderTarget.picking?this.pickingProgram:this.program;r.useProgram(o),r.bindVertexArray(n);var a=ln(this.buffers),l;try{for(a.s();!(l=a.n()).done;){var u=l.value;u.bufferSubData(s)}}catch(x){a.e(x)}finally{a.f()}for(var c=this.batchManager.getAtlases(),h=0;h<c.length;h++)c[h].bufferIfNeeded(r);for(var v=0;v<c.length;v++)r.activeTexture(r.TEXTURE0+v),r.bindTexture(r.TEXTURE_2D,c[v].texture),r.uniform1i(o.uTextures[v],v);r.uniform1f(o.uZoom,uD(this.r)),r.uniformMatrix3fv(o.uPanZoomMatrix,!1,this.panZoomMatrix),r.uniform1i(o.uAtlasSize,this.batchManager.getAtlasSize());var d=Ta(this.bgColor,1);r.uniform4fv(o.uBGColor,d),r.drawArraysInstanced(r.TRIANGLES,0,i,s),r.bindVertexArray(null),r.bindTexture(r.TEXTURE_2D,null),this.debug&&this.batchDebugInfo.push({count:s,atlasCount:c.length}),this.startBatch()}}},{key:"getDebugInfo",value:function(){var r=this.atlasManager.getDebugInfo(),n=r.reduce(function(o,a){return o+a.atlasCount},0),i=this.batchDebugInfo,s=i.reduce(function(o,a){return o+a.count},0);return{atlasInfo:r,totalAtlases:n,wrappedCount:this.wrappedCount,simpleCount:this.simpleCount,batchCount:i.length,batchInfo:i,totalInstances:s}}}])})(),U_={};U_.initWebgl=function(t,e){var r=this,n=r.data.contexts[r.WEBGL];t.bgColor=DD(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=yD(n),r.pickingFrameBuffer.needsDraw=!0,r.drawing=new LD(r,n,t);var i=function(h){return function(v){return r.getTextAngle(v,h)}},s=function(h){return function(v){var d=v.pstyle(h);return d&&d.value}},o=function(h){return function(v){return v.pstyle("".concat(h,"-opacity")).value>0}},a=function(h){var v=h.pstyle("text-events").strValue==="yes";return v?jc.USE_BB:jc.IGNORE},l=function(h){var v=h.position(),d=v.x,x=v.y,w=h.outerWidth(),g=h.outerHeight();return{w,h:g,x1:d-w/2,y1:x-g/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:l,isSimple:hD,shapeProps:{shape:"shape",color:"background-color",opacity:"background-opacity",radius:"corner-radius",border:!0}}),r.drawing.addSimpleShapeRenderType("node-overlay",{getBoundingBox:l,isVisible:o("overlay"),shapeProps:{shape:"overlay-shape",color:"overlay-color",opacity:"overlay-opacity",padding:"overlay-padding",radius:"overlay-corner-radius"}}),r.drawing.addSimpleShapeRenderType("node-underlay",{getBoundingBox:l,isVisible:o("underlay"),shapeProps:{shape:"underlay-shape",color:"underlay-color",opacity:"underlay-opacity",padding:"underlay-padding",radius:"underlay-corner-radius"}}),r.drawing.addTextureAtlasRenderType("label",{collection:"label",getTexPickingMode:a,getKey:Ip(e.getLabelKey,null),getBoundingBox:Op(e.getLabelBox,null),drawClipped:!0,drawElement:e.drawLabel,getRotation:i(null),getRotationPoint:e.getLabelRotationPoint,getRotationOffset:e.getLabelRotationOffset,isVisible:s("label")}),r.drawing.addTextureAtlasRenderType("edge-source-label",{collection:"label",getTexPickingMode:a,getKey:Ip(e.getSourceLabelKey,"source"),getBoundingBox:Op(e.getSourceLabelBox,"source"),drawClipped:!0,drawElement:e.drawSourceLabel,getRotation:i("source"),getRotationPoint:e.getSourceLabelRotationPoint,getRotationOffset:e.getSourceLabelRotationOffset,isVisible:s("source-label")}),r.drawing.addTextureAtlasRenderType("edge-target-label",{collection:"label",getTexPickingMode:a,getKey:Ip(e.getTargetLabelKey,"target"),getBoundingBox:Op(e.getTargetLabelBox,"target"),drawClipped:!0,drawElement:e.drawTargetLabel,getRotation:i("target"),getRotationPoint:e.getTargetLabelRotationPoint,getRotationOffset:e.getTargetLabelRotationOffset,isVisible:s("target-label")});var u=Nl(function(){console.log("garbage collect flag set"),r.data.gc=!0},1e4);r.onUpdateEleCalcs(function(c,h){var v=!1;h&&h.length>0&&(v|=r.drawing.invalidate(h)),v&&u()}),AD(r)};function DD(t){var e=t.cy.container(),r=e&&e.style&&e.style.backgroundColor||"white";return vw(r)}function W_(t,e){var r=t._private.rscratch;return Xr(r,"labelWrapCachedLines",e)||[]}var Ip=function(e,r){return function(n){var i=e(n),s=W_(n,r);return s.length>1?s.map(function(o,a){return"".concat(i,"_").concat(a)}):i}},Op=function(e,r){return function(n,i){var s=e(n);if(typeof i=="string"){var o=i.indexOf("_");if(o>0){var a=Number(i.substring(o+1)),l=W_(n,r),u=s.h/l.length,c=u*a,h=s.y1+c;return{x1:s.x1,w:s.w,y1:h,h:u,yOffset:c}}}return s}};function AD(t){{var e=t.render;t.render=function(s){s=s||{};var o=t.cy;t.webgl&&(o.zoom()>I_?(MD(t),e.call(t,s)):(PD(t),$_(t,s,sl.SCREEN)))}}{var r=t.matchCanvasSize;t.matchCanvasSize=function(s){r.call(t,s),t.pickingFrameBuffer.setFramebufferAttachmentSizes(t.canvasWidth,t.canvasHeight),t.pickingFrameBuffer.needsDraw=!0}}t.findNearestElements=function(s,o,a,l){return zD(t,s,o)};{var n=t.invalidateCachedZSortedEles;t.invalidateCachedZSortedEles=function(){n.call(t),t.pickingFrameBuffer.needsDraw=!0}}{var i=t.notify;t.notify=function(s,o){i.call(t,s,o),s==="viewport"||s==="bounds"?t.pickingFrameBuffer.needsDraw=!0:s==="background"&&t.drawing.invalidate(o,{type:"node-body"})}}}function MD(t){var e=t.data.contexts[t.WEBGL];e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT)}function PD(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 ID(t){var e=t.canvasWidth,r=t.canvasHeight,n=gg(t),i=n.pan,s=n.zoom,o=Ap();bc(o,o,[i.x,i.y]),kv(o,o,[s,s]);var a=Ap();bD(a,e,r);var l=Ap();return xD(l,a,o),l}function V_(t,e){var r=t.canvasWidth,n=t.canvasHeight,i=gg(t),s=i.pan,o=i.zoom;e.setTransform(1,0,0,1,0,0),e.clearRect(0,0,r,n),e.translate(s.x,s.y),e.scale(o,o)}function OD(t,e){t.drawSelectionRectangle(e,function(r){return V_(t,r)})}function BD(t){var e=t.data.contexts[t.NODE];e.save(),V_(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 jD(t){var e=function(i,s,o){for(var a=i.atlasManager.getAtlasCollection(s),l=t.data.contexts[t.NODE],u=a.atlases,c=0;c<u.length;c++){var h=u[c],v=h.canvas;if(v){var d=v.width,x=v.height,w=d*c,g=v.height*o,m=.4;l.save(),l.scale(m,m),l.drawImage(v,w,g),l.strokeStyle="black",l.rect(w,g,d,x),l.stroke(),l.restore()}}},r=0;e(t.drawing,"node",r++),e(t.drawing,"label",r++)}function FD(t,e,r,n,i){var s,o,a,l,u=gg(t),c=u.pan,h=u.zoom;{var v=cD(t,c,h,e,r),d=vr(v,2),x=d[0],w=d[1],g=6;s=x-g/2,o=w-g/2,a=g,l=g}if(a===0||l===0)return[];var m=t.data.contexts[t.WEBGL];m.bindFramebuffer(m.FRAMEBUFFER,t.pickingFrameBuffer),t.pickingFrameBuffer.needsDraw&&(m.viewport(0,0,m.canvas.width,m.canvas.height),$_(t,null,sl.PICKING),t.pickingFrameBuffer.needsDraw=!1);var y=a*l,b=new Uint8Array(y*4);m.readPixels(s,o,a,l,m.RGBA,m.UNSIGNED_BYTE,b),m.bindFramebuffer(m.FRAMEBUFFER,null);for(var S=new Set,N=0;N<y;N++){var E=b.slice(N*4,N*4+4),T=dD(E)-1;T>=0&&S.add(T)}return S}function zD(t,e,r){var n=FD(t,e,r),i=t.getCachedZSortedEles(),s,o,a=ln(n),l;try{for(a.s();!(l=a.n()).done;){var u=l.value,c=i[u];if(!s&&c.isNode()&&(s=c),!o&&c.isEdge()&&(o=c),s&&o)break}}catch(h){a.e(h)}finally{a.f()}return[s,o].filter(Boolean)}function Bp(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 $_(t,e,r){var n;t.webglDebug&&(n=performance.now());var i=t.drawing,s=0;if(r.screen&&t.data.canvasNeedsRedraw[t.SELECT_BOX]&&OD(t,e),t.data.canvasNeedsRedraw[t.NODE]||r.picking){var o=t.data.contexts[t.WEBGL];r.screen?(o.clearColor(0,0,0,0),o.enable(o.BLEND),o.blendFunc(o.ONE,o.ONE_MINUS_SRC_ALPHA)):o.disable(o.BLEND),o.clear(o.COLOR_BUFFER_BIT|o.DEPTH_BUFFER_BIT),o.viewport(0,0,o.canvas.width,o.canvas.height);var a=ID(t),l=t.getCachedZSortedEles();if(s=l.length,i.startFrame(a,r),r.screen){for(var u=0;u<l.nondrag.length;u++)Bp(t,u,l.nondrag[u]);for(var c=0;c<l.drag.length;c++)Bp(t,c,l.drag[c])}else if(r.picking)for(var h=0;h<l.length;h++)Bp(t,h,l[h]);i.endFrame(),r.screen&&t.webglDebugShowAtlases&&(BD(t),jD(t)),t.data.canvasNeedsRedraw[t.NODE]=!1,t.data.canvasNeedsRedraw[t.DRAG]=!1}if(t.webglDebug){var v=performance.now(),d=!1,x=Math.ceil(v-n),w=i.getDebugInfo(),g=["".concat(s," elements"),"".concat(w.totalInstances," instances"),"".concat(w.batchCount," batches"),"".concat(w.totalAtlases," atlases"),"".concat(w.wrappedCount," wrapped textures"),"".concat(w.simpleCount," simple shapes")].join(", ");if(d)console.log("WebGL (".concat(r.name,") - time ").concat(x,"ms, ").concat(g));else{console.log("WebGL (".concat(r.name,") - frame time ").concat(x,"ms")),console.log("Totals:"),console.log(" ".concat(g)),console.log("Texture Atlases Used:");var m=w.atlasInfo,y=ln(m),b;try{for(y.s();!(b=y.n()).done;){var S=b.value;console.log(" ".concat(S.type,": ").concat(S.keyCount," keys, ").concat(S.atlasCount," atlases"))}}catch(N){y.e(N)}finally{y.f()}console.log("")}}t.data.gc&&(console.log("Garbage Collect!"),t.data.gc=!1,i.gc())}var ua={};ua.drawPolygonPath=function(t,e,r,n,i,s){var o=n/2,a=i/2;t.beginPath&&t.beginPath(),t.moveTo(e+o*s[0],r+a*s[1]);for(var l=1;l<s.length/2;l++)t.lineTo(e+o*s[l*2],r+a*s[l*2+1]);t.closePath()};ua.drawRoundPolygonPath=function(t,e,r,n,i,s,o){o.forEach(function(a){return E_(t,a)}),t.closePath()};ua.drawRoundRectanglePath=function(t,e,r,n,i,s){var o=n/2,a=i/2,l=s==="auto"?ea(n,i):Math.min(s,a,o);t.beginPath&&t.beginPath(),t.moveTo(e,r-a),t.arcTo(e+o,r-a,e+o,r,l),t.arcTo(e+o,r+a,e,r+a,l),t.arcTo(e-o,r+a,e-o,r,l),t.arcTo(e-o,r-a,e,r-a,l),t.lineTo(e,r-a),t.closePath()};ua.drawBottomRoundRectanglePath=function(t,e,r,n,i,s){var o=n/2,a=i/2,l=s==="auto"?ea(n,i):s;t.beginPath&&t.beginPath(),t.moveTo(e,r-a),t.lineTo(e+o,r-a),t.lineTo(e+o,r),t.arcTo(e+o,r+a,e,r+a,l),t.arcTo(e-o,r+a,e-o,r,l),t.lineTo(e-o,r-a),t.lineTo(e,r-a),t.closePath()};ua.drawCutRectanglePath=function(t,e,r,n,i,s,o){var a=n/2,l=i/2,u=o==="auto"?rg():o;t.beginPath&&t.beginPath(),t.moveTo(e-a+u,r-l),t.lineTo(e+a-u,r-l),t.lineTo(e+a,r-l+u),t.lineTo(e+a,r+l-u),t.lineTo(e+a-u,r+l),t.lineTo(e-a+u,r+l),t.lineTo(e-a,r+l-u),t.lineTo(e-a,r-l+u),t.closePath()};ua.drawBarrelPath=function(t,e,r,n,i){var s=n/2,o=i/2,a=e-s,l=e+s,u=r-o,c=r+o,h=fv(n,i),v=h.widthOffset,d=h.heightOffset,x=h.ctrlPtOffsetPct*v;t.beginPath&&t.beginPath(),t.moveTo(a,u+d),t.lineTo(a,c-d),t.quadraticCurveTo(a+x,c,a+v,c),t.lineTo(l-v,c),t.quadraticCurveTo(l-x,c,l,c-d),t.lineTo(l,u+d),t.quadraticCurveTo(l-x,u,l-v,u),t.lineTo(a+v,u),t.quadraticCurveTo(a+x,u,a,u+d),t.closePath()};var V1=Math.sin(0),$1=Math.cos(0),Tv={},Nv={},G_=Math.PI/40;for(var ks=0*Math.PI;ks<2*Math.PI;ks+=G_)Tv[ks]=Math.sin(ks),Nv[ks]=Math.cos(ks);ua.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 s,o,a=n/2,l=i/2,u=0*Math.PI;u<2*Math.PI;u+=G_)s=e-a*Tv[u]*V1+a*Nv[u]*$1,o=r+l*Nv[u]*V1+l*Tv[u]*$1,u===0?t.moveTo(s,o):t.lineTo(s,o);t.closePath()};var Pl={};Pl.createBuffer=function(t,e){var r=document.createElement("canvas");return r.width=t,r.height=e,[r,r.getContext("2d")]};Pl.bufferCanvasImage=function(t){var e=this.cy,r=e.mutableElements(),n=r.boundingBox(),i=this.findContainerClientCoords(),s=t.full?Math.ceil(n.w):i[2],o=t.full?Math.ceil(n.h):i[3],a=Ke(t.maxWidth)||Ke(t.maxHeight),l=this.getPixelRatio(),u=1;if(t.scale!==void 0)s*=t.scale,o*=t.scale,u=t.scale;else if(a){var c=1/0,h=1/0;Ke(t.maxWidth)&&(c=u*t.maxWidth/s),Ke(t.maxHeight)&&(h=u*t.maxHeight/o),u=Math.min(c,h),s*=u,o*=u}a||(s*=l,o*=l,u*=l);var v=document.createElement("canvas");v.width=s,v.height=o,v.style.width=s+"px",v.style.height=o+"px";var d=v.getContext("2d");if(s>0&&o>0){d.clearRect(0,0,s,o),d.globalCompositeOperation="source-over";var x=this.getCachedZSortedEles();if(t.full)d.translate(-n.x1*u,-n.y1*u),d.scale(u,u),this.drawElements(d,x),d.scale(1/u,1/u),d.translate(n.x1*u,n.y1*u);else{var w=e.pan(),g={x:w.x*u,y:w.y*u};u*=e.zoom(),d.translate(g.x,g.y),d.scale(u,u),this.drawElements(d,x),d.scale(1/u,1/u),d.translate(-g.x,-g.y)}t.bg&&(d.globalCompositeOperation="destination-over",d.fillStyle=t.bg,d.rect(0,0,s,o),d.fill())}return v};function HD(t,e){for(var r=atob(t),n=new ArrayBuffer(r.length),i=new Uint8Array(n),s=0;s<r.length;s++)i[s]=r.charCodeAt(s);return new Blob([n],{type:e})}function G1(t){var e=t.indexOf(",");return t.substr(e+1)}function q_(t,e,r){var n=function(){return e.toDataURL(r,t.quality)};switch(t.output){case"blob-promise":return new Xs(function(i,s){try{e.toBlob(function(o){o!=null?i(o):s(new Error("`canvas.toBlob()` sent a null value in its callback"))},r,t.quality)}catch(o){s(o)}});case"blob":return HD(G1(n()),r);case"base64":return G1(n());case"base64uri":default:return n()}}Pl.png=function(t){return q_(t,this.bufferCanvasImage(t),"image/png")};Pl.jpg=function(t){return q_(t,this.bufferCanvasImage(t),"image/jpeg")};var Y_={};Y_.nodeShapeImpl=function(t,e,r,n,i,s,o,a){switch(t){case"ellipse":return this.drawEllipsePath(e,r,n,i,s);case"polygon":return this.drawPolygonPath(e,r,n,i,s,o);case"round-polygon":return this.drawRoundPolygonPath(e,r,n,i,s,o,a);case"roundrectangle":case"round-rectangle":return this.drawRoundRectanglePath(e,r,n,i,s,a);case"cutrectangle":case"cut-rectangle":return this.drawCutRectanglePath(e,r,n,i,s,o,a);case"bottomroundrectangle":case"bottom-round-rectangle":return this.drawBottomRoundRectanglePath(e,r,n,i,s,a);case"barrel":return this.drawBarrelPath(e,r,n,i,s)}};var UD=X_,_t=X_.prototype;_t.CANVAS_LAYERS=3;_t.SELECT_BOX=0;_t.DRAG=1;_t.NODE=2;_t.WEBGL=3;_t.CANVAS_TYPES=["2d","2d","2d","webgl2"];_t.BUFFER_COUNT=3;_t.TEXTURE_BUFFER=0;_t.MOTIONBLUR_BUFFER_NODE=1;_t.MOTIONBLUR_BUFFER_DRAG=2;function X_(t){var e=this,r=e.cy.window(),n=r.document;t.webgl&&(_t.CANVAS_LAYERS=e.CANVAS_LAYERS=4,console.log("webgl rendering enabled")),e.data={canvases:new Array(_t.CANVAS_LAYERS),contexts:new Array(_t.CANVAS_LAYERS),canvasNeedsRedraw:new Array(_t.CANVAS_LAYERS),bufferCanvases:new Array(_t.BUFFER_COUNT),bufferContexts:new Array(_t.CANVAS_LAYERS)};var i="-webkit-tap-highlight-color",s="rgba(0,0,0,0)";e.data.canvasContainer=n.createElement("div");var o=e.data.canvasContainer.style;e.data.canvasContainer.style[i]=s,o.position="relative",o.zIndex="0",o.overflow="hidden";var a=t.cy.container();a.appendChild(e.data.canvasContainer),a.style[i]=s;var l={"-webkit-user-select":"none","-moz-user-select":"-moz-none","user-select":"none","-webkit-tap-highlight-color":"rgba(0,0,0,0)","outline-style":"none"};Mk()&&(l["-ms-touch-action"]="none",l["touch-action"]="none");for(var u=0;u<_t.CANVAS_LAYERS;u++){var c=e.data.canvases[u]=n.createElement("canvas"),h=_t.CANVAS_TYPES[u];e.data.contexts[u]=c.getContext(h),e.data.contexts[u]||er("Could not create canvas of type "+h),Object.keys(l).forEach(function(Y){c.style[Y]=l[Y]}),c.style.position="absolute",c.setAttribute("data-id","layer"+u),c.style.zIndex=String(_t.CANVAS_LAYERS-u),e.data.canvasContainer.appendChild(c),e.data.canvasNeedsRedraw[u]=!1}e.data.topCanvas=e.data.canvases[0],e.data.canvases[_t.NODE].setAttribute("data-id","layer"+_t.NODE+"-node"),e.data.canvases[_t.SELECT_BOX].setAttribute("data-id","layer"+_t.SELECT_BOX+"-selectbox"),e.data.canvases[_t.DRAG].setAttribute("data-id","layer"+_t.DRAG+"-drag"),e.data.canvases[_t.WEBGL]&&e.data.canvases[_t.WEBGL].setAttribute("data-id","layer"+_t.WEBGL+"-webgl");for(var u=0;u<_t.BUFFER_COUNT;u++)e.data.bufferCanvases[u]=n.createElement("canvas"),e.data.bufferContexts[u]=e.data.bufferCanvases[u].getContext("2d"),e.data.bufferCanvases[u].style.position="absolute",e.data.bufferCanvases[u].setAttribute("data-id","buffer"+u),e.data.bufferCanvases[u].style.zIndex=String(-u-1),e.data.bufferCanvases[u].style.visibility="hidden";e.pathsEnabled=!0;var v=Qr(),d=function(X){return{x:(X.x1+X.x2)/2,y:(X.y1+X.y2)/2}},x=function(X){return{x:-X.w/2,y:-X.h/2}},w=function(X){var J=X[0]._private,re=J.oldBackgroundTimestamp===J.backgroundTimestamp;return!re},g=function(X){return X[0]._private.nodeKey},m=function(X){return X[0]._private.labelStyleKey},y=function(X){return X[0]._private.sourceLabelStyleKey},b=function(X){return X[0]._private.targetLabelStyleKey},S=function(X,J,re,ce,de){return e.drawElement(X,J,re,!1,!1,de)},N=function(X,J,re,ce,de){return e.drawElementText(X,J,re,ce,"main",de)},E=function(X,J,re,ce,de){return e.drawElementText(X,J,re,ce,"source",de)},T=function(X,J,re,ce,de){return e.drawElementText(X,J,re,ce,"target",de)},k=function(X){return X.boundingBox(),X[0]._private.bodyBounds},L=function(X){return X.boundingBox(),X[0]._private.labelBounds.main||v},A=function(X){return X.boundingBox(),X[0]._private.labelBounds.source||v},I=function(X){return X.boundingBox(),X[0]._private.labelBounds.target||v},M=function(X,J){return J},B=function(X){return d(k(X))},D=function(X,J,re){var ce=X?X+"-":"";return{x:J.x+re.pstyle(ce+"text-margin-x").pfValue,y:J.y+re.pstyle(ce+"text-margin-y").pfValue}},H=function(X,J,re){var ce=X[0]._private.rscratch;return{x:ce[J],y:ce[re]}},U=function(X){return D("",H(X,"labelX","labelY"),X)},z=function(X){return D("source",H(X,"sourceLabelX","sourceLabelY"),X)},W=function(X){return D("target",H(X,"targetLabelX","targetLabelY"),X)},F=function(X){return x(k(X))},P=function(X){return x(A(X))},j=function(X){return x(I(X))},G=function(X){var J=L(X),re=x(L(X));if(X.isNode()){switch(Vs(X.pstyle("text-halign").value)){case"left":re.x=-J.w-(J.leftPad||0);break;case"right":re.x=-(J.rightPad||0);break}switch($s(X.pstyle("text-valign").value)){case"top":re.y=-J.h-(J.topPad||0);break;case"bottom":re.y=-(J.botPad||0);break}}return re},$=e.data.eleTxrCache=new rl(e,{getKey:g,doesEleInvalidateKey:w,drawElement:S,getBoundingBox:k,getRotationPoint:B,getRotationOffset:F,allowEdgeTxrCaching:!1,allowParentTxrCaching:!1}),ee=e.data.lblTxrCache=new rl(e,{getKey:m,drawElement:N,getBoundingBox:L,getRotationPoint:U,getRotationOffset:G,isVisible:M}),ae=e.data.slbTxrCache=new rl(e,{getKey:y,drawElement:E,getBoundingBox:A,getRotationPoint:z,getRotationOffset:P,isVisible:M}),ie=e.data.tlbTxrCache=new rl(e,{getKey:b,drawElement:T,getBoundingBox:I,getRotationPoint:W,getRotationOffset:j,isVisible:M}),K=e.data.lyrTxrCache=new O_(e);e.onUpdateEleCalcs(function(X,J){$.invalidateElements(J),ee.invalidateElements(J),ae.invalidateElements(J),ie.invalidateElements(J),K.invalidateElements(J);for(var re=0;re<J.length;re++){var ce=J[re]._private;ce.oldBackgroundTimestamp=ce.backgroundTimestamp}});var q=function(X){for(var J=0;J<X.length;J++)K.enqueueElementRefinement(X[J].ele)};$.onDequeue(q),ee.onDequeue(q),ae.onDequeue(q),ie.onDequeue(q),t.webgl&&e.initWebgl(t,{getStyleKey:g,getLabelKey:m,getSourceLabelKey:y,getTargetLabelKey:b,drawElement:S,drawLabel:N,drawSourceLabel:E,drawTargetLabel:T,getElementBox:k,getLabelBox:L,getSourceLabelBox:A,getTargetLabelBox:I,getElementRotationPoint:B,getElementRotationOffset:F,getLabelRotationPoint:U,getSourceLabelRotationPoint:z,getTargetLabelRotationPoint:W,getLabelRotationOffset:G,getSourceLabelRotationOffset:P,getTargetLabelRotationOffset:j})}_t.redrawHint=function(t,e){var r=this;switch(t){case"eles":r.data.canvasNeedsRedraw[_t.NODE]=e;break;case"drag":r.data.canvasNeedsRedraw[_t.DRAG]=e;break;case"select":r.data.canvasNeedsRedraw[_t.SELECT_BOX]=e;break;case"gc":r.data.gc=!0;break}};var WD=typeof Path2D<"u";_t.path2dEnabled=function(t){if(t===void 0)return this.pathsEnabled;this.pathsEnabled=!!t};_t.usePaths=function(){return WD&&this.pathsEnabled};_t.setImgSmoothing=function(t,e){t.imageSmoothingEnabled!=null?t.imageSmoothingEnabled=e:(t.webkitImageSmoothingEnabled=e,t.mozImageSmoothingEnabled=e,t.msImageSmoothingEnabled=e)};_t.getImgSmoothing=function(t){return t.imageSmoothingEnabled!=null?t.imageSmoothingEnabled:t.webkitImageSmoothingEnabled||t.mozImageSmoothingEnabled||t.msImageSmoothingEnabled};_t.makeOffscreenCanvas=function(t,e){var r;if((typeof OffscreenCanvas>"u"?"undefined":br(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};[B_,ni,xi,vg,$a,la,Zr,U_,ua,Pl,Y_].forEach(function(t){pt(_t,t)});var VD=[{name:"null",impl:__},{name:"base",impl:M_},{name:"canvas",impl:UD}],$D=[{type:"layout",extensions:pL},{type:"renderer",extensions:VD}],K_={},Q_={};function Z_(t,e,r){var n=r,i=function(k){jt("Can not register `"+e+"` for `"+t+"` since `"+k+"` already exists in the prototype and can not be overridden")};if(t==="core"){if(xl.prototype[e])return i(e);xl.prototype[e]=r}else if(t==="collection"){if(Ar.prototype[e])return i(e);Ar.prototype[e]=r}else if(t==="layout"){for(var s=function(k){this.options=k,r.call(this,k),At(this._private)||(this._private={}),this._private.cy=k.cy,this._private.listeners=[],this.createEmitter()},o=s.prototype=Object.create(r.prototype),a=[],l=0;l<a.length;l++){var u=a[l];o[u]=o[u]||function(){return this}}o.start&&!o.run?o.run=function(){return this.start(),this}:!o.start&&o.run&&(o.start=function(){return this.run(),this});var c=r.prototype.stop;o.stop=function(){var T=this.options;if(T&&T.animate){var k=this.animations;if(k)for(var L=0;L<k.length;L++)k[L].stop()}return c?c.call(this):this.emit("layoutstop"),this},o.destroy||(o.destroy=function(){return this}),o.cy=function(){return this._private.cy};var h=function(k){return k._private.cy},v={addEventFields:function(k,L){L.layout=k,L.cy=h(k),L.target=k},bubble:function(){return!0},parent:function(k){return h(k)}};pt(o,{createEmitter:function(){return this._private.emitter=new th(v,this),this},emitter:function(){return this._private.emitter},on:function(k,L){return this.emitter().on(k,L),this},one:function(k,L){return this.emitter().one(k,L),this},once:function(k,L){return this.emitter().one(k,L),this},removeListener:function(k,L){return this.emitter().removeListener(k,L),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},emit:function(k,L){return this.emitter().emit(k,L),this}}),Bt.eventAliasesOn(o),n=s}else if(t==="renderer"&&e!=="null"&&e!=="base"){var d=J_("renderer","base"),x=d.prototype,w=r,g=r.prototype,m=function(){d.apply(this,arguments),w.apply(this,arguments)},y=m.prototype;for(var b in x){var S=x[b],N=g[b]!=null;if(N)return i(b);y[b]=S}for(var E in g)y[E]=g[E];x.clientFunctions.forEach(function(T){y[T]=y[T]||function(){er("Renderer does not implement `renderer."+T+"()` on its prototype")}}),n=m}else if(t==="__proto__"||t==="constructor"||t==="prototype")return er(t+" is an illegal type to be registered, possibly lead to prototype pollutions");return gw({map:K_,keys:[t,e],value:n})}function J_(t,e){return mw({map:K_,keys:[t,e]})}function GD(t,e,r,n,i){return gw({map:Q_,keys:[t,e,r,n],value:i})}function qD(t,e,r,n){return mw({map:Q_,keys:[t,e,r,n]})}var Rv=function(){if(arguments.length===2)return J_.apply(null,arguments);if(arguments.length===3)return Z_.apply(null,arguments);if(arguments.length===4)return qD.apply(null,arguments);if(arguments.length===5)return GD.apply(null,arguments);er("Invalid extension access syntax")};xl.prototype.extension=Rv;$D.forEach(function(t){t.extensions.forEach(function(e){Z_(t.type,e.name,e.impl)})});var Fc=function(){if(!(this instanceof Fc))return new Fc;this.length=0},Ua=Fc.prototype;Ua.instanceString=function(){return"stylesheet"};Ua.selector=function(t){var e=this.length++;return this[e]={selector:t,properties:[]},this};Ua.css=function(t,e){var r=this.length-1;if(ct(t))this[r].properties.push({name:t,value:e});else if(At(t))for(var n=t,i=Object.keys(n),s=0;s<i.length;s++){var o=i[s],a=n[o];if(a!=null){var l=kr.properties[o]||kr.properties[$c(o)];if(l!=null){var u=l.name,c=a;this[r].properties.push({name:u,value:c})}}}return this};Ua.style=Ua.css;Ua.generateStyle=function(t){var e=new kr(t);return this.appendToStyle(e)};Ua.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 s=0;s<i.length;s++){var o=i[s];t.css(o.name,o.value)}}return t};var YD="3.34.0",ia=function(e){if(e===void 0&&(e={}),At(e))return new xl(e);if(ct(e))return Rv.apply(Rv,arguments)};ia.use=function(t){var e=Array.prototype.slice.call(arguments,1);return e.unshift(ia),t.apply(null,e),this};ia.warnings=function(t){return Cw(t)};ia.version=YD;ia.stylesheet=ia.Stylesheet=Fc;var wc={exports:{}},_c={exports:{}},Sc={exports:{}},XD=Sc.exports,q1;function KD(){return q1||(q1=1,(function(t,e){(function(n,i){t.exports=i()})(XD,function(){return(function(r){var n={};function i(s){if(n[s])return n[s].exports;var o=n[s]={i:s,l:!1,exports:{}};return r[s].call(o.exports,o,o.exports,i),o.l=!0,o.exports}return i.m=r,i.c=n,i.i=function(s){return s},i.d=function(s,o,a){i.o(s,o)||Object.defineProperty(s,o,{configurable:!1,enumerable:!0,get:a})},i.n=function(s){var o=s&&s.__esModule?function(){return s.default}:function(){return s};return i.d(o,"a",o),o},i.o=function(s,o){return Object.prototype.hasOwnProperty.call(s,o)},i.p="",i(i.s=28)})([(function(r,n,i){function s(){}s.QUALITY=1,s.DEFAULT_CREATE_BENDS_AS_NEEDED=!1,s.DEFAULT_INCREMENTAL=!1,s.DEFAULT_ANIMATION_ON_LAYOUT=!0,s.DEFAULT_ANIMATION_DURING_LAYOUT=!1,s.DEFAULT_ANIMATION_PERIOD=50,s.DEFAULT_UNIFORM_LEAF_NODE_SIZES=!1,s.DEFAULT_GRAPH_MARGIN=15,s.NODE_DIMENSIONS_INCLUDE_LABELS=!1,s.SIMPLE_NODE_SIZE=40,s.SIMPLE_NODE_HALF_SIZE=s.SIMPLE_NODE_SIZE/2,s.EMPTY_COMPOUND_NODE_SIZE=40,s.MIN_EDGE_LENGTH=1,s.WORLD_BOUNDARY=1e6,s.INITIAL_WORLD_BOUNDARY=s.WORLD_BOUNDARY/1e3,s.WORLD_CENTER_X=1200,s.WORLD_CENTER_Y=900,r.exports=s}),(function(r,n,i){var s=i(2),o=i(8),a=i(9);function l(c,h,v){s.call(this,v),this.isOverlapingSourceAndTarget=!1,this.vGraphObject=v,this.bendpoints=[],this.source=c,this.target=h}l.prototype=Object.create(s.prototype);for(var u in s)l[u]=s[u];l.prototype.getSource=function(){return this.source},l.prototype.getTarget=function(){return this.target},l.prototype.isInterGraph=function(){return this.isInterGraph},l.prototype.getLength=function(){return this.length},l.prototype.isOverlapingSourceAndTarget=function(){return this.isOverlapingSourceAndTarget},l.prototype.getBendpoints=function(){return this.bendpoints},l.prototype.getLca=function(){return this.lca},l.prototype.getSourceInLca=function(){return this.sourceInLca},l.prototype.getTargetInLca=function(){return this.targetInLca},l.prototype.getOtherEnd=function(c){if(this.source===c)return this.target;if(this.target===c)return this.source;throw"Node is not incident with this edge"},l.prototype.getOtherEndInGraph=function(c,h){for(var v=this.getOtherEnd(c),d=h.getGraphManager().getRoot();;){if(v.getOwner()==h)return v;if(v.getOwner()==d)break;v=v.getOwner().getParent()}return null},l.prototype.updateLength=function(){var c=new Array(4);this.isOverlapingSourceAndTarget=o.getIntersection(this.target.getRect(),this.source.getRect(),c),this.isOverlapingSourceAndTarget||(this.lengthX=c[0]-c[2],this.lengthY=c[1]-c[3],Math.abs(this.lengthX)<1&&(this.lengthX=a.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=a.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY))},l.prototype.updateLengthSimple=function(){this.lengthX=this.target.getCenterX()-this.source.getCenterX(),this.lengthY=this.target.getCenterY()-this.source.getCenterY(),Math.abs(this.lengthX)<1&&(this.lengthX=a.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=a.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY)},r.exports=l}),(function(r,n,i){function s(o){this.vGraphObject=o}r.exports=s}),(function(r,n,i){var s=i(2),o=i(10),a=i(13),l=i(0),u=i(16),c=i(5);function h(d,x,w,g){w==null&&g==null&&(g=x),s.call(this,g),d.graphManager!=null&&(d=d.graphManager),this.estimatedSize=o.MIN_VALUE,this.inclusionTreeDepth=o.MAX_VALUE,this.vGraphObject=g,this.edges=[],this.graphManager=d,w!=null&&x!=null?this.rect=new a(x.x,x.y,w.width,w.height):this.rect=new a}h.prototype=Object.create(s.prototype);for(var v in s)h[v]=s[v];h.prototype.getEdges=function(){return this.edges},h.prototype.getChild=function(){return this.child},h.prototype.getOwner=function(){return this.owner},h.prototype.getWidth=function(){return this.rect.width},h.prototype.setWidth=function(d){this.rect.width=d},h.prototype.getHeight=function(){return this.rect.height},h.prototype.setHeight=function(d){this.rect.height=d},h.prototype.getCenterX=function(){return this.rect.x+this.rect.width/2},h.prototype.getCenterY=function(){return this.rect.y+this.rect.height/2},h.prototype.getCenter=function(){return new c(this.rect.x+this.rect.width/2,this.rect.y+this.rect.height/2)},h.prototype.getLocation=function(){return new c(this.rect.x,this.rect.y)},h.prototype.getRect=function(){return this.rect},h.prototype.getDiagonal=function(){return Math.sqrt(this.rect.width*this.rect.width+this.rect.height*this.rect.height)},h.prototype.getHalfTheDiagonal=function(){return Math.sqrt(this.rect.height*this.rect.height+this.rect.width*this.rect.width)/2},h.prototype.setRect=function(d,x){this.rect.x=d.x,this.rect.y=d.y,this.rect.width=x.width,this.rect.height=x.height},h.prototype.setCenter=function(d,x){this.rect.x=d-this.rect.width/2,this.rect.y=x-this.rect.height/2},h.prototype.setLocation=function(d,x){this.rect.x=d,this.rect.y=x},h.prototype.moveBy=function(d,x){this.rect.x+=d,this.rect.y+=x},h.prototype.getEdgeListToNode=function(d){var x=[],w=this;return w.edges.forEach(function(g){if(g.target==d){if(g.source!=w)throw"Incorrect edge source!";x.push(g)}}),x},h.prototype.getEdgesBetween=function(d){var x=[],w=this;return w.edges.forEach(function(g){if(!(g.source==w||g.target==w))throw"Incorrect edge source and/or target";(g.target==d||g.source==d)&&x.push(g)}),x},h.prototype.getNeighborsList=function(){var d=new Set,x=this;return x.edges.forEach(function(w){if(w.source==x)d.add(w.target);else{if(w.target!=x)throw"Incorrect incidency!";d.add(w.source)}}),d},h.prototype.withChildren=function(){var d=new Set,x,w;if(d.add(this),this.child!=null)for(var g=this.child.getNodes(),m=0;m<g.length;m++)x=g[m],w=x.withChildren(),w.forEach(function(y){d.add(y)});return d},h.prototype.getNoOfChildren=function(){var d=0,x;if(this.child==null)d=1;else for(var w=this.child.getNodes(),g=0;g<w.length;g++)x=w[g],d+=x.getNoOfChildren();return d==0&&(d=1),d},h.prototype.getEstimatedSize=function(){if(this.estimatedSize==o.MIN_VALUE)throw"assert failed";return this.estimatedSize},h.prototype.calcEstimatedSize=function(){return this.child==null?this.estimatedSize=(this.rect.width+this.rect.height)/2:(this.estimatedSize=this.child.calcEstimatedSize(),this.rect.width=this.estimatedSize,this.rect.height=this.estimatedSize,this.estimatedSize)},h.prototype.scatter=function(){var d,x,w=-l.INITIAL_WORLD_BOUNDARY,g=l.INITIAL_WORLD_BOUNDARY;d=l.WORLD_CENTER_X+u.nextDouble()*(g-w)+w;var m=-l.INITIAL_WORLD_BOUNDARY,y=l.INITIAL_WORLD_BOUNDARY;x=l.WORLD_CENTER_Y+u.nextDouble()*(y-m)+m,this.rect.x=d,this.rect.y=x},h.prototype.updateBounds=function(){if(this.getChild()==null)throw"assert failed";if(this.getChild().getNodes().length!=0){var d=this.getChild();if(d.updateBounds(!0),this.rect.x=d.getLeft(),this.rect.y=d.getTop(),this.setWidth(d.getRight()-d.getLeft()),this.setHeight(d.getBottom()-d.getTop()),l.NODE_DIMENSIONS_INCLUDE_LABELS){var x=d.getRight()-d.getLeft(),w=d.getBottom()-d.getTop();this.labelWidth&&(this.labelPosHorizontal=="left"?(this.rect.x-=this.labelWidth,this.setWidth(x+this.labelWidth)):this.labelPosHorizontal=="center"&&this.labelWidth>x?(this.rect.x-=(this.labelWidth-x)/2,this.setWidth(this.labelWidth)):this.labelPosHorizontal=="right"&&this.setWidth(x+this.labelWidth)),this.labelHeight&&(this.labelPosVertical=="top"?(this.rect.y-=this.labelHeight,this.setHeight(w+this.labelHeight)):this.labelPosVertical=="center"&&this.labelHeight>w?(this.rect.y-=(this.labelHeight-w)/2,this.setHeight(this.labelHeight)):this.labelPosVertical=="bottom"&&this.setHeight(w+this.labelHeight))}}},h.prototype.getInclusionTreeDepth=function(){if(this.inclusionTreeDepth==o.MAX_VALUE)throw"assert failed";return this.inclusionTreeDepth},h.prototype.transform=function(d){var x=this.rect.x;x>l.WORLD_BOUNDARY?x=l.WORLD_BOUNDARY:x<-l.WORLD_BOUNDARY&&(x=-l.WORLD_BOUNDARY);var w=this.rect.y;w>l.WORLD_BOUNDARY?w=l.WORLD_BOUNDARY:w<-l.WORLD_BOUNDARY&&(w=-l.WORLD_BOUNDARY);var g=new c(x,w),m=d.inverseTransformPoint(g);this.setLocation(m.x,m.y)},h.prototype.getLeft=function(){return this.rect.x},h.prototype.getRight=function(){return this.rect.x+this.rect.width},h.prototype.getTop=function(){return this.rect.y},h.prototype.getBottom=function(){return this.rect.y+this.rect.height},h.prototype.getParent=function(){return this.owner==null?null:this.owner.getParent()},r.exports=h}),(function(r,n,i){var s=i(0);function o(){}for(var a in s)o[a]=s[a];o.MAX_ITERATIONS=2500,o.DEFAULT_EDGE_LENGTH=50,o.DEFAULT_SPRING_STRENGTH=.45,o.DEFAULT_REPULSION_STRENGTH=4500,o.DEFAULT_GRAVITY_STRENGTH=.4,o.DEFAULT_COMPOUND_GRAVITY_STRENGTH=1,o.DEFAULT_GRAVITY_RANGE_FACTOR=3.8,o.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=1.5,o.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION=!0,o.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION=!0,o.DEFAULT_COOLING_FACTOR_INCREMENTAL=.3,o.COOLING_ADAPTATION_FACTOR=.33,o.ADAPTATION_LOWER_NODE_LIMIT=1e3,o.ADAPTATION_UPPER_NODE_LIMIT=5e3,o.MAX_NODE_DISPLACEMENT_INCREMENTAL=100,o.MAX_NODE_DISPLACEMENT=o.MAX_NODE_DISPLACEMENT_INCREMENTAL*3,o.MIN_REPULSION_DIST=o.DEFAULT_EDGE_LENGTH/10,o.CONVERGENCE_CHECK_PERIOD=100,o.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=.1,o.MIN_EDGE_LENGTH=1,o.GRID_CALCULATION_CHECK_PERIOD=10,r.exports=o}),(function(r,n,i){function s(o,a){o==null&&a==null?(this.x=0,this.y=0):(this.x=o,this.y=a)}s.prototype.getX=function(){return this.x},s.prototype.getY=function(){return this.y},s.prototype.setX=function(o){this.x=o},s.prototype.setY=function(o){this.y=o},s.prototype.getDifference=function(o){return new DimensionD(this.x-o.x,this.y-o.y)},s.prototype.getCopy=function(){return new s(this.x,this.y)},s.prototype.translate=function(o){return this.x+=o.width,this.y+=o.height,this},r.exports=s}),(function(r,n,i){var s=i(2),o=i(10),a=i(0),l=i(7),u=i(3),c=i(1),h=i(13),v=i(12),d=i(11);function x(g,m,y){s.call(this,y),this.estimatedSize=o.MIN_VALUE,this.margin=a.DEFAULT_GRAPH_MARGIN,this.edges=[],this.nodes=[],this.isConnected=!1,this.parent=g,m!=null&&m instanceof l?this.graphManager=m:m!=null&&m instanceof Layout&&(this.graphManager=m.graphManager)}x.prototype=Object.create(s.prototype);for(var w in s)x[w]=s[w];x.prototype.getNodes=function(){return this.nodes},x.prototype.getEdges=function(){return this.edges},x.prototype.getGraphManager=function(){return this.graphManager},x.prototype.getParent=function(){return this.parent},x.prototype.getLeft=function(){return this.left},x.prototype.getRight=function(){return this.right},x.prototype.getTop=function(){return this.top},x.prototype.getBottom=function(){return this.bottom},x.prototype.isConnected=function(){return this.isConnected},x.prototype.add=function(g,m,y){if(m==null&&y==null){var b=g;if(this.graphManager==null)throw"Graph has no graph mgr!";if(this.getNodes().indexOf(b)>-1)throw"Node already in graph!";return b.owner=this,this.getNodes().push(b),b}else{var S=g;if(!(this.getNodes().indexOf(m)>-1&&this.getNodes().indexOf(y)>-1))throw"Source or target not in graph!";if(!(m.owner==y.owner&&m.owner==this))throw"Both owners must be this graph!";return m.owner!=y.owner?null:(S.source=m,S.target=y,S.isInterGraph=!1,this.getEdges().push(S),m.edges.push(S),y!=m&&y.edges.push(S),S)}},x.prototype.remove=function(g){var m=g;if(g instanceof u){if(m==null)throw"Node is null!";if(!(m.owner!=null&&m.owner==this))throw"Owner graph is invalid!";if(this.graphManager==null)throw"Owner graph manager is invalid!";for(var y=m.edges.slice(),b,S=y.length,N=0;N<S;N++)b=y[N],b.isInterGraph?this.graphManager.remove(b):b.source.owner.remove(b);var E=this.nodes.indexOf(m);if(E==-1)throw"Node not in owner node list!";this.nodes.splice(E,1)}else if(g instanceof c){var b=g;if(b==null)throw"Edge is null!";if(!(b.source!=null&&b.target!=null))throw"Source and/or target is null!";if(!(b.source.owner!=null&&b.target.owner!=null&&b.source.owner==this&&b.target.owner==this))throw"Source and/or target owner is invalid!";var T=b.source.edges.indexOf(b),k=b.target.edges.indexOf(b);if(!(T>-1&&k>-1))throw"Source and/or target doesn't know this edge!";b.source.edges.splice(T,1),b.target!=b.source&&b.target.edges.splice(k,1);var E=b.source.owner.getEdges().indexOf(b);if(E==-1)throw"Not in owner's edge list!";b.source.owner.getEdges().splice(E,1)}},x.prototype.updateLeftTop=function(){for(var g=o.MAX_VALUE,m=o.MAX_VALUE,y,b,S,N=this.getNodes(),E=N.length,T=0;T<E;T++){var k=N[T];y=k.getTop(),b=k.getLeft(),g>y&&(g=y),m>b&&(m=b)}return g==o.MAX_VALUE?null:(N[0].getParent().paddingLeft!=null?S=N[0].getParent().paddingLeft:S=this.margin,this.left=m-S,this.top=g-S,new v(this.left,this.top))},x.prototype.updateBounds=function(g){for(var m=o.MAX_VALUE,y=-o.MAX_VALUE,b=o.MAX_VALUE,S=-o.MAX_VALUE,N,E,T,k,L,A=this.nodes,I=A.length,M=0;M<I;M++){var B=A[M];g&&B.child!=null&&B.updateBounds(),N=B.getLeft(),E=B.getRight(),T=B.getTop(),k=B.getBottom(),m>N&&(m=N),y<E&&(y=E),b>T&&(b=T),S<k&&(S=k)}var D=new h(m,b,y-m,S-b);m==o.MAX_VALUE&&(this.left=this.parent.getLeft(),this.right=this.parent.getRight(),this.top=this.parent.getTop(),this.bottom=this.parent.getBottom()),A[0].getParent().paddingLeft!=null?L=A[0].getParent().paddingLeft:L=this.margin,this.left=D.x-L,this.right=D.x+D.width+L,this.top=D.y-L,this.bottom=D.y+D.height+L},x.calculateBounds=function(g){for(var m=o.MAX_VALUE,y=-o.MAX_VALUE,b=o.MAX_VALUE,S=-o.MAX_VALUE,N,E,T,k,L=g.length,A=0;A<L;A++){var I=g[A];N=I.getLeft(),E=I.getRight(),T=I.getTop(),k=I.getBottom(),m>N&&(m=N),y<E&&(y=E),b>T&&(b=T),S<k&&(S=k)}var M=new h(m,b,y-m,S-b);return M},x.prototype.getInclusionTreeDepth=function(){return this==this.graphManager.getRoot()?1:this.parent.getInclusionTreeDepth()},x.prototype.getEstimatedSize=function(){if(this.estimatedSize==o.MIN_VALUE)throw"assert failed";return this.estimatedSize},x.prototype.calcEstimatedSize=function(){for(var g=0,m=this.nodes,y=m.length,b=0;b<y;b++){var S=m[b];g+=S.calcEstimatedSize()}return g==0?this.estimatedSize=a.EMPTY_COMPOUND_NODE_SIZE:this.estimatedSize=g/Math.sqrt(this.nodes.length),this.estimatedSize},x.prototype.updateConnected=function(){var g=this;if(this.nodes.length==0){this.isConnected=!0;return}var m=new d,y=new Set,b=this.nodes[0],S,N,E=b.withChildren();for(E.forEach(function(M){m.push(M),y.add(M)});m.length!==0;){b=m.shift(),S=b.getEdges();for(var T=S.length,k=0;k<T;k++){var L=S[k];if(N=L.getOtherEndInGraph(b,this),N!=null&&!y.has(N)){var A=N.withChildren();A.forEach(function(M){m.push(M),y.add(M)})}}}if(this.isConnected=!1,y.size>=this.nodes.length){var I=0;y.forEach(function(M){M.owner==g&&I++}),I==this.nodes.length&&(this.isConnected=!0)}},r.exports=x}),(function(r,n,i){var s,o=i(1);function a(l){s=i(6),this.layout=l,this.graphs=[],this.edges=[]}a.prototype.addRoot=function(){var l=this.layout.newGraph(),u=this.layout.newNode(null),c=this.add(l,u);return this.setRootGraph(c),this.rootGraph},a.prototype.add=function(l,u,c,h,v){if(c==null&&h==null&&v==null){if(l==null)throw"Graph is null!";if(u==null)throw"Parent node is null!";if(this.graphs.indexOf(l)>-1)throw"Graph already in this graph mgr!";if(this.graphs.push(l),l.parent!=null)throw"Already has a parent!";if(u.child!=null)throw"Already has a child!";return l.parent=u,u.child=l,l}else{v=c,h=u,c=l;var d=h.getOwner(),x=v.getOwner();if(!(d!=null&&d.getGraphManager()==this))throw"Source not in this graph mgr!";if(!(x!=null&&x.getGraphManager()==this))throw"Target not in this graph mgr!";if(d==x)return c.isInterGraph=!1,d.add(c,h,v);if(c.isInterGraph=!0,c.source=h,c.target=v,this.edges.indexOf(c)>-1)throw"Edge already in inter-graph edge list!";if(this.edges.push(c),!(c.source!=null&&c.target!=null))throw"Edge source and/or target is null!";if(!(c.source.edges.indexOf(c)==-1&&c.target.edges.indexOf(c)==-1))throw"Edge already in source and/or target incidency list!";return c.source.edges.push(c),c.target.edges.push(c),c}},a.prototype.remove=function(l){if(l instanceof s){var u=l;if(u.getGraphManager()!=this)throw"Graph not in this graph mgr";if(!(u==this.rootGraph||u.parent!=null&&u.parent.graphManager==this))throw"Invalid parent node!";var c=[];c=c.concat(u.getEdges());for(var h,v=c.length,d=0;d<v;d++)h=c[d],u.remove(h);var x=[];x=x.concat(u.getNodes());var w;v=x.length;for(var d=0;d<v;d++)w=x[d],u.remove(w);u==this.rootGraph&&this.setRootGraph(null);var g=this.graphs.indexOf(u);this.graphs.splice(g,1),u.parent=null}else if(l instanceof o){if(h=l,h==null)throw"Edge is null!";if(!h.isInterGraph)throw"Not an inter-graph edge!";if(!(h.source!=null&&h.target!=null))throw"Source and/or target is null!";if(!(h.source.edges.indexOf(h)!=-1&&h.target.edges.indexOf(h)!=-1))throw"Source and/or target doesn't know this edge!";var g=h.source.edges.indexOf(h);if(h.source.edges.splice(g,1),g=h.target.edges.indexOf(h),h.target.edges.splice(g,1),!(h.source.owner!=null&&h.source.owner.getGraphManager()!=null))throw"Edge owner graph or owner graph manager is null!";if(h.source.owner.getGraphManager().edges.indexOf(h)==-1)throw"Not in owner graph manager's edge list!";var g=h.source.owner.getGraphManager().edges.indexOf(h);h.source.owner.getGraphManager().edges.splice(g,1)}},a.prototype.updateBounds=function(){this.rootGraph.updateBounds(!0)},a.prototype.getGraphs=function(){return this.graphs},a.prototype.getAllNodes=function(){if(this.allNodes==null){for(var l=[],u=this.getGraphs(),c=u.length,h=0;h<c;h++)l=l.concat(u[h].getNodes());this.allNodes=l}return this.allNodes},a.prototype.resetAllNodes=function(){this.allNodes=null},a.prototype.resetAllEdges=function(){this.allEdges=null},a.prototype.resetAllNodesToApplyGravitation=function(){this.allNodesToApplyGravitation=null},a.prototype.getAllEdges=function(){if(this.allEdges==null){var l=[],u=this.getGraphs();u.length;for(var c=0;c<u.length;c++)l=l.concat(u[c].getEdges());l=l.concat(this.edges),this.allEdges=l}return this.allEdges},a.prototype.getAllNodesToApplyGravitation=function(){return this.allNodesToApplyGravitation},a.prototype.setAllNodesToApplyGravitation=function(l){if(this.allNodesToApplyGravitation!=null)throw"assert failed";this.allNodesToApplyGravitation=l},a.prototype.getRoot=function(){return this.rootGraph},a.prototype.setRootGraph=function(l){if(l.getGraphManager()!=this)throw"Root not in this graph mgr!";this.rootGraph=l,l.parent==null&&(l.parent=this.layout.newNode("Root node"))},a.prototype.getLayout=function(){return this.layout},a.prototype.isOneAncestorOfOther=function(l,u){if(!(l!=null&&u!=null))throw"assert failed";if(l==u)return!0;var c=l.getOwner(),h;do{if(h=c.getParent(),h==null)break;if(h==u)return!0;if(c=h.getOwner(),c==null)break}while(!0);c=u.getOwner();do{if(h=c.getParent(),h==null)break;if(h==l)return!0;if(c=h.getOwner(),c==null)break}while(!0);return!1},a.prototype.calcLowestCommonAncestors=function(){for(var l,u,c,h,v,d=this.getAllEdges(),x=d.length,w=0;w<x;w++){if(l=d[w],u=l.source,c=l.target,l.lca=null,l.sourceInLca=u,l.targetInLca=c,u==c){l.lca=u.getOwner();continue}for(h=u.getOwner();l.lca==null;){for(l.targetInLca=c,v=c.getOwner();l.lca==null;){if(v==h){l.lca=v;break}if(v==this.rootGraph)break;if(l.lca!=null)throw"assert failed";l.targetInLca=v.getParent(),v=l.targetInLca.getOwner()}if(h==this.rootGraph)break;l.lca==null&&(l.sourceInLca=h.getParent(),h=l.sourceInLca.getOwner())}if(l.lca==null)throw"assert failed"}},a.prototype.calcLowestCommonAncestor=function(l,u){if(l==u)return l.getOwner();var c=l.getOwner();do{if(c==null)break;var h=u.getOwner();do{if(h==null)break;if(h==c)return h;h=h.getParent().getOwner()}while(!0);c=c.getParent().getOwner()}while(!0);return c},a.prototype.calcInclusionTreeDepths=function(l,u){l==null&&u==null&&(l=this.rootGraph,u=1);for(var c,h=l.getNodes(),v=h.length,d=0;d<v;d++)c=h[d],c.inclusionTreeDepth=u,c.child!=null&&this.calcInclusionTreeDepths(c.child,u+1)},a.prototype.includesInvalidEdge=function(){for(var l,u=[],c=this.edges.length,h=0;h<c;h++)l=this.edges[h],this.isOneAncestorOfOther(l.source,l.target)&&u.push(l);for(var h=0;h<u.length;h++)this.remove(u[h]);return!1},r.exports=a}),(function(r,n,i){var s=i(12);function o(){}o.calcSeparationAmount=function(a,l,u,c){if(!a.intersects(l))throw"assert failed";var h=new Array(2);this.decideDirectionsForOverlappingNodes(a,l,h),u[0]=Math.min(a.getRight(),l.getRight())-Math.max(a.x,l.x),u[1]=Math.min(a.getBottom(),l.getBottom())-Math.max(a.y,l.y),a.getX()<=l.getX()&&a.getRight()>=l.getRight()?u[0]+=Math.min(l.getX()-a.getX(),a.getRight()-l.getRight()):l.getX()<=a.getX()&&l.getRight()>=a.getRight()&&(u[0]+=Math.min(a.getX()-l.getX(),l.getRight()-a.getRight())),a.getY()<=l.getY()&&a.getBottom()>=l.getBottom()?u[1]+=Math.min(l.getY()-a.getY(),a.getBottom()-l.getBottom()):l.getY()<=a.getY()&&l.getBottom()>=a.getBottom()&&(u[1]+=Math.min(a.getY()-l.getY(),l.getBottom()-a.getBottom()));var v=Math.abs((l.getCenterY()-a.getCenterY())/(l.getCenterX()-a.getCenterX()));l.getCenterY()===a.getCenterY()&&l.getCenterX()===a.getCenterX()&&(v=1);var d=v*u[0],x=u[1]/v;u[0]<x?x=u[0]:d=u[1],u[0]=-1*h[0]*(x/2+c),u[1]=-1*h[1]*(d/2+c)},o.decideDirectionsForOverlappingNodes=function(a,l,u){a.getCenterX()<l.getCenterX()?u[0]=-1:u[0]=1,a.getCenterY()<l.getCenterY()?u[1]=-1:u[1]=1},o.getIntersection2=function(a,l,u){var c=a.getCenterX(),h=a.getCenterY(),v=l.getCenterX(),d=l.getCenterY();if(a.intersects(l))return u[0]=c,u[1]=h,u[2]=v,u[3]=d,!0;var x=a.getX(),w=a.getY(),g=a.getRight(),m=a.getX(),y=a.getBottom(),b=a.getRight(),S=a.getWidthHalf(),N=a.getHeightHalf(),E=l.getX(),T=l.getY(),k=l.getRight(),L=l.getX(),A=l.getBottom(),I=l.getRight(),M=l.getWidthHalf(),B=l.getHeightHalf(),D=!1,H=!1;if(c===v){if(h>d)return u[0]=c,u[1]=w,u[2]=v,u[3]=A,!1;if(h<d)return u[0]=c,u[1]=y,u[2]=v,u[3]=T,!1}else if(h===d){if(c>v)return u[0]=x,u[1]=h,u[2]=k,u[3]=d,!1;if(c<v)return u[0]=g,u[1]=h,u[2]=E,u[3]=d,!1}else{var U=a.height/a.width,z=l.height/l.width,W=(d-h)/(v-c),F=void 0,P=void 0,j=void 0,G=void 0,$=void 0,ee=void 0;if(-U===W?c>v?(u[0]=m,u[1]=y,D=!0):(u[0]=g,u[1]=w,D=!0):U===W&&(c>v?(u[0]=x,u[1]=w,D=!0):(u[0]=b,u[1]=y,D=!0)),-z===W?v>c?(u[2]=L,u[3]=A,H=!0):(u[2]=k,u[3]=T,H=!0):z===W&&(v>c?(u[2]=E,u[3]=T,H=!0):(u[2]=I,u[3]=A,H=!0)),D&&H)return!1;if(c>v?h>d?(F=this.getCardinalDirection(U,W,4),P=this.getCardinalDirection(z,W,2)):(F=this.getCardinalDirection(-U,W,3),P=this.getCardinalDirection(-z,W,1)):h>d?(F=this.getCardinalDirection(-U,W,1),P=this.getCardinalDirection(-z,W,3)):(F=this.getCardinalDirection(U,W,2),P=this.getCardinalDirection(z,W,4)),!D)switch(F){case 1:G=w,j=c+-N/W,u[0]=j,u[1]=G;break;case 2:j=b,G=h+S*W,u[0]=j,u[1]=G;break;case 3:G=y,j=c+N/W,u[0]=j,u[1]=G;break;case 4:j=m,G=h+-S*W,u[0]=j,u[1]=G;break}if(!H)switch(P){case 1:ee=T,$=v+-B/W,u[2]=$,u[3]=ee;break;case 2:$=I,ee=d+M*W,u[2]=$,u[3]=ee;break;case 3:ee=A,$=v+B/W,u[2]=$,u[3]=ee;break;case 4:$=L,ee=d+-M*W,u[2]=$,u[3]=ee;break}}return!1},o.getCardinalDirection=function(a,l,u){return a>l?u:1+u%4},o.getIntersection=function(a,l,u,c){if(c==null)return this.getIntersection2(a,l,u);var h=a.x,v=a.y,d=l.x,x=l.y,w=u.x,g=u.y,m=c.x,y=c.y,b=void 0,S=void 0,N=void 0,E=void 0,T=void 0,k=void 0,L=void 0,A=void 0,I=void 0;return N=x-v,T=h-d,L=d*v-h*x,E=y-g,k=w-m,A=m*g-w*y,I=N*k-E*T,I===0?null:(b=(T*A-k*L)/I,S=(E*L-N*A)/I,new s(b,S))},o.angleOfVector=function(a,l,u,c){var h=void 0;return a!==u?(h=Math.atan((c-l)/(u-a)),u<a?h+=Math.PI:c<l&&(h+=this.TWO_PI)):c<l?h=this.ONE_AND_HALF_PI:h=this.HALF_PI,h},o.doIntersect=function(a,l,u,c){var h=a.x,v=a.y,d=l.x,x=l.y,w=u.x,g=u.y,m=c.x,y=c.y,b=(d-h)*(y-g)-(m-w)*(x-v);if(b===0)return!1;var S=((y-g)*(m-h)+(w-m)*(y-v))/b,N=((v-x)*(m-h)+(d-h)*(y-v))/b;return 0<S&&S<1&&0<N&&N<1},o.findCircleLineIntersections=function(a,l,u,c,h,v,d){var x=(u-a)*(u-a)+(c-l)*(c-l),w=2*((a-h)*(u-a)+(l-v)*(c-l)),g=(a-h)*(a-h)+(l-v)*(l-v)-d*d,m=w*w-4*x*g;if(m>=0){var y=(-w+Math.sqrt(w*w-4*x*g))/(2*x),b=(-w-Math.sqrt(w*w-4*x*g))/(2*x),S=null;return y>=0&&y<=1?[y]:b>=0&&b<=1?[b]:S}else return null},o.HALF_PI=.5*Math.PI,o.ONE_AND_HALF_PI=1.5*Math.PI,o.TWO_PI=2*Math.PI,o.THREE_PI=3*Math.PI,r.exports=o}),(function(r,n,i){function s(){}s.sign=function(o){return o>0?1:o<0?-1:0},s.floor=function(o){return o<0?Math.ceil(o):Math.floor(o)},s.ceil=function(o){return o<0?Math.floor(o):Math.ceil(o)},r.exports=s}),(function(r,n,i){function s(){}s.MAX_VALUE=2147483647,s.MIN_VALUE=-2147483648,r.exports=s}),(function(r,n,i){var s=(function(){function h(v,d){for(var x=0;x<d.length;x++){var w=d[x];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(v,w.key,w)}}return function(v,d,x){return d&&h(v.prototype,d),x&&h(v,x),v}})();function o(h,v){if(!(h instanceof v))throw new TypeError("Cannot call a class as a function")}var a=function(v){return{value:v,next:null,prev:null}},l=function(v,d,x,w){return v!==null?v.next=d:w.head=d,x!==null?x.prev=d:w.tail=d,d.prev=v,d.next=x,w.length++,d},u=function(v,d){var x=v.prev,w=v.next;return x!==null?x.next=w:d.head=w,w!==null?w.prev=x:d.tail=x,v.prev=v.next=null,d.length--,v},c=(function(){function h(v){var d=this;o(this,h),this.length=0,this.head=null,this.tail=null,v!=null&&v.forEach(function(x){return d.push(x)})}return s(h,[{key:"size",value:function(){return this.length}},{key:"insertBefore",value:function(d,x){return l(x.prev,a(d),x,this)}},{key:"insertAfter",value:function(d,x){return l(x,a(d),x.next,this)}},{key:"insertNodeBefore",value:function(d,x){return l(x.prev,d,x,this)}},{key:"insertNodeAfter",value:function(d,x){return l(x,d,x.next,this)}},{key:"push",value:function(d){return l(this.tail,a(d),null,this)}},{key:"unshift",value:function(d){return l(null,a(d),this.head,this)}},{key:"remove",value:function(d){return u(d,this)}},{key:"pop",value:function(){return u(this.tail,this).value}},{key:"popNode",value:function(){return u(this.tail,this)}},{key:"shift",value:function(){return u(this.head,this).value}},{key:"shiftNode",value:function(){return u(this.head,this)}},{key:"get_object_at",value:function(d){if(d<=this.length()){for(var x=1,w=this.head;x<d;)w=w.next,x++;return w.value}}},{key:"set_object_at",value:function(d,x){if(d<=this.length()){for(var w=1,g=this.head;w<d;)g=g.next,w++;g.value=x}}}]),h})();r.exports=c}),(function(r,n,i){function s(o,a,l){this.x=null,this.y=null,o==null&&a==null&&l==null?(this.x=0,this.y=0):typeof o=="number"&&typeof a=="number"&&l==null?(this.x=o,this.y=a):o.constructor.name=="Point"&&a==null&&l==null&&(l=o,this.x=l.x,this.y=l.y)}s.prototype.getX=function(){return this.x},s.prototype.getY=function(){return this.y},s.prototype.getLocation=function(){return new s(this.x,this.y)},s.prototype.setLocation=function(o,a,l){o.constructor.name=="Point"&&a==null&&l==null?(l=o,this.setLocation(l.x,l.y)):typeof o=="number"&&typeof a=="number"&&l==null&&(parseInt(o)==o&&parseInt(a)==a?this.move(o,a):(this.x=Math.floor(o+.5),this.y=Math.floor(a+.5)))},s.prototype.move=function(o,a){this.x=o,this.y=a},s.prototype.translate=function(o,a){this.x+=o,this.y+=a},s.prototype.equals=function(o){if(o.constructor.name=="Point"){var a=o;return this.x==a.x&&this.y==a.y}return this==o},s.prototype.toString=function(){return new s().constructor.name+"[x="+this.x+",y="+this.y+"]"},r.exports=s}),(function(r,n,i){function s(o,a,l,u){this.x=0,this.y=0,this.width=0,this.height=0,o!=null&&a!=null&&l!=null&&u!=null&&(this.x=o,this.y=a,this.width=l,this.height=u)}s.prototype.getX=function(){return this.x},s.prototype.setX=function(o){this.x=o},s.prototype.getY=function(){return this.y},s.prototype.setY=function(o){this.y=o},s.prototype.getWidth=function(){return this.width},s.prototype.setWidth=function(o){this.width=o},s.prototype.getHeight=function(){return this.height},s.prototype.setHeight=function(o){this.height=o},s.prototype.getRight=function(){return this.x+this.width},s.prototype.getBottom=function(){return this.y+this.height},s.prototype.intersects=function(o){return!(this.getRight()<o.x||this.getBottom()<o.y||o.getRight()<this.x||o.getBottom()<this.y)},s.prototype.getCenterX=function(){return this.x+this.width/2},s.prototype.getMinX=function(){return this.getX()},s.prototype.getMaxX=function(){return this.getX()+this.width},s.prototype.getCenterY=function(){return this.y+this.height/2},s.prototype.getMinY=function(){return this.getY()},s.prototype.getMaxY=function(){return this.getY()+this.height},s.prototype.getWidthHalf=function(){return this.width/2},s.prototype.getHeightHalf=function(){return this.height/2},r.exports=s}),(function(r,n,i){var s=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(a){return typeof a}:function(a){return a&&typeof Symbol=="function"&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a};function o(){}o.lastID=0,o.createID=function(a){return o.isPrimitive(a)?a:(a.uniqueID!=null||(a.uniqueID=o.getString(),o.lastID++),a.uniqueID)},o.getString=function(a){return a==null&&(a=o.lastID),"Object#"+a},o.isPrimitive=function(a){var l=typeof a>"u"?"undefined":s(a);return a==null||l!="object"&&l!="function"},r.exports=o}),(function(r,n,i){function s(w){if(Array.isArray(w)){for(var g=0,m=Array(w.length);g<w.length;g++)m[g]=w[g];return m}else return Array.from(w)}var o=i(0),a=i(7),l=i(3),u=i(1),c=i(6),h=i(5),v=i(17),d=i(29);function x(w){d.call(this),this.layoutQuality=o.QUALITY,this.createBendsAsNeeded=o.DEFAULT_CREATE_BENDS_AS_NEEDED,this.incremental=o.DEFAULT_INCREMENTAL,this.animationOnLayout=o.DEFAULT_ANIMATION_ON_LAYOUT,this.animationDuringLayout=o.DEFAULT_ANIMATION_DURING_LAYOUT,this.animationPeriod=o.DEFAULT_ANIMATION_PERIOD,this.uniformLeafNodeSizes=o.DEFAULT_UNIFORM_LEAF_NODE_SIZES,this.edgeToDummyNodes=new Map,this.graphManager=new a(this),this.isLayoutFinished=!1,this.isSubLayout=!1,this.isRemoteUse=!1,w!=null&&(this.isRemoteUse=w)}x.RANDOM_SEED=1,x.prototype=Object.create(d.prototype),x.prototype.getGraphManager=function(){return this.graphManager},x.prototype.getAllNodes=function(){return this.graphManager.getAllNodes()},x.prototype.getAllEdges=function(){return this.graphManager.getAllEdges()},x.prototype.getAllNodesToApplyGravitation=function(){return this.graphManager.getAllNodesToApplyGravitation()},x.prototype.newGraphManager=function(){var w=new a(this);return this.graphManager=w,w},x.prototype.newGraph=function(w){return new c(null,this.graphManager,w)},x.prototype.newNode=function(w){return new l(this.graphManager,w)},x.prototype.newEdge=function(w){return new u(null,null,w)},x.prototype.checkLayoutSuccess=function(){return this.graphManager.getRoot()==null||this.graphManager.getRoot().getNodes().length==0||this.graphManager.includesInvalidEdge()},x.prototype.runLayout=function(){this.isLayoutFinished=!1,this.tilingPreLayout&&this.tilingPreLayout(),this.initParameters();var w;return this.checkLayoutSuccess()?w=!1:w=this.layout(),o.ANIMATE==="during"?!1:(w&&(this.isSubLayout||this.doPostLayout()),this.tilingPostLayout&&this.tilingPostLayout(),this.isLayoutFinished=!0,w)},x.prototype.doPostLayout=function(){this.incremental||this.transform(),this.update()},x.prototype.update2=function(){if(this.createBendsAsNeeded&&(this.createBendpointsFromDummyNodes(),this.graphManager.resetAllEdges()),!this.isRemoteUse){for(var w=this.graphManager.getAllEdges(),g=0;g<w.length;g++)w[g];for(var m=this.graphManager.getRoot().getNodes(),g=0;g<m.length;g++)m[g];this.update(this.graphManager.getRoot())}},x.prototype.update=function(w){if(w==null)this.update2();else if(w instanceof l){var g=w;if(g.getChild()!=null)for(var m=g.getChild().getNodes(),y=0;y<m.length;y++)update(m[y]);if(g.vGraphObject!=null){var b=g.vGraphObject;b.update(g)}}else if(w instanceof u){var S=w;if(S.vGraphObject!=null){var N=S.vGraphObject;N.update(S)}}else if(w instanceof c){var E=w;if(E.vGraphObject!=null){var T=E.vGraphObject;T.update(E)}}},x.prototype.initParameters=function(){this.isSubLayout||(this.layoutQuality=o.QUALITY,this.animationDuringLayout=o.DEFAULT_ANIMATION_DURING_LAYOUT,this.animationPeriod=o.DEFAULT_ANIMATION_PERIOD,this.animationOnLayout=o.DEFAULT_ANIMATION_ON_LAYOUT,this.incremental=o.DEFAULT_INCREMENTAL,this.createBendsAsNeeded=o.DEFAULT_CREATE_BENDS_AS_NEEDED,this.uniformLeafNodeSizes=o.DEFAULT_UNIFORM_LEAF_NODE_SIZES),this.animationDuringLayout&&(this.animationOnLayout=!1)},x.prototype.transform=function(w){if(w==null)this.transform(new h(0,0));else{var g=new v,m=this.graphManager.getRoot().updateLeftTop();if(m!=null){g.setWorldOrgX(w.x),g.setWorldOrgY(w.y),g.setDeviceOrgX(m.x),g.setDeviceOrgY(m.y);for(var y=this.getAllNodes(),b,S=0;S<y.length;S++)b=y[S],b.transform(g)}}},x.prototype.positionNodesRandomly=function(w){if(w==null)this.positionNodesRandomly(this.getGraphManager().getRoot()),this.getGraphManager().getRoot().updateBounds(!0);else for(var g,m,y=w.getNodes(),b=0;b<y.length;b++)g=y[b],m=g.getChild(),m==null||m.getNodes().length==0?g.scatter():(this.positionNodesRandomly(m),g.updateBounds())},x.prototype.getFlatForest=function(){for(var w=[],g=!0,m=this.graphManager.getRoot().getNodes(),y=!0,b=0;b<m.length;b++)m[b].getChild()!=null&&(y=!1);if(!y)return w;var S=new Set,N=[],E=new Map,T=[];for(T=T.concat(m);T.length>0&&g;){for(N.push(T[0]);N.length>0&&g;){var k=N[0];N.splice(0,1),S.add(k);for(var L=k.getEdges(),b=0;b<L.length;b++){var A=L[b].getOtherEnd(k);if(E.get(k)!=A)if(!S.has(A))N.push(A),E.set(A,k);else{g=!1;break}}}if(!g)w=[];else{var I=[].concat(s(S));w.push(I);for(var b=0;b<I.length;b++){var M=I[b],B=T.indexOf(M);B>-1&&T.splice(B,1)}S=new Set,E=new Map}}return w},x.prototype.createDummyNodesForBendpoints=function(w){for(var g=[],m=w.source,y=this.graphManager.calcLowestCommonAncestor(w.source,w.target),b=0;b<w.bendpoints.length;b++){var S=this.newNode(null);S.setRect(new Point(0,0),new Dimension(1,1)),y.add(S);var N=this.newEdge(null);this.graphManager.add(N,m,S),g.add(S),m=S}var N=this.newEdge(null);return this.graphManager.add(N,m,w.target),this.edgeToDummyNodes.set(w,g),w.isInterGraph()?this.graphManager.remove(w):y.remove(w),g},x.prototype.createBendpointsFromDummyNodes=function(){var w=[];w=w.concat(this.graphManager.getAllEdges()),w=[].concat(s(this.edgeToDummyNodes.keys())).concat(w);for(var g=0;g<w.length;g++){var m=w[g];if(m.bendpoints.length>0){for(var y=this.edgeToDummyNodes.get(m),b=0;b<y.length;b++){var S=y[b],N=new h(S.getCenterX(),S.getCenterY()),E=m.bendpoints.get(b);E.x=N.x,E.y=N.y,S.getOwner().remove(S)}this.graphManager.add(m,m.source,m.target)}}},x.transform=function(w,g,m,y){if(m!=null&&y!=null){var b=g;if(w<=50){var S=g/m;b-=(g-S)/50*(50-w)}else{var N=g*y;b+=(N-g)/50*(w-50)}return b}else{var E,T;return w<=50?(E=9*g/500,T=g/10):(E=9*g/50,T=-8*g),E*w+T}},x.findCenterOfTree=function(w){var g=[];g=g.concat(w);var m=[],y=new Map,b=!1,S=null;(g.length==1||g.length==2)&&(b=!0,S=g[0]);for(var N=0;N<g.length;N++){var E=g[N],T=E.getNeighborsList().size;y.set(E,E.getNeighborsList().size),T==1&&m.push(E)}var k=[];for(k=k.concat(m);!b;){var L=[];L=L.concat(k),k=[];for(var N=0;N<g.length;N++){var E=g[N],A=g.indexOf(E);A>=0&&g.splice(A,1);var I=E.getNeighborsList();I.forEach(function(D){if(m.indexOf(D)<0){var H=y.get(D),U=H-1;U==1&&k.push(D),y.set(D,U)}})}m=m.concat(k),(g.length==1||g.length==2)&&(b=!0,S=g[0])}return S},x.prototype.setGraphManager=function(w){this.graphManager=w},r.exports=x}),(function(r,n,i){function s(){}s.seed=1,s.x=0,s.nextDouble=function(){return s.x=Math.sin(s.seed++)*1e4,s.x-Math.floor(s.x)},r.exports=s}),(function(r,n,i){var s=i(5);function o(a,l){this.lworldOrgX=0,this.lworldOrgY=0,this.ldeviceOrgX=0,this.ldeviceOrgY=0,this.lworldExtX=1,this.lworldExtY=1,this.ldeviceExtX=1,this.ldeviceExtY=1}o.prototype.getWorldOrgX=function(){return this.lworldOrgX},o.prototype.setWorldOrgX=function(a){this.lworldOrgX=a},o.prototype.getWorldOrgY=function(){return this.lworldOrgY},o.prototype.setWorldOrgY=function(a){this.lworldOrgY=a},o.prototype.getWorldExtX=function(){return this.lworldExtX},o.prototype.setWorldExtX=function(a){this.lworldExtX=a},o.prototype.getWorldExtY=function(){return this.lworldExtY},o.prototype.setWorldExtY=function(a){this.lworldExtY=a},o.prototype.getDeviceOrgX=function(){return this.ldeviceOrgX},o.prototype.setDeviceOrgX=function(a){this.ldeviceOrgX=a},o.prototype.getDeviceOrgY=function(){return this.ldeviceOrgY},o.prototype.setDeviceOrgY=function(a){this.ldeviceOrgY=a},o.prototype.getDeviceExtX=function(){return this.ldeviceExtX},o.prototype.setDeviceExtX=function(a){this.ldeviceExtX=a},o.prototype.getDeviceExtY=function(){return this.ldeviceExtY},o.prototype.setDeviceExtY=function(a){this.ldeviceExtY=a},o.prototype.transformX=function(a){var l=0,u=this.lworldExtX;return u!=0&&(l=this.ldeviceOrgX+(a-this.lworldOrgX)*this.ldeviceExtX/u),l},o.prototype.transformY=function(a){var l=0,u=this.lworldExtY;return u!=0&&(l=this.ldeviceOrgY+(a-this.lworldOrgY)*this.ldeviceExtY/u),l},o.prototype.inverseTransformX=function(a){var l=0,u=this.ldeviceExtX;return u!=0&&(l=this.lworldOrgX+(a-this.ldeviceOrgX)*this.lworldExtX/u),l},o.prototype.inverseTransformY=function(a){var l=0,u=this.ldeviceExtY;return u!=0&&(l=this.lworldOrgY+(a-this.ldeviceOrgY)*this.lworldExtY/u),l},o.prototype.inverseTransformPoint=function(a){var l=new s(this.inverseTransformX(a.x),this.inverseTransformY(a.y));return l},r.exports=o}),(function(r,n,i){function s(d){if(Array.isArray(d)){for(var x=0,w=Array(d.length);x<d.length;x++)w[x]=d[x];return w}else return Array.from(d)}var o=i(15),a=i(4),l=i(0),u=i(8),c=i(9);function h(){o.call(this),this.useSmartIdealEdgeLengthCalculation=a.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.gravityConstant=a.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=a.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=a.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=a.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.displacementThresholdPerNode=3*a.DEFAULT_EDGE_LENGTH/100,this.coolingFactor=a.DEFAULT_COOLING_FACTOR_INCREMENTAL,this.initialCoolingFactor=a.DEFAULT_COOLING_FACTOR_INCREMENTAL,this.totalDisplacement=0,this.oldTotalDisplacement=0,this.maxIterations=a.MAX_ITERATIONS}h.prototype=Object.create(o.prototype);for(var v in o)h[v]=o[v];h.prototype.initParameters=function(){o.prototype.initParameters.call(this,arguments),this.totalIterations=0,this.notAnimatedIterations=0,this.useFRGridVariant=a.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION,this.grid=[]},h.prototype.calcIdealEdgeLengths=function(){for(var d,x,w,g,m,y,b,S=this.getGraphManager().getAllEdges(),N=0;N<S.length;N++)d=S[N],x=d.idealLength,d.isInterGraph&&(g=d.getSource(),m=d.getTarget(),y=d.getSourceInLca().getEstimatedSize(),b=d.getTargetInLca().getEstimatedSize(),this.useSmartIdealEdgeLengthCalculation&&(d.idealLength+=y+b-2*l.SIMPLE_NODE_SIZE),w=d.getLca().getInclusionTreeDepth(),d.idealLength+=x*a.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR*(g.getInclusionTreeDepth()+m.getInclusionTreeDepth()-2*w))},h.prototype.initSpringEmbedder=function(){var d=this.getAllNodes().length;this.incremental?(d>a.ADAPTATION_LOWER_NODE_LIMIT&&(this.coolingFactor=Math.max(this.coolingFactor*a.COOLING_ADAPTATION_FACTOR,this.coolingFactor-(d-a.ADAPTATION_LOWER_NODE_LIMIT)/(a.ADAPTATION_UPPER_NODE_LIMIT-a.ADAPTATION_LOWER_NODE_LIMIT)*this.coolingFactor*(1-a.COOLING_ADAPTATION_FACTOR))),this.maxNodeDisplacement=a.MAX_NODE_DISPLACEMENT_INCREMENTAL):(d>a.ADAPTATION_LOWER_NODE_LIMIT?this.coolingFactor=Math.max(a.COOLING_ADAPTATION_FACTOR,1-(d-a.ADAPTATION_LOWER_NODE_LIMIT)/(a.ADAPTATION_UPPER_NODE_LIMIT-a.ADAPTATION_LOWER_NODE_LIMIT)*(1-a.COOLING_ADAPTATION_FACTOR)):this.coolingFactor=1,this.initialCoolingFactor=this.coolingFactor,this.maxNodeDisplacement=a.MAX_NODE_DISPLACEMENT),this.maxIterations=Math.max(this.getAllNodes().length*5,this.maxIterations),this.displacementThresholdPerNode=3*a.DEFAULT_EDGE_LENGTH/100,this.totalDisplacementThreshold=this.displacementThresholdPerNode*this.getAllNodes().length,this.repulsionRange=this.calcRepulsionRange()},h.prototype.calcSpringForces=function(){for(var d=this.getAllEdges(),x,w=0;w<d.length;w++)x=d[w],this.calcSpringForce(x,x.idealLength)},h.prototype.calcRepulsionForces=function(){var d=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,x=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,w,g,m,y,b=this.getAllNodes(),S;if(this.useFRGridVariant)for(this.totalIterations%a.GRID_CALCULATION_CHECK_PERIOD==1&&d&&this.updateGrid(),S=new Set,w=0;w<b.length;w++)m=b[w],this.calculateRepulsionForceOfANode(m,S,d,x),S.add(m);else for(w=0;w<b.length;w++)for(m=b[w],g=w+1;g<b.length;g++)y=b[g],m.getOwner()==y.getOwner()&&this.calcRepulsionForce(m,y)},h.prototype.calcGravitationalForces=function(){for(var d,x=this.getAllNodesToApplyGravitation(),w=0;w<x.length;w++)d=x[w],this.calcGravitationalForce(d)},h.prototype.moveNodes=function(){for(var d=this.getAllNodes(),x,w=0;w<d.length;w++)x=d[w],x.move()},h.prototype.calcSpringForce=function(d,x){var w=d.getSource(),g=d.getTarget(),m,y,b,S;if(this.uniformLeafNodeSizes&&w.getChild()==null&&g.getChild()==null)d.updateLengthSimple();else if(d.updateLength(),d.isOverlapingSourceAndTarget)return;m=d.getLength(),m!=0&&(y=d.edgeElasticity*(m-x),b=y*(d.lengthX/m),S=y*(d.lengthY/m),w.springForceX+=b,w.springForceY+=S,g.springForceX-=b,g.springForceY-=S)},h.prototype.calcRepulsionForce=function(d,x){var w=d.getRect(),g=x.getRect(),m=new Array(2),y=new Array(4),b,S,N,E,T,k,L;if(w.intersects(g)){u.calcSeparationAmount(w,g,m,a.DEFAULT_EDGE_LENGTH/2),k=2*m[0],L=2*m[1];var A=d.noOfChildren*x.noOfChildren/(d.noOfChildren+x.noOfChildren);d.repulsionForceX-=A*k,d.repulsionForceY-=A*L,x.repulsionForceX+=A*k,x.repulsionForceY+=A*L}else this.uniformLeafNodeSizes&&d.getChild()==null&&x.getChild()==null?(b=g.getCenterX()-w.getCenterX(),S=g.getCenterY()-w.getCenterY()):(u.getIntersection(w,g,y),b=y[2]-y[0],S=y[3]-y[1]),Math.abs(b)<a.MIN_REPULSION_DIST&&(b=c.sign(b)*a.MIN_REPULSION_DIST),Math.abs(S)<a.MIN_REPULSION_DIST&&(S=c.sign(S)*a.MIN_REPULSION_DIST),N=b*b+S*S,E=Math.sqrt(N),T=(d.nodeRepulsion/2+x.nodeRepulsion/2)*d.noOfChildren*x.noOfChildren/N,k=T*b/E,L=T*S/E,d.repulsionForceX-=k,d.repulsionForceY-=L,x.repulsionForceX+=k,x.repulsionForceY+=L},h.prototype.calcGravitationalForce=function(d){var x,w,g,m,y,b,S,N;x=d.getOwner(),w=(x.getRight()+x.getLeft())/2,g=(x.getTop()+x.getBottom())/2,m=d.getCenterX()-w,y=d.getCenterY()-g,b=Math.abs(m)+d.getWidth()/2,S=Math.abs(y)+d.getHeight()/2,d.getOwner()==this.graphManager.getRoot()?(N=x.getEstimatedSize()*this.gravityRangeFactor,(b>N||S>N)&&(d.gravitationForceX=-this.gravityConstant*m,d.gravitationForceY=-this.gravityConstant*y)):(N=x.getEstimatedSize()*this.compoundGravityRangeFactor,(b>N||S>N)&&(d.gravitationForceX=-this.gravityConstant*m*this.compoundGravityConstant,d.gravitationForceY=-this.gravityConstant*y*this.compoundGravityConstant))},h.prototype.isConverged=function(){var d,x=!1;return this.totalIterations>this.maxIterations/3&&(x=Math.abs(this.totalDisplacement-this.oldTotalDisplacement)<2),d=this.totalDisplacement<this.totalDisplacementThreshold,this.oldTotalDisplacement=this.totalDisplacement,d||x},h.prototype.animate=function(){this.animationDuringLayout&&!this.isSubLayout&&(this.notAnimatedIterations==this.animationPeriod?(this.update(),this.notAnimatedIterations=0):this.notAnimatedIterations++)},h.prototype.calcNoOfChildrenForAllNodes=function(){for(var d,x=this.graphManager.getAllNodes(),w=0;w<x.length;w++)d=x[w],d.noOfChildren=d.getNoOfChildren()},h.prototype.calcGrid=function(d){var x=0,w=0;x=parseInt(Math.ceil((d.getRight()-d.getLeft())/this.repulsionRange)),w=parseInt(Math.ceil((d.getBottom()-d.getTop())/this.repulsionRange));for(var g=new Array(x),m=0;m<x;m++)g[m]=new Array(w);for(var m=0;m<x;m++)for(var y=0;y<w;y++)g[m][y]=new Array;return g},h.prototype.addNodeToGrid=function(d,x,w){var g=0,m=0,y=0,b=0;g=parseInt(Math.floor((d.getRect().x-x)/this.repulsionRange)),m=parseInt(Math.floor((d.getRect().width+d.getRect().x-x)/this.repulsionRange)),y=parseInt(Math.floor((d.getRect().y-w)/this.repulsionRange)),b=parseInt(Math.floor((d.getRect().height+d.getRect().y-w)/this.repulsionRange));for(var S=g;S<=m;S++)for(var N=y;N<=b;N++)this.grid[S][N].push(d),d.setGridCoordinates(g,m,y,b)},h.prototype.updateGrid=function(){var d,x,w=this.getAllNodes();for(this.grid=this.calcGrid(this.graphManager.getRoot()),d=0;d<w.length;d++)x=w[d],this.addNodeToGrid(x,this.graphManager.getRoot().getLeft(),this.graphManager.getRoot().getTop())},h.prototype.calculateRepulsionForceOfANode=function(d,x,w,g){if(this.totalIterations%a.GRID_CALCULATION_CHECK_PERIOD==1&&w||g){var m=new Set;d.surrounding=new Array;for(var y,b=this.grid,S=d.startX-1;S<d.finishX+2;S++)for(var N=d.startY-1;N<d.finishY+2;N++)if(!(S<0||N<0||S>=b.length||N>=b[0].length)){for(var E=0;E<b[S][N].length;E++)if(y=b[S][N][E],!(d.getOwner()!=y.getOwner()||d==y)&&!x.has(y)&&!m.has(y)){var T=Math.abs(d.getCenterX()-y.getCenterX())-(d.getWidth()/2+y.getWidth()/2),k=Math.abs(d.getCenterY()-y.getCenterY())-(d.getHeight()/2+y.getHeight()/2);T<=this.repulsionRange&&k<=this.repulsionRange&&m.add(y)}}d.surrounding=[].concat(s(m))}for(S=0;S<d.surrounding.length;S++)this.calcRepulsionForce(d,d.surrounding[S])},h.prototype.calcRepulsionRange=function(){return 0},r.exports=h}),(function(r,n,i){var s=i(1),o=i(4);function a(u,c,h){s.call(this,u,c,h),this.idealLength=o.DEFAULT_EDGE_LENGTH,this.edgeElasticity=o.DEFAULT_SPRING_STRENGTH}a.prototype=Object.create(s.prototype);for(var l in s)a[l]=s[l];r.exports=a}),(function(r,n,i){var s=i(3),o=i(4);function a(u,c,h,v){s.call(this,u,c,h,v),this.nodeRepulsion=o.DEFAULT_REPULSION_STRENGTH,this.springForceX=0,this.springForceY=0,this.repulsionForceX=0,this.repulsionForceY=0,this.gravitationForceX=0,this.gravitationForceY=0,this.displacementX=0,this.displacementY=0,this.startX=0,this.finishX=0,this.startY=0,this.finishY=0,this.surrounding=[]}a.prototype=Object.create(s.prototype);for(var l in s)a[l]=s[l];a.prototype.setGridCoordinates=function(u,c,h,v){this.startX=u,this.finishX=c,this.startY=h,this.finishY=v},r.exports=a}),(function(r,n,i){function s(o,a){this.width=0,this.height=0,o!==null&&a!==null&&(this.height=a,this.width=o)}s.prototype.getWidth=function(){return this.width},s.prototype.setWidth=function(o){this.width=o},s.prototype.getHeight=function(){return this.height},s.prototype.setHeight=function(o){this.height=o},r.exports=s}),(function(r,n,i){var s=i(14);function o(){this.map={},this.keys=[]}o.prototype.put=function(a,l){var u=s.createID(a);this.contains(u)||(this.map[u]=l,this.keys.push(a))},o.prototype.contains=function(a){return s.createID(a),this.map[a]!=null},o.prototype.get=function(a){var l=s.createID(a);return this.map[l]},o.prototype.keySet=function(){return this.keys},r.exports=o}),(function(r,n,i){var s=i(14);function o(){this.set={}}o.prototype.add=function(a){var l=s.createID(a);this.contains(l)||(this.set[l]=a)},o.prototype.remove=function(a){delete this.set[s.createID(a)]},o.prototype.clear=function(){this.set={}},o.prototype.contains=function(a){return this.set[s.createID(a)]==a},o.prototype.isEmpty=function(){return this.size()===0},o.prototype.size=function(){return Object.keys(this.set).length},o.prototype.addAllTo=function(a){for(var l=Object.keys(this.set),u=l.length,c=0;c<u;c++)a.push(this.set[l[c]])},o.prototype.size=function(){return Object.keys(this.set).length},o.prototype.addAll=function(a){for(var l=a.length,u=0;u<l;u++){var c=a[u];this.add(c)}},r.exports=o}),(function(r,n,i){function s(){}s.multMat=function(o,a){for(var l=[],u=0;u<o.length;u++){l[u]=[];for(var c=0;c<a[0].length;c++){l[u][c]=0;for(var h=0;h<o[0].length;h++)l[u][c]+=o[u][h]*a[h][c]}}return l},s.transpose=function(o){for(var a=[],l=0;l<o[0].length;l++){a[l]=[];for(var u=0;u<o.length;u++)a[l][u]=o[u][l]}return a},s.multCons=function(o,a){for(var l=[],u=0;u<o.length;u++)l[u]=o[u]*a;return l},s.minusOp=function(o,a){for(var l=[],u=0;u<o.length;u++)l[u]=o[u]-a[u];return l},s.dotProduct=function(o,a){for(var l=0,u=0;u<o.length;u++)l+=o[u]*a[u];return l},s.mag=function(o){return Math.sqrt(this.dotProduct(o,o))},s.normalize=function(o){for(var a=[],l=this.mag(o),u=0;u<o.length;u++)a[u]=o[u]/l;return a},s.multGamma=function(o){for(var a=[],l=0,u=0;u<o.length;u++)l+=o[u];l*=-1/o.length;for(var c=0;c<o.length;c++)a[c]=l+o[c];return a},s.multL=function(o,a,l){for(var u=[],c=[],h=[],v=0;v<a[0].length;v++){for(var d=0,x=0;x<a.length;x++)d+=-.5*a[x][v]*o[x];c[v]=d}for(var w=0;w<l.length;w++){for(var g=0,m=0;m<l.length;m++)g+=l[w][m]*c[m];h[w]=g}for(var y=0;y<a.length;y++){for(var b=0,S=0;S<a[0].length;S++)b+=a[y][S]*h[S];u[y]=b}return u},r.exports=s}),(function(r,n,i){var s=(function(){function u(c,h){for(var v=0;v<h.length;v++){var d=h[v];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(c,d.key,d)}}return function(c,h,v){return h&&u(c.prototype,h),v&&u(c,v),c}})();function o(u,c){if(!(u instanceof c))throw new TypeError("Cannot call a class as a function")}var a=i(11),l=(function(){function u(c,h){o(this,u),(h!==null||h!==void 0)&&(this.compareFunction=this._defaultCompareFunction);var v=void 0;c instanceof a?v=c.size():v=c.length,this._quicksort(c,0,v-1)}return s(u,[{key:"_quicksort",value:function(h,v,d){if(v<d){var x=this._partition(h,v,d);this._quicksort(h,v,x),this._quicksort(h,x+1,d)}}},{key:"_partition",value:function(h,v,d){for(var x=this._get(h,v),w=v,g=d;;){for(;this.compareFunction(x,this._get(h,g));)g--;for(;this.compareFunction(this._get(h,w),x);)w++;if(w<g)this._swap(h,w,g),w++,g--;else return g}}},{key:"_get",value:function(h,v){return h instanceof a?h.get_object_at(v):h[v]}},{key:"_set",value:function(h,v,d){h instanceof a?h.set_object_at(v,d):h[v]=d}},{key:"_swap",value:function(h,v,d){var x=this._get(h,v);this._set(h,v,this._get(h,d)),this._set(h,d,x)}},{key:"_defaultCompareFunction",value:function(h,v){return v>h}}]),u})();r.exports=l}),(function(r,n,i){function s(){}s.svd=function(o){this.U=null,this.V=null,this.s=null,this.m=0,this.n=0,this.m=o.length,this.n=o[0].length;var a=Math.min(this.m,this.n);this.s=(function(lt){for(var gt=[];lt-- >0;)gt.push(0);return gt})(Math.min(this.m+1,this.n)),this.U=(function(lt){var gt=function xt(Rt){if(Rt.length==0)return 0;for(var Ot=[],Tt=0;Tt<Rt[0];Tt++)Ot.push(xt(Rt.slice(1)));return Ot};return gt(lt)})([this.m,a]),this.V=(function(lt){var gt=function xt(Rt){if(Rt.length==0)return 0;for(var Ot=[],Tt=0;Tt<Rt[0];Tt++)Ot.push(xt(Rt.slice(1)));return Ot};return gt(lt)})([this.n,this.n]);for(var l=(function(lt){for(var gt=[];lt-- >0;)gt.push(0);return gt})(this.n),u=(function(lt){for(var gt=[];lt-- >0;)gt.push(0);return gt})(this.m),c=!0,h=Math.min(this.m-1,this.n),v=Math.max(0,Math.min(this.n-2,this.m)),d=0;d<Math.max(h,v);d++){if(d<h){this.s[d]=0;for(var x=d;x<this.m;x++)this.s[d]=s.hypot(this.s[d],o[x][d]);if(this.s[d]!==0){o[d][d]<0&&(this.s[d]=-this.s[d]);for(var w=d;w<this.m;w++)o[w][d]/=this.s[d];o[d][d]+=1}this.s[d]=-this.s[d]}for(var g=d+1;g<this.n;g++){if((function(lt,gt){return lt&&gt})(d<h,this.s[d]!==0)){for(var m=0,y=d;y<this.m;y++)m+=o[y][d]*o[y][g];m=-m/o[d][d];for(var b=d;b<this.m;b++)o[b][g]+=m*o[b][d]}l[g]=o[d][g]}if((function(lt,gt){return gt})(c,d<h))for(var S=d;S<this.m;S++)this.U[S][d]=o[S][d];if(d<v){l[d]=0;for(var N=d+1;N<this.n;N++)l[d]=s.hypot(l[d],l[N]);if(l[d]!==0){l[d+1]<0&&(l[d]=-l[d]);for(var E=d+1;E<this.n;E++)l[E]/=l[d];l[d+1]+=1}if(l[d]=-l[d],(function(lt,gt){return lt&&gt})(d+1<this.m,l[d]!==0)){for(var T=d+1;T<this.m;T++)u[T]=0;for(var k=d+1;k<this.n;k++)for(var L=d+1;L<this.m;L++)u[L]+=l[k]*o[L][k];for(var A=d+1;A<this.n;A++)for(var I=-l[A]/l[d+1],M=d+1;M<this.m;M++)o[M][A]+=I*u[M]}for(var B=d+1;B<this.n;B++)this.V[B][d]=l[B]}}var D=Math.min(this.n,this.m+1);h<this.n&&(this.s[h]=o[h][h]),this.m<D&&(this.s[D-1]=0),v+1<D&&(l[v]=o[v][D-1]),l[D-1]=0;{for(var H=h;H<a;H++){for(var U=0;U<this.m;U++)this.U[U][H]=0;this.U[H][H]=1}for(var z=h-1;z>=0;z--)if(this.s[z]!==0){for(var W=z+1;W<a;W++){for(var F=0,P=z;P<this.m;P++)F+=this.U[P][z]*this.U[P][W];F=-F/this.U[z][z];for(var j=z;j<this.m;j++)this.U[j][W]+=F*this.U[j][z]}for(var G=z;G<this.m;G++)this.U[G][z]=-this.U[G][z];this.U[z][z]=1+this.U[z][z];for(var $=0;$<z-1;$++)this.U[$][z]=0}else{for(var ee=0;ee<this.m;ee++)this.U[ee][z]=0;this.U[z][z]=1}}for(var ae=this.n-1;ae>=0;ae--){if((function(lt,gt){return lt&&gt})(ae<v,l[ae]!==0))for(var ie=ae+1;ie<a;ie++){for(var K=0,q=ae+1;q<this.n;q++)K+=this.V[q][ae]*this.V[q][ie];K=-K/this.V[ae+1][ae];for(var Y=ae+1;Y<this.n;Y++)this.V[Y][ie]+=K*this.V[Y][ae]}for(var X=0;X<this.n;X++)this.V[X][ae]=0;this.V[ae][ae]=1}for(var J=D-1,re=Math.pow(2,-52),ce=Math.pow(2,-966);D>0;){var de=void 0,Re=void 0;for(de=D-2;de>=-1&&de!==-1;de--)if(Math.abs(l[de])<=ce+re*(Math.abs(this.s[de])+Math.abs(this.s[de+1]))){l[de]=0;break}if(de===D-2)Re=4;else{var Pe=void 0;for(Pe=D-1;Pe>=de&&Pe!==de;Pe--){var _e=(Pe!==D?Math.abs(l[Pe]):0)+(Pe!==de+1?Math.abs(l[Pe-1]):0);if(Math.abs(this.s[Pe])<=ce+re*_e){this.s[Pe]=0;break}}Pe===de?Re=3:Pe===D-1?Re=1:(Re=2,de=Pe)}switch(de++,Re){case 1:{var ke=l[D-2];l[D-2]=0;for(var Le=D-2;Le>=de;Le--){var Ee=s.hypot(this.s[Le],ke),Ie=this.s[Le]/Ee,Oe=ke/Ee;this.s[Le]=Ee,Le!==de&&(ke=-Oe*l[Le-1],l[Le-1]=Ie*l[Le-1]);for(var De=0;De<this.n;De++)Ee=Ie*this.V[De][Le]+Oe*this.V[De][D-1],this.V[De][D-1]=-Oe*this.V[De][Le]+Ie*this.V[De][D-1],this.V[De][Le]=Ee}}break;case 2:{var We=l[de-1];l[de-1]=0;for(var Ye=de;Ye<D;Ye++){var ge=s.hypot(this.s[Ye],We),Ce=this.s[Ye]/ge,Ae=We/ge;this.s[Ye]=ge,We=-Ae*l[Ye],l[Ye]=Ce*l[Ye];for(var Fe=0;Fe<this.m;Fe++)ge=Ce*this.U[Fe][Ye]+Ae*this.U[Fe][de-1],this.U[Fe][de-1]=-Ae*this.U[Fe][Ye]+Ce*this.U[Fe][de-1],this.U[Fe][Ye]=ge}}break;case 3:{var me=Math.max(Math.max(Math.max(Math.max(Math.abs(this.s[D-1]),Math.abs(this.s[D-2])),Math.abs(l[D-2])),Math.abs(this.s[de])),Math.abs(l[de])),Z=this.s[D-1]/me,te=this.s[D-2]/me,oe=l[D-2]/me,ue=this.s[de]/me,se=l[de]/me,he=((te+Z)*(te-Z)+oe*oe)/2,pe=Z*oe*(Z*oe),be=0;(function(lt,gt){return lt||gt})(he!==0,pe!==0)&&(be=Math.sqrt(he*he+pe),he<0&&(be=-be),be=pe/(he+be));for(var Se=(ue+Z)*(ue-Z)+be,Te=ue*se,Ne=de;Ne<D-1;Ne++){var He=s.hypot(Se,Te),ze=Se/He,Ge=Te/He;Ne!==de&&(l[Ne-1]=He),Se=ze*this.s[Ne]+Ge*l[Ne],l[Ne]=ze*l[Ne]-Ge*this.s[Ne],Te=Ge*this.s[Ne+1],this.s[Ne+1]=ze*this.s[Ne+1];for(var st=0;st<this.n;st++)He=ze*this.V[st][Ne]+Ge*this.V[st][Ne+1],this.V[st][Ne+1]=-Ge*this.V[st][Ne]+ze*this.V[st][Ne+1],this.V[st][Ne]=He;if(He=s.hypot(Se,Te),ze=Se/He,Ge=Te/He,this.s[Ne]=He,Se=ze*l[Ne]+Ge*this.s[Ne+1],this.s[Ne+1]=-Ge*l[Ne]+ze*this.s[Ne+1],Te=Ge*l[Ne+1],l[Ne+1]=ze*l[Ne+1],Ne<this.m-1)for(var Je=0;Je<this.m;Je++)He=ze*this.U[Je][Ne]+Ge*this.U[Je][Ne+1],this.U[Je][Ne+1]=-Ge*this.U[Je][Ne]+ze*this.U[Je][Ne+1],this.U[Je][Ne]=He}l[D-2]=Se}break;case 4:{if(this.s[de]<=0){this.s[de]=this.s[de]<0?-this.s[de]:0;for(var qe=0;qe<=J;qe++)this.V[qe][de]=-this.V[qe][de]}for(;de<J&&!(this.s[de]>=this.s[de+1]);){var vt=this.s[de];if(this.s[de]=this.s[de+1],this.s[de+1]=vt,de<this.n-1)for(var Ze=0;Ze<this.n;Ze++)vt=this.V[Ze][de+1],this.V[Ze][de+1]=this.V[Ze][de],this.V[Ze][de]=vt;if(de<this.m-1)for(var Qe=0;Qe<this.m;Qe++)vt=this.U[Qe][de+1],this.U[Qe][de+1]=this.U[Qe][de],this.U[Qe][de]=vt;de++}D--}break}}var wt={U:this.U,V:this.V,S:this.s};return wt},s.hypot=function(o,a){var l=void 0;return Math.abs(o)>Math.abs(a)?(l=a/o,l=Math.abs(o)*Math.sqrt(1+l*l)):a!=0?(l=o/a,l=Math.abs(a)*Math.sqrt(1+l*l)):l=0,l},r.exports=s}),(function(r,n,i){var s=(function(){function l(u,c){for(var h=0;h<c.length;h++){var v=c[h];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(u,v.key,v)}}return function(u,c,h){return c&&l(u.prototype,c),h&&l(u,h),u}})();function o(l,u){if(!(l instanceof u))throw new TypeError("Cannot call a class as a function")}var a=(function(){function l(u,c){var h=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,v=arguments.length>3&&arguments[3]!==void 0?arguments[3]:-1,d=arguments.length>4&&arguments[4]!==void 0?arguments[4]:-1;o(this,l),this.sequence1=u,this.sequence2=c,this.match_score=h,this.mismatch_penalty=v,this.gap_penalty=d,this.iMax=u.length+1,this.jMax=c.length+1,this.grid=new Array(this.iMax);for(var x=0;x<this.iMax;x++){this.grid[x]=new Array(this.jMax);for(var w=0;w<this.jMax;w++)this.grid[x][w]=0}this.tracebackGrid=new Array(this.iMax);for(var g=0;g<this.iMax;g++){this.tracebackGrid[g]=new Array(this.jMax);for(var m=0;m<this.jMax;m++)this.tracebackGrid[g][m]=[null,null,null]}this.alignments=[],this.score=-1,this.computeGrids()}return s(l,[{key:"getScore",value:function(){return this.score}},{key:"getAlignments",value:function(){return this.alignments}},{key:"computeGrids",value:function(){for(var c=1;c<this.jMax;c++)this.grid[0][c]=this.grid[0][c-1]+this.gap_penalty,this.tracebackGrid[0][c]=[!1,!1,!0];for(var h=1;h<this.iMax;h++)this.grid[h][0]=this.grid[h-1][0]+this.gap_penalty,this.tracebackGrid[h][0]=[!1,!0,!1];for(var v=1;v<this.iMax;v++)for(var d=1;d<this.jMax;d++){var x=void 0;this.sequence1[v-1]===this.sequence2[d-1]?x=this.grid[v-1][d-1]+this.match_score:x=this.grid[v-1][d-1]+this.mismatch_penalty;var w=this.grid[v-1][d]+this.gap_penalty,g=this.grid[v][d-1]+this.gap_penalty,m=[x,w,g],y=this.arrayAllMaxIndexes(m);this.grid[v][d]=m[y[0]],this.tracebackGrid[v][d]=[y.includes(0),y.includes(1),y.includes(2)]}this.score=this.grid[this.iMax-1][this.jMax-1]}},{key:"alignmentTraceback",value:function(){var c=[];for(c.push({pos:[this.sequence1.length,this.sequence2.length],seq1:"",seq2:""});c[0];){var h=c[0],v=this.tracebackGrid[h.pos[0]][h.pos[1]];v[0]&&c.push({pos:[h.pos[0]-1,h.pos[1]-1],seq1:this.sequence1[h.pos[0]-1]+h.seq1,seq2:this.sequence2[h.pos[1]-1]+h.seq2}),v[1]&&c.push({pos:[h.pos[0]-1,h.pos[1]],seq1:this.sequence1[h.pos[0]-1]+h.seq1,seq2:"-"+h.seq2}),v[2]&&c.push({pos:[h.pos[0],h.pos[1]-1],seq1:"-"+h.seq1,seq2:this.sequence2[h.pos[1]-1]+h.seq2}),h.pos[0]===0&&h.pos[1]===0&&this.alignments.push({sequence1:h.seq1,sequence2:h.seq2}),c.shift()}return this.alignments}},{key:"getAllIndexes",value:function(c,h){for(var v=[],d=-1;(d=c.indexOf(h,d+1))!==-1;)v.push(d);return v}},{key:"arrayAllMaxIndexes",value:function(c){return this.getAllIndexes(c,Math.max.apply(null,c))}}]),l})();r.exports=a}),(function(r,n,i){var s=function(){};s.FDLayout=i(18),s.FDLayoutConstants=i(4),s.FDLayoutEdge=i(19),s.FDLayoutNode=i(20),s.DimensionD=i(21),s.HashMap=i(22),s.HashSet=i(23),s.IGeometry=i(8),s.IMath=i(9),s.Integer=i(10),s.Point=i(12),s.PointD=i(5),s.RandomSeed=i(16),s.RectangleD=i(13),s.Transform=i(17),s.UniqueIDGeneretor=i(14),s.Quicksort=i(25),s.LinkedList=i(11),s.LGraphObject=i(2),s.LGraph=i(6),s.LEdge=i(1),s.LGraphManager=i(7),s.LNode=i(3),s.Layout=i(15),s.LayoutConstants=i(0),s.NeedlemanWunsch=i(27),s.Matrix=i(24),s.SVD=i(26),r.exports=s}),(function(r,n,i){function s(){this.listeners=[]}var o=s.prototype;o.addListener=function(a,l){this.listeners.push({event:a,callback:l})},o.removeListener=function(a,l){for(var u=this.listeners.length;u>=0;u--){var c=this.listeners[u];c.event===a&&c.callback===l&&this.listeners.splice(u,1)}},o.emit=function(a,l){for(var u=0;u<this.listeners.length;u++){var c=this.listeners[u];a===c.event&&c.callback(l)}},r.exports=s})])})})(Sc)),Sc.exports}var QD=_c.exports,Y1;function ZD(){return Y1||(Y1=1,(function(t,e){(function(n,i){t.exports=i(KD())})(QD,function(r){return(()=>{var n={45:((a,l,u)=>{var c={};c.layoutBase=u(551),c.CoSEConstants=u(806),c.CoSEEdge=u(767),c.CoSEGraph=u(880),c.CoSEGraphManager=u(578),c.CoSELayout=u(765),c.CoSENode=u(991),c.ConstraintHandler=u(902),a.exports=c}),806:((a,l,u)=>{var c=u(551).FDLayoutConstants;function h(){}for(var v in c)h[v]=c[v];h.DEFAULT_USE_MULTI_LEVEL_SCALING=!1,h.DEFAULT_RADIAL_SEPARATION=c.DEFAULT_EDGE_LENGTH,h.DEFAULT_COMPONENT_SEPERATION=60,h.TILE=!0,h.TILING_PADDING_VERTICAL=10,h.TILING_PADDING_HORIZONTAL=10,h.TRANSFORM_ON_CONSTRAINT_HANDLING=!0,h.ENFORCE_CONSTRAINTS=!0,h.APPLY_LAYOUT=!0,h.RELAX_MOVEMENT_ON_CONSTRAINTS=!0,h.TREE_REDUCTION_ON_INCREMENTAL=!0,h.PURE_INCREMENTAL=h.DEFAULT_INCREMENTAL,a.exports=h}),767:((a,l,u)=>{var c=u(551).FDLayoutEdge;function h(d,x,w){c.call(this,d,x,w)}h.prototype=Object.create(c.prototype);for(var v in c)h[v]=c[v];a.exports=h}),880:((a,l,u)=>{var c=u(551).LGraph;function h(d,x,w){c.call(this,d,x,w)}h.prototype=Object.create(c.prototype);for(var v in c)h[v]=c[v];a.exports=h}),578:((a,l,u)=>{var c=u(551).LGraphManager;function h(d){c.call(this,d)}h.prototype=Object.create(c.prototype);for(var v in c)h[v]=c[v];a.exports=h}),765:((a,l,u)=>{var c=u(551).FDLayout,h=u(578),v=u(880),d=u(991),x=u(767),w=u(806),g=u(902),m=u(551).FDLayoutConstants,y=u(551).LayoutConstants,b=u(551).Point,S=u(551).PointD,N=u(551).DimensionD,E=u(551).Layout,T=u(551).Integer,k=u(551).IGeometry,L=u(551).LGraph,A=u(551).Transform,I=u(551).LinkedList;function M(){c.call(this),this.toBeTiled={},this.constraints={}}M.prototype=Object.create(c.prototype);for(var B in c)M[B]=c[B];M.prototype.newGraphManager=function(){var D=new h(this);return this.graphManager=D,D},M.prototype.newGraph=function(D){return new v(null,this.graphManager,D)},M.prototype.newNode=function(D){return new d(this.graphManager,D)},M.prototype.newEdge=function(D){return new x(null,null,D)},M.prototype.initParameters=function(){c.prototype.initParameters.call(this,arguments),this.isSubLayout||(w.DEFAULT_EDGE_LENGTH<10?this.idealEdgeLength=10:this.idealEdgeLength=w.DEFAULT_EDGE_LENGTH,this.useSmartIdealEdgeLengthCalculation=w.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.gravityConstant=m.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=m.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=m.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=m.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.prunedNodesAll=[],this.growTreeIterations=0,this.afterGrowthIterations=0,this.isTreeGrowing=!1,this.isGrowthFinished=!1)},M.prototype.initSpringEmbedder=function(){c.prototype.initSpringEmbedder.call(this),this.coolingCycle=0,this.maxCoolingCycle=this.maxIterations/m.CONVERGENCE_CHECK_PERIOD,this.finalTemperature=.04,this.coolingAdjuster=1},M.prototype.layout=function(){var D=y.DEFAULT_CREATE_BENDS_AS_NEEDED;return D&&(this.createBendpoints(),this.graphManager.resetAllEdges()),this.level=0,this.classicLayout()},M.prototype.classicLayout=function(){if(this.nodesWithGravity=this.calculateNodesToApplyGravitationTo(),this.graphManager.setAllNodesToApplyGravitation(this.nodesWithGravity),this.calcNoOfChildrenForAllNodes(),this.graphManager.calcLowestCommonAncestors(),this.graphManager.calcInclusionTreeDepths(),this.graphManager.getRoot().calcEstimatedSize(),this.calcIdealEdgeLengths(),this.incremental){if(w.TREE_REDUCTION_ON_INCREMENTAL){this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var H=new Set(this.getAllNodes()),U=this.nodesWithGravity.filter(function(F){return H.has(F)});this.graphManager.setAllNodesToApplyGravitation(U)}}else{var D=this.getFlatForest();if(D.length>0)this.positionNodesRadially(D);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var H=new Set(this.getAllNodes()),U=this.nodesWithGravity.filter(function(z){return H.has(z)});this.graphManager.setAllNodesToApplyGravitation(U),this.positionNodesRandomly()}}return Object.keys(this.constraints).length>0&&(g.handleConstraints(this),this.initConstraintVariables()),this.initSpringEmbedder(),w.APPLY_LAYOUT&&this.runSpringEmbedder(),!0},M.prototype.tick=function(){if(this.totalIterations++,this.totalIterations===this.maxIterations&&!this.isTreeGrowing&&!this.isGrowthFinished)if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;if(this.totalIterations%m.CONVERGENCE_CHECK_PERIOD==0&&!this.isTreeGrowing&&!this.isGrowthFinished){if(this.isConverged())if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;this.coolingCycle++,this.layoutQuality==0?this.coolingAdjuster=this.coolingCycle:this.layoutQuality==1&&(this.coolingAdjuster=this.coolingCycle/3),this.coolingFactor=Math.max(this.initialCoolingFactor-Math.pow(this.coolingCycle,Math.log(100*(this.initialCoolingFactor-this.finalTemperature))/Math.log(this.maxCoolingCycle))/100*this.coolingAdjuster,this.finalTemperature),this.animationPeriod=Math.ceil(this.initialAnimationPeriod*Math.sqrt(this.coolingFactor))}if(this.isTreeGrowing){if(this.growTreeIterations%10==0)if(this.prunedNodesAll.length>0){this.graphManager.updateBounds(),this.updateGrid(),this.growTree(this.prunedNodesAll),this.graphManager.resetAllNodesToApplyGravitation();var D=new Set(this.getAllNodes()),H=this.nodesWithGravity.filter(function(W){return D.has(W)});this.graphManager.setAllNodesToApplyGravitation(H),this.graphManager.updateBounds(),this.updateGrid(),w.PURE_INCREMENTAL?this.coolingFactor=m.DEFAULT_COOLING_FACTOR_INCREMENTAL/2:this.coolingFactor=m.DEFAULT_COOLING_FACTOR_INCREMENTAL}else this.isTreeGrowing=!1,this.isGrowthFinished=!0;this.growTreeIterations++}if(this.isGrowthFinished){if(this.isConverged())return!0;this.afterGrowthIterations%10==0&&(this.graphManager.updateBounds(),this.updateGrid()),w.PURE_INCREMENTAL?this.coolingFactor=m.DEFAULT_COOLING_FACTOR_INCREMENTAL/2*((100-this.afterGrowthIterations)/100):this.coolingFactor=m.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var U=!this.isTreeGrowing&&!this.isGrowthFinished,z=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(U,z),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},M.prototype.getPositionsData=function(){for(var D=this.graphManager.getAllNodes(),H={},U=0;U<D.length;U++){var z=D[U].rect,W=D[U].id;H[W]={id:W,x:z.getCenterX(),y:z.getCenterY(),w:z.width,h:z.height}}return H},M.prototype.runSpringEmbedder=function(){this.initialAnimationPeriod=25,this.animationPeriod=this.initialAnimationPeriod;var D=!1;if(m.ANIMATE==="during")this.emit("layoutstarted");else{for(;!D;)D=this.tick();this.graphManager.updateBounds()}},M.prototype.moveNodes=function(){for(var D=this.getAllNodes(),H,U=0;U<D.length;U++)H=D[U],H.calculateDisplacement();Object.keys(this.constraints).length>0&&this.updateDisplacements();for(var U=0;U<D.length;U++)H=D[U],H.move()},M.prototype.initConstraintVariables=function(){var D=this;this.idToNodeMap=new Map,this.fixedNodeSet=new Set;for(var H=this.graphManager.getAllNodes(),U=0;U<H.length;U++){var z=H[U];this.idToNodeMap.set(z.id,z)}var W=function Y(X){for(var J=X.getChild().getNodes(),re,ce=0,de=0;de<J.length;de++)re=J[de],re.getChild()==null?D.fixedNodeSet.has(re.id)&&(ce+=100):ce+=Y(re);return ce};if(this.constraints.fixedNodeConstraint){this.constraints.fixedNodeConstraint.forEach(function(J){D.fixedNodeSet.add(J.nodeId)});for(var H=this.graphManager.getAllNodes(),z,U=0;U<H.length;U++)if(z=H[U],z.getChild()!=null){var F=W(z);F>0&&(z.fixedNodeWeight=F)}}if(this.constraints.relativePlacementConstraint){var P=new Map,j=new Map;if(this.dummyToNodeForVerticalAlignment=new Map,this.dummyToNodeForHorizontalAlignment=new Map,this.fixedNodesOnHorizontal=new Set,this.fixedNodesOnVertical=new Set,this.fixedNodeSet.forEach(function(Y){D.fixedNodesOnHorizontal.add(Y),D.fixedNodesOnVertical.add(Y)}),this.constraints.alignmentConstraint){if(this.constraints.alignmentConstraint.vertical)for(var G=this.constraints.alignmentConstraint.vertical,U=0;U<G.length;U++)this.dummyToNodeForVerticalAlignment.set("dummy"+U,[]),G[U].forEach(function(X){P.set(X,"dummy"+U),D.dummyToNodeForVerticalAlignment.get("dummy"+U).push(X),D.fixedNodeSet.has(X)&&D.fixedNodesOnHorizontal.add("dummy"+U)});if(this.constraints.alignmentConstraint.horizontal)for(var $=this.constraints.alignmentConstraint.horizontal,U=0;U<$.length;U++)this.dummyToNodeForHorizontalAlignment.set("dummy"+U,[]),$[U].forEach(function(X){j.set(X,"dummy"+U),D.dummyToNodeForHorizontalAlignment.get("dummy"+U).push(X),D.fixedNodeSet.has(X)&&D.fixedNodesOnVertical.add("dummy"+U)})}if(w.RELAX_MOVEMENT_ON_CONSTRAINTS)this.shuffle=function(Y){var X,J,re;for(re=Y.length-1;re>=2*Y.length/3;re--)X=Math.floor(Math.random()*(re+1)),J=Y[re],Y[re]=Y[X],Y[X]=J;return Y},this.nodesInRelativeHorizontal=[],this.nodesInRelativeVertical=[],this.nodeToRelativeConstraintMapHorizontal=new Map,this.nodeToRelativeConstraintMapVertical=new Map,this.nodeToTempPositionMapHorizontal=new Map,this.nodeToTempPositionMapVertical=new Map,this.constraints.relativePlacementConstraint.forEach(function(Y){if(Y.left){var X=P.has(Y.left)?P.get(Y.left):Y.left,J=P.has(Y.right)?P.get(Y.right):Y.right;D.nodesInRelativeHorizontal.includes(X)||(D.nodesInRelativeHorizontal.push(X),D.nodeToRelativeConstraintMapHorizontal.set(X,[]),D.dummyToNodeForVerticalAlignment.has(X)?D.nodeToTempPositionMapHorizontal.set(X,D.idToNodeMap.get(D.dummyToNodeForVerticalAlignment.get(X)[0]).getCenterX()):D.nodeToTempPositionMapHorizontal.set(X,D.idToNodeMap.get(X).getCenterX())),D.nodesInRelativeHorizontal.includes(J)||(D.nodesInRelativeHorizontal.push(J),D.nodeToRelativeConstraintMapHorizontal.set(J,[]),D.dummyToNodeForVerticalAlignment.has(J)?D.nodeToTempPositionMapHorizontal.set(J,D.idToNodeMap.get(D.dummyToNodeForVerticalAlignment.get(J)[0]).getCenterX()):D.nodeToTempPositionMapHorizontal.set(J,D.idToNodeMap.get(J).getCenterX())),D.nodeToRelativeConstraintMapHorizontal.get(X).push({right:J,gap:Y.gap}),D.nodeToRelativeConstraintMapHorizontal.get(J).push({left:X,gap:Y.gap})}else{var re=j.has(Y.top)?j.get(Y.top):Y.top,ce=j.has(Y.bottom)?j.get(Y.bottom):Y.bottom;D.nodesInRelativeVertical.includes(re)||(D.nodesInRelativeVertical.push(re),D.nodeToRelativeConstraintMapVertical.set(re,[]),D.dummyToNodeForHorizontalAlignment.has(re)?D.nodeToTempPositionMapVertical.set(re,D.idToNodeMap.get(D.dummyToNodeForHorizontalAlignment.get(re)[0]).getCenterY()):D.nodeToTempPositionMapVertical.set(re,D.idToNodeMap.get(re).getCenterY())),D.nodesInRelativeVertical.includes(ce)||(D.nodesInRelativeVertical.push(ce),D.nodeToRelativeConstraintMapVertical.set(ce,[]),D.dummyToNodeForHorizontalAlignment.has(ce)?D.nodeToTempPositionMapVertical.set(ce,D.idToNodeMap.get(D.dummyToNodeForHorizontalAlignment.get(ce)[0]).getCenterY()):D.nodeToTempPositionMapVertical.set(ce,D.idToNodeMap.get(ce).getCenterY())),D.nodeToRelativeConstraintMapVertical.get(re).push({bottom:ce,gap:Y.gap}),D.nodeToRelativeConstraintMapVertical.get(ce).push({top:re,gap:Y.gap})}});else{var ee=new Map,ae=new Map;this.constraints.relativePlacementConstraint.forEach(function(Y){if(Y.left){var X=P.has(Y.left)?P.get(Y.left):Y.left,J=P.has(Y.right)?P.get(Y.right):Y.right;ee.has(X)?ee.get(X).push(J):ee.set(X,[J]),ee.has(J)?ee.get(J).push(X):ee.set(J,[X])}else{var re=j.has(Y.top)?j.get(Y.top):Y.top,ce=j.has(Y.bottom)?j.get(Y.bottom):Y.bottom;ae.has(re)?ae.get(re).push(ce):ae.set(re,[ce]),ae.has(ce)?ae.get(ce).push(re):ae.set(ce,[re])}});var ie=function(X,J){var re=[],ce=[],de=new I,Re=new Set,Pe=0;return X.forEach(function(_e,ke){if(!Re.has(ke)){re[Pe]=[],ce[Pe]=!1;var Le=ke;for(de.push(Le),Re.add(Le),re[Pe].push(Le);de.length!=0;){Le=de.shift(),J.has(Le)&&(ce[Pe]=!0);var Ee=X.get(Le);Ee.forEach(function(Ie){Re.has(Ie)||(de.push(Ie),Re.add(Ie),re[Pe].push(Ie))})}Pe++}}),{components:re,isFixed:ce}},K=ie(ee,D.fixedNodesOnHorizontal);this.componentsOnHorizontal=K.components,this.fixedComponentsOnHorizontal=K.isFixed;var q=ie(ae,D.fixedNodesOnVertical);this.componentsOnVertical=q.components,this.fixedComponentsOnVertical=q.isFixed}}},M.prototype.updateDisplacements=function(){var D=this;if(this.constraints.fixedNodeConstraint&&this.constraints.fixedNodeConstraint.forEach(function(q){var Y=D.idToNodeMap.get(q.nodeId);Y.displacementX=0,Y.displacementY=0}),this.constraints.alignmentConstraint){if(this.constraints.alignmentConstraint.vertical)for(var H=this.constraints.alignmentConstraint.vertical,U=0;U<H.length;U++){for(var z=0,W=0;W<H[U].length;W++){if(this.fixedNodeSet.has(H[U][W])){z=0;break}z+=this.idToNodeMap.get(H[U][W]).displacementX}for(var F=z/H[U].length,W=0;W<H[U].length;W++)this.idToNodeMap.get(H[U][W]).displacementX=F}if(this.constraints.alignmentConstraint.horizontal)for(var P=this.constraints.alignmentConstraint.horizontal,U=0;U<P.length;U++){for(var j=0,W=0;W<P[U].length;W++){if(this.fixedNodeSet.has(P[U][W])){j=0;break}j+=this.idToNodeMap.get(P[U][W]).displacementY}for(var G=j/P[U].length,W=0;W<P[U].length;W++)this.idToNodeMap.get(P[U][W]).displacementY=G}}if(this.constraints.relativePlacementConstraint)if(w.RELAX_MOVEMENT_ON_CONSTRAINTS)this.totalIterations%10==0&&(this.shuffle(this.nodesInRelativeHorizontal),this.shuffle(this.nodesInRelativeVertical)),this.nodesInRelativeHorizontal.forEach(function(q){if(!D.fixedNodesOnHorizontal.has(q)){var Y=0;D.dummyToNodeForVerticalAlignment.has(q)?Y=D.idToNodeMap.get(D.dummyToNodeForVerticalAlignment.get(q)[0]).displacementX:Y=D.idToNodeMap.get(q).displacementX,D.nodeToRelativeConstraintMapHorizontal.get(q).forEach(function(X){if(X.right){var J=D.nodeToTempPositionMapHorizontal.get(X.right)-D.nodeToTempPositionMapHorizontal.get(q)-Y;J<X.gap&&(Y-=X.gap-J)}else{var J=D.nodeToTempPositionMapHorizontal.get(q)-D.nodeToTempPositionMapHorizontal.get(X.left)+Y;J<X.gap&&(Y+=X.gap-J)}}),D.nodeToTempPositionMapHorizontal.set(q,D.nodeToTempPositionMapHorizontal.get(q)+Y),D.dummyToNodeForVerticalAlignment.has(q)?D.dummyToNodeForVerticalAlignment.get(q).forEach(function(X){D.idToNodeMap.get(X).displacementX=Y}):D.idToNodeMap.get(q).displacementX=Y}}),this.nodesInRelativeVertical.forEach(function(q){if(!D.fixedNodesOnHorizontal.has(q)){var Y=0;D.dummyToNodeForHorizontalAlignment.has(q)?Y=D.idToNodeMap.get(D.dummyToNodeForHorizontalAlignment.get(q)[0]).displacementY:Y=D.idToNodeMap.get(q).displacementY,D.nodeToRelativeConstraintMapVertical.get(q).forEach(function(X){if(X.bottom){var J=D.nodeToTempPositionMapVertical.get(X.bottom)-D.nodeToTempPositionMapVertical.get(q)-Y;J<X.gap&&(Y-=X.gap-J)}else{var J=D.nodeToTempPositionMapVertical.get(q)-D.nodeToTempPositionMapVertical.get(X.top)+Y;J<X.gap&&(Y+=X.gap-J)}}),D.nodeToTempPositionMapVertical.set(q,D.nodeToTempPositionMapVertical.get(q)+Y),D.dummyToNodeForHorizontalAlignment.has(q)?D.dummyToNodeForHorizontalAlignment.get(q).forEach(function(X){D.idToNodeMap.get(X).displacementY=Y}):D.idToNodeMap.get(q).displacementY=Y}});else{for(var U=0;U<this.componentsOnHorizontal.length;U++){var $=this.componentsOnHorizontal[U];if(this.fixedComponentsOnHorizontal[U])for(var W=0;W<$.length;W++)this.dummyToNodeForVerticalAlignment.has($[W])?this.dummyToNodeForVerticalAlignment.get($[W]).forEach(function(X){D.idToNodeMap.get(X).displacementX=0}):this.idToNodeMap.get($[W]).displacementX=0;else{for(var ee=0,ae=0,W=0;W<$.length;W++)if(this.dummyToNodeForVerticalAlignment.has($[W])){var ie=this.dummyToNodeForVerticalAlignment.get($[W]);ee+=ie.length*this.idToNodeMap.get(ie[0]).displacementX,ae+=ie.length}else ee+=this.idToNodeMap.get($[W]).displacementX,ae++;for(var K=ee/ae,W=0;W<$.length;W++)this.dummyToNodeForVerticalAlignment.has($[W])?this.dummyToNodeForVerticalAlignment.get($[W]).forEach(function(X){D.idToNodeMap.get(X).displacementX=K}):this.idToNodeMap.get($[W]).displacementX=K}}for(var U=0;U<this.componentsOnVertical.length;U++){var $=this.componentsOnVertical[U];if(this.fixedComponentsOnVertical[U])for(var W=0;W<$.length;W++)this.dummyToNodeForHorizontalAlignment.has($[W])?this.dummyToNodeForHorizontalAlignment.get($[W]).forEach(function(J){D.idToNodeMap.get(J).displacementY=0}):this.idToNodeMap.get($[W]).displacementY=0;else{for(var ee=0,ae=0,W=0;W<$.length;W++)if(this.dummyToNodeForHorizontalAlignment.has($[W])){var ie=this.dummyToNodeForHorizontalAlignment.get($[W]);ee+=ie.length*this.idToNodeMap.get(ie[0]).displacementY,ae+=ie.length}else ee+=this.idToNodeMap.get($[W]).displacementY,ae++;for(var K=ee/ae,W=0;W<$.length;W++)this.dummyToNodeForHorizontalAlignment.has($[W])?this.dummyToNodeForHorizontalAlignment.get($[W]).forEach(function(de){D.idToNodeMap.get(de).displacementY=K}):this.idToNodeMap.get($[W]).displacementY=K}}}},M.prototype.calculateNodesToApplyGravitationTo=function(){var D=[],H,U=this.graphManager.getGraphs(),z=U.length,W;for(W=0;W<z;W++)H=U[W],H.updateConnected(),H.isConnected||(D=D.concat(H.getNodes()));return D},M.prototype.createBendpoints=function(){var D=[];D=D.concat(this.graphManager.getAllEdges());var H=new Set,U;for(U=0;U<D.length;U++){var z=D[U];if(!H.has(z)){var W=z.getSource(),F=z.getTarget();if(W==F)z.getBendpoints().push(new S),z.getBendpoints().push(new S),this.createDummyNodesForBendpoints(z),H.add(z);else{var P=[];if(P=P.concat(W.getEdgeListToNode(F)),P=P.concat(F.getEdgeListToNode(W)),!H.has(P[0])){if(P.length>1){var j;for(j=0;j<P.length;j++){var G=P[j];G.getBendpoints().push(new S),this.createDummyNodesForBendpoints(G)}}P.forEach(function($){H.add($)})}}}if(H.size==D.length)break}},M.prototype.positionNodesRadially=function(D){for(var H=new b(0,0),U=Math.ceil(Math.sqrt(D.length)),z=0,W=0,F=0,P=new S(0,0),j=0;j<D.length;j++){j%U==0&&(F=0,W=z,j!=0&&(W+=w.DEFAULT_COMPONENT_SEPERATION),z=0);var G=D[j],$=E.findCenterOfTree(G);H.x=F,H.y=W,P=M.radialLayout(G,$,H),P.y>z&&(z=Math.floor(P.y)),F=Math.floor(P.x+w.DEFAULT_COMPONENT_SEPERATION)}this.transform(new S(y.WORLD_CENTER_X-P.x/2,y.WORLD_CENTER_Y-P.y/2))},M.radialLayout=function(D,H,U){var z=Math.max(this.maxDiagonalInTree(D),w.DEFAULT_RADIAL_SEPARATION);M.branchRadialLayout(H,null,0,359,0,z);var W=L.calculateBounds(D),F=new A;F.setDeviceOrgX(W.getMinX()),F.setDeviceOrgY(W.getMinY()),F.setWorldOrgX(U.x),F.setWorldOrgY(U.y);for(var P=0;P<D.length;P++){var j=D[P];j.transform(F)}var G=new S(W.getMaxX(),W.getMaxY());return F.inverseTransformPoint(G)},M.branchRadialLayout=function(D,H,U,z,W,F){var P=(z-U+1)/2;P<0&&(P+=180);var j=(P+U)%360,G=j*k.TWO_PI/360,$=W*Math.cos(G),ee=W*Math.sin(G);D.setCenter($,ee);var ae=[];ae=ae.concat(D.getEdges());var ie=ae.length;H!=null&&ie--;for(var K=0,q=ae.length,Y,X=D.getEdgesBetween(H);X.length>1;){var J=X[0];X.splice(0,1);var re=ae.indexOf(J);re>=0&&ae.splice(re,1),q--,ie--}H!=null?Y=(ae.indexOf(X[0])+1)%q:Y=0;for(var ce=Math.abs(z-U)/ie,de=Y;K!=ie;de=++de%q){var Re=ae[de].getOtherEnd(D);if(Re!=H){var Pe=(U+K*ce)%360,_e=(Pe+ce)%360;M.branchRadialLayout(Re,D,Pe,_e,W+F,F),K++}}},M.maxDiagonalInTree=function(D){for(var H=T.MIN_VALUE,U=0;U<D.length;U++){var z=D[U],W=z.getDiagonal();W>H&&(H=W)}return H},M.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},M.prototype.groupZeroDegreeMembers=function(){var D=this,H={};this.memberGroups={},this.idToDummyNode={};for(var U=[],z=this.graphManager.getAllNodes(),W=0;W<z.length;W++){var F=z[W],P=F.getParent();this.getNodeDegreeWithChildren(F)===0&&(P.id==null||!this.getToBeTiled(P))&&U.push(F)}for(var W=0;W<U.length;W++){var F=U[W],j=F.getParent().id;typeof H[j]>"u"&&(H[j]=[]),H[j]=H[j].concat(F)}Object.keys(H).forEach(function(G){if(H[G].length>1){var $="DummyCompound_"+G;D.memberGroups[$]=H[G];var ee=H[G][0].getParent(),ae=new d(D.graphManager);ae.id=$,ae.paddingLeft=ee.paddingLeft||0,ae.paddingRight=ee.paddingRight||0,ae.paddingBottom=ee.paddingBottom||0,ae.paddingTop=ee.paddingTop||0,D.idToDummyNode[$]=ae;var ie=D.getGraphManager().add(D.newGraph(),ae),K=ee.getChild();K.add(ae);for(var q=0;q<H[G].length;q++){var Y=H[G][q];K.remove(Y),ie.add(Y)}}})},M.prototype.clearCompounds=function(){var D={},H={};this.performDFSOnCompounds();for(var U=0;U<this.compoundOrder.length;U++)H[this.compoundOrder[U].id]=this.compoundOrder[U],D[this.compoundOrder[U].id]=[].concat(this.compoundOrder[U].getChild().getNodes()),this.graphManager.remove(this.compoundOrder[U].getChild()),this.compoundOrder[U].child=null;this.graphManager.resetAllNodes(),this.tileCompoundMembers(D,H)},M.prototype.clearZeroDegreeMembers=function(){var D=this,H=this.tiledZeroDegreePack=[];Object.keys(this.memberGroups).forEach(function(U){var z=D.idToDummyNode[U];if(H[U]=D.tileNodes(D.memberGroups[U],z.paddingLeft+z.paddingRight),z.rect.width=H[U].width,z.rect.height=H[U].height,z.setCenter(H[U].centerX,H[U].centerY),z.labelMarginLeft=0,z.labelMarginTop=0,w.NODE_DIMENSIONS_INCLUDE_LABELS){var W=z.rect.width,F=z.rect.height;z.labelWidth&&(z.labelPosHorizontal=="left"?(z.rect.x-=z.labelWidth,z.setWidth(W+z.labelWidth),z.labelMarginLeft=z.labelWidth):z.labelPosHorizontal=="center"&&z.labelWidth>W?(z.rect.x-=(z.labelWidth-W)/2,z.setWidth(z.labelWidth),z.labelMarginLeft=(z.labelWidth-W)/2):z.labelPosHorizontal=="right"&&z.setWidth(W+z.labelWidth)),z.labelHeight&&(z.labelPosVertical=="top"?(z.rect.y-=z.labelHeight,z.setHeight(F+z.labelHeight),z.labelMarginTop=z.labelHeight):z.labelPosVertical=="center"&&z.labelHeight>F?(z.rect.y-=(z.labelHeight-F)/2,z.setHeight(z.labelHeight),z.labelMarginTop=(z.labelHeight-F)/2):z.labelPosVertical=="bottom"&&z.setHeight(F+z.labelHeight))}})},M.prototype.repopulateCompounds=function(){for(var D=this.compoundOrder.length-1;D>=0;D--){var H=this.compoundOrder[D],U=H.id,z=H.paddingLeft,W=H.paddingTop,F=H.labelMarginLeft,P=H.labelMarginTop;this.adjustLocations(this.tiledMemberPack[U],H.rect.x,H.rect.y,z,W,F,P)}},M.prototype.repopulateZeroDegreeMembers=function(){var D=this,H=this.tiledZeroDegreePack;Object.keys(H).forEach(function(U){var z=D.idToDummyNode[U],W=z.paddingLeft,F=z.paddingTop,P=z.labelMarginLeft,j=z.labelMarginTop;D.adjustLocations(H[U],z.rect.x,z.rect.y,W,F,P,j)})},M.prototype.getToBeTiled=function(D){var H=D.id;if(this.toBeTiled[H]!=null)return this.toBeTiled[H];var U=D.getChild();if(U==null)return this.toBeTiled[H]=!1,!1;for(var z=U.getNodes(),W=0;W<z.length;W++){var F=z[W];if(this.getNodeDegree(F)>0)return this.toBeTiled[H]=!1,!1;if(F.getChild()==null){this.toBeTiled[F.id]=!1;continue}if(!this.getToBeTiled(F))return this.toBeTiled[H]=!1,!1}return this.toBeTiled[H]=!0,!0},M.prototype.getNodeDegree=function(D){D.id;for(var H=D.getEdges(),U=0,z=0;z<H.length;z++){var W=H[z];W.getSource().id!==W.getTarget().id&&(U=U+1)}return U},M.prototype.getNodeDegreeWithChildren=function(D){var H=this.getNodeDegree(D);if(D.getChild()==null)return H;for(var U=D.getChild().getNodes(),z=0;z<U.length;z++){var W=U[z];H+=this.getNodeDegreeWithChildren(W)}return H},M.prototype.performDFSOnCompounds=function(){this.compoundOrder=[],this.fillCompexOrderByDFS(this.graphManager.getRoot().getNodes())},M.prototype.fillCompexOrderByDFS=function(D){for(var H=0;H<D.length;H++){var U=D[H];U.getChild()!=null&&this.fillCompexOrderByDFS(U.getChild().getNodes()),this.getToBeTiled(U)&&this.compoundOrder.push(U)}},M.prototype.adjustLocations=function(D,H,U,z,W,F,P){H+=z+F,U+=W+P;for(var j=H,G=0;G<D.rows.length;G++){var $=D.rows[G];H=j;for(var ee=0,ae=0;ae<$.length;ae++){var ie=$[ae];ie.rect.x=H,ie.rect.y=U,H+=ie.rect.width+D.horizontalPadding,ie.rect.height>ee&&(ee=ie.rect.height)}U+=ee+D.verticalPadding}},M.prototype.tileCompoundMembers=function(D,H){var U=this;this.tiledMemberPack=[],Object.keys(D).forEach(function(z){var W=H[z];if(U.tiledMemberPack[z]=U.tileNodes(D[z],W.paddingLeft+W.paddingRight),W.rect.width=U.tiledMemberPack[z].width,W.rect.height=U.tiledMemberPack[z].height,W.setCenter(U.tiledMemberPack[z].centerX,U.tiledMemberPack[z].centerY),W.labelMarginLeft=0,W.labelMarginTop=0,w.NODE_DIMENSIONS_INCLUDE_LABELS){var F=W.rect.width,P=W.rect.height;W.labelWidth&&(W.labelPosHorizontal=="left"?(W.rect.x-=W.labelWidth,W.setWidth(F+W.labelWidth),W.labelMarginLeft=W.labelWidth):W.labelPosHorizontal=="center"&&W.labelWidth>F?(W.rect.x-=(W.labelWidth-F)/2,W.setWidth(W.labelWidth),W.labelMarginLeft=(W.labelWidth-F)/2):W.labelPosHorizontal=="right"&&W.setWidth(F+W.labelWidth)),W.labelHeight&&(W.labelPosVertical=="top"?(W.rect.y-=W.labelHeight,W.setHeight(P+W.labelHeight),W.labelMarginTop=W.labelHeight):W.labelPosVertical=="center"&&W.labelHeight>P?(W.rect.y-=(W.labelHeight-P)/2,W.setHeight(W.labelHeight),W.labelMarginTop=(W.labelHeight-P)/2):W.labelPosVertical=="bottom"&&W.setHeight(P+W.labelHeight))}})},M.prototype.tileNodes=function(D,H){var U=this.tileNodesByFavoringDim(D,H,!0),z=this.tileNodesByFavoringDim(D,H,!1),W=this.getOrgRatio(U),F=this.getOrgRatio(z),P;return F<W?P=z:P=U,P},M.prototype.getOrgRatio=function(D){var H=D.width,U=D.height,z=H/U;return z<1&&(z=1/z),z},M.prototype.calcIdealRowWidth=function(D,H){var U=w.TILING_PADDING_VERTICAL,z=w.TILING_PADDING_HORIZONTAL,W=D.length,F=0,P=0,j=0;D.forEach(function(q){F+=q.getWidth(),P+=q.getHeight(),q.getWidth()>j&&(j=q.getWidth())});var G=F/W,$=P/W,ee=Math.pow(U-z,2)+4*(G+z)*($+U)*W,ae=(z-U+Math.sqrt(ee))/(2*(G+z)),ie;H?(ie=Math.ceil(ae),ie==ae&&ie++):ie=Math.floor(ae);var K=ie*(G+z)-z;return j>K&&(K=j),K+=z*2,K},M.prototype.tileNodesByFavoringDim=function(D,H,U){var z=w.TILING_PADDING_VERTICAL,W=w.TILING_PADDING_HORIZONTAL,F=w.TILING_COMPARE_BY,P={rows:[],rowWidth:[],rowHeight:[],width:0,height:H,verticalPadding:z,horizontalPadding:W,centerX:0,centerY:0};F&&(P.idealRowWidth=this.calcIdealRowWidth(D,U));var j=function(Y){return Y.rect.width*Y.rect.height},G=function(Y,X){return j(X)-j(Y)};D.sort(function(q,Y){var X=G;return P.idealRowWidth?(X=F,X(q.id,Y.id)):X(q,Y)});for(var $=0,ee=0,ae=0;ae<D.length;ae++){var ie=D[ae];$+=ie.getCenterX(),ee+=ie.getCenterY()}P.centerX=$/D.length,P.centerY=ee/D.length;for(var ae=0;ae<D.length;ae++){var ie=D[ae];if(P.rows.length==0)this.insertNodeToRow(P,ie,0,H);else if(this.canAddHorizontal(P,ie.rect.width,ie.rect.height)){var K=P.rows.length-1;P.idealRowWidth||(K=this.getShortestRowIndex(P)),this.insertNodeToRow(P,ie,K,H)}else this.insertNodeToRow(P,ie,P.rows.length,H);this.shiftToLastRow(P)}return P},M.prototype.insertNodeToRow=function(D,H,U,z){var W=z;if(U==D.rows.length){var F=[];D.rows.push(F),D.rowWidth.push(W),D.rowHeight.push(0)}var P=D.rowWidth[U]+H.rect.width;D.rows[U].length>0&&(P+=D.horizontalPadding),D.rowWidth[U]=P,D.width<P&&(D.width=P);var j=H.rect.height;U>0&&(j+=D.verticalPadding);var G=0;j>D.rowHeight[U]&&(G=D.rowHeight[U],D.rowHeight[U]=j,G=D.rowHeight[U]-G),D.height+=G,D.rows[U].push(H)},M.prototype.getShortestRowIndex=function(D){for(var H=-1,U=Number.MAX_VALUE,z=0;z<D.rows.length;z++)D.rowWidth[z]<U&&(H=z,U=D.rowWidth[z]);return H},M.prototype.getLongestRowIndex=function(D){for(var H=-1,U=Number.MIN_VALUE,z=0;z<D.rows.length;z++)D.rowWidth[z]>U&&(H=z,U=D.rowWidth[z]);return H},M.prototype.canAddHorizontal=function(D,H,U){if(D.idealRowWidth){var z=D.rows.length-1,W=D.rowWidth[z];return W+H+D.horizontalPadding<=D.idealRowWidth}var F=this.getShortestRowIndex(D);if(F<0)return!0;var P=D.rowWidth[F];if(P+D.horizontalPadding+H<=D.width)return!0;var j=0;D.rowHeight[F]<U&&F>0&&(j=U+D.verticalPadding-D.rowHeight[F]);var G;D.width-P>=H+D.horizontalPadding?G=(D.height+j)/(P+H+D.horizontalPadding):G=(D.height+j)/D.width,j=U+D.verticalPadding;var $;return D.width<H?$=(D.height+j)/H:$=(D.height+j)/D.width,$<1&&($=1/$),G<1&&(G=1/G),G<$},M.prototype.shiftToLastRow=function(D){var H=this.getLongestRowIndex(D),U=D.rowWidth.length-1,z=D.rows[H],W=z[z.length-1],F=W.width+D.horizontalPadding;if(D.width-D.rowWidth[U]>F&&H!=U){z.splice(-1,1),D.rows[U].push(W),D.rowWidth[H]=D.rowWidth[H]-F,D.rowWidth[U]=D.rowWidth[U]+F,D.width=D.rowWidth[instance.getLongestRowIndex(D)];for(var P=Number.MIN_VALUE,j=0;j<z.length;j++)z[j].height>P&&(P=z[j].height);H>0&&(P+=D.verticalPadding);var G=D.rowHeight[H]+D.rowHeight[U];D.rowHeight[H]=P,D.rowHeight[U]<W.height+D.verticalPadding&&(D.rowHeight[U]=W.height+D.verticalPadding);var $=D.rowHeight[H]+D.rowHeight[U];D.height+=$-G,this.shiftToLastRow(D)}},M.prototype.tilingPreLayout=function(){w.TILE&&(this.groupZeroDegreeMembers(),this.clearCompounds(),this.clearZeroDegreeMembers())},M.prototype.tilingPostLayout=function(){w.TILE&&(this.repopulateZeroDegreeMembers(),this.repopulateCompounds())},M.prototype.reduceTrees=function(){for(var D=[],H=!0,U;H;){var z=this.graphManager.getAllNodes(),W=[];H=!1;for(var F=0;F<z.length;F++)if(U=z[F],U.getEdges().length==1&&!U.getEdges()[0].isInterGraph&&U.getChild()==null){if(w.PURE_INCREMENTAL){var P=U.getEdges()[0].getOtherEnd(U),j=new N(U.getCenterX()-P.getCenterX(),U.getCenterY()-P.getCenterY());W.push([U,U.getEdges()[0],U.getOwner(),j])}else W.push([U,U.getEdges()[0],U.getOwner()]);H=!0}if(H==!0){for(var G=[],$=0;$<W.length;$++)W[$][0].getEdges().length==1&&(G.push(W[$]),W[$][0].getOwner().remove(W[$][0]));D.push(G),this.graphManager.resetAllNodes(),this.graphManager.resetAllEdges()}}this.prunedNodesAll=D},M.prototype.growTree=function(D){for(var H=D.length,U=D[H-1],z,W=0;W<U.length;W++)z=U[W],this.findPlaceforPrunedNode(z),z[2].add(z[0]),z[2].add(z[1],z[1].source,z[1].target);D.splice(D.length-1,1),this.graphManager.resetAllNodes(),this.graphManager.resetAllEdges()},M.prototype.findPlaceforPrunedNode=function(D){var H,U,z=D[0];if(z==D[1].source?U=D[1].target:U=D[1].source,w.PURE_INCREMENTAL)z.setCenter(U.getCenterX()+D[3].getWidth(),U.getCenterY()+D[3].getHeight());else{var W=U.startX,F=U.finishX,P=U.startY,j=U.finishY,G=0,$=0,ee=0,ae=0,ie=[G,ee,$,ae];if(P>0)for(var K=W;K<=F;K++)ie[0]+=this.grid[K][P-1].length+this.grid[K][P].length-1;if(F<this.grid.length-1)for(var K=P;K<=j;K++)ie[1]+=this.grid[F+1][K].length+this.grid[F][K].length-1;if(j<this.grid[0].length-1)for(var K=W;K<=F;K++)ie[2]+=this.grid[K][j+1].length+this.grid[K][j].length-1;if(W>0)for(var K=P;K<=j;K++)ie[3]+=this.grid[W-1][K].length+this.grid[W][K].length-1;for(var q=T.MAX_VALUE,Y,X,J=0;J<ie.length;J++)ie[J]<q?(q=ie[J],Y=1,X=J):ie[J]==q&&Y++;if(Y==3&&q==0)ie[0]==0&&ie[1]==0&&ie[2]==0?H=1:ie[0]==0&&ie[1]==0&&ie[3]==0?H=0:ie[0]==0&&ie[2]==0&&ie[3]==0?H=3:ie[1]==0&&ie[2]==0&&ie[3]==0&&(H=2);else if(Y==2&&q==0){var re=Math.floor(Math.random()*2);ie[0]==0&&ie[1]==0?re==0?H=0:H=1:ie[0]==0&&ie[2]==0?re==0?H=0:H=2:ie[0]==0&&ie[3]==0?re==0?H=0:H=3:ie[1]==0&&ie[2]==0?re==0?H=1:H=2:ie[1]==0&&ie[3]==0?re==0?H=1:H=3:re==0?H=2:H=3}else if(Y==4&&q==0){var re=Math.floor(Math.random()*4);H=re}else H=X;H==0?z.setCenter(U.getCenterX(),U.getCenterY()-U.getHeight()/2-m.DEFAULT_EDGE_LENGTH-z.getHeight()/2):H==1?z.setCenter(U.getCenterX()+U.getWidth()/2+m.DEFAULT_EDGE_LENGTH+z.getWidth()/2,U.getCenterY()):H==2?z.setCenter(U.getCenterX(),U.getCenterY()+U.getHeight()/2+m.DEFAULT_EDGE_LENGTH+z.getHeight()/2):z.setCenter(U.getCenterX()-U.getWidth()/2-m.DEFAULT_EDGE_LENGTH-z.getWidth()/2,U.getCenterY())}},a.exports=M}),991:((a,l,u)=>{var c=u(551).FDLayoutNode,h=u(551).IMath;function v(x,w,g,m){c.call(this,x,w,g,m)}v.prototype=Object.create(c.prototype);for(var d in c)v[d]=c[d];v.prototype.calculateDisplacement=function(){var x=this.graphManager.getLayout();this.getChild()!=null&&this.fixedNodeWeight?(this.displacementX+=x.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.fixedNodeWeight,this.displacementY+=x.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.fixedNodeWeight):(this.displacementX+=x.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.noOfChildren,this.displacementY+=x.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.noOfChildren),Math.abs(this.displacementX)>x.coolingFactor*x.maxNodeDisplacement&&(this.displacementX=x.coolingFactor*x.maxNodeDisplacement*h.sign(this.displacementX)),Math.abs(this.displacementY)>x.coolingFactor*x.maxNodeDisplacement&&(this.displacementY=x.coolingFactor*x.maxNodeDisplacement*h.sign(this.displacementY)),this.child&&this.child.getNodes().length>0&&this.propogateDisplacementToChildren(this.displacementX,this.displacementY)},v.prototype.propogateDisplacementToChildren=function(x,w){for(var g=this.getChild().getNodes(),m,y=0;y<g.length;y++)m=g[y],m.getChild()==null?(m.displacementX+=x,m.displacementY+=w):m.propogateDisplacementToChildren(x,w)},v.prototype.move=function(){var x=this.graphManager.getLayout();(this.child==null||this.child.getNodes().length==0)&&(this.moveBy(this.displacementX,this.displacementY),x.totalDisplacement+=Math.abs(this.displacementX)+Math.abs(this.displacementY)),this.springForceX=0,this.springForceY=0,this.repulsionForceX=0,this.repulsionForceY=0,this.gravitationForceX=0,this.gravitationForceY=0,this.displacementX=0,this.displacementY=0},v.prototype.setPred1=function(x){this.pred1=x},v.prototype.getPred1=function(){return pred1},v.prototype.getPred2=function(){return pred2},v.prototype.setNext=function(x){this.next=x},v.prototype.getNext=function(){return next},v.prototype.setProcessed=function(x){this.processed=x},v.prototype.isProcessed=function(){return processed},a.exports=v}),902:((a,l,u)=>{function c(g){if(Array.isArray(g)){for(var m=0,y=Array(g.length);m<g.length;m++)y[m]=g[m];return y}else return Array.from(g)}var h=u(806),v=u(551).LinkedList,d=u(551).Matrix,x=u(551).SVD;function w(){}w.handleConstraints=function(g){var m={};m.fixedNodeConstraint=g.constraints.fixedNodeConstraint,m.alignmentConstraint=g.constraints.alignmentConstraint,m.relativePlacementConstraint=g.constraints.relativePlacementConstraint;for(var y=new Map,b=new Map,S=[],N=[],E=g.getAllNodes(),T=0,k=0;k<E.length;k++){var L=E[k];L.getChild()==null&&(b.set(L.id,T++),S.push(L.getCenterX()),N.push(L.getCenterY()),y.set(L.id,L))}m.relativePlacementConstraint&&m.relativePlacementConstraint.forEach(function(te){!te.gap&&te.gap!=0&&(te.left?te.gap=h.DEFAULT_EDGE_LENGTH+y.get(te.left).getWidth()/2+y.get(te.right).getWidth()/2:te.gap=h.DEFAULT_EDGE_LENGTH+y.get(te.top).getHeight()/2+y.get(te.bottom).getHeight()/2)});var A=function(oe,ue){return{x:oe.x-ue.x,y:oe.y-ue.y}},I=function(oe){var ue=0,se=0;return oe.forEach(function(he){ue+=S[b.get(he)],se+=N[b.get(he)]}),{x:ue/oe.size,y:se/oe.size}},M=function(oe,ue,se,he,pe){function be(Je,qe){var vt=new Set(Je),Ze=!0,Qe=!1,wt=void 0;try{for(var lt=qe[Symbol.iterator](),gt;!(Ze=(gt=lt.next()).done);Ze=!0){var xt=gt.value;vt.add(xt)}}catch(Rt){Qe=!0,wt=Rt}finally{try{!Ze&&lt.return&&lt.return()}finally{if(Qe)throw wt}}return vt}var Se=new Map;oe.forEach(function(Je,qe){Se.set(qe,0)}),oe.forEach(function(Je,qe){Je.forEach(function(vt){Se.set(vt.id,Se.get(vt.id)+1)})});var Te=new Map,Ne=new Map,He=new v;Se.forEach(function(Je,qe){Je==0?(He.push(qe),se||(ue=="horizontal"?Te.set(qe,b.has(qe)?S[b.get(qe)]:he.get(qe)):Te.set(qe,b.has(qe)?N[b.get(qe)]:he.get(qe)))):Te.set(qe,Number.NEGATIVE_INFINITY),se&&Ne.set(qe,new Set([qe]))}),se&&pe.forEach(function(Je){var qe=[];if(Je.forEach(function(Qe){se.has(Qe)&&qe.push(Qe)}),qe.length>0){var vt=0;qe.forEach(function(Qe){ue=="horizontal"?(Te.set(Qe,b.has(Qe)?S[b.get(Qe)]:he.get(Qe)),vt+=Te.get(Qe)):(Te.set(Qe,b.has(Qe)?N[b.get(Qe)]:he.get(Qe)),vt+=Te.get(Qe))}),vt=vt/qe.length,Je.forEach(function(Qe){se.has(Qe)||Te.set(Qe,vt)})}else{var Ze=0;Je.forEach(function(Qe){ue=="horizontal"?Ze+=b.has(Qe)?S[b.get(Qe)]:he.get(Qe):Ze+=b.has(Qe)?N[b.get(Qe)]:he.get(Qe)}),Ze=Ze/Je.length,Je.forEach(function(Qe){Te.set(Qe,Ze)})}});for(var ze=function(){var qe=He.shift(),vt=oe.get(qe);vt.forEach(function(Ze){if(Te.get(Ze.id)<Te.get(qe)+Ze.gap)if(se&&se.has(Ze.id)){var Qe=void 0;if(ue=="horizontal"?Qe=b.has(Ze.id)?S[b.get(Ze.id)]:he.get(Ze.id):Qe=b.has(Ze.id)?N[b.get(Ze.id)]:he.get(Ze.id),Te.set(Ze.id,Qe),Qe<Te.get(qe)+Ze.gap){var wt=Te.get(qe)+Ze.gap-Qe;Ne.get(qe).forEach(function(lt){Te.set(lt,Te.get(lt)-wt)})}}else Te.set(Ze.id,Te.get(qe)+Ze.gap);Se.set(Ze.id,Se.get(Ze.id)-1),Se.get(Ze.id)==0&&He.push(Ze.id),se&&Ne.set(Ze.id,be(Ne.get(qe),Ne.get(Ze.id)))})};He.length!=0;)ze();if(se){var Ge=new Set;oe.forEach(function(Je,qe){Je.length==0&&Ge.add(qe)});var st=[];Ne.forEach(function(Je,qe){if(Ge.has(qe)){var vt=!1,Ze=!0,Qe=!1,wt=void 0;try{for(var lt=Je[Symbol.iterator](),gt;!(Ze=(gt=lt.next()).done);Ze=!0){var xt=gt.value;se.has(xt)&&(vt=!0)}}catch(Tt){Qe=!0,wt=Tt}finally{try{!Ze&&lt.return&&lt.return()}finally{if(Qe)throw wt}}if(!vt){var Rt=!1,Ot=void 0;st.forEach(function(Tt,Nr){Tt.has([].concat(c(Je))[0])&&(Rt=!0,Ot=Nr)}),Rt?Je.forEach(function(Tt){st[Ot].add(Tt)}):st.push(new Set(Je))}}}),st.forEach(function(Je,qe){var vt=Number.POSITIVE_INFINITY,Ze=Number.POSITIVE_INFINITY,Qe=Number.NEGATIVE_INFINITY,wt=Number.NEGATIVE_INFINITY,lt=!0,gt=!1,xt=void 0;try{for(var Rt=Je[Symbol.iterator](),Ot;!(lt=(Ot=Rt.next()).done);lt=!0){var Tt=Ot.value,Nr=void 0;ue=="horizontal"?Nr=b.has(Tt)?S[b.get(Tt)]:he.get(Tt):Nr=b.has(Tt)?N[b.get(Tt)]:he.get(Tt);var Ir=Te.get(Tt);Nr<vt&&(vt=Nr),Nr>Qe&&(Qe=Nr),Ir<Ze&&(Ze=Ir),Ir>wt&&(wt=Ir)}}catch(An){gt=!0,xt=An}finally{try{!lt&&Rt.return&&Rt.return()}finally{if(gt)throw xt}}var cr=(vt+Qe)/2-(Ze+wt)/2,Mt=!0,Qt=!1,$r=void 0;try{for(var ar=Je[Symbol.iterator](),Wn;!(Mt=(Wn=ar.next()).done);Mt=!0){var Dn=Wn.value;Te.set(Dn,Te.get(Dn)+cr)}}catch(An){Qt=!0,$r=An}finally{try{!Mt&&ar.return&&ar.return()}finally{if(Qt)throw $r}}})}return Te},B=function(oe){var ue=0,se=0,he=0,pe=0;if(oe.forEach(function(Ne){Ne.left?S[b.get(Ne.left)]-S[b.get(Ne.right)]>=0?ue++:se++:N[b.get(Ne.top)]-N[b.get(Ne.bottom)]>=0?he++:pe++}),ue>se&&he>pe)for(var be=0;be<b.size;be++)S[be]=-1*S[be],N[be]=-1*N[be];else if(ue>se)for(var Se=0;Se<b.size;Se++)S[Se]=-1*S[Se];else if(he>pe)for(var Te=0;Te<b.size;Te++)N[Te]=-1*N[Te]},D=function(oe){var ue=[],se=new v,he=new Set,pe=0;return oe.forEach(function(be,Se){if(!he.has(Se)){ue[pe]=[];var Te=Se;for(se.push(Te),he.add(Te),ue[pe].push(Te);se.length!=0;){Te=se.shift();var Ne=oe.get(Te);Ne.forEach(function(He){he.has(He.id)||(se.push(He.id),he.add(He.id),ue[pe].push(He.id))})}pe++}}),ue},H=function(oe){var ue=new Map;return oe.forEach(function(se,he){ue.set(he,[])}),oe.forEach(function(se,he){se.forEach(function(pe){ue.get(he).push(pe),ue.get(pe.id).push({id:he,gap:pe.gap,direction:pe.direction})})}),ue},U=function(oe){var ue=new Map;return oe.forEach(function(se,he){ue.set(he,[])}),oe.forEach(function(se,he){se.forEach(function(pe){ue.get(pe.id).push({id:he,gap:pe.gap,direction:pe.direction})})}),ue},z=[],W=[],F=!1,P=!1,j=new Set,G=new Map,$=new Map,ee=[];if(m.fixedNodeConstraint&&m.fixedNodeConstraint.forEach(function(te){j.add(te.nodeId)}),m.relativePlacementConstraint&&(m.relativePlacementConstraint.forEach(function(te){te.left?(G.has(te.left)?G.get(te.left).push({id:te.right,gap:te.gap,direction:"horizontal"}):G.set(te.left,[{id:te.right,gap:te.gap,direction:"horizontal"}]),G.has(te.right)||G.set(te.right,[])):(G.has(te.top)?G.get(te.top).push({id:te.bottom,gap:te.gap,direction:"vertical"}):G.set(te.top,[{id:te.bottom,gap:te.gap,direction:"vertical"}]),G.has(te.bottom)||G.set(te.bottom,[]))}),$=H(G),ee=D($)),h.TRANSFORM_ON_CONSTRAINT_HANDLING){if(m.fixedNodeConstraint&&m.fixedNodeConstraint.length>1)m.fixedNodeConstraint.forEach(function(te,oe){z[oe]=[te.position.x,te.position.y],W[oe]=[S[b.get(te.nodeId)],N[b.get(te.nodeId)]]}),F=!0;else if(m.alignmentConstraint)(function(){var te=0;if(m.alignmentConstraint.vertical){for(var oe=m.alignmentConstraint.vertical,ue=function(Te){var Ne=new Set;oe[Te].forEach(function(Ge){Ne.add(Ge)});var He=new Set([].concat(c(Ne)).filter(function(Ge){return j.has(Ge)})),ze=void 0;He.size>0?ze=S[b.get(He.values().next().value)]:ze=I(Ne).x,oe[Te].forEach(function(Ge){z[te]=[ze,N[b.get(Ge)]],W[te]=[S[b.get(Ge)],N[b.get(Ge)]],te++})},se=0;se<oe.length;se++)ue(se);F=!0}if(m.alignmentConstraint.horizontal){for(var he=m.alignmentConstraint.horizontal,pe=function(Te){var Ne=new Set;he[Te].forEach(function(Ge){Ne.add(Ge)});var He=new Set([].concat(c(Ne)).filter(function(Ge){return j.has(Ge)})),ze=void 0;He.size>0?ze=S[b.get(He.values().next().value)]:ze=I(Ne).y,he[Te].forEach(function(Ge){z[te]=[S[b.get(Ge)],ze],W[te]=[S[b.get(Ge)],N[b.get(Ge)]],te++})},be=0;be<he.length;be++)pe(be);F=!0}m.relativePlacementConstraint&&(P=!0)})();else if(m.relativePlacementConstraint){for(var ae=0,ie=0,K=0;K<ee.length;K++)ee[K].length>ae&&(ae=ee[K].length,ie=K);if(ae<$.size/2)B(m.relativePlacementConstraint),F=!1,P=!1;else{var q=new Map,Y=new Map,X=[];ee[ie].forEach(function(te){G.get(te).forEach(function(oe){oe.direction=="horizontal"?(q.has(te)?q.get(te).push(oe):q.set(te,[oe]),q.has(oe.id)||q.set(oe.id,[]),X.push({left:te,right:oe.id})):(Y.has(te)?Y.get(te).push(oe):Y.set(te,[oe]),Y.has(oe.id)||Y.set(oe.id,[]),X.push({top:te,bottom:oe.id}))})}),B(X),P=!1;var J=M(q,"horizontal"),re=M(Y,"vertical");ee[ie].forEach(function(te,oe){W[oe]=[S[b.get(te)],N[b.get(te)]],z[oe]=[],J.has(te)?z[oe][0]=J.get(te):z[oe][0]=S[b.get(te)],re.has(te)?z[oe][1]=re.get(te):z[oe][1]=N[b.get(te)]}),F=!0}}if(F){for(var ce=void 0,de=d.transpose(z),Re=d.transpose(W),Pe=0;Pe<de.length;Pe++)de[Pe]=d.multGamma(de[Pe]),Re[Pe]=d.multGamma(Re[Pe]);var _e=d.multMat(de,d.transpose(Re)),ke=x.svd(_e);ce=d.multMat(ke.V,d.transpose(ke.U));for(var Le=0;Le<b.size;Le++){var Ee=[S[Le],N[Le]],Ie=[ce[0][0],ce[1][0]],Oe=[ce[0][1],ce[1][1]];S[Le]=d.dotProduct(Ee,Ie),N[Le]=d.dotProduct(Ee,Oe)}P&&B(m.relativePlacementConstraint)}}if(h.ENFORCE_CONSTRAINTS){if(m.fixedNodeConstraint&&m.fixedNodeConstraint.length>0){var De={x:0,y:0};m.fixedNodeConstraint.forEach(function(te,oe){var ue={x:S[b.get(te.nodeId)],y:N[b.get(te.nodeId)]},se=te.position,he=A(se,ue);De.x+=he.x,De.y+=he.y}),De.x/=m.fixedNodeConstraint.length,De.y/=m.fixedNodeConstraint.length,S.forEach(function(te,oe){S[oe]+=De.x}),N.forEach(function(te,oe){N[oe]+=De.y}),m.fixedNodeConstraint.forEach(function(te){S[b.get(te.nodeId)]=te.position.x,N[b.get(te.nodeId)]=te.position.y})}if(m.alignmentConstraint){if(m.alignmentConstraint.vertical)for(var We=m.alignmentConstraint.vertical,Ye=function(oe){var ue=new Set;We[oe].forEach(function(pe){ue.add(pe)});var se=new Set([].concat(c(ue)).filter(function(pe){return j.has(pe)})),he=void 0;se.size>0?he=S[b.get(se.values().next().value)]:he=I(ue).x,ue.forEach(function(pe){j.has(pe)||(S[b.get(pe)]=he)})},ge=0;ge<We.length;ge++)Ye(ge);if(m.alignmentConstraint.horizontal)for(var Ce=m.alignmentConstraint.horizontal,Ae=function(oe){var ue=new Set;Ce[oe].forEach(function(pe){ue.add(pe)});var se=new Set([].concat(c(ue)).filter(function(pe){return j.has(pe)})),he=void 0;se.size>0?he=N[b.get(se.values().next().value)]:he=I(ue).y,ue.forEach(function(pe){j.has(pe)||(N[b.get(pe)]=he)})},Fe=0;Fe<Ce.length;Fe++)Ae(Fe)}m.relativePlacementConstraint&&(function(){var te=new Map,oe=new Map,ue=new Map,se=new Map,he=new Map,pe=new Map,be=new Set,Se=new Set;if(j.forEach(function(Zt){be.add(Zt),Se.add(Zt)}),m.alignmentConstraint){if(m.alignmentConstraint.vertical)for(var Te=m.alignmentConstraint.vertical,Ne=function(nt){ue.set("dummy"+nt,[]),Te[nt].forEach(function(kt){te.set(kt,"dummy"+nt),ue.get("dummy"+nt).push(kt),j.has(kt)&&be.add("dummy"+nt)}),he.set("dummy"+nt,S[b.get(Te[nt][0])])},He=0;He<Te.length;He++)Ne(He);if(m.alignmentConstraint.horizontal)for(var ze=m.alignmentConstraint.horizontal,Ge=function(nt){se.set("dummy"+nt,[]),ze[nt].forEach(function(kt){oe.set(kt,"dummy"+nt),se.get("dummy"+nt).push(kt),j.has(kt)&&Se.add("dummy"+nt)}),pe.set("dummy"+nt,N[b.get(ze[nt][0])])},st=0;st<ze.length;st++)Ge(st)}var Je=new Map,qe=new Map,vt=function(nt){G.get(nt).forEach(function(kt){var tr=void 0,hr=void 0;kt.direction=="horizontal"?(tr=te.get(nt)?te.get(nt):nt,te.get(kt.id)?hr={id:te.get(kt.id),gap:kt.gap,direction:kt.direction}:hr=kt,Je.has(tr)?Je.get(tr).push(hr):Je.set(tr,[hr]),Je.has(hr.id)||Je.set(hr.id,[])):(tr=oe.get(nt)?oe.get(nt):nt,oe.get(kt.id)?hr={id:oe.get(kt.id),gap:kt.gap,direction:kt.direction}:hr=kt,qe.has(tr)?qe.get(tr).push(hr):qe.set(tr,[hr]),qe.has(hr.id)||qe.set(hr.id,[]))})},Ze=!0,Qe=!1,wt=void 0;try{for(var lt=G.keys()[Symbol.iterator](),gt;!(Ze=(gt=lt.next()).done);Ze=!0){var xt=gt.value;vt(xt)}}catch(Zt){Qe=!0,wt=Zt}finally{try{!Ze&&lt.return&&lt.return()}finally{if(Qe)throw wt}}var Rt=H(Je),Ot=H(qe),Tt=D(Rt),Nr=D(Ot),Ir=U(Je),cr=U(qe),Mt=[],Qt=[];Tt.forEach(function(Zt,nt){Mt[nt]=[],Zt.forEach(function(kt){Ir.get(kt).length==0&&Mt[nt].push(kt)})}),Nr.forEach(function(Zt,nt){Qt[nt]=[],Zt.forEach(function(kt){cr.get(kt).length==0&&Qt[nt].push(kt)})});var $r=M(Je,"horizontal",be,he,Mt),ar=M(qe,"vertical",Se,pe,Qt),Wn=function(nt){ue.get(nt)?ue.get(nt).forEach(function(kt){S[b.get(kt)]=$r.get(nt)}):S[b.get(nt)]=$r.get(nt)},Dn=!0,An=!1,ha=void 0;try{for(var fa=$r.keys()[Symbol.iterator](),qa;!(Dn=(qa=fa.next()).done);Dn=!0){var Ht=qa.value;Wn(Ht)}}catch(Zt){An=!0,ha=Zt}finally{try{!Dn&&fa.return&&fa.return()}finally{if(An)throw ha}}var ro=function(nt){se.get(nt)?se.get(nt).forEach(function(kt){N[b.get(kt)]=ar.get(nt)}):N[b.get(nt)]=ar.get(nt)},cn=!0,ai=!1,bn=void 0;try{for(var wi=ar.keys()[Symbol.iterator](),_i;!(cn=(_i=wi.next()).done);cn=!0){var Ht=_i.value;ro(Ht)}}catch(Zt){ai=!0,bn=Zt}finally{try{!cn&&wi.return&&wi.return()}finally{if(ai)throw bn}}})()}for(var me=0;me<E.length;me++){var Z=E[me];Z.getChild()==null&&Z.setCenter(S[b.get(Z.id)],N[b.get(Z.id)])}},a.exports=w}),551:(a=>{a.exports=r})},i={};function s(a){var l=i[a];if(l!==void 0)return l.exports;var u=i[a]={exports:{}};return n[a](u,u.exports,s),u.exports}var o=s(45);return o})()})})(_c)),_c.exports}var JD=wc.exports,X1;function eA(){return X1||(X1=1,(function(t,e){(function(n,i){t.exports=i(ZD())})(JD,function(r){return(()=>{var n={658:(a=>{a.exports=Object.assign!=null?Object.assign.bind(Object):function(l){for(var u=arguments.length,c=Array(u>1?u-1:0),h=1;h<u;h++)c[h-1]=arguments[h];return c.forEach(function(v){Object.keys(v).forEach(function(d){return l[d]=v[d]})}),l}}),548:((a,l,u)=>{var c=(function(){function d(x,w){var g=[],m=!0,y=!1,b=void 0;try{for(var S=x[Symbol.iterator](),N;!(m=(N=S.next()).done)&&(g.push(N.value),!(w&&g.length===w));m=!0);}catch(E){y=!0,b=E}finally{try{!m&&S.return&&S.return()}finally{if(y)throw b}}return g}return function(x,w){if(Array.isArray(x))return x;if(Symbol.iterator in Object(x))return d(x,w);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),h=u(140).layoutBase.LinkedList,v={};v.getTopMostNodes=function(d){for(var x={},w=0;w<d.length;w++)x[d[w].id()]=!0;var g=d.filter(function(m,y){typeof m=="number"&&(m=y);for(var b=m.parent()[0];b!=null;){if(x[b.id()])return!1;b=b.parent()[0]}return!0});return g},v.connectComponents=function(d,x,w,g){var m=new h,y=new Set,b=[],S=void 0,N=void 0,E=void 0,T=!1,k=1,L=[],A=[],I=function(){var B=d.collection();A.push(B);var D=w[0],H=d.collection();H.merge(D).merge(D.descendants().intersection(x)),b.push(D),H.forEach(function(W){m.push(W),y.add(W),B.merge(W)});for(var U=function(){D=m.shift();var F=d.collection();D.neighborhood().nodes().forEach(function($){x.intersection(D.edgesWith($)).length>0&&F.merge($)});for(var P=0;P<F.length;P++){var j=F[P];if(S=w.intersection(j.union(j.ancestors())),S!=null&&!y.has(S[0])){var G=S.union(S.descendants());G.forEach(function($){m.push($),y.add($),B.merge($),w.has($)&&b.push($)})}}};m.length!=0;)U();if(B.forEach(function(W){x.intersection(W.connectedEdges()).forEach(function(F){B.has(F.source())&&B.has(F.target())&&B.merge(F)})}),b.length==w.length&&(T=!0),!T||T&&k>1){N=b[0],E=N.connectedEdges().length,b.forEach(function(W){W.connectedEdges().length<E&&(E=W.connectedEdges().length,N=W)}),L.push(N.id());var z=d.collection();z.merge(b[0]),b.forEach(function(W){z.merge(W)}),b=[],w=w.difference(z),k++}};do I();while(!T);return g&&L.length>0&&g.set("dummy"+(g.size+1),L),A},v.relocateComponent=function(d,x,w){if(!w.fixedNodeConstraint){var g=Number.POSITIVE_INFINITY,m=Number.NEGATIVE_INFINITY,y=Number.POSITIVE_INFINITY,b=Number.NEGATIVE_INFINITY;if(w.quality=="draft"){var S=!0,N=!1,E=void 0;try{for(var T=x.nodeIndexes[Symbol.iterator](),k;!(S=(k=T.next()).done);S=!0){var L=k.value,A=c(L,2),I=A[0],M=A[1],B=w.cy.getElementById(I);if(B){var D=B.boundingBox(),H=x.xCoords[M]-D.w/2,U=x.xCoords[M]+D.w/2,z=x.yCoords[M]-D.h/2,W=x.yCoords[M]+D.h/2;H<g&&(g=H),U>m&&(m=U),z<y&&(y=z),W>b&&(b=W)}}}catch($){N=!0,E=$}finally{try{!S&&T.return&&T.return()}finally{if(N)throw E}}var F=d.x-(m+g)/2,P=d.y-(b+y)/2;x.xCoords=x.xCoords.map(function($){return $+F}),x.yCoords=x.yCoords.map(function($){return $+P})}else{Object.keys(x).forEach(function($){var ee=x[$],ae=ee.getRect().x,ie=ee.getRect().x+ee.getRect().width,K=ee.getRect().y,q=ee.getRect().y+ee.getRect().height;ae<g&&(g=ae),ie>m&&(m=ie),K<y&&(y=K),q>b&&(b=q)});var j=d.x-(m+g)/2,G=d.y-(b+y)/2;Object.keys(x).forEach(function($){var ee=x[$];ee.setCenter(ee.getCenterX()+j,ee.getCenterY()+G)})}}},v.calcBoundingBox=function(d,x,w,g){for(var m=Number.MAX_SAFE_INTEGER,y=Number.MIN_SAFE_INTEGER,b=Number.MAX_SAFE_INTEGER,S=Number.MIN_SAFE_INTEGER,N=void 0,E=void 0,T=void 0,k=void 0,L=d.descendants().not(":parent"),A=L.length,I=0;I<A;I++){var M=L[I];N=x[g.get(M.id())]-M.width()/2,E=x[g.get(M.id())]+M.width()/2,T=w[g.get(M.id())]-M.height()/2,k=w[g.get(M.id())]+M.height()/2,m>N&&(m=N),y<E&&(y=E),b>T&&(b=T),S<k&&(S=k)}var B={};return B.topLeftX=m,B.topLeftY=b,B.width=y-m,B.height=S-b,B},v.calcParentsWithoutChildren=function(d,x){var w=d.collection();return x.nodes(":parent").forEach(function(g){var m=!1;g.children().forEach(function(y){y.css("display")!="none"&&(m=!0)}),m||w.merge(g)}),w},a.exports=v}),816:((a,l,u)=>{var c=u(548),h=u(140).CoSELayout,v=u(140).CoSENode,d=u(140).layoutBase.PointD,x=u(140).layoutBase.DimensionD,w=u(140).layoutBase.LayoutConstants,g=u(140).layoutBase.FDLayoutConstants,m=u(140).CoSEConstants,y=function(S,N){var E=S.cy,T=S.eles,k=T.nodes(),L=T.edges(),A=void 0,I=void 0,M=void 0,B={};S.randomize&&(A=N.nodeIndexes,I=N.xCoords,M=N.yCoords);var D=function($){return typeof $=="function"},H=function($,ee){return D($)?$(ee):$},U=c.calcParentsWithoutChildren(E,T),z=function G($,ee,ae,ie){for(var K=ee.length,q=0;q<K;q++){var Y=ee[q],X=null;Y.intersection(U).length==0&&(X=Y.children());var J=void 0,re=Y.layoutDimensions({nodeDimensionsIncludeLabels:ie.nodeDimensionsIncludeLabels});if(Y.outerWidth()!=null&&Y.outerHeight()!=null)if(ie.randomize)if(!Y.isParent())J=$.add(new v(ae.graphManager,new d(I[A.get(Y.id())]-re.w/2,M[A.get(Y.id())]-re.h/2),new x(parseFloat(re.w),parseFloat(re.h))));else{var ce=c.calcBoundingBox(Y,I,M,A);Y.intersection(U).length==0?J=$.add(new v(ae.graphManager,new d(ce.topLeftX,ce.topLeftY),new x(ce.width,ce.height))):J=$.add(new v(ae.graphManager,new d(ce.topLeftX,ce.topLeftY),new x(parseFloat(re.w),parseFloat(re.h))))}else J=$.add(new v(ae.graphManager,new d(Y.position("x")-re.w/2,Y.position("y")-re.h/2),new x(parseFloat(re.w),parseFloat(re.h))));else J=$.add(new v(this.graphManager));if(J.id=Y.data("id"),J.nodeRepulsion=H(ie.nodeRepulsion,Y),J.paddingLeft=parseInt(Y.css("padding")),J.paddingTop=parseInt(Y.css("padding")),J.paddingRight=parseInt(Y.css("padding")),J.paddingBottom=parseInt(Y.css("padding")),ie.nodeDimensionsIncludeLabels&&(J.labelWidth=Y.boundingBox({includeLabels:!0,includeNodes:!1,includeOverlays:!1}).w,J.labelHeight=Y.boundingBox({includeLabels:!0,includeNodes:!1,includeOverlays:!1}).h,J.labelPosVertical=Y.css("text-valign"),J.labelPosHorizontal=Y.css("text-halign")),B[Y.data("id")]=J,isNaN(J.rect.x)&&(J.rect.x=0),isNaN(J.rect.y)&&(J.rect.y=0),X!=null&&X.length>0){var de=void 0;de=ae.getGraphManager().add(ae.newGraph(),J),G(de,X,ae,ie)}}},W=function($,ee,ae){for(var ie=0,K=0,q=0;q<ae.length;q++){var Y=ae[q],X=B[Y.data("source")],J=B[Y.data("target")];if(X&&J&&X!==J&&X.getEdgesBetween(J).length==0){var re=ee.add($.newEdge(),X,J);re.id=Y.id(),re.idealLength=H(S.idealEdgeLength,Y),re.edgeElasticity=H(S.edgeElasticity,Y),ie+=re.idealLength,K++}}S.idealEdgeLength!=null&&(K>0?m.DEFAULT_EDGE_LENGTH=g.DEFAULT_EDGE_LENGTH=ie/K:D(S.idealEdgeLength)?m.DEFAULT_EDGE_LENGTH=g.DEFAULT_EDGE_LENGTH=50:m.DEFAULT_EDGE_LENGTH=g.DEFAULT_EDGE_LENGTH=S.idealEdgeLength,m.MIN_REPULSION_DIST=g.MIN_REPULSION_DIST=g.DEFAULT_EDGE_LENGTH/10,m.DEFAULT_RADIAL_SEPARATION=g.DEFAULT_EDGE_LENGTH)},F=function($,ee){ee.fixedNodeConstraint&&($.constraints.fixedNodeConstraint=ee.fixedNodeConstraint),ee.alignmentConstraint&&($.constraints.alignmentConstraint=ee.alignmentConstraint),ee.relativePlacementConstraint&&($.constraints.relativePlacementConstraint=ee.relativePlacementConstraint)};S.nestingFactor!=null&&(m.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=g.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=S.nestingFactor),S.gravity!=null&&(m.DEFAULT_GRAVITY_STRENGTH=g.DEFAULT_GRAVITY_STRENGTH=S.gravity),S.numIter!=null&&(m.MAX_ITERATIONS=g.MAX_ITERATIONS=S.numIter),S.gravityRange!=null&&(m.DEFAULT_GRAVITY_RANGE_FACTOR=g.DEFAULT_GRAVITY_RANGE_FACTOR=S.gravityRange),S.gravityCompound!=null&&(m.DEFAULT_COMPOUND_GRAVITY_STRENGTH=g.DEFAULT_COMPOUND_GRAVITY_STRENGTH=S.gravityCompound),S.gravityRangeCompound!=null&&(m.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=g.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=S.gravityRangeCompound),S.initialEnergyOnIncremental!=null&&(m.DEFAULT_COOLING_FACTOR_INCREMENTAL=g.DEFAULT_COOLING_FACTOR_INCREMENTAL=S.initialEnergyOnIncremental),S.tilingCompareBy!=null&&(m.TILING_COMPARE_BY=S.tilingCompareBy),S.quality=="proof"?w.QUALITY=2:w.QUALITY=0,m.NODE_DIMENSIONS_INCLUDE_LABELS=g.NODE_DIMENSIONS_INCLUDE_LABELS=w.NODE_DIMENSIONS_INCLUDE_LABELS=S.nodeDimensionsIncludeLabels,m.DEFAULT_INCREMENTAL=g.DEFAULT_INCREMENTAL=w.DEFAULT_INCREMENTAL=!S.randomize,m.ANIMATE=g.ANIMATE=w.ANIMATE=S.animate,m.TILE=S.tile,m.TILING_PADDING_VERTICAL=typeof S.tilingPaddingVertical=="function"?S.tilingPaddingVertical.call():S.tilingPaddingVertical,m.TILING_PADDING_HORIZONTAL=typeof S.tilingPaddingHorizontal=="function"?S.tilingPaddingHorizontal.call():S.tilingPaddingHorizontal,m.DEFAULT_INCREMENTAL=g.DEFAULT_INCREMENTAL=w.DEFAULT_INCREMENTAL=!0,m.PURE_INCREMENTAL=!S.randomize,w.DEFAULT_UNIFORM_LEAF_NODE_SIZES=S.uniformNodeDimensions,S.step=="transformed"&&(m.TRANSFORM_ON_CONSTRAINT_HANDLING=!0,m.ENFORCE_CONSTRAINTS=!1,m.APPLY_LAYOUT=!1),S.step=="enforced"&&(m.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,m.ENFORCE_CONSTRAINTS=!0,m.APPLY_LAYOUT=!1),S.step=="cose"&&(m.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,m.ENFORCE_CONSTRAINTS=!1,m.APPLY_LAYOUT=!0),S.step=="all"&&(S.randomize?m.TRANSFORM_ON_CONSTRAINT_HANDLING=!0:m.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,m.ENFORCE_CONSTRAINTS=!0,m.APPLY_LAYOUT=!0),S.fixedNodeConstraint||S.alignmentConstraint||S.relativePlacementConstraint?m.TREE_REDUCTION_ON_INCREMENTAL=!1:m.TREE_REDUCTION_ON_INCREMENTAL=!0;var P=new h,j=P.newGraphManager();return z(j.addRoot(),c.getTopMostNodes(k),P,S),W(P,j,L),F(P,S),P.runLayout(),B};a.exports={coseLayout:y}}),212:((a,l,u)=>{var c=(function(){function S(N,E){for(var T=0;T<E.length;T++){var k=E[T];k.enumerable=k.enumerable||!1,k.configurable=!0,"value"in k&&(k.writable=!0),Object.defineProperty(N,k.key,k)}}return function(N,E,T){return E&&S(N.prototype,E),T&&S(N,T),N}})();function h(S,N){if(!(S instanceof N))throw new TypeError("Cannot call a class as a function")}var v=u(658),d=u(548),x=u(657),w=x.spectralLayout,g=u(816),m=g.coseLayout,y=Object.freeze({quality:"default",randomize:!0,animate:!0,animationDuration:1e3,animationEasing:void 0,fit:!0,padding:30,nodeDimensionsIncludeLabels:!1,uniformNodeDimensions:!1,packComponents:!0,step:"all",samplingType:!0,sampleSize:25,nodeSeparation:75,piTol:1e-7,nodeRepulsion:function(N){return 4500},idealEdgeLength:function(N){return 50},edgeElasticity:function(N){return .45},nestingFactor:.1,gravity:.25,numIter:2500,tile:!0,tilingCompareBy:void 0,tilingPaddingVertical:10,tilingPaddingHorizontal:10,gravityRangeCompound:1.5,gravityCompound:1,gravityRange:3.8,initialEnergyOnIncremental:.3,fixedNodeConstraint:void 0,alignmentConstraint:void 0,relativePlacementConstraint:void 0,ready:function(){},stop:function(){}}),b=(function(){function S(N){h(this,S),this.options=v({},y,N)}return c(S,[{key:"run",value:function(){var E=this,T=this.options,k=T.cy,L=T.eles,A=[],I=[],M=void 0,B=[];T.fixedNodeConstraint&&(!Array.isArray(T.fixedNodeConstraint)||T.fixedNodeConstraint.length==0)&&(T.fixedNodeConstraint=void 0),T.alignmentConstraint&&(T.alignmentConstraint.vertical&&(!Array.isArray(T.alignmentConstraint.vertical)||T.alignmentConstraint.vertical.length==0)&&(T.alignmentConstraint.vertical=void 0),T.alignmentConstraint.horizontal&&(!Array.isArray(T.alignmentConstraint.horizontal)||T.alignmentConstraint.horizontal.length==0)&&(T.alignmentConstraint.horizontal=void 0)),T.relativePlacementConstraint&&(!Array.isArray(T.relativePlacementConstraint)||T.relativePlacementConstraint.length==0)&&(T.relativePlacementConstraint=void 0);var D=T.fixedNodeConstraint||T.alignmentConstraint||T.relativePlacementConstraint;D&&(T.tile=!1,T.packComponents=!1);var H=void 0,U=!1;if(k.layoutUtilities&&T.packComponents&&(H=k.layoutUtilities("get"),H||(H=k.layoutUtilities()),U=!0),L.nodes().length>0)if(U){var F=d.getTopMostNodes(T.eles.nodes());if(M=d.connectComponents(k,T.eles,F),M.forEach(function(_e){var ke=_e.boundingBox();B.push({x:ke.x1+ke.w/2,y:ke.y1+ke.h/2})}),T.randomize&&M.forEach(function(_e){T.eles=_e,A.push(w(T))}),T.quality=="default"||T.quality=="proof"){var P=k.collection();if(T.tile){var j=new Map,G=[],$=[],ee=0,ae={nodeIndexes:j,xCoords:G,yCoords:$},ie=[];if(M.forEach(function(_e,ke){_e.edges().length==0&&(_e.nodes().forEach(function(Le,Ee){P.merge(_e.nodes()[Ee]),Le.isParent()||(ae.nodeIndexes.set(_e.nodes()[Ee].id(),ee++),ae.xCoords.push(_e.nodes()[0].position().x),ae.yCoords.push(_e.nodes()[0].position().y))}),ie.push(ke))}),P.length>1){var K=P.boundingBox();B.push({x:K.x1+K.w/2,y:K.y1+K.h/2}),M.push(P),A.push(ae);for(var q=ie.length-1;q>=0;q--)M.splice(ie[q],1),A.splice(ie[q],1),B.splice(ie[q],1)}}M.forEach(function(_e,ke){T.eles=_e,I.push(m(T,A[ke])),d.relocateComponent(B[ke],I[ke],T)})}else M.forEach(function(_e,ke){d.relocateComponent(B[ke],A[ke],T)});var Y=new Set;if(M.length>1){var X=[],J=L.filter(function(_e){return _e.css("display")=="none"});M.forEach(function(_e,ke){var Le=void 0;if(T.quality=="draft"&&(Le=A[ke].nodeIndexes),_e.nodes().not(J).length>0){var Ee={};Ee.edges=[],Ee.nodes=[];var Ie=void 0;_e.nodes().not(J).forEach(function(Oe){if(T.quality=="draft")if(!Oe.isParent())Ie=Le.get(Oe.id()),Ee.nodes.push({x:A[ke].xCoords[Ie]-Oe.boundingbox().w/2,y:A[ke].yCoords[Ie]-Oe.boundingbox().h/2,width:Oe.boundingbox().w,height:Oe.boundingbox().h});else{var De=d.calcBoundingBox(Oe,A[ke].xCoords,A[ke].yCoords,Le);Ee.nodes.push({x:De.topLeftX,y:De.topLeftY,width:De.width,height:De.height})}else I[ke][Oe.id()]&&Ee.nodes.push({x:I[ke][Oe.id()].getLeft(),y:I[ke][Oe.id()].getTop(),width:I[ke][Oe.id()].getWidth(),height:I[ke][Oe.id()].getHeight()})}),_e.edges().forEach(function(Oe){var De=Oe.source(),We=Oe.target();if(De.css("display")!="none"&&We.css("display")!="none")if(T.quality=="draft"){var Ye=Le.get(De.id()),ge=Le.get(We.id()),Ce=[],Ae=[];if(De.isParent()){var Fe=d.calcBoundingBox(De,A[ke].xCoords,A[ke].yCoords,Le);Ce.push(Fe.topLeftX+Fe.width/2),Ce.push(Fe.topLeftY+Fe.height/2)}else Ce.push(A[ke].xCoords[Ye]),Ce.push(A[ke].yCoords[Ye]);if(We.isParent()){var me=d.calcBoundingBox(We,A[ke].xCoords,A[ke].yCoords,Le);Ae.push(me.topLeftX+me.width/2),Ae.push(me.topLeftY+me.height/2)}else Ae.push(A[ke].xCoords[ge]),Ae.push(A[ke].yCoords[ge]);Ee.edges.push({startX:Ce[0],startY:Ce[1],endX:Ae[0],endY:Ae[1]})}else I[ke][De.id()]&&I[ke][We.id()]&&Ee.edges.push({startX:I[ke][De.id()].getCenterX(),startY:I[ke][De.id()].getCenterY(),endX:I[ke][We.id()].getCenterX(),endY:I[ke][We.id()].getCenterY()})}),Ee.nodes.length>0&&(X.push(Ee),Y.add(ke))}});var re=H.packComponents(X,T.randomize).shifts;if(T.quality=="draft")A.forEach(function(_e,ke){var Le=_e.xCoords.map(function(Ie){return Ie+re[ke].dx}),Ee=_e.yCoords.map(function(Ie){return Ie+re[ke].dy});_e.xCoords=Le,_e.yCoords=Ee});else{var ce=0;Y.forEach(function(_e){Object.keys(I[_e]).forEach(function(ke){var Le=I[_e][ke];Le.setCenter(Le.getCenterX()+re[ce].dx,Le.getCenterY()+re[ce].dy)}),ce++})}}}else{var z=T.eles.boundingBox();if(B.push({x:z.x1+z.w/2,y:z.y1+z.h/2}),T.randomize){var W=w(T);A.push(W)}T.quality=="default"||T.quality=="proof"?(I.push(m(T,A[0])),d.relocateComponent(B[0],I[0],T)):d.relocateComponent(B[0],A[0],T)}var de=function(ke,Le){if(T.quality=="default"||T.quality=="proof"){typeof ke=="number"&&(ke=Le);var Ee=void 0,Ie=void 0,Oe=ke.data("id");return I.forEach(function(We){Oe in We&&(Ee={x:We[Oe].getRect().getCenterX(),y:We[Oe].getRect().getCenterY()},Ie=We[Oe])}),T.nodeDimensionsIncludeLabels&&(Ie.labelWidth&&(Ie.labelPosHorizontal=="left"?Ee.x+=Ie.labelWidth/2:Ie.labelPosHorizontal=="right"&&(Ee.x-=Ie.labelWidth/2)),Ie.labelHeight&&(Ie.labelPosVertical=="top"?Ee.y+=Ie.labelHeight/2:Ie.labelPosVertical=="bottom"&&(Ee.y-=Ie.labelHeight/2))),Ee==null&&(Ee={x:ke.position("x"),y:ke.position("y")}),{x:Ee.x,y:Ee.y}}else{var De=void 0;return A.forEach(function(We){var Ye=We.nodeIndexes.get(ke.id());Ye!=null&&(De={x:We.xCoords[Ye],y:We.yCoords[Ye]})}),De==null&&(De={x:ke.position("x"),y:ke.position("y")}),{x:De.x,y:De.y}}};if(T.quality=="default"||T.quality=="proof"||T.randomize){var Re=d.calcParentsWithoutChildren(k,L),Pe=L.filter(function(_e){return _e.css("display")=="none"});T.eles=L.not(Pe),L.nodes().not(":parent").not(Pe).layoutPositions(E,T,de),Re.length>0&&Re.forEach(function(_e){_e.position(de(_e))})}else console.log("If randomize option is set to false, then quality option must be 'default' or 'proof'.")}}]),S})();a.exports=b}),657:((a,l,u)=>{var c=u(548),h=u(140).layoutBase.Matrix,v=u(140).layoutBase.SVD,d=function(w){var g=w.cy,m=w.eles,y=m.nodes(),b=m.nodes(":parent"),S=new Map,N=new Map,E=new Map,T=[],k=[],L=[],A=[],I=[],M=[],B=[],D=[],H=void 0,U=1e8,z=1e-9,W=w.piTol,F=w.samplingType,P=w.nodeSeparation,j=void 0,G=function(){for(var oe=0,ue=0,se=!1;ue<j;){oe=Math.floor(Math.random()*H),se=!1;for(var he=0;he<ue;he++)if(A[he]==oe){se=!0;break}if(!se)A[ue]=oe,ue++;else continue}},$=function(oe,ue,se){for(var he=[],pe=0,be=0,Se=0,Te=void 0,Ne=[],He=0,ze=1,Ge=0;Ge<H;Ge++)Ne[Ge]=U;for(he[be]=oe,Ne[oe]=0;be>=pe;){Se=he[pe++];for(var st=T[Se],Je=0;Je<st.length;Je++)Te=N.get(st[Je]),Ne[Te]==U&&(Ne[Te]=Ne[Se]+1,he[++be]=Te);M[Se][ue]=Ne[Se]*P}if(se){for(var qe=0;qe<H;qe++)M[qe][ue]<I[qe]&&(I[qe]=M[qe][ue]);for(var vt=0;vt<H;vt++)I[vt]>He&&(He=I[vt],ze=vt)}return ze},ee=function(oe){var ue=void 0;if(oe){ue=Math.floor(Math.random()*H);for(var he=0;he<H;he++)I[he]=U;for(var pe=0;pe<j;pe++)A[pe]=ue,ue=$(ue,pe,oe)}else{G();for(var se=0;se<j;se++)$(A[se],se,oe)}for(var be=0;be<H;be++)for(var Se=0;Se<j;Se++)M[be][Se]*=M[be][Se];for(var Te=0;Te<j;Te++)B[Te]=[];for(var Ne=0;Ne<j;Ne++)for(var He=0;He<j;He++)B[Ne][He]=M[A[He]][Ne]},ae=function(){for(var oe=v.svd(B),ue=oe.S,se=oe.U,he=oe.V,pe=ue[0]*ue[0]*ue[0],be=[],Se=0;Se<j;Se++){be[Se]=[];for(var Te=0;Te<j;Te++)be[Se][Te]=0,Se==Te&&(be[Se][Te]=ue[Se]/(ue[Se]*ue[Se]+pe/(ue[Se]*ue[Se])))}D=h.multMat(h.multMat(he,be),h.transpose(se))},ie=function(){for(var oe=void 0,ue=void 0,se=[],he=[],pe=[],be=[],Se=0;Se<H;Se++)se[Se]=Math.random(),he[Se]=Math.random();se=h.normalize(se),he=h.normalize(he);for(var Te=z,Ne=z,He=void 0;;){for(var ze=0;ze<H;ze++)pe[ze]=se[ze];if(se=h.multGamma(h.multL(h.multGamma(pe),M,D)),oe=h.dotProduct(pe,se),se=h.normalize(se),Te=h.dotProduct(pe,se),He=Math.abs(Te/Ne),He<=1+W&&He>=1)break;Ne=Te}for(var Ge=0;Ge<H;Ge++)pe[Ge]=se[Ge];for(Ne=z;;){for(var st=0;st<H;st++)be[st]=he[st];if(be=h.minusOp(be,h.multCons(pe,h.dotProduct(pe,be))),he=h.multGamma(h.multL(h.multGamma(be),M,D)),ue=h.dotProduct(be,he),he=h.normalize(he),Te=h.dotProduct(be,he),He=Math.abs(Te/Ne),He<=1+W&&He>=1)break;Ne=Te}for(var Je=0;Je<H;Je++)be[Je]=he[Je];k=h.multCons(pe,Math.sqrt(Math.abs(oe))),L=h.multCons(be,Math.sqrt(Math.abs(ue)))};c.connectComponents(g,m,c.getTopMostNodes(y),S),b.forEach(function(te){c.connectComponents(g,m,c.getTopMostNodes(te.descendants().intersection(m)),S)});for(var K=0,q=0;q<y.length;q++)y[q].isParent()||N.set(y[q].id(),K++);var Y=!0,X=!1,J=void 0;try{for(var re=S.keys()[Symbol.iterator](),ce;!(Y=(ce=re.next()).done);Y=!0){var de=ce.value;N.set(de,K++)}}catch(te){X=!0,J=te}finally{try{!Y&&re.return&&re.return()}finally{if(X)throw J}}for(var Re=0;Re<N.size;Re++)T[Re]=[];b.forEach(function(te){for(var oe=te.children().intersection(m);oe.nodes(":childless").length==0;)oe=oe.nodes()[0].children().intersection(m);var ue=0,se=oe.nodes(":childless")[0].connectedEdges().length;oe.nodes(":childless").forEach(function(he,pe){he.connectedEdges().length<se&&(se=he.connectedEdges().length,ue=pe)}),E.set(te.id(),oe.nodes(":childless")[ue].id())}),y.forEach(function(te){var oe=void 0;te.isParent()?oe=N.get(E.get(te.id())):oe=N.get(te.id()),te.neighborhood().nodes().forEach(function(ue){m.intersection(te.edgesWith(ue)).length>0&&(ue.isParent()?T[oe].push(E.get(ue.id())):T[oe].push(ue.id()))})});var Pe=function(oe){var ue=N.get(oe),se=void 0;S.get(oe).forEach(function(he){g.getElementById(he).isParent()?se=E.get(he):se=he,T[ue].push(se),T[N.get(se)].push(oe)})},_e=!0,ke=!1,Le=void 0;try{for(var Ee=S.keys()[Symbol.iterator](),Ie;!(_e=(Ie=Ee.next()).done);_e=!0){var Oe=Ie.value;Pe(Oe)}}catch(te){ke=!0,Le=te}finally{try{!_e&&Ee.return&&Ee.return()}finally{if(ke)throw Le}}H=N.size;var De=void 0;if(H>2){j=H<w.sampleSize?H:w.sampleSize;for(var We=0;We<H;We++)M[We]=[];for(var Ye=0;Ye<j;Ye++)D[Ye]=[];return w.quality=="draft"||w.step=="all"?(ee(F),ae(),ie(),De={nodeIndexes:N,xCoords:k,yCoords:L}):(N.forEach(function(te,oe){k.push(g.getElementById(oe).position("x")),L.push(g.getElementById(oe).position("y"))}),De={nodeIndexes:N,xCoords:k,yCoords:L}),De}else{var ge=N.keys(),Ce=g.getElementById(ge.next().value),Ae=Ce.position(),Fe=Ce.outerWidth();if(k.push(Ae.x),L.push(Ae.y),H==2){var me=g.getElementById(ge.next().value),Z=me.outerWidth();k.push(Ae.x+Fe/2+Z/2+w.idealEdgeLength),L.push(Ae.y)}return De={nodeIndexes:N,xCoords:k,yCoords:L},De}};a.exports={spectralLayout:d}}),579:((a,l,u)=>{var c=u(212),h=function(d){d&&d("layout","fcose",c)};typeof cytoscape<"u"&&h(cytoscape),a.exports=h}),140:(a=>{a.exports=r})},i={};function s(a){var l=i[a];if(l!==void 0)return l.exports;var u=i[a]={exports:{}};return n[a](u,u.exports,s),u.exports}var o=s(579);return o})()})})(wc)),wc.exports}var tA=eA();const rA=Vc(tA);ia.use(rA);const nA={function:"#10b981",method:"#10b981",constructor:"#10b981",class:"#f97316",struct:"#f97316",interface:"#3b82f6",type_alias:"#3b82f6",trait:"#3b82f6",enum:"#8b5cf6",macro:"#a855f7"},iA={typescript:"#10b981",javascript:"#10b981",rust:"#f97316",python:"#3b82f6",go:"#06b6d4"};function aA(t){var e,r;return nA[(e=t.kind)==null?void 0:e.toLowerCase()]??iA[(r=t.lang)==null?void 0:r.toLowerCase()]??"#9ca3af"}function sA(t){return Math.round(Math.min(20+Math.sqrt(t)*6,60))}function eS({nodes:t,edges:e,externalSelectedId:r,onNodeClick:n,onNodeSelect:i}){const s=ne.useRef(null),[o,a]=ne.useState(null),l=ne.useRef(new Map),u=ne.useRef(n),c=ne.useRef(i);return ne.useEffect(()=>{u.current=n,c.current=i},[n,i]),ne.useEffect(()=>{if(!s.current)return;const h=new Map(t.map((x,w)=>[x.id,`n${w}`]));l.current=h;const v=[...t.map(x=>({group:"nodes",data:{id:h.get(x.id),label:x.name||x.id.split("/").pop()||x.id,color:aA(x),size:sA(x.inDeg),kind:x.kind,file:x.file,inDeg:x.inDeg,outDeg:x.outDeg,raw:x}})),...e.filter(x=>h.has(x.src)&&h.has(x.tgt)).map((x,w)=>({group:"edges",data:{id:`e${w}`,source:h.get(x.src),target:h.get(x.tgt)}}))],d=ia({container:s.current,elements:v,style:[{selector:"node",style:{"background-color":"data(color)",label:"data(label)","font-size":10,"font-family":"ui-monospace, SFMono-Regular, Menlo, monospace",color:"#ffffff","text-valign":"center","text-halign":"center","text-outline-color":"data(color)","text-outline-width":2,"text-max-width":"120px","text-wrap":"ellipsis",width:"data(size)",height:"data(size)","border-width":0,"overlay-padding":4}},{selector:"node:selected",style:{"border-width":3,"border-color":"#fbbf24","border-opacity":1}},{selector:"node.dimmed",style:{opacity:.15}},{selector:"node.highlighted",style:{opacity:1}},{selector:"edge",style:{width:1,"line-color":"#cbd5e1","target-arrow-color":"#94a3b8","target-arrow-shape":"triangle","arrow-scale":.7,"curve-style":"bezier",opacity:.5}},{selector:"edge.highlighted",style:{"line-color":"#fbbf24","target-arrow-color":"#fbbf24",opacity:.9,width:2}},{selector:"edge.dimmed",style:{opacity:.05}}],layout:{name:"fcose",animate:!1,quality:"default",randomize:!0,idealEdgeLength:120,nodeRepulsion:8e3,numIter:2500,nodeSeparation:60},wheelSensitivity:.3,minZoom:.1,maxZoom:4});return d.on("tap","node",x=>{var m,y;const w=x.target.data("raw");(m=u.current)==null||m.call(u,w),(y=c.current)==null||y.call(c,w),d.elements().removeClass("highlighted dimmed");const g=x.target.closedNeighborhood();d.elements().addClass("dimmed"),g.removeClass("dimmed").addClass("highlighted"),x.target.select()}),d.on("tap",x=>{var w;x.target===d&&(d.elements().removeClass("highlighted dimmed"),d.elements("node").unselect(),(w=c.current)==null||w.call(c,null))}),d.ready(()=>{d.destroyed()||d.fit(void 0,40)}),a(d),()=>{d.destroy(),a(null)}},[t,e]),ne.useEffect(()=>{if(o&&!o.destroyed()&&(o.elements("node").unselect(),o.elements().removeClass("highlighted dimmed"),r)){const h=l.current.get(r)??r,v=o.$id(h);if(v.length){v.select();const d=v.closedNeighborhood();o.elements().addClass("dimmed"),d.removeClass("dimmed").addClass("highlighted"),o.destroyed()||o.animate({fit:{eles:d,padding:60},duration:300})}}},[o,r]),_.jsx("div",{ref:s,className:"w-full h-full"})}const oA={function:"#10b981",method:"#10b981",constructor:"#10b981",class:"#f97316",struct:"#f97316",interface:"#3b82f6",type_alias:"#3b82f6",trait:"#3b82f6",enum:"#8b5cf6",macro:"#a855f7"},lA={typescript:"#10b981",javascript:"#10b981",rust:"#f97316",python:"#3b82f6",go:"#06b6d4"};function uA(t){var e,r;return oA[(e=t.kind)==null?void 0:e.toLowerCase()]??lA[(r=t.lang)==null?void 0:r.toLowerCase()]??"#9ca3af"}function cA({nodes:t,selectedId:e,onSelect:r}){var s;const n=[...t].sort((o,a)=>a.inDeg-o.inDeg).slice(0,40),i=((s=n[0])==null?void 0:s.inDeg)??1;return _.jsx("div",{className:"h-full flex flex-col overflow-hidden",style:{background:"#0f1419"},children:_.jsx("div",{className:"flex-1 overflow-y-auto",children:n.map((o,a)=>{const l=i>0?o.inDeg/i*100:0,u=uA(o),c=o.id===e,h=o.name||o.id.split("/").pop()||o.id,v=o.file?o.file.split("/").slice(-2).join("/"):"";return _.jsxs("button",{type:"button",onClick:()=>r==null?void 0:r(o),className:"w-full text-left px-4 py-2.5 relative transition-colors border-b",style:{borderColor:"rgba(230,237,243,0.06)",background:c?"rgba(63,185,80,0.08)":"transparent"},onMouseEnter:d=>{c||(d.currentTarget.style.background="rgba(230,237,243,0.04)")},onMouseLeave:d=>{c||(d.currentTarget.style.background="transparent")},children:[_.jsx("div",{className:"absolute inset-y-0 left-0 pointer-events-none",style:{width:`${l}%`,backgroundColor:u,opacity:c?.18:.1}}),_.jsxs("div",{className:"relative flex items-center gap-2",children:[_.jsx("span",{className:"text-[10px] tabular-nums w-5 text-right shrink-0 font-mono",style:{color:"rgba(230,237,243,0.25)"},children:a+1}),_.jsx("span",{className:"w-2 h-2 rounded-full shrink-0",style:{backgroundColor:u}}),_.jsxs("span",{className:"flex-1 min-w-0 flex flex-col",children:[_.jsx("span",{className:"font-mono text-[11px] truncate font-medium",style:{color:"#e6edf3"},title:o.name||o.id,children:h}),v&&_.jsxs("span",{className:"text-[9px] truncate font-mono",style:{color:"rgba(230,237,243,0.35)"},children:[o.kind&&_.jsx("span",{style:{color:"rgba(230,237,243,0.45)",marginRight:"4px"},children:o.kind}),v]})]}),_.jsx("span",{className:"shrink-0 text-[11px] font-semibold tabular-nums ml-2 font-mono",style:{color:c?"#3fb950":"rgba(230,237,243,0.6)"},children:o.inDeg})]})]},o.id)})})})}const Me={canvas:"#0d1117",canvas2:"#161c26",surface:"#1b222e",surface2:"#0f1419",ink:"#e6edf3",muted:"rgba(230,237,243,0.55)",faint:"rgba(230,237,243,0.24)",hairline:"rgba(230,237,243,0.07)",hairlineS:"rgba(230,237,243,0.14)",accent:"#ffda19",accentInk:"#0d1117",link:"#79c0ff",ok:"#3fb950",deny:"#f85149",blue:"#1c4053",blue2:"#182f3c"},hA={function:"#10b981",method:"#10b981",constructor:"#10b981",class:"#f97316",struct:"#f97316",interface:"#3b82f6",type_alias:"#3b82f6",trait:"#3b82f6",enum:"#8b5cf6",macro:"#a855f7"},fA={typescript:"#10b981",javascript:"#10b981",rust:"#f97316",python:"#3b82f6",go:"#06b6d4"};function dA(t){var e,r;return hA[(e=t.kind)==null?void 0:e.toLowerCase()]??fA[(r=t.lang)==null?void 0:r.toLowerCase()]??"#9ca3af"}function pA({node:t,edges:e,onClose:r,onBlast:n,onExpand:i,blast:s,blastBusy:o,expandBusy:a,onFocusDependent:l}){const u=e.filter(d=>d.tgt===t.id),c=e.filter(d=>d.src===t.id),h=dA(t);function v(d){const x=d.split("/");return x[x.length-1]??d}return _.jsxs("div",{className:"w-64 shrink-0 flex flex-col border-l overflow-hidden",style:{background:Me.canvas2,borderColor:Me.hairline},children:[_.jsxs("div",{className:"flex items-center gap-1.5 px-3 py-2 border-b shrink-0 min-w-0",style:{borderColor:Me.hairline},children:[_.jsx("span",{className:"w-2 h-2 rounded-full shrink-0",style:{backgroundColor:h}}),_.jsx("span",{className:"text-[11px] font-semibold truncate flex-1 font-mono",style:{color:Me.ink},title:t.name||t.id,children:t.name||t.id.split("/").pop()}),_.jsx("button",{type:"button",onClick:r,className:"shrink-0 leading-none text-base",style:{color:Me.faint},children:"×"})]}),_.jsxs("div",{className:"overflow-y-auto flex-1 p-3 flex flex-col gap-3 text-[11px]",children:[(n!==void 0||i!==void 0)&&_.jsxs("div",{className:"flex gap-2",children:[n!==void 0&&_.jsx("button",{type:"button",onClick:()=>n(t),disabled:o,className:"flex-1 px-2 py-1 rounded-lg text-[10px] font-mono font-semibold disabled:opacity-50",style:{background:"rgba(248,81,73,0.12)",color:Me.deny,border:`1px solid ${Me.hairline}`},children:o?"Computing…":"⚡ Blast radius"}),i!==void 0&&_.jsx("button",{type:"button",onClick:()=>i(t),disabled:a,className:"flex-1 px-2 py-1 rounded-lg text-[10px] font-mono font-semibold disabled:opacity-50",style:{background:"rgba(121,192,255,0.12)",color:Me.link,border:`1px solid ${Me.hairline}`},children:a?"Expanding…":"⤢ Expand neighbors"})]}),s!=null&&_.jsxs("div",{className:"flex flex-col gap-1",children:[_.jsxs("span",{className:"text-[10px] font-mono uppercase",style:{color:Me.faint},children:["blast radius · ",s.dependents.length," dependents"]}),s.unresolved>0&&_.jsxs("span",{className:"text-[10px] font-mono",style:{color:Me.deny},children:["+",s.unresolved," unresolved call(s) — impact may be larger"]}),s.unresolved===-1&&_.jsx("span",{className:"text-[10px] font-mono",style:{color:Me.deny},children:"blast radius failed to compute"}),_.jsxs("ul",{className:"flex flex-col gap-0.5 max-h-48 overflow-y-auto",children:[s.dependents.slice(0,30).map(d=>_.jsx("li",{children:_.jsxs("button",{type:"button",onClick:()=>l==null?void 0:l(d),className:"w-full text-left text-[10px] font-mono truncate hover:underline",style:{color:Me.link},title:`${d.file}:${d.line}`,children:[d.name," ",_.jsxs("span",{style:{color:Me.faint},children:["(",d.kind,")"]})]})},d.id)),s.dependents.length>30&&_.jsxs("li",{className:"text-[10px] font-mono",style:{color:Me.faint},children:["+",s.dependents.length-30," more"]})]})]}),t.kind&&_.jsxs("div",{className:"flex items-center gap-2",children:[_.jsx("span",{className:"px-1.5 py-0.5 rounded text-[9px] font-semibold uppercase",style:{background:Me.surface,color:Me.muted},children:t.kind}),_.jsx("span",{className:"capitalize font-mono",style:{color:Me.faint},children:t.lang||""})]}),t.file&&_.jsxs("div",{children:[_.jsx("p",{className:"text-[10px] mb-0.5 font-mono uppercase tracking-wide",style:{color:Me.faint},children:"File"}),_.jsx("p",{className:"font-mono text-[10px] break-all",style:{color:Me.muted},children:t.file})]}),_.jsxs("div",{className:"flex gap-4",children:[_.jsxs("div",{children:[_.jsx("p",{className:"text-[10px] font-mono uppercase tracking-wide mb-0.5",style:{color:Me.faint},children:"Callers"}),_.jsx("p",{className:"font-mono font-bold",style:{color:Me.ink},children:t.inDeg})]}),_.jsxs("div",{children:[_.jsx("p",{className:"text-[10px] font-mono uppercase tracking-wide mb-0.5",style:{color:Me.faint},children:"Calls"}),_.jsx("p",{className:"font-mono font-bold",style:{color:Me.ink},children:t.outDeg})]})]}),u.length>0&&_.jsxs("div",{children:[_.jsxs("p",{className:"text-[10px] font-mono uppercase tracking-wide mb-1",style:{color:Me.faint},children:["Called by (in view) ",_.jsx("span",{style:{color:Me.muted},children:u.length})]}),_.jsxs("div",{className:"flex flex-col gap-0.5",children:[u.slice(0,10).map(d=>_.jsx("p",{className:"font-mono text-[10px] truncate",style:{color:Me.muted},title:d.src,children:v(d.src)},d.src)),u.length>10&&_.jsxs("p",{className:"text-[10px] font-mono",style:{color:Me.faint},children:["+",u.length-10," more"]})]})]}),c.length>0&&_.jsxs("div",{children:[_.jsxs("p",{className:"text-[10px] font-mono uppercase tracking-wide mb-1",style:{color:Me.faint},children:["Calls (in view) ",_.jsx("span",{style:{color:Me.muted},children:c.length})]}),_.jsxs("div",{className:"flex flex-col gap-0.5",children:[c.slice(0,10).map(d=>_.jsx("p",{className:"font-mono text-[10px] truncate",style:{color:Me.muted},title:d.tgt,children:v(d.tgt)},d.tgt)),c.length>10&&_.jsxs("p",{className:"text-[10px] font-mono",style:{color:Me.faint},children:["+",c.length-10," more"]})]})]})]})]})}function vA({graph:t}){const[e,r]=ne.useState(""),[n,i]=ne.useState(null),{nodes:s,edges:o,reqCounts:a}=ne.useMemo(()=>{var y;const h=Object.keys(t.domains),v=new Set(h),d=new Map;for(const b of h)d.set(b,Object.keys(((y=t.domains[b])==null?void 0:y.requirements)??{}).length);const x=b=>{if(b==="(root)")return null;let S=b;for(;S.includes("/");)if(S=S.slice(0,S.lastIndexOf("/")),v.has(S))return S;return v.has("(root)")?"(root)":null},w=new Map,g=[];for(const b of h){const S=x(b);S!==null&&(g.push({src:S,tgt:b}),w.set(S,(w.get(S)??0)+1))}return{nodes:h.map(b=>({id:b,name:b==="(root)"?"(root)":b.slice(b.lastIndexOf("/")+1),kind:"domain",file:b,inDeg:Math.min(d.get(b)??0,60),outDeg:w.get(b)??0,lang:"domain"})),edges:g,reqCounts:d}},[t]),l=e.trim().toLowerCase(),u=ne.useMemo(()=>{if(l==="")return{nodes:s,edges:o};const h=new Set(s.filter(x=>{var w;return x.id.toLowerCase().includes(l)||Object.values(((w=t.domains[x.id])==null?void 0:w.requirements)??{}).some(g=>(g.title??"").toLowerCase().includes(l))}).map(x=>x.id)),v=new Set(h),d=new Map(o.map(x=>[x.tgt,x.src]));for(const x of h){let w=d.get(x);for(;w!==void 0&&!v.has(w);)v.add(w),w=d.get(w)}return{nodes:s.filter(x=>v.has(x.id)),edges:o.filter(x=>v.has(x.src)&&v.has(x.tgt))}},[s,o,l,t]),c=n!==null?t.domains[n]:void 0;return s.length===0?_.jsx("div",{className:"h-full overflow-y-auto p-4",children:_.jsx("p",{className:"text-sm text-center mt-8 font-mono",style:{color:Me.faint},children:"No domains in this graph."})}):_.jsxs("div",{className:"h-full flex flex-col",children:[_.jsxs("div",{className:"flex items-center gap-3 px-4 py-2 shrink-0 border-b",style:{borderColor:Me.hairline},children:[_.jsxs("span",{className:"text-[11px] font-mono shrink-0",style:{color:Me.muted},children:[s.length," domains · ",[...a.values()].reduce((h,v)=>h+v,0)," requirements"]}),_.jsx("input",{type:"text",value:e,onChange:h=>r(h.target.value),placeholder:"Filter domains + requirement titles…",className:"flex-1 text-[11px] font-mono px-3 py-1.5 rounded-lg border outline-none",style:{border:`1px solid ${Me.hairlineS}`,background:Me.canvas2,color:Me.ink}}),l!==""&&_.jsx("span",{className:"text-[10px] font-mono shrink-0",style:{color:Me.faint},children:u.nodes.length===1?"1 match":`${u.nodes.length} matches`})]}),_.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[_.jsx("div",{className:"flex-1 overflow-hidden",style:{background:Me.canvas},children:_.jsx(eS,{nodes:u.nodes,edges:u.edges,externalSelectedId:n,onNodeSelect:h=>i(h?h.id:null)})}),n!==null&&c&&_.jsx(gA,{domainId:n,domain:c,onClose:()=>i(null)})]})]})}function gA({domainId:t,domain:e,onClose:r}){const i=Object.entries(e.requirements??{});return _.jsxs("div",{className:"w-[380px] shrink-0 border-l flex flex-col",style:{borderColor:Me.hairlineS,background:Me.surface2},children:[_.jsxs("div",{className:"px-4 py-2.5 border-b flex items-center gap-2 shrink-0",style:{borderColor:Me.hairline,background:Me.canvas2},children:[_.jsx("span",{className:"text-[11px] font-semibold font-mono truncate",style:{color:Me.ink},children:t}),_.jsxs("span",{className:"text-[10px] font-mono ml-auto shrink-0",style:{color:Me.faint},children:[i.length," reqs"]}),_.jsx("button",{type:"button",onClick:r,"aria-label":"Close domain details",className:"text-sm shrink-0 px-1",style:{color:Me.muted},children:"×"})]}),_.jsxs("div",{className:"flex-1 overflow-y-auto",children:[e.description&&_.jsx("p",{className:"text-[11px] px-4 pt-3 pb-1",style:{color:Me.muted},children:e.description}),i.length===0?_.jsx("p",{className:"text-[11px] px-4 py-3 font-mono",style:{color:Me.faint},children:"No requirements recorded for this domain."}):_.jsxs("div",{className:"divide-y",style:{borderColor:Me.hairline},children:[i.slice(0,150).map(([s,o])=>_.jsxs("div",{className:"px-4 py-2.5",style:{borderColor:Me.hairline},children:[_.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[_.jsx("span",{className:"text-[10px] font-mono",style:{color:Me.faint},children:s}),o.status&&_.jsx("span",{className:"text-[9px] uppercase font-semibold px-1.5 py-0.5 rounded font-mono",style:{background:o.status==="active"?"rgba(63,185,80,0.15)":o.status==="deprecated"?"rgba(248,81,73,0.15)":Me.surface,color:o.status==="active"?Me.ok:o.status==="deprecated"?Me.deny:Me.muted},children:o.status})]}),_.jsx("p",{className:"text-[11px]",style:{color:Me.ink},children:o.title}),o.description&&o.description!==o.title&&_.jsx("p",{className:"text-[10px] mt-0.5",style:{color:Me.muted},children:o.description.slice(0,160)})]},s)),i.length>150&&_.jsxs("p",{className:"text-[10px] font-mono px-4 py-2",style:{color:Me.faint},children:["+",i.length-150," more requirements"]})]})]})]})}function K1(){return _.jsxs("div",{className:"flex items-center gap-1.5",children:[_.jsx("span",{className:"w-3 h-3 rounded-full",style:{background:Me.deny}}),_.jsx("span",{className:"w-3 h-3 rounded-full",style:{background:Me.accent}}),_.jsx("span",{className:"w-3 h-3 rounded-full",style:{background:Me.ok}})]})}function mA({repo:t,onClose:e,onSelectRun:r,initialFocus:n}){const[i,s]=ne.useState("graph"),[o,a]=ne.useState("code"),[l,u]=ne.useState(!0),[c,h]=ne.useState(null),[v,d]=ne.useState(null),[x,w]=ne.useState(null),[g,m]=ne.useState(!1),[y,b]=ne.useState(!1),[S,N]=ne.useState(null),[E,T]=ne.useState(null),[k,L]=ne.useState(null),[A,I]=ne.useState(!0);async function M(){b(!0),N(null);try{const{runId:Y}=await at.rerunOnboarding(t.id);r==null||r(Y),e()}catch(Y){N(Y instanceof Error?Y.message:String(Y)),b(!1)}}ne.useEffect(()=>{function Y(X){X.key==="Escape"&&e()}return document.addEventListener("keydown",Y),()=>document.removeEventListener("keydown",Y)},[e]),ne.useEffect(()=>{u(!0);const Y=n!=null&&n!==""?{focus:n,limit:120}:void 0;at.getRepoGraph(t.id,Y).then(({graph:X})=>{if(h(X),Y!==void 0&&X!==null){const J=X.nodes.find(re=>re.id===n||re.name===n);J&&(L(J),T(J.id))}}).catch(()=>h(null)).finally(()=>u(!1))},[t.id,n]),ne.useEffect(()=>{o!=="domain"||v!==null||(m(!0),at.getRepoDomainGraph(t.id).then(({graph:Y,coverage:X})=>{d(Y),w(X)}).catch(()=>{d(null),w(null)}).finally(()=>m(!1)))},[o,v,t.id]);function B(Y){T(Y.id),L(Y)}function D(Y){L(Y),Y!==null&&T(Y.id),U(null)}const[H,U]=ne.useState(null),[z,W]=ne.useState(!1),[F,P]=ne.useState(!1);function j(Y){W(!0),at.getBlastRadius(t.id,Y.name||Y.id).then(U).catch(()=>U({target:Y.name,dependents:[],unresolved:-1})).finally(()=>W(!1))}function G(Y){h(X=>{if(X===null)return X;const J=new Set(X.nodes.map(Pe=>Pe.id)),re=[...X.nodes,...Y.nodes.filter(Pe=>!J.has(Pe.id))],ce=Pe=>`${Pe.src}→${Pe.tgt}`,de=new Set(X.edges.map(ce)),Re=[...X.edges,...Y.edges.filter(Pe=>!de.has(ce(Pe)))];return{nodes:re,edges:Re,stats:{nodeCount:re.length,edgeCount:Re.length,fileCount:new Set(re.map(Pe=>Pe.file)).size}}})}function $(Y){P(!0),at.getRepoGraph(t.id,{focus:Y.id,limit:60}).then(({graph:X})=>{X!==null&&G(X)}).catch(()=>{}).finally(()=>P(!1))}function ee(Y){U(null);const X=c==null?void 0:c.nodes.find(J=>J.id===Y.id);if(X){D(X);return}at.getRepoGraph(t.id,{focus:Y.id,limit:60}).then(({graph:J})=>{if(J===null)return;G(J);const re=J.nodes.find(ce=>ce.id===Y.id)??J.nodes.find(ce=>ce.name===Y.name);re&&D(re)}).catch(()=>{})}function ae(Y){const J=Y.toLowerCase().split("/"),re=J[J.length-1]??"";return J.some(ce=>ce==="test"||ce==="tests"||ce==="spec"||ce==="specs"||ce==="__tests__"||ce==="e2e")||re.startsWith("test_")||/_(test|spec|tests|suite)\.[^.]+$/.test(re)||/\.(test|spec)\.[^.]+$/.test(re)}const ie=c?c.nodes.filter(Y=>!(!Y.file||Y.file.startsWith("node_modules/")||A&&ae(Y.file))):[],K=ie.length===0;function q({value:Y,current:X,label:J,onChange:re}){const ce=Y===X;return _.jsx("button",{type:"button",onClick:()=>re(Y),className:"rounded px-2.5 py-1 text-[11px] font-mono font-medium transition-colors",style:{background:ce?Me.surface:"transparent",color:ce?Me.ink:Me.muted,boxShadow:ce?"0 1px 4px rgba(0,0,0,0.4)":"none"},children:J})}return _.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{background:"rgba(0,0,0,0.75)"},onMouseDown:Y=>{Y.target===Y.currentTarget&&e()},children:_.jsxs("div",{className:"w-[92vw] h-[92vh] rounded-2xl flex flex-col overflow-hidden",style:{background:Me.blue,border:`1px solid ${Me.hairlineS}`,boxShadow:"0 40px 80px -20px rgba(0,0,0,0.8)"},children:[_.jsxs("div",{className:"flex items-center gap-3 px-5 py-3 border-b shrink-0",style:{background:Me.blue2,borderColor:Me.hairline},children:[_.jsx("span",{className:"text-[13px] font-semibold font-mono mr-1",style:{color:Me.ink},children:t.name}),_.jsx("div",{className:"flex gap-0.5 rounded p-0.5",style:{background:"rgba(0,0,0,0.25)"},children:["code","domain"].map(Y=>_.jsx(q,{value:Y,current:o,label:Y==="code"?"Code":"Domain",onChange:a},Y))}),o==="code"&&_.jsx("div",{className:"flex gap-0.5 rounded p-0.5",style:{background:"rgba(0,0,0,0.25)"},children:["graph","hotspots"].map(Y=>_.jsx(q,{value:Y,current:i,label:Y==="graph"?"Graph":"Hotspots",onChange:s},Y))}),o==="code"&&_.jsx("button",{type:"button",onClick:()=>I(Y=>!Y),className:"flex items-center gap-1.5 px-2 py-1 rounded text-[10px] font-mono font-medium transition-colors border",style:{borderColor:A?Me.hairline:"rgba(255,218,25,0.4)",background:A?"rgba(0,0,0,0.2)":"rgba(255,218,25,0.08)",color:A?Me.faint:Me.accent},children:A?"tests hidden":"tests shown"}),c&&o==="code"&&_.jsxs("span",{className:"text-[10px] font-mono px-2 py-0.5 rounded",style:{background:"rgba(0,0,0,0.2)",color:Me.muted},children:[ie.length," nodes · ",c.stats.edgeCount," edges"]}),_.jsx("button",{type:"button",onClick:e,className:"ml-auto text-xl leading-none w-7 h-7 flex items-center justify-center rounded transition-colors",style:{color:Me.faint},onMouseEnter:Y=>Y.currentTarget.style.color=Me.ink,onMouseLeave:Y=>Y.currentTarget.style.color=Me.faint,children:"×"})]}),_.jsx("div",{className:"flex-1 overflow-hidden",style:{background:Me.blue},children:l?_.jsx("div",{className:"flex items-center justify-center h-full",children:_.jsx("span",{className:"text-sm font-mono",style:{color:Me.muted},children:"Loading…"})}):o==="domain"?g?_.jsx("div",{className:"flex items-center justify-center h-full",children:_.jsx("span",{className:"text-sm font-mono",style:{color:Me.muted},children:"Loading domain graph…"})}):v?_.jsx(vA,{graph:v}):_.jsx("div",{className:"flex items-center justify-center h-full",children:_.jsxs("div",{className:"max-w-sm w-full mx-auto p-6 rounded-xl border flex flex-col gap-4",style:{border:`1px solid ${Me.hairlineS}`,background:Me.canvas2},children:[_.jsx("p",{className:"text-sm font-semibold font-mono",style:{color:Me.ink},children:"Domain graph not yet generated"}),_.jsxs("p",{className:"text-xs leading-relaxed",style:{color:Me.muted},children:["The domain model requires full annotation coverage — every behavior-bearing node in the code graph must be linked to a requirement. To get there: run the",_.jsx("span",{className:"font-mono",children:" domain-extraction"})," workflow for this repo (it annotates behavior nodes with requirement claims), then re-run Onboard — its domain phase runs ",_.jsx("span",{className:"font-mono",children:"wicked-core domain-graph"}),"."]}),x?_.jsxs("div",{className:"rounded-lg p-4 flex flex-col gap-2 border",style:{border:`1px solid ${Me.hairline}`},children:[_.jsxs("div",{className:"flex justify-between items-baseline",children:[_.jsx("span",{className:"text-[11px] font-mono",style:{color:Me.muted},children:"Annotation coverage"}),_.jsxs("span",{className:"text-[11px] font-mono font-bold",style:{color:Me.ink},children:[(x.coverage*100).toFixed(1),"%"]})]}),_.jsx("div",{className:"w-full h-1.5 rounded-full overflow-hidden",style:{background:Me.surface},children:_.jsx("div",{className:"h-full rounded-full",style:{width:`${Math.max(x.coverage*100,.5)}%`,background:Me.ok}})}),_.jsxs("div",{className:"flex gap-4 mt-1 text-[10px] font-mono tabular-nums",style:{color:Me.faint},children:[_.jsxs("span",{children:[x.resolved.toLocaleString()," resolved"]}),_.jsxs("span",{children:[x.behavior_bearing.toLocaleString()," behavior-bearing"]}),_.jsxs("span",{children:[x.total.toLocaleString()," total"]})]})]}):_.jsx("p",{className:"text-[11px] font-mono",style:{color:Me.faint},children:"No coverage data — run onboarding first."}),_.jsx("button",{type:"button",onClick:()=>void M(),disabled:y,className:"self-start rounded-lg px-4 py-2 text-sm font-semibold disabled:opacity-50",style:{background:Me.accent,color:Me.accentInk},children:y?"Starting…":"Run annotation workflow →"}),S&&_.jsx("p",{className:"text-[11px] font-mono",style:{color:Me.deny},children:S})]})}):K?_.jsx("div",{className:"flex items-center justify-center h-full",children:_.jsx("p",{className:"text-sm font-mono",style:{color:Me.muted},children:"Code graph not yet available — run onboarding first."})}):_.jsxs("div",{className:"h-full flex p-4 gap-4",children:[_.jsxs("div",{className:"flex-1 flex flex-col gap-3 min-w-0 overflow-hidden",children:[_.jsxs("div",{className:"rounded-xl overflow-hidden flex flex-col",style:{display:i==="graph"?"flex":"none",flex:1,border:`1px solid ${Me.hairlineS}`,background:Me.canvas2,boxShadow:"0 20px 50px -20px rgba(0,0,0,0.6)"},children:[_.jsxs("div",{className:"flex items-center gap-3 px-4 py-2.5 border-b shrink-0",style:{background:Me.canvas,borderColor:Me.hairline},children:[_.jsx(K1,{}),_.jsxs("span",{className:"font-mono text-[10px] ml-1",style:{color:Me.faint},children:["code-graph · ",_.jsx("span",{style:{color:Me.link},children:t.name})]}),_.jsxs("span",{className:"ml-auto font-mono text-[9px] px-2 py-0.5 rounded",style:{background:Me.surface,color:Me.muted},children:[ie.length," nodes"]})]}),_.jsx("div",{className:"flex-1 overflow-hidden",style:{background:Me.canvas},children:_.jsx(eS,{nodes:ie,edges:c.edges,externalSelectedId:E,onNodeSelect:D})})]}),_.jsxs("div",{className:"rounded-xl overflow-hidden flex flex-col",style:{display:i==="hotspots"?"flex":"none",flex:1,border:`1px solid ${Me.hairlineS}`,background:Me.canvas2,boxShadow:"0 20px 50px -20px rgba(0,0,0,0.6)"},children:[_.jsxs("div",{className:"flex items-center gap-3 px-4 py-2.5 border-b shrink-0",style:{background:Me.canvas,borderColor:Me.hairline},children:[_.jsx(K1,{}),_.jsxs("span",{className:"font-mono text-[10px] ml-1",style:{color:Me.faint},children:["hotspots · ",_.jsx("span",{style:{color:Me.link},children:t.name})]})]}),_.jsx("div",{className:"flex-1 overflow-hidden",style:{background:Me.surface2},children:_.jsx(cA,{nodes:ie,selectedId:(k==null?void 0:k.id)??null,onSelect:B})})]})]}),k&&_.jsx(pA,{node:k,edges:c.edges,onClose:()=>L(null),onBlast:j,onExpand:$,blast:H,blastBusy:z,expandBusy:F,onFocusDependent:ee})]})})]})})}const yA=new Set(["sessionStarted","unitPlanned","unitDistributed","unitExecuting","gateDecided","unitDone","unitDenied","awaitingHuman","resumed","runCancelled","sessionFailed","sessionCompleted"]);function xA(t){return{ord:t,description:"",stage:"build",status:"pending",resolved:!1,assignedCli:null,assignedInvocation:null,routing:null,denialReason:null,skillRef:null,phaseStatus:null,role:null,gate:null,hasValidatorPin:!1,executorType:null,attempts:[],usage:[],filesRead:[],gateEvals:[],stepErrors:[],crashRedrives:0,workerSessionReuses:0,contextInjections:[],hookFires:[],validationPinAttached:!1,gateEscalated:!1,toolExecutorCmd:null,governanceArmed:!1,outputBytes:null,outputGoverned:!1,reworkAmendment:null}}function Q1(t){return JSON.stringify([t.criterion,t.hasDeterministicFloor,t.deterministicPass,t.agentVerdict,t.agentReasoning,t.evaluatorPass,t.denialReason,t.combined])}function bA(t,e){var w;const r={...t.session},n=new Map;for(const g of t.units)n.set(g.ord,{ord:g.ord,description:g.description,stage:g.stage,status:g.status,resolved:!0,assignedCli:g.assigned_cli,assignedInvocation:g.assigned_invocation,routing:g.routing,denialReason:g.denial_reason,skillRef:g.skill_ref??null,phaseStatus:g.phase_status,role:g.role??null,gate:g.gate??null,hasValidatorPin:g.has_validator_pin??!1,executorType:g.tool_cmd!=null?"tool":"agent",attempts:[],usage:[],filesRead:[],gateEvals:[],stepErrors:[],crashRedrives:0,workerSessionReuses:0,contextInjections:[],hookFires:[],validationPinAttached:!1,gateEscalated:!1,toolExecutorCmd:g.tool_cmd??null,governanceArmed:!1,outputBytes:null,outputGoverned:!1,reworkAmendment:null});let i=r.status==="awaiting_human"?{ord:((w=t.units[r.unit_ix])==null?void 0:w.ord)??r.unit_ix+1,prompt:null}:null,s=null;const o=[];let a=null,l=t.session.workflow_id||null;const u=new Map,c=new Set,h=new Set,v=new Set,d=g=>{let m=n.get(g);return m===void 0&&(m=xA(g),n.set(g,m)),m};for(const g of e){const m=typeof g.ord=="number"?g.ord:void 0;switch(g.type){case"sessionStarted":r.status="planning";break;case"unitPlanned":if(m!==void 0){const y=d(m);y.description=typeof g.description=="string"?g.description:y.description;const b=(g.hasValidatorPin??g.has_validator_pin)===!0,S=g.executorType??g.executor_type,N=g.skillRef??g.skill_ref;y.resolved?(y.role===null&&typeof g.role=="string"&&(y.role=g.role),y.gate===null&&typeof g.gate=="string"&&(y.gate=g.gate),!y.hasValidatorPin&&b&&(y.hasValidatorPin=!0),y.executorType===null&&typeof S=="string"&&(y.executorType=S)):(typeof g.stage=="string"&&(y.stage=g.stage),typeof g.role=="string"&&(y.role=g.role),typeof g.gate=="string"&&(y.gate=g.gate),y.hasValidatorPin=b,typeof S=="string"&&(y.executorType=S)),!y.skillRef&&typeof N=="string"&&(y.skillRef=N)}break;case"unitDistributed":if(m!==void 0){const y=d(m);y.status==="pending"&&(y.status="distributed"),typeof g.cli=="string"&&y.assignedCli===null&&(y.assignedCli=g.cli)}break;case"unitExecuting":if(m!==void 0){const y=d(m);y.status==="pending"&&(y.status="distributed")}break;case"unitDone":m!==void 0&&(d(m).status="done");break;case"unitDenied":m!==void 0&&(d(m).status="rejected");break;case"awaitingHuman":m!==void 0&&(r.status="awaiting_human",i={ord:m,prompt:typeof g.prompt=="string"?g.prompt:null});break;case"resumed":r.status="executing",i=null;break;case"runCancelled":r.status="cancelled",i=null;break;case"sessionFailed":r.status="failed",i=null;break;case"sessionCompleted":r.status="completed",i=null;break;case"unitDispatched":if(m!==void 0&&typeof g.attempt=="number"){const y=d(m);y.attempts.includes(g.attempt)||(y.attempts.push(g.attempt),y.attempts.sort((b,S)=>b-S))}break;case"cliUsage":if(m!==void 0&&typeof g.attempt=="number"&&typeof g.inputTokens=="number"&&typeof g.outputTokens=="number"){const y=d(m),b=typeof g.costUsd=="number"?g.costUsd:null,S=y.usage.find(N=>N.attempt===g.attempt);S?(S.inputTokens=g.inputTokens,S.outputTokens=g.outputTokens,S.costUsd=b):y.usage.push({attempt:g.attempt,inputTokens:g.inputTokens,outputTokens:g.outputTokens,costUsd:b})}break;case"dataUsed":if(m!==void 0&&Array.isArray(g.files)){const y=d(m);for(const b of g.files)typeof b=="string"&&!y.filesRead.includes(b)&&y.filesRead.push(b)}break;case"gateEvaluated":if(m!==void 0){const y=d(m),b={criterion:g.criterion??null,hasDeterministicFloor:g.hasDeterministicFloor===!0,deterministicPass:g.deterministicPass===!0,agentVerdict:g.agentVerdict??null,agentReasoning:g.agentReasoning??null,evaluatorPass:typeof g.evaluatorPass=="boolean"?g.evaluatorPass:null,denialReason:g.denialReason??null,combined:g.combined===!0},S=Q1(b);y.gateEvals.some(N=>Q1(N)===S)||y.gateEvals.push(b)}break;case"stepFailed":if(m!==void 0&&typeof g.attempt=="number"&&typeof g.detail=="string"&&typeof g.failureKind=="string"){const y=d(m);y.stepErrors.some(b=>b.attempt===g.attempt)||y.stepErrors.push({attempt:g.attempt,detail:g.detail,failureKind:g.failureKind})}break;case"crashRecoveryRedrive":if(m!==void 0&&typeof g.attempt=="number"){let y=u.get(m);y||(y=new Set,u.set(m,y)),y.has(g.attempt)||(y.add(g.attempt),d(m).crashRedrives+=1)}break;case"workerSessionStarted":typeof g.terminalId=="string"&&(s=g.terminalId);break;case"acpSessionStarted":break;case"acpFallback":typeof g.cliKey=="string"&&typeof g.reason=="string"&&typeof g.fallbackKind=="string"&&(o.some(b=>b.cliKey===g.cliKey&&b.reason===g.reason&&b.fallbackKind===g.fallbackKind)||o.push({cliKey:g.cliKey,reason:g.reason,fallbackKind:g.fallbackKind}));break;case"workerSessionReused":if(m!==void 0&&typeof g.terminalId=="string"){const y=`${m}:${g.terminalId}`;c.has(y)||(c.add(y),d(m).workerSessionReuses+=1)}break;case"workerSessionClosed":typeof g.terminalId=="string"&&(g.reason==="run_complete"||g.reason==="error")&&(a={terminalId:g.terminalId,reason:g.reason});break;case"unitContextInjected":if(m!==void 0&&Array.isArray(g.priorUnits)&&!h.has(m)){h.add(m);const y=d(m);for(const b of g.priorUnits)if(typeof b=="object"&&b!==null){const S=b;typeof S.ord=="number"&&typeof S.label=="string"&&typeof S.outputBytes=="number"&&y.contextInjections.push({ord:S.ord,label:S.label,outputBytes:S.outputBytes})}}break;case"governanceHookFired":if(m!==void 0&&typeof g.attempt=="number"&&typeof g.toolName=="string"&&(g.decision==="allow"||g.decision==="deny")){const y=`${m}:${g.attempt}:${g.toolName}`;v.has(y)||(v.add(y),d(m).hookFires.push({toolName:g.toolName,decision:g.decision,denyingPolicy:typeof g.denyingPolicy=="string"?g.denyingPolicy:null}))}break;case"validationPinAttached":m!==void 0&&(d(m).validationPinAttached=!0);break;case"gateEscalated":m!==void 0&&(d(m).gateEscalated=!0);break;case"toolExecutorDispatched":m!==void 0&&Array.isArray(g.cmd)&&(d(m).toolExecutorCmd=g.cmd);break;case"governanceContextArmed":m!==void 0&&(d(m).governanceArmed=!0);break;case"workflowSelected":l===null&&typeof g.workflowId=="string"&&(l=g.workflowId);break;case"unitReworkAmended":if(m!==void 0&&typeof g.amendment=="string"){const y=d(m);y.reworkAmendment=g.amendment,typeof g.updatedDescription=="string"&&(y.description=g.updatedDescription)}break;case"unitOutputCaptured":if(m!==void 0&&typeof g.attempt=="number"&&typeof g.outputBytes=="number"&&typeof g.governed=="boolean"){const y=d(m);y.outputBytes=g.outputBytes,y.outputGoverned=g.governed}break}}const x=[...n.values()].sort((g,m)=>g.ord-m.ord);return{session:r,units:x,pendingGate:i,activeTerminalId:s,acpFallbacks:o,lastWorkerClose:a,selectedWorkflow:l}}function Z1(t){return(t.split(/[\\/]/).pop()??t).replace(/\.(exe|cmd|bat)$/i,"").toLowerCase()}function wA(t,e){const r=t==null?void 0:t.trim();return r?Z1(r.split(/\s+/)[0]??"")==="claude":e!==null&&Z1(e)==="claude"}function _A(t){let e=0,r=0,n=0,i=0,s=0,o=0;const a=new Map,l=new Set,u=new Set;for(const h of t.units){const v=h.status==="distributed"||h.status==="done"||h.status==="rejected";h.usage.length===0&&h.assignedCli!==null&&v&&(wA(h.assignedInvocation,h.assignedCli)?u.add(h.assignedCli):l.add(h.assignedCli));const d=h.assignedCli??"unknown",x=h.usage.length>0?Math.min(...h.usage.map(w=>w.attempt)):0;for(const w of h.usage){s+=1,e+=w.inputTokens,r+=w.outputTokens,w.costUsd!==null&&(n+=w.costUsd,i+=1),w.attempt>x&&(o+=w.inputTokens+w.outputTokens);const g=a.get(d)??{cli:d,input:0,output:0,cost:null};g.input+=w.inputTokens,g.output+=w.outputTokens,w.costUsd!==null&&(g.cost=(g.cost??0)+w.costUsd),a.set(d,g)}}const c=e+r;return{totalInput:e,totalOutput:r,totalTokens:c,totalCost:i>0?n:null,costComplete:s>0&&i===s,reworkTokens:o,reworkPct:c>0?o/c*100:0,perCli:[...a.values()],noAdapterClis:[...l],pendingUsageClis:[...u],hasUsage:s>0}}const SA=[];function CA(t,e){const r=Ec(o=>o.byRun[t])??SA,[n,i]=ne.useState(e??null),s=Ec(o=>{const a=o.byRun[t];if(a===void 0)return 0;let l=0;for(const u of a)yA.has(u.type)&&(l+=1);return l});return ne.useEffect(()=>{let o=!1;return(async()=>{try{const{run:a}=await at.getRun(t);o||i(a)}catch{}})(),()=>{o=!0}},[t,s]),ne.useMemo(()=>n===null||n.session.id!==t?null:bA(n,r),[n,r,t])}const J1=2e5,Ts=500;function tS(t,e){return`${t}:u${e}`}function jp(t){switch(t.type){case"sessionStarted":return typeof t.problem=="string"?t.problem:"run started";case"unitPlanned":return typeof t.description=="string"?t.description:"unit planned";case"unitDistributed":return typeof t.cli=="string"?`assigned -> ${t.cli}`:"distributed";case"councilConvened":return Array.isArray(t.clis)?`council convened — polling ${t.clis.length} CLIs`:"council convened";case"councilDeliberated":return typeof t.agreementPct=="number"?`ballot ${String(t.round??"?")} at ${t.agreementPct}% — below ${String(t.neededPct??"?")}%, runoff round starting`:"council deliberating";case"councilVoted":return typeof t.agreementPct=="number"?`council voted — ${t.agreementPct}% agreement (${String(t.votes??"?")} votes)`:"council voted";case"unitExecuting":return"executing";case"gateDecided":return t.allow===!0?"gate: allow":"gate: deny";case"unitDone":return"unit done";case"unitDenied":return"unit denied";case"awaitingHuman":return typeof t.prompt=="string"?`awaiting human: ${t.prompt}`:"awaiting human";case"resumed":return"resumed";case"runCancelled":return"run cancelled";case"sessionFailed":return"run failed";case"sessionCompleted":return"run completed";case"stepFailed":return typeof t.detail=="string"?t.detail:"step failed";case"crashRecoveryRedrive":return typeof t.attempt=="number"?`attempt ${t.attempt}`:"crash recovery";case"workerStalled":return`no output for ${String(t.stalledSecs??"?")}s — may be waiting at an interactive prompt (open Term or inject)`;case"failureTriaged":return`triage: ${String(t.decision??"?")}${typeof t.analysis=="string"&&t.analysis?" — "+t.analysis.slice(0,120):""}`;case"workerMessageQueued":case"workerMessageInjected":return typeof t.message=="string"?`${String(t.target??"all")}: "${t.message.length>80?t.message.slice(0,80)+"…":t.message}"`:t.type;case"error":return typeof t.message=="string"?`error: ${t.message}`:"error";default:return t.type}}const Oa=qs(t=>({outputs:{},councilStatus:{},assumptions:{},logs:{},executorTypes:{},terminalIds:{},seq:0,ingest:e=>{const r=typeof e.session=="string"?e.session:void 0;r!==void 0&&t(n=>{const i=n.seq+1;if(e.type==="cliOutputDelta"&&typeof e.ord=="number"&&typeof e.chunk=="string"){const u=tS(r,e.ord);let h=(n.outputs[u]??"")+e.chunk;return h.length>J1&&(h=h.slice(h.length-J1)),{seq:i,outputs:{...n.outputs,[u]:h}}}if(e.type==="heartbeat")return{seq:i};if(e.type==="assumptionRecorded"&&typeof e.ord=="number"&&typeof e.library=="string"&&typeof e.transform=="string"){const u={ord:e.ord,kind:typeof e.kind=="string"?e.kind:"external-transform",library:e.library,transform:e.transform,known:e.known===!0,detail:typeof e.detail=="string"?e.detail:""},c=n.assumptions[r]??[];return{seq:i,assumptions:{...n.assumptions,[r]:[...c,u]}}}if((e.type==="councilConvened"||e.type==="councilDeliberated"||e.type==="councilVoted")&&typeof e.ord=="number"){const u=`${r}:${e.ord}`,c=e.type==="councilConvened"?{state:"convened",...Array.isArray(e.clis)?{clis:e.clis}:{}}:e.type==="councilDeliberated"?{state:"deliberating",...typeof e.round=="number"?{round:e.round}:{},...typeof e.agreementPct=="number"?{agreementPct:e.agreementPct}:{},...typeof e.neededPct=="number"?{neededPct:e.neededPct}:{},...typeof e.votes=="number"?{votes:e.votes}:{}}:{state:"voted",...typeof e.agreementPct=="number"?{agreementPct:e.agreementPct}:{},...typeof e.votes=="number"?{votes:e.votes}:{}},h={seq:i,type:e.type,ts:Date.now(),detail:jp(e)};h.ord=e.ord,typeof e.attempt=="number"&&(h.attempt=e.attempt);const d=[...n.logs[r]??[],h];return d.length>Ts&&d.splice(0,d.length-Ts),{seq:i,councilStatus:{...n.councilStatus,[u]:c},logs:{...n.logs,[r]:d}}}const s=e.executorType??e.executor_type;if(e.type==="unitPlanned"&&typeof e.ord=="number"&&(s==="agent"||s==="tool")){const u=`${r}:${e.ord}`;return{seq:i,executorTypes:{...n.executorTypes,[u]:s},...(()=>{const c={seq:i,type:e.type,ts:Date.now(),detail:jp(e)};c.ord=e.ord;const v=[...n.logs[r]??[],c];return v.length>Ts&&v.splice(0,v.length-Ts),{logs:{...n.logs,[r]:v}}})()}}if(e.type==="workerSessionStarted"&&typeof e.terminalId=="string"&&typeof e.cliKey=="string"){const u=`${r}:${e.cliKey}`;return{seq:i,terminalIds:{...n.terminalIds,[u]:e.terminalId}}}const o={seq:i,type:e.type,ts:Date.now(),detail:jp(e)};typeof e.ord=="number"&&(o.ord=e.ord),typeof e.attempt=="number"&&(o.attempt=e.attempt);const l=[...n.logs[r]??[],o];return l.length>Ts&&l.splice(0,l.length-Ts),{seq:i,logs:{...n.logs,[r]:l}}})},clear:e=>t(r=>{const n={...r.outputs};for(const u of Object.keys(n))u.startsWith(`${e}:u`)&&delete n[u];const i={...r.councilStatus};for(const u of Object.keys(i))u.startsWith(`${e}:`)&&delete i[u];const s={...r.assumptions};delete s[e];const o={...r.executorTypes};for(const u of Object.keys(o))u.startsWith(`${e}:`)&&delete o[u];const a={...r.terminalIds};for(const u of Object.keys(a))u.startsWith(`${e}:`)&&delete a[u];const l={...r.logs};return delete l[e],{outputs:n,councilStatus:i,assumptions:s,executorTypes:o,terminalIds:a,logs:l}})}));function EA(t){return t.method==="council"?t.dissent>0?`council: ${t.winner} (${t.dissent} dissent, ${t.agreement_pct}% agreement)`:`council: ${t.winner} (unanimous)`:t.method==="evaluator_distinct"?`evaluator≠creator: ${t.winner} (was ${t.was})`:t.method==="tool"?"tool: direct command (no council)":`degraded: ${t.reason}`}function kA({model:t}){const e=t.units.filter(n=>n.resolved&&n.routing!=null),r=Oa(n=>n.assumptions[t.session.id])??[];return _.jsxs("div",{"data-testid":"assumptions",className:"flex flex-col gap-2 text-[11px]",children:[r.length>0&&_.jsxs("div",{className:"flex flex-col gap-1",children:[_.jsx("p",{className:"font-mono font-semibold",style:{color:"rgba(230,237,243,0.6)"},children:"external transformations"}),_.jsx("ul",{className:"flex flex-col gap-1",children:r.map((n,i)=>_.jsxs("li",{"data-testid":"assumption-transform",className:"rounded p-1.5 font-mono",style:{background:n.known?"rgba(63,185,80,0.06)":"rgba(255,218,25,0.08)",border:n.known?"1px solid rgba(63,185,80,0.2)":"1px dashed rgba(255,218,25,0.45)"},children:[_.jsxs("div",{className:"flex items-center gap-1.5",children:[_.jsxs("span",{style:{color:"#e6edf3"},children:["unit #",n.ord]}),_.jsx("span",{style:{color:"#79c0ff"},children:n.library}),!n.known&&_.jsx("span",{"data-testid":"needs-review-badge",className:"rounded px-1 text-[9px] font-semibold uppercase",style:{background:"rgba(255,218,25,0.2)",color:"#ffda19"},children:"needs review"})]}),_.jsx("p",{style:{color:"rgba(230,237,243,0.7)"},children:n.transform}),_.jsx("p",{style:{color:"rgba(230,237,243,0.45)"},children:n.detail})]},`${n.ord}:${n.library}:${i}`))})]}),e.length===0?_.jsx("p",{style:{color:"rgba(230,237,243,0.4)"},children:"No routing decisions recorded yet."}):_.jsx("ul",{className:"flex flex-col gap-1",children:e.map(n=>_.jsxs("li",{className:"rounded p-1.5 font-mono",style:{background:"#161c26",border:"1px solid rgba(230,237,243,0.07)",color:"rgba(230,237,243,0.6)"},children:[_.jsxs("span",{className:"font-medium",style:{color:"#e6edf3"},children:["unit #",n.ord]}),n.description.includes(" — ")&&_.jsx("span",{className:"ml-1",style:{color:"rgba(230,237,243,0.4)"},children:n.description.split(" — ")[0]})," ","— ",EA(n.routing)]},n.ord))})]})}const TA=new Set(["completed","cancelled","failed"]),NA=new Intl.NumberFormat("en-US");function qo(t){return NA.format(t)}function eb(t){return t===null?"—":`$${t.toFixed(4)}`}function RA({model:t}){const e=_A(t),n=!TA.has(t.session.status)||e.noAdapterClis.length>0||e.pendingUsageClis.length>0,i={background:"#161c26",border:"1px solid rgba(230,237,243,0.07)",borderRadius:"6px",padding:"8px"};return _.jsxs("div",{"data-testid":"burn",className:"flex flex-col gap-2 text-[11px]",children:[e.hasUsage?_.jsxs(_.Fragment,{children:[_.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[_.jsxs("div",{style:i,children:[_.jsxs("p",{style:{color:"rgba(230,237,243,0.4)"},children:["tokens",n?" (partial)":""]}),_.jsx("p",{className:"font-mono text-sm",style:{color:"#e6edf3"},children:qo(e.totalTokens)}),_.jsxs("p",{className:"text-[10px]",style:{color:"rgba(230,237,243,0.35)"},children:[qo(e.totalInput)," in / ",qo(e.totalOutput)," out"]})]}),_.jsxs("div",{style:i,children:[_.jsxs("p",{style:{color:"rgba(230,237,243,0.4)"},children:["cost",e.costComplete&&!n?"":" (partial)"]}),_.jsx("p",{className:"font-mono text-sm",style:{color:"#e6edf3"},children:eb(e.totalCost)}),e.totalCost===null&&_.jsx("p",{className:"text-[10px]",style:{color:"rgba(230,237,243,0.35)"},children:"no cost reported"})]}),_.jsxs("div",{style:i,"data-testid":"burn-rework",children:[_.jsxs("p",{style:{color:"rgba(230,237,243,0.4)"},children:["rework",n?" (prov.)":""]}),_.jsxs("p",{className:"font-mono text-sm",style:{color:"#e6edf3"},children:[n?"~":"",e.reworkPct.toFixed(0),"%"]}),_.jsxs("p",{className:"text-[10px]",style:{color:"rgba(230,237,243,0.35)"},children:[qo(e.reworkTokens)," tok"]})]})]}),n&&_.jsx("p",{className:"text-[10px]",style:{color:"rgba(230,237,243,0.35)"},"data-testid":"burn-partial",children:"Token totals and rework% are from connect onward; earlier usage may be missing."}),_.jsxs("div",{children:[_.jsx("p",{className:"mb-1",style:{color:"rgba(230,237,243,0.4)"},children:"per CLI"}),_.jsx("ul",{className:"flex flex-col gap-0.5",children:e.perCli.map(s=>_.jsxs("li",{className:"flex justify-between font-mono",style:{color:"rgba(230,237,243,0.6)"},children:[_.jsx("span",{children:s.cli}),_.jsxs("span",{children:[qo(s.input+s.output)," tok · ",eb(s.cost)]})]},s.cli))})]})]}):_.jsxs("p",{style:{color:"rgba(230,237,243,0.4)"},"data-testid":"burn-empty",children:["Awaiting usage — token/cost burn lights up when a CLI emits ",_.jsx("code",{children:"cliUsage"})," ","(claude reports tokens + cost directly)."]}),e.noAdapterClis.length>0&&_.jsxs("p",{style:{color:"#ffda19"},"data-testid":"burn-unavailable",children:["usage unavailable for ",e.noAdapterClis.join(", ")," — no usage adapter"]}),e.pendingUsageClis.length>0&&_.jsxs("p",{style:{color:"rgba(230,237,243,0.4)"},"data-testid":"burn-pending",children:["usage not yet reported for ",e.pendingUsageClis.join(", ")]})]})}function LA({model:t}){const e=t.units.filter(r=>r.filesRead.length>0);return _.jsxs("div",{"data-testid":"data-used",className:"flex flex-col gap-2 text-[11px]",children:[e.length===0?_.jsxs("p",{style:{color:"rgba(230,237,243,0.4)"},"data-testid":"data-used-empty",children:["No files-read captured yet — populated from claude ",_.jsx("code",{children:"tool_use"})," blocks via"," ",_.jsx("code",{children:"dataUsed"}),"."]}):_.jsx("ul",{className:"flex flex-col gap-2",children:e.map(r=>_.jsxs("li",{"data-testid":"data-used-unit","data-ord":r.ord,children:[_.jsxs("p",{className:"font-semibold font-mono",style:{color:"rgba(230,237,243,0.7)"},children:["unit #",r.ord,r.assignedCli?` · ${r.assignedCli}`:""]}),_.jsx("ul",{className:"mt-0.5 flex flex-col gap-0.5",children:r.filesRead.map(n=>_.jsx("li",{className:"truncate font-mono",style:{color:"rgba(230,237,243,0.45)"},title:n,children:n},n))})]},r.ord))}),_.jsx("p",{"data-testid":"data-used-recall-disabled",className:"rounded p-1.5 font-mono",style:{border:"1px dashed rgba(230,237,243,0.12)",color:"rgba(230,237,243,0.35)"},children:"memory / knowledge recall: disabled (pending core-ts binding)"})]})}function DA({routing:t}){return t?t.method==="council"?_.jsxs("p",{className:"text-[11px] font-mono",style:{color:"rgba(230,237,243,0.45)"},"data-testid":"routing-provenance",children:[_.jsx("span",{className:"font-medium",style:{color:"rgba(230,237,243,0.6)"},children:"Council:"})," ",t.winner," won · ",t.agreement_pct,"% agreement · ",t.returned," returned · ",t.dissent," dissent"]}):t.method==="degraded"?_.jsxs("p",{className:"text-[11px] font-mono",style:{color:"#ffda19"},"data-testid":"routing-provenance",children:[_.jsx("span",{className:"font-medium",children:"Degraded:"})," ",t.reason]}):t.method==="tool"?_.jsxs("p",{className:"text-[11px] font-mono",style:{color:"rgba(230,237,243,0.4)"},"data-testid":"routing-provenance",children:[_.jsx("span",{className:"font-medium",children:"Tool:"})," direct command — no council"]}):_.jsxs("p",{className:"text-[11px] font-mono",style:{color:"#a78bfa"},"data-testid":"routing-provenance",children:[_.jsx("span",{className:"font-medium",children:"Evaluator-distinct:"})," ",t.winner," (was ",t.was,")"]}):null}function AA(t){if(!t.combined){const e=[];return t.hasDeterministicFloor&&!t.deterministicPass&&e.push("deterministic floor"),t.evaluatorPass===!1&&e.push("evaluator (2nd pass)"),e.length===0&&t.agentVerdict!==null&&e.push("agent judge"),e.length>0?e.join(" + "):"governance"}return t.evaluatorPass!==null?"evaluator (2nd pass)":t.agentVerdict!==null?"agent judge":t.hasDeterministicFloor?"deterministic floor":"ungated"}function MA({model:t}){const{units:e,session:r,pendingGate:n}=t,i=e.filter(l=>l.routing!==null||l.denialReason!==null||l.gateEvals.length>0),s=n!==null?n.ord+1:r.status==="executing"?r.unit_ix:null,o=(()=>{if(s===null)return!1;const l=r.human_confirm;return l==="all"?!0:l==="none"?!1:l.before===s})(),a={background:"#161c26",border:"1px solid rgba(230,237,243,0.07)",borderRadius:"6px",padding:"8px"};return _.jsx("div",{"data-testid":"decisions-ledger",className:"flex flex-col gap-2",children:i.length===0&&n===null?_.jsx("p",{className:"text-xs font-mono",style:{color:"rgba(230,237,243,0.4)"},children:"No governed decisions recorded yet."}):_.jsxs("ol",{className:"flex flex-col gap-2",children:[i.map(l=>_.jsxs("li",{"data-testid":"ledger-row","data-ord":l.ord,style:a,children:[_.jsxs("div",{className:"flex items-center justify-between mb-1",children:[_.jsxs("div",{className:"flex items-center gap-1",children:[_.jsxs("span",{className:"font-semibold text-[11px] font-mono",style:{color:"#e6edf3"},children:["unit #",l.ord]}),(l.role==="creator"||l.role==="evaluator")&&_.jsx("span",{"data-testid":"role-badge",className:"text-[10px] font-mono px-1 rounded",style:{background:l.role==="evaluator"?"rgba(56,139,253,0.15)":"rgba(63,185,80,0.12)",color:l.role==="evaluator"?"#58a6ff":"#3fb950"},children:l.role==="creator"?"Creator":"Evaluator"}),l.gate!=null&&l.gate!=="auto"&&_.jsx("span",{"data-testid":"gate-badge",className:"text-[10px] font-mono px-1 rounded",style:{background:"rgba(255,218,25,0.1)",color:"#ffda19"},children:typeof l.gate=="string"&&l.gate==="human_confirm"||typeof l.gate=="object"&&"human_confirm"in l.gate?"HUMAN-CONFIRM":"CONDITIONAL"}),l.attempts.length>1&&_.jsxs("span",{"data-testid":"rework-badge",className:"text-[10px] font-mono px-1 rounded",style:{background:"rgba(248,81,73,0.12)",color:"#f85149"},children:["×",l.attempts.length]})]}),_.jsx("span",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.35)"},children:l.resolved?l.stage:"resolving…"})]}),_.jsx(DA,{routing:l.routing}),l.skillRef&&_.jsxs("p",{className:"text-[11px] font-mono",style:{color:"rgba(230,237,243,0.4)"},children:["skill: ",_.jsx("span",{style:{color:"rgba(230,237,243,0.6)"},children:l.skillRef})]}),l.gateEvals.map((u,c)=>_.jsxs("div",{className:"mt-1 rounded p-1.5",style:{background:"#0f1419",border:"1px solid rgba(230,237,243,0.05)"},children:[_.jsxs("p",{className:"text-[11px] font-mono",children:[_.jsx("span",{className:"font-semibold",style:{color:u.combined?"#3fb950":"#f85149"},children:u.combined?"ALLOW":"DENY"}),_.jsxs("span",{style:{color:"rgba(230,237,243,0.45)"},children:[" · ",AA(u),u.criterion?` · ${u.criterion}`:" · (ungated)"]})]}),u.hasDeterministicFloor&&_.jsxs("p",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.4)"},children:["deterministic: ",u.deterministicPass?"pass":"fail"]}),u.agentVerdict!==null&&_.jsxs("p",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.4)"},children:["agent: ",u.agentVerdict,u.agentReasoning?` — ${u.agentReasoning}`:""]}),u.evaluatorPass!==null&&_.jsxs("p",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.4)"},children:["evaluator: ",u.evaluatorPass?"pass":"fail"]}),u.denialReason&&_.jsxs("p",{className:"text-[10px] font-mono",style:{color:"#f85149"},children:["reason: ",u.denialReason]})]},c)),l.denialReason&&l.gateEvals.length===0&&_.jsxs("p",{className:"mt-1 text-[11px] font-mono",style:{color:"#f85149"},"data-testid":"ledger-denial",children:["denied: ",l.denialReason]})]},l.ord)),n!==null&&_.jsxs("li",{"data-testid":"ledger-pending",className:"rounded p-2 text-[11px] font-mono",style:{background:"rgba(255,218,25,0.06)",border:"1px dashed rgba(255,218,25,0.35)",color:"#ffda19"},children:[_.jsx("span",{className:"font-semibold",children:"PENDING"})," · awaiting human · before unit #",n.ord,n.prompt?` — ${n.prompt}`:""]}),s!==null&&_.jsxs("li",{"data-testid":"ledger-next",className:"rounded p-2 text-[11px] font-mono",style:{border:"1px dashed rgba(230,237,243,0.12)",color:"rgba(230,237,243,0.35)"},children:[o?"next decision point · unit #":"next unit · unit #",s,o?" (human-confirm gate)":""]})]})})}function PA({decision:t}){const e={allow:{bg:"rgba(63,185,80,0.12)",color:"#3fb950"},deny:{bg:"rgba(248,81,73,0.12)",color:"#f85149"},allow_with_conditions:{bg:"rgba(255,218,25,0.12)",color:"#ffda19"}},r={allow:"ALLOW",deny:"DENY",allow_with_conditions:"ALLOW + OBLIGATIONS"},n=e[t];return _.jsx("span",{className:"inline-flex rounded px-1.5 py-0.5 text-[10px] font-semibold font-mono",style:{background:n.bg,color:n.color},children:r[t]})}function IA({claim:t}){const[e,r]=ne.useState(!1),n=new Date(t.evaluated_at*1e3).toLocaleTimeString();return _.jsxs("li",{className:"rounded p-2 text-[11px]",style:{background:"#161c26",border:"1px solid rgba(230,237,243,0.07)"},children:[_.jsxs("div",{className:"flex items-center justify-between gap-2",children:[_.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[_.jsx(PA,{decision:t.decision}),_.jsx("span",{className:"font-mono truncate",style:{color:"rgba(230,237,243,0.6)"},children:t.phase})]}),_.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[_.jsx("span",{className:"font-mono",style:{color:"rgba(230,237,243,0.35)"},children:n}),(t.criteria||t.obligations.length>0||t.policy_ids.length>0)&&_.jsx("button",{type:"button",onClick:()=>r(i=>!i),className:"text-xs",style:{color:"rgba(230,237,243,0.35)"},"aria-label":e?"Collapse":"Expand",children:e?"▲":"▼"})]})]}),e&&_.jsxs("div",{className:"mt-2 flex flex-col gap-1.5 text-[10px] font-mono",style:{color:"rgba(230,237,243,0.5)"},children:[t.criteria&&_.jsxs("p",{children:[_.jsx("span",{className:"font-semibold",style:{color:"rgba(230,237,243,0.7)"},children:"criteria: "}),t.criteria]}),t.policy_ids.length>0&&_.jsxs("div",{children:[_.jsx("p",{className:"font-semibold",style:{color:"rgba(230,237,243,0.7)"},children:"policies matched:"}),_.jsx("ul",{className:"list-inside list-disc pl-1",children:t.policy_ids.map(i=>_.jsx("li",{children:i},i))})]}),t.obligations.length>0&&_.jsxs("div",{children:[_.jsx("p",{className:"font-semibold",style:{color:"rgba(230,237,243,0.7)"},children:"obligations:"}),_.jsx("ul",{className:"list-inside list-disc pl-1",children:t.obligations.map((i,s)=>_.jsx("li",{children:i},s))})]}),_.jsxs("p",{children:["evaluator: ",_.jsx("span",{children:t.evaluator_identity})," · ","claim: ",_.jsx("span",{children:t.claim_id})]})]})]})}function OA({model:t}){const[e,r]=ne.useState([]),[n,i]=ne.useState(!0),[s,o]=ne.useState(null),a=ne.useCallback(async()=>{i(!0),o(null);try{const{claims:h}=await at.listClaims();r(h.filter(v=>v.scope===t.session.id).sort((v,d)=>v.evaluated_at-d.evaluated_at))}catch(h){o(h instanceof Error?h.message:String(h))}finally{i(!1)}},[t.session.id]);ne.useEffect(()=>{a()},[a]);const l=_.jsx("button",{type:"button",onClick:()=>void a(),className:"self-start text-[10px] font-mono hover:underline",style:{color:"rgba(230,237,243,0.4)"},children:"Refresh"});if(n)return _.jsx("p",{className:"text-xs font-mono",style:{color:"rgba(230,237,243,0.4)"},children:"Loading governance claims…"});if(s)return _.jsxs("div",{className:"flex flex-col gap-1",children:[_.jsx("p",{className:"rounded px-2 py-1 text-xs font-mono",style:{background:"rgba(248,81,73,0.1)",color:"#f85149",border:"1px solid rgba(248,81,73,0.2)"},children:s}),l]});if(e.length===0)return _.jsxs("div",{className:"flex flex-col gap-1",children:[_.jsx("p",{className:"text-xs font-mono",style:{color:"rgba(230,237,243,0.4)"},children:"No governance claims recorded for this run."}),_.jsx("p",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.3)"},children:"Claims appear when wicked-core runs governance decisions (core#24/#26)."}),l]});const u=e.filter(h=>h.decision==="deny").length,c=e.filter(h=>h.decision==="allow_with_conditions").length;return _.jsxs("div",{className:"flex flex-col gap-2",children:[_.jsxs("div",{className:"flex items-center justify-between",children:[_.jsxs("p",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.4)"},children:[e.length," decision",e.length!==1?"s":"",u>0&&_.jsxs("span",{className:"ml-1 font-semibold",style:{color:"#f85149"},children:["· ",u," denied"]}),c>0&&_.jsxs("span",{className:"ml-1",style:{color:"#ffda19"},children:["· ",c," with obligations"]})]}),l]}),_.jsx("ol",{className:"flex flex-col gap-1.5",children:e.map(h=>_.jsx(IA,{claim:h},h.claim_id))})]})}function tb({title:t,onClose:e,children:r,disableEscapeKey:n}){const i=ne.useId();return ne.useEffect(()=>{if(n)return;function s(o){o.key==="Escape"&&e()}return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[e,n]),_.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{background:"rgba(0,0,0,0.6)"},children:_.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":i,className:"relative w-[90vw] h-[80vh] rounded-xl flex flex-col shadow-2xl",style:{background:"#1b222e",border:"1px solid rgba(230,237,243,0.1)"},children:[_.jsxs("div",{className:"flex items-center justify-between px-4 py-3 shrink-0",style:{borderBottom:"1px solid rgba(230,237,243,0.07)"},children:[_.jsx("h2",{id:i,className:"text-sm font-semibold font-mono",style:{color:"#e6edf3"},children:t}),_.jsx("button",{type:"button",onClick:e,className:"text-lg leading-none transition-colors",style:{color:"rgba(230,237,243,0.35)"},onMouseEnter:s=>{s.currentTarget.style.color="#e6edf3"},onMouseLeave:s=>{s.currentTarget.style.color="rgba(230,237,243,0.35)"},"aria-label":"Close",children:"✕"})]}),_.jsx("div",{className:"flex-1 overflow-auto p-4",children:r})]})})}const BA={approve:{label:"Approved",color:"#3fb950"},"approve-with-steer":{label:"Approved + steered",color:"#ffda19"},reject:{label:"Rejected",color:"#f85149"},cancel:{label:"Cancelled run",color:"rgba(230,237,243,0.5)"}};function jA({runId:t}){const e=Uv(r=>r.entries).filter(r=>r.runId===t);return e.length===0?_.jsx("p",{"data-testid":"steering-timeline",className:"text-xs font-mono",style:{color:"rgba(230,237,243,0.4)"},children:"No interventions recorded this session. Operator gate actions (approve / reject / amend) appear here as they happen."}):_.jsxs("div",{className:"flex flex-col gap-2",children:[_.jsx("p",{"data-testid":"steering-scope-note",className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.35)"},children:"Client-recorded, this session only — daemon keeps no per-action history, cleared on reload."}),_.jsx("ol",{"data-testid":"steering-timeline",className:"flex flex-col gap-2",children:e.map(r=>{const n=BA[r.action];return _.jsxs("li",{"data-testid":"steering-entry",className:"rounded p-2 text-[11px]",style:{background:"#161c26",border:"1px solid rgba(230,237,243,0.07)"},children:[_.jsxs("div",{className:"flex items-center justify-between",children:[_.jsx("span",{className:"font-semibold font-mono",style:{color:n.color},children:n.label}),_.jsx("span",{className:"font-mono",style:{color:"rgba(230,237,243,0.35)"},children:typeof r.ord=="number"?`before unit #${r.ord}`:"—"})]}),r.amend&&_.jsxs("p",{className:"mt-1 whitespace-pre-wrap rounded p-1.5 font-mono",style:{background:"#0f1419",color:"rgba(230,237,243,0.6)"},children:[_.jsx("span",{className:"font-medium",style:{color:"#e6edf3"},children:"amended instruction:"})," ",r.amend]}),_.jsxs("p",{className:"mt-1 text-[10px] font-mono",style:{color:"rgba(230,237,243,0.35)"},children:["effect: ",r.action==="approve-with-steer"?"steers the next unit":r.action==="approve"?"run advances":r.action==="reject"?"run rejected":"run cancelled"," ","— as recorded"]})]},r.seq)})})]})}var Fp={exports:{}},rb;function FA(){return rb||(rb=1,(function(t,e){(function(r,n){t.exports=n()})(globalThis,(()=>(()=>{var r={4567:function(o,a,l){var u=this&&this.__decorate||function(y,b,S,N){var E,T=arguments.length,k=T<3?b:N===null?N=Object.getOwnPropertyDescriptor(b,S):N;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(y,b,S,N);else for(var L=y.length-1;L>=0;L--)(E=y[L])&&(k=(T<3?E(k):T>3?E(b,S,k):E(b,S))||k);return T>3&&k&&Object.defineProperty(b,S,k),k},c=this&&this.__param||function(y,b){return function(S,N){b(S,N,y)}};Object.defineProperty(a,"__esModule",{value:!0}),a.AccessibilityManager=void 0;const h=l(9042),v=l(9924),d=l(844),x=l(4725),w=l(2585),g=l(3656);let m=a.AccessibilityManager=class extends d.Disposable{constructor(y,b,S,N){super(),this._terminal=y,this._coreBrowserService=S,this._renderService=N,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=this._coreBrowserService.mainDocument.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let E=0;E<this._terminal.rows;E++)this._rowElements[E]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[E]);if(this._topBoundaryFocusListener=E=>this._handleBoundaryFocus(E,0),this._bottomBoundaryFocusListener=E=>this._handleBoundaryFocus(E,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new v.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this.register(this._terminal.onResize((E=>this._handleResize(E.rows)))),this.register(this._terminal.onRender((E=>this._refreshRows(E.start,E.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((E=>this._handleChar(E)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
376
- `)))),this.register(this._terminal.onA11yTab((E=>this._handleTab(E)))),this.register(this._terminal.onKey((E=>this._handleKey(E.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this.register((0,g.addDisposableDomListener)(document,"selectionchange",(()=>this._handleSelectionChange()))),this.register(this._coreBrowserService.onDprChange((()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,d.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(y){for(let b=0;b<y;b++)this._handleChar(" ")}_handleChar(y){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==y&&(this._charsToAnnounce+=y):this._charsToAnnounce+=y,y===`
377
- `&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=h.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(y){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(y)||this._charsToConsume.push(y)}_refreshRows(y,b){this._liveRegionDebouncer.refresh(y,b,this._terminal.rows)}_renderRows(y,b){const S=this._terminal.buffer,N=S.lines.length.toString();for(let E=y;E<=b;E++){const T=S.lines.get(S.ydisp+E),k=[],L=(T==null?void 0:T.translateToString(!0,void 0,void 0,k))||"",A=(S.ydisp+E+1).toString(),I=this._rowElements[E];I&&(L.length===0?(I.innerText=" ",this._rowColumns.set(I,[0,1])):(I.textContent=L,this._rowColumns.set(I,k)),I.setAttribute("aria-posinset",A),I.setAttribute("aria-setsize",N))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(y,b){const S=y.target,N=this._rowElements[b===0?1:this._rowElements.length-2];if(S.getAttribute("aria-posinset")===(b===0?"1":`${this._terminal.buffer.lines.length}`)||y.relatedTarget!==N)return;let E,T;if(b===0?(E=S,T=this._rowElements.pop(),this._rowContainer.removeChild(T)):(E=this._rowElements.shift(),T=S,this._rowContainer.removeChild(E)),E.removeEventListener("focus",this._topBoundaryFocusListener),T.removeEventListener("focus",this._bottomBoundaryFocusListener),b===0){const k=this._createAccessibilityTreeNode();this._rowElements.unshift(k),this._rowContainer.insertAdjacentElement("afterbegin",k)}else{const k=this._createAccessibilityTreeNode();this._rowElements.push(k),this._rowContainer.appendChild(k)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(b===0?-1:1),this._rowElements[b===0?1:this._rowElements.length-2].focus(),y.preventDefault(),y.stopImmediatePropagation()}_handleSelectionChange(){var L;if(this._rowElements.length===0)return;const y=document.getSelection();if(!y)return;if(y.isCollapsed)return void(this._rowContainer.contains(y.anchorNode)&&this._terminal.clearSelection());if(!y.anchorNode||!y.focusNode)return void console.error("anchorNode and/or focusNode are null");let b={node:y.anchorNode,offset:y.anchorOffset},S={node:y.focusNode,offset:y.focusOffset};if((b.node.compareDocumentPosition(S.node)&Node.DOCUMENT_POSITION_PRECEDING||b.node===S.node&&b.offset>S.offset)&&([b,S]=[S,b]),b.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(b={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(b.node))return;const N=this._rowElements.slice(-1)[0];if(S.node.compareDocumentPosition(N)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(S={node:N,offset:((L=N.textContent)==null?void 0:L.length)??0}),!this._rowContainer.contains(S.node))return;const E=({node:A,offset:I})=>{const M=A instanceof Text?A.parentNode:A;let B=parseInt(M==null?void 0:M.getAttribute("aria-posinset"),10)-1;if(isNaN(B))return console.warn("row is invalid. Race condition?"),null;const D=this._rowColumns.get(M);if(!D)return console.warn("columns is null. Race condition?"),null;let H=I<D.length?D[I]:D.slice(-1)[0]+1;return H>=this._terminal.cols&&(++B,H=0),{row:B,column:H}},T=E(b),k=E(S);if(T&&k){if(T.row>k.row||T.row===k.row&&T.column>=k.column)throw new Error("invalid range");this._terminal.select(T.column,T.row,(k.row-T.row)*this._terminal.cols-T.column+k.column)}}_handleResize(y){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let b=this._rowContainer.children.length;b<this._terminal.rows;b++)this._rowElements[b]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[b]);for(;this._rowElements.length>y;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const y=this._coreBrowserService.mainDocument.createElement("div");return y.setAttribute("role","listitem"),y.tabIndex=-1,this._refreshRowDimensions(y),y}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let y=0;y<this._terminal.rows;y++)this._refreshRowDimensions(this._rowElements[y])}}_refreshRowDimensions(y){y.style.height=`${this._renderService.dimensions.css.cell.height}px`}};a.AccessibilityManager=m=u([c(1,w.IInstantiationService),c(2,x.ICoreBrowserService),c(3,x.IRenderService)],m)},3614:(o,a)=>{function l(v){return v.replace(/\r?\n/g,"\r")}function u(v,d){return d?"\x1B[200~"+v+"\x1B[201~":v}function c(v,d,x,w){v=u(v=l(v),x.decPrivateModes.bracketedPasteMode&&w.rawOptions.ignoreBracketedPasteMode!==!0),x.triggerDataEvent(v,!0),d.value=""}function h(v,d,x){const w=x.getBoundingClientRect(),g=v.clientX-w.left-10,m=v.clientY-w.top-10;d.style.width="20px",d.style.height="20px",d.style.left=`${g}px`,d.style.top=`${m}px`,d.style.zIndex="1000",d.focus()}Object.defineProperty(a,"__esModule",{value:!0}),a.rightClickHandler=a.moveTextAreaUnderMouseCursor=a.paste=a.handlePasteEvent=a.copyHandler=a.bracketTextForPaste=a.prepareTextForTerminal=void 0,a.prepareTextForTerminal=l,a.bracketTextForPaste=u,a.copyHandler=function(v,d){v.clipboardData&&v.clipboardData.setData("text/plain",d.selectionText),v.preventDefault()},a.handlePasteEvent=function(v,d,x,w){v.stopPropagation(),v.clipboardData&&c(v.clipboardData.getData("text/plain"),d,x,w)},a.paste=c,a.moveTextAreaUnderMouseCursor=h,a.rightClickHandler=function(v,d,x,w,g){h(v,d,x),g&&w.rightClickSelect(v),d.value=w.selectionText,d.select()}},7239:(o,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.ColorContrastCache=void 0;const u=l(1505);a.ColorContrastCache=class{constructor(){this._color=new u.TwoKeyMap,this._css=new u.TwoKeyMap}setCss(c,h,v){this._css.set(c,h,v)}getCss(c,h){return this._css.get(c,h)}setColor(c,h,v){this._color.set(c,h,v)}getColor(c,h){return this._color.get(c,h)}clear(){this._color.clear(),this._css.clear()}}},3656:(o,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.addDisposableDomListener=void 0,a.addDisposableDomListener=function(l,u,c,h){l.addEventListener(u,c,h);let v=!1;return{dispose:()=>{v||(v=!0,l.removeEventListener(u,c,h))}}}},3551:function(o,a,l){var u=this&&this.__decorate||function(m,y,b,S){var N,E=arguments.length,T=E<3?y:S===null?S=Object.getOwnPropertyDescriptor(y,b):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(m,y,b,S);else for(var k=m.length-1;k>=0;k--)(N=m[k])&&(T=(E<3?N(T):E>3?N(y,b,T):N(y,b))||T);return E>3&&T&&Object.defineProperty(y,b,T),T},c=this&&this.__param||function(m,y){return function(b,S){y(b,S,m)}};Object.defineProperty(a,"__esModule",{value:!0}),a.Linkifier=void 0;const h=l(3656),v=l(8460),d=l(844),x=l(2585),w=l(4725);let g=a.Linkifier=class extends d.Disposable{get currentLink(){return this._currentLink}constructor(m,y,b,S,N){super(),this._element=m,this._mouseService=y,this._renderService=b,this._bufferService=S,this._linkProviderService=N,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new v.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new v.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,d.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,d.toDisposable)((()=>{var E;this._lastMouseEvent=void 0,(E=this._activeProviderReplies)==null||E.clear()}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0}))),this.register((0,h.addDisposableDomListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,h.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,h.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,h.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(m){this._lastMouseEvent=m;const y=this._positionFromMouseEvent(m,this._element,this._mouseService);if(!y)return;this._isMouseOut=!1;const b=m.composedPath();for(let S=0;S<b.length;S++){const N=b[S];if(N.classList.contains("xterm"))break;if(N.classList.contains("xterm-hover"))return}this._lastBufferCell&&y.x===this._lastBufferCell.x&&y.y===this._lastBufferCell.y||(this._handleHover(y),this._lastBufferCell=y)}_handleHover(m){if(this._activeLine!==m.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(m,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,m)||(this._clearCurrentLink(),this._askForLink(m,!0))}_askForLink(m,y){var S,N;this._activeProviderReplies&&y||((S=this._activeProviderReplies)==null||S.forEach((E=>{E==null||E.forEach((T=>{T.link.dispose&&T.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=m.y);let b=!1;for(const[E,T]of this._linkProviderService.linkProviders.entries())y?(N=this._activeProviderReplies)!=null&&N.get(E)&&(b=this._checkLinkProviderResult(E,m,b)):T.provideLinks(m.y,(k=>{var A,I;if(this._isMouseOut)return;const L=k==null?void 0:k.map((M=>({link:M})));(A=this._activeProviderReplies)==null||A.set(E,L),b=this._checkLinkProviderResult(E,m,b),((I=this._activeProviderReplies)==null?void 0:I.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(m.y,this._activeProviderReplies)}))}_removeIntersectingLinks(m,y){const b=new Set;for(let S=0;S<y.size;S++){const N=y.get(S);if(N)for(let E=0;E<N.length;E++){const T=N[E],k=T.link.range.start.y<m?0:T.link.range.start.x,L=T.link.range.end.y>m?this._bufferService.cols:T.link.range.end.x;for(let A=k;A<=L;A++){if(b.has(A)){N.splice(E--,1);break}b.add(A)}}}}_checkLinkProviderResult(m,y,b){var E;if(!this._activeProviderReplies)return b;const S=this._activeProviderReplies.get(m);let N=!1;for(let T=0;T<m;T++)this._activeProviderReplies.has(T)&&!this._activeProviderReplies.get(T)||(N=!0);if(!N&&S){const T=S.find((k=>this._linkAtPosition(k.link,y)));T&&(b=!0,this._handleNewLink(T))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!b)for(let T=0;T<this._activeProviderReplies.size;T++){const k=(E=this._activeProviderReplies.get(T))==null?void 0:E.find((L=>this._linkAtPosition(L.link,y)));if(k){b=!0,this._handleNewLink(k);break}}return b}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(m){if(!this._currentLink)return;const y=this._positionFromMouseEvent(m,this._element,this._mouseService);y&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,y)&&this._currentLink.link.activate(m,this._currentLink.link.text)}_clearCurrentLink(m,y){this._currentLink&&this._lastMouseEvent&&(!m||!y||this._currentLink.link.range.start.y>=m&&this._currentLink.link.range.end.y<=y)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,d.disposeArray)(this._linkCacheDisposables))}_handleNewLink(m){if(!this._lastMouseEvent)return;const y=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);y&&this._linkAtPosition(m.link,y)&&(this._currentLink=m,this._currentLink.state={decorations:{underline:m.link.decorations===void 0||m.link.decorations.underline,pointerCursor:m.link.decorations===void 0||m.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,m.link,this._lastMouseEvent),m.link.decorations={},Object.defineProperties(m.link.decorations,{pointerCursor:{get:()=>{var b,S;return(S=(b=this._currentLink)==null?void 0:b.state)==null?void 0:S.decorations.pointerCursor},set:b=>{var S;(S=this._currentLink)!=null&&S.state&&this._currentLink.state.decorations.pointerCursor!==b&&(this._currentLink.state.decorations.pointerCursor=b,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",b))}},underline:{get:()=>{var b,S;return(S=(b=this._currentLink)==null?void 0:b.state)==null?void 0:S.decorations.underline},set:b=>{var S,N,E;(S=this._currentLink)!=null&&S.state&&((E=(N=this._currentLink)==null?void 0:N.state)==null?void 0:E.decorations.underline)!==b&&(this._currentLink.state.decorations.underline=b,this._currentLink.state.isHovered&&this._fireUnderlineEvent(m.link,b))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((b=>{if(!this._currentLink)return;const S=b.start===0?0:b.start+1+this._bufferService.buffer.ydisp,N=this._bufferService.buffer.ydisp+1+b.end;if(this._currentLink.link.range.start.y>=S&&this._currentLink.link.range.end.y<=N&&(this._clearCurrentLink(S,N),this._lastMouseEvent)){const E=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);E&&this._askForLink(E,!1)}}))))}_linkHover(m,y,b){var S;(S=this._currentLink)!=null&&S.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(y,!0),this._currentLink.state.decorations.pointerCursor&&m.classList.add("xterm-cursor-pointer")),y.hover&&y.hover(b,y.text)}_fireUnderlineEvent(m,y){const b=m.range,S=this._bufferService.buffer.ydisp,N=this._createLinkUnderlineEvent(b.start.x-1,b.start.y-S-1,b.end.x,b.end.y-S-1,void 0);(y?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(N)}_linkLeave(m,y,b){var S;(S=this._currentLink)!=null&&S.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(y,!1),this._currentLink.state.decorations.pointerCursor&&m.classList.remove("xterm-cursor-pointer")),y.leave&&y.leave(b,y.text)}_linkAtPosition(m,y){const b=m.range.start.y*this._bufferService.cols+m.range.start.x,S=m.range.end.y*this._bufferService.cols+m.range.end.x,N=y.y*this._bufferService.cols+y.x;return b<=N&&N<=S}_positionFromMouseEvent(m,y,b){const S=b.getCoords(m,y,this._bufferService.cols,this._bufferService.rows);if(S)return{x:S[0],y:S[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(m,y,b,S,N){return{x1:m,y1:y,x2:b,y2:S,cols:this._bufferService.cols,fg:N}}};a.Linkifier=g=u([c(1,w.IMouseService),c(2,w.IRenderService),c(3,x.IBufferService),c(4,w.ILinkProviderService)],g)},9042:(o,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.tooMuchOutput=a.promptLabel=void 0,a.promptLabel="Terminal input",a.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(o,a,l){var u=this&&this.__decorate||function(w,g,m,y){var b,S=arguments.length,N=S<3?g:y===null?y=Object.getOwnPropertyDescriptor(g,m):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(w,g,m,y);else for(var E=w.length-1;E>=0;E--)(b=w[E])&&(N=(S<3?b(N):S>3?b(g,m,N):b(g,m))||N);return S>3&&N&&Object.defineProperty(g,m,N),N},c=this&&this.__param||function(w,g){return function(m,y){g(m,y,w)}};Object.defineProperty(a,"__esModule",{value:!0}),a.OscLinkProvider=void 0;const h=l(511),v=l(2585);let d=a.OscLinkProvider=class{constructor(w,g,m){this._bufferService=w,this._optionsService=g,this._oscLinkService=m}provideLinks(w,g){var L;const m=this._bufferService.buffer.lines.get(w-1);if(!m)return void g(void 0);const y=[],b=this._optionsService.rawOptions.linkHandler,S=new h.CellData,N=m.getTrimmedLength();let E=-1,T=-1,k=!1;for(let A=0;A<N;A++)if(T!==-1||m.hasContent(A)){if(m.loadCell(A,S),S.hasExtendedAttrs()&&S.extended.urlId){if(T===-1){T=A,E=S.extended.urlId;continue}k=S.extended.urlId!==E}else T!==-1&&(k=!0);if(k||T!==-1&&A===N-1){const I=(L=this._oscLinkService.getLinkData(E))==null?void 0:L.uri;if(I){const M={start:{x:T+1,y:w},end:{x:A+(k||A!==N-1?0:1),y:w}};let B=!1;if(!(b!=null&&b.allowNonHttpProtocols))try{const D=new URL(I);["http:","https:"].includes(D.protocol)||(B=!0)}catch{B=!0}B||y.push({text:I,range:M,activate:(D,H)=>b?b.activate(D,H,M):x(0,H),hover:(D,H)=>{var U;return(U=b==null?void 0:b.hover)==null?void 0:U.call(b,D,H,M)},leave:(D,H)=>{var U;return(U=b==null?void 0:b.leave)==null?void 0:U.call(b,D,H,M)}})}k=!1,S.hasExtendedAttrs()&&S.extended.urlId?(T=A,E=S.extended.urlId):(T=-1,E=-1)}}g(y)}};function x(w,g){if(confirm(`Do you want to navigate to ${g}?
378
-
379
- WARNING: This link could potentially be dangerous`)){const m=window.open();if(m){try{m.opener=null}catch{}m.location.href=g}else console.warn("Opening link blocked as opener could not be cleared")}}a.OscLinkProvider=d=u([c(0,v.IBufferService),c(1,v.IOptionsService),c(2,v.IOscLinkService)],d)},6193:(o,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.RenderDebouncer=void 0,a.RenderDebouncer=class{constructor(l,u){this._renderCallback=l,this._coreBrowserService=u,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(l){return this._refreshCallbacks.push(l),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh()))),this._animationFrame}refresh(l,u,c){this._rowCount=c,l=l!==void 0?l:0,u=u!==void 0?u:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,l):l,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,u):u,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return void this._runRefreshCallbacks();const l=Math.max(this._rowStart,0),u=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(l,u),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const l of this._refreshCallbacks)l(0);this._refreshCallbacks=[]}}},3236:(o,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.Terminal=void 0;const u=l(3614),c=l(3656),h=l(3551),v=l(9042),d=l(3730),x=l(1680),w=l(3107),g=l(5744),m=l(2950),y=l(1296),b=l(428),S=l(4269),N=l(5114),E=l(8934),T=l(3230),k=l(9312),L=l(4725),A=l(6731),I=l(8055),M=l(8969),B=l(8460),D=l(844),H=l(6114),U=l(8437),z=l(2584),W=l(7399),F=l(5941),P=l(9074),j=l(2585),G=l(5435),$=l(4567),ee=l(779);class ae extends M.CoreTerminal{get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}constructor(K={}){super(K),this.browser=H,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new D.MutableDisposable),this._onCursorMove=this.register(new B.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new B.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new B.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new B.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new B.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new B.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new B.EventEmitter),this._onBlur=this.register(new B.EventEmitter),this._onA11yCharEmitter=this.register(new B.EventEmitter),this._onA11yTabEmitter=this.register(new B.EventEmitter),this._onWillOpen=this.register(new B.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(P.DecorationService),this._instantiationService.setService(j.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(ee.LinkProviderService),this._instantiationService.setService(L.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(d.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((q,Y)=>this.refresh(q,Y)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((q=>this._reportWindowsOptions(q)))),this.register(this._inputHandler.onColor((q=>this._handleColorEvent(q)))),this.register((0,B.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,B.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,B.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,B.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((q=>this._afterResize(q.cols,q.rows)))),this.register((0,D.toDisposable)((()=>{var q,Y;this._customKeyEventHandler=void 0,(Y=(q=this.element)==null?void 0:q.parentNode)==null||Y.removeChild(this.element)})))}_handleColorEvent(K){if(this._themeService)for(const q of K){let Y,X="";switch(q.index){case 256:Y="foreground",X="10";break;case 257:Y="background",X="11";break;case 258:Y="cursor",X="12";break;default:Y="ansi",X="4;"+q.index}switch(q.type){case 0:const J=I.color.toColorRGB(Y==="ansi"?this._themeService.colors.ansi[q.index]:this._themeService.colors[Y]);this.coreService.triggerDataEvent(`${z.C0.ESC}]${X};${(0,F.toRgbString)(J)}${z.C1_ESCAPED.ST}`);break;case 1:if(Y==="ansi")this._themeService.modifyColors((re=>re.ansi[q.index]=I.channels.toColor(...q.color)));else{const re=Y;this._themeService.modifyColors((ce=>ce[re]=I.channels.toColor(...q.color)))}break;case 2:this._themeService.restoreColor(q.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(K){K?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance($.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(K){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(z.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var K;return(K=this.textarea)==null?void 0:K.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(z.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;const K=this.buffer.ybase+this.buffer.y,q=this.buffer.lines.get(K);if(!q)return;const Y=Math.min(this.buffer.x,this.cols-1),X=this._renderService.dimensions.css.cell.height,J=q.getWidth(Y),re=this._renderService.dimensions.css.cell.width*J,ce=this.buffer.y*this._renderService.dimensions.css.cell.height,de=Y*this._renderService.dimensions.css.cell.width;this.textarea.style.left=de+"px",this.textarea.style.top=ce+"px",this.textarea.style.width=re+"px",this.textarea.style.height=X+"px",this.textarea.style.lineHeight=X+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,c.addDisposableDomListener)(this.element,"copy",(q=>{this.hasSelection()&&(0,u.copyHandler)(q,this._selectionService)})));const K=q=>(0,u.handlePasteEvent)(q,this.textarea,this.coreService,this.optionsService);this.register((0,c.addDisposableDomListener)(this.textarea,"paste",K)),this.register((0,c.addDisposableDomListener)(this.element,"paste",K)),H.isFirefox?this.register((0,c.addDisposableDomListener)(this.element,"mousedown",(q=>{q.button===2&&(0,u.rightClickHandler)(q,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,c.addDisposableDomListener)(this.element,"contextmenu",(q=>{(0,u.rightClickHandler)(q,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),H.isLinux&&this.register((0,c.addDisposableDomListener)(this.element,"auxclick",(q=>{q.button===1&&(0,u.moveTextAreaUnderMouseCursor)(q,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,c.addDisposableDomListener)(this.textarea,"keyup",(K=>this._keyUp(K)),!0)),this.register((0,c.addDisposableDomListener)(this.textarea,"keydown",(K=>this._keyDown(K)),!0)),this.register((0,c.addDisposableDomListener)(this.textarea,"keypress",(K=>this._keyPress(K)),!0)),this.register((0,c.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,c.addDisposableDomListener)(this.textarea,"compositionupdate",(K=>this._compositionHelper.compositionupdate(K)))),this.register((0,c.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,c.addDisposableDomListener)(this.textarea,"input",(K=>this._inputEvent(K)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(K){var Y;if(!K)throw new Error("Terminal requires a parent element.");if(K.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((Y=this.element)==null?void 0:Y.ownerDocument.defaultView)&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=K.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),K.appendChild(this.element);const q=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),q.appendChild(this._viewportElement),this._viewportScrollArea=this._document.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this.register((0,c.addDisposableDomListener)(this.screenElement,"mousemove",(X=>this.updateCursorStyle(X)))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),q.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",v.promptLabel),H.isChromeOS||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._coreBrowserService=this.register(this._instantiationService.createInstance(N.CoreBrowserService,this.textarea,K.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(L.ICoreBrowserService,this._coreBrowserService),this.register((0,c.addDisposableDomListener)(this.textarea,"focus",(X=>this._handleTextAreaFocus(X)))),this.register((0,c.addDisposableDomListener)(this.textarea,"blur",(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(b.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(L.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(A.ThemeService),this._instantiationService.setService(L.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(S.CharacterJoinerService),this._instantiationService.setService(L.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(T.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(L.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((X=>this._onRender.fire(X)))),this.onResize((X=>this._renderService.resize(X.cols,X.rows))),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(m.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(E.MouseService),this._instantiationService.setService(L.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(h.Linkifier,this.screenElement)),this.element.appendChild(q);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(x.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((X=>this.scrollLines(X.amount,X.suppressScrollEvent,1))),this.register(this._inputHandler.onRequestSyncScrollBar((()=>this.viewport.syncScrollArea()))),this.register(this.viewport),this.register(this.onCursorMove((()=>{this._renderService.handleCursorMove(),this._syncTextArea()}))),this.register(this.onResize((()=>this._renderService.handleResize(this.cols,this.rows)))),this.register(this.onBlur((()=>this._renderService.handleBlur()))),this.register(this.onFocus((()=>this._renderService.handleFocus()))),this.register(this._renderService.onDimensionsChange((()=>this.viewport.syncScrollArea()))),this._selectionService=this.register(this._instantiationService.createInstance(k.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(L.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((X=>this.scrollLines(X.amount,X.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((X=>this._renderService.handleSelectionChanged(X.start,X.end,X.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((X=>{this.textarea.value=X,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((X=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,c.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(w.BufferDecorationRenderer,this.screenElement)),this.register((0,c.addDisposableDomListener)(this.element,"mousedown",(X=>this._selectionService.handleMouseDown(X)))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance($.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(X=>this._handleScreenReaderModeOptionChange(X)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(g.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(X=>{!this._overviewRulerRenderer&&X&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(g.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(y.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const K=this,q=this.element;function Y(re){const ce=K._mouseService.getMouseReportCoords(re,K.screenElement);if(!ce)return!1;let de,Re;switch(re.overrideType||re.type){case"mousemove":Re=32,re.buttons===void 0?(de=3,re.button!==void 0&&(de=re.button<3?re.button:3)):de=1&re.buttons?0:4&re.buttons?1:2&re.buttons?2:3;break;case"mouseup":Re=0,de=re.button<3?re.button:3;break;case"mousedown":Re=1,de=re.button<3?re.button:3;break;case"wheel":if(K._customWheelEventHandler&&K._customWheelEventHandler(re)===!1||K.viewport.getLinesScrolled(re)===0)return!1;Re=re.deltaY<0?0:1,de=4;break;default:return!1}return!(Re===void 0||de===void 0||de>4)&&K.coreMouseService.triggerMouseEvent({col:ce.col,row:ce.row,x:ce.x,y:ce.y,button:de,action:Re,ctrl:re.ctrlKey,alt:re.altKey,shift:re.shiftKey})}const X={mouseup:null,wheel:null,mousedrag:null,mousemove:null},J={mouseup:re=>(Y(re),re.buttons||(this._document.removeEventListener("mouseup",X.mouseup),X.mousedrag&&this._document.removeEventListener("mousemove",X.mousedrag)),this.cancel(re)),wheel:re=>(Y(re),this.cancel(re,!0)),mousedrag:re=>{re.buttons&&Y(re)},mousemove:re=>{re.buttons||Y(re)}};this.register(this.coreMouseService.onProtocolChange((re=>{re?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(re)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),8&re?X.mousemove||(q.addEventListener("mousemove",J.mousemove),X.mousemove=J.mousemove):(q.removeEventListener("mousemove",X.mousemove),X.mousemove=null),16&re?X.wheel||(q.addEventListener("wheel",J.wheel,{passive:!1}),X.wheel=J.wheel):(q.removeEventListener("wheel",X.wheel),X.wheel=null),2&re?X.mouseup||(X.mouseup=J.mouseup):(this._document.removeEventListener("mouseup",X.mouseup),X.mouseup=null),4&re?X.mousedrag||(X.mousedrag=J.mousedrag):(this._document.removeEventListener("mousemove",X.mousedrag),X.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,c.addDisposableDomListener)(q,"mousedown",(re=>{if(re.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(re))return Y(re),X.mouseup&&this._document.addEventListener("mouseup",X.mouseup),X.mousedrag&&this._document.addEventListener("mousemove",X.mousedrag),this.cancel(re)}))),this.register((0,c.addDisposableDomListener)(q,"wheel",(re=>{if(!X.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(re)===!1)return!1;if(!this.buffer.hasScrollback){const ce=this.viewport.getLinesScrolled(re);if(ce===0)return;const de=z.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(re.deltaY<0?"A":"B");let Re="";for(let Pe=0;Pe<Math.abs(ce);Pe++)Re+=de;return this.coreService.triggerDataEvent(Re,!0),this.cancel(re,!0)}return this.viewport.handleWheel(re)?this.cancel(re):void 0}}),{passive:!1})),this.register((0,c.addDisposableDomListener)(q,"touchstart",(re=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(re),this.cancel(re)}),{passive:!0})),this.register((0,c.addDisposableDomListener)(q,"touchmove",(re=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(re)?void 0:this.cancel(re)}),{passive:!1}))}refresh(K,q){var Y;(Y=this._renderService)==null||Y.refreshRows(K,q)}updateCursorStyle(K){var q;(q=this._selectionService)!=null&&q.shouldColumnSelect(K)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(K,q,Y=0){var X;Y===1?(super.scrollLines(K,q,Y),this.refresh(0,this.rows-1)):(X=this.viewport)==null||X.scrollLines(K)}paste(K){(0,u.paste)(K,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(K){this._customKeyEventHandler=K}attachCustomWheelEventHandler(K){this._customWheelEventHandler=K}registerLinkProvider(K){return this._linkProviderService.registerLinkProvider(K)}registerCharacterJoiner(K){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const q=this._characterJoinerService.register(K);return this.refresh(0,this.rows-1),q}deregisterCharacterJoiner(K){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(K)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(K){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+K)}registerDecoration(K){return this._decorationService.registerDecoration(K)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(K,q,Y){this._selectionService.setSelection(K,q,Y)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(this._selectionService&&this._selectionService.hasSelection)return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){var K;(K=this._selectionService)==null||K.clearSelection()}selectAll(){var K;(K=this._selectionService)==null||K.selectAll()}selectLines(K,q){var Y;(Y=this._selectionService)==null||Y.selectLines(K,q)}_keyDown(K){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(K)===!1)return!1;const q=this.browser.isMac&&this.options.macOptionIsMeta&&K.altKey;if(!q&&!this._compositionHelper.keydown(K))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;q||K.key!=="Dead"&&K.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const Y=(0,W.evaluateKeyboardEvent)(K,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(K),Y.type===3||Y.type===2){const X=this.rows-1;return this.scrollLines(Y.type===2?-X:X),this.cancel(K,!0)}return Y.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,K)||(Y.cancel&&this.cancel(K,!0),!Y.key||!!(K.key&&!K.ctrlKey&&!K.altKey&&!K.metaKey&&K.key.length===1&&K.key.charCodeAt(0)>=65&&K.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(Y.key!==z.C0.ETX&&Y.key!==z.C0.CR||(this.textarea.value=""),this._onKey.fire({key:Y.key,domEvent:K}),this._showCursor(),this.coreService.triggerDataEvent(Y.key,!0),!this.optionsService.rawOptions.screenReaderMode||K.altKey||K.ctrlKey?this.cancel(K,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(K,q){const Y=K.isMac&&!this.options.macOptionIsMeta&&q.altKey&&!q.ctrlKey&&!q.metaKey||K.isWindows&&q.altKey&&q.ctrlKey&&!q.metaKey||K.isWindows&&q.getModifierState("AltGraph");return q.type==="keypress"?Y:Y&&(!q.keyCode||q.keyCode>47)}_keyUp(K){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(K)===!1||((function(q){return q.keyCode===16||q.keyCode===17||q.keyCode===18})(K)||this.focus(),this.updateCursorStyle(K),this._keyPressHandled=!1)}_keyPress(K){let q;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(K)===!1)return!1;if(this.cancel(K),K.charCode)q=K.charCode;else if(K.which===null||K.which===void 0)q=K.keyCode;else{if(K.which===0||K.charCode===0)return!1;q=K.which}return!(!q||(K.altKey||K.ctrlKey||K.metaKey)&&!this._isThirdLevelShift(this.browser,K)||(q=String.fromCharCode(q),this._onKey.fire({key:q,domEvent:K}),this._showCursor(),this.coreService.triggerDataEvent(q,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(K){if(K.data&&K.inputType==="insertText"&&(!K.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const q=K.data;return this.coreService.triggerDataEvent(q,!0),this.cancel(K),!0}return!1}resize(K,q){K!==this.cols||q!==this.rows?super.resize(K,q):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(K,q){var Y,X;(Y=this._charSizeService)==null||Y.measure(),(X=this.viewport)==null||X.syncScrollArea(!0)}clear(){var K;if(this.buffer.ybase!==0||this.buffer.y!==0){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let q=1;q<this.rows;q++)this.buffer.lines.push(this.buffer.getBlankLine(U.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),(K=this.viewport)==null||K.reset(),this.refresh(0,this.rows-1)}}reset(){var q,Y;this.options.rows=this.rows,this.options.cols=this.cols;const K=this._customKeyEventHandler;this._setup(),super.reset(),(q=this._selectionService)==null||q.reset(),this._decorationService.reset(),(Y=this.viewport)==null||Y.reset(),this._customKeyEventHandler=K,this.refresh(0,this.rows-1)}clearTextureAtlas(){var K;(K=this._renderService)==null||K.clearTextureAtlas()}_reportFocus(){var K;(K=this.element)!=null&&K.classList.contains("focus")?this.coreService.triggerDataEvent(z.C0.ESC+"[I"):this.coreService.triggerDataEvent(z.C0.ESC+"[O")}_reportWindowsOptions(K){if(this._renderService)switch(K){case G.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const q=this._renderService.dimensions.css.canvas.width.toFixed(0),Y=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${z.C0.ESC}[4;${Y};${q}t`);break;case G.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const X=this._renderService.dimensions.css.cell.width.toFixed(0),J=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${z.C0.ESC}[6;${J};${X}t`)}}cancel(K,q){if(this.options.cancelEvents||q)return K.preventDefault(),K.stopPropagation(),!1}}a.Terminal=ae},9924:(o,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.TimeBasedDebouncer=void 0,a.TimeBasedDebouncer=class{constructor(l,u=1e3){this._renderCallback=l,this._debounceThresholdMS=u,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(l,u,c){this._rowCount=c,l=l!==void 0?l:0,u=u!==void 0?u:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,l):l,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,u):u;const h=Date.now();if(h-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=h,this._innerRefresh();else if(!this._additionalRefreshRequested){const v=h-this._lastRefreshMs,d=this._debounceThresholdMS-v;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),d)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const l=Math.max(this._rowStart,0),u=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(l,u)}}},1680:function(o,a,l){var u=this&&this.__decorate||function(m,y,b,S){var N,E=arguments.length,T=E<3?y:S===null?S=Object.getOwnPropertyDescriptor(y,b):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(m,y,b,S);else for(var k=m.length-1;k>=0;k--)(N=m[k])&&(T=(E<3?N(T):E>3?N(y,b,T):N(y,b))||T);return E>3&&T&&Object.defineProperty(y,b,T),T},c=this&&this.__param||function(m,y){return function(b,S){y(b,S,m)}};Object.defineProperty(a,"__esModule",{value:!0}),a.Viewport=void 0;const h=l(3656),v=l(4725),d=l(8460),x=l(844),w=l(2585);let g=a.Viewport=class extends x.Disposable{constructor(m,y,b,S,N,E,T,k){super(),this._viewportElement=m,this._scrollArea=y,this._bufferService=b,this._optionsService=S,this._charSizeService=N,this._renderService=E,this._coreBrowserService=T,this.scrollBarWidth=0,this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._wheelPartialScroll=0,this._refreshAnimationFrame=null,this._ignoreNextScrollEvent=!1,this._smoothScrollState={startTime:0,origin:-1,target:-1},this._onRequestScrollLines=this.register(new d.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,h.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((L=>this._activeBuffer=L.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((L=>this._renderDimensions=L))),this._handleThemeChange(k.colors),this.register(k.onChangeColors((L=>this._handleThemeChange(L)))),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(m){this._viewportElement.style.backgroundColor=m.background.css}reset(){this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._coreBrowserService.window.requestAnimationFrame((()=>this.syncScrollArea()))}_refresh(m){if(m)return this._innerRefresh(),void(this._refreshAnimationFrame!==null&&this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));this._refreshAnimationFrame===null&&(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderDimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderDimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;const y=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==y&&(this._lastRecordedBufferHeight=y,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const m=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==m&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=m),this._refreshAnimationFrame=null}syncScrollArea(m=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(m);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(m)}_handleScroll(m){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._onRequestScrollLines.fire({amount:0,suppressScrollEvent:!0});const y=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:y,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const m=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(m*(this._smoothScrollState.target-this._smoothScrollState.origin)),m<1?this._coreBrowserService.window.requestAnimationFrame((()=>this._smoothScroll())):this._clearSmoothScrollState()}_smoothScrollPercent(){return this._optionsService.rawOptions.smoothScrollDuration&&this._smoothScrollState.startTime?Math.max(Math.min((Date.now()-this._smoothScrollState.startTime)/this._optionsService.rawOptions.smoothScrollDuration,1),0):1}_clearSmoothScrollState(){this._smoothScrollState.startTime=0,this._smoothScrollState.origin=-1,this._smoothScrollState.target=-1}_bubbleScroll(m,y){const b=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(y<0&&this._viewportElement.scrollTop!==0||y>0&&b<this._lastRecordedBufferHeight)||(m.cancelable&&m.preventDefault(),!1)}handleWheel(m){const y=this._getPixelsScrolled(m);return y!==0&&(this._optionsService.rawOptions.smoothScrollDuration?(this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target===-1?this._smoothScrollState.target=this._viewportElement.scrollTop+y:this._smoothScrollState.target+=y,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=y,this._bubbleScroll(m,y))}scrollLines(m){if(m!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const y=m*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+y,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:m,suppressScrollEvent:!1})}_getPixelsScrolled(m){if(m.deltaY===0||m.shiftKey)return 0;let y=this._applyScrollModifier(m.deltaY,m);return m.deltaMode===WheelEvent.DOM_DELTA_LINE?y*=this._currentRowHeight:m.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(y*=this._currentRowHeight*this._bufferService.rows),y}getBufferElements(m,y){var k;let b,S="";const N=[],E=y??this._bufferService.buffer.lines.length,T=this._bufferService.buffer.lines;for(let L=m;L<E;L++){const A=T.get(L);if(!A)continue;const I=(k=T.get(L+1))==null?void 0:k.isWrapped;if(S+=A.translateToString(!I),!I||L===T.length-1){const M=document.createElement("div");M.textContent=S,N.push(M),S.length>0&&(b=M),S=""}}return{bufferElements:N,cursorElement:b}}getLinesScrolled(m){if(m.deltaY===0||m.shiftKey)return 0;let y=this._applyScrollModifier(m.deltaY,m);return m.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(y/=this._currentRowHeight+0,this._wheelPartialScroll+=y,y=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):m.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(y*=this._bufferService.rows),y}_applyScrollModifier(m,y){const b=this._optionsService.rawOptions.fastScrollModifier;return b==="alt"&&y.altKey||b==="ctrl"&&y.ctrlKey||b==="shift"&&y.shiftKey?m*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:m*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(m){this._lastTouchY=m.touches[0].pageY}handleTouchMove(m){const y=this._lastTouchY-m.touches[0].pageY;return this._lastTouchY=m.touches[0].pageY,y!==0&&(this._viewportElement.scrollTop+=y,this._bubbleScroll(m,y))}};a.Viewport=g=u([c(2,w.IBufferService),c(3,w.IOptionsService),c(4,v.ICharSizeService),c(5,v.IRenderService),c(6,v.ICoreBrowserService),c(7,v.IThemeService)],g)},3107:function(o,a,l){var u=this&&this.__decorate||function(w,g,m,y){var b,S=arguments.length,N=S<3?g:y===null?y=Object.getOwnPropertyDescriptor(g,m):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(w,g,m,y);else for(var E=w.length-1;E>=0;E--)(b=w[E])&&(N=(S<3?b(N):S>3?b(g,m,N):b(g,m))||N);return S>3&&N&&Object.defineProperty(g,m,N),N},c=this&&this.__param||function(w,g){return function(m,y){g(m,y,w)}};Object.defineProperty(a,"__esModule",{value:!0}),a.BufferDecorationRenderer=void 0;const h=l(4725),v=l(844),d=l(2585);let x=a.BufferDecorationRenderer=class extends v.Disposable{constructor(w,g,m,y,b){super(),this._screenElement=w,this._bufferService=g,this._coreBrowserService=m,this._decorationService=y,this._renderService=b,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this.register(this._renderService.onRenderedViewportChange((()=>this._doRefreshDecorations()))),this.register(this._renderService.onDimensionsChange((()=>{this._dimensionsChanged=!0,this._queueRefresh()}))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt}))),this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh()))),this.register(this._decorationService.onDecorationRemoved((S=>this._removeDecoration(S)))),this.register((0,v.toDisposable)((()=>{this._container.remove(),this._decorationElements.clear()})))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback((()=>{this._doRefreshDecorations(),this._animationFrame=void 0})))}_doRefreshDecorations(){for(const w of this._decorationService.decorations)this._renderDecoration(w);this._dimensionsChanged=!1}_renderDecoration(w){this._refreshStyle(w),this._dimensionsChanged&&this._refreshXPosition(w)}_createElement(w){var y;const g=this._coreBrowserService.mainDocument.createElement("div");g.classList.add("xterm-decoration"),g.classList.toggle("xterm-decoration-top-layer",((y=w==null?void 0:w.options)==null?void 0:y.layer)==="top"),g.style.width=`${Math.round((w.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,g.style.height=(w.options.height||1)*this._renderService.dimensions.css.cell.height+"px",g.style.top=(w.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",g.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const m=w.options.x??0;return m&&m>this._bufferService.cols&&(g.style.display="none"),this._refreshXPosition(w,g),g}_refreshStyle(w){const g=w.marker.line-this._bufferService.buffers.active.ydisp;if(g<0||g>=this._bufferService.rows)w.element&&(w.element.style.display="none",w.onRenderEmitter.fire(w.element));else{let m=this._decorationElements.get(w);m||(m=this._createElement(w),w.element=m,this._decorationElements.set(w,m),this._container.appendChild(m),w.onDispose((()=>{this._decorationElements.delete(w),m.remove()}))),m.style.top=g*this._renderService.dimensions.css.cell.height+"px",m.style.display=this._altBufferIsActive?"none":"block",w.onRenderEmitter.fire(m)}}_refreshXPosition(w,g=w.element){if(!g)return;const m=w.options.x??0;(w.options.anchor||"left")==="right"?g.style.right=m?m*this._renderService.dimensions.css.cell.width+"px":"":g.style.left=m?m*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(w){var g;(g=this._decorationElements.get(w))==null||g.remove(),this._decorationElements.delete(w),w.dispose()}};a.BufferDecorationRenderer=x=u([c(1,d.IBufferService),c(2,h.ICoreBrowserService),c(3,d.IDecorationService),c(4,h.IRenderService)],x)},5871:(o,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.ColorZoneStore=void 0,a.ColorZoneStore=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(l){if(l.options.overviewRulerOptions){for(const u of this._zones)if(u.color===l.options.overviewRulerOptions.color&&u.position===l.options.overviewRulerOptions.position){if(this._lineIntersectsZone(u,l.marker.line))return;if(this._lineAdjacentToZone(u,l.marker.line,l.options.overviewRulerOptions.position))return void this._addLineToZone(u,l.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=l.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=l.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=l.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=l.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:l.options.overviewRulerOptions.color,position:l.options.overviewRulerOptions.position,startBufferLine:l.marker.line,endBufferLine:l.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(l){this._linePadding=l}_lineIntersectsZone(l,u){return u>=l.startBufferLine&&u<=l.endBufferLine}_lineAdjacentToZone(l,u,c){return u>=l.startBufferLine-this._linePadding[c||"full"]&&u<=l.endBufferLine+this._linePadding[c||"full"]}_addLineToZone(l,u){l.startBufferLine=Math.min(l.startBufferLine,u),l.endBufferLine=Math.max(l.endBufferLine,u)}}},5744:function(o,a,l){var u=this&&this.__decorate||function(b,S,N,E){var T,k=arguments.length,L=k<3?S:E===null?E=Object.getOwnPropertyDescriptor(S,N):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")L=Reflect.decorate(b,S,N,E);else for(var A=b.length-1;A>=0;A--)(T=b[A])&&(L=(k<3?T(L):k>3?T(S,N,L):T(S,N))||L);return k>3&&L&&Object.defineProperty(S,N,L),L},c=this&&this.__param||function(b,S){return function(N,E){S(N,E,b)}};Object.defineProperty(a,"__esModule",{value:!0}),a.OverviewRulerRenderer=void 0;const h=l(5871),v=l(4725),d=l(844),x=l(2585),w={full:0,left:0,center:0,right:0},g={full:0,left:0,center:0,right:0},m={full:0,left:0,center:0,right:0};let y=a.OverviewRulerRenderer=class extends d.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(b,S,N,E,T,k,L){var I;super(),this._viewportElement=b,this._screenElement=S,this._bufferService=N,this._decorationService=E,this._renderService=T,this._optionsService=k,this._coreBrowserService=L,this._colorZoneStore=new h.ColorZoneStore,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),(I=this._viewportElement.parentElement)==null||I.insertBefore(this._canvas,this._viewportElement);const A=this._canvas.getContext("2d");if(!A)throw new Error("Ctx cannot be null");this._ctx=A,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,d.toDisposable)((()=>{var M;(M=this._canvas)==null||M.remove()})))}_registerDecorationListeners(){this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh(void 0,!0)))),this.register(this._decorationService.onDecorationRemoved((()=>this._queueRefresh(void 0,!0))))}_registerBufferChangeListeners(){this.register(this._renderService.onRenderedViewportChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"}))),this.register(this._bufferService.onScroll((()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})))}_registerDimensionChangeListeners(){this.register(this._renderService.onRender((()=>{this._containerHeight&&this._containerHeight===this._screenElement.clientHeight||(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)}))),this.register(this._optionsService.onSpecificOptionChange("overviewRulerWidth",(()=>this._queueRefresh(!0)))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh(!0)))),this._queueRefresh(!0)}_refreshDrawConstants(){const b=Math.floor(this._canvas.width/3),S=Math.ceil(this._canvas.width/3);g.full=this._canvas.width,g.left=b,g.center=S,g.right=b,this._refreshDrawHeightConstants(),m.full=0,m.left=0,m.center=g.left,m.right=g.left+g.center}_refreshDrawHeightConstants(){w.full=Math.round(2*this._coreBrowserService.dpr);const b=this._canvas.height/this._bufferService.buffer.lines.length,S=Math.round(Math.max(Math.min(b,12),6)*this._coreBrowserService.dpr);w.left=S,w.center=S,w.right=S}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*w.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*w.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*w.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*w.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(const S of this._decorationService.decorations)this._colorZoneStore.addDecoration(S);this._ctx.lineWidth=1;const b=this._colorZoneStore.zones;for(const S of b)S.position!=="full"&&this._renderColorZone(S);for(const S of b)S.position==="full"&&this._renderColorZone(S);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(b){this._ctx.fillStyle=b.color,this._ctx.fillRect(m[b.position||"full"],Math.round((this._canvas.height-1)*(b.startBufferLine/this._bufferService.buffers.active.lines.length)-w[b.position||"full"]/2),g[b.position||"full"],Math.round((this._canvas.height-1)*((b.endBufferLine-b.startBufferLine)/this._bufferService.buffers.active.lines.length)+w[b.position||"full"]))}_queueRefresh(b,S){this._shouldUpdateDimensions=b||this._shouldUpdateDimensions,this._shouldUpdateAnchor=S||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};a.OverviewRulerRenderer=y=u([c(2,x.IBufferService),c(3,x.IDecorationService),c(4,v.IRenderService),c(5,x.IOptionsService),c(6,v.ICoreBrowserService)],y)},2950:function(o,a,l){var u=this&&this.__decorate||function(w,g,m,y){var b,S=arguments.length,N=S<3?g:y===null?y=Object.getOwnPropertyDescriptor(g,m):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(w,g,m,y);else for(var E=w.length-1;E>=0;E--)(b=w[E])&&(N=(S<3?b(N):S>3?b(g,m,N):b(g,m))||N);return S>3&&N&&Object.defineProperty(g,m,N),N},c=this&&this.__param||function(w,g){return function(m,y){g(m,y,w)}};Object.defineProperty(a,"__esModule",{value:!0}),a.CompositionHelper=void 0;const h=l(4725),v=l(2585),d=l(2584);let x=a.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(w,g,m,y,b,S){this._textarea=w,this._compositionView=g,this._bufferService=m,this._optionsService=y,this._coreService=b,this._renderService=S,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(w){this._compositionView.textContent=w.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(w){if(this._isComposing||this._isSendingComposition){if(w.keyCode===229||w.keyCode===16||w.keyCode===17||w.keyCode===18)return!1;this._finalizeComposition(!1)}return w.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(w){if(this._compositionView.classList.remove("active"),this._isComposing=!1,w){const g={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let m;this._isSendingComposition=!1,g.start+=this._dataAlreadySent.length,m=this._isComposing?this._textarea.value.substring(g.start,g.end):this._textarea.value.substring(g.start),m.length>0&&this._coreService.triggerDataEvent(m,!0)}}),0)}else{this._isSendingComposition=!1;const g=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(g,!0)}}_handleAnyTextareaChanges(){const w=this._textarea.value;setTimeout((()=>{if(!this._isComposing){const g=this._textarea.value,m=g.replace(w,"");this._dataAlreadySent=m,g.length>w.length?this._coreService.triggerDataEvent(m,!0):g.length<w.length?this._coreService.triggerDataEvent(`${d.C0.DEL}`,!0):g.length===w.length&&g!==w&&this._coreService.triggerDataEvent(g,!0)}}),0)}updateCompositionElements(w){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const g=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),m=this._renderService.dimensions.css.cell.height,y=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,b=g*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=b+"px",this._compositionView.style.top=y+"px",this._compositionView.style.height=m+"px",this._compositionView.style.lineHeight=m+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";const S=this._compositionView.getBoundingClientRect();this._textarea.style.left=b+"px",this._textarea.style.top=y+"px",this._textarea.style.width=Math.max(S.width,1)+"px",this._textarea.style.height=Math.max(S.height,1)+"px",this._textarea.style.lineHeight=S.height+"px"}w||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};a.CompositionHelper=x=u([c(2,v.IBufferService),c(3,v.IOptionsService),c(4,v.ICoreService),c(5,h.IRenderService)],x)},9806:(o,a)=>{function l(u,c,h){const v=h.getBoundingClientRect(),d=u.getComputedStyle(h),x=parseInt(d.getPropertyValue("padding-left")),w=parseInt(d.getPropertyValue("padding-top"));return[c.clientX-v.left-x,c.clientY-v.top-w]}Object.defineProperty(a,"__esModule",{value:!0}),a.getCoords=a.getCoordsRelativeToElement=void 0,a.getCoordsRelativeToElement=l,a.getCoords=function(u,c,h,v,d,x,w,g,m){if(!x)return;const y=l(u,c,h);return y?(y[0]=Math.ceil((y[0]+(m?w/2:0))/w),y[1]=Math.ceil(y[1]/g),y[0]=Math.min(Math.max(y[0],1),v+(m?1:0)),y[1]=Math.min(Math.max(y[1],1),d),y):void 0}},9504:(o,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.moveToCellSequence=void 0;const u=l(2584);function c(g,m,y,b){const S=g-h(g,y),N=m-h(m,y),E=Math.abs(S-N)-(function(T,k,L){let A=0;const I=T-h(T,L),M=k-h(k,L);for(let B=0;B<Math.abs(I-M);B++){const D=v(T,k)==="A"?-1:1,H=L.buffer.lines.get(I+D*B);H!=null&&H.isWrapped&&A++}return A})(g,m,y);return w(E,x(v(g,m),b))}function h(g,m){let y=0,b=m.buffer.lines.get(g),S=b==null?void 0:b.isWrapped;for(;S&&g>=0&&g<m.rows;)y++,b=m.buffer.lines.get(--g),S=b==null?void 0:b.isWrapped;return y}function v(g,m){return g>m?"A":"B"}function d(g,m,y,b,S,N){let E=g,T=m,k="";for(;E!==y||T!==b;)E+=S?1:-1,S&&E>N.cols-1?(k+=N.buffer.translateBufferLineToString(T,!1,g,E),E=0,g=0,T++):!S&&E<0&&(k+=N.buffer.translateBufferLineToString(T,!1,0,g+1),E=N.cols-1,g=E,T--);return k+N.buffer.translateBufferLineToString(T,!1,g,E)}function x(g,m){const y=m?"O":"[";return u.C0.ESC+y+g}function w(g,m){g=Math.floor(g);let y="";for(let b=0;b<g;b++)y+=m;return y}a.moveToCellSequence=function(g,m,y,b){const S=y.buffer.x,N=y.buffer.y;if(!y.buffer.hasScrollback)return(function(k,L,A,I,M,B){return c(L,I,M,B).length===0?"":w(d(k,L,k,L-h(L,M),!1,M).length,x("D",B))})(S,N,0,m,y,b)+c(N,m,y,b)+(function(k,L,A,I,M,B){let D;D=c(L,I,M,B).length>0?I-h(I,M):L;const H=I,U=(function(z,W,F,P,j,G){let $;return $=c(F,P,j,G).length>0?P-h(P,j):W,z<F&&$<=P||z>=F&&$<P?"C":"D"})(k,L,A,I,M,B);return w(d(k,D,A,H,U==="C",M).length,x(U,B))})(S,N,g,m,y,b);let E;if(N===m)return E=S>g?"D":"C",w(Math.abs(S-g),x(E,b));E=N>m?"D":"C";const T=Math.abs(N-m);return w((function(k,L){return L.cols-k})(N>m?g:S,y)+(T-1)*y.cols+1+((N>m?S:g)-1),x(E,b))}},1296:function(o,a,l){var u=this&&this.__decorate||function(B,D,H,U){var z,W=arguments.length,F=W<3?D:U===null?U=Object.getOwnPropertyDescriptor(D,H):U;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")F=Reflect.decorate(B,D,H,U);else for(var P=B.length-1;P>=0;P--)(z=B[P])&&(F=(W<3?z(F):W>3?z(D,H,F):z(D,H))||F);return W>3&&F&&Object.defineProperty(D,H,F),F},c=this&&this.__param||function(B,D){return function(H,U){D(H,U,B)}};Object.defineProperty(a,"__esModule",{value:!0}),a.DomRenderer=void 0;const h=l(3787),v=l(2550),d=l(2223),x=l(6171),w=l(6052),g=l(4725),m=l(8055),y=l(8460),b=l(844),S=l(2585),N="xterm-dom-renderer-owner-",E="xterm-rows",T="xterm-fg-",k="xterm-bg-",L="xterm-focus",A="xterm-selection";let I=1,M=a.DomRenderer=class extends b.Disposable{constructor(B,D,H,U,z,W,F,P,j,G,$,ee,ae){super(),this._terminal=B,this._document=D,this._element=H,this._screenElement=U,this._viewportElement=z,this._helperContainer=W,this._linkifier2=F,this._charSizeService=j,this._optionsService=G,this._bufferService=$,this._coreBrowserService=ee,this._themeService=ae,this._terminalClass=I++,this._rowElements=[],this._selectionRenderModel=(0,w.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new y.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(E),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement("div"),this._selectionContainer.classList.add(A),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,x.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((ie=>this._injectCss(ie)))),this._injectCss(this._themeService.colors),this._rowFactory=P.createInstance(h.DomRendererRowFactory,document),this._element.classList.add(N+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((ie=>this._handleLinkHover(ie)))),this.register(this._linkifier2.onHideLinkUnderline((ie=>this._handleLinkLeave(ie)))),this.register((0,b.toDisposable)((()=>{this._element.classList.remove(N+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new v.WidthCache(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){const B=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*B,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*B),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/B),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/B),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(const H of this._rowElements)H.style.width=`${this.dimensions.css.canvas.width}px`,H.style.height=`${this.dimensions.css.cell.height}px`,H.style.lineHeight=`${this.dimensions.css.cell.height}px`,H.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const D=`${this._terminalSelector} .${E} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=D,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(B){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let D=`${this._terminalSelector} .${E} { color: ${B.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;D+=`${this._terminalSelector} .${E} .xterm-dim { color: ${m.color.multiplyOpacity(B.foreground,.5).css};}`,D+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;const H=`blink_underline_${this._terminalClass}`,U=`blink_bar_${this._terminalClass}`,z=`blink_block_${this._terminalClass}`;D+=`@keyframes ${H} { 50% { border-bottom-style: hidden; }}`,D+=`@keyframes ${U} { 50% { box-shadow: none; }}`,D+=`@keyframes ${z} { 0% { background-color: ${B.cursor.css}; color: ${B.cursorAccent.css}; } 50% { background-color: inherit; color: ${B.cursor.css}; }}`,D+=`${this._terminalSelector} .${E}.${L} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${H} 1s step-end infinite;}${this._terminalSelector} .${E}.${L} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${U} 1s step-end infinite;}${this._terminalSelector} .${E}.${L} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${z} 1s step-end infinite;}${this._terminalSelector} .${E} .xterm-cursor.xterm-cursor-block { background-color: ${B.cursor.css}; color: ${B.cursorAccent.css};}${this._terminalSelector} .${E} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${B.cursor.css} !important; color: ${B.cursorAccent.css} !important;}${this._terminalSelector} .${E} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${B.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${E} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${B.cursor.css} inset;}${this._terminalSelector} .${E} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${B.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,D+=`${this._terminalSelector} .${A} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${A} div { position: absolute; background-color: ${B.selectionBackgroundOpaque.css};}${this._terminalSelector} .${A} div { position: absolute; background-color: ${B.selectionInactiveBackgroundOpaque.css};}`;for(const[W,F]of B.ansi.entries())D+=`${this._terminalSelector} .${T}${W} { color: ${F.css}; }${this._terminalSelector} .${T}${W}.xterm-dim { color: ${m.color.multiplyOpacity(F,.5).css}; }${this._terminalSelector} .${k}${W} { background-color: ${F.css}; }`;D+=`${this._terminalSelector} .${T}${d.INVERTED_DEFAULT_COLOR} { color: ${m.color.opaque(B.background).css}; }${this._terminalSelector} .${T}${d.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${m.color.multiplyOpacity(m.color.opaque(B.background),.5).css}; }${this._terminalSelector} .${k}${d.INVERTED_DEFAULT_COLOR} { background-color: ${B.foreground.css}; }`,this._themeStyleElement.textContent=D}_setDefaultSpacing(){const B=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${B}px`,this._rowFactory.defaultSpacing=B}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(B,D){for(let H=this._rowElements.length;H<=D;H++){const U=this._document.createElement("div");this._rowContainer.appendChild(U),this._rowElements.push(U)}for(;this._rowElements.length>D;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(B,D){this._refreshRowElements(B,D),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(L),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(L),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(B,D,H){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(B,D,H),this.renderRows(0,this._bufferService.rows-1),!B||!D)return;this._selectionRenderModel.update(this._terminal,B,D,H);const U=this._selectionRenderModel.viewportStartRow,z=this._selectionRenderModel.viewportEndRow,W=this._selectionRenderModel.viewportCappedStartRow,F=this._selectionRenderModel.viewportCappedEndRow;if(W>=this._bufferService.rows||F<0)return;const P=this._document.createDocumentFragment();if(H){const j=B[0]>D[0];P.appendChild(this._createSelectionElement(W,j?D[0]:B[0],j?B[0]:D[0],F-W+1))}else{const j=U===W?B[0]:0,G=W===z?D[0]:this._bufferService.cols;P.appendChild(this._createSelectionElement(W,j,G));const $=F-W-1;if(P.appendChild(this._createSelectionElement(W+1,0,this._bufferService.cols,$)),W!==F){const ee=z===F?D[0]:this._bufferService.cols;P.appendChild(this._createSelectionElement(F,0,ee))}}this._selectionContainer.appendChild(P)}_createSelectionElement(B,D,H,U=1){const z=this._document.createElement("div"),W=D*this.dimensions.css.cell.width;let F=this.dimensions.css.cell.width*(H-D);return W+F>this.dimensions.css.canvas.width&&(F=this.dimensions.css.canvas.width-W),z.style.height=U*this.dimensions.css.cell.height+"px",z.style.top=B*this.dimensions.css.cell.height+"px",z.style.left=`${W}px`,z.style.width=`${F}px`,z}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(const B of this._rowElements)B.replaceChildren()}renderRows(B,D){const H=this._bufferService.buffer,U=H.ybase+H.y,z=Math.min(H.x,this._bufferService.cols-1),W=this._optionsService.rawOptions.cursorBlink,F=this._optionsService.rawOptions.cursorStyle,P=this._optionsService.rawOptions.cursorInactiveStyle;for(let j=B;j<=D;j++){const G=j+H.ydisp,$=this._rowElements[j],ee=H.lines.get(G);if(!$||!ee)break;$.replaceChildren(...this._rowFactory.createRow(ee,G,G===U,F,P,z,W,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${N}${this._terminalClass}`}_handleLinkHover(B){this._setCellUnderline(B.x1,B.x2,B.y1,B.y2,B.cols,!0)}_handleLinkLeave(B){this._setCellUnderline(B.x1,B.x2,B.y1,B.y2,B.cols,!1)}_setCellUnderline(B,D,H,U,z,W){H<0&&(B=0),U<0&&(D=0);const F=this._bufferService.rows-1;H=Math.max(Math.min(H,F),0),U=Math.max(Math.min(U,F),0),z=Math.min(z,this._bufferService.cols);const P=this._bufferService.buffer,j=P.ybase+P.y,G=Math.min(P.x,z-1),$=this._optionsService.rawOptions.cursorBlink,ee=this._optionsService.rawOptions.cursorStyle,ae=this._optionsService.rawOptions.cursorInactiveStyle;for(let ie=H;ie<=U;++ie){const K=ie+P.ydisp,q=this._rowElements[ie],Y=P.lines.get(K);if(!q||!Y)break;q.replaceChildren(...this._rowFactory.createRow(Y,K,K===j,ee,ae,G,$,this.dimensions.css.cell.width,this._widthCache,W?ie===H?B:0:-1,W?(ie===U?D:z)-1:-1))}}};a.DomRenderer=M=u([c(7,S.IInstantiationService),c(8,g.ICharSizeService),c(9,S.IOptionsService),c(10,S.IBufferService),c(11,g.ICoreBrowserService),c(12,g.IThemeService)],M)},3787:function(o,a,l){var u=this&&this.__decorate||function(E,T,k,L){var A,I=arguments.length,M=I<3?T:L===null?L=Object.getOwnPropertyDescriptor(T,k):L;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")M=Reflect.decorate(E,T,k,L);else for(var B=E.length-1;B>=0;B--)(A=E[B])&&(M=(I<3?A(M):I>3?A(T,k,M):A(T,k))||M);return I>3&&M&&Object.defineProperty(T,k,M),M},c=this&&this.__param||function(E,T){return function(k,L){T(k,L,E)}};Object.defineProperty(a,"__esModule",{value:!0}),a.DomRendererRowFactory=void 0;const h=l(2223),v=l(643),d=l(511),x=l(2585),w=l(8055),g=l(4725),m=l(4269),y=l(6171),b=l(3734);let S=a.DomRendererRowFactory=class{constructor(E,T,k,L,A,I,M){this._document=E,this._characterJoinerService=T,this._optionsService=k,this._coreBrowserService=L,this._coreService=A,this._decorationService=I,this._themeService=M,this._workCell=new d.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(E,T,k){this._selectionStart=E,this._selectionEnd=T,this._columnSelectMode=k}createRow(E,T,k,L,A,I,M,B,D,H,U){const z=[],W=this._characterJoinerService.getJoinedCharacters(T),F=this._themeService.colors;let P,j=E.getNoBgTrimmedLength();k&&j<I+1&&(j=I+1);let G=0,$="",ee=0,ae=0,ie=0,K=!1,q=0,Y=!1,X=0;const J=[],re=H!==-1&&U!==-1;for(let ce=0;ce<j;ce++){E.loadCell(ce,this._workCell);let de=this._workCell.getWidth();if(de===0)continue;let Re=!1,Pe=ce,_e=this._workCell;if(W.length>0&&ce===W[0][0]){Re=!0;const te=W.shift();_e=new m.JoinedCellData(this._workCell,E.translateToString(!0,te[0],te[1]),te[1]-te[0]),Pe=te[1]-1,de=_e.getWidth()}const ke=this._isCellInSelection(ce,T),Le=k&&ce===I,Ee=re&&ce>=H&&ce<=U;let Ie=!1;this._decorationService.forEachDecorationAtCell(ce,T,void 0,(te=>{Ie=!0}));let Oe=_e.getChars()||v.WHITESPACE_CELL_CHAR;if(Oe===" "&&(_e.isUnderline()||_e.isOverline())&&(Oe=" "),X=de*B-D.get(Oe,_e.isBold(),_e.isItalic()),P){if(G&&(ke&&Y||!ke&&!Y&&_e.bg===ee)&&(ke&&Y&&F.selectionForeground||_e.fg===ae)&&_e.extended.ext===ie&&Ee===K&&X===q&&!Le&&!Re&&!Ie){_e.isInvisible()?$+=v.WHITESPACE_CELL_CHAR:$+=Oe,G++;continue}G&&(P.textContent=$),P=this._document.createElement("span"),G=0,$=""}else P=this._document.createElement("span");if(ee=_e.bg,ae=_e.fg,ie=_e.extended.ext,K=Ee,q=X,Y=ke,Re&&I>=ce&&I<=Pe&&(I=ce),!this._coreService.isCursorHidden&&Le&&this._coreService.isCursorInitialized){if(J.push("xterm-cursor"),this._coreBrowserService.isFocused)M&&J.push("xterm-cursor-blink"),J.push(L==="bar"?"xterm-cursor-bar":L==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(A)switch(A){case"outline":J.push("xterm-cursor-outline");break;case"block":J.push("xterm-cursor-block");break;case"bar":J.push("xterm-cursor-bar");break;case"underline":J.push("xterm-cursor-underline")}}if(_e.isBold()&&J.push("xterm-bold"),_e.isItalic()&&J.push("xterm-italic"),_e.isDim()&&J.push("xterm-dim"),$=_e.isInvisible()?v.WHITESPACE_CELL_CHAR:_e.getChars()||v.WHITESPACE_CELL_CHAR,_e.isUnderline()&&(J.push(`xterm-underline-${_e.extended.underlineStyle}`),$===" "&&($=" "),!_e.isUnderlineColorDefault()))if(_e.isUnderlineColorRGB())P.style.textDecorationColor=`rgb(${b.AttributeData.toColorRGB(_e.getUnderlineColor()).join(",")})`;else{let te=_e.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&_e.isBold()&&te<8&&(te+=8),P.style.textDecorationColor=F.ansi[te].css}_e.isOverline()&&(J.push("xterm-overline"),$===" "&&($=" ")),_e.isStrikethrough()&&J.push("xterm-strikethrough"),Ee&&(P.style.textDecoration="underline");let De=_e.getFgColor(),We=_e.getFgColorMode(),Ye=_e.getBgColor(),ge=_e.getBgColorMode();const Ce=!!_e.isInverse();if(Ce){const te=De;De=Ye,Ye=te;const oe=We;We=ge,ge=oe}let Ae,Fe,me,Z=!1;switch(this._decorationService.forEachDecorationAtCell(ce,T,void 0,(te=>{te.options.layer!=="top"&&Z||(te.backgroundColorRGB&&(ge=50331648,Ye=te.backgroundColorRGB.rgba>>8&16777215,Ae=te.backgroundColorRGB),te.foregroundColorRGB&&(We=50331648,De=te.foregroundColorRGB.rgba>>8&16777215,Fe=te.foregroundColorRGB),Z=te.options.layer==="top")})),!Z&&ke&&(Ae=this._coreBrowserService.isFocused?F.selectionBackgroundOpaque:F.selectionInactiveBackgroundOpaque,Ye=Ae.rgba>>8&16777215,ge=50331648,Z=!0,F.selectionForeground&&(We=50331648,De=F.selectionForeground.rgba>>8&16777215,Fe=F.selectionForeground)),Z&&J.push("xterm-decoration-top"),ge){case 16777216:case 33554432:me=F.ansi[Ye],J.push(`xterm-bg-${Ye}`);break;case 50331648:me=w.channels.toColor(Ye>>16,Ye>>8&255,255&Ye),this._addStyle(P,`background-color:#${N((Ye>>>0).toString(16),"0",6)}`);break;default:Ce?(me=F.foreground,J.push(`xterm-bg-${h.INVERTED_DEFAULT_COLOR}`)):me=F.background}switch(Ae||_e.isDim()&&(Ae=w.color.multiplyOpacity(me,.5)),We){case 16777216:case 33554432:_e.isBold()&&De<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(De+=8),this._applyMinimumContrast(P,me,F.ansi[De],_e,Ae,void 0)||J.push(`xterm-fg-${De}`);break;case 50331648:const te=w.channels.toColor(De>>16&255,De>>8&255,255&De);this._applyMinimumContrast(P,me,te,_e,Ae,Fe)||this._addStyle(P,`color:#${N(De.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(P,me,F.foreground,_e,Ae,Fe)||Ce&&J.push(`xterm-fg-${h.INVERTED_DEFAULT_COLOR}`)}J.length&&(P.className=J.join(" "),J.length=0),Le||Re||Ie?P.textContent=$:G++,X!==this.defaultSpacing&&(P.style.letterSpacing=`${X}px`),z.push(P),ce=Pe}return P&&G&&(P.textContent=$),z}_applyMinimumContrast(E,T,k,L,A,I){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,y.treatGlyphAsBackgroundColor)(L.getCode()))return!1;const M=this._getContrastCache(L);let B;if(A||I||(B=M.getColor(T.rgba,k.rgba)),B===void 0){const D=this._optionsService.rawOptions.minimumContrastRatio/(L.isDim()?2:1);B=w.color.ensureContrastRatio(A||T,I||k,D),M.setColor((A||T).rgba,(I||k).rgba,B??null)}return!!B&&(this._addStyle(E,`color:${B.css}`),!0)}_getContrastCache(E){return E.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(E,T){E.setAttribute("style",`${E.getAttribute("style")||""}${T};`)}_isCellInSelection(E,T){const k=this._selectionStart,L=this._selectionEnd;return!(!k||!L)&&(this._columnSelectMode?k[0]<=L[0]?E>=k[0]&&T>=k[1]&&E<L[0]&&T<=L[1]:E<k[0]&&T>=k[1]&&E>=L[0]&&T<=L[1]:T>k[1]&&T<L[1]||k[1]===L[1]&&T===k[1]&&E>=k[0]&&E<L[0]||k[1]<L[1]&&T===L[1]&&E<L[0]||k[1]<L[1]&&T===k[1]&&E>=k[0])}};function N(E,T,k){for(;E.length<k;)E=T+E;return E}a.DomRendererRowFactory=S=u([c(1,g.ICharacterJoinerService),c(2,x.IOptionsService),c(3,g.ICoreBrowserService),c(4,x.ICoreService),c(5,x.IDecorationService),c(6,g.IThemeService)],S)},2550:(o,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.WidthCache=void 0,a.WidthCache=class{constructor(l,u){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=l.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";const c=l.createElement("span");c.classList.add("xterm-char-measure-element");const h=l.createElement("span");h.classList.add("xterm-char-measure-element"),h.style.fontWeight="bold";const v=l.createElement("span");v.classList.add("xterm-char-measure-element"),v.style.fontStyle="italic";const d=l.createElement("span");d.classList.add("xterm-char-measure-element"),d.style.fontWeight="bold",d.style.fontStyle="italic",this._measureElements=[c,h,v,d],this._container.appendChild(c),this._container.appendChild(h),this._container.appendChild(v),this._container.appendChild(d),u.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(l,u,c,h){l===this._font&&u===this._fontSize&&c===this._weight&&h===this._weightBold||(this._font=l,this._fontSize=u,this._weight=c,this._weightBold=h,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${c}`,this._measureElements[1].style.fontWeight=`${h}`,this._measureElements[2].style.fontWeight=`${c}`,this._measureElements[3].style.fontWeight=`${h}`,this.clear())}get(l,u,c){let h=0;if(!u&&!c&&l.length===1&&(h=l.charCodeAt(0))<256){if(this._flat[h]!==-9999)return this._flat[h];const x=this._measure(l,0);return x>0&&(this._flat[h]=x),x}let v=l;u&&(v+="B"),c&&(v+="I");let d=this._holey.get(v);if(d===void 0){let x=0;u&&(x|=1),c&&(x|=2),d=this._measure(l,x),d>0&&this._holey.set(v,d)}return d}_measure(l,u){const c=this._measureElements[u];return c.textContent=l.repeat(32),c.offsetWidth/32}}},2223:(o,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.TEXT_BASELINE=a.DIM_OPACITY=a.INVERTED_DEFAULT_COLOR=void 0;const u=l(6114);a.INVERTED_DEFAULT_COLOR=257,a.DIM_OPACITY=.5,a.TEXT_BASELINE=u.isFirefox||u.isLegacyEdge?"bottom":"ideographic"},6171:(o,a)=>{function l(c){return 57508<=c&&c<=57558}function u(c){return c>=128512&&c<=128591||c>=127744&&c<=128511||c>=128640&&c<=128767||c>=9728&&c<=9983||c>=9984&&c<=10175||c>=65024&&c<=65039||c>=129280&&c<=129535||c>=127462&&c<=127487}Object.defineProperty(a,"__esModule",{value:!0}),a.computeNextVariantOffset=a.createRenderDimensions=a.treatGlyphAsBackgroundColor=a.allowRescaling=a.isEmoji=a.isRestrictedPowerlineGlyph=a.isPowerlineGlyph=a.throwIfFalsy=void 0,a.throwIfFalsy=function(c){if(!c)throw new Error("value must not be falsy");return c},a.isPowerlineGlyph=l,a.isRestrictedPowerlineGlyph=function(c){return 57520<=c&&c<=57527},a.isEmoji=u,a.allowRescaling=function(c,h,v,d){return h===1&&v>Math.ceil(1.5*d)&&c!==void 0&&c>255&&!u(c)&&!l(c)&&!(function(x){return 57344<=x&&x<=63743})(c)},a.treatGlyphAsBackgroundColor=function(c){return l(c)||(function(h){return 9472<=h&&h<=9631})(c)},a.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},a.computeNextVariantOffset=function(c,h,v=0){return(c-(2*Math.round(h)-v))%(2*Math.round(h))}},6052:(o,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.createSelectionRenderModel=void 0;class l{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(c,h,v,d=!1){if(this.selectionStart=h,this.selectionEnd=v,!h||!v||h[0]===v[0]&&h[1]===v[1])return void this.clear();const x=c.buffers.active.ydisp,w=h[1]-x,g=v[1]-x,m=Math.max(w,0),y=Math.min(g,c.rows-1);m>=c.rows||y<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=d,this.viewportStartRow=w,this.viewportEndRow=g,this.viewportCappedStartRow=m,this.viewportCappedEndRow=y,this.startCol=h[0],this.endCol=v[0])}isCellSelected(c,h,v){return!!this.hasSelection&&(v-=c.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?h>=this.startCol&&v>=this.viewportCappedStartRow&&h<this.endCol&&v<=this.viewportCappedEndRow:h<this.startCol&&v>=this.viewportCappedStartRow&&h>=this.endCol&&v<=this.viewportCappedEndRow:v>this.viewportStartRow&&v<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&v===this.viewportStartRow&&h>=this.startCol&&h<this.endCol||this.viewportStartRow<this.viewportEndRow&&v===this.viewportEndRow&&h<this.endCol||this.viewportStartRow<this.viewportEndRow&&v===this.viewportStartRow&&h>=this.startCol)}}a.createSelectionRenderModel=function(){return new l}},456:(o,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.SelectionModel=void 0,a.SelectionModel=class{constructor(l){this._bufferService=l,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){const l=this.selectionStart[0]+this.selectionStartLength;return l>this._bufferService.cols?l%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(l/this._bufferService.cols)-1]:[l%this._bufferService.cols,this.selectionStart[1]+Math.floor(l/this._bufferService.cols)]:[l,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){const l=this.selectionStart[0]+this.selectionStartLength;return l>this._bufferService.cols?[l%this._bufferService.cols,this.selectionStart[1]+Math.floor(l/this._bufferService.cols)]:[Math.max(l,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){const l=this.selectionStart,u=this.selectionEnd;return!(!l||!u)&&(l[1]>u[1]||l[1]===u[1]&&l[0]>u[0])}handleTrim(l){return this.selectionStart&&(this.selectionStart[1]-=l),this.selectionEnd&&(this.selectionEnd[1]-=l),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(o,a,l){var u=this&&this.__decorate||function(y,b,S,N){var E,T=arguments.length,k=T<3?b:N===null?N=Object.getOwnPropertyDescriptor(b,S):N;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(y,b,S,N);else for(var L=y.length-1;L>=0;L--)(E=y[L])&&(k=(T<3?E(k):T>3?E(b,S,k):E(b,S))||k);return T>3&&k&&Object.defineProperty(b,S,k),k},c=this&&this.__param||function(y,b){return function(S,N){b(S,N,y)}};Object.defineProperty(a,"__esModule",{value:!0}),a.CharSizeService=void 0;const h=l(2585),v=l(8460),d=l(844);let x=a.CharSizeService=class extends d.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(y,b,S){super(),this._optionsService=S,this.width=0,this.height=0,this._onCharSizeChange=this.register(new v.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new m(this._optionsService))}catch{this._measureStrategy=this.register(new g(y,b,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){const y=this._measureStrategy.measure();y.width===this.width&&y.height===this.height||(this.width=y.width,this.height=y.height,this._onCharSizeChange.fire())}};a.CharSizeService=x=u([c(2,h.IOptionsService)],x);class w extends d.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(b,S){b!==void 0&&b>0&&S!==void 0&&S>0&&(this._result.width=b,this._result.height=S)}}class g extends w{constructor(b,S,N){super(),this._document=b,this._parentElement=S,this._optionsService=N,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}}class m extends w{constructor(b){super(),this._optionsService=b,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");const S=this._ctx.measureText("W");if(!("width"in S&&"fontBoundingBoxAscent"in S&&"fontBoundingBoxDescent"in S))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;const b=this._ctx.measureText("W");return this._validateAndSet(b.width,b.fontBoundingBoxAscent+b.fontBoundingBoxDescent),this._result}}},4269:function(o,a,l){var u=this&&this.__decorate||function(m,y,b,S){var N,E=arguments.length,T=E<3?y:S===null?S=Object.getOwnPropertyDescriptor(y,b):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(m,y,b,S);else for(var k=m.length-1;k>=0;k--)(N=m[k])&&(T=(E<3?N(T):E>3?N(y,b,T):N(y,b))||T);return E>3&&T&&Object.defineProperty(y,b,T),T},c=this&&this.__param||function(m,y){return function(b,S){y(b,S,m)}};Object.defineProperty(a,"__esModule",{value:!0}),a.CharacterJoinerService=a.JoinedCellData=void 0;const h=l(3734),v=l(643),d=l(511),x=l(2585);class w extends h.AttributeData{constructor(y,b,S){super(),this.content=0,this.combinedData="",this.fg=y.fg,this.bg=y.bg,this.combinedData=b,this._width=S}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(y){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}a.JoinedCellData=w;let g=a.CharacterJoinerService=class rS{constructor(y){this._bufferService=y,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new d.CellData}register(y){const b={id:this._nextCharacterJoinerId++,handler:y};return this._characterJoiners.push(b),b.id}deregister(y){for(let b=0;b<this._characterJoiners.length;b++)if(this._characterJoiners[b].id===y)return this._characterJoiners.splice(b,1),!0;return!1}getJoinedCharacters(y){if(this._characterJoiners.length===0)return[];const b=this._bufferService.buffer.lines.get(y);if(!b||b.length===0)return[];const S=[],N=b.translateToString(!0);let E=0,T=0,k=0,L=b.getFg(0),A=b.getBg(0);for(let I=0;I<b.getTrimmedLength();I++)if(b.loadCell(I,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==L||this._workCell.bg!==A){if(I-E>1){const M=this._getJoinedRanges(N,k,T,b,E);for(let B=0;B<M.length;B++)S.push(M[B])}E=I,k=T,L=this._workCell.fg,A=this._workCell.bg}T+=this._workCell.getChars().length||v.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-E>1){const I=this._getJoinedRanges(N,k,T,b,E);for(let M=0;M<I.length;M++)S.push(I[M])}return S}_getJoinedRanges(y,b,S,N,E){const T=y.substring(b,S);let k=[];try{k=this._characterJoiners[0].handler(T)}catch(L){console.error(L)}for(let L=1;L<this._characterJoiners.length;L++)try{const A=this._characterJoiners[L].handler(T);for(let I=0;I<A.length;I++)rS._mergeRanges(k,A[I])}catch(A){console.error(A)}return this._stringRangesToCellRanges(k,N,E),k}_stringRangesToCellRanges(y,b,S){let N=0,E=!1,T=0,k=y[N];if(k){for(let L=S;L<this._bufferService.cols;L++){const A=b.getWidth(L),I=b.getString(L).length||v.WHITESPACE_CELL_CHAR.length;if(A!==0){if(!E&&k[0]<=T&&(k[0]=L,E=!0),k[1]<=T){if(k[1]=L,k=y[++N],!k)break;k[0]<=T?(k[0]=L,E=!0):E=!1}T+=I}}k&&(k[1]=this._bufferService.cols)}}static _mergeRanges(y,b){let S=!1;for(let N=0;N<y.length;N++){const E=y[N];if(S){if(b[1]<=E[0])return y[N-1][1]=b[1],y;if(b[1]<=E[1])return y[N-1][1]=Math.max(b[1],E[1]),y.splice(N,1),y;y.splice(N,1),N--}else{if(b[1]<=E[0])return y.splice(N,0,b),y;if(b[1]<=E[1])return E[0]=Math.min(b[0],E[0]),y;b[0]<E[1]&&(E[0]=Math.min(b[0],E[0]),S=!0)}}return S?y[y.length-1][1]=b[1]:y.push(b),y}};a.CharacterJoinerService=g=u([c(0,x.IBufferService)],g)},5114:(o,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.CoreBrowserService=void 0;const u=l(844),c=l(8460),h=l(3656);class v extends u.Disposable{constructor(w,g,m){super(),this._textarea=w,this._window=g,this.mainDocument=m,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new d(this._window),this._onDprChange=this.register(new c.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new c.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((y=>this._screenDprMonitor.setWindow(y)))),this.register((0,c.forwardEvent)(this._screenDprMonitor.onDprChange,this._onDprChange)),this._textarea.addEventListener("focus",(()=>this._isFocused=!0)),this._textarea.addEventListener("blur",(()=>this._isFocused=!1))}get window(){return this._window}set window(w){this._window!==w&&(this._window=w,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask((()=>this._cachedIsFocused=void 0))),this._cachedIsFocused}}a.CoreBrowserService=v;class d extends u.Disposable{constructor(w){super(),this._parentWindow=w,this._windowResizeListener=this.register(new u.MutableDisposable),this._onDprChange=this.register(new c.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,u.toDisposable)((()=>this.clearListener())))}setWindow(w){this._parentWindow=w,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,h.addDisposableDomListener)(this._parentWindow,"resize",(()=>this._setDprAndFireIfDiffers()))}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var w;this._outerListener&&((w=this._resolutionMediaMatchList)==null||w.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){this._resolutionMediaMatchList&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}}},779:(o,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.LinkProviderService=void 0;const u=l(844);class c extends u.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,u.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(v){return this.linkProviders.push(v),{dispose:()=>{const d=this.linkProviders.indexOf(v);d!==-1&&this.linkProviders.splice(d,1)}}}}a.LinkProviderService=c},8934:function(o,a,l){var u=this&&this.__decorate||function(x,w,g,m){var y,b=arguments.length,S=b<3?w:m===null?m=Object.getOwnPropertyDescriptor(w,g):m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(x,w,g,m);else for(var N=x.length-1;N>=0;N--)(y=x[N])&&(S=(b<3?y(S):b>3?y(w,g,S):y(w,g))||S);return b>3&&S&&Object.defineProperty(w,g,S),S},c=this&&this.__param||function(x,w){return function(g,m){w(g,m,x)}};Object.defineProperty(a,"__esModule",{value:!0}),a.MouseService=void 0;const h=l(4725),v=l(9806);let d=a.MouseService=class{constructor(x,w){this._renderService=x,this._charSizeService=w}getCoords(x,w,g,m,y){return(0,v.getCoords)(window,x,w,g,m,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,y)}getMouseReportCoords(x,w){const g=(0,v.getCoordsRelativeToElement)(window,x,w);if(this._charSizeService.hasValidSize)return g[0]=Math.min(Math.max(g[0],0),this._renderService.dimensions.css.canvas.width-1),g[1]=Math.min(Math.max(g[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(g[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(g[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(g[0]),y:Math.floor(g[1])}}};a.MouseService=d=u([c(0,h.IRenderService),c(1,h.ICharSizeService)],d)},3230:function(o,a,l){var u=this&&this.__decorate||function(y,b,S,N){var E,T=arguments.length,k=T<3?b:N===null?N=Object.getOwnPropertyDescriptor(b,S):N;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(y,b,S,N);else for(var L=y.length-1;L>=0;L--)(E=y[L])&&(k=(T<3?E(k):T>3?E(b,S,k):E(b,S))||k);return T>3&&k&&Object.defineProperty(b,S,k),k},c=this&&this.__param||function(y,b){return function(S,N){b(S,N,y)}};Object.defineProperty(a,"__esModule",{value:!0}),a.RenderService=void 0;const h=l(6193),v=l(4725),d=l(8460),x=l(844),w=l(7226),g=l(2585);let m=a.RenderService=class extends x.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(y,b,S,N,E,T,k,L){super(),this._rowCount=y,this._charSizeService=N,this._renderer=this.register(new x.MutableDisposable),this._pausedResizeTask=new w.DebouncedIdleTask,this._observerDisposable=this.register(new x.MutableDisposable),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this.register(new d.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new d.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new d.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new d.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new h.RenderDebouncer(((A,I)=>this._renderRows(A,I)),k),this.register(this._renderDebouncer),this.register(k.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(T.onResize((()=>this._fullRefresh()))),this.register(T.buffers.onBufferActivate((()=>{var A;return(A=this._renderer.value)==null?void 0:A.clear()}))),this.register(S.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(E.onDecorationRegistered((()=>this._fullRefresh()))),this.register(E.onDecorationRemoved((()=>this._fullRefresh()))),this.register(S.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],(()=>{this.clear(),this.handleResize(T.cols,T.rows),this._fullRefresh()}))),this.register(S.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(T.buffer.y,T.buffer.y,!0)))),this.register(L.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(k.window,b),this.register(k.onWindowChange((A=>this._registerIntersectionObserver(A,b))))}_registerIntersectionObserver(y,b){if("IntersectionObserver"in y){const S=new y.IntersectionObserver((N=>this._handleIntersectionChange(N[N.length-1])),{threshold:0});S.observe(b),this._observerDisposable.value=(0,x.toDisposable)((()=>S.disconnect()))}}_handleIntersectionChange(y){this._isPaused=y.isIntersecting===void 0?y.intersectionRatio===0:!y.isIntersecting,this._isPaused||this._charSizeService.hasValidSize||this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(y,b,S=!1){this._isPaused?this._needsFullRefresh=!0:(S||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(y,b,this._rowCount))}_renderRows(y,b){this._renderer.value&&(y=Math.min(y,this._rowCount-1),b=Math.min(b,this._rowCount-1),this._renderer.value.renderRows(y,b),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:y,end:b}),this._onRender.fire({start:y,end:b}),this._isNextRenderRedrawOnly=!0)}resize(y,b){this._rowCount=b,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(y){this._renderer.value=y,this._renderer.value&&(this._renderer.value.onRequestRedraw((b=>this.refreshRows(b.start,b.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(y){return this._renderDebouncer.addRefreshCallback(y)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var y,b;this._renderer.value&&((b=(y=this._renderer.value).clearTextureAtlas)==null||b.call(y),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(y,b){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>{var S;return(S=this._renderer.value)==null?void 0:S.handleResize(y,b)})):this._renderer.value.handleResize(y,b),this._fullRefresh())}handleCharSizeChanged(){var y;(y=this._renderer.value)==null||y.handleCharSizeChanged()}handleBlur(){var y;(y=this._renderer.value)==null||y.handleBlur()}handleFocus(){var y;(y=this._renderer.value)==null||y.handleFocus()}handleSelectionChanged(y,b,S){var N;this._selectionState.start=y,this._selectionState.end=b,this._selectionState.columnSelectMode=S,(N=this._renderer.value)==null||N.handleSelectionChanged(y,b,S)}handleCursorMove(){var y;(y=this._renderer.value)==null||y.handleCursorMove()}clear(){var y;(y=this._renderer.value)==null||y.clear()}};a.RenderService=m=u([c(2,g.IOptionsService),c(3,v.ICharSizeService),c(4,g.IDecorationService),c(5,g.IBufferService),c(6,v.ICoreBrowserService),c(7,v.IThemeService)],m)},9312:function(o,a,l){var u=this&&this.__decorate||function(k,L,A,I){var M,B=arguments.length,D=B<3?L:I===null?I=Object.getOwnPropertyDescriptor(L,A):I;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(k,L,A,I);else for(var H=k.length-1;H>=0;H--)(M=k[H])&&(D=(B<3?M(D):B>3?M(L,A,D):M(L,A))||D);return B>3&&D&&Object.defineProperty(L,A,D),D},c=this&&this.__param||function(k,L){return function(A,I){L(A,I,k)}};Object.defineProperty(a,"__esModule",{value:!0}),a.SelectionService=void 0;const h=l(9806),v=l(9504),d=l(456),x=l(4725),w=l(8460),g=l(844),m=l(6114),y=l(4841),b=l(511),S=l(2585),N=" ",E=new RegExp(N,"g");let T=a.SelectionService=class extends g.Disposable{constructor(k,L,A,I,M,B,D,H,U){super(),this._element=k,this._screenElement=L,this._linkifier=A,this._bufferService=I,this._coreService=M,this._mouseService=B,this._optionsService=D,this._renderService=H,this._coreBrowserService=U,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new b.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new w.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new w.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new w.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new w.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=z=>this._handleMouseMove(z),this._mouseUpListener=z=>this._handleMouseUp(z),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((z=>this._handleTrim(z))),this.register(this._bufferService.buffers.onBufferActivate((z=>this._handleBufferActivate(z)))),this.enable(),this._model=new d.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,g.toDisposable)((()=>{this._removeMouseDownListeners()})))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){const k=this._model.finalSelectionStart,L=this._model.finalSelectionEnd;return!(!k||!L||k[0]===L[0]&&k[1]===L[1])}get selectionText(){const k=this._model.finalSelectionStart,L=this._model.finalSelectionEnd;if(!k||!L)return"";const A=this._bufferService.buffer,I=[];if(this._activeSelectionMode===3){if(k[0]===L[0])return"";const M=k[0]<L[0]?k[0]:L[0],B=k[0]<L[0]?L[0]:k[0];for(let D=k[1];D<=L[1];D++){const H=A.translateBufferLineToString(D,!0,M,B);I.push(H)}}else{const M=k[1]===L[1]?L[0]:void 0;I.push(A.translateBufferLineToString(k[1],!0,k[0],M));for(let B=k[1]+1;B<=L[1]-1;B++){const D=A.lines.get(B),H=A.translateBufferLineToString(B,!0);D!=null&&D.isWrapped?I[I.length-1]+=H:I.push(H)}if(k[1]!==L[1]){const B=A.lines.get(L[1]),D=A.translateBufferLineToString(L[1],!0,0,L[0]);B&&B.isWrapped?I[I.length-1]+=D:I.push(D)}}return I.map((M=>M.replace(E," "))).join(m.isWindows?`\r
380
- `:`
381
- `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(k){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),m.isLinux&&k&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(k){const L=this._getMouseBufferCoords(k),A=this._model.finalSelectionStart,I=this._model.finalSelectionEnd;return!!(A&&I&&L)&&this._areCoordsInSelection(L,A,I)}isCellInSelection(k,L){const A=this._model.finalSelectionStart,I=this._model.finalSelectionEnd;return!(!A||!I)&&this._areCoordsInSelection([k,L],A,I)}_areCoordsInSelection(k,L,A){return k[1]>L[1]&&k[1]<A[1]||L[1]===A[1]&&k[1]===L[1]&&k[0]>=L[0]&&k[0]<A[0]||L[1]<A[1]&&k[1]===A[1]&&k[0]<A[0]||L[1]<A[1]&&k[1]===L[1]&&k[0]>=L[0]}_selectWordAtCursor(k,L){var M,B;const A=(B=(M=this._linkifier.currentLink)==null?void 0:M.link)==null?void 0:B.range;if(A)return this._model.selectionStart=[A.start.x-1,A.start.y-1],this._model.selectionStartLength=(0,y.getRangeLength)(A,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const I=this._getMouseBufferCoords(k);return!!I&&(this._selectWordAt(I,L),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(k,L){this._model.clearSelection(),k=Math.max(k,0),L=Math.min(L,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,k],this._model.selectionEnd=[this._bufferService.cols,L],this.refresh(),this._onSelectionChange.fire()}_handleTrim(k){this._model.handleTrim(k)&&this.refresh()}_getMouseBufferCoords(k){const L=this._mouseService.getCoords(k,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(L)return L[0]--,L[1]--,L[1]+=this._bufferService.buffer.ydisp,L}_getMouseEventScrollAmount(k){let L=(0,h.getCoordsRelativeToElement)(this._coreBrowserService.window,k,this._screenElement)[1];const A=this._renderService.dimensions.css.canvas.height;return L>=0&&L<=A?0:(L>A&&(L-=A),L=Math.min(Math.max(L,-50),50),L/=50,L/Math.abs(L)+Math.round(14*L))}shouldForceSelection(k){return m.isMac?k.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:k.shiftKey}handleMouseDown(k){if(this._mouseDownTimeStamp=k.timeStamp,(k.button!==2||!this.hasSelection)&&k.button===0){if(!this._enabled){if(!this.shouldForceSelection(k))return;k.stopPropagation()}k.preventDefault(),this._dragScrollAmount=0,this._enabled&&k.shiftKey?this._handleIncrementalClick(k):k.detail===1?this._handleSingleClick(k):k.detail===2?this._handleDoubleClick(k):k.detail===3&&this._handleTripleClick(k),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval((()=>this._dragScroll()),50)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(k){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(k))}_handleSingleClick(k){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(k)?3:0,this._model.selectionStart=this._getMouseBufferCoords(k),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const L=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);L&&L.length!==this._model.selectionStart[0]&&L.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(k){this._selectWordAtCursor(k,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(k){const L=this._getMouseBufferCoords(k);L&&(this._activeSelectionMode=2,this._selectLineAt(L[1]))}shouldColumnSelect(k){return k.altKey&&!(m.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(k){if(k.stopImmediatePropagation(),!this._model.selectionStart)return;const L=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(k),!this._model.selectionEnd)return void this.refresh(!0);this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(k),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const A=this._bufferService.buffer;if(this._model.selectionEnd[1]<A.lines.length){const I=A.lines.get(this._model.selectionEnd[1]);I&&I.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}L&&L[0]===this._model.selectionEnd[0]&&L[1]===this._model.selectionEnd[1]||this.refresh(!0)}_dragScroll(){if(this._model.selectionEnd&&this._model.selectionStart&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});const k=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(k.ydisp+this._bufferService.rows,k.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=k.ydisp),this.refresh()}}_handleMouseUp(k){const L=k.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&L<500&&k.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const A=this._mouseService.getCoords(k,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(A&&A[0]!==void 0&&A[1]!==void 0){const I=(0,v.moveToCellSequence)(A[0]-1,A[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(I,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const k=this._model.finalSelectionStart,L=this._model.finalSelectionEnd,A=!(!k||!L||k[0]===L[0]&&k[1]===L[1]);A?k&&L&&(this._oldSelectionStart&&this._oldSelectionEnd&&k[0]===this._oldSelectionStart[0]&&k[1]===this._oldSelectionStart[1]&&L[0]===this._oldSelectionEnd[0]&&L[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(k,L,A)):this._oldHasSelection&&this._fireOnSelectionChange(k,L,A)}_fireOnSelectionChange(k,L,A){this._oldSelectionStart=k,this._oldSelectionEnd=L,this._oldHasSelection=A,this._onSelectionChange.fire()}_handleBufferActivate(k){this.clearSelection(),this._trimListener.dispose(),this._trimListener=k.activeBuffer.lines.onTrim((L=>this._handleTrim(L)))}_convertViewportColToCharacterIndex(k,L){let A=L;for(let I=0;L>=I;I++){const M=k.loadCell(I,this._workCell).getChars().length;this._workCell.getWidth()===0?A--:M>1&&L!==I&&(A+=M-1)}return A}setSelection(k,L,A){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[k,L],this._model.selectionStartLength=A,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(k){this._isClickInSelection(k)||(this._selectWordAtCursor(k,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(k,L,A=!0,I=!0){if(k[0]>=this._bufferService.cols)return;const M=this._bufferService.buffer,B=M.lines.get(k[1]);if(!B)return;const D=M.translateBufferLineToString(k[1],!1);let H=this._convertViewportColToCharacterIndex(B,k[0]),U=H;const z=k[0]-H;let W=0,F=0,P=0,j=0;if(D.charAt(H)===" "){for(;H>0&&D.charAt(H-1)===" ";)H--;for(;U<D.length&&D.charAt(U+1)===" ";)U++}else{let ee=k[0],ae=k[0];B.getWidth(ee)===0&&(W++,ee--),B.getWidth(ae)===2&&(F++,ae++);const ie=B.getString(ae).length;for(ie>1&&(j+=ie-1,U+=ie-1);ee>0&&H>0&&!this._isCharWordSeparator(B.loadCell(ee-1,this._workCell));){B.loadCell(ee-1,this._workCell);const K=this._workCell.getChars().length;this._workCell.getWidth()===0?(W++,ee--):K>1&&(P+=K-1,H-=K-1),H--,ee--}for(;ae<B.length&&U+1<D.length&&!this._isCharWordSeparator(B.loadCell(ae+1,this._workCell));){B.loadCell(ae+1,this._workCell);const K=this._workCell.getChars().length;this._workCell.getWidth()===2?(F++,ae++):K>1&&(j+=K-1,U+=K-1),U++,ae++}}U++;let G=H+z-W+P,$=Math.min(this._bufferService.cols,U-H+W+F-P-j);if(L||D.slice(H,U).trim()!==""){if(A&&G===0&&B.getCodePoint(0)!==32){const ee=M.lines.get(k[1]-1);if(ee&&B.isWrapped&&ee.getCodePoint(this._bufferService.cols-1)!==32){const ae=this._getWordAt([this._bufferService.cols-1,k[1]-1],!1,!0,!1);if(ae){const ie=this._bufferService.cols-ae.start;G-=ie,$+=ie}}}if(I&&G+$===this._bufferService.cols&&B.getCodePoint(this._bufferService.cols-1)!==32){const ee=M.lines.get(k[1]+1);if(ee!=null&&ee.isWrapped&&ee.getCodePoint(0)!==32){const ae=this._getWordAt([0,k[1]+1],!1,!1,!0);ae&&($+=ae.length)}}return{start:G,length:$}}}_selectWordAt(k,L){const A=this._getWordAt(k,L);if(A){for(;A.start<0;)A.start+=this._bufferService.cols,k[1]--;this._model.selectionStart=[A.start,k[1]],this._model.selectionStartLength=A.length}}_selectToWordAt(k){const L=this._getWordAt(k,!0);if(L){let A=k[1];for(;L.start<0;)L.start+=this._bufferService.cols,A--;if(!this._model.areSelectionValuesReversed())for(;L.start+L.length>this._bufferService.cols;)L.length-=this._bufferService.cols,A++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?L.start:L.start+L.length,A]}}_isCharWordSeparator(k){return k.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(k.getChars())>=0}_selectLineAt(k){const L=this._bufferService.buffer.getWrappedRangeForLine(k),A={start:{x:0,y:L.first},end:{x:this._bufferService.cols-1,y:L.last}};this._model.selectionStart=[0,L.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,y.getRangeLength)(A,this._bufferService.cols)}};a.SelectionService=T=u([c(3,S.IBufferService),c(4,S.ICoreService),c(5,x.IMouseService),c(6,S.IOptionsService),c(7,x.IRenderService),c(8,x.ICoreBrowserService)],T)},4725:(o,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.ILinkProviderService=a.IThemeService=a.ICharacterJoinerService=a.ISelectionService=a.IRenderService=a.IMouseService=a.ICoreBrowserService=a.ICharSizeService=void 0;const u=l(8343);a.ICharSizeService=(0,u.createDecorator)("CharSizeService"),a.ICoreBrowserService=(0,u.createDecorator)("CoreBrowserService"),a.IMouseService=(0,u.createDecorator)("MouseService"),a.IRenderService=(0,u.createDecorator)("RenderService"),a.ISelectionService=(0,u.createDecorator)("SelectionService"),a.ICharacterJoinerService=(0,u.createDecorator)("CharacterJoinerService"),a.IThemeService=(0,u.createDecorator)("ThemeService"),a.ILinkProviderService=(0,u.createDecorator)("LinkProviderService")},6731:function(o,a,l){var u=this&&this.__decorate||function(T,k,L,A){var I,M=arguments.length,B=M<3?k:A===null?A=Object.getOwnPropertyDescriptor(k,L):A;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")B=Reflect.decorate(T,k,L,A);else for(var D=T.length-1;D>=0;D--)(I=T[D])&&(B=(M<3?I(B):M>3?I(k,L,B):I(k,L))||B);return M>3&&B&&Object.defineProperty(k,L,B),B},c=this&&this.__param||function(T,k){return function(L,A){k(L,A,T)}};Object.defineProperty(a,"__esModule",{value:!0}),a.ThemeService=a.DEFAULT_ANSI_COLORS=void 0;const h=l(7239),v=l(8055),d=l(8460),x=l(844),w=l(2585),g=v.css.toColor("#ffffff"),m=v.css.toColor("#000000"),y=v.css.toColor("#ffffff"),b=v.css.toColor("#000000"),S={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};a.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const T=[v.css.toColor("#2e3436"),v.css.toColor("#cc0000"),v.css.toColor("#4e9a06"),v.css.toColor("#c4a000"),v.css.toColor("#3465a4"),v.css.toColor("#75507b"),v.css.toColor("#06989a"),v.css.toColor("#d3d7cf"),v.css.toColor("#555753"),v.css.toColor("#ef2929"),v.css.toColor("#8ae234"),v.css.toColor("#fce94f"),v.css.toColor("#729fcf"),v.css.toColor("#ad7fa8"),v.css.toColor("#34e2e2"),v.css.toColor("#eeeeec")],k=[0,95,135,175,215,255];for(let L=0;L<216;L++){const A=k[L/36%6|0],I=k[L/6%6|0],M=k[L%6];T.push({css:v.channels.toCss(A,I,M),rgba:v.channels.toRgba(A,I,M)})}for(let L=0;L<24;L++){const A=8+10*L;T.push({css:v.channels.toCss(A,A,A),rgba:v.channels.toRgba(A,A,A)})}return T})());let N=a.ThemeService=class extends x.Disposable{get colors(){return this._colors}constructor(T){super(),this._optionsService=T,this._contrastCache=new h.ColorContrastCache,this._halfContrastCache=new h.ColorContrastCache,this._onChangeColors=this.register(new d.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:g,background:m,cursor:y,cursorAccent:b,selectionForeground:void 0,selectionBackgroundTransparent:S,selectionBackgroundOpaque:v.color.blend(m,S),selectionInactiveBackgroundTransparent:S,selectionInactiveBackgroundOpaque:v.color.blend(m,S),ansi:a.DEFAULT_ANSI_COLORS.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this.register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",(()=>this._contrastCache.clear()))),this.register(this._optionsService.onSpecificOptionChange("theme",(()=>this._setTheme(this._optionsService.rawOptions.theme))))}_setTheme(T={}){const k=this._colors;if(k.foreground=E(T.foreground,g),k.background=E(T.background,m),k.cursor=E(T.cursor,y),k.cursorAccent=E(T.cursorAccent,b),k.selectionBackgroundTransparent=E(T.selectionBackground,S),k.selectionBackgroundOpaque=v.color.blend(k.background,k.selectionBackgroundTransparent),k.selectionInactiveBackgroundTransparent=E(T.selectionInactiveBackground,k.selectionBackgroundTransparent),k.selectionInactiveBackgroundOpaque=v.color.blend(k.background,k.selectionInactiveBackgroundTransparent),k.selectionForeground=T.selectionForeground?E(T.selectionForeground,v.NULL_COLOR):void 0,k.selectionForeground===v.NULL_COLOR&&(k.selectionForeground=void 0),v.color.isOpaque(k.selectionBackgroundTransparent)&&(k.selectionBackgroundTransparent=v.color.opacity(k.selectionBackgroundTransparent,.3)),v.color.isOpaque(k.selectionInactiveBackgroundTransparent)&&(k.selectionInactiveBackgroundTransparent=v.color.opacity(k.selectionInactiveBackgroundTransparent,.3)),k.ansi=a.DEFAULT_ANSI_COLORS.slice(),k.ansi[0]=E(T.black,a.DEFAULT_ANSI_COLORS[0]),k.ansi[1]=E(T.red,a.DEFAULT_ANSI_COLORS[1]),k.ansi[2]=E(T.green,a.DEFAULT_ANSI_COLORS[2]),k.ansi[3]=E(T.yellow,a.DEFAULT_ANSI_COLORS[3]),k.ansi[4]=E(T.blue,a.DEFAULT_ANSI_COLORS[4]),k.ansi[5]=E(T.magenta,a.DEFAULT_ANSI_COLORS[5]),k.ansi[6]=E(T.cyan,a.DEFAULT_ANSI_COLORS[6]),k.ansi[7]=E(T.white,a.DEFAULT_ANSI_COLORS[7]),k.ansi[8]=E(T.brightBlack,a.DEFAULT_ANSI_COLORS[8]),k.ansi[9]=E(T.brightRed,a.DEFAULT_ANSI_COLORS[9]),k.ansi[10]=E(T.brightGreen,a.DEFAULT_ANSI_COLORS[10]),k.ansi[11]=E(T.brightYellow,a.DEFAULT_ANSI_COLORS[11]),k.ansi[12]=E(T.brightBlue,a.DEFAULT_ANSI_COLORS[12]),k.ansi[13]=E(T.brightMagenta,a.DEFAULT_ANSI_COLORS[13]),k.ansi[14]=E(T.brightCyan,a.DEFAULT_ANSI_COLORS[14]),k.ansi[15]=E(T.brightWhite,a.DEFAULT_ANSI_COLORS[15]),T.extendedAnsi){const L=Math.min(k.ansi.length-16,T.extendedAnsi.length);for(let A=0;A<L;A++)k.ansi[A+16]=E(T.extendedAnsi[A],a.DEFAULT_ANSI_COLORS[A+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(T){this._restoreColor(T),this._onChangeColors.fire(this.colors)}_restoreColor(T){if(T!==void 0)switch(T){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[T]=this._restoreColors.ansi[T]}else for(let k=0;k<this._restoreColors.ansi.length;++k)this._colors.ansi[k]=this._restoreColors.ansi[k]}modifyColors(T){T(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};function E(T,k){if(T!==void 0)try{return v.css.toColor(T)}catch{}return k}a.ThemeService=N=u([c(0,w.IOptionsService)],N)},6349:(o,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.CircularList=void 0;const u=l(8460),c=l(844);class h extends c.Disposable{constructor(d){super(),this._maxLength=d,this.onDeleteEmitter=this.register(new u.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new u.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new u.EventEmitter),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(d){if(this._maxLength===d)return;const x=new Array(d);for(let w=0;w<Math.min(d,this.length);w++)x[w]=this._array[this._getCyclicIndex(w)];this._array=x,this._maxLength=d,this._startIndex=0}get length(){return this._length}set length(d){if(d>this._length)for(let x=this._length;x<d;x++)this._array[x]=void 0;this._length=d}get(d){return this._array[this._getCyclicIndex(d)]}set(d,x){this._array[this._getCyclicIndex(d)]=x}push(d){this._array[this._getCyclicIndex(this._length)]=d,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(d,x,...w){if(x){for(let g=d;g<this._length-x;g++)this._array[this._getCyclicIndex(g)]=this._array[this._getCyclicIndex(g+x)];this._length-=x,this.onDeleteEmitter.fire({index:d,amount:x})}for(let g=this._length-1;g>=d;g--)this._array[this._getCyclicIndex(g+w.length)]=this._array[this._getCyclicIndex(g)];for(let g=0;g<w.length;g++)this._array[this._getCyclicIndex(d+g)]=w[g];if(w.length&&this.onInsertEmitter.fire({index:d,amount:w.length}),this._length+w.length>this._maxLength){const g=this._length+w.length-this._maxLength;this._startIndex+=g,this._length=this._maxLength,this.onTrimEmitter.fire(g)}else this._length+=w.length}trimStart(d){d>this._length&&(d=this._length),this._startIndex+=d,this._length-=d,this.onTrimEmitter.fire(d)}shiftElements(d,x,w){if(!(x<=0)){if(d<0||d>=this._length)throw new Error("start argument out of range");if(d+w<0)throw new Error("Cannot shift elements in list beyond index 0");if(w>0){for(let m=x-1;m>=0;m--)this.set(d+m+w,this.get(d+m));const g=d+x+w-this._length;if(g>0)for(this._length+=g;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let g=0;g<x;g++)this.set(d+g+w,this.get(d+g))}}_getCyclicIndex(d){return(this._startIndex+d)%this._maxLength}}a.CircularList=h},1439:(o,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.clone=void 0,a.clone=function l(u,c=5){if(typeof u!="object")return u;const h=Array.isArray(u)?[]:{};for(const v in u)h[v]=c<=1?u[v]:u[v]&&l(u[v],c-1);return h}},8055:(o,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.contrastRatio=a.toPaddedHex=a.rgba=a.rgb=a.css=a.color=a.channels=a.NULL_COLOR=void 0;let l=0,u=0,c=0,h=0;var v,d,x,w,g;function m(b){const S=b.toString(16);return S.length<2?"0"+S:S}function y(b,S){return b<S?(S+.05)/(b+.05):(b+.05)/(S+.05)}a.NULL_COLOR={css:"#00000000",rgba:0},(function(b){b.toCss=function(S,N,E,T){return T!==void 0?`#${m(S)}${m(N)}${m(E)}${m(T)}`:`#${m(S)}${m(N)}${m(E)}`},b.toRgba=function(S,N,E,T=255){return(S<<24|N<<16|E<<8|T)>>>0},b.toColor=function(S,N,E,T){return{css:b.toCss(S,N,E,T),rgba:b.toRgba(S,N,E,T)}}})(v||(a.channels=v={})),(function(b){function S(N,E){return h=Math.round(255*E),[l,u,c]=g.toChannels(N.rgba),{css:v.toCss(l,u,c,h),rgba:v.toRgba(l,u,c,h)}}b.blend=function(N,E){if(h=(255&E.rgba)/255,h===1)return{css:E.css,rgba:E.rgba};const T=E.rgba>>24&255,k=E.rgba>>16&255,L=E.rgba>>8&255,A=N.rgba>>24&255,I=N.rgba>>16&255,M=N.rgba>>8&255;return l=A+Math.round((T-A)*h),u=I+Math.round((k-I)*h),c=M+Math.round((L-M)*h),{css:v.toCss(l,u,c),rgba:v.toRgba(l,u,c)}},b.isOpaque=function(N){return(255&N.rgba)==255},b.ensureContrastRatio=function(N,E,T){const k=g.ensureContrastRatio(N.rgba,E.rgba,T);if(k)return v.toColor(k>>24&255,k>>16&255,k>>8&255)},b.opaque=function(N){const E=(255|N.rgba)>>>0;return[l,u,c]=g.toChannels(E),{css:v.toCss(l,u,c),rgba:E}},b.opacity=S,b.multiplyOpacity=function(N,E){return h=255&N.rgba,S(N,h*E/255)},b.toColorRGB=function(N){return[N.rgba>>24&255,N.rgba>>16&255,N.rgba>>8&255]}})(d||(a.color=d={})),(function(b){let S,N;try{const E=document.createElement("canvas");E.width=1,E.height=1;const T=E.getContext("2d",{willReadFrequently:!0});T&&(S=T,S.globalCompositeOperation="copy",N=S.createLinearGradient(0,0,1,1))}catch{}b.toColor=function(E){if(E.match(/#[\da-f]{3,8}/i))switch(E.length){case 4:return l=parseInt(E.slice(1,2).repeat(2),16),u=parseInt(E.slice(2,3).repeat(2),16),c=parseInt(E.slice(3,4).repeat(2),16),v.toColor(l,u,c);case 5:return l=parseInt(E.slice(1,2).repeat(2),16),u=parseInt(E.slice(2,3).repeat(2),16),c=parseInt(E.slice(3,4).repeat(2),16),h=parseInt(E.slice(4,5).repeat(2),16),v.toColor(l,u,c,h);case 7:return{css:E,rgba:(parseInt(E.slice(1),16)<<8|255)>>>0};case 9:return{css:E,rgba:parseInt(E.slice(1),16)>>>0}}const T=E.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(T)return l=parseInt(T[1]),u=parseInt(T[2]),c=parseInt(T[3]),h=Math.round(255*(T[5]===void 0?1:parseFloat(T[5]))),v.toColor(l,u,c,h);if(!S||!N)throw new Error("css.toColor: Unsupported css format");if(S.fillStyle=N,S.fillStyle=E,typeof S.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(S.fillRect(0,0,1,1),[l,u,c,h]=S.getImageData(0,0,1,1).data,h!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:v.toRgba(l,u,c,h),css:E}}})(x||(a.css=x={})),(function(b){function S(N,E,T){const k=N/255,L=E/255,A=T/255;return .2126*(k<=.03928?k/12.92:Math.pow((k+.055)/1.055,2.4))+.7152*(L<=.03928?L/12.92:Math.pow((L+.055)/1.055,2.4))+.0722*(A<=.03928?A/12.92:Math.pow((A+.055)/1.055,2.4))}b.relativeLuminance=function(N){return S(N>>16&255,N>>8&255,255&N)},b.relativeLuminance2=S})(w||(a.rgb=w={})),(function(b){function S(E,T,k){const L=E>>24&255,A=E>>16&255,I=E>>8&255;let M=T>>24&255,B=T>>16&255,D=T>>8&255,H=y(w.relativeLuminance2(M,B,D),w.relativeLuminance2(L,A,I));for(;H<k&&(M>0||B>0||D>0);)M-=Math.max(0,Math.ceil(.1*M)),B-=Math.max(0,Math.ceil(.1*B)),D-=Math.max(0,Math.ceil(.1*D)),H=y(w.relativeLuminance2(M,B,D),w.relativeLuminance2(L,A,I));return(M<<24|B<<16|D<<8|255)>>>0}function N(E,T,k){const L=E>>24&255,A=E>>16&255,I=E>>8&255;let M=T>>24&255,B=T>>16&255,D=T>>8&255,H=y(w.relativeLuminance2(M,B,D),w.relativeLuminance2(L,A,I));for(;H<k&&(M<255||B<255||D<255);)M=Math.min(255,M+Math.ceil(.1*(255-M))),B=Math.min(255,B+Math.ceil(.1*(255-B))),D=Math.min(255,D+Math.ceil(.1*(255-D))),H=y(w.relativeLuminance2(M,B,D),w.relativeLuminance2(L,A,I));return(M<<24|B<<16|D<<8|255)>>>0}b.blend=function(E,T){if(h=(255&T)/255,h===1)return T;const k=T>>24&255,L=T>>16&255,A=T>>8&255,I=E>>24&255,M=E>>16&255,B=E>>8&255;return l=I+Math.round((k-I)*h),u=M+Math.round((L-M)*h),c=B+Math.round((A-B)*h),v.toRgba(l,u,c)},b.ensureContrastRatio=function(E,T,k){const L=w.relativeLuminance(E>>8),A=w.relativeLuminance(T>>8);if(y(L,A)<k){if(A<L){const B=S(E,T,k),D=y(L,w.relativeLuminance(B>>8));if(D<k){const H=N(E,T,k);return D>y(L,w.relativeLuminance(H>>8))?B:H}return B}const I=N(E,T,k),M=y(L,w.relativeLuminance(I>>8));if(M<k){const B=S(E,T,k);return M>y(L,w.relativeLuminance(B>>8))?I:B}return I}},b.reduceLuminance=S,b.increaseLuminance=N,b.toChannels=function(E){return[E>>24&255,E>>16&255,E>>8&255,255&E]}})(g||(a.rgba=g={})),a.toPaddedHex=m,a.contrastRatio=y},8969:(o,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.CoreTerminal=void 0;const u=l(844),c=l(2585),h=l(4348),v=l(7866),d=l(744),x=l(7302),w=l(6975),g=l(8460),m=l(1753),y=l(1480),b=l(7994),S=l(9282),N=l(5435),E=l(5981),T=l(2660);let k=!1;class L extends u.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new g.EventEmitter),this._onScroll.event((I=>{var M;(M=this._onScrollApi)==null||M.fire(I.position)}))),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(I){for(const M in I)this.optionsService.options[M]=I[M]}constructor(I){super(),this._windowsWrappingHeuristics=this.register(new u.MutableDisposable),this._onBinary=this.register(new g.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new g.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new g.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new g.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new g.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new g.EventEmitter),this._instantiationService=new h.InstantiationService,this.optionsService=this.register(new x.OptionsService(I)),this._instantiationService.setService(c.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(d.BufferService)),this._instantiationService.setService(c.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(v.LogService)),this._instantiationService.setService(c.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(w.CoreService)),this._instantiationService.setService(c.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(m.CoreMouseService)),this._instantiationService.setService(c.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(y.UnicodeService)),this._instantiationService.setService(c.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(b.CharsetService),this._instantiationService.setService(c.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(T.OscLinkService),this._instantiationService.setService(c.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new N.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,g.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,g.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,g.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,g.forwardEvent)(this.coreService.onBinary,this._onBinary)),this.register(this.coreService.onRequestScrollToBottom((()=>this.scrollToBottom()))),this.register(this.coreService.onUserInput((()=>this._writeBuffer.handleUserInput()))),this.register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],(()=>this._handleWindowsPtyOptionChange()))),this.register(this._bufferService.onScroll((M=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this.register(this._inputHandler.onScroll((M=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this._writeBuffer=this.register(new E.WriteBuffer(((M,B)=>this._inputHandler.parse(M,B)))),this.register((0,g.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(I,M){this._writeBuffer.write(I,M)}writeSync(I,M){this._logService.logLevel<=c.LogLevelEnum.WARN&&!k&&(this._logService.warn("writeSync is unreliable and will be removed soon."),k=!0),this._writeBuffer.writeSync(I,M)}input(I,M=!0){this.coreService.triggerDataEvent(I,M)}resize(I,M){isNaN(I)||isNaN(M)||(I=Math.max(I,d.MINIMUM_COLS),M=Math.max(M,d.MINIMUM_ROWS),this._bufferService.resize(I,M))}scroll(I,M=!1){this._bufferService.scroll(I,M)}scrollLines(I,M,B){this._bufferService.scrollLines(I,M,B)}scrollPages(I){this.scrollLines(I*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(I){const M=I-this._bufferService.buffer.ydisp;M!==0&&this.scrollLines(M)}registerEscHandler(I,M){return this._inputHandler.registerEscHandler(I,M)}registerDcsHandler(I,M){return this._inputHandler.registerDcsHandler(I,M)}registerCsiHandler(I,M){return this._inputHandler.registerCsiHandler(I,M)}registerOscHandler(I,M){return this._inputHandler.registerOscHandler(I,M)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let I=!1;const M=this.optionsService.rawOptions.windowsPty;M&&M.buildNumber!==void 0&&M.buildNumber!==void 0?I=M.backend==="conpty"&&M.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(I=!0),I?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const I=[];I.push(this.onLineFeed(S.updateWindowsModeWrappedState.bind(null,this._bufferService))),I.push(this.registerCsiHandler({final:"H"},(()=>((0,S.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,u.toDisposable)((()=>{for(const M of I)M.dispose()}))}}}a.CoreTerminal=L},8460:(o,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.runAndSubscribe=a.forwardEvent=a.EventEmitter=void 0,a.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=l=>(this._listeners.push(l),{dispose:()=>{if(!this._disposed){for(let u=0;u<this._listeners.length;u++)if(this._listeners[u]===l)return void this._listeners.splice(u,1)}}})),this._event}fire(l,u){const c=[];for(let h=0;h<this._listeners.length;h++)c.push(this._listeners[h]);for(let h=0;h<c.length;h++)c[h].call(void 0,l,u)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},a.forwardEvent=function(l,u){return l((c=>u.fire(c)))},a.runAndSubscribe=function(l,u){return u(void 0),l((c=>u(c)))}},5435:function(o,a,l){var u=this&&this.__decorate||function(W,F,P,j){var G,$=arguments.length,ee=$<3?F:j===null?j=Object.getOwnPropertyDescriptor(F,P):j;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")ee=Reflect.decorate(W,F,P,j);else for(var ae=W.length-1;ae>=0;ae--)(G=W[ae])&&(ee=($<3?G(ee):$>3?G(F,P,ee):G(F,P))||ee);return $>3&&ee&&Object.defineProperty(F,P,ee),ee},c=this&&this.__param||function(W,F){return function(P,j){F(P,j,W)}};Object.defineProperty(a,"__esModule",{value:!0}),a.InputHandler=a.WindowsOptionsReportType=void 0;const h=l(2584),v=l(7116),d=l(2015),x=l(844),w=l(482),g=l(8437),m=l(8460),y=l(643),b=l(511),S=l(3734),N=l(2585),E=l(1480),T=l(6242),k=l(6351),L=l(5941),A={"(":0,")":1,"*":2,"+":3,"-":1,".":2},I=131072;function M(W,F){if(W>24)return F.setWinLines||!1;switch(W){case 1:return!!F.restoreWin;case 2:return!!F.minimizeWin;case 3:return!!F.setWinPosition;case 4:return!!F.setWinSizePixels;case 5:return!!F.raiseWin;case 6:return!!F.lowerWin;case 7:return!!F.refreshWin;case 8:return!!F.setWinSizeChars;case 9:return!!F.maximizeWin;case 10:return!!F.fullscreenWin;case 11:return!!F.getWinState;case 13:return!!F.getWinPosition;case 14:return!!F.getWinSizePixels;case 15:return!!F.getScreenSizePixels;case 16:return!!F.getCellSizePixels;case 18:return!!F.getWinSizeChars;case 19:return!!F.getScreenSizeChars;case 20:return!!F.getIconTitle;case 21:return!!F.getWinTitle;case 22:return!!F.pushTitle;case 23:return!!F.popTitle;case 24:return!!F.setWinLines}return!1}var B;(function(W){W[W.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",W[W.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(B||(a.WindowsOptionsReportType=B={}));let D=0;class H extends x.Disposable{getAttrData(){return this._curAttrData}constructor(F,P,j,G,$,ee,ae,ie,K=new d.EscapeSequenceParser){super(),this._bufferService=F,this._charsetService=P,this._coreService=j,this._logService=G,this._optionsService=$,this._oscLinkService=ee,this._coreMouseService=ae,this._unicodeService=ie,this._parser=K,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new w.StringToUtf32,this._utf8Decoder=new w.Utf8ToUtf32,this._workCell=new b.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=g.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=g.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new m.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new m.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new m.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new m.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new m.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new m.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new m.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new m.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new m.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new m.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new m.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new m.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new m.EventEmitter),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this.register(this._parser),this._dirtyRowTracker=new U(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((q=>this._activeBuffer=q.activeBuffer))),this._parser.setCsiHandlerFallback(((q,Y)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(q),params:Y.toArray()})})),this._parser.setEscHandlerFallback((q=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(q)})})),this._parser.setExecuteHandlerFallback((q=>{this._logService.debug("Unknown EXECUTE code: ",{code:q})})),this._parser.setOscHandlerFallback(((q,Y,X)=>{this._logService.debug("Unknown OSC code: ",{identifier:q,action:Y,data:X})})),this._parser.setDcsHandlerFallback(((q,Y,X)=>{Y==="HOOK"&&(X=X.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(q),action:Y,payload:X})})),this._parser.setPrintHandler(((q,Y,X)=>this.print(q,Y,X))),this._parser.registerCsiHandler({final:"@"},(q=>this.insertChars(q))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(q=>this.scrollLeft(q))),this._parser.registerCsiHandler({final:"A"},(q=>this.cursorUp(q))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(q=>this.scrollRight(q))),this._parser.registerCsiHandler({final:"B"},(q=>this.cursorDown(q))),this._parser.registerCsiHandler({final:"C"},(q=>this.cursorForward(q))),this._parser.registerCsiHandler({final:"D"},(q=>this.cursorBackward(q))),this._parser.registerCsiHandler({final:"E"},(q=>this.cursorNextLine(q))),this._parser.registerCsiHandler({final:"F"},(q=>this.cursorPrecedingLine(q))),this._parser.registerCsiHandler({final:"G"},(q=>this.cursorCharAbsolute(q))),this._parser.registerCsiHandler({final:"H"},(q=>this.cursorPosition(q))),this._parser.registerCsiHandler({final:"I"},(q=>this.cursorForwardTab(q))),this._parser.registerCsiHandler({final:"J"},(q=>this.eraseInDisplay(q,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(q=>this.eraseInDisplay(q,!0))),this._parser.registerCsiHandler({final:"K"},(q=>this.eraseInLine(q,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(q=>this.eraseInLine(q,!0))),this._parser.registerCsiHandler({final:"L"},(q=>this.insertLines(q))),this._parser.registerCsiHandler({final:"M"},(q=>this.deleteLines(q))),this._parser.registerCsiHandler({final:"P"},(q=>this.deleteChars(q))),this._parser.registerCsiHandler({final:"S"},(q=>this.scrollUp(q))),this._parser.registerCsiHandler({final:"T"},(q=>this.scrollDown(q))),this._parser.registerCsiHandler({final:"X"},(q=>this.eraseChars(q))),this._parser.registerCsiHandler({final:"Z"},(q=>this.cursorBackwardTab(q))),this._parser.registerCsiHandler({final:"`"},(q=>this.charPosAbsolute(q))),this._parser.registerCsiHandler({final:"a"},(q=>this.hPositionRelative(q))),this._parser.registerCsiHandler({final:"b"},(q=>this.repeatPrecedingCharacter(q))),this._parser.registerCsiHandler({final:"c"},(q=>this.sendDeviceAttributesPrimary(q))),this._parser.registerCsiHandler({prefix:">",final:"c"},(q=>this.sendDeviceAttributesSecondary(q))),this._parser.registerCsiHandler({final:"d"},(q=>this.linePosAbsolute(q))),this._parser.registerCsiHandler({final:"e"},(q=>this.vPositionRelative(q))),this._parser.registerCsiHandler({final:"f"},(q=>this.hVPosition(q))),this._parser.registerCsiHandler({final:"g"},(q=>this.tabClear(q))),this._parser.registerCsiHandler({final:"h"},(q=>this.setMode(q))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(q=>this.setModePrivate(q))),this._parser.registerCsiHandler({final:"l"},(q=>this.resetMode(q))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(q=>this.resetModePrivate(q))),this._parser.registerCsiHandler({final:"m"},(q=>this.charAttributes(q))),this._parser.registerCsiHandler({final:"n"},(q=>this.deviceStatus(q))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(q=>this.deviceStatusPrivate(q))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(q=>this.softReset(q))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(q=>this.setCursorStyle(q))),this._parser.registerCsiHandler({final:"r"},(q=>this.setScrollRegion(q))),this._parser.registerCsiHandler({final:"s"},(q=>this.saveCursor(q))),this._parser.registerCsiHandler({final:"t"},(q=>this.windowOptions(q))),this._parser.registerCsiHandler({final:"u"},(q=>this.restoreCursor(q))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(q=>this.insertColumns(q))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(q=>this.deleteColumns(q))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(q=>this.selectProtected(q))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(q=>this.requestMode(q,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(q=>this.requestMode(q,!1))),this._parser.setExecuteHandler(h.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(h.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(h.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(h.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(h.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(h.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(h.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(h.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(h.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(h.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(h.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(h.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new T.OscHandler((q=>(this.setTitle(q),this.setIconName(q),!0)))),this._parser.registerOscHandler(1,new T.OscHandler((q=>this.setIconName(q)))),this._parser.registerOscHandler(2,new T.OscHandler((q=>this.setTitle(q)))),this._parser.registerOscHandler(4,new T.OscHandler((q=>this.setOrReportIndexedColor(q)))),this._parser.registerOscHandler(8,new T.OscHandler((q=>this.setHyperlink(q)))),this._parser.registerOscHandler(10,new T.OscHandler((q=>this.setOrReportFgColor(q)))),this._parser.registerOscHandler(11,new T.OscHandler((q=>this.setOrReportBgColor(q)))),this._parser.registerOscHandler(12,new T.OscHandler((q=>this.setOrReportCursorColor(q)))),this._parser.registerOscHandler(104,new T.OscHandler((q=>this.restoreIndexedColor(q)))),this._parser.registerOscHandler(110,new T.OscHandler((q=>this.restoreFgColor(q)))),this._parser.registerOscHandler(111,new T.OscHandler((q=>this.restoreBgColor(q)))),this._parser.registerOscHandler(112,new T.OscHandler((q=>this.restoreCursorColor(q)))),this._parser.registerEscHandler({final:"7"},(()=>this.saveCursor())),this._parser.registerEscHandler({final:"8"},(()=>this.restoreCursor())),this._parser.registerEscHandler({final:"D"},(()=>this.index())),this._parser.registerEscHandler({final:"E"},(()=>this.nextLine())),this._parser.registerEscHandler({final:"H"},(()=>this.tabSet())),this._parser.registerEscHandler({final:"M"},(()=>this.reverseIndex())),this._parser.registerEscHandler({final:"="},(()=>this.keypadApplicationMode())),this._parser.registerEscHandler({final:">"},(()=>this.keypadNumericMode())),this._parser.registerEscHandler({final:"c"},(()=>this.fullReset())),this._parser.registerEscHandler({final:"n"},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:"o"},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:"|"},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:"}"},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:"~"},(()=>this.setgLevel(1))),this._parser.registerEscHandler({intermediates:"%",final:"@"},(()=>this.selectDefaultCharset())),this._parser.registerEscHandler({intermediates:"%",final:"G"},(()=>this.selectDefaultCharset()));for(const q in v.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:q},(()=>this.selectCharset("("+q))),this._parser.registerEscHandler({intermediates:")",final:q},(()=>this.selectCharset(")"+q))),this._parser.registerEscHandler({intermediates:"*",final:q},(()=>this.selectCharset("*"+q))),this._parser.registerEscHandler({intermediates:"+",final:q},(()=>this.selectCharset("+"+q))),this._parser.registerEscHandler({intermediates:"-",final:q},(()=>this.selectCharset("-"+q))),this._parser.registerEscHandler({intermediates:".",final:q},(()=>this.selectCharset("."+q))),this._parser.registerEscHandler({intermediates:"/",final:q},(()=>this.selectCharset("/"+q)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((q=>(this._logService.error("Parsing error: ",q),q))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new k.DcsHandler(((q,Y)=>this.requestStatusString(q,Y))))}_preserveStack(F,P,j,G){this._parseStack.paused=!0,this._parseStack.cursorStartX=F,this._parseStack.cursorStartY=P,this._parseStack.decodedLength=j,this._parseStack.position=G}_logSlowResolvingAsync(F){this._logService.logLevel<=N.LogLevelEnum.WARN&&Promise.race([F,new Promise(((P,j)=>setTimeout((()=>j("#SLOW_TIMEOUT")),5e3)))]).catch((P=>{if(P!=="#SLOW_TIMEOUT")throw P;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(F,P){let j,G=this._activeBuffer.x,$=this._activeBuffer.y,ee=0;const ae=this._parseStack.paused;if(ae){if(j=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,P))return this._logSlowResolvingAsync(j),j;G=this._parseStack.cursorStartX,$=this._parseStack.cursorStartY,this._parseStack.paused=!1,F.length>I&&(ee=this._parseStack.position+I)}if(this._logService.logLevel<=N.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof F=="string"?` "${F}"`:` "${Array.prototype.map.call(F,(q=>String.fromCharCode(q))).join("")}"`),typeof F=="string"?F.split("").map((q=>q.charCodeAt(0))):F),this._parseBuffer.length<F.length&&this._parseBuffer.length<I&&(this._parseBuffer=new Uint32Array(Math.min(F.length,I))),ae||this._dirtyRowTracker.clearRange(),F.length>I)for(let q=ee;q<F.length;q+=I){const Y=q+I<F.length?q+I:F.length,X=typeof F=="string"?this._stringDecoder.decode(F.substring(q,Y),this._parseBuffer):this._utf8Decoder.decode(F.subarray(q,Y),this._parseBuffer);if(j=this._parser.parse(this._parseBuffer,X))return this._preserveStack(G,$,X,q),this._logSlowResolvingAsync(j),j}else if(!ae){const q=typeof F=="string"?this._stringDecoder.decode(F,this._parseBuffer):this._utf8Decoder.decode(F,this._parseBuffer);if(j=this._parser.parse(this._parseBuffer,q))return this._preserveStack(G,$,q,0),this._logSlowResolvingAsync(j),j}this._activeBuffer.x===G&&this._activeBuffer.y===$||this._onCursorMove.fire();const ie=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),K=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);K<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(K,this._bufferService.rows-1),Math.min(ie,this._bufferService.rows-1))}print(F,P,j){let G,$;const ee=this._charsetService.charset,ae=this._optionsService.rawOptions.screenReaderMode,ie=this._bufferService.cols,K=this._coreService.decPrivateModes.wraparound,q=this._coreService.modes.insertMode,Y=this._curAttrData;let X=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&j-P>0&&X.getWidth(this._activeBuffer.x-1)===2&&X.setCellFromCodepoint(this._activeBuffer.x-1,0,1,Y);let J=this._parser.precedingJoinState;for(let re=P;re<j;++re){if(G=F[re],G<127&&ee){const Pe=ee[String.fromCharCode(G)];Pe&&(G=Pe.charCodeAt(0))}const ce=this._unicodeService.charProperties(G,J);$=E.UnicodeService.extractWidth(ce);const de=E.UnicodeService.extractShouldJoin(ce),Re=de?E.UnicodeService.extractWidth(J):0;if(J=ce,ae&&this._onA11yChar.fire((0,w.stringFromCodePoint)(G)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+$-Re>ie){if(K){const Pe=X;let _e=this._activeBuffer.x-Re;for(this._activeBuffer.x=Re,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),X=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),Re>0&&X instanceof g.BufferLine&&X.copyCellsFrom(Pe,_e,0,Re,!1);_e<ie;)Pe.setCellFromCodepoint(_e++,0,1,Y)}else if(this._activeBuffer.x=ie-1,$===2)continue}if(de&&this._activeBuffer.x){const Pe=X.getWidth(this._activeBuffer.x-1)?1:2;X.addCodepointToCell(this._activeBuffer.x-Pe,G,$);for(let _e=$-Re;--_e>=0;)X.setCellFromCodepoint(this._activeBuffer.x++,0,0,Y)}else if(q&&(X.insertCells(this._activeBuffer.x,$-Re,this._activeBuffer.getNullCell(Y)),X.getWidth(ie-1)===2&&X.setCellFromCodepoint(ie-1,y.NULL_CELL_CODE,y.NULL_CELL_WIDTH,Y)),X.setCellFromCodepoint(this._activeBuffer.x++,G,$,Y),$>0)for(;--$;)X.setCellFromCodepoint(this._activeBuffer.x++,0,0,Y)}this._parser.precedingJoinState=J,this._activeBuffer.x<ie&&j-P>0&&X.getWidth(this._activeBuffer.x)===0&&!X.hasContent(this._activeBuffer.x)&&X.setCellFromCodepoint(this._activeBuffer.x,0,1,Y),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(F,P){return F.final!=="t"||F.prefix||F.intermediates?this._parser.registerCsiHandler(F,P):this._parser.registerCsiHandler(F,(j=>!M(j.params[0],this._optionsService.rawOptions.windowOptions)||P(j)))}registerDcsHandler(F,P){return this._parser.registerDcsHandler(F,new k.DcsHandler(P))}registerEscHandler(F,P){return this._parser.registerEscHandler(F,P)}registerOscHandler(F,P){return this._parser.registerOscHandler(F,new T.OscHandler(P))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){var F;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&((F=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&F.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const P=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);P.hasWidth(this._activeBuffer.x)&&!P.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const F=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-F),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(F=this._bufferService.cols-1){this._activeBuffer.x=Math.min(F,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(F,P){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=F,this._activeBuffer.y=this._activeBuffer.scrollTop+P):(this._activeBuffer.x=F,this._activeBuffer.y=P),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(F,P){this._restrictCursor(),this._setCursor(this._activeBuffer.x+F,this._activeBuffer.y+P)}cursorUp(F){const P=this._activeBuffer.y-this._activeBuffer.scrollTop;return P>=0?this._moveCursor(0,-Math.min(P,F.params[0]||1)):this._moveCursor(0,-(F.params[0]||1)),!0}cursorDown(F){const P=this._activeBuffer.scrollBottom-this._activeBuffer.y;return P>=0?this._moveCursor(0,Math.min(P,F.params[0]||1)):this._moveCursor(0,F.params[0]||1),!0}cursorForward(F){return this._moveCursor(F.params[0]||1,0),!0}cursorBackward(F){return this._moveCursor(-(F.params[0]||1),0),!0}cursorNextLine(F){return this.cursorDown(F),this._activeBuffer.x=0,!0}cursorPrecedingLine(F){return this.cursorUp(F),this._activeBuffer.x=0,!0}cursorCharAbsolute(F){return this._setCursor((F.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(F){return this._setCursor(F.length>=2?(F.params[1]||1)-1:0,(F.params[0]||1)-1),!0}charPosAbsolute(F){return this._setCursor((F.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(F){return this._moveCursor(F.params[0]||1,0),!0}linePosAbsolute(F){return this._setCursor(this._activeBuffer.x,(F.params[0]||1)-1),!0}vPositionRelative(F){return this._moveCursor(0,F.params[0]||1),!0}hVPosition(F){return this.cursorPosition(F),!0}tabClear(F){const P=F.params[0];return P===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:P===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(F){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let P=F.params[0]||1;for(;P--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(F){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let P=F.params[0]||1;for(;P--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(F){const P=F.params[0];return P===1&&(this._curAttrData.bg|=536870912),P!==2&&P!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(F,P,j,G=!1,$=!1){const ee=this._activeBuffer.lines.get(this._activeBuffer.ybase+F);ee.replaceCells(P,j,this._activeBuffer.getNullCell(this._eraseAttrData()),$),G&&(ee.isWrapped=!1)}_resetBufferLine(F,P=!1){const j=this._activeBuffer.lines.get(this._activeBuffer.ybase+F);j&&(j.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),P),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+F),j.isWrapped=!1)}eraseInDisplay(F,P=!1){let j;switch(this._restrictCursor(this._bufferService.cols),F.params[0]){case 0:for(j=this._activeBuffer.y,this._dirtyRowTracker.markDirty(j),this._eraseInBufferLine(j++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,P);j<this._bufferService.rows;j++)this._resetBufferLine(j,P);this._dirtyRowTracker.markDirty(j);break;case 1:for(j=this._activeBuffer.y,this._dirtyRowTracker.markDirty(j),this._eraseInBufferLine(j,0,this._activeBuffer.x+1,!0,P),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(j+1).isWrapped=!1);j--;)this._resetBufferLine(j,P);this._dirtyRowTracker.markDirty(0);break;case 2:for(j=this._bufferService.rows,this._dirtyRowTracker.markDirty(j-1);j--;)this._resetBufferLine(j,P);this._dirtyRowTracker.markDirty(0);break;case 3:const G=this._activeBuffer.lines.length-this._bufferService.rows;G>0&&(this._activeBuffer.lines.trimStart(G),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-G,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-G,0),this._onScroll.fire(0))}return!0}eraseInLine(F,P=!1){switch(this._restrictCursor(this._bufferService.cols),F.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,P);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,P);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,P)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(F){this._restrictCursor();let P=F.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const j=this._activeBuffer.ybase+this._activeBuffer.y,G=this._bufferService.rows-1-this._activeBuffer.scrollBottom,$=this._bufferService.rows-1+this._activeBuffer.ybase-G+1;for(;P--;)this._activeBuffer.lines.splice($-1,1),this._activeBuffer.lines.splice(j,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(F){this._restrictCursor();let P=F.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const j=this._activeBuffer.ybase+this._activeBuffer.y;let G;for(G=this._bufferService.rows-1-this._activeBuffer.scrollBottom,G=this._bufferService.rows-1+this._activeBuffer.ybase-G;P--;)this._activeBuffer.lines.splice(j,1),this._activeBuffer.lines.splice(G,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(F){this._restrictCursor();const P=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return P&&(P.insertCells(this._activeBuffer.x,F.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(F){this._restrictCursor();const P=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return P&&(P.deleteCells(this._activeBuffer.x,F.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(F){let P=F.params[0]||1;for(;P--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(F){let P=F.params[0]||1;for(;P--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(g.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(F){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const P=F.params[0]||1;for(let j=this._activeBuffer.scrollTop;j<=this._activeBuffer.scrollBottom;++j){const G=this._activeBuffer.lines.get(this._activeBuffer.ybase+j);G.deleteCells(0,P,this._activeBuffer.getNullCell(this._eraseAttrData())),G.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(F){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const P=F.params[0]||1;for(let j=this._activeBuffer.scrollTop;j<=this._activeBuffer.scrollBottom;++j){const G=this._activeBuffer.lines.get(this._activeBuffer.ybase+j);G.insertCells(0,P,this._activeBuffer.getNullCell(this._eraseAttrData())),G.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(F){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const P=F.params[0]||1;for(let j=this._activeBuffer.scrollTop;j<=this._activeBuffer.scrollBottom;++j){const G=this._activeBuffer.lines.get(this._activeBuffer.ybase+j);G.insertCells(this._activeBuffer.x,P,this._activeBuffer.getNullCell(this._eraseAttrData())),G.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(F){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const P=F.params[0]||1;for(let j=this._activeBuffer.scrollTop;j<=this._activeBuffer.scrollBottom;++j){const G=this._activeBuffer.lines.get(this._activeBuffer.ybase+j);G.deleteCells(this._activeBuffer.x,P,this._activeBuffer.getNullCell(this._eraseAttrData())),G.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(F){this._restrictCursor();const P=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return P&&(P.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(F.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(F){const P=this._parser.precedingJoinState;if(!P)return!0;const j=F.params[0]||1,G=E.UnicodeService.extractWidth(P),$=this._activeBuffer.x-G,ee=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString($),ae=new Uint32Array(ee.length*j);let ie=0;for(let q=0;q<ee.length;){const Y=ee.codePointAt(q)||0;ae[ie++]=Y,q+=Y>65535?2:1}let K=ie;for(let q=1;q<j;++q)ae.copyWithin(K,0,ie),K+=ie;return this.print(ae,0,K),!0}sendDeviceAttributesPrimary(F){return F.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(h.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(h.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(F){return F.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(h.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(h.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(F.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(h.C0.ESC+"[>83;40003;0c")),!0}_is(F){return(this._optionsService.rawOptions.termName+"").indexOf(F)===0}setMode(F){for(let P=0;P<F.length;P++)switch(F.params[P]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(F){for(let P=0;P<F.length;P++)switch(F.params[P]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,v.DEFAULT_CHARSET),this._charsetService.setgCharset(1,v.DEFAULT_CHARSET),this._charsetService.setgCharset(2,v.DEFAULT_CHARSET),this._charsetService.setgCharset(3,v.DEFAULT_CHARSET);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0}return!0}resetMode(F){for(let P=0;P<F.length;P++)switch(F.params[P]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(F){for(let P=0;P<F.length;P++)switch(F.params[P]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),F.params[P]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1}return!0}requestMode(F,P){const j=this._coreService.decPrivateModes,{activeProtocol:G,activeEncoding:$}=this._coreMouseService,ee=this._coreService,{buffers:ae,cols:ie}=this._bufferService,{active:K,alt:q}=ae,Y=this._optionsService.rawOptions,X=de=>de?1:2,J=F.params[0];return re=J,ce=P?J===2?4:J===4?X(ee.modes.insertMode):J===12?3:J===20?X(Y.convertEol):0:J===1?X(j.applicationCursorKeys):J===3?Y.windowOptions.setWinLines?ie===80?2:ie===132?1:0:0:J===6?X(j.origin):J===7?X(j.wraparound):J===8?3:J===9?X(G==="X10"):J===12?X(Y.cursorBlink):J===25?X(!ee.isCursorHidden):J===45?X(j.reverseWraparound):J===66?X(j.applicationKeypad):J===67?4:J===1e3?X(G==="VT200"):J===1002?X(G==="DRAG"):J===1003?X(G==="ANY"):J===1004?X(j.sendFocus):J===1005?4:J===1006?X($==="SGR"):J===1015?4:J===1016?X($==="SGR_PIXELS"):J===1048?1:J===47||J===1047||J===1049?X(K===q):J===2004?X(j.bracketedPasteMode):0,ee.triggerDataEvent(`${h.C0.ESC}[${P?"":"?"}${re};${ce}$y`),!0;var re,ce}_updateAttrColor(F,P,j,G,$){return P===2?(F|=50331648,F&=-16777216,F|=S.AttributeData.fromColorRGB([j,G,$])):P===5&&(F&=-50331904,F|=33554432|255&j),F}_extractColor(F,P,j){const G=[0,0,-1,0,0,0];let $=0,ee=0;do{if(G[ee+$]=F.params[P+ee],F.hasSubParams(P+ee)){const ae=F.getSubParams(P+ee);let ie=0;do G[1]===5&&($=1),G[ee+ie+1+$]=ae[ie];while(++ie<ae.length&&ie+ee+1+$<G.length);break}if(G[1]===5&&ee+$>=2||G[1]===2&&ee+$>=5)break;G[1]&&($=1)}while(++ee+P<F.length&&ee+$<G.length);for(let ae=2;ae<G.length;++ae)G[ae]===-1&&(G[ae]=0);switch(G[0]){case 38:j.fg=this._updateAttrColor(j.fg,G[1],G[3],G[4],G[5]);break;case 48:j.bg=this._updateAttrColor(j.bg,G[1],G[3],G[4],G[5]);break;case 58:j.extended=j.extended.clone(),j.extended.underlineColor=this._updateAttrColor(j.extended.underlineColor,G[1],G[3],G[4],G[5])}return ee}_processUnderline(F,P){P.extended=P.extended.clone(),(!~F||F>5)&&(F=1),P.extended.underlineStyle=F,P.fg|=268435456,F===0&&(P.fg&=-268435457),P.updateExtended()}_processSGR0(F){F.fg=g.DEFAULT_ATTR_DATA.fg,F.bg=g.DEFAULT_ATTR_DATA.bg,F.extended=F.extended.clone(),F.extended.underlineStyle=0,F.extended.underlineColor&=-67108864,F.updateExtended()}charAttributes(F){if(F.length===1&&F.params[0]===0)return this._processSGR0(this._curAttrData),!0;const P=F.length;let j;const G=this._curAttrData;for(let $=0;$<P;$++)j=F.params[$],j>=30&&j<=37?(G.fg&=-50331904,G.fg|=16777216|j-30):j>=40&&j<=47?(G.bg&=-50331904,G.bg|=16777216|j-40):j>=90&&j<=97?(G.fg&=-50331904,G.fg|=16777224|j-90):j>=100&&j<=107?(G.bg&=-50331904,G.bg|=16777224|j-100):j===0?this._processSGR0(G):j===1?G.fg|=134217728:j===3?G.bg|=67108864:j===4?(G.fg|=268435456,this._processUnderline(F.hasSubParams($)?F.getSubParams($)[0]:1,G)):j===5?G.fg|=536870912:j===7?G.fg|=67108864:j===8?G.fg|=1073741824:j===9?G.fg|=2147483648:j===2?G.bg|=134217728:j===21?this._processUnderline(2,G):j===22?(G.fg&=-134217729,G.bg&=-134217729):j===23?G.bg&=-67108865:j===24?(G.fg&=-268435457,this._processUnderline(0,G)):j===25?G.fg&=-536870913:j===27?G.fg&=-67108865:j===28?G.fg&=-1073741825:j===29?G.fg&=2147483647:j===39?(G.fg&=-67108864,G.fg|=16777215&g.DEFAULT_ATTR_DATA.fg):j===49?(G.bg&=-67108864,G.bg|=16777215&g.DEFAULT_ATTR_DATA.bg):j===38||j===48||j===58?$+=this._extractColor(F,$,G):j===53?G.bg|=1073741824:j===55?G.bg&=-1073741825:j===59?(G.extended=G.extended.clone(),G.extended.underlineColor=-1,G.updateExtended()):j===100?(G.fg&=-67108864,G.fg|=16777215&g.DEFAULT_ATTR_DATA.fg,G.bg&=-67108864,G.bg|=16777215&g.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",j);return!0}deviceStatus(F){switch(F.params[0]){case 5:this._coreService.triggerDataEvent(`${h.C0.ESC}[0n`);break;case 6:const P=this._activeBuffer.y+1,j=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${h.C0.ESC}[${P};${j}R`)}return!0}deviceStatusPrivate(F){if(F.params[0]===6){const P=this._activeBuffer.y+1,j=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${h.C0.ESC}[?${P};${j}R`)}return!0}softReset(F){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=g.DEFAULT_ATTR_DATA.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(F){const P=F.params[0]||1;switch(P){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}const j=P%2==1;return this._optionsService.options.cursorBlink=j,!0}setScrollRegion(F){const P=F.params[0]||1;let j;return(F.length<2||(j=F.params[1])>this._bufferService.rows||j===0)&&(j=this._bufferService.rows),j>P&&(this._activeBuffer.scrollTop=P-1,this._activeBuffer.scrollBottom=j-1,this._setCursor(0,0)),!0}windowOptions(F){if(!M(F.params[0],this._optionsService.rawOptions.windowOptions))return!0;const P=F.length>1?F.params[1]:0;switch(F.params[0]){case 14:P!==2&&this._onRequestWindowsOptionsReport.fire(B.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(B.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${h.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:P!==0&&P!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),P!==0&&P!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:P!==0&&P!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),P!==0&&P!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(F){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(F){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(F){return this._windowTitle=F,this._onTitleChange.fire(F),!0}setIconName(F){return this._iconName=F,!0}setOrReportIndexedColor(F){const P=[],j=F.split(";");for(;j.length>1;){const G=j.shift(),$=j.shift();if(/^\d+$/.exec(G)){const ee=parseInt(G);if(z(ee))if($==="?")P.push({type:0,index:ee});else{const ae=(0,L.parseColor)($);ae&&P.push({type:1,index:ee,color:ae})}}}return P.length&&this._onColor.fire(P),!0}setHyperlink(F){const P=F.split(";");return!(P.length<2)&&(P[1]?this._createHyperlink(P[0],P[1]):!P[0]&&this._finishHyperlink())}_createHyperlink(F,P){this._getCurrentLinkId()&&this._finishHyperlink();const j=F.split(":");let G;const $=j.findIndex((ee=>ee.startsWith("id=")));return $!==-1&&(G=j[$].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:G,uri:P}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(F,P){const j=F.split(";");for(let G=0;G<j.length&&!(P>=this._specialColors.length);++G,++P)if(j[G]==="?")this._onColor.fire([{type:0,index:this._specialColors[P]}]);else{const $=(0,L.parseColor)(j[G]);$&&this._onColor.fire([{type:1,index:this._specialColors[P],color:$}])}return!0}setOrReportFgColor(F){return this._setOrReportSpecialColor(F,0)}setOrReportBgColor(F){return this._setOrReportSpecialColor(F,1)}setOrReportCursorColor(F){return this._setOrReportSpecialColor(F,2)}restoreIndexedColor(F){if(!F)return this._onColor.fire([{type:2}]),!0;const P=[],j=F.split(";");for(let G=0;G<j.length;++G)if(/^\d+$/.exec(j[G])){const $=parseInt(j[G]);z($)&&P.push({type:2,index:$})}return P.length&&this._onColor.fire(P),!0}restoreFgColor(F){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(F){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(F){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,v.DEFAULT_CHARSET),!0}selectCharset(F){return F.length!==2?(this.selectDefaultCharset(),!0):(F[0]==="/"||this._charsetService.setgCharset(A[F[0]],v.CHARSETS[F[1]]||v.DEFAULT_CHARSET),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){const F=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,F,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=g.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=g.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(F){return this._charsetService.setgLevel(F),!0}screenAlignmentPattern(){const F=new b.CellData;F.content=4194373,F.fg=this._curAttrData.fg,F.bg=this._curAttrData.bg,this._setCursor(0,0);for(let P=0;P<this._bufferService.rows;++P){const j=this._activeBuffer.ybase+this._activeBuffer.y+P,G=this._activeBuffer.lines.get(j);G&&(G.fill(F),G.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(F,P){const j=this._bufferService.buffer,G=this._optionsService.rawOptions;return($=>(this._coreService.triggerDataEvent(`${h.C0.ESC}${$}${h.C0.ESC}\\`),!0))(F==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:F==='"p'?'P1$r61;1"p':F==="r"?`P1$r${j.scrollTop+1};${j.scrollBottom+1}r`:F==="m"?"P1$r0m":F===" q"?`P1$r${{block:2,underline:4,bar:6}[G.cursorStyle]-(G.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(F,P){this._dirtyRowTracker.markRangeDirty(F,P)}}a.InputHandler=H;let U=class{constructor(W){this._bufferService=W,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(W){W<this.start?this.start=W:W>this.end&&(this.end=W)}markRangeDirty(W,F){W>F&&(D=W,W=F,F=D),W<this.start&&(this.start=W),F>this.end&&(this.end=F)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function z(W){return 0<=W&&W<256}U=u([c(0,N.IBufferService)],U)},844:(o,a)=>{function l(u){for(const c of u)c.dispose();u.length=0}Object.defineProperty(a,"__esModule",{value:!0}),a.getDisposeArrayDisposable=a.disposeArray=a.toDisposable=a.MutableDisposable=a.Disposable=void 0,a.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const u of this._disposables)u.dispose();this._disposables.length=0}register(u){return this._disposables.push(u),u}unregister(u){const c=this._disposables.indexOf(u);c!==-1&&this._disposables.splice(c,1)}},a.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(u){var c;this._isDisposed||u===this._value||((c=this._value)==null||c.dispose(),this._value=u)}clear(){this.value=void 0}dispose(){var u;this._isDisposed=!0,(u=this._value)==null||u.dispose(),this._value=void 0}},a.toDisposable=function(u){return{dispose:u}},a.disposeArray=l,a.getDisposeArrayDisposable=function(u){return{dispose:()=>l(u)}}},1505:(o,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.FourKeyMap=a.TwoKeyMap=void 0;class l{constructor(){this._data={}}set(c,h,v){this._data[c]||(this._data[c]={}),this._data[c][h]=v}get(c,h){return this._data[c]?this._data[c][h]:void 0}clear(){this._data={}}}a.TwoKeyMap=l,a.FourKeyMap=class{constructor(){this._data=new l}set(u,c,h,v,d){this._data.get(u,c)||this._data.set(u,c,new l),this._data.get(u,c).set(h,v,d)}get(u,c,h,v){var d;return(d=this._data.get(u,c))==null?void 0:d.get(h,v)}clear(){this._data.clear()}}},6114:(o,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.isChromeOS=a.isLinux=a.isWindows=a.isIphone=a.isIpad=a.isMac=a.getSafariVersion=a.isSafari=a.isLegacyEdge=a.isFirefox=a.isNode=void 0,a.isNode=typeof process<"u"&&"title"in process;const l=a.isNode?"node":navigator.userAgent,u=a.isNode?"node":navigator.platform;a.isFirefox=l.includes("Firefox"),a.isLegacyEdge=l.includes("Edge"),a.isSafari=/^((?!chrome|android).)*safari/i.test(l),a.getSafariVersion=function(){if(!a.isSafari)return 0;const c=l.match(/Version\/(\d+)/);return c===null||c.length<2?0:parseInt(c[1])},a.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(u),a.isIpad=u==="iPad",a.isIphone=u==="iPhone",a.isWindows=["Windows","Win16","Win32","WinCE"].includes(u),a.isLinux=u.indexOf("Linux")>=0,a.isChromeOS=/\bCrOS\b/.test(l)},6106:(o,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.SortedList=void 0;let l=0;a.SortedList=class{constructor(u){this._getKey=u,this._array=[]}clear(){this._array.length=0}insert(u){this._array.length!==0?(l=this._search(this._getKey(u)),this._array.splice(l,0,u)):this._array.push(u)}delete(u){if(this._array.length===0)return!1;const c=this._getKey(u);if(c===void 0||(l=this._search(c),l===-1)||this._getKey(this._array[l])!==c)return!1;do if(this._array[l]===u)return this._array.splice(l,1),!0;while(++l<this._array.length&&this._getKey(this._array[l])===c);return!1}*getKeyIterator(u){if(this._array.length!==0&&(l=this._search(u),!(l<0||l>=this._array.length)&&this._getKey(this._array[l])===u))do yield this._array[l];while(++l<this._array.length&&this._getKey(this._array[l])===u)}forEachByKey(u,c){if(this._array.length!==0&&(l=this._search(u),!(l<0||l>=this._array.length)&&this._getKey(this._array[l])===u))do c(this._array[l]);while(++l<this._array.length&&this._getKey(this._array[l])===u)}values(){return[...this._array].values()}_search(u){let c=0,h=this._array.length-1;for(;h>=c;){let v=c+h>>1;const d=this._getKey(this._array[v]);if(d>u)h=v-1;else{if(!(d<u)){for(;v>0&&this._getKey(this._array[v-1])===u;)v--;return v}c=v+1}}return c}}},7226:(o,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.DebouncedIdleTask=a.IdleTaskQueue=a.PriorityTaskQueue=void 0;const u=l(6114);class c{constructor(){this._tasks=[],this._i=0}enqueue(d){this._tasks.push(d),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(d){this._idleCallback=void 0;let x=0,w=0,g=d.timeRemaining(),m=0;for(;this._i<this._tasks.length;){if(x=Date.now(),this._tasks[this._i]()||this._i++,x=Math.max(1,Date.now()-x),w=Math.max(x,w),m=d.timeRemaining(),1.5*w>m)return g-x<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(g-x))}ms`),void this._start();g=m}this.clear()}}class h extends c{_requestCallback(d){return setTimeout((()=>d(this._createDeadline(16))))}_cancelCallback(d){clearTimeout(d)}_createDeadline(d){const x=Date.now()+d;return{timeRemaining:()=>Math.max(0,x-Date.now())}}}a.PriorityTaskQueue=h,a.IdleTaskQueue=!u.isNode&&"requestIdleCallback"in window?class extends c{_requestCallback(v){return requestIdleCallback(v)}_cancelCallback(v){cancelIdleCallback(v)}}:h,a.DebouncedIdleTask=class{constructor(){this._queue=new a.IdleTaskQueue}set(v){this._queue.clear(),this._queue.enqueue(v)}flush(){this._queue.flush()}}},9282:(o,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.updateWindowsModeWrappedState=void 0;const u=l(643);a.updateWindowsModeWrappedState=function(c){const h=c.buffer.lines.get(c.buffer.ybase+c.buffer.y-1),v=h==null?void 0:h.get(c.cols-1),d=c.buffer.lines.get(c.buffer.ybase+c.buffer.y);d&&v&&(d.isWrapped=v[u.CHAR_DATA_CODE_INDEX]!==u.NULL_CELL_CODE&&v[u.CHAR_DATA_CODE_INDEX]!==u.WHITESPACE_CELL_CODE)}},3734:(o,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.ExtendedAttrs=a.AttributeData=void 0;class l{constructor(){this.fg=0,this.bg=0,this.extended=new u}static toColorRGB(h){return[h>>>16&255,h>>>8&255,255&h]}static fromColorRGB(h){return(255&h[0])<<16|(255&h[1])<<8|255&h[2]}clone(){const h=new l;return h.fg=this.fg,h.bg=this.bg,h.extended=this.extended.clone(),h}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}a.AttributeData=l;class u{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(h){this._ext=h}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(h){this._ext&=-469762049,this._ext|=h<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(h){this._ext&=-67108864,this._ext|=67108863&h}get urlId(){return this._urlId}set urlId(h){this._urlId=h}get underlineVariantOffset(){const h=(3758096384&this._ext)>>29;return h<0?4294967288^h:h}set underlineVariantOffset(h){this._ext&=536870911,this._ext|=h<<29&3758096384}constructor(h=0,v=0){this._ext=0,this._urlId=0,this._ext=h,this._urlId=v}clone(){return new u(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}a.ExtendedAttrs=u},9092:(o,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.Buffer=a.MAX_BUFFER_SIZE=void 0;const u=l(6349),c=l(7226),h=l(3734),v=l(8437),d=l(4634),x=l(511),w=l(643),g=l(4863),m=l(7116);a.MAX_BUFFER_SIZE=4294967295,a.Buffer=class{constructor(y,b,S){this._hasScrollback=y,this._optionsService=b,this._bufferService=S,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=v.DEFAULT_ATTR_DATA.clone(),this.savedCharset=m.DEFAULT_CHARSET,this.markers=[],this._nullCell=x.CellData.fromCharData([0,w.NULL_CELL_CHAR,w.NULL_CELL_WIDTH,w.NULL_CELL_CODE]),this._whitespaceCell=x.CellData.fromCharData([0,w.WHITESPACE_CELL_CHAR,w.WHITESPACE_CELL_WIDTH,w.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new c.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new u.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(y){return y?(this._nullCell.fg=y.fg,this._nullCell.bg=y.bg,this._nullCell.extended=y.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new h.ExtendedAttrs),this._nullCell}getWhitespaceCell(y){return y?(this._whitespaceCell.fg=y.fg,this._whitespaceCell.bg=y.bg,this._whitespaceCell.extended=y.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new h.ExtendedAttrs),this._whitespaceCell}getBlankLine(y,b){return new v.BufferLine(this._bufferService.cols,this.getNullCell(y),b)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const y=this.ybase+this.y-this.ydisp;return y>=0&&y<this._rows}_getCorrectBufferLength(y){if(!this._hasScrollback)return y;const b=y+this._optionsService.rawOptions.scrollback;return b>a.MAX_BUFFER_SIZE?a.MAX_BUFFER_SIZE:b}fillViewportRows(y){if(this.lines.length===0){y===void 0&&(y=v.DEFAULT_ATTR_DATA);let b=this._rows;for(;b--;)this.lines.push(this.getBlankLine(y))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new u.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(y,b){const S=this.getNullCell(v.DEFAULT_ATTR_DATA);let N=0;const E=this._getCorrectBufferLength(b);if(E>this.lines.maxLength&&(this.lines.maxLength=E),this.lines.length>0){if(this._cols<y)for(let k=0;k<this.lines.length;k++)N+=+this.lines.get(k).resize(y,S);let T=0;if(this._rows<b)for(let k=this._rows;k<b;k++)this.lines.length<b+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new v.BufferLine(y,S)):this.ybase>0&&this.lines.length<=this.ybase+this.y+T+1?(this.ybase--,T++,this.ydisp>0&&this.ydisp--):this.lines.push(new v.BufferLine(y,S)));else for(let k=this._rows;k>b;k--)this.lines.length>b+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(E<this.lines.maxLength){const k=this.lines.length-E;k>0&&(this.lines.trimStart(k),this.ybase=Math.max(this.ybase-k,0),this.ydisp=Math.max(this.ydisp-k,0),this.savedY=Math.max(this.savedY-k,0)),this.lines.maxLength=E}this.x=Math.min(this.x,y-1),this.y=Math.min(this.y,b-1),T&&(this.y+=T),this.savedX=Math.min(this.savedX,y-1),this.scrollTop=0}if(this.scrollBottom=b-1,this._isReflowEnabled&&(this._reflow(y,b),this._cols>y))for(let T=0;T<this.lines.length;T++)N+=+this.lines.get(T).resize(y,S);this._cols=y,this._rows=b,this._memoryCleanupQueue.clear(),N>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let y=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,y=!1);let b=0;for(;this._memoryCleanupPosition<this.lines.length;)if(b+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),b>100)return!0;return y}get _isReflowEnabled(){const y=this._optionsService.rawOptions.windowsPty;return y&&y.buildNumber?this._hasScrollback&&y.backend==="conpty"&&y.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(y,b){this._cols!==y&&(y>this._cols?this._reflowLarger(y,b):this._reflowSmaller(y,b))}_reflowLarger(y,b){const S=(0,d.reflowLargerGetLinesToRemove)(this.lines,this._cols,y,this.ybase+this.y,this.getNullCell(v.DEFAULT_ATTR_DATA));if(S.length>0){const N=(0,d.reflowLargerCreateNewLayout)(this.lines,S);(0,d.reflowLargerApplyNewLayout)(this.lines,N.layout),this._reflowLargerAdjustViewport(y,b,N.countRemoved)}}_reflowLargerAdjustViewport(y,b,S){const N=this.getNullCell(v.DEFAULT_ATTR_DATA);let E=S;for(;E-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<b&&this.lines.push(new v.BufferLine(y,N))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-S,0)}_reflowSmaller(y,b){const S=this.getNullCell(v.DEFAULT_ATTR_DATA),N=[];let E=0;for(let T=this.lines.length-1;T>=0;T--){let k=this.lines.get(T);if(!k||!k.isWrapped&&k.getTrimmedLength()<=y)continue;const L=[k];for(;k.isWrapped&&T>0;)k=this.lines.get(--T),L.unshift(k);const A=this.ybase+this.y;if(A>=T&&A<T+L.length)continue;const I=L[L.length-1].getTrimmedLength(),M=(0,d.reflowSmallerGetNewLineLengths)(L,this._cols,y),B=M.length-L.length;let D;D=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+B):Math.max(0,this.lines.length-this.lines.maxLength+B);const H=[];for(let j=0;j<B;j++){const G=this.getBlankLine(v.DEFAULT_ATTR_DATA,!0);H.push(G)}H.length>0&&(N.push({start:T+L.length+E,newLines:H}),E+=H.length),L.push(...H);let U=M.length-1,z=M[U];z===0&&(U--,z=M[U]);let W=L.length-B-1,F=I;for(;W>=0;){const j=Math.min(F,z);if(L[U]===void 0)break;if(L[U].copyCellsFrom(L[W],F-j,z-j,j,!0),z-=j,z===0&&(U--,z=M[U]),F-=j,F===0){W--;const G=Math.max(W,0);F=(0,d.getWrappedLineTrimmedLength)(L,G,this._cols)}}for(let j=0;j<L.length;j++)M[j]<y&&L[j].setCell(M[j],S);let P=B-D;for(;P-- >0;)this.ybase===0?this.y<b-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+E)-b&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+B,this.ybase+b-1)}if(N.length>0){const T=[],k=[];for(let U=0;U<this.lines.length;U++)k.push(this.lines.get(U));const L=this.lines.length;let A=L-1,I=0,M=N[I];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+E);let B=0;for(let U=Math.min(this.lines.maxLength-1,L+E-1);U>=0;U--)if(M&&M.start>A+B){for(let z=M.newLines.length-1;z>=0;z--)this.lines.set(U--,M.newLines[z]);U++,T.push({index:A+1,amount:M.newLines.length}),B+=M.newLines.length,M=N[++I]}else this.lines.set(U,k[A--]);let D=0;for(let U=T.length-1;U>=0;U--)T[U].index+=D,this.lines.onInsertEmitter.fire(T[U]),D+=T[U].amount;const H=Math.max(0,L+E-this.lines.maxLength);H>0&&this.lines.onTrimEmitter.fire(H)}}translateBufferLineToString(y,b,S=0,N){const E=this.lines.get(y);return E?E.translateToString(b,S,N):""}getWrappedRangeForLine(y){let b=y,S=y;for(;b>0&&this.lines.get(b).isWrapped;)b--;for(;S+1<this.lines.length&&this.lines.get(S+1).isWrapped;)S++;return{first:b,last:S}}setupTabStops(y){for(y!=null?this.tabs[y]||(y=this.prevStop(y)):(this.tabs={},y=0);y<this._cols;y+=this._optionsService.rawOptions.tabStopWidth)this.tabs[y]=!0}prevStop(y){for(y==null&&(y=this.x);!this.tabs[--y]&&y>0;);return y>=this._cols?this._cols-1:y<0?0:y}nextStop(y){for(y==null&&(y=this.x);!this.tabs[++y]&&y<this._cols;);return y>=this._cols?this._cols-1:y<0?0:y}clearMarkers(y){this._isClearing=!0;for(let b=0;b<this.markers.length;b++)this.markers[b].line===y&&(this.markers[b].dispose(),this.markers.splice(b--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let y=0;y<this.markers.length;y++)this.markers[y].dispose(),this.markers.splice(y--,1);this._isClearing=!1}addMarker(y){const b=new g.Marker(y);return this.markers.push(b),b.register(this.lines.onTrim((S=>{b.line-=S,b.line<0&&b.dispose()}))),b.register(this.lines.onInsert((S=>{b.line>=S.index&&(b.line+=S.amount)}))),b.register(this.lines.onDelete((S=>{b.line>=S.index&&b.line<S.index+S.amount&&b.dispose(),b.line>S.index&&(b.line-=S.amount)}))),b.register(b.onDispose((()=>this._removeMarker(b)))),b}_removeMarker(y){this._isClearing||this.markers.splice(this.markers.indexOf(y),1)}}},8437:(o,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.BufferLine=a.DEFAULT_ATTR_DATA=void 0;const u=l(3734),c=l(511),h=l(643),v=l(482);a.DEFAULT_ATTR_DATA=Object.freeze(new u.AttributeData);let d=0;class x{constructor(g,m,y=!1){this.isWrapped=y,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*g);const b=m||c.CellData.fromCharData([0,h.NULL_CELL_CHAR,h.NULL_CELL_WIDTH,h.NULL_CELL_CODE]);for(let S=0;S<g;++S)this.setCell(S,b);this.length=g}get(g){const m=this._data[3*g+0],y=2097151&m;return[this._data[3*g+1],2097152&m?this._combined[g]:y?(0,v.stringFromCodePoint)(y):"",m>>22,2097152&m?this._combined[g].charCodeAt(this._combined[g].length-1):y]}set(g,m){this._data[3*g+1]=m[h.CHAR_DATA_ATTR_INDEX],m[h.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[g]=m[1],this._data[3*g+0]=2097152|g|m[h.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*g+0]=m[h.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|m[h.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(g){return this._data[3*g+0]>>22}hasWidth(g){return 12582912&this._data[3*g+0]}getFg(g){return this._data[3*g+1]}getBg(g){return this._data[3*g+2]}hasContent(g){return 4194303&this._data[3*g+0]}getCodePoint(g){const m=this._data[3*g+0];return 2097152&m?this._combined[g].charCodeAt(this._combined[g].length-1):2097151&m}isCombined(g){return 2097152&this._data[3*g+0]}getString(g){const m=this._data[3*g+0];return 2097152&m?this._combined[g]:2097151&m?(0,v.stringFromCodePoint)(2097151&m):""}isProtected(g){return 536870912&this._data[3*g+2]}loadCell(g,m){return d=3*g,m.content=this._data[d+0],m.fg=this._data[d+1],m.bg=this._data[d+2],2097152&m.content&&(m.combinedData=this._combined[g]),268435456&m.bg&&(m.extended=this._extendedAttrs[g]),m}setCell(g,m){2097152&m.content&&(this._combined[g]=m.combinedData),268435456&m.bg&&(this._extendedAttrs[g]=m.extended),this._data[3*g+0]=m.content,this._data[3*g+1]=m.fg,this._data[3*g+2]=m.bg}setCellFromCodepoint(g,m,y,b){268435456&b.bg&&(this._extendedAttrs[g]=b.extended),this._data[3*g+0]=m|y<<22,this._data[3*g+1]=b.fg,this._data[3*g+2]=b.bg}addCodepointToCell(g,m,y){let b=this._data[3*g+0];2097152&b?this._combined[g]+=(0,v.stringFromCodePoint)(m):2097151&b?(this._combined[g]=(0,v.stringFromCodePoint)(2097151&b)+(0,v.stringFromCodePoint)(m),b&=-2097152,b|=2097152):b=m|4194304,y&&(b&=-12582913,b|=y<<22),this._data[3*g+0]=b}insertCells(g,m,y){if((g%=this.length)&&this.getWidth(g-1)===2&&this.setCellFromCodepoint(g-1,0,1,y),m<this.length-g){const b=new c.CellData;for(let S=this.length-g-m-1;S>=0;--S)this.setCell(g+m+S,this.loadCell(g+S,b));for(let S=0;S<m;++S)this.setCell(g+S,y)}else for(let b=g;b<this.length;++b)this.setCell(b,y);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,y)}deleteCells(g,m,y){if(g%=this.length,m<this.length-g){const b=new c.CellData;for(let S=0;S<this.length-g-m;++S)this.setCell(g+S,this.loadCell(g+m+S,b));for(let S=this.length-m;S<this.length;++S)this.setCell(S,y)}else for(let b=g;b<this.length;++b)this.setCell(b,y);g&&this.getWidth(g-1)===2&&this.setCellFromCodepoint(g-1,0,1,y),this.getWidth(g)!==0||this.hasContent(g)||this.setCellFromCodepoint(g,0,1,y)}replaceCells(g,m,y,b=!1){if(b)for(g&&this.getWidth(g-1)===2&&!this.isProtected(g-1)&&this.setCellFromCodepoint(g-1,0,1,y),m<this.length&&this.getWidth(m-1)===2&&!this.isProtected(m)&&this.setCellFromCodepoint(m,0,1,y);g<m&&g<this.length;)this.isProtected(g)||this.setCell(g,y),g++;else for(g&&this.getWidth(g-1)===2&&this.setCellFromCodepoint(g-1,0,1,y),m<this.length&&this.getWidth(m-1)===2&&this.setCellFromCodepoint(m,0,1,y);g<m&&g<this.length;)this.setCell(g++,y)}resize(g,m){if(g===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const y=3*g;if(g>this.length){if(this._data.buffer.byteLength>=4*y)this._data=new Uint32Array(this._data.buffer,0,y);else{const b=new Uint32Array(y);b.set(this._data),this._data=b}for(let b=this.length;b<g;++b)this.setCell(b,m)}else{this._data=this._data.subarray(0,y);const b=Object.keys(this._combined);for(let N=0;N<b.length;N++){const E=parseInt(b[N],10);E>=g&&delete this._combined[E]}const S=Object.keys(this._extendedAttrs);for(let N=0;N<S.length;N++){const E=parseInt(S[N],10);E>=g&&delete this._extendedAttrs[E]}}return this.length=g,4*y*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const g=new Uint32Array(this._data.length);return g.set(this._data),this._data=g,1}return 0}fill(g,m=!1){if(m)for(let y=0;y<this.length;++y)this.isProtected(y)||this.setCell(y,g);else{this._combined={},this._extendedAttrs={};for(let y=0;y<this.length;++y)this.setCell(y,g)}}copyFrom(g){this.length!==g.length?this._data=new Uint32Array(g._data):this._data.set(g._data),this.length=g.length,this._combined={};for(const m in g._combined)this._combined[m]=g._combined[m];this._extendedAttrs={};for(const m in g._extendedAttrs)this._extendedAttrs[m]=g._extendedAttrs[m];this.isWrapped=g.isWrapped}clone(){const g=new x(0);g._data=new Uint32Array(this._data),g.length=this.length;for(const m in this._combined)g._combined[m]=this._combined[m];for(const m in this._extendedAttrs)g._extendedAttrs[m]=this._extendedAttrs[m];return g.isWrapped=this.isWrapped,g}getTrimmedLength(){for(let g=this.length-1;g>=0;--g)if(4194303&this._data[3*g+0])return g+(this._data[3*g+0]>>22);return 0}getNoBgTrimmedLength(){for(let g=this.length-1;g>=0;--g)if(4194303&this._data[3*g+0]||50331648&this._data[3*g+2])return g+(this._data[3*g+0]>>22);return 0}copyCellsFrom(g,m,y,b,S){const N=g._data;if(S)for(let T=b-1;T>=0;T--){for(let k=0;k<3;k++)this._data[3*(y+T)+k]=N[3*(m+T)+k];268435456&N[3*(m+T)+2]&&(this._extendedAttrs[y+T]=g._extendedAttrs[m+T])}else for(let T=0;T<b;T++){for(let k=0;k<3;k++)this._data[3*(y+T)+k]=N[3*(m+T)+k];268435456&N[3*(m+T)+2]&&(this._extendedAttrs[y+T]=g._extendedAttrs[m+T])}const E=Object.keys(g._combined);for(let T=0;T<E.length;T++){const k=parseInt(E[T],10);k>=m&&(this._combined[k-m+y]=g._combined[k])}}translateToString(g,m,y,b){m=m??0,y=y??this.length,g&&(y=Math.min(y,this.getTrimmedLength())),b&&(b.length=0);let S="";for(;m<y;){const N=this._data[3*m+0],E=2097151&N,T=2097152&N?this._combined[m]:E?(0,v.stringFromCodePoint)(E):h.WHITESPACE_CELL_CHAR;if(S+=T,b)for(let k=0;k<T.length;++k)b.push(m);m+=N>>22||1}return b&&b.push(m),S}}a.BufferLine=x},4841:(o,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.getRangeLength=void 0,a.getRangeLength=function(l,u){if(l.start.y>l.end.y)throw new Error(`Buffer range end (${l.end.x}, ${l.end.y}) cannot be before start (${l.start.x}, ${l.start.y})`);return u*(l.end.y-l.start.y)+(l.end.x-l.start.x+1)}},4634:(o,a)=>{function l(u,c,h){if(c===u.length-1)return u[c].getTrimmedLength();const v=!u[c].hasContent(h-1)&&u[c].getWidth(h-1)===1,d=u[c+1].getWidth(0)===2;return v&&d?h-1:h}Object.defineProperty(a,"__esModule",{value:!0}),a.getWrappedLineTrimmedLength=a.reflowSmallerGetNewLineLengths=a.reflowLargerApplyNewLayout=a.reflowLargerCreateNewLayout=a.reflowLargerGetLinesToRemove=void 0,a.reflowLargerGetLinesToRemove=function(u,c,h,v,d){const x=[];for(let w=0;w<u.length-1;w++){let g=w,m=u.get(++g);if(!m.isWrapped)continue;const y=[u.get(w)];for(;g<u.length&&m.isWrapped;)y.push(m),m=u.get(++g);if(v>=w&&v<g){w+=y.length-1;continue}let b=0,S=l(y,b,c),N=1,E=0;for(;N<y.length;){const k=l(y,N,c),L=k-E,A=h-S,I=Math.min(L,A);y[b].copyCellsFrom(y[N],E,S,I,!1),S+=I,S===h&&(b++,S=0),E+=I,E===k&&(N++,E=0),S===0&&b!==0&&y[b-1].getWidth(h-1)===2&&(y[b].copyCellsFrom(y[b-1],h-1,S++,1,!1),y[b-1].setCell(h-1,d))}y[b].replaceCells(S,h,d);let T=0;for(let k=y.length-1;k>0&&(k>b||y[k].getTrimmedLength()===0);k--)T++;T>0&&(x.push(w+y.length-T),x.push(T)),w+=y.length-1}return x},a.reflowLargerCreateNewLayout=function(u,c){const h=[];let v=0,d=c[v],x=0;for(let w=0;w<u.length;w++)if(d===w){const g=c[++v];u.onDeleteEmitter.fire({index:w-x,amount:g}),w+=g-1,x+=g,d=c[++v]}else h.push(w);return{layout:h,countRemoved:x}},a.reflowLargerApplyNewLayout=function(u,c){const h=[];for(let v=0;v<c.length;v++)h.push(u.get(c[v]));for(let v=0;v<h.length;v++)u.set(v,h[v]);u.length=c.length},a.reflowSmallerGetNewLineLengths=function(u,c,h){const v=[],d=u.map(((m,y)=>l(u,y,c))).reduce(((m,y)=>m+y));let x=0,w=0,g=0;for(;g<d;){if(d-g<h){v.push(d-g);break}x+=h;const m=l(u,w,c);x>m&&(x-=m,w++);const y=u[w].getWidth(x-1)===2;y&&x--;const b=y?h-1:h;v.push(b),g+=b}return v},a.getWrappedLineTrimmedLength=l},5295:(o,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.BufferSet=void 0;const u=l(8460),c=l(844),h=l(9092);class v extends c.Disposable{constructor(x,w){super(),this._optionsService=x,this._bufferService=w,this._onBufferActivate=this.register(new u.EventEmitter),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.resize(this._bufferService.cols,this._bufferService.rows)))),this.register(this._optionsService.onSpecificOptionChange("tabStopWidth",(()=>this.setupTabStops())))}reset(){this._normal=new h.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new h.Buffer(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(x){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(x),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(x,w){this._normal.resize(x,w),this._alt.resize(x,w),this.setupTabStops(x)}setupTabStops(x){this._normal.setupTabStops(x),this._alt.setupTabStops(x)}}a.BufferSet=v},511:(o,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.CellData=void 0;const u=l(482),c=l(643),h=l(3734);class v extends h.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new h.ExtendedAttrs,this.combinedData=""}static fromCharData(x){const w=new v;return w.setFromCharData(x),w}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,u.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(x){this.fg=x[c.CHAR_DATA_ATTR_INDEX],this.bg=0;let w=!1;if(x[c.CHAR_DATA_CHAR_INDEX].length>2)w=!0;else if(x[c.CHAR_DATA_CHAR_INDEX].length===2){const g=x[c.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=g&&g<=56319){const m=x[c.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=m&&m<=57343?this.content=1024*(g-55296)+m-56320+65536|x[c.CHAR_DATA_WIDTH_INDEX]<<22:w=!0}else w=!0}else this.content=x[c.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|x[c.CHAR_DATA_WIDTH_INDEX]<<22;w&&(this.combinedData=x[c.CHAR_DATA_CHAR_INDEX],this.content=2097152|x[c.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}a.CellData=v},643:(o,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.WHITESPACE_CELL_CODE=a.WHITESPACE_CELL_WIDTH=a.WHITESPACE_CELL_CHAR=a.NULL_CELL_CODE=a.NULL_CELL_WIDTH=a.NULL_CELL_CHAR=a.CHAR_DATA_CODE_INDEX=a.CHAR_DATA_WIDTH_INDEX=a.CHAR_DATA_CHAR_INDEX=a.CHAR_DATA_ATTR_INDEX=a.DEFAULT_EXT=a.DEFAULT_ATTR=a.DEFAULT_COLOR=void 0,a.DEFAULT_COLOR=0,a.DEFAULT_ATTR=256|a.DEFAULT_COLOR<<9,a.DEFAULT_EXT=0,a.CHAR_DATA_ATTR_INDEX=0,a.CHAR_DATA_CHAR_INDEX=1,a.CHAR_DATA_WIDTH_INDEX=2,a.CHAR_DATA_CODE_INDEX=3,a.NULL_CELL_CHAR="",a.NULL_CELL_WIDTH=1,a.NULL_CELL_CODE=0,a.WHITESPACE_CELL_CHAR=" ",a.WHITESPACE_CELL_WIDTH=1,a.WHITESPACE_CELL_CODE=32},4863:(o,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.Marker=void 0;const u=l(8460),c=l(844);class h{get id(){return this._id}constructor(d){this.line=d,this.isDisposed=!1,this._disposables=[],this._id=h._nextId++,this._onDispose=this.register(new u.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,c.disposeArray)(this._disposables),this._disposables.length=0)}register(d){return this._disposables.push(d),d}}a.Marker=h,h._nextId=1},7116:(o,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.DEFAULT_CHARSET=a.CHARSETS=void 0,a.CHARSETS={},a.DEFAULT_CHARSET=a.CHARSETS.B,a.CHARSETS[0]={"`":"◆",a:"▒",b:"␉",c:"␌",d:"␍",e:"␊",f:"°",g:"±",h:"␤",i:"␋",j:"┘",k:"┐",l:"┌",m:"└",n:"┼",o:"⎺",p:"⎻",q:"─",r:"⎼",s:"⎽",t:"├",u:"┤",v:"┴",w:"┬",x:"│",y:"≤",z:"≥","{":"π","|":"≠","}":"£","~":"·"},a.CHARSETS.A={"#":"£"},a.CHARSETS.B=void 0,a.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},a.CHARSETS.C=a.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},a.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},a.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},a.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},a.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},a.CHARSETS.E=a.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},a.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},a.CHARSETS.H=a.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},a.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(o,a)=>{var l,u,c;Object.defineProperty(a,"__esModule",{value:!0}),a.C1_ESCAPED=a.C1=a.C0=void 0,(function(h){h.NUL="\0",h.SOH="",h.STX="",h.ETX="",h.EOT="",h.ENQ="",h.ACK="",h.BEL="\x07",h.BS="\b",h.HT=" ",h.LF=`
382
- `,h.VT="\v",h.FF="\f",h.CR="\r",h.SO="",h.SI="",h.DLE="",h.DC1="",h.DC2="",h.DC3="",h.DC4="",h.NAK="",h.SYN="",h.ETB="",h.CAN="",h.EM="",h.SUB="",h.ESC="\x1B",h.FS="",h.GS="",h.RS="",h.US="",h.SP=" ",h.DEL=""})(l||(a.C0=l={})),(function(h){h.PAD="€",h.HOP="",h.BPH="‚",h.NBH="ƒ",h.IND="„",h.NEL="…",h.SSA="†",h.ESA="‡",h.HTS="ˆ",h.HTJ="‰",h.VTS="Š",h.PLD="‹",h.PLU="Œ",h.RI="",h.SS2="Ž",h.SS3="",h.DCS="",h.PU1="‘",h.PU2="’",h.STS="“",h.CCH="”",h.MW="•",h.SPA="–",h.EPA="—",h.SOS="˜",h.SGCI="™",h.SCI="š",h.CSI="›",h.ST="œ",h.OSC="",h.PM="ž",h.APC="Ÿ"})(u||(a.C1=u={})),(function(h){h.ST=`${l.ESC}\\`})(c||(a.C1_ESCAPED=c={}))},7399:(o,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.evaluateKeyboardEvent=void 0;const u=l(2584),c={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};a.evaluateKeyboardEvent=function(h,v,d,x){const w={type:0,cancel:!1,key:void 0},g=(h.shiftKey?1:0)|(h.altKey?2:0)|(h.ctrlKey?4:0)|(h.metaKey?8:0);switch(h.keyCode){case 0:h.key==="UIKeyInputUpArrow"?w.key=v?u.C0.ESC+"OA":u.C0.ESC+"[A":h.key==="UIKeyInputLeftArrow"?w.key=v?u.C0.ESC+"OD":u.C0.ESC+"[D":h.key==="UIKeyInputRightArrow"?w.key=v?u.C0.ESC+"OC":u.C0.ESC+"[C":h.key==="UIKeyInputDownArrow"&&(w.key=v?u.C0.ESC+"OB":u.C0.ESC+"[B");break;case 8:w.key=h.ctrlKey?"\b":u.C0.DEL,h.altKey&&(w.key=u.C0.ESC+w.key);break;case 9:if(h.shiftKey){w.key=u.C0.ESC+"[Z";break}w.key=u.C0.HT,w.cancel=!0;break;case 13:w.key=h.altKey?u.C0.ESC+u.C0.CR:u.C0.CR,w.cancel=!0;break;case 27:w.key=u.C0.ESC,h.altKey&&(w.key=u.C0.ESC+u.C0.ESC),w.cancel=!0;break;case 37:if(h.metaKey)break;g?(w.key=u.C0.ESC+"[1;"+(g+1)+"D",w.key===u.C0.ESC+"[1;3D"&&(w.key=u.C0.ESC+(d?"b":"[1;5D"))):w.key=v?u.C0.ESC+"OD":u.C0.ESC+"[D";break;case 39:if(h.metaKey)break;g?(w.key=u.C0.ESC+"[1;"+(g+1)+"C",w.key===u.C0.ESC+"[1;3C"&&(w.key=u.C0.ESC+(d?"f":"[1;5C"))):w.key=v?u.C0.ESC+"OC":u.C0.ESC+"[C";break;case 38:if(h.metaKey)break;g?(w.key=u.C0.ESC+"[1;"+(g+1)+"A",d||w.key!==u.C0.ESC+"[1;3A"||(w.key=u.C0.ESC+"[1;5A")):w.key=v?u.C0.ESC+"OA":u.C0.ESC+"[A";break;case 40:if(h.metaKey)break;g?(w.key=u.C0.ESC+"[1;"+(g+1)+"B",d||w.key!==u.C0.ESC+"[1;3B"||(w.key=u.C0.ESC+"[1;5B")):w.key=v?u.C0.ESC+"OB":u.C0.ESC+"[B";break;case 45:h.shiftKey||h.ctrlKey||(w.key=u.C0.ESC+"[2~");break;case 46:w.key=g?u.C0.ESC+"[3;"+(g+1)+"~":u.C0.ESC+"[3~";break;case 36:w.key=g?u.C0.ESC+"[1;"+(g+1)+"H":v?u.C0.ESC+"OH":u.C0.ESC+"[H";break;case 35:w.key=g?u.C0.ESC+"[1;"+(g+1)+"F":v?u.C0.ESC+"OF":u.C0.ESC+"[F";break;case 33:h.shiftKey?w.type=2:h.ctrlKey?w.key=u.C0.ESC+"[5;"+(g+1)+"~":w.key=u.C0.ESC+"[5~";break;case 34:h.shiftKey?w.type=3:h.ctrlKey?w.key=u.C0.ESC+"[6;"+(g+1)+"~":w.key=u.C0.ESC+"[6~";break;case 112:w.key=g?u.C0.ESC+"[1;"+(g+1)+"P":u.C0.ESC+"OP";break;case 113:w.key=g?u.C0.ESC+"[1;"+(g+1)+"Q":u.C0.ESC+"OQ";break;case 114:w.key=g?u.C0.ESC+"[1;"+(g+1)+"R":u.C0.ESC+"OR";break;case 115:w.key=g?u.C0.ESC+"[1;"+(g+1)+"S":u.C0.ESC+"OS";break;case 116:w.key=g?u.C0.ESC+"[15;"+(g+1)+"~":u.C0.ESC+"[15~";break;case 117:w.key=g?u.C0.ESC+"[17;"+(g+1)+"~":u.C0.ESC+"[17~";break;case 118:w.key=g?u.C0.ESC+"[18;"+(g+1)+"~":u.C0.ESC+"[18~";break;case 119:w.key=g?u.C0.ESC+"[19;"+(g+1)+"~":u.C0.ESC+"[19~";break;case 120:w.key=g?u.C0.ESC+"[20;"+(g+1)+"~":u.C0.ESC+"[20~";break;case 121:w.key=g?u.C0.ESC+"[21;"+(g+1)+"~":u.C0.ESC+"[21~";break;case 122:w.key=g?u.C0.ESC+"[23;"+(g+1)+"~":u.C0.ESC+"[23~";break;case 123:w.key=g?u.C0.ESC+"[24;"+(g+1)+"~":u.C0.ESC+"[24~";break;default:if(!h.ctrlKey||h.shiftKey||h.altKey||h.metaKey)if(d&&!x||!h.altKey||h.metaKey)!d||h.altKey||h.ctrlKey||h.shiftKey||!h.metaKey?h.key&&!h.ctrlKey&&!h.altKey&&!h.metaKey&&h.keyCode>=48&&h.key.length===1?w.key=h.key:h.key&&h.ctrlKey&&(h.key==="_"&&(w.key=u.C0.US),h.key==="@"&&(w.key=u.C0.NUL)):h.keyCode===65&&(w.type=1);else{const m=c[h.keyCode],y=m==null?void 0:m[h.shiftKey?1:0];if(y)w.key=u.C0.ESC+y;else if(h.keyCode>=65&&h.keyCode<=90){const b=h.ctrlKey?h.keyCode-64:h.keyCode+32;let S=String.fromCharCode(b);h.shiftKey&&(S=S.toUpperCase()),w.key=u.C0.ESC+S}else if(h.keyCode===32)w.key=u.C0.ESC+(h.ctrlKey?u.C0.NUL:" ");else if(h.key==="Dead"&&h.code.startsWith("Key")){let b=h.code.slice(3,4);h.shiftKey||(b=b.toLowerCase()),w.key=u.C0.ESC+b,w.cancel=!0}}else h.keyCode>=65&&h.keyCode<=90?w.key=String.fromCharCode(h.keyCode-64):h.keyCode===32?w.key=u.C0.NUL:h.keyCode>=51&&h.keyCode<=55?w.key=String.fromCharCode(h.keyCode-51+27):h.keyCode===56?w.key=u.C0.DEL:h.keyCode===219?w.key=u.C0.ESC:h.keyCode===220?w.key=u.C0.FS:h.keyCode===221&&(w.key=u.C0.GS)}return w}},482:(o,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.Utf8ToUtf32=a.StringToUtf32=a.utf32ToString=a.stringFromCodePoint=void 0,a.stringFromCodePoint=function(l){return l>65535?(l-=65536,String.fromCharCode(55296+(l>>10))+String.fromCharCode(l%1024+56320)):String.fromCharCode(l)},a.utf32ToString=function(l,u=0,c=l.length){let h="";for(let v=u;v<c;++v){let d=l[v];d>65535?(d-=65536,h+=String.fromCharCode(55296+(d>>10))+String.fromCharCode(d%1024+56320)):h+=String.fromCharCode(d)}return h},a.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(l,u){const c=l.length;if(!c)return 0;let h=0,v=0;if(this._interim){const d=l.charCodeAt(v++);56320<=d&&d<=57343?u[h++]=1024*(this._interim-55296)+d-56320+65536:(u[h++]=this._interim,u[h++]=d),this._interim=0}for(let d=v;d<c;++d){const x=l.charCodeAt(d);if(55296<=x&&x<=56319){if(++d>=c)return this._interim=x,h;const w=l.charCodeAt(d);56320<=w&&w<=57343?u[h++]=1024*(x-55296)+w-56320+65536:(u[h++]=x,u[h++]=w)}else x!==65279&&(u[h++]=x)}return h}},a.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(l,u){const c=l.length;if(!c)return 0;let h,v,d,x,w=0,g=0,m=0;if(this.interim[0]){let S=!1,N=this.interim[0];N&=(224&N)==192?31:(240&N)==224?15:7;let E,T=0;for(;(E=63&this.interim[++T])&&T<4;)N<<=6,N|=E;const k=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,L=k-T;for(;m<L;){if(m>=c)return 0;if(E=l[m++],(192&E)!=128){m--,S=!0;break}this.interim[T++]=E,N<<=6,N|=63&E}S||(k===2?N<128?m--:u[w++]=N:k===3?N<2048||N>=55296&&N<=57343||N===65279||(u[w++]=N):N<65536||N>1114111||(u[w++]=N)),this.interim.fill(0)}const y=c-4;let b=m;for(;b<c;){for(;!(!(b<y)||128&(h=l[b])||128&(v=l[b+1])||128&(d=l[b+2])||128&(x=l[b+3]));)u[w++]=h,u[w++]=v,u[w++]=d,u[w++]=x,b+=4;if(h=l[b++],h<128)u[w++]=h;else if((224&h)==192){if(b>=c)return this.interim[0]=h,w;if(v=l[b++],(192&v)!=128){b--;continue}if(g=(31&h)<<6|63&v,g<128){b--;continue}u[w++]=g}else if((240&h)==224){if(b>=c)return this.interim[0]=h,w;if(v=l[b++],(192&v)!=128){b--;continue}if(b>=c)return this.interim[0]=h,this.interim[1]=v,w;if(d=l[b++],(192&d)!=128){b--;continue}if(g=(15&h)<<12|(63&v)<<6|63&d,g<2048||g>=55296&&g<=57343||g===65279)continue;u[w++]=g}else if((248&h)==240){if(b>=c)return this.interim[0]=h,w;if(v=l[b++],(192&v)!=128){b--;continue}if(b>=c)return this.interim[0]=h,this.interim[1]=v,w;if(d=l[b++],(192&d)!=128){b--;continue}if(b>=c)return this.interim[0]=h,this.interim[1]=v,this.interim[2]=d,w;if(x=l[b++],(192&x)!=128){b--;continue}if(g=(7&h)<<18|(63&v)<<12|(63&d)<<6|63&x,g<65536||g>1114111)continue;u[w++]=g}}return w}}},225:(o,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.UnicodeV6=void 0;const u=l(1480),c=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],h=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]];let v;a.UnicodeV6=class{constructor(){if(this.version="6",!v){v=new Uint8Array(65536),v.fill(1),v[0]=0,v.fill(0,1,32),v.fill(0,127,160),v.fill(2,4352,4448),v[9001]=2,v[9002]=2,v.fill(2,11904,42192),v[12351]=1,v.fill(2,44032,55204),v.fill(2,63744,64256),v.fill(2,65040,65050),v.fill(2,65072,65136),v.fill(2,65280,65377),v.fill(2,65504,65511);for(let d=0;d<c.length;++d)v.fill(0,c[d][0],c[d][1]+1)}}wcwidth(d){return d<32?0:d<127?1:d<65536?v[d]:(function(x,w){let g,m=0,y=w.length-1;if(x<w[0][0]||x>w[y][1])return!1;for(;y>=m;)if(g=m+y>>1,x>w[g][1])m=g+1;else{if(!(x<w[g][0]))return!0;y=g-1}return!1})(d,h)?0:d>=131072&&d<=196605||d>=196608&&d<=262141?2:1}charProperties(d,x){let w=this.wcwidth(d),g=w===0&&x!==0;if(g){const m=u.UnicodeService.extractWidth(x);m===0?g=!1:m>w&&(w=m)}return u.UnicodeService.createPropertyValue(0,w,g)}}},5981:(o,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.WriteBuffer=void 0;const u=l(8460),c=l(844);class h extends c.Disposable{constructor(d){super(),this._action=d,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new u.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(d,x){if(x!==void 0&&this._syncCalls>x)return void(this._syncCalls=0);if(this._pendingData+=d.length,this._writeBuffer.push(d),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let w;for(this._isSyncWriting=!0;w=this._writeBuffer.shift();){this._action(w);const g=this._callbacks.shift();g&&g()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(d,x){if(this._pendingData>5e7)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput)return this._didUserInput=!1,this._pendingData+=d.length,this._writeBuffer.push(d),this._callbacks.push(x),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=d.length,this._writeBuffer.push(d),this._callbacks.push(x)}_innerWrite(d=0,x=!0){const w=d||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const g=this._writeBuffer[this._bufferOffset],m=this._action(g,x);if(m){const b=S=>Date.now()-w>=12?setTimeout((()=>this._innerWrite(0,S))):this._innerWrite(w,S);return void m.catch((S=>(queueMicrotask((()=>{throw S})),Promise.resolve(!1)))).then(b)}const y=this._callbacks[this._bufferOffset];if(y&&y(),this._bufferOffset++,this._pendingData-=g.length,Date.now()-w>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout((()=>this._innerWrite()))):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}}a.WriteBuffer=h},5941:(o,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.toRgbString=a.parseColor=void 0;const l=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,u=/^[\da-f]+$/;function c(h,v){const d=h.toString(16),x=d.length<2?"0"+d:d;switch(v){case 4:return d[0];case 8:return x;case 12:return(x+x).slice(0,3);default:return x+x}}a.parseColor=function(h){if(!h)return;let v=h.toLowerCase();if(v.indexOf("rgb:")===0){v=v.slice(4);const d=l.exec(v);if(d){const x=d[1]?15:d[4]?255:d[7]?4095:65535;return[Math.round(parseInt(d[1]||d[4]||d[7]||d[10],16)/x*255),Math.round(parseInt(d[2]||d[5]||d[8]||d[11],16)/x*255),Math.round(parseInt(d[3]||d[6]||d[9]||d[12],16)/x*255)]}}else if(v.indexOf("#")===0&&(v=v.slice(1),u.exec(v)&&[3,6,9,12].includes(v.length))){const d=v.length/3,x=[0,0,0];for(let w=0;w<3;++w){const g=parseInt(v.slice(d*w,d*w+d),16);x[w]=d===1?g<<4:d===2?g:d===3?g>>4:g>>8}return x}},a.toRgbString=function(h,v=16){const[d,x,w]=h;return`rgb:${c(d,v)}/${c(x,v)}/${c(w,v)}`}},5770:(o,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.PAYLOAD_LIMIT=void 0,a.PAYLOAD_LIMIT=1e7},6351:(o,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.DcsHandler=a.DcsParser=void 0;const u=l(482),c=l(8742),h=l(5770),v=[];a.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=v,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=v}registerHandler(x,w){this._handlers[x]===void 0&&(this._handlers[x]=[]);const g=this._handlers[x];return g.push(w),{dispose:()=>{const m=g.indexOf(w);m!==-1&&g.splice(m,1)}}}clearHandler(x){this._handlers[x]&&delete this._handlers[x]}setHandlerFallback(x){this._handlerFb=x}reset(){if(this._active.length)for(let x=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;x>=0;--x)this._active[x].unhook(!1);this._stack.paused=!1,this._active=v,this._ident=0}hook(x,w){if(this.reset(),this._ident=x,this._active=this._handlers[x]||v,this._active.length)for(let g=this._active.length-1;g>=0;g--)this._active[g].hook(w);else this._handlerFb(this._ident,"HOOK",w)}put(x,w,g){if(this._active.length)for(let m=this._active.length-1;m>=0;m--)this._active[m].put(x,w,g);else this._handlerFb(this._ident,"PUT",(0,u.utf32ToString)(x,w,g))}unhook(x,w=!0){if(this._active.length){let g=!1,m=this._active.length-1,y=!1;if(this._stack.paused&&(m=this._stack.loopPosition-1,g=w,y=this._stack.fallThrough,this._stack.paused=!1),!y&&g===!1){for(;m>=0&&(g=this._active[m].unhook(x),g!==!0);m--)if(g instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=m,this._stack.fallThrough=!1,g;m--}for(;m>=0;m--)if(g=this._active[m].unhook(!1),g instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=m,this._stack.fallThrough=!0,g}else this._handlerFb(this._ident,"UNHOOK",x);this._active=v,this._ident=0}};const d=new c.Params;d.addParam(0),a.DcsHandler=class{constructor(x){this._handler=x,this._data="",this._params=d,this._hitLimit=!1}hook(x){this._params=x.length>1||x.params[0]?x.clone():d,this._data="",this._hitLimit=!1}put(x,w,g){this._hitLimit||(this._data+=(0,u.utf32ToString)(x,w,g),this._data.length>h.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(x){let w=!1;if(this._hitLimit)w=!1;else if(x&&(w=this._handler(this._data,this._params),w instanceof Promise))return w.then((g=>(this._params=d,this._data="",this._hitLimit=!1,g)));return this._params=d,this._data="",this._hitLimit=!1,w}}},2015:(o,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.EscapeSequenceParser=a.VT500_TRANSITION_TABLE=a.TransitionTable=void 0;const u=l(844),c=l(8742),h=l(6242),v=l(6351);class d{constructor(m){this.table=new Uint8Array(m)}setDefault(m,y){this.table.fill(m<<4|y)}add(m,y,b,S){this.table[y<<8|m]=b<<4|S}addMany(m,y,b,S){for(let N=0;N<m.length;N++)this.table[y<<8|m[N]]=b<<4|S}}a.TransitionTable=d;const x=160;a.VT500_TRANSITION_TABLE=(function(){const g=new d(4095),m=Array.apply(null,Array(256)).map(((T,k)=>k)),y=(T,k)=>m.slice(T,k),b=y(32,127),S=y(0,24);S.push(25),S.push.apply(S,y(28,32));const N=y(0,14);let E;for(E in g.setDefault(1,0),g.addMany(b,0,2,0),N)g.addMany([24,26,153,154],E,3,0),g.addMany(y(128,144),E,3,0),g.addMany(y(144,152),E,3,0),g.add(156,E,0,0),g.add(27,E,11,1),g.add(157,E,4,8),g.addMany([152,158,159],E,0,7),g.add(155,E,11,3),g.add(144,E,11,9);return g.addMany(S,0,3,0),g.addMany(S,1,3,1),g.add(127,1,0,1),g.addMany(S,8,0,8),g.addMany(S,3,3,3),g.add(127,3,0,3),g.addMany(S,4,3,4),g.add(127,4,0,4),g.addMany(S,6,3,6),g.addMany(S,5,3,5),g.add(127,5,0,5),g.addMany(S,2,3,2),g.add(127,2,0,2),g.add(93,1,4,8),g.addMany(b,8,5,8),g.add(127,8,5,8),g.addMany([156,27,24,26,7],8,6,0),g.addMany(y(28,32),8,0,8),g.addMany([88,94,95],1,0,7),g.addMany(b,7,0,7),g.addMany(S,7,0,7),g.add(156,7,0,0),g.add(127,7,0,7),g.add(91,1,11,3),g.addMany(y(64,127),3,7,0),g.addMany(y(48,60),3,8,4),g.addMany([60,61,62,63],3,9,4),g.addMany(y(48,60),4,8,4),g.addMany(y(64,127),4,7,0),g.addMany([60,61,62,63],4,0,6),g.addMany(y(32,64),6,0,6),g.add(127,6,0,6),g.addMany(y(64,127),6,0,0),g.addMany(y(32,48),3,9,5),g.addMany(y(32,48),5,9,5),g.addMany(y(48,64),5,0,6),g.addMany(y(64,127),5,7,0),g.addMany(y(32,48),4,9,5),g.addMany(y(32,48),1,9,2),g.addMany(y(32,48),2,9,2),g.addMany(y(48,127),2,10,0),g.addMany(y(48,80),1,10,0),g.addMany(y(81,88),1,10,0),g.addMany([89,90,92],1,10,0),g.addMany(y(96,127),1,10,0),g.add(80,1,11,9),g.addMany(S,9,0,9),g.add(127,9,0,9),g.addMany(y(28,32),9,0,9),g.addMany(y(32,48),9,9,12),g.addMany(y(48,60),9,8,10),g.addMany([60,61,62,63],9,9,10),g.addMany(S,11,0,11),g.addMany(y(32,128),11,0,11),g.addMany(y(28,32),11,0,11),g.addMany(S,10,0,10),g.add(127,10,0,10),g.addMany(y(28,32),10,0,10),g.addMany(y(48,60),10,8,10),g.addMany([60,61,62,63],10,0,11),g.addMany(y(32,48),10,9,12),g.addMany(S,12,0,12),g.add(127,12,0,12),g.addMany(y(28,32),12,0,12),g.addMany(y(32,48),12,9,12),g.addMany(y(48,64),12,0,11),g.addMany(y(64,127),12,12,13),g.addMany(y(64,127),10,12,13),g.addMany(y(64,127),9,12,13),g.addMany(S,13,13,13),g.addMany(b,13,13,13),g.add(127,13,0,13),g.addMany([27,156,24,26],13,14,0),g.add(x,0,2,0),g.add(x,8,5,8),g.add(x,6,0,6),g.add(x,11,0,11),g.add(x,13,13,13),g})();class w extends u.Disposable{constructor(m=a.VT500_TRANSITION_TABLE){super(),this._transitions=m,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new c.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(y,b,S)=>{},this._executeHandlerFb=y=>{},this._csiHandlerFb=(y,b)=>{},this._escHandlerFb=y=>{},this._errorHandlerFb=y=>y,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,u.toDisposable)((()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)}))),this._oscParser=this.register(new h.OscParser),this._dcsParser=this.register(new v.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(m,y=[64,126]){let b=0;if(m.prefix){if(m.prefix.length>1)throw new Error("only one byte as prefix supported");if(b=m.prefix.charCodeAt(0),b&&60>b||b>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(m.intermediates){if(m.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let N=0;N<m.intermediates.length;++N){const E=m.intermediates.charCodeAt(N);if(32>E||E>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");b<<=8,b|=E}}if(m.final.length!==1)throw new Error("final must be a single byte");const S=m.final.charCodeAt(0);if(y[0]>S||S>y[1])throw new Error(`final must be in range ${y[0]} .. ${y[1]}`);return b<<=8,b|=S,b}identToString(m){const y=[];for(;m;)y.push(String.fromCharCode(255&m)),m>>=8;return y.reverse().join("")}setPrintHandler(m){this._printHandler=m}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(m,y){const b=this._identifier(m,[48,126]);this._escHandlers[b]===void 0&&(this._escHandlers[b]=[]);const S=this._escHandlers[b];return S.push(y),{dispose:()=>{const N=S.indexOf(y);N!==-1&&S.splice(N,1)}}}clearEscHandler(m){this._escHandlers[this._identifier(m,[48,126])]&&delete this._escHandlers[this._identifier(m,[48,126])]}setEscHandlerFallback(m){this._escHandlerFb=m}setExecuteHandler(m,y){this._executeHandlers[m.charCodeAt(0)]=y}clearExecuteHandler(m){this._executeHandlers[m.charCodeAt(0)]&&delete this._executeHandlers[m.charCodeAt(0)]}setExecuteHandlerFallback(m){this._executeHandlerFb=m}registerCsiHandler(m,y){const b=this._identifier(m);this._csiHandlers[b]===void 0&&(this._csiHandlers[b]=[]);const S=this._csiHandlers[b];return S.push(y),{dispose:()=>{const N=S.indexOf(y);N!==-1&&S.splice(N,1)}}}clearCsiHandler(m){this._csiHandlers[this._identifier(m)]&&delete this._csiHandlers[this._identifier(m)]}setCsiHandlerFallback(m){this._csiHandlerFb=m}registerDcsHandler(m,y){return this._dcsParser.registerHandler(this._identifier(m),y)}clearDcsHandler(m){this._dcsParser.clearHandler(this._identifier(m))}setDcsHandlerFallback(m){this._dcsParser.setHandlerFallback(m)}registerOscHandler(m,y){return this._oscParser.registerHandler(m,y)}clearOscHandler(m){this._oscParser.clearHandler(m)}setOscHandlerFallback(m){this._oscParser.setHandlerFallback(m)}setErrorHandler(m){this._errorHandler=m}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(m,y,b,S,N){this._parseStack.state=m,this._parseStack.handlers=y,this._parseStack.handlerPos=b,this._parseStack.transition=S,this._parseStack.chunkPos=N}parse(m,y,b){let S,N=0,E=0,T=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,T=this._parseStack.chunkPos+1;else{if(b===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const k=this._parseStack.handlers;let L=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(b===!1&&L>-1){for(;L>=0&&(S=k[L](this._params),S!==!0);L--)if(S instanceof Promise)return this._parseStack.handlerPos=L,S}this._parseStack.handlers=[];break;case 4:if(b===!1&&L>-1){for(;L>=0&&(S=k[L](),S!==!0);L--)if(S instanceof Promise)return this._parseStack.handlerPos=L,S}this._parseStack.handlers=[];break;case 6:if(N=m[this._parseStack.chunkPos],S=this._dcsParser.unhook(N!==24&&N!==26,b),S)return S;N===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(N=m[this._parseStack.chunkPos],S=this._oscParser.end(N!==24&&N!==26,b),S)return S;N===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,T=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let k=T;k<y;++k){switch(N=m[k],E=this._transitions.table[this.currentState<<8|(N<160?N:x)],E>>4){case 2:for(let B=k+1;;++B){if(B>=y||(N=m[B])<32||N>126&&N<x){this._printHandler(m,k,B),k=B-1;break}if(++B>=y||(N=m[B])<32||N>126&&N<x){this._printHandler(m,k,B),k=B-1;break}if(++B>=y||(N=m[B])<32||N>126&&N<x){this._printHandler(m,k,B),k=B-1;break}if(++B>=y||(N=m[B])<32||N>126&&N<x){this._printHandler(m,k,B),k=B-1;break}}break;case 3:this._executeHandlers[N]?this._executeHandlers[N]():this._executeHandlerFb(N),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:k,code:N,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const L=this._csiHandlers[this._collect<<8|N];let A=L?L.length-1:-1;for(;A>=0&&(S=L[A](this._params),S!==!0);A--)if(S instanceof Promise)return this._preserveStack(3,L,A,E,k),S;A<0&&this._csiHandlerFb(this._collect<<8|N,this._params),this.precedingJoinState=0;break;case 8:do switch(N){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(N-48)}while(++k<y&&(N=m[k])>47&&N<60);k--;break;case 9:this._collect<<=8,this._collect|=N;break;case 10:const I=this._escHandlers[this._collect<<8|N];let M=I?I.length-1:-1;for(;M>=0&&(S=I[M](),S!==!0);M--)if(S instanceof Promise)return this._preserveStack(4,I,M,E,k),S;M<0&&this._escHandlerFb(this._collect<<8|N),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|N,this._params);break;case 13:for(let B=k+1;;++B)if(B>=y||(N=m[B])===24||N===26||N===27||N>127&&N<x){this._dcsParser.put(m,k,B),k=B-1;break}break;case 14:if(S=this._dcsParser.unhook(N!==24&&N!==26),S)return this._preserveStack(6,[],0,E,k),S;N===27&&(E|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let B=k+1;;B++)if(B>=y||(N=m[B])<32||N>127&&N<x){this._oscParser.put(m,k,B),k=B-1;break}break;case 6:if(S=this._oscParser.end(N!==24&&N!==26),S)return this._preserveStack(5,[],0,E,k),S;N===27&&(E|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&E}}}a.EscapeSequenceParser=w},6242:(o,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.OscHandler=a.OscParser=void 0;const u=l(5770),c=l(482),h=[];a.OscParser=class{constructor(){this._state=0,this._active=h,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(v,d){this._handlers[v]===void 0&&(this._handlers[v]=[]);const x=this._handlers[v];return x.push(d),{dispose:()=>{const w=x.indexOf(d);w!==-1&&x.splice(w,1)}}}clearHandler(v){this._handlers[v]&&delete this._handlers[v]}setHandlerFallback(v){this._handlerFb=v}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=h}reset(){if(this._state===2)for(let v=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;v>=0;--v)this._active[v].end(!1);this._stack.paused=!1,this._active=h,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||h,this._active.length)for(let v=this._active.length-1;v>=0;v--)this._active[v].start();else this._handlerFb(this._id,"START")}_put(v,d,x){if(this._active.length)for(let w=this._active.length-1;w>=0;w--)this._active[w].put(v,d,x);else this._handlerFb(this._id,"PUT",(0,c.utf32ToString)(v,d,x))}start(){this.reset(),this._state=1}put(v,d,x){if(this._state!==3){if(this._state===1)for(;d<x;){const w=v[d++];if(w===59){this._state=2,this._start();break}if(w<48||57<w)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+w-48}this._state===2&&x-d>0&&this._put(v,d,x)}}end(v,d=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let x=!1,w=this._active.length-1,g=!1;if(this._stack.paused&&(w=this._stack.loopPosition-1,x=d,g=this._stack.fallThrough,this._stack.paused=!1),!g&&x===!1){for(;w>=0&&(x=this._active[w].end(v),x!==!0);w--)if(x instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=w,this._stack.fallThrough=!1,x;w--}for(;w>=0;w--)if(x=this._active[w].end(!1),x instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=w,this._stack.fallThrough=!0,x}else this._handlerFb(this._id,"END",v);this._active=h,this._id=-1,this._state=0}}},a.OscHandler=class{constructor(v){this._handler=v,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(v,d,x){this._hitLimit||(this._data+=(0,c.utf32ToString)(v,d,x),this._data.length>u.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(v){let d=!1;if(this._hitLimit)d=!1;else if(v&&(d=this._handler(this._data),d instanceof Promise))return d.then((x=>(this._data="",this._hitLimit=!1,x)));return this._data="",this._hitLimit=!1,d}}},8742:(o,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.Params=void 0;const l=2147483647;class u{static fromArray(h){const v=new u;if(!h.length)return v;for(let d=Array.isArray(h[0])?1:0;d<h.length;++d){const x=h[d];if(Array.isArray(x))for(let w=0;w<x.length;++w)v.addSubParam(x[w]);else v.addParam(x)}return v}constructor(h=32,v=32){if(this.maxLength=h,this.maxSubParamsLength=v,v>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(h),this.length=0,this._subParams=new Int32Array(v),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(h),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const h=new u(this.maxLength,this.maxSubParamsLength);return h.params.set(this.params),h.length=this.length,h._subParams.set(this._subParams),h._subParamsLength=this._subParamsLength,h._subParamsIdx.set(this._subParamsIdx),h._rejectDigits=this._rejectDigits,h._rejectSubDigits=this._rejectSubDigits,h._digitIsSub=this._digitIsSub,h}toArray(){const h=[];for(let v=0;v<this.length;++v){h.push(this.params[v]);const d=this._subParamsIdx[v]>>8,x=255&this._subParamsIdx[v];x-d>0&&h.push(Array.prototype.slice.call(this._subParams,d,x))}return h}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(h){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(h<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=h>l?l:h}}addSubParam(h){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(h<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=h>l?l:h,this._subParamsIdx[this.length-1]++}}hasSubParams(h){return(255&this._subParamsIdx[h])-(this._subParamsIdx[h]>>8)>0}getSubParams(h){const v=this._subParamsIdx[h]>>8,d=255&this._subParamsIdx[h];return d-v>0?this._subParams.subarray(v,d):null}getSubParamsAll(){const h={};for(let v=0;v<this.length;++v){const d=this._subParamsIdx[v]>>8,x=255&this._subParamsIdx[v];x-d>0&&(h[v]=this._subParams.slice(d,x))}return h}addDigit(h){let v;if(this._rejectDigits||!(v=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const d=this._digitIsSub?this._subParams:this.params,x=d[v-1];d[v-1]=~x?Math.min(10*x+h,l):h}}a.Params=u},5741:(o,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.AddonManager=void 0,a.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let l=this._addons.length-1;l>=0;l--)this._addons[l].instance.dispose()}loadAddon(l,u){const c={instance:u,dispose:u.dispose,isDisposed:!1};this._addons.push(c),u.dispose=()=>this._wrappedAddonDispose(c),u.activate(l)}_wrappedAddonDispose(l){if(l.isDisposed)return;let u=-1;for(let c=0;c<this._addons.length;c++)if(this._addons[c]===l){u=c;break}if(u===-1)throw new Error("Could not dispose an addon that has not been loaded");l.isDisposed=!0,l.dispose.apply(l.instance),this._addons.splice(u,1)}}},8771:(o,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.BufferApiView=void 0;const u=l(3785),c=l(511);a.BufferApiView=class{constructor(h,v){this._buffer=h,this.type=v}init(h){return this._buffer=h,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(h){const v=this._buffer.lines.get(h);if(v)return new u.BufferLineApiView(v)}getNullCell(){return new c.CellData}}},3785:(o,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.BufferLineApiView=void 0;const u=l(511);a.BufferLineApiView=class{constructor(c){this._line=c}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(c,h){if(!(c<0||c>=this._line.length))return h?(this._line.loadCell(c,h),h):this._line.loadCell(c,new u.CellData)}translateToString(c,h,v){return this._line.translateToString(c,h,v)}}},8285:(o,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.BufferNamespaceApi=void 0;const u=l(8771),c=l(8460),h=l(844);class v extends h.Disposable{constructor(x){super(),this._core=x,this._onBufferChange=this.register(new c.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new u.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new u.BufferApiView(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate((()=>this._onBufferChange.fire(this.active)))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}}a.BufferNamespaceApi=v},7975:(o,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.ParserApi=void 0,a.ParserApi=class{constructor(l){this._core=l}registerCsiHandler(l,u){return this._core.registerCsiHandler(l,(c=>u(c.toArray())))}addCsiHandler(l,u){return this.registerCsiHandler(l,u)}registerDcsHandler(l,u){return this._core.registerDcsHandler(l,((c,h)=>u(c,h.toArray())))}addDcsHandler(l,u){return this.registerDcsHandler(l,u)}registerEscHandler(l,u){return this._core.registerEscHandler(l,u)}addEscHandler(l,u){return this.registerEscHandler(l,u)}registerOscHandler(l,u){return this._core.registerOscHandler(l,u)}addOscHandler(l,u){return this.registerOscHandler(l,u)}}},7090:(o,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.UnicodeApi=void 0,a.UnicodeApi=class{constructor(l){this._core=l}register(l){this._core.unicodeService.register(l)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(l){this._core.unicodeService.activeVersion=l}}},744:function(o,a,l){var u=this&&this.__decorate||function(g,m,y,b){var S,N=arguments.length,E=N<3?m:b===null?b=Object.getOwnPropertyDescriptor(m,y):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(g,m,y,b);else for(var T=g.length-1;T>=0;T--)(S=g[T])&&(E=(N<3?S(E):N>3?S(m,y,E):S(m,y))||E);return N>3&&E&&Object.defineProperty(m,y,E),E},c=this&&this.__param||function(g,m){return function(y,b){m(y,b,g)}};Object.defineProperty(a,"__esModule",{value:!0}),a.BufferService=a.MINIMUM_ROWS=a.MINIMUM_COLS=void 0;const h=l(8460),v=l(844),d=l(5295),x=l(2585);a.MINIMUM_COLS=2,a.MINIMUM_ROWS=1;let w=a.BufferService=class extends v.Disposable{get buffer(){return this.buffers.active}constructor(g){super(),this.isUserScrolling=!1,this._onResize=this.register(new h.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new h.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(g.rawOptions.cols||0,a.MINIMUM_COLS),this.rows=Math.max(g.rawOptions.rows||0,a.MINIMUM_ROWS),this.buffers=this.register(new d.BufferSet(g,this))}resize(g,m){this.cols=g,this.rows=m,this.buffers.resize(g,m),this._onResize.fire({cols:g,rows:m})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(g,m=!1){const y=this.buffer;let b;b=this._cachedBlankLine,b&&b.length===this.cols&&b.getFg(0)===g.fg&&b.getBg(0)===g.bg||(b=y.getBlankLine(g,m),this._cachedBlankLine=b),b.isWrapped=m;const S=y.ybase+y.scrollTop,N=y.ybase+y.scrollBottom;if(y.scrollTop===0){const E=y.lines.isFull;N===y.lines.length-1?E?y.lines.recycle().copyFrom(b):y.lines.push(b.clone()):y.lines.splice(N+1,0,b.clone()),E?this.isUserScrolling&&(y.ydisp=Math.max(y.ydisp-1,0)):(y.ybase++,this.isUserScrolling||y.ydisp++)}else{const E=N-S+1;y.lines.shiftElements(S+1,E-1,-1),y.lines.set(N,b.clone())}this.isUserScrolling||(y.ydisp=y.ybase),this._onScroll.fire(y.ydisp)}scrollLines(g,m,y){const b=this.buffer;if(g<0){if(b.ydisp===0)return;this.isUserScrolling=!0}else g+b.ydisp>=b.ybase&&(this.isUserScrolling=!1);const S=b.ydisp;b.ydisp=Math.max(Math.min(b.ydisp+g,b.ybase),0),S!==b.ydisp&&(m||this._onScroll.fire(b.ydisp))}};a.BufferService=w=u([c(0,x.IOptionsService)],w)},7994:(o,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.CharsetService=void 0,a.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(l){this.glevel=l,this.charset=this._charsets[l]}setgCharset(l,u){this._charsets[l]=u,this.glevel===l&&(this.charset=u)}}},1753:function(o,a,l){var u=this&&this.__decorate||function(b,S,N,E){var T,k=arguments.length,L=k<3?S:E===null?E=Object.getOwnPropertyDescriptor(S,N):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")L=Reflect.decorate(b,S,N,E);else for(var A=b.length-1;A>=0;A--)(T=b[A])&&(L=(k<3?T(L):k>3?T(S,N,L):T(S,N))||L);return k>3&&L&&Object.defineProperty(S,N,L),L},c=this&&this.__param||function(b,S){return function(N,E){S(N,E,b)}};Object.defineProperty(a,"__esModule",{value:!0}),a.CoreMouseService=void 0;const h=l(2585),v=l(8460),d=l(844),x={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:b=>b.button!==4&&b.action===1&&(b.ctrl=!1,b.alt=!1,b.shift=!1,!0)},VT200:{events:19,restrict:b=>b.action!==32},DRAG:{events:23,restrict:b=>b.action!==32||b.button!==3},ANY:{events:31,restrict:b=>!0}};function w(b,S){let N=(b.ctrl?16:0)|(b.shift?4:0)|(b.alt?8:0);return b.button===4?(N|=64,N|=b.action):(N|=3&b.button,4&b.button&&(N|=64),8&b.button&&(N|=128),b.action===32?N|=32:b.action!==0||S||(N|=3)),N}const g=String.fromCharCode,m={DEFAULT:b=>{const S=[w(b,!1)+32,b.col+32,b.row+32];return S[0]>255||S[1]>255||S[2]>255?"":`\x1B[M${g(S[0])}${g(S[1])}${g(S[2])}`},SGR:b=>{const S=b.action===0&&b.button!==4?"m":"M";return`\x1B[<${w(b,!0)};${b.col};${b.row}${S}`},SGR_PIXELS:b=>{const S=b.action===0&&b.button!==4?"m":"M";return`\x1B[<${w(b,!0)};${b.x};${b.y}${S}`}};let y=a.CoreMouseService=class extends d.Disposable{constructor(b,S){super(),this._bufferService=b,this._coreService=S,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new v.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const N of Object.keys(x))this.addProtocol(N,x[N]);for(const N of Object.keys(m))this.addEncoding(N,m[N]);this.reset()}addProtocol(b,S){this._protocols[b]=S}addEncoding(b,S){this._encodings[b]=S}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(b){if(!this._protocols[b])throw new Error(`unknown protocol "${b}"`);this._activeProtocol=b,this._onProtocolChange.fire(this._protocols[b].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(b){if(!this._encodings[b])throw new Error(`unknown encoding "${b}"`);this._activeEncoding=b}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(b){if(b.col<0||b.col>=this._bufferService.cols||b.row<0||b.row>=this._bufferService.rows||b.button===4&&b.action===32||b.button===3&&b.action!==32||b.button!==4&&(b.action===2||b.action===3)||(b.col++,b.row++,b.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,b,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(b))return!1;const S=this._encodings[this._activeEncoding](b);return S&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(S):this._coreService.triggerDataEvent(S,!0)),this._lastEvent=b,!0}explainEvents(b){return{down:!!(1&b),up:!!(2&b),drag:!!(4&b),move:!!(8&b),wheel:!!(16&b)}}_equalEvents(b,S,N){if(N){if(b.x!==S.x||b.y!==S.y)return!1}else if(b.col!==S.col||b.row!==S.row)return!1;return b.button===S.button&&b.action===S.action&&b.ctrl===S.ctrl&&b.alt===S.alt&&b.shift===S.shift}};a.CoreMouseService=y=u([c(0,h.IBufferService),c(1,h.ICoreService)],y)},6975:function(o,a,l){var u=this&&this.__decorate||function(y,b,S,N){var E,T=arguments.length,k=T<3?b:N===null?N=Object.getOwnPropertyDescriptor(b,S):N;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(y,b,S,N);else for(var L=y.length-1;L>=0;L--)(E=y[L])&&(k=(T<3?E(k):T>3?E(b,S,k):E(b,S))||k);return T>3&&k&&Object.defineProperty(b,S,k),k},c=this&&this.__param||function(y,b){return function(S,N){b(S,N,y)}};Object.defineProperty(a,"__esModule",{value:!0}),a.CoreService=void 0;const h=l(1439),v=l(8460),d=l(844),x=l(2585),w=Object.freeze({insertMode:!1}),g=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let m=a.CoreService=class extends d.Disposable{constructor(y,b,S){super(),this._bufferService=y,this._logService=b,this._optionsService=S,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new v.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new v.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new v.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new v.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,h.clone)(w),this.decPrivateModes=(0,h.clone)(g)}reset(){this.modes=(0,h.clone)(w),this.decPrivateModes=(0,h.clone)(g)}triggerDataEvent(y,b=!1){if(this._optionsService.rawOptions.disableStdin)return;const S=this._bufferService.buffer;b&&this._optionsService.rawOptions.scrollOnUserInput&&S.ybase!==S.ydisp&&this._onRequestScrollToBottom.fire(),b&&this._onUserInput.fire(),this._logService.debug(`sending data "${y}"`,(()=>y.split("").map((N=>N.charCodeAt(0))))),this._onData.fire(y)}triggerBinaryEvent(y){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${y}"`,(()=>y.split("").map((b=>b.charCodeAt(0))))),this._onBinary.fire(y))}};a.CoreService=m=u([c(0,x.IBufferService),c(1,x.ILogService),c(2,x.IOptionsService)],m)},9074:(o,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.DecorationService=void 0;const u=l(8055),c=l(8460),h=l(844),v=l(6106);let d=0,x=0;class w extends h.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new v.SortedList((y=>y==null?void 0:y.marker.line)),this._onDecorationRegistered=this.register(new c.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new c.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,h.toDisposable)((()=>this.reset())))}registerDecoration(y){if(y.marker.isDisposed)return;const b=new g(y);if(b){const S=b.marker.onDispose((()=>b.dispose()));b.onDispose((()=>{b&&(this._decorations.delete(b)&&this._onDecorationRemoved.fire(b),S.dispose())})),this._decorations.insert(b),this._onDecorationRegistered.fire(b)}return b}reset(){for(const y of this._decorations.values())y.dispose();this._decorations.clear()}*getDecorationsAtCell(y,b,S){let N=0,E=0;for(const T of this._decorations.getKeyIterator(b))N=T.options.x??0,E=N+(T.options.width??1),y>=N&&y<E&&(!S||(T.options.layer??"bottom")===S)&&(yield T)}forEachDecorationAtCell(y,b,S,N){this._decorations.forEachByKey(b,(E=>{d=E.options.x??0,x=d+(E.options.width??1),y>=d&&y<x&&(!S||(E.options.layer??"bottom")===S)&&N(E)}))}}a.DecorationService=w;class g extends h.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=u.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=u.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(y){super(),this.options=y,this.onRenderEmitter=this.register(new c.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new c.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=y.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(o,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.InstantiationService=a.ServiceCollection=void 0;const u=l(2585),c=l(8343);class h{constructor(...d){this._entries=new Map;for(const[x,w]of d)this.set(x,w)}set(d,x){const w=this._entries.get(d);return this._entries.set(d,x),w}forEach(d){for(const[x,w]of this._entries.entries())d(x,w)}has(d){return this._entries.has(d)}get(d){return this._entries.get(d)}}a.ServiceCollection=h,a.InstantiationService=class{constructor(){this._services=new h,this._services.set(u.IInstantiationService,this)}setService(v,d){this._services.set(v,d)}getService(v){return this._services.get(v)}createInstance(v,...d){const x=(0,c.getServiceDependencies)(v).sort(((m,y)=>m.index-y.index)),w=[];for(const m of x){const y=this._services.get(m.id);if(!y)throw new Error(`[createInstance] ${v.name} depends on UNKNOWN service ${m.id}.`);w.push(y)}const g=x.length>0?x[0].index:d.length;if(d.length!==g)throw new Error(`[createInstance] First service dependency of ${v.name} at position ${g+1} conflicts with ${d.length} static arguments`);return new v(...d,...w)}}},7866:function(o,a,l){var u=this&&this.__decorate||function(g,m,y,b){var S,N=arguments.length,E=N<3?m:b===null?b=Object.getOwnPropertyDescriptor(m,y):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(g,m,y,b);else for(var T=g.length-1;T>=0;T--)(S=g[T])&&(E=(N<3?S(E):N>3?S(m,y,E):S(m,y))||E);return N>3&&E&&Object.defineProperty(m,y,E),E},c=this&&this.__param||function(g,m){return function(y,b){m(y,b,g)}};Object.defineProperty(a,"__esModule",{value:!0}),a.traceCall=a.setTraceLogger=a.LogService=void 0;const h=l(844),v=l(2585),d={trace:v.LogLevelEnum.TRACE,debug:v.LogLevelEnum.DEBUG,info:v.LogLevelEnum.INFO,warn:v.LogLevelEnum.WARN,error:v.LogLevelEnum.ERROR,off:v.LogLevelEnum.OFF};let x,w=a.LogService=class extends h.Disposable{get logLevel(){return this._logLevel}constructor(g){super(),this._optionsService=g,this._logLevel=v.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),x=this}_updateLogLevel(){this._logLevel=d[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(g){for(let m=0;m<g.length;m++)typeof g[m]=="function"&&(g[m]=g[m]())}_log(g,m,y){this._evalLazyOptionalParams(y),g.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+m,...y)}trace(g,...m){var y;this._logLevel<=v.LogLevelEnum.TRACE&&this._log(((y=this._optionsService.options.logger)==null?void 0:y.trace.bind(this._optionsService.options.logger))??console.log,g,m)}debug(g,...m){var y;this._logLevel<=v.LogLevelEnum.DEBUG&&this._log(((y=this._optionsService.options.logger)==null?void 0:y.debug.bind(this._optionsService.options.logger))??console.log,g,m)}info(g,...m){var y;this._logLevel<=v.LogLevelEnum.INFO&&this._log(((y=this._optionsService.options.logger)==null?void 0:y.info.bind(this._optionsService.options.logger))??console.info,g,m)}warn(g,...m){var y;this._logLevel<=v.LogLevelEnum.WARN&&this._log(((y=this._optionsService.options.logger)==null?void 0:y.warn.bind(this._optionsService.options.logger))??console.warn,g,m)}error(g,...m){var y;this._logLevel<=v.LogLevelEnum.ERROR&&this._log(((y=this._optionsService.options.logger)==null?void 0:y.error.bind(this._optionsService.options.logger))??console.error,g,m)}};a.LogService=w=u([c(0,v.IOptionsService)],w),a.setTraceLogger=function(g){x=g},a.traceCall=function(g,m,y){if(typeof y.value!="function")throw new Error("not supported");const b=y.value;y.value=function(...S){if(x.logLevel!==v.LogLevelEnum.TRACE)return b.apply(this,S);x.trace(`GlyphRenderer#${b.name}(${S.map((E=>JSON.stringify(E))).join(", ")})`);const N=b.apply(this,S);return x.trace(`GlyphRenderer#${b.name} return`,N),N}}},7302:(o,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.OptionsService=a.DEFAULT_OPTIONS=void 0;const u=l(8460),c=l(844),h=l(6114);a.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"courier-new, courier, monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},rescaleOverlappingGlyphs:!1,rightClickSelectsWord:h.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const v=["normal","bold","100","200","300","400","500","600","700","800","900"];class d extends c.Disposable{constructor(w){super(),this._onOptionChange=this.register(new u.EventEmitter),this.onOptionChange=this._onOptionChange.event;const g={...a.DEFAULT_OPTIONS};for(const m in w)if(m in g)try{const y=w[m];g[m]=this._sanitizeAndValidateOption(m,y)}catch(y){console.error(y)}this.rawOptions=g,this.options={...g},this._setupOptions(),this.register((0,c.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(w,g){return this.onOptionChange((m=>{m===w&&g(this.rawOptions[w])}))}onMultipleOptionChange(w,g){return this.onOptionChange((m=>{w.indexOf(m)!==-1&&g()}))}_setupOptions(){const w=m=>{if(!(m in a.DEFAULT_OPTIONS))throw new Error(`No option with key "${m}"`);return this.rawOptions[m]},g=(m,y)=>{if(!(m in a.DEFAULT_OPTIONS))throw new Error(`No option with key "${m}"`);y=this._sanitizeAndValidateOption(m,y),this.rawOptions[m]!==y&&(this.rawOptions[m]=y,this._onOptionChange.fire(m))};for(const m in this.rawOptions){const y={get:w.bind(this,m),set:g.bind(this,m)};Object.defineProperty(this.options,m,y)}}_sanitizeAndValidateOption(w,g){switch(w){case"cursorStyle":if(g||(g=a.DEFAULT_OPTIONS[w]),!(function(m){return m==="block"||m==="underline"||m==="bar"})(g))throw new Error(`"${g}" is not a valid value for ${w}`);break;case"wordSeparator":g||(g=a.DEFAULT_OPTIONS[w]);break;case"fontWeight":case"fontWeightBold":if(typeof g=="number"&&1<=g&&g<=1e3)break;g=v.includes(g)?g:a.DEFAULT_OPTIONS[w];break;case"cursorWidth":g=Math.floor(g);case"lineHeight":case"tabStopWidth":if(g<1)throw new Error(`${w} cannot be less than 1, value: ${g}`);break;case"minimumContrastRatio":g=Math.max(1,Math.min(21,Math.round(10*g)/10));break;case"scrollback":if((g=Math.min(g,4294967295))<0)throw new Error(`${w} cannot be less than 0, value: ${g}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(g<=0)throw new Error(`${w} cannot be less than or equal to 0, value: ${g}`);break;case"rows":case"cols":if(!g&&g!==0)throw new Error(`${w} must be numeric, value: ${g}`);break;case"windowsPty":g=g??{}}return g}}a.OptionsService=d},2660:function(o,a,l){var u=this&&this.__decorate||function(d,x,w,g){var m,y=arguments.length,b=y<3?x:g===null?g=Object.getOwnPropertyDescriptor(x,w):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(d,x,w,g);else for(var S=d.length-1;S>=0;S--)(m=d[S])&&(b=(y<3?m(b):y>3?m(x,w,b):m(x,w))||b);return y>3&&b&&Object.defineProperty(x,w,b),b},c=this&&this.__param||function(d,x){return function(w,g){x(w,g,d)}};Object.defineProperty(a,"__esModule",{value:!0}),a.OscLinkService=void 0;const h=l(2585);let v=a.OscLinkService=class{constructor(d){this._bufferService=d,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(d){const x=this._bufferService.buffer;if(d.id===void 0){const S=x.addMarker(x.ybase+x.y),N={data:d,id:this._nextId++,lines:[S]};return S.onDispose((()=>this._removeMarkerFromLink(N,S))),this._dataByLinkId.set(N.id,N),N.id}const w=d,g=this._getEntryIdKey(w),m=this._entriesWithId.get(g);if(m)return this.addLineToLink(m.id,x.ybase+x.y),m.id;const y=x.addMarker(x.ybase+x.y),b={id:this._nextId++,key:this._getEntryIdKey(w),data:w,lines:[y]};return y.onDispose((()=>this._removeMarkerFromLink(b,y))),this._entriesWithId.set(b.key,b),this._dataByLinkId.set(b.id,b),b.id}addLineToLink(d,x){const w=this._dataByLinkId.get(d);if(w&&w.lines.every((g=>g.line!==x))){const g=this._bufferService.buffer.addMarker(x);w.lines.push(g),g.onDispose((()=>this._removeMarkerFromLink(w,g)))}}getLinkData(d){var x;return(x=this._dataByLinkId.get(d))==null?void 0:x.data}_getEntryIdKey(d){return`${d.id};;${d.uri}`}_removeMarkerFromLink(d,x){const w=d.lines.indexOf(x);w!==-1&&(d.lines.splice(w,1),d.lines.length===0&&(d.data.id!==void 0&&this._entriesWithId.delete(d.key),this._dataByLinkId.delete(d.id)))}};a.OscLinkService=v=u([c(0,h.IBufferService)],v)},8343:(o,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.createDecorator=a.getServiceDependencies=a.serviceRegistry=void 0;const l="di$target",u="di$dependencies";a.serviceRegistry=new Map,a.getServiceDependencies=function(c){return c[u]||[]},a.createDecorator=function(c){if(a.serviceRegistry.has(c))return a.serviceRegistry.get(c);const h=function(v,d,x){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(w,g,m){g[l]===g?g[u].push({id:w,index:m}):(g[u]=[{id:w,index:m}],g[l]=g)})(h,v,x)};return h.toString=()=>c,a.serviceRegistry.set(c,h),h}},2585:(o,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.IDecorationService=a.IUnicodeService=a.IOscLinkService=a.IOptionsService=a.ILogService=a.LogLevelEnum=a.IInstantiationService=a.ICharsetService=a.ICoreService=a.ICoreMouseService=a.IBufferService=void 0;const u=l(8343);var c;a.IBufferService=(0,u.createDecorator)("BufferService"),a.ICoreMouseService=(0,u.createDecorator)("CoreMouseService"),a.ICoreService=(0,u.createDecorator)("CoreService"),a.ICharsetService=(0,u.createDecorator)("CharsetService"),a.IInstantiationService=(0,u.createDecorator)("InstantiationService"),(function(h){h[h.TRACE=0]="TRACE",h[h.DEBUG=1]="DEBUG",h[h.INFO=2]="INFO",h[h.WARN=3]="WARN",h[h.ERROR=4]="ERROR",h[h.OFF=5]="OFF"})(c||(a.LogLevelEnum=c={})),a.ILogService=(0,u.createDecorator)("LogService"),a.IOptionsService=(0,u.createDecorator)("OptionsService"),a.IOscLinkService=(0,u.createDecorator)("OscLinkService"),a.IUnicodeService=(0,u.createDecorator)("UnicodeService"),a.IDecorationService=(0,u.createDecorator)("DecorationService")},1480:(o,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.UnicodeService=void 0;const u=l(8460),c=l(225);class h{static extractShouldJoin(d){return(1&d)!=0}static extractWidth(d){return d>>1&3}static extractCharKind(d){return d>>3}static createPropertyValue(d,x,w=!1){return(16777215&d)<<3|(3&x)<<1|(w?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new u.EventEmitter,this.onChange=this._onChange.event;const d=new c.UnicodeV6;this.register(d),this._active=d.version,this._activeProvider=d}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(d){if(!this._providers[d])throw new Error(`unknown Unicode version "${d}"`);this._active=d,this._activeProvider=this._providers[d],this._onChange.fire(d)}register(d){this._providers[d.version]=d}wcwidth(d){return this._activeProvider.wcwidth(d)}getStringCellWidth(d){let x=0,w=0;const g=d.length;for(let m=0;m<g;++m){let y=d.charCodeAt(m);if(55296<=y&&y<=56319){if(++m>=g)return x+this.wcwidth(y);const N=d.charCodeAt(m);56320<=N&&N<=57343?y=1024*(y-55296)+N-56320+65536:x+=this.wcwidth(N)}const b=this.charProperties(y,w);let S=h.extractWidth(b);h.extractShouldJoin(b)&&(S-=h.extractWidth(w)),x+=S,w=b}return x}charProperties(d,x){return this._activeProvider.charProperties(d,x)}}a.UnicodeService=h}},n={};function i(o){var a=n[o];if(a!==void 0)return a.exports;var l=n[o]={exports:{}};return r[o].call(l.exports,l,l.exports,i),l.exports}var s={};return(()=>{var o=s;Object.defineProperty(o,"__esModule",{value:!0}),o.Terminal=void 0;const a=i(9042),l=i(3236),u=i(844),c=i(5741),h=i(8285),v=i(7975),d=i(7090),x=["cols","rows"];class w extends u.Disposable{constructor(m){super(),this._core=this.register(new l.Terminal(m)),this._addonManager=this.register(new c.AddonManager),this._publicOptions={...this._core.options};const y=S=>this._core.options[S],b=(S,N)=>{this._checkReadonlyOptions(S),this._core.options[S]=N};for(const S in this._core.options){const N={get:y.bind(this,S),set:b.bind(this,S)};Object.defineProperty(this._publicOptions,S,N)}}_checkReadonlyOptions(m){if(x.includes(m))throw new Error(`Option "${m}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new v.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new d.UnicodeApi(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this.register(new h.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const m=this._core.coreService.decPrivateModes;let y="none";switch(this._core.coreMouseService.activeProtocol){case"X10":y="x10";break;case"VT200":y="vt200";break;case"DRAG":y="drag";break;case"ANY":y="any"}return{applicationCursorKeysMode:m.applicationCursorKeys,applicationKeypadMode:m.applicationKeypad,bracketedPasteMode:m.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:y,originMode:m.origin,reverseWraparoundMode:m.reverseWraparound,sendFocusMode:m.sendFocus,wraparoundMode:m.wraparound}}get options(){return this._publicOptions}set options(m){for(const y in m)this._publicOptions[y]=m[y]}blur(){this._core.blur()}focus(){this._core.focus()}input(m,y=!0){this._core.input(m,y)}resize(m,y){this._verifyIntegers(m,y),this._core.resize(m,y)}open(m){this._core.open(m)}attachCustomKeyEventHandler(m){this._core.attachCustomKeyEventHandler(m)}attachCustomWheelEventHandler(m){this._core.attachCustomWheelEventHandler(m)}registerLinkProvider(m){return this._core.registerLinkProvider(m)}registerCharacterJoiner(m){return this._checkProposedApi(),this._core.registerCharacterJoiner(m)}deregisterCharacterJoiner(m){this._checkProposedApi(),this._core.deregisterCharacterJoiner(m)}registerMarker(m=0){return this._verifyIntegers(m),this._core.registerMarker(m)}registerDecoration(m){return this._checkProposedApi(),this._verifyPositiveIntegers(m.x??0,m.width??0,m.height??0),this._core.registerDecoration(m)}hasSelection(){return this._core.hasSelection()}select(m,y,b){this._verifyIntegers(m,y,b),this._core.select(m,y,b)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(m,y){this._verifyIntegers(m,y),this._core.selectLines(m,y)}dispose(){super.dispose()}scrollLines(m){this._verifyIntegers(m),this._core.scrollLines(m)}scrollPages(m){this._verifyIntegers(m),this._core.scrollPages(m)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(m){this._verifyIntegers(m),this._core.scrollToLine(m)}clear(){this._core.clear()}write(m,y){this._core.write(m,y)}writeln(m,y){this._core.write(m),this._core.write(`\r
383
- `,y)}paste(m){this._core.paste(m)}refresh(m,y){this._verifyIntegers(m,y),this._core.refresh(m,y)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(m){this._addonManager.loadAddon(this,m)}static get strings(){return a}_verifyIntegers(...m){for(const y of m)if(y===1/0||isNaN(y)||y%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...m){for(const y of m)if(y&&(y===1/0||isNaN(y)||y%1!=0||y<0))throw new Error("This API only accepts positive integers")}}o.Terminal=w})(),s})()))})(Fp)),Fp.exports}var nS=FA(),zp={exports:{}},nb;function zA(){return nb||(nb=1,(function(t,e){(function(r,n){t.exports=n()})(self,(()=>(()=>{var r={};return(()=>{var n=r;Object.defineProperty(n,"__esModule",{value:!0}),n.FitAddon=void 0,n.FitAddon=class{activate(i){this._terminal=i}dispose(){}fit(){const i=this.proposeDimensions();if(!i||!this._terminal||isNaN(i.cols)||isNaN(i.rows))return;const s=this._terminal._core;this._terminal.rows===i.rows&&this._terminal.cols===i.cols||(s._renderService.clear(),this._terminal.resize(i.cols,i.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const i=this._terminal._core,s=i._renderService.dimensions;if(s.css.cell.width===0||s.css.cell.height===0)return;const o=this._terminal.options.scrollback===0?0:i.viewport.scrollBarWidth,a=window.getComputedStyle(this._terminal.element.parentElement),l=parseInt(a.getPropertyValue("height")),u=Math.max(0,parseInt(a.getPropertyValue("width"))),c=window.getComputedStyle(this._terminal.element),h=l-(parseInt(c.getPropertyValue("padding-top"))+parseInt(c.getPropertyValue("padding-bottom"))),v=u-(parseInt(c.getPropertyValue("padding-right"))+parseInt(c.getPropertyValue("padding-left")))-o;return{cols:Math.max(2,Math.floor(v/s.css.cell.width)),rows:Math.max(1,Math.floor(h/s.css.cell.height))}}}})(),r})()))})(zp)),zp.exports}var iS=zA();function HA({cwd:t,cmd:e,governed:r=!0}){const n=ne.useRef(null),i=ne.useRef({cwd:t,cmd:e,governed:r});return i.current={cwd:t,cmd:e,governed:r},ne.useEffect(()=>{const s=n.current;if(!s)return;let o=!1,a,l;const u=new nS.Terminal({convertEol:!1,cursorBlink:!0,fontSize:12,fontFamily:'"JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace',theme:{background:"#0d1117",foreground:"#e6edf3",cursor:"#ffda19",cursorAccent:"#0d1117"}}),c=new iS.FitAddon;u.loadAddon(c);const h=u.onData(x=>{a&&a.readyState===WebSocket.OPEN&&a.send(x)}),v=typeof ResizeObserver<"u"?new ResizeObserver(()=>{try{c.fit()}catch{}l&&at.resizeTerminal(l,u.cols,u.rows).catch(()=>{})}):void 0,d=requestAnimationFrame(()=>{if(!o){u.open(s);try{c.fit()}catch{}v==null||v.observe(s),(async()=>{const x=i.current;let w;try{const m={cwd:x.cwd,cols:u.cols,rows:u.rows,governed:x.governed};x.cmd!==void 0&&(m.cmd=x.cmd),w=(await at.openTerminal(m)).id}catch(m){const y=m instanceof Error?m.message:String(m);u.write(`\r
384
- \x1B[31m[failed to open terminal: ${y}]\x1B[0m\r
385
- `);return}if(o){at.closeTerminal(w).catch(()=>{});return}l=w;const g=new WebSocket(nw(w));g.binaryType="arraybuffer",g.onmessage=m=>{typeof m.data=="string"?u.write(m.data):u.write(new Uint8Array(m.data))},a=g})()}});return()=>{o=!0,cancelAnimationFrame(d),v==null||v.disconnect(),h.dispose();try{a==null||a.close()}catch{}l&&at.closeTerminal(l).catch(()=>{}),u.dispose()}},[]),_.jsxs("div",{"data-testid":"terminal",className:"flex flex-col gap-1",children:[_.jsxs("div",{className:"flex items-center justify-between text-[11px]",children:[_.jsx("span",{className:"font-semibold font-mono",style:{color:"rgba(230,237,243,0.4)"},children:"Terminal"}),_.jsx("span",{"data-testid":"terminal-governed",style:{color:r?"rgba(230,237,243,0.35)":"#ffda19",fontWeight:r?void 0:600},children:r?"governed":"ungoverned operator shell"})]}),_.jsx("div",{ref:n,"data-testid":"terminal-host",className:"h-64 w-full overflow-hidden rounded p-1",style:{background:"#0d1117"}})]})}function Yo({label:t,value:e,mono:r}){return _.jsxs("div",{className:"flex gap-2 text-[11px]",children:[_.jsx("span",{className:"w-20 shrink-0 font-mono",style:{color:"rgba(230,237,243,0.4)"},children:t}),_.jsx("span",{className:r?"font-mono break-all":"",style:{color:"rgba(230,237,243,0.7)"},children:e})]})}function UA({model:t}){const{session:e}=t;return _.jsxs("div",{"data-testid":"what-where",className:"flex flex-col gap-1.5",children:[_.jsx(Yo,{label:"intent",value:e.problem}),_.jsx(Yo,{label:"repo",value:e.repo_ref??"—",mono:!0}),_.jsx(Yo,{label:"worktree",value:e.workdir??"—",mono:!0}),_.jsx(Yo,{label:"roster",value:e.clis.length>0?e.clis.join(", "):"—",mono:!0}),_.jsx(Yo,{label:"entity",value:e.entity_mode}),_.jsxs("div",{className:"mt-1 rounded p-1.5 text-[10px] font-mono",style:{border:"1px dashed rgba(230,237,243,0.12)",color:"rgba(230,237,243,0.35)"},children:["diff: not exposed on the run DTO (",_.jsx("code",{children:"work_output"})," pending daemon surface)"]})]})}const WA=[{id:"whatwhere",label:"What / Where"},{id:"decisions",label:"Decisions"},{id:"governance",label:"Governance"},{id:"burn",label:"Burn"},{id:"data",label:"Data"},{id:"steering",label:"Steering"},{id:"assumptions",label:"Assumptions"},{id:"files",label:"Files"}],VA=new Set(["Write","Edit","MultiEdit","NotebookEdit"]),$A=new Set(["DeleteFile","Remove"]);function Hp({path:t,opKind:e}){const[r,n]=ne.useState(!1),i=ne.useRef(null);ne.useEffect(()=>()=>{i.current!==null&&clearTimeout(i.current)},[]);const s=t.replace(/\\/g,"/").split("/"),o=s.pop()??t,a=s.length>0?`${s.join("/")}/`:"",l=e==="delete"?"−":e==="write"?"±":"~",u=e==="delete"?"#f85149":e==="write"?"#ffda19":"rgba(230,237,243,0.25)",c=e==="delete"?"#f85149":"#e6edf3";function h(){navigator.clipboard.writeText(t).then(()=>{n(!0),i.current!==null&&clearTimeout(i.current),i.current=setTimeout(()=>{n(!1),i.current=null},1500)}).catch(()=>{})}return _.jsxs("li",{title:r?"Copied!":t,className:"flex items-start gap-1.5 min-w-0",children:[_.jsx("span",{className:"shrink-0 mt-0.5 text-[9px] font-mono select-none",style:{color:u},children:l}),_.jsxs("button",{type:"button",onClick:h,className:"min-w-0 leading-5 font-mono text-[10px] break-all text-left transition-opacity hover:opacity-70",title:r?"Copied!":`Click to copy: ${t}`,style:{background:"none",border:"none",padding:0,cursor:"pointer"},children:[a&&_.jsx("span",{style:{color:"rgba(230,237,243,0.3)"},children:a}),_.jsx("span",{style:{color:c},children:o}),r&&_.jsx("span",{className:"ml-1 text-[9px]",style:{color:"#3fb950"},children:"✓"})]})]})}function GA({model:t}){const e=new Set,r=new Set;for(const d of t.units)for(const x of d.hookFires)VA.has(x.toolName)&&e.add(d.ord),$A.has(x.toolName)&&r.add(d.ord);const n=new Set,i=new Set,s=new Set;for(const d of t.units)for(const x of d.filesRead)s.add(x),r.has(d.ord)?i.add(x):e.has(d.ord)&&n.add(x);for(const d of i)n.delete(d);const o=new Set;for(const d of s)!n.has(d)&&!i.has(d)&&o.add(d);const a=n.size>0||i.size>0,l=s.size>0,u=!["completed","cancelled","failed"].includes(t.session.status);if(!l)return _.jsx("p",{className:"text-xs font-mono",style:{color:"rgba(230,237,243,0.35)"},children:u?"No files changed yet.":"No files changed."});const c=[...n].sort(),h=[...i].sort(),v=[...o].sort();return _.jsxs("div",{className:"flex flex-col gap-4",children:[(a||u)&&_.jsxs("div",{children:[_.jsx("p",{className:"text-[10px] font-mono mb-2 uppercase tracking-wider",style:{color:"rgba(230,237,243,0.3)"},children:"Modified / Created"}),a?_.jsxs("ul",{className:"flex flex-col gap-1",children:[c.map(d=>_.jsx(Hp,{path:d,opKind:"write"},d)),h.map(d=>_.jsx(Hp,{path:d,opKind:"delete"},d))]}):_.jsx("p",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.3)"},children:"No files changed yet."})]}),v.length>0&&_.jsxs("div",{children:[_.jsx("p",{className:"text-[10px] font-mono mb-2 uppercase tracking-wider",style:{color:"rgba(230,237,243,0.3)"},children:"Referenced"}),_.jsx("ul",{className:"flex flex-col gap-1",children:v.map(d=>_.jsx(Hp,{path:d},d))})]}),_.jsxs("p",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.2)"},children:[s.size," file",s.size!==1?"s":""," total"]})]})}const qA=new Set(["executing","distributing","planning"]);function YA({view:t}){const[e,r]=ne.useState(!1),[n,i]=ne.useState("whatwhere"),[s,o]=ne.useState(!1),[a,l]=ne.useState(!1),[u,c]=ne.useState(""),[h,v]=ne.useState(!1),[d,x]=ne.useState(null),w=ne.useRef(null),g=ne.useRef(!1),{session:m}=t,y=CA(m.id,t),b=qA.has(m.status),S=y?new Set(y.units.flatMap(E=>E.filesRead)).size:null;function N(E){i(T=>T===E?null:E)}return e?_.jsxs("div",{className:"flex flex-col items-center w-10 shrink-0 py-3 gap-2",style:{background:"#0c1015",borderLeft:"1px solid rgba(230,237,243,0.07)"},children:[_.jsx("button",{type:"button",onClick:()=>r(!1),className:"text-sm leading-none",style:{color:"rgba(230,237,243,0.4)"},"aria-label":"Expand insights panel",children:"‹"}),_.jsx("button",{type:"button",onClick:()=>o(!0),title:"Terminal","aria-label":"Open terminal",className:"w-7 h-7 flex items-center justify-center rounded text-sm",style:{color:"rgba(230,237,243,0.4)"},children:"⬛"}),_.jsx("button",{type:"button",onClick:()=>l(!0),title:"Coverage","aria-label":"Open coverage",className:"w-7 h-7 flex items-center justify-center rounded text-sm font-mono",style:{color:"rgba(230,237,243,0.4)"},children:"%"})]}):_.jsxs("div",{className:"flex flex-col w-72 shrink-0 overflow-hidden",style:{background:"#0c1015",borderLeft:"1px solid rgba(230,237,243,0.07)"},children:[_.jsxs("div",{className:"flex items-center gap-1 px-3 py-2 border-b shrink-0",style:{background:"#090d12",borderColor:"rgba(230,237,243,0.07)"},children:[_.jsxs("button",{type:"button",onClick:()=>r(!0),className:"flex items-center gap-1.5 flex-1 min-w-0 text-left","aria-label":"Collapse insights panel",children:[_.jsx("span",{className:"text-sm leading-none shrink-0",style:{color:"rgba(230,237,243,0.35)"},children:"›"}),_.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-widest font-mono",style:{color:"rgba(230,237,243,0.4)"},children:"Insights"})]}),_.jsx("button",{type:"button",onClick:()=>o(!0),title:"Terminal","aria-label":"Open terminal",className:"rounded px-2 py-0.5 text-[11px] font-mono",style:{color:"rgba(230,237,243,0.45)"},children:"Term"}),_.jsx("button",{type:"button",onClick:()=>l(!0),title:"Coverage","aria-label":"Open coverage report",className:"rounded px-2 py-0.5 text-[11px] font-mono",style:{color:"rgba(230,237,243,0.45)"},children:"Cov"})]}),_.jsx("div",{className:"flex-1 overflow-y-auto",children:WA.map(({id:E,label:T})=>_.jsxs("div",{style:{borderBottom:"1px solid rgba(230,237,243,0.06)"},children:[_.jsxs("button",{type:"button",onClick:()=>N(E),className:"w-full flex items-center justify-between px-4 py-2.5 text-left transition-colors",style:{color:n===E?"#e6edf3":"rgba(230,237,243,0.55)"},onMouseEnter:k=>{k.currentTarget.style.background="rgba(230,237,243,0.04)"},onMouseLeave:k=>{k.currentTarget.style.background="transparent"},"aria-expanded":n===E,children:[_.jsxs("div",{className:"flex items-center gap-1.5",children:[_.jsx("span",{className:"text-xs font-medium font-mono",children:T}),E==="files"&&S!==null&&S>0&&_.jsx("span",{className:"text-[9px] font-mono px-1 py-0.5 rounded",style:{background:"rgba(121,192,255,0.12)",color:"#79c0ff"},children:S})]}),_.jsx("span",{className:"text-xs",style:{color:"rgba(230,237,243,0.3)"},children:n===E?"▲":"▼"})]}),n===E&&y&&_.jsxs("div",{className:"px-4 py-3",style:{background:"#0a0d12"},children:[E==="decisions"&&_.jsx(MA,{model:y}),E==="governance"&&_.jsx(OA,{model:y}),E==="burn"&&_.jsx(RA,{model:y}),E==="data"&&_.jsx(LA,{model:y}),E==="steering"&&_.jsx(jA,{runId:y.session.id}),E==="whatwhere"&&_.jsx(UA,{model:y}),E==="assumptions"&&_.jsx(kA,{model:y}),E==="files"&&_.jsx(GA,{model:y})]}),n===E&&!y&&_.jsx("div",{className:"px-4 py-3",children:_.jsx("p",{className:"text-xs font-mono",style:{color:"rgba(230,237,243,0.35)"},children:"Loading…"})})]},E))}),b&&_.jsxs("div",{className:"shrink-0 px-3 py-2 flex flex-col gap-1.5",style:{borderTop:"1px solid rgba(230,237,243,0.07)",background:"#090d12"},children:[_.jsx("p",{className:"text-[9px] font-mono uppercase tracking-widest",style:{color:"rgba(230,237,243,0.3)"},children:"Steer"}),_.jsxs("form",{onSubmit:E=>{E.preventDefault();const T=u.trim();!T||g.current||(g.current=!0,v(!0),x(null),at.injectMessage(m.id,T,"all").then(()=>{c("")}).catch(k=>{const L=k instanceof Error?k.message:String(k);x(L||"Failed to send instruction — please try again.")}).finally(()=>{g.current=!1,v(!1)}))},className:"flex flex-col gap-1",children:[_.jsxs("div",{className:"flex gap-1.5",children:[_.jsx("textarea",{ref:w,value:u,onChange:E=>{c(E.target.value),x(null)},onKeyDown:E=>{var T;E.key==="Enter"&&!E.shiftKey&&!E.nativeEvent.isComposing&&(E.preventDefault(),(T=E.currentTarget.form)==null||T.requestSubmit())},"aria-label":"Steering instruction",rows:2,placeholder:"Send instruction to agents…",disabled:h,className:"flex-1 resize-none rounded text-[11px] font-mono px-2 py-1.5 leading-relaxed",style:{background:"rgba(230,237,243,0.05)",border:"1px solid rgba(230,237,243,0.1)",color:"#e6edf3",outline:"none",minHeight:0}}),_.jsx("button",{type:"submit","aria-label":h?"Sending…":"Send steering instruction",disabled:h||!u.trim(),className:"shrink-0 self-end rounded px-2 py-1 text-[11px] font-mono font-medium transition-opacity disabled:opacity-30",style:{background:"rgba(121,192,255,0.15)",color:"#79c0ff",border:"1px solid rgba(121,192,255,0.2)"},children:h?"…":"↑"})]}),d&&_.jsx("p",{className:"text-[10px] font-mono",style:{color:"#f85149"},children:d})]})]}),s&&_.jsx(tb,{title:"Operator shell",onClose:()=>o(!1),disableEscapeKey:!0,children:_.jsx(HA,{cwd:m.workdir??".",governed:!0})}),a&&_.jsx(tb,{title:"Coverage report",onClose:()=>l(!1),children:_.jsx(sw,{})})]})}const aS={critical:"#f85149",error:"#f97316",warn:"#ffda19",info:"rgba(230,237,243,0.5)"},XA={id:"",rule_type:"pattern",statement:"",severity:"warn",confidence:.9,targets:{},provenance:{source:"manual",source_kinds:["policy"]}};function KA({rule:t,onEdit:e}){var r,n,i;return _.jsxs("tr",{className:"text-[11px]",style:{borderBottom:"1px solid rgba(230,237,243,0.06)"},children:[_.jsx("td",{className:"px-3 py-2 font-mono",style:{color:"rgba(230,237,243,0.7)"},children:t.id}),_.jsx("td",{className:"px-3 py-2",style:{color:"rgba(230,237,243,0.45)"},children:t.rule_type}),_.jsx("td",{className:"px-3 py-2",children:_.jsx("span",{className:"inline-flex rounded px-1.5 py-0.5 text-[10px] font-semibold font-mono",style:{background:"rgba(230,237,243,0.06)",color:aS[t.severity]??"rgba(230,237,243,0.5)"},children:t.severity})}),_.jsx("td",{className:"px-3 py-2 truncate max-w-xs",style:{color:"rgba(230,237,243,0.6)"},children:t.statement}),_.jsx("td",{className:"px-3 py-2 text-[10px]",style:{color:"rgba(230,237,243,0.35)"},children:[(r=t.targets)==null?void 0:r.language,(n=t.targets)==null?void 0:n.layer,(i=t.targets)==null?void 0:i.framework].filter(Boolean).join(" / ")||"—"}),_.jsx("td",{className:"px-3 py-2",children:_.jsx("button",{type:"button",onClick:()=>e(t),className:"text-[10px] hover:underline",style:{color:"#79c0ff"},children:"Edit"})})]})}function QA(){const[t,e]=ne.useState([]),[r,n]=ne.useState(!0),[i,s]=ne.useState(null),[o,a]=ne.useState(""),[l,u]=ne.useState(null),[c,h]=ne.useState("idle"),[v,d]=ne.useState(null),[x,w]=ne.useState({}),[g,m]=ne.useState(null),[y,b]=ne.useState(!1),[S,N]=ne.useState(null),E=ne.useCallback(async()=>{n(!0),s(null);try{const{rules:M}=await at.listConformanceRules();e(M)}catch(M){s(M instanceof Error?M.message:String(M))}finally{n(!1)}},[]);ne.useEffect(()=>{E()},[E]);const T=M=>{a(JSON.stringify(M??XA,null,2)),u(null),h("idle"),d(null)},k=M=>{a(M);try{JSON.parse(M),u(null)}catch(B){u(B instanceof Error?B.message:String(B))}},L=async()=>{if(l)return;let M;try{M=JSON.parse(o)}catch(B){u(B instanceof Error?B.message:String(B));return}h("saving"),d(null);try{await at.upsertConformanceRule(M),h("ok"),await E()}catch(B){h("error"),d(B instanceof Error?B.message:String(B))}},A=async()=>{b(!0),N(null);try{const{rules:M}=await at.recallRulesPreview(x);m(M)}catch(M){N(M instanceof Error?M.message:String(M)),m(null)}finally{b(!1)}},I=(M,B)=>_.jsx("input",{type:"text","aria-label":M,placeholder:B,value:x[M]??"",onChange:D=>w(H=>({...H,[M]:D.target.value||void 0})),className:"rounded px-2 py-0.5 text-[10px] focus:outline-none w-24",style:{background:"#161c26",border:"1px solid rgba(230,237,243,0.1)",color:"#e6edf3"}});return _.jsxs("div",{className:"flex flex-col gap-4",children:[_.jsxs("div",{className:"flex items-center gap-3",children:[_.jsx("h2",{className:"text-sm font-semibold",style:{color:"#e6edf3"},children:"Conformance rules"}),_.jsx("button",{type:"button",onClick:()=>void E(),className:"text-[10px] hover:underline",style:{color:"rgba(230,237,243,0.4)"},children:"Refresh"}),_.jsx("button",{type:"button",onClick:()=>T(),className:"ml-auto rounded px-2 py-1 text-[11px] font-semibold",style:{background:"#ffda19",color:"#0d1117"},children:"+ New rule"})]}),i&&_.jsx("p",{className:"rounded px-2 py-1 text-xs",style:{background:"rgba(248,81,73,0.08)",color:"#f85149"},children:i}),r?_.jsx("p",{className:"text-xs",style:{color:"rgba(230,237,243,0.4)"},children:"Loading rules…"}):_.jsx("div",{className:"overflow-x-auto rounded",style:{border:"1px solid rgba(230,237,243,0.08)"},children:_.jsxs("table",{className:"w-full text-[11px]",children:[_.jsx("thead",{children:_.jsxs("tr",{className:"text-[10px] uppercase tracking-wider",style:{borderBottom:"1px solid rgba(230,237,243,0.08)",background:"#0f1419",color:"rgba(230,237,243,0.4)"},children:[_.jsx("th",{className:"px-3 py-2 text-left",children:"ID"}),_.jsx("th",{className:"px-3 py-2 text-left",children:"Type"}),_.jsx("th",{className:"px-3 py-2 text-left",children:"Severity"}),_.jsx("th",{className:"px-3 py-2 text-left",children:"Statement"}),_.jsx("th",{className:"px-3 py-2 text-left",children:"Targets"}),_.jsx("th",{className:"px-3 py-2"})]})}),_.jsx("tbody",{children:t.length===0?_.jsx("tr",{children:_.jsx("td",{colSpan:6,className:"px-3 py-4 text-center text-xs",style:{color:"rgba(230,237,243,0.35)"},children:"No conformance rules registered."})}):t.map(M=>_.jsx(KA,{rule:M,onEdit:T},M.id))})]})}),o!==""&&_.jsxs("div",{className:"flex flex-col gap-2 rounded p-3",style:{border:"1px solid rgba(255,218,25,0.25)",background:"rgba(255,218,25,0.04)"},children:[_.jsxs("div",{className:"flex items-center gap-2",children:[_.jsx("span",{className:"text-[11px] font-semibold",style:{color:"#ffda19"},children:"Rule JSON"}),_.jsx("button",{type:"button",onClick:()=>{a(""),h("idle")},className:"ml-auto text-[10px] hover:underline",style:{color:"rgba(230,237,243,0.4)"},children:"Cancel"})]}),_.jsx("textarea",{"aria-label":"Conformance rule JSON editor",value:o,onChange:M=>k(M.target.value),spellCheck:!1,className:"rounded p-2 font-mono text-[10px] focus:outline-none min-h-[200px] resize-y",style:{background:"#0d1117",color:"#e6edf3",border:"1px solid rgba(230,237,243,0.1)"}}),l&&_.jsx("p",{className:"text-[10px]",style:{color:"#f85149"},children:l}),_.jsxs("div",{className:"flex items-center gap-2",children:[_.jsx("button",{type:"button",onClick:()=>void L(),disabled:!!l||c==="saving",className:"rounded px-3 py-1 text-[11px] font-semibold disabled:opacity-50",style:{background:"#3fb950",color:"#0d1117"},children:c==="saving"?"Saving…":"Save rule"}),c==="ok"&&_.jsx("span",{className:"text-[10px]",style:{color:"#3fb950"},children:"Saved."}),c==="error"&&_.jsx("span",{className:"text-[10px]",style:{color:"#f85149"},children:v})]})]}),_.jsxs("div",{className:"flex flex-col gap-2 rounded p-3",style:{border:"1px solid rgba(230,237,243,0.08)",background:"#0f1419"},children:[_.jsx("p",{className:"text-[11px] font-semibold",style:{color:"rgba(230,237,243,0.7)"},children:"Preview — which rules apply?"}),_.jsxs("div",{className:"flex flex-wrap gap-2 items-center",children:[I("language","language"),I("layer","layer"),I("framework","framework"),I("severity","severity"),I("rule_type","type"),_.jsx("button",{type:"button",onClick:()=>void A(),disabled:y,className:"rounded px-2 py-0.5 text-[10px] font-semibold disabled:opacity-50",style:{background:"#1b222e",color:"#e6edf3",border:"1px solid rgba(230,237,243,0.1)"},children:y?"Loading…":"Preview"})]}),S&&_.jsx("p",{className:"text-[10px]",style:{color:"#f85149"},children:S}),g!==null&&(g.length===0?_.jsx("p",{className:"text-[10px]",style:{color:"rgba(230,237,243,0.4)"},children:"No rules match this query."}):_.jsx("ul",{className:"flex flex-col gap-0.5",children:g.map(M=>_.jsxs("li",{className:"flex items-center gap-2 text-[10px]",children:[_.jsx("span",{className:"inline-flex rounded px-1 text-[9px] font-semibold font-mono",style:{background:"rgba(230,237,243,0.06)",color:aS[M.severity]??"rgba(230,237,243,0.5)"},children:M.severity}),_.jsx("span",{className:"font-mono",style:{color:"rgba(230,237,243,0.6)"},children:M.id}),_.jsx("span",{className:"truncate",style:{color:"rgba(230,237,243,0.45)"},children:M.statement})]},M.id))}))]})]})}const ZA={planning:{label:"Planning",className:"text-wk-muted",color:"rgba(230,237,243,0.55)"},distributing:{label:"Distributing",className:"text-wk-link",color:"#79c0ff"},executing:{label:"Executing",className:"text-wk-link",color:"#79c0ff"},awaiting_human:{label:"Awaiting human",className:"text-wk-accent",color:"#ffda19"},completed:{label:"Completed",className:"text-wk-ok",color:"#3fb950"},cancelled:{label:"Cancelled",className:"text-wk-muted",color:"rgba(230,237,243,0.4)"},failed:{label:"Failed",className:"text-wk-deny",color:"#f85149"}};function ib({runId:t,ord:e,prompt:r,onResolved:n}){const i=ei(m=>m.clearGate),s=Uv(m=>m.record),[o,a]=ne.useState(""),[l,u]=ne.useState(!1),[c,h]=ne.useState(null);async function v(m,y){u(!0),h(null);try{await m(),s({runId:t,action:y.kind,...typeof e=="number"?{ord:e}:{},...y.amend!==void 0?{amend:y.amend}:{}}),i(t),n==null||n()}catch(b){h(b instanceof Error?b.message:String(b))}finally{u(!1)}}const d=()=>v(()=>at.confirmGate(t,{approve:!0}),{kind:"approve"}),x=()=>{const m=o.trim();if(!m)return Promise.resolve();const y={approve:!0,amend:m};return v(()=>at.confirmGate(t,y),{kind:"approve-with-steer",amend:m})},w=()=>v(()=>at.confirmGate(t,{approve:!1}),{kind:"reject"}),g=()=>v(()=>at.cancelRun(t),{kind:"cancel"});return _.jsxs("div",{className:"rounded-xl p-4",style:{background:"#161c26",border:"1px solid rgba(255,218,25,0.3)",boxShadow:"0 0 0 1px rgba(255,218,25,0.08)"},"data-testid":"steering-gate","data-run-id":t,children:[_.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[_.jsx("span",{className:"w-2 h-2 rounded-full animate-pulse",style:{background:"#ffda19"}}),_.jsx("p",{className:"font-semibold text-sm font-mono",style:{color:"#ffda19"},children:"Awaiting human decision"})]}),_.jsxs("p",{className:"text-xs font-mono mb-3",style:{color:"rgba(230,237,243,0.4)"},children:["run ",t.slice(0,8),typeof e=="number"?` · before unit #${e}`:""]}),_.jsx("p",{className:"text-xs mb-4 whitespace-pre-wrap leading-relaxed font-mono",style:{color:"rgba(230,237,243,0.75)"},"data-testid":"steering-prompt",children:r??"Prompt unavailable (daemon restarted) — you can still approve, reject, or cancel."}),_.jsx("textarea",{"data-testid":"steering-amend",className:"w-full rounded-lg p-2 text-xs mb-3 resize-none font-mono",style:{background:"#0f1419",border:"1px solid rgba(230,237,243,0.14)",color:"#e6edf3",outline:"none"},rows:2,placeholder:"Optional steer / amend — sent with Approve with steer to guide the next unit",value:o,onChange:m=>a(m.target.value),disabled:l}),c&&_.jsx("p",{className:"text-xs mb-3 font-mono",style:{color:"#f85149"},"data-testid":"steering-error",children:c}),_.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[_.jsx("button",{"data-testid":"steering-approve",onClick:()=>void d(),disabled:l,className:"rounded-lg px-3 py-2 text-xs font-semibold font-mono disabled:opacity-50 transition-opacity",style:{background:"#3fb950",color:"#0d1117"},children:"Approve"}),_.jsx("button",{"data-testid":"steering-approve-steer",onClick:()=>void x(),disabled:l||!o.trim(),className:"rounded-lg px-3 py-2 text-xs font-semibold font-mono disabled:opacity-50 transition-opacity",style:{background:"#ffda19",color:"#0d1117"},children:"Approve with steer"}),_.jsx("button",{"data-testid":"steering-reject",onClick:()=>void w(),disabled:l,className:"rounded-lg px-3 py-2 text-xs font-semibold font-mono disabled:opacity-50 transition-opacity",style:{background:"rgba(248,81,73,0.15)",border:"1px solid rgba(248,81,73,0.3)",color:"#f85149"},children:"Reject"}),_.jsx("button",{"data-testid":"steering-cancel",onClick:()=>void g(),disabled:l,className:"rounded-lg px-3 py-2 text-xs font-mono disabled:opacity-50 transition-opacity",style:{background:"rgba(230,237,243,0.06)",border:"1px solid rgba(230,237,243,0.1)",color:"rgba(230,237,243,0.55)"},children:"Cancel run"})]})]})}const sS={feature:"Feature (6 phases)",bug:"Bug (4 phases)",migration:"Migration (5 phases)"};function JA(t,e){const r=e.find(n=>n.id===t);return r?`${t.charAt(0).toUpperCase()}${t.slice(1)} (${r.phases.length} phases)`:sS[t]??t}function Ns({children:t}){return _.jsx("p",{className:"text-[10px] uppercase tracking-widest font-semibold mb-2",style:{color:"rgba(230,237,243,0.35)"},children:t})}function Xo(){return _.jsx("div",{style:{height:"1px",background:"rgba(230,237,243,0.07)"}})}function eM({roster:t,selectedClis:e,onToggleCli:r,confirmMode:n,onConfirmModeChange:i,beforeOrd:s,onBeforeOrdChange:o,entityMode:a,onEntityModeChange:l,workflows:u,workflow:c,onWorkflowChange:h,repos:v,repoRefs:d,onRepoRefsChange:x,attachedFiles:w,onFilesChange:g}){const m=ne.useRef(null);function y(S){const N=Array.from(S.target.files??[]);g([...w,...N]),S.target.value=""}function b(S){g(w.filter((N,E)=>E!==S))}return _.jsxs("div",{role:"dialog","aria-label":"Launch options",className:"flex flex-col text-xs font-mono overflow-y-auto rounded-2xl",style:{background:"#1b222e",border:"1px solid rgba(230,237,243,0.15)",boxShadow:"0 16px 48px rgba(0,0,0,0.55)",width:"300px",maxHeight:"460px"},children:[_.jsxs("div",{className:"px-4 py-3",children:[_.jsx(Ns,{children:"Upload files"}),_.jsx("button",{type:"button",onClick:()=>{var S;return(S=m.current)==null?void 0:S.click()},className:"rounded-lg px-3 py-1.5 font-semibold transition-opacity hover:opacity-80",style:{background:"rgba(230,237,243,0.07)",color:"#e6edf3",border:"1px solid rgba(230,237,243,0.1)"},children:"Choose file(s)…"}),_.jsx("input",{ref:m,type:"file",multiple:!0,className:"hidden",onChange:y,"aria-label":"Upload files for knowledge context"}),w.length>0&&_.jsx("div",{className:"flex flex-wrap gap-1.5 mt-2",children:w.map((S,N)=>_.jsxs("span",{className:"flex items-center gap-1 rounded-full px-2.5 py-0.5 text-[11px]",style:{background:"rgba(121,192,255,0.1)",color:"#79c0ff",border:"1px solid rgba(121,192,255,0.2)"},children:[S.name,_.jsx("button",{type:"button",onClick:()=>b(N),"aria-label":`Remove ${S.name}`,className:"opacity-60 hover:opacity-100 leading-none",children:"×"})]},N))})]}),_.jsx(Xo,{}),_.jsxs("div",{className:"px-4 py-3",children:[_.jsx(Ns,{children:"CLIs on/off"}),t.length===0?_.jsx("span",{style:{color:"rgba(230,237,243,0.3)"},children:"No roster loaded"}):_.jsx("div",{className:"flex flex-wrap gap-x-4 gap-y-1.5",children:t.map(S=>_.jsxs("label",{className:"flex items-center gap-1.5 cursor-pointer",style:{color:"rgba(230,237,243,0.65)"},children:[_.jsx("input",{type:"checkbox",checked:e.has(S.key),onChange:()=>r(S.key),"data-testid":`launch-seat-${S.key}`}),_.jsx("span",{children:S.key})]},S.key))})]}),_.jsx(Xo,{}),_.jsxs("div",{className:"px-4 py-3",children:[_.jsx(Ns,{children:"Set gate"}),_.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[_.jsxs("select",{"data-testid":"launch-confirm",className:"rounded-lg px-2 py-1",style:{background:"#0d1117",border:"1px solid rgba(230,237,243,0.14)",color:"#e6edf3"},value:n,onChange:S=>i(S.target.value),children:[_.jsx("option",{value:"none",children:"None"}),_.jsx("option",{value:"all",children:"Every unit"}),_.jsx("option",{value:"before",children:"Before unit #"})]}),n==="before"&&_.jsx("input",{type:"number",min:1,value:s,onChange:S=>o(Math.max(1,Number(S.target.value)||1)),className:"w-14 rounded-lg px-2 py-1",style:{background:"#0d1117",border:"1px solid rgba(230,237,243,0.14)",color:"#e6edf3"}})]})]}),_.jsx(Xo,{}),_.jsxs("div",{className:"px-4 py-3",children:[_.jsx(Ns,{children:"Set mode"}),_.jsx("div",{className:"flex items-center gap-1.5",children:["shared","isolated"].map(S=>_.jsx("button",{type:"button","data-testid":`launch-entity-${S}`,onClick:()=>l(S),className:"rounded-lg px-3 py-1 capitalize font-medium transition-colors",style:a===S?{background:"rgba(230,237,243,0.12)",color:"#e6edf3"}:{color:"rgba(230,237,243,0.4)"},children:S},S))})]}),_.jsx(Xo,{}),_.jsxs("div",{className:"px-4 py-3",children:[_.jsx(Ns,{children:"Choose workflow"}),_.jsxs("select",{"data-testid":"launch-workflow",className:"rounded-lg px-2 py-1 w-full",style:{background:"#0d1117",border:"1px solid rgba(230,237,243,0.14)",color:"#e6edf3"},value:c,onChange:S=>h(S.target.value),children:[_.jsx("option",{value:"",children:"(free-text)"}),(u.length>0?u.map(S=>S.id):Object.keys(sS)).map(S=>_.jsx("option",{value:S,children:JA(S,u)},S))]})]}),_.jsx(Xo,{}),_.jsxs("div",{className:"px-4 py-3",children:[_.jsx(Ns,{children:"Add repos"}),v.length===0?_.jsx("p",{className:"text-[11px] font-mono italic",style:{color:"rgba(230,237,243,0.3)"},children:"No repos registered."}):_.jsx("div",{className:"flex flex-col gap-1.5 max-h-36 overflow-y-auto pr-1",children:v.map(S=>{const N=d.includes(S.id);return _.jsxs("label",{className:"flex items-center gap-2 cursor-pointer rounded px-1 py-0.5 hover:bg-[rgba(230,237,243,0.04)]",children:[_.jsx("input",{type:"checkbox","data-testid":`launch-repo-${S.id}`,checked:N,onChange:()=>{x(N?d.filter(E=>E!==S.id):[...d,S.id])},className:"accent-[#ffda19] w-3.5 h-3.5 shrink-0"}),_.jsx("span",{className:"text-[11px] font-mono truncate",style:{color:"#e6edf3"},children:S.name})]},S.id)})})]})]})}const tM=new Set(["executing","distributing","planning"]);function rM(t){const e=t.toLowerCase();return/\b(bug|fix|broken|error|crash|issue)\b/.test(e)?"bug":/\b(feature|implement|add|create)\b/.test(e)&&!/\b(bug|fix|broken|error|crash|issue)\b/.test(e)?"feature":/\b(migrate|upgrade|migration|move)\b/.test(e)?"migration":null}function nM({label:t,onClear:e}){return _.jsxs("span",{className:"flex items-center gap-1 rounded-full px-2.5 py-0.5 text-[11px] font-mono",style:{background:"rgba(230,237,243,0.07)",color:"rgba(230,237,243,0.6)",border:"1px solid rgba(230,237,243,0.1)"},children:[t,_.jsx("button",{type:"button",onClick:e,"aria-label":`Clear ${t}`,className:"opacity-60 hover:opacity-100 leading-none ml-0.5",children:"×"})]})}const iM=new Set(["chat","onboarding","survey-repo","repo-graph","domain-graph-slice","memories"]);function oS({runId:t,runStatus:e,onLaunched:r,embedded:n,workflowOverride:i,mode:s,injectTarget:o,onClearInjectTarget:a}){const l=ei(se=>se.clearGate),[u,c]=ne.useState(""),[h,v]=ne.useState(!1),[d,x]=ne.useState(null),w=ne.useRef(null),[g,m]=ne.useState(""),[y,b]=ne.useState(!1),[S,N]=ne.useState(null),E=ne.useRef(!1),[T,k]=ne.useState(""),[L,A]=ne.useState(""),[I,M]=ne.useState([]),[B,D]=ne.useState([]),H=ne.useMemo(()=>B.filter(se=>!se.is_system&&!iM.has(se.id)),[B]),[U,z]=ne.useState(new Set),[W,F]=ne.useState([]),[P,j]=ne.useState([]),[G,$]=ne.useState("shared"),[ee,ae]=ne.useState("none"),[ie,K]=ne.useState(1),[q,Y]=ne.useState([]),[X,J]=ne.useState(!1),[re,ce]=ne.useState(0),[de,Re]=ne.useState(null),[Pe,_e]=ne.useState(null),[ke,Le]=ne.useState(!1),[Ee,Ie]=ne.useState(!1),Oe=ne.useRef(null),De=ne.useRef(null),We=ne.useRef(null);ne.useEffect(()=>{at.getRoster().then(({roster:se})=>{M(se);try{const he=localStorage.getItem("wicked_default_clis");if(he){z(new Set(JSON.parse(he)));return}}catch{}z(new Set(se.filter(he=>he.enabled_for_council).map(he=>he.key)))}).catch(()=>{}),at.listRepos().then(({repos:se})=>F(se)).catch(()=>{}),at.listWorkflows().then(({workflows:se})=>D(se)).catch(()=>{})},[]),ne.useEffect(()=>(X?(ce(0),De.current=setInterval(()=>ce(se=>se+1),1e3)):(De.current!==null&&(clearInterval(De.current),De.current=null),ce(0)),()=>{De.current!==null&&(clearInterval(De.current),De.current=null)}),[X]),ne.useEffect(()=>{const se=We.current;if(!se)return;se.style.height="auto";const he=100;se.style.height=`${Math.min(se.scrollHeight,he)}px`},[T]),ne.useEffect(()=>{if(!T.trim()||L||i){_e(null);return}_e(rM(T))},[T,L,i]),ne.useEffect(()=>{if(!Ee)return;function se(he){Oe.current&&!Oe.current.contains(he.target)&&Ie(!1)}return document.addEventListener("click",se),()=>document.removeEventListener("click",se)},[Ee]),ne.useEffect(()=>{if(!Ee)return;function se(he){he.key==="Escape"&&Ie(!1)}return document.addEventListener("keydown",se),()=>document.removeEventListener("keydown",se)},[Ee]);function Ye(se){z(he=>{const pe=new Set(he);return pe.has(se)?pe.delete(se):pe.add(se),pe})}function ge(){z(new Set(I.filter(se=>se.enabled_for_council).map(se=>se.key)))}async function Ce(){if(!T.trim()||U.size===0||X)return;J(!0),Re(null);const se={problem:T.trim()},he=I.filter(Se=>U.has(Se.key));he.length>0&&(se.clisJson=JSON.stringify(he)),se.entityMode=G,s==="ask"?se.humanConfirm="all":s!=="autonomous"&&(ee==="all"?se.humanConfirm="all":ee==="before"&&(se.humanConfirm=`before:${ie}`));const pe=P[0];pe&&(se.repoRef=pe);const be=(i==null?void 0:i.trim())||L;be&&(se.workflow=be);try{const{runId:Se}=await at.launchRun(se);k(""),r(Se)}catch(Se){Re(Se instanceof Error?Se.message:String(Se))}finally{J(!1)}}async function Ae(){const se=u.trim();if(!(!se||!t)){v(!0),x(null);try{await at.confirmGate(t,{approve:!0,amend:se}),c(""),l(t)}catch(he){x(he instanceof Error?he.message:String(he))}finally{v(!1)}}}async function Fe(){const se=g.trim();if(!se||!t||E.current)return;E.current=!0,b(!0),N(null);const he=(o==null?void 0:o.trim())||"all";try{await at.injectMessage(t,se,he),m("")}catch(pe){N(pe instanceof Error?pe.message:String(pe))}finally{E.current=!1,b(!1)}}if(t){if(e==="awaiting_human"){const se=u.trim().length>0&&!h;return _.jsxs("div",{className:"px-5 py-4 flex flex-col gap-2 shrink-0",style:{borderTop:"1px solid rgba(230,237,243,0.07)",background:"#161c26"},children:[d&&_.jsx("p",{className:"text-[11px] font-mono",style:{color:"#f85149"},children:d}),_.jsxs("div",{className:"flex items-end gap-3 rounded-2xl px-4 py-3",style:{background:"#1b222e",border:"1px solid rgba(255,218,25,0.25)"},children:[_.jsx("textarea",{ref:w,className:"flex-1 resize-none text-base outline-none border-0 bg-transparent leading-6",style:{minHeight:"28px",color:"#e6edf3",fontFamily:"inherit"},placeholder:"Send steering guidance… (approves gate)",value:u,onChange:he=>c(he.target.value),onKeyDown:he=>{he.key==="Enter"&&(he.metaKey||he.ctrlKey)&&(he.preventDefault(),Ae())},disabled:h,rows:1}),_.jsx("button",{type:"button",onClick:()=>void Ae(),disabled:!se,className:"shrink-0 rounded-xl px-4 py-2 text-sm font-semibold transition-opacity disabled:opacity-40",style:{background:"#ffda19",color:"#0d1117"},children:h?"…":"Steer →"})]}),_.jsx("p",{className:"text-[10px] font-mono text-center",style:{color:"rgba(230,237,243,0.3)"},children:"Approve + steer · Cmd+Enter · Use the gate panel above to approve/reject without steering"})]})}if(e&&tM.has(e)){const se=g.trim().length>0&&!y,he=(o==null?void 0:o.trim())||"all",pe=he!=="all",be=pe?he:"all agents";return _.jsxs("div",{className:"px-5 py-4 flex flex-col gap-2 shrink-0",style:{borderTop:"1px solid rgba(230,237,243,0.07)",background:"#161c26"},children:[S&&_.jsx("p",{className:"text-[11px] font-mono",style:{color:"#f85149"},children:S}),_.jsxs("div",{className:"flex items-end gap-3 rounded-2xl px-4 py-3",style:{background:"#1b222e",border:"1px solid rgba(230,237,243,0.12)"},children:[_.jsx("textarea",{className:"flex-1 resize-none text-base outline-none border-0 bg-transparent leading-6",style:{minHeight:"28px",color:"#e6edf3",fontFamily:"inherit"},placeholder:`Send message to ${be}…`,value:g,onChange:Se=>m(Se.target.value),onKeyDown:Se=>{Se.key==="Enter"&&(Se.metaKey||Se.ctrlKey)&&(Se.preventDefault(),Fe())},disabled:y,rows:1}),_.jsx("button",{type:"button",onClick:()=>void Fe(),disabled:!se,className:"shrink-0 rounded-xl px-4 py-2 text-sm font-semibold transition-opacity disabled:opacity-40",style:{background:"#ffda19",color:"#0d1117"},children:y?"…":"Send →"})]}),_.jsxs("div",{className:"flex items-center gap-2",children:[_.jsx("p",{className:"text-[10px] font-mono flex-1",style:{color:"rgba(230,237,243,0.3)"},children:"Cmd+Enter · Click an agent to target it"}),pe&&_.jsxs("span",{className:"flex items-center gap-1 rounded-full px-2.5 py-0.5 text-[10px] font-mono",style:{background:"rgba(139,92,246,0.15)",color:"#c4b5fd",border:"1px solid rgba(139,92,246,0.25)"},children:["→ ",he,a&&_.jsx("button",{type:"button",onClick:a,"aria-label":"Clear target, broadcast to all",className:"opacity-60 hover:opacity-100 leading-none ml-0.5",children:"×"})]})]})]})}return _.jsx("div",{className:"px-5 py-4 shrink-0",style:{borderTop:"1px solid rgba(230,237,243,0.07)",background:"#161c26"},children:_.jsx("div",{className:"rounded-2xl px-5 py-4",style:{border:"1px solid rgba(230,237,243,0.1)",background:"#1b222e"},children:_.jsx("p",{className:"text-sm italic font-mono",style:{color:"rgba(230,237,243,0.35)"},children:"Steer at the next gate."})})})}const me=T.trim().length>0&&U.size>0&&!X,Z=Pe!==null&&!ke&&!L&&!i,te=new Set(I.filter(se=>se.enabled_for_council).map(se=>se.key)),oe=U.size!==te.size||[...U].some(se=>!te.has(se)),ue=[];q.length>0&&ue.push({label:`${q.length} file${q.length!==1?"s":""} attached`,onClear:()=>Y([])}),ee!=="none"&&ue.push({label:ee==="all"?"Gate: every unit":`Gate: before #${ie}`,onClear:()=>ae("none")}),G==="isolated"&&ue.push({label:"Mode: isolated",onClear:()=>$("shared")}),L&&ue.push({label:`Workflow: ${L}`,onClear:()=>{A(""),Le(!0)}});for(const se of P){const he=W.find(pe=>pe.id===se);ue.push({label:`Repo: ${(he==null?void 0:he.name)??se}`,onClear:()=>j(pe=>pe.filter(be=>be!==se))})}return oe&&I.length>0&&ue.push({label:`CLIs: ${[...U].join(", ")}`,onClear:ge}),_.jsxs("div",{className:`flex flex-col gap-3 ${n?"":"px-5 py-4 shrink-0"}`,style:n?{}:{borderTop:"1px solid rgba(230,237,243,0.07)",background:"#161c26"},children:[Z&&_.jsxs("div",{className:"flex items-center gap-2 text-xs rounded-xl px-4 py-2 font-mono",style:{background:"#161c26",border:"1px solid rgba(230,237,243,0.1)",color:"rgba(230,237,243,0.7)"},children:[_.jsxs("span",{children:["Detected: ",_.jsx("strong",{style:{color:"#ffda19"},children:Pe})," workflow"]}),_.jsx("button",{type:"button",onClick:()=>{A(Pe),Le(!0)},className:"rounded-lg px-3 py-1 font-semibold text-xs",style:{background:"#ffda19",color:"#0d1117"},children:"Apply"}),_.jsx("button",{type:"button",onClick:()=>Le(!0),className:"ml-auto",style:{color:"rgba(230,237,243,0.35)"},children:"✕"})]}),_.jsxs("div",{className:"flex items-end gap-2 rounded-2xl px-4 py-3 transition-all",style:{background:"#1b222e",border:"1px solid rgba(230,237,243,0.14)"},children:[_.jsxs("div",{className:"relative shrink-0",ref:Oe,children:[Ee&&_.jsx("div",{style:{position:"absolute",bottom:"calc(100% + 10px)",left:0,zIndex:50},children:_.jsx(eM,{roster:I,selectedClis:U,onToggleCli:Ye,confirmMode:ee,onConfirmModeChange:ae,beforeOrd:ie,onBeforeOrdChange:K,entityMode:G,onEntityModeChange:$,workflows:H,workflow:L,onWorkflowChange:se=>{A(se),Le(!0)},repos:W,repoRefs:P,onRepoRefsChange:j,attachedFiles:q,onFilesChange:Y})}),_.jsx("button",{type:"button","aria-label":"Open launch options","aria-expanded":Ee,"aria-haspopup":"dialog",onClick:()=>Ie(se=>!se),className:"w-7 h-7 rounded-full flex items-center justify-center text-base font-light transition-all",style:Ee?{background:"rgba(255,218,25,0.15)",color:"#ffda19",border:"1px solid rgba(255,218,25,0.3)"}:{background:"rgba(230,237,243,0.06)",color:"rgba(230,237,243,0.4)",border:"1px solid rgba(230,237,243,0.08)"},children:"+"})]}),_.jsx("textarea",{ref:We,"data-testid":"launch-problem",className:"flex-1 resize-none text-base outline-none border-0 bg-transparent leading-6",style:{minHeight:"28px",color:"#e6edf3",fontFamily:"inherit"},placeholder:"What do you need built?",value:T,onChange:se=>{k(se.target.value),Le(!1)},onKeyDown:se=>{se.key==="Enter"&&(se.metaKey||se.ctrlKey)&&(se.preventDefault(),Ce())},disabled:X,rows:1}),_.jsx("button",{type:"button","data-testid":"launch-submit",onClick:()=>void Ce(),disabled:!me,"aria-label":"Send",className:"shrink-0 rounded-xl px-5 py-2.5 text-sm font-semibold font-mono disabled:opacity-40 disabled:cursor-not-allowed transition-opacity",style:{background:"#ffda19",color:"#0d1117"},children:X?`${re}s`:"Send"})]}),ue.length>0&&_.jsx("div",{className:"flex flex-wrap gap-1.5 px-1",children:ue.map((se,he)=>_.jsx(nM,{label:se.label,onClear:se.onClear},he))}),de&&_.jsx("p",{className:"text-xs px-1 font-mono",style:{color:"#f85149"},"data-testid":"launch-error",children:de}),X&&re>=5&&_.jsx("p",{className:"text-xs text-center font-mono",style:{color:"rgba(230,237,243,0.35)"},children:"Creating run… council distribution happens off-thread once launched."})]})}function aM({terminalId:t,cliKey:e,onClose:r}){const n=ne.useRef(null),i=ne.useRef(t);return i.current=t,ne.useEffect(()=>{const s=n.current;if(!s)return;let o=!1;const a=new nS.Terminal({convertEol:!1,cursorBlink:!1,disableStdin:!0,fontSize:12,fontFamily:'"JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace',theme:{background:"#0d1117",foreground:"#e6edf3",cursor:"#ffda19",cursorAccent:"#0d1117"}}),l=new iS.FitAddon;a.loadAddon(l),a.open(s);try{l.fit()}catch{}const u=new WebSocket(nw(i.current));u.binaryType="arraybuffer",u.onmessage=h=>{typeof h.data=="string"?a.write(h.data):a.write(new Uint8Array(h.data))},u.onerror=()=>{o||a.write(`\r
386
- \x1B[31m[terminal connection error]\x1B[0m\r
387
- `)},u.onclose=()=>{o||a.write(`\r
388
- \x1B[90m[agent session ended]\x1B[0m\r
389
- `)};const c=typeof ResizeObserver<"u"?new ResizeObserver(()=>{try{l.fit()}catch{}}):void 0;return c==null||c.observe(s),()=>{o=!0,c==null||c.disconnect();try{u.close()}catch{}a.dispose()}},[t]),_.jsxs("div",{className:"flex flex-col rounded-xl overflow-hidden",style:{background:"#0d1117",border:"1px solid rgba(230,237,243,0.08)"},children:[_.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 shrink-0",style:{background:"#161c26",borderBottom:"1px solid rgba(230,237,243,0.06)"},children:[_.jsxs("span",{className:"text-[11px] font-mono font-semibold",style:{color:"rgba(230,237,243,0.5)"},children:[e," ",_.jsx("span",{style:{color:"rgba(230,237,243,0.3)",fontWeight:400},children:"· observer"})]}),_.jsx("button",{type:"button",onClick:r,"aria-label":`Close ${e} terminal`,className:"text-[13px] leading-none opacity-50 hover:opacity-100 transition-opacity",style:{background:"transparent",border:"none",color:"#e6edf3",cursor:"pointer"},children:"×"})]}),_.jsx("div",{ref:n,className:"h-56 w-full overflow-hidden p-1"})]})}function sM(t,e){const r={};return(t[t.length-1]===""?[...t,""]:t).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const oM=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,lM=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,uM={};function ab(t,e){return(uM.jsx?lM:oM).test(t)}const cM=/[ \t\n\f\r]/g;function hM(t){return typeof t=="object"?t.type==="text"?sb(t.value):!1:sb(t)}function sb(t){return t.replace(cM,"")===""}class Il{constructor(e,r,n){this.normal=r,this.property=e,n&&(this.space=n)}}Il.prototype.normal={};Il.prototype.property={};Il.prototype.space=void 0;function lS(t,e){const r={},n={};for(const i of t)Object.assign(r,i.property),Object.assign(n,i.normal);return new Il(r,n,e)}function Lv(t){return t.toLowerCase()}class un{constructor(e,r){this.attribute=r,this.property=e}}un.prototype.attribute="";un.prototype.booleanish=!1;un.prototype.boolean=!1;un.prototype.commaOrSpaceSeparated=!1;un.prototype.commaSeparated=!1;un.prototype.defined=!1;un.prototype.mustUseProperty=!1;un.prototype.number=!1;un.prototype.overloadedBoolean=!1;un.prototype.property="";un.prototype.spaceSeparated=!1;un.prototype.space=void 0;let fM=0;const yt=Ga(),dr=Ga(),Dv=Ga(),Ve=Ga(),Ut=Ga(),Ba=Ga(),gn=Ga();function Ga(){return 2**++fM}const Av=Object.freeze(Object.defineProperty({__proto__:null,boolean:yt,booleanish:dr,commaOrSpaceSeparated:gn,commaSeparated:Ba,number:Ve,overloadedBoolean:Dv,spaceSeparated:Ut},Symbol.toStringTag,{value:"Module"})),Up=Object.keys(Av);class mg extends un{constructor(e,r,n,i){let s=-1;if(super(e,r),ob(this,"space",i),typeof n=="number")for(;++s<Up.length;){const o=Up[s];ob(this,Up[s],(n&Av[o])===Av[o])}}}mg.prototype.defined=!0;function ob(t,e,r){r&&(t[e]=r)}function eo(t){const e={},r={};for(const[n,i]of Object.entries(t.properties)){const s=new mg(n,t.transform(t.attributes||{},n),i,t.space);t.mustUseProperty&&t.mustUseProperty.includes(n)&&(s.mustUseProperty=!0),e[n]=s,r[Lv(n)]=n,r[Lv(s.attribute)]=n}return new Il(e,r,t.space)}const uS=eo({properties:{ariaActiveDescendant:null,ariaAtomic:dr,ariaAutoComplete:null,ariaBusy:dr,ariaChecked:dr,ariaColCount:Ve,ariaColIndex:Ve,ariaColSpan:Ve,ariaControls:Ut,ariaCurrent:null,ariaDescribedBy:Ut,ariaDetails:null,ariaDisabled:dr,ariaDropEffect:Ut,ariaErrorMessage:null,ariaExpanded:dr,ariaFlowTo:Ut,ariaGrabbed:dr,ariaHasPopup:null,ariaHidden:dr,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Ut,ariaLevel:Ve,ariaLive:null,ariaModal:dr,ariaMultiLine:dr,ariaMultiSelectable:dr,ariaOrientation:null,ariaOwns:Ut,ariaPlaceholder:null,ariaPosInSet:Ve,ariaPressed:dr,ariaReadOnly:dr,ariaRelevant:null,ariaRequired:dr,ariaRoleDescription:Ut,ariaRowCount:Ve,ariaRowIndex:Ve,ariaRowSpan:Ve,ariaSelected:dr,ariaSetSize:Ve,ariaSort:null,ariaValueMax:Ve,ariaValueMin:Ve,ariaValueNow:Ve,ariaValueText:null,role:null},transform(t,e){return e==="role"?e:"aria-"+e.slice(4).toLowerCase()}});function cS(t,e){return e in t?t[e]:e}function hS(t,e){return cS(t,e.toLowerCase())}const dM=eo({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Ba,acceptCharset:Ut,accessKey:Ut,action:null,allow:null,allowFullScreen:yt,allowPaymentRequest:yt,allowUserMedia:yt,alpha:yt,alt:null,as:null,async:yt,autoCapitalize:null,autoComplete:Ut,autoFocus:yt,autoPlay:yt,blocking:Ut,capture:null,charSet:null,checked:yt,cite:null,className:Ut,closedBy:null,colorSpace:null,cols:Ve,colSpan:Ve,command:null,commandFor:null,content:null,contentEditable:dr,controls:yt,controlsList:Ut,coords:Ve|Ba,crossOrigin:null,data:null,dateTime:null,decoding:null,default:yt,defer:yt,dir:null,dirName:null,disabled:yt,download:Dv,draggable:dr,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:yt,formTarget:null,headers:Ut,height:Ve,hidden:Dv,high:Ve,href:null,hrefLang:null,htmlFor:Ut,httpEquiv:Ut,id:null,imageSizes:null,imageSrcSet:null,inert:yt,inputMode:null,integrity:null,is:null,isMap:yt,itemId:null,itemProp:Ut,itemRef:Ut,itemScope:yt,itemType:Ut,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:yt,low:Ve,manifest:null,max:null,maxLength:Ve,media:null,method:null,min:null,minLength:Ve,multiple:yt,muted:yt,name:null,nonce:null,noModule:yt,noValidate:yt,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:yt,optimum:Ve,pattern:null,ping:Ut,placeholder:null,playsInline:yt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:yt,referrerPolicy:null,rel:Ut,required:yt,reversed:yt,rows:Ve,rowSpan:Ve,sandbox:Ut,scope:null,scoped:yt,seamless:yt,selected:yt,shadowRootClonable:yt,shadowRootCustomElementRegistry:yt,shadowRootDelegatesFocus:yt,shadowRootMode:null,shadowRootSerializable:yt,shape:null,size:Ve,sizes:null,slot:null,span:Ve,spellCheck:dr,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Ve,step:null,style:null,tabIndex:Ve,target:null,title:null,translate:null,type:null,typeMustMatch:yt,useMap:null,value:dr,width:Ve,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Ut,axis:null,background:null,bgColor:null,border:Ve,borderColor:null,bottomMargin:Ve,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:yt,declare:yt,event:null,face:null,frame:null,frameBorder:null,hSpace:Ve,leftMargin:Ve,link:null,longDesc:null,lowSrc:null,marginHeight:Ve,marginWidth:Ve,noResize:yt,noHref:yt,noShade:yt,noWrap:yt,object:null,profile:null,prompt:null,rev:null,rightMargin:Ve,rules:null,scheme:null,scrolling:dr,standby:null,summary:null,text:null,topMargin:Ve,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Ve,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:yt,disablePictureInPicture:yt,disableRemotePlayback:yt,exportParts:Ba,part:Ut,prefix:null,property:null,results:Ve,security:null,unselectable:null},space:"html",transform:hS}),pM=eo({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",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",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",maskType:"mask-type",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",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",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",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",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:gn,accentHeight:Ve,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Ve,amplitude:Ve,arabicForm:null,ascent:Ve,attributeName:null,attributeType:null,azimuth:Ve,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Ve,by:null,calcMode:null,capHeight:Ve,className:Ut,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Ve,diffuseConstant:Ve,direction:null,display:null,dur:null,divisor:Ve,dominantBaseline:null,download:yt,dx:null,dy:null,edgeMode:null,editable:null,elevation:Ve,enableBackground:null,end:null,event:null,exponent:Ve,externalResourcesRequired:null,fill:null,fillOpacity:Ve,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Ba,g2:Ba,glyphName:Ba,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Ve,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Ve,horizOriginX:Ve,horizOriginY:Ve,id:null,ideographic:Ve,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Ve,k:Ve,k1:Ve,k2:Ve,k3:Ve,k4:Ve,kernelMatrix:gn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Ve,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Ve,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Ve,overlineThickness:Ve,paintOrder:null,panose1:null,path:null,pathLength:Ve,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Ut,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Ve,pointsAtY:Ve,pointsAtZ:Ve,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:gn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:gn,rev:gn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:gn,requiredFeatures:gn,requiredFonts:gn,requiredFormats:gn,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Ve,specularExponent:Ve,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Ve,strikethroughThickness:Ve,string:null,stroke:null,strokeDashArray:gn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Ve,strokeOpacity:Ve,strokeWidth:null,style:null,surfaceScale:Ve,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:gn,tabIndex:Ve,tableValues:null,target:null,targetX:Ve,targetY:Ve,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:gn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Ve,underlineThickness:Ve,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Ve,values:null,vAlphabetic:Ve,vMathematical:Ve,vectorEffect:null,vHanging:Ve,vIdeographic:Ve,version:null,vertAdvY:Ve,vertOriginX:Ve,vertOriginY:Ve,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Ve,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:cS}),fS=eo({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(t,e){return"xlink:"+e.slice(5).toLowerCase()}}),dS=eo({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:hS}),pS=eo({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(t,e){return"xml:"+e.slice(3).toLowerCase()}}),vM={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},gM=/[A-Z]/g,lb=/-[a-z]/g,mM=/^data[-\w.:]+$/i;function yM(t,e){const r=Lv(e);let n=e,i=un;if(r in t.normal)return t.property[t.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&mM.test(e)){if(e.charAt(4)==="-"){const s=e.slice(5).replace(lb,bM);n="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=e.slice(4);if(!lb.test(s)){let o=s.replace(gM,xM);o.charAt(0)!=="-"&&(o="-"+o),e="data"+o}}i=mg}return new i(n,e)}function xM(t){return"-"+t.toLowerCase()}function bM(t){return t.charAt(1).toUpperCase()}const wM=lS([uS,dM,fS,dS,pS],"html"),yg=lS([uS,pM,fS,dS,pS],"svg");function _M(t){return t.join(" ").trim()}var Rs={},Wp,ub;function SM(){if(ub)return Wp;ub=1;var t=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,e=/\n/g,r=/^\s*/,n=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,o=/^[;\s]*/,a=/^\s+|\s+$/g,l=`
390
- `,u="/",c="*",h="",v="comment",d="declaration";function x(g,m){if(typeof g!="string")throw new TypeError("First argument must be a string");if(!g)return[];m=m||{};var y=1,b=1;function S(D){var H=D.match(e);H&&(y+=H.length);var U=D.lastIndexOf(l);b=~U?D.length-U:b+D.length}function N(){var D={line:y,column:b};return function(H){return H.position=new E(D),L(),H}}function E(D){this.start=D,this.end={line:y,column:b},this.source=m.source}E.prototype.content=g;function T(D){var H=new Error(m.source+":"+y+":"+b+": "+D);if(H.reason=D,H.filename=m.source,H.line=y,H.column=b,H.source=g,!m.silent)throw H}function k(D){var H=D.exec(g);if(H){var U=H[0];return S(U),g=g.slice(U.length),H}}function L(){k(r)}function A(D){var H;for(D=D||[];H=I();)H!==!1&&D.push(H);return D}function I(){var D=N();if(!(u!=g.charAt(0)||c!=g.charAt(1))){for(var H=2;h!=g.charAt(H)&&(c!=g.charAt(H)||u!=g.charAt(H+1));)++H;if(H+=2,h===g.charAt(H-1))return T("End of comment missing");var U=g.slice(2,H-2);return b+=2,S(U),g=g.slice(H),b+=2,D({type:v,comment:U})}}function M(){var D=N(),H=k(n);if(H){if(I(),!k(i))return T("property missing ':'");var U=k(s),z=D({type:d,property:w(H[0].replace(t,h)),value:U?w(U[0].replace(t,h)):h});return k(o),z}}function B(){var D=[];A(D);for(var H;H=M();)H!==!1&&(D.push(H),A(D));return D}return L(),B()}function w(g){return g?g.replace(a,h):h}return Wp=x,Wp}var cb;function CM(){if(cb)return Rs;cb=1;var t=Rs&&Rs.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(Rs,"__esModule",{value:!0}),Rs.default=r;const e=t(SM());function r(n,i){let s=null;if(!n||typeof n!="string")return s;const o=(0,e.default)(n),a=typeof i=="function";return o.forEach(l=>{if(l.type!=="declaration")return;const{property:u,value:c}=l;a?i(u,c,l):c&&(s=s||{},s[u]=c)}),s}return Rs}var Ko={},hb;function EM(){if(hb)return Ko;hb=1,Object.defineProperty(Ko,"__esModule",{value:!0}),Ko.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,e=/-([a-z])/g,r=/^[^-]+$/,n=/^-(webkit|moz|ms|o|khtml)-/,i=/^-(ms)-/,s=function(u){return!u||r.test(u)||t.test(u)},o=function(u,c){return c.toUpperCase()},a=function(u,c){return"".concat(c,"-")},l=function(u,c){return c===void 0&&(c={}),s(u)?u:(u=u.toLowerCase(),c.reactCompat?u=u.replace(i,a):u=u.replace(n,a),u.replace(e,o))};return Ko.camelCase=l,Ko}var Qo,fb;function kM(){if(fb)return Qo;fb=1;var t=Qo&&Qo.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},e=t(CM()),r=EM();function n(i,s){var o={};return!i||typeof i!="string"||(0,e.default)(i,function(a,l){a&&l&&(o[(0,r.camelCase)(a,s)]=l)}),o}return n.default=n,Qo=n,Qo}var TM=kM();const NM=Vc(TM),vS=gS("end"),xg=gS("start");function gS(t){return e;function e(r){const n=r&&r.position&&r.position[t]||{};if(typeof n.line=="number"&&n.line>0&&typeof n.column=="number"&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset=="number"&&n.offset>-1?n.offset:void 0}}}function RM(t){const e=xg(t),r=vS(t);if(e&&r)return{start:e,end:r}}function ol(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?db(t.position):"start"in t||"end"in t?db(t):"line"in t||"column"in t?Mv(t):""}function Mv(t){return pb(t&&t.line)+":"+pb(t&&t.column)}function db(t){return Mv(t&&t.start)+"-"+Mv(t&&t.end)}function pb(t){return t&&typeof t=="number"?t:1}class Vr extends Error{constructor(e,r,n){super(),typeof r=="string"&&(n=r,r=void 0);let i="",s={},o=!1;if(r&&("line"in r&&"column"in r?s={place:r}:"start"in r&&"end"in r?s={place:r}:"type"in r?s={ancestors:[r],place:r.position}:s={...r}),typeof e=="string"?i=e:!s.cause&&e&&(o=!0,i=e.message,s.cause=e),!s.ruleId&&!s.source&&typeof n=="string"){const l=n.indexOf(":");l===-1?s.ruleId=n:(s.source=n.slice(0,l),s.ruleId=n.slice(l+1))}if(!s.place&&s.ancestors&&s.ancestors){const l=s.ancestors[s.ancestors.length-1];l&&(s.place=l.position)}const a=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=a?a.line:void 0,this.name=ol(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=o&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Vr.prototype.file="";Vr.prototype.name="";Vr.prototype.reason="";Vr.prototype.message="";Vr.prototype.stack="";Vr.prototype.column=void 0;Vr.prototype.line=void 0;Vr.prototype.ancestors=void 0;Vr.prototype.cause=void 0;Vr.prototype.fatal=void 0;Vr.prototype.place=void 0;Vr.prototype.ruleId=void 0;Vr.prototype.source=void 0;const bg={}.hasOwnProperty,LM=new Map,DM=/[A-Z]/g,AM=new Set(["table","tbody","thead","tfoot","tr"]),MM=new Set(["td","th"]),mS="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function PM(t,e){if(!e||e.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const r=e.filePath||void 0;let n;if(e.development){if(typeof e.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");n=UM(r,e.jsxDEV)}else{if(typeof e.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof e.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");n=HM(r,e.jsx,e.jsxs)}const i={Fragment:e.Fragment,ancestors:[],components:e.components||{},create:n,elementAttributeNameCase:e.elementAttributeNameCase||"react",evaluater:e.createEvaluater?e.createEvaluater():void 0,filePath:r,ignoreInvalidStyle:e.ignoreInvalidStyle||!1,passKeys:e.passKeys!==!1,passNode:e.passNode||!1,schema:e.space==="svg"?yg:wM,stylePropertyNameCase:e.stylePropertyNameCase||"dom",tableCellAlignToStyle:e.tableCellAlignToStyle!==!1},s=yS(i,t,void 0);return s&&typeof s!="string"?s:i.create(t,i.Fragment,{children:s||void 0},void 0)}function yS(t,e,r){if(e.type==="element")return IM(t,e,r);if(e.type==="mdxFlowExpression"||e.type==="mdxTextExpression")return OM(t,e);if(e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement")return jM(t,e,r);if(e.type==="mdxjsEsm")return BM(t,e);if(e.type==="root")return FM(t,e,r);if(e.type==="text")return zM(t,e)}function IM(t,e,r){const n=t.schema;let i=n;e.tagName.toLowerCase()==="svg"&&n.space==="html"&&(i=yg,t.schema=i),t.ancestors.push(e);const s=bS(t,e.tagName,!1),o=WM(t,e);let a=_g(t,e);return AM.has(e.tagName)&&(a=a.filter(function(l){return typeof l=="string"?!hM(l):!0})),xS(t,o,s,e),wg(o,a),t.ancestors.pop(),t.schema=n,t.create(e,s,o,r)}function OM(t,e){if(e.data&&e.data.estree&&t.evaluater){const n=e.data.estree.body[0];return n.type,t.evaluater.evaluateExpression(n.expression)}wl(t,e.position)}function BM(t,e){if(e.data&&e.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(e.data.estree);wl(t,e.position)}function jM(t,e,r){const n=t.schema;let i=n;e.name==="svg"&&n.space==="html"&&(i=yg,t.schema=i),t.ancestors.push(e);const s=e.name===null?t.Fragment:bS(t,e.name,!0),o=VM(t,e),a=_g(t,e);return xS(t,o,s,e),wg(o,a),t.ancestors.pop(),t.schema=n,t.create(e,s,o,r)}function FM(t,e,r){const n={};return wg(n,_g(t,e)),t.create(e,t.Fragment,n,r)}function zM(t,e){return e.value}function xS(t,e,r,n){typeof r!="string"&&r!==t.Fragment&&t.passNode&&(e.node=n)}function wg(t,e){if(e.length>0){const r=e.length>1?e:e[0];r&&(t.children=r)}}function HM(t,e,r){return n;function n(i,s,o,a){const u=Array.isArray(o.children)?r:e;return a?u(s,o,a):u(s,o)}}function UM(t,e){return r;function r(n,i,s,o){const a=Array.isArray(s.children),l=xg(n);return e(i,s,o,a,{columnNumber:l?l.column-1:void 0,fileName:t,lineNumber:l?l.line:void 0},void 0)}}function WM(t,e){const r={};let n,i;for(i in e.properties)if(i!=="children"&&bg.call(e.properties,i)){const s=$M(t,i,e.properties[i]);if(s){const[o,a]=s;t.tableCellAlignToStyle&&o==="align"&&typeof a=="string"&&MM.has(e.tagName)?n=a:r[o]=a}}if(n){const s=r.style||(r.style={});s[t.stylePropertyNameCase==="css"?"text-align":"textAlign"]=n}return r}function VM(t,e){const r={};for(const n of e.attributes)if(n.type==="mdxJsxExpressionAttribute")if(n.data&&n.data.estree&&t.evaluater){const s=n.data.estree.body[0];s.type;const o=s.expression;o.type;const a=o.properties[0];a.type,Object.assign(r,t.evaluater.evaluateExpression(a.argument))}else wl(t,e.position);else{const i=n.name;let s;if(n.value&&typeof n.value=="object")if(n.value.data&&n.value.data.estree&&t.evaluater){const a=n.value.data.estree.body[0];a.type,s=t.evaluater.evaluateExpression(a.expression)}else wl(t,e.position);else s=n.value===null?!0:n.value;r[i]=s}return r}function _g(t,e){const r=[];let n=-1;const i=t.passKeys?new Map:LM;for(;++n<e.children.length;){const s=e.children[n];let o;if(t.passKeys){const l=s.type==="element"?s.tagName:s.type==="mdxJsxFlowElement"||s.type==="mdxJsxTextElement"?s.name:void 0;if(l){const u=i.get(l)||0;o=l+"-"+u,i.set(l,u+1)}}const a=yS(t,s,o);a!==void 0&&r.push(a)}return r}function $M(t,e,r){const n=yM(t.schema,e);if(!(r==null||typeof r=="number"&&Number.isNaN(r))){if(Array.isArray(r)&&(r=n.commaSeparated?sM(r):_M(r)),n.property==="style"){let i=typeof r=="object"?r:GM(t,String(r));return t.stylePropertyNameCase==="css"&&(i=qM(i)),["style",i]}return[t.elementAttributeNameCase==="react"&&n.space?vM[n.property]||n.property:n.attribute,r]}}function GM(t,e){try{return NM(e,{reactCompat:!0})}catch(r){if(t.ignoreInvalidStyle)return{};const n=r,i=new Vr("Cannot parse `style` attribute",{ancestors:t.ancestors,cause:n,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw i.file=t.filePath||void 0,i.url=mS+"#cannot-parse-style-attribute",i}}function bS(t,e,r){let n;if(!r)n={type:"Literal",value:e};else if(e.includes(".")){const i=e.split(".");let s=-1,o;for(;++s<i.length;){const a=ab(i[s])?{type:"Identifier",name:i[s]}:{type:"Literal",value:i[s]};o=o?{type:"MemberExpression",object:o,property:a,computed:!!(s&&a.type==="Literal"),optional:!1}:a}n=o}else n=ab(e)&&!/^[a-z]/.test(e)?{type:"Identifier",name:e}:{type:"Literal",value:e};if(n.type==="Literal"){const i=n.value;return bg.call(t.components,i)?t.components[i]:i}if(t.evaluater)return t.evaluater.evaluateExpression(n);wl(t)}function wl(t,e){const r=new Vr("Cannot handle MDX estrees without `createEvaluater`",{ancestors:t.ancestors,place:e,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw r.file=t.filePath||void 0,r.url=mS+"#cannot-handle-mdx-estrees-without-createevaluater",r}function qM(t){const e={};let r;for(r in t)bg.call(t,r)&&(e[YM(r)]=t[r]);return e}function YM(t){let e=t.replace(DM,XM);return e.slice(0,3)==="ms-"&&(e="-"+e),e}function XM(t){return"-"+t.toLowerCase()}const Vp={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},KM={};function Sg(t,e){const r=KM,n=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,i=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return wS(t,n,i)}function wS(t,e,r){if(QM(t)){if("value"in t)return t.type==="html"&&!r?"":t.value;if(e&&"alt"in t&&t.alt)return t.alt;if("children"in t)return vb(t.children,e,r)}return Array.isArray(t)?vb(t,e,r):""}function vb(t,e,r){const n=[];let i=-1;for(;++i<t.length;)n[i]=wS(t[i],e,r);return n.join("")}function QM(t){return!!(t&&typeof t=="object")}const gb=document.createElement("i");function Cg(t){const e="&"+t+";";gb.innerHTML=e;const r=gb.textContent;return r.charCodeAt(r.length-1)===59&&t!=="semi"||r===e?!1:r}function xn(t,e,r,n){const i=t.length;let s=0,o;if(e<0?e=-e>i?0:i+e:e=e>i?i:e,r=r>0?r:0,n.length<1e4)o=Array.from(n),o.unshift(e,r),t.splice(...o);else for(r&&t.splice(e,r);s<n.length;)o=n.slice(s,s+1e4),o.unshift(e,0),t.splice(...o),s+=1e4,e+=1e4}function Rn(t,e){return t.length>0?(xn(t,t.length,0,e),t):e}const mb={}.hasOwnProperty;function _S(t){const e={};let r=-1;for(;++r<t.length;)ZM(e,t[r]);return e}function ZM(t,e){let r;for(r in e){const i=(mb.call(t,r)?t[r]:void 0)||(t[r]={}),s=e[r];let o;if(s)for(o in s){mb.call(i,o)||(i[o]=[]);const a=s[o];JM(i[o],Array.isArray(a)?a:a?[a]:[])}}}function JM(t,e){let r=-1;const n=[];for(;++r<e.length;)(e[r].add==="after"?t:n).push(e[r]);xn(t,0,0,n)}function SS(t,e){const r=Number.parseInt(t,e);return r<9||r===11||r>13&&r<32||r>126&&r<160||r>55295&&r<57344||r>64975&&r<65008||(r&65535)===65535||(r&65535)===65534||r>1114111?"�":String.fromCodePoint(r)}function Hn(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Kr=ca(/[A-Za-z]/),zr=ca(/[\dA-Za-z]/),e5=ca(/[#-'*+\--9=?A-Z^-~]/);function zc(t){return t!==null&&(t<32||t===127)}const Pv=ca(/\d/),t5=ca(/[\dA-Fa-f]/),r5=ca(/[!-/:-@[-`{-~]/);function dt(t){return t!==null&&t<-2}function Vt(t){return t!==null&&(t<0||t===32)}function Et(t){return t===-2||t===-1||t===32}const uh=ca(new RegExp("\\p{P}|\\p{S}","u")),Wa=ca(/\s/);function ca(t){return e;function e(r){return r!==null&&r>-1&&t.test(String.fromCharCode(r))}}function to(t){const e=[];let r=-1,n=0,i=0;for(;++r<t.length;){const s=t.charCodeAt(r);let o="";if(s===37&&zr(t.charCodeAt(r+1))&&zr(t.charCodeAt(r+2)))i=2;else if(s<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(s))||(o=String.fromCharCode(s));else if(s>55295&&s<57344){const a=t.charCodeAt(r+1);s<56320&&a>56319&&a<57344?(o=String.fromCharCode(s,a),i=1):o="�"}else o=String.fromCharCode(s);o&&(e.push(t.slice(n,r),encodeURIComponent(o)),n=r+i+1,o=""),i&&(r+=i,i=0)}return e.join("")+t.slice(n)}function Nt(t,e,r,n){const i=n?n-1:Number.POSITIVE_INFINITY;let s=0;return o;function o(l){return Et(l)?(t.enter(r),a(l)):e(l)}function a(l){return Et(l)&&s++<i?(t.consume(l),a):(t.exit(r),e(l))}}const n5={tokenize:i5};function i5(t){const e=t.attempt(this.parser.constructs.contentInitial,n,i);let r;return e;function n(a){if(a===null){t.consume(a);return}return t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),Nt(t,e,"linePrefix")}function i(a){return t.enter("paragraph"),s(a)}function s(a){const l=t.enter("chunkText",{contentType:"text",previous:r});return r&&(r.next=l),r=l,o(a)}function o(a){if(a===null){t.exit("chunkText"),t.exit("paragraph"),t.consume(a);return}return dt(a)?(t.consume(a),t.exit("chunkText"),s):(t.consume(a),o)}}const a5={tokenize:s5},yb={tokenize:o5};function s5(t){const e=this,r=[];let n=0,i,s,o;return a;function a(b){if(n<r.length){const S=r[n];return e.containerState=S[1],t.attempt(S[0].continuation,l,u)(b)}return u(b)}function l(b){if(n++,e.containerState._closeFlow){e.containerState._closeFlow=void 0,i&&y();const S=e.events.length;let N=S,E;for(;N--;)if(e.events[N][0]==="exit"&&e.events[N][1].type==="chunkFlow"){E=e.events[N][1].end;break}m(n);let T=S;for(;T<e.events.length;)e.events[T][1].end={...E},T++;return xn(e.events,N+1,0,e.events.slice(S)),e.events.length=T,u(b)}return a(b)}function u(b){if(n===r.length){if(!i)return v(b);if(i.currentConstruct&&i.currentConstruct.concrete)return x(b);e.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return e.containerState={},t.check(yb,c,h)(b)}function c(b){return i&&y(),m(n),v(b)}function h(b){return e.parser.lazy[e.now().line]=n!==r.length,o=e.now().offset,x(b)}function v(b){return e.containerState={},t.attempt(yb,d,x)(b)}function d(b){return n++,r.push([e.currentConstruct,e.containerState]),v(b)}function x(b){if(b===null){i&&y(),m(0),t.consume(b);return}return i=i||e.parser.flow(e.now()),t.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:s}),w(b)}function w(b){if(b===null){g(t.exit("chunkFlow"),!0),m(0),t.consume(b);return}return dt(b)?(t.consume(b),g(t.exit("chunkFlow")),n=0,e.interrupt=void 0,a):(t.consume(b),w)}function g(b,S){const N=e.sliceStream(b);if(S&&N.push(null),b.previous=s,s&&(s.next=b),s=b,i.defineSkip(b.start),i.write(N),e.parser.lazy[b.start.line]){let E=i.events.length;for(;E--;)if(i.events[E][1].start.offset<o&&(!i.events[E][1].end||i.events[E][1].end.offset>o))return;const T=e.events.length;let k=T,L,A;for(;k--;)if(e.events[k][0]==="exit"&&e.events[k][1].type==="chunkFlow"){if(L){A=e.events[k][1].end;break}L=!0}for(m(n),E=T;E<e.events.length;)e.events[E][1].end={...A},E++;xn(e.events,k+1,0,e.events.slice(T)),e.events.length=E}}function m(b){let S=r.length;for(;S-- >b;){const N=r[S];e.containerState=N[1],N[0].exit.call(e,t)}r.length=b}function y(){i.write([null]),s=void 0,i=void 0,e.containerState._closeFlow=void 0}}function o5(t,e,r){return Nt(t,t.attempt(this.parser.constructs.document,e,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Gs(t){if(t===null||Vt(t)||Wa(t))return 1;if(uh(t))return 2}function ch(t,e,r){const n=[];let i=-1;for(;++i<t.length;){const s=t[i].resolveAll;s&&!n.includes(s)&&(e=s(e,r),n.push(s))}return e}const Iv={name:"attention",resolveAll:l5,tokenize:u5};function l5(t,e){let r=-1,n,i,s,o,a,l,u,c;for(;++r<t.length;)if(t[r][0]==="enter"&&t[r][1].type==="attentionSequence"&&t[r][1]._close){for(n=r;n--;)if(t[n][0]==="exit"&&t[n][1].type==="attentionSequence"&&t[n][1]._open&&e.sliceSerialize(t[n][1]).charCodeAt(0)===e.sliceSerialize(t[r][1]).charCodeAt(0)){if((t[n][1]._close||t[r][1]._open)&&(t[r][1].end.offset-t[r][1].start.offset)%3&&!((t[n][1].end.offset-t[n][1].start.offset+t[r][1].end.offset-t[r][1].start.offset)%3))continue;l=t[n][1].end.offset-t[n][1].start.offset>1&&t[r][1].end.offset-t[r][1].start.offset>1?2:1;const h={...t[n][1].end},v={...t[r][1].start};xb(h,-l),xb(v,l),o={type:l>1?"strongSequence":"emphasisSequence",start:h,end:{...t[n][1].end}},a={type:l>1?"strongSequence":"emphasisSequence",start:{...t[r][1].start},end:v},s={type:l>1?"strongText":"emphasisText",start:{...t[n][1].end},end:{...t[r][1].start}},i={type:l>1?"strong":"emphasis",start:{...o.start},end:{...a.end}},t[n][1].end={...o.start},t[r][1].start={...a.end},u=[],t[n][1].end.offset-t[n][1].start.offset&&(u=Rn(u,[["enter",t[n][1],e],["exit",t[n][1],e]])),u=Rn(u,[["enter",i,e],["enter",o,e],["exit",o,e],["enter",s,e]]),u=Rn(u,ch(e.parser.constructs.insideSpan.null,t.slice(n+1,r),e)),u=Rn(u,[["exit",s,e],["enter",a,e],["exit",a,e],["exit",i,e]]),t[r][1].end.offset-t[r][1].start.offset?(c=2,u=Rn(u,[["enter",t[r][1],e],["exit",t[r][1],e]])):c=0,xn(t,n-1,r-n+3,u),r=n+u.length-c-2;break}}for(r=-1;++r<t.length;)t[r][1].type==="attentionSequence"&&(t[r][1].type="data");return t}function u5(t,e){const r=this.parser.constructs.attentionMarkers.null,n=this.previous,i=Gs(n);let s;return o;function o(l){return s=l,t.enter("attentionSequence"),a(l)}function a(l){if(l===s)return t.consume(l),a;const u=t.exit("attentionSequence"),c=Gs(l),h=!c||c===2&&i||r.includes(l),v=!i||i===2&&c||r.includes(n);return u._open=!!(s===42?h:h&&(i||!v)),u._close=!!(s===42?v:v&&(c||!h)),e(l)}}function xb(t,e){t.column+=e,t.offset+=e,t._bufferIndex+=e}const c5={name:"autolink",tokenize:h5};function h5(t,e,r){let n=0;return i;function i(d){return t.enter("autolink"),t.enter("autolinkMarker"),t.consume(d),t.exit("autolinkMarker"),t.enter("autolinkProtocol"),s}function s(d){return Kr(d)?(t.consume(d),o):d===64?r(d):u(d)}function o(d){return d===43||d===45||d===46||zr(d)?(n=1,a(d)):u(d)}function a(d){return d===58?(t.consume(d),n=0,l):(d===43||d===45||d===46||zr(d))&&n++<32?(t.consume(d),a):(n=0,u(d))}function l(d){return d===62?(t.exit("autolinkProtocol"),t.enter("autolinkMarker"),t.consume(d),t.exit("autolinkMarker"),t.exit("autolink"),e):d===null||d===32||d===60||zc(d)?r(d):(t.consume(d),l)}function u(d){return d===64?(t.consume(d),c):e5(d)?(t.consume(d),u):r(d)}function c(d){return zr(d)?h(d):r(d)}function h(d){return d===46?(t.consume(d),n=0,c):d===62?(t.exit("autolinkProtocol").type="autolinkEmail",t.enter("autolinkMarker"),t.consume(d),t.exit("autolinkMarker"),t.exit("autolink"),e):v(d)}function v(d){if((d===45||zr(d))&&n++<63){const x=d===45?v:h;return t.consume(d),x}return r(d)}}const Ol={partial:!0,tokenize:f5};function f5(t,e,r){return n;function n(s){return Et(s)?Nt(t,i,"linePrefix")(s):i(s)}function i(s){return s===null||dt(s)?e(s):r(s)}}const CS={continuation:{tokenize:p5},exit:v5,name:"blockQuote",tokenize:d5};function d5(t,e,r){const n=this;return i;function i(o){if(o===62){const a=n.containerState;return a.open||(t.enter("blockQuote",{_container:!0}),a.open=!0),t.enter("blockQuotePrefix"),t.enter("blockQuoteMarker"),t.consume(o),t.exit("blockQuoteMarker"),s}return r(o)}function s(o){return Et(o)?(t.enter("blockQuotePrefixWhitespace"),t.consume(o),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),e):(t.exit("blockQuotePrefix"),e(o))}}function p5(t,e,r){const n=this;return i;function i(o){return Et(o)?Nt(t,s,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):s(o)}function s(o){return t.attempt(CS,e,r)(o)}}function v5(t){t.exit("blockQuote")}const ES={name:"characterEscape",tokenize:g5};function g5(t,e,r){return n;function n(s){return t.enter("characterEscape"),t.enter("escapeMarker"),t.consume(s),t.exit("escapeMarker"),i}function i(s){return r5(s)?(t.enter("characterEscapeValue"),t.consume(s),t.exit("characterEscapeValue"),t.exit("characterEscape"),e):r(s)}}const kS={name:"characterReference",tokenize:m5};function m5(t,e,r){const n=this;let i=0,s,o;return a;function a(h){return t.enter("characterReference"),t.enter("characterReferenceMarker"),t.consume(h),t.exit("characterReferenceMarker"),l}function l(h){return h===35?(t.enter("characterReferenceMarkerNumeric"),t.consume(h),t.exit("characterReferenceMarkerNumeric"),u):(t.enter("characterReferenceValue"),s=31,o=zr,c(h))}function u(h){return h===88||h===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(h),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),s=6,o=t5,c):(t.enter("characterReferenceValue"),s=7,o=Pv,c(h))}function c(h){if(h===59&&i){const v=t.exit("characterReferenceValue");return o===zr&&!Cg(n.sliceSerialize(v))?r(h):(t.enter("characterReferenceMarker"),t.consume(h),t.exit("characterReferenceMarker"),t.exit("characterReference"),e)}return o(h)&&i++<s?(t.consume(h),c):r(h)}}const bb={partial:!0,tokenize:x5},wb={concrete:!0,name:"codeFenced",tokenize:y5};function y5(t,e,r){const n=this,i={partial:!0,tokenize:N};let s=0,o=0,a;return l;function l(E){return u(E)}function u(E){const T=n.events[n.events.length-1];return s=T&&T[1].type==="linePrefix"?T[2].sliceSerialize(T[1],!0).length:0,a=E,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),c(E)}function c(E){return E===a?(o++,t.consume(E),c):o<3?r(E):(t.exit("codeFencedFenceSequence"),Et(E)?Nt(t,h,"whitespace")(E):h(E))}function h(E){return E===null||dt(E)?(t.exit("codeFencedFence"),n.interrupt?e(E):t.check(bb,w,S)(E)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),v(E))}function v(E){return E===null||dt(E)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),h(E)):Et(E)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),Nt(t,d,"whitespace")(E)):E===96&&E===a?r(E):(t.consume(E),v)}function d(E){return E===null||dt(E)?h(E):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),x(E))}function x(E){return E===null||dt(E)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),h(E)):E===96&&E===a?r(E):(t.consume(E),x)}function w(E){return t.attempt(i,S,g)(E)}function g(E){return t.enter("lineEnding"),t.consume(E),t.exit("lineEnding"),m}function m(E){return s>0&&Et(E)?Nt(t,y,"linePrefix",s+1)(E):y(E)}function y(E){return E===null||dt(E)?t.check(bb,w,S)(E):(t.enter("codeFlowValue"),b(E))}function b(E){return E===null||dt(E)?(t.exit("codeFlowValue"),y(E)):(t.consume(E),b)}function S(E){return t.exit("codeFenced"),e(E)}function N(E,T,k){let L=0;return A;function A(H){return E.enter("lineEnding"),E.consume(H),E.exit("lineEnding"),I}function I(H){return E.enter("codeFencedFence"),Et(H)?Nt(E,M,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(H):M(H)}function M(H){return H===a?(E.enter("codeFencedFenceSequence"),B(H)):k(H)}function B(H){return H===a?(L++,E.consume(H),B):L>=o?(E.exit("codeFencedFenceSequence"),Et(H)?Nt(E,D,"whitespace")(H):D(H)):k(H)}function D(H){return H===null||dt(H)?(E.exit("codeFencedFence"),T(H)):k(H)}}}function x5(t,e,r){const n=this;return i;function i(o){return o===null?r(o):(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),s)}function s(o){return n.parser.lazy[n.now().line]?r(o):e(o)}}const $p={name:"codeIndented",tokenize:w5},b5={partial:!0,tokenize:_5};function w5(t,e,r){const n=this;return i;function i(u){return t.enter("codeIndented"),Nt(t,s,"linePrefix",5)(u)}function s(u){const c=n.events[n.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?o(u):r(u)}function o(u){return u===null?l(u):dt(u)?t.attempt(b5,o,l)(u):(t.enter("codeFlowValue"),a(u))}function a(u){return u===null||dt(u)?(t.exit("codeFlowValue"),o(u)):(t.consume(u),a)}function l(u){return t.exit("codeIndented"),e(u)}}function _5(t,e,r){const n=this;return i;function i(o){return n.parser.lazy[n.now().line]?r(o):dt(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),i):Nt(t,s,"linePrefix",5)(o)}function s(o){const a=n.events[n.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?e(o):dt(o)?i(o):r(o)}}const S5={name:"codeText",previous:E5,resolve:C5,tokenize:k5};function C5(t){let e=t.length-4,r=3,n,i;if((t[r][1].type==="lineEnding"||t[r][1].type==="space")&&(t[e][1].type==="lineEnding"||t[e][1].type==="space")){for(n=r;++n<e;)if(t[n][1].type==="codeTextData"){t[r][1].type="codeTextPadding",t[e][1].type="codeTextPadding",r+=2,e-=2;break}}for(n=r-1,e++;++n<=e;)i===void 0?n!==e&&t[n][1].type!=="lineEnding"&&(i=n):(n===e||t[n][1].type==="lineEnding")&&(t[i][1].type="codeTextData",n!==i+2&&(t[i][1].end=t[n-1][1].end,t.splice(i+2,n-i-2),e-=n-i-2,n=i+2),i=void 0);return t}function E5(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function k5(t,e,r){let n=0,i,s;return o;function o(h){return t.enter("codeText"),t.enter("codeTextSequence"),a(h)}function a(h){return h===96?(t.consume(h),n++,a):(t.exit("codeTextSequence"),l(h))}function l(h){return h===null?r(h):h===32?(t.enter("space"),t.consume(h),t.exit("space"),l):h===96?(s=t.enter("codeTextSequence"),i=0,c(h)):dt(h)?(t.enter("lineEnding"),t.consume(h),t.exit("lineEnding"),l):(t.enter("codeTextData"),u(h))}function u(h){return h===null||h===32||h===96||dt(h)?(t.exit("codeTextData"),l(h)):(t.consume(h),u)}function c(h){return h===96?(t.consume(h),i++,c):i===n?(t.exit("codeTextSequence"),t.exit("codeText"),e(h)):(s.type="codeTextData",u(h))}}class T5{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,r){const n=r??Number.POSITIVE_INFINITY;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,r,n){const i=r||0;this.setCursor(Math.trunc(e));const s=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return n&&Zo(this.left,n),s.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),Zo(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),Zo(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){const r=this.left.splice(e,Number.POSITIVE_INFINITY);Zo(this.right,r.reverse())}else{const r=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);Zo(this.left,r.reverse())}}}function Zo(t,e){let r=0;if(e.length<1e4)t.push(...e);else for(;r<e.length;)t.push(...e.slice(r,r+1e4)),r+=1e4}function TS(t){const e={};let r=-1,n,i,s,o,a,l,u;const c=new T5(t);for(;++r<c.length;){for(;r in e;)r=e[r];if(n=c.get(r),r&&n[1].type==="chunkFlow"&&c.get(r-1)[1].type==="listItemPrefix"&&(l=n[1]._tokenizer.events,s=0,s<l.length&&l[s][1].type==="lineEndingBlank"&&(s+=2),s<l.length&&l[s][1].type==="content"))for(;++s<l.length&&l[s][1].type!=="content";)l[s][1].type==="chunkText"&&(l[s][1]._isInFirstContentOfListItem=!0,s++);if(n[0]==="enter")n[1].contentType&&(Object.assign(e,N5(c,r)),r=e[r],u=!0);else if(n[1]._container){for(s=r,i=void 0;s--;)if(o=c.get(s),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(i&&(c.get(i)[1].type="lineEndingBlank"),o[1].type="lineEnding",i=s);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;i&&(n[1].end={...c.get(i)[1].start},a=c.slice(i,r),a.unshift(n),c.splice(i,r-i+1,a))}}return xn(t,0,Number.POSITIVE_INFINITY,c.slice(0)),!u}function N5(t,e){const r=t.get(e)[1],n=t.get(e)[2];let i=e-1;const s=[];let o=r._tokenizer;o||(o=n.parser[r.contentType](r.start),r._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const a=o.events,l=[],u={};let c,h,v=-1,d=r,x=0,w=0;const g=[w];for(;d;){for(;t.get(++i)[1]!==d;);s.push(i),d._tokenizer||(c=n.sliceStream(d),d.next||c.push(null),h&&o.defineSkip(d.start),d._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(c),d._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),h=d,d=d.next}for(d=r;++v<a.length;)a[v][0]==="exit"&&a[v-1][0]==="enter"&&a[v][1].type===a[v-1][1].type&&a[v][1].start.line!==a[v][1].end.line&&(w=v+1,g.push(w),d._tokenizer=void 0,d.previous=void 0,d=d.next);for(o.events=[],d?(d._tokenizer=void 0,d.previous=void 0):g.pop(),v=g.length;v--;){const m=a.slice(g[v],g[v+1]),y=s.pop();l.push([y,y+m.length-1]),t.splice(y,2,m)}for(l.reverse(),v=-1;++v<l.length;)u[x+l[v][0]]=x+l[v][1],x+=l[v][1]-l[v][0]-1;return u}const R5={resolve:D5,tokenize:A5},L5={partial:!0,tokenize:M5};function D5(t){return TS(t),t}function A5(t,e){let r;return n;function n(a){return t.enter("content"),r=t.enter("chunkContent",{contentType:"content"}),i(a)}function i(a){return a===null?s(a):dt(a)?t.check(L5,o,s)(a):(t.consume(a),i)}function s(a){return t.exit("chunkContent"),t.exit("content"),e(a)}function o(a){return t.consume(a),t.exit("chunkContent"),r.next=t.enter("chunkContent",{contentType:"content",previous:r}),r=r.next,i}}function M5(t,e,r){const n=this;return i;function i(o){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),Nt(t,s,"linePrefix")}function s(o){if(o===null||dt(o))return r(o);const a=n.events[n.events.length-1];return!n.parser.constructs.disable.null.includes("codeIndented")&&a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?e(o):t.interrupt(n.parser.constructs.flow,r,e)(o)}}function NS(t,e,r,n,i,s,o,a,l){const u=l||Number.POSITIVE_INFINITY;let c=0;return h;function h(m){return m===60?(t.enter(n),t.enter(i),t.enter(s),t.consume(m),t.exit(s),v):m===null||m===32||m===41||zc(m)?r(m):(t.enter(n),t.enter(o),t.enter(a),t.enter("chunkString",{contentType:"string"}),w(m))}function v(m){return m===62?(t.enter(s),t.consume(m),t.exit(s),t.exit(i),t.exit(n),e):(t.enter(a),t.enter("chunkString",{contentType:"string"}),d(m))}function d(m){return m===62?(t.exit("chunkString"),t.exit(a),v(m)):m===null||m===60||dt(m)?r(m):(t.consume(m),m===92?x:d)}function x(m){return m===60||m===62||m===92?(t.consume(m),d):d(m)}function w(m){return!c&&(m===null||m===41||Vt(m))?(t.exit("chunkString"),t.exit(a),t.exit(o),t.exit(n),e(m)):c<u&&m===40?(t.consume(m),c++,w):m===41?(t.consume(m),c--,w):m===null||m===32||m===40||zc(m)?r(m):(t.consume(m),m===92?g:w)}function g(m){return m===40||m===41||m===92?(t.consume(m),w):w(m)}}function RS(t,e,r,n,i,s){const o=this;let a=0,l;return u;function u(d){return t.enter(n),t.enter(i),t.consume(d),t.exit(i),t.enter(s),c}function c(d){return a>999||d===null||d===91||d===93&&!l||d===94&&!a&&"_hiddenFootnoteSupport"in o.parser.constructs?r(d):d===93?(t.exit(s),t.enter(i),t.consume(d),t.exit(i),t.exit(n),e):dt(d)?(t.enter("lineEnding"),t.consume(d),t.exit("lineEnding"),c):(t.enter("chunkString",{contentType:"string"}),h(d))}function h(d){return d===null||d===91||d===93||dt(d)||a++>999?(t.exit("chunkString"),c(d)):(t.consume(d),l||(l=!Et(d)),d===92?v:h)}function v(d){return d===91||d===92||d===93?(t.consume(d),a++,h):h(d)}}function LS(t,e,r,n,i,s){let o;return a;function a(v){return v===34||v===39||v===40?(t.enter(n),t.enter(i),t.consume(v),t.exit(i),o=v===40?41:v,l):r(v)}function l(v){return v===o?(t.enter(i),t.consume(v),t.exit(i),t.exit(n),e):(t.enter(s),u(v))}function u(v){return v===o?(t.exit(s),l(o)):v===null?r(v):dt(v)?(t.enter("lineEnding"),t.consume(v),t.exit("lineEnding"),Nt(t,u,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),c(v))}function c(v){return v===o||v===null||dt(v)?(t.exit("chunkString"),u(v)):(t.consume(v),v===92?h:c)}function h(v){return v===o||v===92?(t.consume(v),c):c(v)}}function ll(t,e){let r;return n;function n(i){return dt(i)?(t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),r=!0,n):Et(i)?Nt(t,n,r?"linePrefix":"lineSuffix")(i):e(i)}}const P5={name:"definition",tokenize:O5},I5={partial:!0,tokenize:B5};function O5(t,e,r){const n=this;let i;return s;function s(d){return t.enter("definition"),o(d)}function o(d){return RS.call(n,t,a,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(d)}function a(d){return i=Hn(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)),d===58?(t.enter("definitionMarker"),t.consume(d),t.exit("definitionMarker"),l):r(d)}function l(d){return Vt(d)?ll(t,u)(d):u(d)}function u(d){return NS(t,c,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(d)}function c(d){return t.attempt(I5,h,h)(d)}function h(d){return Et(d)?Nt(t,v,"whitespace")(d):v(d)}function v(d){return d===null||dt(d)?(t.exit("definition"),n.parser.defined.push(i),e(d)):r(d)}}function B5(t,e,r){return n;function n(a){return Vt(a)?ll(t,i)(a):r(a)}function i(a){return LS(t,s,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function s(a){return Et(a)?Nt(t,o,"whitespace")(a):o(a)}function o(a){return a===null||dt(a)?e(a):r(a)}}const j5={name:"hardBreakEscape",tokenize:F5};function F5(t,e,r){return n;function n(s){return t.enter("hardBreakEscape"),t.consume(s),i}function i(s){return dt(s)?(t.exit("hardBreakEscape"),e(s)):r(s)}}const z5={name:"headingAtx",resolve:H5,tokenize:U5};function H5(t,e){let r=t.length-2,n=3,i,s;return t[n][1].type==="whitespace"&&(n+=2),r-2>n&&t[r][1].type==="whitespace"&&(r-=2),t[r][1].type==="atxHeadingSequence"&&(n===r-1||r-4>n&&t[r-2][1].type==="whitespace")&&(r-=n+1===r?2:4),r>n&&(i={type:"atxHeadingText",start:t[n][1].start,end:t[r][1].end},s={type:"chunkText",start:t[n][1].start,end:t[r][1].end,contentType:"text"},xn(t,n,r-n+1,[["enter",i,e],["enter",s,e],["exit",s,e],["exit",i,e]])),t}function U5(t,e,r){let n=0;return i;function i(c){return t.enter("atxHeading"),s(c)}function s(c){return t.enter("atxHeadingSequence"),o(c)}function o(c){return c===35&&n++<6?(t.consume(c),o):c===null||Vt(c)?(t.exit("atxHeadingSequence"),a(c)):r(c)}function a(c){return c===35?(t.enter("atxHeadingSequence"),l(c)):c===null||dt(c)?(t.exit("atxHeading"),e(c)):Et(c)?Nt(t,a,"whitespace")(c):(t.enter("atxHeadingText"),u(c))}function l(c){return c===35?(t.consume(c),l):(t.exit("atxHeadingSequence"),a(c))}function u(c){return c===null||c===35||Vt(c)?(t.exit("atxHeadingText"),a(c)):(t.consume(c),u)}}const W5=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],_b=["pre","script","style","textarea"],V5={concrete:!0,name:"htmlFlow",resolveTo:q5,tokenize:Y5},$5={partial:!0,tokenize:K5},G5={partial:!0,tokenize:X5};function q5(t){let e=t.length;for(;e--&&!(t[e][0]==="enter"&&t[e][1].type==="htmlFlow"););return e>1&&t[e-2][1].type==="linePrefix"&&(t[e][1].start=t[e-2][1].start,t[e+1][1].start=t[e-2][1].start,t.splice(e-2,2)),t}function Y5(t,e,r){const n=this;let i,s,o,a,l;return u;function u($){return c($)}function c($){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume($),h}function h($){return $===33?(t.consume($),v):$===47?(t.consume($),s=!0,w):$===63?(t.consume($),i=3,n.interrupt?e:P):Kr($)?(t.consume($),o=String.fromCharCode($),g):r($)}function v($){return $===45?(t.consume($),i=2,d):$===91?(t.consume($),i=5,a=0,x):Kr($)?(t.consume($),i=4,n.interrupt?e:P):r($)}function d($){return $===45?(t.consume($),n.interrupt?e:P):r($)}function x($){const ee="CDATA[";return $===ee.charCodeAt(a++)?(t.consume($),a===ee.length?n.interrupt?e:M:x):r($)}function w($){return Kr($)?(t.consume($),o=String.fromCharCode($),g):r($)}function g($){if($===null||$===47||$===62||Vt($)){const ee=$===47,ae=o.toLowerCase();return!ee&&!s&&_b.includes(ae)?(i=1,n.interrupt?e($):M($)):W5.includes(o.toLowerCase())?(i=6,ee?(t.consume($),m):n.interrupt?e($):M($)):(i=7,n.interrupt&&!n.parser.lazy[n.now().line]?r($):s?y($):b($))}return $===45||zr($)?(t.consume($),o+=String.fromCharCode($),g):r($)}function m($){return $===62?(t.consume($),n.interrupt?e:M):r($)}function y($){return Et($)?(t.consume($),y):A($)}function b($){return $===47?(t.consume($),A):$===58||$===95||Kr($)?(t.consume($),S):Et($)?(t.consume($),b):A($)}function S($){return $===45||$===46||$===58||$===95||zr($)?(t.consume($),S):N($)}function N($){return $===61?(t.consume($),E):Et($)?(t.consume($),N):b($)}function E($){return $===null||$===60||$===61||$===62||$===96?r($):$===34||$===39?(t.consume($),l=$,T):Et($)?(t.consume($),E):k($)}function T($){return $===l?(t.consume($),l=null,L):$===null||dt($)?r($):(t.consume($),T)}function k($){return $===null||$===34||$===39||$===47||$===60||$===61||$===62||$===96||Vt($)?N($):(t.consume($),k)}function L($){return $===47||$===62||Et($)?b($):r($)}function A($){return $===62?(t.consume($),I):r($)}function I($){return $===null||dt($)?M($):Et($)?(t.consume($),I):r($)}function M($){return $===45&&i===2?(t.consume($),U):$===60&&i===1?(t.consume($),z):$===62&&i===4?(t.consume($),j):$===63&&i===3?(t.consume($),P):$===93&&i===5?(t.consume($),F):dt($)&&(i===6||i===7)?(t.exit("htmlFlowData"),t.check($5,G,B)($)):$===null||dt($)?(t.exit("htmlFlowData"),B($)):(t.consume($),M)}function B($){return t.check(G5,D,G)($)}function D($){return t.enter("lineEnding"),t.consume($),t.exit("lineEnding"),H}function H($){return $===null||dt($)?B($):(t.enter("htmlFlowData"),M($))}function U($){return $===45?(t.consume($),P):M($)}function z($){return $===47?(t.consume($),o="",W):M($)}function W($){if($===62){const ee=o.toLowerCase();return _b.includes(ee)?(t.consume($),j):M($)}return Kr($)&&o.length<8?(t.consume($),o+=String.fromCharCode($),W):M($)}function F($){return $===93?(t.consume($),P):M($)}function P($){return $===62?(t.consume($),j):$===45&&i===2?(t.consume($),P):M($)}function j($){return $===null||dt($)?(t.exit("htmlFlowData"),G($)):(t.consume($),j)}function G($){return t.exit("htmlFlow"),e($)}}function X5(t,e,r){const n=this;return i;function i(o){return dt(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),s):r(o)}function s(o){return n.parser.lazy[n.now().line]?r(o):e(o)}}function K5(t,e,r){return n;function n(i){return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),t.attempt(Ol,e,r)}}const Q5={name:"htmlText",tokenize:Z5};function Z5(t,e,r){const n=this;let i,s,o;return a;function a(P){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(P),l}function l(P){return P===33?(t.consume(P),u):P===47?(t.consume(P),N):P===63?(t.consume(P),b):Kr(P)?(t.consume(P),k):r(P)}function u(P){return P===45?(t.consume(P),c):P===91?(t.consume(P),s=0,x):Kr(P)?(t.consume(P),y):r(P)}function c(P){return P===45?(t.consume(P),d):r(P)}function h(P){return P===null?r(P):P===45?(t.consume(P),v):dt(P)?(o=h,z(P)):(t.consume(P),h)}function v(P){return P===45?(t.consume(P),d):h(P)}function d(P){return P===62?U(P):P===45?v(P):h(P)}function x(P){const j="CDATA[";return P===j.charCodeAt(s++)?(t.consume(P),s===j.length?w:x):r(P)}function w(P){return P===null?r(P):P===93?(t.consume(P),g):dt(P)?(o=w,z(P)):(t.consume(P),w)}function g(P){return P===93?(t.consume(P),m):w(P)}function m(P){return P===62?U(P):P===93?(t.consume(P),m):w(P)}function y(P){return P===null||P===62?U(P):dt(P)?(o=y,z(P)):(t.consume(P),y)}function b(P){return P===null?r(P):P===63?(t.consume(P),S):dt(P)?(o=b,z(P)):(t.consume(P),b)}function S(P){return P===62?U(P):b(P)}function N(P){return Kr(P)?(t.consume(P),E):r(P)}function E(P){return P===45||zr(P)?(t.consume(P),E):T(P)}function T(P){return dt(P)?(o=T,z(P)):Et(P)?(t.consume(P),T):U(P)}function k(P){return P===45||zr(P)?(t.consume(P),k):P===47||P===62||Vt(P)?L(P):r(P)}function L(P){return P===47?(t.consume(P),U):P===58||P===95||Kr(P)?(t.consume(P),A):dt(P)?(o=L,z(P)):Et(P)?(t.consume(P),L):U(P)}function A(P){return P===45||P===46||P===58||P===95||zr(P)?(t.consume(P),A):I(P)}function I(P){return P===61?(t.consume(P),M):dt(P)?(o=I,z(P)):Et(P)?(t.consume(P),I):L(P)}function M(P){return P===null||P===60||P===61||P===62||P===96?r(P):P===34||P===39?(t.consume(P),i=P,B):dt(P)?(o=M,z(P)):Et(P)?(t.consume(P),M):(t.consume(P),D)}function B(P){return P===i?(t.consume(P),i=void 0,H):P===null?r(P):dt(P)?(o=B,z(P)):(t.consume(P),B)}function D(P){return P===null||P===34||P===39||P===60||P===61||P===96?r(P):P===47||P===62||Vt(P)?L(P):(t.consume(P),D)}function H(P){return P===47||P===62||Vt(P)?L(P):r(P)}function U(P){return P===62?(t.consume(P),t.exit("htmlTextData"),t.exit("htmlText"),e):r(P)}function z(P){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(P),t.exit("lineEnding"),W}function W(P){return Et(P)?Nt(t,F,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(P):F(P)}function F(P){return t.enter("htmlTextData"),o(P)}}const Eg={name:"labelEnd",resolveAll:rP,resolveTo:nP,tokenize:iP},J5={tokenize:aP},eP={tokenize:sP},tP={tokenize:oP};function rP(t){let e=-1;const r=[];for(;++e<t.length;){const n=t[e][1];if(r.push(t[e]),n.type==="labelImage"||n.type==="labelLink"||n.type==="labelEnd"){const i=n.type==="labelImage"?4:2;n.type="data",e+=i}}return t.length!==r.length&&xn(t,0,t.length,r),t}function nP(t,e){let r=t.length,n=0,i,s,o,a;for(;r--;)if(i=t[r][1],s){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;t[r][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(o){if(t[r][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(s=r,i.type!=="labelLink")){n=2;break}}else i.type==="labelEnd"&&(o=r);const l={type:t[s][1].type==="labelLink"?"link":"image",start:{...t[s][1].start},end:{...t[t.length-1][1].end}},u={type:"label",start:{...t[s][1].start},end:{...t[o][1].end}},c={type:"labelText",start:{...t[s+n+2][1].end},end:{...t[o-2][1].start}};return a=[["enter",l,e],["enter",u,e]],a=Rn(a,t.slice(s+1,s+n+3)),a=Rn(a,[["enter",c,e]]),a=Rn(a,ch(e.parser.constructs.insideSpan.null,t.slice(s+n+4,o-3),e)),a=Rn(a,[["exit",c,e],t[o-2],t[o-1],["exit",u,e]]),a=Rn(a,t.slice(o+1)),a=Rn(a,[["exit",l,e]]),xn(t,s,t.length,a),t}function iP(t,e,r){const n=this;let i=n.events.length,s,o;for(;i--;)if((n.events[i][1].type==="labelImage"||n.events[i][1].type==="labelLink")&&!n.events[i][1]._balanced){s=n.events[i][1];break}return a;function a(v){return s?s._inactive?h(v):(o=n.parser.defined.includes(Hn(n.sliceSerialize({start:s.end,end:n.now()}))),t.enter("labelEnd"),t.enter("labelMarker"),t.consume(v),t.exit("labelMarker"),t.exit("labelEnd"),l):r(v)}function l(v){return v===40?t.attempt(J5,c,o?c:h)(v):v===91?t.attempt(eP,c,o?u:h)(v):o?c(v):h(v)}function u(v){return t.attempt(tP,c,h)(v)}function c(v){return e(v)}function h(v){return s._balanced=!0,r(v)}}function aP(t,e,r){return n;function n(h){return t.enter("resource"),t.enter("resourceMarker"),t.consume(h),t.exit("resourceMarker"),i}function i(h){return Vt(h)?ll(t,s)(h):s(h)}function s(h){return h===41?c(h):NS(t,o,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(h)}function o(h){return Vt(h)?ll(t,l)(h):c(h)}function a(h){return r(h)}function l(h){return h===34||h===39||h===40?LS(t,u,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(h):c(h)}function u(h){return Vt(h)?ll(t,c)(h):c(h)}function c(h){return h===41?(t.enter("resourceMarker"),t.consume(h),t.exit("resourceMarker"),t.exit("resource"),e):r(h)}}function sP(t,e,r){const n=this;return i;function i(a){return RS.call(n,t,s,o,"reference","referenceMarker","referenceString")(a)}function s(a){return n.parser.defined.includes(Hn(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)))?e(a):r(a)}function o(a){return r(a)}}function oP(t,e,r){return n;function n(s){return t.enter("reference"),t.enter("referenceMarker"),t.consume(s),t.exit("referenceMarker"),i}function i(s){return s===93?(t.enter("referenceMarker"),t.consume(s),t.exit("referenceMarker"),t.exit("reference"),e):r(s)}}const lP={name:"labelStartImage",resolveAll:Eg.resolveAll,tokenize:uP};function uP(t,e,r){const n=this;return i;function i(a){return t.enter("labelImage"),t.enter("labelImageMarker"),t.consume(a),t.exit("labelImageMarker"),s}function s(a){return a===91?(t.enter("labelMarker"),t.consume(a),t.exit("labelMarker"),t.exit("labelImage"),o):r(a)}function o(a){return a===94&&"_hiddenFootnoteSupport"in n.parser.constructs?r(a):e(a)}}const cP={name:"labelStartLink",resolveAll:Eg.resolveAll,tokenize:hP};function hP(t,e,r){const n=this;return i;function i(o){return t.enter("labelLink"),t.enter("labelMarker"),t.consume(o),t.exit("labelMarker"),t.exit("labelLink"),s}function s(o){return o===94&&"_hiddenFootnoteSupport"in n.parser.constructs?r(o):e(o)}}const Gp={name:"lineEnding",tokenize:fP};function fP(t,e){return r;function r(n){return t.enter("lineEnding"),t.consume(n),t.exit("lineEnding"),Nt(t,e,"linePrefix")}}const Cc={name:"thematicBreak",tokenize:dP};function dP(t,e,r){let n=0,i;return s;function s(u){return t.enter("thematicBreak"),o(u)}function o(u){return i=u,a(u)}function a(u){return u===i?(t.enter("thematicBreakSequence"),l(u)):n>=3&&(u===null||dt(u))?(t.exit("thematicBreak"),e(u)):r(u)}function l(u){return u===i?(t.consume(u),n++,l):(t.exit("thematicBreakSequence"),Et(u)?Nt(t,a,"whitespace")(u):a(u))}}const sn={continuation:{tokenize:mP},exit:xP,name:"list",tokenize:gP},pP={partial:!0,tokenize:bP},vP={partial:!0,tokenize:yP};function gP(t,e,r){const n=this,i=n.events[n.events.length-1];let s=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,o=0;return a;function a(d){const x=n.containerState.type||(d===42||d===43||d===45?"listUnordered":"listOrdered");if(x==="listUnordered"?!n.containerState.marker||d===n.containerState.marker:Pv(d)){if(n.containerState.type||(n.containerState.type=x,t.enter(x,{_container:!0})),x==="listUnordered")return t.enter("listItemPrefix"),d===42||d===45?t.check(Cc,r,u)(d):u(d);if(!n.interrupt||d===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),l(d)}return r(d)}function l(d){return Pv(d)&&++o<10?(t.consume(d),l):(!n.interrupt||o<2)&&(n.containerState.marker?d===n.containerState.marker:d===41||d===46)?(t.exit("listItemValue"),u(d)):r(d)}function u(d){return t.enter("listItemMarker"),t.consume(d),t.exit("listItemMarker"),n.containerState.marker=n.containerState.marker||d,t.check(Ol,n.interrupt?r:c,t.attempt(pP,v,h))}function c(d){return n.containerState.initialBlankLine=!0,s++,v(d)}function h(d){return Et(d)?(t.enter("listItemPrefixWhitespace"),t.consume(d),t.exit("listItemPrefixWhitespace"),v):r(d)}function v(d){return n.containerState.size=s+n.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(d)}}function mP(t,e,r){const n=this;return n.containerState._closeFlow=void 0,t.check(Ol,i,s);function i(a){return n.containerState.furtherBlankLines=n.containerState.furtherBlankLines||n.containerState.initialBlankLine,Nt(t,e,"listItemIndent",n.containerState.size+1)(a)}function s(a){return n.containerState.furtherBlankLines||!Et(a)?(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,o(a)):(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,t.attempt(vP,e,o)(a))}function o(a){return n.containerState._closeFlow=!0,n.interrupt=void 0,Nt(t,t.attempt(sn,e,r),"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function yP(t,e,r){const n=this;return Nt(t,i,"listItemIndent",n.containerState.size+1);function i(s){const o=n.events[n.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===n.containerState.size?e(s):r(s)}}function xP(t){t.exit(this.containerState.type)}function bP(t,e,r){const n=this;return Nt(t,i,"listItemPrefixWhitespace",n.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(s){const o=n.events[n.events.length-1];return!Et(s)&&o&&o[1].type==="listItemPrefixWhitespace"?e(s):r(s)}}const Sb={name:"setextUnderline",resolveTo:wP,tokenize:_P};function wP(t,e){let r=t.length,n,i,s;for(;r--;)if(t[r][0]==="enter"){if(t[r][1].type==="content"){n=r;break}t[r][1].type==="paragraph"&&(i=r)}else t[r][1].type==="content"&&t.splice(r,1),!s&&t[r][1].type==="definition"&&(s=r);const o={type:"setextHeading",start:{...t[n][1].start},end:{...t[t.length-1][1].end}};return t[i][1].type="setextHeadingText",s?(t.splice(i,0,["enter",o,e]),t.splice(s+1,0,["exit",t[n][1],e]),t[n][1].end={...t[s][1].end}):t[n][1]=o,t.push(["exit",o,e]),t}function _P(t,e,r){const n=this;let i;return s;function s(u){let c=n.events.length,h;for(;c--;)if(n.events[c][1].type!=="lineEnding"&&n.events[c][1].type!=="linePrefix"&&n.events[c][1].type!=="content"){h=n.events[c][1].type==="paragraph";break}return!n.parser.lazy[n.now().line]&&(n.interrupt||h)?(t.enter("setextHeadingLine"),i=u,o(u)):r(u)}function o(u){return t.enter("setextHeadingLineSequence"),a(u)}function a(u){return u===i?(t.consume(u),a):(t.exit("setextHeadingLineSequence"),Et(u)?Nt(t,l,"lineSuffix")(u):l(u))}function l(u){return u===null||dt(u)?(t.exit("setextHeadingLine"),e(u)):r(u)}}const SP={tokenize:CP};function CP(t){const e=this,r=t.attempt(Ol,n,t.attempt(this.parser.constructs.flowInitial,i,Nt(t,t.attempt(this.parser.constructs.flow,i,t.attempt(R5,i)),"linePrefix")));return r;function n(s){if(s===null){t.consume(s);return}return t.enter("lineEndingBlank"),t.consume(s),t.exit("lineEndingBlank"),e.currentConstruct=void 0,r}function i(s){if(s===null){t.consume(s);return}return t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),e.currentConstruct=void 0,r}}const EP={resolveAll:AS()},kP=DS("string"),TP=DS("text");function DS(t){return{resolveAll:AS(t==="text"?NP:void 0),tokenize:e};function e(r){const n=this,i=this.parser.constructs[t],s=r.attempt(i,o,a);return o;function o(c){return u(c)?s(c):a(c)}function a(c){if(c===null){r.consume(c);return}return r.enter("data"),r.consume(c),l}function l(c){return u(c)?(r.exit("data"),s(c)):(r.consume(c),l)}function u(c){if(c===null)return!0;const h=i[c];let v=-1;if(h)for(;++v<h.length;){const d=h[v];if(!d.previous||d.previous.call(n,n.previous))return!0}return!1}}}function AS(t){return e;function e(r,n){let i=-1,s;for(;++i<=r.length;)s===void 0?r[i]&&r[i][1].type==="data"&&(s=i,i++):(!r[i]||r[i][1].type!=="data")&&(i!==s+2&&(r[s][1].end=r[i-1][1].end,r.splice(s+2,i-s-2),i=s+2),s=void 0);return t?t(r,n):r}}function NP(t,e){let r=0;for(;++r<=t.length;)if((r===t.length||t[r][1].type==="lineEnding")&&t[r-1][1].type==="data"){const n=t[r-1][1],i=e.sliceStream(n);let s=i.length,o=-1,a=0,l;for(;s--;){const u=i[s];if(typeof u=="string"){for(o=u.length;u.charCodeAt(o-1)===32;)a++,o--;if(o)break;o=-1}else if(u===-2)l=!0,a++;else if(u!==-1){s++;break}}if(e._contentTypeTextTrailing&&r===t.length&&(a=0),a){const u={type:r===t.length||l||a<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:s?o:n.start._bufferIndex+o,_index:n.start._index+s,line:n.end.line,column:n.end.column-a,offset:n.end.offset-a},end:{...n.end}};n.end={...u.start},n.start.offset===n.end.offset?Object.assign(n,u):(t.splice(r,0,["enter",u,e],["exit",u,e]),r+=2)}r++}return t}const RP={42:sn,43:sn,45:sn,48:sn,49:sn,50:sn,51:sn,52:sn,53:sn,54:sn,55:sn,56:sn,57:sn,62:CS},LP={91:P5},DP={[-2]:$p,[-1]:$p,32:$p},AP={35:z5,42:Cc,45:[Sb,Cc],60:V5,61:Sb,95:Cc,96:wb,126:wb},MP={38:kS,92:ES},PP={[-5]:Gp,[-4]:Gp,[-3]:Gp,33:lP,38:kS,42:Iv,60:[c5,Q5],91:cP,92:[j5,ES],93:Eg,95:Iv,96:S5},IP={null:[Iv,EP]},OP={null:[42,95]},BP={null:[]},jP=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:OP,contentInitial:LP,disable:BP,document:RP,flow:AP,flowInitial:DP,insideSpan:IP,string:MP,text:PP},Symbol.toStringTag,{value:"Module"}));function FP(t,e,r){let n={_bufferIndex:-1,_index:0,line:r&&r.line||1,column:r&&r.column||1,offset:r&&r.offset||0};const i={},s=[];let o=[],a=[];const l={attempt:T(N),check:T(E),consume:y,enter:b,exit:S,interrupt:T(E,{interrupt:!0})},u={code:null,containerState:{},defineSkip:w,events:[],now:x,parser:t,previous:null,sliceSerialize:v,sliceStream:d,write:h};let c=e.tokenize.call(u,l);return e.resolveAll&&s.push(e),u;function h(I){return o=Rn(o,I),g(),o[o.length-1]!==null?[]:(k(e,0),u.events=ch(s,u.events,u),u.events)}function v(I,M){return HP(d(I),M)}function d(I){return zP(o,I)}function x(){const{_bufferIndex:I,_index:M,line:B,column:D,offset:H}=n;return{_bufferIndex:I,_index:M,line:B,column:D,offset:H}}function w(I){i[I.line]=I.column,A()}function g(){let I;for(;n._index<o.length;){const M=o[n._index];if(typeof M=="string")for(I=n._index,n._bufferIndex<0&&(n._bufferIndex=0);n._index===I&&n._bufferIndex<M.length;)m(M.charCodeAt(n._bufferIndex));else m(M)}}function m(I){c=c(I)}function y(I){dt(I)?(n.line++,n.column=1,n.offset+=I===-3?2:1,A()):I!==-1&&(n.column++,n.offset++),n._bufferIndex<0?n._index++:(n._bufferIndex++,n._bufferIndex===o[n._index].length&&(n._bufferIndex=-1,n._index++)),u.previous=I}function b(I,M){const B=M||{};return B.type=I,B.start=x(),u.events.push(["enter",B,u]),a.push(B),B}function S(I){const M=a.pop();return M.end=x(),u.events.push(["exit",M,u]),M}function N(I,M){k(I,M.from)}function E(I,M){M.restore()}function T(I,M){return B;function B(D,H,U){let z,W,F,P;return Array.isArray(D)?G(D):"tokenize"in D?G([D]):j(D);function j(ie){return K;function K(q){const Y=q!==null&&ie[q],X=q!==null&&ie.null,J=[...Array.isArray(Y)?Y:Y?[Y]:[],...Array.isArray(X)?X:X?[X]:[]];return G(J)(q)}}function G(ie){return z=ie,W=0,ie.length===0?U:$(ie[W])}function $(ie){return K;function K(q){return P=L(),F=ie,ie.partial||(u.currentConstruct=ie),ie.name&&u.parser.constructs.disable.null.includes(ie.name)?ae():ie.tokenize.call(M?Object.assign(Object.create(u),M):u,l,ee,ae)(q)}}function ee(ie){return I(F,P),H}function ae(ie){return P.restore(),++W<z.length?$(z[W]):U}}}function k(I,M){I.resolveAll&&!s.includes(I)&&s.push(I),I.resolve&&xn(u.events,M,u.events.length-M,I.resolve(u.events.slice(M),u)),I.resolveTo&&(u.events=I.resolveTo(u.events,u))}function L(){const I=x(),M=u.previous,B=u.currentConstruct,D=u.events.length,H=Array.from(a);return{from:D,restore:U};function U(){n=I,u.previous=M,u.currentConstruct=B,u.events.length=D,a=H,A()}}function A(){n.line in i&&n.column<2&&(n.column=i[n.line],n.offset+=i[n.line]-1)}}function zP(t,e){const r=e.start._index,n=e.start._bufferIndex,i=e.end._index,s=e.end._bufferIndex;let o;if(r===i)o=[t[r].slice(n,s)];else{if(o=t.slice(r,i),n>-1){const a=o[0];typeof a=="string"?o[0]=a.slice(n):o.shift()}s>0&&o.push(t[i].slice(0,s))}return o}function HP(t,e){let r=-1;const n=[];let i;for(;++r<t.length;){const s=t[r];let o;if(typeof s=="string")o=s;else switch(s){case-5:{o="\r";break}case-4:{o=`
391
- `;break}case-3:{o=`\r
392
- `;break}case-2:{o=e?" ":" ";break}case-1:{if(!e&&i)continue;o=" ";break}default:o=String.fromCharCode(s)}i=s===-2,n.push(o)}return n.join("")}function UP(t){const n={constructs:_S([jP,...(t||{}).extensions||[]]),content:i(n5),defined:[],document:i(a5),flow:i(SP),lazy:{},string:i(kP),text:i(TP)};return n;function i(s){return o;function o(a){return FP(n,s,a)}}}function WP(t){for(;!TS(t););return t}const Cb=/[\0\t\n\r]/g;function VP(){let t=1,e="",r=!0,n;return i;function i(s,o,a){const l=[];let u,c,h,v,d;for(s=e+(typeof s=="string"?s.toString():new TextDecoder(o||void 0).decode(s)),h=0,e="",r&&(s.charCodeAt(0)===65279&&h++,r=void 0);h<s.length;){if(Cb.lastIndex=h,u=Cb.exec(s),v=u&&u.index!==void 0?u.index:s.length,d=s.charCodeAt(v),!u){e=s.slice(h);break}if(d===10&&h===v&&n)l.push(-3),n=void 0;else switch(n&&(l.push(-5),n=void 0),h<v&&(l.push(s.slice(h,v)),t+=v-h),d){case 0:{l.push(65533),t++;break}case 9:{for(c=Math.ceil(t/4)*4,l.push(-2);t++<c;)l.push(-1);break}case 10:{l.push(-4),t=1;break}default:n=!0,t=1}h=v+1}return a&&(n&&l.push(-5),e&&l.push(e),l.push(null)),l}}const $P=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function GP(t){return t.replace($P,qP)}function qP(t,e,r){if(e)return e;if(r.charCodeAt(0)===35){const i=r.charCodeAt(1),s=i===120||i===88;return SS(r.slice(s?2:1),s?16:10)}return Cg(r)||t}const MS={}.hasOwnProperty;function YP(t,e,r){return e&&typeof e=="object"&&(r=e,e=void 0),XP(r)(WP(UP(r).document().write(VP()(t,e,!0))))}function XP(t){const e={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(Le),autolinkProtocol:L,autolinkEmail:L,atxHeading:s(Re),blockQuote:s(X),characterEscape:L,characterReference:L,codeFenced:s(J),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:s(J,o),codeText:s(re,o),codeTextData:L,data:L,codeFlowValue:L,definition:s(ce),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:s(de),hardBreakEscape:s(Pe),hardBreakTrailing:s(Pe),htmlFlow:s(_e,o),htmlFlowData:L,htmlText:s(_e,o),htmlTextData:L,image:s(ke),label:o,link:s(Le),listItem:s(Ie),listItemValue:v,listOrdered:s(Ee,h),listUnordered:s(Ee),paragraph:s(Oe),reference:$,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:s(Re),strong:s(De),thematicBreak:s(Ye)},exit:{atxHeading:l(),atxHeadingSequence:N,autolink:l(),autolinkEmail:Y,autolinkProtocol:q,blockQuote:l(),characterEscapeValue:A,characterReferenceMarkerHexadecimal:ae,characterReferenceMarkerNumeric:ae,characterReferenceValue:ie,characterReference:K,codeFenced:l(g),codeFencedFence:w,codeFencedFenceInfo:d,codeFencedFenceMeta:x,codeFlowValue:A,codeIndented:l(m),codeText:l(H),codeTextData:A,data:A,definition:l(),definitionDestinationString:S,definitionLabelString:y,definitionTitleString:b,emphasis:l(),hardBreakEscape:l(M),hardBreakTrailing:l(M),htmlFlow:l(B),htmlFlowData:A,htmlText:l(D),htmlTextData:A,image:l(z),label:F,labelText:W,lineEnding:I,link:l(U),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:ee,resourceDestinationString:P,resourceTitleString:j,resource:G,setextHeading:l(k),setextHeadingLineSequence:T,setextHeadingText:E,strong:l(),thematicBreak:l()}};PS(e,(t||{}).mdastExtensions||[]);const r={};return n;function n(ge){let Ce={type:"root",children:[]};const Ae={stack:[Ce],tokenStack:[],config:e,enter:a,exit:u,buffer:o,resume:c,data:r},Fe=[];let me=-1;for(;++me<ge.length;)if(ge[me][1].type==="listOrdered"||ge[me][1].type==="listUnordered")if(ge[me][0]==="enter")Fe.push(me);else{const Z=Fe.pop();me=i(ge,Z,me)}for(me=-1;++me<ge.length;){const Z=e[ge[me][0]];MS.call(Z,ge[me][1].type)&&Z[ge[me][1].type].call(Object.assign({sliceSerialize:ge[me][2].sliceSerialize},Ae),ge[me][1])}if(Ae.tokenStack.length>0){const Z=Ae.tokenStack[Ae.tokenStack.length-1];(Z[1]||Eb).call(Ae,void 0,Z[0])}for(Ce.position={start:Vi(ge.length>0?ge[0][1].start:{line:1,column:1,offset:0}),end:Vi(ge.length>0?ge[ge.length-2][1].end:{line:1,column:1,offset:0})},me=-1;++me<e.transforms.length;)Ce=e.transforms[me](Ce)||Ce;return Ce}function i(ge,Ce,Ae){let Fe=Ce-1,me=-1,Z=!1,te,oe,ue,se;for(;++Fe<=Ae;){const he=ge[Fe];switch(he[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{he[0]==="enter"?me++:me--,se=void 0;break}case"lineEndingBlank":{he[0]==="enter"&&(te&&!se&&!me&&!ue&&(ue=Fe),se=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:se=void 0}if(!me&&he[0]==="enter"&&he[1].type==="listItemPrefix"||me===-1&&he[0]==="exit"&&(he[1].type==="listUnordered"||he[1].type==="listOrdered")){if(te){let pe=Fe;for(oe=void 0;pe--;){const be=ge[pe];if(be[1].type==="lineEnding"||be[1].type==="lineEndingBlank"){if(be[0]==="exit")continue;oe&&(ge[oe][1].type="lineEndingBlank",Z=!0),be[1].type="lineEnding",oe=pe}else if(!(be[1].type==="linePrefix"||be[1].type==="blockQuotePrefix"||be[1].type==="blockQuotePrefixWhitespace"||be[1].type==="blockQuoteMarker"||be[1].type==="listItemIndent"))break}ue&&(!oe||ue<oe)&&(te._spread=!0),te.end=Object.assign({},oe?ge[oe][1].start:he[1].end),ge.splice(oe||Fe,0,["exit",te,he[2]]),Fe++,Ae++}if(he[1].type==="listItemPrefix"){const pe={type:"listItem",_spread:!1,start:Object.assign({},he[1].start),end:void 0};te=pe,ge.splice(Fe,0,["enter",pe,he[2]]),Fe++,Ae++,ue=void 0,se=!0}}}return ge[Ce][1]._spread=Z,Ae}function s(ge,Ce){return Ae;function Ae(Fe){a.call(this,ge(Fe),Fe),Ce&&Ce.call(this,Fe)}}function o(){this.stack.push({type:"fragment",children:[]})}function a(ge,Ce,Ae){this.stack[this.stack.length-1].children.push(ge),this.stack.push(ge),this.tokenStack.push([Ce,Ae||void 0]),ge.position={start:Vi(Ce.start),end:void 0}}function l(ge){return Ce;function Ce(Ae){ge&&ge.call(this,Ae),u.call(this,Ae)}}function u(ge,Ce){const Ae=this.stack.pop(),Fe=this.tokenStack.pop();if(Fe)Fe[0].type!==ge.type&&(Ce?Ce.call(this,ge,Fe[0]):(Fe[1]||Eb).call(this,ge,Fe[0]));else throw new Error("Cannot close `"+ge.type+"` ("+ol({start:ge.start,end:ge.end})+"): it’s not open");Ae.position.end=Vi(ge.end)}function c(){return Sg(this.stack.pop())}function h(){this.data.expectingFirstListItemValue=!0}function v(ge){if(this.data.expectingFirstListItemValue){const Ce=this.stack[this.stack.length-2];Ce.start=Number.parseInt(this.sliceSerialize(ge),10),this.data.expectingFirstListItemValue=void 0}}function d(){const ge=this.resume(),Ce=this.stack[this.stack.length-1];Ce.lang=ge}function x(){const ge=this.resume(),Ce=this.stack[this.stack.length-1];Ce.meta=ge}function w(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function g(){const ge=this.resume(),Ce=this.stack[this.stack.length-1];Ce.value=ge.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function m(){const ge=this.resume(),Ce=this.stack[this.stack.length-1];Ce.value=ge.replace(/(\r?\n|\r)$/g,"")}function y(ge){const Ce=this.resume(),Ae=this.stack[this.stack.length-1];Ae.label=Ce,Ae.identifier=Hn(this.sliceSerialize(ge)).toLowerCase()}function b(){const ge=this.resume(),Ce=this.stack[this.stack.length-1];Ce.title=ge}function S(){const ge=this.resume(),Ce=this.stack[this.stack.length-1];Ce.url=ge}function N(ge){const Ce=this.stack[this.stack.length-1];if(!Ce.depth){const Ae=this.sliceSerialize(ge).length;Ce.depth=Ae}}function E(){this.data.setextHeadingSlurpLineEnding=!0}function T(ge){const Ce=this.stack[this.stack.length-1];Ce.depth=this.sliceSerialize(ge).codePointAt(0)===61?1:2}function k(){this.data.setextHeadingSlurpLineEnding=void 0}function L(ge){const Ae=this.stack[this.stack.length-1].children;let Fe=Ae[Ae.length-1];(!Fe||Fe.type!=="text")&&(Fe=We(),Fe.position={start:Vi(ge.start),end:void 0},Ae.push(Fe)),this.stack.push(Fe)}function A(ge){const Ce=this.stack.pop();Ce.value+=this.sliceSerialize(ge),Ce.position.end=Vi(ge.end)}function I(ge){const Ce=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Ae=Ce.children[Ce.children.length-1];Ae.position.end=Vi(ge.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&e.canContainEols.includes(Ce.type)&&(L.call(this,ge),A.call(this,ge))}function M(){this.data.atHardBreak=!0}function B(){const ge=this.resume(),Ce=this.stack[this.stack.length-1];Ce.value=ge}function D(){const ge=this.resume(),Ce=this.stack[this.stack.length-1];Ce.value=ge}function H(){const ge=this.resume(),Ce=this.stack[this.stack.length-1];Ce.value=ge}function U(){const ge=this.stack[this.stack.length-1];if(this.data.inReference){const Ce=this.data.referenceType||"shortcut";ge.type+="Reference",ge.referenceType=Ce,delete ge.url,delete ge.title}else delete ge.identifier,delete ge.label;this.data.referenceType=void 0}function z(){const ge=this.stack[this.stack.length-1];if(this.data.inReference){const Ce=this.data.referenceType||"shortcut";ge.type+="Reference",ge.referenceType=Ce,delete ge.url,delete ge.title}else delete ge.identifier,delete ge.label;this.data.referenceType=void 0}function W(ge){const Ce=this.sliceSerialize(ge),Ae=this.stack[this.stack.length-2];Ae.label=GP(Ce),Ae.identifier=Hn(Ce).toLowerCase()}function F(){const ge=this.stack[this.stack.length-1],Ce=this.resume(),Ae=this.stack[this.stack.length-1];if(this.data.inReference=!0,Ae.type==="link"){const Fe=ge.children;Ae.children=Fe}else Ae.alt=Ce}function P(){const ge=this.resume(),Ce=this.stack[this.stack.length-1];Ce.url=ge}function j(){const ge=this.resume(),Ce=this.stack[this.stack.length-1];Ce.title=ge}function G(){this.data.inReference=void 0}function $(){this.data.referenceType="collapsed"}function ee(ge){const Ce=this.resume(),Ae=this.stack[this.stack.length-1];Ae.label=Ce,Ae.identifier=Hn(this.sliceSerialize(ge)).toLowerCase(),this.data.referenceType="full"}function ae(ge){this.data.characterReferenceType=ge.type}function ie(ge){const Ce=this.sliceSerialize(ge),Ae=this.data.characterReferenceType;let Fe;Ae?(Fe=SS(Ce,Ae==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Fe=Cg(Ce);const me=this.stack[this.stack.length-1];me.value+=Fe}function K(ge){const Ce=this.stack.pop();Ce.position.end=Vi(ge.end)}function q(ge){A.call(this,ge);const Ce=this.stack[this.stack.length-1];Ce.url=this.sliceSerialize(ge)}function Y(ge){A.call(this,ge);const Ce=this.stack[this.stack.length-1];Ce.url="mailto:"+this.sliceSerialize(ge)}function X(){return{type:"blockquote",children:[]}}function J(){return{type:"code",lang:null,meta:null,value:""}}function re(){return{type:"inlineCode",value:""}}function ce(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function de(){return{type:"emphasis",children:[]}}function Re(){return{type:"heading",depth:0,children:[]}}function Pe(){return{type:"break"}}function _e(){return{type:"html",value:""}}function ke(){return{type:"image",title:null,url:"",alt:null}}function Le(){return{type:"link",title:null,url:"",children:[]}}function Ee(ge){return{type:"list",ordered:ge.type==="listOrdered",start:null,spread:ge._spread,children:[]}}function Ie(ge){return{type:"listItem",spread:ge._spread,checked:null,children:[]}}function Oe(){return{type:"paragraph",children:[]}}function De(){return{type:"strong",children:[]}}function We(){return{type:"text",value:""}}function Ye(){return{type:"thematicBreak"}}}function Vi(t){return{line:t.line,column:t.column,offset:t.offset}}function PS(t,e){let r=-1;for(;++r<e.length;){const n=e[r];Array.isArray(n)?PS(t,n):KP(t,n)}}function KP(t,e){let r;for(r in e)if(MS.call(e,r))switch(r){case"canContainEols":{const n=e[r];n&&t[r].push(...n);break}case"transforms":{const n=e[r];n&&t[r].push(...n);break}case"enter":case"exit":{const n=e[r];n&&Object.assign(t[r],n);break}}}function Eb(t,e){throw t?new Error("Cannot close `"+t.type+"` ("+ol({start:t.start,end:t.end})+"): a different token (`"+e.type+"`, "+ol({start:e.start,end:e.end})+") is open"):new Error("Cannot close document, a token (`"+e.type+"`, "+ol({start:e.start,end:e.end})+") is still open")}function QP(t){const e=this;e.parser=r;function r(n){return YP(n,{...e.data("settings"),...t,extensions:e.data("micromarkExtensions")||[],mdastExtensions:e.data("fromMarkdownExtensions")||[]})}}function ZP(t,e){const r={type:"element",tagName:"blockquote",properties:{},children:t.wrap(t.all(e),!0)};return t.patch(e,r),t.applyData(e,r)}function JP(t,e){const r={type:"element",tagName:"br",properties:{},children:[]};return t.patch(e,r),[t.applyData(e,r),{type:"text",value:`
393
- `}]}function e4(t,e){const r=e.value?e.value+`
394
- `:"",n={},i=e.lang?e.lang.split(/\s+/):[];i.length>0&&(n.className=["language-"+i[0]]);let s={type:"element",tagName:"code",properties:n,children:[{type:"text",value:r}]};return e.meta&&(s.data={meta:e.meta}),t.patch(e,s),s=t.applyData(e,s),s={type:"element",tagName:"pre",properties:{},children:[s]},t.patch(e,s),s}function t4(t,e){const r={type:"element",tagName:"del",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function r4(t,e){const r={type:"element",tagName:"em",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function n4(t,e){const r=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",n=String(e.identifier).toUpperCase(),i=to(n.toLowerCase()),s=t.footnoteOrder.indexOf(n);let o,a=t.footnoteCounts.get(n);a===void 0?(a=0,t.footnoteOrder.push(n),o=t.footnoteOrder.length):o=s+1,a+=1,t.footnoteCounts.set(n,a);const l={type:"element",tagName:"a",properties:{href:"#"+r+"fn-"+i,id:r+"fnref-"+i+(a>1?"-"+a:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};t.patch(e,l);const u={type:"element",tagName:"sup",properties:{},children:[l]};return t.patch(e,u),t.applyData(e,u)}function i4(t,e){const r={type:"element",tagName:"h"+e.depth,properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function a4(t,e){if(t.options.allowDangerousHtml){const r={type:"raw",value:e.value};return t.patch(e,r),t.applyData(e,r)}}function IS(t,e){const r=e.referenceType;let n="]";if(r==="collapsed"?n+="[]":r==="full"&&(n+="["+(e.label||e.identifier)+"]"),e.type==="imageReference")return[{type:"text",value:"!["+e.alt+n}];const i=t.all(e),s=i[0];s&&s.type==="text"?s.value="["+s.value:i.unshift({type:"text",value:"["});const o=i[i.length-1];return o&&o.type==="text"?o.value+=n:i.push({type:"text",value:n}),i}function s4(t,e){const r=String(e.identifier).toUpperCase(),n=t.definitionById.get(r);if(!n)return IS(t,e);const i={src:to(n.url||""),alt:e.alt};n.title!==null&&n.title!==void 0&&(i.title=n.title);const s={type:"element",tagName:"img",properties:i,children:[]};return t.patch(e,s),t.applyData(e,s)}function o4(t,e){const r={src:to(e.url)};e.alt!==null&&e.alt!==void 0&&(r.alt=e.alt),e.title!==null&&e.title!==void 0&&(r.title=e.title);const n={type:"element",tagName:"img",properties:r,children:[]};return t.patch(e,n),t.applyData(e,n)}function l4(t,e){const r={type:"text",value:e.value.replace(/\r?\n|\r/g," ")};t.patch(e,r);const n={type:"element",tagName:"code",properties:{},children:[r]};return t.patch(e,n),t.applyData(e,n)}function u4(t,e){const r=String(e.identifier).toUpperCase(),n=t.definitionById.get(r);if(!n)return IS(t,e);const i={href:to(n.url||"")};n.title!==null&&n.title!==void 0&&(i.title=n.title);const s={type:"element",tagName:"a",properties:i,children:t.all(e)};return t.patch(e,s),t.applyData(e,s)}function c4(t,e){const r={href:to(e.url)};e.title!==null&&e.title!==void 0&&(r.title=e.title);const n={type:"element",tagName:"a",properties:r,children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function h4(t,e,r){const n=t.all(e),i=r?f4(r):OS(e),s={},o=[];if(typeof e.checked=="boolean"){const c=n[0];let h;c&&c.type==="element"&&c.tagName==="p"?h=c:(h={type:"element",tagName:"p",properties:{},children:[]},n.unshift(h)),h.children.length>0&&h.children.unshift({type:"text",value:" "}),h.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:e.checked,disabled:!0},children:[]}),s.className=["task-list-item"]}let a=-1;for(;++a<n.length;){const c=n[a];(i||a!==0||c.type!=="element"||c.tagName!=="p")&&o.push({type:"text",value:`
395
- `}),c.type==="element"&&c.tagName==="p"&&!i?o.push(...c.children):o.push(c)}const l=n[n.length-1];l&&(i||l.type!=="element"||l.tagName!=="p")&&o.push({type:"text",value:`
396
- `});const u={type:"element",tagName:"li",properties:s,children:o};return t.patch(e,u),t.applyData(e,u)}function f4(t){let e=!1;if(t.type==="list"){e=t.spread||!1;const r=t.children;let n=-1;for(;!e&&++n<r.length;)e=OS(r[n])}return e}function OS(t){const e=t.spread;return e??t.children.length>1}function d4(t,e){const r={},n=t.all(e);let i=-1;for(typeof e.start=="number"&&e.start!==1&&(r.start=e.start);++i<n.length;){const o=n[i];if(o.type==="element"&&o.tagName==="li"&&o.properties&&Array.isArray(o.properties.className)&&o.properties.className.includes("task-list-item")){r.className=["contains-task-list"];break}}const s={type:"element",tagName:e.ordered?"ol":"ul",properties:r,children:t.wrap(n,!0)};return t.patch(e,s),t.applyData(e,s)}function p4(t,e){const r={type:"element",tagName:"p",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function v4(t,e){const r={type:"root",children:t.wrap(t.all(e))};return t.patch(e,r),t.applyData(e,r)}function g4(t,e){const r={type:"element",tagName:"strong",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function m4(t,e){const r=t.all(e),n=r.shift(),i=[];if(n){const o={type:"element",tagName:"thead",properties:{},children:t.wrap([n],!0)};t.patch(e.children[0],o),i.push(o)}if(r.length>0){const o={type:"element",tagName:"tbody",properties:{},children:t.wrap(r,!0)},a=xg(e.children[1]),l=vS(e.children[e.children.length-1]);a&&l&&(o.position={start:a,end:l}),i.push(o)}const s={type:"element",tagName:"table",properties:{},children:t.wrap(i,!0)};return t.patch(e,s),t.applyData(e,s)}function y4(t,e,r){const n=r?r.children:void 0,s=(n?n.indexOf(e):1)===0?"th":"td",o=r&&r.type==="table"?r.align:void 0,a=o?o.length:e.children.length;let l=-1;const u=[];for(;++l<a;){const h=e.children[l],v={},d=o?o[l]:void 0;d&&(v.align=d);let x={type:"element",tagName:s,properties:v,children:[]};h&&(x.children=t.all(h),t.patch(h,x),x=t.applyData(h,x)),u.push(x)}const c={type:"element",tagName:"tr",properties:{},children:t.wrap(u,!0)};return t.patch(e,c),t.applyData(e,c)}function x4(t,e){const r={type:"element",tagName:"td",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}const kb=9,Tb=32;function b4(t){const e=String(t),r=/\r?\n|\r/g;let n=r.exec(e),i=0;const s=[];for(;n;)s.push(Nb(e.slice(i,n.index),i>0,!0),n[0]),i=n.index+n[0].length,n=r.exec(e);return s.push(Nb(e.slice(i),i>0,!1)),s.join("")}function Nb(t,e,r){let n=0,i=t.length;if(e){let s=t.codePointAt(n);for(;s===kb||s===Tb;)n++,s=t.codePointAt(n)}if(r){let s=t.codePointAt(i-1);for(;s===kb||s===Tb;)i--,s=t.codePointAt(i-1)}return i>n?t.slice(n,i):""}function w4(t,e){const r={type:"text",value:b4(String(e.value))};return t.patch(e,r),t.applyData(e,r)}function _4(t,e){const r={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(e,r),t.applyData(e,r)}const S4={blockquote:ZP,break:JP,code:e4,delete:t4,emphasis:r4,footnoteReference:n4,heading:i4,html:a4,imageReference:s4,image:o4,inlineCode:l4,linkReference:u4,link:c4,listItem:h4,list:d4,paragraph:p4,root:v4,strong:g4,table:m4,tableCell:x4,tableRow:y4,text:w4,thematicBreak:_4,toml:ic,yaml:ic,definition:ic,footnoteDefinition:ic};function ic(){}const BS=-1,hh=0,ul=1,Hc=2,kg=3,Tg=4,Ng=5,Rg=6,jS=7,FS=8,zS=typeof self=="object"?self:globalThis,Rb=(t,e)=>{switch(t){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+t)}return new zS[t](e)},C4=(t,e)=>{const r=(i,s)=>(t.set(s,i),i),n=i=>{if(t.has(i))return t.get(i);const[s,o]=e[i];switch(s){case hh:case BS:return r(o,i);case ul:{const a=r([],i);for(const l of o)a.push(n(l));return a}case Hc:{const a=r({},i);for(const[l,u]of o)a[n(l)]=n(u);return a}case kg:return r(new Date(o),i);case Tg:{const{source:a,flags:l}=o;return r(new RegExp(a,l),i)}case Ng:{const a=r(new Map,i);for(const[l,u]of o)a.set(n(l),n(u));return a}case Rg:{const a=r(new Set,i);for(const l of o)a.add(n(l));return a}case jS:{const{name:a,message:l}=o;return r(typeof zS[a]=="function"?Rb(a,l):new Error(l),i)}case FS:return r(BigInt(o),i);case"BigInt":return r(Object(BigInt(o)),i);case"ArrayBuffer":return r(new Uint8Array(o).buffer,o);case"DataView":{const{buffer:a}=new Uint8Array(o);return r(new DataView(a),o)}}return r(Rb(s,o),i)};return n},Lb=t=>C4(new Map,t)(0),Aa="",{toString:E4}={},{keys:k4}=Object,Jo=t=>{const e=typeof t;if(e!=="object"||!t)return[hh,e];const r=E4.call(t).slice(8,-1);switch(r){case"Array":return[ul,Aa];case"Object":return[Hc,Aa];case"Date":return[kg,Aa];case"RegExp":return[Tg,Aa];case"Map":return[Ng,Aa];case"Set":return[Rg,Aa];case"DataView":return[ul,r]}return r.includes("Array")?[ul,r]:t instanceof Error?[jS,t.name||"Error"]:[Hc,r]},ac=([t,e])=>t===hh&&(e==="function"||e==="symbol"),T4=(t,e,r,n)=>{const i=(o,a)=>{const l=n.push(o)-1;return r.set(a,l),l},s=o=>{if(r.has(o))return r.get(o);let[a,l]=Jo(o);switch(a){case hh:{let c=o;switch(l){case"bigint":a=FS,c=o.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+l);c=null;break;case"undefined":return i([BS],o)}return i([a,c],o)}case ul:{if(l){let v=o;return l==="DataView"?v=new Uint8Array(o.buffer):l==="ArrayBuffer"&&(v=new Uint8Array(o)),i([l,[...v]],o)}const c=[],h=i([a,c],o);for(const v of o)c.push(s(v));return h}case Hc:{if(l)switch(l){case"BigInt":return i([l,o.toString()],o);case"Boolean":case"Number":case"String":return i([l,o.valueOf()],o)}if(e&&"toJSON"in o)return s(o.toJSON());const c=[],h=i([a,c],o);for(const v of k4(o))(t||!ac(Jo(o[v])))&&c.push([s(v),s(o[v])]);return h}case kg:return i([a,isNaN(o.getTime())?Aa:o.toISOString()],o);case Tg:{const{source:c,flags:h}=o;return i([a,{source:c,flags:h}],o)}case Ng:{const c=[],h=i([a,c],o);for(const[v,d]of o)(t||!(ac(Jo(v))||ac(Jo(d))))&&c.push([s(v),s(d)]);return h}case Rg:{const c=[],h=i([a,c],o);for(const v of o)(t||!ac(Jo(v)))&&c.push(s(v));return h}}const{message:u}=o;return i([a,{name:l,message:u}],o)};return s},Db=(t,{json:e,lossy:r}={})=>{const n=[];return T4(!(e||r),!!e,new Map,n)(t),n},Uc=typeof structuredClone=="function"?(t,e)=>e&&("json"in e||"lossy"in e)?Lb(Db(t,e)):structuredClone(t):(t,e)=>Lb(Db(t,e));function N4(t,e){const r=[{type:"text",value:"↩"}];return e>1&&r.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(e)}]}),r}function R4(t,e){return"Back to reference "+(t+1)+(e>1?"-"+e:"")}function L4(t){const e=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",r=t.options.footnoteBackContent||N4,n=t.options.footnoteBackLabel||R4,i=t.options.footnoteLabel||"Footnotes",s=t.options.footnoteLabelTagName||"h2",o=t.options.footnoteLabelProperties||{className:["sr-only"]},a=[];let l=-1;for(;++l<t.footnoteOrder.length;){const u=t.footnoteById.get(t.footnoteOrder[l]);if(!u)continue;const c=t.all(u),h=String(u.identifier).toUpperCase(),v=to(h.toLowerCase());let d=0;const x=[],w=t.footnoteCounts.get(h);for(;w!==void 0&&++d<=w;){x.length>0&&x.push({type:"text",value:" "});let y=typeof r=="string"?r:r(l,d);typeof y=="string"&&(y={type:"text",value:y}),x.push({type:"element",tagName:"a",properties:{href:"#"+e+"fnref-"+v+(d>1?"-"+d:""),dataFootnoteBackref:"",ariaLabel:typeof n=="string"?n:n(l,d),className:["data-footnote-backref"]},children:Array.isArray(y)?y:[y]})}const g=c[c.length-1];if(g&&g.type==="element"&&g.tagName==="p"){const y=g.children[g.children.length-1];y&&y.type==="text"?y.value+=" ":g.children.push({type:"text",value:" "}),g.children.push(...x)}else c.push(...x);const m={type:"element",tagName:"li",properties:{id:e+"fn-"+v},children:t.wrap(c,!0)};t.patch(u,m),a.push(m)}if(a.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:s,properties:{...Uc(o),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:`
397
- `},{type:"element",tagName:"ol",properties:{},children:t.wrap(a,!0)},{type:"text",value:`
398
- `}]}}const fh=(function(t){if(t==null)return P4;if(typeof t=="function")return dh(t);if(typeof t=="object")return Array.isArray(t)?D4(t):A4(t);if(typeof t=="string")return M4(t);throw new Error("Expected function, string, or object as test")});function D4(t){const e=[];let r=-1;for(;++r<t.length;)e[r]=fh(t[r]);return dh(n);function n(...i){let s=-1;for(;++s<e.length;)if(e[s].apply(this,i))return!0;return!1}}function A4(t){const e=t;return dh(r);function r(n){const i=n;let s;for(s in t)if(i[s]!==e[s])return!1;return!0}}function M4(t){return dh(e);function e(r){return r&&r.type===t}}function dh(t){return e;function e(r,n,i){return!!(I4(r)&&t.call(this,r,typeof n=="number"?n:void 0,i||void 0))}}function P4(){return!0}function I4(t){return t!==null&&typeof t=="object"&&"type"in t}const HS=[],O4=!0,Ov=!1,B4="skip";function US(t,e,r,n){let i;typeof e=="function"&&typeof r!="function"?(n=r,r=e):i=e;const s=fh(i),o=n?-1:1;a(t,void 0,[])();function a(l,u,c){const h=l&&typeof l=="object"?l:{};if(typeof h.type=="string"){const d=typeof h.tagName=="string"?h.tagName:typeof h.name=="string"?h.name:void 0;Object.defineProperty(v,"name",{value:"node ("+(l.type+(d?"<"+d+">":""))+")"})}return v;function v(){let d=HS,x,w,g;if((!e||s(l,u,c[c.length-1]||void 0))&&(d=j4(r(l,c)),d[0]===Ov))return d;if("children"in l&&l.children){const m=l;if(m.children&&d[0]!==B4)for(w=(n?m.children.length:-1)+o,g=c.concat(m);w>-1&&w<m.children.length;){const y=m.children[w];if(x=a(y,w,g)(),x[0]===Ov)return x;w=typeof x[1]=="number"?x[1]:w+o}}return d}}}function j4(t){return Array.isArray(t)?t:typeof t=="number"?[O4,t]:t==null?HS:[t]}function Lg(t,e,r,n){let i,s,o;typeof e=="function"&&typeof r!="function"?(s=void 0,o=e,i=r):(s=e,o=r,i=n),US(t,s,a,i);function a(l,u){const c=u[u.length-1],h=c?c.children.indexOf(l):void 0;return o(l,h,c)}}const Bv={}.hasOwnProperty,F4={};function z4(t,e){const r=e||F4,n=new Map,i=new Map,s=new Map,o={...S4,...r.handlers},a={all:u,applyData:U4,definitionById:n,footnoteById:i,footnoteCounts:s,footnoteOrder:[],handlers:o,one:l,options:r,patch:H4,wrap:V4};return Lg(t,function(c){if(c.type==="definition"||c.type==="footnoteDefinition"){const h=c.type==="definition"?n:i,v=String(c.identifier).toUpperCase();h.has(v)||h.set(v,c)}}),a;function l(c,h){const v=c.type,d=a.handlers[v];if(Bv.call(a.handlers,v)&&d)return d(a,c,h);if(a.options.passThrough&&a.options.passThrough.includes(v)){if("children"in c){const{children:w,...g}=c,m=Uc(g);return m.children=a.all(c),m}return Uc(c)}return(a.options.unknownHandler||W4)(a,c,h)}function u(c){const h=[];if("children"in c){const v=c.children;let d=-1;for(;++d<v.length;){const x=a.one(v[d],c);if(x){if(d&&v[d-1].type==="break"&&(!Array.isArray(x)&&x.type==="text"&&(x.value=Ab(x.value)),!Array.isArray(x)&&x.type==="element")){const w=x.children[0];w&&w.type==="text"&&(w.value=Ab(w.value))}Array.isArray(x)?h.push(...x):h.push(x)}}}return h}}function H4(t,e){t.position&&(e.position=RM(t))}function U4(t,e){let r=e;if(t&&t.data){const n=t.data.hName,i=t.data.hChildren,s=t.data.hProperties;if(typeof n=="string")if(r.type==="element")r.tagName=n;else{const o="children"in r?r.children:[r];r={type:"element",tagName:n,properties:{},children:o}}r.type==="element"&&s&&Object.assign(r.properties,Uc(s)),"children"in r&&r.children&&i!==null&&i!==void 0&&(r.children=i)}return r}function W4(t,e){const r=e.data||{},n="value"in e&&!(Bv.call(r,"hProperties")||Bv.call(r,"hChildren"))?{type:"text",value:e.value}:{type:"element",tagName:"div",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function V4(t,e){const r=[];let n=-1;for(e&&r.push({type:"text",value:`
399
- `});++n<t.length;)n&&r.push({type:"text",value:`
400
- `}),r.push(t[n]);return e&&t.length>0&&r.push({type:"text",value:`
401
- `}),r}function Ab(t){let e=0,r=t.charCodeAt(e);for(;r===9||r===32;)e++,r=t.charCodeAt(e);return t.slice(e)}function Mb(t,e){const r=z4(t,e),n=r.one(t,void 0),i=L4(r),s=Array.isArray(n)?{type:"root",children:n}:n||{type:"root",children:[]};return i&&s.children.push({type:"text",value:`
402
- `},i),s}function $4(t,e){return t&&"run"in t?async function(r,n){const i=Mb(r,{file:n,...e});await t.run(i,n)}:function(r,n){return Mb(r,{file:n,...t||e})}}function Pb(t){if(t)throw t}var qp,Ib;function G4(){if(Ib)return qp;Ib=1;var t=Object.prototype.hasOwnProperty,e=Object.prototype.toString,r=Object.defineProperty,n=Object.getOwnPropertyDescriptor,i=function(u){return typeof Array.isArray=="function"?Array.isArray(u):e.call(u)==="[object Array]"},s=function(u){if(!u||e.call(u)!=="[object Object]")return!1;var c=t.call(u,"constructor"),h=u.constructor&&u.constructor.prototype&&t.call(u.constructor.prototype,"isPrototypeOf");if(u.constructor&&!c&&!h)return!1;var v;for(v in u);return typeof v>"u"||t.call(u,v)},o=function(u,c){r&&c.name==="__proto__"?r(u,c.name,{enumerable:!0,configurable:!0,value:c.newValue,writable:!0}):u[c.name]=c.newValue},a=function(u,c){if(c==="__proto__")if(t.call(u,c)){if(n)return n(u,c).value}else return;return u[c]};return qp=function l(){var u,c,h,v,d,x,w=arguments[0],g=1,m=arguments.length,y=!1;for(typeof w=="boolean"&&(y=w,w=arguments[1]||{},g=2),(w==null||typeof w!="object"&&typeof w!="function")&&(w={});g<m;++g)if(u=arguments[g],u!=null)for(c in u)h=a(w,c),v=a(u,c),w!==v&&(y&&v&&(s(v)||(d=i(v)))?(d?(d=!1,x=h&&i(h)?h:[]):x=h&&s(h)?h:{},o(w,{name:c,newValue:l(y,x,v)})):typeof v<"u"&&o(w,{name:c,newValue:v}));return w},qp}var q4=G4();const Yp=Vc(q4);function jv(t){if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}function Y4(){const t=[],e={run:r,use:n};return e;function r(...i){let s=-1;const o=i.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);a(null,...i);function a(l,...u){const c=t[++s];let h=-1;if(l){o(l);return}for(;++h<i.length;)(u[h]===null||u[h]===void 0)&&(u[h]=i[h]);i=u,c?X4(c,a)(...u):o(null,...u)}}function n(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return t.push(i),e}}function X4(t,e){let r;return n;function n(...o){const a=t.length>o.length;let l;a&&o.push(i);try{l=t.apply(this,o)}catch(u){const c=u;if(a&&r)throw c;return i(c)}a||(l&&l.then&&typeof l.then=="function"?l.then(s,i):l instanceof Error?i(l):s(l))}function i(o,...a){r||(r=!0,e(o,...a))}function s(o){i(null,o)}}const Qn={basename:K4,dirname:Q4,extname:Z4,join:J4,sep:"/"};function K4(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');Bl(t);let r=0,n=-1,i=t.length,s;if(e===void 0||e.length===0||e.length>t.length){for(;i--;)if(t.codePointAt(i)===47){if(s){r=i+1;break}}else n<0&&(s=!0,n=i+1);return n<0?"":t.slice(r,n)}if(e===t)return"";let o=-1,a=e.length-1;for(;i--;)if(t.codePointAt(i)===47){if(s){r=i+1;break}}else o<0&&(s=!0,o=i+1),a>-1&&(t.codePointAt(i)===e.codePointAt(a--)?a<0&&(n=i):(a=-1,n=o));return r===n?n=o:n<0&&(n=t.length),t.slice(r,n)}function Q4(t){if(Bl(t),t.length===0)return".";let e=-1,r=t.length,n;for(;--r;)if(t.codePointAt(r)===47){if(n){e=r;break}}else n||(n=!0);return e<0?t.codePointAt(0)===47?"/":".":e===1&&t.codePointAt(0)===47?"//":t.slice(0,e)}function Z4(t){Bl(t);let e=t.length,r=-1,n=0,i=-1,s=0,o;for(;e--;){const a=t.codePointAt(e);if(a===47){if(o){n=e+1;break}continue}r<0&&(o=!0,r=e+1),a===46?i<0?i=e:s!==1&&(s=1):i>-1&&(s=-1)}return i<0||r<0||s===0||s===1&&i===r-1&&i===n+1?"":t.slice(i,r)}function J4(...t){let e=-1,r;for(;++e<t.length;)Bl(t[e]),t[e]&&(r=r===void 0?t[e]:r+"/"+t[e]);return r===void 0?".":eI(r)}function eI(t){Bl(t);const e=t.codePointAt(0)===47;let r=tI(t,!e);return r.length===0&&!e&&(r="."),r.length>0&&t.codePointAt(t.length-1)===47&&(r+="/"),e?"/"+r:r}function tI(t,e){let r="",n=0,i=-1,s=0,o=-1,a,l;for(;++o<=t.length;){if(o<t.length)a=t.codePointAt(o);else{if(a===47)break;a=47}if(a===47){if(!(i===o-1||s===1))if(i!==o-1&&s===2){if(r.length<2||n!==2||r.codePointAt(r.length-1)!==46||r.codePointAt(r.length-2)!==46){if(r.length>2){if(l=r.lastIndexOf("/"),l!==r.length-1){l<0?(r="",n=0):(r=r.slice(0,l),n=r.length-1-r.lastIndexOf("/")),i=o,s=0;continue}}else if(r.length>0){r="",n=0,i=o,s=0;continue}}e&&(r=r.length>0?r+"/..":"..",n=2)}else r.length>0?r+="/"+t.slice(i+1,o):r=t.slice(i+1,o),n=o-i-1;i=o,s=0}else a===46&&s>-1?s++:s=-1}return r}function Bl(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const rI={cwd:nI};function nI(){return"/"}function Fv(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function iI(t){if(typeof t=="string")t=new URL(t);else if(!Fv(t)){const e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(t.protocol!=="file:"){const e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return aI(t)}function aI(t){if(t.hostname!==""){const n=new TypeError('File URL host must be "localhost" or empty on darwin');throw n.code="ERR_INVALID_FILE_URL_HOST",n}const e=t.pathname;let r=-1;for(;++r<e.length;)if(e.codePointAt(r)===37&&e.codePointAt(r+1)===50){const n=e.codePointAt(r+2);if(n===70||n===102){const i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(e)}const Xp=["history","path","basename","stem","extname","dirname"];class WS{constructor(e){let r;e?Fv(e)?r={path:e}:typeof e=="string"||sI(e)?r={value:e}:r=e:r={},this.cwd="cwd"in r?"":rI.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<Xp.length;){const s=Xp[n];s in r&&r[s]!==void 0&&r[s]!==null&&(this[s]=s==="history"?[...r[s]]:r[s])}let i;for(i in r)Xp.includes(i)||(this[i]=r[i])}get basename(){return typeof this.path=="string"?Qn.basename(this.path):void 0}set basename(e){Qp(e,"basename"),Kp(e,"basename"),this.path=Qn.join(this.dirname||"",e)}get dirname(){return typeof this.path=="string"?Qn.dirname(this.path):void 0}set dirname(e){Ob(this.basename,"dirname"),this.path=Qn.join(e||"",this.basename)}get extname(){return typeof this.path=="string"?Qn.extname(this.path):void 0}set extname(e){if(Kp(e,"extname"),Ob(this.dirname,"extname"),e){if(e.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(e.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Qn.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){Fv(e)&&(e=iI(e)),Qp(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path=="string"?Qn.basename(this.path,this.extname):void 0}set stem(e){Qp(e,"stem"),Kp(e,"stem"),this.path=Qn.join(this.dirname||"",e+(this.extname||""))}fail(e,r,n){const i=this.message(e,r,n);throw i.fatal=!0,i}info(e,r,n){const i=this.message(e,r,n);return i.fatal=void 0,i}message(e,r,n){const i=new Vr(e,r,n);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(e){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(e||void 0).decode(this.value)}}function Kp(t,e){if(t&&t.includes(Qn.sep))throw new Error("`"+e+"` cannot be a path: did not expect `"+Qn.sep+"`")}function Qp(t,e){if(!t)throw new Error("`"+e+"` cannot be empty")}function Ob(t,e){if(!t)throw new Error("Setting `"+e+"` requires `path` to be set too")}function sI(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const oI=(function(t){const n=this.constructor.prototype,i=n[t],s=function(){return i.apply(s,arguments)};return Object.setPrototypeOf(s,n),s}),lI={}.hasOwnProperty;class Dg extends oI{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=Y4()}copy(){const e=new Dg;let r=-1;for(;++r<this.attachers.length;){const n=this.attachers[r];e.use(...n)}return e.data(Yp(!0,{},this.namespace)),e}data(e,r){return typeof e=="string"?arguments.length===2?(ev("data",this.frozen),this.namespace[e]=r,this):lI.call(this.namespace,e)&&this.namespace[e]||void 0:e?(ev("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;const e=this;for(;++this.freezeIndex<this.attachers.length;){const[r,...n]=this.attachers[this.freezeIndex];if(n[0]===!1)continue;n[0]===!0&&(n[0]=void 0);const i=r.call(e,...n);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(e){this.freeze();const r=sc(e),n=this.parser||this.Parser;return Zp("parse",n),n(String(r),r)}process(e,r){const n=this;return this.freeze(),Zp("process",this.parser||this.Parser),Jp("process",this.compiler||this.Compiler),r?i(void 0,r):new Promise(i);function i(s,o){const a=sc(e),l=n.parse(a);n.run(l,a,function(c,h,v){if(c||!h||!v)return u(c);const d=h,x=n.stringify(d,v);hI(x)?v.value=x:v.result=x,u(c,v)});function u(c,h){c||!h?o(c):s?s(h):r(void 0,h)}}}processSync(e){let r=!1,n;return this.freeze(),Zp("processSync",this.parser||this.Parser),Jp("processSync",this.compiler||this.Compiler),this.process(e,i),jb("processSync","process",r),n;function i(s,o){r=!0,Pb(s),n=o}}run(e,r,n){Bb(e),this.freeze();const i=this.transformers;return!n&&typeof r=="function"&&(n=r,r=void 0),n?s(void 0,n):new Promise(s);function s(o,a){const l=sc(r);i.run(e,l,u);function u(c,h,v){const d=h||e;c?a(c):o?o(d):n(void 0,d,v)}}}runSync(e,r){let n=!1,i;return this.run(e,r,s),jb("runSync","run",n),i;function s(o,a){Pb(o),i=a,n=!0}}stringify(e,r){this.freeze();const n=sc(r),i=this.compiler||this.Compiler;return Jp("stringify",i),Bb(e),i(e,n)}use(e,...r){const n=this.attachers,i=this.namespace;if(ev("use",this.frozen),e!=null)if(typeof e=="function")l(e,r);else if(typeof e=="object")Array.isArray(e)?a(e):o(e);else throw new TypeError("Expected usable value, not `"+e+"`");return this;function s(u){if(typeof u=="function")l(u,[]);else if(typeof u=="object")if(Array.isArray(u)){const[c,...h]=u;l(c,h)}else o(u);else throw new TypeError("Expected usable value, not `"+u+"`")}function o(u){if(!("plugins"in u)&&!("settings"in u))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");a(u.plugins),u.settings&&(i.settings=Yp(!0,i.settings,u.settings))}function a(u){let c=-1;if(u!=null)if(Array.isArray(u))for(;++c<u.length;){const h=u[c];s(h)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function l(u,c){let h=-1,v=-1;for(;++h<n.length;)if(n[h][0]===u){v=h;break}if(v===-1)n.push([u,...c]);else if(c.length>0){let[d,...x]=c;const w=n[v][1];jv(w)&&jv(d)&&(d=Yp(!0,w,d)),n[v]=[u,d,...x]}}}}const uI=new Dg().freeze();function Zp(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function Jp(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function ev(t,e){if(e)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Bb(t){if(!jv(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function jb(t,e,r){if(!r)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function sc(t){return cI(t)?t:new WS(t)}function cI(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function hI(t){return typeof t=="string"||fI(t)}function fI(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const dI="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Fb=[],zb={allowDangerousHtml:!0},pI=/^(https?|ircs?|mailto|xmpp)$/i,vI=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function gI(t){const e=mI(t),r=yI(t);return xI(e.runSync(e.parse(r),r),t)}function mI(t){const e=t.rehypePlugins||Fb,r=t.remarkPlugins||Fb,n=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...zb}:zb;return uI().use(QP).use(r).use($4,n).use(e)}function yI(t){const e=t.children||"",r=new WS;return typeof e=="string"&&(r.value=e),r}function xI(t,e){const r=e.allowedElements,n=e.allowElement,i=e.components,s=e.disallowedElements,o=e.skipHtml,a=e.unwrapDisallowed,l=e.urlTransform||bI;for(const c of vI)Object.hasOwn(e,c.from)&&(""+c.from+(c.to?"use `"+c.to+"` instead":"remove it")+dI+c.id,void 0);return Lg(t,u),PM(t,{Fragment:_.Fragment,components:i,ignoreInvalidStyle:!0,jsx:_.jsx,jsxs:_.jsxs,passKeys:!0,passNode:!0});function u(c,h,v){if(c.type==="raw"&&v&&typeof h=="number")return o?v.children.splice(h,1):v.children[h]={type:"text",value:c.value},h;if(c.type==="element"){let d;for(d in Vp)if(Object.hasOwn(Vp,d)&&Object.hasOwn(c.properties,d)){const x=c.properties[d],w=Vp[d];(w===null||w.includes(c.tagName))&&(c.properties[d]=l(String(x||""),d,c))}}if(c.type==="element"){let d=r?!r.includes(c.tagName):s?s.includes(c.tagName):!1;if(!d&&n&&typeof h=="number"&&(d=!n(c,h,v)),d&&v&&typeof h=="number")return a&&c.children?v.children.splice(h,1,...c.children):v.children.splice(h,1),h}}}function bI(t){const e=t.indexOf(":"),r=t.indexOf("?"),n=t.indexOf("#"),i=t.indexOf("/");return e===-1||i!==-1&&e>i||r!==-1&&e>r||n!==-1&&e>n||pI.test(t.slice(0,e))?t:""}function Hb(t,e){const r=String(t);if(typeof e!="string")throw new TypeError("Expected character");let n=0,i=r.indexOf(e);for(;i!==-1;)n++,i=r.indexOf(e,i+e.length);return n}function wI(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function _I(t,e,r){const i=fh((r||{}).ignore||[]),s=SI(e);let o=-1;for(;++o<s.length;)US(t,"text",a);function a(u,c){let h=-1,v;for(;++h<c.length;){const d=c[h],x=v?v.children:void 0;if(i(d,x?x.indexOf(d):void 0,v))return;v=d}if(v)return l(u,c)}function l(u,c){const h=c[c.length-1],v=s[o][0],d=s[o][1];let x=0;const g=h.children.indexOf(u);let m=!1,y=[];v.lastIndex=0;let b=v.exec(u.value);for(;b;){const S=b.index,N={index:b.index,input:b.input,stack:[...c,u]};let E=d(...b,N);if(typeof E=="string"&&(E=E.length>0?{type:"text",value:E}:void 0),E===!1?v.lastIndex=S+1:(x!==S&&y.push({type:"text",value:u.value.slice(x,S)}),Array.isArray(E)?y.push(...E):E&&y.push(E),x=S+b[0].length,m=!0),!v.global)break;b=v.exec(u.value)}return m?(x<u.value.length&&y.push({type:"text",value:u.value.slice(x)}),h.children.splice(g,1,...y)):y=[u],g+y.length}}function SI(t){const e=[];if(!Array.isArray(t))throw new TypeError("Expected find and replace tuple or list of tuples");const r=!t[0]||Array.isArray(t[0])?t:[t];let n=-1;for(;++n<r.length;){const i=r[n];e.push([CI(i[0]),EI(i[1])])}return e}function CI(t){return typeof t=="string"?new RegExp(wI(t),"g"):t}function EI(t){return typeof t=="function"?t:function(){return t}}const tv="phrasing",rv=["autolink","link","image","label"];function kI(){return{transforms:[MI],enter:{literalAutolink:NI,literalAutolinkEmail:nv,literalAutolinkHttp:nv,literalAutolinkWww:nv},exit:{literalAutolink:AI,literalAutolinkEmail:DI,literalAutolinkHttp:RI,literalAutolinkWww:LI}}}function TI(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:tv,notInConstruct:rv},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:tv,notInConstruct:rv},{character:":",before:"[ps]",after:"\\/",inConstruct:tv,notInConstruct:rv}]}}function NI(t){this.enter({type:"link",title:null,url:"",children:[]},t)}function nv(t){this.config.enter.autolinkProtocol.call(this,t)}function RI(t){this.config.exit.autolinkProtocol.call(this,t)}function LI(t){this.config.exit.data.call(this,t);const e=this.stack[this.stack.length-1];e.type,e.url="http://"+this.sliceSerialize(t)}function DI(t){this.config.exit.autolinkEmail.call(this,t)}function AI(t){this.exit(t)}function MI(t){_I(t,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,PI],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),II]],{ignore:["link","linkReference"]})}function PI(t,e,r,n,i){let s="";if(!VS(i)||(/^w/i.test(e)&&(r=e+r,e="",s="http://"),!OI(r)))return!1;const o=BI(r+n);if(!o[0])return!1;const a={type:"link",title:null,url:s+e+o[0],children:[{type:"text",value:e+o[0]}]};return o[1]?[a,{type:"text",value:o[1]}]:a}function II(t,e,r,n){return!VS(n,!0)||/[-\d_]$/.test(r)?!1:{type:"link",title:null,url:"mailto:"+e+"@"+r,children:[{type:"text",value:e+"@"+r}]}}function OI(t){const e=t.split(".");return!(e.length<2||e[e.length-1]&&(/_/.test(e[e.length-1])||!/[a-zA-Z\d]/.test(e[e.length-1]))||e[e.length-2]&&(/_/.test(e[e.length-2])||!/[a-zA-Z\d]/.test(e[e.length-2])))}function BI(t){const e=/[!"&'),.:;<>?\]}]+$/.exec(t);if(!e)return[t,void 0];t=t.slice(0,e.index);let r=e[0],n=r.indexOf(")");const i=Hb(t,"(");let s=Hb(t,")");for(;n!==-1&&i>s;)t+=r.slice(0,n+1),r=r.slice(n+1),n=r.indexOf(")"),s++;return[t,r]}function VS(t,e){const r=t.input.charCodeAt(t.index-1);return(t.index===0||Wa(r)||uh(r))&&(!e||r!==47)}$S.peek=GI;function jI(){this.buffer()}function FI(t){this.enter({type:"footnoteReference",identifier:"",label:""},t)}function zI(){this.buffer()}function HI(t){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},t)}function UI(t){const e=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=Hn(this.sliceSerialize(t)).toLowerCase(),r.label=e}function WI(t){this.exit(t)}function VI(t){const e=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=Hn(this.sliceSerialize(t)).toLowerCase(),r.label=e}function $I(t){this.exit(t)}function GI(){return"["}function $S(t,e,r,n){const i=r.createTracker(n);let s=i.move("[^");const o=r.enter("footnoteReference"),a=r.enter("reference");return s+=i.move(r.safe(r.associationId(t),{after:"]",before:s})),a(),o(),s+=i.move("]"),s}function qI(){return{enter:{gfmFootnoteCallString:jI,gfmFootnoteCall:FI,gfmFootnoteDefinitionLabelString:zI,gfmFootnoteDefinition:HI},exit:{gfmFootnoteCallString:UI,gfmFootnoteCall:WI,gfmFootnoteDefinitionLabelString:VI,gfmFootnoteDefinition:$I}}}function YI(t){let e=!1;return t&&t.firstLineBlank&&(e=!0),{handlers:{footnoteDefinition:r,footnoteReference:$S},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function r(n,i,s,o){const a=s.createTracker(o);let l=a.move("[^");const u=s.enter("footnoteDefinition"),c=s.enter("label");return l+=a.move(s.safe(s.associationId(n),{before:l,after:"]"})),c(),l+=a.move("]:"),n.children&&n.children.length>0&&(a.shift(4),l+=a.move((e?`
403
- `:" ")+s.indentLines(s.containerFlow(n,a.current()),e?GS:XI))),u(),l}}function XI(t,e,r){return e===0?t:GS(t,e,r)}function GS(t,e,r){return(r?"":" ")+t}const KI=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];qS.peek=tO;function QI(){return{canContainEols:["delete"],enter:{strikethrough:JI},exit:{strikethrough:eO}}}function ZI(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:KI}],handlers:{delete:qS}}}function JI(t){this.enter({type:"delete",children:[]},t)}function eO(t){this.exit(t)}function qS(t,e,r,n){const i=r.createTracker(n),s=r.enter("strikethrough");let o=i.move("~~");return o+=r.containerPhrasing(t,{...i.current(),before:o,after:"~"}),o+=i.move("~~"),s(),o}function tO(){return"~"}function rO(t){return t.length}function nO(t,e){const r=e||{},n=(r.align||[]).concat(),i=r.stringLength||rO,s=[],o=[],a=[],l=[];let u=0,c=-1;for(;++c<t.length;){const w=[],g=[];let m=-1;for(t[c].length>u&&(u=t[c].length);++m<t[c].length;){const y=iO(t[c][m]);if(r.alignDelimiters!==!1){const b=i(y);g[m]=b,(l[m]===void 0||b>l[m])&&(l[m]=b)}w.push(y)}o[c]=w,a[c]=g}let h=-1;if(typeof n=="object"&&"length"in n)for(;++h<u;)s[h]=Ub(n[h]);else{const w=Ub(n);for(;++h<u;)s[h]=w}h=-1;const v=[],d=[];for(;++h<u;){const w=s[h];let g="",m="";w===99?(g=":",m=":"):w===108?g=":":w===114&&(m=":");let y=r.alignDelimiters===!1?1:Math.max(1,l[h]-g.length-m.length);const b=g+"-".repeat(y)+m;r.alignDelimiters!==!1&&(y=g.length+y+m.length,y>l[h]&&(l[h]=y),d[h]=y),v[h]=b}o.splice(1,0,v),a.splice(1,0,d),c=-1;const x=[];for(;++c<o.length;){const w=o[c],g=a[c];h=-1;const m=[];for(;++h<u;){const y=w[h]||"";let b="",S="";if(r.alignDelimiters!==!1){const N=l[h]-(g[h]||0),E=s[h];E===114?b=" ".repeat(N):E===99?N%2?(b=" ".repeat(N/2+.5),S=" ".repeat(N/2-.5)):(b=" ".repeat(N/2),S=b):S=" ".repeat(N)}r.delimiterStart!==!1&&!h&&m.push("|"),r.padding!==!1&&!(r.alignDelimiters===!1&&y==="")&&(r.delimiterStart!==!1||h)&&m.push(" "),r.alignDelimiters!==!1&&m.push(b),m.push(y),r.alignDelimiters!==!1&&m.push(S),r.padding!==!1&&m.push(" "),(r.delimiterEnd!==!1||h!==u-1)&&m.push("|")}x.push(r.delimiterEnd===!1?m.join("").replace(/ +$/,""):m.join(""))}return x.join(`
404
- `)}function iO(t){return t==null?"":String(t)}function Ub(t){const e=typeof t=="string"?t.codePointAt(0):0;return e===67||e===99?99:e===76||e===108?108:e===82||e===114?114:0}function aO(t,e,r,n){const i=r.enter("blockquote"),s=r.createTracker(n);s.move("> "),s.shift(2);const o=r.indentLines(r.containerFlow(t,s.current()),sO);return i(),o}function sO(t,e,r){return">"+(r?"":" ")+t}function oO(t,e){return Wb(t,e.inConstruct,!0)&&!Wb(t,e.notInConstruct,!1)}function Wb(t,e,r){if(typeof e=="string"&&(e=[e]),!e||e.length===0)return r;let n=-1;for(;++n<e.length;)if(t.includes(e[n]))return!0;return!1}function Vb(t,e,r,n){let i=-1;for(;++i<r.unsafe.length;)if(r.unsafe[i].character===`
405
- `&&oO(r.stack,r.unsafe[i]))return/[ \t]/.test(n.before)?"":" ";return`\\
406
- `}function lO(t,e){const r=String(t);let n=r.indexOf(e),i=n,s=0,o=0;if(typeof e!="string")throw new TypeError("Expected substring");for(;n!==-1;)n===i?++s>o&&(o=s):s=1,i=n+e.length,n=r.indexOf(e,i);return o}function uO(t,e){return!!(e.options.fences===!1&&t.value&&!t.lang&&/[^ \r\n]/.test(t.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(t.value))}function cO(t){const e=t.options.fence||"`";if(e!=="`"&&e!=="~")throw new Error("Cannot serialize code with `"+e+"` for `options.fence`, expected `` ` `` or `~`");return e}function hO(t,e,r,n){const i=cO(r),s=t.value||"",o=i==="`"?"GraveAccent":"Tilde";if(uO(t,r)){const h=r.enter("codeIndented"),v=r.indentLines(s,fO);return h(),v}const a=r.createTracker(n),l=i.repeat(Math.max(lO(s,i)+1,3)),u=r.enter("codeFenced");let c=a.move(l);if(t.lang){const h=r.enter(`codeFencedLang${o}`);c+=a.move(r.safe(t.lang,{before:c,after:" ",encode:["`"],...a.current()})),h()}if(t.lang&&t.meta){const h=r.enter(`codeFencedMeta${o}`);c+=a.move(" "),c+=a.move(r.safe(t.meta,{before:c,after:`
407
- `,encode:["`"],...a.current()})),h()}return c+=a.move(`
408
- `),s&&(c+=a.move(s+`
409
- `)),c+=a.move(l),u(),c}function fO(t,e,r){return(r?"":" ")+t}function Ag(t){const e=t.options.quote||'"';if(e!=='"'&&e!=="'")throw new Error("Cannot serialize title with `"+e+"` for `options.quote`, expected `\"`, or `'`");return e}function dO(t,e,r,n){const i=Ag(r),s=i==='"'?"Quote":"Apostrophe",o=r.enter("definition");let a=r.enter("label");const l=r.createTracker(n);let u=l.move("[");return u+=l.move(r.safe(r.associationId(t),{before:u,after:"]",...l.current()})),u+=l.move("]: "),a(),!t.url||/[\0- \u007F]/.test(t.url)?(a=r.enter("destinationLiteral"),u+=l.move("<"),u+=l.move(r.safe(t.url,{before:u,after:">",...l.current()})),u+=l.move(">")):(a=r.enter("destinationRaw"),u+=l.move(r.safe(t.url,{before:u,after:t.title?" ":`
410
- `,...l.current()}))),a(),t.title&&(a=r.enter(`title${s}`),u+=l.move(" "+i),u+=l.move(r.safe(t.title,{before:u,after:i,...l.current()})),u+=l.move(i),a()),o(),u}function pO(t){const e=t.options.emphasis||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize emphasis with `"+e+"` for `options.emphasis`, expected `*`, or `_`");return e}function _l(t){return"&#x"+t.toString(16).toUpperCase()+";"}function Wc(t,e,r){const n=Gs(t),i=Gs(e);return n===void 0?i===void 0?r==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:n===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}YS.peek=vO;function YS(t,e,r,n){const i=pO(r),s=r.enter("emphasis"),o=r.createTracker(n),a=o.move(i);let l=o.move(r.containerPhrasing(t,{after:i,before:a,...o.current()}));const u=l.charCodeAt(0),c=Wc(n.before.charCodeAt(n.before.length-1),u,i);c.inside&&(l=_l(u)+l.slice(1));const h=l.charCodeAt(l.length-1),v=Wc(n.after.charCodeAt(0),h,i);v.inside&&(l=l.slice(0,-1)+_l(h));const d=o.move(i);return s(),r.attentionEncodeSurroundingInfo={after:v.outside,before:c.outside},a+l+d}function vO(t,e,r){return r.options.emphasis||"*"}function gO(t,e){let r=!1;return Lg(t,function(n){if("value"in n&&/\r?\n|\r/.test(n.value)||n.type==="break")return r=!0,Ov}),!!((!t.depth||t.depth<3)&&Sg(t)&&(e.options.setext||r))}function mO(t,e,r,n){const i=Math.max(Math.min(6,t.depth||1),1),s=r.createTracker(n);if(gO(t,r)){const c=r.enter("headingSetext"),h=r.enter("phrasing"),v=r.containerPhrasing(t,{...s.current(),before:`
411
- `,after:`
412
- `});return h(),c(),v+`
413
- `+(i===1?"=":"-").repeat(v.length-(Math.max(v.lastIndexOf("\r"),v.lastIndexOf(`
414
- `))+1))}const o="#".repeat(i),a=r.enter("headingAtx"),l=r.enter("phrasing");s.move(o+" ");let u=r.containerPhrasing(t,{before:"# ",after:`
415
- `,...s.current()});return/^[\t ]/.test(u)&&(u=_l(u.charCodeAt(0))+u.slice(1)),u=u?o+" "+u:o,r.options.closeAtx&&(u+=" "+o),l(),a(),u}XS.peek=yO;function XS(t){return t.value||""}function yO(){return"<"}KS.peek=xO;function KS(t,e,r,n){const i=Ag(r),s=i==='"'?"Quote":"Apostrophe",o=r.enter("image");let a=r.enter("label");const l=r.createTracker(n);let u=l.move("![");return u+=l.move(r.safe(t.alt,{before:u,after:"]",...l.current()})),u+=l.move("]("),a(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(a=r.enter("destinationLiteral"),u+=l.move("<"),u+=l.move(r.safe(t.url,{before:u,after:">",...l.current()})),u+=l.move(">")):(a=r.enter("destinationRaw"),u+=l.move(r.safe(t.url,{before:u,after:t.title?" ":")",...l.current()}))),a(),t.title&&(a=r.enter(`title${s}`),u+=l.move(" "+i),u+=l.move(r.safe(t.title,{before:u,after:i,...l.current()})),u+=l.move(i),a()),u+=l.move(")"),o(),u}function xO(){return"!"}QS.peek=bO;function QS(t,e,r,n){const i=t.referenceType,s=r.enter("imageReference");let o=r.enter("label");const a=r.createTracker(n);let l=a.move("![");const u=r.safe(t.alt,{before:l,after:"]",...a.current()});l+=a.move(u+"]["),o();const c=r.stack;r.stack=[],o=r.enter("reference");const h=r.safe(r.associationId(t),{before:l,after:"]",...a.current()});return o(),r.stack=c,s(),i==="full"||!u||u!==h?l+=a.move(h+"]"):i==="shortcut"?l=l.slice(0,-1):l+=a.move("]"),l}function bO(){return"!"}ZS.peek=wO;function ZS(t,e,r){let n=t.value||"",i="`",s=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(n);)i+="`";for(/[^ \r\n]/.test(n)&&(/^[ \r\n]/.test(n)&&/[ \r\n]$/.test(n)||/^`|`$/.test(n))&&(n=" "+n+" ");++s<r.unsafe.length;){const o=r.unsafe[s],a=r.compilePattern(o);let l;if(o.atBreak)for(;l=a.exec(n);){let u=l.index;n.charCodeAt(u)===10&&n.charCodeAt(u-1)===13&&u--,n=n.slice(0,u)+" "+n.slice(l.index+1)}}return i+n+i}function wO(){return"`"}function JS(t,e){const r=Sg(t);return!!(!e.options.resourceLink&&t.url&&!t.title&&t.children&&t.children.length===1&&t.children[0].type==="text"&&(r===t.url||"mailto:"+r===t.url)&&/^[a-z][a-z+.-]+:/i.test(t.url)&&!/[\0- <>\u007F]/.test(t.url))}e2.peek=_O;function e2(t,e,r,n){const i=Ag(r),s=i==='"'?"Quote":"Apostrophe",o=r.createTracker(n);let a,l;if(JS(t,r)){const c=r.stack;r.stack=[],a=r.enter("autolink");let h=o.move("<");return h+=o.move(r.containerPhrasing(t,{before:h,after:">",...o.current()})),h+=o.move(">"),a(),r.stack=c,h}a=r.enter("link"),l=r.enter("label");let u=o.move("[");return u+=o.move(r.containerPhrasing(t,{before:u,after:"](",...o.current()})),u+=o.move("]("),l(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(l=r.enter("destinationLiteral"),u+=o.move("<"),u+=o.move(r.safe(t.url,{before:u,after:">",...o.current()})),u+=o.move(">")):(l=r.enter("destinationRaw"),u+=o.move(r.safe(t.url,{before:u,after:t.title?" ":")",...o.current()}))),l(),t.title&&(l=r.enter(`title${s}`),u+=o.move(" "+i),u+=o.move(r.safe(t.title,{before:u,after:i,...o.current()})),u+=o.move(i),l()),u+=o.move(")"),a(),u}function _O(t,e,r){return JS(t,r)?"<":"["}t2.peek=SO;function t2(t,e,r,n){const i=t.referenceType,s=r.enter("linkReference");let o=r.enter("label");const a=r.createTracker(n);let l=a.move("[");const u=r.containerPhrasing(t,{before:l,after:"]",...a.current()});l+=a.move(u+"]["),o();const c=r.stack;r.stack=[],o=r.enter("reference");const h=r.safe(r.associationId(t),{before:l,after:"]",...a.current()});return o(),r.stack=c,s(),i==="full"||!u||u!==h?l+=a.move(h+"]"):i==="shortcut"?l=l.slice(0,-1):l+=a.move("]"),l}function SO(){return"["}function Mg(t){const e=t.options.bullet||"*";if(e!=="*"&&e!=="+"&&e!=="-")throw new Error("Cannot serialize items with `"+e+"` for `options.bullet`, expected `*`, `+`, or `-`");return e}function CO(t){const e=Mg(t),r=t.options.bulletOther;if(!r)return e==="*"?"-":"*";if(r!=="*"&&r!=="+"&&r!=="-")throw new Error("Cannot serialize items with `"+r+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(r===e)throw new Error("Expected `bullet` (`"+e+"`) and `bulletOther` (`"+r+"`) to be different");return r}function EO(t){const e=t.options.bulletOrdered||".";if(e!=="."&&e!==")")throw new Error("Cannot serialize items with `"+e+"` for `options.bulletOrdered`, expected `.` or `)`");return e}function r2(t){const e=t.options.rule||"*";if(e!=="*"&&e!=="-"&&e!=="_")throw new Error("Cannot serialize rules with `"+e+"` for `options.rule`, expected `*`, `-`, or `_`");return e}function kO(t,e,r,n){const i=r.enter("list"),s=r.bulletCurrent;let o=t.ordered?EO(r):Mg(r);const a=t.ordered?o==="."?")":".":CO(r);let l=e&&r.bulletLastUsed?o===r.bulletLastUsed:!1;if(!t.ordered){const c=t.children?t.children[0]:void 0;if((o==="*"||o==="-")&&c&&(!c.children||!c.children[0])&&r.stack[r.stack.length-1]==="list"&&r.stack[r.stack.length-2]==="listItem"&&r.stack[r.stack.length-3]==="list"&&r.stack[r.stack.length-4]==="listItem"&&r.indexStack[r.indexStack.length-1]===0&&r.indexStack[r.indexStack.length-2]===0&&r.indexStack[r.indexStack.length-3]===0&&(l=!0),r2(r)===o&&c){let h=-1;for(;++h<t.children.length;){const v=t.children[h];if(v&&v.type==="listItem"&&v.children&&v.children[0]&&v.children[0].type==="thematicBreak"){l=!0;break}}}}l&&(o=a),r.bulletCurrent=o;const u=r.containerFlow(t,n);return r.bulletLastUsed=o,r.bulletCurrent=s,i(),u}function TO(t){const e=t.options.listItemIndent||"one";if(e!=="tab"&&e!=="one"&&e!=="mixed")throw new Error("Cannot serialize items with `"+e+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return e}function NO(t,e,r,n){const i=TO(r);let s=r.bulletCurrent||Mg(r);e&&e.type==="list"&&e.ordered&&(s=(typeof e.start=="number"&&e.start>-1?e.start:1)+(r.options.incrementListMarker===!1?0:e.children.indexOf(t))+s);let o=s.length+1;(i==="tab"||i==="mixed"&&(e&&e.type==="list"&&e.spread||t.spread))&&(o=Math.ceil(o/4)*4);const a=r.createTracker(n);a.move(s+" ".repeat(o-s.length)),a.shift(o);const l=r.enter("listItem"),u=r.indentLines(r.containerFlow(t,a.current()),c);return l(),u;function c(h,v,d){return v?(d?"":" ".repeat(o))+h:(d?s:s+" ".repeat(o-s.length))+h}}function RO(t,e,r,n){const i=r.enter("paragraph"),s=r.enter("phrasing"),o=r.containerPhrasing(t,n);return s(),i(),o}const LO=fh(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function DO(t,e,r,n){return(t.children.some(function(o){return LO(o)})?r.containerPhrasing:r.containerFlow).call(r,t,n)}function AO(t){const e=t.options.strong||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize strong with `"+e+"` for `options.strong`, expected `*`, or `_`");return e}n2.peek=MO;function n2(t,e,r,n){const i=AO(r),s=r.enter("strong"),o=r.createTracker(n),a=o.move(i+i);let l=o.move(r.containerPhrasing(t,{after:i,before:a,...o.current()}));const u=l.charCodeAt(0),c=Wc(n.before.charCodeAt(n.before.length-1),u,i);c.inside&&(l=_l(u)+l.slice(1));const h=l.charCodeAt(l.length-1),v=Wc(n.after.charCodeAt(0),h,i);v.inside&&(l=l.slice(0,-1)+_l(h));const d=o.move(i+i);return s(),r.attentionEncodeSurroundingInfo={after:v.outside,before:c.outside},a+l+d}function MO(t,e,r){return r.options.strong||"*"}function PO(t,e,r,n){return r.safe(t.value,n)}function IO(t){const e=t.options.ruleRepetition||3;if(e<3)throw new Error("Cannot serialize rules with repetition `"+e+"` for `options.ruleRepetition`, expected `3` or more");return e}function OO(t,e,r){const n=(r2(r)+(r.options.ruleSpaces?" ":"")).repeat(IO(r));return r.options.ruleSpaces?n.slice(0,-1):n}const i2={blockquote:aO,break:Vb,code:hO,definition:dO,emphasis:YS,hardBreak:Vb,heading:mO,html:XS,image:KS,imageReference:QS,inlineCode:ZS,link:e2,linkReference:t2,list:kO,listItem:NO,paragraph:RO,root:DO,strong:n2,text:PO,thematicBreak:OO};function BO(){return{enter:{table:jO,tableData:$b,tableHeader:$b,tableRow:zO},exit:{codeText:HO,table:FO,tableData:iv,tableHeader:iv,tableRow:iv}}}function jO(t){const e=t._align;this.enter({type:"table",align:e.map(function(r){return r==="none"?null:r}),children:[]},t),this.data.inTable=!0}function FO(t){this.exit(t),this.data.inTable=void 0}function zO(t){this.enter({type:"tableRow",children:[]},t)}function iv(t){this.exit(t)}function $b(t){this.enter({type:"tableCell",children:[]},t)}function HO(t){let e=this.resume();this.data.inTable&&(e=e.replace(/\\([\\|])/g,UO));const r=this.stack[this.stack.length-1];r.type,r.value=e,this.exit(t)}function UO(t,e){return e==="|"?e:t}function WO(t){const e=t||{},r=e.tableCellPadding,n=e.tablePipeAlign,i=e.stringLength,s=r?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
416
- `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:v,table:o,tableCell:l,tableRow:a}};function o(d,x,w,g){return u(c(d,w,g),d.align)}function a(d,x,w,g){const m=h(d,w,g),y=u([m]);return y.slice(0,y.indexOf(`
417
- `))}function l(d,x,w,g){const m=w.enter("tableCell"),y=w.enter("phrasing"),b=w.containerPhrasing(d,{...g,before:s,after:s});return y(),m(),b}function u(d,x){return nO(d,{align:x,alignDelimiters:n,padding:r,stringLength:i})}function c(d,x,w){const g=d.children;let m=-1;const y=[],b=x.enter("table");for(;++m<g.length;)y[m]=h(g[m],x,w);return b(),y}function h(d,x,w){const g=d.children;let m=-1;const y=[],b=x.enter("tableRow");for(;++m<g.length;)y[m]=l(g[m],d,x,w);return b(),y}function v(d,x,w){let g=i2.inlineCode(d,x,w);return w.stack.includes("tableCell")&&(g=g.replace(/\|/g,"\\$&")),g}}function VO(){return{exit:{taskListCheckValueChecked:Gb,taskListCheckValueUnchecked:Gb,paragraph:GO}}}function $O(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:qO}}}function Gb(t){const e=this.stack[this.stack.length-2];e.type,e.checked=t.type==="taskListCheckValueChecked"}function GO(t){const e=this.stack[this.stack.length-2];if(e&&e.type==="listItem"&&typeof e.checked=="boolean"){const r=this.stack[this.stack.length-1];r.type;const n=r.children[0];if(n&&n.type==="text"){const i=e.children;let s=-1,o;for(;++s<i.length;){const a=i[s];if(a.type==="paragraph"){o=a;break}}o===r&&(n.value=n.value.slice(1),n.value.length===0?r.children.shift():r.position&&n.position&&typeof n.position.start.offset=="number"&&(n.position.start.column++,n.position.start.offset++,r.position.start=Object.assign({},n.position.start)))}}this.exit(t)}function qO(t,e,r,n){const i=t.children[0],s=typeof t.checked=="boolean"&&i&&i.type==="paragraph",o="["+(t.checked?"x":" ")+"] ",a=r.createTracker(n);s&&a.move(o);let l=i2.listItem(t,e,r,{...n,...a.current()});return s&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,u)),l;function u(c){return c+o}}function YO(){return[kI(),qI(),QI(),BO(),VO()]}function XO(t){return{extensions:[TI(),YI(t),ZI(),WO(t),$O()]}}const KO={tokenize:rB,partial:!0},a2={tokenize:nB,partial:!0},s2={tokenize:iB,partial:!0},o2={tokenize:aB,partial:!0},QO={tokenize:sB,partial:!0},l2={name:"wwwAutolink",tokenize:eB,previous:c2},u2={name:"protocolAutolink",tokenize:tB,previous:h2},bi={name:"emailAutolink",tokenize:JO,previous:f2},ii={};function ZO(){return{text:ii}}let Na=48;for(;Na<123;)ii[Na]=bi,Na++,Na===58?Na=65:Na===91&&(Na=97);ii[43]=bi;ii[45]=bi;ii[46]=bi;ii[95]=bi;ii[72]=[bi,u2];ii[104]=[bi,u2];ii[87]=[bi,l2];ii[119]=[bi,l2];function JO(t,e,r){const n=this;let i,s;return o;function o(h){return!zv(h)||!f2.call(n,n.previous)||Pg(n.events)?r(h):(t.enter("literalAutolink"),t.enter("literalAutolinkEmail"),a(h))}function a(h){return zv(h)?(t.consume(h),a):h===64?(t.consume(h),l):r(h)}function l(h){return h===46?t.check(QO,c,u)(h):h===45||h===95||zr(h)?(s=!0,t.consume(h),l):c(h)}function u(h){return t.consume(h),i=!0,l}function c(h){return s&&i&&Kr(n.previous)?(t.exit("literalAutolinkEmail"),t.exit("literalAutolink"),e(h)):r(h)}}function eB(t,e,r){const n=this;return i;function i(o){return o!==87&&o!==119||!c2.call(n,n.previous)||Pg(n.events)?r(o):(t.enter("literalAutolink"),t.enter("literalAutolinkWww"),t.check(KO,t.attempt(a2,t.attempt(s2,s),r),r)(o))}function s(o){return t.exit("literalAutolinkWww"),t.exit("literalAutolink"),e(o)}}function tB(t,e,r){const n=this;let i="",s=!1;return o;function o(h){return(h===72||h===104)&&h2.call(n,n.previous)&&!Pg(n.events)?(t.enter("literalAutolink"),t.enter("literalAutolinkHttp"),i+=String.fromCodePoint(h),t.consume(h),a):r(h)}function a(h){if(Kr(h)&&i.length<5)return i+=String.fromCodePoint(h),t.consume(h),a;if(h===58){const v=i.toLowerCase();if(v==="http"||v==="https")return t.consume(h),l}return r(h)}function l(h){return h===47?(t.consume(h),s?u:(s=!0,l)):r(h)}function u(h){return h===null||zc(h)||Vt(h)||Wa(h)||uh(h)?r(h):t.attempt(a2,t.attempt(s2,c),r)(h)}function c(h){return t.exit("literalAutolinkHttp"),t.exit("literalAutolink"),e(h)}}function rB(t,e,r){let n=0;return i;function i(o){return(o===87||o===119)&&n<3?(n++,t.consume(o),i):o===46&&n===3?(t.consume(o),s):r(o)}function s(o){return o===null?r(o):e(o)}}function nB(t,e,r){let n,i,s;return o;function o(u){return u===46||u===95?t.check(o2,l,a)(u):u===null||Vt(u)||Wa(u)||u!==45&&uh(u)?l(u):(s=!0,t.consume(u),o)}function a(u){return u===95?n=!0:(i=n,n=void 0),t.consume(u),o}function l(u){return i||n||!s?r(u):e(u)}}function iB(t,e){let r=0,n=0;return i;function i(o){return o===40?(r++,t.consume(o),i):o===41&&n<r?s(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?t.check(o2,e,s)(o):o===null||Vt(o)||Wa(o)?e(o):(t.consume(o),i)}function s(o){return o===41&&n++,t.consume(o),i}}function aB(t,e,r){return n;function n(a){return a===33||a===34||a===39||a===41||a===42||a===44||a===46||a===58||a===59||a===63||a===95||a===126?(t.consume(a),n):a===38?(t.consume(a),s):a===93?(t.consume(a),i):a===60||a===null||Vt(a)||Wa(a)?e(a):r(a)}function i(a){return a===null||a===40||a===91||Vt(a)||Wa(a)?e(a):n(a)}function s(a){return Kr(a)?o(a):r(a)}function o(a){return a===59?(t.consume(a),n):Kr(a)?(t.consume(a),o):r(a)}}function sB(t,e,r){return n;function n(s){return t.consume(s),i}function i(s){return zr(s)?r(s):e(s)}}function c2(t){return t===null||t===40||t===42||t===95||t===91||t===93||t===126||Vt(t)}function h2(t){return!Kr(t)}function f2(t){return!(t===47||zv(t))}function zv(t){return t===43||t===45||t===46||t===95||zr(t)}function Pg(t){let e=t.length,r=!1;for(;e--;){const n=t[e][1];if((n.type==="labelLink"||n.type==="labelImage")&&!n._balanced){r=!0;break}if(n._gfmAutolinkLiteralWalkedInto){r=!1;break}}return t.length>0&&!r&&(t[t.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),r}const oB={tokenize:vB,partial:!0};function lB(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:fB,continuation:{tokenize:dB},exit:pB}},text:{91:{name:"gfmFootnoteCall",tokenize:hB},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:uB,resolveTo:cB}}}}function uB(t,e,r){const n=this;let i=n.events.length;const s=n.parser.gfmFootnotes||(n.parser.gfmFootnotes=[]);let o;for(;i--;){const l=n.events[i][1];if(l.type==="labelImage"){o=l;break}if(l.type==="gfmFootnoteCall"||l.type==="labelLink"||l.type==="label"||l.type==="image"||l.type==="link")break}return a;function a(l){if(!o||!o._balanced)return r(l);const u=Hn(n.sliceSerialize({start:o.end,end:n.now()}));return u.codePointAt(0)!==94||!s.includes(u.slice(1))?r(l):(t.enter("gfmFootnoteCallLabelMarker"),t.consume(l),t.exit("gfmFootnoteCallLabelMarker"),e(l))}}function cB(t,e){let r=t.length;for(;r--;)if(t[r][1].type==="labelImage"&&t[r][0]==="enter"){t[r][1];break}t[r+1][1].type="data",t[r+3][1].type="gfmFootnoteCallLabelMarker";const n={type:"gfmFootnoteCall",start:Object.assign({},t[r+3][1].start),end:Object.assign({},t[t.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},t[r+3][1].end),end:Object.assign({},t[r+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const s={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},t[t.length-1][1].start)},o={type:"chunkString",contentType:"string",start:Object.assign({},s.start),end:Object.assign({},s.end)},a=[t[r+1],t[r+2],["enter",n,e],t[r+3],t[r+4],["enter",i,e],["exit",i,e],["enter",s,e],["enter",o,e],["exit",o,e],["exit",s,e],t[t.length-2],t[t.length-1],["exit",n,e]];return t.splice(r,t.length-r+1,...a),t}function hB(t,e,r){const n=this,i=n.parser.gfmFootnotes||(n.parser.gfmFootnotes=[]);let s=0,o;return a;function a(h){return t.enter("gfmFootnoteCall"),t.enter("gfmFootnoteCallLabelMarker"),t.consume(h),t.exit("gfmFootnoteCallLabelMarker"),l}function l(h){return h!==94?r(h):(t.enter("gfmFootnoteCallMarker"),t.consume(h),t.exit("gfmFootnoteCallMarker"),t.enter("gfmFootnoteCallString"),t.enter("chunkString").contentType="string",u)}function u(h){if(s>999||h===93&&!o||h===null||h===91||Vt(h))return r(h);if(h===93){t.exit("chunkString");const v=t.exit("gfmFootnoteCallString");return i.includes(Hn(n.sliceSerialize(v)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(h),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),e):r(h)}return Vt(h)||(o=!0),s++,t.consume(h),h===92?c:u}function c(h){return h===91||h===92||h===93?(t.consume(h),s++,u):u(h)}}function fB(t,e,r){const n=this,i=n.parser.gfmFootnotes||(n.parser.gfmFootnotes=[]);let s,o=0,a;return l;function l(x){return t.enter("gfmFootnoteDefinition")._container=!0,t.enter("gfmFootnoteDefinitionLabel"),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(x),t.exit("gfmFootnoteDefinitionLabelMarker"),u}function u(x){return x===94?(t.enter("gfmFootnoteDefinitionMarker"),t.consume(x),t.exit("gfmFootnoteDefinitionMarker"),t.enter("gfmFootnoteDefinitionLabelString"),t.enter("chunkString").contentType="string",c):r(x)}function c(x){if(o>999||x===93&&!a||x===null||x===91||Vt(x))return r(x);if(x===93){t.exit("chunkString");const w=t.exit("gfmFootnoteDefinitionLabelString");return s=Hn(n.sliceSerialize(w)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(x),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),v}return Vt(x)||(a=!0),o++,t.consume(x),x===92?h:c}function h(x){return x===91||x===92||x===93?(t.consume(x),o++,c):c(x)}function v(x){return x===58?(t.enter("definitionMarker"),t.consume(x),t.exit("definitionMarker"),i.includes(s)||i.push(s),Nt(t,d,"gfmFootnoteDefinitionWhitespace")):r(x)}function d(x){return e(x)}}function dB(t,e,r){return t.check(Ol,e,t.attempt(oB,e,r))}function pB(t){t.exit("gfmFootnoteDefinition")}function vB(t,e,r){const n=this;return Nt(t,i,"gfmFootnoteDefinitionIndent",5);function i(s){const o=n.events[n.events.length-1];return o&&o[1].type==="gfmFootnoteDefinitionIndent"&&o[2].sliceSerialize(o[1],!0).length===4?e(s):r(s)}}function gB(t){let r=(t||{}).singleTilde;const n={name:"strikethrough",tokenize:s,resolveAll:i};return r==null&&(r=!0),{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function i(o,a){let l=-1;for(;++l<o.length;)if(o[l][0]==="enter"&&o[l][1].type==="strikethroughSequenceTemporary"&&o[l][1]._close){let u=l;for(;u--;)if(o[u][0]==="exit"&&o[u][1].type==="strikethroughSequenceTemporary"&&o[u][1]._open&&o[l][1].end.offset-o[l][1].start.offset===o[u][1].end.offset-o[u][1].start.offset){o[l][1].type="strikethroughSequence",o[u][1].type="strikethroughSequence";const c={type:"strikethrough",start:Object.assign({},o[u][1].start),end:Object.assign({},o[l][1].end)},h={type:"strikethroughText",start:Object.assign({},o[u][1].end),end:Object.assign({},o[l][1].start)},v=[["enter",c,a],["enter",o[u][1],a],["exit",o[u][1],a],["enter",h,a]],d=a.parser.constructs.insideSpan.null;d&&xn(v,v.length,0,ch(d,o.slice(u+1,l),a)),xn(v,v.length,0,[["exit",h,a],["enter",o[l][1],a],["exit",o[l][1],a],["exit",c,a]]),xn(o,u-1,l-u+3,v),l=u+v.length-2;break}}for(l=-1;++l<o.length;)o[l][1].type==="strikethroughSequenceTemporary"&&(o[l][1].type="data");return o}function s(o,a,l){const u=this.previous,c=this.events;let h=0;return v;function v(x){return u===126&&c[c.length-1][1].type!=="characterEscape"?l(x):(o.enter("strikethroughSequenceTemporary"),d(x))}function d(x){const w=Gs(u);if(x===126)return h>1?l(x):(o.consume(x),h++,d);if(h<2&&!r)return l(x);const g=o.exit("strikethroughSequenceTemporary"),m=Gs(x);return g._open=!m||m===2&&!!w,g._close=!w||w===2&&!!m,a(x)}}}class mB{constructor(){this.map=[]}add(e,r,n){yB(this,e,r,n)}consume(e){if(this.map.sort(function(s,o){return s[0]-o[0]}),this.map.length===0)return;let r=this.map.length;const n=[];for(;r>0;)r-=1,n.push(e.slice(this.map[r][0]+this.map[r][1]),this.map[r][2]),e.length=this.map[r][0];n.push(e.slice()),e.length=0;let i=n.pop();for(;i;){for(const s of i)e.push(s);i=n.pop()}this.map.length=0}}function yB(t,e,r,n){let i=0;if(!(r===0&&n.length===0)){for(;i<t.map.length;){if(t.map[i][0]===e){t.map[i][1]+=r,t.map[i][2].push(...n);return}i+=1}t.map.push([e,r,n])}}function xB(t,e){let r=!1;const n=[];for(;e<t.length;){const i=t[e];if(r){if(i[0]==="enter")i[1].type==="tableContent"&&n.push(t[e+1][1].type==="tableDelimiterMarker"?"left":"none");else if(i[1].type==="tableContent"){if(t[e-1][1].type==="tableDelimiterMarker"){const s=n.length-1;n[s]=n[s]==="left"?"center":"right"}}else if(i[1].type==="tableDelimiterRow")break}else i[0]==="enter"&&i[1].type==="tableDelimiterRow"&&(r=!0);e+=1}return n}function bB(){return{flow:{null:{name:"table",tokenize:wB,resolveAll:_B}}}}function wB(t,e,r){const n=this;let i=0,s=0,o;return a;function a(A){let I=n.events.length-1;for(;I>-1;){const D=n.events[I][1].type;if(D==="lineEnding"||D==="linePrefix")I--;else break}const M=I>-1?n.events[I][1].type:null,B=M==="tableHead"||M==="tableRow"?E:l;return B===E&&n.parser.lazy[n.now().line]?r(A):B(A)}function l(A){return t.enter("tableHead"),t.enter("tableRow"),u(A)}function u(A){return A===124||(o=!0,s+=1),c(A)}function c(A){return A===null?r(A):dt(A)?s>1?(s=0,n.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(A),t.exit("lineEnding"),d):r(A):Et(A)?Nt(t,c,"whitespace")(A):(s+=1,o&&(o=!1,i+=1),A===124?(t.enter("tableCellDivider"),t.consume(A),t.exit("tableCellDivider"),o=!0,c):(t.enter("data"),h(A)))}function h(A){return A===null||A===124||Vt(A)?(t.exit("data"),c(A)):(t.consume(A),A===92?v:h)}function v(A){return A===92||A===124?(t.consume(A),h):h(A)}function d(A){return n.interrupt=!1,n.parser.lazy[n.now().line]?r(A):(t.enter("tableDelimiterRow"),o=!1,Et(A)?Nt(t,x,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(A):x(A))}function x(A){return A===45||A===58?g(A):A===124?(o=!0,t.enter("tableCellDivider"),t.consume(A),t.exit("tableCellDivider"),w):N(A)}function w(A){return Et(A)?Nt(t,g,"whitespace")(A):g(A)}function g(A){return A===58?(s+=1,o=!0,t.enter("tableDelimiterMarker"),t.consume(A),t.exit("tableDelimiterMarker"),m):A===45?(s+=1,m(A)):A===null||dt(A)?S(A):N(A)}function m(A){return A===45?(t.enter("tableDelimiterFiller"),y(A)):N(A)}function y(A){return A===45?(t.consume(A),y):A===58?(o=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(A),t.exit("tableDelimiterMarker"),b):(t.exit("tableDelimiterFiller"),b(A))}function b(A){return Et(A)?Nt(t,S,"whitespace")(A):S(A)}function S(A){return A===124?x(A):A===null||dt(A)?!o||i!==s?N(A):(t.exit("tableDelimiterRow"),t.exit("tableHead"),e(A)):N(A)}function N(A){return r(A)}function E(A){return t.enter("tableRow"),T(A)}function T(A){return A===124?(t.enter("tableCellDivider"),t.consume(A),t.exit("tableCellDivider"),T):A===null||dt(A)?(t.exit("tableRow"),e(A)):Et(A)?Nt(t,T,"whitespace")(A):(t.enter("data"),k(A))}function k(A){return A===null||A===124||Vt(A)?(t.exit("data"),T(A)):(t.consume(A),A===92?L:k)}function L(A){return A===92||A===124?(t.consume(A),k):k(A)}}function _B(t,e){let r=-1,n=!0,i=0,s=[0,0,0,0],o=[0,0,0,0],a=!1,l=0,u,c,h;const v=new mB;for(;++r<t.length;){const d=t[r],x=d[1];d[0]==="enter"?x.type==="tableHead"?(a=!1,l!==0&&(qb(v,e,l,u,c),c=void 0,l=0),u={type:"table",start:Object.assign({},x.start),end:Object.assign({},x.end)},v.add(r,0,[["enter",u,e]])):x.type==="tableRow"||x.type==="tableDelimiterRow"?(n=!0,h=void 0,s=[0,0,0,0],o=[0,r+1,0,0],a&&(a=!1,c={type:"tableBody",start:Object.assign({},x.start),end:Object.assign({},x.end)},v.add(r,0,[["enter",c,e]])),i=x.type==="tableDelimiterRow"?2:c?3:1):i&&(x.type==="data"||x.type==="tableDelimiterMarker"||x.type==="tableDelimiterFiller")?(n=!1,o[2]===0&&(s[1]!==0&&(o[0]=o[1],h=oc(v,e,s,i,void 0,h),s=[0,0,0,0]),o[2]=r)):x.type==="tableCellDivider"&&(n?n=!1:(s[1]!==0&&(o[0]=o[1],h=oc(v,e,s,i,void 0,h)),s=o,o=[s[1],r,0,0])):x.type==="tableHead"?(a=!0,l=r):x.type==="tableRow"||x.type==="tableDelimiterRow"?(l=r,s[1]!==0?(o[0]=o[1],h=oc(v,e,s,i,r,h)):o[1]!==0&&(h=oc(v,e,o,i,r,h)),i=0):i&&(x.type==="data"||x.type==="tableDelimiterMarker"||x.type==="tableDelimiterFiller")&&(o[3]=r)}for(l!==0&&qb(v,e,l,u,c),v.consume(e.events),r=-1;++r<e.events.length;){const d=e.events[r];d[0]==="enter"&&d[1].type==="table"&&(d[1]._align=xB(e.events,r))}return t}function oc(t,e,r,n,i,s){const o=n===1?"tableHeader":n===2?"tableDelimiter":"tableData",a="tableContent";r[0]!==0&&(s.end=Object.assign({},As(e.events,r[0])),t.add(r[0],0,[["exit",s,e]]));const l=As(e.events,r[1]);if(s={type:o,start:Object.assign({},l),end:Object.assign({},l)},t.add(r[1],0,[["enter",s,e]]),r[2]!==0){const u=As(e.events,r[2]),c=As(e.events,r[3]),h={type:a,start:Object.assign({},u),end:Object.assign({},c)};if(t.add(r[2],0,[["enter",h,e]]),n!==2){const v=e.events[r[2]],d=e.events[r[3]];if(v[1].end=Object.assign({},d[1].end),v[1].type="chunkText",v[1].contentType="text",r[3]>r[2]+1){const x=r[2]+1,w=r[3]-r[2]-1;t.add(x,w,[])}}t.add(r[3]+1,0,[["exit",h,e]])}return i!==void 0&&(s.end=Object.assign({},As(e.events,i)),t.add(i,0,[["exit",s,e]]),s=void 0),s}function qb(t,e,r,n,i){const s=[],o=As(e.events,r);i&&(i.end=Object.assign({},o),s.push(["exit",i,e])),n.end=Object.assign({},o),s.push(["exit",n,e]),t.add(r+1,0,s)}function As(t,e){const r=t[e],n=r[0]==="enter"?"start":"end";return r[1][n]}const SB={name:"tasklistCheck",tokenize:EB};function CB(){return{text:{91:SB}}}function EB(t,e,r){const n=this;return i;function i(l){return n.previous!==null||!n._gfmTasklistFirstContentOfListItem?r(l):(t.enter("taskListCheck"),t.enter("taskListCheckMarker"),t.consume(l),t.exit("taskListCheckMarker"),s)}function s(l){return Vt(l)?(t.enter("taskListCheckValueUnchecked"),t.consume(l),t.exit("taskListCheckValueUnchecked"),o):l===88||l===120?(t.enter("taskListCheckValueChecked"),t.consume(l),t.exit("taskListCheckValueChecked"),o):r(l)}function o(l){return l===93?(t.enter("taskListCheckMarker"),t.consume(l),t.exit("taskListCheckMarker"),t.exit("taskListCheck"),a):r(l)}function a(l){return dt(l)?e(l):Et(l)?t.check({tokenize:kB},e,r)(l):r(l)}}function kB(t,e,r){return Nt(t,n,"whitespace");function n(i){return i===null?r(i):e(i)}}function TB(t){return _S([ZO(),lB(),gB(t),bB(),CB()])}const NB={};function RB(t){const e=this,r=t||NB,n=e.data(),i=n.micromarkExtensions||(n.micromarkExtensions=[]),s=n.fromMarkdownExtensions||(n.fromMarkdownExtensions=[]),o=n.toMarkdownExtensions||(n.toMarkdownExtensions=[]);i.push(TB(r)),s.push(YO()),o.push(XO(r))}const LB={h1:({children:t})=>_.jsx("h1",{className:"text-lg font-bold mt-4 mb-2",style:{color:"#e6edf3"},children:t}),h2:({children:t})=>_.jsx("h2",{className:"text-base font-bold mt-3 mb-1.5",style:{color:"#e6edf3"},children:t}),h3:({children:t})=>_.jsx("h3",{className:"text-sm font-semibold mt-2 mb-1",style:{color:"#e6edf3"},children:t}),p:({children:t})=>_.jsx("p",{className:"mb-2 last:mb-0 leading-relaxed",children:t}),a:({href:t,children:e})=>_.jsx("a",{href:t,target:"_blank",rel:"noopener noreferrer",className:"underline",style:{color:"#79c0ff"},children:e}),img:({alt:t})=>_.jsxs("span",{className:"text-xs font-mono rounded px-1",style:{background:"rgba(230,237,243,0.08)",color:"rgba(230,237,243,0.4)"},children:["[image",t?`: ${t}`:"","]"]}),code:({className:t,children:e})=>!!(t!=null&&t.startsWith("language-"))||typeof e=="string"&&e.includes(`
418
- `)?_.jsx("code",{className:`block overflow-auto rounded-lg px-4 py-3 text-xs leading-5 font-mono my-2 ${t??""}`,style:{background:"#0d1117",color:"#e6edf3"},children:e}):_.jsx("code",{className:"rounded px-1.5 py-0.5 text-xs font-mono",style:{background:"rgba(230,237,243,0.1)",color:"#e6edf3"},children:e}),pre:({children:t})=>_.jsx("pre",{className:"my-2",children:t}),blockquote:({children:t})=>_.jsx("blockquote",{className:"pl-3 my-2 italic text-sm",style:{borderLeft:"3px solid rgba(230,237,243,0.2)",color:"rgba(230,237,243,0.6)"},children:t}),ul:({children:t})=>_.jsx("ul",{className:"list-disc pl-5 mb-2 space-y-0.5",children:t}),ol:({children:t})=>_.jsx("ol",{className:"list-decimal pl-5 mb-2 space-y-0.5",children:t}),li:({children:t})=>_.jsx("li",{className:"text-sm leading-relaxed",children:t}),table:({children:t})=>_.jsx("div",{className:"overflow-x-auto my-2",children:_.jsx("table",{className:"text-xs w-full border-collapse font-mono",children:t})}),thead:({children:t})=>_.jsx("thead",{style:{borderBottom:"1px solid rgba(230,237,243,0.12)"},children:t}),tbody:({children:t})=>_.jsx("tbody",{children:t}),tr:({children:t})=>_.jsx("tr",{style:{borderBottom:"1px solid rgba(230,237,243,0.06)"},children:t}),th:({children:t})=>_.jsx("th",{className:"text-left px-3 py-1.5 font-semibold",style:{color:"rgba(230,237,243,0.7)"},children:t}),td:({children:t})=>_.jsx("td",{className:"px-3 py-1.5",style:{color:"#e6edf3"},children:t}),hr:()=>_.jsx("hr",{className:"my-3",style:{borderColor:"rgba(230,237,243,0.1)"}}),strong:({children:t})=>_.jsx("strong",{className:"font-semibold",style:{color:"#e6edf3"},children:t}),em:({children:t})=>_.jsx("em",{style:{color:"rgba(230,237,243,0.8)"},children:t})};function DB({children:t,className:e}){return _.jsx("div",{className:`text-sm leading-relaxed ${e??""}`,style:{color:"#e6edf3"},children:_.jsx(gI,{remarkPlugins:[RB],components:LB,children:t})})}const AB={ask:"Ask",balanced:"Balanced",autonomous:"Autonomous"},MB={claude:{bg:"rgba(139,92,246,0.25)",fg:"#c4b5fd"},codex:{bg:"rgba(59,130,246,0.25)",fg:"#93c5fd"},antigravity:{bg:"rgba(34,197,94,0.2)",fg:"#86efac"},cursor:{bg:"rgba(20,184,166,0.2)",fg:"#5eead4"}},PB={bg:"rgba(230,237,243,0.1)",fg:"rgba(230,237,243,0.55)"};function IB(t){var r,n;const e=t.split(/[-_]/);return e.length>1?((((r=e[0])==null?void 0:r[0])??"")+(((n=e[1])==null?void 0:n[0])??"")).toUpperCase():t.slice(0,2).toUpperCase()}function OB({runId:t,ord:e}){var i,s;const r=Oa(o=>o.councilStatus[`${t}:${e}`]),n=r?r.state==="convened"?`Council convened — polling ${((i=r.clis)==null?void 0:i.length)??"?"} CLI${(((s=r.clis)==null?void 0:s.length)??0)===1?"":"s"}…`:r.state==="deliberating"?`Ballot ${r.round??"?"}: ${r.agreementPct??"?"}% — below the ${r.neededPct??75}% bar, runoff in progress…`:`Council voted — ${r.agreementPct??"?"}% agreement (${r.votes??"?"} votes)`:"Council deliberating…";return _.jsxs("div",{className:"flex items-center gap-2 text-xs font-mono rounded-lg px-3 py-2",style:{background:"rgba(139,92,246,0.08)",border:"1px solid rgba(139,92,246,0.18)",color:"#a78bfa"},children:[_.jsx("span",{className:`inline-block w-1.5 h-1.5 rounded-full ${(r==null?void 0:r.state)==="voted"?"":"animate-pulse"}`,style:{background:"#a78bfa"}}),_.jsx("span",{children:n})]})}function BB({runId:t,ord:e}){const r=Oa(i=>i.outputs[tS(t,e)]);if(!r)return null;const n=r.length>800?"…"+r.slice(r.length-800):r;return _.jsx("pre",{className:"mt-2 max-h-48 overflow-auto rounded-lg p-2 text-[10px] leading-snug whitespace-pre-wrap font-mono",style:{background:"rgba(13,17,23,0.6)",color:"rgba(230,237,243,0.65)",border:"1px solid rgba(230,237,243,0.06)"},children:n})}function jB({reason:t}){const[e,r]=ne.useState(!1),[n,i]=ne.useState(!1),s="degraded-routing-detail";return e?_.jsx(_.Fragment,{}):_.jsxs("div",{className:"self-start max-w-[85%] rounded-xl px-4 py-2.5 text-xs font-mono flex flex-col gap-1.5",style:{background:"rgba(255,218,25,0.08)",border:"1px solid rgba(255,218,25,0.2)",color:"#ffda19"},children:[_.jsxs("div",{className:"flex items-center gap-2",children:[_.jsx("span",{className:"shrink-0","aria-hidden":"true",children:"⚠"}),_.jsxs("span",{className:"flex-1",children:["Degraded routing: ",t]}),_.jsx("button",{type:"button",onClick:()=>i(o=>!o),className:"shrink-0 text-[10px] transition-opacity hover:opacity-70",style:{color:"rgba(255,218,25,0.6)"},"aria-expanded":n,"aria-controls":s,"aria-label":n?"Hide explanation":"Show explanation",children:n?"▲":"▼"}),_.jsx("button",{type:"button",onClick:()=>r(!0),className:"shrink-0 transition-opacity hover:opacity-70",style:{color:"rgba(255,218,25,0.5)"},"aria-label":"Dismiss degraded routing warning",children:_.jsx("span",{"aria-hidden":"true",children:"✕"})})]}),n&&_.jsxs("p",{id:s,className:"text-[10px] leading-relaxed pl-5",style:{color:"rgba(255,218,25,0.6)"},children:["The multi-model council could not reach a quorum vote. The unit proceeded using a fallback routing strategy. Open the ",_.jsx("strong",{children:"Decisions"})," section in the Insights panel on the right to see each reviewer's verdict."]})]})}function FB({cli:t}){const{bg:e,fg:r}=MB[t.toLowerCase()]??PB;return _.jsx("span",{"aria-hidden":"true",className:"shrink-0 w-7 h-7 rounded-full flex items-center justify-center text-[10px] font-bold font-mono select-none",style:{background:e,color:r},children:IB(t)})}const zB={recon:{bg:"rgba(139,92,246,0.15)",color:"#a78bfa"},build:{bg:"rgba(63,185,80,0.12)",color:"#3fb950"},review:{bg:"rgba(121,192,255,0.12)",color:"#79c0ff"},test:{bg:"rgba(255,218,25,0.12)",color:"#ffda19"}},HB={pending:"queued",distributed:"dispatched",done:"done",rejected:"rejected"};function UB(t,e,r){return e.startsWith(`${t}:`)?e.slice(t.length+1):`u${r}`}const WB=new Set(["sessionStarted","sessionCompleted","sessionFailed","awaitingHuman","gateDecided","resumed","runCancelled","workerMessageQueued","workerMessageInjected"]),VB=new Set(["stepFailed","crashRecoveryRedrive","workerStalled","failureTriaged"]);function $B(t,e){switch(t){case"sessionStarted":return"Run started";case"sessionCompleted":return"✓ Run completed";case"sessionFailed":return"✗ Run failed";case"awaitingHuman":return"Waiting for your input…";case"gateDecided":return e.includes("allow")?"Gate: allow":"Gate: deny";case"resumed":return"Run resumed";case"runCancelled":return"Run cancelled";case"workerMessageQueued":return`Message queued for next turn — ${e}`;case"workerMessageInjected":return`Message delivered — ${e}`;default:return e}}function GB(t){switch(t){case"completed":return"#3fb950";case"failed":return"#f85149";case"cancelled":return"rgba(230,237,243,0.25)";case"awaiting_human":return"#ffda19";default:return"#79c0ff"}}function qB(){return _.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[_.jsx("circle",{cx:"8",cy:"8",r:"6.75",stroke:"currentColor",strokeWidth:"1.5"}),_.jsx("rect",{x:"5.25",y:"5.25",width:"5.5",height:"5.5",rx:"0.75",fill:"currentColor"})]})}function YB(){return _.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[_.jsx("path",{d:"M8 2v7.25m0 0L5.25 6.5M8 9.25l2.75-2.75",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),_.jsx("path",{d:"M2.75 11v1.25c0 .69.56 1.25 1.25 1.25h8c.69 0 1.25-.56 1.25-1.25V11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})}function XB({runId:t,disabled:e}){const[r,n]=ne.useState(!1),[i,s]=ne.useState(null);async function o(){n(!0),s(null);try{await cE(t)}catch(u){s(u instanceof Error?u.message:String(u))}finally{n(!1)}}const a=e||r,l=e?"Export evidence — available once the run finishes":i??(r?"Exporting evidence…":"Export evidence");return _.jsxs(_.Fragment,{children:[i&&_.jsxs("span",{role:"alert",className:"text-[11px] font-mono shrink-0 max-w-[14rem] truncate",style:{color:"#f85149"},children:["Export failed: ",i]}),_.jsx("button",{type:"button",onClick:()=>void o(),disabled:a,title:l,"aria-label":"Export evidence","aria-busy":r,className:"flex items-center justify-center w-6 h-6 rounded shrink-0 transition-opacity disabled:cursor-not-allowed",style:{color:i?"#f85149":"#79c0ff",opacity:a?.3:.65},onMouseEnter:u=>{a||(u.currentTarget.style.opacity="1")},onMouseLeave:u=>{a||(u.currentTarget.style.opacity="0.65")},children:_.jsx(YB,{})})]})}function KB({detail:t,onStop:e,canStop:r}){return _.jsxs("div",{className:"self-start max-w-[85%] rounded-xl px-4 py-3 flex flex-col gap-2 font-mono text-xs",style:{background:"rgba(248,81,73,0.07)",border:"1px solid rgba(248,81,73,0.25)",color:"#f85149"},children:[_.jsxs("div",{className:"flex items-center gap-2 font-semibold text-[11px] uppercase tracking-wide",children:[_.jsx("span",{children:"⚠"}),_.jsx("span",{children:"Step failure"})]}),t&&_.jsx("pre",{className:"text-[11px] leading-relaxed whitespace-pre-wrap break-words m-0 overflow-hidden",style:{color:"rgba(230,237,243,0.6)",fontFamily:"inherit"},children:t.length>200?`${t.slice(0,200)}…`:t}),_.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[_.jsx("button",{type:"button",title:"Reassign not yet available",disabled:!0,className:"rounded px-3 py-1 text-[11px] font-semibold opacity-30 cursor-not-allowed",style:{background:"rgba(230,237,243,0.08)",color:"#e6edf3"},children:"Reassign"}),_.jsx("button",{type:"button",onClick:r?e:void 0,disabled:!r,className:"rounded px-3 py-1 text-[11px] font-semibold transition-opacity hover:opacity-100 opacity-80 disabled:opacity-30 disabled:cursor-not-allowed",style:{background:"rgba(248,81,73,0.15)",color:"#f85149",border:"1px solid rgba(248,81,73,0.3)"},children:"Stop run"})]})]})}function QB({attempt:t}){return _.jsxs("div",{className:"self-start max-w-[85%] rounded-xl px-4 py-3 flex flex-col gap-1 font-mono text-xs",style:{background:"rgba(255,218,25,0.06)",border:"1px solid rgba(255,218,25,0.2)",color:"#ffda19"},children:[_.jsxs("div",{className:"flex items-center gap-2 font-semibold text-[11px] uppercase tracking-wide",children:[_.jsx("span",{children:"↺"}),_.jsxs("span",{children:["Crash recovery — attempt ",t]})]}),_.jsx("p",{className:"text-[11px]",style:{color:"rgba(230,237,243,0.5)"},children:"The engine restarted and is re-dispatching this unit automatically."})]})}function d2({mode:t,onChange:e,readOnly:r=!1}){const n=["ask","balanced","autonomous"];function i(s,o){var l,u;if(r)return;let a=o;if(s.key==="ArrowRight"||s.key==="ArrowDown")a=(o+1)%n.length;else if(s.key==="ArrowLeft"||s.key==="ArrowUp")a=(o-1+n.length)%n.length;else return;s.preventDefault(),e(n[a]),(u=(l=s.currentTarget.parentElement)==null?void 0:l.children[a])==null||u.focus()}return _.jsx("div",{role:"radiogroup","aria-label":"Run mode","aria-disabled":r||void 0,title:r?"Run mode (read-only — run is complete)":void 0,className:"flex items-center rounded-lg overflow-hidden shrink-0",style:{background:"rgba(230,237,243,0.06)",border:"1px solid rgba(230,237,243,0.1)",opacity:r?.6:1},children:n.map((s,o)=>_.jsx("button",{type:"button",role:"radio","aria-checked":t===s,"aria-disabled":r,tabIndex:r?-1:t===s?0:-1,onClick:r?void 0:()=>e(s),onKeyDown:r?void 0:a=>i(a,o),disabled:r,className:"px-3 py-1 text-[11px] font-mono font-medium transition-colors disabled:cursor-default",style:t===s?{background:"rgba(255,218,25,0.15)",color:r?"rgba(255,218,25,0.7)":"#ffda19"}:{background:"transparent",color:"rgba(230,237,243,0.35)"},children:AB[s]},s))})}function ZB({view:t,mode:e,onModeChange:r,onLaunched:n,onNavigateBack:i,onRefresh:s,onKill:o}){const{session:a,units:l}=t,u=ei(M=>M.gates[a.id]),c=Oa(M=>M.logs[a.id])??[],h=Oa(M=>M.executorTypes),[v,d]=ne.useState("all"),x=Oa(M=>M.terminalIds),[w,g]=ne.useState(null),[m,y]=ne.useState({}),b=ne.useRef(new Set),S=ne.useRef(null);ne.useEffect(()=>{var M;(M=S.current)==null||M.scrollIntoView({behavior:"smooth"})},[l.length,c.length]),ne.useEffect(()=>{for(const M of l)M.status==="done"&&!b.current.has(M.ord)&&(b.current.add(M.ord),y(B=>({...B,[M.ord]:{text:null,loading:!0,visible:!0}})),at.getUnitOutput(a.id,UB(a.id,M.id,M.ord)).then(({output:B})=>{y(D=>({...D,[M.ord]:{text:B??"(no transcript captured)",loading:!1,visible:!0}}))}).catch(()=>{y(B=>({...B,[M.ord]:{text:"(transcript unavailable)",loading:!1,visible:!0}}))}))},[l,a.id]);function N(M){y(B=>{const D=B[M];return D?{...B,[M]:{...D,visible:!D.visible}}:B})}const E=ZA[a.status]??{label:a.status,color:"rgba(230,237,243,0.5)"},T=["completed","cancelled","failed"].includes(a.status),k=c.filter(M=>WB.has(M.type)||VB.has(M.type)),L=GB(a.status),A=["executing","distributing","planning","awaiting_human"].includes(a.status);function I(){o==null||o(a.id)}return _.jsxs("div",{className:"flex flex-col h-full",children:[_.jsxs("div",{className:"flex items-center gap-3 px-6 py-4 shrink-0",style:{borderBottom:"1px solid rgba(230,237,243,0.07)",background:"#1b222e"},children:[_.jsx("button",{type:"button",onClick:i,"aria-label":"Back to run list",className:"w-8 h-8 flex items-center justify-center rounded-lg transition-colors shrink-0",style:{color:"rgba(230,237,243,0.4)"},onMouseEnter:M=>{M.currentTarget.style.background="rgba(230,237,243,0.06)",M.currentTarget.style.color="#e6edf3"},onMouseLeave:M=>{M.currentTarget.style.background="transparent",M.currentTarget.style.color="rgba(230,237,243,0.4)"},children:"←"}),_.jsx("span",{className:`w-2.5 h-2.5 rounded-full shrink-0 ${A?"animate-pulse":""}`,style:{background:L}}),_.jsx("p",{className:"flex-1 text-base font-semibold truncate",style:{color:"#e6edf3"},title:a.problem,children:a.problem}),_.jsx("span",{className:"text-xs font-medium shrink-0 font-mono",style:{color:E.color},children:E.label}),_.jsx(d2,{mode:e,onChange:r,readOnly:T}),_.jsx(XB,{runId:a.id,disabled:!T}),!T&&o&&_.jsx("button",{type:"button",onClick:()=>void o(a.id),title:"Kill run (Ctrl+K)","aria-label":"Kill run",className:"flex items-center justify-center w-6 h-6 rounded shrink-0 transition-opacity disabled:opacity-30",style:{color:"#f85149",opacity:.65},onMouseEnter:M=>{M.currentTarget.style.opacity="1"},onMouseLeave:M=>{M.currentTarget.style.opacity="0.65"},children:_.jsx(qB,{})})]}),_.jsxs("div",{className:"flex-1 overflow-y-auto px-4 py-6 flex flex-col gap-6 max-w-3xl w-full mx-auto",children:[_.jsx("div",{className:"flex justify-end",children:_.jsx("div",{className:"max-w-[72%] rounded-2xl text-base px-5 py-3.5 leading-relaxed",style:{background:"#224a5e",color:"#e6edf3",border:"1px solid rgba(230,237,243,0.12)"},children:a.problem})}),[...l].sort((M,B)=>M.ord-B.ord).flatMap(M=>{const B=m[M.ord],D=zB[M.stage]??{bg:"rgba(230,237,243,0.08)",color:"rgba(230,237,243,0.5)"},H=a.status==="awaiting_human"&&(u==null?void 0:u.ord)===M.ord,U=_.jsxs("div",{className:"flex flex-col gap-2",children:[M.routing!==null&&M.routing.method==="council"&&_.jsxs("div",{className:"self-start max-w-[85%] rounded-xl px-4 py-2 text-xs flex items-center gap-2 font-mono",style:{background:"rgba(139,92,246,0.1)",border:"1px solid rgba(139,92,246,0.2)",color:"#a78bfa"},children:[_.jsx("span",{className:"shrink-0",children:"⚖"}),_.jsxs("span",{children:[_.jsxs("span",{className:"font-semibold",children:["Council → ",M.assigned_cli??"?"]}),_.jsxs("span",{className:"ml-2",style:{color:"rgba(167,139,250,0.6)"},children:[M.routing.returned," polled · ",M.routing.agreement_pct,"% agree · ",M.routing.dissent," dissent"]})]})]}),M.routing!==null&&M.routing.method==="evaluator_distinct"&&_.jsxs("div",{className:"self-start max-w-[85%] rounded-xl px-4 py-2 text-xs flex items-center gap-2 font-mono",style:{background:"rgba(139,92,246,0.1)",border:"1px solid rgba(139,92,246,0.2)",color:"#a78bfa"},children:[_.jsx("span",{className:"shrink-0",children:"⚖"}),_.jsxs("span",{children:[_.jsxs("span",{className:"font-semibold",children:["Evaluator-distinct → ",M.assigned_cli??"?"]}),_.jsxs("span",{className:"ml-2",style:{color:"rgba(167,139,250,0.6)"},children:["(was: ",M.routing.was,")"]})]})]}),M.routing!==null&&M.routing.method==="degraded"&&_.jsx(jB,{reason:M.routing.reason}),_.jsxs("div",{className:"self-start max-w-[85%] flex flex-col gap-2",children:[_.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[M.assigned_cli?_.jsxs("div",{className:"flex items-center gap-1",children:[_.jsxs("button",{type:"button",onClick:()=>d(M.assigned_cli),title:`Target ${M.assigned_cli}`,"aria-label":`Send message to ${M.assigned_cli} only`,className:"flex items-center gap-2 rounded-lg p-0 pr-1 transition-opacity hover:opacity-80",style:{background:"transparent",border:"none",cursor:"pointer"},children:[_.jsx(FB,{cli:M.assigned_cli}),_.jsxs("span",{className:"text-xs font-mono",style:{color:"rgba(230,237,243,0.55)"},children:[M.assigned_cli,_.jsxs("span",{style:{color:"rgba(230,237,243,0.3)"},children:[" · unit ",M.ord]})]})]}),x[`${a.id}:${M.assigned_cli}`]&&_.jsx("button",{type:"button","aria-pressed":(w==null?void 0:w.cliKey)===M.assigned_cli,"aria-label":(w==null?void 0:w.cliKey)===M.assigned_cli?`Close ${M.assigned_cli} terminal`:`Open ${M.assigned_cli} terminal`,title:(w==null?void 0:w.cliKey)===M.assigned_cli?`Close ${M.assigned_cli} terminal`:`Open ${M.assigned_cli} terminal`,onClick:()=>{const z=M.assigned_cli,W=x[`${a.id}:${z}`];g((w==null?void 0:w.cliKey)===z?null:{cliKey:z,terminalId:W})},className:"text-xs rounded px-1 py-0.5 transition-opacity hover:opacity-80",style:{background:"rgba(230,237,243,0.06)",border:"none",cursor:"pointer",color:"rgba(230,237,243,0.55)",fontFamily:"monospace"},children:"⌨"})]}):_.jsxs("div",{className:"flex items-center gap-2",children:[_.jsx("span",{className:"w-7 h-7 rounded-full shrink-0",style:{background:"rgba(230,237,243,0.06)"}}),_.jsxs("span",{className:"text-xs font-mono",style:{color:"rgba(230,237,243,0.55)"},children:["agent",_.jsxs("span",{style:{color:"rgba(230,237,243,0.3)"},children:[" · unit ",M.ord]})]})]}),_.jsx("span",{className:"rounded-full px-2 py-0.5 text-[11px] font-semibold uppercase tracking-wide font-mono",style:{background:D.bg,color:D.color},children:M.stage}),M.has_validator_pin&&_.jsx("span",{role:"img","aria-label":"Governance floor armed",style:{color:"#ffda19",fontSize:"12px"},children:"🔒"}),_.jsx("span",{className:"text-xs font-mono truncate max-w-xs",style:{color:"rgba(230,237,243,0.35)"},title:M.description,children:M.description})]}),_.jsxs("div",{className:"rounded-2xl px-5 py-4",style:{background:"#1b222e",border:"1px solid rgba(230,237,243,0.08)"},children:[M.status==="distributed"&&!T&&_.jsxs("div",{children:[_.jsxs("div",{className:"flex items-center gap-2 text-sm font-mono",style:{color:"rgba(230,237,243,0.5)"},children:[_.jsx("span",{className:"inline-block w-1.5 h-1.5 rounded-full animate-pulse",style:{background:"#79c0ff"}}),_.jsx("span",{children:"Working…"})]}),_.jsx(BB,{runId:a.id,ord:M.ord})]}),M.status==="distributed"&&T&&_.jsxs("div",{className:"flex items-center gap-2 text-sm font-mono",style:{color:"rgba(230,237,243,0.35)"},children:[_.jsx("span",{children:"—"}),_.jsx("span",{children:"Not started"})]}),M.status==="done"&&_.jsxs("div",{className:"flex items-center gap-2 text-sm font-mono",style:{color:"#3fb950"},children:[_.jsx("span",{children:"✓"}),_.jsx("span",{className:"font-medium",children:HB[M.status]})]}),M.status==="rejected"&&_.jsxs("div",{className:"text-sm font-medium font-mono",style:{color:"#f85149"},children:["Rejected",M.denial_reason?`: ${M.denial_reason}`:""]}),M.status==="pending"&&(()=>{const z=h[`${a.id}:${M.ord}`];return(z?z==="agent":!0)?_.jsx(OB,{runId:a.id,ord:M.ord}):_.jsxs("div",{className:"flex items-center gap-2 text-sm font-mono",style:{color:"rgba(230,237,243,0.3)"},children:[_.jsx("span",{className:"inline-block w-1.5 h-1.5 rounded-full",style:{background:"rgba(230,237,243,0.2)"}}),_.jsx("span",{children:"Queued"})]})})(),M.status==="done"&&_.jsxs("div",{className:"mt-3",children:[_.jsx("button",{type:"button",onClick:()=>N(M.ord),className:"text-xs font-medium font-mono hover:underline",style:{color:"#79c0ff"},children:B!=null&&B.visible?"▾ Hide transcript":"▸ View transcript"}),(B==null?void 0:B.visible)&&_.jsx("div",{className:"mt-2.5 max-h-96 overflow-auto rounded-xl p-4",style:{background:"#0d1117"},children:B.loading?_.jsx("span",{className:"text-xs font-mono",style:{color:"rgba(230,237,243,0.5)"},children:"Loading…"}):_.jsx(DB,{className:"whitespace-pre-wrap",children:B.text??""})})]})]})]})]},M.id);return H?[_.jsx("div",{className:"self-center w-full max-w-lg",children:_.jsx(ib,{runId:a.id,...u?{ord:u.ord,prompt:u.prompt}:{},onResolved:s})},`gate-before-${M.id}`),U]:[U]}),k.map(M=>M.type==="stepFailed"?_.jsx("div",{className:"flex flex-col gap-2",children:_.jsx(KB,{detail:M.detail,onStop:I,canStop:o!==void 0&&!T})},M.seq):M.type==="crashRecoveryRedrive"?_.jsx("div",{className:"flex flex-col gap-2",children:_.jsx(QB,{attempt:M.attempt??1})},M.seq):_.jsx("div",{className:"flex justify-center",children:_.jsx("span",{className:"text-xs rounded-full px-3 py-1 font-mono",style:{color:"rgba(230,237,243,0.4)",background:"#161c26",border:"1px solid rgba(230,237,243,0.07)"},children:$B(M.type,M.detail)})},M.seq)),a.status==="awaiting_human"&&!l.some(M=>(u==null?void 0:u.ord)===M.ord)&&_.jsx("div",{className:"self-center w-full max-w-lg",children:_.jsx(ib,{runId:a.id,...u?{ord:u.ord,prompt:u.prompt}:{},onResolved:s})}),_.jsx("div",{ref:S})]}),w&&_.jsx("div",{className:"px-4 pb-3 shrink-0",children:_.jsx(aM,{terminalId:w.terminalId,cliKey:w.cliKey,onClose:()=>g(null)})}),_.jsx(oS,{runId:T?null:a.id,runStatus:T?null:a.status,mode:e,onLaunched:n,injectTarget:v,onClearInjectTarget:()=>d("all")})]})}function JB({chatMode:t,mode:e,onModeChange:r,onLaunched:n}){const i=t?"What do you want to explore?":"What do you need built?",s=t?"Ask about your repos, get answers, run searches, analyse patterns — without kicking off a full build.":"Describe your goal. The council elects a CLI, decomposes the plan, and executes it — you approve each gate.";return _.jsx("div",{className:"flex flex-col h-full items-center justify-center",children:_.jsxs("div",{className:"w-full max-w-2xl px-8 flex flex-col gap-5",children:[_.jsxs("div",{className:"flex flex-col gap-2 text-center",children:[_.jsx("h1",{className:"text-3xl font-bold tracking-tight",style:{color:"#e6edf3"},children:i}),_.jsx("p",{className:"text-base leading-relaxed",style:{color:"rgba(230,237,243,0.5)"},children:s})]}),_.jsx("div",{className:"flex justify-center",children:_.jsx(d2,{mode:e,onChange:r})}),_.jsx(oS,{embedded:!0,mode:e,onLaunched:n,...t?{workflowOverride:"chat"}:{}})]})})}function ej({view:t,chatMode:e,onLaunched:r,onNavigateBack:n,onRefresh:i,onKill:s}){const[o,a]=ne.useState("balanced");if(t){let l=function(h){a(h),c||at.injectMessage(u.session.id,`mode:${h}`,"all").catch(()=>{})};const u=t,c=["completed","cancelled","failed"].includes(u.session.status);return _.jsx(ZB,{view:u,mode:o,onModeChange:l,onLaunched:r,onNavigateBack:n,onRefresh:i,...s!==void 0?{onKill:s}:{}},u.session.id)}return _.jsx(JB,{chatMode:e??!1,mode:o,onModeChange:a,onLaunched:r})}function tj(t){return t==="auto"?"Auto":t&&typeof t=="object"&&"human_confirm"in t?t.human_confirm.unconditional?"Human (always)":"Human":"Human if not PASS"}const rj={recon:"#79c0ff",build:"#3fb950",review:"#a78bfa",test:"#ffda19"};function p2(t){return rj[t]??"rgba(230,237,243,0.3)"}function nj({phase:t}){const e=t.executor,r=p2(t.kind);return _.jsxs("div",{className:"rounded px-3 py-2 text-[11px] flex flex-col gap-1",style:{border:"1px solid rgba(230,237,243,0.08)",background:"#1b222e"},children:[_.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[_.jsx("span",{className:"h-2 w-2 rounded-full shrink-0",style:{backgroundColor:r},title:t.kind}),_.jsx("span",{className:"font-semibold",style:{color:"#e6edf3"},children:t.id}),_.jsx("span",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.4)"},children:t.kind}),t.role!=="neutral"&&_.jsx("span",{className:"rounded px-1.5 py-0.5 text-[10px] font-semibold font-mono",style:{background:t.role==="creator"?"rgba(121,192,255,0.1)":"rgba(167,139,250,0.1)",color:t.role==="creator"?"#79c0ff":"#a78bfa"},children:t.role}),e&&e.type==="tool"&&_.jsxs("span",{className:"rounded px-1.5 py-0.5 text-[10px] font-semibold font-mono",style:{background:"rgba(255,218,25,0.08)",color:"#ffda19"},children:["tool: ",e.cmd.join(" ")]})]}),_.jsxs("div",{className:"flex flex-wrap gap-x-4 gap-y-0.5 text-[10px]",style:{color:"rgba(230,237,243,0.45)"},children:[_.jsxs("span",{children:[_.jsx("span",{className:"font-medium",style:{color:"rgba(230,237,243,0.6)"},children:"gate:"})," ",t.gate_type?`${t.gate_type} / `:"",tj(t.gate)]}),t.depends_on.length>0&&_.jsxs("span",{children:[_.jsx("span",{className:"font-medium",style:{color:"rgba(230,237,243,0.6)"},children:"after:"})," ",t.depends_on.join(", ")]}),t.skill_ref&&_.jsxs("span",{children:[_.jsx("span",{className:"font-medium",style:{color:"rgba(230,237,243,0.6)"},children:"skill:"})," ",_.jsx("span",{className:"font-mono",children:t.skill_ref})]})]})]})}function Yb(){return{_key:Math.random().toString(36).slice(2),id:"",kind:"build",execMode:"agent",cmd:"",script:"",scriptLang:"bash",scriptPath:"",gate:"auto",role:"neutral",dependsOn:[],executesCode:!1,verifiedEvidence:!1}}function ij(t){return t==="human"?{human_confirm:{unconditional:!1}}:t==="human_if"?{human_confirm_if:"verdict_not_pass"}:"auto"}async function aj(t){if(t.execMode==="agent")return{type:"agent"};if(t.execMode==="command")return{type:"tool",cmd:t.cmd.trim().split(/\s+/).filter(Boolean)};const e=t.id.trim()||`script-${t._key}`,{path:r}=await at.saveScript(e,t.script,t.scriptLang);return{type:"tool",cmd:[t.scriptLang==="python"?"python3":t.scriptLang==="sh"?"sh":"bash",r]}}async function Xb(t,e){const r=await Promise.all(e.map(async(n,i)=>({id:n.id||`phase-${i+1}`,kind:n.kind,gate_type:n.gate==="auto"?null:"execution",gate:ij(n.gate),executes_code:n.executesCode,verified_evidence:n.verifiedEvidence,required_deliverables:[],depends_on:n.dependsOn,role:n.role,skill_ref:null,allowed_skills:[],validator_pin:null,executor:await aj(n)})));return{id:t,phases:r}}const nl={background:"#0f1419",border:"1px solid rgba(230,237,243,0.1)",color:"#e6edf3"};function lc({active:t,onClick:e,children:r}){return _.jsx("button",{type:"button",onClick:e,className:"rounded px-2.5 py-1 text-[11px] font-medium capitalize transition-colors",style:t?{background:"#1b222e",color:"#e6edf3",border:"1px solid rgba(230,237,243,0.2)"}:{background:"transparent",color:"rgba(230,237,243,0.4)",border:"1px solid transparent"},children:r})}function sj({phase:t,index:e,total:r,allIds:n,onChange:i,onRemove:s,onMoveUp:o,onMoveDown:a}){const l=(c,h)=>i({...t,[c]:h}),u=n.slice(0,e);return _.jsxs("div",{className:"rounded p-3 flex flex-col gap-2",style:{border:"1px solid rgba(230,237,243,0.08)",background:"#1b222e"},children:[_.jsxs("div",{className:"flex items-center gap-2",children:[_.jsx("span",{className:"h-2.5 w-2.5 rounded-full",style:{backgroundColor:p2(t.kind)}}),_.jsxs("span",{className:"text-[11px] font-semibold",style:{color:"rgba(230,237,243,0.7)"},children:["Phase ",e+1]}),_.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[_.jsx("button",{type:"button",onClick:o,disabled:e===0,className:"px-1 text-[10px] disabled:opacity-30",style:{color:"rgba(230,237,243,0.4)"},children:"▲"}),_.jsx("button",{type:"button",onClick:a,disabled:e===r-1,className:"px-1 text-[10px] disabled:opacity-30",style:{color:"rgba(230,237,243,0.4)"},children:"▼"}),_.jsx("button",{type:"button",onClick:s,className:"px-1 text-[10px]",style:{color:"#f85149"},children:"✕"})]})]}),_.jsxs("div",{className:"flex gap-2",children:[_.jsx("input",{className:"flex-1 rounded px-2 py-1 text-xs focus:outline-none",placeholder:"phase-id (e.g. build)",value:t.id,onChange:c=>l("id",c.target.value),style:nl}),_.jsx("select",{className:"rounded px-2 py-1 text-xs focus:outline-none",value:t.kind,onChange:c=>l("kind",c.target.value),style:nl,children:["recon","build","review","test"].map(c=>_.jsx("option",{value:c,children:c},c))})]}),_.jsxs("div",{className:"flex flex-col gap-1.5",children:[_.jsx("div",{className:"flex gap-1",children:["agent","command","script"].map(c=>_.jsx(lc,{active:t.execMode===c,onClick:()=>l("execMode",c),children:c==="agent"?"Agent":c==="command"?"Command":"Script"},c))}),t.execMode==="command"&&_.jsx("input",{className:"rounded px-2 py-1 text-xs font-mono focus:outline-none",placeholder:"e.g. wicked-estate index or npm run build",value:t.cmd,onChange:c=>l("cmd",c.target.value),style:nl}),t.execMode==="script"&&_.jsxs("div",{className:"flex flex-col gap-1",children:[_.jsxs("div",{className:"flex gap-1 items-center",children:[_.jsx("span",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.4)"},children:"Language:"}),["bash","sh","python"].map(c=>_.jsx(lc,{active:t.scriptLang===c,onClick:()=>l("scriptLang",c),children:c},c))]}),_.jsx("textarea",{className:"rounded px-2 py-1.5 text-xs font-mono resize-y focus:outline-none",rows:6,placeholder:t.scriptLang==="python"?`# python script
419
- print("hello")`:`# bash script
420
- echo "hello"`,value:t.script,onChange:c=>l("script",c.target.value),style:{...nl,background:"#0d1117"}}),_.jsxs("p",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.3)"},children:["Saved to"," ",_.jsxs("span",{style:{color:"rgba(230,237,243,0.5)"},children:["~/.wicked/scripts/",t.id||"script",".",t.scriptLang==="python"?"py":"sh"]})]})]})]}),_.jsxs("div",{className:"flex gap-2 flex-wrap",children:[_.jsxs("div",{className:"flex flex-col gap-0.5",children:[_.jsx("span",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.4)"},children:"Gate"}),_.jsx("div",{className:"flex gap-1",children:[["auto","Auto"],["human","Human"],["human_if","Human if fails"]].map(([c,h])=>_.jsx(lc,{active:t.gate===c,onClick:()=>l("gate",c),children:h},c))})]}),_.jsxs("div",{className:"flex flex-col gap-0.5",children:[_.jsx("span",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.4)"},children:"Role"}),_.jsx("div",{className:"flex gap-1",children:["neutral","creator","evaluator"].map(c=>_.jsx(lc,{active:t.role===c,onClick:()=>l("role",c),children:c},c))})]})]}),u.length>0&&_.jsxs("div",{className:"flex flex-col gap-0.5",children:[_.jsx("span",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.4)"},children:"Depends on"}),_.jsx("div",{className:"flex flex-wrap gap-1.5",children:u.map(c=>_.jsxs("label",{className:"flex items-center gap-1 text-[10px] cursor-pointer",style:{color:"rgba(230,237,243,0.55)"},children:[_.jsx("input",{type:"checkbox",checked:t.dependsOn.includes(c),onChange:h=>l("dependsOn",h.target.checked?[...t.dependsOn,c]:t.dependsOn.filter(v=>v!==c))}),_.jsx("span",{className:"font-mono",children:c})]},c))})]}),_.jsxs("div",{className:"flex gap-3 text-[10px]",style:{color:"rgba(230,237,243,0.45)"},children:[_.jsxs("label",{className:"flex items-center gap-1 cursor-pointer",children:[_.jsx("input",{type:"checkbox",checked:t.executesCode,onChange:c=>l("executesCode",c.target.checked)}),"executes code"]}),_.jsxs("label",{className:"flex items-center gap-1 cursor-pointer",children:[_.jsx("input",{type:"checkbox",checked:t.verifiedEvidence,onChange:c=>l("verifiedEvidence",c.target.checked)}),"verified evidence"]})]})]})}function oj({initial:t,onSaved:e,onCancel:r}){const[n,i]=ne.useState((t==null?void 0:t.id)??""),[s,o]=ne.useState(()=>t?t.phases.map(L=>{const A=L.executor,I=(A==null?void 0:A.type)==="tool"?"command":"agent";return{_key:Math.random().toString(36).slice(2),id:L.id,kind:L.kind,execMode:I,cmd:(A==null?void 0:A.type)==="tool"?A.cmd.join(" "):"",script:"",scriptLang:"bash",scriptPath:"",gate:L.gate==="auto"?"auto":typeof L.gate=="object"&&L.gate!==null&&"human_confirm_if"in L.gate?"human_if":"human",role:L.role,dependsOn:L.depends_on,executesCode:L.executes_code,verifiedEvidence:L.verified_evidence}}):[Yb()]),[a,l]=ne.useState(!1),[u,c]=ne.useState(null),[h,v]=ne.useState(!1),[d,x]=ne.useState(""),w=s.map(L=>L.id).filter(Boolean);function g(L,A){o(I=>I.map((M,B)=>B===L?A:M))}function m(L){o(A=>A.filter((I,M)=>M!==L))}function y(){o(L=>[...L,Yb()])}function b(L){L!==0&&o(A=>{const I=[...A];return[I[L-1],I[L]]=[I[L],I[L-1]],I})}function S(L){o(A=>{if(L>=A.length-1)return A;const I=[...A];return[I[L],I[L+1]]=[I[L+1],I[L]],I})}async function N(){try{const L=await Xb(n,s);x(JSON.stringify(L,null,2)),v(!0)}catch(L){c(L instanceof Error?L.message:String(L))}}async function E(){if(!n.trim()){c("Workflow ID is required");return}if(s.length===0){c("At least one phase is required");return}l(!0),c(null);try{const L=await Xb(n.trim(),s);await at.createWorkflow(L),e(L)}catch(L){c(L instanceof Error?L.message:String(L))}finally{l(!1)}}const T=ne.useRef(null);function k(L){var M;const A=(M=L.target.files)==null?void 0:M[0];if(!A)return;const I=new FileReader;I.onload=B=>{var D;try{const H=JSON.parse((D=B.target)==null?void 0:D.result);i(H.id??""),o(H.phases.map(U=>{const z=U.executor;return{_key:Math.random().toString(36).slice(2),id:U.id,kind:U.kind,execMode:(z==null?void 0:z.type)==="tool"?"command":"agent",cmd:(z==null?void 0:z.type)==="tool"?z.cmd.join(" "):"",script:"",scriptLang:"bash",scriptPath:"",gate:U.gate==="auto"?"auto":typeof U.gate=="object"&&U.gate!==null&&"human_confirm_if"in U.gate?"human_if":"human",role:U.role,dependsOn:U.depends_on,executesCode:U.executes_code,verifiedEvidence:U.verified_evidence}})),c(null)}catch{c("Could not parse workflow JSON")}},I.readAsText(A),L.target.value=""}return _.jsxs("div",{className:"flex flex-col gap-3 min-w-0",children:[_.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[_.jsx("input",{className:"flex-1 rounded px-2 py-1 text-xs font-semibold focus:outline-none",placeholder:"workflow-id (e.g. my-deploy)",value:n,onChange:L=>i(L.target.value),style:nl}),_.jsx("input",{ref:T,type:"file",accept:".json",className:"hidden",onChange:k}),_.jsx("button",{type:"button",onClick:()=>{var L;return(L=T.current)==null?void 0:L.click()},className:"rounded px-2 py-1 text-[11px]",style:{border:"1px solid rgba(230,237,243,0.1)",color:"rgba(230,237,243,0.6)"},children:"Upload JSON"}),_.jsx("button",{type:"button",onClick:()=>void N(),className:"rounded px-2 py-1 text-[11px]",style:{border:"1px solid rgba(230,237,243,0.1)",color:"rgba(230,237,243,0.6)"},children:"Preview JSON"}),_.jsx("button",{type:"button",onClick:r,className:"text-[11px] px-1 hover:underline",style:{color:"rgba(230,237,243,0.4)"},children:"Cancel"})]}),h&&_.jsxs("div",{className:"relative",children:[_.jsx("pre",{className:"rounded text-[10px] p-3 overflow-auto max-h-48 font-mono",style:{background:"#0d1117",color:"#3fb950"},children:d}),_.jsx("button",{type:"button",onClick:()=>v(!1),className:"absolute top-1 right-1 text-[10px]",style:{color:"rgba(230,237,243,0.4)"},children:"✕"})]}),_.jsx("div",{className:"flex flex-col gap-2",children:s.map((L,A)=>_.jsx(sj,{phase:L,index:A,total:s.length,allIds:w,onChange:I=>g(A,I),onRemove:()=>m(A),onMoveUp:()=>b(A),onMoveDown:()=>S(A)},L._key))}),_.jsx("button",{type:"button",onClick:y,className:"self-start rounded px-3 py-1 text-[11px] transition-colors",style:{border:"1px dashed rgba(230,237,243,0.15)",color:"rgba(230,237,243,0.45)"},children:"+ Add phase"}),u&&_.jsx("p",{className:"text-[11px]",style:{color:"#f85149"},children:u}),_.jsx("button",{type:"button",onClick:()=>void E(),disabled:a,className:"self-start rounded px-4 py-1.5 text-[11px] font-semibold disabled:opacity-50",style:{background:"#3fb950",color:"#0d1117"},children:a?"Saving…":"Save workflow"})]})}function lj(){const[t,e]=ne.useState([]),[r,n]=ne.useState(null),[i,s]=ne.useState(!0),[o,a]=ne.useState(null),[l,u]=ne.useState(!1),[c,h]=ne.useState(void 0),v=ne.useRef(null);v.current=r;const d=ne.useCallback(async()=>{var m;s(!0),a(null);try{const{workflows:y}=await at.listWorkflows();e(y),y.length>0&&!v.current&&n(((m=y[0])==null?void 0:m.id)??null)}catch(y){a(y instanceof Error?y.message:String(y))}finally{s(!1)}},[]);ne.useEffect(()=>{d()},[d]);function x(m){h(m),u(!0)}function w(m){e(y=>y.findIndex(S=>S.id===m.id)>=0?y.map(S=>S.id===m.id?m:S):[...y,m]),n(m.id),u(!1)}const g=t.find(m=>m.id===r)??null;return _.jsxs("div",{className:"flex flex-col gap-4",children:[_.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[_.jsx("h2",{className:"text-sm font-semibold flex-1",style:{color:"#e6edf3"},children:"Workflows"}),!l&&_.jsxs(_.Fragment,{children:[_.jsx("button",{type:"button",onClick:()=>x(),className:"rounded px-3 py-1 text-[11px] font-semibold",style:{background:"#3fb950",color:"#0d1117"},children:"New workflow"}),_.jsx("button",{type:"button",onClick:()=>void d(),className:"text-[10px] hover:underline",style:{color:"rgba(230,237,243,0.4)"},children:"Refresh"})]})]}),i&&_.jsx("p",{className:"text-xs",style:{color:"rgba(230,237,243,0.4)"},children:"Loading workflows…"}),o&&_.jsx("p",{className:"rounded px-2 py-1 text-xs",style:{background:"rgba(248,81,73,0.08)",color:"#f85149"},children:o}),_.jsxs("div",{className:"flex gap-4",children:[!l&&_.jsx("div",{className:"flex flex-col gap-1.5 w-40 shrink-0",children:t.map(m=>_.jsxs("button",{type:"button",onClick:()=>n(m.id),className:"w-full text-left rounded px-3 py-2 text-[11px] transition-colors",style:m.id===r?{border:"1px solid rgba(121,192,255,0.4)",background:"rgba(121,192,255,0.08)",color:"#79c0ff"}:{border:"1px solid rgba(230,237,243,0.08)",background:"#1b222e",color:"rgba(230,237,243,0.7)"},children:[_.jsx("div",{className:"font-semibold",children:m.id}),_.jsxs("div",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.35)"},children:[m.phases.length," phases"]})]},m.id))}),_.jsx("div",{className:"flex-1 min-w-0",children:l?_.jsx(oj,{...c!==void 0?{initial:c}:{},onSaved:w,onCancel:()=>u(!1)}):g?_.jsxs("div",{className:"flex flex-col gap-2",children:[_.jsxs("div",{className:"flex items-center gap-2",children:[_.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider font-mono",style:{color:"rgba(230,237,243,0.4)"},children:g.id}),_.jsxs("span",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.35)"},children:["— ",g.phases.length," phases"]}),_.jsx("button",{type:"button",onClick:()=>x(g),className:"ml-auto text-[10px] hover:underline",style:{color:"#79c0ff"},children:"Edit"}),_.jsx("button",{type:"button",onClick:()=>x({...g,id:`${g.id}-copy`}),className:"text-[10px] hover:underline",style:{color:"rgba(230,237,243,0.4)"},children:"Duplicate"})]}),g.phases.map(m=>_.jsx(nj,{phase:m},m.id))]}):null})]}),!l&&_.jsxs("p",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.25)"},children:["Workflows saved to ",_.jsx("span",{style:{color:"rgba(230,237,243,0.4)"},children:"~/.wicked/workflows/"})," and registered immediately. Scripts saved to ",_.jsx("span",{style:{color:"rgba(230,237,243,0.4)"},children:"~/.wicked/scripts/"}),"."]})]})}const v2=t=>["completed","failed","cancelled"].includes(t),av=t=>!v2(t),sv=t=>t==="completed",Kb=t=>t==="failed"||t==="cancelled",Qb=[{id:"all",label:"All"},{id:"active",label:"Active"},{id:"completed",label:"Completed"},{id:"failed",label:"Failed"}];function uj({runs:t,selectedRunId:e,onSelect:r,navigate:n}){const[i,s]=ne.useState(""),[o,a]=ne.useState("all"),l=ne.useRef([]),{range:u,setRange:c,filter:h}=Wv("30d"),v=ne.useMemo(()=>t.filter(E=>!!E.session.workflow_id&&E.session.workflow_id!=="chat"),[t]),d=ne.useMemo(()=>h(v),[v,h]),x=i.toLowerCase(),w=ne.useMemo(()=>i?d.filter(E=>E.session.problem.toLowerCase().includes(x)):d,[d,i,x]),g=ne.useMemo(()=>{const E=d.length,T=d.filter(D=>av(D.session.status)).length,k=d.filter(D=>sv(D.session.status)).length,L=d.filter(D=>v2(D.session.status)).length,A=L>0?`${Math.round(k/L*100)}%`:"—",I=new Map;for(const D of d){const H=D.session.workflow_id;H&&H!=="chat"&&!H.startsWith("wf-")&&I.set(H,(I.get(H)??0)+1)}let M="—",B=0;return I.forEach((D,H)=>{D>B&&(B=D,M=H)}),{total:E,active:T,successRate:A,topWorkflow:M}},[d]),m={all:w.length,active:w.filter(E=>av(E.session.status)).length,completed:w.filter(E=>sv(E.session.status)).length,failed:w.filter(E=>Kb(E.session.status)).length},y=w.filter(E=>av(E.session.status)),b=w.filter(E=>sv(E.session.status)),S=w.filter(E=>Kb(E.session.status)),N=o==="all"?w:o==="active"?y:o==="completed"?b:S;return _.jsxs("div",{className:"flex flex-col h-full",style:{color:"#e6edf3"},children:[_.jsxs("div",{className:"px-8 pt-8 pb-4 flex items-center gap-4",children:[_.jsx("h1",{className:"text-xl font-semibold font-mono",children:"Work"}),_.jsx("div",{className:"flex-1"}),_.jsx(Vv,{value:u,onChange:c}),_.jsx("input",{type:"text",placeholder:"Search work…",value:i,onChange:E=>s(E.target.value),className:"rounded-xl px-4 py-2 text-sm font-mono outline-none",style:{background:"#1b222e",border:"1px solid rgba(230,237,243,0.12)",color:"#e6edf3",width:"240px"}}),_.jsx("button",{type:"button",onClick:()=>n("/runs/new"),className:"rounded-lg px-4 py-2 text-sm font-semibold font-mono shrink-0",style:{background:"#ffda19",color:"#0d1117"},children:"Do Work"})]}),_.jsx("div",{className:"px-8 pb-4 grid gap-3",style:{gridTemplateColumns:"repeat(4, 1fr)"},children:[{label:"Total Runs",value:String(g.total),accent:void 0},{label:"Active",value:String(g.active),accent:"#79c0ff"},{label:"Success Rate",value:g.successRate,accent:"#3fb950"},{label:"Top Workflow",value:g.topWorkflow,accent:void 0}].map(E=>_.jsxs("div",{className:"rounded-xl px-4 py-3",style:{background:"#1b222e",border:"1px solid rgba(230,237,243,0.07)"},children:[_.jsx("p",{className:"text-[10px] font-mono uppercase tracking-widest",style:{color:"rgba(230,237,243,0.4)",margin:0},children:E.label}),_.jsx("p",{className:"text-xl font-semibold font-mono mt-1 truncate",style:{color:E.accent??"#e6edf3",margin:"4px 0 0"},children:E.value})]},E.label))}),_.jsx("div",{role:"tablist","aria-label":"Filter by status",className:"px-8 pb-3 flex items-center gap-2",onKeyDown:E=>{var A;const T=Qb.map(I=>I.id),k=T.indexOf(o);let L=null;E.key==="ArrowRight"||E.key==="ArrowDown"?(E.preventDefault(),L=(k+1)%T.length):(E.key==="ArrowLeft"||E.key==="ArrowUp")&&(E.preventDefault(),L=(k-1+T.length)%T.length),L!==null&&(a(T[L]),(A=l.current[L])==null||A.focus())},children:Qb.map((E,T)=>_.jsxs("button",{ref:k=>{l.current[T]=k},id:`work-tab-${E.id}`,type:"button",role:"tab","aria-selected":o===E.id,"aria-controls":`work-panel-${E.id}`,tabIndex:o===E.id?0:-1,onClick:()=>a(E.id),className:"rounded-full px-3 py-1 text-xs font-mono",style:o===E.id?{background:"rgba(230,237,243,0.1)",color:"#e6edf3"}:{color:"rgba(230,237,243,0.4)"},children:[E.label," ",m[E.id]]},E.id))}),_.jsx("div",{id:`work-panel-${o}`,role:"tabpanel","aria-labelledby":`work-tab-${o}`,className:"flex-1 overflow-y-auto px-5 pb-8 flex flex-col",children:o==="all"?_.jsxs(_.Fragment,{children:[y.length>0&&_.jsxs(_.Fragment,{children:[_.jsx(ov,{pulse:!0,children:"Active"}),y.map(E=>_.jsx(Gi,{view:E,selectedRunId:e,onSelect:r},E.session.id))]}),b.length>0&&_.jsxs(_.Fragment,{children:[_.jsx(ov,{children:"Completed"}),b.map(E=>_.jsx(Gi,{view:E,selectedRunId:e,onSelect:r},E.session.id))]}),S.length>0&&_.jsxs(_.Fragment,{children:[_.jsx(ov,{children:"Failed"}),S.map(E=>_.jsx(Gi,{view:E,selectedRunId:e,onSelect:r},E.session.id))]}),w.length===0&&_.jsx(Zb,{query:i})]}):_.jsx(_.Fragment,{children:N.length===0?_.jsx(Zb,{query:i,tab:o}):N.map(E=>_.jsx(Gi,{view:E,selectedRunId:e,onSelect:r},E.session.id))})})]})}function ov({children:t,pulse:e}){return _.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 text-[10px] uppercase tracking-widest font-semibold font-mono",style:{color:"rgba(230,237,243,0.4)"},children:[e&&_.jsx("span",{className:"w-1.5 h-1.5 rounded-full animate-pulse shrink-0",style:{background:"#79c0ff"}}),t]})}function Zb({query:t,tab:e}){const r=t?`No runs match "${t}".`:e?`No ${e} runs yet.`:"No work sessions yet.";return _.jsx("p",{className:"px-3 py-6 text-sm font-mono italic",style:{color:"rgba(230,237,243,0.35)"},children:r})}const g2="wicked_default_clis";function cj({label:t,description:e,children:r}){return _.jsxs("div",{className:"flex items-start justify-between gap-6 py-4 border-b last:border-b-0",style:{borderColor:"rgba(230,237,243,0.07)"},children:[_.jsxs("div",{className:"flex-1 min-w-0",children:[_.jsx("p",{className:"text-sm font-medium",style:{color:"#e6edf3"},children:t}),_.jsx("p",{className:"text-xs mt-0.5",style:{color:"rgba(230,237,243,0.45)"},children:e})]}),_.jsx("div",{className:"shrink-0",children:r})]})}function hj(t){try{const e=localStorage.getItem(g2);if(e)return new Set(JSON.parse(e))}catch{}return new Set(t.filter(e=>e.enabled_for_council).map(e=>e.key))}function fj(){const[t,e]=ne.useState(null),[r,n]=ne.useState({}),[i,s]=ne.useState(!1),[o,a]=ne.useState(!1),[l,u]=ne.useState(null),c=ne.useRef(null),[h,v]=ne.useState([]),[d,x]=ne.useState(new Set),[w,g]=ne.useState(!1),m=ne.useRef(null);ne.useEffect(()=>{at.getSettings().then(({settings:k})=>e(k)).catch(k=>u(String(k))),at.getRoster().then(({roster:k})=>{v(k),x(hj(k))}).catch(()=>{})},[]),ne.useEffect(()=>()=>{m.current&&clearTimeout(m.current)},[]);function y(k){x(L=>{const A=new Set(L);return A.has(k)?A.delete(k):A.add(k),A})}function b(){u(null);try{localStorage.setItem(g2,JSON.stringify([...d]))}catch(k){u(String(k));return}g(!0),m.current&&clearTimeout(m.current),m.current=setTimeout(()=>g(!1),2500)}ne.useEffect(()=>()=>{c.current&&clearTimeout(c.current)},[]);function S(k,L){n(A=>({...A,[k]:L})),a(!1)}async function N(){if(Object.keys(r).length!==0){s(!0),u(null);try{const{settings:k}=await at.updateSettings(r);e(k),n({}),a(!0),c.current&&clearTimeout(c.current),c.current=setTimeout(()=>a(!1),2500)}catch(k){u(String(k))}finally{s(!1)}}}const E={graphNodeLimit:150,...t,...r},T=Object.keys(r).length>0;return _.jsxs("div",{className:"max-w-2xl mx-auto",children:[_.jsxs("div",{className:"mb-6",children:[_.jsx("h1",{className:"text-lg font-semibold",style:{color:"#e6edf3"},children:"System"}),_.jsxs("p",{className:"text-sm mt-1",style:{color:"rgba(230,237,243,0.45)"},children:["Runtime tunables persisted to"," ",_.jsx("code",{className:"font-mono text-xs rounded px-1 py-0.5",style:{background:"rgba(230,237,243,0.06)",color:"rgba(230,237,243,0.7)"},children:"~/.config/wicked-core/settings.json"}),"."]})]}),l&&_.jsx("div",{className:"mb-4 px-3 py-2 rounded text-xs",style:{background:"rgba(248,81,73,0.08)",border:"1px solid rgba(248,81,73,0.3)",color:"#f85149"},children:l}),_.jsxs("section",{className:"rounded-xl px-5 mb-6",style:{background:"#1b222e",border:"1px solid rgba(230,237,243,0.07)"},children:[_.jsx("h2",{className:"text-xs font-semibold uppercase tracking-wide pt-4 pb-2 font-mono",style:{color:"rgba(230,237,243,0.4)"},children:"Code Graph"}),_.jsx(cj,{label:"Graph node limit",description:"Maximum number of symbols returned by wicked-estate graph-view per repo. Higher values show more of the graph but take longer to render. Requires reopening the graph modal to take effect.",children:_.jsx("input",{type:"number",min:20,max:500,step:10,value:E.graphNodeLimit,onChange:k=>{const L=Number(k.target.value);Number.isNaN(L)||S("graphNodeLimit",Math.max(20,Math.min(500,L)))},className:"w-24 rounded px-2 py-1 text-sm text-right tabular-nums focus:outline-none",style:{background:"#161c26",border:"1px solid rgba(230,237,243,0.12)",color:"#e6edf3"}})})]}),_.jsxs("div",{className:"flex items-center gap-3 mb-8",children:[_.jsx("button",{type:"button",onClick:N,disabled:!T||i,className:"px-4 py-2 rounded-lg text-sm font-medium transition-colors disabled:opacity-40",style:T&&!i?{background:"#3fb950",color:"#0d1117"}:{background:"rgba(230,237,243,0.06)",color:"rgba(230,237,243,0.35)",cursor:"not-allowed"},children:i?"Saving…":"Save"}),o&&_.jsx("span",{className:"text-xs font-medium",style:{color:"#3fb950"},children:"Saved"})]}),_.jsxs("section",{className:"rounded-xl px-5 mb-6",style:{background:"#1b222e",border:"1px solid rgba(230,237,243,0.07)"},children:[_.jsx("h2",{className:"text-xs font-semibold uppercase tracking-wide pt-4 pb-2 font-mono",style:{color:"rgba(230,237,243,0.4)"},children:"Default CLIs"}),_.jsx("p",{className:"text-xs mb-4",style:{color:"rgba(230,237,243,0.4)"},children:"Which CLIs are pre-selected when you open the launch form. Changes take effect on the next new session."}),h.length===0?_.jsx("p",{className:"text-xs italic pb-4 font-mono",style:{color:"rgba(230,237,243,0.3)"},children:"Loading roster…"}):_.jsx("div",{className:"flex flex-col gap-2 pb-4",children:h.map(k=>_.jsxs("label",{className:"flex items-center gap-3 cursor-pointer group",children:[_.jsx("input",{type:"checkbox",checked:d.has(k.key),onChange:()=>y(k.key),className:"accent-[#ffda19] w-3.5 h-3.5 shrink-0"}),_.jsx("span",{className:"text-sm font-mono flex-1",style:{color:"#e6edf3"},children:k.display_name}),_.jsx("span",{className:"text-xs font-mono",style:{color:"rgba(230,237,243,0.3)"},children:k.key})]},k.key))}),h.length>0&&_.jsxs("div",{className:"flex items-center gap-3 pb-4 pt-2 border-t",style:{borderColor:"rgba(230,237,243,0.07)"},children:[_.jsx("button",{type:"button",onClick:b,className:"px-4 py-2 rounded-lg text-sm font-medium",style:{background:"#ffda19",color:"#0d1117"},children:"Save CLI defaults"}),w&&_.jsx("span",{className:"text-xs font-medium",style:{color:"#3fb950"},children:"Saved"})]})]})]})}function dj(t){const e=$v(n=>n.setStatus),r=ne.useRef(t);r.current=t,ne.useEffect(()=>{let n=!1,i=null;function s(){if(n)return;const o=new WebSocket(`${rw()}/ws`);i=o,o.onopen=()=>{i===o&&e("connected")},o.onmessage=a=>{if(i===o)try{const l=JSON.parse(String(a.data));l!==null&&typeof l=="object"&&typeof l.type=="string"&&r.current(l)}catch{}},o.onclose=()=>{i===o&&e("disconnected"),n||setTimeout(s,3e3)},o.onerror=()=>{o.close()}}return s(),()=>{n=!0,i&&i.readyState!==WebSocket.CLOSED&&i.readyState!==WebSocket.CLOSING&&i.close(),i=null}},[e])}const pj=["runs","coverage","workflows","domain","policies","rules","repos","system","chats","work","repo-detail"];function Jb(t){try{return decodeURIComponent(t)}catch{return t}}function vj(t){const[,e="",r=""]=t.split("/");return e==="repo-detail"&&r?{panel:"repo-detail",runId:null,showLaunch:!1,repoId:Jb(r),showRegisterRepo:!1,chatMode:!1}:e==="repo-detail"?{panel:"repos",runId:null,showLaunch:!1,repoId:null,showRegisterRepo:!1,chatMode:!1}:e==="repos"&&r==="new"?{panel:"repos",runId:null,showLaunch:!1,repoId:null,showRegisterRepo:!0,chatMode:!1}:e==="chat"&&r==="new"?{panel:"runs",runId:null,showLaunch:!0,repoId:null,showRegisterRepo:!1,chatMode:!0}:pj.includes(e)&&e!=="runs"?{panel:e,runId:null,showLaunch:!1,repoId:null,showRegisterRepo:!1,chatMode:!1}:r==="new"?{panel:"runs",runId:null,showLaunch:!0,repoId:null,showRegisterRepo:!1,chatMode:!1}:r?{panel:"runs",runId:Jb(r),showLaunch:!1,repoId:null,showRegisterRepo:!1,chatMode:!1}:{panel:"runs",runId:null,showLaunch:!1,repoId:null,showRegisterRepo:!1,chatMode:!1}}function gj(){const[t,e]=ne.useState(()=>window.location.pathname);ne.useEffect(()=>{const i=()=>e(window.location.pathname);return window.addEventListener("popstate",i),()=>window.removeEventListener("popstate",i)},[]);const r=ne.useCallback(i=>{history.pushState(null,"",i),e(i)},[]),n=ne.useCallback(i=>i==="runs"?"/":`/${i}`,[]);return{...vj(t),navigate:r,panelPath:n}}function mj(){const t=$v(u=>u.status),e=ei(u=>u.setGate),r=ei(u=>u.reconcile),[n,i]=ne.useState([]),[s,o]=ne.useState(0),a=ne.useRef(null),l=ne.useCallback(()=>{a.current!==null&&clearTimeout(a.current),a.current=setTimeout(()=>{a.current=null,o(u=>u+1)},400)},[]);return ne.useEffect(()=>()=>{a.current!==null&&clearTimeout(a.current)},[]),ne.useEffect(()=>{if(t!=="connected")return;let u=!1;return(async()=>{let c;try{({runs:c}=await at.listRuns())}catch{return}if(u)return;i(c);const h=c.filter(v=>v.session.status==="awaiting_human").map(v=>v.session.id);r(h);for(const v of h)if(!ei.getState().gates[v])try{const d=await at.getGate(v);if(u)return;e({runId:d.runId,ord:d.ord,prompt:d.prompt,lifecycle:d.lifecycle,receivedAt:Date.parse(d.receivedAt)||Date.now()})}catch{}})(),()=>{u=!0}},[t,s,e,r]),{runs:n,refresh:l}}const yj=new Set(["sessionStarted","unitPlanned","unitDistributed","unitExecuting","gateDecided","unitDone","unitDenied","awaitingHuman","resumed","runCancelled","sessionFailed","sessionCompleted"]);function xj(t,e,r){ne.useEffect(()=>{if(!t)return;function n(i){var s,o,a;if((i.ctrlKey||i.metaKey)&&i.key==="k"&&t){const l=((o=(s=i.target)==null?void 0:s.tagName)==null?void 0:o.toLowerCase())??"",u=((a=i.target)==null?void 0:a.isContentEditable)??!1;if(l==="input"||l==="textarea"||l==="select"||u)return;const c=e.find(v=>v.session.id===t);if(!c)return;["completed","cancelled","failed"].includes(c.session.status)||(i.preventDefault(),r(t))}}return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[t,e,r])}function bj(){const{panel:t,runId:e,repoId:r,showLaunch:n,showRegisterRepo:i,chatMode:s,navigate:o}=gj(),{runs:a,refresh:l}=mj(),u=ei(I=>I.ingest),c=uc(I=>I.ingest),h=Oa(I=>I.ingest),v=Ec(I=>I.ingest),d=ne.useCallback(()=>{l()},[l]),x=ne.useCallback(()=>{l()},[l]),w=ne.useCallback(I=>{u(I),c(I),h(I),v(I),yj.has(I.type)&&l()},[u,c,h,v,l]);dj(w);const g=ne.useCallback(I=>o(`/runs/${encodeURIComponent(I)}`),[o]),m=ne.useCallback(I=>{l(),o(`/runs/${encodeURIComponent(I)}`)},[o,l]),y=ne.useCallback(()=>o("/"),[o]),b=ne.useCallback(async I=>{try{await at.cancelRun(I),l()}catch{}},[l]);xj(e,a,b);const S=a.find(I=>I.session.id===e)??null,[N,E]=ne.useState(null),[T,k]=ne.useState(null),L=ne.useCallback(I=>{r&&(k(I??null),at.listRepos().then(({repos:M})=>{const B=M.find(D=>D.id===r);B&&E(B)}))},[r]);function A(){return t==="coverage"?_.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:_.jsx(sw,{})}):t==="workflows"?_.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:_.jsx(lj,{})}):t==="domain"?_.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:_.jsx(BE,{})}):t==="policies"?_.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:_.jsx(ik,{})}):t==="rules"?_.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:_.jsx(QA,{})}):t==="repos"?_.jsx("div",{className:"flex-1 overflow-hidden",children:_.jsx(ok,{onSelectRun:g,autoShowRegister:i,navigate:o})}):t==="repo-detail"&&r?_.jsx("div",{className:"flex-1 overflow-y-auto",children:_.jsx(dk,{repoId:r,onSelectRun:g,navigate:o,onOpenGraph:L})}):t==="chats"?_.jsx("div",{className:"flex-1 overflow-y-auto",children:_.jsx(RE,{runs:a,onSelect:g,navigate:o})}):t==="work"?_.jsx("div",{className:"flex-1 overflow-y-auto",children:_.jsx(uj,{runs:a,selectedRunId:e,onSelect:g,navigate:o})}):t==="system"?_.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:_.jsx(fj,{})}):t==="runs"&&!e&&!S&&!n?_.jsx("div",{className:"flex-1 overflow-y-auto",children:_.jsx(TE,{runs:a,onSelectRun:g,onApproveGate:d,onRejectGate:x,navigate:o})}):_.jsx("div",{className:"flex-1 overflow-hidden",children:_.jsx(ej,{view:S,chatMode:s,onLaunched:m,onNavigateBack:y,onRefresh:l,onKill:b})})}return _.jsxs("div",{className:"flex h-screen overflow-hidden bg-wk-canvas",children:[_.jsx(ZE,{runs:a,selectedRunId:e,onSelectRun:g,navigate:o}),_.jsx("div",{className:"flex flex-1 overflow-hidden",children:A()}),S!==null&&_.jsx(YA,{view:S}),_.jsx(jE,{onSelect:g}),N!==null&&_.jsx(mA,{repo:N,initialFocus:T,onClose:()=>{E(null),k(null)},onSelectRun:g})]})}class wj extends ne.Component{constructor(){super(...arguments);i0(this,"state",{error:null})}static getDerivedStateFromError(r){return{error:r}}componentDidCatch(r,n){console.error("[ErrorBoundary]",r,n.componentStack)}render(){return this.state.error?this.props.fallback?this.props.fallback:_.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4 p-8 font-mono",style:{color:"rgba(230,237,243,0.5)"},children:[_.jsx("p",{className:"text-sm font-semibold",style:{color:"#f85149"},children:"Something went wrong"}),_.jsx("p",{className:"text-xs text-center max-w-sm",style:{color:"rgba(230,237,243,0.4)"},children:this.state.error.message||"An unexpected error occurred."}),_.jsx("button",{type:"button",onClick:()=>window.location.reload(),className:"text-xs px-4 py-1.5 rounded-lg transition-opacity hover:opacity-80",style:{background:"rgba(230,237,243,0.08)",color:"#e6edf3"},children:"Reload"})]}):this.props.children}}const m2=document.getElementById("root");if(!m2)throw new Error("Root element not found");uE.createRoot(m2).render(_.jsx(ne.StrictMode,{children:_.jsx(wj,{children:_.jsx(bj,{})})}));