wicked-studio 0.1.1 → 0.2.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.
|
@@ -1,423 +0,0 @@
|
|
|
1
|
-
var Ek=Object.defineProperty;var Tk=(t,e,r)=>e in t?Ek(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var y0=(t,e,r)=>Tk(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 Kc(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var ef={exports:{}},Fo={},tf={exports:{}},St={};/**
|
|
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 x0;function Nk(){if(x0)return St;x0=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"),d=Symbol.iterator;function g(z){return z===null||typeof z!="object"?null:(z=d&&z[d]||z["@@iterator"],typeof z=="function"?z:null)}var f={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},y=Object.assign,_={};function v(z,G,V){this.props=z,this.context=G,this.refs=_,this.updater=V||f}v.prototype.isReactComponent={},v.prototype.setState=function(z,G){if(typeof z!="object"&&typeof z!="function"&&z!=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,z,G,"setState")},v.prototype.forceUpdate=function(z){this.updater.enqueueForceUpdate(this,z,"forceUpdate")};function m(){}m.prototype=v.prototype;function x(z,G,V){this.props=z,this.context=G,this.refs=_,this.updater=V||f}var b=x.prototype=new m;b.constructor=x,y(b,v.prototype),b.isPureReactComponent=!0;var S=Array.isArray,T=Object.prototype.hasOwnProperty,N={current:null},E={key:!0,ref:!0,__self:!0,__source:!0};function k(z,G,V){var te,ie={},ne=null,X=null;if(G!=null)for(te in G.ref!==void 0&&(X=G.ref),G.key!==void 0&&(ne=""+G.key),G)T.call(G,te)&&!E.hasOwnProperty(te)&&(ie[te]=G[te]);var q=arguments.length-2;if(q===1)ie.children=V;else if(1<q){for(var Y=Array(q),K=0;K<q;K++)Y[K]=arguments[K+2];ie.children=Y}if(z&&z.defaultProps)for(te in q=z.defaultProps,q)ie[te]===void 0&&(ie[te]=q[te]);return{$$typeof:t,type:z,key:ne,ref:X,props:ie,_owner:N.current}}function L(z,G){return{$$typeof:t,type:z.type,key:G,ref:z.ref,props:z.props,_owner:z._owner}}function A(z){return typeof z=="object"&&z!==null&&z.$$typeof===t}function I(z){var G={"=":"=0",":":"=2"};return"$"+z.replace(/[=:]/g,function(V){return G[V]})}var O=/\/+/g;function B(z,G){return typeof z=="object"&&z!==null&&z.key!=null?I(""+z.key):G.toString(36)}function D(z,G,V,te,ie){var ne=typeof z;(ne==="undefined"||ne==="boolean")&&(z=null);var X=!1;if(z===null)X=!0;else switch(ne){case"string":case"number":X=!0;break;case"object":switch(z.$$typeof){case t:case e:X=!0}}if(X)return X=z,ie=ie(X),z=te===""?"."+B(X,0):te,S(ie)?(V="",z!=null&&(V=z.replace(O,"$&/")+"/"),D(ie,G,V,"",function(K){return K})):ie!=null&&(A(ie)&&(ie=L(ie,V+(!ie.key||X&&X.key===ie.key?"":(""+ie.key).replace(O,"$&/")+"/")+z)),G.push(ie)),1;if(X=0,te=te===""?".":te+":",S(z))for(var q=0;q<z.length;q++){ne=z[q];var Y=te+B(ne,q);X+=D(ne,G,V,Y,ie)}else if(Y=g(z),typeof Y=="function")for(z=Y.call(z),q=0;!(ne=z.next()).done;)ne=ne.value,Y=te+B(ne,q++),X+=D(ne,G,V,Y,ie);else if(ne==="object")throw G=String(z),Error("Objects are not valid as a React child (found: "+(G==="[object Object]"?"object with keys {"+Object.keys(z).join(", ")+"}":G)+"). If you meant to render a collection of children, use an array instead.");return X}function M(z,G,V){if(z==null)return z;var te=[],ie=0;return D(z,te,"","",function(ne){return G.call(V,ne,ie++)}),te}function U(z){if(z._status===-1){var G=z._result;G=G(),G.then(function(V){(z._status===0||z._status===-1)&&(z._status=1,z._result=V)},function(V){(z._status===0||z._status===-1)&&(z._status=2,z._result=V)}),z._status===-1&&(z._status=0,z._result=G)}if(z._status===1)return z._result.default;throw z._result}var H={current:null},$={transition:null},F={ReactCurrentDispatcher:H,ReactCurrentBatchConfig:$,ReactCurrentOwner:N};function P(){throw Error("act(...) is not supported in production builds of React.")}return St.Children={map:M,forEach:function(z,G,V){M(z,function(){G.apply(this,arguments)},V)},count:function(z){var G=0;return M(z,function(){G++}),G},toArray:function(z){return M(z,function(G){return G})||[]},only:function(z){if(!A(z))throw Error("React.Children.only expected to receive a single React element child.");return z}},St.Component=v,St.Fragment=r,St.Profiler=i,St.PureComponent=x,St.StrictMode=n,St.Suspense=l,St.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=F,St.act=P,St.cloneElement=function(z,G,V){if(z==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+z+".");var te=y({},z.props),ie=z.key,ne=z.ref,X=z._owner;if(G!=null){if(G.ref!==void 0&&(ne=G.ref,X=N.current),G.key!==void 0&&(ie=""+G.key),z.type&&z.type.defaultProps)var q=z.type.defaultProps;for(Y in G)T.call(G,Y)&&!E.hasOwnProperty(Y)&&(te[Y]=G[Y]===void 0&&q!==void 0?q[Y]:G[Y])}var Y=arguments.length-2;if(Y===1)te.children=V;else if(1<Y){q=Array(Y);for(var K=0;K<Y;K++)q[K]=arguments[K+2];te.children=q}return{$$typeof:t,type:z.type,key:ie,ref:ne,props:te,_owner:X}},St.createContext=function(z){return z={$$typeof:o,_currentValue:z,_currentValue2:z,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},z.Provider={$$typeof:s,_context:z},z.Consumer=z},St.createElement=k,St.createFactory=function(z){var G=k.bind(null,z);return G.type=z,G},St.createRef=function(){return{current:null}},St.forwardRef=function(z){return{$$typeof:a,render:z}},St.isValidElement=A,St.lazy=function(z){return{$$typeof:c,_payload:{_status:-1,_result:z},_init:U}},St.memo=function(z,G){return{$$typeof:u,type:z,compare:G===void 0?null:G}},St.startTransition=function(z){var G=$.transition;$.transition={};try{z()}finally{$.transition=G}},St.unstable_act=P,St.useCallback=function(z,G){return H.current.useCallback(z,G)},St.useContext=function(z){return H.current.useContext(z)},St.useDebugValue=function(){},St.useDeferredValue=function(z){return H.current.useDeferredValue(z)},St.useEffect=function(z,G){return H.current.useEffect(z,G)},St.useId=function(){return H.current.useId()},St.useImperativeHandle=function(z,G,V){return H.current.useImperativeHandle(z,G,V)},St.useInsertionEffect=function(z,G){return H.current.useInsertionEffect(z,G)},St.useLayoutEffect=function(z,G){return H.current.useLayoutEffect(z,G)},St.useMemo=function(z,G){return H.current.useMemo(z,G)},St.useReducer=function(z,G,V){return H.current.useReducer(z,G,V)},St.useRef=function(z){return H.current.useRef(z)},St.useState=function(z){return H.current.useState(z)},St.useSyncExternalStore=function(z,G,V){return H.current.useSyncExternalStore(z,G,V)},St.useTransition=function(){return H.current.useTransition()},St.version="18.3.1",St}var b0;function Yg(){return b0||(b0=1,tf.exports=Nk()),tf.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 w0;function Rk(){if(w0)return Fo;w0=1;var t=Yg(),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,d={},g=null,f=null;u!==void 0&&(g=""+u),l.key!==void 0&&(g=""+l.key),l.ref!==void 0&&(f=l.ref);for(c in l)n.call(l,c)&&!s.hasOwnProperty(c)&&(d[c]=l[c]);if(a&&a.defaultProps)for(c in l=a.defaultProps,l)d[c]===void 0&&(d[c]=l[c]);return{$$typeof:e,type:a,key:g,ref:f,props:d,_owner:i.current}}return Fo.Fragment=r,Fo.jsx=o,Fo.jsxs=o,Fo}var _0;function Lk(){return _0||(_0=1,ef.exports=Rk()),ef.exports}var w=Lk(),J=Yg();const Uu=Kc(J);var $u={},rf={exports:{}},sn={},nf={exports:{}},af={};/**
|
|
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 S0;function Dk(){return S0||(S0=1,(function(t){function e($,F){var P=$.length;$.push(F);e:for(;0<P;){var z=P-1>>>1,G=$[z];if(0<i(G,F))$[z]=F,$[P]=G,P=z;else break e}}function r($){return $.length===0?null:$[0]}function n($){if($.length===0)return null;var F=$[0],P=$.pop();if(P!==F){$[0]=P;e:for(var z=0,G=$.length,V=G>>>1;z<V;){var te=2*(z+1)-1,ie=$[te],ne=te+1,X=$[ne];if(0>i(ie,P))ne<G&&0>i(X,ie)?($[z]=X,$[ne]=P,z=ne):($[z]=ie,$[te]=P,z=te);else if(ne<G&&0>i(X,P))$[z]=X,$[ne]=P,z=ne;else break e}}return F}function i($,F){var P=$.sortIndex-F.sortIndex;return P!==0?P:$.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,d=null,g=3,f=!1,y=!1,_=!1,v=typeof setTimeout=="function"?setTimeout:null,m=typeof clearTimeout=="function"?clearTimeout:null,x=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($){for(var F=r(u);F!==null;){if(F.callback===null)n(u);else if(F.startTime<=$)n(u),F.sortIndex=F.expirationTime,e(l,F);else break;F=r(u)}}function S($){if(_=!1,b($),!y)if(r(l)!==null)y=!0,U(T);else{var F=r(u);F!==null&&H(S,F.startTime-$)}}function T($,F){y=!1,_&&(_=!1,m(k),k=-1),f=!0;var P=g;try{for(b(F),d=r(l);d!==null&&(!(d.expirationTime>F)||$&&!I());){var z=d.callback;if(typeof z=="function"){d.callback=null,g=d.priorityLevel;var G=z(d.expirationTime<=F);F=t.unstable_now(),typeof G=="function"?d.callback=G:d===r(l)&&n(l),b(F)}else n(l);d=r(l)}if(d!==null)var V=!0;else{var te=r(u);te!==null&&H(S,te.startTime-F),V=!1}return V}finally{d=null,g=P,f=!1}}var N=!1,E=null,k=-1,L=5,A=-1;function I(){return!(t.unstable_now()-A<L)}function O(){if(E!==null){var $=t.unstable_now();A=$;var F=!0;try{F=E(!0,$)}finally{F?B():(N=!1,E=null)}}else N=!1}var B;if(typeof x=="function")B=function(){x(O)};else if(typeof MessageChannel<"u"){var D=new MessageChannel,M=D.port2;D.port1.onmessage=O,B=function(){M.postMessage(null)}}else B=function(){v(O,0)};function U($){E=$,N||(N=!0,B())}function H($,F){k=v(function(){$(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($){$.callback=null},t.unstable_continueExecution=function(){y||f||(y=!0,U(T))},t.unstable_forceFrameRate=function($){0>$||125<$?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):L=0<$?Math.floor(1e3/$):5},t.unstable_getCurrentPriorityLevel=function(){return g},t.unstable_getFirstCallbackNode=function(){return r(l)},t.unstable_next=function($){switch(g){case 1:case 2:case 3:var F=3;break;default:F=g}var P=g;g=F;try{return $()}finally{g=P}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function($,F){switch($){case 1:case 2:case 3:case 4:case 5:break;default:$=3}var P=g;g=$;try{return F()}finally{g=P}},t.unstable_scheduleCallback=function($,F,P){var z=t.unstable_now();switch(typeof P=="object"&&P!==null?(P=P.delay,P=typeof P=="number"&&0<P?z+P:z):P=z,$){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,$={id:c++,callback:F,priorityLevel:$,startTime:P,expirationTime:G,sortIndex:-1},P>z?($.sortIndex=P,e(u,$),r(l)===null&&$===r(u)&&(_?(m(k),k=-1):_=!0,H(S,P-z))):($.sortIndex=G,e(l,$),y||f||(y=!0,U(T))),$},t.unstable_shouldYield=I,t.unstable_wrapCallback=function($){var F=g;return function(){var P=g;g=F;try{return $.apply(this,arguments)}finally{g=P}}}})(af)),af}var C0;function Ak(){return C0||(C0=1,nf.exports=Dk()),nf.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 k0;function Pk(){if(k0)return sn;k0=1;var t=Yg(),e=Ak();function r(h){for(var p="https://reactjs.org/docs/error-decoder.html?invariant="+h,C=1;C<arguments.length;C++)p+="&args[]="+encodeURIComponent(arguments[C]);return"Minified React error #"+h+"; 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(h,p){o(h,p),o(h+"Capture",p)}function o(h,p){for(i[h]=p,h=0;h<p.length;h++)n.add(p[h])}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={},d={};function g(h){return l.call(d,h)?!0:l.call(c,h)?!1:u.test(h)?d[h]=!0:(c[h]=!0,!1)}function f(h,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:(h=h.toLowerCase().slice(0,5),h!=="data-"&&h!=="aria-");default:return!1}}function y(h,p,C,R){if(p===null||typeof p>"u"||f(h,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 _(h,p,C,R,j,W,Q){this.acceptsBooleans=p===2||p===3||p===4,this.attributeName=R,this.attributeNamespace=j,this.mustUseProperty=C,this.propertyName=h,this.type=p,this.sanitizeURL=W,this.removeEmptyString=Q}var v={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(h){v[h]=new _(h,0,!1,h,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(h){var p=h[0];v[p]=new _(p,1,!1,h[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(h){v[h]=new _(h,2,!1,h.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(h){v[h]=new _(h,2,!1,h,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(h){v[h]=new _(h,3,!1,h.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(h){v[h]=new _(h,3,!0,h,null,!1,!1)}),["capture","download"].forEach(function(h){v[h]=new _(h,4,!1,h,null,!1,!1)}),["cols","rows","size","span"].forEach(function(h){v[h]=new _(h,6,!1,h,null,!1,!1)}),["rowSpan","start"].forEach(function(h){v[h]=new _(h,5,!1,h.toLowerCase(),null,!1,!1)});var m=/[\-:]([a-z])/g;function x(h){return h[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(h){var p=h.replace(m,x);v[p]=new _(p,1,!1,h,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(h){var p=h.replace(m,x);v[p]=new _(p,1,!1,h,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(h){var p=h.replace(m,x);v[p]=new _(p,1,!1,h,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(h){v[h]=new _(h,1,!1,h.toLowerCase(),null,!1,!1)}),v.xlinkHref=new _("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(h){v[h]=new _(h,1,!1,h.toLowerCase(),null,!0,!0)});function b(h,p,C,R){var j=v.hasOwnProperty(p)?v[p]:null;(j!==null?j.type!==0:R||!(2<p.length)||p[0]!=="o"&&p[0]!=="O"||p[1]!=="n"&&p[1]!=="N")&&(y(p,C,j,R)&&(C=null),R||j===null?g(p)&&(C===null?h.removeAttribute(p):h.setAttribute(p,""+C)):j.mustUseProperty?h[j.propertyName]=C===null?j.type===3?!1:"":C:(p=j.attributeName,R=j.attributeNamespace,C===null?h.removeAttribute(p):(j=j.type,C=j===3||j===4&&C===!0?"":""+C,R?h.setAttributeNS(R,p,C):h.setAttribute(p,C))))}var S=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,T=Symbol.for("react.element"),N=Symbol.for("react.portal"),E=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"),O=Symbol.for("react.forward_ref"),B=Symbol.for("react.suspense"),D=Symbol.for("react.suspense_list"),M=Symbol.for("react.memo"),U=Symbol.for("react.lazy"),H=Symbol.for("react.offscreen"),$=Symbol.iterator;function F(h){return h===null||typeof h!="object"?null:(h=$&&h[$]||h["@@iterator"],typeof h=="function"?h:null)}var P=Object.assign,z;function G(h){if(z===void 0)try{throw Error()}catch(C){var p=C.stack.trim().match(/\n( *(at )?)/);z=p&&p[1]||""}return`
|
|
34
|
-
`+z+h}var V=!1;function te(h,p){if(!h||V)return"";V=!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(h,[],p)}else{try{p.call()}catch(we){R=we}h.call(p.prototype)}else{try{throw Error()}catch(we){R=we}h()}}catch(we){if(we&&R&&typeof we.stack=="string"){for(var j=we.stack.split(`
|
|
35
|
-
`),W=R.stack.split(`
|
|
36
|
-
`),Q=j.length-1,le=W.length-1;1<=Q&&0<=le&&j[Q]!==W[le];)le--;for(;1<=Q&&0<=le;Q--,le--)if(j[Q]!==W[le]){if(Q!==1||le!==1)do if(Q--,le--,0>le||j[Q]!==W[le]){var fe=`
|
|
37
|
-
`+j[Q].replace(" at new "," at ");return h.displayName&&fe.includes("<anonymous>")&&(fe=fe.replace("<anonymous>",h.displayName)),fe}while(1<=Q&&0<=le);break}}}finally{V=!1,Error.prepareStackTrace=C}return(h=h?h.displayName||h.name:"")?G(h):""}function ie(h){switch(h.tag){case 5:return G(h.type);case 16:return G("Lazy");case 13:return G("Suspense");case 19:return G("SuspenseList");case 0:case 2:case 15:return h=te(h.type,!1),h;case 11:return h=te(h.type.render,!1),h;case 1:return h=te(h.type,!0),h;default:return""}}function ne(h){if(h==null)return null;if(typeof h=="function")return h.displayName||h.name||null;if(typeof h=="string")return h;switch(h){case E:return"Fragment";case N:return"Portal";case L:return"Profiler";case k:return"StrictMode";case B:return"Suspense";case D:return"SuspenseList"}if(typeof h=="object")switch(h.$$typeof){case I:return(h.displayName||"Context")+".Consumer";case A:return(h._context.displayName||"Context")+".Provider";case O:var p=h.render;return h=h.displayName,h||(h=p.displayName||p.name||"",h=h!==""?"ForwardRef("+h+")":"ForwardRef"),h;case M:return p=h.displayName||null,p!==null?p:ne(h.type)||"Memo";case U:p=h._payload,h=h._init;try{return ne(h(p))}catch{}}return null}function X(h){var p=h.type;switch(h.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 h=p.render,h=h.displayName||h.name||"",p.displayName||(h!==""?"ForwardRef("+h+")":"ForwardRef");case 7:return"Fragment";case 5:return p;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ne(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(h){switch(typeof h){case"boolean":case"number":case"string":case"undefined":return h;case"object":return h;default:return""}}function Y(h){var p=h.type;return(h=h.nodeName)&&h.toLowerCase()==="input"&&(p==="checkbox"||p==="radio")}function K(h){var p=Y(h)?"checked":"value",C=Object.getOwnPropertyDescriptor(h.constructor.prototype,p),R=""+h[p];if(!h.hasOwnProperty(p)&&typeof C<"u"&&typeof C.get=="function"&&typeof C.set=="function"){var j=C.get,W=C.set;return Object.defineProperty(h,p,{configurable:!0,get:function(){return j.call(this)},set:function(Q){R=""+Q,W.call(this,Q)}}),Object.defineProperty(h,p,{enumerable:C.enumerable}),{getValue:function(){return R},setValue:function(Q){R=""+Q},stopTracking:function(){h._valueTracker=null,delete h[p]}}}}function ee(h){h._valueTracker||(h._valueTracker=K(h))}function re(h){if(!h)return!1;var p=h._valueTracker;if(!p)return!0;var C=p.getValue(),R="";return h&&(R=Y(h)?h.checked?"true":"false":h.value),h=R,h!==C?(p.setValue(h),!0):!1}function ue(h){if(h=h||(typeof document<"u"?document:void 0),typeof h>"u")return null;try{return h.activeElement||h.body}catch{return h.body}}function pe(h,p){var C=p.checked;return P({},p,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:C??h._wrapperState.initialChecked})}function Re(h,p){var C=p.defaultValue==null?"":p.defaultValue,R=p.checked!=null?p.checked:p.defaultChecked;C=q(p.value!=null?p.value:C),h._wrapperState={initialChecked:R,initialValue:C,controlled:p.type==="checkbox"||p.type==="radio"?p.checked!=null:p.value!=null}}function Be(h,p){p=p.checked,p!=null&&b(h,"checked",p,!1)}function _e(h,p){Be(h,p);var C=q(p.value),R=p.type;if(C!=null)R==="number"?(C===0&&h.value===""||h.value!=C)&&(h.value=""+C):h.value!==""+C&&(h.value=""+C);else if(R==="submit"||R==="reset"){h.removeAttribute("value");return}p.hasOwnProperty("value")?Le(h,p.type,C):p.hasOwnProperty("defaultValue")&&Le(h,p.type,q(p.defaultValue)),p.checked==null&&p.defaultChecked!=null&&(h.defaultChecked=!!p.defaultChecked)}function Te(h,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=""+h._wrapperState.initialValue,C||p===h.value||(h.value=p),h.defaultValue=p}C=h.name,C!==""&&(h.name=""),h.defaultChecked=!!h._wrapperState.initialChecked,C!==""&&(h.name=C)}function Le(h,p,C){(p!=="number"||ue(h.ownerDocument)!==h)&&(C==null?h.defaultValue=""+h._wrapperState.initialValue:h.defaultValue!==""+C&&(h.defaultValue=""+C))}var Ee=Array.isArray;function Pe(h,p,C,R){if(h=h.options,p){p={};for(var j=0;j<C.length;j++)p["$"+C[j]]=!0;for(C=0;C<h.length;C++)j=p.hasOwnProperty("$"+h[C].value),h[C].selected!==j&&(h[C].selected=j),j&&R&&(h[C].defaultSelected=!0)}else{for(C=""+q(C),p=null,j=0;j<h.length;j++){if(h[j].value===C){h[j].selected=!0,R&&(h[j].defaultSelected=!0);return}p!==null||h[j].disabled||(p=h[j])}p!==null&&(p.selected=!0)}}function ze(h,p){if(p.dangerouslySetInnerHTML!=null)throw Error(r(91));return P({},p,{value:void 0,defaultValue:void 0,children:""+h._wrapperState.initialValue})}function Me(h,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}h._wrapperState={initialValue:q(C)}}function Ue(h,p){var C=q(p.value),R=q(p.defaultValue);C!=null&&(C=""+C,C!==h.value&&(h.value=C),p.defaultValue==null&&h.defaultValue!==C&&(h.defaultValue=C)),R!=null&&(h.defaultValue=""+R)}function Ge(h){var p=h.textContent;p===h._wrapperState.initialValue&&p!==""&&p!==null&&(h.value=p)}function ve(h){switch(h){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(h,p){return h==null||h==="http://www.w3.org/1999/xhtml"?ve(p):h==="http://www.w3.org/2000/svg"&&p==="foreignObject"?"http://www.w3.org/1999/xhtml":h}var Ie,me=(function(h){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(p,C,R,j){MSApp.execUnsafeLocalFunction(function(){return h(p,C,R,j)})}:h})(function(h,p){if(h.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in h)h.innerHTML=p;else{for(Ie=Ie||document.createElement("div"),Ie.innerHTML="<svg>"+p.valueOf().toString()+"</svg>",p=Ie.firstChild;h.firstChild;)h.removeChild(h.firstChild);for(;p.firstChild;)h.appendChild(p.firstChild)}});function Z(h,p){if(p){var C=h.firstChild;if(C&&C===h.lastChild&&C.nodeType===3){C.nodeValue=p;return}}h.textContent=p}var he={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},ae=["Webkit","ms","Moz","O"];Object.keys(he).forEach(function(h){ae.forEach(function(p){p=p+h.charAt(0).toUpperCase()+h.substring(1),he[p]=he[h]})});function se(h,p,C){return p==null||typeof p=="boolean"||p===""?"":C||typeof p!="number"||p===0||he.hasOwnProperty(h)&&he[h]?(""+p).trim():p+"px"}function ce(h,p){h=h.style;for(var C in p)if(p.hasOwnProperty(C)){var R=C.indexOf("--")===0,j=se(C,p[C],R);C==="float"&&(C="cssFloat"),R?h.setProperty(C,j):h[C]=j}}var de=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 oe(h,p){if(p){if(de[h]&&(p.children!=null||p.dangerouslySetInnerHTML!=null))throw Error(r(137,h));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 ye(h,p){if(h.indexOf("-")===-1)return typeof p.is=="string";switch(h){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 Se=null;function ke(h){return h=h.target||h.srcElement||window,h.correspondingUseElement&&(h=h.correspondingUseElement),h.nodeType===3?h.parentNode:h}var De=null,Ne=null,Ae=null;function Qe(h){if(h=Co(h)){if(typeof De!="function")throw Error(r(280));var p=h.stateNode;p&&(p=nu(p),De(h.stateNode,h.type,p))}}function Xe(h){Ne?Ae?Ae.push(h):Ae=[h]:Ne=h}function mt(){if(Ne){var h=Ne,p=Ae;if(Ae=Ne=null,Qe(h),p)for(h=0;h<p.length;h++)Qe(p[h])}}function Je(h,p){return h(p)}function Ze(){}var ut=!1;function et(h,p,C){if(ut)return h(p,C);ut=!0;try{return Je(h,p,C)}finally{ut=!1,(Ne!==null||Ae!==null)&&(Ze(),mt())}}function Ye(h,p){var C=h.stateNode;if(C===null)return null;var R=nu(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)||(h=h.type,R=!(h==="button"||h==="input"||h==="select"||h==="textarea")),h=!R;break e;default:h=!1}if(h)return null;if(C&&typeof C!="function")throw Error(r(231,p,typeof C));return C}var Ct=!1;if(a)try{var ht={};Object.defineProperty(ht,"passive",{get:function(){Ct=!0}}),window.addEventListener("test",ht,ht),window.removeEventListener("test",ht,ht)}catch{Ct=!1}function lt(h,p,C,R,j,W,Q,le,fe){var we=Array.prototype.slice.call(arguments,3);try{p.apply(C,we)}catch(Fe){this.onError(Fe)}}var Bt=!1,Et=null,$t=!1,Mt=null,pr={onError:function(h){Bt=!0,Et=h}};function ar(h,p,C,R,j,W,Q,le,fe){Bt=!1,Et=null,lt.apply(pr,arguments)}function rr(h,p,C,R,j,W,Q,le,fe){if(ar.apply(this,arguments),Bt){if(Bt){var we=Et;Bt=!1,Et=null}else throw Error(r(198));$t||($t=!0,Mt=we)}}function jt(h){var p=h,C=h;if(h.alternate)for(;p.return;)p=p.return;else{h=p;do p=h,(p.flags&4098)!==0&&(C=p.return),h=p.return;while(h)}return p.tag===3?C:null}function Gr(h){if(h.tag===13){var p=h.memoizedState;if(p===null&&(h=h.alternate,h!==null&&(p=h.memoizedState)),p!==null)return p.dehydrated}return null}function ur(h){if(jt(h)!==h)throw Error(r(188))}function xn(h){var p=h.alternate;if(!p){if(p=jt(h),p===null)throw Error(r(188));return p!==h?null:h}for(var C=h,R=p;;){var j=C.return;if(j===null)break;var W=j.alternate;if(W===null){if(R=j.return,R!==null){C=R;continue}break}if(j.child===W.child){for(W=j.child;W;){if(W===C)return ur(j),h;if(W===R)return ur(j),p;W=W.sibling}throw Error(r(188))}if(C.return!==R.return)C=j,R=W;else{for(var Q=!1,le=j.child;le;){if(le===C){Q=!0,C=j,R=W;break}if(le===R){Q=!0,R=j,C=W;break}le=le.sibling}if(!Q){for(le=W.child;le;){if(le===C){Q=!0,C=W,R=j;break}if(le===R){Q=!0,R=W,C=j;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?h:p}function si(h){return h=xn(h),h!==null?Ln(h):null}function Ln(h){if(h.tag===5||h.tag===6)return h;for(h=h.child;h!==null;){var p=Ln(h);if(p!==null)return p;h=h.sibling}return null}var Dn=e.unstable_scheduleCallback,pa=e.unstable_cancelCallback,ga=e.unstable_shouldYield,Za=e.unstable_requestPaint,Wt=e.unstable_now,oi=e.unstable_getCurrentPriorityLevel,An=e.unstable_ImmediatePriority,$n=e.unstable_UserBlockingPriority,Wn=e.unstable_NormalPriority,Ci=e.unstable_LowPriority,va=e.unstable_IdlePriority,Tt=null,ct=null;function Nt(h){if(ct&&typeof ct.onCommitFiberRoot=="function")try{ct.onCommitFiberRoot(Tt,h,void 0,(h.current.flags&128)===128)}catch{}}var Yt=Math.clz32?Math.clz32:Yv,Kt=Math.log,bd=Math.LN2;function Yv(h){return h>>>=0,h===0?32:31-(Kt(h)/bd|0)|0}var Ja=64,zl=4194304;function ao(h){switch(h&-h){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 h&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return h&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return h}}function Hl(h,p){var C=h.pendingLanes;if(C===0)return 0;var R=0,j=h.suspendedLanes,W=h.pingedLanes,Q=C&268435455;if(Q!==0){var le=Q&~j;le!==0?R=ao(le):(W&=Q,W!==0&&(R=ao(W)))}else Q=C&~j,Q!==0?R=ao(Q):W!==0&&(R=ao(W));if(R===0)return 0;if(p!==0&&p!==R&&(p&j)===0&&(j=R&-R,W=p&-p,j>=W||j===16&&(W&4194240)!==0))return p;if((R&4)!==0&&(R|=C&16),p=h.entangledLanes,p!==0)for(h=h.entanglements,p&=R;0<p;)C=31-Yt(p),j=1<<C,R|=h[C],p&=~j;return R}function VS(h,p){switch(h){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 GS(h,p){for(var C=h.suspendedLanes,R=h.pingedLanes,j=h.expirationTimes,W=h.pendingLanes;0<W;){var Q=31-Yt(W),le=1<<Q,fe=j[Q];fe===-1?((le&C)===0||(le&R)!==0)&&(j[Q]=VS(le,p)):fe<=p&&(h.expiredLanes|=le),W&=~le}}function wd(h){return h=h.pendingLanes&-1073741825,h!==0?h:h&1073741824?1073741824:0}function Kv(){var h=Ja;return Ja<<=1,(Ja&4194240)===0&&(Ja=64),h}function _d(h){for(var p=[],C=0;31>C;C++)p.push(h);return p}function so(h,p,C){h.pendingLanes|=p,p!==536870912&&(h.suspendedLanes=0,h.pingedLanes=0),h=h.eventTimes,p=31-Yt(p),h[p]=C}function qS(h,p){var C=h.pendingLanes&~p;h.pendingLanes=p,h.suspendedLanes=0,h.pingedLanes=0,h.expiredLanes&=p,h.mutableReadLanes&=p,h.entangledLanes&=p,p=h.entanglements;var R=h.eventTimes;for(h=h.expirationTimes;0<C;){var j=31-Yt(C),W=1<<j;p[j]=0,R[j]=-1,h[j]=-1,C&=~W}}function Sd(h,p){var C=h.entangledLanes|=p;for(h=h.entanglements;C;){var R=31-Yt(C),j=1<<R;j&p|h[R]&p&&(h[R]|=p),C&=~j}}var Ht=0;function Xv(h){return h&=-h,1<h?4<h?(h&268435455)!==0?16:536870912:4:1}var Qv,Cd,Zv,Jv,em,kd=!1,Ul=[],ki=null,Ei=null,Ti=null,oo=new Map,lo=new Map,Ni=[],YS="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 tm(h,p){switch(h){case"focusin":case"focusout":ki=null;break;case"dragenter":case"dragleave":Ei=null;break;case"mouseover":case"mouseout":Ti=null;break;case"pointerover":case"pointerout":oo.delete(p.pointerId);break;case"gotpointercapture":case"lostpointercapture":lo.delete(p.pointerId)}}function uo(h,p,C,R,j,W){return h===null||h.nativeEvent!==W?(h={blockedOn:p,domEventName:C,eventSystemFlags:R,nativeEvent:W,targetContainers:[j]},p!==null&&(p=Co(p),p!==null&&Cd(p)),h):(h.eventSystemFlags|=R,p=h.targetContainers,j!==null&&p.indexOf(j)===-1&&p.push(j),h)}function KS(h,p,C,R,j){switch(p){case"focusin":return ki=uo(ki,h,p,C,R,j),!0;case"dragenter":return Ei=uo(Ei,h,p,C,R,j),!0;case"mouseover":return Ti=uo(Ti,h,p,C,R,j),!0;case"pointerover":var W=j.pointerId;return oo.set(W,uo(oo.get(W)||null,h,p,C,R,j)),!0;case"gotpointercapture":return W=j.pointerId,lo.set(W,uo(lo.get(W)||null,h,p,C,R,j)),!0}return!1}function rm(h){var p=ma(h.target);if(p!==null){var C=jt(p);if(C!==null){if(p=C.tag,p===13){if(p=Gr(C),p!==null){h.blockedOn=p,em(h.priority,function(){Zv(C)});return}}else if(p===3&&C.stateNode.current.memoizedState.isDehydrated){h.blockedOn=C.tag===3?C.stateNode.containerInfo:null;return}}}h.blockedOn=null}function $l(h){if(h.blockedOn!==null)return!1;for(var p=h.targetContainers;0<p.length;){var C=Td(h.domEventName,h.eventSystemFlags,p[0],h.nativeEvent);if(C===null){C=h.nativeEvent;var R=new C.constructor(C.type,C);Se=R,C.target.dispatchEvent(R),Se=null}else return p=Co(C),p!==null&&Cd(p),h.blockedOn=C,!1;p.shift()}return!0}function nm(h,p,C){$l(h)&&C.delete(p)}function XS(){kd=!1,ki!==null&&$l(ki)&&(ki=null),Ei!==null&&$l(Ei)&&(Ei=null),Ti!==null&&$l(Ti)&&(Ti=null),oo.forEach(nm),lo.forEach(nm)}function co(h,p){h.blockedOn===p&&(h.blockedOn=null,kd||(kd=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,XS)))}function ho(h){function p(j){return co(j,h)}if(0<Ul.length){co(Ul[0],h);for(var C=1;C<Ul.length;C++){var R=Ul[C];R.blockedOn===h&&(R.blockedOn=null)}}for(ki!==null&&co(ki,h),Ei!==null&&co(Ei,h),Ti!==null&&co(Ti,h),oo.forEach(p),lo.forEach(p),C=0;C<Ni.length;C++)R=Ni[C],R.blockedOn===h&&(R.blockedOn=null);for(;0<Ni.length&&(C=Ni[0],C.blockedOn===null);)rm(C),C.blockedOn===null&&Ni.shift()}var es=S.ReactCurrentBatchConfig,Wl=!0;function QS(h,p,C,R){var j=Ht,W=es.transition;es.transition=null;try{Ht=1,Ed(h,p,C,R)}finally{Ht=j,es.transition=W}}function ZS(h,p,C,R){var j=Ht,W=es.transition;es.transition=null;try{Ht=4,Ed(h,p,C,R)}finally{Ht=j,es.transition=W}}function Ed(h,p,C,R){if(Wl){var j=Td(h,p,C,R);if(j===null)Wd(h,p,R,Vl,C),tm(h,R);else if(KS(j,h,p,C,R))R.stopPropagation();else if(tm(h,R),p&4&&-1<YS.indexOf(h)){for(;j!==null;){var W=Co(j);if(W!==null&&Qv(W),W=Td(h,p,C,R),W===null&&Wd(h,p,R,Vl,C),W===j)break;j=W}j!==null&&R.stopPropagation()}else Wd(h,p,R,null,C)}}var Vl=null;function Td(h,p,C,R){if(Vl=null,h=ke(R),h=ma(h),h!==null)if(p=jt(h),p===null)h=null;else if(C=p.tag,C===13){if(h=Gr(p),h!==null)return h;h=null}else if(C===3){if(p.stateNode.current.memoizedState.isDehydrated)return p.tag===3?p.stateNode.containerInfo:null;h=null}else p!==h&&(h=null);return Vl=h,null}function im(h){switch(h){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(oi()){case An:return 1;case $n:return 4;case Wn:case Ci:return 16;case va:return 536870912;default:return 16}default:return 16}}var Ri=null,Nd=null,Gl=null;function am(){if(Gl)return Gl;var h,p=Nd,C=p.length,R,j="value"in Ri?Ri.value:Ri.textContent,W=j.length;for(h=0;h<C&&p[h]===j[h];h++);var Q=C-h;for(R=1;R<=Q&&p[C-R]===j[W-R];R++);return Gl=j.slice(h,1<R?1-R:void 0)}function ql(h){var p=h.keyCode;return"charCode"in h?(h=h.charCode,h===0&&p===13&&(h=13)):h=p,h===10&&(h=13),32<=h||h===13?h:0}function Yl(){return!0}function sm(){return!1}function dn(h){function p(C,R,j,W,Q){this._reactName=C,this._targetInst=j,this.type=R,this.nativeEvent=W,this.target=Q,this.currentTarget=null;for(var le in h)h.hasOwnProperty(le)&&(C=h[le],this[le]=C?C(W):W[le]);return this.isDefaultPrevented=(W.defaultPrevented!=null?W.defaultPrevented:W.returnValue===!1)?Yl:sm,this.isPropagationStopped=sm,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=Yl)},stopPropagation:function(){var C=this.nativeEvent;C&&(C.stopPropagation?C.stopPropagation():typeof C.cancelBubble!="unknown"&&(C.cancelBubble=!0),this.isPropagationStopped=Yl)},persist:function(){},isPersistent:Yl}),p}var ts={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(h){return h.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Rd=dn(ts),fo=P({},ts,{view:0,detail:0}),JS=dn(fo),Ld,Dd,po,Kl=P({},fo,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Pd,button:0,buttons:0,relatedTarget:function(h){return h.relatedTarget===void 0?h.fromElement===h.srcElement?h.toElement:h.fromElement:h.relatedTarget},movementX:function(h){return"movementX"in h?h.movementX:(h!==po&&(po&&h.type==="mousemove"?(Ld=h.screenX-po.screenX,Dd=h.screenY-po.screenY):Dd=Ld=0,po=h),Ld)},movementY:function(h){return"movementY"in h?h.movementY:Dd}}),om=dn(Kl),eC=P({},Kl,{dataTransfer:0}),tC=dn(eC),rC=P({},fo,{relatedTarget:0}),Ad=dn(rC),nC=P({},ts,{animationName:0,elapsedTime:0,pseudoElement:0}),iC=dn(nC),aC=P({},ts,{clipboardData:function(h){return"clipboardData"in h?h.clipboardData:window.clipboardData}}),sC=dn(aC),oC=P({},ts,{data:0}),lm=dn(oC),lC={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},uC={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"},cC={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function dC(h){var p=this.nativeEvent;return p.getModifierState?p.getModifierState(h):(h=cC[h])?!!p[h]:!1}function Pd(){return dC}var hC=P({},fo,{key:function(h){if(h.key){var p=lC[h.key]||h.key;if(p!=="Unidentified")return p}return h.type==="keypress"?(h=ql(h),h===13?"Enter":String.fromCharCode(h)):h.type==="keydown"||h.type==="keyup"?uC[h.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Pd,charCode:function(h){return h.type==="keypress"?ql(h):0},keyCode:function(h){return h.type==="keydown"||h.type==="keyup"?h.keyCode:0},which:function(h){return h.type==="keypress"?ql(h):h.type==="keydown"||h.type==="keyup"?h.keyCode:0}}),fC=dn(hC),pC=P({},Kl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),um=dn(pC),gC=P({},fo,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Pd}),vC=dn(gC),mC=P({},ts,{propertyName:0,elapsedTime:0,pseudoElement:0}),yC=dn(mC),xC=P({},Kl,{deltaX:function(h){return"deltaX"in h?h.deltaX:"wheelDeltaX"in h?-h.wheelDeltaX:0},deltaY:function(h){return"deltaY"in h?h.deltaY:"wheelDeltaY"in h?-h.wheelDeltaY:"wheelDelta"in h?-h.wheelDelta:0},deltaZ:0,deltaMode:0}),bC=dn(xC),wC=[9,13,27,32],Md=a&&"CompositionEvent"in window,go=null;a&&"documentMode"in document&&(go=document.documentMode);var _C=a&&"TextEvent"in window&&!go,cm=a&&(!Md||go&&8<go&&11>=go),dm=" ",hm=!1;function fm(h,p){switch(h){case"keyup":return wC.indexOf(p.keyCode)!==-1;case"keydown":return p.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function pm(h){return h=h.detail,typeof h=="object"&&"data"in h?h.data:null}var rs=!1;function SC(h,p){switch(h){case"compositionend":return pm(p);case"keypress":return p.which!==32?null:(hm=!0,dm);case"textInput":return h=p.data,h===dm&&hm?null:h;default:return null}}function CC(h,p){if(rs)return h==="compositionend"||!Md&&fm(h,p)?(h=am(),Gl=Nd=Ri=null,rs=!1,h):null;switch(h){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 cm&&p.locale!=="ko"?null:p.data;default:return null}}var kC={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 gm(h){var p=h&&h.nodeName&&h.nodeName.toLowerCase();return p==="input"?!!kC[h.type]:p==="textarea"}function vm(h,p,C,R){Xe(R),p=eu(p,"onChange"),0<p.length&&(C=new Rd("onChange","change",null,C,R),h.push({event:C,listeners:p}))}var vo=null,mo=null;function EC(h){Mm(h,0)}function Xl(h){var p=os(h);if(re(p))return h}function TC(h,p){if(h==="change")return p}var mm=!1;if(a){var Id;if(a){var Od="oninput"in document;if(!Od){var ym=document.createElement("div");ym.setAttribute("oninput","return;"),Od=typeof ym.oninput=="function"}Id=Od}else Id=!1;mm=Id&&(!document.documentMode||9<document.documentMode)}function xm(){vo&&(vo.detachEvent("onpropertychange",bm),mo=vo=null)}function bm(h){if(h.propertyName==="value"&&Xl(mo)){var p=[];vm(p,mo,h,ke(h)),et(EC,p)}}function NC(h,p,C){h==="focusin"?(xm(),vo=p,mo=C,vo.attachEvent("onpropertychange",bm)):h==="focusout"&&xm()}function RC(h){if(h==="selectionchange"||h==="keyup"||h==="keydown")return Xl(mo)}function LC(h,p){if(h==="click")return Xl(p)}function DC(h,p){if(h==="input"||h==="change")return Xl(p)}function AC(h,p){return h===p&&(h!==0||1/h===1/p)||h!==h&&p!==p}var Pn=typeof Object.is=="function"?Object.is:AC;function yo(h,p){if(Pn(h,p))return!0;if(typeof h!="object"||h===null||typeof p!="object"||p===null)return!1;var C=Object.keys(h),R=Object.keys(p);if(C.length!==R.length)return!1;for(R=0;R<C.length;R++){var j=C[R];if(!l.call(p,j)||!Pn(h[j],p[j]))return!1}return!0}function wm(h){for(;h&&h.firstChild;)h=h.firstChild;return h}function _m(h,p){var C=wm(h);h=0;for(var R;C;){if(C.nodeType===3){if(R=h+C.textContent.length,h<=p&&R>=p)return{node:C,offset:p-h};h=R}e:{for(;C;){if(C.nextSibling){C=C.nextSibling;break e}C=C.parentNode}C=void 0}C=wm(C)}}function Sm(h,p){return h&&p?h===p?!0:h&&h.nodeType===3?!1:p&&p.nodeType===3?Sm(h,p.parentNode):"contains"in h?h.contains(p):h.compareDocumentPosition?!!(h.compareDocumentPosition(p)&16):!1:!1}function Cm(){for(var h=window,p=ue();p instanceof h.HTMLIFrameElement;){try{var C=typeof p.contentWindow.location.href=="string"}catch{C=!1}if(C)h=p.contentWindow;else break;p=ue(h.document)}return p}function Bd(h){var p=h&&h.nodeName&&h.nodeName.toLowerCase();return p&&(p==="input"&&(h.type==="text"||h.type==="search"||h.type==="tel"||h.type==="url"||h.type==="password")||p==="textarea"||h.contentEditable==="true")}function PC(h){var p=Cm(),C=h.focusedElem,R=h.selectionRange;if(p!==C&&C&&C.ownerDocument&&Sm(C.ownerDocument.documentElement,C)){if(R!==null&&Bd(C)){if(p=R.start,h=R.end,h===void 0&&(h=p),"selectionStart"in C)C.selectionStart=p,C.selectionEnd=Math.min(h,C.value.length);else if(h=(p=C.ownerDocument||document)&&p.defaultView||window,h.getSelection){h=h.getSelection();var j=C.textContent.length,W=Math.min(R.start,j);R=R.end===void 0?W:Math.min(R.end,j),!h.extend&&W>R&&(j=R,R=W,W=j),j=_m(C,W);var Q=_m(C,R);j&&Q&&(h.rangeCount!==1||h.anchorNode!==j.node||h.anchorOffset!==j.offset||h.focusNode!==Q.node||h.focusOffset!==Q.offset)&&(p=p.createRange(),p.setStart(j.node,j.offset),h.removeAllRanges(),W>R?(h.addRange(p),h.extend(Q.node,Q.offset)):(p.setEnd(Q.node,Q.offset),h.addRange(p)))}}for(p=[],h=C;h=h.parentNode;)h.nodeType===1&&p.push({element:h,left:h.scrollLeft,top:h.scrollTop});for(typeof C.focus=="function"&&C.focus(),C=0;C<p.length;C++)h=p[C],h.element.scrollLeft=h.left,h.element.scrollTop=h.top}}var MC=a&&"documentMode"in document&&11>=document.documentMode,ns=null,jd=null,xo=null,Fd=!1;function km(h,p,C){var R=C.window===C?C.document:C.nodeType===9?C:C.ownerDocument;Fd||ns==null||ns!==ue(R)||(R=ns,"selectionStart"in R&&Bd(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}),xo&&yo(xo,R)||(xo=R,R=eu(jd,"onSelect"),0<R.length&&(p=new Rd("onSelect","select",null,p,C),h.push({event:p,listeners:R}),p.target=ns)))}function Ql(h,p){var C={};return C[h.toLowerCase()]=p.toLowerCase(),C["Webkit"+h]="webkit"+p,C["Moz"+h]="moz"+p,C}var is={animationend:Ql("Animation","AnimationEnd"),animationiteration:Ql("Animation","AnimationIteration"),animationstart:Ql("Animation","AnimationStart"),transitionend:Ql("Transition","TransitionEnd")},zd={},Em={};a&&(Em=document.createElement("div").style,"AnimationEvent"in window||(delete is.animationend.animation,delete is.animationiteration.animation,delete is.animationstart.animation),"TransitionEvent"in window||delete is.transitionend.transition);function Zl(h){if(zd[h])return zd[h];if(!is[h])return h;var p=is[h],C;for(C in p)if(p.hasOwnProperty(C)&&C in Em)return zd[h]=p[C];return h}var Tm=Zl("animationend"),Nm=Zl("animationiteration"),Rm=Zl("animationstart"),Lm=Zl("transitionend"),Dm=new Map,Am="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 Li(h,p){Dm.set(h,p),s(p,[h])}for(var Hd=0;Hd<Am.length;Hd++){var Ud=Am[Hd],IC=Ud.toLowerCase(),OC=Ud[0].toUpperCase()+Ud.slice(1);Li(IC,"on"+OC)}Li(Tm,"onAnimationEnd"),Li(Nm,"onAnimationIteration"),Li(Rm,"onAnimationStart"),Li("dblclick","onDoubleClick"),Li("focusin","onFocus"),Li("focusout","onBlur"),Li(Lm,"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 bo="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(" "),BC=new Set("cancel close invalid load scroll toggle".split(" ").concat(bo));function Pm(h,p,C){var R=h.type||"unknown-event";h.currentTarget=C,rr(R,p,void 0,h),h.currentTarget=null}function Mm(h,p){p=(p&4)!==0;for(var C=0;C<h.length;C++){var R=h[C],j=R.event;R=R.listeners;e:{var W=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!==W&&j.isPropagationStopped())break e;Pm(j,le,we),W=fe}else for(Q=0;Q<R.length;Q++){if(le=R[Q],fe=le.instance,we=le.currentTarget,le=le.listener,fe!==W&&j.isPropagationStopped())break e;Pm(j,le,we),W=fe}}}if($t)throw h=Mt,$t=!1,Mt=null,h}function Jt(h,p){var C=p[Xd];C===void 0&&(C=p[Xd]=new Set);var R=h+"__bubble";C.has(R)||(Im(p,h,2,!1),C.add(R))}function $d(h,p,C){var R=0;p&&(R|=4),Im(C,h,R,p)}var Jl="_reactListening"+Math.random().toString(36).slice(2);function wo(h){if(!h[Jl]){h[Jl]=!0,n.forEach(function(C){C!=="selectionchange"&&(BC.has(C)||$d(C,!1,h),$d(C,!0,h))});var p=h.nodeType===9?h:h.ownerDocument;p===null||p[Jl]||(p[Jl]=!0,$d("selectionchange",!1,p))}}function Im(h,p,C,R){switch(im(p)){case 1:var j=QS;break;case 4:j=ZS;break;default:j=Ed}C=j.bind(null,p,C,h),j=void 0,!Ct||p!=="touchstart"&&p!=="touchmove"&&p!=="wheel"||(j=!0),R?j!==void 0?h.addEventListener(p,C,{capture:!0,passive:j}):h.addEventListener(p,C,!0):j!==void 0?h.addEventListener(p,C,{passive:j}):h.addEventListener(p,C,!1)}function Wd(h,p,C,R,j){var W=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===j||le.nodeType===8&&le.parentNode===j)break;if(Q===4)for(Q=R.return;Q!==null;){var fe=Q.tag;if((fe===3||fe===4)&&(fe=Q.stateNode.containerInfo,fe===j||fe.nodeType===8&&fe.parentNode===j))return;Q=Q.return}for(;le!==null;){if(Q=ma(le),Q===null)return;if(fe=Q.tag,fe===5||fe===6){R=W=Q;continue e}le=le.parentNode}}R=R.return}et(function(){var we=W,Fe=ke(C),He=[];e:{var je=Dm.get(h);if(je!==void 0){var tt=Rd,it=h;switch(h){case"keypress":if(ql(C)===0)break e;case"keydown":case"keyup":tt=fC;break;case"focusin":it="focus",tt=Ad;break;case"focusout":it="blur",tt=Ad;break;case"beforeblur":case"afterblur":tt=Ad;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":tt=om;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":tt=tC;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":tt=vC;break;case Tm:case Nm:case Rm:tt=iC;break;case Lm:tt=yC;break;case"scroll":tt=JS;break;case"wheel":tt=bC;break;case"copy":case"cut":case"paste":tt=sC;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":tt=um}var st=(p&4)!==0,hr=!st&&h==="scroll",xe=st?je!==null?je+"Capture":null:je;st=[];for(var ge=we,be;ge!==null;){be=ge;var We=be.stateNode;if(be.tag===5&&We!==null&&(be=We,xe!==null&&(We=Ye(ge,xe),We!=null&&st.push(_o(ge,We,be)))),hr)break;ge=ge.return}0<st.length&&(je=new tt(je,it,null,C,Fe),He.push({event:je,listeners:st}))}}if((p&7)===0){e:{if(je=h==="mouseover"||h==="pointerover",tt=h==="mouseout"||h==="pointerout",je&&C!==Se&&(it=C.relatedTarget||C.fromElement)&&(ma(it)||it[li]))break e;if((tt||je)&&(je=Fe.window===Fe?Fe:(je=Fe.ownerDocument)?je.defaultView||je.parentWindow:window,tt?(it=C.relatedTarget||C.toElement,tt=we,it=it?ma(it):null,it!==null&&(hr=jt(it),it!==hr||it.tag!==5&&it.tag!==6)&&(it=null)):(tt=null,it=we),tt!==it)){if(st=om,We="onMouseLeave",xe="onMouseEnter",ge="mouse",(h==="pointerout"||h==="pointerover")&&(st=um,We="onPointerLeave",xe="onPointerEnter",ge="pointer"),hr=tt==null?je:os(tt),be=it==null?je:os(it),je=new st(We,ge+"leave",tt,C,Fe),je.target=hr,je.relatedTarget=be,We=null,ma(Fe)===we&&(st=new st(xe,ge+"enter",it,C,Fe),st.target=be,st.relatedTarget=hr,We=st),hr=We,tt&&it)t:{for(st=tt,xe=it,ge=0,be=st;be;be=as(be))ge++;for(be=0,We=xe;We;We=as(We))be++;for(;0<ge-be;)st=as(st),ge--;for(;0<be-ge;)xe=as(xe),be--;for(;ge--;){if(st===xe||xe!==null&&st===xe.alternate)break t;st=as(st),xe=as(xe)}st=null}else st=null;tt!==null&&Om(He,je,tt,st,!1),it!==null&&hr!==null&&Om(He,hr,it,st,!0)}}e:{if(je=we?os(we):window,tt=je.nodeName&&je.nodeName.toLowerCase(),tt==="select"||tt==="input"&&je.type==="file")var ot=TC;else if(gm(je))if(mm)ot=DC;else{ot=RC;var ft=NC}else(tt=je.nodeName)&&tt.toLowerCase()==="input"&&(je.type==="checkbox"||je.type==="radio")&&(ot=LC);if(ot&&(ot=ot(h,we))){vm(He,ot,C,Fe);break e}ft&&ft(h,je,we),h==="focusout"&&(ft=je._wrapperState)&&ft.controlled&&je.type==="number"&&Le(je,"number",je.value)}switch(ft=we?os(we):window,h){case"focusin":(gm(ft)||ft.contentEditable==="true")&&(ns=ft,jd=we,xo=null);break;case"focusout":xo=jd=ns=null;break;case"mousedown":Fd=!0;break;case"contextmenu":case"mouseup":case"dragend":Fd=!1,km(He,C,Fe);break;case"selectionchange":if(MC)break;case"keydown":case"keyup":km(He,C,Fe)}var pt;if(Md)e:{switch(h){case"compositionstart":var yt="onCompositionStart";break e;case"compositionend":yt="onCompositionEnd";break e;case"compositionupdate":yt="onCompositionUpdate";break e}yt=void 0}else rs?fm(h,C)&&(yt="onCompositionEnd"):h==="keydown"&&C.keyCode===229&&(yt="onCompositionStart");yt&&(cm&&C.locale!=="ko"&&(rs||yt!=="onCompositionStart"?yt==="onCompositionEnd"&&rs&&(pt=am()):(Ri=Fe,Nd="value"in Ri?Ri.value:Ri.textContent,rs=!0)),ft=eu(we,yt),0<ft.length&&(yt=new lm(yt,h,null,C,Fe),He.push({event:yt,listeners:ft}),pt?yt.data=pt:(pt=pm(C),pt!==null&&(yt.data=pt)))),(pt=_C?SC(h,C):CC(h,C))&&(we=eu(we,"onBeforeInput"),0<we.length&&(Fe=new lm("onBeforeInput","beforeinput",null,C,Fe),He.push({event:Fe,listeners:we}),Fe.data=pt))}Mm(He,p)})}function _o(h,p,C){return{instance:h,listener:p,currentTarget:C}}function eu(h,p){for(var C=p+"Capture",R=[];h!==null;){var j=h,W=j.stateNode;j.tag===5&&W!==null&&(j=W,W=Ye(h,C),W!=null&&R.unshift(_o(h,W,j)),W=Ye(h,p),W!=null&&R.push(_o(h,W,j))),h=h.return}return R}function as(h){if(h===null)return null;do h=h.return;while(h&&h.tag!==5);return h||null}function Om(h,p,C,R,j){for(var W=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,j?(fe=Ye(C,W),fe!=null&&Q.unshift(_o(C,fe,le))):j||(fe=Ye(C,W),fe!=null&&Q.push(_o(C,fe,le)))),C=C.return}Q.length!==0&&h.push({event:p,listeners:Q})}var jC=/\r\n?/g,FC=/\u0000|\uFFFD/g;function Bm(h){return(typeof h=="string"?h:""+h).replace(jC,`
|
|
38
|
-
`).replace(FC,"")}function tu(h,p,C){if(p=Bm(p),Bm(h)!==p&&C)throw Error(r(425))}function ru(){}var Vd=null,Gd=null;function qd(h,p){return h==="textarea"||h==="noscript"||typeof p.children=="string"||typeof p.children=="number"||typeof p.dangerouslySetInnerHTML=="object"&&p.dangerouslySetInnerHTML!==null&&p.dangerouslySetInnerHTML.__html!=null}var Yd=typeof setTimeout=="function"?setTimeout:void 0,zC=typeof clearTimeout=="function"?clearTimeout:void 0,jm=typeof Promise=="function"?Promise:void 0,HC=typeof queueMicrotask=="function"?queueMicrotask:typeof jm<"u"?function(h){return jm.resolve(null).then(h).catch(UC)}:Yd;function UC(h){setTimeout(function(){throw h})}function Kd(h,p){var C=p,R=0;do{var j=C.nextSibling;if(h.removeChild(C),j&&j.nodeType===8)if(C=j.data,C==="/$"){if(R===0){h.removeChild(j),ho(p);return}R--}else C!=="$"&&C!=="$?"&&C!=="$!"||R++;C=j}while(C);ho(p)}function Di(h){for(;h!=null;h=h.nextSibling){var p=h.nodeType;if(p===1||p===3)break;if(p===8){if(p=h.data,p==="$"||p==="$!"||p==="$?")break;if(p==="/$")return null}}return h}function Fm(h){h=h.previousSibling;for(var p=0;h;){if(h.nodeType===8){var C=h.data;if(C==="$"||C==="$!"||C==="$?"){if(p===0)return h;p--}else C==="/$"&&p++}h=h.previousSibling}return null}var ss=Math.random().toString(36).slice(2),Vn="__reactFiber$"+ss,So="__reactProps$"+ss,li="__reactContainer$"+ss,Xd="__reactEvents$"+ss,$C="__reactListeners$"+ss,WC="__reactHandles$"+ss;function ma(h){var p=h[Vn];if(p)return p;for(var C=h.parentNode;C;){if(p=C[li]||C[Vn]){if(C=p.alternate,p.child!==null||C!==null&&C.child!==null)for(h=Fm(h);h!==null;){if(C=h[Vn])return C;h=Fm(h)}return p}h=C,C=h.parentNode}return null}function Co(h){return h=h[Vn]||h[li],!h||h.tag!==5&&h.tag!==6&&h.tag!==13&&h.tag!==3?null:h}function os(h){if(h.tag===5||h.tag===6)return h.stateNode;throw Error(r(33))}function nu(h){return h[So]||null}var Qd=[],ls=-1;function Ai(h){return{current:h}}function er(h){0>ls||(h.current=Qd[ls],Qd[ls]=null,ls--)}function Xt(h,p){ls++,Qd[ls]=h.current,h.current=p}var Pi={},Br=Ai(Pi),en=Ai(!1),ya=Pi;function us(h,p){var C=h.type.contextTypes;if(!C)return Pi;var R=h.stateNode;if(R&&R.__reactInternalMemoizedUnmaskedChildContext===p)return R.__reactInternalMemoizedMaskedChildContext;var j={},W;for(W in C)j[W]=p[W];return R&&(h=h.stateNode,h.__reactInternalMemoizedUnmaskedChildContext=p,h.__reactInternalMemoizedMaskedChildContext=j),j}function tn(h){return h=h.childContextTypes,h!=null}function iu(){er(en),er(Br)}function zm(h,p,C){if(Br.current!==Pi)throw Error(r(168));Xt(Br,p),Xt(en,C)}function Hm(h,p,C){var R=h.stateNode;if(p=p.childContextTypes,typeof R.getChildContext!="function")return C;R=R.getChildContext();for(var j in R)if(!(j in p))throw Error(r(108,X(h)||"Unknown",j));return P({},C,R)}function au(h){return h=(h=h.stateNode)&&h.__reactInternalMemoizedMergedChildContext||Pi,ya=Br.current,Xt(Br,h),Xt(en,en.current),!0}function Um(h,p,C){var R=h.stateNode;if(!R)throw Error(r(169));C?(h=Hm(h,p,ya),R.__reactInternalMemoizedMergedChildContext=h,er(en),er(Br),Xt(Br,h)):er(en),Xt(en,C)}var ui=null,su=!1,Zd=!1;function $m(h){ui===null?ui=[h]:ui.push(h)}function VC(h){su=!0,$m(h)}function Mi(){if(!Zd&&ui!==null){Zd=!0;var h=0,p=Ht;try{var C=ui;for(Ht=1;h<C.length;h++){var R=C[h];do R=R(!0);while(R!==null)}ui=null,su=!1}catch(j){throw ui!==null&&(ui=ui.slice(h+1)),Dn(An,Mi),j}finally{Ht=p,Zd=!1}}return null}var cs=[],ds=0,ou=null,lu=0,bn=[],wn=0,xa=null,ci=1,di="";function ba(h,p){cs[ds++]=lu,cs[ds++]=ou,ou=h,lu=p}function Wm(h,p,C){bn[wn++]=ci,bn[wn++]=di,bn[wn++]=xa,xa=h;var R=ci;h=di;var j=32-Yt(R)-1;R&=~(1<<j),C+=1;var W=32-Yt(p)+j;if(30<W){var Q=j-j%5;W=(R&(1<<Q)-1).toString(32),R>>=Q,j-=Q,ci=1<<32-Yt(p)+j|C<<j|R,di=W+h}else ci=1<<W|C<<j|R,di=h}function Jd(h){h.return!==null&&(ba(h,1),Wm(h,1,0))}function eh(h){for(;h===ou;)ou=cs[--ds],cs[ds]=null,lu=cs[--ds],cs[ds]=null;for(;h===xa;)xa=bn[--wn],bn[wn]=null,di=bn[--wn],bn[wn]=null,ci=bn[--wn],bn[wn]=null}var hn=null,fn=null,nr=!1,Mn=null;function Vm(h,p){var C=kn(5,null,null,0);C.elementType="DELETED",C.stateNode=p,C.return=h,p=h.deletions,p===null?(h.deletions=[C],h.flags|=16):p.push(C)}function Gm(h,p){switch(h.tag){case 5:var C=h.type;return p=p.nodeType!==1||C.toLowerCase()!==p.nodeName.toLowerCase()?null:p,p!==null?(h.stateNode=p,hn=h,fn=Di(p.firstChild),!0):!1;case 6:return p=h.pendingProps===""||p.nodeType!==3?null:p,p!==null?(h.stateNode=p,hn=h,fn=null,!0):!1;case 13:return p=p.nodeType!==8?null:p,p!==null?(C=xa!==null?{id:ci,overflow:di}:null,h.memoizedState={dehydrated:p,treeContext:C,retryLane:1073741824},C=kn(18,null,null,0),C.stateNode=p,C.return=h,h.child=C,hn=h,fn=null,!0):!1;default:return!1}}function th(h){return(h.mode&1)!==0&&(h.flags&128)===0}function rh(h){if(nr){var p=fn;if(p){var C=p;if(!Gm(h,p)){if(th(h))throw Error(r(418));p=Di(C.nextSibling);var R=hn;p&&Gm(h,p)?Vm(R,C):(h.flags=h.flags&-4097|2,nr=!1,hn=h)}}else{if(th(h))throw Error(r(418));h.flags=h.flags&-4097|2,nr=!1,hn=h}}}function qm(h){for(h=h.return;h!==null&&h.tag!==5&&h.tag!==3&&h.tag!==13;)h=h.return;hn=h}function uu(h){if(h!==hn)return!1;if(!nr)return qm(h),nr=!0,!1;var p;if((p=h.tag!==3)&&!(p=h.tag!==5)&&(p=h.type,p=p!=="head"&&p!=="body"&&!qd(h.type,h.memoizedProps)),p&&(p=fn)){if(th(h))throw Ym(),Error(r(418));for(;p;)Vm(h,p),p=Di(p.nextSibling)}if(qm(h),h.tag===13){if(h=h.memoizedState,h=h!==null?h.dehydrated:null,!h)throw Error(r(317));e:{for(h=h.nextSibling,p=0;h;){if(h.nodeType===8){var C=h.data;if(C==="/$"){if(p===0){fn=Di(h.nextSibling);break e}p--}else C!=="$"&&C!=="$!"&&C!=="$?"||p++}h=h.nextSibling}fn=null}}else fn=hn?Di(h.stateNode.nextSibling):null;return!0}function Ym(){for(var h=fn;h;)h=Di(h.nextSibling)}function hs(){fn=hn=null,nr=!1}function nh(h){Mn===null?Mn=[h]:Mn.push(h)}var GC=S.ReactCurrentBatchConfig;function ko(h,p,C){if(h=C.ref,h!==null&&typeof h!="function"&&typeof h!="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,h));var j=R,W=""+h;return p!==null&&p.ref!==null&&typeof p.ref=="function"&&p.ref._stringRef===W?p.ref:(p=function(Q){var le=j.refs;Q===null?delete le[W]:le[W]=Q},p._stringRef=W,p)}if(typeof h!="string")throw Error(r(284));if(!C._owner)throw Error(r(290,h))}return h}function cu(h,p){throw h=Object.prototype.toString.call(p),Error(r(31,h==="[object Object]"?"object with keys {"+Object.keys(p).join(", ")+"}":h))}function Km(h){var p=h._init;return p(h._payload)}function Xm(h){function p(xe,ge){if(h){var be=xe.deletions;be===null?(xe.deletions=[ge],xe.flags|=16):be.push(ge)}}function C(xe,ge){if(!h)return null;for(;ge!==null;)p(xe,ge),ge=ge.sibling;return null}function R(xe,ge){for(xe=new Map;ge!==null;)ge.key!==null?xe.set(ge.key,ge):xe.set(ge.index,ge),ge=ge.sibling;return xe}function j(xe,ge){return xe=Ui(xe,ge),xe.index=0,xe.sibling=null,xe}function W(xe,ge,be){return xe.index=be,h?(be=xe.alternate,be!==null?(be=be.index,be<ge?(xe.flags|=2,ge):be):(xe.flags|=2,ge)):(xe.flags|=1048576,ge)}function Q(xe){return h&&xe.alternate===null&&(xe.flags|=2),xe}function le(xe,ge,be,We){return ge===null||ge.tag!==6?(ge=Yh(be,xe.mode,We),ge.return=xe,ge):(ge=j(ge,be),ge.return=xe,ge)}function fe(xe,ge,be,We){var ot=be.type;return ot===E?Fe(xe,ge,be.props.children,We,be.key):ge!==null&&(ge.elementType===ot||typeof ot=="object"&&ot!==null&&ot.$$typeof===U&&Km(ot)===ge.type)?(We=j(ge,be.props),We.ref=ko(xe,ge,be),We.return=xe,We):(We=Mu(be.type,be.key,be.props,null,xe.mode,We),We.ref=ko(xe,ge,be),We.return=xe,We)}function we(xe,ge,be,We){return ge===null||ge.tag!==4||ge.stateNode.containerInfo!==be.containerInfo||ge.stateNode.implementation!==be.implementation?(ge=Kh(be,xe.mode,We),ge.return=xe,ge):(ge=j(ge,be.children||[]),ge.return=xe,ge)}function Fe(xe,ge,be,We,ot){return ge===null||ge.tag!==7?(ge=Na(be,xe.mode,We,ot),ge.return=xe,ge):(ge=j(ge,be),ge.return=xe,ge)}function He(xe,ge,be){if(typeof ge=="string"&&ge!==""||typeof ge=="number")return ge=Yh(""+ge,xe.mode,be),ge.return=xe,ge;if(typeof ge=="object"&&ge!==null){switch(ge.$$typeof){case T:return be=Mu(ge.type,ge.key,ge.props,null,xe.mode,be),be.ref=ko(xe,null,ge),be.return=xe,be;case N:return ge=Kh(ge,xe.mode,be),ge.return=xe,ge;case U:var We=ge._init;return He(xe,We(ge._payload),be)}if(Ee(ge)||F(ge))return ge=Na(ge,xe.mode,be,null),ge.return=xe,ge;cu(xe,ge)}return null}function je(xe,ge,be,We){var ot=ge!==null?ge.key:null;if(typeof be=="string"&&be!==""||typeof be=="number")return ot!==null?null:le(xe,ge,""+be,We);if(typeof be=="object"&&be!==null){switch(be.$$typeof){case T:return be.key===ot?fe(xe,ge,be,We):null;case N:return be.key===ot?we(xe,ge,be,We):null;case U:return ot=be._init,je(xe,ge,ot(be._payload),We)}if(Ee(be)||F(be))return ot!==null?null:Fe(xe,ge,be,We,null);cu(xe,be)}return null}function tt(xe,ge,be,We,ot){if(typeof We=="string"&&We!==""||typeof We=="number")return xe=xe.get(be)||null,le(ge,xe,""+We,ot);if(typeof We=="object"&&We!==null){switch(We.$$typeof){case T:return xe=xe.get(We.key===null?be:We.key)||null,fe(ge,xe,We,ot);case N:return xe=xe.get(We.key===null?be:We.key)||null,we(ge,xe,We,ot);case U:var ft=We._init;return tt(xe,ge,be,ft(We._payload),ot)}if(Ee(We)||F(We))return xe=xe.get(be)||null,Fe(ge,xe,We,ot,null);cu(ge,We)}return null}function it(xe,ge,be,We){for(var ot=null,ft=null,pt=ge,yt=ge=0,Tr=null;pt!==null&&yt<be.length;yt++){pt.index>yt?(Tr=pt,pt=null):Tr=pt.sibling;var It=je(xe,pt,be[yt],We);if(It===null){pt===null&&(pt=Tr);break}h&&pt&&It.alternate===null&&p(xe,pt),ge=W(It,ge,yt),ft===null?ot=It:ft.sibling=It,ft=It,pt=Tr}if(yt===be.length)return C(xe,pt),nr&&ba(xe,yt),ot;if(pt===null){for(;yt<be.length;yt++)pt=He(xe,be[yt],We),pt!==null&&(ge=W(pt,ge,yt),ft===null?ot=pt:ft.sibling=pt,ft=pt);return nr&&ba(xe,yt),ot}for(pt=R(xe,pt);yt<be.length;yt++)Tr=tt(pt,xe,yt,be[yt],We),Tr!==null&&(h&&Tr.alternate!==null&&pt.delete(Tr.key===null?yt:Tr.key),ge=W(Tr,ge,yt),ft===null?ot=Tr:ft.sibling=Tr,ft=Tr);return h&&pt.forEach(function($i){return p(xe,$i)}),nr&&ba(xe,yt),ot}function st(xe,ge,be,We){var ot=F(be);if(typeof ot!="function")throw Error(r(150));if(be=ot.call(be),be==null)throw Error(r(151));for(var ft=ot=null,pt=ge,yt=ge=0,Tr=null,It=be.next();pt!==null&&!It.done;yt++,It=be.next()){pt.index>yt?(Tr=pt,pt=null):Tr=pt.sibling;var $i=je(xe,pt,It.value,We);if($i===null){pt===null&&(pt=Tr);break}h&&pt&&$i.alternate===null&&p(xe,pt),ge=W($i,ge,yt),ft===null?ot=$i:ft.sibling=$i,ft=$i,pt=Tr}if(It.done)return C(xe,pt),nr&&ba(xe,yt),ot;if(pt===null){for(;!It.done;yt++,It=be.next())It=He(xe,It.value,We),It!==null&&(ge=W(It,ge,yt),ft===null?ot=It:ft.sibling=It,ft=It);return nr&&ba(xe,yt),ot}for(pt=R(xe,pt);!It.done;yt++,It=be.next())It=tt(pt,xe,yt,It.value,We),It!==null&&(h&&It.alternate!==null&&pt.delete(It.key===null?yt:It.key),ge=W(It,ge,yt),ft===null?ot=It:ft.sibling=It,ft=It);return h&&pt.forEach(function(kk){return p(xe,kk)}),nr&&ba(xe,yt),ot}function hr(xe,ge,be,We){if(typeof be=="object"&&be!==null&&be.type===E&&be.key===null&&(be=be.props.children),typeof be=="object"&&be!==null){switch(be.$$typeof){case T:e:{for(var ot=be.key,ft=ge;ft!==null;){if(ft.key===ot){if(ot=be.type,ot===E){if(ft.tag===7){C(xe,ft.sibling),ge=j(ft,be.props.children),ge.return=xe,xe=ge;break e}}else if(ft.elementType===ot||typeof ot=="object"&&ot!==null&&ot.$$typeof===U&&Km(ot)===ft.type){C(xe,ft.sibling),ge=j(ft,be.props),ge.ref=ko(xe,ft,be),ge.return=xe,xe=ge;break e}C(xe,ft);break}else p(xe,ft);ft=ft.sibling}be.type===E?(ge=Na(be.props.children,xe.mode,We,be.key),ge.return=xe,xe=ge):(We=Mu(be.type,be.key,be.props,null,xe.mode,We),We.ref=ko(xe,ge,be),We.return=xe,xe=We)}return Q(xe);case N:e:{for(ft=be.key;ge!==null;){if(ge.key===ft)if(ge.tag===4&&ge.stateNode.containerInfo===be.containerInfo&&ge.stateNode.implementation===be.implementation){C(xe,ge.sibling),ge=j(ge,be.children||[]),ge.return=xe,xe=ge;break e}else{C(xe,ge);break}else p(xe,ge);ge=ge.sibling}ge=Kh(be,xe.mode,We),ge.return=xe,xe=ge}return Q(xe);case U:return ft=be._init,hr(xe,ge,ft(be._payload),We)}if(Ee(be))return it(xe,ge,be,We);if(F(be))return st(xe,ge,be,We);cu(xe,be)}return typeof be=="string"&&be!==""||typeof be=="number"?(be=""+be,ge!==null&&ge.tag===6?(C(xe,ge.sibling),ge=j(ge,be),ge.return=xe,xe=ge):(C(xe,ge),ge=Yh(be,xe.mode,We),ge.return=xe,xe=ge),Q(xe)):C(xe,ge)}return hr}var fs=Xm(!0),Qm=Xm(!1),du=Ai(null),hu=null,ps=null,ih=null;function ah(){ih=ps=hu=null}function sh(h){var p=du.current;er(du),h._currentValue=p}function oh(h,p,C){for(;h!==null;){var R=h.alternate;if((h.childLanes&p)!==p?(h.childLanes|=p,R!==null&&(R.childLanes|=p)):R!==null&&(R.childLanes&p)!==p&&(R.childLanes|=p),h===C)break;h=h.return}}function gs(h,p){hu=h,ih=ps=null,h=h.dependencies,h!==null&&h.firstContext!==null&&((h.lanes&p)!==0&&(rn=!0),h.firstContext=null)}function _n(h){var p=h._currentValue;if(ih!==h)if(h={context:h,memoizedValue:p,next:null},ps===null){if(hu===null)throw Error(r(308));ps=h,hu.dependencies={lanes:0,firstContext:h}}else ps=ps.next=h;return p}var wa=null;function lh(h){wa===null?wa=[h]:wa.push(h)}function Zm(h,p,C,R){var j=p.interleaved;return j===null?(C.next=C,lh(p)):(C.next=j.next,j.next=C),p.interleaved=C,hi(h,R)}function hi(h,p){h.lanes|=p;var C=h.alternate;for(C!==null&&(C.lanes|=p),C=h,h=h.return;h!==null;)h.childLanes|=p,C=h.alternate,C!==null&&(C.childLanes|=p),C=h,h=h.return;return C.tag===3?C.stateNode:null}var Ii=!1;function uh(h){h.updateQueue={baseState:h.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Jm(h,p){h=h.updateQueue,p.updateQueue===h&&(p.updateQueue={baseState:h.baseState,firstBaseUpdate:h.firstBaseUpdate,lastBaseUpdate:h.lastBaseUpdate,shared:h.shared,effects:h.effects})}function fi(h,p){return{eventTime:h,lane:p,tag:0,payload:null,callback:null,next:null}}function Oi(h,p,C){var R=h.updateQueue;if(R===null)return null;if(R=R.shared,(Dt&2)!==0){var j=R.pending;return j===null?p.next=p:(p.next=j.next,j.next=p),R.pending=p,hi(h,C)}return j=R.interleaved,j===null?(p.next=p,lh(R)):(p.next=j.next,j.next=p),R.interleaved=p,hi(h,C)}function fu(h,p,C){if(p=p.updateQueue,p!==null&&(p=p.shared,(C&4194240)!==0)){var R=p.lanes;R&=h.pendingLanes,C|=R,p.lanes=C,Sd(h,C)}}function ey(h,p){var C=h.updateQueue,R=h.alternate;if(R!==null&&(R=R.updateQueue,C===R)){var j=null,W=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};W===null?j=W=Q:W=W.next=Q,C=C.next}while(C!==null);W===null?j=W=p:W=W.next=p}else j=W=p;C={baseState:R.baseState,firstBaseUpdate:j,lastBaseUpdate:W,shared:R.shared,effects:R.effects},h.updateQueue=C;return}h=C.lastBaseUpdate,h===null?C.firstBaseUpdate=p:h.next=p,C.lastBaseUpdate=p}function pu(h,p,C,R){var j=h.updateQueue;Ii=!1;var W=j.firstBaseUpdate,Q=j.lastBaseUpdate,le=j.shared.pending;if(le!==null){j.shared.pending=null;var fe=le,we=fe.next;fe.next=null,Q===null?W=we:Q.next=we,Q=fe;var Fe=h.alternate;Fe!==null&&(Fe=Fe.updateQueue,le=Fe.lastBaseUpdate,le!==Q&&(le===null?Fe.firstBaseUpdate=we:le.next=we,Fe.lastBaseUpdate=fe))}if(W!==null){var He=j.baseState;Q=0,Fe=we=fe=null,le=W;do{var je=le.lane,tt=le.eventTime;if((R&je)===je){Fe!==null&&(Fe=Fe.next={eventTime:tt,lane:0,tag:le.tag,payload:le.payload,callback:le.callback,next:null});e:{var it=h,st=le;switch(je=p,tt=C,st.tag){case 1:if(it=st.payload,typeof it=="function"){He=it.call(tt,He,je);break e}He=it;break e;case 3:it.flags=it.flags&-65537|128;case 0:if(it=st.payload,je=typeof it=="function"?it.call(tt,He,je):it,je==null)break e;He=P({},He,je);break e;case 2:Ii=!0}}le.callback!==null&&le.lane!==0&&(h.flags|=64,je=j.effects,je===null?j.effects=[le]:je.push(le))}else tt={eventTime:tt,lane:je,tag:le.tag,payload:le.payload,callback:le.callback,next:null},Fe===null?(we=Fe=tt,fe=He):Fe=Fe.next=tt,Q|=je;if(le=le.next,le===null){if(le=j.shared.pending,le===null)break;je=le,le=je.next,je.next=null,j.lastBaseUpdate=je,j.shared.pending=null}}while(!0);if(Fe===null&&(fe=He),j.baseState=fe,j.firstBaseUpdate=we,j.lastBaseUpdate=Fe,p=j.shared.interleaved,p!==null){j=p;do Q|=j.lane,j=j.next;while(j!==p)}else W===null&&(j.shared.lanes=0);Ca|=Q,h.lanes=Q,h.memoizedState=He}}function ty(h,p,C){if(h=p.effects,p.effects=null,h!==null)for(p=0;p<h.length;p++){var R=h[p],j=R.callback;if(j!==null){if(R.callback=null,R=C,typeof j!="function")throw Error(r(191,j));j.call(R)}}}var Eo={},Gn=Ai(Eo),To=Ai(Eo),No=Ai(Eo);function _a(h){if(h===Eo)throw Error(r(174));return h}function ch(h,p){switch(Xt(No,p),Xt(To,h),Xt(Gn,Eo),h=p.nodeType,h){case 9:case 11:p=(p=p.documentElement)?p.namespaceURI:Ce(null,"");break;default:h=h===8?p.parentNode:p,p=h.namespaceURI||null,h=h.tagName,p=Ce(p,h)}er(Gn),Xt(Gn,p)}function vs(){er(Gn),er(To),er(No)}function ry(h){_a(No.current);var p=_a(Gn.current),C=Ce(p,h.type);p!==C&&(Xt(To,h),Xt(Gn,C))}function dh(h){To.current===h&&(er(Gn),er(To))}var sr=Ai(0);function gu(h){for(var p=h;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===h)break;for(;p.sibling===null;){if(p.return===null||p.return===h)return null;p=p.return}p.sibling.return=p.return,p=p.sibling}return null}var hh=[];function fh(){for(var h=0;h<hh.length;h++)hh[h]._workInProgressVersionPrimary=null;hh.length=0}var vu=S.ReactCurrentDispatcher,ph=S.ReactCurrentBatchConfig,Sa=0,or=null,xr=null,kr=null,mu=!1,Ro=!1,Lo=0,qC=0;function jr(){throw Error(r(321))}function gh(h,p){if(p===null)return!1;for(var C=0;C<p.length&&C<h.length;C++)if(!Pn(h[C],p[C]))return!1;return!0}function vh(h,p,C,R,j,W){if(Sa=W,or=p,p.memoizedState=null,p.updateQueue=null,p.lanes=0,vu.current=h===null||h.memoizedState===null?QC:ZC,h=C(R,j),Ro){W=0;do{if(Ro=!1,Lo=0,25<=W)throw Error(r(301));W+=1,kr=xr=null,p.updateQueue=null,vu.current=JC,h=C(R,j)}while(Ro)}if(vu.current=bu,p=xr!==null&&xr.next!==null,Sa=0,kr=xr=or=null,mu=!1,p)throw Error(r(300));return h}function mh(){var h=Lo!==0;return Lo=0,h}function qn(){var h={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return kr===null?or.memoizedState=kr=h:kr=kr.next=h,kr}function Sn(){if(xr===null){var h=or.alternate;h=h!==null?h.memoizedState:null}else h=xr.next;var p=kr===null?or.memoizedState:kr.next;if(p!==null)kr=p,xr=h;else{if(h===null)throw Error(r(310));xr=h,h={memoizedState:xr.memoizedState,baseState:xr.baseState,baseQueue:xr.baseQueue,queue:xr.queue,next:null},kr===null?or.memoizedState=kr=h:kr=kr.next=h}return kr}function Do(h,p){return typeof p=="function"?p(h):p}function yh(h){var p=Sn(),C=p.queue;if(C===null)throw Error(r(311));C.lastRenderedReducer=h;var R=xr,j=R.baseQueue,W=C.pending;if(W!==null){if(j!==null){var Q=j.next;j.next=W.next,W.next=Q}R.baseQueue=j=W,C.pending=null}if(j!==null){W=j.next,R=R.baseState;var le=Q=null,fe=null,we=W;do{var Fe=we.lane;if((Sa&Fe)===Fe)fe!==null&&(fe=fe.next={lane:0,action:we.action,hasEagerState:we.hasEagerState,eagerState:we.eagerState,next:null}),R=we.hasEagerState?we.eagerState:h(R,we.action);else{var He={lane:Fe,action:we.action,hasEagerState:we.hasEagerState,eagerState:we.eagerState,next:null};fe===null?(le=fe=He,Q=R):fe=fe.next=He,or.lanes|=Fe,Ca|=Fe}we=we.next}while(we!==null&&we!==W);fe===null?Q=R:fe.next=le,Pn(R,p.memoizedState)||(rn=!0),p.memoizedState=R,p.baseState=Q,p.baseQueue=fe,C.lastRenderedState=R}if(h=C.interleaved,h!==null){j=h;do W=j.lane,or.lanes|=W,Ca|=W,j=j.next;while(j!==h)}else j===null&&(C.lanes=0);return[p.memoizedState,C.dispatch]}function xh(h){var p=Sn(),C=p.queue;if(C===null)throw Error(r(311));C.lastRenderedReducer=h;var R=C.dispatch,j=C.pending,W=p.memoizedState;if(j!==null){C.pending=null;var Q=j=j.next;do W=h(W,Q.action),Q=Q.next;while(Q!==j);Pn(W,p.memoizedState)||(rn=!0),p.memoizedState=W,p.baseQueue===null&&(p.baseState=W),C.lastRenderedState=W}return[W,R]}function ny(){}function iy(h,p){var C=or,R=Sn(),j=p(),W=!Pn(R.memoizedState,j);if(W&&(R.memoizedState=j,rn=!0),R=R.queue,bh(oy.bind(null,C,R,h),[h]),R.getSnapshot!==p||W||kr!==null&&kr.memoizedState.tag&1){if(C.flags|=2048,Ao(9,sy.bind(null,C,R,j,p),void 0,null),Er===null)throw Error(r(349));(Sa&30)!==0||ay(C,p,j)}return j}function ay(h,p,C){h.flags|=16384,h={getSnapshot:p,value:C},p=or.updateQueue,p===null?(p={lastEffect:null,stores:null},or.updateQueue=p,p.stores=[h]):(C=p.stores,C===null?p.stores=[h]:C.push(h))}function sy(h,p,C,R){p.value=C,p.getSnapshot=R,ly(p)&&uy(h)}function oy(h,p,C){return C(function(){ly(p)&&uy(h)})}function ly(h){var p=h.getSnapshot;h=h.value;try{var C=p();return!Pn(h,C)}catch{return!0}}function uy(h){var p=hi(h,1);p!==null&&jn(p,h,1,-1)}function cy(h){var p=qn();return typeof h=="function"&&(h=h()),p.memoizedState=p.baseState=h,h={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Do,lastRenderedState:h},p.queue=h,h=h.dispatch=XC.bind(null,or,h),[p.memoizedState,h]}function Ao(h,p,C,R){return h={tag:h,create:p,destroy:C,deps:R,next:null},p=or.updateQueue,p===null?(p={lastEffect:null,stores:null},or.updateQueue=p,p.lastEffect=h.next=h):(C=p.lastEffect,C===null?p.lastEffect=h.next=h:(R=C.next,C.next=h,h.next=R,p.lastEffect=h)),h}function dy(){return Sn().memoizedState}function yu(h,p,C,R){var j=qn();or.flags|=h,j.memoizedState=Ao(1|p,C,void 0,R===void 0?null:R)}function xu(h,p,C,R){var j=Sn();R=R===void 0?null:R;var W=void 0;if(xr!==null){var Q=xr.memoizedState;if(W=Q.destroy,R!==null&&gh(R,Q.deps)){j.memoizedState=Ao(p,C,W,R);return}}or.flags|=h,j.memoizedState=Ao(1|p,C,W,R)}function hy(h,p){return yu(8390656,8,h,p)}function bh(h,p){return xu(2048,8,h,p)}function fy(h,p){return xu(4,2,h,p)}function py(h,p){return xu(4,4,h,p)}function gy(h,p){if(typeof p=="function")return h=h(),p(h),function(){p(null)};if(p!=null)return h=h(),p.current=h,function(){p.current=null}}function vy(h,p,C){return C=C!=null?C.concat([h]):null,xu(4,4,gy.bind(null,p,h),C)}function wh(){}function my(h,p){var C=Sn();p=p===void 0?null:p;var R=C.memoizedState;return R!==null&&p!==null&&gh(p,R[1])?R[0]:(C.memoizedState=[h,p],h)}function yy(h,p){var C=Sn();p=p===void 0?null:p;var R=C.memoizedState;return R!==null&&p!==null&&gh(p,R[1])?R[0]:(h=h(),C.memoizedState=[h,p],h)}function xy(h,p,C){return(Sa&21)===0?(h.baseState&&(h.baseState=!1,rn=!0),h.memoizedState=C):(Pn(C,p)||(C=Kv(),or.lanes|=C,Ca|=C,h.baseState=!0),p)}function YC(h,p){var C=Ht;Ht=C!==0&&4>C?C:4,h(!0);var R=ph.transition;ph.transition={};try{h(!1),p()}finally{Ht=C,ph.transition=R}}function by(){return Sn().memoizedState}function KC(h,p,C){var R=zi(h);if(C={lane:R,action:C,hasEagerState:!1,eagerState:null,next:null},wy(h))_y(p,C);else if(C=Zm(h,p,C,R),C!==null){var j=Yr();jn(C,h,R,j),Sy(C,p,R)}}function XC(h,p,C){var R=zi(h),j={lane:R,action:C,hasEagerState:!1,eagerState:null,next:null};if(wy(h))_y(p,j);else{var W=h.alternate;if(h.lanes===0&&(W===null||W.lanes===0)&&(W=p.lastRenderedReducer,W!==null))try{var Q=p.lastRenderedState,le=W(Q,C);if(j.hasEagerState=!0,j.eagerState=le,Pn(le,Q)){var fe=p.interleaved;fe===null?(j.next=j,lh(p)):(j.next=fe.next,fe.next=j),p.interleaved=j;return}}catch{}finally{}C=Zm(h,p,j,R),C!==null&&(j=Yr(),jn(C,h,R,j),Sy(C,p,R))}}function wy(h){var p=h.alternate;return h===or||p!==null&&p===or}function _y(h,p){Ro=mu=!0;var C=h.pending;C===null?p.next=p:(p.next=C.next,C.next=p),h.pending=p}function Sy(h,p,C){if((C&4194240)!==0){var R=p.lanes;R&=h.pendingLanes,C|=R,p.lanes=C,Sd(h,C)}}var bu={readContext:_n,useCallback:jr,useContext:jr,useEffect:jr,useImperativeHandle:jr,useInsertionEffect:jr,useLayoutEffect:jr,useMemo:jr,useReducer:jr,useRef:jr,useState:jr,useDebugValue:jr,useDeferredValue:jr,useTransition:jr,useMutableSource:jr,useSyncExternalStore:jr,useId:jr,unstable_isNewReconciler:!1},QC={readContext:_n,useCallback:function(h,p){return qn().memoizedState=[h,p===void 0?null:p],h},useContext:_n,useEffect:hy,useImperativeHandle:function(h,p,C){return C=C!=null?C.concat([h]):null,yu(4194308,4,gy.bind(null,p,h),C)},useLayoutEffect:function(h,p){return yu(4194308,4,h,p)},useInsertionEffect:function(h,p){return yu(4,2,h,p)},useMemo:function(h,p){var C=qn();return p=p===void 0?null:p,h=h(),C.memoizedState=[h,p],h},useReducer:function(h,p,C){var R=qn();return p=C!==void 0?C(p):p,R.memoizedState=R.baseState=p,h={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:h,lastRenderedState:p},R.queue=h,h=h.dispatch=KC.bind(null,or,h),[R.memoizedState,h]},useRef:function(h){var p=qn();return h={current:h},p.memoizedState=h},useState:cy,useDebugValue:wh,useDeferredValue:function(h){return qn().memoizedState=h},useTransition:function(){var h=cy(!1),p=h[0];return h=YC.bind(null,h[1]),qn().memoizedState=h,[p,h]},useMutableSource:function(){},useSyncExternalStore:function(h,p,C){var R=or,j=qn();if(nr){if(C===void 0)throw Error(r(407));C=C()}else{if(C=p(),Er===null)throw Error(r(349));(Sa&30)!==0||ay(R,p,C)}j.memoizedState=C;var W={value:C,getSnapshot:p};return j.queue=W,hy(oy.bind(null,R,W,h),[h]),R.flags|=2048,Ao(9,sy.bind(null,R,W,C,p),void 0,null),C},useId:function(){var h=qn(),p=Er.identifierPrefix;if(nr){var C=di,R=ci;C=(R&~(1<<32-Yt(R)-1)).toString(32)+C,p=":"+p+"R"+C,C=Lo++,0<C&&(p+="H"+C.toString(32)),p+=":"}else C=qC++,p=":"+p+"r"+C.toString(32)+":";return h.memoizedState=p},unstable_isNewReconciler:!1},ZC={readContext:_n,useCallback:my,useContext:_n,useEffect:bh,useImperativeHandle:vy,useInsertionEffect:fy,useLayoutEffect:py,useMemo:yy,useReducer:yh,useRef:dy,useState:function(){return yh(Do)},useDebugValue:wh,useDeferredValue:function(h){var p=Sn();return xy(p,xr.memoizedState,h)},useTransition:function(){var h=yh(Do)[0],p=Sn().memoizedState;return[h,p]},useMutableSource:ny,useSyncExternalStore:iy,useId:by,unstable_isNewReconciler:!1},JC={readContext:_n,useCallback:my,useContext:_n,useEffect:bh,useImperativeHandle:vy,useInsertionEffect:fy,useLayoutEffect:py,useMemo:yy,useReducer:xh,useRef:dy,useState:function(){return xh(Do)},useDebugValue:wh,useDeferredValue:function(h){var p=Sn();return xr===null?p.memoizedState=h:xy(p,xr.memoizedState,h)},useTransition:function(){var h=xh(Do)[0],p=Sn().memoizedState;return[h,p]},useMutableSource:ny,useSyncExternalStore:iy,useId:by,unstable_isNewReconciler:!1};function In(h,p){if(h&&h.defaultProps){p=P({},p),h=h.defaultProps;for(var C in h)p[C]===void 0&&(p[C]=h[C]);return p}return p}function _h(h,p,C,R){p=h.memoizedState,C=C(R,p),C=C==null?p:P({},p,C),h.memoizedState=C,h.lanes===0&&(h.updateQueue.baseState=C)}var wu={isMounted:function(h){return(h=h._reactInternals)?jt(h)===h:!1},enqueueSetState:function(h,p,C){h=h._reactInternals;var R=Yr(),j=zi(h),W=fi(R,j);W.payload=p,C!=null&&(W.callback=C),p=Oi(h,W,j),p!==null&&(jn(p,h,j,R),fu(p,h,j))},enqueueReplaceState:function(h,p,C){h=h._reactInternals;var R=Yr(),j=zi(h),W=fi(R,j);W.tag=1,W.payload=p,C!=null&&(W.callback=C),p=Oi(h,W,j),p!==null&&(jn(p,h,j,R),fu(p,h,j))},enqueueForceUpdate:function(h,p){h=h._reactInternals;var C=Yr(),R=zi(h),j=fi(C,R);j.tag=2,p!=null&&(j.callback=p),p=Oi(h,j,R),p!==null&&(jn(p,h,R,C),fu(p,h,R))}};function Cy(h,p,C,R,j,W,Q){return h=h.stateNode,typeof h.shouldComponentUpdate=="function"?h.shouldComponentUpdate(R,W,Q):p.prototype&&p.prototype.isPureReactComponent?!yo(C,R)||!yo(j,W):!0}function ky(h,p,C){var R=!1,j=Pi,W=p.contextType;return typeof W=="object"&&W!==null?W=_n(W):(j=tn(p)?ya:Br.current,R=p.contextTypes,W=(R=R!=null)?us(h,j):Pi),p=new p(C,W),h.memoizedState=p.state!==null&&p.state!==void 0?p.state:null,p.updater=wu,h.stateNode=p,p._reactInternals=h,R&&(h=h.stateNode,h.__reactInternalMemoizedUnmaskedChildContext=j,h.__reactInternalMemoizedMaskedChildContext=W),p}function Ey(h,p,C,R){h=p.state,typeof p.componentWillReceiveProps=="function"&&p.componentWillReceiveProps(C,R),typeof p.UNSAFE_componentWillReceiveProps=="function"&&p.UNSAFE_componentWillReceiveProps(C,R),p.state!==h&&wu.enqueueReplaceState(p,p.state,null)}function Sh(h,p,C,R){var j=h.stateNode;j.props=C,j.state=h.memoizedState,j.refs={},uh(h);var W=p.contextType;typeof W=="object"&&W!==null?j.context=_n(W):(W=tn(p)?ya:Br.current,j.context=us(h,W)),j.state=h.memoizedState,W=p.getDerivedStateFromProps,typeof W=="function"&&(_h(h,p,W,C),j.state=h.memoizedState),typeof p.getDerivedStateFromProps=="function"||typeof j.getSnapshotBeforeUpdate=="function"||typeof j.UNSAFE_componentWillMount!="function"&&typeof j.componentWillMount!="function"||(p=j.state,typeof j.componentWillMount=="function"&&j.componentWillMount(),typeof j.UNSAFE_componentWillMount=="function"&&j.UNSAFE_componentWillMount(),p!==j.state&&wu.enqueueReplaceState(j,j.state,null),pu(h,C,j,R),j.state=h.memoizedState),typeof j.componentDidMount=="function"&&(h.flags|=4194308)}function ms(h,p){try{var C="",R=p;do C+=ie(R),R=R.return;while(R);var j=C}catch(W){j=`
|
|
39
|
-
Error generating stack: `+W.message+`
|
|
40
|
-
`+W.stack}return{value:h,source:p,stack:j,digest:null}}function Ch(h,p,C){return{value:h,source:null,stack:C??null,digest:p??null}}function kh(h,p){try{console.error(p.value)}catch(C){setTimeout(function(){throw C})}}var ek=typeof WeakMap=="function"?WeakMap:Map;function Ty(h,p,C){C=fi(-1,C),C.tag=3,C.payload={element:null};var R=p.value;return C.callback=function(){Nu||(Nu=!0,zh=R),kh(h,p)},C}function Ny(h,p,C){C=fi(-1,C),C.tag=3;var R=h.type.getDerivedStateFromError;if(typeof R=="function"){var j=p.value;C.payload=function(){return R(j)},C.callback=function(){kh(h,p)}}var W=h.stateNode;return W!==null&&typeof W.componentDidCatch=="function"&&(C.callback=function(){kh(h,p),typeof R!="function"&&(ji===null?ji=new Set([this]):ji.add(this));var Q=p.stack;this.componentDidCatch(p.value,{componentStack:Q!==null?Q:""})}),C}function Ry(h,p,C){var R=h.pingCache;if(R===null){R=h.pingCache=new ek;var j=new Set;R.set(p,j)}else j=R.get(p),j===void 0&&(j=new Set,R.set(p,j));j.has(C)||(j.add(C),h=pk.bind(null,h,p,C),p.then(h,h))}function Ly(h){do{var p;if((p=h.tag===13)&&(p=h.memoizedState,p=p!==null?p.dehydrated!==null:!0),p)return h;h=h.return}while(h!==null);return null}function Dy(h,p,C,R,j){return(h.mode&1)===0?(h===p?h.flags|=65536:(h.flags|=128,C.flags|=131072,C.flags&=-52805,C.tag===1&&(C.alternate===null?C.tag=17:(p=fi(-1,1),p.tag=2,Oi(C,p,1))),C.lanes|=1),h):(h.flags|=65536,h.lanes=j,h)}var tk=S.ReactCurrentOwner,rn=!1;function qr(h,p,C,R){p.child=h===null?Qm(p,null,C,R):fs(p,h.child,C,R)}function Ay(h,p,C,R,j){C=C.render;var W=p.ref;return gs(p,j),R=vh(h,p,C,R,W,j),C=mh(),h!==null&&!rn?(p.updateQueue=h.updateQueue,p.flags&=-2053,h.lanes&=~j,pi(h,p,j)):(nr&&C&&Jd(p),p.flags|=1,qr(h,p,R,j),p.child)}function Py(h,p,C,R,j){if(h===null){var W=C.type;return typeof W=="function"&&!qh(W)&&W.defaultProps===void 0&&C.compare===null&&C.defaultProps===void 0?(p.tag=15,p.type=W,My(h,p,W,R,j)):(h=Mu(C.type,null,R,p,p.mode,j),h.ref=p.ref,h.return=p,p.child=h)}if(W=h.child,(h.lanes&j)===0){var Q=W.memoizedProps;if(C=C.compare,C=C!==null?C:yo,C(Q,R)&&h.ref===p.ref)return pi(h,p,j)}return p.flags|=1,h=Ui(W,R),h.ref=p.ref,h.return=p,p.child=h}function My(h,p,C,R,j){if(h!==null){var W=h.memoizedProps;if(yo(W,R)&&h.ref===p.ref)if(rn=!1,p.pendingProps=R=W,(h.lanes&j)!==0)(h.flags&131072)!==0&&(rn=!0);else return p.lanes=h.lanes,pi(h,p,j)}return Eh(h,p,C,R,j)}function Iy(h,p,C){var R=p.pendingProps,j=R.children,W=h!==null?h.memoizedState:null;if(R.mode==="hidden")if((p.mode&1)===0)p.memoizedState={baseLanes:0,cachePool:null,transitions:null},Xt(xs,pn),pn|=C;else{if((C&1073741824)===0)return h=W!==null?W.baseLanes|C:C,p.lanes=p.childLanes=1073741824,p.memoizedState={baseLanes:h,cachePool:null,transitions:null},p.updateQueue=null,Xt(xs,pn),pn|=h,null;p.memoizedState={baseLanes:0,cachePool:null,transitions:null},R=W!==null?W.baseLanes:C,Xt(xs,pn),pn|=R}else W!==null?(R=W.baseLanes|C,p.memoizedState=null):R=C,Xt(xs,pn),pn|=R;return qr(h,p,j,C),p.child}function Oy(h,p){var C=p.ref;(h===null&&C!==null||h!==null&&h.ref!==C)&&(p.flags|=512,p.flags|=2097152)}function Eh(h,p,C,R,j){var W=tn(C)?ya:Br.current;return W=us(p,W),gs(p,j),C=vh(h,p,C,R,W,j),R=mh(),h!==null&&!rn?(p.updateQueue=h.updateQueue,p.flags&=-2053,h.lanes&=~j,pi(h,p,j)):(nr&&R&&Jd(p),p.flags|=1,qr(h,p,C,j),p.child)}function By(h,p,C,R,j){if(tn(C)){var W=!0;au(p)}else W=!1;if(gs(p,j),p.stateNode===null)Su(h,p),ky(p,C,R),Sh(p,C,R,j),R=!0;else if(h===null){var Q=p.stateNode,le=p.memoizedProps;Q.props=le;var fe=Q.context,we=C.contextType;typeof we=="object"&&we!==null?we=_n(we):(we=tn(C)?ya:Br.current,we=us(p,we));var Fe=C.getDerivedStateFromProps,He=typeof Fe=="function"||typeof Q.getSnapshotBeforeUpdate=="function";He||typeof Q.UNSAFE_componentWillReceiveProps!="function"&&typeof Q.componentWillReceiveProps!="function"||(le!==R||fe!==we)&&Ey(p,Q,R,we),Ii=!1;var je=p.memoizedState;Q.state=je,pu(p,R,Q,j),fe=p.memoizedState,le!==R||je!==fe||en.current||Ii?(typeof Fe=="function"&&(_h(p,C,Fe,R),fe=p.memoizedState),(le=Ii||Cy(p,C,le,R,je,fe,we))?(He||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,Jm(h,p),le=p.memoizedProps,we=p.type===p.elementType?le:In(p.type,le),Q.props=we,He=p.pendingProps,je=Q.context,fe=C.contextType,typeof fe=="object"&&fe!==null?fe=_n(fe):(fe=tn(C)?ya:Br.current,fe=us(p,fe));var tt=C.getDerivedStateFromProps;(Fe=typeof tt=="function"||typeof Q.getSnapshotBeforeUpdate=="function")||typeof Q.UNSAFE_componentWillReceiveProps!="function"&&typeof Q.componentWillReceiveProps!="function"||(le!==He||je!==fe)&&Ey(p,Q,R,fe),Ii=!1,je=p.memoizedState,Q.state=je,pu(p,R,Q,j);var it=p.memoizedState;le!==He||je!==it||en.current||Ii?(typeof tt=="function"&&(_h(p,C,tt,R),it=p.memoizedState),(we=Ii||Cy(p,C,we,R,je,it,fe)||!1)?(Fe||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===h.memoizedProps&&je===h.memoizedState||(p.flags|=4),typeof Q.getSnapshotBeforeUpdate!="function"||le===h.memoizedProps&&je===h.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===h.memoizedProps&&je===h.memoizedState||(p.flags|=4),typeof Q.getSnapshotBeforeUpdate!="function"||le===h.memoizedProps&&je===h.memoizedState||(p.flags|=1024),R=!1)}return Th(h,p,C,R,W,j)}function Th(h,p,C,R,j,W){Oy(h,p);var Q=(p.flags&128)!==0;if(!R&&!Q)return j&&Um(p,C,!1),pi(h,p,W);R=p.stateNode,tk.current=p;var le=Q&&typeof C.getDerivedStateFromError!="function"?null:R.render();return p.flags|=1,h!==null&&Q?(p.child=fs(p,h.child,null,W),p.child=fs(p,null,le,W)):qr(h,p,le,W),p.memoizedState=R.state,j&&Um(p,C,!0),p.child}function jy(h){var p=h.stateNode;p.pendingContext?zm(h,p.pendingContext,p.pendingContext!==p.context):p.context&&zm(h,p.context,!1),ch(h,p.containerInfo)}function Fy(h,p,C,R,j){return hs(),nh(j),p.flags|=256,qr(h,p,C,R),p.child}var Nh={dehydrated:null,treeContext:null,retryLane:0};function Rh(h){return{baseLanes:h,cachePool:null,transitions:null}}function zy(h,p,C){var R=p.pendingProps,j=sr.current,W=!1,Q=(p.flags&128)!==0,le;if((le=Q)||(le=h!==null&&h.memoizedState===null?!1:(j&2)!==0),le?(W=!0,p.flags&=-129):(h===null||h.memoizedState!==null)&&(j|=1),Xt(sr,j&1),h===null)return rh(p),h=p.memoizedState,h!==null&&(h=h.dehydrated,h!==null)?((p.mode&1)===0?p.lanes=1:h.data==="$!"?p.lanes=8:p.lanes=1073741824,null):(Q=R.children,h=R.fallback,W?(R=p.mode,W=p.child,Q={mode:"hidden",children:Q},(R&1)===0&&W!==null?(W.childLanes=0,W.pendingProps=Q):W=Iu(Q,R,0,null),h=Na(h,R,C,null),W.return=p,h.return=p,W.sibling=h,p.child=W,p.child.memoizedState=Rh(C),p.memoizedState=Nh,h):Lh(p,Q));if(j=h.memoizedState,j!==null&&(le=j.dehydrated,le!==null))return rk(h,p,Q,R,le,j,C);if(W){W=R.fallback,Q=p.mode,j=h.child,le=j.sibling;var fe={mode:"hidden",children:R.children};return(Q&1)===0&&p.child!==j?(R=p.child,R.childLanes=0,R.pendingProps=fe,p.deletions=null):(R=Ui(j,fe),R.subtreeFlags=j.subtreeFlags&14680064),le!==null?W=Ui(le,W):(W=Na(W,Q,C,null),W.flags|=2),W.return=p,R.return=p,R.sibling=W,p.child=R,R=W,W=p.child,Q=h.child.memoizedState,Q=Q===null?Rh(C):{baseLanes:Q.baseLanes|C,cachePool:null,transitions:Q.transitions},W.memoizedState=Q,W.childLanes=h.childLanes&~C,p.memoizedState=Nh,R}return W=h.child,h=W.sibling,R=Ui(W,{mode:"visible",children:R.children}),(p.mode&1)===0&&(R.lanes=C),R.return=p,R.sibling=null,h!==null&&(C=p.deletions,C===null?(p.deletions=[h],p.flags|=16):C.push(h)),p.child=R,p.memoizedState=null,R}function Lh(h,p){return p=Iu({mode:"visible",children:p},h.mode,0,null),p.return=h,h.child=p}function _u(h,p,C,R){return R!==null&&nh(R),fs(p,h.child,null,C),h=Lh(p,p.pendingProps.children),h.flags|=2,p.memoizedState=null,h}function rk(h,p,C,R,j,W,Q){if(C)return p.flags&256?(p.flags&=-257,R=Ch(Error(r(422))),_u(h,p,Q,R)):p.memoizedState!==null?(p.child=h.child,p.flags|=128,null):(W=R.fallback,j=p.mode,R=Iu({mode:"visible",children:R.children},j,0,null),W=Na(W,j,Q,null),W.flags|=2,R.return=p,W.return=p,R.sibling=W,p.child=R,(p.mode&1)!==0&&fs(p,h.child,null,Q),p.child.memoizedState=Rh(Q),p.memoizedState=Nh,W);if((p.mode&1)===0)return _u(h,p,Q,null);if(j.data==="$!"){if(R=j.nextSibling&&j.nextSibling.dataset,R)var le=R.dgst;return R=le,W=Error(r(419)),R=Ch(W,R,void 0),_u(h,p,Q,R)}if(le=(Q&h.childLanes)!==0,rn||le){if(R=Er,R!==null){switch(Q&-Q){case 4:j=2;break;case 16:j=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:j=32;break;case 536870912:j=268435456;break;default:j=0}j=(j&(R.suspendedLanes|Q))!==0?0:j,j!==0&&j!==W.retryLane&&(W.retryLane=j,hi(h,j),jn(R,h,j,-1))}return Gh(),R=Ch(Error(r(421))),_u(h,p,Q,R)}return j.data==="$?"?(p.flags|=128,p.child=h.child,p=gk.bind(null,h),j._reactRetry=p,null):(h=W.treeContext,fn=Di(j.nextSibling),hn=p,nr=!0,Mn=null,h!==null&&(bn[wn++]=ci,bn[wn++]=di,bn[wn++]=xa,ci=h.id,di=h.overflow,xa=p),p=Lh(p,R.children),p.flags|=4096,p)}function Hy(h,p,C){h.lanes|=p;var R=h.alternate;R!==null&&(R.lanes|=p),oh(h.return,p,C)}function Dh(h,p,C,R,j){var W=h.memoizedState;W===null?h.memoizedState={isBackwards:p,rendering:null,renderingStartTime:0,last:R,tail:C,tailMode:j}:(W.isBackwards=p,W.rendering=null,W.renderingStartTime=0,W.last=R,W.tail=C,W.tailMode=j)}function Uy(h,p,C){var R=p.pendingProps,j=R.revealOrder,W=R.tail;if(qr(h,p,R.children,C),R=sr.current,(R&2)!==0)R=R&1|2,p.flags|=128;else{if(h!==null&&(h.flags&128)!==0)e:for(h=p.child;h!==null;){if(h.tag===13)h.memoizedState!==null&&Hy(h,C,p);else if(h.tag===19)Hy(h,C,p);else if(h.child!==null){h.child.return=h,h=h.child;continue}if(h===p)break e;for(;h.sibling===null;){if(h.return===null||h.return===p)break e;h=h.return}h.sibling.return=h.return,h=h.sibling}R&=1}if(Xt(sr,R),(p.mode&1)===0)p.memoizedState=null;else switch(j){case"forwards":for(C=p.child,j=null;C!==null;)h=C.alternate,h!==null&&gu(h)===null&&(j=C),C=C.sibling;C=j,C===null?(j=p.child,p.child=null):(j=C.sibling,C.sibling=null),Dh(p,!1,j,C,W);break;case"backwards":for(C=null,j=p.child,p.child=null;j!==null;){if(h=j.alternate,h!==null&&gu(h)===null){p.child=j;break}h=j.sibling,j.sibling=C,C=j,j=h}Dh(p,!0,C,null,W);break;case"together":Dh(p,!1,null,null,void 0);break;default:p.memoizedState=null}return p.child}function Su(h,p){(p.mode&1)===0&&h!==null&&(h.alternate=null,p.alternate=null,p.flags|=2)}function pi(h,p,C){if(h!==null&&(p.dependencies=h.dependencies),Ca|=p.lanes,(C&p.childLanes)===0)return null;if(h!==null&&p.child!==h.child)throw Error(r(153));if(p.child!==null){for(h=p.child,C=Ui(h,h.pendingProps),p.child=C,C.return=p;h.sibling!==null;)h=h.sibling,C=C.sibling=Ui(h,h.pendingProps),C.return=p;C.sibling=null}return p.child}function nk(h,p,C){switch(p.tag){case 3:jy(p),hs();break;case 5:ry(p);break;case 1:tn(p.type)&&au(p);break;case 4:ch(p,p.stateNode.containerInfo);break;case 10:var R=p.type._context,j=p.memoizedProps.value;Xt(du,R._currentValue),R._currentValue=j;break;case 13:if(R=p.memoizedState,R!==null)return R.dehydrated!==null?(Xt(sr,sr.current&1),p.flags|=128,null):(C&p.child.childLanes)!==0?zy(h,p,C):(Xt(sr,sr.current&1),h=pi(h,p,C),h!==null?h.sibling:null);Xt(sr,sr.current&1);break;case 19:if(R=(C&p.childLanes)!==0,(h.flags&128)!==0){if(R)return Uy(h,p,C);p.flags|=128}if(j=p.memoizedState,j!==null&&(j.rendering=null,j.tail=null,j.lastEffect=null),Xt(sr,sr.current),R)break;return null;case 22:case 23:return p.lanes=0,Iy(h,p,C)}return pi(h,p,C)}var $y,Ah,Wy,Vy;$y=function(h,p){for(var C=p.child;C!==null;){if(C.tag===5||C.tag===6)h.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}},Ah=function(){},Wy=function(h,p,C,R){var j=h.memoizedProps;if(j!==R){h=p.stateNode,_a(Gn.current);var W=null;switch(C){case"input":j=pe(h,j),R=pe(h,R),W=[];break;case"select":j=P({},j,{value:void 0}),R=P({},R,{value:void 0}),W=[];break;case"textarea":j=ze(h,j),R=ze(h,R),W=[];break;default:typeof j.onClick!="function"&&typeof R.onClick=="function"&&(h.onclick=ru)}oe(C,R);var Q;C=null;for(we in j)if(!R.hasOwnProperty(we)&&j.hasOwnProperty(we)&&j[we]!=null)if(we==="style"){var le=j[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)?W||(W=[]):(W=W||[]).push(we,null));for(we in R){var fe=R[we];if(le=j!=null?j[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||(W||(W=[]),W.push(we,C)),C=fe;else we==="dangerouslySetInnerHTML"?(fe=fe?fe.__html:void 0,le=le?le.__html:void 0,fe!=null&&le!==fe&&(W=W||[]).push(we,fe)):we==="children"?typeof fe!="string"&&typeof fe!="number"||(W=W||[]).push(we,""+fe):we!=="suppressContentEditableWarning"&&we!=="suppressHydrationWarning"&&(i.hasOwnProperty(we)?(fe!=null&&we==="onScroll"&&Jt("scroll",h),W||le===fe||(W=[])):(W=W||[]).push(we,fe))}C&&(W=W||[]).push("style",C);var we=W;(p.updateQueue=we)&&(p.flags|=4)}},Vy=function(h,p,C,R){C!==R&&(p.flags|=4)};function Po(h,p){if(!nr)switch(h.tailMode){case"hidden":p=h.tail;for(var C=null;p!==null;)p.alternate!==null&&(C=p),p=p.sibling;C===null?h.tail=null:C.sibling=null;break;case"collapsed":C=h.tail;for(var R=null;C!==null;)C.alternate!==null&&(R=C),C=C.sibling;R===null?p||h.tail===null?h.tail=null:h.tail.sibling=null:R.sibling=null}}function Fr(h){var p=h.alternate!==null&&h.alternate.child===h.child,C=0,R=0;if(p)for(var j=h.child;j!==null;)C|=j.lanes|j.childLanes,R|=j.subtreeFlags&14680064,R|=j.flags&14680064,j.return=h,j=j.sibling;else for(j=h.child;j!==null;)C|=j.lanes|j.childLanes,R|=j.subtreeFlags,R|=j.flags,j.return=h,j=j.sibling;return h.subtreeFlags|=R,h.childLanes=C,p}function ik(h,p,C){var R=p.pendingProps;switch(eh(p),p.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Fr(p),null;case 1:return tn(p.type)&&iu(),Fr(p),null;case 3:return R=p.stateNode,vs(),er(en),er(Br),fh(),R.pendingContext&&(R.context=R.pendingContext,R.pendingContext=null),(h===null||h.child===null)&&(uu(p)?p.flags|=4:h===null||h.memoizedState.isDehydrated&&(p.flags&256)===0||(p.flags|=1024,Mn!==null&&($h(Mn),Mn=null))),Ah(h,p),Fr(p),null;case 5:dh(p);var j=_a(No.current);if(C=p.type,h!==null&&p.stateNode!=null)Wy(h,p,C,R,j),h.ref!==p.ref&&(p.flags|=512,p.flags|=2097152);else{if(!R){if(p.stateNode===null)throw Error(r(166));return Fr(p),null}if(h=_a(Gn.current),uu(p)){R=p.stateNode,C=p.type;var W=p.memoizedProps;switch(R[Vn]=p,R[So]=W,h=(p.mode&1)!==0,C){case"dialog":Jt("cancel",R),Jt("close",R);break;case"iframe":case"object":case"embed":Jt("load",R);break;case"video":case"audio":for(j=0;j<bo.length;j++)Jt(bo[j],R);break;case"source":Jt("error",R);break;case"img":case"image":case"link":Jt("error",R),Jt("load",R);break;case"details":Jt("toggle",R);break;case"input":Re(R,W),Jt("invalid",R);break;case"select":R._wrapperState={wasMultiple:!!W.multiple},Jt("invalid",R);break;case"textarea":Me(R,W),Jt("invalid",R)}oe(C,W),j=null;for(var Q in W)if(W.hasOwnProperty(Q)){var le=W[Q];Q==="children"?typeof le=="string"?R.textContent!==le&&(W.suppressHydrationWarning!==!0&&tu(R.textContent,le,h),j=["children",le]):typeof le=="number"&&R.textContent!==""+le&&(W.suppressHydrationWarning!==!0&&tu(R.textContent,le,h),j=["children",""+le]):i.hasOwnProperty(Q)&&le!=null&&Q==="onScroll"&&Jt("scroll",R)}switch(C){case"input":ee(R),Te(R,W,!0);break;case"textarea":ee(R),Ge(R);break;case"select":case"option":break;default:typeof W.onClick=="function"&&(R.onclick=ru)}R=j,p.updateQueue=R,R!==null&&(p.flags|=4)}else{Q=j.nodeType===9?j:j.ownerDocument,h==="http://www.w3.org/1999/xhtml"&&(h=ve(C)),h==="http://www.w3.org/1999/xhtml"?C==="script"?(h=Q.createElement("div"),h.innerHTML="<script><\/script>",h=h.removeChild(h.firstChild)):typeof R.is=="string"?h=Q.createElement(C,{is:R.is}):(h=Q.createElement(C),C==="select"&&(Q=h,R.multiple?Q.multiple=!0:R.size&&(Q.size=R.size))):h=Q.createElementNS(h,C),h[Vn]=p,h[So]=R,$y(h,p,!1,!1),p.stateNode=h;e:{switch(Q=ye(C,R),C){case"dialog":Jt("cancel",h),Jt("close",h),j=R;break;case"iframe":case"object":case"embed":Jt("load",h),j=R;break;case"video":case"audio":for(j=0;j<bo.length;j++)Jt(bo[j],h);j=R;break;case"source":Jt("error",h),j=R;break;case"img":case"image":case"link":Jt("error",h),Jt("load",h),j=R;break;case"details":Jt("toggle",h),j=R;break;case"input":Re(h,R),j=pe(h,R),Jt("invalid",h);break;case"option":j=R;break;case"select":h._wrapperState={wasMultiple:!!R.multiple},j=P({},R,{value:void 0}),Jt("invalid",h);break;case"textarea":Me(h,R),j=ze(h,R),Jt("invalid",h);break;default:j=R}oe(C,j),le=j;for(W in le)if(le.hasOwnProperty(W)){var fe=le[W];W==="style"?ce(h,fe):W==="dangerouslySetInnerHTML"?(fe=fe?fe.__html:void 0,fe!=null&&me(h,fe)):W==="children"?typeof fe=="string"?(C!=="textarea"||fe!=="")&&Z(h,fe):typeof fe=="number"&&Z(h,""+fe):W!=="suppressContentEditableWarning"&&W!=="suppressHydrationWarning"&&W!=="autoFocus"&&(i.hasOwnProperty(W)?fe!=null&&W==="onScroll"&&Jt("scroll",h):fe!=null&&b(h,W,fe,Q))}switch(C){case"input":ee(h),Te(h,R,!1);break;case"textarea":ee(h),Ge(h);break;case"option":R.value!=null&&h.setAttribute("value",""+q(R.value));break;case"select":h.multiple=!!R.multiple,W=R.value,W!=null?Pe(h,!!R.multiple,W,!1):R.defaultValue!=null&&Pe(h,!!R.multiple,R.defaultValue,!0);break;default:typeof j.onClick=="function"&&(h.onclick=ru)}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 Fr(p),null;case 6:if(h&&p.stateNode!=null)Vy(h,p,h.memoizedProps,R);else{if(typeof R!="string"&&p.stateNode===null)throw Error(r(166));if(C=_a(No.current),_a(Gn.current),uu(p)){if(R=p.stateNode,C=p.memoizedProps,R[Vn]=p,(W=R.nodeValue!==C)&&(h=hn,h!==null))switch(h.tag){case 3:tu(R.nodeValue,C,(h.mode&1)!==0);break;case 5:h.memoizedProps.suppressHydrationWarning!==!0&&tu(R.nodeValue,C,(h.mode&1)!==0)}W&&(p.flags|=4)}else R=(C.nodeType===9?C:C.ownerDocument).createTextNode(R),R[Vn]=p,p.stateNode=R}return Fr(p),null;case 13:if(er(sr),R=p.memoizedState,h===null||h.memoizedState!==null&&h.memoizedState.dehydrated!==null){if(nr&&fn!==null&&(p.mode&1)!==0&&(p.flags&128)===0)Ym(),hs(),p.flags|=98560,W=!1;else if(W=uu(p),R!==null&&R.dehydrated!==null){if(h===null){if(!W)throw Error(r(318));if(W=p.memoizedState,W=W!==null?W.dehydrated:null,!W)throw Error(r(317));W[Vn]=p}else hs(),(p.flags&128)===0&&(p.memoizedState=null),p.flags|=4;Fr(p),W=!1}else Mn!==null&&($h(Mn),Mn=null),W=!0;if(!W)return p.flags&65536?p:null}return(p.flags&128)!==0?(p.lanes=C,p):(R=R!==null,R!==(h!==null&&h.memoizedState!==null)&&R&&(p.child.flags|=8192,(p.mode&1)!==0&&(h===null||(sr.current&1)!==0?br===0&&(br=3):Gh())),p.updateQueue!==null&&(p.flags|=4),Fr(p),null);case 4:return vs(),Ah(h,p),h===null&&wo(p.stateNode.containerInfo),Fr(p),null;case 10:return sh(p.type._context),Fr(p),null;case 17:return tn(p.type)&&iu(),Fr(p),null;case 19:if(er(sr),W=p.memoizedState,W===null)return Fr(p),null;if(R=(p.flags&128)!==0,Q=W.rendering,Q===null)if(R)Po(W,!1);else{if(br!==0||h!==null&&(h.flags&128)!==0)for(h=p.child;h!==null;){if(Q=gu(h),Q!==null){for(p.flags|=128,Po(W,!1),R=Q.updateQueue,R!==null&&(p.updateQueue=R,p.flags|=4),p.subtreeFlags=0,R=C,C=p.child;C!==null;)W=C,h=R,W.flags&=14680066,Q=W.alternate,Q===null?(W.childLanes=0,W.lanes=h,W.child=null,W.subtreeFlags=0,W.memoizedProps=null,W.memoizedState=null,W.updateQueue=null,W.dependencies=null,W.stateNode=null):(W.childLanes=Q.childLanes,W.lanes=Q.lanes,W.child=Q.child,W.subtreeFlags=0,W.deletions=null,W.memoizedProps=Q.memoizedProps,W.memoizedState=Q.memoizedState,W.updateQueue=Q.updateQueue,W.type=Q.type,h=Q.dependencies,W.dependencies=h===null?null:{lanes:h.lanes,firstContext:h.firstContext}),C=C.sibling;return Xt(sr,sr.current&1|2),p.child}h=h.sibling}W.tail!==null&&Wt()>bs&&(p.flags|=128,R=!0,Po(W,!1),p.lanes=4194304)}else{if(!R)if(h=gu(Q),h!==null){if(p.flags|=128,R=!0,C=h.updateQueue,C!==null&&(p.updateQueue=C,p.flags|=4),Po(W,!0),W.tail===null&&W.tailMode==="hidden"&&!Q.alternate&&!nr)return Fr(p),null}else 2*Wt()-W.renderingStartTime>bs&&C!==1073741824&&(p.flags|=128,R=!0,Po(W,!1),p.lanes=4194304);W.isBackwards?(Q.sibling=p.child,p.child=Q):(C=W.last,C!==null?C.sibling=Q:p.child=Q,W.last=Q)}return W.tail!==null?(p=W.tail,W.rendering=p,W.tail=p.sibling,W.renderingStartTime=Wt(),p.sibling=null,C=sr.current,Xt(sr,R?C&1|2:C&1),p):(Fr(p),null);case 22:case 23:return Vh(),R=p.memoizedState!==null,h!==null&&h.memoizedState!==null!==R&&(p.flags|=8192),R&&(p.mode&1)!==0?(pn&1073741824)!==0&&(Fr(p),p.subtreeFlags&6&&(p.flags|=8192)):Fr(p),null;case 24:return null;case 25:return null}throw Error(r(156,p.tag))}function ak(h,p){switch(eh(p),p.tag){case 1:return tn(p.type)&&iu(),h=p.flags,h&65536?(p.flags=h&-65537|128,p):null;case 3:return vs(),er(en),er(Br),fh(),h=p.flags,(h&65536)!==0&&(h&128)===0?(p.flags=h&-65537|128,p):null;case 5:return dh(p),null;case 13:if(er(sr),h=p.memoizedState,h!==null&&h.dehydrated!==null){if(p.alternate===null)throw Error(r(340));hs()}return h=p.flags,h&65536?(p.flags=h&-65537|128,p):null;case 19:return er(sr),null;case 4:return vs(),null;case 10:return sh(p.type._context),null;case 22:case 23:return Vh(),null;case 24:return null;default:return null}}var Cu=!1,zr=!1,sk=typeof WeakSet=="function"?WeakSet:Set,rt=null;function ys(h,p){var C=h.ref;if(C!==null)if(typeof C=="function")try{C(null)}catch(R){cr(h,p,R)}else C.current=null}function Ph(h,p,C){try{C()}catch(R){cr(h,p,R)}}var Gy=!1;function ok(h,p){if(Vd=Wl,h=Cm(),Bd(h)){if("selectionStart"in h)var C={start:h.selectionStart,end:h.selectionEnd};else e:{C=(C=h.ownerDocument)&&C.defaultView||window;var R=C.getSelection&&C.getSelection();if(R&&R.rangeCount!==0){C=R.anchorNode;var j=R.anchorOffset,W=R.focusNode;R=R.focusOffset;try{C.nodeType,W.nodeType}catch{C=null;break e}var Q=0,le=-1,fe=-1,we=0,Fe=0,He=h,je=null;t:for(;;){for(var tt;He!==C||j!==0&&He.nodeType!==3||(le=Q+j),He!==W||R!==0&&He.nodeType!==3||(fe=Q+R),He.nodeType===3&&(Q+=He.nodeValue.length),(tt=He.firstChild)!==null;)je=He,He=tt;for(;;){if(He===h)break t;if(je===C&&++we===j&&(le=Q),je===W&&++Fe===R&&(fe=Q),(tt=He.nextSibling)!==null)break;He=je,je=He.parentNode}He=tt}C=le===-1||fe===-1?null:{start:le,end:fe}}else C=null}C=C||{start:0,end:0}}else C=null;for(Gd={focusedElem:h,selectionRange:C},Wl=!1,rt=p;rt!==null;)if(p=rt,h=p.child,(p.subtreeFlags&1028)!==0&&h!==null)h.return=p,rt=h;else for(;rt!==null;){p=rt;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 st=it.memoizedProps,hr=it.memoizedState,xe=p.stateNode,ge=xe.getSnapshotBeforeUpdate(p.elementType===p.type?st:In(p.type,st),hr);xe.__reactInternalSnapshotBeforeUpdate=ge}break;case 3:var be=p.stateNode.containerInfo;be.nodeType===1?be.textContent="":be.nodeType===9&&be.documentElement&&be.removeChild(be.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(We){cr(p,p.return,We)}if(h=p.sibling,h!==null){h.return=p.return,rt=h;break}rt=p.return}return it=Gy,Gy=!1,it}function Mo(h,p,C){var R=p.updateQueue;if(R=R!==null?R.lastEffect:null,R!==null){var j=R=R.next;do{if((j.tag&h)===h){var W=j.destroy;j.destroy=void 0,W!==void 0&&Ph(p,C,W)}j=j.next}while(j!==R)}}function ku(h,p){if(p=p.updateQueue,p=p!==null?p.lastEffect:null,p!==null){var C=p=p.next;do{if((C.tag&h)===h){var R=C.create;C.destroy=R()}C=C.next}while(C!==p)}}function Mh(h){var p=h.ref;if(p!==null){var C=h.stateNode;switch(h.tag){case 5:h=C;break;default:h=C}typeof p=="function"?p(h):p.current=h}}function qy(h){var p=h.alternate;p!==null&&(h.alternate=null,qy(p)),h.child=null,h.deletions=null,h.sibling=null,h.tag===5&&(p=h.stateNode,p!==null&&(delete p[Vn],delete p[So],delete p[Xd],delete p[$C],delete p[WC])),h.stateNode=null,h.return=null,h.dependencies=null,h.memoizedProps=null,h.memoizedState=null,h.pendingProps=null,h.stateNode=null,h.updateQueue=null}function Yy(h){return h.tag===5||h.tag===3||h.tag===4}function Ky(h){e:for(;;){for(;h.sibling===null;){if(h.return===null||Yy(h.return))return null;h=h.return}for(h.sibling.return=h.return,h=h.sibling;h.tag!==5&&h.tag!==6&&h.tag!==18;){if(h.flags&2||h.child===null||h.tag===4)continue e;h.child.return=h,h=h.child}if(!(h.flags&2))return h.stateNode}}function Ih(h,p,C){var R=h.tag;if(R===5||R===6)h=h.stateNode,p?C.nodeType===8?C.parentNode.insertBefore(h,p):C.insertBefore(h,p):(C.nodeType===8?(p=C.parentNode,p.insertBefore(h,C)):(p=C,p.appendChild(h)),C=C._reactRootContainer,C!=null||p.onclick!==null||(p.onclick=ru));else if(R!==4&&(h=h.child,h!==null))for(Ih(h,p,C),h=h.sibling;h!==null;)Ih(h,p,C),h=h.sibling}function Oh(h,p,C){var R=h.tag;if(R===5||R===6)h=h.stateNode,p?C.insertBefore(h,p):C.appendChild(h);else if(R!==4&&(h=h.child,h!==null))for(Oh(h,p,C),h=h.sibling;h!==null;)Oh(h,p,C),h=h.sibling}var Dr=null,On=!1;function Bi(h,p,C){for(C=C.child;C!==null;)Xy(h,p,C),C=C.sibling}function Xy(h,p,C){if(ct&&typeof ct.onCommitFiberUnmount=="function")try{ct.onCommitFiberUnmount(Tt,C)}catch{}switch(C.tag){case 5:zr||ys(C,p);case 6:var R=Dr,j=On;Dr=null,Bi(h,p,C),Dr=R,On=j,Dr!==null&&(On?(h=Dr,C=C.stateNode,h.nodeType===8?h.parentNode.removeChild(C):h.removeChild(C)):Dr.removeChild(C.stateNode));break;case 18:Dr!==null&&(On?(h=Dr,C=C.stateNode,h.nodeType===8?Kd(h.parentNode,C):h.nodeType===1&&Kd(h,C),ho(h)):Kd(Dr,C.stateNode));break;case 4:R=Dr,j=On,Dr=C.stateNode.containerInfo,On=!0,Bi(h,p,C),Dr=R,On=j;break;case 0:case 11:case 14:case 15:if(!zr&&(R=C.updateQueue,R!==null&&(R=R.lastEffect,R!==null))){j=R=R.next;do{var W=j,Q=W.destroy;W=W.tag,Q!==void 0&&((W&2)!==0||(W&4)!==0)&&Ph(C,p,Q),j=j.next}while(j!==R)}Bi(h,p,C);break;case 1:if(!zr&&(ys(C,p),R=C.stateNode,typeof R.componentWillUnmount=="function"))try{R.props=C.memoizedProps,R.state=C.memoizedState,R.componentWillUnmount()}catch(le){cr(C,p,le)}Bi(h,p,C);break;case 21:Bi(h,p,C);break;case 22:C.mode&1?(zr=(R=zr)||C.memoizedState!==null,Bi(h,p,C),zr=R):Bi(h,p,C);break;default:Bi(h,p,C)}}function Qy(h){var p=h.updateQueue;if(p!==null){h.updateQueue=null;var C=h.stateNode;C===null&&(C=h.stateNode=new sk),p.forEach(function(R){var j=vk.bind(null,h,R);C.has(R)||(C.add(R),R.then(j,j))})}}function Bn(h,p){var C=p.deletions;if(C!==null)for(var R=0;R<C.length;R++){var j=C[R];try{var W=h,Q=p,le=Q;e:for(;le!==null;){switch(le.tag){case 5:Dr=le.stateNode,On=!1;break e;case 3:Dr=le.stateNode.containerInfo,On=!0;break e;case 4:Dr=le.stateNode.containerInfo,On=!0;break e}le=le.return}if(Dr===null)throw Error(r(160));Xy(W,Q,j),Dr=null,On=!1;var fe=j.alternate;fe!==null&&(fe.return=null),j.return=null}catch(we){cr(j,p,we)}}if(p.subtreeFlags&12854)for(p=p.child;p!==null;)Zy(p,h),p=p.sibling}function Zy(h,p){var C=h.alternate,R=h.flags;switch(h.tag){case 0:case 11:case 14:case 15:if(Bn(p,h),Yn(h),R&4){try{Mo(3,h,h.return),ku(3,h)}catch(st){cr(h,h.return,st)}try{Mo(5,h,h.return)}catch(st){cr(h,h.return,st)}}break;case 1:Bn(p,h),Yn(h),R&512&&C!==null&&ys(C,C.return);break;case 5:if(Bn(p,h),Yn(h),R&512&&C!==null&&ys(C,C.return),h.flags&32){var j=h.stateNode;try{Z(j,"")}catch(st){cr(h,h.return,st)}}if(R&4&&(j=h.stateNode,j!=null)){var W=h.memoizedProps,Q=C!==null?C.memoizedProps:W,le=h.type,fe=h.updateQueue;if(h.updateQueue=null,fe!==null)try{le==="input"&&W.type==="radio"&&W.name!=null&&Be(j,W),ye(le,Q);var we=ye(le,W);for(Q=0;Q<fe.length;Q+=2){var Fe=fe[Q],He=fe[Q+1];Fe==="style"?ce(j,He):Fe==="dangerouslySetInnerHTML"?me(j,He):Fe==="children"?Z(j,He):b(j,Fe,He,we)}switch(le){case"input":_e(j,W);break;case"textarea":Ue(j,W);break;case"select":var je=j._wrapperState.wasMultiple;j._wrapperState.wasMultiple=!!W.multiple;var tt=W.value;tt!=null?Pe(j,!!W.multiple,tt,!1):je!==!!W.multiple&&(W.defaultValue!=null?Pe(j,!!W.multiple,W.defaultValue,!0):Pe(j,!!W.multiple,W.multiple?[]:"",!1))}j[So]=W}catch(st){cr(h,h.return,st)}}break;case 6:if(Bn(p,h),Yn(h),R&4){if(h.stateNode===null)throw Error(r(162));j=h.stateNode,W=h.memoizedProps;try{j.nodeValue=W}catch(st){cr(h,h.return,st)}}break;case 3:if(Bn(p,h),Yn(h),R&4&&C!==null&&C.memoizedState.isDehydrated)try{ho(p.containerInfo)}catch(st){cr(h,h.return,st)}break;case 4:Bn(p,h),Yn(h);break;case 13:Bn(p,h),Yn(h),j=h.child,j.flags&8192&&(W=j.memoizedState!==null,j.stateNode.isHidden=W,!W||j.alternate!==null&&j.alternate.memoizedState!==null||(Fh=Wt())),R&4&&Qy(h);break;case 22:if(Fe=C!==null&&C.memoizedState!==null,h.mode&1?(zr=(we=zr)||Fe,Bn(p,h),zr=we):Bn(p,h),Yn(h),R&8192){if(we=h.memoizedState!==null,(h.stateNode.isHidden=we)&&!Fe&&(h.mode&1)!==0)for(rt=h,Fe=h.child;Fe!==null;){for(He=rt=Fe;rt!==null;){switch(je=rt,tt=je.child,je.tag){case 0:case 11:case 14:case 15:Mo(4,je,je.return);break;case 1:ys(je,je.return);var it=je.stateNode;if(typeof it.componentWillUnmount=="function"){R=je,C=je.return;try{p=R,it.props=p.memoizedProps,it.state=p.memoizedState,it.componentWillUnmount()}catch(st){cr(R,C,st)}}break;case 5:ys(je,je.return);break;case 22:if(je.memoizedState!==null){t0(He);continue}}tt!==null?(tt.return=je,rt=tt):t0(He)}Fe=Fe.sibling}e:for(Fe=null,He=h;;){if(He.tag===5){if(Fe===null){Fe=He;try{j=He.stateNode,we?(W=j.style,typeof W.setProperty=="function"?W.setProperty("display","none","important"):W.display="none"):(le=He.stateNode,fe=He.memoizedProps.style,Q=fe!=null&&fe.hasOwnProperty("display")?fe.display:null,le.style.display=se("display",Q))}catch(st){cr(h,h.return,st)}}}else if(He.tag===6){if(Fe===null)try{He.stateNode.nodeValue=we?"":He.memoizedProps}catch(st){cr(h,h.return,st)}}else if((He.tag!==22&&He.tag!==23||He.memoizedState===null||He===h)&&He.child!==null){He.child.return=He,He=He.child;continue}if(He===h)break e;for(;He.sibling===null;){if(He.return===null||He.return===h)break e;Fe===He&&(Fe=null),He=He.return}Fe===He&&(Fe=null),He.sibling.return=He.return,He=He.sibling}}break;case 19:Bn(p,h),Yn(h),R&4&&Qy(h);break;case 21:break;default:Bn(p,h),Yn(h)}}function Yn(h){var p=h.flags;if(p&2){try{e:{for(var C=h.return;C!==null;){if(Yy(C)){var R=C;break e}C=C.return}throw Error(r(160))}switch(R.tag){case 5:var j=R.stateNode;R.flags&32&&(Z(j,""),R.flags&=-33);var W=Ky(h);Oh(h,W,j);break;case 3:case 4:var Q=R.stateNode.containerInfo,le=Ky(h);Ih(h,le,Q);break;default:throw Error(r(161))}}catch(fe){cr(h,h.return,fe)}h.flags&=-3}p&4096&&(h.flags&=-4097)}function lk(h,p,C){rt=h,Jy(h)}function Jy(h,p,C){for(var R=(h.mode&1)!==0;rt!==null;){var j=rt,W=j.child;if(j.tag===22&&R){var Q=j.memoizedState!==null||Cu;if(!Q){var le=j.alternate,fe=le!==null&&le.memoizedState!==null||zr;le=Cu;var we=zr;if(Cu=Q,(zr=fe)&&!we)for(rt=j;rt!==null;)Q=rt,fe=Q.child,Q.tag===22&&Q.memoizedState!==null?r0(j):fe!==null?(fe.return=Q,rt=fe):r0(j);for(;W!==null;)rt=W,Jy(W),W=W.sibling;rt=j,Cu=le,zr=we}e0(h)}else(j.subtreeFlags&8772)!==0&&W!==null?(W.return=j,rt=W):e0(h)}}function e0(h){for(;rt!==null;){var p=rt;if((p.flags&8772)!==0){var C=p.alternate;try{if((p.flags&8772)!==0)switch(p.tag){case 0:case 11:case 15:zr||ku(5,p);break;case 1:var R=p.stateNode;if(p.flags&4&&!zr)if(C===null)R.componentDidMount();else{var j=p.elementType===p.type?C.memoizedProps:In(p.type,C.memoizedProps);R.componentDidUpdate(j,C.memoizedState,R.__reactInternalSnapshotBeforeUpdate)}var W=p.updateQueue;W!==null&&ty(p,W,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}ty(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 Fe=we.memoizedState;if(Fe!==null){var He=Fe.dehydrated;He!==null&&ho(He)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(r(163))}zr||p.flags&512&&Mh(p)}catch(je){cr(p,p.return,je)}}if(p===h){rt=null;break}if(C=p.sibling,C!==null){C.return=p.return,rt=C;break}rt=p.return}}function t0(h){for(;rt!==null;){var p=rt;if(p===h){rt=null;break}var C=p.sibling;if(C!==null){C.return=p.return,rt=C;break}rt=p.return}}function r0(h){for(;rt!==null;){var p=rt;try{switch(p.tag){case 0:case 11:case 15:var C=p.return;try{ku(4,p)}catch(fe){cr(p,C,fe)}break;case 1:var R=p.stateNode;if(typeof R.componentDidMount=="function"){var j=p.return;try{R.componentDidMount()}catch(fe){cr(p,j,fe)}}var W=p.return;try{Mh(p)}catch(fe){cr(p,W,fe)}break;case 5:var Q=p.return;try{Mh(p)}catch(fe){cr(p,Q,fe)}}}catch(fe){cr(p,p.return,fe)}if(p===h){rt=null;break}var le=p.sibling;if(le!==null){le.return=p.return,rt=le;break}rt=p.return}}var uk=Math.ceil,Eu=S.ReactCurrentDispatcher,Bh=S.ReactCurrentOwner,Cn=S.ReactCurrentBatchConfig,Dt=0,Er=null,gr=null,Ar=0,pn=0,xs=Ai(0),br=0,Io=null,Ca=0,Tu=0,jh=0,Oo=null,nn=null,Fh=0,bs=1/0,gi=null,Nu=!1,zh=null,ji=null,Ru=!1,Fi=null,Lu=0,Bo=0,Hh=null,Du=-1,Au=0;function Yr(){return(Dt&6)!==0?Wt():Du!==-1?Du:Du=Wt()}function zi(h){return(h.mode&1)===0?1:(Dt&2)!==0&&Ar!==0?Ar&-Ar:GC.transition!==null?(Au===0&&(Au=Kv()),Au):(h=Ht,h!==0||(h=window.event,h=h===void 0?16:im(h.type)),h)}function jn(h,p,C,R){if(50<Bo)throw Bo=0,Hh=null,Error(r(185));so(h,C,R),((Dt&2)===0||h!==Er)&&(h===Er&&((Dt&2)===0&&(Tu|=C),br===4&&Hi(h,Ar)),an(h,R),C===1&&Dt===0&&(p.mode&1)===0&&(bs=Wt()+500,su&&Mi()))}function an(h,p){var C=h.callbackNode;GS(h,p);var R=Hl(h,h===Er?Ar:0);if(R===0)C!==null&&pa(C),h.callbackNode=null,h.callbackPriority=0;else if(p=R&-R,h.callbackPriority!==p){if(C!=null&&pa(C),p===1)h.tag===0?VC(i0.bind(null,h)):$m(i0.bind(null,h)),HC(function(){(Dt&6)===0&&Mi()}),C=null;else{switch(Xv(R)){case 1:C=An;break;case 4:C=$n;break;case 16:C=Wn;break;case 536870912:C=va;break;default:C=Wn}C=h0(C,n0.bind(null,h))}h.callbackPriority=p,h.callbackNode=C}}function n0(h,p){if(Du=-1,Au=0,(Dt&6)!==0)throw Error(r(327));var C=h.callbackNode;if(ws()&&h.callbackNode!==C)return null;var R=Hl(h,h===Er?Ar:0);if(R===0)return null;if((R&30)!==0||(R&h.expiredLanes)!==0||p)p=Pu(h,R);else{p=R;var j=Dt;Dt|=2;var W=s0();(Er!==h||Ar!==p)&&(gi=null,bs=Wt()+500,Ea(h,p));do try{hk();break}catch(le){a0(h,le)}while(!0);ah(),Eu.current=W,Dt=j,gr!==null?p=0:(Er=null,Ar=0,p=br)}if(p!==0){if(p===2&&(j=wd(h),j!==0&&(R=j,p=Uh(h,j))),p===1)throw C=Io,Ea(h,0),Hi(h,R),an(h,Wt()),C;if(p===6)Hi(h,R);else{if(j=h.current.alternate,(R&30)===0&&!ck(j)&&(p=Pu(h,R),p===2&&(W=wd(h),W!==0&&(R=W,p=Uh(h,W))),p===1))throw C=Io,Ea(h,0),Hi(h,R),an(h,Wt()),C;switch(h.finishedWork=j,h.finishedLanes=R,p){case 0:case 1:throw Error(r(345));case 2:Ta(h,nn,gi);break;case 3:if(Hi(h,R),(R&130023424)===R&&(p=Fh+500-Wt(),10<p)){if(Hl(h,0)!==0)break;if(j=h.suspendedLanes,(j&R)!==R){Yr(),h.pingedLanes|=h.suspendedLanes&j;break}h.timeoutHandle=Yd(Ta.bind(null,h,nn,gi),p);break}Ta(h,nn,gi);break;case 4:if(Hi(h,R),(R&4194240)===R)break;for(p=h.eventTimes,j=-1;0<R;){var Q=31-Yt(R);W=1<<Q,Q=p[Q],Q>j&&(j=Q),R&=~W}if(R=j,R=Wt()-R,R=(120>R?120:480>R?480:1080>R?1080:1920>R?1920:3e3>R?3e3:4320>R?4320:1960*uk(R/1960))-R,10<R){h.timeoutHandle=Yd(Ta.bind(null,h,nn,gi),R);break}Ta(h,nn,gi);break;case 5:Ta(h,nn,gi);break;default:throw Error(r(329))}}}return an(h,Wt()),h.callbackNode===C?n0.bind(null,h):null}function Uh(h,p){var C=Oo;return h.current.memoizedState.isDehydrated&&(Ea(h,p).flags|=256),h=Pu(h,p),h!==2&&(p=nn,nn=C,p!==null&&$h(p)),h}function $h(h){nn===null?nn=h:nn.push.apply(nn,h)}function ck(h){for(var p=h;;){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 j=C[R],W=j.getSnapshot;j=j.value;try{if(!Pn(W(),j))return!1}catch{return!1}}}if(C=p.child,p.subtreeFlags&16384&&C!==null)C.return=p,p=C;else{if(p===h)break;for(;p.sibling===null;){if(p.return===null||p.return===h)return!0;p=p.return}p.sibling.return=p.return,p=p.sibling}}return!0}function Hi(h,p){for(p&=~jh,p&=~Tu,h.suspendedLanes|=p,h.pingedLanes&=~p,h=h.expirationTimes;0<p;){var C=31-Yt(p),R=1<<C;h[C]=-1,p&=~R}}function i0(h){if((Dt&6)!==0)throw Error(r(327));ws();var p=Hl(h,0);if((p&1)===0)return an(h,Wt()),null;var C=Pu(h,p);if(h.tag!==0&&C===2){var R=wd(h);R!==0&&(p=R,C=Uh(h,R))}if(C===1)throw C=Io,Ea(h,0),Hi(h,p),an(h,Wt()),C;if(C===6)throw Error(r(345));return h.finishedWork=h.current.alternate,h.finishedLanes=p,Ta(h,nn,gi),an(h,Wt()),null}function Wh(h,p){var C=Dt;Dt|=1;try{return h(p)}finally{Dt=C,Dt===0&&(bs=Wt()+500,su&&Mi())}}function ka(h){Fi!==null&&Fi.tag===0&&(Dt&6)===0&&ws();var p=Dt;Dt|=1;var C=Cn.transition,R=Ht;try{if(Cn.transition=null,Ht=1,h)return h()}finally{Ht=R,Cn.transition=C,Dt=p,(Dt&6)===0&&Mi()}}function Vh(){pn=xs.current,er(xs)}function Ea(h,p){h.finishedWork=null,h.finishedLanes=0;var C=h.timeoutHandle;if(C!==-1&&(h.timeoutHandle=-1,zC(C)),gr!==null)for(C=gr.return;C!==null;){var R=C;switch(eh(R),R.tag){case 1:R=R.type.childContextTypes,R!=null&&iu();break;case 3:vs(),er(en),er(Br),fh();break;case 5:dh(R);break;case 4:vs();break;case 13:er(sr);break;case 19:er(sr);break;case 10:sh(R.type._context);break;case 22:case 23:Vh()}C=C.return}if(Er=h,gr=h=Ui(h.current,null),Ar=pn=p,br=0,Io=null,jh=Tu=Ca=0,nn=Oo=null,wa!==null){for(p=0;p<wa.length;p++)if(C=wa[p],R=C.interleaved,R!==null){C.interleaved=null;var j=R.next,W=C.pending;if(W!==null){var Q=W.next;W.next=j,R.next=Q}C.pending=R}wa=null}return h}function a0(h,p){do{var C=gr;try{if(ah(),vu.current=bu,mu){for(var R=or.memoizedState;R!==null;){var j=R.queue;j!==null&&(j.pending=null),R=R.next}mu=!1}if(Sa=0,kr=xr=or=null,Ro=!1,Lo=0,Bh.current=null,C===null||C.return===null){br=1,Io=p,gr=null;break}e:{var W=h,Q=C.return,le=C,fe=p;if(p=Ar,le.flags|=32768,fe!==null&&typeof fe=="object"&&typeof fe.then=="function"){var we=fe,Fe=le,He=Fe.tag;if((Fe.mode&1)===0&&(He===0||He===11||He===15)){var je=Fe.alternate;je?(Fe.updateQueue=je.updateQueue,Fe.memoizedState=je.memoizedState,Fe.lanes=je.lanes):(Fe.updateQueue=null,Fe.memoizedState=null)}var tt=Ly(Q);if(tt!==null){tt.flags&=-257,Dy(tt,Q,le,W,p),tt.mode&1&&Ry(W,we,p),p=tt,fe=we;var it=p.updateQueue;if(it===null){var st=new Set;st.add(fe),p.updateQueue=st}else it.add(fe);break e}else{if((p&1)===0){Ry(W,we,p),Gh();break e}fe=Error(r(426))}}else if(nr&&le.mode&1){var hr=Ly(Q);if(hr!==null){(hr.flags&65536)===0&&(hr.flags|=256),Dy(hr,Q,le,W,p),nh(ms(fe,le));break e}}W=fe=ms(fe,le),br!==4&&(br=2),Oo===null?Oo=[W]:Oo.push(W),W=Q;do{switch(W.tag){case 3:W.flags|=65536,p&=-p,W.lanes|=p;var xe=Ty(W,fe,p);ey(W,xe);break e;case 1:le=fe;var ge=W.type,be=W.stateNode;if((W.flags&128)===0&&(typeof ge.getDerivedStateFromError=="function"||be!==null&&typeof be.componentDidCatch=="function"&&(ji===null||!ji.has(be)))){W.flags|=65536,p&=-p,W.lanes|=p;var We=Ny(W,le,p);ey(W,We);break e}}W=W.return}while(W!==null)}l0(C)}catch(ot){p=ot,gr===C&&C!==null&&(gr=C=C.return);continue}break}while(!0)}function s0(){var h=Eu.current;return Eu.current=bu,h===null?bu:h}function Gh(){(br===0||br===3||br===2)&&(br=4),Er===null||(Ca&268435455)===0&&(Tu&268435455)===0||Hi(Er,Ar)}function Pu(h,p){var C=Dt;Dt|=2;var R=s0();(Er!==h||Ar!==p)&&(gi=null,Ea(h,p));do try{dk();break}catch(j){a0(h,j)}while(!0);if(ah(),Dt=C,Eu.current=R,gr!==null)throw Error(r(261));return Er=null,Ar=0,br}function dk(){for(;gr!==null;)o0(gr)}function hk(){for(;gr!==null&&!ga();)o0(gr)}function o0(h){var p=d0(h.alternate,h,pn);h.memoizedProps=h.pendingProps,p===null?l0(h):gr=p,Bh.current=null}function l0(h){var p=h;do{var C=p.alternate;if(h=p.return,(p.flags&32768)===0){if(C=ik(C,p,pn),C!==null){gr=C;return}}else{if(C=ak(C,p),C!==null){C.flags&=32767,gr=C;return}if(h!==null)h.flags|=32768,h.subtreeFlags=0,h.deletions=null;else{br=6,gr=null;return}}if(p=p.sibling,p!==null){gr=p;return}gr=p=h}while(p!==null);br===0&&(br=5)}function Ta(h,p,C){var R=Ht,j=Cn.transition;try{Cn.transition=null,Ht=1,fk(h,p,C,R)}finally{Cn.transition=j,Ht=R}return null}function fk(h,p,C,R){do ws();while(Fi!==null);if((Dt&6)!==0)throw Error(r(327));C=h.finishedWork;var j=h.finishedLanes;if(C===null)return null;if(h.finishedWork=null,h.finishedLanes=0,C===h.current)throw Error(r(177));h.callbackNode=null,h.callbackPriority=0;var W=C.lanes|C.childLanes;if(qS(h,W),h===Er&&(gr=Er=null,Ar=0),(C.subtreeFlags&2064)===0&&(C.flags&2064)===0||Ru||(Ru=!0,h0(Wn,function(){return ws(),null})),W=(C.flags&15990)!==0,(C.subtreeFlags&15990)!==0||W){W=Cn.transition,Cn.transition=null;var Q=Ht;Ht=1;var le=Dt;Dt|=4,Bh.current=null,ok(h,C),Zy(C,h),PC(Gd),Wl=!!Vd,Gd=Vd=null,h.current=C,lk(C),Za(),Dt=le,Ht=Q,Cn.transition=W}else h.current=C;if(Ru&&(Ru=!1,Fi=h,Lu=j),W=h.pendingLanes,W===0&&(ji=null),Nt(C.stateNode),an(h,Wt()),p!==null)for(R=h.onRecoverableError,C=0;C<p.length;C++)j=p[C],R(j.value,{componentStack:j.stack,digest:j.digest});if(Nu)throw Nu=!1,h=zh,zh=null,h;return(Lu&1)!==0&&h.tag!==0&&ws(),W=h.pendingLanes,(W&1)!==0?h===Hh?Bo++:(Bo=0,Hh=h):Bo=0,Mi(),null}function ws(){if(Fi!==null){var h=Xv(Lu),p=Cn.transition,C=Ht;try{if(Cn.transition=null,Ht=16>h?16:h,Fi===null)var R=!1;else{if(h=Fi,Fi=null,Lu=0,(Dt&6)!==0)throw Error(r(331));var j=Dt;for(Dt|=4,rt=h.current;rt!==null;){var W=rt,Q=W.child;if((rt.flags&16)!==0){var le=W.deletions;if(le!==null){for(var fe=0;fe<le.length;fe++){var we=le[fe];for(rt=we;rt!==null;){var Fe=rt;switch(Fe.tag){case 0:case 11:case 15:Mo(8,Fe,W)}var He=Fe.child;if(He!==null)He.return=Fe,rt=He;else for(;rt!==null;){Fe=rt;var je=Fe.sibling,tt=Fe.return;if(qy(Fe),Fe===we){rt=null;break}if(je!==null){je.return=tt,rt=je;break}rt=tt}}}var it=W.alternate;if(it!==null){var st=it.child;if(st!==null){it.child=null;do{var hr=st.sibling;st.sibling=null,st=hr}while(st!==null)}}rt=W}}if((W.subtreeFlags&2064)!==0&&Q!==null)Q.return=W,rt=Q;else e:for(;rt!==null;){if(W=rt,(W.flags&2048)!==0)switch(W.tag){case 0:case 11:case 15:Mo(9,W,W.return)}var xe=W.sibling;if(xe!==null){xe.return=W.return,rt=xe;break e}rt=W.return}}var ge=h.current;for(rt=ge;rt!==null;){Q=rt;var be=Q.child;if((Q.subtreeFlags&2064)!==0&&be!==null)be.return=Q,rt=be;else e:for(Q=ge;rt!==null;){if(le=rt,(le.flags&2048)!==0)try{switch(le.tag){case 0:case 11:case 15:ku(9,le)}}catch(ot){cr(le,le.return,ot)}if(le===Q){rt=null;break e}var We=le.sibling;if(We!==null){We.return=le.return,rt=We;break e}rt=le.return}}if(Dt=j,Mi(),ct&&typeof ct.onPostCommitFiberRoot=="function")try{ct.onPostCommitFiberRoot(Tt,h)}catch{}R=!0}return R}finally{Ht=C,Cn.transition=p}}return!1}function u0(h,p,C){p=ms(C,p),p=Ty(h,p,1),h=Oi(h,p,1),p=Yr(),h!==null&&(so(h,1,p),an(h,p))}function cr(h,p,C){if(h.tag===3)u0(h,h,C);else for(;p!==null;){if(p.tag===3){u0(p,h,C);break}else if(p.tag===1){var R=p.stateNode;if(typeof p.type.getDerivedStateFromError=="function"||typeof R.componentDidCatch=="function"&&(ji===null||!ji.has(R))){h=ms(C,h),h=Ny(p,h,1),p=Oi(p,h,1),h=Yr(),p!==null&&(so(p,1,h),an(p,h));break}}p=p.return}}function pk(h,p,C){var R=h.pingCache;R!==null&&R.delete(p),p=Yr(),h.pingedLanes|=h.suspendedLanes&C,Er===h&&(Ar&C)===C&&(br===4||br===3&&(Ar&130023424)===Ar&&500>Wt()-Fh?Ea(h,0):jh|=C),an(h,p)}function c0(h,p){p===0&&((h.mode&1)===0?p=1:(p=zl,zl<<=1,(zl&130023424)===0&&(zl=4194304)));var C=Yr();h=hi(h,p),h!==null&&(so(h,p,C),an(h,C))}function gk(h){var p=h.memoizedState,C=0;p!==null&&(C=p.retryLane),c0(h,C)}function vk(h,p){var C=0;switch(h.tag){case 13:var R=h.stateNode,j=h.memoizedState;j!==null&&(C=j.retryLane);break;case 19:R=h.stateNode;break;default:throw Error(r(314))}R!==null&&R.delete(p),c0(h,C)}var d0;d0=function(h,p,C){if(h!==null)if(h.memoizedProps!==p.pendingProps||en.current)rn=!0;else{if((h.lanes&C)===0&&(p.flags&128)===0)return rn=!1,nk(h,p,C);rn=(h.flags&131072)!==0}else rn=!1,nr&&(p.flags&1048576)!==0&&Wm(p,lu,p.index);switch(p.lanes=0,p.tag){case 2:var R=p.type;Su(h,p),h=p.pendingProps;var j=us(p,Br.current);gs(p,C),j=vh(null,p,R,h,j,C);var W=mh();return p.flags|=1,typeof j=="object"&&j!==null&&typeof j.render=="function"&&j.$$typeof===void 0?(p.tag=1,p.memoizedState=null,p.updateQueue=null,tn(R)?(W=!0,au(p)):W=!1,p.memoizedState=j.state!==null&&j.state!==void 0?j.state:null,uh(p),j.updater=wu,p.stateNode=j,j._reactInternals=p,Sh(p,R,h,C),p=Th(null,p,R,!0,W,C)):(p.tag=0,nr&&W&&Jd(p),qr(null,p,j,C),p=p.child),p;case 16:R=p.elementType;e:{switch(Su(h,p),h=p.pendingProps,j=R._init,R=j(R._payload),p.type=R,j=p.tag=yk(R),h=In(R,h),j){case 0:p=Eh(null,p,R,h,C);break e;case 1:p=By(null,p,R,h,C);break e;case 11:p=Ay(null,p,R,h,C);break e;case 14:p=Py(null,p,R,In(R.type,h),C);break e}throw Error(r(306,R,""))}return p;case 0:return R=p.type,j=p.pendingProps,j=p.elementType===R?j:In(R,j),Eh(h,p,R,j,C);case 1:return R=p.type,j=p.pendingProps,j=p.elementType===R?j:In(R,j),By(h,p,R,j,C);case 3:e:{if(jy(p),h===null)throw Error(r(387));R=p.pendingProps,W=p.memoizedState,j=W.element,Jm(h,p),pu(p,R,null,C);var Q=p.memoizedState;if(R=Q.element,W.isDehydrated)if(W={element:R,isDehydrated:!1,cache:Q.cache,pendingSuspenseBoundaries:Q.pendingSuspenseBoundaries,transitions:Q.transitions},p.updateQueue.baseState=W,p.memoizedState=W,p.flags&256){j=ms(Error(r(423)),p),p=Fy(h,p,R,C,j);break e}else if(R!==j){j=ms(Error(r(424)),p),p=Fy(h,p,R,C,j);break e}else for(fn=Di(p.stateNode.containerInfo.firstChild),hn=p,nr=!0,Mn=null,C=Qm(p,null,R,C),p.child=C;C;)C.flags=C.flags&-3|4096,C=C.sibling;else{if(hs(),R===j){p=pi(h,p,C);break e}qr(h,p,R,C)}p=p.child}return p;case 5:return ry(p),h===null&&rh(p),R=p.type,j=p.pendingProps,W=h!==null?h.memoizedProps:null,Q=j.children,qd(R,j)?Q=null:W!==null&&qd(R,W)&&(p.flags|=32),Oy(h,p),qr(h,p,Q,C),p.child;case 6:return h===null&&rh(p),null;case 13:return zy(h,p,C);case 4:return ch(p,p.stateNode.containerInfo),R=p.pendingProps,h===null?p.child=fs(p,null,R,C):qr(h,p,R,C),p.child;case 11:return R=p.type,j=p.pendingProps,j=p.elementType===R?j:In(R,j),Ay(h,p,R,j,C);case 7:return qr(h,p,p.pendingProps,C),p.child;case 8:return qr(h,p,p.pendingProps.children,C),p.child;case 12:return qr(h,p,p.pendingProps.children,C),p.child;case 10:e:{if(R=p.type._context,j=p.pendingProps,W=p.memoizedProps,Q=j.value,Xt(du,R._currentValue),R._currentValue=Q,W!==null)if(Pn(W.value,Q)){if(W.children===j.children&&!en.current){p=pi(h,p,C);break e}}else for(W=p.child,W!==null&&(W.return=p);W!==null;){var le=W.dependencies;if(le!==null){Q=W.child;for(var fe=le.firstContext;fe!==null;){if(fe.context===R){if(W.tag===1){fe=fi(-1,C&-C),fe.tag=2;var we=W.updateQueue;if(we!==null){we=we.shared;var Fe=we.pending;Fe===null?fe.next=fe:(fe.next=Fe.next,Fe.next=fe),we.pending=fe}}W.lanes|=C,fe=W.alternate,fe!==null&&(fe.lanes|=C),oh(W.return,C,p),le.lanes|=C;break}fe=fe.next}}else if(W.tag===10)Q=W.type===p.type?null:W.child;else if(W.tag===18){if(Q=W.return,Q===null)throw Error(r(341));Q.lanes|=C,le=Q.alternate,le!==null&&(le.lanes|=C),oh(Q,C,p),Q=W.sibling}else Q=W.child;if(Q!==null)Q.return=W;else for(Q=W;Q!==null;){if(Q===p){Q=null;break}if(W=Q.sibling,W!==null){W.return=Q.return,Q=W;break}Q=Q.return}W=Q}qr(h,p,j.children,C),p=p.child}return p;case 9:return j=p.type,R=p.pendingProps.children,gs(p,C),j=_n(j),R=R(j),p.flags|=1,qr(h,p,R,C),p.child;case 14:return R=p.type,j=In(R,p.pendingProps),j=In(R.type,j),Py(h,p,R,j,C);case 15:return My(h,p,p.type,p.pendingProps,C);case 17:return R=p.type,j=p.pendingProps,j=p.elementType===R?j:In(R,j),Su(h,p),p.tag=1,tn(R)?(h=!0,au(p)):h=!1,gs(p,C),ky(p,R,j),Sh(p,R,j,C),Th(null,p,R,!0,h,C);case 19:return Uy(h,p,C);case 22:return Iy(h,p,C)}throw Error(r(156,p.tag))};function h0(h,p){return Dn(h,p)}function mk(h,p,C,R){this.tag=h,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(h,p,C,R){return new mk(h,p,C,R)}function qh(h){return h=h.prototype,!(!h||!h.isReactComponent)}function yk(h){if(typeof h=="function")return qh(h)?1:0;if(h!=null){if(h=h.$$typeof,h===O)return 11;if(h===M)return 14}return 2}function Ui(h,p){var C=h.alternate;return C===null?(C=kn(h.tag,p,h.key,h.mode),C.elementType=h.elementType,C.type=h.type,C.stateNode=h.stateNode,C.alternate=h,h.alternate=C):(C.pendingProps=p,C.type=h.type,C.flags=0,C.subtreeFlags=0,C.deletions=null),C.flags=h.flags&14680064,C.childLanes=h.childLanes,C.lanes=h.lanes,C.child=h.child,C.memoizedProps=h.memoizedProps,C.memoizedState=h.memoizedState,C.updateQueue=h.updateQueue,p=h.dependencies,C.dependencies=p===null?null:{lanes:p.lanes,firstContext:p.firstContext},C.sibling=h.sibling,C.index=h.index,C.ref=h.ref,C}function Mu(h,p,C,R,j,W){var Q=2;if(R=h,typeof h=="function")qh(h)&&(Q=1);else if(typeof h=="string")Q=5;else e:switch(h){case E:return Na(C.children,j,W,p);case k:Q=8,j|=8;break;case L:return h=kn(12,C,p,j|2),h.elementType=L,h.lanes=W,h;case B:return h=kn(13,C,p,j),h.elementType=B,h.lanes=W,h;case D:return h=kn(19,C,p,j),h.elementType=D,h.lanes=W,h;case H:return Iu(C,j,W,p);default:if(typeof h=="object"&&h!==null)switch(h.$$typeof){case A:Q=10;break e;case I:Q=9;break e;case O:Q=11;break e;case M:Q=14;break e;case U:Q=16,R=null;break e}throw Error(r(130,h==null?h:typeof h,""))}return p=kn(Q,C,p,j),p.elementType=h,p.type=R,p.lanes=W,p}function Na(h,p,C,R){return h=kn(7,h,R,p),h.lanes=C,h}function Iu(h,p,C,R){return h=kn(22,h,R,p),h.elementType=H,h.lanes=C,h.stateNode={isHidden:!1},h}function Yh(h,p,C){return h=kn(6,h,null,p),h.lanes=C,h}function Kh(h,p,C){return p=kn(4,h.children!==null?h.children:[],h.key,p),p.lanes=C,p.stateNode={containerInfo:h.containerInfo,pendingChildren:null,implementation:h.implementation},p}function xk(h,p,C,R,j){this.tag=p,this.containerInfo=h,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=_d(0),this.expirationTimes=_d(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=_d(0),this.identifierPrefix=R,this.onRecoverableError=j,this.mutableSourceEagerHydrationData=null}function Xh(h,p,C,R,j,W,Q,le,fe){return h=new xk(h,p,C,le,fe),p===1?(p=1,W===!0&&(p|=8)):p=0,W=kn(3,null,null,p),h.current=W,W.stateNode=h,W.memoizedState={element:R,isDehydrated:C,cache:null,transitions:null,pendingSuspenseBoundaries:null},uh(W),h}function bk(h,p,C){var R=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:N,key:R==null?null:""+R,children:h,containerInfo:p,implementation:C}}function f0(h){if(!h)return Pi;h=h._reactInternals;e:{if(jt(h)!==h||h.tag!==1)throw Error(r(170));var p=h;do{switch(p.tag){case 3:p=p.stateNode.context;break e;case 1:if(tn(p.type)){p=p.stateNode.__reactInternalMemoizedMergedChildContext;break e}}p=p.return}while(p!==null);throw Error(r(171))}if(h.tag===1){var C=h.type;if(tn(C))return Hm(h,C,p)}return p}function p0(h,p,C,R,j,W,Q,le,fe){return h=Xh(C,R,!0,h,j,W,Q,le,fe),h.context=f0(null),C=h.current,R=Yr(),j=zi(C),W=fi(R,j),W.callback=p??null,Oi(C,W,j),h.current.lanes=j,so(h,j,R),an(h,R),h}function Ou(h,p,C,R){var j=p.current,W=Yr(),Q=zi(j);return C=f0(C),p.context===null?p.context=C:p.pendingContext=C,p=fi(W,Q),p.payload={element:h},R=R===void 0?null:R,R!==null&&(p.callback=R),h=Oi(j,p,Q),h!==null&&(jn(h,j,Q,W),fu(h,j,Q)),Q}function Bu(h){if(h=h.current,!h.child)return null;switch(h.child.tag){case 5:return h.child.stateNode;default:return h.child.stateNode}}function g0(h,p){if(h=h.memoizedState,h!==null&&h.dehydrated!==null){var C=h.retryLane;h.retryLane=C!==0&&C<p?C:p}}function Qh(h,p){g0(h,p),(h=h.alternate)&&g0(h,p)}function wk(){return null}var v0=typeof reportError=="function"?reportError:function(h){console.error(h)};function Zh(h){this._internalRoot=h}ju.prototype.render=Zh.prototype.render=function(h){var p=this._internalRoot;if(p===null)throw Error(r(409));Ou(h,p,null,null)},ju.prototype.unmount=Zh.prototype.unmount=function(){var h=this._internalRoot;if(h!==null){this._internalRoot=null;var p=h.containerInfo;ka(function(){Ou(null,h,null,null)}),p[li]=null}};function ju(h){this._internalRoot=h}ju.prototype.unstable_scheduleHydration=function(h){if(h){var p=Jv();h={blockedOn:null,target:h,priority:p};for(var C=0;C<Ni.length&&p!==0&&p<Ni[C].priority;C++);Ni.splice(C,0,h),C===0&&rm(h)}};function Jh(h){return!(!h||h.nodeType!==1&&h.nodeType!==9&&h.nodeType!==11)}function Fu(h){return!(!h||h.nodeType!==1&&h.nodeType!==9&&h.nodeType!==11&&(h.nodeType!==8||h.nodeValue!==" react-mount-point-unstable "))}function m0(){}function _k(h,p,C,R,j){if(j){if(typeof R=="function"){var W=R;R=function(){var we=Bu(Q);W.call(we)}}var Q=p0(p,R,h,0,null,!1,!1,"",m0);return h._reactRootContainer=Q,h[li]=Q.current,wo(h.nodeType===8?h.parentNode:h),ka(),Q}for(;j=h.lastChild;)h.removeChild(j);if(typeof R=="function"){var le=R;R=function(){var we=Bu(fe);le.call(we)}}var fe=Xh(h,0,!1,null,null,!1,!1,"",m0);return h._reactRootContainer=fe,h[li]=fe.current,wo(h.nodeType===8?h.parentNode:h),ka(function(){Ou(p,fe,C,R)}),fe}function zu(h,p,C,R,j){var W=C._reactRootContainer;if(W){var Q=W;if(typeof j=="function"){var le=j;j=function(){var fe=Bu(Q);le.call(fe)}}Ou(p,Q,h,j)}else Q=_k(C,p,h,j,R);return Bu(Q)}Qv=function(h){switch(h.tag){case 3:var p=h.stateNode;if(p.current.memoizedState.isDehydrated){var C=ao(p.pendingLanes);C!==0&&(Sd(p,C|1),an(p,Wt()),(Dt&6)===0&&(bs=Wt()+500,Mi()))}break;case 13:ka(function(){var R=hi(h,1);if(R!==null){var j=Yr();jn(R,h,1,j)}}),Qh(h,1)}},Cd=function(h){if(h.tag===13){var p=hi(h,134217728);if(p!==null){var C=Yr();jn(p,h,134217728,C)}Qh(h,134217728)}},Zv=function(h){if(h.tag===13){var p=zi(h),C=hi(h,p);if(C!==null){var R=Yr();jn(C,h,p,R)}Qh(h,p)}},Jv=function(){return Ht},em=function(h,p){var C=Ht;try{return Ht=h,p()}finally{Ht=C}},De=function(h,p,C){switch(p){case"input":if(_e(h,C),p=C.name,C.type==="radio"&&p!=null){for(C=h;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!==h&&R.form===h.form){var j=nu(R);if(!j)throw Error(r(90));re(R),_e(R,j)}}}break;case"textarea":Ue(h,C);break;case"select":p=C.value,p!=null&&Pe(h,!!C.multiple,p,!1)}},Je=Wh,Ze=ka;var Sk={usingClientEntryPoint:!1,Events:[Co,os,nu,Xe,mt,Wh]},jo={findFiberByHostInstance:ma,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},Ck={bundleType:jo.bundleType,version:jo.version,rendererPackageName:jo.rendererPackageName,rendererConfig:jo.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:S.ReactCurrentDispatcher,findHostInstanceByFiber:function(h){return h=si(h),h===null?null:h.stateNode},findFiberByHostInstance:jo.findFiberByHostInstance||wk,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 Hu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Hu.isDisabled&&Hu.supportsFiber)try{Tt=Hu.inject(Ck),ct=Hu}catch{}}return sn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Sk,sn.createPortal=function(h,p){var C=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Jh(p))throw Error(r(200));return bk(h,p,null,C)},sn.createRoot=function(h,p){if(!Jh(h))throw Error(r(299));var C=!1,R="",j=v0;return p!=null&&(p.unstable_strictMode===!0&&(C=!0),p.identifierPrefix!==void 0&&(R=p.identifierPrefix),p.onRecoverableError!==void 0&&(j=p.onRecoverableError)),p=Xh(h,1,!1,null,null,C,!1,R,j),h[li]=p.current,wo(h.nodeType===8?h.parentNode:h),new Zh(p)},sn.findDOMNode=function(h){if(h==null)return null;if(h.nodeType===1)return h;var p=h._reactInternals;if(p===void 0)throw typeof h.render=="function"?Error(r(188)):(h=Object.keys(h).join(","),Error(r(268,h)));return h=si(p),h=h===null?null:h.stateNode,h},sn.flushSync=function(h){return ka(h)},sn.hydrate=function(h,p,C){if(!Fu(p))throw Error(r(200));return zu(null,h,p,!0,C)},sn.hydrateRoot=function(h,p,C){if(!Jh(h))throw Error(r(405));var R=C!=null&&C.hydratedSources||null,j=!1,W="",Q=v0;if(C!=null&&(C.unstable_strictMode===!0&&(j=!0),C.identifierPrefix!==void 0&&(W=C.identifierPrefix),C.onRecoverableError!==void 0&&(Q=C.onRecoverableError)),p=p0(p,null,h,1,C??null,j,!1,W,Q),h[li]=p.current,wo(h),R)for(h=0;h<R.length;h++)C=R[h],j=C._getVersion,j=j(C._source),p.mutableSourceEagerHydrationData==null?p.mutableSourceEagerHydrationData=[C,j]:p.mutableSourceEagerHydrationData.push(C,j);return new ju(p)},sn.render=function(h,p,C){if(!Fu(p))throw Error(r(200));return zu(null,h,p,!1,C)},sn.unmountComponentAtNode=function(h){if(!Fu(h))throw Error(r(40));return h._reactRootContainer?(ka(function(){zu(null,null,h,!1,function(){h._reactRootContainer=null,h[li]=null})}),!0):!1},sn.unstable_batchedUpdates=Wh,sn.unstable_renderSubtreeIntoContainer=function(h,p,C,R){if(!Fu(C))throw Error(r(200));if(h==null||h._reactInternals===void 0)throw Error(r(38));return zu(h,p,C,!1,R)},sn.version="18.3.1-next-f1338f8080-20240426",sn}var E0;function Mk(){if(E0)return rf.exports;E0=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(),rf.exports=Pk(),rf.exports}var T0;function Ik(){if(T0)return $u;T0=1;var t=Mk();return $u.createRoot=t.createRoot,$u.hydrateRoot=t.hydrateRoot,$u}var Ok=Ik();const sf={};function bw(){const t=sf==null?void 0:sf.VITE_API_HOST;return typeof t=="string"&&t.length>0?t:void 0}function ww(){const t=bw();return t?`http://${t}/api/v1`:`${window.location.origin}/api/v1`}function _w(){const t=bw();return t?`ws://${t}`:`${window.location.protocol==="https:"?"wss":"ws"}://${window.location.host}`}const Sw=t=>`${_w()}/ws/terminals/${encodeURIComponent(t)}`;async function at(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(`${ww()}${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 Bk(t){var s;const e=await fetch(`${ww()}/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 Ve={listRuns:t=>at(t?"/runs?include=archived":"/runs"),archiveRun:(t,e,r)=>at(`/runs/${encodeURIComponent(t)}/archive`,{method:"POST",body:JSON.stringify(r===void 0?{archived:e}:{archived:e,note:r})}),getRun:t=>at(`/runs/${encodeURIComponent(t)}`),getRunEvents:t=>at(`/runs/${encodeURIComponent(t)}/events`),launchRun:t=>at("/runs",{method:"POST",body:JSON.stringify(t)}),confirmGate:(t,e)=>at(`/runs/${encodeURIComponent(t)}/gate`,{method:"POST",body:JSON.stringify(e)}),cancelRun:t=>at(`/runs/${encodeURIComponent(t)}/cancel`,{method:"POST"}),resumeRun:t=>at(`/runs/${encodeURIComponent(t)}/resume`,{method:"POST"}),openChat:t=>at("/chats",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),sendChatMessage:(t,e,r)=>at(`/chats/${encodeURIComponent(t)}/messages`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r===void 0?{text:e}:{text:e,targets:r})}),closeChat:t=>at(`/chats/${encodeURIComponent(t)}`,{method:"DELETE"}),getChat:t=>at(`/chats/${encodeURIComponent(t)}`),listChats:()=>at("/chats"),getUnitOutput:(t,e)=>at(`/runs/${encodeURIComponent(t)}/units/${encodeURIComponent(e)}/output`),getGate:t=>at(`/runs/${encodeURIComponent(t)}/gate`),getElicitation:async t=>{try{return await at(`/runs/${encodeURIComponent(t)}/elicitation`)}catch(e){if(e instanceof Error&&/\b404\b/.test(e.message))return null;throw e}},respondToElicitation:(t,e)=>at(`/runs/${encodeURIComponent(t)}/elicitation`,{method:"POST",body:JSON.stringify(e)}),getRoster:()=>at("/roster"),listRepos:()=>at("/repos"),registerRepo:(t,e)=>at("/repos",{method:"POST",body:JSON.stringify({name:t,rootPath:e})}),cloneAndRegisterRepo:(t,e,r)=>at("/repos",{method:"POST",body:JSON.stringify({name:t,gitUrl:e,...r?{rootPath:r}:{}})}),getOnboardRun:t=>at(`/repos/${encodeURIComponent(t)}/onboard`),rerunOnboarding:t=>at(`/repos/${encodeURIComponent(t)}/onboard`,{method:"POST"}),getHealth:()=>at("/health"),openTerminal:t=>at("/terminals",{method:"POST",body:JSON.stringify(t)}),resizeTerminal:(t,e,r)=>at(`/terminals/${encodeURIComponent(t)}/resize`,{method:"POST",body:JSON.stringify({cols:e,rows:r})}),closeTerminal:t=>at(`/terminals/${encodeURIComponent(t)}/close`,{method:"POST"}),openPath:(t,e)=>at("/open",{method:"POST",body:JSON.stringify(e===void 0?{path:t}:{path:t,runId:e})}),injectMessage:(t,e,r)=>at(`/runs/${encodeURIComponent(t)}/inject`,{method:"POST",body:JSON.stringify({message:e,target:r})}),listWorkflows:()=>at("/workflows"),getWorkflow:t=>at(`/workflows/${encodeURIComponent(t)}`),createWorkflow:t=>at("/workflows",{method:"POST",body:JSON.stringify(t)}),saveScript:(t,e,r)=>at("/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)),at(`/repos/${encodeURIComponent(t)}/requirements?${r.toString()}`)},getRequirement:(t,e)=>at(`/repos/${encodeURIComponent(t)}/requirements/${encodeURIComponent(e)}`),patchRequirement:(t,e,r)=>at(`/repos/${encodeURIComponent(t)}/requirements/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)}),getDomainGraph:()=>at("/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 at(`/repos/${encodeURIComponent(t)}/graph${n}`)},getBlastRadius:(t,e)=>at(`/repos/${encodeURIComponent(t)}/graph/blast-radius?name=${encodeURIComponent(e)}`),getRepoGitHistory:t=>at(`/repos/${encodeURIComponent(t)}/git-history`),getRepoContributors:t=>at(`/repos/${encodeURIComponent(t)}/contributors`),getRepoDomainGraph:t=>at(`/repos/${encodeURIComponent(t)}/domain-graph`),listPolicies:()=>at("/governance/policies"),listConformanceRules:()=>at("/governance/rules"),getCoverageReport:()=>at("/governance/coverage"),getCoverageReportForRepo:t=>at(`/governance/coverage?repo=${encodeURIComponent(t)}`),getGraphKindsForRepo:t=>at(`/governance/graph?repo=${encodeURIComponent(t)}`),listClaims:()=>at("/governance/claims"),upsertPolicy:t=>at("/governance/policies",{method:"POST",body:JSON.stringify(t)}),upsertConformanceRule:t=>at("/governance/rules",{method:"POST",body:JSON.stringify(t)}),retirePolicy:t=>at(`/governance/policies/${encodeURIComponent(t)}`,{method:"DELETE"}),retireConformanceRule:t=>at(`/governance/rules/${encodeURIComponent(t)}`,{method:"DELETE"}),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 at(`/governance/rules/preview${n}`)},getSettings:()=>at("/settings"),updateSettings:t=>at("/settings",{method:"PUT",body:JSON.stringify(t)}),listProjects:t=>{const e=t?`?status=${t}`:"";return at(`/projects${e}`)},getProject:t=>at(`/projects/${encodeURIComponent(t)}`),createProject:t=>at("/projects",{method:"POST",body:JSON.stringify(t)}),updateProject:(t,e)=>at(`/projects/${encodeURIComponent(t)}`,{method:"PATCH",body:JSON.stringify(e)}),listProjectMembers:t=>at(`/projects/${encodeURIComponent(t)}/members`),attachProjectMember:(t,e)=>at(`/projects/${encodeURIComponent(t)}/members`,{method:"POST",body:JSON.stringify(e)}),detachProjectMember:(t,e)=>at(`/projects/${encodeURIComponent(t)}/members/${encodeURIComponent(e)}`,{method:"DELETE"}),getProjectActivity:(t,e)=>{const r=e?`?cursor=${encodeURIComponent(e)}`:"";return at(`/projects/${encodeURIComponent(t)}/activity${r}`)}};function Cw(t,e){if(t.status!=="executing")return null;const n=[...e].sort((i,s)=>i.ord-s.ord)[t.unit_ix];return n===void 0||n.status==="done"||n.status==="rejected"?null:n.ord}function jk(t){return t.reduce((e,r)=>e+(Cw(r.session,r.units)===null?0:1),0)}const N0=t=>{let e;const r=new Set,n=(u,c)=>{const d=typeof u=="function"?u(e):u;if(!Object.is(d,e)){const g=e;e=c??(typeof d!="object"||d===null)?d:Object.assign({},e,d),r.forEach(f=>f(e,g))}},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},Fk=(t=>t?N0(t):N0),zk=t=>t;function Hk(t,e=zk){const r=Uu.useSyncExternalStore(t.subscribe,Uu.useCallback(()=>e(t.getState()),[t,e]),Uu.useCallback(()=>e(t.getInitialState()),[t,e]));return Uu.useDebugValue(r),r}const R0=t=>{const e=Fk(t),r=n=>Hk(e,n);return Object.assign(r,e),r},oa=(t=>t?R0(t):R0),ti=oa(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})})),L0=5e4,D0=new Set(["cliOutputDelta","heartbeat"]),zs=oa(t=>({byRun:{},ingest:e=>{const r=typeof e.session=="string"?e.session:void 0;r!==void 0&&(D0.has(e.type)||t(n=>{const s=[...n.byRun[r]??[],e];return s.length>L0&&s.splice(0,s.length-L0),{byRun:{...n.byRun,[r]:s}}}))},hydrate:(e,r)=>t(n=>{if((n.byRun[e]??[]).length>0)return n;const i=r.filter(s=>s.session===e&&!D0.has(s.type));return i.length===0?n:{byRun:{...n.byRun,[e]:i}}}),clear:e=>t(r=>{if(!(e in r.byRun))return r;const n={...r.byRun};return delete n[e],{byRun:n}})})),Kg=oa(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()}]}})})),Uk=[{value:"30d",label:"30d"},{value:"60d",label:"60d"},{value:"90d",label:"90d"}];function $k(t,e){const r=e==="30d"?30:e==="60d"?60:90;return t.slice(0,r)}function Xg(t="30d"){const[e,r]=J.useState(t),n=J.useCallback(i=>$k(i,e),[e]);return{range:e,setRange:r,filter:n}}const Wk={fontFamily:"monospace"};function Qg({value:t,onChange:e}){return w.jsx("div",{role:"group","aria-label":"Time range",style:{display:"flex",gap:"4px"},children:Uk.map(({value:r,label:n})=>w.jsx("button",{type:"button","aria-pressed":t===r,onClick:()=>e(r),style:{padding:"3px 8px",borderRadius:"5px",fontSize:"10px",fontWeight:600,...Wk,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 Wu=new Set(["planning","distributing","executing","awaiting_human"]),Vk=new Set(["awaitingHuman","gateEscalated","stepFailed","sessionFailed","crashRecoveryRedrive","unitDone","workflowSelected","acpFallback"]),_t={fontFamily:"monospace"},Ms={background:"#1b222e",border:"1px solid rgba(230,237,243,0.08)",borderRadius:"12px"},Ma={fontSize:"10px",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.1em",color:"rgba(230,237,243,0.4)",fontFamily:"monospace",margin:0},Gk={pending:"rgba(230,237,243,0.18)",distributed:"#79c0ff",done:"#3fb950",rejected:"#f85149"},qk={distributed:!0};function dl(t,e){return t.length>e?`${t.slice(0,e)}…`:t}function pg(t){const e=t.session.problem;return e.length>0?dl(e,32):t.session.id.slice(0,8)}function Yk(t){return t<.01?"<$0.01":`$${t.toFixed(2)}`}function Kk(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}k`:String(t)}const kw={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)"}},Ew={icon:"·",label:"Event",borderColor:"rgba(230,237,243,0.08)",textColor:"#e6edf3",badgeColor:"rgba(230,237,243,0.04)"};function Xk({runId:t,ord:e,prompt:r,sessionLbl:n,onApprove:i,onReject:s}){const[o,a]=J.useState(""),[l,u]=J.useState(!1),[c,d]=J.useState(!1),g=J.useCallback(async y=>{u(!0);try{await y()}catch{}finally{u(!1)}},[]),f=kw.awaitingHuman??Ew;return w.jsxs("div",{style:{background:"#161c26",border:`1px solid ${f.borderColor}`,borderRadius:"10px",padding:"14px 16px"},children:[w.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:"4px"},children:[w.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"7px"},children:[w.jsx("span",{style:{color:f.textColor,fontSize:"13px"},children:f.icon}),w.jsx("span",{style:{fontSize:"12px",fontWeight:600,color:f.textColor,..._t},children:f.label})]}),w.jsx("span",{style:{fontSize:"10px",color:"rgba(230,237,243,0.4)",..._t,flexShrink:0,marginLeft:"8px"},children:n})]}),w.jsxs("p",{style:{fontSize:"11px",color:"rgba(230,237,243,0.45)",..._t,margin:"0 0 8px"},children:[t.slice(0,8),typeof e=="number"?` · before unit #${e}`:""]}),r&&w.jsx("p",{style:{fontSize:"12px",color:"rgba(230,237,243,0.7)",..._t,margin:"0 0 10px",lineHeight:1.5,display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"},children:r}),c&&w.jsx("textarea",{style:{width:"100%",background:"#0f1419",border:"1px solid rgba(230,237,243,0.14)",borderRadius:"6px",color:"#e6edf3",fontSize:"12px",..._t,padding:"6px 8px",resize:"vertical",marginBottom:"10px",boxSizing:"border-box",outline:"none"},rows:2,placeholder:"Steer / amendment for the next unit…",value:o,onChange:y=>a(y.target.value),disabled:l}),w.jsxs("div",{style:{display:"flex",gap:"6px",flexWrap:"wrap"},children:[w.jsx("button",{type:"button",disabled:l,onClick:()=>void g(()=>i(t)),style:{background:"#3fb950",color:"#0d1117",border:"none",borderRadius:"6px",padding:"5px 12px",fontSize:"11px",fontWeight:700,..._t,cursor:l?"not-allowed":"pointer",opacity:l?.5:1},children:"Approve"}),w.jsx("button",{type:"button",disabled:l,onClick:()=>{c?o.trim()&&g(()=>i(t,o.trim())):d(!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,..._t,cursor:l?"not-allowed":"pointer",opacity:l?.5:1},children:c&&o.trim()?"Send steer":"Approve + steer"}),w.jsx("button",{type:"button",disabled:l,onClick:()=>void g(()=>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,..._t,cursor:l?"not-allowed":"pointer",opacity:l?.5:1},children:"Reject"})]})]})}function Qk({type:t,sessionId:e,sessionLbl:r,ord:n,detail:i}){const s=kw[t]??Ew;return w.jsxs("div",{style:{background:s.badgeColor,border:`1px solid ${s.borderColor}`,borderRadius:"8px",padding:"8px 12px",display:"flex",alignItems:"flex-start",gap:"8px"},children:[w.jsx("span",{style:{color:s.textColor,fontSize:"12px",lineHeight:"18px",flexShrink:0},children:s.icon}),w.jsxs("div",{style:{flex:1,minWidth:0},children:[w.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:"8px"},children:[w.jsxs("span",{style:{fontSize:"11px",fontWeight:600,color:s.textColor,..._t},children:[s.label,typeof n=="number"?` · unit #${n}`:""]}),w.jsx("span",{style:{fontSize:"10px",color:"rgba(230,237,243,0.3)",..._t,flexShrink:0},children:e.slice(0,6)})]}),i&&w.jsx("p",{style:{fontSize:"11px",color:"rgba(230,237,243,0.55)",..._t,margin:"2px 0 0",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:i,children:dl(i,80)}),!i&&w.jsx("p",{style:{fontSize:"10px",color:"rgba(230,237,243,0.3)",..._t,margin:"2px 0 0"},children:r})]})]})}function Zk({view:t,onSelect:e}){const{session:r,units:n}=t,i=pg(t),s=r.id,o=r.status==="awaiting_human";return w.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:[w.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)"}}),w.jsxs("div",{style:{flex:1,minWidth:0},children:[w.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"6px",gap:"8px"},children:[w.jsx("span",{style:{fontSize:"11px",fontWeight:600,color:"#e6edf3",..._t,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:i}),w.jsxs("span",{style:{fontSize:"10px",color:"rgba(230,237,243,0.35)",..._t,flexShrink:0},children:[s.slice(0,6)," · Open chat →"]})]}),w.jsx("div",{style:{display:"flex",gap:"4px",flexWrap:"wrap"},children:n.length===0?w.jsx("span",{style:{fontSize:"10px",color:"rgba(230,237,243,0.3)",..._t},children:"planning…"}):n.map(a=>{const l=["completed","cancelled","failed"].includes(r.status),u=l&&a.status==="distributed"?"rgba(230,237,243,0.18)":Gk[a.status]??"rgba(230,237,243,0.18)",c=qk[a.status]===!0&&!l;return w.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 Jk({activeRuns:t}){const[e,r]=J.useState(""),[n,i]=J.useState("__all__"),[s,o]=J.useState(!1),[a,l]=J.useState(!1),u=J.useRef(null),c=J.useRef(null);J.useEffect(()=>()=>{c.current&&clearTimeout(c.current)},[]);const d=J.useCallback(async()=>{var f;const g=e.trim();if(!(!g||t.length===0)){o(!0);try{if(n==="__all__"){const _=(await Promise.allSettled(t.map(v=>Ve.injectMessage(v.session.id,g,"all")))).filter(v=>v.status==="rejected").length;if(_>0)throw new Error(`${_} inject(s) failed`)}else await Ve.injectMessage(n,g,"all");r(""),l(!0),c.current=setTimeout(()=>l(!1),2500),(f=u.current)==null||f.focus()}finally{o(!1)}}},[e,n,t]);return w.jsxs("div",{children:[w.jsx("p",{style:{...Ma,marginBottom:"10px"},children:"Send to agents"}),w.jsx("div",{style:{...Ms,padding:"14px 16px"},children:t.length===0?w.jsx("p",{style:{fontSize:"11px",color:"rgba(230,237,243,0.3)",..._t},children:"No active sessions"}):w.jsxs(w.Fragment,{children:[w.jsx("div",{style:{display:"flex",gap:"8px",marginBottom:"8px",flexWrap:"wrap"},children:w.jsxs("select",{value:n,onChange:g=>i(g.target.value),disabled:s,style:{background:"#0f1419",border:"1px solid rgba(230,237,243,0.14)",borderRadius:"6px",color:"#e6edf3",fontSize:"11px",..._t,padding:"4px 8px",cursor:"pointer",outline:"none",flexShrink:0},children:[w.jsx("option",{value:"__all__",children:"All active agents"}),t.map(g=>w.jsxs("option",{value:g.session.id,children:[dl(g.session.problem||g.session.id,30)," (",g.session.id.slice(0,6),")"]},g.session.id))]})}),w.jsx("textarea",{ref:u,value:e,onChange:g=>r(g.target.value),onKeyDown:g=>{g.key==="Enter"&&(g.ctrlKey||g.metaKey)&&d()},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",..._t,padding:"8px 10px",resize:"vertical",outline:"none",boxSizing:"border-box",marginBottom:"8px"}}),w.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px"},children:[w.jsx("button",{type:"button",disabled:s||!e.trim(),onClick:()=>void d(),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,..._t,cursor:s||!e.trim()?"not-allowed":"pointer",transition:"all 0.15s"},children:s?"Sending…":"Send"}),a&&w.jsx("span",{style:{fontSize:"11px",color:"#3fb950",..._t},children:"✓ Injected"}),w.jsx("span",{style:{fontSize:"10px",color:"rgba(230,237,243,0.25)",..._t},children:"Ctrl+Enter"})]})]})})]})}function eE({runs:t,onSelectRun:e,onApproveGate:r,onRejectGate:n,navigate:i}){const s=zs(k=>k.byRun),o=ti(k=>k.gates),a=ti(k=>k.clearGate),l=Kg(k=>k.record),{range:u,setRange:c,filter:d}=Xg("30d"),g=J.useMemo(()=>d(t),[t,d]),f=J.useMemo(()=>g.filter(k=>Wu.has(k.session.status)),[g]),y=J.useMemo(()=>{let k=0,L=0,A=0,I=!1;for(const O of f){const B=s[O.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,f]),_=J.useMemo(()=>jk(g),[g]),v=J.useCallback(async(k,L)=>{await Ve.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=J.useCallback(async k=>{await Ve.confirmGate(k,{approve:!1}),l({runId:k,action:"reject"}),a(k),n(k)},[a,l,n]),x=J.useMemo(()=>{const k=[];for(const L of f){const A=L.session.id,I=pg(L),B=(s[A]??[]).slice(-30);for(const D of B){if(D.type==="awaitingHuman"||!Vk.has(D.type))continue;let M;if(D.type==="stepFailed"&&typeof D.detail=="string")M=D.detail;else if(D.type==="sessionFailed"&&typeof D.message=="string")M=D.message;else if(D.type==="workflowSelected"&&typeof D.workflowId=="string")M=`workflow: ${D.workflowId}`;else if(D.type==="acpFallback"){const U=typeof D.reason=="string"?D.reason:"";M=[typeof D.cliKey=="string"?D.cliKey:"",U].filter(Boolean).join(" — ")}else D.type==="crashRecoveryRedrive"&&typeof D.attempt=="number"&&(M=`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}:{},...M!==void 0?{detail:M}:{}})}}return k.reverse(),k},[s,f]),b=J.useMemo(()=>Object.values(o).sort((k,L)=>L.receivedAt-k.receivedAt),[o]),S=J.useMemo(()=>g.filter(k=>!k.session.workflow_id||k.session.workflow_id==="chat").slice().reverse(),[g]),T=J.useMemo(()=>g.filter(k=>!!k.session.workflow_id&&k.session.workflow_id!=="chat"),[g]),N=J.useMemo(()=>T.filter(k=>Wu.has(k.session.status)),[T]),E=J.useMemo(()=>g.filter(k=>k.session.status==="completed").slice(-5).reverse(),[g]);return w.jsxs("div",{style:{color:"#e6edf3",..._t},children:[w.jsx("style",{children:`
|
|
41
|
-
@keyframes pulse {
|
|
42
|
-
0%, 100% { opacity: 1; }
|
|
43
|
-
50% { opacity: 0.4; }
|
|
44
|
-
}
|
|
45
|
-
`}),w.jsxs("div",{style:{maxWidth:"1100px",margin:"0 auto",padding:"28px 32px"},children:[w.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"24px",gap:"16px",flexWrap:"wrap"},children:[w.jsxs("div",{children:[w.jsx("h1",{style:{fontSize:"20px",fontWeight:600,color:"#e6edf3",margin:0,..._t},children:"wicked-crew studio"}),w.jsx("p",{style:{fontSize:"11px",color:"rgba(230,237,243,0.38)",margin:"4px 0 0",..._t},children:"cross-session control"})]}),w.jsxs("div",{style:{display:"flex",gap:"20px",flexWrap:"wrap",alignItems:"center"},children:[w.jsx(Qg,{value:u,onChange:c}),w.jsx(Vu,{label:"Active sessions",value:String(f.length),color:"#79c0ff"}),w.jsx(Vu,{label:"Units in-flight",value:String(_),color:"#79c0ff"}),w.jsx(Vu,{label:"Cost",value:y.totalCost!==null?Yk(y.totalCost):"—",color:y.totalCost!==null?"#3fb950":"rgba(230,237,243,0.3)"}),w.jsx(Vu,{label:"Tokens",value:y.totalTokens>0?Kk(y.totalTokens):"—",color:y.totalTokens>0?"#e6edf3":"rgba(230,237,243,0.3)"})]})]}),b.length>0&&w.jsxs("div",{style:{marginBottom:"24px"},children:[w.jsx("p",{style:{...Ma,marginBottom:"10px"},children:"Gate inbox"}),w.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?pg(L):k.runId.slice(0,8);return w.jsx(Xk,{runId:k.runId,ord:k.ord,prompt:k.prompt,sessionLbl:A,onApprove:v,onReject:m},`gate-${k.runId}-${k.ord??"x"}`)})})]}),w.jsxs("div",{style:{display:"grid",gridTemplateColumns:"2fr 1fr 1.5fr",gap:"16px",marginBottom:"28px",alignItems:"start"},children:[w.jsxs("div",{style:{...Ms,padding:"16px 20px"},children:[w.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"12px"},children:[w.jsx("p",{style:Ma,children:"Runs"}),w.jsx("button",{type:"button",onClick:()=>i("/runs/new"),style:{background:"#ffda19",color:"#0d1117",border:"none",borderRadius:"6px",padding:"4px 12px",fontSize:"11px",fontWeight:700,..._t,cursor:"pointer",flexShrink:0},children:"Do Work"})]}),T.length===0?w.jsx("p",{style:{fontSize:"11px",color:"rgba(230,237,243,0.3)",..._t,fontStyle:"italic"},children:"No work sessions yet"}):w.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[...N,...T.filter(k=>!Wu.has(k.session.status)).slice(-3).reverse()].slice(0,5).map(k=>w.jsx(Zk,{view:k,onSelect:e},k.session.id))}),T.length>5&&w.jsx("button",{type:"button",onClick:()=>i("/work"),style:{fontSize:"11px",color:"#79c0ff",..._t,background:"none",border:"none",cursor:"pointer",padding:"8px 0 0",display:"block"},children:"view all →"})]}),w.jsxs("div",{style:{...Ms,padding:"16px 20px"},children:[w.jsx("p",{style:{...Ma,marginBottom:"12px"},children:"Campaigns"}),w.jsxs("div",{"data-testid":"campaign-dag-stub",style:{border:"1px dashed rgba(230,237,243,0.15)",borderRadius:"8px",padding:"12px",background:"#161c26"},children:[w.jsx("p",{style:{fontSize:"11px",fontWeight:600,color:"rgba(230,237,243,0.55)",..._t,margin:"0 0 4px"},children:"Campaign DAG"}),w.jsx("p",{style:{fontSize:"10px",color:"rgba(230,237,243,0.35)",..._t,margin:0,lineHeight:1.5},children:"Pending core's Campaign primitive + RunFinished events (§4.3)."})]})]}),w.jsxs("div",{style:{...Ms,padding:"16px 20px"},children:[w.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"12px"},children:[w.jsx("p",{style:Ma,children:"Chats"}),w.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,..._t,cursor:"pointer",flexShrink:0},children:"New Chat"})]}),S.length===0?w.jsx("p",{style:{fontSize:"11px",color:"rgba(230,237,243,0.3)",..._t,fontStyle:"italic"},children:"No chats yet"}):w.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:S.slice(0,4).map(k=>w.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:[w.jsx("span",{style:{width:"7px",height:"7px",borderRadius:"50%",flexShrink:0,background:Wu.has(k.session.status)?"#79c0ff":k.session.status==="completed"?"#3fb950":"rgba(230,237,243,0.25)"}}),w.jsx("span",{style:{fontSize:"11px",color:"#e6edf3",..._t,flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:dl(k.session.problem||k.session.id,28)})]},k.session.id))}),S.length>4&&w.jsx("button",{type:"button",onClick:()=>i("/chats"),style:{fontSize:"11px",color:"#79c0ff",..._t,background:"none",border:"none",cursor:"pointer",padding:"8px 0 0",display:"block"},children:"view all →"})]})]}),b.length===0&&f.length>0&&w.jsxs("div",{style:{marginBottom:"28px"},children:[w.jsx("p",{style:{...Ma,marginBottom:"10px"},children:"Agent activity"}),w.jsxs("div",{style:{...Ms,padding:"14px",maxHeight:"220px",overflowY:"auto",display:"flex",flexDirection:"column",gap:"8px"},children:[x.slice(0,5).map(k=>w.jsx(Qk,{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)),x.length===0&&w.jsx("p",{style:{fontSize:"12px",color:"rgba(230,237,243,0.28)",..._t,textAlign:"center",padding:"12px 0"},children:"Waiting for events…"})]})]}),E.length>0&&w.jsxs("div",{style:{marginBottom:"28px"},children:[w.jsx("p",{style:{...Ma,marginBottom:"10px"},children:"Sessions review"}),w.jsx("div",{style:{...Ms,padding:"4px 0",display:"flex",flexDirection:"column"},children:E.map((k,L)=>w.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:[w.jsx("span",{style:{width:"7px",height:"7px",borderRadius:"50%",flexShrink:0,background:"#3fb950"}}),w.jsx("span",{style:{fontSize:"12px",color:"#e6edf3",..._t,flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:dl(k.session.problem||k.session.id,60)}),w.jsx("span",{style:{fontSize:"10px",color:"rgba(230,237,243,0.3)",..._t,flexShrink:0},children:k.session.id.slice(0,8)}),w.jsx("span",{style:{fontSize:"10px",color:"rgba(121,192,255,0.5)",..._t,flexShrink:0},children:"→"})]},k.session.id))})]}),w.jsx(Jk,{activeRuns:f})]})]})}function Vu({label:t,value:e,color:r}){return w.jsxs("div",{style:{textAlign:"right"},children:[w.jsx("p",{style:{fontSize:"10px",color:"rgba(230,237,243,0.38)",..._t,margin:0},children:t}),w.jsx("p",{style:{fontSize:"16px",fontWeight:600,color:r,..._t,margin:"2px 0 0"},children:e})]})}const tE=t=>["completed","failed","cancelled"].includes(t);function rE({runs:t,onSelect:e,navigate:r}){const[n,i]=J.useState(""),{range:s,setRange:o,filter:a}=Xg("30d"),l=J.useMemo(()=>t.filter(f=>!f.session.workflow_id||f.session.workflow_id==="chat"),[t]),u=J.useMemo(()=>a(l),[l,a]),c=J.useMemo(()=>u.filter(f=>!tE(f.session.status)),[u]),d=J.useMemo(()=>{if(u.length===0)return"—";const y=u.reduce((_,v)=>_+v.units.length,0)/u.length;return y%1===0?String(y):y.toFixed(1)},[u]),g=J.useMemo(()=>n?u.filter(f=>f.session.problem.toLowerCase().includes(n.toLowerCase())):u,[u,n]);return w.jsxs("div",{className:"flex flex-col gap-6",style:{color:"#e6edf3"},children:[w.jsxs("div",{className:"px-8 pt-8 pb-4 flex items-center justify-between gap-4",children:[w.jsx("h1",{className:"text-2xl font-semibold font-mono",children:"Chats"}),w.jsxs("div",{className:"flex items-center gap-3",children:[w.jsx(Qg,{value:s,onChange:o}),w.jsx("input",{type:"text",placeholder:"Search chats…",value:n,onChange:f=>i(f.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"}}),w.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"})]})]}),w.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:d,accent:"#a78bfa"}].map(f=>w.jsxs("div",{className:"rounded-2xl px-6 py-4",style:{background:"#1b222e",border:"1px solid rgba(230,237,243,0.07)"},children:[w.jsx("p",{className:"text-xs font-mono uppercase tracking-widest",style:{color:"rgba(230,237,243,0.4)"},children:f.label}),w.jsx("p",{className:"text-3xl font-semibold mt-1",style:{color:f.accent??"#e6edf3"},children:f.value})]},f.label))}),w.jsx("div",{className:"px-8 pb-8 flex flex-col gap-2",children:g.length===0?w.jsxs("div",{className:"rounded-2xl p-10 text-center",style:{background:"#1b222e",border:"1px solid rgba(230,237,243,0.07)"},children:[w.jsx("p",{className:"text-base font-mono font-semibold mb-3",children:"No chat sessions yet"}),w.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."}),w.jsx("p",{className:"mt-5",children:w.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"})})]}):g.map(f=>w.jsxs("button",{type:"button",onClick:()=>e(f.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:[w.jsx("p",{className:"text-sm font-mono truncate",children:f.session.problem}),w.jsxs("p",{className:"text-xs mt-1 font-mono",style:{color:"rgba(230,237,243,0.35)"},children:[f.session.id.slice(0,8)," · ",f.session.status]})]},f.session.id))})]})}function Zg(t){return`${(t*100).toFixed(1)}%`}function Jg(t){return t.behavior_bearing===0?"—":t.unaccounted>0&&t.coverage*100>=99.95?"<100%":Zg(t.coverage)}function A0(t,e){return e===0?"—":Zg(t)}function nE(t){return t.behavior_bearing===0?"no-data":t.unaccounted===0?"pass":"deny"}function iE({report:t}){const e=nE(t),r={pass:{bg:"rgba(63,185,80,0.12)",fg:"#3fb950",bd:"rgba(63,185,80,0.3)",label:"GATE PASS"},deny:{bg:"rgba(248,81,73,0.12)",fg:"#f85149",bd:"rgba(248,81,73,0.3)",label:"GATE FAIL"},"no-data":{bg:"rgba(230,237,243,0.08)",fg:"rgba(230,237,243,0.6)",bd:"rgba(230,237,243,0.2)",label:"NOT EXTRACTED"}}[e];return w.jsx("span",{className:"inline-flex items-center gap-1 rounded px-2 py-0.5 text-xs font-semibold font-mono",style:{background:r.bg,color:r.fg,border:`1px solid ${r.bd}`},title:e==="no-data"?"No behavior-bearing nodes: nothing has been annotated, so coverage is undefined rather than complete.":`Gate rule: behavior_bearing >= 1 and unaccounted == 0 (currently ${t.behavior_bearing} and ${t.unaccounted}).`,children:r.label})}function aE({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:Jg(t)},{label:"Resolved rate",value:A0(t.resolved_rate,t.resolved+t.risk_flagged)},{label:"Mean confidence",value:A0(t.mean_confidence,t.resolved)},{label:"Threshold",value:Zg(t.resolve_threshold)}];return w.jsx("div",{className:"grid grid-cols-3 gap-2 sm:grid-cols-5",children:e.map(({label:r,value:n})=>w.jsxs("div",{className:"rounded p-2 text-center",style:{border:"1px solid rgba(230,237,243,0.07)",background:"#1b222e"},children:[w.jsx("p",{className:"text-[11px]",style:{color:"rgba(230,237,243,0.4)"},children:r}),w.jsx("p",{className:"text-sm font-semibold",style:{color:"#e6edf3"},children:n})]},r))})}function sE({apps:t}){return t.length===0?w.jsx("p",{className:"text-xs",style:{color:"rgba(230,237,243,0.4)"},children:"No per-app data."}):w.jsxs("table",{className:"w-full text-[11px]",children:[w.jsx("thead",{children:w.jsxs("tr",{className:"border-b text-left",style:{borderColor:"rgba(230,237,243,0.08)",color:"rgba(230,237,243,0.4)"},children:[w.jsx("th",{className:"py-1 pr-3 font-medium",children:"App"}),w.jsx("th",{className:"py-1 pr-3 font-medium text-right",children:"Behavior-bearing"}),w.jsx("th",{className:"py-1 pr-3 font-medium text-right",children:"Resolved"}),w.jsx("th",{className:"py-1 pr-3 font-medium text-right",children:"Risk"}),w.jsx("th",{className:"py-1 pr-3 font-medium text-right",children:"Unaccounted"}),w.jsx("th",{className:"py-1 font-medium text-right",children:"Coverage"})]})}),w.jsx("tbody",{children:t.map(e=>w.jsxs("tr",{className:"border-b",style:{borderColor:"rgba(230,237,243,0.06)"},children:[w.jsx("td",{className:"py-1 pr-3 font-mono",style:{color:"rgba(230,237,243,0.7)"},children:e.app}),w.jsx("td",{className:"py-1 pr-3 text-right",style:{color:"rgba(230,237,243,0.6)"},children:e.behavior_bearing}),w.jsx("td",{className:"py-1 pr-3 text-right",style:{color:"#3fb950"},children:e.resolved}),w.jsx("td",{className:"py-1 pr-3 text-right",style:{color:"#ffda19"},children:e.risk_flagged}),w.jsx("td",{className:"py-1 pr-3 text-right",style:{color:"#f85149"},children:e.unaccounted}),w.jsx("td",{className:"py-1 text-right font-semibold",style:{color:"#e6edf3"},children:Jg(e)})]},e.app))})]})}function Gu({col:t,active:e,dir:r,onSort:n,children:i}){return w.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 oE({nodes:t}){const[e,r]=J.useState(""),[n,i]=J.useState("file"),[s,o]=J.useState("asc"),[a,l]=J.useState(""),[u,c]=J.useState(""),d=J.useMemo(()=>[...new Set(t.map(v=>v.kind??"").filter(Boolean))].sort(),[t]),g=J.useMemo(()=>[...new Set(t.map(v=>v.app??"").filter(Boolean))].sort(),[t]),f=J.useCallback(v=>{v===n?o(m=>m==="asc"?"desc":"asc"):(i(v),o("asc"))},[n]),y=J.useMemo(()=>{let v=t;if(e){const m=e.toLowerCase();v=v.filter(x=>(x.name??"").toLowerCase().includes(m)||(x.file??"").toLowerCase().includes(m)||(x.symbol_id??"").toLowerCase().includes(m))}return a&&(v=v.filter(m=>m.kind===a)),u&&(v=v.filter(m=>m.app===u)),[...v].sort((m,x)=>{const b=n==="name"?m.name??m.symbol_id:m[n]??"",S=n==="name"?x.name??x.symbol_id:x[n]??"";return s==="asc"?b.localeCompare(S):S.localeCompare(b)})},[t,e,a,u,n,s]),_={background:"#161c26",border:"1px solid rgba(230,237,243,0.1)",color:"#e6edf3"};return t.length===0?w.jsx("p",{className:"text-xs",style:{color:"#3fb950"},children:"No unaccounted nodes — gate is satisfied."}):w.jsxs("div",{className:"flex flex-col gap-2",children:[w.jsxs("div",{className:"flex flex-wrap gap-2",children:[w.jsx("input",{type:"text","aria-label":"Search by name, file, or symbol id",placeholder:"Search name / file / id…",value:e,onChange:v=>r(v.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:v=>l(v.target.value),className:"rounded px-2 py-1 text-[11px] focus:outline-none",style:_,children:[w.jsx("option",{value:"",children:"All kinds"}),d.map(v=>w.jsx("option",{value:v,children:v},v))]}),w.jsxs("select",{"aria-label":"Filter by app",value:u,onChange:v=>c(v.target.value),className:"rounded px-2 py-1 text-[11px] focus:outline-none",style:_,children:[w.jsx("option",{value:"",children:"All apps"}),g.map(v=>w.jsx("option",{value:v,children:v},v))]}),w.jsxs("span",{className:"ml-auto text-[11px]",style:{color:"rgba(230,237,243,0.4)"},children:[y.length," / ",t.length," hole",t.length!==1?"s":""]})]}),w.jsxs("table",{className:"w-full text-[11px]",children:[w.jsx("thead",{children:w.jsxs("tr",{className:"border-b",style:{borderColor:"rgba(230,237,243,0.08)"},children:[w.jsx("th",{className:"py-1 pr-3",children:w.jsx(Gu,{col:"name",active:n,dir:s,onSort:f,children:"Name"})}),w.jsx("th",{className:"py-1 pr-3",children:w.jsx(Gu,{col:"kind",active:n,dir:s,onSort:f,children:"Kind"})}),w.jsx("th",{className:"py-1 pr-3",children:w.jsx(Gu,{col:"app",active:n,dir:s,onSort:f,children:"App"})}),w.jsx("th",{className:"py-1",children:w.jsx(Gu,{col:"file",active:n,dir:s,onSort:f,children:"File"})})]})}),w.jsx("tbody",{children:y.map(v=>w.jsxs("tr",{className:"border-b",style:{borderColor:"rgba(230,237,243,0.06)"},children:[w.jsx("td",{className:"py-1 pr-3 font-mono",style:{color:"rgba(230,237,243,0.7)"},children:v.name??v.symbol_id}),w.jsx("td",{className:"py-1 pr-3",style:{color:"rgba(230,237,243,0.45)"},children:v.kind??"—"}),w.jsx("td",{className:"py-1 pr-3",style:{color:"rgba(230,237,243,0.45)"},children:v.app??"—"}),w.jsx("td",{className:"py-1",style:{color:"rgba(230,237,243,0.35)"},title:v.file,children:w.jsx("div",{className:"truncate max-w-xs",children:v.file??"—"})})]},v.symbol_id))})]})]})}function Tw(){const[t,e]=J.useState(null),[r,n]=J.useState(!0),[i,s]=J.useState(null),[o,a]=J.useState([]),[l,u]=J.useState(""),[c,d]=J.useState(null),g=J.useCallback(async()=>{n(!0),s(null);try{if(l){const[{report:f},{kinds:y}]=await Promise.all([Ve.getCoverageReportForRepo(l),Ve.getGraphKindsForRepo(l)]);e(f),d(y)}else{const{report:f}=await Ve.getCoverageReport();e(f),d(null)}}catch(f){s(f instanceof Error?f.message:String(f))}finally{n(!1)}},[l]);return J.useEffect(()=>{Ve.listRepos().then(({repos:f})=>a(f)).catch(()=>a([]))},[]),J.useEffect(()=>{g()},[g]),w.jsxs("div",{className:"flex flex-col gap-4",children:[w.jsxs("div",{className:"flex items-center justify-between",children:[w.jsx("h2",{className:"text-sm font-semibold",style:{color:"#e6edf3"},children:"Coverage gate"}),w.jsxs("div",{className:"flex items-center gap-2",children:[w.jsxs("select",{"aria-label":"Coverage repo",value:l,onChange:f=>u(f.target.value),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)",background:"transparent"},children:[w.jsx("option",{value:"",children:"All (daemon)"}),o.map(f=>w.jsx("option",{value:f.id,children:f.name},f.id))]}),w.jsx("button",{type:"button",onClick:()=>void g(),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&&w.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&&w.jsxs("p",{className:"text-xs",style:{color:"rgba(230,237,243,0.4)"},children:["No coverage data — run"," ",w.jsx("code",{className:"font-mono",style:{color:"rgba(230,237,243,0.6)"},children:"wicked-core rules ingest"})," ","to populate."]}),c&&w.jsxs("section",{className:"flex flex-col gap-1","aria-label":"Code graph summary",children:[w.jsxs("p",{className:"text-[11px] font-semibold uppercase tracking-wider font-mono",style:{color:"rgba(230,237,243,0.4)"},children:["Code graph (",c.reduce((f,y)=>f+y.count,0)," nodes)"]}),c.length===0?w.jsx("p",{className:"text-xs",style:{color:"rgba(230,237,243,0.4)"},children:"This repo’s graph holds no nodes yet — onboard the repo to populate it."}):w.jsx("table",{className:"text-xs",style:{color:"rgba(230,237,243,0.7)"},children:w.jsx("tbody",{children:c.map(f=>w.jsxs("tr",{children:[w.jsx("td",{className:"pr-4 font-mono",children:f.kind}),w.jsx("td",{className:"text-right tabular-nums",children:f.count})]},f.kind))})})]}),t&&w.jsxs(w.Fragment,{children:[w.jsxs("div",{className:"flex items-center gap-3",children:[w.jsx("span",{className:"text-2xl font-bold",style:{color:"#e6edf3"},children:Jg(t)}),w.jsx(iE,{report:t})]}),w.jsx(aE,{report:t}),t.per_app.length>0&&w.jsxs("section",{className:"flex flex-col gap-1",children:[w.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-wider font-mono",style:{color:"rgba(230,237,243,0.4)"},children:"Per-app"}),w.jsx(sE,{apps:t.per_app})]}),w.jsxs("section",{className:"flex flex-col gap-2",children:[w.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,")"]}),w.jsx(oE,{nodes:t.unaccounted_nodes})]})]})]})}function lE(t){if(!t)return null;const r={active:"#3fb950",proposed:"#ffda19",deprecated:"#f85149"}[t]??"rgba(230,237,243,0.5)";return w.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 uE({id:t,req:e}){var i,s,o,a,l;const[r,n]=J.useState(!1);return w.jsxs("div",{className:"rounded",style:{border:"1px solid rgba(230,237,243,0.07)"},children:[w.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:[w.jsx("span",{className:"mt-0.5 shrink-0 text-[10px]",style:{color:"rgba(230,237,243,0.25)"},children:r?"▾":"▸"}),w.jsxs("div",{className:"flex-1 min-w-0",children:[w.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[w.jsx("span",{className:"font-mono text-[10px]",style:{color:"rgba(230,237,243,0.35)"},children:t}),w.jsx("span",{className:"text-[11px] font-medium truncate",style:{color:"#e6edf3"},children:e.title}),lE(e.status),e.disposition&&w.jsx("span",{className:"text-[10px] italic",style:{color:"rgba(230,237,243,0.4)"},children:e.disposition})]}),!r&&e.description&&w.jsx("p",{className:"text-[10px] truncate mt-0.5",style:{color:"rgba(230,237,243,0.4)"},children:e.description})]}),w.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&&w.jsxs("div",{className:"px-4 pb-3 flex flex-col gap-2 text-[10px]",style:{background:"#0f1419"},children:[e.description&&w.jsx("p",{style:{color:"rgba(230,237,243,0.55)"},children:e.description}),(((o=e.business_rules)==null?void 0:o.length)??0)>0&&w.jsxs("div",{children:[w.jsx("p",{className:"font-semibold uppercase tracking-wider mb-1 font-mono",style:{color:"rgba(230,237,243,0.35)"},children:"Business rules"}),w.jsx("ul",{className:"flex flex-col gap-0.5",children:(e.business_rules??[]).map(u=>w.jsxs("li",{className:"flex items-start gap-1.5",children:[w.jsx("span",{className:"font-mono shrink-0",style:{color:"rgba(230,237,243,0.25)"},children:u.id}),w.jsx("span",{style:{color:"rgba(230,237,243,0.65)"},children:u.statement}),w.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&&w.jsxs("div",{children:[w.jsx("p",{className:"font-semibold uppercase tracking-wider mb-1 font-mono",style:{color:"rgba(230,237,243,0.35)"},children:"Validations"}),w.jsx("ul",{className:"flex flex-col gap-0.5",children:(e.validations??[]).map(u=>w.jsxs("li",{className:"flex items-start gap-1.5",children:[w.jsx("span",{className:"font-mono shrink-0",style:{color:"rgba(230,237,243,0.25)"},children:u.id}),w.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&&w.jsxs("div",{children:[w.jsx("p",{className:"font-semibold uppercase tracking-wider mb-1 font-mono",style:{color:"rgba(248,81,73,0.6)"},children:"Error paths"}),w.jsx("ul",{className:"flex flex-col gap-0.5",children:(e.error_paths??[]).map(u=>w.jsxs("li",{className:"flex items-start gap-1.5",children:[w.jsx("span",{className:"font-mono shrink-0",style:{color:"rgba(230,237,243,0.25)"},children:u.id}),w.jsx("span",{style:{color:"#f85149"},children:u.statement})]},u.id))})]})]})]})}function cE({name:t,domain:e}){const[r,n]=J.useState(!0),i=Object.keys(e.requirements??{}),s=Object.keys(e.entities??{});return w.jsxs("div",{className:"rounded-lg overflow-hidden",style:{border:"1px solid rgba(230,237,243,0.08)"},children:[w.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:[w.jsx("span",{className:"text-[10px]",style:{color:"rgba(230,237,243,0.35)"},children:r?"▾":"▸"}),w.jsx("span",{className:"font-semibold text-[12px]",style:{color:"#e6edf3"},children:t}),w.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&&w.jsxs("span",{className:"ml-auto text-[10px] font-mono",style:{color:"rgba(230,237,243,0.25)"},children:["cluster ",e.cluster_id]})]}),r&&w.jsxs("div",{className:"p-3 flex flex-col gap-2",style:{background:"#161c26"},children:[e.description&&w.jsx("p",{className:"text-[10px] italic",style:{color:"rgba(230,237,243,0.4)"},children:e.description}),i.length>0&&w.jsx("div",{className:"flex flex-col gap-1",children:i.map(o=>w.jsx(uE,{id:o,req:e.requirements[o]},o))}),s.length>0&&w.jsxs("div",{children:[w.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider mb-1 font-mono",style:{color:"rgba(230,237,243,0.35)"},children:"Entities"}),w.jsx("div",{className:"flex flex-wrap gap-1",children:s.map(o=>{var a;return w.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 dE(){const[t,e]=J.useState(null),[r,n]=J.useState(!0),[i,s]=J.useState(null),[o,a]=J.useState(""),l=J.useCallback(async()=>{n(!0),s(null);try{const{graph:d}=await Ve.getDomainGraph();e(d)}catch(d){s(d instanceof Error?d.message:String(d))}finally{n(!1)}},[]);if(J.useEffect(()=>{l()},[l]),r)return w.jsx("p",{className:"text-xs",style:{color:"rgba(230,237,243,0.4)"},children:"Loading domain model…"});if(i)return w.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 w.jsxs("div",{className:"flex flex-col gap-2",children:[w.jsx("p",{className:"text-sm",style:{color:"rgba(230,237,243,0.5)"},children:"No domain model found."}),w.jsxs("p",{className:"text-[10px]",style:{color:"rgba(230,237,243,0.4)"},children:["Run"," ",w.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"," ",w.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(d=>{var f;if(!u)return!0;const g=t.domains[d];return d.toLowerCase().includes(u)||(f=g.description)!=null&&f.toLowerCase().includes(u)?!0:Object.entries(g.requirements??{}).some(([y,_])=>{var v,m;return y.toLowerCase().includes(u)||((v=_.title)==null?void 0:v.toLowerCase().includes(u))||((m=_.description)==null?void 0:m.toLowerCase().includes(u))})});return w.jsxs("div",{className:"flex flex-col gap-4",children:[w.jsxs("div",{className:"flex items-center gap-3",children:[w.jsx("h2",{className:"text-sm font-semibold",style:{color:"#e6edf3"},children:"Domain Model"}),w.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"]}),w.jsx("input",{"aria-label":"Search domains and requirements",type:"search",placeholder:"Search…",value:o,onChange:d=>a(d.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"}}),w.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?w.jsx("p",{className:"text-xs",style:{color:"rgba(230,237,243,0.4)"},children:"No domains match your search."}):w.jsx("div",{className:"flex flex-col gap-3",children:c.map(d=>w.jsx(cE,{name:d,domain:t.domains[d]},d))}),t.metadata.source&&w.jsxs("p",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.25)"},children:["Source: ",w.jsx("span",{children:t.metadata.source})]})]})}function hE({onSelect:t,runId:e}){const r=ti(s=>s.gates),n=Object.values(r),i=e?n.filter(s=>s.runId===e):n;return i.length===0?w.jsx(w.Fragment,{}):w.jsx("div",{className:"fixed bottom-4 right-4 flex flex-col gap-2 z-50","data-testid":"gate-notification",style:{pointerEvents:"none"},children:i.map(s=>w.jsxs("button",{type:"button",onClick:()=>t(s.runId),"data-testid":"gate-toast","data-run-id":s.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)",pointerEvents:"auto"},onMouseEnter:o=>{o.currentTarget.style.borderColor="rgba(255,218,25,0.55)"},onMouseLeave:o=>{o.currentTarget.style.borderColor="rgba(255,218,25,0.35)"},children:[w.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[w.jsx("span",{className:"w-1.5 h-1.5 rounded-full animate-pulse",style:{background:"#ffda19"}}),w.jsx("p",{className:"text-xs font-semibold",style:{color:"#ffda19"},children:"Run awaiting human"})]}),w.jsxs("p",{className:"text-[11px] font-mono",style:{color:"rgba(230,237,243,0.4)"},children:[s.runId.slice(0,8)," · before unit #",s.ord]}),s.prompt&&w.jsx("p",{className:"mt-1 text-xs line-clamp-2",style:{color:"rgba(230,237,243,0.6)"},children:s.prompt}),w.jsx("p",{className:"mt-1.5 text-[11px] font-mono",style:{color:"#79c0ff"},children:"Review →"})]},s.runId))})}const ev=oa(t=>({status:"connecting",setStatus:e=>t({status:e})})),of=10;function lf(){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 gc=oa(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:lf(),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,of)};case"sessionFailed":return{notifications:[{id:lf(),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,of)};case"agentMessage":return{notifications:[{id:lf(),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,of)};default:return n}})}})),vn={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 P0(t){switch(t){case"gate":return vn.accent;case"run_failed":return vn.danger;case"steer_requested":return vn.link;default:return vn.muted}}function pE(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 gE(){return w.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0,children:w.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 vE({navigate:t,collapsed:e=!1}){const r=gc(c=>c.notifications),n=gc(c=>c.markRead),i=gc(c=>c.markAllRead),[s,o]=J.useState(!1),a=J.useRef(null),l=r.filter(c=>!c.read).length;J.useEffect(()=>{if(!s)return;function c(d){a.current&&!a.current.contains(d.target)&&o(!1)}return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[s]);function u(c,d){n(c),o(!1),t(`/runs/${encodeURIComponent(d)}`)}return w.jsxs("div",{ref:a,style:{position:"relative"},children:[w.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?vn.accent:vn.faint,background:"transparent",padding:e?0:"0 6px 0 4px"},children:[w.jsx(gE,{}),!e&&w.jsx("span",{style:{fontSize:"11px",fontFamily:"monospace",color:vn.faint},children:"Notifications"}),l>0&&w.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:vn.accent,color:vn.accentInk},children:l>9?"9+":l})]}),s&&w.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:[w.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"10px 14px 8px",borderBottom:"1px solid rgba(230,237,243,0.08)"},children:[w.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&&w.jsx("button",{type:"button",onClick:i,style:{background:"transparent",border:"none",cursor:"pointer",fontSize:"10px",fontFamily:"monospace",color:vn.link,padding:0},children:"Mark all read"})]}),r.length===0?w.jsx("p",{style:{padding:"16px 14px",fontSize:"11px",fontFamily:"monospace",color:vn.faint,margin:0},children:"No notifications"}):w.jsx("ul",{style:{listStyle:"none",margin:0,padding:0},children:r.map(c=>w.jsx("li",{children:w.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:d=>{d.currentTarget.style.background=vn.hover},onMouseLeave:d=>{d.currentTarget.style.background=c.read?"transparent":"rgba(255,218,25,0.04)"},children:[w.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"3px"},children:[w.jsxs("span",{style:{fontSize:"10px",fontWeight:600,fontFamily:"monospace",color:P0(c.kind),display:"flex",alignItems:"center",gap:"4px"},children:[!c.read&&w.jsx("span",{style:{width:"5px",height:"5px",borderRadius:"50%",background:P0(c.kind),display:"inline-block",flexShrink:0}}),fE(c.kind)]}),w.jsx("span",{style:{fontSize:"9px",fontFamily:"monospace",color:"rgba(230,237,243,0.3)",whiteSpace:"nowrap",marginLeft:"8px"},children:pE(c.ts)})]}),w.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}),w.jsxs("span",{style:{fontSize:"10px",fontFamily:"monospace",color:vn.link},children:[c.runId.slice(0,8)," → Review"]})]})},c.id))})]})]})}function mE(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 M0=35;function mi({view:t,selectedRunId:e,onSelect:r}){const{session:n,units:i}=t,s=e===n.id,o=n.problem.length>M0?n.problem.slice(0,M0)+"…":n.problem,a=i.length,l=n.status==="awaiting_human"||n.status==="executing"||n.status==="distributing"||n.status==="planning";return w.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:[w.jsxs("div",{className:"flex items-center gap-2",children:[w.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}),w.jsx("span",{className:`w-2 h-2 rounded-full shrink-0 ${l?"animate-pulse":""}`,style:{background:mE(n.status)}})]}),w.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 yE=[{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 xE({onNavigate:t,onClose:e}){const r=J.useRef(null);return J.useEffect(()=>{function n(i){r.current&&!r.current.contains(i.target)&&e()}return document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[e]),w.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:yE.map(n=>w.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 bE({size:t=28,className:e=""}){return w.jsxs("svg",{width:t,height:t,viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:e,children:[w.jsx("rect",{width:"32",height:"32",rx:"7",fill:"#ffda19"}),w.jsx("path",{d:"M6 10L10.5 24L16 13L21.5 24L26 10",stroke:"#0d1117",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round"})]})}const fr={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"},_s=4;function wE(){return w.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0,children:w.jsx("path",{d:"M13 2 3 14h9l-1 8 10-12h-9l1-8z"})})}function _E(){return w.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0,children:w.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 SE(){return w.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0,children:w.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 CE(){return w.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5","aria-hidden":!0,children:[w.jsx("circle",{cx:"10",cy:"10",r:"7"}),w.jsx("line",{x1:"15.5",y1:"15.5",x2:"21",y2:"21"})]})}function uf({icon:t,label:e,testId:r,onClick:n,collapsed:i}){return w.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:fr.accent,background:"transparent"},children:[t,!i&&w.jsx("span",{children:e})]})}function qu({label:t,asLink:e,onClick:r,withSearch:n,searchActive:i,onToggleSearch:s}){const o=w.jsxs("span",{className:"text-[10px] font-semibold uppercase tracking-widest font-mono select-none",style:{color:e?fr.link:fr.muted},children:[t,e&&w.jsx("span",{className:"ml-1 opacity-70",children:"›"})]});return w.jsxs("div",{className:"flex items-center px-3 pt-3 pb-1",children:[e&&r?w.jsx("button",{type:"button",onClick:r,className:"transition-opacity hover:opacity-80",style:{background:"transparent"},children:o}):o,n&&w.jsx("button",{type:"button",onClick:s,"aria-label":"Search",className:"ml-auto transition-opacity hover:opacity-100",style:{color:i?fr.accent:fr.faint},children:w.jsx(CE,{})})]})}function kE(){const t=ev(c=>c.status),[e,r]=J.useState(!1),[n,i]=J.useState(null),[s,o]=J.useState(!1),a=J.useRef(null);J.useEffect(()=>{e&&(i(null),o(!1),Ve.getHealth().then(c=>i(c)).catch(()=>o(!0)))},[e]),J.useEffect(()=>{if(!e)return;function c(d){a.current&&!a.current.contains(d.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 w.jsxs("div",{ref:a,style:{position:"relative"},children:[w.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:[w.jsx("span",{style:{width:"7px",height:"7px",borderRadius:"50%",background:l,flexShrink:0,boxShadow:t==="connected"?`0 0 5px ${l}`:"none"}}),w.jsx("span",{style:{fontSize:"10px",fontFamily:"monospace",color:l,whiteSpace:"nowrap"},children:u}),w.jsx("span",{style:{fontSize:"9px",color:"rgba(230,237,243,0.35)",marginLeft:"1px"},children:"▾"})]}),e&&w.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:[w.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"}),w.jsx(zo,{label:"WebSocket",ok:t==="connected",detail:u}),s?w.jsx(zo,{label:"API server",ok:!1,detail:"unreachable"}):n?w.jsxs(w.Fragment,{children:[w.jsx(zo,{label:"API server",ok:n.status==="ok",detail:n.status}),w.jsx(zo,{label:"wicked-core",ok:!0,detail:n.version})]}):w.jsx(zo,{label:"API server",ok:null,detail:"checking…"})]})]})}function zo({label:t,ok:e,detail:r}){const n=e===null?"·":e?"✓":"✗",i=e===null?"rgba(230,237,243,0.3)":e?"#3fb950":"#f85149";return w.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"5px"},children:[w.jsx("span",{style:{width:"12px",fontSize:"11px",color:i,fontFamily:"monospace",flexShrink:0},children:n}),w.jsx("span",{style:{fontSize:"11px",color:"#e6edf3",fontFamily:"monospace",flex:1},children:t}),w.jsx("span",{style:{fontSize:"10px",color:"rgba(230,237,243,0.45)",fontFamily:"monospace"},children:r})]})}function EE({runs:t,selectedRunId:e,onSelectRun:r,navigate:n}){const[i,s]=J.useState(!1),[o,a]=J.useState(!1),[l,u]=J.useState(!1),[c,d]=J.useState(!1),[g,f]=J.useState(""),[y,_]=J.useState([]),v=!i||o;J.useEffect(()=>{let E=!1,k=!1;function L(){k||(k=!0,Ve.listRepos().then(({repos:I})=>{if(E)return;const O=[...I].sort((B,D)=>D.registered_at-B.registered_at);_(O)}).catch(()=>{}).finally(()=>{k=!1}))}L();const A=setInterval(L,5e3);return()=>{E=!0,clearInterval(A)}},[]);const m=[],x=[];for(const E of t)!E.session.workflow_id||E.session.workflow_id==="chat"?m.push(E):x.push(E);const b=g.trim().toLowerCase(),S=b?y.filter(E=>E.name.toLowerCase().includes(b)):y,T=b?m.filter(E=>E.session.problem.toLowerCase().includes(b)):m,N=b?x.filter(E=>E.session.problem.toLowerCase().includes(b)):x;return w.jsxs("div",{className:`flex flex-col shrink-0 transition-all duration-200 ${v?"w-[280px]":"w-14"}`,style:{background:fr.bg,borderRight:`1px solid ${fr.border}`},onMouseEnter:()=>{i&&a(!0)},onMouseLeave:()=>a(!1),children:[w.jsxs("div",{className:"flex items-center gap-2 px-4 pt-5 pb-3 shrink-0",children:[w.jsx("button",{type:"button",onClick:()=>n("/"),className:"shrink-0","aria-label":"Home",children:w.jsx(bE,{size:26})}),v&&w.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:fr.ink,background:"transparent"},children:"wicked-crew studio"}),w.jsx("button",{type:"button",onClick:()=>s(E=>!E),"aria-label":i?"Expand sidebar":"Collapse sidebar",className:`text-xs font-mono shrink-0 leading-none ${v?"ml-auto":""}`,style:{color:fr.faint},children:i?"»":"«"})]}),v&&w.jsx("div",{className:"px-4 pt-1 pb-3",children:w.jsx(kE,{})}),w.jsx("div",{className:v?"px-4 pb-2":"flex justify-center pb-2",children:w.jsx(vE,{navigate:n,collapsed:!v})}),w.jsxs("div",{className:`flex flex-col ${v?"px-5 pt-1 pb-1 gap-1":"px-2 items-center gap-2 mt-1"}`,children:[w.jsx(uf,{icon:w.jsx(wE,{}),label:"Do Work",testId:"new-run",onClick:()=>n("/runs/new"),collapsed:!v}),w.jsx(uf,{icon:w.jsx(_E,{}),label:"New Chat",onClick:()=>n("/chat/new"),collapsed:!v}),w.jsx(uf,{icon:w.jsx(SE,{}),label:"New Repository",onClick:()=>n("/repos/new"),collapsed:!v})]}),w.jsx("div",{className:"flex-1 overflow-y-auto flex flex-col min-h-0 mt-2",children:v?w.jsxs(w.Fragment,{children:[c&&w.jsx("div",{className:"px-4 pb-2",children:w.jsx("input",{type:"text",value:g,onChange:E=>f(E.target.value),placeholder:"Search…",autoFocus:!0,className:"w-full bg-transparent text-xs font-mono outline-none border-b",style:{color:fr.ink,borderColor:fr.faint,caretColor:fr.accent}})}),w.jsx(qu,{label:"Projects",asLink:!0,onClick:()=>n("/projects")}),w.jsx(qu,{label:"Repositories",withSearch:!0,searchActive:c,onToggleSearch:()=>{d(E=>!E),c&&f("")}}),w.jsx(cf,{empty:"No repositories yet",viewAllPath:"/repos",navigate:n,children:S.slice(0,_s).map(E=>w.jsxs("button",{type:"button",onClick:()=>n(`/repo-detail/${encodeURIComponent(E.id)}`),title:E.root_path,className:"w-full text-left px-3 py-2 rounded-md transition-colors",style:{background:"transparent"},onMouseEnter:k=>{k.currentTarget.style.background=fr.hover},onMouseLeave:k=>{k.currentTarget.style.background="transparent"},children:[w.jsx("div",{className:"flex items-center gap-2",children:w.jsx("span",{className:"flex-1 truncate text-xs leading-tight font-mono",style:{color:"rgba(230,237,243,0.7)"},children:E.name})}),w.jsx("p",{className:"text-[10px] mt-0.5 font-mono truncate",style:{color:"rgba(230,237,243,0.3)"},children:E.root_path})]},E.id))}),S.length>_s&&w.jsx(df,{onClick:()=>n("/repos")}),w.jsx(qu,{label:"Chats"}),w.jsx(cf,{empty:"No chats yet",viewAllPath:"/chats",navigate:n,children:T.slice(0,_s).map(E=>w.jsx(mi,{view:E,selectedRunId:e,onSelect:r},E.session.id))}),T.length>_s&&w.jsx(df,{onClick:()=>n("/chats")}),w.jsx(qu,{label:"Work"}),w.jsx(cf,{empty:"No work yet",viewAllPath:"/work",navigate:n,children:N.slice(0,_s).map(E=>w.jsx(mi,{view:E,selectedRunId:e,onSelect:r},E.session.id))}),N.length>_s&&w.jsx(df,{onClick:()=>n("/work")})]}):w.jsx("div",{className:"px-2 flex flex-col gap-0.5 mt-1",children:t.map(E=>w.jsx("button",{type:"button",onClick:()=>r(E.session.id),"aria-label":E.session.problem,title:E.session.problem,className:"w-9 h-9 mx-auto flex items-center justify-center rounded-md transition-colors",style:{background:e===E.session.id?fr.active:"transparent"},onMouseEnter:k=>{e!==E.session.id&&(k.currentTarget.style.background=fr.hover)},onMouseLeave:k=>{e!==E.session.id&&(k.currentTarget.style.background="transparent")},children:w.jsx(TE,{status:E.session.status})},E.session.id))})}),w.jsx("div",{className:`px-2 pb-3 shrink-0 ${v?"":"flex flex-col items-center gap-1"}`,children:w.jsxs("div",{className:"relative",children:[w.jsxs("button",{type:"button",onClick:()=>u(E=>!E),onMouseDown:E=>E.stopPropagation(),"aria-label":"Settings",className:`rounded transition-colors ${v?"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:fr.faint},onMouseEnter:E=>{E.currentTarget.style.background=fr.hover,E.currentTarget.style.color=fr.ink},onMouseLeave:E=>{E.currentTarget.style.background="",E.currentTarget.style.color=fr.faint},children:[w.jsx("span",{children:"⚙"}),v&&w.jsxs(w.Fragment,{children:[w.jsx("span",{children:"Settings"}),w.jsx("span",{className:"ml-auto text-[10px] font-mono",style:{color:"rgba(230,237,243,0.25)"},children:"v0.3.2"})]})]}),l&&w.jsx(xE,{onNavigate:n,onClose:()=>u(!1)})]})})]})}function cf({children:t,empty:e,viewAllPath:r,navigate:n}){const i=Array.isArray(t)?t.filter(Boolean):t?[t]:[];return w.jsx("div",{className:"px-2 flex flex-col gap-0.5",children:i.length===0?w.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:fr.faint},children:e}):i})}function df({onClick:t}){return w.jsx("button",{type:"button",onClick:t,className:"mx-4 mb-1 text-left text-[11px] font-mono transition-opacity hover:opacity-80",style:{color:fr.link},children:"view all"})}function TE({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 w.jsx("span",{className:`w-2.5 h-2.5 rounded-full ${r?"animate-pulse":""}`,style:{background:e}})}const NE={deny:"#f85149",allow_with_conditions:"#ffda19",allow:"#3fb950"},RE={high:"#f85149",medium:"#ffda19",low:"rgba(230,237,243,0.4)"},LE={id:"",kind:"output",applies_to:[],effect:"deny",trigger:{contains:""},obligations:[],criteria:"",severity:"high",rule:""};function DE({policy:t,onEdit:e,onRetire:r}){const[n,i]=J.useState(!1),[s,o]=J.useState(!1),a=t.retired===!0;return w.jsxs("tr",{className:"text-[11px]",style:{borderBottom:"1px solid rgba(230,237,243,0.06)",opacity:a?.45:1},children:[w.jsxs("td",{className:"px-3 py-2 font-mono",style:{color:"rgba(230,237,243,0.7)"},children:[t.id,a&&w.jsx("span",{className:"ml-2 inline-flex rounded px-1.5 py-0.5 text-[9px] font-semibold uppercase tracking-wider",style:{background:"rgba(230,237,243,0.06)",color:"rgba(230,237,243,0.45)"},children:"retired"})]}),w.jsx("td",{className:"px-3 py-2",style:{color:"rgba(230,237,243,0.45)"},children:t.kind}),w.jsx("td",{className:"px-3 py-2",children:w.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:NE[t.effect]??"rgba(230,237,243,0.5)"},children:t.effect})}),w.jsx("td",{className:"px-3 py-2 text-[11px] font-semibold",style:{color:RE[t.severity]??"rgba(230,237,243,0.5)"},children:t.severity}),w.jsx("td",{className:"px-3 py-2 truncate max-w-xs",style:{color:"rgba(230,237,243,0.5)"},children:t.rule}),w.jsx("td",{className:"px-3 py-2",children:w.jsxs("div",{className:"flex items-center gap-3",children:[w.jsx("button",{type:"button",onClick:()=>e(t),className:"text-[10px] hover:underline",style:{color:"#79c0ff"},children:"Edit"}),!a&&w.jsx("button",{type:"button",disabled:s,onClick:()=>{if(!n){i(!0);return}o(!0),r(t.id).finally(()=>{o(!1),i(!1)})},className:"text-[10px] hover:underline disabled:opacity-50",style:{color:n?"#f85149":"rgba(230,237,243,0.4)"},children:s?"Retiring…":n?"Confirm retire":"Retire"})]})})]})}function AE(){const[t,e]=J.useState([]),[r,n]=J.useState(!0),[i,s]=J.useState(null),[o,a]=J.useState(""),[l,u]=J.useState("idle"),[c,d]=J.useState(null),[g,f]=J.useState(null),y=J.useCallback(async()=>{n(!0),s(null);try{const{policies:b}=await Ve.listPolicies();e(b)}catch(b){s(b instanceof Error?b.message:String(b))}finally{n(!1)}},[]);J.useEffect(()=>{y()},[y]);const _=J.useCallback(async b=>{s(null);try{await Ve.retirePolicy(b),await y()}catch(S){s(S instanceof Error?S.message:String(S))}},[y]),v=b=>{a(JSON.stringify(b??LE,null,2)),f(null),u("idle"),d(null)},m=b=>{a(b);try{JSON.parse(b),f(null)}catch(S){f(S instanceof Error?S.message:String(S))}},x=async()=>{if(g)return;let b;try{b=JSON.parse(o)}catch(S){f(S instanceof Error?S.message:String(S));return}u("saving"),d(null);try{await Ve.upsertPolicy(b),u("ok"),await y()}catch(S){u("error"),d(S instanceof Error?S.message:String(S))}};return w.jsxs("div",{className:"flex flex-col gap-4",children:[w.jsxs("div",{className:"flex items-center gap-3",children:[w.jsx("h2",{className:"text-sm font-semibold",style:{color:"#e6edf3"},children:"Policies"}),w.jsx("button",{type:"button",onClick:()=>void y(),className:"text-[10px] hover:underline",style:{color:"rgba(230,237,243,0.4)"},children:"Refresh"}),w.jsx("button",{type:"button",onClick:()=>v(),className:"ml-auto rounded px-2 py-1 text-[11px] font-semibold",style:{background:"#ffda19",color:"#0d1117"},children:"+ New policy"})]}),i&&w.jsx("p",{className:"rounded px-2 py-1 text-xs",style:{background:"rgba(248,81,73,0.08)",color:"#f85149"},children:i}),r?w.jsx("p",{className:"text-xs",style:{color:"rgba(230,237,243,0.4)"},children:"Loading policies…"}):w.jsx("div",{className:"overflow-x-auto rounded",style:{border:"1px solid rgba(230,237,243,0.08)"},children:w.jsxs("table",{className:"w-full text-[11px]",children:[w.jsx("thead",{children:w.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:[w.jsx("th",{className:"px-3 py-2 text-left",children:"ID"}),w.jsx("th",{className:"px-3 py-2 text-left",children:"Kind"}),w.jsx("th",{className:"px-3 py-2 text-left",children:"Effect"}),w.jsx("th",{className:"px-3 py-2 text-left",children:"Severity"}),w.jsx("th",{className:"px-3 py-2 text-left",children:"Rule"}),w.jsx("th",{className:"px-3 py-2"})]})}),w.jsx("tbody",{children:t.length===0?w.jsx("tr",{children:w.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(b=>w.jsx(DE,{policy:b,onEdit:v,onRetire:_},b.id))})]})}),o!==""&&w.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:[w.jsxs("div",{className:"flex items-center gap-2",children:[w.jsx("span",{className:"text-[11px] font-semibold",style:{color:"#ffda19"},children:"Policy JSON"}),w.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"})]}),w.jsx("textarea",{"aria-label":"Policy JSON editor",value:o,onChange:b=>m(b.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)"}}),g&&w.jsx("p",{className:"text-[10px]",style:{color:"#f85149"},children:g}),w.jsxs("div",{className:"flex items-center gap-2",children:[w.jsx("button",{type:"button",onClick:()=>void x(),disabled:!!g||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"&&w.jsx("span",{className:"text-[10px]",style:{color:"#3fb950"},children:"Saved."}),l==="error"&&w.jsx("span",{className:"text-[10px]",style:{color:"#f85149"},children:c})]})]})]})}const Nw=oa(t=>({projects:[],loading:!1,error:null,load:async()=>{t({loading:!0,error:null});try{const{projects:e}=await Ve.listProjects();t({projects:e,loading:!1})}catch(e){t({loading:!1,error:e instanceof Error?e.message:String(e)})}},addProject:e=>t(r=>({projects:[e,...r.projects.filter(n=>n.id!==e.id)]})),updateProject:e=>t(r=>({projects:r.projects.map(n=>n.id===e.id?e:n)}))})),bt={card:"#161b22",border:"rgba(230,237,243,0.1)",ink:"#e6edf3",muted:"rgba(230,237,243,0.55)",faint:"rgba(230,237,243,0.3)",accent:"#ffda19",red:"#f85149",hover:"rgba(230,237,243,0.04)"};function I0(){return w.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5","aria-hidden":!0,children:w.jsx("polyline",{points:"15 18 9 12 15 6"})})}function gg({label:t,color:e}){return w.jsx("span",{style:{fontSize:"10px",fontFamily:"monospace",color:e,border:`1px solid ${e}`,borderRadius:"4px",padding:"1px 5px"},children:t})}function PE({kind:t}){const r={"crew.run":"#79c0ff","crew.chat":"#a5d6ff","crew.repo":"#7ee787","crew.workflow":"#ffa657","interactive.doc":"#d2a8ff"}[t]??bt.faint;return w.jsx(gg,{label:t,color:r})}function ME({entry:t}){const e=new Date(t.ts);return w.jsxs("div",{style:{display:"flex",gap:"12px",padding:"10px 0",borderBottom:`1px solid ${bt.border}`,alignItems:"flex-start"},children:[w.jsx("span",{style:{fontSize:"10px",fontFamily:"monospace",color:bt.faint,flexShrink:0,paddingTop:"1px"},children:e.toLocaleTimeString()}),w.jsxs("div",{style:{flex:1,minWidth:0},children:[w.jsxs("p",{style:{fontSize:"12px",color:bt.muted,margin:0,marginBottom:"2px"},children:[w.jsx("span",{style:{color:bt.faint,fontFamily:"monospace"},children:t.kind})," ",w.jsx("span",{style:{color:bt.ink},children:t.summary})]}),w.jsx("span",{style:{fontSize:"10px",fontFamily:"monospace",color:bt.faint},children:t.ref})]}),w.jsx("span",{style:{fontSize:"10px",fontFamily:"monospace",flexShrink:0,color:t.source==="crew"?"#79c0ff":"#d2a8ff"},children:t.source})]})}function IE({member:t,onDetach:e}){const[r,n]=J.useState(!1),[i,s]=J.useState(!1);async function o(){n(!0),e(t.id)}return w.jsxs("div",{onMouseEnter:()=>s(!0),onMouseLeave:()=>s(!1),style:{display:"flex",alignItems:"center",gap:"10px",padding:"10px 12px",borderRadius:"7px",background:i?bt.hover:"transparent",transition:"background 0.1s"},children:[w.jsx(PE,{kind:t.member_kind}),w.jsx("span",{style:{fontSize:"12px",fontFamily:"monospace",color:bt.muted,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.member_ref}),w.jsxs("span",{style:{fontSize:"10px",color:bt.faint,flexShrink:0},children:[t.attached_by," · ",new Date(t.attached_at).toLocaleDateString()]}),i&&w.jsx("button",{type:"button",onClick:()=>void o(),disabled:r,style:{background:"transparent",border:`1px solid ${bt.red}`,color:bt.red,borderRadius:"5px",padding:"3px 8px",fontSize:"11px",cursor:"pointer",flexShrink:0},children:r?"…":"Detach"})]})}function OE({projectId:t,navigate:e}){const{updateProject:r}=Nw(),[n,i]=J.useState(null),[s,o]=J.useState([]),[a,l]=J.useState(!0),[u,c]=J.useState(null),[d,g]=J.useState(!1),[f,y]=J.useState(""),[_,v]=J.useState(""),[m,x]=J.useState(!1),[b,S]=J.useState(null),[T,N]=J.useState(!1),E=t==="default",k=(n==null?void 0:n.project)??null,L=(n==null?void 0:n.members)??[],A=J.useCallback(async()=>{l(!0),c(null);try{const[M,U]=await Promise.all([Ve.getProject(t),Ve.getProjectActivity(t).catch(()=>({entries:[],nextCursor:null,projectId:t}))]);i(M),o(U.entries)}catch(M){c(M instanceof Error?M.message:String(M))}finally{l(!1)}},[t]);J.useEffect(()=>{A()},[A]);function I(){k&&(y(k.name),v(k.description??""),S(null),g(!0))}async function O(){if(!k)return;const M=f.trim();if(M){x(!0),S(null);try{const{project:U}=await Ve.updateProject(k.id,{name:M,description:_.trim()});i(H=>H&&{...H,project:U}),r(U),g(!1)}catch(U){S(U instanceof Error?U.message:String(U))}finally{x(!1)}}}async function B(){if(!(!k||E)){N(!0);try{const M=k.status==="active"?"archived":"active",{project:U}=await Ve.updateProject(k.id,{status:M});i(H=>H&&{...H,project:U}),r(U)}catch{}finally{N(!1)}}}function D(M){k&&(Ve.detachProjectMember(k.id,M).catch(()=>{}),i(U=>U&&{...U,members:U.members.filter(H=>H.id!==M)}))}return a?w.jsx("div",{style:{padding:"28px 32px"},children:w.jsx("p",{style:{fontSize:"13px",color:bt.faint,fontFamily:"monospace"},children:"Loading…"})}):u||!k?w.jsxs("div",{style:{padding:"28px 32px"},children:[w.jsxs("button",{type:"button",onClick:()=>e("/projects"),style:{display:"flex",alignItems:"center",gap:"6px",background:"transparent",border:"none",cursor:"pointer",color:bt.muted,fontSize:"13px",marginBottom:"16px",padding:0},children:[w.jsx(I0,{})," Projects"]}),w.jsx("p",{style:{fontSize:"13px",color:bt.red},children:u??"Project not found."})]}):w.jsxs("div",{style:{padding:"28px 32px",maxWidth:"800px"},children:[w.jsxs("button",{type:"button",onClick:()=>e("/projects"),style:{display:"flex",alignItems:"center",gap:"6px",background:"transparent",border:"none",cursor:"pointer",color:bt.muted,fontSize:"12px",marginBottom:"20px",padding:0},children:[w.jsx(I0,{})," All projects"]}),d?w.jsxs("div",{style:{marginBottom:"24px"},children:[w.jsx("input",{type:"text",value:f,maxLength:120,onChange:M=>y(M.target.value),autoFocus:!0,style:{width:"100%",background:"rgba(255,255,255,0.05)",border:`1px solid ${bt.border}`,borderRadius:"6px",padding:"8px 10px",fontSize:"18px",fontWeight:700,color:bt.ink,outline:"none",marginBottom:"8px",boxSizing:"border-box"}}),w.jsx("textarea",{value:_,onChange:M=>v(M.target.value),rows:2,placeholder:"Description (optional)",style:{width:"100%",background:"rgba(255,255,255,0.05)",border:`1px solid ${bt.border}`,borderRadius:"6px",padding:"8px 10px",fontSize:"13px",color:bt.ink,outline:"none",resize:"vertical",marginBottom:"10px",boxSizing:"border-box",fontFamily:"inherit"}}),b&&w.jsx("p",{style:{fontSize:"12px",color:bt.red,marginBottom:"8px"},children:b}),w.jsxs("div",{style:{display:"flex",gap:"8px"},children:[w.jsx("button",{type:"button",onClick:()=>void O(),disabled:m||!f.trim(),style:{background:bt.accent,color:"#0d1117",border:"none",borderRadius:"6px",padding:"6px 14px",fontSize:"12px",fontWeight:700,cursor:"pointer",opacity:m?.5:1},children:m?"Saving…":"Save"}),w.jsx("button",{type:"button",onClick:()=>g(!1),style:{background:"transparent",color:bt.muted,border:`1px solid ${bt.border}`,borderRadius:"6px",padding:"6px 12px",fontSize:"12px",cursor:"pointer"},children:"Cancel"})]})]}):w.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",marginBottom:"24px",gap:"16px"},children:[w.jsxs("div",{style:{flex:1,minWidth:0},children:[w.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",marginBottom:"6px"},children:[w.jsx("h1",{style:{fontSize:"20px",fontWeight:700,color:bt.ink,margin:0},children:k.name}),k.status==="archived"&&w.jsx(gg,{label:"archived",color:bt.faint}),E&&w.jsx(gg,{label:"default",color:bt.faint})]}),k.description&&w.jsx("p",{style:{fontSize:"13px",color:bt.muted,margin:0},children:k.description}),k.created_at>0&&w.jsxs("p",{style:{fontSize:"11px",color:bt.faint,margin:0,marginTop:"6px",fontFamily:"monospace"},children:["Created ",new Date(k.created_at).toLocaleDateString(),k.updated_at!==k.created_at&&w.jsxs(w.Fragment,{children:[" · Updated ",new Date(k.updated_at).toLocaleDateString()]})]})]}),!E&&w.jsxs("div",{style:{display:"flex",gap:"6px",flexShrink:0},children:[w.jsx("button",{type:"button",onClick:I,style:{background:"transparent",color:bt.muted,border:`1px solid ${bt.border}`,borderRadius:"6px",padding:"6px 12px",fontSize:"12px",cursor:"pointer"},children:"Edit"}),w.jsx("button",{type:"button",onClick:()=>void B(),disabled:T,style:{background:"transparent",color:bt.faint,border:`1px solid ${bt.border}`,borderRadius:"6px",padding:"6px 12px",fontSize:"12px",cursor:"pointer",opacity:T?.5:1},children:k.status==="active"?"Archive":"Restore"})]})]}),w.jsxs("section",{style:{marginBottom:"28px"},children:[w.jsxs("h2",{style:{fontSize:"13px",fontWeight:600,color:bt.muted,margin:0,marginBottom:"10px",textTransform:"uppercase",letterSpacing:"0.06em",fontFamily:"monospace"},children:["Members (",L.length,")"]}),L.length===0?w.jsx("p",{style:{fontSize:"13px",color:bt.faint},children:"No members attached yet."}):w.jsx("div",{style:{background:bt.card,border:`1px solid ${bt.border}`,borderRadius:"10px",overflow:"hidden",padding:"4px"},children:L.map(M=>w.jsx(IE,{member:M,onDetach:D},M.id))})]}),w.jsxs("section",{children:[w.jsx("h2",{style:{fontSize:"13px",fontWeight:600,color:bt.muted,margin:0,marginBottom:"10px",textTransform:"uppercase",letterSpacing:"0.06em",fontFamily:"monospace"},children:"Activity"}),s.length===0?w.jsx("p",{style:{fontSize:"13px",color:bt.faint},children:"No activity yet."}):w.jsx("div",{style:{background:bt.card,border:`1px solid ${bt.border}`,borderRadius:"10px",padding:"0 12px"},children:s.map(M=>w.jsx(ME,{entry:M},M.id))})]})]})}const Rt={card:"#161b22",border:"rgba(230,237,243,0.1)",ink:"#e6edf3",muted:"rgba(230,237,243,0.55)",faint:"rgba(230,237,243,0.3)",accent:"#ffda19",red:"#f85149"};function Rw(){return w.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0,children:w.jsx("path",{d:"M10 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8l-2-2z"})})}function BE(){return w.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0,children:w.jsx("path",{d:"M20 3H4c-1.1 0-2 .9-2 2v2c0 .75.41 1.39 1 1.73V19c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V8.73c.59-.34 1-.99 1-1.73V5c0-1.1-.9-2-2-2zm-5 12H9v-2h6v2zm5-7H4V5h16v3z"})})}function jE(){return w.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0,children:w.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 FE({onCreated:t,onCancel:e}){const[r,n]=J.useState(""),[i,s]=J.useState(""),[o,a]=J.useState(!1),[l,u]=J.useState(null),c=J.useRef(null);J.useEffect(()=>{var g;(g=c.current)==null||g.focus()},[]);async function d(){const g=r.trim();if(g){a(!0),u(null);try{const f=i.trim()?{name:g,description:i.trim()}:{name:g},{project:y}=await Ve.createProject(f);t(y)}catch(f){u(f instanceof Error?f.message:String(f)),a(!1)}}}return w.jsxs("div",{style:{background:Rt.card,border:`1px solid ${Rt.border}`,borderRadius:"10px",padding:"20px",marginBottom:"16px"},children:[w.jsx("p",{style:{fontSize:"13px",fontWeight:600,color:Rt.ink,marginBottom:"14px"},children:"New project"}),w.jsx("input",{ref:c,type:"text",placeholder:"Project name",value:r,maxLength:120,onChange:g=>n(g.target.value),onKeyDown:g=>{g.key==="Enter"&&d(),g.key==="Escape"&&e()},style:{width:"100%",background:"rgba(255,255,255,0.05)",border:`1px solid ${Rt.border}`,borderRadius:"6px",padding:"8px 10px",fontSize:"13px",color:Rt.ink,outline:"none",marginBottom:"8px",boxSizing:"border-box"}}),w.jsx("textarea",{placeholder:"Description (optional)",value:i,onChange:g=>s(g.target.value),rows:2,style:{width:"100%",background:"rgba(255,255,255,0.05)",border:`1px solid ${Rt.border}`,borderRadius:"6px",padding:"8px 10px",fontSize:"13px",color:Rt.ink,outline:"none",resize:"vertical",marginBottom:"12px",boxSizing:"border-box",fontFamily:"inherit"}}),l&&w.jsx("p",{style:{fontSize:"12px",color:Rt.red,marginBottom:"10px"},children:l}),w.jsxs("div",{style:{display:"flex",gap:"8px"},children:[w.jsx("button",{type:"button",onClick:()=>void d(),disabled:o||!r.trim(),style:{background:Rt.accent,color:"#0d1117",border:"none",borderRadius:"6px",padding:"7px 16px",fontSize:"12px",fontWeight:700,cursor:o?"default":"pointer",opacity:o||!r.trim()?.5:1},children:o?"Creating…":"Create project"}),w.jsx("button",{type:"button",onClick:e,style:{background:"transparent",color:Rt.muted,border:`1px solid ${Rt.border}`,borderRadius:"6px",padding:"7px 14px",fontSize:"12px",cursor:"pointer"},children:"Cancel"})]})]})}function O0({project:t,onClick:e}){const[r,n]=J.useState(!1),i=t.status==="archived",s=t.id==="default";return w.jsx("button",{type:"button",onClick:e,onMouseEnter:()=>n(!0),onMouseLeave:()=>n(!1),style:{display:"block",width:"100%",textAlign:"left",background:r?"rgba(230,237,243,0.04)":Rt.card,border:`1px solid ${Rt.border}`,borderRadius:"10px",padding:"16px",cursor:"pointer",transition:"background 0.1s"},children:w.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"12px"},children:[w.jsx("span",{style:{color:i?Rt.faint:Rt.accent,marginTop:"1px",flexShrink:0},children:w.jsx(Rw,{})}),w.jsxs("div",{style:{flex:1,minWidth:0},children:[w.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"4px"},children:[w.jsx("span",{style:{fontSize:"14px",fontWeight:600,color:i?Rt.muted:Rt.ink,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.name}),i&&w.jsx("span",{style:{fontSize:"10px",fontFamily:"monospace",color:Rt.faint,border:`1px solid ${Rt.faint}`,borderRadius:"4px",padding:"1px 5px",flexShrink:0},children:"archived"}),s&&w.jsx("span",{style:{fontSize:"10px",fontFamily:"monospace",color:Rt.faint,border:`1px solid ${Rt.faint}`,borderRadius:"4px",padding:"1px 5px",flexShrink:0},children:"default"})]}),t.description&&w.jsx("p",{style:{fontSize:"12px",color:Rt.muted,margin:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.description}),t.created_at>0&&w.jsxs("p",{style:{fontSize:"11px",color:Rt.faint,margin:0,marginTop:"6px",fontFamily:"monospace"},children:["Created ",new Date(t.created_at).toLocaleDateString()]})]})]})})}function zE({navigate:t}){const{projects:e,loading:r,error:n,load:i,addProject:s}=Nw(),[o,a]=J.useState(!1),[l,u]=J.useState(!1);J.useEffect(()=>{i()},[i]);const c=e.filter(f=>f.status==="active"),d=e.filter(f=>f.status==="archived");function g(f){s(f),a(!1)}return w.jsxs("div",{style:{padding:"28px 32px",maxWidth:"760px"},children:[w.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"24px"},children:[w.jsxs("div",{children:[w.jsx("h1",{style:{fontSize:"20px",fontWeight:700,color:Rt.ink,margin:0,marginBottom:"4px"},children:"Projects"}),w.jsx("p",{style:{fontSize:"13px",color:Rt.muted,margin:0},children:"Group runs, chats, and repos into named containers."})]}),w.jsxs("button",{type:"button",onClick:()=>a(!0),style:{display:"flex",alignItems:"center",gap:"6px",background:Rt.accent,color:"#0d1117",border:"none",borderRadius:"7px",padding:"8px 14px",fontSize:"12px",fontWeight:700,cursor:"pointer",flexShrink:0},children:[w.jsx(jE,{})," New project"]})]}),o&&w.jsx(FE,{onCreated:g,onCancel:()=>a(!1)}),r&&w.jsx("p",{style:{fontSize:"13px",color:Rt.faint,fontFamily:"monospace"},children:"Loading…"}),!r&&n&&w.jsx("p",{style:{fontSize:"13px",color:Rt.red},children:n}),!r&&!n&&c.length===0&&!o&&w.jsxs("div",{style:{textAlign:"center",padding:"48px 24px",background:Rt.card,border:`1px solid ${Rt.border}`,borderRadius:"12px"},children:[w.jsx("span",{style:{color:Rt.faint,display:"block",marginBottom:"10px"},children:w.jsx(Rw,{})}),w.jsx("p",{style:{fontSize:"14px",color:Rt.muted,margin:0,marginBottom:"4px"},children:"No projects yet"}),w.jsx("p",{style:{fontSize:"12px",color:Rt.faint,margin:0},children:"Create a project to group your runs, chats, and repos."})]}),c.length>0&&w.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"8px",marginBottom:"16px"},children:c.map(f=>w.jsx(O0,{project:f,onClick:()=>t(`/projects/${encodeURIComponent(f.id)}`)},f.id))}),d.length>0&&w.jsxs("div",{style:{marginTop:"16px"},children:[w.jsxs("button",{type:"button",onClick:()=>u(f=>!f),style:{display:"flex",alignItems:"center",gap:"6px",background:"transparent",border:"none",cursor:"pointer",fontSize:"12px",color:Rt.faint,padding:"4px 0",marginBottom:"8px"},children:[w.jsx(BE,{}),l?"Hide":"Show"," ",d.length," archived project",d.length!==1?"s":""]}),l&&w.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:d.map(f=>w.jsx(O0,{project:f,onClick:()=>t(`/projects/${encodeURIComponent(f.id)}`)},f.id))})]})]})}const HE=new Set(["completed","cancelled","failed"]);function UE(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 Yu={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 hf({label:t,value:e,hint:r}){return w.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:[w.jsx("p",{className:"text-[10px] font-mono uppercase tracking-widest",style:{color:"rgba(230,237,243,0.4)"},children:t}),w.jsx("p",{className:"text-3xl font-mono font-bold",style:{color:"#e6edf3"},children:e}),r&&w.jsx("p",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.35)"},children:r})]})}function $E({onSelectRun:t,autoShowRegister:e,navigate:r}){const[n,i]=J.useState([]),[s,o]=J.useState([]),[a,l]=J.useState(!0),[u,c]=J.useState(null),[d,g]=J.useState(""),[f,y]=J.useState(0),[_,v]=J.useState({}),[m,x]=J.useState({}),[b,S]=J.useState(e??!1),[T,N]=J.useState("local"),[E,k]=J.useState(""),[L,A]=J.useState(""),[I,O]=J.useState(""),[B,D]=J.useState(""),[M,U]=J.useState(null),[H,$]=J.useState(!1),F=J.useRef(!1);J.useEffect(()=>{l(!0),Promise.all([Ve.listRepos(),Ve.listRuns()]).then(([{repos:X},{runs:q}])=>{i(X),o(q)}).catch(X=>c(X instanceof Error?X.message:String(X))).finally(()=>l(!1))},[]),J.useEffect(()=>{if(n.length===0){y(0);return}let X=!1;return Promise.all(n.map(q=>Ve.getRepoGraph(q.id).then(({graph:Y})=>Y!=null).catch(()=>!1))).then(q=>{X||y(q.filter(Boolean).length)}),()=>{X=!0}},[n]);function P(X){if(F.current)return;const q=X.replace(/\.git$/,"").split(/[/\\:]/).filter(Boolean).pop()??"";q&&k(q)}async function z(X){v(q=>({...q,[X]:!0})),x(q=>({...q,[X]:""}));try{const{runId:q}=await Ve.rerunOnboarding(X);t==null||t(q)}catch(q){x(Y=>({...Y,[X]:q instanceof Error?q.message:String(q)}))}finally{v(q=>({...q,[X]:!1}))}}async function G(){const X=E.trim(),q=T==="remote",Y=q?I.trim():L.trim();if(!(!X||!Y)){U(null),$(!0);try{const{repo:K}=q?await Ve.cloneAndRegisterRepo(X,Y,B.trim()||void 0):await Ve.registerRepo(X,Y);i(ee=>[...ee,K]),S(!1),k(""),A(""),O(""),D(""),N("local"),F.current=!1,r("/repo-detail/"+encodeURIComponent(K.id))}catch(K){U(K instanceof Error?K.message:String(K))}finally{$(!1)}}}const V=!!(E.trim()&&(T==="remote"?I.trim():L.trim())),te=s.filter(X=>!HE.has(X.session.status)),ie=d.trim()===""?n:n.filter(X=>X.name.toLowerCase().includes(d.trim().toLowerCase()));function ne(X){return te.filter(q=>q.session.repo_ref===X).length}return w.jsxs("div",{className:"h-full overflow-y-auto",children:[w.jsxs("div",{className:"px-8 pt-8 pb-4",children:[w.jsxs("div",{className:"flex items-center gap-3 mb-5",children:[w.jsx("h1",{className:"text-base font-bold font-mono flex-1",style:{color:"#e6edf3",letterSpacing:"-0.01em"},children:"Repositories"}),w.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:d,onChange:X=>g(X.target.value)}),w.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&&w.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:[w.jsx("div",{role:"group","aria-label":"Repository source",className:"flex gap-1",children:["local","remote"].map(X=>w.jsx("button",{type:"button","aria-pressed":T===X,onClick:()=>N(X),className:"rounded-md px-3 py-1 text-[11px] font-mono font-medium transition-colors",style:T===X?{background:"rgba(230,237,243,0.12)",color:"#e6edf3"}:{color:"rgba(230,237,243,0.4)"},children:X==="local"?"Local path":"Remote URL"},X))}),w.jsx("input",{style:Yu,placeholder:"Repo name",value:E,onChange:X=>{k(X.target.value),F.current=!!X.target.value.trim()}}),T==="local"?w.jsx("input",{style:Yu,placeholder:"Absolute path to git repo",value:L,onChange:X=>{A(X.target.value),P(X.target.value)}}):w.jsxs(w.Fragment,{children:[w.jsx("input",{style:Yu,placeholder:"https://github.com/org/repo or git@github.com:org/repo",value:I,onChange:X=>{O(X.target.value),P(X.target.value)}}),w.jsxs("div",{className:"flex flex-col gap-1",children:[w.jsx("label",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.4)"},children:"Clone to (optional)"}),w.jsx("input",{style:Yu,placeholder:`~/.wicked/repos/${E||"<name>"}`,value:B,onChange:X=>D(X.target.value)})]})]}),w.jsx("p",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.4)"},children:T==="remote"?`Clones to ${B.trim()||`~/.wicked/repos/${E||"<name>"}`}, then runs the onboarding workflow as a governed run.`:"Runs the onboarding workflow (index → annotate → domain) as a governed run."}),M&&w.jsx("p",{className:"text-[11px] font-mono",style:{color:"#f85149"},children:M}),w.jsx("button",{type:"button",onClick:()=>void G(),disabled:H||!V,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:H?T==="remote"?"Cloning…":"Registering…":T==="remote"?"Clone & onboard":"Register & onboard"})]})]}),w.jsxs("div",{className:"px-8 pb-10",children:[!a&&!u&&w.jsxs("div",{className:"grid grid-cols-3 gap-4 mb-6",children:[w.jsx(hf,{label:"Total Repos",value:n.length,hint:"registered with wicked-crew"}),w.jsx(hf,{label:"Active Runs",value:te.length,hint:te.length===1?"1 run in progress":`${te.length} runs in progress`}),w.jsx(hf,{label:"Tracked",value:f,hint:"onboarded and graph-indexed"})]}),a?w.jsx("p",{className:"text-xs font-mono",style:{color:"rgba(230,237,243,0.4)"},children:"Loading repositories…"}):u?w.jsx("p",{className:"text-xs font-mono",style:{color:"#f85149"},children:u}):n.length===0?w.jsx("div",{className:"flex flex-col items-center justify-center py-24 text-center",children:w.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:[w.jsx("p",{className:"text-2xl font-mono font-bold",style:{color:"rgba(230,237,243,0.15)"},children:"No repositories"}),w.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."}),w.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"})]})}):ie.length===0?w.jsxs("p",{className:"text-xs font-mono",style:{color:"rgba(230,237,243,0.4)"},children:["No repos match “",d,"”."]}):w.jsx("div",{className:"grid grid-cols-2 gap-4",children:ie.map(X=>{const q=ne(X.id),Y=_[X.id]??!1,K=m[X.id];return w.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(X.id)),role:"button",tabIndex:0,onKeyDown:ee=>{(ee.key==="Enter"||ee.key===" ")&&r("/repo-detail/"+encodeURIComponent(X.id))},children:[w.jsxs("div",{className:"flex items-start justify-between gap-2",children:[w.jsxs("div",{className:"flex-1 min-w-0",children:[w.jsx("p",{className:"text-sm font-bold font-mono truncate",style:{color:"#e6edf3"},children:X.name}),w.jsx("p",{className:"text-[11px] font-mono mt-0.5 truncate",style:{color:"rgba(230,237,243,0.4)"},title:X.root_path,children:X.root_path})]}),w.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[q>0&&w.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"]}),w.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:X.default_branch})]})]}),w.jsx("p",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.3)"},children:UE(X.registered_at)}),K&&w.jsx("p",{className:"text-[11px] font-mono",style:{color:"#f85149"},children:K}),w.jsxs("div",{className:"flex items-center justify-between mt-auto",onClick:ee=>ee.stopPropagation(),onKeyDown:ee=>ee.stopPropagation(),role:"presentation",children:[w.jsx("button",{type:"button",onClick:()=>r("/repo-detail/"+encodeURIComponent(X.id)),className:"text-xs font-mono hover:underline",style:{color:"#79c0ff"},children:"View →"}),w.jsx("button",{type:"button",disabled:Y,onClick:()=>void z(X.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"})]})]},X.id)})})]})]})}const qe={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"},Ra=50;function WE({repoId:t,repoName:e,onClose:r,onNavigateComponent:n}){const[i,s]=J.useState(""),[o,a]=J.useState("all"),[l,u]=J.useState("functional"),[c,d]=J.useState(0),[g,f]=J.useState(null),[y,_]=J.useState(null),[v,m]=J.useState(null),x=J.useRef(null),b=J.useCallback((L,A,I,O)=>{const B={offset:O,limit:Ra};L.trim()!==""&&(B.q=L.trim()),A!=="all"&&(B.risk=A),I!=="all"&&(B.category=I),Ve.listRequirements(t,B).then(D=>{f(D),_(null)}).catch(D=>_(D instanceof Error?D.message:String(D)))},[t]);J.useEffect(()=>(x.current!==null&&clearTimeout(x.current),x.current=setTimeout(()=>b(i,o,l,c),250),()=>{x.current!==null&&clearTimeout(x.current)}),[i,o,l,c,b]);function S(L){a(L),d(0)}function T(L){u(L),d(0)}function N(L){f(A=>A===null?A:{...A,items:A.items.map(I=>I.key===L.key?{...I,...VE(L)}:I)})}const E=g!==null?Math.max(1,Math.ceil(g.total/Ra)):1,k=Math.floor(c/Ra)+1;return w.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{background:"rgba(0,0,0,0.6)"},children:w.jsxs("div",{className:"w-[92vw] h-[92vh] rounded-2xl flex flex-col overflow-hidden border",style:{background:qe.surface,border:`1px solid ${qe.hairlineS}`},children:[w.jsxs("div",{className:"flex items-center gap-3 px-5 py-3 border-b shrink-0",style:{borderColor:qe.hairline,background:qe.canvas2},children:[w.jsx("span",{className:"font-mono text-sm font-semibold",style:{color:qe.ink},children:e}),w.jsx("span",{className:"font-mono text-[11px] px-2 py-0.5 rounded",style:{background:qe.surface2,color:qe.muted},children:"requirements"}),g!==null&&w.jsx("span",{className:"font-mono text-[11px]",style:{color:qe.faint},children:g.total===g.corpus?`${g.corpus} total`:`${g.total} matching · ${g.corpus} total`}),w.jsx("button",{type:"button",onClick:r,"aria-label":"Close requirements",className:"ml-auto text-lg px-2",style:{color:qe.muted},children:"×"})]}),w.jsxs("div",{className:"flex items-center gap-3 px-5 py-2.5 border-b shrink-0",style:{borderColor:qe.hairline},children:[w.jsx("input",{type:"text",value:i,onChange:L=>{s(L.target.value),d(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 ${qe.hairlineS}`,background:qe.canvas2,color:qe.ink}}),w.jsx("div",{className:"flex items-center gap-1",role:"group","aria-label":"Category filter",children:["functional","config-data","all"].map(L=>w.jsx("button",{type:"button",onClick:()=>T(L),"aria-pressed":l===L,className:"px-2.5 py-1 rounded-lg text-[11px] font-mono font-semibold",style:{background:l===L?qe.surface2:"transparent",color:l===L?qe.ink:qe.faint,border:`1px solid ${l===L?qe.hairlineS:"transparent"}`},children:L==="functional"?"Functional":L==="config-data"?"Config & data":"All"},L))}),w.jsx("div",{className:"w-px h-4",style:{background:qe.hairline}}),w.jsx("div",{className:"flex items-center gap-1",role:"group","aria-label":"Risk filter",children:["all","risk","no-risk"].map(L=>w.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)":qe.surface2:"transparent",color:o===L?L==="risk"?qe.deny:qe.ink:qe.faint,border:`1px solid ${o===L?qe.hairlineS:"transparent"}`},children:L==="all"?"All":L==="risk"?"Risk":"No risk"},L))})]}),w.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[w.jsxs("div",{className:"flex-1 overflow-y-auto",children:[y!==null?w.jsx("p",{className:"text-[12px] font-mono p-6",style:{color:qe.deny},children:y}):g===null?w.jsx("p",{className:"text-[12px] font-mono p-6",style:{color:qe.faint},children:"Loading…"}):g.corpus===0?w.jsxs("div",{className:"p-6 space-y-1",children:[w.jsx("p",{className:"text-[12px] font-mono",style:{color:qe.ink},children:"No requirements have been extracted for this repo."}),w.jsx("p",{className:"text-[12px] font-mono",style:{color:qe.faint},children:"Run domain extraction on it to populate this view."})]}):g.items.length===0?w.jsx("p",{className:"text-[12px] font-mono p-6",style:{color:qe.faint},children:"No requirements match."}):w.jsx("div",{className:"divide-y",style:{borderColor:qe.hairline},children:g.items.map(L=>w.jsx(GE,{req:L,selected:v===L.key,onSelect:()=>m(L.key)},L.key))}),g!==null&&g.total>Ra&&w.jsxs("div",{className:"flex items-center justify-center gap-4 py-3",children:[w.jsx("button",{type:"button",disabled:c===0,onClick:()=>d(Math.max(0,c-Ra)),className:"text-[11px] font-mono px-3 py-1 rounded disabled:opacity-40",style:{color:qe.link},children:"← Prev"}),w.jsxs("span",{className:"text-[11px] font-mono",style:{color:qe.faint},children:["page ",k," of ",E]}),w.jsx("button",{type:"button",disabled:c+Ra>=g.total,onClick:()=>d(c+Ra),className:"text-[11px] font-mono px-3 py-1 rounded disabled:opacity-40",style:{color:qe.link},children:"Next →"})]})]}),v!==null&&w.jsx(qE,{repoId:t,reqKey:v,onClose:()=>m(null),onSaved:N,onNavigateComponent:n})]})]})})}function VE(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 GE({req:t,selected:e,onSelect:r}){return w.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?qe.canvas2:"transparent",borderColor:qe.hairline},children:[w.jsx("span",{className:"text-[10px] font-mono shrink-0 w-16",style:{color:qe.faint},children:t.reqId}),w.jsxs("span",{className:"flex-1 min-w-0",children:[w.jsx("span",{className:"block text-[12px] truncate",style:{color:qe.ink},children:t.title}),t.statement.trim()!==""&&w.jsx("span",{className:"block text-[11px] truncate",style:{color:qe.muted},children:t.statement.trim()}),w.jsx("span",{className:"block text-[10px] font-mono truncate",style:{color:qe.faint},children:t.domain})]}),t.edited&&w.jsx("span",{className:"text-[9px] uppercase font-mono px-1.5 py-0.5 rounded shrink-0",style:{background:qe.surface2,color:qe.link},children:"edited"}),t.risk&&w.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:qe.deny},title:t.riskSource==="operator"?"Marked risk by operator":"Risk derived from business rules",children:["risk",t.riskSource==="operator"?" ●":""]}),w.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)":qe.surface2,color:t.status==="active"?qe.ok:t.status==="deprecated"?qe.deny:qe.muted},children:t.status})]})}function qE({repoId:t,reqKey:e,onClose:r,onSaved:n,onNavigateComponent:i}){const[s,o]=J.useState(null),[a,l]=J.useState(""),[u,c]=J.useState(""),[d,g]=J.useState("active"),[f,y]=J.useState(!1),[_,v]=J.useState(null),[m,x]=J.useState(null);J.useEffect(()=>{o(null),v(null),x(null),Ve.getRequirement(t,e).then(({requirement:T})=>{o(T),l(T.title),c(T.notes),g(T.status==="deprecated"||T.status==="review"?T.status:"active")}).catch(T=>x(T instanceof Error?T.message:String(T)))},[t,e]);function b(T){if(s===null)return;const N={...T};a!==s.title&&(N.title=a),u!==s.notes&&(N.notes=u),d!==s.status&&(N.status=d),Object.keys(N).length!==0&&(y(!0),x(null),Ve.patchRequirement(t,e,N).then(({requirement:E})=>{o(E),l(E.title),c(E.notes),g(E.status==="deprecated"||E.status==="review"?E.status:"active"),n(E),v(Date.now())}).catch(E=>x(E instanceof Error?E.message:String(E))).finally(()=>y(!1)))}function S(){s!==null&&(y(!0),x(null),Ve.patchRequirement(t,e,{risk:!s.risk}).then(({requirement:T})=>{o(T),n(T),v(Date.now())}).catch(T=>x(T instanceof Error?T.message:String(T))).finally(()=>y(!1)))}return w.jsxs("div",{className:"w-[420px] shrink-0 border-l flex flex-col",style:{borderColor:qe.hairlineS,background:qe.surface2},children:[w.jsxs("div",{className:"px-4 py-2.5 border-b flex items-center gap-2 shrink-0",style:{borderColor:qe.hairline,background:qe.canvas2},children:[w.jsx("span",{className:"text-[11px] font-mono truncate",style:{color:qe.ink},children:e}),w.jsx("button",{type:"button",onClick:r,"aria-label":"Close requirement editor",className:"ml-auto text-sm px-1 shrink-0",style:{color:qe.muted},children:"×"})]}),m!==null&&w.jsx("p",{className:"text-[11px] font-mono px-4 py-2",style:{color:qe.deny},children:m}),s===null&&m===null?w.jsx("p",{className:"text-[11px] font-mono px-4 py-3",style:{color:qe.faint},children:"Loading…"}):s!==null?w.jsxs("div",{className:"flex-1 overflow-y-auto px-4 py-3 flex flex-col gap-3",children:[w.jsxs("label",{className:"flex flex-col gap-1",children:[w.jsx("span",{className:"text-[10px] font-mono uppercase",style:{color:qe.faint},children:"Title"}),w.jsx("input",{type:"text",value:a,onChange:T=>l(T.target.value),className:"text-[12px] font-mono px-3 py-1.5 rounded-lg border outline-none",style:{border:`1px solid ${qe.hairlineS}`,background:qe.canvas2,color:qe.ink}})]}),s.title!==s.sourceTitle&&w.jsxs("p",{className:"text-[10px] font-mono",style:{color:qe.faint},children:["source title: ",s.sourceTitle]}),w.jsxs("div",{children:[w.jsx("span",{className:"text-[10px] font-mono uppercase",style:{color:qe.faint},children:"Description (source)"}),w.jsx("p",{className:"text-[11px] mt-1 whitespace-pre-wrap",style:{color:qe.muted},children:s.description===""?"(none recorded)":s.description.slice(0,1200)})]}),w.jsxs("label",{className:"flex flex-col gap-1",children:[w.jsx("span",{className:"text-[10px] font-mono uppercase",style:{color:qe.faint},children:"Notes (operator)"}),w.jsx("textarea",{value:u,onChange:T=>c(T.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 ${qe.hairlineS}`,background:qe.canvas2,color:qe.ink}})]}),w.jsxs("div",{className:"flex items-center gap-3",children:[w.jsxs("label",{className:"flex items-center gap-2",children:[w.jsx("span",{className:"text-[10px] font-mono uppercase",style:{color:qe.faint},children:"Status"}),w.jsxs("select",{value:d,onChange:T=>g(T.target.value),className:"text-[11px] font-mono px-2 py-1 rounded-lg border outline-none",style:{border:`1px solid ${qe.hairlineS}`,background:qe.canvas2,color:qe.ink},children:[w.jsx("option",{value:"active",children:"active"}),w.jsx("option",{value:"review",children:"review"}),w.jsx("option",{value:"deprecated",children:"deprecated"})]})]}),w.jsx("button",{type:"button",onClick:S,disabled:f,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)":qe.canvas2,color:s.risk?qe.deny:qe.muted,border:`1px solid ${qe.hairlineS}`},children:s.risk?"⚑ Risk (clear)":"⚑ Mark as risk"})]}),s.riskSource==="data"&&w.jsx("p",{className:"text-[10px] font-mono",style:{color:qe.faint},children:"risk derived from business rules — an operator toggle overrides it"}),s.businessRules.length>0&&w.jsxs("div",{children:[w.jsx("span",{className:"text-[10px] font-mono uppercase",style:{color:qe.faint},children:"Business rules"}),w.jsx("ol",{className:"mt-1 flex flex-col gap-1.5",children:s.businessRules.map((T,N)=>{const E=T,k=typeof E.statement=="string"?E.statement.trim():"",L=k!==""?k:JSON.stringify(T),A=typeof E.confidence=="number"?E.confidence:null;return w.jsxs("li",{className:"text-[11px] leading-snug",style:{color:qe.ink},children:[L,A!==null&&w.jsxs("span",{className:"text-[9px] font-mono ml-1.5",style:{color:qe.faint},children:["conf ",A]})]},N)})})]}),w.jsxs("div",{className:"text-[10px] font-mono flex gap-3 flex-wrap",style:{color:qe.faint},children:[w.jsxs("span",{children:[s.ruleCount," rules"]}),w.jsxs("span",{children:[s.componentCount," components"]}),w.jsxs("span",{children:[s.validationCount," validations"]}),w.jsxs("span",{children:[s.errorPathCount," error paths"]})]}),s.legacyComponents.length>0&&w.jsxs("div",{children:[w.jsx("span",{className:"text-[10px] font-mono uppercase",style:{color:qe.faint},children:"Components"}),w.jsx("ul",{className:"mt-1 flex flex-col gap-0.5",children:s.legacyComponents.map((T,N)=>{const E=typeof T=="string"?T:JSON.stringify(T),k=typeof T=="string"?T.includes("#")?T.split("#")[1]:T:"";return w.jsx("li",{className:"text-[10px] font-mono truncate",children:i!==void 0&&k!==""?w.jsxs("button",{type:"button",onClick:()=>i(k),className:"hover:underline text-left truncate w-full",style:{color:qe.link},title:`Open ${E} in the code graph`,children:[E," →"]}):w.jsx("span",{style:{color:qe.muted},children:E})},N)})})]}),w.jsxs("div",{className:"flex items-center gap-3 mt-1",children:[w.jsx("button",{type:"button",onClick:()=>b(),disabled:f,className:"px-4 py-1.5 rounded-lg text-[12px] font-mono font-semibold disabled:opacity-50",style:{background:qe.accent,color:"#0d1117"},children:f?"Saving…":"Save"}),_!==null&&!f&&w.jsx("span",{className:"text-[10px] font-mono",style:{color:qe.ok},children:"saved ✓"})]})]}):null]})}const YE=new Set(["completed","failed","cancelled"]);function KE({repoId:t,onSelectRun:e,navigate:r,onOpenGraph:n}){const[i,s]=J.useState(!1),[o,a]=J.useState(null),[l,u]=J.useState([]),[c,d]=J.useState(null),[g,f]=J.useState(null),[y,_]=J.useState(null),[v,m]=J.useState(!0),[x,b]=J.useState(null),[S,T]=J.useState(!1),[N,E]=J.useState(!1),[k,L]=J.useState(null);if(J.useEffect(()=>{let H=!1;return m(!0),b(null),T(!1),f(null),_(null),Promise.all([Ve.listRepos().then(({repos:$})=>$.find(F=>F.id===t)??null),Ve.listRuns().then(({runs:$})=>$.filter(F=>F.session.repo_ref===t)).catch(()=>[]),Ve.getRepoGraph(t).then(({graph:$})=>$).catch(()=>null)]).then(([$,F,P])=>{H||(a($),u(F),d(P))}).catch($=>{H||b($ instanceof Error?$.message:"Failed to load repo")}).finally(()=>{H||m(!1)}),Ve.getRepoGitHistory(t).then(({commits:$})=>{H||f($)}).catch(()=>{}),Ve.getRepoContributors(t).then(({contributors:$})=>{H||_($)}).catch(()=>{}),()=>{H=!0}},[t]),v)return w.jsx("div",{className:"p-8 font-mono text-sm",style:{color:"rgba(230,237,243,0.4)"},children:"Loading…"});if(x)return w.jsx("div",{className:"p-8 font-mono text-sm",style:{color:"#f85149"},children:x});if(!o)return w.jsx("div",{className:"p-8 font-mono text-sm",style:{color:"#f85149"},children:"Repo not found."});const A=l.filter(H=>!YE.has(H.session.status)),I=l.filter(H=>H.session.status==="completed"),O=l.filter(H=>H.session.status==="failed"||H.session.status==="cancelled"),B=c?[...c.nodes].filter(H=>H.file&&!H.file.startsWith("node_modules/")).sort((H,$)=>$.inDeg-H.inDeg).slice(0,5):[],D=S?l:l.slice(0,10),M=c==null?void 0:c.stats;async function U(){E(!0),L(null);try{const{runId:H}=await Ve.rerunOnboarding(t);e(H)}catch(H){L(H instanceof Error?H.message:String(H))}finally{E(!1)}}return w.jsxs("div",{className:"flex flex-col gap-6 p-8",style:{color:"#e6edf3"},children:[w.jsxs("div",{className:"flex flex-col gap-3",children:[w.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"}),w.jsxs("div",{className:"flex items-start gap-4 flex-wrap",children:[w.jsxs("div",{className:"flex-1 min-w-0",children:[w.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[w.jsx("h1",{className:"text-2xl font-semibold font-mono",children:o.name}),w.jsx("button",{type:"button",onClick:()=>void U(),disabled:N,className:"px-3 py-1 rounded-lg text-xs font-semibold font-mono transition-opacity disabled:opacity-50",style:{background:"#ffda19",color:"#0d1117"},children:N?"Starting…":"↺ Run Onboarding"}),w.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 →"}),w.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&&w.jsx("p",{className:"text-[11px] font-mono mt-1",style:{color:"#f85149"},children:k}),w.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)?w.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}):w.jsx("span",{className:"text-[11px] font-mono mt-0.5 block truncate",style:{color:"#79c0ff"},title:o.git_url,children:o.git_url}))]}),w.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})]})]}),w.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:O.length,accent:O.length>0?"#f85149":void 0}].map(H=>w.jsxs("div",{className:"rounded-2xl px-6 py-4",style:{background:"#1b222e",border:"1px solid rgba(230,237,243,0.07)"},children:[w.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-widest font-mono",style:{color:"rgba(230,237,243,0.4)"},children:H.label}),w.jsx("p",{className:"text-3xl font-semibold mt-1",style:{color:H.accent??"#e6edf3"},children:H.value})]},H.label))}),A.length>0&&w.jsx(Ss,{title:"Active Now",children:w.jsx("div",{className:"flex flex-col gap-1",children:A.map(H=>w.jsx(mi,{view:H,selectedRunId:null,onSelect:e},H.session.id))})}),w.jsxs("div",{className:"grid gap-6 grid-cols-1 md:grid-cols-2",children:[w.jsxs("div",{className:"flex flex-col gap-6",children:[l.length>0&&w.jsxs(Ss,{title:"Work & Chats",children:[w.jsx("div",{className:"flex flex-col gap-1",children:D.map(H=>w.jsx(mi,{view:H,selectedRunId:null,onSelect:e},H.session.id))}),l.length>10&&w.jsx("button",{type:"button",onClick:()=>T(H=>!H),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`})]}),w.jsx(Ss,{title:"Code Hotspots",children:B.length===0?w.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."}):w.jsxs("div",{className:"flex flex-col gap-2",children:[B.map((H,$)=>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:[w.jsx("span",{className:"text-[10px] font-mono w-4 text-right shrink-0",style:{color:"rgba(230,237,243,0.3)"},children:$+1}),w.jsx("span",{className:"flex-1 text-xs font-mono truncate",style:{color:"rgba(230,237,243,0.75)"},title:H.file,children:H.file}),w.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:[H.inDeg," edges"]}),w.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"})]},H.id)),w.jsx("button",{type:"button",onClick:()=>n(),className:"mt-2 self-start text-xs font-mono hover:underline",style:{color:"#79c0ff"},children:"Open full graph →"})]})})]}),w.jsxs("div",{className:"flex flex-col gap-6",children:[w.jsx(Ss,{title:"Code Graph",children:M?w.jsxs("div",{className:"flex flex-col gap-3",children:[[{label:"Symbols",value:M.nodeCount},{label:"Edges",value:M.edgeCount},{label:"Files indexed",value:M.fileCount}].map(H=>w.jsxs("div",{className:"flex items-center justify-between",children:[w.jsx("span",{className:"text-xs font-mono",style:{color:"rgba(230,237,243,0.5)"},children:H.label}),w.jsx("span",{className:"text-sm font-semibold font-mono",style:{color:"#e6edf3"},children:H.value.toLocaleString()})]},H.label)),w.jsx("button",{type:"button",onClick:()=>n(),className:"mt-2 self-start text-xs font-mono hover:underline",style:{color:"#79c0ff"},children:"Browse full graph →"})]}):w.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."})}),w.jsx(Ss,{title:"Git History",children:g===null?w.jsx(XE,{count:6,widths:["w-14","w-16","flex-1","w-12"]}):g.length===0?w.jsx("p",{className:"text-sm font-mono italic",style:{color:"rgba(230,237,243,0.35)"},children:"No commits yet."}):w.jsx("div",{className:"flex flex-col gap-2",children:g.map(H=>w.jsxs("div",{className:"flex items-start gap-2 min-w-0",children:[o.git_url&&/^https:\/\//i.test(o.git_url)?w.jsx("a",{href:`${o.git_url.replace(/\.git$/,"")}/commit/${H.sha}`,target:"_blank",rel:"noopener noreferrer",className:"shrink-0 text-[10px] font-mono hover:underline",style:{color:"#79c0ff",marginTop:"1px"},children:H.shortSha}):w.jsx("span",{className:"shrink-0 text-[10px] font-mono",style:{color:"#79c0ff",marginTop:"1px"},children:H.shortSha}),w.jsx("span",{className:"shrink-0 text-[9px] font-mono truncate max-w-[80px]",style:{color:"rgba(230,237,243,0.45)"},title:H.author,children:H.author}),w.jsx("span",{className:"flex-1 text-[10px] font-mono truncate",style:{color:"rgba(230,237,243,0.8)"},title:H.message,children:H.message.length>72?`${H.message.slice(0,72)}…`:H.message}),w.jsx("span",{className:"shrink-0 text-[9px] font-mono",style:{color:"rgba(230,237,243,0.3)"},children:H.date})]},H.sha))})}),w.jsx(Ss,{title:"Contributors",children:y===null?w.jsx(QE,{count:4}):y.length===0?w.jsx("p",{className:"text-sm font-mono italic",style:{color:"rgba(230,237,243,0.35)"},children:"No contributors found."}):w.jsx("div",{className:"flex flex-col gap-2",children:y.map((H,$)=>{const F=H.name.split(" ").map(P=>P[0]??"").join("").slice(0,2).toUpperCase();return w.jsxs("div",{className:"flex items-center gap-2",children:[w.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}),w.jsx("span",{className:"flex-1 text-xs font-mono truncate",style:{color:"rgba(230,237,243,0.8)"},children:H.name}),w.jsxs("span",{className:"shrink-0 text-[10px] font-mono",style:{color:"rgba(230,237,243,0.4)"},children:[H.commits," commit",H.commits!==1?"s":""]})]},`${H.email}-${H.name}-${$}`)})})})]})]}),i&&o&&w.jsx(WE,{repoId:t,repoName:o.name,onClose:()=>s(!1),onNavigateComponent:H=>{s(!1),n(H)}})]})}const Lw="rgba(230,237,243,0.06)";function vg({className:t}){return w.jsx("span",{className:`inline-block rounded animate-pulse ${t}`,style:{background:Lw}})}function XE({count:t,widths:e}){return w.jsx("div",{className:"flex flex-col gap-2.5",children:Array.from({length:t},(r,n)=>w.jsx("div",{className:"flex items-center gap-2 min-w-0",style:{opacity:Math.max(.15,1-n*.12)},children:e.map((i,s)=>w.jsx(vg,{className:`h-2.5 ${i}`},s))},n))})}function QE({count:t}){return w.jsx("div",{className:"flex flex-col gap-2.5",children:Array.from({length:t},(e,r)=>w.jsxs("div",{className:"flex items-center gap-2",style:{opacity:Math.max(.15,1-r*.18)},children:[w.jsx("span",{className:"shrink-0 w-6 h-6 rounded-full animate-pulse",style:{background:Lw}}),w.jsx(vg,{className:"h-2.5 w-28"}),w.jsx(vg,{className:"h-2 w-14 ml-auto"})]},r))})}function Ss({title:t,children:e}){return w.jsxs("div",{className:"rounded-2xl p-6",style:{background:"#1b222e",border:"1px solid rgba(230,237,243,0.07)"},children:[w.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 mg(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 ZE(t){if(Array.isArray(t))return t}function JE(t){if(Array.isArray(t))return mg(t)}function la(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function e3(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,Aw(n.key),n)}}function ua(t,e,r){return e&&e3(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function un(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=tv(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 Dw(t,e,r){return(e=Aw(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function t3(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function r3(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 n3(){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 i3(){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 yr(t,e){return ZE(t)||r3(t,e)||tv(t,e)||n3()}function Dc(t){return JE(t)||t3(t)||tv(t)||i3()}function a3(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 Aw(t){var e=a3(t,"string");return typeof e=="symbol"?e:e+""}function Sr(t){"@babel/helpers - typeof";return Sr=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},Sr(t)}function tv(t,e){if(t){if(typeof t=="string")return mg(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)?mg(t,e):void 0}}var wr=typeof window>"u"?null:window,B0=wr?wr.navigator:null;wr&&wr.document;var s3=Sr(""),Pw=Sr({}),o3=Sr(function(){}),l3=typeof HTMLElement>"u"?"undefined":Sr(HTMLElement),kl=function(e){return e&&e.instanceString&&lr(e.instanceString)?e.instanceString():null},dt=function(e){return e!=null&&Sr(e)==s3},lr=function(e){return e!=null&&Sr(e)===o3},Gt=function(e){return!mn(e)&&(Array.isArray?Array.isArray(e):e!=null&&e instanceof Array)},Pt=function(e){return e!=null&&Sr(e)===Pw&&!Gt(e)&&e.constructor===Object},u3=function(e){return e!=null&&Sr(e)===Pw},Ke=function(e){return e!=null&&Sr(e)===Sr(1)&&!isNaN(e)},Mw=function(e){return Ke(e)&&Math.floor(e)===e},Ac=function(e){if(l3!=="undefined")return e!=null&&e instanceof HTMLElement},mn=function(e){return El(e)||Iw(e)},El=function(e){return kl(e)==="collection"&&e._private.single},Iw=function(e){return kl(e)==="collection"&&!e._private.single},rv=function(e){return kl(e)==="core"},Ow=function(e){return kl(e)==="stylesheet"},c3=function(e){return kl(e)==="event"},ea=function(e){return e==null?!0:!!(e===""||e.match(/^\s+$/))},d3=function(e){return typeof HTMLElement>"u"?!1:e instanceof HTMLElement},h3=function(e){return Pt(e)&&Ke(e.x1)&&Ke(e.x2)&&Ke(e.y1)&&Ke(e.y2)},f3=function(e){return u3(e)&&lr(e.then)},p3=function(){return B0&&B0.userAgent.match(/msie|trident|edge/i)},Vs=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},nv=Vs(function(t){return t.replace(/([A-Z])/g,function(e){return"-"+e.toLowerCase()})}),Xc=Vs(function(t){return t.replace(/(-\w)/g,function(e){return e[1].toUpperCase()})}),Bw=Vs(function(t,e){return t+e[0].toUpperCase()+e.substring(1)},function(t,e){return t+"$"+e}),j0=function(e){return ea(e)?e:e.charAt(0).toUpperCase()+e.substring(1)},Ki=function(e,r){return e.slice(-1*r.length)===r},_r="(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))",g3="rgb[a]?\\(("+_r+"[%]?)\\s*,\\s*("+_r+"[%]?)\\s*,\\s*("+_r+"[%]?)(?:\\s*,\\s*("+_r+"))?\\)",v3="rgb[a]?\\((?:"+_r+"[%]?)\\s*,\\s*(?:"+_r+"[%]?)\\s*,\\s*(?:"+_r+"[%]?)(?:\\s*,\\s*(?:"+_r+"))?\\)",m3="hsl[a]?\\(("+_r+")\\s*,\\s*("+_r+"[%])\\s*,\\s*("+_r+"[%])(?:\\s*,\\s*("+_r+"))?\\)",y3="hsl[a]?\\((?:"+_r+")\\s*,\\s*(?:"+_r+"[%])\\s*,\\s*(?:"+_r+"[%])(?:\\s*,\\s*(?:"+_r+"))?\\)",x3="\\#[0-9a-fA-F]{3}",b3="\\#[0-9a-fA-F]{6}",jw=function(e,r){return e<r?-1:e>r?1:0},w3=function(e,r){return-1*jw(e,r)},vt=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},_3=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]}},S3=function(e){var r,n,i,s,o,a,l,u;function c(y,_,v){return v<0&&(v+=1),v>1&&(v-=1),v<1/6?y+(_-y)*6*v:v<1/2?_:v<2/3?y+(_-y)*(2/3-v)*6:y}var d=new RegExp("^"+m3+"$").exec(e);if(d){if(n=parseInt(d[1]),n<0?n=(360- -1*n%360)%360:n>360&&(n=n%360),n/=360,i=parseFloat(d[2]),i<0||i>100||(i=i/100,s=parseFloat(d[3]),s<0||s>100)||(s=s/100,o=d[4],o!==void 0&&(o=parseFloat(o),o<0||o>1)))return;if(i===0)a=l=u=Math.round(s*255);else{var g=s<.5?s*(1+i):s+i-s*i,f=2*s-g;a=Math.round(255*c(f,g,n+1/3)),l=Math.round(255*c(f,g,n)),u=Math.round(255*c(f,g,n-1/3))}r=[a,l,u,o]}return r},C3=function(e){var r,n=new RegExp("^"+g3+"$").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},k3=function(e){return E3[e.toLowerCase()]},Fw=function(e){return(Gt(e)?e:null)||k3(e)||_3(e)||C3(e)||S3(e)},E3={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]},zw=function(e){for(var r=e.map,n=e.keys,i=n.length,s=0;s<i;s++){var o=n[s];if(Pt(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}},Hw=function(e){for(var r=e.map,n=e.keys,i=n.length,s=0;s<i;s++){var o=n[s];if(Pt(o))throw Error("Tried to get map with object key");if(r=r[o],r==null)return r}return r},Ku=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Tl(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var ff,F0;function Nl(){if(F0)return ff;F0=1;function t(e){var r=typeof e;return e!=null&&(r=="object"||r=="function")}return ff=t,ff}var pf,z0;function T3(){if(z0)return pf;z0=1;var t=typeof Ku=="object"&&Ku&&Ku.Object===Object&&Ku;return pf=t,pf}var gf,H0;function Qc(){if(H0)return gf;H0=1;var t=T3(),e=typeof self=="object"&&self&&self.Object===Object&&self,r=t||e||Function("return this")();return gf=r,gf}var vf,U0;function N3(){if(U0)return vf;U0=1;var t=Qc(),e=function(){return t.Date.now()};return vf=e,vf}var mf,$0;function R3(){if($0)return mf;$0=1;var t=/\s/;function e(r){for(var n=r.length;n--&&t.test(r.charAt(n)););return n}return mf=e,mf}var yf,W0;function L3(){if(W0)return yf;W0=1;var t=R3(),e=/^\s+/;function r(n){return n&&n.slice(0,t(n)+1).replace(e,"")}return yf=r,yf}var xf,V0;function iv(){if(V0)return xf;V0=1;var t=Qc(),e=t.Symbol;return xf=e,xf}var bf,G0;function D3(){if(G0)return bf;G0=1;var t=iv(),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 bf=s,bf}var wf,q0;function A3(){if(q0)return wf;q0=1;var t=Object.prototype,e=t.toString;function r(n){return e.call(n)}return wf=r,wf}var _f,Y0;function Uw(){if(Y0)return _f;Y0=1;var t=iv(),e=D3(),r=A3(),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 _f=o,_f}var Sf,K0;function P3(){if(K0)return Sf;K0=1;function t(e){return e!=null&&typeof e=="object"}return Sf=t,Sf}var Cf,X0;function Rl(){if(X0)return Cf;X0=1;var t=Uw(),e=P3(),r="[object Symbol]";function n(i){return typeof i=="symbol"||e(i)&&t(i)==r}return Cf=n,Cf}var kf,Q0;function M3(){if(Q0)return kf;Q0=1;var t=L3(),e=Nl(),r=Rl(),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 d=s.test(u);return d||o.test(u)?a(u.slice(2),d?2:8):i.test(u)?n:+u}return kf=l,kf}var Ef,Z0;function I3(){if(Z0)return Ef;Z0=1;var t=Nl(),e=N3(),r=M3(),n="Expected a function",i=Math.max,s=Math.min;function o(a,l,u){var c,d,g,f,y,_,v=0,m=!1,x=!1,b=!0;if(typeof a!="function")throw new TypeError(n);l=r(l)||0,t(u)&&(m=!!u.leading,x="maxWait"in u,g=x?i(r(u.maxWait)||0,l):g,b="trailing"in u?!!u.trailing:b);function S(B){var D=c,M=d;return c=d=void 0,v=B,f=a.apply(M,D),f}function T(B){return v=B,y=setTimeout(k,l),m?S(B):f}function N(B){var D=B-_,M=B-v,U=l-D;return x?s(U,g-M):U}function E(B){var D=B-_,M=B-v;return _===void 0||D>=l||D<0||x&&M>=g}function k(){var B=e();if(E(B))return L(B);y=setTimeout(k,N(B))}function L(B){return y=void 0,b&&c?S(B):(c=d=void 0,f)}function A(){y!==void 0&&clearTimeout(y),v=0,c=_=d=y=void 0}function I(){return y===void 0?f:L(e())}function O(){var B=e(),D=E(B);if(c=arguments,d=this,_=B,D){if(y===void 0)return T(_);if(x)return clearTimeout(y),y=setTimeout(k,l),S(_)}return y===void 0&&(y=setTimeout(k,l)),f}return O.cancel=A,O.flush=I,O}return Ef=o,Ef}var O3=I3(),Ll=Tl(O3),Tf=wr?wr.performance:null,$w=Tf&&Tf.now?function(){return Tf.now()}:function(){return Date.now()},B3=(function(){if(wr){if(wr.requestAnimationFrame)return function(t){wr.requestAnimationFrame(t)};if(wr.mozRequestAnimationFrame)return function(t){wr.mozRequestAnimationFrame(t)};if(wr.webkitRequestAnimationFrame)return function(t){wr.webkitRequestAnimationFrame(t)};if(wr.msRequestAnimationFrame)return function(t){wr.msRequestAnimationFrame(t)}}return function(t){t&&setTimeout(function(){t($w())},1e3/60)}})(),Pc=function(e){return B3(e)},xi=$w,ja=9261,Ww=65599,Is=5381,Vw=function(e){for(var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ja,n=r,i;i=e.next(),!i.done;)n=n*Ww+i.value|0;return n},hl=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ja;return r*Ww+e|0},fl=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Is;return(r<<5)+r+e|0},j3=function(e,r){return e*2097152+r},Wi=function(e){return e[0]*2097152+e[1]},Xu=function(e,r){return[hl(e[0],r[0]),fl(e[1],r[1])]},J0=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 Vw(o,r)},$a=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 Vw(o,r)},Gw=function(){return F3(arguments)},F3=function(e){for(var r,n=0;n<e.length;n++){var i=e[n];n===0?r=$a(i):r=$a(i,r)}return r};function z3(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 H3=function(e,r,n,i,s,o){return{x:(e-n)*s+n,y:(r-i)*o+i}};function U3(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=z3(t.x,t.y,n,i,r),l=H3(a.x,a.y,n,i,s,o);return{x:l.x,y:l.y}}var ex=!0,$3=console.warn!=null,W3=console.trace!=null,av=Number.MAX_SAFE_INTEGER||9007199254740991,qw=function(){return!0},Mc=function(){return!1},tx=function(){return 0},sv=function(){},ir=function(e){throw new Error(e)},Yw=function(e){if(e!==void 0)ex=!!e;else return ex},zt=function(e){Yw()&&($3?console.warn(e):(console.log(e),W3&&console.trace()))},V3=function(e){return vt({},e)},ei=function(e){return e==null?e:Gt(e)?e.slice():Pt(e)?V3(e):e},G3=function(e){return e.slice()},Kw=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},q3={},Xw=function(){return q3},Ir=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}},ta=function(e,r,n){for(var i=e.length-1;i>=0;i--)e[i]===r&&e.splice(i,1)},ov=function(e){e.splice(0,e.length)},Y3=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=Bw(n,r)),e[r]},Jn=function(e,r,n,i){n&&(r=Bw(n,r)),e[r]=i},K3=(function(){function t(){la(this,t),this._obj={}}return ua(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]}}])})(),yi=typeof Map<"u"?Map:K3,X3="undefined",Q3=(function(){function t(e){if(la(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 ua(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)}}])})(),Qs=(typeof Set>"u"?"undefined":Sr(Set))!==X3?Set:Q3,Zc=function(e,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(e===void 0||r===void 0||!rv(e)){ir("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"){ir("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 Qs,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=[];Gt(r.classes)?u=r.classes:dt(r.classes)&&(u=r.classes.split(/\s+/));for(var c=0,d=u.length;c<d;c++){var g=u[c];!g||g===""||s.classes.add(g)}this.createEmitter(),(n===void 0||n)&&this.restore();var f=r.style||r.css;f&&(zt("Setting a `style` bypass at element creation should be done only when absolutely necessary. Try to use the stylesheet instead."),this.style(f))},rx=function(e){return e={bfs:e.bfs||!e.dfs,dfs:e.dfs||!e.bfs},function(n,i,s){var o;Pt(n)&&!mn(n)&&(o=n,n=o.roots||o.root,i=o.visit,s=o.directed),s=arguments.length===2&&!lr(i)?i:s,i=lr(i)?i:function(){};for(var a=this._private.cy,l=n=dt(n)?this.filter(n):n,u=[],c=[],d={},g={},f={},y=0,_,v=this.byGroup(),m=v.nodes,x=v.edges,b=0;b<l.length;b++){var S=l[b],T=S.id();S.isNode()&&(u.unshift(S),e.bfs&&(f[T]=!0,c.push(S)),g[T]=0)}for(var N=function(){var B=e.bfs?u.shift():u.pop(),D=B.id();if(e.dfs){if(f[D])return 0;f[D]=!0,c.push(B)}var M=g[D],U=d[D],H=U!=null?U.source():null,$=U!=null?U.target():null,F=U==null?void 0:B.same(H)?$[0]:H[0],P;if(P=i(B,U,F,y++,M),P===!0)return _=B,1;if(P===!1)return 1;for(var z=B.connectedEdges().filter(function(ne){return(!s||ne.source().same(B))&&x.has(ne)}),G=0;G<z.length;G++){var V=z[G],te=V.connectedNodes().filter(function(ne){return!ne.same(B)&&m.has(ne)}),ie=te.id();te.length!==0&&!f[ie]&&(te=te[0],u.push(te),e.bfs&&(f[ie]=!0,c.push(te)),d[ie]=V,g[ie]=g[D]+1)}},E;u.length!==0&&(E=N(),!(E!==0&&E===1)););for(var k=a.collection(),L=0;L<c.length;L++){var A=c[L],I=d[A.id()];I!=null&&k.push(I),k.push(A)}return{path:a.collection(k),found:a.collection(_)}}},pl={breadthFirstSearch:rx({bfs:!0}),depthFirstSearch:rx({dfs:!0})};pl.bfs=pl.breadthFirstSearch;pl.dfs=pl.depthFirstSearch;var vc={exports:{}},Z3=vc.exports,nx;function J3(){return nx||(nx=1,(function(t,e){(function(){var r,n,i,s,o,a,l,u,c,d,g,f,y,_,v;i=Math.floor,d=Math.min,n=function(m,x){return m<x?-1:m>x?1:0},c=function(m,x,b,S,T){var N;if(b==null&&(b=0),T==null&&(T=n),b<0)throw new Error("lo must be non-negative");for(S==null&&(S=m.length);b<S;)N=i((b+S)/2),T(x,m[N])<0?S=N:b=N+1;return[].splice.apply(m,[b,b-b].concat(x)),x},a=function(m,x,b){return b==null&&(b=n),m.push(x),_(m,0,m.length-1,b)},o=function(m,x){var b,S;return x==null&&(x=n),b=m.pop(),m.length?(S=m[0],m[0]=b,v(m,0,x)):S=b,S},u=function(m,x,b){var S;return b==null&&(b=n),S=m[0],m[0]=x,v(m,0,b),S},l=function(m,x,b){var S;return b==null&&(b=n),m.length&&b(m[0],x)<0&&(S=[m[0],x],x=S[0],m[0]=S[1],v(m,0,b)),x},s=function(m,x){var b,S,T,N,E,k;for(x==null&&(x=n),N=(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(),E=[],S=0,T=N.length;S<T;S++)b=N[S],E.push(v(m,b,x));return E},y=function(m,x,b){var S;if(b==null&&(b=n),S=m.indexOf(x),S!==-1)return _(m,0,S,b),v(m,S,b)},g=function(m,x,b){var S,T,N,E,k;if(b==null&&(b=n),T=m.slice(0,x),!T.length)return T;for(s(T,b),k=m.slice(x),N=0,E=k.length;N<E;N++)S=k[N],l(T,S,b);return T.sort(b).reverse()},f=function(m,x,b){var S,T,N,E,k,L,A,I,O;if(b==null&&(b=n),x*10<=m.length){if(N=m.slice(0,x).sort(b),!N.length)return N;for(T=N[N.length-1],A=m.slice(x),E=0,L=A.length;E<L;E++)S=A[E],b(S,T)<0&&(c(N,S,0,null,b),N.pop(),T=N[N.length-1]);return N}for(s(m,b),O=[],k=0,I=d(x,m.length);0<=I?k<I:k>I;0<=I?++k:--k)O.push(o(m,b));return O},_=function(m,x,b,S){var T,N,E;for(S==null&&(S=n),T=m[b];b>x;){if(E=b-1>>1,N=m[E],S(T,N)<0){m[b]=N,b=E;continue}break}return m[b]=T},v=function(m,x,b){var S,T,N,E,k;for(b==null&&(b=n),T=m.length,k=x,N=m[x],S=2*x+1;S<T;)E=S+1,E<T&&!(b(m[S],m[E])<0)&&(S=E),m[x]=m[S],x=S,S=2*x+1;return m[x]=N,_(m,k,x,b)},r=(function(){m.push=a,m.pop=o,m.replace=u,m.pushpop=l,m.heapify=s,m.updateItem=y,m.nlargest=g,m.nsmallest=f;function m(x){this.cmp=x??n,this.nodes=[]}return m.prototype.push=function(x){return a(this.nodes,x,this.cmp)},m.prototype.pop=function(){return o(this.nodes,this.cmp)},m.prototype.peek=function(){return this.nodes[0]},m.prototype.contains=function(x){return this.nodes.indexOf(x)!==-1},m.prototype.replace=function(x){return u(this.nodes,x,this.cmp)},m.prototype.pushpop=function(x){return l(this.nodes,x,this.cmp)},m.prototype.heapify=function(){return s(this.nodes,this.cmp)},m.prototype.updateItem=function(x){return y(this.nodes,x,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 x;return x=new m,x.nodes=this.nodes.slice(0),x},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,x){return t.exports=x()})(this,function(){return r})}).call(Z3)})(vc)),vc.exports}var Nf,ix;function eT(){return ix||(ix=1,Nf=J3()),Nf}var tT=eT(),Dl=Tl(tT),rT=Ir({root:null,weight:function(e){return 1},directed:!1}),nT={dijkstra:function(e){if(!Pt(e)){var r=arguments;e={root:r[0],weight:r[1],directed:r[2]}}var n=rT(e),i=n.root,s=n.weight,o=n.directed,a=this,l=s,u=dt(i)?this.filter(i)[0]:i[0],c={},d={},g={},f=this.byGroup(),y=f.nodes,_=f.edges;_.unmergeBy(function(M){return M.isLoop()});for(var v=function(U){return c[U.id()]},m=function(U,H){c[U.id()]=H,x.updateItem(U)},x=new Dl(function(M,U){return v(M)-v(U)}),b=0;b<y.length;b++){var S=y[b];c[S.id()]=S.same(u)?0:1/0,x.push(S)}for(var T=function(U,H){for(var $=(o?U.edgesTo(H):U.edgesWith(H)).intersect(_),F=1/0,P,z=0;z<$.length;z++){var G=$[z],V=l(G);(V<F||!P)&&(F=V,P=G)}return{edge:P,dist:F}};x.size()>0;){var N=x.pop(),E=v(N),k=N.id();if(g[k]=E,E!==1/0)for(var L=N.neighborhood().intersect(y),A=0;A<L.length;A++){var I=L[A],O=I.id(),B=T(N,I),D=E+B.dist;D<v(I)&&(m(I,D),d[O]={node:N,edge:B.edge})}}return{distanceTo:function(U){var H=dt(U)?y.filter(U)[0]:U[0];return g[H.id()]},pathTo:function(U){var H=dt(U)?y.filter(U)[0]:U[0],$=[],F=H,P=F.id();if(H.length>0)for($.unshift(H);d[P];){var z=d[P];$.unshift(z.edge),$.unshift(z.node),F=z.node,P=F.id()}return a.spawn($)}}}},iT={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 T=0;T<o.length;T++){var N=o[T];if(N.has(S))return T}},u=0;u<s;u++)o[u]=this.spawn(n[u]);for(var c=i.sort(function(b,S){return e(b)-e(S)}),d=0;d<c.length;d++){var g=c[d],f=g.source()[0],y=g.target()[0],_=l(f),v=l(y),m=o[_],x=o[v];_!==v&&(a.merge(g),m.merge(x),o.splice(v,1))}return a}},aT=Ir({root:null,goal:null,weight:function(e){return 1},heuristic:function(e){return 0},directed:!1}),sT={aStar:function(e){var r=this.cy(),n=aT(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(),d={},g={},f={},y=new Dl(function(P,z){return g[P.id()]-g[z.id()]}),_=new Qs,v={},m={},x=function(z,G){y.push(z),_.add(G)},b,S,T=function(){b=y.pop(),S=b.id(),_.delete(S)},N=function(z){return _.has(z)};x(i,u),d[u]=0,g[u]=o(i);for(var E=0;y.size()>0;){if(T(),E++,S===c){for(var k=[],L=s,A=c,I=m[A];k.unshift(L),I!=null&&k.unshift(I),L=v[A],L!=null;)A=L.id(),I=m[A];return{found:!0,distance:d[S],path:this.spawn(k),steps:E}}f[S]=!0;for(var O=b._private.edges,B=0;B<O.length;B++){var D=O[B];if(this.hasElementWithId(D.id())&&!(a&&D.data("source")!==S)){var M=D.source(),U=D.target(),H=M.id()!==S?M:U,$=H.id();if(this.hasElementWithId($)&&!f[$]){var F=d[S]+l(D);if(!N($)){d[$]=F,g[$]=F+o(H),x(H,$),v[$]=b,m[$]=D;continue}F<d[$]&&(d[$]=F,g[$]=F+o(H),y.updateItem(H),v[$]=b,m[$]=D)}}}}return{found:!1,distance:void 0,path:void 0,steps:E}}},oT=Ir({weight:function(e){return 1},directed:!1}),lT={floydWarshall:function(e){for(var r=this.cy(),n=oT(e),i=n.weight,s=n.directed,o=i,a=this.byGroup(),l=a.nodes,u=a.edges,c=l.length,d=c*c,g=function(V){return l.indexOf(V)},f=function(V){return l[V]},y=new Array(d),_=0;_<d;_++){var v=_%c,m=(_-v)/c;m===v?y[_]=0:y[_]=1/0}for(var x=new Array(d),b=new Array(d),S=0;S<u.length;S++){var T=u[S],N=T.source()[0],E=T.target()[0];if(N!==E){var k=g(N),L=g(E),A=k*c+L,I=o(T);if(y[A]>I&&(y[A]=I,x[A]=L,b[A]=T),!s){var O=L*c+k;!s&&y[O]>I&&(y[O]=I,x[O]=k,b[O]=T)}}}for(var B=0;B<c;B++)for(var D=0;D<c;D++)for(var M=D*c+B,U=0;U<c;U++){var H=D*c+U,$=B*c+U;y[M]+y[$]<y[H]&&(y[H]=y[M]+y[$],x[H]=x[M])}var F=function(V){return(dt(V)?r.filter(V):V)[0]},P=function(V){return g(F(V))},z={distance:function(V,te){var ie=P(V),ne=P(te);return y[ie*c+ne]},path:function(V,te){var ie=P(V),ne=P(te),X=f(ie);if(ie===ne)return X.collection();if(x[ie*c+ne]==null)return r.collection();var q=r.collection(),Y=ie,K;for(q.merge(X);ie!==ne;)Y=ie,ie=x[ie*c+ne],K=b[Y*c+ie],q.merge(K),q.merge(f(ie));return q}};return z}},uT=Ir({weight:function(e){return 1},directed:!1,root:null}),cT={bellmanFord:function(e){var r=this,n=uT(e),i=n.weight,s=n.directed,o=n.root,a=i,l=this,u=this.cy(),c=this.byGroup(),d=c.edges,g=c.nodes,f=g.length,y=new yi,_=!1,v=[];o=u.collection(o)[0],d.unmergeBy(function(_e){return _e.isLoop()});for(var m=d.length,x=function(Te){var Le=y.get(Te.id());return Le||(Le={},y.set(Te.id(),Le)),Le},b=function(Te){return(dt(Te)?u.$(Te):Te)[0]},S=function(Te){return x(b(Te)).dist},T=function(Te){for(var Le=arguments.length>1&&arguments[1]!==void 0?arguments[1]:o,Ee=b(Te),Pe=[],ze=Ee;;){if(ze==null)return r.spawn();var Me=x(ze),Ue=Me.edge,Ge=Me.pred;if(Pe.unshift(ze[0]),ze.same(Le)&&Pe.length>0)break;Ue!=null&&Pe.unshift(Ue),ze=Ge}return l.spawn(Pe)},N=0;N<f;N++){var E=g[N],k=x(E);E.same(o)?k.dist=0:k.dist=1/0,k.pred=null,k.edge=null}for(var L=!1,A=function(Te,Le,Ee,Pe,ze,Me){var Ue=Pe.dist+Me;Ue<ze.dist&&!Ee.same(Pe.edge)&&(ze.dist=Ue,ze.pred=Te,ze.edge=Ee,L=!0)},I=1;I<f;I++){L=!1;for(var O=0;O<m;O++){var B=d[O],D=B.source(),M=B.target(),U=a(B),H=x(D),$=x(M);A(D,M,B,H,$,U),s||A(M,D,B,$,H,U)}if(!L)break}if(L)for(var F=[],P=0;P<m;P++){var z=d[P],G=z.source(),V=z.target(),te=a(z),ie=x(G).dist,ne=x(V).dist;if(ie+te<ne||!s&&ne+te<ie)if(_||(zt("Graph contains a negative weight cycle for Bellman-Ford"),_=!0),e.findNegativeWeightCycles!==!1){var X=[];ie+te<ne&&X.push(G),!s&&ne+te<ie&&X.push(V);for(var q=X.length,Y=0;Y<q;Y++){var K=X[Y],ee=[K];ee.push(x(K).edge);for(var re=x(K).pred;ee.indexOf(re)===-1;)ee.push(re),ee.push(x(re).edge),re=x(re).pred;ee=ee.slice(ee.indexOf(re));for(var ue=ee[0].id(),pe=0,Re=2;Re<ee.length;Re+=2)ee[Re].id()<ue&&(ue=ee[Re].id(),pe=Re);ee=ee.slice(pe).concat(ee.slice(0,pe)),ee.push(ee[0]);var Be=ee.map(function(_e){return _e.id()}).join(",");F.indexOf(Be)===-1&&(v.push(l.spawn(ee)),F.push(Be))}}else break}return{distanceTo:S,pathTo:T,hasNegativeWeightCycle:_,negativeWeightCycles:v}}},dT=Math.sqrt(2),hT=function(e,r,n){n.length===0&&ir("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 d=u[c],g=d[1],f=d[2];(r[g]===a&&r[f]===l||r[g]===l&&r[f]===a)&&u.splice(c,1)}for(var y=0;y<u.length;y++){var _=u[y];_[1]===l?(u[y]=_.slice(),u[y][1]=a):_[2]===l&&(u[y]=_.slice(),u[y][2]=a)}for(var v=0;v<r.length;v++)r[v]===l&&(r[v]=a);return u},Rf=function(e,r,n,i){for(;n>i;){var s=Math.floor(Math.random()*r.length);r=hT(s,e,r),n--}return r},fT={kargerStein:function(){var e=this,r=this.byGroup(),n=r.nodes,i=r.edges;i.unmergeBy(function($){return $.isLoop()});var s=n.length,o=i.length,a=Math.ceil(Math.pow(Math.log(s)/Math.LN2,2)),l=Math.floor(s/dT);if(s<2){ir("At least 2 nodes are required for Karger-Stein algorithm");return}for(var u=[],c=0;c<o;c++){var d=i[c];u.push([c,n.indexOf(d.source()),n.indexOf(d.target())])}for(var g=1/0,f=[],y=new Array(s),_=new Array(s),v=new Array(s),m=function(F,P){for(var z=0;z<s;z++)P[z]=F[z]},x=0;x<=a;x++){for(var b=0;b<s;b++)_[b]=b;var S=Rf(_,u.slice(),s,l),T=S.slice();m(_,v);var N=Rf(_,S,l,2),E=Rf(v,T,l,2);N.length<=E.length&&N.length<g?(g=N.length,f=N,m(_,y)):E.length<=N.length&&E.length<g&&(g=E.length,f=E,m(v,y))}for(var k=this.spawn(f.map(function($){return i[$[0]]})),L=this.spawn(),A=this.spawn(),I=y[0],O=0;O<y.length;O++){var B=y[O],D=n[O];B===I?L.merge(D):A.merge(D)}var M=function(F){var P=e.spawn();return F.forEach(function(z){P.merge(z),z.connectedEdges().forEach(function(G){e.contains(G)&&!k.contains(G)&&P.merge(G)})}),P},U=[M(L),M(A)],H={cut:k,components:U,partition1:L,partition2:A};return H}},Lf,pT=function(e){return{x:e.x,y:e.y}},Jc=function(e,r,n){return{x:e.x*r+n.x,y:e.y*r+n.y}},Qw=function(e,r,n){return{x:(e.x-n.x)/r,y:(e.y-n.y)/r}},Bs=function(e){return{x:e[0],y:e[1]}},gT=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},vT=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},mT=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},yT=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(g,f){return g-f});var c=e.length,d=Math.floor(c/2);return c%2!==0?e[d+1+a]:(e[d-1+a]+e[d+a])/2},Zw=function(e,r){return r===0?e:Zw(r,e%r)},xT=function(e){for(var r=e[0],n=0;n<e.length;n++)if(Mw(e[n]))n>0&&(r=Zw(r,e[n]));else return 0;return r},bT=function(e){return Math.PI*e/180},Qu=function(e,r){return Math.atan2(r,e)-Math.PI/2},lv=Math.log2||function(t){return Math.log(t)/Math.log(2)},uv=function(e){return e>0?1:e<0?-1:0},Wa=function(e,r){return Math.sqrt(Ia(e,r))},Ia=function(e,r){var n=r.x-e.x,i=r.y-e.y;return n*n+i*i},wT=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},Nr=function(e,r,n,i){return(1-i)*(1-i)*e+2*(1-i)*i*r+i*i*n},Hs=function(e,r,n,i){return{x:Nr(e.x,r.x,n.x,i),y:Nr(e.y,r.y,n.y,i)}},_T=function(e,r,n,i){var s={x:r.x-e.x,y:r.y-e.y},o=Wa(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}},gl=function(e,r,n){return Math.max(e,Math.min(n,r))},Zr=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}}},ST=function(e){return{x1:e.x1,x2:e.x2,w:e.w,y1:e.y1,y2:e.y2,h:e.h}},CT=function(e){e.x1=1/0,e.y1=1/0,e.x2=-1/0,e.y2=-1/0,e.w=0,e.h=0},kT=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},Jw=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},mc=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},yc=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=yr(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},ax=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},cv=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)},Xi=function(e,r,n){return e.x1<=r&&r<=e.x2&&e.y1<=n&&n<=e.y2},sx=function(e,r){return Xi(e,r.x,r.y)},e_=function(e,r){return Xi(e,r.x1,r.y1)&&Xi(e,r.x2,r.y2)},ET=(Lf=Math.hypot)!==null&&Lf!==void 0?Lf:function(t,e){return Math.sqrt(t*t+e*e)};function TT(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=ET(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],O=k[(A+1)%k.length];L+=I.x*O.y-O.x*I.y}return L/2},l=function(k,L,A,I){var O=n(L,k),B=n(I,A),D=s(O,B);if(Math.abs(D)<1e-9)return r(k,i(O,.5));var M=s(n(A,k),B)/D;return r(k,i(O,M))},u=t.map(function(E){return{x:E.x,y:E.y}});a(u)<0&&u.reverse();for(var c=u.length,d=[],g=0;g<c;g++){var f=u[g],y=u[(g+1)%c],_=n(y,f),v=o({x:_.y,y:-_.x});d.push(v)}for(var m=d.map(function(E,k){var L=r(u[k],i(E,e)),A=r(u[(k+1)%c],i(E,e));return{p1:L,p2:A}}),x=[],b=0;b<c;b++){var S=m[(b-1+c)%c],T=m[b],N=l(S.p1,S.p2,T.p1,T.p2);x.push(N)}return x}function NT(t,e,r,n,i,s){var o=BT(t,e,r,n,i),a=TT(o,s),l=Zr();return a.forEach(function(u){return Jw(l,u.x,u.y)}),l}var t_=function(e,r,n,i,s,o,a){var l=arguments.length>7&&arguments[7]!==void 0?arguments[7]:"auto",u=l==="auto"?ra(s,o):l,c=s/2,d=o/2;u=Math.min(u,c,d);var g=u!==c,f=u!==d,y;if(g){var _=n-c+u-a,v=i-d-a,m=n+c-u+a,x=v;if(y=Qi(e,r,n,i,_,v,m,x,!1),y.length>0)return y}if(f){var b=n+c+a,S=i-d+u-a,T=b,N=i+d-u+a;if(y=Qi(e,r,n,i,b,S,T,N,!1),y.length>0)return y}if(g){var E=n-c+u-a,k=i+d+a,L=n+c-u+a,A=k;if(y=Qi(e,r,n,i,E,k,L,A,!1),y.length>0)return y}if(f){var I=n-c-a,O=i-d+u-a,B=I,D=i+d-u+a;if(y=Qi(e,r,n,i,I,O,B,D,!1),y.length>0)return y}var M;{var U=n-c+u,H=i-d+u;if(M=tl(e,r,n,i,U,H,u+a),M.length>0&&M[0]<=U&&M[1]<=H)return[M[0],M[1]]}{var $=n+c-u,F=i-d+u;if(M=tl(e,r,n,i,$,F,u+a),M.length>0&&M[0]>=$&&M[1]<=F)return[M[0],M[1]]}{var P=n+c-u,z=i+d-u;if(M=tl(e,r,n,i,P,z,u+a),M.length>0&&M[0]>=P&&M[1]>=z)return[M[0],M[1]]}{var G=n-c+u,V=i+d-u;if(M=tl(e,r,n,i,G,V,u+a),M.length>0&&M[0]<=G&&M[1]>=V)return[M[0],M[1]]}return[]},RT=function(e,r,n,i,s,o,a){var l=a,u=Math.min(n,s),c=Math.max(n,s),d=Math.min(i,o),g=Math.max(i,o);return u-l<=e&&e<=c+l&&d-l<=r&&r<=g+l},LT=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)},DT=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]},AT=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,d,g,f,y;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,f=r/3,a>0){d=u+Math.sqrt(a),d=d<0?-Math.pow(-d,1/3):Math.pow(d,1/3),g=u-Math.sqrt(a),g=g<0?-Math.pow(-g,1/3):Math.pow(g,1/3),s[0]=-f+d+g,f+=(d+g)/2,s[4]=s[2]=-f,f=Math.sqrt(3)*(-g+d)/2,s[3]=f,s[5]=-f;return}if(s[5]=s[3]=0,a===0){y=u<0?-Math.pow(-u,1/3):Math.pow(u,1/3),s[0]=-f+2*y,s[4]=s[2]=-(y+f);return}l=-l,c=l*l*l,c=Math.acos(u/Math.sqrt(c)),y=2*Math.sqrt(l),s[0]=-f+y*Math.cos(c/3),s[2]=-f+y*Math.cos((c+2*Math.PI)/3),s[4]=-f+y*Math.cos((c+4*Math.PI)/3)},PT=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,d=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,g=1*n*s-n*n+n*e-s*e+i*o-i*i+i*r-o*r,f=[];AT(u,c,d,g,f);for(var y=1e-7,_=[],v=0;v<6;v+=2)Math.abs(f[v+1])<y&&f[v]>=0&&f[v]<=1&&_.push(f[v]);_.push(1),_.push(0);for(var m=-1,x,b,S,T=0;T<_.length;T++)x=Math.pow(1-_[T],2)*n+2*(1-_[T])*_[T]*s+_[T]*_[T]*a,b=Math.pow(1-_[T],2)*i+2*(1-_[T])*_[T]*o+_[T]*_[T]*l,S=Math.pow(x-e,2)+Math.pow(b-r,2),m>=0?S<m&&(m=S):m=S;return m},MT=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],d=a[0]*l[0]+a[1]*l[1],g=d*d/u;return d<0?c:g>u?(e-s)*(e-s)+(r-o)*(r-o):c-g},ln=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},bi=function(e,r,n,i,s,o,a,l,u){var c=new Array(n.length),d;l[0]!=null?(d=Math.atan(l[1]/l[0]),l[0]<0?d=d+Math.PI/2:d=-d-Math.PI/2):d=l;for(var g=Math.cos(-d),f=Math.sin(-d),y=0;y<c.length/2;y++)c[y*2]=o/2*(n[y*2]*g-n[y*2+1]*f),c[y*2+1]=a/2*(n[y*2+1]*g+n[y*2]*f),c[y*2]+=i,c[y*2+1]+=s;var _;if(u>0){var v=Oc(c,-u);_=Ic(v)}else _=c;return ln(e,r,_)},IT=function(e,r,n,i,s,o,a,l){for(var u=new Array(n.length*2),c=0;c<l.length;c++){var d=l[c];u[c*4+0]=d.startX,u[c*4+1]=d.startY,u[c*4+2]=d.stopX,u[c*4+3]=d.stopY;var g=Math.pow(d.cx-e,2)+Math.pow(d.cy-r,2);if(g<=Math.pow(d.radius,2))return!0}return ln(e,r,u)},Ic=function(e){for(var r=new Array(e.length/2),n,i,s,o,a,l,u,c,d=0;d<e.length/4;d++){n=e[d*4],i=e[d*4+1],s=e[d*4+2],o=e[d*4+3],d<e.length/4-1?(a=e[(d+1)*4],l=e[(d+1)*4+1],u=e[(d+1)*4+2],c=e[(d+1)*4+3]):(a=e[0],l=e[1],u=e[2],c=e[3]);var g=Qi(n,i,s,o,a,l,u,c,!0);r[d*2]=g[0],r[d*2+1]=g[1]}return r},Oc=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),d=Math.sqrt(u*u+c*c),g=u/d,f=c/d;n[l*4]=i+g*r,n[l*4+1]=s+f*r,n[l*4+2]=o+g*r,n[l*4+3]=a+f*r}return n},OT=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 d=c/u;return[(n-e)*d+e,(i-r)*d+r]},za=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},tl=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],d=2*(u[0]*l[0]+u[1]*l[1]),g=u[0]*u[0]+u[1]*u[1]-a*a,f=d*d-4*c*g;if(f<0)return[];var y=(-d+Math.sqrt(f))/(2*c),_=(-d-Math.sqrt(f))/(2*c),v=Math.min(y,_),m=Math.max(y,_),x=[];if(v>=0&&v<=1&&x.push(v),m>=0&&m<=1&&x.push(m),x.length===0)return[];var b=x[0]*l[0]+e,S=x[0]*l[1]+r;if(x.length>1){if(x[0]==x[1])return[b,S];var T=x[1]*l[0]+e,N=x[1]*l[1]+r;return[b,S,T,N]}else return[b,S]},Df=function(e,r,n){return r<=e&&e<=n||n<=e&&e<=r?e:e<=r&&r<=n||n<=r&&r<=e?r:n},Qi=function(e,r,n,i,s,o,a,l,u){var c=e-s,d=n-e,g=a-s,f=r-o,y=i-r,_=l-o,v=g*f-_*c,m=d*f-y*c,x=_*d-g*y;if(x!==0){var b=v/x,S=m/x,T=.001,N=0-T,E=1+T;return N<=b&&b<=E&&N<=S&&S<=E?[e+b*d,r+b*y]:u?[e+b*d,r+b*y]:[]}else return v===0||m===0?Df(e,n,a)===a?[a,l]:Df(e,n,s)===s?[s,o]:Df(s,a,n)===n?[n,i]:[]:[]},BT=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 d=1;d<e.length/2;d++)o.push({x:u+a*e[d*2],y:c+l*e[d*2+1]});return o},vl=function(e,r,n,i,s,o,a,l){var u=[],c,d=new Array(n.length),g=!0;o==null&&(g=!1);var f;if(g){for(var y=0;y<d.length/2;y++)d[y*2]=n[y*2]*o+i,d[y*2+1]=n[y*2+1]*a+s;if(l>0){var _=Oc(d,-l);f=Ic(_)}else f=d}else f=n;for(var v,m,x,b,S=0;S<f.length/2;S++)v=f[S*2],m=f[S*2+1],S<f.length/2-1?(x=f[(S+1)*2],b=f[(S+1)*2+1]):(x=f[0],b=f[1]),c=Qi(e,r,i,s,v,m,x,b),c.length!==0&&u.push(c[0],c[1]);return u},jT=function(e,r,n,i,s,o,a,l,u){var c=[],d,g=new Array(n.length*2);u.forEach(function(x,b){b===0?(g[g.length-2]=x.startX,g[g.length-1]=x.startY):(g[b*4-2]=x.startX,g[b*4-1]=x.startY),g[b*4]=x.stopX,g[b*4+1]=x.stopY,d=tl(e,r,i,s,x.cx,x.cy,x.radius),d.length!==0&&c.push(d[0],d[1])});for(var f=0;f<g.length/4;f++)d=Qi(e,r,i,s,g[f*4],g[f*4+1],g[f*4+2],g[f*4+3],!1),d.length!==0&&c.push(d[0],d[1]);if(c.length>2){for(var y=[c[0],c[1]],_=Math.pow(y[0]-e,2)+Math.pow(y[1]-r,2),v=1;v<c.length/2;v++){var m=Math.pow(c[v*2]-e,2)+Math.pow(c[v*2+1]-r,2);m<=_&&(y[0]=c[v*2],y[1]=c[v*2+1],_=m)}return y}return c},Zu=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]]},Kr=function(e,r){var n=yg(e,r);return n=r_(n),n},r_=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),d=2/(l-o),g=0;g<i;g++)r=e[2*g]=e[2*g]*c,n=e[2*g+1]=e[2*g+1]*d,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 f=0;f<i;f++)n=e[2*f+1]=e[2*f+1]+(-1-o);return e},yg=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},ra=function(e,r){return Math.min(e/4,r/4,8)},n_=function(e,r){return Math.min(e/10,r/10,8)},dv=function(){return 8},FT=function(e,r,n){return[e-2*r+n,2*(r-e),e]},xg=function(e,r){return{heightOffset:Math.min(15,.05*r),widthOffset:Math.min(100,.25*e),ctrlPtOffsetPct:.05}};function Af(t,e){function r(d){for(var g=[],f=0;f<d.length;f++){var y=d[f],_=d[(f+1)%d.length],v={x:_.x-y.x,y:_.y-y.y},m={x:-v.y,y:v.x},x=Math.sqrt(m.x*m.x+m.y*m.y);g.push({x:m.x/x,y:m.y/x})}return g}function n(d,g){var f=1/0,y=-1/0,_=un(d),v;try{for(_.s();!(v=_.n()).done;){var m=v.value,x=m.x*g.x+m.y*g.y;f=Math.min(f,x),y=Math.max(y,x)}}catch(b){_.e(b)}finally{_.f()}return{min:f,max:y}}function i(d,g){return!(d.max<g.min||g.max<d.min)}var s=[].concat(Dc(r(t)),Dc(r(e))),o=un(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(d){o.e(d)}finally{o.f()}return!0}var zT=Ir({dampingFactor:.8,precision:1e-6,iterations:200,weight:function(e){return 1}}),HT={pageRank:function(e){for(var r=zT(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,d=u.length,g=d*d,f=c.length,y=new Array(g),_=new Array(d),v=(1-n)/d,m=0;m<d;m++){for(var x=0;x<d;x++){var b=m*d+x;y[b]=0}_[m]=0}for(var S=0;S<f;S++){var T=c[S],N=T.data("source"),E=T.data("target");if(N!==E){var k=u.indexOfId(N),L=u.indexOfId(E),A=o(T),I=L*d+k;y[I]+=A,_[k]+=A}}for(var O=1/d+v,B=0;B<d;B++)if(_[B]===0)for(var D=0;D<d;D++){var M=D*d+B;y[M]=O}else for(var U=0;U<d;U++){var H=U*d+B;y[H]=y[H]/_[B]+v}for(var $=new Array(d),F=new Array(d),P,z=0;z<d;z++)$[z]=1;for(var G=0;G<s;G++){for(var V=0;V<d;V++)F[V]=0;for(var te=0;te<d;te++)for(var ie=0;ie<d;ie++){var ne=te*d+ie;F[te]+=y[ne]*$[ie]}wT(F),P=$,$=F,F=P;for(var X=0,q=0;q<d;q++){var Y=P[q]-$[q];X+=Y*Y}if(X<i)break}var K={rank:function(re){return re=a.collection(re)[0],$[u.indexOf(re)]}};return K}},ox=Ir({root:null,weight:function(e){return 1},directed:!1,alpha:0}),Us={degreeCentralityNormalized:function(e){e=ox(e);var r=this.cy(),n=this.nodes(),i=n.length;if(e.directed){for(var c={},d={},g=0,f=0,y=0;y<i;y++){var _=n[y],v=_.id();e.root=_;var m=this.degreeCentrality(e);g<m.indegree&&(g=m.indegree),f<m.outdegree&&(f=m.outdegree),c[v]=m.indegree,d[v]=m.outdegree}return{indegree:function(b){return g==0?0:(dt(b)&&(b=r.filter(b)),c[b.id()]/g)},outdegree:function(b){return f===0?0:(dt(b)&&(b=r.filter(b)),d[b.id()]/f)}}}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:(dt(b)&&(b=r.filter(b)),s[b.id()]/o)}}}},degreeCentrality:function(e){e=ox(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 f=s.connectedEdges(),y=f.filter(function(N){return N.target().same(s)&&n.has(N)}),_=f.filter(function(N){return N.source().same(s)&&n.has(N)}),v=y.length,m=_.length,x=0,b=0,S=0;S<y.length;S++)x+=o(y[S]);for(var T=0;T<_.length;T++)b+=o(_[T]);return{indegree:Math.pow(v,1-l)*Math.pow(x,l),outdegree:Math.pow(m,1-l)*Math.pow(b,l)}}else{for(var u=s.connectedEdges().intersection(n),c=u.length,d=0,g=0;g<u.length;g++)d+=o(u[g]);return{degree:Math.pow(c,1-l)*Math.pow(d,l)}}}};Us.dc=Us.degreeCentrality;Us.dcn=Us.degreeCentralityNormalised=Us.degreeCentralityNormalized;var lx=Ir({harmonic:!0,weight:function(){return 1},directed:!1,root:null}),$s={closenessCentralityNormalized:function(e){for(var r=lx(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}),d=0;d<u.length;d++){for(var g=0,f=u[d],y=0;y<u.length;y++)if(d!==y){var _=c.distance(f,u[y]);n?g+=1/_:g+=_}n||(g=1/g),l<g&&(l=g),a[f.id()]=g}return{closeness:function(m){return l==0?0:(dt(m)?m=o.filter(m)[0].id():m=m.id(),a[m]/l)}}},closenessCentrality:function(e){var r=lx(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 d=u[c];if(!d.same(n)){var g=a.distanceTo(d);o?l+=1/g:l+=g}}return o?l:1/l}};$s.cc=$s.closenessCentrality;$s.ccn=$s.closenessCentralityNormalised=$s.closenessCentralityNormalized;var UT=Ir({weight:null,directed:!1}),bg={betweennessCentrality:function(e){for(var r=UT(e),n=r.directed,i=r.weight,s=i!=null,o=this.cy(),a=this.nodes(),l={},u={},c=0,d={set:function(b,S){u[b]=S,S>c&&(c=S)},get:function(b){return u[b]}},g=0;g<a.length;g++){var f=a[g],y=f.id();n?l[y]=f.outgoers().nodes():l[y]=f.openNeighborhood().nodes(),d.set(y,0)}for(var _=function(){for(var b=a[v].id(),S=[],T={},N={},E={},k=new Dl(function(te,ie){return E[te]-E[ie]}),L=0;L<a.length;L++){var A=a[L].id();T[A]=[],N[A]=0,E[A]=1/0}for(N[b]=1,E[b]=0,k.push(b);!k.empty();){var I=k.pop();if(S.push(I),s)for(var O=0;O<l[I].length;O++){var B=l[I][O],D=o.getElementById(I),M=void 0;D.edgesTo(B).length>0?M=D.edgesTo(B)[0]:M=B.edgesTo(D)[0];var U=i(M);B=B.id(),E[B]>E[I]+U&&(E[B]=E[I]+U,k.nodes.indexOf(B)<0?k.push(B):k.updateItem(B),N[B]=0,T[B]=[]),E[B]==E[I]+U&&(N[B]=N[B]+N[I],T[B].push(I))}else for(var H=0;H<l[I].length;H++){var $=l[I][H].id();E[$]==1/0&&(k.push($),E[$]=E[I]+1),E[$]==E[I]+1&&(N[$]=N[$]+N[I],T[$].push(I))}}for(var F={},P=0;P<a.length;P++)F[a[P].id()]=0;for(;S.length>0;){for(var z=S.pop(),G=0;G<T[z].length;G++){var V=T[z][G];F[V]=F[V]+N[V]/N[z]*(1+F[z])}z!=a[v].id()&&d.set(z,d.get(z)+F[z])}},v=0;v<a.length;v++)_();var m={betweenness:function(b){var S=o.collection(b).id();return d.get(S)},betweennessNormalized:function(b){if(c==0)return 0;var S=o.collection(b).id();return d.get(S)/c}};return m.betweennessNormalised=m.betweennessNormalized,m}};bg.bc=bg.betweennessCentrality;var $T=Ir({expandFactor:2,inflateFactor:2,multFactor:1,maxIterations:20,attributes:[function(t){return 1}]}),WT=function(e){return $T(e)},VT=function(e,r){for(var n=0,i=0;i<r.length;i++)n+=r[i](e);return n},GT=function(e,r,n){for(var i=0;i<r;i++)e[i*r+i]=n},i_=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}},qT=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},YT=function(e,r,n){for(var i=e.slice(0),s=1;s<n;s++)e=qT(e,i,r);return e},KT=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 i_(i,r),i},XT=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},QT=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},ZT=function(e,r){for(var n=0;n<e.length;n++)if(!r[n]||e[n].id()!==r[n].id())return!1;return!0},JT=function(e){for(var r=0;r<e.length;r++)for(var n=0;n<e.length;n++)r!=n&&ZT(e[r],e[n])&&e.splice(n,1);return e},ux=function(e){for(var r=this.nodes(),n=this.edges(),i=this.cy(),s=WT(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),d,g=0;g<u;g++)c[g]=0;for(var f=0;f<n.length;f++){var y=n[f],_=o[y.source().id()],v=o[y.target().id()],m=VT(y,s.attributes);c[_*l+v]+=m,c[v*l+_]+=m}GT(c,l,s.multFactor),i_(c,l);for(var x=!0,b=0;x&&b<s.maxIterations;)x=!1,d=YT(c,l,s.expandFactor),c=KT(d,l,s.inflateFactor),XT(c,d,u,4)||(x=!0),b++;var S=QT(c,l,r,i);return S=JT(S),S},eN={markovClustering:ux,mcl:ux},tN=function(e){return e},a_=function(e,r){return Math.abs(r-e)},cx=function(e,r,n){return e+a_(r,n)},dx=function(e,r,n){return e+Math.pow(n-r,2)},rN=function(e){return Math.sqrt(e)},nN=function(e,r,n){return Math.max(e,a_(r,n))},Ho=function(e,r,n,i,s){for(var o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:tN,a=i,l,u,c=0;c<e;c++)l=r(c),u=n(c),a=s(a,l,u);return o(a)},Gs={euclidean:function(e,r,n){return e>=2?Ho(e,r,n,0,dx,rN):Ho(e,r,n,0,cx)},squaredEuclidean:function(e,r,n){return Ho(e,r,n,0,dx)},manhattan:function(e,r,n){return Ho(e,r,n,0,cx)},max:function(e,r,n){return Ho(e,r,n,-1/0,nN)}};Gs["squared-euclidean"]=Gs.squaredEuclidean;Gs.squaredeuclidean=Gs.squaredEuclidean;function ed(t,e,r,n,i,s){var o;return lr(t)?o=t:o=Gs[t]||Gs.euclidean,e===0&&lr(t)?o(i,s):o(e,r,n,i,s)}var iN=Ir({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),hv=function(e){return iN(e)},Bc=function(e,r,n,i,s){var o=s!=="kMedoids",a=o?function(d){return n[d]}:function(d){return i[d](n)},l=function(g){return i[g](r)},u=n,c=r;return ed(e,i.length,a,l,u,c)},Pf=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 d=0;d<i;d++)l[d]=Math.random()*(o[d]-s[d])+s[d];a[c]=l}return a},s_=function(e,r,n,i,s){for(var o=1/0,a=0,l=0;l<r.length;l++){var u=Bc(n,e,r[l],i,s);u<o&&(o=u,a=l)}return a},o_=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},aN=function(e,r,n){return Math.abs(r-e)<=n},sN=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},oN=function(e,r,n){for(var i=0;i<n;i++)if(e===r[i])return!0;return!1},hx=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)];oN(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},fx=function(e,r,n){for(var i=0,s=0;s<r.length;s++)i+=Bc("manhattan",r[s],e,n,"kMedoids");return i},lN=function(e){var r=this.cy(),n=this.nodes(),i=null,s=hv(e),o=new Array(s.k),a={},l;s.testMode?typeof s.testCentroids=="number"?(s.testCentroids,l=Pf(n,s.k,s.attributes)):Sr(s.testCentroids)==="object"?l=s.testCentroids:l=Pf(n,s.k,s.attributes):l=Pf(n,s.k,s.attributes);for(var u=!0,c=0;u&&c<s.maxIterations;){for(var d=0;d<n.length;d++)i=n[d],a[i.id()]=s_(i,l,s.distance,s.attributes,"kMeans");u=!1;for(var g=0;g<s.k;g++){var f=o_(g,n,a);if(f.length!==0){for(var y=s.attributes.length,_=l[g],v=new Array(y),m=new Array(y),x=0;x<y;x++){m[x]=0;for(var b=0;b<f.length;b++)i=f[b],m[x]+=s.attributes[x](i);v[x]=m[x]/f.length,aN(v[x],_[x],s.sensitivityThreshold)||(u=!0)}l[g]=v,o[g]=r.collection(f)}}c++}return o},uN=function(e){var r=this.cy(),n=this.nodes(),i=null,s=hv(e),o=new Array(s.k),a,l={},u,c=new Array(s.k);s.testMode?typeof s.testCentroids=="number"||(Sr(s.testCentroids)==="object"?a=s.testCentroids:a=hx(n,s.k)):a=hx(n,s.k);for(var d=!0,g=0;d&&g<s.maxIterations;){for(var f=0;f<n.length;f++)i=n[f],l[i.id()]=s_(i,a,s.distance,s.attributes,"kMedoids");d=!1;for(var y=0;y<a.length;y++){var _=o_(y,n,l);if(_.length!==0){c[y]=fx(a[y],_,s.attributes);for(var v=0;v<_.length;v++)u=fx(_[v],_,s.attributes),u<c[y]&&(c[y]=u,a[y]=_[v],d=!0);o[y]=r.collection(_)}}g++}return o},cN=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 d=0;d<s.attributes.length;d++){o=0,a=0;for(var g=0;g<r.length;g++)o+=i[g][c]*s.attributes[d](r[g]),a+=i[g][c];e[c][d]=o/a}},dN=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),d=0;d<n.length;d++)for(var g=0;g<i.length;g++){a=0;for(var f=0;f<n.length;f++)l=Bc(s.distance,i[g],n[d],s.attributes,"cmeans"),u=Bc(s.distance,i[g],n[f],s.attributes,"cmeans"),a+=Math.pow(l/u,c);e[g][d]=1/a}},hN=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 d=0;d<s.length;d++)s[d]=i.collection(s[d]);return s},px=function(e){var r=this.cy(),n=this.nodes(),i=hv(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 d=0;d<n.length;d++)a[d]=new Array(i.k);for(var g=0;g<n.length;g++){for(var f=0,y=0;y<i.k;y++)a[g][y]=Math.random(),f+=a[g][y];for(var _=0;_<i.k;_++)a[g][_]=a[g][_]/f}o=new Array(i.k);for(var v=0;v<i.k;v++)o[v]=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 x=!0,b=0;x&&b<i.maxIterations;)x=!1,cN(o,n,a,u,i),dN(a,l,o,n,i),sN(a,l,i.sensitivityThreshold)||(x=!0),b++;return s=hN(n,a,i,r),{clusters:s,degreeOfMembership:a}},fN={kMeans:lN,kMedoids:uN,fuzzyCMeans:px,fcm:px},pN=Ir({distance:"euclidean",linkage:"min",mode:"threshold",threshold:1/0,addDendrogram:!1,dendrogramDepth:0,attributes:[]}),gN={single:"min",complete:"max"},vN=function(e){var r=pN(e),n=gN[r.linkage];return n!=null&&(r.linkage=n),r},gx=function(e,r,n,i,s){for(var o=0,a=1/0,l,u=s.attributes,c=function(L,A){return ed(s.distance,u.length,function(I){return u[I](L)},function(I){return u[I](A)},L,A)},d=0;d<e.length;d++){var g=e[d].key,f=n[g][i[g]];f<a&&(o=g,a=f)}if(s.mode==="threshold"&&a>=s.threshold||s.mode==="dendrogram"&&e.length===1)return!1;var y=r[o],_=r[i[o]],v;s.mode==="dendrogram"?v={left:y,right:_,key:y.key}:v={value:y.value.concat(_.value),key:y.key},e[y.index]=v,e.splice(_.index,1),r[y.key]=v;for(var m=0;m<e.length;m++){var x=e[m];y.key===x.key?l=1/0:s.linkage==="min"?(l=n[y.key][x.key],n[y.key][x.key]>n[_.key][x.key]&&(l=n[_.key][x.key])):s.linkage==="max"?(l=n[y.key][x.key],n[y.key][x.key]<n[_.key][x.key]&&(l=n[_.key][x.key])):s.linkage==="mean"?l=(n[y.key][x.key]*y.size+n[_.key][x.key]*_.size)/(y.size+_.size):s.mode==="dendrogram"?l=c(x.value,y.value):l=c(x.value[0],y.value[0]),n[y.key][x.key]=n[x.key][y.key]=l}for(var b=0;b<e.length;b++){var S=e[b].key;if(i[S]===y.key||i[S]===_.key){for(var T=S,N=0;N<e.length;N++){var E=e[N].key;n[S][E]<n[S][T]&&(T=E)}i[S]=T}e[b].index=b}return y.key=_.key=y.index=_.index=null,!0},js=function(e,r,n){e&&(e.value?r.push(e.value):(e.left&&js(e.left,r),e.right&&js(e.right,r)))},wg=function(e,r){if(!e)return"";if(e.left&&e.right){var n=wg(e.left,r),i=wg(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()},_g=function(e,r,n){if(!e)return[];var i=[],s=[],o=[];return r===0?(e.left&&js(e.left,i),e.right&&js(e.right,s),o=i.concat(s),[n.collection(o)]):r===1?e.value?[n.collection(e.value)]:(e.left&&js(e.left,i),e.right&&js(e.right,s),[n.collection(i),n.collection(s)]):e.value?[n.collection(e.value)]:(e.left&&(i=_g(e.left,r-1,n)),e.right&&(s=_g(e.right,r-1,n)),i.concat(s))},vx=function(e){for(var r=this.cy(),n=this.nodes(),i=vN(e),s=i.attributes,o=function(b,S){return ed(i.distance,s.length,function(T){return s[T](b)},function(T){return s[T](S)},b,S)},a=[],l=[],u=[],c=[],d=0;d<n.length;d++){var g={value:i.mode==="dendrogram"?n[d]:[n[d]],key:d,index:d};a[d]=g,c[d]=g,l[d]=[],u[d]=0}for(var f=0;f<a.length;f++)for(var y=0;y<=f;y++){var _=void 0;i.mode==="dendrogram"?_=f===y?1/0:o(a[f].value,a[y].value):_=f===y?1/0:o(a[f].value[0],a[y].value[0]),l[f][y]=_,l[y][f]=_,_<l[f][u[f]]&&(u[f]=y)}for(var v=gx(a,c,l,u,i);v;)v=gx(a,c,l,u,i);var m;return i.mode==="dendrogram"?(m=_g(a[0],i.dendrogramDepth,r),i.addDendrogram&&wg(a[0],r)):(m=new Array(a.length),a.forEach(function(x,b){x.key=x.index=null,m[b]=r.collection(x.value)})),m},mN={hierarchicalClustering:vx,hca:vx},yN=Ir({distance:"euclidean",preference:"median",damping:.8,maxIterations:1e3,minIterations:100,attributes:[]}),xN=function(e){var r=e.damping,n=e.preference;.5<=r&&r<1||ir("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)||ir("Preference must be one of [".concat(i.map(function(s){return"'".concat(s,"'")}).join(", "),"] or a number. Got: ").concat(n)),yN(e)},bN=function(e,r,n,i){var s=function(a,l){return i[l](a)};return-ed(e,i.length,function(o){return s(r,o)},function(o){return s(n,o)},r,n)},wN=function(e,r){var n=null;return r==="median"?n=yT(e):r==="mean"?n=mT(e):r==="min"?n=gT(e):r==="max"?n=vT(e):n=r,n},_N=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},mx=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},SN=function(e,r,n){for(var i=mx(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 d=0,g=0;g<o.length;g++)d+=r[o[g]*e+o[c]];d>u&&(l=c,u=d)}n[s]=o[l]}return i=mx(e,r,n),i},yx=function(e){for(var r=this.cy(),n=this.nodes(),i=xN(e),s={},o=0;o<n.length;o++)s[n[o].id()]=o;var a,l,u,c,d,g;a=n.length,l=a*a,u=new Array(l);for(var f=0;f<l;f++)u[f]=-1/0;for(var y=0;y<a;y++)for(var _=0;_<a;_++)y!==_&&(u[y*a+_]=bN(i.distance,n[y],n[_],i.attributes));c=wN(u,i.preference);for(var v=0;v<a;v++)u[v*a+v]=c;d=new Array(l);for(var m=0;m<l;m++)d[m]=0;g=new Array(l);for(var x=0;x<l;x++)g[x]=0;for(var b=new Array(a),S=new Array(a),T=new Array(a),N=0;N<a;N++)b[N]=0,S[N]=0,T[N]=0;for(var E=new Array(a*i.minIterations),k=0;k<E.length;k++)E[k]=0;var L;for(L=0;L<i.maxIterations;L++){for(var A=0;A<a;A++){for(var I=-1/0,O=-1/0,B=-1,D=0,M=0;M<a;M++)b[M]=d[A*a+M],D=g[A*a+M]+u[A*a+M],D>=I?(O=I,I=D,B=M):D>O&&(O=D);for(var U=0;U<a;U++)d[A*a+U]=(1-i.damping)*(u[A*a+U]-I)+i.damping*b[U];d[A*a+B]=(1-i.damping)*(u[A*a+B]-O)+i.damping*b[B]}for(var H=0;H<a;H++){for(var $=0,F=0;F<a;F++)b[F]=g[F*a+H],S[F]=Math.max(0,d[F*a+H]),$+=S[F];$-=S[H],S[H]=d[H*a+H],$+=S[H];for(var P=0;P<a;P++)g[P*a+H]=(1-i.damping)*Math.min(0,$-S[P])+i.damping*b[P];g[H*a+H]=(1-i.damping)*($-S[H])+i.damping*b[H]}for(var z=0,G=0;G<a;G++){var V=g[G*a+G]+d[G*a+G]>0?1:0;E[L%i.minIterations*a+G]=V,z+=V}if(z>0&&(L>=i.minIterations-1||L==i.maxIterations-1)){for(var te=0,ie=0;ie<a;ie++){T[ie]=0;for(var ne=0;ne<i.minIterations;ne++)T[ie]+=E[ne*a+ie];(T[ie]===0||T[ie]===i.minIterations)&&te++}if(te===a)break}}for(var X=_N(a,d,g),q=SN(a,u,X),Y={},K=0;K<X.length;K++)Y[X[K]]=[];for(var ee=0;ee<n.length;ee++){var re=s[n[ee].id()],ue=q[re];ue!=null&&Y[ue].push(n[ee])}for(var pe=new Array(X.length),Re=0;Re<X.length;Re++)pe[Re]=r.collection(Y[X[Re]]);return pe},CN={affinityPropagation:yx,ap:yx},kN=Ir({root:void 0,directed:!1}),EN={hierholzer:function(e){if(!Pt(e)){var r=arguments;e={root:r[0],directed:r[1]}}var n=kN(e),i=n.root,s=n.directed,o=this,a=!1,l,u,c;i&&(c=dt(i)?this.filter(i)[0].id():i[0].id());var d={},g={};s?o.forEach(function(x){var b=x.id();if(x.isNode()){var S=x.indegree(!0),T=x.outdegree(!0),N=S-T,E=T-S;N==1?l?a=!0:l=b:E==1?u?a=!0:u=b:(E>1||N>1)&&(a=!0),d[b]=[],x.outgoers().forEach(function(k){k.isEdge()&&d[b].push(k.id())})}else g[b]=[void 0,x.target().id()]}):o.forEach(function(x){var b=x.id();if(x.isNode()){var S=x.degree(!0);S%2&&(l?u?a=!0:u=b:l=b),d[b]=[],x.connectedEdges().forEach(function(T){return d[b].push(T.id())})}else g[b]=[x.source().id(),x.target().id()]});var f={found:!1,trail:void 0};if(a)return f;if(u&&l)if(s){if(c&&u!=c)return f;c=u}else{if(c&&u!=c&&l!=c)return f;c||(c=u)}else c||(c=o[0].id());var y=function(b){for(var S=b,T=[b],N,E,k;d[S].length;)N=d[S].shift(),E=g[N][0],k=g[N][1],S!=k?(d[k]=d[k].filter(function(L){return L!=N}),S=k):!s&&S!=E&&(d[E]=d[E].filter(function(L){return L!=N}),S=E),T.unshift(N),T.unshift(S);return T},_=[],v=[];for(v=y(c);v.length!=1;)d[v[0]].length==0?(_.unshift(o.getElementById(v.shift())),_.unshift(o.getElementById(v.shift()))):v=y(v.shift()).concat(v);_.unshift(o.getElementById(v.shift()));for(var m in d)if(d[m].length)return f;return f.found=!0,f.trail=this.spawn(_,!0),f}},Ju=function(){var e=this,r={},n=0,i=0,s=[],o=[],a={},l=function(g,f){for(var y=o.length-1,_=[],v=e.spawn();o[y].x!=g||o[y].y!=f;)_.push(o.pop().edge),y--;_.push(o.pop().edge),_.forEach(function(m){var x=m.connectedNodes().intersection(e);v.merge(m),x.forEach(function(b){var S=b.id(),T=b.connectedEdges().intersection(e);v.merge(b),r[S].cutVertex?v.merge(T.filter(function(N){return N.isLoop()})):v.merge(T)})}),s.push(v)},u=function(g,f,y){g===y&&(i+=1),r[f]={id:n,low:n++,cutVertex:!1};var _=e.getElementById(f).connectedEdges().intersection(e);if(_.size()===0)s.push(e.spawn(e.getElementById(f)));else{var v,m,x,b;_.forEach(function(S){v=S.source().id(),m=S.target().id(),x=v===f?m:v,x!==y&&(b=S.id(),a[b]||(a[b]=!0,o.push({x:f,y:x,edge:S})),x in r?r[f].low=Math.min(r[f].low,r[x].id):(u(g,x,f),r[f].low=Math.min(r[f].low,r[x].low),r[f].id<=r[x].low&&(r[f].cutVertex=!0,l(f,x))))})}};e.forEach(function(d){if(d.isNode()){var g=d.id();g in r||(i=0,u(g,g),r[g].cutVertex=i>1)}});var c=Object.keys(r).filter(function(d){return r[d].cutVertex}).map(function(d){return e.getElementById(d)});return{cut:e.spawn(c),components:s}},TN={hopcroftTarjanBiconnected:Ju,htbc:Ju,htb:Ju,hopcroftTarjanBiconnectedComponents:Ju},ec=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(_){var v=_.target().id();v!==u&&(v in r||a(v),r[v].explored||(r[u].low=Math.min(r[u].low,r[v].low)))}),r[u].index===r[u].low){for(var d=e.spawn();;){var g=s.pop();if(d.merge(e.getElementById(g)),r[g].low=r[u].index,r[g].explored=!0,g===u)break}var f=d.edgesWith(d),y=d.merge(f);i.push(y),o=o.difference(y)}};return e.forEach(function(l){if(l.isNode()){var u=l.id();u in r||a(u)}}),{cut:o,components:i}},NN={tarjanStronglyConnected:ec,tsc:ec,tscc:ec,tarjanStronglyConnectedComponents:ec},l_={};[pl,nT,iT,sT,lT,cT,fT,HT,Us,$s,bg,eN,fN,mN,CN,EN,TN,NN].forEach(function(t){vt(l_,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 u_=0,c_=1,d_=2,Un=function(e){if(!(this instanceof Un))return new Un(e);this.id="Thenable/1.0.7",this.state=u_,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 xx(this,c_,"fulfillValue",e)},reject:function(e){return xx(this,d_,"rejectReason",e)},then:function(e,r){var n=this,i=new Un;return n.onFulfilled.push(wx(e,i,"fulfill")),n.onRejected.push(wx(r,i,"reject")),h_(n),i.proxy}};var xx=function(e,r,n,i){return e.state===u_&&(e.state=r,e[n]=i,h_(e)),e},h_=function(e){e.state===c_?bx(e,"onFulfilled",e.fulfillValue):e.state===d_&&bx(e,"onRejected",e.rejectReason)},bx=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)}},wx=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}f_(r,s)}}},f_=function(e,r){if(e===r||e.proxy===r){e.reject(new TypeError("cannot resolve promise with itself"));return}var n;if(Sr(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")):f_(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(d){s(a,d)},function(d){r(d)});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 Zs=typeof Promise<"u"?Promise:Un,Sg=function(e,r,n){var i=rv(e),s=!i,o=this._private=vt({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&&lr(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},Va=Sg.prototype;vt(Va,{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),mn(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 d=e[u];d!=null&&(e[u]=e[c],e[c]=d)};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 Zs(function(i,s){n.push(function(){i()})})}});Va.complete=Va.completed;Va.run=Va.play;Va.running=Va.playing;var RN={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=vt({},r,n);var d=Object.keys(r).length===0;if(d)return new Sg(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 g=r.renderedPosition,f=a.pan(),y=a.zoom();r.position=Qw(g,y,f)}if(l&&r.panBy!=null){var _=r.panBy,v=a.pan();r.pan={x:v.x+_.x,y:v.y+_.y}}var m=r.center||r.centre;if(l&&m!=null){var x=a.getCenterPan(m.eles,r.zoom);x!=null&&(r.pan=x)}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&&Pt(r.zoom)){var T=a.getZoomedViewport(r.zoom);T!=null?(T.zoomed&&(r.zoom=T.zoom),T.panned&&(r.pan=T.pan)):r.zoom=null}return new Sg(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=vt({},r,n));for(var l=0;l<o.length;l++){var u=o[l],c=u.animated()&&(r.queue===void 0||r.queue),d=u.animation(r,c?{queue:!0}:void 0);d.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,d=c.animation.current,g=0;g<d.length;g++){var f=d[g],y=f._private;n&&(y.duration=0)}r&&(c.animation.queue=[]),n||(c.animation.current=[])}return a.notify("draw"),this}}},Mf,_x;function td(){if(_x)return Mf;_x=1;var t=Array.isArray;return Mf=t,Mf}var If,Sx;function LN(){if(Sx)return If;Sx=1;var t=td(),e=Rl(),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 If=i,If}var Of,Cx;function DN(){if(Cx)return Of;Cx=1;var t=Uw(),e=Nl(),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 Of=o,Of}var Bf,kx;function AN(){if(kx)return Bf;kx=1;var t=Qc(),e=t["__core-js_shared__"];return Bf=e,Bf}var jf,Ex;function PN(){if(Ex)return jf;Ex=1;var t=AN(),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 jf=r,jf}var Ff,Tx;function MN(){if(Tx)return Ff;Tx=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 Ff=r,Ff}var zf,Nx;function IN(){if(Nx)return zf;Nx=1;var t=DN(),e=PN(),r=Nl(),n=MN(),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 d(g){if(!r(g)||e(g))return!1;var f=t(g)?c:s;return f.test(n(g))}return zf=d,zf}var Hf,Rx;function ON(){if(Rx)return Hf;Rx=1;function t(e,r){return e==null?void 0:e[r]}return Hf=t,Hf}var Uf,Lx;function fv(){if(Lx)return Uf;Lx=1;var t=IN(),e=ON();function r(n,i){var s=e(n,i);return t(s)?s:void 0}return Uf=r,Uf}var $f,Dx;function rd(){if(Dx)return $f;Dx=1;var t=fv(),e=t(Object,"create");return $f=e,$f}var Wf,Ax;function BN(){if(Ax)return Wf;Ax=1;var t=rd();function e(){this.__data__=t?t(null):{},this.size=0}return Wf=e,Wf}var Vf,Px;function jN(){if(Px)return Vf;Px=1;function t(e){var r=this.has(e)&&delete this.__data__[e];return this.size-=r?1:0,r}return Vf=t,Vf}var Gf,Mx;function FN(){if(Mx)return Gf;Mx=1;var t=rd(),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 Gf=i,Gf}var qf,Ix;function zN(){if(Ix)return qf;Ix=1;var t=rd(),e=Object.prototype,r=e.hasOwnProperty;function n(i){var s=this.__data__;return t?s[i]!==void 0:r.call(s,i)}return qf=n,qf}var Yf,Ox;function HN(){if(Ox)return Yf;Ox=1;var t=rd(),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 Yf=r,Yf}var Kf,Bx;function UN(){if(Bx)return Kf;Bx=1;var t=BN(),e=jN(),r=FN(),n=zN(),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,Kf=s,Kf}var Xf,jx;function $N(){if(jx)return Xf;jx=1;function t(){this.__data__=[],this.size=0}return Xf=t,Xf}var Qf,Fx;function p_(){if(Fx)return Qf;Fx=1;function t(e,r){return e===r||e!==e&&r!==r}return Qf=t,Qf}var Zf,zx;function nd(){if(zx)return Zf;zx=1;var t=p_();function e(r,n){for(var i=r.length;i--;)if(t(r[i][0],n))return i;return-1}return Zf=e,Zf}var Jf,Hx;function WN(){if(Hx)return Jf;Hx=1;var t=nd(),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 Jf=n,Jf}var ep,Ux;function VN(){if(Ux)return ep;Ux=1;var t=nd();function e(r){var n=this.__data__,i=t(n,r);return i<0?void 0:n[i][1]}return ep=e,ep}var tp,$x;function GN(){if($x)return tp;$x=1;var t=nd();function e(r){return t(this.__data__,r)>-1}return tp=e,tp}var rp,Wx;function qN(){if(Wx)return rp;Wx=1;var t=nd();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 rp=e,rp}var np,Vx;function YN(){if(Vx)return np;Vx=1;var t=$N(),e=WN(),r=VN(),n=GN(),i=qN();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,np=s,np}var ip,Gx;function KN(){if(Gx)return ip;Gx=1;var t=fv(),e=Qc(),r=t(e,"Map");return ip=r,ip}var ap,qx;function XN(){if(qx)return ap;qx=1;var t=UN(),e=YN(),r=KN();function n(){this.size=0,this.__data__={hash:new t,map:new(r||e),string:new t}}return ap=n,ap}var sp,Yx;function QN(){if(Yx)return sp;Yx=1;function t(e){var r=typeof e;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?e!=="__proto__":e===null}return sp=t,sp}var op,Kx;function id(){if(Kx)return op;Kx=1;var t=QN();function e(r,n){var i=r.__data__;return t(n)?i[typeof n=="string"?"string":"hash"]:i.map}return op=e,op}var lp,Xx;function ZN(){if(Xx)return lp;Xx=1;var t=id();function e(r){var n=t(this,r).delete(r);return this.size-=n?1:0,n}return lp=e,lp}var up,Qx;function JN(){if(Qx)return up;Qx=1;var t=id();function e(r){return t(this,r).get(r)}return up=e,up}var cp,Zx;function eR(){if(Zx)return cp;Zx=1;var t=id();function e(r){return t(this,r).has(r)}return cp=e,cp}var dp,Jx;function tR(){if(Jx)return dp;Jx=1;var t=id();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 dp=e,dp}var hp,e1;function rR(){if(e1)return hp;e1=1;var t=XN(),e=ZN(),r=JN(),n=eR(),i=tR();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,hp=s,hp}var fp,t1;function nR(){if(t1)return fp;t1=1;var t=rR(),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,fp=r,fp}var pp,r1;function iR(){if(r1)return pp;r1=1;var t=nR(),e=500;function r(n){var i=t(n,function(o){return s.size===e&&s.clear(),o}),s=i.cache;return i}return pp=r,pp}var gp,n1;function g_(){if(n1)return gp;n1=1;var t=iR(),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 gp=n,gp}var vp,i1;function v_(){if(i1)return vp;i1=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 vp=t,vp}var mp,a1;function aR(){if(a1)return mp;a1=1;var t=iv(),e=v_(),r=td(),n=Rl(),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 mp=o,mp}var yp,s1;function m_(){if(s1)return yp;s1=1;var t=aR();function e(r){return r==null?"":t(r)}return yp=e,yp}var xp,o1;function y_(){if(o1)return xp;o1=1;var t=td(),e=LN(),r=g_(),n=m_();function i(s,o){return t(s)?s:e(s,o)?[s]:r(n(s))}return xp=i,xp}var bp,l1;function pv(){if(l1)return bp;l1=1;var t=Rl();function e(r){if(typeof r=="string"||t(r))return r;var n=r+"";return n=="0"&&1/r==-1/0?"-0":n}return bp=e,bp}var wp,u1;function sR(){if(u1)return wp;u1=1;var t=y_(),e=pv();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 wp=r,wp}var _p,c1;function oR(){if(c1)return _p;c1=1;var t=sR();function e(r,n,i){var s=r==null?void 0:t(r,n);return s===void 0?i:s}return _p=e,_p}var lR=oR(),uR=Tl(lR),Sp,d1;function cR(){if(d1)return Sp;d1=1;var t=fv(),e=(function(){try{var r=t(Object,"defineProperty");return r({},"",{}),r}catch{}})();return Sp=e,Sp}var Cp,h1;function dR(){if(h1)return Cp;h1=1;var t=cR();function e(r,n,i){n=="__proto__"&&t?t(r,n,{configurable:!0,enumerable:!0,value:i,writable:!0}):r[n]=i}return Cp=e,Cp}var kp,f1;function hR(){if(f1)return kp;f1=1;var t=dR(),e=p_(),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 kp=i,kp}var Ep,p1;function fR(){if(p1)return Ep;p1=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 Ep=r,Ep}var Tp,g1;function pR(){if(g1)return Tp;g1=1;var t=hR(),e=y_(),r=fR(),n=Nl(),i=pv();function s(o,a,l,u){if(!n(o))return o;a=e(a,o);for(var c=-1,d=a.length,g=d-1,f=o;f!=null&&++c<d;){var y=i(a[c]),_=l;if(y==="__proto__"||y==="constructor"||y==="prototype")return o;if(c!=g){var v=f[y];_=u?u(v,y,f):void 0,_===void 0&&(_=n(v)?v:r(a[c+1])?[]:{})}t(f,y,_),f=f[y]}return o}return Tp=s,Tp}var Np,v1;function gR(){if(v1)return Np;v1=1;var t=pR();function e(r,n,i){return r==null?r:t(r,n,i)}return Np=e,Np}var vR=gR(),mR=Tl(vR),Rp,m1;function yR(){if(m1)return Rp;m1=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 Rp=t,Rp}var Lp,y1;function xR(){if(y1)return Lp;y1=1;var t=v_(),e=yR(),r=td(),n=Rl(),i=g_(),s=pv(),o=m_();function a(l){return r(l)?t(l,s):n(l)?[l]:e(i(o(l)))}return Lp=a,Lp}var bR=xR(),wR=Tl(bR),_R={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=vt({},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(dt(i)){var d=i.indexOf(".")!==-1,g=d&&wR(i);if(o.allowGetting&&s===void 0){var f;return c&&(o.beforeGet(c),g&&c._private[o.field][i]===void 0?f=uR(c._private[o.field],g):f=c._private[o.field][i]),f}else if(o.allowSetting&&s!==void 0){var y=!o.immutableKeys[i];if(y){var _=Dw({},i,s);o.beforeSet(a,_);for(var v=0,m=u.length;v<m;v++){var x=u[v];o.canSet(x)&&(g&&c._private[o.field][i]===void 0?mR(x._private[o.field],g,s):x._private[o.field][i]=s)}o.updateStyle&&a.updateStyle(),o.onSet(a),o.settingTriggersEvent&&a[o.triggerFnName](o.settingEvent)}}}else if(o.allowSetting&&Pt(i)){var b=i,S,T,N=Object.keys(b);o.beforeSet(a,b);for(var E=0;E<N.length;E++){S=N[E],T=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]=T)}}o.updateStyle&&a.updateStyle(),o.onSet(a),o.settingTriggersEvent&&a[o.triggerFnName](o.settingEvent)}else if(o.allowBinding&&lr(i)){var I=i;a.on(o.bindingEvent,I)}else if(o.allowGetting&&i===void 0){var O;return c&&(o.beforeGet(c),O=c._private[o.field]),O}return a}},removeData:function(e){var r={field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!1,immutableKeys:{}};return e=vt({},r,e),function(i){var s=e,o=this,a=o.length!==void 0,l=a?o:[o];if(dt(i)){for(var u=i.split(/\s+/),c=u.length,d=0;d<c;d++){var g=u[d];if(!ea(g)){var f=!s.immutableKeys[g];if(f)for(var y=0,_=l.length;y<_;y++)l[y]._private[s.field][g]=void 0}}s.triggerEvent&&o[s.triggerFnName](s.event)}else if(i===void 0){for(var v=0,m=l.length;v<m;v++)for(var x=l[v]._private[s.field],b=Object.keys(x),S=0;S<b.length;S++){var T=b[S],N=!s.immutableKeys[T];N&&(x[T]=void 0)}s.triggerEvent&&o[s.triggerFnName](s.event)}return o}}},SR={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 Zs(function(a,l){var u=function(f){s.off.apply(s,d),a(f)},c=o.concat([u]),d=c.concat([]);s.on.apply(s,c)})}}},Ft={};[RN,_R,SR].forEach(function(t){vt(Ft,t)});var CR={animate:Ft.animate(),animation:Ft.animation(),animated:Ft.animated(),clearQueue:Ft.clearQueue(),delay:Ft.delay(),delayAnimation:Ft.delayAnimation(),stop:Ft.stop()},xc={classes:function(e){var r=this;if(e===void 0){var n=[];return r[0]._private.classes.forEach(function(y){return n.push(y)}),n}else Gt(e)||(e=(e||"").match(/\S+/g)||[]);for(var i=[],s=new Qs(e),o=0;o<r.length;o++){for(var a=r[o],l=a._private,u=l.classes,c=!1,d=0;d<e.length;d++){var g=e[d],f=u.has(g);if(!f){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){Gt(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,d=0;d<e.length;d++){var g=e[d],f=u.has(g),y=!1;r||i&&!f?(u.add(g),y=!0):(!r||i&&f)&&(u.delete(g),y=!0),!c&&y&&(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}};xc.className=xc.classNames=xc.classes;var At={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:`"(?:\\\\"|[^"])*"|'(?:\\\\'|[^'])*'`,number:_r,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};At.variable="(?:[\\w-.]|(?:\\\\"+At.metaChar+"))+";At.className="(?:[\\w-]|(?:\\\\"+At.metaChar+"))+";At.value=At.string+"|"+At.number;At.id=At.variable;(function(){var t,e,r;for(t=At.comparatorOp.split("|"),r=0;r<t.length;r++)e=t[r],At.comparatorOp+="|@"+e;for(t=At.comparatorOp.split("|"),r=0;r<t.length;r++)e=t[r],!(e.indexOf("!")>=0)&&e!=="="&&(At.comparatorOp+="|\\!"+e)})();var Ut=function(){return{checks:[]}},nt={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},Cg=[{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 w3(t.selector,e.selector)}),kR=(function(){for(var t={},e,r=0;r<Cg.length;r++)e=Cg[r],t[e.selector]=e.matches;return t})(),ER=function(e,r){return kR[e](r)},TR="("+Cg.map(function(t){return t.selector}).join("|")+")",Cs=function(e){return e.replace(new RegExp("\\\\("+At.metaChar+")","g"),function(r,n){return n})},Vi=function(e,r,n){e[e.length-1]=n},kg=[{name:"group",query:!0,regex:"("+At.group+")",populate:function(e,r,n){var i=yr(n,1),s=i[0];r.checks.push({type:nt.GROUP,value:s==="*"?s:s+"s"})}},{name:"state",query:!0,regex:TR,populate:function(e,r,n){var i=yr(n,1),s=i[0];r.checks.push({type:nt.STATE,value:s})}},{name:"id",query:!0,regex:"\\#("+At.id+")",populate:function(e,r,n){var i=yr(n,1),s=i[0];r.checks.push({type:nt.ID,value:Cs(s)})}},{name:"className",query:!0,regex:"\\.("+At.className+")",populate:function(e,r,n){var i=yr(n,1),s=i[0];r.checks.push({type:nt.CLASS,value:Cs(s)})}},{name:"dataExists",query:!0,regex:"\\[\\s*("+At.variable+")\\s*\\]",populate:function(e,r,n){var i=yr(n,1),s=i[0];r.checks.push({type:nt.DATA_EXIST,field:Cs(s)})}},{name:"dataCompare",query:!0,regex:"\\[\\s*("+At.variable+")\\s*("+At.comparatorOp+")\\s*("+At.value+")\\s*\\]",populate:function(e,r,n){var i=yr(n,3),s=i[0],o=i[1],a=i[2],l=new RegExp("^"+At.string+"$").exec(a)!=null;l?a=a.substring(1,a.length-1):a=parseFloat(a),r.checks.push({type:nt.DATA_COMPARE,field:Cs(s),operator:o,value:a})}},{name:"dataBool",query:!0,regex:"\\[\\s*("+At.boolOp+")\\s*("+At.variable+")\\s*\\]",populate:function(e,r,n){var i=yr(n,2),s=i[0],o=i[1];r.checks.push({type:nt.DATA_BOOL,field:Cs(o),operator:s})}},{name:"metaCompare",query:!0,regex:"\\[\\[\\s*("+At.meta+")\\s*("+At.comparatorOp+")\\s*("+At.number+")\\s*\\]\\]",populate:function(e,r,n){var i=yr(n,3),s=i[0],o=i[1],a=i[2];r.checks.push({type:nt.META_COMPARE,field:Cs(s),operator:o,value:parseFloat(a)})}},{name:"nextQuery",separator:!0,regex:At.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++]=Ut();return a}},{name:"directedEdge",separator:!0,regex:At.directedEdge,populate:function(e,r){if(e.currentSubject==null){var n=Ut(),i=r,s=Ut();return n.checks.push({type:nt.DIRECTED_EDGE,source:i,target:s}),Vi(e,r,n),e.edgeCount++,s}else{var o=Ut(),a=r,l=Ut();return o.checks.push({type:nt.NODE_SOURCE,source:a,target:l}),Vi(e,r,o),e.edgeCount++,l}}},{name:"undirectedEdge",separator:!0,regex:At.undirectedEdge,populate:function(e,r){if(e.currentSubject==null){var n=Ut(),i=r,s=Ut();return n.checks.push({type:nt.UNDIRECTED_EDGE,nodes:[i,s]}),Vi(e,r,n),e.edgeCount++,s}else{var o=Ut(),a=r,l=Ut();return o.checks.push({type:nt.NODE_NEIGHBOR,node:a,neighbor:l}),Vi(e,r,o),l}}},{name:"child",separator:!0,regex:At.child,populate:function(e,r){if(e.currentSubject==null){var n=Ut(),i=Ut(),s=e[e.length-1];return n.checks.push({type:nt.CHILD,parent:s,child:i}),Vi(e,r,n),e.compoundCount++,i}else if(e.currentSubject===r){var o=Ut(),a=e[e.length-1],l=Ut(),u=Ut(),c=Ut(),d=Ut();return o.checks.push({type:nt.COMPOUND_SPLIT,left:a,right:l,subject:u}),u.checks=r.checks,r.checks=[{type:nt.TRUE}],d.checks.push({type:nt.TRUE}),l.checks.push({type:nt.PARENT,parent:d,child:c}),Vi(e,a,o),e.currentSubject=u,e.compoundCount++,c}else{var g=Ut(),f=Ut(),y=[{type:nt.PARENT,parent:g,child:f}];return g.checks=r.checks,r.checks=y,e.compoundCount++,f}}},{name:"descendant",separator:!0,regex:At.descendant,populate:function(e,r){if(e.currentSubject==null){var n=Ut(),i=Ut(),s=e[e.length-1];return n.checks.push({type:nt.DESCENDANT,ancestor:s,descendant:i}),Vi(e,r,n),e.compoundCount++,i}else if(e.currentSubject===r){var o=Ut(),a=e[e.length-1],l=Ut(),u=Ut(),c=Ut(),d=Ut();return o.checks.push({type:nt.COMPOUND_SPLIT,left:a,right:l,subject:u}),u.checks=r.checks,r.checks=[{type:nt.TRUE}],d.checks.push({type:nt.TRUE}),l.checks.push({type:nt.ANCESTOR,ancestor:d,descendant:c}),Vi(e,a,o),e.currentSubject=u,e.compoundCount++,c}else{var g=Ut(),f=Ut(),y=[{type:nt.ANCESTOR,ancestor:g,descendant:f}];return g.checks=r.checks,r.checks=y,e.compoundCount++,f}}},{name:"subject",modifier:!0,regex:At.subject,populate:function(e,r){if(e.currentSubject!=null&&e.currentSubject!==r)return zt("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===nt.DIRECTED_EDGE?i.type=nt.NODE_TARGET:s===nt.UNDIRECTED_EDGE&&(i.type=nt.NODE_NEIGHBOR,i.node=i.nodes[1],i.neighbor=i.nodes[0],i.nodes=null)}}];kg.forEach(function(t){return t.regexObj=new RegExp("^"+t.regex)});var NR=function(e){for(var r,n,i,s=0;s<kg.length;s++){var o=kg[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}},RR=function(e){var r=e.match(/^\s+/);if(r){var n=r[0];e=e.substring(n.length)}return e},LR=function(e){var r=this,n=r.inputText=e,i=r[0]=Ut();for(r.length=1,n=RR(n);;){var s=NR(n);if(s.expr==null)return zt("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 zt("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(c.edgeCount>1)return zt("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;c.edgeCount===1&&zt("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},DR=function(){if(this.toStringCache!=null)return this.toStringCache;for(var e=function(c){return c??""},r=function(c){return dt(c)?'"'+c+'"':e(c)},n=function(c){return" "+c+" "},i=function(c,d){var g=c.type,f=c.value;switch(g){case nt.GROUP:{var y=e(f);return y.substring(0,y.length-1)}case nt.DATA_COMPARE:{var _=c.field,v=c.operator;return"["+_+n(e(v))+r(f)+"]"}case nt.DATA_BOOL:{var m=c.operator,x=c.field;return"["+e(m)+x+"]"}case nt.DATA_EXIST:{var b=c.field;return"["+b+"]"}case nt.META_COMPARE:{var S=c.operator,T=c.field;return"[["+T+n(e(S))+r(f)+"]]"}case nt.STATE:return f;case nt.ID:return"#"+f;case nt.CLASS:return"."+f;case nt.PARENT:case nt.CHILD:return s(c.parent,d)+n(">")+s(c.child,d);case nt.ANCESTOR:case nt.DESCENDANT:return s(c.ancestor,d)+" "+s(c.descendant,d);case nt.COMPOUND_SPLIT:{var N=s(c.left,d),E=s(c.subject,d),k=s(c.right,d);return N+(N.length>0?" ":"")+E+k}case nt.TRUE:return""}},s=function(c,d){return c.checks.reduce(function(g,f,y){return g+(d===c&&y===0?"$":"")+i(f,d)},"")},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},AR={parse:LR,toString:DR},x_=function(e,r,n){var i,s=dt(e),o=Ke(e),a=dt(n),l,u,c=!1,d=!1,g=!1;switch(r.indexOf("!")>=0&&(r=r.replace("!",""),d=!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">":g=!0,i=e>n;break;case">=":g=!0,i=e>=n;break;case"<":g=!0,i=e<n;break;case"<=":g=!0,i=e<=n;break;default:i=!1;break}return d&&(e!=null||!g)&&(i=!i),i},PR=function(e,r){switch(r){case"?":return!!e;case"!":return!e;case"^":return e===void 0}},MR=function(e){return e!==void 0},gv=function(e,r){return e.data(r)},IR=function(e,r){return e[r]()},dr=[],tr=function(e,r){return e.checks.every(function(n){return dr[n.type](n,r)})};dr[nt.GROUP]=function(t,e){var r=t.value;return r==="*"||r===e.group()};dr[nt.STATE]=function(t,e){var r=t.value;return ER(r,e)};dr[nt.ID]=function(t,e){var r=t.value;return e.id()===r};dr[nt.CLASS]=function(t,e){var r=t.value;return e.hasClass(r)};dr[nt.META_COMPARE]=function(t,e){var r=t.field,n=t.operator,i=t.value;return x_(IR(e,r),n,i)};dr[nt.DATA_COMPARE]=function(t,e){var r=t.field,n=t.operator,i=t.value;return x_(gv(e,r),n,i)};dr[nt.DATA_BOOL]=function(t,e){var r=t.field,n=t.operator;return PR(gv(e,r),n)};dr[nt.DATA_EXIST]=function(t,e){var r=t.field;return t.operator,MR(gv(e,r))};dr[nt.UNDIRECTED_EDGE]=function(t,e){var r=t.nodes[0],n=t.nodes[1],i=e.source(),s=e.target();return tr(r,i)&&tr(n,s)||tr(n,i)&&tr(r,s)};dr[nt.NODE_NEIGHBOR]=function(t,e){return tr(t.node,e)&&e.neighborhood().some(function(r){return r.isNode()&&tr(t.neighbor,r)})};dr[nt.DIRECTED_EDGE]=function(t,e){return tr(t.source,e.source())&&tr(t.target,e.target())};dr[nt.NODE_SOURCE]=function(t,e){return tr(t.source,e)&&e.outgoers().some(function(r){return r.isNode()&&tr(t.target,r)})};dr[nt.NODE_TARGET]=function(t,e){return tr(t.target,e)&&e.incomers().some(function(r){return r.isNode()&&tr(t.source,r)})};dr[nt.CHILD]=function(t,e){return tr(t.child,e)&&tr(t.parent,e.parent())};dr[nt.PARENT]=function(t,e){return tr(t.parent,e)&&e.children().some(function(r){return tr(t.child,r)})};dr[nt.DESCENDANT]=function(t,e){return tr(t.descendant,e)&&e.ancestors().some(function(r){return tr(t.ancestor,r)})};dr[nt.ANCESTOR]=function(t,e){return tr(t.ancestor,e)&&e.descendants().some(function(r){return tr(t.descendant,r)})};dr[nt.COMPOUND_SPLIT]=function(t,e){return tr(t.subject,e)&&tr(t.left,e)&&tr(t.right,e)};dr[nt.TRUE]=function(){return!0};dr[nt.COLLECTION]=function(t,e){var r=t.value;return r.has(e)};dr[nt.FILTER]=function(t,e){var r=t.value;return r(e)};var OR=function(e){var r=this;if(r.length===1&&r[0].checks.length===1&&r[0].checks[0].type===nt.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(tr(a,s))return!0}return!1};return r.text()==null&&(n=function(){return!0}),e.filter(n)},BR=function(e){for(var r=this,n=0;n<r.length;n++){var i=r[n];if(tr(i,e))return!0}return!1},jR={matches:BR,filter:OR},na=function(e){this.inputText=e,this.currentSubject=null,this.compoundCount=0,this.edgeCount=0,this.length=0,e==null||dt(e)&&e.match(/^\s*$/)||(mn(e)?this.addQuery({checks:[{type:nt.COLLECTION,value:e.collection()}]}):lr(e)?this.addQuery({checks:[{type:nt.FILTER,value:e}]}):dt(e)?this.parse(e)||(this.invalid=!0):ir("A selector must be created from a string; found "))},ia=na.prototype;[AR,jR].forEach(function(t){return vt(ia,t)});ia.text=function(){return this.inputText};ia.size=function(){return this.length};ia.eq=function(t){return this[t]};ia.sameText=function(t){return!this.invalid&&!t.invalid&&this.text()===t.text()};ia.addQuery=function(t){this[this.length++]=t};ia.selector=ia.toString;var Zi={allAre:function(e){var r=new na(e);return this.every(function(n){return r.matches(n)})},is:function(e){var r=new na(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())})}};Zi.allAreNeighbours=Zi.allAreNeighbors;Zi.has=Zi.contains;Zi.equal=Zi.equals=Zi.same;var Rn=function(e,r){return function(i,s,o,a){var l=i,u=this,c;if(l==null?c="":mn(l)&&l.length===1&&(c=l.id()),u.length===1&&c){var d=u[0]._private,g=d.traversalCache=d.traversalCache||{},f=g[r]=g[r]||[],y=$a(c),_=f[y];return _||(f[y]=e.call(u,i,s,o,a))}else return e.call(u,i,s,o,a)}},qs={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:Rn(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 vv(t,e,r,n){for(var i=[],s=new Qs,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 b_(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)}}qs.forEachDown=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return vv(this,t,e,b_)};function w_(t,e,r){if(r.isChild()){var n=r._private.parent;e.has(n.id())||t.push(n)}}qs.forEachUp=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return vv(this,t,e,w_)};function FR(t,e,r){w_(t,e,r),b_(t,e,r)}qs.forEachUpAndDown=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return vv(this,t,e,FR)};qs.ancestors=qs.parents;var ml,__;ml=__={data:Ft.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:Ft.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:Ft.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Ft.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:Ft.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:Ft.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}};ml.attr=ml.data;ml.removeAttr=ml.removeData;var zR=__,ad={};function Dp(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}}vt(ad,{degree:Dp(function(t,e){return e.source().same(e.target())?2:1}),indegree:Dp(function(t,e){return e.target().same(t)?1:0}),outdegree:Dp(function(t,e){return e.source().same(t)?1:0})});function ks(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}}vt(ad,{minDegree:ks("degree",function(t,e){return t<e}),maxDegree:ks("degree",function(t,e){return t>e}),minIndegree:ks("indegree",function(t,e){return t<e}),maxIndegree:ks("indegree",function(t,e){return t>e}),minOutdegree:ks("outdegree",function(t,e){return t<e}),maxOutdegree:ks("outdegree",function(t,e){return t>e})});vt(ad,{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,S_,C_=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()}}},x1={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){C_(e,r,!1)},onSet:function(e){e.dirtyCompoundBoundsCache()},canSet:function(e){return!e.locked()}};zn=S_={position:Ft.data(x1),silentPosition:Ft.data(vt({},x1,{allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!1,beforeSet:function(e,r){C_(e,r,!0)},onSet:function(e){e.dirtyCompoundBoundsCache()}})),positions:function(e,r){if(Pt(e))r?this.silentPosition(e):this.position(e);else if(lr(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(Pt(e)?(i={x:Ke(e.x)?e.x:0,y:Ke(e.y)?e.y:0},n=r):dt(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 Pt(e)?this.shift(e,!0):dt(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=Pt(e)?e:void 0,l=a!==void 0||r!==void 0&&dt(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(Qw(a,s,o))}else{var d=n.position();return a=Jc(d,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=Pt(e)?e:void 0,o=s!==void 0||r!==void 0&&dt(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,d=c&&c.length>0,g=d;d&&(c=c[0]);var f=g?c.position():{x:0,y:0};r!==void 0?u.position(e,r+f[e]):s!==void 0&&u.position({x:s.x+f.x,y:s.y+f.y})}else{var y=n.position(),_=a?n.parent():null,v=_&&_.length>0,m=v;v&&(_=_[0]);var x=m?_.position():{x:0,y:0};return s={x:y.x-x.x,y:y.y-x.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 HR=S_,Ys=function(e){switch(e){case"left":case"right-inside":return"left";case"right":case"left-inside":return"right";default:return"center"}},Ks=function(e){switch(e){case"top":case"bottom-inside":return"top";case"bottom":case"top-inside":return"bottom";default:return"center"}},UR=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"}},Ws,ca;Ws=ca={};ca.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}};ca.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)};ca.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")}},d=l.boundingBox({includeLabels:u,includeOverlays:!1,useCache:!1}),g=a.position;(d.w===0||d.h===0)&&(d={w:o.pstyle("width").pfValue,h:o.pstyle("height").pfValue},d.x1=g.x-d.w/2,d.x2=g.x+d.w/2,d.y1=g.y-d.h/2,d.y2=g.y+d.h/2);function f(L,A,I){var O=0,B=0,D=A+I;return L>0&&D>0&&(O=A/D*L,B=I/D*L),{biasDiff:O,biasComplementDiff:B}}function y(L,A,I,O){if(I.units==="%")switch(O){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 _=c.width.left.value;c.width.left.units==="px"&&c.width.val>0&&(_=_*100/c.width.val);var v=c.width.right.value;c.width.right.units==="px"&&c.width.val>0&&(v=v*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 x=c.height.bottom.value;c.height.bottom.units==="px"&&c.height.val>0&&(x=x*100/c.height.val);var b=f(c.width.val-d.w,_,v),S=b.biasDiff,T=b.biasComplementDiff,N=f(c.height.val-d.h,m,x),E=N.biasDiff,k=N.biasComplementDiff;a.autoPadding=y(d.w,d.h,o.pstyle("padding"),o.pstyle("padding-relative-to").value),a.autoWidth=Math.max(d.w,c.width.val),g.x=(-S+d.x1+d.x2+T)/2,a.autoHeight=Math.max(d.h,c.height.val),g.y=(-E+d.y1+d.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 Tn=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)},Yi=function(e,r){return r==null?e:Fn(e,r.x1,r.y1,r.x2,r.y2)},Uo=function(e,r,n){return Xr(e,r,n)},tc=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||{},d=c[n]=c[n]||{};d.x1=l-o,d.y1=u-o,d.x2=l+o,d.y2=u+o,d.w=d.x2-d.x1,d.h=d.y2-d.y1,mc(d,1),Fn(e,d.x1,d.y1,d.x2,d.y2)}}},Ap=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=Uo(o,"labelWidth",n),d=Uo(o,"labelHeight",n),g=Uo(o,"labelX",n),f=Uo(o,"labelY",n),y=r.pstyle(i+"text-margin-x").pfValue,_=r.pstyle(i+"text-margin-y").pfValue,v=r.isEdge(),m=r.pstyle(i+"text-rotation"),x=r.pstyle("text-outline-width").pfValue,b=r.pstyle("text-border-width").pfValue,S=b/2,T=r.pstyle("text-background-padding").pfValue,N=2,E=d,k=c,L=k/2,A=E/2,I,O,B,D;if(v)I=g-L,O=g+L,B=f-A,D=f+A;else{switch(Ys(l.value)){case"left":I=g-k,O=g;break;case"center":I=g-L,O=g+L;break;case"right":I=g,O=g+k;break}switch(Ks(u.value)){case"top":B=f-E,D=f;break;case"center":B=f-A,D=f+A;break;case"bottom":B=f,D=f+E;break}}var M=y-Math.max(x,S)-T-N,U=y+Math.max(x,S)+T+N,H=_-Math.max(x,S)-T-N,$=_+Math.max(x,S)+T+N;I+=M,O+=U,B+=H,D+=$;var F=n||"main",P=s.labelBounds,z=P[F]=P[F]||{};z.x1=I,z.y1=B,z.x2=O,z.y2=D,z.w=O-I,z.h=D-B,z.leftPad=M,z.rightPad=U,z.topPad=H,z.botPad=$;var G=v&&m.strValue==="autorotate",V=m.pfValue!=null&&m.pfValue!==0;if(G||V){var te=G?Uo(s.rstyle,"labelAngle",n):m.pfValue,ie=Math.cos(te),ne=Math.sin(te),X=(I+O)/2,q=(B+D)/2;if(!v){switch(Ys(l.value)){case"left":X=O;break;case"right":X=I;break}switch(Ks(u.value)){case"top":q=D;break;case"bottom":q=B;break}}var Y=function(_e,Te){return _e=_e-X,Te=Te-q,{x:_e*ie-Te*ne+X,y:_e*ne+Te*ie+q}},K=Y(I,B),ee=Y(I,D),re=Y(O,B),ue=Y(O,D);I=Math.min(K.x,ee.x,re.x,ue.x),O=Math.max(K.x,ee.x,re.x,ue.x),B=Math.min(K.y,ee.y,re.y,ue.y),D=Math.max(K.y,ee.y,re.y,ue.y)}var pe=F+"Rot",Re=P[pe]=P[pe]||{};Re.x1=I,Re.y1=B,Re.x2=O,Re.y2=D,Re.w=O-I,Re.h=D-B,Fn(e,I,B,O,D),Fn(s.labelBounds.all,I,B,O,D)}return e}},b1=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;k_(e,r,n,o,"outside",o/2)}},k_=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(),d=c.x,g=c.y,f=r.width(),y=r.height();if(u.hasMiterBounds){s==="center"&&(i/=2);var _=u.miterBounds(d,g,f,y,i);Yi(e,_)}else o!=null&&o>0&&yc(e,[o,o,o,o])}}},$R=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;k_(e,r,n,i,s)}},WR=function(e,r){var n=e._private.cy,i=n.styleEnabled(),s=n.headless(),o=Zr(),a=e._private,l=e.isNode(),u=e.isEdge(),c,d,g,f,y,_,v=a.rstyle,m=l&&i?e.pstyle("bounds-expansion").pfValue:[0],x=function(Be){return Be.pstyle("display").value!=="none"},b=!i||x(e)&&(!u||x(e.source())&&x(e.target()));if(b){var S=0,T=0;i&&r.includeOverlays&&(S=e.pstyle("overlay-opacity").value,S!==0&&(T=e.pstyle("overlay-padding").value));var N=0,E=0;i&&r.includeUnderlays&&(N=e.pstyle("underlay-opacity").value,N!==0&&(E=e.pstyle("underlay-padding").value));var k=Math.max(T,E),L=0,A=0;if(i&&(L=e.pstyle("width").pfValue,A=L/2),l&&r.includeNodes){var I=e.position();y=I.x,_=I.y;var O=e.outerWidth(),B=O/2,D=e.outerHeight(),M=D/2;c=y-B,d=y+B,g=_-M,f=_+M,Fn(o,c,g,d,f),i&&b1(o,e),i&&r.includeOutlines&&!s&&b1(o,e),i&&$R(o,e)}else if(u&&r.includeEdges)if(i&&!s){var U=e.pstyle("curve-style").strValue;if(c=Math.min(v.srcX,v.midX,v.tgtX),d=Math.max(v.srcX,v.midX,v.tgtX),g=Math.min(v.srcY,v.midY,v.tgtY),f=Math.max(v.srcY,v.midY,v.tgtY),c-=A,d+=A,g-=A,f+=A,Fn(o,c,g,d,f),U==="haystack"){var H=v.haystackPts;if(H&&H.length===2){if(c=H[0].x,g=H[0].y,d=H[1].x,f=H[1].y,c>d){var $=c;c=d,d=$}if(g>f){var F=g;g=f,f=F}Fn(o,c-A,g-A,d+A,f+A)}}else if(U==="bezier"||U==="unbundled-bezier"||Ki(U,"segments")||Ki(U,"taxi")){var P;switch(U){case"bezier":case"unbundled-bezier":P=v.bezierPts;break;case"segments":case"taxi":case"round-segments":case"round-taxi":P=v.linePts;break}if(P!=null)for(var z=0;z<P.length;z++){var G=P[z];c=G.x-A,d=G.x+A,g=G.y-A,f=G.y+A,Fn(o,c,g,d,f)}}}else{var V=e.source(),te=V.position(),ie=e.target(),ne=ie.position();if(c=te.x,d=ne.x,g=te.y,f=ne.y,c>d){var X=c;c=d,d=X}if(g>f){var q=g;g=f,f=q}c-=A,d+=A,g-=A,f+=A,Fn(o,c,g,d,f)}if(i&&r.includeEdges&&u&&(tc(o,e,"mid-source"),tc(o,e,"mid-target"),tc(o,e,"source"),tc(o,e,"target")),i){var Y=e.pstyle("ghost").value==="yes";if(Y){var K=e.pstyle("ghost-offset-x").pfValue,ee=e.pstyle("ghost-offset-y").pfValue;Fn(o,o.x1+K,o.y1+ee,o.x2+K,o.y2+ee)}}var re=a.bodyBounds=a.bodyBounds||{};ax(re,o),yc(re,m),mc(re,1),i&&(c=o.x1,d=o.x2,g=o.y1,f=o.y2,Fn(o,c-k,g-k,d+k,f+k));var ue=a.overlayBounds=a.overlayBounds||{};ax(ue,o),yc(ue,m),mc(ue,1);var pe=a.labelBounds=a.labelBounds||{};pe.all!=null?CT(pe.all):pe.all=Zr(),i&&r.includeLabels&&(r.includeMainLabels&&Ap(o,e,null),u&&(r.includeSourceLabels&&Ap(o,e,"source"),r.includeTargetLabels&&Ap(o,e,"target")))}return o.x1=Tn(o.x1),o.y1=Tn(o.y1),o.x2=Tn(o.x2),o.y2=Tn(o.y2),o.w=Tn(o.x2-o.x1),o.h=Tn(o.y2-o.y1),o.w>0&&o.h>0&&b&&(yc(o,m),mc(o,1)),o},E_=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},T_=function(e){var r=function(a){return Math.round(a)};if(e.isEdge()){var n=e.source().position(),i=e.target().position();return J0([r(n.x),r(n.y),r(i.x),r(i.y)])}else{var s=e.position();return J0([r(s.x),r(s.y)])}},w1=function(e,r){var n=e._private,i,s=e.isEdge(),o=r==null?_1:E_(r),a=o===_1;if(n.bbCache==null?(i=WR(e,yl),n.bbCache=i,n.bbCachePosKey=T_(e)):i=n.bbCache,!a){var l=e.isNode();i=Zr(),(r.includeNodes&&l||r.includeEdges&&!l)&&(r.includeOverlays?Yi(i,n.overlayBounds):Yi(i,n.bodyBounds)),r.includeLabels&&(r.includeMainLabels&&(!s||r.includeSourceLabels&&r.includeTargetLabels)?Yi(i,n.labelBounds.all):(r.includeMainLabels&&Yi(i,n.labelBounds.mainRot),r.includeSourceLabels&&Yi(i,n.labelBounds.sourceRot),r.includeTargetLabels&&Yi(i,n.labelBounds.targetRot))),i.w=i.x2-i.x1,i.h=i.y2-i.y1}return i},yl={includeNodes:!0,includeEdges:!0,includeLabels:!0,includeMainLabels:!0,includeSourceLabels:!0,includeTargetLabels:!0,includeOverlays:!0,includeUnderlays:!0,includeOutlines:!0,useCache:!0},_1=E_(yl),S1=Ir(yl);ca.boundingBox=function(t){var e,r=t===void 0||t.useCache===void 0||t.useCache===!0,n=Vs(function(c){var d=c._private;return d.bbCache==null||d.styleDirty||d.bbCachePosKey!==T_(c)},function(c){return c.id()});if(r&&this.length===1&&!n(this[0]))t===void 0?t=yl:t=S1(t),e=w1(this[0],t);else{e=Zr(),t=t||yl;var i=S1(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(),Yi(e,w1(u,i))}}return e.x1=Tn(e.x1),e.y1=Tn(e.y1),e.x2=Tn(e.x2),e.y2=Tn(e.y2),e.w=Tn(e.x2-e.x1),e.h=Tn(e.y2-e.y1),e};ca.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};ca.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)),Pt(t)){var s=t;t=function(){return s}}var o=function(c,d){return c._private.bbAtOldPos=t(c,d)},a=function(c){return c._private.bbAtOldPos};r.startBatch(),e.forEach(o).silentPositions(t),n&&(i.dirtyCompoundBoundsCache(),i.dirtyBoundingBoxCache(),i.updateCompoundBounds(!0));var l=ST(this.boundingBox({useCache:!1}));return e.silentPositions(a),n&&(i.dirtyCompoundBoundsCache(),i.dirtyBoundingBoxCache(),i.updateCompoundBounds(!0)),r.endBatch(),l};Ws.boundingbox=Ws.bb=Ws.boundingBox;Ws.renderedBoundingbox=Ws.renderedBoundingBox;var VR=ca,rl,Al;rl=Al={};var N_=function(e){e.uppercaseName=j0(e.name),e.autoName="auto"+e.uppercaseName,e.labelName="label"+e.uppercaseName,e.outerName="outer"+e.uppercaseName,e.uppercaseOuterName=j0(e.outerName),rl[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},rl["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},rl["rendered"+e.uppercaseName]=function(){var n=this[0];if(n){var i=n[e.name]();return i*this.cy().zoom()}},rl["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"});Al.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};Al.paddedHeight=function(){var t=this[0];return t.height()+2*t.padding()};Al.paddedWidth=function(){var t=this[0];return t.width()+2*t.padding()};var GR=Al,qR=function(e,r){if(e.isEdge()&&e.takesUpSpace())return r(e)},YR=function(e,r){if(e.isEdge()&&e.takesUpSpace()){var n=e.cy();return Jc(r(e),n.zoom(),n.pan())}},KR=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 Jc(o,s,i)})}},XR=function(e){return e.renderer().getControlPoints(e)},QR=function(e){return e.renderer().getSegmentPoints(e)},ZR=function(e){return e.renderer().getSourceEndpoint(e)},JR=function(e){return e.renderer().getTargetEndpoint(e)},eL=function(e){return e.renderer().getEdgeMidpoint(e)},C1={controlPoints:{get:XR,mult:!0},segmentPoints:{get:QR,mult:!0},sourceEndpoint:{get:ZR},targetEndpoint:{get:JR},midpoint:{get:eL}},tL=function(e){return"rendered"+e[0].toUpperCase()+e.substr(1)},rL=Object.keys(C1).reduce(function(t,e){var r=C1[e],n=tL(e);return t[e]=function(){return qR(this,r.get)},r.mult?t[n]=function(){return KR(this,r.get)}:t[n]=function(){return YR(this,r.get)},t},{}),nL=vt({},HR,VR,GR,rL);/*!
|
|
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 R_=function(e,r){this.recycle(e,r)};function $o(){return!1}function rc(){return!0}R_.prototype={instanceString:function(){return"event"},recycle:function(e,r){if(this.isImmediatePropagationStopped=this.isPropagationStopped=this.isDefaultPrevented=$o,e!=null&&e.preventDefault?(this.type=e.type,this.isDefaultPrevented=e.defaultPrevented?rc:$o):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=rc;var e=this.originalEvent;e&&e.preventDefault&&e.preventDefault()},stopPropagation:function(){this.isPropagationStopped=rc;var e=this.originalEvent;e&&e.stopPropagation&&e.stopPropagation()},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=rc,this.stopPropagation()},isDefaultPrevented:$o,isPropagationStopped:$o,isImmediatePropagationStopped:$o};var L_=/^([^.]+)(\.(?:[^.]+))?$/,iL=".*",D_={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},k1=Object.keys(D_),aL={};function sd(){for(var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:aL,e=arguments.length>1?arguments[1]:void 0,r=0;r<k1.length;r++){var n=k1[r];this[n]=t[n]||D_[n]}this.context=e||this.context,this.listeners=[],this.emitting=0}var aa=sd.prototype,A_=function(e,r,n,i,s,o,a){lr(i)&&(s=i,i=null),a&&(o==null?o=a:o=vt({},o,a));for(var l=Gt(n)?n:n.split(/\s+/),u=0;u<l.length;u++){var c=l[u];if(!ea(c)){var d=c.match(L_);if(d){var g=d[1],f=d[2]?d[2]:null,y=r(e,c,g,f,i,s,o);if(y===!1)break}}}},E1=function(e,r){return e.addEventFields(e.context,r),new R_(r.type,r)},sL=function(e,r,n){if(c3(n)){r(e,n);return}else if(Pt(n)){r(e,E1(e,n));return}for(var i=Gt(n)?n:n.split(/\s+/),s=0;s<i.length;s++){var o=i[s];if(!ea(o)){var a=o.match(L_);if(a){var l=a[1],u=a[2]?a[2]:null,c=E1(e,{type:l,namespace:u,target:e.context});r(e,c)}}}};aa.on=aa.addListener=function(t,e,r,n,i){return A_(this,function(s,o,a,l,u,c,d){lr(c)&&s.listeners.push({event:o,callback:c,type:a,namespace:l,qualifier:u,conf:d})},t,e,r,n,i),this};aa.one=function(t,e,r,n){return this.on(t,e,r,n,{one:!0})};aa.removeListener=aa.off=function(t,e,r,n){var i=this;this.emitting!==0&&(this.listeners=G3(this.listeners));for(var s=this.listeners,o=function(u){var c=s[u];A_(i,function(d,g,f,y,_,v){if((c.type===f||t==="*")&&(!y&&c.namespace!==".*"||c.namespace===y)&&(!_||d.qualifierCompare(c.qualifier,_))&&(!v||c.callback===v))return s.splice(u,1),!1},t,e,r,n)},a=s.length-1;a>=0;a--)o(a);return this};aa.removeAllListeners=function(){return this.removeListener("*")};aa.emit=aa.trigger=function(t,e,r){var n=this.listeners,i=n.length;return this.emitting++,Gt(e)||(e=[e]),sL(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===iL)&&s.eventMatches(s.context,c,o)){var d=[o];e!=null&&Y3(d,e),s.beforeEmit(s.context,c,o),c.conf&&c.conf.one&&(s.listeners=s.listeners.filter(function(y){return y!==c}));var g=s.callbackContext(s.context,c,o),f=c.callback.apply(g,d);s.afterEmit(s.context,c,o),f===!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 oL={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&&El(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()}},nc=function(e){return dt(e)?new na(e):e},P_={createEmitter:function(){for(var e=0;e<this.length;e++){var r=this[e],n=r._private;n.emitter||(n.emitter=new sd(oL,r))}return this},emitter:function(){return this._private.emitter},on:function(e,r,n){for(var i=nc(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=nc(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=nc(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=nc(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}};Ft.eventAliasesOn(P_);var M_={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(dt(e)||mn(e))return new na(e).filter(this);if(lr(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){dt(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(dt(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;dt(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 d=l[c],g=d._private.data.id,f=u.hasElementWithId(g);f||n.push(d)}};return o(i,s),o(s,i),n},diff:function(e){var r=this._private.cy;dt(e)&&(e=r.$(e));var n=this.spawn(),i=this.spawn(),s=this.spawn(),o=this,a=e,l=function(c,d,g){for(var f=0;f<c.length;f++){var y=c[f],_=y._private.data.id,v=d.hasElementWithId(_);v?s.merge(y):g.push(y)}};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(dt(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&&dt(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&&dt(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}}},Ot=M_;Ot.u=Ot["|"]=Ot["+"]=Ot.union=Ot.or=Ot.add;Ot["\\"]=Ot["!"]=Ot["-"]=Ot.difference=Ot.relativeComplement=Ot.subtract=Ot.not;Ot.n=Ot["&"]=Ot["."]=Ot.and=Ot.intersection=Ot.intersect;Ot["^"]=Ot["(+)"]=Ot["(-)"]=Ot.symmetricDifference=Ot.symdiff=Ot.xor;Ot.fnFilter=Ot.filterFn=Ot.stdFilter=Ot.filter;Ot.complement=Ot.abscomp=Ot.absoluteComplement;var lL={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}},I_=function(e,r){var n=e.cy(),i=n.hasCompoundNodes();function s(c){var d=c.pstyle("z-compound-depth");return d.value==="auto"?i?c.zDepth():0:d.value==="bottom"?-1:d.value==="top"?av:0}var o=s(e)-s(r);if(o!==0)return o;function a(c){var d=c.pstyle("z-index-compare");return d.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()},jc={forEach:function(e,r){if(lr(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(!lr(e))return this;var r=this.toArray().sort(e);return this.spawn(r)},sortByZIndex:function(){return this.sort(I_)},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:av-1}else{var s=r.source,o=r.target,a=s.zDepth(),l=o.zDepth();return Math.max(a,l,0)}}}};jc.each=jc.forEach;var uL=function(){var e="undefined",r=(typeof Symbol>"u"?"undefined":Sr(Symbol))!=e&&Sr(Symbol.iterator)!=e;r&&(jc[Symbol.iterator]=function(){var n=this,i={value:void 0,done:!1},s=0,o=this.length;return Dw({next:function(){return s<o?i.value=n[s++]:(i.value=void 0,i.done=!0),i}},Symbol.iterator,function(){return this})})};uL();var cL=Ir({nodeDimensionsIncludeLabels:!1}),bc={layoutDimensions:function(e){e=cL(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(T){return!T.isParent()}),s=this.cy(),o=r.eles,a=function(N){return N.id()},l=Vs(n,a);e.emit({type:"layoutstart",layout:e}),e.animations=[];var u=function(N,E,k){var L={x:E.x1+E.w/2,y:E.y1+E.h/2},A={x:(k.x-L.x)*N,y:(k.y-L.y)*N};return{x:L.x+A.x,y:L.y+A.y}},c=r.spacingFactor&&r.spacingFactor!==1,d=function(){if(!c)return null;for(var N=Zr(),E=0;E<i.length;E++){var k=i[E],L=l(k,E);Jw(N,L.x,L.y)}return N},g=d(),f=Vs(function(T,N){var E=l(T,N);if(c){var k=Math.abs(r.spacingFactor);E=u(k,g,E)}return r.transform!=null&&(E=r.transform(T,E)),E},a);if(r.animate){for(var y=0;y<i.length;y++){var _=i[y],v=f(_,y),m=r.animateFilter==null||r.animateFilter(_,y);if(m){var x=_.animation({position:v,duration:r.animationDuration,easing:r.animationEasing});e.animations.push(x)}else _.position(v)}if(r.fit){var b=s.animation({fit:{boundingBox:o.boundingBoxAt(f),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(T){return T.play()}),e.one("layoutready",r.ready),e.emit({type:"layoutready",layout:e}),Zs.all(e.animations.map(function(T){return T.promise()})).then(function(){e.one("layoutstop",r.stop),e.emit({type:"layoutstop",layout:e})})}else i.positions(f),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(vt({},e,{eles:this}))}};bc.createLayout=bc.makeLayout=bc.layout;function O_(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 od(t,e){return t=$a(t),function(n){return O_(t,e,n)}}function ld(t,e){t=$a(t);var r=function(i){return e.call(i)};return function(){var i=this[0];if(i)return O_(t,r,i)}}var Pr={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(Pt(e)){var o=e;s.applyBypass(this,o,i),this.emitAndNotify("style")}else if(dt(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 Pp(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 mv(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||Pp(s,n);var l=a.source,u=a.target;return r(l)&&(!o||Pp(l,r))&&(l===u||r(u)&&(!o||Pp(u,r)))}}}var Js=od("eleTakesUpSpace",function(t){return t.pstyle("display").value==="element"&&t.width()!==0&&(t.isNode()?t.height()!==0:!0)});Pr.takesUpSpace=ld("takesUpSpace",mv({ok:Js}));var dL=od("eleInteractive",function(t){return t.pstyle("events").value==="yes"&&t.pstyle("visibility").value==="visible"&&Js(t)}),hL=od("parentInteractive",function(t){return t.pstyle("visibility").value==="visible"&&Js(t)});Pr.interactive=ld("interactive",mv({ok:dL,parentOk:hL,edgeOkViaNode:Js}));Pr.noninteractive=function(){var t=this[0];if(t)return!t.interactive()};var fL=od("eleVisible",function(t){return t.pstyle("visibility").value==="visible"&&t.pstyle("opacity").pfValue!==0&&Js(t)}),pL=Js;Pr.visible=ld("visible",mv({ok:fL,edgeOkViaNode:pL}));Pr.hidden=function(){var t=this[0];if(t)return!t.visible()};Pr.isBundledBezier=ld("isBundledBezier",function(){return this.cy().styleEnabled()?!this.removed()&&this.pstyle("curve-style").value==="bezier"&&this.takesUpSpace():!1});Pr.bypass=Pr.css=Pr.style;Pr.renderedCss=Pr.renderedStyle;Pr.removeBypass=Pr.removeCss=Pr.removeStyle;Pr.pstyle=Pr.parsedStyle;var Ji={};function T1(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&&lr(e[0])){var s=e[0];this.on(t.event,s)}else if(e.length===0||e.length===1&&Gt(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 d=t.overrideAble(l);if(d!==void 0&&(u=d,!d))return this}u&&(l._private[t.field]=t.value,c&&r.push(l))}var g=this.spawn(r);g.updateStyle(),g.emit(t.event),o&&g.emit(o)}return this}}function eo(t){Ji[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]}},Ji[t.on]=T1({event:t.on,field:t.field,ableField:t.ableField,overrideAble:t.overrideAble,value:!0}),Ji[t.off]=T1({event:t.off,field:t.field,ableField:t.ableField,overrideAble:t.overrideAble,value:!1})}eo({field:"locked",overrideField:function(e){return e.cy().autolock()?!0:void 0},on:"lock",off:"unlock"});eo({field:"grabbable",overrideField:function(e){return e.cy().autoungrabify()||e.pannable()?!1:void 0},on:"grabify",off:"ungrabify"});eo({field:"selected",ableField:"selectable",overrideAble:function(e){return e.cy().autounselectify()?!1:void 0},on:"select",off:"unselect"});eo({field:"selectable",overrideField:function(e){return e.cy().autounselectify()?!1:void 0},on:"selectify",off:"unselectify"});Ji.deselect=Ji.unselect;Ji.grabbed=function(){var t=this[0];if(t)return t._private.grabbed};eo({field:"active",on:"activate",off:"unactivate"});eo({field:"pannable",on:"panify",off:"unpanify"});Ji.inactive=function(){var t=this[0];if(t)return!t._private.active};var Ur={},N1=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 d=u[c],g=d.source(),f=d.target();if(e.noIncomingEdges&&f===a&&g!==a||e.noOutgoingEdges&&g===a&&f!==a){l=!0;break}}l||s.push(a)}}return this.spawn(s,!0).filter(n)}},R1=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(),d=u.target();e.outgoing&&c===o?(i.push(u),i.push(d)):e.incoming&&d===o&&(i.push(u),i.push(c))}}return this.spawn(i,!0).filter(r)}},L1=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)}};Ur.clearTraversalCache=function(){for(var t=0;t<this.length;t++)this[t]._private.traversalCache=null};vt(Ur,{roots:N1({noIncomingEdges:!0}),leaves:N1({noOutgoingEdges:!0}),outgoers:Rn(R1({outgoing:!0}),"outgoers"),successors:L1({outgoing:!0}),incomers:Rn(R1({incoming:!0}),"incomers"),predecessors:L1({})});vt(Ur,{neighborhood:Rn(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)}});Ur.neighbourhood=Ur.neighborhood;Ur.closedNeighbourhood=Ur.closedNeighborhood;Ur.openNeighbourhood=Ur.openNeighborhood;vt(Ur,{source:Rn(function(e){var r=this[0],n;return r&&(n=r._private.source||r.cy().collection()),n&&e?n.filter(e):n},"source"),target:Rn(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)}}vt(Ur,{edgesWith:Rn(A1(),"edgesWith"),edgesTo:Rn(A1({thisIsSrc:!0}),"edgesTo")});function A1(t){return function(r){var n=[],i=this._private.cy,s=t||{};dt(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,d=this.hasElementWithId(c.source)&&r.hasElementWithId(c.target),g=r.hasElementWithId(c.source)&&this.hasElementWithId(c.target),f=d||g;f&&((s.thisIsSrc||s.thisIsTgt)&&(s.thisIsSrc&&!d||s.thisIsTgt&&!g)||n.push(u))}return this.spawn(n,!0)}}vt(Ur,{connectedEdges:Rn(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:Rn(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:Rn(P1(),"parallelEdges"),codirectedEdges:Rn(P1({codirected:!0}),"codirectedEdges")});function P1(t){var e={codirected:!1};return t=vt({},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,d=c._private.data.id,g=u.data.target,f=c._private.edges,y=0;y<f.length;y++){var _=f[y],v=_._private.data,m=v.target,x=v.source,b=m===g&&x===d,S=d===m&&g===x;(o.codirected&&b||!o.codirected&&(b||S))&&i.push(_)}return this.spawn(i,!0).filter(n)}}vt(Ur,{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,d){i.merge(c),s.unmerge(c),d.merge(c)};if(s.empty())return r.spawn();var l=function(){var c=n.collection();o.push(c);var d=s[0];a(d,c),r.bfs({directed:!1,roots:d,visit:function(f){return a(f,c)}}),c.forEach(function(g){g.connectedEdges().forEach(function(f){r.has(f)&&c.has(f.source())&&c.has(f.target())&&c.merge(f)})})};do l();while(s.length>0);return o},component:function(){var e=this[0];return e.cy().mutableElements().components(e)[0]}});Ur.componentsOf=Ur.components;var Mr=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){ir("A collection must have a reference to the core");return}var s=new yi,o=!1;if(!r)r=[];else if(r.length>0&&Pt(r[0])&&!El(r[0])){o=!0;for(var a=[],l=new Qs,u=0,c=r.length;u<c;u++){var d=r[u];d.data==null&&(d.data={});var g=d.data;if(g.id==null)g.id=Kw();else if(e.hasElementWithId(g.id)||l.has(g.id))continue;var f=new Zc(e,d,!1);a.push(f),l.add(g.id)}r=a}this.length=0;for(var y=0,_=r.length;y<_;y++){var v=r[y][0];if(v!=null){var m=v._private.data.id;(!n||!s.has(m))&&(n&&s.set(m,{index:this.length,ele:v}),this[this.length]=v,this.length++)}}this._private={eles:this,cy:e,get map(){return this.lazyMap==null&&this.rebuildMap(),this.lazyMap},set map(x){this.lazyMap=x},rebuildMap:function(){for(var b=this.lazyMap=new yi,S=this.eles,T=0;T<S.length;T++){var N=S[T];b.set(N.id(),{index:T,ele:N})}}},n&&(this._private.map=s),o&&!i&&this.restore()},Zt=Zc.prototype=Mr.prototype=Object.create(Array.prototype);Zt.instanceString=function(){return"collection"};Zt.spawn=function(t,e){return new Mr(this.cy(),t,e)};Zt.spawnSelf=function(){return this.spawn(this)};Zt.cy=function(){return this._private.cy};Zt.renderer=function(){return this._private.cy.renderer()};Zt.element=function(){return this[0]};Zt.collection=function(){return Iw(this)?this:new Mr(this._private.cy,[this])};Zt.unique=function(){return new Mr(this._private.cy,this,!0)};Zt.hasElementWithId=function(t){return t=""+t,this._private.map.has(t)};Zt.getElementById=function(t){t=""+t;var e=this._private.cy,r=this._private.map.get(t);return r?r.ele:new Mr(e)};Zt.$id=Zt.getElementById;Zt.poolIndex=function(){var t=this._private.cy,e=t._private.elements,r=this[0]._private.data.id;return e._private.map.get(r).index};Zt.indexOf=function(t){var e=t[0]._private.data.id;return this._private.map.get(e).index};Zt.indexOfId=function(t){return t=""+t,this._private.map.get(t).index};Zt.json=function(t){var e=this.element(),r=this.cy();if(e==null&&t)return this;if(e!=null){var n=e._private;if(Pt(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 d=function(_,v,m){var x=t[_];x!=null&&x!==n[_]&&(x?e[v]():e[m]())};return d("removed","remove","restore"),d("selected","select","unselect"),d("selectable","selectify","unselectify"),d("locked","lock","unlock"),d("grabbable","grabify","ungrabify"),d("pannable","panify","unpanify"),t.classes!=null&&e.classes(t.classes),r.endBatch(),this}else if(t===void 0){var g={data:ei(n.data),position:ei(n.position),group:n.group,removed:n.removed,selected:n.selected,selectable:n.selectable,locked:n.locked,grabbable:n.grabbable,pannable:n.pannable,classes:null};g.classes="";var f=0;return n.classes.forEach(function(y){return g.classes+=f++===0?y:" "+y}),g}}};Zt.jsons=function(){for(var t=[],e=0;e<this.length;e++){var r=this[e],n=r.json();t.push(n)}return t};Zt.clone=function(){for(var t=this.cy(),e=[],r=0;r<this.length;r++){var n=this[r],i=n.json(),s=new Zc(t,i,!1);e.push(s)}return new Mr(t,e)};Zt.copy=Zt.clone;Zt.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 d,g=function(){a.splice(d,1),d--};for(d=0;d<a.length;d++){var f=a[d],y=f._private,_=y.data;if(f.clearTraversalCache(),!(!e&&!y.removed)){if(_.id===void 0)_.id=Kw();else if(Ke(_.id))_.id=""+_.id;else if(ea(_.id)||!dt(_.id)){ir("Can not create element with invalid string ID `"+_.id+"`"),g();continue}else if(n.hasElementWithId(_.id)){ir("Can not create second element with ID `"+_.id+"`"),g();continue}}var v=_.id;if(f.isNode()){var m=y.position;m.x==null&&(m.x=0),m.y==null&&(m.y=0)}if(f.isEdge()){for(var x=f,b=["source","target"],S=b.length,T=!1,N=0;N<S;N++){var E=b[N],k=_[E];Ke(k)&&(k=_[E]=""+_[E]),k==null||k===""?(ir("Can not create edge `"+v+"` with unspecified "+E),T=!0):n.hasElementWithId(k)||(ir("Can not create edge `"+v+"` with nonexistent "+E+" `"+k+"`"),T=!0)}if(T){g();continue}var L=n.getElementById(_.source),A=n.getElementById(_.target);L.same(A)?L._private.edges.push(x):(L._private.edges.push(x),A._private.edges.push(x)),x._private.source=L,x._private.target=A}y.map=new yi,y.map.set(v,{ele:f,index:0}),y.removed=!1,e&&n.addToPool(f)}for(var I=0;I<s.length;I++){var O=s[I],B=O._private.data;Ke(B.parent)&&(B.parent=""+B.parent);var D=B.parent,M=D!=null;if(M||O._private.parent){var U=O._private.parent?n.collection().merge(O._private.parent):n.getElementById(D);if(U.empty())B.parent=void 0;else if(U[0].removed())zt("Node added with missing parent, reference to parent removed"),B.parent=void 0,O._private.parent=null;else{for(var H=!1,$=U;!$.empty();){if(O.same($)){H=!0,B.parent=void 0;break}$=$.parent()}H||(U[0]._private.children.push(O),O._private.parent=U[0],i.hasCompoundNodes=!0)}}}if(a.length>0){for(var F=a.length===r.length?r:new Mr(n,a),P=0;P<F.length;P++){var z=F[P];z.isNode()||(z.parallelEdges().clearTraversalCache(),z.source().clearTraversalCache(),z.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};Zt.removed=function(){var t=this[0];return t&&t._private.removed};Zt.inside=function(){var t=this[0];return t&&!t._private.removed};Zt.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 M=D._private.edges,U=0;U<M.length;U++)l(M[U])}function a(D){for(var M=D._private.children,U=0;U<M.length;U++)l(M[U])}function l(D){var M=i[D.id()];e&&D.removed()||M||(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 d=r[u];l(d)}function g(D,M){var U=D._private.edges;ta(U,M),D.clearTraversalCache()}function f(D){D.clearTraversalCache()}var y=[];y.ids={};function _(D,M){M=M[0],D=D[0];var U=D._private.children,H=D.id();ta(U,M),M._private.parent=null,y.ids[H]||(y.ids[H]=!0,y.push(D))}r.dirtyCompoundBoundsCache(),e&&s.removeFromPool(n);for(var v=0;v<n.length;v++){var m=n[v];if(m.isEdge()){var x=m.source()[0],b=m.target()[0];g(x,m),g(b,m);for(var S=m.parallelEdges(),T=0;T<S.length;T++){var N=S[T];f(N),N.isBundledBezier()&&N.dirtyBoundingBoxCache()}}else{var E=m.parent();E.length!==0&&_(E,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 Mr(this.cy(),n);I.size()>0&&(t?I.emitAndNotify("remove"):e&&I.emit("remove"));for(var O=0;O<y.length;O++){var B=y[O];(!e||!B.removed())&&B.updateStyle()}return I};Zt.move=function(t){var e=this._private.cy,r=this,n=!1,i=!1,s=function(y){return y==null?y:""+y};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 f=0;f<r.length;f++){var y=r[f],_=y._private.data;y.isEdge()&&(l&&(_.source=o),u&&(_.target=a))}r.restore(n,i)}),r.emitAndNotify("move"))}else if(t.parent!==void 0){var c=s(t.parent),d=c===null||e.hasElementWithId(c);if(d){var g=c===null?void 0:c;e.batch(function(){var f=r.remove(n,i);f.emitAndNotify("moveout");for(var y=0;y<r.length;y++){var _=r[y],v=_._private.data;_.isNode()&&(v.parent=g)}f.restore(n,i)}),r.emitAndNotify("move")}}return this};[l_,CR,xc,Zi,qs,zR,ad,nL,P_,M_,lL,jc,bc,Pr,Ji,Ur].forEach(function(t){vt(Zt,t)});var gL={add:function(e){var r,n=this;if(mn(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 Mr(n,s)}}else if(Gt(e)){var l=e;r=new Mr(n,l)}else if(Pt(e)&&(Gt(e.nodes)||Gt(e.edges))){for(var u=e,c=[],d=["nodes","edges"],g=0,f=d.length;g<f;g++){var y=d[g],_=u[y];if(Gt(_))for(var v=0,m=_.length;v<m;v++){var x=vt({group:y},_[v]);c.push(x)}}r=new Mr(n,c)}else{var b=e;r=new Zc(n,b).collection()}return r},remove:function(e){if(!mn(e)){if(dt(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 vL(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 d=0;d<4;++d)if(typeof arguments[d]!="number"||isNaN(arguments[d])||!isFinite(arguments[d]))return!1;t=Math.min(t,1),r=Math.min(r,1),t=Math.max(t,0),r=Math.max(r,0);var g=c?new Float32Array(l):new Array(l);function f(A,I){return 1-3*I+3*A}function y(A,I){return 3*I-6*A}function _(A){return 3*A}function v(A,I,O){return((f(I,O)*A+y(I,O))*A+_(I))*A}function m(A,I,O){return 3*f(I,O)*A*A+2*y(I,O)*A+_(I)}function x(A,I){for(var O=0;O<i;++O){var B=m(I,t,r);if(B===0)return I;var D=v(I,t,r)-A;I-=D/B}return I}function b(){for(var A=0;A<l;++A)g[A]=v(A*u,t,r)}function S(A,I,O){var B,D,M=0;do D=I+(O-I)/2,B=v(D,t,r)-A,B>0?O=D:I=D;while(Math.abs(B)>o&&++M<a);return D}function T(A){for(var I=0,O=1,B=l-1;O!==B&&g[O]<=A;++O)I+=u;--O;var D=(A-g[O])/(g[O+1]-g[O]),M=I+D*u,U=m(M,t,r);return U>=s?x(A,M):U===0?M:S(A,I,I+u)}var N=!1;function E(){N=!0,(t!==e||r!==n)&&b()}var k=function(I){return N||E(),t===e&&r===n?I:I===0?0:I===1?1:v(T(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 mL=(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,d=16/1e3,g,f,y;for(i=parseFloat(i)||500,s=parseFloat(s)||20,o=o||null,a.tension=i,a.friction=s,g=o!==null,g?(u=n(i,s),f=u/o*d):f=d;y=r(y||a,f),l.push(1+y.x),u+=16,Math.abs(y.x)>c&&Math.abs(y.v)>c;);return g?function(_){return l[_*(l.length-1)|0]}:u}})(),Qt=function(e,r,n,i){var s=vL(e,r,n,i);return function(o,a,l){return o+(a-o)*s(l)}},wc={linear:function(e,r,n){return e+(r-e)*n},ease:Qt(.25,.1,.25,1),"ease-in":Qt(.42,0,1,1),"ease-out":Qt(0,0,.58,1),"ease-in-out":Qt(.42,0,.58,1),"ease-in-sine":Qt(.47,0,.745,.715),"ease-out-sine":Qt(.39,.575,.565,1),"ease-in-out-sine":Qt(.445,.05,.55,.95),"ease-in-quad":Qt(.55,.085,.68,.53),"ease-out-quad":Qt(.25,.46,.45,.94),"ease-in-out-quad":Qt(.455,.03,.515,.955),"ease-in-cubic":Qt(.55,.055,.675,.19),"ease-out-cubic":Qt(.215,.61,.355,1),"ease-in-out-cubic":Qt(.645,.045,.355,1),"ease-in-quart":Qt(.895,.03,.685,.22),"ease-out-quart":Qt(.165,.84,.44,1),"ease-in-out-quart":Qt(.77,0,.175,1),"ease-in-quint":Qt(.755,.05,.855,.06),"ease-out-quint":Qt(.23,1,.32,1),"ease-in-out-quint":Qt(.86,0,.07,1),"ease-in-expo":Qt(.95,.05,.795,.035),"ease-out-expo":Qt(.19,1,.22,1),"ease-in-out-expo":Qt(1,0,0,1),"ease-in-circ":Qt(.6,.04,.98,.335),"ease-out-circ":Qt(.075,.82,.165,1),"ease-in-out-circ":Qt(.785,.135,.15,.86),spring:function(e,r,n){if(n===0)return wc.linear;var i=mL(e,r,n);return function(s,o,a){return s+(o-s)*i(a)}},"cubic-bezier":Qt};function M1(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 I1(t,e){return t.pfValue!=null||t.value!=null?t.pfValue!=null&&(e==null||e.type.units!=="%")?t.pfValue:t.value:t}function Es(t,e,r,n,i){var s=i!=null?i.type:null;r<0?r=0:r>1&&(r=1);var o=I1(t,i),a=I1(e,i);if(Ke(o)&&Ke(a))return M1(s,o,a,r,n);if(Gt(o)&&Gt(a)){for(var l=[],u=0;u<a.length;u++){var c=o[u],d=a[u];if(c!=null&&d!=null){var g=M1(s,c,d,r,n);l.push(g)}else l.push(d)}return l}}function yL(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=wc.linear;else{var d;if(dt(a)){var g=c.parse("transition-timing-function",a);d=g.value}else d=a;var f,y;dt(d)?(f=d,y=[]):(f=d[1],y=d.slice(2).map(function(F){return+F})),y.length>0?(f==="spring"&&y.push(o.duration),o.easingImpl=wc[f].apply(null,y)):o.easingImpl=wc[f]}var _=o.easingImpl,v;if(o.duration===0?v=1:v=(r-l)/o.duration,o.applying&&(v=o.progress),v<0?v=0:v>1&&(v=1),o.delay==null){var m=o.startPosition,x=o.position;if(x&&i&&!t.locked()){var b={};Wo(m.x,x.x)&&(b.x=Es(m.x,x.x,v,_)),Wo(m.y,x.y)&&(b.y=Es(m.y,x.y,v,_)),t.position(b)}var S=o.startPan,T=o.pan,N=s.pan,E=T!=null&&n;E&&(Wo(S.x,T.x)&&(N.x=Es(S.x,T.x,v,_)),Wo(S.y,T.y)&&(N.y=Es(S.y,T.y,v,_)),t.emit("pan"));var k=o.startZoom,L=o.zoom,A=L!=null&&n;A&&(Wo(k,L)&&(s.zoom=gl(s.minZoom,Es(k,L,v,_),s.maxZoom)),t.emit("zoom")),(E||A)&&t.emit("viewport");var I=o.style;if(I&&I.length>0&&i){for(var O=0;O<I.length;O++){var B=I[O],D=B.name,M=B,U=o.startStyle[D],H=c.properties[U.name],$=Es(U,M,v,_,H);c.overrideBypass(t,D,$)}t.emit("style")}}return o.progress=v,v}function Wo(t,e){return t==null||e==null?!1:Ke(t)&&Ke(e)?!0:!!(t&&e)}function xL(t,e,r,n){var i=e._private;i.started=!0,i.startTime=r-i.progress*i.duration}function O1(t,e){var r=e._private.aniEles,n=[];function i(c,d){var g=c._private,f=g.animation.current,y=g.animation.queue,_=!1;if(f.length===0){var v=y.shift();v&&f.push(v)}for(var m=function(N){for(var E=N.length-1;E>=0;E--){var k=N[E];k()}N.splice(0,N.length)},x=f.length-1;x>=0;x--){var b=f[x],S=b._private;if(S.stopped){f.splice(x,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||xL(c,b,t),yL(c,b,t,d),S.applying&&(S.applying=!1),m(S.frames),S.step!=null&&S.step(t),b.completed()&&(f.splice(x,1),S.hooked=!1,S.playing=!1,S.started=!1,m(S.completes)),_=!0)}return!d&&f.length===0&&y.length===0&&n.push(c),_}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 bL={animate:Ft.animate(),animation:Ft.animation(),animated:Ft.animated(),clearQueue:Ft.clearQueue(),delay:Ft.delay(),delayAnimation:Ft.delayAnimation(),stop:Ft.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&&Pc(function(s){O1(s,e),r()})}var n=e.renderer();n&&n.beforeRender?n.beforeRender(function(s,o){O1(o,e)},n.beforeRenderPriorities.animations):r()}},wL={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&&El(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}},ic=function(e){return dt(e)?new na(e):e},B_={createEmitter:function(){var e=this._private;return e.emitter||(e.emitter=new sd(wL,this)),this},emitter:function(){return this._private.emitter},on:function(e,r,n){return this.emitter().on(e,ic(r),n),this},removeListener:function(e,r,n){return this.emitter().removeListener(e,ic(r),n),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(e,r,n){return this.emitter().one(e,ic(r),n),this},once:function(e,r,n){return this.emitter().one(e,ic(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}};Ft.eventAliasesOn(B_);var Eg={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)}};Eg.jpeg=Eg.jpg;var _c={layout:function(e){var r=this;if(e==null){ir("Layout options must be specified to make a layout");return}if(e.name==null){ir("A `name` must be specified to make a layout");return}var n=e.name,i=r.extension("layout",n);if(i==null){ir("No such layout `"+n+"` found. Did you forget to import it and `cytoscape.use()` it?");return}var s;dt(e.eles)?s=r.$(e.eles):s=e.eles!=null?e.eles:r.$();var o=new i(vt({},e,{cy:r,eles:s}));return o}};_c.createLayout=_c.makeLayout=_c.layout;var _L={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)}})}},SL=Ir({hideEdgesOnViewport:!1,textureOnViewport:!1,motionBlur:!1,motionBlurOpacity:.05,pixelRatio:void 0,desktopTapThreshold:4,touchTapThreshold:8,wheelSensitivity:1,debug:!1,showFps:!1,webgl:!1,webglDebug:!1,webglDebugShowAtlases:!1,webglTexSize:2048,webglTexRows:36,webglTexRowsNodes:18,webglBatchSize:2048,webglTexPerBatch:14,webglBgColor:[255,255,255]}),Tg={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){ir("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&&zt("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=SL(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)}};Tg.invalidateDimensions=Tg.resize;var Sc={collection:function(e,r){return dt(e)?this.$(e):mn(e)?e.collection():Gt(e)?(r||(r={}),new Mr(this,e,r.unique,r.removed)):new Mr(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}};Sc.elements=Sc.filter=Sc.$;var Lr={},al="t",CL="f";Lr.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};Lr.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]===al,d=e[l]===al,g=c!==d,f=u.mappedProperties.length>0;if(g||d&&f){var y=void 0;g&&f||g?y=u.properties:f&&(y=u.mappedProperties);for(var _=0;_<y.length;_++){for(var v=y[_],m=v.name,x=!1,b=l+1;b<r.length;b++){var S=r[b],T=e[b]===al;if(T&&(x=S.properties[v.name]!=null,x))break}!a[m]&&!x&&(a[m]=!0,o.push(m))}}}return n[i]=o,o};Lr.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+=al:r+=CL}return n=e.getPropertiesDiff(i,r),t._private.styleCxtKey=r,{key:r,diffPropNames:n,empty:n.length===0}};Lr.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]===al;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};Lr.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 d=c.mapping,g=d.fnValue=u.value(r);if(g===d.prevFnValue)continue}var f=s[l]={prev:c};n.applyParsedProperty(r,u),f.next=r.pstyle(l),f.next&&f.next.bypass&&(f.next=f.next.bypassed)}}return{diffProps:s}};Lr.updateStyleHints=function(t){var e=t._private,r=this,n=r.propertyGroupNames,i=r.propertyGroupKeys,s=function(re,ue,pe){return r.getPropertiesHash(re,ue,pe)},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]=[ja,Is]}for(var d=function(re,ue){return e.styleKeys[ue][0]=hl(re,e.styleKeys[ue][0])},g=function(re,ue){return e.styleKeys[ue][1]=fl(re,e.styleKeys[ue][1])},f=function(re,ue){d(re,ue),g(re,ue)},y=function(re,ue){for(var pe=0;pe<re.length;pe++){var Re=re.charCodeAt(pe);d(Re,ue),g(Re,ue)}},_=2e9,v=function(re){return-128<re&&re<128&&Math.floor(re)!==re?_-(re*1024|0):re},m=0;m<n.length;m++){var x=n[m],b=l[x];if(b!=null){var S=this.properties[x],T=S.type,N=S.groupKey,E=void 0;S.hashOverride!=null?E=S.hashOverride(t,b):b.pfValue!=null&&(E=b.pfValue);var k=S.enums==null?b.value:null,L=E!=null,A=k!=null,I=L||A,O=b.units;if(T.number&&I&&!T.multiple){var B=L?E:k;f(v(B),N),!L&&O!=null&&y(O,N)}else y(b.strValue,N)}}for(var D=[ja,Is],M=0;M<i.length;M++){var U=i[M],H=e.styleKeys[U];D[0]=hl(H[0],D[0]),D[1]=fl(H[1],D[1])}e.styleKey=j3(D[0],D[1]);var $=e.styleKeys;e.labelDimsKey=Wi($.labelDimensions);var F=s(t,["label"],$.labelDimensions);if(e.labelKey=Wi(F),e.labelStyleKey=Wi(Xu($.commonLabel,F)),!a){var P=s(t,["source-label"],$.labelDimensions);e.sourceLabelKey=Wi(P),e.sourceLabelStyleKey=Wi(Xu($.commonLabel,P));var z=s(t,["target-label"],$.labelDimensions);e.targetLabelKey=Wi(z),e.targetLabelStyleKey=Wi(Xu($.commonLabel,z))}if(a){var G=e.styleKeys,V=G.nodeBody,te=G.nodeBorder,ie=G.nodeOutline,ne=G.backgroundImage,X=G.compound,q=G.pie,Y=G.stripe,K=[V,te,ie,ne,X,q,Y].filter(function(ee){return ee!=null}).reduce(Xu,[ja,Is]);e.nodeKey=Wi(K),e.hasPie=q!=null&&q[0]!==ja&&q[1]!==Is,e.hasStripe=Y!=null&&Y[0]!==ja&&Y[1]!==Is}return o!==e.styleKey};Lr.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};Lr.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,d=t._private,g="mapping",f=function(V){return V==null?null:V.pfValue!=null?V.pfValue:V.value},y=function(){var V=f(u),te=f(n);r.checkTriggers(t,n.name,V,te)};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,y(),!0;if(n.deleteBypassed)return u?u.bypass?(u.bypassed=void 0,y(),!0):!1:(y(),!0);if(n.deleteBypass)return u?u.bypass?(i[n.name]=u.bypassed,y(),!0):!1:(y(),!0);var _=function(){zt("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 v=n.field.split("."),m=d.data,x=0;x<v.length&&m;x++){var b=v[x];m=m[b]}if(m==null)return _(),!1;var S;if(Ke(m)){var T=n.fieldMax-n.fieldMin;T===0?S=0:S=(m-n.fieldMin)/T}else return zt("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 N=n.valueMin[0],E=n.valueMax[0],k=n.valueMin[1],L=n.valueMax[1],A=n.valueMin[2],I=n.valueMax[2],O=n.valueMin[3]==null?1:n.valueMin[3],B=n.valueMax[3]==null?1:n.valueMax[3],D=[Math.round(N+(E-N)*S),Math.round(k+(L-k)*S),Math.round(A+(I-A)*S),Math.round(O+(B-O)*S)];s={bypass:n.bypass,name:n.name,value:D,strValue:"rgb("+D[0]+", "+D[1]+", "+D[2]+")"}}else if(a.number){var M=n.valueMin+(n.valueMax-n.valueMin)*S;s=this.parse(n.name,M,n.bypass,g)}else return!1;if(!s)return _(),!1;s.mapping=n,n=s;break}case o.data:{for(var U=n.field.split("."),H=d.data,$=0;$<U.length&&H;$++){var F=U[$];H=H[F]}if(H!=null&&(s=this.parse(n.name,H,n.bypass,g)),!s)return _(),!1;s.mapping=n,n=s;break}case o.fn:{var P=n.value,z=n.fnValue!=null?n.fnValue:P(t);if(n.prevFnValue=z,z==null)return zt("Custom function mappers may not return null (i.e. `"+n.name+"` for ele `"+t.id()+"` is null)"),!1;if(s=this.parse(n.name,z,n.bypass,g),!s)return zt("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=ei(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,y(),!0};Lr.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)}}};Lr.update=function(){var t=this._private.cy,e=t.mutableElements();e.updateStyle()};Lr.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],d=t.pstyle(c),g=e[c];if(g){var f=g.prev,y=f,_=g.next!=null?g.next:d,v=!1,m=void 0,x=1e-6;y&&(Ke(y.pfValue)&&Ke(_.pfValue)?(v=_.pfValue-y.pfValue,m=y.pfValue+x*v):Ke(y.value)&&Ke(_.value)?(v=_.value-y.value,m=y.value+x*v):Gt(y.value)&&Gt(_.value)&&(v=y.value[0]!==_.value[0]||y.value[1]!==_.value[1]||y.value[2]!==_.value[2],m=y.strValue),v&&(a[c]=_.strValue,this.applyBypass(t,c,m),l=!0))}}if(!l)return;n.transitioning=!0,new Zs(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)};Lr.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)};Lr.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)})};Lr.checkBoundsTrigger=function(t,e,r,n){this.checkTrigger(t,e,r,n,function(i){return i.triggersBounds},function(i){t.dirtyCompoundBoundsCache(),t.dirtyBoundingBoxCache()})};Lr.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()})})};Lr.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()})})};Lr.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 Pl={};Pl.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(dt(e)){var d=this.parse(e,r,!0);d&&s.push(d)}else if(Pt(e)){var g=e;n=r;for(var f=Object.keys(g),y=0;y<f.length;y++){var _=f[y],v=g[_];if(v===void 0&&(v=g[Xc(_)]),v!==void 0){var m=this.parse(_,v,!0);m&&s.push(m)}}}else return!1;if(s.length===0)return!1;for(var x=!1,b=0;b<t.length;b++){for(var S=t[b],T={},N=void 0,E=0;E<s.length;E++){var k=s[E];if(n){var L=S.pstyle(k.name);N=T[k.name]={prev:L}}x=this.applyParsedProperty(S,ei(k))||x,n&&(N.next=S.pstyle(k.name))}x&&this.updateStyleHints(S),n&&this.updateTransitions(S,T,o)}return x};Pl.overrideBypass=function(t,e,r){e=nv(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)}};Pl.removeAllBypasses=function(t,e){return this.removeBypasses(t,this.propertyNames,e)};Pl.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 d="",g=this.parse(l,d,!0),f=o[u.name]={prev:c};this.applyParsedProperty(s,g),f.next=s.pstyle(u.name)}}this.updateStyleHints(s),r&&this.updateTransitions(s,o,n)}};var yv={};yv.getEmSizeInPixels=function(){var t=this.containerCss("font-size");return t!=null?parseFloat(t):1};yv.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 ri={};ri.getRenderedStyle=function(t,e){return e?this.getStylePropertyValue(t,e,!0):this.getRawStyle(t,!0)};ri.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[Xc(s.name)]=o)}return n}};ri.getIndexedStyle=function(t,e,r,n){var i=t.pstyle(e)[r][n];return i??t.cy().style().getDefaultProperty(e)[r][0]};ri.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(),d=function(v){return v*c},g=function(v,m){return d(v)+m},f=Gt(a),y=f?l.every(function(_){return _!=null}):l!=null;return y?f?a.map(function(_,v){return g(_,l[v])}).join(" "):g(a,l):f?a.map(function(_){return dt(_)?_:""+d(_)}).join(" "):""+d(a)}else if(u!=null)return u}return null}};ri.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&&(Pt(o)?o=this.parse(s,o.strValue):o=this.parse(s,o)),o&&(r[s]=o)}return r};ri.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[nv(a)],c=this.parse(u.name,l);c&&r.push(c)}return r};ri.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};ri.getPropertiesHash=ri.getNonDefaultPropertiesHash;var ud={};ud.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};ud.fromJson=function(t){var e=this;return e.resetToDefault(),e.appendFromJson(t),e};ud.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 xv={};xv.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){zt("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+n);break}i=c[0];var d=c[1];if(d!=="core"){var g=new na(d);if(g.invalid){zt("Skipping parsing of block: Invalid selector found in string stylesheet: "+d),a();continue}}var f=c[2],y=!1;s=f;for(var _=[];;){var v=s.match(/^\s*$/);if(v)break;var m=s.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!m){zt("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+f),y=!0;break}o=m[0];var x=m[1],b=m[2],S=e.properties[x];if(!S){zt("Skipping property: Invalid property name in: "+o),l();continue}var T=r.parse(x,b);if(!T){zt("Skipping property: Invalid property definition in: "+o),l();continue}_.push({name:x,val:b}),l()}if(y){a();break}r.selector(d);for(var N=0;N<_.length;N++){var E=_[N];r.css(E.name,E.val)}a()}return r};xv.fromString=function(t){var e=this;return e.resetToDefault(),e.appendFromString(t),e};var mr={};(function(){var t=_r,e=v3,r=y3,n=x3,i=b3,s=function(ee){return"^"+ee+"\\s*\\(\\s*([\\w\\.]+)\\s*\\)$"},o=function(ee){var re=t+"|\\w+|"+e+"|"+r+"|"+n+"|"+i;return"^"+ee+"\\s*\\(([\\w\\.]+)\\s*\\,\\s*("+t+")\\s*\\,\\s*("+t+")\\s*,\\s*("+re+")\\s*\\,\\s*("+re+")\\)$"},a=[`^url\\s*\\(\\s*['"]?(.+?)['"]?\\s*\\)$`,"^(none)$","^(.+)$"];mr.types={time:{number:!0,min:0,units:"s|ms",implicitUnits:"ms"},percent:{number:!0,min:0,max:100,units:"%",implicitUnits:"%"},percentages:{number:!0,min:0,max:100,units:"%",implicitUnits:"%",multiple:!0},zeroOneNumber:{number:!0,min:0,max:1,unitless:!0},zeroOneNumbers:{number:!0,min:0,max:1,unitless:!0,multiple:!0},nOneOneNumber:{number:!0,min:-1,max:1,unitless:!0},nonNegativeInt:{number:!0,min:0,integer:!0,unitless:!0},nonNegativeNumber:{number:!0,min:0,unitless:!0},position:{enums:["parent","origin"]},nodeSize:{number:!0,min:0,enums:["label"]},number:{number:!0,unitless:!0},numbers:{number:!0,unitless:!0,multiple:!0},positiveNumber:{number:!0,unitless:!0,min:0,strictMin:!0},size:{number:!0,min:0},bidirectionalSize:{number:!0},bidirectionalSizeMaybePercent:{number:!0,allowPercent:!0},bidirectionalSizes:{number:!0,multiple:!0},sizeMaybePercent:{number:!0,min:0,allowPercent:!0},axisDirection:{enums:["horizontal","leftward","rightward","vertical","upward","downward","auto"]},axisDirectionExplicit:{enums:["leftward","rightward","upward","downward"]},axisDirectionPrimary:{enums:["horizontal","vertical"]},paddingRelativeTo:{enums:["width","height","average","min","max"]},bgWH:{number:!0,min:0,allowPercent:!0,enums:["auto"],multiple:!0},bgPos:{number:!0,allowPercent:!0,multiple:!0},bgRelativeTo:{enums:["inner","include-padding"],multiple:!0},bgRepeat:{enums:["repeat","repeat-x","repeat-y","no-repeat"],multiple:!0},bgFit:{enums:["none","contain","cover"],multiple:!0},bgCrossOrigin:{enums:["anonymous","use-credentials","null"],multiple:!0},bgClip:{enums:["none","node"],multiple:!0},bgContainment:{enums:["inside","over"],multiple:!0},boxSelection:{enums:["contain","overlap","none"]},color:{color:!0},colors:{color:!0,multiple:!0},fill:{enums:["solid","linear-gradient","radial-gradient"]},bool:{enums:["yes","no"]},bools:{enums:["yes","no"],multiple:!0},lineStyle:{enums:["solid","dotted","dashed"]},lineCap:{enums:["butt","round","square"]},linePosition:{enums:["center","inside","outside"]},lineJoin:{enums:["round","bevel","miter"]},borderStyle:{enums:["solid","dotted","dashed","double"]},curveStyle:{enums:["bezier","unbundled-bezier","haystack","segments","straight","straight-triangle","taxi","round-segments","round-taxi"]},radiusType:{enums:["arc-radius","influence-radius"],multiple:!0},fontFamily:{regex:'^([\\w- \\"]+(?:\\s*,\\s*[\\w- \\"]+)*)$'},fontStyle:{enums:["italic","normal","oblique"]},fontWeight:{enums:["normal","bold","bolder","lighter","100","200","300","400","500","600","800","900",100,200,300,400,500,600,700,800,900]},textDecoration:{enums:["none","underline","overline","line-through"]},textTransform:{enums:["none","uppercase","lowercase"]},textWrap:{enums:["none","wrap","ellipsis"]},textOverflowWrap:{enums:["whitespace","anywhere"]},textBackgroundShape:{enums:["rectangle","roundrectangle","round-rectangle","circle"]},nodeShape:{enums:["rectangle","roundrectangle","round-rectangle","cutrectangle","cut-rectangle","bottomroundrectangle","bottom-round-rectangle","barrel","ellipse","triangle","round-triangle","square","pentagon","round-pentagon","hexagon","round-hexagon","concavehexagon","concave-hexagon","heptagon","round-heptagon","octagon","round-octagon","tag","round-tag","star","diamond","round-diamond","vee","rhomboid","right-rhomboid","polygon"]},overlayShape:{enums:["roundrectangle","round-rectangle","ellipse"]},cornerRadius:{number:!0,min:0,units:"px|em",implicitUnits:"px",enums:["auto"]},compoundIncludeLabels:{enums:["include","exclude"]},arrowShape:{enums:["tee","triangle","triangle-tee","circle-triangle","triangle-cross","triangle-backcurve","vee","square","circle","diamond","chevron","none"]},arrowFill:{enums:["filled","hollow"]},arrowWidth:{number:!0,units:"%|px|em",implicitUnits:"px",enums:["match-line"]},display:{enums:["element","none"]},visibility:{enums:["hidden","visible"]},zCompoundDepth:{enums:["bottom","orphan","auto","top"]},zIndexCompare:{enums:["auto","manual"]},valign:{enums:["top","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(ee,re){switch(ee.length){case 2:return re[0]!=="deg"&&re[0]!=="rad"&&re[1]!=="deg"&&re[1]!=="rad";case 1:return dt(ee[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(ee){var re=ee.length;return re===1||re===2||re===4}}};var l={zeroNonZero:function(ee,re){return(ee==null||re==null)&&ee!==re||ee==0&&re!=0?!0:ee!=0&&re==0},any:function(ee,re){return ee!=re},emptyNonEmpty:function(ee,re){var ue=ea(ee),pe=ea(re);return ue&&!pe||!ue&&pe}},u=mr.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}],d=[{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}],g=[{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}],f=[{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}],y=[{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}],_=[{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}],v=[{name:"display",type:u.display,triggersZOrder:l.any,triggersBounds:l.any,triggersBoundsOfConnectedEdges:l.any,triggersBoundsOfParallelEdges:function(ee,re,ue){return ee===re?!1:ue.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}],x=[{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(ee,re){return re.value==="label"?-ee.poolIndex():re.pfValue},T=[{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}],N=[{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}],E=[{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(ee,re){return ee===re?!1:ee==="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}],O=[{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=[];mr.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<=mr.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 M=[];mr.stripeBackgroundN=16,M.push({name:"stripe-size",type:u.sizeMaybePercent}),M.push({name:"stripe-direction",type:u.axisDirectionPrimary});for(var U=1;U<=mr.stripeBackgroundN;U++)M.push({name:"stripe-"+U+"-background-color",type:u.color}),M.push({name:"stripe-"+U+"-background-size",type:u.percent}),M.push({name:"stripe-"+U+"-background-opacity",type:u.zeroOneNumber});var H=[],$=mr.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(K){$.forEach(function(ee){var re=ee+"-"+K.name,ue=K.type,pe=K.triggersBounds;H.push({name:re,type:ue,triggersBounds:pe})})},{});var F=mr.properties=[].concat(_,b,v,m,x,I,y,f,c,d,g,T,N,E,k,B,M,L,A,H,O),P=mr.propertyGroups={behavior:_,transition:b,visibility:v,overlay:m,underlay:x,ghost:I,commonLabel:y,labelDimensions:f,mainLabel:c,sourceLabel:d,targetLabel:g,nodeBody:T,nodeBorder:N,nodeOutline:E,backgroundImage:k,pie:B,stripe:M,compound:L,edgeLine:A,edgeArrow:H,core:O},z=mr.propertyGroupNames={},G=mr.propertyGroupKeys=Object.keys(P);G.forEach(function(K){z[K]=P[K].map(function(ee){return ee.name}),P[K].forEach(function(ee){return ee.groupKey=K})});var V=mr.aliases=[{name:"content",pointsTo:"label"},{name:"control-point-distance",pointsTo:"control-point-distances"},{name:"control-point-weight",pointsTo:"control-point-weights"},{name:"segment-distance",pointsTo:"segment-distances"},{name:"segment-weight",pointsTo:"segment-weights"},{name:"segment-radius",pointsTo:"segment-radii"},{name:"edge-text-rotation",pointsTo:"text-rotation"},{name:"padding-left",pointsTo:"padding"},{name:"padding-right",pointsTo:"padding"},{name:"padding-top",pointsTo:"padding"},{name:"padding-bottom",pointsTo:"padding"}];mr.propertyNames=F.map(function(K){return K.name});for(var te=0;te<F.length;te++){var ie=F[te];F[ie.name]=ie}for(var ne=0;ne<V.length;ne++){var X=V[ne],q=F[X.pointsTo],Y={name:X.name,alias:!0,pointsTo:q};F.push(Y),F[X.name]=Y}})();mr.getDefaultProperty=function(t){return this.getDefaultProperties()[t]};mr.getDefaultProperties=function(){var t=this._private;if(t.defaultProperties!=null)return t.defaultProperties;for(var e=vt({"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<=mr.pieBackgroundN;c++){var d=u.name.replace("{{i}}",c),g=u.value;l[d]=g}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<=mr.stripeBackgroundN;c++){var d=u.name.replace("{{i}}",c),g=u.value;l[d]=g}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 mr.arrowPrefixes.forEach(function(c){var d=c+"-"+u.name,g=u.value;l[d]=g}),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};mr.addDefaultStylesheet=function(){this.selector(":parent").css({shape:"rectangle",padding:10,"background-color":"#eee","border-color":"#ccc","border-width":1}).selector("edge").css({width:3}).selector(":loop").css({"curve-style":"bezier"}).selector("edge:compound").css({"curve-style":"bezier","source-endpoint":"outside-to-line","target-endpoint":"outside-to-line"}).selector(":selected").css({"background-color":"#0169D9","line-color":"#0169D9","source-arrow-color":"#0169D9","target-arrow-color":"#0169D9","mid-source-arrow-color":"#0169D9","mid-target-arrow-color":"#0169D9"}).selector(":parent:selected").css({"background-color":"#CCE1F9","border-color":"#aec8e5"}).selector(":active").css({"overlay-color":"black","overlay-padding":10,"overlay-opacity":.25}),this.defaultLength=this.length};var cd={};cd.parse=function(t,e,r,n){var i=this;if(lr(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=Gw(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=ei(c),c&&(c.value=ei(c.value))),c};cd.parseImplWarn=function(t,e,r,n){var i=this.parseImpl(t,e,r,n);return!i&&e!=null&&zt("The style property `".concat(t,": ").concat(e,"` is invalid")),i&&(i.name==="width"||i.name==="height")&&e==="label"&&zt("The style value of `label` is deprecated for `"+i.name+"`"),i};cd.parseImpl=function(t,e,r,n){var i=this;t=nv(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=dt(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(lr(e))return{name:t,value:e,strValue:"fn",mapped:a.fn,bypass:r};var c,d;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 g=a.data;return{name:t,value:c,strValue:""+e,mapped:g,field:c[1],bypass:r}}else if(e.length>=10&&e[0]==="m"&&(d=new RegExp(a.mapData.regex).exec(e))){if(r||u.multiple)return!1;var f=a.mapData;if(!(u.color||u.number))return!1;var y=this.parse(t,d[4]);if(!y||y.mapped)return!1;var _=this.parse(t,d[5]);if(!_||_.mapped)return!1;if(y.pfValue===_.pfValue||y.strValue===_.strValue)return zt("`"+t+": "+e+"` is not a valid mapper because the output range is zero; converting to `"+t+": "+y.strValue+"`"),this.parse(t,y.strValue);if(u.color){var v=y.value,m=_.value,x=v[0]===m[0]&&v[1]===m[1]&&v[2]===m[2]&&(v[3]===m[3]||(v[3]==null||v[3]===1)&&(m[3]==null||m[3]===1));if(x)return!1}return{name:t,value:d,strValue:""+e,mapped:f,field:d[1],fieldMin:parseFloat(d[2]),fieldMax:parseFloat(d[3]),valueMin:y.value,valueMax:_.value,bypass:r}}}if(u.multiple&&n!=="multiple"){var b;if(l?b=e.split(/\s+/):Gt(e)?b=e:b=[e],u.evenMultiple&&b.length%2!==0)return null;for(var S=[],T=[],N=[],E="",k=!1,L=0;L<b.length;L++){var A=i.parse(t,b[L],r,"multiple");k=k||dt(A.value),S.push(A.value),N.push(A.pfValue!=null?A.pfValue:A.value),T.push(A.units),E+=(L>0?" ":"")+A.strValue}return u.validate&&!u.validate(S,T)?null:u.singleEnum&&k?S.length===1&&dt(S[0])?{name:t,value:S[0],strValue:S[0],bypass:r}:null:{name:t,value:S,pfValue:N,strValue:E,bypass:r,units:T}}var I=function(){for(var Y=0;Y<u.enums.length;Y++){var K=u.enums[Y];if(K===e)return{name:t,value:e,strValue:""+e,bypass:r}}return null};if(u.number){var O,B="px";if(u.units&&(O=u.units),u.implicitUnits&&(B=u.implicitUnits),!u.unitless)if(l){var D="px|em"+(u.allowPercent?"|\\%":"");O&&(D=O);var M=e.match("^("+_r+")("+D+")?$");M&&(e=M[1],O=M[2]||B)}else(!O||u.implicitUnits)&&(O=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&&!Mw(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+(O||""),units:O,bypass:r};return u.unitless||O!=="px"&&O!=="em"?U.pfValue=e:U.pfValue=O==="px"||!O?e:this.getEmSizeInPixels()*e,(O==="ms"||O==="s")&&(U.pfValue=O==="ms"?e:1e3*e),(O==="deg"||O==="rad")&&(U.pfValue=O==="rad"?e:bT(e)),O==="%"&&(U.pfValue=e/100),U}else if(u.propList){var H=[],$=""+e;if($!=="none"){for(var F=$.split(/\s*,\s*|\s+/),P=0;P<F.length;P++){var z=F[P].trim();i.properties[z]?H.push(z):zt("`"+z+"` is not a valid property name")}if(H.length===0)return null}return{name:t,value:H,strValue:H.length===0?"none":H.join(" "),bypass:r}}else if(u.color){var G=Fw(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 V=I();if(V)return V}for(var te=u.regexes?u.regexes:[u.regex],ie=0;ie<te.length;ie++){var ne=new RegExp(te[ie]),X=ne.exec(e);if(X)return{name:t,value:u.singleRegexMatchValue?X[1]:X,strValue:""+e,bypass:r}}return null}else return u.string?{name:t,value:""+e,strValue:""+e,bypass:r}:u.enums?I():null};var Rr=function(e){if(!(this instanceof Rr))return new Rr(e);if(!rv(e)){ir("A style must have a core reference");return}this._private={cy:e,coreStyle:{}},this.length=0,this.resetToDefault()},$r=Rr.prototype;$r.instanceString=function(){return"style"};$r.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};$r.resetToDefault=function(){return this.clear(),this.addDefaultStylesheet(),this};$r.core=function(t){return this._private.coreStyle[t]||this.getDefaultProperty(t)};$r.selector=function(t){var e=t==="core"?null:new na(t),r=this.length++;return this[r]={selector:e,properties:[],mappedProperties:[],index:r},this};$r.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[Xc(i.name)]),s!==void 0&&this.cssRule(i.name,s)}else e.length===2&&this.cssRule(e[0],e[1]);return this};$r.style=$r.css;$r.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};$r.append=function(t){return Ow(t)?t.appendToStyle(this):Gt(t)?this.appendFromJson(t):dt(t)&&this.appendFromString(t),this};Rr.fromJson=function(t,e){var r=new Rr(t);return r.fromJson(e),r};Rr.fromString=function(t,e){return new Rr(t).fromString(e)};[Lr,Pl,yv,ri,ud,xv,mr,cd].forEach(function(t){vt($r,t)});Rr.types=$r.types;Rr.properties=$r.properties;Rr.propertyGroups=$r.propertyGroups;Rr.propertyGroupNames=$r.propertyGroupNames;Rr.propertyGroupKeys=$r.propertyGroupKeys;var kL={style:function(e){if(e){var r=this.setStyle(e);r.update()}return this._private.style},setStyle:function(e){var r=this._private;return Ow(e)?r.style=e.generateStyle(this):Gt(e)?r.style=Rr.fromJson(this,e):dt(e)?r.style=Rr.fromString(this,e):r.style=Rr(this),r.style},updateStyle:function(){this.mutableElements().updateStyle()}},EL="single",Ga={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=EL),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(dt(e[0]))return n=e[0],r[n];if(Pt(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:Pt(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(dt(e)){var i=e;e=this.$(i)}else if(h3(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 mn(e)||(e=this.mutableElements());if(!(mn(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:Pt(e)&&(o=e.level,e.position!=null?s=Jc(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,d={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:d}}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),Pt(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(dt(e)){var n=e;e=this.mutableElements().filter(n)}else mn(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}};Ga.centre=Ga.center;Ga.autolockNodes=Ga.autolock;Ga.autoungrabifyNodes=Ga.autoungrabify;var xl={data:Ft.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeData:Ft.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),scratch:Ft.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Ft.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0})};xl.attr=xl.data;xl.removeAttr=xl.removeData;var bl=function(e){var r=this;e=vt({},e);var n=e.container;n&&!Ac(n)&&Ac(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=wr!==void 0&&n!==void 0&&!e.headless,a=e;a.layout=vt({name:o?"grid":"null"},a.layout),a.renderer=vt({name:o?"canvas":"null"},a.renderer);var l=function(y,_,v){return _!==void 0?_:v!==void 0?v:y},u=this._private={container:n,ready:!1,options:a,elements:new Mr(this),listeners:[],aniEles:new Mr(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:Pt(a.pan)&&Ke(a.pan.x)?a.pan.x:0,y:Pt(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(y,_){var v=y.some(f3);if(v)return Zs.all(y).then(_);_(y)};u.styleEnabled&&r.setStyle([]);var d=vt({},a,a.renderer);r.initRenderer(d);var g=function(y,_,v){r.notifications(!1);var m=r.mutableElements();m.length>0&&m.remove(),y!=null&&(Pt(y)||Gt(y))&&r.add(y),r.one("layoutready",function(b){r.notifications(!0),r.emit(b),r.one("load",_),r.emitAndNotify("load")}).one("layoutstop",function(){r.one("done",v),r.emit("done")});var x=vt({},r._private.options.layout);x.eles=r.elements(),r.layout(x).run()};c([a.style,a.elements],function(f){var y=f[0],_=f[1];u.styleEnabled&&r.style().append(y),g(_,function(){r.startAnimationLoop(),u.ready=!0,lr(a.ready)&&r.on("ready",a.ready);for(var v=0;v<s.length;v++){var m=s[v];r.on("ready",m)}i&&(i.readies=[]),r.emit("ready")},a.done)})},Fc=bl.prototype;vt(Fc,{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 wr;var r=this._private.container.ownerDocument;return r===void 0||r==null?wr:r.defaultView||wr},mount:function(e){if(e!=null){var r=this,n=r._private,i=n.options;return!Ac(e)&&Ac(e[0])&&(e=e[0]),r.stopAnimationLoop(),r.destroyRenderer(),n.container=e,n.styleEnabled=!0,r.invalidateSize(),r.initRenderer(vt({},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 ei(this._private.options)},json:function(e){var r=this,n=r._private,i=r.mutableElements(),s=function(S){return r.getElementById(S.id())};if(Pt(e)){if(r.startBatch(),e.elements){var o={},a=function(S,T){for(var N=[],E=[],k=0;k<S.length;k++){var L=S[k];if(!L.data.id){zt("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?E.push({ele:I,json:L}):(T&&(L.group=T),N.push(L))}r.add(N);for(var O=0;O<E.length;O++){var B=E[O],D=B.ele,M=B.json;D.json(M)}};if(Gt(e.elements))a(e.elements);else for(var l=["nodes","edges"],u=0;u<l.length;u++){var c=l[u],d=e.elements[c];Gt(d)&&a(d,c)}var g=r.collection();i.filter(function(b){return!o[b.id()]}).forEach(function(b){b.isParent()?g.merge(b):b.remove()}),g.forEach(function(b){return b.children().move({parent:null})}),g.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 f=["minZoom","maxZoom","zoomingEnabled","userZoomingEnabled","panningEnabled","userPanningEnabled","boxSelectionEnabled","autolock","autoungrabify","autounselectify","multiClickDebounceTime"],y=0;y<f.length;y++){var _=f[y];e[_]!=null&&r[_](e[_])}return r.endBatch(),this}else{var v=!!e,m={};v?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=ei(r.data());var x=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=ei(n.pan),m.boxSelectionEnabled=n.boxSelectionEnabled,m.renderer=ei(x.renderer),m.hideEdgesOnViewport=x.hideEdgesOnViewport,m.textureOnViewport=x.textureOnViewport,m.wheelSensitivity=x.wheelSensitivity,m.motionBlur=x.motionBlur,m.multiClickDebounceTime=x.multiClickDebounceTime,m}}});Fc.$id=Fc.getElementById;[gL,bL,B_,Eg,_c,_L,Tg,Sc,kL,Ga,xl].forEach(function(t){vt(Fc,t)});var TL={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}},NL={maximal:!1,acyclic:!1},Ts=function(e){return e.scratch("breadthfirst")},B1=function(e,r){return e.scratch("breadthfirst",r)};function j_(t){this.options=vt({},TL,NL,t)}j_.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=Zr(a?t.boundingBox:structuredClone(e.extent())),u;if(mn(t.roots))u=t.roots;else if(Gt(t.roots)){for(var c=[],d=0;d<t.roots.length;d++){var g=t.roots[d],f=e.getElementById(g);c.push(f)}u=e.collection(c)}else if(dt(t.roots))u=e.$(t.roots);else if(s)u=n.roots();else{var y=r.components();u=e.collection();for(var _=function(){var Ee=y[v],Pe=Ee.maxDegree(!1),ze=Ee.filter(function(Me){return Me.degree(!1)===Pe});u=u.add(ze)},v=0;v<y.length;v++)_()}var m=[],x={},b=function(Ee,Pe){m[Pe]==null&&(m[Pe]=[]);var ze=m[Pe].length;m[Pe].push(Ee),B1(Ee,{index:ze,depth:Pe})},S=function(Ee,Pe){var ze=Ts(Ee),Me=ze.depth,Ue=ze.index;m[Me][Ue]=null,Ee.isChildless()&&b(Ee,Pe)};i.bfs({roots:u,directed:t.directed,visit:function(Ee,Pe,ze,Me,Ue){var Ge=Ee[0],ve=Ge.id();Ge.isChildless()&&b(Ge,Ue),x[ve]=!0}});for(var T=[],N=0;N<n.length;N++){var E=n[N];x[E.id()]||T.push(E)}var k=function(Ee){for(var Pe=m[Ee],ze=0;ze<Pe.length;ze++){var Me=Pe[ze];if(Me==null){Pe.splice(ze,1),ze--;continue}B1(Me,{depth:Ee,index:ze})}},L=function(Ee,Pe){for(var ze=Ts(Ee),Me=Ee.incomers().filter(function(Z){return Z.isNode()&&r.has(Z)}),Ue=-1,Ge=Ee.id(),ve=0;ve<Me.length;ve++){var Ce=Me[ve],Ie=Ts(Ce);Ue=Math.max(Ue,Ie.depth)}if(ze.depth<=Ue){if(!t.acyclic&&Pe[Ge])return null;var me=Ue+1;return S(Ee,me),Pe[Ge]=me,!0}return!1};if(s&&o){var A=[],I={},O=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(),M=L(D,I);if(M)D.outgoers().filter(function(Le){return Le.isNode()&&r.has(Le)}).forEach(O);else if(M===null){zt("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 H=0;H<n.length;H++){var $=n[H],F=$.layoutDimensions(t),P=F.w,z=F.h;U=Math.max(U,P,z)}var G={},V=function(Ee){if(G[Ee.id()])return G[Ee.id()];for(var Pe=Ts(Ee).depth,ze=Ee.neighborhood(),Me=0,Ue=0,Ge=0;Ge<ze.length;Ge++){var ve=ze[Ge];if(!(ve.isEdge()||ve.isParent()||!n.has(ve))){var Ce=Ts(ve);if(Ce!=null){var Ie=Ce.index,me=Ce.depth;if(!(Ie==null||me==null)){var Z=m[me].length;me<Pe&&(Me+=Ie/Z,Ue++)}}}}return Ue=Math.max(1,Ue),Me=Me/Ue,Ue===0&&(Me=0),G[Ee.id()]=Me,Me},te=function(Ee,Pe){var ze=V(Ee),Me=V(Pe),Ue=ze-Me;return Ue===0?jw(Ee.id(),Pe.id()):Ue};t.depthSort!==void 0&&(te=t.depthSort);for(var ie=m.length,ne=0;ne<ie;ne++)m[ne].sort(te),k(ne);for(var X=[],q=0;q<T.length;q++)X.push(T[q]);var Y=function(){for(var Ee=0;Ee<ie;Ee++)k(Ee)};X.length&&(m.unshift(X),ie=m.length,Y());for(var K=0,ee=0;ee<ie;ee++)K=Math.max(m[ee].length,K);var re={x:l.x1+l.w/2,y:l.y1+l.h/2},ue=n.reduce(function(Le,Ee){return(function(Pe){return{w:Le.w===-1?Pe.w:(Le.w+Pe.w)/2,h:Le.h===-1?Pe.h:(Le.h+Pe.h)/2}})(Ee.boundingBox({includeLabels:t.nodeDimensionsIncludeLabels}))},{w:-1,h:-1}),pe=Math.max(ie===1?0:a?(l.h-t.padding*2-ue.h)/(ie-1):(l.h-t.padding*2-ue.h)/(ie+1),U),Re=m.reduce(function(Le,Ee){return Math.max(Le,Ee.length)},0),Be=function(Ee){var Pe=Ts(Ee),ze=Pe.depth,Me=Pe.index;if(t.circle){var Ue=Math.min(l.w/2/ie,l.h/2/ie);Ue=Math.max(Ue,U);var Ge=Ue*ze+Ue-(ie>0&&m[0].length<=3?Ue/2:0),ve=2*Math.PI/m[ze].length*Me;return ze===0&&m[0].length===1&&(Ge=1),{x:re.x+Ge*Math.cos(ve),y:re.y+Ge*Math.sin(ve)}}else{var Ce=m[ze].length,Ie=Math.max(Ce===1?0:a?(l.w-t.padding*2-ue.w)/((t.grid?Re:Ce)-1):(l.w-t.padding*2-ue.w)/((t.grid?Re:Ce)+1),U),me={x:re.x+(Me+1-(Ce+1)/2)*Ie,y:re.y+(ze+1-(ie+1)/2)*pe};return me}},_e={downward:0,leftward:90,upward:180,rightward:-90};Object.keys(_e).indexOf(t.direction)===-1&&ir("Invalid direction '".concat(t.direction,"' specified for breadthfirst layout. Valid values are: ").concat(Object.keys(_e).join(", ")));var Te=function(Ee){return U3(Be(Ee),l,_e[t.direction])};return r.nodes().layoutPositions(this,t,Te),this};var RL={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 F_(t){this.options=vt({},RL,t)}F_.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=Zr(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,d=0,g=0;g<s.length;g++){var f=s[g],y=f.layoutDimensions(e),_=y.w,v=y.h;d=Math.max(d,_,v)}if(Ke(e.radius)?c=e.radius:s.length<=1?c=0:c=Math.min(o.h,o.w)/2-d,s.length>1&&e.avoidOverlap){d*=1.75;var m=Math.cos(u)-Math.cos(0),x=Math.sin(u)-Math.sin(0),b=Math.sqrt(d*d/(m*m+x*x));c=Math.max(b,c)}var S=function(N,E){var k=e.startAngle+E*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 LL={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 z_(t){this.options=vt({},LL,t)}z_.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=Zr(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 d=s[c],g=void 0;g=e.concentric(d),l.push({value:g,node:d}),d._private.scratch.concentric=g}s.updateStyle();for(var f=0;f<s.length;f++){var y=s[f],_=y.layoutDimensions(e);u=Math.max(u,_.w,_.h)}l.sort(function(pe,Re){return Re.value-pe.value});for(var v=e.levelWidth(s),m=[[]],x=m[0],b=0;b<l.length;b++){var S=l[b];if(x.length>0){var T=Math.abs(x[0].value-S.value);T>=v&&(x=[],m.push(x))}x.push(S)}var N=u+e.minNodeSpacing;if(!e.avoidOverlap){var E=m.length>0&&m[0].length>1,k=Math.min(o.w,o.h)/2-N,L=k/(m.length+E?1:0);N=Math.min(N,L)}for(var A=0,I=0;I<m.length;I++){var O=m[I],B=e.sweep===void 0?2*Math.PI-2*Math.PI/O.length:e.sweep,D=O.dTheta=B/Math.max(1,O.length-1);if(O.length>1&&e.avoidOverlap){var M=Math.cos(D)-Math.cos(0),U=Math.sin(D)-Math.sin(0),H=Math.sqrt(N*N/(M*M+U*U));A=Math.max(H,A)}O.r=A,A+=N}if(e.equidistant){for(var $=0,F=0,P=0;P<m.length;P++){var z=m[P],G=z.r-F;$=Math.max($,G)}F=0;for(var V=0;V<m.length;V++){var te=m[V];V===0&&(F=te.r),te.r=F,F+=$}}for(var ie={},ne=0;ne<m.length;ne++)for(var X=m[ne],q=X.dTheta,Y=X.r,K=0;K<X.length;K++){var ee=X[K],re=e.startAngle+(r?1:-1)*q*K,ue={x:a.x+Y*Math.cos(re),y:a.y+Y*Math.sin(re)};ie[ee.node.id()]=ue}return i.nodes().layoutPositions(this,e,function(pe){var Re=pe.id();return ie[Re]}),this};var Mp,DL={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 dd(t){this.options=vt({},DL,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)}dd.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?Mp=!0:Mp=!1;var n=AL(e,r,t);Mp&&ML(n),t.randomize&&IL(n);var i=xi(),s=function(){OL(n,e,t),t.fit===!0&&e.fit(t.padding)},o=function(g){return!(r.stopped||g>=t.numIter||(BL(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 g=t.eles.nodes(),f=U_(n,t,g);g.layoutPositions(r,t,f)}},l=0,u=!0;if(t.animate===!0){var c=function(){for(var g=0;u&&g<t.refresh;)u=o(l),l++,g++;if(!u)F1(n,t),a();else{var f=xi();f-i>=t.animationThreshold&&s(),Pc(c)}};c()}else{for(;u;)u=o(l),l++;F1(n,t),a()}return this};dd.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this};dd.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var AL=function(e,r,n){for(var i=n.eles.edges(),s=n.eles.nodes(),o=Zr(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 d=l[c],g=0;g<d.length;g++){var f=d[g];u[f.id()]=c}for(var c=0;c<a.nodeSize;c++){var y=s[c],_=y.layoutDimensions(n),v={};v.isLocked=y.locked(),v.id=y.data("id"),v.parentId=y.data("parent"),v.cmptId=u[y.id()],v.children=[],v.positionX=y.position("x"),v.positionY=y.position("y"),v.offsetX=0,v.offsetY=0,v.height=_.w,v.width=_.h,v.maxX=v.positionX+v.width/2,v.minX=v.positionX-v.width/2,v.maxY=v.positionY+v.height/2,v.minY=v.positionY-v.height/2,v.padLeft=parseFloat(y.style("padding")),v.padRight=parseFloat(y.style("padding")),v.padTop=parseFloat(y.style("padding")),v.padBottom=parseFloat(y.style("padding")),v.nodeRepulsion=lr(n.nodeRepulsion)?n.nodeRepulsion(y):n.nodeRepulsion,a.layoutNodes.push(v),a.idToIndex[v.id]=c}for(var m=[],x=0,b=-1,S=[],c=0;c<a.nodeSize;c++){var y=a.layoutNodes[c],T=y.parentId;T!=null?a.layoutNodes[a.idToIndex[T]].children.push(y.id):(m[++b]=y.id,S.push(y.id))}for(a.graphSet.push(S);x<=b;){var N=m[x++],E=a.idToIndex[N],f=a.layoutNodes[E],k=f.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],g=0;g<L.length;g++){var A=a.idToIndex[L[g]];a.indexToGraph[A]=c}for(var c=0;c<a.edgeSize;c++){var I=i[c],O={};O.id=I.data("id"),O.sourceId=I.data("source"),O.targetId=I.data("target");var B=lr(n.idealEdgeLength)?n.idealEdgeLength(I):n.idealEdgeLength,D=lr(n.edgeElasticity)?n.edgeElasticity(I):n.edgeElasticity,M=a.idToIndex[O.sourceId],U=a.idToIndex[O.targetId],H=a.indexToGraph[M],$=a.indexToGraph[U];if(H!=$){for(var F=PL(O.sourceId,O.targetId,a),P=a.graphSet[F],z=0,v=a.layoutNodes[M];P.indexOf(v.id)===-1;)v=a.layoutNodes[a.idToIndex[v.parentId]],z++;for(v=a.layoutNodes[U];P.indexOf(v.id)===-1;)v=a.layoutNodes[a.idToIndex[v.parentId]],z++;B*=z*n.nestingFactor}O.idealLength=B,O.elasticity=D,a.layoutEdges.push(O)}return a},PL=function(e,r,n){var i=H_(e,r,0,n);return 2>i.count?0:i.graph},H_=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 d=i.indexToGraph[i.idToIndex[c[0]]],g=H_(e,r,d,i);if(g.count!==0)if(g.count===1){if(o++,o===2)break}else return g}}return{count:o,graph:n}},ML,IL=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)}},U_=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}}},OL=function(e,r,n){var i=n.layout,s=n.eles.nodes(),o=U_(e,n,s);s.positions(o),e.ready!==!0&&(e.ready=!0,i.one("layoutready",n.ready),i.emit({type:"layoutready",layout:this}))},BL=function(e,r,n){jL(e,r),HL(e),UL(e,r),$L(e),WL(e)},jL=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]]];FL(a,u,e,r)}},j1=function(e){return-e+2*e*Math.random()},FL=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=j1(u),l=j1(u));var c=zL(e,r,a,l);if(c>0)var d=i.nodeOverlap*c,g=Math.sqrt(a*a+l*l),f=d*a/g,y=d*l/g;else var _=zc(e,a,l),v=zc(r,-1*a,-1*l),m=v.x-_.x,x=v.y-_.y,b=m*m+x*x,g=Math.sqrt(b),d=(e.nodeRepulsion+r.nodeRepulsion)/b,f=d*m/g,y=d*x/g;e.isLocked||(e.offsetX-=f,e.offsetY-=y),r.isLocked||(r.offsetX+=f,r.offsetY+=y)}},zL=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},zc=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)},HL=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 d=zc(o,u,c),g=zc(l,-1*u,-1*c),f=g.x-d.x,y=g.y-d.y,_=Math.sqrt(f*f+y*y),v=Math.pow(i.idealLength-_,2)/i.elasticity;if(_!==0)var m=v*f/_,x=v*y/_;else var m=0,x=0;o.isLocked||(o.offsetX+=m,o.offsetY+=x),l.isLocked||(l.offsetX-=m,l.offsetY-=x)}}},UL=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 d=0;d<o;d++){var g=e.layoutNodes[e.idToIndex[s[d]]];if(!g.isLocked){var f=a-g.positionX,y=l-g.positionY,_=Math.sqrt(f*f+y*y);if(_>n){var v=r.gravity*f/_,m=r.gravity*y/_;g.offsetX+=v,g.offsetY+=m}}}}},$L=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,d=l.offsetY,g=0;g<u.length;g++){var f=e.layoutNodes[e.idToIndex[u[g]]];f.offsetX+=c,f.offsetY+=d,n[++s]=u[g]}l.offsetX=0,l.offsetY=0}}},WL=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=VL(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,$_(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)}},VL=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},$_=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 $_(i,r)}},F1=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 d=0;d<c.length;d++){var g=c[d];c.x1=Math.min(c.x1,g.positionX-g.width/2),c.x2=Math.max(c.x2,g.positionX+g.width/2),c.y1=Math.min(c.y1,g.positionY-g.height/2),c.y2=Math.max(c.y2,g.positionY+g.height/2)}c.w=c.x2-c.x1,c.h=c.y2-c.y1,u+=c.w*c.h}}i.sort(function(x,b){return b.w*b.h-x.w*x.h});for(var f=0,y=0,_=0,v=0,m=Math.sqrt(u)*e.clientWidth/e.clientHeight,s=0;s<i.length;s++){var c=i[s];if(c){for(var d=0;d<c.length;d++){var g=c[d];g.isLocked||(g.positionX+=f-c.x1,g.positionY+=y-c.y1)}f+=c.w+r.componentSpacing,_+=c.w+r.componentSpacing,v=Math.max(v,c.h),_>m&&(y+=v+r.componentSpacing,f=0,_=0,v=0)}}},GL={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 W_(t){this.options=vt({},GL,t)}W_.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=Zr(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(V){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(te){if(te==null)return Math.min(l,u);var ie=Math.min(l,u);ie==l?l=te:u=te},d=function(te){if(te==null)return Math.max(l,u);var ie=Math.max(l,u);ie==l?l=te:u=te},g=e.rows,f=e.cols!=null?e.cols:e.columns;if(g!=null&&f!=null)l=g,u=f;else if(g!=null&&f==null)l=g,u=Math.ceil(o/l);else if(g==null&&f!=null)u=f,l=Math.ceil(o/u);else if(u*l>o){var y=c(),_=d();(y-1)*_>=o?c(y-1):(_-1)*y>=o&&d(_-1)}else for(;u*l<o;){var v=c(),m=d();(m+1)*v>=o?d(m+1):c(v+1)}var x=s.w/u,b=s.h/l;if(e.condense&&(x=0,b=0),e.avoidOverlap)for(var S=0;S<i.length;S++){var T=i[S],N=T._private.position;(N.x==null||N.y==null)&&(N.x=0,N.y=0);var E=T.layoutDimensions(e),k=e.avoidOverlapPadding,L=E.w+k,A=E.h+k;x=Math.max(x,L),b=Math.max(b,A)}for(var I={},O=function(te,ie){return!!I["c-"+te+"-"+ie]},B=function(te,ie){I["c-"+te+"-"+ie]=!0},D=0,M=0,U=function(){M++,M>=u&&(M=0,D++)},H={},$=0;$<i.length;$++){var F=i[$],P=e.position(F);if(P&&(P.row!==void 0||P.col!==void 0)){var z={row:P.row,col:P.col};if(z.col===void 0)for(z.col=0;O(z.row,z.col);)z.col++;else if(z.row===void 0)for(z.row=0;O(z.row,z.col);)z.row++;H[F.id()]=z,B(z.row,z.col)}}var G=function(te,ie){var ne,X;if(te.locked()||te.isParent())return!1;var q=H[te.id()];if(q)ne=q.col*x+x/2+s.x1,X=q.row*b+b/2+s.y1;else{for(;O(D,M);)U();ne=M*x+x/2+s.x1,X=D*b+b/2+s.y1,B(D,M),U()}return{x:ne,y:X}};i.layoutPositions(this,e,G)}return this};var qL={ready:function(){},stop:function(){}};function bv(t){this.options=vt({},qL,t)}bv.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};bv.prototype.stop=function(){return this};var YL={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 V_(t){this.options=vt({},YL,t)}V_.prototype.run=function(){var t=this.options,e=t.eles,r=e.nodes(),n=lr(t.positions);function i(s){if(t.positions==null)return pT(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 KL={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 G_(t){this.options=vt({},KL,t)}G_.prototype.run=function(){var t=this.options,e=t.cy,r=t.eles,n=Zr(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 XL=[{name:"breadthfirst",impl:j_},{name:"circle",impl:F_},{name:"concentric",impl:z_},{name:"cose",impl:dd},{name:"grid",impl:W_},{name:"null",impl:bv},{name:"preset",impl:V_},{name:"random",impl:G_}];function q_(t){this.options=t,this.notifications=0}var z1=function(){},H1=function(){throw new Error("A headless instance can not render images")};q_.prototype={recalculateRenderedStyle:z1,notify:function(){this.notifications++},init:z1,isHeadless:function(){return!0},png:H1,jpg:H1};var wv={};wv.arrowShapeWidth=.3;wv.registerArrowShapes=function(){var t=this.arrowShapes={},e=this,r=function(u,c,d,g,f,y,_){var v=f.x-d/2-_,m=f.x+d/2+_,x=f.y-d/2-_,b=f.y+d/2+_,S=v<=u&&u<=m&&x<=c&&c<=b;return S},n=function(u,c,d,g,f){var y=u*Math.cos(g)-c*Math.sin(g),_=u*Math.sin(g)+c*Math.cos(g),v=y*d,m=_*d,x=v+f.x,b=m+f.y;return{x,y:b}},i=function(u,c,d,g){for(var f=[],y=0;y<u.length;y+=2){var _=u[y],v=u[y+1];f.push(n(_,v,c,d,g))}return f},s=function(u){for(var c=[],d=0;d<u.length;d++){var g=u[d];c.push(g.x,g.y)}return c},o=function(u){return u.pstyle("width").pfValue*u.pstyle("arrow-scale").pfValue*2},a=function(u,c){dt(c)&&(c=t[c]),t[u]=vt({name:u,points:[-.15,-.3,.15,-.3,.15,.3,-.15,.3],collide:function(g,f,y,_,v,m){var x=s(i(this.points,y+2*m,_,v)),b=ln(g,f,x);return b},roughCollide:r,draw:function(g,f,y,_){var v=i(this.points,f,y,_);e.arrowShapeImpl("polygon")(g,v)},spacing:function(g){return 0},gap:o},c)};a("none",{collide:Mc,roughCollide:Mc,draw:sv,spacing:tx,gap:tx}),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,d,g,f){var y=i(this.points,c,d,g),_=this.controlPoint,v=n(_[0],_[1],c,d,g);e.arrowShapeImpl(this.name)(u,y,v)},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,d,g,f,y,_){var v=s(i(this.points,d+2*_,g,f)),m=s(i(this.pointsTee,d+2*_,g,f)),x=ln(u,c,v)||ln(u,c,m);return x},draw:function(u,c,d,g,f){var y=i(this.points,c,d,g),_=i(this.pointsTee,c,d,g);e.arrowShapeImpl(this.name)(u,y,_)}}),a("circle-triangle",{radius:.15,pointsTr:[0,-.15,.15,-.45,-.15,-.45,0,-.15],collide:function(u,c,d,g,f,y,_){var v=f,m=Math.pow(v.x-u,2)+Math.pow(v.y-c,2)<=Math.pow((d+2*_)*this.radius,2),x=s(i(this.points,d+2*_,g,f));return ln(u,c,x)||m},draw:function(u,c,d,g,f){var y=i(this.pointsTr,c,d,g);e.arrowShapeImpl(this.name)(u,y,g.x,g.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 d=this.baseCrossLinePts.slice(),g=c/u,f=3,y=5;return d[f]=d[f]-g,d[y]=d[y]-g,d},collide:function(u,c,d,g,f,y,_){var v=s(i(this.points,d+2*_,g,f)),m=s(i(this.crossLinePts(d,y),d+2*_,g,f)),x=ln(u,c,v)||ln(u,c,m);return x},draw:function(u,c,d,g,f){var y=i(this.points,c,d,g),_=i(this.crossLinePts(c,f),c,d,g);e.arrowShapeImpl(this.name)(u,y,_)}}),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,d,g,f,y,_){var v=f,m=Math.pow(v.x-u,2)+Math.pow(v.y-c,2)<=Math.pow((d+2*_)*this.radius,2);return m},draw:function(u,c,d,g,f){e.arrowShapeImpl(this.name)(u,g.x,g.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 Ka={};Ka.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]};Ka.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,d=e.width/(o+c),g=o-l,f=a-u,y=e.left+i.left+s.left,_=e.top+i.top+s.top;return this.containerBB=[y,_,g,f,d]};Ka.invalidateContainerClientCoordsCache=function(){this.containerBB=null};Ka.findNearestElement=function(t,e,r,n){return this.findNearestElements(t,e,r,n)[0]};Ka.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,d=(n?8:2)/l,g=(n?8:2)/l,f=1/0,y,_;r&&(o=o.interactive);function v(E,k){if(E.isNode()){if(_)return;_=E,a.push(E)}if(E.isEdge()&&(k==null||k<f))if(y){if(y.pstyle("z-compound-depth").value===E.pstyle("z-compound-depth").value&&y.pstyle("z-compound-depth").value===E.pstyle("z-compound-depth").value){for(var L=0;L<a.length;L++)if(a[L].isEdge()){a[L]=E,y=E,f=k??f;break}}}else a.push(E),y=E,f=k??f}function m(E){var k=E.outerWidth()+2*d,L=E.outerHeight()+2*d,A=k/2,I=L/2,O=E.position(),B=E.pstyle("corner-radius").value==="auto"?"auto":E.pstyle("corner-radius").pfValue,D=E._private.rscratch;if(O.x-A<=t&&t<=O.x+A&&O.y-I<=e&&e<=O.y+I){var M=s.nodeShapes[i.getNodeShape(E)];if(M.checkPoint(t,e,0,k,L,O.x,O.y,B,D))return v(E,0),!0}}function x(E){var k=E._private,L=k.rscratch,A=E.pstyle("width").pfValue,I=E.pstyle("arrow-scale").value,O=A/2+c,B=O*O,D=O*2,$=k.source,F=k.target,M;if(L.edgeType==="segments"||L.edgeType==="straight"||L.edgeType==="haystack"){for(var U=L.allpts,H=0;H+3<U.length;H+=2)if(RT(t,e,U[H],U[H+1],U[H+2],U[H+3],D)&&B>(M=MT(t,e,U[H],U[H+1],U[H+2],U[H+3])))return v(E,M),!0}else if(L.edgeType==="bezier"||L.edgeType==="multibezier"||L.edgeType==="self"||L.edgeType==="compound"){for(var U=L.allpts,H=0;H+5<L.allpts.length;H+=4)if(LT(t,e,U[H],U[H+1],U[H+2],U[H+3],U[H+4],U[H+5],D)&&B>(M=PT(t,e,U[H],U[H+1],U[H+2],U[H+3],U[H+4],U[H+5])))return v(E,M),!0}for(var $=$||k.source,F=F||k.target,P=i.getArrowWidth(A,I),z=[{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}],H=0;H<z.length;H++){var G=z[H],V=s.arrowShapes[E.pstyle(G.name+"-arrow-shape").value],te=E.pstyle("width").pfValue;if(V.roughCollide(t,e,P,G.angle,{x:G.x,y:G.y},te,c)&&V.collide(t,e,P,G.angle,{x:G.x,y:G.y},te,c))return v(E),!0}u&&a.length>0&&(m($),m(F))}function b(E,k,L){return Xr(E,k,L)}function S(E,k){var L=E._private,A=g,I;k?I=k+"-":I="",E.boundingBox();var O=L.labelBounds[k||"main"],B=E.pstyle(I+"label").value,D=E.pstyle("text-events").strValue==="yes";if(!(!D||!B)){var M=b(L.rscratch,"labelX",k),U=b(L.rscratch,"labelY",k),H=b(L.rscratch,"labelAngle",k),$=E.pstyle(I+"text-margin-x").pfValue,F=E.pstyle(I+"text-margin-y").pfValue,P=O.x1-A-$,z=O.x2+A-$,G=O.y1-A-F,V=O.y2+A-F;if(H){var te=Math.cos(H),ie=Math.sin(H),ne=function(ue,pe){return ue=ue-M,pe=pe-U,{x:ue*te-pe*ie+M,y:ue*ie+pe*te+U}},X=ne(P,G),q=ne(P,V),Y=ne(z,G),K=ne(z,V),ee=[X.x+$,X.y+F,Y.x+$,Y.y+F,K.x+$,K.y+F,q.x+$,q.y+F];if(ln(t,e,ee))return v(E),!0}else if(Xi(O,t,e))return v(E),!0}}for(var T=o.length-1;T>=0;T--){var N=o[T];N.isNode()?m(N)||S(N):x(N)||S(N)||S(N,"source")||S(N,"target")}return a};Ka.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),d=Math.max(e,n);t=l,r=u,e=c,n=d;var g=Zr({x1:t,y1:e,x2:r,y2:n}),f=[{x:g.x1,y:g.y1},{x:g.x2,y:g.y1},{x:g.x2,y:g.y2},{x:g.x1,y:g.y2}],y=[[f[0],f[1]],[f[1],f[2]],[f[2],f[3]],[f[3],f[0]]];function _(ue,pe,Re){return Xr(ue,pe,Re)}function v(ue,pe){var Re=ue._private,Be=o,_e="";ue.boundingBox();var Te=Re.labelBounds.main;if(!Te)return null;var Le=_(Re.rscratch,"labelX",pe),Ee=_(Re.rscratch,"labelY",pe),Pe=_(Re.rscratch,"labelAngle",pe),ze=ue.pstyle(_e+"text-margin-x").pfValue,Me=ue.pstyle(_e+"text-margin-y").pfValue,Ue=Te.x1-Be-ze,Ge=Te.x2+Be-ze,ve=Te.y1-Be-Me,Ce=Te.y2+Be-Me;if(Pe){var Ie=Math.cos(Pe),me=Math.sin(Pe),Z=function(ae,se){return ae=ae-Le,se=se-Ee,{x:ae*Ie-se*me+Le,y:ae*me+se*Ie+Ee}};return[Z(Ue,ve),Z(Ge,ve),Z(Ge,Ce),Z(Ue,Ce)]}else return[{x:Ue,y:ve},{x:Ge,y:ve},{x:Ge,y:Ce},{x:Ue,y:Ce}]}function m(ue,pe,Re,Be){function _e(Te,Le,Ee){return(Ee.y-Te.y)*(Le.x-Te.x)>(Le.y-Te.y)*(Ee.x-Te.x)}return _e(ue,Re,Be)!==_e(pe,Re,Be)&&_e(ue,pe,Re)!==_e(ue,pe,Be)}for(var x=0;x<i.length;x++){var b=i[x];if(b.isNode()){var S=b,T=S.pstyle("text-events").strValue==="yes",N=S.pstyle("box-selection").strValue,E=S.pstyle("box-select-labels").strValue==="yes";if(N==="none")continue;var k=(N==="overlap"||E)&&T,L=S.boundingBox({includeNodes:!0,includeEdges:!1,includeLabels:k});if(N==="contain"){var A=!1;if(E&&T){var I=v(S);I&&Af(I,f)&&(a.push(S),A=!0)}!A&&e_(g,L)&&a.push(S)}else if(N==="overlap"&&cv(g,L)){var O=S.boundingBox({includeNodes:!0,includeEdges:!0,includeLabels:!1,includeMainLabels:!1,includeSourceLabels:!1,includeTargetLabels:!1}),B=[{x:O.x1,y:O.y1},{x:O.x2,y:O.y1},{x:O.x2,y:O.y2},{x:O.x1,y:O.y2}];if(Af(B,f))a.push(S);else{var D=v(S);D&&Af(D,f)&&a.push(S)}}}else{var M=b,U=M._private,H=U.rscratch,$=M.pstyle("box-selection").strValue;if($==="none")continue;if($==="contain"){if(H.startX!=null&&H.startY!=null&&!Xi(g,H.startX,H.startY)||H.endX!=null&&H.endY!=null&&!Xi(g,H.endX,H.endY))continue;if(H.edgeType==="bezier"||H.edgeType==="multibezier"||H.edgeType==="self"||H.edgeType==="compound"||H.edgeType==="segments"||H.edgeType==="haystack"){for(var F=U.rstyle.bezierPts||U.rstyle.linePts||U.rstyle.haystackPts,P=!0,z=0;z<F.length;z++)if(!sx(g,F[z])){P=!1;break}P&&a.push(M)}else H.edgeType==="straight"&&a.push(M)}else if($==="overlap"){var G=!1;if(H.startX!=null&&H.startY!=null&&H.endX!=null&&H.endY!=null&&(Xi(g,H.startX,H.startY)||Xi(g,H.endX,H.endY)))a.push(M),G=!0;else if(!G&&H.edgeType==="haystack"){for(var V=U.rstyle.haystackPts,te=0;te<V.length;te++)if(sx(g,V[te])){a.push(M),G=!0;break}}if(!G){var ie=U.rstyle.bezierPts||U.rstyle.linePts||U.rstyle.haystackPts;if((!ie||ie.length<2)&&H.edgeType==="straight"&&H.startX!=null&&H.startY!=null&&H.endX!=null&&H.endY!=null&&(ie=[{x:H.startX,y:H.startY},{x:H.endX,y:H.endY}]),!ie||ie.length<2)continue;for(var ne=0;ne<ie.length-1;ne++){for(var X=ie[ne],q=ie[ne+1],Y=0;Y<y.length;Y++){var K=yr(y[Y],2),ee=K[0],re=K[1];if(m(X,q,ee,re)){a.push(M),G=!0;break}}if(G)break}}}}}return a};var Hc={};Hc.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,d,g,f,m,x;if(r?(c=e.haystackPts[0],d=e.haystackPts[1],g=e.haystackPts[2],f=e.haystackPts[3]):(c=e.arrowStartX,d=e.arrowStartY,g=e.arrowEndX,f=e.arrowEndY),m=e.midX,x=e.midY,s)l=c-e.segpts[0],u=d-e.segpts[1];else if(i||o||a||n){var y=e.allpts,_=Nr(y[0],y[2],y[4],.1),v=Nr(y[1],y[3],y[5],.1);l=c-_,u=d-v}else l=c-m,u=d-x;e.srcArrowAngle=Qu(l,u);var m=e.midX,x=e.midY;if(r&&(m=(c+g)/2,x=(d+f)/2),l=g-c,u=f-d,s){var y=e.allpts;if(y.length/2%2===0){var b=y.length/2,S=b-2;l=y[b]-y[S],u=y[b+1]-y[S+1]}else if(e.isRound)l=e.midVector[1],u=-e.midVector[0];else{var b=y.length/2-1,S=b-2;l=y[b]-y[S],u=y[b+1]-y[S+1]}}else if(i||o||a){var y=e.allpts,T=e.ctrlpts,N,E,k,L;if(T.length/2%2===0){var A=y.length/2-1,I=A+2,O=I+2;N=Nr(y[A],y[I],y[O],0),E=Nr(y[A+1],y[I+1],y[O+1],0),k=Nr(y[A],y[I],y[O],1e-4),L=Nr(y[A+1],y[I+1],y[O+1],1e-4)}else{var I=y.length/2-1,A=I-2,O=I+2;N=Nr(y[A],y[I],y[O],.4999),E=Nr(y[A+1],y[I+1],y[O+1],.4999),k=Nr(y[A],y[I],y[O],.5),L=Nr(y[A+1],y[I+1],y[O+1],.5)}l=k-N,u=L-E}if(e.midtgtArrowAngle=Qu(l,u),e.midDispX=l,e.midDispY=u,l*=-1,u*=-1,s){var y=e.allpts;if(y.length/2%2!==0){if(!e.isRound){var b=y.length/2-1,B=b+2;l=-(y[B]-y[b]),u=-(y[B+1]-y[b+1])}}}if(e.midsrcArrowAngle=Qu(l,u),s)l=g-e.segpts[e.segpts.length-2],u=f-e.segpts[e.segpts.length-1];else if(i||o||a||n){var y=e.allpts,D=y.length,_=Nr(y[D-6],y[D-4],y[D-2],.9),v=Nr(y[D-5],y[D-3],y[D-1],.9);l=g-_,u=f-v}else l=g-m,u=f-x;e.tgtArrowAngle=Qu(l,u)};Hc.getArrowWidth=Hc.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 Ng,Rg,Qn={},En={},U1,$1,Fa,Cc,vi,La,Oa,Kn,Ns,ac,Y_,K_,Lg,Dg,W1,V1=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)},QL=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},ZL=function(e,r,n,i,s){if(e!==W1?V1(r,e,Qn):QL(En,Qn),V1(r,n,En),U1=Qn.nx*En.ny-Qn.ny*En.nx,$1=Qn.nx*En.nx-Qn.ny*-En.ny,vi=Math.asin(Math.max(-1,Math.min(1,U1))),Math.abs(vi)<1e-6){Ng=r.x,Rg=r.y,Oa=Ns=0;return}Fa=1,Cc=!1,$1<0?vi<0?vi=Math.PI+vi:(vi=Math.PI-vi,Fa=-1,Cc=!0):vi>0&&(Fa=-1,Cc=!0),r.radius!==void 0?Ns=r.radius:Ns=i,La=vi/2,ac=Math.min(Qn.len/2,En.len/2),s?(Kn=Math.abs(Math.cos(La)*Ns/Math.sin(La)),Kn>ac?(Kn=ac,Oa=Math.abs(Kn*Math.sin(La)/Math.cos(La))):Oa=Ns):(Kn=Math.min(ac,Ns),Oa=Math.abs(Kn*Math.sin(La)/Math.cos(La))),Lg=r.x+En.nx*Kn,Dg=r.y+En.ny*Kn,Ng=Lg-En.ny*Oa*Fa,Rg=Dg+En.nx*Oa*Fa,Y_=r.x+Qn.nx*Kn,K_=r.y+Qn.ny*Kn,W1=r};function X_(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 _v(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}:(ZL(t,e,r,n,i),{cx:Ng,cy:Rg,radius:Oa,startX:Y_,startY:K_,stopX:Lg,stopY:Dg,startAngle:Qn.ang+Math.PI/2*Fa,endAngle:En.ang-Math.PI/2*Fa,counterClockwise:Cc})}var wl=.01,JL=Math.sqrt(2*wl),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(T,N,E,k){var L=k-N,A=E-T,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 d=this.manualEndptToPx(t.source()[0],o),g=yr(d,2),f=g[0],y=g[1],_=this.manualEndptToPx(t.target()[0],a),v=yr(_,2),m=v[0],x=v[1],b={x1:f,y1:y,x2:m,y2:x};i=u(f,y,m,x),s=b}else zt("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(),d=a.width(),g=o.height(),f=a.height(),y=r.pstyle("haystack-radius").value,_=y/2;i.haystackPts=i.allpts=[i.source.x*c*_+l.x,i.source.y*g*_+l.y,i.target.x*d*_+u.x,i.target.y*f*_+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 d=n.pfValue[c],g=i.pfValue[c],f=1-d,y=d,_=this.findMidptPtsEtc(t,e),v=_.midptPts,m=_.vectorNormInverse,x={x:v.x1*f+v.x2*y,y:v.y1*f+v.y2*y};r.segpts.push(x.x+m.x*g,x.y+m.y*g),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,d=t.pstyle("control-point-step-size").pfValue;i.edgeType="self";var g=r,f=d;n&&(g=0,f=l);var y=u-Math.PI/2,_=y-c/2,v=y+c/2,m=u+"_"+c;g=s[m]===void 0?s[m]=0:++s[m],i.ctrlpts=[o.x+Math.cos(_)*1.4*f*(g/3+1),o.y+Math.sin(_)*1.4*f*(g/3+1),o.x+Math.cos(v)*1.4*f*(g/3+1),o.y+Math.sin(v)*1.4*f*(g/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,d=t.pstyle("control-point-step-size").pfValue,g=t.pstyle("control-point-distances"),f=g?g.pfValue[0]:void 0,y=r,_=d;n&&(y=0,_=f);var v=50,m={x:s.x-a/2,y:s.y-l/2},x={x:o.x-u/2,y:o.y-c/2},b={x:Math.min(m.x,x.x),y:Math.min(m.y,x.y)},S=.5,T=Math.max(S,Math.log(a*wl)),N=Math.max(S,Math.log(u*wl));i.ctrlpts=[b.x,b.y-(1+Math.pow(v,1.12)/100)*_*(y/3+1)*T,b.x-(1+Math.pow(v,1.12)/100)*_*(y/3+1)*N,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,d=l.value[0],g=n;s.edgeType=g?"multibezier":"bezier",s.ctrlpts=[];for(var f=0;f<u;f++){var y=(.5-e.eles.length/2+r)*o*(i?-1:1),_=void 0,v=uv(y);g&&(c=a?a.pfValue[f]:o,d=l.value[f]),n?_=c:_=c!==void 0?v*c:void 0;var m=_!==void 0?_:y,x=1-d,b=d,S=this.findMidptPtsEtc(t,e),T=S.midptPts,N=S.vectorNormInverse,E={x:T.x1*x+T.x2*b,y:T.y1*x+T.y2*b};s.ctrlpts.push(E.x+N.x*m,E.y+N.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,d=e.srcW,g=e.srcH,f=e.tgtW,y=e.tgtH,_=t.pstyle("edge-distances").value,v=_!=="node-position",m=t.pstyle("taxi-direction").value,x=m,b=t.pstyle("taxi-turn"),S=b.units==="%",T=b.pfValue,N=T<0,E=t.pstyle("taxi-turn-min-distance").pfValue,k=v?(d+f)/2:0,L=v?(g+y)/2:0,A=c.x2-c.x1,I=c.y2-c.y1,O=function(se,ce){return se>0?Math.max(se-ce,0):Math.min(se+ce,0)},B=O(A,k),D=O(I,L),M=!1;x===u?m=Math.abs(B)>Math.abs(D)?i:n:x===l||x===a?(m=n,M=!0):(x===s||x===o)&&(m=i,M=!0);var U=m===n,H=U?D:B,$=U?I:A,F=uv($),P=!1;!(M&&(S||N))&&(x===a&&$<0||x===l&&$>0||x===s&&$>0||x===o&&$<0)&&(F*=-1,H=F*Math.abs(H),P=!0);var z;if(S){var G=T<0?1+T:T;z=G*H}else{var V=T<0?H:0;z=V+T*F}var te=function(se){return Math.abs(se)<E||Math.abs(se)>=Math.abs(H)},ie=te(z),ne=te(Math.abs(H)-Math.abs(z)),X=ie||ne;if(X&&!P)if(U){var q=Math.abs($)<=g/2,Y=Math.abs(A)<=f/2;if(q){var K=(c.x1+c.x2)/2,ee=c.y1,re=c.y2;r.segpts=[K,ee,K,re]}else if(Y){var ue=(c.y1+c.y2)/2,pe=c.x1,Re=c.x2;r.segpts=[pe,ue,Re,ue]}else r.segpts=[c.x1,c.y2]}else{var Be=Math.abs($)<=d/2,_e=Math.abs(I)<=y/2;if(Be){var Te=(c.y1+c.y2)/2,Le=c.x1,Ee=c.x2;r.segpts=[Le,Te,Ee,Te]}else if(_e){var Pe=(c.x1+c.x2)/2,ze=c.y1,Me=c.y2;r.segpts=[Pe,ze,Pe,Me]}else r.segpts=[c.x2,c.y1]}else if(U){var Ue=c.y1+z+(v?g/2*F:0),Ge=c.x1,ve=c.x2;r.segpts=[Ge,Ue,ve,Ue]}else{var Ce=c.x1+z+(v?d/2*F:0),Ie=c.y1,me=c.y2;r.segpts=[Ce,Ie,Ce,me]}if(r.isRound){var Z=t.pstyle("taxi-radius").value,he=t.pstyle("radius-type").value[0]==="arc-radius";r.radii=new Array(r.segpts.length/2).fill(Z),r.isArcRadius=new Array(r.segpts.length/2).fill(he)}};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,d=e.srcCornerRadius,g=e.tgtCornerRadius,f=e.srcRs,y=e.tgtRs,_=!Ke(r.startX)||!Ke(r.startY),v=!Ke(r.arrowStartX)||!Ke(r.arrowStartY),m=!Ke(r.endX)||!Ke(r.endY),x=!Ke(r.arrowEndX)||!Ke(r.arrowEndY),b=3,S=this.getArrowWidth(t.pstyle("width").pfValue,t.pstyle("arrow-scale").value)*this.arrowShapeWidth,T=b*S,N=Wa({x:r.ctrlpts[0],y:r.ctrlpts[1]},{x:r.startX,y:r.startY}),E=N<T,k=Wa({x:r.ctrlpts[0],y:r.ctrlpts[1]},{x:r.endX,y:r.endY}),L=k<T,A=!1;if(_||v||E){A=!0;var I={x:r.ctrlpts[0]-n.x,y:r.ctrlpts[1]-n.y},O=Math.sqrt(I.x*I.x+I.y*I.y),B={x:I.x/O,y:I.y/O},D=Math.max(s,o),M={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,M.x,M.y,0,d,f);E?(r.ctrlpts[0]=r.ctrlpts[0]+B.x*(T-N),r.ctrlpts[1]=r.ctrlpts[1]+B.y*(T-N)):(r.ctrlpts[0]=U[0]+B.x*T,r.ctrlpts[1]=U[1]+B.y*T)}if(m||x||L){A=!0;var H={x:r.ctrlpts[0]-i.x,y:r.ctrlpts[1]-i.y},$=Math.sqrt(H.x*H.x+H.y*H.y),F={x:H.x/$,y:H.y/$},P=Math.max(s,o),z={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,z.x,z.y,0,g,y);L?(r.ctrlpts[0]=r.ctrlpts[0]+F.x*(T-k),r.ctrlpts[1]=r.ctrlpts[1]+F.y*(T-k)):(r.ctrlpts[0]=G[0]+F.x*T,r.ctrlpts[1]=G[1]+F.y*T)}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=Nr(e.allpts[n],e.allpts[n+2],e.allpts[n+4],i),e.midY=Nr(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(_v({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 d={x:e.segpts[c],y:e.segpts[c+1]},g=e.roundCorners[c/2];if(g.radius===0){var f={x:e.segpts[c+2],y:e.segpts[c+3]};e.midX=d.x,e.midY=d.y,e.midVector=[d.y-f.y,f.x-d.x]}else{var y=[d.x-g.cx,d.y-g.cy],_=g.radius/Math.sqrt(Math.pow(y[0],2)+Math.pow(y[1],2));y=y.map(function(v){return v*_}),e.midX=g.cx+y[0],e.midY=g.cy+y[1],e.midVector=y}}}}};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,zt("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 yi,o=function(L,A){return[].concat(Dc(L),[A?1:0]).join("-")},a=[],l=[],u=0;u<t.length;u++){var c=t[u],d=c._private,g=c.pstyle("curve-style").value;if(!(c.removed()||!c.takesUpSpace())){if(g==="haystack"){l.push(c);continue}var f=g==="unbundled-bezier"||Ki(g,"segments")||g==="straight"||g==="straight-triangle"||Ki(g,"taxi"),y=g==="unbundled-bezier"||g==="bezier",_=d.source,v=d.target,m=_.poolIndex(),x=v.poolIndex(),b=[m,x].sort(),S=o(b,f),T=s.get(S);T==null&&(T={eles:[]},a.push({pairId:b,edgeIsUnbundled:f}),s.set(S,T)),T.eles.push(c),f&&(T.hasUnbundled=!0),y&&(T.hasBezier=!0)}}for(var N=function(){var L=a[E],A=L.pairId,I=L.edgeIsUnbundled,O=o(A,I),B=s.get(O),D;if(!B.hasUnbundled){var M=B.eles[0].parallelEdges().filter(function(he){return he.isBundledBezier()});ov(B.eles),M.forEach(function(he){return B.eles.push(he)}),B.eles.sort(function(he,ae){return he.poolIndex()-ae.poolIndex()})}var U=B.eles[0],H=U.source(),$=U.target();if(H.poolIndex()>$.poolIndex()){var F=H;H=$,$=F}var P=B.srcPos=H.position(),z=B.tgtPos=$.position(),G=B.srcW=H.outerWidth(),V=B.srcH=H.outerHeight(),te=B.tgtW=$.outerWidth(),ie=B.tgtH=$.outerHeight(),ne=B.srcShape=r.nodeShapes[e.getNodeShape(H)],X=B.tgtShape=r.nodeShapes[e.getNodeShape($)],q=B.srcCornerRadius=H.pstyle("corner-radius").value==="auto"?"auto":H.pstyle("corner-radius").pfValue,Y=B.tgtCornerRadius=$.pstyle("corner-radius").value==="auto"?"auto":$.pstyle("corner-radius").pfValue,K=B.tgtRs=$._private.rscratch,ee=B.srcRs=H._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 ue=B.eles[re],pe=ue[0]._private.rscratch,Re=ue.pstyle("curve-style").value,Be=Re==="unbundled-bezier"||Ki(Re,"segments")||Ki(Re,"taxi"),_e=!H.same(ue.source());if(!B.calculatedIntersection&&H!==$&&(B.hasBezier||B.hasUnbundled)){B.calculatedIntersection=!0;var Te=ne.intersectLine(P.x,P.y,G,V,z.x,z.y,0,q,ee),Le=B.srcIntn=Te,Ee=X.intersectLine(z.x,z.y,te,ie,P.x,P.y,0,Y,K),Pe=B.tgtIntn=Ee,ze=B.intersectionPts={x1:Te[0],x2:Ee[0],y1:Te[1],y2:Ee[1]},Me=B.posPts={x1:P.x,x2:z.x,y1:P.y,y2:z.y},Ue=Ee[1]-Te[1],Ge=Ee[0]-Te[0],ve=Math.sqrt(Ge*Ge+Ue*Ue);Ke(ve)&&ve>=JL||(ve=Math.sqrt(Math.max(Ge*Ge,wl)+Math.max(Ue*Ue,wl)));var Ce=B.vector={x:Ge,y:Ue},Ie=B.vectorNorm={x:Ce.x/ve,y:Ce.y/ve},me={x:-Ie.y,y:Ie.x};B.nodesOverlap=!Ke(ve)||X.checkPoint(Te[0],Te[1],0,te,ie,z.x,z.y,Y,K)||ne.checkPoint(Ee[0],Ee[1],0,G,V,P.x,P.y,q,ee),B.vectorNormInverse=me,D={nodesOverlap:B.nodesOverlap,dirCounts:B.dirCounts,calculatedIntersection:!0,hasBezier:B.hasBezier,hasUnbundled:B.hasUnbundled,eles:B.eles,srcPos:z,srcRs:K,tgtPos:P,tgtRs:ee,srcW:te,srcH:ie,tgtW:G,tgtH:V,srcIntn:Pe,tgtIntn:Le,srcShape:X,tgtShape:ne,posPts:{x1:Me.x2,y1:Me.y2,x2:Me.x1,y2:Me.y1},intersectionPts:{x1:ze.x2,y1:ze.y2,x2:ze.x1,y2:ze.y1},vector:{x:-Ce.x,y:-Ce.y},vectorNorm:{x:-Ie.x,y:-Ie.y},vectorNormInverse:{x:-me.x,y:-me.y}}}var Z=_e?D:B;pe.nodesOverlap=Z.nodesOverlap,pe.srcIntn=Z.srcIntn,pe.tgtIntn=Z.tgtIntn,pe.isRound=Re.startsWith("round"),i&&(H.isParent()||H.isChild()||$.isParent()||$.isChild())&&(H.parents().anySame($)||$.parents().anySame(H)||H.same($)&&H.isParent())?e.findCompoundLoopPoints(ue,Z,re,Be):H===$?e.findLoopPoints(ue,Z,re,Be):Re.endsWith("segments")?e.findSegmentsPoints(ue,Z):Re.endsWith("taxi")?e.findTaxiPoints(ue,Z):Re==="straight"||!Be&&B.eles.length%2===1&&re===Math.floor(B.eles.length/2)?e.findStraightEdgePoints(ue):e.findBezierPoints(ue,Z,re,Be,_e),e.findEndpoints(ue),e.tryToCorrectInvalidPoints(ue,Z),e.checkForInvalidEdgeWarning(ue),e.storeAllpts(ue),e.storeEdgeProjections(ue),e.calculateArrowAngles(ue),e.recalculateEdgeLabelProjections(ue),e.calculateLabelAngles(ue)}},E=0;E<a.length;E++)N();this.findHaystackPoints(l)}};function Q_(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 Q_(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 Q_(e.ctrlpts)};Wr.getEdgeMidpoint=function(t){var e=t[0]._private.rscratch;return this.recalculateRenderedStyle(t),{x:e.midX,y:e.midY}};var Ml={};Ml.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)}};Ml.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(),d=t.pstyle("target-arrow-shape").value,g=t.pstyle("source-arrow-shape").value,f=t.pstyle("target-distance-from-node").pfValue,y=t.pstyle("source-distance-from-node").pfValue,_=a._private.rscratch,v=l._private.rscratch,m=t.pstyle("curve-style").value,x=t._private.rscratch,b=x.edgeType,S=Ki(m,"taxi"),T=b==="self"||b==="compound",N=b==="bezier"||b==="multibezier"||T,E=b!=="bezier",k=b==="straight"||b==="segments",L=b==="segments",A=N||E||k,I=T||S,O=t.pstyle("source-endpoint"),B=I?"outside-to-node":O.value,D=a.pstyle("corner-radius").value==="auto"?"auto":a.pstyle("corner-radius").pfValue,M=t.pstyle("target-endpoint"),U=I?"outside-to-node":M.value,H=l.pstyle("corner-radius").value==="auto"?"auto":l.pstyle("corner-radius").pfValue;x.srcManEndpt=O,x.tgtManEndpt=M;var $,F,P,z,G=(e=(M==null||(r=M.pfValue)===null||r===void 0?void 0:r.length)===2?M.pfValue:null)!==null&&e!==void 0?e:[0,0],V=(n=(O==null||(i=O.pfValue)===null||i===void 0?void 0:i.length)===2?O.pfValue:null)!==null&&n!==void 0?n:[0,0];if(N){var te=[x.ctrlpts[0],x.ctrlpts[1]],ie=E?[x.ctrlpts[x.ctrlpts.length-2],x.ctrlpts[x.ctrlpts.length-1]]:te;$=ie,F=te}else if(k){var ne=L?x.segpts.slice(0,2):[c.x+G[0],c.y+G[1]],X=L?x.segpts.slice(x.segpts.length-2):[u.x+V[0],u.y+V[1]];$=X,F=ne}if(U==="inside-to-node")o=[c.x,c.y];else if(M.units)o=this.manualEndptToPx(l,M);else if(U==="outside-to-line")o=x.tgtIntn;else if(U==="outside-to-node"||U==="outside-to-node-or-label"?P=$:(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,H,v),U==="outside-to-node-or-label"||U==="outside-to-line-or-label"){var q=l._private.rscratch,Y=q.labelWidth,K=q.labelHeight,ee=q.labelX,re=q.labelY,ue=Y/2,pe=K/2,Re=l.pstyle("text-valign").value;Re=Ks(Re),Re==="top"?re-=pe:Re==="bottom"&&(re+=pe);var Be=l.pstyle("text-halign").value;Be=Ys(Be),Be==="left"?ee-=ue:Be==="right"&&(ee+=ue);var _e=vl(P[0],P[1],[ee-ue,re-pe,ee+ue,re-pe,ee+ue,re+pe,ee-ue,re+pe],c.x,c.y);if(_e.length>0){var Te=u,Le=Ia(Te,Bs(o)),Ee=Ia(Te,Bs(_e)),Pe=Le;if(Ee<Le&&(o=_e,Pe=Ee),_e.length>2){var ze=Ia(Te,{x:_e[2],y:_e[3]});ze<Pe&&(o=[_e[2],_e[3]])}}}var Me=Zu(o,$,s.arrowShapes[d].spacing(t)+f),Ue=Zu(o,$,s.arrowShapes[d].gap(t)+f);if(x.endX=Ue[0],x.endY=Ue[1],x.arrowEndX=Me[0],x.arrowEndY=Me[1],B==="inside-to-node")o=[u.x,u.y];else if(O.units)o=this.manualEndptToPx(a,O);else if(B==="outside-to-line")o=x.srcIntn;else if(B==="outside-to-node"||B==="outside-to-node-or-label"?z=F:(B==="outside-to-line"||B==="outside-to-line-or-label")&&(z=[c.x,c.y]),o=s.nodeShapes[this.getNodeShape(a)].intersectLine(u.x,u.y,a.outerWidth(),a.outerHeight(),z[0],z[1],0,D,_),B==="outside-to-node-or-label"||B==="outside-to-line-or-label"){var Ge=a._private.rscratch,ve=Ge.labelWidth,Ce=Ge.labelHeight,Ie=Ge.labelX,me=Ge.labelY,Z=ve/2,he=Ce/2,ae=a.pstyle("text-valign").value;ae=Ks(ae),ae==="top"?me-=he:ae==="bottom"&&(me+=he);var se=a.pstyle("text-halign").value;se=Ys(se),se==="left"?Ie-=Z:se==="right"&&(Ie+=Z);var ce=vl(z[0],z[1],[Ie-Z,me-he,Ie+Z,me-he,Ie+Z,me+he,Ie-Z,me+he],u.x,u.y);if(ce.length>0){var de=c,oe=Ia(de,Bs(o)),ye=Ia(de,Bs(ce)),Se=oe;if(ye<oe&&(o=[ce[0],ce[1]],Se=ye),ce.length>2){var ke=Ia(de,{x:ce[2],y:ce[3]});ke<Se&&(o=[ce[2],ce[3]])}}}var De=Zu(o,F,s.arrowShapes[g].spacing(t)+y),Ne=Zu(o,F,s.arrowShapes[g].gap(t)+y);x.startX=Ne[0],x.startY=Ne[1],x.arrowStartX=De[0],x.arrowStartY=De[1],A&&(!Ke(x.startX)||!Ke(x.startY)||!Ke(x.endX)||!Ke(x.endY)?x.badLine=!0:x.badLine=!1)};Ml.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}}};Ml.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 Sv={};function eD(t,e,r){for(var n=function(u,c,d,g){return Nr(u,c,d,g)},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)})}}Sv.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)eD(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};Sv.recalculateEdgeProjections=function(t){this.findEdgeControlPoints(t)};var ni={};ni.recalculateNodeLabelProjection=function(t){var e=t.pstyle("label").strValue;if(!ea(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,d=i.rscratch,g=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}d.labelX=r,d.labelY=n,g.labelX=r,g.labelY=n,this.calculateLabelAngles(t),this.applyLabelDimensions(t)}};var Z_=function(e,r){var n=Math.atan(r/e);return e===0&&n<0&&(n=n*-1),n},J_=function(e,r){var n=r.x-e.x,i=r.y-e.y;return Z_(n,i)},tD=function(e,r,n,i){var s=gl(0,i-.001,1),o=gl(0,i+.001,1),a=Hs(e,r,n,s),l=Hs(e,r,n,o);return J_(a,l)};ni.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(d,g,f){Jn(r.rscratch,d,g,f),Jn(r.rstyle,d,g,f)};o("labelX",null,e.x),o("labelY",null,e.y);var a=Z_(n.midDispX,n.midDispY);o("labelAutoAngle",null,a);var l=function(){if(l.cache)return l.cache;for(var d=[],g=0;g+5<n.allpts.length;g+=4){var f={x:n.allpts[g],y:n.allpts[g+1]},y={x:n.allpts[g+2],y:n.allpts[g+3]},_={x:n.allpts[g+4],y:n.allpts[g+5]};d.push({p0:f,p1:y,p2:_,startDist:0,length:0,segments:[]})}var v=r.rstyle.bezierPts,m=i.bezierProjPcts.length;function x(E,k,L,A,I){var O=Wa(k,L),B=E.segments[E.segments.length-1],D={p0:k,p1:L,t0:A,t1:I,startDist:B?B.startDist+B.length:0,length:O};E.segments.push(D),E.length+=O}for(var b=0;b<d.length;b++){var S=d[b],T=d[b-1];T&&(S.startDist=T.startDist+T.length),x(S,S.p0,v[b*m],0,i.bezierProjPcts[0]);for(var N=0;N<m-1;N++)x(S,v[b*m+N],v[b*m+N+1],i.bezierProjPcts[N],i.bezierProjPcts[N+1]);x(S,v[b*m+m-1],S.p2,i.bezierProjPcts[m-1],1)}return l.cache=d},u=function(d){var g,f=d==="source";if(s[d]){var y=t.pstyle(d+"-text-offset").pfValue;switch(n.edgeType){case"self":case"compound":case"bezier":case"multibezier":{for(var _=l(),v,m=0,x=0,b=0;b<_.length;b++){for(var S=_[f?b:_.length-1-b],T=0;T<S.segments.length;T++){var N=S.segments[f?T:S.segments.length-1-T],E=b===_.length-1&&T===S.segments.length-1;if(m=x,x+=N.length,x>=y||E){v={cp:S,segment:N};break}}if(v)break}var k=v.cp,L=v.segment,A=(y-m)/L.length,I=L.t1-L.t0,O=f?L.t0+I*A:L.t1-I*A;O=gl(0,O,1),e=Hs(k.p0,k.p1,k.p2,O),g=tD(k.p0,k.p1,k.p2,O);break}case"straight":case"segments":case"haystack":{for(var B=0,D,M,U,H,$=n.allpts.length,F=0;F+3<$&&(f?(U={x:n.allpts[F],y:n.allpts[F+1]},H={x:n.allpts[F+2],y:n.allpts[F+3]}):(U={x:n.allpts[$-2-F],y:n.allpts[$-1-F]},H={x:n.allpts[$-4-F],y:n.allpts[$-3-F]}),D=Wa(U,H),M=B,B+=D,!(B>=y));F+=2);var P=y-M,z=P/D;z=gl(0,z,1),e=_T(U,H,z),g=J_(U,H);break}}o("labelX",d,e.x),o("labelY",d,e.y),o("labelAutoAngle",d,g)}};u("source"),u("target"),this.applyLabelDimensions(t)}};ni.applyLabelDimensions=function(t){this.applyPrefixedLabelDimensions(t),t.isEdge()&&(this.applyPrefixedLabelDimensions(t,"source"),this.applyPrefixedLabelDimensions(t,"target"))};ni.applyPrefixedLabelDimensions=function(t,e){var r=t._private,n=this.getLabelText(t,e),i=$a(n,t._private.labelDimsKey);if(Xr(r.rscratch,"prefixedLabelDimsKey",e)!==i){Jn(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),d=a*o,g=s.width,f=s.height+(c-1)*(o-1)*a;Jn(r.rstyle,"labelWidth",e,g),Jn(r.rscratch,"labelWidth",e,g),Jn(r.rstyle,"labelHeight",e,f),Jn(r.rscratch,"labelHeight",e,f),Jn(r.rscratch,"labelLineHeight",e,d),Jn(r.rscratch,"labelActualDescent",e,s.labelActualDescent)}};ni.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(V,te){return te?(Jn(r.rscratch,V,e,te),te):Xr(r.rscratch,V,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
|
-
`),d=t.pstyle("text-max-width").pfValue,g=t.pstyle("text-overflow-wrap").value,f=g==="anywhere",y=[],_=/[\s\u200b]+|$/g,v=0;v<c.length;v++){var m=c[v],x=this.calculateLabelDimensions(t,m),b=x.width;if(f){var S=m.split("").join(u);m=S}if(b>d){var T=m.matchAll(_),N="",E=0,k=un(T),L;try{for(k.s();!(L=k.n()).done;){var A=L.value,I=A[0],O=m.substring(E,A.index);E=A.index+I.length;var B=N.length===0?O:N+O+I,D=this.calculateLabelDimensions(t,B),M=D.width;M<=d?N+=O+I:(N&&y.push(N),N=O+I)}}catch(G){k.e(G)}finally{k.f()}N.match(/^[\s\u200b]+$/)||y.push(N)}else y.push(m)}o("labelWrapCachedLines",y),i=o("labelWrapCachedText",y.join(`
|
|
60
|
-
`)),o("labelWrapKey",l)}else if(a==="ellipsis"){var U=t.pstyle("text-max-width").pfValue,H="",$="…",F=!1;if(this.calculateLabelDimensions(t,i).width<U)return i;for(var P=0;P<i.length;P++){var z=this.calculateLabelDimensions(t,H+i[P]+$).width;if(z>U)break;H+=i[P],P===i.length-1&&(F=!0)}return F||(H+=$),H}return i};ni.getLabelJustification=function(t){var e=t.pstyle("text-justification").strValue,r=t.pstyle("text-halign").strValue;return e==="auto"?t.isNode()?UR(r):"center":e};ni.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",d=this.labelCalcCanvas,g=this.labelCalcCanvasContext;if(!d){d=this.labelCalcCanvas=i.createElement("canvas"),g=this.labelCalcCanvasContext=d.getContext("2d");var f=d.style;f.position="absolute",f.left="-9999px",f.top="-9999px",f.zIndex="-1",f.visibility="hidden",f.pointerEvents="none"}g.font="".concat(o," ").concat(u," ").concat(a,"px ").concat(l);for(var y=0,_=0,v=e.split(`
|
|
61
|
-
`),m=v.length,x=0,b=0,S=0;S<m;S++){var T=v[S],N=g.measureText(T),E=Math.ceil(N.width),k=a;c==="glyph"&&(S===0&&(b=N.actualBoundingBoxAscent),S===m-1&&(x=N.actualBoundingBoxDescent)),y=Math.max(E,y),_+=k}return c==="glyph"&&(_-=a-b-x),y+=s,_+=s,{width:y,height:_,labelActualAscent:b,labelActualDescent:x}};ni.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};ni.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 e2={},G1=28,q1=!1;e2.getNodeShape=function(t){var e=this,r=t.pstyle("shape").value;if(r==="cutrectangle"&&(t.width()<G1||t.height()<G1))return q1||(zt("The `cutrectangle` node shape can not be used at small sizes so `rectangle` is used instead"),q1=!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 hd={};hd.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,d=c.rstyle;d.clean=!1,d.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 d=0;d<a.length;d++){var g=a[d];g(o,e)}r.recalculateRenderedStyle(e),e=t.collection()}};r.flushRenderedStyleQueue=function(){i(!0)},r.beforeRender(i,r.beforeRenderPriorities.eleCalcs)};hd.onUpdateEleCalcs=function(t){var e=this.onUpdateEleCalcsFns=this.onUpdateEleCalcsFns||[];e.push(t)};hd.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],d=c._private,g=d.rstyle,f=c.position();this.recalculateNodeLabelProjection(c),g.nodeX=f.x,g.nodeY=f.y,g.nodeW=c.pstyle("width").pfValue,g.nodeH=c.pstyle("height").pfValue}this.recalculateEdgeProjections(n);for(var y=0;y<n.length;y++){var _=n[y],v=_._private,m=v.rstyle,x=v.rscratch;m.srcX=x.arrowStartX,m.srcY=x.arrowStartY,m.tgtX=x.arrowEndX,m.tgtY=x.arrowEndY,m.midX=x.midX,m.midY=x.midY,m.labelAngle=x.labelAngle,m.sourceLabelAngle=x.sourceLabelAngle,m.targetLabelAngle=x.targetLabelAngle}}}};var fd={};fd.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)}}};fd.invalidateCachedZSortedEles=function(){this.cachedZSortedEles=null};fd.getCachedZSortedEles=function(t){if(t||!this.cachedZSortedEles){var e=this.cy.mutableElements().toArray();e.sort(I_),e.interactive=e.filter(function(r){return r.interactive()}),this.cachedZSortedEles=e,this.updateCachedGrabbedEles()}else e=this.cachedZSortedEles;return e};var t2={};[Ka,Hc,Wr,Ml,Sv,ni,e2,hd,fd].forEach(function(t){vt(t2,t)});var r2={};r2.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 n2=function(e,r){var n=e[0];!n||n._private.grabbed===r||(n._private.grabbed=r,e.updateStyle(!1))},rD=function(e){n2(e,!0)},nD=function(e){n2(e,!1)},to={};to.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)};to.binder=function(t){var e=this,r=e.cy.window(),n=t===r||t===r.document||t===r.document.body||d3(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 d=Array.prototype.slice.call(arguments);return n&&e.supportsPassiveEvents&&(d[2]={capture:c??!1,passive:!1,once:!1}),e.bindings.push({target:t,args:d}),(t.addEventListener||t.on).apply(t,d),this};return{on:o,addEventListener:o,addListener:o,bind:o}};to.nodeIsDraggable=function(t){return t&&t.isNode()&&!t.locked()&&t.grabbable()};to.nodeIsGrabbable=function(t){return this.nodeIsDraggable(t)&&t.interactive()};to.load=function(){var t=this,e=t.cy.window(),r=function(Z){return Z.selected()},n=function(Z){var he=Z.getRootNode();if(he&&he.nodeType===11&&he.host!==void 0)return he},i=function(Z,he,ae,se){Z==null&&(Z=t.cy);for(var ce=0;ce<he.length;ce++){var de=he[ce];Z.emit({originalEvent:ae,type:de,position:se})}},s=function(Z){return Z.shiftKey||Z.metaKey||Z.ctrlKey},o=function(Z,he){var ae=!0;if(t.cy.hasCompoundNodes()&&Z&&Z.pannable())for(var se=0;he&&se<he.length;se++){var Z=he[se];if(Z.isNode()&&Z.isParent()&&!Z.pannable()){ae=!1;break}}else ae=!0;return ae},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},d=function(Z,he){var ae=he.addToList,se=ae.has(Z);!se&&Z.grabbable()&&!Z.locked()&&(ae.merge(Z),rD(Z))},g=function(Z,he){if(Z.cy().hasCompoundNodes()&&!(he.inDragLayer==null&&he.addToList==null)){var ae=Z.descendants();he.inDragLayer&&(ae.forEach(a),ae.connectedEdges().forEach(a)),he.addToList&&d(ae,he)}},f=function(Z,he){he=he||{};var ae=Z.cy().hasCompoundNodes();he.inDragLayer&&(Z.forEach(a),Z.neighborhood().stdFilter(function(se){return!ae||se.isEdge()}).forEach(a)),he.addToList&&Z.forEach(function(se){d(se,he)}),g(Z,he),v(Z,{inDragLayer:he.inDragLayer}),t.updateCachedGrabbedEles()},y=f,_=function(Z){Z&&(t.getCachedZSortedEles().forEach(function(he){nD(he),l(he),c(he)}),t.updateCachedGrabbedEles())},v=function(Z,he){if(!(he.inDragLayer==null&&he.addToList==null)&&Z.cy().hasCompoundNodes()){var ae=Z.ancestors().orphans();if(!ae.same(Z)){var se=ae.descendants().spawnSelf().merge(ae).unmerge(Z).unmerge(Z.descendants()),ce=se.connectedEdges();he.inDragLayer&&(ce.forEach(a),se.forEach(a)),he.addToList&&se.forEach(function(de){d(de,he)})}}},m=function(){document.activeElement!=null&&document.activeElement.blur!=null&&document.activeElement.blur()},x=typeof MutationObserver<"u",b=typeof ResizeObserver<"u";x?(t.removeObserver=new MutationObserver(function(me){for(var Z=0;Z<me.length;Z++){var he=me[Z],ae=he.removedNodes;if(ae)for(var se=0;se<ae.length;se++){var ce=ae[se];if(ce===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=Ll(function(){t.cy.resize()},100);x&&(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 T=function(Z,he){for(;Z!=null;)he(Z),Z=Z.parentNode},N=function(){t.invalidateContainerClientCoordsCache()};T(t.container,function(me){t.registerBinding(me,"transitionend",N),t.registerBinding(me,"animationend",N),t.registerBinding(me,"scroll",N)}),t.registerBinding(t.container,"contextmenu",function(me){me.preventDefault()});var E=function(){return t.selection[4]!==0},k=function(Z){for(var he=t.findContainerClientCoords(),ae=he[0],se=he[1],ce=he[2],de=he[3],oe=Z.touches?Z.touches:[Z],ye=!1,Se=0;Se<oe.length;Se++){var ke=oe[Se];if(ae<=ke.clientX&&ke.clientX<=ae+ce&&se<=ke.clientY&&ke.clientY<=se+de){ye=!0;break}}if(!ye)return!1;for(var De=t.container,Ne=Z.target,Ae=Ne.parentNode,Qe=!1;Ae;){if(Ae===De){Qe=!0;break}Ae=Ae.parentNode}return!!Qe};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 he=t.cy,ae=[Z.clientX,Z.clientY],se=t.projectIntoViewport(ae[0],ae[1]),ce=t.selection,de=t.findNearestElements(se[0],se[1],!0,!1),oe=de[0],ye=t.dragData.possibleDragElements;t.hoverData.mdownPos=se,t.hoverData.mdownGPos=ae;var Se=function(Xe){return{originalEvent:Z,type:Xe,position:{x:se[0],y:se[1]}}},ke=function(){t.hoverData.tapholdCancelled=!1,clearTimeout(t.hoverData.tapholdTimeout),t.hoverData.tapholdTimeout=setTimeout(function(){if(!t.hoverData.tapholdCancelled){var Xe=t.hoverData.down;Xe?Xe.emit(Se("taphold")):he.emit(Se("taphold"))}},t.tapholdDuration)};if(Z.which==3){t.hoverData.cxtStarted=!0;var De={originalEvent:Z,type:"cxttapstart",position:{x:se[0],y:se[1]}};oe?(oe.activate(),oe.emit(De),t.hoverData.down=oe):he.emit(De),t.hoverData.downTime=new Date().getTime(),t.hoverData.cxtDragged=!1}else if(Z.which==1){oe&&oe.activate();{if(oe!=null&&t.nodeIsGrabbable(oe)){var Ne=function(Xe){Xe.emit(Se("grab"))};if(u(oe),!oe.selected())ye=t.dragData.possibleDragElements=he.collection(),y(oe,{addToList:ye}),oe.emit(Se("grabon")).emit(Se("grab"));else{ye=t.dragData.possibleDragElements=he.collection();var Ae=he.$(function(Qe){return Qe.isNode()&&Qe.selected()&&t.nodeIsGrabbable(Qe)});f(Ae,{addToList:ye}),oe.emit(Se("grabon")),Ae.forEach(Ne)}t.redrawHint("eles",!0),t.redrawHint("drag",!0)}t.hoverData.down=oe,t.hoverData.downs=de,t.hoverData.downTime=new Date().getTime()}i(oe,["mousedown","tapstart","vmousedown"],Z,{x:se[0],y:se[1]}),oe==null?(ce[4]=1,t.data.bgActivePosistion={x:se[0],y:se[1]},t.redrawHint("select",!0),t.redraw()):oe.pannable()&&(ce[4]=1),ke()}ce[0]=ce[2]=se[0],ce[1]=ce[3]=se[1]}},!1);var L=n(t.container);t.registerBinding([e,L],"mousemove",function(Z){var he=t.hoverData.capture;if(!(!he&&!k(Z))){var ae=!1,se=t.cy,ce=se.zoom(),de=[Z.clientX,Z.clientY],oe=t.projectIntoViewport(de[0],de[1]),ye=t.hoverData.mdownPos,Se=t.hoverData.mdownGPos,ke=t.selection,De=null;!t.hoverData.draggingEles&&!t.hoverData.dragging&&!t.hoverData.selecting&&(De=t.findNearestElement(oe[0],oe[1],!0,!1));var Ne=t.hoverData.last,Ae=t.hoverData.down,Qe=[oe[0]-ke[2],oe[1]-ke[3]],Xe=t.dragData.possibleDragElements,mt;if(Se){var Je=de[0]-Se[0],Ze=Je*Je,ut=de[1]-Se[1],et=ut*ut,Ye=Ze+et;t.hoverData.isOverThresholdDrag=mt=Ye>=t.desktopTapThreshold2}var Ct=s(Z);mt&&(t.hoverData.tapholdCancelled=!0);var ht=function(){var ur=t.hoverData.dragDelta=t.hoverData.dragDelta||[];ur.length===0?(ur.push(Qe[0]),ur.push(Qe[1])):(ur[0]+=Qe[0],ur[1]+=Qe[1])};ae=!0,i(De,["mousemove","vmousemove","tapdrag"],Z,{x:oe[0],y:oe[1]});var lt=function(ur){return{originalEvent:Z,type:ur,position:{x:oe[0],y:oe[1]}}},Bt=function(){t.data.bgActivePosistion=void 0,t.hoverData.selecting||se.emit(lt("boxstart")),ke[4]=1,t.hoverData.selecting=!0,t.redrawHint("select",!0),t.redraw()};if(t.hoverData.which===3){if(mt){var Et=lt("cxtdrag");Ae?Ae.emit(Et):se.emit(Et),t.hoverData.cxtDragged=!0,(!t.hoverData.cxtOver||De!==t.hoverData.cxtOver)&&(t.hoverData.cxtOver&&t.hoverData.cxtOver.emit(lt("cxtdragout")),t.hoverData.cxtOver=De,De&&De.emit(lt("cxtdragover")))}}else if(t.hoverData.dragging){if(ae=!0,se.panningEnabled()&&se.userPanningEnabled()){var $t;if(t.hoverData.justStartedPan){var Mt=t.hoverData.mdownPos;$t={x:(oe[0]-Mt[0])*ce,y:(oe[1]-Mt[1])*ce},t.hoverData.justStartedPan=!1}else $t={x:Qe[0]*ce,y:Qe[1]*ce};se.panBy($t),se.emit(lt("dragpan")),t.hoverData.dragged=!0}oe=t.projectIntoViewport(Z.clientX,Z.clientY)}else if(ke[4]==1&&(Ae==null||Ae.pannable())){if(mt){if(!t.hoverData.dragging&&se.boxSelectionEnabled()&&(Ct||!se.panningEnabled()||!se.userPanningEnabled()))Bt();else if(!t.hoverData.selecting&&se.panningEnabled()&&se.userPanningEnabled()){var pr=o(Ae,t.hoverData.downs);pr&&(t.hoverData.dragging=!0,t.hoverData.justStartedPan=!0,ke[4]=0,t.data.bgActivePosistion=Bs(ye),t.redrawHint("select",!0),t.redraw())}Ae&&Ae.pannable()&&Ae.active()&&Ae.unactivate()}}else{if(Ae&&Ae.pannable()&&Ae.active()&&Ae.unactivate(),(!Ae||!Ae.grabbed())&&De!=Ne&&(Ne&&i(Ne,["mouseout","tapdragout"],Z,{x:oe[0],y:oe[1]}),De&&i(De,["mouseover","tapdragover"],Z,{x:oe[0],y:oe[1]}),t.hoverData.last=De),Ae)if(mt){if(se.boxSelectionEnabled()&&Ct)Ae&&Ae.grabbed()&&(_(Xe),Ae.emit(lt("freeon")),Xe.emit(lt("free")),t.dragData.didDrag&&(Ae.emit(lt("dragfreeon")),Xe.emit(lt("dragfree")))),Bt();else if(Ae&&Ae.grabbed()&&t.nodeIsDraggable(Ae)){var ar=!t.dragData.didDrag;ar&&t.redrawHint("eles",!0),t.dragData.didDrag=!0,t.hoverData.draggingEles||f(Xe,{inDragLayer:!0});var rr={x:0,y:0};if(Ke(Qe[0])&&Ke(Qe[1])&&(rr.x+=Qe[0],rr.y+=Qe[1],ar)){var jt=t.hoverData.dragDelta;jt&&Ke(jt[0])&&Ke(jt[1])&&(rr.x+=jt[0],rr.y+=jt[1])}t.hoverData.draggingEles=!0,Xe.silentShift(rr).emit(lt("position")).emit(lt("drag")),t.redrawHint("drag",!0),t.redraw()}}else ht();ae=!0}if(ke[2]=oe[0],ke[3]=oe[1],ae)return Z.stopPropagation&&Z.stopPropagation(),Z.preventDefault&&Z.preventDefault(),!1}},!1);var A,I,O;t.registerBinding(e,"mouseup",function(Z){if(!(t.hoverData.which===1&&Z.which!==1&&t.hoverData.capture)){var he=t.hoverData.capture;if(he){t.hoverData.capture=!1;var ae=t.cy,se=t.projectIntoViewport(Z.clientX,Z.clientY),ce=t.selection,de=t.findNearestElement(se[0],se[1],!0,!1),oe=t.dragData.possibleDragElements,ye=t.hoverData.down,Se=s(Z);t.data.bgActivePosistion&&(t.redrawHint("select",!0),t.redraw()),t.hoverData.tapholdCancelled=!0,t.data.bgActivePosistion=void 0,ye&&ye.unactivate();var ke=function(Je){return{originalEvent:Z,type:Je,position:{x:se[0],y:se[1]}}};if(t.hoverData.which===3){var De=ke("cxttapend");if(ye?ye.emit(De):ae.emit(De),!t.hoverData.cxtDragged){var Ne=ke("cxttap");ye?ye.emit(Ne):ae.emit(Ne)}t.hoverData.cxtDragged=!1,t.hoverData.which=null}else if(t.hoverData.which===1){if(i(de,["mouseup","tapend","vmouseup"],Z,{x:se[0],y:se[1]}),!t.dragData.didDrag&&!t.hoverData.dragged&&!t.hoverData.selecting&&!t.hoverData.isOverThresholdDrag&&(i(ye,["click","tap","vclick"],Z,{x:se[0],y:se[1]}),I=!1,Z.timeStamp-O<=ae.multiClickDebounceTime()?(A&&clearTimeout(A),I=!0,O=null,i(ye,["dblclick","dbltap","vdblclick"],Z,{x:se[0],y:se[1]})):(A=setTimeout(function(){I||i(ye,["oneclick","onetap","voneclick"],Z,{x:se[0],y:se[1]})},ae.multiClickDebounceTime()),O=Z.timeStamp)),ye==null&&!t.dragData.didDrag&&!t.hoverData.selecting&&!t.hoverData.dragged&&!s(Z)&&(ae.$(r).unselect(["tapunselect"]),oe.length>0&&t.redrawHint("eles",!0),t.dragData.possibleDragElements=oe=ae.collection()),de==ye&&!t.dragData.didDrag&&!t.hoverData.selecting&&de!=null&&de._private.selectable&&(t.hoverData.dragging||(ae.selectionType()==="additive"||Se?de.selected()?de.unselect(["tapunselect"]):de.select(["tapselect"]):Se||(ae.$(r).unmerge(de).unselect(["tapunselect"]),de.select(["tapselect"]))),t.redrawHint("eles",!0)),t.hoverData.selecting){var Ae=ae.collection(t.getAllInBox(ce[0],ce[1],ce[2],ce[3]));t.redrawHint("select",!0),Ae.length>0&&t.redrawHint("eles",!0),ae.emit(ke("boxend"));var Qe=function(Je){return Je.selectable()&&!Je.selected()};ae.selectionType()==="additive"||Se||ae.$(r).unmerge(Ae).unselect(),Ae.emit(ke("box")).stdFilter(Qe).select().emit(ke("boxselect")),t.redraw()}if(t.hoverData.dragging&&(t.hoverData.dragging=!1,t.redrawHint("select",!0),t.redrawHint("eles",!0),t.redraw()),!ce[4]){t.redrawHint("drag",!0),t.redrawHint("eles",!0);var Xe=ye&&ye.grabbed();_(oe),Xe&&(ye.emit(ke("freeon")),oe.emit(ke("free")),t.dragData.didDrag&&(ye.emit(ke("dragfreeon")),oe.emit(ke("dragfree"))))}}ce[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,M,U=1e5,H=function(Z){for(var he=Math.abs(Z[0]),ae=1;ae<Z.length;ae++)if(Math.abs(Z[ae])!==he)return!1;return!0},$=function(Z){var he=!1,ae=Z.deltaY;if(ae==null&&(Z.wheelDeltaY!=null?ae=Z.wheelDeltaY/4:Z.wheelDelta!=null&&(ae=Z.wheelDelta/4)),ae!==0){if(M==null)if(B.length>=D){M=!1;var se=B;if(se[0]>=5){var ce;H(se)?ce=se[0]:ce=xT(se),ce>1&&(M=!0,U=ce)}}else B.push(Math.abs(ae)),he=!0;else M&&(U=Math.min(Math.abs(ae),U));if(!t.scrollingPage){var de=t.cy,oe=de.zoom(),ye=de.pan(),Se=t.projectIntoViewport(Z.clientX,Z.clientY),ke=[Se[0]*oe+ye.x,Se[1]*oe+ye.y];if(t.hoverData.draggingEles||t.hoverData.dragging||t.hoverData.cxtStarted||E()){Z.preventDefault();return}if(de.panningEnabled()&&de.userPanningEnabled()&&de.zoomingEnabled()&&de.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 De;he&&Math.abs(ae)>5&&(ae=uv(ae)*5),De=ae/-250,M&&(De/=U,De*=3),De=De*t.wheelSensitivity;var Ne=Z.deltaMode===1;Ne&&(De*=33);var Ae=de.zoom()*Math.pow(10,De);Z.type==="gesturechange"&&(Ae=t.gestureStartZoom*Z.scale),de.zoom({level:Ae,renderedPosition:{x:ke[0],y:ke[1]}}),de.emit({type:Z.type==="gesturechange"?"pinchzoom":"scrollzoom",originalEvent:Z,position:{x:Se[0],y:Se[1]}})}}}};t.registerBinding(t.container,"wheel",$,!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||$(me)},!0),t.registerBinding(t.container,"mouseout",function(Z){var he=t.projectIntoViewport(Z.clientX,Z.clientY);t.cy.emit({originalEvent:Z,type:"mouseout",position:{x:he[0],y:he[1]}})},!1),t.registerBinding(t.container,"mouseover",function(Z){var he=t.projectIntoViewport(Z.clientX,Z.clientY);t.cy.emit({originalEvent:Z,type:"mouseover",position:{x:he[0],y:he[1]}})},!1);var F,P,z,G,V,te,ie,ne,X,q,Y,K,ee,re=function(Z,he,ae,se){return Math.sqrt((ae-Z)*(ae-Z)+(se-he)*(se-he))},ue=function(Z,he,ae,se){return(ae-Z)*(ae-Z)+(se-he)*(se-he)},pe;t.registerBinding(t.container,"touchstart",pe=function(Z){if(t.hasTouchStarted=!0,!!k(Z)){m(),t.touchData.capture=!0,t.data.bgActivePosistion=void 0;var he=t.cy,ae=t.touchData.now,se=t.touchData.earlier;if(Z.touches[0]){var ce=t.projectIntoViewport(Z.touches[0].clientX,Z.touches[0].clientY);ae[0]=ce[0],ae[1]=ce[1]}if(Z.touches[1]){var ce=t.projectIntoViewport(Z.touches[1].clientX,Z.touches[1].clientY);ae[2]=ce[0],ae[3]=ce[1]}if(Z.touches[2]){var ce=t.projectIntoViewport(Z.touches[2].clientX,Z.touches[2].clientY);ae[4]=ce[0],ae[5]=ce[1]}var de=function(Ct){return{originalEvent:Z,type:Ct,position:{x:ae[0],y:ae[1]}}};if(Z.touches[1]){t.touchData.singleTouchMoved=!0,_(t.dragData.touchDragEles);var oe=t.findContainerClientCoords();X=oe[0],q=oe[1],Y=oe[2],K=oe[3],F=Z.touches[0].clientX-X,P=Z.touches[0].clientY-q,z=Z.touches[1].clientX-X,G=Z.touches[1].clientY-q,ee=0<=F&&F<=Y&&0<=z&&z<=Y&&0<=P&&P<=K&&0<=G&&G<=K;var ye=he.pan(),Se=he.zoom();V=re(F,P,z,G),te=ue(F,P,z,G),ie=[(F+z)/2,(P+G)/2],ne=[(ie[0]-ye.x)/Se,(ie[1]-ye.y)/Se];var ke=200,De=ke*ke;if(te<De&&!Z.touches[2]){var Ne=t.findNearestElement(ae[0],ae[1],!0,!0),Ae=t.findNearestElement(ae[2],ae[3],!0,!0);Ne&&Ne.isNode()?(Ne.activate().emit(de("cxttapstart")),t.touchData.start=Ne):Ae&&Ae.isNode()?(Ae.activate().emit(de("cxttapstart")),t.touchData.start=Ae):he.emit(de("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])he.boxSelectionEnabled()&&Z.preventDefault();else if(!Z.touches[1]){if(Z.touches[0]){var Qe=t.findNearestElements(ae[0],ae[1],!0,!0),Xe=Qe[0];if(Xe!=null&&(Xe.activate(),t.touchData.start=Xe,t.touchData.starts=Qe,t.nodeIsGrabbable(Xe))){var mt=t.dragData.touchDragEles=he.collection(),Je=null;t.redrawHint("eles",!0),t.redrawHint("drag",!0),Xe.selected()?(Je=he.$(function(Ye){return Ye.selected()&&t.nodeIsGrabbable(Ye)}),f(Je,{addToList:mt})):y(Xe,{addToList:mt}),u(Xe),Xe.emit(de("grabon")),Je?Je.forEach(function(Ye){Ye.emit(de("grab"))}):Xe.emit(de("grab"))}i(Xe,["touchstart","tapstart","vmousedown"],Z,{x:ae[0],y:ae[1]}),Xe==null&&(t.data.bgActivePosistion={x:ce[0],y:ce[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:ae[0],y:ae[1]})},t.tapholdDuration)}}if(Z.touches.length>=1){for(var Ze=t.touchData.startPosition=[null,null,null,null,null,null],ut=0;ut<ae.length;ut++)Ze[ut]=se[ut]=ae[ut];var et=Z.touches[0];t.touchData.startGPosition=[et.clientX,et.clientY]}}},!1);var Re;t.registerBinding(e,"touchmove",Re=function(Z){var he=t.touchData.capture;if(!(!he&&!k(Z))){var ae=t.selection,se=t.cy,ce=t.touchData.now,de=t.touchData.earlier,oe=se.zoom();if(Z.touches[0]){var ye=t.projectIntoViewport(Z.touches[0].clientX,Z.touches[0].clientY);ce[0]=ye[0],ce[1]=ye[1]}if(Z.touches[1]){var ye=t.projectIntoViewport(Z.touches[1].clientX,Z.touches[1].clientY);ce[2]=ye[0],ce[3]=ye[1]}if(Z.touches[2]){var ye=t.projectIntoViewport(Z.touches[2].clientX,Z.touches[2].clientY);ce[4]=ye[0],ce[5]=ye[1]}var Se=function(Ja){return{originalEvent:Z,type:Ja,position:{x:ce[0],y:ce[1]}}},ke=t.touchData.startGPosition,De;if(he&&Z.touches[0]&&ke){for(var Ne=[],Ae=0;Ae<ce.length;Ae++)Ne[Ae]=ce[Ae]-de[Ae];var Qe=Z.touches[0].clientX-ke[0],Xe=Qe*Qe,mt=Z.touches[0].clientY-ke[1],Je=mt*mt,Ze=Xe+Je;De=Ze>=t.touchTapThreshold2}if(he&&t.touchData.cxt){Z.preventDefault();var ut=Z.touches[0].clientX-X,et=Z.touches[0].clientY-q,Ye=Z.touches[1].clientX-X,Ct=Z.touches[1].clientY-q,ht=ue(ut,et,Ye,Ct),lt=ht/te,Bt=150,Et=Bt*Bt,$t=1.5,Mt=$t*$t;if(lt>=Mt||ht>=Et){t.touchData.cxt=!1,t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);var pr=Se("cxttapend");t.touchData.start?(t.touchData.start.unactivate().emit(pr),t.touchData.start=null):se.emit(pr)}}if(he&&t.touchData.cxt){var pr=Se("cxtdrag");t.data.bgActivePosistion=void 0,t.redrawHint("select",!0),t.touchData.start?t.touchData.start.emit(pr):se.emit(pr),t.touchData.start&&(t.touchData.start._private.grabbed=!1),t.touchData.cxtDragged=!0;var ar=t.findNearestElement(ce[0],ce[1],!0,!0);(!t.touchData.cxtOver||ar!==t.touchData.cxtOver)&&(t.touchData.cxtOver&&t.touchData.cxtOver.emit(Se("cxtdragout")),t.touchData.cxtOver=ar,ar&&ar.emit(Se("cxtdragover")))}else if(he&&Z.touches[2]&&se.boxSelectionEnabled())Z.preventDefault(),t.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,t.touchData.selecting||se.emit(Se("boxstart")),t.touchData.selecting=!0,t.touchData.didSelect=!0,ae[4]=1,!ae||ae.length===0||ae[0]===void 0?(ae[0]=(ce[0]+ce[2]+ce[4])/3,ae[1]=(ce[1]+ce[3]+ce[5])/3,ae[2]=(ce[0]+ce[2]+ce[4])/3+1,ae[3]=(ce[1]+ce[3]+ce[5])/3+1):(ae[2]=(ce[0]+ce[2]+ce[4])/3,ae[3]=(ce[1]+ce[3]+ce[5])/3),t.redrawHint("select",!0),t.redraw();else if(he&&Z.touches[1]&&!t.touchData.didSelect&&se.zoomingEnabled()&&se.panningEnabled()&&se.userZoomingEnabled()&&se.userPanningEnabled()){Z.preventDefault(),t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);var rr=t.dragData.touchDragEles;if(rr){t.redrawHint("drag",!0);for(var jt=0;jt<rr.length;jt++){var Gr=rr[jt]._private;Gr.grabbed=!1,Gr.rscratch.inDragLayer=!1}}var ur=t.touchData.start,ut=Z.touches[0].clientX-X,et=Z.touches[0].clientY-q,Ye=Z.touches[1].clientX-X,Ct=Z.touches[1].clientY-q,xn=re(ut,et,Ye,Ct),si=xn/V;if(ee){var Ln=ut-F,Dn=et-P,pa=Ye-z,ga=Ct-G,Za=(Ln+pa)/2,Wt=(Dn+ga)/2,oi=se.zoom(),An=oi*si,$n=se.pan(),Wn=ne[0]*oi+$n.x,Ci=ne[1]*oi+$n.y,va={x:-An/oi*(Wn-$n.x-Za)+Wn,y:-An/oi*(Ci-$n.y-Wt)+Ci};if(ur&&ur.active()){var rr=t.dragData.touchDragEles;_(rr),t.redrawHint("drag",!0),t.redrawHint("eles",!0),ur.unactivate().emit(Se("freeon")),rr&&rr.emit(Se("free")),t.dragData.didDrag&&(ur.emit(Se("dragfreeon")),rr&&rr.emit(Se("dragfree")))}se.viewport({zoom:An,pan:va,cancelOnFailedZoom:!0}),se.emit(Se("pinchzoom")),V=xn,F=ut,P=et,z=Ye,G=Ct,t.pinching=!0}if(Z.touches[0]){var ye=t.projectIntoViewport(Z.touches[0].clientX,Z.touches[0].clientY);ce[0]=ye[0],ce[1]=ye[1]}if(Z.touches[1]){var ye=t.projectIntoViewport(Z.touches[1].clientX,Z.touches[1].clientY);ce[2]=ye[0],ce[3]=ye[1]}if(Z.touches[2]){var ye=t.projectIntoViewport(Z.touches[2].clientX,Z.touches[2].clientY);ce[4]=ye[0],ce[5]=ye[1]}}else if(Z.touches[0]&&!t.touchData.didSelect){var Tt=t.touchData.start,ct=t.touchData.last,ar;if(!t.hoverData.draggingEles&&!t.swipePanning&&(ar=t.findNearestElement(ce[0],ce[1],!0,!0)),he&&Tt!=null&&Z.preventDefault(),he&&Tt!=null&&t.nodeIsDraggable(Tt))if(De){var rr=t.dragData.touchDragEles,Nt=!t.dragData.didDrag;Nt&&f(rr,{inDragLayer:!0}),t.dragData.didDrag=!0;var Yt={x:0,y:0};if(Ke(Ne[0])&&Ke(Ne[1])&&(Yt.x+=Ne[0],Yt.y+=Ne[1],Nt)){t.redrawHint("eles",!0);var Kt=t.touchData.dragDelta;Kt&&Ke(Kt[0])&&Ke(Kt[1])&&(Yt.x+=Kt[0],Yt.y+=Kt[1])}t.hoverData.draggingEles=!0,rr.silentShift(Yt).emit(Se("position")).emit(Se("drag")),t.redrawHint("drag",!0),t.touchData.startPosition[0]==de[0]&&t.touchData.startPosition[1]==de[1]&&t.redrawHint("eles",!0),t.redraw()}else{var Kt=t.touchData.dragDelta=t.touchData.dragDelta||[];Kt.length===0?(Kt.push(Ne[0]),Kt.push(Ne[1])):(Kt[0]+=Ne[0],Kt[1]+=Ne[1])}if(i(Tt||ar,["touchmove","tapdrag","vmousemove"],Z,{x:ce[0],y:ce[1]}),(!Tt||!Tt.grabbed())&&ar!=ct&&(ct&&ct.emit(Se("tapdragout")),ar&&ar.emit(Se("tapdragover"))),t.touchData.last=ar,he)for(var jt=0;jt<ce.length;jt++)ce[jt]&&t.touchData.startPosition[jt]&&De&&(t.touchData.singleTouchMoved=!0);if(he&&(Tt==null||Tt.pannable())&&se.panningEnabled()&&se.userPanningEnabled()){var bd=o(Tt,t.touchData.starts);bd&&(Z.preventDefault(),t.data.bgActivePosistion||(t.data.bgActivePosistion=Bs(t.touchData.startPosition)),t.swipePanning?(se.panBy({x:Ne[0]*oe,y:Ne[1]*oe}),se.emit(Se("dragpan"))):De&&(t.swipePanning=!0,se.panBy({x:Qe*oe,y:mt*oe}),se.emit(Se("dragpan")),Tt&&(Tt.unactivate(),t.redrawHint("select",!0),t.touchData.start=null)));var ye=t.projectIntoViewport(Z.touches[0].clientX,Z.touches[0].clientY);ce[0]=ye[0],ce[1]=ye[1]}}for(var Ae=0;Ae<ce.length;Ae++)de[Ae]=ce[Ae];he&&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 Be;t.registerBinding(e,"touchcancel",Be=function(Z){var he=t.touchData.start;t.touchData.capture=!1,he&&he.unactivate()});var _e,Te,Le,Ee;if(t.registerBinding(e,"touchend",_e=function(Z){var he=t.touchData.start,ae=t.touchData.capture;if(ae)Z.touches.length===0&&(t.touchData.capture=!1),Z.preventDefault();else return;var se=t.selection;t.swipePanning=!1,t.hoverData.draggingEles=!1;var ce=t.cy,de=ce.zoom(),oe=t.touchData.now,ye=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 ke=function(Et){return{originalEvent:Z,type:Et,position:{x:oe[0],y:oe[1]}}};he&&he.unactivate();var De;if(t.touchData.cxt){if(De=ke("cxttapend"),he?he.emit(De):ce.emit(De),!t.touchData.cxtDragged){var Ne=ke("cxttap");he?he.emit(Ne):ce.emit(Ne)}t.touchData.start&&(t.touchData.start._private.grabbed=!1),t.touchData.cxt=!1,t.touchData.start=null,t.redraw();return}if(!Z.touches[2]&&ce.boxSelectionEnabled()&&t.touchData.selecting){t.touchData.selecting=!1;var Ae=ce.collection(t.getAllInBox(se[0],se[1],se[2],se[3]));se[0]=void 0,se[1]=void 0,se[2]=void 0,se[3]=void 0,se[4]=0,t.redrawHint("select",!0),ce.emit(ke("boxend"));var Qe=function(Et){return Et.selectable()&&!Et.selected()};Ae.emit(ke("box")).stdFilter(Qe).select().emit(ke("boxselect")),Ae.nonempty()&&t.redrawHint("eles",!0),t.redraw()}if(he!=null&&he.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 Xe=t.dragData.touchDragEles;if(he!=null){var mt=he._private.grabbed;_(Xe),t.redrawHint("drag",!0),t.redrawHint("eles",!0),mt&&(he.emit(ke("freeon")),Xe.emit(ke("free")),t.dragData.didDrag&&(he.emit(ke("dragfreeon")),Xe.emit(ke("dragfree")))),i(he,["touchend","tapend","vmouseup","tapdragout"],Z,{x:oe[0],y:oe[1]}),he.unactivate(),t.touchData.start=null}else{var Je=t.findNearestElement(oe[0],oe[1],!0,!0);i(Je,["touchend","tapend","vmouseup","tapdragout"],Z,{x:oe[0],y:oe[1]})}var Ze=t.touchData.startPosition[0]-oe[0],ut=Ze*Ze,et=t.touchData.startPosition[1]-oe[1],Ye=et*et,Ct=ut+Ye,ht=Ct*de*de;t.touchData.singleTouchMoved||(he||ce.$(":selected").unselect(["tapunselect"]),i(he,["tap","vclick"],Z,{x:oe[0],y:oe[1]}),Te=!1,Z.timeStamp-Ee<=ce.multiClickDebounceTime()?(Le&&clearTimeout(Le),Te=!0,Ee=null,i(he,["dbltap","vdblclick"],Z,{x:oe[0],y:oe[1]})):(Le=setTimeout(function(){Te||i(he,["onetap","voneclick"],Z,{x:oe[0],y:oe[1]})},ce.multiClickDebounceTime()),Ee=Z.timeStamp)),he!=null&&!t.dragData.didDrag&&he._private.selectable&&ht<t.touchTapThreshold2&&!t.pinching&&(ce.selectionType()==="single"?(ce.$(r).unmerge(he).unselect(["tapunselect"]),he.select(["tapselect"])):he.selected()?he.unselect(["tapunselect"]):he.select(["tapselect"]),t.redrawHint("eles",!0)),t.touchData.singleTouchMoved=!0}}}for(var lt=0;lt<oe.length;lt++)ye[lt]=oe[lt];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 Pe=[],ze=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}},Me=function(Z){return{event:Z,touch:ze(Z)}},Ue=function(Z){Pe.push(Me(Z))},Ge=function(Z){for(var he=0;he<Pe.length;he++){var ae=Pe[he];if(ae.event.pointerId===Z.pointerId){Pe.splice(he,1);return}}},ve=function(Z){var he=Pe.filter(function(ae){return ae.event.pointerId===Z.pointerId})[0];he.event=Z,he.touch=ze(Z)},Ce=function(Z){Z.touches=Pe.map(function(he){return he.touch})},Ie=function(Z){return Z.pointerType==="mouse"||Z.pointerType===4};t.registerBinding(t.container,"pointerdown",function(me){Ie(me)||(me.preventDefault(),Ue(me),Ce(me),pe(me))}),t.registerBinding(t.container,"pointerup",function(me){Ie(me)||(Ge(me),Ce(me),_e(me))}),t.registerBinding(t.container,"pointercancel",function(me){Ie(me)||(Ge(me),Ce(me),Be(me))}),t.registerBinding(t.container,"pointermove",function(me){Ie(me)||(me.preventDefault(),ve(me),Ce(me),Re(me))})}};var wi={};wi.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 bi(n,i,this.points,l,u,o,a,[0,-1],s)},hasMiterBounds:t!=="rectangle",miterBounds:function(n,i,s,o,a,l){return NT(this.points,n,i,s,o,a)}}};wi.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 OT(s,o,e,r,n/2+a,i/2+a)},checkPoint:function(e,r,n,i,s,o,a,l){return za(e,r,i,s,o,a,n)}}};wi.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&&l[u+"-w"]===s&&l[u+"-h"]===o&&l[u+"-corner-radius"]===a)return l[u];l[u]=new Array(e.length/2),l[u+"-cx"]=n,l[u+"-cy"]=i,l[u+"-w"]=s,l[u+"-h"]=o,l[u+"-corner-radius"]=a;var c=s/2,d=o/2;a=a==="auto"?n_(s,o):a;for(var g=new Array(e.length/2),f=0;f<e.length/2;f++)g[f]={x:n+c*e[f*2],y:i+d*e[f*2+1]};var y,_,v,m,x=g.length;for(_=g[x-1],y=0;y<x;y++)v=g[y%x],m=g[(y+1)%x],l[u][y]=_v(_,v,m,a),_=v,v=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,d){return jT(a,l,this.points,n,i,s,o,u,this.getOrCreateCorners(n,i,s,o,c,d,"corners"))},checkPoint:function(n,i,s,o,a,l,u,c,d){return IT(n,i,this.points,l,u,o,a,this.getOrCreateCorners(l,u,o,a,c,d,"corners"))}}};wi.generateRoundRectangle=function(){return this.nodeShapes["round-rectangle"]=this.nodeShapes.roundrectangle={renderer:this,name:"round-rectangle",points:Kr(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 t_(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"?ra(i,s):l,l=Math.min(u,c,l);var d=l*2;return!!(bi(e,r,this.points,o,a,i,s-d,[0,-1],n)||bi(e,r,this.points,o,a,i-d,s,[0,-1],n)||za(e,r,d,d,o-u+l,a-c+l,n)||za(e,r,d,d,o+u-l,a-c+l,n)||za(e,r,d,d,o+u-l,a+c-l,n)||za(e,r,d,d,o-u+l,a+c-l,n))}}};wi.generateCutRectangle=function(){return this.nodeShapes["cut-rectangle"]=this.nodeShapes.cutrectangle={renderer:this,name:"cut-rectangle",cornerLength:dv(),points:Kr(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,d=i-a,g=i+a;return{topLeft:[u,d+o,u+o,d,u+o,d+o],topRight:[c-o,d,c,d+o,c-o,d+o],bottomRight:[c,g-o,c-o,g,c-o,g-o],bottomLeft:[u+o,g,u,g-o,u+o,g-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(bi(e,r,this.points,o,a,i,s-2*u,[0,-1],n)||bi(e,r,this.points,o,a,i-2*u,s,[0,-1],n))return!0;var c=this.generateCutTrianglePts(i,s,o,a);return ln(e,r,c.topLeft)||ln(e,r,c.topRight)||ln(e,r,c.bottomRight)||ln(e,r,c.bottomLeft)}}};wi.generateBarrel=function(){return this.nodeShapes.barrel={renderer:this,name:"barrel",points:Kr(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,d=.85,g=this.generateBarrelBezierPts(n+2*a,i+2*a,e,r),f=function(v){var m=Hs({x:v[0],y:v[1]},{x:v[2],y:v[3]},{x:v[4],y:v[5]},u),x=Hs({x:v[0],y:v[1]},{x:v[2],y:v[3]},{x:v[4],y:v[5]},c),b=Hs({x:v[0],y:v[1]},{x:v[2],y:v[3]},{x:v[4],y:v[5]},d);return[v[0],v[1],m.x,m.y,x.x,x.y,b.x,b.y,v[4],v[5]]},y=[].concat(f(g.topLeft),f(g.topRight),f(g.bottomRight),f(g.bottomLeft));return vl(s,o,y,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,d=xg(e,r),g=d.heightOffset,f=d.widthOffset,y=d.ctrlPtOffsetPct*e,_={topLeft:[a,u+g,a+y,u,a+f,u],topRight:[l-f,u,l-y,u,l,u+g],bottomRight:[l,c-g,l-y,c,l-f,c],bottomLeft:[a+f,c,a+y,c,a,c-g]};return _.topLeft.isTop=!0,_.topRight.isTop=!0,_.bottomLeft.isBottom=!0,_.bottomRight.isBottom=!0,_},checkPoint:function(e,r,n,i,s,o,a,l){var u=xg(i,s),c=u.heightOffset,d=u.widthOffset;if(bi(e,r,this.points,o,a,i,s-2*c,[0,-1],n)||bi(e,r,this.points,o,a,i-2*d,s,[0,-1],n))return!0;for(var g=this.generateBarrelBezierPts(i,s,o,a),f=function(k,L,A){var I=A[4],O=A[2],B=A[0],D=A[5],M=A[1],U=Math.min(I,B),H=Math.max(I,B),$=Math.min(D,M),F=Math.max(D,M);if(U<=k&&k<=H&&$<=L&&L<=F){var P=FT(I,O,B),z=DT(P[0],P[1],P[2],k),G=z.filter(function(V){return 0<=V&&V<=1});if(G.length>0)return G[0]}return null},y=Object.keys(g),_=0;_<y.length;_++){var v=y[_],m=g[v],x=f(e,r,m);if(x!=null){var b=m[5],S=m[3],T=m[1],N=Nr(b,S,T,x);if(m.isTop&&N<=r||m.isBottom&&r<=N)return!0}}return!1}}};wi.generateBottomRoundrectangle=function(){return this.nodeShapes["bottom-round-rectangle"]=this.nodeShapes.bottomroundrectangle={renderer:this,name:"bottom-round-rectangle",points:Kr(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),d=c,g=e+(n/2+a),f=Qi(s,o,e,r,u,c,g,d,!1);return f.length>0?f:t_(s,o,e,r,n,i,a,l)},checkPoint:function(e,r,n,i,s,o,a,l){l=l==="auto"?ra(i,s):l;var u=2*l;if(bi(e,r,this.points,o,a,i,s-u,[0,-1],n)||bi(e,r,this.points,o,a,i-u,s,[0,-1],n))return!0;var c=i/2+2*n,d=s/2+2*n,g=[o-c,a-d,o-c,a,o+c,a,o+c,a-d];return!!(ln(e,r,g)||za(e,r,u,u,o+i/2-l,a+s/2-l,n)||za(e,r,u,u,o-i/2+l,a+s/2-l,n))}}};wi.registerNodeShapes=function(){var t=this.nodeShapes={},e=this;this.generateEllipse(),this.generatePolygon("triangle",Kr(3,0)),this.generateRoundPolygon("round-triangle",Kr(3,0)),this.generatePolygon("rectangle",Kr(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",Kr(5,0)),this.generateRoundPolygon("round-pentagon",Kr(5,0)),this.generatePolygon("hexagon",Kr(6,0)),this.generateRoundPolygon("round-hexagon",Kr(6,0)),this.generatePolygon("heptagon",Kr(7,0)),this.generateRoundPolygon("round-heptagon",Kr(7,0)),this.generatePolygon("octagon",Kr(8,0)),this.generateRoundPolygon("round-octagon",Kr(8,0));var n=new Array(20);{var i=yg(5,0),s=yg(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=r_(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("$"),d="polygon-"+c,g;return(g=this[d])?g:e.generatePolygon(d,u)}};var Il={};Il.timeToRender=function(){return this.redrawTotalTime/this.redrawCount};Il.redraw=function(t){t=t||Xw();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};Il.beforeRender=function(t,e){if(!this.destroyed){e==null&&ir("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 Y1=function(e,r,n){for(var i=e.beforeRenderCallbacks,s=0;s<i.length;s++)i[s].fn(r,n)};Il.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){Y1(t,!0,i);var s=xi();t.render(t.renderOptions);var o=t.lastDrawTime=xi();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 Y1(t,!1,i);t.skipFrame=!1,Pc(r)}};Pc(r)}};var iD=function(e){this.init(e)},i2=iD,ro=i2.prototype;ro.clientFunctions=["redrawHint","render","renderTo","matchCanvasSize","nodeShapeImpl","arrowShapeImpl"];ro.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),d=c.getPropertyValue("position");d==="static"&&zt("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()};ro.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()}};ro.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{}};ro.isHeadless=function(){return!1};[wv,t2,r2,to,wi,Il].forEach(function(t){vt(ro,t)});var Ip=1e3/60,a2={setupDequeueing:function(e){return function(){var n=this,i=this.renderer;if(!n.dequeueingSetup){n.dequeueingSetup=!0;var s=Ll(function(){i.redrawHint("eles",!0),i.redrawHint("drag",!0),i.redraw()},e.deqRedrawThreshold),o=function(u,c){var d=xi(),g=i.averageRedrawTime,f=i.lastRedrawTime,y=[],_=i.cy.extent(),v=i.getPixelRatio();for(u||i.flushRenderedStyleQueue();;){var m=xi(),x=m-d,b=m-c;if(f<Ip){var S=Ip-(u?g:0);if(b>=e.deqFastCost*S)break}else if(u){if(x>=e.deqCost*f||x>=e.deqAvgCost*g)break}else if(b>=e.deqNoDrawCost*Ip)break;var T=e.deq(n,v,_);if(T.length>0)for(var N=0;N<T.length;N++)y.push(T[N]);else break}y.length>0&&(e.onDeqd(n,y),!u&&e.shouldRedraw(n,y,v,_)&&s())},a=e.priority||sv;i.beforeRender(o,a(n))}}}},aD=(function(){function t(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Mc;la(this,t),this.idsByKey=new yi,this.keyForId=new yi,this.cachesByLvl=new yi,this.lvls=[],this.getKey=e,this.doesEleInvalidateKey=r}return ua(t,[{key:"getIdsFor",value:function(r){r==null&&ir("Can not get id list for null key");var n=this.idsByKey,i=this.idsByKey.get(r);return i||(i=new Qs,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 yi,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}}])})(),K1=25,sc=50,kc=-4,Ag=3,s2=7.99,sD=8,oD=1024,lD=1024,uD=1024,cD=.2,dD=.8,hD=10,fD=.15,pD=.1,gD=.9,vD=.9,mD=100,yD=1,Fs={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},xD=Ir({getKey:null,doesEleInvalidateKey:Mc,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:qw,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),nl=function(e,r){var n=this;n.renderer=e,n.onDequeues=[];var i=xD(r);vt(n,i),n.lookup=new aD(i.getKey,i.doesEleInvalidateKey),n.setupDequeueing()},Cr=nl.prototype;Cr.reasons=Fs;Cr.getTextureQueue=function(t){var e=this;return e.eleImgCaches=e.eleImgCaches||{},e.eleImgCaches[t]=e.eleImgCaches[t]||[]};Cr.getRetiredTextureQueue=function(t){var e=this,r=e.eleImgCaches.retired=e.eleImgCaches.retired||{},n=r[t]=r[t]||[];return n};Cr.getElementQueue=function(){var t=this,e=t.eleCacheQueue=t.eleCacheQueue||new Dl(function(r,n){return n.reqs-r.reqs});return e};Cr.getElementKeyToQueue=function(){var t=this,e=t.eleKeyToCacheQueue=t.eleKeyToCacheQueue||{};return e};Cr.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(lv(a*r))),n<kc)n=kc;else if(a>=s2||n>Ag)return null;var u=Math.pow(2,n),c=e.h*u,d=e.w*u,g=o.eleTextBiggerThanMin(t,u);if(!this.isVisible(t,g))return null;var f=l.get(t,n);if(f&&f.invalidated&&(f.invalidated=!1,f.texture.invalidatedWidth-=f.width),f)return f;var y;if(c<=K1?y=K1:c<=sc?y=sc:y=Math.ceil(c/sc)*sc,c>uD||d>lD)return null;var _=s.getTextureQueue(y),v=_[_.length-2],m=function(){return s.recycleTexture(y,d)||s.addTexture(y,d)};v||(v=_[_.length-1]),v||(v=m()),v.width-v.usedWidth<d&&(v=m());for(var x=function(U){return U&&U.scaledLabelShown===g},b=i&&i===Fs.dequeue,S=i&&i===Fs.highQuality,T=i&&i===Fs.downscale,N,E=n+1;E<=Ag;E++){var k=l.get(t,E);if(k){N=k;break}}var L=N&&N.level===n+1?N:null,A=function(){v.context.drawImage(L.texture.canvas,L.x,0,L.width,L.height,v.usedWidth,0,d,c)};if(v.context.setTransform(1,0,0,1,0,0),v.context.clearRect(v.usedWidth,0,d,y),x(L))A();else if(x(N))if(S){for(var I=N.level;I>n;I--)L=s.getElement(t,e,r,I,Fs.downscale);A()}else return s.queueElement(t,N.level-1),N;else{var O;if(!b&&!S&&!T)for(var B=n-1;B>=kc;B--){var D=l.get(t,B);if(D){O=D;break}}if(x(O))return s.queueElement(t,n),O;v.context.translate(v.usedWidth,0),v.context.scale(u,u),this.drawElement(v.context,t,e,g,!1),v.context.scale(1/u,1/u),v.context.translate(-v.usedWidth,0)}return f={x:v.usedWidth,texture:v,level:n,scale:u,width:d,height:c,scaledLabelShown:g},v.usedWidth+=Math.ceil(d+sD),v.eleCaches.push(f),l.set(t,n,f),s.checkTextureFullness(v),f};Cr.invalidateElements=function(t){for(var e=0;e<t.length;e++)this.invalidateElement(t[e])};Cr.invalidateElement=function(t){var e=this,r=e.lookup,n=[],i=r.isInvalid(t);if(i){for(var s=kc;s<=Ag;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)}};Cr.checkTextureUtility=function(t){t.invalidatedWidth>=cD*t.width&&this.retireTexture(t)};Cr.checkTextureFullness=function(t){var e=this,r=e.getTextureQueue(t.height);t.usedWidth/t.width>dD&&t.fullnessChecks>=hD?ta(r,t):t.fullnessChecks++};Cr.retireTexture=function(t){var e=this,r=t.height,n=e.getTextureQueue(r),i=this.lookup;ta(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)}ov(s);var l=e.getRetiredTextureQueue(r);l.push(t)};Cr.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(oD,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};Cr.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,ov(o.eleCaches),o.context.setTransform(1,0,0,1,0,0),o.context.clearRect(0,0,o.width,o.height),ta(i,o),n.push(o),o}};Cr.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}};Cr.dequeue=function(t){for(var e=this,r=e.getElementQueue(),n=e.getElementKeyToQueue(),i=[],s=e.lookup,o=0;o<yD&&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 d=e.getBoundingBox(u);e.getElement(u,d,t,a.level,Fs.dequeue)}return i};Cr.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=av,r.updateItem(s),r.pop(),n[i]=null):s.eles.unmerge(t))};Cr.onDequeue=function(t){this.onDequeues.push(t)};Cr.offDequeue=function(t){ta(this.onDequeues,t)};Cr.setupDequeueing=a2.setupDequeueing({deqRedrawThreshold:mD,deqCost:fD,deqAvgCost:pD,deqNoDrawCost:gD,deqFastCost:vD,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(cv(l,i))return!0}return!1},priority:function(e){return e.renderer.beforeRenderPriorities.eleTxrDeq}});var bD=1,sl=-4,Uc=2,wD=3.99,_D=50,SD=50,CD=.15,kD=.1,ED=.9,TD=.9,ND=1,X1=250,RD=4e3*4e3,Q1=32767,LD=!0,o2=function(e){var r=this,n=r.renderer=e,i=n.cy;r.layersByLevel={},r.firstGet=!0,r.lastInvalidationTime=xi()-2*X1,r.skipping=!1,r.eleTxrDeqs=i.collection(),r.scheduleElementRefinement=Ll(function(){r.refineElementTextures(r.eleTxrDeqs),r.eleTxrDeqs.unmerge(r.eleTxrDeqs)},SD),n.beforeRender(function(o,a){a-r.lastInvalidationTime<=X1?r.skipping=!0:r.skipping=!1},n.beforeRenderPriorities.lyrTxrSkip);var s=function(a,l){return l.reqs-a.reqs};r.layersQueue=new Dl(s),r.setupDequeueing()},Or=o2.prototype,Z1=0,DD=Math.pow(2,53)-1;Or.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:Z1=++Z1%DD,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};Or.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(lv(o*e)),r<sl)r=sl;else if(o>=wD||r>Uc)return null}n.validateLayersElesOrdering(r,t);var l=n.layersByLevel,u=Math.pow(2,r),c=l[r]=l[r]||[],d,g=n.levelIsComplete(r,t),f,y=function(){var A=function(M){if(n.validateLayersElesOrdering(M,t),n.levelIsComplete(M,t))return f=l[M],!0},I=function(M){if(!f)for(var U=r+M;sl<=U&&U<=Uc&&!A(U);U+=M);};I(1),I(-1);for(var O=c.length-1;O>=0;O--){var B=c[O];B.invalid&&ta(c,B)}};if(!g)y();else return c;var _=function(){if(!d){d=Zr();for(var A=0;A<t.length;A++)kT(d,t[A].boundingBox())}return d},v=function(A){A=A||{};var I=A.after;_();var O=Math.ceil(d.w*u),B=Math.ceil(d.h*u);if(O>Q1||B>Q1)return null;var D=O*B;if(D>RD)return null;var M=n.makeLayer(d,r);if(I!=null){var U=c.indexOf(I)+1;c.splice(U,0,M)}else(A.insert===void 0||A.insert)&&c.unshift(M);return M};if(n.skipping&&!a)return null;for(var m=null,x=t.length/bD,b=!a,S=0;S<t.length;S++){var T=t[S],N=T._private.rscratch,E=N.imgLayerCaches=N.imgLayerCaches||{},k=E[r];if(k){m=k;continue}if((!m||m.eles.length>=x||!e_(m.bb,T.boundingBox()))&&(m=v({insert:!0,after:m}),!m))return null;f||b?n.queueLayer(m,T):n.drawEleInLayer(m,T,r,e),m.eles.push(T),E[r]=m}return f||(b?null:c)};Or.getEleLevelForLayerLevel=function(t,e){return t};Or.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,LD),s.setImgSmoothing(o,!0))};Or.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};Or.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}}};Or.updateElementsInLayers=function(t,e){for(var r=this,n=El(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=sl;u<=Uc;u++){var c=l[u];c&&(s&&r.getEleLevelForLayerLevel(c.level)!==s.level||e(c,o,s))}};Or.haveLayers=function(){for(var t=this,e=!1,r=sl;r<=Uc;r++){var n=t.layersByLevel[r];if(n&&n.length>0){e=!0;break}}return e};Or.invalidateElements=function(t){var e=this;t.length!==0&&(e.lastInvalidationTime=xi(),!(t.length===0||!e.haveLayers())&&e.updateElementsInLayers(t,function(n,i,s){e.invalidateLayer(n)}))};Or.invalidateLayer=function(t){if(this.lastInvalidationTime=xi(),!t.invalid){var e=t.level,r=t.eles,n=this.layersByLevel[e];ta(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)}}};Or.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])})};Or.enqueueElementRefinement=function(t){this.eleTxrDeqs.merge(t),this.scheduleElementRefinement()};Or.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))}};Or.dequeue=function(t){for(var e=this,r=e.layersQueue,n=[],i=0;i<ND&&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};Or.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()}};Or.requestRedraw=Ll(function(){var t=this.renderer;t.redrawHint("eles",!0),t.redrawHint("drag",!0),t.redraw()},100);Or.setupDequeueing=a2.setupDequeueing({deqRedrawThreshold:_D,deqCost:CD,deqAvgCost:kD,deqNoDrawCost:ED,deqFastCost:TD,deq:function(e,r){return e.dequeue(r)},onDeqd:sv,shouldRedraw:qw,priority:function(e){return e.renderer.beforeRenderPriorities.lyrTxrDeq}});var l2={},J1;function AD(t,e){for(var r=0;r<e.length;r++){var n=e[r];t.lineTo(n.x,n.y)}}function PD(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 eb(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 MD(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 ID(t,e,r,n){t.arc(e,r,n,0,Math.PI*2,!1)}l2.arrowShapeImpl=function(t){return(J1||(J1={polygon:AD,"triangle-backcurve":PD,"triangle-tee":eb,"circle-triangle":MD,"triangle-cross":eb,circle:ID}))[t]};var ii={};ii.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)};ii.drawElementOverlay=function(t,e){var r=this;e.isNode()?r.drawNodeOverlay(t,e):r.drawEdgeOverlay(t,e)};ii.drawElementUnderlay=function(t,e){var r=this;e.isNode()?r.drawNodeUnderlay(t,e):r.drawEdgeUnderlay(t,e)};ii.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 d=a(l,e);if(d===0)return;var g=o(l,e),f=u.x1,y=u.y1,_=u.w,v=u.h,m,x,b,S,T;if(g!==0){var N=r.getRotationPoint(e);b=N.x,S=N.y,t.translate(b,S),t.rotate(g),T=l.getImgSmoothing(t),T||l.setImgSmoothing(t,!0);var E=r.getRotationOffset(e);m=E.x,x=E.y}else m=f,x=y;var k;d!==1&&(k=t.globalAlpha,t.globalAlpha=k*d),t.drawImage(c.texture.canvas,c.x,0,c.width,c.height,m,x,_,v),d!==1&&(t.globalAlpha=k),g!==0&&(t.rotate(-g),t.translate(-b,-S),T||l.setImgSmoothing(t,!1))}else r.drawElement(t,e)}};var OD=function(){return 0},BD=function(e,r){return e.getTextAngle(r,null)},jD=function(e,r){return e.getTextAngle(r,"source")},FD=function(e,r){return e.getTextAngle(r,"target")},zD=function(e,r){return r.effectiveOpacity()},Op=function(e,r){return r.pstyle("text-opacity").pfValue*r.effectiveOpacity()};ii.drawCachedElement=function(t,e,r,n,i,s){var o=this,a=o.data,l=a.eleTxrCache,u=a.lblTxrCache,c=a.slbTxrCache,d=a.tlbTxrCache,g=e.boundingBox(),f=s===!0?l.reasons.highQuality:null;if(!(g.w===0||g.h===0||!e.visible())&&(!n||cv(g,n))){var y=e.isEdge(),_=e.element()._private.rscratch.badLine;o.drawElementUnderlay(t,e),o.drawCachedElementPortion(t,e,l,r,i,f,OD,zD),(!y||!_)&&o.drawCachedElementPortion(t,e,u,r,i,f,BD,Op),y&&!_&&(o.drawCachedElementPortion(t,e,c,r,i,f,jD,Op),o.drawCachedElementPortion(t,e,d,r,i,f,FD,Op)),o.drawElementOverlay(t,e)}};ii.drawElements=function(t,e){for(var r=this,n=0;n<e.length;n++){var i=e[n];r.drawElement(t,i)}};ii.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)}};ii.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)}};ii.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 _i={};_i.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,d=e.pstyle("curve-style").value,g=e.pstyle("line-style").value,f=e.pstyle("width").pfValue,y=e.pstyle("line-cap").value,_=e.pstyle("line-outline-width").value,v=e.pstyle("line-outline-color").value,m=u*c,x=u*c,b=function(){var M=arguments.length>0&&arguments[0]!==void 0?arguments[0]:m;d==="straight-triangle"?(o.eleStrokeStyle(t,e,M),o.drawEdgeTrianglePath(e,t,a.allpts)):(t.lineWidth=f,t.lineCap=y,o.eleStrokeStyle(t,e,M),o.drawEdgePath(e,t,a.allpts,g),t.lineCap="butt")},S=function(){var M=arguments.length>0&&arguments[0]!==void 0?arguments[0]:m;if(t.lineWidth=f+_,t.lineCap=y,_>0)o.colorStrokeStyle(t,v[0],v[1],v[2],M);else{t.lineCap="butt";return}d==="straight-triangle"?o.drawEdgeTrianglePath(e,t,a.allpts):(o.drawEdgePath(e,t,a.allpts,g),t.lineCap="butt")},T=function(){i&&o.drawEdgeOverlay(t,e)},N=function(){i&&o.drawEdgeUnderlay(t,e)},E=function(){var M=arguments.length>0&&arguments[0]!==void 0?arguments[0]:x;o.drawArrowheads(t,e,M)},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,O=e.pstyle("ghost-opacity").value,B=m*O;t.translate(A,I),b(B),E(B),t.translate(-A,-I)}else S();N(),b(),E(),T(),k(),r&&t.translate(l.x1,l.y1)}};var u2=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")}}}};_i.drawEdgeOverlay=u2("overlay");_i.drawEdgeUnderlay=u2("underlay");_i.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 d=r.join("$"),g=i.pathCacheKey&&i.pathCacheKey===d;g?(o=e=i.pathCache,a=!0):(o=e=new Path2D,i.pathCacheKey=d,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 f=2;f+3<r.length;f+=4)e.quadraticCurveTo(r[f],r[f+1],r[f+2],r[f+3]);break;case"straight":case"haystack":for(var y=2;y+1<r.length;y+=2)e.lineTo(r[y],r[y+1]);break;case"segments":if(i.isRound){var _=un(i.roundCorners),v;try{for(_.s();!(v=_.n()).done;){var m=v.value;X_(e,m)}}catch(b){_.e(b)}finally{_.f()}e.lineTo(r[r.length-2],r[r.length-1])}else for(var x=2;x+1<r.length;x+=2)e.lineTo(r[x],r[x+1]);break}e=s,l?e.stroke(o):e.stroke(),e.setLineDash&&e.setLineDash([])};_i.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()}};_i.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)};_i.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,d=e.pstyle("width").pfValue,g=e.pstyle(r+"-arrow-width"),f=g.value==="match-line"?d:g.pfValue;g.units==="%"&&(f*=d);var y=e.pstyle("opacity").value;o===void 0&&(o=y);var _=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,d,l,f,n,i,s),t.globalCompositeOperation=_);var v=e.pstyle(r+"-arrow-color").value;a.colorFillStyle(t,v[0],v[1],v[2],o),a.colorStrokeStyle(t,v[0],v[1],v[2],o),a.drawArrowShape(e,t,c,d,l,f,n,i,s)}}};_i.drawArrowShape=function(t,e,r,n,i,s,o,a,l){var u=this,c=this.usePaths()&&i!=="triangle-cross",d=!1,g,f=e,y={x:o,y:a},_=t.pstyle("arrow-scale").value,v=this.getArrowWidth(n,_),m=u.arrowShapes[i];if(c){var x=u.arrowPathCache=u.arrowPathCache||[],b=$a(i),S=x[b];S!=null?(g=e=S,d=!0):(g=e=new Path2D,x[b]=g)}d||(e.beginPath&&e.beginPath(),c?m.draw(e,1,0,{x:0,y:0},1):m.draw(e,v,l,y,n),e.closePath&&e.closePath()),e=f,c&&(e.translate(o,a),e.rotate(l),e.scale(v,v)),(r==="filled"||r==="both")&&(c?e.fill(g):e.fill()),(r==="hollow"||r==="both")&&(e.lineWidth=s/(c?v:1),e.lineJoin="miter",c?e.stroke(g):e.stroke()),c&&(e.scale(1/v,1/v),e.rotate(-l),e.translate(-o,-a))};var Cv={};Cv.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){zt(c)}};Cv.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),d=c(r,"background-fit","value",n),g=c(r,"background-repeat","value",n),f=r.width(),y=r.height(),_=r.padding()*2,v=f+(c(r,"background-width-relative-to","value",n)==="inner"?0:_),m=y+(c(r,"background-height-relative-to","value",n)==="inner"?0:_),x=r._private.rscratch,b=c(r,"background-clip","value",n),S=b==="node",T=c(r,"background-image-opacity","value",n)*i,N=c(r,"background-image-smoothing","value",n),E=r.pstyle("corner-radius").value;E!=="auto"&&(E=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)*v: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(d==="contain"){var O=Math.min(v/A,m/I);A*=O,I*=O}else if(d==="cover"){var O=Math.max(v/A,m/I);A*=O,I*=O}var B=a-v/2,D=c(r,"background-position-x","units",n),M=c(r,"background-position-x","pfValue",n);D==="%"?B+=(v-A)*M:B+=M;var U=c(r,"background-offset-x","units",n),H=c(r,"background-offset-x","pfValue",n);U==="%"?B+=(v-A)*H:B+=H;var $=l-m/2,F=c(r,"background-position-y","units",n),P=c(r,"background-position-y","pfValue",n);F==="%"?$+=(m-I)*P:$+=P;var z=c(r,"background-offset-y","units",n),G=c(r,"background-offset-y","pfValue",n);z==="%"?$+=(m-I)*G:$+=G,x.pathCache&&(B-=a,$-=l,a=0,l=0);var V=t.globalAlpha;t.globalAlpha=T;var te=s.getImgSmoothing(t),ie=!1;if(N==="no"&&te?(s.setImgSmoothing(t,!1),ie=!0):N==="yes"&&!te&&(s.setImgSmoothing(t,!0),ie=!0),g==="no-repeat")S&&(t.save(),x.pathCache?t.clip(x.pathCache):(s.nodeShapes[s.getNodeShape(r)].draw(t,a,l,v,m,E,x),t.clip())),s.safeDrawImage(t,e,0,0,k,L,B,$,A,I),S&&t.restore();else{var ne=t.createPattern(e,g);t.fillStyle=ne,s.nodeShapes[s.getNodeShape(r)].draw(t,a,l,v,m,E,x),t.translate(B,$),t.fill(),t.translate(-B,-$)}t.globalAlpha=V,ie&&s.setImgSmoothing(t,te)}};var Xa={};Xa.eleTextBiggerThanMin=function(t,e){if(!e){var r=t.cy().zoom(),n=this.getPixelRatio(),i=Math.ceil(lv(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)};Xa.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,d=e.pstyle("label"),g=e.pstyle("source-label"),f=e.pstyle("target-label");if(c||(!d||!d.value)&&(!g||!g.value)&&(!f||!f.value))return;t.textAlign="center",t.textBaseline="bottom"}var y=!r,_;r&&(_=r,t.translate(-_.x1,-_.y1)),i==null?(o.drawText(t,e,null,y,s),e.isEdge()&&(o.drawText(t,e,"source",y,s),o.drawText(t,e,"target",y,s))):o.drawText(t,e,i,y,s),r&&t.translate(_.x1,_.y1)};Xa.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};Xa.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 HD(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 tb(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()}Xa.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};Xa.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,d,g=this.getLabelText(e,r);if(g!=null&&g!==""&&!isNaN(l)&&!isNaN(u)){this.setupTextStyle(t,e,i);var f=r?r+"-":"",y=Xr(o,"labelWidth",r),_=Xr(o,"labelHeight",r),v=Xr(o,"labelActualDescent",r),m=e.pstyle(f+"text-margin-x").pfValue,x=e.pstyle(f+"text-margin-y").pfValue,b=e.isEdge(),S=e.pstyle("text-halign").value,T=e.pstyle("text-valign").value;b&&(S="center",T="center"),l+=m,u+=x;var N;n?N=this.getTextAngle(e,r):N=0,N!==0&&(c=l,d=u,t.translate(c,d),t.rotate(N),l=0,u=0);var E=Ys(S),k=Ks(T);switch(k){case"top":break;case"center":u+=_/2;break;case"bottom":u+=_;break}var L=e.pstyle("text-background-opacity").value,A=e.pstyle("text-border-opacity").value,I=e.pstyle("text-border-width").pfValue,O=e.pstyle("text-background-padding").pfValue,B=e.pstyle("text-background-shape").strValue,D=B==="round-rectangle"||B==="roundrectangle",M=B==="circle",U=2;if(L>0||I>0&&A>0){var H=t.fillStyle,$=t.strokeStyle,F=t.lineWidth,P=e.pstyle("text-background-color").value,z=e.pstyle("text-border-color").value,G=e.pstyle("text-border-style").value,V=L>0,te=I>0&&A>0,ie=l-O;switch(E){case"left":ie-=y;break;case"center":ie-=y/2;break}var ne=u-_-O,X=y+2*O,q=_+2*O;if(V&&(t.fillStyle="rgba(".concat(P[0],",").concat(P[1],",").concat(P[2],",").concat(L*a,")")),te&&(t.strokeStyle="rgba(".concat(z[0],",").concat(z[1],",").concat(z[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(),tb(t,ie,ne,X,q,U)):M?(t.beginPath(),HD(t,ie,ne,X,q)):(t.beginPath(),t.rect(ie,ne,X,q)),V&&t.fill(),te&&t.stroke(),te&&G==="double"){var Y=I/2;t.beginPath(),D?tb(t,ie+Y,ne+Y,X-2*Y,q-2*Y,U):t.rect(ie+Y,ne+Y,X-2*Y,q-2*Y),t.stroke()}t.fillStyle=H,t.strokeStyle=$,t.lineWidth=F,t.setLineDash&&t.setLineDash([])}var K=2*e.pstyle("text-outline-width").pfValue;if(K>0&&(t.lineWidth=K),u-=v,e.pstyle("text-wrap").value==="wrap"){var ee=Xr(o,"labelWrapCachedLines",r),re=Xr(o,"labelLineHeight",r),ue=y/2,pe=this.getLabelJustification(e);switch(pe==="auto"||(E==="left"?pe==="left"?l+=-y:pe==="center"&&(l+=-ue):E==="center"?pe==="left"?l+=-ue:pe==="right"&&(l+=ue):E==="right"&&(pe==="center"?l+=ue:pe==="right"&&(l+=y))),k){case"top":u-=(ee.length-1)*re;break;case"center":case"bottom":u-=(ee.length-1)*re;break}for(var Re=0;Re<ee.length;Re++)K>0&&t.strokeText(ee[Re],l,u),t.fillText(ee[Re],l,u),u+=re}else K>0&&t.strokeText(g,l,u),t.fillText(g,l,u);N!==0&&(t.rotate(-N),t.translate(-c,-d))}}};var da={};da.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,d=e.position();if(!(!Ke(d.x)||!Ke(d.y))&&!(s&&!e.visible())){var g=s?e.effectiveOpacity():1,f=o.usePaths(),y,_=!1,v=e.padding();a=e.width()+2*v,l=e.height()+2*v;var m;r&&(m=r,t.translate(-m.x1,-m.y1));for(var x=e.pstyle("background-image"),b=x.value,S=new Array(b.length),T=new Array(b.length),N=0,E=0;E<b.length;E++){var k=b[E],L=S[E]=k!=null&&k!=="none";if(L){var A=e.cy().style().getIndexedStyle(e,"background-image-crossorigin","value",E);N++,T[E]=o.getCachedImage(k,A,function(){u.backgroundTimestamp=Date.now(),e.emitAndNotify("background")})}}var I=e.pstyle("background-blacken").value,O=e.pstyle("border-width").pfValue,B=e.pstyle("background-opacity").value*g,D=e.pstyle("border-color").value,M=e.pstyle("border-style").value,U=e.pstyle("border-join").value,H=e.pstyle("border-cap").value,$=e.pstyle("border-position").value,F=e.pstyle("border-dash-pattern").pfValue,P=e.pstyle("border-dash-offset").pfValue,z=e.pstyle("border-opacity").value*g,G=e.pstyle("outline-width").pfValue,V=e.pstyle("outline-color").value,te=e.pstyle("outline-style").value,ie=e.pstyle("outline-opacity").value*g,ne=e.pstyle("outline-offset").value,X=e.pstyle("corner-radius").value;X!=="auto"&&(X=e.pstyle("corner-radius").pfValue);var q=function(){var he=arguments.length>0&&arguments[0]!==void 0?arguments[0]:B;o.eleFillStyle(t,e,he)},Y=function(){var he=arguments.length>0&&arguments[0]!==void 0?arguments[0]:z;o.colorStrokeStyle(t,D[0],D[1],D[2],he)},K=function(){var he=arguments.length>0&&arguments[0]!==void 0?arguments[0]:ie;o.colorStrokeStyle(t,V[0],V[1],V[2],he)},ee=function(he,ae,se,ce){var de=o.nodePathCache=o.nodePathCache||[],oe=Gw(se==="polygon"?se+","+ce.join(","):se,""+ae,""+he,""+X),ye=de[oe],Se,ke=!1;return ye!=null?(Se=ye,ke=!0,c.pathCache=Se):(Se=new Path2D,de[oe]=c.pathCache=Se),{path:Se,cacheHit:ke}},re=e.pstyle("shape").strValue,ue=e.pstyle("shape-polygon-points").pfValue;if(f){t.translate(d.x,d.y);var pe=ee(a,l,re,ue);y=pe.path,_=pe.cacheHit}var Re=function(){if(!_){var he=d;f&&(he={x:0,y:0}),o.nodeShapes[o.getNodeShape(e)].draw(y||t,he.x,he.y,a,l,X,c)}f?t.fill(y):t.fill()},Be=function(){for(var he=arguments.length>0&&arguments[0]!==void 0?arguments[0]:g,ae=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,se=u.backgrounding,ce=0,de=0;de<T.length;de++){var oe=e.cy().style().getIndexedStyle(e,"background-image-containment","value",de);if(ae&&oe==="over"||!ae&&oe==="inside"){ce++;continue}S[de]&&T[de].complete&&!T[de].error&&(ce++,o.drawInscribedImage(t,T[de],e,de,he))}u.backgrounding=ce!==N,se!==u.backgrounding&&e.updateStyle(!1)},_e=function(){var he=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,ae=arguments.length>1&&arguments[1]!==void 0?arguments[1]:g;o.hasPie(e)&&(o.drawPie(t,e,ae),he&&(f||o.nodeShapes[o.getNodeShape(e)].draw(t,d.x,d.y,a,l,X,c)))},Te=function(){var he=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,ae=arguments.length>1&&arguments[1]!==void 0?arguments[1]:g;o.hasStripe(e)&&(t.save(),f?t.clip(c.pathCache):(o.nodeShapes[o.getNodeShape(e)].draw(t,d.x,d.y,a,l,X,c),t.clip()),o.drawStripe(t,e,ae),t.restore(),he&&(f||o.nodeShapes[o.getNodeShape(e)].draw(t,d.x,d.y,a,l,X,c)))},Le=function(){var he=arguments.length>0&&arguments[0]!==void 0?arguments[0]:g,ae=(I>0?I:-I)*he,se=I>0?0:255;I!==0&&(o.colorFillStyle(t,se,se,se,ae),f?t.fill(y):t.fill())},Ee=function(){if(O>0){if(t.lineWidth=O,t.lineCap=H,t.lineJoin=U,t.setLineDash)switch(M){case"dotted":t.setLineDash([1,1]);break;case"dashed":t.setLineDash(F),t.lineDashOffset=P;break;case"solid":case"double":t.setLineDash([]);break}if($!=="center"){if(t.save(),t.lineWidth*=2,$==="inside")f?t.clip(y):t.clip();else{var he=new Path2D;he.rect(-a/2-O,-l/2-O,a+2*O,l+2*O),he.addPath(y),t.clip(he,"evenodd")}f?t.stroke(y):t.stroke(),t.restore()}else f?t.stroke(y):t.stroke();if(M==="double"){t.lineWidth=O/3;var ae=t.globalCompositeOperation;t.globalCompositeOperation="destination-out",f?t.stroke(y):t.stroke(),t.globalCompositeOperation=ae}t.setLineDash&&t.setLineDash([])}},Pe=function(){if(G>0){if(t.lineWidth=G,t.lineCap="butt",t.setLineDash)switch(te){case"dotted":t.setLineDash([1,1]);break;case"dashed":t.setLineDash([4,2]);break;case"solid":case"double":t.setLineDash([]);break}var he=d;f&&(he={x:0,y:0});var ae=o.getNodeShape(e),se=O;$==="inside"&&(se=0),$==="outside"&&(se*=2);var ce=(a+se+(G+ne))/a,de=(l+se+(G+ne))/l,oe=a*ce,ye=l*de,Se=o.nodeShapes[ae].points,ke;if(f){var De=ee(oe,ye,ae,Se);ke=De.path}if(ae==="ellipse")o.drawEllipsePath(ke||t,he.x,he.y,oe,ye);else if(["round-diamond","round-heptagon","round-hexagon","round-octagon","round-pentagon","round-polygon","round-triangle","round-tag"].includes(ae)){var Ne=0,Ae=0,Qe=0;ae==="round-diamond"?Ne=(se+ne+G)*1.4:ae==="round-heptagon"?(Ne=(se+ne+G)*1.075,Qe=-(se/2+ne+G)/35):ae==="round-hexagon"?Ne=(se+ne+G)*1.12:ae==="round-pentagon"?(Ne=(se+ne+G)*1.13,Qe=-(se/2+ne+G)/15):ae==="round-tag"?(Ne=(se+ne+G)*1.12,Ae=(se/2+G+ne)*.07):ae==="round-triangle"&&(Ne=(se+ne+G)*(Math.PI/2),Qe=-(se+ne/2+G)/Math.PI),Ne!==0&&(ce=(a+Ne)/a,oe=a*ce,["round-hexagon","round-tag"].includes(ae)||(de=(l+Ne)/l,ye=l*de)),X=X==="auto"?n_(oe,ye):X;for(var Xe=oe/2,mt=ye/2,Je=X+(se+G+ne)/2,Ze=new Array(Se.length/2),ut=new Array(Se.length/2),et=0;et<Se.length/2;et++)Ze[et]={x:he.x+Ae+Xe*Se[et*2],y:he.y+Qe+mt*Se[et*2+1]};var Ye,Ct,ht,lt,Bt=Ze.length;for(Ct=Ze[Bt-1],Ye=0;Ye<Bt;Ye++)ht=Ze[Ye%Bt],lt=Ze[(Ye+1)%Bt],ut[Ye]=_v(Ct,ht,lt,Je),Ct=ht,ht=lt;o.drawRoundPolygonPath(ke||t,he.x+Ae,he.y+Qe,a*ce,l*de,Se,ut)}else if(["roundrectangle","round-rectangle"].includes(ae))X=X==="auto"?ra(oe,ye):X,o.drawRoundRectanglePath(ke||t,he.x,he.y,oe,ye,X+(se+G+ne)/2);else if(["cutrectangle","cut-rectangle"].includes(ae))X=X==="auto"?dv():X,o.drawCutRectanglePath(ke||t,he.x,he.y,oe,ye,null,X+(se+G+ne)/4);else if(["bottomroundrectangle","bottom-round-rectangle"].includes(ae))X=X==="auto"?ra(oe,ye):X,o.drawBottomRoundRectanglePath(ke||t,he.x,he.y,oe,ye,X+(se+G+ne)/2);else if(ae==="barrel")o.drawBarrelPath(ke||t,he.x,he.y,oe,ye);else if(ae.startsWith("polygon")||["rhomboid","right-rhomboid","round-tag","tag","vee"].includes(ae)){var Et=(se+G+ne)/a;Se=Ic(Oc(Se,Et)),o.drawPolygonPath(ke||t,he.x,he.y,a,l,Se)}else{var $t=(se+G+ne)/a;Se=Ic(Oc(Se,-$t)),o.drawPolygonPath(ke||t,he.x,he.y,a,l,Se)}if(f?t.stroke(ke):t.stroke(),te==="double"){t.lineWidth=se/3;var Mt=t.globalCompositeOperation;t.globalCompositeOperation="destination-out",f?t.stroke(ke):t.stroke(),t.globalCompositeOperation=Mt}t.setLineDash&&t.setLineDash([])}},ze=function(){i&&o.drawNodeOverlay(t,e,d,a,l)},Me=function(){i&&o.drawNodeUnderlay(t,e,d,a,l)},Ue=function(){o.drawElementText(t,e,null,n)},Ge=e.pstyle("ghost").value==="yes";if(Ge){var ve=e.pstyle("ghost-offset-x").pfValue,Ce=e.pstyle("ghost-offset-y").pfValue,Ie=e.pstyle("ghost-opacity").value,me=Ie*g;t.translate(ve,Ce),K(),Pe(),q(Ie*B),Re(),Be(me,!0),Y(Ie*z),Ee(),_e(I!==0||O!==0),Te(I!==0||O!==0),Be(me,!1),Le(me),t.translate(-ve,-Ce)}f&&t.translate(-d.x,-d.y),Me(),f&&t.translate(d.x,d.y),K(),Pe(),q(),Re(),Be(g,!0),Y(),Ee(),_e(I!==0||O!==0),Te(I!==0||O!==0),Be(g,!1),Le(),f&&t.translate(-d.x,-d.y),Ue(),ze(),r&&t.translate(m.x1,m.y1)}};var c2=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,d=n.pstyle("".concat(e,"-shape")).value,g=n.pstyle("".concat(e,"-corner-radius")).value;if(u>0){if(i=i||n.position(),s==null||o==null){var f=n.padding();s=n.width()+2*f,o=n.height()+2*f}a.colorFillStyle(r,c[0],c[1],c[2],u),a.nodeShapes[d].draw(r,i.x,i.y,s+l*2,o+l*2,g),r.fill()}}}};da.drawNodeOverlay=c2("overlay");da.drawNodeUnderlay=c2("underlay");da.hasPie=function(t){return t=t[0],t._private.hasPie};da.hasStripe=function(t){return t=t[0],t._private.hasStripe};da.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(),d=e.height(),g=Math.min(c,d)/2,f,y=0,_=this.usePaths();if(_&&(l=0,u=0),s.units==="%"?g=g*s.pfValue:s.pfValue!==void 0&&(g=s.pfValue/2),o.units==="%"?f=g*o.pfValue:o.pfValue!==void 0&&(f=o.pfValue/2),!(f>=g))for(var v=1;v<=i.pieBackgroundN;v++){var m=e.pstyle("pie-"+v+"-background-size").value,x=e.pstyle("pie-"+v+"-background-color").value,b=e.pstyle("pie-"+v+"-background-opacity").value*r,S=m/100;S+y>1&&(S=1-y);var T=1.5*Math.PI+2*Math.PI*y;T+=a;var N=2*Math.PI*S,E=T+N;m===0||y>=1||y+S>1||(f===0?(t.beginPath(),t.moveTo(l,u),t.arc(l,u,g,T,E),t.closePath()):(t.beginPath(),t.arc(l,u,g,T,E),t.arc(l,u,f,E,T,!0),t.closePath()),this.colorFillStyle(t,x[0],x[1],x[2],b),t.fill(),y+=S)}};da.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 d=e.pstyle("stripe-direction").value,g=e.pstyle("stripe-size");switch(d){case"vertical":break;case"righward":t.rotate(-Math.PI/2);break}var f=a,y=l;g.units==="%"?(f=f*g.pfValue,y=y*g.pfValue):g.pfValue!==void 0&&(f=g.pfValue,y=g.pfValue),c&&(s=0,o=0),o-=f/2,s-=y/2;for(var _=1;_<=i.stripeBackgroundN;_++){var v=e.pstyle("stripe-"+_+"-background-size").value,m=e.pstyle("stripe-"+_+"-background-color").value,x=e.pstyle("stripe-"+_+"-background-opacity").value*r,b=v/100;b+u>1&&(b=1-u),!(v===0||u>=1||u+b>1)&&(t.beginPath(),t.rect(s,o+y*u,f,y*b),t.closePath(),this.colorFillStyle(t,m[0],m[1],m[2],x),t.fill(),u+=b)}t.restore()};var Jr={},UD=100;Jr.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};Jr.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};Jr.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(),d=r.midpoint(),g=Wa(u,d),f=Wa(c,d);s=t.createRadialGradient(d.x,d.y,0,d.x,d.y,Math.max(g,f))}else{var y=o?{x:0,y:0}:r.position(),_=r.paddedWidth(),v=r.paddedHeight();s=t.createRadialGradient(y.x,y.y,0,y.x,y.y,Math.max(_,v))}else if(r.isEdge()){var m=r.sourceEndpoint(),x=r.targetEndpoint();s=t.createLinearGradient(m.x,m.y,x.x,x.y)}else{var b=o?{x:0,y:0}:r.position(),S=r.paddedWidth(),T=r.paddedHeight(),N=S/2,E=T/2,k=r.pstyle("background-gradient-direction").value;switch(k){case"to-bottom":s=t.createLinearGradient(b.x,b.y-E,b.x,b.y+E);break;case"to-top":s=t.createLinearGradient(b.x,b.y+E,b.x,b.y-E);break;case"to-left":s=t.createLinearGradient(b.x+N,b.y,b.x-N,b.y);break;case"to-right":s=t.createLinearGradient(b.x-N,b.y,b.x+N,b.y);break;case"to-bottom-right":case"to-right-bottom":s=t.createLinearGradient(b.x-N,b.y-E,b.x+N,b.y+E);break;case"to-top-right":case"to-right-top":s=t.createLinearGradient(b.x-N,b.y+E,b.x+N,b.y-E);break;case"to-bottom-left":case"to-left-bottom":s=t.createLinearGradient(b.x+N,b.y-E,b.x-N,b.y+E);break;case"to-top-left":case"to-left-top":s=t.createLinearGradient(b.x+N,b.y+E,b.x-N,b.y-E);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};Jr.gradientFillStyle=function(t,e,r,n){var i=this.createGradientStyleFor(t,"background",e,r,n);if(!i)return null;t.fillStyle=i};Jr.colorFillStyle=function(t,e,r,n,i){t.fillStyle="rgba("+e+","+r+","+n+","+i+")"};Jr.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)}};Jr.gradientStrokeStyle=function(t,e,r,n){var i=this.createGradientStyleFor(t,"line",e,r,n);if(!i)return null;t.strokeStyle=i};Jr.colorStrokeStyle=function(t,e,r,n,i){t.strokeStyle="rgba("+e+","+r+","+n+","+i+")"};Jr.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)}};Jr.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 d=r.canvasContainer;d.style.width=i+"px",d.style.height=s+"px";for(var g=0;g<e.CANVAS_LAYERS;g++)c=r.canvases[g],c.width=l,c.height=u,c.style.width=i+"px",c.style.height=s+"px";for(var g=0;g<e.BUFFER_COUNT;g++)c=r.bufferCanvases[g],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}};Jr.renderTo=function(t,e,r,n){this.render({forcedContext:t,forcedZoom:e,forcedPan:r,drawAllLayers:!0,forcedPxRatio:n})};Jr.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])};Jr.render=function(t){var e=this;t=t||Xw();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,d=e.textureOnViewport&&!n&&(e.pinching||e.hoverData.dragging||e.swipePanning||e.data.wheelZooming),g=t.motionBlur!==void 0?t.motionBlur:e.motionBlur,f=e.motionBlurPxRatio,y=r.hasCompoundNodes(),_=e.hoverData.draggingEles,v=!!(e.hoverData.selecting||e.touchData.selecting);g=g&&!n&&e.motionBlurEnabled&&!v;var m=g;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),g&&(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&&!d&&(c[e.NODE]=!0,c[e.SELECT_BOX]=!0);var x=r.style(),b=r.zoom(),S=o!==void 0?o:b,T=r.pan(),N={x:T.x,y:T.y},E={zoom:b,pan:{x:T.x,y:T.y}},k=e.prevViewport,L=k===void 0||E.zoom!==k.zoom||E.pan.x!==k.pan.x||E.pan.y!==k.pan.y;!L&&!(_&&!y)&&(e.motionBlurPxRatio=1),a&&(N=a),S*=l,N.x*=l,N.y*=l;var A=e.getCachedZSortedEles();function I(Y,K,ee,re,ue){var pe=Y.globalCompositeOperation;Y.globalCompositeOperation="destination-out",e.colorFillStyle(Y,255,255,255,e.motionBlurTransparency),Y.fillRect(K,ee,re,ue),Y.globalCompositeOperation=pe}function O(Y,K){var ee,re,ue,pe;!e.clearingMotionBlur&&(Y===u.bufferContexts[e.MOTIONBLUR_BUFFER_NODE]||Y===u.bufferContexts[e.MOTIONBLUR_BUFFER_DRAG])?(ee={x:T.x*f,y:T.y*f},re=b*f,ue=e.canvasWidth*f,pe=e.canvasHeight*f):(ee=N,re=S,ue=e.canvasWidth,pe=e.canvasHeight),Y.setTransform(1,0,0,1,0,0),K==="motionBlur"?I(Y,0,0,ue,pe):!n&&(K===void 0||K)&&Y.clearRect(0,0,ue,pe),i||(Y.translate(ee.x,ee.y),Y.scale(re,re)),a&&Y.translate(a.x,a.y),o&&Y.scale(o,o)}if(d||(e.textureDrawLastFrame=!1),d){if(e.textureDrawLastFrame=!0,!e.textureCache){e.textureCache={},e.textureCache.bb=r.mutableElements().boundingBox(),e.textureCache.texture=e.data.bufferCanvases[e.TEXTURE_BUFFER];var 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 E=e.textureCache.viewport={zoom:r.zoom(),pan:r.pan(),width:e.canvasWidth,height:e.canvasHeight};E.mpan={x:(0-E.pan.x)/E.zoom,y:(0-E.pan.y)/E.zoom}}c[e.DRAG]=!1,c[e.NODE]=!1;var D=u.contexts[e.NODE],M=e.textureCache.texture,E=e.textureCache.viewport;D.setTransform(1,0,0,1,0,0),g?I(D,0,0,E.width,E.height):D.clearRect(0,0,E.width,E.height);var U=x.core("outside-texture-bg-color").value,H=x.core("outside-texture-bg-opacity").value;e.colorFillStyle(D,U[0],U[1],U[2],H),D.fillRect(0,0,E.width,E.height);var b=r.zoom();O(D,!1),D.clearRect(E.mpan.x,E.mpan.y,E.width/E.zoom/l,E.height/E.zoom/l),D.drawImage(M,E.mpan.x,E.mpan.y,E.width/E.zoom/l,E.height/E.zoom/l)}else e.textureOnViewport&&!n&&(e.textureCache=null);var $=r.extent(),F=e.pinching||e.hoverData.dragging||e.swipePanning||e.data.wheelZooming||e.hoverData.draggingEles||e.cy.animated(),P=e.hideEdgesOnViewport&&F,z=[];if(z[e.NODE]=!c[e.NODE]&&g&&!e.clearedForMotionBlur[e.NODE]||e.clearingMotionBlur,z[e.NODE]&&(e.clearedForMotionBlur[e.NODE]=!0),z[e.DRAG]=!c[e.DRAG]&&g&&!e.clearedForMotionBlur[e.DRAG]||e.clearingMotionBlur,z[e.DRAG]&&(e.clearedForMotionBlur[e.DRAG]=!0),c[e.NODE]||i||s||z[e.NODE]){var G=g&&!z[e.NODE]&&f!==1,D=n||(G?e.data.bufferContexts[e.MOTIONBLUR_BUFFER_NODE]:u.contexts[e.NODE]),V=g&&!G?"motionBlur":void 0;O(D,V),P?e.drawCachedNodes(D,A.nondrag,l,$):e.drawLayeredElements(D,A.nondrag,l,$),e.debug&&e.drawDebugPoints(D,A.nondrag),!i&&!g&&(c[e.NODE]=!1)}if(!s&&(c[e.DRAG]||i||z[e.DRAG])){var G=g&&!z[e.DRAG]&&f!==1,D=n||(G?e.data.bufferContexts[e.MOTIONBLUR_BUFFER_DRAG]:u.contexts[e.DRAG]);O(D,g&&!G?"motionBlur":void 0),P?e.drawCachedNodes(D,A.drag,l,$):e.drawCachedElements(D,A.drag,l,$),e.debug&&e.drawDebugPoints(D,A.drag),!i&&!g&&(c[e.DRAG]=!1)}if(this.drawSelectionRectangle(t,O),g&&f!==1){var te=u.contexts[e.NODE],ie=e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_NODE],ne=u.contexts[e.DRAG],X=e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_DRAG],q=function(K,ee,re){K.setTransform(1,0,0,1,0,0),re||!m?K.clearRect(0,0,e.canvasWidth,e.canvasHeight):I(K,0,0,e.canvasWidth,e.canvasHeight);var ue=f;K.drawImage(ee,0,0,e.canvasWidth*ue,e.canvasHeight*ue,0,0,e.canvasWidth,e.canvasHeight)};(c[e.NODE]||z[e.NODE])&&(q(te,ie,z[e.NODE]),c[e.NODE]=!1),(c[e.DRAG]||z[e.DRAG])&&(q(ne,X,z[e.DRAG]),c[e.DRAG]=!1)}e.prevViewport=E,e.clearingMotionBlur&&(e.clearingMotionBlur=!1,e.motionBlurCleared=!0,e.motionBlur=!0),g&&(e.motionBlurTimeout=setTimeout(function(){e.motionBlurTimeout=null,e.clearedForMotionBlur[e.NODE]=!1,e.clearedForMotionBlur[e.DRAG]=!1,e.motionBlur=!1,e.clearingMotionBlur=!d,e.mbFrames=0,c[e.NODE]=!0,c[e.DRAG]=!0,e.redraw()},UD)),n||r.emit("render")};var Vo;Jr.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 d=r.cy.zoom(),g=s.core("selection-box-border-width").value/d;c.lineWidth=g,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]),g>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 d=r.cy.zoom(),f=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(f.x,f.y,s.core("active-bg-size").pfValue/d,0,2*Math.PI),c.fill()}var y=r.lastRedrawTime;if(r.showFps&&y){y=Math.round(y);var _=Math.round(1e3/y),v="1 frame = "+y+" ms = "+_+" 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(v);Vo=m.actualBoundingBoxAscent}c.fillText(v,0,Vo);var x=60;c.strokeRect(0,Vo+10,250,20),c.fillRect(0,Vo+10,250*Math.min(_/x,1),20)}a||(l[r.SELECT_BOX]=!1)}};function rb(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 $D(t,e,r){var n=rb(t,t.VERTEX_SHADER,e),i=rb(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 WD(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 kv(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 VD(t){var e=t.pixelRatio,r=t.cy.zoom();return r*e}function GD(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 qD(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 YD(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 Da(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 Rs(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 KD(t){return t[0]+(t[1]<<8)+(t[2]<<16)+(t[3]<<24)}function XD(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 d2(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 h2(t,e,r){switch(e){case t.FLOAT:return new Float32Array(r);case t.INT:return new Int32Array(r)}}function QD(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 ZD(t,e,r,n){var i=d2(t,e),s=yr(i,2),o=s[0],a=s[1],l=h2(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=d2(t,r),s=yr(i,3),o=s[0],a=s[1],l=s[2],u=h2(t,a,e*o),c=o*l,d=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,d),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 g=new Array(e),f=0;f<e;f++)g[f]=QD(t,a,u,c,o,f);return d.dataArray=u,d.stride=c,d.size=o,d.getView=function(y){return g[y]},d.setPoint=function(y,_,v){var m=g[y];m[0]=_,m[1]=v},d.bufferSubData=function(y){t.bindBuffer(t.ARRAY_BUFFER,d),y?t.bufferSubData(t.ARRAY_BUFFER,0,u,0,y*o):t.bufferSubData(t.ARRAY_BUFFER,0,u)},d}function JD(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(d){return s[d]},l.setData=function(d,g){s[g].set(d,0)},l.bufferSubData=function(){t.bindBuffer(t.ARRAY_BUFFER,l),t.bufferSubData(t.ARRAY_BUFFER,0,i)},l}function eA(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 nb=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 Bp(){var t=new nb(9);return nb!=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 ib(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 tA(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],d=e[8],g=r[0],f=r[1],y=r[2],_=r[3],v=r[4],m=r[5],x=r[6],b=r[7],S=r[8];return t[0]=g*n+f*o+y*u,t[1]=g*i+f*a+y*c,t[2]=g*s+f*l+y*d,t[3]=_*n+v*o+m*u,t[4]=_*i+v*a+m*c,t[5]=_*s+v*l+m*d,t[6]=x*n+b*o+S*u,t[7]=x*i+b*a+S*c,t[8]=x*s+b*l+S*d,t}function Ec(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],d=e[8],g=r[0],f=r[1];return t[0]=n,t[1]=i,t[2]=s,t[3]=o,t[4]=a,t[5]=l,t[6]=g*n+f*o+u,t[7]=g*i+f*a+c,t[8]=g*s+f*l+d,t}function ab(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],d=e[8],g=Math.sin(r),f=Math.cos(r);return t[0]=f*n+g*o,t[1]=f*i+g*a,t[2]=f*s+g*l,t[3]=f*o-g*n,t[4]=f*a-g*i,t[5]=f*l-g*s,t[6]=u,t[7]=c,t[8]=d,t}function Pg(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 rA(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 nA=(function(){function t(e,r,n,i){la(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 ua(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,d=u.texW,g=u.texH,f=function(b,S){if(i&&S){var T=S.context,N=b.x,E=b.row,k=N,L=l*E;T.save(),T.translate(k,L),T.scale(c,c),i(T,n),T.restore()}},y=[null,null],_=function(){f(s.freePointer,s.canvas),y[0]={x:s.freePointer.x,y:s.freePointer.row*l,w:d,h:g},y[1]={x:s.freePointer.x+d,y:s.freePointer.row*l,w:0,h:g},s.freePointer.x+=d,s.freePointer.x==o&&(s.freePointer.x=0,s.freePointer.row++)},v=function(){var b=s.scratch,S=s.canvas;b.clear(),f({x:0,row:0},b);var T=o-s.freePointer.x,N=d-T,E=l;{var k=s.freePointer.x,L=s.freePointer.row*l,A=T;S.context.drawImage(b,0,0,A,E,k,L,A,E),y[0]={x:k,y:L,w:A,h:g}}{var I=T,O=(s.freePointer.row+1)*l,B=N;S&&S.context.drawImage(b,I,0,B,E,0,O,B,E),y[1]={x:0,y:O,w:B,h:g}}s.freePointer.x=N,s.freePointer.row++},m=function(){s.freePointer.x=0,s.freePointer.row++};if(this.freePointer.x+d<=o)_();else{if(this.freePointer.row>=a-1)return!1;this.freePointer.x===o?(m(),_()):this.enableWrapping?v():(m(),_())}return this.keyToLocation.set(r,y),this.needsBuffer=!0,y}},{key:"getOffsets",value:function(r){return this.keyToLocation.get(r)}},{key:"isEmpty",value:function(){return this.freePointer.x===0&&this.freePointer.row===0}},{key:"canFit",value:function(r){if(this.locked)return!1;var n=this.texSize,i=this.texRows,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=XD(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}}])})(),iA=(function(){function t(e,r,n,i){la(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 ua(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 nA(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=un(this.atlases),l;try{var u=function(){var d=l.value,g=d.getKeys(),f=aA(n,g);if(f.size===0)return i.push(d),g.forEach(function(T){return s.set(T,d)}),1;o||(o=r._createAtlas(),i.push(o));var y=un(g),_;try{for(y.s();!(_=y.n()).done;){var v=_.value;if(!f.has(v)){var m=d.getOffsets(v),x=yr(m,2),b=x[0],S=x[1];o.canFit({w:b.w+S.w,h:b.h})||(o.lock(),o=r._createAtlas(),i.push(o)),d.canvas&&(r._copyTextureToNewAtlas(v,d,o),s.set(v,o))}}}catch(T){y.e(T)}finally{y.f()}d.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=yr(s,2),a=o[0],l=o[1];if(l.w===0)i.draw(r,a,function(g){g.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,d=a.h;i.draw(r,{w:c,h:d},function(g){g.drawImage(u,0,0,c,d,0,0,c,d)})}}},{key:"getCounts",value:function(){return{keyCount:this.styleKeyToAtlas.size,atlasCount:new Set(this.styleKeyToAtlas.values()).size}}}])})();function aA(t,e){return t.intersection?t.intersection(e):new Set(Dc(t).filter(function(r){return e.has(r)}))}var sA=(function(){function t(e,r){la(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 ua(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 iA(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=vt({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,d=!1,g=!1,f=un(r),y;try{for(f.s();!(y=f.n()).done;){var _=y.value;if(l(_)){var v=un(this.renderTypes.values()),m;try{var x=function(){var S=m.value,T=S.type;if(c(T)){var N=n.collections.get(S.collection),E=S.getKey(_),k=Array.isArray(E)?E:[E];if(o)k.forEach(function(O){return N.markKeyForGC(O)}),g=!0;else{var L=S.getID?S.getID(_):_.id(),A=n._key(T,L),I=n.typeAndIdToKey.get(A);I!==void 0&&!YD(k,I)&&(d=!0,n.typeAndIdToKey.delete(A),I.forEach(function(O){return N.markKeyForGC(O)}))}}};for(v.s();!(m=v.n()).done;)x()}catch(b){v.e(b)}finally{v.f()}}}}catch(b){f.e(b)}finally{f.f()}return g&&(this.gc(),d=!1),d}},{key:"gc",value:function(){var r=un(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(g){o.drawClipped?(g.save(),g.beginPath(),g.rect(0,0,i.w,i.h),g.clip(),o.drawElement(g,r,i,!0,!0),g.restore()):o.drawElement(g,r,i,!0,!0),l=!0});if(l){var c=o.getID?o.getID(r):r.id(),d=this._key(n,c);this.typeAndIdToKey.has(d)?this.typeAndIdToKey.get(d).push(s):this.typeAndIdToKey.set(d,[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),d=c.getOffsets(l),g=yr(d,2),f=g[0],y=g[1];return{atlas:c,tex:f,tex1:f,tex2:y,bb:u}})}},{key:"getDebugInfo",value:function(){var r=[],n=un(this.collections),i;try{for(n.s();!(i=n.n()).done;){var s=yr(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(d){n.e(d)}finally{n.f()}return r}}])})(),oA=(function(){function t(e){la(this,t),this.globalOptions=e,this.atlasSize=e.webglTexSize,this.maxAtlasesPerBatch=e.webglTexPerBatch,this.batchAtlases=[]}return ua(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}}])})(),lA=`
|
|
62
|
-
float circleSD(vec2 p, float r) {
|
|
63
|
-
return distance(vec2(0), p) - r; // signed distance
|
|
64
|
-
}
|
|
65
|
-
`,uA=`
|
|
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
|
-
`,cA=`
|
|
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
|
-
`,dA=`
|
|
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
|
-
`,ol={SCREEN:{name:"screen",screen:!0},PICKING:{name:"picking",picking:!0}},$c={IGNORE:1,USE_BB:2},jp=0,sb=1,ob=2,Fp=3,Ls=4,oc=5,Go=6,qo=7,hA=(function(){function t(e,r,n){la(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=WD,this.atlasManager=new sA(e,n),this.batchManager=new oA(n),this.simpleShapeOptions=new Map,this.program=this._createShaderProgram(ol.SCREEN),this.pickingProgram=this._createShaderProgram(ol.PICKING),this.vao=this._createVAO()}return ua(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(jp,`) {
|
|
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(Ls," || aVertType == ").concat(qo,`
|
|
163
|
-
|| aVertType == `).concat(oc," || aVertType == ").concat(Go,`) { // 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(sb,`) {
|
|
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(ob,`) {
|
|
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(Fp,` && 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(lA,`
|
|
288
|
-
`).concat(uA,`
|
|
289
|
-
`).concat(cA,`
|
|
290
|
-
`).concat(dA,`
|
|
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(jp,`) {
|
|
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(Fp,`) {
|
|
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(Ls,` && 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(Ls," || vVertType == ").concat(qo,`
|
|
320
|
-
|| vVertType == `).concat(oc," || vVertType == ").concat(Go,`) { // 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(Ls,`) {
|
|
332
|
-
d = rectangleSD(p, b);
|
|
333
|
-
} else if(vVertType == `).concat(qo,` && w == h) {
|
|
334
|
-
d = circleSD(p, b.x); // faster than ellipse
|
|
335
|
-
} else if(vVertType == `).concat(qo,`) {
|
|
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=$D(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),ZD(i,"vec2",s.aPosition,r),this.transformBuffer=JD(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 Ki(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]:ol.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===$c.IGNORE)return;if(l==$c.USE_BB){this.drawPickingRectangle(r,n,i);return}}var u=s.getAtlasInfo(r,i),c=un(u),d;try{for(c.s();!(d=c.n()).done;){var g=d.value,f=g.atlas,y=g.tex1,_=g.tex2;o.canAddToCurrentBatch(f)||this.endBatch();for(var v=o.getAtlasIndexForBatch(f),m=0,x=[[y,!0],[_,!1]];m<x.length;m++){var b=yr(x[m],2),S=b[0],T=b[1];if(S.w!=0){var N=this.instanceCount;this.vertTypeBuffer.getView(N)[0]=jp;var E=this.indexBuffer.getView(N);Rs(n,E);var k=this.atlasIdBuffer.getView(N);k[0]=v;var L=this.texBuffer.getView(N);L[0]=S.x,L[1]=S.y,L[2]=S.w,L[3]=S.h;var A=this.transformBuffer.getMatrixView(N);this.setTransformMatrix(r,A,a,g,T),this.instanceCount++,T||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,d=u.w/(u.w+c.w);o||(d=1-d);var g=this._getAdjustedBB(l,a,o,d);this._applyTransformMatrix(n,g,i,r)}else{var f=i.getBoundingBox(r),y=this._getAdjustedBB(f,a,!0,1);this._applyTransformMatrix(n,y,i,r)}}},{key:"_applyTransformMatrix",value:function(r,n,i,s){var o,a;ib(r);var l=i.getRotation?i.getRotation(s):0;if(l!==0){var u=i.getRotationPoint(s),c=u.x,d=u.y;Ec(r,r,[c,d]),ab(r,r,l);var g=i.getRotationOffset(s);o=g.x+(n.xOffset||0),a=g.y+(n.yOffset||0)}else o=n.x1,a=n.y1;Ec(r,r,[o,a]),Pg(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 d=0,g=l*s;return i&&s<1?l=g:!i&&s<1&&(d=l-g,o+=d,l=g),{x1:o,y1:a,w:l,h:u,xOffset:d,yOffset:c}}},{key:"drawPickingRectangle",value:function(r,n,i){var s=this.atlasManager.getRenderTypeOpts(i),o=this.instanceCount;this.vertTypeBuffer.getView(o)[0]=Ls;var a=this.indexBuffer.getView(o);Rs(n,a);var l=this.colorBuffer.getView(o);Da([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===oc||a===Go){var u=s.getBoundingBox(r),c=this._getCornerRadius(r,o.radius,u),d=this.cornerRadiusBuffer.getView(l);d[0]=c,d[1]=c,d[2]=c,d[3]=c,a===Go&&(d[0]=0,d[2]=0)}var g=this.indexBuffer.getView(l);Rs(n,g);var f=this.renderTarget.picking?1:i==="node-body"?r.effectiveOpacity():1,y=this.renderTarget.picking?1:r.pstyle(o.opacity).value*f,_=r.pstyle(o.color).value,v=this.colorBuffer.getView(l);Da(_,y,v);var m=this.lineWidthBuffer.getView(l);if(m[0]=0,m[1]=0,o.border){var x=r.pstyle("border-width").value;if(x>0){var b=r.pstyle("border-color").value,S=f*r.pstyle("border-opacity").value,T=this.borderColorBuffer.getView(l);Da(b,S,T);var N=r.pstyle("border-position").value;if(N==="inside")m[0]=0,m[1]=-x;else if(N==="outside")m[0]=x,m[1]=0;else{var E=x/2;m[0]=E,m[1]=-E}}}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 Ls;case"ellipse":return qo;case"roundrectangle":case"round-rectangle":return oc;case"bottom-round-rectangle":return Go;default:return}}},{key:"_getCornerRadius",value:function(r,n,i){var s=i.w,o=i.h;if(r.pstyle(n).value==="auto")return ra(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,d=r.pstyle("opacity").value,g=r.pstyle("line-opacity").value,f=d*g,y=r.pstyle("width").pfValue,_=r.pstyle("arrow-scale").value,v=this.r.getArrowWidth(y,_),m=this.instanceCount,x=this.transformBuffer.getMatrixView(m);ib(x),Ec(x,x,[o,a]),Pg(x,x,[v,v]),ab(x,x,l),this.vertTypeBuffer.getView(m)[0]=Fp;var b=this.indexBuffer.getView(m);Rs(n,b);var S=this.colorBuffer.getView(m);Da(c,f,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]=sb;var d=this.indexBuffer.getView(c);Rs(n,d);var g=this.colorBuffer.getView(c);Da(l,u,g);var f=this.lineWidthBuffer.getView(c);f[0]=a;var y=this.pointAPointBBuffer.getView(c);y[0]=i[0],y[1]=i[1],y[2]=i[2],y[3]=i[3],this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}else for(var _=0;_<i.length-2;_+=2){var v=this.instanceCount;this.vertTypeBuffer.getView(v)[0]=ob;var m=this.indexBuffer.getView(v);Rs(n,m);var x=this.colorBuffer.getView(v);Da(l,u,x);var b=this.lineWidthBuffer.getView(v);b[0]=a;var S=i[_-2],T=i[_-1],N=i[_],E=i[_+1],k=i[_+2],L=i[_+3],A=i[_+4],I=i[_+5];_==0&&(S=2*N-k+.001,T=2*E-L+.001),_==i.length-4&&(A=2*k-N+.001,I=2*L-E+.001);var O=this.pointAPointBBuffer.getView(v);O[0]=S,O[1]=T,O[2]=N,O[3]=E;var B=this.pointCPointDBuffer.getView(v);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=un(this.buffers),l;try{for(a.s();!(l=a.n()).done;){var u=l.value;u.bufferSubData(s)}}catch(y){a.e(y)}finally{a.f()}for(var c=this.batchManager.getAtlases(),d=0;d<c.length;d++)c[d].bufferIfNeeded(r);for(var g=0;g<c.length;g++)r.activeTexture(r.TEXTURE0+g),r.bindTexture(r.TEXTURE_2D,c[g].texture),r.uniform1i(o.uTextures[g],g);r.uniform1f(o.uZoom,VD(this.r)),r.uniformMatrix3fv(o.uPanZoomMatrix,!1,this.panZoomMatrix),r.uniform1i(o.uAtlasSize,this.batchManager.getAtlasSize());var f=Da(this.bgColor,1);r.uniform4fv(o.uBGColor,f),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}}}])})(),f2={};f2.initWebgl=function(t,e){var r=this,n=r.data.contexts[r.WEBGL];t.bgColor=fA(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=eA(n),r.pickingFrameBuffer.needsDraw=!0,r.drawing=new hA(r,n,t);var i=function(d){return function(g){return r.getTextAngle(g,d)}},s=function(d){return function(g){var f=g.pstyle(d);return f&&f.value}},o=function(d){return function(g){return g.pstyle("".concat(d,"-opacity")).value>0}},a=function(d){var g=d.pstyle("text-events").strValue==="yes";return g?$c.USE_BB:$c.IGNORE},l=function(d){var g=d.position(),f=g.x,y=g.y,_=d.outerWidth(),v=d.outerHeight();return{w:_,h:v,x1:f-_/2,y1:y-v/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:qD,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:zp(e.getLabelKey,null),getBoundingBox:Hp(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:zp(e.getSourceLabelKey,"source"),getBoundingBox:Hp(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:zp(e.getTargetLabelKey,"target"),getBoundingBox:Hp(e.getTargetLabelBox,"target"),drawClipped:!0,drawElement:e.drawTargetLabel,getRotation:i("target"),getRotationPoint:e.getTargetLabelRotationPoint,getRotationOffset:e.getTargetLabelRotationOffset,isVisible:s("target-label")});var u=Ll(function(){console.log("garbage collect flag set"),r.data.gc=!0},1e4);r.onUpdateEleCalcs(function(c,d){var g=!1;d&&d.length>0&&(g|=r.drawing.invalidate(d)),g&&u()}),pA(r)};function fA(t){var e=t.cy.container(),r=e&&e.style&&e.style.backgroundColor||"white";return Fw(r)}function p2(t,e){var r=t._private.rscratch;return Xr(r,"labelWrapCachedLines",e)||[]}var zp=function(e,r){return function(n){var i=e(n),s=p2(n,r);return s.length>1?s.map(function(o,a){return"".concat(i,"_").concat(a)}):i}},Hp=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=p2(n,r),u=s.h/l.length,c=u*a,d=s.y1+c;return{x1:s.x1,w:s.w,y1:d,h:u,yOffset:c}}}return s}};function pA(t){{var e=t.render;t.render=function(s){s=s||{};var o=t.cy;t.webgl&&(o.zoom()>s2?(gA(t),e.call(t,s)):(vA(t),v2(t,s,ol.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 _A(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 gA(t){var e=t.data.contexts[t.WEBGL];e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT)}function vA(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 mA(t){var e=t.canvasWidth,r=t.canvasHeight,n=kv(t),i=n.pan,s=n.zoom,o=Bp();Ec(o,o,[i.x,i.y]),Pg(o,o,[s,s]);var a=Bp();rA(a,e,r);var l=Bp();return tA(l,a,o),l}function g2(t,e){var r=t.canvasWidth,n=t.canvasHeight,i=kv(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 yA(t,e){t.drawSelectionRectangle(e,function(r){return g2(t,r)})}function xA(t){var e=t.data.contexts[t.NODE];e.save(),g2(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 bA(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 d=u[c],g=d.canvas;if(g){var f=g.width,y=g.height,_=f*c,v=g.height*o,m=.4;l.save(),l.scale(m,m),l.drawImage(g,_,v),l.strokeStyle="black",l.rect(_,v,f,y),l.stroke(),l.restore()}}},r=0;e(t.drawing,"node",r++),e(t.drawing,"label",r++)}function wA(t,e,r,n,i){var s,o,a,l,u=kv(t),c=u.pan,d=u.zoom;{var g=GD(t,c,d,e,r),f=yr(g,2),y=f[0],_=f[1],v=6;s=y-v/2,o=_-v/2,a=v,l=v}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),v2(t,null,ol.PICKING),t.pickingFrameBuffer.needsDraw=!1);var x=a*l,b=new Uint8Array(x*4);m.readPixels(s,o,a,l,m.RGBA,m.UNSIGNED_BYTE,b),m.bindFramebuffer(m.FRAMEBUFFER,null);for(var S=new Set,T=0;T<x;T++){var N=b.slice(T*4,T*4+4),E=KD(N)-1;E>=0&&S.add(E)}return S}function _A(t,e,r){var n=wA(t,e,r),i=t.getCachedZSortedEles(),s,o,a=un(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(d){a.e(d)}finally{a.f()}return[s,o].filter(Boolean)}function Up(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 v2(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]&&yA(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=mA(t),l=t.getCachedZSortedEles();if(s=l.length,i.startFrame(a,r),r.screen){for(var u=0;u<l.nondrag.length;u++)Up(t,u,l.nondrag[u]);for(var c=0;c<l.drag.length;c++)Up(t,c,l.drag[c])}else if(r.picking)for(var d=0;d<l.length;d++)Up(t,d,l[d]);i.endFrame(),r.screen&&t.webglDebugShowAtlases&&(xA(t),bA(t)),t.data.canvasNeedsRedraw[t.NODE]=!1,t.data.canvasNeedsRedraw[t.DRAG]=!1}if(t.webglDebug){var g=performance.now(),f=!1,y=Math.ceil(g-n),_=i.getDebugInfo(),v=["".concat(s," elements"),"".concat(_.totalInstances," instances"),"".concat(_.batchCount," batches"),"".concat(_.totalAtlases," atlases"),"".concat(_.wrappedCount," wrapped textures"),"".concat(_.simpleCount," simple shapes")].join(", ");if(f)console.log("WebGL (".concat(r.name,") - time ").concat(y,"ms, ").concat(v));else{console.log("WebGL (".concat(r.name,") - frame time ").concat(y,"ms")),console.log("Totals:"),console.log(" ".concat(v)),console.log("Texture Atlases Used:");var m=_.atlasInfo,x=un(m),b;try{for(x.s();!(b=x.n()).done;){var S=b.value;console.log(" ".concat(S.type,": ").concat(S.keyCount," keys, ").concat(S.atlasCount," atlases"))}}catch(T){x.e(T)}finally{x.f()}console.log("")}}t.data.gc&&(console.log("Garbage Collect!"),t.data.gc=!1,i.gc())}var ha={};ha.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()};ha.drawRoundPolygonPath=function(t,e,r,n,i,s,o){o.forEach(function(a){return X_(t,a)}),t.closePath()};ha.drawRoundRectanglePath=function(t,e,r,n,i,s){var o=n/2,a=i/2,l=s==="auto"?ra(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()};ha.drawBottomRoundRectanglePath=function(t,e,r,n,i,s){var o=n/2,a=i/2,l=s==="auto"?ra(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()};ha.drawCutRectanglePath=function(t,e,r,n,i,s,o){var a=n/2,l=i/2,u=o==="auto"?dv():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()};ha.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,d=xg(n,i),g=d.widthOffset,f=d.heightOffset,y=d.ctrlPtOffsetPct*g;t.beginPath&&t.beginPath(),t.moveTo(a,u+f),t.lineTo(a,c-f),t.quadraticCurveTo(a+y,c,a+g,c),t.lineTo(l-g,c),t.quadraticCurveTo(l-y,c,l,c-f),t.lineTo(l,u+f),t.quadraticCurveTo(l-y,u,l-g,u),t.lineTo(a+g,u),t.quadraticCurveTo(a+y,u,a,u+f),t.closePath()};var lb=Math.sin(0),ub=Math.cos(0),Mg={},Ig={},m2=Math.PI/40;for(var Ds=0*Math.PI;Ds<2*Math.PI;Ds+=m2)Mg[Ds]=Math.sin(Ds),Ig[Ds]=Math.cos(Ds);ha.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+=m2)s=e-a*Mg[u]*lb+a*Ig[u]*ub,o=r+l*Ig[u]*lb+l*Mg[u]*ub,u===0?t.moveTo(s,o):t.lineTo(s,o);t.closePath()};var Ol={};Ol.createBuffer=function(t,e){var r=document.createElement("canvas");return r.width=t,r.height=e,[r,r.getContext("2d")]};Ol.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,d=1/0;Ke(t.maxWidth)&&(c=u*t.maxWidth/s),Ke(t.maxHeight)&&(d=u*t.maxHeight/o),u=Math.min(c,d),s*=u,o*=u}a||(s*=l,o*=l,u*=l);var g=document.createElement("canvas");g.width=s,g.height=o,g.style.width=s+"px",g.style.height=o+"px";var f=g.getContext("2d");if(s>0&&o>0){f.clearRect(0,0,s,o),f.globalCompositeOperation="source-over";var y=this.getCachedZSortedEles();if(t.full)f.translate(-n.x1*u,-n.y1*u),f.scale(u,u),this.drawElements(f,y),f.scale(1/u,1/u),f.translate(n.x1*u,n.y1*u);else{var _=e.pan(),v={x:_.x*u,y:_.y*u};u*=e.zoom(),f.translate(v.x,v.y),f.scale(u,u),this.drawElements(f,y),f.scale(1/u,1/u),f.translate(-v.x,-v.y)}t.bg&&(f.globalCompositeOperation="destination-over",f.fillStyle=t.bg,f.rect(0,0,s,o),f.fill())}return g};function SA(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 cb(t){var e=t.indexOf(",");return t.substr(e+1)}function y2(t,e,r){var n=function(){return e.toDataURL(r,t.quality)};switch(t.output){case"blob-promise":return new Zs(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 SA(cb(n()),r);case"base64":return cb(n());case"base64uri":default:return n()}}Ol.png=function(t){return y2(t,this.bufferCanvasImage(t),"image/png")};Ol.jpg=function(t){return y2(t,this.bufferCanvasImage(t),"image/jpeg")};var x2={};x2.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 CA=b2,wt=b2.prototype;wt.CANVAS_LAYERS=3;wt.SELECT_BOX=0;wt.DRAG=1;wt.NODE=2;wt.WEBGL=3;wt.CANVAS_TYPES=["2d","2d","2d","webgl2"];wt.BUFFER_COUNT=3;wt.TEXTURE_BUFFER=0;wt.MOTIONBLUR_BUFFER_NODE=1;wt.MOTIONBLUR_BUFFER_DRAG=2;function b2(t){var e=this,r=e.cy.window(),n=r.document;t.webgl&&(wt.CANVAS_LAYERS=e.CANVAS_LAYERS=4,console.log("webgl rendering enabled")),e.data={canvases:new Array(wt.CANVAS_LAYERS),contexts:new Array(wt.CANVAS_LAYERS),canvasNeedsRedraw:new Array(wt.CANVAS_LAYERS),bufferCanvases:new Array(wt.BUFFER_COUNT),bufferContexts:new Array(wt.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"};p3()&&(l["-ms-touch-action"]="none",l["touch-action"]="none");for(var u=0;u<wt.CANVAS_LAYERS;u++){var c=e.data.canvases[u]=n.createElement("canvas"),d=wt.CANVAS_TYPES[u];e.data.contexts[u]=c.getContext(d),e.data.contexts[u]||ir("Could not create canvas of type "+d),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(wt.CANVAS_LAYERS-u),e.data.canvasContainer.appendChild(c),e.data.canvasNeedsRedraw[u]=!1}e.data.topCanvas=e.data.canvases[0],e.data.canvases[wt.NODE].setAttribute("data-id","layer"+wt.NODE+"-node"),e.data.canvases[wt.SELECT_BOX].setAttribute("data-id","layer"+wt.SELECT_BOX+"-selectbox"),e.data.canvases[wt.DRAG].setAttribute("data-id","layer"+wt.DRAG+"-drag"),e.data.canvases[wt.WEBGL]&&e.data.canvases[wt.WEBGL].setAttribute("data-id","layer"+wt.WEBGL+"-webgl");for(var u=0;u<wt.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 g=Zr(),f=function(K){return{x:(K.x1+K.x2)/2,y:(K.y1+K.y2)/2}},y=function(K){return{x:-K.w/2,y:-K.h/2}},_=function(K){var ee=K[0]._private,re=ee.oldBackgroundTimestamp===ee.backgroundTimestamp;return!re},v=function(K){return K[0]._private.nodeKey},m=function(K){return K[0]._private.labelStyleKey},x=function(K){return K[0]._private.sourceLabelStyleKey},b=function(K){return K[0]._private.targetLabelStyleKey},S=function(K,ee,re,ue,pe){return e.drawElement(K,ee,re,!1,!1,pe)},T=function(K,ee,re,ue,pe){return e.drawElementText(K,ee,re,ue,"main",pe)},N=function(K,ee,re,ue,pe){return e.drawElementText(K,ee,re,ue,"source",pe)},E=function(K,ee,re,ue,pe){return e.drawElementText(K,ee,re,ue,"target",pe)},k=function(K){return K.boundingBox(),K[0]._private.bodyBounds},L=function(K){return K.boundingBox(),K[0]._private.labelBounds.main||g},A=function(K){return K.boundingBox(),K[0]._private.labelBounds.source||g},I=function(K){return K.boundingBox(),K[0]._private.labelBounds.target||g},O=function(K,ee){return ee},B=function(K){return f(k(K))},D=function(K,ee,re){var ue=K?K+"-":"";return{x:ee.x+re.pstyle(ue+"text-margin-x").pfValue,y:ee.y+re.pstyle(ue+"text-margin-y").pfValue}},M=function(K,ee,re){var ue=K[0]._private.rscratch;return{x:ue[ee],y:ue[re]}},U=function(K){return D("",M(K,"labelX","labelY"),K)},H=function(K){return D("source",M(K,"sourceLabelX","sourceLabelY"),K)},$=function(K){return D("target",M(K,"targetLabelX","targetLabelY"),K)},F=function(K){return y(k(K))},P=function(K){return y(A(K))},z=function(K){return y(I(K))},G=function(K){var ee=L(K),re=y(L(K));if(K.isNode()){switch(Ys(K.pstyle("text-halign").value)){case"left":re.x=-ee.w-(ee.leftPad||0);break;case"right":re.x=-(ee.rightPad||0);break}switch(Ks(K.pstyle("text-valign").value)){case"top":re.y=-ee.h-(ee.topPad||0);break;case"bottom":re.y=-(ee.botPad||0);break}}return re},V=e.data.eleTxrCache=new nl(e,{getKey:v,doesEleInvalidateKey:_,drawElement:S,getBoundingBox:k,getRotationPoint:B,getRotationOffset:F,allowEdgeTxrCaching:!1,allowParentTxrCaching:!1}),te=e.data.lblTxrCache=new nl(e,{getKey:m,drawElement:T,getBoundingBox:L,getRotationPoint:U,getRotationOffset:G,isVisible:O}),ie=e.data.slbTxrCache=new nl(e,{getKey:x,drawElement:N,getBoundingBox:A,getRotationPoint:H,getRotationOffset:P,isVisible:O}),ne=e.data.tlbTxrCache=new nl(e,{getKey:b,drawElement:E,getBoundingBox:I,getRotationPoint:$,getRotationOffset:z,isVisible:O}),X=e.data.lyrTxrCache=new o2(e);e.onUpdateEleCalcs(function(K,ee){V.invalidateElements(ee),te.invalidateElements(ee),ie.invalidateElements(ee),ne.invalidateElements(ee),X.invalidateElements(ee);for(var re=0;re<ee.length;re++){var ue=ee[re]._private;ue.oldBackgroundTimestamp=ue.backgroundTimestamp}});var q=function(K){for(var ee=0;ee<K.length;ee++)X.enqueueElementRefinement(K[ee].ele)};V.onDequeue(q),te.onDequeue(q),ie.onDequeue(q),ne.onDequeue(q),t.webgl&&e.initWebgl(t,{getStyleKey:v,getLabelKey:m,getSourceLabelKey:x,getTargetLabelKey:b,drawElement:S,drawLabel:T,drawSourceLabel:N,drawTargetLabel:E,getElementBox:k,getLabelBox:L,getSourceLabelBox:A,getTargetLabelBox:I,getElementRotationPoint:B,getElementRotationOffset:F,getLabelRotationPoint:U,getSourceLabelRotationPoint:H,getTargetLabelRotationPoint:$,getLabelRotationOffset:G,getSourceLabelRotationOffset:P,getTargetLabelRotationOffset:z})}wt.redrawHint=function(t,e){var r=this;switch(t){case"eles":r.data.canvasNeedsRedraw[wt.NODE]=e;break;case"drag":r.data.canvasNeedsRedraw[wt.DRAG]=e;break;case"select":r.data.canvasNeedsRedraw[wt.SELECT_BOX]=e;break;case"gc":r.data.gc=!0;break}};var kA=typeof Path2D<"u";wt.path2dEnabled=function(t){if(t===void 0)return this.pathsEnabled;this.pathsEnabled=!!t};wt.usePaths=function(){return kA&&this.pathsEnabled};wt.setImgSmoothing=function(t,e){t.imageSmoothingEnabled!=null?t.imageSmoothingEnabled=e:(t.webkitImageSmoothingEnabled=e,t.mozImageSmoothingEnabled=e,t.msImageSmoothingEnabled=e)};wt.getImgSmoothing=function(t){return t.imageSmoothingEnabled!=null?t.imageSmoothingEnabled:t.webkitImageSmoothingEnabled||t.mozImageSmoothingEnabled||t.msImageSmoothingEnabled};wt.makeOffscreenCanvas=function(t,e){var r;if((typeof OffscreenCanvas>"u"?"undefined":Sr(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};[l2,ii,_i,Cv,Xa,da,Jr,f2,ha,Ol,x2].forEach(function(t){vt(wt,t)});var EA=[{name:"null",impl:q_},{name:"base",impl:i2},{name:"canvas",impl:CA}],TA=[{type:"layout",extensions:XL},{type:"renderer",extensions:EA}],w2={},_2={};function S2(t,e,r){var n=r,i=function(k){zt("Can not register `"+e+"` for `"+t+"` since `"+k+"` already exists in the prototype and can not be overridden")};if(t==="core"){if(bl.prototype[e])return i(e);bl.prototype[e]=r}else if(t==="collection"){if(Mr.prototype[e])return i(e);Mr.prototype[e]=r}else if(t==="layout"){for(var s=function(k){this.options=k,r.call(this,k),Pt(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 E=this.options;if(E&&E.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 d=function(k){return k._private.cy},g={addEventFields:function(k,L){L.layout=k,L.cy=d(k),L.target=k},bubble:function(){return!0},parent:function(k){return d(k)}};vt(o,{createEmitter:function(){return this._private.emitter=new sd(g,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}}),Ft.eventAliasesOn(o),n=s}else if(t==="renderer"&&e!=="null"&&e!=="base"){var f=C2("renderer","base"),y=f.prototype,_=r,v=r.prototype,m=function(){f.apply(this,arguments),_.apply(this,arguments)},x=m.prototype;for(var b in y){var S=y[b],T=v[b]!=null;if(T)return i(b);x[b]=S}for(var N in v)x[N]=v[N];y.clientFunctions.forEach(function(E){x[E]=x[E]||function(){ir("Renderer does not implement `renderer."+E+"()` on its prototype")}}),n=m}else if(t==="__proto__"||t==="constructor"||t==="prototype")return ir(t+" is an illegal type to be registered, possibly lead to prototype pollutions");return zw({map:w2,keys:[t,e],value:n})}function C2(t,e){return Hw({map:w2,keys:[t,e]})}function NA(t,e,r,n,i){return zw({map:_2,keys:[t,e,r,n],value:i})}function RA(t,e,r,n){return Hw({map:_2,keys:[t,e,r,n]})}var Og=function(){if(arguments.length===2)return C2.apply(null,arguments);if(arguments.length===3)return S2.apply(null,arguments);if(arguments.length===4)return RA.apply(null,arguments);if(arguments.length===5)return NA.apply(null,arguments);ir("Invalid extension access syntax")};bl.prototype.extension=Og;TA.forEach(function(t){t.extensions.forEach(function(e){S2(t.type,e.name,e.impl)})});var Wc=function(){if(!(this instanceof Wc))return new Wc;this.length=0},qa=Wc.prototype;qa.instanceString=function(){return"stylesheet"};qa.selector=function(t){var e=this.length++;return this[e]={selector:t,properties:[]},this};qa.css=function(t,e){var r=this.length-1;if(dt(t))this[r].properties.push({name:t,value:e});else if(Pt(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=Rr.properties[o]||Rr.properties[Xc(o)];if(l!=null){var u=l.name,c=a;this[r].properties.push({name:u,value:c})}}}return this};qa.style=qa.css;qa.generateStyle=function(t){var e=new Rr(t);return this.appendToStyle(e)};qa.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 LA="3.34.1",sa=function(e){if(e===void 0&&(e={}),Pt(e))return new bl(e);if(dt(e))return Og.apply(Og,arguments)};sa.use=function(t){var e=Array.prototype.slice.call(arguments,1);return e.unshift(sa),t.apply(null,e),this};sa.warnings=function(t){return Yw(t)};sa.version=LA;sa.stylesheet=sa.Stylesheet=Wc;var Tc={exports:{}},Nc={exports:{}},Rc={exports:{}},DA=Rc.exports,db;function AA(){return db||(db=1,(function(t,e){(function(n,i){t.exports=i()})(DA,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,d,g){s.call(this,g),this.isOverlapingSourceAndTarget=!1,this.vGraphObject=g,this.bendpoints=[],this.source=c,this.target=d}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,d){for(var g=this.getOtherEnd(c),f=d.getGraphManager().getRoot();;){if(g.getOwner()==d)return g;if(g.getOwner()==f)break;g=g.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 d(f,y,_,v){_==null&&v==null&&(v=y),s.call(this,v),f.graphManager!=null&&(f=f.graphManager),this.estimatedSize=o.MIN_VALUE,this.inclusionTreeDepth=o.MAX_VALUE,this.vGraphObject=v,this.edges=[],this.graphManager=f,_!=null&&y!=null?this.rect=new a(y.x,y.y,_.width,_.height):this.rect=new a}d.prototype=Object.create(s.prototype);for(var g in s)d[g]=s[g];d.prototype.getEdges=function(){return this.edges},d.prototype.getChild=function(){return this.child},d.prototype.getOwner=function(){return this.owner},d.prototype.getWidth=function(){return this.rect.width},d.prototype.setWidth=function(f){this.rect.width=f},d.prototype.getHeight=function(){return this.rect.height},d.prototype.setHeight=function(f){this.rect.height=f},d.prototype.getCenterX=function(){return this.rect.x+this.rect.width/2},d.prototype.getCenterY=function(){return this.rect.y+this.rect.height/2},d.prototype.getCenter=function(){return new c(this.rect.x+this.rect.width/2,this.rect.y+this.rect.height/2)},d.prototype.getLocation=function(){return new c(this.rect.x,this.rect.y)},d.prototype.getRect=function(){return this.rect},d.prototype.getDiagonal=function(){return Math.sqrt(this.rect.width*this.rect.width+this.rect.height*this.rect.height)},d.prototype.getHalfTheDiagonal=function(){return Math.sqrt(this.rect.height*this.rect.height+this.rect.width*this.rect.width)/2},d.prototype.setRect=function(f,y){this.rect.x=f.x,this.rect.y=f.y,this.rect.width=y.width,this.rect.height=y.height},d.prototype.setCenter=function(f,y){this.rect.x=f-this.rect.width/2,this.rect.y=y-this.rect.height/2},d.prototype.setLocation=function(f,y){this.rect.x=f,this.rect.y=y},d.prototype.moveBy=function(f,y){this.rect.x+=f,this.rect.y+=y},d.prototype.getEdgeListToNode=function(f){var y=[],_=this;return _.edges.forEach(function(v){if(v.target==f){if(v.source!=_)throw"Incorrect edge source!";y.push(v)}}),y},d.prototype.getEdgesBetween=function(f){var y=[],_=this;return _.edges.forEach(function(v){if(!(v.source==_||v.target==_))throw"Incorrect edge source and/or target";(v.target==f||v.source==f)&&y.push(v)}),y},d.prototype.getNeighborsList=function(){var f=new Set,y=this;return y.edges.forEach(function(_){if(_.source==y)f.add(_.target);else{if(_.target!=y)throw"Incorrect incidency!";f.add(_.source)}}),f},d.prototype.withChildren=function(){var f=new Set,y,_;if(f.add(this),this.child!=null)for(var v=this.child.getNodes(),m=0;m<v.length;m++)y=v[m],_=y.withChildren(),_.forEach(function(x){f.add(x)});return f},d.prototype.getNoOfChildren=function(){var f=0,y;if(this.child==null)f=1;else for(var _=this.child.getNodes(),v=0;v<_.length;v++)y=_[v],f+=y.getNoOfChildren();return f==0&&(f=1),f},d.prototype.getEstimatedSize=function(){if(this.estimatedSize==o.MIN_VALUE)throw"assert failed";return this.estimatedSize},d.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)},d.prototype.scatter=function(){var f,y,_=-l.INITIAL_WORLD_BOUNDARY,v=l.INITIAL_WORLD_BOUNDARY;f=l.WORLD_CENTER_X+u.nextDouble()*(v-_)+_;var m=-l.INITIAL_WORLD_BOUNDARY,x=l.INITIAL_WORLD_BOUNDARY;y=l.WORLD_CENTER_Y+u.nextDouble()*(x-m)+m,this.rect.x=f,this.rect.y=y},d.prototype.updateBounds=function(){if(this.getChild()==null)throw"assert failed";if(this.getChild().getNodes().length!=0){var f=this.getChild();if(f.updateBounds(!0),this.rect.x=f.getLeft(),this.rect.y=f.getTop(),this.setWidth(f.getRight()-f.getLeft()),this.setHeight(f.getBottom()-f.getTop()),l.NODE_DIMENSIONS_INCLUDE_LABELS){var y=f.getRight()-f.getLeft(),_=f.getBottom()-f.getTop();this.labelWidth&&(this.labelPosHorizontal=="left"?(this.rect.x-=this.labelWidth,this.setWidth(y+this.labelWidth)):this.labelPosHorizontal=="center"&&this.labelWidth>y?(this.rect.x-=(this.labelWidth-y)/2,this.setWidth(this.labelWidth)):this.labelPosHorizontal=="right"&&this.setWidth(y+this.labelWidth)),this.labelHeight&&(this.labelPosVertical=="top"?(this.rect.y-=this.labelHeight,this.setHeight(_+this.labelHeight)):this.labelPosVertical=="center"&&this.labelHeight>_?(this.rect.y-=(this.labelHeight-_)/2,this.setHeight(this.labelHeight)):this.labelPosVertical=="bottom"&&this.setHeight(_+this.labelHeight))}}},d.prototype.getInclusionTreeDepth=function(){if(this.inclusionTreeDepth==o.MAX_VALUE)throw"assert failed";return this.inclusionTreeDepth},d.prototype.transform=function(f){var y=this.rect.x;y>l.WORLD_BOUNDARY?y=l.WORLD_BOUNDARY:y<-l.WORLD_BOUNDARY&&(y=-l.WORLD_BOUNDARY);var _=this.rect.y;_>l.WORLD_BOUNDARY?_=l.WORLD_BOUNDARY:_<-l.WORLD_BOUNDARY&&(_=-l.WORLD_BOUNDARY);var v=new c(y,_),m=f.inverseTransformPoint(v);this.setLocation(m.x,m.y)},d.prototype.getLeft=function(){return this.rect.x},d.prototype.getRight=function(){return this.rect.x+this.rect.width},d.prototype.getTop=function(){return this.rect.y},d.prototype.getBottom=function(){return this.rect.y+this.rect.height},d.prototype.getParent=function(){return this.owner==null?null:this.owner.getParent()},r.exports=d}),(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),d=i(13),g=i(12),f=i(11);function y(v,m,x){s.call(this,x),this.estimatedSize=o.MIN_VALUE,this.margin=a.DEFAULT_GRAPH_MARGIN,this.edges=[],this.nodes=[],this.isConnected=!1,this.parent=v,m!=null&&m instanceof l?this.graphManager=m:m!=null&&m instanceof Layout&&(this.graphManager=m.graphManager)}y.prototype=Object.create(s.prototype);for(var _ in s)y[_]=s[_];y.prototype.getNodes=function(){return this.nodes},y.prototype.getEdges=function(){return this.edges},y.prototype.getGraphManager=function(){return this.graphManager},y.prototype.getParent=function(){return this.parent},y.prototype.getLeft=function(){return this.left},y.prototype.getRight=function(){return this.right},y.prototype.getTop=function(){return this.top},y.prototype.getBottom=function(){return this.bottom},y.prototype.isConnected=function(){return this.isConnected},y.prototype.add=function(v,m,x){if(m==null&&x==null){var b=v;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=v;if(!(this.getNodes().indexOf(m)>-1&&this.getNodes().indexOf(x)>-1))throw"Source or target not in graph!";if(!(m.owner==x.owner&&m.owner==this))throw"Both owners must be this graph!";return m.owner!=x.owner?null:(S.source=m,S.target=x,S.isInterGraph=!1,this.getEdges().push(S),m.edges.push(S),x!=m&&x.edges.push(S),S)}},y.prototype.remove=function(v){var m=v;if(v 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 x=m.edges.slice(),b,S=x.length,T=0;T<S;T++)b=x[T],b.isInterGraph?this.graphManager.remove(b):b.source.owner.remove(b);var N=this.nodes.indexOf(m);if(N==-1)throw"Node not in owner node list!";this.nodes.splice(N,1)}else if(v instanceof c){var b=v;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 E=b.source.edges.indexOf(b),k=b.target.edges.indexOf(b);if(!(E>-1&&k>-1))throw"Source and/or target doesn't know this edge!";b.source.edges.splice(E,1),b.target!=b.source&&b.target.edges.splice(k,1);var N=b.source.owner.getEdges().indexOf(b);if(N==-1)throw"Not in owner's edge list!";b.source.owner.getEdges().splice(N,1)}},y.prototype.updateLeftTop=function(){for(var v=o.MAX_VALUE,m=o.MAX_VALUE,x,b,S,T=this.getNodes(),N=T.length,E=0;E<N;E++){var k=T[E];x=k.getTop(),b=k.getLeft(),v>x&&(v=x),m>b&&(m=b)}return v==o.MAX_VALUE?null:(T[0].getParent().paddingLeft!=null?S=T[0].getParent().paddingLeft:S=this.margin,this.left=m-S,this.top=v-S,new g(this.left,this.top))},y.prototype.updateBounds=function(v){for(var m=o.MAX_VALUE,x=-o.MAX_VALUE,b=o.MAX_VALUE,S=-o.MAX_VALUE,T,N,E,k,L,A=this.nodes,I=A.length,O=0;O<I;O++){var B=A[O];v&&B.child!=null&&B.updateBounds(),T=B.getLeft(),N=B.getRight(),E=B.getTop(),k=B.getBottom(),m>T&&(m=T),x<N&&(x=N),b>E&&(b=E),S<k&&(S=k)}var D=new d(m,b,x-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},y.calculateBounds=function(v){for(var m=o.MAX_VALUE,x=-o.MAX_VALUE,b=o.MAX_VALUE,S=-o.MAX_VALUE,T,N,E,k,L=v.length,A=0;A<L;A++){var I=v[A];T=I.getLeft(),N=I.getRight(),E=I.getTop(),k=I.getBottom(),m>T&&(m=T),x<N&&(x=N),b>E&&(b=E),S<k&&(S=k)}var O=new d(m,b,x-m,S-b);return O},y.prototype.getInclusionTreeDepth=function(){return this==this.graphManager.getRoot()?1:this.parent.getInclusionTreeDepth()},y.prototype.getEstimatedSize=function(){if(this.estimatedSize==o.MIN_VALUE)throw"assert failed";return this.estimatedSize},y.prototype.calcEstimatedSize=function(){for(var v=0,m=this.nodes,x=m.length,b=0;b<x;b++){var S=m[b];v+=S.calcEstimatedSize()}return v==0?this.estimatedSize=a.EMPTY_COMPOUND_NODE_SIZE:this.estimatedSize=v/Math.sqrt(this.nodes.length),this.estimatedSize},y.prototype.updateConnected=function(){var v=this;if(this.nodes.length==0){this.isConnected=!0;return}var m=new f,x=new Set,b=this.nodes[0],S,T,N=b.withChildren();for(N.forEach(function(O){m.push(O),x.add(O)});m.length!==0;){b=m.shift(),S=b.getEdges();for(var E=S.length,k=0;k<E;k++){var L=S[k];if(T=L.getOtherEndInGraph(b,this),T!=null&&!x.has(T)){var A=T.withChildren();A.forEach(function(O){m.push(O),x.add(O)})}}}if(this.isConnected=!1,x.size>=this.nodes.length){var I=0;x.forEach(function(O){O.owner==v&&I++}),I==this.nodes.length&&(this.isConnected=!0)}},r.exports=y}),(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,d,g){if(c==null&&d==null&&g==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{g=c,d=u,c=l;var f=d.getOwner(),y=g.getOwner();if(!(f!=null&&f.getGraphManager()==this))throw"Source not in this graph mgr!";if(!(y!=null&&y.getGraphManager()==this))throw"Target not in this graph mgr!";if(f==y)return c.isInterGraph=!1,f.add(c,d,g);if(c.isInterGraph=!0,c.source=d,c.target=g,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 d,g=c.length,f=0;f<g;f++)d=c[f],u.remove(d);var y=[];y=y.concat(u.getNodes());var _;g=y.length;for(var f=0;f<g;f++)_=y[f],u.remove(_);u==this.rootGraph&&this.setRootGraph(null);var v=this.graphs.indexOf(u);this.graphs.splice(v,1),u.parent=null}else if(l instanceof o){if(d=l,d==null)throw"Edge is null!";if(!d.isInterGraph)throw"Not an inter-graph edge!";if(!(d.source!=null&&d.target!=null))throw"Source and/or target is null!";if(!(d.source.edges.indexOf(d)!=-1&&d.target.edges.indexOf(d)!=-1))throw"Source and/or target doesn't know this edge!";var v=d.source.edges.indexOf(d);if(d.source.edges.splice(v,1),v=d.target.edges.indexOf(d),d.target.edges.splice(v,1),!(d.source.owner!=null&&d.source.owner.getGraphManager()!=null))throw"Edge owner graph or owner graph manager is null!";if(d.source.owner.getGraphManager().edges.indexOf(d)==-1)throw"Not in owner graph manager's edge list!";var v=d.source.owner.getGraphManager().edges.indexOf(d);d.source.owner.getGraphManager().edges.splice(v,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,d=0;d<c;d++)l=l.concat(u[d].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(),d;do{if(d=c.getParent(),d==null)break;if(d==u)return!0;if(c=d.getOwner(),c==null)break}while(!0);c=u.getOwner();do{if(d=c.getParent(),d==null)break;if(d==l)return!0;if(c=d.getOwner(),c==null)break}while(!0);return!1},a.prototype.calcLowestCommonAncestors=function(){for(var l,u,c,d,g,f=this.getAllEdges(),y=f.length,_=0;_<y;_++){if(l=f[_],u=l.source,c=l.target,l.lca=null,l.sourceInLca=u,l.targetInLca=c,u==c){l.lca=u.getOwner();continue}for(d=u.getOwner();l.lca==null;){for(l.targetInLca=c,g=c.getOwner();l.lca==null;){if(g==d){l.lca=g;break}if(g==this.rootGraph)break;if(l.lca!=null)throw"assert failed";l.targetInLca=g.getParent(),g=l.targetInLca.getOwner()}if(d==this.rootGraph)break;l.lca==null&&(l.sourceInLca=d.getParent(),d=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 d=u.getOwner();do{if(d==null)break;if(d==c)return d;d=d.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,d=l.getNodes(),g=d.length,f=0;f<g;f++)c=d[f],c.inclusionTreeDepth=u,c.child!=null&&this.calcInclusionTreeDepths(c.child,u+1)},a.prototype.includesInvalidEdge=function(){for(var l,u=[],c=this.edges.length,d=0;d<c;d++)l=this.edges[d],this.isOneAncestorOfOther(l.source,l.target)&&u.push(l);for(var d=0;d<u.length;d++)this.remove(u[d]);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 d=new Array(2);this.decideDirectionsForOverlappingNodes(a,l,d),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 g=Math.abs((l.getCenterY()-a.getCenterY())/(l.getCenterX()-a.getCenterX()));l.getCenterY()===a.getCenterY()&&l.getCenterX()===a.getCenterX()&&(g=1);var f=g*u[0],y=u[1]/g;u[0]<y?y=u[0]:f=u[1],u[0]=-1*d[0]*(y/2+c),u[1]=-1*d[1]*(f/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(),d=a.getCenterY(),g=l.getCenterX(),f=l.getCenterY();if(a.intersects(l))return u[0]=c,u[1]=d,u[2]=g,u[3]=f,!0;var y=a.getX(),_=a.getY(),v=a.getRight(),m=a.getX(),x=a.getBottom(),b=a.getRight(),S=a.getWidthHalf(),T=a.getHeightHalf(),N=l.getX(),E=l.getY(),k=l.getRight(),L=l.getX(),A=l.getBottom(),I=l.getRight(),O=l.getWidthHalf(),B=l.getHeightHalf(),D=!1,M=!1;if(c===g){if(d>f)return u[0]=c,u[1]=_,u[2]=g,u[3]=A,!1;if(d<f)return u[0]=c,u[1]=x,u[2]=g,u[3]=E,!1}else if(d===f){if(c>g)return u[0]=y,u[1]=d,u[2]=k,u[3]=f,!1;if(c<g)return u[0]=v,u[1]=d,u[2]=N,u[3]=f,!1}else{var U=a.height/a.width,H=l.height/l.width,$=(f-d)/(g-c),F=void 0,P=void 0,z=void 0,G=void 0,V=void 0,te=void 0;if(-U===$?c>g?(u[0]=m,u[1]=x,D=!0):(u[0]=v,u[1]=_,D=!0):U===$&&(c>g?(u[0]=y,u[1]=_,D=!0):(u[0]=b,u[1]=x,D=!0)),-H===$?g>c?(u[2]=L,u[3]=A,M=!0):(u[2]=k,u[3]=E,M=!0):H===$&&(g>c?(u[2]=N,u[3]=E,M=!0):(u[2]=I,u[3]=A,M=!0)),D&&M)return!1;if(c>g?d>f?(F=this.getCardinalDirection(U,$,4),P=this.getCardinalDirection(H,$,2)):(F=this.getCardinalDirection(-U,$,3),P=this.getCardinalDirection(-H,$,1)):d>f?(F=this.getCardinalDirection(-U,$,1),P=this.getCardinalDirection(-H,$,3)):(F=this.getCardinalDirection(U,$,2),P=this.getCardinalDirection(H,$,4)),!D)switch(F){case 1:G=_,z=c+-T/$,u[0]=z,u[1]=G;break;case 2:z=b,G=d+S*$,u[0]=z,u[1]=G;break;case 3:G=x,z=c+T/$,u[0]=z,u[1]=G;break;case 4:z=m,G=d+-S*$,u[0]=z,u[1]=G;break}if(!M)switch(P){case 1:te=E,V=g+-B/$,u[2]=V,u[3]=te;break;case 2:V=I,te=f+O*$,u[2]=V,u[3]=te;break;case 3:te=A,V=g+B/$,u[2]=V,u[3]=te;break;case 4:V=L,te=f+-O*$,u[2]=V,u[3]=te;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 d=a.x,g=a.y,f=l.x,y=l.y,_=u.x,v=u.y,m=c.x,x=c.y,b=void 0,S=void 0,T=void 0,N=void 0,E=void 0,k=void 0,L=void 0,A=void 0,I=void 0;return T=y-g,E=d-f,L=f*g-d*y,N=x-v,k=_-m,A=m*v-_*x,I=T*k-N*E,I===0?null:(b=(E*A-k*L)/I,S=(N*L-T*A)/I,new s(b,S))},o.angleOfVector=function(a,l,u,c){var d=void 0;return a!==u?(d=Math.atan((c-l)/(u-a)),u<a?d+=Math.PI:c<l&&(d+=this.TWO_PI)):c<l?d=this.ONE_AND_HALF_PI:d=this.HALF_PI,d},o.doIntersect=function(a,l,u,c){var d=a.x,g=a.y,f=l.x,y=l.y,_=u.x,v=u.y,m=c.x,x=c.y,b=(f-d)*(x-v)-(m-_)*(y-g);if(b===0)return!1;var S=((x-v)*(m-d)+(_-m)*(x-g))/b,T=((g-y)*(m-d)+(f-d)*(x-g))/b;return 0<S&&S<1&&0<T&&T<1},o.findCircleLineIntersections=function(a,l,u,c,d,g,f){var y=(u-a)*(u-a)+(c-l)*(c-l),_=2*((a-d)*(u-a)+(l-g)*(c-l)),v=(a-d)*(a-d)+(l-g)*(l-g)-f*f,m=_*_-4*y*v;if(m>=0){var x=(-_+Math.sqrt(_*_-4*y*v))/(2*y),b=(-_-Math.sqrt(_*_-4*y*v))/(2*y),S=null;return x>=0&&x<=1?[x]: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 d(g,f){for(var y=0;y<f.length;y++){var _=f[y];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(g,_.key,_)}}return function(g,f,y){return f&&d(g.prototype,f),y&&d(g,y),g}})();function o(d,g){if(!(d instanceof g))throw new TypeError("Cannot call a class as a function")}var a=function(g){return{value:g,next:null,prev:null}},l=function(g,f,y,_){return g!==null?g.next=f:_.head=f,y!==null?y.prev=f:_.tail=f,f.prev=g,f.next=y,_.length++,f},u=function(g,f){var y=g.prev,_=g.next;return y!==null?y.next=_:f.head=_,_!==null?_.prev=y:f.tail=y,g.prev=g.next=null,f.length--,g},c=(function(){function d(g){var f=this;o(this,d),this.length=0,this.head=null,this.tail=null,g!=null&&g.forEach(function(y){return f.push(y)})}return s(d,[{key:"size",value:function(){return this.length}},{key:"insertBefore",value:function(f,y){return l(y.prev,a(f),y,this)}},{key:"insertAfter",value:function(f,y){return l(y,a(f),y.next,this)}},{key:"insertNodeBefore",value:function(f,y){return l(y.prev,f,y,this)}},{key:"insertNodeAfter",value:function(f,y){return l(y,f,y.next,this)}},{key:"push",value:function(f){return l(this.tail,a(f),null,this)}},{key:"unshift",value:function(f){return l(null,a(f),this.head,this)}},{key:"remove",value:function(f){return u(f,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(f){if(f<=this.length()){for(var y=1,_=this.head;y<f;)_=_.next,y++;return _.value}}},{key:"set_object_at",value:function(f,y){if(f<=this.length()){for(var _=1,v=this.head;_<f;)v=v.next,_++;v.value=y}}}]),d})();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(_){if(Array.isArray(_)){for(var v=0,m=Array(_.length);v<_.length;v++)m[v]=_[v];return m}else return Array.from(_)}var o=i(0),a=i(7),l=i(3),u=i(1),c=i(6),d=i(5),g=i(17),f=i(29);function y(_){f.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,_!=null&&(this.isRemoteUse=_)}y.RANDOM_SEED=1,y.prototype=Object.create(f.prototype),y.prototype.getGraphManager=function(){return this.graphManager},y.prototype.getAllNodes=function(){return this.graphManager.getAllNodes()},y.prototype.getAllEdges=function(){return this.graphManager.getAllEdges()},y.prototype.getAllNodesToApplyGravitation=function(){return this.graphManager.getAllNodesToApplyGravitation()},y.prototype.newGraphManager=function(){var _=new a(this);return this.graphManager=_,_},y.prototype.newGraph=function(_){return new c(null,this.graphManager,_)},y.prototype.newNode=function(_){return new l(this.graphManager,_)},y.prototype.newEdge=function(_){return new u(null,null,_)},y.prototype.checkLayoutSuccess=function(){return this.graphManager.getRoot()==null||this.graphManager.getRoot().getNodes().length==0||this.graphManager.includesInvalidEdge()},y.prototype.runLayout=function(){this.isLayoutFinished=!1,this.tilingPreLayout&&this.tilingPreLayout(),this.initParameters();var _;return this.checkLayoutSuccess()?_=!1:_=this.layout(),o.ANIMATE==="during"?!1:(_&&(this.isSubLayout||this.doPostLayout()),this.tilingPostLayout&&this.tilingPostLayout(),this.isLayoutFinished=!0,_)},y.prototype.doPostLayout=function(){this.incremental||this.transform(),this.update()},y.prototype.update2=function(){if(this.createBendsAsNeeded&&(this.createBendpointsFromDummyNodes(),this.graphManager.resetAllEdges()),!this.isRemoteUse){for(var _=this.graphManager.getAllEdges(),v=0;v<_.length;v++)_[v];for(var m=this.graphManager.getRoot().getNodes(),v=0;v<m.length;v++)m[v];this.update(this.graphManager.getRoot())}},y.prototype.update=function(_){if(_==null)this.update2();else if(_ instanceof l){var v=_;if(v.getChild()!=null)for(var m=v.getChild().getNodes(),x=0;x<m.length;x++)update(m[x]);if(v.vGraphObject!=null){var b=v.vGraphObject;b.update(v)}}else if(_ instanceof u){var S=_;if(S.vGraphObject!=null){var T=S.vGraphObject;T.update(S)}}else if(_ instanceof c){var N=_;if(N.vGraphObject!=null){var E=N.vGraphObject;E.update(N)}}},y.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)},y.prototype.transform=function(_){if(_==null)this.transform(new d(0,0));else{var v=new g,m=this.graphManager.getRoot().updateLeftTop();if(m!=null){v.setWorldOrgX(_.x),v.setWorldOrgY(_.y),v.setDeviceOrgX(m.x),v.setDeviceOrgY(m.y);for(var x=this.getAllNodes(),b,S=0;S<x.length;S++)b=x[S],b.transform(v)}}},y.prototype.positionNodesRandomly=function(_){if(_==null)this.positionNodesRandomly(this.getGraphManager().getRoot()),this.getGraphManager().getRoot().updateBounds(!0);else for(var v,m,x=_.getNodes(),b=0;b<x.length;b++)v=x[b],m=v.getChild(),m==null||m.getNodes().length==0?v.scatter():(this.positionNodesRandomly(m),v.updateBounds())},y.prototype.getFlatForest=function(){for(var _=[],v=!0,m=this.graphManager.getRoot().getNodes(),x=!0,b=0;b<m.length;b++)m[b].getChild()!=null&&(x=!1);if(!x)return _;var S=new Set,T=[],N=new Map,E=[];for(E=E.concat(m);E.length>0&&v;){for(T.push(E[0]);T.length>0&&v;){var k=T[0];T.splice(0,1),S.add(k);for(var L=k.getEdges(),b=0;b<L.length;b++){var A=L[b].getOtherEnd(k);if(N.get(k)!=A)if(!S.has(A))T.push(A),N.set(A,k);else{v=!1;break}}}if(!v)_=[];else{var I=[].concat(s(S));_.push(I);for(var b=0;b<I.length;b++){var O=I[b],B=E.indexOf(O);B>-1&&E.splice(B,1)}S=new Set,N=new Map}}return _},y.prototype.createDummyNodesForBendpoints=function(_){for(var v=[],m=_.source,x=this.graphManager.calcLowestCommonAncestor(_.source,_.target),b=0;b<_.bendpoints.length;b++){var S=this.newNode(null);S.setRect(new Point(0,0),new Dimension(1,1)),x.add(S);var T=this.newEdge(null);this.graphManager.add(T,m,S),v.add(S),m=S}var T=this.newEdge(null);return this.graphManager.add(T,m,_.target),this.edgeToDummyNodes.set(_,v),_.isInterGraph()?this.graphManager.remove(_):x.remove(_),v},y.prototype.createBendpointsFromDummyNodes=function(){var _=[];_=_.concat(this.graphManager.getAllEdges()),_=[].concat(s(this.edgeToDummyNodes.keys())).concat(_);for(var v=0;v<_.length;v++){var m=_[v];if(m.bendpoints.length>0){for(var x=this.edgeToDummyNodes.get(m),b=0;b<x.length;b++){var S=x[b],T=new d(S.getCenterX(),S.getCenterY()),N=m.bendpoints.get(b);N.x=T.x,N.y=T.y,S.getOwner().remove(S)}this.graphManager.add(m,m.source,m.target)}}},y.transform=function(_,v,m,x){if(m!=null&&x!=null){var b=v;if(_<=50){var S=v/m;b-=(v-S)/50*(50-_)}else{var T=v*x;b+=(T-v)/50*(_-50)}return b}else{var N,E;return _<=50?(N=9*v/500,E=v/10):(N=9*v/50,E=-8*v),N*_+E}},y.findCenterOfTree=function(_){var v=[];v=v.concat(_);var m=[],x=new Map,b=!1,S=null;(v.length==1||v.length==2)&&(b=!0,S=v[0]);for(var T=0;T<v.length;T++){var N=v[T],E=N.getNeighborsList().size;x.set(N,N.getNeighborsList().size),E==1&&m.push(N)}var k=[];for(k=k.concat(m);!b;){var L=[];L=L.concat(k),k=[];for(var T=0;T<v.length;T++){var N=v[T],A=v.indexOf(N);A>=0&&v.splice(A,1);var I=N.getNeighborsList();I.forEach(function(D){if(m.indexOf(D)<0){var M=x.get(D),U=M-1;U==1&&k.push(D),x.set(D,U)}})}m=m.concat(k),(v.length==1||v.length==2)&&(b=!0,S=v[0])}return S},y.prototype.setGraphManager=function(_){this.graphManager=_},r.exports=y}),(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(f){if(Array.isArray(f)){for(var y=0,_=Array(f.length);y<f.length;y++)_[y]=f[y];return _}else return Array.from(f)}var o=i(15),a=i(4),l=i(0),u=i(8),c=i(9);function d(){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}d.prototype=Object.create(o.prototype);for(var g in o)d[g]=o[g];d.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=[]},d.prototype.calcIdealEdgeLengths=function(){for(var f,y,_,v,m,x,b,S=this.getGraphManager().getAllEdges(),T=0;T<S.length;T++)f=S[T],y=f.idealLength,f.isInterGraph&&(v=f.getSource(),m=f.getTarget(),x=f.getSourceInLca().getEstimatedSize(),b=f.getTargetInLca().getEstimatedSize(),this.useSmartIdealEdgeLengthCalculation&&(f.idealLength+=x+b-2*l.SIMPLE_NODE_SIZE),_=f.getLca().getInclusionTreeDepth(),f.idealLength+=y*a.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR*(v.getInclusionTreeDepth()+m.getInclusionTreeDepth()-2*_))},d.prototype.initSpringEmbedder=function(){var f=this.getAllNodes().length;this.incremental?(f>a.ADAPTATION_LOWER_NODE_LIMIT&&(this.coolingFactor=Math.max(this.coolingFactor*a.COOLING_ADAPTATION_FACTOR,this.coolingFactor-(f-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):(f>a.ADAPTATION_LOWER_NODE_LIMIT?this.coolingFactor=Math.max(a.COOLING_ADAPTATION_FACTOR,1-(f-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()},d.prototype.calcSpringForces=function(){for(var f=this.getAllEdges(),y,_=0;_<f.length;_++)y=f[_],this.calcSpringForce(y,y.idealLength)},d.prototype.calcRepulsionForces=function(){var f=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,_,v,m,x,b=this.getAllNodes(),S;if(this.useFRGridVariant)for(this.totalIterations%a.GRID_CALCULATION_CHECK_PERIOD==1&&f&&this.updateGrid(),S=new Set,_=0;_<b.length;_++)m=b[_],this.calculateRepulsionForceOfANode(m,S,f,y),S.add(m);else for(_=0;_<b.length;_++)for(m=b[_],v=_+1;v<b.length;v++)x=b[v],m.getOwner()==x.getOwner()&&this.calcRepulsionForce(m,x)},d.prototype.calcGravitationalForces=function(){for(var f,y=this.getAllNodesToApplyGravitation(),_=0;_<y.length;_++)f=y[_],this.calcGravitationalForce(f)},d.prototype.moveNodes=function(){for(var f=this.getAllNodes(),y,_=0;_<f.length;_++)y=f[_],y.move()},d.prototype.calcSpringForce=function(f,y){var _=f.getSource(),v=f.getTarget(),m,x,b,S;if(this.uniformLeafNodeSizes&&_.getChild()==null&&v.getChild()==null)f.updateLengthSimple();else if(f.updateLength(),f.isOverlapingSourceAndTarget)return;m=f.getLength(),m!=0&&(x=f.edgeElasticity*(m-y),b=x*(f.lengthX/m),S=x*(f.lengthY/m),_.springForceX+=b,_.springForceY+=S,v.springForceX-=b,v.springForceY-=S)},d.prototype.calcRepulsionForce=function(f,y){var _=f.getRect(),v=y.getRect(),m=new Array(2),x=new Array(4),b,S,T,N,E,k,L;if(_.intersects(v)){u.calcSeparationAmount(_,v,m,a.DEFAULT_EDGE_LENGTH/2),k=2*m[0],L=2*m[1];var A=f.noOfChildren*y.noOfChildren/(f.noOfChildren+y.noOfChildren);f.repulsionForceX-=A*k,f.repulsionForceY-=A*L,y.repulsionForceX+=A*k,y.repulsionForceY+=A*L}else this.uniformLeafNodeSizes&&f.getChild()==null&&y.getChild()==null?(b=v.getCenterX()-_.getCenterX(),S=v.getCenterY()-_.getCenterY()):(u.getIntersection(_,v,x),b=x[2]-x[0],S=x[3]-x[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),T=b*b+S*S,N=Math.sqrt(T),E=(f.nodeRepulsion/2+y.nodeRepulsion/2)*f.noOfChildren*y.noOfChildren/T,k=E*b/N,L=E*S/N,f.repulsionForceX-=k,f.repulsionForceY-=L,y.repulsionForceX+=k,y.repulsionForceY+=L},d.prototype.calcGravitationalForce=function(f){var y,_,v,m,x,b,S,T;y=f.getOwner(),_=(y.getRight()+y.getLeft())/2,v=(y.getTop()+y.getBottom())/2,m=f.getCenterX()-_,x=f.getCenterY()-v,b=Math.abs(m)+f.getWidth()/2,S=Math.abs(x)+f.getHeight()/2,f.getOwner()==this.graphManager.getRoot()?(T=y.getEstimatedSize()*this.gravityRangeFactor,(b>T||S>T)&&(f.gravitationForceX=-this.gravityConstant*m,f.gravitationForceY=-this.gravityConstant*x)):(T=y.getEstimatedSize()*this.compoundGravityRangeFactor,(b>T||S>T)&&(f.gravitationForceX=-this.gravityConstant*m*this.compoundGravityConstant,f.gravitationForceY=-this.gravityConstant*x*this.compoundGravityConstant))},d.prototype.isConverged=function(){var f,y=!1;return this.totalIterations>this.maxIterations/3&&(y=Math.abs(this.totalDisplacement-this.oldTotalDisplacement)<2),f=this.totalDisplacement<this.totalDisplacementThreshold,this.oldTotalDisplacement=this.totalDisplacement,f||y},d.prototype.animate=function(){this.animationDuringLayout&&!this.isSubLayout&&(this.notAnimatedIterations==this.animationPeriod?(this.update(),this.notAnimatedIterations=0):this.notAnimatedIterations++)},d.prototype.calcNoOfChildrenForAllNodes=function(){for(var f,y=this.graphManager.getAllNodes(),_=0;_<y.length;_++)f=y[_],f.noOfChildren=f.getNoOfChildren()},d.prototype.calcGrid=function(f){var y=0,_=0;y=parseInt(Math.ceil((f.getRight()-f.getLeft())/this.repulsionRange)),_=parseInt(Math.ceil((f.getBottom()-f.getTop())/this.repulsionRange));for(var v=new Array(y),m=0;m<y;m++)v[m]=new Array(_);for(var m=0;m<y;m++)for(var x=0;x<_;x++)v[m][x]=new Array;return v},d.prototype.addNodeToGrid=function(f,y,_){var v=0,m=0,x=0,b=0;v=parseInt(Math.floor((f.getRect().x-y)/this.repulsionRange)),m=parseInt(Math.floor((f.getRect().width+f.getRect().x-y)/this.repulsionRange)),x=parseInt(Math.floor((f.getRect().y-_)/this.repulsionRange)),b=parseInt(Math.floor((f.getRect().height+f.getRect().y-_)/this.repulsionRange));for(var S=v;S<=m;S++)for(var T=x;T<=b;T++)this.grid[S][T].push(f),f.setGridCoordinates(v,m,x,b)},d.prototype.updateGrid=function(){var f,y,_=this.getAllNodes();for(this.grid=this.calcGrid(this.graphManager.getRoot()),f=0;f<_.length;f++)y=_[f],this.addNodeToGrid(y,this.graphManager.getRoot().getLeft(),this.graphManager.getRoot().getTop())},d.prototype.calculateRepulsionForceOfANode=function(f,y,_,v){if(this.totalIterations%a.GRID_CALCULATION_CHECK_PERIOD==1&&_||v){var m=new Set;f.surrounding=new Array;for(var x,b=this.grid,S=f.startX-1;S<f.finishX+2;S++)for(var T=f.startY-1;T<f.finishY+2;T++)if(!(S<0||T<0||S>=b.length||T>=b[0].length)){for(var N=0;N<b[S][T].length;N++)if(x=b[S][T][N],!(f.getOwner()!=x.getOwner()||f==x)&&!y.has(x)&&!m.has(x)){var E=Math.abs(f.getCenterX()-x.getCenterX())-(f.getWidth()/2+x.getWidth()/2),k=Math.abs(f.getCenterY()-x.getCenterY())-(f.getHeight()/2+x.getHeight()/2);E<=this.repulsionRange&&k<=this.repulsionRange&&m.add(x)}}f.surrounding=[].concat(s(m))}for(S=0;S<f.surrounding.length;S++)this.calcRepulsionForce(f,f.surrounding[S])},d.prototype.calcRepulsionRange=function(){return 0},r.exports=d}),(function(r,n,i){var s=i(1),o=i(4);function a(u,c,d){s.call(this,u,c,d),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,d,g){s.call(this,u,c,d,g),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,d,g){this.startX=u,this.finishX=c,this.startY=d,this.finishY=g},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 d=0;d<o[0].length;d++)l[u][c]+=o[u][d]*a[d][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=[],d=[],g=0;g<a[0].length;g++){for(var f=0,y=0;y<a.length;y++)f+=-.5*a[y][g]*o[y];c[g]=f}for(var _=0;_<l.length;_++){for(var v=0,m=0;m<l.length;m++)v+=l[_][m]*c[m];d[_]=v}for(var x=0;x<a.length;x++){for(var b=0,S=0;S<a[0].length;S++)b+=a[x][S]*d[S];u[x]=b}return u},r.exports=s}),(function(r,n,i){var s=(function(){function u(c,d){for(var g=0;g<d.length;g++){var f=d[g];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(c,f.key,f)}}return function(c,d,g){return d&&u(c.prototype,d),g&&u(c,g),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,d){o(this,u),(d!==null||d!==void 0)&&(this.compareFunction=this._defaultCompareFunction);var g=void 0;c instanceof a?g=c.size():g=c.length,this._quicksort(c,0,g-1)}return s(u,[{key:"_quicksort",value:function(d,g,f){if(g<f){var y=this._partition(d,g,f);this._quicksort(d,g,y),this._quicksort(d,y+1,f)}}},{key:"_partition",value:function(d,g,f){for(var y=this._get(d,g),_=g,v=f;;){for(;this.compareFunction(y,this._get(d,v));)v--;for(;this.compareFunction(this._get(d,_),y);)_++;if(_<v)this._swap(d,_,v),_++,v--;else return v}}},{key:"_get",value:function(d,g){return d instanceof a?d.get_object_at(g):d[g]}},{key:"_set",value:function(d,g,f){d instanceof a?d.set_object_at(g,f):d[g]=f}},{key:"_swap",value:function(d,g,f){var y=this._get(d,g);this._set(d,g,this._get(d,f)),this._set(d,f,y)}},{key:"_defaultCompareFunction",value:function(d,g){return g>d}}]),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(ht){for(var lt=[];ht-- >0;)lt.push(0);return lt})(Math.min(this.m+1,this.n)),this.U=(function(ht){var lt=function Bt(Et){if(Et.length==0)return 0;for(var $t=[],Mt=0;Mt<Et[0];Mt++)$t.push(Bt(Et.slice(1)));return $t};return lt(ht)})([this.m,a]),this.V=(function(ht){var lt=function Bt(Et){if(Et.length==0)return 0;for(var $t=[],Mt=0;Mt<Et[0];Mt++)$t.push(Bt(Et.slice(1)));return $t};return lt(ht)})([this.n,this.n]);for(var l=(function(ht){for(var lt=[];ht-- >0;)lt.push(0);return lt})(this.n),u=(function(ht){for(var lt=[];ht-- >0;)lt.push(0);return lt})(this.m),c=!0,d=Math.min(this.m-1,this.n),g=Math.max(0,Math.min(this.n-2,this.m)),f=0;f<Math.max(d,g);f++){if(f<d){this.s[f]=0;for(var y=f;y<this.m;y++)this.s[f]=s.hypot(this.s[f],o[y][f]);if(this.s[f]!==0){o[f][f]<0&&(this.s[f]=-this.s[f]);for(var _=f;_<this.m;_++)o[_][f]/=this.s[f];o[f][f]+=1}this.s[f]=-this.s[f]}for(var v=f+1;v<this.n;v++){if((function(ht,lt){return ht&<})(f<d,this.s[f]!==0)){for(var m=0,x=f;x<this.m;x++)m+=o[x][f]*o[x][v];m=-m/o[f][f];for(var b=f;b<this.m;b++)o[b][v]+=m*o[b][f]}l[v]=o[f][v]}if((function(ht,lt){return lt})(c,f<d))for(var S=f;S<this.m;S++)this.U[S][f]=o[S][f];if(f<g){l[f]=0;for(var T=f+1;T<this.n;T++)l[f]=s.hypot(l[f],l[T]);if(l[f]!==0){l[f+1]<0&&(l[f]=-l[f]);for(var N=f+1;N<this.n;N++)l[N]/=l[f];l[f+1]+=1}if(l[f]=-l[f],(function(ht,lt){return ht&<})(f+1<this.m,l[f]!==0)){for(var E=f+1;E<this.m;E++)u[E]=0;for(var k=f+1;k<this.n;k++)for(var L=f+1;L<this.m;L++)u[L]+=l[k]*o[L][k];for(var A=f+1;A<this.n;A++)for(var I=-l[A]/l[f+1],O=f+1;O<this.m;O++)o[O][A]+=I*u[O]}for(var B=f+1;B<this.n;B++)this.V[B][f]=l[B]}}var D=Math.min(this.n,this.m+1);d<this.n&&(this.s[d]=o[d][d]),this.m<D&&(this.s[D-1]=0),g+1<D&&(l[g]=o[g][D-1]),l[D-1]=0;{for(var M=d;M<a;M++){for(var U=0;U<this.m;U++)this.U[U][M]=0;this.U[M][M]=1}for(var H=d-1;H>=0;H--)if(this.s[H]!==0){for(var $=H+1;$<a;$++){for(var F=0,P=H;P<this.m;P++)F+=this.U[P][H]*this.U[P][$];F=-F/this.U[H][H];for(var z=H;z<this.m;z++)this.U[z][$]+=F*this.U[z][H]}for(var G=H;G<this.m;G++)this.U[G][H]=-this.U[G][H];this.U[H][H]=1+this.U[H][H];for(var V=0;V<H-1;V++)this.U[V][H]=0}else{for(var te=0;te<this.m;te++)this.U[te][H]=0;this.U[H][H]=1}}for(var ie=this.n-1;ie>=0;ie--){if((function(ht,lt){return ht&<})(ie<g,l[ie]!==0))for(var ne=ie+1;ne<a;ne++){for(var X=0,q=ie+1;q<this.n;q++)X+=this.V[q][ie]*this.V[q][ne];X=-X/this.V[ie+1][ie];for(var Y=ie+1;Y<this.n;Y++)this.V[Y][ne]+=X*this.V[Y][ie]}for(var K=0;K<this.n;K++)this.V[K][ie]=0;this.V[ie][ie]=1}for(var ee=D-1,re=Math.pow(2,-52),ue=Math.pow(2,-966);D>0;){var pe=void 0,Re=void 0;for(pe=D-2;pe>=-1&&pe!==-1;pe--)if(Math.abs(l[pe])<=ue+re*(Math.abs(this.s[pe])+Math.abs(this.s[pe+1]))){l[pe]=0;break}if(pe===D-2)Re=4;else{var Be=void 0;for(Be=D-1;Be>=pe&&Be!==pe;Be--){var _e=(Be!==D?Math.abs(l[Be]):0)+(Be!==pe+1?Math.abs(l[Be-1]):0);if(Math.abs(this.s[Be])<=ue+re*_e){this.s[Be]=0;break}}Be===pe?Re=3:Be===D-1?Re=1:(Re=2,pe=Be)}switch(pe++,Re){case 1:{var Te=l[D-2];l[D-2]=0;for(var Le=D-2;Le>=pe;Le--){var Ee=s.hypot(this.s[Le],Te),Pe=this.s[Le]/Ee,ze=Te/Ee;this.s[Le]=Ee,Le!==pe&&(Te=-ze*l[Le-1],l[Le-1]=Pe*l[Le-1]);for(var Me=0;Me<this.n;Me++)Ee=Pe*this.V[Me][Le]+ze*this.V[Me][D-1],this.V[Me][D-1]=-ze*this.V[Me][Le]+Pe*this.V[Me][D-1],this.V[Me][Le]=Ee}}break;case 2:{var Ue=l[pe-1];l[pe-1]=0;for(var Ge=pe;Ge<D;Ge++){var ve=s.hypot(this.s[Ge],Ue),Ce=this.s[Ge]/ve,Ie=Ue/ve;this.s[Ge]=ve,Ue=-Ie*l[Ge],l[Ge]=Ce*l[Ge];for(var me=0;me<this.m;me++)ve=Ce*this.U[me][Ge]+Ie*this.U[me][pe-1],this.U[me][pe-1]=-Ie*this.U[me][Ge]+Ce*this.U[me][pe-1],this.U[me][Ge]=ve}}break;case 3:{var Z=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[pe])),Math.abs(l[pe])),he=this.s[D-1]/Z,ae=this.s[D-2]/Z,se=l[D-2]/Z,ce=this.s[pe]/Z,de=l[pe]/Z,oe=((ae+he)*(ae-he)+se*se)/2,ye=he*se*(he*se),Se=0;(function(ht,lt){return ht||lt})(oe!==0,ye!==0)&&(Se=Math.sqrt(oe*oe+ye),oe<0&&(Se=-Se),Se=ye/(oe+Se));for(var ke=(ce+he)*(ce-he)+Se,De=ce*de,Ne=pe;Ne<D-1;Ne++){var Ae=s.hypot(ke,De),Qe=ke/Ae,Xe=De/Ae;Ne!==pe&&(l[Ne-1]=Ae),ke=Qe*this.s[Ne]+Xe*l[Ne],l[Ne]=Qe*l[Ne]-Xe*this.s[Ne],De=Xe*this.s[Ne+1],this.s[Ne+1]=Qe*this.s[Ne+1];for(var mt=0;mt<this.n;mt++)Ae=Qe*this.V[mt][Ne]+Xe*this.V[mt][Ne+1],this.V[mt][Ne+1]=-Xe*this.V[mt][Ne]+Qe*this.V[mt][Ne+1],this.V[mt][Ne]=Ae;if(Ae=s.hypot(ke,De),Qe=ke/Ae,Xe=De/Ae,this.s[Ne]=Ae,ke=Qe*l[Ne]+Xe*this.s[Ne+1],this.s[Ne+1]=-Xe*l[Ne]+Qe*this.s[Ne+1],De=Xe*l[Ne+1],l[Ne+1]=Qe*l[Ne+1],Ne<this.m-1)for(var Je=0;Je<this.m;Je++)Ae=Qe*this.U[Je][Ne]+Xe*this.U[Je][Ne+1],this.U[Je][Ne+1]=-Xe*this.U[Je][Ne]+Qe*this.U[Je][Ne+1],this.U[Je][Ne]=Ae}l[D-2]=ke}break;case 4:{if(this.s[pe]<=0){this.s[pe]=this.s[pe]<0?-this.s[pe]:0;for(var Ze=0;Ze<=ee;Ze++)this.V[Ze][pe]=-this.V[Ze][pe]}for(;pe<ee&&!(this.s[pe]>=this.s[pe+1]);){var ut=this.s[pe];if(this.s[pe]=this.s[pe+1],this.s[pe+1]=ut,pe<this.n-1)for(var et=0;et<this.n;et++)ut=this.V[et][pe+1],this.V[et][pe+1]=this.V[et][pe],this.V[et][pe]=ut;if(pe<this.m-1)for(var Ye=0;Ye<this.m;Ye++)ut=this.U[Ye][pe+1],this.U[Ye][pe+1]=this.U[Ye][pe],this.U[Ye][pe]=ut;pe++}D--}break}}var Ct={U:this.U,V:this.V,S:this.s};return Ct},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 d=0;d<c.length;d++){var g=c[d];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(u,g.key,g)}}return function(u,c,d){return c&&l(u.prototype,c),d&&l(u,d),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 d=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,g=arguments.length>3&&arguments[3]!==void 0?arguments[3]:-1,f=arguments.length>4&&arguments[4]!==void 0?arguments[4]:-1;o(this,l),this.sequence1=u,this.sequence2=c,this.match_score=d,this.mismatch_penalty=g,this.gap_penalty=f,this.iMax=u.length+1,this.jMax=c.length+1,this.grid=new Array(this.iMax);for(var y=0;y<this.iMax;y++){this.grid[y]=new Array(this.jMax);for(var _=0;_<this.jMax;_++)this.grid[y][_]=0}this.tracebackGrid=new Array(this.iMax);for(var v=0;v<this.iMax;v++){this.tracebackGrid[v]=new Array(this.jMax);for(var m=0;m<this.jMax;m++)this.tracebackGrid[v][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 d=1;d<this.iMax;d++)this.grid[d][0]=this.grid[d-1][0]+this.gap_penalty,this.tracebackGrid[d][0]=[!1,!0,!1];for(var g=1;g<this.iMax;g++)for(var f=1;f<this.jMax;f++){var y=void 0;this.sequence1[g-1]===this.sequence2[f-1]?y=this.grid[g-1][f-1]+this.match_score:y=this.grid[g-1][f-1]+this.mismatch_penalty;var _=this.grid[g-1][f]+this.gap_penalty,v=this.grid[g][f-1]+this.gap_penalty,m=[y,_,v],x=this.arrayAllMaxIndexes(m);this.grid[g][f]=m[x[0]],this.tracebackGrid[g][f]=[x.includes(0),x.includes(1),x.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 d=c[0],g=this.tracebackGrid[d.pos[0]][d.pos[1]];g[0]&&c.push({pos:[d.pos[0]-1,d.pos[1]-1],seq1:this.sequence1[d.pos[0]-1]+d.seq1,seq2:this.sequence2[d.pos[1]-1]+d.seq2}),g[1]&&c.push({pos:[d.pos[0]-1,d.pos[1]],seq1:this.sequence1[d.pos[0]-1]+d.seq1,seq2:"-"+d.seq2}),g[2]&&c.push({pos:[d.pos[0],d.pos[1]-1],seq1:"-"+d.seq1,seq2:this.sequence2[d.pos[1]-1]+d.seq2}),d.pos[0]===0&&d.pos[1]===0&&this.alignments.push({sequence1:d.seq1,sequence2:d.seq2}),c.shift()}return this.alignments}},{key:"getAllIndexes",value:function(c,d){for(var g=[],f=-1;(f=c.indexOf(d,f+1))!==-1;)g.push(f);return g}},{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})])})})(Rc)),Rc.exports}var PA=Nc.exports,hb;function MA(){return hb||(hb=1,(function(t,e){(function(n,i){t.exports=i(AA())})(PA,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 d(){}for(var g in c)d[g]=c[g];d.DEFAULT_USE_MULTI_LEVEL_SCALING=!1,d.DEFAULT_RADIAL_SEPARATION=c.DEFAULT_EDGE_LENGTH,d.DEFAULT_COMPONENT_SEPERATION=60,d.TILE=!0,d.TILING_PADDING_VERTICAL=10,d.TILING_PADDING_HORIZONTAL=10,d.TRANSFORM_ON_CONSTRAINT_HANDLING=!0,d.ENFORCE_CONSTRAINTS=!0,d.APPLY_LAYOUT=!0,d.RELAX_MOVEMENT_ON_CONSTRAINTS=!0,d.TREE_REDUCTION_ON_INCREMENTAL=!0,d.PURE_INCREMENTAL=d.DEFAULT_INCREMENTAL,a.exports=d}),767:((a,l,u)=>{var c=u(551).FDLayoutEdge;function d(f,y,_){c.call(this,f,y,_)}d.prototype=Object.create(c.prototype);for(var g in c)d[g]=c[g];a.exports=d}),880:((a,l,u)=>{var c=u(551).LGraph;function d(f,y,_){c.call(this,f,y,_)}d.prototype=Object.create(c.prototype);for(var g in c)d[g]=c[g];a.exports=d}),578:((a,l,u)=>{var c=u(551).LGraphManager;function d(f){c.call(this,f)}d.prototype=Object.create(c.prototype);for(var g in c)d[g]=c[g];a.exports=d}),765:((a,l,u)=>{var c=u(551).FDLayout,d=u(578),g=u(880),f=u(991),y=u(767),_=u(806),v=u(902),m=u(551).FDLayoutConstants,x=u(551).LayoutConstants,b=u(551).Point,S=u(551).PointD,T=u(551).DimensionD,N=u(551).Layout,E=u(551).Integer,k=u(551).IGeometry,L=u(551).LGraph,A=u(551).Transform,I=u(551).LinkedList;function O(){c.call(this),this.toBeTiled={},this.constraints={}}O.prototype=Object.create(c.prototype);for(var B in c)O[B]=c[B];O.prototype.newGraphManager=function(){var D=new d(this);return this.graphManager=D,D},O.prototype.newGraph=function(D){return new g(null,this.graphManager,D)},O.prototype.newNode=function(D){return new f(this.graphManager,D)},O.prototype.newEdge=function(D){return new y(null,null,D)},O.prototype.initParameters=function(){c.prototype.initParameters.call(this,arguments),this.isSubLayout||(_.DEFAULT_EDGE_LENGTH<10?this.idealEdgeLength=10:this.idealEdgeLength=_.DEFAULT_EDGE_LENGTH,this.useSmartIdealEdgeLengthCalculation=_.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)},O.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},O.prototype.layout=function(){var D=x.DEFAULT_CREATE_BENDS_AS_NEEDED;return D&&(this.createBendpoints(),this.graphManager.resetAllEdges()),this.level=0,this.classicLayout()},O.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(_.TREE_REDUCTION_ON_INCREMENTAL){this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var M=new Set(this.getAllNodes()),U=this.nodesWithGravity.filter(function(F){return M.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 M=new Set(this.getAllNodes()),U=this.nodesWithGravity.filter(function(H){return M.has(H)});this.graphManager.setAllNodesToApplyGravitation(U),this.positionNodesRandomly()}}return Object.keys(this.constraints).length>0&&(v.handleConstraints(this),this.initConstraintVariables()),this.initSpringEmbedder(),_.APPLY_LAYOUT&&this.runSpringEmbedder(),!0},O.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()),M=this.nodesWithGravity.filter(function($){return D.has($)});this.graphManager.setAllNodesToApplyGravitation(M),this.graphManager.updateBounds(),this.updateGrid(),_.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()),_.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,H=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(U,H),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},O.prototype.getPositionsData=function(){for(var D=this.graphManager.getAllNodes(),M={},U=0;U<D.length;U++){var H=D[U].rect,$=D[U].id;M[$]={id:$,x:H.getCenterX(),y:H.getCenterY(),w:H.width,h:H.height}}return M},O.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()}},O.prototype.moveNodes=function(){for(var D=this.getAllNodes(),M,U=0;U<D.length;U++)M=D[U],M.calculateDisplacement();Object.keys(this.constraints).length>0&&this.updateDisplacements();for(var U=0;U<D.length;U++)M=D[U],M.move()},O.prototype.initConstraintVariables=function(){var D=this;this.idToNodeMap=new Map,this.fixedNodeSet=new Set;for(var M=this.graphManager.getAllNodes(),U=0;U<M.length;U++){var H=M[U];this.idToNodeMap.set(H.id,H)}var $=function Y(K){for(var ee=K.getChild().getNodes(),re,ue=0,pe=0;pe<ee.length;pe++)re=ee[pe],re.getChild()==null?D.fixedNodeSet.has(re.id)&&(ue+=100):ue+=Y(re);return ue};if(this.constraints.fixedNodeConstraint){this.constraints.fixedNodeConstraint.forEach(function(ee){D.fixedNodeSet.add(ee.nodeId)});for(var M=this.graphManager.getAllNodes(),H,U=0;U<M.length;U++)if(H=M[U],H.getChild()!=null){var F=$(H);F>0&&(H.fixedNodeWeight=F)}}if(this.constraints.relativePlacementConstraint){var P=new Map,z=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(K){P.set(K,"dummy"+U),D.dummyToNodeForVerticalAlignment.get("dummy"+U).push(K),D.fixedNodeSet.has(K)&&D.fixedNodesOnHorizontal.add("dummy"+U)});if(this.constraints.alignmentConstraint.horizontal)for(var V=this.constraints.alignmentConstraint.horizontal,U=0;U<V.length;U++)this.dummyToNodeForHorizontalAlignment.set("dummy"+U,[]),V[U].forEach(function(K){z.set(K,"dummy"+U),D.dummyToNodeForHorizontalAlignment.get("dummy"+U).push(K),D.fixedNodeSet.has(K)&&D.fixedNodesOnVertical.add("dummy"+U)})}if(_.RELAX_MOVEMENT_ON_CONSTRAINTS)this.shuffle=function(Y){var K,ee,re;for(re=Y.length-1;re>=2*Y.length/3;re--)K=Math.floor(Math.random()*(re+1)),ee=Y[re],Y[re]=Y[K],Y[K]=ee;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 K=P.has(Y.left)?P.get(Y.left):Y.left,ee=P.has(Y.right)?P.get(Y.right):Y.right;D.nodesInRelativeHorizontal.includes(K)||(D.nodesInRelativeHorizontal.push(K),D.nodeToRelativeConstraintMapHorizontal.set(K,[]),D.dummyToNodeForVerticalAlignment.has(K)?D.nodeToTempPositionMapHorizontal.set(K,D.idToNodeMap.get(D.dummyToNodeForVerticalAlignment.get(K)[0]).getCenterX()):D.nodeToTempPositionMapHorizontal.set(K,D.idToNodeMap.get(K).getCenterX())),D.nodesInRelativeHorizontal.includes(ee)||(D.nodesInRelativeHorizontal.push(ee),D.nodeToRelativeConstraintMapHorizontal.set(ee,[]),D.dummyToNodeForVerticalAlignment.has(ee)?D.nodeToTempPositionMapHorizontal.set(ee,D.idToNodeMap.get(D.dummyToNodeForVerticalAlignment.get(ee)[0]).getCenterX()):D.nodeToTempPositionMapHorizontal.set(ee,D.idToNodeMap.get(ee).getCenterX())),D.nodeToRelativeConstraintMapHorizontal.get(K).push({right:ee,gap:Y.gap}),D.nodeToRelativeConstraintMapHorizontal.get(ee).push({left:K,gap:Y.gap})}else{var re=z.has(Y.top)?z.get(Y.top):Y.top,ue=z.has(Y.bottom)?z.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(ue)||(D.nodesInRelativeVertical.push(ue),D.nodeToRelativeConstraintMapVertical.set(ue,[]),D.dummyToNodeForHorizontalAlignment.has(ue)?D.nodeToTempPositionMapVertical.set(ue,D.idToNodeMap.get(D.dummyToNodeForHorizontalAlignment.get(ue)[0]).getCenterY()):D.nodeToTempPositionMapVertical.set(ue,D.idToNodeMap.get(ue).getCenterY())),D.nodeToRelativeConstraintMapVertical.get(re).push({bottom:ue,gap:Y.gap}),D.nodeToRelativeConstraintMapVertical.get(ue).push({top:re,gap:Y.gap})}});else{var te=new Map,ie=new Map;this.constraints.relativePlacementConstraint.forEach(function(Y){if(Y.left){var K=P.has(Y.left)?P.get(Y.left):Y.left,ee=P.has(Y.right)?P.get(Y.right):Y.right;te.has(K)?te.get(K).push(ee):te.set(K,[ee]),te.has(ee)?te.get(ee).push(K):te.set(ee,[K])}else{var re=z.has(Y.top)?z.get(Y.top):Y.top,ue=z.has(Y.bottom)?z.get(Y.bottom):Y.bottom;ie.has(re)?ie.get(re).push(ue):ie.set(re,[ue]),ie.has(ue)?ie.get(ue).push(re):ie.set(ue,[re])}});var ne=function(K,ee){var re=[],ue=[],pe=new I,Re=new Set,Be=0;return K.forEach(function(_e,Te){if(!Re.has(Te)){re[Be]=[],ue[Be]=!1;var Le=Te;for(pe.push(Le),Re.add(Le),re[Be].push(Le);pe.length!=0;){Le=pe.shift(),ee.has(Le)&&(ue[Be]=!0);var Ee=K.get(Le);Ee.forEach(function(Pe){Re.has(Pe)||(pe.push(Pe),Re.add(Pe),re[Be].push(Pe))})}Be++}}),{components:re,isFixed:ue}},X=ne(te,D.fixedNodesOnHorizontal);this.componentsOnHorizontal=X.components,this.fixedComponentsOnHorizontal=X.isFixed;var q=ne(ie,D.fixedNodesOnVertical);this.componentsOnVertical=q.components,this.fixedComponentsOnVertical=q.isFixed}}},O.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 M=this.constraints.alignmentConstraint.vertical,U=0;U<M.length;U++){for(var H=0,$=0;$<M[U].length;$++){if(this.fixedNodeSet.has(M[U][$])){H=0;break}H+=this.idToNodeMap.get(M[U][$]).displacementX}for(var F=H/M[U].length,$=0;$<M[U].length;$++)this.idToNodeMap.get(M[U][$]).displacementX=F}if(this.constraints.alignmentConstraint.horizontal)for(var P=this.constraints.alignmentConstraint.horizontal,U=0;U<P.length;U++){for(var z=0,$=0;$<P[U].length;$++){if(this.fixedNodeSet.has(P[U][$])){z=0;break}z+=this.idToNodeMap.get(P[U][$]).displacementY}for(var G=z/P[U].length,$=0;$<P[U].length;$++)this.idToNodeMap.get(P[U][$]).displacementY=G}}if(this.constraints.relativePlacementConstraint)if(_.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(K){if(K.right){var ee=D.nodeToTempPositionMapHorizontal.get(K.right)-D.nodeToTempPositionMapHorizontal.get(q)-Y;ee<K.gap&&(Y-=K.gap-ee)}else{var ee=D.nodeToTempPositionMapHorizontal.get(q)-D.nodeToTempPositionMapHorizontal.get(K.left)+Y;ee<K.gap&&(Y+=K.gap-ee)}}),D.nodeToTempPositionMapHorizontal.set(q,D.nodeToTempPositionMapHorizontal.get(q)+Y),D.dummyToNodeForVerticalAlignment.has(q)?D.dummyToNodeForVerticalAlignment.get(q).forEach(function(K){D.idToNodeMap.get(K).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(K){if(K.bottom){var ee=D.nodeToTempPositionMapVertical.get(K.bottom)-D.nodeToTempPositionMapVertical.get(q)-Y;ee<K.gap&&(Y-=K.gap-ee)}else{var ee=D.nodeToTempPositionMapVertical.get(q)-D.nodeToTempPositionMapVertical.get(K.top)+Y;ee<K.gap&&(Y+=K.gap-ee)}}),D.nodeToTempPositionMapVertical.set(q,D.nodeToTempPositionMapVertical.get(q)+Y),D.dummyToNodeForHorizontalAlignment.has(q)?D.dummyToNodeForHorizontalAlignment.get(q).forEach(function(K){D.idToNodeMap.get(K).displacementY=Y}):D.idToNodeMap.get(q).displacementY=Y}});else{for(var U=0;U<this.componentsOnHorizontal.length;U++){var V=this.componentsOnHorizontal[U];if(this.fixedComponentsOnHorizontal[U])for(var $=0;$<V.length;$++)this.dummyToNodeForVerticalAlignment.has(V[$])?this.dummyToNodeForVerticalAlignment.get(V[$]).forEach(function(K){D.idToNodeMap.get(K).displacementX=0}):this.idToNodeMap.get(V[$]).displacementX=0;else{for(var te=0,ie=0,$=0;$<V.length;$++)if(this.dummyToNodeForVerticalAlignment.has(V[$])){var ne=this.dummyToNodeForVerticalAlignment.get(V[$]);te+=ne.length*this.idToNodeMap.get(ne[0]).displacementX,ie+=ne.length}else te+=this.idToNodeMap.get(V[$]).displacementX,ie++;for(var X=te/ie,$=0;$<V.length;$++)this.dummyToNodeForVerticalAlignment.has(V[$])?this.dummyToNodeForVerticalAlignment.get(V[$]).forEach(function(K){D.idToNodeMap.get(K).displacementX=X}):this.idToNodeMap.get(V[$]).displacementX=X}}for(var U=0;U<this.componentsOnVertical.length;U++){var V=this.componentsOnVertical[U];if(this.fixedComponentsOnVertical[U])for(var $=0;$<V.length;$++)this.dummyToNodeForHorizontalAlignment.has(V[$])?this.dummyToNodeForHorizontalAlignment.get(V[$]).forEach(function(ee){D.idToNodeMap.get(ee).displacementY=0}):this.idToNodeMap.get(V[$]).displacementY=0;else{for(var te=0,ie=0,$=0;$<V.length;$++)if(this.dummyToNodeForHorizontalAlignment.has(V[$])){var ne=this.dummyToNodeForHorizontalAlignment.get(V[$]);te+=ne.length*this.idToNodeMap.get(ne[0]).displacementY,ie+=ne.length}else te+=this.idToNodeMap.get(V[$]).displacementY,ie++;for(var X=te/ie,$=0;$<V.length;$++)this.dummyToNodeForHorizontalAlignment.has(V[$])?this.dummyToNodeForHorizontalAlignment.get(V[$]).forEach(function(pe){D.idToNodeMap.get(pe).displacementY=X}):this.idToNodeMap.get(V[$]).displacementY=X}}}},O.prototype.calculateNodesToApplyGravitationTo=function(){var D=[],M,U=this.graphManager.getGraphs(),H=U.length,$;for($=0;$<H;$++)M=U[$],M.updateConnected(),M.isConnected||(D=D.concat(M.getNodes()));return D},O.prototype.createBendpoints=function(){var D=[];D=D.concat(this.graphManager.getAllEdges());var M=new Set,U;for(U=0;U<D.length;U++){var H=D[U];if(!M.has(H)){var $=H.getSource(),F=H.getTarget();if($==F)H.getBendpoints().push(new S),H.getBendpoints().push(new S),this.createDummyNodesForBendpoints(H),M.add(H);else{var P=[];if(P=P.concat($.getEdgeListToNode(F)),P=P.concat(F.getEdgeListToNode($)),!M.has(P[0])){if(P.length>1){var z;for(z=0;z<P.length;z++){var G=P[z];G.getBendpoints().push(new S),this.createDummyNodesForBendpoints(G)}}P.forEach(function(V){M.add(V)})}}}if(M.size==D.length)break}},O.prototype.positionNodesRadially=function(D){for(var M=new b(0,0),U=Math.ceil(Math.sqrt(D.length)),H=0,$=0,F=0,P=new S(0,0),z=0;z<D.length;z++){z%U==0&&(F=0,$=H,z!=0&&($+=_.DEFAULT_COMPONENT_SEPERATION),H=0);var G=D[z],V=N.findCenterOfTree(G);M.x=F,M.y=$,P=O.radialLayout(G,V,M),P.y>H&&(H=Math.floor(P.y)),F=Math.floor(P.x+_.DEFAULT_COMPONENT_SEPERATION)}this.transform(new S(x.WORLD_CENTER_X-P.x/2,x.WORLD_CENTER_Y-P.y/2))},O.radialLayout=function(D,M,U){var H=Math.max(this.maxDiagonalInTree(D),_.DEFAULT_RADIAL_SEPARATION);O.branchRadialLayout(M,null,0,359,0,H);var $=L.calculateBounds(D),F=new A;F.setDeviceOrgX($.getMinX()),F.setDeviceOrgY($.getMinY()),F.setWorldOrgX(U.x),F.setWorldOrgY(U.y);for(var P=0;P<D.length;P++){var z=D[P];z.transform(F)}var G=new S($.getMaxX(),$.getMaxY());return F.inverseTransformPoint(G)},O.branchRadialLayout=function(D,M,U,H,$,F){var P=(H-U+1)/2;P<0&&(P+=180);var z=(P+U)%360,G=z*k.TWO_PI/360,V=$*Math.cos(G),te=$*Math.sin(G);D.setCenter(V,te);var ie=[];ie=ie.concat(D.getEdges());var ne=ie.length;M!=null&&ne--;for(var X=0,q=ie.length,Y,K=D.getEdgesBetween(M);K.length>1;){var ee=K[0];K.splice(0,1);var re=ie.indexOf(ee);re>=0&&ie.splice(re,1),q--,ne--}M!=null?Y=(ie.indexOf(K[0])+1)%q:Y=0;for(var ue=Math.abs(H-U)/ne,pe=Y;X!=ne;pe=++pe%q){var Re=ie[pe].getOtherEnd(D);if(Re!=M){var Be=(U+X*ue)%360,_e=(Be+ue)%360;O.branchRadialLayout(Re,D,Be,_e,$+F,F),X++}}},O.maxDiagonalInTree=function(D){for(var M=E.MIN_VALUE,U=0;U<D.length;U++){var H=D[U],$=H.getDiagonal();$>M&&(M=$)}return M},O.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},O.prototype.groupZeroDegreeMembers=function(){var D=this,M={};this.memberGroups={},this.idToDummyNode={};for(var U=[],H=this.graphManager.getAllNodes(),$=0;$<H.length;$++){var F=H[$],P=F.getParent();this.getNodeDegreeWithChildren(F)===0&&(P.id==null||!this.getToBeTiled(P))&&U.push(F)}for(var $=0;$<U.length;$++){var F=U[$],z=F.getParent().id;typeof M[z]>"u"&&(M[z]=[]),M[z]=M[z].concat(F)}Object.keys(M).forEach(function(G){if(M[G].length>1){var V="DummyCompound_"+G;D.memberGroups[V]=M[G];var te=M[G][0].getParent(),ie=new f(D.graphManager);ie.id=V,ie.paddingLeft=te.paddingLeft||0,ie.paddingRight=te.paddingRight||0,ie.paddingBottom=te.paddingBottom||0,ie.paddingTop=te.paddingTop||0,D.idToDummyNode[V]=ie;var ne=D.getGraphManager().add(D.newGraph(),ie),X=te.getChild();X.add(ie);for(var q=0;q<M[G].length;q++){var Y=M[G][q];X.remove(Y),ne.add(Y)}}})},O.prototype.clearCompounds=function(){var D={},M={};this.performDFSOnCompounds();for(var U=0;U<this.compoundOrder.length;U++)M[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,M)},O.prototype.clearZeroDegreeMembers=function(){var D=this,M=this.tiledZeroDegreePack=[];Object.keys(this.memberGroups).forEach(function(U){var H=D.idToDummyNode[U];if(M[U]=D.tileNodes(D.memberGroups[U],H.paddingLeft+H.paddingRight),H.rect.width=M[U].width,H.rect.height=M[U].height,H.setCenter(M[U].centerX,M[U].centerY),H.labelMarginLeft=0,H.labelMarginTop=0,_.NODE_DIMENSIONS_INCLUDE_LABELS){var $=H.rect.width,F=H.rect.height;H.labelWidth&&(H.labelPosHorizontal=="left"?(H.rect.x-=H.labelWidth,H.setWidth($+H.labelWidth),H.labelMarginLeft=H.labelWidth):H.labelPosHorizontal=="center"&&H.labelWidth>$?(H.rect.x-=(H.labelWidth-$)/2,H.setWidth(H.labelWidth),H.labelMarginLeft=(H.labelWidth-$)/2):H.labelPosHorizontal=="right"&&H.setWidth($+H.labelWidth)),H.labelHeight&&(H.labelPosVertical=="top"?(H.rect.y-=H.labelHeight,H.setHeight(F+H.labelHeight),H.labelMarginTop=H.labelHeight):H.labelPosVertical=="center"&&H.labelHeight>F?(H.rect.y-=(H.labelHeight-F)/2,H.setHeight(H.labelHeight),H.labelMarginTop=(H.labelHeight-F)/2):H.labelPosVertical=="bottom"&&H.setHeight(F+H.labelHeight))}})},O.prototype.repopulateCompounds=function(){for(var D=this.compoundOrder.length-1;D>=0;D--){var M=this.compoundOrder[D],U=M.id,H=M.paddingLeft,$=M.paddingTop,F=M.labelMarginLeft,P=M.labelMarginTop;this.adjustLocations(this.tiledMemberPack[U],M.rect.x,M.rect.y,H,$,F,P)}},O.prototype.repopulateZeroDegreeMembers=function(){var D=this,M=this.tiledZeroDegreePack;Object.keys(M).forEach(function(U){var H=D.idToDummyNode[U],$=H.paddingLeft,F=H.paddingTop,P=H.labelMarginLeft,z=H.labelMarginTop;D.adjustLocations(M[U],H.rect.x,H.rect.y,$,F,P,z)})},O.prototype.getToBeTiled=function(D){var M=D.id;if(this.toBeTiled[M]!=null)return this.toBeTiled[M];var U=D.getChild();if(U==null)return this.toBeTiled[M]=!1,!1;for(var H=U.getNodes(),$=0;$<H.length;$++){var F=H[$];if(this.getNodeDegree(F)>0)return this.toBeTiled[M]=!1,!1;if(F.getChild()==null){this.toBeTiled[F.id]=!1;continue}if(!this.getToBeTiled(F))return this.toBeTiled[M]=!1,!1}return this.toBeTiled[M]=!0,!0},O.prototype.getNodeDegree=function(D){D.id;for(var M=D.getEdges(),U=0,H=0;H<M.length;H++){var $=M[H];$.getSource().id!==$.getTarget().id&&(U=U+1)}return U},O.prototype.getNodeDegreeWithChildren=function(D){var M=this.getNodeDegree(D);if(D.getChild()==null)return M;for(var U=D.getChild().getNodes(),H=0;H<U.length;H++){var $=U[H];M+=this.getNodeDegreeWithChildren($)}return M},O.prototype.performDFSOnCompounds=function(){this.compoundOrder=[],this.fillCompexOrderByDFS(this.graphManager.getRoot().getNodes())},O.prototype.fillCompexOrderByDFS=function(D){for(var M=0;M<D.length;M++){var U=D[M];U.getChild()!=null&&this.fillCompexOrderByDFS(U.getChild().getNodes()),this.getToBeTiled(U)&&this.compoundOrder.push(U)}},O.prototype.adjustLocations=function(D,M,U,H,$,F,P){M+=H+F,U+=$+P;for(var z=M,G=0;G<D.rows.length;G++){var V=D.rows[G];M=z;for(var te=0,ie=0;ie<V.length;ie++){var ne=V[ie];ne.rect.x=M,ne.rect.y=U,M+=ne.rect.width+D.horizontalPadding,ne.rect.height>te&&(te=ne.rect.height)}U+=te+D.verticalPadding}},O.prototype.tileCompoundMembers=function(D,M){var U=this;this.tiledMemberPack=[],Object.keys(D).forEach(function(H){var $=M[H];if(U.tiledMemberPack[H]=U.tileNodes(D[H],$.paddingLeft+$.paddingRight),$.rect.width=U.tiledMemberPack[H].width,$.rect.height=U.tiledMemberPack[H].height,$.setCenter(U.tiledMemberPack[H].centerX,U.tiledMemberPack[H].centerY),$.labelMarginLeft=0,$.labelMarginTop=0,_.NODE_DIMENSIONS_INCLUDE_LABELS){var F=$.rect.width,P=$.rect.height;$.labelWidth&&($.labelPosHorizontal=="left"?($.rect.x-=$.labelWidth,$.setWidth(F+$.labelWidth),$.labelMarginLeft=$.labelWidth):$.labelPosHorizontal=="center"&&$.labelWidth>F?($.rect.x-=($.labelWidth-F)/2,$.setWidth($.labelWidth),$.labelMarginLeft=($.labelWidth-F)/2):$.labelPosHorizontal=="right"&&$.setWidth(F+$.labelWidth)),$.labelHeight&&($.labelPosVertical=="top"?($.rect.y-=$.labelHeight,$.setHeight(P+$.labelHeight),$.labelMarginTop=$.labelHeight):$.labelPosVertical=="center"&&$.labelHeight>P?($.rect.y-=($.labelHeight-P)/2,$.setHeight($.labelHeight),$.labelMarginTop=($.labelHeight-P)/2):$.labelPosVertical=="bottom"&&$.setHeight(P+$.labelHeight))}})},O.prototype.tileNodes=function(D,M){var U=this.tileNodesByFavoringDim(D,M,!0),H=this.tileNodesByFavoringDim(D,M,!1),$=this.getOrgRatio(U),F=this.getOrgRatio(H),P;return F<$?P=H:P=U,P},O.prototype.getOrgRatio=function(D){var M=D.width,U=D.height,H=M/U;return H<1&&(H=1/H),H},O.prototype.calcIdealRowWidth=function(D,M){var U=_.TILING_PADDING_VERTICAL,H=_.TILING_PADDING_HORIZONTAL,$=D.length,F=0,P=0,z=0;D.forEach(function(q){F+=q.getWidth(),P+=q.getHeight(),q.getWidth()>z&&(z=q.getWidth())});var G=F/$,V=P/$,te=Math.pow(U-H,2)+4*(G+H)*(V+U)*$,ie=(H-U+Math.sqrt(te))/(2*(G+H)),ne;M?(ne=Math.ceil(ie),ne==ie&&ne++):ne=Math.floor(ie);var X=ne*(G+H)-H;return z>X&&(X=z),X+=H*2,X},O.prototype.tileNodesByFavoringDim=function(D,M,U){var H=_.TILING_PADDING_VERTICAL,$=_.TILING_PADDING_HORIZONTAL,F=_.TILING_COMPARE_BY,P={rows:[],rowWidth:[],rowHeight:[],width:0,height:M,verticalPadding:H,horizontalPadding:$,centerX:0,centerY:0};F&&(P.idealRowWidth=this.calcIdealRowWidth(D,U));var z=function(Y){return Y.rect.width*Y.rect.height},G=function(Y,K){return z(K)-z(Y)};D.sort(function(q,Y){var K=G;return P.idealRowWidth?(K=F,K(q.id,Y.id)):K(q,Y)});for(var V=0,te=0,ie=0;ie<D.length;ie++){var ne=D[ie];V+=ne.getCenterX(),te+=ne.getCenterY()}P.centerX=V/D.length,P.centerY=te/D.length;for(var ie=0;ie<D.length;ie++){var ne=D[ie];if(P.rows.length==0)this.insertNodeToRow(P,ne,0,M);else if(this.canAddHorizontal(P,ne.rect.width,ne.rect.height)){var X=P.rows.length-1;P.idealRowWidth||(X=this.getShortestRowIndex(P)),this.insertNodeToRow(P,ne,X,M)}else this.insertNodeToRow(P,ne,P.rows.length,M);this.shiftToLastRow(P)}return P},O.prototype.insertNodeToRow=function(D,M,U,H){var $=H;if(U==D.rows.length){var F=[];D.rows.push(F),D.rowWidth.push($),D.rowHeight.push(0)}var P=D.rowWidth[U]+M.rect.width;D.rows[U].length>0&&(P+=D.horizontalPadding),D.rowWidth[U]=P,D.width<P&&(D.width=P);var z=M.rect.height;U>0&&(z+=D.verticalPadding);var G=0;z>D.rowHeight[U]&&(G=D.rowHeight[U],D.rowHeight[U]=z,G=D.rowHeight[U]-G),D.height+=G,D.rows[U].push(M)},O.prototype.getShortestRowIndex=function(D){for(var M=-1,U=Number.MAX_VALUE,H=0;H<D.rows.length;H++)D.rowWidth[H]<U&&(M=H,U=D.rowWidth[H]);return M},O.prototype.getLongestRowIndex=function(D){for(var M=-1,U=Number.MIN_VALUE,H=0;H<D.rows.length;H++)D.rowWidth[H]>U&&(M=H,U=D.rowWidth[H]);return M},O.prototype.canAddHorizontal=function(D,M,U){if(D.idealRowWidth){var H=D.rows.length-1,$=D.rowWidth[H];return $+M+D.horizontalPadding<=D.idealRowWidth}var F=this.getShortestRowIndex(D);if(F<0)return!0;var P=D.rowWidth[F];if(P+D.horizontalPadding+M<=D.width)return!0;var z=0;D.rowHeight[F]<U&&F>0&&(z=U+D.verticalPadding-D.rowHeight[F]);var G;D.width-P>=M+D.horizontalPadding?G=(D.height+z)/(P+M+D.horizontalPadding):G=(D.height+z)/D.width,z=U+D.verticalPadding;var V;return D.width<M?V=(D.height+z)/M:V=(D.height+z)/D.width,V<1&&(V=1/V),G<1&&(G=1/G),G<V},O.prototype.shiftToLastRow=function(D){var M=this.getLongestRowIndex(D),U=D.rowWidth.length-1,H=D.rows[M],$=H[H.length-1],F=$.width+D.horizontalPadding;if(D.width-D.rowWidth[U]>F&&M!=U){H.splice(-1,1),D.rows[U].push($),D.rowWidth[M]=D.rowWidth[M]-F,D.rowWidth[U]=D.rowWidth[U]+F,D.width=D.rowWidth[instance.getLongestRowIndex(D)];for(var P=Number.MIN_VALUE,z=0;z<H.length;z++)H[z].height>P&&(P=H[z].height);M>0&&(P+=D.verticalPadding);var G=D.rowHeight[M]+D.rowHeight[U];D.rowHeight[M]=P,D.rowHeight[U]<$.height+D.verticalPadding&&(D.rowHeight[U]=$.height+D.verticalPadding);var V=D.rowHeight[M]+D.rowHeight[U];D.height+=V-G,this.shiftToLastRow(D)}},O.prototype.tilingPreLayout=function(){_.TILE&&(this.groupZeroDegreeMembers(),this.clearCompounds(),this.clearZeroDegreeMembers())},O.prototype.tilingPostLayout=function(){_.TILE&&(this.repopulateZeroDegreeMembers(),this.repopulateCompounds())},O.prototype.reduceTrees=function(){for(var D=[],M=!0,U;M;){var H=this.graphManager.getAllNodes(),$=[];M=!1;for(var F=0;F<H.length;F++)if(U=H[F],U.getEdges().length==1&&!U.getEdges()[0].isInterGraph&&U.getChild()==null){if(_.PURE_INCREMENTAL){var P=U.getEdges()[0].getOtherEnd(U),z=new T(U.getCenterX()-P.getCenterX(),U.getCenterY()-P.getCenterY());$.push([U,U.getEdges()[0],U.getOwner(),z])}else $.push([U,U.getEdges()[0],U.getOwner()]);M=!0}if(M==!0){for(var G=[],V=0;V<$.length;V++)$[V][0].getEdges().length==1&&(G.push($[V]),$[V][0].getOwner().remove($[V][0]));D.push(G),this.graphManager.resetAllNodes(),this.graphManager.resetAllEdges()}}this.prunedNodesAll=D},O.prototype.growTree=function(D){for(var M=D.length,U=D[M-1],H,$=0;$<U.length;$++)H=U[$],this.findPlaceforPrunedNode(H),H[2].add(H[0]),H[2].add(H[1],H[1].source,H[1].target);D.splice(D.length-1,1),this.graphManager.resetAllNodes(),this.graphManager.resetAllEdges()},O.prototype.findPlaceforPrunedNode=function(D){var M,U,H=D[0];if(H==D[1].source?U=D[1].target:U=D[1].source,_.PURE_INCREMENTAL)H.setCenter(U.getCenterX()+D[3].getWidth(),U.getCenterY()+D[3].getHeight());else{var $=U.startX,F=U.finishX,P=U.startY,z=U.finishY,G=0,V=0,te=0,ie=0,ne=[G,te,V,ie];if(P>0)for(var X=$;X<=F;X++)ne[0]+=this.grid[X][P-1].length+this.grid[X][P].length-1;if(F<this.grid.length-1)for(var X=P;X<=z;X++)ne[1]+=this.grid[F+1][X].length+this.grid[F][X].length-1;if(z<this.grid[0].length-1)for(var X=$;X<=F;X++)ne[2]+=this.grid[X][z+1].length+this.grid[X][z].length-1;if($>0)for(var X=P;X<=z;X++)ne[3]+=this.grid[$-1][X].length+this.grid[$][X].length-1;for(var q=E.MAX_VALUE,Y,K,ee=0;ee<ne.length;ee++)ne[ee]<q?(q=ne[ee],Y=1,K=ee):ne[ee]==q&&Y++;if(Y==3&&q==0)ne[0]==0&&ne[1]==0&&ne[2]==0?M=1:ne[0]==0&&ne[1]==0&&ne[3]==0?M=0:ne[0]==0&&ne[2]==0&&ne[3]==0?M=3:ne[1]==0&&ne[2]==0&&ne[3]==0&&(M=2);else if(Y==2&&q==0){var re=Math.floor(Math.random()*2);ne[0]==0&&ne[1]==0?re==0?M=0:M=1:ne[0]==0&&ne[2]==0?re==0?M=0:M=2:ne[0]==0&&ne[3]==0?re==0?M=0:M=3:ne[1]==0&&ne[2]==0?re==0?M=1:M=2:ne[1]==0&&ne[3]==0?re==0?M=1:M=3:re==0?M=2:M=3}else if(Y==4&&q==0){var re=Math.floor(Math.random()*4);M=re}else M=K;M==0?H.setCenter(U.getCenterX(),U.getCenterY()-U.getHeight()/2-m.DEFAULT_EDGE_LENGTH-H.getHeight()/2):M==1?H.setCenter(U.getCenterX()+U.getWidth()/2+m.DEFAULT_EDGE_LENGTH+H.getWidth()/2,U.getCenterY()):M==2?H.setCenter(U.getCenterX(),U.getCenterY()+U.getHeight()/2+m.DEFAULT_EDGE_LENGTH+H.getHeight()/2):H.setCenter(U.getCenterX()-U.getWidth()/2-m.DEFAULT_EDGE_LENGTH-H.getWidth()/2,U.getCenterY())}},a.exports=O}),991:((a,l,u)=>{var c=u(551).FDLayoutNode,d=u(551).IMath;function g(y,_,v,m){c.call(this,y,_,v,m)}g.prototype=Object.create(c.prototype);for(var f in c)g[f]=c[f];g.prototype.calculateDisplacement=function(){var y=this.graphManager.getLayout();this.getChild()!=null&&this.fixedNodeWeight?(this.displacementX+=y.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.fixedNodeWeight,this.displacementY+=y.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.fixedNodeWeight):(this.displacementX+=y.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.noOfChildren,this.displacementY+=y.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.noOfChildren),Math.abs(this.displacementX)>y.coolingFactor*y.maxNodeDisplacement&&(this.displacementX=y.coolingFactor*y.maxNodeDisplacement*d.sign(this.displacementX)),Math.abs(this.displacementY)>y.coolingFactor*y.maxNodeDisplacement&&(this.displacementY=y.coolingFactor*y.maxNodeDisplacement*d.sign(this.displacementY)),this.child&&this.child.getNodes().length>0&&this.propogateDisplacementToChildren(this.displacementX,this.displacementY)},g.prototype.propogateDisplacementToChildren=function(y,_){for(var v=this.getChild().getNodes(),m,x=0;x<v.length;x++)m=v[x],m.getChild()==null?(m.displacementX+=y,m.displacementY+=_):m.propogateDisplacementToChildren(y,_)},g.prototype.move=function(){var y=this.graphManager.getLayout();(this.child==null||this.child.getNodes().length==0)&&(this.moveBy(this.displacementX,this.displacementY),y.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},g.prototype.setPred1=function(y){this.pred1=y},g.prototype.getPred1=function(){return pred1},g.prototype.getPred2=function(){return pred2},g.prototype.setNext=function(y){this.next=y},g.prototype.getNext=function(){return next},g.prototype.setProcessed=function(y){this.processed=y},g.prototype.isProcessed=function(){return processed},a.exports=g}),902:((a,l,u)=>{function c(v){if(Array.isArray(v)){for(var m=0,x=Array(v.length);m<v.length;m++)x[m]=v[m];return x}else return Array.from(v)}var d=u(806),g=u(551).LinkedList,f=u(551).Matrix,y=u(551).SVD;function _(){}_.handleConstraints=function(v){var m={};m.fixedNodeConstraint=v.constraints.fixedNodeConstraint,m.alignmentConstraint=v.constraints.alignmentConstraint,m.relativePlacementConstraint=v.constraints.relativePlacementConstraint;for(var x=new Map,b=new Map,S=[],T=[],N=v.getAllNodes(),E=0,k=0;k<N.length;k++){var L=N[k];L.getChild()==null&&(b.set(L.id,E++),S.push(L.getCenterX()),T.push(L.getCenterY()),x.set(L.id,L))}m.relativePlacementConstraint&&m.relativePlacementConstraint.forEach(function(ae){!ae.gap&&ae.gap!=0&&(ae.left?ae.gap=d.DEFAULT_EDGE_LENGTH+x.get(ae.left).getWidth()/2+x.get(ae.right).getWidth()/2:ae.gap=d.DEFAULT_EDGE_LENGTH+x.get(ae.top).getHeight()/2+x.get(ae.bottom).getHeight()/2)});var A=function(se,ce){return{x:se.x-ce.x,y:se.y-ce.y}},I=function(se){var ce=0,de=0;return se.forEach(function(oe){ce+=S[b.get(oe)],de+=T[b.get(oe)]}),{x:ce/se.size,y:de/se.size}},O=function(se,ce,de,oe,ye){function Se(Je,Ze){var ut=new Set(Je),et=!0,Ye=!1,Ct=void 0;try{for(var ht=Ze[Symbol.iterator](),lt;!(et=(lt=ht.next()).done);et=!0){var Bt=lt.value;ut.add(Bt)}}catch(Et){Ye=!0,Ct=Et}finally{try{!et&&ht.return&&ht.return()}finally{if(Ye)throw Ct}}return ut}var ke=new Map;se.forEach(function(Je,Ze){ke.set(Ze,0)}),se.forEach(function(Je,Ze){Je.forEach(function(ut){ke.set(ut.id,ke.get(ut.id)+1)})});var De=new Map,Ne=new Map,Ae=new g;ke.forEach(function(Je,Ze){Je==0?(Ae.push(Ze),de||(ce=="horizontal"?De.set(Ze,b.has(Ze)?S[b.get(Ze)]:oe.get(Ze)):De.set(Ze,b.has(Ze)?T[b.get(Ze)]:oe.get(Ze)))):De.set(Ze,Number.NEGATIVE_INFINITY),de&&Ne.set(Ze,new Set([Ze]))}),de&&ye.forEach(function(Je){var Ze=[];if(Je.forEach(function(Ye){de.has(Ye)&&Ze.push(Ye)}),Ze.length>0){var ut=0;Ze.forEach(function(Ye){ce=="horizontal"?(De.set(Ye,b.has(Ye)?S[b.get(Ye)]:oe.get(Ye)),ut+=De.get(Ye)):(De.set(Ye,b.has(Ye)?T[b.get(Ye)]:oe.get(Ye)),ut+=De.get(Ye))}),ut=ut/Ze.length,Je.forEach(function(Ye){de.has(Ye)||De.set(Ye,ut)})}else{var et=0;Je.forEach(function(Ye){ce=="horizontal"?et+=b.has(Ye)?S[b.get(Ye)]:oe.get(Ye):et+=b.has(Ye)?T[b.get(Ye)]:oe.get(Ye)}),et=et/Je.length,Je.forEach(function(Ye){De.set(Ye,et)})}});for(var Qe=function(){var Ze=Ae.shift(),ut=se.get(Ze);ut.forEach(function(et){if(De.get(et.id)<De.get(Ze)+et.gap)if(de&&de.has(et.id)){var Ye=void 0;if(ce=="horizontal"?Ye=b.has(et.id)?S[b.get(et.id)]:oe.get(et.id):Ye=b.has(et.id)?T[b.get(et.id)]:oe.get(et.id),De.set(et.id,Ye),Ye<De.get(Ze)+et.gap){var Ct=De.get(Ze)+et.gap-Ye;Ne.get(Ze).forEach(function(ht){De.set(ht,De.get(ht)-Ct)})}}else De.set(et.id,De.get(Ze)+et.gap);ke.set(et.id,ke.get(et.id)-1),ke.get(et.id)==0&&Ae.push(et.id),de&&Ne.set(et.id,Se(Ne.get(Ze),Ne.get(et.id)))})};Ae.length!=0;)Qe();if(de){var Xe=new Set;se.forEach(function(Je,Ze){Je.length==0&&Xe.add(Ze)});var mt=[];Ne.forEach(function(Je,Ze){if(Xe.has(Ze)){var ut=!1,et=!0,Ye=!1,Ct=void 0;try{for(var ht=Je[Symbol.iterator](),lt;!(et=(lt=ht.next()).done);et=!0){var Bt=lt.value;de.has(Bt)&&(ut=!0)}}catch(Mt){Ye=!0,Ct=Mt}finally{try{!et&&ht.return&&ht.return()}finally{if(Ye)throw Ct}}if(!ut){var Et=!1,$t=void 0;mt.forEach(function(Mt,pr){Mt.has([].concat(c(Je))[0])&&(Et=!0,$t=pr)}),Et?Je.forEach(function(Mt){mt[$t].add(Mt)}):mt.push(new Set(Je))}}}),mt.forEach(function(Je,Ze){var ut=Number.POSITIVE_INFINITY,et=Number.POSITIVE_INFINITY,Ye=Number.NEGATIVE_INFINITY,Ct=Number.NEGATIVE_INFINITY,ht=!0,lt=!1,Bt=void 0;try{for(var Et=Je[Symbol.iterator](),$t;!(ht=($t=Et.next()).done);ht=!0){var Mt=$t.value,pr=void 0;ce=="horizontal"?pr=b.has(Mt)?S[b.get(Mt)]:oe.get(Mt):pr=b.has(Mt)?T[b.get(Mt)]:oe.get(Mt);var ar=De.get(Mt);pr<ut&&(ut=pr),pr>Ye&&(Ye=pr),ar<et&&(et=ar),ar>Ct&&(Ct=ar)}}catch(Dn){lt=!0,Bt=Dn}finally{try{!ht&&Et.return&&Et.return()}finally{if(lt)throw Bt}}var rr=(ut+Ye)/2-(et+Ct)/2,jt=!0,Gr=!1,ur=void 0;try{for(var xn=Je[Symbol.iterator](),si;!(jt=(si=xn.next()).done);jt=!0){var Ln=si.value;De.set(Ln,De.get(Ln)+rr)}}catch(Dn){Gr=!0,ur=Dn}finally{try{!jt&&xn.return&&xn.return()}finally{if(Gr)throw ur}}})}return De},B=function(se){var ce=0,de=0,oe=0,ye=0;if(se.forEach(function(Ne){Ne.left?S[b.get(Ne.left)]-S[b.get(Ne.right)]>=0?ce++:de++:T[b.get(Ne.top)]-T[b.get(Ne.bottom)]>=0?oe++:ye++}),ce>de&&oe>ye)for(var Se=0;Se<b.size;Se++)S[Se]=-1*S[Se],T[Se]=-1*T[Se];else if(ce>de)for(var ke=0;ke<b.size;ke++)S[ke]=-1*S[ke];else if(oe>ye)for(var De=0;De<b.size;De++)T[De]=-1*T[De]},D=function(se){var ce=[],de=new g,oe=new Set,ye=0;return se.forEach(function(Se,ke){if(!oe.has(ke)){ce[ye]=[];var De=ke;for(de.push(De),oe.add(De),ce[ye].push(De);de.length!=0;){De=de.shift();var Ne=se.get(De);Ne.forEach(function(Ae){oe.has(Ae.id)||(de.push(Ae.id),oe.add(Ae.id),ce[ye].push(Ae.id))})}ye++}}),ce},M=function(se){var ce=new Map;return se.forEach(function(de,oe){ce.set(oe,[])}),se.forEach(function(de,oe){de.forEach(function(ye){ce.get(oe).push(ye),ce.get(ye.id).push({id:oe,gap:ye.gap,direction:ye.direction})})}),ce},U=function(se){var ce=new Map;return se.forEach(function(de,oe){ce.set(oe,[])}),se.forEach(function(de,oe){de.forEach(function(ye){ce.get(ye.id).push({id:oe,gap:ye.gap,direction:ye.direction})})}),ce},H=[],$=[],F=!1,P=!1,z=new Set,G=new Map,V=new Map,te=[];if(m.fixedNodeConstraint&&m.fixedNodeConstraint.forEach(function(ae){z.add(ae.nodeId)}),m.relativePlacementConstraint&&(m.relativePlacementConstraint.forEach(function(ae){ae.left?(G.has(ae.left)?G.get(ae.left).push({id:ae.right,gap:ae.gap,direction:"horizontal"}):G.set(ae.left,[{id:ae.right,gap:ae.gap,direction:"horizontal"}]),G.has(ae.right)||G.set(ae.right,[])):(G.has(ae.top)?G.get(ae.top).push({id:ae.bottom,gap:ae.gap,direction:"vertical"}):G.set(ae.top,[{id:ae.bottom,gap:ae.gap,direction:"vertical"}]),G.has(ae.bottom)||G.set(ae.bottom,[]))}),V=M(G),te=D(V)),d.TRANSFORM_ON_CONSTRAINT_HANDLING){if(m.fixedNodeConstraint&&m.fixedNodeConstraint.length>1)m.fixedNodeConstraint.forEach(function(ae,se){H[se]=[ae.position.x,ae.position.y],$[se]=[S[b.get(ae.nodeId)],T[b.get(ae.nodeId)]]}),F=!0;else if(m.alignmentConstraint)(function(){var ae=0;if(m.alignmentConstraint.vertical){for(var se=m.alignmentConstraint.vertical,ce=function(De){var Ne=new Set;se[De].forEach(function(Xe){Ne.add(Xe)});var Ae=new Set([].concat(c(Ne)).filter(function(Xe){return z.has(Xe)})),Qe=void 0;Ae.size>0?Qe=S[b.get(Ae.values().next().value)]:Qe=I(Ne).x,se[De].forEach(function(Xe){H[ae]=[Qe,T[b.get(Xe)]],$[ae]=[S[b.get(Xe)],T[b.get(Xe)]],ae++})},de=0;de<se.length;de++)ce(de);F=!0}if(m.alignmentConstraint.horizontal){for(var oe=m.alignmentConstraint.horizontal,ye=function(De){var Ne=new Set;oe[De].forEach(function(Xe){Ne.add(Xe)});var Ae=new Set([].concat(c(Ne)).filter(function(Xe){return z.has(Xe)})),Qe=void 0;Ae.size>0?Qe=S[b.get(Ae.values().next().value)]:Qe=I(Ne).y,oe[De].forEach(function(Xe){H[ae]=[S[b.get(Xe)],Qe],$[ae]=[S[b.get(Xe)],T[b.get(Xe)]],ae++})},Se=0;Se<oe.length;Se++)ye(Se);F=!0}m.relativePlacementConstraint&&(P=!0)})();else if(m.relativePlacementConstraint){for(var ie=0,ne=0,X=0;X<te.length;X++)te[X].length>ie&&(ie=te[X].length,ne=X);if(ie<V.size/2)B(m.relativePlacementConstraint),F=!1,P=!1;else{var q=new Map,Y=new Map,K=[];te[ne].forEach(function(ae){G.get(ae).forEach(function(se){se.direction=="horizontal"?(q.has(ae)?q.get(ae).push(se):q.set(ae,[se]),q.has(se.id)||q.set(se.id,[]),K.push({left:ae,right:se.id})):(Y.has(ae)?Y.get(ae).push(se):Y.set(ae,[se]),Y.has(se.id)||Y.set(se.id,[]),K.push({top:ae,bottom:se.id}))})}),B(K),P=!1;var ee=O(q,"horizontal"),re=O(Y,"vertical");te[ne].forEach(function(ae,se){$[se]=[S[b.get(ae)],T[b.get(ae)]],H[se]=[],ee.has(ae)?H[se][0]=ee.get(ae):H[se][0]=S[b.get(ae)],re.has(ae)?H[se][1]=re.get(ae):H[se][1]=T[b.get(ae)]}),F=!0}}if(F){for(var ue=void 0,pe=f.transpose(H),Re=f.transpose($),Be=0;Be<pe.length;Be++)pe[Be]=f.multGamma(pe[Be]),Re[Be]=f.multGamma(Re[Be]);var _e=f.multMat(pe,f.transpose(Re)),Te=y.svd(_e);ue=f.multMat(Te.V,f.transpose(Te.U));for(var Le=0;Le<b.size;Le++){var Ee=[S[Le],T[Le]],Pe=[ue[0][0],ue[1][0]],ze=[ue[0][1],ue[1][1]];S[Le]=f.dotProduct(Ee,Pe),T[Le]=f.dotProduct(Ee,ze)}P&&B(m.relativePlacementConstraint)}}if(d.ENFORCE_CONSTRAINTS){if(m.fixedNodeConstraint&&m.fixedNodeConstraint.length>0){var Me={x:0,y:0};m.fixedNodeConstraint.forEach(function(ae,se){var ce={x:S[b.get(ae.nodeId)],y:T[b.get(ae.nodeId)]},de=ae.position,oe=A(de,ce);Me.x+=oe.x,Me.y+=oe.y}),Me.x/=m.fixedNodeConstraint.length,Me.y/=m.fixedNodeConstraint.length,S.forEach(function(ae,se){S[se]+=Me.x}),T.forEach(function(ae,se){T[se]+=Me.y}),m.fixedNodeConstraint.forEach(function(ae){S[b.get(ae.nodeId)]=ae.position.x,T[b.get(ae.nodeId)]=ae.position.y})}if(m.alignmentConstraint){if(m.alignmentConstraint.vertical)for(var Ue=m.alignmentConstraint.vertical,Ge=function(se){var ce=new Set;Ue[se].forEach(function(ye){ce.add(ye)});var de=new Set([].concat(c(ce)).filter(function(ye){return z.has(ye)})),oe=void 0;de.size>0?oe=S[b.get(de.values().next().value)]:oe=I(ce).x,ce.forEach(function(ye){z.has(ye)||(S[b.get(ye)]=oe)})},ve=0;ve<Ue.length;ve++)Ge(ve);if(m.alignmentConstraint.horizontal)for(var Ce=m.alignmentConstraint.horizontal,Ie=function(se){var ce=new Set;Ce[se].forEach(function(ye){ce.add(ye)});var de=new Set([].concat(c(ce)).filter(function(ye){return z.has(ye)})),oe=void 0;de.size>0?oe=T[b.get(de.values().next().value)]:oe=I(ce).y,ce.forEach(function(ye){z.has(ye)||(T[b.get(ye)]=oe)})},me=0;me<Ce.length;me++)Ie(me)}m.relativePlacementConstraint&&(function(){var ae=new Map,se=new Map,ce=new Map,de=new Map,oe=new Map,ye=new Map,Se=new Set,ke=new Set;if(z.forEach(function(Tt){Se.add(Tt),ke.add(Tt)}),m.alignmentConstraint){if(m.alignmentConstraint.vertical)for(var De=m.alignmentConstraint.vertical,Ne=function(ct){ce.set("dummy"+ct,[]),De[ct].forEach(function(Nt){ae.set(Nt,"dummy"+ct),ce.get("dummy"+ct).push(Nt),z.has(Nt)&&Se.add("dummy"+ct)}),oe.set("dummy"+ct,S[b.get(De[ct][0])])},Ae=0;Ae<De.length;Ae++)Ne(Ae);if(m.alignmentConstraint.horizontal)for(var Qe=m.alignmentConstraint.horizontal,Xe=function(ct){de.set("dummy"+ct,[]),Qe[ct].forEach(function(Nt){se.set(Nt,"dummy"+ct),de.get("dummy"+ct).push(Nt),z.has(Nt)&&ke.add("dummy"+ct)}),ye.set("dummy"+ct,T[b.get(Qe[ct][0])])},mt=0;mt<Qe.length;mt++)Xe(mt)}var Je=new Map,Ze=new Map,ut=function(ct){G.get(ct).forEach(function(Nt){var Yt=void 0,Kt=void 0;Nt.direction=="horizontal"?(Yt=ae.get(ct)?ae.get(ct):ct,ae.get(Nt.id)?Kt={id:ae.get(Nt.id),gap:Nt.gap,direction:Nt.direction}:Kt=Nt,Je.has(Yt)?Je.get(Yt).push(Kt):Je.set(Yt,[Kt]),Je.has(Kt.id)||Je.set(Kt.id,[])):(Yt=se.get(ct)?se.get(ct):ct,se.get(Nt.id)?Kt={id:se.get(Nt.id),gap:Nt.gap,direction:Nt.direction}:Kt=Nt,Ze.has(Yt)?Ze.get(Yt).push(Kt):Ze.set(Yt,[Kt]),Ze.has(Kt.id)||Ze.set(Kt.id,[]))})},et=!0,Ye=!1,Ct=void 0;try{for(var ht=G.keys()[Symbol.iterator](),lt;!(et=(lt=ht.next()).done);et=!0){var Bt=lt.value;ut(Bt)}}catch(Tt){Ye=!0,Ct=Tt}finally{try{!et&&ht.return&&ht.return()}finally{if(Ye)throw Ct}}var Et=M(Je),$t=M(Ze),Mt=D(Et),pr=D($t),ar=U(Je),rr=U(Ze),jt=[],Gr=[];Mt.forEach(function(Tt,ct){jt[ct]=[],Tt.forEach(function(Nt){ar.get(Nt).length==0&&jt[ct].push(Nt)})}),pr.forEach(function(Tt,ct){Gr[ct]=[],Tt.forEach(function(Nt){rr.get(Nt).length==0&&Gr[ct].push(Nt)})});var ur=O(Je,"horizontal",Se,oe,jt),xn=O(Ze,"vertical",ke,ye,Gr),si=function(ct){ce.get(ct)?ce.get(ct).forEach(function(Nt){S[b.get(Nt)]=ur.get(ct)}):S[b.get(ct)]=ur.get(ct)},Ln=!0,Dn=!1,pa=void 0;try{for(var ga=ur.keys()[Symbol.iterator](),Za;!(Ln=(Za=ga.next()).done);Ln=!0){var Wt=Za.value;si(Wt)}}catch(Tt){Dn=!0,pa=Tt}finally{try{!Ln&&ga.return&&ga.return()}finally{if(Dn)throw pa}}var oi=function(ct){de.get(ct)?de.get(ct).forEach(function(Nt){T[b.get(Nt)]=xn.get(ct)}):T[b.get(ct)]=xn.get(ct)},An=!0,$n=!1,Wn=void 0;try{for(var Ci=xn.keys()[Symbol.iterator](),va;!(An=(va=Ci.next()).done);An=!0){var Wt=va.value;oi(Wt)}}catch(Tt){$n=!0,Wn=Tt}finally{try{!An&&Ci.return&&Ci.return()}finally{if($n)throw Wn}}})()}for(var Z=0;Z<N.length;Z++){var he=N[Z];he.getChild()==null&&he.setCenter(S[b.get(he.id)],T[b.get(he.id)])}},a.exports=_}),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})()})})(Nc)),Nc.exports}var IA=Tc.exports,fb;function OA(){return fb||(fb=1,(function(t,e){(function(n,i){t.exports=i(MA())})(IA,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),d=1;d<u;d++)c[d-1]=arguments[d];return c.forEach(function(g){Object.keys(g).forEach(function(f){return l[f]=g[f]})}),l}}),548:((a,l,u)=>{var c=(function(){function f(y,_){var v=[],m=!0,x=!1,b=void 0;try{for(var S=y[Symbol.iterator](),T;!(m=(T=S.next()).done)&&(v.push(T.value),!(_&&v.length===_));m=!0);}catch(N){x=!0,b=N}finally{try{!m&&S.return&&S.return()}finally{if(x)throw b}}return v}return function(y,_){if(Array.isArray(y))return y;if(Symbol.iterator in Object(y))return f(y,_);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),d=u(140).layoutBase.LinkedList,g={};g.getTopMostNodes=function(f){for(var y={},_=0;_<f.length;_++)y[f[_].id()]=!0;var v=f.filter(function(m,x){typeof m=="number"&&(m=x);for(var b=m.parent()[0];b!=null;){if(y[b.id()])return!1;b=b.parent()[0]}return!0});return v},g.connectComponents=function(f,y,_,v){var m=new d,x=new Set,b=[],S=void 0,T=void 0,N=void 0,E=!1,k=1,L=[],A=[],I=function(){var B=f.collection();A.push(B);var D=_[0],M=f.collection();M.merge(D).merge(D.descendants().intersection(y)),b.push(D),M.forEach(function($){m.push($),x.add($),B.merge($)});for(var U=function(){D=m.shift();var F=f.collection();D.neighborhood().nodes().forEach(function(V){y.intersection(D.edgesWith(V)).length>0&&F.merge(V)});for(var P=0;P<F.length;P++){var z=F[P];if(S=_.intersection(z.union(z.ancestors())),S!=null&&!x.has(S[0])){var G=S.union(S.descendants());G.forEach(function(V){m.push(V),x.add(V),B.merge(V),_.has(V)&&b.push(V)})}}};m.length!=0;)U();if(B.forEach(function($){y.intersection($.connectedEdges()).forEach(function(F){B.has(F.source())&&B.has(F.target())&&B.merge(F)})}),b.length==_.length&&(E=!0),!E||E&&k>1){T=b[0],N=T.connectedEdges().length,b.forEach(function($){$.connectedEdges().length<N&&(N=$.connectedEdges().length,T=$)}),L.push(T.id());var H=f.collection();H.merge(b[0]),b.forEach(function($){H.merge($)}),b=[],_=_.difference(H),k++}};do I();while(!E);return v&&L.length>0&&v.set("dummy"+(v.size+1),L),A},g.relocateComponent=function(f,y,_){if(!_.fixedNodeConstraint){var v=Number.POSITIVE_INFINITY,m=Number.NEGATIVE_INFINITY,x=Number.POSITIVE_INFINITY,b=Number.NEGATIVE_INFINITY;if(_.quality=="draft"){var S=!0,T=!1,N=void 0;try{for(var E=y.nodeIndexes[Symbol.iterator](),k;!(S=(k=E.next()).done);S=!0){var L=k.value,A=c(L,2),I=A[0],O=A[1],B=_.cy.getElementById(I);if(B){var D=B.boundingBox(),M=y.xCoords[O]-D.w/2,U=y.xCoords[O]+D.w/2,H=y.yCoords[O]-D.h/2,$=y.yCoords[O]+D.h/2;M<v&&(v=M),U>m&&(m=U),H<x&&(x=H),$>b&&(b=$)}}}catch(V){T=!0,N=V}finally{try{!S&&E.return&&E.return()}finally{if(T)throw N}}var F=f.x-(m+v)/2,P=f.y-(b+x)/2;y.xCoords=y.xCoords.map(function(V){return V+F}),y.yCoords=y.yCoords.map(function(V){return V+P})}else{Object.keys(y).forEach(function(V){var te=y[V],ie=te.getRect().x,ne=te.getRect().x+te.getRect().width,X=te.getRect().y,q=te.getRect().y+te.getRect().height;ie<v&&(v=ie),ne>m&&(m=ne),X<x&&(x=X),q>b&&(b=q)});var z=f.x-(m+v)/2,G=f.y-(b+x)/2;Object.keys(y).forEach(function(V){var te=y[V];te.setCenter(te.getCenterX()+z,te.getCenterY()+G)})}}},g.calcBoundingBox=function(f,y,_,v){for(var m=Number.MAX_SAFE_INTEGER,x=Number.MIN_SAFE_INTEGER,b=Number.MAX_SAFE_INTEGER,S=Number.MIN_SAFE_INTEGER,T=void 0,N=void 0,E=void 0,k=void 0,L=f.descendants().not(":parent"),A=L.length,I=0;I<A;I++){var O=L[I];T=y[v.get(O.id())]-O.width()/2,N=y[v.get(O.id())]+O.width()/2,E=_[v.get(O.id())]-O.height()/2,k=_[v.get(O.id())]+O.height()/2,m>T&&(m=T),x<N&&(x=N),b>E&&(b=E),S<k&&(S=k)}var B={};return B.topLeftX=m,B.topLeftY=b,B.width=x-m,B.height=S-b,B},g.calcParentsWithoutChildren=function(f,y){var _=f.collection();return y.nodes(":parent").forEach(function(v){var m=!1;v.children().forEach(function(x){x.css("display")!="none"&&(m=!0)}),m||_.merge(v)}),_},a.exports=g}),816:((a,l,u)=>{var c=u(548),d=u(140).CoSELayout,g=u(140).CoSENode,f=u(140).layoutBase.PointD,y=u(140).layoutBase.DimensionD,_=u(140).layoutBase.LayoutConstants,v=u(140).layoutBase.FDLayoutConstants,m=u(140).CoSEConstants,x=function(S,T){var N=S.cy,E=S.eles,k=E.nodes(),L=E.edges(),A=void 0,I=void 0,O=void 0,B={};S.randomize&&(A=T.nodeIndexes,I=T.xCoords,O=T.yCoords);var D=function(V){return typeof V=="function"},M=function(V,te){return D(V)?V(te):V},U=c.calcParentsWithoutChildren(N,E),H=function G(V,te,ie,ne){for(var X=te.length,q=0;q<X;q++){var Y=te[q],K=null;Y.intersection(U).length==0&&(K=Y.children());var ee=void 0,re=Y.layoutDimensions({nodeDimensionsIncludeLabels:ne.nodeDimensionsIncludeLabels});if(Y.outerWidth()!=null&&Y.outerHeight()!=null)if(ne.randomize)if(!Y.isParent())ee=V.add(new g(ie.graphManager,new f(I[A.get(Y.id())]-re.w/2,O[A.get(Y.id())]-re.h/2),new y(parseFloat(re.w),parseFloat(re.h))));else{var ue=c.calcBoundingBox(Y,I,O,A);Y.intersection(U).length==0?ee=V.add(new g(ie.graphManager,new f(ue.topLeftX,ue.topLeftY),new y(ue.width,ue.height))):ee=V.add(new g(ie.graphManager,new f(ue.topLeftX,ue.topLeftY),new y(parseFloat(re.w),parseFloat(re.h))))}else ee=V.add(new g(ie.graphManager,new f(Y.position("x")-re.w/2,Y.position("y")-re.h/2),new y(parseFloat(re.w),parseFloat(re.h))));else ee=V.add(new g(this.graphManager));if(ee.id=Y.data("id"),ee.nodeRepulsion=M(ne.nodeRepulsion,Y),ee.paddingLeft=parseInt(Y.css("padding")),ee.paddingTop=parseInt(Y.css("padding")),ee.paddingRight=parseInt(Y.css("padding")),ee.paddingBottom=parseInt(Y.css("padding")),ne.nodeDimensionsIncludeLabels&&(ee.labelWidth=Y.boundingBox({includeLabels:!0,includeNodes:!1,includeOverlays:!1}).w,ee.labelHeight=Y.boundingBox({includeLabels:!0,includeNodes:!1,includeOverlays:!1}).h,ee.labelPosVertical=Y.css("text-valign"),ee.labelPosHorizontal=Y.css("text-halign")),B[Y.data("id")]=ee,isNaN(ee.rect.x)&&(ee.rect.x=0),isNaN(ee.rect.y)&&(ee.rect.y=0),K!=null&&K.length>0){var pe=void 0;pe=ie.getGraphManager().add(ie.newGraph(),ee),G(pe,K,ie,ne)}}},$=function(V,te,ie){for(var ne=0,X=0,q=0;q<ie.length;q++){var Y=ie[q],K=B[Y.data("source")],ee=B[Y.data("target")];if(K&&ee&&K!==ee&&K.getEdgesBetween(ee).length==0){var re=te.add(V.newEdge(),K,ee);re.id=Y.id(),re.idealLength=M(S.idealEdgeLength,Y),re.edgeElasticity=M(S.edgeElasticity,Y),ne+=re.idealLength,X++}}S.idealEdgeLength!=null&&(X>0?m.DEFAULT_EDGE_LENGTH=v.DEFAULT_EDGE_LENGTH=ne/X:D(S.idealEdgeLength)?m.DEFAULT_EDGE_LENGTH=v.DEFAULT_EDGE_LENGTH=50:m.DEFAULT_EDGE_LENGTH=v.DEFAULT_EDGE_LENGTH=S.idealEdgeLength,m.MIN_REPULSION_DIST=v.MIN_REPULSION_DIST=v.DEFAULT_EDGE_LENGTH/10,m.DEFAULT_RADIAL_SEPARATION=v.DEFAULT_EDGE_LENGTH)},F=function(V,te){te.fixedNodeConstraint&&(V.constraints.fixedNodeConstraint=te.fixedNodeConstraint),te.alignmentConstraint&&(V.constraints.alignmentConstraint=te.alignmentConstraint),te.relativePlacementConstraint&&(V.constraints.relativePlacementConstraint=te.relativePlacementConstraint)};S.nestingFactor!=null&&(m.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=v.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=S.nestingFactor),S.gravity!=null&&(m.DEFAULT_GRAVITY_STRENGTH=v.DEFAULT_GRAVITY_STRENGTH=S.gravity),S.numIter!=null&&(m.MAX_ITERATIONS=v.MAX_ITERATIONS=S.numIter),S.gravityRange!=null&&(m.DEFAULT_GRAVITY_RANGE_FACTOR=v.DEFAULT_GRAVITY_RANGE_FACTOR=S.gravityRange),S.gravityCompound!=null&&(m.DEFAULT_COMPOUND_GRAVITY_STRENGTH=v.DEFAULT_COMPOUND_GRAVITY_STRENGTH=S.gravityCompound),S.gravityRangeCompound!=null&&(m.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=v.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=S.gravityRangeCompound),S.initialEnergyOnIncremental!=null&&(m.DEFAULT_COOLING_FACTOR_INCREMENTAL=v.DEFAULT_COOLING_FACTOR_INCREMENTAL=S.initialEnergyOnIncremental),S.tilingCompareBy!=null&&(m.TILING_COMPARE_BY=S.tilingCompareBy),S.quality=="proof"?_.QUALITY=2:_.QUALITY=0,m.NODE_DIMENSIONS_INCLUDE_LABELS=v.NODE_DIMENSIONS_INCLUDE_LABELS=_.NODE_DIMENSIONS_INCLUDE_LABELS=S.nodeDimensionsIncludeLabels,m.DEFAULT_INCREMENTAL=v.DEFAULT_INCREMENTAL=_.DEFAULT_INCREMENTAL=!S.randomize,m.ANIMATE=v.ANIMATE=_.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=v.DEFAULT_INCREMENTAL=_.DEFAULT_INCREMENTAL=!0,m.PURE_INCREMENTAL=!S.randomize,_.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 d,z=P.newGraphManager();return H(z.addRoot(),c.getTopMostNodes(k),P,S),$(P,z,L),F(P,S),P.runLayout(),B};a.exports={coseLayout:x}}),212:((a,l,u)=>{var c=(function(){function S(T,N){for(var E=0;E<N.length;E++){var k=N[E];k.enumerable=k.enumerable||!1,k.configurable=!0,"value"in k&&(k.writable=!0),Object.defineProperty(T,k.key,k)}}return function(T,N,E){return N&&S(T.prototype,N),E&&S(T,E),T}})();function d(S,T){if(!(S instanceof T))throw new TypeError("Cannot call a class as a function")}var g=u(658),f=u(548),y=u(657),_=y.spectralLayout,v=u(816),m=v.coseLayout,x=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(T){return 4500},idealEdgeLength:function(T){return 50},edgeElasticity:function(T){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(T){d(this,S),this.options=g({},x,T)}return c(S,[{key:"run",value:function(){var N=this,E=this.options,k=E.cy,L=E.eles,A=[],I=[],O=void 0,B=[];E.fixedNodeConstraint&&(!Array.isArray(E.fixedNodeConstraint)||E.fixedNodeConstraint.length==0)&&(E.fixedNodeConstraint=void 0),E.alignmentConstraint&&(E.alignmentConstraint.vertical&&(!Array.isArray(E.alignmentConstraint.vertical)||E.alignmentConstraint.vertical.length==0)&&(E.alignmentConstraint.vertical=void 0),E.alignmentConstraint.horizontal&&(!Array.isArray(E.alignmentConstraint.horizontal)||E.alignmentConstraint.horizontal.length==0)&&(E.alignmentConstraint.horizontal=void 0)),E.relativePlacementConstraint&&(!Array.isArray(E.relativePlacementConstraint)||E.relativePlacementConstraint.length==0)&&(E.relativePlacementConstraint=void 0);var D=E.fixedNodeConstraint||E.alignmentConstraint||E.relativePlacementConstraint;D&&(E.tile=!1,E.packComponents=!1);var M=void 0,U=!1;if(k.layoutUtilities&&E.packComponents&&(M=k.layoutUtilities("get"),M||(M=k.layoutUtilities()),U=!0),L.nodes().length>0)if(U){var F=f.getTopMostNodes(E.eles.nodes());if(O=f.connectComponents(k,E.eles,F),O.forEach(function(_e){var Te=_e.boundingBox();B.push({x:Te.x1+Te.w/2,y:Te.y1+Te.h/2})}),E.randomize&&O.forEach(function(_e){E.eles=_e,A.push(_(E))}),E.quality=="default"||E.quality=="proof"){var P=k.collection();if(E.tile){var z=new Map,G=[],V=[],te=0,ie={nodeIndexes:z,xCoords:G,yCoords:V},ne=[];if(O.forEach(function(_e,Te){_e.edges().length==0&&(_e.nodes().forEach(function(Le,Ee){P.merge(_e.nodes()[Ee]),Le.isParent()||(ie.nodeIndexes.set(_e.nodes()[Ee].id(),te++),ie.xCoords.push(_e.nodes()[0].position().x),ie.yCoords.push(_e.nodes()[0].position().y))}),ne.push(Te))}),P.length>1){var X=P.boundingBox();B.push({x:X.x1+X.w/2,y:X.y1+X.h/2}),O.push(P),A.push(ie);for(var q=ne.length-1;q>=0;q--)O.splice(ne[q],1),A.splice(ne[q],1),B.splice(ne[q],1)}}O.forEach(function(_e,Te){E.eles=_e,I.push(m(E,A[Te])),f.relocateComponent(B[Te],I[Te],E)})}else O.forEach(function(_e,Te){f.relocateComponent(B[Te],A[Te],E)});var Y=new Set;if(O.length>1){var K=[],ee=L.filter(function(_e){return _e.css("display")=="none"});O.forEach(function(_e,Te){var Le=void 0;if(E.quality=="draft"&&(Le=A[Te].nodeIndexes),_e.nodes().not(ee).length>0){var Ee={};Ee.edges=[],Ee.nodes=[];var Pe=void 0;_e.nodes().not(ee).forEach(function(ze){if(E.quality=="draft")if(!ze.isParent())Pe=Le.get(ze.id()),Ee.nodes.push({x:A[Te].xCoords[Pe]-ze.boundingbox().w/2,y:A[Te].yCoords[Pe]-ze.boundingbox().h/2,width:ze.boundingbox().w,height:ze.boundingbox().h});else{var Me=f.calcBoundingBox(ze,A[Te].xCoords,A[Te].yCoords,Le);Ee.nodes.push({x:Me.topLeftX,y:Me.topLeftY,width:Me.width,height:Me.height})}else I[Te][ze.id()]&&Ee.nodes.push({x:I[Te][ze.id()].getLeft(),y:I[Te][ze.id()].getTop(),width:I[Te][ze.id()].getWidth(),height:I[Te][ze.id()].getHeight()})}),_e.edges().forEach(function(ze){var Me=ze.source(),Ue=ze.target();if(Me.css("display")!="none"&&Ue.css("display")!="none")if(E.quality=="draft"){var Ge=Le.get(Me.id()),ve=Le.get(Ue.id()),Ce=[],Ie=[];if(Me.isParent()){var me=f.calcBoundingBox(Me,A[Te].xCoords,A[Te].yCoords,Le);Ce.push(me.topLeftX+me.width/2),Ce.push(me.topLeftY+me.height/2)}else Ce.push(A[Te].xCoords[Ge]),Ce.push(A[Te].yCoords[Ge]);if(Ue.isParent()){var Z=f.calcBoundingBox(Ue,A[Te].xCoords,A[Te].yCoords,Le);Ie.push(Z.topLeftX+Z.width/2),Ie.push(Z.topLeftY+Z.height/2)}else Ie.push(A[Te].xCoords[ve]),Ie.push(A[Te].yCoords[ve]);Ee.edges.push({startX:Ce[0],startY:Ce[1],endX:Ie[0],endY:Ie[1]})}else I[Te][Me.id()]&&I[Te][Ue.id()]&&Ee.edges.push({startX:I[Te][Me.id()].getCenterX(),startY:I[Te][Me.id()].getCenterY(),endX:I[Te][Ue.id()].getCenterX(),endY:I[Te][Ue.id()].getCenterY()})}),Ee.nodes.length>0&&(K.push(Ee),Y.add(Te))}});var re=M.packComponents(K,E.randomize).shifts;if(E.quality=="draft")A.forEach(function(_e,Te){var Le=_e.xCoords.map(function(Pe){return Pe+re[Te].dx}),Ee=_e.yCoords.map(function(Pe){return Pe+re[Te].dy});_e.xCoords=Le,_e.yCoords=Ee});else{var ue=0;Y.forEach(function(_e){Object.keys(I[_e]).forEach(function(Te){var Le=I[_e][Te];Le.setCenter(Le.getCenterX()+re[ue].dx,Le.getCenterY()+re[ue].dy)}),ue++})}}}else{var H=E.eles.boundingBox();if(B.push({x:H.x1+H.w/2,y:H.y1+H.h/2}),E.randomize){var $=_(E);A.push($)}E.quality=="default"||E.quality=="proof"?(I.push(m(E,A[0])),f.relocateComponent(B[0],I[0],E)):f.relocateComponent(B[0],A[0],E)}var pe=function(Te,Le){if(E.quality=="default"||E.quality=="proof"){typeof Te=="number"&&(Te=Le);var Ee=void 0,Pe=void 0,ze=Te.data("id");return I.forEach(function(Ue){ze in Ue&&(Ee={x:Ue[ze].getRect().getCenterX(),y:Ue[ze].getRect().getCenterY()},Pe=Ue[ze])}),E.nodeDimensionsIncludeLabels&&(Pe.labelWidth&&(Pe.labelPosHorizontal=="left"?Ee.x+=Pe.labelWidth/2:Pe.labelPosHorizontal=="right"&&(Ee.x-=Pe.labelWidth/2)),Pe.labelHeight&&(Pe.labelPosVertical=="top"?Ee.y+=Pe.labelHeight/2:Pe.labelPosVertical=="bottom"&&(Ee.y-=Pe.labelHeight/2))),Ee==null&&(Ee={x:Te.position("x"),y:Te.position("y")}),{x:Ee.x,y:Ee.y}}else{var Me=void 0;return A.forEach(function(Ue){var Ge=Ue.nodeIndexes.get(Te.id());Ge!=null&&(Me={x:Ue.xCoords[Ge],y:Ue.yCoords[Ge]})}),Me==null&&(Me={x:Te.position("x"),y:Te.position("y")}),{x:Me.x,y:Me.y}}};if(E.quality=="default"||E.quality=="proof"||E.randomize){var Re=f.calcParentsWithoutChildren(k,L),Be=L.filter(function(_e){return _e.css("display")=="none"});E.eles=L.not(Be),L.nodes().not(":parent").not(Be).layoutPositions(N,E,pe),Re.length>0&&Re.forEach(function(_e){_e.position(pe(_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),d=u(140).layoutBase.Matrix,g=u(140).layoutBase.SVD,f=function(_){var v=_.cy,m=_.eles,x=m.nodes(),b=m.nodes(":parent"),S=new Map,T=new Map,N=new Map,E=[],k=[],L=[],A=[],I=[],O=[],B=[],D=[],M=void 0,U=1e8,H=1e-9,$=_.piTol,F=_.samplingType,P=_.nodeSeparation,z=void 0,G=function(){for(var se=0,ce=0,de=!1;ce<z;){se=Math.floor(Math.random()*M),de=!1;for(var oe=0;oe<ce;oe++)if(A[oe]==se){de=!0;break}if(!de)A[ce]=se,ce++;else continue}},V=function(se,ce,de){for(var oe=[],ye=0,Se=0,ke=0,De=void 0,Ne=[],Ae=0,Qe=1,Xe=0;Xe<M;Xe++)Ne[Xe]=U;for(oe[Se]=se,Ne[se]=0;Se>=ye;){ke=oe[ye++];for(var mt=E[ke],Je=0;Je<mt.length;Je++)De=T.get(mt[Je]),Ne[De]==U&&(Ne[De]=Ne[ke]+1,oe[++Se]=De);O[ke][ce]=Ne[ke]*P}if(de){for(var Ze=0;Ze<M;Ze++)O[Ze][ce]<I[Ze]&&(I[Ze]=O[Ze][ce]);for(var ut=0;ut<M;ut++)I[ut]>Ae&&(Ae=I[ut],Qe=ut)}return Qe},te=function(se){var ce=void 0;if(se){ce=Math.floor(Math.random()*M);for(var oe=0;oe<M;oe++)I[oe]=U;for(var ye=0;ye<z;ye++)A[ye]=ce,ce=V(ce,ye,se)}else{G();for(var de=0;de<z;de++)V(A[de],de,se)}for(var Se=0;Se<M;Se++)for(var ke=0;ke<z;ke++)O[Se][ke]*=O[Se][ke];for(var De=0;De<z;De++)B[De]=[];for(var Ne=0;Ne<z;Ne++)for(var Ae=0;Ae<z;Ae++)B[Ne][Ae]=O[A[Ae]][Ne]},ie=function(){for(var se=g.svd(B),ce=se.S,de=se.U,oe=se.V,ye=ce[0]*ce[0]*ce[0],Se=[],ke=0;ke<z;ke++){Se[ke]=[];for(var De=0;De<z;De++)Se[ke][De]=0,ke==De&&(Se[ke][De]=ce[ke]/(ce[ke]*ce[ke]+ye/(ce[ke]*ce[ke])))}D=d.multMat(d.multMat(oe,Se),d.transpose(de))},ne=function(){for(var se=void 0,ce=void 0,de=[],oe=[],ye=[],Se=[],ke=0;ke<M;ke++)de[ke]=Math.random(),oe[ke]=Math.random();de=d.normalize(de),oe=d.normalize(oe);for(var De=H,Ne=H,Ae=void 0;;){for(var Qe=0;Qe<M;Qe++)ye[Qe]=de[Qe];if(de=d.multGamma(d.multL(d.multGamma(ye),O,D)),se=d.dotProduct(ye,de),de=d.normalize(de),De=d.dotProduct(ye,de),Ae=Math.abs(De/Ne),Ae<=1+$&&Ae>=1)break;Ne=De}for(var Xe=0;Xe<M;Xe++)ye[Xe]=de[Xe];for(Ne=H;;){for(var mt=0;mt<M;mt++)Se[mt]=oe[mt];if(Se=d.minusOp(Se,d.multCons(ye,d.dotProduct(ye,Se))),oe=d.multGamma(d.multL(d.multGamma(Se),O,D)),ce=d.dotProduct(Se,oe),oe=d.normalize(oe),De=d.dotProduct(Se,oe),Ae=Math.abs(De/Ne),Ae<=1+$&&Ae>=1)break;Ne=De}for(var Je=0;Je<M;Je++)Se[Je]=oe[Je];k=d.multCons(ye,Math.sqrt(Math.abs(se))),L=d.multCons(Se,Math.sqrt(Math.abs(ce)))};c.connectComponents(v,m,c.getTopMostNodes(x),S),b.forEach(function(ae){c.connectComponents(v,m,c.getTopMostNodes(ae.descendants().intersection(m)),S)});for(var X=0,q=0;q<x.length;q++)x[q].isParent()||T.set(x[q].id(),X++);var Y=!0,K=!1,ee=void 0;try{for(var re=S.keys()[Symbol.iterator](),ue;!(Y=(ue=re.next()).done);Y=!0){var pe=ue.value;T.set(pe,X++)}}catch(ae){K=!0,ee=ae}finally{try{!Y&&re.return&&re.return()}finally{if(K)throw ee}}for(var Re=0;Re<T.size;Re++)E[Re]=[];b.forEach(function(ae){for(var se=ae.children().intersection(m);se.nodes(":childless").length==0;)se=se.nodes()[0].children().intersection(m);var ce=0,de=se.nodes(":childless")[0].connectedEdges().length;se.nodes(":childless").forEach(function(oe,ye){oe.connectedEdges().length<de&&(de=oe.connectedEdges().length,ce=ye)}),N.set(ae.id(),se.nodes(":childless")[ce].id())}),x.forEach(function(ae){var se=void 0;ae.isParent()?se=T.get(N.get(ae.id())):se=T.get(ae.id()),ae.neighborhood().nodes().forEach(function(ce){m.intersection(ae.edgesWith(ce)).length>0&&(ce.isParent()?E[se].push(N.get(ce.id())):E[se].push(ce.id()))})});var Be=function(se){var ce=T.get(se),de=void 0;S.get(se).forEach(function(oe){v.getElementById(oe).isParent()?de=N.get(oe):de=oe,E[ce].push(de),E[T.get(de)].push(se)})},_e=!0,Te=!1,Le=void 0;try{for(var Ee=S.keys()[Symbol.iterator](),Pe;!(_e=(Pe=Ee.next()).done);_e=!0){var ze=Pe.value;Be(ze)}}catch(ae){Te=!0,Le=ae}finally{try{!_e&&Ee.return&&Ee.return()}finally{if(Te)throw Le}}M=T.size;var Me=void 0;if(M>2){z=M<_.sampleSize?M:_.sampleSize;for(var Ue=0;Ue<M;Ue++)O[Ue]=[];for(var Ge=0;Ge<z;Ge++)D[Ge]=[];return _.quality=="draft"||_.step=="all"?(te(F),ie(),ne(),Me={nodeIndexes:T,xCoords:k,yCoords:L}):(T.forEach(function(ae,se){k.push(v.getElementById(se).position("x")),L.push(v.getElementById(se).position("y"))}),Me={nodeIndexes:T,xCoords:k,yCoords:L}),Me}else{var ve=T.keys(),Ce=v.getElementById(ve.next().value),Ie=Ce.position(),me=Ce.outerWidth();if(k.push(Ie.x),L.push(Ie.y),M==2){var Z=v.getElementById(ve.next().value),he=Z.outerWidth();k.push(Ie.x+me/2+he/2+_.idealEdgeLength),L.push(Ie.y)}return Me={nodeIndexes:T,xCoords:k,yCoords:L},Me}};a.exports={spectralLayout:f}}),579:((a,l,u)=>{var c=u(212),d=function(f){f&&f("layout","fcose",c)};typeof cytoscape<"u"&&d(cytoscape),a.exports=d}),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})()})})(Tc)),Tc.exports}var BA=OA();const jA=Kc(BA);sa.use(jA);const FA={function:"#10b981",method:"#10b981",constructor:"#10b981",class:"#f97316",struct:"#f97316",interface:"#3b82f6",type_alias:"#3b82f6",trait:"#3b82f6",enum:"#8b5cf6",macro:"#a855f7"},zA={typescript:"#10b981",javascript:"#10b981",rust:"#f97316",python:"#3b82f6",go:"#06b6d4"};function HA(t){var e,r;return FA[(e=t.kind)==null?void 0:e.toLowerCase()]??zA[(r=t.lang)==null?void 0:r.toLowerCase()]??"#9ca3af"}function UA(t){return Math.round(Math.min(20+Math.sqrt(t)*6,60))}function k2({nodes:t,edges:e,externalSelectedId:r,onNodeClick:n,onNodeSelect:i}){const s=J.useRef(null),[o,a]=J.useState(null),l=J.useRef(new Map),u=J.useRef(n),c=J.useRef(i);return J.useEffect(()=>{u.current=n,c.current=i},[n,i]),J.useEffect(()=>{if(!s.current)return;const d=new Map(t.map((y,_)=>[y.id,`n${_}`]));l.current=d;const g=[...t.map(y=>({group:"nodes",data:{id:d.get(y.id),label:y.name||y.id.split("/").pop()||y.id,color:HA(y),size:UA(y.inDeg),kind:y.kind,file:y.file,inDeg:y.inDeg,outDeg:y.outDeg,raw:y}})),...e.filter(y=>d.has(y.src)&&d.has(y.tgt)).map((y,_)=>({group:"edges",data:{id:`e${_}`,source:d.get(y.src),target:d.get(y.tgt)}}))],f=sa({container:s.current,elements:g,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 f.on("tap","node",y=>{var m,x;const _=y.target.data("raw");(m=u.current)==null||m.call(u,_),(x=c.current)==null||x.call(c,_),f.elements().removeClass("highlighted dimmed");const v=y.target.closedNeighborhood();f.elements().addClass("dimmed"),v.removeClass("dimmed").addClass("highlighted"),y.target.select()}),f.on("tap",y=>{var _;y.target===f&&(f.elements().removeClass("highlighted dimmed"),f.elements("node").unselect(),(_=c.current)==null||_.call(c,null))}),f.ready(()=>{f.destroyed()||f.fit(void 0,40)}),a(f),()=>{f.destroy(),a(null)}},[t,e]),J.useEffect(()=>{if(o&&!o.destroyed()&&(o.elements("node").unselect(),o.elements().removeClass("highlighted dimmed"),r)){const d=l.current.get(r)??r,g=o.$id(d);if(g.length){g.select();const f=g.closedNeighborhood();o.elements().addClass("dimmed"),f.removeClass("dimmed").addClass("highlighted"),o.destroyed()||o.animate({fit:{eles:f,padding:60},duration:300})}}},[o,r]),w.jsx("div",{ref:s,className:"w-full h-full"})}const $A={function:"#10b981",method:"#10b981",constructor:"#10b981",class:"#f97316",struct:"#f97316",interface:"#3b82f6",type_alias:"#3b82f6",trait:"#3b82f6",enum:"#8b5cf6",macro:"#a855f7"},WA={typescript:"#10b981",javascript:"#10b981",rust:"#f97316",python:"#3b82f6",go:"#06b6d4"};function VA(t){var e,r;return $A[(e=t.kind)==null?void 0:e.toLowerCase()]??WA[(r=t.lang)==null?void 0:r.toLowerCase()]??"#9ca3af"}function GA({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 w.jsx("div",{className:"h-full flex flex-col overflow-hidden",style:{background:"#0f1419"},children:w.jsx("div",{className:"flex-1 overflow-y-auto",children:n.map((o,a)=>{const l=i>0?o.inDeg/i*100:0,u=VA(o),c=o.id===e,d=o.name||o.id.split("/").pop()||o.id,g=o.file?o.file.split("/").slice(-2).join("/"):"";return w.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:f=>{c||(f.currentTarget.style.background="rgba(230,237,243,0.04)")},onMouseLeave:f=>{c||(f.currentTarget.style.background="transparent")},children:[w.jsx("div",{className:"absolute inset-y-0 left-0 pointer-events-none",style:{width:`${l}%`,backgroundColor:u,opacity:c?.18:.1}}),w.jsxs("div",{className:"relative flex items-center gap-2",children:[w.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}),w.jsx("span",{className:"w-2 h-2 rounded-full shrink-0",style:{backgroundColor:u}}),w.jsxs("span",{className:"flex-1 min-w-0 flex flex-col",children:[w.jsx("span",{className:"font-mono text-[11px] truncate font-medium",style:{color:"#e6edf3"},title:o.name||o.id,children:d}),g&&w.jsxs("span",{className:"text-[9px] truncate font-mono",style:{color:"rgba(230,237,243,0.35)"},children:[o.kind&&w.jsx("span",{style:{color:"rgba(230,237,243,0.45)",marginRight:"4px"},children:o.kind}),g]})]}),w.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 Oe={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"},qA={function:"#10b981",method:"#10b981",constructor:"#10b981",class:"#f97316",struct:"#f97316",interface:"#3b82f6",type_alias:"#3b82f6",trait:"#3b82f6",enum:"#8b5cf6",macro:"#a855f7"},YA={typescript:"#10b981",javascript:"#10b981",rust:"#f97316",python:"#3b82f6",go:"#06b6d4"};function KA(t){var e,r;return qA[(e=t.kind)==null?void 0:e.toLowerCase()]??YA[(r=t.lang)==null?void 0:r.toLowerCase()]??"#9ca3af"}function XA({node:t,edges:e,onClose:r,onBlast:n,onExpand:i,blast:s,blastBusy:o,expandBusy:a,onFocusDependent:l}){const u=e.filter(f=>f.tgt===t.id),c=e.filter(f=>f.src===t.id),d=KA(t);function g(f){const y=f.split("/");return y[y.length-1]??f}return w.jsxs("div",{className:"w-64 shrink-0 flex flex-col border-l overflow-hidden",style:{background:Oe.canvas2,borderColor:Oe.hairline},children:[w.jsxs("div",{className:"flex items-center gap-1.5 px-3 py-2 border-b shrink-0 min-w-0",style:{borderColor:Oe.hairline},children:[w.jsx("span",{className:"w-2 h-2 rounded-full shrink-0",style:{backgroundColor:d}}),w.jsx("span",{className:"text-[11px] font-semibold truncate flex-1 font-mono",style:{color:Oe.ink},title:t.name||t.id,children:t.name||t.id.split("/").pop()}),w.jsx("button",{type:"button",onClick:r,className:"shrink-0 leading-none text-base",style:{color:Oe.faint},children:"×"})]}),w.jsxs("div",{className:"overflow-y-auto flex-1 p-3 flex flex-col gap-3 text-[11px]",children:[(n!==void 0||i!==void 0)&&w.jsxs("div",{className:"flex gap-2",children:[n!==void 0&&w.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:Oe.deny,border:`1px solid ${Oe.hairline}`},children:o?"Computing…":"⚡ Blast radius"}),i!==void 0&&w.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:Oe.link,border:`1px solid ${Oe.hairline}`},children:a?"Expanding…":"⤢ Expand neighbors"})]}),s!=null&&w.jsxs("div",{className:"flex flex-col gap-1",children:[w.jsxs("span",{className:"text-[10px] font-mono uppercase",style:{color:Oe.faint},children:["blast radius · ",s.dependents.length," dependents"]}),s.unresolved>0&&w.jsxs("span",{className:"text-[10px] font-mono",style:{color:Oe.deny},children:["+",s.unresolved," unresolved call(s) — impact may be larger"]}),s.unresolved===-1&&w.jsx("span",{className:"text-[10px] font-mono",style:{color:Oe.deny},children:"blast radius failed to compute"}),w.jsxs("ul",{className:"flex flex-col gap-0.5 max-h-48 overflow-y-auto",children:[s.dependents.slice(0,30).map(f=>w.jsx("li",{children:w.jsxs("button",{type:"button",onClick:()=>l==null?void 0:l(f),className:"w-full text-left text-[10px] font-mono truncate hover:underline",style:{color:Oe.link},title:`${f.file}:${f.line}`,children:[f.name," ",w.jsxs("span",{style:{color:Oe.faint},children:["(",f.kind,")"]})]})},f.id)),s.dependents.length>30&&w.jsxs("li",{className:"text-[10px] font-mono",style:{color:Oe.faint},children:["+",s.dependents.length-30," more"]})]})]}),t.kind&&w.jsxs("div",{className:"flex items-center gap-2",children:[w.jsx("span",{className:"px-1.5 py-0.5 rounded text-[9px] font-semibold uppercase",style:{background:Oe.surface,color:Oe.muted},children:t.kind}),w.jsx("span",{className:"capitalize font-mono",style:{color:Oe.faint},children:t.lang||""})]}),t.file&&w.jsxs("div",{children:[w.jsx("p",{className:"text-[10px] mb-0.5 font-mono uppercase tracking-wide",style:{color:Oe.faint},children:"File"}),w.jsx("p",{className:"font-mono text-[10px] break-all",style:{color:Oe.muted},children:t.file})]}),w.jsxs("div",{className:"flex gap-4",children:[w.jsxs("div",{children:[w.jsx("p",{className:"text-[10px] font-mono uppercase tracking-wide mb-0.5",style:{color:Oe.faint},children:"Callers"}),w.jsx("p",{className:"font-mono font-bold",style:{color:Oe.ink},children:t.inDeg})]}),w.jsxs("div",{children:[w.jsx("p",{className:"text-[10px] font-mono uppercase tracking-wide mb-0.5",style:{color:Oe.faint},children:"Calls"}),w.jsx("p",{className:"font-mono font-bold",style:{color:Oe.ink},children:t.outDeg})]})]}),u.length>0&&w.jsxs("div",{children:[w.jsxs("p",{className:"text-[10px] font-mono uppercase tracking-wide mb-1",style:{color:Oe.faint},children:["Called by (in view) ",w.jsx("span",{style:{color:Oe.muted},children:u.length})]}),w.jsxs("div",{className:"flex flex-col gap-0.5",children:[u.slice(0,10).map(f=>w.jsx("p",{className:"font-mono text-[10px] truncate",style:{color:Oe.muted},title:f.src,children:g(f.src)},f.src)),u.length>10&&w.jsxs("p",{className:"text-[10px] font-mono",style:{color:Oe.faint},children:["+",u.length-10," more"]})]})]}),c.length>0&&w.jsxs("div",{children:[w.jsxs("p",{className:"text-[10px] font-mono uppercase tracking-wide mb-1",style:{color:Oe.faint},children:["Calls (in view) ",w.jsx("span",{style:{color:Oe.muted},children:c.length})]}),w.jsxs("div",{className:"flex flex-col gap-0.5",children:[c.slice(0,10).map(f=>w.jsx("p",{className:"font-mono text-[10px] truncate",style:{color:Oe.muted},title:f.tgt,children:g(f.tgt)},f.tgt)),c.length>10&&w.jsxs("p",{className:"text-[10px] font-mono",style:{color:Oe.faint},children:["+",c.length-10," more"]})]})]})]})]})}function QA({graph:t}){const[e,r]=J.useState(""),[n,i]=J.useState(null),{nodes:s,edges:o,reqCounts:a}=J.useMemo(()=>{var x;const d=Object.keys(t.domains),g=new Set(d),f=new Map;for(const b of d)f.set(b,Object.keys(((x=t.domains[b])==null?void 0:x.requirements)??{}).length);const y=b=>{if(b==="(root)")return null;let S=b;for(;S.includes("/");)if(S=S.slice(0,S.lastIndexOf("/")),g.has(S))return S;return g.has("(root)")?"(root)":null},_=new Map,v=[];for(const b of d){const S=y(b);S!==null&&(v.push({src:S,tgt:b}),_.set(S,(_.get(S)??0)+1))}return{nodes:d.map(b=>({id:b,name:b==="(root)"?"(root)":b.slice(b.lastIndexOf("/")+1),kind:"domain",file:b,inDeg:Math.min(f.get(b)??0,60),outDeg:_.get(b)??0,lang:"domain"})),edges:v,reqCounts:f}},[t]),l=e.trim().toLowerCase(),u=J.useMemo(()=>{if(l==="")return{nodes:s,edges:o};const d=new Set(s.filter(y=>{var _;return y.id.toLowerCase().includes(l)||Object.values(((_=t.domains[y.id])==null?void 0:_.requirements)??{}).some(v=>(v.title??"").toLowerCase().includes(l))}).map(y=>y.id)),g=new Set(d),f=new Map(o.map(y=>[y.tgt,y.src]));for(const y of d){let _=f.get(y);for(;_!==void 0&&!g.has(_);)g.add(_),_=f.get(_)}return{nodes:s.filter(y=>g.has(y.id)),edges:o.filter(y=>g.has(y.src)&&g.has(y.tgt))}},[s,o,l,t]),c=n!==null?t.domains[n]:void 0;return s.length===0?w.jsx("div",{className:"h-full overflow-y-auto p-4",children:w.jsx("p",{className:"text-sm text-center mt-8 font-mono",style:{color:Oe.faint},children:"No domains in this graph."})}):w.jsxs("div",{className:"h-full flex flex-col",children:[w.jsxs("div",{className:"flex items-center gap-3 px-4 py-2 shrink-0 border-b",style:{borderColor:Oe.hairline},children:[w.jsxs("span",{className:"text-[11px] font-mono shrink-0",style:{color:Oe.muted},children:[s.length," domains · ",[...a.values()].reduce((d,g)=>d+g,0)," requirements"]}),w.jsx("input",{type:"text",value:e,onChange:d=>r(d.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 ${Oe.hairlineS}`,background:Oe.canvas2,color:Oe.ink}}),l!==""&&w.jsx("span",{className:"text-[10px] font-mono shrink-0",style:{color:Oe.faint},children:u.nodes.length===1?"1 match":`${u.nodes.length} matches`})]}),w.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[w.jsx("div",{className:"flex-1 overflow-hidden",style:{background:Oe.canvas},children:w.jsx(k2,{nodes:u.nodes,edges:u.edges,externalSelectedId:n,onNodeSelect:d=>i(d?d.id:null)})}),n!==null&&c&&w.jsx(ZA,{domainId:n,domain:c,onClose:()=>i(null)})]})]})}function ZA({domainId:t,domain:e,onClose:r}){const i=Object.entries(e.requirements??{});return w.jsxs("div",{className:"w-[380px] shrink-0 border-l flex flex-col",style:{borderColor:Oe.hairlineS,background:Oe.surface2},children:[w.jsxs("div",{className:"px-4 py-2.5 border-b flex items-center gap-2 shrink-0",style:{borderColor:Oe.hairline,background:Oe.canvas2},children:[w.jsx("span",{className:"text-[11px] font-semibold font-mono truncate",style:{color:Oe.ink},children:t}),w.jsxs("span",{className:"text-[10px] font-mono ml-auto shrink-0",style:{color:Oe.faint},children:[i.length," reqs"]}),w.jsx("button",{type:"button",onClick:r,"aria-label":"Close domain details",className:"text-sm shrink-0 px-1",style:{color:Oe.muted},children:"×"})]}),w.jsxs("div",{className:"flex-1 overflow-y-auto",children:[e.description&&w.jsx("p",{className:"text-[11px] px-4 pt-3 pb-1",style:{color:Oe.muted},children:e.description}),i.length===0?w.jsx("p",{className:"text-[11px] px-4 py-3 font-mono",style:{color:Oe.faint},children:"No requirements recorded for this domain."}):w.jsxs("div",{className:"divide-y",style:{borderColor:Oe.hairline},children:[i.slice(0,150).map(([s,o])=>w.jsxs("div",{className:"px-4 py-2.5",style:{borderColor:Oe.hairline},children:[w.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[w.jsx("span",{className:"text-[10px] font-mono",style:{color:Oe.faint},children:s}),o.status&&w.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)":Oe.surface,color:o.status==="active"?Oe.ok:o.status==="deprecated"?Oe.deny:Oe.muted},children:o.status})]}),w.jsx("p",{className:"text-[11px]",style:{color:Oe.ink},children:o.title}),o.description&&o.description!==o.title&&w.jsx("p",{className:"text-[10px] mt-0.5",style:{color:Oe.muted},children:o.description.slice(0,160)})]},s)),i.length>150&&w.jsxs("p",{className:"text-[10px] font-mono px-4 py-2",style:{color:Oe.faint},children:["+",i.length-150," more requirements"]})]})]})]})}function pb(){return w.jsxs("div",{className:"flex items-center gap-1.5",children:[w.jsx("span",{className:"w-3 h-3 rounded-full",style:{background:Oe.deny}}),w.jsx("span",{className:"w-3 h-3 rounded-full",style:{background:Oe.accent}}),w.jsx("span",{className:"w-3 h-3 rounded-full",style:{background:Oe.ok}})]})}function JA({repo:t,onClose:e,onSelectRun:r,initialFocus:n}){const[i,s]=J.useState("graph"),[o,a]=J.useState("code"),[l,u]=J.useState(!0),[c,d]=J.useState(null),[g,f]=J.useState(null),[y,_]=J.useState(null),[v,m]=J.useState(!1),[x,b]=J.useState(!1),[S,T]=J.useState(null),[N,E]=J.useState(null),[k,L]=J.useState(null),[A,I]=J.useState(!0);async function O(){b(!0),T(null);try{const{runId:Y}=await Ve.rerunOnboarding(t.id);r==null||r(Y),e()}catch(Y){T(Y instanceof Error?Y.message:String(Y)),b(!1)}}J.useEffect(()=>{function Y(K){K.key==="Escape"&&e()}return document.addEventListener("keydown",Y),()=>document.removeEventListener("keydown",Y)},[e]),J.useEffect(()=>{u(!0);const Y=n!=null&&n!==""?{focus:n,limit:120}:void 0;Ve.getRepoGraph(t.id,Y).then(({graph:K})=>{if(d(K),Y!==void 0&&K!==null){const ee=K.nodes.find(re=>re.id===n||re.name===n);ee&&(L(ee),E(ee.id))}}).catch(()=>d(null)).finally(()=>u(!1))},[t.id,n]),J.useEffect(()=>{o!=="domain"||g!==null||(m(!0),Ve.getRepoDomainGraph(t.id).then(({graph:Y,coverage:K})=>{f(Y),_(K)}).catch(()=>{f(null),_(null)}).finally(()=>m(!1)))},[o,g,t.id]);function B(Y){E(Y.id),L(Y)}function D(Y){L(Y),Y!==null&&E(Y.id),U(null)}const[M,U]=J.useState(null),[H,$]=J.useState(!1),[F,P]=J.useState(!1);function z(Y){$(!0),Ve.getBlastRadius(t.id,Y.name||Y.id).then(U).catch(()=>U({target:Y.name,dependents:[],unresolved:-1})).finally(()=>$(!1))}function G(Y){d(K=>{if(K===null)return K;const ee=new Set(K.nodes.map(Be=>Be.id)),re=[...K.nodes,...Y.nodes.filter(Be=>!ee.has(Be.id))],ue=Be=>`${Be.src}→${Be.tgt}`,pe=new Set(K.edges.map(ue)),Re=[...K.edges,...Y.edges.filter(Be=>!pe.has(ue(Be)))];return{nodes:re,edges:Re,stats:{nodeCount:re.length,edgeCount:Re.length,fileCount:new Set(re.map(Be=>Be.file)).size}}})}function V(Y){P(!0),Ve.getRepoGraph(t.id,{focus:Y.id,limit:60}).then(({graph:K})=>{K!==null&&G(K)}).catch(()=>{}).finally(()=>P(!1))}function te(Y){U(null);const K=c==null?void 0:c.nodes.find(ee=>ee.id===Y.id);if(K){D(K);return}Ve.getRepoGraph(t.id,{focus:Y.id,limit:60}).then(({graph:ee})=>{if(ee===null)return;G(ee);const re=ee.nodes.find(ue=>ue.id===Y.id)??ee.nodes.find(ue=>ue.name===Y.name);re&&D(re)}).catch(()=>{})}function ie(Y){const ee=Y.toLowerCase().split("/"),re=ee[ee.length-1]??"";return ee.some(ue=>ue==="test"||ue==="tests"||ue==="spec"||ue==="specs"||ue==="__tests__"||ue==="e2e")||re.startsWith("test_")||/_(test|spec|tests|suite)\.[^.]+$/.test(re)||/\.(test|spec)\.[^.]+$/.test(re)}const ne=c?c.nodes.filter(Y=>!(!Y.file||Y.file.startsWith("node_modules/")||A&&ie(Y.file))):[],X=ne.length===0;function q({value:Y,current:K,label:ee,onChange:re}){const ue=Y===K;return w.jsx("button",{type:"button",onClick:()=>re(Y),className:"rounded px-2.5 py-1 text-[11px] font-mono font-medium transition-colors",style:{background:ue?Oe.surface:"transparent",color:ue?Oe.ink:Oe.muted,boxShadow:ue?"0 1px 4px rgba(0,0,0,0.4)":"none"},children:ee})}return w.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:w.jsxs("div",{className:"w-[92vw] h-[92vh] rounded-2xl flex flex-col overflow-hidden",style:{background:Oe.blue,border:`1px solid ${Oe.hairlineS}`,boxShadow:"0 40px 80px -20px rgba(0,0,0,0.8)"},children:[w.jsxs("div",{className:"flex items-center gap-3 px-5 py-3 border-b shrink-0",style:{background:Oe.blue2,borderColor:Oe.hairline},children:[w.jsx("span",{className:"text-[13px] font-semibold font-mono mr-1",style:{color:Oe.ink},children:t.name}),w.jsx("div",{className:"flex gap-0.5 rounded p-0.5",style:{background:"rgba(0,0,0,0.25)"},children:["code","domain"].map(Y=>w.jsx(q,{value:Y,current:o,label:Y==="code"?"Code":"Domain",onChange:a},Y))}),o==="code"&&w.jsx("div",{className:"flex gap-0.5 rounded p-0.5",style:{background:"rgba(0,0,0,0.25)"},children:["graph","hotspots"].map(Y=>w.jsx(q,{value:Y,current:i,label:Y==="graph"?"Graph":"Hotspots",onChange:s},Y))}),o==="code"&&w.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?Oe.hairline:"rgba(255,218,25,0.4)",background:A?"rgba(0,0,0,0.2)":"rgba(255,218,25,0.08)",color:A?Oe.faint:Oe.accent},children:A?"tests hidden":"tests shown"}),c&&o==="code"&&w.jsxs("span",{className:"text-[10px] font-mono px-2 py-0.5 rounded",style:{background:"rgba(0,0,0,0.2)",color:Oe.muted},children:[ne.length," nodes · ",c.stats.edgeCount," edges"]}),w.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:Oe.faint},onMouseEnter:Y=>Y.currentTarget.style.color=Oe.ink,onMouseLeave:Y=>Y.currentTarget.style.color=Oe.faint,children:"×"})]}),w.jsx("div",{className:"flex-1 overflow-hidden",style:{background:Oe.blue},children:l?w.jsx("div",{className:"flex items-center justify-center h-full",children:w.jsx("span",{className:"text-sm font-mono",style:{color:Oe.muted},children:"Loading…"})}):o==="domain"?v?w.jsx("div",{className:"flex items-center justify-center h-full",children:w.jsx("span",{className:"text-sm font-mono",style:{color:Oe.muted},children:"Loading domain graph…"})}):g?w.jsx(QA,{graph:g}):w.jsx("div",{className:"flex items-center justify-center h-full",children:w.jsxs("div",{className:"max-w-sm w-full mx-auto p-6 rounded-xl border flex flex-col gap-4",style:{border:`1px solid ${Oe.hairlineS}`,background:Oe.canvas2},children:[w.jsx("p",{className:"text-sm font-semibold font-mono",style:{color:Oe.ink},children:"Domain graph not yet generated"}),w.jsxs("p",{className:"text-xs leading-relaxed",style:{color:Oe.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",w.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 ",w.jsx("span",{className:"font-mono",children:"wicked-core domain-graph"}),"."]}),y?w.jsxs("div",{className:"rounded-lg p-4 flex flex-col gap-2 border",style:{border:`1px solid ${Oe.hairline}`},children:[w.jsxs("div",{className:"flex justify-between items-baseline",children:[w.jsx("span",{className:"text-[11px] font-mono",style:{color:Oe.muted},children:"Annotation coverage"}),w.jsx("span",{className:"text-[11px] font-mono font-bold",style:{color:Oe.ink},children:y.behavior_bearing===0?"not extracted":y.coverage<1&&y.coverage*100>=99.95?"<100%":`${(y.coverage*100).toFixed(1)}%`})]}),w.jsx("div",{className:"w-full h-1.5 rounded-full overflow-hidden",style:{background:Oe.surface},children:w.jsx("div",{className:"h-full rounded-full",style:{width:y.behavior_bearing===0?"0%":`${Math.max(y.coverage*100,.5)}%`,background:Oe.ok}})}),w.jsxs("div",{className:"flex gap-4 mt-1 text-[10px] font-mono tabular-nums",style:{color:Oe.faint},children:[w.jsxs("span",{children:[y.resolved.toLocaleString()," resolved"]}),w.jsxs("span",{children:[y.behavior_bearing.toLocaleString()," behavior-bearing"]}),w.jsxs("span",{children:[y.total.toLocaleString()," total"]})]})]}):w.jsx("p",{className:"text-[11px] font-mono",style:{color:Oe.faint},children:"No coverage data — run onboarding first."}),w.jsx("button",{type:"button",onClick:()=>void O(),disabled:x,className:"self-start rounded-lg px-4 py-2 text-sm font-semibold disabled:opacity-50",style:{background:Oe.accent,color:Oe.accentInk},children:x?"Starting…":"Run annotation workflow →"}),S&&w.jsx("p",{className:"text-[11px] font-mono",style:{color:Oe.deny},children:S})]})}):X?w.jsx("div",{className:"flex items-center justify-center h-full",children:w.jsx("p",{className:"text-sm font-mono",style:{color:Oe.muted},children:"Code graph not yet available — run onboarding first."})}):w.jsxs("div",{className:"h-full flex p-4 gap-4",children:[w.jsxs("div",{className:"flex-1 flex flex-col gap-3 min-w-0 overflow-hidden",children:[w.jsxs("div",{className:"rounded-xl overflow-hidden flex flex-col",style:{display:i==="graph"?"flex":"none",flex:1,border:`1px solid ${Oe.hairlineS}`,background:Oe.canvas2,boxShadow:"0 20px 50px -20px rgba(0,0,0,0.6)"},children:[w.jsxs("div",{className:"flex items-center gap-3 px-4 py-2.5 border-b shrink-0",style:{background:Oe.canvas,borderColor:Oe.hairline},children:[w.jsx(pb,{}),w.jsxs("span",{className:"font-mono text-[10px] ml-1",style:{color:Oe.faint},children:["code-graph · ",w.jsx("span",{style:{color:Oe.link},children:t.name})]}),w.jsxs("span",{className:"ml-auto font-mono text-[9px] px-2 py-0.5 rounded",style:{background:Oe.surface,color:Oe.muted},children:[ne.length," nodes"]})]}),w.jsx("div",{className:"flex-1 overflow-hidden",style:{background:Oe.canvas},children:w.jsx(k2,{nodes:ne,edges:c.edges,externalSelectedId:N,onNodeSelect:D})})]}),w.jsxs("div",{className:"rounded-xl overflow-hidden flex flex-col",style:{display:i==="hotspots"?"flex":"none",flex:1,border:`1px solid ${Oe.hairlineS}`,background:Oe.canvas2,boxShadow:"0 20px 50px -20px rgba(0,0,0,0.6)"},children:[w.jsxs("div",{className:"flex items-center gap-3 px-4 py-2.5 border-b shrink-0",style:{background:Oe.canvas,borderColor:Oe.hairline},children:[w.jsx(pb,{}),w.jsxs("span",{className:"font-mono text-[10px] ml-1",style:{color:Oe.faint},children:["hotspots · ",w.jsx("span",{style:{color:Oe.link},children:t.name})]})]}),w.jsx("div",{className:"flex-1 overflow-hidden",style:{background:Oe.surface2},children:w.jsx(GA,{nodes:ne,selectedId:(k==null?void 0:k.id)??null,onSelect:B})})]})]}),k&&w.jsx(XA,{node:k,edges:c.edges,onClose:()=>L(null),onBlast:z,onExpand:V,blast:M,blastBusy:H,expandBusy:F,onFocusDependent:te})]})})]})})}const e5=new Set(["sessionStarted","unitPlanned","unitDistributed","unitExecuting","gateDecided","unitDone","unitDenied","awaitingHuman","resumed","runCancelled","sessionFailed","sessionCompleted"]);function t5(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,governanceUnenforced:null,outputBytes:null,outputGoverned:!1,reworkAmendment:null}}function gb(t){return JSON.stringify([t.criterion,t.hasDeterministicFloor,t.deterministicPass,t.agentVerdict,t.agentReasoning,t.evaluatorPass,t.evaluatorPolicies,t.denialReason,t.combined])}function r5(t,e){var _;const r={...t.session},n=new Map;for(const v of t.units)n.set(v.ord,{ord:v.ord,description:v.description,stage:v.stage,status:v.status,resolved:!0,assignedCli:v.assigned_cli,assignedInvocation:v.assigned_invocation,routing:v.routing,denialReason:v.denial_reason,skillRef:v.skill_ref??null,phaseStatus:v.phase_status,role:v.role??null,gate:v.gate??null,hasValidatorPin:v.has_validator_pin??!1,executorType:v.tool_cmd!=null?"tool":"agent",attempts:[],usage:[],filesRead:[],gateEvals:[],stepErrors:[],crashRedrives:0,workerSessionReuses:0,contextInjections:[],hookFires:[],validationPinAttached:!1,gateEscalated:!1,toolExecutorCmd:v.tool_cmd??null,governanceArmed:!1,governanceUnenforced:null,outputBytes:null,outputGoverned:!1,reworkAmendment:null});let i=r.status==="awaiting_human"?{ord:((_=t.units[r.unit_ix])==null?void 0:_.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,d=new Set,g=new Set,f=v=>{let m=n.get(v);return m===void 0&&(m=t5(v),n.set(v,m)),m};for(const v of e){const m=typeof v.ord=="number"?v.ord:void 0;switch(v.type){case"sessionStarted":r.status="planning";break;case"unitPlanned":if(m!==void 0){const x=f(m);x.description=typeof v.description=="string"?v.description:x.description;const b=(v.hasValidatorPin??v.has_validator_pin)===!0,S=v.executorType??v.executor_type,T=v.skillRef??v.skill_ref;x.resolved?(x.role===null&&typeof v.role=="string"&&(x.role=v.role),x.gate===null&&typeof v.gate=="string"&&(x.gate=v.gate),!x.hasValidatorPin&&b&&(x.hasValidatorPin=!0),x.executorType===null&&typeof S=="string"&&(x.executorType=S)):(typeof v.stage=="string"&&(x.stage=v.stage),typeof v.role=="string"&&(x.role=v.role),typeof v.gate=="string"&&(x.gate=v.gate),x.hasValidatorPin=b,typeof S=="string"&&(x.executorType=S)),!x.skillRef&&typeof T=="string"&&(x.skillRef=T)}break;case"unitDistributed":if(m!==void 0){const x=f(m);x.status==="pending"&&(x.status="distributed"),typeof v.cli=="string"&&x.assignedCli===null&&(x.assignedCli=v.cli)}break;case"unitExecuting":if(m!==void 0){const x=f(m);x.status==="pending"&&(x.status="distributed")}break;case"unitDone":m!==void 0&&(f(m).status="done");break;case"unitDenied":m!==void 0&&(f(m).status="rejected");break;case"awaitingHuman":m!==void 0&&(r.status="awaiting_human",i={ord:m,prompt:typeof v.prompt=="string"?v.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 v.attempt=="number"){const x=f(m);x.attempts.includes(v.attempt)||(x.attempts.push(v.attempt),x.attempts.sort((b,S)=>b-S))}break;case"cliUsage":if(m!==void 0&&typeof v.attempt=="number"&&typeof v.inputTokens=="number"&&typeof v.outputTokens=="number"){const x=f(m),b=typeof v.costUsd=="number"?v.costUsd:null,S=v,T=typeof S.cacheReadTokens=="number"?S.cacheReadTokens:0,N=typeof S.cacheCreationTokens=="number"?S.cacheCreationTokens:0,E=x.usage.find(k=>k.attempt===v.attempt);E?(E.inputTokens=v.inputTokens,E.outputTokens=v.outputTokens,E.costUsd=b,E.cacheReadTokens=T,E.cacheCreationTokens=N):x.usage.push({attempt:v.attempt,inputTokens:v.inputTokens,outputTokens:v.outputTokens,costUsd:b,cacheReadTokens:T,cacheCreationTokens:N})}break;case"dataUsed":if(m!==void 0&&Array.isArray(v.files)){const x=f(m);for(const b of v.files)typeof b=="string"&&!x.filesRead.includes(b)&&x.filesRead.push(b)}break;case"gateEvaluated":if(m!==void 0){const x=f(m),b={criterion:v.criterion??null,hasDeterministicFloor:v.hasDeterministicFloor===!0,deterministicPass:v.deterministicPass===!0,agentVerdict:v.agentVerdict??null,agentReasoning:v.agentReasoning??null,evaluatorPass:typeof v.evaluatorPass=="boolean"?v.evaluatorPass:null,evaluatorPolicies:Array.isArray(v.evaluatorPolicies)?v.evaluatorPolicies.filter(T=>typeof T=="string"):[],denialReason:v.denialReason??null,combined:v.combined===!0},S=gb(b);x.gateEvals.some(T=>gb(T)===S)||x.gateEvals.push(b)}break;case"stepFailed":if(m!==void 0&&typeof v.attempt=="number"&&typeof v.detail=="string"&&typeof v.failureKind=="string"){const x=f(m);x.stepErrors.some(b=>b.attempt===v.attempt)||x.stepErrors.push({attempt:v.attempt,detail:v.detail,failureKind:v.failureKind})}break;case"crashRecoveryRedrive":if(m!==void 0&&typeof v.attempt=="number"){let x=u.get(m);x||(x=new Set,u.set(m,x)),x.has(v.attempt)||(x.add(v.attempt),f(m).crashRedrives+=1)}break;case"workerSessionStarted":typeof v.terminalId=="string"&&(s=v.terminalId);break;case"acpSessionStarted":break;case"acpFallback":typeof v.cliKey=="string"&&typeof v.reason=="string"&&typeof v.fallbackKind=="string"&&(o.some(b=>b.cliKey===v.cliKey&&b.reason===v.reason&&b.fallbackKind===v.fallbackKind)||o.push({cliKey:v.cliKey,reason:v.reason,fallbackKind:v.fallbackKind}));break;case"workerSessionReused":if(m!==void 0&&typeof v.terminalId=="string"){const x=`${m}:${v.terminalId}`;c.has(x)||(c.add(x),f(m).workerSessionReuses+=1)}break;case"workerSessionClosed":typeof v.terminalId=="string"&&(v.reason==="run_complete"||v.reason==="error")&&(a={terminalId:v.terminalId,reason:v.reason});break;case"unitContextInjected":if(m!==void 0&&Array.isArray(v.priorUnits)&&!d.has(m)){d.add(m);const x=f(m);for(const b of v.priorUnits)if(typeof b=="object"&&b!==null){const S=b;typeof S.ord=="number"&&typeof S.label=="string"&&typeof S.outputBytes=="number"&&x.contextInjections.push({ord:S.ord,label:S.label,outputBytes:S.outputBytes})}}break;case"governanceHookFired":if(m!==void 0&&typeof v.attempt=="number"&&typeof v.toolName=="string"&&(v.decision==="allow"||v.decision==="deny")){const x=`${m}:${v.attempt}:${v.toolName}`;g.has(x)||(g.add(x),f(m).hookFires.push({toolName:v.toolName,decision:v.decision,denyingPolicy:typeof v.denyingPolicy=="string"?v.denyingPolicy:null}))}break;case"validationPinAttached":m!==void 0&&(f(m).validationPinAttached=!0);break;case"gateEscalated":m!==void 0&&(f(m).gateEscalated=!0);break;case"toolExecutorDispatched":m!==void 0&&Array.isArray(v.cmd)&&(f(m).toolExecutorCmd=v.cmd);break;case"governanceContextArmed":m!==void 0&&(f(m).governanceArmed=!0);break;case"governanceUnenforced":m!==void 0&&typeof v.cli=="string"&&typeof v.reason=="string"&&(f(m).governanceUnenforced={cli:v.cli,reason:v.reason});break;case"workflowSelected":l===null&&typeof v.workflowId=="string"&&(l=v.workflowId);break;case"unitReworkAmended":if(m!==void 0&&typeof v.amendment=="string"){const x=f(m);x.reworkAmendment=v.amendment,typeof v.updatedDescription=="string"&&(x.description=v.updatedDescription)}break;case"unitOutputCaptured":if(m!==void 0&&typeof v.attempt=="number"&&typeof v.outputBytes=="number"&&typeof v.governed=="boolean"){const x=f(m);x.outputBytes=v.outputBytes,x.outputGoverned=v.governed}break}}const y=[...n.values()].sort((v,m)=>v.ord-m.ord);return{session:r,units:y,pendingGate:i,activeTerminalId:s,acpFallbacks:o,lastWorkerClose:a,selectedWorkflow:l}}function vb(t){return(t.split(/[\\/]/).pop()??t).replace(/\.(exe|cmd|bat)$/i,"").toLowerCase()}function n5(t,e){const r=t==null?void 0:t.trim();return r?vb(r.split(/\s+/)[0]??"")==="claude":e!==null&&vb(e)==="claude"}function i5(t){let e=0,r=0,n=0,i=0,s=0,o=0,a=0,l=0;const u=new Map,c=new Set,d=new Set;for(const f of t.units){const y=f.status==="distributed"||f.status==="done"||f.status==="rejected";f.usage.length===0&&f.assignedCli!==null&&y&&(n5(f.assignedInvocation,f.assignedCli)?d.add(f.assignedCli):c.add(f.assignedCli));const _=f.assignedCli??"unknown",v=f.usage.length>0?Math.min(...f.usage.map(m=>m.attempt)):0;for(const m of f.usage){a+=1,e+=m.inputTokens,r+=m.outputTokens,m.costUsd!==null&&(s+=m.costUsd,o+=1),m.attempt>v&&(l+=m.inputTokens+m.outputTokens),n+=m.cacheReadTokens,i+=m.cacheCreationTokens;const x=u.get(_)??{cli:_,input:0,output:0,cost:null};x.input+=m.inputTokens,x.output+=m.outputTokens,m.costUsd!==null&&(x.cost=(x.cost??0)+m.costUsd),u.set(_,x)}}const g=e+r;return{totalInput:e,totalOutput:r,totalTokens:g,totalCost:o>0?s:null,costComplete:a>0&&o===a,reworkTokens:l,reworkPct:g>0?l/g*100:0,perCli:[...u.values()],noAdapterClis:[...c],pendingUsageClis:[...d],hasUsage:a>0,totalCacheRead:n,totalCacheCreation:i}}const a5=[];function s5(t,e){const r=zs(o=>o.byRun[t])??a5,[n,i]=J.useState(e??null),s=zs(o=>{const a=o.byRun[t];if(a===void 0)return 0;let l=0;for(const u of a)e5.has(u.type)&&(l+=1);return l});return J.useEffect(()=>{let o=!1;return(async()=>{try{const{run:a}=await Ve.getRun(t);o||i(a)}catch{}})(),()=>{o=!0}},[t,s]),J.useMemo(()=>n===null||n.session.id!==t?null:r5(n,r),[n,r,t])}const mb=2e5,Gi=500;function E2(t,e){return`${t}:u${e}`}const yb=160;function xb(t){const e=t.replace(/\r/g,"").split(`
|
|
376
|
-
`)[0]??"";return e.length>yb?`${e.slice(0,yb-1)}…`:e}function lc(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"councilSeatFailed":{const e=typeof t.exitCode=="number"?` (exit ${t.exitCode})`:"",r=typeof t.stderr=="string"&&t.stderr.trim()||typeof t.detail=="string"&&t.detail.trim()||"";return`seat ${String(t.cli??"?")} did not vote — ${String(t.kind??"unreported")}${e}${xb(r)?`: ${xb(r)}`:""}`}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 Ha=oa(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=>{var u;const i=n.seq+1;if(e.type==="cliOutputDelta"&&typeof e.ord=="number"&&typeof e.chunk=="string"){const c=E2(r,e.ord);let g=(n.outputs[c]??"")+e.chunk;return g.length>mb&&(g=g.slice(g.length-mb)),{seq:i,outputs:{...n.outputs,[c]:g}}}if(e.type==="heartbeat")return{seq:i};if(e.type==="assumptionRecorded"&&typeof e.ord=="number"&&typeof e.library=="string"&&typeof e.transform=="string"){const c={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:""},d=n.assumptions[r]??[];return{seq:i,assumptions:{...n.assumptions,[r]:[...d,c]}}}if(e.type==="councilSeatFailed"&&typeof e.ord=="number"){const c=`${r}:${e.ord}`,d=n.councilStatus[c],g={cli:typeof e.cli=="string"?e.cli:"?",kind:typeof e.kind=="string"?e.kind:"unreported",...typeof e.exitCode=="number"?{exitCode:e.exitCode}:{},why:(typeof e.stderr=="string"&&e.stderr.trim()||typeof e.detail=="string"&&e.detail.trim()||"").replace(/\r\n?/g,`
|
|
377
|
-
`)},f={seq:i,type:e.type,ts:Date.now(),detail:lc(e)};f.ord=e.ord;const _=[...n.logs[r]??[],f];return _.length>Gi&&_.splice(0,_.length-Gi),{seq:i,councilStatus:{...n.councilStatus,[c]:{...d??{state:"convened"},failedSeats:[...(d==null?void 0:d.failedSeats)??[],g]}},logs:{...n.logs,[r]:_}}}if((e.type==="councilConvened"||e.type==="councilDeliberated"||e.type==="councilVoted")&&typeof e.ord=="number"){const c=`${r}:${e.ord}`,d=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}:{}},g=(u=n.councilStatus[c])==null?void 0:u.failedSeats;g!==void 0&&g.length>0&&(d.failedSeats=g);const f={seq:i,type:e.type,ts:Date.now(),detail:lc(e)};f.ord=e.ord,typeof e.attempt=="number"&&(f.attempt=e.attempt);const _=[...n.logs[r]??[],f];return _.length>Gi&&_.splice(0,_.length-Gi),{seq:i,councilStatus:{...n.councilStatus,[c]:d},logs:{...n.logs,[r]:_}}}const s=e.executorType??e.executor_type;if(e.type==="unitPlanned"&&typeof e.ord=="number"&&(s==="agent"||s==="tool")){const c=`${r}:${e.ord}`;return{seq:i,executorTypes:{...n.executorTypes,[c]:s},...(()=>{const d={seq:i,type:e.type,ts:Date.now(),detail:lc(e)};d.ord=e.ord;const f=[...n.logs[r]??[],d];return f.length>Gi&&f.splice(0,f.length-Gi),{logs:{...n.logs,[r]:f}}})()}}if(e.type==="workerSessionStarted"&&typeof e.terminalId=="string"&&typeof e.cliKey=="string"){const c=`${r}:${e.cliKey}`;return{seq:i,terminalIds:{...n.terminalIds,[c]:e.terminalId}}}const o={seq:i,type:e.type,ts:Date.now(),detail:lc(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>Gi&&l.splice(0,l.length-Gi),{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 Ev(t){return t.seated==null?`${t.returned} polled`:`${t.returned} of ${t.seated} seats`}function pd(t){return t.seated!=null&&t.returned*2<=t.seated}function o5(t){return t.dissent===0&&!pd(t)}function l5(t){if(t.method==="council"){if(o5(t))return`council: ${t.winner} (unanimous)`;const e=`${t.dissent} dissent, ${t.agreement_pct}% agreement`;return pd(t)?`council: ${t.winner} (quorum lost — ${Ev(t)}, ${e})`:`council: ${t.winner} (${e})`}return t.method==="evaluator_distinct"?`evaluator≠creator: ${t.winner} (was ${t.was})`:t.method==="tool"?"tool: direct command (no council)":`degraded: ${t.reason}`}function u5({model:t}){const e=t.units.filter(n=>n.resolved&&n.routing!=null),r=Ha(n=>n.assumptions[t.session.id])??[];return w.jsxs("div",{"data-testid":"assumptions",className:"flex flex-col gap-2 text-[11px]",children:[r.length>0&&w.jsxs("div",{className:"flex flex-col gap-1",children:[w.jsx("p",{className:"font-mono font-semibold",style:{color:"rgba(230,237,243,0.6)"},children:"external transformations"}),w.jsx("ul",{className:"flex flex-col gap-1",children:r.map((n,i)=>w.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:[w.jsxs("div",{className:"flex items-center gap-1.5",children:[w.jsxs("span",{style:{color:"#e6edf3"},children:["unit #",n.ord]}),w.jsx("span",{style:{color:"#79c0ff"},children:n.library}),!n.known&&w.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"})]}),w.jsx("p",{style:{color:"rgba(230,237,243,0.7)"},children:n.transform}),w.jsx("p",{style:{color:"rgba(230,237,243,0.45)"},children:n.detail})]},`${n.ord}:${n.library}:${i}`))})]}),e.length===0?w.jsx("p",{style:{color:"rgba(230,237,243,0.4)"},children:"No routing decisions recorded yet."}):w.jsx("ul",{className:"flex flex-col gap-1",children:e.map(n=>w.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:[w.jsxs("span",{className:"font-medium",style:{color:"#e6edf3"},children:["unit #",n.ord]}),n.description.includes(" — ")&&w.jsx("span",{className:"ml-1",style:{color:"rgba(230,237,243,0.4)"},children:n.description.split(" — ")[0]})," ","— ",l5(n.routing)]},n.ord))})]})}const c5=new Set(["completed","cancelled","failed"]),d5=new Intl.NumberFormat("en-US");function Aa(t){return d5.format(t)}function bb(t){return t===null?"—":`$${t.toFixed(4)}`}function h5({model:t}){const e=i5(t),n=!c5.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 w.jsxs("div",{"data-testid":"burn",className:"flex flex-col gap-2 text-[11px]",children:[e.hasUsage?w.jsxs(w.Fragment,{children:[w.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[w.jsxs("div",{style:i,children:[w.jsxs("p",{style:{color:"rgba(230,237,243,0.4)"},children:["tokens",n?" (partial)":""]}),w.jsx("p",{className:"font-mono text-sm",style:{color:"#e6edf3"},children:Aa(e.totalTokens)}),w.jsxs("p",{className:"text-[10px]",style:{color:"rgba(230,237,243,0.35)"},children:[Aa(e.totalInput)," in / ",Aa(e.totalOutput)," out"]}),(e.totalCacheRead>0||e.totalCacheCreation>0)&&w.jsxs("p",{className:"text-[10px]",style:{color:"rgba(96,165,250,0.55)"},children:[Aa(e.totalCacheRead)," cached · ",Aa(e.totalCacheCreation)," written"]})]}),w.jsxs("div",{style:i,children:[w.jsxs("p",{style:{color:"rgba(230,237,243,0.4)"},children:["cost",e.costComplete&&!n?"":" (partial)"]}),w.jsx("p",{className:"font-mono text-sm",style:{color:"#e6edf3"},children:bb(e.totalCost)}),e.totalCost===null&&w.jsx("p",{className:"text-[10px]",style:{color:"rgba(230,237,243,0.35)"},children:"no cost reported"})]}),w.jsxs("div",{style:i,"data-testid":"burn-rework",children:[w.jsxs("p",{style:{color:"rgba(230,237,243,0.4)"},children:["rework",n?" (prov.)":""]}),w.jsxs("p",{className:"font-mono text-sm",style:{color:"#e6edf3"},children:[n?"~":"",e.reworkPct.toFixed(0),"%"]}),w.jsxs("p",{className:"text-[10px]",style:{color:"rgba(230,237,243,0.35)"},children:[Aa(e.reworkTokens)," tok"]})]})]}),n&&w.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."}),w.jsxs("div",{children:[w.jsx("p",{className:"mb-1",style:{color:"rgba(230,237,243,0.4)"},children:"per CLI"}),w.jsx("ul",{className:"flex flex-col gap-0.5",children:e.perCli.map(s=>w.jsxs("li",{className:"flex justify-between font-mono",style:{color:"rgba(230,237,243,0.6)"},children:[w.jsx("span",{children:s.cli}),w.jsxs("span",{children:[Aa(s.input+s.output)," tok · ",bb(s.cost)]})]},s.cli))})]})]}):w.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 ",w.jsx("code",{children:"cliUsage"})," ","(claude reports tokens + cost directly)."]}),e.noAdapterClis.length>0&&w.jsxs("p",{style:{color:"#ffda19"},"data-testid":"burn-unavailable",children:["usage unavailable for ",e.noAdapterClis.join(", ")," — no usage adapter"]}),e.pendingUsageClis.length>0&&w.jsxs("p",{style:{color:"rgba(230,237,243,0.4)"},"data-testid":"burn-pending",children:["usage not yet reported for ",e.pendingUsageClis.join(", ")]})]})}function f5({model:t}){const e=t.units.filter(r=>r.filesRead.length>0);return w.jsxs("div",{"data-testid":"data-used",className:"flex flex-col gap-2 text-[11px]",children:[e.length===0?w.jsxs("p",{style:{color:"rgba(230,237,243,0.4)"},"data-testid":"data-used-empty",children:["No files-read captured yet — populated from claude ",w.jsx("code",{children:"tool_use"})," blocks via"," ",w.jsx("code",{children:"dataUsed"}),"."]}):w.jsx("ul",{className:"flex flex-col gap-2",children:e.map(r=>w.jsxs("li",{"data-testid":"data-used-unit","data-ord":r.ord,children:[w.jsxs("p",{className:"font-semibold font-mono",style:{color:"rgba(230,237,243,0.7)"},children:["unit #",r.ord,r.assignedCli?` · ${r.assignedCli}`:""]}),w.jsx("ul",{className:"mt-0.5 flex flex-col gap-0.5",children:r.filesRead.map(n=>w.jsx("li",{className:"truncate font-mono",style:{color:"rgba(230,237,243,0.45)"},title:n,children:n},n))})]},r.ord))}),w.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 p5({routing:t}){return t?t.method==="council"?w.jsxs("p",{className:"text-[11px] font-mono",style:{color:"rgba(230,237,243,0.45)"},"data-testid":"routing-provenance",children:[w.jsx("span",{className:"font-medium",style:{color:"rgba(230,237,243,0.6)"},children:"Council:"})," ",t.winner," won · ",t.agreement_pct,"% agreement · ",Ev(t)," · ",t.dissent," dissent",pd(t)&&w.jsx("span",{style:{color:"#ffda19"},children:" · quorum lost"})]}):t.method==="degraded"?w.jsxs("p",{className:"text-[11px] font-mono",style:{color:"#ffda19"},"data-testid":"routing-provenance",children:[w.jsx("span",{className:"font-medium",children:"Degraded:"})," ",t.reason]}):t.method==="tool"?w.jsxs("p",{className:"text-[11px] font-mono",style:{color:"rgba(230,237,243,0.4)"},"data-testid":"routing-provenance",children:[w.jsx("span",{className:"font-medium",children:"Tool:"})," direct command — no council"]}):w.jsxs("p",{className:"text-[11px] font-mono",style:{color:"#a78bfa"},"data-testid":"routing-provenance",children:[w.jsx("span",{className:"font-medium",children:"Evaluator-distinct:"})," ",t.winner," (was ",t.was,")"]}):null}function g5(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===!0&&t.evaluatorPolicies.length>0?"evaluator (2nd pass)":t.agentVerdict!==null?"agent judge":t.hasDeterministicFloor?"deterministic floor":"ungated"}function v5({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 w.jsx("div",{"data-testid":"decisions-ledger",className:"flex flex-col gap-2",children:i.length===0&&n===null?w.jsx("p",{className:"text-xs font-mono",style:{color:"rgba(230,237,243,0.4)"},children:"No governed decisions recorded yet."}):w.jsxs("ol",{className:"flex flex-col gap-2",children:[i.map(l=>w.jsxs("li",{"data-testid":"ledger-row","data-ord":l.ord,style:a,children:[w.jsxs("div",{className:"flex items-center justify-between mb-1",children:[w.jsxs("div",{className:"flex items-center gap-1",children:[w.jsxs("span",{className:"font-semibold text-[11px] font-mono",style:{color:"#e6edf3"},children:["unit #",l.ord]}),(l.role==="creator"||l.role==="evaluator")&&w.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"&&w.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&&w.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]})]}),w.jsx("span",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.35)"},children:l.resolved?l.stage:"resolving…"})]}),w.jsx(p5,{routing:l.routing}),l.skillRef&&w.jsxs("p",{className:"text-[11px] font-mono",style:{color:"rgba(230,237,243,0.4)"},children:["skill: ",w.jsx("span",{style:{color:"rgba(230,237,243,0.6)"},children:l.skillRef})]}),l.gateEvals.map((u,c)=>w.jsxs("div",{className:"mt-1 rounded p-1.5",style:{background:"#0f1419",border:"1px solid rgba(230,237,243,0.05)"},children:[w.jsxs("p",{className:"text-[11px] font-mono",children:[w.jsx("span",{className:"font-semibold",style:{color:u.combined?"#3fb950":"#f85149"},children:u.combined?"ALLOW":"DENY"}),w.jsxs("span",{style:{color:"rgba(230,237,243,0.45)"},children:[" · ",g5(u),u.criterion?` · ${u.criterion}`:" · (ungated)"]})]}),u.hasDeterministicFloor&&w.jsxs("p",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.4)"},children:["deterministic: ",u.deterministicPass?"pass":"fail"]}),u.agentVerdict!==null&&w.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&&w.jsxs("p",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.4)"},children:["evaluator: ",u.evaluatorPass?"pass":"fail",u.evaluatorPolicies.length>0?` — ${u.evaluatorPolicies.join(", ")}`:u.evaluatorPass?" (no policy applied)":""]}),u.denialReason&&w.jsxs("p",{className:"text-[10px] font-mono",style:{color:"#f85149"},children:["reason: ",u.denialReason]})]},c)),l.denialReason&&l.gateEvals.length===0&&w.jsxs("p",{className:"mt-1 text-[11px] font-mono",style:{color:"#f85149"},"data-testid":"ledger-denial",children:["denied: ",l.denialReason]})]},l.ord)),n!==null&&w.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:[w.jsx("span",{className:"font-semibold",children:"PENDING"})," · awaiting human · before unit #",n.ord,n.prompt?` — ${n.prompt}`:""]}),s!==null&&w.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 m5({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 w.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 y5({claim:t}){const[e,r]=J.useState(!1),n=new Date(t.evaluated_at*1e3).toLocaleTimeString();return w.jsxs("li",{className:"rounded p-2 text-[11px]",style:{background:"#161c26",border:"1px solid rgba(230,237,243,0.07)"},children:[w.jsxs("div",{className:"flex items-center justify-between gap-2",children:[w.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[w.jsx(m5,{decision:t.decision}),w.jsx("span",{className:"font-mono truncate",style:{color:"rgba(230,237,243,0.6)"},children:t.phase})]}),w.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[w.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)&&w.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&&w.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&&w.jsxs("p",{children:[w.jsx("span",{className:"font-semibold",style:{color:"rgba(230,237,243,0.7)"},children:"criteria: "}),t.criteria]}),t.policy_ids.length>0&&w.jsxs("div",{children:[w.jsx("p",{className:"font-semibold",style:{color:"rgba(230,237,243,0.7)"},children:"policies matched:"}),w.jsx("ul",{className:"list-inside list-disc pl-1",children:t.policy_ids.map(i=>w.jsx("li",{children:i},i))})]}),t.obligations.length>0&&w.jsxs("div",{children:[w.jsx("p",{className:"font-semibold",style:{color:"rgba(230,237,243,0.7)"},children:"obligations:"}),w.jsx("ul",{className:"list-inside list-disc pl-1",children:t.obligations.map((i,s)=>w.jsx("li",{children:i},s))})]}),w.jsxs("p",{children:["evaluator: ",w.jsx("span",{children:t.evaluator_identity})," · ","claim: ",w.jsx("span",{children:t.claim_id})]})]})]})}function x5({model:t}){const[e,r]=J.useState([]),[n,i]=J.useState(!0),[s,o]=J.useState(null),a=J.useCallback(async()=>{i(!0),o(null);try{const{claims:d}=await Ve.listClaims();r(d.filter(g=>g.scope===t.session.id).sort((g,f)=>g.evaluated_at-f.evaluated_at))}catch(d){o(d instanceof Error?d.message:String(d))}finally{i(!1)}},[t.session.id]);J.useEffect(()=>{a()},[a]);const l=w.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 w.jsx("p",{className:"text-xs font-mono",style:{color:"rgba(230,237,243,0.4)"},children:"Loading governance claims…"});if(s)return w.jsxs("div",{className:"flex flex-col gap-1",children:[w.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 w.jsxs("div",{className:"flex flex-col gap-1",children:[w.jsx("p",{className:"text-xs font-mono",style:{color:"rgba(230,237,243,0.4)"},children:"No governance claims recorded for this run."}),w.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(d=>d.decision==="deny").length,c=e.filter(d=>d.decision==="allow_with_conditions").length;return w.jsxs("div",{className:"flex flex-col gap-2",children:[w.jsxs("div",{className:"flex items-center justify-between",children:[w.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&&w.jsxs("span",{className:"ml-1 font-semibold",style:{color:"#f85149"},children:["· ",u," denied"]}),c>0&&w.jsxs("span",{className:"ml-1",style:{color:"#ffda19"},children:["· ",c," with obligations"]})]}),l]}),w.jsx("ol",{className:"flex flex-col gap-1.5",children:e.map(d=>w.jsx(y5,{claim:d},d.claim_id))})]})}function wb({title:t,onClose:e,children:r,disableEscapeKey:n}){const i=J.useId();return J.useEffect(()=>{if(n)return;function s(o){o.key==="Escape"&&e()}return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[e,n]),w.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{background:"rgba(0,0,0,0.6)"},children:w.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:[w.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:[w.jsx("h2",{id:i,className:"text-sm font-semibold font-mono",style:{color:"#e6edf3"},children:t}),w.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:"✕"})]}),w.jsx("div",{className:"flex-1 overflow-auto p-4",children:r})]})})}const b5={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 w5({runId:t}){const e=Kg(r=>r.entries).filter(r=>r.runId===t);return e.length===0?w.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."}):w.jsxs("div",{className:"flex flex-col gap-2",children:[w.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."}),w.jsx("ol",{"data-testid":"steering-timeline",className:"flex flex-col gap-2",children:e.map(r=>{const n=b5[r.action];return w.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:[w.jsxs("div",{className:"flex items-center justify-between",children:[w.jsx("span",{className:"font-semibold font-mono",style:{color:n.color},children:n.label}),w.jsx("span",{className:"font-mono",style:{color:"rgba(230,237,243,0.35)"},children:typeof r.ord=="number"?`before unit #${r.ord}`:"—"})]}),r.amend&&w.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:[w.jsx("span",{className:"font-medium",style:{color:"#e6edf3"},children:"amended instruction:"})," ",r.amend]}),w.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 $p={exports:{}},_b;function _5(){return _b||(_b=1,(function(t,e){(function(r,n){t.exports=n()})(globalThis,(()=>(()=>{var r={4567:function(o,a,l){var u=this&&this.__decorate||function(x,b,S,T){var N,E=arguments.length,k=E<3?b:T===null?T=Object.getOwnPropertyDescriptor(b,S):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(x,b,S,T);else for(var L=x.length-1;L>=0;L--)(N=x[L])&&(k=(E<3?N(k):E>3?N(b,S,k):N(b,S))||k);return E>3&&k&&Object.defineProperty(b,S,k),k},c=this&&this.__param||function(x,b){return function(S,T){b(S,T,x)}};Object.defineProperty(a,"__esModule",{value:!0}),a.AccessibilityManager=void 0;const d=l(9042),g=l(9924),f=l(844),y=l(4725),_=l(2585),v=l(3656);let m=a.AccessibilityManager=class extends f.Disposable{constructor(x,b,S,T){super(),this._terminal=x,this._coreBrowserService=S,this._renderService=T,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 N=0;N<this._terminal.rows;N++)this._rowElements[N]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[N]);if(this._topBoundaryFocusListener=N=>this._handleBoundaryFocus(N,0),this._bottomBoundaryFocusListener=N=>this._handleBoundaryFocus(N,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 g.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((N=>this._handleResize(N.rows)))),this.register(this._terminal.onRender((N=>this._refreshRows(N.start,N.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((N=>this._handleChar(N)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
|
|
378
|
-
`)))),this.register(this._terminal.onA11yTab((N=>this._handleTab(N)))),this.register(this._terminal.onKey((N=>this._handleKey(N.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this.register((0,v.addDisposableDomListener)(document,"selectionchange",(()=>this._handleSelectionChange()))),this.register(this._coreBrowserService.onDprChange((()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,f.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(x){for(let b=0;b<x;b++)this._handleChar(" ")}_handleChar(x){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==x&&(this._charsToAnnounce+=x):this._charsToAnnounce+=x,x===`
|
|
379
|
-
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=d.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(x){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(x)||this._charsToConsume.push(x)}_refreshRows(x,b){this._liveRegionDebouncer.refresh(x,b,this._terminal.rows)}_renderRows(x,b){const S=this._terminal.buffer,T=S.lines.length.toString();for(let N=x;N<=b;N++){const E=S.lines.get(S.ydisp+N),k=[],L=(E==null?void 0:E.translateToString(!0,void 0,void 0,k))||"",A=(S.ydisp+N+1).toString(),I=this._rowElements[N];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",T))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(x,b){const S=x.target,T=this._rowElements[b===0?1:this._rowElements.length-2];if(S.getAttribute("aria-posinset")===(b===0?"1":`${this._terminal.buffer.lines.length}`)||x.relatedTarget!==T)return;let N,E;if(b===0?(N=S,E=this._rowElements.pop(),this._rowContainer.removeChild(E)):(N=this._rowElements.shift(),E=S,this._rowContainer.removeChild(N)),N.removeEventListener("focus",this._topBoundaryFocusListener),E.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(),x.preventDefault(),x.stopImmediatePropagation()}_handleSelectionChange(){var L;if(this._rowElements.length===0)return;const x=document.getSelection();if(!x)return;if(x.isCollapsed)return void(this._rowContainer.contains(x.anchorNode)&&this._terminal.clearSelection());if(!x.anchorNode||!x.focusNode)return void console.error("anchorNode and/or focusNode are null");let b={node:x.anchorNode,offset:x.anchorOffset},S={node:x.focusNode,offset:x.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 T=this._rowElements.slice(-1)[0];if(S.node.compareDocumentPosition(T)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(S={node:T,offset:((L=T.textContent)==null?void 0:L.length)??0}),!this._rowContainer.contains(S.node))return;const N=({node:A,offset:I})=>{const O=A instanceof Text?A.parentNode:A;let B=parseInt(O==null?void 0:O.getAttribute("aria-posinset"),10)-1;if(isNaN(B))return console.warn("row is invalid. Race condition?"),null;const D=this._rowColumns.get(O);if(!D)return console.warn("columns is null. Race condition?"),null;let M=I<D.length?D[I]:D.slice(-1)[0]+1;return M>=this._terminal.cols&&(++B,M=0),{row:B,column:M}},E=N(b),k=N(S);if(E&&k){if(E.row>k.row||E.row===k.row&&E.column>=k.column)throw new Error("invalid range");this._terminal.select(E.column,E.row,(k.row-E.row)*this._terminal.cols-E.column+k.column)}}_handleResize(x){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>x;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const x=this._coreBrowserService.mainDocument.createElement("div");return x.setAttribute("role","listitem"),x.tabIndex=-1,this._refreshRowDimensions(x),x}_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 x=0;x<this._terminal.rows;x++)this._refreshRowDimensions(this._rowElements[x])}}_refreshRowDimensions(x){x.style.height=`${this._renderService.dimensions.css.cell.height}px`}};a.AccessibilityManager=m=u([c(1,_.IInstantiationService),c(2,y.ICoreBrowserService),c(3,y.IRenderService)],m)},3614:(o,a)=>{function l(g){return g.replace(/\r?\n/g,"\r")}function u(g,f){return f?"\x1B[200~"+g+"\x1B[201~":g}function c(g,f,y,_){g=u(g=l(g),y.decPrivateModes.bracketedPasteMode&&_.rawOptions.ignoreBracketedPasteMode!==!0),y.triggerDataEvent(g,!0),f.value=""}function d(g,f,y){const _=y.getBoundingClientRect(),v=g.clientX-_.left-10,m=g.clientY-_.top-10;f.style.width="20px",f.style.height="20px",f.style.left=`${v}px`,f.style.top=`${m}px`,f.style.zIndex="1000",f.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(g,f){g.clipboardData&&g.clipboardData.setData("text/plain",f.selectionText),g.preventDefault()},a.handlePasteEvent=function(g,f,y,_){g.stopPropagation(),g.clipboardData&&c(g.clipboardData.getData("text/plain"),f,y,_)},a.paste=c,a.moveTextAreaUnderMouseCursor=d,a.rightClickHandler=function(g,f,y,_,v){d(g,f,y),v&&_.rightClickSelect(g),f.value=_.selectionText,f.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,d,g){this._css.set(c,d,g)}getCss(c,d){return this._css.get(c,d)}setColor(c,d,g){this._color.set(c,d,g)}getColor(c,d){return this._color.get(c,d)}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,d){l.addEventListener(u,c,d);let g=!1;return{dispose:()=>{g||(g=!0,l.removeEventListener(u,c,d))}}}},3551:function(o,a,l){var u=this&&this.__decorate||function(m,x,b,S){var T,N=arguments.length,E=N<3?x:S===null?S=Object.getOwnPropertyDescriptor(x,b):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(m,x,b,S);else for(var k=m.length-1;k>=0;k--)(T=m[k])&&(E=(N<3?T(E):N>3?T(x,b,E):T(x,b))||E);return N>3&&E&&Object.defineProperty(x,b,E),E},c=this&&this.__param||function(m,x){return function(b,S){x(b,S,m)}};Object.defineProperty(a,"__esModule",{value:!0}),a.Linkifier=void 0;const d=l(3656),g=l(8460),f=l(844),y=l(2585),_=l(4725);let v=a.Linkifier=class extends f.Disposable{get currentLink(){return this._currentLink}constructor(m,x,b,S,T){super(),this._element=m,this._mouseService=x,this._renderService=b,this._bufferService=S,this._linkProviderService=T,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new g.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new g.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,f.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,f.toDisposable)((()=>{var N;this._lastMouseEvent=void 0,(N=this._activeProviderReplies)==null||N.clear()}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0}))),this.register((0,d.addDisposableDomListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,d.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,d.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,d.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(m){this._lastMouseEvent=m;const x=this._positionFromMouseEvent(m,this._element,this._mouseService);if(!x)return;this._isMouseOut=!1;const b=m.composedPath();for(let S=0;S<b.length;S++){const T=b[S];if(T.classList.contains("xterm"))break;if(T.classList.contains("xterm-hover"))return}this._lastBufferCell&&x.x===this._lastBufferCell.x&&x.y===this._lastBufferCell.y||(this._handleHover(x),this._lastBufferCell=x)}_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,x){var S,T;this._activeProviderReplies&&x||((S=this._activeProviderReplies)==null||S.forEach((N=>{N==null||N.forEach((E=>{E.link.dispose&&E.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=m.y);let b=!1;for(const[N,E]of this._linkProviderService.linkProviders.entries())x?(T=this._activeProviderReplies)!=null&&T.get(N)&&(b=this._checkLinkProviderResult(N,m,b)):E.provideLinks(m.y,(k=>{var A,I;if(this._isMouseOut)return;const L=k==null?void 0:k.map((O=>({link:O})));(A=this._activeProviderReplies)==null||A.set(N,L),b=this._checkLinkProviderResult(N,m,b),((I=this._activeProviderReplies)==null?void 0:I.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(m.y,this._activeProviderReplies)}))}_removeIntersectingLinks(m,x){const b=new Set;for(let S=0;S<x.size;S++){const T=x.get(S);if(T)for(let N=0;N<T.length;N++){const E=T[N],k=E.link.range.start.y<m?0:E.link.range.start.x,L=E.link.range.end.y>m?this._bufferService.cols:E.link.range.end.x;for(let A=k;A<=L;A++){if(b.has(A)){T.splice(N--,1);break}b.add(A)}}}}_checkLinkProviderResult(m,x,b){var N;if(!this._activeProviderReplies)return b;const S=this._activeProviderReplies.get(m);let T=!1;for(let E=0;E<m;E++)this._activeProviderReplies.has(E)&&!this._activeProviderReplies.get(E)||(T=!0);if(!T&&S){const E=S.find((k=>this._linkAtPosition(k.link,x)));E&&(b=!0,this._handleNewLink(E))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!b)for(let E=0;E<this._activeProviderReplies.size;E++){const k=(N=this._activeProviderReplies.get(E))==null?void 0:N.find((L=>this._linkAtPosition(L.link,x)));if(k){b=!0,this._handleNewLink(k);break}}return b}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(m){if(!this._currentLink)return;const x=this._positionFromMouseEvent(m,this._element,this._mouseService);x&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,x)&&this._currentLink.link.activate(m,this._currentLink.link.text)}_clearCurrentLink(m,x){this._currentLink&&this._lastMouseEvent&&(!m||!x||this._currentLink.link.range.start.y>=m&&this._currentLink.link.range.end.y<=x)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,f.disposeArray)(this._linkCacheDisposables))}_handleNewLink(m){if(!this._lastMouseEvent)return;const x=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);x&&this._linkAtPosition(m.link,x)&&(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,T,N;(S=this._currentLink)!=null&&S.state&&((N=(T=this._currentLink)==null?void 0:T.state)==null?void 0:N.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,T=this._bufferService.buffer.ydisp+1+b.end;if(this._currentLink.link.range.start.y>=S&&this._currentLink.link.range.end.y<=T&&(this._clearCurrentLink(S,T),this._lastMouseEvent)){const N=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);N&&this._askForLink(N,!1)}}))))}_linkHover(m,x,b){var S;(S=this._currentLink)!=null&&S.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(x,!0),this._currentLink.state.decorations.pointerCursor&&m.classList.add("xterm-cursor-pointer")),x.hover&&x.hover(b,x.text)}_fireUnderlineEvent(m,x){const b=m.range,S=this._bufferService.buffer.ydisp,T=this._createLinkUnderlineEvent(b.start.x-1,b.start.y-S-1,b.end.x,b.end.y-S-1,void 0);(x?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(T)}_linkLeave(m,x,b){var S;(S=this._currentLink)!=null&&S.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(x,!1),this._currentLink.state.decorations.pointerCursor&&m.classList.remove("xterm-cursor-pointer")),x.leave&&x.leave(b,x.text)}_linkAtPosition(m,x){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,T=x.y*this._bufferService.cols+x.x;return b<=T&&T<=S}_positionFromMouseEvent(m,x,b){const S=b.getCoords(m,x,this._bufferService.cols,this._bufferService.rows);if(S)return{x:S[0],y:S[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(m,x,b,S,T){return{x1:m,y1:x,x2:b,y2:S,cols:this._bufferService.cols,fg:T}}};a.Linkifier=v=u([c(1,_.IMouseService),c(2,_.IRenderService),c(3,y.IBufferService),c(4,_.ILinkProviderService)],v)},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(_,v,m,x){var b,S=arguments.length,T=S<3?v:x===null?x=Object.getOwnPropertyDescriptor(v,m):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(_,v,m,x);else for(var N=_.length-1;N>=0;N--)(b=_[N])&&(T=(S<3?b(T):S>3?b(v,m,T):b(v,m))||T);return S>3&&T&&Object.defineProperty(v,m,T),T},c=this&&this.__param||function(_,v){return function(m,x){v(m,x,_)}};Object.defineProperty(a,"__esModule",{value:!0}),a.OscLinkProvider=void 0;const d=l(511),g=l(2585);let f=a.OscLinkProvider=class{constructor(_,v,m){this._bufferService=_,this._optionsService=v,this._oscLinkService=m}provideLinks(_,v){var L;const m=this._bufferService.buffer.lines.get(_-1);if(!m)return void v(void 0);const x=[],b=this._optionsService.rawOptions.linkHandler,S=new d.CellData,T=m.getTrimmedLength();let N=-1,E=-1,k=!1;for(let A=0;A<T;A++)if(E!==-1||m.hasContent(A)){if(m.loadCell(A,S),S.hasExtendedAttrs()&&S.extended.urlId){if(E===-1){E=A,N=S.extended.urlId;continue}k=S.extended.urlId!==N}else E!==-1&&(k=!0);if(k||E!==-1&&A===T-1){const I=(L=this._oscLinkService.getLinkData(N))==null?void 0:L.uri;if(I){const O={start:{x:E+1,y:_},end:{x:A+(k||A!==T-1?0:1),y:_}};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||x.push({text:I,range:O,activate:(D,M)=>b?b.activate(D,M,O):y(0,M),hover:(D,M)=>{var U;return(U=b==null?void 0:b.hover)==null?void 0:U.call(b,D,M,O)},leave:(D,M)=>{var U;return(U=b==null?void 0:b.leave)==null?void 0:U.call(b,D,M,O)}})}k=!1,S.hasExtendedAttrs()&&S.extended.urlId?(E=A,N=S.extended.urlId):(E=-1,N=-1)}}v(x)}};function y(_,v){if(confirm(`Do you want to navigate to ${v}?
|
|
380
|
-
|
|
381
|
-
WARNING: This link could potentially be dangerous`)){const m=window.open();if(m){try{m.opener=null}catch{}m.location.href=v}else console.warn("Opening link blocked as opener could not be cleared")}}a.OscLinkProvider=f=u([c(0,g.IBufferService),c(1,g.IOptionsService),c(2,g.IOscLinkService)],f)},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),d=l(3551),g=l(9042),f=l(3730),y=l(1680),_=l(3107),v=l(5744),m=l(2950),x=l(1296),b=l(428),S=l(4269),T=l(5114),N=l(8934),E=l(3230),k=l(9312),L=l(4725),A=l(6731),I=l(8055),O=l(8969),B=l(8460),D=l(844),M=l(6114),U=l(8437),H=l(2584),$=l(7399),F=l(5941),P=l(9074),z=l(2585),G=l(5435),V=l(4567),te=l(779);class ie extends O.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(X={}){super(X),this.browser=M,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(z.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(te.LinkProviderService),this._instantiationService.setService(L.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(f.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(X){if(this._themeService)for(const q of X){let Y,K="";switch(q.index){case 256:Y="foreground",K="10";break;case 257:Y="background",K="11";break;case 258:Y="cursor",K="12";break;default:Y="ansi",K="4;"+q.index}switch(q.type){case 0:const ee=I.color.toColorRGB(Y==="ansi"?this._themeService.colors.ansi[q.index]:this._themeService.colors[Y]);this.coreService.triggerDataEvent(`${H.C0.ESC}]${K};${(0,F.toRgbString)(ee)}${H.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((ue=>ue[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(X){X?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(V.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(X){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(H.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var X;return(X=this.textarea)==null?void 0:X.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(H.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 X=this.buffer.ybase+this.buffer.y,q=this.buffer.lines.get(X);if(!q)return;const Y=Math.min(this.buffer.x,this.cols-1),K=this._renderService.dimensions.css.cell.height,ee=q.getWidth(Y),re=this._renderService.dimensions.css.cell.width*ee,ue=this.buffer.y*this._renderService.dimensions.css.cell.height,pe=Y*this._renderService.dimensions.css.cell.width;this.textarea.style.left=pe+"px",this.textarea.style.top=ue+"px",this.textarea.style.width=re+"px",this.textarea.style.height=K+"px",this.textarea.style.lineHeight=K+"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 X=q=>(0,u.handlePasteEvent)(q,this.textarea,this.coreService,this.optionsService);this.register((0,c.addDisposableDomListener)(this.textarea,"paste",X)),this.register((0,c.addDisposableDomListener)(this.element,"paste",X)),M.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)}))),M.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",(X=>this._keyUp(X)),!0)),this.register((0,c.addDisposableDomListener)(this.textarea,"keydown",(X=>this._keyDown(X)),!0)),this.register((0,c.addDisposableDomListener)(this.textarea,"keypress",(X=>this._keyPress(X)),!0)),this.register((0,c.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,c.addDisposableDomListener)(this.textarea,"compositionupdate",(X=>this._compositionHelper.compositionupdate(X)))),this.register((0,c.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,c.addDisposableDomListener)(this.textarea,"input",(X=>this._inputEvent(X)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(X){var Y;if(!X)throw new Error("Terminal requires a parent element.");if(X.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=X.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"),X.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",(K=>this.updateCursorStyle(K)))),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",g.promptLabel),M.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(T.CoreBrowserService,this.textarea,X.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",(K=>this._handleTextAreaFocus(K)))),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(E.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(L.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((K=>this._onRender.fire(K)))),this.onResize((K=>this._renderService.resize(K.cols,K.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(N.MouseService),this._instantiationService.setService(L.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(d.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(y.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((K=>this.scrollLines(K.amount,K.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((K=>this.scrollLines(K.amount,K.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((K=>this._renderService.handleSelectionChanged(K.start,K.end,K.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((K=>{this.textarea.value=K,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((K=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,c.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(_.BufferDecorationRenderer,this.screenElement)),this.register((0,c.addDisposableDomListener)(this.element,"mousedown",(K=>this._selectionService.handleMouseDown(K)))),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(V.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(K=>this._handleScreenReaderModeOptionChange(K)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(v.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(K=>{!this._overviewRulerRenderer&&K&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(v.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(x.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const X=this,q=this.element;function Y(re){const ue=X._mouseService.getMouseReportCoords(re,X.screenElement);if(!ue)return!1;let pe,Re;switch(re.overrideType||re.type){case"mousemove":Re=32,re.buttons===void 0?(pe=3,re.button!==void 0&&(pe=re.button<3?re.button:3)):pe=1&re.buttons?0:4&re.buttons?1:2&re.buttons?2:3;break;case"mouseup":Re=0,pe=re.button<3?re.button:3;break;case"mousedown":Re=1,pe=re.button<3?re.button:3;break;case"wheel":if(X._customWheelEventHandler&&X._customWheelEventHandler(re)===!1||X.viewport.getLinesScrolled(re)===0)return!1;Re=re.deltaY<0?0:1,pe=4;break;default:return!1}return!(Re===void 0||pe===void 0||pe>4)&&X.coreMouseService.triggerMouseEvent({col:ue.col,row:ue.row,x:ue.x,y:ue.y,button:pe,action:Re,ctrl:re.ctrlKey,alt:re.altKey,shift:re.shiftKey})}const K={mouseup:null,wheel:null,mousedrag:null,mousemove:null},ee={mouseup:re=>(Y(re),re.buttons||(this._document.removeEventListener("mouseup",K.mouseup),K.mousedrag&&this._document.removeEventListener("mousemove",K.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?K.mousemove||(q.addEventListener("mousemove",ee.mousemove),K.mousemove=ee.mousemove):(q.removeEventListener("mousemove",K.mousemove),K.mousemove=null),16&re?K.wheel||(q.addEventListener("wheel",ee.wheel,{passive:!1}),K.wheel=ee.wheel):(q.removeEventListener("wheel",K.wheel),K.wheel=null),2&re?K.mouseup||(K.mouseup=ee.mouseup):(this._document.removeEventListener("mouseup",K.mouseup),K.mouseup=null),4&re?K.mousedrag||(K.mousedrag=ee.mousedrag):(this._document.removeEventListener("mousemove",K.mousedrag),K.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),K.mouseup&&this._document.addEventListener("mouseup",K.mouseup),K.mousedrag&&this._document.addEventListener("mousemove",K.mousedrag),this.cancel(re)}))),this.register((0,c.addDisposableDomListener)(q,"wheel",(re=>{if(!K.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(re)===!1)return!1;if(!this.buffer.hasScrollback){const ue=this.viewport.getLinesScrolled(re);if(ue===0)return;const pe=H.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(re.deltaY<0?"A":"B");let Re="";for(let Be=0;Be<Math.abs(ue);Be++)Re+=pe;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(X,q){var Y;(Y=this._renderService)==null||Y.refreshRows(X,q)}updateCursorStyle(X){var q;(q=this._selectionService)!=null&&q.shouldColumnSelect(X)?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(X,q,Y=0){var K;Y===1?(super.scrollLines(X,q,Y),this.refresh(0,this.rows-1)):(K=this.viewport)==null||K.scrollLines(X)}paste(X){(0,u.paste)(X,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(X){this._customKeyEventHandler=X}attachCustomWheelEventHandler(X){this._customWheelEventHandler=X}registerLinkProvider(X){return this._linkProviderService.registerLinkProvider(X)}registerCharacterJoiner(X){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const q=this._characterJoinerService.register(X);return this.refresh(0,this.rows-1),q}deregisterCharacterJoiner(X){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(X)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(X){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+X)}registerDecoration(X){return this._decorationService.registerDecoration(X)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(X,q,Y){this._selectionService.setSelection(X,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 X;(X=this._selectionService)==null||X.clearSelection()}selectAll(){var X;(X=this._selectionService)==null||X.selectAll()}selectLines(X,q){var Y;(Y=this._selectionService)==null||Y.selectLines(X,q)}_keyDown(X){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(X)===!1)return!1;const q=this.browser.isMac&&this.options.macOptionIsMeta&&X.altKey;if(!q&&!this._compositionHelper.keydown(X))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;q||X.key!=="Dead"&&X.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const Y=(0,$.evaluateKeyboardEvent)(X,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(X),Y.type===3||Y.type===2){const K=this.rows-1;return this.scrollLines(Y.type===2?-K:K),this.cancel(X,!0)}return Y.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,X)||(Y.cancel&&this.cancel(X,!0),!Y.key||!!(X.key&&!X.ctrlKey&&!X.altKey&&!X.metaKey&&X.key.length===1&&X.key.charCodeAt(0)>=65&&X.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(Y.key!==H.C0.ETX&&Y.key!==H.C0.CR||(this.textarea.value=""),this._onKey.fire({key:Y.key,domEvent:X}),this._showCursor(),this.coreService.triggerDataEvent(Y.key,!0),!this.optionsService.rawOptions.screenReaderMode||X.altKey||X.ctrlKey?this.cancel(X,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(X,q){const Y=X.isMac&&!this.options.macOptionIsMeta&&q.altKey&&!q.ctrlKey&&!q.metaKey||X.isWindows&&q.altKey&&q.ctrlKey&&!q.metaKey||X.isWindows&&q.getModifierState("AltGraph");return q.type==="keypress"?Y:Y&&(!q.keyCode||q.keyCode>47)}_keyUp(X){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(X)===!1||((function(q){return q.keyCode===16||q.keyCode===17||q.keyCode===18})(X)||this.focus(),this.updateCursorStyle(X),this._keyPressHandled=!1)}_keyPress(X){let q;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(X)===!1)return!1;if(this.cancel(X),X.charCode)q=X.charCode;else if(X.which===null||X.which===void 0)q=X.keyCode;else{if(X.which===0||X.charCode===0)return!1;q=X.which}return!(!q||(X.altKey||X.ctrlKey||X.metaKey)&&!this._isThirdLevelShift(this.browser,X)||(q=String.fromCharCode(q),this._onKey.fire({key:q,domEvent:X}),this._showCursor(),this.coreService.triggerDataEvent(q,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(X){if(X.data&&X.inputType==="insertText"&&(!X.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const q=X.data;return this.coreService.triggerDataEvent(q,!0),this.cancel(X),!0}return!1}resize(X,q){X!==this.cols||q!==this.rows?super.resize(X,q):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(X,q){var Y,K;(Y=this._charSizeService)==null||Y.measure(),(K=this.viewport)==null||K.syncScrollArea(!0)}clear(){var X;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}),(X=this.viewport)==null||X.reset(),this.refresh(0,this.rows-1)}}reset(){var q,Y;this.options.rows=this.rows,this.options.cols=this.cols;const X=this._customKeyEventHandler;this._setup(),super.reset(),(q=this._selectionService)==null||q.reset(),this._decorationService.reset(),(Y=this.viewport)==null||Y.reset(),this._customKeyEventHandler=X,this.refresh(0,this.rows-1)}clearTextureAtlas(){var X;(X=this._renderService)==null||X.clearTextureAtlas()}_reportFocus(){var X;(X=this.element)!=null&&X.classList.contains("focus")?this.coreService.triggerDataEvent(H.C0.ESC+"[I"):this.coreService.triggerDataEvent(H.C0.ESC+"[O")}_reportWindowsOptions(X){if(this._renderService)switch(X){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(`${H.C0.ESC}[4;${Y};${q}t`);break;case G.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const K=this._renderService.dimensions.css.cell.width.toFixed(0),ee=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${H.C0.ESC}[6;${ee};${K}t`)}}cancel(X,q){if(this.options.cancelEvents||q)return X.preventDefault(),X.stopPropagation(),!1}}a.Terminal=ie},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 d=Date.now();if(d-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=d,this._innerRefresh();else if(!this._additionalRefreshRequested){const g=d-this._lastRefreshMs,f=this._debounceThresholdMS-g;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),f)}}_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,x,b,S){var T,N=arguments.length,E=N<3?x:S===null?S=Object.getOwnPropertyDescriptor(x,b):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(m,x,b,S);else for(var k=m.length-1;k>=0;k--)(T=m[k])&&(E=(N<3?T(E):N>3?T(x,b,E):T(x,b))||E);return N>3&&E&&Object.defineProperty(x,b,E),E},c=this&&this.__param||function(m,x){return function(b,S){x(b,S,m)}};Object.defineProperty(a,"__esModule",{value:!0}),a.Viewport=void 0;const d=l(3656),g=l(4725),f=l(8460),y=l(844),_=l(2585);let v=a.Viewport=class extends y.Disposable{constructor(m,x,b,S,T,N,E,k){super(),this._viewportElement=m,this._scrollArea=x,this._bufferService=b,this._optionsService=S,this._charSizeService=T,this._renderService=N,this._coreBrowserService=E,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 f.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,d.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 x=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==x&&(this._lastRecordedBufferHeight=x,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 x=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:x,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,x){const b=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(x<0&&this._viewportElement.scrollTop!==0||x>0&&b<this._lastRecordedBufferHeight)||(m.cancelable&&m.preventDefault(),!1)}handleWheel(m){const x=this._getPixelsScrolled(m);return x!==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+x:this._smoothScrollState.target+=x,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=x,this._bubbleScroll(m,x))}scrollLines(m){if(m!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const x=m*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+x,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 x=this._applyScrollModifier(m.deltaY,m);return m.deltaMode===WheelEvent.DOM_DELTA_LINE?x*=this._currentRowHeight:m.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(x*=this._currentRowHeight*this._bufferService.rows),x}getBufferElements(m,x){var k;let b,S="";const T=[],N=x??this._bufferService.buffer.lines.length,E=this._bufferService.buffer.lines;for(let L=m;L<N;L++){const A=E.get(L);if(!A)continue;const I=(k=E.get(L+1))==null?void 0:k.isWrapped;if(S+=A.translateToString(!I),!I||L===E.length-1){const O=document.createElement("div");O.textContent=S,T.push(O),S.length>0&&(b=O),S=""}}return{bufferElements:T,cursorElement:b}}getLinesScrolled(m){if(m.deltaY===0||m.shiftKey)return 0;let x=this._applyScrollModifier(m.deltaY,m);return m.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(x/=this._currentRowHeight+0,this._wheelPartialScroll+=x,x=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):m.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(x*=this._bufferService.rows),x}_applyScrollModifier(m,x){const b=this._optionsService.rawOptions.fastScrollModifier;return b==="alt"&&x.altKey||b==="ctrl"&&x.ctrlKey||b==="shift"&&x.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 x=this._lastTouchY-m.touches[0].pageY;return this._lastTouchY=m.touches[0].pageY,x!==0&&(this._viewportElement.scrollTop+=x,this._bubbleScroll(m,x))}};a.Viewport=v=u([c(2,_.IBufferService),c(3,_.IOptionsService),c(4,g.ICharSizeService),c(5,g.IRenderService),c(6,g.ICoreBrowserService),c(7,g.IThemeService)],v)},3107:function(o,a,l){var u=this&&this.__decorate||function(_,v,m,x){var b,S=arguments.length,T=S<3?v:x===null?x=Object.getOwnPropertyDescriptor(v,m):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(_,v,m,x);else for(var N=_.length-1;N>=0;N--)(b=_[N])&&(T=(S<3?b(T):S>3?b(v,m,T):b(v,m))||T);return S>3&&T&&Object.defineProperty(v,m,T),T},c=this&&this.__param||function(_,v){return function(m,x){v(m,x,_)}};Object.defineProperty(a,"__esModule",{value:!0}),a.BufferDecorationRenderer=void 0;const d=l(4725),g=l(844),f=l(2585);let y=a.BufferDecorationRenderer=class extends g.Disposable{constructor(_,v,m,x,b){super(),this._screenElement=_,this._bufferService=v,this._coreBrowserService=m,this._decorationService=x,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,g.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 _ of this._decorationService.decorations)this._renderDecoration(_);this._dimensionsChanged=!1}_renderDecoration(_){this._refreshStyle(_),this._dimensionsChanged&&this._refreshXPosition(_)}_createElement(_){var x;const v=this._coreBrowserService.mainDocument.createElement("div");v.classList.add("xterm-decoration"),v.classList.toggle("xterm-decoration-top-layer",((x=_==null?void 0:_.options)==null?void 0:x.layer)==="top"),v.style.width=`${Math.round((_.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,v.style.height=(_.options.height||1)*this._renderService.dimensions.css.cell.height+"px",v.style.top=(_.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",v.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const m=_.options.x??0;return m&&m>this._bufferService.cols&&(v.style.display="none"),this._refreshXPosition(_,v),v}_refreshStyle(_){const v=_.marker.line-this._bufferService.buffers.active.ydisp;if(v<0||v>=this._bufferService.rows)_.element&&(_.element.style.display="none",_.onRenderEmitter.fire(_.element));else{let m=this._decorationElements.get(_);m||(m=this._createElement(_),_.element=m,this._decorationElements.set(_,m),this._container.appendChild(m),_.onDispose((()=>{this._decorationElements.delete(_),m.remove()}))),m.style.top=v*this._renderService.dimensions.css.cell.height+"px",m.style.display=this._altBufferIsActive?"none":"block",_.onRenderEmitter.fire(m)}}_refreshXPosition(_,v=_.element){if(!v)return;const m=_.options.x??0;(_.options.anchor||"left")==="right"?v.style.right=m?m*this._renderService.dimensions.css.cell.width+"px":"":v.style.left=m?m*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(_){var v;(v=this._decorationElements.get(_))==null||v.remove(),this._decorationElements.delete(_),_.dispose()}};a.BufferDecorationRenderer=y=u([c(1,f.IBufferService),c(2,d.ICoreBrowserService),c(3,f.IDecorationService),c(4,d.IRenderService)],y)},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,T,N){var E,k=arguments.length,L=k<3?S:N===null?N=Object.getOwnPropertyDescriptor(S,T):N;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")L=Reflect.decorate(b,S,T,N);else for(var A=b.length-1;A>=0;A--)(E=b[A])&&(L=(k<3?E(L):k>3?E(S,T,L):E(S,T))||L);return k>3&&L&&Object.defineProperty(S,T,L),L},c=this&&this.__param||function(b,S){return function(T,N){S(T,N,b)}};Object.defineProperty(a,"__esModule",{value:!0}),a.OverviewRulerRenderer=void 0;const d=l(5871),g=l(4725),f=l(844),y=l(2585),_={full:0,left:0,center:0,right:0},v={full:0,left:0,center:0,right:0},m={full:0,left:0,center:0,right:0};let x=a.OverviewRulerRenderer=class extends f.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(b,S,T,N,E,k,L){var I;super(),this._viewportElement=b,this._screenElement=S,this._bufferService=T,this._decorationService=N,this._renderService=E,this._optionsService=k,this._coreBrowserService=L,this._colorZoneStore=new d.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,f.toDisposable)((()=>{var O;(O=this._canvas)==null||O.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);v.full=this._canvas.width,v.left=b,v.center=S,v.right=b,this._refreshDrawHeightConstants(),m.full=0,m.left=0,m.center=v.left,m.right=v.left+v.center}_refreshDrawHeightConstants(){_.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);_.left=S,_.center=S,_.right=S}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*_.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*_.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*_.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*_.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)-_[b.position||"full"]/2),v[b.position||"full"],Math.round((this._canvas.height-1)*((b.endBufferLine-b.startBufferLine)/this._bufferService.buffers.active.lines.length)+_[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=x=u([c(2,y.IBufferService),c(3,y.IDecorationService),c(4,g.IRenderService),c(5,y.IOptionsService),c(6,g.ICoreBrowserService)],x)},2950:function(o,a,l){var u=this&&this.__decorate||function(_,v,m,x){var b,S=arguments.length,T=S<3?v:x===null?x=Object.getOwnPropertyDescriptor(v,m):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(_,v,m,x);else for(var N=_.length-1;N>=0;N--)(b=_[N])&&(T=(S<3?b(T):S>3?b(v,m,T):b(v,m))||T);return S>3&&T&&Object.defineProperty(v,m,T),T},c=this&&this.__param||function(_,v){return function(m,x){v(m,x,_)}};Object.defineProperty(a,"__esModule",{value:!0}),a.CompositionHelper=void 0;const d=l(4725),g=l(2585),f=l(2584);let y=a.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(_,v,m,x,b,S){this._textarea=_,this._compositionView=v,this._bufferService=m,this._optionsService=x,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(_){this._compositionView.textContent=_.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(_){if(this._isComposing||this._isSendingComposition){if(_.keyCode===229||_.keyCode===16||_.keyCode===17||_.keyCode===18)return!1;this._finalizeComposition(!1)}return _.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(_){if(this._compositionView.classList.remove("active"),this._isComposing=!1,_){const v={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let m;this._isSendingComposition=!1,v.start+=this._dataAlreadySent.length,m=this._isComposing?this._textarea.value.substring(v.start,v.end):this._textarea.value.substring(v.start),m.length>0&&this._coreService.triggerDataEvent(m,!0)}}),0)}else{this._isSendingComposition=!1;const v=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(v,!0)}}_handleAnyTextareaChanges(){const _=this._textarea.value;setTimeout((()=>{if(!this._isComposing){const v=this._textarea.value,m=v.replace(_,"");this._dataAlreadySent=m,v.length>_.length?this._coreService.triggerDataEvent(m,!0):v.length<_.length?this._coreService.triggerDataEvent(`${f.C0.DEL}`,!0):v.length===_.length&&v!==_&&this._coreService.triggerDataEvent(v,!0)}}),0)}updateCompositionElements(_){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const v=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),m=this._renderService.dimensions.css.cell.height,x=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,b=v*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=b+"px",this._compositionView.style.top=x+"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=x+"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"}_||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};a.CompositionHelper=y=u([c(2,g.IBufferService),c(3,g.IOptionsService),c(4,g.ICoreService),c(5,d.IRenderService)],y)},9806:(o,a)=>{function l(u,c,d){const g=d.getBoundingClientRect(),f=u.getComputedStyle(d),y=parseInt(f.getPropertyValue("padding-left")),_=parseInt(f.getPropertyValue("padding-top"));return[c.clientX-g.left-y,c.clientY-g.top-_]}Object.defineProperty(a,"__esModule",{value:!0}),a.getCoords=a.getCoordsRelativeToElement=void 0,a.getCoordsRelativeToElement=l,a.getCoords=function(u,c,d,g,f,y,_,v,m){if(!y)return;const x=l(u,c,d);return x?(x[0]=Math.ceil((x[0]+(m?_/2:0))/_),x[1]=Math.ceil(x[1]/v),x[0]=Math.min(Math.max(x[0],1),g+(m?1:0)),x[1]=Math.min(Math.max(x[1],1),f),x):void 0}},9504:(o,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.moveToCellSequence=void 0;const u=l(2584);function c(v,m,x,b){const S=v-d(v,x),T=m-d(m,x),N=Math.abs(S-T)-(function(E,k,L){let A=0;const I=E-d(E,L),O=k-d(k,L);for(let B=0;B<Math.abs(I-O);B++){const D=g(E,k)==="A"?-1:1,M=L.buffer.lines.get(I+D*B);M!=null&&M.isWrapped&&A++}return A})(v,m,x);return _(N,y(g(v,m),b))}function d(v,m){let x=0,b=m.buffer.lines.get(v),S=b==null?void 0:b.isWrapped;for(;S&&v>=0&&v<m.rows;)x++,b=m.buffer.lines.get(--v),S=b==null?void 0:b.isWrapped;return x}function g(v,m){return v>m?"A":"B"}function f(v,m,x,b,S,T){let N=v,E=m,k="";for(;N!==x||E!==b;)N+=S?1:-1,S&&N>T.cols-1?(k+=T.buffer.translateBufferLineToString(E,!1,v,N),N=0,v=0,E++):!S&&N<0&&(k+=T.buffer.translateBufferLineToString(E,!1,0,v+1),N=T.cols-1,v=N,E--);return k+T.buffer.translateBufferLineToString(E,!1,v,N)}function y(v,m){const x=m?"O":"[";return u.C0.ESC+x+v}function _(v,m){v=Math.floor(v);let x="";for(let b=0;b<v;b++)x+=m;return x}a.moveToCellSequence=function(v,m,x,b){const S=x.buffer.x,T=x.buffer.y;if(!x.buffer.hasScrollback)return(function(k,L,A,I,O,B){return c(L,I,O,B).length===0?"":_(f(k,L,k,L-d(L,O),!1,O).length,y("D",B))})(S,T,0,m,x,b)+c(T,m,x,b)+(function(k,L,A,I,O,B){let D;D=c(L,I,O,B).length>0?I-d(I,O):L;const M=I,U=(function(H,$,F,P,z,G){let V;return V=c(F,P,z,G).length>0?P-d(P,z):$,H<F&&V<=P||H>=F&&V<P?"C":"D"})(k,L,A,I,O,B);return _(f(k,D,A,M,U==="C",O).length,y(U,B))})(S,T,v,m,x,b);let N;if(T===m)return N=S>v?"D":"C",_(Math.abs(S-v),y(N,b));N=T>m?"D":"C";const E=Math.abs(T-m);return _((function(k,L){return L.cols-k})(T>m?v:S,x)+(E-1)*x.cols+1+((T>m?S:v)-1),y(N,b))}},1296:function(o,a,l){var u=this&&this.__decorate||function(B,D,M,U){var H,$=arguments.length,F=$<3?D:U===null?U=Object.getOwnPropertyDescriptor(D,M):U;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")F=Reflect.decorate(B,D,M,U);else for(var P=B.length-1;P>=0;P--)(H=B[P])&&(F=($<3?H(F):$>3?H(D,M,F):H(D,M))||F);return $>3&&F&&Object.defineProperty(D,M,F),F},c=this&&this.__param||function(B,D){return function(M,U){D(M,U,B)}};Object.defineProperty(a,"__esModule",{value:!0}),a.DomRenderer=void 0;const d=l(3787),g=l(2550),f=l(2223),y=l(6171),_=l(6052),v=l(4725),m=l(8055),x=l(8460),b=l(844),S=l(2585),T="xterm-dom-renderer-owner-",N="xterm-rows",E="xterm-fg-",k="xterm-bg-",L="xterm-focus",A="xterm-selection";let I=1,O=a.DomRenderer=class extends b.Disposable{constructor(B,D,M,U,H,$,F,P,z,G,V,te,ie){super(),this._terminal=B,this._document=D,this._element=M,this._screenElement=U,this._viewportElement=H,this._helperContainer=$,this._linkifier2=F,this._charSizeService=z,this._optionsService=G,this._bufferService=V,this._coreBrowserService=te,this._themeService=ie,this._terminalClass=I++,this._rowElements=[],this._selectionRenderModel=(0,_.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new x.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(N),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,y.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((ne=>this._injectCss(ne)))),this._injectCss(this._themeService.colors),this._rowFactory=P.createInstance(d.DomRendererRowFactory,document),this._element.classList.add(T+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((ne=>this._handleLinkHover(ne)))),this.register(this._linkifier2.onHideLinkUnderline((ne=>this._handleLinkLeave(ne)))),this.register((0,b.toDisposable)((()=>{this._element.classList.remove(T+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new g.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 M of this._rowElements)M.style.width=`${this.dimensions.css.canvas.width}px`,M.style.height=`${this.dimensions.css.cell.height}px`,M.style.lineHeight=`${this.dimensions.css.cell.height}px`,M.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const D=`${this._terminalSelector} .${N} 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} .${N} { 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} .${N} .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 M=`blink_underline_${this._terminalClass}`,U=`blink_bar_${this._terminalClass}`,H=`blink_block_${this._terminalClass}`;D+=`@keyframes ${M} { 50% { border-bottom-style: hidden; }}`,D+=`@keyframes ${U} { 50% { box-shadow: none; }}`,D+=`@keyframes ${H} { 0% { background-color: ${B.cursor.css}; color: ${B.cursorAccent.css}; } 50% { background-color: inherit; color: ${B.cursor.css}; }}`,D+=`${this._terminalSelector} .${N}.${L} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${M} 1s step-end infinite;}${this._terminalSelector} .${N}.${L} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${U} 1s step-end infinite;}${this._terminalSelector} .${N}.${L} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${H} 1s step-end infinite;}${this._terminalSelector} .${N} .xterm-cursor.xterm-cursor-block { background-color: ${B.cursor.css}; color: ${B.cursorAccent.css};}${this._terminalSelector} .${N} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${B.cursor.css} !important; color: ${B.cursorAccent.css} !important;}${this._terminalSelector} .${N} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${B.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${N} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${B.cursor.css} inset;}${this._terminalSelector} .${N} .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[$,F]of B.ansi.entries())D+=`${this._terminalSelector} .${E}${$} { color: ${F.css}; }${this._terminalSelector} .${E}${$}.xterm-dim { color: ${m.color.multiplyOpacity(F,.5).css}; }${this._terminalSelector} .${k}${$} { background-color: ${F.css}; }`;D+=`${this._terminalSelector} .${E}${f.INVERTED_DEFAULT_COLOR} { color: ${m.color.opaque(B.background).css}; }${this._terminalSelector} .${E}${f.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${m.color.multiplyOpacity(m.color.opaque(B.background),.5).css}; }${this._terminalSelector} .${k}${f.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 M=this._rowElements.length;M<=D;M++){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,M){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(B,D,M),this.renderRows(0,this._bufferService.rows-1),!B||!D)return;this._selectionRenderModel.update(this._terminal,B,D,M);const U=this._selectionRenderModel.viewportStartRow,H=this._selectionRenderModel.viewportEndRow,$=this._selectionRenderModel.viewportCappedStartRow,F=this._selectionRenderModel.viewportCappedEndRow;if($>=this._bufferService.rows||F<0)return;const P=this._document.createDocumentFragment();if(M){const z=B[0]>D[0];P.appendChild(this._createSelectionElement($,z?D[0]:B[0],z?B[0]:D[0],F-$+1))}else{const z=U===$?B[0]:0,G=$===H?D[0]:this._bufferService.cols;P.appendChild(this._createSelectionElement($,z,G));const V=F-$-1;if(P.appendChild(this._createSelectionElement($+1,0,this._bufferService.cols,V)),$!==F){const te=H===F?D[0]:this._bufferService.cols;P.appendChild(this._createSelectionElement(F,0,te))}}this._selectionContainer.appendChild(P)}_createSelectionElement(B,D,M,U=1){const H=this._document.createElement("div"),$=D*this.dimensions.css.cell.width;let F=this.dimensions.css.cell.width*(M-D);return $+F>this.dimensions.css.canvas.width&&(F=this.dimensions.css.canvas.width-$),H.style.height=U*this.dimensions.css.cell.height+"px",H.style.top=B*this.dimensions.css.cell.height+"px",H.style.left=`${$}px`,H.style.width=`${F}px`,H}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 M=this._bufferService.buffer,U=M.ybase+M.y,H=Math.min(M.x,this._bufferService.cols-1),$=this._optionsService.rawOptions.cursorBlink,F=this._optionsService.rawOptions.cursorStyle,P=this._optionsService.rawOptions.cursorInactiveStyle;for(let z=B;z<=D;z++){const G=z+M.ydisp,V=this._rowElements[z],te=M.lines.get(G);if(!V||!te)break;V.replaceChildren(...this._rowFactory.createRow(te,G,G===U,F,P,H,$,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${T}${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,M,U,H,$){M<0&&(B=0),U<0&&(D=0);const F=this._bufferService.rows-1;M=Math.max(Math.min(M,F),0),U=Math.max(Math.min(U,F),0),H=Math.min(H,this._bufferService.cols);const P=this._bufferService.buffer,z=P.ybase+P.y,G=Math.min(P.x,H-1),V=this._optionsService.rawOptions.cursorBlink,te=this._optionsService.rawOptions.cursorStyle,ie=this._optionsService.rawOptions.cursorInactiveStyle;for(let ne=M;ne<=U;++ne){const X=ne+P.ydisp,q=this._rowElements[ne],Y=P.lines.get(X);if(!q||!Y)break;q.replaceChildren(...this._rowFactory.createRow(Y,X,X===z,te,ie,G,V,this.dimensions.css.cell.width,this._widthCache,$?ne===M?B:0:-1,$?(ne===U?D:H)-1:-1))}}};a.DomRenderer=O=u([c(7,S.IInstantiationService),c(8,v.ICharSizeService),c(9,S.IOptionsService),c(10,S.IBufferService),c(11,v.ICoreBrowserService),c(12,v.IThemeService)],O)},3787:function(o,a,l){var u=this&&this.__decorate||function(N,E,k,L){var A,I=arguments.length,O=I<3?E:L===null?L=Object.getOwnPropertyDescriptor(E,k):L;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")O=Reflect.decorate(N,E,k,L);else for(var B=N.length-1;B>=0;B--)(A=N[B])&&(O=(I<3?A(O):I>3?A(E,k,O):A(E,k))||O);return I>3&&O&&Object.defineProperty(E,k,O),O},c=this&&this.__param||function(N,E){return function(k,L){E(k,L,N)}};Object.defineProperty(a,"__esModule",{value:!0}),a.DomRendererRowFactory=void 0;const d=l(2223),g=l(643),f=l(511),y=l(2585),_=l(8055),v=l(4725),m=l(4269),x=l(6171),b=l(3734);let S=a.DomRendererRowFactory=class{constructor(N,E,k,L,A,I,O){this._document=N,this._characterJoinerService=E,this._optionsService=k,this._coreBrowserService=L,this._coreService=A,this._decorationService=I,this._themeService=O,this._workCell=new f.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(N,E,k){this._selectionStart=N,this._selectionEnd=E,this._columnSelectMode=k}createRow(N,E,k,L,A,I,O,B,D,M,U){const H=[],$=this._characterJoinerService.getJoinedCharacters(E),F=this._themeService.colors;let P,z=N.getNoBgTrimmedLength();k&&z<I+1&&(z=I+1);let G=0,V="",te=0,ie=0,ne=0,X=!1,q=0,Y=!1,K=0;const ee=[],re=M!==-1&&U!==-1;for(let ue=0;ue<z;ue++){N.loadCell(ue,this._workCell);let pe=this._workCell.getWidth();if(pe===0)continue;let Re=!1,Be=ue,_e=this._workCell;if($.length>0&&ue===$[0][0]){Re=!0;const ae=$.shift();_e=new m.JoinedCellData(this._workCell,N.translateToString(!0,ae[0],ae[1]),ae[1]-ae[0]),Be=ae[1]-1,pe=_e.getWidth()}const Te=this._isCellInSelection(ue,E),Le=k&&ue===I,Ee=re&&ue>=M&&ue<=U;let Pe=!1;this._decorationService.forEachDecorationAtCell(ue,E,void 0,(ae=>{Pe=!0}));let ze=_e.getChars()||g.WHITESPACE_CELL_CHAR;if(ze===" "&&(_e.isUnderline()||_e.isOverline())&&(ze=" "),K=pe*B-D.get(ze,_e.isBold(),_e.isItalic()),P){if(G&&(Te&&Y||!Te&&!Y&&_e.bg===te)&&(Te&&Y&&F.selectionForeground||_e.fg===ie)&&_e.extended.ext===ne&&Ee===X&&K===q&&!Le&&!Re&&!Pe){_e.isInvisible()?V+=g.WHITESPACE_CELL_CHAR:V+=ze,G++;continue}G&&(P.textContent=V),P=this._document.createElement("span"),G=0,V=""}else P=this._document.createElement("span");if(te=_e.bg,ie=_e.fg,ne=_e.extended.ext,X=Ee,q=K,Y=Te,Re&&I>=ue&&I<=Be&&(I=ue),!this._coreService.isCursorHidden&&Le&&this._coreService.isCursorInitialized){if(ee.push("xterm-cursor"),this._coreBrowserService.isFocused)O&&ee.push("xterm-cursor-blink"),ee.push(L==="bar"?"xterm-cursor-bar":L==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(A)switch(A){case"outline":ee.push("xterm-cursor-outline");break;case"block":ee.push("xterm-cursor-block");break;case"bar":ee.push("xterm-cursor-bar");break;case"underline":ee.push("xterm-cursor-underline")}}if(_e.isBold()&&ee.push("xterm-bold"),_e.isItalic()&&ee.push("xterm-italic"),_e.isDim()&&ee.push("xterm-dim"),V=_e.isInvisible()?g.WHITESPACE_CELL_CHAR:_e.getChars()||g.WHITESPACE_CELL_CHAR,_e.isUnderline()&&(ee.push(`xterm-underline-${_e.extended.underlineStyle}`),V===" "&&(V=" "),!_e.isUnderlineColorDefault()))if(_e.isUnderlineColorRGB())P.style.textDecorationColor=`rgb(${b.AttributeData.toColorRGB(_e.getUnderlineColor()).join(",")})`;else{let ae=_e.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&_e.isBold()&&ae<8&&(ae+=8),P.style.textDecorationColor=F.ansi[ae].css}_e.isOverline()&&(ee.push("xterm-overline"),V===" "&&(V=" ")),_e.isStrikethrough()&&ee.push("xterm-strikethrough"),Ee&&(P.style.textDecoration="underline");let Me=_e.getFgColor(),Ue=_e.getFgColorMode(),Ge=_e.getBgColor(),ve=_e.getBgColorMode();const Ce=!!_e.isInverse();if(Ce){const ae=Me;Me=Ge,Ge=ae;const se=Ue;Ue=ve,ve=se}let Ie,me,Z,he=!1;switch(this._decorationService.forEachDecorationAtCell(ue,E,void 0,(ae=>{ae.options.layer!=="top"&&he||(ae.backgroundColorRGB&&(ve=50331648,Ge=ae.backgroundColorRGB.rgba>>8&16777215,Ie=ae.backgroundColorRGB),ae.foregroundColorRGB&&(Ue=50331648,Me=ae.foregroundColorRGB.rgba>>8&16777215,me=ae.foregroundColorRGB),he=ae.options.layer==="top")})),!he&&Te&&(Ie=this._coreBrowserService.isFocused?F.selectionBackgroundOpaque:F.selectionInactiveBackgroundOpaque,Ge=Ie.rgba>>8&16777215,ve=50331648,he=!0,F.selectionForeground&&(Ue=50331648,Me=F.selectionForeground.rgba>>8&16777215,me=F.selectionForeground)),he&&ee.push("xterm-decoration-top"),ve){case 16777216:case 33554432:Z=F.ansi[Ge],ee.push(`xterm-bg-${Ge}`);break;case 50331648:Z=_.channels.toColor(Ge>>16,Ge>>8&255,255&Ge),this._addStyle(P,`background-color:#${T((Ge>>>0).toString(16),"0",6)}`);break;default:Ce?(Z=F.foreground,ee.push(`xterm-bg-${d.INVERTED_DEFAULT_COLOR}`)):Z=F.background}switch(Ie||_e.isDim()&&(Ie=_.color.multiplyOpacity(Z,.5)),Ue){case 16777216:case 33554432:_e.isBold()&&Me<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(Me+=8),this._applyMinimumContrast(P,Z,F.ansi[Me],_e,Ie,void 0)||ee.push(`xterm-fg-${Me}`);break;case 50331648:const ae=_.channels.toColor(Me>>16&255,Me>>8&255,255&Me);this._applyMinimumContrast(P,Z,ae,_e,Ie,me)||this._addStyle(P,`color:#${T(Me.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(P,Z,F.foreground,_e,Ie,me)||Ce&&ee.push(`xterm-fg-${d.INVERTED_DEFAULT_COLOR}`)}ee.length&&(P.className=ee.join(" "),ee.length=0),Le||Re||Pe?P.textContent=V:G++,K!==this.defaultSpacing&&(P.style.letterSpacing=`${K}px`),H.push(P),ue=Be}return P&&G&&(P.textContent=V),H}_applyMinimumContrast(N,E,k,L,A,I){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,x.treatGlyphAsBackgroundColor)(L.getCode()))return!1;const O=this._getContrastCache(L);let B;if(A||I||(B=O.getColor(E.rgba,k.rgba)),B===void 0){const D=this._optionsService.rawOptions.minimumContrastRatio/(L.isDim()?2:1);B=_.color.ensureContrastRatio(A||E,I||k,D),O.setColor((A||E).rgba,(I||k).rgba,B??null)}return!!B&&(this._addStyle(N,`color:${B.css}`),!0)}_getContrastCache(N){return N.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(N,E){N.setAttribute("style",`${N.getAttribute("style")||""}${E};`)}_isCellInSelection(N,E){const k=this._selectionStart,L=this._selectionEnd;return!(!k||!L)&&(this._columnSelectMode?k[0]<=L[0]?N>=k[0]&&E>=k[1]&&N<L[0]&&E<=L[1]:N<k[0]&&E>=k[1]&&N>=L[0]&&E<=L[1]:E>k[1]&&E<L[1]||k[1]===L[1]&&E===k[1]&&N>=k[0]&&N<L[0]||k[1]<L[1]&&E===L[1]&&N<L[0]||k[1]<L[1]&&E===k[1]&&N>=k[0])}};function T(N,E,k){for(;N.length<k;)N=E+N;return N}a.DomRendererRowFactory=S=u([c(1,v.ICharacterJoinerService),c(2,y.IOptionsService),c(3,v.ICoreBrowserService),c(4,y.ICoreService),c(5,y.IDecorationService),c(6,v.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 d=l.createElement("span");d.classList.add("xterm-char-measure-element"),d.style.fontWeight="bold";const g=l.createElement("span");g.classList.add("xterm-char-measure-element"),g.style.fontStyle="italic";const f=l.createElement("span");f.classList.add("xterm-char-measure-element"),f.style.fontWeight="bold",f.style.fontStyle="italic",this._measureElements=[c,d,g,f],this._container.appendChild(c),this._container.appendChild(d),this._container.appendChild(g),this._container.appendChild(f),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,d){l===this._font&&u===this._fontSize&&c===this._weight&&d===this._weightBold||(this._font=l,this._fontSize=u,this._weight=c,this._weightBold=d,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${c}`,this._measureElements[1].style.fontWeight=`${d}`,this._measureElements[2].style.fontWeight=`${c}`,this._measureElements[3].style.fontWeight=`${d}`,this.clear())}get(l,u,c){let d=0;if(!u&&!c&&l.length===1&&(d=l.charCodeAt(0))<256){if(this._flat[d]!==-9999)return this._flat[d];const y=this._measure(l,0);return y>0&&(this._flat[d]=y),y}let g=l;u&&(g+="B"),c&&(g+="I");let f=this._holey.get(g);if(f===void 0){let y=0;u&&(y|=1),c&&(y|=2),f=this._measure(l,y),f>0&&this._holey.set(g,f)}return f}_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,d,g,f){return d===1&&g>Math.ceil(1.5*f)&&c!==void 0&&c>255&&!u(c)&&!l(c)&&!(function(y){return 57344<=y&&y<=63743})(c)},a.treatGlyphAsBackgroundColor=function(c){return l(c)||(function(d){return 9472<=d&&d<=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,d,g=0){return(c-(2*Math.round(d)-g))%(2*Math.round(d))}},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,d,g,f=!1){if(this.selectionStart=d,this.selectionEnd=g,!d||!g||d[0]===g[0]&&d[1]===g[1])return void this.clear();const y=c.buffers.active.ydisp,_=d[1]-y,v=g[1]-y,m=Math.max(_,0),x=Math.min(v,c.rows-1);m>=c.rows||x<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=f,this.viewportStartRow=_,this.viewportEndRow=v,this.viewportCappedStartRow=m,this.viewportCappedEndRow=x,this.startCol=d[0],this.endCol=g[0])}isCellSelected(c,d,g){return!!this.hasSelection&&(g-=c.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?d>=this.startCol&&g>=this.viewportCappedStartRow&&d<this.endCol&&g<=this.viewportCappedEndRow:d<this.startCol&&g>=this.viewportCappedStartRow&&d>=this.endCol&&g<=this.viewportCappedEndRow:g>this.viewportStartRow&&g<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&g===this.viewportStartRow&&d>=this.startCol&&d<this.endCol||this.viewportStartRow<this.viewportEndRow&&g===this.viewportEndRow&&d<this.endCol||this.viewportStartRow<this.viewportEndRow&&g===this.viewportStartRow&&d>=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(x,b,S,T){var N,E=arguments.length,k=E<3?b:T===null?T=Object.getOwnPropertyDescriptor(b,S):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(x,b,S,T);else for(var L=x.length-1;L>=0;L--)(N=x[L])&&(k=(E<3?N(k):E>3?N(b,S,k):N(b,S))||k);return E>3&&k&&Object.defineProperty(b,S,k),k},c=this&&this.__param||function(x,b){return function(S,T){b(S,T,x)}};Object.defineProperty(a,"__esModule",{value:!0}),a.CharSizeService=void 0;const d=l(2585),g=l(8460),f=l(844);let y=a.CharSizeService=class extends f.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(x,b,S){super(),this._optionsService=S,this.width=0,this.height=0,this._onCharSizeChange=this.register(new g.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new m(this._optionsService))}catch{this._measureStrategy=this.register(new v(x,b,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){const x=this._measureStrategy.measure();x.width===this.width&&x.height===this.height||(this.width=x.width,this.height=x.height,this._onCharSizeChange.fire())}};a.CharSizeService=y=u([c(2,d.IOptionsService)],y);class _ extends f.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 v extends _{constructor(b,S,T){super(),this._document=b,this._parentElement=S,this._optionsService=T,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 _{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,x,b,S){var T,N=arguments.length,E=N<3?x:S===null?S=Object.getOwnPropertyDescriptor(x,b):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(m,x,b,S);else for(var k=m.length-1;k>=0;k--)(T=m[k])&&(E=(N<3?T(E):N>3?T(x,b,E):T(x,b))||E);return N>3&&E&&Object.defineProperty(x,b,E),E},c=this&&this.__param||function(m,x){return function(b,S){x(b,S,m)}};Object.defineProperty(a,"__esModule",{value:!0}),a.CharacterJoinerService=a.JoinedCellData=void 0;const d=l(3734),g=l(643),f=l(511),y=l(2585);class _ extends d.AttributeData{constructor(x,b,S){super(),this.content=0,this.combinedData="",this.fg=x.fg,this.bg=x.bg,this.combinedData=b,this._width=S}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(x){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}a.JoinedCellData=_;let v=a.CharacterJoinerService=class T2{constructor(x){this._bufferService=x,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new f.CellData}register(x){const b={id:this._nextCharacterJoinerId++,handler:x};return this._characterJoiners.push(b),b.id}deregister(x){for(let b=0;b<this._characterJoiners.length;b++)if(this._characterJoiners[b].id===x)return this._characterJoiners.splice(b,1),!0;return!1}getJoinedCharacters(x){if(this._characterJoiners.length===0)return[];const b=this._bufferService.buffer.lines.get(x);if(!b||b.length===0)return[];const S=[],T=b.translateToString(!0);let N=0,E=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-N>1){const O=this._getJoinedRanges(T,k,E,b,N);for(let B=0;B<O.length;B++)S.push(O[B])}N=I,k=E,L=this._workCell.fg,A=this._workCell.bg}E+=this._workCell.getChars().length||g.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-N>1){const I=this._getJoinedRanges(T,k,E,b,N);for(let O=0;O<I.length;O++)S.push(I[O])}return S}_getJoinedRanges(x,b,S,T,N){const E=x.substring(b,S);let k=[];try{k=this._characterJoiners[0].handler(E)}catch(L){console.error(L)}for(let L=1;L<this._characterJoiners.length;L++)try{const A=this._characterJoiners[L].handler(E);for(let I=0;I<A.length;I++)T2._mergeRanges(k,A[I])}catch(A){console.error(A)}return this._stringRangesToCellRanges(k,T,N),k}_stringRangesToCellRanges(x,b,S){let T=0,N=!1,E=0,k=x[T];if(k){for(let L=S;L<this._bufferService.cols;L++){const A=b.getWidth(L),I=b.getString(L).length||g.WHITESPACE_CELL_CHAR.length;if(A!==0){if(!N&&k[0]<=E&&(k[0]=L,N=!0),k[1]<=E){if(k[1]=L,k=x[++T],!k)break;k[0]<=E?(k[0]=L,N=!0):N=!1}E+=I}}k&&(k[1]=this._bufferService.cols)}}static _mergeRanges(x,b){let S=!1;for(let T=0;T<x.length;T++){const N=x[T];if(S){if(b[1]<=N[0])return x[T-1][1]=b[1],x;if(b[1]<=N[1])return x[T-1][1]=Math.max(b[1],N[1]),x.splice(T,1),x;x.splice(T,1),T--}else{if(b[1]<=N[0])return x.splice(T,0,b),x;if(b[1]<=N[1])return N[0]=Math.min(b[0],N[0]),x;b[0]<N[1]&&(N[0]=Math.min(b[0],N[0]),S=!0)}}return S?x[x.length-1][1]=b[1]:x.push(b),x}};a.CharacterJoinerService=v=u([c(0,y.IBufferService)],v)},5114:(o,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.CoreBrowserService=void 0;const u=l(844),c=l(8460),d=l(3656);class g extends u.Disposable{constructor(_,v,m){super(),this._textarea=_,this._window=v,this.mainDocument=m,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new f(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((x=>this._screenDprMonitor.setWindow(x)))),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(_){this._window!==_&&(this._window=_,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=g;class f extends u.Disposable{constructor(_){super(),this._parentWindow=_,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(_){this._parentWindow=_,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,d.addDisposableDomListener)(this._parentWindow,"resize",(()=>this._setDprAndFireIfDiffers()))}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var _;this._outerListener&&((_=this._resolutionMediaMatchList)==null||_.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(g){return this.linkProviders.push(g),{dispose:()=>{const f=this.linkProviders.indexOf(g);f!==-1&&this.linkProviders.splice(f,1)}}}}a.LinkProviderService=c},8934:function(o,a,l){var u=this&&this.__decorate||function(y,_,v,m){var x,b=arguments.length,S=b<3?_:m===null?m=Object.getOwnPropertyDescriptor(_,v):m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(y,_,v,m);else for(var T=y.length-1;T>=0;T--)(x=y[T])&&(S=(b<3?x(S):b>3?x(_,v,S):x(_,v))||S);return b>3&&S&&Object.defineProperty(_,v,S),S},c=this&&this.__param||function(y,_){return function(v,m){_(v,m,y)}};Object.defineProperty(a,"__esModule",{value:!0}),a.MouseService=void 0;const d=l(4725),g=l(9806);let f=a.MouseService=class{constructor(y,_){this._renderService=y,this._charSizeService=_}getCoords(y,_,v,m,x){return(0,g.getCoords)(window,y,_,v,m,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,x)}getMouseReportCoords(y,_){const v=(0,g.getCoordsRelativeToElement)(window,y,_);if(this._charSizeService.hasValidSize)return v[0]=Math.min(Math.max(v[0],0),this._renderService.dimensions.css.canvas.width-1),v[1]=Math.min(Math.max(v[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(v[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(v[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(v[0]),y:Math.floor(v[1])}}};a.MouseService=f=u([c(0,d.IRenderService),c(1,d.ICharSizeService)],f)},3230:function(o,a,l){var u=this&&this.__decorate||function(x,b,S,T){var N,E=arguments.length,k=E<3?b:T===null?T=Object.getOwnPropertyDescriptor(b,S):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(x,b,S,T);else for(var L=x.length-1;L>=0;L--)(N=x[L])&&(k=(E<3?N(k):E>3?N(b,S,k):N(b,S))||k);return E>3&&k&&Object.defineProperty(b,S,k),k},c=this&&this.__param||function(x,b){return function(S,T){b(S,T,x)}};Object.defineProperty(a,"__esModule",{value:!0}),a.RenderService=void 0;const d=l(6193),g=l(4725),f=l(8460),y=l(844),_=l(7226),v=l(2585);let m=a.RenderService=class extends y.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(x,b,S,T,N,E,k,L){super(),this._rowCount=x,this._charSizeService=T,this._renderer=this.register(new y.MutableDisposable),this._pausedResizeTask=new _.DebouncedIdleTask,this._observerDisposable=this.register(new y.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 f.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new f.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new f.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new f.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new d.RenderDebouncer(((A,I)=>this._renderRows(A,I)),k),this.register(this._renderDebouncer),this.register(k.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(E.onResize((()=>this._fullRefresh()))),this.register(E.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(N.onDecorationRegistered((()=>this._fullRefresh()))),this.register(N.onDecorationRemoved((()=>this._fullRefresh()))),this.register(S.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],(()=>{this.clear(),this.handleResize(E.cols,E.rows),this._fullRefresh()}))),this.register(S.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(E.buffer.y,E.buffer.y,!0)))),this.register(L.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(k.window,b),this.register(k.onWindowChange((A=>this._registerIntersectionObserver(A,b))))}_registerIntersectionObserver(x,b){if("IntersectionObserver"in x){const S=new x.IntersectionObserver((T=>this._handleIntersectionChange(T[T.length-1])),{threshold:0});S.observe(b),this._observerDisposable.value=(0,y.toDisposable)((()=>S.disconnect()))}}_handleIntersectionChange(x){this._isPaused=x.isIntersecting===void 0?x.intersectionRatio===0:!x.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(x,b,S=!1){this._isPaused?this._needsFullRefresh=!0:(S||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(x,b,this._rowCount))}_renderRows(x,b){this._renderer.value&&(x=Math.min(x,this._rowCount-1),b=Math.min(b,this._rowCount-1),this._renderer.value.renderRows(x,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:x,end:b}),this._onRender.fire({start:x,end:b}),this._isNextRenderRedrawOnly=!0)}resize(x,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(x){this._renderer.value=x,this._renderer.value&&(this._renderer.value.onRequestRedraw((b=>this.refreshRows(b.start,b.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(x){return this._renderDebouncer.addRefreshCallback(x)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var x,b;this._renderer.value&&((b=(x=this._renderer.value).clearTextureAtlas)==null||b.call(x),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(x,b){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>{var S;return(S=this._renderer.value)==null?void 0:S.handleResize(x,b)})):this._renderer.value.handleResize(x,b),this._fullRefresh())}handleCharSizeChanged(){var x;(x=this._renderer.value)==null||x.handleCharSizeChanged()}handleBlur(){var x;(x=this._renderer.value)==null||x.handleBlur()}handleFocus(){var x;(x=this._renderer.value)==null||x.handleFocus()}handleSelectionChanged(x,b,S){var T;this._selectionState.start=x,this._selectionState.end=b,this._selectionState.columnSelectMode=S,(T=this._renderer.value)==null||T.handleSelectionChanged(x,b,S)}handleCursorMove(){var x;(x=this._renderer.value)==null||x.handleCursorMove()}clear(){var x;(x=this._renderer.value)==null||x.clear()}};a.RenderService=m=u([c(2,v.IOptionsService),c(3,g.ICharSizeService),c(4,v.IDecorationService),c(5,v.IBufferService),c(6,g.ICoreBrowserService),c(7,g.IThemeService)],m)},9312:function(o,a,l){var u=this&&this.__decorate||function(k,L,A,I){var O,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 M=k.length-1;M>=0;M--)(O=k[M])&&(D=(B<3?O(D):B>3?O(L,A,D):O(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 d=l(9806),g=l(9504),f=l(456),y=l(4725),_=l(8460),v=l(844),m=l(6114),x=l(4841),b=l(511),S=l(2585),T=" ",N=new RegExp(T,"g");let E=a.SelectionService=class extends v.Disposable{constructor(k,L,A,I,O,B,D,M,U){super(),this._element=k,this._screenElement=L,this._linkifier=A,this._bufferService=I,this._coreService=O,this._mouseService=B,this._optionsService=D,this._renderService=M,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 _.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new _.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new _.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new _.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=H=>this._handleMouseMove(H),this._mouseUpListener=H=>this._handleMouseUp(H),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((H=>this._handleTrim(H))),this.register(this._bufferService.buffers.onBufferActivate((H=>this._handleBufferActivate(H)))),this.enable(),this._model=new f.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,v.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 O=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 M=A.translateBufferLineToString(D,!0,O,B);I.push(M)}}else{const O=k[1]===L[1]?L[0]:void 0;I.push(A.translateBufferLineToString(k[1],!0,k[0],O));for(let B=k[1]+1;B<=L[1]-1;B++){const D=A.lines.get(B),M=A.translateBufferLineToString(B,!0);D!=null&&D.isWrapped?I[I.length-1]+=M:I.push(M)}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((O=>O.replace(N," "))).join(m.isWindows?`\r
|
|
382
|
-
`:`
|
|
383
|
-
`)}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 O,B;const A=(B=(O=this._linkifier.currentLink)==null?void 0:O.link)==null?void 0:B.range;if(A)return this._model.selectionStart=[A.start.x-1,A.start.y-1],this._model.selectionStartLength=(0,x.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,d.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,g.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 O=k.loadCell(I,this._workCell).getChars().length;this._workCell.getWidth()===0?A--:O>1&&L!==I&&(A+=O-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 O=this._bufferService.buffer,B=O.lines.get(k[1]);if(!B)return;const D=O.translateBufferLineToString(k[1],!1);let M=this._convertViewportColToCharacterIndex(B,k[0]),U=M;const H=k[0]-M;let $=0,F=0,P=0,z=0;if(D.charAt(M)===" "){for(;M>0&&D.charAt(M-1)===" ";)M--;for(;U<D.length&&D.charAt(U+1)===" ";)U++}else{let te=k[0],ie=k[0];B.getWidth(te)===0&&($++,te--),B.getWidth(ie)===2&&(F++,ie++);const ne=B.getString(ie).length;for(ne>1&&(z+=ne-1,U+=ne-1);te>0&&M>0&&!this._isCharWordSeparator(B.loadCell(te-1,this._workCell));){B.loadCell(te-1,this._workCell);const X=this._workCell.getChars().length;this._workCell.getWidth()===0?($++,te--):X>1&&(P+=X-1,M-=X-1),M--,te--}for(;ie<B.length&&U+1<D.length&&!this._isCharWordSeparator(B.loadCell(ie+1,this._workCell));){B.loadCell(ie+1,this._workCell);const X=this._workCell.getChars().length;this._workCell.getWidth()===2?(F++,ie++):X>1&&(z+=X-1,U+=X-1),U++,ie++}}U++;let G=M+H-$+P,V=Math.min(this._bufferService.cols,U-M+$+F-P-z);if(L||D.slice(M,U).trim()!==""){if(A&&G===0&&B.getCodePoint(0)!==32){const te=O.lines.get(k[1]-1);if(te&&B.isWrapped&&te.getCodePoint(this._bufferService.cols-1)!==32){const ie=this._getWordAt([this._bufferService.cols-1,k[1]-1],!1,!0,!1);if(ie){const ne=this._bufferService.cols-ie.start;G-=ne,V+=ne}}}if(I&&G+V===this._bufferService.cols&&B.getCodePoint(this._bufferService.cols-1)!==32){const te=O.lines.get(k[1]+1);if(te!=null&&te.isWrapped&&te.getCodePoint(0)!==32){const ie=this._getWordAt([0,k[1]+1],!1,!1,!0);ie&&(V+=ie.length)}}return{start:G,length:V}}}_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,x.getRangeLength)(A,this._bufferService.cols)}};a.SelectionService=E=u([c(3,S.IBufferService),c(4,S.ICoreService),c(5,y.IMouseService),c(6,S.IOptionsService),c(7,y.IRenderService),c(8,y.ICoreBrowserService)],E)},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(E,k,L,A){var I,O=arguments.length,B=O<3?k:A===null?A=Object.getOwnPropertyDescriptor(k,L):A;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")B=Reflect.decorate(E,k,L,A);else for(var D=E.length-1;D>=0;D--)(I=E[D])&&(B=(O<3?I(B):O>3?I(k,L,B):I(k,L))||B);return O>3&&B&&Object.defineProperty(k,L,B),B},c=this&&this.__param||function(E,k){return function(L,A){k(L,A,E)}};Object.defineProperty(a,"__esModule",{value:!0}),a.ThemeService=a.DEFAULT_ANSI_COLORS=void 0;const d=l(7239),g=l(8055),f=l(8460),y=l(844),_=l(2585),v=g.css.toColor("#ffffff"),m=g.css.toColor("#000000"),x=g.css.toColor("#ffffff"),b=g.css.toColor("#000000"),S={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};a.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const E=[g.css.toColor("#2e3436"),g.css.toColor("#cc0000"),g.css.toColor("#4e9a06"),g.css.toColor("#c4a000"),g.css.toColor("#3465a4"),g.css.toColor("#75507b"),g.css.toColor("#06989a"),g.css.toColor("#d3d7cf"),g.css.toColor("#555753"),g.css.toColor("#ef2929"),g.css.toColor("#8ae234"),g.css.toColor("#fce94f"),g.css.toColor("#729fcf"),g.css.toColor("#ad7fa8"),g.css.toColor("#34e2e2"),g.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],O=k[L%6];E.push({css:g.channels.toCss(A,I,O),rgba:g.channels.toRgba(A,I,O)})}for(let L=0;L<24;L++){const A=8+10*L;E.push({css:g.channels.toCss(A,A,A),rgba:g.channels.toRgba(A,A,A)})}return E})());let T=a.ThemeService=class extends y.Disposable{get colors(){return this._colors}constructor(E){super(),this._optionsService=E,this._contrastCache=new d.ColorContrastCache,this._halfContrastCache=new d.ColorContrastCache,this._onChangeColors=this.register(new f.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:v,background:m,cursor:x,cursorAccent:b,selectionForeground:void 0,selectionBackgroundTransparent:S,selectionBackgroundOpaque:g.color.blend(m,S),selectionInactiveBackgroundTransparent:S,selectionInactiveBackgroundOpaque:g.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(E={}){const k=this._colors;if(k.foreground=N(E.foreground,v),k.background=N(E.background,m),k.cursor=N(E.cursor,x),k.cursorAccent=N(E.cursorAccent,b),k.selectionBackgroundTransparent=N(E.selectionBackground,S),k.selectionBackgroundOpaque=g.color.blend(k.background,k.selectionBackgroundTransparent),k.selectionInactiveBackgroundTransparent=N(E.selectionInactiveBackground,k.selectionBackgroundTransparent),k.selectionInactiveBackgroundOpaque=g.color.blend(k.background,k.selectionInactiveBackgroundTransparent),k.selectionForeground=E.selectionForeground?N(E.selectionForeground,g.NULL_COLOR):void 0,k.selectionForeground===g.NULL_COLOR&&(k.selectionForeground=void 0),g.color.isOpaque(k.selectionBackgroundTransparent)&&(k.selectionBackgroundTransparent=g.color.opacity(k.selectionBackgroundTransparent,.3)),g.color.isOpaque(k.selectionInactiveBackgroundTransparent)&&(k.selectionInactiveBackgroundTransparent=g.color.opacity(k.selectionInactiveBackgroundTransparent,.3)),k.ansi=a.DEFAULT_ANSI_COLORS.slice(),k.ansi[0]=N(E.black,a.DEFAULT_ANSI_COLORS[0]),k.ansi[1]=N(E.red,a.DEFAULT_ANSI_COLORS[1]),k.ansi[2]=N(E.green,a.DEFAULT_ANSI_COLORS[2]),k.ansi[3]=N(E.yellow,a.DEFAULT_ANSI_COLORS[3]),k.ansi[4]=N(E.blue,a.DEFAULT_ANSI_COLORS[4]),k.ansi[5]=N(E.magenta,a.DEFAULT_ANSI_COLORS[5]),k.ansi[6]=N(E.cyan,a.DEFAULT_ANSI_COLORS[6]),k.ansi[7]=N(E.white,a.DEFAULT_ANSI_COLORS[7]),k.ansi[8]=N(E.brightBlack,a.DEFAULT_ANSI_COLORS[8]),k.ansi[9]=N(E.brightRed,a.DEFAULT_ANSI_COLORS[9]),k.ansi[10]=N(E.brightGreen,a.DEFAULT_ANSI_COLORS[10]),k.ansi[11]=N(E.brightYellow,a.DEFAULT_ANSI_COLORS[11]),k.ansi[12]=N(E.brightBlue,a.DEFAULT_ANSI_COLORS[12]),k.ansi[13]=N(E.brightMagenta,a.DEFAULT_ANSI_COLORS[13]),k.ansi[14]=N(E.brightCyan,a.DEFAULT_ANSI_COLORS[14]),k.ansi[15]=N(E.brightWhite,a.DEFAULT_ANSI_COLORS[15]),E.extendedAnsi){const L=Math.min(k.ansi.length-16,E.extendedAnsi.length);for(let A=0;A<L;A++)k.ansi[A+16]=N(E.extendedAnsi[A],a.DEFAULT_ANSI_COLORS[A+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(E){this._restoreColor(E),this._onChangeColors.fire(this.colors)}_restoreColor(E){if(E!==void 0)switch(E){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[E]=this._restoreColors.ansi[E]}else for(let k=0;k<this._restoreColors.ansi.length;++k)this._colors.ansi[k]=this._restoreColors.ansi[k]}modifyColors(E){E(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 N(E,k){if(E!==void 0)try{return g.css.toColor(E)}catch{}return k}a.ThemeService=T=u([c(0,_.IOptionsService)],T)},6349:(o,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.CircularList=void 0;const u=l(8460),c=l(844);class d extends c.Disposable{constructor(f){super(),this._maxLength=f,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(f){if(this._maxLength===f)return;const y=new Array(f);for(let _=0;_<Math.min(f,this.length);_++)y[_]=this._array[this._getCyclicIndex(_)];this._array=y,this._maxLength=f,this._startIndex=0}get length(){return this._length}set length(f){if(f>this._length)for(let y=this._length;y<f;y++)this._array[y]=void 0;this._length=f}get(f){return this._array[this._getCyclicIndex(f)]}set(f,y){this._array[this._getCyclicIndex(f)]=y}push(f){this._array[this._getCyclicIndex(this._length)]=f,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(f,y,..._){if(y){for(let v=f;v<this._length-y;v++)this._array[this._getCyclicIndex(v)]=this._array[this._getCyclicIndex(v+y)];this._length-=y,this.onDeleteEmitter.fire({index:f,amount:y})}for(let v=this._length-1;v>=f;v--)this._array[this._getCyclicIndex(v+_.length)]=this._array[this._getCyclicIndex(v)];for(let v=0;v<_.length;v++)this._array[this._getCyclicIndex(f+v)]=_[v];if(_.length&&this.onInsertEmitter.fire({index:f,amount:_.length}),this._length+_.length>this._maxLength){const v=this._length+_.length-this._maxLength;this._startIndex+=v,this._length=this._maxLength,this.onTrimEmitter.fire(v)}else this._length+=_.length}trimStart(f){f>this._length&&(f=this._length),this._startIndex+=f,this._length-=f,this.onTrimEmitter.fire(f)}shiftElements(f,y,_){if(!(y<=0)){if(f<0||f>=this._length)throw new Error("start argument out of range");if(f+_<0)throw new Error("Cannot shift elements in list beyond index 0");if(_>0){for(let m=y-1;m>=0;m--)this.set(f+m+_,this.get(f+m));const v=f+y+_-this._length;if(v>0)for(this._length+=v;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let v=0;v<y;v++)this.set(f+v+_,this.get(f+v))}}_getCyclicIndex(f){return(this._startIndex+f)%this._maxLength}}a.CircularList=d},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 d=Array.isArray(u)?[]:{};for(const g in u)d[g]=c<=1?u[g]:u[g]&&l(u[g],c-1);return d}},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,d=0;var g,f,y,_,v;function m(b){const S=b.toString(16);return S.length<2?"0"+S:S}function x(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,T,N,E){return E!==void 0?`#${m(S)}${m(T)}${m(N)}${m(E)}`:`#${m(S)}${m(T)}${m(N)}`},b.toRgba=function(S,T,N,E=255){return(S<<24|T<<16|N<<8|E)>>>0},b.toColor=function(S,T,N,E){return{css:b.toCss(S,T,N,E),rgba:b.toRgba(S,T,N,E)}}})(g||(a.channels=g={})),(function(b){function S(T,N){return d=Math.round(255*N),[l,u,c]=v.toChannels(T.rgba),{css:g.toCss(l,u,c,d),rgba:g.toRgba(l,u,c,d)}}b.blend=function(T,N){if(d=(255&N.rgba)/255,d===1)return{css:N.css,rgba:N.rgba};const E=N.rgba>>24&255,k=N.rgba>>16&255,L=N.rgba>>8&255,A=T.rgba>>24&255,I=T.rgba>>16&255,O=T.rgba>>8&255;return l=A+Math.round((E-A)*d),u=I+Math.round((k-I)*d),c=O+Math.round((L-O)*d),{css:g.toCss(l,u,c),rgba:g.toRgba(l,u,c)}},b.isOpaque=function(T){return(255&T.rgba)==255},b.ensureContrastRatio=function(T,N,E){const k=v.ensureContrastRatio(T.rgba,N.rgba,E);if(k)return g.toColor(k>>24&255,k>>16&255,k>>8&255)},b.opaque=function(T){const N=(255|T.rgba)>>>0;return[l,u,c]=v.toChannels(N),{css:g.toCss(l,u,c),rgba:N}},b.opacity=S,b.multiplyOpacity=function(T,N){return d=255&T.rgba,S(T,d*N/255)},b.toColorRGB=function(T){return[T.rgba>>24&255,T.rgba>>16&255,T.rgba>>8&255]}})(f||(a.color=f={})),(function(b){let S,T;try{const N=document.createElement("canvas");N.width=1,N.height=1;const E=N.getContext("2d",{willReadFrequently:!0});E&&(S=E,S.globalCompositeOperation="copy",T=S.createLinearGradient(0,0,1,1))}catch{}b.toColor=function(N){if(N.match(/#[\da-f]{3,8}/i))switch(N.length){case 4:return l=parseInt(N.slice(1,2).repeat(2),16),u=parseInt(N.slice(2,3).repeat(2),16),c=parseInt(N.slice(3,4).repeat(2),16),g.toColor(l,u,c);case 5:return l=parseInt(N.slice(1,2).repeat(2),16),u=parseInt(N.slice(2,3).repeat(2),16),c=parseInt(N.slice(3,4).repeat(2),16),d=parseInt(N.slice(4,5).repeat(2),16),g.toColor(l,u,c,d);case 7:return{css:N,rgba:(parseInt(N.slice(1),16)<<8|255)>>>0};case 9:return{css:N,rgba:parseInt(N.slice(1),16)>>>0}}const E=N.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(E)return l=parseInt(E[1]),u=parseInt(E[2]),c=parseInt(E[3]),d=Math.round(255*(E[5]===void 0?1:parseFloat(E[5]))),g.toColor(l,u,c,d);if(!S||!T)throw new Error("css.toColor: Unsupported css format");if(S.fillStyle=T,S.fillStyle=N,typeof S.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(S.fillRect(0,0,1,1),[l,u,c,d]=S.getImageData(0,0,1,1).data,d!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:g.toRgba(l,u,c,d),css:N}}})(y||(a.css=y={})),(function(b){function S(T,N,E){const k=T/255,L=N/255,A=E/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(T){return S(T>>16&255,T>>8&255,255&T)},b.relativeLuminance2=S})(_||(a.rgb=_={})),(function(b){function S(N,E,k){const L=N>>24&255,A=N>>16&255,I=N>>8&255;let O=E>>24&255,B=E>>16&255,D=E>>8&255,M=x(_.relativeLuminance2(O,B,D),_.relativeLuminance2(L,A,I));for(;M<k&&(O>0||B>0||D>0);)O-=Math.max(0,Math.ceil(.1*O)),B-=Math.max(0,Math.ceil(.1*B)),D-=Math.max(0,Math.ceil(.1*D)),M=x(_.relativeLuminance2(O,B,D),_.relativeLuminance2(L,A,I));return(O<<24|B<<16|D<<8|255)>>>0}function T(N,E,k){const L=N>>24&255,A=N>>16&255,I=N>>8&255;let O=E>>24&255,B=E>>16&255,D=E>>8&255,M=x(_.relativeLuminance2(O,B,D),_.relativeLuminance2(L,A,I));for(;M<k&&(O<255||B<255||D<255);)O=Math.min(255,O+Math.ceil(.1*(255-O))),B=Math.min(255,B+Math.ceil(.1*(255-B))),D=Math.min(255,D+Math.ceil(.1*(255-D))),M=x(_.relativeLuminance2(O,B,D),_.relativeLuminance2(L,A,I));return(O<<24|B<<16|D<<8|255)>>>0}b.blend=function(N,E){if(d=(255&E)/255,d===1)return E;const k=E>>24&255,L=E>>16&255,A=E>>8&255,I=N>>24&255,O=N>>16&255,B=N>>8&255;return l=I+Math.round((k-I)*d),u=O+Math.round((L-O)*d),c=B+Math.round((A-B)*d),g.toRgba(l,u,c)},b.ensureContrastRatio=function(N,E,k){const L=_.relativeLuminance(N>>8),A=_.relativeLuminance(E>>8);if(x(L,A)<k){if(A<L){const B=S(N,E,k),D=x(L,_.relativeLuminance(B>>8));if(D<k){const M=T(N,E,k);return D>x(L,_.relativeLuminance(M>>8))?B:M}return B}const I=T(N,E,k),O=x(L,_.relativeLuminance(I>>8));if(O<k){const B=S(N,E,k);return O>x(L,_.relativeLuminance(B>>8))?I:B}return I}},b.reduceLuminance=S,b.increaseLuminance=T,b.toChannels=function(N){return[N>>24&255,N>>16&255,N>>8&255,255&N]}})(v||(a.rgba=v={})),a.toPaddedHex=m,a.contrastRatio=x},8969:(o,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.CoreTerminal=void 0;const u=l(844),c=l(2585),d=l(4348),g=l(7866),f=l(744),y=l(7302),_=l(6975),v=l(8460),m=l(1753),x=l(1480),b=l(7994),S=l(9282),T=l(5435),N=l(5981),E=l(2660);let k=!1;class L extends u.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new v.EventEmitter),this._onScroll.event((I=>{var O;(O=this._onScrollApi)==null||O.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 O in I)this.optionsService.options[O]=I[O]}constructor(I){super(),this._windowsWrappingHeuristics=this.register(new u.MutableDisposable),this._onBinary=this.register(new v.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new v.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new v.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new v.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new v.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new v.EventEmitter),this._instantiationService=new d.InstantiationService,this.optionsService=this.register(new y.OptionsService(I)),this._instantiationService.setService(c.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(f.BufferService)),this._instantiationService.setService(c.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(g.LogService)),this._instantiationService.setService(c.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(_.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(x.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(E.OscLinkService),this._instantiationService.setService(c.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new T.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,v.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,v.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,v.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,v.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((O=>{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((O=>{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 N.WriteBuffer(((O,B)=>this._inputHandler.parse(O,B)))),this.register((0,v.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(I,O){this._writeBuffer.write(I,O)}writeSync(I,O){this._logService.logLevel<=c.LogLevelEnum.WARN&&!k&&(this._logService.warn("writeSync is unreliable and will be removed soon."),k=!0),this._writeBuffer.writeSync(I,O)}input(I,O=!0){this.coreService.triggerDataEvent(I,O)}resize(I,O){isNaN(I)||isNaN(O)||(I=Math.max(I,f.MINIMUM_COLS),O=Math.max(O,f.MINIMUM_ROWS),this._bufferService.resize(I,O))}scroll(I,O=!1){this._bufferService.scroll(I,O)}scrollLines(I,O,B){this._bufferService.scrollLines(I,O,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 O=I-this._bufferService.buffer.ydisp;O!==0&&this.scrollLines(O)}registerEscHandler(I,O){return this._inputHandler.registerEscHandler(I,O)}registerDcsHandler(I,O){return this._inputHandler.registerDcsHandler(I,O)}registerCsiHandler(I,O){return this._inputHandler.registerCsiHandler(I,O)}registerOscHandler(I,O){return this._inputHandler.registerOscHandler(I,O)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let I=!1;const O=this.optionsService.rawOptions.windowsPty;O&&O.buildNumber!==void 0&&O.buildNumber!==void 0?I=O.backend==="conpty"&&O.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 O of I)O.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 d=0;d<this._listeners.length;d++)c.push(this._listeners[d]);for(let d=0;d<c.length;d++)c[d].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($,F,P,z){var G,V=arguments.length,te=V<3?F:z===null?z=Object.getOwnPropertyDescriptor(F,P):z;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")te=Reflect.decorate($,F,P,z);else for(var ie=$.length-1;ie>=0;ie--)(G=$[ie])&&(te=(V<3?G(te):V>3?G(F,P,te):G(F,P))||te);return V>3&&te&&Object.defineProperty(F,P,te),te},c=this&&this.__param||function($,F){return function(P,z){F(P,z,$)}};Object.defineProperty(a,"__esModule",{value:!0}),a.InputHandler=a.WindowsOptionsReportType=void 0;const d=l(2584),g=l(7116),f=l(2015),y=l(844),_=l(482),v=l(8437),m=l(8460),x=l(643),b=l(511),S=l(3734),T=l(2585),N=l(1480),E=l(6242),k=l(6351),L=l(5941),A={"(":0,")":1,"*":2,"+":3,"-":1,".":2},I=131072;function O($,F){if($>24)return F.setWinLines||!1;switch($){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($){$[$.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",$[$.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(B||(a.WindowsOptionsReportType=B={}));let D=0;class M extends y.Disposable{getAttrData(){return this._curAttrData}constructor(F,P,z,G,V,te,ie,ne,X=new f.EscapeSequenceParser){super(),this._bufferService=F,this._charsetService=P,this._coreService=z,this._logService=G,this._optionsService=V,this._oscLinkService=te,this._coreMouseService=ie,this._unicodeService=ne,this._parser=X,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new _.StringToUtf32,this._utf8Decoder=new _.Utf8ToUtf32,this._workCell=new b.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=v.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=v.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,K)=>{this._logService.debug("Unknown OSC code: ",{identifier:q,action:Y,data:K})})),this._parser.setDcsHandlerFallback(((q,Y,K)=>{Y==="HOOK"&&(K=K.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(q),action:Y,payload:K})})),this._parser.setPrintHandler(((q,Y,K)=>this.print(q,Y,K))),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(d.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(d.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(d.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(d.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(d.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(d.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(d.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(d.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(d.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(d.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(d.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(d.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new E.OscHandler((q=>(this.setTitle(q),this.setIconName(q),!0)))),this._parser.registerOscHandler(1,new E.OscHandler((q=>this.setIconName(q)))),this._parser.registerOscHandler(2,new E.OscHandler((q=>this.setTitle(q)))),this._parser.registerOscHandler(4,new E.OscHandler((q=>this.setOrReportIndexedColor(q)))),this._parser.registerOscHandler(8,new E.OscHandler((q=>this.setHyperlink(q)))),this._parser.registerOscHandler(10,new E.OscHandler((q=>this.setOrReportFgColor(q)))),this._parser.registerOscHandler(11,new E.OscHandler((q=>this.setOrReportBgColor(q)))),this._parser.registerOscHandler(12,new E.OscHandler((q=>this.setOrReportCursorColor(q)))),this._parser.registerOscHandler(104,new E.OscHandler((q=>this.restoreIndexedColor(q)))),this._parser.registerOscHandler(110,new E.OscHandler((q=>this.restoreFgColor(q)))),this._parser.registerOscHandler(111,new E.OscHandler((q=>this.restoreBgColor(q)))),this._parser.registerOscHandler(112,new E.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 g.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,z,G){this._parseStack.paused=!0,this._parseStack.cursorStartX=F,this._parseStack.cursorStartY=P,this._parseStack.decodedLength=z,this._parseStack.position=G}_logSlowResolvingAsync(F){this._logService.logLevel<=T.LogLevelEnum.WARN&&Promise.race([F,new Promise(((P,z)=>setTimeout((()=>z("#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 z,G=this._activeBuffer.x,V=this._activeBuffer.y,te=0;const ie=this._parseStack.paused;if(ie){if(z=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,P))return this._logSlowResolvingAsync(z),z;G=this._parseStack.cursorStartX,V=this._parseStack.cursorStartY,this._parseStack.paused=!1,F.length>I&&(te=this._parseStack.position+I)}if(this._logService.logLevel<=T.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))),ie||this._dirtyRowTracker.clearRange(),F.length>I)for(let q=te;q<F.length;q+=I){const Y=q+I<F.length?q+I:F.length,K=typeof F=="string"?this._stringDecoder.decode(F.substring(q,Y),this._parseBuffer):this._utf8Decoder.decode(F.subarray(q,Y),this._parseBuffer);if(z=this._parser.parse(this._parseBuffer,K))return this._preserveStack(G,V,K,q),this._logSlowResolvingAsync(z),z}else if(!ie){const q=typeof F=="string"?this._stringDecoder.decode(F,this._parseBuffer):this._utf8Decoder.decode(F,this._parseBuffer);if(z=this._parser.parse(this._parseBuffer,q))return this._preserveStack(G,V,q,0),this._logSlowResolvingAsync(z),z}this._activeBuffer.x===G&&this._activeBuffer.y===V||this._onCursorMove.fire();const ne=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),X=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);X<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(X,this._bufferService.rows-1),Math.min(ne,this._bufferService.rows-1))}print(F,P,z){let G,V;const te=this._charsetService.charset,ie=this._optionsService.rawOptions.screenReaderMode,ne=this._bufferService.cols,X=this._coreService.decPrivateModes.wraparound,q=this._coreService.modes.insertMode,Y=this._curAttrData;let K=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&z-P>0&&K.getWidth(this._activeBuffer.x-1)===2&&K.setCellFromCodepoint(this._activeBuffer.x-1,0,1,Y);let ee=this._parser.precedingJoinState;for(let re=P;re<z;++re){if(G=F[re],G<127&&te){const Be=te[String.fromCharCode(G)];Be&&(G=Be.charCodeAt(0))}const ue=this._unicodeService.charProperties(G,ee);V=N.UnicodeService.extractWidth(ue);const pe=N.UnicodeService.extractShouldJoin(ue),Re=pe?N.UnicodeService.extractWidth(ee):0;if(ee=ue,ie&&this._onA11yChar.fire((0,_.stringFromCodePoint)(G)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+V-Re>ne){if(X){const Be=K;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),K=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),Re>0&&K instanceof v.BufferLine&&K.copyCellsFrom(Be,_e,0,Re,!1);_e<ne;)Be.setCellFromCodepoint(_e++,0,1,Y)}else if(this._activeBuffer.x=ne-1,V===2)continue}if(pe&&this._activeBuffer.x){const Be=K.getWidth(this._activeBuffer.x-1)?1:2;K.addCodepointToCell(this._activeBuffer.x-Be,G,V);for(let _e=V-Re;--_e>=0;)K.setCellFromCodepoint(this._activeBuffer.x++,0,0,Y)}else if(q&&(K.insertCells(this._activeBuffer.x,V-Re,this._activeBuffer.getNullCell(Y)),K.getWidth(ne-1)===2&&K.setCellFromCodepoint(ne-1,x.NULL_CELL_CODE,x.NULL_CELL_WIDTH,Y)),K.setCellFromCodepoint(this._activeBuffer.x++,G,V,Y),V>0)for(;--V;)K.setCellFromCodepoint(this._activeBuffer.x++,0,0,Y)}this._parser.precedingJoinState=ee,this._activeBuffer.x<ne&&z-P>0&&K.getWidth(this._activeBuffer.x)===0&&!K.hasContent(this._activeBuffer.x)&&K.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,(z=>!O(z.params[0],this._optionsService.rawOptions.windowOptions)||P(z)))}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 E.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,z,G=!1,V=!1){const te=this._activeBuffer.lines.get(this._activeBuffer.ybase+F);te.replaceCells(P,z,this._activeBuffer.getNullCell(this._eraseAttrData()),V),G&&(te.isWrapped=!1)}_resetBufferLine(F,P=!1){const z=this._activeBuffer.lines.get(this._activeBuffer.ybase+F);z&&(z.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),P),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+F),z.isWrapped=!1)}eraseInDisplay(F,P=!1){let z;switch(this._restrictCursor(this._bufferService.cols),F.params[0]){case 0:for(z=this._activeBuffer.y,this._dirtyRowTracker.markDirty(z),this._eraseInBufferLine(z++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,P);z<this._bufferService.rows;z++)this._resetBufferLine(z,P);this._dirtyRowTracker.markDirty(z);break;case 1:for(z=this._activeBuffer.y,this._dirtyRowTracker.markDirty(z),this._eraseInBufferLine(z,0,this._activeBuffer.x+1,!0,P),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(z+1).isWrapped=!1);z--;)this._resetBufferLine(z,P);this._dirtyRowTracker.markDirty(0);break;case 2:for(z=this._bufferService.rows,this._dirtyRowTracker.markDirty(z-1);z--;)this._resetBufferLine(z,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 z=this._activeBuffer.ybase+this._activeBuffer.y,G=this._bufferService.rows-1-this._activeBuffer.scrollBottom,V=this._bufferService.rows-1+this._activeBuffer.ybase-G+1;for(;P--;)this._activeBuffer.lines.splice(V-1,1),this._activeBuffer.lines.splice(z,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 z=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(z,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(v.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 z=this._activeBuffer.scrollTop;z<=this._activeBuffer.scrollBottom;++z){const G=this._activeBuffer.lines.get(this._activeBuffer.ybase+z);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 z=this._activeBuffer.scrollTop;z<=this._activeBuffer.scrollBottom;++z){const G=this._activeBuffer.lines.get(this._activeBuffer.ybase+z);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 z=this._activeBuffer.scrollTop;z<=this._activeBuffer.scrollBottom;++z){const G=this._activeBuffer.lines.get(this._activeBuffer.ybase+z);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 z=this._activeBuffer.scrollTop;z<=this._activeBuffer.scrollBottom;++z){const G=this._activeBuffer.lines.get(this._activeBuffer.ybase+z);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 z=F.params[0]||1,G=N.UnicodeService.extractWidth(P),V=this._activeBuffer.x-G,te=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(V),ie=new Uint32Array(te.length*z);let ne=0;for(let q=0;q<te.length;){const Y=te.codePointAt(q)||0;ie[ne++]=Y,q+=Y>65535?2:1}let X=ne;for(let q=1;q<z;++q)ie.copyWithin(X,0,ne),X+=ne;return this.print(ie,0,X),!0}sendDeviceAttributesPrimary(F){return F.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(d.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(d.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(F){return F.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(d.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(d.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(F.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(d.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,g.DEFAULT_CHARSET),this._charsetService.setgCharset(1,g.DEFAULT_CHARSET),this._charsetService.setgCharset(2,g.DEFAULT_CHARSET),this._charsetService.setgCharset(3,g.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 z=this._coreService.decPrivateModes,{activeProtocol:G,activeEncoding:V}=this._coreMouseService,te=this._coreService,{buffers:ie,cols:ne}=this._bufferService,{active:X,alt:q}=ie,Y=this._optionsService.rawOptions,K=pe=>pe?1:2,ee=F.params[0];return re=ee,ue=P?ee===2?4:ee===4?K(te.modes.insertMode):ee===12?3:ee===20?K(Y.convertEol):0:ee===1?K(z.applicationCursorKeys):ee===3?Y.windowOptions.setWinLines?ne===80?2:ne===132?1:0:0:ee===6?K(z.origin):ee===7?K(z.wraparound):ee===8?3:ee===9?K(G==="X10"):ee===12?K(Y.cursorBlink):ee===25?K(!te.isCursorHidden):ee===45?K(z.reverseWraparound):ee===66?K(z.applicationKeypad):ee===67?4:ee===1e3?K(G==="VT200"):ee===1002?K(G==="DRAG"):ee===1003?K(G==="ANY"):ee===1004?K(z.sendFocus):ee===1005?4:ee===1006?K(V==="SGR"):ee===1015?4:ee===1016?K(V==="SGR_PIXELS"):ee===1048?1:ee===47||ee===1047||ee===1049?K(X===q):ee===2004?K(z.bracketedPasteMode):0,te.triggerDataEvent(`${d.C0.ESC}[${P?"":"?"}${re};${ue}$y`),!0;var re,ue}_updateAttrColor(F,P,z,G,V){return P===2?(F|=50331648,F&=-16777216,F|=S.AttributeData.fromColorRGB([z,G,V])):P===5&&(F&=-50331904,F|=33554432|255&z),F}_extractColor(F,P,z){const G=[0,0,-1,0,0,0];let V=0,te=0;do{if(G[te+V]=F.params[P+te],F.hasSubParams(P+te)){const ie=F.getSubParams(P+te);let ne=0;do G[1]===5&&(V=1),G[te+ne+1+V]=ie[ne];while(++ne<ie.length&&ne+te+1+V<G.length);break}if(G[1]===5&&te+V>=2||G[1]===2&&te+V>=5)break;G[1]&&(V=1)}while(++te+P<F.length&&te+V<G.length);for(let ie=2;ie<G.length;++ie)G[ie]===-1&&(G[ie]=0);switch(G[0]){case 38:z.fg=this._updateAttrColor(z.fg,G[1],G[3],G[4],G[5]);break;case 48:z.bg=this._updateAttrColor(z.bg,G[1],G[3],G[4],G[5]);break;case 58:z.extended=z.extended.clone(),z.extended.underlineColor=this._updateAttrColor(z.extended.underlineColor,G[1],G[3],G[4],G[5])}return te}_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=v.DEFAULT_ATTR_DATA.fg,F.bg=v.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 z;const G=this._curAttrData;for(let V=0;V<P;V++)z=F.params[V],z>=30&&z<=37?(G.fg&=-50331904,G.fg|=16777216|z-30):z>=40&&z<=47?(G.bg&=-50331904,G.bg|=16777216|z-40):z>=90&&z<=97?(G.fg&=-50331904,G.fg|=16777224|z-90):z>=100&&z<=107?(G.bg&=-50331904,G.bg|=16777224|z-100):z===0?this._processSGR0(G):z===1?G.fg|=134217728:z===3?G.bg|=67108864:z===4?(G.fg|=268435456,this._processUnderline(F.hasSubParams(V)?F.getSubParams(V)[0]:1,G)):z===5?G.fg|=536870912:z===7?G.fg|=67108864:z===8?G.fg|=1073741824:z===9?G.fg|=2147483648:z===2?G.bg|=134217728:z===21?this._processUnderline(2,G):z===22?(G.fg&=-134217729,G.bg&=-134217729):z===23?G.bg&=-67108865:z===24?(G.fg&=-268435457,this._processUnderline(0,G)):z===25?G.fg&=-536870913:z===27?G.fg&=-67108865:z===28?G.fg&=-1073741825:z===29?G.fg&=2147483647:z===39?(G.fg&=-67108864,G.fg|=16777215&v.DEFAULT_ATTR_DATA.fg):z===49?(G.bg&=-67108864,G.bg|=16777215&v.DEFAULT_ATTR_DATA.bg):z===38||z===48||z===58?V+=this._extractColor(F,V,G):z===53?G.bg|=1073741824:z===55?G.bg&=-1073741825:z===59?(G.extended=G.extended.clone(),G.extended.underlineColor=-1,G.updateExtended()):z===100?(G.fg&=-67108864,G.fg|=16777215&v.DEFAULT_ATTR_DATA.fg,G.bg&=-67108864,G.bg|=16777215&v.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",z);return!0}deviceStatus(F){switch(F.params[0]){case 5:this._coreService.triggerDataEvent(`${d.C0.ESC}[0n`);break;case 6:const P=this._activeBuffer.y+1,z=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${d.C0.ESC}[${P};${z}R`)}return!0}deviceStatusPrivate(F){if(F.params[0]===6){const P=this._activeBuffer.y+1,z=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${d.C0.ESC}[?${P};${z}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=v.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 z=P%2==1;return this._optionsService.options.cursorBlink=z,!0}setScrollRegion(F){const P=F.params[0]||1;let z;return(F.length<2||(z=F.params[1])>this._bufferService.rows||z===0)&&(z=this._bufferService.rows),z>P&&(this._activeBuffer.scrollTop=P-1,this._activeBuffer.scrollBottom=z-1,this._setCursor(0,0)),!0}windowOptions(F){if(!O(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(`${d.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=[],z=F.split(";");for(;z.length>1;){const G=z.shift(),V=z.shift();if(/^\d+$/.exec(G)){const te=parseInt(G);if(H(te))if(V==="?")P.push({type:0,index:te});else{const ie=(0,L.parseColor)(V);ie&&P.push({type:1,index:te,color:ie})}}}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 z=F.split(":");let G;const V=z.findIndex((te=>te.startsWith("id=")));return V!==-1&&(G=z[V].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 z=F.split(";");for(let G=0;G<z.length&&!(P>=this._specialColors.length);++G,++P)if(z[G]==="?")this._onColor.fire([{type:0,index:this._specialColors[P]}]);else{const V=(0,L.parseColor)(z[G]);V&&this._onColor.fire([{type:1,index:this._specialColors[P],color:V}])}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=[],z=F.split(";");for(let G=0;G<z.length;++G)if(/^\d+$/.exec(z[G])){const V=parseInt(z[G]);H(V)&&P.push({type:2,index:V})}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,g.DEFAULT_CHARSET),!0}selectCharset(F){return F.length!==2?(this.selectDefaultCharset(),!0):(F[0]==="/"||this._charsetService.setgCharset(A[F[0]],g.CHARSETS[F[1]]||g.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=v.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=v.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 z=this._activeBuffer.ybase+this._activeBuffer.y+P,G=this._activeBuffer.lines.get(z);G&&(G.fill(F),G.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(F,P){const z=this._bufferService.buffer,G=this._optionsService.rawOptions;return(V=>(this._coreService.triggerDataEvent(`${d.C0.ESC}${V}${d.C0.ESC}\\`),!0))(F==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:F==='"p'?'P1$r61;1"p':F==="r"?`P1$r${z.scrollTop+1};${z.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=M;let U=class{constructor($){this._bufferService=$,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty($){$<this.start?this.start=$:$>this.end&&(this.end=$)}markRangeDirty($,F){$>F&&(D=$,$=F,F=D),$<this.start&&(this.start=$),F>this.end&&(this.end=F)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function H($){return 0<=$&&$<256}U=u([c(0,T.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,d,g){this._data[c]||(this._data[c]={}),this._data[c][d]=g}get(c,d){return this._data[c]?this._data[c][d]:void 0}clear(){this._data={}}}a.TwoKeyMap=l,a.FourKeyMap=class{constructor(){this._data=new l}set(u,c,d,g,f){this._data.get(u,c)||this._data.set(u,c,new l),this._data.get(u,c).set(d,g,f)}get(u,c,d,g){var f;return(f=this._data.get(u,c))==null?void 0:f.get(d,g)}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,d=this._array.length-1;for(;d>=c;){let g=c+d>>1;const f=this._getKey(this._array[g]);if(f>u)d=g-1;else{if(!(f<u)){for(;g>0&&this._getKey(this._array[g-1])===u;)g--;return g}c=g+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(f){this._tasks.push(f),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(f){this._idleCallback=void 0;let y=0,_=0,v=f.timeRemaining(),m=0;for(;this._i<this._tasks.length;){if(y=Date.now(),this._tasks[this._i]()||this._i++,y=Math.max(1,Date.now()-y),_=Math.max(y,_),m=f.timeRemaining(),1.5*_>m)return v-y<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(v-y))}ms`),void this._start();v=m}this.clear()}}class d extends c{_requestCallback(f){return setTimeout((()=>f(this._createDeadline(16))))}_cancelCallback(f){clearTimeout(f)}_createDeadline(f){const y=Date.now()+f;return{timeRemaining:()=>Math.max(0,y-Date.now())}}}a.PriorityTaskQueue=d,a.IdleTaskQueue=!u.isNode&&"requestIdleCallback"in window?class extends c{_requestCallback(g){return requestIdleCallback(g)}_cancelCallback(g){cancelIdleCallback(g)}}:d,a.DebouncedIdleTask=class{constructor(){this._queue=new a.IdleTaskQueue}set(g){this._queue.clear(),this._queue.enqueue(g)}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 d=c.buffer.lines.get(c.buffer.ybase+c.buffer.y-1),g=d==null?void 0:d.get(c.cols-1),f=c.buffer.lines.get(c.buffer.ybase+c.buffer.y);f&&g&&(f.isWrapped=g[u.CHAR_DATA_CODE_INDEX]!==u.NULL_CELL_CODE&&g[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(d){return[d>>>16&255,d>>>8&255,255&d]}static fromColorRGB(d){return(255&d[0])<<16|(255&d[1])<<8|255&d[2]}clone(){const d=new l;return d.fg=this.fg,d.bg=this.bg,d.extended=this.extended.clone(),d}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(d){this._ext=d}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(d){this._ext&=-469762049,this._ext|=d<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(d){this._ext&=-67108864,this._ext|=67108863&d}get urlId(){return this._urlId}set urlId(d){this._urlId=d}get underlineVariantOffset(){const d=(3758096384&this._ext)>>29;return d<0?4294967288^d:d}set underlineVariantOffset(d){this._ext&=536870911,this._ext|=d<<29&3758096384}constructor(d=0,g=0){this._ext=0,this._urlId=0,this._ext=d,this._urlId=g}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),d=l(3734),g=l(8437),f=l(4634),y=l(511),_=l(643),v=l(4863),m=l(7116);a.MAX_BUFFER_SIZE=4294967295,a.Buffer=class{constructor(x,b,S){this._hasScrollback=x,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=g.DEFAULT_ATTR_DATA.clone(),this.savedCharset=m.DEFAULT_CHARSET,this.markers=[],this._nullCell=y.CellData.fromCharData([0,_.NULL_CELL_CHAR,_.NULL_CELL_WIDTH,_.NULL_CELL_CODE]),this._whitespaceCell=y.CellData.fromCharData([0,_.WHITESPACE_CELL_CHAR,_.WHITESPACE_CELL_WIDTH,_.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(x){return x?(this._nullCell.fg=x.fg,this._nullCell.bg=x.bg,this._nullCell.extended=x.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new d.ExtendedAttrs),this._nullCell}getWhitespaceCell(x){return x?(this._whitespaceCell.fg=x.fg,this._whitespaceCell.bg=x.bg,this._whitespaceCell.extended=x.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new d.ExtendedAttrs),this._whitespaceCell}getBlankLine(x,b){return new g.BufferLine(this._bufferService.cols,this.getNullCell(x),b)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const x=this.ybase+this.y-this.ydisp;return x>=0&&x<this._rows}_getCorrectBufferLength(x){if(!this._hasScrollback)return x;const b=x+this._optionsService.rawOptions.scrollback;return b>a.MAX_BUFFER_SIZE?a.MAX_BUFFER_SIZE:b}fillViewportRows(x){if(this.lines.length===0){x===void 0&&(x=g.DEFAULT_ATTR_DATA);let b=this._rows;for(;b--;)this.lines.push(this.getBlankLine(x))}}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(x,b){const S=this.getNullCell(g.DEFAULT_ATTR_DATA);let T=0;const N=this._getCorrectBufferLength(b);if(N>this.lines.maxLength&&(this.lines.maxLength=N),this.lines.length>0){if(this._cols<x)for(let k=0;k<this.lines.length;k++)T+=+this.lines.get(k).resize(x,S);let E=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 g.BufferLine(x,S)):this.ybase>0&&this.lines.length<=this.ybase+this.y+E+1?(this.ybase--,E++,this.ydisp>0&&this.ydisp--):this.lines.push(new g.BufferLine(x,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(N<this.lines.maxLength){const k=this.lines.length-N;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=N}this.x=Math.min(this.x,x-1),this.y=Math.min(this.y,b-1),E&&(this.y+=E),this.savedX=Math.min(this.savedX,x-1),this.scrollTop=0}if(this.scrollBottom=b-1,this._isReflowEnabled&&(this._reflow(x,b),this._cols>x))for(let E=0;E<this.lines.length;E++)T+=+this.lines.get(E).resize(x,S);this._cols=x,this._rows=b,this._memoryCleanupQueue.clear(),T>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let x=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,x=!1);let b=0;for(;this._memoryCleanupPosition<this.lines.length;)if(b+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),b>100)return!0;return x}get _isReflowEnabled(){const x=this._optionsService.rawOptions.windowsPty;return x&&x.buildNumber?this._hasScrollback&&x.backend==="conpty"&&x.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(x,b){this._cols!==x&&(x>this._cols?this._reflowLarger(x,b):this._reflowSmaller(x,b))}_reflowLarger(x,b){const S=(0,f.reflowLargerGetLinesToRemove)(this.lines,this._cols,x,this.ybase+this.y,this.getNullCell(g.DEFAULT_ATTR_DATA));if(S.length>0){const T=(0,f.reflowLargerCreateNewLayout)(this.lines,S);(0,f.reflowLargerApplyNewLayout)(this.lines,T.layout),this._reflowLargerAdjustViewport(x,b,T.countRemoved)}}_reflowLargerAdjustViewport(x,b,S){const T=this.getNullCell(g.DEFAULT_ATTR_DATA);let N=S;for(;N-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<b&&this.lines.push(new g.BufferLine(x,T))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-S,0)}_reflowSmaller(x,b){const S=this.getNullCell(g.DEFAULT_ATTR_DATA),T=[];let N=0;for(let E=this.lines.length-1;E>=0;E--){let k=this.lines.get(E);if(!k||!k.isWrapped&&k.getTrimmedLength()<=x)continue;const L=[k];for(;k.isWrapped&&E>0;)k=this.lines.get(--E),L.unshift(k);const A=this.ybase+this.y;if(A>=E&&A<E+L.length)continue;const I=L[L.length-1].getTrimmedLength(),O=(0,f.reflowSmallerGetNewLineLengths)(L,this._cols,x),B=O.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 M=[];for(let z=0;z<B;z++){const G=this.getBlankLine(g.DEFAULT_ATTR_DATA,!0);M.push(G)}M.length>0&&(T.push({start:E+L.length+N,newLines:M}),N+=M.length),L.push(...M);let U=O.length-1,H=O[U];H===0&&(U--,H=O[U]);let $=L.length-B-1,F=I;for(;$>=0;){const z=Math.min(F,H);if(L[U]===void 0)break;if(L[U].copyCellsFrom(L[$],F-z,H-z,z,!0),H-=z,H===0&&(U--,H=O[U]),F-=z,F===0){$--;const G=Math.max($,0);F=(0,f.getWrappedLineTrimmedLength)(L,G,this._cols)}}for(let z=0;z<L.length;z++)O[z]<x&&L[z].setCell(O[z],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+N)-b&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+B,this.ybase+b-1)}if(T.length>0){const E=[],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,O=T[I];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+N);let B=0;for(let U=Math.min(this.lines.maxLength-1,L+N-1);U>=0;U--)if(O&&O.start>A+B){for(let H=O.newLines.length-1;H>=0;H--)this.lines.set(U--,O.newLines[H]);U++,E.push({index:A+1,amount:O.newLines.length}),B+=O.newLines.length,O=T[++I]}else this.lines.set(U,k[A--]);let D=0;for(let U=E.length-1;U>=0;U--)E[U].index+=D,this.lines.onInsertEmitter.fire(E[U]),D+=E[U].amount;const M=Math.max(0,L+N-this.lines.maxLength);M>0&&this.lines.onTrimEmitter.fire(M)}}translateBufferLineToString(x,b,S=0,T){const N=this.lines.get(x);return N?N.translateToString(b,S,T):""}getWrappedRangeForLine(x){let b=x,S=x;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(x){for(x!=null?this.tabs[x]||(x=this.prevStop(x)):(this.tabs={},x=0);x<this._cols;x+=this._optionsService.rawOptions.tabStopWidth)this.tabs[x]=!0}prevStop(x){for(x==null&&(x=this.x);!this.tabs[--x]&&x>0;);return x>=this._cols?this._cols-1:x<0?0:x}nextStop(x){for(x==null&&(x=this.x);!this.tabs[++x]&&x<this._cols;);return x>=this._cols?this._cols-1:x<0?0:x}clearMarkers(x){this._isClearing=!0;for(let b=0;b<this.markers.length;b++)this.markers[b].line===x&&(this.markers[b].dispose(),this.markers.splice(b--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let x=0;x<this.markers.length;x++)this.markers[x].dispose(),this.markers.splice(x--,1);this._isClearing=!1}addMarker(x){const b=new v.Marker(x);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(x){this._isClearing||this.markers.splice(this.markers.indexOf(x),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),d=l(643),g=l(482);a.DEFAULT_ATTR_DATA=Object.freeze(new u.AttributeData);let f=0;class y{constructor(v,m,x=!1){this.isWrapped=x,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*v);const b=m||c.CellData.fromCharData([0,d.NULL_CELL_CHAR,d.NULL_CELL_WIDTH,d.NULL_CELL_CODE]);for(let S=0;S<v;++S)this.setCell(S,b);this.length=v}get(v){const m=this._data[3*v+0],x=2097151&m;return[this._data[3*v+1],2097152&m?this._combined[v]:x?(0,g.stringFromCodePoint)(x):"",m>>22,2097152&m?this._combined[v].charCodeAt(this._combined[v].length-1):x]}set(v,m){this._data[3*v+1]=m[d.CHAR_DATA_ATTR_INDEX],m[d.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[v]=m[1],this._data[3*v+0]=2097152|v|m[d.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*v+0]=m[d.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|m[d.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(v){return this._data[3*v+0]>>22}hasWidth(v){return 12582912&this._data[3*v+0]}getFg(v){return this._data[3*v+1]}getBg(v){return this._data[3*v+2]}hasContent(v){return 4194303&this._data[3*v+0]}getCodePoint(v){const m=this._data[3*v+0];return 2097152&m?this._combined[v].charCodeAt(this._combined[v].length-1):2097151&m}isCombined(v){return 2097152&this._data[3*v+0]}getString(v){const m=this._data[3*v+0];return 2097152&m?this._combined[v]:2097151&m?(0,g.stringFromCodePoint)(2097151&m):""}isProtected(v){return 536870912&this._data[3*v+2]}loadCell(v,m){return f=3*v,m.content=this._data[f+0],m.fg=this._data[f+1],m.bg=this._data[f+2],2097152&m.content&&(m.combinedData=this._combined[v]),268435456&m.bg&&(m.extended=this._extendedAttrs[v]),m}setCell(v,m){2097152&m.content&&(this._combined[v]=m.combinedData),268435456&m.bg&&(this._extendedAttrs[v]=m.extended),this._data[3*v+0]=m.content,this._data[3*v+1]=m.fg,this._data[3*v+2]=m.bg}setCellFromCodepoint(v,m,x,b){268435456&b.bg&&(this._extendedAttrs[v]=b.extended),this._data[3*v+0]=m|x<<22,this._data[3*v+1]=b.fg,this._data[3*v+2]=b.bg}addCodepointToCell(v,m,x){let b=this._data[3*v+0];2097152&b?this._combined[v]+=(0,g.stringFromCodePoint)(m):2097151&b?(this._combined[v]=(0,g.stringFromCodePoint)(2097151&b)+(0,g.stringFromCodePoint)(m),b&=-2097152,b|=2097152):b=m|4194304,x&&(b&=-12582913,b|=x<<22),this._data[3*v+0]=b}insertCells(v,m,x){if((v%=this.length)&&this.getWidth(v-1)===2&&this.setCellFromCodepoint(v-1,0,1,x),m<this.length-v){const b=new c.CellData;for(let S=this.length-v-m-1;S>=0;--S)this.setCell(v+m+S,this.loadCell(v+S,b));for(let S=0;S<m;++S)this.setCell(v+S,x)}else for(let b=v;b<this.length;++b)this.setCell(b,x);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,x)}deleteCells(v,m,x){if(v%=this.length,m<this.length-v){const b=new c.CellData;for(let S=0;S<this.length-v-m;++S)this.setCell(v+S,this.loadCell(v+m+S,b));for(let S=this.length-m;S<this.length;++S)this.setCell(S,x)}else for(let b=v;b<this.length;++b)this.setCell(b,x);v&&this.getWidth(v-1)===2&&this.setCellFromCodepoint(v-1,0,1,x),this.getWidth(v)!==0||this.hasContent(v)||this.setCellFromCodepoint(v,0,1,x)}replaceCells(v,m,x,b=!1){if(b)for(v&&this.getWidth(v-1)===2&&!this.isProtected(v-1)&&this.setCellFromCodepoint(v-1,0,1,x),m<this.length&&this.getWidth(m-1)===2&&!this.isProtected(m)&&this.setCellFromCodepoint(m,0,1,x);v<m&&v<this.length;)this.isProtected(v)||this.setCell(v,x),v++;else for(v&&this.getWidth(v-1)===2&&this.setCellFromCodepoint(v-1,0,1,x),m<this.length&&this.getWidth(m-1)===2&&this.setCellFromCodepoint(m,0,1,x);v<m&&v<this.length;)this.setCell(v++,x)}resize(v,m){if(v===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const x=3*v;if(v>this.length){if(this._data.buffer.byteLength>=4*x)this._data=new Uint32Array(this._data.buffer,0,x);else{const b=new Uint32Array(x);b.set(this._data),this._data=b}for(let b=this.length;b<v;++b)this.setCell(b,m)}else{this._data=this._data.subarray(0,x);const b=Object.keys(this._combined);for(let T=0;T<b.length;T++){const N=parseInt(b[T],10);N>=v&&delete this._combined[N]}const S=Object.keys(this._extendedAttrs);for(let T=0;T<S.length;T++){const N=parseInt(S[T],10);N>=v&&delete this._extendedAttrs[N]}}return this.length=v,4*x*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const v=new Uint32Array(this._data.length);return v.set(this._data),this._data=v,1}return 0}fill(v,m=!1){if(m)for(let x=0;x<this.length;++x)this.isProtected(x)||this.setCell(x,v);else{this._combined={},this._extendedAttrs={};for(let x=0;x<this.length;++x)this.setCell(x,v)}}copyFrom(v){this.length!==v.length?this._data=new Uint32Array(v._data):this._data.set(v._data),this.length=v.length,this._combined={};for(const m in v._combined)this._combined[m]=v._combined[m];this._extendedAttrs={};for(const m in v._extendedAttrs)this._extendedAttrs[m]=v._extendedAttrs[m];this.isWrapped=v.isWrapped}clone(){const v=new y(0);v._data=new Uint32Array(this._data),v.length=this.length;for(const m in this._combined)v._combined[m]=this._combined[m];for(const m in this._extendedAttrs)v._extendedAttrs[m]=this._extendedAttrs[m];return v.isWrapped=this.isWrapped,v}getTrimmedLength(){for(let v=this.length-1;v>=0;--v)if(4194303&this._data[3*v+0])return v+(this._data[3*v+0]>>22);return 0}getNoBgTrimmedLength(){for(let v=this.length-1;v>=0;--v)if(4194303&this._data[3*v+0]||50331648&this._data[3*v+2])return v+(this._data[3*v+0]>>22);return 0}copyCellsFrom(v,m,x,b,S){const T=v._data;if(S)for(let E=b-1;E>=0;E--){for(let k=0;k<3;k++)this._data[3*(x+E)+k]=T[3*(m+E)+k];268435456&T[3*(m+E)+2]&&(this._extendedAttrs[x+E]=v._extendedAttrs[m+E])}else for(let E=0;E<b;E++){for(let k=0;k<3;k++)this._data[3*(x+E)+k]=T[3*(m+E)+k];268435456&T[3*(m+E)+2]&&(this._extendedAttrs[x+E]=v._extendedAttrs[m+E])}const N=Object.keys(v._combined);for(let E=0;E<N.length;E++){const k=parseInt(N[E],10);k>=m&&(this._combined[k-m+x]=v._combined[k])}}translateToString(v,m,x,b){m=m??0,x=x??this.length,v&&(x=Math.min(x,this.getTrimmedLength())),b&&(b.length=0);let S="";for(;m<x;){const T=this._data[3*m+0],N=2097151&T,E=2097152&T?this._combined[m]:N?(0,g.stringFromCodePoint)(N):d.WHITESPACE_CELL_CHAR;if(S+=E,b)for(let k=0;k<E.length;++k)b.push(m);m+=T>>22||1}return b&&b.push(m),S}}a.BufferLine=y},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,d){if(c===u.length-1)return u[c].getTrimmedLength();const g=!u[c].hasContent(d-1)&&u[c].getWidth(d-1)===1,f=u[c+1].getWidth(0)===2;return g&&f?d-1:d}Object.defineProperty(a,"__esModule",{value:!0}),a.getWrappedLineTrimmedLength=a.reflowSmallerGetNewLineLengths=a.reflowLargerApplyNewLayout=a.reflowLargerCreateNewLayout=a.reflowLargerGetLinesToRemove=void 0,a.reflowLargerGetLinesToRemove=function(u,c,d,g,f){const y=[];for(let _=0;_<u.length-1;_++){let v=_,m=u.get(++v);if(!m.isWrapped)continue;const x=[u.get(_)];for(;v<u.length&&m.isWrapped;)x.push(m),m=u.get(++v);if(g>=_&&g<v){_+=x.length-1;continue}let b=0,S=l(x,b,c),T=1,N=0;for(;T<x.length;){const k=l(x,T,c),L=k-N,A=d-S,I=Math.min(L,A);x[b].copyCellsFrom(x[T],N,S,I,!1),S+=I,S===d&&(b++,S=0),N+=I,N===k&&(T++,N=0),S===0&&b!==0&&x[b-1].getWidth(d-1)===2&&(x[b].copyCellsFrom(x[b-1],d-1,S++,1,!1),x[b-1].setCell(d-1,f))}x[b].replaceCells(S,d,f);let E=0;for(let k=x.length-1;k>0&&(k>b||x[k].getTrimmedLength()===0);k--)E++;E>0&&(y.push(_+x.length-E),y.push(E)),_+=x.length-1}return y},a.reflowLargerCreateNewLayout=function(u,c){const d=[];let g=0,f=c[g],y=0;for(let _=0;_<u.length;_++)if(f===_){const v=c[++g];u.onDeleteEmitter.fire({index:_-y,amount:v}),_+=v-1,y+=v,f=c[++g]}else d.push(_);return{layout:d,countRemoved:y}},a.reflowLargerApplyNewLayout=function(u,c){const d=[];for(let g=0;g<c.length;g++)d.push(u.get(c[g]));for(let g=0;g<d.length;g++)u.set(g,d[g]);u.length=c.length},a.reflowSmallerGetNewLineLengths=function(u,c,d){const g=[],f=u.map(((m,x)=>l(u,x,c))).reduce(((m,x)=>m+x));let y=0,_=0,v=0;for(;v<f;){if(f-v<d){g.push(f-v);break}y+=d;const m=l(u,_,c);y>m&&(y-=m,_++);const x=u[_].getWidth(y-1)===2;x&&y--;const b=x?d-1:d;g.push(b),v+=b}return g},a.getWrappedLineTrimmedLength=l},5295:(o,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.BufferSet=void 0;const u=l(8460),c=l(844),d=l(9092);class g extends c.Disposable{constructor(y,_){super(),this._optionsService=y,this._bufferService=_,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 d.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new d.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(y){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(y),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(y,_){this._normal.resize(y,_),this._alt.resize(y,_),this.setupTabStops(y)}setupTabStops(y){this._normal.setupTabStops(y),this._alt.setupTabStops(y)}}a.BufferSet=g},511:(o,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.CellData=void 0;const u=l(482),c=l(643),d=l(3734);class g extends d.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new d.ExtendedAttrs,this.combinedData=""}static fromCharData(y){const _=new g;return _.setFromCharData(y),_}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(y){this.fg=y[c.CHAR_DATA_ATTR_INDEX],this.bg=0;let _=!1;if(y[c.CHAR_DATA_CHAR_INDEX].length>2)_=!0;else if(y[c.CHAR_DATA_CHAR_INDEX].length===2){const v=y[c.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=v&&v<=56319){const m=y[c.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=m&&m<=57343?this.content=1024*(v-55296)+m-56320+65536|y[c.CHAR_DATA_WIDTH_INDEX]<<22:_=!0}else _=!0}else this.content=y[c.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|y[c.CHAR_DATA_WIDTH_INDEX]<<22;_&&(this.combinedData=y[c.CHAR_DATA_CHAR_INDEX],this.content=2097152|y[c.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}a.CellData=g},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 d{get id(){return this._id}constructor(f){this.line=f,this.isDisposed=!1,this._disposables=[],this._id=d._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(f){return this._disposables.push(f),f}}a.Marker=d,d._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(d){d.NUL="\0",d.SOH="",d.STX="",d.ETX="",d.EOT="",d.ENQ="",d.ACK="",d.BEL="\x07",d.BS="\b",d.HT=" ",d.LF=`
|
|
384
|
-
`,d.VT="\v",d.FF="\f",d.CR="\r",d.SO="",d.SI="",d.DLE="",d.DC1="",d.DC2="",d.DC3="",d.DC4="",d.NAK="",d.SYN="",d.ETB="",d.CAN="",d.EM="",d.SUB="",d.ESC="\x1B",d.FS="",d.GS="",d.RS="",d.US="",d.SP=" ",d.DEL=""})(l||(a.C0=l={})),(function(d){d.PAD="",d.HOP="",d.BPH="",d.NBH="",d.IND="",d.NEL="
",d.SSA="",d.ESA="",d.HTS="",d.HTJ="",d.VTS="",d.PLD="",d.PLU="",d.RI="",d.SS2="",d.SS3="",d.DCS="",d.PU1="",d.PU2="",d.STS="",d.CCH="",d.MW="",d.SPA="",d.EPA="",d.SOS="",d.SGCI="",d.SCI="",d.CSI="",d.ST="",d.OSC="",d.PM="",d.APC=""})(u||(a.C1=u={})),(function(d){d.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(d,g,f,y){const _={type:0,cancel:!1,key:void 0},v=(d.shiftKey?1:0)|(d.altKey?2:0)|(d.ctrlKey?4:0)|(d.metaKey?8:0);switch(d.keyCode){case 0:d.key==="UIKeyInputUpArrow"?_.key=g?u.C0.ESC+"OA":u.C0.ESC+"[A":d.key==="UIKeyInputLeftArrow"?_.key=g?u.C0.ESC+"OD":u.C0.ESC+"[D":d.key==="UIKeyInputRightArrow"?_.key=g?u.C0.ESC+"OC":u.C0.ESC+"[C":d.key==="UIKeyInputDownArrow"&&(_.key=g?u.C0.ESC+"OB":u.C0.ESC+"[B");break;case 8:_.key=d.ctrlKey?"\b":u.C0.DEL,d.altKey&&(_.key=u.C0.ESC+_.key);break;case 9:if(d.shiftKey){_.key=u.C0.ESC+"[Z";break}_.key=u.C0.HT,_.cancel=!0;break;case 13:_.key=d.altKey?u.C0.ESC+u.C0.CR:u.C0.CR,_.cancel=!0;break;case 27:_.key=u.C0.ESC,d.altKey&&(_.key=u.C0.ESC+u.C0.ESC),_.cancel=!0;break;case 37:if(d.metaKey)break;v?(_.key=u.C0.ESC+"[1;"+(v+1)+"D",_.key===u.C0.ESC+"[1;3D"&&(_.key=u.C0.ESC+(f?"b":"[1;5D"))):_.key=g?u.C0.ESC+"OD":u.C0.ESC+"[D";break;case 39:if(d.metaKey)break;v?(_.key=u.C0.ESC+"[1;"+(v+1)+"C",_.key===u.C0.ESC+"[1;3C"&&(_.key=u.C0.ESC+(f?"f":"[1;5C"))):_.key=g?u.C0.ESC+"OC":u.C0.ESC+"[C";break;case 38:if(d.metaKey)break;v?(_.key=u.C0.ESC+"[1;"+(v+1)+"A",f||_.key!==u.C0.ESC+"[1;3A"||(_.key=u.C0.ESC+"[1;5A")):_.key=g?u.C0.ESC+"OA":u.C0.ESC+"[A";break;case 40:if(d.metaKey)break;v?(_.key=u.C0.ESC+"[1;"+(v+1)+"B",f||_.key!==u.C0.ESC+"[1;3B"||(_.key=u.C0.ESC+"[1;5B")):_.key=g?u.C0.ESC+"OB":u.C0.ESC+"[B";break;case 45:d.shiftKey||d.ctrlKey||(_.key=u.C0.ESC+"[2~");break;case 46:_.key=v?u.C0.ESC+"[3;"+(v+1)+"~":u.C0.ESC+"[3~";break;case 36:_.key=v?u.C0.ESC+"[1;"+(v+1)+"H":g?u.C0.ESC+"OH":u.C0.ESC+"[H";break;case 35:_.key=v?u.C0.ESC+"[1;"+(v+1)+"F":g?u.C0.ESC+"OF":u.C0.ESC+"[F";break;case 33:d.shiftKey?_.type=2:d.ctrlKey?_.key=u.C0.ESC+"[5;"+(v+1)+"~":_.key=u.C0.ESC+"[5~";break;case 34:d.shiftKey?_.type=3:d.ctrlKey?_.key=u.C0.ESC+"[6;"+(v+1)+"~":_.key=u.C0.ESC+"[6~";break;case 112:_.key=v?u.C0.ESC+"[1;"+(v+1)+"P":u.C0.ESC+"OP";break;case 113:_.key=v?u.C0.ESC+"[1;"+(v+1)+"Q":u.C0.ESC+"OQ";break;case 114:_.key=v?u.C0.ESC+"[1;"+(v+1)+"R":u.C0.ESC+"OR";break;case 115:_.key=v?u.C0.ESC+"[1;"+(v+1)+"S":u.C0.ESC+"OS";break;case 116:_.key=v?u.C0.ESC+"[15;"+(v+1)+"~":u.C0.ESC+"[15~";break;case 117:_.key=v?u.C0.ESC+"[17;"+(v+1)+"~":u.C0.ESC+"[17~";break;case 118:_.key=v?u.C0.ESC+"[18;"+(v+1)+"~":u.C0.ESC+"[18~";break;case 119:_.key=v?u.C0.ESC+"[19;"+(v+1)+"~":u.C0.ESC+"[19~";break;case 120:_.key=v?u.C0.ESC+"[20;"+(v+1)+"~":u.C0.ESC+"[20~";break;case 121:_.key=v?u.C0.ESC+"[21;"+(v+1)+"~":u.C0.ESC+"[21~";break;case 122:_.key=v?u.C0.ESC+"[23;"+(v+1)+"~":u.C0.ESC+"[23~";break;case 123:_.key=v?u.C0.ESC+"[24;"+(v+1)+"~":u.C0.ESC+"[24~";break;default:if(!d.ctrlKey||d.shiftKey||d.altKey||d.metaKey)if(f&&!y||!d.altKey||d.metaKey)!f||d.altKey||d.ctrlKey||d.shiftKey||!d.metaKey?d.key&&!d.ctrlKey&&!d.altKey&&!d.metaKey&&d.keyCode>=48&&d.key.length===1?_.key=d.key:d.key&&d.ctrlKey&&(d.key==="_"&&(_.key=u.C0.US),d.key==="@"&&(_.key=u.C0.NUL)):d.keyCode===65&&(_.type=1);else{const m=c[d.keyCode],x=m==null?void 0:m[d.shiftKey?1:0];if(x)_.key=u.C0.ESC+x;else if(d.keyCode>=65&&d.keyCode<=90){const b=d.ctrlKey?d.keyCode-64:d.keyCode+32;let S=String.fromCharCode(b);d.shiftKey&&(S=S.toUpperCase()),_.key=u.C0.ESC+S}else if(d.keyCode===32)_.key=u.C0.ESC+(d.ctrlKey?u.C0.NUL:" ");else if(d.key==="Dead"&&d.code.startsWith("Key")){let b=d.code.slice(3,4);d.shiftKey||(b=b.toLowerCase()),_.key=u.C0.ESC+b,_.cancel=!0}}else d.keyCode>=65&&d.keyCode<=90?_.key=String.fromCharCode(d.keyCode-64):d.keyCode===32?_.key=u.C0.NUL:d.keyCode>=51&&d.keyCode<=55?_.key=String.fromCharCode(d.keyCode-51+27):d.keyCode===56?_.key=u.C0.DEL:d.keyCode===219?_.key=u.C0.ESC:d.keyCode===220?_.key=u.C0.FS:d.keyCode===221&&(_.key=u.C0.GS)}return _}},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 d="";for(let g=u;g<c;++g){let f=l[g];f>65535?(f-=65536,d+=String.fromCharCode(55296+(f>>10))+String.fromCharCode(f%1024+56320)):d+=String.fromCharCode(f)}return d},a.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(l,u){const c=l.length;if(!c)return 0;let d=0,g=0;if(this._interim){const f=l.charCodeAt(g++);56320<=f&&f<=57343?u[d++]=1024*(this._interim-55296)+f-56320+65536:(u[d++]=this._interim,u[d++]=f),this._interim=0}for(let f=g;f<c;++f){const y=l.charCodeAt(f);if(55296<=y&&y<=56319){if(++f>=c)return this._interim=y,d;const _=l.charCodeAt(f);56320<=_&&_<=57343?u[d++]=1024*(y-55296)+_-56320+65536:(u[d++]=y,u[d++]=_)}else y!==65279&&(u[d++]=y)}return d}},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 d,g,f,y,_=0,v=0,m=0;if(this.interim[0]){let S=!1,T=this.interim[0];T&=(224&T)==192?31:(240&T)==224?15:7;let N,E=0;for(;(N=63&this.interim[++E])&&E<4;)T<<=6,T|=N;const k=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,L=k-E;for(;m<L;){if(m>=c)return 0;if(N=l[m++],(192&N)!=128){m--,S=!0;break}this.interim[E++]=N,T<<=6,T|=63&N}S||(k===2?T<128?m--:u[_++]=T:k===3?T<2048||T>=55296&&T<=57343||T===65279||(u[_++]=T):T<65536||T>1114111||(u[_++]=T)),this.interim.fill(0)}const x=c-4;let b=m;for(;b<c;){for(;!(!(b<x)||128&(d=l[b])||128&(g=l[b+1])||128&(f=l[b+2])||128&(y=l[b+3]));)u[_++]=d,u[_++]=g,u[_++]=f,u[_++]=y,b+=4;if(d=l[b++],d<128)u[_++]=d;else if((224&d)==192){if(b>=c)return this.interim[0]=d,_;if(g=l[b++],(192&g)!=128){b--;continue}if(v=(31&d)<<6|63&g,v<128){b--;continue}u[_++]=v}else if((240&d)==224){if(b>=c)return this.interim[0]=d,_;if(g=l[b++],(192&g)!=128){b--;continue}if(b>=c)return this.interim[0]=d,this.interim[1]=g,_;if(f=l[b++],(192&f)!=128){b--;continue}if(v=(15&d)<<12|(63&g)<<6|63&f,v<2048||v>=55296&&v<=57343||v===65279)continue;u[_++]=v}else if((248&d)==240){if(b>=c)return this.interim[0]=d,_;if(g=l[b++],(192&g)!=128){b--;continue}if(b>=c)return this.interim[0]=d,this.interim[1]=g,_;if(f=l[b++],(192&f)!=128){b--;continue}if(b>=c)return this.interim[0]=d,this.interim[1]=g,this.interim[2]=f,_;if(y=l[b++],(192&y)!=128){b--;continue}if(v=(7&d)<<18|(63&g)<<12|(63&f)<<6|63&y,v<65536||v>1114111)continue;u[_++]=v}}return _}}},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]],d=[[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 g;a.UnicodeV6=class{constructor(){if(this.version="6",!g){g=new Uint8Array(65536),g.fill(1),g[0]=0,g.fill(0,1,32),g.fill(0,127,160),g.fill(2,4352,4448),g[9001]=2,g[9002]=2,g.fill(2,11904,42192),g[12351]=1,g.fill(2,44032,55204),g.fill(2,63744,64256),g.fill(2,65040,65050),g.fill(2,65072,65136),g.fill(2,65280,65377),g.fill(2,65504,65511);for(let f=0;f<c.length;++f)g.fill(0,c[f][0],c[f][1]+1)}}wcwidth(f){return f<32?0:f<127?1:f<65536?g[f]:(function(y,_){let v,m=0,x=_.length-1;if(y<_[0][0]||y>_[x][1])return!1;for(;x>=m;)if(v=m+x>>1,y>_[v][1])m=v+1;else{if(!(y<_[v][0]))return!0;x=v-1}return!1})(f,d)?0:f>=131072&&f<=196605||f>=196608&&f<=262141?2:1}charProperties(f,y){let _=this.wcwidth(f),v=_===0&&y!==0;if(v){const m=u.UnicodeService.extractWidth(y);m===0?v=!1:m>_&&(_=m)}return u.UnicodeService.createPropertyValue(0,_,v)}}},5981:(o,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.WriteBuffer=void 0;const u=l(8460),c=l(844);class d extends c.Disposable{constructor(f){super(),this._action=f,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(f,y){if(y!==void 0&&this._syncCalls>y)return void(this._syncCalls=0);if(this._pendingData+=f.length,this._writeBuffer.push(f),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let _;for(this._isSyncWriting=!0;_=this._writeBuffer.shift();){this._action(_);const v=this._callbacks.shift();v&&v()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(f,y){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+=f.length,this._writeBuffer.push(f),this._callbacks.push(y),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=f.length,this._writeBuffer.push(f),this._callbacks.push(y)}_innerWrite(f=0,y=!0){const _=f||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const v=this._writeBuffer[this._bufferOffset],m=this._action(v,y);if(m){const b=S=>Date.now()-_>=12?setTimeout((()=>this._innerWrite(0,S))):this._innerWrite(_,S);return void m.catch((S=>(queueMicrotask((()=>{throw S})),Promise.resolve(!1)))).then(b)}const x=this._callbacks[this._bufferOffset];if(x&&x(),this._bufferOffset++,this._pendingData-=v.length,Date.now()-_>=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=d},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(d,g){const f=d.toString(16),y=f.length<2?"0"+f:f;switch(g){case 4:return f[0];case 8:return y;case 12:return(y+y).slice(0,3);default:return y+y}}a.parseColor=function(d){if(!d)return;let g=d.toLowerCase();if(g.indexOf("rgb:")===0){g=g.slice(4);const f=l.exec(g);if(f){const y=f[1]?15:f[4]?255:f[7]?4095:65535;return[Math.round(parseInt(f[1]||f[4]||f[7]||f[10],16)/y*255),Math.round(parseInt(f[2]||f[5]||f[8]||f[11],16)/y*255),Math.round(parseInt(f[3]||f[6]||f[9]||f[12],16)/y*255)]}}else if(g.indexOf("#")===0&&(g=g.slice(1),u.exec(g)&&[3,6,9,12].includes(g.length))){const f=g.length/3,y=[0,0,0];for(let _=0;_<3;++_){const v=parseInt(g.slice(f*_,f*_+f),16);y[_]=f===1?v<<4:f===2?v:f===3?v>>4:v>>8}return y}},a.toRgbString=function(d,g=16){const[f,y,_]=d;return`rgb:${c(f,g)}/${c(y,g)}/${c(_,g)}`}},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),d=l(5770),g=[];a.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=g,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=g}registerHandler(y,_){this._handlers[y]===void 0&&(this._handlers[y]=[]);const v=this._handlers[y];return v.push(_),{dispose:()=>{const m=v.indexOf(_);m!==-1&&v.splice(m,1)}}}clearHandler(y){this._handlers[y]&&delete this._handlers[y]}setHandlerFallback(y){this._handlerFb=y}reset(){if(this._active.length)for(let y=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;y>=0;--y)this._active[y].unhook(!1);this._stack.paused=!1,this._active=g,this._ident=0}hook(y,_){if(this.reset(),this._ident=y,this._active=this._handlers[y]||g,this._active.length)for(let v=this._active.length-1;v>=0;v--)this._active[v].hook(_);else this._handlerFb(this._ident,"HOOK",_)}put(y,_,v){if(this._active.length)for(let m=this._active.length-1;m>=0;m--)this._active[m].put(y,_,v);else this._handlerFb(this._ident,"PUT",(0,u.utf32ToString)(y,_,v))}unhook(y,_=!0){if(this._active.length){let v=!1,m=this._active.length-1,x=!1;if(this._stack.paused&&(m=this._stack.loopPosition-1,v=_,x=this._stack.fallThrough,this._stack.paused=!1),!x&&v===!1){for(;m>=0&&(v=this._active[m].unhook(y),v!==!0);m--)if(v instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=m,this._stack.fallThrough=!1,v;m--}for(;m>=0;m--)if(v=this._active[m].unhook(!1),v instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=m,this._stack.fallThrough=!0,v}else this._handlerFb(this._ident,"UNHOOK",y);this._active=g,this._ident=0}};const f=new c.Params;f.addParam(0),a.DcsHandler=class{constructor(y){this._handler=y,this._data="",this._params=f,this._hitLimit=!1}hook(y){this._params=y.length>1||y.params[0]?y.clone():f,this._data="",this._hitLimit=!1}put(y,_,v){this._hitLimit||(this._data+=(0,u.utf32ToString)(y,_,v),this._data.length>d.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(y){let _=!1;if(this._hitLimit)_=!1;else if(y&&(_=this._handler(this._data,this._params),_ instanceof Promise))return _.then((v=>(this._params=f,this._data="",this._hitLimit=!1,v)));return this._params=f,this._data="",this._hitLimit=!1,_}}},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),d=l(6242),g=l(6351);class f{constructor(m){this.table=new Uint8Array(m)}setDefault(m,x){this.table.fill(m<<4|x)}add(m,x,b,S){this.table[x<<8|m]=b<<4|S}addMany(m,x,b,S){for(let T=0;T<m.length;T++)this.table[x<<8|m[T]]=b<<4|S}}a.TransitionTable=f;const y=160;a.VT500_TRANSITION_TABLE=(function(){const v=new f(4095),m=Array.apply(null,Array(256)).map(((E,k)=>k)),x=(E,k)=>m.slice(E,k),b=x(32,127),S=x(0,24);S.push(25),S.push.apply(S,x(28,32));const T=x(0,14);let N;for(N in v.setDefault(1,0),v.addMany(b,0,2,0),T)v.addMany([24,26,153,154],N,3,0),v.addMany(x(128,144),N,3,0),v.addMany(x(144,152),N,3,0),v.add(156,N,0,0),v.add(27,N,11,1),v.add(157,N,4,8),v.addMany([152,158,159],N,0,7),v.add(155,N,11,3),v.add(144,N,11,9);return v.addMany(S,0,3,0),v.addMany(S,1,3,1),v.add(127,1,0,1),v.addMany(S,8,0,8),v.addMany(S,3,3,3),v.add(127,3,0,3),v.addMany(S,4,3,4),v.add(127,4,0,4),v.addMany(S,6,3,6),v.addMany(S,5,3,5),v.add(127,5,0,5),v.addMany(S,2,3,2),v.add(127,2,0,2),v.add(93,1,4,8),v.addMany(b,8,5,8),v.add(127,8,5,8),v.addMany([156,27,24,26,7],8,6,0),v.addMany(x(28,32),8,0,8),v.addMany([88,94,95],1,0,7),v.addMany(b,7,0,7),v.addMany(S,7,0,7),v.add(156,7,0,0),v.add(127,7,0,7),v.add(91,1,11,3),v.addMany(x(64,127),3,7,0),v.addMany(x(48,60),3,8,4),v.addMany([60,61,62,63],3,9,4),v.addMany(x(48,60),4,8,4),v.addMany(x(64,127),4,7,0),v.addMany([60,61,62,63],4,0,6),v.addMany(x(32,64),6,0,6),v.add(127,6,0,6),v.addMany(x(64,127),6,0,0),v.addMany(x(32,48),3,9,5),v.addMany(x(32,48),5,9,5),v.addMany(x(48,64),5,0,6),v.addMany(x(64,127),5,7,0),v.addMany(x(32,48),4,9,5),v.addMany(x(32,48),1,9,2),v.addMany(x(32,48),2,9,2),v.addMany(x(48,127),2,10,0),v.addMany(x(48,80),1,10,0),v.addMany(x(81,88),1,10,0),v.addMany([89,90,92],1,10,0),v.addMany(x(96,127),1,10,0),v.add(80,1,11,9),v.addMany(S,9,0,9),v.add(127,9,0,9),v.addMany(x(28,32),9,0,9),v.addMany(x(32,48),9,9,12),v.addMany(x(48,60),9,8,10),v.addMany([60,61,62,63],9,9,10),v.addMany(S,11,0,11),v.addMany(x(32,128),11,0,11),v.addMany(x(28,32),11,0,11),v.addMany(S,10,0,10),v.add(127,10,0,10),v.addMany(x(28,32),10,0,10),v.addMany(x(48,60),10,8,10),v.addMany([60,61,62,63],10,0,11),v.addMany(x(32,48),10,9,12),v.addMany(S,12,0,12),v.add(127,12,0,12),v.addMany(x(28,32),12,0,12),v.addMany(x(32,48),12,9,12),v.addMany(x(48,64),12,0,11),v.addMany(x(64,127),12,12,13),v.addMany(x(64,127),10,12,13),v.addMany(x(64,127),9,12,13),v.addMany(S,13,13,13),v.addMany(b,13,13,13),v.add(127,13,0,13),v.addMany([27,156,24,26],13,14,0),v.add(y,0,2,0),v.add(y,8,5,8),v.add(y,6,0,6),v.add(y,11,0,11),v.add(y,13,13,13),v})();class _ 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=(x,b,S)=>{},this._executeHandlerFb=x=>{},this._csiHandlerFb=(x,b)=>{},this._escHandlerFb=x=>{},this._errorHandlerFb=x=>x,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 d.OscParser),this._dcsParser=this.register(new g.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(m,x=[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 T=0;T<m.intermediates.length;++T){const N=m.intermediates.charCodeAt(T);if(32>N||N>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");b<<=8,b|=N}}if(m.final.length!==1)throw new Error("final must be a single byte");const S=m.final.charCodeAt(0);if(x[0]>S||S>x[1])throw new Error(`final must be in range ${x[0]} .. ${x[1]}`);return b<<=8,b|=S,b}identToString(m){const x=[];for(;m;)x.push(String.fromCharCode(255&m)),m>>=8;return x.reverse().join("")}setPrintHandler(m){this._printHandler=m}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(m,x){const b=this._identifier(m,[48,126]);this._escHandlers[b]===void 0&&(this._escHandlers[b]=[]);const S=this._escHandlers[b];return S.push(x),{dispose:()=>{const T=S.indexOf(x);T!==-1&&S.splice(T,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,x){this._executeHandlers[m.charCodeAt(0)]=x}clearExecuteHandler(m){this._executeHandlers[m.charCodeAt(0)]&&delete this._executeHandlers[m.charCodeAt(0)]}setExecuteHandlerFallback(m){this._executeHandlerFb=m}registerCsiHandler(m,x){const b=this._identifier(m);this._csiHandlers[b]===void 0&&(this._csiHandlers[b]=[]);const S=this._csiHandlers[b];return S.push(x),{dispose:()=>{const T=S.indexOf(x);T!==-1&&S.splice(T,1)}}}clearCsiHandler(m){this._csiHandlers[this._identifier(m)]&&delete this._csiHandlers[this._identifier(m)]}setCsiHandlerFallback(m){this._csiHandlerFb=m}registerDcsHandler(m,x){return this._dcsParser.registerHandler(this._identifier(m),x)}clearDcsHandler(m){this._dcsParser.clearHandler(this._identifier(m))}setDcsHandlerFallback(m){this._dcsParser.setHandlerFallback(m)}registerOscHandler(m,x){return this._oscParser.registerHandler(m,x)}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,x,b,S,T){this._parseStack.state=m,this._parseStack.handlers=x,this._parseStack.handlerPos=b,this._parseStack.transition=S,this._parseStack.chunkPos=T}parse(m,x,b){let S,T=0,N=0,E=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,E=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(T=m[this._parseStack.chunkPos],S=this._dcsParser.unhook(T!==24&&T!==26,b),S)return S;T===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(T=m[this._parseStack.chunkPos],S=this._oscParser.end(T!==24&&T!==26,b),S)return S;T===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,E=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let k=E;k<x;++k){switch(T=m[k],N=this._transitions.table[this.currentState<<8|(T<160?T:y)],N>>4){case 2:for(let B=k+1;;++B){if(B>=x||(T=m[B])<32||T>126&&T<y){this._printHandler(m,k,B),k=B-1;break}if(++B>=x||(T=m[B])<32||T>126&&T<y){this._printHandler(m,k,B),k=B-1;break}if(++B>=x||(T=m[B])<32||T>126&&T<y){this._printHandler(m,k,B),k=B-1;break}if(++B>=x||(T=m[B])<32||T>126&&T<y){this._printHandler(m,k,B),k=B-1;break}}break;case 3:this._executeHandlers[T]?this._executeHandlers[T]():this._executeHandlerFb(T),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:k,code:T,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const L=this._csiHandlers[this._collect<<8|T];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,N,k),S;A<0&&this._csiHandlerFb(this._collect<<8|T,this._params),this.precedingJoinState=0;break;case 8:do switch(T){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(T-48)}while(++k<x&&(T=m[k])>47&&T<60);k--;break;case 9:this._collect<<=8,this._collect|=T;break;case 10:const I=this._escHandlers[this._collect<<8|T];let O=I?I.length-1:-1;for(;O>=0&&(S=I[O](),S!==!0);O--)if(S instanceof Promise)return this._preserveStack(4,I,O,N,k),S;O<0&&this._escHandlerFb(this._collect<<8|T),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|T,this._params);break;case 13:for(let B=k+1;;++B)if(B>=x||(T=m[B])===24||T===26||T===27||T>127&&T<y){this._dcsParser.put(m,k,B),k=B-1;break}break;case 14:if(S=this._dcsParser.unhook(T!==24&&T!==26),S)return this._preserveStack(6,[],0,N,k),S;T===27&&(N|=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>=x||(T=m[B])<32||T>127&&T<y){this._oscParser.put(m,k,B),k=B-1;break}break;case 6:if(S=this._oscParser.end(T!==24&&T!==26),S)return this._preserveStack(5,[],0,N,k),S;T===27&&(N|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&N}}}a.EscapeSequenceParser=_},6242:(o,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.OscHandler=a.OscParser=void 0;const u=l(5770),c=l(482),d=[];a.OscParser=class{constructor(){this._state=0,this._active=d,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(g,f){this._handlers[g]===void 0&&(this._handlers[g]=[]);const y=this._handlers[g];return y.push(f),{dispose:()=>{const _=y.indexOf(f);_!==-1&&y.splice(_,1)}}}clearHandler(g){this._handlers[g]&&delete this._handlers[g]}setHandlerFallback(g){this._handlerFb=g}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=d}reset(){if(this._state===2)for(let g=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;g>=0;--g)this._active[g].end(!1);this._stack.paused=!1,this._active=d,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||d,this._active.length)for(let g=this._active.length-1;g>=0;g--)this._active[g].start();else this._handlerFb(this._id,"START")}_put(g,f,y){if(this._active.length)for(let _=this._active.length-1;_>=0;_--)this._active[_].put(g,f,y);else this._handlerFb(this._id,"PUT",(0,c.utf32ToString)(g,f,y))}start(){this.reset(),this._state=1}put(g,f,y){if(this._state!==3){if(this._state===1)for(;f<y;){const _=g[f++];if(_===59){this._state=2,this._start();break}if(_<48||57<_)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+_-48}this._state===2&&y-f>0&&this._put(g,f,y)}}end(g,f=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let y=!1,_=this._active.length-1,v=!1;if(this._stack.paused&&(_=this._stack.loopPosition-1,y=f,v=this._stack.fallThrough,this._stack.paused=!1),!v&&y===!1){for(;_>=0&&(y=this._active[_].end(g),y!==!0);_--)if(y instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=_,this._stack.fallThrough=!1,y;_--}for(;_>=0;_--)if(y=this._active[_].end(!1),y instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=_,this._stack.fallThrough=!0,y}else this._handlerFb(this._id,"END",g);this._active=d,this._id=-1,this._state=0}}},a.OscHandler=class{constructor(g){this._handler=g,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(g,f,y){this._hitLimit||(this._data+=(0,c.utf32ToString)(g,f,y),this._data.length>u.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(g){let f=!1;if(this._hitLimit)f=!1;else if(g&&(f=this._handler(this._data),f instanceof Promise))return f.then((y=>(this._data="",this._hitLimit=!1,y)));return this._data="",this._hitLimit=!1,f}}},8742:(o,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.Params=void 0;const l=2147483647;class u{static fromArray(d){const g=new u;if(!d.length)return g;for(let f=Array.isArray(d[0])?1:0;f<d.length;++f){const y=d[f];if(Array.isArray(y))for(let _=0;_<y.length;++_)g.addSubParam(y[_]);else g.addParam(y)}return g}constructor(d=32,g=32){if(this.maxLength=d,this.maxSubParamsLength=g,g>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(d),this.length=0,this._subParams=new Int32Array(g),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(d),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const d=new u(this.maxLength,this.maxSubParamsLength);return d.params.set(this.params),d.length=this.length,d._subParams.set(this._subParams),d._subParamsLength=this._subParamsLength,d._subParamsIdx.set(this._subParamsIdx),d._rejectDigits=this._rejectDigits,d._rejectSubDigits=this._rejectSubDigits,d._digitIsSub=this._digitIsSub,d}toArray(){const d=[];for(let g=0;g<this.length;++g){d.push(this.params[g]);const f=this._subParamsIdx[g]>>8,y=255&this._subParamsIdx[g];y-f>0&&d.push(Array.prototype.slice.call(this._subParams,f,y))}return d}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(d){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(d<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=d>l?l:d}}addSubParam(d){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(d<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=d>l?l:d,this._subParamsIdx[this.length-1]++}}hasSubParams(d){return(255&this._subParamsIdx[d])-(this._subParamsIdx[d]>>8)>0}getSubParams(d){const g=this._subParamsIdx[d]>>8,f=255&this._subParamsIdx[d];return f-g>0?this._subParams.subarray(g,f):null}getSubParamsAll(){const d={};for(let g=0;g<this.length;++g){const f=this._subParamsIdx[g]>>8,y=255&this._subParamsIdx[g];y-f>0&&(d[g]=this._subParams.slice(f,y))}return d}addDigit(d){let g;if(this._rejectDigits||!(g=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const f=this._digitIsSub?this._subParams:this.params,y=f[g-1];f[g-1]=~y?Math.min(10*y+d,l):d}}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(d,g){this._buffer=d,this.type=g}init(d){return this._buffer=d,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(d){const g=this._buffer.lines.get(d);if(g)return new u.BufferLineApiView(g)}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,d){if(!(c<0||c>=this._line.length))return d?(this._line.loadCell(c,d),d):this._line.loadCell(c,new u.CellData)}translateToString(c,d,g){return this._line.translateToString(c,d,g)}}},8285:(o,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.BufferNamespaceApi=void 0;const u=l(8771),c=l(8460),d=l(844);class g extends d.Disposable{constructor(y){super(),this._core=y,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=g},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,d)=>u(c,d.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(v,m,x,b){var S,T=arguments.length,N=T<3?m:b===null?b=Object.getOwnPropertyDescriptor(m,x):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(v,m,x,b);else for(var E=v.length-1;E>=0;E--)(S=v[E])&&(N=(T<3?S(N):T>3?S(m,x,N):S(m,x))||N);return T>3&&N&&Object.defineProperty(m,x,N),N},c=this&&this.__param||function(v,m){return function(x,b){m(x,b,v)}};Object.defineProperty(a,"__esModule",{value:!0}),a.BufferService=a.MINIMUM_ROWS=a.MINIMUM_COLS=void 0;const d=l(8460),g=l(844),f=l(5295),y=l(2585);a.MINIMUM_COLS=2,a.MINIMUM_ROWS=1;let _=a.BufferService=class extends g.Disposable{get buffer(){return this.buffers.active}constructor(v){super(),this.isUserScrolling=!1,this._onResize=this.register(new d.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new d.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(v.rawOptions.cols||0,a.MINIMUM_COLS),this.rows=Math.max(v.rawOptions.rows||0,a.MINIMUM_ROWS),this.buffers=this.register(new f.BufferSet(v,this))}resize(v,m){this.cols=v,this.rows=m,this.buffers.resize(v,m),this._onResize.fire({cols:v,rows:m})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(v,m=!1){const x=this.buffer;let b;b=this._cachedBlankLine,b&&b.length===this.cols&&b.getFg(0)===v.fg&&b.getBg(0)===v.bg||(b=x.getBlankLine(v,m),this._cachedBlankLine=b),b.isWrapped=m;const S=x.ybase+x.scrollTop,T=x.ybase+x.scrollBottom;if(x.scrollTop===0){const N=x.lines.isFull;T===x.lines.length-1?N?x.lines.recycle().copyFrom(b):x.lines.push(b.clone()):x.lines.splice(T+1,0,b.clone()),N?this.isUserScrolling&&(x.ydisp=Math.max(x.ydisp-1,0)):(x.ybase++,this.isUserScrolling||x.ydisp++)}else{const N=T-S+1;x.lines.shiftElements(S+1,N-1,-1),x.lines.set(T,b.clone())}this.isUserScrolling||(x.ydisp=x.ybase),this._onScroll.fire(x.ydisp)}scrollLines(v,m,x){const b=this.buffer;if(v<0){if(b.ydisp===0)return;this.isUserScrolling=!0}else v+b.ydisp>=b.ybase&&(this.isUserScrolling=!1);const S=b.ydisp;b.ydisp=Math.max(Math.min(b.ydisp+v,b.ybase),0),S!==b.ydisp&&(m||this._onScroll.fire(b.ydisp))}};a.BufferService=_=u([c(0,y.IOptionsService)],_)},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,T,N){var E,k=arguments.length,L=k<3?S:N===null?N=Object.getOwnPropertyDescriptor(S,T):N;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")L=Reflect.decorate(b,S,T,N);else for(var A=b.length-1;A>=0;A--)(E=b[A])&&(L=(k<3?E(L):k>3?E(S,T,L):E(S,T))||L);return k>3&&L&&Object.defineProperty(S,T,L),L},c=this&&this.__param||function(b,S){return function(T,N){S(T,N,b)}};Object.defineProperty(a,"__esModule",{value:!0}),a.CoreMouseService=void 0;const d=l(2585),g=l(8460),f=l(844),y={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 _(b,S){let T=(b.ctrl?16:0)|(b.shift?4:0)|(b.alt?8:0);return b.button===4?(T|=64,T|=b.action):(T|=3&b.button,4&b.button&&(T|=64),8&b.button&&(T|=128),b.action===32?T|=32:b.action!==0||S||(T|=3)),T}const v=String.fromCharCode,m={DEFAULT:b=>{const S=[_(b,!1)+32,b.col+32,b.row+32];return S[0]>255||S[1]>255||S[2]>255?"":`\x1B[M${v(S[0])}${v(S[1])}${v(S[2])}`},SGR:b=>{const S=b.action===0&&b.button!==4?"m":"M";return`\x1B[<${_(b,!0)};${b.col};${b.row}${S}`},SGR_PIXELS:b=>{const S=b.action===0&&b.button!==4?"m":"M";return`\x1B[<${_(b,!0)};${b.x};${b.y}${S}`}};let x=a.CoreMouseService=class extends f.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 g.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const T of Object.keys(y))this.addProtocol(T,y[T]);for(const T of Object.keys(m))this.addEncoding(T,m[T]);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,T){if(T){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=x=u([c(0,d.IBufferService),c(1,d.ICoreService)],x)},6975:function(o,a,l){var u=this&&this.__decorate||function(x,b,S,T){var N,E=arguments.length,k=E<3?b:T===null?T=Object.getOwnPropertyDescriptor(b,S):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(x,b,S,T);else for(var L=x.length-1;L>=0;L--)(N=x[L])&&(k=(E<3?N(k):E>3?N(b,S,k):N(b,S))||k);return E>3&&k&&Object.defineProperty(b,S,k),k},c=this&&this.__param||function(x,b){return function(S,T){b(S,T,x)}};Object.defineProperty(a,"__esModule",{value:!0}),a.CoreService=void 0;const d=l(1439),g=l(8460),f=l(844),y=l(2585),_=Object.freeze({insertMode:!1}),v=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let m=a.CoreService=class extends f.Disposable{constructor(x,b,S){super(),this._bufferService=x,this._logService=b,this._optionsService=S,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new g.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new g.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new g.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new g.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,d.clone)(_),this.decPrivateModes=(0,d.clone)(v)}reset(){this.modes=(0,d.clone)(_),this.decPrivateModes=(0,d.clone)(v)}triggerDataEvent(x,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 "${x}"`,(()=>x.split("").map((T=>T.charCodeAt(0))))),this._onData.fire(x)}triggerBinaryEvent(x){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${x}"`,(()=>x.split("").map((b=>b.charCodeAt(0))))),this._onBinary.fire(x))}};a.CoreService=m=u([c(0,y.IBufferService),c(1,y.ILogService),c(2,y.IOptionsService)],m)},9074:(o,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.DecorationService=void 0;const u=l(8055),c=l(8460),d=l(844),g=l(6106);let f=0,y=0;class _ extends d.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new g.SortedList((x=>x==null?void 0:x.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,d.toDisposable)((()=>this.reset())))}registerDecoration(x){if(x.marker.isDisposed)return;const b=new v(x);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 x of this._decorations.values())x.dispose();this._decorations.clear()}*getDecorationsAtCell(x,b,S){let T=0,N=0;for(const E of this._decorations.getKeyIterator(b))T=E.options.x??0,N=T+(E.options.width??1),x>=T&&x<N&&(!S||(E.options.layer??"bottom")===S)&&(yield E)}forEachDecorationAtCell(x,b,S,T){this._decorations.forEachByKey(b,(N=>{f=N.options.x??0,y=f+(N.options.width??1),x>=f&&x<y&&(!S||(N.options.layer??"bottom")===S)&&T(N)}))}}a.DecorationService=_;class v extends d.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(x){super(),this.options=x,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=x.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 d{constructor(...f){this._entries=new Map;for(const[y,_]of f)this.set(y,_)}set(f,y){const _=this._entries.get(f);return this._entries.set(f,y),_}forEach(f){for(const[y,_]of this._entries.entries())f(y,_)}has(f){return this._entries.has(f)}get(f){return this._entries.get(f)}}a.ServiceCollection=d,a.InstantiationService=class{constructor(){this._services=new d,this._services.set(u.IInstantiationService,this)}setService(g,f){this._services.set(g,f)}getService(g){return this._services.get(g)}createInstance(g,...f){const y=(0,c.getServiceDependencies)(g).sort(((m,x)=>m.index-x.index)),_=[];for(const m of y){const x=this._services.get(m.id);if(!x)throw new Error(`[createInstance] ${g.name} depends on UNKNOWN service ${m.id}.`);_.push(x)}const v=y.length>0?y[0].index:f.length;if(f.length!==v)throw new Error(`[createInstance] First service dependency of ${g.name} at position ${v+1} conflicts with ${f.length} static arguments`);return new g(...f,..._)}}},7866:function(o,a,l){var u=this&&this.__decorate||function(v,m,x,b){var S,T=arguments.length,N=T<3?m:b===null?b=Object.getOwnPropertyDescriptor(m,x):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(v,m,x,b);else for(var E=v.length-1;E>=0;E--)(S=v[E])&&(N=(T<3?S(N):T>3?S(m,x,N):S(m,x))||N);return T>3&&N&&Object.defineProperty(m,x,N),N},c=this&&this.__param||function(v,m){return function(x,b){m(x,b,v)}};Object.defineProperty(a,"__esModule",{value:!0}),a.traceCall=a.setTraceLogger=a.LogService=void 0;const d=l(844),g=l(2585),f={trace:g.LogLevelEnum.TRACE,debug:g.LogLevelEnum.DEBUG,info:g.LogLevelEnum.INFO,warn:g.LogLevelEnum.WARN,error:g.LogLevelEnum.ERROR,off:g.LogLevelEnum.OFF};let y,_=a.LogService=class extends d.Disposable{get logLevel(){return this._logLevel}constructor(v){super(),this._optionsService=v,this._logLevel=g.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),y=this}_updateLogLevel(){this._logLevel=f[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(v){for(let m=0;m<v.length;m++)typeof v[m]=="function"&&(v[m]=v[m]())}_log(v,m,x){this._evalLazyOptionalParams(x),v.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+m,...x)}trace(v,...m){var x;this._logLevel<=g.LogLevelEnum.TRACE&&this._log(((x=this._optionsService.options.logger)==null?void 0:x.trace.bind(this._optionsService.options.logger))??console.log,v,m)}debug(v,...m){var x;this._logLevel<=g.LogLevelEnum.DEBUG&&this._log(((x=this._optionsService.options.logger)==null?void 0:x.debug.bind(this._optionsService.options.logger))??console.log,v,m)}info(v,...m){var x;this._logLevel<=g.LogLevelEnum.INFO&&this._log(((x=this._optionsService.options.logger)==null?void 0:x.info.bind(this._optionsService.options.logger))??console.info,v,m)}warn(v,...m){var x;this._logLevel<=g.LogLevelEnum.WARN&&this._log(((x=this._optionsService.options.logger)==null?void 0:x.warn.bind(this._optionsService.options.logger))??console.warn,v,m)}error(v,...m){var x;this._logLevel<=g.LogLevelEnum.ERROR&&this._log(((x=this._optionsService.options.logger)==null?void 0:x.error.bind(this._optionsService.options.logger))??console.error,v,m)}};a.LogService=_=u([c(0,g.IOptionsService)],_),a.setTraceLogger=function(v){y=v},a.traceCall=function(v,m,x){if(typeof x.value!="function")throw new Error("not supported");const b=x.value;x.value=function(...S){if(y.logLevel!==g.LogLevelEnum.TRACE)return b.apply(this,S);y.trace(`GlyphRenderer#${b.name}(${S.map((N=>JSON.stringify(N))).join(", ")})`);const T=b.apply(this,S);return y.trace(`GlyphRenderer#${b.name} return`,T),T}}},7302:(o,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.OptionsService=a.DEFAULT_OPTIONS=void 0;const u=l(8460),c=l(844),d=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:d.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const g=["normal","bold","100","200","300","400","500","600","700","800","900"];class f extends c.Disposable{constructor(_){super(),this._onOptionChange=this.register(new u.EventEmitter),this.onOptionChange=this._onOptionChange.event;const v={...a.DEFAULT_OPTIONS};for(const m in _)if(m in v)try{const x=_[m];v[m]=this._sanitizeAndValidateOption(m,x)}catch(x){console.error(x)}this.rawOptions=v,this.options={...v},this._setupOptions(),this.register((0,c.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(_,v){return this.onOptionChange((m=>{m===_&&v(this.rawOptions[_])}))}onMultipleOptionChange(_,v){return this.onOptionChange((m=>{_.indexOf(m)!==-1&&v()}))}_setupOptions(){const _=m=>{if(!(m in a.DEFAULT_OPTIONS))throw new Error(`No option with key "${m}"`);return this.rawOptions[m]},v=(m,x)=>{if(!(m in a.DEFAULT_OPTIONS))throw new Error(`No option with key "${m}"`);x=this._sanitizeAndValidateOption(m,x),this.rawOptions[m]!==x&&(this.rawOptions[m]=x,this._onOptionChange.fire(m))};for(const m in this.rawOptions){const x={get:_.bind(this,m),set:v.bind(this,m)};Object.defineProperty(this.options,m,x)}}_sanitizeAndValidateOption(_,v){switch(_){case"cursorStyle":if(v||(v=a.DEFAULT_OPTIONS[_]),!(function(m){return m==="block"||m==="underline"||m==="bar"})(v))throw new Error(`"${v}" is not a valid value for ${_}`);break;case"wordSeparator":v||(v=a.DEFAULT_OPTIONS[_]);break;case"fontWeight":case"fontWeightBold":if(typeof v=="number"&&1<=v&&v<=1e3)break;v=g.includes(v)?v:a.DEFAULT_OPTIONS[_];break;case"cursorWidth":v=Math.floor(v);case"lineHeight":case"tabStopWidth":if(v<1)throw new Error(`${_} cannot be less than 1, value: ${v}`);break;case"minimumContrastRatio":v=Math.max(1,Math.min(21,Math.round(10*v)/10));break;case"scrollback":if((v=Math.min(v,4294967295))<0)throw new Error(`${_} cannot be less than 0, value: ${v}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(v<=0)throw new Error(`${_} cannot be less than or equal to 0, value: ${v}`);break;case"rows":case"cols":if(!v&&v!==0)throw new Error(`${_} must be numeric, value: ${v}`);break;case"windowsPty":v=v??{}}return v}}a.OptionsService=f},2660:function(o,a,l){var u=this&&this.__decorate||function(f,y,_,v){var m,x=arguments.length,b=x<3?y:v===null?v=Object.getOwnPropertyDescriptor(y,_):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(f,y,_,v);else for(var S=f.length-1;S>=0;S--)(m=f[S])&&(b=(x<3?m(b):x>3?m(y,_,b):m(y,_))||b);return x>3&&b&&Object.defineProperty(y,_,b),b},c=this&&this.__param||function(f,y){return function(_,v){y(_,v,f)}};Object.defineProperty(a,"__esModule",{value:!0}),a.OscLinkService=void 0;const d=l(2585);let g=a.OscLinkService=class{constructor(f){this._bufferService=f,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(f){const y=this._bufferService.buffer;if(f.id===void 0){const S=y.addMarker(y.ybase+y.y),T={data:f,id:this._nextId++,lines:[S]};return S.onDispose((()=>this._removeMarkerFromLink(T,S))),this._dataByLinkId.set(T.id,T),T.id}const _=f,v=this._getEntryIdKey(_),m=this._entriesWithId.get(v);if(m)return this.addLineToLink(m.id,y.ybase+y.y),m.id;const x=y.addMarker(y.ybase+y.y),b={id:this._nextId++,key:this._getEntryIdKey(_),data:_,lines:[x]};return x.onDispose((()=>this._removeMarkerFromLink(b,x))),this._entriesWithId.set(b.key,b),this._dataByLinkId.set(b.id,b),b.id}addLineToLink(f,y){const _=this._dataByLinkId.get(f);if(_&&_.lines.every((v=>v.line!==y))){const v=this._bufferService.buffer.addMarker(y);_.lines.push(v),v.onDispose((()=>this._removeMarkerFromLink(_,v)))}}getLinkData(f){var y;return(y=this._dataByLinkId.get(f))==null?void 0:y.data}_getEntryIdKey(f){return`${f.id};;${f.uri}`}_removeMarkerFromLink(f,y){const _=f.lines.indexOf(y);_!==-1&&(f.lines.splice(_,1),f.lines.length===0&&(f.data.id!==void 0&&this._entriesWithId.delete(f.key),this._dataByLinkId.delete(f.id)))}};a.OscLinkService=g=u([c(0,d.IBufferService)],g)},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 d=function(g,f,y){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(_,v,m){v[l]===v?v[u].push({id:_,index:m}):(v[u]=[{id:_,index:m}],v[l]=v)})(d,g,y)};return d.toString=()=>c,a.serviceRegistry.set(c,d),d}},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(d){d[d.TRACE=0]="TRACE",d[d.DEBUG=1]="DEBUG",d[d.INFO=2]="INFO",d[d.WARN=3]="WARN",d[d.ERROR=4]="ERROR",d[d.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 d{static extractShouldJoin(f){return(1&f)!=0}static extractWidth(f){return f>>1&3}static extractCharKind(f){return f>>3}static createPropertyValue(f,y,_=!1){return(16777215&f)<<3|(3&y)<<1|(_?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new u.EventEmitter,this.onChange=this._onChange.event;const f=new c.UnicodeV6;this.register(f),this._active=f.version,this._activeProvider=f}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(f){if(!this._providers[f])throw new Error(`unknown Unicode version "${f}"`);this._active=f,this._activeProvider=this._providers[f],this._onChange.fire(f)}register(f){this._providers[f.version]=f}wcwidth(f){return this._activeProvider.wcwidth(f)}getStringCellWidth(f){let y=0,_=0;const v=f.length;for(let m=0;m<v;++m){let x=f.charCodeAt(m);if(55296<=x&&x<=56319){if(++m>=v)return y+this.wcwidth(x);const T=f.charCodeAt(m);56320<=T&&T<=57343?x=1024*(x-55296)+T-56320+65536:y+=this.wcwidth(T)}const b=this.charProperties(x,_);let S=d.extractWidth(b);d.extractShouldJoin(b)&&(S-=d.extractWidth(_)),y+=S,_=b}return y}charProperties(f,y){return this._activeProvider.charProperties(f,y)}}a.UnicodeService=d}},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),d=i(8285),g=i(7975),f=i(7090),y=["cols","rows"];class _ 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 x=S=>this._core.options[S],b=(S,T)=>{this._checkReadonlyOptions(S),this._core.options[S]=T};for(const S in this._core.options){const T={get:x.bind(this,S),set:b.bind(this,S)};Object.defineProperty(this._publicOptions,S,T)}}_checkReadonlyOptions(m){if(y.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 g.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new f.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 d.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const m=this._core.coreService.decPrivateModes;let x="none";switch(this._core.coreMouseService.activeProtocol){case"X10":x="x10";break;case"VT200":x="vt200";break;case"DRAG":x="drag";break;case"ANY":x="any"}return{applicationCursorKeysMode:m.applicationCursorKeys,applicationKeypadMode:m.applicationKeypad,bracketedPasteMode:m.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:x,originMode:m.origin,reverseWraparoundMode:m.reverseWraparound,sendFocusMode:m.sendFocus,wraparoundMode:m.wraparound}}get options(){return this._publicOptions}set options(m){for(const x in m)this._publicOptions[x]=m[x]}blur(){this._core.blur()}focus(){this._core.focus()}input(m,x=!0){this._core.input(m,x)}resize(m,x){this._verifyIntegers(m,x),this._core.resize(m,x)}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,x,b){this._verifyIntegers(m,x,b),this._core.select(m,x,b)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(m,x){this._verifyIntegers(m,x),this._core.selectLines(m,x)}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,x){this._core.write(m,x)}writeln(m,x){this._core.write(m),this._core.write(`\r
|
|
385
|
-
`,x)}paste(m){this._core.paste(m)}refresh(m,x){this._verifyIntegers(m,x),this._core.refresh(m,x)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(m){this._addonManager.loadAddon(this,m)}static get strings(){return a}_verifyIntegers(...m){for(const x of m)if(x===1/0||isNaN(x)||x%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...m){for(const x of m)if(x&&(x===1/0||isNaN(x)||x%1!=0||x<0))throw new Error("This API only accepts positive integers")}}o.Terminal=_})(),s})()))})($p)),$p.exports}var N2=_5(),Wp={exports:{}},Sb;function S5(){return Sb||(Sb=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),d=l-(parseInt(c.getPropertyValue("padding-top"))+parseInt(c.getPropertyValue("padding-bottom"))),g=u-(parseInt(c.getPropertyValue("padding-right"))+parseInt(c.getPropertyValue("padding-left")))-o;return{cols:Math.max(2,Math.floor(g/s.css.cell.width)),rows:Math.max(1,Math.floor(d/s.css.cell.height))}}}})(),r})()))})(Wp)),Wp.exports}var R2=S5();function C5({cwd:t,cmd:e,governed:r=!0}){const n=J.useRef(null),i=J.useRef({cwd:t,cmd:e,governed:r});return i.current={cwd:t,cmd:e,governed:r},J.useEffect(()=>{const s=n.current;if(!s)return;let o=!1,a,l;const u=new N2.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 R2.FitAddon;u.loadAddon(c);const d=u.onData(y=>{a&&a.readyState===WebSocket.OPEN&&a.send(y)}),g=typeof ResizeObserver<"u"?new ResizeObserver(()=>{try{c.fit()}catch{}l&&Ve.resizeTerminal(l,u.cols,u.rows).catch(()=>{})}):void 0,f=requestAnimationFrame(()=>{if(!o){u.open(s);try{c.fit()}catch{}g==null||g.observe(s),(async()=>{const y=i.current;let _;try{const m={cwd:y.cwd,cols:u.cols,rows:u.rows,governed:y.governed};y.cmd!==void 0&&(m.cmd=y.cmd),_=(await Ve.openTerminal(m)).id}catch(m){const x=m instanceof Error?m.message:String(m);u.write(`\r
|
|
386
|
-
\x1B[31m[failed to open terminal: ${x}]\x1B[0m\r
|
|
387
|
-
`);return}if(o){Ve.closeTerminal(_).catch(()=>{});return}l=_;const v=new WebSocket(Sw(_));v.binaryType="arraybuffer",v.onmessage=m=>{typeof m.data=="string"?u.write(m.data):u.write(new Uint8Array(m.data))},a=v})()}});return()=>{o=!0,cancelAnimationFrame(f),g==null||g.disconnect(),d.dispose();try{a==null||a.close()}catch{}l&&Ve.closeTerminal(l).catch(()=>{}),u.dispose()}},[]),w.jsxs("div",{"data-testid":"terminal",className:"flex flex-col gap-1",children:[w.jsxs("div",{className:"flex items-center justify-between text-[11px]",children:[w.jsx("span",{className:"font-semibold font-mono",style:{color:"rgba(230,237,243,0.4)"},children:"Terminal"}),w.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"})]}),w.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 w.jsxs("div",{className:"flex gap-2 text-[11px]",children:[w.jsx("span",{className:"w-20 shrink-0 font-mono",style:{color:"rgba(230,237,243,0.4)"},children:t}),w.jsx("span",{className:r?"font-mono break-all":"",style:{color:"rgba(230,237,243,0.7)"},children:e})]})}function k5({model:t}){const{session:e}=t;return w.jsxs("div",{"data-testid":"what-where",className:"flex flex-col gap-1.5",children:[w.jsx(Yo,{label:"intent",value:e.problem}),w.jsx(Yo,{label:"repo",value:e.repo_ref??"—",mono:!0}),w.jsx(Yo,{label:"worktree",value:e.workdir??"—",mono:!0}),w.jsx(Yo,{label:"roster",value:e.clis.length>0?e.clis.join(", "):"—",mono:!0}),w.jsx(Yo,{label:"entity",value:e.entity_mode}),w.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 (",w.jsx("code",{children:"work_output"})," pending daemon surface)"]})]})}const E5=[{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"}],T5=new Set(["Write","Edit","MultiEdit","NotebookEdit"]),N5=new Set(["DeleteFile","Remove"]);function Vp({path:t,opKind:e,runId:r}){const[n,i]=J.useState(null),s=J.useRef(null);J.useEffect(()=>()=>{s.current!==null&&clearTimeout(s.current)},[]);const o=t.replace(/\\/g,"/").split("/"),a=o.pop()??t,l=o.length>0?`${o.join("/")}/`:"",u=e==="delete"?"−":e==="write"?"±":"~",c=e==="delete"?"#f85149":e==="write"?"#ffda19":"rgba(230,237,243,0.25)",d=e==="delete"?"#f85149":"#e6edf3";function g(_){i(_),s.current!==null&&clearTimeout(s.current),s.current=setTimeout(()=>{i(null),s.current=null},2e3)}function f(){navigator.clipboard.writeText(t).then(()=>{g("copied")}).catch(()=>{})}function y(){Ve.openPath(t,r).then(()=>g("opened")).catch(()=>{navigator.clipboard.writeText(t).catch(()=>{}),g("open-failed")})}return w.jsxs("li",{title:t,className:"flex items-start gap-1.5 min-w-0",children:[w.jsx("span",{className:"shrink-0 mt-0.5 text-[9px] font-mono select-none",style:{color:c},children:u}),w.jsxs("button",{type:"button",onClick:y,className:"min-w-0 flex-1 leading-5 font-mono text-[10px] break-all text-left transition-opacity hover:opacity-70",title:`Open with system default app: ${t}`,style:{background:"none",border:"none",padding:0,cursor:"pointer"},children:[l&&w.jsx("span",{style:{color:"rgba(230,237,243,0.3)"},children:l}),w.jsx("span",{style:{color:d},children:a}),n==="opened"&&w.jsx("span",{className:"ml-1 text-[9px]",style:{color:"#3fb950"},children:"✓ opened"}),n==="copied"&&w.jsx("span",{className:"ml-1 text-[9px]",style:{color:"#3fb950"},children:"✓ copied"}),n==="open-failed"&&w.jsx("span",{className:"ml-1 text-[9px]",style:{color:"#ffda19"},children:"open unavailable — path copied"})]}),w.jsx("button",{type:"button",onClick:f,"aria-label":`Copy path ${t}`,title:"Copy path",className:"shrink-0 mt-0.5 text-[9px] font-mono leading-5 transition-opacity hover:opacity-70",style:{background:"none",border:"none",padding:0,cursor:"pointer",color:"rgba(230,237,243,0.35)"},children:"⧉"})]})}function R5({model:t}){const e=t.session.id,r=new Set,n=new Set;for(const y of t.units)for(const _ of y.hookFires)T5.has(_.toolName)&&r.add(y.ord),N5.has(_.toolName)&&n.add(y.ord);const i=new Set,s=new Set,o=new Set;for(const y of t.units)for(const _ of y.filesRead)o.add(_),n.has(y.ord)?s.add(_):r.has(y.ord)&&i.add(_);for(const y of s)i.delete(y);const a=new Set;for(const y of o)!i.has(y)&&!s.has(y)&&a.add(y);const l=i.size>0||s.size>0,u=o.size>0,c=!["completed","cancelled","failed"].includes(t.session.status);if(!u)return w.jsx("p",{className:"text-xs font-mono",style:{color:"rgba(230,237,243,0.35)"},children:c?"No files changed yet.":"No files changed."});const d=[...i].sort(),g=[...s].sort(),f=[...a].sort();return w.jsxs("div",{className:"flex flex-col gap-4",children:[(l||c)&&w.jsxs("div",{children:[w.jsx("p",{className:"text-[10px] font-mono mb-2 uppercase tracking-wider",style:{color:"rgba(230,237,243,0.3)"},children:"Modified / Created"}),l?w.jsxs("ul",{className:"flex flex-col gap-1",children:[d.map(y=>w.jsx(Vp,{path:y,opKind:"write",runId:e},y)),g.map(y=>w.jsx(Vp,{path:y,opKind:"delete",runId:e},y))]}):w.jsx("p",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.3)"},children:"No files changed yet."})]}),f.length>0&&w.jsxs("div",{children:[w.jsx("p",{className:"text-[10px] font-mono mb-2 uppercase tracking-wider",style:{color:"rgba(230,237,243,0.3)"},children:"Referenced"}),w.jsx("ul",{className:"flex flex-col gap-1",children:f.map(y=>w.jsx(Vp,{path:y,runId:e},y))})]}),w.jsxs("p",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.2)"},children:[o.size," file",o.size!==1?"s":""," total"]})]})}const L5=new Set(["executing","distributing","planning"]);function D5({view:t}){const[e,r]=J.useState(!1),[n,i]=J.useState("whatwhere"),[s,o]=J.useState(!1),[a,l]=J.useState(!1),[u,c]=J.useState(""),[d,g]=J.useState(!1),[f,y]=J.useState(null),_=J.useRef(null),v=J.useRef(!1),{session:m}=t,x=s5(m.id,t),b=L5.has(m.status),S=x?new Set(x.units.flatMap(N=>N.filesRead)).size:null;function T(N){i(E=>E===N?null:N)}return e?w.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:[w.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:"‹"}),w.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:"⬛"}),w.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:"%"})]}):w.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:[w.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:[w.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:[w.jsx("span",{className:"text-sm leading-none shrink-0",style:{color:"rgba(230,237,243,0.35)"},children:"›"}),w.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-widest font-mono",style:{color:"rgba(230,237,243,0.4)"},children:"Insights"})]}),w.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"}),w.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"})]}),w.jsx("div",{className:"flex-1 overflow-y-auto",children:E5.map(({id:N,label:E})=>w.jsxs("div",{style:{borderBottom:"1px solid rgba(230,237,243,0.06)"},children:[w.jsxs("button",{type:"button",onClick:()=>T(N),className:"w-full flex items-center justify-between px-4 py-2.5 text-left transition-colors",style:{color:n===N?"#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===N,children:[w.jsxs("div",{className:"flex items-center gap-1.5",children:[w.jsx("span",{className:"text-xs font-medium font-mono",children:E}),N==="files"&&S!==null&&S>0&&w.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})]}),w.jsx("span",{className:"text-xs",style:{color:"rgba(230,237,243,0.3)"},children:n===N?"▲":"▼"})]}),n===N&&x&&w.jsxs("div",{className:"px-4 py-3",style:{background:"#0a0d12"},children:[N==="decisions"&&w.jsx(v5,{model:x}),N==="governance"&&w.jsx(x5,{model:x}),N==="burn"&&w.jsx(h5,{model:x}),N==="data"&&w.jsx(f5,{model:x}),N==="steering"&&w.jsx(w5,{runId:x.session.id}),N==="whatwhere"&&w.jsx(k5,{model:x}),N==="assumptions"&&w.jsx(u5,{model:x}),N==="files"&&w.jsx(R5,{model:x})]}),n===N&&!x&&w.jsx("div",{className:"px-4 py-3",children:w.jsx("p",{className:"text-xs font-mono",style:{color:"rgba(230,237,243,0.35)"},children:"Loading…"})})]},N))}),b&&w.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:[w.jsx("p",{className:"text-[9px] font-mono uppercase tracking-widest",style:{color:"rgba(230,237,243,0.3)"},children:"Steer"}),w.jsxs("form",{onSubmit:N=>{N.preventDefault();const E=u.trim();!E||v.current||(v.current=!0,g(!0),y(null),Ve.injectMessage(m.id,E,"all").then(()=>{c("")}).catch(k=>{const L=k instanceof Error?k.message:String(k);y(L||"Failed to send instruction — please try again.")}).finally(()=>{v.current=!1,g(!1)}))},className:"flex flex-col gap-1",children:[w.jsxs("div",{className:"flex gap-1.5",children:[w.jsx("textarea",{ref:_,value:u,onChange:N=>{c(N.target.value),y(null)},onKeyDown:N=>{var E;N.key==="Enter"&&!N.shiftKey&&!N.nativeEvent.isComposing&&(N.preventDefault(),(E=N.currentTarget.form)==null||E.requestSubmit())},"aria-label":"Steering instruction",rows:2,placeholder:"Send instruction to agents…",disabled:d,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}}),w.jsx("button",{type:"submit","aria-label":d?"Sending…":"Send steering instruction",disabled:d||!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:d?"…":"↑"})]}),f&&w.jsx("p",{className:"text-[10px] font-mono",style:{color:"#f85149"},children:f})]})]}),s&&w.jsx(wb,{title:"Operator shell",onClose:()=>o(!1),disableEscapeKey:!0,children:w.jsx(C5,{cwd:m.workdir??".",governed:!0})}),a&&w.jsx(wb,{title:"Coverage report",onClose:()=>l(!1),children:w.jsx(Tw,{})})]})}const L2={critical:"#f85149",error:"#f97316",warn:"#ffda19",info:"rgba(230,237,243,0.5)"},A5={id:"",rule_type:"pattern",statement:"",severity:"warn",confidence:.9,targets:{},provenance:{source:"manual",source_kinds:["policy"]}};function P5({rule:t,onEdit:e}){var r,n,i;return w.jsxs("tr",{className:"text-[11px]",style:{borderBottom:"1px solid rgba(230,237,243,0.06)"},children:[w.jsx("td",{className:"px-3 py-2 font-mono",style:{color:"rgba(230,237,243,0.7)"},children:t.id}),w.jsx("td",{className:"px-3 py-2",style:{color:"rgba(230,237,243,0.45)"},children:t.rule_type}),w.jsx("td",{className:"px-3 py-2",children:w.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:L2[t.severity]??"rgba(230,237,243,0.5)"},children:t.severity})}),w.jsx("td",{className:"px-3 py-2 truncate max-w-xs",style:{color:"rgba(230,237,243,0.6)"},children:t.statement}),w.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(" / ")||"—"}),w.jsx("td",{className:"px-3 py-2",children:w.jsx("button",{type:"button",onClick:()=>e(t),className:"text-[10px] hover:underline",style:{color:"#79c0ff"},children:"Edit"})})]})}function M5(){const[t,e]=J.useState([]),[r,n]=J.useState(!0),[i,s]=J.useState(null),[o,a]=J.useState(""),[l,u]=J.useState(null),[c,d]=J.useState("idle"),[g,f]=J.useState(null),[y,_]=J.useState({}),[v,m]=J.useState(null),[x,b]=J.useState(!1),[S,T]=J.useState(null),N=J.useCallback(async()=>{n(!0),s(null);try{const{rules:O}=await Ve.listConformanceRules();e(O)}catch(O){s(O instanceof Error?O.message:String(O))}finally{n(!1)}},[]);J.useEffect(()=>{N()},[N]);const E=O=>{a(JSON.stringify(O??A5,null,2)),u(null),d("idle"),f(null)},k=O=>{a(O);try{JSON.parse(O),u(null)}catch(B){u(B instanceof Error?B.message:String(B))}},L=async()=>{if(l)return;let O;try{O=JSON.parse(o)}catch(B){u(B instanceof Error?B.message:String(B));return}d("saving"),f(null);try{await Ve.upsertConformanceRule(O),d("ok"),await N()}catch(B){d("error"),f(B instanceof Error?B.message:String(B))}},A=async()=>{b(!0),T(null);try{const{rules:O}=await Ve.recallRulesPreview(y);m(O)}catch(O){T(O instanceof Error?O.message:String(O)),m(null)}finally{b(!1)}},I=(O,B)=>w.jsx("input",{type:"text","aria-label":O,placeholder:B,value:y[O]??"",onChange:D=>_(M=>({...M,[O]: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 w.jsxs("div",{className:"flex flex-col gap-4",children:[w.jsxs("div",{className:"flex items-center gap-3",children:[w.jsx("h2",{className:"text-sm font-semibold",style:{color:"#e6edf3"},children:"Conformance rules"}),w.jsx("button",{type:"button",onClick:()=>void N(),className:"text-[10px] hover:underline",style:{color:"rgba(230,237,243,0.4)"},children:"Refresh"}),w.jsx("button",{type:"button",onClick:()=>E(),className:"ml-auto rounded px-2 py-1 text-[11px] font-semibold",style:{background:"#ffda19",color:"#0d1117"},children:"+ New rule"})]}),i&&w.jsx("p",{className:"rounded px-2 py-1 text-xs",style:{background:"rgba(248,81,73,0.08)",color:"#f85149"},children:i}),r?w.jsx("p",{className:"text-xs",style:{color:"rgba(230,237,243,0.4)"},children:"Loading rules…"}):w.jsx("div",{className:"overflow-x-auto rounded",style:{border:"1px solid rgba(230,237,243,0.08)"},children:w.jsxs("table",{className:"w-full text-[11px]",children:[w.jsx("thead",{children:w.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:[w.jsx("th",{className:"px-3 py-2 text-left",children:"ID"}),w.jsx("th",{className:"px-3 py-2 text-left",children:"Type"}),w.jsx("th",{className:"px-3 py-2 text-left",children:"Severity"}),w.jsx("th",{className:"px-3 py-2 text-left",children:"Statement"}),w.jsx("th",{className:"px-3 py-2 text-left",children:"Targets"}),w.jsx("th",{className:"px-3 py-2"})]})}),w.jsx("tbody",{children:t.length===0?w.jsx("tr",{children:w.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(O=>w.jsx(P5,{rule:O,onEdit:E},O.id))})]})}),o!==""&&w.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:[w.jsxs("div",{className:"flex items-center gap-2",children:[w.jsx("span",{className:"text-[11px] font-semibold",style:{color:"#ffda19"},children:"Rule JSON"}),w.jsx("button",{type:"button",onClick:()=>{a(""),d("idle")},className:"ml-auto text-[10px] hover:underline",style:{color:"rgba(230,237,243,0.4)"},children:"Cancel"})]}),w.jsx("textarea",{"aria-label":"Conformance rule JSON editor",value:o,onChange:O=>k(O.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&&w.jsx("p",{className:"text-[10px]",style:{color:"#f85149"},children:l}),w.jsxs("div",{className:"flex items-center gap-2",children:[w.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"&&w.jsx("span",{className:"text-[10px]",style:{color:"#3fb950"},children:"Saved."}),c==="error"&&w.jsx("span",{className:"text-[10px]",style:{color:"#f85149"},children:g})]})]}),w.jsxs("div",{className:"flex flex-col gap-2 rounded p-3",style:{border:"1px solid rgba(230,237,243,0.08)",background:"#0f1419"},children:[w.jsx("p",{className:"text-[11px] font-semibold",style:{color:"rgba(230,237,243,0.7)"},children:"Preview — which rules apply?"}),w.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"),w.jsx("button",{type:"button",onClick:()=>void A(),disabled:x,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:x?"Loading…":"Preview"})]}),S&&w.jsx("p",{className:"text-[10px]",style:{color:"#f85149"},children:S}),v!==null&&(v.length===0?w.jsx("p",{className:"text-[10px]",style:{color:"rgba(230,237,243,0.4)"},children:"No rules match this query."}):w.jsx("ul",{className:"flex flex-col gap-0.5",children:v.map(O=>w.jsxs("li",{className:"flex items-center gap-2 text-[10px]",children:[w.jsx("span",{className:"inline-flex rounded px-1 text-[9px] font-semibold font-mono",style:{background:"rgba(230,237,243,0.06)",color:L2[O.severity]??"rgba(230,237,243,0.5)"},children:O.severity}),w.jsx("span",{className:"font-mono",style:{color:"rgba(230,237,243,0.6)"},children:O.id}),w.jsx("span",{className:"truncate",style:{color:"rgba(230,237,243,0.45)"},children:O.statement})]},O.id))}))]})]})}function Ko(t,e){return{...t,[e]:(t[e]??0)+1}}const _l=oa((t,e)=>({elicitations:{},generations:{},getRunGen:r=>e().generations[r]??0,setElicitation:r=>t(n=>({elicitations:{...n.elicitations,[r.runId]:r},generations:Ko(n.generations,r.runId)})),clearElicitation:r=>t(n=>{const i={...n.elicitations};return delete i[r],{elicitations:i,generations:Ko(n.generations,r)}}),setFromGetIfUnchanged:(r,n,i)=>{let s=!1;return t(o=>{if((o.generations[r]??0)!==n)return o;s=!0;const a={...o.elicitations};return i===null?delete a[r]:a[r]=i,{elicitations:a,generations:Ko(o.generations,r)}}),s},swapFromGet:(r,n,i)=>{let s=!1;return t(o=>{var l;if(((l=o.elicitations[r])==null?void 0:l.elicitationId)!==n)return o;s=!0;const a={...o.elicitations};return i===null?delete a[r]:a[r]=i,{elicitations:a,generations:Ko(o.generations,r)}}),s},ingest:r=>{const n=typeof r.session=="string"?r.session:void 0;if(n!==void 0){if(r.type==="elicitationCreated"){const i=r.elicitationId,s=r.message??r.prompt;if(typeof i!="string"||typeof s!="string")return;e().setElicitation({runId:n,elicitationId:i,message:s,options:Array.isArray(r.options)?r.options:null,receivedAt:new Date().toISOString()});return}(r.type==="elicitationResolved"||r.type==="sessionCompleted"||r.type==="sessionFailed"||r.type==="sessionCancelled")&&e().clearElicitation(n)}},reconcile:r=>{const n=new Set(r);t(i=>{const s=Object.keys(i.elicitations).filter(l=>!n.has(l));if(s.length===0)return i;const o={};for(const[l,u]of Object.entries(i.elicitations))n.has(l)&&(o[l]=u);let a=i.generations;for(const l of s)a=Ko(a,l);return{elicitations:o,generations:a}})}}));function I5({e:t}){const[e,r]=J.useState(""),[n,i]=J.useState(null),[s,o]=J.useState(!1),[a,l]=J.useState(null),u=_l(y=>y.swapFromGet),c=_l(y=>y.clearElicitation),d=n??e.trim(),g=t.options===null?d.length>0:n!==null;async function f(y){o(!0),l(null);try{await Ve.respondToElicitation(t.runId,{elicitationId:t.elicitationId,action:y,...y==="accept"?{content:{response:d}}:{}}),c(t.runId)}catch(_){const v=_ instanceof Error?_.message:String(_);if(/\b409\b/.test(v)){let m;try{m=await Ve.getElicitation(t.runId)}catch(b){l(b instanceof Error?b.message:String(b));return}u(t.runId,t.elicitationId,m===null?null:{runId:m.runId,elicitationId:m.elicitationId,message:m.message,options:m.options,receivedAt:m.receivedAt})&&m===null&&l(null)}else l(v)}finally{o(!1)}}return w.jsxs("div",{className:"flex flex-col gap-2 rounded p-3",style:{border:"1px solid rgba(230,237,243,0.12)",background:"#1b222e"},"data-testid":"elicitation-prompt",children:[w.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-wider font-mono",style:{color:"rgba(230,237,243,0.4)"},children:"Input requested"}),w.jsx("p",{className:"text-sm",style:{color:"#e6edf3"},children:t.message}),t.options===null?w.jsx("input",{type:"text",value:e,disabled:s,onChange:y=>r(y.target.value),placeholder:"Your answer","aria-label":"Your answer",className:"rounded px-2 py-1 text-sm",style:{background:"#161c26",border:"1px solid rgba(230,237,243,0.1)",color:"#e6edf3"}}):w.jsx("div",{className:"flex flex-wrap gap-1",children:t.options.map(y=>w.jsx("button",{type:"button",disabled:s,onClick:()=>i(y),className:"rounded px-2 py-0.5 text-xs font-mono",style:{background:n===y?"rgba(121,192,255,0.15)":"#161c26",border:`1px solid ${n===y?"#79c0ff":"rgba(230,237,243,0.1)"}`,color:"#e6edf3"},children:y},y))}),a!==null&&w.jsx("p",{className:"text-xs",style:{color:"#f85149"},children:a}),w.jsxs("div",{className:"flex gap-2",children:[w.jsx("button",{type:"button",disabled:s||!g,onClick:()=>void f("accept"),className:"rounded px-2 py-0.5 text-xs font-semibold",style:{background:g?"rgba(63,185,80,0.12)":"rgba(230,237,243,0.05)",border:`1px solid ${g?"rgba(63,185,80,0.3)":"rgba(230,237,243,0.1)"}`,color:g?"#3fb950":"rgba(230,237,243,0.3)"},children:"Send"}),w.jsx("button",{type:"button",disabled:s,onClick:()=>void f("decline"),className:"rounded px-2 py-0.5 text-xs",style:{border:"1px solid rgba(230,237,243,0.15)",color:"rgba(230,237,243,0.7)"},children:"Decline"})]})]})}const O5={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 B5(t){const e=t.indexOf("[");return e===-1?{headline:t.trim(),footnote:null}:{headline:t.slice(0,e).trim(),footnote:t.slice(e+1,t.lastIndexOf("]")!==-1?t.lastIndexOf("]"):void 0).trim()}}function j5(t){const e=t.behavior_bearing===0?"—":`${(t.coverage*100).toFixed(1)}%`,r=t.behavior_bearing===0?"":` · resolved ${(t.resolved_rate*100).toFixed(0)}%`;return`Coverage: ${e} · ${t.behavior_bearing.toLocaleString()} nodes · ${t.unaccounted} unaccounted${r}`}function Cb({runId:t,ord:e,prompt:r,repoRef:n,onResolved:i}){const s=ti(E=>E.clearGate),o=Kg(E=>E.record),[a,l]=J.useState(""),[u,c]=J.useState(!1),[d,g]=J.useState(null),[f,y]=J.useState(null);J.useEffect(()=>{n&&Ve.getCoverageReportForRepo(n).then(({report:E})=>{E&&y(E)}).catch(()=>{})},[n]);async function _(E,k){c(!0),g(null);try{await E(),o({runId:t,action:k.kind,...typeof e=="number"?{ord:e}:{},...k.amend!==void 0?{amend:k.amend}:{}}),s(t),i==null||i()}catch(L){g(L instanceof Error?L.message:String(L))}finally{c(!1)}}const v=()=>_(()=>Ve.confirmGate(t,{approve:!0}),{kind:"approve"}),m=()=>{const E=a.trim();if(!E)return Promise.resolve();const k={approve:!0,amend:E};return _(()=>Ve.confirmGate(t,k),{kind:"approve-with-steer",amend:E})},x=()=>_(()=>Ve.confirmGate(t,{approve:!1}),{kind:"reject"}),b=()=>_(()=>Ve.cancelRun(t),{kind:"cancel"}),{headline:S,footnote:T}=B5(r??"Prompt unavailable (daemon restarted) — you can still approve or reject."),N=S.toLowerCase().includes("not pass")||S.toLowerCase().includes("coverage");return w.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:[w.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[w.jsx("span",{className:"w-2 h-2 rounded-full animate-pulse",style:{background:"#ffda19"}}),w.jsx("p",{className:"font-semibold text-sm font-mono",style:{color:"#ffda19"},children:"Awaiting human decision"})]}),w.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}`:""]}),w.jsx("p",{className:"text-xs mb-1 leading-relaxed font-mono",style:{color:"rgba(230,237,243,0.85)"},"data-testid":"steering-prompt",children:S}),N&&f&&w.jsx("p",{className:"text-xs mb-2 font-mono",style:{color:"rgba(96,165,250,0.85)"},children:j5(f)}),T&&w.jsxs("details",{className:"mb-3",children:[w.jsx("summary",{className:"text-[10px] font-mono cursor-pointer select-none",style:{color:"rgba(230,237,243,0.3)"},children:"why this gate fired"}),w.jsx("p",{className:"text-[10px] font-mono mt-1 leading-relaxed",style:{color:"rgba(230,237,243,0.35)"},children:T})]}),w.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:N&&f&&f.unaccounted>0?`${f.unaccounted} nodes unaccounted — add guidance for the evaluator, e.g. "focus on services/ directory"`:"Optional steer — guide the next unit when approving with steer",value:a,onChange:E=>l(E.target.value),disabled:u}),d&&w.jsx("p",{className:"text-xs mb-3 font-mono",style:{color:"#f85149"},"data-testid":"steering-error",children:d}),w.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[w.jsx("button",{"data-testid":"steering-approve",onClick:()=>void v(),disabled:u,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"}),w.jsx("button",{"data-testid":"steering-approve-steer",onClick:()=>void m(),disabled:u||!a.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 + steer"}),w.jsx("button",{"data-testid":"steering-reject",onClick:()=>void x(),disabled:u,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"}),w.jsx("button",{"data-testid":"steering-cancel",onClick:()=>void b(),disabled:u,className:"rounded-lg px-3 py-2 text-xs font-semibold font-mono disabled:opacity-50 transition-opacity",style:{background:"rgba(139,148,158,0.12)",border:"1px solid rgba(139,148,158,0.25)",color:"rgba(139,148,158,0.9)"},children:"Cancel run"})]}),w.jsx("p",{className:"text-[10px] font-mono mt-2",style:{color:"rgba(230,237,243,0.25)"},children:"Workflow-declared gate — run-level human_confirm setting does not apply here."})]})}const D2={feature:"Feature (6 phases)",bug:"Bug (4 phases)",migration:"Migration (5 phases)"};function F5(t,e){const r=e.find(n=>n.id===t);return r?`${t.charAt(0).toUpperCase()}${t.slice(1)} (${r.phases.length} phases)`:D2[t]??t}function As({children:t}){return w.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 w.jsx("div",{style:{height:"1px",background:"rgba(230,237,243,0.07)"}})}function z5({roster:t,selectedClis:e,onToggleCli:r,confirmMode:n,onConfirmModeChange:i,beforeOrd:s,onBeforeOrdChange:o,entityMode:a,onEntityModeChange:l,workflows:u,workflow:c,onWorkflowChange:d,repos:g,repoRefs:f,onRepoRefsChange:y,attachedFiles:_,onFilesChange:v}){const m=J.useRef(null);function x(S){const T=Array.from(S.target.files??[]);v([..._,...T]),S.target.value=""}function b(S){v(_.filter((T,N)=>N!==S))}return w.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:[w.jsxs("div",{className:"px-4 py-3",children:[w.jsx(As,{children:"Upload files"}),w.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)…"}),w.jsx("input",{ref:m,type:"file",multiple:!0,className:"hidden",onChange:x,"aria-label":"Upload files for knowledge context"}),_.length>0&&w.jsx("div",{className:"flex flex-wrap gap-1.5 mt-2",children:_.map((S,T)=>w.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,w.jsx("button",{type:"button",onClick:()=>b(T),"aria-label":`Remove ${S.name}`,className:"opacity-60 hover:opacity-100 leading-none",children:"×"})]},T))})]}),w.jsx(Xo,{}),w.jsxs("div",{className:"px-4 py-3",children:[w.jsx(As,{children:"CLIs on/off"}),t.length===0?w.jsx("span",{style:{color:"rgba(230,237,243,0.3)"},children:"No roster loaded"}):w.jsx("div",{className:"flex flex-wrap gap-x-4 gap-y-1.5",children:t.map(S=>w.jsxs("label",{className:"flex items-center gap-1.5 cursor-pointer",style:{color:"rgba(230,237,243,0.65)"},children:[w.jsx("input",{type:"checkbox",checked:e.has(S.key),onChange:()=>r(S.key),"data-testid":`launch-seat-${S.key}`}),w.jsx("span",{children:S.key})]},S.key))})]}),w.jsx(Xo,{}),w.jsxs("div",{className:"px-4 py-3",children:[w.jsx(As,{children:"Set gate"}),w.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[w.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:[w.jsx("option",{value:"none",children:"None"}),w.jsx("option",{value:"all",children:"Every unit"}),w.jsx("option",{value:"before",children:"Before unit #"})]}),n==="before"&&w.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"}})]})]}),w.jsx(Xo,{}),w.jsxs("div",{className:"px-4 py-3",children:[w.jsx(As,{children:"Set mode"}),w.jsx("div",{className:"flex items-center gap-1.5",children:["shared","isolated"].map(S=>w.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))})]}),w.jsx(Xo,{}),w.jsxs("div",{className:"px-4 py-3",children:[w.jsx(As,{children:"Choose workflow"}),w.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=>d(S.target.value),children:[w.jsx("option",{value:"",children:"(free-text)"}),(u.length>0?u.map(S=>S.id):Object.keys(D2)).map(S=>w.jsx("option",{value:S,children:F5(S,u)},S))]})]}),w.jsx(Xo,{}),w.jsxs("div",{className:"px-4 py-3",children:[w.jsx(As,{children:"Add repos"}),g.length===0?w.jsx("p",{className:"text-[11px] font-mono italic",style:{color:"rgba(230,237,243,0.3)"},children:"No repos registered."}):w.jsx("div",{className:"flex flex-col gap-1.5 max-h-36 overflow-y-auto pr-1",children:g.map(S=>{const T=f.includes(S.id);return w.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:[w.jsx("input",{type:"checkbox","data-testid":`launch-repo-${S.id}`,checked:T,onChange:()=>{y(T?f.filter(N=>N!==S.id):[...f,S.id])},className:"accent-[#ffda19] w-3.5 h-3.5 shrink-0"}),w.jsx("span",{className:"text-[11px] font-mono truncate",style:{color:"#e6edf3"},children:S.name})]},S.id)})})]})]})}const H5=new Set(["executing","distributing","planning"]);function U5(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 $5({label:t,onClear:e}){return w.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,w.jsx("button",{type:"button",onClick:e,"aria-label":`Clear ${t}`,className:"opacity-60 hover:opacity-100 leading-none ml-0.5",children:"×"})]})}const W5=new Set(["chat","onboarding","survey-repo","domain-graph-slice","memories"]);function A2({runId:t,runStatus:e,onLaunched:r,embedded:n,workflowOverride:i,mode:s,injectTarget:o,onClearInjectTarget:a}){const l=ti(de=>de.clearGate),[u,c]=J.useState(""),[d,g]=J.useState(!1),[f,y]=J.useState(null),_=J.useRef(null),[v,m]=J.useState(""),[x,b]=J.useState(!1),[S,T]=J.useState(null),N=J.useRef(!1),[E,k]=J.useState(""),[L,A]=J.useState(""),[I,O]=J.useState([]),[B,D]=J.useState([]),M=J.useMemo(()=>B.filter(de=>!de.is_system&&!W5.has(de.id)),[B]),[U,H]=J.useState(new Set),[$,F]=J.useState([]),[P,z]=J.useState([]),[G,V]=J.useState("shared"),[te,ie]=J.useState("none"),[ne,X]=J.useState(1),[q,Y]=J.useState([]),[K,ee]=J.useState(!1),[re,ue]=J.useState(0),[pe,Re]=J.useState(null),[Be,_e]=J.useState(null),[Te,Le]=J.useState(!1),[Ee,Pe]=J.useState(!1),ze=J.useRef(null),Me=J.useRef(null),Ue=J.useRef(null);J.useEffect(()=>{Ve.getRoster().then(({roster:de})=>{O(de);try{const oe=localStorage.getItem("wicked_default_clis");if(oe){H(new Set(JSON.parse(oe)));return}}catch{}H(new Set(de.filter(oe=>oe.enabled_for_council).map(oe=>oe.key)))}).catch(()=>{}),Ve.listRepos().then(({repos:de})=>F(de)).catch(()=>{}),Ve.listWorkflows().then(({workflows:de})=>D(de)).catch(()=>{})},[]),J.useEffect(()=>(K?(ue(0),Me.current=setInterval(()=>ue(de=>de+1),1e3)):(Me.current!==null&&(clearInterval(Me.current),Me.current=null),ue(0)),()=>{Me.current!==null&&(clearInterval(Me.current),Me.current=null)}),[K]),J.useEffect(()=>{const de=Ue.current;if(!de)return;de.style.height="auto";const oe=100;de.style.height=`${Math.min(de.scrollHeight,oe)}px`},[E]),J.useEffect(()=>{if(!E.trim()||L||i){_e(null);return}_e(U5(E))},[E,L,i]),J.useEffect(()=>{if(!Ee)return;function de(oe){ze.current&&!ze.current.contains(oe.target)&&Pe(!1)}return document.addEventListener("click",de),()=>document.removeEventListener("click",de)},[Ee]),J.useEffect(()=>{if(!Ee)return;function de(oe){oe.key==="Escape"&&Pe(!1)}return document.addEventListener("keydown",de),()=>document.removeEventListener("keydown",de)},[Ee]);function Ge(de){H(oe=>{const ye=new Set(oe);return ye.has(de)?ye.delete(de):ye.add(de),ye})}function ve(){H(new Set(I.filter(de=>de.enabled_for_council).map(de=>de.key)))}async function Ce(){if(!E.trim()||U.size===0||K)return;ee(!0),Re(null);const de={problem:E.trim()},oe=I.filter(ke=>U.has(ke.key));oe.length>0&&(de.clisJson=JSON.stringify(oe)),de.entityMode=G,s==="ask"?de.humanConfirm="all":s!=="autonomous"&&(te==="all"?de.humanConfirm="all":te==="before"&&(de.humanConfirm=`before:${ne}`));const ye=P[0];ye&&(de.repoRef=ye);const Se=(i==null?void 0:i.trim())||L;Se&&(de.workflow=Se);try{const{runId:ke}=await Ve.launchRun(de);k(""),r(ke)}catch(ke){Re(ke instanceof Error?ke.message:String(ke))}finally{ee(!1)}}async function Ie(){const de=u.trim();if(!(!de||!t)){g(!0),y(null);try{await Ve.confirmGate(t,{approve:!0,amend:de}),c(""),l(t)}catch(oe){y(oe instanceof Error?oe.message:String(oe))}finally{g(!1)}}}async function me(){const de=v.trim();if(!de||!t||N.current)return;N.current=!0,b(!0),T(null);const oe=(o==null?void 0:o.trim())||"all";try{await Ve.injectMessage(t,de,oe),m("")}catch(ye){T(ye instanceof Error?ye.message:String(ye))}finally{N.current=!1,b(!1)}}if(t){if(e==="awaiting_human"){const de=u.trim().length>0&&!d;return w.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:[f&&w.jsx("p",{className:"text-[11px] font-mono",style:{color:"#f85149"},children:f}),w.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:[w.jsx("textarea",{ref:_,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:oe=>c(oe.target.value),onKeyDown:oe=>{oe.key==="Enter"&&(oe.metaKey||oe.ctrlKey)&&(oe.preventDefault(),Ie())},disabled:d,rows:1}),w.jsx("button",{type:"button",onClick:()=>void Ie(),disabled:!de,className:"shrink-0 rounded-xl px-4 py-2 text-sm font-semibold transition-opacity disabled:opacity-40",style:{background:"#ffda19",color:"#0d1117"},children:d?"…":"Steer →"})]}),w.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&&H5.has(e)){const de=v.trim().length>0&&!x,oe=(o==null?void 0:o.trim())||"all",ye=oe!=="all",Se=ye?oe:"all agents";return w.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&&w.jsx("p",{className:"text-[11px] font-mono",style:{color:"#f85149"},children:S}),w.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:[w.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 ${Se}…`,value:v,onChange:ke=>m(ke.target.value),onKeyDown:ke=>{ke.key==="Enter"&&(ke.metaKey||ke.ctrlKey)&&(ke.preventDefault(),me())},disabled:x,rows:1}),w.jsx("button",{type:"button",onClick:()=>void me(),disabled:!de,className:"shrink-0 rounded-xl px-4 py-2 text-sm font-semibold transition-opacity disabled:opacity-40",style:{background:"#ffda19",color:"#0d1117"},children:x?"…":"Send →"})]}),w.jsxs("div",{className:"flex items-center gap-2",children:[w.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"}),ye&&w.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:["→ ",oe,a&&w.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 w.jsx("div",{className:"px-5 py-4 shrink-0",style:{borderTop:"1px solid rgba(230,237,243,0.07)",background:"#161c26"},children:w.jsx("div",{className:"rounded-2xl px-5 py-4",style:{border:"1px solid rgba(230,237,243,0.1)",background:"#1b222e"},children:w.jsx("p",{className:"text-sm italic font-mono",style:{color:"rgba(230,237,243,0.35)"},children:"Steer at the next gate."})})})}const Z=E.trim().length>0&&U.size>0&&!K,he=Be!==null&&!Te&&!L&&!i,ae=new Set(I.filter(de=>de.enabled_for_council).map(de=>de.key)),se=U.size!==ae.size||[...U].some(de=>!ae.has(de)),ce=[];q.length>0&&ce.push({label:`${q.length} file${q.length!==1?"s":""} attached`,onClear:()=>Y([])}),te!=="none"&&ce.push({label:te==="all"?"Gate: every unit":`Gate: before #${ne}`,onClear:()=>ie("none")}),G==="isolated"&&ce.push({label:"Mode: isolated",onClear:()=>V("shared")}),L&&ce.push({label:`Workflow: ${L}`,onClear:()=>{A(""),Le(!0)}});for(const de of P){const oe=$.find(ye=>ye.id===de);ce.push({label:`Repo: ${(oe==null?void 0:oe.name)??de}`,onClear:()=>z(ye=>ye.filter(Se=>Se!==de))})}return se&&I.length>0&&ce.push({label:`CLIs: ${[...U].join(", ")}`,onClear:ve}),w.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:[he&&w.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:[w.jsxs("span",{children:["Detected: ",w.jsx("strong",{style:{color:"#ffda19"},children:Be})," workflow"]}),w.jsx("button",{type:"button",onClick:()=>{A(Be),Le(!0)},className:"rounded-lg px-3 py-1 font-semibold text-xs",style:{background:"#ffda19",color:"#0d1117"},children:"Apply"}),w.jsx("button",{type:"button",onClick:()=>Le(!0),className:"ml-auto",style:{color:"rgba(230,237,243,0.35)"},children:"✕"})]}),w.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:[w.jsxs("div",{className:"relative shrink-0",ref:ze,children:[Ee&&w.jsx("div",{style:{position:"absolute",bottom:"calc(100% + 10px)",left:0,zIndex:50},children:w.jsx(z5,{roster:I,selectedClis:U,onToggleCli:Ge,confirmMode:te,onConfirmModeChange:ie,beforeOrd:ne,onBeforeOrdChange:X,entityMode:G,onEntityModeChange:V,workflows:M,workflow:L,onWorkflowChange:de=>{A(de),Le(!0)},repos:$,repoRefs:P,onRepoRefsChange:z,attachedFiles:q,onFilesChange:Y})}),w.jsx("button",{type:"button","aria-label":"Open launch options","aria-expanded":Ee,"aria-haspopup":"dialog",onClick:()=>Pe(de=>!de),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:"+"})]}),w.jsx("textarea",{ref:Ue,"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:E,onChange:de=>{k(de.target.value),Le(!1)},onKeyDown:de=>{de.key==="Enter"&&(de.metaKey||de.ctrlKey)&&(de.preventDefault(),Ce())},disabled:K,rows:1}),w.jsx("button",{type:"button","data-testid":"launch-submit",onClick:()=>void Ce(),disabled:!Z,"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:K?`${re}s`:"Send"})]}),ce.length>0&&w.jsx("div",{className:"flex flex-wrap gap-1.5 px-1",children:ce.map((de,oe)=>w.jsx($5,{label:de.label,onClear:de.onClear},oe))}),pe&&w.jsx("p",{className:"text-xs px-1 font-mono",style:{color:"#f85149"},"data-testid":"launch-error",children:pe}),K&&re>=5&&w.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 V5({terminalId:t,cliKey:e,onClose:r}){const n=J.useRef(null),i=J.useRef(t);return i.current=t,J.useEffect(()=>{const s=n.current;if(!s)return;let o=!1;const a=new N2.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 R2.FitAddon;a.loadAddon(l),a.open(s);try{l.fit()}catch{}const u=new WebSocket(Sw(i.current));u.binaryType="arraybuffer",u.onmessage=d=>{typeof d.data=="string"?a.write(d.data):a.write(new Uint8Array(d.data))},u.onerror=()=>{o||a.write(`\r
|
|
388
|
-
\x1B[31m[terminal connection error]\x1B[0m\r
|
|
389
|
-
`)},u.onclose=()=>{o||a.write(`\r
|
|
390
|
-
\x1B[90m[agent session ended]\x1B[0m\r
|
|
391
|
-
`)};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]),w.jsxs("div",{className:"flex flex-col rounded-xl overflow-hidden",style:{background:"#0d1117",border:"1px solid rgba(230,237,243,0.08)"},children:[w.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:[w.jsxs("span",{className:"text-[11px] font-mono font-semibold",style:{color:"rgba(230,237,243,0.5)"},children:[e," ",w.jsx("span",{style:{color:"rgba(230,237,243,0.3)",fontWeight:400},children:"· observer"})]}),w.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:"×"})]}),w.jsx("div",{ref:n,className:"h-56 w-full overflow-hidden p-1"})]})}function G5(t,e){const r={};return(t[t.length-1]===""?[...t,""]:t).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const q5=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Y5=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,K5={};function kb(t,e){return(K5.jsx?Y5:q5).test(t)}const X5=/[ \t\n\f\r]/g;function Q5(t){return typeof t=="object"?t.type==="text"?Eb(t.value):!1:Eb(t)}function Eb(t){return t.replace(X5,"")===""}class Bl{constructor(e,r,n){this.normal=r,this.property=e,n&&(this.space=n)}}Bl.prototype.normal={};Bl.prototype.property={};Bl.prototype.space=void 0;function P2(t,e){const r={},n={};for(const i of t)Object.assign(r,i.property),Object.assign(n,i.normal);return new Bl(r,n,e)}function Bg(t){return t.toLowerCase()}class cn{constructor(e,r){this.attribute=r,this.property=e}}cn.prototype.attribute="";cn.prototype.booleanish=!1;cn.prototype.boolean=!1;cn.prototype.commaOrSpaceSeparated=!1;cn.prototype.commaSeparated=!1;cn.prototype.defined=!1;cn.prototype.mustUseProperty=!1;cn.prototype.number=!1;cn.prototype.overloadedBoolean=!1;cn.prototype.property="";cn.prototype.spaceSeparated=!1;cn.prototype.space=void 0;let Z5=0;const xt=Qa(),vr=Qa(),jg=Qa(),$e=Qa(),Vt=Qa(),Ua=Qa(),gn=Qa();function Qa(){return 2**++Z5}const Fg=Object.freeze(Object.defineProperty({__proto__:null,boolean:xt,booleanish:vr,commaOrSpaceSeparated:gn,commaSeparated:Ua,number:$e,overloadedBoolean:jg,spaceSeparated:Vt},Symbol.toStringTag,{value:"Module"})),Gp=Object.keys(Fg);class Tv extends cn{constructor(e,r,n,i){let s=-1;if(super(e,r),Tb(this,"space",i),typeof n=="number")for(;++s<Gp.length;){const o=Gp[s];Tb(this,Gp[s],(n&Fg[o])===Fg[o])}}}Tv.prototype.defined=!0;function Tb(t,e,r){r&&(t[e]=r)}function no(t){const e={},r={};for(const[n,i]of Object.entries(t.properties)){const s=new Tv(n,t.transform(t.attributes||{},n),i,t.space);t.mustUseProperty&&t.mustUseProperty.includes(n)&&(s.mustUseProperty=!0),e[n]=s,r[Bg(n)]=n,r[Bg(s.attribute)]=n}return new Bl(e,r,t.space)}const M2=no({properties:{ariaActiveDescendant:null,ariaAtomic:vr,ariaAutoComplete:null,ariaBusy:vr,ariaChecked:vr,ariaColCount:$e,ariaColIndex:$e,ariaColSpan:$e,ariaControls:Vt,ariaCurrent:null,ariaDescribedBy:Vt,ariaDetails:null,ariaDisabled:vr,ariaDropEffect:Vt,ariaErrorMessage:null,ariaExpanded:vr,ariaFlowTo:Vt,ariaGrabbed:vr,ariaHasPopup:null,ariaHidden:vr,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Vt,ariaLevel:$e,ariaLive:null,ariaModal:vr,ariaMultiLine:vr,ariaMultiSelectable:vr,ariaOrientation:null,ariaOwns:Vt,ariaPlaceholder:null,ariaPosInSet:$e,ariaPressed:vr,ariaReadOnly:vr,ariaRelevant:null,ariaRequired:vr,ariaRoleDescription:Vt,ariaRowCount:$e,ariaRowIndex:$e,ariaRowSpan:$e,ariaSelected:vr,ariaSetSize:$e,ariaSort:null,ariaValueMax:$e,ariaValueMin:$e,ariaValueNow:$e,ariaValueText:null,role:null},transform(t,e){return e==="role"?e:"aria-"+e.slice(4).toLowerCase()}});function I2(t,e){return e in t?t[e]:e}function O2(t,e){return I2(t,e.toLowerCase())}const J5=no({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Ua,acceptCharset:Vt,accessKey:Vt,action:null,allow:null,allowFullScreen:xt,allowPaymentRequest:xt,allowUserMedia:xt,alpha:xt,alt:null,as:null,async:xt,autoCapitalize:null,autoComplete:Vt,autoFocus:xt,autoPlay:xt,blocking:Vt,capture:null,charSet:null,checked:xt,cite:null,className:Vt,closedBy:null,colorSpace:null,cols:$e,colSpan:$e,command:null,commandFor:null,content:null,contentEditable:vr,controls:xt,controlsList:Vt,coords:$e|Ua,crossOrigin:null,data:null,dateTime:null,decoding:null,default:xt,defer:xt,dir:null,dirName:null,disabled:xt,download:jg,draggable:vr,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:xt,formTarget:null,headers:Vt,height:$e,hidden:jg,high:$e,href:null,hrefLang:null,htmlFor:Vt,httpEquiv:Vt,id:null,imageSizes:null,imageSrcSet:null,inert:xt,inputMode:null,integrity:null,is:null,isMap:xt,itemId:null,itemProp:Vt,itemRef:Vt,itemScope:xt,itemType:Vt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:xt,low:$e,manifest:null,max:null,maxLength:$e,media:null,method:null,min:null,minLength:$e,multiple:xt,muted:xt,name:null,nonce:null,noModule:xt,noValidate:xt,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:xt,optimum:$e,pattern:null,ping:Vt,placeholder:null,playsInline:xt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:xt,referrerPolicy:null,rel:Vt,required:xt,reversed:xt,rows:$e,rowSpan:$e,sandbox:Vt,scope:null,scoped:xt,seamless:xt,selected:xt,shadowRootClonable:xt,shadowRootCustomElementRegistry:xt,shadowRootDelegatesFocus:xt,shadowRootMode:null,shadowRootSerializable:xt,shape:null,size:$e,sizes:null,slot:null,span:$e,spellCheck:vr,src:null,srcDoc:null,srcLang:null,srcSet:null,start:$e,step:null,style:null,tabIndex:$e,target:null,title:null,translate:null,type:null,typeMustMatch:xt,useMap:null,value:vr,width:$e,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Vt,axis:null,background:null,bgColor:null,border:$e,borderColor:null,bottomMargin:$e,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:xt,declare:xt,event:null,face:null,frame:null,frameBorder:null,hSpace:$e,leftMargin:$e,link:null,longDesc:null,lowSrc:null,marginHeight:$e,marginWidth:$e,noResize:xt,noHref:xt,noShade:xt,noWrap:xt,object:null,profile:null,prompt:null,rev:null,rightMargin:$e,rules:null,scheme:null,scrolling:vr,standby:null,summary:null,text:null,topMargin:$e,valueType:null,version:null,vAlign:null,vLink:null,vSpace:$e,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:xt,disablePictureInPicture:xt,disableRemotePlayback:xt,exportParts:Ua,part:Vt,prefix:null,property:null,results:$e,security:null,unselectable:null},space:"html",transform:O2}),e4=no({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:$e,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:$e,amplitude:$e,arabicForm:null,ascent:$e,attributeName:null,attributeType:null,azimuth:$e,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:$e,by:null,calcMode:null,capHeight:$e,className:Vt,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:$e,diffuseConstant:$e,direction:null,display:null,dur:null,divisor:$e,dominantBaseline:null,download:xt,dx:null,dy:null,edgeMode:null,editable:null,elevation:$e,enableBackground:null,end:null,event:null,exponent:$e,externalResourcesRequired:null,fill:null,fillOpacity:$e,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:Ua,g2:Ua,glyphName:Ua,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:$e,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:$e,horizOriginX:$e,horizOriginY:$e,id:null,ideographic:$e,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:$e,k:$e,k1:$e,k2:$e,k3:$e,k4:$e,kernelMatrix:gn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:$e,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:$e,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:$e,overlineThickness:$e,paintOrder:null,panose1:null,path:null,pathLength:$e,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Vt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:$e,pointsAtY:$e,pointsAtZ:$e,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:$e,specularExponent:$e,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:$e,strikethroughThickness:$e,string:null,stroke:null,strokeDashArray:gn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:$e,strokeOpacity:$e,strokeWidth:null,style:null,surfaceScale:$e,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:gn,tabIndex:$e,tableValues:null,target:null,targetX:$e,targetY:$e,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:$e,underlineThickness:$e,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:$e,values:null,vAlphabetic:$e,vMathematical:$e,vectorEffect:null,vHanging:$e,vIdeographic:$e,version:null,vertAdvY:$e,vertOriginX:$e,vertOriginY:$e,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:$e,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:I2}),B2=no({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()}}),j2=no({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:O2}),F2=no({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(t,e){return"xml:"+e.slice(3).toLowerCase()}}),t4={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"},r4=/[A-Z]/g,Nb=/-[a-z]/g,n4=/^data[-\w.:]+$/i;function i4(t,e){const r=Bg(e);let n=e,i=cn;if(r in t.normal)return t.property[t.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&n4.test(e)){if(e.charAt(4)==="-"){const s=e.slice(5).replace(Nb,s4);n="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=e.slice(4);if(!Nb.test(s)){let o=s.replace(r4,a4);o.charAt(0)!=="-"&&(o="-"+o),e="data"+o}}i=Tv}return new i(n,e)}function a4(t){return"-"+t.toLowerCase()}function s4(t){return t.charAt(1).toUpperCase()}const o4=P2([M2,J5,B2,j2,F2],"html"),Nv=P2([M2,e4,B2,j2,F2],"svg");function l4(t){return t.join(" ").trim()}var Ps={},qp,Rb;function u4(){if(Rb)return qp;Rb=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=`
|
|
392
|
-
`,u="/",c="*",d="",g="comment",f="declaration";function y(v,m){if(typeof v!="string")throw new TypeError("First argument must be a string");if(!v)return[];m=m||{};var x=1,b=1;function S(D){var M=D.match(e);M&&(x+=M.length);var U=D.lastIndexOf(l);b=~U?D.length-U:b+D.length}function T(){var D={line:x,column:b};return function(M){return M.position=new N(D),L(),M}}function N(D){this.start=D,this.end={line:x,column:b},this.source=m.source}N.prototype.content=v;function E(D){var M=new Error(m.source+":"+x+":"+b+": "+D);if(M.reason=D,M.filename=m.source,M.line=x,M.column=b,M.source=v,!m.silent)throw M}function k(D){var M=D.exec(v);if(M){var U=M[0];return S(U),v=v.slice(U.length),M}}function L(){k(r)}function A(D){var M;for(D=D||[];M=I();)M!==!1&&D.push(M);return D}function I(){var D=T();if(!(u!=v.charAt(0)||c!=v.charAt(1))){for(var M=2;d!=v.charAt(M)&&(c!=v.charAt(M)||u!=v.charAt(M+1));)++M;if(M+=2,d===v.charAt(M-1))return E("End of comment missing");var U=v.slice(2,M-2);return b+=2,S(U),v=v.slice(M),b+=2,D({type:g,comment:U})}}function O(){var D=T(),M=k(n);if(M){if(I(),!k(i))return E("property missing ':'");var U=k(s),H=D({type:f,property:_(M[0].replace(t,d)),value:U?_(U[0].replace(t,d)):d});return k(o),H}}function B(){var D=[];A(D);for(var M;M=O();)M!==!1&&(D.push(M),A(D));return D}return L(),B()}function _(v){return v?v.replace(a,d):d}return qp=y,qp}var Lb;function c4(){if(Lb)return Ps;Lb=1;var t=Ps&&Ps.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(Ps,"__esModule",{value:!0}),Ps.default=r;const e=t(u4());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 Ps}var Qo={},Db;function d4(){if(Db)return Qo;Db=1,Object.defineProperty(Qo,"__esModule",{value:!0}),Qo.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 Qo.camelCase=l,Qo}var Zo,Ab;function h4(){if(Ab)return Zo;Ab=1;var t=Zo&&Zo.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},e=t(c4()),r=d4();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,Zo=n,Zo}var f4=h4();const p4=Kc(f4),z2=H2("end"),Rv=H2("start");function H2(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 g4(t){const e=Rv(t),r=z2(t);if(e&&r)return{start:e,end:r}}function ll(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?Pb(t.position):"start"in t||"end"in t?Pb(t):"line"in t||"column"in t?zg(t):""}function zg(t){return Mb(t&&t.line)+":"+Mb(t&&t.column)}function Pb(t){return zg(t&&t.start)+"-"+zg(t&&t.end)}function Mb(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=ll(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 Lv={}.hasOwnProperty,v4=new Map,m4=/[A-Z]/g,y4=new Set(["table","tbody","thead","tfoot","tr"]),x4=new Set(["td","th"]),U2="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function b4(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=N4(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=T4(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"?Nv:o4,stylePropertyNameCase:e.stylePropertyNameCase||"dom",tableCellAlignToStyle:e.tableCellAlignToStyle!==!1},s=$2(i,t,void 0);return s&&typeof s!="string"?s:i.create(t,i.Fragment,{children:s||void 0},void 0)}function $2(t,e,r){if(e.type==="element")return w4(t,e,r);if(e.type==="mdxFlowExpression"||e.type==="mdxTextExpression")return _4(t,e);if(e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement")return C4(t,e,r);if(e.type==="mdxjsEsm")return S4(t,e);if(e.type==="root")return k4(t,e,r);if(e.type==="text")return E4(t,e)}function w4(t,e,r){const n=t.schema;let i=n;e.tagName.toLowerCase()==="svg"&&n.space==="html"&&(i=Nv,t.schema=i),t.ancestors.push(e);const s=V2(t,e.tagName,!1),o=R4(t,e);let a=Av(t,e);return y4.has(e.tagName)&&(a=a.filter(function(l){return typeof l=="string"?!Q5(l):!0})),W2(t,o,s,e),Dv(o,a),t.ancestors.pop(),t.schema=n,t.create(e,s,o,r)}function _4(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)}Sl(t,e.position)}function S4(t,e){if(e.data&&e.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(e.data.estree);Sl(t,e.position)}function C4(t,e,r){const n=t.schema;let i=n;e.name==="svg"&&n.space==="html"&&(i=Nv,t.schema=i),t.ancestors.push(e);const s=e.name===null?t.Fragment:V2(t,e.name,!0),o=L4(t,e),a=Av(t,e);return W2(t,o,s,e),Dv(o,a),t.ancestors.pop(),t.schema=n,t.create(e,s,o,r)}function k4(t,e,r){const n={};return Dv(n,Av(t,e)),t.create(e,t.Fragment,n,r)}function E4(t,e){return e.value}function W2(t,e,r,n){typeof r!="string"&&r!==t.Fragment&&t.passNode&&(e.node=n)}function Dv(t,e){if(e.length>0){const r=e.length>1?e:e[0];r&&(t.children=r)}}function T4(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 N4(t,e){return r;function r(n,i,s,o){const a=Array.isArray(s.children),l=Rv(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 R4(t,e){const r={};let n,i;for(i in e.properties)if(i!=="children"&&Lv.call(e.properties,i)){const s=D4(t,i,e.properties[i]);if(s){const[o,a]=s;t.tableCellAlignToStyle&&o==="align"&&typeof a=="string"&&x4.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 L4(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 Sl(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 Sl(t,e.position);else s=n.value===null?!0:n.value;r[i]=s}return r}function Av(t,e){const r=[];let n=-1;const i=t.passKeys?new Map:v4;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=$2(t,s,o);a!==void 0&&r.push(a)}return r}function D4(t,e,r){const n=i4(t.schema,e);if(!(r==null||typeof r=="number"&&Number.isNaN(r))){if(Array.isArray(r)&&(r=n.commaSeparated?G5(r):l4(r)),n.property==="style"){let i=typeof r=="object"?r:A4(t,String(r));return t.stylePropertyNameCase==="css"&&(i=P4(i)),["style",i]}return[t.elementAttributeNameCase==="react"&&n.space?t4[n.property]||n.property:n.attribute,r]}}function A4(t,e){try{return p4(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=U2+"#cannot-parse-style-attribute",i}}function V2(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=kb(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=kb(e)&&!/^[a-z]/.test(e)?{type:"Identifier",name:e}:{type:"Literal",value:e};if(n.type==="Literal"){const i=n.value;return Lv.call(t.components,i)?t.components[i]:i}if(t.evaluater)return t.evaluater.evaluateExpression(n);Sl(t)}function Sl(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=U2+"#cannot-handle-mdx-estrees-without-createevaluater",r}function P4(t){const e={};let r;for(r in t)Lv.call(t,r)&&(e[M4(r)]=t[r]);return e}function M4(t){let e=t.replace(m4,I4);return e.slice(0,3)==="ms-"&&(e="-"+e),e}function I4(t){return"-"+t.toLowerCase()}const Yp={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"]},O4={};function Pv(t,e){const r=O4,n=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,i=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return G2(t,n,i)}function G2(t,e,r){if(B4(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 Ib(t.children,e,r)}return Array.isArray(t)?Ib(t,e,r):""}function Ib(t,e,r){const n=[];let i=-1;for(;++i<t.length;)n[i]=G2(t[i],e,r);return n.join("")}function B4(t){return!!(t&&typeof t=="object")}const Ob=document.createElement("i");function Mv(t){const e="&"+t+";";Ob.innerHTML=e;const r=Ob.textContent;return r.charCodeAt(r.length-1)===59&&t!=="semi"||r===e?!1:r}function yn(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 Nn(t,e){return t.length>0?(yn(t,t.length,0,e),t):e}const Bb={}.hasOwnProperty;function q2(t){const e={};let r=-1;for(;++r<t.length;)j4(e,t[r]);return e}function j4(t,e){let r;for(r in e){const i=(Bb.call(t,r)?t[r]:void 0)||(t[r]={}),s=e[r];let o;if(s)for(o in s){Bb.call(i,o)||(i[o]=[]);const a=s[o];F4(i[o],Array.isArray(a)?a:a?[a]:[])}}}function F4(t,e){let r=-1;const n=[];for(;++r<e.length;)(e[r].add==="after"?t:n).push(e[r]);yn(t,0,0,n)}function Y2(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 Qr=fa(/[A-Za-z]/),Hr=fa(/[\dA-Za-z]/),z4=fa(/[#-'*+\--9=?A-Z^-~]/);function Vc(t){return t!==null&&(t<32||t===127)}const Hg=fa(/\d/),H4=fa(/[\dA-Fa-f]/),U4=fa(/[!-/:-@[-`{-~]/);function gt(t){return t!==null&&t<-2}function qt(t){return t!==null&&(t<0||t===32)}function kt(t){return t===-2||t===-1||t===32}const gd=fa(new RegExp("\\p{P}|\\p{S}","u")),Ya=fa(/\s/);function fa(t){return e;function e(r){return r!==null&&r>-1&&t.test(String.fromCharCode(r))}}function io(t){const e=[];let r=-1,n=0,i=0;for(;++r<t.length;){const s=t.charCodeAt(r);let o="";if(s===37&&Hr(t.charCodeAt(r+1))&&Hr(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 Lt(t,e,r,n){const i=n?n-1:Number.POSITIVE_INFINITY;let s=0;return o;function o(l){return kt(l)?(t.enter(r),a(l)):e(l)}function a(l){return kt(l)&&s++<i?(t.consume(l),a):(t.exit(r),e(l))}}const $4={tokenize:W4};function W4(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"),Lt(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 gt(a)?(t.consume(a),t.exit("chunkText"),s):(t.consume(a),o)}}const V4={tokenize:G4},jb={tokenize:q4};function G4(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&&x();const S=e.events.length;let T=S,N;for(;T--;)if(e.events[T][0]==="exit"&&e.events[T][1].type==="chunkFlow"){N=e.events[T][1].end;break}m(n);let E=S;for(;E<e.events.length;)e.events[E][1].end={...N},E++;return yn(e.events,T+1,0,e.events.slice(S)),e.events.length=E,u(b)}return a(b)}function u(b){if(n===r.length){if(!i)return g(b);if(i.currentConstruct&&i.currentConstruct.concrete)return y(b);e.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return e.containerState={},t.check(jb,c,d)(b)}function c(b){return i&&x(),m(n),g(b)}function d(b){return e.parser.lazy[e.now().line]=n!==r.length,o=e.now().offset,y(b)}function g(b){return e.containerState={},t.attempt(jb,f,y)(b)}function f(b){return n++,r.push([e.currentConstruct,e.containerState]),g(b)}function y(b){if(b===null){i&&x(),m(0),t.consume(b);return}return i=i||e.parser.flow(e.now()),t.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:s}),_(b)}function _(b){if(b===null){v(t.exit("chunkFlow"),!0),m(0),t.consume(b);return}return gt(b)?(t.consume(b),v(t.exit("chunkFlow")),n=0,e.interrupt=void 0,a):(t.consume(b),_)}function v(b,S){const T=e.sliceStream(b);if(S&&T.push(null),b.previous=s,s&&(s.next=b),s=b,i.defineSkip(b.start),i.write(T),e.parser.lazy[b.start.line]){let N=i.events.length;for(;N--;)if(i.events[N][1].start.offset<o&&(!i.events[N][1].end||i.events[N][1].end.offset>o))return;const E=e.events.length;let k=E,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),N=E;N<e.events.length;)e.events[N][1].end={...A},N++;yn(e.events,k+1,0,e.events.slice(E)),e.events.length=N}}function m(b){let S=r.length;for(;S-- >b;){const T=r[S];e.containerState=T[1],T[0].exit.call(e,t)}r.length=b}function x(){i.write([null]),s=void 0,i=void 0,e.containerState._closeFlow=void 0}}function q4(t,e,r){return Lt(t,t.attempt(this.parser.constructs.document,e,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Xs(t){if(t===null||qt(t)||Ya(t))return 1;if(gd(t))return 2}function vd(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 Ug={name:"attention",resolveAll:Y4,tokenize:K4};function Y4(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 d={...t[n][1].end},g={...t[r][1].start};Fb(d,-l),Fb(g,l),o={type:l>1?"strongSequence":"emphasisSequence",start:d,end:{...t[n][1].end}},a={type:l>1?"strongSequence":"emphasisSequence",start:{...t[r][1].start},end:g},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=Nn(u,[["enter",t[n][1],e],["exit",t[n][1],e]])),u=Nn(u,[["enter",i,e],["enter",o,e],["exit",o,e],["enter",s,e]]),u=Nn(u,vd(e.parser.constructs.insideSpan.null,t.slice(n+1,r),e)),u=Nn(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=Nn(u,[["enter",t[r][1],e],["exit",t[r][1],e]])):c=0,yn(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 K4(t,e){const r=this.parser.constructs.attentionMarkers.null,n=this.previous,i=Xs(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=Xs(l),d=!c||c===2&&i||r.includes(l),g=!i||i===2&&c||r.includes(n);return u._open=!!(s===42?d:d&&(i||!g)),u._close=!!(s===42?g:g&&(c||!d)),e(l)}}function Fb(t,e){t.column+=e,t.offset+=e,t._bufferIndex+=e}const X4={name:"autolink",tokenize:Q4};function Q4(t,e,r){let n=0;return i;function i(f){return t.enter("autolink"),t.enter("autolinkMarker"),t.consume(f),t.exit("autolinkMarker"),t.enter("autolinkProtocol"),s}function s(f){return Qr(f)?(t.consume(f),o):f===64?r(f):u(f)}function o(f){return f===43||f===45||f===46||Hr(f)?(n=1,a(f)):u(f)}function a(f){return f===58?(t.consume(f),n=0,l):(f===43||f===45||f===46||Hr(f))&&n++<32?(t.consume(f),a):(n=0,u(f))}function l(f){return f===62?(t.exit("autolinkProtocol"),t.enter("autolinkMarker"),t.consume(f),t.exit("autolinkMarker"),t.exit("autolink"),e):f===null||f===32||f===60||Vc(f)?r(f):(t.consume(f),l)}function u(f){return f===64?(t.consume(f),c):z4(f)?(t.consume(f),u):r(f)}function c(f){return Hr(f)?d(f):r(f)}function d(f){return f===46?(t.consume(f),n=0,c):f===62?(t.exit("autolinkProtocol").type="autolinkEmail",t.enter("autolinkMarker"),t.consume(f),t.exit("autolinkMarker"),t.exit("autolink"),e):g(f)}function g(f){if((f===45||Hr(f))&&n++<63){const y=f===45?g:d;return t.consume(f),y}return r(f)}}const jl={partial:!0,tokenize:Z4};function Z4(t,e,r){return n;function n(s){return kt(s)?Lt(t,i,"linePrefix")(s):i(s)}function i(s){return s===null||gt(s)?e(s):r(s)}}const K2={continuation:{tokenize:eP},exit:tP,name:"blockQuote",tokenize:J4};function J4(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 kt(o)?(t.enter("blockQuotePrefixWhitespace"),t.consume(o),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),e):(t.exit("blockQuotePrefix"),e(o))}}function eP(t,e,r){const n=this;return i;function i(o){return kt(o)?Lt(t,s,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):s(o)}function s(o){return t.attempt(K2,e,r)(o)}}function tP(t){t.exit("blockQuote")}const X2={name:"characterEscape",tokenize:rP};function rP(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 U4(s)?(t.enter("characterEscapeValue"),t.consume(s),t.exit("characterEscapeValue"),t.exit("characterEscape"),e):r(s)}}const Q2={name:"characterReference",tokenize:nP};function nP(t,e,r){const n=this;let i=0,s,o;return a;function a(d){return t.enter("characterReference"),t.enter("characterReferenceMarker"),t.consume(d),t.exit("characterReferenceMarker"),l}function l(d){return d===35?(t.enter("characterReferenceMarkerNumeric"),t.consume(d),t.exit("characterReferenceMarkerNumeric"),u):(t.enter("characterReferenceValue"),s=31,o=Hr,c(d))}function u(d){return d===88||d===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(d),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),s=6,o=H4,c):(t.enter("characterReferenceValue"),s=7,o=Hg,c(d))}function c(d){if(d===59&&i){const g=t.exit("characterReferenceValue");return o===Hr&&!Mv(n.sliceSerialize(g))?r(d):(t.enter("characterReferenceMarker"),t.consume(d),t.exit("characterReferenceMarker"),t.exit("characterReference"),e)}return o(d)&&i++<s?(t.consume(d),c):r(d)}}const zb={partial:!0,tokenize:aP},Hb={concrete:!0,name:"codeFenced",tokenize:iP};function iP(t,e,r){const n=this,i={partial:!0,tokenize:T};let s=0,o=0,a;return l;function l(N){return u(N)}function u(N){const E=n.events[n.events.length-1];return s=E&&E[1].type==="linePrefix"?E[2].sliceSerialize(E[1],!0).length:0,a=N,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),c(N)}function c(N){return N===a?(o++,t.consume(N),c):o<3?r(N):(t.exit("codeFencedFenceSequence"),kt(N)?Lt(t,d,"whitespace")(N):d(N))}function d(N){return N===null||gt(N)?(t.exit("codeFencedFence"),n.interrupt?e(N):t.check(zb,_,S)(N)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),g(N))}function g(N){return N===null||gt(N)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),d(N)):kt(N)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),Lt(t,f,"whitespace")(N)):N===96&&N===a?r(N):(t.consume(N),g)}function f(N){return N===null||gt(N)?d(N):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),y(N))}function y(N){return N===null||gt(N)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),d(N)):N===96&&N===a?r(N):(t.consume(N),y)}function _(N){return t.attempt(i,S,v)(N)}function v(N){return t.enter("lineEnding"),t.consume(N),t.exit("lineEnding"),m}function m(N){return s>0&&kt(N)?Lt(t,x,"linePrefix",s+1)(N):x(N)}function x(N){return N===null||gt(N)?t.check(zb,_,S)(N):(t.enter("codeFlowValue"),b(N))}function b(N){return N===null||gt(N)?(t.exit("codeFlowValue"),x(N)):(t.consume(N),b)}function S(N){return t.exit("codeFenced"),e(N)}function T(N,E,k){let L=0;return A;function A(M){return N.enter("lineEnding"),N.consume(M),N.exit("lineEnding"),I}function I(M){return N.enter("codeFencedFence"),kt(M)?Lt(N,O,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):O(M)}function O(M){return M===a?(N.enter("codeFencedFenceSequence"),B(M)):k(M)}function B(M){return M===a?(L++,N.consume(M),B):L>=o?(N.exit("codeFencedFenceSequence"),kt(M)?Lt(N,D,"whitespace")(M):D(M)):k(M)}function D(M){return M===null||gt(M)?(N.exit("codeFencedFence"),E(M)):k(M)}}}function aP(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 Kp={name:"codeIndented",tokenize:oP},sP={partial:!0,tokenize:lP};function oP(t,e,r){const n=this;return i;function i(u){return t.enter("codeIndented"),Lt(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):gt(u)?t.attempt(sP,o,l)(u):(t.enter("codeFlowValue"),a(u))}function a(u){return u===null||gt(u)?(t.exit("codeFlowValue"),o(u)):(t.consume(u),a)}function l(u){return t.exit("codeIndented"),e(u)}}function lP(t,e,r){const n=this;return i;function i(o){return n.parser.lazy[n.now().line]?r(o):gt(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),i):Lt(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):gt(o)?i(o):r(o)}}const uP={name:"codeText",previous:dP,resolve:cP,tokenize:hP};function cP(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 dP(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function hP(t,e,r){let n=0,i,s;return o;function o(d){return t.enter("codeText"),t.enter("codeTextSequence"),a(d)}function a(d){return d===96?(t.consume(d),n++,a):(t.exit("codeTextSequence"),l(d))}function l(d){return d===null?r(d):d===32?(t.enter("space"),t.consume(d),t.exit("space"),l):d===96?(s=t.enter("codeTextSequence"),i=0,c(d)):gt(d)?(t.enter("lineEnding"),t.consume(d),t.exit("lineEnding"),l):(t.enter("codeTextData"),u(d))}function u(d){return d===null||d===32||d===96||gt(d)?(t.exit("codeTextData"),l(d)):(t.consume(d),u)}function c(d){return d===96?(t.consume(d),i++,c):i===n?(t.exit("codeTextSequence"),t.exit("codeText"),e(d)):(s.type="codeTextData",u(d))}}class fP{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&&Jo(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),Jo(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),Jo(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);Jo(this.right,r.reverse())}else{const r=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);Jo(this.left,r.reverse())}}}function Jo(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 Z2(t){const e={};let r=-1,n,i,s,o,a,l,u;const c=new fP(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,pP(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 yn(t,0,Number.POSITIVE_INFINITY,c.slice(0)),!u}function pP(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,d,g=-1,f=r,y=0,_=0;const v=[_];for(;f;){for(;t.get(++i)[1]!==f;);s.push(i),f._tokenizer||(c=n.sliceStream(f),f.next||c.push(null),d&&o.defineSkip(f.start),f._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(c),f._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=f,f=f.next}for(f=r;++g<a.length;)a[g][0]==="exit"&&a[g-1][0]==="enter"&&a[g][1].type===a[g-1][1].type&&a[g][1].start.line!==a[g][1].end.line&&(_=g+1,v.push(_),f._tokenizer=void 0,f.previous=void 0,f=f.next);for(o.events=[],f?(f._tokenizer=void 0,f.previous=void 0):v.pop(),g=v.length;g--;){const m=a.slice(v[g],v[g+1]),x=s.pop();l.push([x,x+m.length-1]),t.splice(x,2,m)}for(l.reverse(),g=-1;++g<l.length;)u[y+l[g][0]]=y+l[g][1],y+=l[g][1]-l[g][0]-1;return u}const gP={resolve:mP,tokenize:yP},vP={partial:!0,tokenize:xP};function mP(t){return Z2(t),t}function yP(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):gt(a)?t.check(vP,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 xP(t,e,r){const n=this;return i;function i(o){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),Lt(t,s,"linePrefix")}function s(o){if(o===null||gt(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 J2(t,e,r,n,i,s,o,a,l){const u=l||Number.POSITIVE_INFINITY;let c=0;return d;function d(m){return m===60?(t.enter(n),t.enter(i),t.enter(s),t.consume(m),t.exit(s),g):m===null||m===32||m===41||Vc(m)?r(m):(t.enter(n),t.enter(o),t.enter(a),t.enter("chunkString",{contentType:"string"}),_(m))}function g(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"}),f(m))}function f(m){return m===62?(t.exit("chunkString"),t.exit(a),g(m)):m===null||m===60||gt(m)?r(m):(t.consume(m),m===92?y:f)}function y(m){return m===60||m===62||m===92?(t.consume(m),f):f(m)}function _(m){return!c&&(m===null||m===41||qt(m))?(t.exit("chunkString"),t.exit(a),t.exit(o),t.exit(n),e(m)):c<u&&m===40?(t.consume(m),c++,_):m===41?(t.consume(m),c--,_):m===null||m===32||m===40||Vc(m)?r(m):(t.consume(m),m===92?v:_)}function v(m){return m===40||m===41||m===92?(t.consume(m),_):_(m)}}function eS(t,e,r,n,i,s){const o=this;let a=0,l;return u;function u(f){return t.enter(n),t.enter(i),t.consume(f),t.exit(i),t.enter(s),c}function c(f){return a>999||f===null||f===91||f===93&&!l||f===94&&!a&&"_hiddenFootnoteSupport"in o.parser.constructs?r(f):f===93?(t.exit(s),t.enter(i),t.consume(f),t.exit(i),t.exit(n),e):gt(f)?(t.enter("lineEnding"),t.consume(f),t.exit("lineEnding"),c):(t.enter("chunkString",{contentType:"string"}),d(f))}function d(f){return f===null||f===91||f===93||gt(f)||a++>999?(t.exit("chunkString"),c(f)):(t.consume(f),l||(l=!kt(f)),f===92?g:d)}function g(f){return f===91||f===92||f===93?(t.consume(f),a++,d):d(f)}}function tS(t,e,r,n,i,s){let o;return a;function a(g){return g===34||g===39||g===40?(t.enter(n),t.enter(i),t.consume(g),t.exit(i),o=g===40?41:g,l):r(g)}function l(g){return g===o?(t.enter(i),t.consume(g),t.exit(i),t.exit(n),e):(t.enter(s),u(g))}function u(g){return g===o?(t.exit(s),l(o)):g===null?r(g):gt(g)?(t.enter("lineEnding"),t.consume(g),t.exit("lineEnding"),Lt(t,u,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),c(g))}function c(g){return g===o||g===null||gt(g)?(t.exit("chunkString"),u(g)):(t.consume(g),g===92?d:c)}function d(g){return g===o||g===92?(t.consume(g),c):c(g)}}function ul(t,e){let r;return n;function n(i){return gt(i)?(t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),r=!0,n):kt(i)?Lt(t,n,r?"linePrefix":"lineSuffix")(i):e(i)}}const bP={name:"definition",tokenize:_P},wP={partial:!0,tokenize:SP};function _P(t,e,r){const n=this;let i;return s;function s(f){return t.enter("definition"),o(f)}function o(f){return eS.call(n,t,a,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(f)}function a(f){return i=Hn(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)),f===58?(t.enter("definitionMarker"),t.consume(f),t.exit("definitionMarker"),l):r(f)}function l(f){return qt(f)?ul(t,u)(f):u(f)}function u(f){return J2(t,c,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(f)}function c(f){return t.attempt(wP,d,d)(f)}function d(f){return kt(f)?Lt(t,g,"whitespace")(f):g(f)}function g(f){return f===null||gt(f)?(t.exit("definition"),n.parser.defined.push(i),e(f)):r(f)}}function SP(t,e,r){return n;function n(a){return qt(a)?ul(t,i)(a):r(a)}function i(a){return tS(t,s,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function s(a){return kt(a)?Lt(t,o,"whitespace")(a):o(a)}function o(a){return a===null||gt(a)?e(a):r(a)}}const CP={name:"hardBreakEscape",tokenize:kP};function kP(t,e,r){return n;function n(s){return t.enter("hardBreakEscape"),t.consume(s),i}function i(s){return gt(s)?(t.exit("hardBreakEscape"),e(s)):r(s)}}const EP={name:"headingAtx",resolve:TP,tokenize:NP};function TP(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"},yn(t,n,r-n+1,[["enter",i,e],["enter",s,e],["exit",s,e],["exit",i,e]])),t}function NP(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||qt(c)?(t.exit("atxHeadingSequence"),a(c)):r(c)}function a(c){return c===35?(t.enter("atxHeadingSequence"),l(c)):c===null||gt(c)?(t.exit("atxHeading"),e(c)):kt(c)?Lt(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||qt(c)?(t.exit("atxHeadingText"),a(c)):(t.consume(c),u)}}const RP=["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"],Ub=["pre","script","style","textarea"],LP={concrete:!0,name:"htmlFlow",resolveTo:PP,tokenize:MP},DP={partial:!0,tokenize:OP},AP={partial:!0,tokenize:IP};function PP(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 MP(t,e,r){const n=this;let i,s,o,a,l;return u;function u(V){return c(V)}function c(V){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(V),d}function d(V){return V===33?(t.consume(V),g):V===47?(t.consume(V),s=!0,_):V===63?(t.consume(V),i=3,n.interrupt?e:P):Qr(V)?(t.consume(V),o=String.fromCharCode(V),v):r(V)}function g(V){return V===45?(t.consume(V),i=2,f):V===91?(t.consume(V),i=5,a=0,y):Qr(V)?(t.consume(V),i=4,n.interrupt?e:P):r(V)}function f(V){return V===45?(t.consume(V),n.interrupt?e:P):r(V)}function y(V){const te="CDATA[";return V===te.charCodeAt(a++)?(t.consume(V),a===te.length?n.interrupt?e:O:y):r(V)}function _(V){return Qr(V)?(t.consume(V),o=String.fromCharCode(V),v):r(V)}function v(V){if(V===null||V===47||V===62||qt(V)){const te=V===47,ie=o.toLowerCase();return!te&&!s&&Ub.includes(ie)?(i=1,n.interrupt?e(V):O(V)):RP.includes(o.toLowerCase())?(i=6,te?(t.consume(V),m):n.interrupt?e(V):O(V)):(i=7,n.interrupt&&!n.parser.lazy[n.now().line]?r(V):s?x(V):b(V))}return V===45||Hr(V)?(t.consume(V),o+=String.fromCharCode(V),v):r(V)}function m(V){return V===62?(t.consume(V),n.interrupt?e:O):r(V)}function x(V){return kt(V)?(t.consume(V),x):A(V)}function b(V){return V===47?(t.consume(V),A):V===58||V===95||Qr(V)?(t.consume(V),S):kt(V)?(t.consume(V),b):A(V)}function S(V){return V===45||V===46||V===58||V===95||Hr(V)?(t.consume(V),S):T(V)}function T(V){return V===61?(t.consume(V),N):kt(V)?(t.consume(V),T):b(V)}function N(V){return V===null||V===60||V===61||V===62||V===96?r(V):V===34||V===39?(t.consume(V),l=V,E):kt(V)?(t.consume(V),N):k(V)}function E(V){return V===l?(t.consume(V),l=null,L):V===null||gt(V)?r(V):(t.consume(V),E)}function k(V){return V===null||V===34||V===39||V===47||V===60||V===61||V===62||V===96||qt(V)?T(V):(t.consume(V),k)}function L(V){return V===47||V===62||kt(V)?b(V):r(V)}function A(V){return V===62?(t.consume(V),I):r(V)}function I(V){return V===null||gt(V)?O(V):kt(V)?(t.consume(V),I):r(V)}function O(V){return V===45&&i===2?(t.consume(V),U):V===60&&i===1?(t.consume(V),H):V===62&&i===4?(t.consume(V),z):V===63&&i===3?(t.consume(V),P):V===93&&i===5?(t.consume(V),F):gt(V)&&(i===6||i===7)?(t.exit("htmlFlowData"),t.check(DP,G,B)(V)):V===null||gt(V)?(t.exit("htmlFlowData"),B(V)):(t.consume(V),O)}function B(V){return t.check(AP,D,G)(V)}function D(V){return t.enter("lineEnding"),t.consume(V),t.exit("lineEnding"),M}function M(V){return V===null||gt(V)?B(V):(t.enter("htmlFlowData"),O(V))}function U(V){return V===45?(t.consume(V),P):O(V)}function H(V){return V===47?(t.consume(V),o="",$):O(V)}function $(V){if(V===62){const te=o.toLowerCase();return Ub.includes(te)?(t.consume(V),z):O(V)}return Qr(V)&&o.length<8?(t.consume(V),o+=String.fromCharCode(V),$):O(V)}function F(V){return V===93?(t.consume(V),P):O(V)}function P(V){return V===62?(t.consume(V),z):V===45&&i===2?(t.consume(V),P):O(V)}function z(V){return V===null||gt(V)?(t.exit("htmlFlowData"),G(V)):(t.consume(V),z)}function G(V){return t.exit("htmlFlow"),e(V)}}function IP(t,e,r){const n=this;return i;function i(o){return gt(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 OP(t,e,r){return n;function n(i){return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),t.attempt(jl,e,r)}}const BP={name:"htmlText",tokenize:jP};function jP(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),T):P===63?(t.consume(P),b):Qr(P)?(t.consume(P),k):r(P)}function u(P){return P===45?(t.consume(P),c):P===91?(t.consume(P),s=0,y):Qr(P)?(t.consume(P),x):r(P)}function c(P){return P===45?(t.consume(P),f):r(P)}function d(P){return P===null?r(P):P===45?(t.consume(P),g):gt(P)?(o=d,H(P)):(t.consume(P),d)}function g(P){return P===45?(t.consume(P),f):d(P)}function f(P){return P===62?U(P):P===45?g(P):d(P)}function y(P){const z="CDATA[";return P===z.charCodeAt(s++)?(t.consume(P),s===z.length?_:y):r(P)}function _(P){return P===null?r(P):P===93?(t.consume(P),v):gt(P)?(o=_,H(P)):(t.consume(P),_)}function v(P){return P===93?(t.consume(P),m):_(P)}function m(P){return P===62?U(P):P===93?(t.consume(P),m):_(P)}function x(P){return P===null||P===62?U(P):gt(P)?(o=x,H(P)):(t.consume(P),x)}function b(P){return P===null?r(P):P===63?(t.consume(P),S):gt(P)?(o=b,H(P)):(t.consume(P),b)}function S(P){return P===62?U(P):b(P)}function T(P){return Qr(P)?(t.consume(P),N):r(P)}function N(P){return P===45||Hr(P)?(t.consume(P),N):E(P)}function E(P){return gt(P)?(o=E,H(P)):kt(P)?(t.consume(P),E):U(P)}function k(P){return P===45||Hr(P)?(t.consume(P),k):P===47||P===62||qt(P)?L(P):r(P)}function L(P){return P===47?(t.consume(P),U):P===58||P===95||Qr(P)?(t.consume(P),A):gt(P)?(o=L,H(P)):kt(P)?(t.consume(P),L):U(P)}function A(P){return P===45||P===46||P===58||P===95||Hr(P)?(t.consume(P),A):I(P)}function I(P){return P===61?(t.consume(P),O):gt(P)?(o=I,H(P)):kt(P)?(t.consume(P),I):L(P)}function O(P){return P===null||P===60||P===61||P===62||P===96?r(P):P===34||P===39?(t.consume(P),i=P,B):gt(P)?(o=O,H(P)):kt(P)?(t.consume(P),O):(t.consume(P),D)}function B(P){return P===i?(t.consume(P),i=void 0,M):P===null?r(P):gt(P)?(o=B,H(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||qt(P)?L(P):(t.consume(P),D)}function M(P){return P===47||P===62||qt(P)?L(P):r(P)}function U(P){return P===62?(t.consume(P),t.exit("htmlTextData"),t.exit("htmlText"),e):r(P)}function H(P){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(P),t.exit("lineEnding"),$}function $(P){return kt(P)?Lt(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 Iv={name:"labelEnd",resolveAll:UP,resolveTo:$P,tokenize:WP},FP={tokenize:VP},zP={tokenize:GP},HP={tokenize:qP};function UP(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&&yn(t,0,t.length,r),t}function $P(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=Nn(a,t.slice(s+1,s+n+3)),a=Nn(a,[["enter",c,e]]),a=Nn(a,vd(e.parser.constructs.insideSpan.null,t.slice(s+n+4,o-3),e)),a=Nn(a,[["exit",c,e],t[o-2],t[o-1],["exit",u,e]]),a=Nn(a,t.slice(o+1)),a=Nn(a,[["exit",l,e]]),yn(t,s,t.length,a),t}function WP(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(g){return s?s._inactive?d(g):(o=n.parser.defined.includes(Hn(n.sliceSerialize({start:s.end,end:n.now()}))),t.enter("labelEnd"),t.enter("labelMarker"),t.consume(g),t.exit("labelMarker"),t.exit("labelEnd"),l):r(g)}function l(g){return g===40?t.attempt(FP,c,o?c:d)(g):g===91?t.attempt(zP,c,o?u:d)(g):o?c(g):d(g)}function u(g){return t.attempt(HP,c,d)(g)}function c(g){return e(g)}function d(g){return s._balanced=!0,r(g)}}function VP(t,e,r){return n;function n(d){return t.enter("resource"),t.enter("resourceMarker"),t.consume(d),t.exit("resourceMarker"),i}function i(d){return qt(d)?ul(t,s)(d):s(d)}function s(d){return d===41?c(d):J2(t,o,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(d)}function o(d){return qt(d)?ul(t,l)(d):c(d)}function a(d){return r(d)}function l(d){return d===34||d===39||d===40?tS(t,u,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(d):c(d)}function u(d){return qt(d)?ul(t,c)(d):c(d)}function c(d){return d===41?(t.enter("resourceMarker"),t.consume(d),t.exit("resourceMarker"),t.exit("resource"),e):r(d)}}function GP(t,e,r){const n=this;return i;function i(a){return eS.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 qP(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 YP={name:"labelStartImage",resolveAll:Iv.resolveAll,tokenize:KP};function KP(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 XP={name:"labelStartLink",resolveAll:Iv.resolveAll,tokenize:QP};function QP(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 Xp={name:"lineEnding",tokenize:ZP};function ZP(t,e){return r;function r(n){return t.enter("lineEnding"),t.consume(n),t.exit("lineEnding"),Lt(t,e,"linePrefix")}}const Lc={name:"thematicBreak",tokenize:JP};function JP(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||gt(u))?(t.exit("thematicBreak"),e(u)):r(u)}function l(u){return u===i?(t.consume(u),n++,l):(t.exit("thematicBreakSequence"),kt(u)?Lt(t,a,"whitespace")(u):a(u))}}const on={continuation:{tokenize:nM},exit:aM,name:"list",tokenize:rM},eM={partial:!0,tokenize:sM},tM={partial:!0,tokenize:iM};function rM(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(f){const y=n.containerState.type||(f===42||f===43||f===45?"listUnordered":"listOrdered");if(y==="listUnordered"?!n.containerState.marker||f===n.containerState.marker:Hg(f)){if(n.containerState.type||(n.containerState.type=y,t.enter(y,{_container:!0})),y==="listUnordered")return t.enter("listItemPrefix"),f===42||f===45?t.check(Lc,r,u)(f):u(f);if(!n.interrupt||f===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),l(f)}return r(f)}function l(f){return Hg(f)&&++o<10?(t.consume(f),l):(!n.interrupt||o<2)&&(n.containerState.marker?f===n.containerState.marker:f===41||f===46)?(t.exit("listItemValue"),u(f)):r(f)}function u(f){return t.enter("listItemMarker"),t.consume(f),t.exit("listItemMarker"),n.containerState.marker=n.containerState.marker||f,t.check(jl,n.interrupt?r:c,t.attempt(eM,g,d))}function c(f){return n.containerState.initialBlankLine=!0,s++,g(f)}function d(f){return kt(f)?(t.enter("listItemPrefixWhitespace"),t.consume(f),t.exit("listItemPrefixWhitespace"),g):r(f)}function g(f){return n.containerState.size=s+n.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(f)}}function nM(t,e,r){const n=this;return n.containerState._closeFlow=void 0,t.check(jl,i,s);function i(a){return n.containerState.furtherBlankLines=n.containerState.furtherBlankLines||n.containerState.initialBlankLine,Lt(t,e,"listItemIndent",n.containerState.size+1)(a)}function s(a){return n.containerState.furtherBlankLines||!kt(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(tM,e,o)(a))}function o(a){return n.containerState._closeFlow=!0,n.interrupt=void 0,Lt(t,t.attempt(on,e,r),"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function iM(t,e,r){const n=this;return Lt(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 aM(t){t.exit(this.containerState.type)}function sM(t,e,r){const n=this;return Lt(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!kt(s)&&o&&o[1].type==="listItemPrefixWhitespace"?e(s):r(s)}}const $b={name:"setextUnderline",resolveTo:oM,tokenize:lM};function oM(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 lM(t,e,r){const n=this;let i;return s;function s(u){let c=n.events.length,d;for(;c--;)if(n.events[c][1].type!=="lineEnding"&&n.events[c][1].type!=="linePrefix"&&n.events[c][1].type!=="content"){d=n.events[c][1].type==="paragraph";break}return!n.parser.lazy[n.now().line]&&(n.interrupt||d)?(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"),kt(u)?Lt(t,l,"lineSuffix")(u):l(u))}function l(u){return u===null||gt(u)?(t.exit("setextHeadingLine"),e(u)):r(u)}}const uM={tokenize:cM};function cM(t){const e=this,r=t.attempt(jl,n,t.attempt(this.parser.constructs.flowInitial,i,Lt(t,t.attempt(this.parser.constructs.flow,i,t.attempt(gP,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 dM={resolveAll:nS()},hM=rS("string"),fM=rS("text");function rS(t){return{resolveAll:nS(t==="text"?pM: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 d=i[c];let g=-1;if(d)for(;++g<d.length;){const f=d[g];if(!f.previous||f.previous.call(n,n.previous))return!0}return!1}}}function nS(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 pM(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 gM={42:on,43:on,45:on,48:on,49:on,50:on,51:on,52:on,53:on,54:on,55:on,56:on,57:on,62:K2},vM={91:bP},mM={[-2]:Kp,[-1]:Kp,32:Kp},yM={35:EP,42:Lc,45:[$b,Lc],60:LP,61:$b,95:Lc,96:Hb,126:Hb},xM={38:Q2,92:X2},bM={[-5]:Xp,[-4]:Xp,[-3]:Xp,33:YP,38:Q2,42:Ug,60:[X4,BP],91:XP,92:[CP,X2],93:Iv,95:Ug,96:uP},wM={null:[Ug,dM]},_M={null:[42,95]},SM={null:[]},CM=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:_M,contentInitial:vM,disable:SM,document:gM,flow:yM,flowInitial:mM,insideSpan:wM,string:xM,text:bM},Symbol.toStringTag,{value:"Module"}));function kM(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:E(T),check:E(N),consume:x,enter:b,exit:S,interrupt:E(N,{interrupt:!0})},u={code:null,containerState:{},defineSkip:_,events:[],now:y,parser:t,previous:null,sliceSerialize:g,sliceStream:f,write:d};let c=e.tokenize.call(u,l);return e.resolveAll&&s.push(e),u;function d(I){return o=Nn(o,I),v(),o[o.length-1]!==null?[]:(k(e,0),u.events=vd(s,u.events,u),u.events)}function g(I,O){return TM(f(I),O)}function f(I){return EM(o,I)}function y(){const{_bufferIndex:I,_index:O,line:B,column:D,offset:M}=n;return{_bufferIndex:I,_index:O,line:B,column:D,offset:M}}function _(I){i[I.line]=I.column,A()}function v(){let I;for(;n._index<o.length;){const O=o[n._index];if(typeof O=="string")for(I=n._index,n._bufferIndex<0&&(n._bufferIndex=0);n._index===I&&n._bufferIndex<O.length;)m(O.charCodeAt(n._bufferIndex));else m(O)}}function m(I){c=c(I)}function x(I){gt(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,O){const B=O||{};return B.type=I,B.start=y(),u.events.push(["enter",B,u]),a.push(B),B}function S(I){const O=a.pop();return O.end=y(),u.events.push(["exit",O,u]),O}function T(I,O){k(I,O.from)}function N(I,O){O.restore()}function E(I,O){return B;function B(D,M,U){let H,$,F,P;return Array.isArray(D)?G(D):"tokenize"in D?G([D]):z(D);function z(ne){return X;function X(q){const Y=q!==null&&ne[q],K=q!==null&&ne.null,ee=[...Array.isArray(Y)?Y:Y?[Y]:[],...Array.isArray(K)?K:K?[K]:[]];return G(ee)(q)}}function G(ne){return H=ne,$=0,ne.length===0?U:V(ne[$])}function V(ne){return X;function X(q){return P=L(),F=ne,ne.partial||(u.currentConstruct=ne),ne.name&&u.parser.constructs.disable.null.includes(ne.name)?ie():ne.tokenize.call(O?Object.assign(Object.create(u),O):u,l,te,ie)(q)}}function te(ne){return I(F,P),M}function ie(ne){return P.restore(),++$<H.length?V(H[$]):U}}}function k(I,O){I.resolveAll&&!s.includes(I)&&s.push(I),I.resolve&&yn(u.events,O,u.events.length-O,I.resolve(u.events.slice(O),u)),I.resolveTo&&(u.events=I.resolveTo(u.events,u))}function L(){const I=y(),O=u.previous,B=u.currentConstruct,D=u.events.length,M=Array.from(a);return{from:D,restore:U};function U(){n=I,u.previous=O,u.currentConstruct=B,u.events.length=D,a=M,A()}}function A(){n.line in i&&n.column<2&&(n.column=i[n.line],n.offset+=i[n.line]-1)}}function EM(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 TM(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=`
|
|
393
|
-
`;break}case-3:{o=`\r
|
|
394
|
-
`;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 NM(t){const n={constructs:q2([CM,...(t||{}).extensions||[]]),content:i($4),defined:[],document:i(V4),flow:i(uM),lazy:{},string:i(hM),text:i(fM)};return n;function i(s){return o;function o(a){return kM(n,s,a)}}}function RM(t){for(;!Z2(t););return t}const Wb=/[\0\t\n\r]/g;function LM(){let t=1,e="",r=!0,n;return i;function i(s,o,a){const l=[];let u,c,d,g,f;for(s=e+(typeof s=="string"?s.toString():new TextDecoder(o||void 0).decode(s)),d=0,e="",r&&(s.charCodeAt(0)===65279&&d++,r=void 0);d<s.length;){if(Wb.lastIndex=d,u=Wb.exec(s),g=u&&u.index!==void 0?u.index:s.length,f=s.charCodeAt(g),!u){e=s.slice(d);break}if(f===10&&d===g&&n)l.push(-3),n=void 0;else switch(n&&(l.push(-5),n=void 0),d<g&&(l.push(s.slice(d,g)),t+=g-d),f){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}d=g+1}return a&&(n&&l.push(-5),e&&l.push(e),l.push(null)),l}}const DM=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function AM(t){return t.replace(DM,PM)}function PM(t,e,r){if(e)return e;if(r.charCodeAt(0)===35){const i=r.charCodeAt(1),s=i===120||i===88;return Y2(r.slice(s?2:1),s?16:10)}return Mv(r)||t}const iS={}.hasOwnProperty;function MM(t,e,r){return e&&typeof e=="object"&&(r=e,e=void 0),IM(r)(RM(NM(r).document().write(LM()(t,e,!0))))}function IM(t){const e={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(Le),autolinkProtocol:L,autolinkEmail:L,atxHeading:s(Re),blockQuote:s(K),characterEscape:L,characterReference:L,codeFenced:s(ee),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:s(ee,o),codeText:s(re,o),codeTextData:L,data:L,codeFlowValue:L,definition:s(ue),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:s(pe),hardBreakEscape:s(Be),hardBreakTrailing:s(Be),htmlFlow:s(_e,o),htmlFlowData:L,htmlText:s(_e,o),htmlTextData:L,image:s(Te),label:o,link:s(Le),listItem:s(Pe),listItemValue:g,listOrdered:s(Ee,d),listUnordered:s(Ee),paragraph:s(ze),reference:V,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:s(Re),strong:s(Me),thematicBreak:s(Ge)},exit:{atxHeading:l(),atxHeadingSequence:T,autolink:l(),autolinkEmail:Y,autolinkProtocol:q,blockQuote:l(),characterEscapeValue:A,characterReferenceMarkerHexadecimal:ie,characterReferenceMarkerNumeric:ie,characterReferenceValue:ne,characterReference:X,codeFenced:l(v),codeFencedFence:_,codeFencedFenceInfo:f,codeFencedFenceMeta:y,codeFlowValue:A,codeIndented:l(m),codeText:l(M),codeTextData:A,data:A,definition:l(),definitionDestinationString:S,definitionLabelString:x,definitionTitleString:b,emphasis:l(),hardBreakEscape:l(O),hardBreakTrailing:l(O),htmlFlow:l(B),htmlFlowData:A,htmlText:l(D),htmlTextData:A,image:l(H),label:F,labelText:$,lineEnding:I,link:l(U),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:te,resourceDestinationString:P,resourceTitleString:z,resource:G,setextHeading:l(k),setextHeadingLineSequence:E,setextHeadingText:N,strong:l(),thematicBreak:l()}};aS(e,(t||{}).mdastExtensions||[]);const r={};return n;function n(ve){let Ce={type:"root",children:[]};const Ie={stack:[Ce],tokenStack:[],config:e,enter:a,exit:u,buffer:o,resume:c,data:r},me=[];let Z=-1;for(;++Z<ve.length;)if(ve[Z][1].type==="listOrdered"||ve[Z][1].type==="listUnordered")if(ve[Z][0]==="enter")me.push(Z);else{const he=me.pop();Z=i(ve,he,Z)}for(Z=-1;++Z<ve.length;){const he=e[ve[Z][0]];iS.call(he,ve[Z][1].type)&&he[ve[Z][1].type].call(Object.assign({sliceSerialize:ve[Z][2].sliceSerialize},Ie),ve[Z][1])}if(Ie.tokenStack.length>0){const he=Ie.tokenStack[Ie.tokenStack.length-1];(he[1]||Vb).call(Ie,void 0,he[0])}for(Ce.position={start:qi(ve.length>0?ve[0][1].start:{line:1,column:1,offset:0}),end:qi(ve.length>0?ve[ve.length-2][1].end:{line:1,column:1,offset:0})},Z=-1;++Z<e.transforms.length;)Ce=e.transforms[Z](Ce)||Ce;return Ce}function i(ve,Ce,Ie){let me=Ce-1,Z=-1,he=!1,ae,se,ce,de;for(;++me<=Ie;){const oe=ve[me];switch(oe[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{oe[0]==="enter"?Z++:Z--,de=void 0;break}case"lineEndingBlank":{oe[0]==="enter"&&(ae&&!de&&!Z&&!ce&&(ce=me),de=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:de=void 0}if(!Z&&oe[0]==="enter"&&oe[1].type==="listItemPrefix"||Z===-1&&oe[0]==="exit"&&(oe[1].type==="listUnordered"||oe[1].type==="listOrdered")){if(ae){let ye=me;for(se=void 0;ye--;){const Se=ve[ye];if(Se[1].type==="lineEnding"||Se[1].type==="lineEndingBlank"){if(Se[0]==="exit")continue;se&&(ve[se][1].type="lineEndingBlank",he=!0),Se[1].type="lineEnding",se=ye}else if(!(Se[1].type==="linePrefix"||Se[1].type==="blockQuotePrefix"||Se[1].type==="blockQuotePrefixWhitespace"||Se[1].type==="blockQuoteMarker"||Se[1].type==="listItemIndent"))break}ce&&(!se||ce<se)&&(ae._spread=!0),ae.end=Object.assign({},se?ve[se][1].start:oe[1].end),ve.splice(se||me,0,["exit",ae,oe[2]]),me++,Ie++}if(oe[1].type==="listItemPrefix"){const ye={type:"listItem",_spread:!1,start:Object.assign({},oe[1].start),end:void 0};ae=ye,ve.splice(me,0,["enter",ye,oe[2]]),me++,Ie++,ce=void 0,de=!0}}}return ve[Ce][1]._spread=he,Ie}function s(ve,Ce){return Ie;function Ie(me){a.call(this,ve(me),me),Ce&&Ce.call(this,me)}}function o(){this.stack.push({type:"fragment",children:[]})}function a(ve,Ce,Ie){this.stack[this.stack.length-1].children.push(ve),this.stack.push(ve),this.tokenStack.push([Ce,Ie||void 0]),ve.position={start:qi(Ce.start),end:void 0}}function l(ve){return Ce;function Ce(Ie){ve&&ve.call(this,Ie),u.call(this,Ie)}}function u(ve,Ce){const Ie=this.stack.pop(),me=this.tokenStack.pop();if(me)me[0].type!==ve.type&&(Ce?Ce.call(this,ve,me[0]):(me[1]||Vb).call(this,ve,me[0]));else throw new Error("Cannot close `"+ve.type+"` ("+ll({start:ve.start,end:ve.end})+"): it’s not open");Ie.position.end=qi(ve.end)}function c(){return Pv(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function g(ve){if(this.data.expectingFirstListItemValue){const Ce=this.stack[this.stack.length-2];Ce.start=Number.parseInt(this.sliceSerialize(ve),10),this.data.expectingFirstListItemValue=void 0}}function f(){const ve=this.resume(),Ce=this.stack[this.stack.length-1];Ce.lang=ve}function y(){const ve=this.resume(),Ce=this.stack[this.stack.length-1];Ce.meta=ve}function _(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function v(){const ve=this.resume(),Ce=this.stack[this.stack.length-1];Ce.value=ve.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function m(){const ve=this.resume(),Ce=this.stack[this.stack.length-1];Ce.value=ve.replace(/(\r?\n|\r)$/g,"")}function x(ve){const Ce=this.resume(),Ie=this.stack[this.stack.length-1];Ie.label=Ce,Ie.identifier=Hn(this.sliceSerialize(ve)).toLowerCase()}function b(){const ve=this.resume(),Ce=this.stack[this.stack.length-1];Ce.title=ve}function S(){const ve=this.resume(),Ce=this.stack[this.stack.length-1];Ce.url=ve}function T(ve){const Ce=this.stack[this.stack.length-1];if(!Ce.depth){const Ie=this.sliceSerialize(ve).length;Ce.depth=Ie}}function N(){this.data.setextHeadingSlurpLineEnding=!0}function E(ve){const Ce=this.stack[this.stack.length-1];Ce.depth=this.sliceSerialize(ve).codePointAt(0)===61?1:2}function k(){this.data.setextHeadingSlurpLineEnding=void 0}function L(ve){const Ie=this.stack[this.stack.length-1].children;let me=Ie[Ie.length-1];(!me||me.type!=="text")&&(me=Ue(),me.position={start:qi(ve.start),end:void 0},Ie.push(me)),this.stack.push(me)}function A(ve){const Ce=this.stack.pop();Ce.value+=this.sliceSerialize(ve),Ce.position.end=qi(ve.end)}function I(ve){const Ce=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Ie=Ce.children[Ce.children.length-1];Ie.position.end=qi(ve.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&e.canContainEols.includes(Ce.type)&&(L.call(this,ve),A.call(this,ve))}function O(){this.data.atHardBreak=!0}function B(){const ve=this.resume(),Ce=this.stack[this.stack.length-1];Ce.value=ve}function D(){const ve=this.resume(),Ce=this.stack[this.stack.length-1];Ce.value=ve}function M(){const ve=this.resume(),Ce=this.stack[this.stack.length-1];Ce.value=ve}function U(){const ve=this.stack[this.stack.length-1];if(this.data.inReference){const Ce=this.data.referenceType||"shortcut";ve.type+="Reference",ve.referenceType=Ce,delete ve.url,delete ve.title}else delete ve.identifier,delete ve.label;this.data.referenceType=void 0}function H(){const ve=this.stack[this.stack.length-1];if(this.data.inReference){const Ce=this.data.referenceType||"shortcut";ve.type+="Reference",ve.referenceType=Ce,delete ve.url,delete ve.title}else delete ve.identifier,delete ve.label;this.data.referenceType=void 0}function $(ve){const Ce=this.sliceSerialize(ve),Ie=this.stack[this.stack.length-2];Ie.label=AM(Ce),Ie.identifier=Hn(Ce).toLowerCase()}function F(){const ve=this.stack[this.stack.length-1],Ce=this.resume(),Ie=this.stack[this.stack.length-1];if(this.data.inReference=!0,Ie.type==="link"){const me=ve.children;Ie.children=me}else Ie.alt=Ce}function P(){const ve=this.resume(),Ce=this.stack[this.stack.length-1];Ce.url=ve}function z(){const ve=this.resume(),Ce=this.stack[this.stack.length-1];Ce.title=ve}function G(){this.data.inReference=void 0}function V(){this.data.referenceType="collapsed"}function te(ve){const Ce=this.resume(),Ie=this.stack[this.stack.length-1];Ie.label=Ce,Ie.identifier=Hn(this.sliceSerialize(ve)).toLowerCase(),this.data.referenceType="full"}function ie(ve){this.data.characterReferenceType=ve.type}function ne(ve){const Ce=this.sliceSerialize(ve),Ie=this.data.characterReferenceType;let me;Ie?(me=Y2(Ce,Ie==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):me=Mv(Ce);const Z=this.stack[this.stack.length-1];Z.value+=me}function X(ve){const Ce=this.stack.pop();Ce.position.end=qi(ve.end)}function q(ve){A.call(this,ve);const Ce=this.stack[this.stack.length-1];Ce.url=this.sliceSerialize(ve)}function Y(ve){A.call(this,ve);const Ce=this.stack[this.stack.length-1];Ce.url="mailto:"+this.sliceSerialize(ve)}function K(){return{type:"blockquote",children:[]}}function ee(){return{type:"code",lang:null,meta:null,value:""}}function re(){return{type:"inlineCode",value:""}}function ue(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function pe(){return{type:"emphasis",children:[]}}function Re(){return{type:"heading",depth:0,children:[]}}function Be(){return{type:"break"}}function _e(){return{type:"html",value:""}}function Te(){return{type:"image",title:null,url:"",alt:null}}function Le(){return{type:"link",title:null,url:"",children:[]}}function Ee(ve){return{type:"list",ordered:ve.type==="listOrdered",start:null,spread:ve._spread,children:[]}}function Pe(ve){return{type:"listItem",spread:ve._spread,checked:null,children:[]}}function ze(){return{type:"paragraph",children:[]}}function Me(){return{type:"strong",children:[]}}function Ue(){return{type:"text",value:""}}function Ge(){return{type:"thematicBreak"}}}function qi(t){return{line:t.line,column:t.column,offset:t.offset}}function aS(t,e){let r=-1;for(;++r<e.length;){const n=e[r];Array.isArray(n)?aS(t,n):OM(t,n)}}function OM(t,e){let r;for(r in e)if(iS.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 Vb(t,e){throw t?new Error("Cannot close `"+t.type+"` ("+ll({start:t.start,end:t.end})+"): a different token (`"+e.type+"`, "+ll({start:e.start,end:e.end})+") is open"):new Error("Cannot close document, a token (`"+e.type+"`, "+ll({start:e.start,end:e.end})+") is still open")}function BM(t){const e=this;e.parser=r;function r(n){return MM(n,{...e.data("settings"),...t,extensions:e.data("micromarkExtensions")||[],mdastExtensions:e.data("fromMarkdownExtensions")||[]})}}function jM(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 FM(t,e){const r={type:"element",tagName:"br",properties:{},children:[]};return t.patch(e,r),[t.applyData(e,r),{type:"text",value:`
|
|
395
|
-
`}]}function zM(t,e){const r=e.value?e.value+`
|
|
396
|
-
`:"",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 HM(t,e){const r={type:"element",tagName:"del",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function UM(t,e){const r={type:"element",tagName:"em",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function $M(t,e){const r=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",n=String(e.identifier).toUpperCase(),i=io(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 WM(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 VM(t,e){if(t.options.allowDangerousHtml){const r={type:"raw",value:e.value};return t.patch(e,r),t.applyData(e,r)}}function sS(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 GM(t,e){const r=String(e.identifier).toUpperCase(),n=t.definitionById.get(r);if(!n)return sS(t,e);const i={src:io(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 qM(t,e){const r={src:io(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 YM(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 KM(t,e){const r=String(e.identifier).toUpperCase(),n=t.definitionById.get(r);if(!n)return sS(t,e);const i={href:io(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 XM(t,e){const r={href:io(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 QM(t,e,r){const n=t.all(e),i=r?ZM(r):oS(e),s={},o=[];if(typeof e.checked=="boolean"){const c=n[0];let d;c&&c.type==="element"&&c.tagName==="p"?d=c:(d={type:"element",tagName:"p",properties:{},children:[]},n.unshift(d)),d.children.length>0&&d.children.unshift({type:"text",value:" "}),d.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:`
|
|
397
|
-
`}),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:`
|
|
398
|
-
`});const u={type:"element",tagName:"li",properties:s,children:o};return t.patch(e,u),t.applyData(e,u)}function ZM(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 JM(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 eI(t,e){const r={type:"element",tagName:"p",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function tI(t,e){const r={type:"root",children:t.wrap(t.all(e))};return t.patch(e,r),t.applyData(e,r)}function rI(t,e){const r={type:"element",tagName:"strong",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function nI(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=Rv(e.children[1]),l=z2(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 iI(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 d=e.children[l],g={},f=o?o[l]:void 0;f&&(g.align=f);let y={type:"element",tagName:s,properties:g,children:[]};d&&(y.children=t.all(d),t.patch(d,y),y=t.applyData(d,y)),u.push(y)}const c={type:"element",tagName:"tr",properties:{},children:t.wrap(u,!0)};return t.patch(e,c),t.applyData(e,c)}function aI(t,e){const r={type:"element",tagName:"td",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}const Gb=9,qb=32;function sI(t){const e=String(t),r=/\r?\n|\r/g;let n=r.exec(e),i=0;const s=[];for(;n;)s.push(Yb(e.slice(i,n.index),i>0,!0),n[0]),i=n.index+n[0].length,n=r.exec(e);return s.push(Yb(e.slice(i),i>0,!1)),s.join("")}function Yb(t,e,r){let n=0,i=t.length;if(e){let s=t.codePointAt(n);for(;s===Gb||s===qb;)n++,s=t.codePointAt(n)}if(r){let s=t.codePointAt(i-1);for(;s===Gb||s===qb;)i--,s=t.codePointAt(i-1)}return i>n?t.slice(n,i):""}function oI(t,e){const r={type:"text",value:sI(String(e.value))};return t.patch(e,r),t.applyData(e,r)}function lI(t,e){const r={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(e,r),t.applyData(e,r)}const uI={blockquote:jM,break:FM,code:zM,delete:HM,emphasis:UM,footnoteReference:$M,heading:WM,html:VM,imageReference:GM,image:qM,inlineCode:YM,linkReference:KM,link:XM,listItem:QM,list:JM,paragraph:eI,root:tI,strong:rI,table:nI,tableCell:aI,tableRow:iI,text:oI,thematicBreak:lI,toml:uc,yaml:uc,definition:uc,footnoteDefinition:uc};function uc(){}const lS=-1,md=0,cl=1,Gc=2,Ov=3,Bv=4,jv=5,Fv=6,uS=7,cS=8,dS=typeof self=="object"?self:globalThis,Kb=(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 dS[t](e)},cI=(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 md:case lS:return r(o,i);case cl:{const a=r([],i);for(const l of o)a.push(n(l));return a}case Gc:{const a=r({},i);for(const[l,u]of o)a[n(l)]=n(u);return a}case Ov:return r(new Date(o),i);case Bv:{const{source:a,flags:l}=o;return r(new RegExp(a,l),i)}case jv:{const a=r(new Map,i);for(const[l,u]of o)a.set(n(l),n(u));return a}case Fv:{const a=r(new Set,i);for(const l of o)a.add(n(l));return a}case uS:{const{name:a,message:l}=o;return r(typeof dS[a]=="function"?Kb(a,l):new Error(l),i)}case cS: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(Kb(s,o),i)};return n},Xb=t=>cI(new Map,t)(0),Ba="",{toString:dI}={},{keys:hI}=Object,el=t=>{const e=typeof t;if(e!=="object"||!t)return[md,e];const r=dI.call(t).slice(8,-1);switch(r){case"Array":return[cl,Ba];case"Object":return[Gc,Ba];case"Date":return[Ov,Ba];case"RegExp":return[Bv,Ba];case"Map":return[jv,Ba];case"Set":return[Fv,Ba];case"DataView":return[cl,r]}return r.includes("Array")?[cl,r]:t instanceof Error?[uS,t.name||"Error"]:[Gc,r]},cc=([t,e])=>t===md&&(e==="function"||e==="symbol"),fI=(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]=el(o);switch(a){case md:{let c=o;switch(l){case"bigint":a=cS,c=o.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+l);c=null;break;case"undefined":return i([lS],o)}return i([a,c],o)}case cl:{if(l){let g=o;return l==="DataView"?g=new Uint8Array(o.buffer):l==="ArrayBuffer"&&(g=new Uint8Array(o)),i([l,[...g]],o)}const c=[],d=i([a,c],o);for(const g of o)c.push(s(g));return d}case Gc:{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=[],d=i([a,c],o);for(const g of hI(o))(t||!cc(el(o[g])))&&c.push([s(g),s(o[g])]);return d}case Ov:return i([a,isNaN(o.getTime())?Ba:o.toISOString()],o);case Bv:{const{source:c,flags:d}=o;return i([a,{source:c,flags:d}],o)}case jv:{const c=[],d=i([a,c],o);for(const[g,f]of o)(t||!(cc(el(g))||cc(el(f))))&&c.push([s(g),s(f)]);return d}case Fv:{const c=[],d=i([a,c],o);for(const g of o)(t||!cc(el(g)))&&c.push(s(g));return d}}const{message:u}=o;return i([a,{name:l,message:u}],o)};return s},Qb=(t,{json:e,lossy:r}={})=>{const n=[];return fI(!(e||r),!!e,new Map,n)(t),n},qc=typeof structuredClone=="function"?(t,e)=>e&&("json"in e||"lossy"in e)?Xb(Qb(t,e)):structuredClone(t):(t,e)=>Xb(Qb(t,e));function pI(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 gI(t,e){return"Back to reference "+(t+1)+(e>1?"-"+e:"")}function vI(t){const e=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",r=t.options.footnoteBackContent||pI,n=t.options.footnoteBackLabel||gI,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),d=String(u.identifier).toUpperCase(),g=io(d.toLowerCase());let f=0;const y=[],_=t.footnoteCounts.get(d);for(;_!==void 0&&++f<=_;){y.length>0&&y.push({type:"text",value:" "});let x=typeof r=="string"?r:r(l,f);typeof x=="string"&&(x={type:"text",value:x}),y.push({type:"element",tagName:"a",properties:{href:"#"+e+"fnref-"+g+(f>1?"-"+f:""),dataFootnoteBackref:"",ariaLabel:typeof n=="string"?n:n(l,f),className:["data-footnote-backref"]},children:Array.isArray(x)?x:[x]})}const v=c[c.length-1];if(v&&v.type==="element"&&v.tagName==="p"){const x=v.children[v.children.length-1];x&&x.type==="text"?x.value+=" ":v.children.push({type:"text",value:" "}),v.children.push(...y)}else c.push(...y);const m={type:"element",tagName:"li",properties:{id:e+"fn-"+g},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:{...qc(o),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:`
|
|
399
|
-
`},{type:"element",tagName:"ol",properties:{},children:t.wrap(a,!0)},{type:"text",value:`
|
|
400
|
-
`}]}}const yd=(function(t){if(t==null)return bI;if(typeof t=="function")return xd(t);if(typeof t=="object")return Array.isArray(t)?mI(t):yI(t);if(typeof t=="string")return xI(t);throw new Error("Expected function, string, or object as test")});function mI(t){const e=[];let r=-1;for(;++r<t.length;)e[r]=yd(t[r]);return xd(n);function n(...i){let s=-1;for(;++s<e.length;)if(e[s].apply(this,i))return!0;return!1}}function yI(t){const e=t;return xd(r);function r(n){const i=n;let s;for(s in t)if(i[s]!==e[s])return!1;return!0}}function xI(t){return xd(e);function e(r){return r&&r.type===t}}function xd(t){return e;function e(r,n,i){return!!(wI(r)&&t.call(this,r,typeof n=="number"?n:void 0,i||void 0))}}function bI(){return!0}function wI(t){return t!==null&&typeof t=="object"&&"type"in t}const hS=[],_I=!0,$g=!1,SI="skip";function fS(t,e,r,n){let i;typeof e=="function"&&typeof r!="function"?(n=r,r=e):i=e;const s=yd(i),o=n?-1:1;a(t,void 0,[])();function a(l,u,c){const d=l&&typeof l=="object"?l:{};if(typeof d.type=="string"){const f=typeof d.tagName=="string"?d.tagName:typeof d.name=="string"?d.name:void 0;Object.defineProperty(g,"name",{value:"node ("+(l.type+(f?"<"+f+">":""))+")"})}return g;function g(){let f=hS,y,_,v;if((!e||s(l,u,c[c.length-1]||void 0))&&(f=CI(r(l,c)),f[0]===$g))return f;if("children"in l&&l.children){const m=l;if(m.children&&f[0]!==SI)for(_=(n?m.children.length:-1)+o,v=c.concat(m);_>-1&&_<m.children.length;){const x=m.children[_];if(y=a(x,_,v)(),y[0]===$g)return y;_=typeof y[1]=="number"?y[1]:_+o}}return f}}}function CI(t){return Array.isArray(t)?t:typeof t=="number"?[_I,t]:t==null?hS:[t]}function zv(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),fS(t,s,a,i);function a(l,u){const c=u[u.length-1],d=c?c.children.indexOf(l):void 0;return o(l,d,c)}}const Wg={}.hasOwnProperty,kI={};function EI(t,e){const r=e||kI,n=new Map,i=new Map,s=new Map,o={...uI,...r.handlers},a={all:u,applyData:NI,definitionById:n,footnoteById:i,footnoteCounts:s,footnoteOrder:[],handlers:o,one:l,options:r,patch:TI,wrap:LI};return zv(t,function(c){if(c.type==="definition"||c.type==="footnoteDefinition"){const d=c.type==="definition"?n:i,g=String(c.identifier).toUpperCase();d.has(g)||d.set(g,c)}}),a;function l(c,d){const g=c.type,f=a.handlers[g];if(Wg.call(a.handlers,g)&&f)return f(a,c,d);if(a.options.passThrough&&a.options.passThrough.includes(g)){if("children"in c){const{children:_,...v}=c,m=qc(v);return m.children=a.all(c),m}return qc(c)}return(a.options.unknownHandler||RI)(a,c,d)}function u(c){const d=[];if("children"in c){const g=c.children;let f=-1;for(;++f<g.length;){const y=a.one(g[f],c);if(y){if(f&&g[f-1].type==="break"&&(!Array.isArray(y)&&y.type==="text"&&(y.value=Zb(y.value)),!Array.isArray(y)&&y.type==="element")){const _=y.children[0];_&&_.type==="text"&&(_.value=Zb(_.value))}Array.isArray(y)?d.push(...y):d.push(y)}}}return d}}function TI(t,e){t.position&&(e.position=g4(t))}function NI(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,qc(s)),"children"in r&&r.children&&i!==null&&i!==void 0&&(r.children=i)}return r}function RI(t,e){const r=e.data||{},n="value"in e&&!(Wg.call(r,"hProperties")||Wg.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 LI(t,e){const r=[];let n=-1;for(e&&r.push({type:"text",value:`
|
|
401
|
-
`});++n<t.length;)n&&r.push({type:"text",value:`
|
|
402
|
-
`}),r.push(t[n]);return e&&t.length>0&&r.push({type:"text",value:`
|
|
403
|
-
`}),r}function Zb(t){let e=0,r=t.charCodeAt(e);for(;r===9||r===32;)e++,r=t.charCodeAt(e);return t.slice(e)}function Jb(t,e){const r=EI(t,e),n=r.one(t,void 0),i=vI(r),s=Array.isArray(n)?{type:"root",children:n}:n||{type:"root",children:[]};return i&&s.children.push({type:"text",value:`
|
|
404
|
-
`},i),s}function DI(t,e){return t&&"run"in t?async function(r,n){const i=Jb(r,{file:n,...e});await t.run(i,n)}:function(r,n){return Jb(r,{file:n,...t||e})}}function ew(t){if(t)throw t}var Qp,tw;function AI(){if(tw)return Qp;tw=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"),d=u.constructor&&u.constructor.prototype&&t.call(u.constructor.prototype,"isPrototypeOf");if(u.constructor&&!c&&!d)return!1;var g;for(g in u);return typeof g>"u"||t.call(u,g)},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,d,g,f,y,_=arguments[0],v=1,m=arguments.length,x=!1;for(typeof _=="boolean"&&(x=_,_=arguments[1]||{},v=2),(_==null||typeof _!="object"&&typeof _!="function")&&(_={});v<m;++v)if(u=arguments[v],u!=null)for(c in u)d=a(_,c),g=a(u,c),_!==g&&(x&&g&&(s(g)||(f=i(g)))?(f?(f=!1,y=d&&i(d)?d:[]):y=d&&s(d)?d:{},o(_,{name:c,newValue:l(x,y,g)})):typeof g<"u"&&o(_,{name:c,newValue:g}));return _},Qp}var PI=AI();const Zp=Kc(PI);function Vg(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 MI(){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 d=-1;if(l){o(l);return}for(;++d<i.length;)(u[d]===null||u[d]===void 0)&&(u[d]=i[d]);i=u,c?II(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 II(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 Zn={basename:OI,dirname:BI,extname:jI,join:FI,sep:"/"};function OI(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');Fl(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 BI(t){if(Fl(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 jI(t){Fl(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 FI(...t){let e=-1,r;for(;++e<t.length;)Fl(t[e]),t[e]&&(r=r===void 0?t[e]:r+"/"+t[e]);return r===void 0?".":zI(r)}function zI(t){Fl(t);const e=t.codePointAt(0)===47;let r=HI(t,!e);return r.length===0&&!e&&(r="."),r.length>0&&t.codePointAt(t.length-1)===47&&(r+="/"),e?"/"+r:r}function HI(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 Fl(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const UI={cwd:$I};function $I(){return"/"}function Gg(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function WI(t){if(typeof t=="string")t=new URL(t);else if(!Gg(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 VI(t)}function VI(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 Jp=["history","path","basename","stem","extname","dirname"];class pS{constructor(e){let r;e?Gg(e)?r={path:e}:typeof e=="string"||GI(e)?r={value:e}:r=e:r={},this.cwd="cwd"in r?"":UI.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<Jp.length;){const s=Jp[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)Jp.includes(i)||(this[i]=r[i])}get basename(){return typeof this.path=="string"?Zn.basename(this.path):void 0}set basename(e){tg(e,"basename"),eg(e,"basename"),this.path=Zn.join(this.dirname||"",e)}get dirname(){return typeof this.path=="string"?Zn.dirname(this.path):void 0}set dirname(e){rw(this.basename,"dirname"),this.path=Zn.join(e||"",this.basename)}get extname(){return typeof this.path=="string"?Zn.extname(this.path):void 0}set extname(e){if(eg(e,"extname"),rw(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=Zn.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){Gg(e)&&(e=WI(e)),tg(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path=="string"?Zn.basename(this.path,this.extname):void 0}set stem(e){tg(e,"stem"),eg(e,"stem"),this.path=Zn.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 eg(t,e){if(t&&t.includes(Zn.sep))throw new Error("`"+e+"` cannot be a path: did not expect `"+Zn.sep+"`")}function tg(t,e){if(!t)throw new Error("`"+e+"` cannot be empty")}function rw(t,e){if(!t)throw new Error("Setting `"+e+"` requires `path` to be set too")}function GI(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const qI=(function(t){const n=this.constructor.prototype,i=n[t],s=function(){return i.apply(s,arguments)};return Object.setPrototypeOf(s,n),s}),YI={}.hasOwnProperty;class Hv extends qI{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=MI()}copy(){const e=new Hv;let r=-1;for(;++r<this.attachers.length;){const n=this.attachers[r];e.use(...n)}return e.data(Zp(!0,{},this.namespace)),e}data(e,r){return typeof e=="string"?arguments.length===2?(ig("data",this.frozen),this.namespace[e]=r,this):YI.call(this.namespace,e)&&this.namespace[e]||void 0:e?(ig("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=dc(e),n=this.parser||this.Parser;return rg("parse",n),n(String(r),r)}process(e,r){const n=this;return this.freeze(),rg("process",this.parser||this.Parser),ng("process",this.compiler||this.Compiler),r?i(void 0,r):new Promise(i);function i(s,o){const a=dc(e),l=n.parse(a);n.run(l,a,function(c,d,g){if(c||!d||!g)return u(c);const f=d,y=n.stringify(f,g);QI(y)?g.value=y:g.result=y,u(c,g)});function u(c,d){c||!d?o(c):s?s(d):r(void 0,d)}}}processSync(e){let r=!1,n;return this.freeze(),rg("processSync",this.parser||this.Parser),ng("processSync",this.compiler||this.Compiler),this.process(e,i),iw("processSync","process",r),n;function i(s,o){r=!0,ew(s),n=o}}run(e,r,n){nw(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=dc(r);i.run(e,l,u);function u(c,d,g){const f=d||e;c?a(c):o?o(f):n(void 0,f,g)}}}runSync(e,r){let n=!1,i;return this.run(e,r,s),iw("runSync","run",n),i;function s(o,a){ew(o),i=a,n=!0}}stringify(e,r){this.freeze();const n=dc(r),i=this.compiler||this.Compiler;return ng("stringify",i),nw(e),i(e,n)}use(e,...r){const n=this.attachers,i=this.namespace;if(ig("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,...d]=u;l(c,d)}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=Zp(!0,i.settings,u.settings))}function a(u){let c=-1;if(u!=null)if(Array.isArray(u))for(;++c<u.length;){const d=u[c];s(d)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function l(u,c){let d=-1,g=-1;for(;++d<n.length;)if(n[d][0]===u){g=d;break}if(g===-1)n.push([u,...c]);else if(c.length>0){let[f,...y]=c;const _=n[g][1];Vg(_)&&Vg(f)&&(f=Zp(!0,_,f)),n[g]=[u,f,...y]}}}}const KI=new Hv().freeze();function rg(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function ng(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function ig(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 nw(t){if(!Vg(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function iw(t,e,r){if(!r)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function dc(t){return XI(t)?t:new pS(t)}function XI(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function QI(t){return typeof t=="string"||ZI(t)}function ZI(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const JI="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",aw=[],sw={allowDangerousHtml:!0},eO=/^(https?|ircs?|mailto|xmpp)$/i,tO=[{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 rO(t){const e=nO(t),r=iO(t);return aO(e.runSync(e.parse(r),r),t)}function nO(t){const e=t.rehypePlugins||aw,r=t.remarkPlugins||aw,n=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...sw}:sw;return KI().use(BM).use(r).use(DI,n).use(e)}function iO(t){const e=t.children||"",r=new pS;return typeof e=="string"&&(r.value=e),r}function aO(t,e){const r=e.allowedElements,n=e.allowElement,i=e.components,s=e.disallowedElements,o=e.skipHtml,a=e.unwrapDisallowed,l=e.urlTransform||sO;for(const c of tO)Object.hasOwn(e,c.from)&&(""+c.from+(c.to?"use `"+c.to+"` instead":"remove it")+JI+c.id,void 0);return zv(t,u),b4(t,{Fragment:w.Fragment,components:i,ignoreInvalidStyle:!0,jsx:w.jsx,jsxs:w.jsxs,passKeys:!0,passNode:!0});function u(c,d,g){if(c.type==="raw"&&g&&typeof d=="number")return o?g.children.splice(d,1):g.children[d]={type:"text",value:c.value},d;if(c.type==="element"){let f;for(f in Yp)if(Object.hasOwn(Yp,f)&&Object.hasOwn(c.properties,f)){const y=c.properties[f],_=Yp[f];(_===null||_.includes(c.tagName))&&(c.properties[f]=l(String(y||""),f,c))}}if(c.type==="element"){let f=r?!r.includes(c.tagName):s?s.includes(c.tagName):!1;if(!f&&n&&typeof d=="number"&&(f=!n(c,d,g)),f&&g&&typeof d=="number")return a&&c.children?g.children.splice(d,1,...c.children):g.children.splice(d,1),d}}}function sO(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||eO.test(t.slice(0,e))?t:""}function ow(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 oO(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function lO(t,e,r){const i=yd((r||{}).ignore||[]),s=uO(e);let o=-1;for(;++o<s.length;)fS(t,"text",a);function a(u,c){let d=-1,g;for(;++d<c.length;){const f=c[d],y=g?g.children:void 0;if(i(f,y?y.indexOf(f):void 0,g))return;g=f}if(g)return l(u,c)}function l(u,c){const d=c[c.length-1],g=s[o][0],f=s[o][1];let y=0;const v=d.children.indexOf(u);let m=!1,x=[];g.lastIndex=0;let b=g.exec(u.value);for(;b;){const S=b.index,T={index:b.index,input:b.input,stack:[...c,u]};let N=f(...b,T);if(typeof N=="string"&&(N=N.length>0?{type:"text",value:N}:void 0),N===!1?g.lastIndex=S+1:(y!==S&&x.push({type:"text",value:u.value.slice(y,S)}),Array.isArray(N)?x.push(...N):N&&x.push(N),y=S+b[0].length,m=!0),!g.global)break;b=g.exec(u.value)}return m?(y<u.value.length&&x.push({type:"text",value:u.value.slice(y)}),d.children.splice(v,1,...x)):x=[u],v+x.length}}function uO(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([cO(i[0]),dO(i[1])])}return e}function cO(t){return typeof t=="string"?new RegExp(oO(t),"g"):t}function dO(t){return typeof t=="function"?t:function(){return t}}const ag="phrasing",sg=["autolink","link","image","label"];function hO(){return{transforms:[xO],enter:{literalAutolink:pO,literalAutolinkEmail:og,literalAutolinkHttp:og,literalAutolinkWww:og},exit:{literalAutolink:yO,literalAutolinkEmail:mO,literalAutolinkHttp:gO,literalAutolinkWww:vO}}}function fO(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:ag,notInConstruct:sg},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:ag,notInConstruct:sg},{character:":",before:"[ps]",after:"\\/",inConstruct:ag,notInConstruct:sg}]}}function pO(t){this.enter({type:"link",title:null,url:"",children:[]},t)}function og(t){this.config.enter.autolinkProtocol.call(this,t)}function gO(t){this.config.exit.autolinkProtocol.call(this,t)}function vO(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 mO(t){this.config.exit.autolinkEmail.call(this,t)}function yO(t){this.exit(t)}function xO(t){lO(t,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,bO],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),wO]],{ignore:["link","linkReference"]})}function bO(t,e,r,n,i){let s="";if(!gS(i)||(/^w/i.test(e)&&(r=e+r,e="",s="http://"),!_O(r)))return!1;const o=SO(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 wO(t,e,r,n){return!gS(n,!0)||/[-\d_]$/.test(r)?!1:{type:"link",title:null,url:"mailto:"+e+"@"+r,children:[{type:"text",value:e+"@"+r}]}}function _O(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 SO(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=ow(t,"(");let s=ow(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 gS(t,e){const r=t.input.charCodeAt(t.index-1);return(t.index===0||Ya(r)||gd(r))&&(!e||r!==47)}vS.peek=AO;function CO(){this.buffer()}function kO(t){this.enter({type:"footnoteReference",identifier:"",label:""},t)}function EO(){this.buffer()}function TO(t){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},t)}function NO(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 RO(t){this.exit(t)}function LO(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 DO(t){this.exit(t)}function AO(){return"["}function vS(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 PO(){return{enter:{gfmFootnoteCallString:CO,gfmFootnoteCall:kO,gfmFootnoteDefinitionLabelString:EO,gfmFootnoteDefinition:TO},exit:{gfmFootnoteCallString:NO,gfmFootnoteCall:RO,gfmFootnoteDefinitionLabelString:LO,gfmFootnoteDefinition:DO}}}function MO(t){let e=!1;return t&&t.firstLineBlank&&(e=!0),{handlers:{footnoteDefinition:r,footnoteReference:vS},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?`
|
|
405
|
-
`:" ")+s.indentLines(s.containerFlow(n,a.current()),e?mS:IO))),u(),l}}function IO(t,e,r){return e===0?t:mS(t,e,r)}function mS(t,e,r){return(r?"":" ")+t}const OO=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];yS.peek=HO;function BO(){return{canContainEols:["delete"],enter:{strikethrough:FO},exit:{strikethrough:zO}}}function jO(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:OO}],handlers:{delete:yS}}}function FO(t){this.enter({type:"delete",children:[]},t)}function zO(t){this.exit(t)}function yS(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 HO(){return"~"}function UO(t){return t.length}function $O(t,e){const r=e||{},n=(r.align||[]).concat(),i=r.stringLength||UO,s=[],o=[],a=[],l=[];let u=0,c=-1;for(;++c<t.length;){const _=[],v=[];let m=-1;for(t[c].length>u&&(u=t[c].length);++m<t[c].length;){const x=WO(t[c][m]);if(r.alignDelimiters!==!1){const b=i(x);v[m]=b,(l[m]===void 0||b>l[m])&&(l[m]=b)}_.push(x)}o[c]=_,a[c]=v}let d=-1;if(typeof n=="object"&&"length"in n)for(;++d<u;)s[d]=lw(n[d]);else{const _=lw(n);for(;++d<u;)s[d]=_}d=-1;const g=[],f=[];for(;++d<u;){const _=s[d];let v="",m="";_===99?(v=":",m=":"):_===108?v=":":_===114&&(m=":");let x=r.alignDelimiters===!1?1:Math.max(1,l[d]-v.length-m.length);const b=v+"-".repeat(x)+m;r.alignDelimiters!==!1&&(x=v.length+x+m.length,x>l[d]&&(l[d]=x),f[d]=x),g[d]=b}o.splice(1,0,g),a.splice(1,0,f),c=-1;const y=[];for(;++c<o.length;){const _=o[c],v=a[c];d=-1;const m=[];for(;++d<u;){const x=_[d]||"";let b="",S="";if(r.alignDelimiters!==!1){const T=l[d]-(v[d]||0),N=s[d];N===114?b=" ".repeat(T):N===99?T%2?(b=" ".repeat(T/2+.5),S=" ".repeat(T/2-.5)):(b=" ".repeat(T/2),S=b):S=" ".repeat(T)}r.delimiterStart!==!1&&!d&&m.push("|"),r.padding!==!1&&!(r.alignDelimiters===!1&&x==="")&&(r.delimiterStart!==!1||d)&&m.push(" "),r.alignDelimiters!==!1&&m.push(b),m.push(x),r.alignDelimiters!==!1&&m.push(S),r.padding!==!1&&m.push(" "),(r.delimiterEnd!==!1||d!==u-1)&&m.push("|")}y.push(r.delimiterEnd===!1?m.join("").replace(/ +$/,""):m.join(""))}return y.join(`
|
|
406
|
-
`)}function WO(t){return t==null?"":String(t)}function lw(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 VO(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()),GO);return i(),o}function GO(t,e,r){return">"+(r?"":" ")+t}function qO(t,e){return uw(t,e.inConstruct,!0)&&!uw(t,e.notInConstruct,!1)}function uw(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 cw(t,e,r,n){let i=-1;for(;++i<r.unsafe.length;)if(r.unsafe[i].character===`
|
|
407
|
-
`&&qO(r.stack,r.unsafe[i]))return/[ \t]/.test(n.before)?"":" ";return`\\
|
|
408
|
-
`}function YO(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 KO(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 XO(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 QO(t,e,r,n){const i=XO(r),s=t.value||"",o=i==="`"?"GraveAccent":"Tilde";if(KO(t,r)){const d=r.enter("codeIndented"),g=r.indentLines(s,ZO);return d(),g}const a=r.createTracker(n),l=i.repeat(Math.max(YO(s,i)+1,3)),u=r.enter("codeFenced");let c=a.move(l);if(t.lang){const d=r.enter(`codeFencedLang${o}`);c+=a.move(r.safe(t.lang,{before:c,after:" ",encode:["`"],...a.current()})),d()}if(t.lang&&t.meta){const d=r.enter(`codeFencedMeta${o}`);c+=a.move(" "),c+=a.move(r.safe(t.meta,{before:c,after:`
|
|
409
|
-
`,encode:["`"],...a.current()})),d()}return c+=a.move(`
|
|
410
|
-
`),s&&(c+=a.move(s+`
|
|
411
|
-
`)),c+=a.move(l),u(),c}function ZO(t,e,r){return(r?"":" ")+t}function Uv(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 JO(t,e,r,n){const i=Uv(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?" ":`
|
|
412
|
-
`,...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 eB(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 Cl(t){return"&#x"+t.toString(16).toUpperCase()+";"}function Yc(t,e,r){const n=Xs(t),i=Xs(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}}xS.peek=tB;function xS(t,e,r,n){const i=eB(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=Yc(n.before.charCodeAt(n.before.length-1),u,i);c.inside&&(l=Cl(u)+l.slice(1));const d=l.charCodeAt(l.length-1),g=Yc(n.after.charCodeAt(0),d,i);g.inside&&(l=l.slice(0,-1)+Cl(d));const f=o.move(i);return s(),r.attentionEncodeSurroundingInfo={after:g.outside,before:c.outside},a+l+f}function tB(t,e,r){return r.options.emphasis||"*"}function rB(t,e){let r=!1;return zv(t,function(n){if("value"in n&&/\r?\n|\r/.test(n.value)||n.type==="break")return r=!0,$g}),!!((!t.depth||t.depth<3)&&Pv(t)&&(e.options.setext||r))}function nB(t,e,r,n){const i=Math.max(Math.min(6,t.depth||1),1),s=r.createTracker(n);if(rB(t,r)){const c=r.enter("headingSetext"),d=r.enter("phrasing"),g=r.containerPhrasing(t,{...s.current(),before:`
|
|
413
|
-
`,after:`
|
|
414
|
-
`});return d(),c(),g+`
|
|
415
|
-
`+(i===1?"=":"-").repeat(g.length-(Math.max(g.lastIndexOf("\r"),g.lastIndexOf(`
|
|
416
|
-
`))+1))}const o="#".repeat(i),a=r.enter("headingAtx"),l=r.enter("phrasing");s.move(o+" ");let u=r.containerPhrasing(t,{before:"# ",after:`
|
|
417
|
-
`,...s.current()});return/^[\t ]/.test(u)&&(u=Cl(u.charCodeAt(0))+u.slice(1)),u=u?o+" "+u:o,r.options.closeAtx&&(u+=" "+o),l(),a(),u}bS.peek=iB;function bS(t){return t.value||""}function iB(){return"<"}wS.peek=aB;function wS(t,e,r,n){const i=Uv(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 aB(){return"!"}_S.peek=sB;function _S(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 d=r.safe(r.associationId(t),{before:l,after:"]",...a.current()});return o(),r.stack=c,s(),i==="full"||!u||u!==d?l+=a.move(d+"]"):i==="shortcut"?l=l.slice(0,-1):l+=a.move("]"),l}function sB(){return"!"}SS.peek=oB;function SS(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 oB(){return"`"}function CS(t,e){const r=Pv(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))}kS.peek=lB;function kS(t,e,r,n){const i=Uv(r),s=i==='"'?"Quote":"Apostrophe",o=r.createTracker(n);let a,l;if(CS(t,r)){const c=r.stack;r.stack=[],a=r.enter("autolink");let d=o.move("<");return d+=o.move(r.containerPhrasing(t,{before:d,after:">",...o.current()})),d+=o.move(">"),a(),r.stack=c,d}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 lB(t,e,r){return CS(t,r)?"<":"["}ES.peek=uB;function ES(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 d=r.safe(r.associationId(t),{before:l,after:"]",...a.current()});return o(),r.stack=c,s(),i==="full"||!u||u!==d?l+=a.move(d+"]"):i==="shortcut"?l=l.slice(0,-1):l+=a.move("]"),l}function uB(){return"["}function $v(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 cB(t){const e=$v(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 dB(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 TS(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 hB(t,e,r,n){const i=r.enter("list"),s=r.bulletCurrent;let o=t.ordered?dB(r):$v(r);const a=t.ordered?o==="."?")":".":cB(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),TS(r)===o&&c){let d=-1;for(;++d<t.children.length;){const g=t.children[d];if(g&&g.type==="listItem"&&g.children&&g.children[0]&&g.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 fB(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 pB(t,e,r,n){const i=fB(r);let s=r.bulletCurrent||$v(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(d,g,f){return g?(f?"":" ".repeat(o))+d:(f?s:s+" ".repeat(o-s.length))+d}}function gB(t,e,r,n){const i=r.enter("paragraph"),s=r.enter("phrasing"),o=r.containerPhrasing(t,n);return s(),i(),o}const vB=yd(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function mB(t,e,r,n){return(t.children.some(function(o){return vB(o)})?r.containerPhrasing:r.containerFlow).call(r,t,n)}function yB(t){const e=t.options.strong||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize strong with `"+e+"` for `options.strong`, expected `*`, or `_`");return e}NS.peek=xB;function NS(t,e,r,n){const i=yB(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=Yc(n.before.charCodeAt(n.before.length-1),u,i);c.inside&&(l=Cl(u)+l.slice(1));const d=l.charCodeAt(l.length-1),g=Yc(n.after.charCodeAt(0),d,i);g.inside&&(l=l.slice(0,-1)+Cl(d));const f=o.move(i+i);return s(),r.attentionEncodeSurroundingInfo={after:g.outside,before:c.outside},a+l+f}function xB(t,e,r){return r.options.strong||"*"}function bB(t,e,r,n){return r.safe(t.value,n)}function wB(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 _B(t,e,r){const n=(TS(r)+(r.options.ruleSpaces?" ":"")).repeat(wB(r));return r.options.ruleSpaces?n.slice(0,-1):n}const RS={blockquote:VO,break:cw,code:QO,definition:JO,emphasis:xS,hardBreak:cw,heading:nB,html:bS,image:wS,imageReference:_S,inlineCode:SS,link:kS,linkReference:ES,list:hB,listItem:pB,paragraph:gB,root:mB,strong:NS,text:bB,thematicBreak:_B};function SB(){return{enter:{table:CB,tableData:dw,tableHeader:dw,tableRow:EB},exit:{codeText:TB,table:kB,tableData:lg,tableHeader:lg,tableRow:lg}}}function CB(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 kB(t){this.exit(t),this.data.inTable=void 0}function EB(t){this.enter({type:"tableRow",children:[]},t)}function lg(t){this.exit(t)}function dw(t){this.enter({type:"tableCell",children:[]},t)}function TB(t){let e=this.resume();this.data.inTable&&(e=e.replace(/\\([\\|])/g,NB));const r=this.stack[this.stack.length-1];r.type,r.value=e,this.exit(t)}function NB(t,e){return e==="|"?e:t}function RB(t){const e=t||{},r=e.tableCellPadding,n=e.tablePipeAlign,i=e.stringLength,s=r?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
418
|
-
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:g,table:o,tableCell:l,tableRow:a}};function o(f,y,_,v){return u(c(f,_,v),f.align)}function a(f,y,_,v){const m=d(f,_,v),x=u([m]);return x.slice(0,x.indexOf(`
|
|
419
|
-
`))}function l(f,y,_,v){const m=_.enter("tableCell"),x=_.enter("phrasing"),b=_.containerPhrasing(f,{...v,before:s,after:s});return x(),m(),b}function u(f,y){return $O(f,{align:y,alignDelimiters:n,padding:r,stringLength:i})}function c(f,y,_){const v=f.children;let m=-1;const x=[],b=y.enter("table");for(;++m<v.length;)x[m]=d(v[m],y,_);return b(),x}function d(f,y,_){const v=f.children;let m=-1;const x=[],b=y.enter("tableRow");for(;++m<v.length;)x[m]=l(v[m],f,y,_);return b(),x}function g(f,y,_){let v=RS.inlineCode(f,y,_);return _.stack.includes("tableCell")&&(v=v.replace(/\|/g,"\\$&")),v}}function LB(){return{exit:{taskListCheckValueChecked:hw,taskListCheckValueUnchecked:hw,paragraph:AB}}}function DB(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:PB}}}function hw(t){const e=this.stack[this.stack.length-2];e.type,e.checked=t.type==="taskListCheckValueChecked"}function AB(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 PB(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=RS.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 MB(){return[hO(),PO(),BO(),SB(),LB()]}function IB(t){return{extensions:[fO(),MO(t),jO(),RB(t),DB()]}}const OB={tokenize:UB,partial:!0},LS={tokenize:$B,partial:!0},DS={tokenize:WB,partial:!0},AS={tokenize:VB,partial:!0},BB={tokenize:GB,partial:!0},PS={name:"wwwAutolink",tokenize:zB,previous:IS},MS={name:"protocolAutolink",tokenize:HB,previous:OS},Si={name:"emailAutolink",tokenize:FB,previous:BS},ai={};function jB(){return{text:ai}}let Pa=48;for(;Pa<123;)ai[Pa]=Si,Pa++,Pa===58?Pa=65:Pa===91&&(Pa=97);ai[43]=Si;ai[45]=Si;ai[46]=Si;ai[95]=Si;ai[72]=[Si,MS];ai[104]=[Si,MS];ai[87]=[Si,PS];ai[119]=[Si,PS];function FB(t,e,r){const n=this;let i,s;return o;function o(d){return!qg(d)||!BS.call(n,n.previous)||Wv(n.events)?r(d):(t.enter("literalAutolink"),t.enter("literalAutolinkEmail"),a(d))}function a(d){return qg(d)?(t.consume(d),a):d===64?(t.consume(d),l):r(d)}function l(d){return d===46?t.check(BB,c,u)(d):d===45||d===95||Hr(d)?(s=!0,t.consume(d),l):c(d)}function u(d){return t.consume(d),i=!0,l}function c(d){return s&&i&&Qr(n.previous)?(t.exit("literalAutolinkEmail"),t.exit("literalAutolink"),e(d)):r(d)}}function zB(t,e,r){const n=this;return i;function i(o){return o!==87&&o!==119||!IS.call(n,n.previous)||Wv(n.events)?r(o):(t.enter("literalAutolink"),t.enter("literalAutolinkWww"),t.check(OB,t.attempt(LS,t.attempt(DS,s),r),r)(o))}function s(o){return t.exit("literalAutolinkWww"),t.exit("literalAutolink"),e(o)}}function HB(t,e,r){const n=this;let i="",s=!1;return o;function o(d){return(d===72||d===104)&&OS.call(n,n.previous)&&!Wv(n.events)?(t.enter("literalAutolink"),t.enter("literalAutolinkHttp"),i+=String.fromCodePoint(d),t.consume(d),a):r(d)}function a(d){if(Qr(d)&&i.length<5)return i+=String.fromCodePoint(d),t.consume(d),a;if(d===58){const g=i.toLowerCase();if(g==="http"||g==="https")return t.consume(d),l}return r(d)}function l(d){return d===47?(t.consume(d),s?u:(s=!0,l)):r(d)}function u(d){return d===null||Vc(d)||qt(d)||Ya(d)||gd(d)?r(d):t.attempt(LS,t.attempt(DS,c),r)(d)}function c(d){return t.exit("literalAutolinkHttp"),t.exit("literalAutolink"),e(d)}}function UB(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 $B(t,e,r){let n,i,s;return o;function o(u){return u===46||u===95?t.check(AS,l,a)(u):u===null||qt(u)||Ya(u)||u!==45&&gd(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 WB(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(AS,e,s)(o):o===null||qt(o)||Ya(o)?e(o):(t.consume(o),i)}function s(o){return o===41&&n++,t.consume(o),i}}function VB(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||qt(a)||Ya(a)?e(a):r(a)}function i(a){return a===null||a===40||a===91||qt(a)||Ya(a)?e(a):n(a)}function s(a){return Qr(a)?o(a):r(a)}function o(a){return a===59?(t.consume(a),n):Qr(a)?(t.consume(a),o):r(a)}}function GB(t,e,r){return n;function n(s){return t.consume(s),i}function i(s){return Hr(s)?r(s):e(s)}}function IS(t){return t===null||t===40||t===42||t===95||t===91||t===93||t===126||qt(t)}function OS(t){return!Qr(t)}function BS(t){return!(t===47||qg(t))}function qg(t){return t===43||t===45||t===46||t===95||Hr(t)}function Wv(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 qB={tokenize:tj,partial:!0};function YB(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:ZB,continuation:{tokenize:JB},exit:ej}},text:{91:{name:"gfmFootnoteCall",tokenize:QB},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:KB,resolveTo:XB}}}}function KB(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 XB(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 QB(t,e,r){const n=this,i=n.parser.gfmFootnotes||(n.parser.gfmFootnotes=[]);let s=0,o;return a;function a(d){return t.enter("gfmFootnoteCall"),t.enter("gfmFootnoteCallLabelMarker"),t.consume(d),t.exit("gfmFootnoteCallLabelMarker"),l}function l(d){return d!==94?r(d):(t.enter("gfmFootnoteCallMarker"),t.consume(d),t.exit("gfmFootnoteCallMarker"),t.enter("gfmFootnoteCallString"),t.enter("chunkString").contentType="string",u)}function u(d){if(s>999||d===93&&!o||d===null||d===91||qt(d))return r(d);if(d===93){t.exit("chunkString");const g=t.exit("gfmFootnoteCallString");return i.includes(Hn(n.sliceSerialize(g)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(d),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),e):r(d)}return qt(d)||(o=!0),s++,t.consume(d),d===92?c:u}function c(d){return d===91||d===92||d===93?(t.consume(d),s++,u):u(d)}}function ZB(t,e,r){const n=this,i=n.parser.gfmFootnotes||(n.parser.gfmFootnotes=[]);let s,o=0,a;return l;function l(y){return t.enter("gfmFootnoteDefinition")._container=!0,t.enter("gfmFootnoteDefinitionLabel"),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(y),t.exit("gfmFootnoteDefinitionLabelMarker"),u}function u(y){return y===94?(t.enter("gfmFootnoteDefinitionMarker"),t.consume(y),t.exit("gfmFootnoteDefinitionMarker"),t.enter("gfmFootnoteDefinitionLabelString"),t.enter("chunkString").contentType="string",c):r(y)}function c(y){if(o>999||y===93&&!a||y===null||y===91||qt(y))return r(y);if(y===93){t.exit("chunkString");const _=t.exit("gfmFootnoteDefinitionLabelString");return s=Hn(n.sliceSerialize(_)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(y),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),g}return qt(y)||(a=!0),o++,t.consume(y),y===92?d:c}function d(y){return y===91||y===92||y===93?(t.consume(y),o++,c):c(y)}function g(y){return y===58?(t.enter("definitionMarker"),t.consume(y),t.exit("definitionMarker"),i.includes(s)||i.push(s),Lt(t,f,"gfmFootnoteDefinitionWhitespace")):r(y)}function f(y){return e(y)}}function JB(t,e,r){return t.check(jl,e,t.attempt(qB,e,r))}function ej(t){t.exit("gfmFootnoteDefinition")}function tj(t,e,r){const n=this;return Lt(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 rj(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)},d={type:"strikethroughText",start:Object.assign({},o[u][1].end),end:Object.assign({},o[l][1].start)},g=[["enter",c,a],["enter",o[u][1],a],["exit",o[u][1],a],["enter",d,a]],f=a.parser.constructs.insideSpan.null;f&&yn(g,g.length,0,vd(f,o.slice(u+1,l),a)),yn(g,g.length,0,[["exit",d,a],["enter",o[l][1],a],["exit",o[l][1],a],["exit",c,a]]),yn(o,u-1,l-u+3,g),l=u+g.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 d=0;return g;function g(y){return u===126&&c[c.length-1][1].type!=="characterEscape"?l(y):(o.enter("strikethroughSequenceTemporary"),f(y))}function f(y){const _=Xs(u);if(y===126)return d>1?l(y):(o.consume(y),d++,f);if(d<2&&!r)return l(y);const v=o.exit("strikethroughSequenceTemporary"),m=Xs(y);return v._open=!m||m===2&&!!_,v._close=!_||_===2&&!!m,a(y)}}}class nj{constructor(){this.map=[]}add(e,r,n){ij(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 ij(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 aj(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 sj(){return{flow:{null:{name:"table",tokenize:oj,resolveAll:lj}}}}function oj(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 O=I>-1?n.events[I][1].type:null,B=O==="tableHead"||O==="tableRow"?N:l;return B===N&&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):gt(A)?s>1?(s=0,n.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(A),t.exit("lineEnding"),f):r(A):kt(A)?Lt(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"),d(A)))}function d(A){return A===null||A===124||qt(A)?(t.exit("data"),c(A)):(t.consume(A),A===92?g:d)}function g(A){return A===92||A===124?(t.consume(A),d):d(A)}function f(A){return n.interrupt=!1,n.parser.lazy[n.now().line]?r(A):(t.enter("tableDelimiterRow"),o=!1,kt(A)?Lt(t,y,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(A):y(A))}function y(A){return A===45||A===58?v(A):A===124?(o=!0,t.enter("tableCellDivider"),t.consume(A),t.exit("tableCellDivider"),_):T(A)}function _(A){return kt(A)?Lt(t,v,"whitespace")(A):v(A)}function v(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||gt(A)?S(A):T(A)}function m(A){return A===45?(t.enter("tableDelimiterFiller"),x(A)):T(A)}function x(A){return A===45?(t.consume(A),x):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 kt(A)?Lt(t,S,"whitespace")(A):S(A)}function S(A){return A===124?y(A):A===null||gt(A)?!o||i!==s?T(A):(t.exit("tableDelimiterRow"),t.exit("tableHead"),e(A)):T(A)}function T(A){return r(A)}function N(A){return t.enter("tableRow"),E(A)}function E(A){return A===124?(t.enter("tableCellDivider"),t.consume(A),t.exit("tableCellDivider"),E):A===null||gt(A)?(t.exit("tableRow"),e(A)):kt(A)?Lt(t,E,"whitespace")(A):(t.enter("data"),k(A))}function k(A){return A===null||A===124||qt(A)?(t.exit("data"),E(A)):(t.consume(A),A===92?L:k)}function L(A){return A===92||A===124?(t.consume(A),k):k(A)}}function lj(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,d;const g=new nj;for(;++r<t.length;){const f=t[r],y=f[1];f[0]==="enter"?y.type==="tableHead"?(a=!1,l!==0&&(fw(g,e,l,u,c),c=void 0,l=0),u={type:"table",start:Object.assign({},y.start),end:Object.assign({},y.end)},g.add(r,0,[["enter",u,e]])):y.type==="tableRow"||y.type==="tableDelimiterRow"?(n=!0,d=void 0,s=[0,0,0,0],o=[0,r+1,0,0],a&&(a=!1,c={type:"tableBody",start:Object.assign({},y.start),end:Object.assign({},y.end)},g.add(r,0,[["enter",c,e]])),i=y.type==="tableDelimiterRow"?2:c?3:1):i&&(y.type==="data"||y.type==="tableDelimiterMarker"||y.type==="tableDelimiterFiller")?(n=!1,o[2]===0&&(s[1]!==0&&(o[0]=o[1],d=hc(g,e,s,i,void 0,d),s=[0,0,0,0]),o[2]=r)):y.type==="tableCellDivider"&&(n?n=!1:(s[1]!==0&&(o[0]=o[1],d=hc(g,e,s,i,void 0,d)),s=o,o=[s[1],r,0,0])):y.type==="tableHead"?(a=!0,l=r):y.type==="tableRow"||y.type==="tableDelimiterRow"?(l=r,s[1]!==0?(o[0]=o[1],d=hc(g,e,s,i,r,d)):o[1]!==0&&(d=hc(g,e,o,i,r,d)),i=0):i&&(y.type==="data"||y.type==="tableDelimiterMarker"||y.type==="tableDelimiterFiller")&&(o[3]=r)}for(l!==0&&fw(g,e,l,u,c),g.consume(e.events),r=-1;++r<e.events.length;){const f=e.events[r];f[0]==="enter"&&f[1].type==="table"&&(f[1]._align=aj(e.events,r))}return t}function hc(t,e,r,n,i,s){const o=n===1?"tableHeader":n===2?"tableDelimiter":"tableData",a="tableContent";r[0]!==0&&(s.end=Object.assign({},Os(e.events,r[0])),t.add(r[0],0,[["exit",s,e]]));const l=Os(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=Os(e.events,r[2]),c=Os(e.events,r[3]),d={type:a,start:Object.assign({},u),end:Object.assign({},c)};if(t.add(r[2],0,[["enter",d,e]]),n!==2){const g=e.events[r[2]],f=e.events[r[3]];if(g[1].end=Object.assign({},f[1].end),g[1].type="chunkText",g[1].contentType="text",r[3]>r[2]+1){const y=r[2]+1,_=r[3]-r[2]-1;t.add(y,_,[])}}t.add(r[3]+1,0,[["exit",d,e]])}return i!==void 0&&(s.end=Object.assign({},Os(e.events,i)),t.add(i,0,[["exit",s,e]]),s=void 0),s}function fw(t,e,r,n,i){const s=[],o=Os(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 Os(t,e){const r=t[e],n=r[0]==="enter"?"start":"end";return r[1][n]}const uj={name:"tasklistCheck",tokenize:dj};function cj(){return{text:{91:uj}}}function dj(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 qt(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 gt(l)?e(l):kt(l)?t.check({tokenize:hj},e,r)(l):r(l)}}function hj(t,e,r){return Lt(t,n,"whitespace");function n(i){return i===null?r(i):e(i)}}function fj(t){return q2([jB(),YB(),rj(t),sj(),cj()])}const pj={};function gj(t){const e=this,r=t||pj,n=e.data(),i=n.micromarkExtensions||(n.micromarkExtensions=[]),s=n.fromMarkdownExtensions||(n.fromMarkdownExtensions=[]),o=n.toMarkdownExtensions||(n.toMarkdownExtensions=[]);i.push(fj(r)),s.push(MB()),o.push(IB(r))}const vj={h1:({children:t})=>w.jsx("h1",{className:"text-lg font-bold mt-4 mb-2",style:{color:"#e6edf3"},children:t}),h2:({children:t})=>w.jsx("h2",{className:"text-base font-bold mt-3 mb-1.5",style:{color:"#e6edf3"},children:t}),h3:({children:t})=>w.jsx("h3",{className:"text-sm font-semibold mt-2 mb-1",style:{color:"#e6edf3"},children:t}),p:({children:t})=>w.jsx("p",{className:"mb-2 last:mb-0 leading-relaxed",children:t}),a:({href:t,children:e})=>w.jsx("a",{href:t,target:"_blank",rel:"noopener noreferrer",className:"underline",style:{color:"#79c0ff"},children:e}),img:({alt:t})=>w.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(`
|
|
420
|
-
`)?w.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}):w.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})=>w.jsx("pre",{className:"my-2",children:t}),blockquote:({children:t})=>w.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})=>w.jsx("ul",{className:"list-disc pl-5 mb-2 space-y-0.5",children:t}),ol:({children:t})=>w.jsx("ol",{className:"list-decimal pl-5 mb-2 space-y-0.5",children:t}),li:({children:t})=>w.jsx("li",{className:"text-sm leading-relaxed",children:t}),table:({children:t})=>w.jsx("div",{className:"overflow-x-auto my-2",children:w.jsx("table",{className:"text-xs w-full border-collapse font-mono",children:t})}),thead:({children:t})=>w.jsx("thead",{style:{borderBottom:"1px solid rgba(230,237,243,0.12)"},children:t}),tbody:({children:t})=>w.jsx("tbody",{children:t}),tr:({children:t})=>w.jsx("tr",{style:{borderBottom:"1px solid rgba(230,237,243,0.06)"},children:t}),th:({children:t})=>w.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})=>w.jsx("td",{className:"px-3 py-1.5",style:{color:"#e6edf3"},children:t}),hr:()=>w.jsx("hr",{className:"my-3",style:{borderColor:"rgba(230,237,243,0.1)"}}),strong:({children:t})=>w.jsx("strong",{className:"font-semibold",style:{color:"#e6edf3"},children:t}),em:({children:t})=>w.jsx("em",{style:{color:"rgba(230,237,243,0.8)"},children:t})};function Vv({children:t,className:e}){return w.jsx("div",{className:`text-sm leading-relaxed ${e??""}`,style:{color:"#e6edf3"},children:w.jsx(rO,{remarkPlugins:[gj],components:vj,children:t})})}const mj={ask:"Ask",balanced:"Balanced",autonomous:"Autonomous"},yj={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"}},xj={bg:"rgba(230,237,243,0.1)",fg:"rgba(230,237,243,0.55)"};function bj(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 wj({runId:t,ord:e}){var s,o;const r=Ha(a=>a.councilStatus[`${t}:${e}`]),n=r?r.state==="convened"?`Council convened — polling ${((s=r.clis)==null?void 0:s.length)??"?"} CLI${(((o=r.clis)==null?void 0:o.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…",i=(r==null?void 0:r.failedSeats)??[];return w.jsxs("div",{className:"flex flex-col gap-1 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:[w.jsxs("div",{className:"flex items-center gap-2",children:[w.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"}}),w.jsx("span",{children:n})]}),i.length>0&&w.jsxs("div",{className:"pl-3.5",style:{color:"#fca5a5"},title:i.map(a=>`${a.cli}: ${a.why}`).join(`
|
|
421
|
-
`),children:[i.length," seat",i.length===1?"":"s"," did not vote —"," ",i.map(a=>`${a.cli} (${a.kind})`).join(", ")]})]})}function _j({runId:t,ord:e}){const r=Ha(i=>i.outputs[E2(t,e)]);if(!r)return null;const n=r.length>800?"…"+r.slice(r.length-800):r;return w.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 Sj({reason:t}){const[e,r]=J.useState(!1),[n,i]=J.useState(!1),s="degraded-routing-detail";return e?w.jsx(w.Fragment,{}):w.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:[w.jsxs("div",{className:"flex items-center gap-2",children:[w.jsx("span",{className:"shrink-0","aria-hidden":"true",children:"⚠"}),w.jsxs("span",{className:"flex-1",children:["Degraded routing: ",t]}),w.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?"▲":"▼"}),w.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:w.jsx("span",{"aria-hidden":"true",children:"✕"})})]}),n&&w.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 ",w.jsx("strong",{children:"Decisions"})," section in the Insights panel on the right to see each reviewer's verdict."]})]})}function jS({cli:t}){const{bg:e,fg:r}=yj[t.toLowerCase()]??xj;return w.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:bj(t)})}const Cj={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"}},kj={pending:"queued",distributed:"dispatched",done:"done",rejected:"rejected"};function Gv(t,e,r){return e.startsWith(`${t}:`)?e.slice(t.length+1):`u${r}`}function Ej(t,e){const r=Gv(t,e.id,e.ord);return/^u\d+$/.test(r)?e.stage:r}const Tj=new Set(["sessionStarted","sessionCompleted","sessionFailed","awaitingHuman","gateDecided","resumed","runCancelled","workerMessageQueued","workerMessageInjected"]),Nj=new Set(["stepFailed","crashRecoveryRedrive","workerStalled","failureTriaged"]);function Rj(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 Lj(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 Dj(){return w.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[w.jsx("circle",{cx:"8",cy:"8",r:"6.75",stroke:"currentColor",strokeWidth:"1.5"}),w.jsx("rect",{x:"5.25",y:"5.25",width:"5.5",height:"5.5",rx:"0.75",fill:"currentColor"})]})}function Aj(){return w.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[w.jsx("path",{d:"M8 2v7.25m0 0L5.25 6.5M8 9.25l2.75-2.75",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),w.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 Pj({runId:t,disabled:e}){const[r,n]=J.useState(!1),[i,s]=J.useState(null);async function o(){n(!0),s(null);try{await Bk(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 w.jsxs(w.Fragment,{children:[i&&w.jsxs("span",{role:"alert",className:"text-[11px] font-mono shrink-0 max-w-[14rem] truncate",style:{color:"#f85149"},children:["Export failed: ",i]}),w.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:w.jsx(Aj,{})})]})}function Mj({detail:t,onStop:e,canStop:r}){return w.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:[w.jsxs("div",{className:"flex items-center gap-2 font-semibold text-[11px] uppercase tracking-wide",children:[w.jsx("span",{children:"⚠"}),w.jsx("span",{children:"Step failure"})]}),t&&w.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}),w.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[w.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"}),w.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 Ij({attempt:t}){return w.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:[w.jsxs("div",{className:"flex items-center gap-2 font-semibold text-[11px] uppercase tracking-wide",children:[w.jsx("span",{children:"↺"}),w.jsxs("span",{children:["Crash recovery — attempt ",t]})]}),w.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 FS({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 w.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)=>w.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:mj[s]},s))})}function Oj({view:t,onNavigateBack:e}){const{session:r,units:n}=t,[i,s]=J.useState({}),o=J.useRef(new Set);return J.useEffect(()=>{for(const a of n)a.status==="done"&&!o.current.has(a.ord)&&(o.current.add(a.ord),s(l=>({...l,[a.ord]:{text:null,loading:!0,visible:!0}})),Ve.getUnitOutput(r.id,Gv(r.id,a.id,a.ord)).then(({output:l,outputUnavailable:u})=>{s(c=>({...c,[a.ord]:{text:l??u??null,loading:!1,visible:!0}}))}).catch(()=>{s(l=>({...l,[a.ord]:{text:null,loading:!1,visible:!0}}))}))},[n,r.id]),w.jsxs("div",{className:"flex flex-col h-full",children:[w.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:[w.jsx("button",{type:"button",onClick:e,"aria-label":"Back",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:a=>{a.currentTarget.style.background="rgba(230,237,243,0.06)",a.currentTarget.style.color="#e6edf3"},onMouseLeave:a=>{a.currentTarget.style.background="transparent",a.currentTarget.style.color="rgba(230,237,243,0.4)"},children:"←"}),w.jsx("p",{className:"flex-1 text-base font-semibold truncate",style:{color:"#e6edf3"},title:r.problem,children:r.problem}),w.jsx("span",{className:"text-xs font-mono",style:{color:"rgba(230,237,243,0.3)"},children:"legacy chat"})]}),w.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:[w.jsx("div",{className:"flex justify-end",children:w.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:r.problem})}),[...n].sort((a,l)=>a.ord-l.ord).map(a=>{const l=i[a.ord];return w.jsxs("div",{className:"self-start max-w-[85%] flex flex-col gap-2",children:[w.jsx("div",{className:"flex items-center gap-2",children:a.assigned_cli?w.jsxs(w.Fragment,{children:[w.jsx(jS,{cli:a.assigned_cli}),w.jsx("span",{className:"text-xs font-mono",style:{color:"rgba(230,237,243,0.55)"},children:a.assigned_cli})]}):w.jsx("span",{className:"text-xs font-mono",style:{color:"rgba(230,237,243,0.55)"},children:"agent"})}),w.jsxs("div",{className:"rounded-2xl px-5 py-4",style:{background:"#1b222e",border:"1px solid rgba(230,237,243,0.08)"},children:[(l==null?void 0:l.loading)&&w.jsx("span",{className:"text-xs font-mono",style:{color:"rgba(230,237,243,0.5)"},children:"Loading…"}),!(l!=null&&l.loading)&&(l==null?void 0:l.text)&&w.jsxs("div",{children:[w.jsx("button",{type:"button",onClick:()=>s(u=>({...u,[a.ord]:{...u[a.ord],visible:!l.visible}})),className:"text-xs font-medium font-mono hover:underline",style:{color:"#79c0ff"},children:l.visible?"▾ Hide response":"▸ View response"}),l.visible&&w.jsx("div",{className:"mt-2.5 max-h-96 overflow-auto rounded-xl p-4",style:{background:"#0d1117"},children:w.jsx(Vv,{className:"whitespace-pre-wrap",children:l.text})})]}),!(l!=null&&l.loading)&&!(l!=null&&l.text)&&w.jsx("span",{className:"text-xs font-mono",style:{color:"rgba(230,237,243,0.3)"},children:"Response not available — this session predates durable transcripts."})]})]},a.id)})]})]})}function Bj({view:t,mode:e,onModeChange:r,onLaunched:n,onNavigateBack:i,onRefresh:s,onKill:o}){const{session:a,units:l}=t,u=J.useMemo(()=>[...l].sort((M,U)=>M.ord-U.ord),[l]),c=J.useMemo(()=>Cw(a,l),[a,l]),d=ti(M=>M.gates[a.id]),g=_l(M=>M.elicitations[a.id]),f=Ha(M=>M.logs[a.id])??[],y=Ha(M=>M.executorTypes),[_,v]=J.useState("all"),m=Ha(M=>M.terminalIds),[x,b]=J.useState(null),[S,T]=J.useState({}),N=J.useRef(new Set),E=J.useRef(null);J.useEffect(()=>{var M;(M=E.current)==null||M.scrollIntoView({behavior:"smooth"})},[l.length,f.length]),J.useEffect(()=>{for(const M of l)M.status==="done"&&!N.current.has(M.ord)&&(N.current.add(M.ord),T(U=>({...U,[M.ord]:{text:null,loading:!0,visible:!0}})),Ve.getUnitOutput(a.id,Gv(a.id,M.id,M.ord)).then(({output:U,outputUnavailable:H})=>{T($=>({...$,[M.ord]:{text:U??H??"(no transcript captured)",loading:!1,visible:!0}}))}).catch(()=>{T(U=>({...U,[M.ord]:{text:"(transcript unavailable)",loading:!1,visible:!0}}))}))},[l,a.id]);function k(M){T(U=>{const H=U[M];return H?{...U,[M]:{...H,visible:!H.visible}}:U})}const L=O5[a.status]??{label:a.status,color:"rgba(230,237,243,0.5)"},A=["completed","cancelled","failed"].includes(a.status),I=f.filter(M=>Tj.has(M.type)||Nj.has(M.type)),O=Lj(a.status),B=["executing","distributing","planning","awaiting_human"].includes(a.status);function D(){o==null||o(a.id)}return w.jsxs("div",{className:"flex flex-col h-full",children:[w.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:[w.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:"←"}),w.jsx("span",{className:`w-2.5 h-2.5 rounded-full shrink-0 ${B?"animate-pulse":""}`,style:{background:O}}),w.jsx("p",{className:"flex-1 text-base font-semibold truncate",style:{color:"#e6edf3"},title:a.problem,children:a.problem}),w.jsx("span",{className:"text-xs font-medium shrink-0 font-mono",style:{color:L.color},children:L.label}),w.jsx(FS,{mode:e,onChange:r,readOnly:A}),w.jsx(Pj,{runId:a.id,disabled:!A}),!A&&o&&w.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:w.jsx(Dj,{})})]}),w.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:[g!==void 0&&w.jsx("div",{className:"self-center w-full max-w-lg",children:w.jsx(I5,{e:g},g.elicitationId)}),w.jsx("div",{className:"flex justify-end",children:w.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})}),u.flatMap(M=>{const U=S[M.ord],H=Cj[M.stage]??{bg:"rgba(230,237,243,0.08)",color:"rgba(230,237,243,0.5)"},$=a.status==="awaiting_human"&&(d==null?void 0:d.ord)===M.ord,F=w.jsxs("div",{className:"flex flex-col gap-2",children:[M.routing!==null&&M.routing.method==="council"&&w.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:[w.jsx("span",{className:"shrink-0",children:"⚖"}),w.jsxs("span",{children:[w.jsxs("span",{className:"font-semibold",children:["Council → ",M.assigned_cli??"?"]}),w.jsxs("span",{className:"ml-2",style:{color:"rgba(167,139,250,0.6)"},children:[Ev(M.routing)," · ",M.routing.agreement_pct,"% agree · ",M.routing.dissent," dissent",pd(M.routing)&&w.jsx("span",{className:"ml-2",style:{color:"#ffda19"},children:"· quorum lost"})]})]})]}),M.routing!==null&&M.routing.method==="evaluator_distinct"&&w.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:[w.jsx("span",{className:"shrink-0",children:"⚖"}),w.jsxs("span",{children:[w.jsxs("span",{className:"font-semibold",children:["Evaluator-distinct → ",M.assigned_cli??"?"]}),w.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"&&w.jsx(Sj,{reason:M.routing.reason}),w.jsxs("div",{className:"self-start max-w-[85%] flex flex-col gap-2",children:[w.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[M.assigned_cli?w.jsxs("div",{className:"flex items-center gap-1",children:[w.jsxs("button",{type:"button",onClick:()=>v(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:[w.jsx(jS,{cli:M.assigned_cli}),w.jsxs("span",{className:"text-xs font-mono",style:{color:"rgba(230,237,243,0.55)"},children:[M.assigned_cli,w.jsxs("span",{style:{color:"rgba(230,237,243,0.3)"},children:[" · unit ",M.ord]})]})]}),m[`${a.id}:${M.assigned_cli}`]&&w.jsx("button",{type:"button","aria-pressed":(x==null?void 0:x.cliKey)===M.assigned_cli,"aria-label":(x==null?void 0:x.cliKey)===M.assigned_cli?`Close ${M.assigned_cli} terminal`:`Open ${M.assigned_cli} terminal`,title:(x==null?void 0:x.cliKey)===M.assigned_cli?`Close ${M.assigned_cli} terminal`:`Open ${M.assigned_cli} terminal`,onClick:()=>{const P=M.assigned_cli,z=m[`${a.id}:${P}`];b((x==null?void 0:x.cliKey)===P?null:{cliKey:P,terminalId:z})},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:"⌨"})]}):w.jsxs("div",{className:"flex items-center gap-2",children:[w.jsx("span",{className:"w-7 h-7 rounded-full shrink-0",style:{background:"rgba(230,237,243,0.06)"}}),w.jsxs("span",{className:"text-xs font-mono",style:{color:"rgba(230,237,243,0.55)"},children:["agent",w.jsxs("span",{style:{color:"rgba(230,237,243,0.3)"},children:[" · unit ",M.ord]})]})]}),w.jsx("span",{className:"rounded-full px-2 py-0.5 text-[11px] font-semibold uppercase tracking-wide font-mono",style:{background:H.bg,color:H.color},children:M.stage}),M.has_validator_pin&&w.jsx("span",{role:"img","aria-label":"Governance floor armed",style:{color:"#ffda19",fontSize:"12px"},children:"🔒"}),w.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})]}),w.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"&&M.ord===c&&w.jsxs("div",{children:[w.jsxs("div",{className:"flex items-center gap-2 text-sm font-mono",style:{color:"rgba(230,237,243,0.5)"},children:[w.jsx("span",{className:"inline-block w-1.5 h-1.5 rounded-full animate-pulse",style:{background:"#79c0ff"}}),w.jsx("span",{children:"Working…"})]}),w.jsx(_j,{runId:a.id,ord:M.ord})]}),M.status==="distributed"&&M.ord!==c&&w.jsxs("div",{className:"flex items-center gap-2 text-sm font-mono",style:{color:"rgba(230,237,243,0.35)"},children:[w.jsx("span",{children:"—"}),w.jsx("span",{children:"Not started"})]}),M.status==="done"&&w.jsxs("div",{"data-testid":`unit-output-${M.ord}`,children:[w.jsxs("div",{className:"flex items-center gap-2 text-sm font-mono",children:[w.jsx("span",{style:{color:"#3fb950"},children:"✓"}),w.jsx("span",{className:"font-medium",style:{color:"#3fb950"},children:Ej(a.id,M)}),w.jsx("span",{className:"text-xs",style:{color:"rgba(230,237,243,0.4)"},children:kj[M.status]}),w.jsx("button",{type:"button","data-testid":`unit-output-toggle-${M.ord}`,onClick:()=>k(M.ord),className:"ml-auto text-xs font-medium font-mono hover:underline",style:{color:"#79c0ff"},children:U!=null&&U.visible?"▾ Hide output":"▸ Show output"})]}),(U==null?void 0:U.visible)&&w.jsx("div",{className:"mt-2.5 max-h-[28rem] overflow-y-auto",children:U.loading?w.jsx("span",{className:"text-xs font-mono",style:{color:"rgba(230,237,243,0.5)"},children:"Loading output…"}):w.jsx(Vv,{className:"whitespace-pre-wrap",children:U.text??""})})]}),M.status==="rejected"&&w.jsxs("div",{className:"text-sm font-medium font-mono",style:{color:"#f85149"},children:["Rejected",M.denial_reason?`: ${M.denial_reason}`:""]}),M.status==="pending"&&(()=>{const P=y[`${a.id}:${M.ord}`];return(P?P==="agent":!0)?w.jsx(wj,{runId:a.id,ord:M.ord}):w.jsxs("div",{className:"flex items-center gap-2 text-sm font-mono",style:{color:"rgba(230,237,243,0.3)"},children:[w.jsx("span",{className:"inline-block w-1.5 h-1.5 rounded-full",style:{background:"rgba(230,237,243,0.2)"}}),w.jsx("span",{children:"Queued"})]})})()]})]})]},M.id);return $?[w.jsx("div",{className:"self-center w-full max-w-lg",children:w.jsx(Cb,{runId:a.id,...d?{ord:d.ord,prompt:d.prompt}:{},onResolved:s})},`gate-before-${M.id}`),F]:[F]}),I.map(M=>M.type==="stepFailed"?w.jsx("div",{className:"flex flex-col gap-2",children:w.jsx(Mj,{detail:M.detail,onStop:D,canStop:o!==void 0&&!A})},M.seq):M.type==="crashRecoveryRedrive"?w.jsx("div",{className:"flex flex-col gap-2",children:w.jsx(Ij,{attempt:M.attempt??1})},M.seq):w.jsx("div",{className:"flex justify-center",children:w.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:Rj(M.type,M.detail)})},M.seq)),a.status==="awaiting_human"&&!l.some(M=>(d==null?void 0:d.ord)===M.ord)&&w.jsx("div",{className:"self-center w-full max-w-lg",children:w.jsx(Cb,{runId:a.id,...d?{ord:d.ord,prompt:d.prompt}:{},onResolved:s})}),w.jsx("div",{ref:E})]}),x&&w.jsx("div",{className:"px-4 pb-3 shrink-0",children:w.jsx(V5,{terminalId:x.terminalId,cliKey:x.cliKey,onClose:()=>b(null)})}),w.jsx(A2,{runId:A?null:a.id,runStatus:A?null:a.status,mode:e,onLaunched:n,injectTarget:_,onClearInjectTarget:()=>v("all")})]})}function jj({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 w.jsx("div",{className:"flex flex-col h-full items-center justify-center",children:w.jsxs("div",{className:"w-full max-w-2xl px-8 flex flex-col gap-5",children:[w.jsxs("div",{className:"flex flex-col gap-2 text-center",children:[w.jsx("h1",{className:"text-3xl font-bold tracking-tight",style:{color:"#e6edf3"},children:i}),w.jsx("p",{className:"text-base leading-relaxed",style:{color:"rgba(230,237,243,0.5)"},children:s})]}),w.jsx("div",{className:"flex justify-center",children:w.jsx(FS,{mode:e,onChange:r})}),w.jsx(A2,{embedded:!0,mode:e,onLaunched:n,...t?{workflowOverride:"chat"}:{}})]})})}function Fj({view:t,chatMode:e,onLaunched:r,onNavigateBack:n,onRefresh:i,onKill:s}){const[o,a]=J.useState("balanced");if(t){let l=function(d){a(d),c||Ve.injectMessage(u.session.id,`mode:${d}`,"all").catch(()=>{})};const u=t;if(u.session.workflow_id==="chat")return w.jsx(Oj,{view:u,onNavigateBack:n});const c=["completed","cancelled","failed"].includes(u.session.status);return w.jsx(Bj,{view:u,mode:o,onModeChange:l,onLaunched:r,onNavigateBack:n,onRefresh:i,...s!==void 0?{onKill:s}:{}},u.session.id)}return w.jsx(jj,{chatMode:e??!1,mode:o,onModeChange:a,onLaunched:r})}function zS(t){const e=ev(n=>n.setStatus),r=J.useRef(t);r.current=t,J.useEffect(()=>{let n=!1,i=null;function s(){if(n)return;const o=new WebSocket(`${_w()}/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 ug={claude:{bg:"rgba(139,92,246,0.25)",fg:"#c4b5fd"},codex:{bg:"rgba(59,130,246,0.25)",fg:"#93c5fd"},agy:{bg:"rgba(34,197,94,0.2)",fg:"#86efac"},pi:{bg:"rgba(234,179,8,0.2)",fg:"#fde68a"}},cg={bg:"rgba(230,237,243,0.1)",fg:"rgba(230,237,243,0.55)"},qv=t=>`wicked.chat.${t??"_"}`;function zj(t){try{const e=sessionStorage.getItem(qv(t));return e!==null&&e!==""?e:null}catch{return null}}function Hj(t,e){try{sessionStorage.setItem(qv(t),e)}catch{}}function pw(t){try{sessionStorage.removeItem(qv(t))}catch{}}function Uj({repoId:t,onBack:e}){const[r,n]=J.useState(null),[i,s]=J.useState({}),[o,a]=J.useState({}),[l,u]=J.useState([]),[c,d]=J.useState(""),[g,f]=J.useState(null),[y,_]=J.useState(!1),v=J.useRef(null),m=J.useRef(null);m.current=r,J.useEffect(()=>{var E;(E=v.current)==null||E.scrollIntoView({behavior:"smooth"})},[l]),J.useEffect(()=>{let E=!1;u([]),s({}),a({}),f(null),_(!1),n(null),m.current=null;const k=Ve.getRoster().then(({roster:L})=>L).catch(()=>[]);return(async()=>{const L=zj(t);if(L!==null){const O=await Ve.getChat(L).then(({seats:B})=>({seats:B})).catch(B=>({error:B instanceof Error?B.message:String(B)}));if(E)return;if("error"in O){n(L),m.current=L,f(`Could not reach the daemon to check the previous chat (${O.error}). Keeping it — reload to retry, or End chat to release its seats.`);return}if(O.seats.length>0){n(L),m.current=L,s(Object.fromEntries(O.seats.map(B=>[B,"ready"])));return}pw(t)}const A=crypto.randomUUID();if(E)return;n(A),m.current=A,Hj(t,A);const I=await k;if(!E){s(Object.fromEntries(I.flatMap(O=>typeof O.key=="string"?[[O.key,"warming"]]:[])));try{const{seats:O}=await Ve.openChat(t?{chatId:A,repoRef:t}:{chatId:A});if(E)return;const B={},D={};for(const M of O)B[M.cliKey]=M.ok?"ready":"failed",!M.ok&&M.error&&(D[M.cliKey]=M.error);s(B),a(D)}catch(O){E||f(O instanceof Error?O.message:String(O))}}})(),()=>{E=!0}},[t]),zS(E=>{const k=E;if(k.chat===m.current)switch(k.type){case"chatSessionReady":k.cliKey&&s(L=>({...L,[k.cliKey]:"ready"}));break;case"chatSessionFailed":k.cliKey&&(s(L=>({...L,[k.cliKey]:"failed"})),a(L=>({...L,[k.cliKey]:k.reason??"session failed"})));break;case"chatDelta":k.cliKey&&k.text&&x(k.cliKey,k.text);break;case"chatReply":k.cliKey&&b(k.cliKey,k.text??"",k.ok??!1);break}});function x(E,k){u(L=>{const A=[...L];for(let I=A.length-1;I>=0;I--){const O=A[I];if(O&&O.kind==="seat"&&O.cliKey===E&&O.pending)return A[I]={...O,text:O.text+k},A}return L})}function b(E,k,L){u(A=>{const I=[...A];for(let O=I.length-1;O>=0;O--){const B=I[O];if(B&&B.kind==="seat"&&B.cliKey===E&&B.pending)return I[O]={kind:"seat",cliKey:E,text:k,pending:!1,ok:L},I}return A})}async function S(){const E=c.trim(),k=Object.values(i).some(A=>A==="ready");if(E===""||r===null||y||!k)return;d("");const L=Object.entries(i).filter(([,A])=>A==="ready").map(([A])=>A);u(A=>[...A,{kind:"user",text:E},...L.map(I=>({kind:"seat",cliKey:I,text:"",pending:!0,ok:!1}))]);try{await Ve.sendChatMessage(r,E)}catch(A){const I=A instanceof Error?A.message:String(A);u(O=>O.map(B=>B.kind==="seat"&&B.pending?{...B,pending:!1,ok:!1,text:`(send failed: ${I})`}:B))}}async function T(){if(pw(t),r!==null)try{await Ve.closeChat(r)}catch{}_(!0),e()}const N=(E,k)=>{const L=ug[E]??cg;return w.jsxs("span",{title:k==="failed"?o[E]:k,className:"inline-flex items-center gap-1.5 rounded-lg px-2 py-0.5 text-[11px] font-mono",style:{background:L.bg,color:L.fg,opacity:k==="failed"?.5:1},children:[w.jsx("span",{className:`inline-block w-1.5 h-1.5 rounded-full ${k==="warming"?"animate-pulse":""}`,style:{background:k==="failed"?"#f85149":k==="warming"?"#d29922":"#3fb950"}}),E,k==="failed"?" ✕":""]},E)};return w.jsxs("div",{className:"flex flex-col h-full",style:{color:"#e6edf3"},children:[w.jsxs("div",{className:"flex items-center gap-3 px-6 py-3 border-b shrink-0",style:{borderColor:"rgba(230,237,243,0.08)"},children:[w.jsx("button",{type:"button",onClick:e,className:"text-sm font-mono opacity-60 hover:opacity-100",children:"←"}),w.jsx("span",{className:"text-sm font-mono font-semibold",children:"Group chat"}),w.jsx("div",{className:"flex items-center gap-1.5 flex-wrap",children:Object.entries(i).map(([E,k])=>N(E,k))}),w.jsx("div",{className:"flex-1"}),w.jsx("button",{type:"button",onClick:()=>void T(),className:"text-[11px] font-mono px-2.5 py-1 rounded-lg",style:{background:"rgba(248,81,73,0.12)",color:"#f85149",border:"1px solid rgba(248,81,73,0.25)"},children:"End chat"})]}),w.jsxs("div",{className:"flex-1 overflow-y-auto px-6 py-4 flex flex-col gap-3",children:[g!==null&&w.jsxs("p",{className:"text-[12px] font-mono",style:{color:"#f85149"},children:["Could not open chat: ",g]}),Object.keys(i).length===0&&g===null&&w.jsx("p",{className:"text-[12px] font-mono opacity-60",children:"Warming seats…"}),l.map((E,k)=>E.kind==="user"?w.jsx("div",{className:"self-end max-w-[70%] rounded-xl px-4 py-2 text-[13px]",style:{background:"rgba(88,166,255,0.15)"},children:E.text},k):w.jsxs("div",{className:"self-start max-w-[80%] flex gap-2",children:[w.jsx("span",{className:"shrink-0 w-7 h-7 rounded-lg flex items-center justify-center text-[10px] font-mono font-bold mt-0.5",style:{background:(ug[E.cliKey]??cg).bg,color:(ug[E.cliKey]??cg).fg},children:E.cliKey.slice(0,2).toUpperCase()}),w.jsx("div",{className:"rounded-xl px-4 py-2 text-[13px] min-w-[60px]",style:{background:"rgba(230,237,243,0.05)",border:`1px solid ${E.pending?"rgba(210,153,34,0.35)":E.ok?"rgba(230,237,243,0.08)":"rgba(248,81,73,0.35)"}`},children:E.pending&&E.text===""?w.jsx("span",{className:"opacity-50 font-mono text-[11px] animate-pulse",children:"thinking…"}):w.jsx(Vv,{children:E.text})})]},k)),w.jsx("div",{ref:v})]}),w.jsx("div",{className:"px-6 py-3 border-t shrink-0",style:{borderColor:"rgba(230,237,243,0.08)"},children:w.jsxs("div",{className:"flex gap-2",children:[w.jsx("textarea",{value:c,onChange:E=>d(E.target.value),onKeyDown:E=>{E.key==="Enter"&&!E.shiftKey&&(E.preventDefault(),S())},rows:2,placeholder:"Message every warm seat… (Enter to send, Shift+Enter for newline)",className:"flex-1 rounded-xl px-4 py-2 text-[13px] font-mono outline-none resize-none",style:{background:"#1b222e",border:"1px solid rgba(230,237,243,0.12)"}}),w.jsx("button",{type:"button",onClick:()=>void S(),disabled:!Object.values(i).some(E=>E==="ready")||c.trim()==="",className:"px-4 rounded-xl text-sm font-mono font-semibold disabled:opacity-40",style:{background:"rgba(88,166,255,0.2)",color:"#79c0ff"},children:"Send"})]})})]})}function $j(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 Wj={recon:"#79c0ff",build:"#3fb950",review:"#a78bfa",test:"#ffda19"};function HS(t){return Wj[t]??"rgba(230,237,243,0.3)"}function Vj({phase:t}){const e=t.executor,r=HS(t.kind);return w.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:[w.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[w.jsx("span",{className:"h-2 w-2 rounded-full shrink-0",style:{backgroundColor:r},title:t.kind}),w.jsx("span",{className:"font-semibold",style:{color:"#e6edf3"},children:t.id}),w.jsx("span",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.4)"},children:t.kind}),t.role!=="neutral"&&w.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"&&w.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(" ")]})]}),w.jsxs("div",{className:"flex flex-wrap gap-x-4 gap-y-0.5 text-[10px]",style:{color:"rgba(230,237,243,0.45)"},children:[w.jsxs("span",{children:[w.jsx("span",{className:"font-medium",style:{color:"rgba(230,237,243,0.6)"},children:"gate:"})," ",t.gate_type?`${t.gate_type} / `:"",$j(t.gate)]}),t.depends_on.length>0&&w.jsxs("span",{children:[w.jsx("span",{className:"font-medium",style:{color:"rgba(230,237,243,0.6)"},children:"after:"})," ",t.depends_on.join(", ")]}),t.skill_ref&&w.jsxs("span",{children:[w.jsx("span",{className:"font-medium",style:{color:"rgba(230,237,243,0.6)"},children:"skill:"})," ",w.jsx("span",{className:"font-mono",children:t.skill_ref})]})]})]})}function gw(){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 Gj(t){return t==="human"?{human_confirm:{unconditional:!1}}:t==="human_if"?{human_confirm_if:"verdict_not_pass"}:"auto"}async function qj(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 Ve.saveScript(e,t.script,t.scriptLang);return{type:"tool",cmd:[t.scriptLang==="python"?"python3":t.scriptLang==="sh"?"sh":"bash",r]}}async function vw(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:Gj(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 qj(n)})));return{id:t,phases:r}}const il={background:"#0f1419",border:"1px solid rgba(230,237,243,0.1)",color:"#e6edf3"};function fc({active:t,onClick:e,children:r}){return w.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 Yj({phase:t,index:e,total:r,allIds:n,onChange:i,onRemove:s,onMoveUp:o,onMoveDown:a}){const l=(c,d)=>i({...t,[c]:d}),u=n.slice(0,e);return w.jsxs("div",{className:"rounded p-3 flex flex-col gap-2",style:{border:"1px solid rgba(230,237,243,0.08)",background:"#1b222e"},children:[w.jsxs("div",{className:"flex items-center gap-2",children:[w.jsx("span",{className:"h-2.5 w-2.5 rounded-full",style:{backgroundColor:HS(t.kind)}}),w.jsxs("span",{className:"text-[11px] font-semibold",style:{color:"rgba(230,237,243,0.7)"},children:["Phase ",e+1]}),w.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[w.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:"▲"}),w.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:"▼"}),w.jsx("button",{type:"button",onClick:s,className:"px-1 text-[10px]",style:{color:"#f85149"},children:"✕"})]})]}),w.jsxs("div",{className:"flex gap-2",children:[w.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:il}),w.jsx("select",{className:"rounded px-2 py-1 text-xs focus:outline-none",value:t.kind,onChange:c=>l("kind",c.target.value),style:il,children:["recon","build","review","test"].map(c=>w.jsx("option",{value:c,children:c},c))})]}),w.jsxs("div",{className:"flex flex-col gap-1.5",children:[w.jsx("div",{className:"flex gap-1",children:["agent","command","script"].map(c=>w.jsx(fc,{active:t.execMode===c,onClick:()=>l("execMode",c),children:c==="agent"?"Agent":c==="command"?"Command":"Script"},c))}),t.execMode==="command"&&w.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:il}),t.execMode==="script"&&w.jsxs("div",{className:"flex flex-col gap-1",children:[w.jsxs("div",{className:"flex gap-1 items-center",children:[w.jsx("span",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.4)"},children:"Language:"}),["bash","sh","python"].map(c=>w.jsx(fc,{active:t.scriptLang===c,onClick:()=>l("scriptLang",c),children:c},c))]}),w.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
|
|
422
|
-
print("hello")`:`# bash script
|
|
423
|
-
echo "hello"`,value:t.script,onChange:c=>l("script",c.target.value),style:{...il,background:"#0d1117"}}),w.jsxs("p",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.3)"},children:["Saved to"," ",w.jsxs("span",{style:{color:"rgba(230,237,243,0.5)"},children:["~/.wicked/scripts/",t.id||"script",".",t.scriptLang==="python"?"py":"sh"]})]})]})]}),w.jsxs("div",{className:"flex gap-2 flex-wrap",children:[w.jsxs("div",{className:"flex flex-col gap-0.5",children:[w.jsx("span",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.4)"},children:"Gate"}),w.jsx("div",{className:"flex gap-1",children:[["auto","Auto"],["human","Human"],["human_if","Human if fails"]].map(([c,d])=>w.jsx(fc,{active:t.gate===c,onClick:()=>l("gate",c),children:d},c))})]}),w.jsxs("div",{className:"flex flex-col gap-0.5",children:[w.jsx("span",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.4)"},children:"Role"}),w.jsx("div",{className:"flex gap-1",children:["neutral","creator","evaluator"].map(c=>w.jsx(fc,{active:t.role===c,onClick:()=>l("role",c),children:c},c))})]})]}),u.length>0&&w.jsxs("div",{className:"flex flex-col gap-0.5",children:[w.jsx("span",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.4)"},children:"Depends on"}),w.jsx("div",{className:"flex flex-wrap gap-1.5",children:u.map(c=>w.jsxs("label",{className:"flex items-center gap-1 text-[10px] cursor-pointer",style:{color:"rgba(230,237,243,0.55)"},children:[w.jsx("input",{type:"checkbox",checked:t.dependsOn.includes(c),onChange:d=>l("dependsOn",d.target.checked?[...t.dependsOn,c]:t.dependsOn.filter(g=>g!==c))}),w.jsx("span",{className:"font-mono",children:c})]},c))})]}),w.jsxs("div",{className:"flex gap-3 text-[10px]",style:{color:"rgba(230,237,243,0.45)"},children:[w.jsxs("label",{className:"flex items-center gap-1 cursor-pointer",children:[w.jsx("input",{type:"checkbox",checked:t.executesCode,onChange:c=>l("executesCode",c.target.checked)}),"executes code"]}),w.jsxs("label",{className:"flex items-center gap-1 cursor-pointer",children:[w.jsx("input",{type:"checkbox",checked:t.verifiedEvidence,onChange:c=>l("verifiedEvidence",c.target.checked)}),"verified evidence"]})]})]})}function Kj({initial:t,onSaved:e,onCancel:r}){const[n,i]=J.useState((t==null?void 0:t.id)??""),[s,o]=J.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}}):[gw()]),[a,l]=J.useState(!1),[u,c]=J.useState(null),[d,g]=J.useState(!1),[f,y]=J.useState(""),_=s.map(L=>L.id).filter(Boolean);function v(L,A){o(I=>I.map((O,B)=>B===L?A:O))}function m(L){o(A=>A.filter((I,O)=>O!==L))}function x(){o(L=>[...L,gw()])}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 T(){try{const L=await vw(n,s);y(JSON.stringify(L,null,2)),g(!0)}catch(L){c(L instanceof Error?L.message:String(L))}}async function N(){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 vw(n.trim(),s);await Ve.createWorkflow(L),e(L)}catch(L){c(L instanceof Error?L.message:String(L))}finally{l(!1)}}const E=J.useRef(null);function k(L){var O;const A=(O=L.target.files)==null?void 0:O[0];if(!A)return;const I=new FileReader;I.onload=B=>{var D;try{const M=JSON.parse((D=B.target)==null?void 0:D.result);i(M.id??""),o(M.phases.map(U=>{const H=U.executor;return{_key:Math.random().toString(36).slice(2),id:U.id,kind:U.kind,execMode:(H==null?void 0:H.type)==="tool"?"command":"agent",cmd:(H==null?void 0:H.type)==="tool"?H.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 w.jsxs("div",{className:"flex flex-col gap-3 min-w-0",children:[w.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[w.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:il}),w.jsx("input",{ref:E,type:"file",accept:".json",className:"hidden",onChange:k}),w.jsx("button",{type:"button",onClick:()=>{var L;return(L=E.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"}),w.jsx("button",{type:"button",onClick:()=>void T(),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"}),w.jsx("button",{type:"button",onClick:r,className:"text-[11px] px-1 hover:underline",style:{color:"rgba(230,237,243,0.4)"},children:"Cancel"})]}),d&&w.jsxs("div",{className:"relative",children:[w.jsx("pre",{className:"rounded text-[10px] p-3 overflow-auto max-h-48 font-mono",style:{background:"#0d1117",color:"#3fb950"},children:f}),w.jsx("button",{type:"button",onClick:()=>g(!1),className:"absolute top-1 right-1 text-[10px]",style:{color:"rgba(230,237,243,0.4)"},children:"✕"})]}),w.jsx("div",{className:"flex flex-col gap-2",children:s.map((L,A)=>w.jsx(Yj,{phase:L,index:A,total:s.length,allIds:_,onChange:I=>v(A,I),onRemove:()=>m(A),onMoveUp:()=>b(A),onMoveDown:()=>S(A)},L._key))}),w.jsx("button",{type:"button",onClick:x,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&&w.jsx("p",{className:"text-[11px]",style:{color:"#f85149"},children:u}),w.jsx("button",{type:"button",onClick:()=>void N(),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 Xj(){const[t,e]=J.useState([]),[r,n]=J.useState(null),[i,s]=J.useState(!0),[o,a]=J.useState(null),[l,u]=J.useState(!1),[c,d]=J.useState(void 0),g=J.useRef(null);g.current=r;const f=J.useCallback(async()=>{var m;s(!0),a(null);try{const{workflows:x}=await Ve.listWorkflows();e(x),x.length>0&&!g.current&&n(((m=x[0])==null?void 0:m.id)??null)}catch(x){a(x instanceof Error?x.message:String(x))}finally{s(!1)}},[]);J.useEffect(()=>{f()},[f]);function y(m){d(m),u(!0)}function _(m){e(x=>x.findIndex(S=>S.id===m.id)>=0?x.map(S=>S.id===m.id?m:S):[...x,m]),n(m.id),u(!1)}const v=t.find(m=>m.id===r)??null;return w.jsxs("div",{className:"flex flex-col gap-4",children:[w.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[w.jsx("h2",{className:"text-sm font-semibold flex-1",style:{color:"#e6edf3"},children:"Workflows"}),!l&&w.jsxs(w.Fragment,{children:[w.jsx("button",{type:"button",onClick:()=>y(),className:"rounded px-3 py-1 text-[11px] font-semibold",style:{background:"#3fb950",color:"#0d1117"},children:"New workflow"}),w.jsx("button",{type:"button",onClick:()=>void f(),className:"text-[10px] hover:underline",style:{color:"rgba(230,237,243,0.4)"},children:"Refresh"})]})]}),i&&w.jsx("p",{className:"text-xs",style:{color:"rgba(230,237,243,0.4)"},children:"Loading workflows…"}),o&&w.jsx("p",{className:"rounded px-2 py-1 text-xs",style:{background:"rgba(248,81,73,0.08)",color:"#f85149"},children:o}),w.jsxs("div",{className:"flex gap-4",children:[!l&&w.jsx("div",{className:"flex flex-col gap-1.5 w-40 shrink-0",children:t.map(m=>w.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:[w.jsx("div",{className:"font-semibold",children:m.id}),w.jsxs("div",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.35)"},children:[m.phases.length," phases"]})]},m.id))}),w.jsx("div",{className:"flex-1 min-w-0",children:l?w.jsx(Kj,{...c!==void 0?{initial:c}:{},onSaved:_,onCancel:()=>u(!1)}):v?w.jsxs("div",{className:"flex flex-col gap-2",children:[w.jsxs("div",{className:"flex items-center gap-2",children:[w.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider font-mono",style:{color:"rgba(230,237,243,0.4)"},children:v.id}),w.jsxs("span",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.35)"},children:["— ",v.phases.length," phases"]}),w.jsx("button",{type:"button",onClick:()=>y(v),className:"ml-auto text-[10px] hover:underline",style:{color:"#79c0ff"},children:"Edit"}),w.jsx("button",{type:"button",onClick:()=>y({...v,id:`${v.id}-copy`}),className:"text-[10px] hover:underline",style:{color:"rgba(230,237,243,0.4)"},children:"Duplicate"})]}),v.phases.map(m=>w.jsx(Vj,{phase:m},m.id))]}):null})]}),!l&&w.jsxs("p",{className:"text-[10px] font-mono",style:{color:"rgba(230,237,243,0.25)"},children:["Workflows saved to ",w.jsx("span",{style:{color:"rgba(230,237,243,0.4)"},children:"~/.wicked/workflows/"})," and registered immediately. Scripts saved to ",w.jsx("span",{style:{color:"rgba(230,237,243,0.4)"},children:"~/.wicked/scripts/"}),"."]})]})}const US=t=>["completed","failed","cancelled"].includes(t),dg=t=>!US(t),hg=t=>t==="completed",mw=t=>t==="failed"||t==="cancelled",yw=[{id:"all",label:"All"},{id:"active",label:"Active"},{id:"completed",label:"Completed"},{id:"failed",label:"Failed"}];function Qj({runs:t,selectedRunId:e,onSelect:r,navigate:n}){const[i,s]=J.useState(""),[o,a]=J.useState("all"),l=J.useRef([]),{range:u,setRange:c,filter:d}=Xg("30d"),[g,f]=J.useState(!1),[y,_]=J.useState(null);J.useEffect(()=>{if(!g)return;let I=!1;return Ve.listRuns(!0).then(({runs:O})=>{I||_(O.filter(B=>B.session.archived_at!=null))}).catch(()=>{I||_([])}),()=>{I=!0}},[g]);async function v(I){try{await Ve.archiveRun(I,!1),_(O=>O&&O.filter(B=>B.session.id!==I))}catch{}}const m=J.useMemo(()=>t.filter(I=>!!I.session.workflow_id&&I.session.workflow_id!=="chat"),[t]),x=J.useMemo(()=>d(m),[m,d]),b=i.toLowerCase(),S=J.useMemo(()=>i?x.filter(I=>I.session.problem.toLowerCase().includes(b)):x,[x,i,b]),T=J.useMemo(()=>{const I=x.length,O=x.filter(F=>dg(F.session.status)).length,B=x.filter(F=>hg(F.session.status)).length,D=x.filter(F=>US(F.session.status)).length,M=D>0?`${Math.round(B/D*100)}%`:"—",U=new Map;for(const F of x){const P=F.session.workflow_id;P&&P!=="chat"&&!P.startsWith("wf-")&&U.set(P,(U.get(P)??0)+1)}let H="—",$=0;return U.forEach((F,P)=>{F>$&&($=F,H=P)}),{total:I,active:O,successRate:M,topWorkflow:H}},[x]),N={all:S.length,active:S.filter(I=>dg(I.session.status)).length,completed:S.filter(I=>hg(I.session.status)).length,failed:S.filter(I=>mw(I.session.status)).length},E=S.filter(I=>dg(I.session.status)),k=S.filter(I=>hg(I.session.status)),L=S.filter(I=>mw(I.session.status)),A=o==="all"?S:o==="active"?E:o==="completed"?k:L;return w.jsxs("div",{className:"flex flex-col h-full",style:{color:"#e6edf3"},children:[w.jsxs("div",{className:"px-8 pt-8 pb-4 flex items-center gap-4",children:[w.jsx("h1",{className:"text-xl font-semibold font-mono",children:"Work"}),w.jsx("div",{className:"flex-1"}),w.jsx(Qg,{value:u,onChange:c}),w.jsx("input",{type:"text",placeholder:"Search work…",value:i,onChange:I=>s(I.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"}}),w.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"})]}),w.jsx("div",{className:"px-8 pb-4 grid gap-3",style:{gridTemplateColumns:"repeat(4, 1fr)"},children:[{label:"Total Runs",value:String(T.total),accent:void 0},{label:"Active",value:String(T.active),accent:"#79c0ff"},{label:"Success Rate",value:T.successRate,accent:"#3fb950"},{label:"Top Workflow",value:T.topWorkflow,accent:void 0}].map(I=>w.jsxs("div",{className:"rounded-xl px-4 py-3",style:{background:"#1b222e",border:"1px solid rgba(230,237,243,0.07)"},children:[w.jsx("p",{className:"text-[10px] font-mono uppercase tracking-widest",style:{color:"rgba(230,237,243,0.4)",margin:0},children:I.label}),w.jsx("p",{className:"text-xl font-semibold font-mono mt-1 truncate",style:{color:I.accent??"#e6edf3",margin:"4px 0 0"},children:I.value})]},I.label))}),w.jsxs("div",{role:"tablist","aria-label":"Filter by status",className:"px-8 pb-3 flex items-center gap-2",onKeyDown:I=>{var M;const O=yw.map(U=>U.id),B=O.indexOf(o);let D=null;I.key==="ArrowRight"||I.key==="ArrowDown"?(I.preventDefault(),D=(B+1)%O.length):(I.key==="ArrowLeft"||I.key==="ArrowUp")&&(I.preventDefault(),D=(B-1+O.length)%O.length),D!==null&&(a(O[D]),(M=l.current[D])==null||M.focus())},children:[yw.map((I,O)=>w.jsxs("button",{ref:B=>{l.current[O]=B},id:`work-tab-${I.id}`,type:"button",role:"tab","aria-selected":o===I.id,"aria-controls":`work-panel-${I.id}`,tabIndex:o===I.id?0:-1,onClick:()=>a(I.id),className:"rounded-full px-3 py-1 text-xs font-mono",style:o===I.id?{background:"rgba(230,237,243,0.1)",color:"#e6edf3"}:{color:"rgba(230,237,243,0.4)"},children:[I.label," ",N[I.id]]},I.id)),w.jsx("div",{className:"flex-1"}),w.jsxs("button",{type:"button","aria-pressed":g,onClick:()=>f(I=>!I),className:"rounded-full px-3 py-1 text-xs font-mono",style:g?{background:"rgba(230,237,243,0.1)",color:"#e6edf3",border:"1px dashed rgba(230,237,243,0.3)"}:{color:"rgba(230,237,243,0.4)",border:"1px dashed rgba(230,237,243,0.15)"},children:["Archived",y!==null?` ${y.length}`:""]})]}),w.jsxs("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"?w.jsxs(w.Fragment,{children:[E.length>0&&w.jsxs(w.Fragment,{children:[w.jsx(pc,{pulse:!0,children:"Active"}),E.map(I=>w.jsx(mi,{view:I,selectedRunId:e,onSelect:r},I.session.id))]}),k.length>0&&w.jsxs(w.Fragment,{children:[w.jsx(pc,{children:"Completed"}),k.map(I=>w.jsx(mi,{view:I,selectedRunId:e,onSelect:r},I.session.id))]}),L.length>0&&w.jsxs(w.Fragment,{children:[w.jsx(pc,{children:"Failed"}),L.map(I=>w.jsx(mi,{view:I,selectedRunId:e,onSelect:r},I.session.id))]}),S.length===0&&w.jsx(xw,{query:i})]}):w.jsx(w.Fragment,{children:A.length===0?w.jsx(xw,{query:i,tab:o}):A.map(I=>w.jsx(mi,{view:I,selectedRunId:e,onSelect:r},I.session.id))}),g&&y!==null&&w.jsxs(w.Fragment,{children:[w.jsx(pc,{children:"Archived"}),y.length===0?w.jsx("p",{className:"px-3 py-3 text-sm font-mono italic",style:{color:"rgba(230,237,243,0.35)"},children:"Nothing archived."}):y.map(I=>w.jsxs("div",{className:"flex items-center gap-2",children:[w.jsx("div",{className:"flex-1 min-w-0",style:{opacity:.55},children:w.jsx(mi,{view:I,selectedRunId:e,onSelect:r})}),w.jsx("button",{type:"button",onClick:()=>void v(I.session.id),className:"rounded-lg px-2 py-1 text-[11px] font-mono shrink-0",style:{color:"rgba(230,237,243,0.55)",border:"1px solid rgba(230,237,243,0.15)"},children:"Unarchive"})]},I.session.id))]})]})]})}function pc({children:t,pulse:e}){return w.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&&w.jsx("span",{className:"w-1.5 h-1.5 rounded-full animate-pulse shrink-0",style:{background:"#79c0ff"}}),t]})}function xw({query:t,tab:e}){const r=t?`No runs match "${t}".`:e?`No ${e} runs yet.`:"No work sessions yet.";return w.jsx("p",{className:"px-3 py-6 text-sm font-mono italic",style:{color:"rgba(230,237,243,0.35)"},children:r})}const $S="wicked_default_clis";function Zj({label:t,description:e,children:r}){return w.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:[w.jsxs("div",{className:"flex-1 min-w-0",children:[w.jsx("p",{className:"text-sm font-medium",style:{color:"#e6edf3"},children:t}),w.jsx("p",{className:"text-xs mt-0.5",style:{color:"rgba(230,237,243,0.45)"},children:e})]}),w.jsx("div",{className:"shrink-0",children:r})]})}function Jj(t){try{const e=localStorage.getItem($S);if(e)return new Set(JSON.parse(e))}catch{}return new Set(t.filter(e=>e.enabled_for_council).map(e=>e.key))}function eF(){const[t,e]=J.useState(null),[r,n]=J.useState({}),[i,s]=J.useState(!1),[o,a]=J.useState(!1),[l,u]=J.useState(null),c=J.useRef(null),[d,g]=J.useState([]),[f,y]=J.useState(new Set),[_,v]=J.useState(!1),m=J.useRef(null);J.useEffect(()=>{Ve.getSettings().then(({settings:k})=>e(k)).catch(k=>u(String(k))),Ve.getRoster().then(({roster:k})=>{g(k),y(Jj(k))}).catch(()=>{})},[]),J.useEffect(()=>()=>{m.current&&clearTimeout(m.current)},[]);function x(k){y(L=>{const A=new Set(L);return A.has(k)?A.delete(k):A.add(k),A})}function b(){u(null);try{localStorage.setItem($S,JSON.stringify([...f]))}catch(k){u(String(k));return}v(!0),m.current&&clearTimeout(m.current),m.current=setTimeout(()=>v(!1),2500)}J.useEffect(()=>()=>{c.current&&clearTimeout(c.current)},[]);function S(k,L){n(A=>({...A,[k]:L})),a(!1)}async function T(){if(Object.keys(r).length!==0){s(!0),u(null);try{const{settings:k}=await Ve.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 N={graphNodeLimit:150,...t,...r},E=Object.keys(r).length>0;return w.jsxs("div",{className:"max-w-2xl mx-auto",children:[w.jsxs("div",{className:"mb-6",children:[w.jsx("h1",{className:"text-lg font-semibold",style:{color:"#e6edf3"},children:"System"}),w.jsxs("p",{className:"text-sm mt-1",style:{color:"rgba(230,237,243,0.45)"},children:["Runtime tunables persisted to"," ",w.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&&w.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}),w.jsxs("section",{className:"rounded-xl px-5 mb-6",style:{background:"#1b222e",border:"1px solid rgba(230,237,243,0.07)"},children:[w.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"}),w.jsx(Zj,{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:w.jsx("input",{type:"number",min:20,max:500,step:10,value:N.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"}})})]}),w.jsxs("div",{className:"flex items-center gap-3 mb-8",children:[w.jsx("button",{type:"button",onClick:T,disabled:!E||i,className:"px-4 py-2 rounded-lg text-sm font-medium transition-colors disabled:opacity-40",style:E&&!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&&w.jsx("span",{className:"text-xs font-medium",style:{color:"#3fb950"},children:"Saved"})]}),w.jsxs("section",{className:"rounded-xl px-5 mb-6",style:{background:"#1b222e",border:"1px solid rgba(230,237,243,0.07)"},children:[w.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"}),w.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."}),d.length===0?w.jsx("p",{className:"text-xs italic pb-4 font-mono",style:{color:"rgba(230,237,243,0.3)"},children:"Loading roster…"}):w.jsx("div",{className:"flex flex-col gap-2 pb-4",children:d.map(k=>w.jsxs("label",{className:"flex items-center gap-3 cursor-pointer group",children:[w.jsx("input",{type:"checkbox",checked:f.has(k.key),onChange:()=>x(k.key),className:"accent-[#ffda19] w-3.5 h-3.5 shrink-0"}),w.jsx("span",{className:"text-sm font-mono flex-1",style:{color:"#e6edf3"},children:k.display_name}),w.jsx("span",{className:"text-xs font-mono",style:{color:"rgba(230,237,243,0.3)"},children:k.key})]},k.key))}),d.length>0&&w.jsxs("div",{className:"flex items-center gap-3 pb-4 pt-2 border-t",style:{borderColor:"rgba(230,237,243,0.07)"},children:[w.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"})]})]})]})}const tF=["runs","coverage","workflows","domain","policies","rules","repos","system","chats","work","repo-detail","projects","project-detail"];function fg(t){try{return decodeURIComponent(t)}catch{return t}}function rF(t){const[,e="",r=""]=t.split("/");return e==="repo-detail"&&r?{panel:"repo-detail",runId:null,showLaunch:!1,repoId:fg(r),showRegisterRepo:!1,chatMode:!1,projectId:null}:e==="repo-detail"?{panel:"repos",runId:null,showLaunch:!1,repoId:null,showRegisterRepo:!1,chatMode:!1,projectId:null}:e==="repos"&&r==="new"?{panel:"repos",runId:null,showLaunch:!1,repoId:null,showRegisterRepo:!0,chatMode:!1,projectId:null}:e==="chat"&&r==="new"?{panel:"runs",runId:null,showLaunch:!0,repoId:null,showRegisterRepo:!1,chatMode:!0,projectId:null}:e==="projects"&&r?{panel:"project-detail",runId:null,showLaunch:!1,repoId:null,showRegisterRepo:!1,chatMode:!1,projectId:fg(r)}:tF.includes(e)&&e!=="runs"?{panel:e,runId:null,showLaunch:!1,repoId:null,showRegisterRepo:!1,chatMode:!1,projectId:null}:r==="new"?{panel:"runs",runId:null,showLaunch:!0,repoId:null,showRegisterRepo:!1,chatMode:!1,projectId:null}:r?{panel:"runs",runId:fg(r),showLaunch:!1,repoId:null,showRegisterRepo:!1,chatMode:!1,projectId:null}:{panel:"runs",runId:null,showLaunch:!1,repoId:null,showRegisterRepo:!1,chatMode:!1,projectId:null}}function nF(){const[t,e]=J.useState(()=>window.location.pathname);J.useEffect(()=>{const i=()=>e(window.location.pathname);return window.addEventListener("popstate",i),()=>window.removeEventListener("popstate",i)},[]);const r=J.useCallback(i=>{history.pushState(null,"",i),e(i)},[]),n=J.useCallback(i=>i==="runs"?"/":`/${i}`,[]);return{...rF(t),navigate:r,panelPath:n}}function iF(){const t=ev(c=>c.status),e=ti(c=>c.setGate),r=ti(c=>c.reconcile),n=_l(c=>c.reconcile),[i,s]=J.useState([]),[o,a]=J.useState(0),l=J.useRef(null),u=J.useCallback(()=>{l.current!==null&&clearTimeout(l.current),l.current=setTimeout(()=>{l.current=null,a(c=>c+1)},400)},[]);return J.useEffect(()=>()=>{l.current!==null&&clearTimeout(l.current)},[]),J.useEffect(()=>{if(t!=="connected")return;let c=!1;return(async()=>{let d;try{({runs:d}=await Ve.listRuns())}catch{return}if(c)return;s(d);const g=d.filter(f=>f.session.status==="awaiting_human").map(f=>f.session.id);r(g),n(d.map(f=>f.session.id));for(const f of g)if(!ti.getState().gates[f])try{const y=await Ve.getGate(f);if(c)return;e({runId:y.runId,ord:y.ord,prompt:y.prompt,lifecycle:y.lifecycle,receivedAt:Date.parse(y.receivedAt)||Date.now()})}catch{}})(),()=>{c=!0}},[t,o,e,r,n]),{runs:i,refresh:u}}const aF=new Set(["sessionStarted","unitPlanned","unitDistributed","unitExecuting","gateDecided","unitDone","unitDenied","awaitingHuman","resumed","runCancelled","sessionFailed","sessionCompleted"]);function sF(t,e,r){J.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(g=>g.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 oF(){const{panel:t,runId:e,repoId:r,projectId:n,showLaunch:i,showRegisterRepo:s,chatMode:o,navigate:a}=nF(),{runs:l,refresh:u}=iF(),c=ti(B=>B.ingest),d=_l(B=>B.ingest),g=gc(B=>B.ingest),f=Ha(B=>B.ingest),y=zs(B=>B.ingest),_=J.useCallback(()=>{u()},[u]),v=J.useCallback(()=>{u()},[u]),m=J.useCallback(B=>{c(B),d(B),g(B),f(B),y(B),aF.has(B.type)&&u()},[c,d,g,f,y,u]);zS(m),J.useEffect(()=>{if(!e||(zs.getState().byRun[e]??[]).length>0)return;let B=!1;return Ve.getRunEvents(e).then(({events:D})=>{B||zs.getState().hydrate(e,D)}).catch(()=>{}),()=>{B=!0}},[e]);const x=J.useCallback(B=>a(`/runs/${encodeURIComponent(B)}`),[a]),b=J.useCallback(B=>{u(),a(`/runs/${encodeURIComponent(B)}`)},[a,u]),S=J.useCallback(()=>a("/"),[a]),T=J.useCallback(async B=>{try{await Ve.cancelRun(B),u()}catch{}},[u]);sF(e,l,T);const N=l.find(B=>B.session.id===e)??null,[E,k]=J.useState(null),[L,A]=J.useState(null),I=J.useCallback(B=>{r&&(A(B??null),Ve.listRepos().then(({repos:D})=>{const M=D.find(U=>U.id===r);M&&k(M)}))},[r]);function O(){return t==="coverage"?w.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:w.jsx(Tw,{})}):t==="workflows"?w.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:w.jsx(Xj,{})}):t==="domain"?w.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:w.jsx(dE,{})}):t==="policies"?w.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:w.jsx(AE,{})}):t==="rules"?w.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:w.jsx(M5,{})}):t==="repos"?w.jsx("div",{className:"flex-1 overflow-hidden",children:w.jsx($E,{onSelectRun:x,autoShowRegister:s,navigate:a})}):t==="repo-detail"&&r?w.jsx("div",{className:"flex-1 overflow-y-auto",children:w.jsx(KE,{repoId:r,onSelectRun:x,navigate:a,onOpenGraph:I})}):t==="chats"?w.jsx("div",{className:"flex-1 overflow-y-auto",children:w.jsx(rE,{runs:l,onSelect:x,navigate:a})}):t==="work"?w.jsx("div",{className:"flex-1 overflow-y-auto",children:w.jsx(Qj,{runs:l,selectedRunId:e,onSelect:x,navigate:a})}):t==="projects"?w.jsx("div",{className:"flex-1 overflow-y-auto",children:w.jsx(zE,{navigate:a})}):t==="project-detail"&&n?w.jsx("div",{className:"flex-1 overflow-y-auto",children:w.jsx(OE,{projectId:n,navigate:a})}):t==="system"?w.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:w.jsx(eF,{})}):t==="runs"&&!e&&!N&&!i?w.jsx("div",{className:"flex-1 overflow-y-auto",children:w.jsx(eE,{runs:l,onSelectRun:x,onApproveGate:_,onRejectGate:v,navigate:a})}):o&&N===null?w.jsx("div",{className:"flex-1 overflow-hidden",children:w.jsx(Uj,{repoId:r,onBack:S})}):w.jsx("div",{className:"flex-1 overflow-hidden",children:w.jsx(Fj,{view:N,chatMode:o,onLaunched:b,onNavigateBack:S,onRefresh:u,onKill:T})})}return w.jsxs("div",{className:"flex h-screen overflow-hidden bg-wk-canvas",children:[w.jsx(EE,{runs:l,selectedRunId:e,onSelectRun:x,navigate:a}),w.jsx("div",{className:"flex flex-1 overflow-hidden",children:O()}),N!==null&&w.jsx(D5,{view:N}),w.jsx(hE,{onSelect:x,runId:e}),E!==null&&w.jsx(JA,{repo:E,initialFocus:L,onClose:()=>{k(null),A(null)},onSelectRun:x})]})}class lF extends J.Component{constructor(){super(...arguments);y0(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:w.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:[w.jsx("p",{className:"text-sm font-semibold",style:{color:"#f85149"},children:"Something went wrong"}),w.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."}),w.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 WS=document.getElementById("root");if(!WS)throw new Error("Root element not found");Ok.createRoot(WS).render(w.jsx(J.StrictMode,{children:w.jsx(lF,{children:w.jsx(oF,{})})}));
|