diff --git a/ui/dist/assets/index-VwwcTCRX.js b/ui/dist/assets/index-BDvcb1RI.js similarity index 63% rename from ui/dist/assets/index-VwwcTCRX.js rename to ui/dist/assets/index-BDvcb1RI.js index 075bd7a3..3a99fa81 100644 --- a/ui/dist/assets/index-VwwcTCRX.js +++ b/ui/dist/assets/index-BDvcb1RI.js @@ -1,4 +1,4 @@ -(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))r(a);new MutationObserver(a=>{for(const l of a)if(l.type==="childList")for(const u of l.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&r(u)}).observe(document,{childList:!0,subtree:!0});function n(a){const l={};return a.integrity&&(l.integrity=a.integrity),a.referrerPolicy&&(l.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?l.credentials="include":a.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function r(a){if(a.ep)return;a.ep=!0;const l=n(a);fetch(a.href,l)}})();function Fu(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var zd={exports:{}},_o={};/** +(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))r(a);new MutationObserver(a=>{for(const l of a)if(l.type==="childList")for(const u of l.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&r(u)}).observe(document,{childList:!0,subtree:!0});function n(a){const l={};return a.integrity&&(l.integrity=a.integrity),a.referrerPolicy&&(l.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?l.credentials="include":a.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function r(a){if(a.ep)return;a.ep=!0;const l=n(a);fetch(a.href,l)}})();function Hu(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Id={exports:{}},_o={};/** * @license React * react-jsx-runtime.production.js * @@ -6,7 +6,7 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var Ey;function tA(){if(Ey)return _o;Ey=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,a,l){var u=null;if(l!==void 0&&(u=""+l),a.key!==void 0&&(u=""+a.key),"key"in a){l={};for(var o in a)o!=="key"&&(l[o]=a[o])}else l=a;return a=l.ref,{$$typeof:e,type:r,key:u,ref:a!==void 0?a:null,props:l}}return _o.Fragment=t,_o.jsx=n,_o.jsxs=n,_o}var ky;function nA(){return ky||(ky=1,zd.exports=tA()),zd.exports}var m=nA(),Hd={exports:{}},He={};/** + */var Ey;function nA(){if(Ey)return _o;Ey=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,a,l){var u=null;if(l!==void 0&&(u=""+l),a.key!==void 0&&(u=""+a.key),"key"in a){l={};for(var o in a)o!=="key"&&(l[o]=a[o])}else l=a;return a=l.ref,{$$typeof:e,type:r,key:u,ref:a!==void 0?a:null,props:l}}return _o.Fragment=t,_o.jsx=n,_o.jsxs=n,_o}var ky;function iA(){return ky||(ky=1,Id.exports=nA()),Id.exports}var m=iA(),zd={exports:{}},He={};/** * @license React * react.production.js * @@ -14,7 +14,7 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var Ay;function iA(){if(Ay)return He;Ay=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),l=Symbol.for("react.consumer"),u=Symbol.for("react.context"),o=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),d=Symbol.for("react.activity"),_=Symbol.iterator;function v(j){return j===null||typeof j!="object"?null:(j=_&&j[_]||j["@@iterator"],typeof j=="function"?j:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,y={};function S(j,$,U){this.props=j,this.context=$,this.refs=y,this.updater=U||w}S.prototype.isReactComponent={},S.prototype.setState=function(j,$){if(typeof j!="object"&&typeof j!="function"&&j!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,j,$,"setState")},S.prototype.forceUpdate=function(j){this.updater.enqueueForceUpdate(this,j,"forceUpdate")};function x(){}x.prototype=S.prototype;function b(j,$,U){this.props=j,this.context=$,this.refs=y,this.updater=U||w}var k=b.prototype=new x;k.constructor=b,C(k,S.prototype),k.isPureReactComponent=!0;var D=Array.isArray;function T(){}var R={H:null,A:null,T:null,S:null},N=Object.prototype.hasOwnProperty;function M(j,$,U){var Q=U.ref;return{$$typeof:e,type:j,key:$,ref:Q!==void 0?Q:null,props:U}}function B(j,$){return M(j.type,$,j.props)}function H(j){return typeof j=="object"&&j!==null&&j.$$typeof===e}function Y(j){var $={"=":"=0",":":"=2"};return"$"+j.replace(/[=:]/g,function(U){return $[U]})}var F=/\/+/g;function z(j,$){return typeof j=="object"&&j!==null&&j.key!=null?Y(""+j.key):$.toString(36)}function q(j){switch(j.status){case"fulfilled":return j.value;case"rejected":throw j.reason;default:switch(typeof j.status=="string"?j.then(T,T):(j.status="pending",j.then(function($){j.status==="pending"&&(j.status="fulfilled",j.value=$)},function($){j.status==="pending"&&(j.status="rejected",j.reason=$)})),j.status){case"fulfilled":return j.value;case"rejected":throw j.reason}}throw j}function G(j,$,U,Q,re){var ae=typeof j;(ae==="undefined"||ae==="boolean")&&(j=null);var Z=!1;if(j===null)Z=!0;else switch(ae){case"bigint":case"string":case"number":Z=!0;break;case"object":switch(j.$$typeof){case e:case t:Z=!0;break;case p:return Z=j._init,G(Z(j._payload),$,U,Q,re)}}if(Z)return re=re(j),Z=Q===""?"."+z(j,0):Q,D(re)?(U="",Z!=null&&(U=Z.replace(F,"$&/")+"/"),G(re,$,U,"",function(ie){return ie})):re!=null&&(H(re)&&(re=B(re,U+(re.key==null||j&&j.key===re.key?"":(""+re.key).replace(F,"$&/")+"/")+Z)),$.push(re)),1;Z=0;var P=Q===""?".":Q+":";if(D(j))for(var te=0;te>>1,L=G[O];if(0>>1;Oa(U,K))Qa(re,U)?(G[O]=re,G[Q]=K,O=Q):(G[O]=U,G[$]=K,O=$);else if(Qa(re,K))G[O]=re,G[Q]=K,O=Q;else break e}}return X}function a(G,X){var K=G.sortIndex-X.sortIndex;return K!==0?K:G.id-X.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var l=performance;e.unstable_now=function(){return l.now()}}else{var u=Date,o=u.now();e.unstable_now=function(){return u.now()-o}}var c=[],f=[],p=1,d=null,_=3,v=!1,w=!1,C=!1,y=!1,S=typeof setTimeout=="function"?setTimeout:null,x=typeof clearTimeout=="function"?clearTimeout:null,b=typeof setImmediate<"u"?setImmediate:null;function k(G){for(var X=n(f);X!==null;){if(X.callback===null)r(f);else if(X.startTime<=G)r(f),X.sortIndex=X.expirationTime,t(c,X);else break;X=n(f)}}function D(G){if(C=!1,k(G),!w)if(n(c)!==null)w=!0,T||(T=!0,Y());else{var X=n(f);X!==null&&q(D,X.startTime-G)}}var T=!1,R=-1,N=5,M=-1;function B(){return y?!0:!(e.unstable_now()-MG&&B());){var O=d.callback;if(typeof O=="function"){d.callback=null,_=d.priorityLevel;var L=O(d.expirationTime<=G);if(G=e.unstable_now(),typeof L=="function"){d.callback=L,k(G),X=!0;break t}d===n(c)&&r(c),k(G)}else r(c);d=n(c)}if(d!==null)X=!0;else{var j=n(f);j!==null&&q(D,j.startTime-G),X=!1}}break e}finally{d=null,_=K,v=!1}X=void 0}}finally{X?Y():T=!1}}}var Y;if(typeof b=="function")Y=function(){b(H)};else if(typeof MessageChannel<"u"){var F=new MessageChannel,z=F.port2;F.port1.onmessage=H,Y=function(){z.postMessage(null)}}else Y=function(){S(H,0)};function q(G,X){R=S(function(){G(e.unstable_now())},X)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(G){G.callback=null},e.unstable_forceFrameRate=function(G){0>G||125O?(G.sortIndex=K,t(f,G),n(c)===null&&G===n(f)&&(C?(x(R),R=-1):C=!0,q(D,K-O))):(G.sortIndex=L,t(c,G),w||v||(w=!0,T||(T=!0,Y()))),G},e.unstable_shouldYield=B,e.unstable_wrapCallback=function(G){var X=_;return function(){var K=_;_=X;try{return G.apply(this,arguments)}finally{_=K}}}})(Ud)),Ud}var Dy;function aA(){return Dy||(Dy=1,Pd.exports=sA()),Pd.exports}var $d={exports:{}},Jt={};/** + */var Ny;function aA(){return Ny||(Ny=1,(function(e){function t(G,X){var K=G.length;G.push(X);e:for(;0>>1,L=G[O];if(0>>1;Oa(U,K))Qa(re,U)?(G[O]=re,G[Q]=K,O=Q):(G[O]=U,G[$]=K,O=$);else if(Qa(re,K))G[O]=re,G[Q]=K,O=Q;else break e}}return X}function a(G,X){var K=G.sortIndex-X.sortIndex;return K!==0?K:G.id-X.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var l=performance;e.unstable_now=function(){return l.now()}}else{var u=Date,o=u.now();e.unstable_now=function(){return u.now()-o}}var c=[],f=[],p=1,d=null,_=3,v=!1,w=!1,C=!1,b=!1,S=typeof setTimeout=="function"?setTimeout:null,x=typeof clearTimeout=="function"?clearTimeout:null,y=typeof setImmediate<"u"?setImmediate:null;function k(G){for(var X=n(f);X!==null;){if(X.callback===null)r(f);else if(X.startTime<=G)r(f),X.sortIndex=X.expirationTime,t(c,X);else break;X=n(f)}}function D(G){if(C=!1,k(G),!w)if(n(c)!==null)w=!0,T||(T=!0,Y());else{var X=n(f);X!==null&&q(D,X.startTime-G)}}var T=!1,R=-1,N=5,M=-1;function B(){return b?!0:!(e.unstable_now()-MG&&B());){var O=d.callback;if(typeof O=="function"){d.callback=null,_=d.priorityLevel;var L=O(d.expirationTime<=G);if(G=e.unstable_now(),typeof L=="function"){d.callback=L,k(G),X=!0;break t}d===n(c)&&r(c),k(G)}else r(c);d=n(c)}if(d!==null)X=!0;else{var j=n(f);j!==null&&q(D,j.startTime-G),X=!1}}break e}finally{d=null,_=K,v=!1}X=void 0}}finally{X?Y():T=!1}}}var Y;if(typeof y=="function")Y=function(){y(H)};else if(typeof MessageChannel<"u"){var F=new MessageChannel,z=F.port2;F.port1.onmessage=H,Y=function(){z.postMessage(null)}}else Y=function(){S(H,0)};function q(G,X){R=S(function(){G(e.unstable_now())},X)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(G){G.callback=null},e.unstable_forceFrameRate=function(G){0>G||125O?(G.sortIndex=K,t(f,G),n(c)===null&&G===n(f)&&(C?(x(R),R=-1):C=!0,q(D,K-O))):(G.sortIndex=L,t(c,G),w||v||(w=!0,T||(T=!0,Y()))),G},e.unstable_shouldYield=B,e.unstable_wrapCallback=function(G){var X=_;return function(){var K=_;_=X;try{return G.apply(this,arguments)}finally{_=K}}}})(Pd)),Pd}var Dy;function oA(){return Dy||(Dy=1,Fd.exports=aA()),Fd.exports}var Ud={exports:{}},Jt={};/** * @license React * react-dom.production.js * @@ -30,7 +30,7 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var Ry;function oA(){if(Ry)return Jt;Ry=1;var e=tl();function t(c){var f="https://react.dev/errors/"+c;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),$d.exports=oA(),$d.exports}/** + */var Ry;function lA(){if(Ry)return Jt;Ry=1;var e=tl();function t(c){var f="https://react.dev/errors/"+c;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Ud.exports=lA(),Ud.exports}/** * @license React * react-dom-client.production.js * @@ -38,15 +38,15 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var Ly;function lA(){if(Ly)return vo;Ly=1;var e=aA(),t=tl(),n=jS();function r(i){var s="https://react.dev/errors/"+i;if(1L||(i.current=O[L],O[L]=null,L--)}function U(i,s){L++,O[L]=i.current,i.current=s}var Q=j(null),re=j(null),ae=j(null),Z=j(null);function P(i,s){switch(U(ae,s),U(re,i),U(Q,null),s.nodeType){case 9:case 11:i=(i=s.documentElement)&&(i=i.namespaceURI)?Wv(i):0;break;default:if(i=s.tagName,s=s.namespaceURI)s=Wv(s),i=Xv(s,i);else switch(i){case"svg":i=1;break;case"math":i=2;break;default:i=0}}$(Q),U(Q,i)}function te(){$(Q),$(re),$(ae)}function ie(i){i.memoizedState!==null&&U(Z,i);var s=Q.current,h=Xv(s,i.type);s!==h&&(U(re,i),U(Q,h))}function pe(i){re.current===i&&($(Q),$(re)),Z.current===i&&($(Z),fo._currentValue=K)}var he,ye;function we(i){if(he===void 0)try{throw Error()}catch(h){var s=h.stack.trim().match(/\n( *(at )?)/);he=s&&s[1]||"",ye=-1L||(i.current=O[L],O[L]=null,L--)}function U(i,s){L++,O[L]=i.current,i.current=s}var Q=j(null),re=j(null),ae=j(null),Z=j(null);function P(i,s){switch(U(ae,s),U(re,i),U(Q,null),s.nodeType){case 9:case 11:i=(i=s.documentElement)&&(i=i.namespaceURI)?Wv(i):0;break;default:if(i=s.tagName,s=s.namespaceURI)s=Wv(s),i=Xv(s,i);else switch(i){case"svg":i=1;break;case"math":i=2;break;default:i=0}}$(Q),U(Q,i)}function ee(){$(Q),$(re),$(ae)}function ie(i){i.memoizedState!==null&&U(Z,i);var s=Q.current,h=Xv(s,i.type);s!==h&&(U(re,i),U(Q,h))}function ge(i){re.current===i&&($(Q),$(re)),Z.current===i&&($(Z),fo._currentValue=K)}var he,ye;function Se(i){if(he===void 0)try{throw Error()}catch(h){var s=h.stack.trim().match(/\n( *(at )?)/);he=s&&s[1]||"",ye=-1)":-1E||J[g]!==le[E]){var ge=` -`+J[g].replace(" at new "," at ");return i.displayName&&ge.includes("")&&(ge=ge.replace("",i.displayName)),ge}while(1<=g&&0<=E);break}}}finally{Ce=!1,Error.prepareStackTrace=h}return(h=i?i.displayName||i.name:"")?we(h):""}function xe(i,s){switch(i.tag){case 26:case 27:case 5:return we(i.type);case 16:return we("Lazy");case 13:return i.child!==s&&s!==null?we("Suspense Fallback"):we("Suspense");case 19:return we("SuspenseList");case 0:case 15:return Ae(i.type,!1);case 11:return Ae(i.type.render,!1);case 1:return Ae(i.type,!0);case 31:return we("Activity");default:return""}}function Ye(i){try{var s="",h=null;do s+=xe(i,h),h=i,i=i.return;while(i);return s}catch(g){return` +`);for(E=g=0;gE||J[g]!==le[E]){var me=` +`+J[g].replace(" at new "," at ");return i.displayName&&me.includes("")&&(me=me.replace("",i.displayName)),me}while(1<=g&&0<=E);break}}}finally{Ae=!1,Error.prepareStackTrace=h}return(h=i?i.displayName||i.name:"")?Se(h):""}function we(i,s){switch(i.tag){case 26:case 27:case 5:return Se(i.type);case 16:return Se("Lazy");case 13:return i.child!==s&&s!==null?Se("Suspense Fallback"):Se("Suspense");case 19:return Se("SuspenseList");case 0:case 15:return Ce(i.type,!1);case 11:return Ce(i.type.render,!1);case 1:return Ce(i.type,!0);case 31:return Se("Activity");default:return""}}function at(i){try{var s="",h=null;do s+=we(i,h),h=i,i=i.return;while(i);return s}catch(g){return` Error generating stack: `+g.message+` -`+g.stack}}var lt=Object.prototype.hasOwnProperty,dt=e.unstable_scheduleCallback,it=e.unstable_cancelCallback,pt=e.unstable_shouldYield,rt=e.unstable_requestPaint,Ue=e.unstable_now,Je=e.unstable_getCurrentPriorityLevel,fe=e.unstable_ImmediatePriority,ee=e.unstable_UserBlockingPriority,me=e.unstable_NormalPriority,be=e.unstable_LowPriority,Ee=e.unstable_IdlePriority,Be=e.log,Ie=e.unstable_setDisableYieldValue,Ke=null,ct=null;function Ut(i){if(typeof Be=="function"&&Ie(i),ct&&typeof ct.setStrictMode=="function")try{ct.setStrictMode(Ke,i)}catch{}}var st=Math.clz32?Math.clz32:ls,yn=Math.log,Zt=Math.LN2;function ls(i){return i>>>=0,i===0?32:31-(yn(i)/Zt|0)|0}var pi=256,ue=262144,ke=4194304;function Ne(i){var s=i&42;if(s!==0)return s;switch(i&-i){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return i&261888;case 262144:case 524288:case 1048576:case 2097152:return i&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return i&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return i}}function et(i,s,h){var g=i.pendingLanes;if(g===0)return 0;var E=0,A=i.suspendedLanes,I=i.pingedLanes;i=i.warmLanes;var W=g&134217727;return W!==0?(g=W&~A,g!==0?E=Ne(g):(I&=W,I!==0?E=Ne(I):h||(h=W&~i,h!==0&&(E=Ne(h))))):(W=g&~A,W!==0?E=Ne(W):I!==0?E=Ne(I):h||(h=g&~i,h!==0&&(E=Ne(h)))),E===0?0:s!==0&&s!==E&&(s&A)===0&&(A=E&-E,h=s&-s,A>=h||A===32&&(h&4194048)!==0)?s:E}function ut(i,s){return(i.pendingLanes&~(i.suspendedLanes&~i.pingedLanes)&s)===0}function cs(i,s){switch(i){case 1:case 2:case 4:case 8:case 64:return s+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return s+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function nn(){var i=ke;return ke<<=1,(ke&62914560)===0&&(ke=4194304),i}function Cr(i){for(var s=[],h=0;31>h;h++)s.push(i);return s}function Er(i,s){i.pendingLanes|=s,s!==268435456&&(i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0)}function Th(i,s,h,g,E,A){var I=i.pendingLanes;i.pendingLanes=h,i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0,i.expiredLanes&=h,i.entangledLanes&=h,i.errorRecoveryDisabledLanes&=h,i.shellSuspendCounter=0;var W=i.entanglements,J=i.expirationTimes,le=i.hiddenUpdates;for(h=I&~h;0"u")return null;try{return i.activeElement||i.body}catch{return i.body}}var kl=/[\n"\\]/g;function on(i){return i.replace(kl,function(s){return"\\"+s.charCodeAt(0).toString(16)+" "})}function ka(i,s,h,g,E,A,I,W){i.name="",I!=null&&typeof I!="function"&&typeof I!="symbol"&&typeof I!="boolean"?i.type=I:i.removeAttribute("type"),s!=null?I==="number"?(s===0&&i.value===""||i.value!=s)&&(i.value=""+an(s)):i.value!==""+an(s)&&(i.value=""+an(s)):I!=="submit"&&I!=="reset"||i.removeAttribute("value"),s!=null?Aa(i,I,an(s)):h!=null?Aa(i,I,an(h)):g!=null&&i.removeAttribute("value"),E==null&&A!=null&&(i.defaultChecked=!!A),E!=null&&(i.checked=E&&typeof E!="function"&&typeof E!="symbol"),W!=null&&typeof W!="function"&&typeof W!="symbol"&&typeof W!="boolean"?i.name=""+an(W):i.removeAttribute("name")}function ps(i,s,h,g,E,A,I,W){if(A!=null&&typeof A!="function"&&typeof A!="symbol"&&typeof A!="boolean"&&(i.type=A),s!=null||h!=null){if(!(A!=="submit"&&A!=="reset"||s!=null)){Ea(i);return}h=h!=null?""+an(h):"",s=s!=null?""+an(s):h,W||s===i.value||(i.value=s),i.defaultValue=s}g=g??E,g=typeof g!="function"&&typeof g!="symbol"&&!!g,i.checked=W?i.checked:!!g,i.defaultChecked=!!g,I!=null&&typeof I!="function"&&typeof I!="symbol"&&typeof I!="boolean"&&(i.name=I),Ea(i)}function Aa(i,s,h){s==="number"&&ds(i.ownerDocument)===i||i.defaultValue===""+h||(i.defaultValue=""+h)}function Vi(i,s,h,g){if(i=i.options,s){s={};for(var E=0;E"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ih=!1;if(vi)try{var Da={};Object.defineProperty(Da,"passive",{get:function(){Ih=!0}}),window.addEventListener("test",Da,Da),window.removeEventListener("test",Da,Da)}catch{Ih=!1}var Yi=null,zh=null,Tl=null;function Xm(){if(Tl)return Tl;var i,s=zh,h=s.length,g,E="value"in Yi?Yi.value:Yi.textContent,A=E.length;for(i=0;i=La),t0=" ",n0=!1;function i0(i,s){switch(i){case"keyup":return w2.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function r0(i){return i=i.detail,typeof i=="object"&&"data"in i?i.data:null}var vs=!1;function E2(i,s){switch(i){case"compositionend":return r0(s);case"keypress":return s.which!==32?null:(n0=!0,t0);case"textInput":return i=s.data,i===t0&&n0?null:i;default:return null}}function k2(i,s){if(vs)return i==="compositionend"||!$h&&i0(i,s)?(i=Xm(),Tl=zh=Yi=null,vs=!1,i):null;switch(i){case"paste":return null;case"keypress":if(!(s.ctrlKey||s.altKey||s.metaKey)||s.ctrlKey&&s.altKey){if(s.char&&1=s)return{node:h,offset:s-i};i=g}e:{for(;h;){if(h.nextSibling){h=h.nextSibling;break e}h=h.parentNode}h=void 0}h=f0(h)}}function p0(i,s){return i&&s?i===s?!0:i&&i.nodeType===3?!1:s&&s.nodeType===3?p0(i,s.parentNode):"contains"in i?i.contains(s):i.compareDocumentPosition?!!(i.compareDocumentPosition(s)&16):!1:!1}function g0(i){i=i!=null&&i.ownerDocument!=null&&i.ownerDocument.defaultView!=null?i.ownerDocument.defaultView:window;for(var s=ds(i.document);s instanceof i.HTMLIFrameElement;){try{var h=typeof s.contentWindow.location.href=="string"}catch{h=!1}if(h)i=s.contentWindow;else break;s=ds(i.document)}return s}function Vh(i){var s=i&&i.nodeName&&i.nodeName.toLowerCase();return s&&(s==="input"&&(i.type==="text"||i.type==="search"||i.type==="tel"||i.type==="url"||i.type==="password")||s==="textarea"||i.contentEditable==="true")}var O2=vi&&"documentMode"in document&&11>=document.documentMode,ys=null,Yh=null,Ia=null,Wh=!1;function m0(i,s,h){var g=h.window===h?h.document:h.nodeType===9?h:h.ownerDocument;Wh||ys==null||ys!==ds(g)||(g=ys,"selectionStart"in g&&Vh(g)?g={start:g.selectionStart,end:g.selectionEnd}:(g=(g.ownerDocument&&g.ownerDocument.defaultView||window).getSelection(),g={anchorNode:g.anchorNode,anchorOffset:g.anchorOffset,focusNode:g.focusNode,focusOffset:g.focusOffset}),Ia&&Ba(Ia,g)||(Ia=g,g=Sc(Yh,"onSelect"),0>=I,E-=I,ni=1<<32-st(s)+E|h<Pe?(Xe=De,De=null):Xe=De.sibling;var ot=ce(se,De,oe[Pe],_e);if(ot===null){De===null&&(De=Xe);break}i&&De&&ot.alternate===null&&s(se,De),ne=A(ot,ne,Pe),at===null?Le=ot:at.sibling=ot,at=ot,De=Xe}if(Pe===oe.length)return h(se,De),Ze&&bi(se,Pe),Le;if(De===null){for(;PePe?(Xe=De,De=null):Xe=De.sibling;var gr=ce(se,De,ot.value,_e);if(gr===null){De===null&&(De=Xe);break}i&&De&&gr.alternate===null&&s(se,De),ne=A(gr,ne,Pe),at===null?Le=gr:at.sibling=gr,at=gr,De=Xe}if(ot.done)return h(se,De),Ze&&bi(se,Pe),Le;if(De===null){for(;!ot.done;Pe++,ot=oe.next())ot=ve(se,ot.value,_e),ot!==null&&(ne=A(ot,ne,Pe),at===null?Le=ot:at.sibling=ot,at=ot);return Ze&&bi(se,Pe),Le}for(De=g(De);!ot.done;Pe++,ot=oe.next())ot=de(De,se,Pe,ot.value,_e),ot!==null&&(i&&ot.alternate!==null&&De.delete(ot.key===null?Pe:ot.key),ne=A(ot,ne,Pe),at===null?Le=ot:at.sibling=ot,at=ot);return i&&De.forEach(function(eA){return s(se,eA)}),Ze&&bi(se,Pe),Le}function yt(se,ne,oe,_e){if(typeof oe=="object"&&oe!==null&&oe.type===C&&oe.key===null&&(oe=oe.props.children),typeof oe=="object"&&oe!==null){switch(oe.$$typeof){case v:e:{for(var Le=oe.key;ne!==null;){if(ne.key===Le){if(Le=oe.type,Le===C){if(ne.tag===7){h(se,ne.sibling),_e=E(ne,oe.props.children),_e.return=se,se=_e;break e}}else if(ne.elementType===Le||typeof Le=="object"&&Le!==null&&Le.$$typeof===N&&Ir(Le)===ne.type){h(se,ne.sibling),_e=E(ne,oe.props),$a(_e,oe),_e.return=se,se=_e;break e}h(se,ne);break}else s(se,ne);ne=ne.sibling}oe.type===C?(_e=Mr(oe.props.children,se.mode,_e,oe.key),_e.return=se,se=_e):(_e=zl(oe.type,oe.key,oe.props,null,se.mode,_e),$a(_e,oe),_e.return=se,se=_e)}return I(se);case w:e:{for(Le=oe.key;ne!==null;){if(ne.key===Le)if(ne.tag===4&&ne.stateNode.containerInfo===oe.containerInfo&&ne.stateNode.implementation===oe.implementation){h(se,ne.sibling),_e=E(ne,oe.children||[]),_e.return=se,se=_e;break e}else{h(se,ne);break}else s(se,ne);ne=ne.sibling}_e=tf(oe,se.mode,_e),_e.return=se,se=_e}return I(se);case N:return oe=Ir(oe),yt(se,ne,oe,_e)}if(q(oe))return Te(se,ne,oe,_e);if(Y(oe)){if(Le=Y(oe),typeof Le!="function")throw Error(r(150));return oe=Le.call(oe),je(se,ne,oe,_e)}if(typeof oe.then=="function")return yt(se,ne,ql(oe),_e);if(oe.$$typeof===b)return yt(se,ne,Pl(se,oe),_e);Vl(se,oe)}return typeof oe=="string"&&oe!==""||typeof oe=="number"||typeof oe=="bigint"?(oe=""+oe,ne!==null&&ne.tag===6?(h(se,ne.sibling),_e=E(ne,oe),_e.return=se,se=_e):(h(se,ne),_e=ef(oe,se.mode,_e),_e.return=se,se=_e),I(se)):h(se,ne)}return function(se,ne,oe,_e){try{Ua=0;var Le=yt(se,ne,oe,_e);return Ds=null,Le}catch(De){if(De===Ns||De===$l)throw De;var at=Sn(29,De,null,se.mode);return at.lanes=_e,at.return=se,at}finally{}}}var Hr=H0(!0),F0=H0(!1),Qi=!1;function pf(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function gf(i,s){i=i.updateQueue,s.updateQueue===i&&(s.updateQueue={baseState:i.baseState,firstBaseUpdate:i.firstBaseUpdate,lastBaseUpdate:i.lastBaseUpdate,shared:i.shared,callbacks:null})}function Ji(i){return{lane:i,tag:0,payload:null,callback:null,next:null}}function er(i,s,h){var g=i.updateQueue;if(g===null)return null;if(g=g.shared,(ht&2)!==0){var E=g.pending;return E===null?s.next=s:(s.next=E.next,E.next=s),g.pending=s,s=Il(i),w0(i,null,h),s}return Bl(i,g,s,h),Il(i)}function Ga(i,s,h){if(s=s.updateQueue,s!==null&&(s=s.shared,(h&4194048)!==0)){var g=s.lanes;g&=i.pendingLanes,h|=g,s.lanes=h,ml(i,h)}}function mf(i,s){var h=i.updateQueue,g=i.alternate;if(g!==null&&(g=g.updateQueue,h===g)){var E=null,A=null;if(h=h.firstBaseUpdate,h!==null){do{var I={lane:h.lane,tag:h.tag,payload:h.payload,callback:null,next:null};A===null?E=A=I:A=A.next=I,h=h.next}while(h!==null);A===null?E=A=s:A=A.next=s}else E=A=s;h={baseState:g.baseState,firstBaseUpdate:E,lastBaseUpdate:A,shared:g.shared,callbacks:g.callbacks},i.updateQueue=h;return}i=h.lastBaseUpdate,i===null?h.firstBaseUpdate=s:i.next=s,h.lastBaseUpdate=s}var _f=!1;function qa(){if(_f){var i=Ts;if(i!==null)throw i}}function Va(i,s,h,g){_f=!1;var E=i.updateQueue;Qi=!1;var A=E.firstBaseUpdate,I=E.lastBaseUpdate,W=E.shared.pending;if(W!==null){E.shared.pending=null;var J=W,le=J.next;J.next=null,I===null?A=le:I.next=le,I=J;var ge=i.alternate;ge!==null&&(ge=ge.updateQueue,W=ge.lastBaseUpdate,W!==I&&(W===null?ge.firstBaseUpdate=le:W.next=le,ge.lastBaseUpdate=J))}if(A!==null){var ve=E.baseState;I=0,ge=le=J=null,W=A;do{var ce=W.lane&-536870913,de=ce!==W.lane;if(de?(We&ce)===ce:(g&ce)===ce){ce!==0&&ce===As&&(_f=!0),ge!==null&&(ge=ge.next={lane:0,tag:W.tag,payload:W.payload,callback:null,next:null});e:{var Te=i,je=W;ce=s;var yt=h;switch(je.tag){case 1:if(Te=je.payload,typeof Te=="function"){ve=Te.call(yt,ve,ce);break e}ve=Te;break e;case 3:Te.flags=Te.flags&-65537|128;case 0:if(Te=je.payload,ce=typeof Te=="function"?Te.call(yt,ve,ce):Te,ce==null)break e;ve=d({},ve,ce);break e;case 2:Qi=!0}}ce=W.callback,ce!==null&&(i.flags|=64,de&&(i.flags|=8192),de=E.callbacks,de===null?E.callbacks=[ce]:de.push(ce))}else de={lane:ce,tag:W.tag,payload:W.payload,callback:W.callback,next:null},ge===null?(le=ge=de,J=ve):ge=ge.next=de,I|=ce;if(W=W.next,W===null){if(W=E.shared.pending,W===null)break;de=W,W=de.next,de.next=null,E.lastBaseUpdate=de,E.shared.pending=null}}while(!0);ge===null&&(J=ve),E.baseState=J,E.firstBaseUpdate=le,E.lastBaseUpdate=ge,A===null&&(E.shared.lanes=0),sr|=I,i.lanes=I,i.memoizedState=ve}}function P0(i,s){if(typeof i!="function")throw Error(r(191,i));i.call(s)}function U0(i,s){var h=i.callbacks;if(h!==null)for(i.callbacks=null,i=0;iA?A:8;var I=G.T,W={};G.T=W,Bf(i,!1,s,h);try{var J=E(),le=G.S;if(le!==null&&le(W,J),J!==null&&typeof J=="object"&&typeof J.then=="function"){var ge=$2(J,g);Xa(i,s,ge,kn(i))}else Xa(i,s,g,kn(i))}catch(ve){Xa(i,s,{then:function(){},status:"rejected",reason:ve},kn())}finally{X.p=A,I!==null&&W.types!==null&&(I.types=W.types),G.T=I}}function X2(){}function Of(i,s,h,g){if(i.tag!==5)throw Error(r(476));var E=b_(i).queue;y_(i,E,s,K,h===null?X2:function(){return S_(i),h(g)})}function b_(i){var s=i.memoizedState;if(s!==null)return s;s={memoizedState:K,baseState:K,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ci,lastRenderedState:K},next:null};var h={};return s.next={memoizedState:h,baseState:h,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ci,lastRenderedState:h},next:null},i.memoizedState=s,i=i.alternate,i!==null&&(i.memoizedState=s),s}function S_(i){var s=b_(i);s.next===null&&(s=i.alternate.memoizedState),Xa(i,s.next.queue,{},kn())}function jf(){return Wt(fo)}function x_(){return Lt().memoizedState}function w_(){return Lt().memoizedState}function K2(i){for(var s=i.return;s!==null;){switch(s.tag){case 24:case 3:var h=kn();i=Ji(h);var g=er(s,i,h);g!==null&&(dn(g,s,h),Ga(g,s,h)),s={cache:uf()},i.payload=s;return}s=s.return}}function Z2(i,s,h){var g=kn();h={lane:g,revertLane:0,gesture:null,action:h,hasEagerState:!1,eagerState:null,next:null},nc(i)?E_(s,h):(h=Qh(i,s,h,g),h!==null&&(dn(h,i,g),k_(h,s,g)))}function C_(i,s,h){var g=kn();Xa(i,s,h,g)}function Xa(i,s,h,g){var E={lane:g,revertLane:0,gesture:null,action:h,hasEagerState:!1,eagerState:null,next:null};if(nc(i))E_(s,E);else{var A=i.alternate;if(i.lanes===0&&(A===null||A.lanes===0)&&(A=s.lastRenderedReducer,A!==null))try{var I=s.lastRenderedState,W=A(I,h);if(E.hasEagerState=!0,E.eagerState=W,bn(W,I))return Bl(i,s,E,0),bt===null&&jl(),!1}catch{}finally{}if(h=Qh(i,s,E,g),h!==null)return dn(h,i,g),k_(h,s,g),!0}return!1}function Bf(i,s,h,g){if(g={lane:2,revertLane:pd(),gesture:null,action:g,hasEagerState:!1,eagerState:null,next:null},nc(i)){if(s)throw Error(r(479))}else s=Qh(i,h,g,2),s!==null&&dn(s,i,2)}function nc(i){var s=i.alternate;return i===Fe||s!==null&&s===Fe}function E_(i,s){Ms=Xl=!0;var h=i.pending;h===null?s.next=s:(s.next=h.next,h.next=s),i.pending=s}function k_(i,s,h){if((h&4194048)!==0){var g=s.lanes;g&=i.pendingLanes,h|=g,s.lanes=h,ml(i,h)}}var Ka={readContext:Wt,use:Ql,useCallback:Dt,useContext:Dt,useEffect:Dt,useImperativeHandle:Dt,useLayoutEffect:Dt,useInsertionEffect:Dt,useMemo:Dt,useReducer:Dt,useRef:Dt,useState:Dt,useDebugValue:Dt,useDeferredValue:Dt,useTransition:Dt,useSyncExternalStore:Dt,useId:Dt,useHostTransitionStatus:Dt,useFormState:Dt,useActionState:Dt,useOptimistic:Dt,useMemoCache:Dt,useCacheRefresh:Dt};Ka.useEffectEvent=Dt;var A_={readContext:Wt,use:Ql,useCallback:function(i,s){return rn().memoizedState=[i,s===void 0?null:s],i},useContext:Wt,useEffect:u_,useImperativeHandle:function(i,s,h){h=h!=null?h.concat([i]):null,ec(4194308,4,p_.bind(null,s,i),h)},useLayoutEffect:function(i,s){return ec(4194308,4,i,s)},useInsertionEffect:function(i,s){ec(4,2,i,s)},useMemo:function(i,s){var h=rn();s=s===void 0?null:s;var g=i();if(Fr){Ut(!0);try{i()}finally{Ut(!1)}}return h.memoizedState=[g,s],g},useReducer:function(i,s,h){var g=rn();if(h!==void 0){var E=h(s);if(Fr){Ut(!0);try{h(s)}finally{Ut(!1)}}}else E=s;return g.memoizedState=g.baseState=E,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:E},g.queue=i,i=i.dispatch=Z2.bind(null,Fe,i),[g.memoizedState,i]},useRef:function(i){var s=rn();return i={current:i},s.memoizedState=i},useState:function(i){i=Nf(i);var s=i.queue,h=C_.bind(null,Fe,s);return s.dispatch=h,[i.memoizedState,h]},useDebugValue:Mf,useDeferredValue:function(i,s){var h=rn();return Lf(h,i,s)},useTransition:function(){var i=Nf(!1);return i=y_.bind(null,Fe,i.queue,!0,!1),rn().memoizedState=i,[!1,i]},useSyncExternalStore:function(i,s,h){var g=Fe,E=rn();if(Ze){if(h===void 0)throw Error(r(407));h=h()}else{if(h=s(),bt===null)throw Error(r(349));(We&127)!==0||W0(g,s,h)}E.memoizedState=h;var A={value:h,getSnapshot:s};return E.queue=A,u_(K0.bind(null,g,A,i),[i]),g.flags|=2048,Os(9,{destroy:void 0},X0.bind(null,g,A,h,s),null),h},useId:function(){var i=rn(),s=bt.identifierPrefix;if(Ze){var h=ii,g=ni;h=(g&~(1<<32-st(g)-1)).toString(32)+h,s="_"+s+"R_"+h,h=Kl++,0<\/script>",A=A.removeChild(A.firstChild);break;case"select":A=typeof g.is=="string"?I.createElement("select",{is:g.is}):I.createElement("select"),g.multiple?A.multiple=!0:g.size&&(A.size=g.size);break;default:A=typeof g.is=="string"?I.createElement(E,{is:g.is}):I.createElement(E)}}A[$t]=s,A[Qt]=g;e:for(I=s.child;I!==null;){if(I.tag===5||I.tag===6)A.appendChild(I.stateNode);else if(I.tag!==4&&I.tag!==27&&I.child!==null){I.child.return=I,I=I.child;continue}if(I===s)break e;for(;I.sibling===null;){if(I.return===null||I.return===s)break e;I=I.return}I.sibling.return=I.return,I=I.sibling}s.stateNode=A;e:switch(Kt(A,E,g),E){case"button":case"input":case"select":case"textarea":g=!!g.autoFocus;break e;case"img":g=!0;break e;default:g=!1}g&&ki(s)}}return Et(s),Kf(s,s.type,i===null?null:i.memoizedProps,s.pendingProps,h),null;case 6:if(i&&s.stateNode!=null)i.memoizedProps!==g&&ki(s);else{if(typeof g!="string"&&s.stateNode===null)throw Error(r(166));if(i=ae.current,Es(s)){if(i=s.stateNode,h=s.memoizedProps,g=null,E=Yt,E!==null)switch(E.tag){case 27:case 5:g=E.memoizedProps}i[$t]=s,i=!!(i.nodeValue===h||g!==null&&g.suppressHydrationWarning===!0||Vv(i.nodeValue,h)),i||Ki(s,!0)}else i=xc(i).createTextNode(g),i[$t]=s,s.stateNode=i}return Et(s),null;case 31:if(h=s.memoizedState,i===null||i.memoizedState!==null){if(g=Es(s),h!==null){if(i===null){if(!g)throw Error(r(318));if(i=s.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(r(557));i[$t]=s}else Lr(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;Et(s),i=!1}else h=af(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=h),i=!0;if(!i)return s.flags&256?(wn(s),s):(wn(s),null);if((s.flags&128)!==0)throw Error(r(558))}return Et(s),null;case 13:if(g=s.memoizedState,i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){if(E=Es(s),g!==null&&g.dehydrated!==null){if(i===null){if(!E)throw Error(r(318));if(E=s.memoizedState,E=E!==null?E.dehydrated:null,!E)throw Error(r(317));E[$t]=s}else Lr(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;Et(s),E=!1}else E=af(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=E),E=!0;if(!E)return s.flags&256?(wn(s),s):(wn(s),null)}return wn(s),(s.flags&128)!==0?(s.lanes=h,s):(h=g!==null,i=i!==null&&i.memoizedState!==null,h&&(g=s.child,E=null,g.alternate!==null&&g.alternate.memoizedState!==null&&g.alternate.memoizedState.cachePool!==null&&(E=g.alternate.memoizedState.cachePool.pool),A=null,g.memoizedState!==null&&g.memoizedState.cachePool!==null&&(A=g.memoizedState.cachePool.pool),A!==E&&(g.flags|=2048)),h!==i&&h&&(s.child.flags|=8192),oc(s,s.updateQueue),Et(s),null);case 4:return te(),i===null&&vd(s.stateNode.containerInfo),Et(s),null;case 10:return xi(s.type),Et(s),null;case 19:if($(Mt),g=s.memoizedState,g===null)return Et(s),null;if(E=(s.flags&128)!==0,A=g.rendering,A===null)if(E)Qa(g,!1);else{if(Rt!==0||i!==null&&(i.flags&128)!==0)for(i=s.child;i!==null;){if(A=Wl(i),A!==null){for(s.flags|=128,Qa(g,!1),i=A.updateQueue,s.updateQueue=i,oc(s,i),s.subtreeFlags=0,i=h,h=s.child;h!==null;)C0(h,i),h=h.sibling;return U(Mt,Mt.current&1|2),Ze&&bi(s,g.treeForkCount),s.child}i=i.sibling}g.tail!==null&&Ue()>fc&&(s.flags|=128,E=!0,Qa(g,!1),s.lanes=4194304)}else{if(!E)if(i=Wl(A),i!==null){if(s.flags|=128,E=!0,i=i.updateQueue,s.updateQueue=i,oc(s,i),Qa(g,!0),g.tail===null&&g.tailMode==="hidden"&&!A.alternate&&!Ze)return Et(s),null}else 2*Ue()-g.renderingStartTime>fc&&h!==536870912&&(s.flags|=128,E=!0,Qa(g,!1),s.lanes=4194304);g.isBackwards?(A.sibling=s.child,s.child=A):(i=g.last,i!==null?i.sibling=A:s.child=A,g.last=A)}return g.tail!==null?(i=g.tail,g.rendering=i,g.tail=i.sibling,g.renderingStartTime=Ue(),i.sibling=null,h=Mt.current,U(Mt,E?h&1|2:h&1),Ze&&bi(s,g.treeForkCount),i):(Et(s),null);case 22:case 23:return wn(s),yf(),g=s.memoizedState!==null,i!==null?i.memoizedState!==null!==g&&(s.flags|=8192):g&&(s.flags|=8192),g?(h&536870912)!==0&&(s.flags&128)===0&&(Et(s),s.subtreeFlags&6&&(s.flags|=8192)):Et(s),h=s.updateQueue,h!==null&&oc(s,h.retryQueue),h=null,i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(h=i.memoizedState.cachePool.pool),g=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(g=s.memoizedState.cachePool.pool),g!==h&&(s.flags|=2048),i!==null&&$(Br),null;case 24:return h=null,i!==null&&(h=i.memoizedState.cache),s.memoizedState.cache!==h&&(s.flags|=2048),xi(Bt),Et(s),null;case 25:return null;case 30:return null}throw Error(r(156,s.tag))}function nk(i,s){switch(rf(s),s.tag){case 1:return i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 3:return xi(Bt),te(),i=s.flags,(i&65536)!==0&&(i&128)===0?(s.flags=i&-65537|128,s):null;case 26:case 27:case 5:return pe(s),null;case 31:if(s.memoizedState!==null){if(wn(s),s.alternate===null)throw Error(r(340));Lr()}return i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 13:if(wn(s),i=s.memoizedState,i!==null&&i.dehydrated!==null){if(s.alternate===null)throw Error(r(340));Lr()}return i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 19:return $(Mt),null;case 4:return te(),null;case 10:return xi(s.type),null;case 22:case 23:return wn(s),yf(),i!==null&&$(Br),i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 24:return xi(Bt),null;case 25:return null;default:return null}}function Z_(i,s){switch(rf(s),s.tag){case 3:xi(Bt),te();break;case 26:case 27:case 5:pe(s);break;case 4:te();break;case 31:s.memoizedState!==null&&wn(s);break;case 13:wn(s);break;case 19:$(Mt);break;case 10:xi(s.type);break;case 22:case 23:wn(s),yf(),i!==null&&$(Br);break;case 24:xi(Bt)}}function Ja(i,s){try{var h=s.updateQueue,g=h!==null?h.lastEffect:null;if(g!==null){var E=g.next;h=E;do{if((h.tag&i)===i){g=void 0;var A=h.create,I=h.inst;g=A(),I.destroy=g}h=h.next}while(h!==E)}}catch(W){mt(s,s.return,W)}}function ir(i,s,h){try{var g=s.updateQueue,E=g!==null?g.lastEffect:null;if(E!==null){var A=E.next;g=A;do{if((g.tag&i)===i){var I=g.inst,W=I.destroy;if(W!==void 0){I.destroy=void 0,E=s;var J=h,le=W;try{le()}catch(ge){mt(E,J,ge)}}}g=g.next}while(g!==A)}}catch(ge){mt(s,s.return,ge)}}function Q_(i){var s=i.updateQueue;if(s!==null){var h=i.stateNode;try{U0(s,h)}catch(g){mt(i,i.return,g)}}}function J_(i,s,h){h.props=Pr(i.type,i.memoizedProps),h.state=i.memoizedState;try{h.componentWillUnmount()}catch(g){mt(i,s,g)}}function eo(i,s){try{var h=i.ref;if(h!==null){switch(i.tag){case 26:case 27:case 5:var g=i.stateNode;break;case 30:g=i.stateNode;break;default:g=i.stateNode}typeof h=="function"?i.refCleanup=h(g):h.current=g}}catch(E){mt(i,s,E)}}function ri(i,s){var h=i.ref,g=i.refCleanup;if(h!==null)if(typeof g=="function")try{g()}catch(E){mt(i,s,E)}finally{i.refCleanup=null,i=i.alternate,i!=null&&(i.refCleanup=null)}else if(typeof h=="function")try{h(null)}catch(E){mt(i,s,E)}else h.current=null}function ev(i){var s=i.type,h=i.memoizedProps,g=i.stateNode;try{e:switch(s){case"button":case"input":case"select":case"textarea":h.autoFocus&&g.focus();break e;case"img":h.src?g.src=h.src:h.srcSet&&(g.srcset=h.srcSet)}}catch(E){mt(i,i.return,E)}}function Zf(i,s,h){try{var g=i.stateNode;Ck(g,i.type,h,s),g[Qt]=s}catch(E){mt(i,i.return,E)}}function tv(i){return i.tag===5||i.tag===3||i.tag===26||i.tag===27&&ur(i.type)||i.tag===4}function Qf(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||tv(i.return))return null;i=i.return}for(i.sibling.return=i.return,i=i.sibling;i.tag!==5&&i.tag!==6&&i.tag!==18;){if(i.tag===27&&ur(i.type)||i.flags&2||i.child===null||i.tag===4)continue e;i.child.return=i,i=i.child}if(!(i.flags&2))return i.stateNode}}function Jf(i,s,h){var g=i.tag;if(g===5||g===6)i=i.stateNode,s?(h.nodeType===9?h.body:h.nodeName==="HTML"?h.ownerDocument.body:h).insertBefore(i,s):(s=h.nodeType===9?h.body:h.nodeName==="HTML"?h.ownerDocument.body:h,s.appendChild(i),h=h._reactRootContainer,h!=null||s.onclick!==null||(s.onclick=_i));else if(g!==4&&(g===27&&ur(i.type)&&(h=i.stateNode,s=null),i=i.child,i!==null))for(Jf(i,s,h),i=i.sibling;i!==null;)Jf(i,s,h),i=i.sibling}function lc(i,s,h){var g=i.tag;if(g===5||g===6)i=i.stateNode,s?h.insertBefore(i,s):h.appendChild(i);else if(g!==4&&(g===27&&ur(i.type)&&(h=i.stateNode),i=i.child,i!==null))for(lc(i,s,h),i=i.sibling;i!==null;)lc(i,s,h),i=i.sibling}function nv(i){var s=i.stateNode,h=i.memoizedProps;try{for(var g=i.type,E=s.attributes;E.length;)s.removeAttributeNode(E[0]);Kt(s,g,h),s[$t]=i,s[Qt]=h}catch(A){mt(i,i.return,A)}}var Ai=!1,Ht=!1,ed=!1,iv=typeof WeakSet=="function"?WeakSet:Set,qt=null;function ik(i,s){if(i=i.containerInfo,Sd=Nc,i=g0(i),Vh(i)){if("selectionStart"in i)var h={start:i.selectionStart,end:i.selectionEnd};else e:{h=(h=i.ownerDocument)&&h.defaultView||window;var g=h.getSelection&&h.getSelection();if(g&&g.rangeCount!==0){h=g.anchorNode;var E=g.anchorOffset,A=g.focusNode;g=g.focusOffset;try{h.nodeType,A.nodeType}catch{h=null;break e}var I=0,W=-1,J=-1,le=0,ge=0,ve=i,ce=null;t:for(;;){for(var de;ve!==h||E!==0&&ve.nodeType!==3||(W=I+E),ve!==A||g!==0&&ve.nodeType!==3||(J=I+g),ve.nodeType===3&&(I+=ve.nodeValue.length),(de=ve.firstChild)!==null;)ce=ve,ve=de;for(;;){if(ve===i)break t;if(ce===h&&++le===E&&(W=I),ce===A&&++ge===g&&(J=I),(de=ve.nextSibling)!==null)break;ve=ce,ce=ve.parentNode}ve=de}h=W===-1||J===-1?null:{start:W,end:J}}else h=null}h=h||{start:0,end:0}}else h=null;for(xd={focusedElem:i,selectionRange:h},Nc=!1,qt=s;qt!==null;)if(s=qt,i=s.child,(s.subtreeFlags&1028)!==0&&i!==null)i.return=s,qt=i;else for(;qt!==null;){switch(s=qt,A=s.alternate,i=s.flags,s.tag){case 0:if((i&4)!==0&&(i=s.updateQueue,i=i!==null?i.events:null,i!==null))for(h=0;h title"))),Kt(A,g,h),A[$t]=i,jt(A),g=A;break e;case"link":var I=cy("link","href",E).get(g+(h.href||""));if(I){for(var W=0;Wyt&&(I=yt,yt=je,je=I);var se=d0(W,je),ne=d0(W,yt);if(se&&ne&&(de.rangeCount!==1||de.anchorNode!==se.node||de.anchorOffset!==se.offset||de.focusNode!==ne.node||de.focusOffset!==ne.offset)){var oe=ve.createRange();oe.setStart(se.node,se.offset),de.removeAllRanges(),je>yt?(de.addRange(oe),de.extend(ne.node,ne.offset)):(oe.setEnd(ne.node,ne.offset),de.addRange(oe))}}}}for(ve=[],de=W;de=de.parentNode;)de.nodeType===1&&ve.push({element:de,left:de.scrollLeft,top:de.scrollTop});for(typeof W.focus=="function"&&W.focus(),W=0;Wh?32:h,G.T=null,h=od,od=null;var A=or,I=Mi;if(Gt=0,Hs=or=null,Mi=0,(ht&6)!==0)throw Error(r(331));var W=ht;if(ht|=4,pv(A.current),hv(A,A.current,I,h),ht=W,ao(0,!1),ct&&typeof ct.onPostCommitFiberRoot=="function")try{ct.onPostCommitFiberRoot(Ke,A)}catch{}return!0}finally{X.p=E,G.T=g,Mv(i,s)}}function Ov(i,s,h){s=Bn(h,s),s=Ff(i.stateNode,s,2),i=er(i,s,2),i!==null&&(Er(i,2),si(i))}function mt(i,s,h){if(i.tag===3)Ov(i,i,h);else for(;s!==null;){if(s.tag===3){Ov(s,i,h);break}else if(s.tag===1){var g=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof g.componentDidCatch=="function"&&(ar===null||!ar.has(g))){i=Bn(h,i),h=j_(2),g=er(s,h,2),g!==null&&(B_(h,g,s,i),Er(g,2),si(g));break}}s=s.return}}function hd(i,s,h){var g=i.pingCache;if(g===null){g=i.pingCache=new ak;var E=new Set;g.set(s,E)}else E=g.get(s),E===void 0&&(E=new Set,g.set(s,E));E.has(h)||(id=!0,E.add(h),i=hk.bind(null,i,s,h),s.then(i,i))}function hk(i,s,h){var g=i.pingCache;g!==null&&g.delete(s),i.pingedLanes|=i.suspendedLanes&h,i.warmLanes&=~h,bt===i&&(We&h)===h&&(Rt===4||Rt===3&&(We&62914560)===We&&300>Ue()-hc?(ht&2)===0&&Fs(i,0):rd|=h,zs===We&&(zs=0)),si(i)}function jv(i,s){s===0&&(s=nn()),i=Rr(i,s),i!==null&&(Er(i,s),si(i))}function fk(i){var s=i.memoizedState,h=0;s!==null&&(h=s.retryLane),jv(i,h)}function dk(i,s){var h=0;switch(i.tag){case 31:case 13:var g=i.stateNode,E=i.memoizedState;E!==null&&(h=E.retryLane);break;case 19:g=i.stateNode;break;case 22:g=i.stateNode._retryCache;break;default:throw Error(r(314))}g!==null&&g.delete(s),jv(i,h)}function pk(i,s){return dt(i,s)}var vc=null,Us=null,fd=!1,yc=!1,dd=!1,cr=0;function si(i){i!==Us&&i.next===null&&(Us===null?vc=Us=i:Us=Us.next=i),yc=!0,fd||(fd=!0,mk())}function ao(i,s){if(!dd&&yc){dd=!0;do for(var h=!1,g=vc;g!==null;){if(i!==0){var E=g.pendingLanes;if(E===0)var A=0;else{var I=g.suspendedLanes,W=g.pingedLanes;A=(1<<31-st(42|i)+1)-1,A&=E&~(I&~W),A=A&201326741?A&201326741|1:A?A|2:0}A!==0&&(h=!0,Hv(g,A))}else A=We,A=et(g,g===bt?A:0,g.cancelPendingCommit!==null||g.timeoutHandle!==-1),(A&3)===0||ut(g,A)||(h=!0,Hv(g,A));g=g.next}while(h);dd=!1}}function gk(){Bv()}function Bv(){yc=fd=!1;var i=0;cr!==0&&kk()&&(i=cr);for(var s=Ue(),h=null,g=vc;g!==null;){var E=g.next,A=Iv(g,s);A===0?(g.next=null,h===null?vc=E:h.next=E,E===null&&(Us=h)):(h=g,(i!==0||(A&3)!==0)&&(yc=!0)),g=E}Gt!==0&&Gt!==5||ao(i),cr!==0&&(cr=0)}function Iv(i,s){for(var h=i.suspendedLanes,g=i.pingedLanes,E=i.expirationTimes,A=i.pendingLanes&-62914561;0W)break;var ge=J.transferSize,ve=J.initiatorType;ge&&Yv(ve)&&(J=J.responseEnd,I+=ge*(J"u"?null:document;function sy(i,s,h){var g=$s;if(g&&typeof s=="string"&&s){var E=on(s);E='link[rel="'+i+'"][href="'+E+'"]',typeof h=="string"&&(E+='[crossorigin="'+h+'"]'),ry.has(E)||(ry.add(E),i={rel:i,crossOrigin:h,href:s},g.querySelector(E)===null&&(s=g.createElement("link"),Kt(s,"link",i),jt(s),g.head.appendChild(s)))}}function jk(i){Li.D(i),sy("dns-prefetch",i,null)}function Bk(i,s){Li.C(i,s),sy("preconnect",i,s)}function Ik(i,s,h){Li.L(i,s,h);var g=$s;if(g&&i&&s){var E='link[rel="preload"][as="'+on(s)+'"]';s==="image"&&h&&h.imageSrcSet?(E+='[imagesrcset="'+on(h.imageSrcSet)+'"]',typeof h.imageSizes=="string"&&(E+='[imagesizes="'+on(h.imageSizes)+'"]')):E+='[href="'+on(i)+'"]';var A=E;switch(s){case"style":A=Gs(i);break;case"script":A=qs(i)}Un.has(A)||(i=d({rel:"preload",href:s==="image"&&h&&h.imageSrcSet?void 0:i,as:s},h),Un.set(A,i),g.querySelector(E)!==null||s==="style"&&g.querySelector(uo(A))||s==="script"&&g.querySelector(ho(A))||(s=g.createElement("link"),Kt(s,"link",i),jt(s),g.head.appendChild(s)))}}function zk(i,s){Li.m(i,s);var h=$s;if(h&&i){var g=s&&typeof s.as=="string"?s.as:"script",E='link[rel="modulepreload"][as="'+on(g)+'"][href="'+on(i)+'"]',A=E;switch(g){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":A=qs(i)}if(!Un.has(A)&&(i=d({rel:"modulepreload",href:i},s),Un.set(A,i),h.querySelector(E)===null)){switch(g){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(h.querySelector(ho(A)))return}g=h.createElement("link"),Kt(g,"link",i),jt(g),h.head.appendChild(g)}}}function Hk(i,s,h){Li.S(i,s,h);var g=$s;if(g&&i){var E=Gi(g).hoistableStyles,A=Gs(i);s=s||"default";var I=E.get(A);if(!I){var W={loading:0,preload:null};if(I=g.querySelector(uo(A)))W.loading=5;else{i=d({rel:"stylesheet",href:i,"data-precedence":s},h),(h=Un.get(A))&&Nd(i,h);var J=I=g.createElement("link");jt(J),Kt(J,"link",i),J._p=new Promise(function(le,ge){J.onload=le,J.onerror=ge}),J.addEventListener("load",function(){W.loading|=1}),J.addEventListener("error",function(){W.loading|=2}),W.loading|=4,Cc(I,s,g)}I={type:"stylesheet",instance:I,count:1,state:W},E.set(A,I)}}}function Fk(i,s){Li.X(i,s);var h=$s;if(h&&i){var g=Gi(h).hoistableScripts,E=qs(i),A=g.get(E);A||(A=h.querySelector(ho(E)),A||(i=d({src:i,async:!0},s),(s=Un.get(E))&&Dd(i,s),A=h.createElement("script"),jt(A),Kt(A,"link",i),h.head.appendChild(A)),A={type:"script",instance:A,count:1,state:null},g.set(E,A))}}function Pk(i,s){Li.M(i,s);var h=$s;if(h&&i){var g=Gi(h).hoistableScripts,E=qs(i),A=g.get(E);A||(A=h.querySelector(ho(E)),A||(i=d({src:i,async:!0,type:"module"},s),(s=Un.get(E))&&Dd(i,s),A=h.createElement("script"),jt(A),Kt(A,"link",i),h.head.appendChild(A)),A={type:"script",instance:A,count:1,state:null},g.set(E,A))}}function ay(i,s,h,g){var E=(E=ae.current)?wc(E):null;if(!E)throw Error(r(446));switch(i){case"meta":case"title":return null;case"style":return typeof h.precedence=="string"&&typeof h.href=="string"?(s=Gs(h.href),h=Gi(E).hoistableStyles,g=h.get(s),g||(g={type:"style",instance:null,count:0,state:null},h.set(s,g)),g):{type:"void",instance:null,count:0,state:null};case"link":if(h.rel==="stylesheet"&&typeof h.href=="string"&&typeof h.precedence=="string"){i=Gs(h.href);var A=Gi(E).hoistableStyles,I=A.get(i);if(I||(E=E.ownerDocument||E,I={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},A.set(i,I),(A=E.querySelector(uo(i)))&&!A._p&&(I.instance=A,I.state.loading=5),Un.has(i)||(h={rel:"preload",as:"style",href:h.href,crossOrigin:h.crossOrigin,integrity:h.integrity,media:h.media,hrefLang:h.hrefLang,referrerPolicy:h.referrerPolicy},Un.set(i,h),A||Uk(E,i,h,I.state))),s&&g===null)throw Error(r(528,""));return I}if(s&&g!==null)throw Error(r(529,""));return null;case"script":return s=h.async,h=h.src,typeof h=="string"&&s&&typeof s!="function"&&typeof s!="symbol"?(s=qs(h),h=Gi(E).hoistableScripts,g=h.get(s),g||(g={type:"script",instance:null,count:0,state:null},h.set(s,g)),g):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,i))}}function Gs(i){return'href="'+on(i)+'"'}function uo(i){return'link[rel="stylesheet"]['+i+"]"}function oy(i){return d({},i,{"data-precedence":i.precedence,precedence:null})}function Uk(i,s,h,g){i.querySelector('link[rel="preload"][as="style"]['+s+"]")?g.loading=1:(s=i.createElement("link"),g.preload=s,s.addEventListener("load",function(){return g.loading|=1}),s.addEventListener("error",function(){return g.loading|=2}),Kt(s,"link",h),jt(s),i.head.appendChild(s))}function qs(i){return'[src="'+on(i)+'"]'}function ho(i){return"script[async]"+i}function ly(i,s,h){if(s.count++,s.instance===null)switch(s.type){case"style":var g=i.querySelector('style[data-href~="'+on(h.href)+'"]');if(g)return s.instance=g,jt(g),g;var E=d({},h,{"data-href":h.href,"data-precedence":h.precedence,href:null,precedence:null});return g=(i.ownerDocument||i).createElement("style"),jt(g),Kt(g,"style",E),Cc(g,h.precedence,i),s.instance=g;case"stylesheet":E=Gs(h.href);var A=i.querySelector(uo(E));if(A)return s.state.loading|=4,s.instance=A,jt(A),A;g=oy(h),(E=Un.get(E))&&Nd(g,E),A=(i.ownerDocument||i).createElement("link"),jt(A);var I=A;return I._p=new Promise(function(W,J){I.onload=W,I.onerror=J}),Kt(A,"link",g),s.state.loading|=4,Cc(A,h.precedence,i),s.instance=A;case"script":return A=qs(h.src),(E=i.querySelector(ho(A)))?(s.instance=E,jt(E),E):(g=h,(E=Un.get(A))&&(g=d({},h),Dd(g,E)),i=i.ownerDocument||i,E=i.createElement("script"),jt(E),Kt(E,"link",g),i.head.appendChild(E),s.instance=E);case"void":return null;default:throw Error(r(443,s.type))}else s.type==="stylesheet"&&(s.state.loading&4)===0&&(g=s.instance,s.state.loading|=4,Cc(g,h.precedence,i));return s.instance}function Cc(i,s,h){for(var g=h.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),E=g.length?g[g.length-1]:null,A=E,I=0;I title"):null)}function $k(i,s,h){if(h===1||s.itemProp!=null)return!1;switch(i){case"meta":case"title":return!0;case"style":if(typeof s.precedence!="string"||typeof s.href!="string"||s.href==="")break;return!0;case"link":if(typeof s.rel!="string"||typeof s.href!="string"||s.href===""||s.onLoad||s.onError)break;switch(s.rel){case"stylesheet":return i=s.disabled,typeof s.precedence=="string"&&i==null;default:return!0}case"script":if(s.async&&typeof s.async!="function"&&typeof s.async!="symbol"&&!s.onLoad&&!s.onError&&s.src&&typeof s.src=="string")return!0}return!1}function hy(i){return!(i.type==="stylesheet"&&(i.state.loading&3)===0)}function Gk(i,s,h,g){if(h.type==="stylesheet"&&(typeof g.media!="string"||matchMedia(g.media).matches!==!1)&&(h.state.loading&4)===0){if(h.instance===null){var E=Gs(g.href),A=s.querySelector(uo(E));if(A){s=A._p,s!==null&&typeof s=="object"&&typeof s.then=="function"&&(i.count++,i=kc.bind(i),s.then(i,i)),h.state.loading|=4,h.instance=A,jt(A);return}A=s.ownerDocument||s,g=oy(g),(E=Un.get(E))&&Nd(g,E),A=A.createElement("link"),jt(A);var I=A;I._p=new Promise(function(W,J){I.onload=W,I.onerror=J}),Kt(A,"link",g),h.instance=A}i.stylesheets===null&&(i.stylesheets=new Map),i.stylesheets.set(h,s),(s=h.state.preload)&&(h.state.loading&3)===0&&(i.count++,h=kc.bind(i),s.addEventListener("load",h),s.addEventListener("error",h))}}var Rd=0;function qk(i,s){return i.stylesheets&&i.count===0&&Tc(i,i.stylesheets),0Rd?50:800)+s);return i.unsuspend=h,function(){i.unsuspend=null,clearTimeout(g),clearTimeout(E)}}:null}function kc(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Tc(this,this.stylesheets);else if(this.unsuspend){var i=this.unsuspend;this.unsuspend=null,i()}}}var Ac=null;function Tc(i,s){i.stylesheets=null,i.unsuspend!==null&&(i.count++,Ac=new Map,s.forEach(Vk,i),Ac=null,kc.call(i))}function Vk(i,s){if(!(s.state.loading&4)){var h=Ac.get(i);if(h)var g=h.get(null);else{h=new Map,Ac.set(i,h);for(var E=i.querySelectorAll("link[data-precedence],style[data-precedence]"),A=0;A"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Fd.exports=lA(),Fd.exports}var uA=cA();/** +`+g.stack}}var ht=Object.prototype.hasOwnProperty,Ke=e.unstable_scheduleCallback,ct=e.unstable_cancelCallback,Rt=e.unstable_shouldYield,Ze=e.unstable_requestPaint,$e=e.unstable_now,de=e.unstable_getCurrentPriorityLevel,ne=e.unstable_ImmediatePriority,fe=e.unstable_UserBlockingPriority,be=e.unstable_NormalPriority,Ee=e.unstable_LowPriority,Oe=e.unstable_IdlePriority,Qe=e.log,Ie=e.unstable_setDisableYieldValue,Tt=null,Et=null;function Ut(i){if(typeof Qe=="function"&&Ie(i),Et&&typeof Et.setStrictMode=="function")try{Et.setStrictMode(Tt,i)}catch{}}var it=Math.clz32?Math.clz32:os,yn=Math.log,Zt=Math.LN2;function os(i){return i>>>=0,i===0?32:31-(yn(i)/Zt|0)|0}var ue=256,ke=262144,De=4194304;function Ge(i){var s=i&42;if(s!==0)return s;switch(i&-i){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return i&261888;case 262144:case 524288:case 1048576:case 2097152:return i&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return i&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return i}}function ut(i,s,h){var g=i.pendingLanes;if(g===0)return 0;var E=0,A=i.suspendedLanes,I=i.pingedLanes;i=i.warmLanes;var W=g&134217727;return W!==0?(g=W&~A,g!==0?E=Ge(g):(I&=W,I!==0?E=Ge(I):h||(h=W&~i,h!==0&&(E=Ge(h))))):(W=g&~A,W!==0?E=Ge(W):I!==0?E=Ge(I):h||(h=g&~i,h!==0&&(E=Ge(h)))),E===0?0:s!==0&&s!==E&&(s&A)===0&&(A=E&-E,h=s&-s,A>=h||A===32&&(h&4194048)!==0)?s:E}function ti(i,s){return(i.pendingLanes&~(i.suspendedLanes&~i.pingedLanes)&s)===0}function sn(i,s){switch(i){case 1:case 2:case 4:case 8:case 64:return s+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return s+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function ls(){var i=De;return De<<=1,(De&62914560)===0&&(De=4194304),i}function ba(i){for(var s=[],h=0;31>h;h++)s.push(i);return s}function Cr(i,s){i.pendingLanes|=s,s!==268435456&&(i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0)}function Ah(i,s,h,g,E,A){var I=i.pendingLanes;i.pendingLanes=h,i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0,i.expiredLanes&=h,i.entangledLanes&=h,i.errorRecoveryDisabledLanes&=h,i.shellSuspendCounter=0;var W=i.entanglements,J=i.expirationTimes,le=i.hiddenUpdates;for(h=I&~h;0"u")return null;try{return i.activeElement||i.body}catch{return i.body}}var El=/[\n"\\]/g;function on(i){return i.replace(El,function(s){return"\\"+s.charCodeAt(0).toString(16)+" "})}function ka(i,s,h,g,E,A,I,W){i.name="",I!=null&&typeof I!="function"&&typeof I!="symbol"&&typeof I!="boolean"?i.type=I:i.removeAttribute("type"),s!=null?I==="number"?(s===0&&i.value===""||i.value!=s)&&(i.value=""+an(s)):i.value!==""+an(s)&&(i.value=""+an(s)):I!=="submit"&&I!=="reset"||i.removeAttribute("value"),s!=null?Aa(i,I,an(s)):h!=null?Aa(i,I,an(h)):g!=null&&i.removeAttribute("value"),E==null&&A!=null&&(i.defaultChecked=!!A),E!=null&&(i.checked=E&&typeof E!="function"&&typeof E!="symbol"),W!=null&&typeof W!="function"&&typeof W!="symbol"&&typeof W!="boolean"?i.name=""+an(W):i.removeAttribute("name")}function ds(i,s,h,g,E,A,I,W){if(A!=null&&typeof A!="function"&&typeof A!="symbol"&&typeof A!="boolean"&&(i.type=A),s!=null||h!=null){if(!(A!=="submit"&&A!=="reset"||s!=null)){Ea(i);return}h=h!=null?""+an(h):"",s=s!=null?""+an(s):h,W||s===i.value||(i.value=s),i.defaultValue=s}g=g??E,g=typeof g!="function"&&typeof g!="symbol"&&!!g,i.checked=W?i.checked:!!g,i.defaultChecked=!!g,I!=null&&typeof I!="function"&&typeof I!="symbol"&&typeof I!="boolean"&&(i.name=I),Ea(i)}function Aa(i,s,h){s==="number"&&fs(i.ownerDocument)===i||i.defaultValue===""+h||(i.defaultValue=""+h)}function Vi(i,s,h,g){if(i=i.options,s){s={};for(var E=0;E"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Bh=!1;if(vi)try{var Da={};Object.defineProperty(Da,"passive",{get:function(){Bh=!0}}),window.addEventListener("test",Da,Da),window.removeEventListener("test",Da,Da)}catch{Bh=!1}var Yi=null,Ih=null,Al=null;function Xm(){if(Al)return Al;var i,s=Ih,h=s.length,g,E="value"in Yi?Yi.value:Yi.textContent,A=E.length;for(i=0;i=La),t0=" ",n0=!1;function i0(i,s){switch(i){case"keyup":return CE.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function r0(i){return i=i.detail,typeof i=="object"&&"data"in i?i.data:null}var _s=!1;function kE(i,s){switch(i){case"compositionend":return r0(s);case"keypress":return s.which!==32?null:(n0=!0,t0);case"textInput":return i=s.data,i===t0&&n0?null:i;default:return null}}function AE(i,s){if(_s)return i==="compositionend"||!Uh&&i0(i,s)?(i=Xm(),Al=Ih=Yi=null,_s=!1,i):null;switch(i){case"paste":return null;case"keypress":if(!(s.ctrlKey||s.altKey||s.metaKey)||s.ctrlKey&&s.altKey){if(s.char&&1=s)return{node:h,offset:s-i};i=g}e:{for(;h;){if(h.nextSibling){h=h.nextSibling;break e}h=h.parentNode}h=void 0}h=f0(h)}}function p0(i,s){return i&&s?i===s?!0:i&&i.nodeType===3?!1:s&&s.nodeType===3?p0(i,s.parentNode):"contains"in i?i.contains(s):i.compareDocumentPosition?!!(i.compareDocumentPosition(s)&16):!1:!1}function g0(i){i=i!=null&&i.ownerDocument!=null&&i.ownerDocument.defaultView!=null?i.ownerDocument.defaultView:window;for(var s=fs(i.document);s instanceof i.HTMLIFrameElement;){try{var h=typeof s.contentWindow.location.href=="string"}catch{h=!1}if(h)i=s.contentWindow;else break;s=fs(i.document)}return s}function qh(i){var s=i&&i.nodeName&&i.nodeName.toLowerCase();return s&&(s==="input"&&(i.type==="text"||i.type==="search"||i.type==="tel"||i.type==="url"||i.type==="password")||s==="textarea"||i.contentEditable==="true")}var jE=vi&&"documentMode"in document&&11>=document.documentMode,vs=null,Vh=null,Ia=null,Yh=!1;function m0(i,s,h){var g=h.window===h?h.document:h.nodeType===9?h:h.ownerDocument;Yh||vs==null||vs!==fs(g)||(g=vs,"selectionStart"in g&&qh(g)?g={start:g.selectionStart,end:g.selectionEnd}:(g=(g.ownerDocument&&g.ownerDocument.defaultView||window).getSelection(),g={anchorNode:g.anchorNode,anchorOffset:g.anchorOffset,focusNode:g.focusNode,focusOffset:g.focusOffset}),Ia&&Ba(Ia,g)||(Ia=g,g=bc(Vh,"onSelect"),0>=I,E-=I,ii=1<<32-it(s)+E|h<Pe?(Xe=Ne,Ne=null):Xe=Ne.sibling;var st=ce(se,Ne,oe[Pe],_e);if(st===null){Ne===null&&(Ne=Xe);break}i&&Ne&&st.alternate===null&&s(se,Ne),te=A(st,te,Pe),rt===null?Le=st:rt.sibling=st,rt=st,Ne=Xe}if(Pe===oe.length)return h(se,Ne),Je&&bi(se,Pe),Le;if(Ne===null){for(;PePe?(Xe=Ne,Ne=null):Xe=Ne.sibling;var gr=ce(se,Ne,st.value,_e);if(gr===null){Ne===null&&(Ne=Xe);break}i&&Ne&&gr.alternate===null&&s(se,Ne),te=A(gr,te,Pe),rt===null?Le=gr:rt.sibling=gr,rt=gr,Ne=Xe}if(st.done)return h(se,Ne),Je&&bi(se,Pe),Le;if(Ne===null){for(;!st.done;Pe++,st=oe.next())st=ve(se,st.value,_e),st!==null&&(te=A(st,te,Pe),rt===null?Le=st:rt.sibling=st,rt=st);return Je&&bi(se,Pe),Le}for(Ne=g(Ne);!st.done;Pe++,st=oe.next())st=pe(Ne,se,Pe,st.value,_e),st!==null&&(i&&st.alternate!==null&&Ne.delete(st.key===null?Pe:st.key),te=A(st,te,Pe),rt===null?Le=st:rt.sibling=st,rt=st);return i&&Ne.forEach(function(tA){return s(se,tA)}),Je&&bi(se,Pe),Le}function mt(se,te,oe,_e){if(typeof oe=="object"&&oe!==null&&oe.type===C&&oe.key===null&&(oe=oe.props.children),typeof oe=="object"&&oe!==null){switch(oe.$$typeof){case v:e:{for(var Le=oe.key;te!==null;){if(te.key===Le){if(Le=oe.type,Le===C){if(te.tag===7){h(se,te.sibling),_e=E(te,oe.props.children),_e.return=se,se=_e;break e}}else if(te.elementType===Le||typeof Le=="object"&&Le!==null&&Le.$$typeof===N&&Br(Le)===te.type){h(se,te.sibling),_e=E(te,oe.props),$a(_e,oe),_e.return=se,se=_e;break e}h(se,te);break}else s(se,te);te=te.sibling}oe.type===C?(_e=Rr(oe.props.children,se.mode,_e,oe.key),_e.return=se,se=_e):(_e=Il(oe.type,oe.key,oe.props,null,se.mode,_e),$a(_e,oe),_e.return=se,se=_e)}return I(se);case w:e:{for(Le=oe.key;te!==null;){if(te.key===Le)if(te.tag===4&&te.stateNode.containerInfo===oe.containerInfo&&te.stateNode.implementation===oe.implementation){h(se,te.sibling),_e=E(te,oe.children||[]),_e.return=se,se=_e;break e}else{h(se,te);break}else s(se,te);te=te.sibling}_e=ef(oe,se.mode,_e),_e.return=se,se=_e}return I(se);case N:return oe=Br(oe),mt(se,te,oe,_e)}if(q(oe))return Te(se,te,oe,_e);if(Y(oe)){if(Le=Y(oe),typeof Le!="function")throw Error(r(150));return oe=Le.call(oe),Be(se,te,oe,_e)}if(typeof oe.then=="function")return mt(se,te,Gl(oe),_e);if(oe.$$typeof===y)return mt(se,te,Fl(se,oe),_e);ql(se,oe)}return typeof oe=="string"&&oe!==""||typeof oe=="number"||typeof oe=="bigint"?(oe=""+oe,te!==null&&te.tag===6?(h(se,te.sibling),_e=E(te,oe),_e.return=se,se=_e):(h(se,te),_e=Jh(oe,se.mode,_e),_e.return=se,se=_e),I(se)):h(se,te)}return function(se,te,oe,_e){try{Ua=0;var Le=mt(se,te,oe,_e);return Ns=null,Le}catch(Ne){if(Ne===Ts||Ne===Ul)throw Ne;var rt=Sn(29,Ne,null,se.mode);return rt.lanes=_e,rt.return=se,rt}finally{}}}var zr=H0(!0),F0=H0(!1),Qi=!1;function df(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function pf(i,s){i=i.updateQueue,s.updateQueue===i&&(s.updateQueue={baseState:i.baseState,firstBaseUpdate:i.firstBaseUpdate,lastBaseUpdate:i.lastBaseUpdate,shared:i.shared,callbacks:null})}function Ji(i){return{lane:i,tag:0,payload:null,callback:null,next:null}}function er(i,s,h){var g=i.updateQueue;if(g===null)return null;if(g=g.shared,(ot&2)!==0){var E=g.pending;return E===null?s.next=s:(s.next=E.next,E.next=s),g.pending=s,s=Bl(i),w0(i,null,h),s}return jl(i,g,s,h),Bl(i)}function Ga(i,s,h){if(s=s.updateQueue,s!==null&&(s=s.shared,(h&4194048)!==0)){var g=s.lanes;g&=i.pendingLanes,h|=g,s.lanes=h,gl(i,h)}}function gf(i,s){var h=i.updateQueue,g=i.alternate;if(g!==null&&(g=g.updateQueue,h===g)){var E=null,A=null;if(h=h.firstBaseUpdate,h!==null){do{var I={lane:h.lane,tag:h.tag,payload:h.payload,callback:null,next:null};A===null?E=A=I:A=A.next=I,h=h.next}while(h!==null);A===null?E=A=s:A=A.next=s}else E=A=s;h={baseState:g.baseState,firstBaseUpdate:E,lastBaseUpdate:A,shared:g.shared,callbacks:g.callbacks},i.updateQueue=h;return}i=h.lastBaseUpdate,i===null?h.firstBaseUpdate=s:i.next=s,h.lastBaseUpdate=s}var mf=!1;function qa(){if(mf){var i=As;if(i!==null)throw i}}function Va(i,s,h,g){mf=!1;var E=i.updateQueue;Qi=!1;var A=E.firstBaseUpdate,I=E.lastBaseUpdate,W=E.shared.pending;if(W!==null){E.shared.pending=null;var J=W,le=J.next;J.next=null,I===null?A=le:I.next=le,I=J;var me=i.alternate;me!==null&&(me=me.updateQueue,W=me.lastBaseUpdate,W!==I&&(W===null?me.firstBaseUpdate=le:W.next=le,me.lastBaseUpdate=J))}if(A!==null){var ve=E.baseState;I=0,me=le=J=null,W=A;do{var ce=W.lane&-536870913,pe=ce!==W.lane;if(pe?(We&ce)===ce:(g&ce)===ce){ce!==0&&ce===ks&&(mf=!0),me!==null&&(me=me.next={lane:0,tag:W.tag,payload:W.payload,callback:null,next:null});e:{var Te=i,Be=W;ce=s;var mt=h;switch(Be.tag){case 1:if(Te=Be.payload,typeof Te=="function"){ve=Te.call(mt,ve,ce);break e}ve=Te;break e;case 3:Te.flags=Te.flags&-65537|128;case 0:if(Te=Be.payload,ce=typeof Te=="function"?Te.call(mt,ve,ce):Te,ce==null)break e;ve=d({},ve,ce);break e;case 2:Qi=!0}}ce=W.callback,ce!==null&&(i.flags|=64,pe&&(i.flags|=8192),pe=E.callbacks,pe===null?E.callbacks=[ce]:pe.push(ce))}else pe={lane:ce,tag:W.tag,payload:W.payload,callback:W.callback,next:null},me===null?(le=me=pe,J=ve):me=me.next=pe,I|=ce;if(W=W.next,W===null){if(W=E.shared.pending,W===null)break;pe=W,W=pe.next,pe.next=null,E.lastBaseUpdate=pe,E.shared.pending=null}}while(!0);me===null&&(J=ve),E.baseState=J,E.firstBaseUpdate=le,E.lastBaseUpdate=me,A===null&&(E.shared.lanes=0),sr|=I,i.lanes=I,i.memoizedState=ve}}function P0(i,s){if(typeof i!="function")throw Error(r(191,i));i.call(s)}function U0(i,s){var h=i.callbacks;if(h!==null)for(i.callbacks=null,i=0;iA?A:8;var I=G.T,W={};G.T=W,jf(i,!1,s,h);try{var J=E(),le=G.S;if(le!==null&&le(W,J),J!==null&&typeof J=="object"&&typeof J.then=="function"){var me=GE(J,g);Xa(i,s,me,kn(i))}else Xa(i,s,g,kn(i))}catch(ve){Xa(i,s,{then:function(){},status:"rejected",reason:ve},kn())}finally{X.p=A,I!==null&&W.types!==null&&(I.types=W.types),G.T=I}}function KE(){}function Lf(i,s,h,g){if(i.tag!==5)throw Error(r(476));var E=b_(i).queue;y_(i,E,s,K,h===null?KE:function(){return S_(i),h(g)})}function b_(i){var s=i.memoizedState;if(s!==null)return s;s={memoizedState:K,baseState:K,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ci,lastRenderedState:K},next:null};var h={};return s.next={memoizedState:h,baseState:h,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ci,lastRenderedState:h},next:null},i.memoizedState=s,i=i.alternate,i!==null&&(i.memoizedState=s),s}function S_(i){var s=b_(i);s.next===null&&(s=i.alternate.memoizedState),Xa(i,s.next.queue,{},kn())}function Of(){return Wt(fo)}function x_(){return Lt().memoizedState}function w_(){return Lt().memoizedState}function ZE(i){for(var s=i.return;s!==null;){switch(s.tag){case 24:case 3:var h=kn();i=Ji(h);var g=er(s,i,h);g!==null&&(dn(g,s,h),Ga(g,s,h)),s={cache:cf()},i.payload=s;return}s=s.return}}function QE(i,s,h){var g=kn();h={lane:g,revertLane:0,gesture:null,action:h,hasEagerState:!1,eagerState:null,next:null},tc(i)?E_(s,h):(h=Zh(i,s,h,g),h!==null&&(dn(h,i,g),k_(h,s,g)))}function C_(i,s,h){var g=kn();Xa(i,s,h,g)}function Xa(i,s,h,g){var E={lane:g,revertLane:0,gesture:null,action:h,hasEagerState:!1,eagerState:null,next:null};if(tc(i))E_(s,E);else{var A=i.alternate;if(i.lanes===0&&(A===null||A.lanes===0)&&(A=s.lastRenderedReducer,A!==null))try{var I=s.lastRenderedState,W=A(I,h);if(E.hasEagerState=!0,E.eagerState=W,bn(W,I))return jl(i,s,E,0),_t===null&&Ol(),!1}catch{}finally{}if(h=Zh(i,s,E,g),h!==null)return dn(h,i,g),k_(h,s,g),!0}return!1}function jf(i,s,h,g){if(g={lane:2,revertLane:dd(),gesture:null,action:g,hasEagerState:!1,eagerState:null,next:null},tc(i)){if(s)throw Error(r(479))}else s=Zh(i,h,g,2),s!==null&&dn(s,i,2)}function tc(i){var s=i.alternate;return i===Fe||s!==null&&s===Fe}function E_(i,s){Rs=Wl=!0;var h=i.pending;h===null?s.next=s:(s.next=h.next,h.next=s),i.pending=s}function k_(i,s,h){if((h&4194048)!==0){var g=s.lanes;g&=i.pendingLanes,h|=g,s.lanes=h,gl(i,h)}}var Ka={readContext:Wt,use:Zl,useCallback:Nt,useContext:Nt,useEffect:Nt,useImperativeHandle:Nt,useLayoutEffect:Nt,useInsertionEffect:Nt,useMemo:Nt,useReducer:Nt,useRef:Nt,useState:Nt,useDebugValue:Nt,useDeferredValue:Nt,useTransition:Nt,useSyncExternalStore:Nt,useId:Nt,useHostTransitionStatus:Nt,useFormState:Nt,useActionState:Nt,useOptimistic:Nt,useMemoCache:Nt,useCacheRefresh:Nt};Ka.useEffectEvent=Nt;var A_={readContext:Wt,use:Zl,useCallback:function(i,s){return nn().memoizedState=[i,s===void 0?null:s],i},useContext:Wt,useEffect:u_,useImperativeHandle:function(i,s,h){h=h!=null?h.concat([i]):null,Jl(4194308,4,p_.bind(null,s,i),h)},useLayoutEffect:function(i,s){return Jl(4194308,4,i,s)},useInsertionEffect:function(i,s){Jl(4,2,i,s)},useMemo:function(i,s){var h=nn();s=s===void 0?null:s;var g=i();if(Hr){Ut(!0);try{i()}finally{Ut(!1)}}return h.memoizedState=[g,s],g},useReducer:function(i,s,h){var g=nn();if(h!==void 0){var E=h(s);if(Hr){Ut(!0);try{h(s)}finally{Ut(!1)}}}else E=s;return g.memoizedState=g.baseState=E,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:E},g.queue=i,i=i.dispatch=QE.bind(null,Fe,i),[g.memoizedState,i]},useRef:function(i){var s=nn();return i={current:i},s.memoizedState=i},useState:function(i){i=Tf(i);var s=i.queue,h=C_.bind(null,Fe,s);return s.dispatch=h,[i.memoizedState,h]},useDebugValue:Rf,useDeferredValue:function(i,s){var h=nn();return Mf(h,i,s)},useTransition:function(){var i=Tf(!1);return i=y_.bind(null,Fe,i.queue,!0,!1),nn().memoizedState=i,[!1,i]},useSyncExternalStore:function(i,s,h){var g=Fe,E=nn();if(Je){if(h===void 0)throw Error(r(407));h=h()}else{if(h=s(),_t===null)throw Error(r(349));(We&127)!==0||W0(g,s,h)}E.memoizedState=h;var A={value:h,getSnapshot:s};return E.queue=A,u_(K0.bind(null,g,A,i),[i]),g.flags|=2048,Ls(9,{destroy:void 0},X0.bind(null,g,A,h,s),null),h},useId:function(){var i=nn(),s=_t.identifierPrefix;if(Je){var h=ri,g=ii;h=(g&~(1<<32-it(g)-1)).toString(32)+h,s="_"+s+"R_"+h,h=Xl++,0<\/script>",A=A.removeChild(A.firstChild);break;case"select":A=typeof g.is=="string"?I.createElement("select",{is:g.is}):I.createElement("select"),g.multiple?A.multiple=!0:g.size&&(A.size=g.size);break;default:A=typeof g.is=="string"?I.createElement(E,{is:g.is}):I.createElement(E)}}A[$t]=s,A[Qt]=g;e:for(I=s.child;I!==null;){if(I.tag===5||I.tag===6)A.appendChild(I.stateNode);else if(I.tag!==4&&I.tag!==27&&I.child!==null){I.child.return=I,I=I.child;continue}if(I===s)break e;for(;I.sibling===null;){if(I.return===null||I.return===s)break e;I=I.return}I.sibling.return=I.return,I=I.sibling}s.stateNode=A;e:switch(Kt(A,E,g),E){case"button":case"input":case"select":case"textarea":g=!!g.autoFocus;break e;case"img":g=!0;break e;default:g=!1}g&&ki(s)}}return xt(s),Xf(s,s.type,i===null?null:i.memoizedProps,s.pendingProps,h),null;case 6:if(i&&s.stateNode!=null)i.memoizedProps!==g&&ki(s);else{if(typeof g!="string"&&s.stateNode===null)throw Error(r(166));if(i=ae.current,Cs(s)){if(i=s.stateNode,h=s.memoizedProps,g=null,E=Yt,E!==null)switch(E.tag){case 27:case 5:g=E.memoizedProps}i[$t]=s,i=!!(i.nodeValue===h||g!==null&&g.suppressHydrationWarning===!0||Vv(i.nodeValue,h)),i||Ki(s,!0)}else i=Sc(i).createTextNode(g),i[$t]=s,s.stateNode=i}return xt(s),null;case 31:if(h=s.memoizedState,i===null||i.memoizedState!==null){if(g=Cs(s),h!==null){if(i===null){if(!g)throw Error(r(318));if(i=s.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(r(557));i[$t]=s}else Mr(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;xt(s),i=!1}else h=sf(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=h),i=!0;if(!i)return s.flags&256?(wn(s),s):(wn(s),null);if((s.flags&128)!==0)throw Error(r(558))}return xt(s),null;case 13:if(g=s.memoizedState,i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){if(E=Cs(s),g!==null&&g.dehydrated!==null){if(i===null){if(!E)throw Error(r(318));if(E=s.memoizedState,E=E!==null?E.dehydrated:null,!E)throw Error(r(317));E[$t]=s}else Mr(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;xt(s),E=!1}else E=sf(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=E),E=!0;if(!E)return s.flags&256?(wn(s),s):(wn(s),null)}return wn(s),(s.flags&128)!==0?(s.lanes=h,s):(h=g!==null,i=i!==null&&i.memoizedState!==null,h&&(g=s.child,E=null,g.alternate!==null&&g.alternate.memoizedState!==null&&g.alternate.memoizedState.cachePool!==null&&(E=g.alternate.memoizedState.cachePool.pool),A=null,g.memoizedState!==null&&g.memoizedState.cachePool!==null&&(A=g.memoizedState.cachePool.pool),A!==E&&(g.flags|=2048)),h!==i&&h&&(s.child.flags|=8192),ac(s,s.updateQueue),xt(s),null);case 4:return ee(),i===null&&_d(s.stateNode.containerInfo),xt(s),null;case 10:return xi(s.type),xt(s),null;case 19:if($(Mt),g=s.memoizedState,g===null)return xt(s),null;if(E=(s.flags&128)!==0,A=g.rendering,A===null)if(E)Qa(g,!1);else{if(Dt!==0||i!==null&&(i.flags&128)!==0)for(i=s.child;i!==null;){if(A=Yl(i),A!==null){for(s.flags|=128,Qa(g,!1),i=A.updateQueue,s.updateQueue=i,ac(s,i),s.subtreeFlags=0,i=h,h=s.child;h!==null;)C0(h,i),h=h.sibling;return U(Mt,Mt.current&1|2),Je&&bi(s,g.treeForkCount),s.child}i=i.sibling}g.tail!==null&&$e()>hc&&(s.flags|=128,E=!0,Qa(g,!1),s.lanes=4194304)}else{if(!E)if(i=Yl(A),i!==null){if(s.flags|=128,E=!0,i=i.updateQueue,s.updateQueue=i,ac(s,i),Qa(g,!0),g.tail===null&&g.tailMode==="hidden"&&!A.alternate&&!Je)return xt(s),null}else 2*$e()-g.renderingStartTime>hc&&h!==536870912&&(s.flags|=128,E=!0,Qa(g,!1),s.lanes=4194304);g.isBackwards?(A.sibling=s.child,s.child=A):(i=g.last,i!==null?i.sibling=A:s.child=A,g.last=A)}return g.tail!==null?(i=g.tail,g.rendering=i,g.tail=i.sibling,g.renderingStartTime=$e(),i.sibling=null,h=Mt.current,U(Mt,E?h&1|2:h&1),Je&&bi(s,g.treeForkCount),i):(xt(s),null);case 22:case 23:return wn(s),vf(),g=s.memoizedState!==null,i!==null?i.memoizedState!==null!==g&&(s.flags|=8192):g&&(s.flags|=8192),g?(h&536870912)!==0&&(s.flags&128)===0&&(xt(s),s.subtreeFlags&6&&(s.flags|=8192)):xt(s),h=s.updateQueue,h!==null&&ac(s,h.retryQueue),h=null,i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(h=i.memoizedState.cachePool.pool),g=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(g=s.memoizedState.cachePool.pool),g!==h&&(s.flags|=2048),i!==null&&$(jr),null;case 24:return h=null,i!==null&&(h=i.memoizedState.cache),s.memoizedState.cache!==h&&(s.flags|=2048),xi(Bt),xt(s),null;case 25:return null;case 30:return null}throw Error(r(156,s.tag))}function ik(i,s){switch(nf(s),s.tag){case 1:return i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 3:return xi(Bt),ee(),i=s.flags,(i&65536)!==0&&(i&128)===0?(s.flags=i&-65537|128,s):null;case 26:case 27:case 5:return ge(s),null;case 31:if(s.memoizedState!==null){if(wn(s),s.alternate===null)throw Error(r(340));Mr()}return i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 13:if(wn(s),i=s.memoizedState,i!==null&&i.dehydrated!==null){if(s.alternate===null)throw Error(r(340));Mr()}return i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 19:return $(Mt),null;case 4:return ee(),null;case 10:return xi(s.type),null;case 22:case 23:return wn(s),vf(),i!==null&&$(jr),i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 24:return xi(Bt),null;case 25:return null;default:return null}}function Z_(i,s){switch(nf(s),s.tag){case 3:xi(Bt),ee();break;case 26:case 27:case 5:ge(s);break;case 4:ee();break;case 31:s.memoizedState!==null&&wn(s);break;case 13:wn(s);break;case 19:$(Mt);break;case 10:xi(s.type);break;case 22:case 23:wn(s),vf(),i!==null&&$(jr);break;case 24:xi(Bt)}}function Ja(i,s){try{var h=s.updateQueue,g=h!==null?h.lastEffect:null;if(g!==null){var E=g.next;h=E;do{if((h.tag&i)===i){g=void 0;var A=h.create,I=h.inst;g=A(),I.destroy=g}h=h.next}while(h!==E)}}catch(W){dt(s,s.return,W)}}function ir(i,s,h){try{var g=s.updateQueue,E=g!==null?g.lastEffect:null;if(E!==null){var A=E.next;g=A;do{if((g.tag&i)===i){var I=g.inst,W=I.destroy;if(W!==void 0){I.destroy=void 0,E=s;var J=h,le=W;try{le()}catch(me){dt(E,J,me)}}}g=g.next}while(g!==A)}}catch(me){dt(s,s.return,me)}}function Q_(i){var s=i.updateQueue;if(s!==null){var h=i.stateNode;try{U0(s,h)}catch(g){dt(i,i.return,g)}}}function J_(i,s,h){h.props=Fr(i.type,i.memoizedProps),h.state=i.memoizedState;try{h.componentWillUnmount()}catch(g){dt(i,s,g)}}function eo(i,s){try{var h=i.ref;if(h!==null){switch(i.tag){case 26:case 27:case 5:var g=i.stateNode;break;case 30:g=i.stateNode;break;default:g=i.stateNode}typeof h=="function"?i.refCleanup=h(g):h.current=g}}catch(E){dt(i,s,E)}}function si(i,s){var h=i.ref,g=i.refCleanup;if(h!==null)if(typeof g=="function")try{g()}catch(E){dt(i,s,E)}finally{i.refCleanup=null,i=i.alternate,i!=null&&(i.refCleanup=null)}else if(typeof h=="function")try{h(null)}catch(E){dt(i,s,E)}else h.current=null}function ev(i){var s=i.type,h=i.memoizedProps,g=i.stateNode;try{e:switch(s){case"button":case"input":case"select":case"textarea":h.autoFocus&&g.focus();break e;case"img":h.src?g.src=h.src:h.srcSet&&(g.srcset=h.srcSet)}}catch(E){dt(i,i.return,E)}}function Kf(i,s,h){try{var g=i.stateNode;Ek(g,i.type,h,s),g[Qt]=s}catch(E){dt(i,i.return,E)}}function tv(i){return i.tag===5||i.tag===3||i.tag===26||i.tag===27&&ur(i.type)||i.tag===4}function Zf(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||tv(i.return))return null;i=i.return}for(i.sibling.return=i.return,i=i.sibling;i.tag!==5&&i.tag!==6&&i.tag!==18;){if(i.tag===27&&ur(i.type)||i.flags&2||i.child===null||i.tag===4)continue e;i.child.return=i,i=i.child}if(!(i.flags&2))return i.stateNode}}function Qf(i,s,h){var g=i.tag;if(g===5||g===6)i=i.stateNode,s?(h.nodeType===9?h.body:h.nodeName==="HTML"?h.ownerDocument.body:h).insertBefore(i,s):(s=h.nodeType===9?h.body:h.nodeName==="HTML"?h.ownerDocument.body:h,s.appendChild(i),h=h._reactRootContainer,h!=null||s.onclick!==null||(s.onclick=_i));else if(g!==4&&(g===27&&ur(i.type)&&(h=i.stateNode,s=null),i=i.child,i!==null))for(Qf(i,s,h),i=i.sibling;i!==null;)Qf(i,s,h),i=i.sibling}function oc(i,s,h){var g=i.tag;if(g===5||g===6)i=i.stateNode,s?h.insertBefore(i,s):h.appendChild(i);else if(g!==4&&(g===27&&ur(i.type)&&(h=i.stateNode),i=i.child,i!==null))for(oc(i,s,h),i=i.sibling;i!==null;)oc(i,s,h),i=i.sibling}function nv(i){var s=i.stateNode,h=i.memoizedProps;try{for(var g=i.type,E=s.attributes;E.length;)s.removeAttributeNode(E[0]);Kt(s,g,h),s[$t]=i,s[Qt]=h}catch(A){dt(i,i.return,A)}}var Ai=!1,Ht=!1,Jf=!1,iv=typeof WeakSet=="function"?WeakSet:Set,qt=null;function rk(i,s){if(i=i.containerInfo,bd=Tc,i=g0(i),qh(i)){if("selectionStart"in i)var h={start:i.selectionStart,end:i.selectionEnd};else e:{h=(h=i.ownerDocument)&&h.defaultView||window;var g=h.getSelection&&h.getSelection();if(g&&g.rangeCount!==0){h=g.anchorNode;var E=g.anchorOffset,A=g.focusNode;g=g.focusOffset;try{h.nodeType,A.nodeType}catch{h=null;break e}var I=0,W=-1,J=-1,le=0,me=0,ve=i,ce=null;t:for(;;){for(var pe;ve!==h||E!==0&&ve.nodeType!==3||(W=I+E),ve!==A||g!==0&&ve.nodeType!==3||(J=I+g),ve.nodeType===3&&(I+=ve.nodeValue.length),(pe=ve.firstChild)!==null;)ce=ve,ve=pe;for(;;){if(ve===i)break t;if(ce===h&&++le===E&&(W=I),ce===A&&++me===g&&(J=I),(pe=ve.nextSibling)!==null)break;ve=ce,ce=ve.parentNode}ve=pe}h=W===-1||J===-1?null:{start:W,end:J}}else h=null}h=h||{start:0,end:0}}else h=null;for(Sd={focusedElem:i,selectionRange:h},Tc=!1,qt=s;qt!==null;)if(s=qt,i=s.child,(s.subtreeFlags&1028)!==0&&i!==null)i.return=s,qt=i;else for(;qt!==null;){switch(s=qt,A=s.alternate,i=s.flags,s.tag){case 0:if((i&4)!==0&&(i=s.updateQueue,i=i!==null?i.events:null,i!==null))for(h=0;h title"))),Kt(A,g,h),A[$t]=i,jt(A),g=A;break e;case"link":var I=cy("link","href",E).get(g+(h.href||""));if(I){for(var W=0;Wmt&&(I=mt,mt=Be,Be=I);var se=d0(W,Be),te=d0(W,mt);if(se&&te&&(pe.rangeCount!==1||pe.anchorNode!==se.node||pe.anchorOffset!==se.offset||pe.focusNode!==te.node||pe.focusOffset!==te.offset)){var oe=ve.createRange();oe.setStart(se.node,se.offset),pe.removeAllRanges(),Be>mt?(pe.addRange(oe),pe.extend(te.node,te.offset)):(oe.setEnd(te.node,te.offset),pe.addRange(oe))}}}}for(ve=[],pe=W;pe=pe.parentNode;)pe.nodeType===1&&ve.push({element:pe,left:pe.scrollLeft,top:pe.scrollTop});for(typeof W.focus=="function"&&W.focus(),W=0;Wh?32:h,G.T=null,h=ad,ad=null;var A=or,I=Mi;if(Gt=0,zs=or=null,Mi=0,(ot&6)!==0)throw Error(r(331));var W=ot;if(ot|=4,pv(A.current),hv(A,A.current,I,h),ot=W,ao(0,!1),Et&&typeof Et.onPostCommitFiberRoot=="function")try{Et.onPostCommitFiberRoot(Tt,A)}catch{}return!0}finally{X.p=E,G.T=g,Mv(i,s)}}function Ov(i,s,h){s=Bn(h,s),s=Hf(i.stateNode,s,2),i=er(i,s,2),i!==null&&(Cr(i,2),ai(i))}function dt(i,s,h){if(i.tag===3)Ov(i,i,h);else for(;s!==null;){if(s.tag===3){Ov(s,i,h);break}else if(s.tag===1){var g=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof g.componentDidCatch=="function"&&(ar===null||!ar.has(g))){i=Bn(h,i),h=j_(2),g=er(s,h,2),g!==null&&(B_(h,g,s,i),Cr(g,2),ai(g));break}}s=s.return}}function ud(i,s,h){var g=i.pingCache;if(g===null){g=i.pingCache=new ok;var E=new Set;g.set(s,E)}else E=g.get(s),E===void 0&&(E=new Set,g.set(s,E));E.has(h)||(nd=!0,E.add(h),i=fk.bind(null,i,s,h),s.then(i,i))}function fk(i,s,h){var g=i.pingCache;g!==null&&g.delete(s),i.pingedLanes|=i.suspendedLanes&h,i.warmLanes&=~h,_t===i&&(We&h)===h&&(Dt===4||Dt===3&&(We&62914560)===We&&300>$e()-uc?(ot&2)===0&&Hs(i,0):id|=h,Is===We&&(Is=0)),ai(i)}function jv(i,s){s===0&&(s=ls()),i=Dr(i,s),i!==null&&(Cr(i,s),ai(i))}function dk(i){var s=i.memoizedState,h=0;s!==null&&(h=s.retryLane),jv(i,h)}function pk(i,s){var h=0;switch(i.tag){case 31:case 13:var g=i.stateNode,E=i.memoizedState;E!==null&&(h=E.retryLane);break;case 19:g=i.stateNode;break;case 22:g=i.stateNode._retryCache;break;default:throw Error(r(314))}g!==null&&g.delete(s),jv(i,h)}function gk(i,s){return Ke(i,s)}var _c=null,Ps=null,hd=!1,vc=!1,fd=!1,cr=0;function ai(i){i!==Ps&&i.next===null&&(Ps===null?_c=Ps=i:Ps=Ps.next=i),vc=!0,hd||(hd=!0,_k())}function ao(i,s){if(!fd&&vc){fd=!0;do for(var h=!1,g=_c;g!==null;){if(i!==0){var E=g.pendingLanes;if(E===0)var A=0;else{var I=g.suspendedLanes,W=g.pingedLanes;A=(1<<31-it(42|i)+1)-1,A&=E&~(I&~W),A=A&201326741?A&201326741|1:A?A|2:0}A!==0&&(h=!0,Hv(g,A))}else A=We,A=ut(g,g===_t?A:0,g.cancelPendingCommit!==null||g.timeoutHandle!==-1),(A&3)===0||ti(g,A)||(h=!0,Hv(g,A));g=g.next}while(h);fd=!1}}function mk(){Bv()}function Bv(){vc=hd=!1;var i=0;cr!==0&&Ak()&&(i=cr);for(var s=$e(),h=null,g=_c;g!==null;){var E=g.next,A=Iv(g,s);A===0?(g.next=null,h===null?_c=E:h.next=E,E===null&&(Ps=h)):(h=g,(i!==0||(A&3)!==0)&&(vc=!0)),g=E}Gt!==0&&Gt!==5||ao(i),cr!==0&&(cr=0)}function Iv(i,s){for(var h=i.suspendedLanes,g=i.pingedLanes,E=i.expirationTimes,A=i.pendingLanes&-62914561;0W)break;var me=J.transferSize,ve=J.initiatorType;me&&Yv(ve)&&(J=J.responseEnd,I+=me*(J"u"?null:document;function sy(i,s,h){var g=Us;if(g&&typeof s=="string"&&s){var E=on(s);E='link[rel="'+i+'"][href="'+E+'"]',typeof h=="string"&&(E+='[crossorigin="'+h+'"]'),ry.has(E)||(ry.add(E),i={rel:i,crossOrigin:h,href:s},g.querySelector(E)===null&&(s=g.createElement("link"),Kt(s,"link",i),jt(s),g.head.appendChild(s)))}}function Bk(i){Li.D(i),sy("dns-prefetch",i,null)}function Ik(i,s){Li.C(i,s),sy("preconnect",i,s)}function zk(i,s,h){Li.L(i,s,h);var g=Us;if(g&&i&&s){var E='link[rel="preload"][as="'+on(s)+'"]';s==="image"&&h&&h.imageSrcSet?(E+='[imagesrcset="'+on(h.imageSrcSet)+'"]',typeof h.imageSizes=="string"&&(E+='[imagesizes="'+on(h.imageSizes)+'"]')):E+='[href="'+on(i)+'"]';var A=E;switch(s){case"style":A=$s(i);break;case"script":A=Gs(i)}Un.has(A)||(i=d({rel:"preload",href:s==="image"&&h&&h.imageSrcSet?void 0:i,as:s},h),Un.set(A,i),g.querySelector(E)!==null||s==="style"&&g.querySelector(uo(A))||s==="script"&&g.querySelector(ho(A))||(s=g.createElement("link"),Kt(s,"link",i),jt(s),g.head.appendChild(s)))}}function Hk(i,s){Li.m(i,s);var h=Us;if(h&&i){var g=s&&typeof s.as=="string"?s.as:"script",E='link[rel="modulepreload"][as="'+on(g)+'"][href="'+on(i)+'"]',A=E;switch(g){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":A=Gs(i)}if(!Un.has(A)&&(i=d({rel:"modulepreload",href:i},s),Un.set(A,i),h.querySelector(E)===null)){switch(g){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(h.querySelector(ho(A)))return}g=h.createElement("link"),Kt(g,"link",i),jt(g),h.head.appendChild(g)}}}function Fk(i,s,h){Li.S(i,s,h);var g=Us;if(g&&i){var E=Gi(g).hoistableStyles,A=$s(i);s=s||"default";var I=E.get(A);if(!I){var W={loading:0,preload:null};if(I=g.querySelector(uo(A)))W.loading=5;else{i=d({rel:"stylesheet",href:i,"data-precedence":s},h),(h=Un.get(A))&&Td(i,h);var J=I=g.createElement("link");jt(J),Kt(J,"link",i),J._p=new Promise(function(le,me){J.onload=le,J.onerror=me}),J.addEventListener("load",function(){W.loading|=1}),J.addEventListener("error",function(){W.loading|=2}),W.loading|=4,wc(I,s,g)}I={type:"stylesheet",instance:I,count:1,state:W},E.set(A,I)}}}function Pk(i,s){Li.X(i,s);var h=Us;if(h&&i){var g=Gi(h).hoistableScripts,E=Gs(i),A=g.get(E);A||(A=h.querySelector(ho(E)),A||(i=d({src:i,async:!0},s),(s=Un.get(E))&&Nd(i,s),A=h.createElement("script"),jt(A),Kt(A,"link",i),h.head.appendChild(A)),A={type:"script",instance:A,count:1,state:null},g.set(E,A))}}function Uk(i,s){Li.M(i,s);var h=Us;if(h&&i){var g=Gi(h).hoistableScripts,E=Gs(i),A=g.get(E);A||(A=h.querySelector(ho(E)),A||(i=d({src:i,async:!0,type:"module"},s),(s=Un.get(E))&&Nd(i,s),A=h.createElement("script"),jt(A),Kt(A,"link",i),h.head.appendChild(A)),A={type:"script",instance:A,count:1,state:null},g.set(E,A))}}function ay(i,s,h,g){var E=(E=ae.current)?xc(E):null;if(!E)throw Error(r(446));switch(i){case"meta":case"title":return null;case"style":return typeof h.precedence=="string"&&typeof h.href=="string"?(s=$s(h.href),h=Gi(E).hoistableStyles,g=h.get(s),g||(g={type:"style",instance:null,count:0,state:null},h.set(s,g)),g):{type:"void",instance:null,count:0,state:null};case"link":if(h.rel==="stylesheet"&&typeof h.href=="string"&&typeof h.precedence=="string"){i=$s(h.href);var A=Gi(E).hoistableStyles,I=A.get(i);if(I||(E=E.ownerDocument||E,I={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},A.set(i,I),(A=E.querySelector(uo(i)))&&!A._p&&(I.instance=A,I.state.loading=5),Un.has(i)||(h={rel:"preload",as:"style",href:h.href,crossOrigin:h.crossOrigin,integrity:h.integrity,media:h.media,hrefLang:h.hrefLang,referrerPolicy:h.referrerPolicy},Un.set(i,h),A||$k(E,i,h,I.state))),s&&g===null)throw Error(r(528,""));return I}if(s&&g!==null)throw Error(r(529,""));return null;case"script":return s=h.async,h=h.src,typeof h=="string"&&s&&typeof s!="function"&&typeof s!="symbol"?(s=Gs(h),h=Gi(E).hoistableScripts,g=h.get(s),g||(g={type:"script",instance:null,count:0,state:null},h.set(s,g)),g):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,i))}}function $s(i){return'href="'+on(i)+'"'}function uo(i){return'link[rel="stylesheet"]['+i+"]"}function oy(i){return d({},i,{"data-precedence":i.precedence,precedence:null})}function $k(i,s,h,g){i.querySelector('link[rel="preload"][as="style"]['+s+"]")?g.loading=1:(s=i.createElement("link"),g.preload=s,s.addEventListener("load",function(){return g.loading|=1}),s.addEventListener("error",function(){return g.loading|=2}),Kt(s,"link",h),jt(s),i.head.appendChild(s))}function Gs(i){return'[src="'+on(i)+'"]'}function ho(i){return"script[async]"+i}function ly(i,s,h){if(s.count++,s.instance===null)switch(s.type){case"style":var g=i.querySelector('style[data-href~="'+on(h.href)+'"]');if(g)return s.instance=g,jt(g),g;var E=d({},h,{"data-href":h.href,"data-precedence":h.precedence,href:null,precedence:null});return g=(i.ownerDocument||i).createElement("style"),jt(g),Kt(g,"style",E),wc(g,h.precedence,i),s.instance=g;case"stylesheet":E=$s(h.href);var A=i.querySelector(uo(E));if(A)return s.state.loading|=4,s.instance=A,jt(A),A;g=oy(h),(E=Un.get(E))&&Td(g,E),A=(i.ownerDocument||i).createElement("link"),jt(A);var I=A;return I._p=new Promise(function(W,J){I.onload=W,I.onerror=J}),Kt(A,"link",g),s.state.loading|=4,wc(A,h.precedence,i),s.instance=A;case"script":return A=Gs(h.src),(E=i.querySelector(ho(A)))?(s.instance=E,jt(E),E):(g=h,(E=Un.get(A))&&(g=d({},h),Nd(g,E)),i=i.ownerDocument||i,E=i.createElement("script"),jt(E),Kt(E,"link",g),i.head.appendChild(E),s.instance=E);case"void":return null;default:throw Error(r(443,s.type))}else s.type==="stylesheet"&&(s.state.loading&4)===0&&(g=s.instance,s.state.loading|=4,wc(g,h.precedence,i));return s.instance}function wc(i,s,h){for(var g=h.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),E=g.length?g[g.length-1]:null,A=E,I=0;I title"):null)}function Gk(i,s,h){if(h===1||s.itemProp!=null)return!1;switch(i){case"meta":case"title":return!0;case"style":if(typeof s.precedence!="string"||typeof s.href!="string"||s.href==="")break;return!0;case"link":if(typeof s.rel!="string"||typeof s.href!="string"||s.href===""||s.onLoad||s.onError)break;switch(s.rel){case"stylesheet":return i=s.disabled,typeof s.precedence=="string"&&i==null;default:return!0}case"script":if(s.async&&typeof s.async!="function"&&typeof s.async!="symbol"&&!s.onLoad&&!s.onError&&s.src&&typeof s.src=="string")return!0}return!1}function hy(i){return!(i.type==="stylesheet"&&(i.state.loading&3)===0)}function qk(i,s,h,g){if(h.type==="stylesheet"&&(typeof g.media!="string"||matchMedia(g.media).matches!==!1)&&(h.state.loading&4)===0){if(h.instance===null){var E=$s(g.href),A=s.querySelector(uo(E));if(A){s=A._p,s!==null&&typeof s=="object"&&typeof s.then=="function"&&(i.count++,i=Ec.bind(i),s.then(i,i)),h.state.loading|=4,h.instance=A,jt(A);return}A=s.ownerDocument||s,g=oy(g),(E=Un.get(E))&&Td(g,E),A=A.createElement("link"),jt(A);var I=A;I._p=new Promise(function(W,J){I.onload=W,I.onerror=J}),Kt(A,"link",g),h.instance=A}i.stylesheets===null&&(i.stylesheets=new Map),i.stylesheets.set(h,s),(s=h.state.preload)&&(h.state.loading&3)===0&&(i.count++,h=Ec.bind(i),s.addEventListener("load",h),s.addEventListener("error",h))}}var Dd=0;function Vk(i,s){return i.stylesheets&&i.count===0&&Ac(i,i.stylesheets),0Dd?50:800)+s);return i.unsuspend=h,function(){i.unsuspend=null,clearTimeout(g),clearTimeout(E)}}:null}function Ec(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Ac(this,this.stylesheets);else if(this.unsuspend){var i=this.unsuspend;this.unsuspend=null,i()}}}var kc=null;function Ac(i,s){i.stylesheets=null,i.unsuspend!==null&&(i.count++,kc=new Map,s.forEach(Yk,i),kc=null,Ec.call(i))}function Yk(i,s){if(!(s.state.loading&4)){var h=kc.get(i);if(h)var g=h.get(null);else{h=new Map,kc.set(i,h);for(var E=i.querySelectorAll("link[data-precedence],style[data-precedence]"),A=0;A"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Hd.exports=cA(),Hd.exports}var hA=uA();/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. @@ -56,300 +56,303 @@ Error generating stack: `+g.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const hA=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/** + */const fA=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const fA=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase());/** + */const dA=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase());/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const jy=e=>{const t=fA(e);return t.charAt(0).toUpperCase()+t.slice(1)};/** + */const jy=e=>{const t=dA(e);return t.charAt(0).toUpperCase()+t.slice(1)};/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */var Gd={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** + */var $d={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const dA=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1},pA=V.createContext({}),gA=()=>V.useContext(pA),mA=V.forwardRef(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:a="",children:l,iconNode:u,...o},c)=>{const{size:f=24,strokeWidth:p=2,absoluteStrokeWidth:d=!1,color:_="currentColor",className:v=""}=gA()??{},w=r??d?Number(n??p)*24/Number(t??f):n??p;return V.createElement("svg",{ref:c,...Gd,width:t??f??Gd.width,height:t??f??Gd.height,stroke:e??_,strokeWidth:w,className:BS("lucide",v,a),...!l&&!dA(o)&&{"aria-hidden":"true"},...o},[...u.map(([C,y])=>V.createElement(C,y)),...Array.isArray(l)?l:[l]])});/** + */const pA=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1},gA=V.createContext({}),mA=()=>V.useContext(gA),_A=V.forwardRef(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:a="",children:l,iconNode:u,...o},c)=>{const{size:f=24,strokeWidth:p=2,absoluteStrokeWidth:d=!1,color:_="currentColor",className:v=""}=mA()??{},w=r??d?Number(n??p)*24/Number(t??f):n??p;return V.createElement("svg",{ref:c,...$d,width:t??f??$d.width,height:t??f??$d.height,stroke:e??_,strokeWidth:w,className:BS("lucide",v,a),...!l&&!pA(o)&&{"aria-hidden":"true"},...o},[...u.map(([C,b])=>V.createElement(C,b)),...Array.isArray(l)?l:[l]])});/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const $e=(e,t)=>{const n=V.forwardRef(({className:r,...a},l)=>V.createElement(mA,{ref:l,iconNode:t,className:BS(`lucide-${hA(jy(e))}`,`lucide-${e}`,r),...a}));return n.displayName=jy(e),n};/** + */const Ue=(e,t)=>{const n=V.forwardRef(({className:r,...a},l)=>V.createElement(_A,{ref:l,iconNode:t,className:BS(`lucide-${fA(jy(e))}`,`lucide-${e}`,r),...a}));return n.displayName=jy(e),n};/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const _A=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],To=$e("arrow-left",_A);/** + */const vA=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],To=Ue("arrow-left",vA);/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const vA=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],Bc=$e("arrow-right",vA);/** + */const yA=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],jc=Ue("arrow-right",yA);/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const yA=[["path",{d:"M10 22V7a1 1 0 0 0-1-1H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5a1 1 0 0 0-1-1H2",key:"1ah6g2"}],["rect",{x:"14",y:"2",width:"8",height:"8",rx:"1",key:"88lufb"}]],bA=$e("blocks",yA);/** + */const bA=[["path",{d:"M10 22V7a1 1 0 0 0-1-1H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5a1 1 0 0 0-1-1H2",key:"1ah6g2"}],["rect",{x:"14",y:"2",width:"8",height:"8",rx:"1",key:"88lufb"}]],SA=Ue("blocks",bA);/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const SA=[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]],xA=$e("boxes",SA);/** + */const xA=[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]],wA=Ue("boxes",xA);/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const wA=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],_n=$e("check",wA);/** + */const CA=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],_n=Ue("check",CA);/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const CA=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],ga=$e("chevron-down",CA);/** + */const EA=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],pa=Ue("chevron-down",EA);/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const EA=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Pu=$e("chevron-right",EA);/** + */const kA=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Fu=Ue("chevron-right",kA);/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const kA=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]],AA=$e("circle-stop",kA);/** + */const AA=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]],TA=Ue("circle-stop",AA);/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const TA=[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]],NA=$e("cloud",TA);/** + */const NA=[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]],DA=Ue("cloud",NA);/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const DA=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],RA=$e("code",DA);/** + */const RA=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],MA=Ue("code",RA);/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const MA=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],bg=$e("copy",MA);/** + */const LA=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],yg=Ue("copy",LA);/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const LA=[["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}],["path",{d:"m9 10-5 5 5 5",key:"1kshq7"}]],OA=$e("corner-down-left",LA);/** + */const OA=[["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}],["path",{d:"m9 10-5 5 5 5",key:"1kshq7"}]],jA=Ue("corner-down-left",OA);/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const jA=[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]],BA=$e("cpu",jA);/** + */const BA=[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]],IA=Ue("cpu",BA);/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const IA=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],zA=$e("ellipsis",IA);/** + */const zA=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],HA=Ue("ellipsis",zA);/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const HA=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],nl=$e("external-link",HA);/** + */const FA=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],bg=Ue("external-link",FA);/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const FA=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}]],IS=$e("file-code",FA);/** + */const PA=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}]],IS=Ue("file-code",PA);/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const PA=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],UA=$e("file-text",PA);/** + */const UA=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],$A=Ue("file-text",UA);/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const $A=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}]],GA=$e("file",$A);/** + */const GA=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}]],qA=Ue("file",GA);/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const qA=[["path",{d:"M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2",key:"18mbvz"}],["path",{d:"M6.453 15h11.094",key:"3shlmq"}],["path",{d:"M8.5 2h7",key:"csnxdl"}]],VA=$e("flask-conical",qA);/** + */const VA=[["path",{d:"M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2",key:"18mbvz"}],["path",{d:"M6.453 15h11.094",key:"3shlmq"}],["path",{d:"M8.5 2h7",key:"csnxdl"}]],YA=Ue("flask-conical",VA);/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const YA=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],zS=$e("folder-open",YA);/** + */const WA=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],zS=Ue("folder-open",WA);/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const WA=[["path",{d:"M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"hod4my"}],["path",{d:"M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"w4yl2u"}],["path",{d:"M3 5a2 2 0 0 0 2 2h3",key:"f2jnh7"}],["path",{d:"M3 3v13a2 2 0 0 0 2 2h3",key:"k8epm1"}]],HS=$e("folder-tree",WA);/** + */const XA=[["path",{d:"M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"hod4my"}],["path",{d:"M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"w4yl2u"}],["path",{d:"M3 5a2 2 0 0 0 2 2h3",key:"f2jnh7"}],["path",{d:"M3 3v13a2 2 0 0 0 2 2h3",key:"k8epm1"}]],HS=Ue("folder-tree",XA);/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const XA=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],KA=$e("folder",XA);/** + */const KA=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],ZA=Ue("folder",KA);/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const ZA=[["path",{d:"M15 6a9 9 0 0 0-9 9V3",key:"1cii5b"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}]],Uu=$e("git-branch",ZA);/** + */const QA=[["path",{d:"M15 6a9 9 0 0 0-9 9V3",key:"1cii5b"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}]],Pu=Ue("git-branch",QA);/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const QA=[["path",{d:"M10 16h.01",key:"1bzywj"}],["path",{d:"M2.212 11.577a2 2 0 0 0-.212.896V18a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-5.527a2 2 0 0 0-.212-.896L18.55 5.11A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"18tbho"}],["path",{d:"M21.946 12.013H2.054",key:"zqlbp7"}],["path",{d:"M6 16h.01",key:"1pmjb7"}]],JA=$e("hard-drive",QA);/** + */const JA=[["path",{d:"M10 16h.01",key:"1bzywj"}],["path",{d:"M2.212 11.577a2 2 0 0 0-.212.896V18a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-5.527a2 2 0 0 0-.212-.896L18.55 5.11A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"18tbho"}],["path",{d:"M21.946 12.013H2.054",key:"zqlbp7"}],["path",{d:"M6 16h.01",key:"1pmjb7"}]],eT=Ue("hard-drive",JA);/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const eT=[["path",{d:"M18 5a2 2 0 0 1 2 2v8.526a2 2 0 0 0 .212.897l1.068 2.127a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45l1.068-2.127A2 2 0 0 0 4 15.526V7a2 2 0 0 1 2-2z",key:"1pdavp"}],["path",{d:"M20.054 15.987H3.946",key:"14rxg9"}]],tT=$e("laptop",eT);/** + */const tT=[["path",{d:"M18 5a2 2 0 0 1 2 2v8.526a2 2 0 0 0 .212.897l1.068 2.127a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45l1.068-2.127A2 2 0 0 0 4 15.526V7a2 2 0 0 1 2-2z",key:"1pdavp"}],["path",{d:"M20.054 15.987H3.946",key:"14rxg9"}]],nT=Ue("laptop",tT);/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const nT=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],iT=$e("lock",nT);/** + */const iT=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],rT=Ue("lock",iT);/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const rT=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]],sT=$e("maximize-2",rT);/** + */const sT=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]],aT=Ue("maximize-2",sT);/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const aT=[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]],oT=$e("minimize-2",aT);/** + */const oT=[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]],lT=Ue("minimize-2",oT);/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const lT=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],FS=$e("panel-left",lT);/** + */const cT=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],FS=Ue("panel-left",cT);/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const cT=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Sg=$e("plus",cT);/** + */const uT=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Sg=Ue("plus",uT);/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const uT=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],bu=$e("refresh-cw",uT);/** + */const hT=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],yu=Ue("refresh-cw",hT);/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const hT=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],xg=$e("rotate-cw",hT);/** + */const fT=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],xg=Ue("rotate-cw",fT);/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const fT=[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]],PS=$e("scroll-text",fT);/** + */const dT=[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]],PS=Ue("scroll-text",dT);/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const dT=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],Tp=$e("server",dT);/** + */const pT=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],Ap=Ue("server",pT);/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const pT=[["path",{d:"M10 5H3",key:"1qgfaw"}],["path",{d:"M12 19H3",key:"yhmn1j"}],["path",{d:"M14 3v4",key:"1sua03"}],["path",{d:"M16 17v4",key:"1q0r14"}],["path",{d:"M21 12h-9",key:"1o4lsq"}],["path",{d:"M21 19h-5",key:"1rlt1p"}],["path",{d:"M21 5h-7",key:"1oszz2"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M8 12H3",key:"a7s4jb"}]],gT=$e("sliders-horizontal",pT);/** + */const gT=[["path",{d:"M10 5H3",key:"1qgfaw"}],["path",{d:"M12 19H3",key:"yhmn1j"}],["path",{d:"M14 3v4",key:"1sua03"}],["path",{d:"M16 17v4",key:"1q0r14"}],["path",{d:"M21 12h-9",key:"1o4lsq"}],["path",{d:"M21 19h-5",key:"1rlt1p"}],["path",{d:"M21 5h-7",key:"1oszz2"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M8 12H3",key:"a7s4jb"}]],mT=Ue("sliders-horizontal",gT);/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const mT=[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]],_T=$e("square-terminal",mT);/** + */const _T=[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]],vT=Ue("square-terminal",_T);/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const vT=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],US=$e("terminal",vT);/** + */const yT=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],US=Ue("terminal",yT);/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const yT=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],$u=$e("trash-2",yT);/** + */const bT=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],Uu=Ue("trash-2",bT);/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const bT=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],jo=$e("x",bT);async function rs(e){if(!e.ok){const t=await e.text().catch(()=>"");let n=t;try{const r=JSON.parse(t);r.error&&(n=r.error)}catch{}throw new Error(n||`HTTP ${e.status}`)}return await e.json()}const wt=e=>fetch(e).then(t=>rs(t)),Ot=(e,t)=>fetch(e,{method:"POST",headers:t===void 0?{}:{"content-type":"application/json"},body:t===void 0?void 0:JSON.stringify(t)}).then(n=>rs(n)),$S=(e,t)=>fetch(e,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(t)}).then(n=>rs(n)),ST=()=>wt("/api/projects").then(e=>e.projects),xT=e=>Ot("/api/projects",e).then(t=>t.project),wT=e=>wt(`/api/papers/search?q=${encodeURIComponent(e)}`).then(t=>t.papers),CT=e=>wt(`/api/papers/resolve?id=${encodeURIComponent(e)}`).then(t=>t.paper),ET=e=>Ot(`/api/projects/${e}/open`).then(t=>t.project),kT=e=>fetch(`/api/projects/${e}`,{method:"DELETE"}).then(async t=>{if(!t.ok){const n=await t.json().catch(()=>null);throw new Error((n==null?void 0:n.error)??`delete failed (${t.status})`)}}),AT=e=>wt(`/api/projects/${e}/experiments`).then(t=>t.experiments),TT=e=>wt(`/api/projects/${e}/runs`).then(t=>t.runs),NT=()=>wt("/api/instances").then(e=>e.instances),GS=e=>Ot(`/api/runs/${e}/cancel`),DT=(e,t)=>wt(`/api/runs/${e}/log?offset=${t}`),RT=e=>wt(`/api/experiments/${e}/commits`).then(t=>t.commits),MT=(e,t)=>wt(`/api/experiments/${e}/commits/${t}/diff`),By=e=>wt(`/api/projects/${e}/working-tree`),qS=(e,t=new URLSearchParams)=>(e.sessionId&&t.set("sessionId",e.sessionId),e.ref&&t.set("ref",e.ref),t),LT=(e,t,n={})=>wt(`/api/projects/${e}/file?${qS(n,new URLSearchParams({path:t}))}`),OT=(e,t={})=>{const n=qS(t).toString();return wt(`/api/projects/${e}/code-tree${n?`?${n}`:""}`)},wg=(e,t,n)=>`https://github.com/${e}/${t}/tree/${n.split("/").map(encodeURIComponent).join("/")}`,jT=()=>wt("/api/settings/hf"),BT=e=>Ot("/api/settings/hf",{token:e}),IT=()=>wt("/api/settings/k8s"),zT=e=>Ot("/api/settings/k8s",e),HT=()=>wt("/api/settings/modal"),FT=()=>Ot("/api/settings/modal/provision"),PT=()=>wt("/api/settings/env").then(e=>e.vars),VS=(e,t)=>Ot("/api/settings/env",{key:e,value:t}).then(n=>n.vars),UT=e=>fetch(`/api/settings/env/${encodeURIComponent(e)}`,{method:"DELETE"}).then(t=>rs(t)).then(t=>t.vars),YS=()=>wt("/api/settings/data-dir"),$T=e=>Ot("/api/settings/data-dir/validate",{path:e}),GT=e=>Ot("/api/settings/data-dir",{path:e}),qT=e=>Ot("/api/settings/data-dir/move",{path:e}),VT=()=>wt("/api/settings/ssh").then(e=>e.hosts),YT=e=>Ot("/api/settings/ssh/preflight",{host:e}),WT=()=>wt("/api/settings/slurm"),XT=e=>Ot("/api/settings/slurm",e),KT=e=>Ot("/api/settings/slurm/preflight",{host:e}),Iy=e=>wt(`/api/projects/${e}/files`),ZT=(e,t)=>wt(`/api/projects/${e}/files/report?path=${encodeURIComponent(t)}`),QT=(e,t)=>fetch(`/api/projects/${e}/files?path=${encodeURIComponent(t)}`,{method:"DELETE"}).then(n=>rs(n)),Np=(e,t)=>`/api/projects/${e}/files/file?path=${encodeURIComponent(t)}`,WS=()=>wt("/api/settings/git"),JT=e=>Ot("/api/settings/git",e),eN=e=>Ot("/api/settings/git/token",{token:e}),tN=()=>fetch("/api/settings/git/token",{method:"DELETE"}).then(e=>rs(e)),nN=()=>wt("/api/settings/telemetry"),iN=e=>Ot("/api/settings/telemetry",{enabled:e}),rN=e=>Ot("/api/settings/telemetry/consent",{enabled:e}),Cg=(e=!1)=>wt(`/api/harnesses${e?"?refresh=1":""}`).then(t=>t.harnesses),sN=()=>wt("/api/skills").then(e=>e.skills);function Su(e){const t=(e.split("/").pop()??e).replace(/^~/,"").replace(/^claude-/,""),n=[],r=[];for(const a of t.split("-"))/^\d+(\.\d+)?$/.test(a)?r.push(a):(r.length&&n.push(r.splice(0).join(".")),n.push(a==="gpt"?"GPT":a.charAt(0).toUpperCase()+a.slice(1)));return r.length&&n.push(r.join(".")),n.join(" ")}const aN=e=>wt(`/api/chat/sessions?projectId=${encodeURIComponent(e)}`).then(t=>t.sessions),oN=(e,t,n={})=>Ot("/api/chat/sessions",{projectId:e,harness:t,...n}).then(r=>r.session),lN=e=>fetch(`/api/chat/sessions/${e}`,{method:"DELETE"}).then(t=>rs(t)),cN=(e,t)=>$S(`/api/chat/sessions/${e}`,{archived:t}).then(n=>n.session),uN=(e,t)=>$S(`/api/chat/sessions/${e}`,{title:t}).then(n=>n.session),hN=e=>wt(`/api/chat/sessions/${e}/messages`).then(t=>t.messages),fN=e=>`/api/chat/attachments/${encodeURIComponent(e)}`,dN=(e,t,n={},r)=>Ot(`/api/chat/sessions/${e}/message`,{text:t,model:n.model,permissionMode:n.permissionMode,reasoningLevel:n.reasoningLevel,images:r}),pN=e=>Ot(`/api/chat/sessions/${e}/interrupt`),gN=(e,t)=>Ot(`/api/chat/sessions/${e}/respond`,t);function ma(e){const t=Math.max(0,Math.floor((Date.now()-e)/1e3));if(t<60)return`${t}s ago`;const n=Math.floor(t/60);if(n<60)return`${n}m ago`;const r=Math.floor(n/60);return r<24?`${r}h ago`:`${Math.floor(r/24)}d ago`}function zy(e){const t=Math.max(0,Math.floor(e/1e3));if(t<60)return`${t}s`;const n=Math.floor(t/60);if(n<60)return`${n}m`;const r=Math.floor(n/60);return r<24?`${r}h ${n%60}m`:`${Math.floor(r/24)}d ${r%24}h`}function Bo(e){const t=["B","KB","MB","GB","TB"];let n=e,r=0;for(;n>=1024&&r10?`${e.slice(0,10)}…`:e}function XS(e){return e?typeof e.kind=="string"?e.kind:typeof e.type=="string"?e.type:"":""}function KS(e){return e?typeof e.flavor=="string"&&e.flavor?e.flavor:typeof e.manifest=="string"&&e.manifest?e.manifest:typeof e.namespace=="string"&&e.namespace?e.namespace:"":""}const lu=new Map;function mN(e,t){let n=lu.get(e);return n||(n=new Set,lu.set(e,n)),n.add(t),()=>{n.delete(t),n.size===0&&lu.delete(e)}}function _N(e){var t;(t=lu.get(e.runId))==null||t.forEach(n=>n(e))}const Rp=new Set;function vN(e){return Rp.add(e),()=>{Rp.delete(e)}}function Ic(e){Rp.forEach(t=>t(e))}const Mp=new Set;function yN(e){return Mp.add(e),()=>{Mp.delete(e)}}function qd(e){Mp.forEach(t=>t(e))}function bN(e){const t=V.useRef(e);t.current=e,V.useEffect(()=>{const n=new EventSource("/api/events"),r=a=>{try{return JSON.parse(a.data)}catch{return null}};return n.addEventListener("run.updated",a=>{const l=r(a);l!=null&&l.run&&t.current.onRun(l.run)}),n.addEventListener("experiment.updated",a=>{const l=r(a);l!=null&&l.experiment&&t.current.onExperiment(l.experiment)}),n.addEventListener("project.updated",a=>{const l=r(a);l!=null&&l.project&&t.current.onProject(l.project)}),n.addEventListener("files.updated",a=>{var u,o;const l=r(a);l!=null&&l.projectId&&((o=(u=t.current).onFiles)==null||o.call(u,l.projectId))}),n.addEventListener("run.log",a=>{const l=r(a);l!=null&&l.runId&&_N(l)}),n.addEventListener("chat.session",a=>{const l=r(a);l!=null&&l.session&&Ic({type:"session",session:l.session})}),n.addEventListener("chat.session.deleted",a=>{const l=r(a);l!=null&&l.sessionId&&Ic({type:"sessionDeleted",sessionId:l.sessionId})}),n.addEventListener("chat.message",a=>{const l=r(a);l!=null&&l.message&&Ic({type:"message",sessionId:l.sessionId,message:l.message})}),n.addEventListener("chat.busy",a=>{const l=r(a);l!=null&&l.sessionId&&Ic({type:"busy",sessionId:l.sessionId,busy:l.busy})}),n.addEventListener("datadir.move.progress",a=>{const l=r(a);l&&qd({type:"progress",...l})}),n.addEventListener("datadir.move.done",a=>{const l=r(a);l&&qd({type:"done",path:l.path,oldPathLeft:l.oldPathLeft})}),n.addEventListener("datadir.move.error",a=>{const l=r(a);l&&qd({type:"error",error:l.error})}),()=>n.close()},[])}function Hy(e){const t=[],n=String(e||"");let r=n.indexOf(","),a=0,l=!1;for(;!l;){r===-1&&(r=n.length,l=!0);const u=n.slice(a,r).trim();(u||!l)&&t.push(u),a=r+1,r=n.indexOf(",",a)}return t}function SN(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const xN=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,wN=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,CN={};function Fy(e,t){return(CN.jsx?wN:xN).test(e)}const EN=/[ \t\n\f\r]/g;function kN(e){return typeof e=="object"?e.type==="text"?Py(e.value):!1:Py(e)}function Py(e){return e.replace(EN,"")===""}class il{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}il.prototype.normal={};il.prototype.property={};il.prototype.space=void 0;function ZS(e,t){const n={},r={};for(const a of e)Object.assign(n,a.property),Object.assign(r,a.normal);return new il(n,r,t)}function Io(e){return e.toLowerCase()}class vn{constructor(t,n){this.attribute=n,this.property=t}}vn.prototype.attribute="";vn.prototype.booleanish=!1;vn.prototype.boolean=!1;vn.prototype.commaOrSpaceSeparated=!1;vn.prototype.commaSeparated=!1;vn.prototype.defined=!1;vn.prototype.mustUseProperty=!1;vn.prototype.number=!1;vn.prototype.overloadedBoolean=!1;vn.prototype.property="";vn.prototype.spaceSeparated=!1;vn.prototype.space=void 0;let AN=0;const ze=ss(),Ft=ss(),Lp=ss(),Se=ss(),St=ss(),Xr=ss(),An=ss();function ss(){return 2**++AN}const Op=Object.freeze(Object.defineProperty({__proto__:null,boolean:ze,booleanish:Ft,commaOrSpaceSeparated:An,commaSeparated:Xr,number:Se,overloadedBoolean:Lp,spaceSeparated:St},Symbol.toStringTag,{value:"Module"})),Vd=Object.keys(Op);class Eg extends vn{constructor(t,n,r,a){let l=-1;if(super(t,n),Uy(this,"space",a),typeof r=="number")for(;++l4&&n.slice(0,4)==="data"&&MN.test(t)){if(t.charAt(4)==="-"){const l=t.slice(5).replace($y,ON);r="data"+l.charAt(0).toUpperCase()+l.slice(1)}else{const l=t.slice(4);if(!$y.test(l)){let u=l.replace(RN,LN);u.charAt(0)!=="-"&&(u="-"+u),t="data"+u}}a=Eg}return new a(r,t)}function LN(e){return"-"+e.toLowerCase()}function ON(e){return e.charAt(1).toUpperCase()}const sx=ZS([QS,TN,tx,nx,ix],"html"),Gu=ZS([QS,NN,tx,nx,ix],"svg");function Gy(e){const t=String(e||"").trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function jN(e){return e.join(" ").trim()}var Ys={},Yd,qy;function BN(){if(qy)return Yd;qy=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,a=/^:\s*/,l=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,u=/^[;\s]*/,o=/^\s+|\s+$/g,c=` -`,f="/",p="*",d="",_="comment",v="declaration";function w(y,S){if(typeof y!="string")throw new TypeError("First argument must be a string");if(!y)return[];S=S||{};var x=1,b=1;function k(z){var q=z.match(t);q&&(x+=q.length);var G=z.lastIndexOf(c);b=~G?z.length-G:b+z.length}function D(){var z={line:x,column:b};return function(q){return q.position=new T(z),M(),q}}function T(z){this.start=z,this.end={line:x,column:b},this.source=S.source}T.prototype.content=y;function R(z){var q=new Error(S.source+":"+x+":"+b+": "+z);if(q.reason=z,q.filename=S.source,q.line=x,q.column=b,q.source=y,!S.silent)throw q}function N(z){var q=z.exec(y);if(q){var G=q[0];return k(G),y=y.slice(G.length),q}}function M(){N(n)}function B(z){var q;for(z=z||[];q=H();)q!==!1&&z.push(q);return z}function H(){var z=D();if(!(f!=y.charAt(0)||p!=y.charAt(1))){for(var q=2;d!=y.charAt(q)&&(p!=y.charAt(q)||f!=y.charAt(q+1));)++q;if(q+=2,d===y.charAt(q-1))return R("End of comment missing");var G=y.slice(2,q-2);return b+=2,k(G),y=y.slice(q),b+=2,z({type:_,comment:G})}}function Y(){var z=D(),q=N(r);if(q){if(H(),!N(a))return R("property missing ':'");var G=N(l),X=z({type:v,property:C(q[0].replace(e,d)),value:G?C(G[0].replace(e,d)):d});return N(u),X}}function F(){var z=[];B(z);for(var q;q=Y();)q!==!1&&(z.push(q),B(z));return z}return M(),F()}function C(y){return y?y.replace(o,d):d}return Yd=w,Yd}var Vy;function IN(){if(Vy)return Ys;Vy=1;var e=Ys&&Ys.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Ys,"__esModule",{value:!0}),Ys.default=n;const t=e(BN());function n(r,a){let l=null;if(!r||typeof r!="string")return l;const u=(0,t.default)(r),o=typeof a=="function";return u.forEach(c=>{if(c.type!=="declaration")return;const{property:f,value:p}=c;o?a(f,p,c):p&&(l=l||{},l[f]=p)}),l}return Ys}var yo={},Yy;function zN(){if(Yy)return yo;Yy=1,Object.defineProperty(yo,"__esModule",{value:!0}),yo.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,l=function(f){return!f||n.test(f)||e.test(f)},u=function(f,p){return p.toUpperCase()},o=function(f,p){return"".concat(p,"-")},c=function(f,p){return p===void 0&&(p={}),l(f)?f:(f=f.toLowerCase(),p.reactCompat?f=f.replace(a,o):f=f.replace(r,o),f.replace(t,u))};return yo.camelCase=c,yo}var bo,Wy;function HN(){if(Wy)return bo;Wy=1;var e=bo&&bo.__importDefault||function(a){return a&&a.__esModule?a:{default:a}},t=e(IN()),n=zN();function r(a,l){var u={};return!a||typeof a!="string"||(0,t.default)(a,function(o,c){o&&c&&(u[(0,n.camelCase)(o,l)]=c)}),u}return r.default=r,bo=r,bo}var FN=HN();const PN=Fu(FN),ax=ox("end"),kg=ox("start");function ox(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function UN(e){const t=kg(e),n=ax(e);if(t&&n)return{start:t,end:n}}function No(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Xy(e.position):"start"in e||"end"in e?Xy(e):"line"in e||"column"in e?jp(e):""}function jp(e){return Ky(e&&e.line)+":"+Ky(e&&e.column)}function Xy(e){return jp(e&&e.start)+"-"+jp(e&&e.end)}function Ky(e){return e&&typeof e=="number"?e:1}class tn extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let a="",l={},u=!1;if(n&&("line"in n&&"column"in n?l={place:n}:"start"in n&&"end"in n?l={place:n}:"type"in n?l={ancestors:[n],place:n.position}:l={...n}),typeof t=="string"?a=t:!l.cause&&t&&(u=!0,a=t.message,l.cause=t),!l.ruleId&&!l.source&&typeof r=="string"){const c=r.indexOf(":");c===-1?l.ruleId=r:(l.source=r.slice(0,c),l.ruleId=r.slice(c+1))}if(!l.place&&l.ancestors&&l.ancestors){const c=l.ancestors[l.ancestors.length-1];c&&(l.place=c.position)}const o=l.place&&"start"in l.place?l.place.start:l.place;this.ancestors=l.ancestors||void 0,this.cause=l.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file="",this.message=a,this.line=o?o.line:void 0,this.name=No(l.place)||"1:1",this.place=l.place||void 0,this.reason=this.message,this.ruleId=l.ruleId||void 0,this.source=l.source||void 0,this.stack=u&&l.cause&&typeof l.cause.stack=="string"?l.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}tn.prototype.file="";tn.prototype.name="";tn.prototype.reason="";tn.prototype.message="";tn.prototype.stack="";tn.prototype.column=void 0;tn.prototype.line=void 0;tn.prototype.ancestors=void 0;tn.prototype.cause=void 0;tn.prototype.fatal=void 0;tn.prototype.place=void 0;tn.prototype.ruleId=void 0;tn.prototype.source=void 0;const Ag={}.hasOwnProperty,$N=new Map,GN=/[A-Z]/g,qN=new Set(["table","tbody","thead","tfoot","tr"]),VN=new Set(["td","th"]),lx="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function YN(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=t3(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=e3(n,t.jsx,t.jsxs)}const a={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?Gu:sx,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},l=cx(a,e,void 0);return l&&typeof l!="string"?l:a.create(e,a.Fragment,{children:l||void 0},void 0)}function cx(e,t,n){if(t.type==="element")return WN(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return XN(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return ZN(e,t,n);if(t.type==="mdxjsEsm")return KN(e,t);if(t.type==="root")return QN(e,t,n);if(t.type==="text")return JN(e,t)}function WN(e,t,n){const r=e.schema;let a=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(a=Gu,e.schema=a),e.ancestors.push(t);const l=hx(e,t.tagName,!1),u=n3(e,t);let o=Ng(e,t);return qN.has(t.tagName)&&(o=o.filter(function(c){return typeof c=="string"?!kN(c):!0})),ux(e,u,l,t),Tg(u,o),e.ancestors.pop(),e.schema=r,e.create(t,l,u,n)}function XN(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}zo(e,t.position)}function KN(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);zo(e,t.position)}function ZN(e,t,n){const r=e.schema;let a=r;t.name==="svg"&&r.space==="html"&&(a=Gu,e.schema=a),e.ancestors.push(t);const l=t.name===null?e.Fragment:hx(e,t.name,!0),u=i3(e,t),o=Ng(e,t);return ux(e,u,l,t),Tg(u,o),e.ancestors.pop(),e.schema=r,e.create(t,l,u,n)}function QN(e,t,n){const r={};return Tg(r,Ng(e,t)),e.create(t,e.Fragment,r,n)}function JN(e,t){return t.value}function ux(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Tg(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function e3(e,t,n){return r;function r(a,l,u,o){const f=Array.isArray(u.children)?n:t;return o?f(l,u,o):f(l,u)}}function t3(e,t){return n;function n(r,a,l,u){const o=Array.isArray(l.children),c=kg(r);return t(a,l,u,o,{columnNumber:c?c.column-1:void 0,fileName:e,lineNumber:c?c.line:void 0},void 0)}}function n3(e,t){const n={};let r,a;for(a in t.properties)if(a!=="children"&&Ag.call(t.properties,a)){const l=r3(e,a,t.properties[a]);if(l){const[u,o]=l;e.tableCellAlignToStyle&&u==="align"&&typeof o=="string"&&VN.has(t.tagName)?r=o:n[u]=o}}if(r){const l=n.style||(n.style={});l[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function i3(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const l=r.data.estree.body[0];l.type;const u=l.expression;u.type;const o=u.properties[0];o.type,Object.assign(n,e.evaluater.evaluateExpression(o.argument))}else zo(e,t.position);else{const a=r.name;let l;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const o=r.value.data.estree.body[0];o.type,l=e.evaluater.evaluateExpression(o.expression)}else zo(e,t.position);else l=r.value===null?!0:r.value;n[a]=l}return n}function Ng(e,t){const n=[];let r=-1;const a=e.passKeys?new Map:$N;for(;++ra?0:a+t:t=t>a?a:t,n=n>0?n:0,r.length<1e4)u=Array.from(r),u.unshift(t,n),e.splice(...u);else for(n&&e.splice(t,n);l0?(Dn(e,e.length,0,t),e):t}const Jy={}.hasOwnProperty;function dx(e){const t={};let n=-1;for(;++n13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Qn(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const sn=xr(/[A-Za-z]/),en=xr(/[\dA-Za-z]/),d3=xr(/[#-'*+\--9=?A-Z^-~]/);function xu(e){return e!==null&&(e<32||e===127)}const Bp=xr(/\d/),p3=xr(/[\dA-Fa-f]/),g3=xr(/[!-/:-@[-`{-~]/);function Oe(e){return e!==null&&e<-2}function xt(e){return e!==null&&(e<0||e===32)}function Ve(e){return e===-2||e===-1||e===32}const qu=xr(new RegExp("\\p{P}|\\p{S}","u")),Qr=xr(/\s/);function xr(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function va(e){const t=[];let n=-1,r=0,a=0;for(;++n55295&&l<57344){const o=e.charCodeAt(n+1);l<56320&&o>56319&&o<57344?(u=String.fromCharCode(l,o),a=1):u="�"}else u=String.fromCharCode(l);u&&(t.push(e.slice(r,n),encodeURIComponent(u)),r=n+a+1,u=""),a&&(n+=a,a=0)}return t.join("")+e.slice(r)}function tt(e,t,n,r){const a=r?r-1:Number.POSITIVE_INFINITY;let l=0;return u;function u(c){return Ve(c)?(e.enter(n),o(c)):t(c)}function o(c){return Ve(c)&&l++u))return;const R=t.events.length;let N=R,M,B;for(;N--;)if(t.events[N][0]==="exit"&&t.events[N][1].type==="chunkFlow"){if(M){B=t.events[N][1].end;break}M=!0}for(S(r),T=R;Tb;){const D=n[k];t.containerState=D[1],D[0].exit.call(t,e)}n.length=b}function x(){a.write([null]),l=void 0,a=void 0,t.containerState._closeFlow=void 0}}function b3(e,t,n){return tt(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function aa(e){if(e===null||xt(e)||Qr(e))return 1;if(qu(e))return 2}function Vu(e,t,n){const r=[];let a=-1;for(;++a1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const d={...e[r][1].end},_={...e[n][1].start};t1(d,-c),t1(_,c),u={type:c>1?"strongSequence":"emphasisSequence",start:d,end:{...e[r][1].end}},o={type:c>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:_},l={type:c>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},a={type:c>1?"strong":"emphasis",start:{...u.start},end:{...o.end}},e[r][1].end={...u.start},e[n][1].start={...o.end},f=[],e[r][1].end.offset-e[r][1].start.offset&&(f=$n(f,[["enter",e[r][1],t],["exit",e[r][1],t]])),f=$n(f,[["enter",a,t],["enter",u,t],["exit",u,t],["enter",l,t]]),f=$n(f,Vu(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),f=$n(f,[["exit",l,t],["enter",o,t],["exit",o,t],["exit",a,t]]),e[n][1].end.offset-e[n][1].start.offset?(p=2,f=$n(f,[["enter",e[n][1],t],["exit",e[n][1],t]])):p=0,Dn(e,r-1,n-r+3,f),n=r+f.length-p-2;break}}for(n=-1;++n0&&Ve(T)?tt(e,x,"linePrefix",l+1)(T):x(T)}function x(T){return T===null||Oe(T)?e.check(n1,C,k)(T):(e.enter("codeFlowValue"),b(T))}function b(T){return T===null||Oe(T)?(e.exit("codeFlowValue"),x(T)):(e.consume(T),b)}function k(T){return e.exit("codeFenced"),t(T)}function D(T,R,N){let M=0;return B;function B(q){return T.enter("lineEnding"),T.consume(q),T.exit("lineEnding"),H}function H(q){return T.enter("codeFencedFence"),Ve(q)?tt(T,Y,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(q):Y(q)}function Y(q){return q===o?(T.enter("codeFencedFenceSequence"),F(q)):N(q)}function F(q){return q===o?(M++,T.consume(q),F):M>=u?(T.exit("codeFencedFenceSequence"),Ve(q)?tt(T,z,"whitespace")(q):z(q)):N(q)}function z(q){return q===null||Oe(q)?(T.exit("codeFencedFence"),R(q)):N(q)}}}function M3(e,t,n){const r=this;return a;function a(u){return u===null?n(u):(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),l)}function l(u){return r.parser.lazy[r.now().line]?n(u):t(u)}}const Xd={name:"codeIndented",tokenize:O3},L3={partial:!0,tokenize:j3};function O3(e,t,n){const r=this;return a;function a(f){return e.enter("codeIndented"),tt(e,l,"linePrefix",5)(f)}function l(f){const p=r.events[r.events.length-1];return p&&p[1].type==="linePrefix"&&p[2].sliceSerialize(p[1],!0).length>=4?u(f):n(f)}function u(f){return f===null?c(f):Oe(f)?e.attempt(L3,u,c)(f):(e.enter("codeFlowValue"),o(f))}function o(f){return f===null||Oe(f)?(e.exit("codeFlowValue"),u(f)):(e.consume(f),o)}function c(f){return e.exit("codeIndented"),t(f)}}function j3(e,t,n){const r=this;return a;function a(u){return r.parser.lazy[r.now().line]?n(u):Oe(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),a):tt(e,l,"linePrefix",5)(u)}function l(u){const o=r.events[r.events.length-1];return o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?t(u):Oe(u)?a(u):n(u)}}const B3={name:"codeText",previous:z3,resolve:I3,tokenize:H3};function I3(e){let t=e.length-4,n=3,r,a;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return tthis.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const a=n||0;this.setCursor(Math.trunc(t));const l=this.right.splice(this.right.length-a,Number.POSITIVE_INFINITY);return r&&So(this.left,r),l.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),So(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),So(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t=4?t(u):e.interrupt(r.parser.constructs.flow,n,t)(u)}}function yx(e,t,n,r,a,l,u,o,c){const f=c||Number.POSITIVE_INFINITY;let p=0;return d;function d(S){return S===60?(e.enter(r),e.enter(a),e.enter(l),e.consume(S),e.exit(l),_):S===null||S===32||S===41||xu(S)?n(S):(e.enter(r),e.enter(u),e.enter(o),e.enter("chunkString",{contentType:"string"}),C(S))}function _(S){return S===62?(e.enter(l),e.consume(S),e.exit(l),e.exit(a),e.exit(r),t):(e.enter(o),e.enter("chunkString",{contentType:"string"}),v(S))}function v(S){return S===62?(e.exit("chunkString"),e.exit(o),_(S)):S===null||S===60||Oe(S)?n(S):(e.consume(S),S===92?w:v)}function w(S){return S===60||S===62||S===92?(e.consume(S),v):v(S)}function C(S){return!p&&(S===null||S===41||xt(S))?(e.exit("chunkString"),e.exit(o),e.exit(u),e.exit(r),t(S)):p999||v===null||v===91||v===93&&!c||v===94&&!o&&"_hiddenFootnoteSupport"in u.parser.constructs?n(v):v===93?(e.exit(l),e.enter(a),e.consume(v),e.exit(a),e.exit(r),t):Oe(v)?(e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),p):(e.enter("chunkString",{contentType:"string"}),d(v))}function d(v){return v===null||v===91||v===93||Oe(v)||o++>999?(e.exit("chunkString"),p(v)):(e.consume(v),c||(c=!Ve(v)),v===92?_:d)}function _(v){return v===91||v===92||v===93?(e.consume(v),o++,d):d(v)}}function Sx(e,t,n,r,a,l){let u;return o;function o(_){return _===34||_===39||_===40?(e.enter(r),e.enter(a),e.consume(_),e.exit(a),u=_===40?41:_,c):n(_)}function c(_){return _===u?(e.enter(a),e.consume(_),e.exit(a),e.exit(r),t):(e.enter(l),f(_))}function f(_){return _===u?(e.exit(l),c(u)):_===null?n(_):Oe(_)?(e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),tt(e,f,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),p(_))}function p(_){return _===u||_===null||Oe(_)?(e.exit("chunkString"),f(_)):(e.consume(_),_===92?d:p)}function d(_){return _===u||_===92?(e.consume(_),p):p(_)}}function Do(e,t){let n;return r;function r(a){return Oe(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,r):Ve(a)?tt(e,r,n?"linePrefix":"lineSuffix")(a):t(a)}}const Y3={name:"definition",tokenize:X3},W3={partial:!0,tokenize:K3};function X3(e,t,n){const r=this;let a;return l;function l(v){return e.enter("definition"),u(v)}function u(v){return bx.call(r,e,o,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(v)}function o(v){return a=Qn(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),v===58?(e.enter("definitionMarker"),e.consume(v),e.exit("definitionMarker"),c):n(v)}function c(v){return xt(v)?Do(e,f)(v):f(v)}function f(v){return yx(e,p,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(v)}function p(v){return e.attempt(W3,d,d)(v)}function d(v){return Ve(v)?tt(e,_,"whitespace")(v):_(v)}function _(v){return v===null||Oe(v)?(e.exit("definition"),r.parser.defined.push(a),t(v)):n(v)}}function K3(e,t,n){return r;function r(o){return xt(o)?Do(e,a)(o):n(o)}function a(o){return Sx(e,l,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(o)}function l(o){return Ve(o)?tt(e,u,"whitespace")(o):u(o)}function u(o){return o===null||Oe(o)?t(o):n(o)}}const Z3={name:"hardBreakEscape",tokenize:Q3};function Q3(e,t,n){return r;function r(l){return e.enter("hardBreakEscape"),e.consume(l),a}function a(l){return Oe(l)?(e.exit("hardBreakEscape"),t(l)):n(l)}}const J3={name:"headingAtx",resolve:e5,tokenize:t5};function e5(e,t){let n=e.length-2,r=3,a,l;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(a={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},l={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},Dn(e,r,n-r+1,[["enter",a,t],["enter",l,t],["exit",l,t],["exit",a,t]])),e}function t5(e,t,n){let r=0;return a;function a(p){return e.enter("atxHeading"),l(p)}function l(p){return e.enter("atxHeadingSequence"),u(p)}function u(p){return p===35&&r++<6?(e.consume(p),u):p===null||xt(p)?(e.exit("atxHeadingSequence"),o(p)):n(p)}function o(p){return p===35?(e.enter("atxHeadingSequence"),c(p)):p===null||Oe(p)?(e.exit("atxHeading"),t(p)):Ve(p)?tt(e,o,"whitespace")(p):(e.enter("atxHeadingText"),f(p))}function c(p){return p===35?(e.consume(p),c):(e.exit("atxHeadingSequence"),o(p))}function f(p){return p===null||p===35||xt(p)?(e.exit("atxHeadingText"),o(p)):(e.consume(p),f)}}const n5=["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"],r1=["pre","script","style","textarea"],i5={concrete:!0,name:"htmlFlow",resolveTo:a5,tokenize:o5},r5={partial:!0,tokenize:c5},s5={partial:!0,tokenize:l5};function a5(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function o5(e,t,n){const r=this;let a,l,u,o,c;return f;function f(U){return p(U)}function p(U){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(U),d}function d(U){return U===33?(e.consume(U),_):U===47?(e.consume(U),l=!0,C):U===63?(e.consume(U),a=3,r.interrupt?t:L):sn(U)?(e.consume(U),u=String.fromCharCode(U),y):n(U)}function _(U){return U===45?(e.consume(U),a=2,v):U===91?(e.consume(U),a=5,o=0,w):sn(U)?(e.consume(U),a=4,r.interrupt?t:L):n(U)}function v(U){return U===45?(e.consume(U),r.interrupt?t:L):n(U)}function w(U){const Q="CDATA[";return U===Q.charCodeAt(o++)?(e.consume(U),o===Q.length?r.interrupt?t:Y:w):n(U)}function C(U){return sn(U)?(e.consume(U),u=String.fromCharCode(U),y):n(U)}function y(U){if(U===null||U===47||U===62||xt(U)){const Q=U===47,re=u.toLowerCase();return!Q&&!l&&r1.includes(re)?(a=1,r.interrupt?t(U):Y(U)):n5.includes(u.toLowerCase())?(a=6,Q?(e.consume(U),S):r.interrupt?t(U):Y(U)):(a=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(U):l?x(U):b(U))}return U===45||en(U)?(e.consume(U),u+=String.fromCharCode(U),y):n(U)}function S(U){return U===62?(e.consume(U),r.interrupt?t:Y):n(U)}function x(U){return Ve(U)?(e.consume(U),x):B(U)}function b(U){return U===47?(e.consume(U),B):U===58||U===95||sn(U)?(e.consume(U),k):Ve(U)?(e.consume(U),b):B(U)}function k(U){return U===45||U===46||U===58||U===95||en(U)?(e.consume(U),k):D(U)}function D(U){return U===61?(e.consume(U),T):Ve(U)?(e.consume(U),D):b(U)}function T(U){return U===null||U===60||U===61||U===62||U===96?n(U):U===34||U===39?(e.consume(U),c=U,R):Ve(U)?(e.consume(U),T):N(U)}function R(U){return U===c?(e.consume(U),c=null,M):U===null||Oe(U)?n(U):(e.consume(U),R)}function N(U){return U===null||U===34||U===39||U===47||U===60||U===61||U===62||U===96||xt(U)?D(U):(e.consume(U),N)}function M(U){return U===47||U===62||Ve(U)?b(U):n(U)}function B(U){return U===62?(e.consume(U),H):n(U)}function H(U){return U===null||Oe(U)?Y(U):Ve(U)?(e.consume(U),H):n(U)}function Y(U){return U===45&&a===2?(e.consume(U),G):U===60&&a===1?(e.consume(U),X):U===62&&a===4?(e.consume(U),j):U===63&&a===3?(e.consume(U),L):U===93&&a===5?(e.consume(U),O):Oe(U)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(r5,$,F)(U)):U===null||Oe(U)?(e.exit("htmlFlowData"),F(U)):(e.consume(U),Y)}function F(U){return e.check(s5,z,$)(U)}function z(U){return e.enter("lineEnding"),e.consume(U),e.exit("lineEnding"),q}function q(U){return U===null||Oe(U)?F(U):(e.enter("htmlFlowData"),Y(U))}function G(U){return U===45?(e.consume(U),L):Y(U)}function X(U){return U===47?(e.consume(U),u="",K):Y(U)}function K(U){if(U===62){const Q=u.toLowerCase();return r1.includes(Q)?(e.consume(U),j):Y(U)}return sn(U)&&u.length<8?(e.consume(U),u+=String.fromCharCode(U),K):Y(U)}function O(U){return U===93?(e.consume(U),L):Y(U)}function L(U){return U===62?(e.consume(U),j):U===45&&a===2?(e.consume(U),L):Y(U)}function j(U){return U===null||Oe(U)?(e.exit("htmlFlowData"),$(U)):(e.consume(U),j)}function $(U){return e.exit("htmlFlow"),t(U)}}function l5(e,t,n){const r=this;return a;function a(u){return Oe(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),l):n(u)}function l(u){return r.parser.lazy[r.now().line]?n(u):t(u)}}function c5(e,t,n){return r;function r(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(rl,t,n)}}const u5={name:"htmlText",tokenize:h5};function h5(e,t,n){const r=this;let a,l,u;return o;function o(L){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(L),c}function c(L){return L===33?(e.consume(L),f):L===47?(e.consume(L),D):L===63?(e.consume(L),b):sn(L)?(e.consume(L),N):n(L)}function f(L){return L===45?(e.consume(L),p):L===91?(e.consume(L),l=0,w):sn(L)?(e.consume(L),x):n(L)}function p(L){return L===45?(e.consume(L),v):n(L)}function d(L){return L===null?n(L):L===45?(e.consume(L),_):Oe(L)?(u=d,X(L)):(e.consume(L),d)}function _(L){return L===45?(e.consume(L),v):d(L)}function v(L){return L===62?G(L):L===45?_(L):d(L)}function w(L){const j="CDATA[";return L===j.charCodeAt(l++)?(e.consume(L),l===j.length?C:w):n(L)}function C(L){return L===null?n(L):L===93?(e.consume(L),y):Oe(L)?(u=C,X(L)):(e.consume(L),C)}function y(L){return L===93?(e.consume(L),S):C(L)}function S(L){return L===62?G(L):L===93?(e.consume(L),S):C(L)}function x(L){return L===null||L===62?G(L):Oe(L)?(u=x,X(L)):(e.consume(L),x)}function b(L){return L===null?n(L):L===63?(e.consume(L),k):Oe(L)?(u=b,X(L)):(e.consume(L),b)}function k(L){return L===62?G(L):b(L)}function D(L){return sn(L)?(e.consume(L),T):n(L)}function T(L){return L===45||en(L)?(e.consume(L),T):R(L)}function R(L){return Oe(L)?(u=R,X(L)):Ve(L)?(e.consume(L),R):G(L)}function N(L){return L===45||en(L)?(e.consume(L),N):L===47||L===62||xt(L)?M(L):n(L)}function M(L){return L===47?(e.consume(L),G):L===58||L===95||sn(L)?(e.consume(L),B):Oe(L)?(u=M,X(L)):Ve(L)?(e.consume(L),M):G(L)}function B(L){return L===45||L===46||L===58||L===95||en(L)?(e.consume(L),B):H(L)}function H(L){return L===61?(e.consume(L),Y):Oe(L)?(u=H,X(L)):Ve(L)?(e.consume(L),H):M(L)}function Y(L){return L===null||L===60||L===61||L===62||L===96?n(L):L===34||L===39?(e.consume(L),a=L,F):Oe(L)?(u=Y,X(L)):Ve(L)?(e.consume(L),Y):(e.consume(L),z)}function F(L){return L===a?(e.consume(L),a=void 0,q):L===null?n(L):Oe(L)?(u=F,X(L)):(e.consume(L),F)}function z(L){return L===null||L===34||L===39||L===60||L===61||L===96?n(L):L===47||L===62||xt(L)?M(L):(e.consume(L),z)}function q(L){return L===47||L===62||xt(L)?M(L):n(L)}function G(L){return L===62?(e.consume(L),e.exit("htmlTextData"),e.exit("htmlText"),t):n(L)}function X(L){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(L),e.exit("lineEnding"),K}function K(L){return Ve(L)?tt(e,O,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):O(L)}function O(L){return e.enter("htmlTextData"),u(L)}}const Rg={name:"labelEnd",resolveAll:g5,resolveTo:m5,tokenize:_5},f5={tokenize:v5},d5={tokenize:y5},p5={tokenize:b5};function g5(e){let t=-1;const n=[];for(;++t=3&&(f===null||Oe(f))?(e.exit("thematicBreak"),t(f)):n(f)}function c(f){return f===a?(e.consume(f),r++,c):(e.exit("thematicBreakSequence"),Ve(f)?tt(e,o,"whitespace")(f):o(f))}}const pn={continuation:{tokenize:D5},exit:M5,name:"list",tokenize:N5},A5={partial:!0,tokenize:L5},T5={partial:!0,tokenize:R5};function N5(e,t,n){const r=this,a=r.events[r.events.length-1];let l=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[1],!0).length:0,u=0;return o;function o(v){const w=r.containerState.type||(v===42||v===43||v===45?"listUnordered":"listOrdered");if(w==="listUnordered"?!r.containerState.marker||v===r.containerState.marker:Bp(v)){if(r.containerState.type||(r.containerState.type=w,e.enter(w,{_container:!0})),w==="listUnordered")return e.enter("listItemPrefix"),v===42||v===45?e.check(cu,n,f)(v):f(v);if(!r.interrupt||v===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),c(v)}return n(v)}function c(v){return Bp(v)&&++u<10?(e.consume(v),c):(!r.interrupt||u<2)&&(r.containerState.marker?v===r.containerState.marker:v===41||v===46)?(e.exit("listItemValue"),f(v)):n(v)}function f(v){return e.enter("listItemMarker"),e.consume(v),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||v,e.check(rl,r.interrupt?n:p,e.attempt(A5,_,d))}function p(v){return r.containerState.initialBlankLine=!0,l++,_(v)}function d(v){return Ve(v)?(e.enter("listItemPrefixWhitespace"),e.consume(v),e.exit("listItemPrefixWhitespace"),_):n(v)}function _(v){return r.containerState.size=l+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(v)}}function D5(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(rl,a,l);function a(o){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,tt(e,t,"listItemIndent",r.containerState.size+1)(o)}function l(o){return r.containerState.furtherBlankLines||!Ve(o)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,u(o)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(T5,t,u)(o))}function u(o){return r.containerState._closeFlow=!0,r.interrupt=void 0,tt(e,e.attempt(pn,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}function R5(e,t,n){const r=this;return tt(e,a,"listItemIndent",r.containerState.size+1);function a(l){const u=r.events[r.events.length-1];return u&&u[1].type==="listItemIndent"&&u[2].sliceSerialize(u[1],!0).length===r.containerState.size?t(l):n(l)}}function M5(e){e.exit(this.containerState.type)}function L5(e,t,n){const r=this;return tt(e,a,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function a(l){const u=r.events[r.events.length-1];return!Ve(l)&&u&&u[1].type==="listItemPrefixWhitespace"?t(l):n(l)}}const s1={name:"setextUnderline",resolveTo:O5,tokenize:j5};function O5(e,t){let n=e.length,r,a,l;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(a=n)}else e[n][1].type==="content"&&e.splice(n,1),!l&&e[n][1].type==="definition"&&(l=n);const u={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[a][1].type="setextHeadingText",l?(e.splice(a,0,["enter",u,t]),e.splice(l+1,0,["exit",e[r][1],t]),e[r][1].end={...e[l][1].end}):e[r][1]=u,e.push(["exit",u,t]),e}function j5(e,t,n){const r=this;let a;return l;function l(f){let p=r.events.length,d;for(;p--;)if(r.events[p][1].type!=="lineEnding"&&r.events[p][1].type!=="linePrefix"&&r.events[p][1].type!=="content"){d=r.events[p][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||d)?(e.enter("setextHeadingLine"),a=f,u(f)):n(f)}function u(f){return e.enter("setextHeadingLineSequence"),o(f)}function o(f){return f===a?(e.consume(f),o):(e.exit("setextHeadingLineSequence"),Ve(f)?tt(e,c,"lineSuffix")(f):c(f))}function c(f){return f===null||Oe(f)?(e.exit("setextHeadingLine"),t(f)):n(f)}}const B5={tokenize:I5};function I5(e){const t=this,n=e.attempt(rl,r,e.attempt(this.parser.constructs.flowInitial,a,tt(e,e.attempt(this.parser.constructs.flow,a,e.attempt(U3,a)),"linePrefix")));return n;function r(l){if(l===null){e.consume(l);return}return e.enter("lineEndingBlank"),e.consume(l),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function a(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const z5={resolveAll:wx()},H5=xx("string"),F5=xx("text");function xx(e){return{resolveAll:wx(e==="text"?P5:void 0),tokenize:t};function t(n){const r=this,a=this.parser.constructs[e],l=n.attempt(a,u,o);return u;function u(p){return f(p)?l(p):o(p)}function o(p){if(p===null){n.consume(p);return}return n.enter("data"),n.consume(p),c}function c(p){return f(p)?(n.exit("data"),l(p)):(n.consume(p),c)}function f(p){if(p===null)return!0;const d=a[p];let _=-1;if(d)for(;++_-1){const o=u[0];typeof o=="string"?u[0]=o.slice(r):u.shift()}l>0&&u.push(e[a].slice(0,l))}return u}function eD(e,t){let n=-1;const r=[];let a;for(;++n"");let n=t;try{const r=JSON.parse(t);r.error&&(n=r.error)}catch{}throw new Error(n||`HTTP ${e.status}`)}return await e.json()}const bt=e=>fetch(e).then(t=>is(t)),Ot=(e,t)=>fetch(e,{method:"POST",headers:t===void 0?{}:{"content-type":"application/json"},body:t===void 0?void 0:JSON.stringify(t)}).then(n=>is(n)),$S=(e,t)=>fetch(e,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(t)}).then(n=>is(n)),xT=()=>bt("/api/projects").then(e=>e.projects),wT=e=>Ot("/api/projects",e).then(t=>t.project),CT=e=>bt(`/api/papers/search?q=${encodeURIComponent(e)}`).then(t=>t.papers),ET=e=>bt(`/api/papers/resolve?id=${encodeURIComponent(e)}`).then(t=>t.paper),kT=e=>Ot(`/api/projects/${e}/open`).then(t=>t.project),AT=e=>fetch(`/api/projects/${e}`,{method:"DELETE"}).then(async t=>{if(!t.ok){const n=await t.json().catch(()=>null);throw new Error((n==null?void 0:n.error)??`delete failed (${t.status})`)}}),TT=e=>bt(`/api/projects/${e}/experiments`).then(t=>t.experiments),NT=e=>bt(`/api/projects/${e}/runs`).then(t=>t.runs),DT=()=>bt("/api/instances").then(e=>e.instances),GS=e=>Ot(`/api/runs/${e}/cancel`),RT=(e,t)=>bt(`/api/runs/${e}/log?offset=${t}`),MT=e=>bt(`/api/experiments/${e}/commits`).then(t=>t.commits),LT=(e,t)=>bt(`/api/experiments/${e}/commits/${t}/diff`),By=e=>bt(`/api/projects/${e}/working-tree`),qS=(e,t=new URLSearchParams)=>(e.sessionId&&t.set("sessionId",e.sessionId),e.ref&&t.set("ref",e.ref),t),OT=(e,t,n={})=>bt(`/api/projects/${e}/file?${qS(n,new URLSearchParams({path:t}))}`),jT=(e,t={})=>{const n=qS(t).toString();return bt(`/api/projects/${e}/code-tree${n?`?${n}`:""}`)},wg=(e,t,n)=>`https://github.com/${e}/${t}/tree/${n.split("/").map(encodeURIComponent).join("/")}`,BT=()=>bt("/api/settings/hf"),IT=e=>Ot("/api/settings/hf",{token:e}),zT=()=>bt("/api/settings/k8s"),HT=e=>Ot("/api/settings/k8s",e),FT=()=>bt("/api/settings/modal"),PT=()=>Ot("/api/settings/modal/provision"),UT=()=>bt("/api/settings/env").then(e=>e.vars),VS=(e,t)=>Ot("/api/settings/env",{key:e,value:t}).then(n=>n.vars),$T=e=>fetch(`/api/settings/env/${encodeURIComponent(e)}`,{method:"DELETE"}).then(t=>is(t)).then(t=>t.vars),YS=()=>bt("/api/settings/data-dir"),GT=e=>Ot("/api/settings/data-dir/validate",{path:e}),qT=e=>Ot("/api/settings/data-dir",{path:e}),VT=e=>Ot("/api/settings/data-dir/move",{path:e}),YT=()=>bt("/api/settings/ssh").then(e=>e.hosts),WT=e=>Ot("/api/settings/ssh/preflight",{host:e}),XT=()=>bt("/api/settings/slurm"),KT=e=>Ot("/api/settings/slurm",e),ZT=e=>Ot("/api/settings/slurm/preflight",{host:e}),Iy=e=>bt(`/api/projects/${e}/files`),QT=(e,t)=>bt(`/api/projects/${e}/files/report?path=${encodeURIComponent(t)}`),JT=(e,t)=>fetch(`/api/projects/${e}/files?path=${encodeURIComponent(t)}`,{method:"DELETE"}).then(n=>is(n)),Tp=(e,t)=>`/api/projects/${e}/files/file?path=${encodeURIComponent(t)}`,WS=()=>bt("/api/settings/git"),eN=e=>Ot("/api/settings/git",e),tN=e=>Ot("/api/settings/git/token",{token:e}),nN=()=>fetch("/api/settings/git/token",{method:"DELETE"}).then(e=>is(e)),iN=()=>bt("/api/settings/telemetry"),rN=e=>Ot("/api/settings/telemetry",{enabled:e}),sN=e=>Ot("/api/settings/telemetry/consent",{enabled:e}),Cg=(e=!1)=>bt(`/api/harnesses${e?"?refresh=1":""}`).then(t=>t.harnesses),aN=()=>bt("/api/skills").then(e=>e.skills);function bu(e){const t=(e.split("/").pop()??e).replace(/^~/,"").replace(/^claude-/,""),n=[],r=[];for(const a of t.split("-"))/^\d+(\.\d+)?$/.test(a)?r.push(a):(r.length&&n.push(r.splice(0).join(".")),n.push(a==="gpt"?"GPT":a.charAt(0).toUpperCase()+a.slice(1)));return r.length&&n.push(r.join(".")),n.join(" ")}const oN=e=>bt(`/api/chat/sessions?projectId=${encodeURIComponent(e)}`).then(t=>t.sessions),lN=(e,t,n={})=>Ot("/api/chat/sessions",{projectId:e,harness:t,...n}).then(r=>r.session),cN=e=>fetch(`/api/chat/sessions/${e}`,{method:"DELETE"}).then(t=>is(t)),uN=(e,t)=>$S(`/api/chat/sessions/${e}`,{archived:t}).then(n=>n.session),hN=(e,t)=>$S(`/api/chat/sessions/${e}`,{title:t}).then(n=>n.session),fN=e=>bt(`/api/chat/sessions/${e}/messages`).then(t=>t.messages),dN=e=>`/api/chat/attachments/${encodeURIComponent(e)}`,pN=(e,t,n={},r)=>Ot(`/api/chat/sessions/${e}/message`,{text:t,model:n.model,permissionMode:n.permissionMode,reasoningLevel:n.reasoningLevel,images:r}),gN=e=>Ot(`/api/chat/sessions/${e}/interrupt`),mN=(e,t)=>Ot(`/api/chat/sessions/${e}/respond`,t);function ga(e){const t=Math.max(0,Math.floor((Date.now()-e)/1e3));if(t<60)return`${t}s ago`;const n=Math.floor(t/60);if(n<60)return`${n}m ago`;const r=Math.floor(n/60);return r<24?`${r}h ago`:`${Math.floor(r/24)}d ago`}function zy(e){const t=Math.max(0,Math.floor(e/1e3));if(t<60)return`${t}s`;const n=Math.floor(t/60);if(n<60)return`${n}m`;const r=Math.floor(n/60);return r<24?`${r}h ${n%60}m`:`${Math.floor(r/24)}d ${r%24}h`}function Bo(e){const t=["B","KB","MB","GB","TB"];let n=e,r=0;for(;n>=1024&&r10?`${e.slice(0,10)}…`:e}function XS(e){return e?typeof e.kind=="string"?e.kind:typeof e.type=="string"?e.type:"":""}function KS(e){return e?typeof e.flavor=="string"&&e.flavor?e.flavor:typeof e.manifest=="string"&&e.manifest?e.manifest:typeof e.namespace=="string"&&e.namespace?e.namespace:"":""}const ou=new Map;function _N(e,t){let n=ou.get(e);return n||(n=new Set,ou.set(e,n)),n.add(t),()=>{n.delete(t),n.size===0&&ou.delete(e)}}function vN(e){var t;(t=ou.get(e.runId))==null||t.forEach(n=>n(e))}const Dp=new Set;function yN(e){return Dp.add(e),()=>{Dp.delete(e)}}function Bc(e){Dp.forEach(t=>t(e))}const Rp=new Set;function bN(e){return Rp.add(e),()=>{Rp.delete(e)}}function Gd(e){Rp.forEach(t=>t(e))}function SN(e){const t=V.useRef(e);t.current=e,V.useEffect(()=>{const n=new EventSource("/api/events"),r=a=>{try{return JSON.parse(a.data)}catch{return null}};return n.addEventListener("run.updated",a=>{const l=r(a);l!=null&&l.run&&t.current.onRun(l.run)}),n.addEventListener("experiment.updated",a=>{const l=r(a);l!=null&&l.experiment&&t.current.onExperiment(l.experiment)}),n.addEventListener("project.updated",a=>{const l=r(a);l!=null&&l.project&&t.current.onProject(l.project)}),n.addEventListener("files.updated",a=>{var u,o;const l=r(a);l!=null&&l.projectId&&((o=(u=t.current).onFiles)==null||o.call(u,l.projectId))}),n.addEventListener("run.log",a=>{const l=r(a);l!=null&&l.runId&&vN(l)}),n.addEventListener("chat.session",a=>{const l=r(a);l!=null&&l.session&&Bc({type:"session",session:l.session})}),n.addEventListener("chat.session.deleted",a=>{const l=r(a);l!=null&&l.sessionId&&Bc({type:"sessionDeleted",sessionId:l.sessionId})}),n.addEventListener("chat.message",a=>{const l=r(a);l!=null&&l.message&&Bc({type:"message",sessionId:l.sessionId,message:l.message})}),n.addEventListener("chat.busy",a=>{const l=r(a);l!=null&&l.sessionId&&Bc({type:"busy",sessionId:l.sessionId,busy:l.busy})}),n.addEventListener("datadir.move.progress",a=>{const l=r(a);l&&Gd({type:"progress",...l})}),n.addEventListener("datadir.move.done",a=>{const l=r(a);l&&Gd({type:"done",path:l.path,oldPathLeft:l.oldPathLeft})}),n.addEventListener("datadir.move.error",a=>{const l=r(a);l&&Gd({type:"error",error:l.error})}),()=>n.close()},[])}function Hy(e){const t=[],n=String(e||"");let r=n.indexOf(","),a=0,l=!1;for(;!l;){r===-1&&(r=n.length,l=!0);const u=n.slice(a,r).trim();(u||!l)&&t.push(u),a=r+1,r=n.indexOf(",",a)}return t}function xN(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const wN=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,CN=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,EN={};function Fy(e,t){return(EN.jsx?CN:wN).test(e)}const kN=/[ \t\n\f\r]/g;function AN(e){return typeof e=="object"?e.type==="text"?Py(e.value):!1:Py(e)}function Py(e){return e.replace(kN,"")===""}class nl{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}nl.prototype.normal={};nl.prototype.property={};nl.prototype.space=void 0;function ZS(e,t){const n={},r={};for(const a of e)Object.assign(n,a.property),Object.assign(r,a.normal);return new nl(n,r,t)}function Io(e){return e.toLowerCase()}class vn{constructor(t,n){this.attribute=n,this.property=t}}vn.prototype.attribute="";vn.prototype.booleanish=!1;vn.prototype.boolean=!1;vn.prototype.commaOrSpaceSeparated=!1;vn.prototype.commaSeparated=!1;vn.prototype.defined=!1;vn.prototype.mustUseProperty=!1;vn.prototype.number=!1;vn.prototype.overloadedBoolean=!1;vn.prototype.property="";vn.prototype.spaceSeparated=!1;vn.prototype.space=void 0;let TN=0;const ze=rs(),Ft=rs(),Mp=rs(),xe=rs(),vt=rs(),Wr=rs(),An=rs();function rs(){return 2**++TN}const Lp=Object.freeze(Object.defineProperty({__proto__:null,boolean:ze,booleanish:Ft,commaOrSpaceSeparated:An,commaSeparated:Wr,number:xe,overloadedBoolean:Mp,spaceSeparated:vt},Symbol.toStringTag,{value:"Module"})),qd=Object.keys(Lp);class Eg extends vn{constructor(t,n,r,a){let l=-1;if(super(t,n),Uy(this,"space",a),typeof r=="number")for(;++l4&&n.slice(0,4)==="data"&&LN.test(t)){if(t.charAt(4)==="-"){const l=t.slice(5).replace($y,jN);r="data"+l.charAt(0).toUpperCase()+l.slice(1)}else{const l=t.slice(4);if(!$y.test(l)){let u=l.replace(MN,ON);u.charAt(0)!=="-"&&(u="-"+u),t="data"+u}}a=Eg}return new a(r,t)}function ON(e){return"-"+e.toLowerCase()}function jN(e){return e.charAt(1).toUpperCase()}const sx=ZS([QS,NN,tx,nx,ix],"html"),$u=ZS([QS,DN,tx,nx,ix],"svg");function Gy(e){const t=String(e||"").trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function BN(e){return e.join(" ").trim()}var Vs={},Vd,qy;function IN(){if(qy)return Vd;qy=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,a=/^:\s*/,l=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,u=/^[;\s]*/,o=/^\s+|\s+$/g,c=` +`,f="/",p="*",d="",_="comment",v="declaration";function w(b,S){if(typeof b!="string")throw new TypeError("First argument must be a string");if(!b)return[];S=S||{};var x=1,y=1;function k(z){var q=z.match(t);q&&(x+=q.length);var G=z.lastIndexOf(c);y=~G?z.length-G:y+z.length}function D(){var z={line:x,column:y};return function(q){return q.position=new T(z),M(),q}}function T(z){this.start=z,this.end={line:x,column:y},this.source=S.source}T.prototype.content=b;function R(z){var q=new Error(S.source+":"+x+":"+y+": "+z);if(q.reason=z,q.filename=S.source,q.line=x,q.column=y,q.source=b,!S.silent)throw q}function N(z){var q=z.exec(b);if(q){var G=q[0];return k(G),b=b.slice(G.length),q}}function M(){N(n)}function B(z){var q;for(z=z||[];q=H();)q!==!1&&z.push(q);return z}function H(){var z=D();if(!(f!=b.charAt(0)||p!=b.charAt(1))){for(var q=2;d!=b.charAt(q)&&(p!=b.charAt(q)||f!=b.charAt(q+1));)++q;if(q+=2,d===b.charAt(q-1))return R("End of comment missing");var G=b.slice(2,q-2);return y+=2,k(G),b=b.slice(q),y+=2,z({type:_,comment:G})}}function Y(){var z=D(),q=N(r);if(q){if(H(),!N(a))return R("property missing ':'");var G=N(l),X=z({type:v,property:C(q[0].replace(e,d)),value:G?C(G[0].replace(e,d)):d});return N(u),X}}function F(){var z=[];B(z);for(var q;q=Y();)q!==!1&&(z.push(q),B(z));return z}return M(),F()}function C(b){return b?b.replace(o,d):d}return Vd=w,Vd}var Vy;function zN(){if(Vy)return Vs;Vy=1;var e=Vs&&Vs.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Vs,"__esModule",{value:!0}),Vs.default=n;const t=e(IN());function n(r,a){let l=null;if(!r||typeof r!="string")return l;const u=(0,t.default)(r),o=typeof a=="function";return u.forEach(c=>{if(c.type!=="declaration")return;const{property:f,value:p}=c;o?a(f,p,c):p&&(l=l||{},l[f]=p)}),l}return Vs}var yo={},Yy;function HN(){if(Yy)return yo;Yy=1,Object.defineProperty(yo,"__esModule",{value:!0}),yo.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,l=function(f){return!f||n.test(f)||e.test(f)},u=function(f,p){return p.toUpperCase()},o=function(f,p){return"".concat(p,"-")},c=function(f,p){return p===void 0&&(p={}),l(f)?f:(f=f.toLowerCase(),p.reactCompat?f=f.replace(a,o):f=f.replace(r,o),f.replace(t,u))};return yo.camelCase=c,yo}var bo,Wy;function FN(){if(Wy)return bo;Wy=1;var e=bo&&bo.__importDefault||function(a){return a&&a.__esModule?a:{default:a}},t=e(zN()),n=HN();function r(a,l){var u={};return!a||typeof a!="string"||(0,t.default)(a,function(o,c){o&&c&&(u[(0,n.camelCase)(o,l)]=c)}),u}return r.default=r,bo=r,bo}var PN=FN();const UN=Hu(PN),ax=ox("end"),kg=ox("start");function ox(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function $N(e){const t=kg(e),n=ax(e);if(t&&n)return{start:t,end:n}}function No(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Xy(e.position):"start"in e||"end"in e?Xy(e):"line"in e||"column"in e?Op(e):""}function Op(e){return Ky(e&&e.line)+":"+Ky(e&&e.column)}function Xy(e){return Op(e&&e.start)+"-"+Op(e&&e.end)}function Ky(e){return e&&typeof e=="number"?e:1}class tn extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let a="",l={},u=!1;if(n&&("line"in n&&"column"in n?l={place:n}:"start"in n&&"end"in n?l={place:n}:"type"in n?l={ancestors:[n],place:n.position}:l={...n}),typeof t=="string"?a=t:!l.cause&&t&&(u=!0,a=t.message,l.cause=t),!l.ruleId&&!l.source&&typeof r=="string"){const c=r.indexOf(":");c===-1?l.ruleId=r:(l.source=r.slice(0,c),l.ruleId=r.slice(c+1))}if(!l.place&&l.ancestors&&l.ancestors){const c=l.ancestors[l.ancestors.length-1];c&&(l.place=c.position)}const o=l.place&&"start"in l.place?l.place.start:l.place;this.ancestors=l.ancestors||void 0,this.cause=l.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file="",this.message=a,this.line=o?o.line:void 0,this.name=No(l.place)||"1:1",this.place=l.place||void 0,this.reason=this.message,this.ruleId=l.ruleId||void 0,this.source=l.source||void 0,this.stack=u&&l.cause&&typeof l.cause.stack=="string"?l.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}tn.prototype.file="";tn.prototype.name="";tn.prototype.reason="";tn.prototype.message="";tn.prototype.stack="";tn.prototype.column=void 0;tn.prototype.line=void 0;tn.prototype.ancestors=void 0;tn.prototype.cause=void 0;tn.prototype.fatal=void 0;tn.prototype.place=void 0;tn.prototype.ruleId=void 0;tn.prototype.source=void 0;const Ag={}.hasOwnProperty,GN=new Map,qN=/[A-Z]/g,VN=new Set(["table","tbody","thead","tfoot","tr"]),YN=new Set(["td","th"]),lx="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function WN(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=n3(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=t3(n,t.jsx,t.jsxs)}const a={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?$u:sx,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},l=cx(a,e,void 0);return l&&typeof l!="string"?l:a.create(e,a.Fragment,{children:l||void 0},void 0)}function cx(e,t,n){if(t.type==="element")return XN(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return KN(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return QN(e,t,n);if(t.type==="mdxjsEsm")return ZN(e,t);if(t.type==="root")return JN(e,t,n);if(t.type==="text")return e3(e,t)}function XN(e,t,n){const r=e.schema;let a=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(a=$u,e.schema=a),e.ancestors.push(t);const l=hx(e,t.tagName,!1),u=i3(e,t);let o=Ng(e,t);return VN.has(t.tagName)&&(o=o.filter(function(c){return typeof c=="string"?!AN(c):!0})),ux(e,u,l,t),Tg(u,o),e.ancestors.pop(),e.schema=r,e.create(t,l,u,n)}function KN(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}zo(e,t.position)}function ZN(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);zo(e,t.position)}function QN(e,t,n){const r=e.schema;let a=r;t.name==="svg"&&r.space==="html"&&(a=$u,e.schema=a),e.ancestors.push(t);const l=t.name===null?e.Fragment:hx(e,t.name,!0),u=r3(e,t),o=Ng(e,t);return ux(e,u,l,t),Tg(u,o),e.ancestors.pop(),e.schema=r,e.create(t,l,u,n)}function JN(e,t,n){const r={};return Tg(r,Ng(e,t)),e.create(t,e.Fragment,r,n)}function e3(e,t){return t.value}function ux(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Tg(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function t3(e,t,n){return r;function r(a,l,u,o){const f=Array.isArray(u.children)?n:t;return o?f(l,u,o):f(l,u)}}function n3(e,t){return n;function n(r,a,l,u){const o=Array.isArray(l.children),c=kg(r);return t(a,l,u,o,{columnNumber:c?c.column-1:void 0,fileName:e,lineNumber:c?c.line:void 0},void 0)}}function i3(e,t){const n={};let r,a;for(a in t.properties)if(a!=="children"&&Ag.call(t.properties,a)){const l=s3(e,a,t.properties[a]);if(l){const[u,o]=l;e.tableCellAlignToStyle&&u==="align"&&typeof o=="string"&&YN.has(t.tagName)?r=o:n[u]=o}}if(r){const l=n.style||(n.style={});l[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function r3(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const l=r.data.estree.body[0];l.type;const u=l.expression;u.type;const o=u.properties[0];o.type,Object.assign(n,e.evaluater.evaluateExpression(o.argument))}else zo(e,t.position);else{const a=r.name;let l;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const o=r.value.data.estree.body[0];o.type,l=e.evaluater.evaluateExpression(o.expression)}else zo(e,t.position);else l=r.value===null?!0:r.value;n[a]=l}return n}function Ng(e,t){const n=[];let r=-1;const a=e.passKeys?new Map:GN;for(;++ra?0:a+t:t=t>a?a:t,n=n>0?n:0,r.length<1e4)u=Array.from(r),u.unshift(t,n),e.splice(...u);else for(n&&e.splice(t,n);l0?(Dn(e,e.length,0,t),e):t}const Jy={}.hasOwnProperty;function dx(e){const t={};let n=-1;for(;++n13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Qn(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const rn=xr(/[A-Za-z]/),en=xr(/[\dA-Za-z]/),p3=xr(/[#-'*+\--9=?A-Z^-~]/);function Su(e){return e!==null&&(e<32||e===127)}const jp=xr(/\d/),g3=xr(/[\dA-Fa-f]/),m3=xr(/[!-/:-@[-`{-~]/);function je(e){return e!==null&&e<-2}function yt(e){return e!==null&&(e<0||e===32)}function Ye(e){return e===-2||e===-1||e===32}const Gu=xr(new RegExp("\\p{P}|\\p{S}","u")),Zr=xr(/\s/);function xr(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function _a(e){const t=[];let n=-1,r=0,a=0;for(;++n55295&&l<57344){const o=e.charCodeAt(n+1);l<56320&&o>56319&&o<57344?(u=String.fromCharCode(l,o),a=1):u="�"}else u=String.fromCharCode(l);u&&(t.push(e.slice(r,n),encodeURIComponent(u)),r=n+a+1,u=""),a&&(n+=a,a=0)}return t.join("")+e.slice(r)}function tt(e,t,n,r){const a=r?r-1:Number.POSITIVE_INFINITY;let l=0;return u;function u(c){return Ye(c)?(e.enter(n),o(c)):t(c)}function o(c){return Ye(c)&&l++u))return;const R=t.events.length;let N=R,M,B;for(;N--;)if(t.events[N][0]==="exit"&&t.events[N][1].type==="chunkFlow"){if(M){B=t.events[N][1].end;break}M=!0}for(S(r),T=R;Ty;){const D=n[k];t.containerState=D[1],D[0].exit.call(t,e)}n.length=y}function x(){a.write([null]),l=void 0,a=void 0,t.containerState._closeFlow=void 0}}function S3(e,t,n){return tt(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function sa(e){if(e===null||yt(e)||Zr(e))return 1;if(Gu(e))return 2}function qu(e,t,n){const r=[];let a=-1;for(;++a1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const d={...e[r][1].end},_={...e[n][1].start};t1(d,-c),t1(_,c),u={type:c>1?"strongSequence":"emphasisSequence",start:d,end:{...e[r][1].end}},o={type:c>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:_},l={type:c>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},a={type:c>1?"strong":"emphasis",start:{...u.start},end:{...o.end}},e[r][1].end={...u.start},e[n][1].start={...o.end},f=[],e[r][1].end.offset-e[r][1].start.offset&&(f=$n(f,[["enter",e[r][1],t],["exit",e[r][1],t]])),f=$n(f,[["enter",a,t],["enter",u,t],["exit",u,t],["enter",l,t]]),f=$n(f,qu(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),f=$n(f,[["exit",l,t],["enter",o,t],["exit",o,t],["exit",a,t]]),e[n][1].end.offset-e[n][1].start.offset?(p=2,f=$n(f,[["enter",e[n][1],t],["exit",e[n][1],t]])):p=0,Dn(e,r-1,n-r+3,f),n=r+f.length-p-2;break}}for(n=-1;++n0&&Ye(T)?tt(e,x,"linePrefix",l+1)(T):x(T)}function x(T){return T===null||je(T)?e.check(n1,C,k)(T):(e.enter("codeFlowValue"),y(T))}function y(T){return T===null||je(T)?(e.exit("codeFlowValue"),x(T)):(e.consume(T),y)}function k(T){return e.exit("codeFenced"),t(T)}function D(T,R,N){let M=0;return B;function B(q){return T.enter("lineEnding"),T.consume(q),T.exit("lineEnding"),H}function H(q){return T.enter("codeFencedFence"),Ye(q)?tt(T,Y,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(q):Y(q)}function Y(q){return q===o?(T.enter("codeFencedFenceSequence"),F(q)):N(q)}function F(q){return q===o?(M++,T.consume(q),F):M>=u?(T.exit("codeFencedFenceSequence"),Ye(q)?tt(T,z,"whitespace")(q):z(q)):N(q)}function z(q){return q===null||je(q)?(T.exit("codeFencedFence"),R(q)):N(q)}}}function L3(e,t,n){const r=this;return a;function a(u){return u===null?n(u):(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),l)}function l(u){return r.parser.lazy[r.now().line]?n(u):t(u)}}const Wd={name:"codeIndented",tokenize:j3},O3={partial:!0,tokenize:B3};function j3(e,t,n){const r=this;return a;function a(f){return e.enter("codeIndented"),tt(e,l,"linePrefix",5)(f)}function l(f){const p=r.events[r.events.length-1];return p&&p[1].type==="linePrefix"&&p[2].sliceSerialize(p[1],!0).length>=4?u(f):n(f)}function u(f){return f===null?c(f):je(f)?e.attempt(O3,u,c)(f):(e.enter("codeFlowValue"),o(f))}function o(f){return f===null||je(f)?(e.exit("codeFlowValue"),u(f)):(e.consume(f),o)}function c(f){return e.exit("codeIndented"),t(f)}}function B3(e,t,n){const r=this;return a;function a(u){return r.parser.lazy[r.now().line]?n(u):je(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),a):tt(e,l,"linePrefix",5)(u)}function l(u){const o=r.events[r.events.length-1];return o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?t(u):je(u)?a(u):n(u)}}const I3={name:"codeText",previous:H3,resolve:z3,tokenize:F3};function z3(e){let t=e.length-4,n=3,r,a;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return tthis.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const a=n||0;this.setCursor(Math.trunc(t));const l=this.right.splice(this.right.length-a,Number.POSITIVE_INFINITY);return r&&So(this.left,r),l.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),So(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),So(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t=4?t(u):e.interrupt(r.parser.constructs.flow,n,t)(u)}}function yx(e,t,n,r,a,l,u,o,c){const f=c||Number.POSITIVE_INFINITY;let p=0;return d;function d(S){return S===60?(e.enter(r),e.enter(a),e.enter(l),e.consume(S),e.exit(l),_):S===null||S===32||S===41||Su(S)?n(S):(e.enter(r),e.enter(u),e.enter(o),e.enter("chunkString",{contentType:"string"}),C(S))}function _(S){return S===62?(e.enter(l),e.consume(S),e.exit(l),e.exit(a),e.exit(r),t):(e.enter(o),e.enter("chunkString",{contentType:"string"}),v(S))}function v(S){return S===62?(e.exit("chunkString"),e.exit(o),_(S)):S===null||S===60||je(S)?n(S):(e.consume(S),S===92?w:v)}function w(S){return S===60||S===62||S===92?(e.consume(S),v):v(S)}function C(S){return!p&&(S===null||S===41||yt(S))?(e.exit("chunkString"),e.exit(o),e.exit(u),e.exit(r),t(S)):p999||v===null||v===91||v===93&&!c||v===94&&!o&&"_hiddenFootnoteSupport"in u.parser.constructs?n(v):v===93?(e.exit(l),e.enter(a),e.consume(v),e.exit(a),e.exit(r),t):je(v)?(e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),p):(e.enter("chunkString",{contentType:"string"}),d(v))}function d(v){return v===null||v===91||v===93||je(v)||o++>999?(e.exit("chunkString"),p(v)):(e.consume(v),c||(c=!Ye(v)),v===92?_:d)}function _(v){return v===91||v===92||v===93?(e.consume(v),o++,d):d(v)}}function Sx(e,t,n,r,a,l){let u;return o;function o(_){return _===34||_===39||_===40?(e.enter(r),e.enter(a),e.consume(_),e.exit(a),u=_===40?41:_,c):n(_)}function c(_){return _===u?(e.enter(a),e.consume(_),e.exit(a),e.exit(r),t):(e.enter(l),f(_))}function f(_){return _===u?(e.exit(l),c(u)):_===null?n(_):je(_)?(e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),tt(e,f,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),p(_))}function p(_){return _===u||_===null||je(_)?(e.exit("chunkString"),f(_)):(e.consume(_),_===92?d:p)}function d(_){return _===u||_===92?(e.consume(_),p):p(_)}}function Do(e,t){let n;return r;function r(a){return je(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,r):Ye(a)?tt(e,r,n?"linePrefix":"lineSuffix")(a):t(a)}}const W3={name:"definition",tokenize:K3},X3={partial:!0,tokenize:Z3};function K3(e,t,n){const r=this;let a;return l;function l(v){return e.enter("definition"),u(v)}function u(v){return bx.call(r,e,o,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(v)}function o(v){return a=Qn(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),v===58?(e.enter("definitionMarker"),e.consume(v),e.exit("definitionMarker"),c):n(v)}function c(v){return yt(v)?Do(e,f)(v):f(v)}function f(v){return yx(e,p,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(v)}function p(v){return e.attempt(X3,d,d)(v)}function d(v){return Ye(v)?tt(e,_,"whitespace")(v):_(v)}function _(v){return v===null||je(v)?(e.exit("definition"),r.parser.defined.push(a),t(v)):n(v)}}function Z3(e,t,n){return r;function r(o){return yt(o)?Do(e,a)(o):n(o)}function a(o){return Sx(e,l,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(o)}function l(o){return Ye(o)?tt(e,u,"whitespace")(o):u(o)}function u(o){return o===null||je(o)?t(o):n(o)}}const Q3={name:"hardBreakEscape",tokenize:J3};function J3(e,t,n){return r;function r(l){return e.enter("hardBreakEscape"),e.consume(l),a}function a(l){return je(l)?(e.exit("hardBreakEscape"),t(l)):n(l)}}const e5={name:"headingAtx",resolve:t5,tokenize:n5};function t5(e,t){let n=e.length-2,r=3,a,l;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(a={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},l={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},Dn(e,r,n-r+1,[["enter",a,t],["enter",l,t],["exit",l,t],["exit",a,t]])),e}function n5(e,t,n){let r=0;return a;function a(p){return e.enter("atxHeading"),l(p)}function l(p){return e.enter("atxHeadingSequence"),u(p)}function u(p){return p===35&&r++<6?(e.consume(p),u):p===null||yt(p)?(e.exit("atxHeadingSequence"),o(p)):n(p)}function o(p){return p===35?(e.enter("atxHeadingSequence"),c(p)):p===null||je(p)?(e.exit("atxHeading"),t(p)):Ye(p)?tt(e,o,"whitespace")(p):(e.enter("atxHeadingText"),f(p))}function c(p){return p===35?(e.consume(p),c):(e.exit("atxHeadingSequence"),o(p))}function f(p){return p===null||p===35||yt(p)?(e.exit("atxHeadingText"),o(p)):(e.consume(p),f)}}const i5=["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"],r1=["pre","script","style","textarea"],r5={concrete:!0,name:"htmlFlow",resolveTo:o5,tokenize:l5},s5={partial:!0,tokenize:u5},a5={partial:!0,tokenize:c5};function o5(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function l5(e,t,n){const r=this;let a,l,u,o,c;return f;function f(U){return p(U)}function p(U){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(U),d}function d(U){return U===33?(e.consume(U),_):U===47?(e.consume(U),l=!0,C):U===63?(e.consume(U),a=3,r.interrupt?t:L):rn(U)?(e.consume(U),u=String.fromCharCode(U),b):n(U)}function _(U){return U===45?(e.consume(U),a=2,v):U===91?(e.consume(U),a=5,o=0,w):rn(U)?(e.consume(U),a=4,r.interrupt?t:L):n(U)}function v(U){return U===45?(e.consume(U),r.interrupt?t:L):n(U)}function w(U){const Q="CDATA[";return U===Q.charCodeAt(o++)?(e.consume(U),o===Q.length?r.interrupt?t:Y:w):n(U)}function C(U){return rn(U)?(e.consume(U),u=String.fromCharCode(U),b):n(U)}function b(U){if(U===null||U===47||U===62||yt(U)){const Q=U===47,re=u.toLowerCase();return!Q&&!l&&r1.includes(re)?(a=1,r.interrupt?t(U):Y(U)):i5.includes(u.toLowerCase())?(a=6,Q?(e.consume(U),S):r.interrupt?t(U):Y(U)):(a=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(U):l?x(U):y(U))}return U===45||en(U)?(e.consume(U),u+=String.fromCharCode(U),b):n(U)}function S(U){return U===62?(e.consume(U),r.interrupt?t:Y):n(U)}function x(U){return Ye(U)?(e.consume(U),x):B(U)}function y(U){return U===47?(e.consume(U),B):U===58||U===95||rn(U)?(e.consume(U),k):Ye(U)?(e.consume(U),y):B(U)}function k(U){return U===45||U===46||U===58||U===95||en(U)?(e.consume(U),k):D(U)}function D(U){return U===61?(e.consume(U),T):Ye(U)?(e.consume(U),D):y(U)}function T(U){return U===null||U===60||U===61||U===62||U===96?n(U):U===34||U===39?(e.consume(U),c=U,R):Ye(U)?(e.consume(U),T):N(U)}function R(U){return U===c?(e.consume(U),c=null,M):U===null||je(U)?n(U):(e.consume(U),R)}function N(U){return U===null||U===34||U===39||U===47||U===60||U===61||U===62||U===96||yt(U)?D(U):(e.consume(U),N)}function M(U){return U===47||U===62||Ye(U)?y(U):n(U)}function B(U){return U===62?(e.consume(U),H):n(U)}function H(U){return U===null||je(U)?Y(U):Ye(U)?(e.consume(U),H):n(U)}function Y(U){return U===45&&a===2?(e.consume(U),G):U===60&&a===1?(e.consume(U),X):U===62&&a===4?(e.consume(U),j):U===63&&a===3?(e.consume(U),L):U===93&&a===5?(e.consume(U),O):je(U)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(s5,$,F)(U)):U===null||je(U)?(e.exit("htmlFlowData"),F(U)):(e.consume(U),Y)}function F(U){return e.check(a5,z,$)(U)}function z(U){return e.enter("lineEnding"),e.consume(U),e.exit("lineEnding"),q}function q(U){return U===null||je(U)?F(U):(e.enter("htmlFlowData"),Y(U))}function G(U){return U===45?(e.consume(U),L):Y(U)}function X(U){return U===47?(e.consume(U),u="",K):Y(U)}function K(U){if(U===62){const Q=u.toLowerCase();return r1.includes(Q)?(e.consume(U),j):Y(U)}return rn(U)&&u.length<8?(e.consume(U),u+=String.fromCharCode(U),K):Y(U)}function O(U){return U===93?(e.consume(U),L):Y(U)}function L(U){return U===62?(e.consume(U),j):U===45&&a===2?(e.consume(U),L):Y(U)}function j(U){return U===null||je(U)?(e.exit("htmlFlowData"),$(U)):(e.consume(U),j)}function $(U){return e.exit("htmlFlow"),t(U)}}function c5(e,t,n){const r=this;return a;function a(u){return je(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),l):n(u)}function l(u){return r.parser.lazy[r.now().line]?n(u):t(u)}}function u5(e,t,n){return r;function r(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(il,t,n)}}const h5={name:"htmlText",tokenize:f5};function f5(e,t,n){const r=this;let a,l,u;return o;function o(L){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(L),c}function c(L){return L===33?(e.consume(L),f):L===47?(e.consume(L),D):L===63?(e.consume(L),y):rn(L)?(e.consume(L),N):n(L)}function f(L){return L===45?(e.consume(L),p):L===91?(e.consume(L),l=0,w):rn(L)?(e.consume(L),x):n(L)}function p(L){return L===45?(e.consume(L),v):n(L)}function d(L){return L===null?n(L):L===45?(e.consume(L),_):je(L)?(u=d,X(L)):(e.consume(L),d)}function _(L){return L===45?(e.consume(L),v):d(L)}function v(L){return L===62?G(L):L===45?_(L):d(L)}function w(L){const j="CDATA[";return L===j.charCodeAt(l++)?(e.consume(L),l===j.length?C:w):n(L)}function C(L){return L===null?n(L):L===93?(e.consume(L),b):je(L)?(u=C,X(L)):(e.consume(L),C)}function b(L){return L===93?(e.consume(L),S):C(L)}function S(L){return L===62?G(L):L===93?(e.consume(L),S):C(L)}function x(L){return L===null||L===62?G(L):je(L)?(u=x,X(L)):(e.consume(L),x)}function y(L){return L===null?n(L):L===63?(e.consume(L),k):je(L)?(u=y,X(L)):(e.consume(L),y)}function k(L){return L===62?G(L):y(L)}function D(L){return rn(L)?(e.consume(L),T):n(L)}function T(L){return L===45||en(L)?(e.consume(L),T):R(L)}function R(L){return je(L)?(u=R,X(L)):Ye(L)?(e.consume(L),R):G(L)}function N(L){return L===45||en(L)?(e.consume(L),N):L===47||L===62||yt(L)?M(L):n(L)}function M(L){return L===47?(e.consume(L),G):L===58||L===95||rn(L)?(e.consume(L),B):je(L)?(u=M,X(L)):Ye(L)?(e.consume(L),M):G(L)}function B(L){return L===45||L===46||L===58||L===95||en(L)?(e.consume(L),B):H(L)}function H(L){return L===61?(e.consume(L),Y):je(L)?(u=H,X(L)):Ye(L)?(e.consume(L),H):M(L)}function Y(L){return L===null||L===60||L===61||L===62||L===96?n(L):L===34||L===39?(e.consume(L),a=L,F):je(L)?(u=Y,X(L)):Ye(L)?(e.consume(L),Y):(e.consume(L),z)}function F(L){return L===a?(e.consume(L),a=void 0,q):L===null?n(L):je(L)?(u=F,X(L)):(e.consume(L),F)}function z(L){return L===null||L===34||L===39||L===60||L===61||L===96?n(L):L===47||L===62||yt(L)?M(L):(e.consume(L),z)}function q(L){return L===47||L===62||yt(L)?M(L):n(L)}function G(L){return L===62?(e.consume(L),e.exit("htmlTextData"),e.exit("htmlText"),t):n(L)}function X(L){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(L),e.exit("lineEnding"),K}function K(L){return Ye(L)?tt(e,O,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):O(L)}function O(L){return e.enter("htmlTextData"),u(L)}}const Rg={name:"labelEnd",resolveAll:m5,resolveTo:_5,tokenize:v5},d5={tokenize:y5},p5={tokenize:b5},g5={tokenize:S5};function m5(e){let t=-1;const n=[];for(;++t=3&&(f===null||je(f))?(e.exit("thematicBreak"),t(f)):n(f)}function c(f){return f===a?(e.consume(f),r++,c):(e.exit("thematicBreakSequence"),Ye(f)?tt(e,o,"whitespace")(f):o(f))}}const pn={continuation:{tokenize:R5},exit:L5,name:"list",tokenize:D5},T5={partial:!0,tokenize:O5},N5={partial:!0,tokenize:M5};function D5(e,t,n){const r=this,a=r.events[r.events.length-1];let l=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[1],!0).length:0,u=0;return o;function o(v){const w=r.containerState.type||(v===42||v===43||v===45?"listUnordered":"listOrdered");if(w==="listUnordered"?!r.containerState.marker||v===r.containerState.marker:jp(v)){if(r.containerState.type||(r.containerState.type=w,e.enter(w,{_container:!0})),w==="listUnordered")return e.enter("listItemPrefix"),v===42||v===45?e.check(lu,n,f)(v):f(v);if(!r.interrupt||v===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),c(v)}return n(v)}function c(v){return jp(v)&&++u<10?(e.consume(v),c):(!r.interrupt||u<2)&&(r.containerState.marker?v===r.containerState.marker:v===41||v===46)?(e.exit("listItemValue"),f(v)):n(v)}function f(v){return e.enter("listItemMarker"),e.consume(v),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||v,e.check(il,r.interrupt?n:p,e.attempt(T5,_,d))}function p(v){return r.containerState.initialBlankLine=!0,l++,_(v)}function d(v){return Ye(v)?(e.enter("listItemPrefixWhitespace"),e.consume(v),e.exit("listItemPrefixWhitespace"),_):n(v)}function _(v){return r.containerState.size=l+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(v)}}function R5(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(il,a,l);function a(o){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,tt(e,t,"listItemIndent",r.containerState.size+1)(o)}function l(o){return r.containerState.furtherBlankLines||!Ye(o)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,u(o)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(N5,t,u)(o))}function u(o){return r.containerState._closeFlow=!0,r.interrupt=void 0,tt(e,e.attempt(pn,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}function M5(e,t,n){const r=this;return tt(e,a,"listItemIndent",r.containerState.size+1);function a(l){const u=r.events[r.events.length-1];return u&&u[1].type==="listItemIndent"&&u[2].sliceSerialize(u[1],!0).length===r.containerState.size?t(l):n(l)}}function L5(e){e.exit(this.containerState.type)}function O5(e,t,n){const r=this;return tt(e,a,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function a(l){const u=r.events[r.events.length-1];return!Ye(l)&&u&&u[1].type==="listItemPrefixWhitespace"?t(l):n(l)}}const s1={name:"setextUnderline",resolveTo:j5,tokenize:B5};function j5(e,t){let n=e.length,r,a,l;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(a=n)}else e[n][1].type==="content"&&e.splice(n,1),!l&&e[n][1].type==="definition"&&(l=n);const u={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[a][1].type="setextHeadingText",l?(e.splice(a,0,["enter",u,t]),e.splice(l+1,0,["exit",e[r][1],t]),e[r][1].end={...e[l][1].end}):e[r][1]=u,e.push(["exit",u,t]),e}function B5(e,t,n){const r=this;let a;return l;function l(f){let p=r.events.length,d;for(;p--;)if(r.events[p][1].type!=="lineEnding"&&r.events[p][1].type!=="linePrefix"&&r.events[p][1].type!=="content"){d=r.events[p][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||d)?(e.enter("setextHeadingLine"),a=f,u(f)):n(f)}function u(f){return e.enter("setextHeadingLineSequence"),o(f)}function o(f){return f===a?(e.consume(f),o):(e.exit("setextHeadingLineSequence"),Ye(f)?tt(e,c,"lineSuffix")(f):c(f))}function c(f){return f===null||je(f)?(e.exit("setextHeadingLine"),t(f)):n(f)}}const I5={tokenize:z5};function z5(e){const t=this,n=e.attempt(il,r,e.attempt(this.parser.constructs.flowInitial,a,tt(e,e.attempt(this.parser.constructs.flow,a,e.attempt($3,a)),"linePrefix")));return n;function r(l){if(l===null){e.consume(l);return}return e.enter("lineEndingBlank"),e.consume(l),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function a(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const H5={resolveAll:wx()},F5=xx("string"),P5=xx("text");function xx(e){return{resolveAll:wx(e==="text"?U5:void 0),tokenize:t};function t(n){const r=this,a=this.parser.constructs[e],l=n.attempt(a,u,o);return u;function u(p){return f(p)?l(p):o(p)}function o(p){if(p===null){n.consume(p);return}return n.enter("data"),n.consume(p),c}function c(p){return f(p)?(n.exit("data"),l(p)):(n.consume(p),c)}function f(p){if(p===null)return!0;const d=a[p];let _=-1;if(d)for(;++_-1){const o=u[0];typeof o=="string"?u[0]=o.slice(r):u.shift()}l>0&&u.push(e[a].slice(0,l))}return u}function t4(e,t){let n=-1;const r=[];let a;for(;++n0){const Be=me.tokenStack[me.tokenStack.length-1];(Be[1]||o1).call(me,void 0,Be[0])}for(ee.position={start:mr(fe.length>0?fe[0][1].start:{line:1,column:1,offset:0}),end:mr(fe.length>0?fe[fe.length-2][1].end:{line:1,column:1,offset:0})},Ee=-1;++Ee0&&(r.className=["language-"+a[0]]);let l={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(l.data={meta:t.meta}),e.patch(t,l),l=e.applyData(t,l),l={type:"element",tagName:"pre",properties:{},children:[l]},e.patch(t,l),l}function pD(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function gD(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function mD(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),a=va(r.toLowerCase()),l=e.footnoteOrder.indexOf(r);let u,o=e.footnoteCounts.get(r);o===void 0?(o=0,e.footnoteOrder.push(r),u=e.footnoteOrder.length):u=l+1,o+=1,e.footnoteCounts.set(r,o);const c={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+a,id:n+"fnref-"+a+(o>1?"-"+o:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(u)}]};e.patch(t,c);const f={type:"element",tagName:"sup",properties:{},children:[c]};return e.patch(t,f),e.applyData(t,f)}function _D(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function vD(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function kx(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const a=e.all(t),l=a[0];l&&l.type==="text"?l.value="["+l.value:a.unshift({type:"text",value:"["});const u=a[a.length-1];return u&&u.type==="text"?u.value+=r:a.push({type:"text",value:r}),a}function yD(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return kx(e,t);const a={src:va(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(a.title=r.title);const l={type:"element",tagName:"img",properties:a,children:[]};return e.patch(t,l),e.applyData(t,l)}function bD(e,t){const n={src:va(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function SD(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function xD(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return kx(e,t);const a={href:va(r.url||"")};r.title!==null&&r.title!==void 0&&(a.title=r.title);const l={type:"element",tagName:"a",properties:a,children:e.all(t)};return e.patch(t,l),e.applyData(t,l)}function wD(e,t){const n={href:va(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function CD(e,t,n){const r=e.all(t),a=n?ED(n):Ax(t),l={},u=[];if(typeof t.checked=="boolean"){const p=r[0];let d;p&&p.type==="element"&&p.tagName==="p"?d=p:(d={type:"element",tagName:"p",properties:{},children:[]},r.unshift(d)),d.children.length>0&&d.children.unshift({type:"text",value:" "}),d.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),l.className=["task-list-item"]}let o=-1;for(;++o0){const Qe=be.tokenStack[be.tokenStack.length-1];(Qe[1]||o1).call(be,void 0,Qe[0])}for(fe.position={start:mr(ne.length>0?ne[0][1].start:{line:1,column:1,offset:0}),end:mr(ne.length>0?ne[ne.length-2][1].end:{line:1,column:1,offset:0})},Oe=-1;++Oe0&&(r.className=["language-"+a[0]]);let l={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(l.data={meta:t.meta}),e.patch(t,l),l=e.applyData(t,l),l={type:"element",tagName:"pre",properties:{},children:[l]},e.patch(t,l),l}function g4(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function m4(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function _4(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),a=_a(r.toLowerCase()),l=e.footnoteOrder.indexOf(r);let u,o=e.footnoteCounts.get(r);o===void 0?(o=0,e.footnoteOrder.push(r),u=e.footnoteOrder.length):u=l+1,o+=1,e.footnoteCounts.set(r,o);const c={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+a,id:n+"fnref-"+a+(o>1?"-"+o:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(u)}]};e.patch(t,c);const f={type:"element",tagName:"sup",properties:{},children:[c]};return e.patch(t,f),e.applyData(t,f)}function v4(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function y4(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function kx(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const a=e.all(t),l=a[0];l&&l.type==="text"?l.value="["+l.value:a.unshift({type:"text",value:"["});const u=a[a.length-1];return u&&u.type==="text"?u.value+=r:a.push({type:"text",value:r}),a}function b4(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return kx(e,t);const a={src:_a(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(a.title=r.title);const l={type:"element",tagName:"img",properties:a,children:[]};return e.patch(t,l),e.applyData(t,l)}function S4(e,t){const n={src:_a(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function x4(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function w4(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return kx(e,t);const a={href:_a(r.url||"")};r.title!==null&&r.title!==void 0&&(a.title=r.title);const l={type:"element",tagName:"a",properties:a,children:e.all(t)};return e.patch(t,l),e.applyData(t,l)}function C4(e,t){const n={href:_a(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function E4(e,t,n){const r=e.all(t),a=n?k4(n):Ax(t),l={},u=[];if(typeof t.checked=="boolean"){const p=r[0];let d;p&&p.type==="element"&&p.tagName==="p"?d=p:(d={type:"element",tagName:"p",properties:{},children:[]},r.unshift(d)),d.children.length>0&&d.children.unshift({type:"text",value:" "}),d.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),l.className=["task-list-item"]}let o=-1;for(;++o1}function kD(e,t){const n={},r=e.all(t);let a=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++a0){const u={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},o=kg(t.children[1]),c=ax(t.children[t.children.length-1]);o&&c&&(u.position={start:o,end:c}),a.push(u)}const l={type:"element",tagName:"table",properties:{},children:e.wrap(a,!0)};return e.patch(t,l),e.applyData(t,l)}function RD(e,t,n){const r=n?n.children:void 0,l=(r?r.indexOf(t):1)===0?"th":"td",u=n&&n.type==="table"?n.align:void 0,o=u?u.length:t.children.length;let c=-1;const f=[];for(;++c0,!0),r[0]),a=r.index+r[0].length,r=n.exec(t);return l.push(u1(t.slice(a),a>0,!1)),l.join("")}function u1(e,t,n){let r=0,a=e.length;if(t){let l=e.codePointAt(r);for(;l===l1||l===c1;)r++,l=e.codePointAt(r)}if(n){let l=e.codePointAt(a-1);for(;l===l1||l===c1;)a--,l=e.codePointAt(a-1)}return a>r?e.slice(r,a):""}function OD(e,t){const n={type:"text",value:LD(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function jD(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const BD={blockquote:hD,break:fD,code:dD,delete:pD,emphasis:gD,footnoteReference:mD,heading:_D,html:vD,imageReference:yD,image:bD,inlineCode:SD,linkReference:xD,link:wD,listItem:CD,list:kD,paragraph:AD,root:TD,strong:ND,table:DD,tableCell:MD,tableRow:RD,text:OD,thematicBreak:jD,toml:zc,yaml:zc,definition:zc,footnoteDefinition:zc};function zc(){}const Tx=-1,Yu=0,Ro=1,wu=2,Mg=3,Lg=4,Og=5,jg=6,Nx=7,Dx=8,Rx=typeof self=="object"?self:globalThis,h1=(e,t)=>{switch(e){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+e)}return new Rx[e](t)},ID=(e,t)=>{const n=(a,l)=>(e.set(l,a),a),r=a=>{if(e.has(a))return e.get(a);const[l,u]=t[a];switch(l){case Yu:case Tx:return n(u,a);case Ro:{const o=n([],a);for(const c of u)o.push(r(c));return o}case wu:{const o=n({},a);for(const[c,f]of u)o[r(c)]=r(f);return o}case Mg:return n(new Date(u),a);case Lg:{const{source:o,flags:c}=u;return n(new RegExp(o,c),a)}case Og:{const o=n(new Map,a);for(const[c,f]of u)o.set(r(c),r(f));return o}case jg:{const o=n(new Set,a);for(const c of u)o.add(r(c));return o}case Nx:{const{name:o,message:c}=u;return n(typeof Rx[o]=="function"?h1(o,c):new Error(c),a)}case Dx:return n(BigInt(u),a);case"BigInt":return n(Object(BigInt(u)),a);case"ArrayBuffer":return n(new Uint8Array(u).buffer,u);case"DataView":{const{buffer:o}=new Uint8Array(u);return n(new DataView(o),u)}}return n(h1(l,u),a)};return r},f1=e=>ID(new Map,e)(0),qr="",{toString:zD}={},{keys:HD}=Object,xo=e=>{const t=typeof e;if(t!=="object"||!e)return[Yu,t];const n=zD.call(e).slice(8,-1);switch(n){case"Array":return[Ro,qr];case"Object":return[wu,qr];case"Date":return[Mg,qr];case"RegExp":return[Lg,qr];case"Map":return[Og,qr];case"Set":return[jg,qr];case"DataView":return[Ro,n]}return n.includes("Array")?[Ro,n]:e instanceof Error?[Nx,e.name||"Error"]:[wu,n]},Hc=([e,t])=>e===Yu&&(t==="function"||t==="symbol"),FD=(e,t,n,r)=>{const a=(u,o)=>{const c=r.push(u)-1;return n.set(o,c),c},l=u=>{if(n.has(u))return n.get(u);let[o,c]=xo(u);switch(o){case Yu:{let p=u;switch(c){case"bigint":o=Dx,p=u.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+c);p=null;break;case"undefined":return a([Tx],u)}return a([o,p],u)}case Ro:{if(c){let _=u;return c==="DataView"?_=new Uint8Array(u.buffer):c==="ArrayBuffer"&&(_=new Uint8Array(u)),a([c,[..._]],u)}const p=[],d=a([o,p],u);for(const _ of u)p.push(l(_));return d}case wu:{if(c)switch(c){case"BigInt":return a([c,u.toString()],u);case"Boolean":case"Number":case"String":return a([c,u.valueOf()],u)}if(t&&"toJSON"in u)return l(u.toJSON());const p=[],d=a([o,p],u);for(const _ of HD(u))(e||!Hc(xo(u[_])))&&p.push([l(_),l(u[_])]);return d}case Mg:return a([o,isNaN(u.getTime())?qr:u.toISOString()],u);case Lg:{const{source:p,flags:d}=u;return a([o,{source:p,flags:d}],u)}case Og:{const p=[],d=a([o,p],u);for(const[_,v]of u)(e||!(Hc(xo(_))||Hc(xo(v))))&&p.push([l(_),l(v)]);return d}case jg:{const p=[],d=a([o,p],u);for(const _ of u)(e||!Hc(xo(_)))&&p.push(l(_));return d}}const{message:f}=u;return a([o,{name:c,message:f}],u)};return l},d1=(e,{json:t,lossy:n}={})=>{const r=[];return FD(!(t||n),!!t,new Map,r)(e),r},Cu=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?f1(d1(e,t)):structuredClone(e):(e,t)=>f1(d1(e,t));function PD(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function UD(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function $D(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||PD,r=e.options.footnoteBackLabel||UD,a=e.options.footnoteLabel||"Footnotes",l=e.options.footnoteLabelTagName||"h2",u=e.options.footnoteLabelProperties||{className:["sr-only"]},o=[];let c=-1;for(;++c0&&w.push({type:"text",value:" "});let x=typeof n=="string"?n:n(c,v);typeof x=="string"&&(x={type:"text",value:x}),w.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+_+(v>1?"-"+v:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(c,v),className:["data-footnote-backref"]},children:Array.isArray(x)?x:[x]})}const y=p[p.length-1];if(y&&y.type==="element"&&y.tagName==="p"){const x=y.children[y.children.length-1];x&&x.type==="text"?x.value+=" ":y.children.push({type:"text",value:" "}),y.children.push(...w)}else p.push(...w);const S={type:"element",tagName:"li",properties:{id:t+"fn-"+_},children:e.wrap(p,!0)};e.patch(f,S),o.push(S)}if(o.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:l,properties:{...Cu(u),id:"footnote-label"},children:[{type:"text",value:a}]},{type:"text",value:` +`});const f={type:"element",tagName:"li",properties:l,children:u};return e.patch(t,f),e.applyData(t,f)}function k4(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r1}function A4(e,t){const n={},r=e.all(t);let a=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++a0){const u={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},o=kg(t.children[1]),c=ax(t.children[t.children.length-1]);o&&c&&(u.position={start:o,end:c}),a.push(u)}const l={type:"element",tagName:"table",properties:{},children:e.wrap(a,!0)};return e.patch(t,l),e.applyData(t,l)}function M4(e,t,n){const r=n?n.children:void 0,l=(r?r.indexOf(t):1)===0?"th":"td",u=n&&n.type==="table"?n.align:void 0,o=u?u.length:t.children.length;let c=-1;const f=[];for(;++c0,!0),r[0]),a=r.index+r[0].length,r=n.exec(t);return l.push(u1(t.slice(a),a>0,!1)),l.join("")}function u1(e,t,n){let r=0,a=e.length;if(t){let l=e.codePointAt(r);for(;l===l1||l===c1;)r++,l=e.codePointAt(r)}if(n){let l=e.codePointAt(a-1);for(;l===l1||l===c1;)a--,l=e.codePointAt(a-1)}return a>r?e.slice(r,a):""}function j4(e,t){const n={type:"text",value:O4(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function B4(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const I4={blockquote:f4,break:d4,code:p4,delete:g4,emphasis:m4,footnoteReference:_4,heading:v4,html:y4,imageReference:b4,image:S4,inlineCode:x4,linkReference:w4,link:C4,listItem:E4,list:A4,paragraph:T4,root:N4,strong:D4,table:R4,tableCell:L4,tableRow:M4,text:j4,thematicBreak:B4,toml:Ic,yaml:Ic,definition:Ic,footnoteDefinition:Ic};function Ic(){}const Tx=-1,Vu=0,Ro=1,xu=2,Mg=3,Lg=4,Og=5,jg=6,Nx=7,Dx=8,Rx=typeof self=="object"?self:globalThis,h1=(e,t)=>{switch(e){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+e)}return new Rx[e](t)},z4=(e,t)=>{const n=(a,l)=>(e.set(l,a),a),r=a=>{if(e.has(a))return e.get(a);const[l,u]=t[a];switch(l){case Vu:case Tx:return n(u,a);case Ro:{const o=n([],a);for(const c of u)o.push(r(c));return o}case xu:{const o=n({},a);for(const[c,f]of u)o[r(c)]=r(f);return o}case Mg:return n(new Date(u),a);case Lg:{const{source:o,flags:c}=u;return n(new RegExp(o,c),a)}case Og:{const o=n(new Map,a);for(const[c,f]of u)o.set(r(c),r(f));return o}case jg:{const o=n(new Set,a);for(const c of u)o.add(r(c));return o}case Nx:{const{name:o,message:c}=u;return n(typeof Rx[o]=="function"?h1(o,c):new Error(c),a)}case Dx:return n(BigInt(u),a);case"BigInt":return n(Object(BigInt(u)),a);case"ArrayBuffer":return n(new Uint8Array(u).buffer,u);case"DataView":{const{buffer:o}=new Uint8Array(u);return n(new DataView(o),u)}}return n(h1(l,u),a)};return r},f1=e=>z4(new Map,e)(0),Gr="",{toString:H4}={},{keys:F4}=Object,xo=e=>{const t=typeof e;if(t!=="object"||!e)return[Vu,t];const n=H4.call(e).slice(8,-1);switch(n){case"Array":return[Ro,Gr];case"Object":return[xu,Gr];case"Date":return[Mg,Gr];case"RegExp":return[Lg,Gr];case"Map":return[Og,Gr];case"Set":return[jg,Gr];case"DataView":return[Ro,n]}return n.includes("Array")?[Ro,n]:e instanceof Error?[Nx,e.name||"Error"]:[xu,n]},zc=([e,t])=>e===Vu&&(t==="function"||t==="symbol"),P4=(e,t,n,r)=>{const a=(u,o)=>{const c=r.push(u)-1;return n.set(o,c),c},l=u=>{if(n.has(u))return n.get(u);let[o,c]=xo(u);switch(o){case Vu:{let p=u;switch(c){case"bigint":o=Dx,p=u.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+c);p=null;break;case"undefined":return a([Tx],u)}return a([o,p],u)}case Ro:{if(c){let _=u;return c==="DataView"?_=new Uint8Array(u.buffer):c==="ArrayBuffer"&&(_=new Uint8Array(u)),a([c,[..._]],u)}const p=[],d=a([o,p],u);for(const _ of u)p.push(l(_));return d}case xu:{if(c)switch(c){case"BigInt":return a([c,u.toString()],u);case"Boolean":case"Number":case"String":return a([c,u.valueOf()],u)}if(t&&"toJSON"in u)return l(u.toJSON());const p=[],d=a([o,p],u);for(const _ of F4(u))(e||!zc(xo(u[_])))&&p.push([l(_),l(u[_])]);return d}case Mg:return a([o,isNaN(u.getTime())?Gr:u.toISOString()],u);case Lg:{const{source:p,flags:d}=u;return a([o,{source:p,flags:d}],u)}case Og:{const p=[],d=a([o,p],u);for(const[_,v]of u)(e||!(zc(xo(_))||zc(xo(v))))&&p.push([l(_),l(v)]);return d}case jg:{const p=[],d=a([o,p],u);for(const _ of u)(e||!zc(xo(_)))&&p.push(l(_));return d}}const{message:f}=u;return a([o,{name:c,message:f}],u)};return l},d1=(e,{json:t,lossy:n}={})=>{const r=[];return P4(!(t||n),!!t,new Map,r)(e),r},wu=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?f1(d1(e,t)):structuredClone(e):(e,t)=>f1(d1(e,t));function U4(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function $4(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function G4(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||U4,r=e.options.footnoteBackLabel||$4,a=e.options.footnoteLabel||"Footnotes",l=e.options.footnoteLabelTagName||"h2",u=e.options.footnoteLabelProperties||{className:["sr-only"]},o=[];let c=-1;for(;++c0&&w.push({type:"text",value:" "});let x=typeof n=="string"?n:n(c,v);typeof x=="string"&&(x={type:"text",value:x}),w.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+_+(v>1?"-"+v:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(c,v),className:["data-footnote-backref"]},children:Array.isArray(x)?x:[x]})}const b=p[p.length-1];if(b&&b.type==="element"&&b.tagName==="p"){const x=b.children[b.children.length-1];x&&x.type==="text"?x.value+=" ":b.children.push({type:"text",value:" "}),b.children.push(...w)}else p.push(...w);const S={type:"element",tagName:"li",properties:{id:t+"fn-"+_},children:e.wrap(p,!0)};e.patch(f,S),o.push(S)}if(o.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:l,properties:{...wu(u),id:"footnote-label"},children:[{type:"text",value:a}]},{type:"text",value:` `},{type:"element",tagName:"ol",properties:{},children:e.wrap(o,!0)},{type:"text",value:` -`}]}}const Wu=(function(e){if(e==null)return YD;if(typeof e=="function")return Xu(e);if(typeof e=="object")return Array.isArray(e)?GD(e):qD(e);if(typeof e=="string")return VD(e);throw new Error("Expected function, string, or object as test")});function GD(e){const t=[];let n=-1;for(;++n":""))+")"})}return _;function _(){let v=Mx,w,C,y;if((!t||l(c,f,p[p.length-1]||void 0))&&(v=ZD(n(c,p)),v[0]===zp))return v;if("children"in c&&c.children){const S=c;if(S.children&&v[0]!==KD)for(C=(r?S.children.length:-1)+u,y=p.concat(S);C>-1&&C":""))+")"})}return _;function _(){let v=Mx,w,C,b;if((!t||l(c,f,p[p.length-1]||void 0))&&(v=Q4(n(c,p)),v[0]===Ip))return v;if("children"in c&&c.children){const S=c;if(S.children&&v[0]!==Z4)for(C=(r?S.children.length:-1)+u,b=p.concat(S);C>-1&&C0&&n.push({type:"text",value:` -`}),n}function p1(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function g1(e,t){const n=JD(e,t),r=n.one(e,void 0),a=$D(n),l=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return a&&l.children.push({type:"text",value:` -`},a),l}function r4(e,t){return e&&"run"in e?async function(n,r){const a=g1(n,{file:r,...t});await e.run(a,r)}:function(n,r){return g1(n,{file:r,...e||t})}}function m1(e){if(e)throw e}var Zd,_1;function s4(){if(_1)return Zd;_1=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,a=function(f){return typeof Array.isArray=="function"?Array.isArray(f):t.call(f)==="[object Array]"},l=function(f){if(!f||t.call(f)!=="[object Object]")return!1;var p=e.call(f,"constructor"),d=f.constructor&&f.constructor.prototype&&e.call(f.constructor.prototype,"isPrototypeOf");if(f.constructor&&!p&&!d)return!1;var _;for(_ in f);return typeof _>"u"||e.call(f,_)},u=function(f,p){n&&p.name==="__proto__"?n(f,p.name,{enumerable:!0,configurable:!0,value:p.newValue,writable:!0}):f[p.name]=p.newValue},o=function(f,p){if(p==="__proto__")if(e.call(f,p)){if(r)return r(f,p).value}else return;return f[p]};return Zd=function c(){var f,p,d,_,v,w,C=arguments[0],y=1,S=arguments.length,x=!1;for(typeof C=="boolean"&&(x=C,C=arguments[1]||{},y=2),(C==null||typeof C!="object"&&typeof C!="function")&&(C={});yu.length;let c;o&&u.push(a);try{c=e.apply(this,u)}catch(f){const p=f;if(o&&n)throw p;return a(p)}o||(c&&c.then&&typeof c.then=="function"?c.then(l,a):c instanceof Error?a(c):l(c))}function a(u,...o){n||(n=!0,t(u,...o))}function l(u){a(null,u)}}const ai={basename:c4,dirname:u4,extname:h4,join:f4,sep:"/"};function c4(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');sl(e);let n=0,r=-1,a=e.length,l;if(t===void 0||t.length===0||t.length>e.length){for(;a--;)if(e.codePointAt(a)===47){if(l){n=a+1;break}}else r<0&&(l=!0,r=a+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let u=-1,o=t.length-1;for(;a--;)if(e.codePointAt(a)===47){if(l){n=a+1;break}}else u<0&&(l=!0,u=a+1),o>-1&&(e.codePointAt(a)===t.codePointAt(o--)?o<0&&(r=a):(o=-1,r=u));return n===r?r=u:r<0&&(r=e.length),e.slice(n,r)}function u4(e){if(sl(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function h4(e){sl(e);let t=e.length,n=-1,r=0,a=-1,l=0,u;for(;t--;){const o=e.codePointAt(t);if(o===47){if(u){r=t+1;break}continue}n<0&&(u=!0,n=t+1),o===46?a<0?a=t:l!==1&&(l=1):a>-1&&(l=-1)}return a<0||n<0||l===0||l===1&&a===n-1&&a===r+1?"":e.slice(a,n)}function f4(...e){let t=-1,n;for(;++t0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function p4(e,t){let n="",r=0,a=-1,l=0,u=-1,o,c;for(;++u<=e.length;){if(u2){if(c=n.lastIndexOf("/"),c!==n.length-1){c<0?(n="",r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf("/")),a=u,l=0;continue}}else if(n.length>0){n="",r=0,a=u,l=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(a+1,u):n=e.slice(a+1,u),r=u-a-1;a=u,l=0}else o===46&&l>-1?l++:l=-1}return n}function sl(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const g4={cwd:m4};function m4(){return"/"}function Pp(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function _4(e){if(typeof e=="string")e=new URL(e);else if(!Pp(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return v4(e)}function v4(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n0){let[v,...w]=p;const C=r[_][1];Fp(C)&&Fp(v)&&(v=Qd(!0,C,v)),r[_]=[f,v,...w]}}}}const x4=new Ig().freeze();function np(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function ip(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function rp(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function y1(e){if(!Fp(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function b1(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Fc(e){return w4(e)?e:new Ox(e)}function w4(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function C4(e){return typeof e=="string"||E4(e)}function E4(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const k4="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",S1=[],x1={allowDangerousHtml:!0},A4=/^(https?|ircs?|mailto|xmpp)$/i,T4=[{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 jx(e){const t=N4(e),n=D4(e);return R4(t.runSync(t.parse(n),n),e)}function N4(e){const t=e.rehypePlugins||S1,n=e.remarkPlugins||S1,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...x1}:x1;return x4().use(uD).use(n).use(r4,r).use(t)}function D4(e){const t=e.children||"",n=new Ox;return typeof t=="string"&&(n.value=t),n}function R4(e,t){const n=t.allowedElements,r=t.allowElement,a=t.components,l=t.disallowedElements,u=t.skipHtml,o=t.unwrapDisallowed,c=t.urlTransform||M4;for(const p of T4)Object.hasOwn(t,p.from)&&(""+p.from+(p.to?"use `"+p.to+"` instead":"remove it")+k4+p.id,void 0);return Bg(e,f),YN(e,{Fragment:m.Fragment,components:a,ignoreInvalidStyle:!0,jsx:m.jsx,jsxs:m.jsxs,passKeys:!0,passNode:!0});function f(p,d,_){if(p.type==="raw"&&_&&typeof d=="number")return u?_.children.splice(d,1):_.children[d]={type:"text",value:p.value},d;if(p.type==="element"){let v;for(v in Wd)if(Object.hasOwn(Wd,v)&&Object.hasOwn(p.properties,v)){const w=p.properties[v],C=Wd[v];(C===null||C.includes(p.tagName))&&(p.properties[v]=c(String(w||""),v,p))}}if(p.type==="element"){let v=n?!n.includes(p.tagName):l?l.includes(p.tagName):!1;if(!v&&r&&typeof d=="number"&&(v=!r(p,d,_)),v&&_&&typeof d=="number")return o&&p.children?_.children.splice(d,1,...p.children):_.children.splice(d,1),d}}}function M4(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),a=e.indexOf("/");return t===-1||a!==-1&&t>a||n!==-1&&t>n||r!==-1&&t>r||A4.test(e.slice(0,t))?e:""}function w1(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,a=n.indexOf(t);for(;a!==-1;)r++,a=n.indexOf(t,a+t.length);return r}function L4(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function O4(e,t,n){const a=Wu((n||{}).ignore||[]),l=j4(t);let u=-1;for(;++u0?{type:"text",value:T}:void 0),T===!1?_.lastIndex=k+1:(w!==k&&x.push({type:"text",value:f.value.slice(w,k)}),Array.isArray(T)?x.push(...T):T&&x.push(T),w=k+b[0].length,S=!0),!_.global)break;b=_.exec(f.value)}return S?(w?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const a=w1(e,"(");let l=w1(e,")");for(;r!==-1&&a>l;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),l++;return[e,n]}function Bx(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||Qr(n)||qu(n))&&(!t||n!==47)}Ix.peek=rR;function K4(){this.buffer()}function Z4(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function Q4(){this.buffer()}function J4(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function eR(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Qn(this.sliceSerialize(e)).toLowerCase(),n.label=t}function tR(e){this.exit(e)}function nR(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Qn(this.sliceSerialize(e)).toLowerCase(),n.label=t}function iR(e){this.exit(e)}function rR(){return"["}function Ix(e,t,n,r){const a=n.createTracker(r);let l=a.move("[^");const u=n.enter("footnoteReference"),o=n.enter("reference");return l+=a.move(n.safe(n.associationId(e),{after:"]",before:l})),o(),u(),l+=a.move("]"),l}function sR(){return{enter:{gfmFootnoteCallString:K4,gfmFootnoteCall:Z4,gfmFootnoteDefinitionLabelString:Q4,gfmFootnoteDefinition:J4},exit:{gfmFootnoteCallString:eR,gfmFootnoteCall:tR,gfmFootnoteDefinitionLabelString:nR,gfmFootnoteDefinition:iR}}}function aR(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:Ix},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,a,l,u){const o=l.createTracker(u);let c=o.move("[^");const f=l.enter("footnoteDefinition"),p=l.enter("label");return c+=o.move(l.safe(l.associationId(r),{before:c,after:"]"})),p(),c+=o.move("]:"),r.children&&r.children.length>0&&(o.shift(4),c+=o.move((t?` -`:" ")+l.indentLines(l.containerFlow(r,o.current()),t?zx:oR))),f(),c}}function oR(e,t,n){return t===0?e:zx(e,t,n)}function zx(e,t,n){return(n?"":" ")+e}const lR=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Hx.peek=dR;function cR(){return{canContainEols:["delete"],enter:{strikethrough:hR},exit:{strikethrough:fR}}}function uR(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:lR}],handlers:{delete:Hx}}}function hR(e){this.enter({type:"delete",children:[]},e)}function fR(e){this.exit(e)}function Hx(e,t,n,r){const a=n.createTracker(r),l=n.enter("strikethrough");let u=a.move("~~");return u+=n.containerPhrasing(e,{...a.current(),before:u,after:"~"}),u+=a.move("~~"),l(),u}function dR(){return"~"}function pR(e){return e.length}function gR(e,t){const n=t||{},r=(n.align||[]).concat(),a=n.stringLength||pR,l=[],u=[],o=[],c=[];let f=0,p=-1;for(;++pf&&(f=e[p].length);++Sc[S])&&(c[S]=b)}C.push(x)}u[p]=C,o[p]=y}let d=-1;if(typeof r=="object"&&"length"in r)for(;++dc[d]&&(c[d]=x),v[d]=x),_[d]=b}u.splice(1,0,_),o.splice(1,0,v),p=-1;const w=[];for(;++p "),l.shift(2);const u=n.indentLines(n.containerFlow(e,l.current()),vR);return a(),u}function vR(e,t,n){return">"+(n?"":" ")+e}function yR(e,t){return E1(e,t.inConstruct,!0)&&!E1(e,t.notInConstruct,!1)}function E1(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++ru&&(u=l):l=1,a=r+t.length,r=n.indexOf(t,a);return u}function SR(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function xR(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function wR(e,t,n,r){const a=xR(n),l=e.value||"",u=a==="`"?"GraveAccent":"Tilde";if(SR(e,n)){const d=n.enter("codeIndented"),_=n.indentLines(l,CR);return d(),_}const o=n.createTracker(r),c=a.repeat(Math.max(bR(l,a)+1,3)),f=n.enter("codeFenced");let p=o.move(c);if(e.lang){const d=n.enter(`codeFencedLang${u}`);p+=o.move(n.safe(e.lang,{before:p,after:" ",encode:["`"],...o.current()})),d()}if(e.lang&&e.meta){const d=n.enter(`codeFencedMeta${u}`);p+=o.move(" "),p+=o.move(n.safe(e.meta,{before:p,after:` +`}),n}function p1(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function g1(e,t){const n=eD(e,t),r=n.one(e,void 0),a=G4(n),l=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return a&&l.children.push({type:"text",value:` +`},a),l}function sD(e,t){return e&&"run"in e?async function(n,r){const a=g1(n,{file:r,...t});await e.run(a,r)}:function(n,r){return g1(n,{file:r,...e||t})}}function m1(e){if(e)throw e}var Kd,_1;function aD(){if(_1)return Kd;_1=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,a=function(f){return typeof Array.isArray=="function"?Array.isArray(f):t.call(f)==="[object Array]"},l=function(f){if(!f||t.call(f)!=="[object Object]")return!1;var p=e.call(f,"constructor"),d=f.constructor&&f.constructor.prototype&&e.call(f.constructor.prototype,"isPrototypeOf");if(f.constructor&&!p&&!d)return!1;var _;for(_ in f);return typeof _>"u"||e.call(f,_)},u=function(f,p){n&&p.name==="__proto__"?n(f,p.name,{enumerable:!0,configurable:!0,value:p.newValue,writable:!0}):f[p.name]=p.newValue},o=function(f,p){if(p==="__proto__")if(e.call(f,p)){if(r)return r(f,p).value}else return;return f[p]};return Kd=function c(){var f,p,d,_,v,w,C=arguments[0],b=1,S=arguments.length,x=!1;for(typeof C=="boolean"&&(x=C,C=arguments[1]||{},b=2),(C==null||typeof C!="object"&&typeof C!="function")&&(C={});bu.length;let c;o&&u.push(a);try{c=e.apply(this,u)}catch(f){const p=f;if(o&&n)throw p;return a(p)}o||(c&&c.then&&typeof c.then=="function"?c.then(l,a):c instanceof Error?a(c):l(c))}function a(u,...o){n||(n=!0,t(u,...o))}function l(u){a(null,u)}}const oi={basename:uD,dirname:hD,extname:fD,join:dD,sep:"/"};function uD(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');rl(e);let n=0,r=-1,a=e.length,l;if(t===void 0||t.length===0||t.length>e.length){for(;a--;)if(e.codePointAt(a)===47){if(l){n=a+1;break}}else r<0&&(l=!0,r=a+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let u=-1,o=t.length-1;for(;a--;)if(e.codePointAt(a)===47){if(l){n=a+1;break}}else u<0&&(l=!0,u=a+1),o>-1&&(e.codePointAt(a)===t.codePointAt(o--)?o<0&&(r=a):(o=-1,r=u));return n===r?r=u:r<0&&(r=e.length),e.slice(n,r)}function hD(e){if(rl(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function fD(e){rl(e);let t=e.length,n=-1,r=0,a=-1,l=0,u;for(;t--;){const o=e.codePointAt(t);if(o===47){if(u){r=t+1;break}continue}n<0&&(u=!0,n=t+1),o===46?a<0?a=t:l!==1&&(l=1):a>-1&&(l=-1)}return a<0||n<0||l===0||l===1&&a===n-1&&a===r+1?"":e.slice(a,n)}function dD(...e){let t=-1,n;for(;++t0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function gD(e,t){let n="",r=0,a=-1,l=0,u=-1,o,c;for(;++u<=e.length;){if(u2){if(c=n.lastIndexOf("/"),c!==n.length-1){c<0?(n="",r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf("/")),a=u,l=0;continue}}else if(n.length>0){n="",r=0,a=u,l=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(a+1,u):n=e.slice(a+1,u),r=u-a-1;a=u,l=0}else o===46&&l>-1?l++:l=-1}return n}function rl(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const mD={cwd:_D};function _D(){return"/"}function Fp(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function vD(e){if(typeof e=="string")e=new URL(e);else if(!Fp(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return yD(e)}function yD(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n0){let[v,...w]=p;const C=r[_][1];Hp(C)&&Hp(v)&&(v=Zd(!0,C,v)),r[_]=[f,v,...w]}}}}const wD=new Ig().freeze();function tp(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function np(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function ip(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function y1(e){if(!Hp(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function b1(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Hc(e){return CD(e)?e:new Ox(e)}function CD(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function ED(e){return typeof e=="string"||kD(e)}function kD(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const AD="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",S1=[],x1={allowDangerousHtml:!0},TD=/^(https?|ircs?|mailto|xmpp)$/i,ND=[{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 jx(e){const t=DD(e),n=RD(e);return MD(t.runSync(t.parse(n),n),e)}function DD(e){const t=e.rehypePlugins||S1,n=e.remarkPlugins||S1,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...x1}:x1;return wD().use(h4).use(n).use(sD,r).use(t)}function RD(e){const t=e.children||"",n=new Ox;return typeof t=="string"&&(n.value=t),n}function MD(e,t){const n=t.allowedElements,r=t.allowElement,a=t.components,l=t.disallowedElements,u=t.skipHtml,o=t.unwrapDisallowed,c=t.urlTransform||LD;for(const p of ND)Object.hasOwn(t,p.from)&&(""+p.from+(p.to?"use `"+p.to+"` instead":"remove it")+AD+p.id,void 0);return Bg(e,f),WN(e,{Fragment:m.Fragment,components:a,ignoreInvalidStyle:!0,jsx:m.jsx,jsxs:m.jsxs,passKeys:!0,passNode:!0});function f(p,d,_){if(p.type==="raw"&&_&&typeof d=="number")return u?_.children.splice(d,1):_.children[d]={type:"text",value:p.value},d;if(p.type==="element"){let v;for(v in Yd)if(Object.hasOwn(Yd,v)&&Object.hasOwn(p.properties,v)){const w=p.properties[v],C=Yd[v];(C===null||C.includes(p.tagName))&&(p.properties[v]=c(String(w||""),v,p))}}if(p.type==="element"){let v=n?!n.includes(p.tagName):l?l.includes(p.tagName):!1;if(!v&&r&&typeof d=="number"&&(v=!r(p,d,_)),v&&_&&typeof d=="number")return o&&p.children?_.children.splice(d,1,...p.children):_.children.splice(d,1),d}}}function LD(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),a=e.indexOf("/");return t===-1||a!==-1&&t>a||n!==-1&&t>n||r!==-1&&t>r||TD.test(e.slice(0,t))?e:""}function w1(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,a=n.indexOf(t);for(;a!==-1;)r++,a=n.indexOf(t,a+t.length);return r}function OD(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function jD(e,t,n){const a=Yu((n||{}).ignore||[]),l=BD(t);let u=-1;for(;++u0?{type:"text",value:T}:void 0),T===!1?_.lastIndex=k+1:(w!==k&&x.push({type:"text",value:f.value.slice(w,k)}),Array.isArray(T)?x.push(...T):T&&x.push(T),w=k+y[0].length,S=!0),!_.global)break;y=_.exec(f.value)}return S?(w?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const a=w1(e,"(");let l=w1(e,")");for(;r!==-1&&a>l;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),l++;return[e,n]}function Bx(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||Zr(n)||Gu(n))&&(!t||n!==47)}Ix.peek=sR;function ZD(){this.buffer()}function QD(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function JD(){this.buffer()}function eR(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function tR(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Qn(this.sliceSerialize(e)).toLowerCase(),n.label=t}function nR(e){this.exit(e)}function iR(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Qn(this.sliceSerialize(e)).toLowerCase(),n.label=t}function rR(e){this.exit(e)}function sR(){return"["}function Ix(e,t,n,r){const a=n.createTracker(r);let l=a.move("[^");const u=n.enter("footnoteReference"),o=n.enter("reference");return l+=a.move(n.safe(n.associationId(e),{after:"]",before:l})),o(),u(),l+=a.move("]"),l}function aR(){return{enter:{gfmFootnoteCallString:ZD,gfmFootnoteCall:QD,gfmFootnoteDefinitionLabelString:JD,gfmFootnoteDefinition:eR},exit:{gfmFootnoteCallString:tR,gfmFootnoteCall:nR,gfmFootnoteDefinitionLabelString:iR,gfmFootnoteDefinition:rR}}}function oR(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:Ix},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,a,l,u){const o=l.createTracker(u);let c=o.move("[^");const f=l.enter("footnoteDefinition"),p=l.enter("label");return c+=o.move(l.safe(l.associationId(r),{before:c,after:"]"})),p(),c+=o.move("]:"),r.children&&r.children.length>0&&(o.shift(4),c+=o.move((t?` +`:" ")+l.indentLines(l.containerFlow(r,o.current()),t?zx:lR))),f(),c}}function lR(e,t,n){return t===0?e:zx(e,t,n)}function zx(e,t,n){return(n?"":" ")+e}const cR=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Hx.peek=pR;function uR(){return{canContainEols:["delete"],enter:{strikethrough:fR},exit:{strikethrough:dR}}}function hR(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:cR}],handlers:{delete:Hx}}}function fR(e){this.enter({type:"delete",children:[]},e)}function dR(e){this.exit(e)}function Hx(e,t,n,r){const a=n.createTracker(r),l=n.enter("strikethrough");let u=a.move("~~");return u+=n.containerPhrasing(e,{...a.current(),before:u,after:"~"}),u+=a.move("~~"),l(),u}function pR(){return"~"}function gR(e){return e.length}function mR(e,t){const n=t||{},r=(n.align||[]).concat(),a=n.stringLength||gR,l=[],u=[],o=[],c=[];let f=0,p=-1;for(;++pf&&(f=e[p].length);++Sc[S])&&(c[S]=y)}C.push(x)}u[p]=C,o[p]=b}let d=-1;if(typeof r=="object"&&"length"in r)for(;++dc[d]&&(c[d]=x),v[d]=x),_[d]=y}u.splice(1,0,_),o.splice(1,0,v),p=-1;const w=[];for(;++p "),l.shift(2);const u=n.indentLines(n.containerFlow(e,l.current()),yR);return a(),u}function yR(e,t,n){return">"+(n?"":" ")+e}function bR(e,t){return E1(e,t.inConstruct,!0)&&!E1(e,t.notInConstruct,!1)}function E1(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++ru&&(u=l):l=1,a=r+t.length,r=n.indexOf(t,a);return u}function xR(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function wR(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function CR(e,t,n,r){const a=wR(n),l=e.value||"",u=a==="`"?"GraveAccent":"Tilde";if(xR(e,n)){const d=n.enter("codeIndented"),_=n.indentLines(l,ER);return d(),_}const o=n.createTracker(r),c=a.repeat(Math.max(SR(l,a)+1,3)),f=n.enter("codeFenced");let p=o.move(c);if(e.lang){const d=n.enter(`codeFencedLang${u}`);p+=o.move(n.safe(e.lang,{before:p,after:" ",encode:["`"],...o.current()})),d()}if(e.lang&&e.meta){const d=n.enter(`codeFencedMeta${u}`);p+=o.move(" "),p+=o.move(n.safe(e.meta,{before:p,after:` `,encode:["`"],...o.current()})),d()}return p+=o.move(` `),l&&(p+=o.move(l+` -`)),p+=o.move(c),f(),p}function CR(e,t,n){return(n?"":" ")+e}function zg(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function ER(e,t,n,r){const a=zg(n),l=a==='"'?"Quote":"Apostrophe",u=n.enter("definition");let o=n.enter("label");const c=n.createTracker(r);let f=c.move("[");return f+=c.move(n.safe(n.associationId(e),{before:f,after:"]",...c.current()})),f+=c.move("]: "),o(),!e.url||/[\0- \u007F]/.test(e.url)?(o=n.enter("destinationLiteral"),f+=c.move("<"),f+=c.move(n.safe(e.url,{before:f,after:">",...c.current()})),f+=c.move(">")):(o=n.enter("destinationRaw"),f+=c.move(n.safe(e.url,{before:f,after:e.title?" ":` -`,...c.current()}))),o(),e.title&&(o=n.enter(`title${l}`),f+=c.move(" "+a),f+=c.move(n.safe(e.title,{before:f,after:a,...c.current()})),f+=c.move(a),o()),u(),f}function kR(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function Fo(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Eu(e,t,n){const r=aa(e),a=aa(t);return r===void 0?a===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:a===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?a===void 0?{inside:!1,outside:!1}:a===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:a===void 0?{inside:!1,outside:!1}:a===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}Fx.peek=AR;function Fx(e,t,n,r){const a=kR(n),l=n.enter("emphasis"),u=n.createTracker(r),o=u.move(a);let c=u.move(n.containerPhrasing(e,{after:a,before:o,...u.current()}));const f=c.charCodeAt(0),p=Eu(r.before.charCodeAt(r.before.length-1),f,a);p.inside&&(c=Fo(f)+c.slice(1));const d=c.charCodeAt(c.length-1),_=Eu(r.after.charCodeAt(0),d,a);_.inside&&(c=c.slice(0,-1)+Fo(d));const v=u.move(a);return l(),n.attentionEncodeSurroundingInfo={after:_.outside,before:p.outside},o+c+v}function AR(e,t,n){return n.options.emphasis||"*"}function TR(e,t){let n=!1;return Bg(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,zp}),!!((!e.depth||e.depth<3)&&Dg(e)&&(t.options.setext||n))}function NR(e,t,n,r){const a=Math.max(Math.min(6,e.depth||1),1),l=n.createTracker(r);if(TR(e,n)){const p=n.enter("headingSetext"),d=n.enter("phrasing"),_=n.containerPhrasing(e,{...l.current(),before:` +`)),p+=o.move(c),f(),p}function ER(e,t,n){return(n?"":" ")+e}function zg(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function kR(e,t,n,r){const a=zg(n),l=a==='"'?"Quote":"Apostrophe",u=n.enter("definition");let o=n.enter("label");const c=n.createTracker(r);let f=c.move("[");return f+=c.move(n.safe(n.associationId(e),{before:f,after:"]",...c.current()})),f+=c.move("]: "),o(),!e.url||/[\0- \u007F]/.test(e.url)?(o=n.enter("destinationLiteral"),f+=c.move("<"),f+=c.move(n.safe(e.url,{before:f,after:">",...c.current()})),f+=c.move(">")):(o=n.enter("destinationRaw"),f+=c.move(n.safe(e.url,{before:f,after:e.title?" ":` +`,...c.current()}))),o(),e.title&&(o=n.enter(`title${l}`),f+=c.move(" "+a),f+=c.move(n.safe(e.title,{before:f,after:a,...c.current()})),f+=c.move(a),o()),u(),f}function AR(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function Fo(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Cu(e,t,n){const r=sa(e),a=sa(t);return r===void 0?a===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:a===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?a===void 0?{inside:!1,outside:!1}:a===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:a===void 0?{inside:!1,outside:!1}:a===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}Fx.peek=TR;function Fx(e,t,n,r){const a=AR(n),l=n.enter("emphasis"),u=n.createTracker(r),o=u.move(a);let c=u.move(n.containerPhrasing(e,{after:a,before:o,...u.current()}));const f=c.charCodeAt(0),p=Cu(r.before.charCodeAt(r.before.length-1),f,a);p.inside&&(c=Fo(f)+c.slice(1));const d=c.charCodeAt(c.length-1),_=Cu(r.after.charCodeAt(0),d,a);_.inside&&(c=c.slice(0,-1)+Fo(d));const v=u.move(a);return l(),n.attentionEncodeSurroundingInfo={after:_.outside,before:p.outside},o+c+v}function TR(e,t,n){return n.options.emphasis||"*"}function NR(e,t){let n=!1;return Bg(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,Ip}),!!((!e.depth||e.depth<3)&&Dg(e)&&(t.options.setext||n))}function DR(e,t,n,r){const a=Math.max(Math.min(6,e.depth||1),1),l=n.createTracker(r);if(NR(e,n)){const p=n.enter("headingSetext"),d=n.enter("phrasing"),_=n.containerPhrasing(e,{...l.current(),before:` `,after:` `});return d(),p(),_+` `+(a===1?"=":"-").repeat(_.length-(Math.max(_.lastIndexOf("\r"),_.lastIndexOf(` `))+1))}const u="#".repeat(a),o=n.enter("headingAtx"),c=n.enter("phrasing");l.move(u+" ");let f=n.containerPhrasing(e,{before:"# ",after:` -`,...l.current()});return/^[\t ]/.test(f)&&(f=Fo(f.charCodeAt(0))+f.slice(1)),f=f?u+" "+f:u,n.options.closeAtx&&(f+=" "+u),c(),o(),f}Px.peek=DR;function Px(e){return e.value||""}function DR(){return"<"}Ux.peek=RR;function Ux(e,t,n,r){const a=zg(n),l=a==='"'?"Quote":"Apostrophe",u=n.enter("image");let o=n.enter("label");const c=n.createTracker(r);let f=c.move("![");return f+=c.move(n.safe(e.alt,{before:f,after:"]",...c.current()})),f+=c.move("]("),o(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(o=n.enter("destinationLiteral"),f+=c.move("<"),f+=c.move(n.safe(e.url,{before:f,after:">",...c.current()})),f+=c.move(">")):(o=n.enter("destinationRaw"),f+=c.move(n.safe(e.url,{before:f,after:e.title?" ":")",...c.current()}))),o(),e.title&&(o=n.enter(`title${l}`),f+=c.move(" "+a),f+=c.move(n.safe(e.title,{before:f,after:a,...c.current()})),f+=c.move(a),o()),f+=c.move(")"),u(),f}function RR(){return"!"}$x.peek=MR;function $x(e,t,n,r){const a=e.referenceType,l=n.enter("imageReference");let u=n.enter("label");const o=n.createTracker(r);let c=o.move("![");const f=n.safe(e.alt,{before:c,after:"]",...o.current()});c+=o.move(f+"]["),u();const p=n.stack;n.stack=[],u=n.enter("reference");const d=n.safe(n.associationId(e),{before:c,after:"]",...o.current()});return u(),n.stack=p,l(),a==="full"||!f||f!==d?c+=o.move(d+"]"):a==="shortcut"?c=c.slice(0,-1):c+=o.move("]"),c}function MR(){return"!"}Gx.peek=LR;function Gx(e,t,n){let r=e.value||"",a="`",l=-1;for(;new RegExp("(^|[^`])"+a+"([^`]|$)").test(r);)a+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++l\u007F]/.test(e.url))}Vx.peek=OR;function Vx(e,t,n,r){const a=zg(n),l=a==='"'?"Quote":"Apostrophe",u=n.createTracker(r);let o,c;if(qx(e,n)){const p=n.stack;n.stack=[],o=n.enter("autolink");let d=u.move("<");return d+=u.move(n.containerPhrasing(e,{before:d,after:">",...u.current()})),d+=u.move(">"),o(),n.stack=p,d}o=n.enter("link"),c=n.enter("label");let f=u.move("[");return f+=u.move(n.containerPhrasing(e,{before:f,after:"](",...u.current()})),f+=u.move("]("),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter("destinationLiteral"),f+=u.move("<"),f+=u.move(n.safe(e.url,{before:f,after:">",...u.current()})),f+=u.move(">")):(c=n.enter("destinationRaw"),f+=u.move(n.safe(e.url,{before:f,after:e.title?" ":")",...u.current()}))),c(),e.title&&(c=n.enter(`title${l}`),f+=u.move(" "+a),f+=u.move(n.safe(e.title,{before:f,after:a,...u.current()})),f+=u.move(a),c()),f+=u.move(")"),o(),f}function OR(e,t,n){return qx(e,n)?"<":"["}Yx.peek=jR;function Yx(e,t,n,r){const a=e.referenceType,l=n.enter("linkReference");let u=n.enter("label");const o=n.createTracker(r);let c=o.move("[");const f=n.containerPhrasing(e,{before:c,after:"]",...o.current()});c+=o.move(f+"]["),u();const p=n.stack;n.stack=[],u=n.enter("reference");const d=n.safe(n.associationId(e),{before:c,after:"]",...o.current()});return u(),n.stack=p,l(),a==="full"||!f||f!==d?c+=o.move(d+"]"):a==="shortcut"?c=c.slice(0,-1):c+=o.move("]"),c}function jR(){return"["}function Hg(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function BR(e){const t=Hg(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function IR(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function Wx(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function zR(e,t,n,r){const a=n.enter("list"),l=n.bulletCurrent;let u=e.ordered?IR(n):Hg(n);const o=e.ordered?u==="."?")":".":BR(n);let c=t&&n.bulletLastUsed?u===n.bulletLastUsed:!1;if(!e.ordered){const p=e.children?e.children[0]:void 0;if((u==="*"||u==="-")&&p&&(!p.children||!p.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(c=!0),Wx(n)===u&&p){let d=-1;for(;++d-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+l);let u=l.length+1;(a==="tab"||a==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(u=Math.ceil(u/4)*4);const o=n.createTracker(r);o.move(l+" ".repeat(u-l.length)),o.shift(u);const c=n.enter("listItem"),f=n.indentLines(n.containerFlow(e,o.current()),p);return c(),f;function p(d,_,v){return _?(v?"":" ".repeat(u))+d:(v?l:l+" ".repeat(u-l.length))+d}}function PR(e,t,n,r){const a=n.enter("paragraph"),l=n.enter("phrasing"),u=n.containerPhrasing(e,r);return l(),a(),u}const UR=Wu(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function $R(e,t,n,r){return(e.children.some(function(u){return UR(u)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function GR(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}Xx.peek=qR;function Xx(e,t,n,r){const a=GR(n),l=n.enter("strong"),u=n.createTracker(r),o=u.move(a+a);let c=u.move(n.containerPhrasing(e,{after:a,before:o,...u.current()}));const f=c.charCodeAt(0),p=Eu(r.before.charCodeAt(r.before.length-1),f,a);p.inside&&(c=Fo(f)+c.slice(1));const d=c.charCodeAt(c.length-1),_=Eu(r.after.charCodeAt(0),d,a);_.inside&&(c=c.slice(0,-1)+Fo(d));const v=u.move(a+a);return l(),n.attentionEncodeSurroundingInfo={after:_.outside,before:p.outside},o+c+v}function qR(e,t,n){return n.options.strong||"*"}function VR(e,t,n,r){return n.safe(e.value,r)}function YR(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function WR(e,t,n){const r=(Wx(n)+(n.options.ruleSpaces?" ":"")).repeat(YR(n));return n.options.ruleSpaces?r.slice(0,-1):r}const Kx={blockquote:_R,break:k1,code:wR,definition:ER,emphasis:Fx,hardBreak:k1,heading:NR,html:Px,image:Ux,imageReference:$x,inlineCode:Gx,link:Vx,linkReference:Yx,list:zR,listItem:FR,paragraph:PR,root:$R,strong:Xx,text:VR,thematicBreak:WR};function XR(){return{enter:{table:KR,tableData:A1,tableHeader:A1,tableRow:QR},exit:{codeText:JR,table:ZR,tableData:lp,tableHeader:lp,tableRow:lp}}}function KR(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function ZR(e){this.exit(e),this.data.inTable=void 0}function QR(e){this.enter({type:"tableRow",children:[]},e)}function lp(e){this.exit(e)}function A1(e){this.enter({type:"tableCell",children:[]},e)}function JR(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,eM));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function eM(e,t){return t==="|"?t:e}function tM(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,a=t.stringLength,l=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:` -`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:_,table:u,tableCell:c,tableRow:o}};function u(v,w,C,y){return f(p(v,C,y),v.align)}function o(v,w,C,y){const S=d(v,C,y),x=f([S]);return x.slice(0,x.indexOf(` -`))}function c(v,w,C,y){const S=C.enter("tableCell"),x=C.enter("phrasing"),b=C.containerPhrasing(v,{...y,before:l,after:l});return x(),S(),b}function f(v,w){return gR(v,{align:w,alignDelimiters:r,padding:n,stringLength:a})}function p(v,w,C){const y=v.children;let S=-1;const x=[],b=w.enter("table");for(;++S0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const yM={tokenize:AM,partial:!0};function bM(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:CM,continuation:{tokenize:EM},exit:kM}},text:{91:{name:"gfmFootnoteCall",tokenize:wM},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:SM,resolveTo:xM}}}}function SM(e,t,n){const r=this;let a=r.events.length;const l=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let u;for(;a--;){const c=r.events[a][1];if(c.type==="labelImage"){u=c;break}if(c.type==="gfmFootnoteCall"||c.type==="labelLink"||c.type==="label"||c.type==="image"||c.type==="link")break}return o;function o(c){if(!u||!u._balanced)return n(c);const f=Qn(r.sliceSerialize({start:u.end,end:r.now()}));return f.codePointAt(0)!==94||!l.includes(f.slice(1))?n(c):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),t(c))}}function xM(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},a={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};a.end.column++,a.end.offset++,a.end._bufferIndex++;const l={type:"gfmFootnoteCallString",start:Object.assign({},a.end),end:Object.assign({},e[e.length-1][1].start)},u={type:"chunkString",contentType:"string",start:Object.assign({},l.start),end:Object.assign({},l.end)},o=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",a,t],["exit",a,t],["enter",l,t],["enter",u,t],["exit",u,t],["exit",l,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...o),e}function wM(e,t,n){const r=this,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let l=0,u;return o;function o(d){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(d),e.exit("gfmFootnoteCallLabelMarker"),c}function c(d){return d!==94?n(d):(e.enter("gfmFootnoteCallMarker"),e.consume(d),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",f)}function f(d){if(l>999||d===93&&!u||d===null||d===91||xt(d))return n(d);if(d===93){e.exit("chunkString");const _=e.exit("gfmFootnoteCallString");return a.includes(Qn(r.sliceSerialize(_)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(d),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(d)}return xt(d)||(u=!0),l++,e.consume(d),d===92?p:f}function p(d){return d===91||d===92||d===93?(e.consume(d),l++,f):f(d)}}function CM(e,t,n){const r=this,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let l,u=0,o;return c;function c(w){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(w),e.exit("gfmFootnoteDefinitionLabelMarker"),f}function f(w){return w===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(w),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",p):n(w)}function p(w){if(u>999||w===93&&!o||w===null||w===91||xt(w))return n(w);if(w===93){e.exit("chunkString");const C=e.exit("gfmFootnoteDefinitionLabelString");return l=Qn(r.sliceSerialize(C)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(w),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),_}return xt(w)||(o=!0),u++,e.consume(w),w===92?d:p}function d(w){return w===91||w===92||w===93?(e.consume(w),u++,p):p(w)}function _(w){return w===58?(e.enter("definitionMarker"),e.consume(w),e.exit("definitionMarker"),a.includes(l)||a.push(l),tt(e,v,"gfmFootnoteDefinitionWhitespace")):n(w)}function v(w){return t(w)}}function EM(e,t,n){return e.check(rl,t,e.attempt(yM,t,n))}function kM(e){e.exit("gfmFootnoteDefinition")}function AM(e,t,n){const r=this;return tt(e,a,"gfmFootnoteDefinitionIndent",5);function a(l){const u=r.events[r.events.length-1];return u&&u[1].type==="gfmFootnoteDefinitionIndent"&&u[2].sliceSerialize(u[1],!0).length===4?t(l):n(l)}}function TM(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:l,resolveAll:a};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function a(u,o){let c=-1;for(;++c1?c(w):(u.consume(w),d++,v);if(d<2&&!n)return c(w);const y=u.exit("strikethroughSequenceTemporary"),S=aa(w);return y._open=!S||S===2&&!!C,y._close=!C||C===2&&!!S,o(w)}}}class NM{constructor(){this.map=[]}add(t,n,r){DM(this,t,n,r)}consume(t){if(this.map.sort(function(l,u){return l[0]-u[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let a=r.pop();for(;a;){for(const l of a)t.push(l);a=r.pop()}this.map.length=0}}function DM(e,t,n,r){let a=0;if(!(n===0&&r.length===0)){for(;a-1;){const z=r.events[H][1].type;if(z==="lineEnding"||z==="linePrefix")H--;else break}const Y=H>-1?r.events[H][1].type:null,F=Y==="tableHead"||Y==="tableRow"?T:c;return F===T&&r.parser.lazy[r.now().line]?n(B):F(B)}function c(B){return e.enter("tableHead"),e.enter("tableRow"),f(B)}function f(B){return B===124||(u=!0,l+=1),p(B)}function p(B){return B===null?n(B):Oe(B)?l>1?(l=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(B),e.exit("lineEnding"),v):n(B):Ve(B)?tt(e,p,"whitespace")(B):(l+=1,u&&(u=!1,a+=1),B===124?(e.enter("tableCellDivider"),e.consume(B),e.exit("tableCellDivider"),u=!0,p):(e.enter("data"),d(B)))}function d(B){return B===null||B===124||xt(B)?(e.exit("data"),p(B)):(e.consume(B),B===92?_:d)}function _(B){return B===92||B===124?(e.consume(B),d):d(B)}function v(B){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(B):(e.enter("tableDelimiterRow"),u=!1,Ve(B)?tt(e,w,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(B):w(B))}function w(B){return B===45||B===58?y(B):B===124?(u=!0,e.enter("tableCellDivider"),e.consume(B),e.exit("tableCellDivider"),C):D(B)}function C(B){return Ve(B)?tt(e,y,"whitespace")(B):y(B)}function y(B){return B===58?(l+=1,u=!0,e.enter("tableDelimiterMarker"),e.consume(B),e.exit("tableDelimiterMarker"),S):B===45?(l+=1,S(B)):B===null||Oe(B)?k(B):D(B)}function S(B){return B===45?(e.enter("tableDelimiterFiller"),x(B)):D(B)}function x(B){return B===45?(e.consume(B),x):B===58?(u=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(B),e.exit("tableDelimiterMarker"),b):(e.exit("tableDelimiterFiller"),b(B))}function b(B){return Ve(B)?tt(e,k,"whitespace")(B):k(B)}function k(B){return B===124?w(B):B===null||Oe(B)?!u||a!==l?D(B):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(B)):D(B)}function D(B){return n(B)}function T(B){return e.enter("tableRow"),R(B)}function R(B){return B===124?(e.enter("tableCellDivider"),e.consume(B),e.exit("tableCellDivider"),R):B===null||Oe(B)?(e.exit("tableRow"),t(B)):Ve(B)?tt(e,R,"whitespace")(B):(e.enter("data"),N(B))}function N(B){return B===null||B===124||xt(B)?(e.exit("data"),R(B)):(e.consume(B),B===92?M:N)}function M(B){return B===92||B===124?(e.consume(B),N):N(B)}}function OM(e,t){let n=-1,r=!0,a=0,l=[0,0,0,0],u=[0,0,0,0],o=!1,c=0,f,p,d;const _=new NM;for(;++nn[2]+1){const w=n[2]+1,C=n[3]-n[2]-1;e.add(w,C,[])}}e.add(n[3]+1,0,[["exit",d,t]])}return a!==void 0&&(l.end=Object.assign({},Ks(t.events,a)),e.add(a,0,[["exit",l,t]]),l=void 0),l}function N1(e,t,n,r,a){const l=[],u=Ks(t.events,n);a&&(a.end=Object.assign({},u),l.push(["exit",a,t])),r.end=Object.assign({},u),l.push(["exit",r,t]),e.add(n+1,0,l)}function Ks(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const jM={name:"tasklistCheck",tokenize:IM};function BM(){return{text:{91:jM}}}function IM(e,t,n){const r=this;return a;function a(c){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(c):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),l)}function l(c){return xt(c)?(e.enter("taskListCheckValueUnchecked"),e.consume(c),e.exit("taskListCheckValueUnchecked"),u):c===88||c===120?(e.enter("taskListCheckValueChecked"),e.consume(c),e.exit("taskListCheckValueChecked"),u):n(c)}function u(c){return c===93?(e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),o):n(c)}function o(c){return Oe(c)?t(c):Ve(c)?e.check({tokenize:zM},t,n)(c):n(c)}}function zM(e,t,n){return tt(e,r,"whitespace");function r(a){return a===null?n(a):t(a)}}function HM(e){return dx([uM(),bM(),TM(e),MM(),BM()])}const FM={};function sw(e){const t=this,n=e||FM,r=t.data(),a=r.micromarkExtensions||(r.micromarkExtensions=[]),l=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),u=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);a.push(HM(n)),l.push(aM()),u.push(oM(n))}const PM={cjs:"javascript",console:"bash",cts:"typescript",fish:"bash",html:"markup",js:"javascript",jsx:"javascript",md:"markdown",mjs:"javascript",mts:"typescript",py:"python",rb:"ruby",sh:"bash",shell:"bash",svg:"markup",terminal:"bash",ts:"typescript",tsx:"typescript",xml:"markup",yml:"yaml",zsh:"bash"},UM={containerfile:"docker",dockerfile:"docker",justfile:"makefile",makefile:"makefile"};function $p(e){const t=e.trim().toLowerCase();return PM[t]??t}function aw(e){var a;if(!e)return null;const t=((a=e.split("/").pop())==null?void 0:a.toLowerCase())??"",n=UM[t];if(n)return $p(n);const r=t.lastIndexOf(".");return r===-1||r===t.length-1?null:$p(t.slice(r+1))}hi.displayName="clike";hi.aliases=[];function hi(e){e.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/}}al.displayName="c";al.aliases=[];function al(e){e.register(hi),e.languages.c=e.languages.extend("clike",{comment:{pattern:/\/\/(?:[^\r\n\\]|\\(?:\r\n?|\n|(?![\r\n])))*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},string:{pattern:/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},"class-name":{pattern:/(\b(?:enum|struct)\s+(?:__attribute__\s*\(\([\s\S]*?\)\)\s*)?)\w+|\b[a-z]\w*_t\b/,lookbehind:!0},keyword:/\b(?:_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|__attribute__|asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|inline|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|typeof|union|unsigned|void|volatile|while)\b/,function:/\b[a-z_]\w*(?=\s*\()/i,number:/(?:\b0x(?:[\da-f]+(?:\.[\da-f]*)?|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)[ful]{0,4}/i,operator:/>>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?/}),e.languages.insertBefore("c","string",{char:{pattern:/'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n]){0,32}'/,greedy:!0}}),e.languages.insertBefore("c","string",{macro:{pattern:/(^[\t ]*)#\s*[a-z](?:[^\r\n\\/]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|\\(?:\r\n|[\s\S]))*/im,lookbehind:!0,greedy:!0,alias:"property",inside:{string:[{pattern:/^(#\s*include\s*)<[^>]+>/,lookbehind:!0},e.languages.c.string],char:e.languages.c.char,comment:e.languages.c.comment,"macro-name":[{pattern:/(^#\s*define\s+)\w+\b(?!\()/i,lookbehind:!0},{pattern:/(^#\s*define\s+)\w+\b(?=\()/i,lookbehind:!0,alias:"function"}],directive:{pattern:/^(#\s*)[a-z]+/,lookbehind:!0,alias:"keyword"},"directive-hash":/^#/,punctuation:/##|\\(?=[\r\n])/,expression:{pattern:/\S[\s\S]*/,inside:e.languages.c}}}}),e.languages.insertBefore("c","function",{constant:/\b(?:EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|__DATE__|__FILE__|__LINE__|__TIMESTAMP__|__TIME__|__func__|stderr|stdin|stdout)\b/}),delete e.languages.c.boolean}Ku.displayName="cpp";Ku.aliases=[];function Ku(e){e.register(al),(function(t){var n=/\b(?:alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|char8_t|class|co_await|co_return|co_yield|compl|concept|const|const_cast|consteval|constexpr|constinit|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|final|float|for|friend|goto|if|import|inline|int|int16_t|int32_t|int64_t|int8_t|long|module|mutable|namespace|new|noexcept|nullptr|operator|override|private|protected|public|register|reinterpret_cast|requires|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|uint16_t|uint32_t|uint64_t|uint8_t|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/,r=/\b(?!)\w+(?:\s*\.\s*\w+)*\b/.source.replace(//g,function(){return n.source});t.languages.cpp=t.languages.extend("c",{"class-name":[{pattern:RegExp(/(\b(?:class|concept|enum|struct|typename)\s+)(?!)\w+/.source.replace(//g,function(){return n.source})),lookbehind:!0},/\b[A-Z]\w*(?=\s*::\s*\w+\s*\()/,/\b[A-Z_]\w*(?=\s*::\s*~\w+\s*\()/i,/\b\w+(?=\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>\s*::\s*\w+\s*\()/],keyword:n,number:{pattern:/(?:\b0b[01']+|\b0x(?:[\da-f']+(?:\.[\da-f']*)?|\.[\da-f']+)(?:p[+-]?[\d']+)?|(?:\b[\d']+(?:\.[\d']*)?|\B\.[\d']+)(?:e[+-]?[\d']+)?)[ful]{0,4}/i,greedy:!0},operator:/>>=?|<<=?|->|--|\+\+|&&|\|\||[?:~]|<=>|[-+*/%&|^!=<>]=?|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/,boolean:/\b(?:false|true)\b/}),t.languages.insertBefore("cpp","string",{module:{pattern:RegExp(/(\b(?:import|module)\s+)/.source+"(?:"+/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|<[^<>\r\n]*>/.source+"|"+/(?:\s*:\s*)?|:\s*/.source.replace(//g,function(){return r})+")"),lookbehind:!0,greedy:!0,inside:{string:/^[<"][\s\S]+/,operator:/:/,punctuation:/\./}},"raw-string":{pattern:/R"([^()\\ ]{0,16})\([\s\S]*?\)\1"/,alias:"string",greedy:!0}}),t.languages.insertBefore("cpp","keyword",{"generic-function":{pattern:/\b(?!operator\b)[a-z_]\w*\s*<(?:[^<>]|<[^<>]*>)*>(?=\s*\()/i,inside:{function:/^\w+/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:t.languages.cpp}}}}),t.languages.insertBefore("cpp","operator",{"double-colon":{pattern:/::/,alias:"punctuation"}}),t.languages.insertBefore("cpp","class-name",{"base-clause":{pattern:/(\b(?:class|struct)\s+\w+\s*:\s*)[^;{}"'\s]+(?:\s+[^;{}"'\s]+)*(?=\s*[;{])/,lookbehind:!0,greedy:!0,inside:t.languages.extend("cpp",{})}}),t.languages.insertBefore("inside","double-colon",{"class-name":/\b[a-z_]\w*\b(?!\s*::)/i},t.languages.cpp["base-clause"])})(e)}Pg.displayName="arduino";Pg.aliases=["ino"];function Pg(e){e.register(Ku),e.languages.arduino=e.languages.extend("cpp",{keyword:/\b(?:String|array|bool|boolean|break|byte|case|catch|continue|default|do|double|else|finally|for|function|goto|if|in|instanceof|int|integer|long|loop|new|null|return|setup|string|switch|throw|try|void|while|word)\b/,constant:/\b(?:ANALOG_MESSAGE|DEFAULT|DIGITAL_MESSAGE|EXTERNAL|FIRMATA_STRING|HIGH|INPUT|INPUT_PULLUP|INTERNAL|INTERNAL1V1|INTERNAL2V56|LED_BUILTIN|LOW|OUTPUT|REPORT_ANALOG|REPORT_DIGITAL|SET_PIN_MODE|SYSEX_START|SYSTEM_RESET)\b/,builtin:/\b(?:Audio|BSSID|Bridge|Client|Console|EEPROM|Esplora|EsploraTFT|Ethernet|EthernetClient|EthernetServer|EthernetUDP|File|FileIO|FileSystem|Firmata|GPRS|GSM|GSMBand|GSMClient|GSMModem|GSMPIN|GSMScanner|GSMServer|GSMVoiceCall|GSM_SMS|HttpClient|IPAddress|IRread|Keyboard|KeyboardController|LiquidCrystal|LiquidCrystal_I2C|Mailbox|Mouse|MouseController|PImage|Process|RSSI|RobotControl|RobotMotor|SD|SPI|SSID|Scheduler|Serial|Server|Servo|SoftwareSerial|Stepper|Stream|TFT|Task|USBHost|WiFi|WiFiClient|WiFiServer|WiFiUDP|Wire|YunClient|YunServer|abs|addParameter|analogRead|analogReadResolution|analogReference|analogWrite|analogWriteResolution|answerCall|attach|attachGPRS|attachInterrupt|attached|autoscroll|available|background|beep|begin|beginPacket|beginSD|beginSMS|beginSpeaker|beginTFT|beginTransmission|beginWrite|bit|bitClear|bitRead|bitSet|bitWrite|blink|blinkVersion|buffer|changePIN|checkPIN|checkPUK|checkReg|circle|cityNameRead|cityNameWrite|clear|clearScreen|click|close|compassRead|config|connect|connected|constrain|cos|countryNameRead|countryNameWrite|createChar|cursor|debugPrint|delay|delayMicroseconds|detach|detachInterrupt|digitalRead|digitalWrite|disconnect|display|displayLogos|drawBMP|drawCompass|encryptionType|end|endPacket|endSMS|endTransmission|endWrite|exists|exitValue|fill|find|findUntil|flush|gatewayIP|get|getAsynchronously|getBand|getButton|getCurrentCarrier|getIMEI|getKey|getModifiers|getOemKey|getPINUsed|getResult|getSignalStrength|getSocket|getVoiceCallStatus|getXChange|getYChange|hangCall|height|highByte|home|image|interrupts|isActionDone|isDirectory|isListening|isPIN|isPressed|isValid|keyPressed|keyReleased|keyboardRead|knobRead|leftToRight|line|lineFollowConfig|listen|listenOnLocalhost|loadImage|localIP|lowByte|macAddress|maintain|map|max|messageAvailable|micros|millis|min|mkdir|motorsStop|motorsWrite|mouseDragged|mouseMoved|mousePressed|mouseReleased|move|noAutoscroll|noBlink|noBuffer|noCursor|noDisplay|noFill|noInterrupts|noListenOnLocalhost|noStroke|noTone|onReceive|onRequest|open|openNextFile|overflow|parseCommand|parseFloat|parseInt|parsePacket|pauseMode|peek|pinMode|playFile|playMelody|point|pointTo|position|pow|prepare|press|print|printFirmwareVersion|printVersion|println|process|processInput|pulseIn|put|random|randomSeed|read|readAccelerometer|readBlue|readButton|readBytes|readBytesUntil|readGreen|readJoystickButton|readJoystickSwitch|readJoystickX|readJoystickY|readLightSensor|readMessage|readMicrophone|readNetworks|readRed|readSlider|readString|readStringUntil|readTemperature|ready|rect|release|releaseAll|remoteIP|remoteNumber|remotePort|remove|requestFrom|retrieveCallingNumber|rewindDirectory|rightToLeft|rmdir|robotNameRead|robotNameWrite|run|runAsynchronously|runShellCommand|runShellCommandAsynchronously|running|scanNetworks|scrollDisplayLeft|scrollDisplayRight|seek|sendAnalog|sendDigitalPortPair|sendDigitalPorts|sendString|sendSysex|serialEvent|setBand|setBitOrder|setClockDivider|setCursor|setDNS|setDataMode|setFirmwareVersion|setMode|setPINUsed|setSpeed|setTextSize|setTimeout|shiftIn|shiftOut|shutdown|sin|size|sqrt|startLoop|step|stop|stroke|subnetMask|switchPIN|tan|tempoWrite|text|tone|transfer|tuneWrite|turn|updateIR|userNameRead|userNameWrite|voiceCall|waitContinue|width|write|writeBlue|writeGreen|writeJSON|writeMessage|writeMicroseconds|writeRGB|writeRed|yield)\b/}),e.languages.ino=e.languages.arduino}Ug.displayName="bash";Ug.aliases=["sh","shell"];function Ug(e){(function(t){var n="\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b",r={pattern:/(^(["']?)\w+\2)[ \t]+\S.*/,lookbehind:!0,alias:"punctuation",inside:null},a={bash:r,environment:{pattern:RegExp("\\$"+n),alias:"constant"},variable:[{pattern:/\$?\(\([\s\S]+?\)\)/,greedy:!0,inside:{variable:[{pattern:/(^\$\(\([\s\S]+)\)\)/,lookbehind:!0},/^\$\(\(/],number:/\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,operator:/--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,punctuation:/\(\(?|\)\)?|,|;/}},{pattern:/\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,greedy:!0,inside:{variable:/^\$\(|^`|\)$|`$/}},{pattern:/\$\{[^}]+\}/,greedy:!0,inside:{operator:/:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,punctuation:/[\[\]]/,environment:{pattern:RegExp("(\\{)"+n),lookbehind:!0,alias:"constant"}}},/\$(?:\w+|[#?*!@$])/],entity:/\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/};t.languages.bash={shebang:{pattern:/^#!\s*\/.*/,alias:"important"},comment:{pattern:/(^|[^"{\\$])#.*/,lookbehind:!0},"function-name":[{pattern:/(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,lookbehind:!0,alias:"function"},{pattern:/\b[\w-]+(?=\s*\(\s*\)\s*\{)/,alias:"function"}],"for-or-select":{pattern:/(\b(?:for|select)\s+)\w+(?=\s+in\s)/,alias:"variable",lookbehind:!0},"assign-left":{pattern:/(^|[\s;|&]|[<>]\()\w+(?:\.\w+)*(?=\+?=)/,inside:{environment:{pattern:RegExp("(^|[\\s;|&]|[<>]\\()"+n),lookbehind:!0,alias:"constant"}},alias:"variable",lookbehind:!0},parameter:{pattern:/(^|\s)-{1,2}(?:\w+:[+-]?)?\w+(?:\.\w+)*(?=[=\s]|$)/,alias:"variable",lookbehind:!0},string:[{pattern:/((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,lookbehind:!0,greedy:!0,inside:a},{pattern:/((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,lookbehind:!0,greedy:!0,inside:{bash:r}},{pattern:/(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,lookbehind:!0,greedy:!0,inside:a},{pattern:/(^|[^$\\])'[^']*'/,lookbehind:!0,greedy:!0},{pattern:/\$'(?:[^'\\]|\\[\s\S])*'/,greedy:!0,inside:{entity:a.entity}}],environment:{pattern:RegExp("\\$?"+n),alias:"constant"},variable:a.variable,function:{pattern:/(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cargo|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|java|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|sysctl|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,lookbehind:!0},keyword:{pattern:/(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,lookbehind:!0},builtin:{pattern:/(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,lookbehind:!0,alias:"class-name"},boolean:{pattern:/(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,lookbehind:!0},"file-descriptor":{pattern:/\B&\d\b/,alias:"important"},operator:{pattern:/\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,inside:{"file-descriptor":{pattern:/^\d/,alias:"important"}}},punctuation:/\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,number:{pattern:/(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,lookbehind:!0}},r.inside=t.languages.bash;for(var l=["comment","function-name","for-or-select","assign-left","parameter","string","environment","function","keyword","builtin","boolean","file-descriptor","operator","punctuation","number"],u=a.variable[1].inside,o=0;o>/g,function($,U){return"(?:"+j[+U]+")"})}function r(L,j,$){return RegExp(n(L,j),"")}function a(L,j){for(var $=0;$>/g,function(){return"(?:"+L+")"});return L.replace(/<>/g,"[^\\s\\S]")}var l={type:"bool byte char decimal double dynamic float int long object sbyte short string uint ulong ushort var void",typeDeclaration:"class enum interface record struct",contextual:"add alias and ascending async await by descending from(?=\\s*(?:\\w|$)) get global group into init(?=\\s*;) join let nameof not notnull on or orderby partial remove select set unmanaged value when where with(?=\\s*{)",other:"abstract as base break case catch checked const continue default delegate do else event explicit extern finally fixed for foreach goto if implicit in internal is lock namespace new null operator out override params private protected public readonly ref return sealed sizeof stackalloc static switch this throw try typeof unchecked unsafe using virtual volatile while yield"};function u(L){return"\\b(?:"+L.trim().replace(/ /g,"|")+")\\b"}var o=u(l.typeDeclaration),c=RegExp(u(l.type+" "+l.typeDeclaration+" "+l.contextual+" "+l.other)),f=u(l.typeDeclaration+" "+l.contextual+" "+l.other),p=u(l.type+" "+l.typeDeclaration+" "+l.other),d=a(/<(?:[^<>;=+\-*/%&|^]|<>)*>/.source,2),_=a(/\((?:[^()]|<>)*\)/.source,2),v=/@?\b[A-Za-z_]\w*\b/.source,w=n(/<<0>>(?:\s*<<1>>)?/.source,[v,d]),C=n(/(?!<<0>>)<<1>>(?:\s*\.\s*<<1>>)*/.source,[f,w]),y=/\[\s*(?:,\s*)*\]/.source,S=n(/<<0>>(?:\s*(?:\?\s*)?<<1>>)*(?:\s*\?)?/.source,[C,y]),x=n(/[^,()<>[\];=+\-*/%&|^]|<<0>>|<<1>>|<<2>>/.source,[d,_,y]),b=n(/\(<<0>>+(?:,<<0>>+)+\)/.source,[x]),k=n(/(?:<<0>>|<<1>>)(?:\s*(?:\?\s*)?<<2>>)*(?:\s*\?)?/.source,[b,C,y]),D={keyword:c,punctuation:/[<>()?,.:[\]]/},T=/'(?:[^\r\n'\\]|\\.|\\[Uux][\da-fA-F]{1,8})'/.source,R=/"(?:\\.|[^\\"\r\n])*"/.source,N=/@"(?:""|\\[\s\S]|[^\\"])*"(?!")/.source;t.languages.csharp=t.languages.extend("clike",{string:[{pattern:r(/(^|[^$\\])<<0>>/.source,[N]),lookbehind:!0,greedy:!0},{pattern:r(/(^|[^@$\\])<<0>>/.source,[R]),lookbehind:!0,greedy:!0}],"class-name":[{pattern:r(/(\busing\s+static\s+)<<0>>(?=\s*;)/.source,[C]),lookbehind:!0,inside:D},{pattern:r(/(\busing\s+<<0>>\s*=\s*)<<1>>(?=\s*;)/.source,[v,k]),lookbehind:!0,inside:D},{pattern:r(/(\busing\s+)<<0>>(?=\s*=)/.source,[v]),lookbehind:!0},{pattern:r(/(\b<<0>>\s+)<<1>>/.source,[o,w]),lookbehind:!0,inside:D},{pattern:r(/(\bcatch\s*\(\s*)<<0>>/.source,[C]),lookbehind:!0,inside:D},{pattern:r(/(\bwhere\s+)<<0>>/.source,[v]),lookbehind:!0},{pattern:r(/(\b(?:is(?:\s+not)?|as)\s+)<<0>>/.source,[S]),lookbehind:!0,inside:D},{pattern:r(/\b<<0>>(?=\s+(?!<<1>>|with\s*\{)<<2>>(?:\s*[=,;:{)\]]|\s+(?:in|when)\b))/.source,[k,p,v]),inside:D}],keyword:c,number:/(?:\b0(?:x[\da-f_]*[\da-f]|b[01_]*[01])|(?:\B\.\d+(?:_+\d+)*|\b\d+(?:_+\d+)*(?:\.\d+(?:_+\d+)*)?)(?:e[-+]?\d+(?:_+\d+)*)?)(?:[dflmu]|lu|ul)?\b/i,operator:/>>=?|<<=?|[-=]>|([-+&|])\1|~|\?\?=?|[-+*/%&|^!=<>]=?/,punctuation:/\?\.?|::|[{}[\];(),.:]/}),t.languages.insertBefore("csharp","number",{range:{pattern:/\.\./,alias:"operator"}}),t.languages.insertBefore("csharp","punctuation",{"named-parameter":{pattern:r(/([(,]\s*)<<0>>(?=\s*:)/.source,[v]),lookbehind:!0,alias:"punctuation"}}),t.languages.insertBefore("csharp","class-name",{namespace:{pattern:r(/(\b(?:namespace|using)\s+)<<0>>(?:\s*\.\s*<<0>>)*(?=\s*[;{])/.source,[v]),lookbehind:!0,inside:{punctuation:/\./}},"type-expression":{pattern:r(/(\b(?:default|sizeof|typeof)\s*\(\s*(?!\s))(?:[^()\s]|\s(?!\s)|<<0>>)*(?=\s*\))/.source,[_]),lookbehind:!0,alias:"class-name",inside:D},"return-type":{pattern:r(/<<0>>(?=\s+(?:<<1>>\s*(?:=>|[({]|\.\s*this\s*\[)|this\s*\[))/.source,[k,C]),inside:D,alias:"class-name"},"constructor-invocation":{pattern:r(/(\bnew\s+)<<0>>(?=\s*[[({])/.source,[k]),lookbehind:!0,inside:D,alias:"class-name"},"generic-method":{pattern:r(/<<0>>\s*<<1>>(?=\s*\()/.source,[v,d]),inside:{function:r(/^<<0>>/.source,[v]),generic:{pattern:RegExp(d),alias:"class-name",inside:D}}},"type-list":{pattern:r(/\b((?:<<0>>\s+<<1>>|record\s+<<1>>\s*<<5>>|where\s+<<2>>)\s*:\s*)(?:<<3>>|<<4>>|<<1>>\s*<<5>>|<<6>>)(?:\s*,\s*(?:<<3>>|<<4>>|<<6>>))*(?=\s*(?:where|[{;]|=>|$))/.source,[o,w,v,k,c.source,_,/\bnew\s*\(\s*\)/.source]),lookbehind:!0,inside:{"record-arguments":{pattern:r(/(^(?!new\s*\()<<0>>\s*)<<1>>/.source,[w,_]),lookbehind:!0,greedy:!0,inside:t.languages.csharp},keyword:c,"class-name":{pattern:RegExp(k),greedy:!0,inside:D},punctuation:/[,()]/}},preprocessor:{pattern:/(^[\t ]*)#.*/m,lookbehind:!0,alias:"property",inside:{directive:{pattern:/(#)\b(?:define|elif|else|endif|endregion|error|if|line|nullable|pragma|region|undef|warning)\b/,lookbehind:!0,alias:"keyword"}}}});var M=R+"|"+T,B=n(/\/(?![*/])|\/\/[^\r\n]*[\r\n]|\/\*(?:[^*]|\*(?!\/))*\*\/|<<0>>/.source,[M]),H=a(n(/[^"'/()]|<<0>>|\(<>*\)/.source,[B]),2),Y=/\b(?:assembly|event|field|method|module|param|property|return|type)\b/.source,F=n(/<<0>>(?:\s*\(<<1>>*\))?/.source,[C,H]);t.languages.insertBefore("csharp","class-name",{attribute:{pattern:r(/((?:^|[^\s\w>)?])\s*\[\s*)(?:<<0>>\s*:\s*)?<<1>>(?:\s*,\s*<<1>>)*(?=\s*\])/.source,[Y,F]),lookbehind:!0,greedy:!0,inside:{target:{pattern:r(/^<<0>>(?=\s*:)/.source,[Y]),alias:"keyword"},"attribute-arguments":{pattern:r(/\(<<0>>*\)/.source,[H]),inside:t.languages.csharp},"class-name":{pattern:RegExp(C),inside:{punctuation:/\./}},punctuation:/[:,]/}}});var z=/:[^}\r\n]+/.source,q=a(n(/[^"'/()]|<<0>>|\(<>*\)/.source,[B]),2),G=n(/\{(?!\{)(?:(?![}:])<<0>>)*<<1>>?\}/.source,[q,z]),X=a(n(/[^"'/()]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|<<0>>|\(<>*\)/.source,[M]),2),K=n(/\{(?!\{)(?:(?![}:])<<0>>)*<<1>>?\}/.source,[X,z]);function O(L,j){return{interpolation:{pattern:r(/((?:^|[^{])(?:\{\{)*)<<0>>/.source,[L]),lookbehind:!0,inside:{"format-string":{pattern:r(/(^\{(?:(?![}:])<<0>>)*)<<1>>(?=\}$)/.source,[j,z]),lookbehind:!0,inside:{punctuation:/^:/}},punctuation:/^\{|\}$/,expression:{pattern:/[\s\S]+/,alias:"language-csharp",inside:t.languages.csharp}}},string:/[\s\S]+/}}t.languages.insertBefore("csharp","string",{"interpolation-string":[{pattern:r(/(^|[^\\])(?:\$@|@\$)"(?:""|\\[\s\S]|\{\{|<<0>>|[^\\{"])*"/.source,[G]),lookbehind:!0,greedy:!0,inside:O(G,q)},{pattern:r(/(^|[^@\\])\$"(?:\\.|\{\{|<<0>>|[^\\"{])*"/.source,[K]),lookbehind:!0,greedy:!0,inside:O(K,X)}],char:{pattern:RegExp(T),greedy:!0}}),t.languages.dotnet=t.languages.cs=t.languages.csharp})(e)}ol.displayName="markup";ol.aliases=["atom","html","mathml","rss","ssml","svg","xml"];function ol(e){e.languages.markup={comment:{pattern://,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern://i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},e.languages.markup.tag.inside["attr-value"].inside.entity=e.languages.markup.entity,e.languages.markup.doctype.inside["internal-subset"].inside=e.languages.markup,e.hooks.add("wrap",function(t){t.type==="entity"&&(t.attributes.title=t.content.value.replace(/&/,"&"))}),Object.defineProperty(e.languages.markup.tag,"addInlined",{value:function(n,r){var a={};a["language-"+r]={pattern:/(^$)/i,lookbehind:!0,inside:e.languages[r]},a.cdata=/^$/i;var l={"included-cdata":{pattern://i,inside:a}};l["language-"+r]={pattern:/[\s\S]+/,inside:e.languages[r]};var u={};u[n]={pattern:RegExp(/(<__[^>]*>)(?:))*\]\]>|(?!)/.source.replace(/__/g,function(){return n}),"i"),lookbehind:!0,greedy:!0,inside:l},e.languages.insertBefore("markup","cdata",u)}}),Object.defineProperty(e.languages.markup.tag,"addAttribute",{value:function(t,n){e.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+t+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[n,"language-"+n],inside:e.languages[n]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),e.languages.html=e.languages.markup,e.languages.mathml=e.languages.markup,e.languages.svg=e.languages.markup,e.languages.xml=e.languages.extend("markup",{}),e.languages.ssml=e.languages.xml,e.languages.atom=e.languages.xml,e.languages.rss=e.languages.xml}ya.displayName="css";ya.aliases=[];function ya(e){(function(t){var n=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;t.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+n.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+n.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+n.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+n.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:n,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},t.languages.css.atrule.inside.rest=t.languages.css;var r=t.languages.markup;r&&(r.tag.addInlined("style","css"),r.tag.addAttribute("style","css"))})(e)}Gg.displayName="diff";Gg.aliases=[];function Gg(e){(function(t){t.languages.diff={coord:[/^(?:\*{3}|-{3}|\+{3}).*$/m,/^@@.*@@$/m,/^\d.*$/m]};var n={"deleted-sign":"-","deleted-arrow":"<","inserted-sign":"+","inserted-arrow":">",unchanged:" ",diff:"!"};Object.keys(n).forEach(function(r){var a=n[r],l=[];/^\w+$/.test(r)||l.push(/\w+/.exec(r)[0]),r==="diff"&&l.push("bold"),t.languages.diff[r]={pattern:RegExp("^(?:["+a+`].*(?:\r +`,...l.current()});return/^[\t ]/.test(f)&&(f=Fo(f.charCodeAt(0))+f.slice(1)),f=f?u+" "+f:u,n.options.closeAtx&&(f+=" "+u),c(),o(),f}Px.peek=RR;function Px(e){return e.value||""}function RR(){return"<"}Ux.peek=MR;function Ux(e,t,n,r){const a=zg(n),l=a==='"'?"Quote":"Apostrophe",u=n.enter("image");let o=n.enter("label");const c=n.createTracker(r);let f=c.move("![");return f+=c.move(n.safe(e.alt,{before:f,after:"]",...c.current()})),f+=c.move("]("),o(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(o=n.enter("destinationLiteral"),f+=c.move("<"),f+=c.move(n.safe(e.url,{before:f,after:">",...c.current()})),f+=c.move(">")):(o=n.enter("destinationRaw"),f+=c.move(n.safe(e.url,{before:f,after:e.title?" ":")",...c.current()}))),o(),e.title&&(o=n.enter(`title${l}`),f+=c.move(" "+a),f+=c.move(n.safe(e.title,{before:f,after:a,...c.current()})),f+=c.move(a),o()),f+=c.move(")"),u(),f}function MR(){return"!"}$x.peek=LR;function $x(e,t,n,r){const a=e.referenceType,l=n.enter("imageReference");let u=n.enter("label");const o=n.createTracker(r);let c=o.move("![");const f=n.safe(e.alt,{before:c,after:"]",...o.current()});c+=o.move(f+"]["),u();const p=n.stack;n.stack=[],u=n.enter("reference");const d=n.safe(n.associationId(e),{before:c,after:"]",...o.current()});return u(),n.stack=p,l(),a==="full"||!f||f!==d?c+=o.move(d+"]"):a==="shortcut"?c=c.slice(0,-1):c+=o.move("]"),c}function LR(){return"!"}Gx.peek=OR;function Gx(e,t,n){let r=e.value||"",a="`",l=-1;for(;new RegExp("(^|[^`])"+a+"([^`]|$)").test(r);)a+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++l\u007F]/.test(e.url))}Vx.peek=jR;function Vx(e,t,n,r){const a=zg(n),l=a==='"'?"Quote":"Apostrophe",u=n.createTracker(r);let o,c;if(qx(e,n)){const p=n.stack;n.stack=[],o=n.enter("autolink");let d=u.move("<");return d+=u.move(n.containerPhrasing(e,{before:d,after:">",...u.current()})),d+=u.move(">"),o(),n.stack=p,d}o=n.enter("link"),c=n.enter("label");let f=u.move("[");return f+=u.move(n.containerPhrasing(e,{before:f,after:"](",...u.current()})),f+=u.move("]("),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter("destinationLiteral"),f+=u.move("<"),f+=u.move(n.safe(e.url,{before:f,after:">",...u.current()})),f+=u.move(">")):(c=n.enter("destinationRaw"),f+=u.move(n.safe(e.url,{before:f,after:e.title?" ":")",...u.current()}))),c(),e.title&&(c=n.enter(`title${l}`),f+=u.move(" "+a),f+=u.move(n.safe(e.title,{before:f,after:a,...u.current()})),f+=u.move(a),c()),f+=u.move(")"),o(),f}function jR(e,t,n){return qx(e,n)?"<":"["}Yx.peek=BR;function Yx(e,t,n,r){const a=e.referenceType,l=n.enter("linkReference");let u=n.enter("label");const o=n.createTracker(r);let c=o.move("[");const f=n.containerPhrasing(e,{before:c,after:"]",...o.current()});c+=o.move(f+"]["),u();const p=n.stack;n.stack=[],u=n.enter("reference");const d=n.safe(n.associationId(e),{before:c,after:"]",...o.current()});return u(),n.stack=p,l(),a==="full"||!f||f!==d?c+=o.move(d+"]"):a==="shortcut"?c=c.slice(0,-1):c+=o.move("]"),c}function BR(){return"["}function Hg(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function IR(e){const t=Hg(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function zR(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function Wx(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function HR(e,t,n,r){const a=n.enter("list"),l=n.bulletCurrent;let u=e.ordered?zR(n):Hg(n);const o=e.ordered?u==="."?")":".":IR(n);let c=t&&n.bulletLastUsed?u===n.bulletLastUsed:!1;if(!e.ordered){const p=e.children?e.children[0]:void 0;if((u==="*"||u==="-")&&p&&(!p.children||!p.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(c=!0),Wx(n)===u&&p){let d=-1;for(;++d-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+l);let u=l.length+1;(a==="tab"||a==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(u=Math.ceil(u/4)*4);const o=n.createTracker(r);o.move(l+" ".repeat(u-l.length)),o.shift(u);const c=n.enter("listItem"),f=n.indentLines(n.containerFlow(e,o.current()),p);return c(),f;function p(d,_,v){return _?(v?"":" ".repeat(u))+d:(v?l:l+" ".repeat(u-l.length))+d}}function UR(e,t,n,r){const a=n.enter("paragraph"),l=n.enter("phrasing"),u=n.containerPhrasing(e,r);return l(),a(),u}const $R=Yu(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function GR(e,t,n,r){return(e.children.some(function(u){return $R(u)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function qR(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}Xx.peek=VR;function Xx(e,t,n,r){const a=qR(n),l=n.enter("strong"),u=n.createTracker(r),o=u.move(a+a);let c=u.move(n.containerPhrasing(e,{after:a,before:o,...u.current()}));const f=c.charCodeAt(0),p=Cu(r.before.charCodeAt(r.before.length-1),f,a);p.inside&&(c=Fo(f)+c.slice(1));const d=c.charCodeAt(c.length-1),_=Cu(r.after.charCodeAt(0),d,a);_.inside&&(c=c.slice(0,-1)+Fo(d));const v=u.move(a+a);return l(),n.attentionEncodeSurroundingInfo={after:_.outside,before:p.outside},o+c+v}function VR(e,t,n){return n.options.strong||"*"}function YR(e,t,n,r){return n.safe(e.value,r)}function WR(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function XR(e,t,n){const r=(Wx(n)+(n.options.ruleSpaces?" ":"")).repeat(WR(n));return n.options.ruleSpaces?r.slice(0,-1):r}const Kx={blockquote:vR,break:k1,code:CR,definition:kR,emphasis:Fx,hardBreak:k1,heading:DR,html:Px,image:Ux,imageReference:$x,inlineCode:Gx,link:Vx,linkReference:Yx,list:HR,listItem:PR,paragraph:UR,root:GR,strong:Xx,text:YR,thematicBreak:XR};function KR(){return{enter:{table:ZR,tableData:A1,tableHeader:A1,tableRow:JR},exit:{codeText:eM,table:QR,tableData:op,tableHeader:op,tableRow:op}}}function ZR(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function QR(e){this.exit(e),this.data.inTable=void 0}function JR(e){this.enter({type:"tableRow",children:[]},e)}function op(e){this.exit(e)}function A1(e){this.enter({type:"tableCell",children:[]},e)}function eM(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,tM));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function tM(e,t){return t==="|"?t:e}function nM(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,a=t.stringLength,l=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:` +`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:_,table:u,tableCell:c,tableRow:o}};function u(v,w,C,b){return f(p(v,C,b),v.align)}function o(v,w,C,b){const S=d(v,C,b),x=f([S]);return x.slice(0,x.indexOf(` +`))}function c(v,w,C,b){const S=C.enter("tableCell"),x=C.enter("phrasing"),y=C.containerPhrasing(v,{...b,before:l,after:l});return x(),S(),y}function f(v,w){return mR(v,{align:w,alignDelimiters:r,padding:n,stringLength:a})}function p(v,w,C){const b=v.children;let S=-1;const x=[],y=w.enter("table");for(;++S0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const bM={tokenize:TM,partial:!0};function SM(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:EM,continuation:{tokenize:kM},exit:AM}},text:{91:{name:"gfmFootnoteCall",tokenize:CM},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:xM,resolveTo:wM}}}}function xM(e,t,n){const r=this;let a=r.events.length;const l=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let u;for(;a--;){const c=r.events[a][1];if(c.type==="labelImage"){u=c;break}if(c.type==="gfmFootnoteCall"||c.type==="labelLink"||c.type==="label"||c.type==="image"||c.type==="link")break}return o;function o(c){if(!u||!u._balanced)return n(c);const f=Qn(r.sliceSerialize({start:u.end,end:r.now()}));return f.codePointAt(0)!==94||!l.includes(f.slice(1))?n(c):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),t(c))}}function wM(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},a={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};a.end.column++,a.end.offset++,a.end._bufferIndex++;const l={type:"gfmFootnoteCallString",start:Object.assign({},a.end),end:Object.assign({},e[e.length-1][1].start)},u={type:"chunkString",contentType:"string",start:Object.assign({},l.start),end:Object.assign({},l.end)},o=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",a,t],["exit",a,t],["enter",l,t],["enter",u,t],["exit",u,t],["exit",l,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...o),e}function CM(e,t,n){const r=this,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let l=0,u;return o;function o(d){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(d),e.exit("gfmFootnoteCallLabelMarker"),c}function c(d){return d!==94?n(d):(e.enter("gfmFootnoteCallMarker"),e.consume(d),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",f)}function f(d){if(l>999||d===93&&!u||d===null||d===91||yt(d))return n(d);if(d===93){e.exit("chunkString");const _=e.exit("gfmFootnoteCallString");return a.includes(Qn(r.sliceSerialize(_)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(d),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(d)}return yt(d)||(u=!0),l++,e.consume(d),d===92?p:f}function p(d){return d===91||d===92||d===93?(e.consume(d),l++,f):f(d)}}function EM(e,t,n){const r=this,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let l,u=0,o;return c;function c(w){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(w),e.exit("gfmFootnoteDefinitionLabelMarker"),f}function f(w){return w===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(w),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",p):n(w)}function p(w){if(u>999||w===93&&!o||w===null||w===91||yt(w))return n(w);if(w===93){e.exit("chunkString");const C=e.exit("gfmFootnoteDefinitionLabelString");return l=Qn(r.sliceSerialize(C)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(w),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),_}return yt(w)||(o=!0),u++,e.consume(w),w===92?d:p}function d(w){return w===91||w===92||w===93?(e.consume(w),u++,p):p(w)}function _(w){return w===58?(e.enter("definitionMarker"),e.consume(w),e.exit("definitionMarker"),a.includes(l)||a.push(l),tt(e,v,"gfmFootnoteDefinitionWhitespace")):n(w)}function v(w){return t(w)}}function kM(e,t,n){return e.check(il,t,e.attempt(bM,t,n))}function AM(e){e.exit("gfmFootnoteDefinition")}function TM(e,t,n){const r=this;return tt(e,a,"gfmFootnoteDefinitionIndent",5);function a(l){const u=r.events[r.events.length-1];return u&&u[1].type==="gfmFootnoteDefinitionIndent"&&u[2].sliceSerialize(u[1],!0).length===4?t(l):n(l)}}function NM(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:l,resolveAll:a};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function a(u,o){let c=-1;for(;++c1?c(w):(u.consume(w),d++,v);if(d<2&&!n)return c(w);const b=u.exit("strikethroughSequenceTemporary"),S=sa(w);return b._open=!S||S===2&&!!C,b._close=!C||C===2&&!!S,o(w)}}}class DM{constructor(){this.map=[]}add(t,n,r){RM(this,t,n,r)}consume(t){if(this.map.sort(function(l,u){return l[0]-u[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let a=r.pop();for(;a;){for(const l of a)t.push(l);a=r.pop()}this.map.length=0}}function RM(e,t,n,r){let a=0;if(!(n===0&&r.length===0)){for(;a-1;){const z=r.events[H][1].type;if(z==="lineEnding"||z==="linePrefix")H--;else break}const Y=H>-1?r.events[H][1].type:null,F=Y==="tableHead"||Y==="tableRow"?T:c;return F===T&&r.parser.lazy[r.now().line]?n(B):F(B)}function c(B){return e.enter("tableHead"),e.enter("tableRow"),f(B)}function f(B){return B===124||(u=!0,l+=1),p(B)}function p(B){return B===null?n(B):je(B)?l>1?(l=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(B),e.exit("lineEnding"),v):n(B):Ye(B)?tt(e,p,"whitespace")(B):(l+=1,u&&(u=!1,a+=1),B===124?(e.enter("tableCellDivider"),e.consume(B),e.exit("tableCellDivider"),u=!0,p):(e.enter("data"),d(B)))}function d(B){return B===null||B===124||yt(B)?(e.exit("data"),p(B)):(e.consume(B),B===92?_:d)}function _(B){return B===92||B===124?(e.consume(B),d):d(B)}function v(B){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(B):(e.enter("tableDelimiterRow"),u=!1,Ye(B)?tt(e,w,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(B):w(B))}function w(B){return B===45||B===58?b(B):B===124?(u=!0,e.enter("tableCellDivider"),e.consume(B),e.exit("tableCellDivider"),C):D(B)}function C(B){return Ye(B)?tt(e,b,"whitespace")(B):b(B)}function b(B){return B===58?(l+=1,u=!0,e.enter("tableDelimiterMarker"),e.consume(B),e.exit("tableDelimiterMarker"),S):B===45?(l+=1,S(B)):B===null||je(B)?k(B):D(B)}function S(B){return B===45?(e.enter("tableDelimiterFiller"),x(B)):D(B)}function x(B){return B===45?(e.consume(B),x):B===58?(u=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(B),e.exit("tableDelimiterMarker"),y):(e.exit("tableDelimiterFiller"),y(B))}function y(B){return Ye(B)?tt(e,k,"whitespace")(B):k(B)}function k(B){return B===124?w(B):B===null||je(B)?!u||a!==l?D(B):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(B)):D(B)}function D(B){return n(B)}function T(B){return e.enter("tableRow"),R(B)}function R(B){return B===124?(e.enter("tableCellDivider"),e.consume(B),e.exit("tableCellDivider"),R):B===null||je(B)?(e.exit("tableRow"),t(B)):Ye(B)?tt(e,R,"whitespace")(B):(e.enter("data"),N(B))}function N(B){return B===null||B===124||yt(B)?(e.exit("data"),R(B)):(e.consume(B),B===92?M:N)}function M(B){return B===92||B===124?(e.consume(B),N):N(B)}}function jM(e,t){let n=-1,r=!0,a=0,l=[0,0,0,0],u=[0,0,0,0],o=!1,c=0,f,p,d;const _=new DM;for(;++nn[2]+1){const w=n[2]+1,C=n[3]-n[2]-1;e.add(w,C,[])}}e.add(n[3]+1,0,[["exit",d,t]])}return a!==void 0&&(l.end=Object.assign({},Xs(t.events,a)),e.add(a,0,[["exit",l,t]]),l=void 0),l}function N1(e,t,n,r,a){const l=[],u=Xs(t.events,n);a&&(a.end=Object.assign({},u),l.push(["exit",a,t])),r.end=Object.assign({},u),l.push(["exit",r,t]),e.add(n+1,0,l)}function Xs(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const BM={name:"tasklistCheck",tokenize:zM};function IM(){return{text:{91:BM}}}function zM(e,t,n){const r=this;return a;function a(c){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(c):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),l)}function l(c){return yt(c)?(e.enter("taskListCheckValueUnchecked"),e.consume(c),e.exit("taskListCheckValueUnchecked"),u):c===88||c===120?(e.enter("taskListCheckValueChecked"),e.consume(c),e.exit("taskListCheckValueChecked"),u):n(c)}function u(c){return c===93?(e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),o):n(c)}function o(c){return je(c)?t(c):Ye(c)?e.check({tokenize:HM},t,n)(c):n(c)}}function HM(e,t,n){return tt(e,r,"whitespace");function r(a){return a===null?n(a):t(a)}}function FM(e){return dx([hM(),SM(),NM(e),LM(),IM()])}const PM={};function sw(e){const t=this,n=e||PM,r=t.data(),a=r.micromarkExtensions||(r.micromarkExtensions=[]),l=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),u=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);a.push(FM(n)),l.push(oM()),u.push(lM(n))}const UM={cjs:"javascript",console:"bash",cts:"typescript",fish:"bash",html:"markup",js:"javascript",jsx:"javascript",md:"markdown",mjs:"javascript",mts:"typescript",py:"python",rb:"ruby",sh:"bash",shell:"bash",svg:"markup",terminal:"bash",ts:"typescript",tsx:"typescript",xml:"markup",yml:"yaml",zsh:"bash"},$M={containerfile:"docker",dockerfile:"docker",justfile:"makefile",makefile:"makefile"};function Up(e){const t=e.trim().toLowerCase();return UM[t]??t}function aw(e){var a;if(!e)return null;const t=((a=e.split("/").pop())==null?void 0:a.toLowerCase())??"",n=$M[t];if(n)return Up(n);const r=t.lastIndexOf(".");return r===-1||r===t.length-1?null:Up(t.slice(r+1))}fi.displayName="clike";fi.aliases=[];function fi(e){e.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/}}sl.displayName="c";sl.aliases=[];function sl(e){e.register(fi),e.languages.c=e.languages.extend("clike",{comment:{pattern:/\/\/(?:[^\r\n\\]|\\(?:\r\n?|\n|(?![\r\n])))*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},string:{pattern:/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},"class-name":{pattern:/(\b(?:enum|struct)\s+(?:__attribute__\s*\(\([\s\S]*?\)\)\s*)?)\w+|\b[a-z]\w*_t\b/,lookbehind:!0},keyword:/\b(?:_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|__attribute__|asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|inline|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|typeof|union|unsigned|void|volatile|while)\b/,function:/\b[a-z_]\w*(?=\s*\()/i,number:/(?:\b0x(?:[\da-f]+(?:\.[\da-f]*)?|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)[ful]{0,4}/i,operator:/>>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?/}),e.languages.insertBefore("c","string",{char:{pattern:/'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n]){0,32}'/,greedy:!0}}),e.languages.insertBefore("c","string",{macro:{pattern:/(^[\t ]*)#\s*[a-z](?:[^\r\n\\/]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|\\(?:\r\n|[\s\S]))*/im,lookbehind:!0,greedy:!0,alias:"property",inside:{string:[{pattern:/^(#\s*include\s*)<[^>]+>/,lookbehind:!0},e.languages.c.string],char:e.languages.c.char,comment:e.languages.c.comment,"macro-name":[{pattern:/(^#\s*define\s+)\w+\b(?!\()/i,lookbehind:!0},{pattern:/(^#\s*define\s+)\w+\b(?=\()/i,lookbehind:!0,alias:"function"}],directive:{pattern:/^(#\s*)[a-z]+/,lookbehind:!0,alias:"keyword"},"directive-hash":/^#/,punctuation:/##|\\(?=[\r\n])/,expression:{pattern:/\S[\s\S]*/,inside:e.languages.c}}}}),e.languages.insertBefore("c","function",{constant:/\b(?:EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|__DATE__|__FILE__|__LINE__|__TIMESTAMP__|__TIME__|__func__|stderr|stdin|stdout)\b/}),delete e.languages.c.boolean}Xu.displayName="cpp";Xu.aliases=[];function Xu(e){e.register(sl),(function(t){var n=/\b(?:alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|char8_t|class|co_await|co_return|co_yield|compl|concept|const|const_cast|consteval|constexpr|constinit|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|final|float|for|friend|goto|if|import|inline|int|int16_t|int32_t|int64_t|int8_t|long|module|mutable|namespace|new|noexcept|nullptr|operator|override|private|protected|public|register|reinterpret_cast|requires|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|uint16_t|uint32_t|uint64_t|uint8_t|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/,r=/\b(?!)\w+(?:\s*\.\s*\w+)*\b/.source.replace(//g,function(){return n.source});t.languages.cpp=t.languages.extend("c",{"class-name":[{pattern:RegExp(/(\b(?:class|concept|enum|struct|typename)\s+)(?!)\w+/.source.replace(//g,function(){return n.source})),lookbehind:!0},/\b[A-Z]\w*(?=\s*::\s*\w+\s*\()/,/\b[A-Z_]\w*(?=\s*::\s*~\w+\s*\()/i,/\b\w+(?=\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>\s*::\s*\w+\s*\()/],keyword:n,number:{pattern:/(?:\b0b[01']+|\b0x(?:[\da-f']+(?:\.[\da-f']*)?|\.[\da-f']+)(?:p[+-]?[\d']+)?|(?:\b[\d']+(?:\.[\d']*)?|\B\.[\d']+)(?:e[+-]?[\d']+)?)[ful]{0,4}/i,greedy:!0},operator:/>>=?|<<=?|->|--|\+\+|&&|\|\||[?:~]|<=>|[-+*/%&|^!=<>]=?|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/,boolean:/\b(?:false|true)\b/}),t.languages.insertBefore("cpp","string",{module:{pattern:RegExp(/(\b(?:import|module)\s+)/.source+"(?:"+/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|<[^<>\r\n]*>/.source+"|"+/(?:\s*:\s*)?|:\s*/.source.replace(//g,function(){return r})+")"),lookbehind:!0,greedy:!0,inside:{string:/^[<"][\s\S]+/,operator:/:/,punctuation:/\./}},"raw-string":{pattern:/R"([^()\\ ]{0,16})\([\s\S]*?\)\1"/,alias:"string",greedy:!0}}),t.languages.insertBefore("cpp","keyword",{"generic-function":{pattern:/\b(?!operator\b)[a-z_]\w*\s*<(?:[^<>]|<[^<>]*>)*>(?=\s*\()/i,inside:{function:/^\w+/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:t.languages.cpp}}}}),t.languages.insertBefore("cpp","operator",{"double-colon":{pattern:/::/,alias:"punctuation"}}),t.languages.insertBefore("cpp","class-name",{"base-clause":{pattern:/(\b(?:class|struct)\s+\w+\s*:\s*)[^;{}"'\s]+(?:\s+[^;{}"'\s]+)*(?=\s*[;{])/,lookbehind:!0,greedy:!0,inside:t.languages.extend("cpp",{})}}),t.languages.insertBefore("inside","double-colon",{"class-name":/\b[a-z_]\w*\b(?!\s*::)/i},t.languages.cpp["base-clause"])})(e)}Pg.displayName="arduino";Pg.aliases=["ino"];function Pg(e){e.register(Xu),e.languages.arduino=e.languages.extend("cpp",{keyword:/\b(?:String|array|bool|boolean|break|byte|case|catch|continue|default|do|double|else|finally|for|function|goto|if|in|instanceof|int|integer|long|loop|new|null|return|setup|string|switch|throw|try|void|while|word)\b/,constant:/\b(?:ANALOG_MESSAGE|DEFAULT|DIGITAL_MESSAGE|EXTERNAL|FIRMATA_STRING|HIGH|INPUT|INPUT_PULLUP|INTERNAL|INTERNAL1V1|INTERNAL2V56|LED_BUILTIN|LOW|OUTPUT|REPORT_ANALOG|REPORT_DIGITAL|SET_PIN_MODE|SYSEX_START|SYSTEM_RESET)\b/,builtin:/\b(?:Audio|BSSID|Bridge|Client|Console|EEPROM|Esplora|EsploraTFT|Ethernet|EthernetClient|EthernetServer|EthernetUDP|File|FileIO|FileSystem|Firmata|GPRS|GSM|GSMBand|GSMClient|GSMModem|GSMPIN|GSMScanner|GSMServer|GSMVoiceCall|GSM_SMS|HttpClient|IPAddress|IRread|Keyboard|KeyboardController|LiquidCrystal|LiquidCrystal_I2C|Mailbox|Mouse|MouseController|PImage|Process|RSSI|RobotControl|RobotMotor|SD|SPI|SSID|Scheduler|Serial|Server|Servo|SoftwareSerial|Stepper|Stream|TFT|Task|USBHost|WiFi|WiFiClient|WiFiServer|WiFiUDP|Wire|YunClient|YunServer|abs|addParameter|analogRead|analogReadResolution|analogReference|analogWrite|analogWriteResolution|answerCall|attach|attachGPRS|attachInterrupt|attached|autoscroll|available|background|beep|begin|beginPacket|beginSD|beginSMS|beginSpeaker|beginTFT|beginTransmission|beginWrite|bit|bitClear|bitRead|bitSet|bitWrite|blink|blinkVersion|buffer|changePIN|checkPIN|checkPUK|checkReg|circle|cityNameRead|cityNameWrite|clear|clearScreen|click|close|compassRead|config|connect|connected|constrain|cos|countryNameRead|countryNameWrite|createChar|cursor|debugPrint|delay|delayMicroseconds|detach|detachInterrupt|digitalRead|digitalWrite|disconnect|display|displayLogos|drawBMP|drawCompass|encryptionType|end|endPacket|endSMS|endTransmission|endWrite|exists|exitValue|fill|find|findUntil|flush|gatewayIP|get|getAsynchronously|getBand|getButton|getCurrentCarrier|getIMEI|getKey|getModifiers|getOemKey|getPINUsed|getResult|getSignalStrength|getSocket|getVoiceCallStatus|getXChange|getYChange|hangCall|height|highByte|home|image|interrupts|isActionDone|isDirectory|isListening|isPIN|isPressed|isValid|keyPressed|keyReleased|keyboardRead|knobRead|leftToRight|line|lineFollowConfig|listen|listenOnLocalhost|loadImage|localIP|lowByte|macAddress|maintain|map|max|messageAvailable|micros|millis|min|mkdir|motorsStop|motorsWrite|mouseDragged|mouseMoved|mousePressed|mouseReleased|move|noAutoscroll|noBlink|noBuffer|noCursor|noDisplay|noFill|noInterrupts|noListenOnLocalhost|noStroke|noTone|onReceive|onRequest|open|openNextFile|overflow|parseCommand|parseFloat|parseInt|parsePacket|pauseMode|peek|pinMode|playFile|playMelody|point|pointTo|position|pow|prepare|press|print|printFirmwareVersion|printVersion|println|process|processInput|pulseIn|put|random|randomSeed|read|readAccelerometer|readBlue|readButton|readBytes|readBytesUntil|readGreen|readJoystickButton|readJoystickSwitch|readJoystickX|readJoystickY|readLightSensor|readMessage|readMicrophone|readNetworks|readRed|readSlider|readString|readStringUntil|readTemperature|ready|rect|release|releaseAll|remoteIP|remoteNumber|remotePort|remove|requestFrom|retrieveCallingNumber|rewindDirectory|rightToLeft|rmdir|robotNameRead|robotNameWrite|run|runAsynchronously|runShellCommand|runShellCommandAsynchronously|running|scanNetworks|scrollDisplayLeft|scrollDisplayRight|seek|sendAnalog|sendDigitalPortPair|sendDigitalPorts|sendString|sendSysex|serialEvent|setBand|setBitOrder|setClockDivider|setCursor|setDNS|setDataMode|setFirmwareVersion|setMode|setPINUsed|setSpeed|setTextSize|setTimeout|shiftIn|shiftOut|shutdown|sin|size|sqrt|startLoop|step|stop|stroke|subnetMask|switchPIN|tan|tempoWrite|text|tone|transfer|tuneWrite|turn|updateIR|userNameRead|userNameWrite|voiceCall|waitContinue|width|write|writeBlue|writeGreen|writeJSON|writeMessage|writeMicroseconds|writeRGB|writeRed|yield)\b/}),e.languages.ino=e.languages.arduino}Ug.displayName="bash";Ug.aliases=["sh","shell"];function Ug(e){(function(t){var n="\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b",r={pattern:/(^(["']?)\w+\2)[ \t]+\S.*/,lookbehind:!0,alias:"punctuation",inside:null},a={bash:r,environment:{pattern:RegExp("\\$"+n),alias:"constant"},variable:[{pattern:/\$?\(\([\s\S]+?\)\)/,greedy:!0,inside:{variable:[{pattern:/(^\$\(\([\s\S]+)\)\)/,lookbehind:!0},/^\$\(\(/],number:/\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,operator:/--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,punctuation:/\(\(?|\)\)?|,|;/}},{pattern:/\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,greedy:!0,inside:{variable:/^\$\(|^`|\)$|`$/}},{pattern:/\$\{[^}]+\}/,greedy:!0,inside:{operator:/:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,punctuation:/[\[\]]/,environment:{pattern:RegExp("(\\{)"+n),lookbehind:!0,alias:"constant"}}},/\$(?:\w+|[#?*!@$])/],entity:/\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/};t.languages.bash={shebang:{pattern:/^#!\s*\/.*/,alias:"important"},comment:{pattern:/(^|[^"{\\$])#.*/,lookbehind:!0},"function-name":[{pattern:/(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,lookbehind:!0,alias:"function"},{pattern:/\b[\w-]+(?=\s*\(\s*\)\s*\{)/,alias:"function"}],"for-or-select":{pattern:/(\b(?:for|select)\s+)\w+(?=\s+in\s)/,alias:"variable",lookbehind:!0},"assign-left":{pattern:/(^|[\s;|&]|[<>]\()\w+(?:\.\w+)*(?=\+?=)/,inside:{environment:{pattern:RegExp("(^|[\\s;|&]|[<>]\\()"+n),lookbehind:!0,alias:"constant"}},alias:"variable",lookbehind:!0},parameter:{pattern:/(^|\s)-{1,2}(?:\w+:[+-]?)?\w+(?:\.\w+)*(?=[=\s]|$)/,alias:"variable",lookbehind:!0},string:[{pattern:/((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,lookbehind:!0,greedy:!0,inside:a},{pattern:/((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,lookbehind:!0,greedy:!0,inside:{bash:r}},{pattern:/(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,lookbehind:!0,greedy:!0,inside:a},{pattern:/(^|[^$\\])'[^']*'/,lookbehind:!0,greedy:!0},{pattern:/\$'(?:[^'\\]|\\[\s\S])*'/,greedy:!0,inside:{entity:a.entity}}],environment:{pattern:RegExp("\\$?"+n),alias:"constant"},variable:a.variable,function:{pattern:/(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cargo|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|java|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|sysctl|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,lookbehind:!0},keyword:{pattern:/(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,lookbehind:!0},builtin:{pattern:/(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,lookbehind:!0,alias:"class-name"},boolean:{pattern:/(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,lookbehind:!0},"file-descriptor":{pattern:/\B&\d\b/,alias:"important"},operator:{pattern:/\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,inside:{"file-descriptor":{pattern:/^\d/,alias:"important"}}},punctuation:/\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,number:{pattern:/(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,lookbehind:!0}},r.inside=t.languages.bash;for(var l=["comment","function-name","for-or-select","assign-left","parameter","string","environment","function","keyword","builtin","boolean","file-descriptor","operator","punctuation","number"],u=a.variable[1].inside,o=0;o>/g,function($,U){return"(?:"+j[+U]+")"})}function r(L,j,$){return RegExp(n(L,j),"")}function a(L,j){for(var $=0;$>/g,function(){return"(?:"+L+")"});return L.replace(/<>/g,"[^\\s\\S]")}var l={type:"bool byte char decimal double dynamic float int long object sbyte short string uint ulong ushort var void",typeDeclaration:"class enum interface record struct",contextual:"add alias and ascending async await by descending from(?=\\s*(?:\\w|$)) get global group into init(?=\\s*;) join let nameof not notnull on or orderby partial remove select set unmanaged value when where with(?=\\s*{)",other:"abstract as base break case catch checked const continue default delegate do else event explicit extern finally fixed for foreach goto if implicit in internal is lock namespace new null operator out override params private protected public readonly ref return sealed sizeof stackalloc static switch this throw try typeof unchecked unsafe using virtual volatile while yield"};function u(L){return"\\b(?:"+L.trim().replace(/ /g,"|")+")\\b"}var o=u(l.typeDeclaration),c=RegExp(u(l.type+" "+l.typeDeclaration+" "+l.contextual+" "+l.other)),f=u(l.typeDeclaration+" "+l.contextual+" "+l.other),p=u(l.type+" "+l.typeDeclaration+" "+l.other),d=a(/<(?:[^<>;=+\-*/%&|^]|<>)*>/.source,2),_=a(/\((?:[^()]|<>)*\)/.source,2),v=/@?\b[A-Za-z_]\w*\b/.source,w=n(/<<0>>(?:\s*<<1>>)?/.source,[v,d]),C=n(/(?!<<0>>)<<1>>(?:\s*\.\s*<<1>>)*/.source,[f,w]),b=/\[\s*(?:,\s*)*\]/.source,S=n(/<<0>>(?:\s*(?:\?\s*)?<<1>>)*(?:\s*\?)?/.source,[C,b]),x=n(/[^,()<>[\];=+\-*/%&|^]|<<0>>|<<1>>|<<2>>/.source,[d,_,b]),y=n(/\(<<0>>+(?:,<<0>>+)+\)/.source,[x]),k=n(/(?:<<0>>|<<1>>)(?:\s*(?:\?\s*)?<<2>>)*(?:\s*\?)?/.source,[y,C,b]),D={keyword:c,punctuation:/[<>()?,.:[\]]/},T=/'(?:[^\r\n'\\]|\\.|\\[Uux][\da-fA-F]{1,8})'/.source,R=/"(?:\\.|[^\\"\r\n])*"/.source,N=/@"(?:""|\\[\s\S]|[^\\"])*"(?!")/.source;t.languages.csharp=t.languages.extend("clike",{string:[{pattern:r(/(^|[^$\\])<<0>>/.source,[N]),lookbehind:!0,greedy:!0},{pattern:r(/(^|[^@$\\])<<0>>/.source,[R]),lookbehind:!0,greedy:!0}],"class-name":[{pattern:r(/(\busing\s+static\s+)<<0>>(?=\s*;)/.source,[C]),lookbehind:!0,inside:D},{pattern:r(/(\busing\s+<<0>>\s*=\s*)<<1>>(?=\s*;)/.source,[v,k]),lookbehind:!0,inside:D},{pattern:r(/(\busing\s+)<<0>>(?=\s*=)/.source,[v]),lookbehind:!0},{pattern:r(/(\b<<0>>\s+)<<1>>/.source,[o,w]),lookbehind:!0,inside:D},{pattern:r(/(\bcatch\s*\(\s*)<<0>>/.source,[C]),lookbehind:!0,inside:D},{pattern:r(/(\bwhere\s+)<<0>>/.source,[v]),lookbehind:!0},{pattern:r(/(\b(?:is(?:\s+not)?|as)\s+)<<0>>/.source,[S]),lookbehind:!0,inside:D},{pattern:r(/\b<<0>>(?=\s+(?!<<1>>|with\s*\{)<<2>>(?:\s*[=,;:{)\]]|\s+(?:in|when)\b))/.source,[k,p,v]),inside:D}],keyword:c,number:/(?:\b0(?:x[\da-f_]*[\da-f]|b[01_]*[01])|(?:\B\.\d+(?:_+\d+)*|\b\d+(?:_+\d+)*(?:\.\d+(?:_+\d+)*)?)(?:e[-+]?\d+(?:_+\d+)*)?)(?:[dflmu]|lu|ul)?\b/i,operator:/>>=?|<<=?|[-=]>|([-+&|])\1|~|\?\?=?|[-+*/%&|^!=<>]=?/,punctuation:/\?\.?|::|[{}[\];(),.:]/}),t.languages.insertBefore("csharp","number",{range:{pattern:/\.\./,alias:"operator"}}),t.languages.insertBefore("csharp","punctuation",{"named-parameter":{pattern:r(/([(,]\s*)<<0>>(?=\s*:)/.source,[v]),lookbehind:!0,alias:"punctuation"}}),t.languages.insertBefore("csharp","class-name",{namespace:{pattern:r(/(\b(?:namespace|using)\s+)<<0>>(?:\s*\.\s*<<0>>)*(?=\s*[;{])/.source,[v]),lookbehind:!0,inside:{punctuation:/\./}},"type-expression":{pattern:r(/(\b(?:default|sizeof|typeof)\s*\(\s*(?!\s))(?:[^()\s]|\s(?!\s)|<<0>>)*(?=\s*\))/.source,[_]),lookbehind:!0,alias:"class-name",inside:D},"return-type":{pattern:r(/<<0>>(?=\s+(?:<<1>>\s*(?:=>|[({]|\.\s*this\s*\[)|this\s*\[))/.source,[k,C]),inside:D,alias:"class-name"},"constructor-invocation":{pattern:r(/(\bnew\s+)<<0>>(?=\s*[[({])/.source,[k]),lookbehind:!0,inside:D,alias:"class-name"},"generic-method":{pattern:r(/<<0>>\s*<<1>>(?=\s*\()/.source,[v,d]),inside:{function:r(/^<<0>>/.source,[v]),generic:{pattern:RegExp(d),alias:"class-name",inside:D}}},"type-list":{pattern:r(/\b((?:<<0>>\s+<<1>>|record\s+<<1>>\s*<<5>>|where\s+<<2>>)\s*:\s*)(?:<<3>>|<<4>>|<<1>>\s*<<5>>|<<6>>)(?:\s*,\s*(?:<<3>>|<<4>>|<<6>>))*(?=\s*(?:where|[{;]|=>|$))/.source,[o,w,v,k,c.source,_,/\bnew\s*\(\s*\)/.source]),lookbehind:!0,inside:{"record-arguments":{pattern:r(/(^(?!new\s*\()<<0>>\s*)<<1>>/.source,[w,_]),lookbehind:!0,greedy:!0,inside:t.languages.csharp},keyword:c,"class-name":{pattern:RegExp(k),greedy:!0,inside:D},punctuation:/[,()]/}},preprocessor:{pattern:/(^[\t ]*)#.*/m,lookbehind:!0,alias:"property",inside:{directive:{pattern:/(#)\b(?:define|elif|else|endif|endregion|error|if|line|nullable|pragma|region|undef|warning)\b/,lookbehind:!0,alias:"keyword"}}}});var M=R+"|"+T,B=n(/\/(?![*/])|\/\/[^\r\n]*[\r\n]|\/\*(?:[^*]|\*(?!\/))*\*\/|<<0>>/.source,[M]),H=a(n(/[^"'/()]|<<0>>|\(<>*\)/.source,[B]),2),Y=/\b(?:assembly|event|field|method|module|param|property|return|type)\b/.source,F=n(/<<0>>(?:\s*\(<<1>>*\))?/.source,[C,H]);t.languages.insertBefore("csharp","class-name",{attribute:{pattern:r(/((?:^|[^\s\w>)?])\s*\[\s*)(?:<<0>>\s*:\s*)?<<1>>(?:\s*,\s*<<1>>)*(?=\s*\])/.source,[Y,F]),lookbehind:!0,greedy:!0,inside:{target:{pattern:r(/^<<0>>(?=\s*:)/.source,[Y]),alias:"keyword"},"attribute-arguments":{pattern:r(/\(<<0>>*\)/.source,[H]),inside:t.languages.csharp},"class-name":{pattern:RegExp(C),inside:{punctuation:/\./}},punctuation:/[:,]/}}});var z=/:[^}\r\n]+/.source,q=a(n(/[^"'/()]|<<0>>|\(<>*\)/.source,[B]),2),G=n(/\{(?!\{)(?:(?![}:])<<0>>)*<<1>>?\}/.source,[q,z]),X=a(n(/[^"'/()]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|<<0>>|\(<>*\)/.source,[M]),2),K=n(/\{(?!\{)(?:(?![}:])<<0>>)*<<1>>?\}/.source,[X,z]);function O(L,j){return{interpolation:{pattern:r(/((?:^|[^{])(?:\{\{)*)<<0>>/.source,[L]),lookbehind:!0,inside:{"format-string":{pattern:r(/(^\{(?:(?![}:])<<0>>)*)<<1>>(?=\}$)/.source,[j,z]),lookbehind:!0,inside:{punctuation:/^:/}},punctuation:/^\{|\}$/,expression:{pattern:/[\s\S]+/,alias:"language-csharp",inside:t.languages.csharp}}},string:/[\s\S]+/}}t.languages.insertBefore("csharp","string",{"interpolation-string":[{pattern:r(/(^|[^\\])(?:\$@|@\$)"(?:""|\\[\s\S]|\{\{|<<0>>|[^\\{"])*"/.source,[G]),lookbehind:!0,greedy:!0,inside:O(G,q)},{pattern:r(/(^|[^@\\])\$"(?:\\.|\{\{|<<0>>|[^\\"{])*"/.source,[K]),lookbehind:!0,greedy:!0,inside:O(K,X)}],char:{pattern:RegExp(T),greedy:!0}}),t.languages.dotnet=t.languages.cs=t.languages.csharp})(e)}al.displayName="markup";al.aliases=["atom","html","mathml","rss","ssml","svg","xml"];function al(e){e.languages.markup={comment:{pattern://,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern://i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},e.languages.markup.tag.inside["attr-value"].inside.entity=e.languages.markup.entity,e.languages.markup.doctype.inside["internal-subset"].inside=e.languages.markup,e.hooks.add("wrap",function(t){t.type==="entity"&&(t.attributes.title=t.content.value.replace(/&/,"&"))}),Object.defineProperty(e.languages.markup.tag,"addInlined",{value:function(n,r){var a={};a["language-"+r]={pattern:/(^$)/i,lookbehind:!0,inside:e.languages[r]},a.cdata=/^$/i;var l={"included-cdata":{pattern://i,inside:a}};l["language-"+r]={pattern:/[\s\S]+/,inside:e.languages[r]};var u={};u[n]={pattern:RegExp(/(<__[^>]*>)(?:))*\]\]>|(?!)/.source.replace(/__/g,function(){return n}),"i"),lookbehind:!0,greedy:!0,inside:l},e.languages.insertBefore("markup","cdata",u)}}),Object.defineProperty(e.languages.markup.tag,"addAttribute",{value:function(t,n){e.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+t+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[n,"language-"+n],inside:e.languages[n]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),e.languages.html=e.languages.markup,e.languages.mathml=e.languages.markup,e.languages.svg=e.languages.markup,e.languages.xml=e.languages.extend("markup",{}),e.languages.ssml=e.languages.xml,e.languages.atom=e.languages.xml,e.languages.rss=e.languages.xml}va.displayName="css";va.aliases=[];function va(e){(function(t){var n=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;t.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+n.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+n.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+n.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+n.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:n,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},t.languages.css.atrule.inside.rest=t.languages.css;var r=t.languages.markup;r&&(r.tag.addInlined("style","css"),r.tag.addAttribute("style","css"))})(e)}Gg.displayName="diff";Gg.aliases=[];function Gg(e){(function(t){t.languages.diff={coord:[/^(?:\*{3}|-{3}|\+{3}).*$/m,/^@@.*@@$/m,/^\d.*$/m]};var n={"deleted-sign":"-","deleted-arrow":"<","inserted-sign":"+","inserted-arrow":">",unchanged:" ",diff:"!"};Object.keys(n).forEach(function(r){var a=n[r],l=[];/^\w+$/.test(r)||l.push(/\w+/.exec(r)[0]),r==="diff"&&l.push("bold"),t.languages.diff[r]={pattern:RegExp("^(?:["+a+`].*(?:\r ?| -|(?![\\s\\S])))+`,"m"),alias:l,inside:{line:{pattern:/(.)(?=[\s\S]).*(?:\r\n?|\n)?/,lookbehind:!0},prefix:{pattern:/[\s\S]/,alias:/\w+/.exec(r)[0]}}}}),Object.defineProperty(t.languages.diff,"PREFIXES",{value:n})})(e)}qg.displayName="go";qg.aliases=[];function qg(e){e.register(hi),e.languages.go=e.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"|`[^`]*`/,lookbehind:!0,greedy:!0},keyword:/\b(?:break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go(?:to)?|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b/,boolean:/\b(?:_|false|iota|nil|true)\b/,number:[/\b0(?:b[01_]+|o[0-7_]+)i?\b/i,/\b0x(?:[a-f\d_]+(?:\.[a-f\d_]*)?|\.[a-f\d_]+)(?:p[+-]?\d+(?:_\d+)*)?i?(?!\w)/i,/(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?[\d_]+)?i?(?!\w)/i],operator:/[*\/%^!=]=?|\+[=+]?|-[=-]?|\|[=|]?|&(?:=|&|\^=?)?|>(?:>=?|=)?|<(?:<=?|=|-)?|:=|\.\.\./,builtin:/\b(?:append|bool|byte|cap|close|complex|complex(?:64|128)|copy|delete|error|float(?:32|64)|u?int(?:8|16|32|64)?|imag|len|make|new|panic|print(?:ln)?|real|recover|rune|string|uintptr)\b/}),e.languages.insertBefore("go","string",{char:{pattern:/'(?:\\.|[^'\\\r\n]){0,10}'/,greedy:!0}}),delete e.languages.go["class-name"]}Vg.displayName="ini";Vg.aliases=[];function Vg(e){e.languages.ini={comment:{pattern:/(^[ \f\t\v]*)[#;][^\n\r]*/m,lookbehind:!0},section:{pattern:/(^[ \f\t\v]*)\[[^\n\r\]]*\]?/m,lookbehind:!0,inside:{"section-name":{pattern:/(^\[[ \f\t\v]*)[^ \f\t\v\]]+(?:[ \f\t\v]+[^ \f\t\v\]]+)*/,lookbehind:!0,alias:"selector"},punctuation:/\[|\]/}},key:{pattern:/(^[ \f\t\v]*)[^ \f\n\r\t\v=]+(?:[ \f\t\v]+[^ \f\n\r\t\v=]+)*(?=[ \f\t\v]*=)/m,lookbehind:!0,alias:"attr-name"},value:{pattern:/(=[ \f\t\v]*)[^ \f\n\r\t\v]+(?:[ \f\t\v]+[^ \f\n\r\t\v]+)*/,lookbehind:!0,alias:"attr-value",inside:{"inner-value":{pattern:/^("|').+(?=\1$)/,lookbehind:!0}}},punctuation:/=/}}Yg.displayName="java";Yg.aliases=[];function Yg(e){e.register(hi),(function(t){var n=/\b(?:abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|exports|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|module|native|new|non-sealed|null|open|opens|package|permits|private|protected|provides|public|record(?!\s*[(){}[\]<>=%~.:,;?+\-*/&|^])|requires|return|sealed|short|static|strictfp|super|switch|synchronized|this|throw|throws|to|transient|transitive|try|uses|var|void|volatile|while|with|yield)\b/,r=/(?:[a-z]\w*\s*\.\s*)*(?:[A-Z]\w*\s*\.\s*)*/.source,a={pattern:RegExp(/(^|[^\w.])/.source+r+/[A-Z](?:[\d_A-Z]*[a-z]\w*)?\b/.source),lookbehind:!0,inside:{namespace:{pattern:/^[a-z]\w*(?:\s*\.\s*[a-z]\w*)*(?:\s*\.)?/,inside:{punctuation:/\./}},punctuation:/\./}};t.languages.java=t.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"/,lookbehind:!0,greedy:!0},"class-name":[a,{pattern:RegExp(/(^|[^\w.])/.source+r+/[A-Z]\w*(?=\s+\w+\s*[;,=()]|\s*(?:\[[\s,]*\]\s*)?::\s*new\b)/.source),lookbehind:!0,inside:a.inside},{pattern:RegExp(/(\b(?:class|enum|extends|implements|instanceof|interface|new|record|throws)\s+)/.source+r+/[A-Z]\w*\b/.source),lookbehind:!0,inside:a.inside}],keyword:n,function:[t.languages.clike.function,{pattern:/(::\s*)[a-z_]\w*/,lookbehind:!0}],number:/\b0b[01][01_]*L?\b|\b0x(?:\.[\da-f_p+-]+|[\da-f_]+(?:\.[\da-f_p+-]+)?)\b|(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?\d[\d_]*)?[dfl]?/i,operator:{pattern:/(^|[^.])(?:<<=?|>>>?=?|->|--|\+\+|&&|\|\||::|[?:~]|[-+*/%&|^!=<>]=?)/m,lookbehind:!0},constant:/\b[A-Z][A-Z_\d]+\b/}),t.languages.insertBefore("java","string",{"triple-quoted-string":{pattern:/"""[ \t]*[\r\n](?:(?:"|"")?(?:\\.|[^"\\]))*"""/,greedy:!0,alias:"string"},char:{pattern:/'(?:\\.|[^'\\\r\n]){1,6}'/,greedy:!0}}),t.languages.insertBefore("java","class-name",{annotation:{pattern:/(^|[^.])@\w+(?:\s*\.\s*\w+)*/,lookbehind:!0,alias:"punctuation"},generics:{pattern:/<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&))*>)*>)*>)*>/,inside:{"class-name":a,keyword:n,punctuation:/[<>(),.:]/,operator:/[?&|]/}},import:[{pattern:RegExp(/(\bimport\s+)/.source+r+/(?:[A-Z]\w*|\*)(?=\s*;)/.source),lookbehind:!0,inside:{namespace:a.inside.namespace,punctuation:/\./,operator:/\*/,"class-name":/\w+/}},{pattern:RegExp(/(\bimport\s+static\s+)/.source+r+/(?:\w+|\*)(?=\s*;)/.source),lookbehind:!0,alias:"static",inside:{namespace:a.inside.namespace,static:/\b\w+$/,punctuation:/\./,operator:/\*/,"class-name":/\w+/}}],namespace:{pattern:RegExp(/(\b(?:exports|import(?:\s+static)?|module|open|opens|package|provides|requires|to|transitive|uses|with)\s+)(?!)[a-z]\w*(?:\.[a-z]\w*)*\.?/.source.replace(//g,function(){return n.source})),lookbehind:!0,inside:{punctuation:/\./}}})})(e)}Wg.displayName="regex";Wg.aliases=[];function Wg(e){(function(t){var n={pattern:/\\[\\(){}[\]^$+*?|.]/,alias:"escape"},r=/\\(?:x[\da-fA-F]{2}|u[\da-fA-F]{4}|u\{[\da-fA-F]+\}|0[0-7]{0,2}|[123][0-7]{2}|c[a-zA-Z]|.)/,a={pattern:/\.|\\[wsd]|\\p\{[^{}]+\}/i,alias:"class-name"},l={pattern:/\\[wsd]|\\p\{[^{}]+\}/i,alias:"class-name"},u="(?:[^\\\\-]|"+r.source+")",o=RegExp(u+"-"+u),c={pattern:/(<|')[^<>']+(?=[>']$)/,lookbehind:!0,alias:"variable"};t.languages.regex={"char-class":{pattern:/((?:^|[^\\])(?:\\\\)*)\[(?:[^\\\]]|\\[\s\S])*\]/,lookbehind:!0,inside:{"char-class-negation":{pattern:/(^\[)\^/,lookbehind:!0,alias:"operator"},"char-class-punctuation":{pattern:/^\[|\]$/,alias:"punctuation"},range:{pattern:o,inside:{escape:r,"range-punctuation":{pattern:/-/,alias:"operator"}}},"special-escape":n,"char-set":l,escape:r}},"special-escape":n,"char-set":a,backreference:[{pattern:/\\(?![123][0-7]{2})[1-9]/,alias:"keyword"},{pattern:/\\k<[^<>']+>/,alias:"keyword",inside:{"group-name":c}}],anchor:{pattern:/[$^]|\\[ABbGZz]/,alias:"function"},escape:r,group:[{pattern:/\((?:\?(?:<[^<>']+>|'[^<>']+'|[>:]||&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),e.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,e.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:e.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:e.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:e.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:e.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:e.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),e.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:e.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),e.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),e.languages.markup&&(e.languages.markup.tag.addInlined("script","javascript"),e.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),e.languages.js=e.languages.javascript}Xg.displayName="json";Xg.aliases=["webmanifest"];function Xg(e){e.languages.json={property:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,lookbehind:!0,greedy:!0},string:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,lookbehind:!0,greedy:!0},comment:{pattern:/\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},number:/-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,punctuation:/[{}[\],]/,operator:/:/,boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"}},e.languages.webmanifest=e.languages.json}Kg.displayName="kotlin";Kg.aliases=["kt","kts"];function Kg(e){e.register(hi),(function(t){t.languages.kotlin=t.languages.extend("clike",{keyword:{pattern:/(^|[^.])\b(?:abstract|actual|annotation|as|break|by|catch|class|companion|const|constructor|continue|crossinline|data|do|dynamic|else|enum|expect|external|final|finally|for|fun|get|if|import|in|infix|init|inline|inner|interface|internal|is|lateinit|noinline|null|object|open|operator|out|override|package|private|protected|public|reified|return|sealed|set|super|suspend|tailrec|this|throw|to|try|typealias|val|var|vararg|when|where|while)\b/,lookbehind:!0},function:[{pattern:/(?:`[^\r\n`]+`|\b\w+)(?=\s*\()/,greedy:!0},{pattern:/(\.)(?:`[^\r\n`]+`|\w+)(?=\s*\{)/,lookbehind:!0,greedy:!0}],number:/\b(?:0[xX][\da-fA-F]+(?:_[\da-fA-F]+)*|0[bB][01]+(?:_[01]+)*|\d+(?:_\d+)*(?:\.\d+(?:_\d+)*)?(?:[eE][+-]?\d+(?:_\d+)*)?[fFL]?)\b/,operator:/\+[+=]?|-[-=>]?|==?=?|!(?:!|==?)?|[\/*%<>]=?|[?:]:?|\.\.|&&|\|\||\b(?:and|inv|or|shl|shr|ushr|xor)\b/}),delete t.languages.kotlin["class-name"];var n={"interpolation-punctuation":{pattern:/^\$\{?|\}$/,alias:"punctuation"},expression:{pattern:/[\s\S]+/,inside:t.languages.kotlin}};t.languages.insertBefore("kotlin","string",{"string-literal":[{pattern:/"""(?:[^$]|\$(?:(?!\{)|\{[^{}]*\}))*?"""/,alias:"multiline",inside:{interpolation:{pattern:/\$(?:[a-z_]\w*|\{[^{}]*\})/i,inside:n},string:/[\s\S]+/}},{pattern:/"(?:[^"\\\r\n$]|\\.|\$(?:(?!\{)|\{[^{}]*\}))*"/,alias:"singleline",inside:{interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$(?:[a-z_]\w*|\{[^{}]*\})/i,lookbehind:!0,inside:n},string:/[\s\S]+/}}],char:{pattern:/'(?:[^'\\\r\n]|\\(?:.|u[a-fA-F0-9]{0,4}))'/,greedy:!0}}),delete t.languages.kotlin.string,t.languages.insertBefore("kotlin","keyword",{annotation:{pattern:/\B@(?:\w+:)?(?:[A-Z]\w*|\[[^\]]+\])/,alias:"builtin"}}),t.languages.insertBefore("kotlin","function",{label:{pattern:/\b\w+@|@\w+\b/,alias:"symbol"}}),t.languages.kt=t.languages.kotlin,t.languages.kts=t.languages.kotlin})(e)}Zg.displayName="less";Zg.aliases=[];function Zg(e){e.register(ya),e.languages.less=e.languages.extend("css",{comment:[/\/\*[\s\S]*?\*\//,{pattern:/(^|[^\\])\/\/.*/,lookbehind:!0}],atrule:{pattern:/@[\w-](?:\((?:[^(){}]|\([^(){}]*\))*\)|[^(){};\s]|\s+(?!\s))*?(?=\s*\{)/,inside:{punctuation:/[:()]/}},selector:{pattern:/(?:@\{[\w-]+\}|[^{};\s@])(?:@\{[\w-]+\}|\((?:[^(){}]|\([^(){}]*\))*\)|[^(){};@\s]|\s+(?!\s))*?(?=\s*\{)/,inside:{variable:/@+[\w-]+/}},property:/(?:@\{[\w-]+\}|[\w-])+(?:\+_?)?(?=\s*:)/,operator:/[+\-*\/]/}),e.languages.insertBefore("less","property",{variable:[{pattern:/@[\w-]+\s*:/,inside:{punctuation:/:/}},/@@?[\w-]+/],"mixin-usage":{pattern:/([{;]\s*)[.#](?!\d)[\w-].*?(?=[(;])/,lookbehind:!0,alias:"function"}})}Qg.displayName="lua";Qg.aliases=[];function Qg(e){e.languages.lua={comment:/^#!.+|--(?:\[(=*)\[[\s\S]*?\]\1\]|.*)/m,string:{pattern:/(["'])(?:(?!\1)[^\\\r\n]|\\z(?:\r\n|\s)|\\(?:\r\n|[^z]))*\1|\[(=*)\[[\s\S]*?\]\2\]/,greedy:!0},number:/\b0x[a-f\d]+(?:\.[a-f\d]*)?(?:p[+-]?\d+)?\b|\b\d+(?:\.\B|(?:\.\d*)?(?:e[+-]?\d+)?\b)|\B\.\d+(?:e[+-]?\d+)?\b/i,keyword:/\b(?:and|break|do|else|elseif|end|false|for|function|goto|if|in|local|nil|not|or|repeat|return|then|true|until|while)\b/,function:/(?!\d)\w+(?=\s*(?:[({]))/,operator:[/[-+*%^&|#]|\/\/?|<[<=]?|>[>=]?|[=~]=?/,{pattern:/(^|[^.])\.\.(?!\.)/,lookbehind:!0}],punctuation:/[\[\](){},;]|\.+|:+/}}Jg.displayName="makefile";Jg.aliases=[];function Jg(e){e.languages.makefile={comment:{pattern:/(^|[^\\])#(?:\\(?:\r\n|[\s\S])|[^\\\r\n])*/,lookbehind:!0},string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"builtin-target":{pattern:/\.[A-Z][^:#=\s]+(?=\s*:(?!=))/,alias:"builtin"},target:{pattern:/^(?:[^:=\s]|[ \t]+(?![\s:]))+(?=\s*:(?!=))/m,alias:"symbol",inside:{variable:/\$+(?:(?!\$)[^(){}:#=\s]+|(?=[({]))/}},variable:/\$+(?:(?!\$)[^(){}:#=\s]+|\([@*%<^+?][DF]\)|(?=[({]))/,keyword:/-include\b|\b(?:define|else|endef|endif|export|ifn?def|ifn?eq|include|override|private|sinclude|undefine|unexport|vpath)\b/,function:{pattern:/(\()(?:abspath|addsuffix|and|basename|call|dir|error|eval|file|filter(?:-out)?|findstring|firstword|flavor|foreach|guile|if|info|join|lastword|load|notdir|or|origin|patsubst|realpath|shell|sort|strip|subst|suffix|value|warning|wildcard|word(?:list|s)?)(?=[ \t])/,lookbehind:!0},operator:/(?:::|[?:+!])?=|[|@]/,punctuation:/[:;(){}]/}}em.displayName="yaml";em.aliases=["yml"];function em(e){(function(t){var n=/[*&][^\s[\]{},]+/,r=/!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/,a="(?:"+r.source+"(?:[ ]+"+n.source+")?|"+n.source+"(?:[ ]+"+r.source+")?)",l=/(?:[^\s\x00-\x08\x0e-\x1f!"#%&'*,\-:>?@[\]`{|}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]|[?:-])(?:[ \t]*(?:(?![#:])|:))*/.source.replace(//g,function(){return/[^\s\x00-\x08\x0e-\x1f,[\]{}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]/.source}),u=/"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'/.source;function o(c,f){f=(f||"").replace(/m/g,"")+"m";var p=/([:\-,[{]\s*(?:\s<>[ \t]+)?)(?:<>)(?=[ \t]*(?:$|,|\]|\}|(?:[\r\n]\s*)?#))/.source.replace(/<>/g,function(){return a}).replace(/<>/g,function(){return c});return RegExp(p,f)}t.languages.yaml={scalar:{pattern:RegExp(/([\-:]\s*(?:\s<>[ \t]+)?[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)\S[^\r\n]*(?:\2[^\r\n]+)*)/.source.replace(/<>/g,function(){return a})),lookbehind:!0,alias:"string"},comment:/#.*/,key:{pattern:RegExp(/((?:^|[:\-,[{\r\n?])[ \t]*(?:<>[ \t]+)?)<>(?=\s*:\s)/.source.replace(/<>/g,function(){return a}).replace(/<>/g,function(){return"(?:"+l+"|"+u+")"})),lookbehind:!0,greedy:!0,alias:"atrule"},directive:{pattern:/(^[ \t]*)%.+/m,lookbehind:!0,alias:"important"},datetime:{pattern:o(/\d{4}-\d\d?-\d\d?(?:[tT]|[ \t]+)\d\d?:\d{2}:\d{2}(?:\.\d*)?(?:[ \t]*(?:Z|[-+]\d\d?(?::\d{2})?))?|\d{4}-\d{2}-\d{2}|\d\d?:\d{2}(?::\d{2}(?:\.\d*)?)?/.source),lookbehind:!0,alias:"number"},boolean:{pattern:o(/false|true/.source,"i"),lookbehind:!0,alias:"important"},null:{pattern:o(/null|~/.source,"i"),lookbehind:!0,alias:"important"},string:{pattern:o(u),lookbehind:!0,greedy:!0},number:{pattern:o(/[+-]?(?:0x[\da-f]+|0o[0-7]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?|\.inf|\.nan)/.source,"i"),lookbehind:!0},tag:r,important:n,punctuation:/---|[:[\]{}\-,|>?]|\.\.\./},t.languages.yml=t.languages.yaml})(e)}tm.displayName="markdown";tm.aliases=["md"];function tm(e){e.register(ol),(function(t){var n=/(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;function r(o){return o=o.replace(//g,function(){return n}),RegExp(/((?:^|[^\\])(?:\\{2})*)/.source+"(?:"+o+")")}var a=/(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source,l=/\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g,function(){return a}),u=/\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source;t.languages.markdown=t.languages.extend("markup",{}),t.languages.insertBefore("markdown","prolog",{"front-matter-block":{pattern:/(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,lookbehind:!0,greedy:!0,inside:{punctuation:/^---|---$/,"front-matter":{pattern:/\S+(?:\s+\S+)*/,alias:["yaml","language-yaml"],inside:t.languages.yaml}}},blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:"punctuation"},table:{pattern:RegExp("^"+l+u+"(?:"+l+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+l+u+")(?:"+l+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(a),inside:t.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+l+")"+u+"$"),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp("^"+l+"$"),inside:{"table-header":{pattern:RegExp(a),alias:"important",inside:t.languages.markdown},punctuation:/\|/}}}},code:[{pattern:/((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,lookbehind:!0,alias:"keyword"},{pattern:/^```[\s\S]*?^```$/m,greedy:!0,inside:{"code-block":{pattern:/^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,lookbehind:!0},"code-language":{pattern:/^(```).+/,lookbehind:!0},punctuation:/```/}}],title:[{pattern:/\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,alias:"important",inside:{punctuation:/==+$|--+$/}},{pattern:/(^\s*)#.+/m,lookbehind:!0,alias:"important",inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,lookbehind:!0,alias:"punctuation"},list:{pattern:/(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,lookbehind:!0,alias:"punctuation"},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,punctuation:/^[\[\]!:]|[<>]/},alias:"url"},bold:{pattern:r(/\b__(?:(?!_)|_(?:(?!_))+_)+__\b|\*\*(?:(?!\*)|\*(?:(?!\*))+\*)+\*\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:r(/\b_(?:(?!_)|__(?:(?!_))+__)+_\b|\*(?:(?!\*)|\*\*(?:(?!\*))+\*\*)+\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:r(/(~~?)(?:(?!~))+\2/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^~~?)[\s\S]+(?=\1$)/,lookbehind:!0,inside:{}},punctuation:/~~?/}},"code-snippet":{pattern:/(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,lookbehind:!0,greedy:!0,alias:["code","keyword"]},url:{pattern:r(/!?\[(?:(?!\]))+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\]))+\])/.source),lookbehind:!0,greedy:!0,inside:{operator:/^!/,content:{pattern:/(^\[)[^\]]+(?=\])/,lookbehind:!0,inside:{}},variable:{pattern:/(^\][ \t]?\[)[^\]]+(?=\]$)/,lookbehind:!0},url:{pattern:/(^\]\()[^\s)]+/,lookbehind:!0},string:{pattern:/(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,lookbehind:!0}}}}),["url","bold","italic","strike"].forEach(function(o){["url","bold","italic","strike","code-snippet"].forEach(function(c){o!==c&&(t.languages.markdown[o].inside.content.inside[c]=t.languages.markdown[c])})}),t.hooks.add("after-tokenize",function(o){if(o.language!=="markdown"&&o.language!=="md")return;function c(f){if(!(!f||typeof f=="string"))for(var p=0,d=f.length;p]?|\+\+?|!=?|<>?=?|==?|&&?|\|\|?|[~^%?*\/@]/}),delete e.languages.objectivec["class-name"],e.languages.objc=e.languages.objectivec}im.displayName="perl";im.aliases=[];function im(e){(function(t){var n=/(?:\((?:[^()\\]|\\[\s\S])*\)|\{(?:[^{}\\]|\\[\s\S])*\}|\[(?:[^[\]\\]|\\[\s\S])*\]|<(?:[^<>\\]|\\[\s\S])*>)/.source;t.languages.perl={comment:[{pattern:/(^\s*)=\w[\s\S]*?=cut.*/m,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\$])#.*/,lookbehind:!0,greedy:!0}],string:[{pattern:RegExp(/\b(?:q|qq|qw|qx)(?![a-zA-Z0-9])\s*/.source+"(?:"+[/([^a-zA-Z0-9\s{(\[<])(?:(?!\1)[^\\]|\\[\s\S])*\1/.source,/([a-zA-Z0-9])(?:(?!\2)[^\\]|\\[\s\S])*\2/.source,n].join("|")+")"),greedy:!0},{pattern:/("|`)(?:(?!\1)[^\\]|\\[\s\S])*\1/,greedy:!0},{pattern:/'(?:[^'\\\r\n]|\\.)*'/,greedy:!0}],regex:[{pattern:RegExp(/\b(?:m|qr)(?![a-zA-Z0-9])\s*/.source+"(?:"+[/([^a-zA-Z0-9\s{(\[<])(?:(?!\1)[^\\]|\\[\s\S])*\1/.source,/([a-zA-Z0-9])(?:(?!\2)[^\\]|\\[\s\S])*\2/.source,n].join("|")+")"+/[msixpodualngc]*/.source),greedy:!0},{pattern:RegExp(/(^|[^-])\b(?:s|tr|y)(?![a-zA-Z0-9])\s*/.source+"(?:"+[/([^a-zA-Z0-9\s{(\[<])(?:(?!\2)[^\\]|\\[\s\S])*\2(?:(?!\2)[^\\]|\\[\s\S])*\2/.source,/([a-zA-Z0-9])(?:(?!\3)[^\\]|\\[\s\S])*\3(?:(?!\3)[^\\]|\\[\s\S])*\3/.source,n+/\s*/.source+n].join("|")+")"+/[msixpodualngcer]*/.source),lookbehind:!0,greedy:!0},{pattern:/\/(?:[^\/\\\r\n]|\\.)*\/[msixpodualngc]*(?=\s*(?:$|[\r\n,.;})&|\-+*~<>!?^]|(?:and|cmp|eq|ge|gt|le|lt|ne|not|or|x|xor)\b))/,greedy:!0}],variable:[/[&*$@%]\{\^[A-Z]+\}/,/[&*$@%]\^[A-Z_]/,/[&*$@%]#?(?=\{)/,/[&*$@%]#?(?:(?:::)*'?(?!\d)[\w$]+(?![\w$]))+(?:::)*/,/[&*$@%]\d+/,/(?!%=)[$@%][!"#$%&'()*+,\-.\/:;<=>?@[\\\]^_`{|}~]/],filehandle:{pattern:/<(?![<=])\S*?>|\b_\b/,alias:"symbol"},"v-string":{pattern:/v\d+(?:\.\d+)*|\d+(?:\.\d+){2,}/,alias:"string"},function:{pattern:/(\bsub[ \t]+)\w+/,lookbehind:!0},keyword:/\b(?:any|break|continue|default|delete|die|do|else|elsif|eval|for|foreach|given|goto|if|last|local|my|next|our|package|print|redo|require|return|say|state|sub|switch|undef|unless|until|use|when|while)\b/,number:/\b(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0b[01](?:_?[01])*|(?:(?:\d(?:_?\d)*)?\.)?\d(?:_?\d)*(?:[Ee][+-]?\d+)?)\b/,operator:/-[rwxoRWXOezsfdlpSbctugkTBMAC]\b|\+[+=]?|-[-=>]?|\*\*?=?|\/\/?=?|=[=~>]?|~[~=]?|\|\|?=?|&&?=?|<(?:=>?|<=?)?|>>?=?|![~=]?|[%^]=?|\.(?:=|\.\.?)?|[\\?]|\bx(?:=|\b)|\b(?:and|cmp|eq|ge|gt|le|lt|ne|not|or|xor)\b/,punctuation:/[{}[\];(),:]/}})(e)}Qu.displayName="markup-templating";Qu.aliases=[];function Qu(e){e.register(ol),(function(t){function n(r,a){return"___"+r.toUpperCase()+a+"___"}Object.defineProperties(t.languages["markup-templating"]={},{buildPlaceholders:{value:function(r,a,l,u){if(r.language===a){var o=r.tokenStack=[];r.code=r.code.replace(l,function(c){if(typeof u=="function"&&!u(c))return c;for(var f=o.length,p;r.code.indexOf(p=n(a,f))!==-1;)++f;return o[f]=c,p}),r.grammar=t.languages.markup}}},tokenizePlaceholders:{value:function(r,a){if(r.language!==a||!r.tokenStack)return;r.grammar=t.languages[a];var l=0,u=Object.keys(r.tokenStack);function o(c){for(var f=0;f=u.length);f++){var p=c[f];if(typeof p=="string"||p.content&&typeof p.content=="string"){var d=u[l],_=r.tokenStack[d],v=typeof p=="string"?p:p.content,w=n(a,d),C=v.indexOf(w);if(C>-1){++l;var y=v.substring(0,C),S=new t.Token(a,t.tokenize(_,r.grammar),"language-"+a,_),x=v.substring(C+w.length),b=[];y&&b.push.apply(b,o([y])),b.push(S),x&&b.push.apply(b,o([x])),typeof p=="string"?c.splice.apply(c,[f,1].concat(b)):p.content=b}}else p.content&&o(p.content)}return c}o(r.tokens)}}})})(e)}rm.displayName="php";rm.aliases=[];function rm(e){e.register(Qu),(function(t){var n=/\/\*[\s\S]*?\*\/|\/\/.*|#(?!\[).*/,r=[{pattern:/\b(?:false|true)\b/i,alias:"boolean"},{pattern:/(::\s*)\b[a-z_]\w*\b(?!\s*\()/i,greedy:!0,lookbehind:!0},{pattern:/(\b(?:case|const)\s+)\b[a-z_]\w*(?=\s*[;=])/i,greedy:!0,lookbehind:!0},/\b(?:null)\b/i,/\b[A-Z_][A-Z0-9_]*\b(?!\s*\()/],a=/\b0b[01]+(?:_[01]+)*\b|\b0o[0-7]+(?:_[0-7]+)*\b|\b0x[\da-f]+(?:_[\da-f]+)*\b|(?:\b\d+(?:_\d+)*\.?(?:\d+(?:_\d+)*)?|\B\.\d+)(?:e[+-]?\d+)?/i,l=/|\?\?=?|\.{3}|\??->|[!=]=?=?|::|\*\*=?|--|\+\+|&&|\|\||<<|>>|[?~]|[/^|%*&<>.+-]=?/,u=/[{}\[\](),:;]/;t.languages.php={delimiter:{pattern:/\?>$|^<\?(?:php(?=\s)|=)?/i,alias:"important"},comment:n,variable:/\$+(?:\w+\b|(?=\{))/,package:{pattern:/(namespace\s+|use\s+(?:function\s+)?)(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,lookbehind:!0,inside:{punctuation:/\\/}},"class-name-definition":{pattern:/(\b(?:class|enum|interface|trait)\s+)\b[a-z_]\w*(?!\\)\b/i,lookbehind:!0,alias:"class-name"},"function-definition":{pattern:/(\bfunction\s+)[a-z_]\w*(?=\s*\()/i,lookbehind:!0,alias:"function"},keyword:[{pattern:/(\(\s*)\b(?:array|bool|boolean|float|int|integer|object|string)\b(?=\s*\))/i,alias:"type-casting",greedy:!0,lookbehind:!0},{pattern:/([(,?]\s*)\b(?:array(?!\s*\()|bool|callable|(?:false|null)(?=\s*\|)|float|int|iterable|mixed|object|self|static|string)\b(?=\s*\$)/i,alias:"type-hint",greedy:!0,lookbehind:!0},{pattern:/(\)\s*:\s*(?:\?\s*)?)\b(?:array(?!\s*\()|bool|callable|(?:false|null)(?=\s*\|)|float|int|iterable|mixed|never|object|self|static|string|void)\b/i,alias:"return-type",greedy:!0,lookbehind:!0},{pattern:/\b(?:array(?!\s*\()|bool|float|int|iterable|mixed|object|string|void)\b/i,alias:"type-declaration",greedy:!0},{pattern:/(\|\s*)(?:false|null)\b|\b(?:false|null)(?=\s*\|)/i,alias:"type-declaration",greedy:!0,lookbehind:!0},{pattern:/\b(?:parent|self|static)(?=\s*::)/i,alias:"static-context",greedy:!0},{pattern:/(\byield\s+)from\b/i,lookbehind:!0},/\bclass\b/i,{pattern:/((?:^|[^\s>:]|(?:^|[^-])>|(?:^|[^:]):)\s*)\b(?:abstract|and|array|as|break|callable|case|catch|clone|const|continue|declare|default|die|do|echo|else|elseif|empty|enddeclare|endfor|endforeach|endif|endswitch|endwhile|enum|eval|exit|extends|final|finally|fn|for|foreach|function|global|goto|if|implements|include|include_once|instanceof|insteadof|interface|isset|list|match|namespace|never|new|or|parent|print|private|protected|public|readonly|require|require_once|return|self|static|switch|throw|trait|try|unset|use|var|while|xor|yield|__halt_compiler)\b/i,lookbehind:!0}],"argument-name":{pattern:/([(,]\s*)\b[a-z_]\w*(?=\s*:(?!:))/i,lookbehind:!0},"class-name":[{pattern:/(\b(?:extends|implements|instanceof|new(?!\s+self|\s+static))\s+|\bcatch\s*\()\b[a-z_]\w*(?!\\)\b/i,greedy:!0,lookbehind:!0},{pattern:/(\|\s*)\b[a-z_]\w*(?!\\)\b/i,greedy:!0,lookbehind:!0},{pattern:/\b[a-z_]\w*(?!\\)\b(?=\s*\|)/i,greedy:!0},{pattern:/(\|\s*)(?:\\?\b[a-z_]\w*)+\b/i,alias:"class-name-fully-qualified",greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/(?:\\?\b[a-z_]\w*)+\b(?=\s*\|)/i,alias:"class-name-fully-qualified",greedy:!0,inside:{punctuation:/\\/}},{pattern:/(\b(?:extends|implements|instanceof|new(?!\s+self\b|\s+static\b))\s+|\bcatch\s*\()(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,alias:"class-name-fully-qualified",greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/\b[a-z_]\w*(?=\s*\$)/i,alias:"type-declaration",greedy:!0},{pattern:/(?:\\?\b[a-z_]\w*)+(?=\s*\$)/i,alias:["class-name-fully-qualified","type-declaration"],greedy:!0,inside:{punctuation:/\\/}},{pattern:/\b[a-z_]\w*(?=\s*::)/i,alias:"static-context",greedy:!0},{pattern:/(?:\\?\b[a-z_]\w*)+(?=\s*::)/i,alias:["class-name-fully-qualified","static-context"],greedy:!0,inside:{punctuation:/\\/}},{pattern:/([(,?]\s*)[a-z_]\w*(?=\s*\$)/i,alias:"type-hint",greedy:!0,lookbehind:!0},{pattern:/([(,?]\s*)(?:\\?\b[a-z_]\w*)+(?=\s*\$)/i,alias:["class-name-fully-qualified","type-hint"],greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/(\)\s*:\s*(?:\?\s*)?)\b[a-z_]\w*(?!\\)\b/i,alias:"return-type",greedy:!0,lookbehind:!0},{pattern:/(\)\s*:\s*(?:\?\s*)?)(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,alias:["class-name-fully-qualified","return-type"],greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}}],constant:r,function:{pattern:/(^|[^\\\w])\\?[a-z_](?:[\w\\]*\w)?(?=\s*\()/i,lookbehind:!0,inside:{punctuation:/\\/}},property:{pattern:/(->\s*)\w+/,lookbehind:!0},number:a,operator:l,punctuation:u};var o={pattern:/\{\$(?:\{(?:\{[^{}]+\}|[^{}]+)\}|[^{}])+\}|(^|[^\\{])\$+(?:\w+(?:\[[^\r\n\[\]]+\]|->\w+)?)/,lookbehind:!0,inside:t.languages.php},c=[{pattern:/<<<'([^']+)'[\r\n](?:.*[\r\n])*?\1;/,alias:"nowdoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<<'[^']+'|[a-z_]\w*;$/i,alias:"symbol",inside:{punctuation:/^<<<'?|[';]$/}}}},{pattern:/<<<(?:"([^"]+)"[\r\n](?:.*[\r\n])*?\1;|([a-z_]\w*)[\r\n](?:.*[\r\n])*?\2;)/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<<(?:"[^"]+"|[a-z_]\w*)|[a-z_]\w*;$/i,alias:"symbol",inside:{punctuation:/^<<<"?|[";]$/}},interpolation:o}},{pattern:/`(?:\\[\s\S]|[^\\`])*`/,alias:"backtick-quoted-string",greedy:!0},{pattern:/'(?:\\[\s\S]|[^\\'])*'/,alias:"single-quoted-string",greedy:!0},{pattern:/"(?:\\[\s\S]|[^\\"])*"/,alias:"double-quoted-string",greedy:!0,inside:{interpolation:o}}];t.languages.insertBefore("php","variable",{string:c,attribute:{pattern:/#\[(?:[^"'\/#]|\/(?![*/])|\/\/.*$|#(?!\[).*$|\/\*(?:[^*]|\*(?!\/))*\*\/|"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*')+\](?=\s*[a-z$#])/im,greedy:!0,inside:{"attribute-content":{pattern:/^(#\[)[\s\S]+(?=\]$)/,lookbehind:!0,inside:{comment:n,string:c,"attribute-class-name":[{pattern:/([^:]|^)\b[a-z_]\w*(?!\\)\b/i,alias:"class-name",greedy:!0,lookbehind:!0},{pattern:/([^:]|^)(?:\\?\b[a-z_]\w*)+/i,alias:["class-name","class-name-fully-qualified"],greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}}],constant:r,number:a,operator:l,punctuation:u}},delimiter:{pattern:/^#\[|\]$/,alias:"punctuation"}}}}),t.hooks.add("before-tokenize",function(f){if(/<\?/.test(f.code)){var p=/<\?(?:[^"'/#]|\/(?![*/])|("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|(?:\/\/|#(?!\[))(?:[^?\n\r]|\?(?!>))*(?=$|\?>|[\r\n])|#\[|\/\*(?:[^*]|\*(?!\/))*(?:\*\/|$))*?(?:\?>|$)/g;t.languages["markup-templating"].buildPlaceholders(f,"php",p)}}),t.hooks.add("after-tokenize",function(f){t.languages["markup-templating"].tokenizePlaceholders(f,"php")})})(e)}sm.displayName="python";sm.aliases=["py"];function sm(e){e.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0},"string-interpolation":{pattern:/(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern:/![sra](?=[:}]$)/,alias:"punctuation"},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:"string"},string:{pattern:/(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/m,lookbehind:!0,alias:["annotation","punctuation"],inside:{punctuation:/\./}},keyword:/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:False|None|True)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,operator:/[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/},e.languages.python["string-interpolation"].inside.interpolation.inside.rest=e.languages.python,e.languages.py=e.languages.python}am.displayName="r";am.aliases=[];function am(e){e.languages.r={comment:/#.*/,string:{pattern:/(['"])(?:\\.|(?!\1)[^\\\r\n])*\1/,greedy:!0},"percent-operator":{pattern:/%[^%\s]*%/,alias:"operator"},boolean:/\b(?:FALSE|TRUE)\b/,ellipsis:/\.\.(?:\.|\d+)/,number:[/\b(?:Inf|NaN)\b/,/(?:\b0x[\dA-Fa-f]+(?:\.\d*)?|\b\d+(?:\.\d*)?|\B\.\d+)(?:[EePp][+-]?\d+)?[iL]?/],keyword:/\b(?:NA|NA_character_|NA_complex_|NA_integer_|NA_real_|NULL|break|else|for|function|if|in|next|repeat|while)\b/,operator:/->?>?|<(?:=|=!]=?|::?|&&?|\|\|?|[+*\/^$@~]/,punctuation:/[(){}\[\],;]/}}om.displayName="ruby";om.aliases=["rb"];function om(e){e.register(hi),(function(t){t.languages.ruby=t.languages.extend("clike",{comment:{pattern:/#.*|^=begin\s[\s\S]*?^=end/m,greedy:!0},"class-name":{pattern:/(\b(?:class|module)\s+|\bcatch\s+\()[\w.\\]+|\b[A-Z_]\w*(?=\s*\.\s*new\b)/,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:BEGIN|END|alias|and|begin|break|case|class|def|define_method|defined|do|each|else|elsif|end|ensure|extend|for|if|in|include|module|new|next|nil|not|or|prepend|private|protected|public|raise|redo|require|rescue|retry|return|self|super|then|throw|undef|unless|until|when|while|yield)\b/,operator:/\.{2,3}|&\.|===||[!=]?~|(?:&&|\|\||<<|>>|\*\*|[+\-*/%<>!^&|=])=?|[?:]/,punctuation:/[(){}[\].,;]/}),t.languages.insertBefore("ruby","operator",{"double-colon":{pattern:/::/,alias:"punctuation"}});var n={pattern:/((?:^|[^\\])(?:\\{2})*)#\{(?:[^{}]|\{[^{}]*\})*\}/,lookbehind:!0,inside:{content:{pattern:/^(#\{)[\s\S]+(?=\}$)/,lookbehind:!0,inside:t.languages.ruby},delimiter:{pattern:/^#\{|\}$/,alias:"punctuation"}}};delete t.languages.ruby.function;var r="(?:"+[/([^a-zA-Z0-9\s{(\[<=])(?:(?!\1)[^\\]|\\[\s\S])*\1/.source,/\((?:[^()\\]|\\[\s\S]|\((?:[^()\\]|\\[\s\S])*\))*\)/.source,/\{(?:[^{}\\]|\\[\s\S]|\{(?:[^{}\\]|\\[\s\S])*\})*\}/.source,/\[(?:[^\[\]\\]|\\[\s\S]|\[(?:[^\[\]\\]|\\[\s\S])*\])*\]/.source,/<(?:[^<>\\]|\\[\s\S]|<(?:[^<>\\]|\\[\s\S])*>)*>/.source].join("|")+")",a=/(?:"(?:\\.|[^"\\\r\n])*"|(?:\b[a-zA-Z_]\w*|[^\s\0-\x7F]+)[?!]?|\$.)/.source;t.languages.insertBefore("ruby","keyword",{"regex-literal":[{pattern:RegExp(/%r/.source+r+/[egimnosux]{0,6}/.source),greedy:!0,inside:{interpolation:n,regex:/[\s\S]+/}},{pattern:/(^|[^/])\/(?!\/)(?:\[[^\r\n\]]+\]|\\.|[^[/\\\r\n])+\/[egimnosux]{0,6}(?=\s*(?:$|[\r\n,.;})#]))/,lookbehind:!0,greedy:!0,inside:{interpolation:n,regex:/[\s\S]+/}}],variable:/[@$]+[a-zA-Z_]\w*(?:[?!]|\b)/,symbol:[{pattern:RegExp(/(^|[^:]):/.source+a),lookbehind:!0,greedy:!0},{pattern:RegExp(/([\r\n{(,][ \t]*)/.source+a+/(?=:(?!:))/.source),lookbehind:!0,greedy:!0}],"method-definition":{pattern:/(\bdef\s+)\w+(?:\s*\.\s*\w+)?/,lookbehind:!0,inside:{function:/\b\w+$/,keyword:/^self\b/,"class-name":/^\w+/,punctuation:/\./}}}),t.languages.insertBefore("ruby","string",{"string-literal":[{pattern:RegExp(/%[qQiIwWs]?/.source+r),greedy:!0,inside:{interpolation:n,string:/[\s\S]+/}},{pattern:/("|')(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|(?!\1)[^\\#\r\n])*\1/,greedy:!0,inside:{interpolation:n,string:/[\s\S]+/}},{pattern:/<<[-~]?([a-z_]\w*)[\r\n](?:.*[\r\n])*?[\t ]*\1/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<[-~]?[a-z_]\w*|\b[a-z_]\w*$/i,inside:{symbol:/\b\w+/,punctuation:/^<<[-~]?/}},interpolation:n,string:/[\s\S]+/}},{pattern:/<<[-~]?'([a-z_]\w*)'[\r\n](?:.*[\r\n])*?[\t ]*\1/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<[-~]?'[a-z_]\w*'|\b[a-z_]\w*$/i,inside:{symbol:/\b\w+/,punctuation:/^<<[-~]?'|'$/}},string:/[\s\S]+/}}],"command-literal":[{pattern:RegExp(/%x/.source+r),greedy:!0,inside:{interpolation:n,command:{pattern:/[\s\S]+/,alias:"string"}}},{pattern:/`(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|[^\\`#\r\n])*`/,greedy:!0,inside:{interpolation:n,command:{pattern:/[\s\S]+/,alias:"string"}}}]}),delete t.languages.ruby.string,t.languages.insertBefore("ruby","number",{builtin:/\b(?:Array|Bignum|Binding|Class|Continuation|Dir|Exception|FalseClass|File|Fixnum|Float|Hash|IO|Integer|MatchData|Method|Module|NilClass|Numeric|Object|Proc|Range|Regexp|Stat|String|Struct|Symbol|TMS|Thread|ThreadGroup|Time|TrueClass)\b/,constant:/\b[A-Z][A-Z0-9_]*(?:[?!]|\b)/}),t.languages.rb=t.languages.ruby})(e)}lm.displayName="rust";lm.aliases=[];function lm(e){(function(t){for(var n=/\/\*(?:[^*/]|\*(?!\/)|\/(?!\*)|)*\*\//.source,r=0;r<2;r++)n=n.replace(//g,function(){return n});n=n.replace(//g,function(){return/[^\s\S]/.source}),t.languages.rust={comment:[{pattern:RegExp(/(^|[^\\])/.source+n),lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/b?"(?:\\[\s\S]|[^\\"])*"|b?r(#*)"(?:[^"]|"(?!\1))*"\1/,greedy:!0},char:{pattern:/b?'(?:\\(?:x[0-7][\da-fA-F]|u\{(?:[\da-fA-F]_*){1,6}\}|.)|[^\\\r\n\t'])'/,greedy:!0},attribute:{pattern:/#!?\[(?:[^\[\]"]|"(?:\\[\s\S]|[^\\"])*")*\]/,greedy:!0,alias:"attr-name",inside:{string:null}},"closure-params":{pattern:/([=(,:]\s*|\bmove\s*)\|[^|]*\||\|[^|]*\|(?=\s*(?:\{|->))/,lookbehind:!0,greedy:!0,inside:{"closure-punctuation":{pattern:/^\||\|$/,alias:"punctuation"},rest:null}},"lifetime-annotation":{pattern:/'\w+/,alias:"symbol"},"fragment-specifier":{pattern:/(\$\w+:)[a-z]+/,lookbehind:!0,alias:"punctuation"},variable:/\$\w+/,"function-definition":{pattern:/(\bfn\s+)\w+/,lookbehind:!0,alias:"function"},"type-definition":{pattern:/(\b(?:enum|struct|trait|type|union)\s+)\w+/,lookbehind:!0,alias:"class-name"},"module-declaration":[{pattern:/(\b(?:crate|mod)\s+)[a-z][a-z_\d]*/,lookbehind:!0,alias:"namespace"},{pattern:/(\b(?:crate|self|super)\s*)::\s*[a-z][a-z_\d]*\b(?:\s*::(?:\s*[a-z][a-z_\d]*\s*::)*)?/,lookbehind:!0,alias:"namespace",inside:{punctuation:/::/}}],keyword:[/\b(?:Self|abstract|as|async|await|become|box|break|const|continue|crate|do|dyn|else|enum|extern|final|fn|for|if|impl|in|let|loop|macro|match|mod|move|mut|override|priv|pub|ref|return|self|static|struct|super|trait|try|type|typeof|union|unsafe|unsized|use|virtual|where|while|yield)\b/,/\b(?:bool|char|f(?:32|64)|[ui](?:8|16|32|64|128|size)|str)\b/],function:/\b[a-z_]\w*(?=\s*(?:::\s*<|\())/,macro:{pattern:/\b\w+!/,alias:"property"},constant:/\b[A-Z_][A-Z_\d]+\b/,"class-name":/\b[A-Z]\w*\b/,namespace:{pattern:/(?:\b[a-z][a-z_\d]*\s*::\s*)*\b[a-z][a-z_\d]*\s*::(?!\s*<)/,inside:{punctuation:/::/}},number:/\b(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0o[0-7](?:_?[0-7])*|0b[01](?:_?[01])*|(?:(?:\d(?:_?\d)*)?\.)?\d(?:_?\d)*(?:[Ee][+-]?\d+)?)(?:_?(?:f32|f64|[iu](?:8|16|32|64|size)?))?\b/,boolean:/\b(?:false|true)\b/,punctuation:/->|\.\.=|\.{1,3}|::|[{}[\];(),:]/,operator:/[-+*\/%!^]=?|=[=>]?|&[&=]?|\|[|=]?|<>?=?|[@?]/},t.languages.rust["closure-params"].inside.rest=t.languages.rust,t.languages.rust.attribute.inside.string=t.languages.rust.string})(e)}cm.displayName="sass";cm.aliases=[];function cm(e){e.register(ya),(function(t){t.languages.sass=t.languages.extend("css",{comment:{pattern:/^([ \t]*)\/[\/*].*(?:(?:\r?\n|\r)\1[ \t].+)*/m,lookbehind:!0,greedy:!0}}),t.languages.insertBefore("sass","atrule",{"atrule-line":{pattern:/^(?:[ \t]*)[@+=].+/m,greedy:!0,inside:{atrule:/(?:@[\w-]+|[+=])/}}}),delete t.languages.sass.atrule;var n=/\$[-\w]+|#\{\$[-\w]+\}/,r=[/[+*\/%]|[=!]=|<=?|>=?|\b(?:and|not|or)\b/,{pattern:/(\s)-(?=\s)/,lookbehind:!0}];t.languages.insertBefore("sass","property",{"variable-line":{pattern:/^[ \t]*\$.+/m,greedy:!0,inside:{punctuation:/:/,variable:n,operator:r}},"property-line":{pattern:/^[ \t]*(?:[^:\s]+ *:.*|:[^:\s].*)/m,greedy:!0,inside:{property:[/[^:\s]+(?=\s*:)/,{pattern:/(:)[^:\s]+/,lookbehind:!0}],punctuation:/:/,variable:n,operator:r,important:t.languages.sass.important}}}),delete t.languages.sass.property,delete t.languages.sass.important,t.languages.insertBefore("sass","punctuation",{selector:{pattern:/^([ \t]*)\S(?:,[^,\r\n]+|[^,\r\n]*)(?:,[^,\r\n]+)*(?:,(?:\r?\n|\r)\1[ \t]+\S(?:,[^,\r\n]+|[^,\r\n]*)(?:,[^,\r\n]+)*)*/m,lookbehind:!0,greedy:!0}})})(e)}um.displayName="scss";um.aliases=[];function um(e){e.register(ya),e.languages.scss=e.languages.extend("css",{comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,lookbehind:!0},atrule:{pattern:/@[\w-](?:\([^()]+\)|[^()\s]|\s+(?!\s))*?(?=\s+[{;])/,inside:{rule:/@[\w-]+/}},url:/(?:[-a-z]+-)?url(?=\()/i,selector:{pattern:/(?=\S)[^@;{}()]?(?:[^@;{}()\s]|\s+(?!\s)|#\{\$[-\w]+\})+(?=\s*\{(?:\}|\s|[^}][^:{}]*[:{][^}]))/,inside:{parent:{pattern:/&/,alias:"important"},placeholder:/%[-\w]+/,variable:/\$[-\w]+|#\{\$[-\w]+\}/}},property:{pattern:/(?:[-\w]|\$[-\w]|#\{\$[-\w]+\})+(?=\s*:)/,inside:{variable:/\$[-\w]+|#\{\$[-\w]+\}/}}}),e.languages.insertBefore("scss","atrule",{keyword:[/@(?:content|debug|each|else(?: if)?|extend|for|forward|function|if|import|include|mixin|return|use|warn|while)\b/i,{pattern:/( )(?:from|through)(?= )/,lookbehind:!0}]}),e.languages.insertBefore("scss","important",{variable:/\$[-\w]+|#\{\$[-\w]+\}/}),e.languages.insertBefore("scss","function",{"module-modifier":{pattern:/\b(?:as|hide|show|with)\b/i,alias:"keyword"},placeholder:{pattern:/%[-\w]+/,alias:"selector"},statement:{pattern:/\B!(?:default|optional)\b/i,alias:"keyword"},boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"},operator:{pattern:/(\s)(?:[-+*\/%]|[=!]=|<=?|>=?|and|not|or)(?=\s)/,lookbehind:!0}}),e.languages.scss.atrule.inside.rest=e.languages.scss}hm.displayName="sql";hm.aliases=[];function hm(e){e.languages.sql={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,lookbehind:!0},variable:[{pattern:/@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/,greedy:!0},/@[\w.$]+/],string:{pattern:/(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\]|\2\2)*\2/,greedy:!0,lookbehind:!0},identifier:{pattern:/(^|[^@\\])`(?:\\[\s\S]|[^`\\]|``)*`/,greedy:!0,lookbehind:!0,inside:{punctuation:/^`|`$/}},function:/\b(?:AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE)(?=\s*\()/i,keyword:/\b(?:ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|APPLY|AS|ASC|AUTHORIZATION|AUTO_INCREMENT|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADED?|CASE|CHAIN|CHAR(?:ACTER|SET)?|CHECK(?:POINT)?|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMNS?|COMMENT|COMMIT(?:TED)?|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS(?:TABLE)?|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|CYCLE|DATA(?:BASES?)?|DATE(?:TIME)?|DAY|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DELIMITERS?|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE|ELSE(?:IF)?|ENABLE|ENCLOSED|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPED?|EXCEPT|EXEC(?:UTE)?|EXISTS|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR(?: EACH ROW)?|FORCE|FOREIGN|FREETEXT(?:TABLE)?|FROM|FULL|FUNCTION|GEOMETRY(?:COLLECTION)?|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|HOUR|IDENTITY(?:COL|_INSERT)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTERVAL|INTO|INVOKER|ISOLATION|ITERATE|JOIN|KEYS?|KILL|LANGUAGE|LAST|LEAVE|LEFT|LEVEL|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|LOOP|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MINUTE|MODE|MODIFIES|MODIFY|MONTH|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL|NATURAL|NCHAR|NEXT|NO|NONCLUSTERED|NULLIF|NUMERIC|OFF?|OFFSETS?|ON|OPEN(?:DATASOURCE|QUERY|ROWSET)?|OPTIMIZE|OPTION(?:ALLY)?|ORDER|OUT(?:ER|FILE)?|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREPARE|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READS?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEAT(?:ABLE)?|REPLACE|REPLICATION|REQUIRE|RESIGNAL|RESTORE|RESTRICT|RETURN(?:ING|S)?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SECOND|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|SQL|START(?:ING)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED|TEXT(?:SIZE)?|THEN|TIME(?:STAMP)?|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNLOCK|UNPIVOT|UNSIGNED|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?|YEAR)\b/i,boolean:/\b(?:FALSE|NULL|TRUE)\b/i,number:/\b0x[\da-f]+\b|\b\d+(?:\.\d*)?|\B\.\d+\b/i,operator:/[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|DIV|ILIKE|IN|IS|LIKE|NOT|OR|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,punctuation:/[;[\]()`,.]/}}fm.displayName="swift";fm.aliases=[];function fm(e){e.languages.swift={comment:{pattern:/(^|[^\\:])(?:\/\/.*|\/\*(?:[^/*]|\/(?!\*)|\*(?!\/)|\/\*(?:[^*]|\*(?!\/))*\*\/)*\*\/)/,lookbehind:!0,greedy:!0},"string-literal":[{pattern:RegExp(/(^|[^"#])/.source+"(?:"+/"(?:\\(?:\((?:[^()]|\([^()]*\))*\)|\r\n|[^(])|[^\\\r\n"])*"/.source+"|"+/"""(?:\\(?:\((?:[^()]|\([^()]*\))*\)|[^(])|[^\\"]|"(?!""))*"""/.source+")"+/(?!["#])/.source),lookbehind:!0,greedy:!0,inside:{interpolation:{pattern:/(\\\()(?:[^()]|\([^()]*\))*(?=\))/,lookbehind:!0,inside:null},"interpolation-punctuation":{pattern:/^\)|\\\($/,alias:"punctuation"},punctuation:/\\(?=[\r\n])/,string:/[\s\S]+/}},{pattern:RegExp(/(^|[^"#])(#+)/.source+"(?:"+/"(?:\\(?:#+\((?:[^()]|\([^()]*\))*\)|\r\n|[^#])|[^\\\r\n])*?"/.source+"|"+/"""(?:\\(?:#+\((?:[^()]|\([^()]*\))*\)|[^#])|[^\\])*?"""/.source+")\\2"),lookbehind:!0,greedy:!0,inside:{interpolation:{pattern:/(\\#+\()(?:[^()]|\([^()]*\))*(?=\))/,lookbehind:!0,inside:null},"interpolation-punctuation":{pattern:/^\)|\\#+\($/,alias:"punctuation"},string:/[\s\S]+/}}],directive:{pattern:RegExp(/#/.source+"(?:"+(/(?:elseif|if)\b/.source+"(?:[ ]*"+/(?:![ \t]*)?(?:\b\w+\b(?:[ \t]*\((?:[^()]|\([^()]*\))*\))?|\((?:[^()]|\([^()]*\))*\))(?:[ \t]*(?:&&|\|\|))?/.source+")+")+"|"+/(?:else|endif)\b/.source+")"),alias:"property",inside:{"directive-name":/^#\w+/,boolean:/\b(?:false|true)\b/,number:/\b\d+(?:\.\d+)*\b/,operator:/!|&&|\|\||[<>]=?/,punctuation:/[(),]/}},literal:{pattern:/#(?:colorLiteral|column|dsohandle|file(?:ID|Literal|Path)?|function|imageLiteral|line)\b/,alias:"constant"},"other-directive":{pattern:/#\w+\b/,alias:"property"},attribute:{pattern:/@\w+/,alias:"atrule"},"function-definition":{pattern:/(\bfunc\s+)\w+/,lookbehind:!0,alias:"function"},label:{pattern:/\b(break|continue)\s+\w+|\b[a-zA-Z_]\w*(?=\s*:\s*(?:for|repeat|while)\b)/,lookbehind:!0,alias:"important"},keyword:/\b(?:Any|Protocol|Self|Type|actor|as|assignment|associatedtype|associativity|async|await|break|case|catch|class|continue|convenience|default|defer|deinit|didSet|do|dynamic|else|enum|extension|fallthrough|fileprivate|final|for|func|get|guard|higherThan|if|import|in|indirect|infix|init|inout|internal|is|isolated|lazy|left|let|lowerThan|mutating|none|nonisolated|nonmutating|open|operator|optional|override|postfix|precedencegroup|prefix|private|protocol|public|repeat|required|rethrows|return|right|safe|self|set|some|static|struct|subscript|super|switch|throw|throws|try|typealias|unowned|unsafe|var|weak|where|while|willSet)\b/,boolean:/\b(?:false|true)\b/,nil:{pattern:/\bnil\b/,alias:"constant"},"short-argument":/\$\d+\b/,omit:{pattern:/\b_\b/,alias:"keyword"},number:/\b(?:[\d_]+(?:\.[\de_]+)?|0x[a-f0-9_]+(?:\.[a-f0-9p_]+)?|0b[01_]+|0o[0-7_]+)\b/i,"class-name":/\b[A-Z](?:[A-Z_\d]*[a-z]\w*)?\b/,function:/\b[a-z_]\w*(?=\s*\()/i,constant:/\b(?:[A-Z_]{2,}|k[A-Z][A-Za-z_]+)\b/,operator:/[-+*/%=!<>&|^~?]+|\.[.\-+*/%=!<>&|^~?]+/,punctuation:/[{}[\]();,.:\\]/},e.languages.swift["string-literal"].forEach(function(t){t.inside.interpolation.inside=e.languages.swift})}dm.displayName="typescript";dm.aliases=["ts"];function dm(e){e.register(Zu),(function(t){t.languages.typescript=t.languages.extend("javascript",{"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,lookbehind:!0,greedy:!0,inside:null},builtin:/\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/}),t.languages.typescript.keyword.push(/\b(?:abstract|declare|is|keyof|readonly|require)\b/,/\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,/\btype\b(?=\s*(?:[\{*]|$))/),delete t.languages.typescript.parameter,delete t.languages.typescript["literal-property"];var n=t.languages.extend("typescript",{});delete n["class-name"],t.languages.typescript["class-name"].inside=n,t.languages.insertBefore("typescript","function",{decorator:{pattern:/@[$\w\xA0-\uFFFF]+/,inside:{at:{pattern:/^@/,alias:"operator"},function:/^[\s\S]+/}},"generic-function":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,greedy:!0,inside:{function:/^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:n}}}}),t.languages.ts=t.languages.typescript})(e)}Ju.displayName="basic";Ju.aliases=[];function Ju(e){e.languages.basic={comment:{pattern:/(?:!|REM\b).+/i,inside:{keyword:/^REM/i}},string:{pattern:/"(?:""|[!#$%&'()*,\/:;<=>?^\w +\-.])*"/,greedy:!0},number:/(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:E[+-]?\d+)?/i,keyword:/\b(?:AS|BEEP|BLOAD|BSAVE|CALL(?: ABSOLUTE)?|CASE|CHAIN|CHDIR|CLEAR|CLOSE|CLS|COM|COMMON|CONST|DATA|DECLARE|DEF(?: FN| SEG|DBL|INT|LNG|SNG|STR)|DIM|DO|DOUBLE|ELSE|ELSEIF|END|ENVIRON|ERASE|ERROR|EXIT|FIELD|FILES|FOR|FUNCTION|GET|GOSUB|GOTO|IF|INPUT|INTEGER|IOCTL|KEY|KILL|LINE INPUT|LOCATE|LOCK|LONG|LOOP|LSET|MKDIR|NAME|NEXT|OFF|ON(?: COM| ERROR| KEY| TIMER)?|OPEN|OPTION BASE|OUT|POKE|PUT|READ|REDIM|REM|RESTORE|RESUME|RETURN|RMDIR|RSET|RUN|SELECT CASE|SHARED|SHELL|SINGLE|SLEEP|STATIC|STEP|STOP|STRING|SUB|SWAP|SYSTEM|THEN|TIMER|TO|TROFF|TRON|TYPE|UNLOCK|UNTIL|USING|VIEW PRINT|WAIT|WEND|WHILE|WRITE)(?:\$|\b)/i,function:/\b(?:ABS|ACCESS|ACOS|ANGLE|AREA|ARITHMETIC|ARRAY|ASIN|ASK|AT|ATN|BASE|BEGIN|BREAK|CAUSE|CEIL|CHR|CLIP|COLLATE|COLOR|CON|COS|COSH|COT|CSC|DATE|DATUM|DEBUG|DECIMAL|DEF|DEG|DEGREES|DELETE|DET|DEVICE|DISPLAY|DOT|ELAPSED|EPS|ERASABLE|EXLINE|EXP|EXTERNAL|EXTYPE|FILETYPE|FIXED|FP|GO|GRAPH|HANDLER|IDN|IMAGE|IN|INT|INTERNAL|IP|IS|KEYED|LBOUND|LCASE|LEFT|LEN|LENGTH|LET|LINE|LINES|LOG|LOG10|LOG2|LTRIM|MARGIN|MAT|MAX|MAXNUM|MID|MIN|MISSING|MOD|NATIVE|NUL|NUMERIC|OF|OPTION|ORD|ORGANIZATION|OUTIN|OUTPUT|PI|POINT|POINTER|POINTS|POS|PRINT|PROGRAM|PROMPT|RAD|RADIANS|RANDOMIZE|RECORD|RECSIZE|RECTYPE|RELATIVE|REMAINDER|REPEAT|REST|RETRY|REWRITE|RIGHT|RND|ROUND|RTRIM|SAME|SEC|SELECT|SEQUENTIAL|SET|SETTER|SGN|SIN|SINH|SIZE|SKIP|SQR|STANDARD|STATUS|STR|STREAM|STYLE|TAB|TAN|TANH|TEMPLATE|TEXT|THERE|TIME|TIMEOUT|TRACE|TRANSFORM|TRUNCATE|UBOUND|UCASE|USE|VAL|VARIABLE|VIEWPORT|WHEN|WINDOW|WITH|ZER|ZONEWIDTH)(?:\$|\b)/i,operator:/<[=>]?|>=?|[+\-*\/^=&]|\b(?:AND|EQV|IMP|NOT|OR|XOR)\b/i,punctuation:/[,;:()]/}}pm.displayName="vbnet";pm.aliases=[];function pm(e){e.register(Ju),e.languages.vbnet=e.languages.extend("basic",{comment:[{pattern:/(?:!|REM\b).+/i,inside:{keyword:/^REM/i}},{pattern:/(^|[^\\:])'.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(^|[^"])"(?:""|[^"])*"(?!")/,lookbehind:!0,greedy:!0},keyword:/(?:\b(?:ADDHANDLER|ADDRESSOF|ALIAS|AND|ANDALSO|AS|BEEP|BLOAD|BOOLEAN|BSAVE|BYREF|BYTE|BYVAL|CALL(?: ABSOLUTE)?|CASE|CATCH|CBOOL|CBYTE|CCHAR|CDATE|CDBL|CDEC|CHAIN|CHAR|CHDIR|CINT|CLASS|CLEAR|CLNG|CLOSE|CLS|COBJ|COM|COMMON|CONST|CONTINUE|CSBYTE|CSHORT|CSNG|CSTR|CTYPE|CUINT|CULNG|CUSHORT|DATA|DATE|DECIMAL|DECLARE|DEF(?: FN| SEG|DBL|INT|LNG|SNG|STR)|DEFAULT|DELEGATE|DIM|DIRECTCAST|DO|DOUBLE|ELSE|ELSEIF|END|ENUM|ENVIRON|ERASE|ERROR|EVENT|EXIT|FALSE|FIELD|FILES|FINALLY|FOR(?: EACH)?|FRIEND|FUNCTION|GET|GETTYPE|GETXMLNAMESPACE|GLOBAL|GOSUB|GOTO|HANDLES|IF|IMPLEMENTS|IMPORTS|IN|INHERITS|INPUT|INTEGER|INTERFACE|IOCTL|IS|ISNOT|KEY|KILL|LET|LIB|LIKE|LINE INPUT|LOCATE|LOCK|LONG|LOOP|LSET|ME|MKDIR|MOD|MODULE|MUSTINHERIT|MUSTOVERRIDE|MYBASE|MYCLASS|NAME|NAMESPACE|NARROWING|NEW|NEXT|NOT|NOTHING|NOTINHERITABLE|NOTOVERRIDABLE|OBJECT|OF|OFF|ON(?: COM| ERROR| KEY| TIMER)?|OPEN|OPERATOR|OPTION(?: BASE)?|OPTIONAL|OR|ORELSE|OUT|OVERLOADS|OVERRIDABLE|OVERRIDES|PARAMARRAY|PARTIAL|POKE|PRIVATE|PROPERTY|PROTECTED|PUBLIC|PUT|RAISEEVENT|READ|READONLY|REDIM|REM|REMOVEHANDLER|RESTORE|RESUME|RETURN|RMDIR|RSET|RUN|SBYTE|SELECT(?: CASE)?|SET|SHADOWS|SHARED|SHELL|SHORT|SINGLE|SLEEP|STATIC|STEP|STOP|STRING|STRUCTURE|SUB|SWAP|SYNCLOCK|SYSTEM|THEN|THROW|TIMER|TO|TROFF|TRON|TRUE|TRY|TRYCAST|TYPE|TYPEOF|UINTEGER|ULONG|UNLOCK|UNTIL|USHORT|USING|VIEW PRINT|WAIT|WEND|WHEN|WHILE|WIDENING|WITH|WITHEVENTS|WRITE|WRITEONLY|XOR)|\B(?:#CONST|#ELSE|#ELSEIF|#END|#IF))(?:\$|\b)/i,punctuation:/[,;:(){}]/})}const D1=/[#.]/g;function $M(e,t){const n=e||"",r={};let a=0,l,u;for(;a=48&&t<=57}function ZM(e){const t=typeof e=="string"?e.charCodeAt(0):e;return t>=97&&t<=102||t>=65&&t<=70||t>=48&&t<=57}function QM(e){const t=typeof e=="string"?e.charCodeAt(0):e;return t>=97&&t<=122||t>=65&&t<=90}function L1(e){return QM(e)||lw(e)}const JM=["","Named character references must be terminated by a semicolon","Numeric character references must be terminated by a semicolon","Named character references cannot be empty","Numeric character references cannot be empty","Named character references must be known","Numeric character references cannot be disallowed","Numeric character references cannot be outside the permissible Unicode range"];function eL(e,t){const n={},r=typeof n.additional=="string"?n.additional.charCodeAt(0):n.additional,a=[];let l=0,u=-1,o="",c,f;n.position&&("start"in n.position||"indent"in n.position?(f=n.position.indent,c=n.position.start):c=n.position);let p=(c?c.line:0)||1,d=(c?c.column:0)||1,_=w(),v;for(l--;++l<=e.length;)if(v===10&&(d=(f?f[u]:0)||1),v=e.charCodeAt(l),v===38){const S=e.charCodeAt(l+1);if(S===9||S===10||S===12||S===32||S===38||S===60||Number.isNaN(S)||r&&S===r){o+=String.fromCharCode(v),d++;continue}const x=l+1;let b=x,k=x,D;if(S===35){k=++b;const F=e.charCodeAt(k);F===88||F===120?(D="hexadecimal",k=++b):D="decimal"}else D="named";let T="",R="",N="";const M=D==="named"?L1:D==="decimal"?lw:ZM;for(k--;++k<=e.length;){const F=e.charCodeAt(k);if(!M(F))break;N+=String.fromCharCode(F),D==="named"&&KM.includes(N)&&(T=N,R=Ho(N))}let B=e.charCodeAt(k)===59;if(B){k++;const F=D==="named"?Ho(N):!1;F&&(T=N,R=F)}let H=1+k-x,Y="";if(!(!B&&n.nonTerminated===!1))if(!N)D!=="named"&&C(4,H);else if(D==="named"){if(B&&!R)C(5,1);else if(T!==N&&(k=b+T.length,H=1+k-b,B=!1),!B){const F=T?1:3;if(n.attribute){const z=e.charCodeAt(k);z===61?(C(F,H),R=""):L1(z)?R="":C(F,H)}else C(F,H)}Y=R}else{B||C(2,H);let F=Number.parseInt(N,D==="hexadecimal"?16:10);if(tL(F))C(7,H),Y="�";else if(F in M1)C(6,H),Y=M1[F];else{let z="";nL(F)&&C(6,H),F>65535&&(F-=65536,z+=String.fromCharCode(F>>>10|55296),F=56320|F&1023),Y=z+String.fromCharCode(F)}}if(Y){y(),_=w(),l=k-1,d+=k-x+1,a.push(Y);const F=w();F.offset++,n.reference&&n.reference.call(n.referenceContext||void 0,Y,{start:_,end:F},e.slice(x-1,k)),_=F}else N=e.slice(x-1,k),o+=N,d+=N.length,l=k-1}else v===10&&(p++,u++,d=0),Number.isNaN(v)?y():(o+=String.fromCharCode(v),d++);return a.join("");function w(){return{line:p,column:d,offset:l+((c?c.offset:0)||0)}}function C(S,x){let b;n.warning&&(b=w(),b.column+=x,b.offset+=x,n.warning.call(n.warningContext||void 0,JM[S],b,S))}function y(){o&&(a.push(o),n.text&&n.text.call(n.textContext||void 0,o,{start:_,end:w()}),o="")}}function tL(e){return e>=55296&&e<=57343||e>1114111}function nL(e){return e>=1&&e<=8||e===11||e>=13&&e<=31||e>=127&&e<=159||e>=64976&&e<=65007||(e&65535)===65535||(e&65535)===65534}var iL=0,Uc={},Vt={util:{type:function(e){return Object.prototype.toString.call(e).slice(8,-1)},objId:function(e){return e.__id||Object.defineProperty(e,"__id",{value:++iL}),e.__id},clone:function e(t,n){n=n||{};var r,a;switch(Vt.util.type(t)){case"Object":if(a=Vt.util.objId(t),n[a])return n[a];r={},n[a]=r;for(var l in t)t.hasOwnProperty(l)&&(r[l]=e(t[l],n));return r;case"Array":return a=Vt.util.objId(t),n[a]?n[a]:(r=[],n[a]=r,t.forEach(function(u,o){r[o]=e(u,n)}),r);default:return t}}},languages:{plain:Uc,plaintext:Uc,text:Uc,txt:Uc,extend:function(e,t){var n=Vt.util.clone(Vt.languages[e]);for(var r in t)n[r]=t[r];return n},insertBefore:function(e,t,n,r){r=r||Vt.languages;var a=r[e],l={};for(var u in a)if(a.hasOwnProperty(u)){if(u==t)for(var o in n)n.hasOwnProperty(o)&&(l[o]=n[o]);n.hasOwnProperty(u)||(l[u]=a[u])}var c=r[e];return r[e]=l,Vt.languages.DFS(Vt.languages,function(f,p){p===c&&f!=e&&(this[f]=l)}),l},DFS:function e(t,n,r,a){a=a||{};var l=Vt.util.objId;for(var u in t)if(t.hasOwnProperty(u)){n.call(t,u,t[u],r||u);var o=t[u],c=Vt.util.type(o);c==="Object"&&!a[l(o)]?(a[l(o)]=!0,e(o,n,null,a)):c==="Array"&&!a[l(o)]&&(a[l(o)]=!0,e(o,n,u,a))}}},plugins:{},highlight:function(e,t,n){var r={code:e,grammar:t,language:n};if(Vt.hooks.run("before-tokenize",r),!r.grammar)throw new Error('The language "'+r.language+'" has no grammar.');return r.tokens=Vt.tokenize(r.code,r.grammar),Vt.hooks.run("after-tokenize",r),Mo.stringify(Vt.util.encode(r.tokens),r.language)},tokenize:function(e,t){var n=t.rest;if(n){for(var r in n)t[r]=n[r];delete t.rest}var a=new rL;return uu(a,a.head,e),cw(e,a,t,a.head,0),aL(a)},hooks:{all:{},add:function(e,t){var n=Vt.hooks.all;n[e]=n[e]||[],n[e].push(t)},run:function(e,t){var n=Vt.hooks.all[e];if(!(!n||!n.length))for(var r=0,a;a=n[r++];)a(t)}},Token:Mo};function Mo(e,t,n,r){this.type=e,this.content=t,this.alias=n,this.length=(r||"").length|0}function O1(e,t,n,r){e.lastIndex=t;var a=e.exec(n);if(a&&r&&a[1]){var l=a[1].length;a.index+=l,a[0]=a[0].slice(l)}return a}function cw(e,t,n,r,a,l){for(var u in n)if(!(!n.hasOwnProperty(u)||!n[u])){var o=n[u];o=Array.isArray(o)?o:[o];for(var c=0;c=l.reach);S+=y.value.length,y=y.next){var x=y.value;if(t.length>e.length)return;if(!(x instanceof Mo)){var b=1,k;if(_){if(k=O1(C,S,e,d),!k||k.index>=e.length)break;var N=k.index,D=k.index+k[0].length,T=S;for(T+=y.value.length;N>=T;)y=y.next,T+=y.value.length;if(T-=y.value.length,S=T,y.value instanceof Mo)continue;for(var R=y;R!==t.tail&&(Tl.reach&&(l.reach=Y);var F=y.prev;B&&(F=uu(t,F,B),S+=B.length),sL(t,F,b);var z=new Mo(u,p?Vt.tokenize(M,p):M,v,M);if(y=uu(t,F,z),H&&uu(t,y,H),b>1){var q={cause:u+","+c,reach:Y};cw(e,t,n,y.prev,S,q),l&&q.reach>l.reach&&(l.reach=q.reach)}}}}}}function rL(){var e={value:null,prev:null,next:null},t={value:null,prev:e,next:null};e.next=t,this.head=e,this.tail=t,this.length=0}function uu(e,t,n){var r=t.next,a={value:n,prev:t,next:r};return t.next=a,r.prev=a,e.length++,a}function sL(e,t,n){for(var r=t.next,a=0;an)return e;try{return Me.highlight(e,t).children.map(fw)}catch{return e}}const pL=1e5;function gL({code:e,lang:t}){const[n,r]=V.useState(!1),a=()=>{var l;(l=navigator.clipboard)==null||l.writeText(e).then(()=>{r(!0),setTimeout(()=>r(!1),1500)})};return m.jsxs("div",{className:"md-code",children:[m.jsx("button",{className:"md-code-copy",title:"Copy","aria-label":"Copy code",onClick:a,children:n?m.jsx(_n,{size:13}):m.jsx(bg,{size:13})}),m.jsx("pre",{children:m.jsx("code",{children:dw(e,t,pL)})})]})}function mL(e){const t={};for(const n of e.matchAll(/([\w-]+)=(["'])(.*?)\2/g)){const r=n[1];r&&(t[r.toLowerCase()]=n[3]??"")}return t}function _L(e){const t=/]*?)\/?>/gi,n=[];let r=0,a=!1;for(const l of e.matchAll(t)){const u=mL(l[1]??"");u.path&&(a=!0,l.index>r&&n.push({type:"text",value:e.slice(r,l.index)}),n.push({children:[],data:{hName:"file-mention",hProperties:u},type:"fileMention"}),r=l.index+l[0].length)}return a?(rpw(e)}function j1({path:e,lines:t,onOpenFile:n}){const r=e.split("/").pop()||e,a=t&&Number.parseInt(t,10)||void 0,l=a!=null?`${r}:${a}`:r;return m.jsxs("button",{className:"file-chip",title:`Open ${e}`,onClick:()=>n==null?void 0:n(e),disabled:!n,children:[m.jsx(IS,{size:12}),m.jsx("span",{className:"file-chip-label",children:l})]})}function yL(e){return!(/^[a-z][a-z0-9+.-]*:/i.test(e)||e.startsWith("#")||e.startsWith("//"))}const gw={code:({node:e,className:t,children:n,...r})=>{const a=t??"",l=/language-(\w+)/.exec(a),u=String(n??"").replace(/\n$/,"");if(!(l!=null||u.includes(` -`)))return m.jsx("code",{className:a,...r,children:n});const c=l?$p(l[1]):null;return m.jsx(gL,{code:u,lang:c})},pre:({children:e})=>m.jsx(m.Fragment,{children:e})};function eh({text:e,onOpenFile:t}){const n={"file-mention":r=>m.jsx(j1,{path:r.path,lines:r.lines,onOpenFile:t}),a:({node:r,href:a,children:l,...u})=>a&&yL(a)&&t?m.jsx(j1,{path:decodeURI(a),onOpenFile:t}):m.jsx("a",{href:a,target:"_blank",rel:"noopener noreferrer",...u,children:l}),...gw};return m.jsx("div",{className:"md",children:m.jsx(jx,{remarkPlugins:[sw,vL],components:n,children:e})})}function bL({plan:e,synthesized:t,onView:n,onApprove:r,onKeepPlanning:a}){const[l,u]=V.useState(!1),o=V.useRef(null);V.useEffect(()=>{if(!l)return;const f=p=>{o.current&&!o.current.contains(p.target)&&u(!1)};return window.addEventListener("pointerdown",f),()=>window.removeEventListener("pointerdown",f)},[l]);const c=e.split(` -`).map(f=>f.replace(/^#+\s*/,"").trim()).find(f=>f.length>0)??"";return m.jsxs("div",{className:"plan-strip",children:[m.jsxs("div",{className:"plan-strip-info",children:[m.jsx(PS,{size:14,className:"plan-strip-icon"}),m.jsxs("div",{className:"plan-strip-text",children:[m.jsx("span",{className:"plan-strip-title",children:t?"Plan mode — ready to proceed?":"Plan ready"}),c&&m.jsx("span",{className:"plan-strip-excerpt",children:c})]})]}),m.jsxs("div",{className:"plan-strip-actions",children:[m.jsx("button",{className:"btn-ghost",onClick:n,children:"View plan"}),m.jsx("button",{className:"btn-ghost",onClick:a,children:"Keep planning"}),m.jsxs("div",{className:"plan-strip-approve",ref:o,children:[m.jsx("button",{className:"btn-primary",onClick:()=>r("auto"),children:"Approve & run"}),m.jsx("button",{className:"btn-primary plan-strip-caret","aria-label":"More approval options",onClick:()=>u(f=>!f),children:m.jsx(ga,{size:13})}),l&&m.jsxs("div",{className:"plan-strip-menu",children:[m.jsx("button",{onClick:()=>{u(!1),r("accept-edits")},children:"Approve & accept edits"}),m.jsx("button",{onClick:()=>{u(!1),r("bypass")},children:"Approve & bypass all"})]})]})]})]})}function mw({onSaved:e}){const[t,n]=V.useState(""),[r,a]=V.useState(!1),[l,u]=V.useState(null);async function o(c){if(c.preventDefault(),!(r||!t.trim())){a(!0),u(null);try{e(await eN(t.trim())),n("")}catch(f){u(f instanceof Error?f.message:String(f))}finally{a(!1)}}}return m.jsxs("form",{className:"onb-token-form",onSubmit:o,children:[m.jsx("input",{type:"password",value:t,onChange:c=>n(c.target.value),placeholder:"ghp_… personal access token",autoComplete:"off"}),m.jsx("button",{type:"submit",className:"btn",disabled:r||!t.trim(),children:r?"Checking…":"Save"}),m.jsx("a",{href:"https://github.com/settings/tokens/new?scopes=repo,workflow&description=orx",target:"_blank",rel:"noreferrer",children:"Create a token ↗"}),l&&m.jsx("div",{className:"error",children:l})]})}function SL(e){switch(e){case"modal_job":return"Modal";case"hf_job":return"Hugging Face";case"k8s_job":return"Kubernetes";case"ssh_job":return"SSH";case"slurm_job":return"Slurm";case"openresearch_job":return"OpenResearch";case"local_job":return"This machine";default:return e||"—"}}function xL({size:e=16}){return m.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24","aria-hidden":"true",children:[m.jsx("path",{d:"M2.25 11.535c0-3.407 1.847-6.554 4.844-8.258a9.822 9.822 0 019.687 0c2.997 1.704 4.844 4.851 4.844 8.258 0 5.266-4.337 9.535-9.687 9.535S2.25 16.8 2.25 11.535z",fill:"#FF9D0B"}),m.jsx("path",{d:"M11.938 20.086c4.797 0 8.687-3.829 8.687-8.551 0-4.722-3.89-8.55-8.687-8.55-4.798 0-8.688 3.828-8.688 8.55 0 4.722 3.89 8.55 8.688 8.55z",fill:"#FFD21E"}),m.jsx("path",{d:"M11.875 15.113c2.457 0 3.25-2.156 3.25-3.263 0-.576-.393-.394-1.023-.089-.582.283-1.365.675-2.224.675-1.798 0-3.25-1.693-3.25-.586 0 1.107.79 3.263 3.25 3.263h-.003z",fill:"#FF323D"}),m.jsx("path",{d:"M14.76 9.21c.32.108.445.753.767.585.447-.233.707-.708.659-1.204a1.235 1.235 0 00-.879-1.059 1.262 1.262 0 00-1.33.394c-.322.384-.377.92-.14 1.36.153.283.638-.177.925-.079l-.002.003zm-5.887 0c-.32.108-.448.753-.768.585a1.226 1.226 0 01-.658-1.204c.048-.495.395-.913.878-1.059a1.262 1.262 0 011.33.394c.322.384.377.92.14 1.36-.152.283-.64-.177-.925-.079l.003.003z",fill:"#3A3B45"}),m.jsx("path",{d:"M17.812 10.366a.806.806 0 00.813-.8c0-.441-.364-.8-.813-.8a.806.806 0 00-.812.8c0 .442.364.8.812.8zm-11.624 0a.806.806 0 00.812-.8c0-.441-.364-.8-.812-.8a.806.806 0 00-.813.8c0 .442.364.8.813.8z",fill:"#3A3B45"}),m.jsx("path",{d:"M4.515 13.073c-.405 0-.765.162-1.017.46a1.455 1.455 0 00-.333.925 1.801 1.801 0 00-.485-.074c-.387 0-.737.146-.985.409a1.41 1.41 0 00-.2 1.722 1.302 1.302 0 00-.447.694c-.06.222-.12.69.2 1.166a1.267 1.267 0 00-.093 1.236c.238.533.81.958 1.89 1.405l.24.096c.768.3 1.473.492 1.478.494.89.243 1.808.375 2.732.394 1.465 0 2.513-.443 3.115-1.314.93-1.342.842-2.575-.274-3.763l-.151-.154c-.692-.684-1.155-1.69-1.25-1.912-.195-.655-.71-1.383-1.562-1.383-.46.007-.889.233-1.15.605-.25-.31-.495-.553-.715-.694a1.87 1.87 0 00-.993-.312zm14.97 0c.405 0 .767.162 1.017.46.216.262.333.588.333.925.158-.047.322-.071.487-.074.388 0 .738.146.985.409a1.41 1.41 0 01.2 1.722c.22.178.377.422.445.694.06.222.12.69-.2 1.166.244.37.279.836.093 1.236-.238.533-.81.958-1.889 1.405l-.239.096c-.77.3-1.475.492-1.48.494-.89.243-1.808.375-2.732.394-1.465 0-2.513-.443-3.115-1.314-.93-1.342-.842-2.575.274-3.763l.151-.154c.695-.684 1.157-1.69 1.252-1.912.195-.655.708-1.383 1.56-1.383.46.007.889.233 1.15.605.25-.31.495-.553.718-.694.244-.162.523-.265.814-.3l.176-.012z",fill:"#FF9D0B"}),m.jsx("path",{d:"M9.785 20.132c.688-.994.638-1.74-.305-2.667-.945-.928-1.495-2.288-1.495-2.288s-.205-.788-.672-.714c-.468.074-.81 1.25.17 1.971.977.721-.195 1.21-.573.534-.375-.677-1.405-2.416-1.94-2.751-.532-.332-.907-.148-.782.541.125.687 2.357 2.35 2.14 2.707-.218.362-.983-.42-.983-.42S2.953 14.9 2.43 15.46c-.52.558.398 1.026 1.7 1.803 1.308.778 1.41.985 1.225 1.28-.187.295-3.07-2.1-3.34-1.083-.27 1.011 2.943 1.304 2.745 2.006-.2.7-2.265-1.324-2.685-.537-.425.79 2.913 1.718 2.94 1.725 1.075.276 3.813.859 4.77-.522zm4.432 0c-.687-.994-.64-1.74.305-2.667.943-.928 1.493-2.288 1.493-2.288s.205-.788.675-.714c.465.074.807 1.25-.17 1.971-.98.721.195 1.21.57.534.377-.677 1.407-2.416 1.94-2.751.532-.332.91-.148.782.541-.125.687-2.355 2.35-2.137 2.707.215.362.98-.42.98-.42S21.05 14.9 21.57 15.46c.52.558-.395 1.026-1.7 1.803-1.308.778-1.408.985-1.225 1.28.187.295 3.07-2.1 3.34-1.083.27 1.011-2.94 1.304-2.743 2.006.2.7 2.263-1.324 2.685-.537.423.79-2.912 1.718-2.94 1.725-1.077.276-3.815.859-4.77-.522z",fill:"#FFD21E"})]})}function wL({size:e=16}){return m.jsxs("svg",{width:e,height:e,viewBox:"0 0 300 300",fill:"none","aria-hidden":"true",children:[m.jsx("path",{d:"M121.683 75.25L149.997 124L91.4816 224.75C90.3128 226.757 88.155 228 85.8174 228H32.9664C31.7976 228 30.6778 227.691 29.697 227.131C28.7161 226.57 27.8906 225.758 27.3021 224.75L0.876625 179.25C-0.292208 177.243 -0.292208 174.765 0.876625 172.75L57.512 75.25C58.0923 74.2425 58.9259 73.43 59.9068 72.8694C60.8876 72.3088 62.0074 72 63.1762 72H116.027C118.365 72 120.523 73.2431 121.692 75.25H121.683ZM299.125 172.75L242.49 75.25C241.91 74.2425 241.076 73.43 240.095 72.8694C239.114 72.3088 237.995 72 236.826 72H183.975C181.637 72 179.479 73.2431 178.311 75.25L149.997 124L208.512 224.75C209.681 226.757 211.839 228 214.177 228H267.027C268.196 228 269.316 227.691 270.297 227.131C271.278 226.57 272.103 225.758 272.692 224.75L299.117 179.25C300.286 177.243 300.286 174.765 299.117 172.75H299.125Z",fill:"#62DE61"}),m.jsx("path",{d:"M89.6018 124H150.005L121.692 75.25C120.523 73.2431 118.365 72 116.027 72H63.1763C62.0074 72 60.8876 72.3088 59.9068 72.8694L89.6018 124Z",fill:"url(#orxModalA)"}),m.jsx("path",{d:"M89.6018 124L59.9068 72.8694C58.9259 73.43 58.1005 74.2425 57.512 75.25L0.876625 172.75C-0.292208 174.765 -0.292208 177.235 0.876625 179.25L27.3021 224.75C27.8825 225.758 28.7161 226.57 29.697 227.131L89.5936 124H89.6018Z",fill:"url(#orxModalB)"}),m.jsx("path",{d:"M149.997 124H89.5936L29.697 227.131C30.6778 227.691 31.7976 228 32.9664 228H85.8174C88.155 228 90.3128 226.757 91.4816 224.75L149.997 124Z",fill:"#09AF58"}),m.jsx("path",{d:"M299.125 179.25C299.706 178.243 300 177.121 300 176H240.61L210.915 227.131C211.896 227.691 213.016 228 214.185 228H267.036C269.373 228 271.531 226.757 272.7 224.75L299.125 179.25Z",fill:"#09AF58"}),m.jsx("path",{d:"M183.975 72C182.806 72 181.686 72.3088 180.705 72.8694L240.602 176H299.992C299.992 174.879 299.698 173.758 299.117 172.75L242.49 75.25C241.321 73.2431 239.163 72 236.826 72H183.967H183.975Z",fill:"url(#orxModalC)"}),m.jsx("path",{d:"M210.907 227.131L240.602 176L180.705 72.8694C179.725 73.43 178.899 74.2425 178.311 75.25L149.997 124L208.512 224.75C209.093 225.758 209.926 226.57 210.907 227.131Z",fill:"url(#orxModalD)"}),m.jsxs("defs",{children:[m.jsxs("linearGradient",{id:"orxModalA",x1:"127.348",y1:"137",x2:"82.9561",y2:"59.6398",gradientUnits:"userSpaceOnUse",children:[m.jsx("stop",{stopColor:"#BFF9B4"}),m.jsx("stop",{offset:"1",stopColor:"#80EE64"})]}),m.jsxs("linearGradient",{id:"orxModalB",x1:"7.04774",y1:"214.131",x2:"81.1284",y2:"85.0556",gradientUnits:"userSpaceOnUse",children:[m.jsx("stop",{stopColor:"#80EE64"}),m.jsx("stop",{offset:"0.18",stopColor:"#7BEB63"}),m.jsx("stop",{offset:"0.36",stopColor:"#6FE562"}),m.jsx("stop",{offset:"0.55",stopColor:"#5ADA60"}),m.jsx("stop",{offset:"0.74",stopColor:"#3DCA5D"}),m.jsx("stop",{offset:"0.93",stopColor:"#18B759"}),m.jsx("stop",{offset:"1",stopColor:"#09AF58"})]}),m.jsxs("linearGradient",{id:"orxModalC",x1:"278.103",y1:"188.561",x2:"204.022",y2:"59.4863",gradientUnits:"userSpaceOnUse",children:[m.jsx("stop",{stopColor:"#BFF9B4"}),m.jsx("stop",{offset:"1",stopColor:"#80EE64"})]}),m.jsxs("linearGradient",{id:"orxModalD",x1:"232.804",y1:"214.569",x2:"158.724",y2:"85.4864",gradientUnits:"userSpaceOnUse",children:[m.jsx("stop",{stopColor:"#80EE64"}),m.jsx("stop",{offset:"0.18",stopColor:"#7BEB63"}),m.jsx("stop",{offset:"0.36",stopColor:"#6FE562"}),m.jsx("stop",{offset:"0.55",stopColor:"#5ADA60"}),m.jsx("stop",{offset:"0.74",stopColor:"#3DCA5D"}),m.jsx("stop",{offset:"0.93",stopColor:"#18B759"}),m.jsx("stop",{offset:"1",stopColor:"#09AF58"})]})]})]})}function CL({size:e=16}){return m.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"#326CE5","aria-hidden":"true",children:m.jsx("path",{d:"M10.204 14.35l.007.01-.999 2.413a5.171 5.171 0 0 1-2.075-2.597l2.578-.437.004.005a.44.44 0 0 1 .484.606zm-.833-2.129a.44.44 0 0 0 .173-.756l.002-.011L7.585 9.7a5.143 5.143 0 0 0-.73 3.255l2.514-.725.002-.009zm1.145-1.98a.44.44 0 0 0 .699-.337l.01-.005.15-2.62a5.144 5.144 0 0 0-3.01 1.442l2.147 1.523.004-.002zm.76 2.75l.723.349.722-.347.18-.78-.5-.623h-.804l-.5.623.179.779zm1.5-3.095a.44.44 0 0 0 .7.336l.008.003 2.134-1.513a5.188 5.188 0 0 0-2.992-1.442l.148 2.615.002.001zm10.876 5.97l-5.773 7.181a1.6 1.6 0 0 1-1.248.594l-9.261.003a1.6 1.6 0 0 1-1.247-.596l-5.776-7.18a1.583 1.583 0 0 1-.307-1.34L2.1 5.573c.108-.47.425-.864.863-1.073L11.305.513a1.606 1.606 0 0 1 1.385 0l8.345 3.985c.438.209.755.604.863 1.073l2.062 8.955c.108.47-.005.963-.308 1.34zm-3.289-2.057c-.042-.01-.103-.026-.145-.034-.174-.033-.315-.025-.479-.038-.35-.037-.638-.067-.895-.148-.105-.04-.18-.165-.216-.216l-.201-.059a6.45 6.45 0 0 0-.105-2.332 6.465 6.465 0 0 0-.936-2.163c.052-.047.15-.133.177-.159.008-.09.001-.183.094-.282.197-.185.444-.338.743-.522.142-.084.273-.137.415-.242.032-.024.076-.062.11-.089.24-.191.295-.52.123-.736-.172-.216-.506-.236-.745-.045-.034.027-.08.062-.111.088-.134.116-.217.23-.33.35-.246.25-.45.458-.673.609-.097.056-.239.037-.303.033l-.19.135a6.545 6.545 0 0 0-4.146-2.003l-.012-.223c-.065-.062-.143-.115-.163-.25-.022-.268.015-.557.057-.905.023-.163.061-.298.068-.475.001-.04-.001-.099-.001-.142 0-.306-.224-.555-.5-.555-.275 0-.499.249-.499.555l.001.014c0 .041-.002.092 0 .128.006.177.044.312.067.475.042.348.078.637.056.906a.545.545 0 0 1-.162.258l-.012.211a6.424 6.424 0 0 0-4.166 2.003 8.373 8.373 0 0 1-.18-.128c-.09.012-.18.04-.297-.029-.223-.15-.427-.358-.673-.608-.113-.12-.195-.234-.329-.349-.03-.026-.077-.062-.111-.088a.594.594 0 0 0-.348-.132.481.481 0 0 0-.398.176c-.172.216-.117.546.123.737l.007.005.104.083c.142.105.272.159.414.242.299.185.546.338.743.522.076.082.09.226.1.288l.16.143a6.462 6.462 0 0 0-1.02 4.506l-.208.06c-.055.072-.133.184-.215.217-.257.081-.546.11-.895.147-.164.014-.305.006-.48.039-.037.007-.09.02-.133.03l-.004.002-.007.002c-.295.071-.484.342-.423.608.061.267.349.429.645.365l.007-.001.01-.003.129-.029c.17-.046.294-.113.448-.172.33-.118.604-.217.87-.256.112-.009.23.069.288.101l.217-.037a6.5 6.5 0 0 0 2.88 3.596l-.09.218c.033.084.069.199.044.282-.097.252-.263.517-.452.813-.091.136-.185.242-.268.399-.02.037-.045.095-.064.134-.128.275-.034.591.213.71.248.12.556-.007.69-.282v-.002c.02-.039.046-.09.062-.127.07-.162.094-.301.144-.458.132-.332.205-.68.387-.897.05-.06.13-.082.215-.105l.113-.205a6.453 6.453 0 0 0 4.609.012l.106.192c.086.028.18.042.256.155.136.232.229.507.342.84.05.156.074.295.145.457.016.037.043.09.062.129.133.276.442.402.69.282.247-.118.341-.435.213-.71-.02-.039-.045-.096-.065-.134-.083-.156-.177-.261-.268-.398-.19-.296-.346-.541-.443-.793-.04-.13.007-.21.038-.294-.018-.022-.059-.144-.083-.202a6.499 6.499 0 0 0 2.88-3.622c.064.01.176.03.213.038.075-.05.144-.114.28-.104.266.039.54.138.87.256.154.06.277.128.448.173.036.01.088.019.13.028l.009.003.007.001c.297.064.584-.098.645-.365.06-.266-.128-.537-.423-.608zM16.4 9.701l-1.95 1.746v.005a.44.44 0 0 0 .173.757l.003.01 2.526.728a5.199 5.199 0 0 0-.108-1.674A5.208 5.208 0 0 0 16.4 9.7zm-4.013 5.325a.437.437 0 0 0-.404-.232.44.44 0 0 0-.372.233h-.002l-1.268 2.292a5.164 5.164 0 0 0 3.326.003l-1.27-2.296h-.01zm1.888-1.293a.44.44 0 0 0-.27.036.44.44 0 0 0-.214.572l-.003.004 1.01 2.438a5.15 5.15 0 0 0 2.081-2.615l-2.6-.44-.004.005z"})})}function EL({kind:e,size:t=16}){switch(e){case"modal_job":return m.jsx(wL,{size:t});case"hf_job":return m.jsx(xL,{size:t});case"k8s_job":return m.jsx(CL,{size:t});case"ssh_job":return m.jsx(Tp,{size:t});case"slurm_job":return m.jsx(xA,{size:t});case"openresearch_job":return m.jsx(NA,{size:t});case"local_job":return m.jsx(tT,{size:t});default:return m.jsx(Tp,{size:t})}}function kL({backend:e}){const t=XS(e),n=KS(e);return t?m.jsxs("span",{className:"backend-badge",children:[m.jsx(EL,{kind:t}),m.jsx("span",{className:"backend-name",children:SL(t)}),n&&m.jsx("span",{className:"backend-detail mono",children:n})]}):m.jsx("span",{className:"backend-badge muted",children:"—"})}const B1={done:{className:"st-done",live:!1},failed:{className:"st-failed",live:!1},running:{className:"st-running",live:!0},starting:{className:"st-starting",live:!0},cancelled:{className:"st-cancelled",live:!1},editing:{className:"st-editing",live:!0},idle:{className:"st-idle",live:!1}};function AL(e){return B1[e]??B1.idle}function Po({status:e,label:t}){const n=AL(e);return m.jsxs("span",{className:`status-badge ${n.className}${n.live?" live":""}`,children:[m.jsx("span",{className:"dot"}),t??e]})}function cp(e){return e.installed&&e.authenticated?{cls:"ok",label:"Connected"}:e.installed?{cls:"warn",label:"Not signed in"}:{cls:"warn",label:"Not installed"}}function TL({h:e}){return e.authMethod?m.jsx(m.Fragment,{children:e.authMethod==="oauth"?"OAuth (subscription login)":"API key"}):m.jsx(m.Fragment,{children:"—"})}function NL(){const[e,t]=V.useState(null),[n,r]=V.useState("claude-code"),[a,l]=V.useState(!1),u=c=>{l(!0),Cg(c).then(t).catch(()=>{}).finally(()=>l(!1))};V.useEffect(()=>u(!1),[]);const o=e==null?void 0:e.find(c=>c.id===n);return m.jsxs(m.Fragment,{children:[m.jsx("h1",{children:"Harnesses"}),m.jsx("p",{className:"settings-sub",children:"Coding-agent setups detected on this machine. The research agent chat is served by OpenCode; Claude Code and Codex accounts surface their models in the composer's model picker."}),m.jsx("div",{className:"harness-tabs",children:(e??[]).map(c=>m.jsxs("button",{className:c.id===n?"active":"",onClick:()=>r(c.id),children:[c.name,m.jsx("span",{className:`harness-dot ${cp(c).cls}`})]},c.id))}),e?o?m.jsxs("div",{className:"settings-card",children:[m.jsxs("div",{className:"settings-card-head",children:[m.jsx("span",{className:`badge ${cp(o).cls}`,children:cp(o).label}),m.jsx("div",{className:"spacer",style:{flex:1}}),m.jsxs("button",{className:"btn sm",onClick:()=>u(!0),disabled:a,children:[m.jsx(bu,{size:12,className:a?"spin":""})," Refresh"]})]}),m.jsxs("div",{className:"kv",children:[m.jsx("span",{className:"k",children:"Binary"}),m.jsx("span",{className:"v",children:o.binPath??"not found on PATH"}),m.jsx("span",{className:"k",children:"Version"}),m.jsx("span",{className:"v",children:o.version??"—"}),m.jsx("span",{className:"k",children:"Auth"}),m.jsx("span",{className:"v",children:m.jsx(TL,{h:o})}),o.account&&m.jsxs(m.Fragment,{children:[m.jsx("span",{className:"k",children:o.id==="opencode"?"Providers":"Account"}),m.jsx("span",{className:"v",children:o.account})]}),o.org&&m.jsxs(m.Fragment,{children:[m.jsx("span",{className:"k",children:"Org"}),m.jsx("span",{className:"v",children:o.org})]}),o.plan&&m.jsxs(m.Fragment,{children:[m.jsx("span",{className:"k",children:"Plan"}),m.jsx("span",{className:"v",children:o.plan})]}),m.jsx("span",{className:"k",children:"Agent models"}),m.jsx("span",{className:"v",children:o.models.length>0?`${o.models.length} available — ${o.models.slice(0,4).map(c=>Su(c.id)).join(", ")}${o.models.length>4?", …":""}`:"none"})]}),!o.agentReady&&o.agentNote&&m.jsx("p",{className:"settings-note",children:o.agentNote})]}):null:m.jsxs("div",{className:"settings-loading",children:[m.jsx("span",{className:"spinner"})," Detecting harnesses…"]})]})}function DL({s:e}){if(!e.configured)return m.jsx("span",{className:"badge",children:"not configured"});const t=e.preflight;return t.kubectlFound?t.reachable?t.canCreateJobs?m.jsx("span",{className:"badge ok",children:"connected"}):m.jsx("span",{className:"badge err",children:"no job-create permission"}):m.jsx("span",{className:"badge err",children:"cluster unreachable"}):m.jsx("span",{className:"badge err",children:"kubectl not found"})}function RL(){const[e,t]=V.useState(null),[n,r]=V.useState(null),[a,l]=V.useState(""),[u,o]=V.useState(""),[c,f]=V.useState(!1),[p,d]=V.useState(null),_=C=>{t(C),l(C.context??""),o(C.namespace)};V.useEffect(()=>{IT().then(_).catch(C=>r(C instanceof Error?C.message:String(C)))},[]);const v=e!==null&&a===(e.context??"")&&u.trim()===e.namespace;async function w(C){if(C.preventDefault(),!c){f(!0),d(null);try{_(await zT({context:a,namespace:u.trim()}))}catch(y){d(y instanceof Error?y.message:String(y))}finally{f(!1)}}}return m.jsxs(m.Fragment,{children:[m.jsxs("p",{className:"settings-sub",children:[m.jsx("strong",{children:"Kubernetes"})," — run on your own cluster with ",m.jsx("code",{children:"--backend k8s"}),". The run's resources (image, GPUs, topology) come from a manifest committed on the experiment branch (default ",m.jsx("code",{children:".orx/k8s.yaml"}),"); only the cluster context and namespace live here. Auth comes from your kubeconfig."]}),n?m.jsx("div",{className:"settings-card",children:m.jsx("div",{className:"error",children:n})}):e?m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"settings-card",children:[m.jsxs("div",{className:"settings-card-head",children:[m.jsx("h3",{children:"Kubernetes cluster"}),m.jsx("div",{className:"spacer",style:{flex:1}}),m.jsx(DL,{s:e})]}),e.preflight.error&&m.jsx("p",{className:"settings-note",children:e.preflight.error}),m.jsxs("form",{className:"form settings-form",onSubmit:w,children:[m.jsxs("div",{className:"row2",children:[m.jsxs("label",{children:["Context",m.jsxs("select",{value:a,onChange:C=>l(C.target.value),children:[m.jsxs("option",{value:"",children:["kubectl default",e.currentContext?` (${e.currentContext})`:""]}),e.contexts.map(C=>m.jsx("option",{value:C,children:C},C))]})]}),m.jsxs("label",{children:["Namespace",m.jsx("input",{className:"mono",type:"text",value:u,onChange:C=>o(C.target.value),placeholder:"default",autoComplete:"off",spellCheck:!1})]})]}),p&&m.jsx("div",{className:"error",children:p}),m.jsx("div",{className:"actions",children:m.jsx("button",{type:"submit",className:"btn primary",disabled:c||v,children:c?"Saving…":"Save"})})]})]}),m.jsxs("div",{className:"settings-card",children:[m.jsx("div",{className:"settings-card-head",children:m.jsx("h3",{children:"Run manifest"})}),m.jsxs("p",{className:"settings-sub",children:["Each run applies the manifest committed on its experiment branch — default"," ",m.jsx("code",{children:".orx/k8s.yaml"}),", or ",m.jsx("code",{children:"--manifest "}),". It declares whatever the run needs (image, GPU requests, an Indexed Job across nodes, extra Services, …); orx injects the run script as ",m.jsx("code",{children:"$ORX_SCRIPT"}),", the"," ",m.jsx("code",{children:"orx-env"})," Secret, run labels, and a default timeout, and requires exactly one Job (or one labelled ",m.jsx("code",{children:'orx-primary: "true"'}),") whose completion is the run's. Logs follow that Job's leader pod. Use"," ",m.jsx("code",{children:"{{ORX_RUN}}"})," in resource names to keep re-runs collision-free."]})]})]}):m.jsxs("div",{className:"settings-loading",children:[m.jsx("span",{className:"spinner"})," Checking kubectl…"]})]})}const ML={env:"MODAL_TOKEN_ID env var",syncedEnv:"~/.openresearch/env",modalToml:"~/.modal.toml (modal token new)"};function LL({s:e}){return e.ready?m.jsx("span",{className:"badge ok",children:"connected"}):!e.tokenConfigured&&!e.modalImportable?m.jsx("span",{className:"badge",children:"not set up"}):e.modalImportable?e.tokenConfigured?m.jsx("span",{className:"badge",children:"unknown"}):m.jsx("span",{className:"badge err",children:"no token"}):m.jsx("span",{className:"badge err",children:e.envProvisioned?"env broken":"env not built"})}function OL(){const[e,t]=V.useState(null),[n,r]=V.useState(null),[a,l]=V.useState(!1),[u,o]=V.useState(null);V.useEffect(()=>{HT().then(t).catch(f=>r(f instanceof Error?f.message:String(f)))},[]);async function c(){if(!a){l(!0),o(null);try{t(await FT())}catch(f){o(f instanceof Error?f.message:String(f))}finally{l(!1)}}}return m.jsxs("div",{className:"settings-card",children:[m.jsxs("div",{className:"settings-card-head",children:[m.jsx("h3",{children:"Modal"}),m.jsx("div",{className:"spacer",style:{flex:1}}),e&&m.jsx(LL,{s:e})]}),m.jsxs("p",{className:"settings-sub",children:["Serverless GPUs on your own Modal account with"," ",m.jsx("code",{children:"--backend modal --flavor "})," (t4, a10g, a100-80gb, h100, …). orx manages a dedicated Python env with the Modal SDK; sandboxes scale to zero between runs."]}),n?m.jsx("div",{className:"error",children:n}):e?m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"kv",children:[m.jsx("span",{className:"k",children:"Environment"}),m.jsx("span",{className:"v",children:e.modalImportable?"ready":e.envProvisioned?"provisioned (modal import failing)":"not built yet"}),m.jsx("span",{className:"k",children:"Token"}),m.jsx("span",{className:"v",children:e.tokenSource?ML[e.tokenSource]:"not configured"})]}),!e.tokenConfigured&&m.jsxs("p",{className:"settings-note",children:["No Modal token found. Run ",m.jsx("code",{children:"modal token new"}),", or add"," ",m.jsx("code",{children:"MODAL_TOKEN_ID"})," and ",m.jsx("code",{children:"MODAL_TOKEN_SECRET"})," in the Environment tab."]}),e.error&&e.envProvisioned&&!e.modalImportable&&m.jsx("p",{className:"settings-note",children:e.error}),u&&m.jsx("div",{className:"error",children:u}),!e.modalImportable&&m.jsx("div",{className:"actions",children:m.jsx("button",{className:"btn primary",onClick:()=>void c(),disabled:a,children:a?"Setting up… (~30–60s)":"Set up environment"})})]}):m.jsxs("div",{className:"settings-loading",children:[m.jsx("span",{className:"spinner"})," Checking Modal…"]})]})}function jL({test:e}){if(e===void 0)return m.jsx("span",{className:"muted",children:"never tested"});if(e==="testing")return m.jsx("span",{className:"spinner"});const t=e.reachable?e.gitFound?m.jsx("span",{className:"badge ok",children:"ready"}):m.jsx("span",{className:"badge err",children:"no git"}):m.jsx("span",{className:"badge err",title:e.error??void 0,children:"unreachable"});return m.jsxs(m.Fragment,{children:[t,m.jsx("span",{className:"ssh-tested-at",children:ma(e.testedAt)})]})}function BL(){const[e,t]=V.useState(null),[n,r]=V.useState({});V.useEffect(()=>{VT().then(t).catch(()=>t([]))},[]);async function a(l){r(u=>({...u,[l]:"testing"}));try{const u=await YT(l);r(o=>({...o,[l]:u}))}catch(u){r(o=>({...o,[l]:{reachable:!1,gitFound:!1,error:u instanceof Error?u.message:String(u),testedAt:Date.now()}}))}}return m.jsxs("div",{className:"settings-card",children:[m.jsx("h3",{children:"SSH hosts"}),m.jsxs("p",{className:"settings-sub",children:["Run experiments directly on your own boxes with"," ",m.jsx("code",{children:"--backend ssh --host "}),". Hosts come from"," ",m.jsx("code",{children:"~/.ssh/config"}),"; auth uses your keys/agent (orx never reads a key). The host just needs ",m.jsx("code",{children:"git"})," and ",m.jsx("code",{children:"bash"}),"."]}),e===null?m.jsxs("div",{className:"settings-loading",children:[m.jsx("span",{className:"spinner"})," Reading ~/.ssh/config…"]}):e.length===0?m.jsx("p",{className:"settings-empty",children:"No hosts found in ~/.ssh/config."}):m.jsxs("table",{className:"flavor-table ssh-table",children:[m.jsx("thead",{children:m.jsxs("tr",{children:[m.jsx("th",{children:"Host"}),m.jsx("th",{children:"Address"}),m.jsx("th",{children:"Identity"}),m.jsx("th",{children:"Status"}),m.jsx("th",{})]})}),m.jsx("tbody",{children:e.map(l=>m.jsxs("tr",{children:[m.jsx("td",{className:"mono",children:l.host}),m.jsxs("td",{className:"mono muted",children:[[l.user,l.hostname??"—"].filter(Boolean).join("@"),l.port?`:${l.port}`:""]}),m.jsx("td",{className:"mono muted",children:l.identityFile??"—"}),m.jsx("td",{children:m.jsx(jL,{test:n[l.host]??l.lastTest})}),m.jsx("td",{children:m.jsx("button",{className:"btn sm",onClick:()=>void a(l.host),disabled:n[l.host]==="testing",children:"Test"})})]},l.host))})]})]})}function IL({test:e}){return e===null?null:e==="testing"?m.jsx("span",{className:"spinner"}):e.reachable?e.slurmFound?e.gitFound?m.jsx("span",{className:"badge ok",children:"ready"}):m.jsx("span",{className:"badge err",children:"no git"}):m.jsx("span",{className:"badge err",children:"no slurm CLI"}):m.jsx("span",{className:"badge err",title:e.error??void 0,children:"unreachable"})}function zL(){const[e,t]=V.useState(null),[n,r]=V.useState(null),[a,l]=V.useState(""),[u,o]=V.useState(""),[c,f]=V.useState(""),[p,d]=V.useState(""),[_,v]=V.useState(!1),[w,C]=V.useState(null),[y,S]=V.useState(null),x=y!==null&&y!=="testing"?y:null,b=R=>{t(R),l(R.host??""),o(R.partition??""),f(R.account??""),d(R.timeLimit??"")};V.useEffect(()=>{WT().then(b).catch(R=>r(R instanceof Error?R.message:String(R)))},[]);const k=e!==null&&a===(e.host??"")&&u.trim()===(e.partition??"")&&c.trim()===(e.account??"")&&p.trim()===(e.timeLimit??"");async function D(R){if(R.preventDefault(),!_){v(!0),C(null);try{b(await XT({host:a,partition:u.trim(),account:c.trim(),timeLimit:p.trim()}))}catch(N){C(N instanceof Error?N.message:String(N))}finally{v(!1)}}}async function T(R){S("testing");try{S(await KT(R))}catch(N){S({reachable:!1,slurmFound:!1,gitFound:!1,partitions:[],error:N instanceof Error?N.message:String(N)})}}return m.jsxs(m.Fragment,{children:[m.jsxs("p",{className:"settings-sub",children:[m.jsx("strong",{children:"Slurm"})," — run on your own cluster with"," ",m.jsx("code",{children:"--backend slurm [--flavor h100:2]"}),". orx submits via ",m.jsx("code",{children:"sbatch"})," on the login node over ssh (auth is your keys/agent; orx never reads a key) and the job runs in your cluster environment. The defaults below apply when a launch doesn't override them."]}),n?m.jsx("div",{className:"settings-card",children:m.jsx("div",{className:"error",children:n})}):e?m.jsxs("div",{className:"settings-card",children:[m.jsxs("div",{className:"settings-card-head",children:[m.jsx("h3",{children:"Slurm cluster"}),m.jsx("div",{className:"spacer",style:{flex:1}}),m.jsx(IL,{test:y})]}),(x==null?void 0:x.error)&&m.jsx("p",{className:"settings-note",children:x.error}),x&&x.partitions.length>0&&m.jsxs("p",{className:"settings-note",children:["Partitions: ",m.jsx("code",{children:x.partitions.join(", ")})]}),m.jsxs("form",{className:"form settings-form",onSubmit:D,children:[m.jsxs("div",{className:"row2",children:[m.jsxs("label",{children:["Login node",m.jsxs("select",{value:a,onChange:R=>{l(R.target.value),S(null)},children:[m.jsx("option",{value:"",children:"not set (pass --host per launch)"}),a&&!e.hosts.some(R=>R.host===a)&&m.jsxs("option",{value:a,children:[a," (not in ~/.ssh/config)"]}),e.hosts.map(R=>m.jsx("option",{value:R.host,children:R.host},R.host))]})]}),m.jsxs("label",{children:["Partition",m.jsx("input",{className:"mono",type:"text",list:"slurm-partitions",value:u,onChange:R=>o(R.target.value),placeholder:"cluster default",autoComplete:"off",spellCheck:!1}),m.jsx("datalist",{id:"slurm-partitions",children:x==null?void 0:x.partitions.map(R=>m.jsx("option",{value:R},R))})]})]}),m.jsxs("div",{className:"row2",children:[m.jsxs("label",{children:["Account",m.jsx("input",{className:"mono",type:"text",value:c,onChange:R=>f(R.target.value),placeholder:"cluster default",autoComplete:"off",spellCheck:!1})]}),m.jsxs("label",{children:["Time limit",m.jsx("input",{className:"mono",type:"text",value:p,onChange:R=>d(R.target.value),placeholder:"cluster default (e.g. 4h, 30m)",autoComplete:"off",spellCheck:!1})]})]}),w&&m.jsx("div",{className:"error",children:w}),m.jsxs("div",{className:"actions",children:[m.jsx("button",{type:"submit",className:"btn primary",disabled:_||k,children:_?"Saving…":"Save"}),m.jsx("button",{type:"button",className:"btn",onClick:()=>void T(a),disabled:!a||y==="testing",title:a?void 0:"Pick a login node first",children:"Test connection"})]})]})]}):m.jsxs("div",{className:"settings-loading",children:[m.jsx("span",{className:"spinner"})," Loading slurm settings…"]})]})}const HL=[{id:"hf",label:"HF Jobs"},{id:"modal",label:"Modal"},{id:"k8s",label:"Kubernetes"},{id:"ssh",label:"SSH"},{id:"slurm",label:"Slurm"}];function FL(){const[e,t]=V.useState("hf");return m.jsxs(m.Fragment,{children:[m.jsx("h1",{children:"Compute"}),m.jsxs("p",{className:"settings-sub",children:["Run experiments on external compute with"," ",m.jsx("code",{children:"--backend --flavor "}),"."]}),m.jsx("div",{className:"harness-tabs",children:HL.map(n=>m.jsx("button",{className:n.id===e?"active":"",onClick:()=>t(n.id),children:n.label},n.id))}),e==="hf"&&m.jsx(GL,{}),e==="modal"&&m.jsx(OL,{}),e==="k8s"&&m.jsx(RL,{}),e==="ssh"&&m.jsx(BL,{}),e==="slurm"&&m.jsx(zL,{})]})}const PL={env:"HF_TOKEN env var",openresearchEnv:"~/.openresearch/env",hfCache:"~/.cache/huggingface/token (hf auth login)"};function UL({settings:e}){return e.configured?e.valid?m.jsx("span",{className:"badge ok",children:"connected"}):m.jsx("span",{className:"badge err",children:"invalid token"}):m.jsx("span",{className:"badge",children:"not configured"})}function $L({settings:e}){return!e.configured||!e.valid?null:e.jobsWrite===!0?m.jsx("span",{className:"badge ok",children:"jobs: write OK"}):e.jobsWrite===!1?m.jsx("span",{className:"badge err",children:"no job.write permission"}):m.jsx("span",{className:"badge",children:"jobs permission unknown"})}function GL(){const[e,t]=V.useState(null),[n,r]=V.useState(null),[a,l]=V.useState(""),[u,o]=V.useState(!1),[c,f]=V.useState(null),p=V.useRef(!1);V.useEffect(()=>{jT().then(_=>{p.current||t(_)}).catch(_=>{p.current||r(_ instanceof Error?_.message:String(_))})},[]);async function d(_){if(_.preventDefault(),!(!a.trim()||u)){o(!0),f(null);try{const v=await BT(a.trim());p.current=!0,t(v),r(null),l("")}catch(v){f(v instanceof Error?v.message:String(v))}finally{o(!1)}}}return m.jsxs("div",{className:"settings-card",children:[m.jsxs("div",{className:"settings-card-head",children:[m.jsx("h3",{children:"Hugging Face Jobs"}),m.jsx("div",{className:"spacer",style:{flex:1}}),e&&m.jsx(UL,{settings:e})]}),m.jsxs("p",{className:"settings-sub",children:["Run experiments on your Hugging Face account with"," ",m.jsx("code",{children:"--backend hf --flavor "})," (t4-small, a10g-small, a100-large, …). Billed to HF per minute."]}),n?m.jsx("div",{className:"error",children:n}):e?m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"kv",children:[m.jsx("span",{className:"k",children:"Account"}),m.jsx("span",{className:"v",children:e.username??"—"}),m.jsx("span",{className:"k",children:"Token"}),m.jsx("span",{className:"v",children:e.maskedToken??"—"}),m.jsx("span",{className:"k",children:"Source"}),m.jsx("span",{className:"v",children:e.source?PL[e.source]:"not configured"}),m.jsx("span",{className:"k",children:"Jobs"}),m.jsxs("span",{className:"v",children:[m.jsx($L,{settings:e}),(!e.configured||!e.valid)&&"—"]})]}),e.source==="env"&&m.jsx("p",{className:"settings-note",children:"HF_TOKEN is set in the environment and overrides any token saved here."}),e.valid&&e.jobsWrite===null&&m.jsxs("p",{className:"settings-note",children:["This token is valid but doesn't report whether it can launch Jobs — OAuth tokens from ",m.jsx("code",{children:"hf auth login"})," never do. Launches may still work; for a definitive check, save a write-scoped token from"," ",m.jsx("a",{href:"https://huggingface.co/settings/tokens",target:"_blank",rel:"noreferrer",children:"huggingface.co/settings/tokens"}),"."]})]}):m.jsxs("div",{className:"settings-loading",children:[m.jsx("span",{className:"spinner"})," Loading status…"]}),m.jsxs("form",{className:"form settings-form",onSubmit:d,children:[m.jsxs("label",{children:[e!=null&&e.configured?"Replace token":"New token",m.jsx("input",{type:"password",value:a,onChange:_=>l(_.target.value),placeholder:"hf_…",autoComplete:"off"})]}),c&&m.jsx("div",{className:"error",children:c}),m.jsx("div",{className:"actions",children:m.jsx("button",{type:"submit",className:"btn primary",disabled:!a.trim()||u,children:u?"Validating…":"Save"})})]})]})}const _w=/^hf_[A-Za-z0-9]{10,}$/;function vw(){return m.jsx("tr",{children:m.jsx("td",{colSpan:3,children:m.jsxs("p",{className:"settings-note",children:["This value looks like a Hugging Face token — compute runs only read it from"," ",m.jsx("code",{children:"HF_TOKEN"}),". Save it under that key if it's meant for HF Jobs."]})})})}const I1=["HF_TOKEN","WANDB_API_KEY"];function qL({name:e,entry:t,onVars:n,onError:r}){const[a,l]=V.useState(""),[u,o]=V.useState(!1),c=d=>r(`${e}: ${d instanceof Error?d.message:String(d)}`);async function f(){if(!(!a.trim()||u)){o(!0);try{n(await VS(e,a.trim())),l("")}catch(d){c(d)}finally{o(!1)}}}async function p(){if(!u){o(!0);try{n(await UT(e))}catch(d){c(d)}finally{o(!1)}}}return m.jsxs(m.Fragment,{children:[m.jsxs("tr",{children:[m.jsx("td",{className:"mono",children:e}),m.jsx("td",{className:"mono muted",children:t?m.jsxs(m.Fragment,{children:[t.maskedValue,t.inProcessEnv&&m.jsx("span",{className:"badge",children:"overridden by env"})]}):m.jsx("input",{className:"mono",type:"password",value:a,onChange:d=>l(d.target.value),onKeyDown:d=>{d.key==="Enter"&&(d.preventDefault(),f()),d.key==="Escape"&&!u&&l("")},placeholder:"value","aria-label":`Value for ${e}`,autoComplete:"new-password",disabled:u})}),m.jsx("td",{children:t?m.jsx("button",{className:"icon-btn",title:`Delete ${e}`,"aria-label":`Delete ${e}`,onClick:()=>void p(),disabled:u,children:m.jsx($u,{size:13})}):a.trim()&&m.jsx("button",{className:"btn sm",onClick:()=>void f(),disabled:u,children:u?"Saving…":"Save"})})]}),!t&&e!=="HF_TOKEN"&&_w.test(a.trim())&&m.jsx(vw,{})]})}function VL({onVars:e,onError:t,onDone:n}){const[r,a]=V.useState(""),[l,u]=V.useState(""),[o,c]=V.useState(!1);async function f(){if(!(!r.trim()||!l.trim()||o)){c(!0);try{e(await VS(r.trim(),l.trim())),n()}catch(d){t(`${r.trim()}: ${d instanceof Error?d.message:String(d)}`)}finally{c(!1)}}}const p=d=>{d.key==="Enter"&&(d.preventDefault(),f()),d.key==="Escape"&&!o&&n()};return m.jsxs(m.Fragment,{children:[m.jsxs("tr",{children:[m.jsx("td",{children:m.jsx("input",{autoFocus:!0,className:"mono",type:"text",value:r,onChange:d=>a(d.target.value),onKeyDown:p,placeholder:"MY_API_KEY","aria-label":"New variable key",autoComplete:"off",spellCheck:!1,disabled:o})}),m.jsx("td",{children:m.jsx("input",{className:"mono",type:"password",value:l,onChange:d=>u(d.target.value),onKeyDown:p,placeholder:"value","aria-label":"New variable value",autoComplete:"new-password",disabled:o})}),m.jsxs("td",{children:[m.jsx("button",{className:"btn sm",onClick:()=>void f(),disabled:o||!r.trim()||!l.trim(),children:o?"Saving…":"Save"}),m.jsx("button",{className:"icon-btn",title:"Cancel","aria-label":"Cancel new variable",onClick:n,disabled:o,children:m.jsx(jo,{size:13})})]})]}),r.trim()!=="HF_TOKEN"&&_w.test(l.trim())&&m.jsx(vw,{})]})}function YL(){const[e,t]=V.useState(null),[n,r]=V.useState(null),[a,l]=V.useState(!1),[u,o]=V.useState(null);V.useEffect(()=>{PT().then(t).catch(d=>r(d instanceof Error?d.message:String(d)))},[]);const c=d=>{t(d),o(null)},f=e===null?[]:e.map(d=>d.key).filter(d=>!I1.includes(d)),p=[...I1,...f];return m.jsxs("div",{className:"settings-card",children:[m.jsxs("div",{className:"settings-card-head",children:[m.jsx("h3",{children:"Environment variables"}),m.jsx("div",{className:"spacer",style:{flex:1}}),m.jsxs("button",{className:"btn sm",onClick:()=>l(!0),disabled:a||e===null,children:[m.jsx(Sg,{size:12})," Add variable"]})]}),m.jsxs("p",{className:"settings-sub",children:["Stored in ",m.jsx("code",{children:"~/.openresearch/env"})," and passed to runs and the research agent."," ",m.jsx("code",{children:"HF_TOKEN"})," and ",m.jsx("code",{children:"WANDB_API_KEY"})," are always listed since runs typically need them. Variables set in orx's own environment win on conflicts."]}),n?m.jsx("div",{className:"error",children:n}):e===null?m.jsxs("div",{className:"settings-loading",children:[m.jsx("span",{className:"spinner"})," Loading…"]}):m.jsx("table",{className:"env-table",children:m.jsxs("tbody",{children:[p.map(d=>m.jsx(qL,{name:d,entry:e.find(_=>_.key===d),onVars:c,onError:o},d)),a&&m.jsx(VL,{onVars:c,onError:o,onDone:()=>l(!1)})]})}),u&&m.jsx("div",{className:"error",children:u})]})}function WL(){const[e,t]=V.useState(null),[n,r]=V.useState(""),[a,l]=V.useState(""),[u,o]=V.useState(!1),[c,f]=V.useState(null);V.useEffect(()=>{WS().then(_=>{t(_),r(_.userName??""),l(_.userEmail??"")}).catch(()=>{})},[]);const p=e!==null&&n.trim()===(e.userName??"")&&a.trim()===(e.userEmail??"");async function d(_){if(_.preventDefault(),!(u||p)){o(!0),f(null);try{const v=await JT({userName:n.trim(),userEmail:a.trim()});t(v),r(v.userName??""),l(v.userEmail??"")}catch(v){f(v instanceof Error?v.message:String(v))}finally{o(!1)}}}return m.jsxs(m.Fragment,{children:[m.jsx("h1",{children:"Git"}),m.jsx("p",{className:"settings-sub",children:"Experiment branches are committed and pushed from local clones with this identity."}),e?m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"settings-card",children:[m.jsx("h3",{children:"Identity"}),m.jsxs("form",{className:"form",onSubmit:d,children:[m.jsxs("div",{className:"row2",children:[m.jsxs("label",{children:["user.name",m.jsx("input",{type:"text",value:n,onChange:_=>r(_.target.value),autoComplete:"off"})]}),m.jsxs("label",{children:["user.email",m.jsx("input",{type:"text",value:a,onChange:_=>l(_.target.value),autoComplete:"off"})]})]}),c&&m.jsx("div",{className:"error",children:c}),m.jsx("div",{className:"actions",children:m.jsx("button",{type:"submit",className:"btn primary",disabled:u||p||!n.trim()&&!a.trim(),children:u?"Saving…":"Save"})})]})]}),m.jsxs("div",{className:"settings-card",children:[m.jsx("h3",{children:"GitHub access"}),m.jsxs("div",{className:"kv",children:[m.jsx("span",{className:"k",children:"git"}),m.jsx("span",{className:"v",children:e.gitVersion??"not found"}),m.jsx("span",{className:"k",children:"Token"}),m.jsx("span",{className:"v",children:e.githubTokenSource==="env"?"GITHUB_TOKEN env var":e.githubTokenSource==="stored"?"token saved in orx":e.githubTokenSource==="gh"?"gh CLI (gh auth token)":"none found"})]}),!e.githubTokenSource&&m.jsxs(m.Fragment,{children:[m.jsxs("p",{className:"settings-note",children:["No GitHub token found — private repo clones and branch pushes will fail. Run"," ",m.jsx("code",{children:"gh auth login"}),", or paste a personal access token:"]}),m.jsx(mw,{onSaved:t})]}),e.githubTokenSource==="stored"&&m.jsx("div",{className:"actions",children:m.jsx("button",{className:"btn",onClick:()=>{tN().then(t).catch(()=>{})},children:"Remove saved token"})})]})]}):m.jsxs("div",{className:"settings-loading",children:[m.jsx("span",{className:"spinner"})," Loading…"]})]})}function XL({value:e,max:t,label:n}){const r=t>0?Math.min(100,Math.round(e/t*100)):0;return m.jsxs("div",{className:"progress",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,children:[m.jsx("div",{className:"progress-track",children:m.jsx("div",{className:"progress-fill",style:{width:`${r}%`}})}),m.jsxs("div",{className:"progress-caption",children:[m.jsx("span",{children:n??`${r}%`}),t>0&&m.jsxs("span",{className:"mono",children:[Bo(e)," / ",Bo(t)]})]})]})}const KL={env:"ORX_DATA_DIR environment variable",config:"your saved setting",xdg:"XDG_DATA_HOME",default:"default location"};function ZL(){const[e,t]=V.useState(null),[n,r]=V.useState(null),[a,l]=V.useState(""),[u,o]=V.useState(!1),[c,f]=V.useState(null),[p,d]=V.useState({kind:"idle"}),[_,v]=V.useState(null),w=()=>YS().then(k=>{t(k),l(D=>D||k.current)}).catch(k=>r(k instanceof Error?k.message:String(k)));V.useEffect(()=>{w()},[]),V.useEffect(()=>yN(k=>{k.type==="progress"?d(D=>{const T=D.kind==="moving"?D.total:0;return{kind:"moving",phase:k.phase,copied:k.copiedBytes,total:k.totalBytes||T}}):k.type==="done"?(d({kind:"done",oldPathLeft:k.oldPathLeft}),f(null),l(""),w()):k.type==="error"&&d({kind:"error",message:k.error})}),[]);const C=(e==null?void 0:e.source)==="env",y=a.trim(),S=e!==null&&y===e.current;async function x(){if(!(u||!y)){o(!0),v(null),f(null);try{f(await $T(y))}catch(k){v(k instanceof Error?k.message:String(k))}finally{o(!1)}}}async function b(k){if(k.preventDefault(),!(p.kind==="moving"||!y||S)&&(v(null),!!window.confirm(`Move all orx data to: -${y} +|(?![\\s\\S])))+`,"m"),alias:l,inside:{line:{pattern:/(.)(?=[\s\S]).*(?:\r\n?|\n)?/,lookbehind:!0},prefix:{pattern:/[\s\S]/,alias:/\w+/.exec(r)[0]}}}}),Object.defineProperty(t.languages.diff,"PREFIXES",{value:n})})(e)}qg.displayName="go";qg.aliases=[];function qg(e){e.register(fi),e.languages.go=e.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"|`[^`]*`/,lookbehind:!0,greedy:!0},keyword:/\b(?:break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go(?:to)?|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b/,boolean:/\b(?:_|false|iota|nil|true)\b/,number:[/\b0(?:b[01_]+|o[0-7_]+)i?\b/i,/\b0x(?:[a-f\d_]+(?:\.[a-f\d_]*)?|\.[a-f\d_]+)(?:p[+-]?\d+(?:_\d+)*)?i?(?!\w)/i,/(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?[\d_]+)?i?(?!\w)/i],operator:/[*\/%^!=]=?|\+[=+]?|-[=-]?|\|[=|]?|&(?:=|&|\^=?)?|>(?:>=?|=)?|<(?:<=?|=|-)?|:=|\.\.\./,builtin:/\b(?:append|bool|byte|cap|close|complex|complex(?:64|128)|copy|delete|error|float(?:32|64)|u?int(?:8|16|32|64)?|imag|len|make|new|panic|print(?:ln)?|real|recover|rune|string|uintptr)\b/}),e.languages.insertBefore("go","string",{char:{pattern:/'(?:\\.|[^'\\\r\n]){0,10}'/,greedy:!0}}),delete e.languages.go["class-name"]}Vg.displayName="ini";Vg.aliases=[];function Vg(e){e.languages.ini={comment:{pattern:/(^[ \f\t\v]*)[#;][^\n\r]*/m,lookbehind:!0},section:{pattern:/(^[ \f\t\v]*)\[[^\n\r\]]*\]?/m,lookbehind:!0,inside:{"section-name":{pattern:/(^\[[ \f\t\v]*)[^ \f\t\v\]]+(?:[ \f\t\v]+[^ \f\t\v\]]+)*/,lookbehind:!0,alias:"selector"},punctuation:/\[|\]/}},key:{pattern:/(^[ \f\t\v]*)[^ \f\n\r\t\v=]+(?:[ \f\t\v]+[^ \f\n\r\t\v=]+)*(?=[ \f\t\v]*=)/m,lookbehind:!0,alias:"attr-name"},value:{pattern:/(=[ \f\t\v]*)[^ \f\n\r\t\v]+(?:[ \f\t\v]+[^ \f\n\r\t\v]+)*/,lookbehind:!0,alias:"attr-value",inside:{"inner-value":{pattern:/^("|').+(?=\1$)/,lookbehind:!0}}},punctuation:/=/}}Yg.displayName="java";Yg.aliases=[];function Yg(e){e.register(fi),(function(t){var n=/\b(?:abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|exports|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|module|native|new|non-sealed|null|open|opens|package|permits|private|protected|provides|public|record(?!\s*[(){}[\]<>=%~.:,;?+\-*/&|^])|requires|return|sealed|short|static|strictfp|super|switch|synchronized|this|throw|throws|to|transient|transitive|try|uses|var|void|volatile|while|with|yield)\b/,r=/(?:[a-z]\w*\s*\.\s*)*(?:[A-Z]\w*\s*\.\s*)*/.source,a={pattern:RegExp(/(^|[^\w.])/.source+r+/[A-Z](?:[\d_A-Z]*[a-z]\w*)?\b/.source),lookbehind:!0,inside:{namespace:{pattern:/^[a-z]\w*(?:\s*\.\s*[a-z]\w*)*(?:\s*\.)?/,inside:{punctuation:/\./}},punctuation:/\./}};t.languages.java=t.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"/,lookbehind:!0,greedy:!0},"class-name":[a,{pattern:RegExp(/(^|[^\w.])/.source+r+/[A-Z]\w*(?=\s+\w+\s*[;,=()]|\s*(?:\[[\s,]*\]\s*)?::\s*new\b)/.source),lookbehind:!0,inside:a.inside},{pattern:RegExp(/(\b(?:class|enum|extends|implements|instanceof|interface|new|record|throws)\s+)/.source+r+/[A-Z]\w*\b/.source),lookbehind:!0,inside:a.inside}],keyword:n,function:[t.languages.clike.function,{pattern:/(::\s*)[a-z_]\w*/,lookbehind:!0}],number:/\b0b[01][01_]*L?\b|\b0x(?:\.[\da-f_p+-]+|[\da-f_]+(?:\.[\da-f_p+-]+)?)\b|(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?\d[\d_]*)?[dfl]?/i,operator:{pattern:/(^|[^.])(?:<<=?|>>>?=?|->|--|\+\+|&&|\|\||::|[?:~]|[-+*/%&|^!=<>]=?)/m,lookbehind:!0},constant:/\b[A-Z][A-Z_\d]+\b/}),t.languages.insertBefore("java","string",{"triple-quoted-string":{pattern:/"""[ \t]*[\r\n](?:(?:"|"")?(?:\\.|[^"\\]))*"""/,greedy:!0,alias:"string"},char:{pattern:/'(?:\\.|[^'\\\r\n]){1,6}'/,greedy:!0}}),t.languages.insertBefore("java","class-name",{annotation:{pattern:/(^|[^.])@\w+(?:\s*\.\s*\w+)*/,lookbehind:!0,alias:"punctuation"},generics:{pattern:/<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&))*>)*>)*>)*>/,inside:{"class-name":a,keyword:n,punctuation:/[<>(),.:]/,operator:/[?&|]/}},import:[{pattern:RegExp(/(\bimport\s+)/.source+r+/(?:[A-Z]\w*|\*)(?=\s*;)/.source),lookbehind:!0,inside:{namespace:a.inside.namespace,punctuation:/\./,operator:/\*/,"class-name":/\w+/}},{pattern:RegExp(/(\bimport\s+static\s+)/.source+r+/(?:\w+|\*)(?=\s*;)/.source),lookbehind:!0,alias:"static",inside:{namespace:a.inside.namespace,static:/\b\w+$/,punctuation:/\./,operator:/\*/,"class-name":/\w+/}}],namespace:{pattern:RegExp(/(\b(?:exports|import(?:\s+static)?|module|open|opens|package|provides|requires|to|transitive|uses|with)\s+)(?!)[a-z]\w*(?:\.[a-z]\w*)*\.?/.source.replace(//g,function(){return n.source})),lookbehind:!0,inside:{punctuation:/\./}}})})(e)}Wg.displayName="regex";Wg.aliases=[];function Wg(e){(function(t){var n={pattern:/\\[\\(){}[\]^$+*?|.]/,alias:"escape"},r=/\\(?:x[\da-fA-F]{2}|u[\da-fA-F]{4}|u\{[\da-fA-F]+\}|0[0-7]{0,2}|[123][0-7]{2}|c[a-zA-Z]|.)/,a={pattern:/\.|\\[wsd]|\\p\{[^{}]+\}/i,alias:"class-name"},l={pattern:/\\[wsd]|\\p\{[^{}]+\}/i,alias:"class-name"},u="(?:[^\\\\-]|"+r.source+")",o=RegExp(u+"-"+u),c={pattern:/(<|')[^<>']+(?=[>']$)/,lookbehind:!0,alias:"variable"};t.languages.regex={"char-class":{pattern:/((?:^|[^\\])(?:\\\\)*)\[(?:[^\\\]]|\\[\s\S])*\]/,lookbehind:!0,inside:{"char-class-negation":{pattern:/(^\[)\^/,lookbehind:!0,alias:"operator"},"char-class-punctuation":{pattern:/^\[|\]$/,alias:"punctuation"},range:{pattern:o,inside:{escape:r,"range-punctuation":{pattern:/-/,alias:"operator"}}},"special-escape":n,"char-set":l,escape:r}},"special-escape":n,"char-set":a,backreference:[{pattern:/\\(?![123][0-7]{2})[1-9]/,alias:"keyword"},{pattern:/\\k<[^<>']+>/,alias:"keyword",inside:{"group-name":c}}],anchor:{pattern:/[$^]|\\[ABbGZz]/,alias:"function"},escape:r,group:[{pattern:/\((?:\?(?:<[^<>']+>|'[^<>']+'|[>:]||&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),e.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,e.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:e.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:e.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:e.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:e.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:e.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),e.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:e.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),e.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),e.languages.markup&&(e.languages.markup.tag.addInlined("script","javascript"),e.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),e.languages.js=e.languages.javascript}Xg.displayName="json";Xg.aliases=["webmanifest"];function Xg(e){e.languages.json={property:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,lookbehind:!0,greedy:!0},string:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,lookbehind:!0,greedy:!0},comment:{pattern:/\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},number:/-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,punctuation:/[{}[\],]/,operator:/:/,boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"}},e.languages.webmanifest=e.languages.json}Kg.displayName="kotlin";Kg.aliases=["kt","kts"];function Kg(e){e.register(fi),(function(t){t.languages.kotlin=t.languages.extend("clike",{keyword:{pattern:/(^|[^.])\b(?:abstract|actual|annotation|as|break|by|catch|class|companion|const|constructor|continue|crossinline|data|do|dynamic|else|enum|expect|external|final|finally|for|fun|get|if|import|in|infix|init|inline|inner|interface|internal|is|lateinit|noinline|null|object|open|operator|out|override|package|private|protected|public|reified|return|sealed|set|super|suspend|tailrec|this|throw|to|try|typealias|val|var|vararg|when|where|while)\b/,lookbehind:!0},function:[{pattern:/(?:`[^\r\n`]+`|\b\w+)(?=\s*\()/,greedy:!0},{pattern:/(\.)(?:`[^\r\n`]+`|\w+)(?=\s*\{)/,lookbehind:!0,greedy:!0}],number:/\b(?:0[xX][\da-fA-F]+(?:_[\da-fA-F]+)*|0[bB][01]+(?:_[01]+)*|\d+(?:_\d+)*(?:\.\d+(?:_\d+)*)?(?:[eE][+-]?\d+(?:_\d+)*)?[fFL]?)\b/,operator:/\+[+=]?|-[-=>]?|==?=?|!(?:!|==?)?|[\/*%<>]=?|[?:]:?|\.\.|&&|\|\||\b(?:and|inv|or|shl|shr|ushr|xor)\b/}),delete t.languages.kotlin["class-name"];var n={"interpolation-punctuation":{pattern:/^\$\{?|\}$/,alias:"punctuation"},expression:{pattern:/[\s\S]+/,inside:t.languages.kotlin}};t.languages.insertBefore("kotlin","string",{"string-literal":[{pattern:/"""(?:[^$]|\$(?:(?!\{)|\{[^{}]*\}))*?"""/,alias:"multiline",inside:{interpolation:{pattern:/\$(?:[a-z_]\w*|\{[^{}]*\})/i,inside:n},string:/[\s\S]+/}},{pattern:/"(?:[^"\\\r\n$]|\\.|\$(?:(?!\{)|\{[^{}]*\}))*"/,alias:"singleline",inside:{interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$(?:[a-z_]\w*|\{[^{}]*\})/i,lookbehind:!0,inside:n},string:/[\s\S]+/}}],char:{pattern:/'(?:[^'\\\r\n]|\\(?:.|u[a-fA-F0-9]{0,4}))'/,greedy:!0}}),delete t.languages.kotlin.string,t.languages.insertBefore("kotlin","keyword",{annotation:{pattern:/\B@(?:\w+:)?(?:[A-Z]\w*|\[[^\]]+\])/,alias:"builtin"}}),t.languages.insertBefore("kotlin","function",{label:{pattern:/\b\w+@|@\w+\b/,alias:"symbol"}}),t.languages.kt=t.languages.kotlin,t.languages.kts=t.languages.kotlin})(e)}Zg.displayName="less";Zg.aliases=[];function Zg(e){e.register(va),e.languages.less=e.languages.extend("css",{comment:[/\/\*[\s\S]*?\*\//,{pattern:/(^|[^\\])\/\/.*/,lookbehind:!0}],atrule:{pattern:/@[\w-](?:\((?:[^(){}]|\([^(){}]*\))*\)|[^(){};\s]|\s+(?!\s))*?(?=\s*\{)/,inside:{punctuation:/[:()]/}},selector:{pattern:/(?:@\{[\w-]+\}|[^{};\s@])(?:@\{[\w-]+\}|\((?:[^(){}]|\([^(){}]*\))*\)|[^(){};@\s]|\s+(?!\s))*?(?=\s*\{)/,inside:{variable:/@+[\w-]+/}},property:/(?:@\{[\w-]+\}|[\w-])+(?:\+_?)?(?=\s*:)/,operator:/[+\-*\/]/}),e.languages.insertBefore("less","property",{variable:[{pattern:/@[\w-]+\s*:/,inside:{punctuation:/:/}},/@@?[\w-]+/],"mixin-usage":{pattern:/([{;]\s*)[.#](?!\d)[\w-].*?(?=[(;])/,lookbehind:!0,alias:"function"}})}Qg.displayName="lua";Qg.aliases=[];function Qg(e){e.languages.lua={comment:/^#!.+|--(?:\[(=*)\[[\s\S]*?\]\1\]|.*)/m,string:{pattern:/(["'])(?:(?!\1)[^\\\r\n]|\\z(?:\r\n|\s)|\\(?:\r\n|[^z]))*\1|\[(=*)\[[\s\S]*?\]\2\]/,greedy:!0},number:/\b0x[a-f\d]+(?:\.[a-f\d]*)?(?:p[+-]?\d+)?\b|\b\d+(?:\.\B|(?:\.\d*)?(?:e[+-]?\d+)?\b)|\B\.\d+(?:e[+-]?\d+)?\b/i,keyword:/\b(?:and|break|do|else|elseif|end|false|for|function|goto|if|in|local|nil|not|or|repeat|return|then|true|until|while)\b/,function:/(?!\d)\w+(?=\s*(?:[({]))/,operator:[/[-+*%^&|#]|\/\/?|<[<=]?|>[>=]?|[=~]=?/,{pattern:/(^|[^.])\.\.(?!\.)/,lookbehind:!0}],punctuation:/[\[\](){},;]|\.+|:+/}}Jg.displayName="makefile";Jg.aliases=[];function Jg(e){e.languages.makefile={comment:{pattern:/(^|[^\\])#(?:\\(?:\r\n|[\s\S])|[^\\\r\n])*/,lookbehind:!0},string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"builtin-target":{pattern:/\.[A-Z][^:#=\s]+(?=\s*:(?!=))/,alias:"builtin"},target:{pattern:/^(?:[^:=\s]|[ \t]+(?![\s:]))+(?=\s*:(?!=))/m,alias:"symbol",inside:{variable:/\$+(?:(?!\$)[^(){}:#=\s]+|(?=[({]))/}},variable:/\$+(?:(?!\$)[^(){}:#=\s]+|\([@*%<^+?][DF]\)|(?=[({]))/,keyword:/-include\b|\b(?:define|else|endef|endif|export|ifn?def|ifn?eq|include|override|private|sinclude|undefine|unexport|vpath)\b/,function:{pattern:/(\()(?:abspath|addsuffix|and|basename|call|dir|error|eval|file|filter(?:-out)?|findstring|firstword|flavor|foreach|guile|if|info|join|lastword|load|notdir|or|origin|patsubst|realpath|shell|sort|strip|subst|suffix|value|warning|wildcard|word(?:list|s)?)(?=[ \t])/,lookbehind:!0},operator:/(?:::|[?:+!])?=|[|@]/,punctuation:/[:;(){}]/}}em.displayName="yaml";em.aliases=["yml"];function em(e){(function(t){var n=/[*&][^\s[\]{},]+/,r=/!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/,a="(?:"+r.source+"(?:[ ]+"+n.source+")?|"+n.source+"(?:[ ]+"+r.source+")?)",l=/(?:[^\s\x00-\x08\x0e-\x1f!"#%&'*,\-:>?@[\]`{|}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]|[?:-])(?:[ \t]*(?:(?![#:])|:))*/.source.replace(//g,function(){return/[^\s\x00-\x08\x0e-\x1f,[\]{}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]/.source}),u=/"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'/.source;function o(c,f){f=(f||"").replace(/m/g,"")+"m";var p=/([:\-,[{]\s*(?:\s<>[ \t]+)?)(?:<>)(?=[ \t]*(?:$|,|\]|\}|(?:[\r\n]\s*)?#))/.source.replace(/<>/g,function(){return a}).replace(/<>/g,function(){return c});return RegExp(p,f)}t.languages.yaml={scalar:{pattern:RegExp(/([\-:]\s*(?:\s<>[ \t]+)?[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)\S[^\r\n]*(?:\2[^\r\n]+)*)/.source.replace(/<>/g,function(){return a})),lookbehind:!0,alias:"string"},comment:/#.*/,key:{pattern:RegExp(/((?:^|[:\-,[{\r\n?])[ \t]*(?:<>[ \t]+)?)<>(?=\s*:\s)/.source.replace(/<>/g,function(){return a}).replace(/<>/g,function(){return"(?:"+l+"|"+u+")"})),lookbehind:!0,greedy:!0,alias:"atrule"},directive:{pattern:/(^[ \t]*)%.+/m,lookbehind:!0,alias:"important"},datetime:{pattern:o(/\d{4}-\d\d?-\d\d?(?:[tT]|[ \t]+)\d\d?:\d{2}:\d{2}(?:\.\d*)?(?:[ \t]*(?:Z|[-+]\d\d?(?::\d{2})?))?|\d{4}-\d{2}-\d{2}|\d\d?:\d{2}(?::\d{2}(?:\.\d*)?)?/.source),lookbehind:!0,alias:"number"},boolean:{pattern:o(/false|true/.source,"i"),lookbehind:!0,alias:"important"},null:{pattern:o(/null|~/.source,"i"),lookbehind:!0,alias:"important"},string:{pattern:o(u),lookbehind:!0,greedy:!0},number:{pattern:o(/[+-]?(?:0x[\da-f]+|0o[0-7]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?|\.inf|\.nan)/.source,"i"),lookbehind:!0},tag:r,important:n,punctuation:/---|[:[\]{}\-,|>?]|\.\.\./},t.languages.yml=t.languages.yaml})(e)}tm.displayName="markdown";tm.aliases=["md"];function tm(e){e.register(al),(function(t){var n=/(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;function r(o){return o=o.replace(//g,function(){return n}),RegExp(/((?:^|[^\\])(?:\\{2})*)/.source+"(?:"+o+")")}var a=/(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source,l=/\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g,function(){return a}),u=/\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source;t.languages.markdown=t.languages.extend("markup",{}),t.languages.insertBefore("markdown","prolog",{"front-matter-block":{pattern:/(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,lookbehind:!0,greedy:!0,inside:{punctuation:/^---|---$/,"front-matter":{pattern:/\S+(?:\s+\S+)*/,alias:["yaml","language-yaml"],inside:t.languages.yaml}}},blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:"punctuation"},table:{pattern:RegExp("^"+l+u+"(?:"+l+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+l+u+")(?:"+l+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(a),inside:t.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+l+")"+u+"$"),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp("^"+l+"$"),inside:{"table-header":{pattern:RegExp(a),alias:"important",inside:t.languages.markdown},punctuation:/\|/}}}},code:[{pattern:/((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,lookbehind:!0,alias:"keyword"},{pattern:/^```[\s\S]*?^```$/m,greedy:!0,inside:{"code-block":{pattern:/^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,lookbehind:!0},"code-language":{pattern:/^(```).+/,lookbehind:!0},punctuation:/```/}}],title:[{pattern:/\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,alias:"important",inside:{punctuation:/==+$|--+$/}},{pattern:/(^\s*)#.+/m,lookbehind:!0,alias:"important",inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,lookbehind:!0,alias:"punctuation"},list:{pattern:/(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,lookbehind:!0,alias:"punctuation"},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,punctuation:/^[\[\]!:]|[<>]/},alias:"url"},bold:{pattern:r(/\b__(?:(?!_)|_(?:(?!_))+_)+__\b|\*\*(?:(?!\*)|\*(?:(?!\*))+\*)+\*\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:r(/\b_(?:(?!_)|__(?:(?!_))+__)+_\b|\*(?:(?!\*)|\*\*(?:(?!\*))+\*\*)+\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:r(/(~~?)(?:(?!~))+\2/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^~~?)[\s\S]+(?=\1$)/,lookbehind:!0,inside:{}},punctuation:/~~?/}},"code-snippet":{pattern:/(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,lookbehind:!0,greedy:!0,alias:["code","keyword"]},url:{pattern:r(/!?\[(?:(?!\]))+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\]))+\])/.source),lookbehind:!0,greedy:!0,inside:{operator:/^!/,content:{pattern:/(^\[)[^\]]+(?=\])/,lookbehind:!0,inside:{}},variable:{pattern:/(^\][ \t]?\[)[^\]]+(?=\]$)/,lookbehind:!0},url:{pattern:/(^\]\()[^\s)]+/,lookbehind:!0},string:{pattern:/(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,lookbehind:!0}}}}),["url","bold","italic","strike"].forEach(function(o){["url","bold","italic","strike","code-snippet"].forEach(function(c){o!==c&&(t.languages.markdown[o].inside.content.inside[c]=t.languages.markdown[c])})}),t.hooks.add("after-tokenize",function(o){if(o.language!=="markdown"&&o.language!=="md")return;function c(f){if(!(!f||typeof f=="string"))for(var p=0,d=f.length;p]?|\+\+?|!=?|<>?=?|==?|&&?|\|\|?|[~^%?*\/@]/}),delete e.languages.objectivec["class-name"],e.languages.objc=e.languages.objectivec}im.displayName="perl";im.aliases=[];function im(e){(function(t){var n=/(?:\((?:[^()\\]|\\[\s\S])*\)|\{(?:[^{}\\]|\\[\s\S])*\}|\[(?:[^[\]\\]|\\[\s\S])*\]|<(?:[^<>\\]|\\[\s\S])*>)/.source;t.languages.perl={comment:[{pattern:/(^\s*)=\w[\s\S]*?=cut.*/m,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\$])#.*/,lookbehind:!0,greedy:!0}],string:[{pattern:RegExp(/\b(?:q|qq|qw|qx)(?![a-zA-Z0-9])\s*/.source+"(?:"+[/([^a-zA-Z0-9\s{(\[<])(?:(?!\1)[^\\]|\\[\s\S])*\1/.source,/([a-zA-Z0-9])(?:(?!\2)[^\\]|\\[\s\S])*\2/.source,n].join("|")+")"),greedy:!0},{pattern:/("|`)(?:(?!\1)[^\\]|\\[\s\S])*\1/,greedy:!0},{pattern:/'(?:[^'\\\r\n]|\\.)*'/,greedy:!0}],regex:[{pattern:RegExp(/\b(?:m|qr)(?![a-zA-Z0-9])\s*/.source+"(?:"+[/([^a-zA-Z0-9\s{(\[<])(?:(?!\1)[^\\]|\\[\s\S])*\1/.source,/([a-zA-Z0-9])(?:(?!\2)[^\\]|\\[\s\S])*\2/.source,n].join("|")+")"+/[msixpodualngc]*/.source),greedy:!0},{pattern:RegExp(/(^|[^-])\b(?:s|tr|y)(?![a-zA-Z0-9])\s*/.source+"(?:"+[/([^a-zA-Z0-9\s{(\[<])(?:(?!\2)[^\\]|\\[\s\S])*\2(?:(?!\2)[^\\]|\\[\s\S])*\2/.source,/([a-zA-Z0-9])(?:(?!\3)[^\\]|\\[\s\S])*\3(?:(?!\3)[^\\]|\\[\s\S])*\3/.source,n+/\s*/.source+n].join("|")+")"+/[msixpodualngcer]*/.source),lookbehind:!0,greedy:!0},{pattern:/\/(?:[^\/\\\r\n]|\\.)*\/[msixpodualngc]*(?=\s*(?:$|[\r\n,.;})&|\-+*~<>!?^]|(?:and|cmp|eq|ge|gt|le|lt|ne|not|or|x|xor)\b))/,greedy:!0}],variable:[/[&*$@%]\{\^[A-Z]+\}/,/[&*$@%]\^[A-Z_]/,/[&*$@%]#?(?=\{)/,/[&*$@%]#?(?:(?:::)*'?(?!\d)[\w$]+(?![\w$]))+(?:::)*/,/[&*$@%]\d+/,/(?!%=)[$@%][!"#$%&'()*+,\-.\/:;<=>?@[\\\]^_`{|}~]/],filehandle:{pattern:/<(?![<=])\S*?>|\b_\b/,alias:"symbol"},"v-string":{pattern:/v\d+(?:\.\d+)*|\d+(?:\.\d+){2,}/,alias:"string"},function:{pattern:/(\bsub[ \t]+)\w+/,lookbehind:!0},keyword:/\b(?:any|break|continue|default|delete|die|do|else|elsif|eval|for|foreach|given|goto|if|last|local|my|next|our|package|print|redo|require|return|say|state|sub|switch|undef|unless|until|use|when|while)\b/,number:/\b(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0b[01](?:_?[01])*|(?:(?:\d(?:_?\d)*)?\.)?\d(?:_?\d)*(?:[Ee][+-]?\d+)?)\b/,operator:/-[rwxoRWXOezsfdlpSbctugkTBMAC]\b|\+[+=]?|-[-=>]?|\*\*?=?|\/\/?=?|=[=~>]?|~[~=]?|\|\|?=?|&&?=?|<(?:=>?|<=?)?|>>?=?|![~=]?|[%^]=?|\.(?:=|\.\.?)?|[\\?]|\bx(?:=|\b)|\b(?:and|cmp|eq|ge|gt|le|lt|ne|not|or|xor)\b/,punctuation:/[{}[\];(),:]/}})(e)}Zu.displayName="markup-templating";Zu.aliases=[];function Zu(e){e.register(al),(function(t){function n(r,a){return"___"+r.toUpperCase()+a+"___"}Object.defineProperties(t.languages["markup-templating"]={},{buildPlaceholders:{value:function(r,a,l,u){if(r.language===a){var o=r.tokenStack=[];r.code=r.code.replace(l,function(c){if(typeof u=="function"&&!u(c))return c;for(var f=o.length,p;r.code.indexOf(p=n(a,f))!==-1;)++f;return o[f]=c,p}),r.grammar=t.languages.markup}}},tokenizePlaceholders:{value:function(r,a){if(r.language!==a||!r.tokenStack)return;r.grammar=t.languages[a];var l=0,u=Object.keys(r.tokenStack);function o(c){for(var f=0;f=u.length);f++){var p=c[f];if(typeof p=="string"||p.content&&typeof p.content=="string"){var d=u[l],_=r.tokenStack[d],v=typeof p=="string"?p:p.content,w=n(a,d),C=v.indexOf(w);if(C>-1){++l;var b=v.substring(0,C),S=new t.Token(a,t.tokenize(_,r.grammar),"language-"+a,_),x=v.substring(C+w.length),y=[];b&&y.push.apply(y,o([b])),y.push(S),x&&y.push.apply(y,o([x])),typeof p=="string"?c.splice.apply(c,[f,1].concat(y)):p.content=y}}else p.content&&o(p.content)}return c}o(r.tokens)}}})})(e)}rm.displayName="php";rm.aliases=[];function rm(e){e.register(Zu),(function(t){var n=/\/\*[\s\S]*?\*\/|\/\/.*|#(?!\[).*/,r=[{pattern:/\b(?:false|true)\b/i,alias:"boolean"},{pattern:/(::\s*)\b[a-z_]\w*\b(?!\s*\()/i,greedy:!0,lookbehind:!0},{pattern:/(\b(?:case|const)\s+)\b[a-z_]\w*(?=\s*[;=])/i,greedy:!0,lookbehind:!0},/\b(?:null)\b/i,/\b[A-Z_][A-Z0-9_]*\b(?!\s*\()/],a=/\b0b[01]+(?:_[01]+)*\b|\b0o[0-7]+(?:_[0-7]+)*\b|\b0x[\da-f]+(?:_[\da-f]+)*\b|(?:\b\d+(?:_\d+)*\.?(?:\d+(?:_\d+)*)?|\B\.\d+)(?:e[+-]?\d+)?/i,l=/|\?\?=?|\.{3}|\??->|[!=]=?=?|::|\*\*=?|--|\+\+|&&|\|\||<<|>>|[?~]|[/^|%*&<>.+-]=?/,u=/[{}\[\](),:;]/;t.languages.php={delimiter:{pattern:/\?>$|^<\?(?:php(?=\s)|=)?/i,alias:"important"},comment:n,variable:/\$+(?:\w+\b|(?=\{))/,package:{pattern:/(namespace\s+|use\s+(?:function\s+)?)(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,lookbehind:!0,inside:{punctuation:/\\/}},"class-name-definition":{pattern:/(\b(?:class|enum|interface|trait)\s+)\b[a-z_]\w*(?!\\)\b/i,lookbehind:!0,alias:"class-name"},"function-definition":{pattern:/(\bfunction\s+)[a-z_]\w*(?=\s*\()/i,lookbehind:!0,alias:"function"},keyword:[{pattern:/(\(\s*)\b(?:array|bool|boolean|float|int|integer|object|string)\b(?=\s*\))/i,alias:"type-casting",greedy:!0,lookbehind:!0},{pattern:/([(,?]\s*)\b(?:array(?!\s*\()|bool|callable|(?:false|null)(?=\s*\|)|float|int|iterable|mixed|object|self|static|string)\b(?=\s*\$)/i,alias:"type-hint",greedy:!0,lookbehind:!0},{pattern:/(\)\s*:\s*(?:\?\s*)?)\b(?:array(?!\s*\()|bool|callable|(?:false|null)(?=\s*\|)|float|int|iterable|mixed|never|object|self|static|string|void)\b/i,alias:"return-type",greedy:!0,lookbehind:!0},{pattern:/\b(?:array(?!\s*\()|bool|float|int|iterable|mixed|object|string|void)\b/i,alias:"type-declaration",greedy:!0},{pattern:/(\|\s*)(?:false|null)\b|\b(?:false|null)(?=\s*\|)/i,alias:"type-declaration",greedy:!0,lookbehind:!0},{pattern:/\b(?:parent|self|static)(?=\s*::)/i,alias:"static-context",greedy:!0},{pattern:/(\byield\s+)from\b/i,lookbehind:!0},/\bclass\b/i,{pattern:/((?:^|[^\s>:]|(?:^|[^-])>|(?:^|[^:]):)\s*)\b(?:abstract|and|array|as|break|callable|case|catch|clone|const|continue|declare|default|die|do|echo|else|elseif|empty|enddeclare|endfor|endforeach|endif|endswitch|endwhile|enum|eval|exit|extends|final|finally|fn|for|foreach|function|global|goto|if|implements|include|include_once|instanceof|insteadof|interface|isset|list|match|namespace|never|new|or|parent|print|private|protected|public|readonly|require|require_once|return|self|static|switch|throw|trait|try|unset|use|var|while|xor|yield|__halt_compiler)\b/i,lookbehind:!0}],"argument-name":{pattern:/([(,]\s*)\b[a-z_]\w*(?=\s*:(?!:))/i,lookbehind:!0},"class-name":[{pattern:/(\b(?:extends|implements|instanceof|new(?!\s+self|\s+static))\s+|\bcatch\s*\()\b[a-z_]\w*(?!\\)\b/i,greedy:!0,lookbehind:!0},{pattern:/(\|\s*)\b[a-z_]\w*(?!\\)\b/i,greedy:!0,lookbehind:!0},{pattern:/\b[a-z_]\w*(?!\\)\b(?=\s*\|)/i,greedy:!0},{pattern:/(\|\s*)(?:\\?\b[a-z_]\w*)+\b/i,alias:"class-name-fully-qualified",greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/(?:\\?\b[a-z_]\w*)+\b(?=\s*\|)/i,alias:"class-name-fully-qualified",greedy:!0,inside:{punctuation:/\\/}},{pattern:/(\b(?:extends|implements|instanceof|new(?!\s+self\b|\s+static\b))\s+|\bcatch\s*\()(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,alias:"class-name-fully-qualified",greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/\b[a-z_]\w*(?=\s*\$)/i,alias:"type-declaration",greedy:!0},{pattern:/(?:\\?\b[a-z_]\w*)+(?=\s*\$)/i,alias:["class-name-fully-qualified","type-declaration"],greedy:!0,inside:{punctuation:/\\/}},{pattern:/\b[a-z_]\w*(?=\s*::)/i,alias:"static-context",greedy:!0},{pattern:/(?:\\?\b[a-z_]\w*)+(?=\s*::)/i,alias:["class-name-fully-qualified","static-context"],greedy:!0,inside:{punctuation:/\\/}},{pattern:/([(,?]\s*)[a-z_]\w*(?=\s*\$)/i,alias:"type-hint",greedy:!0,lookbehind:!0},{pattern:/([(,?]\s*)(?:\\?\b[a-z_]\w*)+(?=\s*\$)/i,alias:["class-name-fully-qualified","type-hint"],greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/(\)\s*:\s*(?:\?\s*)?)\b[a-z_]\w*(?!\\)\b/i,alias:"return-type",greedy:!0,lookbehind:!0},{pattern:/(\)\s*:\s*(?:\?\s*)?)(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,alias:["class-name-fully-qualified","return-type"],greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}}],constant:r,function:{pattern:/(^|[^\\\w])\\?[a-z_](?:[\w\\]*\w)?(?=\s*\()/i,lookbehind:!0,inside:{punctuation:/\\/}},property:{pattern:/(->\s*)\w+/,lookbehind:!0},number:a,operator:l,punctuation:u};var o={pattern:/\{\$(?:\{(?:\{[^{}]+\}|[^{}]+)\}|[^{}])+\}|(^|[^\\{])\$+(?:\w+(?:\[[^\r\n\[\]]+\]|->\w+)?)/,lookbehind:!0,inside:t.languages.php},c=[{pattern:/<<<'([^']+)'[\r\n](?:.*[\r\n])*?\1;/,alias:"nowdoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<<'[^']+'|[a-z_]\w*;$/i,alias:"symbol",inside:{punctuation:/^<<<'?|[';]$/}}}},{pattern:/<<<(?:"([^"]+)"[\r\n](?:.*[\r\n])*?\1;|([a-z_]\w*)[\r\n](?:.*[\r\n])*?\2;)/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<<(?:"[^"]+"|[a-z_]\w*)|[a-z_]\w*;$/i,alias:"symbol",inside:{punctuation:/^<<<"?|[";]$/}},interpolation:o}},{pattern:/`(?:\\[\s\S]|[^\\`])*`/,alias:"backtick-quoted-string",greedy:!0},{pattern:/'(?:\\[\s\S]|[^\\'])*'/,alias:"single-quoted-string",greedy:!0},{pattern:/"(?:\\[\s\S]|[^\\"])*"/,alias:"double-quoted-string",greedy:!0,inside:{interpolation:o}}];t.languages.insertBefore("php","variable",{string:c,attribute:{pattern:/#\[(?:[^"'\/#]|\/(?![*/])|\/\/.*$|#(?!\[).*$|\/\*(?:[^*]|\*(?!\/))*\*\/|"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*')+\](?=\s*[a-z$#])/im,greedy:!0,inside:{"attribute-content":{pattern:/^(#\[)[\s\S]+(?=\]$)/,lookbehind:!0,inside:{comment:n,string:c,"attribute-class-name":[{pattern:/([^:]|^)\b[a-z_]\w*(?!\\)\b/i,alias:"class-name",greedy:!0,lookbehind:!0},{pattern:/([^:]|^)(?:\\?\b[a-z_]\w*)+/i,alias:["class-name","class-name-fully-qualified"],greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}}],constant:r,number:a,operator:l,punctuation:u}},delimiter:{pattern:/^#\[|\]$/,alias:"punctuation"}}}}),t.hooks.add("before-tokenize",function(f){if(/<\?/.test(f.code)){var p=/<\?(?:[^"'/#]|\/(?![*/])|("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|(?:\/\/|#(?!\[))(?:[^?\n\r]|\?(?!>))*(?=$|\?>|[\r\n])|#\[|\/\*(?:[^*]|\*(?!\/))*(?:\*\/|$))*?(?:\?>|$)/g;t.languages["markup-templating"].buildPlaceholders(f,"php",p)}}),t.hooks.add("after-tokenize",function(f){t.languages["markup-templating"].tokenizePlaceholders(f,"php")})})(e)}sm.displayName="python";sm.aliases=["py"];function sm(e){e.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0},"string-interpolation":{pattern:/(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern:/![sra](?=[:}]$)/,alias:"punctuation"},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:"string"},string:{pattern:/(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/m,lookbehind:!0,alias:["annotation","punctuation"],inside:{punctuation:/\./}},keyword:/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:False|None|True)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,operator:/[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/},e.languages.python["string-interpolation"].inside.interpolation.inside.rest=e.languages.python,e.languages.py=e.languages.python}am.displayName="r";am.aliases=[];function am(e){e.languages.r={comment:/#.*/,string:{pattern:/(['"])(?:\\.|(?!\1)[^\\\r\n])*\1/,greedy:!0},"percent-operator":{pattern:/%[^%\s]*%/,alias:"operator"},boolean:/\b(?:FALSE|TRUE)\b/,ellipsis:/\.\.(?:\.|\d+)/,number:[/\b(?:Inf|NaN)\b/,/(?:\b0x[\dA-Fa-f]+(?:\.\d*)?|\b\d+(?:\.\d*)?|\B\.\d+)(?:[EePp][+-]?\d+)?[iL]?/],keyword:/\b(?:NA|NA_character_|NA_complex_|NA_integer_|NA_real_|NULL|break|else|for|function|if|in|next|repeat|while)\b/,operator:/->?>?|<(?:=|=!]=?|::?|&&?|\|\|?|[+*\/^$@~]/,punctuation:/[(){}\[\],;]/}}om.displayName="ruby";om.aliases=["rb"];function om(e){e.register(fi),(function(t){t.languages.ruby=t.languages.extend("clike",{comment:{pattern:/#.*|^=begin\s[\s\S]*?^=end/m,greedy:!0},"class-name":{pattern:/(\b(?:class|module)\s+|\bcatch\s+\()[\w.\\]+|\b[A-Z_]\w*(?=\s*\.\s*new\b)/,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:BEGIN|END|alias|and|begin|break|case|class|def|define_method|defined|do|each|else|elsif|end|ensure|extend|for|if|in|include|module|new|next|nil|not|or|prepend|private|protected|public|raise|redo|require|rescue|retry|return|self|super|then|throw|undef|unless|until|when|while|yield)\b/,operator:/\.{2,3}|&\.|===||[!=]?~|(?:&&|\|\||<<|>>|\*\*|[+\-*/%<>!^&|=])=?|[?:]/,punctuation:/[(){}[\].,;]/}),t.languages.insertBefore("ruby","operator",{"double-colon":{pattern:/::/,alias:"punctuation"}});var n={pattern:/((?:^|[^\\])(?:\\{2})*)#\{(?:[^{}]|\{[^{}]*\})*\}/,lookbehind:!0,inside:{content:{pattern:/^(#\{)[\s\S]+(?=\}$)/,lookbehind:!0,inside:t.languages.ruby},delimiter:{pattern:/^#\{|\}$/,alias:"punctuation"}}};delete t.languages.ruby.function;var r="(?:"+[/([^a-zA-Z0-9\s{(\[<=])(?:(?!\1)[^\\]|\\[\s\S])*\1/.source,/\((?:[^()\\]|\\[\s\S]|\((?:[^()\\]|\\[\s\S])*\))*\)/.source,/\{(?:[^{}\\]|\\[\s\S]|\{(?:[^{}\\]|\\[\s\S])*\})*\}/.source,/\[(?:[^\[\]\\]|\\[\s\S]|\[(?:[^\[\]\\]|\\[\s\S])*\])*\]/.source,/<(?:[^<>\\]|\\[\s\S]|<(?:[^<>\\]|\\[\s\S])*>)*>/.source].join("|")+")",a=/(?:"(?:\\.|[^"\\\r\n])*"|(?:\b[a-zA-Z_]\w*|[^\s\0-\x7F]+)[?!]?|\$.)/.source;t.languages.insertBefore("ruby","keyword",{"regex-literal":[{pattern:RegExp(/%r/.source+r+/[egimnosux]{0,6}/.source),greedy:!0,inside:{interpolation:n,regex:/[\s\S]+/}},{pattern:/(^|[^/])\/(?!\/)(?:\[[^\r\n\]]+\]|\\.|[^[/\\\r\n])+\/[egimnosux]{0,6}(?=\s*(?:$|[\r\n,.;})#]))/,lookbehind:!0,greedy:!0,inside:{interpolation:n,regex:/[\s\S]+/}}],variable:/[@$]+[a-zA-Z_]\w*(?:[?!]|\b)/,symbol:[{pattern:RegExp(/(^|[^:]):/.source+a),lookbehind:!0,greedy:!0},{pattern:RegExp(/([\r\n{(,][ \t]*)/.source+a+/(?=:(?!:))/.source),lookbehind:!0,greedy:!0}],"method-definition":{pattern:/(\bdef\s+)\w+(?:\s*\.\s*\w+)?/,lookbehind:!0,inside:{function:/\b\w+$/,keyword:/^self\b/,"class-name":/^\w+/,punctuation:/\./}}}),t.languages.insertBefore("ruby","string",{"string-literal":[{pattern:RegExp(/%[qQiIwWs]?/.source+r),greedy:!0,inside:{interpolation:n,string:/[\s\S]+/}},{pattern:/("|')(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|(?!\1)[^\\#\r\n])*\1/,greedy:!0,inside:{interpolation:n,string:/[\s\S]+/}},{pattern:/<<[-~]?([a-z_]\w*)[\r\n](?:.*[\r\n])*?[\t ]*\1/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<[-~]?[a-z_]\w*|\b[a-z_]\w*$/i,inside:{symbol:/\b\w+/,punctuation:/^<<[-~]?/}},interpolation:n,string:/[\s\S]+/}},{pattern:/<<[-~]?'([a-z_]\w*)'[\r\n](?:.*[\r\n])*?[\t ]*\1/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<[-~]?'[a-z_]\w*'|\b[a-z_]\w*$/i,inside:{symbol:/\b\w+/,punctuation:/^<<[-~]?'|'$/}},string:/[\s\S]+/}}],"command-literal":[{pattern:RegExp(/%x/.source+r),greedy:!0,inside:{interpolation:n,command:{pattern:/[\s\S]+/,alias:"string"}}},{pattern:/`(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|[^\\`#\r\n])*`/,greedy:!0,inside:{interpolation:n,command:{pattern:/[\s\S]+/,alias:"string"}}}]}),delete t.languages.ruby.string,t.languages.insertBefore("ruby","number",{builtin:/\b(?:Array|Bignum|Binding|Class|Continuation|Dir|Exception|FalseClass|File|Fixnum|Float|Hash|IO|Integer|MatchData|Method|Module|NilClass|Numeric|Object|Proc|Range|Regexp|Stat|String|Struct|Symbol|TMS|Thread|ThreadGroup|Time|TrueClass)\b/,constant:/\b[A-Z][A-Z0-9_]*(?:[?!]|\b)/}),t.languages.rb=t.languages.ruby})(e)}lm.displayName="rust";lm.aliases=[];function lm(e){(function(t){for(var n=/\/\*(?:[^*/]|\*(?!\/)|\/(?!\*)|)*\*\//.source,r=0;r<2;r++)n=n.replace(//g,function(){return n});n=n.replace(//g,function(){return/[^\s\S]/.source}),t.languages.rust={comment:[{pattern:RegExp(/(^|[^\\])/.source+n),lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/b?"(?:\\[\s\S]|[^\\"])*"|b?r(#*)"(?:[^"]|"(?!\1))*"\1/,greedy:!0},char:{pattern:/b?'(?:\\(?:x[0-7][\da-fA-F]|u\{(?:[\da-fA-F]_*){1,6}\}|.)|[^\\\r\n\t'])'/,greedy:!0},attribute:{pattern:/#!?\[(?:[^\[\]"]|"(?:\\[\s\S]|[^\\"])*")*\]/,greedy:!0,alias:"attr-name",inside:{string:null}},"closure-params":{pattern:/([=(,:]\s*|\bmove\s*)\|[^|]*\||\|[^|]*\|(?=\s*(?:\{|->))/,lookbehind:!0,greedy:!0,inside:{"closure-punctuation":{pattern:/^\||\|$/,alias:"punctuation"},rest:null}},"lifetime-annotation":{pattern:/'\w+/,alias:"symbol"},"fragment-specifier":{pattern:/(\$\w+:)[a-z]+/,lookbehind:!0,alias:"punctuation"},variable:/\$\w+/,"function-definition":{pattern:/(\bfn\s+)\w+/,lookbehind:!0,alias:"function"},"type-definition":{pattern:/(\b(?:enum|struct|trait|type|union)\s+)\w+/,lookbehind:!0,alias:"class-name"},"module-declaration":[{pattern:/(\b(?:crate|mod)\s+)[a-z][a-z_\d]*/,lookbehind:!0,alias:"namespace"},{pattern:/(\b(?:crate|self|super)\s*)::\s*[a-z][a-z_\d]*\b(?:\s*::(?:\s*[a-z][a-z_\d]*\s*::)*)?/,lookbehind:!0,alias:"namespace",inside:{punctuation:/::/}}],keyword:[/\b(?:Self|abstract|as|async|await|become|box|break|const|continue|crate|do|dyn|else|enum|extern|final|fn|for|if|impl|in|let|loop|macro|match|mod|move|mut|override|priv|pub|ref|return|self|static|struct|super|trait|try|type|typeof|union|unsafe|unsized|use|virtual|where|while|yield)\b/,/\b(?:bool|char|f(?:32|64)|[ui](?:8|16|32|64|128|size)|str)\b/],function:/\b[a-z_]\w*(?=\s*(?:::\s*<|\())/,macro:{pattern:/\b\w+!/,alias:"property"},constant:/\b[A-Z_][A-Z_\d]+\b/,"class-name":/\b[A-Z]\w*\b/,namespace:{pattern:/(?:\b[a-z][a-z_\d]*\s*::\s*)*\b[a-z][a-z_\d]*\s*::(?!\s*<)/,inside:{punctuation:/::/}},number:/\b(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0o[0-7](?:_?[0-7])*|0b[01](?:_?[01])*|(?:(?:\d(?:_?\d)*)?\.)?\d(?:_?\d)*(?:[Ee][+-]?\d+)?)(?:_?(?:f32|f64|[iu](?:8|16|32|64|size)?))?\b/,boolean:/\b(?:false|true)\b/,punctuation:/->|\.\.=|\.{1,3}|::|[{}[\];(),:]/,operator:/[-+*\/%!^]=?|=[=>]?|&[&=]?|\|[|=]?|<>?=?|[@?]/},t.languages.rust["closure-params"].inside.rest=t.languages.rust,t.languages.rust.attribute.inside.string=t.languages.rust.string})(e)}cm.displayName="sass";cm.aliases=[];function cm(e){e.register(va),(function(t){t.languages.sass=t.languages.extend("css",{comment:{pattern:/^([ \t]*)\/[\/*].*(?:(?:\r?\n|\r)\1[ \t].+)*/m,lookbehind:!0,greedy:!0}}),t.languages.insertBefore("sass","atrule",{"atrule-line":{pattern:/^(?:[ \t]*)[@+=].+/m,greedy:!0,inside:{atrule:/(?:@[\w-]+|[+=])/}}}),delete t.languages.sass.atrule;var n=/\$[-\w]+|#\{\$[-\w]+\}/,r=[/[+*\/%]|[=!]=|<=?|>=?|\b(?:and|not|or)\b/,{pattern:/(\s)-(?=\s)/,lookbehind:!0}];t.languages.insertBefore("sass","property",{"variable-line":{pattern:/^[ \t]*\$.+/m,greedy:!0,inside:{punctuation:/:/,variable:n,operator:r}},"property-line":{pattern:/^[ \t]*(?:[^:\s]+ *:.*|:[^:\s].*)/m,greedy:!0,inside:{property:[/[^:\s]+(?=\s*:)/,{pattern:/(:)[^:\s]+/,lookbehind:!0}],punctuation:/:/,variable:n,operator:r,important:t.languages.sass.important}}}),delete t.languages.sass.property,delete t.languages.sass.important,t.languages.insertBefore("sass","punctuation",{selector:{pattern:/^([ \t]*)\S(?:,[^,\r\n]+|[^,\r\n]*)(?:,[^,\r\n]+)*(?:,(?:\r?\n|\r)\1[ \t]+\S(?:,[^,\r\n]+|[^,\r\n]*)(?:,[^,\r\n]+)*)*/m,lookbehind:!0,greedy:!0}})})(e)}um.displayName="scss";um.aliases=[];function um(e){e.register(va),e.languages.scss=e.languages.extend("css",{comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,lookbehind:!0},atrule:{pattern:/@[\w-](?:\([^()]+\)|[^()\s]|\s+(?!\s))*?(?=\s+[{;])/,inside:{rule:/@[\w-]+/}},url:/(?:[-a-z]+-)?url(?=\()/i,selector:{pattern:/(?=\S)[^@;{}()]?(?:[^@;{}()\s]|\s+(?!\s)|#\{\$[-\w]+\})+(?=\s*\{(?:\}|\s|[^}][^:{}]*[:{][^}]))/,inside:{parent:{pattern:/&/,alias:"important"},placeholder:/%[-\w]+/,variable:/\$[-\w]+|#\{\$[-\w]+\}/}},property:{pattern:/(?:[-\w]|\$[-\w]|#\{\$[-\w]+\})+(?=\s*:)/,inside:{variable:/\$[-\w]+|#\{\$[-\w]+\}/}}}),e.languages.insertBefore("scss","atrule",{keyword:[/@(?:content|debug|each|else(?: if)?|extend|for|forward|function|if|import|include|mixin|return|use|warn|while)\b/i,{pattern:/( )(?:from|through)(?= )/,lookbehind:!0}]}),e.languages.insertBefore("scss","important",{variable:/\$[-\w]+|#\{\$[-\w]+\}/}),e.languages.insertBefore("scss","function",{"module-modifier":{pattern:/\b(?:as|hide|show|with)\b/i,alias:"keyword"},placeholder:{pattern:/%[-\w]+/,alias:"selector"},statement:{pattern:/\B!(?:default|optional)\b/i,alias:"keyword"},boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"},operator:{pattern:/(\s)(?:[-+*\/%]|[=!]=|<=?|>=?|and|not|or)(?=\s)/,lookbehind:!0}}),e.languages.scss.atrule.inside.rest=e.languages.scss}hm.displayName="sql";hm.aliases=[];function hm(e){e.languages.sql={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,lookbehind:!0},variable:[{pattern:/@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/,greedy:!0},/@[\w.$]+/],string:{pattern:/(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\]|\2\2)*\2/,greedy:!0,lookbehind:!0},identifier:{pattern:/(^|[^@\\])`(?:\\[\s\S]|[^`\\]|``)*`/,greedy:!0,lookbehind:!0,inside:{punctuation:/^`|`$/}},function:/\b(?:AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE)(?=\s*\()/i,keyword:/\b(?:ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|APPLY|AS|ASC|AUTHORIZATION|AUTO_INCREMENT|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADED?|CASE|CHAIN|CHAR(?:ACTER|SET)?|CHECK(?:POINT)?|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMNS?|COMMENT|COMMIT(?:TED)?|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS(?:TABLE)?|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|CYCLE|DATA(?:BASES?)?|DATE(?:TIME)?|DAY|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DELIMITERS?|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE|ELSE(?:IF)?|ENABLE|ENCLOSED|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPED?|EXCEPT|EXEC(?:UTE)?|EXISTS|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR(?: EACH ROW)?|FORCE|FOREIGN|FREETEXT(?:TABLE)?|FROM|FULL|FUNCTION|GEOMETRY(?:COLLECTION)?|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|HOUR|IDENTITY(?:COL|_INSERT)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTERVAL|INTO|INVOKER|ISOLATION|ITERATE|JOIN|KEYS?|KILL|LANGUAGE|LAST|LEAVE|LEFT|LEVEL|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|LOOP|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MINUTE|MODE|MODIFIES|MODIFY|MONTH|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL|NATURAL|NCHAR|NEXT|NO|NONCLUSTERED|NULLIF|NUMERIC|OFF?|OFFSETS?|ON|OPEN(?:DATASOURCE|QUERY|ROWSET)?|OPTIMIZE|OPTION(?:ALLY)?|ORDER|OUT(?:ER|FILE)?|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREPARE|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READS?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEAT(?:ABLE)?|REPLACE|REPLICATION|REQUIRE|RESIGNAL|RESTORE|RESTRICT|RETURN(?:ING|S)?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SECOND|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|SQL|START(?:ING)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED|TEXT(?:SIZE)?|THEN|TIME(?:STAMP)?|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNLOCK|UNPIVOT|UNSIGNED|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?|YEAR)\b/i,boolean:/\b(?:FALSE|NULL|TRUE)\b/i,number:/\b0x[\da-f]+\b|\b\d+(?:\.\d*)?|\B\.\d+\b/i,operator:/[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|DIV|ILIKE|IN|IS|LIKE|NOT|OR|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,punctuation:/[;[\]()`,.]/}}fm.displayName="swift";fm.aliases=[];function fm(e){e.languages.swift={comment:{pattern:/(^|[^\\:])(?:\/\/.*|\/\*(?:[^/*]|\/(?!\*)|\*(?!\/)|\/\*(?:[^*]|\*(?!\/))*\*\/)*\*\/)/,lookbehind:!0,greedy:!0},"string-literal":[{pattern:RegExp(/(^|[^"#])/.source+"(?:"+/"(?:\\(?:\((?:[^()]|\([^()]*\))*\)|\r\n|[^(])|[^\\\r\n"])*"/.source+"|"+/"""(?:\\(?:\((?:[^()]|\([^()]*\))*\)|[^(])|[^\\"]|"(?!""))*"""/.source+")"+/(?!["#])/.source),lookbehind:!0,greedy:!0,inside:{interpolation:{pattern:/(\\\()(?:[^()]|\([^()]*\))*(?=\))/,lookbehind:!0,inside:null},"interpolation-punctuation":{pattern:/^\)|\\\($/,alias:"punctuation"},punctuation:/\\(?=[\r\n])/,string:/[\s\S]+/}},{pattern:RegExp(/(^|[^"#])(#+)/.source+"(?:"+/"(?:\\(?:#+\((?:[^()]|\([^()]*\))*\)|\r\n|[^#])|[^\\\r\n])*?"/.source+"|"+/"""(?:\\(?:#+\((?:[^()]|\([^()]*\))*\)|[^#])|[^\\])*?"""/.source+")\\2"),lookbehind:!0,greedy:!0,inside:{interpolation:{pattern:/(\\#+\()(?:[^()]|\([^()]*\))*(?=\))/,lookbehind:!0,inside:null},"interpolation-punctuation":{pattern:/^\)|\\#+\($/,alias:"punctuation"},string:/[\s\S]+/}}],directive:{pattern:RegExp(/#/.source+"(?:"+(/(?:elseif|if)\b/.source+"(?:[ ]*"+/(?:![ \t]*)?(?:\b\w+\b(?:[ \t]*\((?:[^()]|\([^()]*\))*\))?|\((?:[^()]|\([^()]*\))*\))(?:[ \t]*(?:&&|\|\|))?/.source+")+")+"|"+/(?:else|endif)\b/.source+")"),alias:"property",inside:{"directive-name":/^#\w+/,boolean:/\b(?:false|true)\b/,number:/\b\d+(?:\.\d+)*\b/,operator:/!|&&|\|\||[<>]=?/,punctuation:/[(),]/}},literal:{pattern:/#(?:colorLiteral|column|dsohandle|file(?:ID|Literal|Path)?|function|imageLiteral|line)\b/,alias:"constant"},"other-directive":{pattern:/#\w+\b/,alias:"property"},attribute:{pattern:/@\w+/,alias:"atrule"},"function-definition":{pattern:/(\bfunc\s+)\w+/,lookbehind:!0,alias:"function"},label:{pattern:/\b(break|continue)\s+\w+|\b[a-zA-Z_]\w*(?=\s*:\s*(?:for|repeat|while)\b)/,lookbehind:!0,alias:"important"},keyword:/\b(?:Any|Protocol|Self|Type|actor|as|assignment|associatedtype|associativity|async|await|break|case|catch|class|continue|convenience|default|defer|deinit|didSet|do|dynamic|else|enum|extension|fallthrough|fileprivate|final|for|func|get|guard|higherThan|if|import|in|indirect|infix|init|inout|internal|is|isolated|lazy|left|let|lowerThan|mutating|none|nonisolated|nonmutating|open|operator|optional|override|postfix|precedencegroup|prefix|private|protocol|public|repeat|required|rethrows|return|right|safe|self|set|some|static|struct|subscript|super|switch|throw|throws|try|typealias|unowned|unsafe|var|weak|where|while|willSet)\b/,boolean:/\b(?:false|true)\b/,nil:{pattern:/\bnil\b/,alias:"constant"},"short-argument":/\$\d+\b/,omit:{pattern:/\b_\b/,alias:"keyword"},number:/\b(?:[\d_]+(?:\.[\de_]+)?|0x[a-f0-9_]+(?:\.[a-f0-9p_]+)?|0b[01_]+|0o[0-7_]+)\b/i,"class-name":/\b[A-Z](?:[A-Z_\d]*[a-z]\w*)?\b/,function:/\b[a-z_]\w*(?=\s*\()/i,constant:/\b(?:[A-Z_]{2,}|k[A-Z][A-Za-z_]+)\b/,operator:/[-+*/%=!<>&|^~?]+|\.[.\-+*/%=!<>&|^~?]+/,punctuation:/[{}[\]();,.:\\]/},e.languages.swift["string-literal"].forEach(function(t){t.inside.interpolation.inside=e.languages.swift})}dm.displayName="typescript";dm.aliases=["ts"];function dm(e){e.register(Ku),(function(t){t.languages.typescript=t.languages.extend("javascript",{"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,lookbehind:!0,greedy:!0,inside:null},builtin:/\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/}),t.languages.typescript.keyword.push(/\b(?:abstract|declare|is|keyof|readonly|require)\b/,/\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,/\btype\b(?=\s*(?:[\{*]|$))/),delete t.languages.typescript.parameter,delete t.languages.typescript["literal-property"];var n=t.languages.extend("typescript",{});delete n["class-name"],t.languages.typescript["class-name"].inside=n,t.languages.insertBefore("typescript","function",{decorator:{pattern:/@[$\w\xA0-\uFFFF]+/,inside:{at:{pattern:/^@/,alias:"operator"},function:/^[\s\S]+/}},"generic-function":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,greedy:!0,inside:{function:/^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:n}}}}),t.languages.ts=t.languages.typescript})(e)}Qu.displayName="basic";Qu.aliases=[];function Qu(e){e.languages.basic={comment:{pattern:/(?:!|REM\b).+/i,inside:{keyword:/^REM/i}},string:{pattern:/"(?:""|[!#$%&'()*,\/:;<=>?^\w +\-.])*"/,greedy:!0},number:/(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:E[+-]?\d+)?/i,keyword:/\b(?:AS|BEEP|BLOAD|BSAVE|CALL(?: ABSOLUTE)?|CASE|CHAIN|CHDIR|CLEAR|CLOSE|CLS|COM|COMMON|CONST|DATA|DECLARE|DEF(?: FN| SEG|DBL|INT|LNG|SNG|STR)|DIM|DO|DOUBLE|ELSE|ELSEIF|END|ENVIRON|ERASE|ERROR|EXIT|FIELD|FILES|FOR|FUNCTION|GET|GOSUB|GOTO|IF|INPUT|INTEGER|IOCTL|KEY|KILL|LINE INPUT|LOCATE|LOCK|LONG|LOOP|LSET|MKDIR|NAME|NEXT|OFF|ON(?: COM| ERROR| KEY| TIMER)?|OPEN|OPTION BASE|OUT|POKE|PUT|READ|REDIM|REM|RESTORE|RESUME|RETURN|RMDIR|RSET|RUN|SELECT CASE|SHARED|SHELL|SINGLE|SLEEP|STATIC|STEP|STOP|STRING|SUB|SWAP|SYSTEM|THEN|TIMER|TO|TROFF|TRON|TYPE|UNLOCK|UNTIL|USING|VIEW PRINT|WAIT|WEND|WHILE|WRITE)(?:\$|\b)/i,function:/\b(?:ABS|ACCESS|ACOS|ANGLE|AREA|ARITHMETIC|ARRAY|ASIN|ASK|AT|ATN|BASE|BEGIN|BREAK|CAUSE|CEIL|CHR|CLIP|COLLATE|COLOR|CON|COS|COSH|COT|CSC|DATE|DATUM|DEBUG|DECIMAL|DEF|DEG|DEGREES|DELETE|DET|DEVICE|DISPLAY|DOT|ELAPSED|EPS|ERASABLE|EXLINE|EXP|EXTERNAL|EXTYPE|FILETYPE|FIXED|FP|GO|GRAPH|HANDLER|IDN|IMAGE|IN|INT|INTERNAL|IP|IS|KEYED|LBOUND|LCASE|LEFT|LEN|LENGTH|LET|LINE|LINES|LOG|LOG10|LOG2|LTRIM|MARGIN|MAT|MAX|MAXNUM|MID|MIN|MISSING|MOD|NATIVE|NUL|NUMERIC|OF|OPTION|ORD|ORGANIZATION|OUTIN|OUTPUT|PI|POINT|POINTER|POINTS|POS|PRINT|PROGRAM|PROMPT|RAD|RADIANS|RANDOMIZE|RECORD|RECSIZE|RECTYPE|RELATIVE|REMAINDER|REPEAT|REST|RETRY|REWRITE|RIGHT|RND|ROUND|RTRIM|SAME|SEC|SELECT|SEQUENTIAL|SET|SETTER|SGN|SIN|SINH|SIZE|SKIP|SQR|STANDARD|STATUS|STR|STREAM|STYLE|TAB|TAN|TANH|TEMPLATE|TEXT|THERE|TIME|TIMEOUT|TRACE|TRANSFORM|TRUNCATE|UBOUND|UCASE|USE|VAL|VARIABLE|VIEWPORT|WHEN|WINDOW|WITH|ZER|ZONEWIDTH)(?:\$|\b)/i,operator:/<[=>]?|>=?|[+\-*\/^=&]|\b(?:AND|EQV|IMP|NOT|OR|XOR)\b/i,punctuation:/[,;:()]/}}pm.displayName="vbnet";pm.aliases=[];function pm(e){e.register(Qu),e.languages.vbnet=e.languages.extend("basic",{comment:[{pattern:/(?:!|REM\b).+/i,inside:{keyword:/^REM/i}},{pattern:/(^|[^\\:])'.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(^|[^"])"(?:""|[^"])*"(?!")/,lookbehind:!0,greedy:!0},keyword:/(?:\b(?:ADDHANDLER|ADDRESSOF|ALIAS|AND|ANDALSO|AS|BEEP|BLOAD|BOOLEAN|BSAVE|BYREF|BYTE|BYVAL|CALL(?: ABSOLUTE)?|CASE|CATCH|CBOOL|CBYTE|CCHAR|CDATE|CDBL|CDEC|CHAIN|CHAR|CHDIR|CINT|CLASS|CLEAR|CLNG|CLOSE|CLS|COBJ|COM|COMMON|CONST|CONTINUE|CSBYTE|CSHORT|CSNG|CSTR|CTYPE|CUINT|CULNG|CUSHORT|DATA|DATE|DECIMAL|DECLARE|DEF(?: FN| SEG|DBL|INT|LNG|SNG|STR)|DEFAULT|DELEGATE|DIM|DIRECTCAST|DO|DOUBLE|ELSE|ELSEIF|END|ENUM|ENVIRON|ERASE|ERROR|EVENT|EXIT|FALSE|FIELD|FILES|FINALLY|FOR(?: EACH)?|FRIEND|FUNCTION|GET|GETTYPE|GETXMLNAMESPACE|GLOBAL|GOSUB|GOTO|HANDLES|IF|IMPLEMENTS|IMPORTS|IN|INHERITS|INPUT|INTEGER|INTERFACE|IOCTL|IS|ISNOT|KEY|KILL|LET|LIB|LIKE|LINE INPUT|LOCATE|LOCK|LONG|LOOP|LSET|ME|MKDIR|MOD|MODULE|MUSTINHERIT|MUSTOVERRIDE|MYBASE|MYCLASS|NAME|NAMESPACE|NARROWING|NEW|NEXT|NOT|NOTHING|NOTINHERITABLE|NOTOVERRIDABLE|OBJECT|OF|OFF|ON(?: COM| ERROR| KEY| TIMER)?|OPEN|OPERATOR|OPTION(?: BASE)?|OPTIONAL|OR|ORELSE|OUT|OVERLOADS|OVERRIDABLE|OVERRIDES|PARAMARRAY|PARTIAL|POKE|PRIVATE|PROPERTY|PROTECTED|PUBLIC|PUT|RAISEEVENT|READ|READONLY|REDIM|REM|REMOVEHANDLER|RESTORE|RESUME|RETURN|RMDIR|RSET|RUN|SBYTE|SELECT(?: CASE)?|SET|SHADOWS|SHARED|SHELL|SHORT|SINGLE|SLEEP|STATIC|STEP|STOP|STRING|STRUCTURE|SUB|SWAP|SYNCLOCK|SYSTEM|THEN|THROW|TIMER|TO|TROFF|TRON|TRUE|TRY|TRYCAST|TYPE|TYPEOF|UINTEGER|ULONG|UNLOCK|UNTIL|USHORT|USING|VIEW PRINT|WAIT|WEND|WHEN|WHILE|WIDENING|WITH|WITHEVENTS|WRITE|WRITEONLY|XOR)|\B(?:#CONST|#ELSE|#ELSEIF|#END|#IF))(?:\$|\b)/i,punctuation:/[,;:(){}]/})}const D1=/[#.]/g;function GM(e,t){const n=e||"",r={};let a=0,l,u;for(;a=48&&t<=57}function QM(e){const t=typeof e=="string"?e.charCodeAt(0):e;return t>=97&&t<=102||t>=65&&t<=70||t>=48&&t<=57}function JM(e){const t=typeof e=="string"?e.charCodeAt(0):e;return t>=97&&t<=122||t>=65&&t<=90}function L1(e){return JM(e)||lw(e)}const eL=["","Named character references must be terminated by a semicolon","Numeric character references must be terminated by a semicolon","Named character references cannot be empty","Numeric character references cannot be empty","Named character references must be known","Numeric character references cannot be disallowed","Numeric character references cannot be outside the permissible Unicode range"];function tL(e,t){const n={},r=typeof n.additional=="string"?n.additional.charCodeAt(0):n.additional,a=[];let l=0,u=-1,o="",c,f;n.position&&("start"in n.position||"indent"in n.position?(f=n.position.indent,c=n.position.start):c=n.position);let p=(c?c.line:0)||1,d=(c?c.column:0)||1,_=w(),v;for(l--;++l<=e.length;)if(v===10&&(d=(f?f[u]:0)||1),v=e.charCodeAt(l),v===38){const S=e.charCodeAt(l+1);if(S===9||S===10||S===12||S===32||S===38||S===60||Number.isNaN(S)||r&&S===r){o+=String.fromCharCode(v),d++;continue}const x=l+1;let y=x,k=x,D;if(S===35){k=++y;const F=e.charCodeAt(k);F===88||F===120?(D="hexadecimal",k=++y):D="decimal"}else D="named";let T="",R="",N="";const M=D==="named"?L1:D==="decimal"?lw:QM;for(k--;++k<=e.length;){const F=e.charCodeAt(k);if(!M(F))break;N+=String.fromCharCode(F),D==="named"&&ZM.includes(N)&&(T=N,R=Ho(N))}let B=e.charCodeAt(k)===59;if(B){k++;const F=D==="named"?Ho(N):!1;F&&(T=N,R=F)}let H=1+k-x,Y="";if(!(!B&&n.nonTerminated===!1))if(!N)D!=="named"&&C(4,H);else if(D==="named"){if(B&&!R)C(5,1);else if(T!==N&&(k=y+T.length,H=1+k-y,B=!1),!B){const F=T?1:3;if(n.attribute){const z=e.charCodeAt(k);z===61?(C(F,H),R=""):L1(z)?R="":C(F,H)}else C(F,H)}Y=R}else{B||C(2,H);let F=Number.parseInt(N,D==="hexadecimal"?16:10);if(nL(F))C(7,H),Y="�";else if(F in M1)C(6,H),Y=M1[F];else{let z="";iL(F)&&C(6,H),F>65535&&(F-=65536,z+=String.fromCharCode(F>>>10|55296),F=56320|F&1023),Y=z+String.fromCharCode(F)}}if(Y){b(),_=w(),l=k-1,d+=k-x+1,a.push(Y);const F=w();F.offset++,n.reference&&n.reference.call(n.referenceContext||void 0,Y,{start:_,end:F},e.slice(x-1,k)),_=F}else N=e.slice(x-1,k),o+=N,d+=N.length,l=k-1}else v===10&&(p++,u++,d=0),Number.isNaN(v)?b():(o+=String.fromCharCode(v),d++);return a.join("");function w(){return{line:p,column:d,offset:l+((c?c.offset:0)||0)}}function C(S,x){let y;n.warning&&(y=w(),y.column+=x,y.offset+=x,n.warning.call(n.warningContext||void 0,eL[S],y,S))}function b(){o&&(a.push(o),n.text&&n.text.call(n.textContext||void 0,o,{start:_,end:w()}),o="")}}function nL(e){return e>=55296&&e<=57343||e>1114111}function iL(e){return e>=1&&e<=8||e===11||e>=13&&e<=31||e>=127&&e<=159||e>=64976&&e<=65007||(e&65535)===65535||(e&65535)===65534}var rL=0,Pc={},Vt={util:{type:function(e){return Object.prototype.toString.call(e).slice(8,-1)},objId:function(e){return e.__id||Object.defineProperty(e,"__id",{value:++rL}),e.__id},clone:function e(t,n){n=n||{};var r,a;switch(Vt.util.type(t)){case"Object":if(a=Vt.util.objId(t),n[a])return n[a];r={},n[a]=r;for(var l in t)t.hasOwnProperty(l)&&(r[l]=e(t[l],n));return r;case"Array":return a=Vt.util.objId(t),n[a]?n[a]:(r=[],n[a]=r,t.forEach(function(u,o){r[o]=e(u,n)}),r);default:return t}}},languages:{plain:Pc,plaintext:Pc,text:Pc,txt:Pc,extend:function(e,t){var n=Vt.util.clone(Vt.languages[e]);for(var r in t)n[r]=t[r];return n},insertBefore:function(e,t,n,r){r=r||Vt.languages;var a=r[e],l={};for(var u in a)if(a.hasOwnProperty(u)){if(u==t)for(var o in n)n.hasOwnProperty(o)&&(l[o]=n[o]);n.hasOwnProperty(u)||(l[u]=a[u])}var c=r[e];return r[e]=l,Vt.languages.DFS(Vt.languages,function(f,p){p===c&&f!=e&&(this[f]=l)}),l},DFS:function e(t,n,r,a){a=a||{};var l=Vt.util.objId;for(var u in t)if(t.hasOwnProperty(u)){n.call(t,u,t[u],r||u);var o=t[u],c=Vt.util.type(o);c==="Object"&&!a[l(o)]?(a[l(o)]=!0,e(o,n,null,a)):c==="Array"&&!a[l(o)]&&(a[l(o)]=!0,e(o,n,u,a))}}},plugins:{},highlight:function(e,t,n){var r={code:e,grammar:t,language:n};if(Vt.hooks.run("before-tokenize",r),!r.grammar)throw new Error('The language "'+r.language+'" has no grammar.');return r.tokens=Vt.tokenize(r.code,r.grammar),Vt.hooks.run("after-tokenize",r),Mo.stringify(Vt.util.encode(r.tokens),r.language)},tokenize:function(e,t){var n=t.rest;if(n){for(var r in n)t[r]=n[r];delete t.rest}var a=new sL;return cu(a,a.head,e),cw(e,a,t,a.head,0),oL(a)},hooks:{all:{},add:function(e,t){var n=Vt.hooks.all;n[e]=n[e]||[],n[e].push(t)},run:function(e,t){var n=Vt.hooks.all[e];if(!(!n||!n.length))for(var r=0,a;a=n[r++];)a(t)}},Token:Mo};function Mo(e,t,n,r){this.type=e,this.content=t,this.alias=n,this.length=(r||"").length|0}function O1(e,t,n,r){e.lastIndex=t;var a=e.exec(n);if(a&&r&&a[1]){var l=a[1].length;a.index+=l,a[0]=a[0].slice(l)}return a}function cw(e,t,n,r,a,l){for(var u in n)if(!(!n.hasOwnProperty(u)||!n[u])){var o=n[u];o=Array.isArray(o)?o:[o];for(var c=0;c=l.reach);S+=b.value.length,b=b.next){var x=b.value;if(t.length>e.length)return;if(!(x instanceof Mo)){var y=1,k;if(_){if(k=O1(C,S,e,d),!k||k.index>=e.length)break;var N=k.index,D=k.index+k[0].length,T=S;for(T+=b.value.length;N>=T;)b=b.next,T+=b.value.length;if(T-=b.value.length,S=T,b.value instanceof Mo)continue;for(var R=b;R!==t.tail&&(Tl.reach&&(l.reach=Y);var F=b.prev;B&&(F=cu(t,F,B),S+=B.length),aL(t,F,y);var z=new Mo(u,p?Vt.tokenize(M,p):M,v,M);if(b=cu(t,F,z),H&&cu(t,b,H),y>1){var q={cause:u+","+c,reach:Y};cw(e,t,n,b.prev,S,q),l&&q.reach>l.reach&&(l.reach=q.reach)}}}}}}function sL(){var e={value:null,prev:null,next:null},t={value:null,prev:e,next:null};e.next=t,this.head=e,this.tail=t,this.length=0}function cu(e,t,n){var r=t.next,a={value:n,prev:t,next:r};return t.next=a,r.prev=a,e.length++,a}function aL(e,t,n){for(var r=t.next,a=0;an)return e;try{return Me.highlight(e,t).children.map(fw)}catch{return e}}const gL=1e5;function mL({code:e,lang:t}){const[n,r]=V.useState(!1),a=()=>{var l;(l=navigator.clipboard)==null||l.writeText(e).then(()=>{r(!0),setTimeout(()=>r(!1),1500)})};return m.jsxs("div",{className:"md-code",children:[m.jsx("button",{className:"md-code-copy",title:"Copy","aria-label":"Copy code",onClick:a,children:n?m.jsx(_n,{size:13}):m.jsx(yg,{size:13})}),m.jsx("pre",{children:m.jsx("code",{children:dw(e,t,gL)})})]})}function _L(e){const t={};for(const n of e.matchAll(/([\w-]+)=(["'])(.*?)\2/g)){const r=n[1];r&&(t[r.toLowerCase()]=n[3]??"")}return t}function vL(e){const t=/]*?)\/?>/gi,n=[];let r=0,a=!1;for(const l of e.matchAll(t)){const u=_L(l[1]??"");u.path&&(a=!0,l.index>r&&n.push({type:"text",value:e.slice(r,l.index)}),n.push({children:[],data:{hName:"file-mention",hProperties:u},type:"fileMention"}),r=l.index+l[0].length)}return a?(rpw(e)}function j1({path:e,lines:t,onOpenFile:n}){const r=e.split("/").pop()||e,a=t&&Number.parseInt(t,10)||void 0,l=a!=null?`${r}:${a}`:r;return m.jsxs("button",{className:"file-chip",title:`Open ${e}`,onClick:()=>n==null?void 0:n(e),disabled:!n,children:[m.jsx(IS,{size:12}),m.jsx("span",{className:"file-chip-label",children:l})]})}function bL(e){return!(/^[a-z][a-z0-9+.-]*:/i.test(e)||e.startsWith("#")||e.startsWith("//"))}const gw={code:({node:e,className:t,children:n,...r})=>{const a=t??"",l=/language-(\w+)/.exec(a),u=String(n??"").replace(/\n$/,"");if(!(l!=null||u.includes(` +`)))return m.jsx("code",{className:a,...r,children:n});const c=l?Up(l[1]):null;return m.jsx(mL,{code:u,lang:c})},pre:({children:e})=>m.jsx(m.Fragment,{children:e})};function Ju({text:e,onOpenFile:t}){const n={"file-mention":r=>m.jsx(j1,{path:r.path,lines:r.lines,onOpenFile:t}),a:({node:r,href:a,children:l,...u})=>a&&bL(a)&&t?m.jsx(j1,{path:decodeURI(a),onOpenFile:t}):m.jsx("a",{href:a,target:"_blank",rel:"noopener noreferrer",...u,children:l}),...gw};return m.jsx("div",{className:"md",children:m.jsx(jx,{remarkPlugins:[sw,yL],components:n,children:e})})}function SL({plan:e,synthesized:t,onView:n,onApprove:r,onKeepPlanning:a}){const[l,u]=V.useState(!1),o=V.useRef(null);V.useEffect(()=>{if(!l)return;const f=p=>{o.current&&!o.current.contains(p.target)&&u(!1)};return window.addEventListener("pointerdown",f),()=>window.removeEventListener("pointerdown",f)},[l]);const c=e.split(` +`).map(f=>f.replace(/^#+\s*/,"").trim()).find(f=>f.length>0)??"";return m.jsxs("div",{className:"plan-strip",children:[m.jsxs("div",{className:"plan-strip-info",children:[m.jsx(PS,{size:14,className:"plan-strip-icon"}),m.jsxs("div",{className:"plan-strip-text",children:[m.jsx("span",{className:"plan-strip-title",children:t?"Plan mode — ready to proceed?":"Plan ready"}),c&&m.jsx("span",{className:"plan-strip-excerpt",children:c})]})]}),m.jsxs("div",{className:"plan-strip-actions",children:[m.jsx("button",{className:"btn-ghost",onClick:n,children:"View plan"}),m.jsx("button",{className:"btn-ghost",onClick:a,children:"Keep planning"}),m.jsxs("div",{className:"plan-strip-approve",ref:o,children:[m.jsx("button",{className:"btn-primary",onClick:()=>r("auto"),children:"Approve & run"}),m.jsx("button",{className:"btn-primary plan-strip-caret","aria-label":"More approval options",onClick:()=>u(f=>!f),children:m.jsx(pa,{size:13})}),l&&m.jsxs("div",{className:"plan-strip-menu",children:[m.jsx("button",{onClick:()=>{u(!1),r("accept-edits")},children:"Approve & accept edits"}),m.jsx("button",{onClick:()=>{u(!1),r("bypass")},children:"Approve & bypass all"})]})]})]})]})}function mw({onSaved:e}){const[t,n]=V.useState(""),[r,a]=V.useState(!1),[l,u]=V.useState(null);async function o(c){if(c.preventDefault(),!(r||!t.trim())){a(!0),u(null);try{e(await tN(t.trim())),n("")}catch(f){u(f instanceof Error?f.message:String(f))}finally{a(!1)}}}return m.jsxs("form",{className:"onb-token-form",onSubmit:o,children:[m.jsx("input",{type:"password",value:t,onChange:c=>n(c.target.value),placeholder:"ghp_… personal access token",autoComplete:"off"}),m.jsx("button",{type:"submit",className:"btn",disabled:r||!t.trim(),children:r?"Checking…":"Save"}),m.jsx("a",{href:"https://github.com/settings/tokens/new?scopes=repo,workflow&description=orx",target:"_blank",rel:"noreferrer",children:"Create a token ↗"}),l&&m.jsx("div",{className:"error",children:l})]})}function xL(e){switch(e){case"modal_job":return"Modal";case"hf_job":return"Hugging Face";case"k8s_job":return"Kubernetes";case"ssh_job":return"SSH";case"slurm_job":return"Slurm";case"openresearch_job":return"OpenResearch";case"local_job":return"This machine";default:return e||"—"}}function wL({size:e=16}){return m.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24","aria-hidden":"true",children:[m.jsx("path",{d:"M2.25 11.535c0-3.407 1.847-6.554 4.844-8.258a9.822 9.822 0 019.687 0c2.997 1.704 4.844 4.851 4.844 8.258 0 5.266-4.337 9.535-9.687 9.535S2.25 16.8 2.25 11.535z",fill:"#FF9D0B"}),m.jsx("path",{d:"M11.938 20.086c4.797 0 8.687-3.829 8.687-8.551 0-4.722-3.89-8.55-8.687-8.55-4.798 0-8.688 3.828-8.688 8.55 0 4.722 3.89 8.55 8.688 8.55z",fill:"#FFD21E"}),m.jsx("path",{d:"M11.875 15.113c2.457 0 3.25-2.156 3.25-3.263 0-.576-.393-.394-1.023-.089-.582.283-1.365.675-2.224.675-1.798 0-3.25-1.693-3.25-.586 0 1.107.79 3.263 3.25 3.263h-.003z",fill:"#FF323D"}),m.jsx("path",{d:"M14.76 9.21c.32.108.445.753.767.585.447-.233.707-.708.659-1.204a1.235 1.235 0 00-.879-1.059 1.262 1.262 0 00-1.33.394c-.322.384-.377.92-.14 1.36.153.283.638-.177.925-.079l-.002.003zm-5.887 0c-.32.108-.448.753-.768.585a1.226 1.226 0 01-.658-1.204c.048-.495.395-.913.878-1.059a1.262 1.262 0 011.33.394c.322.384.377.92.14 1.36-.152.283-.64-.177-.925-.079l.003.003z",fill:"#3A3B45"}),m.jsx("path",{d:"M17.812 10.366a.806.806 0 00.813-.8c0-.441-.364-.8-.813-.8a.806.806 0 00-.812.8c0 .442.364.8.812.8zm-11.624 0a.806.806 0 00.812-.8c0-.441-.364-.8-.812-.8a.806.806 0 00-.813.8c0 .442.364.8.813.8z",fill:"#3A3B45"}),m.jsx("path",{d:"M4.515 13.073c-.405 0-.765.162-1.017.46a1.455 1.455 0 00-.333.925 1.801 1.801 0 00-.485-.074c-.387 0-.737.146-.985.409a1.41 1.41 0 00-.2 1.722 1.302 1.302 0 00-.447.694c-.06.222-.12.69.2 1.166a1.267 1.267 0 00-.093 1.236c.238.533.81.958 1.89 1.405l.24.096c.768.3 1.473.492 1.478.494.89.243 1.808.375 2.732.394 1.465 0 2.513-.443 3.115-1.314.93-1.342.842-2.575-.274-3.763l-.151-.154c-.692-.684-1.155-1.69-1.25-1.912-.195-.655-.71-1.383-1.562-1.383-.46.007-.889.233-1.15.605-.25-.31-.495-.553-.715-.694a1.87 1.87 0 00-.993-.312zm14.97 0c.405 0 .767.162 1.017.46.216.262.333.588.333.925.158-.047.322-.071.487-.074.388 0 .738.146.985.409a1.41 1.41 0 01.2 1.722c.22.178.377.422.445.694.06.222.12.69-.2 1.166.244.37.279.836.093 1.236-.238.533-.81.958-1.889 1.405l-.239.096c-.77.3-1.475.492-1.48.494-.89.243-1.808.375-2.732.394-1.465 0-2.513-.443-3.115-1.314-.93-1.342-.842-2.575.274-3.763l.151-.154c.695-.684 1.157-1.69 1.252-1.912.195-.655.708-1.383 1.56-1.383.46.007.889.233 1.15.605.25-.31.495-.553.718-.694.244-.162.523-.265.814-.3l.176-.012z",fill:"#FF9D0B"}),m.jsx("path",{d:"M9.785 20.132c.688-.994.638-1.74-.305-2.667-.945-.928-1.495-2.288-1.495-2.288s-.205-.788-.672-.714c-.468.074-.81 1.25.17 1.971.977.721-.195 1.21-.573.534-.375-.677-1.405-2.416-1.94-2.751-.532-.332-.907-.148-.782.541.125.687 2.357 2.35 2.14 2.707-.218.362-.983-.42-.983-.42S2.953 14.9 2.43 15.46c-.52.558.398 1.026 1.7 1.803 1.308.778 1.41.985 1.225 1.28-.187.295-3.07-2.1-3.34-1.083-.27 1.011 2.943 1.304 2.745 2.006-.2.7-2.265-1.324-2.685-.537-.425.79 2.913 1.718 2.94 1.725 1.075.276 3.813.859 4.77-.522zm4.432 0c-.687-.994-.64-1.74.305-2.667.943-.928 1.493-2.288 1.493-2.288s.205-.788.675-.714c.465.074.807 1.25-.17 1.971-.98.721.195 1.21.57.534.377-.677 1.407-2.416 1.94-2.751.532-.332.91-.148.782.541-.125.687-2.355 2.35-2.137 2.707.215.362.98-.42.98-.42S21.05 14.9 21.57 15.46c.52.558-.395 1.026-1.7 1.803-1.308.778-1.408.985-1.225 1.28.187.295 3.07-2.1 3.34-1.083.27 1.011-2.94 1.304-2.743 2.006.2.7 2.263-1.324 2.685-.537.423.79-2.912 1.718-2.94 1.725-1.077.276-3.815.859-4.77-.522z",fill:"#FFD21E"})]})}function CL({size:e=16}){return m.jsxs("svg",{width:e,height:e,viewBox:"0 0 300 300",fill:"none","aria-hidden":"true",children:[m.jsx("path",{d:"M121.683 75.25L149.997 124L91.4816 224.75C90.3128 226.757 88.155 228 85.8174 228H32.9664C31.7976 228 30.6778 227.691 29.697 227.131C28.7161 226.57 27.8906 225.758 27.3021 224.75L0.876625 179.25C-0.292208 177.243 -0.292208 174.765 0.876625 172.75L57.512 75.25C58.0923 74.2425 58.9259 73.43 59.9068 72.8694C60.8876 72.3088 62.0074 72 63.1762 72H116.027C118.365 72 120.523 73.2431 121.692 75.25H121.683ZM299.125 172.75L242.49 75.25C241.91 74.2425 241.076 73.43 240.095 72.8694C239.114 72.3088 237.995 72 236.826 72H183.975C181.637 72 179.479 73.2431 178.311 75.25L149.997 124L208.512 224.75C209.681 226.757 211.839 228 214.177 228H267.027C268.196 228 269.316 227.691 270.297 227.131C271.278 226.57 272.103 225.758 272.692 224.75L299.117 179.25C300.286 177.243 300.286 174.765 299.117 172.75H299.125Z",fill:"#62DE61"}),m.jsx("path",{d:"M89.6018 124H150.005L121.692 75.25C120.523 73.2431 118.365 72 116.027 72H63.1763C62.0074 72 60.8876 72.3088 59.9068 72.8694L89.6018 124Z",fill:"url(#orxModalA)"}),m.jsx("path",{d:"M89.6018 124L59.9068 72.8694C58.9259 73.43 58.1005 74.2425 57.512 75.25L0.876625 172.75C-0.292208 174.765 -0.292208 177.235 0.876625 179.25L27.3021 224.75C27.8825 225.758 28.7161 226.57 29.697 227.131L89.5936 124H89.6018Z",fill:"url(#orxModalB)"}),m.jsx("path",{d:"M149.997 124H89.5936L29.697 227.131C30.6778 227.691 31.7976 228 32.9664 228H85.8174C88.155 228 90.3128 226.757 91.4816 224.75L149.997 124Z",fill:"#09AF58"}),m.jsx("path",{d:"M299.125 179.25C299.706 178.243 300 177.121 300 176H240.61L210.915 227.131C211.896 227.691 213.016 228 214.185 228H267.036C269.373 228 271.531 226.757 272.7 224.75L299.125 179.25Z",fill:"#09AF58"}),m.jsx("path",{d:"M183.975 72C182.806 72 181.686 72.3088 180.705 72.8694L240.602 176H299.992C299.992 174.879 299.698 173.758 299.117 172.75L242.49 75.25C241.321 73.2431 239.163 72 236.826 72H183.967H183.975Z",fill:"url(#orxModalC)"}),m.jsx("path",{d:"M210.907 227.131L240.602 176L180.705 72.8694C179.725 73.43 178.899 74.2425 178.311 75.25L149.997 124L208.512 224.75C209.093 225.758 209.926 226.57 210.907 227.131Z",fill:"url(#orxModalD)"}),m.jsxs("defs",{children:[m.jsxs("linearGradient",{id:"orxModalA",x1:"127.348",y1:"137",x2:"82.9561",y2:"59.6398",gradientUnits:"userSpaceOnUse",children:[m.jsx("stop",{stopColor:"#BFF9B4"}),m.jsx("stop",{offset:"1",stopColor:"#80EE64"})]}),m.jsxs("linearGradient",{id:"orxModalB",x1:"7.04774",y1:"214.131",x2:"81.1284",y2:"85.0556",gradientUnits:"userSpaceOnUse",children:[m.jsx("stop",{stopColor:"#80EE64"}),m.jsx("stop",{offset:"0.18",stopColor:"#7BEB63"}),m.jsx("stop",{offset:"0.36",stopColor:"#6FE562"}),m.jsx("stop",{offset:"0.55",stopColor:"#5ADA60"}),m.jsx("stop",{offset:"0.74",stopColor:"#3DCA5D"}),m.jsx("stop",{offset:"0.93",stopColor:"#18B759"}),m.jsx("stop",{offset:"1",stopColor:"#09AF58"})]}),m.jsxs("linearGradient",{id:"orxModalC",x1:"278.103",y1:"188.561",x2:"204.022",y2:"59.4863",gradientUnits:"userSpaceOnUse",children:[m.jsx("stop",{stopColor:"#BFF9B4"}),m.jsx("stop",{offset:"1",stopColor:"#80EE64"})]}),m.jsxs("linearGradient",{id:"orxModalD",x1:"232.804",y1:"214.569",x2:"158.724",y2:"85.4864",gradientUnits:"userSpaceOnUse",children:[m.jsx("stop",{stopColor:"#80EE64"}),m.jsx("stop",{offset:"0.18",stopColor:"#7BEB63"}),m.jsx("stop",{offset:"0.36",stopColor:"#6FE562"}),m.jsx("stop",{offset:"0.55",stopColor:"#5ADA60"}),m.jsx("stop",{offset:"0.74",stopColor:"#3DCA5D"}),m.jsx("stop",{offset:"0.93",stopColor:"#18B759"}),m.jsx("stop",{offset:"1",stopColor:"#09AF58"})]})]})]})}function EL({size:e=16}){return m.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"#326CE5","aria-hidden":"true",children:m.jsx("path",{d:"M10.204 14.35l.007.01-.999 2.413a5.171 5.171 0 0 1-2.075-2.597l2.578-.437.004.005a.44.44 0 0 1 .484.606zm-.833-2.129a.44.44 0 0 0 .173-.756l.002-.011L7.585 9.7a5.143 5.143 0 0 0-.73 3.255l2.514-.725.002-.009zm1.145-1.98a.44.44 0 0 0 .699-.337l.01-.005.15-2.62a5.144 5.144 0 0 0-3.01 1.442l2.147 1.523.004-.002zm.76 2.75l.723.349.722-.347.18-.78-.5-.623h-.804l-.5.623.179.779zm1.5-3.095a.44.44 0 0 0 .7.336l.008.003 2.134-1.513a5.188 5.188 0 0 0-2.992-1.442l.148 2.615.002.001zm10.876 5.97l-5.773 7.181a1.6 1.6 0 0 1-1.248.594l-9.261.003a1.6 1.6 0 0 1-1.247-.596l-5.776-7.18a1.583 1.583 0 0 1-.307-1.34L2.1 5.573c.108-.47.425-.864.863-1.073L11.305.513a1.606 1.606 0 0 1 1.385 0l8.345 3.985c.438.209.755.604.863 1.073l2.062 8.955c.108.47-.005.963-.308 1.34zm-3.289-2.057c-.042-.01-.103-.026-.145-.034-.174-.033-.315-.025-.479-.038-.35-.037-.638-.067-.895-.148-.105-.04-.18-.165-.216-.216l-.201-.059a6.45 6.45 0 0 0-.105-2.332 6.465 6.465 0 0 0-.936-2.163c.052-.047.15-.133.177-.159.008-.09.001-.183.094-.282.197-.185.444-.338.743-.522.142-.084.273-.137.415-.242.032-.024.076-.062.11-.089.24-.191.295-.52.123-.736-.172-.216-.506-.236-.745-.045-.034.027-.08.062-.111.088-.134.116-.217.23-.33.35-.246.25-.45.458-.673.609-.097.056-.239.037-.303.033l-.19.135a6.545 6.545 0 0 0-4.146-2.003l-.012-.223c-.065-.062-.143-.115-.163-.25-.022-.268.015-.557.057-.905.023-.163.061-.298.068-.475.001-.04-.001-.099-.001-.142 0-.306-.224-.555-.5-.555-.275 0-.499.249-.499.555l.001.014c0 .041-.002.092 0 .128.006.177.044.312.067.475.042.348.078.637.056.906a.545.545 0 0 1-.162.258l-.012.211a6.424 6.424 0 0 0-4.166 2.003 8.373 8.373 0 0 1-.18-.128c-.09.012-.18.04-.297-.029-.223-.15-.427-.358-.673-.608-.113-.12-.195-.234-.329-.349-.03-.026-.077-.062-.111-.088a.594.594 0 0 0-.348-.132.481.481 0 0 0-.398.176c-.172.216-.117.546.123.737l.007.005.104.083c.142.105.272.159.414.242.299.185.546.338.743.522.076.082.09.226.1.288l.16.143a6.462 6.462 0 0 0-1.02 4.506l-.208.06c-.055.072-.133.184-.215.217-.257.081-.546.11-.895.147-.164.014-.305.006-.48.039-.037.007-.09.02-.133.03l-.004.002-.007.002c-.295.071-.484.342-.423.608.061.267.349.429.645.365l.007-.001.01-.003.129-.029c.17-.046.294-.113.448-.172.33-.118.604-.217.87-.256.112-.009.23.069.288.101l.217-.037a6.5 6.5 0 0 0 2.88 3.596l-.09.218c.033.084.069.199.044.282-.097.252-.263.517-.452.813-.091.136-.185.242-.268.399-.02.037-.045.095-.064.134-.128.275-.034.591.213.71.248.12.556-.007.69-.282v-.002c.02-.039.046-.09.062-.127.07-.162.094-.301.144-.458.132-.332.205-.68.387-.897.05-.06.13-.082.215-.105l.113-.205a6.453 6.453 0 0 0 4.609.012l.106.192c.086.028.18.042.256.155.136.232.229.507.342.84.05.156.074.295.145.457.016.037.043.09.062.129.133.276.442.402.69.282.247-.118.341-.435.213-.71-.02-.039-.045-.096-.065-.134-.083-.156-.177-.261-.268-.398-.19-.296-.346-.541-.443-.793-.04-.13.007-.21.038-.294-.018-.022-.059-.144-.083-.202a6.499 6.499 0 0 0 2.88-3.622c.064.01.176.03.213.038.075-.05.144-.114.28-.104.266.039.54.138.87.256.154.06.277.128.448.173.036.01.088.019.13.028l.009.003.007.001c.297.064.584-.098.645-.365.06-.266-.128-.537-.423-.608zM16.4 9.701l-1.95 1.746v.005a.44.44 0 0 0 .173.757l.003.01 2.526.728a5.199 5.199 0 0 0-.108-1.674A5.208 5.208 0 0 0 16.4 9.7zm-4.013 5.325a.437.437 0 0 0-.404-.232.44.44 0 0 0-.372.233h-.002l-1.268 2.292a5.164 5.164 0 0 0 3.326.003l-1.27-2.296h-.01zm1.888-1.293a.44.44 0 0 0-.27.036.44.44 0 0 0-.214.572l-.003.004 1.01 2.438a5.15 5.15 0 0 0 2.081-2.615l-2.6-.44-.004.005z"})})}function kL({kind:e,size:t=16}){switch(e){case"modal_job":return m.jsx(CL,{size:t});case"hf_job":return m.jsx(wL,{size:t});case"k8s_job":return m.jsx(EL,{size:t});case"ssh_job":return m.jsx(Ap,{size:t});case"slurm_job":return m.jsx(wA,{size:t});case"openresearch_job":return m.jsx(DA,{size:t});case"local_job":return m.jsx(nT,{size:t});default:return m.jsx(Ap,{size:t})}}function AL({backend:e}){const t=XS(e),n=KS(e);return t?m.jsxs("span",{className:"backend-badge",children:[m.jsx(kL,{kind:t}),m.jsx("span",{className:"backend-name",children:xL(t)}),n&&m.jsx("span",{className:"backend-detail mono",children:n})]}):m.jsx("span",{className:"backend-badge muted",children:"—"})}const B1={done:{className:"st-done",live:!1},failed:{className:"st-failed",live:!1},running:{className:"st-running",live:!0},starting:{className:"st-starting",live:!0},cancelled:{className:"st-cancelled",live:!1},editing:{className:"st-editing",live:!0},idle:{className:"st-idle",live:!1}};function TL(e){return B1[e]??B1.idle}function Po({status:e,label:t}){const n=TL(e);return m.jsxs("span",{className:`status-badge ${n.className}${n.live?" live":""}`,children:[m.jsx("span",{className:"dot"}),t??e]})}function lp(e){return e.installed&&e.authenticated?{cls:"ok",label:"Connected"}:e.installed?{cls:"warn",label:"Not signed in"}:{cls:"warn",label:"Not installed"}}function NL({h:e}){return e.authMethod?m.jsx(m.Fragment,{children:e.authMethod==="oauth"?"OAuth (subscription login)":"API key"}):m.jsx(m.Fragment,{children:"—"})}function DL(){const[e,t]=V.useState(null),[n,r]=V.useState("claude-code"),[a,l]=V.useState(!1),u=c=>{l(!0),Cg(c).then(t).catch(()=>{}).finally(()=>l(!1))};V.useEffect(()=>u(!1),[]);const o=e==null?void 0:e.find(c=>c.id===n);return m.jsxs(m.Fragment,{children:[m.jsx("h1",{children:"Harnesses"}),m.jsx("p",{className:"settings-sub",children:"Coding-agent setups detected on this machine. The research agent chat is served by OpenCode; Claude Code and Codex accounts surface their models in the composer's model picker."}),m.jsx("div",{className:"harness-tabs",children:(e??[]).map(c=>m.jsxs("button",{className:c.id===n?"active":"",onClick:()=>r(c.id),children:[c.name,m.jsx("span",{className:`harness-dot ${lp(c).cls}`})]},c.id))}),e?o?m.jsxs("div",{className:"settings-card",children:[m.jsxs("div",{className:"settings-card-head",children:[m.jsx("span",{className:`badge ${lp(o).cls}`,children:lp(o).label}),m.jsx("div",{className:"spacer",style:{flex:1}}),m.jsxs("button",{className:"btn sm",onClick:()=>u(!0),disabled:a,children:[m.jsx(yu,{size:12,className:a?"spin":""})," Refresh"]})]}),m.jsxs("div",{className:"kv",children:[m.jsx("span",{className:"k",children:"Binary"}),m.jsx("span",{className:"v",children:o.binPath??"not found on PATH"}),m.jsx("span",{className:"k",children:"Version"}),m.jsx("span",{className:"v",children:o.version??"—"}),m.jsx("span",{className:"k",children:"Auth"}),m.jsx("span",{className:"v",children:m.jsx(NL,{h:o})}),o.account&&m.jsxs(m.Fragment,{children:[m.jsx("span",{className:"k",children:o.id==="opencode"?"Providers":"Account"}),m.jsx("span",{className:"v",children:o.account})]}),o.org&&m.jsxs(m.Fragment,{children:[m.jsx("span",{className:"k",children:"Org"}),m.jsx("span",{className:"v",children:o.org})]}),o.plan&&m.jsxs(m.Fragment,{children:[m.jsx("span",{className:"k",children:"Plan"}),m.jsx("span",{className:"v",children:o.plan})]}),m.jsx("span",{className:"k",children:"Agent models"}),m.jsx("span",{className:"v",children:o.models.length>0?`${o.models.length} available — ${o.models.slice(0,4).map(c=>bu(c.id)).join(", ")}${o.models.length>4?", …":""}`:"none"})]}),!o.agentReady&&o.agentNote&&m.jsx("p",{className:"settings-note",children:o.agentNote})]}):null:m.jsxs("div",{className:"settings-loading",children:[m.jsx("span",{className:"spinner"})," Detecting harnesses…"]})]})}function RL({s:e}){if(!e.configured)return m.jsx("span",{className:"badge",children:"not configured"});const t=e.preflight;return t.kubectlFound?t.reachable?t.canCreateJobs?m.jsx("span",{className:"badge ok",children:"connected"}):m.jsx("span",{className:"badge err",children:"no job-create permission"}):m.jsx("span",{className:"badge err",children:"cluster unreachable"}):m.jsx("span",{className:"badge err",children:"kubectl not found"})}function ML(){const[e,t]=V.useState(null),[n,r]=V.useState(null),[a,l]=V.useState(""),[u,o]=V.useState(""),[c,f]=V.useState(!1),[p,d]=V.useState(null),_=C=>{t(C),l(C.context??""),o(C.namespace)};V.useEffect(()=>{zT().then(_).catch(C=>r(C instanceof Error?C.message:String(C)))},[]);const v=e!==null&&a===(e.context??"")&&u.trim()===e.namespace;async function w(C){if(C.preventDefault(),!c){f(!0),d(null);try{_(await HT({context:a,namespace:u.trim()}))}catch(b){d(b instanceof Error?b.message:String(b))}finally{f(!1)}}}return m.jsxs(m.Fragment,{children:[m.jsxs("p",{className:"settings-sub",children:[m.jsx("strong",{children:"Kubernetes"})," — run on your own cluster with ",m.jsx("code",{children:"--backend k8s"}),". The run's resources (image, GPUs, topology) come from a manifest committed on the experiment branch (default ",m.jsx("code",{children:".orx/k8s.yaml"}),"); only the cluster context and namespace live here. Auth comes from your kubeconfig."]}),n?m.jsx("div",{className:"settings-card",children:m.jsx("div",{className:"error",children:n})}):e?m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"settings-card",children:[m.jsxs("div",{className:"settings-card-head",children:[m.jsx("h3",{children:"Kubernetes cluster"}),m.jsx("div",{className:"spacer",style:{flex:1}}),m.jsx(RL,{s:e})]}),e.preflight.error&&m.jsx("p",{className:"settings-note",children:e.preflight.error}),m.jsxs("form",{className:"form settings-form",onSubmit:w,children:[m.jsxs("div",{className:"row2",children:[m.jsxs("label",{children:["Context",m.jsxs("select",{value:a,onChange:C=>l(C.target.value),children:[m.jsxs("option",{value:"",children:["kubectl default",e.currentContext?` (${e.currentContext})`:""]}),e.contexts.map(C=>m.jsx("option",{value:C,children:C},C))]})]}),m.jsxs("label",{children:["Namespace",m.jsx("input",{className:"mono",type:"text",value:u,onChange:C=>o(C.target.value),placeholder:"default",autoComplete:"off",spellCheck:!1})]})]}),p&&m.jsx("div",{className:"error",children:p}),m.jsx("div",{className:"actions",children:m.jsx("button",{type:"submit",className:"btn primary",disabled:c||v,children:c?"Saving…":"Save"})})]})]}),m.jsxs("div",{className:"settings-card",children:[m.jsx("div",{className:"settings-card-head",children:m.jsx("h3",{children:"Run manifest"})}),m.jsxs("p",{className:"settings-sub",children:["Each run applies the manifest committed on its experiment branch — default"," ",m.jsx("code",{children:".orx/k8s.yaml"}),", or ",m.jsx("code",{children:"--manifest "}),". It declares whatever the run needs (image, GPU requests, an Indexed Job across nodes, extra Services, …); orx injects the run script as ",m.jsx("code",{children:"$ORX_SCRIPT"}),", the"," ",m.jsx("code",{children:"orx-env"})," Secret, run labels, and a default timeout, and requires exactly one Job (or one labelled ",m.jsx("code",{children:'orx-primary: "true"'}),") whose completion is the run's. Logs follow that Job's leader pod. Use"," ",m.jsx("code",{children:"{{ORX_RUN}}"})," in resource names to keep re-runs collision-free."]})]})]}):m.jsxs("div",{className:"settings-loading",children:[m.jsx("span",{className:"spinner"})," Checking kubectl…"]})]})}const LL={env:"MODAL_TOKEN_ID env var",syncedEnv:"~/.openresearch/env",modalToml:"~/.modal.toml (modal token new)"};function OL({s:e}){return e.ready?m.jsx("span",{className:"badge ok",children:"connected"}):!e.tokenConfigured&&!e.modalImportable?m.jsx("span",{className:"badge",children:"not set up"}):e.modalImportable?e.tokenConfigured?m.jsx("span",{className:"badge",children:"unknown"}):m.jsx("span",{className:"badge err",children:"no token"}):m.jsx("span",{className:"badge err",children:e.envProvisioned?"env broken":"env not built"})}function jL(){const[e,t]=V.useState(null),[n,r]=V.useState(null),[a,l]=V.useState(!1),[u,o]=V.useState(null);V.useEffect(()=>{FT().then(t).catch(f=>r(f instanceof Error?f.message:String(f)))},[]);async function c(){if(!a){l(!0),o(null);try{t(await PT())}catch(f){o(f instanceof Error?f.message:String(f))}finally{l(!1)}}}return m.jsxs("div",{className:"settings-card",children:[m.jsxs("div",{className:"settings-card-head",children:[m.jsx("h3",{children:"Modal"}),m.jsx("div",{className:"spacer",style:{flex:1}}),e&&m.jsx(OL,{s:e})]}),m.jsxs("p",{className:"settings-sub",children:["Serverless GPUs on your own Modal account with"," ",m.jsx("code",{children:"--backend modal --flavor "})," (t4, a10g, a100-80gb, h100, …). orx manages a dedicated Python env with the Modal SDK; sandboxes scale to zero between runs."]}),n?m.jsx("div",{className:"error",children:n}):e?m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"kv",children:[m.jsx("span",{className:"k",children:"Environment"}),m.jsx("span",{className:"v",children:e.modalImportable?"ready":e.envProvisioned?"provisioned (modal import failing)":"not built yet"}),m.jsx("span",{className:"k",children:"Token"}),m.jsx("span",{className:"v",children:e.tokenSource?LL[e.tokenSource]:"not configured"})]}),!e.tokenConfigured&&m.jsxs("p",{className:"settings-note",children:["No Modal token found. Run ",m.jsx("code",{children:"modal token new"}),", or add"," ",m.jsx("code",{children:"MODAL_TOKEN_ID"})," and ",m.jsx("code",{children:"MODAL_TOKEN_SECRET"})," in the Environment tab."]}),e.error&&e.envProvisioned&&!e.modalImportable&&m.jsx("p",{className:"settings-note",children:e.error}),u&&m.jsx("div",{className:"error",children:u}),!e.modalImportable&&m.jsx("div",{className:"actions",children:m.jsx("button",{className:"btn primary",onClick:()=>void c(),disabled:a,children:a?"Setting up… (~30–60s)":"Set up environment"})})]}):m.jsxs("div",{className:"settings-loading",children:[m.jsx("span",{className:"spinner"})," Checking Modal…"]})]})}function BL({test:e}){if(e===void 0)return m.jsx("span",{className:"muted",children:"never tested"});if(e==="testing")return m.jsx("span",{className:"spinner"});const t=e.reachable?e.gitFound?m.jsx("span",{className:"badge ok",children:"ready"}):m.jsx("span",{className:"badge err",children:"no git"}):m.jsx("span",{className:"badge err",title:e.error??void 0,children:"unreachable"});return m.jsxs(m.Fragment,{children:[t,m.jsx("span",{className:"ssh-tested-at",children:ga(e.testedAt)})]})}function IL(){const[e,t]=V.useState(null),[n,r]=V.useState({});V.useEffect(()=>{YT().then(t).catch(()=>t([]))},[]);async function a(l){r(u=>({...u,[l]:"testing"}));try{const u=await WT(l);r(o=>({...o,[l]:u}))}catch(u){r(o=>({...o,[l]:{reachable:!1,gitFound:!1,error:u instanceof Error?u.message:String(u),testedAt:Date.now()}}))}}return m.jsxs("div",{className:"settings-card",children:[m.jsx("h3",{children:"SSH hosts"}),m.jsxs("p",{className:"settings-sub",children:["Run experiments directly on your own boxes with"," ",m.jsx("code",{children:"--backend ssh --host "}),". Hosts come from"," ",m.jsx("code",{children:"~/.ssh/config"}),"; auth uses your keys/agent (orx never reads a key). The host just needs ",m.jsx("code",{children:"git"})," and ",m.jsx("code",{children:"bash"}),"."]}),e===null?m.jsxs("div",{className:"settings-loading",children:[m.jsx("span",{className:"spinner"})," Reading ~/.ssh/config…"]}):e.length===0?m.jsx("p",{className:"settings-empty",children:"No hosts found in ~/.ssh/config."}):m.jsxs("table",{className:"flavor-table ssh-table",children:[m.jsx("thead",{children:m.jsxs("tr",{children:[m.jsx("th",{children:"Host"}),m.jsx("th",{children:"Address"}),m.jsx("th",{children:"Identity"}),m.jsx("th",{children:"Status"}),m.jsx("th",{})]})}),m.jsx("tbody",{children:e.map(l=>m.jsxs("tr",{children:[m.jsx("td",{className:"mono",children:l.host}),m.jsxs("td",{className:"mono muted",children:[[l.user,l.hostname??"—"].filter(Boolean).join("@"),l.port?`:${l.port}`:""]}),m.jsx("td",{className:"mono muted",children:l.identityFile??"—"}),m.jsx("td",{children:m.jsx(BL,{test:n[l.host]??l.lastTest})}),m.jsx("td",{children:m.jsx("button",{className:"btn sm",onClick:()=>void a(l.host),disabled:n[l.host]==="testing",children:"Test"})})]},l.host))})]})]})}function zL({test:e}){return e===null?null:e==="testing"?m.jsx("span",{className:"spinner"}):e.reachable?e.slurmFound?e.gitFound?m.jsx("span",{className:"badge ok",children:"ready"}):m.jsx("span",{className:"badge err",children:"no git"}):m.jsx("span",{className:"badge err",children:"no slurm CLI"}):m.jsx("span",{className:"badge err",title:e.error??void 0,children:"unreachable"})}function HL(){const[e,t]=V.useState(null),[n,r]=V.useState(null),[a,l]=V.useState(""),[u,o]=V.useState(""),[c,f]=V.useState(""),[p,d]=V.useState(""),[_,v]=V.useState(!1),[w,C]=V.useState(null),[b,S]=V.useState(null),x=b!==null&&b!=="testing"?b:null,y=R=>{t(R),l(R.host??""),o(R.partition??""),f(R.account??""),d(R.timeLimit??"")};V.useEffect(()=>{XT().then(y).catch(R=>r(R instanceof Error?R.message:String(R)))},[]);const k=e!==null&&a===(e.host??"")&&u.trim()===(e.partition??"")&&c.trim()===(e.account??"")&&p.trim()===(e.timeLimit??"");async function D(R){if(R.preventDefault(),!_){v(!0),C(null);try{y(await KT({host:a,partition:u.trim(),account:c.trim(),timeLimit:p.trim()}))}catch(N){C(N instanceof Error?N.message:String(N))}finally{v(!1)}}}async function T(R){S("testing");try{S(await ZT(R))}catch(N){S({reachable:!1,slurmFound:!1,gitFound:!1,partitions:[],error:N instanceof Error?N.message:String(N)})}}return m.jsxs(m.Fragment,{children:[m.jsxs("p",{className:"settings-sub",children:[m.jsx("strong",{children:"Slurm"})," — run on your own cluster with"," ",m.jsx("code",{children:"--backend slurm [--flavor h100:2]"}),". orx submits via ",m.jsx("code",{children:"sbatch"})," on the login node over ssh (auth is your keys/agent; orx never reads a key) and the job runs in your cluster environment. The defaults below apply when a launch doesn't override them."]}),n?m.jsx("div",{className:"settings-card",children:m.jsx("div",{className:"error",children:n})}):e?m.jsxs("div",{className:"settings-card",children:[m.jsxs("div",{className:"settings-card-head",children:[m.jsx("h3",{children:"Slurm cluster"}),m.jsx("div",{className:"spacer",style:{flex:1}}),m.jsx(zL,{test:b})]}),(x==null?void 0:x.error)&&m.jsx("p",{className:"settings-note",children:x.error}),x&&x.partitions.length>0&&m.jsxs("p",{className:"settings-note",children:["Partitions: ",m.jsx("code",{children:x.partitions.join(", ")})]}),m.jsxs("form",{className:"form settings-form",onSubmit:D,children:[m.jsxs("div",{className:"row2",children:[m.jsxs("label",{children:["Login node",m.jsxs("select",{value:a,onChange:R=>{l(R.target.value),S(null)},children:[m.jsx("option",{value:"",children:"not set (pass --host per launch)"}),a&&!e.hosts.some(R=>R.host===a)&&m.jsxs("option",{value:a,children:[a," (not in ~/.ssh/config)"]}),e.hosts.map(R=>m.jsx("option",{value:R.host,children:R.host},R.host))]})]}),m.jsxs("label",{children:["Partition",m.jsx("input",{className:"mono",type:"text",list:"slurm-partitions",value:u,onChange:R=>o(R.target.value),placeholder:"cluster default",autoComplete:"off",spellCheck:!1}),m.jsx("datalist",{id:"slurm-partitions",children:x==null?void 0:x.partitions.map(R=>m.jsx("option",{value:R},R))})]})]}),m.jsxs("div",{className:"row2",children:[m.jsxs("label",{children:["Account",m.jsx("input",{className:"mono",type:"text",value:c,onChange:R=>f(R.target.value),placeholder:"cluster default",autoComplete:"off",spellCheck:!1})]}),m.jsxs("label",{children:["Time limit",m.jsx("input",{className:"mono",type:"text",value:p,onChange:R=>d(R.target.value),placeholder:"cluster default (e.g. 4h, 30m)",autoComplete:"off",spellCheck:!1})]})]}),w&&m.jsx("div",{className:"error",children:w}),m.jsxs("div",{className:"actions",children:[m.jsx("button",{type:"submit",className:"btn primary",disabled:_||k,children:_?"Saving…":"Save"}),m.jsx("button",{type:"button",className:"btn",onClick:()=>void T(a),disabled:!a||b==="testing",title:a?void 0:"Pick a login node first",children:"Test connection"})]})]})]}):m.jsxs("div",{className:"settings-loading",children:[m.jsx("span",{className:"spinner"})," Loading slurm settings…"]})]})}const FL=[{id:"hf",label:"HF Jobs"},{id:"modal",label:"Modal"},{id:"k8s",label:"Kubernetes"},{id:"ssh",label:"SSH"},{id:"slurm",label:"Slurm"}];function PL(){const[e,t]=V.useState("hf");return m.jsxs(m.Fragment,{children:[m.jsx("h1",{children:"Compute"}),m.jsxs("p",{className:"settings-sub",children:["Run experiments on external compute with"," ",m.jsx("code",{children:"--backend --flavor "}),"."]}),m.jsx("div",{className:"harness-tabs",children:FL.map(n=>m.jsx("button",{className:n.id===e?"active":"",onClick:()=>t(n.id),children:n.label},n.id))}),e==="hf"&&m.jsx(qL,{}),e==="modal"&&m.jsx(jL,{}),e==="k8s"&&m.jsx(ML,{}),e==="ssh"&&m.jsx(IL,{}),e==="slurm"&&m.jsx(HL,{})]})}const UL={env:"HF_TOKEN env var",openresearchEnv:"~/.openresearch/env",hfCache:"~/.cache/huggingface/token (hf auth login)"};function $L({settings:e}){return e.configured?e.valid?m.jsx("span",{className:"badge ok",children:"connected"}):m.jsx("span",{className:"badge err",children:"invalid token"}):m.jsx("span",{className:"badge",children:"not configured"})}function GL({settings:e}){return!e.configured||!e.valid?null:e.jobsWrite===!0?m.jsx("span",{className:"badge ok",children:"jobs: write OK"}):e.jobsWrite===!1?m.jsx("span",{className:"badge err",children:"no job.write permission"}):m.jsx("span",{className:"badge",children:"jobs permission unknown"})}function qL(){const[e,t]=V.useState(null),[n,r]=V.useState(null),[a,l]=V.useState(""),[u,o]=V.useState(!1),[c,f]=V.useState(null),p=V.useRef(!1);V.useEffect(()=>{BT().then(_=>{p.current||t(_)}).catch(_=>{p.current||r(_ instanceof Error?_.message:String(_))})},[]);async function d(_){if(_.preventDefault(),!(!a.trim()||u)){o(!0),f(null);try{const v=await IT(a.trim());p.current=!0,t(v),r(null),l("")}catch(v){f(v instanceof Error?v.message:String(v))}finally{o(!1)}}}return m.jsxs("div",{className:"settings-card",children:[m.jsxs("div",{className:"settings-card-head",children:[m.jsx("h3",{children:"Hugging Face Jobs"}),m.jsx("div",{className:"spacer",style:{flex:1}}),e&&m.jsx($L,{settings:e})]}),m.jsxs("p",{className:"settings-sub",children:["Run experiments on your Hugging Face account with"," ",m.jsx("code",{children:"--backend hf --flavor "})," (t4-small, a10g-small, a100-large, …). Billed to HF per minute."]}),n?m.jsx("div",{className:"error",children:n}):e?m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"kv",children:[m.jsx("span",{className:"k",children:"Account"}),m.jsx("span",{className:"v",children:e.username??"—"}),m.jsx("span",{className:"k",children:"Token"}),m.jsx("span",{className:"v",children:e.maskedToken??"—"}),m.jsx("span",{className:"k",children:"Source"}),m.jsx("span",{className:"v",children:e.source?UL[e.source]:"not configured"}),m.jsx("span",{className:"k",children:"Jobs"}),m.jsxs("span",{className:"v",children:[m.jsx(GL,{settings:e}),(!e.configured||!e.valid)&&"—"]})]}),e.source==="env"&&m.jsx("p",{className:"settings-note",children:"HF_TOKEN is set in the environment and overrides any token saved here."}),e.valid&&e.jobsWrite===null&&m.jsxs("p",{className:"settings-note",children:["This token is valid but doesn't report whether it can launch Jobs — OAuth tokens from ",m.jsx("code",{children:"hf auth login"})," never do. Launches may still work; for a definitive check, save a write-scoped token from"," ",m.jsx("a",{href:"https://huggingface.co/settings/tokens",target:"_blank",rel:"noreferrer",children:"huggingface.co/settings/tokens"}),"."]})]}):m.jsxs("div",{className:"settings-loading",children:[m.jsx("span",{className:"spinner"})," Loading status…"]}),m.jsxs("form",{className:"form settings-form",onSubmit:d,children:[m.jsxs("label",{children:[e!=null&&e.configured?"Replace token":"New token",m.jsx("input",{type:"password",value:a,onChange:_=>l(_.target.value),placeholder:"hf_…",autoComplete:"off"})]}),c&&m.jsx("div",{className:"error",children:c}),m.jsx("div",{className:"actions",children:m.jsx("button",{type:"submit",className:"btn primary",disabled:!a.trim()||u,children:u?"Validating…":"Save"})})]})]})}const _w=/^hf_[A-Za-z0-9]{10,}$/;function vw(){return m.jsx("tr",{children:m.jsx("td",{colSpan:3,children:m.jsxs("p",{className:"settings-note",children:["This value looks like a Hugging Face token — compute runs only read it from"," ",m.jsx("code",{children:"HF_TOKEN"}),". Save it under that key if it's meant for HF Jobs."]})})})}const I1=["HF_TOKEN","WANDB_API_KEY"];function VL({name:e,entry:t,onVars:n,onError:r}){const[a,l]=V.useState(""),[u,o]=V.useState(!1),c=d=>r(`${e}: ${d instanceof Error?d.message:String(d)}`);async function f(){if(!(!a.trim()||u)){o(!0);try{n(await VS(e,a.trim())),l("")}catch(d){c(d)}finally{o(!1)}}}async function p(){if(!u){o(!0);try{n(await $T(e))}catch(d){c(d)}finally{o(!1)}}}return m.jsxs(m.Fragment,{children:[m.jsxs("tr",{children:[m.jsx("td",{className:"mono",children:e}),m.jsx("td",{className:"mono muted",children:t?m.jsxs(m.Fragment,{children:[t.maskedValue,t.inProcessEnv&&m.jsx("span",{className:"badge",children:"overridden by env"})]}):m.jsx("input",{className:"mono",type:"password",value:a,onChange:d=>l(d.target.value),onKeyDown:d=>{d.key==="Enter"&&(d.preventDefault(),f()),d.key==="Escape"&&!u&&l("")},placeholder:"value","aria-label":`Value for ${e}`,autoComplete:"new-password",disabled:u})}),m.jsx("td",{children:t?m.jsx("button",{className:"icon-btn",title:`Delete ${e}`,"aria-label":`Delete ${e}`,onClick:()=>void p(),disabled:u,children:m.jsx(Uu,{size:13})}):a.trim()&&m.jsx("button",{className:"btn sm",onClick:()=>void f(),disabled:u,children:u?"Saving…":"Save"})})]}),!t&&e!=="HF_TOKEN"&&_w.test(a.trim())&&m.jsx(vw,{})]})}function YL({onVars:e,onError:t,onDone:n}){const[r,a]=V.useState(""),[l,u]=V.useState(""),[o,c]=V.useState(!1);async function f(){if(!(!r.trim()||!l.trim()||o)){c(!0);try{e(await VS(r.trim(),l.trim())),n()}catch(d){t(`${r.trim()}: ${d instanceof Error?d.message:String(d)}`)}finally{c(!1)}}}const p=d=>{d.key==="Enter"&&(d.preventDefault(),f()),d.key==="Escape"&&!o&&n()};return m.jsxs(m.Fragment,{children:[m.jsxs("tr",{children:[m.jsx("td",{children:m.jsx("input",{autoFocus:!0,className:"mono",type:"text",value:r,onChange:d=>a(d.target.value),onKeyDown:p,placeholder:"MY_API_KEY","aria-label":"New variable key",autoComplete:"off",spellCheck:!1,disabled:o})}),m.jsx("td",{children:m.jsx("input",{className:"mono",type:"password",value:l,onChange:d=>u(d.target.value),onKeyDown:p,placeholder:"value","aria-label":"New variable value",autoComplete:"new-password",disabled:o})}),m.jsxs("td",{children:[m.jsx("button",{className:"btn sm",onClick:()=>void f(),disabled:o||!r.trim()||!l.trim(),children:o?"Saving…":"Save"}),m.jsx("button",{className:"icon-btn",title:"Cancel","aria-label":"Cancel new variable",onClick:n,disabled:o,children:m.jsx(jo,{size:13})})]})]}),r.trim()!=="HF_TOKEN"&&_w.test(l.trim())&&m.jsx(vw,{})]})}function WL(){const[e,t]=V.useState(null),[n,r]=V.useState(null),[a,l]=V.useState(!1),[u,o]=V.useState(null);V.useEffect(()=>{UT().then(t).catch(d=>r(d instanceof Error?d.message:String(d)))},[]);const c=d=>{t(d),o(null)},f=e===null?[]:e.map(d=>d.key).filter(d=>!I1.includes(d)),p=[...I1,...f];return m.jsxs("div",{className:"settings-card",children:[m.jsxs("div",{className:"settings-card-head",children:[m.jsx("h3",{children:"Environment variables"}),m.jsx("div",{className:"spacer",style:{flex:1}}),m.jsxs("button",{className:"btn sm",onClick:()=>l(!0),disabled:a||e===null,children:[m.jsx(Sg,{size:12})," Add variable"]})]}),m.jsxs("p",{className:"settings-sub",children:["Stored in ",m.jsx("code",{children:"~/.openresearch/env"})," and passed to runs and the research agent."," ",m.jsx("code",{children:"HF_TOKEN"})," and ",m.jsx("code",{children:"WANDB_API_KEY"})," are always listed since runs typically need them. Variables set in orx's own environment win on conflicts."]}),n?m.jsx("div",{className:"error",children:n}):e===null?m.jsxs("div",{className:"settings-loading",children:[m.jsx("span",{className:"spinner"})," Loading…"]}):m.jsx("table",{className:"env-table",children:m.jsxs("tbody",{children:[p.map(d=>m.jsx(VL,{name:d,entry:e.find(_=>_.key===d),onVars:c,onError:o},d)),a&&m.jsx(YL,{onVars:c,onError:o,onDone:()=>l(!1)})]})}),u&&m.jsx("div",{className:"error",children:u})]})}function XL(){const[e,t]=V.useState(null),[n,r]=V.useState(""),[a,l]=V.useState(""),[u,o]=V.useState(!1),[c,f]=V.useState(null);V.useEffect(()=>{WS().then(_=>{t(_),r(_.userName??""),l(_.userEmail??"")}).catch(()=>{})},[]);const p=e!==null&&n.trim()===(e.userName??"")&&a.trim()===(e.userEmail??"");async function d(_){if(_.preventDefault(),!(u||p)){o(!0),f(null);try{const v=await eN({userName:n.trim(),userEmail:a.trim()});t(v),r(v.userName??""),l(v.userEmail??"")}catch(v){f(v instanceof Error?v.message:String(v))}finally{o(!1)}}}return m.jsxs(m.Fragment,{children:[m.jsx("h1",{children:"Git"}),m.jsx("p",{className:"settings-sub",children:"Experiment branches are committed and pushed from local clones with this identity."}),e?m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"settings-card",children:[m.jsx("h3",{children:"Identity"}),m.jsxs("form",{className:"form",onSubmit:d,children:[m.jsxs("div",{className:"row2",children:[m.jsxs("label",{children:["user.name",m.jsx("input",{type:"text",value:n,onChange:_=>r(_.target.value),autoComplete:"off"})]}),m.jsxs("label",{children:["user.email",m.jsx("input",{type:"text",value:a,onChange:_=>l(_.target.value),autoComplete:"off"})]})]}),c&&m.jsx("div",{className:"error",children:c}),m.jsx("div",{className:"actions",children:m.jsx("button",{type:"submit",className:"btn primary",disabled:u||p||!n.trim()&&!a.trim(),children:u?"Saving…":"Save"})})]})]}),m.jsxs("div",{className:"settings-card",children:[m.jsx("h3",{children:"GitHub access"}),m.jsxs("div",{className:"kv",children:[m.jsx("span",{className:"k",children:"git"}),m.jsx("span",{className:"v",children:e.gitVersion??"not found"}),m.jsx("span",{className:"k",children:"Token"}),m.jsx("span",{className:"v",children:e.githubTokenSource==="env"?"GITHUB_TOKEN env var":e.githubTokenSource==="stored"?"token saved in orx":e.githubTokenSource==="gh"?"gh CLI (gh auth token)":"none found"})]}),!e.githubTokenSource&&m.jsxs(m.Fragment,{children:[m.jsxs("p",{className:"settings-note",children:["No GitHub token found — private repo clones and branch pushes will fail. Run"," ",m.jsx("code",{children:"gh auth login"}),", or paste a personal access token:"]}),m.jsx(mw,{onSaved:t})]}),e.githubTokenSource==="stored"&&m.jsx("div",{className:"actions",children:m.jsx("button",{className:"btn",onClick:()=>{nN().then(t).catch(()=>{})},children:"Remove saved token"})})]})]}):m.jsxs("div",{className:"settings-loading",children:[m.jsx("span",{className:"spinner"})," Loading…"]})]})}function KL({value:e,max:t,label:n}){const r=t>0?Math.min(100,Math.round(e/t*100)):0;return m.jsxs("div",{className:"progress",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,children:[m.jsx("div",{className:"progress-track",children:m.jsx("div",{className:"progress-fill",style:{width:`${r}%`}})}),m.jsxs("div",{className:"progress-caption",children:[m.jsx("span",{children:n??`${r}%`}),t>0&&m.jsxs("span",{className:"mono",children:[Bo(e)," / ",Bo(t)]})]})]})}const ZL={env:"ORX_DATA_DIR environment variable",config:"your saved setting",xdg:"XDG_DATA_HOME",default:"default location"};function QL(){const[e,t]=V.useState(null),[n,r]=V.useState(null),[a,l]=V.useState(""),[u,o]=V.useState(!1),[c,f]=V.useState(null),[p,d]=V.useState({kind:"idle"}),[_,v]=V.useState(null),w=()=>YS().then(k=>{t(k),l(D=>D||k.current)}).catch(k=>r(k instanceof Error?k.message:String(k)));V.useEffect(()=>{w()},[]),V.useEffect(()=>bN(k=>{k.type==="progress"?d(D=>{const T=D.kind==="moving"?D.total:0;return{kind:"moving",phase:k.phase,copied:k.copiedBytes,total:k.totalBytes||T}}):k.type==="done"?(d({kind:"done",oldPathLeft:k.oldPathLeft}),f(null),l(""),w()):k.type==="error"&&d({kind:"error",message:k.error})}),[]);const C=(e==null?void 0:e.source)==="env",b=a.trim(),S=e!==null&&b===e.current;async function x(){if(!(u||!b)){o(!0),v(null),f(null);try{f(await GT(b))}catch(k){v(k instanceof Error?k.message:String(k))}finally{o(!1)}}}async function y(k){if(k.preventDefault(),!(p.kind==="moving"||!b||S)&&(v(null),!!window.confirm(`Move all orx data to: +${b} -The store is copied to the new location and activated there. Active runs or chats will block the move.`))){d({kind:"moving",phase:"preparing",copied:0,total:(c==null?void 0:c.treeBytes)??0});try{await qT(y)}catch(D){d({kind:"idle"}),v(D instanceof Error?D.message:String(D))}}}return m.jsxs(m.Fragment,{children:[m.jsx("h1",{children:"Storage"}),m.jsxs("p",{className:"settings-sub",children:["Where orx keeps everything on this machine — the local database, run logs, artifacts, and chat attachments for ",m.jsx("strong",{children:"all"})," projects. Moving it copies the whole store to the new location and activates it there."]}),n?m.jsx("div",{className:"settings-card",children:m.jsx("div",{className:"error",children:n})}):e?m.jsxs("div",{className:"settings-card",children:[m.jsxs("div",{className:"settings-card-head",children:[m.jsx("h3",{children:"Data directory"}),m.jsx("div",{className:"spacer",style:{flex:1}}),m.jsx("span",{className:"badge",children:e.isDefault?"default":"custom"})]}),m.jsxs("div",{className:"kv",children:[m.jsx("span",{className:"k",children:"Current"}),m.jsx("span",{className:"v mono",children:e.current}),m.jsx("span",{className:"k",children:"Source"}),m.jsx("span",{className:"v",children:KL[e.source]}),!e.isDefault&&m.jsxs(m.Fragment,{children:[m.jsx("span",{className:"k",children:"Default"}),m.jsx("span",{className:"v mono",children:e.defaultPath})]})]}),C?m.jsxs("p",{className:"settings-note",children:["The data directory is pinned by the ",m.jsx("code",{children:"ORX_DATA_DIR"})," environment variable, which overrides this setting. Unset it to choose a location here."]}):m.jsxs("form",{className:"form settings-form",onSubmit:b,children:[m.jsxs("label",{children:["New location",m.jsx("input",{className:"mono",type:"text",value:a,onChange:k=>{l(k.target.value),f(null)},placeholder:"/absolute/path/to/openresearch",autoComplete:"off",spellCheck:!1,disabled:p.kind==="moving"})]}),c&&!c.error&&c.ok&&m.jsxs("p",{className:"settings-note",children:["Ready to move ",Bo(c.treeBytes??0),c.freeBytes!=null&&` — ${Bo(c.freeBytes)} free at target`,c.sameFilesystem?" (same disk, instant)":"","."]}),c&&c.ok===!1&&c.error&&m.jsx("div",{className:"error",children:c.error}),_&&m.jsx("div",{className:"error",children:_}),p.kind==="moving"&&m.jsx(XL,{value:p.copied,max:p.total,label:`${p.phase.charAt(0).toUpperCase()}${p.phase.slice(1)}…`}),p.kind==="done"&&m.jsxs("p",{className:"settings-note",children:["Moved. orx is now using the new location.",p.oldPathLeft&&m.jsxs(m.Fragment,{children:[" ","The old copy was left at ",m.jsx("code",{children:p.oldPathLeft})," (different disk) — you can delete it once you've confirmed everything works."]})]}),p.kind==="error"&&m.jsxs("div",{className:"error",children:["Move failed: ",p.message]}),m.jsxs("div",{className:"actions",children:[m.jsx("button",{type:"button",className:"btn",onClick:x,disabled:u||!y||S||p.kind==="moving",children:u?"Checking…":"Check"}),m.jsx("button",{type:"submit",className:"btn primary",disabled:!y||S||p.kind==="moving",children:p.kind==="moving"?"Moving…":"Move data here"})]})]})]}):m.jsxs("div",{className:"settings-loading",children:[m.jsx("span",{className:"spinner"})," Loading…"]})]})}const Vp=e=>e==="running"||e==="starting";function QL(e){return Vp(e.status)?zy(Date.now()-e.createdAt):e.endedAt?zy(e.endedAt-e.createdAt):"—"}function z1({instances:e,emptyLabel:t}){return e.length===0?m.jsx("p",{className:"instances-empty",children:t}):m.jsx("div",{className:"instances-table-wrap",children:m.jsxs("table",{className:"runs-table",children:[m.jsx("thead",{children:m.jsxs("tr",{children:[m.jsx("th",{children:"Backend"}),m.jsx("th",{children:"Project"}),m.jsx("th",{children:"Status"}),m.jsx("th",{children:"Started"}),m.jsx("th",{children:"Runtime"})]})}),m.jsx("tbody",{children:e.map(n=>{var a;const r=typeof((a=n.backend)==null?void 0:a.url)=="string"?n.backend.url:void 0;return m.jsxs("tr",{children:[m.jsx("td",{children:m.jsxs("span",{className:"backend-cell",children:[m.jsx(kL,{backend:n.backend}),r&&m.jsx("a",{className:"icon-btn",href:r,target:"_blank",rel:"noreferrer",title:"Open job page","aria-label":"Open job page",onClick:l=>l.stopPropagation(),children:m.jsx(nl,{size:12})})]})}),m.jsx("td",{children:n.projectName??Dp(n.projectId)}),m.jsx("td",{children:m.jsx(Po,{status:n.status})}),m.jsx("td",{children:ma(n.createdAt)}),m.jsx("td",{className:"mono",children:QL(n)})]},n.id)})})]})})}function JL(){const[e,t]=V.useState(null),[n,r]=V.useState(null),[a,l]=V.useState(!1),[,u]=V.useState(0);V.useEffect(()=>{const d=setInterval(()=>u(_=>_+1),3e4);return()=>clearInterval(d)},[]);const o=()=>{l(!0),NT().then(d=>{t(d),r(null)}).catch(d=>{r(d instanceof Error?d.message:String(d)),t(_=>_??[])}).finally(()=>l(!1))};V.useEffect(()=>o(),[]);const c=(d,_)=>_.createdAt-d.createdAt,f=e==null?void 0:e.filter(d=>Vp(d.status)).sort(c),p=e==null?void 0:e.filter(d=>!Vp(d.status)).sort(c);return m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"settings-head-row",children:[m.jsx("h1",{children:"Instances"}),m.jsxs("button",{className:"btn sm",onClick:o,disabled:a,children:[m.jsx(bu,{size:12,className:a?"spin":""})," Refresh"]})]}),m.jsx("p",{className:"settings-sub",children:"Compute spun up across all projects — Modal, Hugging Face, SSH, Kubernetes, Slurm, and OpenResearch."}),n&&m.jsx("div",{className:"error",children:n}),!f||!p?m.jsxs("div",{className:"settings-loading",children:[m.jsx("span",{className:"spinner"})," Loading…"]}):m.jsxs(m.Fragment,{children:[m.jsxs("h2",{className:"instances-section-title",children:["Running",f.length>0&&m.jsx("span",{className:"count-badge",children:f.length})]}),m.jsx(z1,{instances:f,emptyLabel:"Nothing running right now."}),m.jsx("h2",{className:"instances-section-title",children:"Past"}),m.jsx(z1,{instances:p,emptyLabel:"No past instances yet."})]})]})}const eO=[{id:"harnesses",label:"Harnesses",icon:m.jsx(bA,{size:15})},{id:"compute",label:"Compute",icon:m.jsx(BA,{size:15})},{id:"instances",label:"Instances",icon:m.jsx(Tp,{size:15})},{id:"environment",label:"Environment",icon:m.jsx(_T,{size:15})},{id:"git",label:"Git",icon:m.jsx(Uu,{size:15})},{id:"storage",label:"Storage",icon:m.jsx(JA,{size:15})}];function tO({tab:e}){return m.jsxs("div",{className:"settings-view",children:[e==="harnesses"&&m.jsx(NL,{}),e==="compute"&&m.jsx(FL,{}),e==="environment"&&m.jsxs(m.Fragment,{children:[m.jsx("h1",{children:"Environment"}),m.jsx("p",{className:"settings-sub",children:"Variables available to runs and the research agent (API keys, tokens)."}),m.jsx(YL,{})]}),e==="instances"&&m.jsx(JL,{}),e==="git"&&m.jsx(WL,{}),e==="storage"&&m.jsx(ZL,{})]})}function nO({skills:e,activeIndex:t,onPick:n,onHover:r}){return m.jsx("div",{className:"skill-menu",children:e.map((a,l)=>m.jsxs("button",{type:"button",className:`skill-item ${l===t?"active":""}`,onMouseDown:u=>{u.preventDefault(),n(a)},onMouseEnter:()=>r(l),children:[m.jsxs("span",{className:"skill-name",children:["/",a.name," ",m.jsx("span",{className:"skill-hint",children:a.argHint})]}),m.jsx("span",{className:"skill-desc",children:a.description})]},a.name))})}const yw={"claude-code":"Claude Code",codex:"Codex",opencode:"OpenCode"};function H1(e){var n,r,a;const t=e.find(l=>l.agentReady);return t?{harness:t.id,model:((n=t.models[0])==null?void 0:n.id)??null,permissionMode:((r=t.options)==null?void 0:r.defaultPermissionMode)??null,reasoningLevel:((a=t.options)==null?void 0:a.defaultReasoningLevel)??null}:null}function th(){const[e,t]=V.useState(!1),n=V.useRef(null);return V.useEffect(()=>{if(!e)return;const r=l=>{var u;(u=n.current)!=null&&u.contains(l.target)||t(!1)},a=l=>{l.key==="Escape"&&(l.preventDefault(),l.stopPropagation(),t(!1))};return document.addEventListener("mousedown",r),document.addEventListener("keydown",a,!0),()=>{document.removeEventListener("mousedown",r),document.removeEventListener("keydown",a,!0)}},[e]),{open:e,setOpen:t,ref:n}}function iO({value:e,onSelect:t,onHarnesses:n,lockHarness:r=!1}){const[a,l]=V.useState([]),{open:u,setOpen:o,ref:c}=th(),[f,p]=V.useState("");V.useEffect(()=>{Cg().then(w=>{l(w),n==null||n(w)}).catch(()=>{})},[]);const d=V.useMemo(()=>{const w=f.trim().toLowerCase();return(r&&e?a.filter(y=>y.id===e.harness):a).map(y=>{let S=y.models;return w?S=S.filter(x=>x.id.toLowerCase().includes(w)):y.id==="opencode"&&(S=S.slice(0,6)),{harness:y,models:S,hidden:w?0:y.models.length-S.length}})},[a,f,r,e]),_=(w,C)=>{var S,x;const y=(e==null?void 0:e.harness)===w.id;t({harness:w.id,model:C,permissionMode:y?e.permissionMode:((S=w.options)==null?void 0:S.defaultPermissionMode)??null,reasoningLevel:y?e.reasoningLevel:((x=w.options)==null?void 0:x.defaultReasoningLevel)??null}),o(!1),p("")},v=e?e.model?Su(e.model):"Default model":"Model";return m.jsxs("div",{className:"model-picker",ref:c,children:[m.jsxs("button",{type:"button",className:"composer-pill",title:"Harness + model for this chat",onClick:()=>o(w=>!w),children:[v,m.jsx(ga,{size:12})]}),u&&m.jsxs("div",{className:"model-menu align-right",children:[m.jsx("input",{autoFocus:!0,type:"text",placeholder:"Search models…",value:f,onChange:w=>p(w.target.value)}),m.jsxs("div",{className:"model-menu-list",children:[d.map(({harness:w,models:C,hidden:y})=>m.jsxs("div",{children:[m.jsx("div",{className:"model-group",children:w.name}),w.agentReady?m.jsxs(m.Fragment,{children:[C.map(S=>m.jsxs("button",{className:"model-item",onClick:()=>_(w,S.id),children:[m.jsxs("span",{children:[Su(S.id),m.jsx("span",{className:"model-id",children:S.id})]}),(e==null?void 0:e.harness)===w.id&&(e==null?void 0:e.model)===S.id&&m.jsx(_n,{size:13})]},S.id)),y>0&&m.jsxs("div",{className:"model-more",children:[y," more — search to find"]})]}):m.jsx("div",{className:"model-more",children:w.agentNote??"Not available"})]},w.id)),a.length===0&&m.jsx("div",{className:"model-more",children:"Detecting harnesses…"})]}),r&&e&&a.length>1&&m.jsxs("div",{className:"model-locked-note",children:[m.jsx(iT,{size:11}),"Sessions keep their harness — new chat to switch"]})]})]})}function F1({choices:e,value:t,defaultId:n,header:r,align:a="left",variant:l="pill",title:u,numbered:o=!1,onSelect:c}){var S,x;const{open:f,setOpen:p,ref:d}=th();if(e.length===0)return null;const _=t??n??((S=e[0])==null?void 0:S.id)??null,v=e.find(b=>b.id===_),w=e.find(b=>b.id===n),C=(v==null?void 0:v.label)??((x=e[0])==null?void 0:x.label)??"",y=b=>{c(b),p(!1)};return m.jsxs("div",{className:"option-picker",ref:d,children:[m.jsxs("button",{type:"button",className:l==="pill"?"composer-pill":"composer-bare",title:u,onClick:()=>p(b=>!b),children:[C,m.jsx(ga,{size:12})]}),f&&m.jsxs("div",{className:`option-menu ${a==="right"?"align-right":""}`,children:[r&&m.jsx("div",{className:"model-group",children:r}),w&&m.jsxs(m.Fragment,{children:[m.jsxs("button",{className:"model-item",onClick:()=>y(w.id),children:[m.jsxs("span",{children:[w.label," ",m.jsx("span",{className:"option-default",children:"· Default"})]}),_===w.id&&m.jsx(_n,{size:13})]}),m.jsx("div",{className:"option-sep"})]}),e.map((b,k)=>m.jsxs("button",{className:"model-item",onClick:()=>y(b.id),children:[m.jsx("span",{children:b.label}),_===b.id?m.jsx(_n,{size:13}):o&&m.jsx("span",{className:"option-num",children:k+1})]},b.id))]})]})}const bw="orx:agent-selection";function rO(){try{const e=localStorage.getItem(bw);return e?JSON.parse(e):null}catch{return null}}const Sw="local-";function sO(e,t){const n=e.findIndex(a=>a.id===t.id);if(n>=0){const a=e.slice();return a[n]=t,a}return[...t.role==="user"?e.filter(a=>!a.id.startsWith(Sw)):e,t]}function aO(e,t){switch(t.type){case"reset":return{messagesBySession:{},busySessions:new Set};case"seed":return{...e,messagesBySession:{...e.messagesBySession,[t.sessionId]:t.messages}};case"upsertMessage":{const n=e.messagesBySession[t.sessionId]??[];return{...e,messagesBySession:{...e.messagesBySession,[t.sessionId]:sO(n,t.message)}}}case"optimisticUser":{const n=e.messagesBySession[t.sessionId]??[],r=t.text?[{id:"p0",type:"text",text:t.text}]:[];t.imageUrls.forEach((l,u)=>r.push({id:`img${u}`,type:"image",text:l}));const a={id:`${Sw}${Date.now()}`,role:"user",parts:r,createdAt:Date.now()};return{...e,messagesBySession:{...e.messagesBySession,[t.sessionId]:[...n,a]}}}case"busy":{const n=new Set(e.busySessions);return t.busy?n.add(t.sessionId):n.delete(t.sessionId),{...e,busySessions:n}}case"seedBusy":return{...e,busySessions:new Set(t.sessions)};case"forget":{const n={...e.messagesBySession};delete n[t.sessionId];const r=new Set(e.busySessions);return r.delete(t.sessionId),{messagesBySession:n,busySessions:r}}}}function oO({harnesses:e,selection:t}){if(e.length===0)return null;const n=t?e.find(r=>r.id===t.harness):void 0;return n?m.jsxs("p",{className:"chat-empty-hint",children:["Chatting with ",n.name,n.account?` as ${n.account}`:""," — detected automatically, switch in the model picker below."]}):m.jsx("p",{className:"chat-empty-hint",children:"No coding agent detected on this machine — install Claude Code, Codex or opencode and sign in, then re-open the model picker below."})}function xw(e){return e==="error"?"tool-status error":e==="completed"?"tool-status":"tool-status running"}function lO(e){if(!e)return"";const t=Math.max(0,Math.floor((Date.now()-e)/1e3));if(t<60)return"now";const n=Math.floor(t/60);if(n<60)return`${n}m`;const r=Math.floor(n/60);return r<24?`${r}h`:`${Math.floor(r/24)}d`}function P1(e){const t=e.replace(/\/+$/,"");return t.slice(t.lastIndexOf("/")+1)||t}function Yp(e){var u,o;const t=e.tool??"tool",n=((u=e.state)==null?void 0:u.input)??{},r=typeof n.command=="string"?n.command:null,a=typeof n.filePath=="string"?n.filePath:null,l=typeof n.description=="string"?n.description:null;switch(t){case"Bash":case"bash":return r?`Ran ${r}`:"Ran command";case"Read":return a?`Read ${P1(a)}`:"Read file";case"Edit":case"Write":case"NotebookEdit":return a?`Edited ${P1(a)}`:"Edited file";case"Grep":return typeof n.pattern=="string"?`Searched “${n.pattern}”`:"Searched";case"Glob":return typeof n.pattern=="string"?`Found ${n.pattern}`:"Listed files";case"WebFetch":case"WebSearch":return l??"Searched the web";case"Task":return l??"Ran a subagent";case"error":return"Error";default:{const c=l??a??r??((o=e.state)==null?void 0:o.title)??"";return c?`${t}: ${c}`:t}}}function cO({part:e,onOpenFile:t}){var o,c;const n=e.state,r=(n==null?void 0:n.error)||(n==null?void 0:n.output)||"",a=typeof((o=n==null?void 0:n.input)==null?void 0:o.command)=="string"?n.input.command:null,l=typeof((c=n==null?void 0:n.input)==null?void 0:c.filePath)=="string"?n.input.filePath:null,u=!!(r||a||l);return m.jsxs("details",{className:"tool-row",open:!1,children:[m.jsxs("summary",{children:[m.jsx("span",{className:xw(n==null?void 0:n.status)}),m.jsx("span",{className:"tool-line",children:Yp(e)}),l&&t&&m.jsx("button",{className:"tool-open file-link",title:`Open ${l}`,onClick:f=>{f.preventDefault(),f.stopPropagation(),t(l)},children:"open"})]}),u&&m.jsxs("div",{className:"tool-detail",children:[a&&m.jsx("div",{className:"tool-cmd-full",children:a}),r&&m.jsx("div",{className:"tool-output",children:r.slice(0,2e4)})]})]})}function uO({parts:e,onOpenFile:t}){const n=e.some(c=>{var f;return((f=c.state)==null?void 0:f.status)==="running"}),r=e.some(c=>{var f;return((f=c.state)==null?void 0:f.status)==="error"}),[a,l]=V.useState(!1),u=a||n,o=e.length===1?Yp(e[0]):n?Yp(e.find(c=>{var f;return((f=c.state)==null?void 0:f.status)==="running"})??e[e.length-1]):`Used ${e.length} tools`;return m.jsxs("div",{className:`tool-group ${r?"has-error":""}`,children:[m.jsxs("button",{className:"tool-group-summary",onClick:()=>l(c=>!c),children:[m.jsx("span",{className:xw(n?"running":r?"error":"completed")}),m.jsx("span",{className:"tool-line",children:o}),m.jsx(Pu,{size:12,className:`tool-chevron ${u?"open":""}`})]}),u&&m.jsx("div",{className:"tool-group-rows",children:e.map(c=>m.jsx(cO,{part:c,onOpenFile:t},c.id))})]})}function hO({part:e,onRespond:t,onOpenFile:n,onOpenPlan:r}){var p,d,_;const a=e.prompt,[l,u]=V.useState([]),o=a.resolved||!t,c=v=>t==null?void 0:t({promptId:e.id,...v});if(a.kind==="plan"){const v=!!r;return m.jsxs("div",{className:`prompt-card plan ${o?"resolved":""}`,children:[m.jsx("div",{className:"prompt-head",children:a.synthesized?"Plan mode — ready to proceed?":"Proposed plan"}),m.jsx("div",{className:`prompt-plan ${v?"clamped":""}`,children:m.jsx(eh,{text:a.plan??"",onOpenFile:n})}),v&&m.jsx("button",{className:"prompt-plan-open",onClick:()=>r(a.plan??"",e.id),children:"View full plan"}),o?m.jsx("div",{className:"prompt-resolved",children:"Resolved"}):!v&&m.jsxs("div",{className:"prompt-actions",children:[m.jsx("button",{className:"btn-primary",onClick:()=>c({approve:!0,resumeMode:"auto"}),children:"Approve & run"}),m.jsx("button",{className:"btn-ghost",onClick:()=>c({approve:!0,resumeMode:"accept-edits"}),children:"Approve & accept edits"}),m.jsx("button",{className:"btn-ghost",onClick:()=>c({approve:!0,resumeMode:"bypass"}),children:"Approve & bypass all"}),m.jsx("button",{className:"btn-ghost",onClick:()=>c({approve:!1}),children:"Keep planning"})]})]})}if(a.kind==="permission"){const v=typeof((p=a.toolInput)==null?void 0:p.command)=="string"&&a.toolInput.command||typeof((d=a.toolInput)==null?void 0:d.filePath)=="string"&&a.toolInput.filePath||"",w=typeof((_=a.toolInput)==null?void 0:_.reason)=="string"&&a.toolInput.reason||"";return m.jsxs("div",{className:`prompt-card permission ${o?"resolved":""}`,children:[m.jsxs("div",{className:"prompt-head",children:["Permission needed: ",m.jsx("code",{children:a.tool})]}),v&&m.jsx("div",{className:"prompt-sub",children:v}),w&&m.jsx("div",{className:"prompt-sub",children:w}),o?m.jsx("div",{className:"prompt-resolved",children:"Resolved"}):m.jsxs("div",{className:"prompt-actions",children:[m.jsx("button",{className:"btn-primary",onClick:()=>c({approve:!0}),children:"Allow"}),m.jsx("button",{className:"btn-ghost",onClick:()=>c({approve:!1}),children:"Deny"})]})]})}const f=v=>u(w=>a.multiSelect?w.includes(v)?w.filter(C=>C!==v):[...w,v]:[v]);return m.jsxs("div",{className:`prompt-card question ${o?"resolved":""}`,children:[a.header&&m.jsx("div",{className:"prompt-head",children:a.header}),a.question&&m.jsx("div",{className:"prompt-q",children:a.question}),m.jsx("div",{className:"prompt-options",children:(a.options??[]).map(v=>{const w=l.includes(v.label);return m.jsxs("button",{className:`prompt-option ${w?"sel":""}`,disabled:o,onClick:()=>o?void 0:a.multiSelect?f(v.label):c({answers:[v.label]}),children:[m.jsx("span",{className:"prompt-option-label",children:v.label}),v.description&&m.jsx("span",{className:"prompt-option-desc",children:v.description})]},v.label)})}),a.multiSelect&&!o&&m.jsx("div",{className:"prompt-actions",children:m.jsx("button",{className:"btn-primary",disabled:l.length===0,onClick:()=>c({answers:l}),children:"Submit"})}),o&&m.jsx("div",{className:"prompt-resolved",children:"Resolved"})]})}function fO({message:e,onOpenFile:t,onRespond:n,onOpenPlan:r}){if(e.role==="user"){const o=e.parts.filter(f=>f.type==="text").map(f=>f.text??"").join(` -`),c=e.parts.filter(f=>f.type==="image"&&f.text).map(f=>f.text.startsWith("data:")?f.text:fN(f.text));return m.jsxs("div",{className:"msg-user",children:[o,c.length>0&&m.jsx("div",{className:"msg-images",children:c.map((f,p)=>m.jsx("a",{href:f,target:"_blank",rel:"noreferrer",children:m.jsx("img",{src:f,alt:"attachment"})},p))})]})}const a=[];let l=[];const u=()=>{l.length!==0&&(a.push(m.jsx(uO,{parts:l,onOpenFile:t},`tg-${l[0].id}`)),l=[])};for(const o of e.parts){if(o.type==="tool"){l.push(o);continue}u(),o.type==="text"&&o.text?a.push(m.jsx(eh,{text:o.text,onOpenFile:t},o.id)):o.type==="reasoning"&&o.text?a.push(m.jsxs("details",{className:"reasoning",children:[m.jsx("summary",{children:"thinking…"}),o.text]},o.id)):o.type==="prompt"&&o.prompt&&a.push(m.jsx(hO,{part:o,onRespond:n,onOpenFile:t,onOpenPlan:r},o.id))}return u(),m.jsx("div",{className:"msg-assistant",children:a})}const ww=[{id:"active",label:"Active",railLabel:"Recents"},{id:"archived",label:"Archived",railLabel:"Archived"},{id:"all",label:"All",railLabel:"All sessions"}];function dO({value:e,onChange:t}){const{open:n,setOpen:r,ref:a}=th();return m.jsxs("div",{className:"rail-filter",ref:a,children:[m.jsx("button",{className:`icon-btn rail-filter-btn ${e!=="active"?"active":""}`,title:"Filter sessions","aria-label":"Filter sessions",onClick:()=>r(l=>!l),children:m.jsx(gT,{size:13})}),n&&m.jsx("div",{className:"option-menu drop-down align-right",children:ww.map(l=>m.jsxs("button",{className:"model-item",onClick:()=>{t(l.id),r(!1)},children:[m.jsx("span",{children:l.label}),e===l.id&&m.jsx(_n,{size:13})]},l.id))})]})}function pO({session:e,active:t,busy:n,onOpen:r,onRename:a,onSetArchived:l,onDelete:u}){var x;const{open:o,setOpen:c,ref:f}=th(),p=((x=e.title)==null?void 0:x.trim())||"Untitled",[d,_]=V.useState(!1),[v,w]=V.useState(""),C=V.useRef(null);function y(){var b;w(((b=e.title)==null?void 0:b.trim())||""),_(!0)}function S(){var k;const b=v.trim();_(!1),b&&b!==(((k=e.title)==null?void 0:k.trim())||"")&&a(b)}return V.useEffect(()=>{var b,k;d&&((b=C.current)==null||b.focus(),(k=C.current)==null||k.select())},[d]),m.jsxs("div",{ref:f,role:"button",tabIndex:0,className:`session-row ${t?"active":""} ${o?"menu-open":""} ${d?"editing":""}`,title:`${yw[e.harness]}${e.model?` · ${e.model}`:""}`,onClick:()=>{d||(o?c(!1):r())},onKeyDown:b=>{b.target===b.currentTarget&&(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),o?c(!1):r())},children:[m.jsx("span",{className:"session-dot",children:n&&m.jsx("span",{className:"busy-dot"})}),d?m.jsx("input",{ref:C,className:"session-title-input","aria-label":"Session title",value:v,onChange:b=>w(b.target.value),onClick:b=>b.stopPropagation(),onBlur:S,onKeyDown:b=>{b.stopPropagation(),b.key==="Enter"?(b.preventDefault(),S()):b.key==="Escape"&&(b.preventDefault(),_(!1))}}):m.jsx("span",{className:"session-title",children:p}),m.jsx("span",{className:"session-time",children:lO(e.updatedAt)}),m.jsx("button",{className:"session-menu-btn",title:"Session options","aria-label":"Session options",onClick:b=>{b.stopPropagation(),c(k=>!k)},children:m.jsx(zA,{size:14})}),o&&m.jsxs("div",{className:"option-menu drop-down session-menu",children:[m.jsx("button",{className:"model-item",onClick:b=>{b.stopPropagation(),c(!1),y()},children:m.jsx("span",{children:"Rename"})}),m.jsx("button",{className:"model-item",onClick:b=>{b.stopPropagation(),c(!1),l(!e.archived)},children:m.jsx("span",{children:e.archived?"Unarchive":"Archive"})}),m.jsx("button",{className:"model-item danger",onClick:b=>{b.stopPropagation(),c(!1),u()},children:m.jsx("span",{children:"Delete"})})]})]})}function gO({projectId:e,paperId:t,railHeader:n,railOpen:r,onShowRail:a,mainView:l,onSelectMainView:u,panelOpen:o,onTogglePanel:c,onOpenFile:f,onOpenPlan:p,onOpenCode:d,children:_}){var Zt,ls,pi;const[v,w]=V.useState([]),[C,y]=V.useState(null),[S,x]=V.useState("active"),[b,k]=V.useState(""),[D,T]=V.useState([]),[R,N]=V.useReducer(aO,{messagesBySession:{},busySessions:new Set}),[M,B]=V.useState([]),[H,Y]=V.useState(rO),[F,z]=V.useState({}),q=V.useRef(new Set),G=V.useRef(new Set),X=V.useRef(null),K=V.useRef(null),O=V.useRef(!0),L=V.useRef(null),[j,$]=V.useState([]),[U,Q]=V.useState(0),[re,ae]=V.useState(!1);V.useEffect(()=>{sN().then($).catch(()=>{})},[]);const Z=b.startsWith("/")&&!/\s/.test(b)?b.slice(1):null,P=Z!==null&&!re?j.filter(ue=>ue.name.startsWith(Z.toLowerCase())):[],te=P.length>0,ie=Math.min(U,Math.max(0,P.length-1));V.useEffect(()=>Q(0),[Z]);function pe(ue){var ke;k(`/${ue.name} `),(ke=L.current)==null||ke.focus()}function he(ue){for(const ke of ue){if(!/^image\/(png|jpeg|gif|webp)$/.test(ke.type))continue;const Ne=new FileReader;Ne.onload=()=>{const et=Ne.result;T(ut=>[...ut,{dataUrl:et,mediaType:ke.type}])},Ne.readAsDataURL(ke)}}function ye(ue){const ke=Array.from(ue.clipboardData.items).filter(Ne=>Ne.kind==="file"&&Ne.type.startsWith("image/")).map(Ne=>Ne.getAsFile()).filter(Ne=>Ne!==null);ke.length>0&&(ue.preventDefault(),he(ke))}const we=v.find(ue=>ue.id===C),Ce=we?{harness:we.harness,model:F.model??we.model,permissionMode:F.permissionMode??we.permissionMode,reasoningLevel:F.reasoningLevel??we.reasoningLevel}:H??H1(M),Ae=Ce?M.find(ue=>ue.id===Ce.harness):void 0,xe=Ae==null?void 0:Ae.options,Ye=ue=>{we?z({model:ue.model,permissionMode:ue.permissionMode,reasoningLevel:ue.reasoningLevel}):(Y(ue),localStorage.setItem(bw,JSON.stringify(ue)))},lt=ue=>{Ce&&Ye({...Ce,permissionMode:ue})},dt=ue=>{Ce&&Ye({...Ce,reasoningLevel:ue})};V.useEffect(()=>{w([]),y(null),k(""),T([]),N({type:"reset"}),q.current=new Set,aN(e).then(ue=>{w(ue),y(ke=>{var Ne;return ke??((Ne=ue.find(et=>!et.archived))==null?void 0:Ne.id)??null}),N({type:"seedBusy",sessions:ue.filter(ke=>ke.busy).map(ke=>ke.id)})}).catch(()=>{})},[e]),V.useEffect(()=>{!C||q.current.has(C)||(q.current.add(C),hN(C).then(ue=>N({type:"seed",sessionId:C,messages:ue})).catch(()=>q.current.delete(C)))},[C]),V.useEffect(()=>vN(ue=>{switch(ue.type){case"session":if(ue.session.projectId!==e||G.current.has(ue.session.id))return;w(ke=>{const Ne=ke.findIndex(ut=>ut.id===ue.session.id);if(Ne<0)return[ue.session,...ke];const et=ke.slice();return et[Ne]=ue.session,et});break;case"sessionDeleted":be(ue.sessionId);break;case"message":N({type:"upsertMessage",sessionId:ue.sessionId,message:ue.message});break;case"busy":N({type:"busy",sessionId:ue.sessionId,busy:ue.busy});break}}),[e]);const it=C?R.messagesBySession[C]??[]:[],pt=C?R.busySessions.has(C):!1,rt=we,Ue=V.useMemo(()=>{var ue;for(let ke=it.length-1;ke>=0;ke--)for(const Ne of it[ke].parts)if(Ne.type==="prompt"&&((ue=Ne.prompt)==null?void 0:ue.kind)==="plan"&&!Ne.prompt.resolved)return{promptId:Ne.id,plan:Ne.prompt.plan??"",synthesized:!!Ne.prompt.synthesized};return null},[it]),Je=p&&C?(ue,ke)=>p(ue,C,ke):void 0;V.useEffect(()=>z({}),[C]);const fe=l==="chat"&&(it.length>0||pt);V.useLayoutEffect(()=>{O.current=!0;const ue=X.current;ue&&(ue.scrollTop=ue.scrollHeight)},[C,fe]),V.useLayoutEffect(()=>{const ue=X.current;ue&&O.current&&(ue.scrollTop=ue.scrollHeight)},[it,pt]),V.useEffect(()=>{const ue=X.current,ke=K.current;if(!ue||!ke)return;const Ne=new ResizeObserver(()=>{O.current&&(ue.scrollTop=ue.scrollHeight)});return Ne.observe(ke),Ne.observe(ue),()=>Ne.disconnect()},[fe]);async function ee(){const ue=b.trim(),ke=D;if(!ue&&ke.length===0||pt)return;const Ne=Ce;if(!Ne&&!C)return;k(""),T([]);let et=C;try{if(!et){const nn=await oN(e,Ne.harness,{model:Ne.model,permissionMode:Ne.permissionMode,reasoningLevel:Ne.reasoningLevel});q.current.add(nn.id),w(Cr=>[nn,...Cr]),y(nn.id),et=nn.id}N({type:"optimisticUser",sessionId:et,text:ue,imageUrls:ke.map(nn=>nn.dataUrl)}),N({type:"busy",sessionId:et,busy:!0}),O.current=!0,S==="archived"&&x("active");const ut=Ne?{model:Ne.model,permissionMode:Ne.permissionMode,reasoningLevel:Ne.reasoningLevel}:{};z({});const cs=ke.map(nn=>({mediaType:nn.mediaType,dataBase64:nn.dataUrl.slice(nn.dataUrl.indexOf(",")+1)}));await dN(et,ue,ut,cs.length?cs:void 0)}catch{et&&N({type:"busy",sessionId:et,busy:!1})}}function me(){C&&pN(C)}V.useEffect(()=>{if(!pt||l!=="chat")return;function ue(ke){var Ne;ke.key!=="Escape"||ke.defaultPrevented||(ke.preventDefault(),me(),(Ne=L.current)==null||Ne.focus())}return document.addEventListener("keydown",ue),()=>document.removeEventListener("keydown",ue)},[pt,C,l]);function be(ue){G.current.add(ue),w(ke=>ke.filter(Ne=>Ne.id!==ue)),y(ke=>ke===ue?null:ke),q.current.delete(ue),N({type:"forget",sessionId:ue})}function Ee(ue,ke){const Ne=ue.archived;w(et=>et.map(ut=>ut.id===ue.id?{...ut,archived:ke}:ut)),cN(ue.id,ke).catch(()=>{w(et=>et.map(ut=>ut.id===ue.id?{...ut,archived:Ne}:ut))})}function Be(ue,ke){const Ne=ue.title;w(et=>et.map(ut=>ut.id===ue.id?{...ut,title:ke}:ut)),uN(ue.id,ke).catch(()=>{w(et=>et.map(ut=>ut.id===ue.id?{...ut,title:Ne}:ut))})}async function Ie(ue){var Ne;const ke=((Ne=ue.title)==null?void 0:Ne.trim())||"Untitled";if(window.confirm(`Delete "${ke}"? +The store is copied to the new location and activated there. Active runs or chats will block the move.`))){d({kind:"moving",phase:"preparing",copied:0,total:(c==null?void 0:c.treeBytes)??0});try{await VT(b)}catch(D){d({kind:"idle"}),v(D instanceof Error?D.message:String(D))}}}return m.jsxs(m.Fragment,{children:[m.jsx("h1",{children:"Storage"}),m.jsxs("p",{className:"settings-sub",children:["Where orx keeps everything on this machine — the local database, run logs, artifacts, and chat attachments for ",m.jsx("strong",{children:"all"})," projects. Moving it copies the whole store to the new location and activates it there."]}),n?m.jsx("div",{className:"settings-card",children:m.jsx("div",{className:"error",children:n})}):e?m.jsxs("div",{className:"settings-card",children:[m.jsxs("div",{className:"settings-card-head",children:[m.jsx("h3",{children:"Data directory"}),m.jsx("div",{className:"spacer",style:{flex:1}}),m.jsx("span",{className:"badge",children:e.isDefault?"default":"custom"})]}),m.jsxs("div",{className:"kv",children:[m.jsx("span",{className:"k",children:"Current"}),m.jsx("span",{className:"v mono",children:e.current}),m.jsx("span",{className:"k",children:"Source"}),m.jsx("span",{className:"v",children:ZL[e.source]}),!e.isDefault&&m.jsxs(m.Fragment,{children:[m.jsx("span",{className:"k",children:"Default"}),m.jsx("span",{className:"v mono",children:e.defaultPath})]})]}),C?m.jsxs("p",{className:"settings-note",children:["The data directory is pinned by the ",m.jsx("code",{children:"ORX_DATA_DIR"})," environment variable, which overrides this setting. Unset it to choose a location here."]}):m.jsxs("form",{className:"form settings-form",onSubmit:y,children:[m.jsxs("label",{children:["New location",m.jsx("input",{className:"mono",type:"text",value:a,onChange:k=>{l(k.target.value),f(null)},placeholder:"/absolute/path/to/openresearch",autoComplete:"off",spellCheck:!1,disabled:p.kind==="moving"})]}),c&&!c.error&&c.ok&&m.jsxs("p",{className:"settings-note",children:["Ready to move ",Bo(c.treeBytes??0),c.freeBytes!=null&&` — ${Bo(c.freeBytes)} free at target`,c.sameFilesystem?" (same disk, instant)":"","."]}),c&&c.ok===!1&&c.error&&m.jsx("div",{className:"error",children:c.error}),_&&m.jsx("div",{className:"error",children:_}),p.kind==="moving"&&m.jsx(KL,{value:p.copied,max:p.total,label:`${p.phase.charAt(0).toUpperCase()}${p.phase.slice(1)}…`}),p.kind==="done"&&m.jsxs("p",{className:"settings-note",children:["Moved. orx is now using the new location.",p.oldPathLeft&&m.jsxs(m.Fragment,{children:[" ","The old copy was left at ",m.jsx("code",{children:p.oldPathLeft})," (different disk) — you can delete it once you've confirmed everything works."]})]}),p.kind==="error"&&m.jsxs("div",{className:"error",children:["Move failed: ",p.message]}),m.jsxs("div",{className:"actions",children:[m.jsx("button",{type:"button",className:"btn",onClick:x,disabled:u||!b||S||p.kind==="moving",children:u?"Checking…":"Check"}),m.jsx("button",{type:"submit",className:"btn primary",disabled:!b||S||p.kind==="moving",children:p.kind==="moving"?"Moving…":"Move data here"})]})]})]}):m.jsxs("div",{className:"settings-loading",children:[m.jsx("span",{className:"spinner"})," Loading…"]})]})}const qp=e=>e==="running"||e==="starting";function JL(e){return qp(e.status)?zy(Date.now()-e.createdAt):e.endedAt?zy(e.endedAt-e.createdAt):"—"}function z1({instances:e,emptyLabel:t}){return e.length===0?m.jsx("p",{className:"instances-empty",children:t}):m.jsx("div",{className:"instances-table-wrap",children:m.jsxs("table",{className:"runs-table",children:[m.jsx("thead",{children:m.jsxs("tr",{children:[m.jsx("th",{children:"Backend"}),m.jsx("th",{children:"Project"}),m.jsx("th",{children:"Status"}),m.jsx("th",{children:"Started"}),m.jsx("th",{children:"Runtime"})]})}),m.jsx("tbody",{children:e.map(n=>{var a;const r=typeof((a=n.backend)==null?void 0:a.url)=="string"?n.backend.url:void 0;return m.jsxs("tr",{children:[m.jsx("td",{children:m.jsxs("span",{className:"backend-cell",children:[m.jsx(AL,{backend:n.backend}),r&&m.jsx("a",{className:"icon-btn",href:r,target:"_blank",rel:"noreferrer",title:"Open job page","aria-label":"Open job page",onClick:l=>l.stopPropagation(),children:m.jsx(bg,{size:12})})]})}),m.jsx("td",{children:n.projectName??Np(n.projectId)}),m.jsx("td",{children:m.jsx(Po,{status:n.status})}),m.jsx("td",{children:ga(n.createdAt)}),m.jsx("td",{className:"mono",children:JL(n)})]},n.id)})})]})})}function eO(){const[e,t]=V.useState(null),[n,r]=V.useState(null),[a,l]=V.useState(!1),[,u]=V.useState(0);V.useEffect(()=>{const d=setInterval(()=>u(_=>_+1),3e4);return()=>clearInterval(d)},[]);const o=()=>{l(!0),DT().then(d=>{t(d),r(null)}).catch(d=>{r(d instanceof Error?d.message:String(d)),t(_=>_??[])}).finally(()=>l(!1))};V.useEffect(()=>o(),[]);const c=(d,_)=>_.createdAt-d.createdAt,f=e==null?void 0:e.filter(d=>qp(d.status)).sort(c),p=e==null?void 0:e.filter(d=>!qp(d.status)).sort(c);return m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"settings-head-row",children:[m.jsx("h1",{children:"Instances"}),m.jsxs("button",{className:"btn sm",onClick:o,disabled:a,children:[m.jsx(yu,{size:12,className:a?"spin":""})," Refresh"]})]}),m.jsx("p",{className:"settings-sub",children:"Compute spun up across all projects — Modal, Hugging Face, SSH, Kubernetes, Slurm, and OpenResearch."}),n&&m.jsx("div",{className:"error",children:n}),!f||!p?m.jsxs("div",{className:"settings-loading",children:[m.jsx("span",{className:"spinner"})," Loading…"]}):m.jsxs(m.Fragment,{children:[m.jsxs("h2",{className:"instances-section-title",children:["Running",f.length>0&&m.jsx("span",{className:"count-badge",children:f.length})]}),m.jsx(z1,{instances:f,emptyLabel:"Nothing running right now."}),m.jsx("h2",{className:"instances-section-title",children:"Past"}),m.jsx(z1,{instances:p,emptyLabel:"No past instances yet."})]})]})}const tO=[{id:"harnesses",label:"Harnesses",icon:m.jsx(SA,{size:15})},{id:"compute",label:"Compute",icon:m.jsx(IA,{size:15})},{id:"instances",label:"Instances",icon:m.jsx(Ap,{size:15})},{id:"environment",label:"Environment",icon:m.jsx(vT,{size:15})},{id:"git",label:"Git",icon:m.jsx(Pu,{size:15})},{id:"storage",label:"Storage",icon:m.jsx(eT,{size:15})}];function nO({tab:e}){return m.jsxs("div",{className:"settings-view",children:[e==="harnesses"&&m.jsx(DL,{}),e==="compute"&&m.jsx(PL,{}),e==="environment"&&m.jsxs(m.Fragment,{children:[m.jsx("h1",{children:"Environment"}),m.jsx("p",{className:"settings-sub",children:"Variables available to runs and the research agent (API keys, tokens)."}),m.jsx(WL,{})]}),e==="instances"&&m.jsx(eO,{}),e==="git"&&m.jsx(XL,{}),e==="storage"&&m.jsx(QL,{})]})}function iO({skills:e,activeIndex:t,onPick:n,onHover:r}){return m.jsx("div",{className:"skill-menu",children:e.map((a,l)=>m.jsxs("button",{type:"button",className:`skill-item ${l===t?"active":""}`,onMouseDown:u=>{u.preventDefault(),n(a)},onMouseEnter:()=>r(l),children:[m.jsxs("span",{className:"skill-name",children:["/",a.name," ",m.jsx("span",{className:"skill-hint",children:a.argHint})]}),m.jsx("span",{className:"skill-desc",children:a.description})]},a.name))})}const yw={"claude-code":"Claude Code",codex:"Codex",opencode:"OpenCode"};function H1(e){var n,r,a;const t=e.find(l=>l.agentReady);return t?{harness:t.id,model:((n=t.models[0])==null?void 0:n.id)??null,permissionMode:((r=t.options)==null?void 0:r.defaultPermissionMode)??null,reasoningLevel:((a=t.options)==null?void 0:a.defaultReasoningLevel)??null}:null}function eh(){const[e,t]=V.useState(!1),n=V.useRef(null);return V.useEffect(()=>{if(!e)return;const r=l=>{var u;(u=n.current)!=null&&u.contains(l.target)||t(!1)},a=l=>{l.key==="Escape"&&(l.preventDefault(),l.stopPropagation(),t(!1))};return document.addEventListener("mousedown",r),document.addEventListener("keydown",a,!0),()=>{document.removeEventListener("mousedown",r),document.removeEventListener("keydown",a,!0)}},[e]),{open:e,setOpen:t,ref:n}}function rO({value:e,onSelect:t,onHarnesses:n,lockHarness:r=!1}){const[a,l]=V.useState([]),{open:u,setOpen:o,ref:c}=eh(),[f,p]=V.useState("");V.useEffect(()=>{Cg().then(w=>{l(w),n==null||n(w)}).catch(()=>{})},[]);const d=V.useMemo(()=>{const w=f.trim().toLowerCase();return(r&&e?a.filter(b=>b.id===e.harness):a).map(b=>{let S=b.models;return w?S=S.filter(x=>x.id.toLowerCase().includes(w)):b.id==="opencode"&&(S=S.slice(0,6)),{harness:b,models:S,hidden:w?0:b.models.length-S.length}})},[a,f,r,e]),_=(w,C)=>{var S,x;const b=(e==null?void 0:e.harness)===w.id;t({harness:w.id,model:C,permissionMode:b?e.permissionMode:((S=w.options)==null?void 0:S.defaultPermissionMode)??null,reasoningLevel:b?e.reasoningLevel:((x=w.options)==null?void 0:x.defaultReasoningLevel)??null}),o(!1),p("")},v=e?e.model?bu(e.model):"Default model":"Model";return m.jsxs("div",{className:"model-picker",ref:c,children:[m.jsxs("button",{type:"button",className:"composer-pill",title:"Harness + model for this chat",onClick:()=>o(w=>!w),children:[v,m.jsx(pa,{size:12})]}),u&&m.jsxs("div",{className:"model-menu align-right",children:[m.jsx("input",{autoFocus:!0,type:"text",placeholder:"Search models…",value:f,onChange:w=>p(w.target.value)}),m.jsxs("div",{className:"model-menu-list",children:[d.map(({harness:w,models:C,hidden:b})=>m.jsxs("div",{children:[m.jsx("div",{className:"model-group",children:w.name}),w.agentReady?m.jsxs(m.Fragment,{children:[C.map(S=>m.jsxs("button",{className:"model-item",onClick:()=>_(w,S.id),children:[m.jsxs("span",{children:[bu(S.id),m.jsx("span",{className:"model-id",children:S.id})]}),(e==null?void 0:e.harness)===w.id&&(e==null?void 0:e.model)===S.id&&m.jsx(_n,{size:13})]},S.id)),b>0&&m.jsxs("div",{className:"model-more",children:[b," more — search to find"]})]}):m.jsx("div",{className:"model-more",children:w.agentNote??"Not available"})]},w.id)),a.length===0&&m.jsx("div",{className:"model-more",children:"Detecting harnesses…"})]}),r&&e&&a.length>1&&m.jsxs("div",{className:"model-locked-note",children:[m.jsx(rT,{size:11}),"Sessions keep their harness — new chat to switch"]})]})]})}function F1({choices:e,value:t,defaultId:n,header:r,align:a="left",variant:l="pill",title:u,numbered:o=!1,onSelect:c}){var S,x;const{open:f,setOpen:p,ref:d}=eh();if(e.length===0)return null;const _=t??n??((S=e[0])==null?void 0:S.id)??null,v=e.find(y=>y.id===_),w=e.find(y=>y.id===n),C=(v==null?void 0:v.label)??((x=e[0])==null?void 0:x.label)??"",b=y=>{c(y),p(!1)};return m.jsxs("div",{className:"option-picker",ref:d,children:[m.jsxs("button",{type:"button",className:l==="pill"?"composer-pill":"composer-bare",title:u,onClick:()=>p(y=>!y),children:[C,m.jsx(pa,{size:12})]}),f&&m.jsxs("div",{className:`option-menu ${a==="right"?"align-right":""}`,children:[r&&m.jsx("div",{className:"model-group",children:r}),w&&m.jsxs(m.Fragment,{children:[m.jsxs("button",{className:"model-item",onClick:()=>b(w.id),children:[m.jsxs("span",{children:[w.label," ",m.jsx("span",{className:"option-default",children:"· Default"})]}),_===w.id&&m.jsx(_n,{size:13})]}),m.jsx("div",{className:"option-sep"})]}),e.map((y,k)=>m.jsxs("button",{className:"model-item",onClick:()=>b(y.id),children:[m.jsx("span",{children:y.label}),_===y.id?m.jsx(_n,{size:13}):o&&m.jsx("span",{className:"option-num",children:k+1})]},y.id))]})]})}const bw="orx:agent-selection";function sO(){try{const e=localStorage.getItem(bw);return e?JSON.parse(e):null}catch{return null}}const Sw="local-";function aO(e,t){const n=e.findIndex(a=>a.id===t.id);if(n>=0){const a=e.slice();return a[n]=t,a}return[...t.role==="user"?e.filter(a=>!a.id.startsWith(Sw)):e,t]}function oO(e,t){switch(t.type){case"reset":return{messagesBySession:{},busySessions:new Set};case"seed":return{...e,messagesBySession:{...e.messagesBySession,[t.sessionId]:t.messages}};case"upsertMessage":{const n=e.messagesBySession[t.sessionId]??[];return{...e,messagesBySession:{...e.messagesBySession,[t.sessionId]:aO(n,t.message)}}}case"optimisticUser":{const n=e.messagesBySession[t.sessionId]??[],r=t.text?[{id:"p0",type:"text",text:t.text}]:[];t.imageUrls.forEach((l,u)=>r.push({id:`img${u}`,type:"image",text:l}));const a={id:`${Sw}${Date.now()}`,role:"user",parts:r,createdAt:Date.now()};return{...e,messagesBySession:{...e.messagesBySession,[t.sessionId]:[...n,a]}}}case"busy":{const n=new Set(e.busySessions);return t.busy?n.add(t.sessionId):n.delete(t.sessionId),{...e,busySessions:n}}case"seedBusy":return{...e,busySessions:new Set(t.sessions)};case"forget":{const n={...e.messagesBySession};delete n[t.sessionId];const r=new Set(e.busySessions);return r.delete(t.sessionId),{messagesBySession:n,busySessions:r}}}}function lO({harnesses:e,selection:t}){if(e.length===0)return null;const n=t?e.find(r=>r.id===t.harness):void 0;return n?m.jsxs("p",{className:"chat-empty-hint",children:["Chatting with ",n.name,n.account?` as ${n.account}`:""," — detected automatically, switch in the model picker below."]}):m.jsx("p",{className:"chat-empty-hint",children:"No coding agent detected on this machine — install Claude Code, Codex or opencode and sign in, then re-open the model picker below."})}function xw(e){return e==="error"?"tool-status error":e==="completed"?"tool-status":"tool-status running"}function cO(e){if(!e)return"";const t=Math.max(0,Math.floor((Date.now()-e)/1e3));if(t<60)return"now";const n=Math.floor(t/60);if(n<60)return`${n}m`;const r=Math.floor(n/60);return r<24?`${r}h`:`${Math.floor(r/24)}d`}function P1(e){const t=e.replace(/\/+$/,"");return t.slice(t.lastIndexOf("/")+1)||t}function Vp(e){var u,o;const t=e.tool??"tool",n=((u=e.state)==null?void 0:u.input)??{},r=typeof n.command=="string"?n.command:null,a=typeof n.filePath=="string"?n.filePath:null,l=typeof n.description=="string"?n.description:null;switch(t){case"Bash":case"bash":return r?`Ran ${r}`:"Ran command";case"Read":return a?`Read ${P1(a)}`:"Read file";case"Edit":case"Write":case"NotebookEdit":return a?`Edited ${P1(a)}`:"Edited file";case"Grep":return typeof n.pattern=="string"?`Searched “${n.pattern}”`:"Searched";case"Glob":return typeof n.pattern=="string"?`Found ${n.pattern}`:"Listed files";case"WebFetch":case"WebSearch":return l??"Searched the web";case"Task":return l??"Ran a subagent";case"error":return"Error";default:{const c=l??a??r??((o=e.state)==null?void 0:o.title)??"";return c?`${t}: ${c}`:t}}}function uO({part:e,onOpenFile:t}){var o,c;const n=e.state,r=(n==null?void 0:n.error)||(n==null?void 0:n.output)||"",a=typeof((o=n==null?void 0:n.input)==null?void 0:o.command)=="string"?n.input.command:null,l=typeof((c=n==null?void 0:n.input)==null?void 0:c.filePath)=="string"?n.input.filePath:null,u=!!(r||a||l);return m.jsxs("details",{className:"tool-row",open:!1,children:[m.jsxs("summary",{children:[m.jsx("span",{className:xw(n==null?void 0:n.status)}),m.jsx("span",{className:"tool-line",children:Vp(e)}),l&&t&&m.jsx("button",{className:"tool-open file-link",title:`Open ${l}`,onClick:f=>{f.preventDefault(),f.stopPropagation(),t(l)},children:"open"})]}),u&&m.jsxs("div",{className:"tool-detail",children:[a&&m.jsx("div",{className:"tool-cmd-full",children:a}),r&&m.jsx("div",{className:"tool-output",children:r.slice(0,2e4)})]})]})}function hO({parts:e,onOpenFile:t}){const n=e.some(c=>{var f;return((f=c.state)==null?void 0:f.status)==="running"}),r=e.some(c=>{var f;return((f=c.state)==null?void 0:f.status)==="error"}),[a,l]=V.useState(!1),u=a||n,o=e.length===1?Vp(e[0]):n?Vp(e.find(c=>{var f;return((f=c.state)==null?void 0:f.status)==="running"})??e[e.length-1]):`Used ${e.length} tools`;return m.jsxs("div",{className:`tool-group ${r?"has-error":""}`,children:[m.jsxs("button",{className:"tool-group-summary",onClick:()=>l(c=>!c),children:[m.jsx("span",{className:xw(n?"running":r?"error":"completed")}),m.jsx("span",{className:"tool-line",children:o}),m.jsx(Fu,{size:12,className:`tool-chevron ${u?"open":""}`})]}),u&&m.jsx("div",{className:"tool-group-rows",children:e.map(c=>m.jsx(uO,{part:c,onOpenFile:t},c.id))})]})}function fO({part:e,onRespond:t,onOpenFile:n,onOpenPlan:r}){var p,d,_;const a=e.prompt,[l,u]=V.useState([]),o=a.resolved||!t,c=v=>t==null?void 0:t({promptId:e.id,...v});if(a.kind==="plan"){const v=!!r;return m.jsxs("div",{className:`prompt-card plan ${o?"resolved":""}`,children:[m.jsx("div",{className:"prompt-head",children:a.synthesized?"Plan mode — ready to proceed?":"Proposed plan"}),m.jsx("div",{className:`prompt-plan ${v?"clamped":""}`,children:m.jsx(Ju,{text:a.plan??"",onOpenFile:n})}),v&&m.jsx("button",{className:"prompt-plan-open",onClick:()=>r(a.plan??"",e.id),children:"View full plan"}),o?m.jsx("div",{className:"prompt-resolved",children:"Resolved"}):!v&&m.jsxs("div",{className:"prompt-actions",children:[m.jsx("button",{className:"btn-primary",onClick:()=>c({approve:!0,resumeMode:"auto"}),children:"Approve & run"}),m.jsx("button",{className:"btn-ghost",onClick:()=>c({approve:!0,resumeMode:"accept-edits"}),children:"Approve & accept edits"}),m.jsx("button",{className:"btn-ghost",onClick:()=>c({approve:!0,resumeMode:"bypass"}),children:"Approve & bypass all"}),m.jsx("button",{className:"btn-ghost",onClick:()=>c({approve:!1}),children:"Keep planning"})]})]})}if(a.kind==="permission"){const v=typeof((p=a.toolInput)==null?void 0:p.command)=="string"&&a.toolInput.command||typeof((d=a.toolInput)==null?void 0:d.filePath)=="string"&&a.toolInput.filePath||"",w=typeof((_=a.toolInput)==null?void 0:_.reason)=="string"&&a.toolInput.reason||"";return m.jsxs("div",{className:`prompt-card permission ${o?"resolved":""}`,children:[m.jsxs("div",{className:"prompt-head",children:["Permission needed: ",m.jsx("code",{children:a.tool})]}),v&&m.jsx("div",{className:"prompt-sub",children:v}),w&&m.jsx("div",{className:"prompt-sub",children:w}),o?m.jsx("div",{className:"prompt-resolved",children:"Resolved"}):m.jsxs("div",{className:"prompt-actions",children:[m.jsx("button",{className:"btn-primary",onClick:()=>c({approve:!0}),children:"Allow"}),m.jsx("button",{className:"btn-ghost",onClick:()=>c({approve:!1}),children:"Deny"})]})]})}const f=v=>u(w=>a.multiSelect?w.includes(v)?w.filter(C=>C!==v):[...w,v]:[v]);return m.jsxs("div",{className:`prompt-card question ${o?"resolved":""}`,children:[a.header&&m.jsx("div",{className:"prompt-head",children:a.header}),a.question&&m.jsx("div",{className:"prompt-q",children:a.question}),m.jsx("div",{className:"prompt-options",children:(a.options??[]).map(v=>{const w=l.includes(v.label);return m.jsxs("button",{className:`prompt-option ${w?"sel":""}`,disabled:o,onClick:()=>o?void 0:a.multiSelect?f(v.label):c({answers:[v.label]}),children:[m.jsx("span",{className:"prompt-option-label",children:v.label}),v.description&&m.jsx("span",{className:"prompt-option-desc",children:v.description})]},v.label)})}),a.multiSelect&&!o&&m.jsx("div",{className:"prompt-actions",children:m.jsx("button",{className:"btn-primary",disabled:l.length===0,onClick:()=>c({answers:l}),children:"Submit"})}),o&&m.jsx("div",{className:"prompt-resolved",children:"Resolved"})]})}function dO({message:e,onOpenFile:t,onRespond:n,onOpenPlan:r}){if(e.role==="user"){const o=e.parts.filter(f=>f.type==="text").map(f=>f.text??"").join(` +`),c=e.parts.filter(f=>f.type==="image"&&f.text).map(f=>f.text.startsWith("data:")?f.text:dN(f.text));return m.jsxs("div",{className:"msg-user",children:[o,c.length>0&&m.jsx("div",{className:"msg-images",children:c.map((f,p)=>m.jsx("a",{href:f,target:"_blank",rel:"noreferrer",children:m.jsx("img",{src:f,alt:"attachment"})},p))})]})}const a=[];let l=[];const u=()=>{l.length!==0&&(a.push(m.jsx(hO,{parts:l,onOpenFile:t},`tg-${l[0].id}`)),l=[])};for(const o of e.parts){if(o.type==="tool"){l.push(o);continue}u(),o.type==="text"&&o.text?a.push(m.jsx(Ju,{text:o.text,onOpenFile:t},o.id)):o.type==="reasoning"&&o.text?a.push(m.jsxs("details",{className:"reasoning",children:[m.jsx("summary",{children:"thinking…"}),o.text]},o.id)):o.type==="prompt"&&o.prompt&&a.push(m.jsx(fO,{part:o,onRespond:n,onOpenFile:t,onOpenPlan:r},o.id))}return u(),m.jsx("div",{className:"msg-assistant",children:a})}const ww=[{id:"active",label:"Active",railLabel:"Recents"},{id:"archived",label:"Archived",railLabel:"Archived"},{id:"all",label:"All",railLabel:"All sessions"}];function pO({value:e,onChange:t}){const{open:n,setOpen:r,ref:a}=eh();return m.jsxs("div",{className:"rail-filter",ref:a,children:[m.jsx("button",{className:`icon-btn rail-filter-btn ${e!=="active"?"active":""}`,title:"Filter sessions","aria-label":"Filter sessions",onClick:()=>r(l=>!l),children:m.jsx(mT,{size:13})}),n&&m.jsx("div",{className:"option-menu drop-down align-right",children:ww.map(l=>m.jsxs("button",{className:"model-item",onClick:()=>{t(l.id),r(!1)},children:[m.jsx("span",{children:l.label}),e===l.id&&m.jsx(_n,{size:13})]},l.id))})]})}function gO({session:e,active:t,busy:n,onOpen:r,onRename:a,onSetArchived:l,onDelete:u}){var x;const{open:o,setOpen:c,ref:f}=eh(),p=((x=e.title)==null?void 0:x.trim())||"Untitled",[d,_]=V.useState(!1),[v,w]=V.useState(""),C=V.useRef(null);function b(){var y;w(((y=e.title)==null?void 0:y.trim())||""),_(!0)}function S(){var k;const y=v.trim();_(!1),y&&y!==(((k=e.title)==null?void 0:k.trim())||"")&&a(y)}return V.useEffect(()=>{var y,k;d&&((y=C.current)==null||y.focus(),(k=C.current)==null||k.select())},[d]),m.jsxs("div",{ref:f,role:"button",tabIndex:0,className:`session-row ${t?"active":""} ${o?"menu-open":""} ${d?"editing":""}`,title:`${yw[e.harness]}${e.model?` · ${e.model}`:""}`,onClick:()=>{d||(o?c(!1):r())},onKeyDown:y=>{y.target===y.currentTarget&&(y.key==="Enter"||y.key===" ")&&(y.preventDefault(),o?c(!1):r())},children:[m.jsx("span",{className:"session-dot",children:n&&m.jsx("span",{className:"busy-dot"})}),d?m.jsx("input",{ref:C,className:"session-title-input","aria-label":"Session title",value:v,onChange:y=>w(y.target.value),onClick:y=>y.stopPropagation(),onBlur:S,onKeyDown:y=>{y.stopPropagation(),y.key==="Enter"?(y.preventDefault(),S()):y.key==="Escape"&&(y.preventDefault(),_(!1))}}):m.jsx("span",{className:"session-title",children:p}),m.jsx("span",{className:"session-time",children:cO(e.updatedAt)}),m.jsx("button",{className:"session-menu-btn",title:"Session options","aria-label":"Session options",onClick:y=>{y.stopPropagation(),c(k=>!k)},children:m.jsx(HA,{size:14})}),o&&m.jsxs("div",{className:"option-menu drop-down session-menu",children:[m.jsx("button",{className:"model-item",onClick:y=>{y.stopPropagation(),c(!1),b()},children:m.jsx("span",{children:"Rename"})}),m.jsx("button",{className:"model-item",onClick:y=>{y.stopPropagation(),c(!1),l(!e.archived)},children:m.jsx("span",{children:e.archived?"Unarchive":"Archive"})}),m.jsx("button",{className:"model-item danger",onClick:y=>{y.stopPropagation(),c(!1),u()},children:m.jsx("span",{children:"Delete"})})]})]})}function mO({projectId:e,paperId:t,railHeader:n,railOpen:r,onShowRail:a,mainView:l,onSelectMainView:u,panelOpen:o,onTogglePanel:c,onOpenFile:f,onOpenPlan:p,children:d}){var yn,Zt,os;const[_,v]=V.useState([]),[w,C]=V.useState(null),[b,S]=V.useState("active"),[x,y]=V.useState(""),[k,D]=V.useState([]),[T,R]=V.useReducer(oO,{messagesBySession:{},busySessions:new Set}),[N,M]=V.useState([]),[B,H]=V.useState(sO),[Y,F]=V.useState({}),z=V.useRef(new Set),q=V.useRef(new Set),G=V.useRef(null),X=V.useRef(null),K=V.useRef(!0),O=V.useRef(null),[L,j]=V.useState([]),[$,U]=V.useState(0),[Q,re]=V.useState(!1);V.useEffect(()=>{aN().then(j).catch(()=>{})},[]);const ae=x.startsWith("/")&&!/\s/.test(x)?x.slice(1):null,Z=ae!==null&&!Q?L.filter(ue=>ue.name.startsWith(ae.toLowerCase())):[],P=Z.length>0,ee=Math.min($,Math.max(0,Z.length-1));V.useEffect(()=>U(0),[ae]);function ie(ue){var ke;y(`/${ue.name} `),(ke=O.current)==null||ke.focus()}function ge(ue){for(const ke of ue){if(!/^image\/(png|jpeg|gif|webp)$/.test(ke.type))continue;const De=new FileReader;De.onload=()=>{const Ge=De.result;D(ut=>[...ut,{dataUrl:Ge,mediaType:ke.type}])},De.readAsDataURL(ke)}}function he(ue){const ke=Array.from(ue.clipboardData.items).filter(De=>De.kind==="file"&&De.type.startsWith("image/")).map(De=>De.getAsFile()).filter(De=>De!==null);ke.length>0&&(ue.preventDefault(),ge(ke))}const ye=_.find(ue=>ue.id===w),Se=ye?{harness:ye.harness,model:Y.model??ye.model,permissionMode:Y.permissionMode??ye.permissionMode,reasoningLevel:Y.reasoningLevel??ye.reasoningLevel}:B??H1(N),Ae=Se?N.find(ue=>ue.id===Se.harness):void 0,Ce=Ae==null?void 0:Ae.options,we=ue=>{ye?F({model:ue.model,permissionMode:ue.permissionMode,reasoningLevel:ue.reasoningLevel}):(H(ue),localStorage.setItem(bw,JSON.stringify(ue)))},at=ue=>{Se&&we({...Se,permissionMode:ue})},ht=ue=>{Se&&we({...Se,reasoningLevel:ue})};V.useEffect(()=>{v([]),C(null),y(""),D([]),R({type:"reset"}),z.current=new Set,oN(e).then(ue=>{v(ue),C(ke=>{var De;return ke??((De=ue.find(Ge=>!Ge.archived))==null?void 0:De.id)??null}),R({type:"seedBusy",sessions:ue.filter(ke=>ke.busy).map(ke=>ke.id)})}).catch(()=>{})},[e]),V.useEffect(()=>{!w||z.current.has(w)||(z.current.add(w),fN(w).then(ue=>R({type:"seed",sessionId:w,messages:ue})).catch(()=>z.current.delete(w)))},[w]),V.useEffect(()=>yN(ue=>{switch(ue.type){case"session":if(ue.session.projectId!==e||q.current.has(ue.session.id))return;v(ke=>{const De=ke.findIndex(ut=>ut.id===ue.session.id);if(De<0)return[ue.session,...ke];const Ge=ke.slice();return Ge[De]=ue.session,Ge});break;case"sessionDeleted":be(ue.sessionId);break;case"message":R({type:"upsertMessage",sessionId:ue.sessionId,message:ue.message});break;case"busy":R({type:"busy",sessionId:ue.sessionId,busy:ue.busy});break}}),[e]);const Ke=w?T.messagesBySession[w]??[]:[],ct=w?T.busySessions.has(w):!1,Rt=ye,Ze=V.useMemo(()=>{var ue;for(let ke=Ke.length-1;ke>=0;ke--)for(const De of Ke[ke].parts)if(De.type==="prompt"&&((ue=De.prompt)==null?void 0:ue.kind)==="plan"&&!De.prompt.resolved)return{promptId:De.id,plan:De.prompt.plan??"",synthesized:!!De.prompt.synthesized};return null},[Ke]),$e=p&&w?(ue,ke)=>p(ue,w,ke):void 0;V.useEffect(()=>F({}),[w]);const de=l==="chat"&&(Ke.length>0||ct);V.useLayoutEffect(()=>{K.current=!0;const ue=G.current;ue&&(ue.scrollTop=ue.scrollHeight)},[w,de]),V.useLayoutEffect(()=>{const ue=G.current;ue&&K.current&&(ue.scrollTop=ue.scrollHeight)},[Ke,ct]),V.useEffect(()=>{const ue=G.current,ke=X.current;if(!ue||!ke)return;const De=new ResizeObserver(()=>{K.current&&(ue.scrollTop=ue.scrollHeight)});return De.observe(ke),De.observe(ue),()=>De.disconnect()},[de]);async function ne(){const ue=x.trim(),ke=k;if(!ue&&ke.length===0||ct)return;const De=Se;if(!De&&!w)return;y(""),D([]);let Ge=w;try{if(!Ge){const sn=await lN(e,De.harness,{model:De.model,permissionMode:De.permissionMode,reasoningLevel:De.reasoningLevel});z.current.add(sn.id),v(ls=>[sn,...ls]),C(sn.id),Ge=sn.id}R({type:"optimisticUser",sessionId:Ge,text:ue,imageUrls:ke.map(sn=>sn.dataUrl)}),R({type:"busy",sessionId:Ge,busy:!0}),K.current=!0,b==="archived"&&S("active");const ut=De?{model:De.model,permissionMode:De.permissionMode,reasoningLevel:De.reasoningLevel}:{};F({});const ti=ke.map(sn=>({mediaType:sn.mediaType,dataBase64:sn.dataUrl.slice(sn.dataUrl.indexOf(",")+1)}));await pN(Ge,ue,ut,ti.length?ti:void 0)}catch{Ge&&R({type:"busy",sessionId:Ge,busy:!1})}}function fe(){w&&gN(w)}V.useEffect(()=>{if(!ct||l!=="chat")return;function ue(ke){var De;ke.key!=="Escape"||ke.defaultPrevented||(ke.preventDefault(),fe(),(De=O.current)==null||De.focus())}return document.addEventListener("keydown",ue),()=>document.removeEventListener("keydown",ue)},[ct,w,l]);function be(ue){q.current.add(ue),v(ke=>ke.filter(De=>De.id!==ue)),C(ke=>ke===ue?null:ke),z.current.delete(ue),R({type:"forget",sessionId:ue})}function Ee(ue,ke){const De=ue.archived;v(Ge=>Ge.map(ut=>ut.id===ue.id?{...ut,archived:ke}:ut)),uN(ue.id,ke).catch(()=>{v(Ge=>Ge.map(ut=>ut.id===ue.id?{...ut,archived:De}:ut))})}function Oe(ue,ke){const De=ue.title;v(Ge=>Ge.map(ut=>ut.id===ue.id?{...ut,title:ke}:ut)),hN(ue.id,ke).catch(()=>{v(Ge=>Ge.map(ut=>ut.id===ue.id?{...ut,title:De}:ut))})}async function Qe(ue){var De;const ke=((De=ue.title)==null?void 0:De.trim())||"Untitled";if(window.confirm(`Delete "${ke}"? -Its transcript is permanently removed.`)){try{await lN(ue.id)}catch(et){window.alert(`Failed to delete "${ke}": ${et instanceof Error?et.message:String(et)}`);return}be(ue.id)}}function Ke(ue){C&&(N({type:"busy",sessionId:C,busy:!0}),gN(C,ue).catch(()=>{C&&N({type:"busy",sessionId:C,busy:!1})}))}const ct=v.filter(ue=>S==="all"?!0:S==="archived"?ue.archived:!ue.archived),Ut=m.jsxs("aside",{className:"session-rail floating-panel",children:[n,m.jsxs("nav",{className:"rail-nav",children:[m.jsxs("button",{className:"rail-nav-item",onClick:()=>{y(null),u("chat")},children:[m.jsx(Sg,{size:15}),"New session"]}),m.jsxs("button",{className:`rail-nav-item ${l==="files"?"active":""}`,onClick:()=>u("files"),children:[m.jsx(zS,{size:15}),"Files"]}),eO.map(ue=>m.jsxs("button",{className:`rail-nav-item ${l===ue.id?"active":""}`,onClick:()=>u(ue.id),children:[ue.icon,ue.label]},ue.id))]}),m.jsxs("div",{className:"rail-body",children:[m.jsxs("div",{className:"rail-section-head",children:[m.jsx("div",{className:"rail-section-label",children:((Zt=ww.find(ue=>ue.id===S))==null?void 0:Zt.railLabel)??"Recents"}),m.jsx(dO,{value:S,onChange:x})]}),ct.map(ue=>m.jsx(pO,{session:ue,active:ue.id===C&&l==="chat",busy:R.busySessions.has(ue.id),onOpen:()=>{y(ue.id),u("chat")},onRename:ke=>Be(ue,ke),onSetArchived:ke=>Ee(ue,ke),onDelete:()=>void Ie(ue)},ue.id)),ct.length===0&&m.jsx("div",{className:"rail-empty",children:S==="archived"?"No archived sessions":v.length>0?"No active sessions":"No sessions yet"})]})]}),st=`chat-header${r?"":" rail-hidden"}`,yn=!r&&m.jsx("button",{className:"icon-btn",title:"Show sidebar","aria-label":"Show sidebar",onClick:a,children:m.jsx(FS,{size:15})});return l!=="chat"?m.jsxs(m.Fragment,{children:[r&&Ut,m.jsxs("section",{className:"chat-pane",children:[!r&&m.jsx("div",{className:st,children:yn}),m.jsx("div",{className:"settings-view-scroll",children:_})]})]}):m.jsxs(m.Fragment,{children:[r&&Ut,m.jsxs("section",{className:"chat-pane",children:[m.jsxs("div",{className:st,children:[yn,m.jsx("div",{className:"title",title:rt?((ls=rt.title)==null?void 0:ls.trim())||"Untitled":"New session",children:rt?((pi=rt.title)==null?void 0:pi.trim())||"Untitled":"New session"}),d&&C&&m.jsx("button",{className:"icon-btn",title:"Code","aria-label":"Code",onClick:()=>d(C),children:m.jsx(HS,{size:15})}),m.jsx("button",{className:`icon-btn ${o?"active":""}`,title:"Experiments","aria-label":"Experiments",onClick:c,children:m.jsx(VA,{size:15})})]}),fe?m.jsx("div",{className:"chat-thread",ref:X,onScroll:ue=>{const ke=ue.currentTarget;O.current=ke.scrollHeight-ke.scrollTop-ke.clientHeight<60},children:m.jsxs("div",{className:"chat-thread-inner",ref:K,children:[it.map(ue=>m.jsx(fO,{message:ue,onOpenFile:f&&(ke=>f(ke,C??void 0)),onRespond:Ke,onOpenPlan:Je},ue.id)),pt&&m.jsxs("div",{className:"working",children:[m.jsx("span",{className:"spinner"})," Working…"]})]})}):m.jsxs("div",{className:"chat-empty",children:[m.jsxs("h2",{children:["Open",m.jsx("span",{children:"Research"})]}),m.jsx("p",{children:"Ask the agent to explore your codebase, create and run your baseline experiment, and branch variants off it."}),m.jsx(oO,{harnesses:M,selection:H??H1(M)}),t&&m.jsxs("button",{type:"button",className:"chat-suggest mono",title:"Prefills the composer — add the compute to run on, then send",onClick:()=>{var ue;k(`/reproduce-paper ${t} on `),(ue=L.current)==null||ue.focus()},children:["/reproduce-paper ",t," on [describe your compute setup]"]})]}),Ue&&m.jsx(bL,{plan:Ue.plan,synthesized:Ue.synthesized,onView:()=>Je==null?void 0:Je(Ue.plan,Ue.promptId),onApprove:ue=>Ke({promptId:Ue.promptId,approve:!0,resumeMode:ue}),onKeepPlanning:()=>{const ue=b.trim();Ke({promptId:Ue.promptId,approve:!1,note:ue||void 0}),ue&&k("")}}),m.jsx("div",{className:"composer",children:m.jsxs("div",{className:"composer-box",children:[te&&m.jsx(nO,{skills:P,activeIndex:ie,onPick:pe,onHover:Q}),D.length>0&&m.jsx("div",{className:"composer-attachments",children:D.map((ue,ke)=>m.jsxs("div",{className:"attachment-thumb",children:[m.jsx("img",{src:ue.dataUrl,alt:"pasted"}),m.jsx("button",{title:"Remove image","aria-label":"Remove image",onClick:()=>T(Ne=>Ne.filter((et,ut)=>ut!==ke)),children:m.jsx(jo,{size:11})})]},ke))}),m.jsx("textarea",{ref:L,value:b,placeholder:Ce?`Message ${yw[Ce.harness]}… ( / for skills)`:"Ask the research agent… ( / for skills)",rows:2,onPaste:ye,onDragOver:ue=>{ue.dataTransfer.types.includes("Files")&&ue.preventDefault()},onDrop:ue=>{ue.dataTransfer.files.length!==0&&(ue.preventDefault(),he(Array.from(ue.dataTransfer.files)))},onChange:ue=>{k(ue.target.value),ae(!1)},onKeyDown:ue=>{if(te){if(ue.key==="ArrowDown"||ue.key==="ArrowUp"){ue.preventDefault();const ke=ue.key==="ArrowDown"?1:-1;Q((ie+ke+P.length)%P.length);return}if(ue.key==="Enter"||ue.key==="Tab"){ue.preventDefault(),pe(P[ie]);return}if(ue.key==="Escape"){ue.preventDefault(),ae(!0);return}}ue.key==="Enter"&&!ue.shiftKey&&(ue.preventDefault(),ee())}}),m.jsxs("div",{className:"composer-actions",children:[m.jsx(F1,{choices:(xe==null?void 0:xe.permissionModes)??[],value:(Ce==null?void 0:Ce.permissionMode)??null,defaultId:(xe==null?void 0:xe.defaultPermissionMode)??null,header:"Mode",align:"left",variant:"pill",numbered:!0,title:"Permission mode for this chat",onSelect:lt}),m.jsx("div",{style:{flex:1}}),m.jsx(iO,{value:Ce,onSelect:Ye,onHarnesses:B,lockHarness:!!we}),m.jsx(F1,{choices:(xe==null?void 0:xe.reasoningLevels)??[],value:(Ce==null?void 0:Ce.reasoningLevel)??null,defaultId:(xe==null?void 0:xe.defaultReasoningLevel)??null,header:"Reasoning",align:"right",variant:"bare",title:"Reasoning level for this chat",onSelect:dt}),pt?m.jsx("button",{className:"send-btn stop",title:"Stop","aria-label":"Stop",onClick:me,children:m.jsx(jo,{size:16})}):m.jsx("button",{className:"send-btn",title:"Send","aria-label":"Send",onClick:()=>void ee(),disabled:!b.trim()&&D.length===0,children:m.jsx(OA,{size:16})})]})]})})]})]})}function U1(){return{dirs:new Map,files:[]}}function mO(e){const t=U1();for(const n of e){const r=n.split("/");let a=t;for(let l=0;ll(n),title:n,children:[c?m.jsx(ga,{size:13,className:"code-tree-chev"}):m.jsx(Pu,{size:13,className:"code-tree-chev"}),c?m.jsx(zS,{size:13}):m.jsx(KA,{size:13}),m.jsx("span",{className:"code-tree-name",children:e})]}),c&&m.jsx(Cw,{node:t,parentPath:n,depth:r+1,toggled:a,onToggle:l,onOpenFile:u})]})}function Cw({node:e,parentPath:t,depth:n,toggled:r,onToggle:a,onOpenFile:l}){const u=[...e.dirs.keys()].sort((c,f)=>c.localeCompare(f)),o=[...e.files].sort((c,f)=>c.localeCompare(f));return m.jsxs(m.Fragment,{children:[u.map(c=>{const f=t?`${t}/${c}`:c;return m.jsx(_O,{name:c,node:e.dirs.get(c),path:f,depth:n,toggled:r,onToggle:a,onOpenFile:l},`d:${f}`)}),o.map(c=>{const f=t?`${t}/${c}`:c;return m.jsxs("button",{type:"button",className:"code-tree-row",style:{paddingLeft:8+n*14},onClick:()=>l(f),title:f,children:[m.jsx(GA,{size:13}),m.jsx("span",{className:"code-tree-name",children:c})]},`f:${f}`)})]})}function vO({projectId:e,sessionId:t,project:n,experiments:r,sel:a,selPicked:l,toggled:u,onSelChange:o,onToggledChange:c,onOpenFile:f}){const[p,d]=V.useState(null),[_,v]=V.useState(null),[w,C]=V.useState(!0),y=V.useRef(0),S=V.useRef(!1),x=V.useRef(o);x.current=o;const b=V.useRef(l);b.current=l;const k=V.useCallback(M=>{const B=++y.current;S.current=!0,M&&C(!0),OT(e,a?{ref:a}:{sessionId:t}).then(H=>{B===y.current&&(d(H),v(null))}).catch(H=>{if(B===y.current){if(a&&!b.current){x.current("",!1);return}M&&v(H.message)}}).finally(()=>{B===y.current&&(S.current=!1,C(!1))})},[e,t,a]);V.useEffect(()=>(d(null),v(null),k(!0),()=>{y.current++}),[k]),V.useEffect(()=>{if(a)return;const M=setInterval(()=>{S.current||k(!1)},5e3);return()=>clearInterval(M)},[a,k]);const D=V.useMemo(()=>p?mO(p.entries):null,[p]),T=V.useCallback(M=>{const B=new Set(u);B.has(M)?B.delete(M):B.add(M),c(B)},[u,c]),R=V.useMemo(()=>{const M=new Set,B=[];for(const H of r)M.has(H.branchName)||(M.add(H.branchName),B.push({branch:H.branchName,label:H.slug}));return B},[r]),N=a||(p==null?void 0:p.branch)||null;return m.jsxs("div",{className:"code-tab",children:[m.jsxs("div",{className:"code-tab-header",children:[m.jsxs("select",{className:"input sm code-tab-select",value:a,onChange:M=>o(M.target.value,!0),title:"Source to browse",children:[m.jsx("option",{value:"",children:"live — session worktree"}),R.map(M=>m.jsx("option",{value:M.branch,children:M.label},M.branch))]}),N&&m.jsx("a",{className:"icon-btn",href:wg(n.githubOwner,n.githubRepo,N),target:"_blank",rel:"noopener noreferrer",title:`Open ${N} on GitHub`,children:m.jsx(nl,{size:13})}),m.jsx("span",{style:{flex:1}}),m.jsx("button",{className:"icon-btn",title:"Refresh","aria-label":"Refresh",onClick:()=>k(!0),children:w?m.jsx("span",{className:"spinner"}):m.jsx(xg,{size:13})})]}),!a&&(p==null?void 0:p.root)==="clone"&&m.jsx("div",{className:"code-tab-note",children:"This session's worktree isn't available — showing the project clone."}),(p==null?void 0:p.truncated)&&m.jsx("div",{className:"code-tab-note",children:"listing truncated"}),_&&D&&m.jsxs("div",{className:"code-tab-note",children:["Refresh failed: ",_]}),m.jsx("div",{className:"code-tab-body",children:D?D.dirs.size===0&&D.files.length===0?m.jsx("div",{className:"code-tab-note",children:"No files."}):m.jsx("div",{className:"code-tree",children:m.jsx(Cw,{node:D,parentPath:"",depth:0,toggled:u,onToggle:T,onOpenFile:M=>f(M,t,a||void 0)})}):m.jsx("div",{className:"code-tab-note",children:_?`Failed to load: ${_}`:"Loading…"})})]})}const yO="project";function bO(e){return/^[a-z][a-z0-9+.-]*:/i.test(e)||e.startsWith("//")}function SO(e){if(!e.startsWith("---"))return e;const t=e.indexOf(` ----`,3);return t===-1?e:e.slice(t+4).replace(/^\r?\n/,"")}const xO=/\.(png|jpe?g|gif|webp|svg)$/i;function Wp(e,t){for(const n of e){if(n.path===t)return n;if(n.isDir&&t.startsWith(n.path+"/")){const r=Wp(n.children??[],t);if(r)return r}}return null}function wO({projectId:e,folder:t,markdown:n}){const r=a=>bO(a)?a:Np(e,`${t}/${a.replace(/^\.?\//,"")}`);return m.jsx("div",{className:"md report-md",children:m.jsx(jx,{remarkPlugins:[sw],components:{a:({href:a,children:l,...u})=>{const o=!a||a.startsWith("#");return m.jsx("a",{...u,href:o?a:r(a),...o?{}:{target:"_blank",rel:"noopener noreferrer"},children:l})},img:({src:a,alt:l})=>{if(!a||typeof a!="string")return null;const u=r(a);return m.jsxs("a",{href:u,target:"_blank",rel:"noopener noreferrer",className:"report-img",children:[m.jsx("img",{src:u,alt:l??"",loading:"lazy"}),l&&m.jsx("span",{className:"report-img-caption",children:l})]})},...gw},children:SO(n)})})}function CO({projectId:e,entry:t,onBack:n,onDelete:r}){const[a,l]=V.useState(null),[u,o]=V.useState(null);return V.useEffect(()=>{ZT(e,t.path).then(c=>l(c.markdown)).catch(c=>o(c instanceof Error?c.message:String(c)))},[e,t.path,t.modifiedAt]),m.jsx("div",{className:"report-view",children:m.jsxs("div",{className:"report-view-col",children:[m.jsxs("div",{className:"report-view-head",children:[m.jsxs("button",{className:"report-back",onClick:n,children:[m.jsx(To,{size:13})," Files"]}),m.jsx("span",{style:{flex:1}}),m.jsx("span",{className:"report-date",children:new Date(t.modifiedAt).toLocaleString()}),m.jsx("button",{className:"icon-btn",title:"Delete report folder","aria-label":"Delete report folder",onClick:()=>{window.confirm(`Delete the "${t.path}" folder from the files dir?`)&&r()},children:m.jsx($u,{size:14})})]}),u?m.jsx("div",{className:"error",children:u}):a===null?m.jsxs("div",{className:"settings-loading",children:[m.jsx("span",{className:"spinner"})," Loading report…"]}):m.jsx(wO,{projectId:e,folder:t.path,markdown:a})]})})}function EO({dir:e}){const[t,n]=V.useState(!1);return m.jsxs("div",{className:"files-pill files-pill-dir",title:e,children:[m.jsx("code",{children:e}),m.jsx("button",{className:"icon-btn",title:"Copy path","aria-label":"Copy files directory path",onClick:()=>{var r;(r=navigator.clipboard)==null||r.writeText(e),n(!0),setTimeout(()=>n(!1),1200)},children:t?m.jsx(_n,{size:13}):m.jsx(bg,{size:13})})]})}function Ew({projectId:e,entries:t,depth:n,expanded:r,onToggle:a,onOpenReport:l,onDelete:u}){return m.jsx(m.Fragment,{children:t.map(o=>{var p;const c={paddingLeft:14+n*22},f=m.jsx("button",{className:"icon-btn ftree-del",title:`Delete ${o.path}`,"aria-label":`Delete ${o.path}`,onClick:d=>{d.stopPropagation(),window.confirm(`Delete "${o.path}" from the files dir?`)&&u(o.path)},children:m.jsx($u,{size:13})});if(o.isDir){const d=o.reportTitle!==void 0,_=r.has(o.path),v=n===0?o.experiment:void 0,w=d&&n>0,C=v?[v.title,v.branchName].filter(Boolean).join(" — "):d&&!w?o.reportTitle:void 0;return m.jsxs("div",{children:[m.jsxs("div",{className:"ftree-row clickable",style:c,title:C,onClick:()=>d?l(o.path):a(o.path),children:[m.jsx("button",{className:`ftree-chevron ${_?"open":""}`,"aria-label":_?`Collapse ${o.name}`:`Expand ${o.name}`,onClick:y=>{y.stopPropagation(),a(o.path)},children:m.jsx(Pu,{size:13})}),w?m.jsx("span",{className:"ftree-title",children:o.reportTitle}):m.jsxs("span",{className:"ftree-dirname",children:[o.name,"/"]}),d&&m.jsx("span",{className:"ftree-tag",children:"report"}),(v==null?void 0:v.latestRunStatus)&&m.jsx("span",{className:"ftree-status",children:v.latestRunStatus}),f,m.jsx("span",{className:"ftree-date",children:new Date(o.modifiedAt).toLocaleDateString()})]}),_&&(((p=o.children)==null?void 0:p.length)??0)>0&&m.jsx("div",{className:"ftree-children",children:m.jsx(Ew,{projectId:e,entries:o.children??[],depth:n+1,expanded:r,onToggle:a,onOpenReport:l,onDelete:u})})]},o.path)}return m.jsxs("div",{className:"ftree-row",style:c,children:[m.jsx("span",{className:"ftree-chevron spacer"}),m.jsxs("a",{className:"ftree-link",href:Np(e,o.path),target:"_blank",rel:"noopener noreferrer",title:o.path,children:[xO.test(o.name)&&m.jsx("img",{className:"ftree-thumb",src:Np(e,o.path),alt:"",loading:"lazy"}),m.jsx("span",{className:"ftree-name",children:o.name})]}),f,m.jsx("span",{className:"ftree-size",children:Bo(o.size)})]},o.path)})})}function kO(e){const t=[],n=[],r=[];for(const a of e)a.isDir&&a.name===yO?t.push(a):a.isDir&&a.experiment?n.push(a):r.push(a);return{project:t,experiments:n,other:r}}function AO({project:e,files:t,onChanged:n,onOpenStorage:r}){const[a,l]=V.useState(null),[u,o]=V.useState(new Set),c=a&&t?Wp(t.entries,a):null;V.useEffect(()=>{var y;a&&t&&!((y=Wp(t.entries,a))!=null&&y.reportTitle)&&l(null)},[a,t]);const f=y=>o(S=>{const x=new Set(S);return x.has(y)?x.delete(y):x.add(y),x}),p=y=>{QT(e.id,y).catch(()=>{}).finally(n)};if(c!=null&&c.reportTitle)return m.jsx(CO,{projectId:e.id,entry:c,onBack:()=>l(null),onDelete:()=>{p(c.path),l(null)}});if(!t)return m.jsx("div",{className:"files-tab",children:m.jsx("div",{className:"files-col",children:m.jsxs("div",{className:"settings-loading",children:[m.jsx("span",{className:"spinner"})," Loading files…"]})})});const{project:d,experiments:_,other:v}=kO(t.entries),w=y=>m.jsx(Ew,{projectId:e.id,entries:y,depth:0,expanded:u,onToggle:f,onOpenReport:l,onDelete:p}),C=`https://github.com/${e.githubOwner}/${e.githubRepo}`;return m.jsx("div",{className:"files-tab",children:m.jsxs("div",{className:"files-col",children:[m.jsxs("div",{className:"files-meta",children:[m.jsxs("a",{className:"files-pill",href:C,target:"_blank",rel:"noopener noreferrer",children:[m.jsxs("code",{children:[e.githubOwner,"/",e.githubRepo]}),m.jsx(nl,{size:12})]}),m.jsx(EO,{dir:t.dir}),m.jsx("button",{type:"button",className:"files-pill files-pill-link",onClick:r,children:"Change storage location →"})]}),m.jsxs("p",{className:"files-hint",children:["An explorer over this folder — the agent writes each experiment's reports and figures into the folder named for its slug (project-wide reports under ",m.jsx("code",{children:"project/"}),"), and you can drop in your own files."]}),t.entries.length===0?m.jsxs("p",{className:"files-empty",children:["Nothing here yet. Ask the agent for a write-up of its findings — it saves each experiment's report folder (",m.jsx("code",{children:"report.md"})," + images) into the folder above."]}):m.jsxs("div",{className:"files-card",children:[w(d),w(_),v.length>0&&(_.length>0||d.length>0)&&m.jsx("div",{className:"ftree-divider",children:"Not linked to an experiment"}),w(v),t.truncated&&m.jsx("p",{className:"files-truncated",children:"Listing truncated — the folder has more files."})]})]})})}function $c({active:e,label:t,icon:n,onSelect:r,onClose:a}){return m.jsxs("button",{className:`tab closable ${e?"active":""}`,onClick:r,title:t,children:[n,m.jsx("span",{className:"tab-label",children:t}),m.jsx("span",{role:"button",className:"tab-close",title:"Close tab",onClick:l=>{l.stopPropagation(),a()},children:m.jsx(jo,{size:12})})]})}function TO({owner:e,repo:t,branch:n}){return m.jsxs("a",{className:"files-pill",href:wg(e,t,n),target:"_blank",rel:"noopener noreferrer",title:`Open ${n} on GitHub`,children:[m.jsx("code",{children:n}),m.jsx(nl,{size:12})]})}function $1(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),n.push.apply(n,r)}return n}function ft(e){for(var t=1;t=0||(p[c]=u[c]);return p})(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function Qe(e,t){return Aw(e)||(function(n,r){var a=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(a!=null){var l,u,o,c,f=[],p=!0,d=!1;try{if(o=(a=a.call(n)).next,r===0){if(Object(a)!==a)return;p=!1}else for(;!(p=(l=o.call(a)).done)&&(f.push(l.value),f.length!==r);p=!0);}catch(_){d=!0,u=_}finally{try{if(!p&&a.return!=null&&(c=a.return(),Object(c)!==c))return}finally{if(d)throw u}}return f}})(e,t)||nh(e,t)||Nw()}function kw(e){return Aw(e)||Tw(e)||nh(e)||Nw()}function Rn(e){return(function(t){if(Array.isArray(t))return Kp(t)})(e)||Tw(e)||nh(e)||(function(){throw new TypeError(`Invalid attempt to spread non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)})()}function Aw(e){if(Array.isArray(e))return e}function Tw(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function nh(e,t){if(e){if(typeof e=="string")return Kp(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Kp(e,t):void 0}}function Kp(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(c){throw c},f:a}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var l,u=!0,o=!1;return{s:function(){n=n.call(e)},n:function(){var c=n.next();return u=c.done,c},e:function(c){o=!0,l=c},f:function(){try{u||n.return==null||n.return()}finally{if(o)throw l}}}}var Gc=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ll(e,t){return e(t={exports:{}},t.exports),t.exports}var Nn=ll((function(e){/*! +Its transcript is permanently removed.`)){try{await cN(ue.id)}catch(Ge){window.alert(`Failed to delete "${ke}": ${Ge instanceof Error?Ge.message:String(Ge)}`);return}be(ue.id)}}function Ie(ue){w&&(R({type:"busy",sessionId:w,busy:!0}),mN(w,ue).catch(()=>{w&&R({type:"busy",sessionId:w,busy:!1})}))}const Tt=_.filter(ue=>b==="all"?!0:b==="archived"?ue.archived:!ue.archived),Et=m.jsxs("aside",{className:"session-rail floating-panel",children:[n,m.jsxs("nav",{className:"rail-nav",children:[m.jsxs("button",{className:"rail-nav-item",onClick:()=>{C(null),u("chat")},children:[m.jsx(Sg,{size:15}),"New session"]}),m.jsxs("button",{className:`rail-nav-item ${l==="files"?"active":""}`,onClick:()=>u("files"),children:[m.jsx(zS,{size:15}),"Files"]}),tO.map(ue=>m.jsxs("button",{className:`rail-nav-item ${l===ue.id?"active":""}`,onClick:()=>u(ue.id),children:[ue.icon,ue.label]},ue.id))]}),m.jsxs("div",{className:"rail-body",children:[m.jsxs("div",{className:"rail-section-head",children:[m.jsx("div",{className:"rail-section-label",children:((yn=ww.find(ue=>ue.id===b))==null?void 0:yn.railLabel)??"Recents"}),m.jsx(pO,{value:b,onChange:S})]}),Tt.map(ue=>m.jsx(gO,{session:ue,active:ue.id===w&&l==="chat",busy:T.busySessions.has(ue.id),onOpen:()=>{C(ue.id),u("chat")},onRename:ke=>Oe(ue,ke),onSetArchived:ke=>Ee(ue,ke),onDelete:()=>void Qe(ue)},ue.id)),Tt.length===0&&m.jsx("div",{className:"rail-empty",children:b==="archived"?"No archived sessions":_.length>0?"No active sessions":"No sessions yet"})]})]}),Ut=`chat-header${r?"":" rail-hidden"}`,it=!r&&m.jsx("button",{className:"icon-btn",title:"Show sidebar","aria-label":"Show sidebar",onClick:a,children:m.jsx(FS,{size:15})});return l!=="chat"?m.jsxs(m.Fragment,{children:[r&&Et,m.jsxs("section",{className:"chat-pane",children:[!r&&m.jsx("div",{className:Ut,children:it}),m.jsx("div",{className:"settings-view-scroll",children:d})]})]}):m.jsxs(m.Fragment,{children:[r&&Et,m.jsxs("section",{className:"chat-pane",children:[m.jsxs("div",{className:Ut,children:[it,m.jsx("div",{className:"title",title:Rt?((Zt=Rt.title)==null?void 0:Zt.trim())||"Untitled":"New session",children:Rt?((os=Rt.title)==null?void 0:os.trim())||"Untitled":"New session"}),m.jsx("button",{className:`icon-btn ${o?"active":""}`,title:"Experiments","aria-label":"Experiments",onClick:c,children:m.jsx(YA,{size:15})})]}),de?m.jsx("div",{className:"chat-thread",ref:G,onScroll:ue=>{const ke=ue.currentTarget;K.current=ke.scrollHeight-ke.scrollTop-ke.clientHeight<60},children:m.jsxs("div",{className:"chat-thread-inner",ref:X,children:[Ke.map(ue=>m.jsx(dO,{message:ue,onOpenFile:f&&(ke=>f(ke,w??void 0)),onRespond:Ie,onOpenPlan:$e},ue.id)),ct&&m.jsxs("div",{className:"working",children:[m.jsx("span",{className:"spinner"})," Working…"]})]})}):m.jsxs("div",{className:"chat-empty",children:[m.jsxs("h2",{children:["Open",m.jsx("span",{children:"Research"})]}),m.jsx("p",{children:"Ask the agent to explore your codebase, create and run your baseline experiment, and branch variants off it."}),m.jsx(lO,{harnesses:N,selection:B??H1(N)}),t&&m.jsxs("button",{type:"button",className:"chat-suggest mono",title:"Prefills the composer — add the compute to run on, then send",onClick:()=>{var ue;y(`/reproduce-paper ${t} on `),(ue=O.current)==null||ue.focus()},children:["/reproduce-paper ",t," on [describe your compute setup]"]})]}),Ze&&m.jsx(SL,{plan:Ze.plan,synthesized:Ze.synthesized,onView:()=>$e==null?void 0:$e(Ze.plan,Ze.promptId),onApprove:ue=>Ie({promptId:Ze.promptId,approve:!0,resumeMode:ue}),onKeepPlanning:()=>{const ue=x.trim();Ie({promptId:Ze.promptId,approve:!1,note:ue||void 0}),ue&&y("")}}),m.jsx("div",{className:"composer",children:m.jsxs("div",{className:"composer-box",children:[P&&m.jsx(iO,{skills:Z,activeIndex:ee,onPick:ie,onHover:U}),k.length>0&&m.jsx("div",{className:"composer-attachments",children:k.map((ue,ke)=>m.jsxs("div",{className:"attachment-thumb",children:[m.jsx("img",{src:ue.dataUrl,alt:"pasted"}),m.jsx("button",{title:"Remove image","aria-label":"Remove image",onClick:()=>D(De=>De.filter((Ge,ut)=>ut!==ke)),children:m.jsx(jo,{size:11})})]},ke))}),m.jsx("textarea",{ref:O,value:x,placeholder:Se?`Message ${yw[Se.harness]}… ( / for skills)`:"Ask the research agent… ( / for skills)",rows:2,onPaste:he,onDragOver:ue=>{ue.dataTransfer.types.includes("Files")&&ue.preventDefault()},onDrop:ue=>{ue.dataTransfer.files.length!==0&&(ue.preventDefault(),ge(Array.from(ue.dataTransfer.files)))},onChange:ue=>{y(ue.target.value),re(!1)},onKeyDown:ue=>{if(P){if(ue.key==="ArrowDown"||ue.key==="ArrowUp"){ue.preventDefault();const ke=ue.key==="ArrowDown"?1:-1;U((ee+ke+Z.length)%Z.length);return}if(ue.key==="Enter"||ue.key==="Tab"){ue.preventDefault(),ie(Z[ee]);return}if(ue.key==="Escape"){ue.preventDefault(),re(!0);return}}ue.key==="Enter"&&!ue.shiftKey&&(ue.preventDefault(),ne())}}),m.jsxs("div",{className:"composer-actions",children:[m.jsx(F1,{choices:(Ce==null?void 0:Ce.permissionModes)??[],value:(Se==null?void 0:Se.permissionMode)??null,defaultId:(Ce==null?void 0:Ce.defaultPermissionMode)??null,header:"Mode",align:"left",variant:"pill",numbered:!0,title:"Permission mode for this chat",onSelect:at}),m.jsx("div",{style:{flex:1}}),m.jsx(rO,{value:Se,onSelect:we,onHarnesses:M,lockHarness:!!ye}),m.jsx(F1,{choices:(Ce==null?void 0:Ce.reasoningLevels)??[],value:(Se==null?void 0:Se.reasoningLevel)??null,defaultId:(Ce==null?void 0:Ce.defaultReasoningLevel)??null,header:"Reasoning",align:"right",variant:"bare",title:"Reasoning level for this chat",onSelect:ht}),ct?m.jsx("button",{className:"send-btn stop",title:"Stop","aria-label":"Stop",onClick:fe,children:m.jsx(jo,{size:16})}):m.jsx("button",{className:"send-btn",title:"Send","aria-label":"Send",onClick:()=>void ne(),disabled:!x.trim()&&k.length===0,children:m.jsx(jA,{size:16})})]})]})})]})]})}function U1(){return{dirs:new Map,files:[]}}function _O(e){const t=U1();for(const n of e){const r=n.split("/");let a=t;for(let l=0;ll(n),title:n,children:[c?m.jsx(pa,{size:13,className:"code-tree-chev"}):m.jsx(Fu,{size:13,className:"code-tree-chev"}),c?m.jsx(zS,{size:13}):m.jsx(ZA,{size:13}),m.jsx("span",{className:"code-tree-name",children:e})]}),c&&m.jsx(Cw,{node:t,parentPath:n,depth:r+1,toggled:a,onToggle:l,onOpenFile:u})]})}function Cw({node:e,parentPath:t,depth:n,toggled:r,onToggle:a,onOpenFile:l}){const u=[...e.dirs.keys()].sort((c,f)=>c.localeCompare(f)),o=[...e.files].sort((c,f)=>c.localeCompare(f));return m.jsxs(m.Fragment,{children:[u.map(c=>{const f=t?`${t}/${c}`:c;return m.jsx(vO,{name:c,node:e.dirs.get(c),path:f,depth:n,toggled:r,onToggle:a,onOpenFile:l},`d:${f}`)}),o.map(c=>{const f=t?`${t}/${c}`:c;return m.jsxs("button",{type:"button",className:"code-tree-row",style:{paddingLeft:8+n*14},onClick:()=>l(f),title:f,children:[m.jsx(qA,{size:13}),m.jsx("span",{className:"code-tree-name",children:c})]},`f:${f}`)})]})}function yO({projectId:e,sessionId:t,project:n,experiments:r,sel:a,selPicked:l,toggled:u,onSelChange:o,onToggledChange:c,onOpenFile:f}){const[p,d]=V.useState(null),[_,v]=V.useState(null),[w,C]=V.useState(!0),b=V.useRef(0),S=V.useRef(!1),x=V.useRef(o);x.current=o;const y=V.useRef(l);y.current=l;const k=V.useCallback(M=>{const B=++b.current;S.current=!0,M&&C(!0),jT(e,a?{ref:a}:{sessionId:t??void 0}).then(H=>{B===b.current&&(d(H),v(null))}).catch(H=>{if(B===b.current){if(a&&!y.current){x.current("",!1);return}M&&v(H.message)}}).finally(()=>{B===b.current&&(S.current=!1,C(!1))})},[e,t,a]);V.useEffect(()=>(d(null),v(null),k(!0),()=>{b.current++}),[k]),V.useEffect(()=>{if(a)return;const M=setInterval(()=>{S.current||k(!1)},5e3);return()=>clearInterval(M)},[a,k]);const D=V.useMemo(()=>p?_O(p.entries):null,[p]),T=V.useCallback(M=>{const B=new Set(u);B.has(M)?B.delete(M):B.add(M),c(B)},[u,c]),R=V.useMemo(()=>{const M=new Set,B=[];for(const H of r)M.has(H.branchName)||(M.add(H.branchName),B.push({branch:H.branchName,label:H.slug}));return B},[r]),N=a||(p==null?void 0:p.branch)||null;return m.jsxs("div",{className:"code-tab",children:[m.jsxs("div",{className:"code-tab-header",children:[m.jsx("span",{className:"ctl-label",children:"Source"}),m.jsxs("select",{className:"input sm code-tab-select",value:a,onChange:M=>o(M.target.value,!0),title:"Source to browse",children:[m.jsx("option",{value:"",children:t?"live — session worktree":"project clone"}),R.map(M=>m.jsx("option",{value:M.branch,children:M.label},M.branch))]}),N&&m.jsx("a",{className:"icon-btn",href:wg(n.githubOwner,n.githubRepo,N),target:"_blank",rel:"noopener noreferrer",title:`Open ${N} on GitHub`,children:m.jsx(bg,{size:13})}),m.jsx("span",{style:{flex:1}}),m.jsx("button",{className:"icon-btn",title:"Refresh","aria-label":"Refresh",onClick:()=>k(!0),children:w?m.jsx("span",{className:"spinner"}):m.jsx(xg,{size:13})})]}),t!==null&&!a&&(p==null?void 0:p.root)==="clone"&&m.jsx("div",{className:"code-tab-note",children:"This session's worktree isn't available — showing the project clone."}),(p==null?void 0:p.truncated)&&m.jsx("div",{className:"code-tab-note",children:"listing truncated"}),_&&D&&m.jsxs("div",{className:"code-tab-note",children:["Refresh failed: ",_]}),m.jsx("div",{className:"code-tab-body",children:D?D.dirs.size===0&&D.files.length===0?m.jsx("div",{className:"code-tab-note",children:"No files."}):m.jsx("div",{className:"code-tree",children:m.jsx(Cw,{node:D,parentPath:"",depth:0,toggled:u,onToggle:T,onOpenFile:M=>f(M,t??void 0,a||void 0)})}):m.jsx("div",{className:"code-tab-note",children:_?`Failed to load: ${_}`:"Loading…"})})]})}const bO="project";function SO(e){return/^[a-z][a-z0-9+.-]*:/i.test(e)||e.startsWith("//")}function xO(e){if(!e.startsWith("---"))return e;const t=e.indexOf(` +---`,3);return t===-1?e:e.slice(t+4).replace(/^\r?\n/,"")}const wO=/\.(png|jpe?g|gif|webp|svg)$/i;function Yp(e,t){for(const n of e){if(n.path===t)return n;if(n.isDir&&t.startsWith(n.path+"/")){const r=Yp(n.children??[],t);if(r)return r}}return null}function CO({projectId:e,folder:t,markdown:n}){const r=a=>SO(a)?a:Tp(e,`${t}/${a.replace(/^\.?\//,"")}`);return m.jsx("div",{className:"md report-md",children:m.jsx(jx,{remarkPlugins:[sw],components:{a:({href:a,children:l,...u})=>{const o=!a||a.startsWith("#");return m.jsx("a",{...u,href:o?a:r(a),...o?{}:{target:"_blank",rel:"noopener noreferrer"},children:l})},img:({src:a,alt:l})=>{if(!a||typeof a!="string")return null;const u=r(a);return m.jsxs("a",{href:u,target:"_blank",rel:"noopener noreferrer",className:"report-img",children:[m.jsx("img",{src:u,alt:l??"",loading:"lazy"}),l&&m.jsx("span",{className:"report-img-caption",children:l})]})},...gw},children:xO(n)})})}function EO({projectId:e,entry:t,onBack:n,onDelete:r}){const[a,l]=V.useState(null),[u,o]=V.useState(null);return V.useEffect(()=>{QT(e,t.path).then(c=>l(c.markdown)).catch(c=>o(c instanceof Error?c.message:String(c)))},[e,t.path,t.modifiedAt]),m.jsx("div",{className:"report-view",children:m.jsxs("div",{className:"report-view-col",children:[m.jsxs("div",{className:"report-view-head",children:[m.jsxs("button",{className:"report-back",onClick:n,children:[m.jsx(To,{size:13})," Files"]}),m.jsx("span",{style:{flex:1}}),m.jsx("span",{className:"report-date",children:new Date(t.modifiedAt).toLocaleString()}),m.jsx("button",{className:"icon-btn",title:"Delete report folder","aria-label":"Delete report folder",onClick:()=>{window.confirm(`Delete the "${t.path}" folder from the files dir?`)&&r()},children:m.jsx(Uu,{size:14})})]}),u?m.jsx("div",{className:"error",children:u}):a===null?m.jsxs("div",{className:"settings-loading",children:[m.jsx("span",{className:"spinner"})," Loading report…"]}):m.jsx(CO,{projectId:e,folder:t.path,markdown:a})]})})}function kO({dir:e}){const[t,n]=V.useState(!1);return m.jsxs("div",{className:"files-pill files-pill-dir",title:e,children:[m.jsx("code",{children:e}),m.jsx("button",{className:"icon-btn",title:"Copy path","aria-label":"Copy files directory path",onClick:()=>{var r;(r=navigator.clipboard)==null||r.writeText(e),n(!0),setTimeout(()=>n(!1),1200)},children:t?m.jsx(_n,{size:13}):m.jsx(yg,{size:13})})]})}function Ew({projectId:e,entries:t,depth:n,expanded:r,onToggle:a,onOpenReport:l,onDelete:u}){return m.jsx(m.Fragment,{children:t.map(o=>{var p;const c={paddingLeft:14+n*22},f=m.jsx("button",{className:"icon-btn ftree-del",title:`Delete ${o.path}`,"aria-label":`Delete ${o.path}`,onClick:d=>{d.stopPropagation(),window.confirm(`Delete "${o.path}" from the files dir?`)&&u(o.path)},children:m.jsx(Uu,{size:13})});if(o.isDir){const d=o.reportTitle!==void 0,_=r.has(o.path),v=n===0?o.experiment:void 0,w=d&&n>0,C=v?[v.title,v.branchName].filter(Boolean).join(" — "):d&&!w?o.reportTitle:void 0;return m.jsxs("div",{children:[m.jsxs("div",{className:"ftree-row clickable",style:c,title:C,onClick:()=>d?l(o.path):a(o.path),children:[m.jsx("button",{className:`ftree-chevron ${_?"open":""}`,"aria-label":_?`Collapse ${o.name}`:`Expand ${o.name}`,onClick:b=>{b.stopPropagation(),a(o.path)},children:m.jsx(Fu,{size:13})}),w?m.jsx("span",{className:"ftree-title",children:o.reportTitle}):m.jsxs("span",{className:"ftree-dirname",children:[o.name,"/"]}),d&&m.jsx("span",{className:"ftree-tag",children:"report"}),(v==null?void 0:v.latestRunStatus)&&m.jsx("span",{className:"ftree-status",children:v.latestRunStatus}),f,m.jsx("span",{className:"ftree-date",children:new Date(o.modifiedAt).toLocaleDateString()})]}),_&&(((p=o.children)==null?void 0:p.length)??0)>0&&m.jsx("div",{className:"ftree-children",children:m.jsx(Ew,{projectId:e,entries:o.children??[],depth:n+1,expanded:r,onToggle:a,onOpenReport:l,onDelete:u})})]},o.path)}return m.jsxs("div",{className:"ftree-row",style:c,children:[m.jsx("span",{className:"ftree-chevron spacer"}),m.jsxs("a",{className:"ftree-link",href:Tp(e,o.path),target:"_blank",rel:"noopener noreferrer",title:o.path,children:[wO.test(o.name)&&m.jsx("img",{className:"ftree-thumb",src:Tp(e,o.path),alt:"",loading:"lazy"}),m.jsx("span",{className:"ftree-name",children:o.name})]}),f,m.jsx("span",{className:"ftree-size",children:Bo(o.size)})]},o.path)})})}function AO(e){const t=[],n=[],r=[];for(const a of e)a.isDir&&a.name===bO?t.push(a):a.isDir&&a.experiment?n.push(a):r.push(a);return{project:t,experiments:n,other:r}}function TO({project:e,files:t,onChanged:n,onOpenStorage:r}){const[a,l]=V.useState(null),[u,o]=V.useState(new Set),c=a&&t?Yp(t.entries,a):null;V.useEffect(()=>{var b;a&&t&&!((b=Yp(t.entries,a))!=null&&b.reportTitle)&&l(null)},[a,t]);const f=b=>o(S=>{const x=new Set(S);return x.has(b)?x.delete(b):x.add(b),x}),p=b=>{JT(e.id,b).catch(()=>{}).finally(n)};if(c!=null&&c.reportTitle)return m.jsx(EO,{projectId:e.id,entry:c,onBack:()=>l(null),onDelete:()=>{p(c.path),l(null)}});if(!t)return m.jsx("div",{className:"files-tab",children:m.jsx("div",{className:"files-col",children:m.jsxs("div",{className:"settings-loading",children:[m.jsx("span",{className:"spinner"})," Loading files…"]})})});const{project:d,experiments:_,other:v}=AO(t.entries),w=b=>m.jsx(Ew,{projectId:e.id,entries:b,depth:0,expanded:u,onToggle:f,onOpenReport:l,onDelete:p}),C=`https://github.com/${e.githubOwner}/${e.githubRepo}`;return m.jsx("div",{className:"files-tab",children:m.jsxs("div",{className:"files-col",children:[m.jsxs("div",{className:"files-meta",children:[m.jsxs("a",{className:"files-pill",href:C,target:"_blank",rel:"noopener noreferrer",children:[m.jsxs("code",{children:[e.githubOwner,"/",e.githubRepo]}),m.jsx(bg,{size:12})]}),m.jsx(kO,{dir:t.dir}),m.jsx("button",{type:"button",className:"files-pill files-pill-link",onClick:r,children:"Change storage location →"})]}),m.jsxs("p",{className:"files-hint",children:["An explorer over this folder — the agent writes each experiment's reports and figures into the folder named for its slug (project-wide reports under ",m.jsx("code",{children:"project/"}),"), and you can drop in your own files."]}),t.entries.length===0?m.jsxs("p",{className:"files-empty",children:["Nothing here yet. Ask the agent for a write-up of its findings — it saves each experiment's report folder (",m.jsx("code",{children:"report.md"})," + images) into the folder above."]}):m.jsxs("div",{className:"files-card",children:[w(d),w(_),v.length>0&&(_.length>0||d.length>0)&&m.jsx("div",{className:"ftree-divider",children:"Not linked to an experiment"}),w(v),t.truncated&&m.jsx("p",{className:"files-truncated",children:"Listing truncated — the folder has more files."})]})]})})}function Uc({active:e,label:t,icon:n,onSelect:r,onClose:a}){return m.jsxs("button",{className:`tab closable ${e?"active":""}`,onClick:r,title:t,children:[n,m.jsx("span",{className:"tab-label",children:t}),m.jsx("span",{role:"button",className:"tab-close",title:"Close tab",onClick:l=>{l.stopPropagation(),a()},children:m.jsx(jo,{size:12})})]})}function kw({size:e}){return m.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:m.jsx("path",{d:"M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0 0 24 12c0-6.63-5.37-12-12-12z"})})}function NO({owner:e,repo:t,branch:n}){return m.jsxs("a",{className:"files-pill",href:wg(e,t,n),target:"_blank",rel:"noopener noreferrer",title:`Open ${n} on GitHub`,children:[m.jsx("code",{children:n}),m.jsx(kw,{size:12})]})}function $1(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),n.push.apply(n,r)}return n}function lt(e){for(var t=1;t=0||(p[c]=u[c]);return p})(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function et(e,t){return Tw(e)||(function(n,r){var a=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(a!=null){var l,u,o,c,f=[],p=!0,d=!1;try{if(o=(a=a.call(n)).next,r===0){if(Object(a)!==a)return;p=!1}else for(;!(p=(l=o.call(a)).done)&&(f.push(l.value),f.length!==r);p=!0);}catch(_){d=!0,u=_}finally{try{if(!p&&a.return!=null&&(c=a.return(),Object(c)!==c))return}finally{if(d)throw u}}return f}})(e,t)||th(e,t)||Dw()}function Aw(e){return Tw(e)||Nw(e)||th(e)||Dw()}function Rn(e){return(function(t){if(Array.isArray(t))return Xp(t)})(e)||Nw(e)||th(e)||(function(){throw new TypeError(`Invalid attempt to spread non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)})()}function Tw(e){if(Array.isArray(e))return e}function Nw(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function th(e,t){if(e){if(typeof e=="string")return Xp(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Xp(e,t):void 0}}function Xp(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(c){throw c},f:a}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var l,u=!0,o=!1;return{s:function(){n=n.call(e)},n:function(){var c=n.next();return u=c.done,c},e:function(c){o=!0,l=c},f:function(){try{u||n.return==null||n.return()}finally{if(o)throw l}}}}var $c=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ol(e,t){return e(t={exports:{}},t.exports),t.exports}var Nn=ol((function(e){/*! Copyright (c) 2018 Jed Watson. Licensed under the MIT License (MIT), see http://jedwatson.github.io/classnames -*/(function(){var t={}.hasOwnProperty;function n(){for(var r=[],a=0;a-1?S.slice(0,b):k;switch(k){case"diff":C--;break e;case"deleted":case"new":var D=S.slice(b+1);D.indexOf("file mode")===0&&(u[k==="new"?"newMode":"oldMode"]=D.slice(10));break;case"similarity":u.similarity=parseInt(S.split(" ")[2],10);break;case"index":var T=S.slice(b+1).split(" "),R=T[0].split("..");u.oldRevision=R[0],u.newRevision=R[1],T[1]&&(u.oldMode=u.newMode=T[1]);break;case"copy":case"rename":var N=S.slice(b+1);N.indexOf("from")===0?u.oldPath=N.slice(5):u.newPath=N.slice(3),x=k;break;case"---":var M=S.slice(b+1),B=v[++C].slice(4);M==="/dev/null"?(B=B.slice(2),x="add"):B==="/dev/null"?(M=M.slice(2),x="delete"):(x="modify",M=M.slice(2),B=B.slice(2)),M&&(u.oldPath=M),B&&(u.newPath=B),_=5;break e}}u.type=x||"modify"}else if(y.indexOf("Binary")===0)u.isBinary=!0,u.type=y.indexOf("/dev/null and")>=0?"add":y.indexOf("and /dev/null")>=0?"delete":"modify",_=2,u=null;else if(_===5)if(y.indexOf("@@")===0){var H=/^@@\s+-([0-9]+)(,([0-9]+))?\s+\+([0-9]+)(,([0-9]+))?/.exec(y);o={content:y,oldStart:H[1]-0,newStart:H[4]-0,oldLines:H[3]-0||1,newLines:H[6]-0||1,changes:[]},u.hunks.push(o),c=o.oldStart,f=o.newStart}else{var Y=y.slice(0,1),F={content:y.slice(1)};switch(Y){case"+":F.type="insert",F.isInsert=!0,F.lineNumber=f,f++;break;case"-":F.type="delete",F.isDelete=!0,F.lineNumber=c,c++;break;case" ":F.type="normal",F.isNormal=!0,F.oldLineNumber=c,F.newLineNumber=f,c++,f++;break;case"\\":var z=o.changes[o.changes.length-1];z.isDelete||(u.newEndingNewLine=!1),z.isInsert||(u.oldEndingNewLine=!1)}F.type&&o.changes.push(F)}C++}return d}};e.exports=a})()}));function wr(e){return e.type==="insert"}function Mn(e){return e.type==="delete"}function Ii(e){return e.type==="normal"}function MO(e,t){var n=t.nearbySequences==="zip"?(function(r){var a=r.reduce((function(l,u,o){var c=Qe(l,3),f=c[0],p=c[1],d=c[2];return p?wr(u)&&d>=0?(f.splice(d+1,0,u),[f,u,d+2]):(f.push(u),[f,u,Mn(u)&&Mn(p)?d:o]):(f.push(u),[f,u,Mn(u)?o:-1])}),[[],null,-1]);return Qe(a,1)[0]})(e.changes):e.changes;return ft(ft({},e),{},{isPlain:!1,changes:n})}function LO(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=(function(r){if(r.startsWith("diff --git"))return r;var a=r.indexOf(` +*/(function(){var t={}.hasOwnProperty;function n(){for(var r=[],a=0;a-1?S.slice(0,y):k;switch(k){case"diff":C--;break e;case"deleted":case"new":var D=S.slice(y+1);D.indexOf("file mode")===0&&(u[k==="new"?"newMode":"oldMode"]=D.slice(10));break;case"similarity":u.similarity=parseInt(S.split(" ")[2],10);break;case"index":var T=S.slice(y+1).split(" "),R=T[0].split("..");u.oldRevision=R[0],u.newRevision=R[1],T[1]&&(u.oldMode=u.newMode=T[1]);break;case"copy":case"rename":var N=S.slice(y+1);N.indexOf("from")===0?u.oldPath=N.slice(5):u.newPath=N.slice(3),x=k;break;case"---":var M=S.slice(y+1),B=v[++C].slice(4);M==="/dev/null"?(B=B.slice(2),x="add"):B==="/dev/null"?(M=M.slice(2),x="delete"):(x="modify",M=M.slice(2),B=B.slice(2)),M&&(u.oldPath=M),B&&(u.newPath=B),_=5;break e}}u.type=x||"modify"}else if(b.indexOf("Binary")===0)u.isBinary=!0,u.type=b.indexOf("/dev/null and")>=0?"add":b.indexOf("and /dev/null")>=0?"delete":"modify",_=2,u=null;else if(_===5)if(b.indexOf("@@")===0){var H=/^@@\s+-([0-9]+)(,([0-9]+))?\s+\+([0-9]+)(,([0-9]+))?/.exec(b);o={content:b,oldStart:H[1]-0,newStart:H[4]-0,oldLines:H[3]-0||1,newLines:H[6]-0||1,changes:[]},u.hunks.push(o),c=o.oldStart,f=o.newStart}else{var Y=b.slice(0,1),F={content:b.slice(1)};switch(Y){case"+":F.type="insert",F.isInsert=!0,F.lineNumber=f,f++;break;case"-":F.type="delete",F.isDelete=!0,F.lineNumber=c,c++;break;case" ":F.type="normal",F.isNormal=!0,F.oldLineNumber=c,F.newLineNumber=f,c++,f++;break;case"\\":var z=o.changes[o.changes.length-1];z.isDelete||(u.newEndingNewLine=!1),z.isInsert||(u.oldEndingNewLine=!1)}F.type&&o.changes.push(F)}C++}return d}};e.exports=a})()}));function wr(e){return e.type==="insert"}function Mn(e){return e.type==="delete"}function Ii(e){return e.type==="normal"}function LO(e,t){var n=t.nearbySequences==="zip"?(function(r){var a=r.reduce((function(l,u,o){var c=et(l,3),f=c[0],p=c[1],d=c[2];return p?wr(u)&&d>=0?(f.splice(d+1,0,u),[f,u,d+2]):(f.push(u),[f,u,Mn(u)&&Mn(p)?d:o]):(f.push(u),[f,u,Mn(u)?o:-1])}),[[],null,-1]);return et(a,1)[0]})(e.changes):e.changes;return lt(lt({},e),{},{isPlain:!1,changes:n})}function OO(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=(function(r){if(r.startsWith("diff --git"))return r;var a=r.indexOf(` `),l=r.indexOf(` `,a+1),u=r.slice(0,a),o=r.slice(a+1,l),c=u.split(" ").slice(1,-3).join(" "),f=o.split(" ").slice(1,-3).join(" ");return["diff --git a/".concat(c," b/").concat(f),"index 1111111..2222222 100644","--- a/".concat(c),"+++ b/".concat(f),r.slice(l+1)].join(` -`)})(e.trimStart());return RO.parse(n).map((function(r){return(function(a,l){var u=a.hunks.map((function(o){return MO(o,l)}));return ft(ft({},a),{},{hunks:u})})(r,t)}))}function OO(e){return e[0]}function jO(e){return e[e.length-1]}function Zp(e){return["".concat(e,"Start"),"".concat(e,"Lines")]}function Uo(e){return e==="old"?function(t){return wr(t)?-1:Ii(t)?t.oldLineNumber:t.lineNumber}:function(t){return Mn(t)?-1:Ii(t)?t.newLineNumber:t.lineNumber}}function Rw(e,t){return function(n,r){var a=n[e],l=a+n[t];return r>=a&&r=l&&a-1},$O=function(e,t){var n=this.__data__,r=ih(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this};function Zs(e){var t=-1,n=e==null?0:e.length;for(this.clear();++to))return!1;var f=l.get(e),p=l.get(t);if(f&&p)return f==t&&p==e;var d=-1,_=!0,v=2&n?new kj:void 0;for(l.set(e,t),l.set(t,e);++d-1&&e%1==0&&e-1&&e%1==0&&e<=9007199254740991},kt={};kt["[object Float32Array]"]=kt["[object Float64Array]"]=kt["[object Int8Array]"]=kt["[object Int16Array]"]=kt["[object Int32Array]"]=kt["[object Uint8Array]"]=kt["[object Uint8ClampedArray]"]=kt["[object Uint16Array]"]=kt["[object Uint32Array]"]=!0,kt["[object Arguments]"]=kt["[object Array]"]=kt["[object ArrayBuffer]"]=kt["[object Boolean]"]=kt["[object DataView]"]=kt["[object Date]"]=kt["[object Error]"]=kt["[object Function]"]=kt["[object Map]"]=kt["[object Number]"]=kt["[object Object]"]=kt["[object RegExp]"]=kt["[object Set]"]=kt["[object String]"]=kt["[object WeakMap]"]=!1;var Uj=function(e){return oa(e)&&_m(e.length)&&!!kt[ba(e)]},$j=function(e){return function(t){return e(t)}},Z1=ll((function(e,t){var n=t&&!t.nodeType&&t,r=n&&e&&!e.nodeType&&e,a=r&&r.exports===n&&Ow.process,l=(function(){try{var u=r&&r.require&&r.require("util").types;return u||a&&a.binding&&a.binding("util")}catch{}})();e.exports=l})),Q1=Z1&&Z1.isTypedArray,vm=Q1?$j(Q1):Uj,Gj=Object.prototype.hasOwnProperty,qj=function(e,t){var n=Ln(e),r=!n&&oh(e),a=!n&&!r&&ku(e),l=!n&&!r&&!a&&vm(e),u=n||r||a||l,o=u?Ij(e.length,String):[],c=o.length;for(var f in e)!Gj.call(e,f)||u&&(f=="length"||a&&(f=="offset"||f=="parent")||l&&(f=="buffer"||f=="byteLength"||f=="byteOffset")||Fw(f,c))||o.push(f);return o},Vj=Object.prototype,Pw=function(e){var t=e&&e.constructor;return e===(typeof t=="function"&&t.prototype||Vj)},Yj=(function(e,t){return function(n){return e(t(n))}})(Object.keys,Object),Wj=Object.prototype.hasOwnProperty,Uw=function(e){if(!Pw(e))return Yj(e);var t=[];for(var n in Object(e))Wj.call(e,n)&&n!="constructor"&&t.push(n);return t},lh=function(e){return e!=null&&_m(e.length)&&!Bw(e)},ym=function(e){return lh(e)?qj(e):Uw(e)},J1=function(e){return Mj(e,ym,Bj)},Xj=Object.prototype.hasOwnProperty,Kj=function(e,t,n,r,a,l){var u=1&n,o=J1(e),c=o.length;if(c!=J1(t).length&&!u)return!1;for(var f=c;f--;){var p=o[f];if(!(u?p in t:Xj.call(t,p)))return!1}var d=l.get(e),_=l.get(t);if(d&&_)return d==t&&_==e;var v=!0;l.set(e,t),l.set(t,e);for(var w=u;++f1)return!1;if(e.length===1){var t=Qe(e,1)[0];return t.type==="text"&&!t.value}return!0}function z6(e){var t=e.changeKey,n=e.text,r=e.tokens,a=e.renderToken,l=Sr(e,B6),u=a?function(o,c){return a(o,rb,c)}:rb;return m.jsx("td",ft(ft({},l),{},{"data-change-key":t,children:r?I6(r)?" ":r.map(u):n||" "}))}var Kw=V.memo(z6);function Zw(e,t){return function(){var n=t==="old"?dh(e):ph(e);return n===-1?void 0:n}}function Qw(e,t){return function(n){return e&&n?m.jsx("a",{href:t?"#"+t:void 0,children:n}):n}}function Au(e,t){return t?function(n){e(),t(n)}:e}function sb(e,t,n,r){return V.useMemo((function(){var a=Xw(e,(function(l){return function(u){return l&&l(t,u)}}));return a.onMouseEnter=Au(n,a.onMouseEnter),a.onMouseLeave=Au(r,a.onMouseLeave),a}),[e,n,r,t])}function ab(e,t,n,r,a,l,u,o,c){var f={change:t,side:r,inHoverState:o,renderDefault:Zw(t,r),wrapInAnchor:Qw(a,l)};return m.jsx("td",ft(ft({className:e},u),{},{"data-change-key":n,children:c(f)}))}function H6(e){var t,n,r,a=e.change,l=e.selected,u=e.tokens,o=e.className,c=e.generateLineClassName,f=e.gutterClassName,p=e.codeClassName,d=e.gutterEvents,_=e.codeEvents,v=e.hideGutter,w=e.gutterAnchor,C=e.generateAnchorID,y=e.renderToken,S=e.renderGutter,x=a.type,b=a.content,k=br(a),D=(t=Qe(V.useState(!1),2),n=t[0],r=t[1],[n,V.useCallback((function(){return r(!0)}),[]),V.useCallback((function(){return r(!1)}),[])]),T=Qe(D,3),R=T[0],N=T[1],M=T[2],B=V.useMemo((function(){return{change:a}}),[a]),H=sb(d,B,N,M),Y=sb(_,B,N,M),F=C(a),z=c({changes:[a],defaultGenerate:function(){return o}}),q=Nn("diff-gutter","diff-gutter-".concat(x),f,{"diff-gutter-selected":l}),G=Nn("diff-code","diff-code-".concat(x),p,{"diff-code-selected":l});return m.jsxs("tr",{id:F,className:Nn("diff-line",z),children:[!v&&ab(q,a,k,"old",w,F,H,R,S),!v&&ab(q,a,k,"new",w,F,H,R,S),m.jsx(Kw,ft({className:G,changeKey:k,text:b,tokens:u,renderToken:y},Y))]})}var F6=V.memo(H6);function P6(e){var t=e.hideGutter,n=e.element;return m.jsx("tr",{className:"diff-widget",children:m.jsx("td",{colSpan:t?1:3,className:"diff-widget-content",children:n})})}var U6=["hideGutter","selectedChanges","tokens","lineClassName"],$6=["hunk","widgets","className"];function G6(e){var t=e.hunk,n=e.widgets,r=e.className,a=Sr(e,$6),l=(function(u,o){return u.reduce((function(c,f){var p=br(f);c.push(["change",p,f]);var d=o[p];return d&&c.push(["widget",p,d]),c}),[])})(t.changes,n);return m.jsx("tbody",{className:Nn("diff-hunk",r),children:l.map((function(u){return(function(o,c){var f=Qe(o,3),p=f[0],d=f[1],_=f[2],v=c.hideGutter,w=c.selectedChanges,C=c.tokens,y=c.lineClassName,S=Sr(c,U6);if(p==="change"){var x=Mn(_)?"old":"new",b=Mn(_)?dh(_):ph(_),k=C?C[x][b-1]:null;return m.jsx(F6,ft({className:y,change:_,hideGutter:v,selected:w.includes(d),tokens:k},S),"change".concat(d))}return p==="widget"?m.jsx(P6,{hideGutter:v,element:_},"widget".concat(d)):null})(u,a)}))})}var Jw=0;function Vc(e,t,n,r){var a=V.useCallback((function(){return t(e)}),[e,t]),l=V.useCallback((function(){return t("")}),[t]);return V.useMemo((function(){var u=Xw(r,(function(o){return function(c){return o&&o({side:e,change:n},c)}}));return u.onMouseEnter=Au(a,u.onMouseEnter),u.onMouseLeave=Au(l,u.onMouseLeave),u}),[n,r,a,e,l])}function fp(e){var t=e.change,n=e.side,r=e.selected,a=e.tokens,l=e.gutterClassName,u=e.codeClassName,o=e.gutterEvents,c=e.codeEvents,f=e.anchorID,p=e.gutterAnchor,d=e.gutterAnchorTarget,_=e.hideGutter,v=e.hover,w=e.renderToken,C=e.renderGutter;if(!t){var y=Nn("diff-gutter","diff-gutter-omit",l),S=Nn("diff-code","diff-code-omit",u);return[!_&&m.jsx("td",{className:y},"gutter"),m.jsx("td",{className:S},"code")]}var x=t.type,b=t.content,k=br(t),D=n===Jw?"old":"new",T=ft({id:f||void 0,className:Nn("diff-gutter","diff-gutter-".concat(x),Xp({"diff-gutter-selected":r},"diff-line-hover-"+D,v),l),children:C({change:t,side:D,inHoverState:v,renderDefault:Zw(t,D),wrapInAnchor:Qw(p,d)})},o),R=Nn("diff-code","diff-code-".concat(x),Xp({"diff-code-selected":r},"diff-line-hover-"+D,v),u);return[!_&&m.jsx("td",ft(ft({},T),{},{"data-change-key":k}),"gutter"),m.jsx(Kw,ft({className:R,changeKey:k,text:b,tokens:a,renderToken:w},c),"code")]}function q6(e){var t=e.className,n=e.oldChange,r=e.newChange,a=e.oldSelected,l=e.newSelected,u=e.oldTokens,o=e.newTokens,c=e.monotonous,f=e.gutterClassName,p=e.codeClassName,d=e.gutterEvents,_=e.codeEvents,v=e.hideGutter,w=e.generateAnchorID,C=e.generateLineClassName,y=e.gutterAnchor,S=e.renderToken,x=e.renderGutter,b=Qe(V.useState(""),2),k=b[0],D=b[1],T=Vc("old",D,n,d),R=Vc("new",D,r,d),N=Vc("old",D,n,_),M=Vc("new",D,r,_),B=n&&w(n),H=r&&w(r),Y=C({changes:[n,r],defaultGenerate:function(){return t}}),F={monotonous:c,hideGutter:v,gutterClassName:f,codeClassName:p,gutterEvents:d,codeEvents:_,renderToken:S,renderGutter:x},z=ft(ft({},F),{},{change:n,side:Jw,selected:a,tokens:u,gutterEvents:T,codeEvents:N,anchorID:B,gutterAnchor:y,gutterAnchorTarget:B,hover:k==="old"}),q=ft(ft({},F),{},{change:r,side:1,selected:l,tokens:o,gutterEvents:R,codeEvents:M,anchorID:n===r?null:H,gutterAnchor:y,gutterAnchorTarget:n===r?B:H,hover:k==="new"});if(c)return m.jsx("tr",{className:Nn("diff-line",Y),children:fp(n?z:q)});var G=(function(X,K){return X&&!K?"diff-line-old-only":!X&&K?"diff-line-new-only":X===K?"diff-line-normal":"diff-line-compare"})(n,r);return m.jsxs("tr",{className:Nn("diff-line",G,Y),children:[fp(z),fp(q)]})}var V6=V.memo(q6);function Y6(e){var t=e.hideGutter,n=e.oldElement,r=e.newElement;return e.monotonous?m.jsx("tr",{className:"diff-widget",children:m.jsx("td",{colSpan:t?1:2,className:"diff-widget-content",children:n||r})}):n===r?m.jsx("tr",{className:"diff-widget",children:m.jsx("td",{colSpan:t?2:4,className:"diff-widget-content",children:n})}):m.jsxs("tr",{className:"diff-widget",children:[m.jsx("td",{colSpan:t?1:2,className:"diff-widget-content",children:n}),m.jsx("td",{colSpan:t?1:2,className:"diff-widget-content",children:r})]})}var W6=["selectedChanges","monotonous","hideGutter","tokens","lineClassName"],X6=["hunk","widgets","className"];function Yc(e,t){return(e?br(e):"00")+(t?br(t):"00")}function K6(e){var t=e.hunk,n=e.widgets,r=e.className,a=Sr(e,X6),l=(function(u,o){for(var c=function(S){if(!S)return null;var x=br(S);return o[x]||null},f=[],p=0;p=a&&r=l&&a-1},GO=function(e,t){var n=this.__data__,r=nh(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this};function Ks(e){var t=-1,n=e==null?0:e.length;for(this.clear();++to))return!1;var f=l.get(e),p=l.get(t);if(f&&p)return f==t&&p==e;var d=-1,_=!0,v=2&n?new Aj:void 0;for(l.set(e,t),l.set(t,e);++d-1&&e%1==0&&e-1&&e%1==0&&e<=9007199254740991},wt={};wt["[object Float32Array]"]=wt["[object Float64Array]"]=wt["[object Int8Array]"]=wt["[object Int16Array]"]=wt["[object Int32Array]"]=wt["[object Uint8Array]"]=wt["[object Uint8ClampedArray]"]=wt["[object Uint16Array]"]=wt["[object Uint32Array]"]=!0,wt["[object Arguments]"]=wt["[object Array]"]=wt["[object ArrayBuffer]"]=wt["[object Boolean]"]=wt["[object DataView]"]=wt["[object Date]"]=wt["[object Error]"]=wt["[object Function]"]=wt["[object Map]"]=wt["[object Number]"]=wt["[object Object]"]=wt["[object RegExp]"]=wt["[object Set]"]=wt["[object String]"]=wt["[object WeakMap]"]=!1;var $j=function(e){return aa(e)&&_m(e.length)&&!!wt[ya(e)]},Gj=function(e){return function(t){return e(t)}},Z1=ol((function(e,t){var n=t&&!t.nodeType&&t,r=n&&e&&!e.nodeType&&e,a=r&&r.exports===n&&jw.process,l=(function(){try{var u=r&&r.require&&r.require("util").types;return u||a&&a.binding&&a.binding("util")}catch{}})();e.exports=l})),Q1=Z1&&Z1.isTypedArray,vm=Q1?Gj(Q1):$j,qj=Object.prototype.hasOwnProperty,Vj=function(e,t){var n=Ln(e),r=!n&&ah(e),a=!n&&!r&&Eu(e),l=!n&&!r&&!a&&vm(e),u=n||r||a||l,o=u?zj(e.length,String):[],c=o.length;for(var f in e)!qj.call(e,f)||u&&(f=="length"||a&&(f=="offset"||f=="parent")||l&&(f=="buffer"||f=="byteLength"||f=="byteOffset")||Pw(f,c))||o.push(f);return o},Yj=Object.prototype,Uw=function(e){var t=e&&e.constructor;return e===(typeof t=="function"&&t.prototype||Yj)},Wj=(function(e,t){return function(n){return e(t(n))}})(Object.keys,Object),Xj=Object.prototype.hasOwnProperty,$w=function(e){if(!Uw(e))return Wj(e);var t=[];for(var n in Object(e))Xj.call(e,n)&&n!="constructor"&&t.push(n);return t},oh=function(e){return e!=null&&_m(e.length)&&!Iw(e)},ym=function(e){return oh(e)?Vj(e):$w(e)},J1=function(e){return Lj(e,ym,Ij)},Kj=Object.prototype.hasOwnProperty,Zj=function(e,t,n,r,a,l){var u=1&n,o=J1(e),c=o.length;if(c!=J1(t).length&&!u)return!1;for(var f=c;f--;){var p=o[f];if(!(u?p in t:Kj.call(t,p)))return!1}var d=l.get(e),_=l.get(t);if(d&&_)return d==t&&_==e;var v=!0;l.set(e,t),l.set(t,e);for(var w=u;++f1)return!1;if(e.length===1){var t=et(e,1)[0];return t.type==="text"&&!t.value}return!0}function H6(e){var t=e.changeKey,n=e.text,r=e.tokens,a=e.renderToken,l=Sr(e,I6),u=a?function(o,c){return a(o,rb,c)}:rb;return m.jsx("td",lt(lt({},l),{},{"data-change-key":t,children:r?z6(r)?" ":r.map(u):n||" "}))}var Zw=V.memo(H6);function Qw(e,t){return function(){var n=t==="old"?fh(e):dh(e);return n===-1?void 0:n}}function Jw(e,t){return function(n){return e&&n?m.jsx("a",{href:t?"#"+t:void 0,children:n}):n}}function ku(e,t){return t?function(n){e(),t(n)}:e}function sb(e,t,n,r){return V.useMemo((function(){var a=Kw(e,(function(l){return function(u){return l&&l(t,u)}}));return a.onMouseEnter=ku(n,a.onMouseEnter),a.onMouseLeave=ku(r,a.onMouseLeave),a}),[e,n,r,t])}function ab(e,t,n,r,a,l,u,o,c){var f={change:t,side:r,inHoverState:o,renderDefault:Qw(t,r),wrapInAnchor:Jw(a,l)};return m.jsx("td",lt(lt({className:e},u),{},{"data-change-key":n,children:c(f)}))}function F6(e){var t,n,r,a=e.change,l=e.selected,u=e.tokens,o=e.className,c=e.generateLineClassName,f=e.gutterClassName,p=e.codeClassName,d=e.gutterEvents,_=e.codeEvents,v=e.hideGutter,w=e.gutterAnchor,C=e.generateAnchorID,b=e.renderToken,S=e.renderGutter,x=a.type,y=a.content,k=br(a),D=(t=et(V.useState(!1),2),n=t[0],r=t[1],[n,V.useCallback((function(){return r(!0)}),[]),V.useCallback((function(){return r(!1)}),[])]),T=et(D,3),R=T[0],N=T[1],M=T[2],B=V.useMemo((function(){return{change:a}}),[a]),H=sb(d,B,N,M),Y=sb(_,B,N,M),F=C(a),z=c({changes:[a],defaultGenerate:function(){return o}}),q=Nn("diff-gutter","diff-gutter-".concat(x),f,{"diff-gutter-selected":l}),G=Nn("diff-code","diff-code-".concat(x),p,{"diff-code-selected":l});return m.jsxs("tr",{id:F,className:Nn("diff-line",z),children:[!v&&ab(q,a,k,"old",w,F,H,R,S),!v&&ab(q,a,k,"new",w,F,H,R,S),m.jsx(Zw,lt({className:G,changeKey:k,text:y,tokens:u,renderToken:b},Y))]})}var P6=V.memo(F6);function U6(e){var t=e.hideGutter,n=e.element;return m.jsx("tr",{className:"diff-widget",children:m.jsx("td",{colSpan:t?1:3,className:"diff-widget-content",children:n})})}var $6=["hideGutter","selectedChanges","tokens","lineClassName"],G6=["hunk","widgets","className"];function q6(e){var t=e.hunk,n=e.widgets,r=e.className,a=Sr(e,G6),l=(function(u,o){return u.reduce((function(c,f){var p=br(f);c.push(["change",p,f]);var d=o[p];return d&&c.push(["widget",p,d]),c}),[])})(t.changes,n);return m.jsx("tbody",{className:Nn("diff-hunk",r),children:l.map((function(u){return(function(o,c){var f=et(o,3),p=f[0],d=f[1],_=f[2],v=c.hideGutter,w=c.selectedChanges,C=c.tokens,b=c.lineClassName,S=Sr(c,$6);if(p==="change"){var x=Mn(_)?"old":"new",y=Mn(_)?fh(_):dh(_),k=C?C[x][y-1]:null;return m.jsx(P6,lt({className:b,change:_,hideGutter:v,selected:w.includes(d),tokens:k},S),"change".concat(d))}return p==="widget"?m.jsx(U6,{hideGutter:v,element:_},"widget".concat(d)):null})(u,a)}))})}var eC=0;function qc(e,t,n,r){var a=V.useCallback((function(){return t(e)}),[e,t]),l=V.useCallback((function(){return t("")}),[t]);return V.useMemo((function(){var u=Kw(r,(function(o){return function(c){return o&&o({side:e,change:n},c)}}));return u.onMouseEnter=ku(a,u.onMouseEnter),u.onMouseLeave=ku(l,u.onMouseLeave),u}),[n,r,a,e,l])}function hp(e){var t=e.change,n=e.side,r=e.selected,a=e.tokens,l=e.gutterClassName,u=e.codeClassName,o=e.gutterEvents,c=e.codeEvents,f=e.anchorID,p=e.gutterAnchor,d=e.gutterAnchorTarget,_=e.hideGutter,v=e.hover,w=e.renderToken,C=e.renderGutter;if(!t){var b=Nn("diff-gutter","diff-gutter-omit",l),S=Nn("diff-code","diff-code-omit",u);return[!_&&m.jsx("td",{className:b},"gutter"),m.jsx("td",{className:S},"code")]}var x=t.type,y=t.content,k=br(t),D=n===eC?"old":"new",T=lt({id:f||void 0,className:Nn("diff-gutter","diff-gutter-".concat(x),Wp({"diff-gutter-selected":r},"diff-line-hover-"+D,v),l),children:C({change:t,side:D,inHoverState:v,renderDefault:Qw(t,D),wrapInAnchor:Jw(p,d)})},o),R=Nn("diff-code","diff-code-".concat(x),Wp({"diff-code-selected":r},"diff-line-hover-"+D,v),u);return[!_&&m.jsx("td",lt(lt({},T),{},{"data-change-key":k}),"gutter"),m.jsx(Zw,lt({className:R,changeKey:k,text:y,tokens:a,renderToken:w},c),"code")]}function V6(e){var t=e.className,n=e.oldChange,r=e.newChange,a=e.oldSelected,l=e.newSelected,u=e.oldTokens,o=e.newTokens,c=e.monotonous,f=e.gutterClassName,p=e.codeClassName,d=e.gutterEvents,_=e.codeEvents,v=e.hideGutter,w=e.generateAnchorID,C=e.generateLineClassName,b=e.gutterAnchor,S=e.renderToken,x=e.renderGutter,y=et(V.useState(""),2),k=y[0],D=y[1],T=qc("old",D,n,d),R=qc("new",D,r,d),N=qc("old",D,n,_),M=qc("new",D,r,_),B=n&&w(n),H=r&&w(r),Y=C({changes:[n,r],defaultGenerate:function(){return t}}),F={monotonous:c,hideGutter:v,gutterClassName:f,codeClassName:p,gutterEvents:d,codeEvents:_,renderToken:S,renderGutter:x},z=lt(lt({},F),{},{change:n,side:eC,selected:a,tokens:u,gutterEvents:T,codeEvents:N,anchorID:B,gutterAnchor:b,gutterAnchorTarget:B,hover:k==="old"}),q=lt(lt({},F),{},{change:r,side:1,selected:l,tokens:o,gutterEvents:R,codeEvents:M,anchorID:n===r?null:H,gutterAnchor:b,gutterAnchorTarget:n===r?B:H,hover:k==="new"});if(c)return m.jsx("tr",{className:Nn("diff-line",Y),children:hp(n?z:q)});var G=(function(X,K){return X&&!K?"diff-line-old-only":!X&&K?"diff-line-new-only":X===K?"diff-line-normal":"diff-line-compare"})(n,r);return m.jsxs("tr",{className:Nn("diff-line",G,Y),children:[hp(z),hp(q)]})}var Y6=V.memo(V6);function W6(e){var t=e.hideGutter,n=e.oldElement,r=e.newElement;return e.monotonous?m.jsx("tr",{className:"diff-widget",children:m.jsx("td",{colSpan:t?1:2,className:"diff-widget-content",children:n||r})}):n===r?m.jsx("tr",{className:"diff-widget",children:m.jsx("td",{colSpan:t?2:4,className:"diff-widget-content",children:n})}):m.jsxs("tr",{className:"diff-widget",children:[m.jsx("td",{colSpan:t?1:2,className:"diff-widget-content",children:n}),m.jsx("td",{colSpan:t?1:2,className:"diff-widget-content",children:r})]})}var X6=["selectedChanges","monotonous","hideGutter","tokens","lineClassName"],K6=["hunk","widgets","className"];function Vc(e,t){return(e?br(e):"00")+(t?br(t):"00")}function Z6(e){var t=e.hunk,n=e.widgets,r=e.className,a=Sr(e,K6),l=(function(u,o){for(var c=function(S){if(!S)return null;var x=br(S);return o[x]||null},f=[],p=0;p=(l==null?void 0:l.value.length))return[e];var o=function(d,_){var v=l.value.slice(d,_);return[].concat(Rn(a),[ft(ft({},l),{},{value:v})])};if(t>0){var c=o(0,t);u.push(ta(c))}var f=o(Math.max(t,0),n);if(u.push(r?(function(d,_){return[_].concat(Rn(ta(d)))})(f,r):ta(f)),n1&&arguments[1]!==void 0?arguments[1]:[],n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];if(e.children){var r=e.children,a=Sr(e,m8);n.push(a);var l,u=gm(r);try{for(u.s();!(l=u.n()).done;)iC(l.value,t,n)}catch(o){u.e(o)}finally{u.f()}n.pop()}else t.push(ta([].concat(Rn(n.slice(1)),[e])));return t}function _8(e){return e.reduce((function(t,n){var r=t[t.length-1],a=(function(c){var f=Cm(c);return f.value.includes(` +`)})(t.oldSource,e),r=t.highlight?function(c){return t.refractor.highlight(c,t.language)}:function(c){return[{type:"text",value:c}]};return[Yc(r(t.oldSource)),Yc(r(n))]}var a=et(f8(e),2),l=a[0],u=a[1],o=t.highlight?function(c){return Yc(t.refractor.highlight(c,t.language))}:function(c){return Yc([{type:"text",value:c}])};return[o(l),o(u)]}function ea(e){return e.map((function(t){return lt({},t)}))}function p8(e,t){return[].concat(Rn(ea(e.slice(0,-1))),[t])}function g8(e){return e.type==="text"}function Cm(e){var t=e[e.length-1];if(g8(t))return t;throw new Error("Invalid token path with leaf of type ".concat(t.type))}function m8(e,t,n,r){var a=e.slice(0,-1),l=Cm(e),u=[];if(n<=0||t>=(l==null?void 0:l.value.length))return[e];var o=function(d,_){var v=l.value.slice(d,_);return[].concat(Rn(a),[lt(lt({},l),{},{value:v})])};if(t>0){var c=o(0,t);u.push(ea(c))}var f=o(Math.max(t,0),n);if(u.push(r?(function(d,_){return[_].concat(Rn(ea(d)))})(f,r):ea(f)),n1&&arguments[1]!==void 0?arguments[1]:[],n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];if(e.children){var r=e.children,a=Sr(e,_8);n.push(a);var l,u=gm(r);try{for(u.s();!(l=u.n()).done;)rC(l.value,t,n)}catch(o){u.e(o)}finally{u.f()}n.pop()}else t.push(ea([].concat(Rn(n.slice(1)),[e])));return t}function v8(e){return e.reduce((function(t,n){var r=t[t.length-1],a=(function(c){var f=Cm(c);return f.value.includes(` `)?f.value.split(` -`).map((function(p){return d8(c,ft(ft({},f),{},{value:p}))})):[c]})(n),l=kw(a),u=l[0],o=l.slice(1);return[].concat(Rn(t.slice(0,-1)),[[].concat(Rn(r),[u])],Rn(o.map((function(c){return[c]}))))}),[[]])}function ub(e){return _8(iC(e))}var v8=function(e,t,n){var r=(n=typeof n=="function"?n:void 0)?n(e,t):void 0;return r===void 0?ch(e,t,void 0,n):!!r},y8=function(e,t){return ch(e,t)},b8=function(e){var t=e==null?0:e.length;return t?e[t-1]:void 0};function S8(e,t){if(!e.children)throw new Error("parent node missing children property");var n,r,a=b8(e.children);return a&&(r=t,(n=a).type===r.type&&(n.type==="text"||n.children&&r.children&&v8(n,r,(function(l,u,o){return o==="chlidren"||y8(l,u)}))))?e.children[e.children.length-1]=(function(l,u){return"value"in l&&"value"in u?ft(ft({},l),{},{value:"".concat(l.value).concat(u.value)}):l})(a,t):e.children.push(t),e.children[e.children.length-1]}function hb(e){var t,n={type:"root",children:[]},r=gm(e);try{var a=function(){var l=t.value;l.reduce((function(u,o,c){return S8(u,c===l.length-1?ft({},o):ft(ft({},o),{},{children:[]}))}),n)};for(r.s();!(t=r.n()).done;)a()}catch(l){r.e(l)}finally{r.f()}return n}var x8=Object.prototype.hasOwnProperty,w8=tC((function(e,t,n){x8.call(e,n)?e[n].push(t):xm(e,n,[t])})),C8=Object.prototype.hasOwnProperty,E8=function(e){if(e==null)return!0;if(lh(e)&&(Ln(e)||typeof e=="string"||typeof e.splice=="function"||ku(e)||vm(e)||oh(e)))return!e.length;var t=ng(e);if(t=="[object Map]"||t=="[object Set]")return!e.size;if(Pw(e))return!Uw(e).length;for(var n in e)if(C8.call(e,n))return!1;return!0},k8=function(e,t){var n=t.start,r=t.length,a=n+r,l=e.reduce((function(u,o){var c=Qe(u,2),f=c[0],p=c[1],d=p+Cm(o).value.length;if(p>a||dr.length?n:r,c=n.length>r.length?r:n,f=o.indexOf(c);if(f!=-1)return u=[new t.Diff(1,o.substring(0,f)),new t.Diff(0,c),new t.Diff(1,o.substring(f+c.length))],n.length>r.length&&(u[0][0]=u[2][0]=-1),u;if(c.length==1)return[new t.Diff(-1,n),new t.Diff(1,r)];var p=this.diff_halfMatch_(n,r);if(p){var d=p[0],_=p[1],v=p[2],w=p[3],C=p[4],y=this.diff_main(d,v,a,l),S=this.diff_main(_,w,a,l);return y.concat([new t.Diff(0,C)],S)}return a&&n.length>100&&r.length>100?this.diff_lineMode_(n,r,l):this.diff_bisect_(n,r,l)},t.prototype.diff_lineMode_=function(n,r,a){var l=this.diff_linesToChars_(n,r);n=l.chars1,r=l.chars2;var u=l.lineArray,o=this.diff_main(n,r,!1,a);this.diff_charsToLines_(o,u),this.diff_cleanupSemantic(o),o.push(new t.Diff(0,""));for(var c=0,f=0,p=0,d="",_="";c=1&&p>=1){o.splice(c-f-p,f+p),c=c-f-p;for(var v=this.diff_main(d,_,!1,a),w=v.length-1;w>=0;w--)o.splice(c,0,v[w]);c+=v.length}p=0,f=0,d="",_=""}c++}return o.pop(),o},t.prototype.diff_bisect_=function(n,r,a){for(var l=n.length,u=r.length,o=Math.ceil((l+u)/2),c=o,f=2*o,p=new Array(f),d=new Array(f),_=0;_a);b++){for(var k=-b+C;k<=b-y;k+=2){for(var D=c+k,T=(H=k==-b||k!=b&&p[D-1]l)y+=2;else if(T>u)C+=2;else if(w&&(M=c+v-k)>=0&&M=(N=l-d[M]))return this.diff_bisectSplit_(n,r,H,T,a)}for(var R=-b+S;R<=b-x;R+=2){for(var N,M=c+R,B=(N=R==-b||R!=b&&d[M-1]l)x+=2;else if(B>u)S+=2;else if(!w&&(D=c+v-R)>=0&&D=(N=l-N))return this.diff_bisectSplit_(n,r,H,T,a)}}}return[new t.Diff(-1,n),new t.Diff(1,r)]},t.prototype.diff_bisectSplit_=function(n,r,a,l,u){var o=n.substring(0,a),c=r.substring(0,l),f=n.substring(a),p=r.substring(l),d=this.diff_main(o,c,!1,u),_=this.diff_main(f,p,!1,u);return d.concat(_)},t.prototype.diff_linesToChars_=function(n,r){var a=[],l={};function u(f){for(var p="",d=0,_=-1,v=a.length;_l?n=n.substring(a-l):ar.length?n:r,l=n.length>r.length?r:n;if(a.length<4||2*l.length=C.length?[x,b,k,D,N]:null}var c,f,p,d,_,v=o(a,l,Math.ceil(a.length/4)),w=o(a,l,Math.ceil(a.length/2));return v||w?(c=w?v&&v[4].length>w[4].length?v:w:v,n.length>r.length?(f=c[0],p=c[1],d=c[2],_=c[3]):(d=c[0],_=c[1],f=c[2],p=c[3]),[f,p,d,_,c[4]]):null},t.prototype.diff_cleanupSemantic=function(n){for(var r=!1,a=[],l=0,u=null,o=0,c=0,f=0,p=0,d=0;o0?a[l-1]:-1,c=0,f=0,p=0,d=0,u=null,r=!0)),o++;for(r&&this.diff_cleanupMerge(n),this.diff_cleanupSemanticLossless(n),o=1;o=C?(w>=_.length/2||w>=v.length/2)&&(n.splice(o,0,new t.Diff(0,v.substring(0,w))),n[o-1][1]=_.substring(0,_.length-w),n[o+1][1]=v.substring(w),o++):(C>=_.length/2||C>=v.length/2)&&(n.splice(o,0,new t.Diff(0,_.substring(0,C))),n[o-1][0]=1,n[o-1][1]=v.substring(0,v.length-C),n[o+1][0]=-1,n[o+1][1]=_.substring(C),o++),o++}o++}},t.prototype.diff_cleanupSemanticLossless=function(n){function r(C,y){if(!C||!y)return 6;var S=C.charAt(C.length-1),x=y.charAt(0),b=S.match(t.nonAlphaNumericRegex_),k=x.match(t.nonAlphaNumericRegex_),D=b&&S.match(t.whitespaceRegex_),T=k&&x.match(t.whitespaceRegex_),R=D&&S.match(t.linebreakRegex_),N=T&&x.match(t.linebreakRegex_),M=R&&C.match(t.blanklineEndRegex_),B=N&&y.match(t.blanklineStartRegex_);return M||B?5:R||N?4:b&&!D&&T?3:D||T?2:b||k?1:0}for(var a=1;a=v&&(v=w,p=l,d=u,_=o)}n[a-1][1]!=p&&(p?n[a-1][1]=p:(n.splice(a-1,1),a--),n[a][1]=d,_?n[a+1][1]=_:(n.splice(a+1,1),a--))}a++}},t.nonAlphaNumericRegex_=/[^a-zA-Z0-9]/,t.whitespaceRegex_=/\s/,t.linebreakRegex_=/[\r\n]/,t.blanklineEndRegex_=/\n\r?\n$/,t.blanklineStartRegex_=/^\r?\n\r?\n/,t.prototype.diff_cleanupEfficiency=function(n){for(var r=!1,a=[],l=0,u=null,o=0,c=!1,f=!1,p=!1,d=!1;o0?a[l-1]:-1,p=d=!1),r=!0)),o++;r&&this.diff_cleanupMerge(n)},t.prototype.diff_cleanupMerge=function(n){n.push(new t.Diff(0,""));for(var r,a=0,l=0,u=0,o="",c="";a1?(l!==0&&u!==0&&((r=this.diff_commonPrefix(c,o))!==0&&(a-l-u>0&&n[a-l-u-1][0]==0?n[a-l-u-1][1]+=c.substring(0,r):(n.splice(0,0,new t.Diff(0,c.substring(0,r))),a++),c=c.substring(r),o=o.substring(r)),(r=this.diff_commonSuffix(c,o))!==0&&(n[a][1]=c.substring(c.length-r)+n[a][1],c=c.substring(0,c.length-r),o=o.substring(0,o.length-r))),a-=l+u,n.splice(a,l+u),o.length&&(n.splice(a,0,new t.Diff(-1,o)),a++),c.length&&(n.splice(a,0,new t.Diff(1,c)),a++),a++):a!==0&&n[a-1][0]==0?(n[a-1][1]+=n[a][1],n.splice(a,1)):a++,u=0,l=0,o="",c=""}n[n.length-1][1]===""&&n.pop();var f=!1;for(a=1;ar));a++)o=l,c=u;return n.length!=a&&n[a][0]===-1?c:c+(r-o)},t.prototype.diff_prettyHtml=function(n){for(var r=[],a=/&/g,l=//g,o=/\n/g,c=0;c");switch(f){case 1:r[c]=''+p+"";break;case-1:r[c]=''+p+"";break;case 0:r[c]=""+p+""}}return r.join("")},t.prototype.diff_text1=function(n){for(var r=[],a=0;athis.Match_MaxBits)throw new Error("Pattern too long for this browser.");var l=this.match_alphabet_(r),u=this;function o(T,R){var N=T/r.length,M=Math.abs(a-R);return u.Match_Distance?N+M/u.Match_Distance:M?1:N}var c=this.Match_Threshold,f=n.indexOf(r,a);f!=-1&&(c=Math.min(o(0,f),c),(f=n.lastIndexOf(r,a+r.length))!=-1&&(c=Math.min(o(0,f),c)));var p,d,_=1<=y;b--){var k=l[n.charAt(b-1)];if(x[b]=C===0?(x[b+1]<<1|1)&k:(x[b+1]<<1|1)&k|(v[b+1]|v[b])<<1|1|v[b+1],x[b]&_){var D=o(C,b-1);if(D<=c){if(c=D,!((f=b-1)>a))break;y=Math.max(1,2*a-f)}}}if(o(C+1,a)>c)break;v=x}return f},t.prototype.match_alphabet_=function(n){for(var r={},a=0;a2&&(this.diff_cleanupSemantic(u),this.diff_cleanupEfficiency(u));else if(n&&typeof n=="object"&&r===void 0&&a===void 0)u=n,l=this.diff_text1(u);else if(typeof n=="string"&&r&&typeof r=="object"&&a===void 0)l=n,u=r;else{if(typeof n!="string"||typeof r!="string"||!a||typeof a!="object")throw new Error("Unknown call format to patch_make.");l=n,u=a}if(u.length===0)return[];for(var o=[],c=new t.patch_obj,f=0,p=0,d=0,_=l,v=l,w=0;w=2*this.Patch_Margin&&f&&(this.patch_addContext_(c,_),o.push(c),c=new t.patch_obj,f=0,_=v,p=d)}C!==1&&(p+=y.length),C!==-1&&(d+=y.length)}return f&&(this.patch_addContext_(c,_),o.push(c)),o},t.prototype.patch_deepCopy=function(n){for(var r=[],a=0;athis.Match_MaxBits?(c=this.match_main(r,d.substring(0,this.Match_MaxBits),p))!=-1&&((_=this.match_main(r,d.substring(d.length-this.Match_MaxBits),p+d.length-this.Match_MaxBits))==-1||c>=_)&&(c=-1):c=this.match_main(r,d,p),c==-1)u[o]=!1,l-=n[o].length2-n[o].length1;else if(u[o]=!0,l=c-p,d==(f=_==-1?r.substring(c,c+d.length):r.substring(c,_+this.Match_MaxBits)))r=r.substring(0,c)+this.diff_text2(n[o].diffs)+r.substring(c+d.length);else{var v=this.diff_main(d,f,!1);if(d.length>this.Match_MaxBits&&this.diff_levenshtein(v)/d.length>this.Patch_DeleteThreshold)u[o]=!1;else{this.diff_cleanupSemanticLossless(v);for(var w,C=0,y=0;yo[0][1].length){var c=r-o[0][1].length;o[0][1]=a.substring(o[0][1].length)+o[0][1],u.start1-=c,u.start2-=c,u.length1+=c,u.length2+=c}return(o=(u=n[n.length-1]).diffs).length==0||o[o.length-1][0]!=0?(o.push(new t.Diff(0,a)),u.length1+=r,u.length2+=r):r>o[o.length-1][1].length&&(c=r-o[o.length-1][1].length,o[o.length-1][1]+=a.substring(0,c),u.length1+=c,u.length2+=c),a},t.prototype.patch_splitMax=function(n){for(var r=this.Match_MaxBits,a=0;a2*r?(f.length1+=_.length,u+=_.length,p=!1,f.diffs.push(new t.Diff(d,_)),l.diffs.shift()):(_=_.substring(0,r-f.length1-this.Patch_Margin),f.length1+=_.length,u+=_.length,d===0?(f.length2+=_.length,o+=_.length):p=!1,f.diffs.push(new t.Diff(d,_)),_==l.diffs[0][1]?l.diffs.shift():l.diffs[0][1]=l.diffs[0][1].substring(_.length))}c=(c=this.diff_text2(f.diffs)).substring(c.length-this.Patch_Margin);var v=this.diff_text1(l.diffs).substring(0,this.Patch_Margin);v!==""&&(f.length1+=v.length,f.length2+=v.length,f.diffs.length!==0&&f.diffs[f.diffs.length-1][0]===0?f.diffs[f.diffs.length-1][1]+=v:f.diffs.push(new t.Diff(0,v))),p||n.splice(++a,0,f)}}},t.prototype.patch_toText=function(n){for(var r=[],a=0;aa||dr.length?n:r,c=n.length>r.length?r:n,f=o.indexOf(c);if(f!=-1)return u=[new t.Diff(1,o.substring(0,f)),new t.Diff(0,c),new t.Diff(1,o.substring(f+c.length))],n.length>r.length&&(u[0][0]=u[2][0]=-1),u;if(c.length==1)return[new t.Diff(-1,n),new t.Diff(1,r)];var p=this.diff_halfMatch_(n,r);if(p){var d=p[0],_=p[1],v=p[2],w=p[3],C=p[4],b=this.diff_main(d,v,a,l),S=this.diff_main(_,w,a,l);return b.concat([new t.Diff(0,C)],S)}return a&&n.length>100&&r.length>100?this.diff_lineMode_(n,r,l):this.diff_bisect_(n,r,l)},t.prototype.diff_lineMode_=function(n,r,a){var l=this.diff_linesToChars_(n,r);n=l.chars1,r=l.chars2;var u=l.lineArray,o=this.diff_main(n,r,!1,a);this.diff_charsToLines_(o,u),this.diff_cleanupSemantic(o),o.push(new t.Diff(0,""));for(var c=0,f=0,p=0,d="",_="";c=1&&p>=1){o.splice(c-f-p,f+p),c=c-f-p;for(var v=this.diff_main(d,_,!1,a),w=v.length-1;w>=0;w--)o.splice(c,0,v[w]);c+=v.length}p=0,f=0,d="",_=""}c++}return o.pop(),o},t.prototype.diff_bisect_=function(n,r,a){for(var l=n.length,u=r.length,o=Math.ceil((l+u)/2),c=o,f=2*o,p=new Array(f),d=new Array(f),_=0;_a);y++){for(var k=-y+C;k<=y-b;k+=2){for(var D=c+k,T=(H=k==-y||k!=y&&p[D-1]l)b+=2;else if(T>u)C+=2;else if(w&&(M=c+v-k)>=0&&M=(N=l-d[M]))return this.diff_bisectSplit_(n,r,H,T,a)}for(var R=-y+S;R<=y-x;R+=2){for(var N,M=c+R,B=(N=R==-y||R!=y&&d[M-1]l)x+=2;else if(B>u)S+=2;else if(!w&&(D=c+v-R)>=0&&D=(N=l-N))return this.diff_bisectSplit_(n,r,H,T,a)}}}return[new t.Diff(-1,n),new t.Diff(1,r)]},t.prototype.diff_bisectSplit_=function(n,r,a,l,u){var o=n.substring(0,a),c=r.substring(0,l),f=n.substring(a),p=r.substring(l),d=this.diff_main(o,c,!1,u),_=this.diff_main(f,p,!1,u);return d.concat(_)},t.prototype.diff_linesToChars_=function(n,r){var a=[],l={};function u(f){for(var p="",d=0,_=-1,v=a.length;_l?n=n.substring(a-l):ar.length?n:r,l=n.length>r.length?r:n;if(a.length<4||2*l.length=C.length?[x,y,k,D,N]:null}var c,f,p,d,_,v=o(a,l,Math.ceil(a.length/4)),w=o(a,l,Math.ceil(a.length/2));return v||w?(c=w?v&&v[4].length>w[4].length?v:w:v,n.length>r.length?(f=c[0],p=c[1],d=c[2],_=c[3]):(d=c[0],_=c[1],f=c[2],p=c[3]),[f,p,d,_,c[4]]):null},t.prototype.diff_cleanupSemantic=function(n){for(var r=!1,a=[],l=0,u=null,o=0,c=0,f=0,p=0,d=0;o0?a[l-1]:-1,c=0,f=0,p=0,d=0,u=null,r=!0)),o++;for(r&&this.diff_cleanupMerge(n),this.diff_cleanupSemanticLossless(n),o=1;o=C?(w>=_.length/2||w>=v.length/2)&&(n.splice(o,0,new t.Diff(0,v.substring(0,w))),n[o-1][1]=_.substring(0,_.length-w),n[o+1][1]=v.substring(w),o++):(C>=_.length/2||C>=v.length/2)&&(n.splice(o,0,new t.Diff(0,_.substring(0,C))),n[o-1][0]=1,n[o-1][1]=v.substring(0,v.length-C),n[o+1][0]=-1,n[o+1][1]=_.substring(C),o++),o++}o++}},t.prototype.diff_cleanupSemanticLossless=function(n){function r(C,b){if(!C||!b)return 6;var S=C.charAt(C.length-1),x=b.charAt(0),y=S.match(t.nonAlphaNumericRegex_),k=x.match(t.nonAlphaNumericRegex_),D=y&&S.match(t.whitespaceRegex_),T=k&&x.match(t.whitespaceRegex_),R=D&&S.match(t.linebreakRegex_),N=T&&x.match(t.linebreakRegex_),M=R&&C.match(t.blanklineEndRegex_),B=N&&b.match(t.blanklineStartRegex_);return M||B?5:R||N?4:y&&!D&&T?3:D||T?2:y||k?1:0}for(var a=1;a=v&&(v=w,p=l,d=u,_=o)}n[a-1][1]!=p&&(p?n[a-1][1]=p:(n.splice(a-1,1),a--),n[a][1]=d,_?n[a+1][1]=_:(n.splice(a+1,1),a--))}a++}},t.nonAlphaNumericRegex_=/[^a-zA-Z0-9]/,t.whitespaceRegex_=/\s/,t.linebreakRegex_=/[\r\n]/,t.blanklineEndRegex_=/\n\r?\n$/,t.blanklineStartRegex_=/^\r?\n\r?\n/,t.prototype.diff_cleanupEfficiency=function(n){for(var r=!1,a=[],l=0,u=null,o=0,c=!1,f=!1,p=!1,d=!1;o0?a[l-1]:-1,p=d=!1),r=!0)),o++;r&&this.diff_cleanupMerge(n)},t.prototype.diff_cleanupMerge=function(n){n.push(new t.Diff(0,""));for(var r,a=0,l=0,u=0,o="",c="";a1?(l!==0&&u!==0&&((r=this.diff_commonPrefix(c,o))!==0&&(a-l-u>0&&n[a-l-u-1][0]==0?n[a-l-u-1][1]+=c.substring(0,r):(n.splice(0,0,new t.Diff(0,c.substring(0,r))),a++),c=c.substring(r),o=o.substring(r)),(r=this.diff_commonSuffix(c,o))!==0&&(n[a][1]=c.substring(c.length-r)+n[a][1],c=c.substring(0,c.length-r),o=o.substring(0,o.length-r))),a-=l+u,n.splice(a,l+u),o.length&&(n.splice(a,0,new t.Diff(-1,o)),a++),c.length&&(n.splice(a,0,new t.Diff(1,c)),a++),a++):a!==0&&n[a-1][0]==0?(n[a-1][1]+=n[a][1],n.splice(a,1)):a++,u=0,l=0,o="",c=""}n[n.length-1][1]===""&&n.pop();var f=!1;for(a=1;ar));a++)o=l,c=u;return n.length!=a&&n[a][0]===-1?c:c+(r-o)},t.prototype.diff_prettyHtml=function(n){for(var r=[],a=/&/g,l=//g,o=/\n/g,c=0;c");switch(f){case 1:r[c]=''+p+"";break;case-1:r[c]=''+p+"";break;case 0:r[c]=""+p+""}}return r.join("")},t.prototype.diff_text1=function(n){for(var r=[],a=0;athis.Match_MaxBits)throw new Error("Pattern too long for this browser.");var l=this.match_alphabet_(r),u=this;function o(T,R){var N=T/r.length,M=Math.abs(a-R);return u.Match_Distance?N+M/u.Match_Distance:M?1:N}var c=this.Match_Threshold,f=n.indexOf(r,a);f!=-1&&(c=Math.min(o(0,f),c),(f=n.lastIndexOf(r,a+r.length))!=-1&&(c=Math.min(o(0,f),c)));var p,d,_=1<=b;y--){var k=l[n.charAt(y-1)];if(x[y]=C===0?(x[y+1]<<1|1)&k:(x[y+1]<<1|1)&k|(v[y+1]|v[y])<<1|1|v[y+1],x[y]&_){var D=o(C,y-1);if(D<=c){if(c=D,!((f=y-1)>a))break;b=Math.max(1,2*a-f)}}}if(o(C+1,a)>c)break;v=x}return f},t.prototype.match_alphabet_=function(n){for(var r={},a=0;a2&&(this.diff_cleanupSemantic(u),this.diff_cleanupEfficiency(u));else if(n&&typeof n=="object"&&r===void 0&&a===void 0)u=n,l=this.diff_text1(u);else if(typeof n=="string"&&r&&typeof r=="object"&&a===void 0)l=n,u=r;else{if(typeof n!="string"||typeof r!="string"||!a||typeof a!="object")throw new Error("Unknown call format to patch_make.");l=n,u=a}if(u.length===0)return[];for(var o=[],c=new t.patch_obj,f=0,p=0,d=0,_=l,v=l,w=0;w=2*this.Patch_Margin&&f&&(this.patch_addContext_(c,_),o.push(c),c=new t.patch_obj,f=0,_=v,p=d)}C!==1&&(p+=b.length),C!==-1&&(d+=b.length)}return f&&(this.patch_addContext_(c,_),o.push(c)),o},t.prototype.patch_deepCopy=function(n){for(var r=[],a=0;athis.Match_MaxBits?(c=this.match_main(r,d.substring(0,this.Match_MaxBits),p))!=-1&&((_=this.match_main(r,d.substring(d.length-this.Match_MaxBits),p+d.length-this.Match_MaxBits))==-1||c>=_)&&(c=-1):c=this.match_main(r,d,p),c==-1)u[o]=!1,l-=n[o].length2-n[o].length1;else if(u[o]=!0,l=c-p,d==(f=_==-1?r.substring(c,c+d.length):r.substring(c,_+this.Match_MaxBits)))r=r.substring(0,c)+this.diff_text2(n[o].diffs)+r.substring(c+d.length);else{var v=this.diff_main(d,f,!1);if(d.length>this.Match_MaxBits&&this.diff_levenshtein(v)/d.length>this.Patch_DeleteThreshold)u[o]=!1;else{this.diff_cleanupSemanticLossless(v);for(var w,C=0,b=0;bo[0][1].length){var c=r-o[0][1].length;o[0][1]=a.substring(o[0][1].length)+o[0][1],u.start1-=c,u.start2-=c,u.length1+=c,u.length2+=c}return(o=(u=n[n.length-1]).diffs).length==0||o[o.length-1][0]!=0?(o.push(new t.Diff(0,a)),u.length1+=r,u.length2+=r):r>o[o.length-1][1].length&&(c=r-o[o.length-1][1].length,o[o.length-1][1]+=a.substring(0,c),u.length1+=c,u.length2+=c),a},t.prototype.patch_splitMax=function(n){for(var r=this.Match_MaxBits,a=0;a2*r?(f.length1+=_.length,u+=_.length,p=!1,f.diffs.push(new t.Diff(d,_)),l.diffs.shift()):(_=_.substring(0,r-f.length1-this.Patch_Margin),f.length1+=_.length,u+=_.length,d===0?(f.length2+=_.length,o+=_.length):p=!1,f.diffs.push(new t.Diff(d,_)),_==l.diffs[0][1]?l.diffs.shift():l.diffs[0][1]=l.diffs[0][1].substring(_.length))}c=(c=this.diff_text2(f.diffs)).substring(c.length-this.Patch_Margin);var v=this.diff_text1(l.diffs).substring(0,this.Patch_Margin);v!==""&&(f.length1+=v.length,f.length2+=v.length,f.diffs.length!==0&&f.diffs[f.diffs.length-1][0]===0?f.diffs[f.diffs.length-1][1]+=v:f.diffs.push(new t.Diff(0,v))),p||n.splice(++a,0,f)}}},t.prototype.patch_toText=function(n){for(var r=[],a=0;a1&&arguments[1]!==void 0?arguments[1]:{}).type,n=(t===void 0?"block":t)==="block"?M8:L8,r=wm(e.map((function(o){return o.changes})),rC).map(n).reduce((function(o,c){var f=Qe(o,2),p=f[0],d=f[1],_=Qe(c,2),v=_[0],w=_[1];return[p.concat(v),d.concat(w)]}),[[],[]]),a=Qe(r,2),l=a[0],u=a[1];return A8(db(l),db(u))}var j8=["enhancers"],_b=function(e){var t,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=n.enhancers,a=r===void 0?[]:r,l=Qe(f8(e,Sr(n,j8)),2),u=l[0],o=l[1],c=[ub(u),ub(o)],f=(t=[c[0],c[1]],a.reduce((function(C,y){return y(C)}),t)),p=Qe(f,2),d=p[0],_=p[1],v=[d.map(hb),_.map(hb)],w=v[1];return{old:v[0].map((function(C){var y;return(y=C.children)!==null&&y!==void 0?y:[]})),new:w.map((function(C){var y;return(y=C.children)!==null&&y!==void 0?y:[]}))}};const B8=2e3,I8={highlight(e,t){return Me.highlight(e,t).children}};function z8(e){return e.type==="normal"?e.newLineNumber:e.lineNumber}function H8(e){let t=0,n=0;for(const r of e.hunks)for(const a of r.changes)a.type==="insert"?t++:a.type==="delete"&&n++;return{additions:t,deletions:n}}function F8(e){return e.newPath==="/dev/null"?e.oldPath:(e.oldPath==="/dev/null",e.newPath)}function P8(e){switch(e.type){case"delete":return e.oldPath;case"add":case"modify":return e.newPath;case"rename":case"copy":return`${e.oldPath} → ${e.newPath}`}}function U8(e){const t=[O8(e.hunks,{type:"line"})],n=aw(F8(e));return n&&Me.registered(n)?_b(e.hunks,{enhancers:t,highlight:!0,language:n,refractor:I8}):_b(e.hunks,{enhancers:t,highlight:!1})}const $8=({change:e,side:t})=>t==="old"?null:z8(e);function vb(e){return e>=1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:`${(e/1024).toFixed(1)} KB`}function G8({bytesRead:e,byteLimit:t}){return m.jsxs("div",{className:"truncated-notice",children:[m.jsx("h4",{children:"Diff too large to display"}),m.jsxs("p",{children:["This diff is larger than ",vb(t)," (",vb(e)," read). View it locally with git."]})]})}function q8({file:e,defaultExpanded:t}){const[n,r]=V.useState(t),{additions:a,deletions:l}=V.useMemo(()=>H8(e),[e]),u=n&&a+l<=B8,o=V.useMemo(()=>{if(u)try{return U8(e)}catch{return}},[e,u]);return m.jsxs("section",{className:"diff-file-card",children:[m.jsxs("button",{className:"diff-file-header",onClick:()=>r(c=>!c),children:[m.jsx("span",{className:"chev",children:n?m.jsx(ga,{size:14}):m.jsx(Pu,{size:14})}),m.jsx("span",{className:"path",children:m.jsx("code",{children:P8(e)})}),m.jsxs("span",{className:"stats",children:[m.jsxs("span",{className:"diff-stat-add",children:["+",a]}),m.jsxs("span",{className:"diff-stat-del",children:["−",l]})]})]}),n&&(e.hunks.length===0?m.jsx("div",{className:"diff-empty",children:"No textual diff for this file."}):m.jsx(n8,{className:"openresearch-diff-file",diffType:e.type,gutterType:"default",hunks:e.hunks,renderGutter:$8,tokens:o,viewType:"unified"}))]})}function aC({diff:e,className:t}){const n=V.useMemo(()=>{if(!e.trim())return[];try{return LO(e,{nearbySequences:"zip"})}catch{return[]}},[e]);return n.length===0?m.jsx("div",{className:"diff-empty",children:"No changes."}):m.jsx("div",{className:t?`openresearch-diff ${t}`:"openresearch-diff",children:n.map((r,a)=>m.jsx(q8,{file:r,defaultExpanded:a===0},`${r.oldPath}→${r.newPath}#${a}`))})}var dp={exports:{}},yb;function V8(){return yb||(yb=1,(function(e,t){(function(n,r){e.exports=r()})(self,(()=>(()=>{var n={};return(()=>{var r=n;Object.defineProperty(r,"__esModule",{value:!0}),r.FitAddon=void 0,r.FitAddon=class{activate(a){this._terminal=a}dispose(){}fit(){const a=this.proposeDimensions();if(!a||!this._terminal||isNaN(a.cols)||isNaN(a.rows))return;const l=this._terminal._core;this._terminal.rows===a.rows&&this._terminal.cols===a.cols||(l._renderService.clear(),this._terminal.resize(a.cols,a.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const a=this._terminal._core,l=a._renderService.dimensions;if(l.css.cell.width===0||l.css.cell.height===0)return;const u=this._terminal.options.scrollback===0?0:a.viewport.scrollBarWidth,o=window.getComputedStyle(this._terminal.element.parentElement),c=parseInt(o.getPropertyValue("height")),f=Math.max(0,parseInt(o.getPropertyValue("width"))),p=window.getComputedStyle(this._terminal.element),d=c-(parseInt(p.getPropertyValue("padding-top"))+parseInt(p.getPropertyValue("padding-bottom"))),_=f-(parseInt(p.getPropertyValue("padding-right"))+parseInt(p.getPropertyValue("padding-left")))-u;return{cols:Math.max(2,Math.floor(_/l.css.cell.width)),rows:Math.max(1,Math.floor(d/l.css.cell.height))}}}})(),n})()))})(dp)),dp.exports}var Y8=V8(),pp={exports:{}},bb;function W8(){return bb||(bb=1,(function(e,t){(function(n,r){e.exports=r()})(globalThis,(()=>(()=>{var n={4567:function(u,o,c){var f=this&&this.__decorate||function(x,b,k,D){var T,R=arguments.length,N=R<3?b:D===null?D=Object.getOwnPropertyDescriptor(b,k):D;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(x,b,k,D);else for(var M=x.length-1;M>=0;M--)(T=x[M])&&(N=(R<3?T(N):R>3?T(b,k,N):T(b,k))||N);return R>3&&N&&Object.defineProperty(b,k,N),N},p=this&&this.__param||function(x,b){return function(k,D){b(k,D,x)}};Object.defineProperty(o,"__esModule",{value:!0}),o.AccessibilityManager=void 0;const d=c(9042),_=c(9924),v=c(844),w=c(4725),C=c(2585),y=c(3656);let S=o.AccessibilityManager=class extends v.Disposable{constructor(x,b,k,D){super(),this._terminal=x,this._coreBrowserService=k,this._renderService=D,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 T=0;Tthis._handleBoundaryFocus(T,0),this._bottomBoundaryFocusListener=T=>this._handleBoundaryFocus(T,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 _.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((T=>this._handleResize(T.rows)))),this.register(this._terminal.onRender((T=>this._refreshRows(T.start,T.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((T=>this._handleChar(T)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(` -`)))),this.register(this._terminal.onA11yTab((T=>this._handleTab(T)))),this.register(this._terminal.onKey((T=>this._handleKey(T.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this.register((0,y.addDisposableDomListener)(document,"selectionchange",(()=>this._handleSelectionChange()))),this.register(this._coreBrowserService.onDprChange((()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,v.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(x){for(let b=0;b0?this._charsToConsume.shift()!==x&&(this._charsToAnnounce+=x):this._charsToAnnounce+=x,x===` -`&&(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 k=this._terminal.buffer,D=k.lines.length.toString();for(let T=x;T<=b;T++){const R=k.lines.get(k.ydisp+T),N=[],M=(R==null?void 0:R.translateToString(!0,void 0,void 0,N))||"",B=(k.ydisp+T+1).toString(),H=this._rowElements[T];H&&(M.length===0?(H.innerText=" ",this._rowColumns.set(H,[0,1])):(H.textContent=M,this._rowColumns.set(H,N)),H.setAttribute("aria-posinset",B),H.setAttribute("aria-setsize",D))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(x,b){const k=x.target,D=this._rowElements[b===0?1:this._rowElements.length-2];if(k.getAttribute("aria-posinset")===(b===0?"1":`${this._terminal.buffer.lines.length}`)||x.relatedTarget!==D)return;let T,R;if(b===0?(T=k,R=this._rowElements.pop(),this._rowContainer.removeChild(R)):(T=this._rowElements.shift(),R=k,this._rowContainer.removeChild(T)),T.removeEventListener("focus",this._topBoundaryFocusListener),R.removeEventListener("focus",this._bottomBoundaryFocusListener),b===0){const N=this._createAccessibilityTreeNode();this._rowElements.unshift(N),this._rowContainer.insertAdjacentElement("afterbegin",N)}else{const N=this._createAccessibilityTreeNode();this._rowElements.push(N),this._rowContainer.appendChild(N)}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 M;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},k={node:x.focusNode,offset:x.focusOffset};if((b.node.compareDocumentPosition(k.node)&Node.DOCUMENT_POSITION_PRECEDING||b.node===k.node&&b.offset>k.offset)&&([b,k]=[k,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 D=this._rowElements.slice(-1)[0];if(k.node.compareDocumentPosition(D)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(k={node:D,offset:((M=D.textContent)==null?void 0:M.length)??0}),!this._rowContainer.contains(k.node))return;const T=({node:B,offset:H})=>{const Y=B instanceof Text?B.parentNode:B;let F=parseInt(Y==null?void 0:Y.getAttribute("aria-posinset"),10)-1;if(isNaN(F))return console.warn("row is invalid. Race condition?"),null;const z=this._rowColumns.get(Y);if(!z)return console.warn("columns is null. Race condition?"),null;let q=H=this._terminal.cols&&(++F,q=0),{row:F,column:q}},R=T(b),N=T(k);if(R&&N){if(R.row>N.row||R.row===N.row&&R.column>=N.column)throw new Error("invalid range");this._terminal.select(R.column,R.row,(N.row-R.row)*this._terminal.cols-R.column+N.column)}}_handleResize(x){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let b=this._rowContainer.children.length;bx;)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{function c(_){return _.replace(/\r?\n/g,"\r")}function f(_,v){return v?"\x1B[200~"+_+"\x1B[201~":_}function p(_,v,w,C){_=f(_=c(_),w.decPrivateModes.bracketedPasteMode&&C.rawOptions.ignoreBracketedPasteMode!==!0),w.triggerDataEvent(_,!0),v.value=""}function d(_,v,w){const C=w.getBoundingClientRect(),y=_.clientX-C.left-10,S=_.clientY-C.top-10;v.style.width="20px",v.style.height="20px",v.style.left=`${y}px`,v.style.top=`${S}px`,v.style.zIndex="1000",v.focus()}Object.defineProperty(o,"__esModule",{value:!0}),o.rightClickHandler=o.moveTextAreaUnderMouseCursor=o.paste=o.handlePasteEvent=o.copyHandler=o.bracketTextForPaste=o.prepareTextForTerminal=void 0,o.prepareTextForTerminal=c,o.bracketTextForPaste=f,o.copyHandler=function(_,v){_.clipboardData&&_.clipboardData.setData("text/plain",v.selectionText),_.preventDefault()},o.handlePasteEvent=function(_,v,w,C){_.stopPropagation(),_.clipboardData&&p(_.clipboardData.getData("text/plain"),v,w,C)},o.paste=p,o.moveTextAreaUnderMouseCursor=d,o.rightClickHandler=function(_,v,w,C,y){d(_,v,w),y&&C.rightClickSelect(_),v.value=C.selectionText,v.select()}},7239:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.ColorContrastCache=void 0;const f=c(1505);o.ColorContrastCache=class{constructor(){this._color=new f.TwoKeyMap,this._css=new f.TwoKeyMap}setCss(p,d,_){this._css.set(p,d,_)}getCss(p,d){return this._css.get(p,d)}setColor(p,d,_){this._color.set(p,d,_)}getColor(p,d){return this._color.get(p,d)}clear(){this._color.clear(),this._css.clear()}}},3656:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.addDisposableDomListener=void 0,o.addDisposableDomListener=function(c,f,p,d){c.addEventListener(f,p,d);let _=!1;return{dispose:()=>{_||(_=!0,c.removeEventListener(f,p,d))}}}},3551:function(u,o,c){var f=this&&this.__decorate||function(S,x,b,k){var D,T=arguments.length,R=T<3?x:k===null?k=Object.getOwnPropertyDescriptor(x,b):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(S,x,b,k);else for(var N=S.length-1;N>=0;N--)(D=S[N])&&(R=(T<3?D(R):T>3?D(x,b,R):D(x,b))||R);return T>3&&R&&Object.defineProperty(x,b,R),R},p=this&&this.__param||function(S,x){return function(b,k){x(b,k,S)}};Object.defineProperty(o,"__esModule",{value:!0}),o.Linkifier=void 0;const d=c(3656),_=c(8460),v=c(844),w=c(2585),C=c(4725);let y=o.Linkifier=class extends v.Disposable{get currentLink(){return this._currentLink}constructor(S,x,b,k,D){super(),this._element=S,this._mouseService=x,this._renderService=b,this._bufferService=k,this._linkProviderService=D,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new _.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new _.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,v.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,v.toDisposable)((()=>{var T;this._lastMouseEvent=void 0,(T=this._activeProviderReplies)==null||T.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(S){this._lastMouseEvent=S;const x=this._positionFromMouseEvent(S,this._element,this._mouseService);if(!x)return;this._isMouseOut=!1;const b=S.composedPath();for(let k=0;k{T==null||T.forEach((R=>{R.link.dispose&&R.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=S.y);let b=!1;for(const[T,R]of this._linkProviderService.linkProviders.entries())x?(D=this._activeProviderReplies)!=null&&D.get(T)&&(b=this._checkLinkProviderResult(T,S,b)):R.provideLinks(S.y,(N=>{var B,H;if(this._isMouseOut)return;const M=N==null?void 0:N.map((Y=>({link:Y})));(B=this._activeProviderReplies)==null||B.set(T,M),b=this._checkLinkProviderResult(T,S,b),((H=this._activeProviderReplies)==null?void 0:H.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(S.y,this._activeProviderReplies)}))}_removeIntersectingLinks(S,x){const b=new Set;for(let k=0;kS?this._bufferService.cols:R.link.range.end.x;for(let B=N;B<=M;B++){if(b.has(B)){D.splice(T--,1);break}b.add(B)}}}}_checkLinkProviderResult(S,x,b){var T;if(!this._activeProviderReplies)return b;const k=this._activeProviderReplies.get(S);let D=!1;for(let R=0;Rthis._linkAtPosition(N.link,x)));R&&(b=!0,this._handleNewLink(R))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!b)for(let R=0;Rthis._linkAtPosition(M.link,x)));if(N){b=!0,this._handleNewLink(N);break}}return b}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(S){if(!this._currentLink)return;const x=this._positionFromMouseEvent(S,this._element,this._mouseService);x&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,x)&&this._currentLink.link.activate(S,this._currentLink.link.text)}_clearCurrentLink(S,x){this._currentLink&&this._lastMouseEvent&&(!S||!x||this._currentLink.link.range.start.y>=S&&this._currentLink.link.range.end.y<=x)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,v.disposeArray)(this._linkCacheDisposables))}_handleNewLink(S){if(!this._lastMouseEvent)return;const x=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);x&&this._linkAtPosition(S.link,x)&&(this._currentLink=S,this._currentLink.state={decorations:{underline:S.link.decorations===void 0||S.link.decorations.underline,pointerCursor:S.link.decorations===void 0||S.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,S.link,this._lastMouseEvent),S.link.decorations={},Object.defineProperties(S.link.decorations,{pointerCursor:{get:()=>{var b,k;return(k=(b=this._currentLink)==null?void 0:b.state)==null?void 0:k.decorations.pointerCursor},set:b=>{var k;(k=this._currentLink)!=null&&k.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,k;return(k=(b=this._currentLink)==null?void 0:b.state)==null?void 0:k.decorations.underline},set:b=>{var k,D,T;(k=this._currentLink)!=null&&k.state&&((T=(D=this._currentLink)==null?void 0:D.state)==null?void 0:T.decorations.underline)!==b&&(this._currentLink.state.decorations.underline=b,this._currentLink.state.isHovered&&this._fireUnderlineEvent(S.link,b))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((b=>{if(!this._currentLink)return;const k=b.start===0?0:b.start+1+this._bufferService.buffer.ydisp,D=this._bufferService.buffer.ydisp+1+b.end;if(this._currentLink.link.range.start.y>=k&&this._currentLink.link.range.end.y<=D&&(this._clearCurrentLink(k,D),this._lastMouseEvent)){const T=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);T&&this._askForLink(T,!1)}}))))}_linkHover(S,x,b){var k;(k=this._currentLink)!=null&&k.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(x,!0),this._currentLink.state.decorations.pointerCursor&&S.classList.add("xterm-cursor-pointer")),x.hover&&x.hover(b,x.text)}_fireUnderlineEvent(S,x){const b=S.range,k=this._bufferService.buffer.ydisp,D=this._createLinkUnderlineEvent(b.start.x-1,b.start.y-k-1,b.end.x,b.end.y-k-1,void 0);(x?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(D)}_linkLeave(S,x,b){var k;(k=this._currentLink)!=null&&k.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(x,!1),this._currentLink.state.decorations.pointerCursor&&S.classList.remove("xterm-cursor-pointer")),x.leave&&x.leave(b,x.text)}_linkAtPosition(S,x){const b=S.range.start.y*this._bufferService.cols+S.range.start.x,k=S.range.end.y*this._bufferService.cols+S.range.end.x,D=x.y*this._bufferService.cols+x.x;return b<=D&&D<=k}_positionFromMouseEvent(S,x,b){const k=b.getCoords(S,x,this._bufferService.cols,this._bufferService.rows);if(k)return{x:k[0],y:k[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(S,x,b,k,D){return{x1:S,y1:x,x2:b,y2:k,cols:this._bufferService.cols,fg:D}}};o.Linkifier=y=f([p(1,C.IMouseService),p(2,C.IRenderService),p(3,w.IBufferService),p(4,C.ILinkProviderService)],y)},9042:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.tooMuchOutput=o.promptLabel=void 0,o.promptLabel="Terminal input",o.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(u,o,c){var f=this&&this.__decorate||function(C,y,S,x){var b,k=arguments.length,D=k<3?y:x===null?x=Object.getOwnPropertyDescriptor(y,S):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(C,y,S,x);else for(var T=C.length-1;T>=0;T--)(b=C[T])&&(D=(k<3?b(D):k>3?b(y,S,D):b(y,S))||D);return k>3&&D&&Object.defineProperty(y,S,D),D},p=this&&this.__param||function(C,y){return function(S,x){y(S,x,C)}};Object.defineProperty(o,"__esModule",{value:!0}),o.OscLinkProvider=void 0;const d=c(511),_=c(2585);let v=o.OscLinkProvider=class{constructor(C,y,S){this._bufferService=C,this._optionsService=y,this._oscLinkService=S}provideLinks(C,y){var M;const S=this._bufferService.buffer.lines.get(C-1);if(!S)return void y(void 0);const x=[],b=this._optionsService.rawOptions.linkHandler,k=new d.CellData,D=S.getTrimmedLength();let T=-1,R=-1,N=!1;for(let B=0;Bb?b.activate(z,q,Y):w(0,q),hover:(z,q)=>{var G;return(G=b==null?void 0:b.hover)==null?void 0:G.call(b,z,q,Y)},leave:(z,q)=>{var G;return(G=b==null?void 0:b.leave)==null?void 0:G.call(b,z,q,Y)}})}N=!1,k.hasExtendedAttrs()&&k.extended.urlId?(R=B,T=k.extended.urlId):(R=-1,T=-1)}}y(x)}};function w(C,y){if(confirm(`Do you want to navigate to ${y}? +`:"")+p.content]}),["",""]),n=et(t,2),r=et(aC(n[0],n[1]),2),a=r[0],l=r[1];if(a.length===0&&l.length===0)return[[],[]];var u=function(f){if(f&&!Ii(f))return f.lineNumber},o=u(e.find(Mn)),c=u(e.find(wr));if(o===void 0||c===void 0)throw new Error("Could not find start line number for edit");return[mb(gb(a),o),mb(gb(l),c)]}function O8(e){var t=e.reduce((function(r,a){var l=et(r,3),u=l[0],o=l[1],c=l[2];if(!c||!Mn(c)||!wr(a))return[u,o,a];var f=et(aC(c.content,a.content),2),p=f[0],d=f[1];return[u.concat(ng(p,c.lineNumber)),o.concat(ng(d,a.lineNumber)),a]}),[[],[],null]),n=et(t,2);return[n[0],n[1]]}function j8(e){var t=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:{}).type,n=(t===void 0?"block":t)==="block"?L8:O8,r=wm(e.map((function(o){return o.changes})),sC).map(n).reduce((function(o,c){var f=et(o,2),p=f[0],d=f[1],_=et(c,2),v=_[0],w=_[1];return[p.concat(v),d.concat(w)]}),[[],[]]),a=et(r,2),l=a[0],u=a[1];return T8(db(l),db(u))}var B8=["enhancers"],_b=function(e){var t,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=n.enhancers,a=r===void 0?[]:r,l=et(d8(e,Sr(n,B8)),2),u=l[0],o=l[1],c=[ub(u),ub(o)],f=(t=[c[0],c[1]],a.reduce((function(C,b){return b(C)}),t)),p=et(f,2),d=p[0],_=p[1],v=[d.map(hb),_.map(hb)],w=v[1];return{old:v[0].map((function(C){var b;return(b=C.children)!==null&&b!==void 0?b:[]})),new:w.map((function(C){var b;return(b=C.children)!==null&&b!==void 0?b:[]}))}};const I8=2e3,z8={highlight(e,t){return Me.highlight(e,t).children}};function H8(e){return e.type==="normal"?e.newLineNumber:e.lineNumber}function F8(e){let t=0,n=0;for(const r of e.hunks)for(const a of r.changes)a.type==="insert"?t++:a.type==="delete"&&n++;return{additions:t,deletions:n}}function P8(e){return e.newPath==="/dev/null"?e.oldPath:(e.oldPath==="/dev/null",e.newPath)}function U8(e){switch(e.type){case"delete":return e.oldPath;case"add":case"modify":return e.newPath;case"rename":case"copy":return`${e.oldPath} → ${e.newPath}`}}function $8(e){const t=[j8(e.hunks,{type:"line"})],n=aw(P8(e));return n&&Me.registered(n)?_b(e.hunks,{enhancers:t,highlight:!0,language:n,refractor:z8}):_b(e.hunks,{enhancers:t,highlight:!1})}const G8=({change:e,side:t})=>t==="old"?null:H8(e);function vb(e){return e>=1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:`${(e/1024).toFixed(1)} KB`}function q8({bytesRead:e,byteLimit:t}){return m.jsxs("div",{className:"truncated-notice",children:[m.jsx("h4",{children:"Diff too large to display"}),m.jsxs("p",{children:["This diff is larger than ",vb(t)," (",vb(e)," read). View it locally with git."]})]})}function V8({file:e,defaultExpanded:t}){const[n,r]=V.useState(t),{additions:a,deletions:l}=V.useMemo(()=>F8(e),[e]),u=n&&a+l<=I8,o=V.useMemo(()=>{if(u)try{return $8(e)}catch{return}},[e,u]);return m.jsxs("section",{className:"diff-file-card",children:[m.jsxs("button",{className:"diff-file-header",onClick:()=>r(c=>!c),children:[m.jsx("span",{className:"chev",children:n?m.jsx(pa,{size:14}):m.jsx(Fu,{size:14})}),m.jsx("span",{className:"path",children:m.jsx("code",{children:U8(e)})}),m.jsxs("span",{className:"stats",children:[m.jsxs("span",{className:"diff-stat-add",children:["+",a]}),m.jsxs("span",{className:"diff-stat-del",children:["−",l]})]})]}),n&&(e.hunks.length===0?m.jsx("div",{className:"diff-empty",children:"No textual diff for this file."}):m.jsx(i8,{className:"openresearch-diff-file",diffType:e.type,gutterType:"default",hunks:e.hunks,renderGutter:G8,tokens:o,viewType:"unified"}))]})}function oC({diff:e,className:t}){const n=V.useMemo(()=>{if(!e.trim())return[];try{return OO(e,{nearbySequences:"zip"})}catch{return[]}},[e]);return n.length===0?m.jsx("div",{className:"diff-empty",children:"No changes."}):m.jsx("div",{className:t?`openresearch-diff ${t}`:"openresearch-diff",children:n.map((r,a)=>m.jsx(V8,{file:r,defaultExpanded:a===0},`${r.oldPath}→${r.newPath}#${a}`))})}var fp={exports:{}},yb;function Y8(){return yb||(yb=1,(function(e,t){(function(n,r){e.exports=r()})(self,(()=>(()=>{var n={};return(()=>{var r=n;Object.defineProperty(r,"__esModule",{value:!0}),r.FitAddon=void 0,r.FitAddon=class{activate(a){this._terminal=a}dispose(){}fit(){const a=this.proposeDimensions();if(!a||!this._terminal||isNaN(a.cols)||isNaN(a.rows))return;const l=this._terminal._core;this._terminal.rows===a.rows&&this._terminal.cols===a.cols||(l._renderService.clear(),this._terminal.resize(a.cols,a.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const a=this._terminal._core,l=a._renderService.dimensions;if(l.css.cell.width===0||l.css.cell.height===0)return;const u=this._terminal.options.scrollback===0?0:a.viewport.scrollBarWidth,o=window.getComputedStyle(this._terminal.element.parentElement),c=parseInt(o.getPropertyValue("height")),f=Math.max(0,parseInt(o.getPropertyValue("width"))),p=window.getComputedStyle(this._terminal.element),d=c-(parseInt(p.getPropertyValue("padding-top"))+parseInt(p.getPropertyValue("padding-bottom"))),_=f-(parseInt(p.getPropertyValue("padding-right"))+parseInt(p.getPropertyValue("padding-left")))-u;return{cols:Math.max(2,Math.floor(_/l.css.cell.width)),rows:Math.max(1,Math.floor(d/l.css.cell.height))}}}})(),n})()))})(fp)),fp.exports}var W8=Y8(),dp={exports:{}},bb;function X8(){return bb||(bb=1,(function(e,t){(function(n,r){e.exports=r()})(globalThis,(()=>(()=>{var n={4567:function(u,o,c){var f=this&&this.__decorate||function(x,y,k,D){var T,R=arguments.length,N=R<3?y:D===null?D=Object.getOwnPropertyDescriptor(y,k):D;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(x,y,k,D);else for(var M=x.length-1;M>=0;M--)(T=x[M])&&(N=(R<3?T(N):R>3?T(y,k,N):T(y,k))||N);return R>3&&N&&Object.defineProperty(y,k,N),N},p=this&&this.__param||function(x,y){return function(k,D){y(k,D,x)}};Object.defineProperty(o,"__esModule",{value:!0}),o.AccessibilityManager=void 0;const d=c(9042),_=c(9924),v=c(844),w=c(4725),C=c(2585),b=c(3656);let S=o.AccessibilityManager=class extends v.Disposable{constructor(x,y,k,D){super(),this._terminal=x,this._coreBrowserService=k,this._renderService=D,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 T=0;Tthis._handleBoundaryFocus(T,0),this._bottomBoundaryFocusListener=T=>this._handleBoundaryFocus(T,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 _.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((T=>this._handleResize(T.rows)))),this.register(this._terminal.onRender((T=>this._refreshRows(T.start,T.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((T=>this._handleChar(T)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(` +`)))),this.register(this._terminal.onA11yTab((T=>this._handleTab(T)))),this.register(this._terminal.onKey((T=>this._handleKey(T.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this.register((0,b.addDisposableDomListener)(document,"selectionchange",(()=>this._handleSelectionChange()))),this.register(this._coreBrowserService.onDprChange((()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,v.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(x){for(let y=0;y0?this._charsToConsume.shift()!==x&&(this._charsToAnnounce+=x):this._charsToAnnounce+=x,x===` +`&&(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,y){this._liveRegionDebouncer.refresh(x,y,this._terminal.rows)}_renderRows(x,y){const k=this._terminal.buffer,D=k.lines.length.toString();for(let T=x;T<=y;T++){const R=k.lines.get(k.ydisp+T),N=[],M=(R==null?void 0:R.translateToString(!0,void 0,void 0,N))||"",B=(k.ydisp+T+1).toString(),H=this._rowElements[T];H&&(M.length===0?(H.innerText=" ",this._rowColumns.set(H,[0,1])):(H.textContent=M,this._rowColumns.set(H,N)),H.setAttribute("aria-posinset",B),H.setAttribute("aria-setsize",D))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(x,y){const k=x.target,D=this._rowElements[y===0?1:this._rowElements.length-2];if(k.getAttribute("aria-posinset")===(y===0?"1":`${this._terminal.buffer.lines.length}`)||x.relatedTarget!==D)return;let T,R;if(y===0?(T=k,R=this._rowElements.pop(),this._rowContainer.removeChild(R)):(T=this._rowElements.shift(),R=k,this._rowContainer.removeChild(T)),T.removeEventListener("focus",this._topBoundaryFocusListener),R.removeEventListener("focus",this._bottomBoundaryFocusListener),y===0){const N=this._createAccessibilityTreeNode();this._rowElements.unshift(N),this._rowContainer.insertAdjacentElement("afterbegin",N)}else{const N=this._createAccessibilityTreeNode();this._rowElements.push(N),this._rowContainer.appendChild(N)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(y===0?-1:1),this._rowElements[y===0?1:this._rowElements.length-2].focus(),x.preventDefault(),x.stopImmediatePropagation()}_handleSelectionChange(){var M;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 y={node:x.anchorNode,offset:x.anchorOffset},k={node:x.focusNode,offset:x.focusOffset};if((y.node.compareDocumentPosition(k.node)&Node.DOCUMENT_POSITION_PRECEDING||y.node===k.node&&y.offset>k.offset)&&([y,k]=[k,y]),y.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(y={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(y.node))return;const D=this._rowElements.slice(-1)[0];if(k.node.compareDocumentPosition(D)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(k={node:D,offset:((M=D.textContent)==null?void 0:M.length)??0}),!this._rowContainer.contains(k.node))return;const T=({node:B,offset:H})=>{const Y=B instanceof Text?B.parentNode:B;let F=parseInt(Y==null?void 0:Y.getAttribute("aria-posinset"),10)-1;if(isNaN(F))return console.warn("row is invalid. Race condition?"),null;const z=this._rowColumns.get(Y);if(!z)return console.warn("columns is null. Race condition?"),null;let q=H=this._terminal.cols&&(++F,q=0),{row:F,column:q}},R=T(y),N=T(k);if(R&&N){if(R.row>N.row||R.row===N.row&&R.column>=N.column)throw new Error("invalid range");this._terminal.select(R.column,R.row,(N.row-R.row)*this._terminal.cols-R.column+N.column)}}_handleResize(x){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let y=this._rowContainer.children.length;yx;)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{function c(_){return _.replace(/\r?\n/g,"\r")}function f(_,v){return v?"\x1B[200~"+_+"\x1B[201~":_}function p(_,v,w,C){_=f(_=c(_),w.decPrivateModes.bracketedPasteMode&&C.rawOptions.ignoreBracketedPasteMode!==!0),w.triggerDataEvent(_,!0),v.value=""}function d(_,v,w){const C=w.getBoundingClientRect(),b=_.clientX-C.left-10,S=_.clientY-C.top-10;v.style.width="20px",v.style.height="20px",v.style.left=`${b}px`,v.style.top=`${S}px`,v.style.zIndex="1000",v.focus()}Object.defineProperty(o,"__esModule",{value:!0}),o.rightClickHandler=o.moveTextAreaUnderMouseCursor=o.paste=o.handlePasteEvent=o.copyHandler=o.bracketTextForPaste=o.prepareTextForTerminal=void 0,o.prepareTextForTerminal=c,o.bracketTextForPaste=f,o.copyHandler=function(_,v){_.clipboardData&&_.clipboardData.setData("text/plain",v.selectionText),_.preventDefault()},o.handlePasteEvent=function(_,v,w,C){_.stopPropagation(),_.clipboardData&&p(_.clipboardData.getData("text/plain"),v,w,C)},o.paste=p,o.moveTextAreaUnderMouseCursor=d,o.rightClickHandler=function(_,v,w,C,b){d(_,v,w),b&&C.rightClickSelect(_),v.value=C.selectionText,v.select()}},7239:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.ColorContrastCache=void 0;const f=c(1505);o.ColorContrastCache=class{constructor(){this._color=new f.TwoKeyMap,this._css=new f.TwoKeyMap}setCss(p,d,_){this._css.set(p,d,_)}getCss(p,d){return this._css.get(p,d)}setColor(p,d,_){this._color.set(p,d,_)}getColor(p,d){return this._color.get(p,d)}clear(){this._color.clear(),this._css.clear()}}},3656:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.addDisposableDomListener=void 0,o.addDisposableDomListener=function(c,f,p,d){c.addEventListener(f,p,d);let _=!1;return{dispose:()=>{_||(_=!0,c.removeEventListener(f,p,d))}}}},3551:function(u,o,c){var f=this&&this.__decorate||function(S,x,y,k){var D,T=arguments.length,R=T<3?x:k===null?k=Object.getOwnPropertyDescriptor(x,y):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(S,x,y,k);else for(var N=S.length-1;N>=0;N--)(D=S[N])&&(R=(T<3?D(R):T>3?D(x,y,R):D(x,y))||R);return T>3&&R&&Object.defineProperty(x,y,R),R},p=this&&this.__param||function(S,x){return function(y,k){x(y,k,S)}};Object.defineProperty(o,"__esModule",{value:!0}),o.Linkifier=void 0;const d=c(3656),_=c(8460),v=c(844),w=c(2585),C=c(4725);let b=o.Linkifier=class extends v.Disposable{get currentLink(){return this._currentLink}constructor(S,x,y,k,D){super(),this._element=S,this._mouseService=x,this._renderService=y,this._bufferService=k,this._linkProviderService=D,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new _.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new _.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,v.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,v.toDisposable)((()=>{var T;this._lastMouseEvent=void 0,(T=this._activeProviderReplies)==null||T.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(S){this._lastMouseEvent=S;const x=this._positionFromMouseEvent(S,this._element,this._mouseService);if(!x)return;this._isMouseOut=!1;const y=S.composedPath();for(let k=0;k{T==null||T.forEach((R=>{R.link.dispose&&R.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=S.y);let y=!1;for(const[T,R]of this._linkProviderService.linkProviders.entries())x?(D=this._activeProviderReplies)!=null&&D.get(T)&&(y=this._checkLinkProviderResult(T,S,y)):R.provideLinks(S.y,(N=>{var B,H;if(this._isMouseOut)return;const M=N==null?void 0:N.map((Y=>({link:Y})));(B=this._activeProviderReplies)==null||B.set(T,M),y=this._checkLinkProviderResult(T,S,y),((H=this._activeProviderReplies)==null?void 0:H.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(S.y,this._activeProviderReplies)}))}_removeIntersectingLinks(S,x){const y=new Set;for(let k=0;kS?this._bufferService.cols:R.link.range.end.x;for(let B=N;B<=M;B++){if(y.has(B)){D.splice(T--,1);break}y.add(B)}}}}_checkLinkProviderResult(S,x,y){var T;if(!this._activeProviderReplies)return y;const k=this._activeProviderReplies.get(S);let D=!1;for(let R=0;Rthis._linkAtPosition(N.link,x)));R&&(y=!0,this._handleNewLink(R))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!y)for(let R=0;Rthis._linkAtPosition(M.link,x)));if(N){y=!0,this._handleNewLink(N);break}}return y}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(S){if(!this._currentLink)return;const x=this._positionFromMouseEvent(S,this._element,this._mouseService);x&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,x)&&this._currentLink.link.activate(S,this._currentLink.link.text)}_clearCurrentLink(S,x){this._currentLink&&this._lastMouseEvent&&(!S||!x||this._currentLink.link.range.start.y>=S&&this._currentLink.link.range.end.y<=x)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,v.disposeArray)(this._linkCacheDisposables))}_handleNewLink(S){if(!this._lastMouseEvent)return;const x=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);x&&this._linkAtPosition(S.link,x)&&(this._currentLink=S,this._currentLink.state={decorations:{underline:S.link.decorations===void 0||S.link.decorations.underline,pointerCursor:S.link.decorations===void 0||S.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,S.link,this._lastMouseEvent),S.link.decorations={},Object.defineProperties(S.link.decorations,{pointerCursor:{get:()=>{var y,k;return(k=(y=this._currentLink)==null?void 0:y.state)==null?void 0:k.decorations.pointerCursor},set:y=>{var k;(k=this._currentLink)!=null&&k.state&&this._currentLink.state.decorations.pointerCursor!==y&&(this._currentLink.state.decorations.pointerCursor=y,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",y))}},underline:{get:()=>{var y,k;return(k=(y=this._currentLink)==null?void 0:y.state)==null?void 0:k.decorations.underline},set:y=>{var k,D,T;(k=this._currentLink)!=null&&k.state&&((T=(D=this._currentLink)==null?void 0:D.state)==null?void 0:T.decorations.underline)!==y&&(this._currentLink.state.decorations.underline=y,this._currentLink.state.isHovered&&this._fireUnderlineEvent(S.link,y))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((y=>{if(!this._currentLink)return;const k=y.start===0?0:y.start+1+this._bufferService.buffer.ydisp,D=this._bufferService.buffer.ydisp+1+y.end;if(this._currentLink.link.range.start.y>=k&&this._currentLink.link.range.end.y<=D&&(this._clearCurrentLink(k,D),this._lastMouseEvent)){const T=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);T&&this._askForLink(T,!1)}}))))}_linkHover(S,x,y){var k;(k=this._currentLink)!=null&&k.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(x,!0),this._currentLink.state.decorations.pointerCursor&&S.classList.add("xterm-cursor-pointer")),x.hover&&x.hover(y,x.text)}_fireUnderlineEvent(S,x){const y=S.range,k=this._bufferService.buffer.ydisp,D=this._createLinkUnderlineEvent(y.start.x-1,y.start.y-k-1,y.end.x,y.end.y-k-1,void 0);(x?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(D)}_linkLeave(S,x,y){var k;(k=this._currentLink)!=null&&k.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(x,!1),this._currentLink.state.decorations.pointerCursor&&S.classList.remove("xterm-cursor-pointer")),x.leave&&x.leave(y,x.text)}_linkAtPosition(S,x){const y=S.range.start.y*this._bufferService.cols+S.range.start.x,k=S.range.end.y*this._bufferService.cols+S.range.end.x,D=x.y*this._bufferService.cols+x.x;return y<=D&&D<=k}_positionFromMouseEvent(S,x,y){const k=y.getCoords(S,x,this._bufferService.cols,this._bufferService.rows);if(k)return{x:k[0],y:k[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(S,x,y,k,D){return{x1:S,y1:x,x2:y,y2:k,cols:this._bufferService.cols,fg:D}}};o.Linkifier=b=f([p(1,C.IMouseService),p(2,C.IRenderService),p(3,w.IBufferService),p(4,C.ILinkProviderService)],b)},9042:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.tooMuchOutput=o.promptLabel=void 0,o.promptLabel="Terminal input",o.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(u,o,c){var f=this&&this.__decorate||function(C,b,S,x){var y,k=arguments.length,D=k<3?b:x===null?x=Object.getOwnPropertyDescriptor(b,S):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(C,b,S,x);else for(var T=C.length-1;T>=0;T--)(y=C[T])&&(D=(k<3?y(D):k>3?y(b,S,D):y(b,S))||D);return k>3&&D&&Object.defineProperty(b,S,D),D},p=this&&this.__param||function(C,b){return function(S,x){b(S,x,C)}};Object.defineProperty(o,"__esModule",{value:!0}),o.OscLinkProvider=void 0;const d=c(511),_=c(2585);let v=o.OscLinkProvider=class{constructor(C,b,S){this._bufferService=C,this._optionsService=b,this._oscLinkService=S}provideLinks(C,b){var M;const S=this._bufferService.buffer.lines.get(C-1);if(!S)return void b(void 0);const x=[],y=this._optionsService.rawOptions.linkHandler,k=new d.CellData,D=S.getTrimmedLength();let T=-1,R=-1,N=!1;for(let B=0;By?y.activate(z,q,Y):w(0,q),hover:(z,q)=>{var G;return(G=y==null?void 0:y.hover)==null?void 0:G.call(y,z,q,Y)},leave:(z,q)=>{var G;return(G=y==null?void 0:y.leave)==null?void 0:G.call(y,z,q,Y)}})}N=!1,k.hasExtendedAttrs()&&k.extended.urlId?(R=B,T=k.extended.urlId):(R=-1,T=-1)}}b(x)}};function w(C,b){if(confirm(`Do you want to navigate to ${b}? -WARNING: This link could potentially be dangerous`)){const S=window.open();if(S){try{S.opener=null}catch{}S.location.href=y}else console.warn("Opening link blocked as opener could not be cleared")}}o.OscLinkProvider=v=f([p(0,_.IBufferService),p(1,_.IOptionsService),p(2,_.IOscLinkService)],v)},6193:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.RenderDebouncer=void 0,o.RenderDebouncer=class{constructor(c,f){this._renderCallback=c,this._coreBrowserService=f,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(c){return this._refreshCallbacks.push(c),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh()))),this._animationFrame}refresh(c,f,p){this._rowCount=p,c=c!==void 0?c:0,f=f!==void 0?f:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,c):c,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,f):f,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 c=Math.max(this._rowStart,0),f=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(c,f),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const c of this._refreshCallbacks)c(0);this._refreshCallbacks=[]}}},3236:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.Terminal=void 0;const f=c(3614),p=c(3656),d=c(3551),_=c(9042),v=c(3730),w=c(1680),C=c(3107),y=c(5744),S=c(2950),x=c(1296),b=c(428),k=c(4269),D=c(5114),T=c(8934),R=c(3230),N=c(9312),M=c(4725),B=c(6731),H=c(8055),Y=c(8969),F=c(8460),z=c(844),q=c(6114),G=c(8437),X=c(2584),K=c(7399),O=c(5941),L=c(9074),j=c(2585),$=c(5435),U=c(4567),Q=c(779);class re extends Y.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(Z={}){super(Z),this.browser=q,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new z.MutableDisposable),this._onCursorMove=this.register(new F.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new F.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new F.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new F.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new F.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new F.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new F.EventEmitter),this._onBlur=this.register(new F.EventEmitter),this._onA11yCharEmitter=this.register(new F.EventEmitter),this._onA11yTabEmitter=this.register(new F.EventEmitter),this._onWillOpen=this.register(new F.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(L.DecorationService),this._instantiationService.setService(j.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(Q.LinkProviderService),this._instantiationService.setService(M.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(v.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((P,te)=>this.refresh(P,te)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((P=>this._reportWindowsOptions(P)))),this.register(this._inputHandler.onColor((P=>this._handleColorEvent(P)))),this.register((0,F.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,F.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,F.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,F.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((P=>this._afterResize(P.cols,P.rows)))),this.register((0,z.toDisposable)((()=>{var P,te;this._customKeyEventHandler=void 0,(te=(P=this.element)==null?void 0:P.parentNode)==null||te.removeChild(this.element)})))}_handleColorEvent(Z){if(this._themeService)for(const P of Z){let te,ie="";switch(P.index){case 256:te="foreground",ie="10";break;case 257:te="background",ie="11";break;case 258:te="cursor",ie="12";break;default:te="ansi",ie="4;"+P.index}switch(P.type){case 0:const pe=H.color.toColorRGB(te==="ansi"?this._themeService.colors.ansi[P.index]:this._themeService.colors[te]);this.coreService.triggerDataEvent(`${X.C0.ESC}]${ie};${(0,O.toRgbString)(pe)}${X.C1_ESCAPED.ST}`);break;case 1:if(te==="ansi")this._themeService.modifyColors((he=>he.ansi[P.index]=H.channels.toColor(...P.color)));else{const he=te;this._themeService.modifyColors((ye=>ye[he]=H.channels.toColor(...P.color)))}break;case 2:this._themeService.restoreColor(P.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(Z){Z?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(U.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(Z){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(X.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var Z;return(Z=this.textarea)==null?void 0:Z.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(X.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 Z=this.buffer.ybase+this.buffer.y,P=this.buffer.lines.get(Z);if(!P)return;const te=Math.min(this.buffer.x,this.cols-1),ie=this._renderService.dimensions.css.cell.height,pe=P.getWidth(te),he=this._renderService.dimensions.css.cell.width*pe,ye=this.buffer.y*this._renderService.dimensions.css.cell.height,we=te*this._renderService.dimensions.css.cell.width;this.textarea.style.left=we+"px",this.textarea.style.top=ye+"px",this.textarea.style.width=he+"px",this.textarea.style.height=ie+"px",this.textarea.style.lineHeight=ie+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,p.addDisposableDomListener)(this.element,"copy",(P=>{this.hasSelection()&&(0,f.copyHandler)(P,this._selectionService)})));const Z=P=>(0,f.handlePasteEvent)(P,this.textarea,this.coreService,this.optionsService);this.register((0,p.addDisposableDomListener)(this.textarea,"paste",Z)),this.register((0,p.addDisposableDomListener)(this.element,"paste",Z)),q.isFirefox?this.register((0,p.addDisposableDomListener)(this.element,"mousedown",(P=>{P.button===2&&(0,f.rightClickHandler)(P,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,p.addDisposableDomListener)(this.element,"contextmenu",(P=>{(0,f.rightClickHandler)(P,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),q.isLinux&&this.register((0,p.addDisposableDomListener)(this.element,"auxclick",(P=>{P.button===1&&(0,f.moveTextAreaUnderMouseCursor)(P,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,p.addDisposableDomListener)(this.textarea,"keyup",(Z=>this._keyUp(Z)),!0)),this.register((0,p.addDisposableDomListener)(this.textarea,"keydown",(Z=>this._keyDown(Z)),!0)),this.register((0,p.addDisposableDomListener)(this.textarea,"keypress",(Z=>this._keyPress(Z)),!0)),this.register((0,p.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,p.addDisposableDomListener)(this.textarea,"compositionupdate",(Z=>this._compositionHelper.compositionupdate(Z)))),this.register((0,p.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,p.addDisposableDomListener)(this.textarea,"input",(Z=>this._inputEvent(Z)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(Z){var te;if(!Z)throw new Error("Terminal requires a parent element.");if(Z.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((te=this.element)==null?void 0:te.ownerDocument.defaultView)&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=Z.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"),Z.appendChild(this.element);const P=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),P.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,p.addDisposableDomListener)(this.screenElement,"mousemove",(ie=>this.updateCursorStyle(ie)))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),P.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",_.promptLabel),q.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(D.CoreBrowserService,this.textarea,Z.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(M.ICoreBrowserService,this._coreBrowserService),this.register((0,p.addDisposableDomListener)(this.textarea,"focus",(ie=>this._handleTextAreaFocus(ie)))),this.register((0,p.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(M.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(B.ThemeService),this._instantiationService.setService(M.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(k.CharacterJoinerService),this._instantiationService.setService(M.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(R.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(M.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((ie=>this._onRender.fire(ie)))),this.onResize((ie=>this._renderService.resize(ie.cols,ie.rows))),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(S.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(T.MouseService),this._instantiationService.setService(M.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(d.Linkifier,this.screenElement)),this.element.appendChild(P);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(w.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((ie=>this.scrollLines(ie.amount,ie.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(N.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(M.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((ie=>this.scrollLines(ie.amount,ie.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((ie=>this._renderService.handleSelectionChanged(ie.start,ie.end,ie.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((ie=>{this.textarea.value=ie,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((ie=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,p.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(C.BufferDecorationRenderer,this.screenElement)),this.register((0,p.addDisposableDomListener)(this.element,"mousedown",(ie=>this._selectionService.handleMouseDown(ie)))),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(U.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(ie=>this._handleScreenReaderModeOptionChange(ie)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(y.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(ie=>{!this._overviewRulerRenderer&&ie&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(y.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 Z=this,P=this.element;function te(he){const ye=Z._mouseService.getMouseReportCoords(he,Z.screenElement);if(!ye)return!1;let we,Ce;switch(he.overrideType||he.type){case"mousemove":Ce=32,he.buttons===void 0?(we=3,he.button!==void 0&&(we=he.button<3?he.button:3)):we=1&he.buttons?0:4&he.buttons?1:2&he.buttons?2:3;break;case"mouseup":Ce=0,we=he.button<3?he.button:3;break;case"mousedown":Ce=1,we=he.button<3?he.button:3;break;case"wheel":if(Z._customWheelEventHandler&&Z._customWheelEventHandler(he)===!1||Z.viewport.getLinesScrolled(he)===0)return!1;Ce=he.deltaY<0?0:1,we=4;break;default:return!1}return!(Ce===void 0||we===void 0||we>4)&&Z.coreMouseService.triggerMouseEvent({col:ye.col,row:ye.row,x:ye.x,y:ye.y,button:we,action:Ce,ctrl:he.ctrlKey,alt:he.altKey,shift:he.shiftKey})}const ie={mouseup:null,wheel:null,mousedrag:null,mousemove:null},pe={mouseup:he=>(te(he),he.buttons||(this._document.removeEventListener("mouseup",ie.mouseup),ie.mousedrag&&this._document.removeEventListener("mousemove",ie.mousedrag)),this.cancel(he)),wheel:he=>(te(he),this.cancel(he,!0)),mousedrag:he=>{he.buttons&&te(he)},mousemove:he=>{he.buttons||te(he)}};this.register(this.coreMouseService.onProtocolChange((he=>{he?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(he)),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&he?ie.mousemove||(P.addEventListener("mousemove",pe.mousemove),ie.mousemove=pe.mousemove):(P.removeEventListener("mousemove",ie.mousemove),ie.mousemove=null),16&he?ie.wheel||(P.addEventListener("wheel",pe.wheel,{passive:!1}),ie.wheel=pe.wheel):(P.removeEventListener("wheel",ie.wheel),ie.wheel=null),2&he?ie.mouseup||(ie.mouseup=pe.mouseup):(this._document.removeEventListener("mouseup",ie.mouseup),ie.mouseup=null),4&he?ie.mousedrag||(ie.mousedrag=pe.mousedrag):(this._document.removeEventListener("mousemove",ie.mousedrag),ie.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,p.addDisposableDomListener)(P,"mousedown",(he=>{if(he.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(he))return te(he),ie.mouseup&&this._document.addEventListener("mouseup",ie.mouseup),ie.mousedrag&&this._document.addEventListener("mousemove",ie.mousedrag),this.cancel(he)}))),this.register((0,p.addDisposableDomListener)(P,"wheel",(he=>{if(!ie.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(he)===!1)return!1;if(!this.buffer.hasScrollback){const ye=this.viewport.getLinesScrolled(he);if(ye===0)return;const we=X.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(he.deltaY<0?"A":"B");let Ce="";for(let Ae=0;Ae{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(he),this.cancel(he)}),{passive:!0})),this.register((0,p.addDisposableDomListener)(P,"touchmove",(he=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(he)?void 0:this.cancel(he)}),{passive:!1}))}refresh(Z,P){var te;(te=this._renderService)==null||te.refreshRows(Z,P)}updateCursorStyle(Z){var P;(P=this._selectionService)!=null&&P.shouldColumnSelect(Z)?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(Z,P,te=0){var ie;te===1?(super.scrollLines(Z,P,te),this.refresh(0,this.rows-1)):(ie=this.viewport)==null||ie.scrollLines(Z)}paste(Z){(0,f.paste)(Z,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(Z){this._customKeyEventHandler=Z}attachCustomWheelEventHandler(Z){this._customWheelEventHandler=Z}registerLinkProvider(Z){return this._linkProviderService.registerLinkProvider(Z)}registerCharacterJoiner(Z){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const P=this._characterJoinerService.register(Z);return this.refresh(0,this.rows-1),P}deregisterCharacterJoiner(Z){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(Z)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(Z){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+Z)}registerDecoration(Z){return this._decorationService.registerDecoration(Z)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(Z,P,te){this._selectionService.setSelection(Z,P,te)}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 Z;(Z=this._selectionService)==null||Z.clearSelection()}selectAll(){var Z;(Z=this._selectionService)==null||Z.selectAll()}selectLines(Z,P){var te;(te=this._selectionService)==null||te.selectLines(Z,P)}_keyDown(Z){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(Z)===!1)return!1;const P=this.browser.isMac&&this.options.macOptionIsMeta&&Z.altKey;if(!P&&!this._compositionHelper.keydown(Z))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;P||Z.key!=="Dead"&&Z.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const te=(0,K.evaluateKeyboardEvent)(Z,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(Z),te.type===3||te.type===2){const ie=this.rows-1;return this.scrollLines(te.type===2?-ie:ie),this.cancel(Z,!0)}return te.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,Z)||(te.cancel&&this.cancel(Z,!0),!te.key||!!(Z.key&&!Z.ctrlKey&&!Z.altKey&&!Z.metaKey&&Z.key.length===1&&Z.key.charCodeAt(0)>=65&&Z.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(te.key!==X.C0.ETX&&te.key!==X.C0.CR||(this.textarea.value=""),this._onKey.fire({key:te.key,domEvent:Z}),this._showCursor(),this.coreService.triggerDataEvent(te.key,!0),!this.optionsService.rawOptions.screenReaderMode||Z.altKey||Z.ctrlKey?this.cancel(Z,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(Z,P){const te=Z.isMac&&!this.options.macOptionIsMeta&&P.altKey&&!P.ctrlKey&&!P.metaKey||Z.isWindows&&P.altKey&&P.ctrlKey&&!P.metaKey||Z.isWindows&&P.getModifierState("AltGraph");return P.type==="keypress"?te:te&&(!P.keyCode||P.keyCode>47)}_keyUp(Z){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(Z)===!1||((function(P){return P.keyCode===16||P.keyCode===17||P.keyCode===18})(Z)||this.focus(),this.updateCursorStyle(Z),this._keyPressHandled=!1)}_keyPress(Z){let P;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(Z)===!1)return!1;if(this.cancel(Z),Z.charCode)P=Z.charCode;else if(Z.which===null||Z.which===void 0)P=Z.keyCode;else{if(Z.which===0||Z.charCode===0)return!1;P=Z.which}return!(!P||(Z.altKey||Z.ctrlKey||Z.metaKey)&&!this._isThirdLevelShift(this.browser,Z)||(P=String.fromCharCode(P),this._onKey.fire({key:P,domEvent:Z}),this._showCursor(),this.coreService.triggerDataEvent(P,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(Z){if(Z.data&&Z.inputType==="insertText"&&(!Z.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const P=Z.data;return this.coreService.triggerDataEvent(P,!0),this.cancel(Z),!0}return!1}resize(Z,P){Z!==this.cols||P!==this.rows?super.resize(Z,P):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(Z,P){var te,ie;(te=this._charSizeService)==null||te.measure(),(ie=this.viewport)==null||ie.syncScrollArea(!0)}clear(){var Z;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 P=1;P{Object.defineProperty(o,"__esModule",{value:!0}),o.TimeBasedDebouncer=void 0,o.TimeBasedDebouncer=class{constructor(c,f=1e3){this._renderCallback=c,this._debounceThresholdMS=f,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(c,f,p){this._rowCount=p,c=c!==void 0?c:0,f=f!==void 0?f:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,c):c,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,f):f;const d=Date.now();if(d-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=d,this._innerRefresh();else if(!this._additionalRefreshRequested){const _=d-this._lastRefreshMs,v=this._debounceThresholdMS-_;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),v)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const c=Math.max(this._rowStart,0),f=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(c,f)}}},1680:function(u,o,c){var f=this&&this.__decorate||function(S,x,b,k){var D,T=arguments.length,R=T<3?x:k===null?k=Object.getOwnPropertyDescriptor(x,b):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(S,x,b,k);else for(var N=S.length-1;N>=0;N--)(D=S[N])&&(R=(T<3?D(R):T>3?D(x,b,R):D(x,b))||R);return T>3&&R&&Object.defineProperty(x,b,R),R},p=this&&this.__param||function(S,x){return function(b,k){x(b,k,S)}};Object.defineProperty(o,"__esModule",{value:!0}),o.Viewport=void 0;const d=c(3656),_=c(4725),v=c(8460),w=c(844),C=c(2585);let y=o.Viewport=class extends w.Disposable{constructor(S,x,b,k,D,T,R,N){super(),this._viewportElement=S,this._scrollArea=x,this._bufferService=b,this._optionsService=k,this._charSizeService=D,this._renderService=T,this._coreBrowserService=R,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 v.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((M=>this._activeBuffer=M.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((M=>this._renderDimensions=M))),this._handleThemeChange(N.colors),this.register(N.onChangeColors((M=>this._handleThemeChange(M)))),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(S){this._viewportElement.style.backgroundColor=S.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(S){if(S)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 S=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==S&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=S),this._refreshAnimationFrame=null}syncScrollArea(S=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(S);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(S)}_handleScroll(S){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 S=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(S*(this._smoothScrollState.target-this._smoothScrollState.origin)),S<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(S,x){const b=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(x<0&&this._viewportElement.scrollTop!==0||x>0&&b0&&(b=Y),k=""}}return{bufferElements:D,cursorElement:b}}getLinesScrolled(S){if(S.deltaY===0||S.shiftKey)return 0;let x=this._applyScrollModifier(S.deltaY,S);return S.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):S.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(x*=this._bufferService.rows),x}_applyScrollModifier(S,x){const b=this._optionsService.rawOptions.fastScrollModifier;return b==="alt"&&x.altKey||b==="ctrl"&&x.ctrlKey||b==="shift"&&x.shiftKey?S*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:S*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(S){this._lastTouchY=S.touches[0].pageY}handleTouchMove(S){const x=this._lastTouchY-S.touches[0].pageY;return this._lastTouchY=S.touches[0].pageY,x!==0&&(this._viewportElement.scrollTop+=x,this._bubbleScroll(S,x))}};o.Viewport=y=f([p(2,C.IBufferService),p(3,C.IOptionsService),p(4,_.ICharSizeService),p(5,_.IRenderService),p(6,_.ICoreBrowserService),p(7,_.IThemeService)],y)},3107:function(u,o,c){var f=this&&this.__decorate||function(C,y,S,x){var b,k=arguments.length,D=k<3?y:x===null?x=Object.getOwnPropertyDescriptor(y,S):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(C,y,S,x);else for(var T=C.length-1;T>=0;T--)(b=C[T])&&(D=(k<3?b(D):k>3?b(y,S,D):b(y,S))||D);return k>3&&D&&Object.defineProperty(y,S,D),D},p=this&&this.__param||function(C,y){return function(S,x){y(S,x,C)}};Object.defineProperty(o,"__esModule",{value:!0}),o.BufferDecorationRenderer=void 0;const d=c(4725),_=c(844),v=c(2585);let w=o.BufferDecorationRenderer=class extends _.Disposable{constructor(C,y,S,x,b){super(),this._screenElement=C,this._bufferService=y,this._coreBrowserService=S,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((k=>this._removeDecoration(k)))),this.register((0,_.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 C of this._decorationService.decorations)this._renderDecoration(C);this._dimensionsChanged=!1}_renderDecoration(C){this._refreshStyle(C),this._dimensionsChanged&&this._refreshXPosition(C)}_createElement(C){var x;const y=this._coreBrowserService.mainDocument.createElement("div");y.classList.add("xterm-decoration"),y.classList.toggle("xterm-decoration-top-layer",((x=C==null?void 0:C.options)==null?void 0:x.layer)==="top"),y.style.width=`${Math.round((C.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,y.style.height=(C.options.height||1)*this._renderService.dimensions.css.cell.height+"px",y.style.top=(C.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",y.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const S=C.options.x??0;return S&&S>this._bufferService.cols&&(y.style.display="none"),this._refreshXPosition(C,y),y}_refreshStyle(C){const y=C.marker.line-this._bufferService.buffers.active.ydisp;if(y<0||y>=this._bufferService.rows)C.element&&(C.element.style.display="none",C.onRenderEmitter.fire(C.element));else{let S=this._decorationElements.get(C);S||(S=this._createElement(C),C.element=S,this._decorationElements.set(C,S),this._container.appendChild(S),C.onDispose((()=>{this._decorationElements.delete(C),S.remove()}))),S.style.top=y*this._renderService.dimensions.css.cell.height+"px",S.style.display=this._altBufferIsActive?"none":"block",C.onRenderEmitter.fire(S)}}_refreshXPosition(C,y=C.element){if(!y)return;const S=C.options.x??0;(C.options.anchor||"left")==="right"?y.style.right=S?S*this._renderService.dimensions.css.cell.width+"px":"":y.style.left=S?S*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(C){var y;(y=this._decorationElements.get(C))==null||y.remove(),this._decorationElements.delete(C),C.dispose()}};o.BufferDecorationRenderer=w=f([p(1,v.IBufferService),p(2,d.ICoreBrowserService),p(3,v.IDecorationService),p(4,d.IRenderService)],w)},5871:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.ColorZoneStore=void 0,o.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(c){if(c.options.overviewRulerOptions){for(const f of this._zones)if(f.color===c.options.overviewRulerOptions.color&&f.position===c.options.overviewRulerOptions.position){if(this._lineIntersectsZone(f,c.marker.line))return;if(this._lineAdjacentToZone(f,c.marker.line,c.options.overviewRulerOptions.position))return void this._addLineToZone(f,c.marker.line)}if(this._zonePoolIndex=c.startBufferLine&&f<=c.endBufferLine}_lineAdjacentToZone(c,f,p){return f>=c.startBufferLine-this._linePadding[p||"full"]&&f<=c.endBufferLine+this._linePadding[p||"full"]}_addLineToZone(c,f){c.startBufferLine=Math.min(c.startBufferLine,f),c.endBufferLine=Math.max(c.endBufferLine,f)}}},5744:function(u,o,c){var f=this&&this.__decorate||function(b,k,D,T){var R,N=arguments.length,M=N<3?k:T===null?T=Object.getOwnPropertyDescriptor(k,D):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")M=Reflect.decorate(b,k,D,T);else for(var B=b.length-1;B>=0;B--)(R=b[B])&&(M=(N<3?R(M):N>3?R(k,D,M):R(k,D))||M);return N>3&&M&&Object.defineProperty(k,D,M),M},p=this&&this.__param||function(b,k){return function(D,T){k(D,T,b)}};Object.defineProperty(o,"__esModule",{value:!0}),o.OverviewRulerRenderer=void 0;const d=c(5871),_=c(4725),v=c(844),w=c(2585),C={full:0,left:0,center:0,right:0},y={full:0,left:0,center:0,right:0},S={full:0,left:0,center:0,right:0};let x=o.OverviewRulerRenderer=class extends v.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(b,k,D,T,R,N,M){var H;super(),this._viewportElement=b,this._screenElement=k,this._bufferService=D,this._decorationService=T,this._renderService=R,this._optionsService=N,this._coreBrowserService=M,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(),(H=this._viewportElement.parentElement)==null||H.insertBefore(this._canvas,this._viewportElement);const B=this._canvas.getContext("2d");if(!B)throw new Error("Ctx cannot be null");this._ctx=B,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,v.toDisposable)((()=>{var Y;(Y=this._canvas)==null||Y.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),k=Math.ceil(this._canvas.width/3);y.full=this._canvas.width,y.left=b,y.center=k,y.right=b,this._refreshDrawHeightConstants(),S.full=0,S.left=0,S.center=y.left,S.right=y.left+y.center}_refreshDrawHeightConstants(){C.full=Math.round(2*this._coreBrowserService.dpr);const b=this._canvas.height/this._bufferService.buffer.lines.length,k=Math.round(Math.max(Math.min(b,12),6)*this._coreBrowserService.dpr);C.left=k,C.center=k,C.right=k}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*C.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*C.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*C.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*C.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 k of this._decorationService.decorations)this._colorZoneStore.addDecoration(k);this._ctx.lineWidth=1;const b=this._colorZoneStore.zones;for(const k of b)k.position!=="full"&&this._renderColorZone(k);for(const k of b)k.position==="full"&&this._renderColorZone(k);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(b){this._ctx.fillStyle=b.color,this._ctx.fillRect(S[b.position||"full"],Math.round((this._canvas.height-1)*(b.startBufferLine/this._bufferService.buffers.active.lines.length)-C[b.position||"full"]/2),y[b.position||"full"],Math.round((this._canvas.height-1)*((b.endBufferLine-b.startBufferLine)/this._bufferService.buffers.active.lines.length)+C[b.position||"full"]))}_queueRefresh(b,k){this._shouldUpdateDimensions=b||this._shouldUpdateDimensions,this._shouldUpdateAnchor=k||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};o.OverviewRulerRenderer=x=f([p(2,w.IBufferService),p(3,w.IDecorationService),p(4,_.IRenderService),p(5,w.IOptionsService),p(6,_.ICoreBrowserService)],x)},2950:function(u,o,c){var f=this&&this.__decorate||function(C,y,S,x){var b,k=arguments.length,D=k<3?y:x===null?x=Object.getOwnPropertyDescriptor(y,S):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(C,y,S,x);else for(var T=C.length-1;T>=0;T--)(b=C[T])&&(D=(k<3?b(D):k>3?b(y,S,D):b(y,S))||D);return k>3&&D&&Object.defineProperty(y,S,D),D},p=this&&this.__param||function(C,y){return function(S,x){y(S,x,C)}};Object.defineProperty(o,"__esModule",{value:!0}),o.CompositionHelper=void 0;const d=c(4725),_=c(2585),v=c(2584);let w=o.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(C,y,S,x,b,k){this._textarea=C,this._compositionView=y,this._bufferService=S,this._optionsService=x,this._coreService=b,this._renderService=k,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(C){this._compositionView.textContent=C.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(C){if(this._isComposing||this._isSendingComposition){if(C.keyCode===229||C.keyCode===16||C.keyCode===17||C.keyCode===18)return!1;this._finalizeComposition(!1)}return C.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(C){if(this._compositionView.classList.remove("active"),this._isComposing=!1,C){const y={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let S;this._isSendingComposition=!1,y.start+=this._dataAlreadySent.length,S=this._isComposing?this._textarea.value.substring(y.start,y.end):this._textarea.value.substring(y.start),S.length>0&&this._coreService.triggerDataEvent(S,!0)}}),0)}else{this._isSendingComposition=!1;const y=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(y,!0)}}_handleAnyTextareaChanges(){const C=this._textarea.value;setTimeout((()=>{if(!this._isComposing){const y=this._textarea.value,S=y.replace(C,"");this._dataAlreadySent=S,y.length>C.length?this._coreService.triggerDataEvent(S,!0):y.lengththis.updateCompositionElements(!0)),0)}}};o.CompositionHelper=w=f([p(2,_.IBufferService),p(3,_.IOptionsService),p(4,_.ICoreService),p(5,d.IRenderService)],w)},9806:(u,o)=>{function c(f,p,d){const _=d.getBoundingClientRect(),v=f.getComputedStyle(d),w=parseInt(v.getPropertyValue("padding-left")),C=parseInt(v.getPropertyValue("padding-top"));return[p.clientX-_.left-w,p.clientY-_.top-C]}Object.defineProperty(o,"__esModule",{value:!0}),o.getCoords=o.getCoordsRelativeToElement=void 0,o.getCoordsRelativeToElement=c,o.getCoords=function(f,p,d,_,v,w,C,y,S){if(!w)return;const x=c(f,p,d);return x?(x[0]=Math.ceil((x[0]+(S?C/2:0))/C),x[1]=Math.ceil(x[1]/y),x[0]=Math.min(Math.max(x[0],1),_+(S?1:0)),x[1]=Math.min(Math.max(x[1],1),v),x):void 0}},9504:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.moveToCellSequence=void 0;const f=c(2584);function p(y,S,x,b){const k=y-d(y,x),D=S-d(S,x),T=Math.abs(k-D)-(function(R,N,M){let B=0;const H=R-d(R,M),Y=N-d(N,M);for(let F=0;F=0&&yS?"A":"B"}function v(y,S,x,b,k,D){let T=y,R=S,N="";for(;T!==x||R!==b;)T+=k?1:-1,k&&T>D.cols-1?(N+=D.buffer.translateBufferLineToString(R,!1,y,T),T=0,y=0,R++):!k&&T<0&&(N+=D.buffer.translateBufferLineToString(R,!1,0,y+1),T=D.cols-1,y=T,R--);return N+D.buffer.translateBufferLineToString(R,!1,y,T)}function w(y,S){const x=S?"O":"[";return f.C0.ESC+x+y}function C(y,S){y=Math.floor(y);let x="";for(let b=0;b0?H-d(H,Y):M;const q=H,G=(function(X,K,O,L,j,$){let U;return U=p(O,L,j,$).length>0?L-d(L,j):K,X=O&&Uy?"D":"C",C(Math.abs(k-y),w(T,b));T=D>S?"D":"C";const R=Math.abs(D-S);return C((function(N,M){return M.cols-N})(D>S?y:k,x)+(R-1)*x.cols+1+((D>S?k:y)-1),w(T,b))}},1296:function(u,o,c){var f=this&&this.__decorate||function(F,z,q,G){var X,K=arguments.length,O=K<3?z:G===null?G=Object.getOwnPropertyDescriptor(z,q):G;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")O=Reflect.decorate(F,z,q,G);else for(var L=F.length-1;L>=0;L--)(X=F[L])&&(O=(K<3?X(O):K>3?X(z,q,O):X(z,q))||O);return K>3&&O&&Object.defineProperty(z,q,O),O},p=this&&this.__param||function(F,z){return function(q,G){z(q,G,F)}};Object.defineProperty(o,"__esModule",{value:!0}),o.DomRenderer=void 0;const d=c(3787),_=c(2550),v=c(2223),w=c(6171),C=c(6052),y=c(4725),S=c(8055),x=c(8460),b=c(844),k=c(2585),D="xterm-dom-renderer-owner-",T="xterm-rows",R="xterm-fg-",N="xterm-bg-",M="xterm-focus",B="xterm-selection";let H=1,Y=o.DomRenderer=class extends b.Disposable{constructor(F,z,q,G,X,K,O,L,j,$,U,Q,re){super(),this._terminal=F,this._document=z,this._element=q,this._screenElement=G,this._viewportElement=X,this._helperContainer=K,this._linkifier2=O,this._charSizeService=j,this._optionsService=$,this._bufferService=U,this._coreBrowserService=Q,this._themeService=re,this._terminalClass=H++,this._rowElements=[],this._selectionRenderModel=(0,C.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new x.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(T),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(B),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,w.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((ae=>this._injectCss(ae)))),this._injectCss(this._themeService.colors),this._rowFactory=L.createInstance(d.DomRendererRowFactory,document),this._element.classList.add(D+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((ae=>this._handleLinkHover(ae)))),this.register(this._linkifier2.onHideLinkUnderline((ae=>this._handleLinkLeave(ae)))),this.register((0,b.toDisposable)((()=>{this._element.classList.remove(D+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new _.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 F=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*F,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*F),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/F),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/F),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 q of this._rowElements)q.style.width=`${this.dimensions.css.canvas.width}px`,q.style.height=`${this.dimensions.css.cell.height}px`,q.style.lineHeight=`${this.dimensions.css.cell.height}px`,q.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const z=`${this._terminalSelector} .${T} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=z,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(F){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let z=`${this._terminalSelector} .${T} { color: ${F.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;z+=`${this._terminalSelector} .${T} .xterm-dim { color: ${S.color.multiplyOpacity(F.foreground,.5).css};}`,z+=`${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 q=`blink_underline_${this._terminalClass}`,G=`blink_bar_${this._terminalClass}`,X=`blink_block_${this._terminalClass}`;z+=`@keyframes ${q} { 50% { border-bottom-style: hidden; }}`,z+=`@keyframes ${G} { 50% { box-shadow: none; }}`,z+=`@keyframes ${X} { 0% { background-color: ${F.cursor.css}; color: ${F.cursorAccent.css}; } 50% { background-color: inherit; color: ${F.cursor.css}; }}`,z+=`${this._terminalSelector} .${T}.${M} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${q} 1s step-end infinite;}${this._terminalSelector} .${T}.${M} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${G} 1s step-end infinite;}${this._terminalSelector} .${T}.${M} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${X} 1s step-end infinite;}${this._terminalSelector} .${T} .xterm-cursor.xterm-cursor-block { background-color: ${F.cursor.css}; color: ${F.cursorAccent.css};}${this._terminalSelector} .${T} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${F.cursor.css} !important; color: ${F.cursorAccent.css} !important;}${this._terminalSelector} .${T} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${F.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${T} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${F.cursor.css} inset;}${this._terminalSelector} .${T} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${F.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,z+=`${this._terminalSelector} .${B} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${B} div { position: absolute; background-color: ${F.selectionBackgroundOpaque.css};}${this._terminalSelector} .${B} div { position: absolute; background-color: ${F.selectionInactiveBackgroundOpaque.css};}`;for(const[K,O]of F.ansi.entries())z+=`${this._terminalSelector} .${R}${K} { color: ${O.css}; }${this._terminalSelector} .${R}${K}.xterm-dim { color: ${S.color.multiplyOpacity(O,.5).css}; }${this._terminalSelector} .${N}${K} { background-color: ${O.css}; }`;z+=`${this._terminalSelector} .${R}${v.INVERTED_DEFAULT_COLOR} { color: ${S.color.opaque(F.background).css}; }${this._terminalSelector} .${R}${v.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${S.color.multiplyOpacity(S.color.opaque(F.background),.5).css}; }${this._terminalSelector} .${N}${v.INVERTED_DEFAULT_COLOR} { background-color: ${F.foreground.css}; }`,this._themeStyleElement.textContent=z}_setDefaultSpacing(){const F=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${F}px`,this._rowFactory.defaultSpacing=F}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(F,z){for(let q=this._rowElements.length;q<=z;q++){const G=this._document.createElement("div");this._rowContainer.appendChild(G),this._rowElements.push(G)}for(;this._rowElements.length>z;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(F,z){this._refreshRowElements(F,z),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(M),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(M),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(F,z,q){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(F,z,q),this.renderRows(0,this._bufferService.rows-1),!F||!z)return;this._selectionRenderModel.update(this._terminal,F,z,q);const G=this._selectionRenderModel.viewportStartRow,X=this._selectionRenderModel.viewportEndRow,K=this._selectionRenderModel.viewportCappedStartRow,O=this._selectionRenderModel.viewportCappedEndRow;if(K>=this._bufferService.rows||O<0)return;const L=this._document.createDocumentFragment();if(q){const j=F[0]>z[0];L.appendChild(this._createSelectionElement(K,j?z[0]:F[0],j?F[0]:z[0],O-K+1))}else{const j=G===K?F[0]:0,$=K===X?z[0]:this._bufferService.cols;L.appendChild(this._createSelectionElement(K,j,$));const U=O-K-1;if(L.appendChild(this._createSelectionElement(K+1,0,this._bufferService.cols,U)),K!==O){const Q=X===O?z[0]:this._bufferService.cols;L.appendChild(this._createSelectionElement(O,0,Q))}}this._selectionContainer.appendChild(L)}_createSelectionElement(F,z,q,G=1){const X=this._document.createElement("div"),K=z*this.dimensions.css.cell.width;let O=this.dimensions.css.cell.width*(q-z);return K+O>this.dimensions.css.canvas.width&&(O=this.dimensions.css.canvas.width-K),X.style.height=G*this.dimensions.css.cell.height+"px",X.style.top=F*this.dimensions.css.cell.height+"px",X.style.left=`${K}px`,X.style.width=`${O}px`,X}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 F of this._rowElements)F.replaceChildren()}renderRows(F,z){const q=this._bufferService.buffer,G=q.ybase+q.y,X=Math.min(q.x,this._bufferService.cols-1),K=this._optionsService.rawOptions.cursorBlink,O=this._optionsService.rawOptions.cursorStyle,L=this._optionsService.rawOptions.cursorInactiveStyle;for(let j=F;j<=z;j++){const $=j+q.ydisp,U=this._rowElements[j],Q=q.lines.get($);if(!U||!Q)break;U.replaceChildren(...this._rowFactory.createRow(Q,$,$===G,O,L,X,K,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${D}${this._terminalClass}`}_handleLinkHover(F){this._setCellUnderline(F.x1,F.x2,F.y1,F.y2,F.cols,!0)}_handleLinkLeave(F){this._setCellUnderline(F.x1,F.x2,F.y1,F.y2,F.cols,!1)}_setCellUnderline(F,z,q,G,X,K){q<0&&(F=0),G<0&&(z=0);const O=this._bufferService.rows-1;q=Math.max(Math.min(q,O),0),G=Math.max(Math.min(G,O),0),X=Math.min(X,this._bufferService.cols);const L=this._bufferService.buffer,j=L.ybase+L.y,$=Math.min(L.x,X-1),U=this._optionsService.rawOptions.cursorBlink,Q=this._optionsService.rawOptions.cursorStyle,re=this._optionsService.rawOptions.cursorInactiveStyle;for(let ae=q;ae<=G;++ae){const Z=ae+L.ydisp,P=this._rowElements[ae],te=L.lines.get(Z);if(!P||!te)break;P.replaceChildren(...this._rowFactory.createRow(te,Z,Z===j,Q,re,$,U,this.dimensions.css.cell.width,this._widthCache,K?ae===q?F:0:-1,K?(ae===G?z:X)-1:-1))}}};o.DomRenderer=Y=f([p(7,k.IInstantiationService),p(8,y.ICharSizeService),p(9,k.IOptionsService),p(10,k.IBufferService),p(11,y.ICoreBrowserService),p(12,y.IThemeService)],Y)},3787:function(u,o,c){var f=this&&this.__decorate||function(T,R,N,M){var B,H=arguments.length,Y=H<3?R:M===null?M=Object.getOwnPropertyDescriptor(R,N):M;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")Y=Reflect.decorate(T,R,N,M);else for(var F=T.length-1;F>=0;F--)(B=T[F])&&(Y=(H<3?B(Y):H>3?B(R,N,Y):B(R,N))||Y);return H>3&&Y&&Object.defineProperty(R,N,Y),Y},p=this&&this.__param||function(T,R){return function(N,M){R(N,M,T)}};Object.defineProperty(o,"__esModule",{value:!0}),o.DomRendererRowFactory=void 0;const d=c(2223),_=c(643),v=c(511),w=c(2585),C=c(8055),y=c(4725),S=c(4269),x=c(6171),b=c(3734);let k=o.DomRendererRowFactory=class{constructor(T,R,N,M,B,H,Y){this._document=T,this._characterJoinerService=R,this._optionsService=N,this._coreBrowserService=M,this._coreService=B,this._decorationService=H,this._themeService=Y,this._workCell=new v.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(T,R,N){this._selectionStart=T,this._selectionEnd=R,this._columnSelectMode=N}createRow(T,R,N,M,B,H,Y,F,z,q,G){const X=[],K=this._characterJoinerService.getJoinedCharacters(R),O=this._themeService.colors;let L,j=T.getNoBgTrimmedLength();N&&j0&&ye===K[0][0]){Ce=!0;const Ie=K.shift();xe=new S.JoinedCellData(this._workCell,T.translateToString(!0,Ie[0],Ie[1]),Ie[1]-Ie[0]),Ae=Ie[1]-1,we=xe.getWidth()}const Ye=this._isCellInSelection(ye,R),lt=N&&ye===H,dt=he&&ye>=q&&ye<=G;let it=!1;this._decorationService.forEachDecorationAtCell(ye,R,void 0,(Ie=>{it=!0}));let pt=xe.getChars()||_.WHITESPACE_CELL_CHAR;if(pt===" "&&(xe.isUnderline()||xe.isOverline())&&(pt=" "),ie=we*F-z.get(pt,xe.isBold(),xe.isItalic()),L){if($&&(Ye&&te||!Ye&&!te&&xe.bg===Q)&&(Ye&&te&&O.selectionForeground||xe.fg===re)&&xe.extended.ext===ae&&dt===Z&&ie===P&&!lt&&!Ce&&!it){xe.isInvisible()?U+=_.WHITESPACE_CELL_CHAR:U+=pt,$++;continue}$&&(L.textContent=U),L=this._document.createElement("span"),$=0,U=""}else L=this._document.createElement("span");if(Q=xe.bg,re=xe.fg,ae=xe.extended.ext,Z=dt,P=ie,te=Ye,Ce&&H>=ye&&H<=Ae&&(H=ye),!this._coreService.isCursorHidden&<&&this._coreService.isCursorInitialized){if(pe.push("xterm-cursor"),this._coreBrowserService.isFocused)Y&&pe.push("xterm-cursor-blink"),pe.push(M==="bar"?"xterm-cursor-bar":M==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(B)switch(B){case"outline":pe.push("xterm-cursor-outline");break;case"block":pe.push("xterm-cursor-block");break;case"bar":pe.push("xterm-cursor-bar");break;case"underline":pe.push("xterm-cursor-underline")}}if(xe.isBold()&&pe.push("xterm-bold"),xe.isItalic()&&pe.push("xterm-italic"),xe.isDim()&&pe.push("xterm-dim"),U=xe.isInvisible()?_.WHITESPACE_CELL_CHAR:xe.getChars()||_.WHITESPACE_CELL_CHAR,xe.isUnderline()&&(pe.push(`xterm-underline-${xe.extended.underlineStyle}`),U===" "&&(U=" "),!xe.isUnderlineColorDefault()))if(xe.isUnderlineColorRGB())L.style.textDecorationColor=`rgb(${b.AttributeData.toColorRGB(xe.getUnderlineColor()).join(",")})`;else{let Ie=xe.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&xe.isBold()&&Ie<8&&(Ie+=8),L.style.textDecorationColor=O.ansi[Ie].css}xe.isOverline()&&(pe.push("xterm-overline"),U===" "&&(U=" ")),xe.isStrikethrough()&&pe.push("xterm-strikethrough"),dt&&(L.style.textDecoration="underline");let rt=xe.getFgColor(),Ue=xe.getFgColorMode(),Je=xe.getBgColor(),fe=xe.getBgColorMode();const ee=!!xe.isInverse();if(ee){const Ie=rt;rt=Je,Je=Ie;const Ke=Ue;Ue=fe,fe=Ke}let me,be,Ee,Be=!1;switch(this._decorationService.forEachDecorationAtCell(ye,R,void 0,(Ie=>{Ie.options.layer!=="top"&&Be||(Ie.backgroundColorRGB&&(fe=50331648,Je=Ie.backgroundColorRGB.rgba>>8&16777215,me=Ie.backgroundColorRGB),Ie.foregroundColorRGB&&(Ue=50331648,rt=Ie.foregroundColorRGB.rgba>>8&16777215,be=Ie.foregroundColorRGB),Be=Ie.options.layer==="top")})),!Be&&Ye&&(me=this._coreBrowserService.isFocused?O.selectionBackgroundOpaque:O.selectionInactiveBackgroundOpaque,Je=me.rgba>>8&16777215,fe=50331648,Be=!0,O.selectionForeground&&(Ue=50331648,rt=O.selectionForeground.rgba>>8&16777215,be=O.selectionForeground)),Be&&pe.push("xterm-decoration-top"),fe){case 16777216:case 33554432:Ee=O.ansi[Je],pe.push(`xterm-bg-${Je}`);break;case 50331648:Ee=C.channels.toColor(Je>>16,Je>>8&255,255&Je),this._addStyle(L,`background-color:#${D((Je>>>0).toString(16),"0",6)}`);break;default:ee?(Ee=O.foreground,pe.push(`xterm-bg-${d.INVERTED_DEFAULT_COLOR}`)):Ee=O.background}switch(me||xe.isDim()&&(me=C.color.multiplyOpacity(Ee,.5)),Ue){case 16777216:case 33554432:xe.isBold()&&rt<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(rt+=8),this._applyMinimumContrast(L,Ee,O.ansi[rt],xe,me,void 0)||pe.push(`xterm-fg-${rt}`);break;case 50331648:const Ie=C.channels.toColor(rt>>16&255,rt>>8&255,255&rt);this._applyMinimumContrast(L,Ee,Ie,xe,me,be)||this._addStyle(L,`color:#${D(rt.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(L,Ee,O.foreground,xe,me,be)||ee&&pe.push(`xterm-fg-${d.INVERTED_DEFAULT_COLOR}`)}pe.length&&(L.className=pe.join(" "),pe.length=0),lt||Ce||it?L.textContent=U:$++,ie!==this.defaultSpacing&&(L.style.letterSpacing=`${ie}px`),X.push(L),ye=Ae}return L&&$&&(L.textContent=U),X}_applyMinimumContrast(T,R,N,M,B,H){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,x.treatGlyphAsBackgroundColor)(M.getCode()))return!1;const Y=this._getContrastCache(M);let F;if(B||H||(F=Y.getColor(R.rgba,N.rgba)),F===void 0){const z=this._optionsService.rawOptions.minimumContrastRatio/(M.isDim()?2:1);F=C.color.ensureContrastRatio(B||R,H||N,z),Y.setColor((B||R).rgba,(H||N).rgba,F??null)}return!!F&&(this._addStyle(T,`color:${F.css}`),!0)}_getContrastCache(T){return T.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(T,R){T.setAttribute("style",`${T.getAttribute("style")||""}${R};`)}_isCellInSelection(T,R){const N=this._selectionStart,M=this._selectionEnd;return!(!N||!M)&&(this._columnSelectMode?N[0]<=M[0]?T>=N[0]&&R>=N[1]&&T=N[1]&&T>=M[0]&&R<=M[1]:R>N[1]&&R=N[0]&&T=N[0])}};function D(T,R,N){for(;T.length{Object.defineProperty(o,"__esModule",{value:!0}),o.WidthCache=void 0,o.WidthCache=class{constructor(c,f){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=c.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 p=c.createElement("span");p.classList.add("xterm-char-measure-element");const d=c.createElement("span");d.classList.add("xterm-char-measure-element"),d.style.fontWeight="bold";const _=c.createElement("span");_.classList.add("xterm-char-measure-element"),_.style.fontStyle="italic";const v=c.createElement("span");v.classList.add("xterm-char-measure-element"),v.style.fontWeight="bold",v.style.fontStyle="italic",this._measureElements=[p,d,_,v],this._container.appendChild(p),this._container.appendChild(d),this._container.appendChild(_),this._container.appendChild(v),f.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(c,f,p,d){c===this._font&&f===this._fontSize&&p===this._weight&&d===this._weightBold||(this._font=c,this._fontSize=f,this._weight=p,this._weightBold=d,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${p}`,this._measureElements[1].style.fontWeight=`${d}`,this._measureElements[2].style.fontWeight=`${p}`,this._measureElements[3].style.fontWeight=`${d}`,this.clear())}get(c,f,p){let d=0;if(!f&&!p&&c.length===1&&(d=c.charCodeAt(0))<256){if(this._flat[d]!==-9999)return this._flat[d];const w=this._measure(c,0);return w>0&&(this._flat[d]=w),w}let _=c;f&&(_+="B"),p&&(_+="I");let v=this._holey.get(_);if(v===void 0){let w=0;f&&(w|=1),p&&(w|=2),v=this._measure(c,w),v>0&&this._holey.set(_,v)}return v}_measure(c,f){const p=this._measureElements[f];return p.textContent=c.repeat(32),p.offsetWidth/32}}},2223:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.TEXT_BASELINE=o.DIM_OPACITY=o.INVERTED_DEFAULT_COLOR=void 0;const f=c(6114);o.INVERTED_DEFAULT_COLOR=257,o.DIM_OPACITY=.5,o.TEXT_BASELINE=f.isFirefox||f.isLegacyEdge?"bottom":"ideographic"},6171:(u,o)=>{function c(p){return 57508<=p&&p<=57558}function f(p){return p>=128512&&p<=128591||p>=127744&&p<=128511||p>=128640&&p<=128767||p>=9728&&p<=9983||p>=9984&&p<=10175||p>=65024&&p<=65039||p>=129280&&p<=129535||p>=127462&&p<=127487}Object.defineProperty(o,"__esModule",{value:!0}),o.computeNextVariantOffset=o.createRenderDimensions=o.treatGlyphAsBackgroundColor=o.allowRescaling=o.isEmoji=o.isRestrictedPowerlineGlyph=o.isPowerlineGlyph=o.throwIfFalsy=void 0,o.throwIfFalsy=function(p){if(!p)throw new Error("value must not be falsy");return p},o.isPowerlineGlyph=c,o.isRestrictedPowerlineGlyph=function(p){return 57520<=p&&p<=57527},o.isEmoji=f,o.allowRescaling=function(p,d,_,v){return d===1&&_>Math.ceil(1.5*v)&&p!==void 0&&p>255&&!f(p)&&!c(p)&&!(function(w){return 57344<=w&&w<=63743})(p)},o.treatGlyphAsBackgroundColor=function(p){return c(p)||(function(d){return 9472<=d&&d<=9631})(p)},o.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}}}},o.computeNextVariantOffset=function(p,d,_=0){return(p-(2*Math.round(d)-_))%(2*Math.round(d))}},6052:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.createSelectionRenderModel=void 0;class c{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(p,d,_,v=!1){if(this.selectionStart=d,this.selectionEnd=_,!d||!_||d[0]===_[0]&&d[1]===_[1])return void this.clear();const w=p.buffers.active.ydisp,C=d[1]-w,y=_[1]-w,S=Math.max(C,0),x=Math.min(y,p.rows-1);S>=p.rows||x<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=v,this.viewportStartRow=C,this.viewportEndRow=y,this.viewportCappedStartRow=S,this.viewportCappedEndRow=x,this.startCol=d[0],this.endCol=_[0])}isCellSelected(p,d,_){return!!this.hasSelection&&(_-=p.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?d>=this.startCol&&_>=this.viewportCappedStartRow&&d=this.viewportCappedStartRow&&d>=this.endCol&&_<=this.viewportCappedEndRow:_>this.viewportStartRow&&_=this.startCol&&d=this.startCol)}}o.createSelectionRenderModel=function(){return new c}},456:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.SelectionModel=void 0,o.SelectionModel=class{constructor(c){this._bufferService=c,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 c=this.selectionStart[0]+this.selectionStartLength;return c>this._bufferService.cols?c%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(c/this._bufferService.cols)-1]:[c%this._bufferService.cols,this.selectionStart[1]+Math.floor(c/this._bufferService.cols)]:[c,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){const c=this.selectionStart[0]+this.selectionStartLength;return c>this._bufferService.cols?[c%this._bufferService.cols,this.selectionStart[1]+Math.floor(c/this._bufferService.cols)]:[Math.max(c,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){const c=this.selectionStart,f=this.selectionEnd;return!(!c||!f)&&(c[1]>f[1]||c[1]===f[1]&&c[0]>f[0])}handleTrim(c){return this.selectionStart&&(this.selectionStart[1]-=c),this.selectionEnd&&(this.selectionEnd[1]-=c),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(u,o,c){var f=this&&this.__decorate||function(x,b,k,D){var T,R=arguments.length,N=R<3?b:D===null?D=Object.getOwnPropertyDescriptor(b,k):D;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(x,b,k,D);else for(var M=x.length-1;M>=0;M--)(T=x[M])&&(N=(R<3?T(N):R>3?T(b,k,N):T(b,k))||N);return R>3&&N&&Object.defineProperty(b,k,N),N},p=this&&this.__param||function(x,b){return function(k,D){b(k,D,x)}};Object.defineProperty(o,"__esModule",{value:!0}),o.CharSizeService=void 0;const d=c(2585),_=c(8460),v=c(844);let w=o.CharSizeService=class extends v.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(x,b,k){super(),this._optionsService=k,this.width=0,this.height=0,this._onCharSizeChange=this.register(new _.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new S(this._optionsService))}catch{this._measureStrategy=this.register(new y(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())}};o.CharSizeService=w=f([p(2,d.IOptionsService)],w);class C extends v.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(b,k){b!==void 0&&b>0&&k!==void 0&&k>0&&(this._result.width=b,this._result.height=k)}}class y extends C{constructor(b,k,D){super(),this._document=b,this._parentElement=k,this._optionsService=D,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 S extends C{constructor(b){super(),this._optionsService=b,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");const k=this._ctx.measureText("W");if(!("width"in k&&"fontBoundingBoxAscent"in k&&"fontBoundingBoxDescent"in k))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(u,o,c){var f=this&&this.__decorate||function(S,x,b,k){var D,T=arguments.length,R=T<3?x:k===null?k=Object.getOwnPropertyDescriptor(x,b):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(S,x,b,k);else for(var N=S.length-1;N>=0;N--)(D=S[N])&&(R=(T<3?D(R):T>3?D(x,b,R):D(x,b))||R);return T>3&&R&&Object.defineProperty(x,b,R),R},p=this&&this.__param||function(S,x){return function(b,k){x(b,k,S)}};Object.defineProperty(o,"__esModule",{value:!0}),o.CharacterJoinerService=o.JoinedCellData=void 0;const d=c(3734),_=c(643),v=c(511),w=c(2585);class C extends d.AttributeData{constructor(x,b,k){super(),this.content=0,this.combinedData="",this.fg=x.fg,this.bg=x.bg,this.combinedData=b,this._width=k}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()]}}o.JoinedCellData=C;let y=o.CharacterJoinerService=class oC{constructor(x){this._bufferService=x,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new v.CellData}register(x){const b={id:this._nextCharacterJoinerId++,handler:x};return this._characterJoiners.push(b),b.id}deregister(x){for(let b=0;b1){const Y=this._getJoinedRanges(D,N,R,b,T);for(let F=0;F1){const H=this._getJoinedRanges(D,N,R,b,T);for(let Y=0;Y{Object.defineProperty(o,"__esModule",{value:!0}),o.CoreBrowserService=void 0;const f=c(844),p=c(8460),d=c(3656);class _ extends f.Disposable{constructor(C,y,S){super(),this._textarea=C,this._window=y,this.mainDocument=S,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new v(this._window),this._onDprChange=this.register(new p.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new p.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((x=>this._screenDprMonitor.setWindow(x)))),this.register((0,p.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(C){this._window!==C&&(this._window=C,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}}o.CoreBrowserService=_;class v extends f.Disposable{constructor(C){super(),this._parentWindow=C,this._windowResizeListener=this.register(new f.MutableDisposable),this._onDprChange=this.register(new p.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,f.toDisposable)((()=>this.clearListener())))}setWindow(C){this._parentWindow=C,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 C;this._outerListener&&((C=this._resolutionMediaMatchList)==null||C.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:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.LinkProviderService=void 0;const f=c(844);class p extends f.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,f.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(_){return this.linkProviders.push(_),{dispose:()=>{const v=this.linkProviders.indexOf(_);v!==-1&&this.linkProviders.splice(v,1)}}}}o.LinkProviderService=p},8934:function(u,o,c){var f=this&&this.__decorate||function(w,C,y,S){var x,b=arguments.length,k=b<3?C:S===null?S=Object.getOwnPropertyDescriptor(C,y):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(w,C,y,S);else for(var D=w.length-1;D>=0;D--)(x=w[D])&&(k=(b<3?x(k):b>3?x(C,y,k):x(C,y))||k);return b>3&&k&&Object.defineProperty(C,y,k),k},p=this&&this.__param||function(w,C){return function(y,S){C(y,S,w)}};Object.defineProperty(o,"__esModule",{value:!0}),o.MouseService=void 0;const d=c(4725),_=c(9806);let v=o.MouseService=class{constructor(w,C){this._renderService=w,this._charSizeService=C}getCoords(w,C,y,S,x){return(0,_.getCoords)(window,w,C,y,S,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,x)}getMouseReportCoords(w,C){const y=(0,_.getCoordsRelativeToElement)(window,w,C);if(this._charSizeService.hasValidSize)return y[0]=Math.min(Math.max(y[0],0),this._renderService.dimensions.css.canvas.width-1),y[1]=Math.min(Math.max(y[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(y[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(y[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(y[0]),y:Math.floor(y[1])}}};o.MouseService=v=f([p(0,d.IRenderService),p(1,d.ICharSizeService)],v)},3230:function(u,o,c){var f=this&&this.__decorate||function(x,b,k,D){var T,R=arguments.length,N=R<3?b:D===null?D=Object.getOwnPropertyDescriptor(b,k):D;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(x,b,k,D);else for(var M=x.length-1;M>=0;M--)(T=x[M])&&(N=(R<3?T(N):R>3?T(b,k,N):T(b,k))||N);return R>3&&N&&Object.defineProperty(b,k,N),N},p=this&&this.__param||function(x,b){return function(k,D){b(k,D,x)}};Object.defineProperty(o,"__esModule",{value:!0}),o.RenderService=void 0;const d=c(6193),_=c(4725),v=c(8460),w=c(844),C=c(7226),y=c(2585);let S=o.RenderService=class extends w.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(x,b,k,D,T,R,N,M){super(),this._rowCount=x,this._charSizeService=D,this._renderer=this.register(new w.MutableDisposable),this._pausedResizeTask=new C.DebouncedIdleTask,this._observerDisposable=this.register(new w.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 v.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new v.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new v.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new v.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new d.RenderDebouncer(((B,H)=>this._renderRows(B,H)),N),this.register(this._renderDebouncer),this.register(N.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(R.onResize((()=>this._fullRefresh()))),this.register(R.buffers.onBufferActivate((()=>{var B;return(B=this._renderer.value)==null?void 0:B.clear()}))),this.register(k.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(T.onDecorationRegistered((()=>this._fullRefresh()))),this.register(T.onDecorationRemoved((()=>this._fullRefresh()))),this.register(k.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],(()=>{this.clear(),this.handleResize(R.cols,R.rows),this._fullRefresh()}))),this.register(k.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(R.buffer.y,R.buffer.y,!0)))),this.register(M.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(N.window,b),this.register(N.onWindowChange((B=>this._registerIntersectionObserver(B,b))))}_registerIntersectionObserver(x,b){if("IntersectionObserver"in x){const k=new x.IntersectionObserver((D=>this._handleIntersectionChange(D[D.length-1])),{threshold:0});k.observe(b),this._observerDisposable.value=(0,w.toDisposable)((()=>k.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,k=!1){this._isPaused?this._needsFullRefresh=!0:(k||(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 k;return(k=this._renderer.value)==null?void 0:k.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,k){var D;this._selectionState.start=x,this._selectionState.end=b,this._selectionState.columnSelectMode=k,(D=this._renderer.value)==null||D.handleSelectionChanged(x,b,k)}handleCursorMove(){var x;(x=this._renderer.value)==null||x.handleCursorMove()}clear(){var x;(x=this._renderer.value)==null||x.clear()}};o.RenderService=S=f([p(2,y.IOptionsService),p(3,_.ICharSizeService),p(4,y.IDecorationService),p(5,y.IBufferService),p(6,_.ICoreBrowserService),p(7,_.IThemeService)],S)},9312:function(u,o,c){var f=this&&this.__decorate||function(N,M,B,H){var Y,F=arguments.length,z=F<3?M:H===null?H=Object.getOwnPropertyDescriptor(M,B):H;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")z=Reflect.decorate(N,M,B,H);else for(var q=N.length-1;q>=0;q--)(Y=N[q])&&(z=(F<3?Y(z):F>3?Y(M,B,z):Y(M,B))||z);return F>3&&z&&Object.defineProperty(M,B,z),z},p=this&&this.__param||function(N,M){return function(B,H){M(B,H,N)}};Object.defineProperty(o,"__esModule",{value:!0}),o.SelectionService=void 0;const d=c(9806),_=c(9504),v=c(456),w=c(4725),C=c(8460),y=c(844),S=c(6114),x=c(4841),b=c(511),k=c(2585),D=" ",T=new RegExp(D,"g");let R=o.SelectionService=class extends y.Disposable{constructor(N,M,B,H,Y,F,z,q,G){super(),this._element=N,this._screenElement=M,this._linkifier=B,this._bufferService=H,this._coreService=Y,this._mouseService=F,this._optionsService=z,this._renderService=q,this._coreBrowserService=G,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 C.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new C.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new C.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new C.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=X=>this._handleMouseMove(X),this._mouseUpListener=X=>this._handleMouseUp(X),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((X=>this._handleTrim(X))),this.register(this._bufferService.buffers.onBufferActivate((X=>this._handleBufferActivate(X)))),this.enable(),this._model=new v.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,y.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 N=this._model.finalSelectionStart,M=this._model.finalSelectionEnd;return!(!N||!M||N[0]===M[0]&&N[1]===M[1])}get selectionText(){const N=this._model.finalSelectionStart,M=this._model.finalSelectionEnd;if(!N||!M)return"";const B=this._bufferService.buffer,H=[];if(this._activeSelectionMode===3){if(N[0]===M[0])return"";const Y=N[0]Y.replace(T," "))).join(S.isWindows?`\r +WARNING: This link could potentially be dangerous`)){const S=window.open();if(S){try{S.opener=null}catch{}S.location.href=b}else console.warn("Opening link blocked as opener could not be cleared")}}o.OscLinkProvider=v=f([p(0,_.IBufferService),p(1,_.IOptionsService),p(2,_.IOscLinkService)],v)},6193:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.RenderDebouncer=void 0,o.RenderDebouncer=class{constructor(c,f){this._renderCallback=c,this._coreBrowserService=f,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(c){return this._refreshCallbacks.push(c),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh()))),this._animationFrame}refresh(c,f,p){this._rowCount=p,c=c!==void 0?c:0,f=f!==void 0?f:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,c):c,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,f):f,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 c=Math.max(this._rowStart,0),f=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(c,f),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const c of this._refreshCallbacks)c(0);this._refreshCallbacks=[]}}},3236:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.Terminal=void 0;const f=c(3614),p=c(3656),d=c(3551),_=c(9042),v=c(3730),w=c(1680),C=c(3107),b=c(5744),S=c(2950),x=c(1296),y=c(428),k=c(4269),D=c(5114),T=c(8934),R=c(3230),N=c(9312),M=c(4725),B=c(6731),H=c(8055),Y=c(8969),F=c(8460),z=c(844),q=c(6114),G=c(8437),X=c(2584),K=c(7399),O=c(5941),L=c(9074),j=c(2585),$=c(5435),U=c(4567),Q=c(779);class re extends Y.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(Z={}){super(Z),this.browser=q,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new z.MutableDisposable),this._onCursorMove=this.register(new F.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new F.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new F.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new F.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new F.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new F.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new F.EventEmitter),this._onBlur=this.register(new F.EventEmitter),this._onA11yCharEmitter=this.register(new F.EventEmitter),this._onA11yTabEmitter=this.register(new F.EventEmitter),this._onWillOpen=this.register(new F.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(L.DecorationService),this._instantiationService.setService(j.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(Q.LinkProviderService),this._instantiationService.setService(M.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(v.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((P,ee)=>this.refresh(P,ee)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((P=>this._reportWindowsOptions(P)))),this.register(this._inputHandler.onColor((P=>this._handleColorEvent(P)))),this.register((0,F.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,F.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,F.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,F.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((P=>this._afterResize(P.cols,P.rows)))),this.register((0,z.toDisposable)((()=>{var P,ee;this._customKeyEventHandler=void 0,(ee=(P=this.element)==null?void 0:P.parentNode)==null||ee.removeChild(this.element)})))}_handleColorEvent(Z){if(this._themeService)for(const P of Z){let ee,ie="";switch(P.index){case 256:ee="foreground",ie="10";break;case 257:ee="background",ie="11";break;case 258:ee="cursor",ie="12";break;default:ee="ansi",ie="4;"+P.index}switch(P.type){case 0:const ge=H.color.toColorRGB(ee==="ansi"?this._themeService.colors.ansi[P.index]:this._themeService.colors[ee]);this.coreService.triggerDataEvent(`${X.C0.ESC}]${ie};${(0,O.toRgbString)(ge)}${X.C1_ESCAPED.ST}`);break;case 1:if(ee==="ansi")this._themeService.modifyColors((he=>he.ansi[P.index]=H.channels.toColor(...P.color)));else{const he=ee;this._themeService.modifyColors((ye=>ye[he]=H.channels.toColor(...P.color)))}break;case 2:this._themeService.restoreColor(P.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(Z){Z?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(U.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(Z){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(X.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var Z;return(Z=this.textarea)==null?void 0:Z.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(X.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 Z=this.buffer.ybase+this.buffer.y,P=this.buffer.lines.get(Z);if(!P)return;const ee=Math.min(this.buffer.x,this.cols-1),ie=this._renderService.dimensions.css.cell.height,ge=P.getWidth(ee),he=this._renderService.dimensions.css.cell.width*ge,ye=this.buffer.y*this._renderService.dimensions.css.cell.height,Se=ee*this._renderService.dimensions.css.cell.width;this.textarea.style.left=Se+"px",this.textarea.style.top=ye+"px",this.textarea.style.width=he+"px",this.textarea.style.height=ie+"px",this.textarea.style.lineHeight=ie+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,p.addDisposableDomListener)(this.element,"copy",(P=>{this.hasSelection()&&(0,f.copyHandler)(P,this._selectionService)})));const Z=P=>(0,f.handlePasteEvent)(P,this.textarea,this.coreService,this.optionsService);this.register((0,p.addDisposableDomListener)(this.textarea,"paste",Z)),this.register((0,p.addDisposableDomListener)(this.element,"paste",Z)),q.isFirefox?this.register((0,p.addDisposableDomListener)(this.element,"mousedown",(P=>{P.button===2&&(0,f.rightClickHandler)(P,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,p.addDisposableDomListener)(this.element,"contextmenu",(P=>{(0,f.rightClickHandler)(P,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),q.isLinux&&this.register((0,p.addDisposableDomListener)(this.element,"auxclick",(P=>{P.button===1&&(0,f.moveTextAreaUnderMouseCursor)(P,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,p.addDisposableDomListener)(this.textarea,"keyup",(Z=>this._keyUp(Z)),!0)),this.register((0,p.addDisposableDomListener)(this.textarea,"keydown",(Z=>this._keyDown(Z)),!0)),this.register((0,p.addDisposableDomListener)(this.textarea,"keypress",(Z=>this._keyPress(Z)),!0)),this.register((0,p.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,p.addDisposableDomListener)(this.textarea,"compositionupdate",(Z=>this._compositionHelper.compositionupdate(Z)))),this.register((0,p.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,p.addDisposableDomListener)(this.textarea,"input",(Z=>this._inputEvent(Z)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(Z){var ee;if(!Z)throw new Error("Terminal requires a parent element.");if(Z.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((ee=this.element)==null?void 0:ee.ownerDocument.defaultView)&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=Z.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"),Z.appendChild(this.element);const P=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),P.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,p.addDisposableDomListener)(this.screenElement,"mousemove",(ie=>this.updateCursorStyle(ie)))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),P.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",_.promptLabel),q.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(D.CoreBrowserService,this.textarea,Z.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(M.ICoreBrowserService,this._coreBrowserService),this.register((0,p.addDisposableDomListener)(this.textarea,"focus",(ie=>this._handleTextAreaFocus(ie)))),this.register((0,p.addDisposableDomListener)(this.textarea,"blur",(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(y.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(M.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(B.ThemeService),this._instantiationService.setService(M.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(k.CharacterJoinerService),this._instantiationService.setService(M.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(R.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(M.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((ie=>this._onRender.fire(ie)))),this.onResize((ie=>this._renderService.resize(ie.cols,ie.rows))),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(S.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(T.MouseService),this._instantiationService.setService(M.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(d.Linkifier,this.screenElement)),this.element.appendChild(P);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(w.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((ie=>this.scrollLines(ie.amount,ie.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(N.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(M.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((ie=>this.scrollLines(ie.amount,ie.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((ie=>this._renderService.handleSelectionChanged(ie.start,ie.end,ie.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((ie=>{this.textarea.value=ie,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((ie=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,p.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(C.BufferDecorationRenderer,this.screenElement)),this.register((0,p.addDisposableDomListener)(this.element,"mousedown",(ie=>this._selectionService.handleMouseDown(ie)))),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(U.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(ie=>this._handleScreenReaderModeOptionChange(ie)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(b.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(ie=>{!this._overviewRulerRenderer&&ie&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(b.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 Z=this,P=this.element;function ee(he){const ye=Z._mouseService.getMouseReportCoords(he,Z.screenElement);if(!ye)return!1;let Se,Ae;switch(he.overrideType||he.type){case"mousemove":Ae=32,he.buttons===void 0?(Se=3,he.button!==void 0&&(Se=he.button<3?he.button:3)):Se=1&he.buttons?0:4&he.buttons?1:2&he.buttons?2:3;break;case"mouseup":Ae=0,Se=he.button<3?he.button:3;break;case"mousedown":Ae=1,Se=he.button<3?he.button:3;break;case"wheel":if(Z._customWheelEventHandler&&Z._customWheelEventHandler(he)===!1||Z.viewport.getLinesScrolled(he)===0)return!1;Ae=he.deltaY<0?0:1,Se=4;break;default:return!1}return!(Ae===void 0||Se===void 0||Se>4)&&Z.coreMouseService.triggerMouseEvent({col:ye.col,row:ye.row,x:ye.x,y:ye.y,button:Se,action:Ae,ctrl:he.ctrlKey,alt:he.altKey,shift:he.shiftKey})}const ie={mouseup:null,wheel:null,mousedrag:null,mousemove:null},ge={mouseup:he=>(ee(he),he.buttons||(this._document.removeEventListener("mouseup",ie.mouseup),ie.mousedrag&&this._document.removeEventListener("mousemove",ie.mousedrag)),this.cancel(he)),wheel:he=>(ee(he),this.cancel(he,!0)),mousedrag:he=>{he.buttons&&ee(he)},mousemove:he=>{he.buttons||ee(he)}};this.register(this.coreMouseService.onProtocolChange((he=>{he?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(he)),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&he?ie.mousemove||(P.addEventListener("mousemove",ge.mousemove),ie.mousemove=ge.mousemove):(P.removeEventListener("mousemove",ie.mousemove),ie.mousemove=null),16&he?ie.wheel||(P.addEventListener("wheel",ge.wheel,{passive:!1}),ie.wheel=ge.wheel):(P.removeEventListener("wheel",ie.wheel),ie.wheel=null),2&he?ie.mouseup||(ie.mouseup=ge.mouseup):(this._document.removeEventListener("mouseup",ie.mouseup),ie.mouseup=null),4&he?ie.mousedrag||(ie.mousedrag=ge.mousedrag):(this._document.removeEventListener("mousemove",ie.mousedrag),ie.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,p.addDisposableDomListener)(P,"mousedown",(he=>{if(he.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(he))return ee(he),ie.mouseup&&this._document.addEventListener("mouseup",ie.mouseup),ie.mousedrag&&this._document.addEventListener("mousemove",ie.mousedrag),this.cancel(he)}))),this.register((0,p.addDisposableDomListener)(P,"wheel",(he=>{if(!ie.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(he)===!1)return!1;if(!this.buffer.hasScrollback){const ye=this.viewport.getLinesScrolled(he);if(ye===0)return;const Se=X.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(he.deltaY<0?"A":"B");let Ae="";for(let Ce=0;Ce{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(he),this.cancel(he)}),{passive:!0})),this.register((0,p.addDisposableDomListener)(P,"touchmove",(he=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(he)?void 0:this.cancel(he)}),{passive:!1}))}refresh(Z,P){var ee;(ee=this._renderService)==null||ee.refreshRows(Z,P)}updateCursorStyle(Z){var P;(P=this._selectionService)!=null&&P.shouldColumnSelect(Z)?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(Z,P,ee=0){var ie;ee===1?(super.scrollLines(Z,P,ee),this.refresh(0,this.rows-1)):(ie=this.viewport)==null||ie.scrollLines(Z)}paste(Z){(0,f.paste)(Z,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(Z){this._customKeyEventHandler=Z}attachCustomWheelEventHandler(Z){this._customWheelEventHandler=Z}registerLinkProvider(Z){return this._linkProviderService.registerLinkProvider(Z)}registerCharacterJoiner(Z){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const P=this._characterJoinerService.register(Z);return this.refresh(0,this.rows-1),P}deregisterCharacterJoiner(Z){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(Z)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(Z){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+Z)}registerDecoration(Z){return this._decorationService.registerDecoration(Z)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(Z,P,ee){this._selectionService.setSelection(Z,P,ee)}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 Z;(Z=this._selectionService)==null||Z.clearSelection()}selectAll(){var Z;(Z=this._selectionService)==null||Z.selectAll()}selectLines(Z,P){var ee;(ee=this._selectionService)==null||ee.selectLines(Z,P)}_keyDown(Z){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(Z)===!1)return!1;const P=this.browser.isMac&&this.options.macOptionIsMeta&&Z.altKey;if(!P&&!this._compositionHelper.keydown(Z))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;P||Z.key!=="Dead"&&Z.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const ee=(0,K.evaluateKeyboardEvent)(Z,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(Z),ee.type===3||ee.type===2){const ie=this.rows-1;return this.scrollLines(ee.type===2?-ie:ie),this.cancel(Z,!0)}return ee.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,Z)||(ee.cancel&&this.cancel(Z,!0),!ee.key||!!(Z.key&&!Z.ctrlKey&&!Z.altKey&&!Z.metaKey&&Z.key.length===1&&Z.key.charCodeAt(0)>=65&&Z.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(ee.key!==X.C0.ETX&&ee.key!==X.C0.CR||(this.textarea.value=""),this._onKey.fire({key:ee.key,domEvent:Z}),this._showCursor(),this.coreService.triggerDataEvent(ee.key,!0),!this.optionsService.rawOptions.screenReaderMode||Z.altKey||Z.ctrlKey?this.cancel(Z,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(Z,P){const ee=Z.isMac&&!this.options.macOptionIsMeta&&P.altKey&&!P.ctrlKey&&!P.metaKey||Z.isWindows&&P.altKey&&P.ctrlKey&&!P.metaKey||Z.isWindows&&P.getModifierState("AltGraph");return P.type==="keypress"?ee:ee&&(!P.keyCode||P.keyCode>47)}_keyUp(Z){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(Z)===!1||((function(P){return P.keyCode===16||P.keyCode===17||P.keyCode===18})(Z)||this.focus(),this.updateCursorStyle(Z),this._keyPressHandled=!1)}_keyPress(Z){let P;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(Z)===!1)return!1;if(this.cancel(Z),Z.charCode)P=Z.charCode;else if(Z.which===null||Z.which===void 0)P=Z.keyCode;else{if(Z.which===0||Z.charCode===0)return!1;P=Z.which}return!(!P||(Z.altKey||Z.ctrlKey||Z.metaKey)&&!this._isThirdLevelShift(this.browser,Z)||(P=String.fromCharCode(P),this._onKey.fire({key:P,domEvent:Z}),this._showCursor(),this.coreService.triggerDataEvent(P,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(Z){if(Z.data&&Z.inputType==="insertText"&&(!Z.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const P=Z.data;return this.coreService.triggerDataEvent(P,!0),this.cancel(Z),!0}return!1}resize(Z,P){Z!==this.cols||P!==this.rows?super.resize(Z,P):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(Z,P){var ee,ie;(ee=this._charSizeService)==null||ee.measure(),(ie=this.viewport)==null||ie.syncScrollArea(!0)}clear(){var Z;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 P=1;P{Object.defineProperty(o,"__esModule",{value:!0}),o.TimeBasedDebouncer=void 0,o.TimeBasedDebouncer=class{constructor(c,f=1e3){this._renderCallback=c,this._debounceThresholdMS=f,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(c,f,p){this._rowCount=p,c=c!==void 0?c:0,f=f!==void 0?f:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,c):c,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,f):f;const d=Date.now();if(d-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=d,this._innerRefresh();else if(!this._additionalRefreshRequested){const _=d-this._lastRefreshMs,v=this._debounceThresholdMS-_;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),v)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const c=Math.max(this._rowStart,0),f=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(c,f)}}},1680:function(u,o,c){var f=this&&this.__decorate||function(S,x,y,k){var D,T=arguments.length,R=T<3?x:k===null?k=Object.getOwnPropertyDescriptor(x,y):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(S,x,y,k);else for(var N=S.length-1;N>=0;N--)(D=S[N])&&(R=(T<3?D(R):T>3?D(x,y,R):D(x,y))||R);return T>3&&R&&Object.defineProperty(x,y,R),R},p=this&&this.__param||function(S,x){return function(y,k){x(y,k,S)}};Object.defineProperty(o,"__esModule",{value:!0}),o.Viewport=void 0;const d=c(3656),_=c(4725),v=c(8460),w=c(844),C=c(2585);let b=o.Viewport=class extends w.Disposable{constructor(S,x,y,k,D,T,R,N){super(),this._viewportElement=S,this._scrollArea=x,this._bufferService=y,this._optionsService=k,this._charSizeService=D,this._renderService=T,this._coreBrowserService=R,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 v.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((M=>this._activeBuffer=M.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((M=>this._renderDimensions=M))),this._handleThemeChange(N.colors),this.register(N.onChangeColors((M=>this._handleThemeChange(M)))),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(S){this._viewportElement.style.backgroundColor=S.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(S){if(S)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 S=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==S&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=S),this._refreshAnimationFrame=null}syncScrollArea(S=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(S);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(S)}_handleScroll(S){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 S=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(S*(this._smoothScrollState.target-this._smoothScrollState.origin)),S<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(S,x){const y=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(x<0&&this._viewportElement.scrollTop!==0||x>0&&y0&&(y=Y),k=""}}return{bufferElements:D,cursorElement:y}}getLinesScrolled(S){if(S.deltaY===0||S.shiftKey)return 0;let x=this._applyScrollModifier(S.deltaY,S);return S.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):S.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(x*=this._bufferService.rows),x}_applyScrollModifier(S,x){const y=this._optionsService.rawOptions.fastScrollModifier;return y==="alt"&&x.altKey||y==="ctrl"&&x.ctrlKey||y==="shift"&&x.shiftKey?S*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:S*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(S){this._lastTouchY=S.touches[0].pageY}handleTouchMove(S){const x=this._lastTouchY-S.touches[0].pageY;return this._lastTouchY=S.touches[0].pageY,x!==0&&(this._viewportElement.scrollTop+=x,this._bubbleScroll(S,x))}};o.Viewport=b=f([p(2,C.IBufferService),p(3,C.IOptionsService),p(4,_.ICharSizeService),p(5,_.IRenderService),p(6,_.ICoreBrowserService),p(7,_.IThemeService)],b)},3107:function(u,o,c){var f=this&&this.__decorate||function(C,b,S,x){var y,k=arguments.length,D=k<3?b:x===null?x=Object.getOwnPropertyDescriptor(b,S):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(C,b,S,x);else for(var T=C.length-1;T>=0;T--)(y=C[T])&&(D=(k<3?y(D):k>3?y(b,S,D):y(b,S))||D);return k>3&&D&&Object.defineProperty(b,S,D),D},p=this&&this.__param||function(C,b){return function(S,x){b(S,x,C)}};Object.defineProperty(o,"__esModule",{value:!0}),o.BufferDecorationRenderer=void 0;const d=c(4725),_=c(844),v=c(2585);let w=o.BufferDecorationRenderer=class extends _.Disposable{constructor(C,b,S,x,y){super(),this._screenElement=C,this._bufferService=b,this._coreBrowserService=S,this._decorationService=x,this._renderService=y,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((k=>this._removeDecoration(k)))),this.register((0,_.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 C of this._decorationService.decorations)this._renderDecoration(C);this._dimensionsChanged=!1}_renderDecoration(C){this._refreshStyle(C),this._dimensionsChanged&&this._refreshXPosition(C)}_createElement(C){var x;const b=this._coreBrowserService.mainDocument.createElement("div");b.classList.add("xterm-decoration"),b.classList.toggle("xterm-decoration-top-layer",((x=C==null?void 0:C.options)==null?void 0:x.layer)==="top"),b.style.width=`${Math.round((C.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,b.style.height=(C.options.height||1)*this._renderService.dimensions.css.cell.height+"px",b.style.top=(C.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",b.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const S=C.options.x??0;return S&&S>this._bufferService.cols&&(b.style.display="none"),this._refreshXPosition(C,b),b}_refreshStyle(C){const b=C.marker.line-this._bufferService.buffers.active.ydisp;if(b<0||b>=this._bufferService.rows)C.element&&(C.element.style.display="none",C.onRenderEmitter.fire(C.element));else{let S=this._decorationElements.get(C);S||(S=this._createElement(C),C.element=S,this._decorationElements.set(C,S),this._container.appendChild(S),C.onDispose((()=>{this._decorationElements.delete(C),S.remove()}))),S.style.top=b*this._renderService.dimensions.css.cell.height+"px",S.style.display=this._altBufferIsActive?"none":"block",C.onRenderEmitter.fire(S)}}_refreshXPosition(C,b=C.element){if(!b)return;const S=C.options.x??0;(C.options.anchor||"left")==="right"?b.style.right=S?S*this._renderService.dimensions.css.cell.width+"px":"":b.style.left=S?S*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(C){var b;(b=this._decorationElements.get(C))==null||b.remove(),this._decorationElements.delete(C),C.dispose()}};o.BufferDecorationRenderer=w=f([p(1,v.IBufferService),p(2,d.ICoreBrowserService),p(3,v.IDecorationService),p(4,d.IRenderService)],w)},5871:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.ColorZoneStore=void 0,o.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(c){if(c.options.overviewRulerOptions){for(const f of this._zones)if(f.color===c.options.overviewRulerOptions.color&&f.position===c.options.overviewRulerOptions.position){if(this._lineIntersectsZone(f,c.marker.line))return;if(this._lineAdjacentToZone(f,c.marker.line,c.options.overviewRulerOptions.position))return void this._addLineToZone(f,c.marker.line)}if(this._zonePoolIndex=c.startBufferLine&&f<=c.endBufferLine}_lineAdjacentToZone(c,f,p){return f>=c.startBufferLine-this._linePadding[p||"full"]&&f<=c.endBufferLine+this._linePadding[p||"full"]}_addLineToZone(c,f){c.startBufferLine=Math.min(c.startBufferLine,f),c.endBufferLine=Math.max(c.endBufferLine,f)}}},5744:function(u,o,c){var f=this&&this.__decorate||function(y,k,D,T){var R,N=arguments.length,M=N<3?k:T===null?T=Object.getOwnPropertyDescriptor(k,D):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")M=Reflect.decorate(y,k,D,T);else for(var B=y.length-1;B>=0;B--)(R=y[B])&&(M=(N<3?R(M):N>3?R(k,D,M):R(k,D))||M);return N>3&&M&&Object.defineProperty(k,D,M),M},p=this&&this.__param||function(y,k){return function(D,T){k(D,T,y)}};Object.defineProperty(o,"__esModule",{value:!0}),o.OverviewRulerRenderer=void 0;const d=c(5871),_=c(4725),v=c(844),w=c(2585),C={full:0,left:0,center:0,right:0},b={full:0,left:0,center:0,right:0},S={full:0,left:0,center:0,right:0};let x=o.OverviewRulerRenderer=class extends v.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(y,k,D,T,R,N,M){var H;super(),this._viewportElement=y,this._screenElement=k,this._bufferService=D,this._decorationService=T,this._renderService=R,this._optionsService=N,this._coreBrowserService=M,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(),(H=this._viewportElement.parentElement)==null||H.insertBefore(this._canvas,this._viewportElement);const B=this._canvas.getContext("2d");if(!B)throw new Error("Ctx cannot be null");this._ctx=B,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,v.toDisposable)((()=>{var Y;(Y=this._canvas)==null||Y.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 y=Math.floor(this._canvas.width/3),k=Math.ceil(this._canvas.width/3);b.full=this._canvas.width,b.left=y,b.center=k,b.right=y,this._refreshDrawHeightConstants(),S.full=0,S.left=0,S.center=b.left,S.right=b.left+b.center}_refreshDrawHeightConstants(){C.full=Math.round(2*this._coreBrowserService.dpr);const y=this._canvas.height/this._bufferService.buffer.lines.length,k=Math.round(Math.max(Math.min(y,12),6)*this._coreBrowserService.dpr);C.left=k,C.center=k,C.right=k}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*C.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*C.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*C.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*C.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 k of this._decorationService.decorations)this._colorZoneStore.addDecoration(k);this._ctx.lineWidth=1;const y=this._colorZoneStore.zones;for(const k of y)k.position!=="full"&&this._renderColorZone(k);for(const k of y)k.position==="full"&&this._renderColorZone(k);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(y){this._ctx.fillStyle=y.color,this._ctx.fillRect(S[y.position||"full"],Math.round((this._canvas.height-1)*(y.startBufferLine/this._bufferService.buffers.active.lines.length)-C[y.position||"full"]/2),b[y.position||"full"],Math.round((this._canvas.height-1)*((y.endBufferLine-y.startBufferLine)/this._bufferService.buffers.active.lines.length)+C[y.position||"full"]))}_queueRefresh(y,k){this._shouldUpdateDimensions=y||this._shouldUpdateDimensions,this._shouldUpdateAnchor=k||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};o.OverviewRulerRenderer=x=f([p(2,w.IBufferService),p(3,w.IDecorationService),p(4,_.IRenderService),p(5,w.IOptionsService),p(6,_.ICoreBrowserService)],x)},2950:function(u,o,c){var f=this&&this.__decorate||function(C,b,S,x){var y,k=arguments.length,D=k<3?b:x===null?x=Object.getOwnPropertyDescriptor(b,S):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(C,b,S,x);else for(var T=C.length-1;T>=0;T--)(y=C[T])&&(D=(k<3?y(D):k>3?y(b,S,D):y(b,S))||D);return k>3&&D&&Object.defineProperty(b,S,D),D},p=this&&this.__param||function(C,b){return function(S,x){b(S,x,C)}};Object.defineProperty(o,"__esModule",{value:!0}),o.CompositionHelper=void 0;const d=c(4725),_=c(2585),v=c(2584);let w=o.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(C,b,S,x,y,k){this._textarea=C,this._compositionView=b,this._bufferService=S,this._optionsService=x,this._coreService=y,this._renderService=k,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(C){this._compositionView.textContent=C.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(C){if(this._isComposing||this._isSendingComposition){if(C.keyCode===229||C.keyCode===16||C.keyCode===17||C.keyCode===18)return!1;this._finalizeComposition(!1)}return C.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(C){if(this._compositionView.classList.remove("active"),this._isComposing=!1,C){const b={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let S;this._isSendingComposition=!1,b.start+=this._dataAlreadySent.length,S=this._isComposing?this._textarea.value.substring(b.start,b.end):this._textarea.value.substring(b.start),S.length>0&&this._coreService.triggerDataEvent(S,!0)}}),0)}else{this._isSendingComposition=!1;const b=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(b,!0)}}_handleAnyTextareaChanges(){const C=this._textarea.value;setTimeout((()=>{if(!this._isComposing){const b=this._textarea.value,S=b.replace(C,"");this._dataAlreadySent=S,b.length>C.length?this._coreService.triggerDataEvent(S,!0):b.lengththis.updateCompositionElements(!0)),0)}}};o.CompositionHelper=w=f([p(2,_.IBufferService),p(3,_.IOptionsService),p(4,_.ICoreService),p(5,d.IRenderService)],w)},9806:(u,o)=>{function c(f,p,d){const _=d.getBoundingClientRect(),v=f.getComputedStyle(d),w=parseInt(v.getPropertyValue("padding-left")),C=parseInt(v.getPropertyValue("padding-top"));return[p.clientX-_.left-w,p.clientY-_.top-C]}Object.defineProperty(o,"__esModule",{value:!0}),o.getCoords=o.getCoordsRelativeToElement=void 0,o.getCoordsRelativeToElement=c,o.getCoords=function(f,p,d,_,v,w,C,b,S){if(!w)return;const x=c(f,p,d);return x?(x[0]=Math.ceil((x[0]+(S?C/2:0))/C),x[1]=Math.ceil(x[1]/b),x[0]=Math.min(Math.max(x[0],1),_+(S?1:0)),x[1]=Math.min(Math.max(x[1],1),v),x):void 0}},9504:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.moveToCellSequence=void 0;const f=c(2584);function p(b,S,x,y){const k=b-d(b,x),D=S-d(S,x),T=Math.abs(k-D)-(function(R,N,M){let B=0;const H=R-d(R,M),Y=N-d(N,M);for(let F=0;F=0&&bS?"A":"B"}function v(b,S,x,y,k,D){let T=b,R=S,N="";for(;T!==x||R!==y;)T+=k?1:-1,k&&T>D.cols-1?(N+=D.buffer.translateBufferLineToString(R,!1,b,T),T=0,b=0,R++):!k&&T<0&&(N+=D.buffer.translateBufferLineToString(R,!1,0,b+1),T=D.cols-1,b=T,R--);return N+D.buffer.translateBufferLineToString(R,!1,b,T)}function w(b,S){const x=S?"O":"[";return f.C0.ESC+x+b}function C(b,S){b=Math.floor(b);let x="";for(let y=0;y0?H-d(H,Y):M;const q=H,G=(function(X,K,O,L,j,$){let U;return U=p(O,L,j,$).length>0?L-d(L,j):K,X=O&&Ub?"D":"C",C(Math.abs(k-b),w(T,y));T=D>S?"D":"C";const R=Math.abs(D-S);return C((function(N,M){return M.cols-N})(D>S?b:k,x)+(R-1)*x.cols+1+((D>S?k:b)-1),w(T,y))}},1296:function(u,o,c){var f=this&&this.__decorate||function(F,z,q,G){var X,K=arguments.length,O=K<3?z:G===null?G=Object.getOwnPropertyDescriptor(z,q):G;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")O=Reflect.decorate(F,z,q,G);else for(var L=F.length-1;L>=0;L--)(X=F[L])&&(O=(K<3?X(O):K>3?X(z,q,O):X(z,q))||O);return K>3&&O&&Object.defineProperty(z,q,O),O},p=this&&this.__param||function(F,z){return function(q,G){z(q,G,F)}};Object.defineProperty(o,"__esModule",{value:!0}),o.DomRenderer=void 0;const d=c(3787),_=c(2550),v=c(2223),w=c(6171),C=c(6052),b=c(4725),S=c(8055),x=c(8460),y=c(844),k=c(2585),D="xterm-dom-renderer-owner-",T="xterm-rows",R="xterm-fg-",N="xterm-bg-",M="xterm-focus",B="xterm-selection";let H=1,Y=o.DomRenderer=class extends y.Disposable{constructor(F,z,q,G,X,K,O,L,j,$,U,Q,re){super(),this._terminal=F,this._document=z,this._element=q,this._screenElement=G,this._viewportElement=X,this._helperContainer=K,this._linkifier2=O,this._charSizeService=j,this._optionsService=$,this._bufferService=U,this._coreBrowserService=Q,this._themeService=re,this._terminalClass=H++,this._rowElements=[],this._selectionRenderModel=(0,C.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new x.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(T),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(B),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,w.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((ae=>this._injectCss(ae)))),this._injectCss(this._themeService.colors),this._rowFactory=L.createInstance(d.DomRendererRowFactory,document),this._element.classList.add(D+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((ae=>this._handleLinkHover(ae)))),this.register(this._linkifier2.onHideLinkUnderline((ae=>this._handleLinkLeave(ae)))),this.register((0,y.toDisposable)((()=>{this._element.classList.remove(D+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new _.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 F=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*F,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*F),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/F),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/F),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 q of this._rowElements)q.style.width=`${this.dimensions.css.canvas.width}px`,q.style.height=`${this.dimensions.css.cell.height}px`,q.style.lineHeight=`${this.dimensions.css.cell.height}px`,q.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const z=`${this._terminalSelector} .${T} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=z,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(F){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let z=`${this._terminalSelector} .${T} { color: ${F.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;z+=`${this._terminalSelector} .${T} .xterm-dim { color: ${S.color.multiplyOpacity(F.foreground,.5).css};}`,z+=`${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 q=`blink_underline_${this._terminalClass}`,G=`blink_bar_${this._terminalClass}`,X=`blink_block_${this._terminalClass}`;z+=`@keyframes ${q} { 50% { border-bottom-style: hidden; }}`,z+=`@keyframes ${G} { 50% { box-shadow: none; }}`,z+=`@keyframes ${X} { 0% { background-color: ${F.cursor.css}; color: ${F.cursorAccent.css}; } 50% { background-color: inherit; color: ${F.cursor.css}; }}`,z+=`${this._terminalSelector} .${T}.${M} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${q} 1s step-end infinite;}${this._terminalSelector} .${T}.${M} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${G} 1s step-end infinite;}${this._terminalSelector} .${T}.${M} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${X} 1s step-end infinite;}${this._terminalSelector} .${T} .xterm-cursor.xterm-cursor-block { background-color: ${F.cursor.css}; color: ${F.cursorAccent.css};}${this._terminalSelector} .${T} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${F.cursor.css} !important; color: ${F.cursorAccent.css} !important;}${this._terminalSelector} .${T} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${F.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${T} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${F.cursor.css} inset;}${this._terminalSelector} .${T} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${F.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,z+=`${this._terminalSelector} .${B} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${B} div { position: absolute; background-color: ${F.selectionBackgroundOpaque.css};}${this._terminalSelector} .${B} div { position: absolute; background-color: ${F.selectionInactiveBackgroundOpaque.css};}`;for(const[K,O]of F.ansi.entries())z+=`${this._terminalSelector} .${R}${K} { color: ${O.css}; }${this._terminalSelector} .${R}${K}.xterm-dim { color: ${S.color.multiplyOpacity(O,.5).css}; }${this._terminalSelector} .${N}${K} { background-color: ${O.css}; }`;z+=`${this._terminalSelector} .${R}${v.INVERTED_DEFAULT_COLOR} { color: ${S.color.opaque(F.background).css}; }${this._terminalSelector} .${R}${v.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${S.color.multiplyOpacity(S.color.opaque(F.background),.5).css}; }${this._terminalSelector} .${N}${v.INVERTED_DEFAULT_COLOR} { background-color: ${F.foreground.css}; }`,this._themeStyleElement.textContent=z}_setDefaultSpacing(){const F=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${F}px`,this._rowFactory.defaultSpacing=F}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(F,z){for(let q=this._rowElements.length;q<=z;q++){const G=this._document.createElement("div");this._rowContainer.appendChild(G),this._rowElements.push(G)}for(;this._rowElements.length>z;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(F,z){this._refreshRowElements(F,z),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(M),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(M),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(F,z,q){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(F,z,q),this.renderRows(0,this._bufferService.rows-1),!F||!z)return;this._selectionRenderModel.update(this._terminal,F,z,q);const G=this._selectionRenderModel.viewportStartRow,X=this._selectionRenderModel.viewportEndRow,K=this._selectionRenderModel.viewportCappedStartRow,O=this._selectionRenderModel.viewportCappedEndRow;if(K>=this._bufferService.rows||O<0)return;const L=this._document.createDocumentFragment();if(q){const j=F[0]>z[0];L.appendChild(this._createSelectionElement(K,j?z[0]:F[0],j?F[0]:z[0],O-K+1))}else{const j=G===K?F[0]:0,$=K===X?z[0]:this._bufferService.cols;L.appendChild(this._createSelectionElement(K,j,$));const U=O-K-1;if(L.appendChild(this._createSelectionElement(K+1,0,this._bufferService.cols,U)),K!==O){const Q=X===O?z[0]:this._bufferService.cols;L.appendChild(this._createSelectionElement(O,0,Q))}}this._selectionContainer.appendChild(L)}_createSelectionElement(F,z,q,G=1){const X=this._document.createElement("div"),K=z*this.dimensions.css.cell.width;let O=this.dimensions.css.cell.width*(q-z);return K+O>this.dimensions.css.canvas.width&&(O=this.dimensions.css.canvas.width-K),X.style.height=G*this.dimensions.css.cell.height+"px",X.style.top=F*this.dimensions.css.cell.height+"px",X.style.left=`${K}px`,X.style.width=`${O}px`,X}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 F of this._rowElements)F.replaceChildren()}renderRows(F,z){const q=this._bufferService.buffer,G=q.ybase+q.y,X=Math.min(q.x,this._bufferService.cols-1),K=this._optionsService.rawOptions.cursorBlink,O=this._optionsService.rawOptions.cursorStyle,L=this._optionsService.rawOptions.cursorInactiveStyle;for(let j=F;j<=z;j++){const $=j+q.ydisp,U=this._rowElements[j],Q=q.lines.get($);if(!U||!Q)break;U.replaceChildren(...this._rowFactory.createRow(Q,$,$===G,O,L,X,K,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${D}${this._terminalClass}`}_handleLinkHover(F){this._setCellUnderline(F.x1,F.x2,F.y1,F.y2,F.cols,!0)}_handleLinkLeave(F){this._setCellUnderline(F.x1,F.x2,F.y1,F.y2,F.cols,!1)}_setCellUnderline(F,z,q,G,X,K){q<0&&(F=0),G<0&&(z=0);const O=this._bufferService.rows-1;q=Math.max(Math.min(q,O),0),G=Math.max(Math.min(G,O),0),X=Math.min(X,this._bufferService.cols);const L=this._bufferService.buffer,j=L.ybase+L.y,$=Math.min(L.x,X-1),U=this._optionsService.rawOptions.cursorBlink,Q=this._optionsService.rawOptions.cursorStyle,re=this._optionsService.rawOptions.cursorInactiveStyle;for(let ae=q;ae<=G;++ae){const Z=ae+L.ydisp,P=this._rowElements[ae],ee=L.lines.get(Z);if(!P||!ee)break;P.replaceChildren(...this._rowFactory.createRow(ee,Z,Z===j,Q,re,$,U,this.dimensions.css.cell.width,this._widthCache,K?ae===q?F:0:-1,K?(ae===G?z:X)-1:-1))}}};o.DomRenderer=Y=f([p(7,k.IInstantiationService),p(8,b.ICharSizeService),p(9,k.IOptionsService),p(10,k.IBufferService),p(11,b.ICoreBrowserService),p(12,b.IThemeService)],Y)},3787:function(u,o,c){var f=this&&this.__decorate||function(T,R,N,M){var B,H=arguments.length,Y=H<3?R:M===null?M=Object.getOwnPropertyDescriptor(R,N):M;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")Y=Reflect.decorate(T,R,N,M);else for(var F=T.length-1;F>=0;F--)(B=T[F])&&(Y=(H<3?B(Y):H>3?B(R,N,Y):B(R,N))||Y);return H>3&&Y&&Object.defineProperty(R,N,Y),Y},p=this&&this.__param||function(T,R){return function(N,M){R(N,M,T)}};Object.defineProperty(o,"__esModule",{value:!0}),o.DomRendererRowFactory=void 0;const d=c(2223),_=c(643),v=c(511),w=c(2585),C=c(8055),b=c(4725),S=c(4269),x=c(6171),y=c(3734);let k=o.DomRendererRowFactory=class{constructor(T,R,N,M,B,H,Y){this._document=T,this._characterJoinerService=R,this._optionsService=N,this._coreBrowserService=M,this._coreService=B,this._decorationService=H,this._themeService=Y,this._workCell=new v.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(T,R,N){this._selectionStart=T,this._selectionEnd=R,this._columnSelectMode=N}createRow(T,R,N,M,B,H,Y,F,z,q,G){const X=[],K=this._characterJoinerService.getJoinedCharacters(R),O=this._themeService.colors;let L,j=T.getNoBgTrimmedLength();N&&j0&&ye===K[0][0]){Ae=!0;const Ie=K.shift();we=new S.JoinedCellData(this._workCell,T.translateToString(!0,Ie[0],Ie[1]),Ie[1]-Ie[0]),Ce=Ie[1]-1,Se=we.getWidth()}const at=this._isCellInSelection(ye,R),ht=N&&ye===H,Ke=he&&ye>=q&&ye<=G;let ct=!1;this._decorationService.forEachDecorationAtCell(ye,R,void 0,(Ie=>{ct=!0}));let Rt=we.getChars()||_.WHITESPACE_CELL_CHAR;if(Rt===" "&&(we.isUnderline()||we.isOverline())&&(Rt=" "),ie=Se*F-z.get(Rt,we.isBold(),we.isItalic()),L){if($&&(at&&ee||!at&&!ee&&we.bg===Q)&&(at&&ee&&O.selectionForeground||we.fg===re)&&we.extended.ext===ae&&Ke===Z&&ie===P&&!ht&&!Ae&&!ct){we.isInvisible()?U+=_.WHITESPACE_CELL_CHAR:U+=Rt,$++;continue}$&&(L.textContent=U),L=this._document.createElement("span"),$=0,U=""}else L=this._document.createElement("span");if(Q=we.bg,re=we.fg,ae=we.extended.ext,Z=Ke,P=ie,ee=at,Ae&&H>=ye&&H<=Ce&&(H=ye),!this._coreService.isCursorHidden&&ht&&this._coreService.isCursorInitialized){if(ge.push("xterm-cursor"),this._coreBrowserService.isFocused)Y&&ge.push("xterm-cursor-blink"),ge.push(M==="bar"?"xterm-cursor-bar":M==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(B)switch(B){case"outline":ge.push("xterm-cursor-outline");break;case"block":ge.push("xterm-cursor-block");break;case"bar":ge.push("xterm-cursor-bar");break;case"underline":ge.push("xterm-cursor-underline")}}if(we.isBold()&&ge.push("xterm-bold"),we.isItalic()&&ge.push("xterm-italic"),we.isDim()&&ge.push("xterm-dim"),U=we.isInvisible()?_.WHITESPACE_CELL_CHAR:we.getChars()||_.WHITESPACE_CELL_CHAR,we.isUnderline()&&(ge.push(`xterm-underline-${we.extended.underlineStyle}`),U===" "&&(U=" "),!we.isUnderlineColorDefault()))if(we.isUnderlineColorRGB())L.style.textDecorationColor=`rgb(${y.AttributeData.toColorRGB(we.getUnderlineColor()).join(",")})`;else{let Ie=we.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&we.isBold()&&Ie<8&&(Ie+=8),L.style.textDecorationColor=O.ansi[Ie].css}we.isOverline()&&(ge.push("xterm-overline"),U===" "&&(U=" ")),we.isStrikethrough()&&ge.push("xterm-strikethrough"),Ke&&(L.style.textDecoration="underline");let Ze=we.getFgColor(),$e=we.getFgColorMode(),de=we.getBgColor(),ne=we.getBgColorMode();const fe=!!we.isInverse();if(fe){const Ie=Ze;Ze=de,de=Ie;const Tt=$e;$e=ne,ne=Tt}let be,Ee,Oe,Qe=!1;switch(this._decorationService.forEachDecorationAtCell(ye,R,void 0,(Ie=>{Ie.options.layer!=="top"&&Qe||(Ie.backgroundColorRGB&&(ne=50331648,de=Ie.backgroundColorRGB.rgba>>8&16777215,be=Ie.backgroundColorRGB),Ie.foregroundColorRGB&&($e=50331648,Ze=Ie.foregroundColorRGB.rgba>>8&16777215,Ee=Ie.foregroundColorRGB),Qe=Ie.options.layer==="top")})),!Qe&&at&&(be=this._coreBrowserService.isFocused?O.selectionBackgroundOpaque:O.selectionInactiveBackgroundOpaque,de=be.rgba>>8&16777215,ne=50331648,Qe=!0,O.selectionForeground&&($e=50331648,Ze=O.selectionForeground.rgba>>8&16777215,Ee=O.selectionForeground)),Qe&&ge.push("xterm-decoration-top"),ne){case 16777216:case 33554432:Oe=O.ansi[de],ge.push(`xterm-bg-${de}`);break;case 50331648:Oe=C.channels.toColor(de>>16,de>>8&255,255&de),this._addStyle(L,`background-color:#${D((de>>>0).toString(16),"0",6)}`);break;default:fe?(Oe=O.foreground,ge.push(`xterm-bg-${d.INVERTED_DEFAULT_COLOR}`)):Oe=O.background}switch(be||we.isDim()&&(be=C.color.multiplyOpacity(Oe,.5)),$e){case 16777216:case 33554432:we.isBold()&&Ze<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(Ze+=8),this._applyMinimumContrast(L,Oe,O.ansi[Ze],we,be,void 0)||ge.push(`xterm-fg-${Ze}`);break;case 50331648:const Ie=C.channels.toColor(Ze>>16&255,Ze>>8&255,255&Ze);this._applyMinimumContrast(L,Oe,Ie,we,be,Ee)||this._addStyle(L,`color:#${D(Ze.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(L,Oe,O.foreground,we,be,Ee)||fe&&ge.push(`xterm-fg-${d.INVERTED_DEFAULT_COLOR}`)}ge.length&&(L.className=ge.join(" "),ge.length=0),ht||Ae||ct?L.textContent=U:$++,ie!==this.defaultSpacing&&(L.style.letterSpacing=`${ie}px`),X.push(L),ye=Ce}return L&&$&&(L.textContent=U),X}_applyMinimumContrast(T,R,N,M,B,H){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,x.treatGlyphAsBackgroundColor)(M.getCode()))return!1;const Y=this._getContrastCache(M);let F;if(B||H||(F=Y.getColor(R.rgba,N.rgba)),F===void 0){const z=this._optionsService.rawOptions.minimumContrastRatio/(M.isDim()?2:1);F=C.color.ensureContrastRatio(B||R,H||N,z),Y.setColor((B||R).rgba,(H||N).rgba,F??null)}return!!F&&(this._addStyle(T,`color:${F.css}`),!0)}_getContrastCache(T){return T.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(T,R){T.setAttribute("style",`${T.getAttribute("style")||""}${R};`)}_isCellInSelection(T,R){const N=this._selectionStart,M=this._selectionEnd;return!(!N||!M)&&(this._columnSelectMode?N[0]<=M[0]?T>=N[0]&&R>=N[1]&&T=N[1]&&T>=M[0]&&R<=M[1]:R>N[1]&&R=N[0]&&T=N[0])}};function D(T,R,N){for(;T.length{Object.defineProperty(o,"__esModule",{value:!0}),o.WidthCache=void 0,o.WidthCache=class{constructor(c,f){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=c.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 p=c.createElement("span");p.classList.add("xterm-char-measure-element");const d=c.createElement("span");d.classList.add("xterm-char-measure-element"),d.style.fontWeight="bold";const _=c.createElement("span");_.classList.add("xterm-char-measure-element"),_.style.fontStyle="italic";const v=c.createElement("span");v.classList.add("xterm-char-measure-element"),v.style.fontWeight="bold",v.style.fontStyle="italic",this._measureElements=[p,d,_,v],this._container.appendChild(p),this._container.appendChild(d),this._container.appendChild(_),this._container.appendChild(v),f.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(c,f,p,d){c===this._font&&f===this._fontSize&&p===this._weight&&d===this._weightBold||(this._font=c,this._fontSize=f,this._weight=p,this._weightBold=d,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${p}`,this._measureElements[1].style.fontWeight=`${d}`,this._measureElements[2].style.fontWeight=`${p}`,this._measureElements[3].style.fontWeight=`${d}`,this.clear())}get(c,f,p){let d=0;if(!f&&!p&&c.length===1&&(d=c.charCodeAt(0))<256){if(this._flat[d]!==-9999)return this._flat[d];const w=this._measure(c,0);return w>0&&(this._flat[d]=w),w}let _=c;f&&(_+="B"),p&&(_+="I");let v=this._holey.get(_);if(v===void 0){let w=0;f&&(w|=1),p&&(w|=2),v=this._measure(c,w),v>0&&this._holey.set(_,v)}return v}_measure(c,f){const p=this._measureElements[f];return p.textContent=c.repeat(32),p.offsetWidth/32}}},2223:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.TEXT_BASELINE=o.DIM_OPACITY=o.INVERTED_DEFAULT_COLOR=void 0;const f=c(6114);o.INVERTED_DEFAULT_COLOR=257,o.DIM_OPACITY=.5,o.TEXT_BASELINE=f.isFirefox||f.isLegacyEdge?"bottom":"ideographic"},6171:(u,o)=>{function c(p){return 57508<=p&&p<=57558}function f(p){return p>=128512&&p<=128591||p>=127744&&p<=128511||p>=128640&&p<=128767||p>=9728&&p<=9983||p>=9984&&p<=10175||p>=65024&&p<=65039||p>=129280&&p<=129535||p>=127462&&p<=127487}Object.defineProperty(o,"__esModule",{value:!0}),o.computeNextVariantOffset=o.createRenderDimensions=o.treatGlyphAsBackgroundColor=o.allowRescaling=o.isEmoji=o.isRestrictedPowerlineGlyph=o.isPowerlineGlyph=o.throwIfFalsy=void 0,o.throwIfFalsy=function(p){if(!p)throw new Error("value must not be falsy");return p},o.isPowerlineGlyph=c,o.isRestrictedPowerlineGlyph=function(p){return 57520<=p&&p<=57527},o.isEmoji=f,o.allowRescaling=function(p,d,_,v){return d===1&&_>Math.ceil(1.5*v)&&p!==void 0&&p>255&&!f(p)&&!c(p)&&!(function(w){return 57344<=w&&w<=63743})(p)},o.treatGlyphAsBackgroundColor=function(p){return c(p)||(function(d){return 9472<=d&&d<=9631})(p)},o.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}}}},o.computeNextVariantOffset=function(p,d,_=0){return(p-(2*Math.round(d)-_))%(2*Math.round(d))}},6052:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.createSelectionRenderModel=void 0;class c{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(p,d,_,v=!1){if(this.selectionStart=d,this.selectionEnd=_,!d||!_||d[0]===_[0]&&d[1]===_[1])return void this.clear();const w=p.buffers.active.ydisp,C=d[1]-w,b=_[1]-w,S=Math.max(C,0),x=Math.min(b,p.rows-1);S>=p.rows||x<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=v,this.viewportStartRow=C,this.viewportEndRow=b,this.viewportCappedStartRow=S,this.viewportCappedEndRow=x,this.startCol=d[0],this.endCol=_[0])}isCellSelected(p,d,_){return!!this.hasSelection&&(_-=p.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?d>=this.startCol&&_>=this.viewportCappedStartRow&&d=this.viewportCappedStartRow&&d>=this.endCol&&_<=this.viewportCappedEndRow:_>this.viewportStartRow&&_=this.startCol&&d=this.startCol)}}o.createSelectionRenderModel=function(){return new c}},456:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.SelectionModel=void 0,o.SelectionModel=class{constructor(c){this._bufferService=c,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 c=this.selectionStart[0]+this.selectionStartLength;return c>this._bufferService.cols?c%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(c/this._bufferService.cols)-1]:[c%this._bufferService.cols,this.selectionStart[1]+Math.floor(c/this._bufferService.cols)]:[c,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){const c=this.selectionStart[0]+this.selectionStartLength;return c>this._bufferService.cols?[c%this._bufferService.cols,this.selectionStart[1]+Math.floor(c/this._bufferService.cols)]:[Math.max(c,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){const c=this.selectionStart,f=this.selectionEnd;return!(!c||!f)&&(c[1]>f[1]||c[1]===f[1]&&c[0]>f[0])}handleTrim(c){return this.selectionStart&&(this.selectionStart[1]-=c),this.selectionEnd&&(this.selectionEnd[1]-=c),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(u,o,c){var f=this&&this.__decorate||function(x,y,k,D){var T,R=arguments.length,N=R<3?y:D===null?D=Object.getOwnPropertyDescriptor(y,k):D;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(x,y,k,D);else for(var M=x.length-1;M>=0;M--)(T=x[M])&&(N=(R<3?T(N):R>3?T(y,k,N):T(y,k))||N);return R>3&&N&&Object.defineProperty(y,k,N),N},p=this&&this.__param||function(x,y){return function(k,D){y(k,D,x)}};Object.defineProperty(o,"__esModule",{value:!0}),o.CharSizeService=void 0;const d=c(2585),_=c(8460),v=c(844);let w=o.CharSizeService=class extends v.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(x,y,k){super(),this._optionsService=k,this.width=0,this.height=0,this._onCharSizeChange=this.register(new _.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new S(this._optionsService))}catch{this._measureStrategy=this.register(new b(x,y,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())}};o.CharSizeService=w=f([p(2,d.IOptionsService)],w);class C extends v.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(y,k){y!==void 0&&y>0&&k!==void 0&&k>0&&(this._result.width=y,this._result.height=k)}}class b extends C{constructor(y,k,D){super(),this._document=y,this._parentElement=k,this._optionsService=D,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 S extends C{constructor(y){super(),this._optionsService=y,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");const k=this._ctx.measureText("W");if(!("width"in k&&"fontBoundingBoxAscent"in k&&"fontBoundingBoxDescent"in k))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;const y=this._ctx.measureText("W");return this._validateAndSet(y.width,y.fontBoundingBoxAscent+y.fontBoundingBoxDescent),this._result}}},4269:function(u,o,c){var f=this&&this.__decorate||function(S,x,y,k){var D,T=arguments.length,R=T<3?x:k===null?k=Object.getOwnPropertyDescriptor(x,y):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(S,x,y,k);else for(var N=S.length-1;N>=0;N--)(D=S[N])&&(R=(T<3?D(R):T>3?D(x,y,R):D(x,y))||R);return T>3&&R&&Object.defineProperty(x,y,R),R},p=this&&this.__param||function(S,x){return function(y,k){x(y,k,S)}};Object.defineProperty(o,"__esModule",{value:!0}),o.CharacterJoinerService=o.JoinedCellData=void 0;const d=c(3734),_=c(643),v=c(511),w=c(2585);class C extends d.AttributeData{constructor(x,y,k){super(),this.content=0,this.combinedData="",this.fg=x.fg,this.bg=x.bg,this.combinedData=y,this._width=k}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()]}}o.JoinedCellData=C;let b=o.CharacterJoinerService=class lC{constructor(x){this._bufferService=x,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new v.CellData}register(x){const y={id:this._nextCharacterJoinerId++,handler:x};return this._characterJoiners.push(y),y.id}deregister(x){for(let y=0;y1){const Y=this._getJoinedRanges(D,N,R,y,T);for(let F=0;F1){const H=this._getJoinedRanges(D,N,R,y,T);for(let Y=0;Y{Object.defineProperty(o,"__esModule",{value:!0}),o.CoreBrowserService=void 0;const f=c(844),p=c(8460),d=c(3656);class _ extends f.Disposable{constructor(C,b,S){super(),this._textarea=C,this._window=b,this.mainDocument=S,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new v(this._window),this._onDprChange=this.register(new p.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new p.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((x=>this._screenDprMonitor.setWindow(x)))),this.register((0,p.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(C){this._window!==C&&(this._window=C,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}}o.CoreBrowserService=_;class v extends f.Disposable{constructor(C){super(),this._parentWindow=C,this._windowResizeListener=this.register(new f.MutableDisposable),this._onDprChange=this.register(new p.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,f.toDisposable)((()=>this.clearListener())))}setWindow(C){this._parentWindow=C,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 C;this._outerListener&&((C=this._resolutionMediaMatchList)==null||C.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:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.LinkProviderService=void 0;const f=c(844);class p extends f.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,f.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(_){return this.linkProviders.push(_),{dispose:()=>{const v=this.linkProviders.indexOf(_);v!==-1&&this.linkProviders.splice(v,1)}}}}o.LinkProviderService=p},8934:function(u,o,c){var f=this&&this.__decorate||function(w,C,b,S){var x,y=arguments.length,k=y<3?C:S===null?S=Object.getOwnPropertyDescriptor(C,b):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(w,C,b,S);else for(var D=w.length-1;D>=0;D--)(x=w[D])&&(k=(y<3?x(k):y>3?x(C,b,k):x(C,b))||k);return y>3&&k&&Object.defineProperty(C,b,k),k},p=this&&this.__param||function(w,C){return function(b,S){C(b,S,w)}};Object.defineProperty(o,"__esModule",{value:!0}),o.MouseService=void 0;const d=c(4725),_=c(9806);let v=o.MouseService=class{constructor(w,C){this._renderService=w,this._charSizeService=C}getCoords(w,C,b,S,x){return(0,_.getCoords)(window,w,C,b,S,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,x)}getMouseReportCoords(w,C){const b=(0,_.getCoordsRelativeToElement)(window,w,C);if(this._charSizeService.hasValidSize)return b[0]=Math.min(Math.max(b[0],0),this._renderService.dimensions.css.canvas.width-1),b[1]=Math.min(Math.max(b[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(b[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(b[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(b[0]),y:Math.floor(b[1])}}};o.MouseService=v=f([p(0,d.IRenderService),p(1,d.ICharSizeService)],v)},3230:function(u,o,c){var f=this&&this.__decorate||function(x,y,k,D){var T,R=arguments.length,N=R<3?y:D===null?D=Object.getOwnPropertyDescriptor(y,k):D;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(x,y,k,D);else for(var M=x.length-1;M>=0;M--)(T=x[M])&&(N=(R<3?T(N):R>3?T(y,k,N):T(y,k))||N);return R>3&&N&&Object.defineProperty(y,k,N),N},p=this&&this.__param||function(x,y){return function(k,D){y(k,D,x)}};Object.defineProperty(o,"__esModule",{value:!0}),o.RenderService=void 0;const d=c(6193),_=c(4725),v=c(8460),w=c(844),C=c(7226),b=c(2585);let S=o.RenderService=class extends w.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(x,y,k,D,T,R,N,M){super(),this._rowCount=x,this._charSizeService=D,this._renderer=this.register(new w.MutableDisposable),this._pausedResizeTask=new C.DebouncedIdleTask,this._observerDisposable=this.register(new w.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 v.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new v.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new v.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new v.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new d.RenderDebouncer(((B,H)=>this._renderRows(B,H)),N),this.register(this._renderDebouncer),this.register(N.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(R.onResize((()=>this._fullRefresh()))),this.register(R.buffers.onBufferActivate((()=>{var B;return(B=this._renderer.value)==null?void 0:B.clear()}))),this.register(k.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(T.onDecorationRegistered((()=>this._fullRefresh()))),this.register(T.onDecorationRemoved((()=>this._fullRefresh()))),this.register(k.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],(()=>{this.clear(),this.handleResize(R.cols,R.rows),this._fullRefresh()}))),this.register(k.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(R.buffer.y,R.buffer.y,!0)))),this.register(M.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(N.window,y),this.register(N.onWindowChange((B=>this._registerIntersectionObserver(B,y))))}_registerIntersectionObserver(x,y){if("IntersectionObserver"in x){const k=new x.IntersectionObserver((D=>this._handleIntersectionChange(D[D.length-1])),{threshold:0});k.observe(y),this._observerDisposable.value=(0,w.toDisposable)((()=>k.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,y,k=!1){this._isPaused?this._needsFullRefresh=!0:(k||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(x,y,this._rowCount))}_renderRows(x,y){this._renderer.value&&(x=Math.min(x,this._rowCount-1),y=Math.min(y,this._rowCount-1),this._renderer.value.renderRows(x,y),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:y}),this._onRender.fire({start:x,end:y}),this._isNextRenderRedrawOnly=!0)}resize(x,y){this._rowCount=y,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((y=>this.refreshRows(y.start,y.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,y;this._renderer.value&&((y=(x=this._renderer.value).clearTextureAtlas)==null||y.call(x),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(x,y){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>{var k;return(k=this._renderer.value)==null?void 0:k.handleResize(x,y)})):this._renderer.value.handleResize(x,y),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,y,k){var D;this._selectionState.start=x,this._selectionState.end=y,this._selectionState.columnSelectMode=k,(D=this._renderer.value)==null||D.handleSelectionChanged(x,y,k)}handleCursorMove(){var x;(x=this._renderer.value)==null||x.handleCursorMove()}clear(){var x;(x=this._renderer.value)==null||x.clear()}};o.RenderService=S=f([p(2,b.IOptionsService),p(3,_.ICharSizeService),p(4,b.IDecorationService),p(5,b.IBufferService),p(6,_.ICoreBrowserService),p(7,_.IThemeService)],S)},9312:function(u,o,c){var f=this&&this.__decorate||function(N,M,B,H){var Y,F=arguments.length,z=F<3?M:H===null?H=Object.getOwnPropertyDescriptor(M,B):H;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")z=Reflect.decorate(N,M,B,H);else for(var q=N.length-1;q>=0;q--)(Y=N[q])&&(z=(F<3?Y(z):F>3?Y(M,B,z):Y(M,B))||z);return F>3&&z&&Object.defineProperty(M,B,z),z},p=this&&this.__param||function(N,M){return function(B,H){M(B,H,N)}};Object.defineProperty(o,"__esModule",{value:!0}),o.SelectionService=void 0;const d=c(9806),_=c(9504),v=c(456),w=c(4725),C=c(8460),b=c(844),S=c(6114),x=c(4841),y=c(511),k=c(2585),D=" ",T=new RegExp(D,"g");let R=o.SelectionService=class extends b.Disposable{constructor(N,M,B,H,Y,F,z,q,G){super(),this._element=N,this._screenElement=M,this._linkifier=B,this._bufferService=H,this._coreService=Y,this._mouseService=F,this._optionsService=z,this._renderService=q,this._coreBrowserService=G,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new y.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new C.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new C.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new C.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new C.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=X=>this._handleMouseMove(X),this._mouseUpListener=X=>this._handleMouseUp(X),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((X=>this._handleTrim(X))),this.register(this._bufferService.buffers.onBufferActivate((X=>this._handleBufferActivate(X)))),this.enable(),this._model=new v.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,b.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 N=this._model.finalSelectionStart,M=this._model.finalSelectionEnd;return!(!N||!M||N[0]===M[0]&&N[1]===M[1])}get selectionText(){const N=this._model.finalSelectionStart,M=this._model.finalSelectionEnd;if(!N||!M)return"";const B=this._bufferService.buffer,H=[];if(this._activeSelectionMode===3){if(N[0]===M[0])return"";const Y=N[0]Y.replace(T," "))).join(S.isWindows?`\r `:` -`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(N){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),S.isLinux&&N&&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(N){const M=this._getMouseBufferCoords(N),B=this._model.finalSelectionStart,H=this._model.finalSelectionEnd;return!!(B&&H&&M)&&this._areCoordsInSelection(M,B,H)}isCellInSelection(N,M){const B=this._model.finalSelectionStart,H=this._model.finalSelectionEnd;return!(!B||!H)&&this._areCoordsInSelection([N,M],B,H)}_areCoordsInSelection(N,M,B){return N[1]>M[1]&&N[1]=M[0]&&N[0]=M[0]}_selectWordAtCursor(N,M){var Y,F;const B=(F=(Y=this._linkifier.currentLink)==null?void 0:Y.link)==null?void 0:F.range;if(B)return this._model.selectionStart=[B.start.x-1,B.start.y-1],this._model.selectionStartLength=(0,x.getRangeLength)(B,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const H=this._getMouseBufferCoords(N);return!!H&&(this._selectWordAt(H,M),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(N,M){this._model.clearSelection(),N=Math.max(N,0),M=Math.min(M,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,N],this._model.selectionEnd=[this._bufferService.cols,M],this.refresh(),this._onSelectionChange.fire()}_handleTrim(N){this._model.handleTrim(N)&&this.refresh()}_getMouseBufferCoords(N){const M=this._mouseService.getCoords(N,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(M)return M[0]--,M[1]--,M[1]+=this._bufferService.buffer.ydisp,M}_getMouseEventScrollAmount(N){let M=(0,d.getCoordsRelativeToElement)(this._coreBrowserService.window,N,this._screenElement)[1];const B=this._renderService.dimensions.css.canvas.height;return M>=0&&M<=B?0:(M>B&&(M-=B),M=Math.min(Math.max(M,-50),50),M/=50,M/Math.abs(M)+Math.round(14*M))}shouldForceSelection(N){return S.isMac?N.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:N.shiftKey}handleMouseDown(N){if(this._mouseDownTimeStamp=N.timeStamp,(N.button!==2||!this.hasSelection)&&N.button===0){if(!this._enabled){if(!this.shouldForceSelection(N))return;N.stopPropagation()}N.preventDefault(),this._dragScrollAmount=0,this._enabled&&N.shiftKey?this._handleIncrementalClick(N):N.detail===1?this._handleSingleClick(N):N.detail===2?this._handleDoubleClick(N):N.detail===3&&this._handleTripleClick(N),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(N){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(N))}_handleSingleClick(N){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(N)?3:0,this._model.selectionStart=this._getMouseBufferCoords(N),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const M=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);M&&M.length!==this._model.selectionStart[0]&&M.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(N){this._selectWordAtCursor(N,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(N){const M=this._getMouseBufferCoords(N);M&&(this._activeSelectionMode=2,this._selectLineAt(M[1]))}shouldColumnSelect(N){return N.altKey&&!(S.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(N){if(N.stopImmediatePropagation(),!this._model.selectionStart)return;const M=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(N),!this._model.selectionEnd)return void this.refresh(!0);this._activeSelectionMode===2?this._model.selectionEnd[1]0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const B=this._bufferService.buffer;if(this._model.selectionEnd[1]0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(N.ydisp+this._bufferService.rows,N.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=N.ydisp),this.refresh()}}_handleMouseUp(N){const M=N.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&M<500&&N.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const B=this._mouseService.getCoords(N,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(B&&B[0]!==void 0&&B[1]!==void 0){const H=(0,_.moveToCellSequence)(B[0]-1,B[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(H,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const N=this._model.finalSelectionStart,M=this._model.finalSelectionEnd,B=!(!N||!M||N[0]===M[0]&&N[1]===M[1]);B?N&&M&&(this._oldSelectionStart&&this._oldSelectionEnd&&N[0]===this._oldSelectionStart[0]&&N[1]===this._oldSelectionStart[1]&&M[0]===this._oldSelectionEnd[0]&&M[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(N,M,B)):this._oldHasSelection&&this._fireOnSelectionChange(N,M,B)}_fireOnSelectionChange(N,M,B){this._oldSelectionStart=N,this._oldSelectionEnd=M,this._oldHasSelection=B,this._onSelectionChange.fire()}_handleBufferActivate(N){this.clearSelection(),this._trimListener.dispose(),this._trimListener=N.activeBuffer.lines.onTrim((M=>this._handleTrim(M)))}_convertViewportColToCharacterIndex(N,M){let B=M;for(let H=0;M>=H;H++){const Y=N.loadCell(H,this._workCell).getChars().length;this._workCell.getWidth()===0?B--:Y>1&&M!==H&&(B+=Y-1)}return B}setSelection(N,M,B){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[N,M],this._model.selectionStartLength=B,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(N){this._isClickInSelection(N)||(this._selectWordAtCursor(N,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(N,M,B=!0,H=!0){if(N[0]>=this._bufferService.cols)return;const Y=this._bufferService.buffer,F=Y.lines.get(N[1]);if(!F)return;const z=Y.translateBufferLineToString(N[1],!1);let q=this._convertViewportColToCharacterIndex(F,N[0]),G=q;const X=N[0]-q;let K=0,O=0,L=0,j=0;if(z.charAt(q)===" "){for(;q>0&&z.charAt(q-1)===" ";)q--;for(;G1&&(j+=ae-1,G+=ae-1);Q>0&&q>0&&!this._isCharWordSeparator(F.loadCell(Q-1,this._workCell));){F.loadCell(Q-1,this._workCell);const Z=this._workCell.getChars().length;this._workCell.getWidth()===0?(K++,Q--):Z>1&&(L+=Z-1,q-=Z-1),q--,Q--}for(;re1&&(j+=Z-1,G+=Z-1),G++,re++}}G++;let $=q+X-K+L,U=Math.min(this._bufferService.cols,G-q+K+O-L-j);if(M||z.slice(q,G).trim()!==""){if(B&&$===0&&F.getCodePoint(0)!==32){const Q=Y.lines.get(N[1]-1);if(Q&&F.isWrapped&&Q.getCodePoint(this._bufferService.cols-1)!==32){const re=this._getWordAt([this._bufferService.cols-1,N[1]-1],!1,!0,!1);if(re){const ae=this._bufferService.cols-re.start;$-=ae,U+=ae}}}if(H&&$+U===this._bufferService.cols&&F.getCodePoint(this._bufferService.cols-1)!==32){const Q=Y.lines.get(N[1]+1);if(Q!=null&&Q.isWrapped&&Q.getCodePoint(0)!==32){const re=this._getWordAt([0,N[1]+1],!1,!1,!0);re&&(U+=re.length)}}return{start:$,length:U}}}_selectWordAt(N,M){const B=this._getWordAt(N,M);if(B){for(;B.start<0;)B.start+=this._bufferService.cols,N[1]--;this._model.selectionStart=[B.start,N[1]],this._model.selectionStartLength=B.length}}_selectToWordAt(N){const M=this._getWordAt(N,!0);if(M){let B=N[1];for(;M.start<0;)M.start+=this._bufferService.cols,B--;if(!this._model.areSelectionValuesReversed())for(;M.start+M.length>this._bufferService.cols;)M.length-=this._bufferService.cols,B++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?M.start:M.start+M.length,B]}}_isCharWordSeparator(N){return N.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(N.getChars())>=0}_selectLineAt(N){const M=this._bufferService.buffer.getWrappedRangeForLine(N),B={start:{x:0,y:M.first},end:{x:this._bufferService.cols-1,y:M.last}};this._model.selectionStart=[0,M.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,x.getRangeLength)(B,this._bufferService.cols)}};o.SelectionService=R=f([p(3,k.IBufferService),p(4,k.ICoreService),p(5,w.IMouseService),p(6,k.IOptionsService),p(7,w.IRenderService),p(8,w.ICoreBrowserService)],R)},4725:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.ILinkProviderService=o.IThemeService=o.ICharacterJoinerService=o.ISelectionService=o.IRenderService=o.IMouseService=o.ICoreBrowserService=o.ICharSizeService=void 0;const f=c(8343);o.ICharSizeService=(0,f.createDecorator)("CharSizeService"),o.ICoreBrowserService=(0,f.createDecorator)("CoreBrowserService"),o.IMouseService=(0,f.createDecorator)("MouseService"),o.IRenderService=(0,f.createDecorator)("RenderService"),o.ISelectionService=(0,f.createDecorator)("SelectionService"),o.ICharacterJoinerService=(0,f.createDecorator)("CharacterJoinerService"),o.IThemeService=(0,f.createDecorator)("ThemeService"),o.ILinkProviderService=(0,f.createDecorator)("LinkProviderService")},6731:function(u,o,c){var f=this&&this.__decorate||function(R,N,M,B){var H,Y=arguments.length,F=Y<3?N:B===null?B=Object.getOwnPropertyDescriptor(N,M):B;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")F=Reflect.decorate(R,N,M,B);else for(var z=R.length-1;z>=0;z--)(H=R[z])&&(F=(Y<3?H(F):Y>3?H(N,M,F):H(N,M))||F);return Y>3&&F&&Object.defineProperty(N,M,F),F},p=this&&this.__param||function(R,N){return function(M,B){N(M,B,R)}};Object.defineProperty(o,"__esModule",{value:!0}),o.ThemeService=o.DEFAULT_ANSI_COLORS=void 0;const d=c(7239),_=c(8055),v=c(8460),w=c(844),C=c(2585),y=_.css.toColor("#ffffff"),S=_.css.toColor("#000000"),x=_.css.toColor("#ffffff"),b=_.css.toColor("#000000"),k={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};o.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const R=[_.css.toColor("#2e3436"),_.css.toColor("#cc0000"),_.css.toColor("#4e9a06"),_.css.toColor("#c4a000"),_.css.toColor("#3465a4"),_.css.toColor("#75507b"),_.css.toColor("#06989a"),_.css.toColor("#d3d7cf"),_.css.toColor("#555753"),_.css.toColor("#ef2929"),_.css.toColor("#8ae234"),_.css.toColor("#fce94f"),_.css.toColor("#729fcf"),_.css.toColor("#ad7fa8"),_.css.toColor("#34e2e2"),_.css.toColor("#eeeeec")],N=[0,95,135,175,215,255];for(let M=0;M<216;M++){const B=N[M/36%6|0],H=N[M/6%6|0],Y=N[M%6];R.push({css:_.channels.toCss(B,H,Y),rgba:_.channels.toRgba(B,H,Y)})}for(let M=0;M<24;M++){const B=8+10*M;R.push({css:_.channels.toCss(B,B,B),rgba:_.channels.toRgba(B,B,B)})}return R})());let D=o.ThemeService=class extends w.Disposable{get colors(){return this._colors}constructor(R){super(),this._optionsService=R,this._contrastCache=new d.ColorContrastCache,this._halfContrastCache=new d.ColorContrastCache,this._onChangeColors=this.register(new v.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:y,background:S,cursor:x,cursorAccent:b,selectionForeground:void 0,selectionBackgroundTransparent:k,selectionBackgroundOpaque:_.color.blend(S,k),selectionInactiveBackgroundTransparent:k,selectionInactiveBackgroundOpaque:_.color.blend(S,k),ansi:o.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(R={}){const N=this._colors;if(N.foreground=T(R.foreground,y),N.background=T(R.background,S),N.cursor=T(R.cursor,x),N.cursorAccent=T(R.cursorAccent,b),N.selectionBackgroundTransparent=T(R.selectionBackground,k),N.selectionBackgroundOpaque=_.color.blend(N.background,N.selectionBackgroundTransparent),N.selectionInactiveBackgroundTransparent=T(R.selectionInactiveBackground,N.selectionBackgroundTransparent),N.selectionInactiveBackgroundOpaque=_.color.blend(N.background,N.selectionInactiveBackgroundTransparent),N.selectionForeground=R.selectionForeground?T(R.selectionForeground,_.NULL_COLOR):void 0,N.selectionForeground===_.NULL_COLOR&&(N.selectionForeground=void 0),_.color.isOpaque(N.selectionBackgroundTransparent)&&(N.selectionBackgroundTransparent=_.color.opacity(N.selectionBackgroundTransparent,.3)),_.color.isOpaque(N.selectionInactiveBackgroundTransparent)&&(N.selectionInactiveBackgroundTransparent=_.color.opacity(N.selectionInactiveBackgroundTransparent,.3)),N.ansi=o.DEFAULT_ANSI_COLORS.slice(),N.ansi[0]=T(R.black,o.DEFAULT_ANSI_COLORS[0]),N.ansi[1]=T(R.red,o.DEFAULT_ANSI_COLORS[1]),N.ansi[2]=T(R.green,o.DEFAULT_ANSI_COLORS[2]),N.ansi[3]=T(R.yellow,o.DEFAULT_ANSI_COLORS[3]),N.ansi[4]=T(R.blue,o.DEFAULT_ANSI_COLORS[4]),N.ansi[5]=T(R.magenta,o.DEFAULT_ANSI_COLORS[5]),N.ansi[6]=T(R.cyan,o.DEFAULT_ANSI_COLORS[6]),N.ansi[7]=T(R.white,o.DEFAULT_ANSI_COLORS[7]),N.ansi[8]=T(R.brightBlack,o.DEFAULT_ANSI_COLORS[8]),N.ansi[9]=T(R.brightRed,o.DEFAULT_ANSI_COLORS[9]),N.ansi[10]=T(R.brightGreen,o.DEFAULT_ANSI_COLORS[10]),N.ansi[11]=T(R.brightYellow,o.DEFAULT_ANSI_COLORS[11]),N.ansi[12]=T(R.brightBlue,o.DEFAULT_ANSI_COLORS[12]),N.ansi[13]=T(R.brightMagenta,o.DEFAULT_ANSI_COLORS[13]),N.ansi[14]=T(R.brightCyan,o.DEFAULT_ANSI_COLORS[14]),N.ansi[15]=T(R.brightWhite,o.DEFAULT_ANSI_COLORS[15]),R.extendedAnsi){const M=Math.min(N.ansi.length-16,R.extendedAnsi.length);for(let B=0;B{Object.defineProperty(o,"__esModule",{value:!0}),o.CircularList=void 0;const f=c(8460),p=c(844);class d extends p.Disposable{constructor(v){super(),this._maxLength=v,this.onDeleteEmitter=this.register(new f.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new f.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new f.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(v){if(this._maxLength===v)return;const w=new Array(v);for(let C=0;Cthis._length)for(let w=this._length;w=v;y--)this._array[this._getCyclicIndex(y+C.length)]=this._array[this._getCyclicIndex(y)];for(let y=0;ythis._maxLength){const y=this._length+C.length-this._maxLength;this._startIndex+=y,this._length=this._maxLength,this.onTrimEmitter.fire(y)}else this._length+=C.length}trimStart(v){v>this._length&&(v=this._length),this._startIndex+=v,this._length-=v,this.onTrimEmitter.fire(v)}shiftElements(v,w,C){if(!(w<=0)){if(v<0||v>=this._length)throw new Error("start argument out of range");if(v+C<0)throw new Error("Cannot shift elements in list beyond index 0");if(C>0){for(let S=w-1;S>=0;S--)this.set(v+S+C,this.get(v+S));const y=v+w+C-this._length;if(y>0)for(this._length+=y;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let y=0;y{Object.defineProperty(o,"__esModule",{value:!0}),o.clone=void 0,o.clone=function c(f,p=5){if(typeof f!="object")return f;const d=Array.isArray(f)?[]:{};for(const _ in f)d[_]=p<=1?f[_]:f[_]&&c(f[_],p-1);return d}},8055:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.contrastRatio=o.toPaddedHex=o.rgba=o.rgb=o.css=o.color=o.channels=o.NULL_COLOR=void 0;let c=0,f=0,p=0,d=0;var _,v,w,C,y;function S(b){const k=b.toString(16);return k.length<2?"0"+k:k}function x(b,k){return b>>0},b.toColor=function(k,D,T,R){return{css:b.toCss(k,D,T,R),rgba:b.toRgba(k,D,T,R)}}})(_||(o.channels=_={})),(function(b){function k(D,T){return d=Math.round(255*T),[c,f,p]=y.toChannels(D.rgba),{css:_.toCss(c,f,p,d),rgba:_.toRgba(c,f,p,d)}}b.blend=function(D,T){if(d=(255&T.rgba)/255,d===1)return{css:T.css,rgba:T.rgba};const R=T.rgba>>24&255,N=T.rgba>>16&255,M=T.rgba>>8&255,B=D.rgba>>24&255,H=D.rgba>>16&255,Y=D.rgba>>8&255;return c=B+Math.round((R-B)*d),f=H+Math.round((N-H)*d),p=Y+Math.round((M-Y)*d),{css:_.toCss(c,f,p),rgba:_.toRgba(c,f,p)}},b.isOpaque=function(D){return(255&D.rgba)==255},b.ensureContrastRatio=function(D,T,R){const N=y.ensureContrastRatio(D.rgba,T.rgba,R);if(N)return _.toColor(N>>24&255,N>>16&255,N>>8&255)},b.opaque=function(D){const T=(255|D.rgba)>>>0;return[c,f,p]=y.toChannels(T),{css:_.toCss(c,f,p),rgba:T}},b.opacity=k,b.multiplyOpacity=function(D,T){return d=255&D.rgba,k(D,d*T/255)},b.toColorRGB=function(D){return[D.rgba>>24&255,D.rgba>>16&255,D.rgba>>8&255]}})(v||(o.color=v={})),(function(b){let k,D;try{const T=document.createElement("canvas");T.width=1,T.height=1;const R=T.getContext("2d",{willReadFrequently:!0});R&&(k=R,k.globalCompositeOperation="copy",D=k.createLinearGradient(0,0,1,1))}catch{}b.toColor=function(T){if(T.match(/#[\da-f]{3,8}/i))switch(T.length){case 4:return c=parseInt(T.slice(1,2).repeat(2),16),f=parseInt(T.slice(2,3).repeat(2),16),p=parseInt(T.slice(3,4).repeat(2),16),_.toColor(c,f,p);case 5:return c=parseInt(T.slice(1,2).repeat(2),16),f=parseInt(T.slice(2,3).repeat(2),16),p=parseInt(T.slice(3,4).repeat(2),16),d=parseInt(T.slice(4,5).repeat(2),16),_.toColor(c,f,p,d);case 7:return{css:T,rgba:(parseInt(T.slice(1),16)<<8|255)>>>0};case 9:return{css:T,rgba:parseInt(T.slice(1),16)>>>0}}const R=T.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(R)return c=parseInt(R[1]),f=parseInt(R[2]),p=parseInt(R[3]),d=Math.round(255*(R[5]===void 0?1:parseFloat(R[5]))),_.toColor(c,f,p,d);if(!k||!D)throw new Error("css.toColor: Unsupported css format");if(k.fillStyle=D,k.fillStyle=T,typeof k.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(k.fillRect(0,0,1,1),[c,f,p,d]=k.getImageData(0,0,1,1).data,d!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:_.toRgba(c,f,p,d),css:T}}})(w||(o.css=w={})),(function(b){function k(D,T,R){const N=D/255,M=T/255,B=R/255;return .2126*(N<=.03928?N/12.92:Math.pow((N+.055)/1.055,2.4))+.7152*(M<=.03928?M/12.92:Math.pow((M+.055)/1.055,2.4))+.0722*(B<=.03928?B/12.92:Math.pow((B+.055)/1.055,2.4))}b.relativeLuminance=function(D){return k(D>>16&255,D>>8&255,255&D)},b.relativeLuminance2=k})(C||(o.rgb=C={})),(function(b){function k(T,R,N){const M=T>>24&255,B=T>>16&255,H=T>>8&255;let Y=R>>24&255,F=R>>16&255,z=R>>8&255,q=x(C.relativeLuminance2(Y,F,z),C.relativeLuminance2(M,B,H));for(;q0||F>0||z>0);)Y-=Math.max(0,Math.ceil(.1*Y)),F-=Math.max(0,Math.ceil(.1*F)),z-=Math.max(0,Math.ceil(.1*z)),q=x(C.relativeLuminance2(Y,F,z),C.relativeLuminance2(M,B,H));return(Y<<24|F<<16|z<<8|255)>>>0}function D(T,R,N){const M=T>>24&255,B=T>>16&255,H=T>>8&255;let Y=R>>24&255,F=R>>16&255,z=R>>8&255,q=x(C.relativeLuminance2(Y,F,z),C.relativeLuminance2(M,B,H));for(;q>>0}b.blend=function(T,R){if(d=(255&R)/255,d===1)return R;const N=R>>24&255,M=R>>16&255,B=R>>8&255,H=T>>24&255,Y=T>>16&255,F=T>>8&255;return c=H+Math.round((N-H)*d),f=Y+Math.round((M-Y)*d),p=F+Math.round((B-F)*d),_.toRgba(c,f,p)},b.ensureContrastRatio=function(T,R,N){const M=C.relativeLuminance(T>>8),B=C.relativeLuminance(R>>8);if(x(M,B)>8));if(zx(M,C.relativeLuminance(q>>8))?F:q}return F}const H=D(T,R,N),Y=x(M,C.relativeLuminance(H>>8));if(Yx(M,C.relativeLuminance(F>>8))?H:F}return H}},b.reduceLuminance=k,b.increaseLuminance=D,b.toChannels=function(T){return[T>>24&255,T>>16&255,T>>8&255,255&T]}})(y||(o.rgba=y={})),o.toPaddedHex=S,o.contrastRatio=x},8969:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.CoreTerminal=void 0;const f=c(844),p=c(2585),d=c(4348),_=c(7866),v=c(744),w=c(7302),C=c(6975),y=c(8460),S=c(1753),x=c(1480),b=c(7994),k=c(9282),D=c(5435),T=c(5981),R=c(2660);let N=!1;class M extends f.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new y.EventEmitter),this._onScroll.event((H=>{var Y;(Y=this._onScrollApi)==null||Y.fire(H.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(H){for(const Y in H)this.optionsService.options[Y]=H[Y]}constructor(H){super(),this._windowsWrappingHeuristics=this.register(new f.MutableDisposable),this._onBinary=this.register(new y.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new y.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new y.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new y.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new y.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new y.EventEmitter),this._instantiationService=new d.InstantiationService,this.optionsService=this.register(new w.OptionsService(H)),this._instantiationService.setService(p.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(v.BufferService)),this._instantiationService.setService(p.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(_.LogService)),this._instantiationService.setService(p.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(C.CoreService)),this._instantiationService.setService(p.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(S.CoreMouseService)),this._instantiationService.setService(p.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(x.UnicodeService)),this._instantiationService.setService(p.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(b.CharsetService),this._instantiationService.setService(p.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(R.OscLinkService),this._instantiationService.setService(p.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new D.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,y.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,y.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,y.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,y.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((Y=>{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((Y=>{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 T.WriteBuffer(((Y,F)=>this._inputHandler.parse(Y,F)))),this.register((0,y.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(H,Y){this._writeBuffer.write(H,Y)}writeSync(H,Y){this._logService.logLevel<=p.LogLevelEnum.WARN&&!N&&(this._logService.warn("writeSync is unreliable and will be removed soon."),N=!0),this._writeBuffer.writeSync(H,Y)}input(H,Y=!0){this.coreService.triggerDataEvent(H,Y)}resize(H,Y){isNaN(H)||isNaN(Y)||(H=Math.max(H,v.MINIMUM_COLS),Y=Math.max(Y,v.MINIMUM_ROWS),this._bufferService.resize(H,Y))}scroll(H,Y=!1){this._bufferService.scroll(H,Y)}scrollLines(H,Y,F){this._bufferService.scrollLines(H,Y,F)}scrollPages(H){this.scrollLines(H*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(H){const Y=H-this._bufferService.buffer.ydisp;Y!==0&&this.scrollLines(Y)}registerEscHandler(H,Y){return this._inputHandler.registerEscHandler(H,Y)}registerDcsHandler(H,Y){return this._inputHandler.registerDcsHandler(H,Y)}registerCsiHandler(H,Y){return this._inputHandler.registerCsiHandler(H,Y)}registerOscHandler(H,Y){return this._inputHandler.registerOscHandler(H,Y)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let H=!1;const Y=this.optionsService.rawOptions.windowsPty;Y&&Y.buildNumber!==void 0&&Y.buildNumber!==void 0?H=Y.backend==="conpty"&&Y.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(H=!0),H?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const H=[];H.push(this.onLineFeed(k.updateWindowsModeWrappedState.bind(null,this._bufferService))),H.push(this.registerCsiHandler({final:"H"},(()=>((0,k.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,f.toDisposable)((()=>{for(const Y of H)Y.dispose()}))}}}o.CoreTerminal=M},8460:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.runAndSubscribe=o.forwardEvent=o.EventEmitter=void 0,o.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=c=>(this._listeners.push(c),{dispose:()=>{if(!this._disposed){for(let f=0;ff.fire(p)))},o.runAndSubscribe=function(c,f){return f(void 0),c((p=>f(p)))}},5435:function(u,o,c){var f=this&&this.__decorate||function(K,O,L,j){var $,U=arguments.length,Q=U<3?O:j===null?j=Object.getOwnPropertyDescriptor(O,L):j;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")Q=Reflect.decorate(K,O,L,j);else for(var re=K.length-1;re>=0;re--)($=K[re])&&(Q=(U<3?$(Q):U>3?$(O,L,Q):$(O,L))||Q);return U>3&&Q&&Object.defineProperty(O,L,Q),Q},p=this&&this.__param||function(K,O){return function(L,j){O(L,j,K)}};Object.defineProperty(o,"__esModule",{value:!0}),o.InputHandler=o.WindowsOptionsReportType=void 0;const d=c(2584),_=c(7116),v=c(2015),w=c(844),C=c(482),y=c(8437),S=c(8460),x=c(643),b=c(511),k=c(3734),D=c(2585),T=c(1480),R=c(6242),N=c(6351),M=c(5941),B={"(":0,")":1,"*":2,"+":3,"-":1,".":2},H=131072;function Y(K,O){if(K>24)return O.setWinLines||!1;switch(K){case 1:return!!O.restoreWin;case 2:return!!O.minimizeWin;case 3:return!!O.setWinPosition;case 4:return!!O.setWinSizePixels;case 5:return!!O.raiseWin;case 6:return!!O.lowerWin;case 7:return!!O.refreshWin;case 8:return!!O.setWinSizeChars;case 9:return!!O.maximizeWin;case 10:return!!O.fullscreenWin;case 11:return!!O.getWinState;case 13:return!!O.getWinPosition;case 14:return!!O.getWinSizePixels;case 15:return!!O.getScreenSizePixels;case 16:return!!O.getCellSizePixels;case 18:return!!O.getWinSizeChars;case 19:return!!O.getScreenSizeChars;case 20:return!!O.getIconTitle;case 21:return!!O.getWinTitle;case 22:return!!O.pushTitle;case 23:return!!O.popTitle;case 24:return!!O.setWinLines}return!1}var F;(function(K){K[K.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",K[K.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(F||(o.WindowsOptionsReportType=F={}));let z=0;class q extends w.Disposable{getAttrData(){return this._curAttrData}constructor(O,L,j,$,U,Q,re,ae,Z=new v.EscapeSequenceParser){super(),this._bufferService=O,this._charsetService=L,this._coreService=j,this._logService=$,this._optionsService=U,this._oscLinkService=Q,this._coreMouseService=re,this._unicodeService=ae,this._parser=Z,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new C.StringToUtf32,this._utf8Decoder=new C.Utf8ToUtf32,this._workCell=new b.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=y.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=y.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new S.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new S.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new S.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new S.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new S.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new S.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new S.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new S.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new S.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new S.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new S.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new S.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new S.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 G(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((P=>this._activeBuffer=P.activeBuffer))),this._parser.setCsiHandlerFallback(((P,te)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(P),params:te.toArray()})})),this._parser.setEscHandlerFallback((P=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(P)})})),this._parser.setExecuteHandlerFallback((P=>{this._logService.debug("Unknown EXECUTE code: ",{code:P})})),this._parser.setOscHandlerFallback(((P,te,ie)=>{this._logService.debug("Unknown OSC code: ",{identifier:P,action:te,data:ie})})),this._parser.setDcsHandlerFallback(((P,te,ie)=>{te==="HOOK"&&(ie=ie.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(P),action:te,payload:ie})})),this._parser.setPrintHandler(((P,te,ie)=>this.print(P,te,ie))),this._parser.registerCsiHandler({final:"@"},(P=>this.insertChars(P))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(P=>this.scrollLeft(P))),this._parser.registerCsiHandler({final:"A"},(P=>this.cursorUp(P))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(P=>this.scrollRight(P))),this._parser.registerCsiHandler({final:"B"},(P=>this.cursorDown(P))),this._parser.registerCsiHandler({final:"C"},(P=>this.cursorForward(P))),this._parser.registerCsiHandler({final:"D"},(P=>this.cursorBackward(P))),this._parser.registerCsiHandler({final:"E"},(P=>this.cursorNextLine(P))),this._parser.registerCsiHandler({final:"F"},(P=>this.cursorPrecedingLine(P))),this._parser.registerCsiHandler({final:"G"},(P=>this.cursorCharAbsolute(P))),this._parser.registerCsiHandler({final:"H"},(P=>this.cursorPosition(P))),this._parser.registerCsiHandler({final:"I"},(P=>this.cursorForwardTab(P))),this._parser.registerCsiHandler({final:"J"},(P=>this.eraseInDisplay(P,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(P=>this.eraseInDisplay(P,!0))),this._parser.registerCsiHandler({final:"K"},(P=>this.eraseInLine(P,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(P=>this.eraseInLine(P,!0))),this._parser.registerCsiHandler({final:"L"},(P=>this.insertLines(P))),this._parser.registerCsiHandler({final:"M"},(P=>this.deleteLines(P))),this._parser.registerCsiHandler({final:"P"},(P=>this.deleteChars(P))),this._parser.registerCsiHandler({final:"S"},(P=>this.scrollUp(P))),this._parser.registerCsiHandler({final:"T"},(P=>this.scrollDown(P))),this._parser.registerCsiHandler({final:"X"},(P=>this.eraseChars(P))),this._parser.registerCsiHandler({final:"Z"},(P=>this.cursorBackwardTab(P))),this._parser.registerCsiHandler({final:"`"},(P=>this.charPosAbsolute(P))),this._parser.registerCsiHandler({final:"a"},(P=>this.hPositionRelative(P))),this._parser.registerCsiHandler({final:"b"},(P=>this.repeatPrecedingCharacter(P))),this._parser.registerCsiHandler({final:"c"},(P=>this.sendDeviceAttributesPrimary(P))),this._parser.registerCsiHandler({prefix:">",final:"c"},(P=>this.sendDeviceAttributesSecondary(P))),this._parser.registerCsiHandler({final:"d"},(P=>this.linePosAbsolute(P))),this._parser.registerCsiHandler({final:"e"},(P=>this.vPositionRelative(P))),this._parser.registerCsiHandler({final:"f"},(P=>this.hVPosition(P))),this._parser.registerCsiHandler({final:"g"},(P=>this.tabClear(P))),this._parser.registerCsiHandler({final:"h"},(P=>this.setMode(P))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(P=>this.setModePrivate(P))),this._parser.registerCsiHandler({final:"l"},(P=>this.resetMode(P))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(P=>this.resetModePrivate(P))),this._parser.registerCsiHandler({final:"m"},(P=>this.charAttributes(P))),this._parser.registerCsiHandler({final:"n"},(P=>this.deviceStatus(P))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(P=>this.deviceStatusPrivate(P))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(P=>this.softReset(P))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(P=>this.setCursorStyle(P))),this._parser.registerCsiHandler({final:"r"},(P=>this.setScrollRegion(P))),this._parser.registerCsiHandler({final:"s"},(P=>this.saveCursor(P))),this._parser.registerCsiHandler({final:"t"},(P=>this.windowOptions(P))),this._parser.registerCsiHandler({final:"u"},(P=>this.restoreCursor(P))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(P=>this.insertColumns(P))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(P=>this.deleteColumns(P))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(P=>this.selectProtected(P))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(P=>this.requestMode(P,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(P=>this.requestMode(P,!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 R.OscHandler((P=>(this.setTitle(P),this.setIconName(P),!0)))),this._parser.registerOscHandler(1,new R.OscHandler((P=>this.setIconName(P)))),this._parser.registerOscHandler(2,new R.OscHandler((P=>this.setTitle(P)))),this._parser.registerOscHandler(4,new R.OscHandler((P=>this.setOrReportIndexedColor(P)))),this._parser.registerOscHandler(8,new R.OscHandler((P=>this.setHyperlink(P)))),this._parser.registerOscHandler(10,new R.OscHandler((P=>this.setOrReportFgColor(P)))),this._parser.registerOscHandler(11,new R.OscHandler((P=>this.setOrReportBgColor(P)))),this._parser.registerOscHandler(12,new R.OscHandler((P=>this.setOrReportCursorColor(P)))),this._parser.registerOscHandler(104,new R.OscHandler((P=>this.restoreIndexedColor(P)))),this._parser.registerOscHandler(110,new R.OscHandler((P=>this.restoreFgColor(P)))),this._parser.registerOscHandler(111,new R.OscHandler((P=>this.restoreBgColor(P)))),this._parser.registerOscHandler(112,new R.OscHandler((P=>this.restoreCursorColor(P)))),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 P in _.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:P},(()=>this.selectCharset("("+P))),this._parser.registerEscHandler({intermediates:")",final:P},(()=>this.selectCharset(")"+P))),this._parser.registerEscHandler({intermediates:"*",final:P},(()=>this.selectCharset("*"+P))),this._parser.registerEscHandler({intermediates:"+",final:P},(()=>this.selectCharset("+"+P))),this._parser.registerEscHandler({intermediates:"-",final:P},(()=>this.selectCharset("-"+P))),this._parser.registerEscHandler({intermediates:".",final:P},(()=>this.selectCharset("."+P))),this._parser.registerEscHandler({intermediates:"/",final:P},(()=>this.selectCharset("/"+P)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((P=>(this._logService.error("Parsing error: ",P),P))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new N.DcsHandler(((P,te)=>this.requestStatusString(P,te))))}_preserveStack(O,L,j,$){this._parseStack.paused=!0,this._parseStack.cursorStartX=O,this._parseStack.cursorStartY=L,this._parseStack.decodedLength=j,this._parseStack.position=$}_logSlowResolvingAsync(O){this._logService.logLevel<=D.LogLevelEnum.WARN&&Promise.race([O,new Promise(((L,j)=>setTimeout((()=>j("#SLOW_TIMEOUT")),5e3)))]).catch((L=>{if(L!=="#SLOW_TIMEOUT")throw L;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(O,L){let j,$=this._activeBuffer.x,U=this._activeBuffer.y,Q=0;const re=this._parseStack.paused;if(re){if(j=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,L))return this._logSlowResolvingAsync(j),j;$=this._parseStack.cursorStartX,U=this._parseStack.cursorStartY,this._parseStack.paused=!1,O.length>H&&(Q=this._parseStack.position+H)}if(this._logService.logLevel<=D.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof O=="string"?` "${O}"`:` "${Array.prototype.map.call(O,(P=>String.fromCharCode(P))).join("")}"`),typeof O=="string"?O.split("").map((P=>P.charCodeAt(0))):O),this._parseBuffer.lengthH)for(let P=Q;P0&&ie.getWidth(this._activeBuffer.x-1)===2&&ie.setCellFromCodepoint(this._activeBuffer.x-1,0,1,te);let pe=this._parser.precedingJoinState;for(let he=L;heae){if(Z){const Ae=ie;let xe=this._activeBuffer.x-Ce;for(this._activeBuffer.x=Ce,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),ie=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),Ce>0&&ie instanceof y.BufferLine&&ie.copyCellsFrom(Ae,xe,0,Ce,!1);xe=0;)ie.setCellFromCodepoint(this._activeBuffer.x++,0,0,te)}else if(P&&(ie.insertCells(this._activeBuffer.x,U-Ce,this._activeBuffer.getNullCell(te)),ie.getWidth(ae-1)===2&&ie.setCellFromCodepoint(ae-1,x.NULL_CELL_CODE,x.NULL_CELL_WIDTH,te)),ie.setCellFromCodepoint(this._activeBuffer.x++,$,U,te),U>0)for(;--U;)ie.setCellFromCodepoint(this._activeBuffer.x++,0,0,te)}this._parser.precedingJoinState=pe,this._activeBuffer.x0&&ie.getWidth(this._activeBuffer.x)===0&&!ie.hasContent(this._activeBuffer.x)&&ie.setCellFromCodepoint(this._activeBuffer.x,0,1,te),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(O,L){return O.final!=="t"||O.prefix||O.intermediates?this._parser.registerCsiHandler(O,L):this._parser.registerCsiHandler(O,(j=>!Y(j.params[0],this._optionsService.rawOptions.windowOptions)||L(j)))}registerDcsHandler(O,L){return this._parser.registerDcsHandler(O,new N.DcsHandler(L))}registerEscHandler(O,L){return this._parser.registerEscHandler(O,L)}registerOscHandler(O,L){return this._parser.registerOscHandler(O,new R.OscHandler(L))}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 O;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&&((O=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&O.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const L=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);L.hasWidth(this._activeBuffer.x)&&!L.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const O=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-O),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(O=this._bufferService.cols-1){this._activeBuffer.x=Math.min(O,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(O,L){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=O,this._activeBuffer.y=this._activeBuffer.scrollTop+L):(this._activeBuffer.x=O,this._activeBuffer.y=L),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(O,L){this._restrictCursor(),this._setCursor(this._activeBuffer.x+O,this._activeBuffer.y+L)}cursorUp(O){const L=this._activeBuffer.y-this._activeBuffer.scrollTop;return L>=0?this._moveCursor(0,-Math.min(L,O.params[0]||1)):this._moveCursor(0,-(O.params[0]||1)),!0}cursorDown(O){const L=this._activeBuffer.scrollBottom-this._activeBuffer.y;return L>=0?this._moveCursor(0,Math.min(L,O.params[0]||1)):this._moveCursor(0,O.params[0]||1),!0}cursorForward(O){return this._moveCursor(O.params[0]||1,0),!0}cursorBackward(O){return this._moveCursor(-(O.params[0]||1),0),!0}cursorNextLine(O){return this.cursorDown(O),this._activeBuffer.x=0,!0}cursorPrecedingLine(O){return this.cursorUp(O),this._activeBuffer.x=0,!0}cursorCharAbsolute(O){return this._setCursor((O.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(O){return this._setCursor(O.length>=2?(O.params[1]||1)-1:0,(O.params[0]||1)-1),!0}charPosAbsolute(O){return this._setCursor((O.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(O){return this._moveCursor(O.params[0]||1,0),!0}linePosAbsolute(O){return this._setCursor(this._activeBuffer.x,(O.params[0]||1)-1),!0}vPositionRelative(O){return this._moveCursor(0,O.params[0]||1),!0}hVPosition(O){return this.cursorPosition(O),!0}tabClear(O){const L=O.params[0];return L===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:L===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(O){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let L=O.params[0]||1;for(;L--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(O){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let L=O.params[0]||1;for(;L--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(O){const L=O.params[0];return L===1&&(this._curAttrData.bg|=536870912),L!==2&&L!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(O,L,j,$=!1,U=!1){const Q=this._activeBuffer.lines.get(this._activeBuffer.ybase+O);Q.replaceCells(L,j,this._activeBuffer.getNullCell(this._eraseAttrData()),U),$&&(Q.isWrapped=!1)}_resetBufferLine(O,L=!1){const j=this._activeBuffer.lines.get(this._activeBuffer.ybase+O);j&&(j.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),L),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+O),j.isWrapped=!1)}eraseInDisplay(O,L=!1){let j;switch(this._restrictCursor(this._bufferService.cols),O.params[0]){case 0:for(j=this._activeBuffer.y,this._dirtyRowTracker.markDirty(j),this._eraseInBufferLine(j++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,L);j=this._bufferService.cols&&(this._activeBuffer.lines.get(j+1).isWrapped=!1);j--;)this._resetBufferLine(j,L);this._dirtyRowTracker.markDirty(0);break;case 2:for(j=this._bufferService.rows,this._dirtyRowTracker.markDirty(j-1);j--;)this._resetBufferLine(j,L);this._dirtyRowTracker.markDirty(0);break;case 3:const $=this._activeBuffer.lines.length-this._bufferService.rows;$>0&&(this._activeBuffer.lines.trimStart($),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-$,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-$,0),this._onScroll.fire(0))}return!0}eraseInLine(O,L=!1){switch(this._restrictCursor(this._bufferService.cols),O.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,L);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,L);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,L)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(O){this._restrictCursor();let L=O.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.y65535?2:1}let Z=ae;for(let P=1;P0||(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(O){return O.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(O.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(d.C0.ESC+"[>83;40003;0c")),!0}_is(O){return(this._optionsService.rawOptions.termName+"").indexOf(O)===0}setMode(O){for(let L=0;Lwe?1:2,pe=O.params[0];return he=pe,ye=L?pe===2?4:pe===4?ie(Q.modes.insertMode):pe===12?3:pe===20?ie(te.convertEol):0:pe===1?ie(j.applicationCursorKeys):pe===3?te.windowOptions.setWinLines?ae===80?2:ae===132?1:0:0:pe===6?ie(j.origin):pe===7?ie(j.wraparound):pe===8?3:pe===9?ie($==="X10"):pe===12?ie(te.cursorBlink):pe===25?ie(!Q.isCursorHidden):pe===45?ie(j.reverseWraparound):pe===66?ie(j.applicationKeypad):pe===67?4:pe===1e3?ie($==="VT200"):pe===1002?ie($==="DRAG"):pe===1003?ie($==="ANY"):pe===1004?ie(j.sendFocus):pe===1005?4:pe===1006?ie(U==="SGR"):pe===1015?4:pe===1016?ie(U==="SGR_PIXELS"):pe===1048?1:pe===47||pe===1047||pe===1049?ie(Z===P):pe===2004?ie(j.bracketedPasteMode):0,Q.triggerDataEvent(`${d.C0.ESC}[${L?"":"?"}${he};${ye}$y`),!0;var he,ye}_updateAttrColor(O,L,j,$,U){return L===2?(O|=50331648,O&=-16777216,O|=k.AttributeData.fromColorRGB([j,$,U])):L===5&&(O&=-50331904,O|=33554432|255&j),O}_extractColor(O,L,j){const $=[0,0,-1,0,0,0];let U=0,Q=0;do{if($[Q+U]=O.params[L+Q],O.hasSubParams(L+Q)){const re=O.getSubParams(L+Q);let ae=0;do $[1]===5&&(U=1),$[Q+ae+1+U]=re[ae];while(++ae=2||$[1]===2&&Q+U>=5)break;$[1]&&(U=1)}while(++Q+L5)&&(O=1),L.extended.underlineStyle=O,L.fg|=268435456,O===0&&(L.fg&=-268435457),L.updateExtended()}_processSGR0(O){O.fg=y.DEFAULT_ATTR_DATA.fg,O.bg=y.DEFAULT_ATTR_DATA.bg,O.extended=O.extended.clone(),O.extended.underlineStyle=0,O.extended.underlineColor&=-67108864,O.updateExtended()}charAttributes(O){if(O.length===1&&O.params[0]===0)return this._processSGR0(this._curAttrData),!0;const L=O.length;let j;const $=this._curAttrData;for(let U=0;U=30&&j<=37?($.fg&=-50331904,$.fg|=16777216|j-30):j>=40&&j<=47?($.bg&=-50331904,$.bg|=16777216|j-40):j>=90&&j<=97?($.fg&=-50331904,$.fg|=16777224|j-90):j>=100&&j<=107?($.bg&=-50331904,$.bg|=16777224|j-100):j===0?this._processSGR0($):j===1?$.fg|=134217728:j===3?$.bg|=67108864:j===4?($.fg|=268435456,this._processUnderline(O.hasSubParams(U)?O.getSubParams(U)[0]:1,$)):j===5?$.fg|=536870912:j===7?$.fg|=67108864:j===8?$.fg|=1073741824:j===9?$.fg|=2147483648:j===2?$.bg|=134217728:j===21?this._processUnderline(2,$):j===22?($.fg&=-134217729,$.bg&=-134217729):j===23?$.bg&=-67108865:j===24?($.fg&=-268435457,this._processUnderline(0,$)):j===25?$.fg&=-536870913:j===27?$.fg&=-67108865:j===28?$.fg&=-1073741825:j===29?$.fg&=2147483647:j===39?($.fg&=-67108864,$.fg|=16777215&y.DEFAULT_ATTR_DATA.fg):j===49?($.bg&=-67108864,$.bg|=16777215&y.DEFAULT_ATTR_DATA.bg):j===38||j===48||j===58?U+=this._extractColor(O,U,$):j===53?$.bg|=1073741824:j===55?$.bg&=-1073741825:j===59?($.extended=$.extended.clone(),$.extended.underlineColor=-1,$.updateExtended()):j===100?($.fg&=-67108864,$.fg|=16777215&y.DEFAULT_ATTR_DATA.fg,$.bg&=-67108864,$.bg|=16777215&y.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",j);return!0}deviceStatus(O){switch(O.params[0]){case 5:this._coreService.triggerDataEvent(`${d.C0.ESC}[0n`);break;case 6:const L=this._activeBuffer.y+1,j=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${d.C0.ESC}[${L};${j}R`)}return!0}deviceStatusPrivate(O){if(O.params[0]===6){const L=this._activeBuffer.y+1,j=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${d.C0.ESC}[?${L};${j}R`)}return!0}softReset(O){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=y.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(O){const L=O.params[0]||1;switch(L){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}const j=L%2==1;return this._optionsService.options.cursorBlink=j,!0}setScrollRegion(O){const L=O.params[0]||1;let j;return(O.length<2||(j=O.params[1])>this._bufferService.rows||j===0)&&(j=this._bufferService.rows),j>L&&(this._activeBuffer.scrollTop=L-1,this._activeBuffer.scrollBottom=j-1,this._setCursor(0,0)),!0}windowOptions(O){if(!Y(O.params[0],this._optionsService.rawOptions.windowOptions))return!0;const L=O.length>1?O.params[1]:0;switch(O.params[0]){case 14:L!==2&&this._onRequestWindowsOptionsReport.fire(F.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(F.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:L!==0&&L!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),L!==0&&L!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:L!==0&&L!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),L!==0&&L!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(O){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(O){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(O){return this._windowTitle=O,this._onTitleChange.fire(O),!0}setIconName(O){return this._iconName=O,!0}setOrReportIndexedColor(O){const L=[],j=O.split(";");for(;j.length>1;){const $=j.shift(),U=j.shift();if(/^\d+$/.exec($)){const Q=parseInt($);if(X(Q))if(U==="?")L.push({type:0,index:Q});else{const re=(0,M.parseColor)(U);re&&L.push({type:1,index:Q,color:re})}}}return L.length&&this._onColor.fire(L),!0}setHyperlink(O){const L=O.split(";");return!(L.length<2)&&(L[1]?this._createHyperlink(L[0],L[1]):!L[0]&&this._finishHyperlink())}_createHyperlink(O,L){this._getCurrentLinkId()&&this._finishHyperlink();const j=O.split(":");let $;const U=j.findIndex((Q=>Q.startsWith("id=")));return U!==-1&&($=j[U].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:$,uri:L}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(O,L){const j=O.split(";");for(let $=0;$=this._specialColors.length);++$,++L)if(j[$]==="?")this._onColor.fire([{type:0,index:this._specialColors[L]}]);else{const U=(0,M.parseColor)(j[$]);U&&this._onColor.fire([{type:1,index:this._specialColors[L],color:U}])}return!0}setOrReportFgColor(O){return this._setOrReportSpecialColor(O,0)}setOrReportBgColor(O){return this._setOrReportSpecialColor(O,1)}setOrReportCursorColor(O){return this._setOrReportSpecialColor(O,2)}restoreIndexedColor(O){if(!O)return this._onColor.fire([{type:2}]),!0;const L=[],j=O.split(";");for(let $=0;$=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 O=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,O,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=y.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=y.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(O){return this._charsetService.setgLevel(O),!0}screenAlignmentPattern(){const O=new b.CellData;O.content=4194373,O.fg=this._curAttrData.fg,O.bg=this._curAttrData.bg,this._setCursor(0,0);for(let L=0;L(this._coreService.triggerDataEvent(`${d.C0.ESC}${U}${d.C0.ESC}\\`),!0))(O==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:O==='"p'?'P1$r61;1"p':O==="r"?`P1$r${j.scrollTop+1};${j.scrollBottom+1}r`:O==="m"?"P1$r0m":O===" q"?`P1$r${{block:2,underline:4,bar:6}[$.cursorStyle]-($.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(O,L){this._dirtyRowTracker.markRangeDirty(O,L)}}o.InputHandler=q;let G=class{constructor(K){this._bufferService=K,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(K){Kthis.end&&(this.end=K)}markRangeDirty(K,O){K>O&&(z=K,K=O,O=z),Kthis.end&&(this.end=O)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function X(K){return 0<=K&&K<256}G=f([p(0,D.IBufferService)],G)},844:(u,o)=>{function c(f){for(const p of f)p.dispose();f.length=0}Object.defineProperty(o,"__esModule",{value:!0}),o.getDisposeArrayDisposable=o.disposeArray=o.toDisposable=o.MutableDisposable=o.Disposable=void 0,o.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const f of this._disposables)f.dispose();this._disposables.length=0}register(f){return this._disposables.push(f),f}unregister(f){const p=this._disposables.indexOf(f);p!==-1&&this._disposables.splice(p,1)}},o.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(f){var p;this._isDisposed||f===this._value||((p=this._value)==null||p.dispose(),this._value=f)}clear(){this.value=void 0}dispose(){var f;this._isDisposed=!0,(f=this._value)==null||f.dispose(),this._value=void 0}},o.toDisposable=function(f){return{dispose:f}},o.disposeArray=c,o.getDisposeArrayDisposable=function(f){return{dispose:()=>c(f)}}},1505:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.FourKeyMap=o.TwoKeyMap=void 0;class c{constructor(){this._data={}}set(p,d,_){this._data[p]||(this._data[p]={}),this._data[p][d]=_}get(p,d){return this._data[p]?this._data[p][d]:void 0}clear(){this._data={}}}o.TwoKeyMap=c,o.FourKeyMap=class{constructor(){this._data=new c}set(f,p,d,_,v){this._data.get(f,p)||this._data.set(f,p,new c),this._data.get(f,p).set(d,_,v)}get(f,p,d,_){var v;return(v=this._data.get(f,p))==null?void 0:v.get(d,_)}clear(){this._data.clear()}}},6114:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.isChromeOS=o.isLinux=o.isWindows=o.isIphone=o.isIpad=o.isMac=o.getSafariVersion=o.isSafari=o.isLegacyEdge=o.isFirefox=o.isNode=void 0,o.isNode=typeof process<"u"&&"title"in process;const c=o.isNode?"node":navigator.userAgent,f=o.isNode?"node":navigator.platform;o.isFirefox=c.includes("Firefox"),o.isLegacyEdge=c.includes("Edge"),o.isSafari=/^((?!chrome|android).)*safari/i.test(c),o.getSafariVersion=function(){if(!o.isSafari)return 0;const p=c.match(/Version\/(\d+)/);return p===null||p.length<2?0:parseInt(p[1])},o.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(f),o.isIpad=f==="iPad",o.isIphone=f==="iPhone",o.isWindows=["Windows","Win16","Win32","WinCE"].includes(f),o.isLinux=f.indexOf("Linux")>=0,o.isChromeOS=/\bCrOS\b/.test(c)},6106:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.SortedList=void 0;let c=0;o.SortedList=class{constructor(f){this._getKey=f,this._array=[]}clear(){this._array.length=0}insert(f){this._array.length!==0?(c=this._search(this._getKey(f)),this._array.splice(c,0,f)):this._array.push(f)}delete(f){if(this._array.length===0)return!1;const p=this._getKey(f);if(p===void 0||(c=this._search(p),c===-1)||this._getKey(this._array[c])!==p)return!1;do if(this._array[c]===f)return this._array.splice(c,1),!0;while(++c=this._array.length)&&this._getKey(this._array[c])===f))do yield this._array[c];while(++c=this._array.length)&&this._getKey(this._array[c])===f))do p(this._array[c]);while(++c=p;){let _=p+d>>1;const v=this._getKey(this._array[_]);if(v>f)d=_-1;else{if(!(v0&&this._getKey(this._array[_-1])===f;)_--;return _}p=_+1}}return p}}},7226:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.DebouncedIdleTask=o.IdleTaskQueue=o.PriorityTaskQueue=void 0;const f=c(6114);class p{constructor(){this._tasks=[],this._i=0}enqueue(v){this._tasks.push(v),this._start()}flush(){for(;this._iS)return y-w<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(y-w))}ms`),void this._start();y=S}this.clear()}}class d extends p{_requestCallback(v){return setTimeout((()=>v(this._createDeadline(16))))}_cancelCallback(v){clearTimeout(v)}_createDeadline(v){const w=Date.now()+v;return{timeRemaining:()=>Math.max(0,w-Date.now())}}}o.PriorityTaskQueue=d,o.IdleTaskQueue=!f.isNode&&"requestIdleCallback"in window?class extends p{_requestCallback(_){return requestIdleCallback(_)}_cancelCallback(_){cancelIdleCallback(_)}}:d,o.DebouncedIdleTask=class{constructor(){this._queue=new o.IdleTaskQueue}set(_){this._queue.clear(),this._queue.enqueue(_)}flush(){this._queue.flush()}}},9282:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.updateWindowsModeWrappedState=void 0;const f=c(643);o.updateWindowsModeWrappedState=function(p){const d=p.buffer.lines.get(p.buffer.ybase+p.buffer.y-1),_=d==null?void 0:d.get(p.cols-1),v=p.buffer.lines.get(p.buffer.ybase+p.buffer.y);v&&_&&(v.isWrapped=_[f.CHAR_DATA_CODE_INDEX]!==f.NULL_CELL_CODE&&_[f.CHAR_DATA_CODE_INDEX]!==f.WHITESPACE_CELL_CODE)}},3734:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.ExtendedAttrs=o.AttributeData=void 0;class c{constructor(){this.fg=0,this.bg=0,this.extended=new f}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 c;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}}o.AttributeData=c;class f{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,_=0){this._ext=0,this._urlId=0,this._ext=d,this._urlId=_}clone(){return new f(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}o.ExtendedAttrs=f},9092:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.Buffer=o.MAX_BUFFER_SIZE=void 0;const f=c(6349),p=c(7226),d=c(3734),_=c(8437),v=c(4634),w=c(511),C=c(643),y=c(4863),S=c(7116);o.MAX_BUFFER_SIZE=4294967295,o.Buffer=class{constructor(x,b,k){this._hasScrollback=x,this._optionsService=b,this._bufferService=k,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=_.DEFAULT_ATTR_DATA.clone(),this.savedCharset=S.DEFAULT_CHARSET,this.markers=[],this._nullCell=w.CellData.fromCharData([0,C.NULL_CELL_CHAR,C.NULL_CELL_WIDTH,C.NULL_CELL_CODE]),this._whitespaceCell=w.CellData.fromCharData([0,C.WHITESPACE_CELL_CHAR,C.WHITESPACE_CELL_WIDTH,C.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new p.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new f.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 _.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&&xo.MAX_BUFFER_SIZE?o.MAX_BUFFER_SIZE:b}fillViewportRows(x){if(this.lines.length===0){x===void 0&&(x=_.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 f.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(x,b){const k=this.getNullCell(_.DEFAULT_ATTR_DATA);let D=0;const T=this._getCorrectBufferLength(b);if(T>this.lines.maxLength&&(this.lines.maxLength=T),this.lines.length>0){if(this._cols0&&this.lines.length<=this.ybase+this.y+R+1?(this.ybase--,R++,this.ydisp>0&&this.ydisp--):this.lines.push(new _.BufferLine(x,k)));else for(let N=this._rows;N>b;N--)this.lines.length>b+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(T0&&(this.lines.trimStart(N),this.ybase=Math.max(this.ybase-N,0),this.ydisp=Math.max(this.ydisp-N,0),this.savedY=Math.max(this.savedY-N,0)),this.lines.maxLength=T}this.x=Math.min(this.x,x-1),this.y=Math.min(this.y,b-1),R&&(this.y+=R),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 R=0;R.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._memoryCleanupPosition100)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 k=(0,v.reflowLargerGetLinesToRemove)(this.lines,this._cols,x,this.ybase+this.y,this.getNullCell(_.DEFAULT_ATTR_DATA));if(k.length>0){const D=(0,v.reflowLargerCreateNewLayout)(this.lines,k);(0,v.reflowLargerApplyNewLayout)(this.lines,D.layout),this._reflowLargerAdjustViewport(x,b,D.countRemoved)}}_reflowLargerAdjustViewport(x,b,k){const D=this.getNullCell(_.DEFAULT_ATTR_DATA);let T=k;for(;T-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length=0;R--){let N=this.lines.get(R);if(!N||!N.isWrapped&&N.getTrimmedLength()<=x)continue;const M=[N];for(;N.isWrapped&&R>0;)N=this.lines.get(--R),M.unshift(N);const B=this.ybase+this.y;if(B>=R&&B0&&(D.push({start:R+M.length+T,newLines:q}),T+=q.length),M.push(...q);let G=Y.length-1,X=Y[G];X===0&&(G--,X=Y[G]);let K=M.length-F-1,O=H;for(;K>=0;){const j=Math.min(O,X);if(M[G]===void 0)break;if(M[G].copyCellsFrom(M[K],O-j,X-j,j,!0),X-=j,X===0&&(G--,X=Y[G]),O-=j,O===0){K--;const $=Math.max(K,0);O=(0,v.getWrappedLineTrimmedLength)(M,$,this._cols)}}for(let j=0;j0;)this.ybase===0?this.y0){const R=[],N=[];for(let G=0;G=0;G--)if(Y&&Y.start>B+F){for(let X=Y.newLines.length-1;X>=0;X--)this.lines.set(G--,Y.newLines[X]);G++,R.push({index:B+1,amount:Y.newLines.length}),F+=Y.newLines.length,Y=D[++H]}else this.lines.set(G,N[B--]);let z=0;for(let G=R.length-1;G>=0;G--)R[G].index+=z,this.lines.onInsertEmitter.fire(R[G]),z+=R[G].amount;const q=Math.max(0,M+T-this.lines.maxLength);q>0&&this.lines.onTrimEmitter.fire(q)}}translateBufferLineToString(x,b,k=0,D){const T=this.lines.get(x);return T?T.translateToString(b,k,D):""}getWrappedRangeForLine(x){let b=x,k=x;for(;b>0&&this.lines.get(b).isWrapped;)b--;for(;k+10;);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?this._cols-1:x<0?0:x}clearMarkers(x){this._isClearing=!0;for(let b=0;b{b.line-=k,b.line<0&&b.dispose()}))),b.register(this.lines.onInsert((k=>{b.line>=k.index&&(b.line+=k.amount)}))),b.register(this.lines.onDelete((k=>{b.line>=k.index&&b.linek.index&&(b.line-=k.amount)}))),b.register(b.onDispose((()=>this._removeMarker(b)))),b}_removeMarker(x){this._isClearing||this.markers.splice(this.markers.indexOf(x),1)}}},8437:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.BufferLine=o.DEFAULT_ATTR_DATA=void 0;const f=c(3734),p=c(511),d=c(643),_=c(482);o.DEFAULT_ATTR_DATA=Object.freeze(new f.AttributeData);let v=0;class w{constructor(y,S,x=!1){this.isWrapped=x,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*y);const b=S||p.CellData.fromCharData([0,d.NULL_CELL_CHAR,d.NULL_CELL_WIDTH,d.NULL_CELL_CODE]);for(let k=0;k>22,2097152&S?this._combined[y].charCodeAt(this._combined[y].length-1):x]}set(y,S){this._data[3*y+1]=S[d.CHAR_DATA_ATTR_INDEX],S[d.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[y]=S[1],this._data[3*y+0]=2097152|y|S[d.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*y+0]=S[d.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|S[d.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(y){return this._data[3*y+0]>>22}hasWidth(y){return 12582912&this._data[3*y+0]}getFg(y){return this._data[3*y+1]}getBg(y){return this._data[3*y+2]}hasContent(y){return 4194303&this._data[3*y+0]}getCodePoint(y){const S=this._data[3*y+0];return 2097152&S?this._combined[y].charCodeAt(this._combined[y].length-1):2097151&S}isCombined(y){return 2097152&this._data[3*y+0]}getString(y){const S=this._data[3*y+0];return 2097152&S?this._combined[y]:2097151&S?(0,_.stringFromCodePoint)(2097151&S):""}isProtected(y){return 536870912&this._data[3*y+2]}loadCell(y,S){return v=3*y,S.content=this._data[v+0],S.fg=this._data[v+1],S.bg=this._data[v+2],2097152&S.content&&(S.combinedData=this._combined[y]),268435456&S.bg&&(S.extended=this._extendedAttrs[y]),S}setCell(y,S){2097152&S.content&&(this._combined[y]=S.combinedData),268435456&S.bg&&(this._extendedAttrs[y]=S.extended),this._data[3*y+0]=S.content,this._data[3*y+1]=S.fg,this._data[3*y+2]=S.bg}setCellFromCodepoint(y,S,x,b){268435456&b.bg&&(this._extendedAttrs[y]=b.extended),this._data[3*y+0]=S|x<<22,this._data[3*y+1]=b.fg,this._data[3*y+2]=b.bg}addCodepointToCell(y,S,x){let b=this._data[3*y+0];2097152&b?this._combined[y]+=(0,_.stringFromCodePoint)(S):2097151&b?(this._combined[y]=(0,_.stringFromCodePoint)(2097151&b)+(0,_.stringFromCodePoint)(S),b&=-2097152,b|=2097152):b=S|4194304,x&&(b&=-12582913,b|=x<<22),this._data[3*y+0]=b}insertCells(y,S,x){if((y%=this.length)&&this.getWidth(y-1)===2&&this.setCellFromCodepoint(y-1,0,1,x),S=0;--k)this.setCell(y+S+k,this.loadCell(y+k,b));for(let k=0;kthis.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=y&&delete this._combined[T]}const k=Object.keys(this._extendedAttrs);for(let D=0;D=y&&delete this._extendedAttrs[T]}}return this.length=y,4*x*2=0;--y)if(4194303&this._data[3*y+0])return y+(this._data[3*y+0]>>22);return 0}getNoBgTrimmedLength(){for(let y=this.length-1;y>=0;--y)if(4194303&this._data[3*y+0]||50331648&this._data[3*y+2])return y+(this._data[3*y+0]>>22);return 0}copyCellsFrom(y,S,x,b,k){const D=y._data;if(k)for(let R=b-1;R>=0;R--){for(let N=0;N<3;N++)this._data[3*(x+R)+N]=D[3*(S+R)+N];268435456&D[3*(S+R)+2]&&(this._extendedAttrs[x+R]=y._extendedAttrs[S+R])}else for(let R=0;R=S&&(this._combined[N-S+x]=y._combined[N])}}translateToString(y,S,x,b){S=S??0,x=x??this.length,y&&(x=Math.min(x,this.getTrimmedLength())),b&&(b.length=0);let k="";for(;S>22||1}return b&&b.push(S),k}}o.BufferLine=w},4841:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.getRangeLength=void 0,o.getRangeLength=function(c,f){if(c.start.y>c.end.y)throw new Error(`Buffer range end (${c.end.x}, ${c.end.y}) cannot be before start (${c.start.x}, ${c.start.y})`);return f*(c.end.y-c.start.y)+(c.end.x-c.start.x+1)}},4634:(u,o)=>{function c(f,p,d){if(p===f.length-1)return f[p].getTrimmedLength();const _=!f[p].hasContent(d-1)&&f[p].getWidth(d-1)===1,v=f[p+1].getWidth(0)===2;return _&&v?d-1:d}Object.defineProperty(o,"__esModule",{value:!0}),o.getWrappedLineTrimmedLength=o.reflowSmallerGetNewLineLengths=o.reflowLargerApplyNewLayout=o.reflowLargerCreateNewLayout=o.reflowLargerGetLinesToRemove=void 0,o.reflowLargerGetLinesToRemove=function(f,p,d,_,v){const w=[];for(let C=0;C=C&&_0&&(N>b||x[N].getTrimmedLength()===0);N--)R++;R>0&&(w.push(C+x.length-R),w.push(R)),C+=x.length-1}return w},o.reflowLargerCreateNewLayout=function(f,p){const d=[];let _=0,v=p[_],w=0;for(let C=0;Cc(f,x,p))).reduce(((S,x)=>S+x));let w=0,C=0,y=0;for(;yS&&(w-=S,C++);const x=f[C].getWidth(w-1)===2;x&&w--;const b=x?d-1:d;_.push(b),y+=b}return _},o.getWrappedLineTrimmedLength=c},5295:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.BufferSet=void 0;const f=c(8460),p=c(844),d=c(9092);class _ extends p.Disposable{constructor(w,C){super(),this._optionsService=w,this._bufferService=C,this._onBufferActivate=this.register(new f.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(w){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(w),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(w,C){this._normal.resize(w,C),this._alt.resize(w,C),this.setupTabStops(w)}setupTabStops(w){this._normal.setupTabStops(w),this._alt.setupTabStops(w)}}o.BufferSet=_},511:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.CellData=void 0;const f=c(482),p=c(643),d=c(3734);class _ extends d.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new d.ExtendedAttrs,this.combinedData=""}static fromCharData(w){const C=new _;return C.setFromCharData(w),C}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,f.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(w){this.fg=w[p.CHAR_DATA_ATTR_INDEX],this.bg=0;let C=!1;if(w[p.CHAR_DATA_CHAR_INDEX].length>2)C=!0;else if(w[p.CHAR_DATA_CHAR_INDEX].length===2){const y=w[p.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=y&&y<=56319){const S=w[p.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=S&&S<=57343?this.content=1024*(y-55296)+S-56320+65536|w[p.CHAR_DATA_WIDTH_INDEX]<<22:C=!0}else C=!0}else this.content=w[p.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|w[p.CHAR_DATA_WIDTH_INDEX]<<22;C&&(this.combinedData=w[p.CHAR_DATA_CHAR_INDEX],this.content=2097152|w[p.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}o.CellData=_},643:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.WHITESPACE_CELL_CODE=o.WHITESPACE_CELL_WIDTH=o.WHITESPACE_CELL_CHAR=o.NULL_CELL_CODE=o.NULL_CELL_WIDTH=o.NULL_CELL_CHAR=o.CHAR_DATA_CODE_INDEX=o.CHAR_DATA_WIDTH_INDEX=o.CHAR_DATA_CHAR_INDEX=o.CHAR_DATA_ATTR_INDEX=o.DEFAULT_EXT=o.DEFAULT_ATTR=o.DEFAULT_COLOR=void 0,o.DEFAULT_COLOR=0,o.DEFAULT_ATTR=256|o.DEFAULT_COLOR<<9,o.DEFAULT_EXT=0,o.CHAR_DATA_ATTR_INDEX=0,o.CHAR_DATA_CHAR_INDEX=1,o.CHAR_DATA_WIDTH_INDEX=2,o.CHAR_DATA_CODE_INDEX=3,o.NULL_CELL_CHAR="",o.NULL_CELL_WIDTH=1,o.NULL_CELL_CODE=0,o.WHITESPACE_CELL_CHAR=" ",o.WHITESPACE_CELL_WIDTH=1,o.WHITESPACE_CELL_CODE=32},4863:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.Marker=void 0;const f=c(8460),p=c(844);class d{get id(){return this._id}constructor(v){this.line=v,this.isDisposed=!1,this._disposables=[],this._id=d._nextId++,this._onDispose=this.register(new f.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,p.disposeArray)(this._disposables),this._disposables.length=0)}register(v){return this._disposables.push(v),v}}o.Marker=d,d._nextId=1},7116:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.DEFAULT_CHARSET=o.CHARSETS=void 0,o.CHARSETS={},o.DEFAULT_CHARSET=o.CHARSETS.B,o.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:"≥","{":"π","|":"≠","}":"£","~":"·"},o.CHARSETS.A={"#":"£"},o.CHARSETS.B=void 0,o.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},o.CHARSETS.C=o.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},o.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},o.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},o.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},o.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},o.CHARSETS.E=o.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},o.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},o.CHARSETS.H=o.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},o.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(u,o)=>{var c,f,p;Object.defineProperty(o,"__esModule",{value:!0}),o.C1_ESCAPED=o.C1=o.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=` -`,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=""})(c||(o.C0=c={})),(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="Ÿ"})(f||(o.C1=f={})),(function(d){d.ST=`${c.ESC}\\`})(p||(o.C1_ESCAPED=p={}))},7399:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.evaluateKeyboardEvent=void 0;const f=c(2584),p={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:["'",'"']};o.evaluateKeyboardEvent=function(d,_,v,w){const C={type:0,cancel:!1,key:void 0},y=(d.shiftKey?1:0)|(d.altKey?2:0)|(d.ctrlKey?4:0)|(d.metaKey?8:0);switch(d.keyCode){case 0:d.key==="UIKeyInputUpArrow"?C.key=_?f.C0.ESC+"OA":f.C0.ESC+"[A":d.key==="UIKeyInputLeftArrow"?C.key=_?f.C0.ESC+"OD":f.C0.ESC+"[D":d.key==="UIKeyInputRightArrow"?C.key=_?f.C0.ESC+"OC":f.C0.ESC+"[C":d.key==="UIKeyInputDownArrow"&&(C.key=_?f.C0.ESC+"OB":f.C0.ESC+"[B");break;case 8:C.key=d.ctrlKey?"\b":f.C0.DEL,d.altKey&&(C.key=f.C0.ESC+C.key);break;case 9:if(d.shiftKey){C.key=f.C0.ESC+"[Z";break}C.key=f.C0.HT,C.cancel=!0;break;case 13:C.key=d.altKey?f.C0.ESC+f.C0.CR:f.C0.CR,C.cancel=!0;break;case 27:C.key=f.C0.ESC,d.altKey&&(C.key=f.C0.ESC+f.C0.ESC),C.cancel=!0;break;case 37:if(d.metaKey)break;y?(C.key=f.C0.ESC+"[1;"+(y+1)+"D",C.key===f.C0.ESC+"[1;3D"&&(C.key=f.C0.ESC+(v?"b":"[1;5D"))):C.key=_?f.C0.ESC+"OD":f.C0.ESC+"[D";break;case 39:if(d.metaKey)break;y?(C.key=f.C0.ESC+"[1;"+(y+1)+"C",C.key===f.C0.ESC+"[1;3C"&&(C.key=f.C0.ESC+(v?"f":"[1;5C"))):C.key=_?f.C0.ESC+"OC":f.C0.ESC+"[C";break;case 38:if(d.metaKey)break;y?(C.key=f.C0.ESC+"[1;"+(y+1)+"A",v||C.key!==f.C0.ESC+"[1;3A"||(C.key=f.C0.ESC+"[1;5A")):C.key=_?f.C0.ESC+"OA":f.C0.ESC+"[A";break;case 40:if(d.metaKey)break;y?(C.key=f.C0.ESC+"[1;"+(y+1)+"B",v||C.key!==f.C0.ESC+"[1;3B"||(C.key=f.C0.ESC+"[1;5B")):C.key=_?f.C0.ESC+"OB":f.C0.ESC+"[B";break;case 45:d.shiftKey||d.ctrlKey||(C.key=f.C0.ESC+"[2~");break;case 46:C.key=y?f.C0.ESC+"[3;"+(y+1)+"~":f.C0.ESC+"[3~";break;case 36:C.key=y?f.C0.ESC+"[1;"+(y+1)+"H":_?f.C0.ESC+"OH":f.C0.ESC+"[H";break;case 35:C.key=y?f.C0.ESC+"[1;"+(y+1)+"F":_?f.C0.ESC+"OF":f.C0.ESC+"[F";break;case 33:d.shiftKey?C.type=2:d.ctrlKey?C.key=f.C0.ESC+"[5;"+(y+1)+"~":C.key=f.C0.ESC+"[5~";break;case 34:d.shiftKey?C.type=3:d.ctrlKey?C.key=f.C0.ESC+"[6;"+(y+1)+"~":C.key=f.C0.ESC+"[6~";break;case 112:C.key=y?f.C0.ESC+"[1;"+(y+1)+"P":f.C0.ESC+"OP";break;case 113:C.key=y?f.C0.ESC+"[1;"+(y+1)+"Q":f.C0.ESC+"OQ";break;case 114:C.key=y?f.C0.ESC+"[1;"+(y+1)+"R":f.C0.ESC+"OR";break;case 115:C.key=y?f.C0.ESC+"[1;"+(y+1)+"S":f.C0.ESC+"OS";break;case 116:C.key=y?f.C0.ESC+"[15;"+(y+1)+"~":f.C0.ESC+"[15~";break;case 117:C.key=y?f.C0.ESC+"[17;"+(y+1)+"~":f.C0.ESC+"[17~";break;case 118:C.key=y?f.C0.ESC+"[18;"+(y+1)+"~":f.C0.ESC+"[18~";break;case 119:C.key=y?f.C0.ESC+"[19;"+(y+1)+"~":f.C0.ESC+"[19~";break;case 120:C.key=y?f.C0.ESC+"[20;"+(y+1)+"~":f.C0.ESC+"[20~";break;case 121:C.key=y?f.C0.ESC+"[21;"+(y+1)+"~":f.C0.ESC+"[21~";break;case 122:C.key=y?f.C0.ESC+"[23;"+(y+1)+"~":f.C0.ESC+"[23~";break;case 123:C.key=y?f.C0.ESC+"[24;"+(y+1)+"~":f.C0.ESC+"[24~";break;default:if(!d.ctrlKey||d.shiftKey||d.altKey||d.metaKey)if(v&&!w||!d.altKey||d.metaKey)!v||d.altKey||d.ctrlKey||d.shiftKey||!d.metaKey?d.key&&!d.ctrlKey&&!d.altKey&&!d.metaKey&&d.keyCode>=48&&d.key.length===1?C.key=d.key:d.key&&d.ctrlKey&&(d.key==="_"&&(C.key=f.C0.US),d.key==="@"&&(C.key=f.C0.NUL)):d.keyCode===65&&(C.type=1);else{const S=p[d.keyCode],x=S==null?void 0:S[d.shiftKey?1:0];if(x)C.key=f.C0.ESC+x;else if(d.keyCode>=65&&d.keyCode<=90){const b=d.ctrlKey?d.keyCode-64:d.keyCode+32;let k=String.fromCharCode(b);d.shiftKey&&(k=k.toUpperCase()),C.key=f.C0.ESC+k}else if(d.keyCode===32)C.key=f.C0.ESC+(d.ctrlKey?f.C0.NUL:" ");else if(d.key==="Dead"&&d.code.startsWith("Key")){let b=d.code.slice(3,4);d.shiftKey||(b=b.toLowerCase()),C.key=f.C0.ESC+b,C.cancel=!0}}else d.keyCode>=65&&d.keyCode<=90?C.key=String.fromCharCode(d.keyCode-64):d.keyCode===32?C.key=f.C0.NUL:d.keyCode>=51&&d.keyCode<=55?C.key=String.fromCharCode(d.keyCode-51+27):d.keyCode===56?C.key=f.C0.DEL:d.keyCode===219?C.key=f.C0.ESC:d.keyCode===220?C.key=f.C0.FS:d.keyCode===221&&(C.key=f.C0.GS)}return C}},482:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.Utf8ToUtf32=o.StringToUtf32=o.utf32ToString=o.stringFromCodePoint=void 0,o.stringFromCodePoint=function(c){return c>65535?(c-=65536,String.fromCharCode(55296+(c>>10))+String.fromCharCode(c%1024+56320)):String.fromCharCode(c)},o.utf32ToString=function(c,f=0,p=c.length){let d="";for(let _=f;_65535?(v-=65536,d+=String.fromCharCode(55296+(v>>10))+String.fromCharCode(v%1024+56320)):d+=String.fromCharCode(v)}return d},o.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(c,f){const p=c.length;if(!p)return 0;let d=0,_=0;if(this._interim){const v=c.charCodeAt(_++);56320<=v&&v<=57343?f[d++]=1024*(this._interim-55296)+v-56320+65536:(f[d++]=this._interim,f[d++]=v),this._interim=0}for(let v=_;v=p)return this._interim=w,d;const C=c.charCodeAt(v);56320<=C&&C<=57343?f[d++]=1024*(w-55296)+C-56320+65536:(f[d++]=w,f[d++]=C)}else w!==65279&&(f[d++]=w)}return d}},o.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(c,f){const p=c.length;if(!p)return 0;let d,_,v,w,C=0,y=0,S=0;if(this.interim[0]){let k=!1,D=this.interim[0];D&=(224&D)==192?31:(240&D)==224?15:7;let T,R=0;for(;(T=63&this.interim[++R])&&R<4;)D<<=6,D|=T;const N=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,M=N-R;for(;S=p)return 0;if(T=c[S++],(192&T)!=128){S--,k=!0;break}this.interim[R++]=T,D<<=6,D|=63&T}k||(N===2?D<128?S--:f[C++]=D:N===3?D<2048||D>=55296&&D<=57343||D===65279||(f[C++]=D):D<65536||D>1114111||(f[C++]=D)),this.interim.fill(0)}const x=p-4;let b=S;for(;b=p)return this.interim[0]=d,C;if(_=c[b++],(192&_)!=128){b--;continue}if(y=(31&d)<<6|63&_,y<128){b--;continue}f[C++]=y}else if((240&d)==224){if(b>=p)return this.interim[0]=d,C;if(_=c[b++],(192&_)!=128){b--;continue}if(b>=p)return this.interim[0]=d,this.interim[1]=_,C;if(v=c[b++],(192&v)!=128){b--;continue}if(y=(15&d)<<12|(63&_)<<6|63&v,y<2048||y>=55296&&y<=57343||y===65279)continue;f[C++]=y}else if((248&d)==240){if(b>=p)return this.interim[0]=d,C;if(_=c[b++],(192&_)!=128){b--;continue}if(b>=p)return this.interim[0]=d,this.interim[1]=_,C;if(v=c[b++],(192&v)!=128){b--;continue}if(b>=p)return this.interim[0]=d,this.interim[1]=_,this.interim[2]=v,C;if(w=c[b++],(192&w)!=128){b--;continue}if(y=(7&d)<<18|(63&_)<<12|(63&v)<<6|63&w,y<65536||y>1114111)continue;f[C++]=y}}return C}}},225:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.UnicodeV6=void 0;const f=c(1480),p=[[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 _;o.UnicodeV6=class{constructor(){if(this.version="6",!_){_=new Uint8Array(65536),_.fill(1),_[0]=0,_.fill(0,1,32),_.fill(0,127,160),_.fill(2,4352,4448),_[9001]=2,_[9002]=2,_.fill(2,11904,42192),_[12351]=1,_.fill(2,44032,55204),_.fill(2,63744,64256),_.fill(2,65040,65050),_.fill(2,65072,65136),_.fill(2,65280,65377),_.fill(2,65504,65511);for(let v=0;vC[x][1])return!1;for(;x>=S;)if(y=S+x>>1,w>C[y][1])S=y+1;else{if(!(w=131072&&v<=196605||v>=196608&&v<=262141?2:1}charProperties(v,w){let C=this.wcwidth(v),y=C===0&&w!==0;if(y){const S=f.UnicodeService.extractWidth(w);S===0?y=!1:S>C&&(C=S)}return f.UnicodeService.createPropertyValue(0,C,y)}}},5981:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.WriteBuffer=void 0;const f=c(8460),p=c(844);class d extends p.Disposable{constructor(v){super(),this._action=v,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new f.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(v,w){if(w!==void 0&&this._syncCalls>w)return void(this._syncCalls=0);if(this._pendingData+=v.length,this._writeBuffer.push(v),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let C;for(this._isSyncWriting=!0;C=this._writeBuffer.shift();){this._action(C);const y=this._callbacks.shift();y&&y()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(v,w){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+=v.length,this._writeBuffer.push(v),this._callbacks.push(w),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=v.length,this._writeBuffer.push(v),this._callbacks.push(w)}_innerWrite(v=0,w=!0){const C=v||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const y=this._writeBuffer[this._bufferOffset],S=this._action(y,w);if(S){const b=k=>Date.now()-C>=12?setTimeout((()=>this._innerWrite(0,k))):this._innerWrite(C,k);return void S.catch((k=>(queueMicrotask((()=>{throw k})),Promise.resolve(!1)))).then(b)}const x=this._callbacks[this._bufferOffset];if(x&&x(),this._bufferOffset++,this._pendingData-=y.length,Date.now()-C>=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()}}o.WriteBuffer=d},5941:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.toRgbString=o.parseColor=void 0;const c=/^([\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})$/,f=/^[\da-f]+$/;function p(d,_){const v=d.toString(16),w=v.length<2?"0"+v:v;switch(_){case 4:return v[0];case 8:return w;case 12:return(w+w).slice(0,3);default:return w+w}}o.parseColor=function(d){if(!d)return;let _=d.toLowerCase();if(_.indexOf("rgb:")===0){_=_.slice(4);const v=c.exec(_);if(v){const w=v[1]?15:v[4]?255:v[7]?4095:65535;return[Math.round(parseInt(v[1]||v[4]||v[7]||v[10],16)/w*255),Math.round(parseInt(v[2]||v[5]||v[8]||v[11],16)/w*255),Math.round(parseInt(v[3]||v[6]||v[9]||v[12],16)/w*255)]}}else if(_.indexOf("#")===0&&(_=_.slice(1),f.exec(_)&&[3,6,9,12].includes(_.length))){const v=_.length/3,w=[0,0,0];for(let C=0;C<3;++C){const y=parseInt(_.slice(v*C,v*C+v),16);w[C]=v===1?y<<4:v===2?y:v===3?y>>4:y>>8}return w}},o.toRgbString=function(d,_=16){const[v,w,C]=d;return`rgb:${p(v,_)}/${p(w,_)}/${p(C,_)}`}},5770:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.PAYLOAD_LIMIT=void 0,o.PAYLOAD_LIMIT=1e7},6351:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.DcsHandler=o.DcsParser=void 0;const f=c(482),p=c(8742),d=c(5770),_=[];o.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=_,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=_}registerHandler(w,C){this._handlers[w]===void 0&&(this._handlers[w]=[]);const y=this._handlers[w];return y.push(C),{dispose:()=>{const S=y.indexOf(C);S!==-1&&y.splice(S,1)}}}clearHandler(w){this._handlers[w]&&delete this._handlers[w]}setHandlerFallback(w){this._handlerFb=w}reset(){if(this._active.length)for(let w=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;w>=0;--w)this._active[w].unhook(!1);this._stack.paused=!1,this._active=_,this._ident=0}hook(w,C){if(this.reset(),this._ident=w,this._active=this._handlers[w]||_,this._active.length)for(let y=this._active.length-1;y>=0;y--)this._active[y].hook(C);else this._handlerFb(this._ident,"HOOK",C)}put(w,C,y){if(this._active.length)for(let S=this._active.length-1;S>=0;S--)this._active[S].put(w,C,y);else this._handlerFb(this._ident,"PUT",(0,f.utf32ToString)(w,C,y))}unhook(w,C=!0){if(this._active.length){let y=!1,S=this._active.length-1,x=!1;if(this._stack.paused&&(S=this._stack.loopPosition-1,y=C,x=this._stack.fallThrough,this._stack.paused=!1),!x&&y===!1){for(;S>=0&&(y=this._active[S].unhook(w),y!==!0);S--)if(y instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=S,this._stack.fallThrough=!1,y;S--}for(;S>=0;S--)if(y=this._active[S].unhook(!1),y instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=S,this._stack.fallThrough=!0,y}else this._handlerFb(this._ident,"UNHOOK",w);this._active=_,this._ident=0}};const v=new p.Params;v.addParam(0),o.DcsHandler=class{constructor(w){this._handler=w,this._data="",this._params=v,this._hitLimit=!1}hook(w){this._params=w.length>1||w.params[0]?w.clone():v,this._data="",this._hitLimit=!1}put(w,C,y){this._hitLimit||(this._data+=(0,f.utf32ToString)(w,C,y),this._data.length>d.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(w){let C=!1;if(this._hitLimit)C=!1;else if(w&&(C=this._handler(this._data,this._params),C instanceof Promise))return C.then((y=>(this._params=v,this._data="",this._hitLimit=!1,y)));return this._params=v,this._data="",this._hitLimit=!1,C}}},2015:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.EscapeSequenceParser=o.VT500_TRANSITION_TABLE=o.TransitionTable=void 0;const f=c(844),p=c(8742),d=c(6242),_=c(6351);class v{constructor(S){this.table=new Uint8Array(S)}setDefault(S,x){this.table.fill(S<<4|x)}add(S,x,b,k){this.table[x<<8|S]=b<<4|k}addMany(S,x,b,k){for(let D=0;DN)),x=(R,N)=>S.slice(R,N),b=x(32,127),k=x(0,24);k.push(25),k.push.apply(k,x(28,32));const D=x(0,14);let T;for(T in y.setDefault(1,0),y.addMany(b,0,2,0),D)y.addMany([24,26,153,154],T,3,0),y.addMany(x(128,144),T,3,0),y.addMany(x(144,152),T,3,0),y.add(156,T,0,0),y.add(27,T,11,1),y.add(157,T,4,8),y.addMany([152,158,159],T,0,7),y.add(155,T,11,3),y.add(144,T,11,9);return y.addMany(k,0,3,0),y.addMany(k,1,3,1),y.add(127,1,0,1),y.addMany(k,8,0,8),y.addMany(k,3,3,3),y.add(127,3,0,3),y.addMany(k,4,3,4),y.add(127,4,0,4),y.addMany(k,6,3,6),y.addMany(k,5,3,5),y.add(127,5,0,5),y.addMany(k,2,3,2),y.add(127,2,0,2),y.add(93,1,4,8),y.addMany(b,8,5,8),y.add(127,8,5,8),y.addMany([156,27,24,26,7],8,6,0),y.addMany(x(28,32),8,0,8),y.addMany([88,94,95],1,0,7),y.addMany(b,7,0,7),y.addMany(k,7,0,7),y.add(156,7,0,0),y.add(127,7,0,7),y.add(91,1,11,3),y.addMany(x(64,127),3,7,0),y.addMany(x(48,60),3,8,4),y.addMany([60,61,62,63],3,9,4),y.addMany(x(48,60),4,8,4),y.addMany(x(64,127),4,7,0),y.addMany([60,61,62,63],4,0,6),y.addMany(x(32,64),6,0,6),y.add(127,6,0,6),y.addMany(x(64,127),6,0,0),y.addMany(x(32,48),3,9,5),y.addMany(x(32,48),5,9,5),y.addMany(x(48,64),5,0,6),y.addMany(x(64,127),5,7,0),y.addMany(x(32,48),4,9,5),y.addMany(x(32,48),1,9,2),y.addMany(x(32,48),2,9,2),y.addMany(x(48,127),2,10,0),y.addMany(x(48,80),1,10,0),y.addMany(x(81,88),1,10,0),y.addMany([89,90,92],1,10,0),y.addMany(x(96,127),1,10,0),y.add(80,1,11,9),y.addMany(k,9,0,9),y.add(127,9,0,9),y.addMany(x(28,32),9,0,9),y.addMany(x(32,48),9,9,12),y.addMany(x(48,60),9,8,10),y.addMany([60,61,62,63],9,9,10),y.addMany(k,11,0,11),y.addMany(x(32,128),11,0,11),y.addMany(x(28,32),11,0,11),y.addMany(k,10,0,10),y.add(127,10,0,10),y.addMany(x(28,32),10,0,10),y.addMany(x(48,60),10,8,10),y.addMany([60,61,62,63],10,0,11),y.addMany(x(32,48),10,9,12),y.addMany(k,12,0,12),y.add(127,12,0,12),y.addMany(x(28,32),12,0,12),y.addMany(x(32,48),12,9,12),y.addMany(x(48,64),12,0,11),y.addMany(x(64,127),12,12,13),y.addMany(x(64,127),10,12,13),y.addMany(x(64,127),9,12,13),y.addMany(k,13,13,13),y.addMany(b,13,13,13),y.add(127,13,0,13),y.addMany([27,156,24,26],13,14,0),y.add(w,0,2,0),y.add(w,8,5,8),y.add(w,6,0,6),y.add(w,11,0,11),y.add(w,13,13,13),y})();class C extends f.Disposable{constructor(S=o.VT500_TRANSITION_TABLE){super(),this._transitions=S,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new p.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(x,b,k)=>{},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,f.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 _.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(S,x=[64,126]){let b=0;if(S.prefix){if(S.prefix.length>1)throw new Error("only one byte as prefix supported");if(b=S.prefix.charCodeAt(0),b&&60>b||b>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(S.intermediates){if(S.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let D=0;DT||T>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");b<<=8,b|=T}}if(S.final.length!==1)throw new Error("final must be a single byte");const k=S.final.charCodeAt(0);if(x[0]>k||k>x[1])throw new Error(`final must be in range ${x[0]} .. ${x[1]}`);return b<<=8,b|=k,b}identToString(S){const x=[];for(;S;)x.push(String.fromCharCode(255&S)),S>>=8;return x.reverse().join("")}setPrintHandler(S){this._printHandler=S}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(S,x){const b=this._identifier(S,[48,126]);this._escHandlers[b]===void 0&&(this._escHandlers[b]=[]);const k=this._escHandlers[b];return k.push(x),{dispose:()=>{const D=k.indexOf(x);D!==-1&&k.splice(D,1)}}}clearEscHandler(S){this._escHandlers[this._identifier(S,[48,126])]&&delete this._escHandlers[this._identifier(S,[48,126])]}setEscHandlerFallback(S){this._escHandlerFb=S}setExecuteHandler(S,x){this._executeHandlers[S.charCodeAt(0)]=x}clearExecuteHandler(S){this._executeHandlers[S.charCodeAt(0)]&&delete this._executeHandlers[S.charCodeAt(0)]}setExecuteHandlerFallback(S){this._executeHandlerFb=S}registerCsiHandler(S,x){const b=this._identifier(S);this._csiHandlers[b]===void 0&&(this._csiHandlers[b]=[]);const k=this._csiHandlers[b];return k.push(x),{dispose:()=>{const D=k.indexOf(x);D!==-1&&k.splice(D,1)}}}clearCsiHandler(S){this._csiHandlers[this._identifier(S)]&&delete this._csiHandlers[this._identifier(S)]}setCsiHandlerFallback(S){this._csiHandlerFb=S}registerDcsHandler(S,x){return this._dcsParser.registerHandler(this._identifier(S),x)}clearDcsHandler(S){this._dcsParser.clearHandler(this._identifier(S))}setDcsHandlerFallback(S){this._dcsParser.setHandlerFallback(S)}registerOscHandler(S,x){return this._oscParser.registerHandler(S,x)}clearOscHandler(S){this._oscParser.clearHandler(S)}setOscHandlerFallback(S){this._oscParser.setHandlerFallback(S)}setErrorHandler(S){this._errorHandler=S}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(S,x,b,k,D){this._parseStack.state=S,this._parseStack.handlers=x,this._parseStack.handlerPos=b,this._parseStack.transition=k,this._parseStack.chunkPos=D}parse(S,x,b){let k,D=0,T=0,R=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,R=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 N=this._parseStack.handlers;let M=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(b===!1&&M>-1){for(;M>=0&&(k=N[M](this._params),k!==!0);M--)if(k instanceof Promise)return this._parseStack.handlerPos=M,k}this._parseStack.handlers=[];break;case 4:if(b===!1&&M>-1){for(;M>=0&&(k=N[M](),k!==!0);M--)if(k instanceof Promise)return this._parseStack.handlerPos=M,k}this._parseStack.handlers=[];break;case 6:if(D=S[this._parseStack.chunkPos],k=this._dcsParser.unhook(D!==24&&D!==26,b),k)return k;D===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(D=S[this._parseStack.chunkPos],k=this._oscParser.end(D!==24&&D!==26,b),k)return k;D===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,R=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let N=R;N>4){case 2:for(let F=N+1;;++F){if(F>=x||(D=S[F])<32||D>126&&D=x||(D=S[F])<32||D>126&&D=x||(D=S[F])<32||D>126&&D=x||(D=S[F])<32||D>126&&D=0&&(k=M[B](this._params),k!==!0);B--)if(k instanceof Promise)return this._preserveStack(3,M,B,T,N),k;B<0&&this._csiHandlerFb(this._collect<<8|D,this._params),this.precedingJoinState=0;break;case 8:do switch(D){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(D-48)}while(++N47&&D<60);N--;break;case 9:this._collect<<=8,this._collect|=D;break;case 10:const H=this._escHandlers[this._collect<<8|D];let Y=H?H.length-1:-1;for(;Y>=0&&(k=H[Y](),k!==!0);Y--)if(k instanceof Promise)return this._preserveStack(4,H,Y,T,N),k;Y<0&&this._escHandlerFb(this._collect<<8|D),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|D,this._params);break;case 13:for(let F=N+1;;++F)if(F>=x||(D=S[F])===24||D===26||D===27||D>127&&D=x||(D=S[F])<32||D>127&&D{Object.defineProperty(o,"__esModule",{value:!0}),o.OscHandler=o.OscParser=void 0;const f=c(5770),p=c(482),d=[];o.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(_,v){this._handlers[_]===void 0&&(this._handlers[_]=[]);const w=this._handlers[_];return w.push(v),{dispose:()=>{const C=w.indexOf(v);C!==-1&&w.splice(C,1)}}}clearHandler(_){this._handlers[_]&&delete this._handlers[_]}setHandlerFallback(_){this._handlerFb=_}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=d}reset(){if(this._state===2)for(let _=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;_>=0;--_)this._active[_].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 _=this._active.length-1;_>=0;_--)this._active[_].start();else this._handlerFb(this._id,"START")}_put(_,v,w){if(this._active.length)for(let C=this._active.length-1;C>=0;C--)this._active[C].put(_,v,w);else this._handlerFb(this._id,"PUT",(0,p.utf32ToString)(_,v,w))}start(){this.reset(),this._state=1}put(_,v,w){if(this._state!==3){if(this._state===1)for(;v0&&this._put(_,v,w)}}end(_,v=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let w=!1,C=this._active.length-1,y=!1;if(this._stack.paused&&(C=this._stack.loopPosition-1,w=v,y=this._stack.fallThrough,this._stack.paused=!1),!y&&w===!1){for(;C>=0&&(w=this._active[C].end(_),w!==!0);C--)if(w instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=C,this._stack.fallThrough=!1,w;C--}for(;C>=0;C--)if(w=this._active[C].end(!1),w instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=C,this._stack.fallThrough=!0,w}else this._handlerFb(this._id,"END",_);this._active=d,this._id=-1,this._state=0}}},o.OscHandler=class{constructor(_){this._handler=_,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(_,v,w){this._hitLimit||(this._data+=(0,p.utf32ToString)(_,v,w),this._data.length>f.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(_){let v=!1;if(this._hitLimit)v=!1;else if(_&&(v=this._handler(this._data),v instanceof Promise))return v.then((w=>(this._data="",this._hitLimit=!1,w)));return this._data="",this._hitLimit=!1,v}}},8742:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.Params=void 0;const c=2147483647;class f{static fromArray(d){const _=new f;if(!d.length)return _;for(let v=Array.isArray(d[0])?1:0;v256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(d),this.length=0,this._subParams=new Int32Array(_),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(d),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const d=new f(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 _=0;_>8,w=255&this._subParamsIdx[_];w-v>0&&d.push(Array.prototype.slice.call(this._subParams,v,w))}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>c?c: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>c?c:d,this._subParamsIdx[this.length-1]++}}hasSubParams(d){return(255&this._subParamsIdx[d])-(this._subParamsIdx[d]>>8)>0}getSubParams(d){const _=this._subParamsIdx[d]>>8,v=255&this._subParamsIdx[d];return v-_>0?this._subParams.subarray(_,v):null}getSubParamsAll(){const d={};for(let _=0;_>8,w=255&this._subParamsIdx[_];w-v>0&&(d[_]=this._subParams.slice(v,w))}return d}addDigit(d){let _;if(this._rejectDigits||!(_=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const v=this._digitIsSub?this._subParams:this.params,w=v[_-1];v[_-1]=~w?Math.min(10*w+d,c):d}}o.Params=f},5741:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.AddonManager=void 0,o.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let c=this._addons.length-1;c>=0;c--)this._addons[c].instance.dispose()}loadAddon(c,f){const p={instance:f,dispose:f.dispose,isDisposed:!1};this._addons.push(p),f.dispose=()=>this._wrappedAddonDispose(p),f.activate(c)}_wrappedAddonDispose(c){if(c.isDisposed)return;let f=-1;for(let p=0;p{Object.defineProperty(o,"__esModule",{value:!0}),o.BufferApiView=void 0;const f=c(3785),p=c(511);o.BufferApiView=class{constructor(d,_){this._buffer=d,this.type=_}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 _=this._buffer.lines.get(d);if(_)return new f.BufferLineApiView(_)}getNullCell(){return new p.CellData}}},3785:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.BufferLineApiView=void 0;const f=c(511);o.BufferLineApiView=class{constructor(p){this._line=p}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(p,d){if(!(p<0||p>=this._line.length))return d?(this._line.loadCell(p,d),d):this._line.loadCell(p,new f.CellData)}translateToString(p,d,_){return this._line.translateToString(p,d,_)}}},8285:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.BufferNamespaceApi=void 0;const f=c(8771),p=c(8460),d=c(844);class _ extends d.Disposable{constructor(w){super(),this._core=w,this._onBufferChange=this.register(new p.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new f.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new f.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)}}o.BufferNamespaceApi=_},7975:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.ParserApi=void 0,o.ParserApi=class{constructor(c){this._core=c}registerCsiHandler(c,f){return this._core.registerCsiHandler(c,(p=>f(p.toArray())))}addCsiHandler(c,f){return this.registerCsiHandler(c,f)}registerDcsHandler(c,f){return this._core.registerDcsHandler(c,((p,d)=>f(p,d.toArray())))}addDcsHandler(c,f){return this.registerDcsHandler(c,f)}registerEscHandler(c,f){return this._core.registerEscHandler(c,f)}addEscHandler(c,f){return this.registerEscHandler(c,f)}registerOscHandler(c,f){return this._core.registerOscHandler(c,f)}addOscHandler(c,f){return this.registerOscHandler(c,f)}}},7090:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.UnicodeApi=void 0,o.UnicodeApi=class{constructor(c){this._core=c}register(c){this._core.unicodeService.register(c)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(c){this._core.unicodeService.activeVersion=c}}},744:function(u,o,c){var f=this&&this.__decorate||function(y,S,x,b){var k,D=arguments.length,T=D<3?S:b===null?b=Object.getOwnPropertyDescriptor(S,x):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(y,S,x,b);else for(var R=y.length-1;R>=0;R--)(k=y[R])&&(T=(D<3?k(T):D>3?k(S,x,T):k(S,x))||T);return D>3&&T&&Object.defineProperty(S,x,T),T},p=this&&this.__param||function(y,S){return function(x,b){S(x,b,y)}};Object.defineProperty(o,"__esModule",{value:!0}),o.BufferService=o.MINIMUM_ROWS=o.MINIMUM_COLS=void 0;const d=c(8460),_=c(844),v=c(5295),w=c(2585);o.MINIMUM_COLS=2,o.MINIMUM_ROWS=1;let C=o.BufferService=class extends _.Disposable{get buffer(){return this.buffers.active}constructor(y){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(y.rawOptions.cols||0,o.MINIMUM_COLS),this.rows=Math.max(y.rawOptions.rows||0,o.MINIMUM_ROWS),this.buffers=this.register(new v.BufferSet(y,this))}resize(y,S){this.cols=y,this.rows=S,this.buffers.resize(y,S),this._onResize.fire({cols:y,rows:S})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(y,S=!1){const x=this.buffer;let b;b=this._cachedBlankLine,b&&b.length===this.cols&&b.getFg(0)===y.fg&&b.getBg(0)===y.bg||(b=x.getBlankLine(y,S),this._cachedBlankLine=b),b.isWrapped=S;const k=x.ybase+x.scrollTop,D=x.ybase+x.scrollBottom;if(x.scrollTop===0){const T=x.lines.isFull;D===x.lines.length-1?T?x.lines.recycle().copyFrom(b):x.lines.push(b.clone()):x.lines.splice(D+1,0,b.clone()),T?this.isUserScrolling&&(x.ydisp=Math.max(x.ydisp-1,0)):(x.ybase++,this.isUserScrolling||x.ydisp++)}else{const T=D-k+1;x.lines.shiftElements(k+1,T-1,-1),x.lines.set(D,b.clone())}this.isUserScrolling||(x.ydisp=x.ybase),this._onScroll.fire(x.ydisp)}scrollLines(y,S,x){const b=this.buffer;if(y<0){if(b.ydisp===0)return;this.isUserScrolling=!0}else y+b.ydisp>=b.ybase&&(this.isUserScrolling=!1);const k=b.ydisp;b.ydisp=Math.max(Math.min(b.ydisp+y,b.ybase),0),k!==b.ydisp&&(S||this._onScroll.fire(b.ydisp))}};o.BufferService=C=f([p(0,w.IOptionsService)],C)},7994:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.CharsetService=void 0,o.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(c){this.glevel=c,this.charset=this._charsets[c]}setgCharset(c,f){this._charsets[c]=f,this.glevel===c&&(this.charset=f)}}},1753:function(u,o,c){var f=this&&this.__decorate||function(b,k,D,T){var R,N=arguments.length,M=N<3?k:T===null?T=Object.getOwnPropertyDescriptor(k,D):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")M=Reflect.decorate(b,k,D,T);else for(var B=b.length-1;B>=0;B--)(R=b[B])&&(M=(N<3?R(M):N>3?R(k,D,M):R(k,D))||M);return N>3&&M&&Object.defineProperty(k,D,M),M},p=this&&this.__param||function(b,k){return function(D,T){k(D,T,b)}};Object.defineProperty(o,"__esModule",{value:!0}),o.CoreMouseService=void 0;const d=c(2585),_=c(8460),v=c(844),w={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 C(b,k){let D=(b.ctrl?16:0)|(b.shift?4:0)|(b.alt?8:0);return b.button===4?(D|=64,D|=b.action):(D|=3&b.button,4&b.button&&(D|=64),8&b.button&&(D|=128),b.action===32?D|=32:b.action!==0||k||(D|=3)),D}const y=String.fromCharCode,S={DEFAULT:b=>{const k=[C(b,!1)+32,b.col+32,b.row+32];return k[0]>255||k[1]>255||k[2]>255?"":`\x1B[M${y(k[0])}${y(k[1])}${y(k[2])}`},SGR:b=>{const k=b.action===0&&b.button!==4?"m":"M";return`\x1B[<${C(b,!0)};${b.col};${b.row}${k}`},SGR_PIXELS:b=>{const k=b.action===0&&b.button!==4?"m":"M";return`\x1B[<${C(b,!0)};${b.x};${b.y}${k}`}};let x=o.CoreMouseService=class extends v.Disposable{constructor(b,k){super(),this._bufferService=b,this._coreService=k,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new _.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const D of Object.keys(w))this.addProtocol(D,w[D]);for(const D of Object.keys(S))this.addEncoding(D,S[D]);this.reset()}addProtocol(b,k){this._protocols[b]=k}addEncoding(b,k){this._encodings[b]=k}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 k=this._encodings[this._activeEncoding](b);return k&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(k):this._coreService.triggerDataEvent(k,!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,k,D){if(D){if(b.x!==k.x||b.y!==k.y)return!1}else if(b.col!==k.col||b.row!==k.row)return!1;return b.button===k.button&&b.action===k.action&&b.ctrl===k.ctrl&&b.alt===k.alt&&b.shift===k.shift}};o.CoreMouseService=x=f([p(0,d.IBufferService),p(1,d.ICoreService)],x)},6975:function(u,o,c){var f=this&&this.__decorate||function(x,b,k,D){var T,R=arguments.length,N=R<3?b:D===null?D=Object.getOwnPropertyDescriptor(b,k):D;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(x,b,k,D);else for(var M=x.length-1;M>=0;M--)(T=x[M])&&(N=(R<3?T(N):R>3?T(b,k,N):T(b,k))||N);return R>3&&N&&Object.defineProperty(b,k,N),N},p=this&&this.__param||function(x,b){return function(k,D){b(k,D,x)}};Object.defineProperty(o,"__esModule",{value:!0}),o.CoreService=void 0;const d=c(1439),_=c(8460),v=c(844),w=c(2585),C=Object.freeze({insertMode:!1}),y=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let S=o.CoreService=class extends v.Disposable{constructor(x,b,k){super(),this._bufferService=x,this._logService=b,this._optionsService=k,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new _.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new _.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new _.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new _.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,d.clone)(C),this.decPrivateModes=(0,d.clone)(y)}reset(){this.modes=(0,d.clone)(C),this.decPrivateModes=(0,d.clone)(y)}triggerDataEvent(x,b=!1){if(this._optionsService.rawOptions.disableStdin)return;const k=this._bufferService.buffer;b&&this._optionsService.rawOptions.scrollOnUserInput&&k.ybase!==k.ydisp&&this._onRequestScrollToBottom.fire(),b&&this._onUserInput.fire(),this._logService.debug(`sending data "${x}"`,(()=>x.split("").map((D=>D.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))}};o.CoreService=S=f([p(0,w.IBufferService),p(1,w.ILogService),p(2,w.IOptionsService)],S)},9074:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.DecorationService=void 0;const f=c(8055),p=c(8460),d=c(844),_=c(6106);let v=0,w=0;class C extends d.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new _.SortedList((x=>x==null?void 0:x.marker.line)),this._onDecorationRegistered=this.register(new p.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new p.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,d.toDisposable)((()=>this.reset())))}registerDecoration(x){if(x.marker.isDisposed)return;const b=new y(x);if(b){const k=b.marker.onDispose((()=>b.dispose()));b.onDispose((()=>{b&&(this._decorations.delete(b)&&this._onDecorationRemoved.fire(b),k.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,k){let D=0,T=0;for(const R of this._decorations.getKeyIterator(b))D=R.options.x??0,T=D+(R.options.width??1),x>=D&&x{v=T.options.x??0,w=v+(T.options.width??1),x>=v&&x{Object.defineProperty(o,"__esModule",{value:!0}),o.InstantiationService=o.ServiceCollection=void 0;const f=c(2585),p=c(8343);class d{constructor(...v){this._entries=new Map;for(const[w,C]of v)this.set(w,C)}set(v,w){const C=this._entries.get(v);return this._entries.set(v,w),C}forEach(v){for(const[w,C]of this._entries.entries())v(w,C)}has(v){return this._entries.has(v)}get(v){return this._entries.get(v)}}o.ServiceCollection=d,o.InstantiationService=class{constructor(){this._services=new d,this._services.set(f.IInstantiationService,this)}setService(_,v){this._services.set(_,v)}getService(_){return this._services.get(_)}createInstance(_,...v){const w=(0,p.getServiceDependencies)(_).sort(((S,x)=>S.index-x.index)),C=[];for(const S of w){const x=this._services.get(S.id);if(!x)throw new Error(`[createInstance] ${_.name} depends on UNKNOWN service ${S.id}.`);C.push(x)}const y=w.length>0?w[0].index:v.length;if(v.length!==y)throw new Error(`[createInstance] First service dependency of ${_.name} at position ${y+1} conflicts with ${v.length} static arguments`);return new _(...v,...C)}}},7866:function(u,o,c){var f=this&&this.__decorate||function(y,S,x,b){var k,D=arguments.length,T=D<3?S:b===null?b=Object.getOwnPropertyDescriptor(S,x):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(y,S,x,b);else for(var R=y.length-1;R>=0;R--)(k=y[R])&&(T=(D<3?k(T):D>3?k(S,x,T):k(S,x))||T);return D>3&&T&&Object.defineProperty(S,x,T),T},p=this&&this.__param||function(y,S){return function(x,b){S(x,b,y)}};Object.defineProperty(o,"__esModule",{value:!0}),o.traceCall=o.setTraceLogger=o.LogService=void 0;const d=c(844),_=c(2585),v={trace:_.LogLevelEnum.TRACE,debug:_.LogLevelEnum.DEBUG,info:_.LogLevelEnum.INFO,warn:_.LogLevelEnum.WARN,error:_.LogLevelEnum.ERROR,off:_.LogLevelEnum.OFF};let w,C=o.LogService=class extends d.Disposable{get logLevel(){return this._logLevel}constructor(y){super(),this._optionsService=y,this._logLevel=_.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),w=this}_updateLogLevel(){this._logLevel=v[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(y){for(let S=0;SJSON.stringify(T))).join(", ")})`);const D=b.apply(this,k);return w.trace(`GlyphRenderer#${b.name} return`,D),D}}},7302:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.OptionsService=o.DEFAULT_OPTIONS=void 0;const f=c(8460),p=c(844),d=c(6114);o.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 _=["normal","bold","100","200","300","400","500","600","700","800","900"];class v extends p.Disposable{constructor(C){super(),this._onOptionChange=this.register(new f.EventEmitter),this.onOptionChange=this._onOptionChange.event;const y={...o.DEFAULT_OPTIONS};for(const S in C)if(S in y)try{const x=C[S];y[S]=this._sanitizeAndValidateOption(S,x)}catch(x){console.error(x)}this.rawOptions=y,this.options={...y},this._setupOptions(),this.register((0,p.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(C,y){return this.onOptionChange((S=>{S===C&&y(this.rawOptions[C])}))}onMultipleOptionChange(C,y){return this.onOptionChange((S=>{C.indexOf(S)!==-1&&y()}))}_setupOptions(){const C=S=>{if(!(S in o.DEFAULT_OPTIONS))throw new Error(`No option with key "${S}"`);return this.rawOptions[S]},y=(S,x)=>{if(!(S in o.DEFAULT_OPTIONS))throw new Error(`No option with key "${S}"`);x=this._sanitizeAndValidateOption(S,x),this.rawOptions[S]!==x&&(this.rawOptions[S]=x,this._onOptionChange.fire(S))};for(const S in this.rawOptions){const x={get:C.bind(this,S),set:y.bind(this,S)};Object.defineProperty(this.options,S,x)}}_sanitizeAndValidateOption(C,y){switch(C){case"cursorStyle":if(y||(y=o.DEFAULT_OPTIONS[C]),!(function(S){return S==="block"||S==="underline"||S==="bar"})(y))throw new Error(`"${y}" is not a valid value for ${C}`);break;case"wordSeparator":y||(y=o.DEFAULT_OPTIONS[C]);break;case"fontWeight":case"fontWeightBold":if(typeof y=="number"&&1<=y&&y<=1e3)break;y=_.includes(y)?y:o.DEFAULT_OPTIONS[C];break;case"cursorWidth":y=Math.floor(y);case"lineHeight":case"tabStopWidth":if(y<1)throw new Error(`${C} cannot be less than 1, value: ${y}`);break;case"minimumContrastRatio":y=Math.max(1,Math.min(21,Math.round(10*y)/10));break;case"scrollback":if((y=Math.min(y,4294967295))<0)throw new Error(`${C} cannot be less than 0, value: ${y}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(y<=0)throw new Error(`${C} cannot be less than or equal to 0, value: ${y}`);break;case"rows":case"cols":if(!y&&y!==0)throw new Error(`${C} must be numeric, value: ${y}`);break;case"windowsPty":y=y??{}}return y}}o.OptionsService=v},2660:function(u,o,c){var f=this&&this.__decorate||function(v,w,C,y){var S,x=arguments.length,b=x<3?w:y===null?y=Object.getOwnPropertyDescriptor(w,C):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(v,w,C,y);else for(var k=v.length-1;k>=0;k--)(S=v[k])&&(b=(x<3?S(b):x>3?S(w,C,b):S(w,C))||b);return x>3&&b&&Object.defineProperty(w,C,b),b},p=this&&this.__param||function(v,w){return function(C,y){w(C,y,v)}};Object.defineProperty(o,"__esModule",{value:!0}),o.OscLinkService=void 0;const d=c(2585);let _=o.OscLinkService=class{constructor(v){this._bufferService=v,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(v){const w=this._bufferService.buffer;if(v.id===void 0){const k=w.addMarker(w.ybase+w.y),D={data:v,id:this._nextId++,lines:[k]};return k.onDispose((()=>this._removeMarkerFromLink(D,k))),this._dataByLinkId.set(D.id,D),D.id}const C=v,y=this._getEntryIdKey(C),S=this._entriesWithId.get(y);if(S)return this.addLineToLink(S.id,w.ybase+w.y),S.id;const x=w.addMarker(w.ybase+w.y),b={id:this._nextId++,key:this._getEntryIdKey(C),data:C,lines:[x]};return x.onDispose((()=>this._removeMarkerFromLink(b,x))),this._entriesWithId.set(b.key,b),this._dataByLinkId.set(b.id,b),b.id}addLineToLink(v,w){const C=this._dataByLinkId.get(v);if(C&&C.lines.every((y=>y.line!==w))){const y=this._bufferService.buffer.addMarker(w);C.lines.push(y),y.onDispose((()=>this._removeMarkerFromLink(C,y)))}}getLinkData(v){var w;return(w=this._dataByLinkId.get(v))==null?void 0:w.data}_getEntryIdKey(v){return`${v.id};;${v.uri}`}_removeMarkerFromLink(v,w){const C=v.lines.indexOf(w);C!==-1&&(v.lines.splice(C,1),v.lines.length===0&&(v.data.id!==void 0&&this._entriesWithId.delete(v.key),this._dataByLinkId.delete(v.id)))}};o.OscLinkService=_=f([p(0,d.IBufferService)],_)},8343:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.createDecorator=o.getServiceDependencies=o.serviceRegistry=void 0;const c="di$target",f="di$dependencies";o.serviceRegistry=new Map,o.getServiceDependencies=function(p){return p[f]||[]},o.createDecorator=function(p){if(o.serviceRegistry.has(p))return o.serviceRegistry.get(p);const d=function(_,v,w){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(C,y,S){y[c]===y?y[f].push({id:C,index:S}):(y[f]=[{id:C,index:S}],y[c]=y)})(d,_,w)};return d.toString=()=>p,o.serviceRegistry.set(p,d),d}},2585:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.IDecorationService=o.IUnicodeService=o.IOscLinkService=o.IOptionsService=o.ILogService=o.LogLevelEnum=o.IInstantiationService=o.ICharsetService=o.ICoreService=o.ICoreMouseService=o.IBufferService=void 0;const f=c(8343);var p;o.IBufferService=(0,f.createDecorator)("BufferService"),o.ICoreMouseService=(0,f.createDecorator)("CoreMouseService"),o.ICoreService=(0,f.createDecorator)("CoreService"),o.ICharsetService=(0,f.createDecorator)("CharsetService"),o.IInstantiationService=(0,f.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"})(p||(o.LogLevelEnum=p={})),o.ILogService=(0,f.createDecorator)("LogService"),o.IOptionsService=(0,f.createDecorator)("OptionsService"),o.IOscLinkService=(0,f.createDecorator)("OscLinkService"),o.IUnicodeService=(0,f.createDecorator)("UnicodeService"),o.IDecorationService=(0,f.createDecorator)("DecorationService")},1480:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.UnicodeService=void 0;const f=c(8460),p=c(225);class d{static extractShouldJoin(v){return(1&v)!=0}static extractWidth(v){return v>>1&3}static extractCharKind(v){return v>>3}static createPropertyValue(v,w,C=!1){return(16777215&v)<<3|(3&w)<<1|(C?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new f.EventEmitter,this.onChange=this._onChange.event;const v=new p.UnicodeV6;this.register(v),this._active=v.version,this._activeProvider=v}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(v){if(!this._providers[v])throw new Error(`unknown Unicode version "${v}"`);this._active=v,this._activeProvider=this._providers[v],this._onChange.fire(v)}register(v){this._providers[v.version]=v}wcwidth(v){return this._activeProvider.wcwidth(v)}getStringCellWidth(v){let w=0,C=0;const y=v.length;for(let S=0;S=y)return w+this.wcwidth(x);const D=v.charCodeAt(S);56320<=D&&D<=57343?x=1024*(x-55296)+D-56320+65536:w+=this.wcwidth(D)}const b=this.charProperties(x,C);let k=d.extractWidth(b);d.extractShouldJoin(b)&&(k-=d.extractWidth(C)),w+=k,C=b}return w}charProperties(v,w){return this._activeProvider.charProperties(v,w)}}o.UnicodeService=d}},r={};function a(u){var o=r[u];if(o!==void 0)return o.exports;var c=r[u]={exports:{}};return n[u].call(c.exports,c,c.exports,a),c.exports}var l={};return(()=>{var u=l;Object.defineProperty(u,"__esModule",{value:!0}),u.Terminal=void 0;const o=a(9042),c=a(3236),f=a(844),p=a(5741),d=a(8285),_=a(7975),v=a(7090),w=["cols","rows"];class C extends f.Disposable{constructor(S){super(),this._core=this.register(new c.Terminal(S)),this._addonManager=this.register(new p.AddonManager),this._publicOptions={...this._core.options};const x=k=>this._core.options[k],b=(k,D)=>{this._checkReadonlyOptions(k),this._core.options[k]=D};for(const k in this._core.options){const D={get:x.bind(this,k),set:b.bind(this,k)};Object.defineProperty(this._publicOptions,k,D)}}_checkReadonlyOptions(S){if(w.includes(S))throw new Error(`Option "${S}" 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 _.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new v.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 S=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:S.applicationCursorKeys,applicationKeypadMode:S.applicationKeypad,bracketedPasteMode:S.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:x,originMode:S.origin,reverseWraparoundMode:S.reverseWraparound,sendFocusMode:S.sendFocus,wraparoundMode:S.wraparound}}get options(){return this._publicOptions}set options(S){for(const x in S)this._publicOptions[x]=S[x]}blur(){this._core.blur()}focus(){this._core.focus()}input(S,x=!0){this._core.input(S,x)}resize(S,x){this._verifyIntegers(S,x),this._core.resize(S,x)}open(S){this._core.open(S)}attachCustomKeyEventHandler(S){this._core.attachCustomKeyEventHandler(S)}attachCustomWheelEventHandler(S){this._core.attachCustomWheelEventHandler(S)}registerLinkProvider(S){return this._core.registerLinkProvider(S)}registerCharacterJoiner(S){return this._checkProposedApi(),this._core.registerCharacterJoiner(S)}deregisterCharacterJoiner(S){this._checkProposedApi(),this._core.deregisterCharacterJoiner(S)}registerMarker(S=0){return this._verifyIntegers(S),this._core.registerMarker(S)}registerDecoration(S){return this._checkProposedApi(),this._verifyPositiveIntegers(S.x??0,S.width??0,S.height??0),this._core.registerDecoration(S)}hasSelection(){return this._core.hasSelection()}select(S,x,b){this._verifyIntegers(S,x,b),this._core.select(S,x,b)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(S,x){this._verifyIntegers(S,x),this._core.selectLines(S,x)}dispose(){super.dispose()}scrollLines(S){this._verifyIntegers(S),this._core.scrollLines(S)}scrollPages(S){this._verifyIntegers(S),this._core.scrollPages(S)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(S){this._verifyIntegers(S),this._core.scrollToLine(S)}clear(){this._core.clear()}write(S,x){this._core.write(S,x)}writeln(S,x){this._core.write(S),this._core.write(`\r -`,x)}paste(S){this._core.paste(S)}refresh(S,x){this._verifyIntegers(S,x),this._core.refresh(S,x)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(S){this._addonManager.loadAddon(this,S)}static get strings(){return o}_verifyIntegers(...S){for(const x of S)if(x===1/0||isNaN(x)||x%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...S){for(const x of S)if(x&&(x===1/0||isNaN(x)||x%1!=0||x<0))throw new Error("This API only accepts positive integers")}}u.Terminal=C})(),l})()))})(pp)),pp.exports}var X8=W8();function Sb(e){const t=atob(e),n=new Uint8Array(t.length);for(let r=0;r{const n=t.current;if(!n)return;const r=new X8.Terminal({convertEol:!0,disableStdin:!0,fontSize:12,fontFamily:'ui-monospace, "SF Mono", Menlo, Consolas, monospace',scrollback:2e4,theme:{background:"#1a1a1a",foreground:"#e6e1e0",cursor:"#1a1a1a",selectionBackground:"#2c3441"}}),a=new Y8.FitAddon;r.loadAddon(a),r.open(n);try{a.fit()}catch{}const l=new ResizeObserver(()=>{try{a.fit()}catch{}});l.observe(n);let u=!1,o=0,c=!1,f=!1;async function p(){if(c){f=!0;return}c=!0;try{for(;;){const _=await DT(e,o);if(u)return;if(_.dataBase64&&r.write(Sb(_.dataBase64)),o=_.nextOffset,_.eof)break}}catch{}finally{c=!1,f&&!u&&(f=!1,p())}}const d=mN(e,_=>{if(u)return;const v=Sb(_.dataBase64);!c&&_.offset===o?(r.write(v),o+=v.length):_.offset+v.length>o&&p()});return p(),()=>{u=!0,d(),l.disconnect(),r.dispose()}},[e]),m.jsx("div",{ref:t,style:{width:"100%",height:"100%"}})}const Ws="__uncommitted__";function Z8({state:e}){return!e||e.loading?m.jsx("div",{className:"changes-note",children:"Loading diff…"}):e.error?m.jsx("div",{className:"error",children:e.error}):e.payload?e.payload.truncated?m.jsx(G8,{bytesRead:e.payload.bytesRead,byteLimit:e.payload.byteLimit}):m.jsx(aC,{diff:e.payload.diff}):m.jsx("div",{className:"diff-empty",children:"No changes."})}function Q8({experiment:e,project:t,view:n,runs:r,selectedRunId:a,onSelectRun:l}){const u=r.filter(o=>o.experimentId===e.id).sort((o,c)=>c.createdAt-o.createdAt);return n==="terminal"?m.jsx(J8,{experiment:e,expRuns:u,selectedRunId:a,onSelectRun:l}):m.jsx(eB,{experiment:e,project:t})}function J8({experiment:e,expRuns:t,selectedRunId:n,onSelectRun:r}){const[a,l]=V.useState(null),[u,o]=V.useState(!1),c=V.useRef(null),f=n&&t.find(w=>w.id===n)||t[0]||null,p=(f==null?void 0:f.status)==="running"||(f==null?void 0:f.status)==="starting",d=w=>{const C=t.findIndex(y=>y.id===w);return C===-1?t.length:t.length-C},_=V.useRef(null);V.useEffect(()=>{if(_.current===null){_.current=new Set(t.map(C=>C.id));return}const w=t.find(C=>!_.current.has(C.id));for(const C of t)_.current.add(C.id);w&&r(w.id)},[t,r]),V.useEffect(()=>{if(!u)return;const w=C=>{var y;(y=c.current)!=null&&y.contains(C.target)||o(!1)};return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[u]);async function v(){if(f){l(null);try{await GS(f.id)}catch(w){l(w instanceof Error?w.message:String(w))}}}return m.jsxs("div",{className:"term-view",children:[m.jsxs("div",{className:"term-bar",children:[m.jsx("div",{className:"term-title",title:e.title||e.slug,children:e.title||e.slug}),m.jsx("span",{style:{flex:1}}),a&&m.jsx("span",{className:"error",children:a}),p&&m.jsxs("button",{className:"btn sm ghost",onClick:()=>void v(),children:[m.jsx(AA,{size:13}),"Stop"]}),t.length>0&&f&&m.jsxs("div",{className:"run-history",ref:c,children:[m.jsxs("button",{className:"run-picker",title:"Switch run",onClick:()=>o(w=>!w),children:[m.jsxs("span",{className:"run-label",children:["Run ",d(f.id)]}),m.jsx(Po,{status:f.status}),m.jsx(ga,{size:14,className:"run-picker-chev"})]}),u&&m.jsx("div",{className:"history-menu",children:t.map(w=>m.jsxs("button",{className:`history-item ${w.id===(f==null?void 0:f.id)?"active":""}`,onClick:()=>{r(w.id),o(!1)},children:[m.jsxs("span",{className:"run-label",children:["Run ",d(w.id)]}),m.jsx(Po,{status:w.status}),m.jsx("span",{className:"when",children:ma(w.createdAt)})]},w.id))})]})]}),m.jsx("div",{className:"term-fill",children:f?m.jsx(K8,{runId:f.id},f.id):m.jsx("div",{className:"term-empty",children:"No runs yet — ask the agent to launch one."})})]})}function eB({experiment:e,project:t}){const[n,r]=V.useState(null),[a,l]=V.useState(null),[u,o]=V.useState(null),[c,f]=V.useState(null),[p,d]=V.useState({}),_=!!(u&&u.diff.trim()!==""&&u.experimentId===e.id);async function v(){l(null);try{const[C,y]=await Promise.all([RT(e.id),By(e.projectId)]);r(C),o(y),f(S=>{var b;return S!==null?S:y.diff.trim()!==""&&y.experimentId===e.id?Ws:((b=C[0])==null?void 0:b.sha)??null})}catch(C){l(C instanceof Error?C.message:String(C))}}V.useEffect(()=>{n===null&&!a&&v()},[n,a,e.id]),V.useEffect(()=>{const C=setInterval(()=>{By(e.projectId).then(o).catch(()=>{})},5e3);return()=>clearInterval(C)},[e.projectId]),V.useEffect(()=>{var C;c===Ws&&u&&!_&&f(((C=n==null?void 0:n[0])==null?void 0:C.sha)??null)},[c,u,_,n]),V.useEffect(()=>{if(!c||c===Ws||p[c])return;const C=c;d(y=>({...y,[C]:{loading:!0}})),MT(e.id,C).then(y=>d(S=>({...S,[C]:{loading:!1,payload:y}}))).catch(y=>d(S=>({...S,[C]:{loading:!1,error:y instanceof Error?y.message:String(y)}})))},[c,p,e.id]);const w=!_&&((n==null?void 0:n.length)??0)===0;return m.jsx("div",{className:"drawer",children:m.jsx("div",{className:"drawer-body",children:m.jsxs("div",{className:"drawer-section",children:[m.jsx("div",{className:"changes-branch",children:m.jsx(TO,{owner:t.githubOwner,repo:t.githubRepo,branch:e.branchName})}),a?m.jsx("div",{className:"error",children:a}):n===null?m.jsx("div",{className:"changes-note",children:"Loading changes…"}):w?m.jsx("div",{className:"changes-note",children:"No changes yet — the agent hasn't committed on this branch."}):m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"commit-picker",children:[c===Ws&&m.jsx("span",{className:"uncommitted-dot"}),m.jsxs("select",{className:"input sm",value:c??"",onChange:C=>f(C.target.value),children:[_&&m.jsx("option",{value:Ws,children:"● Uncommitted changes"}),n.map(C=>m.jsxs("option",{value:C.sha,children:[C.sha.slice(0,7)," — ",C.subject]},C.sha))]}),m.jsx("button",{className:"icon-btn",title:"Refresh","aria-label":"Refresh",onClick:()=>void v(),children:m.jsx(xg,{size:14})})]}),m.jsx("div",{style:{marginTop:10},children:c===Ws&&u?u.truncated?m.jsxs("div",{className:"truncated-notice",children:[m.jsx("h4",{children:"Diff too large to display"}),m.jsx("p",{children:"The uncommitted diff is too large to display. View it locally with git."})]}):m.jsx(aC,{diff:u.diff}):c?m.jsx(Z8,{state:p[c]}):m.jsx("div",{className:"changes-note",children:"Select a commit to view its diff."})})]})]})})})}function tB(e,t){return dw(e,aw(t))}function nB({projectId:e,path:t,sessionId:n,gitRef:r,onOpenFile:a}){const[l,u]=V.useState(null),[o,c]=V.useState(null),[f,p]=V.useState(!0),[d,_]=V.useState(0),v=/\.(md|mdx|markdown)$/i.test(t),[w,C]=V.useState(!1);V.useEffect(()=>{let x=!1;return p(!0),LT(e,t,{sessionId:n,ref:r}).then(b=>{x||(u(b),c(null))}).catch(b=>{x||c(b.message)}).finally(()=>{x||p(!1)}),()=>{x=!0}},[e,t,n,r,d]);const y=V.useMemo(()=>l&&!l.notFound?tB(l.content,t):null,[l,t]),S=x=>r?`File not found on branch ${r}.`:n&&x.root==="clone"?"This session's worktree isn't available, and the file isn't in the project clone.":`File not found in the ${x.root==="worktree"?"session's worktree":"project clone"}.`;return m.jsxs("div",{className:"file-view",children:[m.jsxs("div",{className:"file-view-header",children:[m.jsx(UA,{size:13,style:{flexShrink:0}}),m.jsx("code",{className:"file-view-path",title:t,children:t}),r&&m.jsx("code",{className:"file-view-ref",title:`Committed state of ${r}`,children:r}),v&&m.jsx("button",{className:`icon-btn ${w?"active":""}`,title:w?"Rendered view":"Source view","aria-label":w?"Rendered view":"Source view",onClick:()=>C(x=>!x),children:m.jsx(RA,{size:13})}),m.jsx("button",{className:"icon-btn",title:"Reload file","aria-label":"Reload file",onClick:()=>_(x=>x+1),children:f?m.jsx("span",{className:"spinner"}):m.jsx(xg,{size:13})})]}),m.jsx("div",{className:"file-view-body",children:o?m.jsxs("div",{className:"file-view-note",children:["Failed to load file: ",o]}):l===null?m.jsx("div",{className:"file-view-note",children:"Loading…"}):l.notFound?m.jsx("div",{className:"file-view-note",children:S(l)}):m.jsxs(m.Fragment,{children:[!r&&n&&l.root==="clone"&&m.jsx("div",{className:"file-view-note",children:"This session's worktree isn't available — showing the project clone's copy."}),v&&!w?m.jsx("div",{className:"file-view-md",children:m.jsx(eh,{text:l.content,onOpenFile:a&&(x=>a(x,n,r))})}):m.jsx("pre",{className:"file-view-code",children:m.jsx("code",{children:y})}),l.truncated&&m.jsx("div",{className:"file-view-note",children:"File truncated — showing the first 512 KB."})]})})]})}function iB({projectName:e,onHome:t,onCollapse:n}){return m.jsxs("div",{className:"rail-brand",children:[m.jsxs("button",{className:"brand",onClick:t,title:"All projects",children:[m.jsx(To,{size:15}),m.jsx("span",{className:"brand-project",children:e})]}),n&&m.jsx("button",{className:"icon-btn",title:"Hide sidebar","aria-label":"Hide sidebar",onClick:n,children:m.jsx(FS,{size:15})})]})}function rB({onDone:e}){const[t,n]=V.useState(0),[r,a]=V.useState(null),[l,u]=V.useState(null),[o,c]=V.useState(null),[f,p]=V.useState(null),[d,_]=V.useState(!1),v=C=>{_(!0),Promise.allSettled([Cg(C).then(a),WS().then(u),YS().then(c),nN().then(p)]).finally(()=>_(!1))};V.useEffect(()=>v(!1),[]);const w=()=>{rN((f==null?void 0:f.enabled)??!0).catch(()=>{}),e()};return m.jsx("div",{className:"home onboarding",children:m.jsx("div",{className:"home-inner",children:t===0?m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"onb-eyebrow",children:["Open",m.jsx("span",{children:"Research"})," · step 1 of 4"]}),m.jsx("h2",{className:"onb-title",children:"Your coding agents"}),m.jsx("p",{className:"onb-sub",children:"orx found the agent CLIs on this machine and drives them directly — chat and autoresearch run on your own logins, no extra API keys."}),m.jsx("div",{className:"onb-cards",children:r===null?m.jsxs("div",{className:"onb-loading",children:[m.jsx("span",{className:"spinner"})," Detecting Claude Code, Codex, OpenCode…"]}):r.map(C=>m.jsx(aB,{h:C},C.id))}),m.jsxs("div",{className:"onb-actions",children:[m.jsxs("button",{className:"btn ghost",onClick:()=>v(!0),disabled:d,children:[m.jsx(bu,{size:12,className:d?"spin":""})," Re-check"]}),m.jsx("div",{style:{flex:1}}),m.jsxs("button",{className:"btn primary",onClick:()=>n(1),children:["Continue ",m.jsx(Bc,{size:13})]})]})]}):t===1?m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"onb-eyebrow",children:["Open",m.jsx("span",{children:"Research"})," · step 2 of 4"]}),m.jsx("h2",{className:"onb-title",children:"Git & GitHub"}),m.jsx("p",{className:"onb-sub",children:"A project is a clone of one of your GitHub repos, made with your own git credentials. Every experiment becomes a branch pushed to that repo — compute jobs clone it from there."}),m.jsx("div",{className:"onb-cards",children:m.jsx(oB,{git:l,onUpdate:u})}),m.jsxs("div",{className:"onb-actions",children:[m.jsxs("button",{className:"btn ghost",onClick:()=>n(0),children:[m.jsx(To,{size:12})," Back"]}),m.jsxs("button",{className:"btn ghost",onClick:()=>v(!1),disabled:d,children:[m.jsx(bu,{size:12,className:d?"spin":""})," Re-check"]}),m.jsx("div",{style:{flex:1}}),m.jsxs("button",{className:"btn primary",onClick:()=>n(2),children:["Continue ",m.jsx(Bc,{size:13})]})]})]}):t===2?m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"onb-eyebrow",children:["Open",m.jsx("span",{children:"Research"})," · step 3 of 4"]}),m.jsx("h2",{className:"onb-title",children:"Where orx keeps your data"}),m.jsx("p",{className:"onb-sub",children:"Your local database, run logs, artifacts, and chat attachments live in one folder on this machine. The default works for most people — change it if you'd rather keep it on another disk."}),m.jsx("div",{className:"onb-cards",children:m.jsx(lB,{dataDir:o,onUpdate:c})}),m.jsxs("div",{className:"onb-actions",children:[m.jsxs("button",{className:"btn ghost",onClick:()=>n(1),children:[m.jsx(To,{size:12})," Back"]}),m.jsx("div",{style:{flex:1}}),m.jsxs("button",{className:"btn primary",onClick:()=>n(3),children:["Continue ",m.jsx(Bc,{size:13})]})]})]}):m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"onb-eyebrow",children:["Open",m.jsx("span",{children:"Research"})," · step 4 of 4"]}),m.jsx("h2",{className:"onb-title",children:"Usage analytics"}),m.jsx("p",{className:"onb-sub",children:"orx can send anonymous usage analytics to help improve the tool. No code, prompts, file contents, or identifiers are ever sent — just a random per-install id, the command run, and your OS."}),m.jsx("div",{className:"onb-cards",children:m.jsx(cB,{telemetry:f,onUpdate:p})}),m.jsxs("div",{className:"onb-actions",children:[m.jsxs("button",{className:"btn ghost",onClick:()=>n(2),children:[m.jsx(To,{size:12})," Back"]}),m.jsx("div",{style:{flex:1}}),m.jsxs("button",{className:"btn primary",onClick:w,children:["Create your first project ",m.jsx(Bc,{size:13})]})]})]})})})}function sB(e){return e.agentReady?{cls:"st-done",label:"connected"}:e.installed?{cls:"st-starting",label:"not signed in"}:{cls:"st-idle",label:"not detected"}}function aB({h:e}){var r,a;const t=sB(e),n=(r=e.version)==null?void 0:r.replace(/\s*\(.*\)$/,"");return m.jsxs("div",{className:"onb-card",children:[m.jsxs("div",{className:"onb-card-head",children:[m.jsx("span",{className:"onb-card-name",children:e.name}),m.jsxs("span",{className:`status-badge ${t.cls}`,children:[e.agentReady?m.jsx(_n,{size:12,strokeWidth:3}):m.jsx("span",{className:"dot"}),t.label]})]}),e.agentReady?m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"onb-card-detail mono",children:[e.account??"API key",e.plan?` · ${e.plan}`:""]}),m.jsx("div",{className:"onb-card-meta",children:[n,e.models.length>0&&`${e.models.length} model${e.models.length===1?"":"s"} — ${e.models.slice(0,3).map(l=>Su(l.id)).join(", ")}${e.models.length>3?", …":""}`].filter(Boolean).join(" · ")})]}):m.jsx("div",{className:"onb-card-meta",children:(a=e.agentNote)==null?void 0:a.replace(/`/g,"")})]})}function oB({git:e,onUpdate:t}){const[n,r]=V.useState(!1),a=()=>{navigator.clipboard.writeText("gh auth login").then(()=>{r(!0),setTimeout(()=>r(!1),1500)})};if(e===null)return m.jsxs("div",{className:"onb-loading",children:[m.jsx("span",{className:"spinner"})," Checking git…"]});if(!e.gitVersion)return m.jsxs("div",{className:"onb-card",children:[m.jsxs("div",{className:"onb-card-head",children:[m.jsx("span",{className:"onb-card-name",children:"git"}),m.jsxs("span",{className:"status-badge st-failed",children:[m.jsx("span",{className:"dot"})," not found"]})]}),m.jsx("div",{className:"onb-card-meta",children:"Install git to clone projects, then re-open orx."})]});const l=[e.userName,e.userEmail&&`<${e.userEmail}>`].filter(Boolean).join(" ");return m.jsxs("div",{className:"onb-card",children:[m.jsxs("div",{className:"onb-card-row",children:[m.jsx("span",{className:"onb-card-name",children:"git"}),m.jsxs("span",{className:"onb-card-detail mono",children:[e.gitVersion.replace(/^git version /,""),l?` · ${l}`:""]}),m.jsxs("span",{className:`status-badge ${l?"st-done":"st-starting"}`,children:[l?m.jsx(_n,{size:12,strokeWidth:3}):m.jsx("span",{className:"dot"}),l?"ready":"no identity"]})]}),m.jsxs("div",{className:"onb-card-row",children:[m.jsx("span",{className:"onb-card-name",children:"GitHub"}),m.jsx("span",{className:"onb-card-detail mono",children:e.githubTokenSource==="env"?"token from GITHUB_TOKEN":e.githubTokenSource==="stored"?"token saved in orx":e.githubTokenSource==="gh"?"signed in via gh CLI":"not connected"}),m.jsxs("span",{className:`status-badge ${e.githubTokenSource?"st-done":"st-starting"}`,children:[e.githubTokenSource?m.jsx(_n,{size:12,strokeWidth:3}):m.jsx("span",{className:"dot"}),e.githubTokenSource?"ready":"check"]})]}),!l&&m.jsxs("div",{className:"onb-card-meta",children:["Set ",m.jsx("code",{children:"git config --global user.name / user.email"})," so the agent can commit."]}),!e.githubTokenSource&&m.jsxs("div",{className:"onb-gh-options",children:[m.jsx("div",{className:"onb-card-meta",children:"GitHub access is used to clone your repos and push experiment branches. Connect either way:"}),m.jsxs("div",{className:"onb-gh-option",children:[m.jsx("span",{className:"onb-gh-option-label",children:"GitHub CLI"}),m.jsx("div",{className:"onb-gh-option-body",children:e.ghInstalled?m.jsxs(m.Fragment,{children:[m.jsx("code",{className:"onb-gh-cmd",children:"gh auth login"}),m.jsxs("button",{className:"btn ghost",onClick:a,children:[n?m.jsx(_n,{size:12,strokeWidth:3}):m.jsx(bg,{size:12}),n?"Copied":"Copy"]}),m.jsx("span",{className:"onb-gh-hint",children:"run in a terminal, then Re-check"})]}):m.jsxs("span",{className:"onb-gh-hint",children:["install the GitHub CLI, run ",m.jsx("code",{children:"gh auth login"}),", then Re-check"]})})]}),m.jsx("div",{className:"onb-gh-or",children:"or"}),m.jsxs("div",{className:"onb-gh-option",children:[m.jsx("span",{className:"onb-gh-option-label",children:"Paste a token"}),m.jsx(mw,{onSaved:t})]})]})]})}function lB({dataDir:e,onUpdate:t}){const[n,r]=V.useState(""),[a,l]=V.useState(!1),[u,o]=V.useState(!1),[c,f]=V.useState(null);if(V.useEffect(()=>{e&&!n&&r(e.current)},[e,n]),e===null)return m.jsxs("div",{className:"onb-loading",children:[m.jsx("span",{className:"spinner"})," Checking storage…"]});if(e.source==="env")return m.jsxs("div",{className:"onb-card",children:[m.jsxs("div",{className:"onb-card-row",children:[m.jsx("span",{className:"onb-card-name",children:"Data folder"}),m.jsx("span",{className:"onb-card-detail mono",children:e.current}),m.jsxs("span",{className:"status-badge st-done",children:[m.jsx(_n,{size:12,strokeWidth:3})," pinned"]})]}),m.jsxs("div",{className:"onb-card-meta",children:["Set by the ",m.jsx("code",{children:"ORX_DATA_DIR"})," environment variable."]})]});const p=n.trim(),d=p!==""&&p!==e.current;async function _(){if(!(u||!d)){o(!0),f(null);try{t(await GT(p)),l(!1)}catch(v){f(v instanceof Error?v.message:String(v))}finally{o(!1)}}}return m.jsxs("div",{className:"onb-card",children:[m.jsxs("div",{className:"onb-card-row",children:[m.jsx("span",{className:"onb-card-name",children:"Data folder"}),m.jsx("span",{className:"onb-card-detail mono",children:e.current}),m.jsxs("span",{className:`status-badge ${e.isDefault?"st-idle":"st-done"}`,children:[e.isDefault?m.jsx("span",{className:"dot"}):m.jsx(_n,{size:12,strokeWidth:3}),e.isDefault?"default":"custom"]})]}),a?m.jsxs(m.Fragment,{children:[m.jsx("input",{className:"mono",type:"text",value:n,onChange:v=>r(v.target.value),placeholder:"/absolute/path/to/openresearch",autoComplete:"off",spellCheck:!1,style:{width:"100%",marginTop:10}}),c&&m.jsx("div",{className:"error",style:{marginTop:8},children:c}),m.jsxs("div",{style:{display:"flex",gap:6,marginTop:10},children:[m.jsx("button",{className:"btn primary",onClick:_,disabled:u||!d,children:u?"Saving…":"Use this folder"}),m.jsx("button",{className:"btn ghost",onClick:()=>{l(!1),r(e.current),f(null)},disabled:u,children:"Cancel"})]})]}):m.jsxs("div",{className:"onb-card-meta",style:{display:"flex",gap:10,alignItems:"center"},children:["The default is fine for most setups.",m.jsx("button",{className:"btn ghost",onClick:()=>l(!0),children:"Change…"})]})]})}function cB({telemetry:e,onUpdate:t}){const[n,r]=V.useState(!1);if(e===null)return m.jsxs("div",{className:"onb-loading",children:[m.jsx("span",{className:"spinner"})," Checking analytics…"]});const a=e.enabled,l=!a&&e.reason!==null&&e.reason!=="disabled via `orx telemetry off`",u=o=>{n||o===a||(r(!0),iN(o).then(t).finally(()=>r(!1)))};return m.jsxs("div",{className:"onb-card",children:[m.jsxs("div",{className:"onb-card-head",children:[m.jsxs("div",{children:[m.jsx("div",{className:"onb-card-name",children:"Share anonymous usage analytics"}),m.jsx("div",{className:"onb-card-meta",style:{marginTop:2},children:a?"On — helps prioritize what to build next.":l?`Off — ${e.reason}.`:"Off — you can turn it back on anytime."})]}),m.jsxs("div",{style:{display:"flex",gap:6,flex:"none"},children:[m.jsxs("button",{className:`btn ${a?"primary":"ghost"}`,onClick:()=>u(!0),disabled:n,"aria-pressed":a,children:[a?m.jsx(_n,{size:12,strokeWidth:3}):null," On"]}),m.jsxs("button",{className:`btn ${a?"ghost":"primary"}`,onClick:()=>u(!1),disabled:n,"aria-pressed":!a,children:[a?null:m.jsx(_n,{size:12,strokeWidth:3})," Off"]})]})]}),m.jsxs("div",{className:"onb-card-meta",style:{marginTop:12},children:["Sent: a random per-install id, the command run, CLI version, and OS. Never sent: code, prompts, file contents, paths, or repo names. Change anytime in Settings or with"," ",m.jsx("code",{children:"orx telemetry off"}),"."]}),l&&m.jsxs("div",{className:"onb-card-meta",style:{marginTop:8},children:["Note: this run is off because of ",e.reason,", which overrides the saved choice."]})]})}function Xc(e){const t=e.trim().replace(/^git@github\.com:/i,"").replace(/^https?:\/\/(www\.)?github\.com\//i,"").replace(/\.git$/i,"").replace(/^\/+|\/+$/g,""),[n,r]=t.split("/");return!n||!r||/[\s:@]/.test(n)||/[\s:@]/.test(r)?null:{owner:n,repo:r}}function xb(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,48).replace(/-+$/,"")||"experiment"}function uB(e){const r=(e.trim().split(/[?#]/)[0].split("/").filter(Boolean).pop()??"").replace(/\.(pdf|md)$/i,"");return/^\d{4}\.\d{4,5}(v\d+)?$/.test(r)?r:null}function hB(e){return e.replace(/^\[[^\]]*\]\s*/,"").replace(/\s*[-–|]\s*arXiv\s*$/i,"")}function fB({onCreated:e,onCancel:t}){var U;const[n,r]=V.useState("paper"),[a,l]=V.useState("use"),[u,o]=V.useState(""),[c,f]=V.useState(""),[p,d]=V.useState(!1),[_,v]=V.useState("main"),[w,C]=V.useState(!1),[y,S]=V.useState(null),[x,b]=V.useState(""),[k,D]=V.useState([]),[T,R]=V.useState(!1),[N,M]=V.useState(null),[B,H]=V.useState(!1),[Y,F]=V.useState(null),z=V.useRef(0),q=Xc(u),G=!!(c.trim()&&(n==="new"||n==="existing"&&q!==null||n==="paper"&&N!==null&&(u.trim()===""||q!==null))),X=Q=>{var re;o(Q),p||f(((re=Xc(Q))==null?void 0:re.repo)??"")};async function K(Q){const re=++z.current;D([]),R(!1),H(!0),F(null);try{const ae=await CT(Q);if(re!==z.current)return;M(ae);const Z=ae.repoUrl?Xc(ae.repoUrl):null;o(Z?`${Z.owner}/${Z.repo}`:""),l("fork"),p||f((Z==null?void 0:Z.repo)??(ae.title??"").trim().slice(0,60))}catch(ae){if(re!==z.current)return;F(ae instanceof Error?ae.message:String(ae))}finally{re===z.current&&H(!1)}}function O(){z.current++,M(null),b(""),D([]),F(null),o(""),p||f("")}V.useEffect(()=>{if(n!=="paper"||N)return;const Q=x.trim(),re=uB(Q);if(!re&&Q.length<3){D([]),R(!1);return}const ae=++z.current;re||R(!0);const Z=setTimeout(()=>{if(re){K(re);return}wT(Q).then(P=>{ae===z.current&&D(P)}).catch(P=>{ae===z.current&&(D([]),F(P instanceof Error?P.message:String(P)))}).finally(()=>{ae===z.current&&R(!1)})},350);return()=>clearTimeout(Z)},[n,N,x]);async function L(Q){if(Q.preventDefault(),!(!G||w)){C(!0),S(null);try{const re=await xT(n==="new"?{name:c.trim(),createRepo:!0}:n==="paper"&&!q?{name:c.trim(),createRepo:!0,paperId:N.paperId}:{name:c.trim(),githubOwner:q.owner,githubRepo:q.repo,baselineBranch:_.trim()||"main",forkRepo:a==="fork",...n==="paper"?{paperId:N.paperId}:{}});e(re)}catch(re){S(re instanceof Error?re.message:String(re))}finally{C(!1)}}}const j=n==="new"||n==="paper"&&!q,$=m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"seg form-seg",children:[m.jsx("button",{type:"button",className:a==="use"?"active":"",onClick:()=>l("use"),children:"Use this repo"}),m.jsx("button",{type:"button",className:a==="fork"?"active":"",onClick:()=>l("fork"),children:"Fork a copy"})]}),m.jsx("span",{className:"repo-hint",children:a==="fork"?`snapshots ${q?`${q.owner}/${q.repo}`:"the repo"} into a private repo on your account`:"experiments push branches here — if you can't push to it, a fork is made automatically"}),m.jsxs("div",{className:"row2",children:[m.jsxs("label",{children:["Project name",m.jsx("input",{value:c,onChange:Q=>{d(!0),f(Q.target.value)},placeholder:"my-research"})]}),m.jsxs("label",{children:["Branch",m.jsx("input",{value:_,onChange:Q=>v(Q.target.value),placeholder:"main"})]})]})]});return m.jsxs("form",{className:"form",onSubmit:L,children:[m.jsxs("div",{className:"seg form-seg",children:[m.jsx("button",{type:"button",className:n==="paper"?"active":"",onClick:()=>r("paper"),children:"From a paper"}),m.jsx("button",{type:"button",className:n==="existing"?"active":"",onClick:()=>r("existing"),children:"Existing repo"}),m.jsx("button",{type:"button",className:n==="new"?"active":"",onClick:()=>r("new"),children:"New blank repo"})]}),n==="existing"&&m.jsxs(m.Fragment,{children:[m.jsxs("label",{children:["GitHub repository",m.jsx("input",{value:u,onChange:Q=>X(Q.target.value),placeholder:"https://github.com/karpathy/nanoGPT",autoFocus:!0,spellCheck:!1}),m.jsx("span",{className:`repo-hint mono ${q?"ok":""}`,children:q?`${q.owner} / ${q.repo}`:u.trim()?"paste a GitHub URL or owner/repo":"URL or owner/repo — cloned with your git credentials"})]}),$]}),n==="paper"&&(N===null?m.jsxs(m.Fragment,{children:[m.jsxs("label",{children:["Paper",m.jsx("input",{value:x,onChange:Q=>b(Q.target.value),placeholder:"arXiv id, URL, or title — e.g. 1706.03762",autoFocus:!0,spellCheck:!1}),m.jsx("span",{className:`repo-hint ${Y?"":"mono"}`,children:B?"looking up paper…":T?"searching alphaXiv…":Y??"searches alphaXiv by title — or paste an arXiv id / URL"})]}),k.length>0&&m.jsx("div",{className:"paper-results",children:k.map(Q=>m.jsxs("button",{type:"button",onClick:()=>void K(Q.paperId),children:[m.jsx("span",{className:"title",children:hB(Q.title)}),m.jsx("span",{className:"id",children:Q.paperId})]},Q.paperId))})]}):m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"paper-pick",children:[m.jsxs("div",{className:"meta",children:[m.jsx("div",{className:"title",children:N.title||N.paperId}),m.jsxs("div",{className:"id",children:["arXiv ",N.paperId]})]}),m.jsx("button",{type:"button",className:"btn ghost",onClick:O,children:"Change"})]}),m.jsxs("label",{children:["GitHub repository",N.repoUrl?"":" (optional)",m.jsx("input",{value:u,onChange:Q=>X(Q.target.value),placeholder:"owner/repo — leave blank for a new private repo",spellCheck:!1}),m.jsx("span",{className:`repo-hint mono ${q?"ok":""}`,children:q?`${q.owner} / ${q.repo}`+(N.repoUrl&&((U=Xc(N.repoUrl))==null?void 0:U.repo)===q.repo?` · linked on alphaXiv${N.repoStars!=null?` · ★ ${N.repoStars}`:""}`:""):u.trim()?"paste a GitHub URL or owner/repo":"no code linked to this paper — a blank private repo will be created"})]}),q?$:m.jsxs("label",{children:["Project name",m.jsx("input",{value:c,onChange:Q=>{d(!0),f(Q.target.value)},placeholder:"my-research"}),m.jsx("span",{className:`repo-hint mono ${c.trim()?"ok":""}`,children:c.trim()?`creates github.com/you/${xb(c)} · private`:"a blank private repo is created on your GitHub account"})]})]})),n==="new"&&m.jsxs("label",{children:["Project name",m.jsx("input",{value:c,onChange:Q=>{d(!0),f(Q.target.value)},placeholder:"my-research",autoFocus:!0}),m.jsx("span",{className:`repo-hint mono ${c.trim()?"ok":""}`,children:c.trim()?`creates github.com/you/${xb(c)} · private`:"a blank private repo is created on your GitHub account"})]}),y&&m.jsx("div",{className:"error",children:y}),m.jsxs("div",{className:"actions",children:[t&&m.jsx("button",{type:"button",className:"btn ghost",onClick:t,children:"Cancel"}),m.jsx("button",{type:"submit",className:"btn primary",disabled:!G||w,children:w?j?"Creating repo…":a==="fork"?"Forking repo…":"Cloning repo…":"Create project"})]})]})}function wb({projects:e,onOpen:t,onCreated:n,onDeleted:r}){const[a,l]=V.useState(!1),[u,o]=V.useState(null);async function c(f){if(window.confirm(`Delete project "${f.name}"? +`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(N){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),S.isLinux&&N&&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(N){const M=this._getMouseBufferCoords(N),B=this._model.finalSelectionStart,H=this._model.finalSelectionEnd;return!!(B&&H&&M)&&this._areCoordsInSelection(M,B,H)}isCellInSelection(N,M){const B=this._model.finalSelectionStart,H=this._model.finalSelectionEnd;return!(!B||!H)&&this._areCoordsInSelection([N,M],B,H)}_areCoordsInSelection(N,M,B){return N[1]>M[1]&&N[1]=M[0]&&N[0]=M[0]}_selectWordAtCursor(N,M){var Y,F;const B=(F=(Y=this._linkifier.currentLink)==null?void 0:Y.link)==null?void 0:F.range;if(B)return this._model.selectionStart=[B.start.x-1,B.start.y-1],this._model.selectionStartLength=(0,x.getRangeLength)(B,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const H=this._getMouseBufferCoords(N);return!!H&&(this._selectWordAt(H,M),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(N,M){this._model.clearSelection(),N=Math.max(N,0),M=Math.min(M,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,N],this._model.selectionEnd=[this._bufferService.cols,M],this.refresh(),this._onSelectionChange.fire()}_handleTrim(N){this._model.handleTrim(N)&&this.refresh()}_getMouseBufferCoords(N){const M=this._mouseService.getCoords(N,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(M)return M[0]--,M[1]--,M[1]+=this._bufferService.buffer.ydisp,M}_getMouseEventScrollAmount(N){let M=(0,d.getCoordsRelativeToElement)(this._coreBrowserService.window,N,this._screenElement)[1];const B=this._renderService.dimensions.css.canvas.height;return M>=0&&M<=B?0:(M>B&&(M-=B),M=Math.min(Math.max(M,-50),50),M/=50,M/Math.abs(M)+Math.round(14*M))}shouldForceSelection(N){return S.isMac?N.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:N.shiftKey}handleMouseDown(N){if(this._mouseDownTimeStamp=N.timeStamp,(N.button!==2||!this.hasSelection)&&N.button===0){if(!this._enabled){if(!this.shouldForceSelection(N))return;N.stopPropagation()}N.preventDefault(),this._dragScrollAmount=0,this._enabled&&N.shiftKey?this._handleIncrementalClick(N):N.detail===1?this._handleSingleClick(N):N.detail===2?this._handleDoubleClick(N):N.detail===3&&this._handleTripleClick(N),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(N){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(N))}_handleSingleClick(N){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(N)?3:0,this._model.selectionStart=this._getMouseBufferCoords(N),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const M=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);M&&M.length!==this._model.selectionStart[0]&&M.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(N){this._selectWordAtCursor(N,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(N){const M=this._getMouseBufferCoords(N);M&&(this._activeSelectionMode=2,this._selectLineAt(M[1]))}shouldColumnSelect(N){return N.altKey&&!(S.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(N){if(N.stopImmediatePropagation(),!this._model.selectionStart)return;const M=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(N),!this._model.selectionEnd)return void this.refresh(!0);this._activeSelectionMode===2?this._model.selectionEnd[1]0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const B=this._bufferService.buffer;if(this._model.selectionEnd[1]0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(N.ydisp+this._bufferService.rows,N.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=N.ydisp),this.refresh()}}_handleMouseUp(N){const M=N.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&M<500&&N.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const B=this._mouseService.getCoords(N,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(B&&B[0]!==void 0&&B[1]!==void 0){const H=(0,_.moveToCellSequence)(B[0]-1,B[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(H,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const N=this._model.finalSelectionStart,M=this._model.finalSelectionEnd,B=!(!N||!M||N[0]===M[0]&&N[1]===M[1]);B?N&&M&&(this._oldSelectionStart&&this._oldSelectionEnd&&N[0]===this._oldSelectionStart[0]&&N[1]===this._oldSelectionStart[1]&&M[0]===this._oldSelectionEnd[0]&&M[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(N,M,B)):this._oldHasSelection&&this._fireOnSelectionChange(N,M,B)}_fireOnSelectionChange(N,M,B){this._oldSelectionStart=N,this._oldSelectionEnd=M,this._oldHasSelection=B,this._onSelectionChange.fire()}_handleBufferActivate(N){this.clearSelection(),this._trimListener.dispose(),this._trimListener=N.activeBuffer.lines.onTrim((M=>this._handleTrim(M)))}_convertViewportColToCharacterIndex(N,M){let B=M;for(let H=0;M>=H;H++){const Y=N.loadCell(H,this._workCell).getChars().length;this._workCell.getWidth()===0?B--:Y>1&&M!==H&&(B+=Y-1)}return B}setSelection(N,M,B){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[N,M],this._model.selectionStartLength=B,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(N){this._isClickInSelection(N)||(this._selectWordAtCursor(N,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(N,M,B=!0,H=!0){if(N[0]>=this._bufferService.cols)return;const Y=this._bufferService.buffer,F=Y.lines.get(N[1]);if(!F)return;const z=Y.translateBufferLineToString(N[1],!1);let q=this._convertViewportColToCharacterIndex(F,N[0]),G=q;const X=N[0]-q;let K=0,O=0,L=0,j=0;if(z.charAt(q)===" "){for(;q>0&&z.charAt(q-1)===" ";)q--;for(;G1&&(j+=ae-1,G+=ae-1);Q>0&&q>0&&!this._isCharWordSeparator(F.loadCell(Q-1,this._workCell));){F.loadCell(Q-1,this._workCell);const Z=this._workCell.getChars().length;this._workCell.getWidth()===0?(K++,Q--):Z>1&&(L+=Z-1,q-=Z-1),q--,Q--}for(;re1&&(j+=Z-1,G+=Z-1),G++,re++}}G++;let $=q+X-K+L,U=Math.min(this._bufferService.cols,G-q+K+O-L-j);if(M||z.slice(q,G).trim()!==""){if(B&&$===0&&F.getCodePoint(0)!==32){const Q=Y.lines.get(N[1]-1);if(Q&&F.isWrapped&&Q.getCodePoint(this._bufferService.cols-1)!==32){const re=this._getWordAt([this._bufferService.cols-1,N[1]-1],!1,!0,!1);if(re){const ae=this._bufferService.cols-re.start;$-=ae,U+=ae}}}if(H&&$+U===this._bufferService.cols&&F.getCodePoint(this._bufferService.cols-1)!==32){const Q=Y.lines.get(N[1]+1);if(Q!=null&&Q.isWrapped&&Q.getCodePoint(0)!==32){const re=this._getWordAt([0,N[1]+1],!1,!1,!0);re&&(U+=re.length)}}return{start:$,length:U}}}_selectWordAt(N,M){const B=this._getWordAt(N,M);if(B){for(;B.start<0;)B.start+=this._bufferService.cols,N[1]--;this._model.selectionStart=[B.start,N[1]],this._model.selectionStartLength=B.length}}_selectToWordAt(N){const M=this._getWordAt(N,!0);if(M){let B=N[1];for(;M.start<0;)M.start+=this._bufferService.cols,B--;if(!this._model.areSelectionValuesReversed())for(;M.start+M.length>this._bufferService.cols;)M.length-=this._bufferService.cols,B++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?M.start:M.start+M.length,B]}}_isCharWordSeparator(N){return N.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(N.getChars())>=0}_selectLineAt(N){const M=this._bufferService.buffer.getWrappedRangeForLine(N),B={start:{x:0,y:M.first},end:{x:this._bufferService.cols-1,y:M.last}};this._model.selectionStart=[0,M.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,x.getRangeLength)(B,this._bufferService.cols)}};o.SelectionService=R=f([p(3,k.IBufferService),p(4,k.ICoreService),p(5,w.IMouseService),p(6,k.IOptionsService),p(7,w.IRenderService),p(8,w.ICoreBrowserService)],R)},4725:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.ILinkProviderService=o.IThemeService=o.ICharacterJoinerService=o.ISelectionService=o.IRenderService=o.IMouseService=o.ICoreBrowserService=o.ICharSizeService=void 0;const f=c(8343);o.ICharSizeService=(0,f.createDecorator)("CharSizeService"),o.ICoreBrowserService=(0,f.createDecorator)("CoreBrowserService"),o.IMouseService=(0,f.createDecorator)("MouseService"),o.IRenderService=(0,f.createDecorator)("RenderService"),o.ISelectionService=(0,f.createDecorator)("SelectionService"),o.ICharacterJoinerService=(0,f.createDecorator)("CharacterJoinerService"),o.IThemeService=(0,f.createDecorator)("ThemeService"),o.ILinkProviderService=(0,f.createDecorator)("LinkProviderService")},6731:function(u,o,c){var f=this&&this.__decorate||function(R,N,M,B){var H,Y=arguments.length,F=Y<3?N:B===null?B=Object.getOwnPropertyDescriptor(N,M):B;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")F=Reflect.decorate(R,N,M,B);else for(var z=R.length-1;z>=0;z--)(H=R[z])&&(F=(Y<3?H(F):Y>3?H(N,M,F):H(N,M))||F);return Y>3&&F&&Object.defineProperty(N,M,F),F},p=this&&this.__param||function(R,N){return function(M,B){N(M,B,R)}};Object.defineProperty(o,"__esModule",{value:!0}),o.ThemeService=o.DEFAULT_ANSI_COLORS=void 0;const d=c(7239),_=c(8055),v=c(8460),w=c(844),C=c(2585),b=_.css.toColor("#ffffff"),S=_.css.toColor("#000000"),x=_.css.toColor("#ffffff"),y=_.css.toColor("#000000"),k={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};o.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const R=[_.css.toColor("#2e3436"),_.css.toColor("#cc0000"),_.css.toColor("#4e9a06"),_.css.toColor("#c4a000"),_.css.toColor("#3465a4"),_.css.toColor("#75507b"),_.css.toColor("#06989a"),_.css.toColor("#d3d7cf"),_.css.toColor("#555753"),_.css.toColor("#ef2929"),_.css.toColor("#8ae234"),_.css.toColor("#fce94f"),_.css.toColor("#729fcf"),_.css.toColor("#ad7fa8"),_.css.toColor("#34e2e2"),_.css.toColor("#eeeeec")],N=[0,95,135,175,215,255];for(let M=0;M<216;M++){const B=N[M/36%6|0],H=N[M/6%6|0],Y=N[M%6];R.push({css:_.channels.toCss(B,H,Y),rgba:_.channels.toRgba(B,H,Y)})}for(let M=0;M<24;M++){const B=8+10*M;R.push({css:_.channels.toCss(B,B,B),rgba:_.channels.toRgba(B,B,B)})}return R})());let D=o.ThemeService=class extends w.Disposable{get colors(){return this._colors}constructor(R){super(),this._optionsService=R,this._contrastCache=new d.ColorContrastCache,this._halfContrastCache=new d.ColorContrastCache,this._onChangeColors=this.register(new v.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:b,background:S,cursor:x,cursorAccent:y,selectionForeground:void 0,selectionBackgroundTransparent:k,selectionBackgroundOpaque:_.color.blend(S,k),selectionInactiveBackgroundTransparent:k,selectionInactiveBackgroundOpaque:_.color.blend(S,k),ansi:o.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(R={}){const N=this._colors;if(N.foreground=T(R.foreground,b),N.background=T(R.background,S),N.cursor=T(R.cursor,x),N.cursorAccent=T(R.cursorAccent,y),N.selectionBackgroundTransparent=T(R.selectionBackground,k),N.selectionBackgroundOpaque=_.color.blend(N.background,N.selectionBackgroundTransparent),N.selectionInactiveBackgroundTransparent=T(R.selectionInactiveBackground,N.selectionBackgroundTransparent),N.selectionInactiveBackgroundOpaque=_.color.blend(N.background,N.selectionInactiveBackgroundTransparent),N.selectionForeground=R.selectionForeground?T(R.selectionForeground,_.NULL_COLOR):void 0,N.selectionForeground===_.NULL_COLOR&&(N.selectionForeground=void 0),_.color.isOpaque(N.selectionBackgroundTransparent)&&(N.selectionBackgroundTransparent=_.color.opacity(N.selectionBackgroundTransparent,.3)),_.color.isOpaque(N.selectionInactiveBackgroundTransparent)&&(N.selectionInactiveBackgroundTransparent=_.color.opacity(N.selectionInactiveBackgroundTransparent,.3)),N.ansi=o.DEFAULT_ANSI_COLORS.slice(),N.ansi[0]=T(R.black,o.DEFAULT_ANSI_COLORS[0]),N.ansi[1]=T(R.red,o.DEFAULT_ANSI_COLORS[1]),N.ansi[2]=T(R.green,o.DEFAULT_ANSI_COLORS[2]),N.ansi[3]=T(R.yellow,o.DEFAULT_ANSI_COLORS[3]),N.ansi[4]=T(R.blue,o.DEFAULT_ANSI_COLORS[4]),N.ansi[5]=T(R.magenta,o.DEFAULT_ANSI_COLORS[5]),N.ansi[6]=T(R.cyan,o.DEFAULT_ANSI_COLORS[6]),N.ansi[7]=T(R.white,o.DEFAULT_ANSI_COLORS[7]),N.ansi[8]=T(R.brightBlack,o.DEFAULT_ANSI_COLORS[8]),N.ansi[9]=T(R.brightRed,o.DEFAULT_ANSI_COLORS[9]),N.ansi[10]=T(R.brightGreen,o.DEFAULT_ANSI_COLORS[10]),N.ansi[11]=T(R.brightYellow,o.DEFAULT_ANSI_COLORS[11]),N.ansi[12]=T(R.brightBlue,o.DEFAULT_ANSI_COLORS[12]),N.ansi[13]=T(R.brightMagenta,o.DEFAULT_ANSI_COLORS[13]),N.ansi[14]=T(R.brightCyan,o.DEFAULT_ANSI_COLORS[14]),N.ansi[15]=T(R.brightWhite,o.DEFAULT_ANSI_COLORS[15]),R.extendedAnsi){const M=Math.min(N.ansi.length-16,R.extendedAnsi.length);for(let B=0;B{Object.defineProperty(o,"__esModule",{value:!0}),o.CircularList=void 0;const f=c(8460),p=c(844);class d extends p.Disposable{constructor(v){super(),this._maxLength=v,this.onDeleteEmitter=this.register(new f.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new f.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new f.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(v){if(this._maxLength===v)return;const w=new Array(v);for(let C=0;Cthis._length)for(let w=this._length;w=v;b--)this._array[this._getCyclicIndex(b+C.length)]=this._array[this._getCyclicIndex(b)];for(let b=0;bthis._maxLength){const b=this._length+C.length-this._maxLength;this._startIndex+=b,this._length=this._maxLength,this.onTrimEmitter.fire(b)}else this._length+=C.length}trimStart(v){v>this._length&&(v=this._length),this._startIndex+=v,this._length-=v,this.onTrimEmitter.fire(v)}shiftElements(v,w,C){if(!(w<=0)){if(v<0||v>=this._length)throw new Error("start argument out of range");if(v+C<0)throw new Error("Cannot shift elements in list beyond index 0");if(C>0){for(let S=w-1;S>=0;S--)this.set(v+S+C,this.get(v+S));const b=v+w+C-this._length;if(b>0)for(this._length+=b;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let b=0;b{Object.defineProperty(o,"__esModule",{value:!0}),o.clone=void 0,o.clone=function c(f,p=5){if(typeof f!="object")return f;const d=Array.isArray(f)?[]:{};for(const _ in f)d[_]=p<=1?f[_]:f[_]&&c(f[_],p-1);return d}},8055:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.contrastRatio=o.toPaddedHex=o.rgba=o.rgb=o.css=o.color=o.channels=o.NULL_COLOR=void 0;let c=0,f=0,p=0,d=0;var _,v,w,C,b;function S(y){const k=y.toString(16);return k.length<2?"0"+k:k}function x(y,k){return y>>0},y.toColor=function(k,D,T,R){return{css:y.toCss(k,D,T,R),rgba:y.toRgba(k,D,T,R)}}})(_||(o.channels=_={})),(function(y){function k(D,T){return d=Math.round(255*T),[c,f,p]=b.toChannels(D.rgba),{css:_.toCss(c,f,p,d),rgba:_.toRgba(c,f,p,d)}}y.blend=function(D,T){if(d=(255&T.rgba)/255,d===1)return{css:T.css,rgba:T.rgba};const R=T.rgba>>24&255,N=T.rgba>>16&255,M=T.rgba>>8&255,B=D.rgba>>24&255,H=D.rgba>>16&255,Y=D.rgba>>8&255;return c=B+Math.round((R-B)*d),f=H+Math.round((N-H)*d),p=Y+Math.round((M-Y)*d),{css:_.toCss(c,f,p),rgba:_.toRgba(c,f,p)}},y.isOpaque=function(D){return(255&D.rgba)==255},y.ensureContrastRatio=function(D,T,R){const N=b.ensureContrastRatio(D.rgba,T.rgba,R);if(N)return _.toColor(N>>24&255,N>>16&255,N>>8&255)},y.opaque=function(D){const T=(255|D.rgba)>>>0;return[c,f,p]=b.toChannels(T),{css:_.toCss(c,f,p),rgba:T}},y.opacity=k,y.multiplyOpacity=function(D,T){return d=255&D.rgba,k(D,d*T/255)},y.toColorRGB=function(D){return[D.rgba>>24&255,D.rgba>>16&255,D.rgba>>8&255]}})(v||(o.color=v={})),(function(y){let k,D;try{const T=document.createElement("canvas");T.width=1,T.height=1;const R=T.getContext("2d",{willReadFrequently:!0});R&&(k=R,k.globalCompositeOperation="copy",D=k.createLinearGradient(0,0,1,1))}catch{}y.toColor=function(T){if(T.match(/#[\da-f]{3,8}/i))switch(T.length){case 4:return c=parseInt(T.slice(1,2).repeat(2),16),f=parseInt(T.slice(2,3).repeat(2),16),p=parseInt(T.slice(3,4).repeat(2),16),_.toColor(c,f,p);case 5:return c=parseInt(T.slice(1,2).repeat(2),16),f=parseInt(T.slice(2,3).repeat(2),16),p=parseInt(T.slice(3,4).repeat(2),16),d=parseInt(T.slice(4,5).repeat(2),16),_.toColor(c,f,p,d);case 7:return{css:T,rgba:(parseInt(T.slice(1),16)<<8|255)>>>0};case 9:return{css:T,rgba:parseInt(T.slice(1),16)>>>0}}const R=T.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(R)return c=parseInt(R[1]),f=parseInt(R[2]),p=parseInt(R[3]),d=Math.round(255*(R[5]===void 0?1:parseFloat(R[5]))),_.toColor(c,f,p,d);if(!k||!D)throw new Error("css.toColor: Unsupported css format");if(k.fillStyle=D,k.fillStyle=T,typeof k.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(k.fillRect(0,0,1,1),[c,f,p,d]=k.getImageData(0,0,1,1).data,d!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:_.toRgba(c,f,p,d),css:T}}})(w||(o.css=w={})),(function(y){function k(D,T,R){const N=D/255,M=T/255,B=R/255;return .2126*(N<=.03928?N/12.92:Math.pow((N+.055)/1.055,2.4))+.7152*(M<=.03928?M/12.92:Math.pow((M+.055)/1.055,2.4))+.0722*(B<=.03928?B/12.92:Math.pow((B+.055)/1.055,2.4))}y.relativeLuminance=function(D){return k(D>>16&255,D>>8&255,255&D)},y.relativeLuminance2=k})(C||(o.rgb=C={})),(function(y){function k(T,R,N){const M=T>>24&255,B=T>>16&255,H=T>>8&255;let Y=R>>24&255,F=R>>16&255,z=R>>8&255,q=x(C.relativeLuminance2(Y,F,z),C.relativeLuminance2(M,B,H));for(;q0||F>0||z>0);)Y-=Math.max(0,Math.ceil(.1*Y)),F-=Math.max(0,Math.ceil(.1*F)),z-=Math.max(0,Math.ceil(.1*z)),q=x(C.relativeLuminance2(Y,F,z),C.relativeLuminance2(M,B,H));return(Y<<24|F<<16|z<<8|255)>>>0}function D(T,R,N){const M=T>>24&255,B=T>>16&255,H=T>>8&255;let Y=R>>24&255,F=R>>16&255,z=R>>8&255,q=x(C.relativeLuminance2(Y,F,z),C.relativeLuminance2(M,B,H));for(;q>>0}y.blend=function(T,R){if(d=(255&R)/255,d===1)return R;const N=R>>24&255,M=R>>16&255,B=R>>8&255,H=T>>24&255,Y=T>>16&255,F=T>>8&255;return c=H+Math.round((N-H)*d),f=Y+Math.round((M-Y)*d),p=F+Math.round((B-F)*d),_.toRgba(c,f,p)},y.ensureContrastRatio=function(T,R,N){const M=C.relativeLuminance(T>>8),B=C.relativeLuminance(R>>8);if(x(M,B)>8));if(zx(M,C.relativeLuminance(q>>8))?F:q}return F}const H=D(T,R,N),Y=x(M,C.relativeLuminance(H>>8));if(Yx(M,C.relativeLuminance(F>>8))?H:F}return H}},y.reduceLuminance=k,y.increaseLuminance=D,y.toChannels=function(T){return[T>>24&255,T>>16&255,T>>8&255,255&T]}})(b||(o.rgba=b={})),o.toPaddedHex=S,o.contrastRatio=x},8969:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.CoreTerminal=void 0;const f=c(844),p=c(2585),d=c(4348),_=c(7866),v=c(744),w=c(7302),C=c(6975),b=c(8460),S=c(1753),x=c(1480),y=c(7994),k=c(9282),D=c(5435),T=c(5981),R=c(2660);let N=!1;class M extends f.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new b.EventEmitter),this._onScroll.event((H=>{var Y;(Y=this._onScrollApi)==null||Y.fire(H.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(H){for(const Y in H)this.optionsService.options[Y]=H[Y]}constructor(H){super(),this._windowsWrappingHeuristics=this.register(new f.MutableDisposable),this._onBinary=this.register(new b.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new b.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new b.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new b.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new b.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new b.EventEmitter),this._instantiationService=new d.InstantiationService,this.optionsService=this.register(new w.OptionsService(H)),this._instantiationService.setService(p.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(v.BufferService)),this._instantiationService.setService(p.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(_.LogService)),this._instantiationService.setService(p.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(C.CoreService)),this._instantiationService.setService(p.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(S.CoreMouseService)),this._instantiationService.setService(p.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(x.UnicodeService)),this._instantiationService.setService(p.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(y.CharsetService),this._instantiationService.setService(p.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(R.OscLinkService),this._instantiationService.setService(p.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new D.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,b.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,b.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,b.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,b.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((Y=>{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((Y=>{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 T.WriteBuffer(((Y,F)=>this._inputHandler.parse(Y,F)))),this.register((0,b.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(H,Y){this._writeBuffer.write(H,Y)}writeSync(H,Y){this._logService.logLevel<=p.LogLevelEnum.WARN&&!N&&(this._logService.warn("writeSync is unreliable and will be removed soon."),N=!0),this._writeBuffer.writeSync(H,Y)}input(H,Y=!0){this.coreService.triggerDataEvent(H,Y)}resize(H,Y){isNaN(H)||isNaN(Y)||(H=Math.max(H,v.MINIMUM_COLS),Y=Math.max(Y,v.MINIMUM_ROWS),this._bufferService.resize(H,Y))}scroll(H,Y=!1){this._bufferService.scroll(H,Y)}scrollLines(H,Y,F){this._bufferService.scrollLines(H,Y,F)}scrollPages(H){this.scrollLines(H*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(H){const Y=H-this._bufferService.buffer.ydisp;Y!==0&&this.scrollLines(Y)}registerEscHandler(H,Y){return this._inputHandler.registerEscHandler(H,Y)}registerDcsHandler(H,Y){return this._inputHandler.registerDcsHandler(H,Y)}registerCsiHandler(H,Y){return this._inputHandler.registerCsiHandler(H,Y)}registerOscHandler(H,Y){return this._inputHandler.registerOscHandler(H,Y)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let H=!1;const Y=this.optionsService.rawOptions.windowsPty;Y&&Y.buildNumber!==void 0&&Y.buildNumber!==void 0?H=Y.backend==="conpty"&&Y.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(H=!0),H?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const H=[];H.push(this.onLineFeed(k.updateWindowsModeWrappedState.bind(null,this._bufferService))),H.push(this.registerCsiHandler({final:"H"},(()=>((0,k.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,f.toDisposable)((()=>{for(const Y of H)Y.dispose()}))}}}o.CoreTerminal=M},8460:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.runAndSubscribe=o.forwardEvent=o.EventEmitter=void 0,o.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=c=>(this._listeners.push(c),{dispose:()=>{if(!this._disposed){for(let f=0;ff.fire(p)))},o.runAndSubscribe=function(c,f){return f(void 0),c((p=>f(p)))}},5435:function(u,o,c){var f=this&&this.__decorate||function(K,O,L,j){var $,U=arguments.length,Q=U<3?O:j===null?j=Object.getOwnPropertyDescriptor(O,L):j;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")Q=Reflect.decorate(K,O,L,j);else for(var re=K.length-1;re>=0;re--)($=K[re])&&(Q=(U<3?$(Q):U>3?$(O,L,Q):$(O,L))||Q);return U>3&&Q&&Object.defineProperty(O,L,Q),Q},p=this&&this.__param||function(K,O){return function(L,j){O(L,j,K)}};Object.defineProperty(o,"__esModule",{value:!0}),o.InputHandler=o.WindowsOptionsReportType=void 0;const d=c(2584),_=c(7116),v=c(2015),w=c(844),C=c(482),b=c(8437),S=c(8460),x=c(643),y=c(511),k=c(3734),D=c(2585),T=c(1480),R=c(6242),N=c(6351),M=c(5941),B={"(":0,")":1,"*":2,"+":3,"-":1,".":2},H=131072;function Y(K,O){if(K>24)return O.setWinLines||!1;switch(K){case 1:return!!O.restoreWin;case 2:return!!O.minimizeWin;case 3:return!!O.setWinPosition;case 4:return!!O.setWinSizePixels;case 5:return!!O.raiseWin;case 6:return!!O.lowerWin;case 7:return!!O.refreshWin;case 8:return!!O.setWinSizeChars;case 9:return!!O.maximizeWin;case 10:return!!O.fullscreenWin;case 11:return!!O.getWinState;case 13:return!!O.getWinPosition;case 14:return!!O.getWinSizePixels;case 15:return!!O.getScreenSizePixels;case 16:return!!O.getCellSizePixels;case 18:return!!O.getWinSizeChars;case 19:return!!O.getScreenSizeChars;case 20:return!!O.getIconTitle;case 21:return!!O.getWinTitle;case 22:return!!O.pushTitle;case 23:return!!O.popTitle;case 24:return!!O.setWinLines}return!1}var F;(function(K){K[K.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",K[K.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(F||(o.WindowsOptionsReportType=F={}));let z=0;class q extends w.Disposable{getAttrData(){return this._curAttrData}constructor(O,L,j,$,U,Q,re,ae,Z=new v.EscapeSequenceParser){super(),this._bufferService=O,this._charsetService=L,this._coreService=j,this._logService=$,this._optionsService=U,this._oscLinkService=Q,this._coreMouseService=re,this._unicodeService=ae,this._parser=Z,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new C.StringToUtf32,this._utf8Decoder=new C.Utf8ToUtf32,this._workCell=new y.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=b.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=b.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new S.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new S.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new S.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new S.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new S.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new S.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new S.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new S.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new S.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new S.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new S.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new S.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new S.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 G(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((P=>this._activeBuffer=P.activeBuffer))),this._parser.setCsiHandlerFallback(((P,ee)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(P),params:ee.toArray()})})),this._parser.setEscHandlerFallback((P=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(P)})})),this._parser.setExecuteHandlerFallback((P=>{this._logService.debug("Unknown EXECUTE code: ",{code:P})})),this._parser.setOscHandlerFallback(((P,ee,ie)=>{this._logService.debug("Unknown OSC code: ",{identifier:P,action:ee,data:ie})})),this._parser.setDcsHandlerFallback(((P,ee,ie)=>{ee==="HOOK"&&(ie=ie.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(P),action:ee,payload:ie})})),this._parser.setPrintHandler(((P,ee,ie)=>this.print(P,ee,ie))),this._parser.registerCsiHandler({final:"@"},(P=>this.insertChars(P))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(P=>this.scrollLeft(P))),this._parser.registerCsiHandler({final:"A"},(P=>this.cursorUp(P))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(P=>this.scrollRight(P))),this._parser.registerCsiHandler({final:"B"},(P=>this.cursorDown(P))),this._parser.registerCsiHandler({final:"C"},(P=>this.cursorForward(P))),this._parser.registerCsiHandler({final:"D"},(P=>this.cursorBackward(P))),this._parser.registerCsiHandler({final:"E"},(P=>this.cursorNextLine(P))),this._parser.registerCsiHandler({final:"F"},(P=>this.cursorPrecedingLine(P))),this._parser.registerCsiHandler({final:"G"},(P=>this.cursorCharAbsolute(P))),this._parser.registerCsiHandler({final:"H"},(P=>this.cursorPosition(P))),this._parser.registerCsiHandler({final:"I"},(P=>this.cursorForwardTab(P))),this._parser.registerCsiHandler({final:"J"},(P=>this.eraseInDisplay(P,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(P=>this.eraseInDisplay(P,!0))),this._parser.registerCsiHandler({final:"K"},(P=>this.eraseInLine(P,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(P=>this.eraseInLine(P,!0))),this._parser.registerCsiHandler({final:"L"},(P=>this.insertLines(P))),this._parser.registerCsiHandler({final:"M"},(P=>this.deleteLines(P))),this._parser.registerCsiHandler({final:"P"},(P=>this.deleteChars(P))),this._parser.registerCsiHandler({final:"S"},(P=>this.scrollUp(P))),this._parser.registerCsiHandler({final:"T"},(P=>this.scrollDown(P))),this._parser.registerCsiHandler({final:"X"},(P=>this.eraseChars(P))),this._parser.registerCsiHandler({final:"Z"},(P=>this.cursorBackwardTab(P))),this._parser.registerCsiHandler({final:"`"},(P=>this.charPosAbsolute(P))),this._parser.registerCsiHandler({final:"a"},(P=>this.hPositionRelative(P))),this._parser.registerCsiHandler({final:"b"},(P=>this.repeatPrecedingCharacter(P))),this._parser.registerCsiHandler({final:"c"},(P=>this.sendDeviceAttributesPrimary(P))),this._parser.registerCsiHandler({prefix:">",final:"c"},(P=>this.sendDeviceAttributesSecondary(P))),this._parser.registerCsiHandler({final:"d"},(P=>this.linePosAbsolute(P))),this._parser.registerCsiHandler({final:"e"},(P=>this.vPositionRelative(P))),this._parser.registerCsiHandler({final:"f"},(P=>this.hVPosition(P))),this._parser.registerCsiHandler({final:"g"},(P=>this.tabClear(P))),this._parser.registerCsiHandler({final:"h"},(P=>this.setMode(P))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(P=>this.setModePrivate(P))),this._parser.registerCsiHandler({final:"l"},(P=>this.resetMode(P))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(P=>this.resetModePrivate(P))),this._parser.registerCsiHandler({final:"m"},(P=>this.charAttributes(P))),this._parser.registerCsiHandler({final:"n"},(P=>this.deviceStatus(P))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(P=>this.deviceStatusPrivate(P))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(P=>this.softReset(P))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(P=>this.setCursorStyle(P))),this._parser.registerCsiHandler({final:"r"},(P=>this.setScrollRegion(P))),this._parser.registerCsiHandler({final:"s"},(P=>this.saveCursor(P))),this._parser.registerCsiHandler({final:"t"},(P=>this.windowOptions(P))),this._parser.registerCsiHandler({final:"u"},(P=>this.restoreCursor(P))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(P=>this.insertColumns(P))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(P=>this.deleteColumns(P))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(P=>this.selectProtected(P))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(P=>this.requestMode(P,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(P=>this.requestMode(P,!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 R.OscHandler((P=>(this.setTitle(P),this.setIconName(P),!0)))),this._parser.registerOscHandler(1,new R.OscHandler((P=>this.setIconName(P)))),this._parser.registerOscHandler(2,new R.OscHandler((P=>this.setTitle(P)))),this._parser.registerOscHandler(4,new R.OscHandler((P=>this.setOrReportIndexedColor(P)))),this._parser.registerOscHandler(8,new R.OscHandler((P=>this.setHyperlink(P)))),this._parser.registerOscHandler(10,new R.OscHandler((P=>this.setOrReportFgColor(P)))),this._parser.registerOscHandler(11,new R.OscHandler((P=>this.setOrReportBgColor(P)))),this._parser.registerOscHandler(12,new R.OscHandler((P=>this.setOrReportCursorColor(P)))),this._parser.registerOscHandler(104,new R.OscHandler((P=>this.restoreIndexedColor(P)))),this._parser.registerOscHandler(110,new R.OscHandler((P=>this.restoreFgColor(P)))),this._parser.registerOscHandler(111,new R.OscHandler((P=>this.restoreBgColor(P)))),this._parser.registerOscHandler(112,new R.OscHandler((P=>this.restoreCursorColor(P)))),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 P in _.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:P},(()=>this.selectCharset("("+P))),this._parser.registerEscHandler({intermediates:")",final:P},(()=>this.selectCharset(")"+P))),this._parser.registerEscHandler({intermediates:"*",final:P},(()=>this.selectCharset("*"+P))),this._parser.registerEscHandler({intermediates:"+",final:P},(()=>this.selectCharset("+"+P))),this._parser.registerEscHandler({intermediates:"-",final:P},(()=>this.selectCharset("-"+P))),this._parser.registerEscHandler({intermediates:".",final:P},(()=>this.selectCharset("."+P))),this._parser.registerEscHandler({intermediates:"/",final:P},(()=>this.selectCharset("/"+P)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((P=>(this._logService.error("Parsing error: ",P),P))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new N.DcsHandler(((P,ee)=>this.requestStatusString(P,ee))))}_preserveStack(O,L,j,$){this._parseStack.paused=!0,this._parseStack.cursorStartX=O,this._parseStack.cursorStartY=L,this._parseStack.decodedLength=j,this._parseStack.position=$}_logSlowResolvingAsync(O){this._logService.logLevel<=D.LogLevelEnum.WARN&&Promise.race([O,new Promise(((L,j)=>setTimeout((()=>j("#SLOW_TIMEOUT")),5e3)))]).catch((L=>{if(L!=="#SLOW_TIMEOUT")throw L;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(O,L){let j,$=this._activeBuffer.x,U=this._activeBuffer.y,Q=0;const re=this._parseStack.paused;if(re){if(j=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,L))return this._logSlowResolvingAsync(j),j;$=this._parseStack.cursorStartX,U=this._parseStack.cursorStartY,this._parseStack.paused=!1,O.length>H&&(Q=this._parseStack.position+H)}if(this._logService.logLevel<=D.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof O=="string"?` "${O}"`:` "${Array.prototype.map.call(O,(P=>String.fromCharCode(P))).join("")}"`),typeof O=="string"?O.split("").map((P=>P.charCodeAt(0))):O),this._parseBuffer.lengthH)for(let P=Q;P0&&ie.getWidth(this._activeBuffer.x-1)===2&&ie.setCellFromCodepoint(this._activeBuffer.x-1,0,1,ee);let ge=this._parser.precedingJoinState;for(let he=L;heae){if(Z){const Ce=ie;let we=this._activeBuffer.x-Ae;for(this._activeBuffer.x=Ae,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),ie=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),Ae>0&&ie instanceof b.BufferLine&&ie.copyCellsFrom(Ce,we,0,Ae,!1);we=0;)ie.setCellFromCodepoint(this._activeBuffer.x++,0,0,ee)}else if(P&&(ie.insertCells(this._activeBuffer.x,U-Ae,this._activeBuffer.getNullCell(ee)),ie.getWidth(ae-1)===2&&ie.setCellFromCodepoint(ae-1,x.NULL_CELL_CODE,x.NULL_CELL_WIDTH,ee)),ie.setCellFromCodepoint(this._activeBuffer.x++,$,U,ee),U>0)for(;--U;)ie.setCellFromCodepoint(this._activeBuffer.x++,0,0,ee)}this._parser.precedingJoinState=ge,this._activeBuffer.x0&&ie.getWidth(this._activeBuffer.x)===0&&!ie.hasContent(this._activeBuffer.x)&&ie.setCellFromCodepoint(this._activeBuffer.x,0,1,ee),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(O,L){return O.final!=="t"||O.prefix||O.intermediates?this._parser.registerCsiHandler(O,L):this._parser.registerCsiHandler(O,(j=>!Y(j.params[0],this._optionsService.rawOptions.windowOptions)||L(j)))}registerDcsHandler(O,L){return this._parser.registerDcsHandler(O,new N.DcsHandler(L))}registerEscHandler(O,L){return this._parser.registerEscHandler(O,L)}registerOscHandler(O,L){return this._parser.registerOscHandler(O,new R.OscHandler(L))}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 O;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&&((O=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&O.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const L=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);L.hasWidth(this._activeBuffer.x)&&!L.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const O=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-O),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(O=this._bufferService.cols-1){this._activeBuffer.x=Math.min(O,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(O,L){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=O,this._activeBuffer.y=this._activeBuffer.scrollTop+L):(this._activeBuffer.x=O,this._activeBuffer.y=L),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(O,L){this._restrictCursor(),this._setCursor(this._activeBuffer.x+O,this._activeBuffer.y+L)}cursorUp(O){const L=this._activeBuffer.y-this._activeBuffer.scrollTop;return L>=0?this._moveCursor(0,-Math.min(L,O.params[0]||1)):this._moveCursor(0,-(O.params[0]||1)),!0}cursorDown(O){const L=this._activeBuffer.scrollBottom-this._activeBuffer.y;return L>=0?this._moveCursor(0,Math.min(L,O.params[0]||1)):this._moveCursor(0,O.params[0]||1),!0}cursorForward(O){return this._moveCursor(O.params[0]||1,0),!0}cursorBackward(O){return this._moveCursor(-(O.params[0]||1),0),!0}cursorNextLine(O){return this.cursorDown(O),this._activeBuffer.x=0,!0}cursorPrecedingLine(O){return this.cursorUp(O),this._activeBuffer.x=0,!0}cursorCharAbsolute(O){return this._setCursor((O.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(O){return this._setCursor(O.length>=2?(O.params[1]||1)-1:0,(O.params[0]||1)-1),!0}charPosAbsolute(O){return this._setCursor((O.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(O){return this._moveCursor(O.params[0]||1,0),!0}linePosAbsolute(O){return this._setCursor(this._activeBuffer.x,(O.params[0]||1)-1),!0}vPositionRelative(O){return this._moveCursor(0,O.params[0]||1),!0}hVPosition(O){return this.cursorPosition(O),!0}tabClear(O){const L=O.params[0];return L===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:L===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(O){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let L=O.params[0]||1;for(;L--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(O){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let L=O.params[0]||1;for(;L--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(O){const L=O.params[0];return L===1&&(this._curAttrData.bg|=536870912),L!==2&&L!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(O,L,j,$=!1,U=!1){const Q=this._activeBuffer.lines.get(this._activeBuffer.ybase+O);Q.replaceCells(L,j,this._activeBuffer.getNullCell(this._eraseAttrData()),U),$&&(Q.isWrapped=!1)}_resetBufferLine(O,L=!1){const j=this._activeBuffer.lines.get(this._activeBuffer.ybase+O);j&&(j.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),L),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+O),j.isWrapped=!1)}eraseInDisplay(O,L=!1){let j;switch(this._restrictCursor(this._bufferService.cols),O.params[0]){case 0:for(j=this._activeBuffer.y,this._dirtyRowTracker.markDirty(j),this._eraseInBufferLine(j++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,L);j=this._bufferService.cols&&(this._activeBuffer.lines.get(j+1).isWrapped=!1);j--;)this._resetBufferLine(j,L);this._dirtyRowTracker.markDirty(0);break;case 2:for(j=this._bufferService.rows,this._dirtyRowTracker.markDirty(j-1);j--;)this._resetBufferLine(j,L);this._dirtyRowTracker.markDirty(0);break;case 3:const $=this._activeBuffer.lines.length-this._bufferService.rows;$>0&&(this._activeBuffer.lines.trimStart($),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-$,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-$,0),this._onScroll.fire(0))}return!0}eraseInLine(O,L=!1){switch(this._restrictCursor(this._bufferService.cols),O.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,L);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,L);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,L)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(O){this._restrictCursor();let L=O.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.y65535?2:1}let Z=ae;for(let P=1;P0||(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(O){return O.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(O.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(d.C0.ESC+"[>83;40003;0c")),!0}_is(O){return(this._optionsService.rawOptions.termName+"").indexOf(O)===0}setMode(O){for(let L=0;LSe?1:2,ge=O.params[0];return he=ge,ye=L?ge===2?4:ge===4?ie(Q.modes.insertMode):ge===12?3:ge===20?ie(ee.convertEol):0:ge===1?ie(j.applicationCursorKeys):ge===3?ee.windowOptions.setWinLines?ae===80?2:ae===132?1:0:0:ge===6?ie(j.origin):ge===7?ie(j.wraparound):ge===8?3:ge===9?ie($==="X10"):ge===12?ie(ee.cursorBlink):ge===25?ie(!Q.isCursorHidden):ge===45?ie(j.reverseWraparound):ge===66?ie(j.applicationKeypad):ge===67?4:ge===1e3?ie($==="VT200"):ge===1002?ie($==="DRAG"):ge===1003?ie($==="ANY"):ge===1004?ie(j.sendFocus):ge===1005?4:ge===1006?ie(U==="SGR"):ge===1015?4:ge===1016?ie(U==="SGR_PIXELS"):ge===1048?1:ge===47||ge===1047||ge===1049?ie(Z===P):ge===2004?ie(j.bracketedPasteMode):0,Q.triggerDataEvent(`${d.C0.ESC}[${L?"":"?"}${he};${ye}$y`),!0;var he,ye}_updateAttrColor(O,L,j,$,U){return L===2?(O|=50331648,O&=-16777216,O|=k.AttributeData.fromColorRGB([j,$,U])):L===5&&(O&=-50331904,O|=33554432|255&j),O}_extractColor(O,L,j){const $=[0,0,-1,0,0,0];let U=0,Q=0;do{if($[Q+U]=O.params[L+Q],O.hasSubParams(L+Q)){const re=O.getSubParams(L+Q);let ae=0;do $[1]===5&&(U=1),$[Q+ae+1+U]=re[ae];while(++ae=2||$[1]===2&&Q+U>=5)break;$[1]&&(U=1)}while(++Q+L5)&&(O=1),L.extended.underlineStyle=O,L.fg|=268435456,O===0&&(L.fg&=-268435457),L.updateExtended()}_processSGR0(O){O.fg=b.DEFAULT_ATTR_DATA.fg,O.bg=b.DEFAULT_ATTR_DATA.bg,O.extended=O.extended.clone(),O.extended.underlineStyle=0,O.extended.underlineColor&=-67108864,O.updateExtended()}charAttributes(O){if(O.length===1&&O.params[0]===0)return this._processSGR0(this._curAttrData),!0;const L=O.length;let j;const $=this._curAttrData;for(let U=0;U=30&&j<=37?($.fg&=-50331904,$.fg|=16777216|j-30):j>=40&&j<=47?($.bg&=-50331904,$.bg|=16777216|j-40):j>=90&&j<=97?($.fg&=-50331904,$.fg|=16777224|j-90):j>=100&&j<=107?($.bg&=-50331904,$.bg|=16777224|j-100):j===0?this._processSGR0($):j===1?$.fg|=134217728:j===3?$.bg|=67108864:j===4?($.fg|=268435456,this._processUnderline(O.hasSubParams(U)?O.getSubParams(U)[0]:1,$)):j===5?$.fg|=536870912:j===7?$.fg|=67108864:j===8?$.fg|=1073741824:j===9?$.fg|=2147483648:j===2?$.bg|=134217728:j===21?this._processUnderline(2,$):j===22?($.fg&=-134217729,$.bg&=-134217729):j===23?$.bg&=-67108865:j===24?($.fg&=-268435457,this._processUnderline(0,$)):j===25?$.fg&=-536870913:j===27?$.fg&=-67108865:j===28?$.fg&=-1073741825:j===29?$.fg&=2147483647:j===39?($.fg&=-67108864,$.fg|=16777215&b.DEFAULT_ATTR_DATA.fg):j===49?($.bg&=-67108864,$.bg|=16777215&b.DEFAULT_ATTR_DATA.bg):j===38||j===48||j===58?U+=this._extractColor(O,U,$):j===53?$.bg|=1073741824:j===55?$.bg&=-1073741825:j===59?($.extended=$.extended.clone(),$.extended.underlineColor=-1,$.updateExtended()):j===100?($.fg&=-67108864,$.fg|=16777215&b.DEFAULT_ATTR_DATA.fg,$.bg&=-67108864,$.bg|=16777215&b.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",j);return!0}deviceStatus(O){switch(O.params[0]){case 5:this._coreService.triggerDataEvent(`${d.C0.ESC}[0n`);break;case 6:const L=this._activeBuffer.y+1,j=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${d.C0.ESC}[${L};${j}R`)}return!0}deviceStatusPrivate(O){if(O.params[0]===6){const L=this._activeBuffer.y+1,j=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${d.C0.ESC}[?${L};${j}R`)}return!0}softReset(O){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=b.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(O){const L=O.params[0]||1;switch(L){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}const j=L%2==1;return this._optionsService.options.cursorBlink=j,!0}setScrollRegion(O){const L=O.params[0]||1;let j;return(O.length<2||(j=O.params[1])>this._bufferService.rows||j===0)&&(j=this._bufferService.rows),j>L&&(this._activeBuffer.scrollTop=L-1,this._activeBuffer.scrollBottom=j-1,this._setCursor(0,0)),!0}windowOptions(O){if(!Y(O.params[0],this._optionsService.rawOptions.windowOptions))return!0;const L=O.length>1?O.params[1]:0;switch(O.params[0]){case 14:L!==2&&this._onRequestWindowsOptionsReport.fire(F.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(F.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:L!==0&&L!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),L!==0&&L!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:L!==0&&L!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),L!==0&&L!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(O){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(O){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(O){return this._windowTitle=O,this._onTitleChange.fire(O),!0}setIconName(O){return this._iconName=O,!0}setOrReportIndexedColor(O){const L=[],j=O.split(";");for(;j.length>1;){const $=j.shift(),U=j.shift();if(/^\d+$/.exec($)){const Q=parseInt($);if(X(Q))if(U==="?")L.push({type:0,index:Q});else{const re=(0,M.parseColor)(U);re&&L.push({type:1,index:Q,color:re})}}}return L.length&&this._onColor.fire(L),!0}setHyperlink(O){const L=O.split(";");return!(L.length<2)&&(L[1]?this._createHyperlink(L[0],L[1]):!L[0]&&this._finishHyperlink())}_createHyperlink(O,L){this._getCurrentLinkId()&&this._finishHyperlink();const j=O.split(":");let $;const U=j.findIndex((Q=>Q.startsWith("id=")));return U!==-1&&($=j[U].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:$,uri:L}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(O,L){const j=O.split(";");for(let $=0;$=this._specialColors.length);++$,++L)if(j[$]==="?")this._onColor.fire([{type:0,index:this._specialColors[L]}]);else{const U=(0,M.parseColor)(j[$]);U&&this._onColor.fire([{type:1,index:this._specialColors[L],color:U}])}return!0}setOrReportFgColor(O){return this._setOrReportSpecialColor(O,0)}setOrReportBgColor(O){return this._setOrReportSpecialColor(O,1)}setOrReportCursorColor(O){return this._setOrReportSpecialColor(O,2)}restoreIndexedColor(O){if(!O)return this._onColor.fire([{type:2}]),!0;const L=[],j=O.split(";");for(let $=0;$=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 O=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,O,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=b.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=b.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(O){return this._charsetService.setgLevel(O),!0}screenAlignmentPattern(){const O=new y.CellData;O.content=4194373,O.fg=this._curAttrData.fg,O.bg=this._curAttrData.bg,this._setCursor(0,0);for(let L=0;L(this._coreService.triggerDataEvent(`${d.C0.ESC}${U}${d.C0.ESC}\\`),!0))(O==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:O==='"p'?'P1$r61;1"p':O==="r"?`P1$r${j.scrollTop+1};${j.scrollBottom+1}r`:O==="m"?"P1$r0m":O===" q"?`P1$r${{block:2,underline:4,bar:6}[$.cursorStyle]-($.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(O,L){this._dirtyRowTracker.markRangeDirty(O,L)}}o.InputHandler=q;let G=class{constructor(K){this._bufferService=K,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(K){Kthis.end&&(this.end=K)}markRangeDirty(K,O){K>O&&(z=K,K=O,O=z),Kthis.end&&(this.end=O)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function X(K){return 0<=K&&K<256}G=f([p(0,D.IBufferService)],G)},844:(u,o)=>{function c(f){for(const p of f)p.dispose();f.length=0}Object.defineProperty(o,"__esModule",{value:!0}),o.getDisposeArrayDisposable=o.disposeArray=o.toDisposable=o.MutableDisposable=o.Disposable=void 0,o.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const f of this._disposables)f.dispose();this._disposables.length=0}register(f){return this._disposables.push(f),f}unregister(f){const p=this._disposables.indexOf(f);p!==-1&&this._disposables.splice(p,1)}},o.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(f){var p;this._isDisposed||f===this._value||((p=this._value)==null||p.dispose(),this._value=f)}clear(){this.value=void 0}dispose(){var f;this._isDisposed=!0,(f=this._value)==null||f.dispose(),this._value=void 0}},o.toDisposable=function(f){return{dispose:f}},o.disposeArray=c,o.getDisposeArrayDisposable=function(f){return{dispose:()=>c(f)}}},1505:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.FourKeyMap=o.TwoKeyMap=void 0;class c{constructor(){this._data={}}set(p,d,_){this._data[p]||(this._data[p]={}),this._data[p][d]=_}get(p,d){return this._data[p]?this._data[p][d]:void 0}clear(){this._data={}}}o.TwoKeyMap=c,o.FourKeyMap=class{constructor(){this._data=new c}set(f,p,d,_,v){this._data.get(f,p)||this._data.set(f,p,new c),this._data.get(f,p).set(d,_,v)}get(f,p,d,_){var v;return(v=this._data.get(f,p))==null?void 0:v.get(d,_)}clear(){this._data.clear()}}},6114:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.isChromeOS=o.isLinux=o.isWindows=o.isIphone=o.isIpad=o.isMac=o.getSafariVersion=o.isSafari=o.isLegacyEdge=o.isFirefox=o.isNode=void 0,o.isNode=typeof process<"u"&&"title"in process;const c=o.isNode?"node":navigator.userAgent,f=o.isNode?"node":navigator.platform;o.isFirefox=c.includes("Firefox"),o.isLegacyEdge=c.includes("Edge"),o.isSafari=/^((?!chrome|android).)*safari/i.test(c),o.getSafariVersion=function(){if(!o.isSafari)return 0;const p=c.match(/Version\/(\d+)/);return p===null||p.length<2?0:parseInt(p[1])},o.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(f),o.isIpad=f==="iPad",o.isIphone=f==="iPhone",o.isWindows=["Windows","Win16","Win32","WinCE"].includes(f),o.isLinux=f.indexOf("Linux")>=0,o.isChromeOS=/\bCrOS\b/.test(c)},6106:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.SortedList=void 0;let c=0;o.SortedList=class{constructor(f){this._getKey=f,this._array=[]}clear(){this._array.length=0}insert(f){this._array.length!==0?(c=this._search(this._getKey(f)),this._array.splice(c,0,f)):this._array.push(f)}delete(f){if(this._array.length===0)return!1;const p=this._getKey(f);if(p===void 0||(c=this._search(p),c===-1)||this._getKey(this._array[c])!==p)return!1;do if(this._array[c]===f)return this._array.splice(c,1),!0;while(++c=this._array.length)&&this._getKey(this._array[c])===f))do yield this._array[c];while(++c=this._array.length)&&this._getKey(this._array[c])===f))do p(this._array[c]);while(++c=p;){let _=p+d>>1;const v=this._getKey(this._array[_]);if(v>f)d=_-1;else{if(!(v0&&this._getKey(this._array[_-1])===f;)_--;return _}p=_+1}}return p}}},7226:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.DebouncedIdleTask=o.IdleTaskQueue=o.PriorityTaskQueue=void 0;const f=c(6114);class p{constructor(){this._tasks=[],this._i=0}enqueue(v){this._tasks.push(v),this._start()}flush(){for(;this._iS)return b-w<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(b-w))}ms`),void this._start();b=S}this.clear()}}class d extends p{_requestCallback(v){return setTimeout((()=>v(this._createDeadline(16))))}_cancelCallback(v){clearTimeout(v)}_createDeadline(v){const w=Date.now()+v;return{timeRemaining:()=>Math.max(0,w-Date.now())}}}o.PriorityTaskQueue=d,o.IdleTaskQueue=!f.isNode&&"requestIdleCallback"in window?class extends p{_requestCallback(_){return requestIdleCallback(_)}_cancelCallback(_){cancelIdleCallback(_)}}:d,o.DebouncedIdleTask=class{constructor(){this._queue=new o.IdleTaskQueue}set(_){this._queue.clear(),this._queue.enqueue(_)}flush(){this._queue.flush()}}},9282:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.updateWindowsModeWrappedState=void 0;const f=c(643);o.updateWindowsModeWrappedState=function(p){const d=p.buffer.lines.get(p.buffer.ybase+p.buffer.y-1),_=d==null?void 0:d.get(p.cols-1),v=p.buffer.lines.get(p.buffer.ybase+p.buffer.y);v&&_&&(v.isWrapped=_[f.CHAR_DATA_CODE_INDEX]!==f.NULL_CELL_CODE&&_[f.CHAR_DATA_CODE_INDEX]!==f.WHITESPACE_CELL_CODE)}},3734:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.ExtendedAttrs=o.AttributeData=void 0;class c{constructor(){this.fg=0,this.bg=0,this.extended=new f}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 c;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}}o.AttributeData=c;class f{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,_=0){this._ext=0,this._urlId=0,this._ext=d,this._urlId=_}clone(){return new f(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}o.ExtendedAttrs=f},9092:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.Buffer=o.MAX_BUFFER_SIZE=void 0;const f=c(6349),p=c(7226),d=c(3734),_=c(8437),v=c(4634),w=c(511),C=c(643),b=c(4863),S=c(7116);o.MAX_BUFFER_SIZE=4294967295,o.Buffer=class{constructor(x,y,k){this._hasScrollback=x,this._optionsService=y,this._bufferService=k,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=_.DEFAULT_ATTR_DATA.clone(),this.savedCharset=S.DEFAULT_CHARSET,this.markers=[],this._nullCell=w.CellData.fromCharData([0,C.NULL_CELL_CHAR,C.NULL_CELL_WIDTH,C.NULL_CELL_CODE]),this._whitespaceCell=w.CellData.fromCharData([0,C.WHITESPACE_CELL_CHAR,C.WHITESPACE_CELL_WIDTH,C.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new p.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new f.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,y){return new _.BufferLine(this._bufferService.cols,this.getNullCell(x),y)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const x=this.ybase+this.y-this.ydisp;return x>=0&&xo.MAX_BUFFER_SIZE?o.MAX_BUFFER_SIZE:y}fillViewportRows(x){if(this.lines.length===0){x===void 0&&(x=_.DEFAULT_ATTR_DATA);let y=this._rows;for(;y--;)this.lines.push(this.getBlankLine(x))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new f.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(x,y){const k=this.getNullCell(_.DEFAULT_ATTR_DATA);let D=0;const T=this._getCorrectBufferLength(y);if(T>this.lines.maxLength&&(this.lines.maxLength=T),this.lines.length>0){if(this._cols0&&this.lines.length<=this.ybase+this.y+R+1?(this.ybase--,R++,this.ydisp>0&&this.ydisp--):this.lines.push(new _.BufferLine(x,k)));else for(let N=this._rows;N>y;N--)this.lines.length>y+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(T0&&(this.lines.trimStart(N),this.ybase=Math.max(this.ybase-N,0),this.ydisp=Math.max(this.ydisp-N,0),this.savedY=Math.max(this.savedY-N,0)),this.lines.maxLength=T}this.x=Math.min(this.x,x-1),this.y=Math.min(this.y,y-1),R&&(this.y+=R),this.savedX=Math.min(this.savedX,x-1),this.scrollTop=0}if(this.scrollBottom=y-1,this._isReflowEnabled&&(this._reflow(x,y),this._cols>x))for(let R=0;R.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 y=0;for(;this._memoryCleanupPosition100)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,y){this._cols!==x&&(x>this._cols?this._reflowLarger(x,y):this._reflowSmaller(x,y))}_reflowLarger(x,y){const k=(0,v.reflowLargerGetLinesToRemove)(this.lines,this._cols,x,this.ybase+this.y,this.getNullCell(_.DEFAULT_ATTR_DATA));if(k.length>0){const D=(0,v.reflowLargerCreateNewLayout)(this.lines,k);(0,v.reflowLargerApplyNewLayout)(this.lines,D.layout),this._reflowLargerAdjustViewport(x,y,D.countRemoved)}}_reflowLargerAdjustViewport(x,y,k){const D=this.getNullCell(_.DEFAULT_ATTR_DATA);let T=k;for(;T-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length=0;R--){let N=this.lines.get(R);if(!N||!N.isWrapped&&N.getTrimmedLength()<=x)continue;const M=[N];for(;N.isWrapped&&R>0;)N=this.lines.get(--R),M.unshift(N);const B=this.ybase+this.y;if(B>=R&&B0&&(D.push({start:R+M.length+T,newLines:q}),T+=q.length),M.push(...q);let G=Y.length-1,X=Y[G];X===0&&(G--,X=Y[G]);let K=M.length-F-1,O=H;for(;K>=0;){const j=Math.min(O,X);if(M[G]===void 0)break;if(M[G].copyCellsFrom(M[K],O-j,X-j,j,!0),X-=j,X===0&&(G--,X=Y[G]),O-=j,O===0){K--;const $=Math.max(K,0);O=(0,v.getWrappedLineTrimmedLength)(M,$,this._cols)}}for(let j=0;j0;)this.ybase===0?this.y0){const R=[],N=[];for(let G=0;G=0;G--)if(Y&&Y.start>B+F){for(let X=Y.newLines.length-1;X>=0;X--)this.lines.set(G--,Y.newLines[X]);G++,R.push({index:B+1,amount:Y.newLines.length}),F+=Y.newLines.length,Y=D[++H]}else this.lines.set(G,N[B--]);let z=0;for(let G=R.length-1;G>=0;G--)R[G].index+=z,this.lines.onInsertEmitter.fire(R[G]),z+=R[G].amount;const q=Math.max(0,M+T-this.lines.maxLength);q>0&&this.lines.onTrimEmitter.fire(q)}}translateBufferLineToString(x,y,k=0,D){const T=this.lines.get(x);return T?T.translateToString(y,k,D):""}getWrappedRangeForLine(x){let y=x,k=x;for(;y>0&&this.lines.get(y).isWrapped;)y--;for(;k+10;);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?this._cols-1:x<0?0:x}clearMarkers(x){this._isClearing=!0;for(let y=0;y{y.line-=k,y.line<0&&y.dispose()}))),y.register(this.lines.onInsert((k=>{y.line>=k.index&&(y.line+=k.amount)}))),y.register(this.lines.onDelete((k=>{y.line>=k.index&&y.linek.index&&(y.line-=k.amount)}))),y.register(y.onDispose((()=>this._removeMarker(y)))),y}_removeMarker(x){this._isClearing||this.markers.splice(this.markers.indexOf(x),1)}}},8437:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.BufferLine=o.DEFAULT_ATTR_DATA=void 0;const f=c(3734),p=c(511),d=c(643),_=c(482);o.DEFAULT_ATTR_DATA=Object.freeze(new f.AttributeData);let v=0;class w{constructor(b,S,x=!1){this.isWrapped=x,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*b);const y=S||p.CellData.fromCharData([0,d.NULL_CELL_CHAR,d.NULL_CELL_WIDTH,d.NULL_CELL_CODE]);for(let k=0;k>22,2097152&S?this._combined[b].charCodeAt(this._combined[b].length-1):x]}set(b,S){this._data[3*b+1]=S[d.CHAR_DATA_ATTR_INDEX],S[d.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[b]=S[1],this._data[3*b+0]=2097152|b|S[d.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*b+0]=S[d.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|S[d.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(b){return this._data[3*b+0]>>22}hasWidth(b){return 12582912&this._data[3*b+0]}getFg(b){return this._data[3*b+1]}getBg(b){return this._data[3*b+2]}hasContent(b){return 4194303&this._data[3*b+0]}getCodePoint(b){const S=this._data[3*b+0];return 2097152&S?this._combined[b].charCodeAt(this._combined[b].length-1):2097151&S}isCombined(b){return 2097152&this._data[3*b+0]}getString(b){const S=this._data[3*b+0];return 2097152&S?this._combined[b]:2097151&S?(0,_.stringFromCodePoint)(2097151&S):""}isProtected(b){return 536870912&this._data[3*b+2]}loadCell(b,S){return v=3*b,S.content=this._data[v+0],S.fg=this._data[v+1],S.bg=this._data[v+2],2097152&S.content&&(S.combinedData=this._combined[b]),268435456&S.bg&&(S.extended=this._extendedAttrs[b]),S}setCell(b,S){2097152&S.content&&(this._combined[b]=S.combinedData),268435456&S.bg&&(this._extendedAttrs[b]=S.extended),this._data[3*b+0]=S.content,this._data[3*b+1]=S.fg,this._data[3*b+2]=S.bg}setCellFromCodepoint(b,S,x,y){268435456&y.bg&&(this._extendedAttrs[b]=y.extended),this._data[3*b+0]=S|x<<22,this._data[3*b+1]=y.fg,this._data[3*b+2]=y.bg}addCodepointToCell(b,S,x){let y=this._data[3*b+0];2097152&y?this._combined[b]+=(0,_.stringFromCodePoint)(S):2097151&y?(this._combined[b]=(0,_.stringFromCodePoint)(2097151&y)+(0,_.stringFromCodePoint)(S),y&=-2097152,y|=2097152):y=S|4194304,x&&(y&=-12582913,y|=x<<22),this._data[3*b+0]=y}insertCells(b,S,x){if((b%=this.length)&&this.getWidth(b-1)===2&&this.setCellFromCodepoint(b-1,0,1,x),S=0;--k)this.setCell(b+S+k,this.loadCell(b+k,y));for(let k=0;kthis.length){if(this._data.buffer.byteLength>=4*x)this._data=new Uint32Array(this._data.buffer,0,x);else{const y=new Uint32Array(x);y.set(this._data),this._data=y}for(let y=this.length;y=b&&delete this._combined[T]}const k=Object.keys(this._extendedAttrs);for(let D=0;D=b&&delete this._extendedAttrs[T]}}return this.length=b,4*x*2=0;--b)if(4194303&this._data[3*b+0])return b+(this._data[3*b+0]>>22);return 0}getNoBgTrimmedLength(){for(let b=this.length-1;b>=0;--b)if(4194303&this._data[3*b+0]||50331648&this._data[3*b+2])return b+(this._data[3*b+0]>>22);return 0}copyCellsFrom(b,S,x,y,k){const D=b._data;if(k)for(let R=y-1;R>=0;R--){for(let N=0;N<3;N++)this._data[3*(x+R)+N]=D[3*(S+R)+N];268435456&D[3*(S+R)+2]&&(this._extendedAttrs[x+R]=b._extendedAttrs[S+R])}else for(let R=0;R=S&&(this._combined[N-S+x]=b._combined[N])}}translateToString(b,S,x,y){S=S??0,x=x??this.length,b&&(x=Math.min(x,this.getTrimmedLength())),y&&(y.length=0);let k="";for(;S>22||1}return y&&y.push(S),k}}o.BufferLine=w},4841:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.getRangeLength=void 0,o.getRangeLength=function(c,f){if(c.start.y>c.end.y)throw new Error(`Buffer range end (${c.end.x}, ${c.end.y}) cannot be before start (${c.start.x}, ${c.start.y})`);return f*(c.end.y-c.start.y)+(c.end.x-c.start.x+1)}},4634:(u,o)=>{function c(f,p,d){if(p===f.length-1)return f[p].getTrimmedLength();const _=!f[p].hasContent(d-1)&&f[p].getWidth(d-1)===1,v=f[p+1].getWidth(0)===2;return _&&v?d-1:d}Object.defineProperty(o,"__esModule",{value:!0}),o.getWrappedLineTrimmedLength=o.reflowSmallerGetNewLineLengths=o.reflowLargerApplyNewLayout=o.reflowLargerCreateNewLayout=o.reflowLargerGetLinesToRemove=void 0,o.reflowLargerGetLinesToRemove=function(f,p,d,_,v){const w=[];for(let C=0;C=C&&_0&&(N>y||x[N].getTrimmedLength()===0);N--)R++;R>0&&(w.push(C+x.length-R),w.push(R)),C+=x.length-1}return w},o.reflowLargerCreateNewLayout=function(f,p){const d=[];let _=0,v=p[_],w=0;for(let C=0;Cc(f,x,p))).reduce(((S,x)=>S+x));let w=0,C=0,b=0;for(;bS&&(w-=S,C++);const x=f[C].getWidth(w-1)===2;x&&w--;const y=x?d-1:d;_.push(y),b+=y}return _},o.getWrappedLineTrimmedLength=c},5295:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.BufferSet=void 0;const f=c(8460),p=c(844),d=c(9092);class _ extends p.Disposable{constructor(w,C){super(),this._optionsService=w,this._bufferService=C,this._onBufferActivate=this.register(new f.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(w){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(w),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(w,C){this._normal.resize(w,C),this._alt.resize(w,C),this.setupTabStops(w)}setupTabStops(w){this._normal.setupTabStops(w),this._alt.setupTabStops(w)}}o.BufferSet=_},511:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.CellData=void 0;const f=c(482),p=c(643),d=c(3734);class _ extends d.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new d.ExtendedAttrs,this.combinedData=""}static fromCharData(w){const C=new _;return C.setFromCharData(w),C}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,f.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(w){this.fg=w[p.CHAR_DATA_ATTR_INDEX],this.bg=0;let C=!1;if(w[p.CHAR_DATA_CHAR_INDEX].length>2)C=!0;else if(w[p.CHAR_DATA_CHAR_INDEX].length===2){const b=w[p.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=b&&b<=56319){const S=w[p.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=S&&S<=57343?this.content=1024*(b-55296)+S-56320+65536|w[p.CHAR_DATA_WIDTH_INDEX]<<22:C=!0}else C=!0}else this.content=w[p.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|w[p.CHAR_DATA_WIDTH_INDEX]<<22;C&&(this.combinedData=w[p.CHAR_DATA_CHAR_INDEX],this.content=2097152|w[p.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}o.CellData=_},643:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.WHITESPACE_CELL_CODE=o.WHITESPACE_CELL_WIDTH=o.WHITESPACE_CELL_CHAR=o.NULL_CELL_CODE=o.NULL_CELL_WIDTH=o.NULL_CELL_CHAR=o.CHAR_DATA_CODE_INDEX=o.CHAR_DATA_WIDTH_INDEX=o.CHAR_DATA_CHAR_INDEX=o.CHAR_DATA_ATTR_INDEX=o.DEFAULT_EXT=o.DEFAULT_ATTR=o.DEFAULT_COLOR=void 0,o.DEFAULT_COLOR=0,o.DEFAULT_ATTR=256|o.DEFAULT_COLOR<<9,o.DEFAULT_EXT=0,o.CHAR_DATA_ATTR_INDEX=0,o.CHAR_DATA_CHAR_INDEX=1,o.CHAR_DATA_WIDTH_INDEX=2,o.CHAR_DATA_CODE_INDEX=3,o.NULL_CELL_CHAR="",o.NULL_CELL_WIDTH=1,o.NULL_CELL_CODE=0,o.WHITESPACE_CELL_CHAR=" ",o.WHITESPACE_CELL_WIDTH=1,o.WHITESPACE_CELL_CODE=32},4863:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.Marker=void 0;const f=c(8460),p=c(844);class d{get id(){return this._id}constructor(v){this.line=v,this.isDisposed=!1,this._disposables=[],this._id=d._nextId++,this._onDispose=this.register(new f.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,p.disposeArray)(this._disposables),this._disposables.length=0)}register(v){return this._disposables.push(v),v}}o.Marker=d,d._nextId=1},7116:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.DEFAULT_CHARSET=o.CHARSETS=void 0,o.CHARSETS={},o.DEFAULT_CHARSET=o.CHARSETS.B,o.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:"≥","{":"π","|":"≠","}":"£","~":"·"},o.CHARSETS.A={"#":"£"},o.CHARSETS.B=void 0,o.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},o.CHARSETS.C=o.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},o.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},o.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},o.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},o.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},o.CHARSETS.E=o.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},o.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},o.CHARSETS.H=o.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},o.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(u,o)=>{var c,f,p;Object.defineProperty(o,"__esModule",{value:!0}),o.C1_ESCAPED=o.C1=o.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=` +`,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=""})(c||(o.C0=c={})),(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="Ÿ"})(f||(o.C1=f={})),(function(d){d.ST=`${c.ESC}\\`})(p||(o.C1_ESCAPED=p={}))},7399:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.evaluateKeyboardEvent=void 0;const f=c(2584),p={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:["'",'"']};o.evaluateKeyboardEvent=function(d,_,v,w){const C={type:0,cancel:!1,key:void 0},b=(d.shiftKey?1:0)|(d.altKey?2:0)|(d.ctrlKey?4:0)|(d.metaKey?8:0);switch(d.keyCode){case 0:d.key==="UIKeyInputUpArrow"?C.key=_?f.C0.ESC+"OA":f.C0.ESC+"[A":d.key==="UIKeyInputLeftArrow"?C.key=_?f.C0.ESC+"OD":f.C0.ESC+"[D":d.key==="UIKeyInputRightArrow"?C.key=_?f.C0.ESC+"OC":f.C0.ESC+"[C":d.key==="UIKeyInputDownArrow"&&(C.key=_?f.C0.ESC+"OB":f.C0.ESC+"[B");break;case 8:C.key=d.ctrlKey?"\b":f.C0.DEL,d.altKey&&(C.key=f.C0.ESC+C.key);break;case 9:if(d.shiftKey){C.key=f.C0.ESC+"[Z";break}C.key=f.C0.HT,C.cancel=!0;break;case 13:C.key=d.altKey?f.C0.ESC+f.C0.CR:f.C0.CR,C.cancel=!0;break;case 27:C.key=f.C0.ESC,d.altKey&&(C.key=f.C0.ESC+f.C0.ESC),C.cancel=!0;break;case 37:if(d.metaKey)break;b?(C.key=f.C0.ESC+"[1;"+(b+1)+"D",C.key===f.C0.ESC+"[1;3D"&&(C.key=f.C0.ESC+(v?"b":"[1;5D"))):C.key=_?f.C0.ESC+"OD":f.C0.ESC+"[D";break;case 39:if(d.metaKey)break;b?(C.key=f.C0.ESC+"[1;"+(b+1)+"C",C.key===f.C0.ESC+"[1;3C"&&(C.key=f.C0.ESC+(v?"f":"[1;5C"))):C.key=_?f.C0.ESC+"OC":f.C0.ESC+"[C";break;case 38:if(d.metaKey)break;b?(C.key=f.C0.ESC+"[1;"+(b+1)+"A",v||C.key!==f.C0.ESC+"[1;3A"||(C.key=f.C0.ESC+"[1;5A")):C.key=_?f.C0.ESC+"OA":f.C0.ESC+"[A";break;case 40:if(d.metaKey)break;b?(C.key=f.C0.ESC+"[1;"+(b+1)+"B",v||C.key!==f.C0.ESC+"[1;3B"||(C.key=f.C0.ESC+"[1;5B")):C.key=_?f.C0.ESC+"OB":f.C0.ESC+"[B";break;case 45:d.shiftKey||d.ctrlKey||(C.key=f.C0.ESC+"[2~");break;case 46:C.key=b?f.C0.ESC+"[3;"+(b+1)+"~":f.C0.ESC+"[3~";break;case 36:C.key=b?f.C0.ESC+"[1;"+(b+1)+"H":_?f.C0.ESC+"OH":f.C0.ESC+"[H";break;case 35:C.key=b?f.C0.ESC+"[1;"+(b+1)+"F":_?f.C0.ESC+"OF":f.C0.ESC+"[F";break;case 33:d.shiftKey?C.type=2:d.ctrlKey?C.key=f.C0.ESC+"[5;"+(b+1)+"~":C.key=f.C0.ESC+"[5~";break;case 34:d.shiftKey?C.type=3:d.ctrlKey?C.key=f.C0.ESC+"[6;"+(b+1)+"~":C.key=f.C0.ESC+"[6~";break;case 112:C.key=b?f.C0.ESC+"[1;"+(b+1)+"P":f.C0.ESC+"OP";break;case 113:C.key=b?f.C0.ESC+"[1;"+(b+1)+"Q":f.C0.ESC+"OQ";break;case 114:C.key=b?f.C0.ESC+"[1;"+(b+1)+"R":f.C0.ESC+"OR";break;case 115:C.key=b?f.C0.ESC+"[1;"+(b+1)+"S":f.C0.ESC+"OS";break;case 116:C.key=b?f.C0.ESC+"[15;"+(b+1)+"~":f.C0.ESC+"[15~";break;case 117:C.key=b?f.C0.ESC+"[17;"+(b+1)+"~":f.C0.ESC+"[17~";break;case 118:C.key=b?f.C0.ESC+"[18;"+(b+1)+"~":f.C0.ESC+"[18~";break;case 119:C.key=b?f.C0.ESC+"[19;"+(b+1)+"~":f.C0.ESC+"[19~";break;case 120:C.key=b?f.C0.ESC+"[20;"+(b+1)+"~":f.C0.ESC+"[20~";break;case 121:C.key=b?f.C0.ESC+"[21;"+(b+1)+"~":f.C0.ESC+"[21~";break;case 122:C.key=b?f.C0.ESC+"[23;"+(b+1)+"~":f.C0.ESC+"[23~";break;case 123:C.key=b?f.C0.ESC+"[24;"+(b+1)+"~":f.C0.ESC+"[24~";break;default:if(!d.ctrlKey||d.shiftKey||d.altKey||d.metaKey)if(v&&!w||!d.altKey||d.metaKey)!v||d.altKey||d.ctrlKey||d.shiftKey||!d.metaKey?d.key&&!d.ctrlKey&&!d.altKey&&!d.metaKey&&d.keyCode>=48&&d.key.length===1?C.key=d.key:d.key&&d.ctrlKey&&(d.key==="_"&&(C.key=f.C0.US),d.key==="@"&&(C.key=f.C0.NUL)):d.keyCode===65&&(C.type=1);else{const S=p[d.keyCode],x=S==null?void 0:S[d.shiftKey?1:0];if(x)C.key=f.C0.ESC+x;else if(d.keyCode>=65&&d.keyCode<=90){const y=d.ctrlKey?d.keyCode-64:d.keyCode+32;let k=String.fromCharCode(y);d.shiftKey&&(k=k.toUpperCase()),C.key=f.C0.ESC+k}else if(d.keyCode===32)C.key=f.C0.ESC+(d.ctrlKey?f.C0.NUL:" ");else if(d.key==="Dead"&&d.code.startsWith("Key")){let y=d.code.slice(3,4);d.shiftKey||(y=y.toLowerCase()),C.key=f.C0.ESC+y,C.cancel=!0}}else d.keyCode>=65&&d.keyCode<=90?C.key=String.fromCharCode(d.keyCode-64):d.keyCode===32?C.key=f.C0.NUL:d.keyCode>=51&&d.keyCode<=55?C.key=String.fromCharCode(d.keyCode-51+27):d.keyCode===56?C.key=f.C0.DEL:d.keyCode===219?C.key=f.C0.ESC:d.keyCode===220?C.key=f.C0.FS:d.keyCode===221&&(C.key=f.C0.GS)}return C}},482:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.Utf8ToUtf32=o.StringToUtf32=o.utf32ToString=o.stringFromCodePoint=void 0,o.stringFromCodePoint=function(c){return c>65535?(c-=65536,String.fromCharCode(55296+(c>>10))+String.fromCharCode(c%1024+56320)):String.fromCharCode(c)},o.utf32ToString=function(c,f=0,p=c.length){let d="";for(let _=f;_65535?(v-=65536,d+=String.fromCharCode(55296+(v>>10))+String.fromCharCode(v%1024+56320)):d+=String.fromCharCode(v)}return d},o.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(c,f){const p=c.length;if(!p)return 0;let d=0,_=0;if(this._interim){const v=c.charCodeAt(_++);56320<=v&&v<=57343?f[d++]=1024*(this._interim-55296)+v-56320+65536:(f[d++]=this._interim,f[d++]=v),this._interim=0}for(let v=_;v=p)return this._interim=w,d;const C=c.charCodeAt(v);56320<=C&&C<=57343?f[d++]=1024*(w-55296)+C-56320+65536:(f[d++]=w,f[d++]=C)}else w!==65279&&(f[d++]=w)}return d}},o.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(c,f){const p=c.length;if(!p)return 0;let d,_,v,w,C=0,b=0,S=0;if(this.interim[0]){let k=!1,D=this.interim[0];D&=(224&D)==192?31:(240&D)==224?15:7;let T,R=0;for(;(T=63&this.interim[++R])&&R<4;)D<<=6,D|=T;const N=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,M=N-R;for(;S=p)return 0;if(T=c[S++],(192&T)!=128){S--,k=!0;break}this.interim[R++]=T,D<<=6,D|=63&T}k||(N===2?D<128?S--:f[C++]=D:N===3?D<2048||D>=55296&&D<=57343||D===65279||(f[C++]=D):D<65536||D>1114111||(f[C++]=D)),this.interim.fill(0)}const x=p-4;let y=S;for(;y=p)return this.interim[0]=d,C;if(_=c[y++],(192&_)!=128){y--;continue}if(b=(31&d)<<6|63&_,b<128){y--;continue}f[C++]=b}else if((240&d)==224){if(y>=p)return this.interim[0]=d,C;if(_=c[y++],(192&_)!=128){y--;continue}if(y>=p)return this.interim[0]=d,this.interim[1]=_,C;if(v=c[y++],(192&v)!=128){y--;continue}if(b=(15&d)<<12|(63&_)<<6|63&v,b<2048||b>=55296&&b<=57343||b===65279)continue;f[C++]=b}else if((248&d)==240){if(y>=p)return this.interim[0]=d,C;if(_=c[y++],(192&_)!=128){y--;continue}if(y>=p)return this.interim[0]=d,this.interim[1]=_,C;if(v=c[y++],(192&v)!=128){y--;continue}if(y>=p)return this.interim[0]=d,this.interim[1]=_,this.interim[2]=v,C;if(w=c[y++],(192&w)!=128){y--;continue}if(b=(7&d)<<18|(63&_)<<12|(63&v)<<6|63&w,b<65536||b>1114111)continue;f[C++]=b}}return C}}},225:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.UnicodeV6=void 0;const f=c(1480),p=[[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 _;o.UnicodeV6=class{constructor(){if(this.version="6",!_){_=new Uint8Array(65536),_.fill(1),_[0]=0,_.fill(0,1,32),_.fill(0,127,160),_.fill(2,4352,4448),_[9001]=2,_[9002]=2,_.fill(2,11904,42192),_[12351]=1,_.fill(2,44032,55204),_.fill(2,63744,64256),_.fill(2,65040,65050),_.fill(2,65072,65136),_.fill(2,65280,65377),_.fill(2,65504,65511);for(let v=0;vC[x][1])return!1;for(;x>=S;)if(b=S+x>>1,w>C[b][1])S=b+1;else{if(!(w=131072&&v<=196605||v>=196608&&v<=262141?2:1}charProperties(v,w){let C=this.wcwidth(v),b=C===0&&w!==0;if(b){const S=f.UnicodeService.extractWidth(w);S===0?b=!1:S>C&&(C=S)}return f.UnicodeService.createPropertyValue(0,C,b)}}},5981:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.WriteBuffer=void 0;const f=c(8460),p=c(844);class d extends p.Disposable{constructor(v){super(),this._action=v,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new f.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(v,w){if(w!==void 0&&this._syncCalls>w)return void(this._syncCalls=0);if(this._pendingData+=v.length,this._writeBuffer.push(v),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let C;for(this._isSyncWriting=!0;C=this._writeBuffer.shift();){this._action(C);const b=this._callbacks.shift();b&&b()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(v,w){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+=v.length,this._writeBuffer.push(v),this._callbacks.push(w),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=v.length,this._writeBuffer.push(v),this._callbacks.push(w)}_innerWrite(v=0,w=!0){const C=v||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const b=this._writeBuffer[this._bufferOffset],S=this._action(b,w);if(S){const y=k=>Date.now()-C>=12?setTimeout((()=>this._innerWrite(0,k))):this._innerWrite(C,k);return void S.catch((k=>(queueMicrotask((()=>{throw k})),Promise.resolve(!1)))).then(y)}const x=this._callbacks[this._bufferOffset];if(x&&x(),this._bufferOffset++,this._pendingData-=b.length,Date.now()-C>=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()}}o.WriteBuffer=d},5941:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.toRgbString=o.parseColor=void 0;const c=/^([\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})$/,f=/^[\da-f]+$/;function p(d,_){const v=d.toString(16),w=v.length<2?"0"+v:v;switch(_){case 4:return v[0];case 8:return w;case 12:return(w+w).slice(0,3);default:return w+w}}o.parseColor=function(d){if(!d)return;let _=d.toLowerCase();if(_.indexOf("rgb:")===0){_=_.slice(4);const v=c.exec(_);if(v){const w=v[1]?15:v[4]?255:v[7]?4095:65535;return[Math.round(parseInt(v[1]||v[4]||v[7]||v[10],16)/w*255),Math.round(parseInt(v[2]||v[5]||v[8]||v[11],16)/w*255),Math.round(parseInt(v[3]||v[6]||v[9]||v[12],16)/w*255)]}}else if(_.indexOf("#")===0&&(_=_.slice(1),f.exec(_)&&[3,6,9,12].includes(_.length))){const v=_.length/3,w=[0,0,0];for(let C=0;C<3;++C){const b=parseInt(_.slice(v*C,v*C+v),16);w[C]=v===1?b<<4:v===2?b:v===3?b>>4:b>>8}return w}},o.toRgbString=function(d,_=16){const[v,w,C]=d;return`rgb:${p(v,_)}/${p(w,_)}/${p(C,_)}`}},5770:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.PAYLOAD_LIMIT=void 0,o.PAYLOAD_LIMIT=1e7},6351:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.DcsHandler=o.DcsParser=void 0;const f=c(482),p=c(8742),d=c(5770),_=[];o.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=_,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=_}registerHandler(w,C){this._handlers[w]===void 0&&(this._handlers[w]=[]);const b=this._handlers[w];return b.push(C),{dispose:()=>{const S=b.indexOf(C);S!==-1&&b.splice(S,1)}}}clearHandler(w){this._handlers[w]&&delete this._handlers[w]}setHandlerFallback(w){this._handlerFb=w}reset(){if(this._active.length)for(let w=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;w>=0;--w)this._active[w].unhook(!1);this._stack.paused=!1,this._active=_,this._ident=0}hook(w,C){if(this.reset(),this._ident=w,this._active=this._handlers[w]||_,this._active.length)for(let b=this._active.length-1;b>=0;b--)this._active[b].hook(C);else this._handlerFb(this._ident,"HOOK",C)}put(w,C,b){if(this._active.length)for(let S=this._active.length-1;S>=0;S--)this._active[S].put(w,C,b);else this._handlerFb(this._ident,"PUT",(0,f.utf32ToString)(w,C,b))}unhook(w,C=!0){if(this._active.length){let b=!1,S=this._active.length-1,x=!1;if(this._stack.paused&&(S=this._stack.loopPosition-1,b=C,x=this._stack.fallThrough,this._stack.paused=!1),!x&&b===!1){for(;S>=0&&(b=this._active[S].unhook(w),b!==!0);S--)if(b instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=S,this._stack.fallThrough=!1,b;S--}for(;S>=0;S--)if(b=this._active[S].unhook(!1),b instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=S,this._stack.fallThrough=!0,b}else this._handlerFb(this._ident,"UNHOOK",w);this._active=_,this._ident=0}};const v=new p.Params;v.addParam(0),o.DcsHandler=class{constructor(w){this._handler=w,this._data="",this._params=v,this._hitLimit=!1}hook(w){this._params=w.length>1||w.params[0]?w.clone():v,this._data="",this._hitLimit=!1}put(w,C,b){this._hitLimit||(this._data+=(0,f.utf32ToString)(w,C,b),this._data.length>d.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(w){let C=!1;if(this._hitLimit)C=!1;else if(w&&(C=this._handler(this._data,this._params),C instanceof Promise))return C.then((b=>(this._params=v,this._data="",this._hitLimit=!1,b)));return this._params=v,this._data="",this._hitLimit=!1,C}}},2015:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.EscapeSequenceParser=o.VT500_TRANSITION_TABLE=o.TransitionTable=void 0;const f=c(844),p=c(8742),d=c(6242),_=c(6351);class v{constructor(S){this.table=new Uint8Array(S)}setDefault(S,x){this.table.fill(S<<4|x)}add(S,x,y,k){this.table[x<<8|S]=y<<4|k}addMany(S,x,y,k){for(let D=0;DN)),x=(R,N)=>S.slice(R,N),y=x(32,127),k=x(0,24);k.push(25),k.push.apply(k,x(28,32));const D=x(0,14);let T;for(T in b.setDefault(1,0),b.addMany(y,0,2,0),D)b.addMany([24,26,153,154],T,3,0),b.addMany(x(128,144),T,3,0),b.addMany(x(144,152),T,3,0),b.add(156,T,0,0),b.add(27,T,11,1),b.add(157,T,4,8),b.addMany([152,158,159],T,0,7),b.add(155,T,11,3),b.add(144,T,11,9);return b.addMany(k,0,3,0),b.addMany(k,1,3,1),b.add(127,1,0,1),b.addMany(k,8,0,8),b.addMany(k,3,3,3),b.add(127,3,0,3),b.addMany(k,4,3,4),b.add(127,4,0,4),b.addMany(k,6,3,6),b.addMany(k,5,3,5),b.add(127,5,0,5),b.addMany(k,2,3,2),b.add(127,2,0,2),b.add(93,1,4,8),b.addMany(y,8,5,8),b.add(127,8,5,8),b.addMany([156,27,24,26,7],8,6,0),b.addMany(x(28,32),8,0,8),b.addMany([88,94,95],1,0,7),b.addMany(y,7,0,7),b.addMany(k,7,0,7),b.add(156,7,0,0),b.add(127,7,0,7),b.add(91,1,11,3),b.addMany(x(64,127),3,7,0),b.addMany(x(48,60),3,8,4),b.addMany([60,61,62,63],3,9,4),b.addMany(x(48,60),4,8,4),b.addMany(x(64,127),4,7,0),b.addMany([60,61,62,63],4,0,6),b.addMany(x(32,64),6,0,6),b.add(127,6,0,6),b.addMany(x(64,127),6,0,0),b.addMany(x(32,48),3,9,5),b.addMany(x(32,48),5,9,5),b.addMany(x(48,64),5,0,6),b.addMany(x(64,127),5,7,0),b.addMany(x(32,48),4,9,5),b.addMany(x(32,48),1,9,2),b.addMany(x(32,48),2,9,2),b.addMany(x(48,127),2,10,0),b.addMany(x(48,80),1,10,0),b.addMany(x(81,88),1,10,0),b.addMany([89,90,92],1,10,0),b.addMany(x(96,127),1,10,0),b.add(80,1,11,9),b.addMany(k,9,0,9),b.add(127,9,0,9),b.addMany(x(28,32),9,0,9),b.addMany(x(32,48),9,9,12),b.addMany(x(48,60),9,8,10),b.addMany([60,61,62,63],9,9,10),b.addMany(k,11,0,11),b.addMany(x(32,128),11,0,11),b.addMany(x(28,32),11,0,11),b.addMany(k,10,0,10),b.add(127,10,0,10),b.addMany(x(28,32),10,0,10),b.addMany(x(48,60),10,8,10),b.addMany([60,61,62,63],10,0,11),b.addMany(x(32,48),10,9,12),b.addMany(k,12,0,12),b.add(127,12,0,12),b.addMany(x(28,32),12,0,12),b.addMany(x(32,48),12,9,12),b.addMany(x(48,64),12,0,11),b.addMany(x(64,127),12,12,13),b.addMany(x(64,127),10,12,13),b.addMany(x(64,127),9,12,13),b.addMany(k,13,13,13),b.addMany(y,13,13,13),b.add(127,13,0,13),b.addMany([27,156,24,26],13,14,0),b.add(w,0,2,0),b.add(w,8,5,8),b.add(w,6,0,6),b.add(w,11,0,11),b.add(w,13,13,13),b})();class C extends f.Disposable{constructor(S=o.VT500_TRANSITION_TABLE){super(),this._transitions=S,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new p.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(x,y,k)=>{},this._executeHandlerFb=x=>{},this._csiHandlerFb=(x,y)=>{},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,f.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 _.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(S,x=[64,126]){let y=0;if(S.prefix){if(S.prefix.length>1)throw new Error("only one byte as prefix supported");if(y=S.prefix.charCodeAt(0),y&&60>y||y>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(S.intermediates){if(S.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let D=0;DT||T>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");y<<=8,y|=T}}if(S.final.length!==1)throw new Error("final must be a single byte");const k=S.final.charCodeAt(0);if(x[0]>k||k>x[1])throw new Error(`final must be in range ${x[0]} .. ${x[1]}`);return y<<=8,y|=k,y}identToString(S){const x=[];for(;S;)x.push(String.fromCharCode(255&S)),S>>=8;return x.reverse().join("")}setPrintHandler(S){this._printHandler=S}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(S,x){const y=this._identifier(S,[48,126]);this._escHandlers[y]===void 0&&(this._escHandlers[y]=[]);const k=this._escHandlers[y];return k.push(x),{dispose:()=>{const D=k.indexOf(x);D!==-1&&k.splice(D,1)}}}clearEscHandler(S){this._escHandlers[this._identifier(S,[48,126])]&&delete this._escHandlers[this._identifier(S,[48,126])]}setEscHandlerFallback(S){this._escHandlerFb=S}setExecuteHandler(S,x){this._executeHandlers[S.charCodeAt(0)]=x}clearExecuteHandler(S){this._executeHandlers[S.charCodeAt(0)]&&delete this._executeHandlers[S.charCodeAt(0)]}setExecuteHandlerFallback(S){this._executeHandlerFb=S}registerCsiHandler(S,x){const y=this._identifier(S);this._csiHandlers[y]===void 0&&(this._csiHandlers[y]=[]);const k=this._csiHandlers[y];return k.push(x),{dispose:()=>{const D=k.indexOf(x);D!==-1&&k.splice(D,1)}}}clearCsiHandler(S){this._csiHandlers[this._identifier(S)]&&delete this._csiHandlers[this._identifier(S)]}setCsiHandlerFallback(S){this._csiHandlerFb=S}registerDcsHandler(S,x){return this._dcsParser.registerHandler(this._identifier(S),x)}clearDcsHandler(S){this._dcsParser.clearHandler(this._identifier(S))}setDcsHandlerFallback(S){this._dcsParser.setHandlerFallback(S)}registerOscHandler(S,x){return this._oscParser.registerHandler(S,x)}clearOscHandler(S){this._oscParser.clearHandler(S)}setOscHandlerFallback(S){this._oscParser.setHandlerFallback(S)}setErrorHandler(S){this._errorHandler=S}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(S,x,y,k,D){this._parseStack.state=S,this._parseStack.handlers=x,this._parseStack.handlerPos=y,this._parseStack.transition=k,this._parseStack.chunkPos=D}parse(S,x,y){let k,D=0,T=0,R=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,R=this._parseStack.chunkPos+1;else{if(y===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const N=this._parseStack.handlers;let M=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(y===!1&&M>-1){for(;M>=0&&(k=N[M](this._params),k!==!0);M--)if(k instanceof Promise)return this._parseStack.handlerPos=M,k}this._parseStack.handlers=[];break;case 4:if(y===!1&&M>-1){for(;M>=0&&(k=N[M](),k!==!0);M--)if(k instanceof Promise)return this._parseStack.handlerPos=M,k}this._parseStack.handlers=[];break;case 6:if(D=S[this._parseStack.chunkPos],k=this._dcsParser.unhook(D!==24&&D!==26,y),k)return k;D===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(D=S[this._parseStack.chunkPos],k=this._oscParser.end(D!==24&&D!==26,y),k)return k;D===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,R=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let N=R;N>4){case 2:for(let F=N+1;;++F){if(F>=x||(D=S[F])<32||D>126&&D=x||(D=S[F])<32||D>126&&D=x||(D=S[F])<32||D>126&&D=x||(D=S[F])<32||D>126&&D=0&&(k=M[B](this._params),k!==!0);B--)if(k instanceof Promise)return this._preserveStack(3,M,B,T,N),k;B<0&&this._csiHandlerFb(this._collect<<8|D,this._params),this.precedingJoinState=0;break;case 8:do switch(D){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(D-48)}while(++N47&&D<60);N--;break;case 9:this._collect<<=8,this._collect|=D;break;case 10:const H=this._escHandlers[this._collect<<8|D];let Y=H?H.length-1:-1;for(;Y>=0&&(k=H[Y](),k!==!0);Y--)if(k instanceof Promise)return this._preserveStack(4,H,Y,T,N),k;Y<0&&this._escHandlerFb(this._collect<<8|D),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|D,this._params);break;case 13:for(let F=N+1;;++F)if(F>=x||(D=S[F])===24||D===26||D===27||D>127&&D=x||(D=S[F])<32||D>127&&D{Object.defineProperty(o,"__esModule",{value:!0}),o.OscHandler=o.OscParser=void 0;const f=c(5770),p=c(482),d=[];o.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(_,v){this._handlers[_]===void 0&&(this._handlers[_]=[]);const w=this._handlers[_];return w.push(v),{dispose:()=>{const C=w.indexOf(v);C!==-1&&w.splice(C,1)}}}clearHandler(_){this._handlers[_]&&delete this._handlers[_]}setHandlerFallback(_){this._handlerFb=_}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=d}reset(){if(this._state===2)for(let _=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;_>=0;--_)this._active[_].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 _=this._active.length-1;_>=0;_--)this._active[_].start();else this._handlerFb(this._id,"START")}_put(_,v,w){if(this._active.length)for(let C=this._active.length-1;C>=0;C--)this._active[C].put(_,v,w);else this._handlerFb(this._id,"PUT",(0,p.utf32ToString)(_,v,w))}start(){this.reset(),this._state=1}put(_,v,w){if(this._state!==3){if(this._state===1)for(;v0&&this._put(_,v,w)}}end(_,v=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let w=!1,C=this._active.length-1,b=!1;if(this._stack.paused&&(C=this._stack.loopPosition-1,w=v,b=this._stack.fallThrough,this._stack.paused=!1),!b&&w===!1){for(;C>=0&&(w=this._active[C].end(_),w!==!0);C--)if(w instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=C,this._stack.fallThrough=!1,w;C--}for(;C>=0;C--)if(w=this._active[C].end(!1),w instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=C,this._stack.fallThrough=!0,w}else this._handlerFb(this._id,"END",_);this._active=d,this._id=-1,this._state=0}}},o.OscHandler=class{constructor(_){this._handler=_,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(_,v,w){this._hitLimit||(this._data+=(0,p.utf32ToString)(_,v,w),this._data.length>f.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(_){let v=!1;if(this._hitLimit)v=!1;else if(_&&(v=this._handler(this._data),v instanceof Promise))return v.then((w=>(this._data="",this._hitLimit=!1,w)));return this._data="",this._hitLimit=!1,v}}},8742:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.Params=void 0;const c=2147483647;class f{static fromArray(d){const _=new f;if(!d.length)return _;for(let v=Array.isArray(d[0])?1:0;v256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(d),this.length=0,this._subParams=new Int32Array(_),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(d),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const d=new f(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 _=0;_>8,w=255&this._subParamsIdx[_];w-v>0&&d.push(Array.prototype.slice.call(this._subParams,v,w))}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>c?c: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>c?c:d,this._subParamsIdx[this.length-1]++}}hasSubParams(d){return(255&this._subParamsIdx[d])-(this._subParamsIdx[d]>>8)>0}getSubParams(d){const _=this._subParamsIdx[d]>>8,v=255&this._subParamsIdx[d];return v-_>0?this._subParams.subarray(_,v):null}getSubParamsAll(){const d={};for(let _=0;_>8,w=255&this._subParamsIdx[_];w-v>0&&(d[_]=this._subParams.slice(v,w))}return d}addDigit(d){let _;if(this._rejectDigits||!(_=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const v=this._digitIsSub?this._subParams:this.params,w=v[_-1];v[_-1]=~w?Math.min(10*w+d,c):d}}o.Params=f},5741:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.AddonManager=void 0,o.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let c=this._addons.length-1;c>=0;c--)this._addons[c].instance.dispose()}loadAddon(c,f){const p={instance:f,dispose:f.dispose,isDisposed:!1};this._addons.push(p),f.dispose=()=>this._wrappedAddonDispose(p),f.activate(c)}_wrappedAddonDispose(c){if(c.isDisposed)return;let f=-1;for(let p=0;p{Object.defineProperty(o,"__esModule",{value:!0}),o.BufferApiView=void 0;const f=c(3785),p=c(511);o.BufferApiView=class{constructor(d,_){this._buffer=d,this.type=_}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 _=this._buffer.lines.get(d);if(_)return new f.BufferLineApiView(_)}getNullCell(){return new p.CellData}}},3785:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.BufferLineApiView=void 0;const f=c(511);o.BufferLineApiView=class{constructor(p){this._line=p}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(p,d){if(!(p<0||p>=this._line.length))return d?(this._line.loadCell(p,d),d):this._line.loadCell(p,new f.CellData)}translateToString(p,d,_){return this._line.translateToString(p,d,_)}}},8285:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.BufferNamespaceApi=void 0;const f=c(8771),p=c(8460),d=c(844);class _ extends d.Disposable{constructor(w){super(),this._core=w,this._onBufferChange=this.register(new p.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new f.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new f.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)}}o.BufferNamespaceApi=_},7975:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.ParserApi=void 0,o.ParserApi=class{constructor(c){this._core=c}registerCsiHandler(c,f){return this._core.registerCsiHandler(c,(p=>f(p.toArray())))}addCsiHandler(c,f){return this.registerCsiHandler(c,f)}registerDcsHandler(c,f){return this._core.registerDcsHandler(c,((p,d)=>f(p,d.toArray())))}addDcsHandler(c,f){return this.registerDcsHandler(c,f)}registerEscHandler(c,f){return this._core.registerEscHandler(c,f)}addEscHandler(c,f){return this.registerEscHandler(c,f)}registerOscHandler(c,f){return this._core.registerOscHandler(c,f)}addOscHandler(c,f){return this.registerOscHandler(c,f)}}},7090:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.UnicodeApi=void 0,o.UnicodeApi=class{constructor(c){this._core=c}register(c){this._core.unicodeService.register(c)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(c){this._core.unicodeService.activeVersion=c}}},744:function(u,o,c){var f=this&&this.__decorate||function(b,S,x,y){var k,D=arguments.length,T=D<3?S:y===null?y=Object.getOwnPropertyDescriptor(S,x):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(b,S,x,y);else for(var R=b.length-1;R>=0;R--)(k=b[R])&&(T=(D<3?k(T):D>3?k(S,x,T):k(S,x))||T);return D>3&&T&&Object.defineProperty(S,x,T),T},p=this&&this.__param||function(b,S){return function(x,y){S(x,y,b)}};Object.defineProperty(o,"__esModule",{value:!0}),o.BufferService=o.MINIMUM_ROWS=o.MINIMUM_COLS=void 0;const d=c(8460),_=c(844),v=c(5295),w=c(2585);o.MINIMUM_COLS=2,o.MINIMUM_ROWS=1;let C=o.BufferService=class extends _.Disposable{get buffer(){return this.buffers.active}constructor(b){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(b.rawOptions.cols||0,o.MINIMUM_COLS),this.rows=Math.max(b.rawOptions.rows||0,o.MINIMUM_ROWS),this.buffers=this.register(new v.BufferSet(b,this))}resize(b,S){this.cols=b,this.rows=S,this.buffers.resize(b,S),this._onResize.fire({cols:b,rows:S})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(b,S=!1){const x=this.buffer;let y;y=this._cachedBlankLine,y&&y.length===this.cols&&y.getFg(0)===b.fg&&y.getBg(0)===b.bg||(y=x.getBlankLine(b,S),this._cachedBlankLine=y),y.isWrapped=S;const k=x.ybase+x.scrollTop,D=x.ybase+x.scrollBottom;if(x.scrollTop===0){const T=x.lines.isFull;D===x.lines.length-1?T?x.lines.recycle().copyFrom(y):x.lines.push(y.clone()):x.lines.splice(D+1,0,y.clone()),T?this.isUserScrolling&&(x.ydisp=Math.max(x.ydisp-1,0)):(x.ybase++,this.isUserScrolling||x.ydisp++)}else{const T=D-k+1;x.lines.shiftElements(k+1,T-1,-1),x.lines.set(D,y.clone())}this.isUserScrolling||(x.ydisp=x.ybase),this._onScroll.fire(x.ydisp)}scrollLines(b,S,x){const y=this.buffer;if(b<0){if(y.ydisp===0)return;this.isUserScrolling=!0}else b+y.ydisp>=y.ybase&&(this.isUserScrolling=!1);const k=y.ydisp;y.ydisp=Math.max(Math.min(y.ydisp+b,y.ybase),0),k!==y.ydisp&&(S||this._onScroll.fire(y.ydisp))}};o.BufferService=C=f([p(0,w.IOptionsService)],C)},7994:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.CharsetService=void 0,o.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(c){this.glevel=c,this.charset=this._charsets[c]}setgCharset(c,f){this._charsets[c]=f,this.glevel===c&&(this.charset=f)}}},1753:function(u,o,c){var f=this&&this.__decorate||function(y,k,D,T){var R,N=arguments.length,M=N<3?k:T===null?T=Object.getOwnPropertyDescriptor(k,D):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")M=Reflect.decorate(y,k,D,T);else for(var B=y.length-1;B>=0;B--)(R=y[B])&&(M=(N<3?R(M):N>3?R(k,D,M):R(k,D))||M);return N>3&&M&&Object.defineProperty(k,D,M),M},p=this&&this.__param||function(y,k){return function(D,T){k(D,T,y)}};Object.defineProperty(o,"__esModule",{value:!0}),o.CoreMouseService=void 0;const d=c(2585),_=c(8460),v=c(844),w={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:y=>y.button!==4&&y.action===1&&(y.ctrl=!1,y.alt=!1,y.shift=!1,!0)},VT200:{events:19,restrict:y=>y.action!==32},DRAG:{events:23,restrict:y=>y.action!==32||y.button!==3},ANY:{events:31,restrict:y=>!0}};function C(y,k){let D=(y.ctrl?16:0)|(y.shift?4:0)|(y.alt?8:0);return y.button===4?(D|=64,D|=y.action):(D|=3&y.button,4&y.button&&(D|=64),8&y.button&&(D|=128),y.action===32?D|=32:y.action!==0||k||(D|=3)),D}const b=String.fromCharCode,S={DEFAULT:y=>{const k=[C(y,!1)+32,y.col+32,y.row+32];return k[0]>255||k[1]>255||k[2]>255?"":`\x1B[M${b(k[0])}${b(k[1])}${b(k[2])}`},SGR:y=>{const k=y.action===0&&y.button!==4?"m":"M";return`\x1B[<${C(y,!0)};${y.col};${y.row}${k}`},SGR_PIXELS:y=>{const k=y.action===0&&y.button!==4?"m":"M";return`\x1B[<${C(y,!0)};${y.x};${y.y}${k}`}};let x=o.CoreMouseService=class extends v.Disposable{constructor(y,k){super(),this._bufferService=y,this._coreService=k,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new _.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const D of Object.keys(w))this.addProtocol(D,w[D]);for(const D of Object.keys(S))this.addEncoding(D,S[D]);this.reset()}addProtocol(y,k){this._protocols[y]=k}addEncoding(y,k){this._encodings[y]=k}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(y){if(!this._protocols[y])throw new Error(`unknown protocol "${y}"`);this._activeProtocol=y,this._onProtocolChange.fire(this._protocols[y].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(y){if(!this._encodings[y])throw new Error(`unknown encoding "${y}"`);this._activeEncoding=y}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(y){if(y.col<0||y.col>=this._bufferService.cols||y.row<0||y.row>=this._bufferService.rows||y.button===4&&y.action===32||y.button===3&&y.action!==32||y.button!==4&&(y.action===2||y.action===3)||(y.col++,y.row++,y.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,y,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(y))return!1;const k=this._encodings[this._activeEncoding](y);return k&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(k):this._coreService.triggerDataEvent(k,!0)),this._lastEvent=y,!0}explainEvents(y){return{down:!!(1&y),up:!!(2&y),drag:!!(4&y),move:!!(8&y),wheel:!!(16&y)}}_equalEvents(y,k,D){if(D){if(y.x!==k.x||y.y!==k.y)return!1}else if(y.col!==k.col||y.row!==k.row)return!1;return y.button===k.button&&y.action===k.action&&y.ctrl===k.ctrl&&y.alt===k.alt&&y.shift===k.shift}};o.CoreMouseService=x=f([p(0,d.IBufferService),p(1,d.ICoreService)],x)},6975:function(u,o,c){var f=this&&this.__decorate||function(x,y,k,D){var T,R=arguments.length,N=R<3?y:D===null?D=Object.getOwnPropertyDescriptor(y,k):D;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(x,y,k,D);else for(var M=x.length-1;M>=0;M--)(T=x[M])&&(N=(R<3?T(N):R>3?T(y,k,N):T(y,k))||N);return R>3&&N&&Object.defineProperty(y,k,N),N},p=this&&this.__param||function(x,y){return function(k,D){y(k,D,x)}};Object.defineProperty(o,"__esModule",{value:!0}),o.CoreService=void 0;const d=c(1439),_=c(8460),v=c(844),w=c(2585),C=Object.freeze({insertMode:!1}),b=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let S=o.CoreService=class extends v.Disposable{constructor(x,y,k){super(),this._bufferService=x,this._logService=y,this._optionsService=k,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new _.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new _.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new _.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new _.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,d.clone)(C),this.decPrivateModes=(0,d.clone)(b)}reset(){this.modes=(0,d.clone)(C),this.decPrivateModes=(0,d.clone)(b)}triggerDataEvent(x,y=!1){if(this._optionsService.rawOptions.disableStdin)return;const k=this._bufferService.buffer;y&&this._optionsService.rawOptions.scrollOnUserInput&&k.ybase!==k.ydisp&&this._onRequestScrollToBottom.fire(),y&&this._onUserInput.fire(),this._logService.debug(`sending data "${x}"`,(()=>x.split("").map((D=>D.charCodeAt(0))))),this._onData.fire(x)}triggerBinaryEvent(x){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${x}"`,(()=>x.split("").map((y=>y.charCodeAt(0))))),this._onBinary.fire(x))}};o.CoreService=S=f([p(0,w.IBufferService),p(1,w.ILogService),p(2,w.IOptionsService)],S)},9074:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.DecorationService=void 0;const f=c(8055),p=c(8460),d=c(844),_=c(6106);let v=0,w=0;class C extends d.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new _.SortedList((x=>x==null?void 0:x.marker.line)),this._onDecorationRegistered=this.register(new p.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new p.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,d.toDisposable)((()=>this.reset())))}registerDecoration(x){if(x.marker.isDisposed)return;const y=new b(x);if(y){const k=y.marker.onDispose((()=>y.dispose()));y.onDispose((()=>{y&&(this._decorations.delete(y)&&this._onDecorationRemoved.fire(y),k.dispose())})),this._decorations.insert(y),this._onDecorationRegistered.fire(y)}return y}reset(){for(const x of this._decorations.values())x.dispose();this._decorations.clear()}*getDecorationsAtCell(x,y,k){let D=0,T=0;for(const R of this._decorations.getKeyIterator(y))D=R.options.x??0,T=D+(R.options.width??1),x>=D&&x{v=T.options.x??0,w=v+(T.options.width??1),x>=v&&x{Object.defineProperty(o,"__esModule",{value:!0}),o.InstantiationService=o.ServiceCollection=void 0;const f=c(2585),p=c(8343);class d{constructor(...v){this._entries=new Map;for(const[w,C]of v)this.set(w,C)}set(v,w){const C=this._entries.get(v);return this._entries.set(v,w),C}forEach(v){for(const[w,C]of this._entries.entries())v(w,C)}has(v){return this._entries.has(v)}get(v){return this._entries.get(v)}}o.ServiceCollection=d,o.InstantiationService=class{constructor(){this._services=new d,this._services.set(f.IInstantiationService,this)}setService(_,v){this._services.set(_,v)}getService(_){return this._services.get(_)}createInstance(_,...v){const w=(0,p.getServiceDependencies)(_).sort(((S,x)=>S.index-x.index)),C=[];for(const S of w){const x=this._services.get(S.id);if(!x)throw new Error(`[createInstance] ${_.name} depends on UNKNOWN service ${S.id}.`);C.push(x)}const b=w.length>0?w[0].index:v.length;if(v.length!==b)throw new Error(`[createInstance] First service dependency of ${_.name} at position ${b+1} conflicts with ${v.length} static arguments`);return new _(...v,...C)}}},7866:function(u,o,c){var f=this&&this.__decorate||function(b,S,x,y){var k,D=arguments.length,T=D<3?S:y===null?y=Object.getOwnPropertyDescriptor(S,x):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(b,S,x,y);else for(var R=b.length-1;R>=0;R--)(k=b[R])&&(T=(D<3?k(T):D>3?k(S,x,T):k(S,x))||T);return D>3&&T&&Object.defineProperty(S,x,T),T},p=this&&this.__param||function(b,S){return function(x,y){S(x,y,b)}};Object.defineProperty(o,"__esModule",{value:!0}),o.traceCall=o.setTraceLogger=o.LogService=void 0;const d=c(844),_=c(2585),v={trace:_.LogLevelEnum.TRACE,debug:_.LogLevelEnum.DEBUG,info:_.LogLevelEnum.INFO,warn:_.LogLevelEnum.WARN,error:_.LogLevelEnum.ERROR,off:_.LogLevelEnum.OFF};let w,C=o.LogService=class extends d.Disposable{get logLevel(){return this._logLevel}constructor(b){super(),this._optionsService=b,this._logLevel=_.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),w=this}_updateLogLevel(){this._logLevel=v[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(b){for(let S=0;SJSON.stringify(T))).join(", ")})`);const D=y.apply(this,k);return w.trace(`GlyphRenderer#${y.name} return`,D),D}}},7302:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.OptionsService=o.DEFAULT_OPTIONS=void 0;const f=c(8460),p=c(844),d=c(6114);o.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 _=["normal","bold","100","200","300","400","500","600","700","800","900"];class v extends p.Disposable{constructor(C){super(),this._onOptionChange=this.register(new f.EventEmitter),this.onOptionChange=this._onOptionChange.event;const b={...o.DEFAULT_OPTIONS};for(const S in C)if(S in b)try{const x=C[S];b[S]=this._sanitizeAndValidateOption(S,x)}catch(x){console.error(x)}this.rawOptions=b,this.options={...b},this._setupOptions(),this.register((0,p.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(C,b){return this.onOptionChange((S=>{S===C&&b(this.rawOptions[C])}))}onMultipleOptionChange(C,b){return this.onOptionChange((S=>{C.indexOf(S)!==-1&&b()}))}_setupOptions(){const C=S=>{if(!(S in o.DEFAULT_OPTIONS))throw new Error(`No option with key "${S}"`);return this.rawOptions[S]},b=(S,x)=>{if(!(S in o.DEFAULT_OPTIONS))throw new Error(`No option with key "${S}"`);x=this._sanitizeAndValidateOption(S,x),this.rawOptions[S]!==x&&(this.rawOptions[S]=x,this._onOptionChange.fire(S))};for(const S in this.rawOptions){const x={get:C.bind(this,S),set:b.bind(this,S)};Object.defineProperty(this.options,S,x)}}_sanitizeAndValidateOption(C,b){switch(C){case"cursorStyle":if(b||(b=o.DEFAULT_OPTIONS[C]),!(function(S){return S==="block"||S==="underline"||S==="bar"})(b))throw new Error(`"${b}" is not a valid value for ${C}`);break;case"wordSeparator":b||(b=o.DEFAULT_OPTIONS[C]);break;case"fontWeight":case"fontWeightBold":if(typeof b=="number"&&1<=b&&b<=1e3)break;b=_.includes(b)?b:o.DEFAULT_OPTIONS[C];break;case"cursorWidth":b=Math.floor(b);case"lineHeight":case"tabStopWidth":if(b<1)throw new Error(`${C} cannot be less than 1, value: ${b}`);break;case"minimumContrastRatio":b=Math.max(1,Math.min(21,Math.round(10*b)/10));break;case"scrollback":if((b=Math.min(b,4294967295))<0)throw new Error(`${C} cannot be less than 0, value: ${b}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(b<=0)throw new Error(`${C} cannot be less than or equal to 0, value: ${b}`);break;case"rows":case"cols":if(!b&&b!==0)throw new Error(`${C} must be numeric, value: ${b}`);break;case"windowsPty":b=b??{}}return b}}o.OptionsService=v},2660:function(u,o,c){var f=this&&this.__decorate||function(v,w,C,b){var S,x=arguments.length,y=x<3?w:b===null?b=Object.getOwnPropertyDescriptor(w,C):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")y=Reflect.decorate(v,w,C,b);else for(var k=v.length-1;k>=0;k--)(S=v[k])&&(y=(x<3?S(y):x>3?S(w,C,y):S(w,C))||y);return x>3&&y&&Object.defineProperty(w,C,y),y},p=this&&this.__param||function(v,w){return function(C,b){w(C,b,v)}};Object.defineProperty(o,"__esModule",{value:!0}),o.OscLinkService=void 0;const d=c(2585);let _=o.OscLinkService=class{constructor(v){this._bufferService=v,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(v){const w=this._bufferService.buffer;if(v.id===void 0){const k=w.addMarker(w.ybase+w.y),D={data:v,id:this._nextId++,lines:[k]};return k.onDispose((()=>this._removeMarkerFromLink(D,k))),this._dataByLinkId.set(D.id,D),D.id}const C=v,b=this._getEntryIdKey(C),S=this._entriesWithId.get(b);if(S)return this.addLineToLink(S.id,w.ybase+w.y),S.id;const x=w.addMarker(w.ybase+w.y),y={id:this._nextId++,key:this._getEntryIdKey(C),data:C,lines:[x]};return x.onDispose((()=>this._removeMarkerFromLink(y,x))),this._entriesWithId.set(y.key,y),this._dataByLinkId.set(y.id,y),y.id}addLineToLink(v,w){const C=this._dataByLinkId.get(v);if(C&&C.lines.every((b=>b.line!==w))){const b=this._bufferService.buffer.addMarker(w);C.lines.push(b),b.onDispose((()=>this._removeMarkerFromLink(C,b)))}}getLinkData(v){var w;return(w=this._dataByLinkId.get(v))==null?void 0:w.data}_getEntryIdKey(v){return`${v.id};;${v.uri}`}_removeMarkerFromLink(v,w){const C=v.lines.indexOf(w);C!==-1&&(v.lines.splice(C,1),v.lines.length===0&&(v.data.id!==void 0&&this._entriesWithId.delete(v.key),this._dataByLinkId.delete(v.id)))}};o.OscLinkService=_=f([p(0,d.IBufferService)],_)},8343:(u,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.createDecorator=o.getServiceDependencies=o.serviceRegistry=void 0;const c="di$target",f="di$dependencies";o.serviceRegistry=new Map,o.getServiceDependencies=function(p){return p[f]||[]},o.createDecorator=function(p){if(o.serviceRegistry.has(p))return o.serviceRegistry.get(p);const d=function(_,v,w){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(C,b,S){b[c]===b?b[f].push({id:C,index:S}):(b[f]=[{id:C,index:S}],b[c]=b)})(d,_,w)};return d.toString=()=>p,o.serviceRegistry.set(p,d),d}},2585:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.IDecorationService=o.IUnicodeService=o.IOscLinkService=o.IOptionsService=o.ILogService=o.LogLevelEnum=o.IInstantiationService=o.ICharsetService=o.ICoreService=o.ICoreMouseService=o.IBufferService=void 0;const f=c(8343);var p;o.IBufferService=(0,f.createDecorator)("BufferService"),o.ICoreMouseService=(0,f.createDecorator)("CoreMouseService"),o.ICoreService=(0,f.createDecorator)("CoreService"),o.ICharsetService=(0,f.createDecorator)("CharsetService"),o.IInstantiationService=(0,f.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"})(p||(o.LogLevelEnum=p={})),o.ILogService=(0,f.createDecorator)("LogService"),o.IOptionsService=(0,f.createDecorator)("OptionsService"),o.IOscLinkService=(0,f.createDecorator)("OscLinkService"),o.IUnicodeService=(0,f.createDecorator)("UnicodeService"),o.IDecorationService=(0,f.createDecorator)("DecorationService")},1480:(u,o,c)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.UnicodeService=void 0;const f=c(8460),p=c(225);class d{static extractShouldJoin(v){return(1&v)!=0}static extractWidth(v){return v>>1&3}static extractCharKind(v){return v>>3}static createPropertyValue(v,w,C=!1){return(16777215&v)<<3|(3&w)<<1|(C?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new f.EventEmitter,this.onChange=this._onChange.event;const v=new p.UnicodeV6;this.register(v),this._active=v.version,this._activeProvider=v}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(v){if(!this._providers[v])throw new Error(`unknown Unicode version "${v}"`);this._active=v,this._activeProvider=this._providers[v],this._onChange.fire(v)}register(v){this._providers[v.version]=v}wcwidth(v){return this._activeProvider.wcwidth(v)}getStringCellWidth(v){let w=0,C=0;const b=v.length;for(let S=0;S=b)return w+this.wcwidth(x);const D=v.charCodeAt(S);56320<=D&&D<=57343?x=1024*(x-55296)+D-56320+65536:w+=this.wcwidth(D)}const y=this.charProperties(x,C);let k=d.extractWidth(y);d.extractShouldJoin(y)&&(k-=d.extractWidth(C)),w+=k,C=y}return w}charProperties(v,w){return this._activeProvider.charProperties(v,w)}}o.UnicodeService=d}},r={};function a(u){var o=r[u];if(o!==void 0)return o.exports;var c=r[u]={exports:{}};return n[u].call(c.exports,c,c.exports,a),c.exports}var l={};return(()=>{var u=l;Object.defineProperty(u,"__esModule",{value:!0}),u.Terminal=void 0;const o=a(9042),c=a(3236),f=a(844),p=a(5741),d=a(8285),_=a(7975),v=a(7090),w=["cols","rows"];class C extends f.Disposable{constructor(S){super(),this._core=this.register(new c.Terminal(S)),this._addonManager=this.register(new p.AddonManager),this._publicOptions={...this._core.options};const x=k=>this._core.options[k],y=(k,D)=>{this._checkReadonlyOptions(k),this._core.options[k]=D};for(const k in this._core.options){const D={get:x.bind(this,k),set:y.bind(this,k)};Object.defineProperty(this._publicOptions,k,D)}}_checkReadonlyOptions(S){if(w.includes(S))throw new Error(`Option "${S}" 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 _.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new v.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 S=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:S.applicationCursorKeys,applicationKeypadMode:S.applicationKeypad,bracketedPasteMode:S.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:x,originMode:S.origin,reverseWraparoundMode:S.reverseWraparound,sendFocusMode:S.sendFocus,wraparoundMode:S.wraparound}}get options(){return this._publicOptions}set options(S){for(const x in S)this._publicOptions[x]=S[x]}blur(){this._core.blur()}focus(){this._core.focus()}input(S,x=!0){this._core.input(S,x)}resize(S,x){this._verifyIntegers(S,x),this._core.resize(S,x)}open(S){this._core.open(S)}attachCustomKeyEventHandler(S){this._core.attachCustomKeyEventHandler(S)}attachCustomWheelEventHandler(S){this._core.attachCustomWheelEventHandler(S)}registerLinkProvider(S){return this._core.registerLinkProvider(S)}registerCharacterJoiner(S){return this._checkProposedApi(),this._core.registerCharacterJoiner(S)}deregisterCharacterJoiner(S){this._checkProposedApi(),this._core.deregisterCharacterJoiner(S)}registerMarker(S=0){return this._verifyIntegers(S),this._core.registerMarker(S)}registerDecoration(S){return this._checkProposedApi(),this._verifyPositiveIntegers(S.x??0,S.width??0,S.height??0),this._core.registerDecoration(S)}hasSelection(){return this._core.hasSelection()}select(S,x,y){this._verifyIntegers(S,x,y),this._core.select(S,x,y)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(S,x){this._verifyIntegers(S,x),this._core.selectLines(S,x)}dispose(){super.dispose()}scrollLines(S){this._verifyIntegers(S),this._core.scrollLines(S)}scrollPages(S){this._verifyIntegers(S),this._core.scrollPages(S)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(S){this._verifyIntegers(S),this._core.scrollToLine(S)}clear(){this._core.clear()}write(S,x){this._core.write(S,x)}writeln(S,x){this._core.write(S),this._core.write(`\r +`,x)}paste(S){this._core.paste(S)}refresh(S,x){this._verifyIntegers(S,x),this._core.refresh(S,x)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(S){this._addonManager.loadAddon(this,S)}static get strings(){return o}_verifyIntegers(...S){for(const x of S)if(x===1/0||isNaN(x)||x%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...S){for(const x of S)if(x&&(x===1/0||isNaN(x)||x%1!=0||x<0))throw new Error("This API only accepts positive integers")}}u.Terminal=C})(),l})()))})(dp)),dp.exports}var K8=X8();function Sb(e){const t=atob(e),n=new Uint8Array(t.length);for(let r=0;r{const n=t.current;if(!n)return;const r=new K8.Terminal({convertEol:!0,disableStdin:!0,fontSize:12,fontFamily:'ui-monospace, "SF Mono", Menlo, Consolas, monospace',scrollback:2e4,theme:{background:"#1a1a1a",foreground:"#e6e1e0",cursor:"#1a1a1a",selectionBackground:"#2c3441"}}),a=new W8.FitAddon;r.loadAddon(a),r.open(n);try{a.fit()}catch{}const l=new ResizeObserver(()=>{try{a.fit()}catch{}});l.observe(n);let u=!1,o=0,c=!1,f=!1;async function p(){if(c){f=!0;return}c=!0;try{for(;;){const _=await RT(e,o);if(u)return;if(_.dataBase64&&r.write(Sb(_.dataBase64)),o=_.nextOffset,_.eof)break}}catch{}finally{c=!1,f&&!u&&(f=!1,p())}}const d=_N(e,_=>{if(u)return;const v=Sb(_.dataBase64);!c&&_.offset===o?(r.write(v),o+=v.length):_.offset+v.length>o&&p()});return p(),()=>{u=!0,d(),l.disconnect(),r.dispose()}},[e]),m.jsx("div",{ref:t,style:{width:"100%",height:"100%"}})}const Ys="__uncommitted__";function Q8({state:e}){return!e||e.loading?m.jsx("div",{className:"changes-note",children:"Loading diff…"}):e.error?m.jsx("div",{className:"error",children:e.error}):e.payload?e.payload.truncated?m.jsx(q8,{bytesRead:e.payload.bytesRead,byteLimit:e.payload.byteLimit}):m.jsx(oC,{diff:e.payload.diff}):m.jsx("div",{className:"diff-empty",children:"No changes."})}function J8({experiment:e,project:t,view:n,runs:r,selectedRunId:a,onSelectRun:l}){const u=r.filter(o=>o.experimentId===e.id).sort((o,c)=>c.createdAt-o.createdAt);return n==="terminal"?m.jsx(eB,{experiment:e,expRuns:u,selectedRunId:a,onSelectRun:l}):m.jsx(tB,{experiment:e,project:t})}function eB({experiment:e,expRuns:t,selectedRunId:n,onSelectRun:r}){const[a,l]=V.useState(null),[u,o]=V.useState(!1),c=V.useRef(null),f=n&&t.find(w=>w.id===n)||t[0]||null,p=(f==null?void 0:f.status)==="running"||(f==null?void 0:f.status)==="starting",d=w=>{const C=t.findIndex(b=>b.id===w);return C===-1?t.length:t.length-C},_=V.useRef(null);V.useEffect(()=>{if(_.current===null){_.current=new Set(t.map(C=>C.id));return}const w=t.find(C=>!_.current.has(C.id));for(const C of t)_.current.add(C.id);w&&r(w.id)},[t,r]),V.useEffect(()=>{if(!u)return;const w=C=>{var b;(b=c.current)!=null&&b.contains(C.target)||o(!1)};return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[u]);async function v(){if(f){l(null);try{await GS(f.id)}catch(w){l(w instanceof Error?w.message:String(w))}}}return m.jsxs("div",{className:"term-view",children:[m.jsxs("div",{className:"term-bar",children:[m.jsx("div",{className:"term-title",title:e.title||e.slug,children:e.title||e.slug}),m.jsx("span",{style:{flex:1}}),a&&m.jsx("span",{className:"error",children:a}),p&&m.jsxs("button",{className:"btn sm ghost",onClick:()=>void v(),children:[m.jsx(TA,{size:13}),"Stop"]}),t.length>0&&f&&m.jsxs("div",{className:"run-history",ref:c,children:[m.jsxs("button",{className:"run-picker",title:"Switch run",onClick:()=>o(w=>!w),children:[m.jsxs("span",{className:"run-label",children:["Run ",d(f.id)]}),m.jsx(Po,{status:f.status}),m.jsx(pa,{size:14,className:"run-picker-chev"})]}),u&&m.jsx("div",{className:"history-menu",children:t.map(w=>m.jsxs("button",{className:`history-item ${w.id===(f==null?void 0:f.id)?"active":""}`,onClick:()=>{r(w.id),o(!1)},children:[m.jsxs("span",{className:"run-label",children:["Run ",d(w.id)]}),m.jsx(Po,{status:w.status}),m.jsx("span",{className:"when",children:ga(w.createdAt)})]},w.id))})]})]}),m.jsx("div",{className:"term-fill",children:f?m.jsx(Z8,{runId:f.id},f.id):m.jsx("div",{className:"term-empty",children:"No runs yet — ask the agent to launch one."})})]})}function tB({experiment:e,project:t}){const[n,r]=V.useState(null),[a,l]=V.useState(null),[u,o]=V.useState(null),[c,f]=V.useState(null),[p,d]=V.useState({}),_=!!(u&&u.diff.trim()!==""&&u.experimentId===e.id);async function v(){l(null);try{const[C,b]=await Promise.all([MT(e.id),By(e.projectId)]);r(C),o(b),f(S=>{var y;return S!==null?S:b.diff.trim()!==""&&b.experimentId===e.id?Ys:((y=C[0])==null?void 0:y.sha)??null})}catch(C){l(C instanceof Error?C.message:String(C))}}V.useEffect(()=>{n===null&&!a&&v()},[n,a,e.id]),V.useEffect(()=>{const C=setInterval(()=>{By(e.projectId).then(o).catch(()=>{})},5e3);return()=>clearInterval(C)},[e.projectId]),V.useEffect(()=>{var C;c===Ys&&u&&!_&&f(((C=n==null?void 0:n[0])==null?void 0:C.sha)??null)},[c,u,_,n]),V.useEffect(()=>{if(!c||c===Ys||p[c])return;const C=c;d(b=>({...b,[C]:{loading:!0}})),LT(e.id,C).then(b=>d(S=>({...S,[C]:{loading:!1,payload:b}}))).catch(b=>d(S=>({...S,[C]:{loading:!1,error:b instanceof Error?b.message:String(b)}})))},[c,p,e.id]);const w=!_&&((n==null?void 0:n.length)??0)===0;return m.jsx("div",{className:"drawer",children:m.jsx("div",{className:"drawer-body",children:m.jsxs("div",{className:"drawer-section",children:[m.jsxs("div",{className:"changes-branch",children:[m.jsx("span",{className:"ctl-label",children:"Branch"}),m.jsx(NO,{owner:t.githubOwner,repo:t.githubRepo,branch:e.branchName})]}),a?m.jsx("div",{className:"error",children:a}):n===null?m.jsx("div",{className:"changes-note",children:"Loading changes…"}):w?m.jsx("div",{className:"changes-note",children:"No changes yet — the agent hasn't committed on this branch."}):m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"commit-picker",children:[m.jsx("span",{className:"ctl-label",children:"Commit"}),c===Ys&&m.jsx("span",{className:"uncommitted-dot"}),m.jsxs("select",{className:"input sm",value:c??"",onChange:C=>f(C.target.value),children:[_&&m.jsx("option",{value:Ys,children:"● Uncommitted changes"}),n.map(C=>m.jsxs("option",{value:C.sha,children:[C.sha.slice(0,7)," — ",C.subject]},C.sha))]}),m.jsx("button",{className:"icon-btn",title:"Refresh","aria-label":"Refresh",onClick:()=>void v(),children:m.jsx(xg,{size:14})})]}),m.jsx("div",{style:{marginTop:10},children:c===Ys&&u?u.truncated?m.jsxs("div",{className:"truncated-notice",children:[m.jsx("h4",{children:"Diff too large to display"}),m.jsx("p",{children:"The uncommitted diff is too large to display. View it locally with git."})]}):m.jsx(oC,{diff:u.diff}):c?m.jsx(Q8,{state:p[c]}):m.jsx("div",{className:"changes-note",children:"Select a commit to view its diff."})})]})]})})})}function nB(e,t){return dw(e,aw(t))}function iB({projectId:e,path:t,sessionId:n,gitRef:r,onOpenFile:a}){const[l,u]=V.useState(null),[o,c]=V.useState(null),[f,p]=V.useState(!0),[d,_]=V.useState(0),v=/\.(md|mdx|markdown)$/i.test(t),[w,C]=V.useState(!1);V.useEffect(()=>{let y=!1;return p(!0),OT(e,t,{sessionId:n,ref:r}).then(k=>{y||(u(k),c(null))}).catch(k=>{y||c(k.message)}).finally(()=>{y||p(!1)}),()=>{y=!0}},[e,t,n,r,d]);const b=V.useMemo(()=>l&&!l.notFound?nB(l.content,t):null,[l,t]),S=l&&!l.notFound&&l.content?l.content.split(` +`).length-(l.content.endsWith(` +`)?1:0):0,x=y=>r?`File not found on branch ${r}.`:n&&y.root==="clone"?"This session's worktree isn't available, and the file isn't in the project clone.":`File not found in the ${y.root==="worktree"?"session's worktree":"project clone"}.`;return m.jsxs("div",{className:"file-view",children:[m.jsxs("div",{className:"file-view-header",children:[m.jsx($A,{size:13,style:{flexShrink:0}}),m.jsx("code",{className:"file-view-path",title:t,children:t}),r&&m.jsx("code",{className:"file-view-ref",title:`Committed state of ${r}`,children:r}),v&&m.jsx("button",{className:`icon-btn ${w?"active":""}`,title:w?"Rendered view":"Source view","aria-label":w?"Rendered view":"Source view",onClick:()=>C(y=>!y),children:m.jsx(MA,{size:13})}),m.jsx("button",{className:"icon-btn",title:"Reload file","aria-label":"Reload file",onClick:()=>_(y=>y+1),children:f?m.jsx("span",{className:"spinner"}):m.jsx(xg,{size:13})})]}),m.jsx("div",{className:"file-view-body",children:o?m.jsxs("div",{className:"file-view-note",children:["Failed to load file: ",o]}):l===null?m.jsx("div",{className:"file-view-note",children:"Loading…"}):l.notFound?m.jsx("div",{className:"file-view-note",children:x(l)}):m.jsxs(m.Fragment,{children:[!r&&n&&l.root==="clone"&&m.jsx("div",{className:"file-view-note",children:"This session's worktree isn't available — showing the project clone's copy."}),v&&!w?m.jsx("div",{className:"file-view-md",children:m.jsx(Ju,{text:l.content,onOpenFile:a&&(y=>a(y,n,r))})}):m.jsxs("div",{className:"file-view-codewrap",children:[m.jsx("pre",{className:"file-view-gutter","aria-hidden":"true",children:Array.from({length:S},(y,k)=>k+1).join(` +`)}),m.jsx("pre",{className:"file-view-code",children:m.jsx("code",{children:b})})]}),l.truncated&&m.jsx("div",{className:"file-view-note",children:"File truncated — showing the first 512 KB."})]})})]})}function rB({projectName:e,onHome:t,onCollapse:n}){return m.jsxs("div",{className:"rail-brand",children:[m.jsxs("button",{className:"brand",onClick:t,title:"All projects",children:[m.jsx(To,{size:15}),m.jsx("span",{className:"brand-project",children:e})]}),n&&m.jsx("button",{className:"icon-btn",title:"Hide sidebar","aria-label":"Hide sidebar",onClick:n,children:m.jsx(FS,{size:15})})]})}function sB({onDone:e}){const[t,n]=V.useState(0),[r,a]=V.useState(null),[l,u]=V.useState(null),[o,c]=V.useState(null),[f,p]=V.useState(null),[d,_]=V.useState(!1),v=C=>{_(!0),Promise.allSettled([Cg(C).then(a),WS().then(u),YS().then(c),iN().then(p)]).finally(()=>_(!1))};V.useEffect(()=>v(!1),[]);const w=()=>{sN((f==null?void 0:f.enabled)??!0).catch(()=>{}),e()};return m.jsx("div",{className:"home onboarding",children:m.jsx("div",{className:"home-inner",children:t===0?m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"onb-eyebrow",children:["Open",m.jsx("span",{children:"Research"})," · step 1 of 4"]}),m.jsx("h2",{className:"onb-title",children:"Your coding agents"}),m.jsx("p",{className:"onb-sub",children:"orx found the agent CLIs on this machine and drives them directly — chat and autoresearch run on your own logins, no extra API keys."}),m.jsx("div",{className:"onb-cards",children:r===null?m.jsxs("div",{className:"onb-loading",children:[m.jsx("span",{className:"spinner"})," Detecting Claude Code, Codex, OpenCode…"]}):r.map(C=>m.jsx(oB,{h:C},C.id))}),m.jsxs("div",{className:"onb-actions",children:[m.jsxs("button",{className:"btn ghost",onClick:()=>v(!0),disabled:d,children:[m.jsx(yu,{size:12,className:d?"spin":""})," Re-check"]}),m.jsx("div",{style:{flex:1}}),m.jsxs("button",{className:"btn primary",onClick:()=>n(1),children:["Continue ",m.jsx(jc,{size:13})]})]})]}):t===1?m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"onb-eyebrow",children:["Open",m.jsx("span",{children:"Research"})," · step 2 of 4"]}),m.jsx("h2",{className:"onb-title",children:"Git & GitHub"}),m.jsx("p",{className:"onb-sub",children:"A project is a clone of one of your GitHub repos, made with your own git credentials. Every experiment becomes a branch pushed to that repo — compute jobs clone it from there."}),m.jsx("div",{className:"onb-cards",children:m.jsx(lB,{git:l,onUpdate:u})}),m.jsxs("div",{className:"onb-actions",children:[m.jsxs("button",{className:"btn ghost",onClick:()=>n(0),children:[m.jsx(To,{size:12})," Back"]}),m.jsxs("button",{className:"btn ghost",onClick:()=>v(!1),disabled:d,children:[m.jsx(yu,{size:12,className:d?"spin":""})," Re-check"]}),m.jsx("div",{style:{flex:1}}),m.jsxs("button",{className:"btn primary",onClick:()=>n(2),children:["Continue ",m.jsx(jc,{size:13})]})]})]}):t===2?m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"onb-eyebrow",children:["Open",m.jsx("span",{children:"Research"})," · step 3 of 4"]}),m.jsx("h2",{className:"onb-title",children:"Where orx keeps your data"}),m.jsx("p",{className:"onb-sub",children:"Your local database, run logs, artifacts, and chat attachments live in one folder on this machine. The default works for most people — change it if you'd rather keep it on another disk."}),m.jsx("div",{className:"onb-cards",children:m.jsx(cB,{dataDir:o,onUpdate:c})}),m.jsxs("div",{className:"onb-actions",children:[m.jsxs("button",{className:"btn ghost",onClick:()=>n(1),children:[m.jsx(To,{size:12})," Back"]}),m.jsx("div",{style:{flex:1}}),m.jsxs("button",{className:"btn primary",onClick:()=>n(3),children:["Continue ",m.jsx(jc,{size:13})]})]})]}):m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"onb-eyebrow",children:["Open",m.jsx("span",{children:"Research"})," · step 4 of 4"]}),m.jsx("h2",{className:"onb-title",children:"Usage analytics"}),m.jsx("p",{className:"onb-sub",children:"orx can send anonymous usage analytics to help improve the tool. No code, prompts, file contents, or identifiers are ever sent — just a random per-install id, the command run, and your OS."}),m.jsx("div",{className:"onb-cards",children:m.jsx(uB,{telemetry:f,onUpdate:p})}),m.jsxs("div",{className:"onb-actions",children:[m.jsxs("button",{className:"btn ghost",onClick:()=>n(2),children:[m.jsx(To,{size:12})," Back"]}),m.jsx("div",{style:{flex:1}}),m.jsxs("button",{className:"btn primary",onClick:w,children:["Create your first project ",m.jsx(jc,{size:13})]})]})]})})})}function aB(e){return e.agentReady?{cls:"st-done",label:"connected"}:e.installed?{cls:"st-starting",label:"not signed in"}:{cls:"st-idle",label:"not detected"}}function oB({h:e}){var r,a;const t=aB(e),n=(r=e.version)==null?void 0:r.replace(/\s*\(.*\)$/,"");return m.jsxs("div",{className:"onb-card",children:[m.jsxs("div",{className:"onb-card-head",children:[m.jsx("span",{className:"onb-card-name",children:e.name}),m.jsxs("span",{className:`status-badge ${t.cls}`,children:[e.agentReady?m.jsx(_n,{size:12,strokeWidth:3}):m.jsx("span",{className:"dot"}),t.label]})]}),e.agentReady?m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"onb-card-detail mono",children:[e.account??"API key",e.plan?` · ${e.plan}`:""]}),m.jsx("div",{className:"onb-card-meta",children:[n,e.models.length>0&&`${e.models.length} model${e.models.length===1?"":"s"} — ${e.models.slice(0,3).map(l=>bu(l.id)).join(", ")}${e.models.length>3?", …":""}`].filter(Boolean).join(" · ")})]}):m.jsx("div",{className:"onb-card-meta",children:(a=e.agentNote)==null?void 0:a.replace(/`/g,"")})]})}function lB({git:e,onUpdate:t}){const[n,r]=V.useState(!1),a=()=>{navigator.clipboard.writeText("gh auth login").then(()=>{r(!0),setTimeout(()=>r(!1),1500)})};if(e===null)return m.jsxs("div",{className:"onb-loading",children:[m.jsx("span",{className:"spinner"})," Checking git…"]});if(!e.gitVersion)return m.jsxs("div",{className:"onb-card",children:[m.jsxs("div",{className:"onb-card-head",children:[m.jsx("span",{className:"onb-card-name",children:"git"}),m.jsxs("span",{className:"status-badge st-failed",children:[m.jsx("span",{className:"dot"})," not found"]})]}),m.jsx("div",{className:"onb-card-meta",children:"Install git to clone projects, then re-open orx."})]});const l=[e.userName,e.userEmail&&`<${e.userEmail}>`].filter(Boolean).join(" ");return m.jsxs("div",{className:"onb-card",children:[m.jsxs("div",{className:"onb-card-row",children:[m.jsx("span",{className:"onb-card-name",children:"git"}),m.jsxs("span",{className:"onb-card-detail mono",children:[e.gitVersion.replace(/^git version /,""),l?` · ${l}`:""]}),m.jsxs("span",{className:`status-badge ${l?"st-done":"st-starting"}`,children:[l?m.jsx(_n,{size:12,strokeWidth:3}):m.jsx("span",{className:"dot"}),l?"ready":"no identity"]})]}),m.jsxs("div",{className:"onb-card-row",children:[m.jsx("span",{className:"onb-card-name",children:"GitHub"}),m.jsx("span",{className:"onb-card-detail mono",children:e.githubTokenSource==="env"?"token from GITHUB_TOKEN":e.githubTokenSource==="stored"?"token saved in orx":e.githubTokenSource==="gh"?"signed in via gh CLI":"not connected"}),m.jsxs("span",{className:`status-badge ${e.githubTokenSource?"st-done":"st-starting"}`,children:[e.githubTokenSource?m.jsx(_n,{size:12,strokeWidth:3}):m.jsx("span",{className:"dot"}),e.githubTokenSource?"ready":"check"]})]}),!l&&m.jsxs("div",{className:"onb-card-meta",children:["Set ",m.jsx("code",{children:"git config --global user.name / user.email"})," so the agent can commit."]}),!e.githubTokenSource&&m.jsxs("div",{className:"onb-gh-options",children:[m.jsx("div",{className:"onb-card-meta",children:"GitHub access is used to clone your repos and push experiment branches. Connect either way:"}),m.jsxs("div",{className:"onb-gh-option",children:[m.jsx("span",{className:"onb-gh-option-label",children:"GitHub CLI"}),m.jsx("div",{className:"onb-gh-option-body",children:e.ghInstalled?m.jsxs(m.Fragment,{children:[m.jsx("code",{className:"onb-gh-cmd",children:"gh auth login"}),m.jsxs("button",{className:"btn ghost",onClick:a,children:[n?m.jsx(_n,{size:12,strokeWidth:3}):m.jsx(yg,{size:12}),n?"Copied":"Copy"]}),m.jsx("span",{className:"onb-gh-hint",children:"run in a terminal, then Re-check"})]}):m.jsxs("span",{className:"onb-gh-hint",children:["install the GitHub CLI, run ",m.jsx("code",{children:"gh auth login"}),", then Re-check"]})})]}),m.jsx("div",{className:"onb-gh-or",children:"or"}),m.jsxs("div",{className:"onb-gh-option",children:[m.jsx("span",{className:"onb-gh-option-label",children:"Paste a token"}),m.jsx(mw,{onSaved:t})]})]})]})}function cB({dataDir:e,onUpdate:t}){const[n,r]=V.useState(""),[a,l]=V.useState(!1),[u,o]=V.useState(!1),[c,f]=V.useState(null);if(V.useEffect(()=>{e&&!n&&r(e.current)},[e,n]),e===null)return m.jsxs("div",{className:"onb-loading",children:[m.jsx("span",{className:"spinner"})," Checking storage…"]});if(e.source==="env")return m.jsxs("div",{className:"onb-card",children:[m.jsxs("div",{className:"onb-card-row",children:[m.jsx("span",{className:"onb-card-name",children:"Data folder"}),m.jsx("span",{className:"onb-card-detail mono",children:e.current}),m.jsxs("span",{className:"status-badge st-done",children:[m.jsx(_n,{size:12,strokeWidth:3})," pinned"]})]}),m.jsxs("div",{className:"onb-card-meta",children:["Set by the ",m.jsx("code",{children:"ORX_DATA_DIR"})," environment variable."]})]});const p=n.trim(),d=p!==""&&p!==e.current;async function _(){if(!(u||!d)){o(!0),f(null);try{t(await qT(p)),l(!1)}catch(v){f(v instanceof Error?v.message:String(v))}finally{o(!1)}}}return m.jsxs("div",{className:"onb-card",children:[m.jsxs("div",{className:"onb-card-row",children:[m.jsx("span",{className:"onb-card-name",children:"Data folder"}),m.jsx("span",{className:"onb-card-detail mono",children:e.current}),m.jsxs("span",{className:`status-badge ${e.isDefault?"st-idle":"st-done"}`,children:[e.isDefault?m.jsx("span",{className:"dot"}):m.jsx(_n,{size:12,strokeWidth:3}),e.isDefault?"default":"custom"]})]}),a?m.jsxs(m.Fragment,{children:[m.jsx("input",{className:"mono",type:"text",value:n,onChange:v=>r(v.target.value),placeholder:"/absolute/path/to/openresearch",autoComplete:"off",spellCheck:!1,style:{width:"100%",marginTop:10}}),c&&m.jsx("div",{className:"error",style:{marginTop:8},children:c}),m.jsxs("div",{style:{display:"flex",gap:6,marginTop:10},children:[m.jsx("button",{className:"btn primary",onClick:_,disabled:u||!d,children:u?"Saving…":"Use this folder"}),m.jsx("button",{className:"btn ghost",onClick:()=>{l(!1),r(e.current),f(null)},disabled:u,children:"Cancel"})]})]}):m.jsxs("div",{className:"onb-card-meta",style:{display:"flex",gap:10,alignItems:"center"},children:["The default is fine for most setups.",m.jsx("button",{className:"btn ghost",onClick:()=>l(!0),children:"Change…"})]})]})}function uB({telemetry:e,onUpdate:t}){const[n,r]=V.useState(!1);if(e===null)return m.jsxs("div",{className:"onb-loading",children:[m.jsx("span",{className:"spinner"})," Checking analytics…"]});const a=e.enabled,l=!a&&e.reason!==null&&e.reason!=="disabled via `orx telemetry off`",u=o=>{n||o===a||(r(!0),rN(o).then(t).finally(()=>r(!1)))};return m.jsxs("div",{className:"onb-card",children:[m.jsxs("div",{className:"onb-card-head",children:[m.jsxs("div",{children:[m.jsx("div",{className:"onb-card-name",children:"Share anonymous usage analytics"}),m.jsx("div",{className:"onb-card-meta",style:{marginTop:2},children:a?"On — helps prioritize what to build next.":l?`Off — ${e.reason}.`:"Off — you can turn it back on anytime."})]}),m.jsxs("div",{style:{display:"flex",gap:6,flex:"none"},children:[m.jsxs("button",{className:`btn ${a?"primary":"ghost"}`,onClick:()=>u(!0),disabled:n,"aria-pressed":a,children:[a?m.jsx(_n,{size:12,strokeWidth:3}):null," On"]}),m.jsxs("button",{className:`btn ${a?"ghost":"primary"}`,onClick:()=>u(!1),disabled:n,"aria-pressed":!a,children:[a?null:m.jsx(_n,{size:12,strokeWidth:3})," Off"]})]})]}),m.jsxs("div",{className:"onb-card-meta",style:{marginTop:12},children:["Sent: a random per-install id, the command run, CLI version, and OS. Never sent: code, prompts, file contents, paths, or repo names. Change anytime in Settings or with"," ",m.jsx("code",{children:"orx telemetry off"}),"."]}),l&&m.jsxs("div",{className:"onb-card-meta",style:{marginTop:8},children:["Note: this run is off because of ",e.reason,", which overrides the saved choice."]})]})}function Wc(e){const t=e.trim().replace(/^git@github\.com:/i,"").replace(/^https?:\/\/(www\.)?github\.com\//i,"").replace(/\.git$/i,"").replace(/^\/+|\/+$/g,""),[n,r]=t.split("/");return!n||!r||/[\s:@]/.test(n)||/[\s:@]/.test(r)?null:{owner:n,repo:r}}function xb(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,48).replace(/-+$/,"")||"experiment"}function hB(e){const r=(e.trim().split(/[?#]/)[0].split("/").filter(Boolean).pop()??"").replace(/\.(pdf|md)$/i,"");return/^\d{4}\.\d{4,5}(v\d+)?$/.test(r)?r:null}function fB(e){return e.replace(/^\[[^\]]*\]\s*/,"").replace(/\s*[-–|]\s*arXiv\s*$/i,"")}function dB({onCreated:e,onCancel:t}){var U;const[n,r]=V.useState("paper"),[a,l]=V.useState("use"),[u,o]=V.useState(""),[c,f]=V.useState(""),[p,d]=V.useState(!1),[_,v]=V.useState("main"),[w,C]=V.useState(!1),[b,S]=V.useState(null),[x,y]=V.useState(""),[k,D]=V.useState([]),[T,R]=V.useState(!1),[N,M]=V.useState(null),[B,H]=V.useState(!1),[Y,F]=V.useState(null),z=V.useRef(0),q=Wc(u),G=!!(c.trim()&&(n==="new"||n==="existing"&&q!==null||n==="paper"&&N!==null&&(u.trim()===""||q!==null))),X=Q=>{var re;o(Q),p||f(((re=Wc(Q))==null?void 0:re.repo)??"")};async function K(Q){const re=++z.current;D([]),R(!1),H(!0),F(null);try{const ae=await ET(Q);if(re!==z.current)return;M(ae);const Z=ae.repoUrl?Wc(ae.repoUrl):null;o(Z?`${Z.owner}/${Z.repo}`:""),l("fork"),p||f((Z==null?void 0:Z.repo)??(ae.title??"").trim().slice(0,60))}catch(ae){if(re!==z.current)return;F(ae instanceof Error?ae.message:String(ae))}finally{re===z.current&&H(!1)}}function O(){z.current++,M(null),y(""),D([]),F(null),o(""),p||f("")}V.useEffect(()=>{if(n!=="paper"||N)return;const Q=x.trim(),re=hB(Q);if(!re&&Q.length<3){D([]),R(!1);return}const ae=++z.current;re||R(!0);const Z=setTimeout(()=>{if(re){K(re);return}CT(Q).then(P=>{ae===z.current&&D(P)}).catch(P=>{ae===z.current&&(D([]),F(P instanceof Error?P.message:String(P)))}).finally(()=>{ae===z.current&&R(!1)})},350);return()=>clearTimeout(Z)},[n,N,x]);async function L(Q){if(Q.preventDefault(),!(!G||w)){C(!0),S(null);try{const re=await wT(n==="new"?{name:c.trim(),createRepo:!0}:n==="paper"&&!q?{name:c.trim(),createRepo:!0,paperId:N.paperId}:{name:c.trim(),githubOwner:q.owner,githubRepo:q.repo,baselineBranch:_.trim()||"main",forkRepo:a==="fork",...n==="paper"?{paperId:N.paperId}:{}});e(re)}catch(re){S(re instanceof Error?re.message:String(re))}finally{C(!1)}}}const j=n==="new"||n==="paper"&&!q,$=m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"seg form-seg",children:[m.jsx("button",{type:"button",className:a==="use"?"active":"",onClick:()=>l("use"),children:"Use this repo"}),m.jsx("button",{type:"button",className:a==="fork"?"active":"",onClick:()=>l("fork"),children:"Fork a copy"})]}),m.jsx("span",{className:"repo-hint",children:a==="fork"?`snapshots ${q?`${q.owner}/${q.repo}`:"the repo"} into a private repo on your account`:"experiments push branches here — if you can't push to it, a fork is made automatically"}),m.jsxs("div",{className:"row2",children:[m.jsxs("label",{children:["Project name",m.jsx("input",{value:c,onChange:Q=>{d(!0),f(Q.target.value)},placeholder:"my-research"})]}),m.jsxs("label",{children:["Branch",m.jsx("input",{value:_,onChange:Q=>v(Q.target.value),placeholder:"main"})]})]})]});return m.jsxs("form",{className:"form",onSubmit:L,children:[m.jsxs("div",{className:"seg form-seg",children:[m.jsx("button",{type:"button",className:n==="paper"?"active":"",onClick:()=>r("paper"),children:"From a paper"}),m.jsx("button",{type:"button",className:n==="existing"?"active":"",onClick:()=>r("existing"),children:"Existing repo"}),m.jsx("button",{type:"button",className:n==="new"?"active":"",onClick:()=>r("new"),children:"New blank repo"})]}),n==="existing"&&m.jsxs(m.Fragment,{children:[m.jsxs("label",{children:["GitHub repository",m.jsx("input",{value:u,onChange:Q=>X(Q.target.value),placeholder:"https://github.com/karpathy/nanoGPT",autoFocus:!0,spellCheck:!1}),m.jsx("span",{className:`repo-hint mono ${q?"ok":""}`,children:q?`${q.owner} / ${q.repo}`:u.trim()?"paste a GitHub URL or owner/repo":"URL or owner/repo — cloned with your git credentials"})]}),$]}),n==="paper"&&(N===null?m.jsxs(m.Fragment,{children:[m.jsxs("label",{children:["Paper",m.jsx("input",{value:x,onChange:Q=>y(Q.target.value),placeholder:"arXiv id, URL, or title — e.g. 1706.03762",autoFocus:!0,spellCheck:!1}),m.jsx("span",{className:`repo-hint ${Y?"":"mono"}`,children:B?"looking up paper…":T?"searching alphaXiv…":Y??"searches alphaXiv by title — or paste an arXiv id / URL"})]}),k.length>0&&m.jsx("div",{className:"paper-results",children:k.map(Q=>m.jsxs("button",{type:"button",onClick:()=>void K(Q.paperId),children:[m.jsx("span",{className:"title",children:fB(Q.title)}),m.jsx("span",{className:"id",children:Q.paperId})]},Q.paperId))})]}):m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"paper-pick",children:[m.jsxs("div",{className:"meta",children:[m.jsx("div",{className:"title",children:N.title||N.paperId}),m.jsxs("div",{className:"id",children:["arXiv ",N.paperId]})]}),m.jsx("button",{type:"button",className:"btn ghost",onClick:O,children:"Change"})]}),m.jsxs("label",{children:["GitHub repository",N.repoUrl?"":" (optional)",m.jsx("input",{value:u,onChange:Q=>X(Q.target.value),placeholder:"owner/repo — leave blank for a new private repo",spellCheck:!1}),m.jsx("span",{className:`repo-hint mono ${q?"ok":""}`,children:q?`${q.owner} / ${q.repo}`+(N.repoUrl&&((U=Wc(N.repoUrl))==null?void 0:U.repo)===q.repo?` · linked on alphaXiv${N.repoStars!=null?` · ★ ${N.repoStars}`:""}`:""):u.trim()?"paste a GitHub URL or owner/repo":"no code linked to this paper — a blank private repo will be created"})]}),q?$:m.jsxs("label",{children:["Project name",m.jsx("input",{value:c,onChange:Q=>{d(!0),f(Q.target.value)},placeholder:"my-research"}),m.jsx("span",{className:`repo-hint mono ${c.trim()?"ok":""}`,children:c.trim()?`creates github.com/you/${xb(c)} · private`:"a blank private repo is created on your GitHub account"})]})]})),n==="new"&&m.jsxs("label",{children:["Project name",m.jsx("input",{value:c,onChange:Q=>{d(!0),f(Q.target.value)},placeholder:"my-research",autoFocus:!0}),m.jsx("span",{className:`repo-hint mono ${c.trim()?"ok":""}`,children:c.trim()?`creates github.com/you/${xb(c)} · private`:"a blank private repo is created on your GitHub account"})]}),b&&m.jsx("div",{className:"error",children:b}),m.jsxs("div",{className:"actions",children:[t&&m.jsx("button",{type:"button",className:"btn ghost",onClick:t,children:"Cancel"}),m.jsx("button",{type:"submit",className:"btn primary",disabled:!G||w,children:w?j?"Creating repo…":a==="fork"?"Forking repo…":"Cloning repo…":"Create project"})]})]})}function wb({projects:e,onOpen:t,onCreated:n,onDeleted:r}){const[a,l]=V.useState(!1),[u,o]=V.useState(null);async function c(f){if(window.confirm(`Delete project "${f.name}"? -Its experiments, runs and chats are removed from orx. The GitHub repo (${f.githubOwner}/${f.githubRepo}) is kept.`)){o(f.id);try{await kT(f.id),r(f.id)}catch(d){window.alert(d instanceof Error?d.message:String(d))}finally{o(null)}}}return m.jsxs("div",{className:"home",children:[m.jsxs("div",{className:"home-inner",children:[m.jsxs("div",{className:"home-brand",children:["Open",m.jsx("span",{children:"Research"})]}),m.jsxs("div",{className:"home-head",children:[m.jsx("h2",{children:"Projects"}),m.jsxs("button",{className:"btn sm",onClick:()=>l(!0),children:[m.jsx(Sg,{size:13})," New project"]})]}),m.jsx("div",{className:"home-list",children:e.length===0?m.jsx("div",{className:"changes-note",children:"No projects yet — create one to get started."}):[...e].sort((f,p)=>p.updatedAt-f.updatedAt).map(f=>m.jsxs("div",{className:"project-card",role:"button",tabIndex:0,onClick:()=>t(f.id),onKeyDown:p=>{(p.key==="Enter"||p.key===" ")&&t(f.id)},children:[m.jsx("span",{className:"name",children:f.name}),m.jsxs("span",{className:"repo mono",children:[f.githubOwner,"/",f.githubRepo," · ",f.baselineBranch]}),f.paperId&&m.jsxs("span",{className:"paper mono",children:["arXiv ",f.paperId]}),m.jsxs("span",{className:"time",children:["created ",ma(f.createdAt)]}),m.jsx("button",{className:"project-delete",title:`Delete ${f.name}`,disabled:u===f.id,onClick:p=>{p.stopPropagation(),c(f)},children:m.jsx($u,{size:14})})]},f.id))})]}),a&&m.jsx("div",{className:"modal-backdrop",onClick:()=>l(!1),children:m.jsxs("div",{className:"modal",onClick:f=>f.stopPropagation(),children:[m.jsx("h2",{children:"New project"}),m.jsx(fB,{onCancel:()=>l(!1),onCreated:f=>{l(!1),n(f)}})]})})]})}function dB(e){const t=XS(e.backend);return t?[t,KS(e.backend)].filter(Boolean).join(" · "):"—"}function pB({runs:e,experiments:t,onOpen:n,onOpenChanges:r,onCancel:a}){const l=new Map(t.map(o=>[o.id,o.slug])),u=[...e].sort((o,c)=>c.createdAt-o.createdAt);return u.length===0?m.jsx("div",{className:"empty-state",children:m.jsx("p",{children:"No runs yet."})}):m.jsx("div",{className:"runs-table-wrap",children:m.jsxs("table",{className:"runs-table",children:[m.jsx("thead",{children:m.jsxs("tr",{children:[m.jsx("th",{children:"Run"}),m.jsx("th",{children:"Experiment"}),m.jsx("th",{children:"Status"}),m.jsx("th",{children:"Backend"}),m.jsx("th",{children:"Commit"}),m.jsx("th",{children:"Started"}),m.jsx("th",{children:"Exit"}),m.jsx("th",{})]})}),m.jsx("tbody",{children:u.map(o=>{const c=o.status==="running"||o.status==="starting";return m.jsxs("tr",{className:"clickable",onClick:()=>n(o),children:[m.jsx("td",{className:"mono",children:Dp(o.id)}),m.jsx("td",{className:"mono",children:l.get(o.experimentId)??Dp(o.experimentId)}),m.jsx("td",{children:m.jsx(Po,{status:o.status})}),m.jsx("td",{className:"mono",children:dB(o)}),m.jsx("td",{className:"mono",children:o.commitSha?o.commitSha.slice(0,7):"—"}),m.jsx("td",{children:ma(o.createdAt)}),m.jsx("td",{className:"mono",children:o.exitCode??"—"}),m.jsx("td",{children:m.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4},children:[m.jsx("button",{className:"icon-btn",title:"Open changes",onClick:f=>{f.stopPropagation(),r(o.experimentId)},children:m.jsx(Uu,{size:14})}),c&&m.jsx("button",{className:"btn sm danger",onClick:f=>{f.stopPropagation(),a(o.id)},children:"Cancel"})]})})]},o.id)})})]})})}function Pt(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,r;n{}};function mh(){for(var e=0,t=arguments.length,n={},r;e=0&&(r=n.slice(a+1),n=n.slice(0,a)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}du.prototype=mh.prototype={constructor:du,on:function(e,t){var n=this._,r=mB(e+"",n),a,l=-1,u=r.length;if(arguments.length<2){for(;++l0)for(var n=new Array(a),r=0,a,l;r=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Eb.hasOwnProperty(t)?{space:Eb[t],local:e}:e}function vB(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===rg&&t.documentElement.namespaceURI===rg?t.createElement(e):t.createElementNS(n,e)}}function yB(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function lC(e){var t=_h(e);return(t.local?yB:vB)(t)}function bB(){}function Em(e){return e==null?bB:function(){return this.querySelector(e)}}function SB(e){typeof e!="function"&&(e=Em(e));for(var t=this._groups,n=t.length,r=new Array(n),a=0;a=b&&(b=x+1);!(D=y[b])&&++b=0;)(u=r[a])&&(l&&u.compareDocumentPosition(l)^4&&l.parentNode.insertBefore(u,l),l=u);return this}function VB(e){e||(e=YB);function t(d,_){return d&&_?e(d.__data__,_.__data__):!d-!_}for(var n=this._groups,r=n.length,a=new Array(r),l=0;lt?1:e>=t?0:NaN}function WB(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function XB(){return Array.from(this)}function KB(){for(var e=this._groups,t=0,n=e.length;t1?this.each((t==null?oI:typeof t=="function"?cI:lI)(e,t,n??"")):la(this.node(),e)}function la(e,t){return e.style.getPropertyValue(t)||dC(e).getComputedStyle(e,null).getPropertyValue(t)}function hI(e){return function(){delete this[e]}}function fI(e,t){return function(){this[e]=t}}function dI(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function pI(e,t){return arguments.length>1?this.each((t==null?hI:typeof t=="function"?dI:fI)(e,t)):this.node()[e]}function pC(e){return e.trim().split(/^|\s+/)}function km(e){return e.classList||new gC(e)}function gC(e){this._node=e,this._names=pC(e.getAttribute("class")||"")}gC.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function mC(e,t){for(var n=km(e),r=-1,a=t.length;++r=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function UI(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,a=t.length,l;n()=>e;function sg(e,{sourceEvent:t,subject:n,target:r,identifier:a,active:l,x:u,y:o,dx:c,dy:f,dispatch:p}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:a,enumerable:!0,configurable:!0},active:{value:l,enumerable:!0,configurable:!0},x:{value:u,enumerable:!0,configurable:!0},y:{value:o,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:f,enumerable:!0,configurable:!0},_:{value:p}})}sg.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function QI(e){return!e.ctrlKey&&!e.button}function JI(){return this.parentNode}function e7(e,t){return t??{x:e.x,y:e.y}}function t7(){return navigator.maxTouchPoints||"ontouchstart"in this}function xC(){var e=QI,t=JI,n=e7,r=t7,a={},l=mh("start","drag","end"),u=0,o,c,f,p,d=0;function _(k){k.on("mousedown.drag",v).filter(r).on("touchstart.drag",y).on("touchmove.drag",S,ZI).on("touchend.drag touchcancel.drag",x).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function v(k,D){if(!(p||!e.call(this,k,D))){var T=b(this,t.call(this,k,D),k,D,"mouse");T&&(Tn(k.view).on("mousemove.drag",w,Vo).on("mouseup.drag",C,Vo),bC(k.view),gp(k),f=!1,o=k.clientX,c=k.clientY,T("start",k))}}function w(k){if(ra(k),!f){var D=k.clientX-o,T=k.clientY-c;f=D*D+T*T>d}a.mouse("drag",k)}function C(k){Tn(k.view).on("mousemove.drag mouseup.drag",null),SC(k.view,f),ra(k),a.mouse("end",k)}function y(k,D){if(e.call(this,k,D)){var T=k.changedTouches,R=t.call(this,k,D),N=T.length,M,B;for(M=0;M>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Zc(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Zc(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=i7.exec(e))?new mn(t[1],t[2],t[3],1):(t=r7.exec(e))?new mn(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=s7.exec(e))?Zc(t[1],t[2],t[3],t[4]):(t=a7.exec(e))?Zc(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=o7.exec(e))?Mb(t[1],t[2]/100,t[3]/100,1):(t=l7.exec(e))?Mb(t[1],t[2]/100,t[3]/100,t[4]):kb.hasOwnProperty(e)?Nb(kb[e]):e==="transparent"?new mn(NaN,NaN,NaN,0):null}function Nb(e){return new mn(e>>16&255,e>>8&255,e&255,1)}function Zc(e,t,n,r){return r<=0&&(e=t=n=NaN),new mn(e,t,n,r)}function h7(e){return e instanceof ul||(e=Jr(e)),e?(e=e.rgb(),new mn(e.r,e.g,e.b,e.opacity)):new mn}function ag(e,t,n,r){return arguments.length===1?h7(e):new mn(e,t,n,r??1)}function mn(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}Am(mn,ag,wC(ul,{brighter(e){return e=e==null?Nu:Math.pow(Nu,e),new mn(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Yo:Math.pow(Yo,e),new mn(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new mn(Kr(this.r),Kr(this.g),Kr(this.b),Du(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Db,formatHex:Db,formatHex8:f7,formatRgb:Rb,toString:Rb}));function Db(){return`#${Wr(this.r)}${Wr(this.g)}${Wr(this.b)}`}function f7(){return`#${Wr(this.r)}${Wr(this.g)}${Wr(this.b)}${Wr((isNaN(this.opacity)?1:this.opacity)*255)}`}function Rb(){const e=Du(this.opacity);return`${e===1?"rgb(":"rgba("}${Kr(this.r)}, ${Kr(this.g)}, ${Kr(this.b)}${e===1?")":`, ${e})`}`}function Du(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Kr(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Wr(e){return e=Kr(e),(e<16?"0":"")+e.toString(16)}function Mb(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Xn(e,t,n,r)}function CC(e){if(e instanceof Xn)return new Xn(e.h,e.s,e.l,e.opacity);if(e instanceof ul||(e=Jr(e)),!e)return new Xn;if(e instanceof Xn)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,a=Math.min(t,n,r),l=Math.max(t,n,r),u=NaN,o=l-a,c=(l+a)/2;return o?(t===l?u=(n-r)/o+(n0&&c<1?0:u,new Xn(u,o,c,e.opacity)}function d7(e,t,n,r){return arguments.length===1?CC(e):new Xn(e,t,n,r??1)}function Xn(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Am(Xn,d7,wC(ul,{brighter(e){return e=e==null?Nu:Math.pow(Nu,e),new Xn(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Yo:Math.pow(Yo,e),new Xn(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,a=2*n-r;return new mn(mp(e>=240?e-240:e+120,a,r),mp(e,a,r),mp(e<120?e+240:e-120,a,r),this.opacity)},clamp(){return new Xn(Lb(this.h),Qc(this.s),Qc(this.l),Du(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Du(this.opacity);return`${e===1?"hsl(":"hsla("}${Lb(this.h)}, ${Qc(this.s)*100}%, ${Qc(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Lb(e){return e=(e||0)%360,e<0?e+360:e}function Qc(e){return Math.max(0,Math.min(1,e||0))}function mp(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const Tm=e=>()=>e;function p7(e,t){return function(n){return e+n*t}}function g7(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function m7(e){return(e=+e)==1?EC:function(t,n){return n-t?g7(t,n,e):Tm(isNaN(t)?n:t)}}function EC(e,t){var n=t-e;return n?p7(e,n):Tm(isNaN(e)?t:e)}const Ru=(function e(t){var n=m7(t);function r(a,l){var u=n((a=ag(a)).r,(l=ag(l)).r),o=n(a.g,l.g),c=n(a.b,l.b),f=EC(a.opacity,l.opacity);return function(p){return a.r=u(p),a.g=o(p),a.b=c(p),a.opacity=f(p),a+""}}return r.gamma=e,r})(1);function _7(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),a;return function(l){for(a=0;an&&(l=t.slice(n,l),o[u]?o[u]+=l:o[++u]=l),(r=r[0])===(a=a[0])?o[u]?o[u]+=a:o[++u]=a:(o[++u]=null,c.push({i:u,x:oi(r,a)})),n=_p.lastIndex;return n180?p+=360:p-f>180&&(f+=360),_.push({i:d.push(a(d)+"rotate(",null,r)-2,x:oi(f,p)})):p&&d.push(a(d)+"rotate("+p+r)}function o(f,p,d,_){f!==p?_.push({i:d.push(a(d)+"skewX(",null,r)-2,x:oi(f,p)}):p&&d.push(a(d)+"skewX("+p+r)}function c(f,p,d,_,v,w){if(f!==d||p!==_){var C=v.push(a(v)+"scale(",null,",",null,")");w.push({i:C-4,x:oi(f,d)},{i:C-2,x:oi(p,_)})}else(d!==1||_!==1)&&v.push(a(v)+"scale("+d+","+_+")")}return function(f,p){var d=[],_=[];return f=e(f),p=e(p),l(f.translateX,f.translateY,p.translateX,p.translateY,d,_),u(f.rotate,p.rotate,d,_),o(f.skewX,p.skewX,d,_),c(f.scaleX,f.scaleY,p.scaleX,p.scaleY,d,_),f=p=null,function(v){for(var w=-1,C=_.length,y;++w=0&&e._call.call(void 0,t),e=e._next;--ca}function Bb(){es=(Lu=Xo.now())+vh,ca=ko=0;try{M7()}finally{ca=0,O7(),es=0}}function L7(){var e=Xo.now(),t=e-Lu;t>NC&&(vh-=t,Lu=e)}function O7(){for(var e,t=Mu,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:Mu=n);Ao=e,cg(r)}function cg(e){if(!ca){ko&&(ko=clearTimeout(ko));var t=e-es;t>24?(e<1/0&&(ko=setTimeout(Bb,e-Xo.now()-vh)),Co&&(Co=clearInterval(Co))):(Co||(Lu=Xo.now(),Co=setInterval(L7,NC)),ca=1,DC(Bb))}}function Ib(e,t,n){var r=new Ou;return t=t==null?0:+t,r.restart(a=>{r.stop(),e(a+t)},t,n),r}var j7=mh("start","end","cancel","interrupt"),B7=[],MC=0,zb=1,ug=2,gu=3,Hb=4,hg=5,mu=6;function yh(e,t,n,r,a,l){var u=e.__transition;if(!u)e.__transition={};else if(n in u)return;I7(e,n,{name:t,index:r,group:a,on:j7,tween:B7,time:l.time,delay:l.delay,duration:l.duration,ease:l.ease,timer:null,state:MC})}function Dm(e,t){var n=ei(e,t);if(n.state>MC)throw new Error("too late; already scheduled");return n}function fi(e,t){var n=ei(e,t);if(n.state>gu)throw new Error("too late; already running");return n}function ei(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function I7(e,t,n){var r=e.__transition,a;r[t]=n,n.timer=RC(l,0,n.time);function l(f){n.state=zb,n.timer.restart(u,n.delay,n.time),n.delay<=f&&u(f-n.delay)}function u(f){var p,d,_,v;if(n.state!==zb)return c();for(p in r)if(v=r[p],v.name===n.name){if(v.state===gu)return Ib(u);v.state===Hb?(v.state=mu,v.timer.stop(),v.on.call("interrupt",e,e.__data__,v.index,v.group),delete r[p]):+pug&&r.state=0&&(t=t.slice(0,n)),!t||t==="start"})}function d9(e,t,n){var r,a,l=f9(t)?Dm:fi;return function(){var u=l(this,e),o=u.on;o!==r&&(a=(r=o).copy()).on(t,n),u.on=a}}function p9(e,t){var n=this._id;return arguments.length<2?ei(this.node(),n).on.on(e):this.each(d9(n,e,t))}function g9(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function m9(){return this.on("end.remove",g9(this._id))}function _9(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Em(e));for(var r=this._groups,a=r.length,l=new Array(a),u=0;u()=>e;function U9(e,{sourceEvent:t,target:n,transform:r,dispatch:a}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:a}})}function ji(e,t,n){this.k=e,this.x=t,this.y=n}ji.prototype={constructor:ji,scale:function(e){return e===1?this:new ji(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new ji(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var bh=new ji(1,0,0);BC.prototype=ji.prototype;function BC(e){for(;!e.__zoom;)if(!(e=e.parentNode))return bh;return e.__zoom}function vp(e){e.stopImmediatePropagation()}function Eo(e){e.preventDefault(),e.stopImmediatePropagation()}function $9(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function G9(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function Fb(){return this.__zoom||bh}function q9(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function V9(){return navigator.maxTouchPoints||"ontouchstart"in this}function Y9(e,t,n){var r=e.invertX(t[0][0])-n[0][0],a=e.invertX(t[1][0])-n[1][0],l=e.invertY(t[0][1])-n[0][1],u=e.invertY(t[1][1])-n[1][1];return e.translate(a>r?(r+a)/2:Math.min(0,r)||Math.max(0,a),u>l?(l+u)/2:Math.min(0,l)||Math.max(0,u))}function IC(){var e=$9,t=G9,n=Y9,r=q9,a=V9,l=[0,1/0],u=[[-1/0,-1/0],[1/0,1/0]],o=250,c=pu,f=mh("start","zoom","end"),p,d,_,v=500,w=150,C=0,y=10;function S(z){z.property("__zoom",Fb).on("wheel.zoom",N,{passive:!1}).on("mousedown.zoom",M).on("dblclick.zoom",B).filter(a).on("touchstart.zoom",H).on("touchmove.zoom",Y).on("touchend.zoom touchcancel.zoom",F).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}S.transform=function(z,q,G,X){var K=z.selection?z.selection():z;K.property("__zoom",Fb),z!==K?D(z,q,G,X):K.interrupt().each(function(){T(this,arguments).event(X).start().zoom(null,typeof q=="function"?q.apply(this,arguments):q).end()})},S.scaleBy=function(z,q,G,X){S.scaleTo(z,function(){var K=this.__zoom.k,O=typeof q=="function"?q.apply(this,arguments):q;return K*O},G,X)},S.scaleTo=function(z,q,G,X){S.transform(z,function(){var K=t.apply(this,arguments),O=this.__zoom,L=G==null?k(K):typeof G=="function"?G.apply(this,arguments):G,j=O.invert(L),$=typeof q=="function"?q.apply(this,arguments):q;return n(b(x(O,$),L,j),K,u)},G,X)},S.translateBy=function(z,q,G,X){S.transform(z,function(){return n(this.__zoom.translate(typeof q=="function"?q.apply(this,arguments):q,typeof G=="function"?G.apply(this,arguments):G),t.apply(this,arguments),u)},null,X)},S.translateTo=function(z,q,G,X,K){S.transform(z,function(){var O=t.apply(this,arguments),L=this.__zoom,j=X==null?k(O):typeof X=="function"?X.apply(this,arguments):X;return n(bh.translate(j[0],j[1]).scale(L.k).translate(typeof q=="function"?-q.apply(this,arguments):-q,typeof G=="function"?-G.apply(this,arguments):-G),O,u)},X,K)};function x(z,q){return q=Math.max(l[0],Math.min(l[1],q)),q===z.k?z:new ji(q,z.x,z.y)}function b(z,q,G){var X=q[0]-G[0]*z.k,K=q[1]-G[1]*z.k;return X===z.x&&K===z.y?z:new ji(z.k,X,K)}function k(z){return[(+z[0][0]+ +z[1][0])/2,(+z[0][1]+ +z[1][1])/2]}function D(z,q,G,X){z.on("start.zoom",function(){T(this,arguments).event(X).start()}).on("interrupt.zoom end.zoom",function(){T(this,arguments).event(X).end()}).tween("zoom",function(){var K=this,O=arguments,L=T(K,O).event(X),j=t.apply(K,O),$=G==null?k(j):typeof G=="function"?G.apply(K,O):G,U=Math.max(j[1][0]-j[0][0],j[1][1]-j[0][1]),Q=K.__zoom,re=typeof q=="function"?q.apply(K,O):q,ae=c(Q.invert($).concat(U/Q.k),re.invert($).concat(U/re.k));return function(Z){if(Z===1)Z=re;else{var P=ae(Z),te=U/P[2];Z=new ji(te,$[0]-P[0]*te,$[1]-P[1]*te)}L.zoom(null,Z)}})}function T(z,q,G){return!G&&z.__zooming||new R(z,q)}function R(z,q){this.that=z,this.args=q,this.active=0,this.sourceEvent=null,this.extent=t.apply(z,q),this.taps=0}R.prototype={event:function(z){return z&&(this.sourceEvent=z),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(z,q){return this.mouse&&z!=="mouse"&&(this.mouse[1]=q.invert(this.mouse[0])),this.touch0&&z!=="touch"&&(this.touch0[1]=q.invert(this.touch0[0])),this.touch1&&z!=="touch"&&(this.touch1[1]=q.invert(this.touch1[0])),this.that.__zoom=q,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(z){var q=Tn(this.that).datum();f.call(z,this.that,new U9(z,{sourceEvent:this.sourceEvent,target:S,transform:this.that.__zoom,dispatch:f}),q)}};function N(z,...q){if(!e.apply(this,arguments))return;var G=T(this,q).event(z),X=this.__zoom,K=Math.max(l[0],Math.min(l[1],X.k*Math.pow(2,r.apply(this,arguments)))),O=Wn(z);if(G.wheel)(G.mouse[0][0]!==O[0]||G.mouse[0][1]!==O[1])&&(G.mouse[1]=X.invert(G.mouse[0]=O)),clearTimeout(G.wheel);else{if(X.k===K)return;G.mouse=[O,X.invert(O)],_u(this),G.start()}Eo(z),G.wheel=setTimeout(L,w),G.zoom("mouse",n(b(x(X,K),G.mouse[0],G.mouse[1]),G.extent,u));function L(){G.wheel=null,G.end()}}function M(z,...q){if(_||!e.apply(this,arguments))return;var G=z.currentTarget,X=T(this,q,!0).event(z),K=Tn(z.view).on("mousemove.zoom",$,!0).on("mouseup.zoom",U,!0),O=Wn(z,G),L=z.clientX,j=z.clientY;bC(z.view),vp(z),X.mouse=[O,this.__zoom.invert(O)],_u(this),X.start();function $(Q){if(Eo(Q),!X.moved){var re=Q.clientX-L,ae=Q.clientY-j;X.moved=re*re+ae*ae>C}X.event(Q).zoom("mouse",n(b(X.that.__zoom,X.mouse[0]=Wn(Q,G),X.mouse[1]),X.extent,u))}function U(Q){K.on("mousemove.zoom mouseup.zoom",null),SC(Q.view,X.moved),Eo(Q),X.event(Q).end()}}function B(z,...q){if(e.apply(this,arguments)){var G=this.__zoom,X=Wn(z.changedTouches?z.changedTouches[0]:z,this),K=G.invert(X),O=G.k*(z.shiftKey?.5:2),L=n(b(x(G,O),X,K),t.apply(this,q),u);Eo(z),o>0?Tn(this).transition().duration(o).call(D,L,X,z):Tn(this).call(S.transform,L,X,z)}}function H(z,...q){if(e.apply(this,arguments)){var G=z.touches,X=G.length,K=T(this,q,z.changedTouches.length===X).event(z),O,L,j,$;for(vp(z),L=0;L`Seems like you have not used ${e==="svelte"?"SvelteFlowProvider":"ReactFlowProvider"} as an ancestor. Help: https://${e}flow.dev/error#001`,error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:r}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.",error016:e=>`Edge with id "${e}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`},Ko=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],zC=["Enter"," ","Escape"],HC={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var ua;(function(e){e.Strict="strict",e.Loose="loose"})(ua||(ua={}));var Zr;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Zr||(Zr={}));var Zo;(function(e){e.Partial="partial",e.Full="full"})(Zo||(Zo={}));const FC={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var yr;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(yr||(yr={}));var ju;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(ju||(ju={}));var Re;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Re||(Re={}));const Pb={[Re.Left]:Re.Right,[Re.Right]:Re.Left,[Re.Top]:Re.Bottom,[Re.Bottom]:Re.Top};function PC(e){return e===null?null:e?"valid":"invalid"}const UC=e=>!!e&&typeof e=="object"&&"id"in e&&"source"in e&&"target"in e,W9=e=>!!e&&typeof e=="object"&&"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),Mm=e=>!!e&&typeof e=="object"&&"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),hl=(e,t=[0,0])=>{const{width:n,height:r}=di(e),a=e.origin??t,l=n*a[0],u=r*a[1];return{x:e.position.x-l,y:e.position.y-u}},X9=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,a)=>{const l=typeof a=="string";let u=!t.nodeLookup&&!l?a:void 0;t.nodeLookup&&(u=l?t.nodeLookup.get(a):Mm(a)?a:t.nodeLookup.get(a.id));const o=u?Bu(u,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Sh(r,o)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return xh(n)},fl=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(a=>{(t.filter===void 0||t.filter(a))&&(n=Sh(n,Bu(a)),r=!0)}),r?xh(n):{x:0,y:0,width:0,height:0}},Lm=(e,t,[n,r,a]=[0,0,1],l=!1,u=!1)=>{const o=(t.x-n)/a,c=(t.y-r)/a,f=t.width/a,p=t.height/a,d=[];for(const _ of e.values()){const{measured:v,selectable:w=!0,hidden:C=!1}=_;if(u&&!w||C)continue;const y=v.width??_.width??_.initialWidth??0,S=v.height??_.height??_.initialHeight??0,{x,y:b}=_.internals.positionAbsolute,k=VC(o,c,f,p,x,b,y,S),D=y*S,T=l&&k>0;(!_.internals.handleBounds||T||k>=D||_.dragging)&&d.push(_)}return d},K9=(e,t)=>{const n=new Set;return e.forEach(r=>{n.add(r.id)}),t.filter(r=>n.has(r.source)||n.has(r.target))};function Z9(e,t){const n=new Map,r=t!=null&&t.nodes?new Set(t.nodes.map(a=>a.id)):null;return e.forEach(a=>{let l;if(t!=null&&t.includeHiddenNodes){const{width:u,height:o}=di(a);l=u>0&&o>0}else l=!!(a.measured.width&&a.measured.height&&!a.hidden);l&&(!r||r.has(a.id))&&n.set(a.id,a)}),n}async function Q9({nodes:e,width:t,height:n,panZoom:r,minZoom:a,maxZoom:l},u){if(e.size===0)return!0;const o=Z9(e,u),c=fl(o),f=jm(c,t,n,(u==null?void 0:u.minZoom)??a,(u==null?void 0:u.maxZoom)??l,(u==null?void 0:u.padding)??.1);return await r.setViewport(f,{duration:u==null?void 0:u.duration,ease:u==null?void 0:u.ease,interpolate:u==null?void 0:u.interpolate}),!0}function $C({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:a,onError:l}){const u=n.get(e),o=u.parentId?n.get(u.parentId):void 0,{x:c,y:f}=o?o.internals.positionAbsolute:{x:0,y:0},p=u.origin??r;let d=u.extent||a;if(u.extent==="parent"&&!u.expandParent)if(!o)l==null||l("005",Jn.error005());else{const v=o.measured.width,w=o.measured.height;v&&w&&(d=[[c,f],[c+v,f+w]])}else o&&ns(u.extent)&&(d=[[u.extent[0][0]+c,u.extent[0][1]+f],[u.extent[1][0]+c,u.extent[1][1]+f]]);const _=ns(d)?ts(t,d,u.measured):t;return(u.measured.width===void 0||u.measured.height===void 0)&&(l==null||l("015",Jn.error015())),{position:{x:_.x-c+(u.measured.width??0)*p[0],y:_.y-f+(u.measured.height??0)*p[1]},positionAbsolute:_}}async function J9({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:a}){const l=new Set(e.map(_=>_.id)),u=[];for(const _ of n){if(_.deletable===!1)continue;const v=l.has(_.id),w=!v&&_.parentId&&u.find(C=>C.id===_.parentId);(v||w)&&u.push(_)}const o=new Set(t.map(_=>_.id)),c=r.filter(_=>_.deletable!==!1),p=K9(u,c);for(const _ of c)o.has(_.id)&&!p.find(w=>w.id===_.id)&&p.push(_);if(!a)return{edges:p,nodes:u};const d=await a({nodes:u,edges:p});return typeof d=="boolean"?d?{edges:p,nodes:u}:{edges:[],nodes:[]}:d}const ha=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),ts=(e={x:0,y:0},t,n)=>({x:ha(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:ha(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function GC(e,t,n){const{width:r,height:a}=di(n),{x:l,y:u}=n.internals.positionAbsolute;return ts(e,[[l,u],[l+r,u+a]],t)}const Ub=(e,t,n)=>en?-ha(Math.abs(e-n),1,t)/t:0,Om=(e,t,n=15,r=40)=>{const a=Ub(e.x,r,t.width-r)*n,l=Ub(e.y,r,t.height-r)*n;return[a,l]},Sh=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),fg=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),xh=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),Qo=(e,t=[0,0])=>{var a,l;const{x:n,y:r}=Mm(e)?e.internals.positionAbsolute:hl(e,t);return{x:n,y:r,width:((a=e.measured)==null?void 0:a.width)??e.width??e.initialWidth??0,height:((l=e.measured)==null?void 0:l.height)??e.height??e.initialHeight??0}},Bu=(e,t=[0,0])=>{var a,l;const{x:n,y:r}=Mm(e)?e.internals.positionAbsolute:hl(e,t);return{x:n,y:r,x2:n+(((a=e.measured)==null?void 0:a.width)??e.width??e.initialWidth??0),y2:r+(((l=e.measured)==null?void 0:l.height)??e.height??e.initialHeight??0)}},qC=(e,t)=>xh(Sh(fg(e),fg(t))),VC=(e,t,n,r,a,l,u,o)=>{const c=Math.max(0,Math.min(e+n,a+u)-Math.max(e,a)),f=Math.max(0,Math.min(t+r,l+o)-Math.max(t,l));return Math.ceil(c*f)},Iu=(e,t)=>VC(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),$b=e=>Kn(e.width)&&Kn(e.height)&&Kn(e.x)&&Kn(e.y),Kn=e=>!isNaN(e)&&isFinite(e),YC=(e,t)=>(n,r)=>{},dl=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),pl=({x:e,y:t},[n,r,a],l=!1,u=[1,1])=>{const o={x:(e-n)/a,y:(t-r)/a};return l?dl(o,u):o},fa=({x:e,y:t},[n,r,a])=>({x:e*a+n,y:t*a+r});function Xs(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function ez(e,t,n){if(typeof e=="string"||typeof e=="number"){const r=Xs(e,n),a=Xs(e,t);return{top:r,right:a,bottom:r,left:a,x:a*2,y:r*2}}if(typeof e=="object"){const r=Xs(e.top??e.y??0,n),a=Xs(e.bottom??e.y??0,n),l=Xs(e.left??e.x??0,t),u=Xs(e.right??e.x??0,t);return{top:r,right:u,bottom:a,left:l,x:l+u,y:r+a}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function tz(e,t,n,r,a,l){const{x:u,y:o}=fa(e,[t,n,r]),{x:c,y:f}=fa({x:e.x+e.width,y:e.y+e.height},[t,n,r]),p=a-c,d=l-f;return{left:Math.floor(u),top:Math.floor(o),right:Math.floor(p),bottom:Math.floor(d)}}const jm=(e,t,n,r,a,l)=>{const u=ez(l,t,n),o=(t-u.x)/e.width,c=(n-u.y)/e.height,f=Math.min(o,c),p=ha(f,r,a),d=e.x+e.width/2,_=e.y+e.height/2,v=t/2-d*p,w=n/2-_*p,C=tz(e,v,w,p,t,n),y={left:Math.min(C.left-u.left,0),top:Math.min(C.top-u.top,0),right:Math.min(C.right-u.right,0),bottom:Math.min(C.bottom-u.bottom,0)};return{x:v-y.left+y.right,y:w-y.top+y.bottom,zoom:p}},Jo=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function ns(e){return e!=null&&e!=="parent"}function di(e){var t,n;return{width:((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth??0,height:((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight??0}}function WC(e){var t,n;return(((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth)!==void 0&&(((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight)!==void 0}function XC(e,t={width:0,height:0},n,r,a){const l={...e},u=r.get(n);if(u){const o=u.origin||a;l.x+=u.internals.positionAbsolute.x-(t.width??0)*o[0],l.y+=u.internals.positionAbsolute.y-(t.height??0)*o[1]}return l}function Gb(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function nz(){let e,t;return{promise:new Promise((r,a)=>{e=r,t=a}),resolve:e,reject:t}}function iz(e){return{...HC,...e||{}}}function Oo(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:a}){const{x:l,y:u}=Zn(e),o=pl({x:l-((a==null?void 0:a.left)??0),y:u-((a==null?void 0:a.top)??0)},r),{x:c,y:f}=n?dl(o,t):o;return{xSnapped:c,ySnapped:f,...o}}const Bm=e=>({width:e.offsetWidth,height:e.offsetHeight}),KC=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},rz=["INPUT","SELECT","TEXTAREA"];function ZC(e){var r,a;const t=((a=(r=e.composedPath)==null?void 0:r.call(e))==null?void 0:a[0])||e.target;return(t==null?void 0:t.nodeType)!==1?!1:rz.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const QC=e=>"clientX"in e,Zn=(e,t)=>{var l,u;const n=QC(e),r=n?e.clientX:(l=e.touches)==null?void 0:l[0].clientX,a=n?e.clientY:(u=e.touches)==null?void 0:u[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:a-((t==null?void 0:t.top)??0)}},qb=(e,t,n,r,a)=>{const l=t.querySelectorAll(`.${e}`);return!l||!l.length?null:Array.from(l).map(u=>{const o=u.getBoundingClientRect();return{id:u.getAttribute("data-handleid"),type:e,nodeId:a,position:u.getAttribute("data-handlepos"),x:(o.left-n.left)/r,y:(o.top-n.top)/r,...Bm(u)}})};function JC({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:a,sourceControlY:l,targetControlX:u,targetControlY:o}){const c=e*.125+a*.375+u*.375+n*.125,f=t*.125+l*.375+o*.375+r*.125,p=Math.abs(c-e),d=Math.abs(f-t);return[c,f,p,d]}function tu(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Vb({pos:e,x1:t,y1:n,x2:r,y2:a,c:l}){switch(e){case Re.Left:return[t-tu(t-r,l),n];case Re.Right:return[t+tu(r-t,l),n];case Re.Top:return[t,n-tu(n-a,l)];case Re.Bottom:return[t,n+tu(a-n,l)]}}function eE({sourceX:e,sourceY:t,sourcePosition:n=Re.Bottom,targetX:r,targetY:a,targetPosition:l=Re.Top,curvature:u=.25}){const[o,c]=Vb({pos:n,x1:e,y1:t,x2:r,y2:a,c:u}),[f,p]=Vb({pos:l,x1:r,y1:a,x2:e,y2:t,c:u}),[d,_,v,w]=JC({sourceX:e,sourceY:t,targetX:r,targetY:a,sourceControlX:o,sourceControlY:c,targetControlX:f,targetControlY:p});return[`M${e},${t} C${o},${c} ${f},${p} ${r},${a}`,d,_,v,w]}function tE({sourceX:e,sourceY:t,targetX:n,targetY:r}){const a=Math.abs(n-e)/2,l=n0}const oz=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,lz=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),cz=(e,t,n={})=>{var l;if(!e.source||!e.target)return(l=n.onError)==null||l.call(n,"006",Jn.error006()),t;const r=n.getEdgeId||oz;let a;return UC(e)?a={...e}:a={...e,id:r(e)},lz(a,t)?t:(a.sourceHandle===null&&delete a.sourceHandle,a.targetHandle===null&&delete a.targetHandle,t.concat(a))};function nE({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[a,l,u,o]=tE({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,a,l,u,o]}const Yb={[Re.Left]:{x:-1,y:0},[Re.Right]:{x:1,y:0},[Re.Top]:{x:0,y:-1},[Re.Bottom]:{x:0,y:1}},uz=({source:e,sourcePosition:t=Re.Bottom,target:n})=>t===Re.Left||t===Re.Right?e.xMath.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function hz({source:e,sourcePosition:t=Re.Bottom,target:n,targetPosition:r=Re.Top,center:a,offset:l,stepPosition:u}){const o=Yb[t],c=Yb[r],f={x:e.x+o.x*l,y:e.y+o.y*l},p={x:n.x+c.x*l,y:n.y+c.y*l},d=uz({source:f,sourcePosition:t,target:p}),_=d.x!==0?"x":"y",v=d[_];let w=[],C,y;const S={x:0,y:0},x={x:0,y:0},[,,b,k]=tE({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(o[_]*c[_]===-1){_==="x"?(C=a.x??f.x+(p.x-f.x)*u,y=a.y??(f.y+p.y)/2):(C=a.x??(f.x+p.x)/2,y=a.y??f.y+(p.y-f.y)*u);const N=[{x:C,y:f.y},{x:C,y:p.y}],M=[{x:f.x,y},{x:p.x,y}];o[_]===v?w=_==="x"?N:M:w=_==="x"?M:N}else{const N=[{x:f.x,y:p.y}],M=[{x:p.x,y:f.y}];if(_==="x"?w=o.x===v?M:N:w=o.y===v?N:M,t===r){const z=Math.abs(e[_]-n[_]);if(z<=l){const q=Math.min(l-1,l-z);o[_]===v?S[_]=(f[_]>e[_]?-1:1)*q:x[_]=(p[_]>n[_]?-1:1)*q}}if(t!==r){const z=_==="x"?"y":"x",q=o[_]===c[z],G=f[z]>p[z],X=f[z]=F?(C=(B.x+H.x)/2,y=w[0].y):(C=w[0].x,y=(B.y+H.y)/2)}const D={x:f.x+S.x,y:f.y+S.y},T={x:p.x+x.x,y:p.y+x.y};return[[e,...D.x!==w[0].x||D.y!==w[0].y?[D]:[],...w,...T.x!==w[w.length-1].x||T.y!==w[w.length-1].y?[T]:[],n],C,y,b,k]}function fz(e,t,n,r){const a=Math.min(Wb(e,t)/2,Wb(t,n)/2,r),{x:l,y:u}=t;if(e.x===l&&l===n.x||e.y===u&&u===n.y)return`L${l} ${u}`;if(e.y===u){const f=e.xn.id===t):e[0])||null}function pg(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function pz(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:a}){const l=new Set;return e.reduce((u,o)=>([o.markerStart||r,o.markerEnd||a].forEach(c=>{if(c&&typeof c=="object"){const f=pg(c,t);l.has(f)||(u.push({id:f,color:c.color||n,...c}),l.add(f))}}),u),[]).sort((u,o)=>u.id.localeCompare(o.id))}const iE=1e3,gz=10,Im={nodeOrigin:[0,0],nodeExtent:Ko,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},mz={...Im,checkEquality:!0};function zm(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function _z(e,t,n){const r=zm(Im,n);for(const a of e.values())if(a.parentId)Fm(a,e,t,r);else{const l=hl(a,r.nodeOrigin),u=ns(a.extent)?a.extent:r.nodeExtent,o=ts(l,u,di(a));a.internals.positionAbsolute=o}}function vz(e,t){if(!e.handles)return e.measured?t==null?void 0:t.internals.handleBounds:void 0;const n=[],r=[];for(const a of e.handles){const l={id:a.id,width:a.width??1,height:a.height??1,nodeId:e.id,x:a.x,y:a.y,position:a.position,type:a.type};a.type==="source"?n.push(l):a.type==="target"&&r.push(l)}return{source:n,target:r}}function Hm(e){return e==="manual"}function gg(e,t,n,r={}){var p,d;const a=zm(mz,r),l={i:0},u=new Map(t),o=a!=null&&a.elevateNodesOnSelect&&!Hm(a.zIndexMode)?iE:0;let c=e.length>0,f=!1;t.clear(),n.clear();for(const _ of e){let v=u.get(_.id);if(a.checkEquality&&_===(v==null?void 0:v.internals.userNode))t.set(_.id,v);else{const w=hl(_,a.nodeOrigin),C=ns(_.extent)?_.extent:a.nodeExtent,y=ts(w,C,di(_));v={...a.defaults,..._,measured:{width:(p=_.measured)==null?void 0:p.width,height:(d=_.measured)==null?void 0:d.height},internals:{positionAbsolute:y,handleBounds:vz(_,v),z:rE(_,o,a.zIndexMode),userNode:_}},t.set(_.id,v)}(v.measured===void 0||v.measured.width===void 0||v.measured.height===void 0)&&!v.hidden&&(c=!1),_.parentId&&Fm(v,t,n,r,l),f||(f=_.selected??!1)}return{nodesInitialized:c,hasSelectedNodes:f}}function yz(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function Fm(e,t,n,r,a){const{elevateNodesOnSelect:l,nodeOrigin:u,nodeExtent:o,zIndexMode:c}=zm(Im,r),f=e.parentId,p=t.get(f);if(!p){console.warn(`Parent node ${f} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}yz(e,n),a&&!p.parentId&&p.internals.rootParentIndex===void 0&&c==="auto"&&(p.internals.rootParentIndex=++a.i,p.internals.z=p.internals.z+a.i*gz),a&&p.internals.rootParentIndex!==void 0&&(a.i=p.internals.rootParentIndex);const d=l&&!Hm(c)?iE:0,{x:_,y:v,z:w}=bz(e,p,u,o,d,c),{positionAbsolute:C}=e.internals,y=_!==C.x||v!==C.y;(y||w!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:y?{x:_,y:v}:C,z:w}})}function rE(e,t,n){const r=Kn(e.zIndex)?e.zIndex:0;return Hm(n)?r:r+(e.selected?t:0)}function bz(e,t,n,r,a,l){const{x:u,y:o}=t.internals.positionAbsolute,c=di(e),f=hl(e,n),p=ns(e.extent)?ts(f,e.extent,c):f;let d=ts({x:u+p.x,y:o+p.y},r,c);e.extent==="parent"&&(d=GC(d,c,t));const _=rE(e,a,l),v=t.internals.z??0;return{x:d.x,y:d.y,z:v>=_?v+1:_}}function Pm(e,t,n,r=[0,0]){var u;const a=[],l=new Map;for(const o of e){const c=t.get(o.parentId);if(!c)continue;const f=((u=l.get(o.parentId))==null?void 0:u.expandedRect)??Qo(c),p=qC(f,o.rect);l.set(o.parentId,{expandedRect:p,parent:c})}return l.size>0&&l.forEach(({expandedRect:o,parent:c},f)=>{var b;const p=c.internals.positionAbsolute,d=di(c),_=c.origin??r,v=o.x0||w>0||S||x)&&(a.push({id:f,type:"position",position:{x:c.position.x-v+S,y:c.position.y-w+x}}),(b=n.get(f))==null||b.forEach(k=>{e.some(D=>D.id===k.id)||a.push({id:k.id,type:"position",position:{x:k.position.x+v,y:k.position.y+w}})})),(d.width0){const v=Pm(_,t,n,a);f.push(...v)}return{changes:f,updatedInternals:c}}async function xz({delta:e,panZoom:t,transform:n,translateExtent:r,width:a,height:l}){if(!t||!e.x&&!e.y)return!1;const u=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[a,l]],r);return!!u&&(u.x!==n[0]||u.y!==n[1]||u.k!==n[2])}function Qb(e,t,n,r,a,l){let u=a;const o=r.get(u)||new Map;r.set(u,o.set(n,t)),u=`${a}-${e}`;const c=r.get(u)||new Map;if(r.set(u,c.set(n,t)),l){u=`${a}-${e}-${l}`;const f=r.get(u)||new Map;r.set(u,f.set(n,t))}}function sE(e,t,n){e.clear(),t.clear();for(const r of n){const{source:a,target:l,sourceHandle:u=null,targetHandle:o=null}=r,c={edgeId:r.id,source:a,target:l,sourceHandle:u,targetHandle:o},f=`${a}-${u}--${l}-${o}`,p=`${l}-${o}--${a}-${u}`;Qb("source",c,p,e,a,u),Qb("target",c,f,e,l,o),t.set(r.id,r)}}function aE(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:aE(n,t):!1}function Jb(e,t,n){var a;let r=e;do{if((a=r==null?void 0:r.matches)!=null&&a.call(r,t))return!0;if(r===n)return!1;r=r==null?void 0:r.parentElement}while(r);return!1}function wz(e,t,n,r){const a=new Map;for(const[l,u]of e)if((u.selected||u.id===r)&&(!u.parentId||!aE(u,e))&&(u.draggable||t&&typeof u.draggable>"u")){const o=e.get(l);o&&a.set(l,{id:l,position:o.position||{x:0,y:0},distance:{x:n.x-o.internals.positionAbsolute.x,y:n.y-o.internals.positionAbsolute.y},extent:o.extent,parentId:o.parentId,origin:o.origin,expandParent:o.expandParent,internals:{positionAbsolute:o.internals.positionAbsolute||{x:0,y:0}},measured:{width:o.measured.width??0,height:o.measured.height??0}})}return a}function yp({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){var u,o,c;const a=[];for(const[f,p]of t){const d=(u=n.get(f))==null?void 0:u.internals.userNode;d&&a.push({...d,position:p.position,dragging:r})}if(!e)return[a[0],a];const l=(o=n.get(e))==null?void 0:o.internals.userNode;return[l?{...l,position:((c=t.get(e))==null?void 0:c.position)||l.position,dragging:r}:a[0],a]}function Cz({dragItems:e,snapGrid:t,x:n,y:r}){const a=e.values().next().value;if(!a)return null;const l={x:n-a.distance.x,y:r-a.distance.y},u=dl(l,t);return{x:u.x-l.x,y:u.y-l.y}}function Ez({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:a}){let l={x:null,y:null},u=0,o=new Map,c=!1,f={x:0,y:0},p=null,d=!1,_=null,v=!1,w=!1,C=null;function y({noDragClassName:x,handleSelector:b,domNode:k,isSelectable:D,nodeId:T,nodeClickDistance:R=0}){_=Tn(k);function N({x:Y,y:F}){const{nodeLookup:z,nodeExtent:q,snapGrid:G,snapToGrid:X,nodeOrigin:K,onNodeDrag:O,onSelectionDrag:L,onError:j,updateNodePositions:$}=t();l={x:Y,y:F};let U=!1;const Q=o.size>1,re=Q&&q?fg(fl(o)):null,ae=Q&&X?Cz({dragItems:o,snapGrid:G,x:Y,y:F}):null;for(const[Z,P]of o){if(!z.has(Z))continue;let te={x:Y-P.distance.x,y:F-P.distance.y};X&&(te=ae?{x:Math.round(te.x+ae.x),y:Math.round(te.y+ae.y)}:dl(te,G));let ie=null;if(Q&&q&&!P.extent&&re){const{positionAbsolute:ye}=P.internals,we=ye.x-re.x+q[0][0],Ce=ye.x+P.measured.width-re.x2+q[1][0],Ae=ye.y-re.y+q[0][1],xe=ye.y+P.measured.height-re.y2+q[1][1];ie=[[we,Ae],[Ce,xe]]}const{position:pe,positionAbsolute:he}=$C({nodeId:Z,nextPosition:te,nodeLookup:z,nodeExtent:ie||q,nodeOrigin:K,onError:j});U=U||P.position.x!==pe.x||P.position.y!==pe.y,P.position=pe,P.internals.positionAbsolute=he}if(w=w||U,!!U&&($(o,!0),C&&(r||O||!T&&L))){const[Z,P]=yp({nodeId:T,dragItems:o,nodeLookup:z});r==null||r(C,o,Z,P),O==null||O(C,Z,P),T||L==null||L(C,P)}}async function M(){if(!p)return;const{transform:Y,panBy:F,autoPanSpeed:z,autoPanOnNodeDrag:q}=t();if(!q){c=!1,cancelAnimationFrame(u);return}const[G,X]=Om(f,p,z);(G!==0||X!==0)&&(l.x=(l.x??0)-G/Y[2],l.y=(l.y??0)-X/Y[2],await F({x:G,y:X})&&N(l)),u=requestAnimationFrame(M)}function B(Y){var Q;const{nodeLookup:F,multiSelectionActive:z,nodesDraggable:q,transform:G,snapGrid:X,snapToGrid:K,selectNodesOnDrag:O,onNodeDragStart:L,onSelectionDragStart:j,unselectNodesAndEdges:$}=t();d=!0,(!O||!D)&&!z&&T&&((Q=F.get(T))!=null&&Q.selected||$()),D&&O&&T&&(e==null||e(T));const U=Oo(Y.sourceEvent,{transform:G,snapGrid:X,snapToGrid:K,containerBounds:p});if(l=U,o=wz(F,q,U,T),o.size>0&&(n||L||!T&&j)){const[re,ae]=yp({nodeId:T,dragItems:o,nodeLookup:F});n==null||n(Y.sourceEvent,o,re,ae),L==null||L(Y.sourceEvent,re,ae),T||j==null||j(Y.sourceEvent,ae)}}const H=xC().clickDistance(R).on("start",Y=>{const{domNode:F,nodeDragThreshold:z,transform:q,snapGrid:G,snapToGrid:X}=t();p=(F==null?void 0:F.getBoundingClientRect())||null,v=!1,w=!1,C=Y.sourceEvent,z===0&&B(Y),l=Oo(Y.sourceEvent,{transform:q,snapGrid:G,snapToGrid:X,containerBounds:p}),f=Zn(Y.sourceEvent,p)}).on("drag",Y=>{const{autoPanOnNodeDrag:F,transform:z,snapGrid:q,snapToGrid:G,nodeDragThreshold:X,nodeLookup:K}=t(),O=Oo(Y.sourceEvent,{transform:z,snapGrid:q,snapToGrid:G,containerBounds:p});if(C=Y.sourceEvent,(Y.sourceEvent.type==="touchmove"&&Y.sourceEvent.touches.length>1||T&&!K.has(T))&&(v=!0),!v){if(!c&&F&&d&&(c=!0,M()),!d){const L=Zn(Y.sourceEvent,p),j=L.x-f.x,$=L.y-f.y;Math.sqrt(j*j+$*$)>X&&B(Y)}(l.x!==O.xSnapped||l.y!==O.ySnapped)&&o&&d&&(f=Zn(Y.sourceEvent,p),N(O))}}).on("end",Y=>{if(!d||v){v&&o.size>0&&t().updateNodePositions(o,!1);return}if(c=!1,d=!1,cancelAnimationFrame(u),o.size>0){const{nodeLookup:F,updateNodePositions:z,onNodeDragStop:q,onSelectionDragStop:G}=t();if(w&&(z(o,!1),w=!1),a||q||!T&&G){const[X,K]=yp({nodeId:T,dragItems:o,nodeLookup:F,dragging:!1});a==null||a(Y.sourceEvent,o,X,K),q==null||q(Y.sourceEvent,X,K),T||G==null||G(Y.sourceEvent,K)}}}).filter(Y=>{const F=Y.target;return!Y.button&&(!x||!Jb(F,`.${x}`,k))&&(!b||Jb(F,b,k))});_.call(H)}function S(){_==null||_.on(".drag",null)}return{update:y,destroy:S}}function kz(e,t,n){const r=[],a={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const l of t.values())Iu(a,Qo(l))>0&&r.push(l);return r}const Az=250;function Tz(e,t,n,r){var o,c;let a=[],l=1/0;const u=kz(e,n,t+Az);for(const f of u){const p=[...((o=f.internals.handleBounds)==null?void 0:o.source)??[],...((c=f.internals.handleBounds)==null?void 0:c.target)??[]];for(const d of p){if(r.nodeId===d.nodeId&&r.type===d.type&&r.id===d.id)continue;const{x:_,y:v}=is(f,d,d.position,!0),w=Math.sqrt(Math.pow(_-e.x,2)+Math.pow(v-e.y,2));w>t||(w1){const f=r.type==="source"?"target":"source";return a.find(p=>p.type===f)??a[0]}return a[0]}function oE(e,t,n,r,a,l=!1){var f,p,d;const u=r.get(e);if(!u)return null;const o=a==="strict"?(f=u.internals.handleBounds)==null?void 0:f[t]:[...((p=u.internals.handleBounds)==null?void 0:p.source)??[],...((d=u.internals.handleBounds)==null?void 0:d.target)??[]],c=(n?o==null?void 0:o.find(_=>_.id===n):o==null?void 0:o[0])??null;return c&&l?{...c,...is(u,c,c.position,!0)}:c}function lE(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function Nz(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const cE=()=>!0;function Dz(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:a,edgeUpdaterType:l,isTarget:u,domNode:o,nodeLookup:c,lib:f,autoPanOnConnect:p,flowId:d,panBy:_,cancelConnection:v,onConnectStart:w,onConnect:C,onConnectEnd:y,isValidConnection:S=cE,onReconnectEnd:x,updateConnection:b,getTransform:k,getFromHandle:D,autoPanSpeed:T,dragThreshold:R=1,handleDomNode:N}){const M=KC(e.target);let B=0,H;const{x:Y,y:F}=Zn(e),z=lE(l,N),q=o==null?void 0:o.getBoundingClientRect();let G=!1;if(!q||!z)return;const X=oE(a,z,r,c,t);if(!X)return;let K=Zn(e,q),O=!1,L=null,j=!1,$=null;function U(){if(!p||!q)return;const[pe,he]=Om(K,q,T);_({x:pe,y:he}),B=requestAnimationFrame(U)}const Q={...X,nodeId:a,type:z,position:X.position},re=c.get(a);let Z={inProgress:!0,isValid:null,from:is(re,Q,Re.Left,!0),fromHandle:Q,fromPosition:Q.position,fromNode:re,to:K,toHandle:null,toPosition:Pb[Q.position],toNode:null,pointer:K};function P(){G=!0,b(Z),w==null||w(e,{nodeId:a,handleId:r,handleType:z})}R===0&&P();function te(pe){if(!G){const{x:xe,y:Ye}=Zn(pe),lt=xe-Y,dt=Ye-F;if(!(lt*lt+dt*dt>R*R))return;P()}if(!D()||!Q){ie(pe);return}const he=k();K=Zn(pe,q),H=Tz(pl(K,he,!1,[1,1]),n,c,Q),O||(U(),O=!0);const ye=uE(pe,{handle:H,connectionMode:t,fromNodeId:a,fromHandleId:r,fromType:u?"target":"source",isValidConnection:S,doc:M,lib:f,flowId:d,nodeLookup:c});$=ye.handleDomNode,L=ye.connection,j=Nz(!!H,ye.isValid);const we=c.get(a),Ce=we?is(we,Q,Re.Left,!0):Z.from,Ae={...Z,from:Ce,isValid:j,to:ye.toHandle&&j?fa({x:ye.toHandle.x,y:ye.toHandle.y},he):K,toHandle:ye.toHandle,toPosition:j&&ye.toHandle?ye.toHandle.position:Pb[Q.position],toNode:ye.toHandle?c.get(ye.toHandle.nodeId):null,pointer:K};b(Ae),Z=Ae}function ie(pe){if(!("touches"in pe&&pe.touches.length>0)){if(G){(H||$)&&L&&j&&(C==null||C(L));const{inProgress:he,...ye}=Z,we={...ye,toPosition:Z.toHandle?Z.toPosition:null};y==null||y(pe,we),l&&(x==null||x(pe,we))}v(),cancelAnimationFrame(B),O=!1,j=!1,L=null,$=null,M.removeEventListener("mousemove",te),M.removeEventListener("mouseup",ie),M.removeEventListener("touchmove",te),M.removeEventListener("touchend",ie)}}M.addEventListener("mousemove",te),M.addEventListener("mouseup",ie),M.addEventListener("touchmove",te),M.addEventListener("touchend",ie)}function uE(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:a,fromType:l,doc:u,lib:o,flowId:c,isValidConnection:f=cE,nodeLookup:p}){const d=l==="target",_=t?u.querySelector(`.${o}-flow__handle[data-id="${c}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:v,y:w}=Zn(e),C=u.elementFromPoint(v,w),y=C!=null&&C.classList.contains(`${o}-flow__handle`)?C:_,S={handleDomNode:y,isValid:!1,connection:null,toHandle:null};if(y){const x=lE(void 0,y),b=y.getAttribute("data-nodeid"),k=y.getAttribute("data-handleid"),D=y.classList.contains("connectable"),T=y.classList.contains("connectableend");if(!b||!x)return S;const R={source:d?b:r,sourceHandle:d?k:a,target:d?r:b,targetHandle:d?a:k};S.connection=R;const M=D&&T&&(n===ua.Strict?d&&x==="source"||!d&&x==="target":b!==r||k!==a);S.isValid=M&&f(R),S.toHandle=oE(b,x,k,p,n,!0)}return S}const mg={onPointerDown:Dz,isValid:uE};function Rz({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const a=Tn(e);function l({translateExtent:o,width:c,height:f,zoomStep:p=1,pannable:d=!0,zoomable:_=!0,inversePan:v=!1}){const w=b=>{if(b.sourceEvent.type!=="wheel"||!t)return;const k=n(),D=b.sourceEvent.ctrlKey&&Jo()?10:1,T=-b.sourceEvent.deltaY*(b.sourceEvent.deltaMode===1?.05:b.sourceEvent.deltaMode?1:.002)*p,R=k[2]*Math.pow(2,T*D);t.scaleTo(R)};let C=[0,0];const y=b=>{(b.sourceEvent.type==="mousedown"||b.sourceEvent.type==="touchstart")&&(C=[b.sourceEvent.clientX??b.sourceEvent.touches[0].clientX,b.sourceEvent.clientY??b.sourceEvent.touches[0].clientY])},S=b=>{const k=n();if(b.sourceEvent.type!=="mousemove"&&b.sourceEvent.type!=="touchmove"||!t)return;const D=[b.sourceEvent.clientX??b.sourceEvent.touches[0].clientX,b.sourceEvent.clientY??b.sourceEvent.touches[0].clientY],T=[D[0]-C[0],D[1]-C[1]];C=D;const R=r()*Math.max(k[2],Math.log(k[2]))*(v?-1:1),N={x:k[0]-T[0]*R,y:k[1]-T[1]*R},M=[[0,0],[c,f]];t.setViewportConstrained({x:N.x,y:N.y,zoom:k[2]},M,o)},x=IC().on("start",y).on("zoom",d?S:null).on("zoom.wheel",_?w:null);a.call(x,{})}function u(){a.on("zoom",null)}return{update:l,destroy:u,pointer:Wn}}const wh=e=>({x:e.x,y:e.y,zoom:e.k}),bp=({x:e,y:t,zoom:n})=>bh.translate(e,t).scale(n),na=(e,t)=>e.target.closest(`.${t}`),hE=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Mz=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Sp=(e,t=0,n=Mz,r=()=>{})=>{const a=typeof t=="number"&&t>0;return a||r(),a?e.transition().duration(t).ease(n).on("end",r):e},fE=e=>{const t=e.ctrlKey&&Jo()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function Lz({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:a,panOnScrollSpeed:l,zoomOnPinch:u,onPanZoomStart:o,onPanZoom:c,onPanZoomEnd:f}){return p=>{if(na(p,t))return p.ctrlKey&&p.preventDefault(),!1;p.preventDefault(),p.stopImmediatePropagation();const d=n.property("__zoom").k||1;if(p.ctrlKey&&u){const y=Wn(p),S=fE(p),x=d*Math.pow(2,S);r.scaleTo(n,x,y,p);return}const _=p.deltaMode===1?20:1;let v=a===Zr.Vertical?0:p.deltaX*_,w=a===Zr.Horizontal?0:p.deltaY*_;!Jo()&&p.shiftKey&&a!==Zr.Vertical&&(v=p.deltaY*_,w=0),r.translateBy(n,-(v/d)*l,-(w/d)*l,{internal:!0});const C=wh(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?c==null||c(p,C):(e.isPanScrolling=!0,o==null||o(p,C)),e.panScrollTimeout=setTimeout(()=>{f==null||f(p,C),e.isPanScrolling=!1},150)}}function Oz({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,a){const l=r.type==="wheel",u=!t&&l&&!r.ctrlKey,o=na(r,e);if(r.ctrlKey&&l&&o&&r.preventDefault(),u||o)return null;r.preventDefault(),n.call(this,r,a)}}function jz({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{var l,u,o;if((l=r.sourceEvent)!=null&&l.internal)return;const a=wh(r.transform);e.mouseButton=((u=r.sourceEvent)==null?void 0:u.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=a,((o=r.sourceEvent)==null?void 0:o.type)==="mousedown"&&t(!0),n&&(n==null||n(r.sourceEvent,a))}}function Bz({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:a}){return l=>{var u,o;e.usedRightMouseButton=!!(n&&hE(t,e.mouseButton??0)),(u=l.sourceEvent)!=null&&u.sync||r([l.transform.x,l.transform.y,l.transform.k]),a&&!((o=l.sourceEvent)!=null&&o.internal)&&(a==null||a(l.sourceEvent,wh(l.transform)))}}function Iz({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:a,onPaneContextMenu:l}){return u=>{var o;if(!((o=u.sourceEvent)!=null&&o.internal)&&(e.isZoomingOrPanning=!1,l&&hE(t,e.mouseButton??0)&&!e.usedRightMouseButton&&u.sourceEvent&&l(u.sourceEvent),e.usedRightMouseButton=!1,r(!1),a)){const c=wh(u.transform);e.prevViewport=c,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{a==null||a(u.sourceEvent,c)},n?150:0)}}}function zz({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:a,zoomOnDoubleClick:l,userSelectionActive:u,noWheelClassName:o,noPanClassName:c,lib:f,connectionInProgress:p}){return d=>{var y;const _=e||t,v=n&&d.ctrlKey,w=d.type==="wheel";if(d.button===1&&d.type==="mousedown"&&(na(d,`${f}-flow__node`)||na(d,`${f}-flow__edge`)))return!0;if(!r&&!_&&!a&&!l&&!n||u||p&&!w||na(d,o)&&w||na(d,c)&&(!w||a&&w&&!e)||!n&&d.ctrlKey&&w)return!1;if(!n&&d.type==="touchstart"&&((y=d.touches)==null?void 0:y.length)>1)return d.preventDefault(),!1;if(!_&&!a&&!v&&w||!r&&(d.type==="mousedown"||d.type==="touchstart")||Array.isArray(r)&&!r.includes(d.button)&&d.type==="mousedown")return!1;const C=Array.isArray(r)&&r.includes(d.button)||!d.button||d.button<=1;return(!d.ctrlKey||w)&&C}}function Hz({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:a,onPanZoom:l,onPanZoomStart:u,onPanZoomEnd:o,onDraggingChange:c}){const f={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},p=e.getBoundingClientRect();let d=[[0,0],[p.width,p.height]];const _=typeof ResizeObserver<"u"?new ResizeObserver(F=>{const z=F[0];z&&(d=[[0,0],[z.contentRect.width,z.contentRect.height]])}):null;_==null||_.observe(e);const v=IC().extent(()=>d).scaleExtent([t,n]).translateExtent(r),w=Tn(e).call(v);k({x:a.x,y:a.y,zoom:ha(a.zoom,t,n)},[[0,0],[p.width,p.height]],r);const C=w.on("wheel.zoom"),y=w.on("dblclick.zoom");v.wheelDelta(fE);async function S(F,z){return w?new Promise(q=>{v==null||v.interpolate((z==null?void 0:z.interpolate)==="linear"?Lo:pu).transform(Sp(w,z==null?void 0:z.duration,z==null?void 0:z.ease,()=>q(!0)),F)}):!1}function x({noWheelClassName:F,noPanClassName:z,onPaneContextMenu:q,userSelectionActive:G,panOnScroll:X,panOnDrag:K,panOnScrollMode:O,panOnScrollSpeed:L,preventScrolling:j,zoomOnPinch:$,zoomOnScroll:U,zoomOnDoubleClick:Q,zoomActivationKeyPressed:re,lib:ae,onTransformChange:Z,connectionInProgress:P,paneClickDistance:te,selectionOnDrag:ie}){G&&!f.isZoomingOrPanning&&b();const pe=X&&!re&&!G;v.clickDistance(ie?1/0:!Kn(te)||te<0?0:te);const he=pe?Lz({zoomPanValues:f,noWheelClassName:F,d3Selection:w,d3Zoom:v,panOnScrollMode:O,panOnScrollSpeed:L,zoomOnPinch:$,onPanZoomStart:u,onPanZoom:l,onPanZoomEnd:o}):Oz({noWheelClassName:F,preventScrolling:j,d3ZoomHandler:C});w.on("wheel.zoom",he,{passive:!1});const ye=jz({zoomPanValues:f,onDraggingChange:c,onPanZoomStart:u});v.on("start",ye);const we=Bz({zoomPanValues:f,panOnDrag:K,onPaneContextMenu:!!q,onPanZoom:l,onTransformChange:Z});v.on("zoom",we);const Ce=Iz({zoomPanValues:f,panOnDrag:K,panOnScroll:X,onPaneContextMenu:q,onPanZoomEnd:o,onDraggingChange:c});v.on("end",Ce);const Ae=zz({zoomActivationKeyPressed:re,panOnDrag:K,zoomOnScroll:U,panOnScroll:X,zoomOnDoubleClick:Q,zoomOnPinch:$,userSelectionActive:G,noPanClassName:z,noWheelClassName:F,lib:ae,connectionInProgress:P});v.filter(Ae),Q?w.on("dblclick.zoom",y):w.on("dblclick.zoom",null)}function b(){v.on("zoom",null)}async function k(F,z,q){const G=bp(F),X=v==null?void 0:v.constrain()(G,z,q);return X&&await S(X),X}async function D(F,z){const q=bp(F);return await S(q,z),q}function T(F){if(w){const z=bp(F),q=w.property("__zoom");(q.k!==F.zoom||q.x!==F.x||q.y!==F.y)&&(v==null||v.transform(w,z,null,{sync:!0}))}}function R(){const F=w?BC(w.node()):{x:0,y:0,k:1};return{x:F.x,y:F.y,zoom:F.k}}async function N(F,z){return w?new Promise(q=>{v==null||v.interpolate((z==null?void 0:z.interpolate)==="linear"?Lo:pu).scaleTo(Sp(w,z==null?void 0:z.duration,z==null?void 0:z.ease,()=>q(!0)),F)}):!1}async function M(F,z){return w?new Promise(q=>{v==null||v.interpolate((z==null?void 0:z.interpolate)==="linear"?Lo:pu).scaleBy(Sp(w,z==null?void 0:z.duration,z==null?void 0:z.ease,()=>q(!0)),F)}):!1}function B(F){v==null||v.scaleExtent(F)}function H(F){v==null||v.translateExtent(F)}function Y(F){const z=!Kn(F)||F<0?0:F;v==null||v.clickDistance(z)}return{update:x,destroy:b,setViewport:D,setViewportConstrained:k,getViewport:R,scaleTo:N,scaleBy:M,setScaleExtent:B,setTranslateExtent:H,syncViewport:T,setClickDistance:Y}}var da;(function(e){e.Line="line",e.Handle="handle"})(da||(da={}));function Fz({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:a,affectsY:l}){const u=e-t,o=n-r,c=[u>0?1:u<0?-1:0,o>0?1:o<0?-1:0];return u&&a&&(c[0]=c[0]*-1),o&&l&&(c[1]=c[1]*-1),c}function eS(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),r=e.includes("left"),a=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:r,affectsY:a}}function _r(e,t){return Math.max(0,t-e)}function vr(e,t){return Math.max(0,e-t)}function nu(e,t,n){return Math.max(0,t-e,e-n)}function tS(e,t){return e?!t:t}function Pz(e,t,n,r,a,l,u,o){let{affectsX:c,affectsY:f}=t;const{isHorizontal:p,isVertical:d}=t,_=p&&d,{xSnapped:v,ySnapped:w}=n,{minWidth:C,maxWidth:y,minHeight:S,maxHeight:x}=r,{x:b,y:k,width:D,height:T,aspectRatio:R}=e;let N=Math.floor(p?v-e.pointerX:0),M=Math.floor(d?w-e.pointerY:0);const B=D+(c?-N:N),H=T+(f?-M:M),Y=-l[0]*D,F=-l[1]*T;let z=nu(B,C,y),q=nu(H,S,x);if(u){let K=0,O=0;c&&N<0?K=_r(b+N+Y,u[0][0]):!c&&N>0&&(K=vr(b+B+Y,u[1][0])),f&&M<0?O=_r(k+M+F,u[0][1]):!f&&M>0&&(O=vr(k+H+F,u[1][1])),z=Math.max(z,K),q=Math.max(q,O)}if(o){let K=0,O=0;c&&N>0?K=vr(b+N,o[0][0]):!c&&N<0&&(K=_r(b+B,o[1][0])),f&&M>0?O=vr(k+M,o[0][1]):!f&&M<0&&(O=_r(k+H,o[1][1])),z=Math.max(z,K),q=Math.max(q,O)}if(a){if(p){const K=nu(B/R,S,x)*R;if(z=Math.max(z,K),u){let O=0;!c&&!f||c&&!f&&_?O=vr(k+F+B/R,u[1][1])*R:O=_r(k+F+(c?N:-N)/R,u[0][1])*R,z=Math.max(z,O)}if(o){let O=0;!c&&!f||c&&!f&&_?O=_r(k+B/R,o[1][1])*R:O=vr(k+(c?N:-N)/R,o[0][1])*R,z=Math.max(z,O)}}if(d){const K=nu(H*R,C,y)/R;if(q=Math.max(q,K),u){let O=0;!c&&!f||f&&!c&&_?O=vr(b+H*R+Y,u[1][0])/R:O=_r(b+(f?M:-M)*R+Y,u[0][0])/R,q=Math.max(q,O)}if(o){let O=0;!c&&!f||f&&!c&&_?O=_r(b+H*R,o[1][0])/R:O=vr(b+(f?M:-M)*R,o[0][0])/R,q=Math.max(q,O)}}}M=M+(M<0?q:-q),N=N+(N<0?z:-z),a&&(_?B>H*R?M=(tS(c,f)?-N:N)/R:N=(tS(c,f)?-M:M)*R:p?(M=N/R,f=c):(N=M*R,c=f));const G=c?b+N:b,X=f?k+M:k;return{width:D+(c?-N:N),height:T+(f?-M:M),x:l[0]*N*(c?-1:1)+G,y:l[1]*M*(f?-1:1)+X}}const dE={width:0,height:0,x:0,y:0},Uz={...dE,pointerX:0,pointerY:0,aspectRatio:1};function $z(e,t,n){const r=t.position.x+e.position.x,a=t.position.y+e.position.y,l=e.measured.width??0,u=e.measured.height??0,o=n[0]*l,c=n[1]*u;return[[r-o,a-c],[r+l-o,a+u-c]]}function Gz({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:a}){const l=Tn(e);let u={controlDirection:eS("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function o({controlPosition:f,boundaries:p,keepAspectRatio:d,resizeDirection:_,onResizeStart:v,onResize:w,onResizeEnd:C,shouldResize:y}){let S={...dE},x={...Uz};u={boundaries:p,resizeDirection:_,keepAspectRatio:d,controlDirection:eS(f)};let b,k=null,D=[],T,R,N,M=!1;const B=xC().on("start",H=>{const{nodeLookup:Y,transform:F,snapGrid:z,snapToGrid:q,nodeOrigin:G,paneDomNode:X}=n();if(b=Y.get(t),!b)return;k=(X==null?void 0:X.getBoundingClientRect())??null;const{xSnapped:K,ySnapped:O}=Oo(H.sourceEvent,{transform:F,snapGrid:z,snapToGrid:q,containerBounds:k});S={width:b.measured.width??0,height:b.measured.height??0,x:b.position.x??0,y:b.position.y??0},x={...S,pointerX:K,pointerY:O,aspectRatio:S.width/S.height},T=void 0,R=ns(b.extent)?b.extent:void 0,b.parentId&&(b.extent==="parent"||b.expandParent)&&(T=Y.get(b.parentId)),T&&b.extent==="parent"&&(R=[[0,0],[T.measured.width,T.measured.height]]),D=[],N=void 0;for(const[L,j]of Y)if(j.parentId===t&&(D.push({id:L,position:{...j.position},extent:j.extent}),j.extent==="parent"||j.expandParent)){const $=$z(j,b,j.origin??G);N?N=[[Math.min($[0][0],N[0][0]),Math.min($[0][1],N[0][1])],[Math.max($[1][0],N[1][0]),Math.max($[1][1],N[1][1])]]:N=$}v==null||v(H,{...S})}).on("drag",H=>{const{transform:Y,snapGrid:F,snapToGrid:z,nodeOrigin:q}=n(),G=Oo(H.sourceEvent,{transform:Y,snapGrid:F,snapToGrid:z,containerBounds:k}),X=[];if(!b)return;const{x:K,y:O,width:L,height:j}=S,$={},U=b.origin??q,{width:Q,height:re,x:ae,y:Z}=Pz(x,u.controlDirection,G,u.boundaries,u.keepAspectRatio,U,R,N),P=Q!==L,te=re!==j,ie=ae!==K&&P,pe=Z!==O&&te;if(!ie&&!pe&&!P&&!te)return;if((ie||pe||U[0]===1||U[1]===1)&&($.x=ie?ae:S.x,$.y=pe?Z:S.y,S.x=$.x,S.y=$.y,D.length>0)){const Ce=ae-K,Ae=Z-O;for(const xe of D)xe.position={x:xe.position.x-Ce+U[0]*(Q-L),y:xe.position.y-Ae+U[1]*(re-j)},X.push(xe)}if((P||te)&&($.width=P&&(!u.resizeDirection||u.resizeDirection==="horizontal")?Q:S.width,$.height=te&&(!u.resizeDirection||u.resizeDirection==="vertical")?re:S.height,S.width=$.width,S.height=$.height),T&&b.expandParent){const Ce=U[0]*($.width??0);$.x&&$.x{M&&(C==null||C(H,{...S}),a==null||a({...S}),M=!1)});l.call(B)}function c(){l.on(".drag",null)}return{update:o,destroy:c}}var xp={exports:{}},wp={},Cp={exports:{}},Ep={};/** +Its experiments, runs and chats are removed from orx. The GitHub repo (${f.githubOwner}/${f.githubRepo}) is kept.`)){o(f.id);try{await AT(f.id),r(f.id)}catch(d){window.alert(d instanceof Error?d.message:String(d))}finally{o(null)}}}return m.jsxs("div",{className:"home",children:[m.jsxs("div",{className:"home-inner",children:[m.jsxs("div",{className:"home-brand",children:["Open",m.jsx("span",{children:"Research"})]}),m.jsxs("div",{className:"home-head",children:[m.jsx("h2",{children:"Projects"}),m.jsxs("button",{className:"btn sm",onClick:()=>l(!0),children:[m.jsx(Sg,{size:13})," New project"]})]}),m.jsx("div",{className:"home-list",children:e.length===0?m.jsx("div",{className:"changes-note",children:"No projects yet — create one to get started."}):[...e].sort((f,p)=>p.updatedAt-f.updatedAt).map(f=>m.jsxs("div",{className:"project-card",role:"button",tabIndex:0,onClick:()=>t(f.id),onKeyDown:p=>{(p.key==="Enter"||p.key===" ")&&t(f.id)},children:[m.jsx("span",{className:"name",children:f.name}),m.jsxs("span",{className:"repo mono",children:[f.githubOwner,"/",f.githubRepo," · ",f.baselineBranch]}),f.paperId&&m.jsxs("span",{className:"paper mono",children:["arXiv ",f.paperId]}),m.jsxs("span",{className:"time",children:["created ",ga(f.createdAt)]}),m.jsx("button",{className:"project-delete",title:`Delete ${f.name}`,disabled:u===f.id,onClick:p=>{p.stopPropagation(),c(f)},children:m.jsx(Uu,{size:14})})]},f.id))})]}),a&&m.jsx("div",{className:"modal-backdrop",onClick:()=>l(!1),children:m.jsxs("div",{className:"modal",onClick:f=>f.stopPropagation(),children:[m.jsx("h2",{children:"New project"}),m.jsx(dB,{onCancel:()=>l(!1),onCreated:f=>{l(!1),n(f)}})]})})]})}function pB(e){const t=XS(e.backend);return t?[t,KS(e.backend)].filter(Boolean).join(" · "):"—"}function gB({runs:e,experiments:t,onOpen:n,onOpenChanges:r,onCancel:a}){const l=new Map(t.map(o=>[o.id,o.slug])),u=[...e].sort((o,c)=>c.createdAt-o.createdAt);return u.length===0?m.jsx("div",{className:"empty-state",children:m.jsx("p",{children:"No runs yet."})}):m.jsx("div",{className:"runs-table-wrap",children:m.jsxs("table",{className:"runs-table",children:[m.jsx("thead",{children:m.jsxs("tr",{children:[m.jsx("th",{children:"Run"}),m.jsx("th",{children:"Experiment"}),m.jsx("th",{children:"Status"}),m.jsx("th",{children:"Backend"}),m.jsx("th",{children:"Commit"}),m.jsx("th",{children:"Started"}),m.jsx("th",{children:"Exit"}),m.jsx("th",{})]})}),m.jsx("tbody",{children:u.map(o=>{const c=o.status==="running"||o.status==="starting";return m.jsxs("tr",{className:"clickable",onClick:()=>n(o),children:[m.jsx("td",{className:"mono",children:Np(o.id)}),m.jsx("td",{className:"mono",children:l.get(o.experimentId)??Np(o.experimentId)}),m.jsx("td",{children:m.jsx(Po,{status:o.status})}),m.jsx("td",{className:"mono",children:pB(o)}),m.jsx("td",{className:"mono",children:o.commitSha?o.commitSha.slice(0,7):"—"}),m.jsx("td",{children:ga(o.createdAt)}),m.jsx("td",{className:"mono",children:o.exitCode??"—"}),m.jsx("td",{children:m.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4},children:[m.jsx("button",{className:"icon-btn",title:"Open changes",onClick:f=>{f.stopPropagation(),r(o.experimentId)},children:m.jsx(Pu,{size:14})}),c&&m.jsx("button",{className:"btn sm danger",onClick:f=>{f.stopPropagation(),a(o.id)},children:"Cancel"})]})})]},o.id)})})]})})}function Pt(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,r;n{}};function gh(){for(var e=0,t=arguments.length,n={},r;e=0&&(r=n.slice(a+1),n=n.slice(0,a)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}fu.prototype=gh.prototype={constructor:fu,on:function(e,t){var n=this._,r=_B(e+"",n),a,l=-1,u=r.length;if(arguments.length<2){for(;++l0)for(var n=new Array(a),r=0,a,l;r=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Eb.hasOwnProperty(t)?{space:Eb[t],local:e}:e}function yB(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===ig&&t.documentElement.namespaceURI===ig?t.createElement(e):t.createElementNS(n,e)}}function bB(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function cC(e){var t=mh(e);return(t.local?bB:yB)(t)}function SB(){}function Em(e){return e==null?SB:function(){return this.querySelector(e)}}function xB(e){typeof e!="function"&&(e=Em(e));for(var t=this._groups,n=t.length,r=new Array(n),a=0;a=y&&(y=x+1);!(D=b[y])&&++y=0;)(u=r[a])&&(l&&u.compareDocumentPosition(l)^4&&l.parentNode.insertBefore(u,l),l=u);return this}function YB(e){e||(e=WB);function t(d,_){return d&&_?e(d.__data__,_.__data__):!d-!_}for(var n=this._groups,r=n.length,a=new Array(r),l=0;lt?1:e>=t?0:NaN}function XB(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function KB(){return Array.from(this)}function ZB(){for(var e=this._groups,t=0,n=e.length;t1?this.each((t==null?lI:typeof t=="function"?uI:cI)(e,t,n??"")):oa(this.node(),e)}function oa(e,t){return e.style.getPropertyValue(t)||pC(e).getComputedStyle(e,null).getPropertyValue(t)}function fI(e){return function(){delete this[e]}}function dI(e,t){return function(){this[e]=t}}function pI(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function gI(e,t){return arguments.length>1?this.each((t==null?fI:typeof t=="function"?pI:dI)(e,t)):this.node()[e]}function gC(e){return e.trim().split(/^|\s+/)}function km(e){return e.classList||new mC(e)}function mC(e){this._node=e,this._names=gC(e.getAttribute("class")||"")}mC.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function _C(e,t){for(var n=km(e),r=-1,a=t.length;++r=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function $I(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,a=t.length,l;n()=>e;function rg(e,{sourceEvent:t,subject:n,target:r,identifier:a,active:l,x:u,y:o,dx:c,dy:f,dispatch:p}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:a,enumerable:!0,configurable:!0},active:{value:l,enumerable:!0,configurable:!0},x:{value:u,enumerable:!0,configurable:!0},y:{value:o,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:f,enumerable:!0,configurable:!0},_:{value:p}})}rg.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function JI(e){return!e.ctrlKey&&!e.button}function e7(){return this.parentNode}function t7(e,t){return t??{x:e.x,y:e.y}}function n7(){return navigator.maxTouchPoints||"ontouchstart"in this}function wC(){var e=JI,t=e7,n=t7,r=n7,a={},l=gh("start","drag","end"),u=0,o,c,f,p,d=0;function _(k){k.on("mousedown.drag",v).filter(r).on("touchstart.drag",b).on("touchmove.drag",S,QI).on("touchend.drag touchcancel.drag",x).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function v(k,D){if(!(p||!e.call(this,k,D))){var T=y(this,t.call(this,k,D),k,D,"mouse");T&&(Tn(k.view).on("mousemove.drag",w,Vo).on("mouseup.drag",C,Vo),SC(k.view),pp(k),f=!1,o=k.clientX,c=k.clientY,T("start",k))}}function w(k){if(ia(k),!f){var D=k.clientX-o,T=k.clientY-c;f=D*D+T*T>d}a.mouse("drag",k)}function C(k){Tn(k.view).on("mousemove.drag mouseup.drag",null),xC(k.view,f),ia(k),a.mouse("end",k)}function b(k,D){if(e.call(this,k,D)){var T=k.changedTouches,R=t.call(this,k,D),N=T.length,M,B;for(M=0;M>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Kc(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Kc(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=r7.exec(e))?new mn(t[1],t[2],t[3],1):(t=s7.exec(e))?new mn(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=a7.exec(e))?Kc(t[1],t[2],t[3],t[4]):(t=o7.exec(e))?Kc(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=l7.exec(e))?Mb(t[1],t[2]/100,t[3]/100,1):(t=c7.exec(e))?Mb(t[1],t[2]/100,t[3]/100,t[4]):kb.hasOwnProperty(e)?Nb(kb[e]):e==="transparent"?new mn(NaN,NaN,NaN,0):null}function Nb(e){return new mn(e>>16&255,e>>8&255,e&255,1)}function Kc(e,t,n,r){return r<=0&&(e=t=n=NaN),new mn(e,t,n,r)}function f7(e){return e instanceof cl||(e=Qr(e)),e?(e=e.rgb(),new mn(e.r,e.g,e.b,e.opacity)):new mn}function sg(e,t,n,r){return arguments.length===1?f7(e):new mn(e,t,n,r??1)}function mn(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}Am(mn,sg,CC(cl,{brighter(e){return e=e==null?Tu:Math.pow(Tu,e),new mn(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Yo:Math.pow(Yo,e),new mn(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new mn(Xr(this.r),Xr(this.g),Xr(this.b),Nu(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Db,formatHex:Db,formatHex8:d7,formatRgb:Rb,toString:Rb}));function Db(){return`#${Yr(this.r)}${Yr(this.g)}${Yr(this.b)}`}function d7(){return`#${Yr(this.r)}${Yr(this.g)}${Yr(this.b)}${Yr((isNaN(this.opacity)?1:this.opacity)*255)}`}function Rb(){const e=Nu(this.opacity);return`${e===1?"rgb(":"rgba("}${Xr(this.r)}, ${Xr(this.g)}, ${Xr(this.b)}${e===1?")":`, ${e})`}`}function Nu(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Xr(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Yr(e){return e=Xr(e),(e<16?"0":"")+e.toString(16)}function Mb(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Xn(e,t,n,r)}function EC(e){if(e instanceof Xn)return new Xn(e.h,e.s,e.l,e.opacity);if(e instanceof cl||(e=Qr(e)),!e)return new Xn;if(e instanceof Xn)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,a=Math.min(t,n,r),l=Math.max(t,n,r),u=NaN,o=l-a,c=(l+a)/2;return o?(t===l?u=(n-r)/o+(n0&&c<1?0:u,new Xn(u,o,c,e.opacity)}function p7(e,t,n,r){return arguments.length===1?EC(e):new Xn(e,t,n,r??1)}function Xn(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Am(Xn,p7,CC(cl,{brighter(e){return e=e==null?Tu:Math.pow(Tu,e),new Xn(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Yo:Math.pow(Yo,e),new Xn(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,a=2*n-r;return new mn(gp(e>=240?e-240:e+120,a,r),gp(e,a,r),gp(e<120?e+240:e-120,a,r),this.opacity)},clamp(){return new Xn(Lb(this.h),Zc(this.s),Zc(this.l),Nu(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Nu(this.opacity);return`${e===1?"hsl(":"hsla("}${Lb(this.h)}, ${Zc(this.s)*100}%, ${Zc(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Lb(e){return e=(e||0)%360,e<0?e+360:e}function Zc(e){return Math.max(0,Math.min(1,e||0))}function gp(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const Tm=e=>()=>e;function g7(e,t){return function(n){return e+n*t}}function m7(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function _7(e){return(e=+e)==1?kC:function(t,n){return n-t?m7(t,n,e):Tm(isNaN(t)?n:t)}}function kC(e,t){var n=t-e;return n?g7(e,n):Tm(isNaN(e)?t:e)}const Du=(function e(t){var n=_7(t);function r(a,l){var u=n((a=sg(a)).r,(l=sg(l)).r),o=n(a.g,l.g),c=n(a.b,l.b),f=kC(a.opacity,l.opacity);return function(p){return a.r=u(p),a.g=o(p),a.b=c(p),a.opacity=f(p),a+""}}return r.gamma=e,r})(1);function v7(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),a;return function(l){for(a=0;an&&(l=t.slice(n,l),o[u]?o[u]+=l:o[++u]=l),(r=r[0])===(a=a[0])?o[u]?o[u]+=a:o[++u]=a:(o[++u]=null,c.push({i:u,x:li(r,a)})),n=mp.lastIndex;return n180?p+=360:p-f>180&&(f+=360),_.push({i:d.push(a(d)+"rotate(",null,r)-2,x:li(f,p)})):p&&d.push(a(d)+"rotate("+p+r)}function o(f,p,d,_){f!==p?_.push({i:d.push(a(d)+"skewX(",null,r)-2,x:li(f,p)}):p&&d.push(a(d)+"skewX("+p+r)}function c(f,p,d,_,v,w){if(f!==d||p!==_){var C=v.push(a(v)+"scale(",null,",",null,")");w.push({i:C-4,x:li(f,d)},{i:C-2,x:li(p,_)})}else(d!==1||_!==1)&&v.push(a(v)+"scale("+d+","+_+")")}return function(f,p){var d=[],_=[];return f=e(f),p=e(p),l(f.translateX,f.translateY,p.translateX,p.translateY,d,_),u(f.rotate,p.rotate,d,_),o(f.skewX,p.skewX,d,_),c(f.scaleX,f.scaleY,p.scaleX,p.scaleY,d,_),f=p=null,function(v){for(var w=-1,C=_.length,b;++w=0&&e._call.call(void 0,t),e=e._next;--la}function Bb(){Jr=(Mu=Xo.now())+_h,la=ko=0;try{L7()}finally{la=0,j7(),Jr=0}}function O7(){var e=Xo.now(),t=e-Mu;t>DC&&(_h-=t,Mu=e)}function j7(){for(var e,t=Ru,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:Ru=n);Ao=e,lg(r)}function lg(e){if(!la){ko&&(ko=clearTimeout(ko));var t=e-Jr;t>24?(e<1/0&&(ko=setTimeout(Bb,e-Xo.now()-_h)),Co&&(Co=clearInterval(Co))):(Co||(Mu=Xo.now(),Co=setInterval(O7,DC)),la=1,RC(Bb))}}function Ib(e,t,n){var r=new Lu;return t=t==null?0:+t,r.restart(a=>{r.stop(),e(a+t)},t,n),r}var B7=gh("start","end","cancel","interrupt"),I7=[],LC=0,zb=1,cg=2,pu=3,Hb=4,ug=5,gu=6;function vh(e,t,n,r,a,l){var u=e.__transition;if(!u)e.__transition={};else if(n in u)return;z7(e,n,{name:t,index:r,group:a,on:B7,tween:I7,time:l.time,delay:l.delay,duration:l.duration,ease:l.ease,timer:null,state:LC})}function Dm(e,t){var n=ei(e,t);if(n.state>LC)throw new Error("too late; already scheduled");return n}function di(e,t){var n=ei(e,t);if(n.state>pu)throw new Error("too late; already running");return n}function ei(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function z7(e,t,n){var r=e.__transition,a;r[t]=n,n.timer=MC(l,0,n.time);function l(f){n.state=zb,n.timer.restart(u,n.delay,n.time),n.delay<=f&&u(f-n.delay)}function u(f){var p,d,_,v;if(n.state!==zb)return c();for(p in r)if(v=r[p],v.name===n.name){if(v.state===pu)return Ib(u);v.state===Hb?(v.state=gu,v.timer.stop(),v.on.call("interrupt",e,e.__data__,v.index,v.group),delete r[p]):+pcg&&r.state=0&&(t=t.slice(0,n)),!t||t==="start"})}function p9(e,t,n){var r,a,l=d9(t)?Dm:di;return function(){var u=l(this,e),o=u.on;o!==r&&(a=(r=o).copy()).on(t,n),u.on=a}}function g9(e,t){var n=this._id;return arguments.length<2?ei(this.node(),n).on.on(e):this.each(p9(n,e,t))}function m9(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function _9(){return this.on("end.remove",m9(this._id))}function v9(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Em(e));for(var r=this._groups,a=r.length,l=new Array(a),u=0;u()=>e;function $9(e,{sourceEvent:t,target:n,transform:r,dispatch:a}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:a}})}function ji(e,t,n){this.k=e,this.x=t,this.y=n}ji.prototype={constructor:ji,scale:function(e){return e===1?this:new ji(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new ji(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var yh=new ji(1,0,0);IC.prototype=ji.prototype;function IC(e){for(;!e.__zoom;)if(!(e=e.parentNode))return yh;return e.__zoom}function _p(e){e.stopImmediatePropagation()}function Eo(e){e.preventDefault(),e.stopImmediatePropagation()}function G9(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function q9(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function Fb(){return this.__zoom||yh}function V9(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Y9(){return navigator.maxTouchPoints||"ontouchstart"in this}function W9(e,t,n){var r=e.invertX(t[0][0])-n[0][0],a=e.invertX(t[1][0])-n[1][0],l=e.invertY(t[0][1])-n[0][1],u=e.invertY(t[1][1])-n[1][1];return e.translate(a>r?(r+a)/2:Math.min(0,r)||Math.max(0,a),u>l?(l+u)/2:Math.min(0,l)||Math.max(0,u))}function zC(){var e=G9,t=q9,n=W9,r=V9,a=Y9,l=[0,1/0],u=[[-1/0,-1/0],[1/0,1/0]],o=250,c=du,f=gh("start","zoom","end"),p,d,_,v=500,w=150,C=0,b=10;function S(z){z.property("__zoom",Fb).on("wheel.zoom",N,{passive:!1}).on("mousedown.zoom",M).on("dblclick.zoom",B).filter(a).on("touchstart.zoom",H).on("touchmove.zoom",Y).on("touchend.zoom touchcancel.zoom",F).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}S.transform=function(z,q,G,X){var K=z.selection?z.selection():z;K.property("__zoom",Fb),z!==K?D(z,q,G,X):K.interrupt().each(function(){T(this,arguments).event(X).start().zoom(null,typeof q=="function"?q.apply(this,arguments):q).end()})},S.scaleBy=function(z,q,G,X){S.scaleTo(z,function(){var K=this.__zoom.k,O=typeof q=="function"?q.apply(this,arguments):q;return K*O},G,X)},S.scaleTo=function(z,q,G,X){S.transform(z,function(){var K=t.apply(this,arguments),O=this.__zoom,L=G==null?k(K):typeof G=="function"?G.apply(this,arguments):G,j=O.invert(L),$=typeof q=="function"?q.apply(this,arguments):q;return n(y(x(O,$),L,j),K,u)},G,X)},S.translateBy=function(z,q,G,X){S.transform(z,function(){return n(this.__zoom.translate(typeof q=="function"?q.apply(this,arguments):q,typeof G=="function"?G.apply(this,arguments):G),t.apply(this,arguments),u)},null,X)},S.translateTo=function(z,q,G,X,K){S.transform(z,function(){var O=t.apply(this,arguments),L=this.__zoom,j=X==null?k(O):typeof X=="function"?X.apply(this,arguments):X;return n(yh.translate(j[0],j[1]).scale(L.k).translate(typeof q=="function"?-q.apply(this,arguments):-q,typeof G=="function"?-G.apply(this,arguments):-G),O,u)},X,K)};function x(z,q){return q=Math.max(l[0],Math.min(l[1],q)),q===z.k?z:new ji(q,z.x,z.y)}function y(z,q,G){var X=q[0]-G[0]*z.k,K=q[1]-G[1]*z.k;return X===z.x&&K===z.y?z:new ji(z.k,X,K)}function k(z){return[(+z[0][0]+ +z[1][0])/2,(+z[0][1]+ +z[1][1])/2]}function D(z,q,G,X){z.on("start.zoom",function(){T(this,arguments).event(X).start()}).on("interrupt.zoom end.zoom",function(){T(this,arguments).event(X).end()}).tween("zoom",function(){var K=this,O=arguments,L=T(K,O).event(X),j=t.apply(K,O),$=G==null?k(j):typeof G=="function"?G.apply(K,O):G,U=Math.max(j[1][0]-j[0][0],j[1][1]-j[0][1]),Q=K.__zoom,re=typeof q=="function"?q.apply(K,O):q,ae=c(Q.invert($).concat(U/Q.k),re.invert($).concat(U/re.k));return function(Z){if(Z===1)Z=re;else{var P=ae(Z),ee=U/P[2];Z=new ji(ee,$[0]-P[0]*ee,$[1]-P[1]*ee)}L.zoom(null,Z)}})}function T(z,q,G){return!G&&z.__zooming||new R(z,q)}function R(z,q){this.that=z,this.args=q,this.active=0,this.sourceEvent=null,this.extent=t.apply(z,q),this.taps=0}R.prototype={event:function(z){return z&&(this.sourceEvent=z),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(z,q){return this.mouse&&z!=="mouse"&&(this.mouse[1]=q.invert(this.mouse[0])),this.touch0&&z!=="touch"&&(this.touch0[1]=q.invert(this.touch0[0])),this.touch1&&z!=="touch"&&(this.touch1[1]=q.invert(this.touch1[0])),this.that.__zoom=q,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(z){var q=Tn(this.that).datum();f.call(z,this.that,new $9(z,{sourceEvent:this.sourceEvent,target:S,transform:this.that.__zoom,dispatch:f}),q)}};function N(z,...q){if(!e.apply(this,arguments))return;var G=T(this,q).event(z),X=this.__zoom,K=Math.max(l[0],Math.min(l[1],X.k*Math.pow(2,r.apply(this,arguments)))),O=Wn(z);if(G.wheel)(G.mouse[0][0]!==O[0]||G.mouse[0][1]!==O[1])&&(G.mouse[1]=X.invert(G.mouse[0]=O)),clearTimeout(G.wheel);else{if(X.k===K)return;G.mouse=[O,X.invert(O)],mu(this),G.start()}Eo(z),G.wheel=setTimeout(L,w),G.zoom("mouse",n(y(x(X,K),G.mouse[0],G.mouse[1]),G.extent,u));function L(){G.wheel=null,G.end()}}function M(z,...q){if(_||!e.apply(this,arguments))return;var G=z.currentTarget,X=T(this,q,!0).event(z),K=Tn(z.view).on("mousemove.zoom",$,!0).on("mouseup.zoom",U,!0),O=Wn(z,G),L=z.clientX,j=z.clientY;SC(z.view),_p(z),X.mouse=[O,this.__zoom.invert(O)],mu(this),X.start();function $(Q){if(Eo(Q),!X.moved){var re=Q.clientX-L,ae=Q.clientY-j;X.moved=re*re+ae*ae>C}X.event(Q).zoom("mouse",n(y(X.that.__zoom,X.mouse[0]=Wn(Q,G),X.mouse[1]),X.extent,u))}function U(Q){K.on("mousemove.zoom mouseup.zoom",null),xC(Q.view,X.moved),Eo(Q),X.event(Q).end()}}function B(z,...q){if(e.apply(this,arguments)){var G=this.__zoom,X=Wn(z.changedTouches?z.changedTouches[0]:z,this),K=G.invert(X),O=G.k*(z.shiftKey?.5:2),L=n(y(x(G,O),X,K),t.apply(this,q),u);Eo(z),o>0?Tn(this).transition().duration(o).call(D,L,X,z):Tn(this).call(S.transform,L,X,z)}}function H(z,...q){if(e.apply(this,arguments)){var G=z.touches,X=G.length,K=T(this,q,z.changedTouches.length===X).event(z),O,L,j,$;for(_p(z),L=0;L`Seems like you have not used ${e==="svelte"?"SvelteFlowProvider":"ReactFlowProvider"} as an ancestor. Help: https://${e}flow.dev/error#001`,error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:r}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.",error016:e=>`Edge with id "${e}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`},Ko=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],HC=["Enter"," ","Escape"],FC={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var ca;(function(e){e.Strict="strict",e.Loose="loose"})(ca||(ca={}));var Kr;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Kr||(Kr={}));var Zo;(function(e){e.Partial="partial",e.Full="full"})(Zo||(Zo={}));const PC={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var yr;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(yr||(yr={}));var Ou;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Ou||(Ou={}));var Re;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Re||(Re={}));const Pb={[Re.Left]:Re.Right,[Re.Right]:Re.Left,[Re.Top]:Re.Bottom,[Re.Bottom]:Re.Top};function UC(e){return e===null?null:e?"valid":"invalid"}const $C=e=>!!e&&typeof e=="object"&&"id"in e&&"source"in e&&"target"in e,X9=e=>!!e&&typeof e=="object"&&"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),Mm=e=>!!e&&typeof e=="object"&&"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),ul=(e,t=[0,0])=>{const{width:n,height:r}=pi(e),a=e.origin??t,l=n*a[0],u=r*a[1];return{x:e.position.x-l,y:e.position.y-u}},K9=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,a)=>{const l=typeof a=="string";let u=!t.nodeLookup&&!l?a:void 0;t.nodeLookup&&(u=l?t.nodeLookup.get(a):Mm(a)?a:t.nodeLookup.get(a.id));const o=u?ju(u,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return bh(r,o)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Sh(n)},hl=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(a=>{(t.filter===void 0||t.filter(a))&&(n=bh(n,ju(a)),r=!0)}),r?Sh(n):{x:0,y:0,width:0,height:0}},Lm=(e,t,[n,r,a]=[0,0,1],l=!1,u=!1)=>{const o=(t.x-n)/a,c=(t.y-r)/a,f=t.width/a,p=t.height/a,d=[];for(const _ of e.values()){const{measured:v,selectable:w=!0,hidden:C=!1}=_;if(u&&!w||C)continue;const b=v.width??_.width??_.initialWidth??0,S=v.height??_.height??_.initialHeight??0,{x,y}=_.internals.positionAbsolute,k=YC(o,c,f,p,x,y,b,S),D=b*S,T=l&&k>0;(!_.internals.handleBounds||T||k>=D||_.dragging)&&d.push(_)}return d},Z9=(e,t)=>{const n=new Set;return e.forEach(r=>{n.add(r.id)}),t.filter(r=>n.has(r.source)||n.has(r.target))};function Q9(e,t){const n=new Map,r=t!=null&&t.nodes?new Set(t.nodes.map(a=>a.id)):null;return e.forEach(a=>{let l;if(t!=null&&t.includeHiddenNodes){const{width:u,height:o}=pi(a);l=u>0&&o>0}else l=!!(a.measured.width&&a.measured.height&&!a.hidden);l&&(!r||r.has(a.id))&&n.set(a.id,a)}),n}async function J9({nodes:e,width:t,height:n,panZoom:r,minZoom:a,maxZoom:l},u){if(e.size===0)return!0;const o=Q9(e,u),c=hl(o),f=jm(c,t,n,(u==null?void 0:u.minZoom)??a,(u==null?void 0:u.maxZoom)??l,(u==null?void 0:u.padding)??.1);return await r.setViewport(f,{duration:u==null?void 0:u.duration,ease:u==null?void 0:u.ease,interpolate:u==null?void 0:u.interpolate}),!0}function GC({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:a,onError:l}){const u=n.get(e),o=u.parentId?n.get(u.parentId):void 0,{x:c,y:f}=o?o.internals.positionAbsolute:{x:0,y:0},p=u.origin??r;let d=u.extent||a;if(u.extent==="parent"&&!u.expandParent)if(!o)l==null||l("005",Jn.error005());else{const v=o.measured.width,w=o.measured.height;v&&w&&(d=[[c,f],[c+v,f+w]])}else o&&ts(u.extent)&&(d=[[u.extent[0][0]+c,u.extent[0][1]+f],[u.extent[1][0]+c,u.extent[1][1]+f]]);const _=ts(d)?es(t,d,u.measured):t;return(u.measured.width===void 0||u.measured.height===void 0)&&(l==null||l("015",Jn.error015())),{position:{x:_.x-c+(u.measured.width??0)*p[0],y:_.y-f+(u.measured.height??0)*p[1]},positionAbsolute:_}}async function ez({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:a}){const l=new Set(e.map(_=>_.id)),u=[];for(const _ of n){if(_.deletable===!1)continue;const v=l.has(_.id),w=!v&&_.parentId&&u.find(C=>C.id===_.parentId);(v||w)&&u.push(_)}const o=new Set(t.map(_=>_.id)),c=r.filter(_=>_.deletable!==!1),p=Z9(u,c);for(const _ of c)o.has(_.id)&&!p.find(w=>w.id===_.id)&&p.push(_);if(!a)return{edges:p,nodes:u};const d=await a({nodes:u,edges:p});return typeof d=="boolean"?d?{edges:p,nodes:u}:{edges:[],nodes:[]}:d}const ua=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),es=(e={x:0,y:0},t,n)=>({x:ua(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:ua(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function qC(e,t,n){const{width:r,height:a}=pi(n),{x:l,y:u}=n.internals.positionAbsolute;return es(e,[[l,u],[l+r,u+a]],t)}const Ub=(e,t,n)=>en?-ua(Math.abs(e-n),1,t)/t:0,Om=(e,t,n=15,r=40)=>{const a=Ub(e.x,r,t.width-r)*n,l=Ub(e.y,r,t.height-r)*n;return[a,l]},bh=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),hg=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),Sh=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),Qo=(e,t=[0,0])=>{var a,l;const{x:n,y:r}=Mm(e)?e.internals.positionAbsolute:ul(e,t);return{x:n,y:r,width:((a=e.measured)==null?void 0:a.width)??e.width??e.initialWidth??0,height:((l=e.measured)==null?void 0:l.height)??e.height??e.initialHeight??0}},ju=(e,t=[0,0])=>{var a,l;const{x:n,y:r}=Mm(e)?e.internals.positionAbsolute:ul(e,t);return{x:n,y:r,x2:n+(((a=e.measured)==null?void 0:a.width)??e.width??e.initialWidth??0),y2:r+(((l=e.measured)==null?void 0:l.height)??e.height??e.initialHeight??0)}},VC=(e,t)=>Sh(bh(hg(e),hg(t))),YC=(e,t,n,r,a,l,u,o)=>{const c=Math.max(0,Math.min(e+n,a+u)-Math.max(e,a)),f=Math.max(0,Math.min(t+r,l+o)-Math.max(t,l));return Math.ceil(c*f)},Bu=(e,t)=>YC(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),$b=e=>Kn(e.width)&&Kn(e.height)&&Kn(e.x)&&Kn(e.y),Kn=e=>!isNaN(e)&&isFinite(e),WC=(e,t)=>(n,r)=>{},fl=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),dl=({x:e,y:t},[n,r,a],l=!1,u=[1,1])=>{const o={x:(e-n)/a,y:(t-r)/a};return l?fl(o,u):o},ha=({x:e,y:t},[n,r,a])=>({x:e*a+n,y:t*a+r});function Ws(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function tz(e,t,n){if(typeof e=="string"||typeof e=="number"){const r=Ws(e,n),a=Ws(e,t);return{top:r,right:a,bottom:r,left:a,x:a*2,y:r*2}}if(typeof e=="object"){const r=Ws(e.top??e.y??0,n),a=Ws(e.bottom??e.y??0,n),l=Ws(e.left??e.x??0,t),u=Ws(e.right??e.x??0,t);return{top:r,right:u,bottom:a,left:l,x:l+u,y:r+a}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function nz(e,t,n,r,a,l){const{x:u,y:o}=ha(e,[t,n,r]),{x:c,y:f}=ha({x:e.x+e.width,y:e.y+e.height},[t,n,r]),p=a-c,d=l-f;return{left:Math.floor(u),top:Math.floor(o),right:Math.floor(p),bottom:Math.floor(d)}}const jm=(e,t,n,r,a,l)=>{const u=tz(l,t,n),o=(t-u.x)/e.width,c=(n-u.y)/e.height,f=Math.min(o,c),p=ua(f,r,a),d=e.x+e.width/2,_=e.y+e.height/2,v=t/2-d*p,w=n/2-_*p,C=nz(e,v,w,p,t,n),b={left:Math.min(C.left-u.left,0),top:Math.min(C.top-u.top,0),right:Math.min(C.right-u.right,0),bottom:Math.min(C.bottom-u.bottom,0)};return{x:v-b.left+b.right,y:w-b.top+b.bottom,zoom:p}},Jo=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function ts(e){return e!=null&&e!=="parent"}function pi(e){var t,n;return{width:((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth??0,height:((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight??0}}function XC(e){var t,n;return(((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth)!==void 0&&(((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight)!==void 0}function KC(e,t={width:0,height:0},n,r,a){const l={...e},u=r.get(n);if(u){const o=u.origin||a;l.x+=u.internals.positionAbsolute.x-(t.width??0)*o[0],l.y+=u.internals.positionAbsolute.y-(t.height??0)*o[1]}return l}function Gb(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function iz(){let e,t;return{promise:new Promise((r,a)=>{e=r,t=a}),resolve:e,reject:t}}function rz(e){return{...FC,...e||{}}}function Oo(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:a}){const{x:l,y:u}=Zn(e),o=dl({x:l-((a==null?void 0:a.left)??0),y:u-((a==null?void 0:a.top)??0)},r),{x:c,y:f}=n?fl(o,t):o;return{xSnapped:c,ySnapped:f,...o}}const Bm=e=>({width:e.offsetWidth,height:e.offsetHeight}),ZC=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},sz=["INPUT","SELECT","TEXTAREA"];function QC(e){var r,a;const t=((a=(r=e.composedPath)==null?void 0:r.call(e))==null?void 0:a[0])||e.target;return(t==null?void 0:t.nodeType)!==1?!1:sz.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const JC=e=>"clientX"in e,Zn=(e,t)=>{var l,u;const n=JC(e),r=n?e.clientX:(l=e.touches)==null?void 0:l[0].clientX,a=n?e.clientY:(u=e.touches)==null?void 0:u[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:a-((t==null?void 0:t.top)??0)}},qb=(e,t,n,r,a)=>{const l=t.querySelectorAll(`.${e}`);return!l||!l.length?null:Array.from(l).map(u=>{const o=u.getBoundingClientRect();return{id:u.getAttribute("data-handleid"),type:e,nodeId:a,position:u.getAttribute("data-handlepos"),x:(o.left-n.left)/r,y:(o.top-n.top)/r,...Bm(u)}})};function e2({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:a,sourceControlY:l,targetControlX:u,targetControlY:o}){const c=e*.125+a*.375+u*.375+n*.125,f=t*.125+l*.375+o*.375+r*.125,p=Math.abs(c-e),d=Math.abs(f-t);return[c,f,p,d]}function eu(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Vb({pos:e,x1:t,y1:n,x2:r,y2:a,c:l}){switch(e){case Re.Left:return[t-eu(t-r,l),n];case Re.Right:return[t+eu(r-t,l),n];case Re.Top:return[t,n-eu(n-a,l)];case Re.Bottom:return[t,n+eu(a-n,l)]}}function t2({sourceX:e,sourceY:t,sourcePosition:n=Re.Bottom,targetX:r,targetY:a,targetPosition:l=Re.Top,curvature:u=.25}){const[o,c]=Vb({pos:n,x1:e,y1:t,x2:r,y2:a,c:u}),[f,p]=Vb({pos:l,x1:r,y1:a,x2:e,y2:t,c:u}),[d,_,v,w]=e2({sourceX:e,sourceY:t,targetX:r,targetY:a,sourceControlX:o,sourceControlY:c,targetControlX:f,targetControlY:p});return[`M${e},${t} C${o},${c} ${f},${p} ${r},${a}`,d,_,v,w]}function n2({sourceX:e,sourceY:t,targetX:n,targetY:r}){const a=Math.abs(n-e)/2,l=n0}const lz=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,cz=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),uz=(e,t,n={})=>{var l;if(!e.source||!e.target)return(l=n.onError)==null||l.call(n,"006",Jn.error006()),t;const r=n.getEdgeId||lz;let a;return $C(e)?a={...e}:a={...e,id:r(e)},cz(a,t)?t:(a.sourceHandle===null&&delete a.sourceHandle,a.targetHandle===null&&delete a.targetHandle,t.concat(a))};function i2({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[a,l,u,o]=n2({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,a,l,u,o]}const Yb={[Re.Left]:{x:-1,y:0},[Re.Right]:{x:1,y:0},[Re.Top]:{x:0,y:-1},[Re.Bottom]:{x:0,y:1}},hz=({source:e,sourcePosition:t=Re.Bottom,target:n})=>t===Re.Left||t===Re.Right?e.xMath.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function fz({source:e,sourcePosition:t=Re.Bottom,target:n,targetPosition:r=Re.Top,center:a,offset:l,stepPosition:u}){const o=Yb[t],c=Yb[r],f={x:e.x+o.x*l,y:e.y+o.y*l},p={x:n.x+c.x*l,y:n.y+c.y*l},d=hz({source:f,sourcePosition:t,target:p}),_=d.x!==0?"x":"y",v=d[_];let w=[],C,b;const S={x:0,y:0},x={x:0,y:0},[,,y,k]=n2({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(o[_]*c[_]===-1){_==="x"?(C=a.x??f.x+(p.x-f.x)*u,b=a.y??(f.y+p.y)/2):(C=a.x??(f.x+p.x)/2,b=a.y??f.y+(p.y-f.y)*u);const N=[{x:C,y:f.y},{x:C,y:p.y}],M=[{x:f.x,y:b},{x:p.x,y:b}];o[_]===v?w=_==="x"?N:M:w=_==="x"?M:N}else{const N=[{x:f.x,y:p.y}],M=[{x:p.x,y:f.y}];if(_==="x"?w=o.x===v?M:N:w=o.y===v?N:M,t===r){const z=Math.abs(e[_]-n[_]);if(z<=l){const q=Math.min(l-1,l-z);o[_]===v?S[_]=(f[_]>e[_]?-1:1)*q:x[_]=(p[_]>n[_]?-1:1)*q}}if(t!==r){const z=_==="x"?"y":"x",q=o[_]===c[z],G=f[z]>p[z],X=f[z]=F?(C=(B.x+H.x)/2,b=w[0].y):(C=w[0].x,b=(B.y+H.y)/2)}const D={x:f.x+S.x,y:f.y+S.y},T={x:p.x+x.x,y:p.y+x.y};return[[e,...D.x!==w[0].x||D.y!==w[0].y?[D]:[],...w,...T.x!==w[w.length-1].x||T.y!==w[w.length-1].y?[T]:[],n],C,b,y,k]}function dz(e,t,n,r){const a=Math.min(Wb(e,t)/2,Wb(t,n)/2,r),{x:l,y:u}=t;if(e.x===l&&l===n.x||e.y===u&&u===n.y)return`L${l} ${u}`;if(e.y===u){const f=e.xn.id===t):e[0])||null}function dg(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function gz(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:a}){const l=new Set;return e.reduce((u,o)=>([o.markerStart||r,o.markerEnd||a].forEach(c=>{if(c&&typeof c=="object"){const f=dg(c,t);l.has(f)||(u.push({id:f,color:c.color||n,...c}),l.add(f))}}),u),[]).sort((u,o)=>u.id.localeCompare(o.id))}const r2=1e3,mz=10,Im={nodeOrigin:[0,0],nodeExtent:Ko,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},_z={...Im,checkEquality:!0};function zm(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function vz(e,t,n){const r=zm(Im,n);for(const a of e.values())if(a.parentId)Fm(a,e,t,r);else{const l=ul(a,r.nodeOrigin),u=ts(a.extent)?a.extent:r.nodeExtent,o=es(l,u,pi(a));a.internals.positionAbsolute=o}}function yz(e,t){if(!e.handles)return e.measured?t==null?void 0:t.internals.handleBounds:void 0;const n=[],r=[];for(const a of e.handles){const l={id:a.id,width:a.width??1,height:a.height??1,nodeId:e.id,x:a.x,y:a.y,position:a.position,type:a.type};a.type==="source"?n.push(l):a.type==="target"&&r.push(l)}return{source:n,target:r}}function Hm(e){return e==="manual"}function pg(e,t,n,r={}){var p,d;const a=zm(_z,r),l={i:0},u=new Map(t),o=a!=null&&a.elevateNodesOnSelect&&!Hm(a.zIndexMode)?r2:0;let c=e.length>0,f=!1;t.clear(),n.clear();for(const _ of e){let v=u.get(_.id);if(a.checkEquality&&_===(v==null?void 0:v.internals.userNode))t.set(_.id,v);else{const w=ul(_,a.nodeOrigin),C=ts(_.extent)?_.extent:a.nodeExtent,b=es(w,C,pi(_));v={...a.defaults,..._,measured:{width:(p=_.measured)==null?void 0:p.width,height:(d=_.measured)==null?void 0:d.height},internals:{positionAbsolute:b,handleBounds:yz(_,v),z:s2(_,o,a.zIndexMode),userNode:_}},t.set(_.id,v)}(v.measured===void 0||v.measured.width===void 0||v.measured.height===void 0)&&!v.hidden&&(c=!1),_.parentId&&Fm(v,t,n,r,l),f||(f=_.selected??!1)}return{nodesInitialized:c,hasSelectedNodes:f}}function bz(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function Fm(e,t,n,r,a){const{elevateNodesOnSelect:l,nodeOrigin:u,nodeExtent:o,zIndexMode:c}=zm(Im,r),f=e.parentId,p=t.get(f);if(!p){console.warn(`Parent node ${f} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}bz(e,n),a&&!p.parentId&&p.internals.rootParentIndex===void 0&&c==="auto"&&(p.internals.rootParentIndex=++a.i,p.internals.z=p.internals.z+a.i*mz),a&&p.internals.rootParentIndex!==void 0&&(a.i=p.internals.rootParentIndex);const d=l&&!Hm(c)?r2:0,{x:_,y:v,z:w}=Sz(e,p,u,o,d,c),{positionAbsolute:C}=e.internals,b=_!==C.x||v!==C.y;(b||w!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:b?{x:_,y:v}:C,z:w}})}function s2(e,t,n){const r=Kn(e.zIndex)?e.zIndex:0;return Hm(n)?r:r+(e.selected?t:0)}function Sz(e,t,n,r,a,l){const{x:u,y:o}=t.internals.positionAbsolute,c=pi(e),f=ul(e,n),p=ts(e.extent)?es(f,e.extent,c):f;let d=es({x:u+p.x,y:o+p.y},r,c);e.extent==="parent"&&(d=qC(d,c,t));const _=s2(e,a,l),v=t.internals.z??0;return{x:d.x,y:d.y,z:v>=_?v+1:_}}function Pm(e,t,n,r=[0,0]){var u;const a=[],l=new Map;for(const o of e){const c=t.get(o.parentId);if(!c)continue;const f=((u=l.get(o.parentId))==null?void 0:u.expandedRect)??Qo(c),p=VC(f,o.rect);l.set(o.parentId,{expandedRect:p,parent:c})}return l.size>0&&l.forEach(({expandedRect:o,parent:c},f)=>{var y;const p=c.internals.positionAbsolute,d=pi(c),_=c.origin??r,v=o.x0||w>0||S||x)&&(a.push({id:f,type:"position",position:{x:c.position.x-v+S,y:c.position.y-w+x}}),(y=n.get(f))==null||y.forEach(k=>{e.some(D=>D.id===k.id)||a.push({id:k.id,type:"position",position:{x:k.position.x+v,y:k.position.y+w}})})),(d.width0){const v=Pm(_,t,n,a);f.push(...v)}return{changes:f,updatedInternals:c}}async function wz({delta:e,panZoom:t,transform:n,translateExtent:r,width:a,height:l}){if(!t||!e.x&&!e.y)return!1;const u=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[a,l]],r);return!!u&&(u.x!==n[0]||u.y!==n[1]||u.k!==n[2])}function Qb(e,t,n,r,a,l){let u=a;const o=r.get(u)||new Map;r.set(u,o.set(n,t)),u=`${a}-${e}`;const c=r.get(u)||new Map;if(r.set(u,c.set(n,t)),l){u=`${a}-${e}-${l}`;const f=r.get(u)||new Map;r.set(u,f.set(n,t))}}function a2(e,t,n){e.clear(),t.clear();for(const r of n){const{source:a,target:l,sourceHandle:u=null,targetHandle:o=null}=r,c={edgeId:r.id,source:a,target:l,sourceHandle:u,targetHandle:o},f=`${a}-${u}--${l}-${o}`,p=`${l}-${o}--${a}-${u}`;Qb("source",c,p,e,a,u),Qb("target",c,f,e,l,o),t.set(r.id,r)}}function o2(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:o2(n,t):!1}function Jb(e,t,n){var a;let r=e;do{if((a=r==null?void 0:r.matches)!=null&&a.call(r,t))return!0;if(r===n)return!1;r=r==null?void 0:r.parentElement}while(r);return!1}function Cz(e,t,n,r){const a=new Map;for(const[l,u]of e)if((u.selected||u.id===r)&&(!u.parentId||!o2(u,e))&&(u.draggable||t&&typeof u.draggable>"u")){const o=e.get(l);o&&a.set(l,{id:l,position:o.position||{x:0,y:0},distance:{x:n.x-o.internals.positionAbsolute.x,y:n.y-o.internals.positionAbsolute.y},extent:o.extent,parentId:o.parentId,origin:o.origin,expandParent:o.expandParent,internals:{positionAbsolute:o.internals.positionAbsolute||{x:0,y:0}},measured:{width:o.measured.width??0,height:o.measured.height??0}})}return a}function vp({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){var u,o,c;const a=[];for(const[f,p]of t){const d=(u=n.get(f))==null?void 0:u.internals.userNode;d&&a.push({...d,position:p.position,dragging:r})}if(!e)return[a[0],a];const l=(o=n.get(e))==null?void 0:o.internals.userNode;return[l?{...l,position:((c=t.get(e))==null?void 0:c.position)||l.position,dragging:r}:a[0],a]}function Ez({dragItems:e,snapGrid:t,x:n,y:r}){const a=e.values().next().value;if(!a)return null;const l={x:n-a.distance.x,y:r-a.distance.y},u=fl(l,t);return{x:u.x-l.x,y:u.y-l.y}}function kz({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:a}){let l={x:null,y:null},u=0,o=new Map,c=!1,f={x:0,y:0},p=null,d=!1,_=null,v=!1,w=!1,C=null;function b({noDragClassName:x,handleSelector:y,domNode:k,isSelectable:D,nodeId:T,nodeClickDistance:R=0}){_=Tn(k);function N({x:Y,y:F}){const{nodeLookup:z,nodeExtent:q,snapGrid:G,snapToGrid:X,nodeOrigin:K,onNodeDrag:O,onSelectionDrag:L,onError:j,updateNodePositions:$}=t();l={x:Y,y:F};let U=!1;const Q=o.size>1,re=Q&&q?hg(hl(o)):null,ae=Q&&X?Ez({dragItems:o,snapGrid:G,x:Y,y:F}):null;for(const[Z,P]of o){if(!z.has(Z))continue;let ee={x:Y-P.distance.x,y:F-P.distance.y};X&&(ee=ae?{x:Math.round(ee.x+ae.x),y:Math.round(ee.y+ae.y)}:fl(ee,G));let ie=null;if(Q&&q&&!P.extent&&re){const{positionAbsolute:ye}=P.internals,Se=ye.x-re.x+q[0][0],Ae=ye.x+P.measured.width-re.x2+q[1][0],Ce=ye.y-re.y+q[0][1],we=ye.y+P.measured.height-re.y2+q[1][1];ie=[[Se,Ce],[Ae,we]]}const{position:ge,positionAbsolute:he}=GC({nodeId:Z,nextPosition:ee,nodeLookup:z,nodeExtent:ie||q,nodeOrigin:K,onError:j});U=U||P.position.x!==ge.x||P.position.y!==ge.y,P.position=ge,P.internals.positionAbsolute=he}if(w=w||U,!!U&&($(o,!0),C&&(r||O||!T&&L))){const[Z,P]=vp({nodeId:T,dragItems:o,nodeLookup:z});r==null||r(C,o,Z,P),O==null||O(C,Z,P),T||L==null||L(C,P)}}async function M(){if(!p)return;const{transform:Y,panBy:F,autoPanSpeed:z,autoPanOnNodeDrag:q}=t();if(!q){c=!1,cancelAnimationFrame(u);return}const[G,X]=Om(f,p,z);(G!==0||X!==0)&&(l.x=(l.x??0)-G/Y[2],l.y=(l.y??0)-X/Y[2],await F({x:G,y:X})&&N(l)),u=requestAnimationFrame(M)}function B(Y){var Q;const{nodeLookup:F,multiSelectionActive:z,nodesDraggable:q,transform:G,snapGrid:X,snapToGrid:K,selectNodesOnDrag:O,onNodeDragStart:L,onSelectionDragStart:j,unselectNodesAndEdges:$}=t();d=!0,(!O||!D)&&!z&&T&&((Q=F.get(T))!=null&&Q.selected||$()),D&&O&&T&&(e==null||e(T));const U=Oo(Y.sourceEvent,{transform:G,snapGrid:X,snapToGrid:K,containerBounds:p});if(l=U,o=Cz(F,q,U,T),o.size>0&&(n||L||!T&&j)){const[re,ae]=vp({nodeId:T,dragItems:o,nodeLookup:F});n==null||n(Y.sourceEvent,o,re,ae),L==null||L(Y.sourceEvent,re,ae),T||j==null||j(Y.sourceEvent,ae)}}const H=wC().clickDistance(R).on("start",Y=>{const{domNode:F,nodeDragThreshold:z,transform:q,snapGrid:G,snapToGrid:X}=t();p=(F==null?void 0:F.getBoundingClientRect())||null,v=!1,w=!1,C=Y.sourceEvent,z===0&&B(Y),l=Oo(Y.sourceEvent,{transform:q,snapGrid:G,snapToGrid:X,containerBounds:p}),f=Zn(Y.sourceEvent,p)}).on("drag",Y=>{const{autoPanOnNodeDrag:F,transform:z,snapGrid:q,snapToGrid:G,nodeDragThreshold:X,nodeLookup:K}=t(),O=Oo(Y.sourceEvent,{transform:z,snapGrid:q,snapToGrid:G,containerBounds:p});if(C=Y.sourceEvent,(Y.sourceEvent.type==="touchmove"&&Y.sourceEvent.touches.length>1||T&&!K.has(T))&&(v=!0),!v){if(!c&&F&&d&&(c=!0,M()),!d){const L=Zn(Y.sourceEvent,p),j=L.x-f.x,$=L.y-f.y;Math.sqrt(j*j+$*$)>X&&B(Y)}(l.x!==O.xSnapped||l.y!==O.ySnapped)&&o&&d&&(f=Zn(Y.sourceEvent,p),N(O))}}).on("end",Y=>{if(!d||v){v&&o.size>0&&t().updateNodePositions(o,!1);return}if(c=!1,d=!1,cancelAnimationFrame(u),o.size>0){const{nodeLookup:F,updateNodePositions:z,onNodeDragStop:q,onSelectionDragStop:G}=t();if(w&&(z(o,!1),w=!1),a||q||!T&&G){const[X,K]=vp({nodeId:T,dragItems:o,nodeLookup:F,dragging:!1});a==null||a(Y.sourceEvent,o,X,K),q==null||q(Y.sourceEvent,X,K),T||G==null||G(Y.sourceEvent,K)}}}).filter(Y=>{const F=Y.target;return!Y.button&&(!x||!Jb(F,`.${x}`,k))&&(!y||Jb(F,y,k))});_.call(H)}function S(){_==null||_.on(".drag",null)}return{update:b,destroy:S}}function Az(e,t,n){const r=[],a={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const l of t.values())Bu(a,Qo(l))>0&&r.push(l);return r}const Tz=250;function Nz(e,t,n,r){var o,c;let a=[],l=1/0;const u=Az(e,n,t+Tz);for(const f of u){const p=[...((o=f.internals.handleBounds)==null?void 0:o.source)??[],...((c=f.internals.handleBounds)==null?void 0:c.target)??[]];for(const d of p){if(r.nodeId===d.nodeId&&r.type===d.type&&r.id===d.id)continue;const{x:_,y:v}=ns(f,d,d.position,!0),w=Math.sqrt(Math.pow(_-e.x,2)+Math.pow(v-e.y,2));w>t||(w1){const f=r.type==="source"?"target":"source";return a.find(p=>p.type===f)??a[0]}return a[0]}function l2(e,t,n,r,a,l=!1){var f,p,d;const u=r.get(e);if(!u)return null;const o=a==="strict"?(f=u.internals.handleBounds)==null?void 0:f[t]:[...((p=u.internals.handleBounds)==null?void 0:p.source)??[],...((d=u.internals.handleBounds)==null?void 0:d.target)??[]],c=(n?o==null?void 0:o.find(_=>_.id===n):o==null?void 0:o[0])??null;return c&&l?{...c,...ns(u,c,c.position,!0)}:c}function c2(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function Dz(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const u2=()=>!0;function Rz(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:a,edgeUpdaterType:l,isTarget:u,domNode:o,nodeLookup:c,lib:f,autoPanOnConnect:p,flowId:d,panBy:_,cancelConnection:v,onConnectStart:w,onConnect:C,onConnectEnd:b,isValidConnection:S=u2,onReconnectEnd:x,updateConnection:y,getTransform:k,getFromHandle:D,autoPanSpeed:T,dragThreshold:R=1,handleDomNode:N}){const M=ZC(e.target);let B=0,H;const{x:Y,y:F}=Zn(e),z=c2(l,N),q=o==null?void 0:o.getBoundingClientRect();let G=!1;if(!q||!z)return;const X=l2(a,z,r,c,t);if(!X)return;let K=Zn(e,q),O=!1,L=null,j=!1,$=null;function U(){if(!p||!q)return;const[ge,he]=Om(K,q,T);_({x:ge,y:he}),B=requestAnimationFrame(U)}const Q={...X,nodeId:a,type:z,position:X.position},re=c.get(a);let Z={inProgress:!0,isValid:null,from:ns(re,Q,Re.Left,!0),fromHandle:Q,fromPosition:Q.position,fromNode:re,to:K,toHandle:null,toPosition:Pb[Q.position],toNode:null,pointer:K};function P(){G=!0,y(Z),w==null||w(e,{nodeId:a,handleId:r,handleType:z})}R===0&&P();function ee(ge){if(!G){const{x:we,y:at}=Zn(ge),ht=we-Y,Ke=at-F;if(!(ht*ht+Ke*Ke>R*R))return;P()}if(!D()||!Q){ie(ge);return}const he=k();K=Zn(ge,q),H=Nz(dl(K,he,!1,[1,1]),n,c,Q),O||(U(),O=!0);const ye=h2(ge,{handle:H,connectionMode:t,fromNodeId:a,fromHandleId:r,fromType:u?"target":"source",isValidConnection:S,doc:M,lib:f,flowId:d,nodeLookup:c});$=ye.handleDomNode,L=ye.connection,j=Dz(!!H,ye.isValid);const Se=c.get(a),Ae=Se?ns(Se,Q,Re.Left,!0):Z.from,Ce={...Z,from:Ae,isValid:j,to:ye.toHandle&&j?ha({x:ye.toHandle.x,y:ye.toHandle.y},he):K,toHandle:ye.toHandle,toPosition:j&&ye.toHandle?ye.toHandle.position:Pb[Q.position],toNode:ye.toHandle?c.get(ye.toHandle.nodeId):null,pointer:K};y(Ce),Z=Ce}function ie(ge){if(!("touches"in ge&&ge.touches.length>0)){if(G){(H||$)&&L&&j&&(C==null||C(L));const{inProgress:he,...ye}=Z,Se={...ye,toPosition:Z.toHandle?Z.toPosition:null};b==null||b(ge,Se),l&&(x==null||x(ge,Se))}v(),cancelAnimationFrame(B),O=!1,j=!1,L=null,$=null,M.removeEventListener("mousemove",ee),M.removeEventListener("mouseup",ie),M.removeEventListener("touchmove",ee),M.removeEventListener("touchend",ie)}}M.addEventListener("mousemove",ee),M.addEventListener("mouseup",ie),M.addEventListener("touchmove",ee),M.addEventListener("touchend",ie)}function h2(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:a,fromType:l,doc:u,lib:o,flowId:c,isValidConnection:f=u2,nodeLookup:p}){const d=l==="target",_=t?u.querySelector(`.${o}-flow__handle[data-id="${c}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:v,y:w}=Zn(e),C=u.elementFromPoint(v,w),b=C!=null&&C.classList.contains(`${o}-flow__handle`)?C:_,S={handleDomNode:b,isValid:!1,connection:null,toHandle:null};if(b){const x=c2(void 0,b),y=b.getAttribute("data-nodeid"),k=b.getAttribute("data-handleid"),D=b.classList.contains("connectable"),T=b.classList.contains("connectableend");if(!y||!x)return S;const R={source:d?y:r,sourceHandle:d?k:a,target:d?r:y,targetHandle:d?a:k};S.connection=R;const M=D&&T&&(n===ca.Strict?d&&x==="source"||!d&&x==="target":y!==r||k!==a);S.isValid=M&&f(R),S.toHandle=l2(y,x,k,p,n,!0)}return S}const gg={onPointerDown:Rz,isValid:h2};function Mz({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const a=Tn(e);function l({translateExtent:o,width:c,height:f,zoomStep:p=1,pannable:d=!0,zoomable:_=!0,inversePan:v=!1}){const w=y=>{if(y.sourceEvent.type!=="wheel"||!t)return;const k=n(),D=y.sourceEvent.ctrlKey&&Jo()?10:1,T=-y.sourceEvent.deltaY*(y.sourceEvent.deltaMode===1?.05:y.sourceEvent.deltaMode?1:.002)*p,R=k[2]*Math.pow(2,T*D);t.scaleTo(R)};let C=[0,0];const b=y=>{(y.sourceEvent.type==="mousedown"||y.sourceEvent.type==="touchstart")&&(C=[y.sourceEvent.clientX??y.sourceEvent.touches[0].clientX,y.sourceEvent.clientY??y.sourceEvent.touches[0].clientY])},S=y=>{const k=n();if(y.sourceEvent.type!=="mousemove"&&y.sourceEvent.type!=="touchmove"||!t)return;const D=[y.sourceEvent.clientX??y.sourceEvent.touches[0].clientX,y.sourceEvent.clientY??y.sourceEvent.touches[0].clientY],T=[D[0]-C[0],D[1]-C[1]];C=D;const R=r()*Math.max(k[2],Math.log(k[2]))*(v?-1:1),N={x:k[0]-T[0]*R,y:k[1]-T[1]*R},M=[[0,0],[c,f]];t.setViewportConstrained({x:N.x,y:N.y,zoom:k[2]},M,o)},x=zC().on("start",b).on("zoom",d?S:null).on("zoom.wheel",_?w:null);a.call(x,{})}function u(){a.on("zoom",null)}return{update:l,destroy:u,pointer:Wn}}const xh=e=>({x:e.x,y:e.y,zoom:e.k}),yp=({x:e,y:t,zoom:n})=>yh.translate(e,t).scale(n),ta=(e,t)=>e.target.closest(`.${t}`),f2=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Lz=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,bp=(e,t=0,n=Lz,r=()=>{})=>{const a=typeof t=="number"&&t>0;return a||r(),a?e.transition().duration(t).ease(n).on("end",r):e},d2=e=>{const t=e.ctrlKey&&Jo()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function Oz({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:a,panOnScrollSpeed:l,zoomOnPinch:u,onPanZoomStart:o,onPanZoom:c,onPanZoomEnd:f}){return p=>{if(ta(p,t))return p.ctrlKey&&p.preventDefault(),!1;p.preventDefault(),p.stopImmediatePropagation();const d=n.property("__zoom").k||1;if(p.ctrlKey&&u){const b=Wn(p),S=d2(p),x=d*Math.pow(2,S);r.scaleTo(n,x,b,p);return}const _=p.deltaMode===1?20:1;let v=a===Kr.Vertical?0:p.deltaX*_,w=a===Kr.Horizontal?0:p.deltaY*_;!Jo()&&p.shiftKey&&a!==Kr.Vertical&&(v=p.deltaY*_,w=0),r.translateBy(n,-(v/d)*l,-(w/d)*l,{internal:!0});const C=xh(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?c==null||c(p,C):(e.isPanScrolling=!0,o==null||o(p,C)),e.panScrollTimeout=setTimeout(()=>{f==null||f(p,C),e.isPanScrolling=!1},150)}}function jz({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,a){const l=r.type==="wheel",u=!t&&l&&!r.ctrlKey,o=ta(r,e);if(r.ctrlKey&&l&&o&&r.preventDefault(),u||o)return null;r.preventDefault(),n.call(this,r,a)}}function Bz({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{var l,u,o;if((l=r.sourceEvent)!=null&&l.internal)return;const a=xh(r.transform);e.mouseButton=((u=r.sourceEvent)==null?void 0:u.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=a,((o=r.sourceEvent)==null?void 0:o.type)==="mousedown"&&t(!0),n&&(n==null||n(r.sourceEvent,a))}}function Iz({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:a}){return l=>{var u,o;e.usedRightMouseButton=!!(n&&f2(t,e.mouseButton??0)),(u=l.sourceEvent)!=null&&u.sync||r([l.transform.x,l.transform.y,l.transform.k]),a&&!((o=l.sourceEvent)!=null&&o.internal)&&(a==null||a(l.sourceEvent,xh(l.transform)))}}function zz({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:a,onPaneContextMenu:l}){return u=>{var o;if(!((o=u.sourceEvent)!=null&&o.internal)&&(e.isZoomingOrPanning=!1,l&&f2(t,e.mouseButton??0)&&!e.usedRightMouseButton&&u.sourceEvent&&l(u.sourceEvent),e.usedRightMouseButton=!1,r(!1),a)){const c=xh(u.transform);e.prevViewport=c,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{a==null||a(u.sourceEvent,c)},n?150:0)}}}function Hz({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:a,zoomOnDoubleClick:l,userSelectionActive:u,noWheelClassName:o,noPanClassName:c,lib:f,connectionInProgress:p}){return d=>{var b;const _=e||t,v=n&&d.ctrlKey,w=d.type==="wheel";if(d.button===1&&d.type==="mousedown"&&(ta(d,`${f}-flow__node`)||ta(d,`${f}-flow__edge`)))return!0;if(!r&&!_&&!a&&!l&&!n||u||p&&!w||ta(d,o)&&w||ta(d,c)&&(!w||a&&w&&!e)||!n&&d.ctrlKey&&w)return!1;if(!n&&d.type==="touchstart"&&((b=d.touches)==null?void 0:b.length)>1)return d.preventDefault(),!1;if(!_&&!a&&!v&&w||!r&&(d.type==="mousedown"||d.type==="touchstart")||Array.isArray(r)&&!r.includes(d.button)&&d.type==="mousedown")return!1;const C=Array.isArray(r)&&r.includes(d.button)||!d.button||d.button<=1;return(!d.ctrlKey||w)&&C}}function Fz({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:a,onPanZoom:l,onPanZoomStart:u,onPanZoomEnd:o,onDraggingChange:c}){const f={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},p=e.getBoundingClientRect();let d=[[0,0],[p.width,p.height]];const _=typeof ResizeObserver<"u"?new ResizeObserver(F=>{const z=F[0];z&&(d=[[0,0],[z.contentRect.width,z.contentRect.height]])}):null;_==null||_.observe(e);const v=zC().extent(()=>d).scaleExtent([t,n]).translateExtent(r),w=Tn(e).call(v);k({x:a.x,y:a.y,zoom:ua(a.zoom,t,n)},[[0,0],[p.width,p.height]],r);const C=w.on("wheel.zoom"),b=w.on("dblclick.zoom");v.wheelDelta(d2);async function S(F,z){return w?new Promise(q=>{v==null||v.interpolate((z==null?void 0:z.interpolate)==="linear"?Lo:du).transform(bp(w,z==null?void 0:z.duration,z==null?void 0:z.ease,()=>q(!0)),F)}):!1}function x({noWheelClassName:F,noPanClassName:z,onPaneContextMenu:q,userSelectionActive:G,panOnScroll:X,panOnDrag:K,panOnScrollMode:O,panOnScrollSpeed:L,preventScrolling:j,zoomOnPinch:$,zoomOnScroll:U,zoomOnDoubleClick:Q,zoomActivationKeyPressed:re,lib:ae,onTransformChange:Z,connectionInProgress:P,paneClickDistance:ee,selectionOnDrag:ie}){G&&!f.isZoomingOrPanning&&y();const ge=X&&!re&&!G;v.clickDistance(ie?1/0:!Kn(ee)||ee<0?0:ee);const he=ge?Oz({zoomPanValues:f,noWheelClassName:F,d3Selection:w,d3Zoom:v,panOnScrollMode:O,panOnScrollSpeed:L,zoomOnPinch:$,onPanZoomStart:u,onPanZoom:l,onPanZoomEnd:o}):jz({noWheelClassName:F,preventScrolling:j,d3ZoomHandler:C});w.on("wheel.zoom",he,{passive:!1});const ye=Bz({zoomPanValues:f,onDraggingChange:c,onPanZoomStart:u});v.on("start",ye);const Se=Iz({zoomPanValues:f,panOnDrag:K,onPaneContextMenu:!!q,onPanZoom:l,onTransformChange:Z});v.on("zoom",Se);const Ae=zz({zoomPanValues:f,panOnDrag:K,panOnScroll:X,onPaneContextMenu:q,onPanZoomEnd:o,onDraggingChange:c});v.on("end",Ae);const Ce=Hz({zoomActivationKeyPressed:re,panOnDrag:K,zoomOnScroll:U,panOnScroll:X,zoomOnDoubleClick:Q,zoomOnPinch:$,userSelectionActive:G,noPanClassName:z,noWheelClassName:F,lib:ae,connectionInProgress:P});v.filter(Ce),Q?w.on("dblclick.zoom",b):w.on("dblclick.zoom",null)}function y(){v.on("zoom",null)}async function k(F,z,q){const G=yp(F),X=v==null?void 0:v.constrain()(G,z,q);return X&&await S(X),X}async function D(F,z){const q=yp(F);return await S(q,z),q}function T(F){if(w){const z=yp(F),q=w.property("__zoom");(q.k!==F.zoom||q.x!==F.x||q.y!==F.y)&&(v==null||v.transform(w,z,null,{sync:!0}))}}function R(){const F=w?IC(w.node()):{x:0,y:0,k:1};return{x:F.x,y:F.y,zoom:F.k}}async function N(F,z){return w?new Promise(q=>{v==null||v.interpolate((z==null?void 0:z.interpolate)==="linear"?Lo:du).scaleTo(bp(w,z==null?void 0:z.duration,z==null?void 0:z.ease,()=>q(!0)),F)}):!1}async function M(F,z){return w?new Promise(q=>{v==null||v.interpolate((z==null?void 0:z.interpolate)==="linear"?Lo:du).scaleBy(bp(w,z==null?void 0:z.duration,z==null?void 0:z.ease,()=>q(!0)),F)}):!1}function B(F){v==null||v.scaleExtent(F)}function H(F){v==null||v.translateExtent(F)}function Y(F){const z=!Kn(F)||F<0?0:F;v==null||v.clickDistance(z)}return{update:x,destroy:y,setViewport:D,setViewportConstrained:k,getViewport:R,scaleTo:N,scaleBy:M,setScaleExtent:B,setTranslateExtent:H,syncViewport:T,setClickDistance:Y}}var fa;(function(e){e.Line="line",e.Handle="handle"})(fa||(fa={}));function Pz({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:a,affectsY:l}){const u=e-t,o=n-r,c=[u>0?1:u<0?-1:0,o>0?1:o<0?-1:0];return u&&a&&(c[0]=c[0]*-1),o&&l&&(c[1]=c[1]*-1),c}function eS(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),r=e.includes("left"),a=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:r,affectsY:a}}function _r(e,t){return Math.max(0,t-e)}function vr(e,t){return Math.max(0,e-t)}function tu(e,t,n){return Math.max(0,t-e,e-n)}function tS(e,t){return e?!t:t}function Uz(e,t,n,r,a,l,u,o){let{affectsX:c,affectsY:f}=t;const{isHorizontal:p,isVertical:d}=t,_=p&&d,{xSnapped:v,ySnapped:w}=n,{minWidth:C,maxWidth:b,minHeight:S,maxHeight:x}=r,{x:y,y:k,width:D,height:T,aspectRatio:R}=e;let N=Math.floor(p?v-e.pointerX:0),M=Math.floor(d?w-e.pointerY:0);const B=D+(c?-N:N),H=T+(f?-M:M),Y=-l[0]*D,F=-l[1]*T;let z=tu(B,C,b),q=tu(H,S,x);if(u){let K=0,O=0;c&&N<0?K=_r(y+N+Y,u[0][0]):!c&&N>0&&(K=vr(y+B+Y,u[1][0])),f&&M<0?O=_r(k+M+F,u[0][1]):!f&&M>0&&(O=vr(k+H+F,u[1][1])),z=Math.max(z,K),q=Math.max(q,O)}if(o){let K=0,O=0;c&&N>0?K=vr(y+N,o[0][0]):!c&&N<0&&(K=_r(y+B,o[1][0])),f&&M>0?O=vr(k+M,o[0][1]):!f&&M<0&&(O=_r(k+H,o[1][1])),z=Math.max(z,K),q=Math.max(q,O)}if(a){if(p){const K=tu(B/R,S,x)*R;if(z=Math.max(z,K),u){let O=0;!c&&!f||c&&!f&&_?O=vr(k+F+B/R,u[1][1])*R:O=_r(k+F+(c?N:-N)/R,u[0][1])*R,z=Math.max(z,O)}if(o){let O=0;!c&&!f||c&&!f&&_?O=_r(k+B/R,o[1][1])*R:O=vr(k+(c?N:-N)/R,o[0][1])*R,z=Math.max(z,O)}}if(d){const K=tu(H*R,C,b)/R;if(q=Math.max(q,K),u){let O=0;!c&&!f||f&&!c&&_?O=vr(y+H*R+Y,u[1][0])/R:O=_r(y+(f?M:-M)*R+Y,u[0][0])/R,q=Math.max(q,O)}if(o){let O=0;!c&&!f||f&&!c&&_?O=_r(y+H*R,o[1][0])/R:O=vr(y+(f?M:-M)*R,o[0][0])/R,q=Math.max(q,O)}}}M=M+(M<0?q:-q),N=N+(N<0?z:-z),a&&(_?B>H*R?M=(tS(c,f)?-N:N)/R:N=(tS(c,f)?-M:M)*R:p?(M=N/R,f=c):(N=M*R,c=f));const G=c?y+N:y,X=f?k+M:k;return{width:D+(c?-N:N),height:T+(f?-M:M),x:l[0]*N*(c?-1:1)+G,y:l[1]*M*(f?-1:1)+X}}const p2={width:0,height:0,x:0,y:0},$z={...p2,pointerX:0,pointerY:0,aspectRatio:1};function Gz(e,t,n){const r=t.position.x+e.position.x,a=t.position.y+e.position.y,l=e.measured.width??0,u=e.measured.height??0,o=n[0]*l,c=n[1]*u;return[[r-o,a-c],[r+l-o,a+u-c]]}function qz({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:a}){const l=Tn(e);let u={controlDirection:eS("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function o({controlPosition:f,boundaries:p,keepAspectRatio:d,resizeDirection:_,onResizeStart:v,onResize:w,onResizeEnd:C,shouldResize:b}){let S={...p2},x={...$z};u={boundaries:p,resizeDirection:_,keepAspectRatio:d,controlDirection:eS(f)};let y,k=null,D=[],T,R,N,M=!1;const B=wC().on("start",H=>{const{nodeLookup:Y,transform:F,snapGrid:z,snapToGrid:q,nodeOrigin:G,paneDomNode:X}=n();if(y=Y.get(t),!y)return;k=(X==null?void 0:X.getBoundingClientRect())??null;const{xSnapped:K,ySnapped:O}=Oo(H.sourceEvent,{transform:F,snapGrid:z,snapToGrid:q,containerBounds:k});S={width:y.measured.width??0,height:y.measured.height??0,x:y.position.x??0,y:y.position.y??0},x={...S,pointerX:K,pointerY:O,aspectRatio:S.width/S.height},T=void 0,R=ts(y.extent)?y.extent:void 0,y.parentId&&(y.extent==="parent"||y.expandParent)&&(T=Y.get(y.parentId)),T&&y.extent==="parent"&&(R=[[0,0],[T.measured.width,T.measured.height]]),D=[],N=void 0;for(const[L,j]of Y)if(j.parentId===t&&(D.push({id:L,position:{...j.position},extent:j.extent}),j.extent==="parent"||j.expandParent)){const $=Gz(j,y,j.origin??G);N?N=[[Math.min($[0][0],N[0][0]),Math.min($[0][1],N[0][1])],[Math.max($[1][0],N[1][0]),Math.max($[1][1],N[1][1])]]:N=$}v==null||v(H,{...S})}).on("drag",H=>{const{transform:Y,snapGrid:F,snapToGrid:z,nodeOrigin:q}=n(),G=Oo(H.sourceEvent,{transform:Y,snapGrid:F,snapToGrid:z,containerBounds:k}),X=[];if(!y)return;const{x:K,y:O,width:L,height:j}=S,$={},U=y.origin??q,{width:Q,height:re,x:ae,y:Z}=Uz(x,u.controlDirection,G,u.boundaries,u.keepAspectRatio,U,R,N),P=Q!==L,ee=re!==j,ie=ae!==K&&P,ge=Z!==O&ⅇif(!ie&&!ge&&!P&&!ee)return;if((ie||ge||U[0]===1||U[1]===1)&&($.x=ie?ae:S.x,$.y=ge?Z:S.y,S.x=$.x,S.y=$.y,D.length>0)){const Ae=ae-K,Ce=Z-O;for(const we of D)we.position={x:we.position.x-Ae+U[0]*(Q-L),y:we.position.y-Ce+U[1]*(re-j)},X.push(we)}if((P||ee)&&($.width=P&&(!u.resizeDirection||u.resizeDirection==="horizontal")?Q:S.width,$.height=ee&&(!u.resizeDirection||u.resizeDirection==="vertical")?re:S.height,S.width=$.width,S.height=$.height),T&&y.expandParent){const Ae=U[0]*($.width??0);$.x&&$.x{M&&(C==null||C(H,{...S}),a==null||a({...S}),M=!1)});l.call(B)}function c(){l.on(".drag",null)}return{update:o,destroy:c}}var Sp={exports:{}},xp={},wp={exports:{}},Cp={};/** * @license React * use-sync-external-store-shim.production.js * @@ -357,7 +360,7 @@ Its experiments, runs and chats are removed from orx. The GitHub repo (${f.githu * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var nS;function qz(){if(nS)return Ep;nS=1;var e=tl();function t(d,_){return d===_&&(d!==0||1/d===1/_)||d!==d&&_!==_}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,a=e.useEffect,l=e.useLayoutEffect,u=e.useDebugValue;function o(d,_){var v=_(),w=r({inst:{value:v,getSnapshot:_}}),C=w[0].inst,y=w[1];return l(function(){C.value=v,C.getSnapshot=_,c(C)&&y({inst:C})},[d,v,_]),a(function(){return c(C)&&y({inst:C}),d(function(){c(C)&&y({inst:C})})},[d]),u(v),v}function c(d){var _=d.getSnapshot;d=d.value;try{var v=_();return!n(d,v)}catch{return!0}}function f(d,_){return _()}var p=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?f:o;return Ep.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:p,Ep}var iS;function Vz(){return iS||(iS=1,Cp.exports=qz()),Cp.exports}/** + */var nS;function Vz(){if(nS)return Cp;nS=1;var e=tl();function t(d,_){return d===_&&(d!==0||1/d===1/_)||d!==d&&_!==_}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,a=e.useEffect,l=e.useLayoutEffect,u=e.useDebugValue;function o(d,_){var v=_(),w=r({inst:{value:v,getSnapshot:_}}),C=w[0].inst,b=w[1];return l(function(){C.value=v,C.getSnapshot=_,c(C)&&b({inst:C})},[d,v,_]),a(function(){return c(C)&&b({inst:C}),d(function(){c(C)&&b({inst:C})})},[d]),u(v),v}function c(d){var _=d.getSnapshot;d=d.value;try{var v=_();return!n(d,v)}catch{return!0}}function f(d,_){return _()}var p=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?f:o;return Cp.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:p,Cp}var iS;function Yz(){return iS||(iS=1,wp.exports=Vz()),wp.exports}/** * @license React * use-sync-external-store-shim/with-selector.production.js * @@ -365,10 +368,10 @@ Its experiments, runs and chats are removed from orx. The GitHub repo (${f.githu * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var rS;function Yz(){if(rS)return wp;rS=1;var e=tl(),t=Vz();function n(f,p){return f===p&&(f!==0||1/f===1/p)||f!==f&&p!==p}var r=typeof Object.is=="function"?Object.is:n,a=t.useSyncExternalStore,l=e.useRef,u=e.useEffect,o=e.useMemo,c=e.useDebugValue;return wp.useSyncExternalStoreWithSelector=function(f,p,d,_,v){var w=l(null);if(w.current===null){var C={hasValue:!1,value:null};w.current=C}else C=w.current;w=o(function(){function S(T){if(!x){if(x=!0,b=T,T=_(T),v!==void 0&&C.hasValue){var R=C.value;if(v(R,T))return k=R}return k=T}if(R=k,r(b,T))return R;var N=_(T);return v!==void 0&&v(R,N)?(b=T,R):(b=T,k=N)}var x=!1,b,k,D=d===void 0?null:d;return[function(){return S(p())},D===null?void 0:function(){return S(D())}]},[p,d,_,v]);var y=a(f,w[0],w[1]);return u(function(){C.hasValue=!0,C.value=y},[y]),c(y),y},wp}var sS;function Wz(){return sS||(sS=1,xp.exports=Yz()),xp.exports}var Xz=Wz();const Kz=Fu(Xz),Zz={},aS=e=>{let t;const n=new Set,r=(p,d)=>{const _=typeof p=="function"?p(t):p;if(!Object.is(_,t)){const v=t;t=d??(typeof _!="object"||_===null)?_:Object.assign({},t,_),n.forEach(w=>w(t,v))}},a=()=>t,c={setState:r,getState:a,getInitialState:()=>f,subscribe:p=>(n.add(p),()=>n.delete(p)),destroy:()=>{(Zz?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},f=t=e(r,a,c);return c},Qz=e=>e?aS(e):aS,{useDebugValue:Jz}=rA,{useSyncExternalStoreWithSelector:eH}=Kz,tH=e=>e;function pE(e,t=tH,n){const r=eH(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Jz(r),r}const oS=(e,t)=>{const n=Qz(e),r=(a,l=t)=>pE(n,a,l);return Object.assign(r,n),r},nH=(e,t)=>e?oS(e,t):oS;function Nt(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,a]of e)if(!Object.is(a,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}jS();const Ch=V.createContext(null),iH=Ch.Provider,gE=Jn.error001("react");function nt(e,t){const n=V.useContext(Ch);if(n===null)throw new Error(gE);return pE(n,e,t)}function At(){const e=V.useContext(Ch);if(e===null)throw new Error(gE);return V.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const lS={display:"none"},rH={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},mE="react-flow__node-desc",_E="react-flow__edge-desc",sH="react-flow__aria-live",aH=e=>e.ariaLiveMessage,oH=e=>e.ariaLabelConfig;function lH({rfId:e}){const t=nt(aH);return m.jsx("div",{id:`${sH}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:rH,children:t})}function cH({rfId:e,disableKeyboardA11y:t}){const n=nt(oH);return m.jsxs(m.Fragment,{children:[m.jsx("div",{id:`${mE}-${e}`,style:lS,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),m.jsx("div",{id:`${_E}-${e}`,style:lS,children:n["edge.a11yDescription.default"]}),!t&&m.jsx(lH,{rfId:e})]})}const Eh=V.forwardRef(({position:e="top-left",children:t,className:n,style:r,...a},l)=>{const u=`${e}`.split("-");return m.jsx("div",{className:Pt(["react-flow__panel",n,...u]),style:r,ref:l,...a,children:t})});Eh.displayName="Panel";const cS="https://reactflow.dev?utm_source=attribution";function uH({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:m.jsx(Eh,{position:t,className:"react-flow__attribution","data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${cS}`,children:m.jsx("a",{href:cS,target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const hH=e=>{const t=[],n=[];for(const[,r]of e.nodeLookup)r.selected&&t.push(r.internals.userNode);for(const[,r]of e.edgeLookup)r.selected&&n.push(r);return{selectedNodes:t,selectedEdges:n}},iu=e=>e.id;function fH(e,t){return Nt(e.selectedNodes.map(iu),t.selectedNodes.map(iu))&&Nt(e.selectedEdges.map(iu),t.selectedEdges.map(iu))}function dH({onSelectionChange:e}){const t=At(),{selectedNodes:n,selectedEdges:r}=nt(hH,fH);return V.useEffect(()=>{const a={nodes:n,edges:r};e==null||e(a),t.getState().onSelectionChangeHandlers.forEach(l=>l(a))},[n,r,e]),null}const pH=e=>!!e.onSelectionChangeHandlers;function gH({onSelectionChange:e}){const t=nt(pH);return e||t?m.jsx(dH,{onSelectionChange:e}):null}const vE=[0,0],mH={x:0,y:0,zoom:1},_H=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],uS=[..._H,"rfId"],vH=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),hS={translateExtent:Ko,nodeOrigin:vE,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function yH(e){const{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:a,setTranslateExtent:l,setNodeExtent:u,reset:o,setDefaultNodesAndEdges:c}=nt(vH,Nt),f=At();V.useEffect(()=>(c(e.defaultNodes,e.defaultEdges),()=>{p.current=hS,o()}),[]);const p=V.useRef(hS);return V.useEffect(()=>{for(const d of uS){const _=e[d],v=p.current[d];_!==v&&(typeof e[d]>"u"||(d==="nodes"?t(_):d==="edges"?n(_):d==="minZoom"?r(_):d==="maxZoom"?a(_):d==="translateExtent"?l(_):d==="nodeExtent"?u(_):d==="ariaLabelConfig"?f.setState({ariaLabelConfig:iz(_)}):d==="fitView"?f.setState({fitViewQueued:_}):d==="fitViewOptions"?f.setState({fitViewOptions:_}):f.setState({[d]:_})))}p.current=e},uS.map(d=>e[d])),null}function fS(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function bH(e){var r;const[t,n]=V.useState(e==="system"?null:e);return V.useEffect(()=>{if(e!=="system"){n(e);return}const a=fS(),l=()=>n(a!=null&&a.matches?"dark":"light");return l(),a==null||a.addEventListener("change",l),()=>{a==null||a.removeEventListener("change",l)}},[e]),t!==null?t:(r=fS())!=null&&r.matches?"dark":"light"}const dS=typeof document<"u"?document:null;function el(e=null,t={target:dS,actInsideInputWithModifier:!0}){const[n,r]=V.useState(!1),a=V.useRef(!1),l=V.useRef(new Set([])),[u,o]=V.useMemo(()=>{if(e!==null){const f=(Array.isArray(e)?e:[e]).filter(d=>typeof d=="string").map(d=>d.replace("+",` + */var rS;function Wz(){if(rS)return xp;rS=1;var e=tl(),t=Yz();function n(f,p){return f===p&&(f!==0||1/f===1/p)||f!==f&&p!==p}var r=typeof Object.is=="function"?Object.is:n,a=t.useSyncExternalStore,l=e.useRef,u=e.useEffect,o=e.useMemo,c=e.useDebugValue;return xp.useSyncExternalStoreWithSelector=function(f,p,d,_,v){var w=l(null);if(w.current===null){var C={hasValue:!1,value:null};w.current=C}else C=w.current;w=o(function(){function S(T){if(!x){if(x=!0,y=T,T=_(T),v!==void 0&&C.hasValue){var R=C.value;if(v(R,T))return k=R}return k=T}if(R=k,r(y,T))return R;var N=_(T);return v!==void 0&&v(R,N)?(y=T,R):(y=T,k=N)}var x=!1,y,k,D=d===void 0?null:d;return[function(){return S(p())},D===null?void 0:function(){return S(D())}]},[p,d,_,v]);var b=a(f,w[0],w[1]);return u(function(){C.hasValue=!0,C.value=b},[b]),c(b),b},xp}var sS;function Xz(){return sS||(sS=1,Sp.exports=Wz()),Sp.exports}var Kz=Xz();const Zz=Hu(Kz),Qz={},aS=e=>{let t;const n=new Set,r=(p,d)=>{const _=typeof p=="function"?p(t):p;if(!Object.is(_,t)){const v=t;t=d??(typeof _!="object"||_===null)?_:Object.assign({},t,_),n.forEach(w=>w(t,v))}},a=()=>t,c={setState:r,getState:a,getInitialState:()=>f,subscribe:p=>(n.add(p),()=>n.delete(p)),destroy:()=>{(Qz?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},f=t=e(r,a,c);return c},Jz=e=>e?aS(e):aS,{useDebugValue:eH}=sA,{useSyncExternalStoreWithSelector:tH}=Zz,nH=e=>e;function g2(e,t=nH,n){const r=tH(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return eH(r),r}const oS=(e,t)=>{const n=Jz(e),r=(a,l=t)=>g2(n,a,l);return Object.assign(r,n),r},iH=(e,t)=>e?oS(e,t):oS;function At(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,a]of e)if(!Object.is(a,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}jS();const wh=V.createContext(null),rH=wh.Provider,m2=Jn.error001("react");function nt(e,t){const n=V.useContext(wh);if(n===null)throw new Error(m2);return g2(n,e,t)}function Ct(){const e=V.useContext(wh);if(e===null)throw new Error(m2);return V.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const lS={display:"none"},sH={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},_2="react-flow__node-desc",v2="react-flow__edge-desc",aH="react-flow__aria-live",oH=e=>e.ariaLiveMessage,lH=e=>e.ariaLabelConfig;function cH({rfId:e}){const t=nt(oH);return m.jsx("div",{id:`${aH}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:sH,children:t})}function uH({rfId:e,disableKeyboardA11y:t}){const n=nt(lH);return m.jsxs(m.Fragment,{children:[m.jsx("div",{id:`${_2}-${e}`,style:lS,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),m.jsx("div",{id:`${v2}-${e}`,style:lS,children:n["edge.a11yDescription.default"]}),!t&&m.jsx(cH,{rfId:e})]})}const Ch=V.forwardRef(({position:e="top-left",children:t,className:n,style:r,...a},l)=>{const u=`${e}`.split("-");return m.jsx("div",{className:Pt(["react-flow__panel",n,...u]),style:r,ref:l,...a,children:t})});Ch.displayName="Panel";const cS="https://reactflow.dev?utm_source=attribution";function hH({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:m.jsx(Ch,{position:t,className:"react-flow__attribution","data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${cS}`,children:m.jsx("a",{href:cS,target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const fH=e=>{const t=[],n=[];for(const[,r]of e.nodeLookup)r.selected&&t.push(r.internals.userNode);for(const[,r]of e.edgeLookup)r.selected&&n.push(r);return{selectedNodes:t,selectedEdges:n}},nu=e=>e.id;function dH(e,t){return At(e.selectedNodes.map(nu),t.selectedNodes.map(nu))&&At(e.selectedEdges.map(nu),t.selectedEdges.map(nu))}function pH({onSelectionChange:e}){const t=Ct(),{selectedNodes:n,selectedEdges:r}=nt(fH,dH);return V.useEffect(()=>{const a={nodes:n,edges:r};e==null||e(a),t.getState().onSelectionChangeHandlers.forEach(l=>l(a))},[n,r,e]),null}const gH=e=>!!e.onSelectionChangeHandlers;function mH({onSelectionChange:e}){const t=nt(gH);return e||t?m.jsx(pH,{onSelectionChange:e}):null}const y2=[0,0],_H={x:0,y:0,zoom:1},vH=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],uS=[...vH,"rfId"],yH=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),hS={translateExtent:Ko,nodeOrigin:y2,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function bH(e){const{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:a,setTranslateExtent:l,setNodeExtent:u,reset:o,setDefaultNodesAndEdges:c}=nt(yH,At),f=Ct();V.useEffect(()=>(c(e.defaultNodes,e.defaultEdges),()=>{p.current=hS,o()}),[]);const p=V.useRef(hS);return V.useEffect(()=>{for(const d of uS){const _=e[d],v=p.current[d];_!==v&&(typeof e[d]>"u"||(d==="nodes"?t(_):d==="edges"?n(_):d==="minZoom"?r(_):d==="maxZoom"?a(_):d==="translateExtent"?l(_):d==="nodeExtent"?u(_):d==="ariaLabelConfig"?f.setState({ariaLabelConfig:rz(_)}):d==="fitView"?f.setState({fitViewQueued:_}):d==="fitViewOptions"?f.setState({fitViewOptions:_}):f.setState({[d]:_})))}p.current=e},uS.map(d=>e[d])),null}function fS(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function SH(e){var r;const[t,n]=V.useState(e==="system"?null:e);return V.useEffect(()=>{if(e!=="system"){n(e);return}const a=fS(),l=()=>n(a!=null&&a.matches?"dark":"light");return l(),a==null||a.addEventListener("change",l),()=>{a==null||a.removeEventListener("change",l)}},[e]),t!==null?t:(r=fS())!=null&&r.matches?"dark":"light"}const dS=typeof document<"u"?document:null;function el(e=null,t={target:dS,actInsideInputWithModifier:!0}){const[n,r]=V.useState(!1),a=V.useRef(!1),l=V.useRef(new Set([])),[u,o]=V.useMemo(()=>{if(e!==null){const f=(Array.isArray(e)?e:[e]).filter(d=>typeof d=="string").map(d=>d.replace("+",` `).replace(` `,` +`).split(` -`)),p=f.reduce((d,_)=>d.concat(..._),[]);return[f,p]}return[[],[]]},[e]);return V.useEffect(()=>{const c=(t==null?void 0:t.target)??dS,f=(t==null?void 0:t.actInsideInputWithModifier)??!0;if(e!==null){const p=v=>{var y,S;if(a.current=v.ctrlKey||v.metaKey||v.shiftKey||v.altKey,(!a.current||a.current&&!f)&&ZC(v))return!1;const C=gS(v.code,o);if(l.current.add(v[C]),pS(u,l.current,!1)){const x=((S=(y=v.composedPath)==null?void 0:y.call(v))==null?void 0:S[0])||v.target,b=(x==null?void 0:x.nodeName)==="BUTTON"||(x==null?void 0:x.nodeName)==="A";t.preventDefault!==!1&&(a.current||!b)&&v.preventDefault(),r(!0)}},d=v=>{const w=gS(v.code,o);pS(u,l.current,!0)?(r(!1),l.current.clear()):l.current.delete(v[w]),v.key==="Meta"&&l.current.clear(),a.current=!1},_=()=>{l.current.clear(),r(!1)};return c==null||c.addEventListener("keydown",p),c==null||c.addEventListener("keyup",d),window.addEventListener("blur",_),window.addEventListener("contextmenu",_),()=>{c==null||c.removeEventListener("keydown",p),c==null||c.removeEventListener("keyup",d),window.removeEventListener("blur",_),window.removeEventListener("contextmenu",_)}}},[e,r]),n}function pS(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(a=>t.has(a)))}function gS(e,t){return t.includes(e)?"code":"key"}const SH=()=>{const e=At();return V.useMemo(()=>({zoomIn:async t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,t):!1},zoomOut:async t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,t):!1},zoomTo:async(t,n)=>{const{panZoom:r}=e.getState();return r?r.scaleTo(t,n):!1},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[r,a,l],panZoom:u}=e.getState();return u?(await u.setViewport({x:t.x??r,y:t.y??a,zoom:t.zoom??l},n),!0):!1},getViewport:()=>{const[t,n,r]=e.getState().transform;return{x:t,y:n,zoom:r}},setCenter:async(t,n,r)=>e.getState().setCenter(t,n,r),fitBounds:async(t,n)=>{const{width:r,height:a,minZoom:l,maxZoom:u,panZoom:o}=e.getState(),c=jm(t,r,a,l,u,(n==null?void 0:n.padding)??.1);return o?(await o.setViewport(c,{duration:n==null?void 0:n.duration,ease:n==null?void 0:n.ease,interpolate:n==null?void 0:n.interpolate}),!0):!1},screenToFlowPosition:(t,n={})=>{const{transform:r,snapGrid:a,snapToGrid:l,domNode:u}=e.getState();if(!u)return t;const{x:o,y:c}=u.getBoundingClientRect(),f={x:t.x-o,y:t.y-c},p=n.snapGrid??a,d=n.snapToGrid??l;return pl(f,r,d,p)},flowToScreenPosition:t=>{const{transform:n,domNode:r}=e.getState();if(!r)return t;const{x:a,y:l}=r.getBoundingClientRect(),u=fa(t,n);return{x:u.x+a,y:u.y+l}}}),[])};function yE(e,t){const n=[],r=new Map,a=[];for(const l of e)if(l.type==="add"){a.push(l);continue}else if(l.type==="remove"||l.type==="replace")r.set(l.id,[l]);else{const u=r.get(l.id);u?u.push(l):r.set(l.id,[l])}for(const l of t){const u=r.get(l.id);if(!u){n.push(l);continue}if(u[0].type==="remove")continue;if(u[0].type==="replace"){n.push({...u[0].item});continue}const o={...l};for(const c of u)xH(c,o);n.push(o)}return a.length&&a.forEach(l=>{l.index!==void 0?n.splice(l.index,0,{...l.item}):n.push({...l.item})}),n}function xH(e,t){switch(e.type){case"select":{t.selected=e.selected;break}case"position":{typeof e.position<"u"&&(t.position=e.position),typeof e.dragging<"u"&&(t.dragging=e.dragging);break}case"dimensions":{typeof e.dimensions<"u"&&(t.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes==="width")&&(t.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes==="height")&&(t.height=e.dimensions.height))),typeof e.resizing=="boolean"&&(t.resizing=e.resizing);break}}}function wH(e,t){return yE(e,t)}function CH(e,t){return yE(e,t)}function Yr(e,t){return{id:e,type:"select",selected:t}}function ia(e,t=new Set,n=!1){const r=[];for(const[a,l]of e){const u=t.has(a);!(l.selected===void 0&&!u)&&l.selected!==u&&(n&&(l.selected=u),r.push(Yr(l.id,u)))}return r}function mS({items:e=[],lookup:t}){var a;const n=[],r=new Map(e.map(l=>[l.id,l]));for(const[l,u]of e.entries()){const o=t.get(u.id),c=((a=o==null?void 0:o.internals)==null?void 0:a.userNode)??o;c!==void 0&&c!==u&&n.push({id:u.id,item:u,type:"replace"}),c===void 0&&n.push({item:u,type:"add",index:l})}for(const[l]of t)r.get(l)===void 0&&n.push({id:l,type:"remove"});return n}function _S(e){return{id:e.id,type:"remove"}}const EH=YC();function kH(e,t,n={}){return cz(e,t,{...n,onError:n.onError??EH})}const vS=e=>W9(e),AH=e=>UC(e);function bE(e){return V.forwardRef(e)}const SE=typeof window<"u"?V.useLayoutEffect:V.useEffect;function yS(e){const[t,n]=V.useState(BigInt(0)),[r]=V.useState(()=>TH(()=>n(a=>a+BigInt(1))));return SE(()=>{const a=r.get();a.length&&(e(a),r.reset())},[t]),r}function TH(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const xE=V.createContext(null);function NH({children:e}){const t=At(),n=V.useCallback(o=>{const{nodes:c=[],setNodes:f,hasDefaultNodes:p,onNodesChange:d,nodeLookup:_,fitViewQueued:v,onNodesChangeMiddlewareMap:w}=t.getState();let C=c;for(const S of o)C=typeof S=="function"?S(C):S;let y=mS({items:C,lookup:_});for(const S of w.values())y=S(y);p&&f(C),y.length>0?d==null||d(y):v&&window.requestAnimationFrame(()=>{const{fitViewQueued:S,nodes:x,setNodes:b}=t.getState();S&&b(x)})},[]),r=yS(n),a=V.useCallback(o=>{const{edges:c=[],setEdges:f,hasDefaultEdges:p,onEdgesChange:d,edgeLookup:_}=t.getState();let v=c;for(const w of o)v=typeof w=="function"?w(v):w;p?f(v):d&&d(mS({items:v,lookup:_}))},[]),l=yS(a),u=V.useMemo(()=>({nodeQueue:r,edgeQueue:l}),[]);return m.jsx(xE.Provider,{value:u,children:e})}function DH(){const e=V.useContext(xE);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const RH=e=>!!e.panZoom;function Um(){const e=SH(),t=At(),n=DH(),r=nt(RH),a=V.useMemo(()=>{const l=d=>t.getState().nodeLookup.get(d),u=d=>{n.nodeQueue.push(d)},o=d=>{n.edgeQueue.push(d)},c=d=>{var S,x;const{nodeLookup:_,nodeOrigin:v}=t.getState(),w=vS(d)?d:_.get(d.id),C=w.parentId?XC(w.position,w.measured,w.parentId,_,v):w.position,y={...w,position:C,width:((S=w.measured)==null?void 0:S.width)??w.width,height:((x=w.measured)==null?void 0:x.height)??w.height};return Qo(y)},f=(d,_,v={replace:!1})=>{u(w=>w.map(C=>{if(C.id===d){const y=typeof _=="function"?_(C):_;return v.replace&&vS(y)?y:{...C,...y}}return C}))},p=(d,_,v={replace:!1})=>{o(w=>w.map(C=>{if(C.id===d){const y=typeof _=="function"?_(C):_;return v.replace&&AH(y)?y:{...C,...y}}return C}))};return{getNodes:()=>t.getState().nodes.map(d=>({...d})),getNode:d=>{var _;return(_=l(d))==null?void 0:_.internals.userNode},getInternalNode:l,getEdges:()=>{const{edges:d=[]}=t.getState();return d.map(_=>({..._}))},getEdge:d=>t.getState().edgeLookup.get(d),setNodes:u,setEdges:o,addNodes:d=>{const _=Array.isArray(d)?d:[d];n.nodeQueue.push(v=>[...v,..._])},addEdges:d=>{const _=Array.isArray(d)?d:[d];n.edgeQueue.push(v=>[...v,..._])},toObject:()=>{const{nodes:d=[],edges:_=[],transform:v}=t.getState(),[w,C,y]=v;return{nodes:d.map(S=>({...S})),edges:_.map(S=>({...S})),viewport:{x:w,y:C,zoom:y}}},deleteElements:async({nodes:d=[],edges:_=[]})=>{const{nodes:v,edges:w,onNodesDelete:C,onEdgesDelete:y,triggerNodeChanges:S,triggerEdgeChanges:x,onDelete:b,onBeforeDelete:k}=t.getState(),{nodes:D,edges:T}=await J9({nodesToRemove:d,edgesToRemove:_,nodes:v,edges:w,onBeforeDelete:k}),R=T.length>0,N=D.length>0;if(R){const M=T.map(_S);y==null||y(T),x(M)}if(N){const M=D.map(_S);C==null||C(D),S(M)}return(N||R)&&(b==null||b({nodes:D,edges:T})),{deletedNodes:D,deletedEdges:T}},getIntersectingNodes:(d,_=!0,v)=>{const w=$b(d),C=w?d:c(d),y=v!==void 0;return C?(v||t.getState().nodes).filter(S=>{const x=t.getState().nodeLookup.get(S.id);if(x&&!w&&(S.id===d.id||!x.internals.positionAbsolute))return!1;const b=Qo(y?S:x),k=Iu(b,C);return _&&k>0||k>=b.width*b.height||k>=C.width*C.height}):[]},isNodeIntersecting:(d,_,v=!0)=>{const C=$b(d)?d:c(d);if(!C)return!1;const y=Iu(C,_);return v&&y>0||y>=_.width*_.height||y>=C.width*C.height},updateNode:f,updateNodeData:(d,_,v={replace:!1})=>{f(d,w=>{const C=typeof _=="function"?_(w):_;return v.replace?{...w,data:C}:{...w,data:{...w.data,...C}}},v)},updateEdge:p,updateEdgeData:(d,_,v={replace:!1})=>{p(d,w=>{const C=typeof _=="function"?_(w):_;return v.replace?{...w,data:C}:{...w,data:{...w.data,...C}}},v)},getNodesBounds:d=>{const{nodeLookup:_,nodeOrigin:v}=t.getState();return X9(d,{nodeLookup:_,nodeOrigin:v})},getHandleConnections:({type:d,id:_,nodeId:v})=>{var w;return Array.from(((w=t.getState().connectionLookup.get(`${v}-${d}${_?`-${_}`:""}`))==null?void 0:w.values())??[])},getNodeConnections:({type:d,handleId:_,nodeId:v})=>{var w;return Array.from(((w=t.getState().connectionLookup.get(`${v}${d?_?`-${d}-${_}`:`-${d}`:""}`))==null?void 0:w.values())??[])},fitView:async d=>{const _=t.getState().fitViewResolver??nz();return t.setState({fitViewQueued:!0,fitViewOptions:d,fitViewResolver:_}),n.nodeQueue.push(v=>[...v]),_.promise}}},[]);return V.useMemo(()=>({...a,...e,viewportInitialized:r}),[r])}const bS=e=>e.selected,MH=typeof window<"u"?window:void 0;function LH({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=At(),{deleteElements:r}=Um(),a=el(e,{actInsideInputWithModifier:!1}),l=el(t,{target:MH});V.useEffect(()=>{if(a){const{edges:u,nodes:o}=n.getState();r({nodes:o.filter(bS),edges:u.filter(bS)}),n.setState({nodesSelectionActive:!1})}},[a]),V.useEffect(()=>{n.setState({multiSelectionActive:l})},[l])}function OH(e){const t=At();V.useEffect(()=>{const n=()=>{var a,l,u,o;if(!e.current||!(((l=(a=e.current).checkVisibility)==null?void 0:l.call(a))??!0))return!1;const r=Bm(e.current);(r.height===0||r.width===0)&&((o=(u=t.getState()).onError)==null||o.call(u,"004",Jn.error004())),t.setState({width:r.width||500,height:r.height||500})};if(e.current){n(),window.addEventListener("resize",n);const r=new ResizeObserver(()=>n());return r.observe(e.current),()=>{window.removeEventListener("resize",n),r&&e.current&&r.unobserve(e.current)}}},[])}const kh={position:"absolute",width:"100%",height:"100%",top:0,left:0},jH=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function BH({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:a=.5,panOnScrollMode:l=Zr.Free,zoomOnDoubleClick:u=!0,panOnDrag:o=!0,defaultViewport:c,translateExtent:f,minZoom:p,maxZoom:d,zoomActivationKeyCode:_,preventScrolling:v=!0,children:w,noWheelClassName:C,noPanClassName:y,onViewportChange:S,isControlledViewport:x,paneClickDistance:b,selectionOnDrag:k}){const D=At(),T=V.useRef(null),{userSelectionActive:R,lib:N,connectionInProgress:M}=nt(jH,Nt),B=el(_),H=V.useRef();OH(T);const Y=V.useCallback(F=>{S==null||S({x:F[0],y:F[1],zoom:F[2]}),x||D.setState({transform:F})},[S,x]);return V.useEffect(()=>{if(T.current){H.current=Hz({domNode:T.current,minZoom:p,maxZoom:d,translateExtent:f,viewport:c,onDraggingChange:G=>D.setState(X=>X.paneDragging===G?X:{paneDragging:G}),onPanZoomStart:(G,X)=>{const{onViewportChangeStart:K,onMoveStart:O}=D.getState();O==null||O(G,X),K==null||K(X)},onPanZoom:(G,X)=>{const{onViewportChange:K,onMove:O}=D.getState();O==null||O(G,X),K==null||K(X)},onPanZoomEnd:(G,X)=>{const{onViewportChangeEnd:K,onMoveEnd:O}=D.getState();O==null||O(G,X),K==null||K(X)}});const{x:F,y:z,zoom:q}=H.current.getViewport();return D.setState({panZoom:H.current,transform:[F,z,q],domNode:T.current.closest(".react-flow")}),()=>{var G;(G=H.current)==null||G.destroy()}}},[]),V.useEffect(()=>{var F;(F=H.current)==null||F.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:a,panOnScrollMode:l,zoomOnDoubleClick:u,panOnDrag:o,zoomActivationKeyPressed:B,preventScrolling:v,noPanClassName:y,userSelectionActive:R,noWheelClassName:C,lib:N,onTransformChange:Y,connectionInProgress:M,selectionOnDrag:k,paneClickDistance:b})},[e,t,n,r,a,l,u,o,B,v,y,R,C,N,Y,M,k,b]),m.jsx("div",{className:"react-flow__renderer",ref:T,style:kh,children:w})}const IH=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function zH(){const{userSelectionActive:e,userSelectionRect:t}=nt(IH,Nt);return e&&t?m.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}const kp=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},HH=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function FH({isSelecting:e,selectionKeyPressed:t,selectionMode:n=Zo.Full,panOnDrag:r,autoPanOnSelection:a,paneClickDistance:l,selectionOnDrag:u,onSelectionStart:o,onSelectionEnd:c,onPaneClick:f,onPaneContextMenu:p,onPaneScroll:d,onPaneMouseEnter:_,onPaneMouseMove:v,onPaneMouseLeave:w,children:C}){const y=V.useRef(0),S=At(),{userSelectionActive:x,elementsSelectable:b,dragging:k,panBy:D,autoPanSpeed:T}=nt(HH,Nt),R=b&&(e||x),N=V.useRef(null),M=V.useRef(),B=V.useRef(new Set),H=V.useRef(new Set),Y=V.useRef(!1),F=V.useRef(!1),z=V.useRef({x:0,y:0}),q=V.useRef(!1),G=P=>{if(F.current||Y.current||S.getState().connection.inProgress){F.current=!1,Y.current=!1;return}f==null||f(P),S.getState().resetSelectedElements(),S.setState({nodesSelectionActive:!1})},X=P=>{if(Array.isArray(r)&&(r!=null&&r.includes(2))){P.preventDefault();return}p==null||p(P)},K=d?P=>d(P):void 0,O=P=>{F.current&&(P.stopPropagation(),F.current=!1)},L=P=>{var xe,Ye;const{domNode:te,transform:ie}=S.getState();if(M.current=te==null?void 0:te.getBoundingClientRect(),!M.current)return;const pe=P.target===N.current;if(!pe&&!!P.target.closest(".nokey")||!e||!(u&&pe||t)||P.button!==0||!P.isPrimary)return;(Ye=(xe=P.target)==null?void 0:xe.setPointerCapture)==null||Ye.call(xe,P.pointerId),F.current=!1;const{x:we,y:Ce}=Zn(P.nativeEvent,M.current),Ae=pl({x:we,y:Ce},ie);S.setState({userSelectionRect:{width:0,height:0,startX:Ae.x,startY:Ae.y,x:we,y:Ce}}),pe||(P.stopPropagation(),P.preventDefault())};function j(P,te){const{userSelectionRect:ie}=S.getState();if(!ie)return;const{transform:pe,nodeLookup:he,edgeLookup:ye,connectionLookup:we,triggerNodeChanges:Ce,triggerEdgeChanges:Ae,defaultEdgeOptions:xe}=S.getState(),Ye={x:ie.startX,y:ie.startY},{x:lt,y:dt}=fa(Ye,pe),it={startX:Ye.x,startY:Ye.y,x:PJe.id)),H.current=new Set;const Ue=(xe==null?void 0:xe.selectable)??!0;for(const Je of B.current){const fe=we.get(Je);if(fe)for(const{edgeId:ee}of fe.values()){const me=ye.get(ee);me&&(me.selectable??Ue)&&H.current.add(ee)}}if(!Gb(pt,B.current)){const Je=ia(he,B.current,!0);Ce(Je)}if(!Gb(rt,H.current)){const Je=ia(ye,H.current);Ae(Je)}S.setState({userSelectionRect:it,userSelectionActive:!0,nodesSelectionActive:!1})}function $(){if(!a||!M.current)return;const[P,te]=Om(z.current,M.current,T);D({x:P,y:te}).then(ie=>{if(!F.current||!ie){y.current=requestAnimationFrame($);return}const{x:pe,y:he}=z.current;j(pe,he),y.current=requestAnimationFrame($)})}const U=()=>{cancelAnimationFrame(y.current),y.current=0,q.current=!1};V.useEffect(()=>()=>U(),[]);const Q=P=>{const{userSelectionRect:te,transform:ie,resetSelectedElements:pe}=S.getState();if(!M.current||!te)return;const{x:he,y:ye}=Zn(P.nativeEvent,M.current);z.current={x:he,y:ye};const we=fa({x:te.startX,y:te.startY},ie);if(!F.current){const Ce=t?0:l;if(Math.hypot(he-we.x,ye-we.y)<=Ce)return;pe(),o==null||o(P)}F.current=!0,q.current||($(),q.current=!0),j(he,ye)},re=P=>{var te,ie;if(!R){P.target===N.current&&S.getState().connection.inProgress&&(Y.current=!0);return}P.button===0&&((ie=(te=P.target)==null?void 0:te.releasePointerCapture)==null||ie.call(te,P.pointerId),!x&&P.target===N.current&&S.getState().userSelectionRect&&(G==null||G(P)),S.setState({userSelectionActive:!1,userSelectionRect:null}),F.current&&(c==null||c(P),S.setState({nodesSelectionActive:B.current.size>0})),U())},ae=P=>{var te,ie;(ie=(te=P.target)==null?void 0:te.releasePointerCapture)==null||ie.call(te,P.pointerId),U()},Z=r===!0||Array.isArray(r)&&r.includes(0);return m.jsxs("div",{className:Pt(["react-flow__pane",{draggable:Z,dragging:k,selection:e}]),onClick:R?void 0:kp(G,N),onContextMenu:kp(X,N),onWheel:kp(K,N),onPointerEnter:R?void 0:_,onPointerMove:R?Q:v,onPointerUp:re,onPointerCancel:R?ae:void 0,onPointerDownCapture:R?L:void 0,onClickCapture:R?O:void 0,onPointerLeave:w,ref:N,style:kh,children:[C,m.jsx(zH,{})]})}function _g({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:a,unselectNodesAndEdges:l,multiSelectionActive:u,nodeLookup:o,onError:c}=t.getState(),f=o.get(e);if(!f){c==null||c("012",Jn.error012(e));return}t.setState({nodesSelectionActive:!1}),f.selected?(n||f.selected&&u)&&(l({nodes:[f],edges:[]}),requestAnimationFrame(()=>{var p;return(p=r==null?void 0:r.current)==null?void 0:p.blur()})):a([e])}function wE({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:a,isSelectable:l,nodeClickDistance:u}){const o=At(),[c,f]=V.useState(!1),p=V.useRef();return V.useEffect(()=>{if(!t)return p.current=Ez({getStoreItems:()=>o.getState(),onNodeMouseDown:d=>{_g({id:d,store:o,nodeRef:e})},onDragStart:()=>{f(!0)},onDragStop:()=>{f(!1)}}),()=>{var d;(d=p.current)==null||d.destroy(),p.current=void 0}},[t,o,e]),V.useEffect(()=>{t||!e.current||!p.current||p.current.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:l,nodeId:a,nodeClickDistance:u})},[n,r,t,l,e,a,u]),c}const PH=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function CE(){const e=At();return V.useCallback(n=>{const{nodeExtent:r,snapToGrid:a,snapGrid:l,nodesDraggable:u,onError:o,updateNodePositions:c,nodeLookup:f,nodeOrigin:p}=e.getState(),d=new Map,_=PH(u),v=a?l[0]:5,w=a?l[1]:5,C=n.direction.x*v*n.factor,y=n.direction.y*w*n.factor;for(const[,S]of f){if(!_(S))continue;let x={x:S.internals.positionAbsolute.x+C,y:S.internals.positionAbsolute.y+y};a&&(x=dl(x,l));const{position:b,positionAbsolute:k}=$C({nodeId:S.id,nextPosition:x,nodeLookup:f,nodeExtent:r,nodeOrigin:p,onError:o});S.position=b,S.internals.positionAbsolute=k,d.set(S.id,S)}c(d)},[])}const $m=V.createContext(null),UH=$m.Provider;$m.Consumer;const EE=()=>V.useContext($m),$H=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),kE=V.createContext(null);function GH({children:e}){const t=nt($H,Nt);return m.jsx(kE.Provider,{value:t,children:e})}function qH(){const e=V.useContext(kE);if(!e)throw new Error("useHandleConfig must be used within a HandleConfigProvider");return e}const VH={connectingFrom:!1,connectingTo:!1,clickConnecting:!1,isPossibleEndHandle:!0,connectionInProcess:!1,clickConnectionInProcess:!1,valid:!1},YH=(e,t,n)=>r=>{const{connectionClickStartHandle:a,connectionMode:l,connection:u}=r,{fromHandle:o,toHandle:c,isValid:f}=u;if(!o&&!a)return VH;const p=(c==null?void 0:c.nodeId)===e&&(c==null?void 0:c.id)===t&&(c==null?void 0:c.type)===n;return{connectingFrom:(o==null?void 0:o.nodeId)===e&&(o==null?void 0:o.id)===t&&(o==null?void 0:o.type)===n,connectingTo:p,clickConnecting:(a==null?void 0:a.nodeId)===e&&(a==null?void 0:a.id)===t&&(a==null?void 0:a.type)===n,isPossibleEndHandle:l===ua.Strict?(o==null?void 0:o.type)!==n:e!==(o==null?void 0:o.nodeId)||t!==(o==null?void 0:o.id),connectionInProcess:!!o,clickConnectionInProcess:!!a,valid:p&&f}};function WH({type:e="source",position:t=Re.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:a=!0,isConnectableEnd:l=!0,id:u,onConnect:o,children:c,className:f,onMouseDown:p,onTouchStart:d,..._},v){var q,G;const w=u||null,C=e==="target",y=At(),S=EE(),{connectOnClick:x,noPanClassName:b,rfId:k}=qH(),{connectingFrom:D,connectingTo:T,clickConnecting:R,isPossibleEndHandle:N,connectionInProcess:M,clickConnectionInProcess:B,valid:H}=nt(YH(S,w,e),Nt);S||(G=(q=y.getState()).onError)==null||G.call(q,"010",Jn.error010());const Y=X=>{const{defaultEdgeOptions:K,onConnect:O,hasDefaultEdges:L}=y.getState(),j={...K,...X};if(L){const{edges:$,setEdges:U,onError:Q}=y.getState();U(kH(j,$,{onError:Q}))}O==null||O(j),o==null||o(j)},F=X=>{if(!S)return;const K=QC(X.nativeEvent);if(a&&(K&&X.button===0||!K)){const O=y.getState();mg.onPointerDown(X.nativeEvent,{handleDomNode:X.currentTarget,autoPanOnConnect:O.autoPanOnConnect,connectionMode:O.connectionMode,connectionRadius:O.connectionRadius,domNode:O.domNode,nodeLookup:O.nodeLookup,lib:O.lib,isTarget:C,handleId:w,nodeId:S,flowId:O.rfId,panBy:O.panBy,cancelConnection:O.cancelConnection,onConnectStart:O.onConnectStart,onConnectEnd:(...L)=>{var j,$;return($=(j=y.getState()).onConnectEnd)==null?void 0:$.call(j,...L)},updateConnection:O.updateConnection,onConnect:Y,isValidConnection:n||((...L)=>{var j,$;return(($=(j=y.getState()).isValidConnection)==null?void 0:$.call(j,...L))??!0}),getTransform:()=>y.getState().transform,getFromHandle:()=>y.getState().connection.fromHandle,autoPanSpeed:O.autoPanSpeed,dragThreshold:O.connectionDragThreshold})}K?p==null||p(X):d==null||d(X)},z=X=>{const{onClickConnectStart:K,onClickConnectEnd:O,connectionClickStartHandle:L,connectionMode:j,isValidConnection:$,lib:U,rfId:Q,nodeLookup:re,connection:ae}=y.getState();if(!S||!L&&!a)return;if(!L){K==null||K(X.nativeEvent,{nodeId:S,handleId:w,handleType:e}),y.setState({connectionClickStartHandle:{nodeId:S,type:e,id:w}});return}const Z=KC(X.target),P=n||$,{connection:te,isValid:ie}=mg.isValid(X.nativeEvent,{handle:{nodeId:S,id:w,type:e},connectionMode:j,fromNodeId:L.nodeId,fromHandleId:L.id||null,fromType:L.type,isValidConnection:P,flowId:Q,doc:Z,lib:U,nodeLookup:re});ie&&te&&Y(te);const pe=structuredClone(ae);delete pe.inProgress,pe.toPosition=pe.toHandle?pe.toHandle.position:null,O==null||O(X,pe),y.setState({connectionClickStartHandle:null})};return m.jsx("div",{"data-handleid":w,"data-nodeid":S,"data-handlepos":t,"data-id":`${k}-${S}-${w}-${e}`,className:Pt(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",b,f,{source:!C,target:C,connectable:r,connectablestart:a,connectableend:l,clickconnecting:R,connectingfrom:D,connectingto:T,valid:H,connectionindicator:r&&(!M||N)&&(M||B?l:a)}]),onMouseDown:F,onTouchStart:F,onClick:x?z:void 0,ref:v,..._,children:c})}const pa=V.memo(bE(WH));function XH({data:e,isConnectable:t,sourcePosition:n=Re.Bottom}){return m.jsxs(m.Fragment,{children:[e==null?void 0:e.label,m.jsx(pa,{type:"source",position:n,isConnectable:t})]})}function KH({data:e,isConnectable:t,targetPosition:n=Re.Top,sourcePosition:r=Re.Bottom}){return m.jsxs(m.Fragment,{children:[m.jsx(pa,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,m.jsx(pa,{type:"source",position:r,isConnectable:t})]})}function ZH(){return null}function QH({data:e,isConnectable:t,targetPosition:n=Re.Top}){return m.jsxs(m.Fragment,{children:[m.jsx(pa,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]})}const zu={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},SS={input:XH,default:KH,output:QH,group:ZH};function JH(e){var t,n,r,a;return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??((t=e.style)==null?void 0:t.width),height:e.height??e.initialHeight??((n=e.style)==null?void 0:n.height)}:{width:e.width??((r=e.style)==null?void 0:r.width),height:e.height??((a=e.style)==null?void 0:a.height)}}const eF=e=>{const{width:t,height:n,x:r,y:a}=fl(e.nodeLookup,{filter:l=>!!l.selected});return{width:Kn(t)?t:null,height:Kn(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${a}px)`}};function tF({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=At(),{width:a,height:l,transformString:u,userSelectionActive:o}=nt(eF,Nt),c=CE(),f=V.useRef(null);V.useEffect(()=>{var v;n||(v=f.current)==null||v.focus({preventScroll:!0})},[n]);const p=!o&&a!==null&&l!==null;if(wE({nodeRef:f,disabled:!p}),!p)return null;const d=e?v=>{const w=r.getState().nodes.filter(C=>C.selected);e(v,w)}:void 0,_=v=>{Object.prototype.hasOwnProperty.call(zu,v.key)&&(v.preventDefault(),c({direction:zu[v.key],factor:v.shiftKey?4:1}))};return m.jsx("div",{className:Pt(["react-flow__nodesselection","react-flow__container",t]),style:{transform:u},children:m.jsx("div",{ref:f,className:"react-flow__nodesselection-rect",onContextMenu:d,tabIndex:n?void 0:-1,onKeyDown:n?void 0:_,style:{width:a,height:l}})})}const xS=typeof window<"u"?window:void 0,nF=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function AE({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:a,onPaneContextMenu:l,onPaneScroll:u,paneClickDistance:o,deleteKeyCode:c,selectionKeyCode:f,selectionOnDrag:p,selectionMode:d,onSelectionStart:_,onSelectionEnd:v,multiSelectionKeyCode:w,panActivationKeyCode:C,zoomActivationKeyCode:y,elementsSelectable:S,zoomOnScroll:x,zoomOnPinch:b,panOnScroll:k,panOnScrollSpeed:D,panOnScrollMode:T,zoomOnDoubleClick:R,panOnDrag:N,autoPanOnSelection:M,defaultViewport:B,translateExtent:H,minZoom:Y,maxZoom:F,preventScrolling:z,onSelectionContextMenu:q,noWheelClassName:G,noPanClassName:X,disableKeyboardA11y:K,onViewportChange:O,isControlledViewport:L}){const{nodesSelectionActive:j,userSelectionActive:$}=nt(nF,Nt),U=el(f,{target:xS}),Q=el(C,{target:xS}),re=Q||N,ae=Q||k,Z=p&&re!==!0,P=U||$||Z;return LH({deleteKeyCode:c,multiSelectionKeyCode:w}),m.jsx(BH,{onPaneContextMenu:l,elementsSelectable:S,zoomOnScroll:x,zoomOnPinch:b,panOnScroll:ae,panOnScrollSpeed:D,panOnScrollMode:T,zoomOnDoubleClick:R,panOnDrag:!U&&re,defaultViewport:B,translateExtent:H,minZoom:Y,maxZoom:F,zoomActivationKeyCode:y,preventScrolling:z,noWheelClassName:G,noPanClassName:X,onViewportChange:O,isControlledViewport:L,paneClickDistance:o,selectionOnDrag:Z,children:m.jsxs(FH,{onSelectionStart:_,onSelectionEnd:v,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:a,onPaneContextMenu:l,onPaneScroll:u,panOnDrag:re,autoPanOnSelection:M,isSelecting:!!P,selectionMode:d,selectionKeyPressed:U,paneClickDistance:o,selectionOnDrag:Z,children:[e,j&&m.jsx(tF,{onSelectionContextMenu:q,noPanClassName:X,disableKeyboardA11y:K})]})})}AE.displayName="FlowRenderer";const iF=V.memo(AE),rF=e=>t=>e?Lm(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(n=>n.id):Array.from(t.nodeLookup.keys());function sF(e){return nt(V.useCallback(rF(e),[e]),Nt)}const aF=e=>e.updateNodeInternals;function oF(){const e=nt(aF),[t]=V.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const r=new Map;n.forEach(a=>{const l=a.target.getAttribute("data-id");r.set(l,{id:l,nodeElement:a.target,force:!0})}),e(r)}));return V.useEffect(()=>()=>{t==null||t.disconnect()},[t]),t}function lF({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){const a=At(),l=V.useRef(null),u=V.useRef(null),o=V.useRef(e.sourcePosition),c=V.useRef(e.targetPosition),f=V.useRef(t),p=n&&!!e.internals.handleBounds;return V.useEffect(()=>{l.current&&!e.hidden&&(!p||u.current!==l.current)&&(u.current&&(r==null||r.unobserve(u.current)),r==null||r.observe(l.current),u.current=l.current)},[p,e.hidden]),V.useEffect(()=>()=>{u.current&&(r==null||r.unobserve(u.current),u.current=null)},[]),V.useEffect(()=>{if(l.current){const d=f.current!==t,_=o.current!==e.sourcePosition,v=c.current!==e.targetPosition;(d||_||v)&&(f.current=t,o.current=e.sourcePosition,c.current=e.targetPosition,a.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:l.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),l}function cF({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:a,onContextMenu:l,onDoubleClick:u,nodesDraggable:o,elementsSelectable:c,nodesConnectable:f,nodesFocusable:p,resizeObserver:d,noDragClassName:_,noPanClassName:v,disableKeyboardA11y:w,rfId:C,nodeTypes:y,nodeClickDistance:S,onError:x}){const{node:b,internals:k,isParent:D}=nt(P=>{const te=P.nodeLookup.get(e),ie=P.parentLookup.has(e);return{node:te,internals:te.internals,isParent:ie}},Nt);let T=b.type||"default",R=(y==null?void 0:y[T])||SS[T];R===void 0&&(x==null||x("003",Jn.error003(T)),T="default",R=(y==null?void 0:y.default)||SS.default);const N=!!(b.draggable||o&&typeof b.draggable>"u"),M=!!(b.selectable||c&&typeof b.selectable>"u"),B=!!(b.connectable||f&&typeof b.connectable>"u"),H=!!(b.focusable||p&&typeof b.focusable>"u"),Y=At(),F=WC(b),z=lF({node:b,nodeType:T,hasDimensions:F,resizeObserver:d}),q=wE({nodeRef:z,disabled:b.hidden||!N,noDragClassName:_,handleSelector:b.dragHandle,nodeId:e,isSelectable:M,nodeClickDistance:S}),G=CE();if(b.hidden)return null;const X=di(b),K=JH(b),O=M||N||t||n||r||a,L=n?P=>n(P,{...k.userNode}):void 0,j=r?P=>r(P,{...k.userNode}):void 0,$=a?P=>a(P,{...k.userNode}):void 0,U=l?P=>l(P,{...k.userNode}):void 0,Q=u?P=>u(P,{...k.userNode}):void 0,re=P=>{const{selectNodesOnDrag:te,nodeDragThreshold:ie}=Y.getState();M&&(!te||!N||ie>0)&&_g({id:e,store:Y,nodeRef:z}),t&&t(P,{...k.userNode})},ae=P=>{if(!(ZC(P.nativeEvent)||w)){if(zC.includes(P.key)&&M){const te=P.key==="Escape";_g({id:e,store:Y,unselect:te,nodeRef:z})}else if(N&&b.selected&&Object.prototype.hasOwnProperty.call(zu,P.key)){P.preventDefault();const{ariaLabelConfig:te}=Y.getState();Y.setState({ariaLiveMessage:te["node.a11yDescription.ariaLiveMessage"]({direction:P.key.replace("Arrow","").toLowerCase(),x:~~k.positionAbsolute.x,y:~~k.positionAbsolute.y})}),G({direction:zu[P.key],factor:P.shiftKey?4:1})}}},Z=()=>{var we;if(w||!((we=z.current)!=null&&we.matches(":focus-visible")))return;const{transform:P,width:te,height:ie,autoPanOnNodeFocus:pe,setCenter:he}=Y.getState();if(!pe)return;Lm(new Map([[e,b]]),{x:0,y:0,width:te,height:ie},P,!0).length>0||he(b.position.x+X.width/2,b.position.y+X.height/2,{zoom:P[2]})};return m.jsx("div",{className:Pt(["react-flow__node",`react-flow__node-${T}`,{[v]:N},b.className,{selected:b.selected,selectable:M,parent:D,draggable:N,dragging:q}]),ref:z,style:{zIndex:k.z,transform:`translate(${k.positionAbsolute.x}px,${k.positionAbsolute.y}px)`,pointerEvents:O?"all":"none",visibility:F?"visible":"hidden",...b.style,...K},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:L,onMouseMove:j,onMouseLeave:$,onContextMenu:U,onClick:re,onDoubleClick:Q,onKeyDown:H?ae:void 0,tabIndex:H?0:void 0,onFocus:H?Z:void 0,role:b.ariaRole??(H?"group":void 0),"aria-roledescription":"node","aria-describedby":w?void 0:`${mE}-${C}`,"aria-label":b.ariaLabel,...b.domAttributes,children:m.jsx(UH,{value:e,children:m.jsx(R,{id:e,data:b.data,type:T,positionAbsoluteX:k.positionAbsolute.x,positionAbsoluteY:k.positionAbsolute.y,selected:b.selected??!1,selectable:M,draggable:N,deletable:b.deletable??!0,isConnectable:B,sourcePosition:b.sourcePosition,targetPosition:b.targetPosition,dragging:q,dragHandle:b.dragHandle,zIndex:k.z,parentId:b.parentId,...X})})})}var uF=V.memo(cF);const hF=e=>({nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function TE(e){const{nodesConnectable:t,nodesFocusable:n,elementsSelectable:r,onError:a}=nt(hF,Nt),l=sF(e.onlyRenderVisibleElements),u=oF();return m.jsx("div",{className:"react-flow__nodes",style:kh,children:l.map(o=>m.jsx(uF,{id:o,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:u,nodesDraggable:e.nodesDraggable??!0,nodesConnectable:t,nodesFocusable:n,elementsSelectable:r,nodeClickDistance:e.nodeClickDistance,onError:a},o))})}TE.displayName="NodeRenderer";const fF=V.memo(TE);function dF(e){return nt(V.useCallback(n=>{if(!e)return n.edges.map(a=>a.id);const r=[];if(n.width&&n.height)for(const a of n.edges){const l=n.nodeLookup.get(a.source),u=n.nodeLookup.get(a.target);l&&u&&az({sourceNode:l,targetNode:u,width:n.width,height:n.height,transform:n.transform})&&r.push(a.id)}return r},[e]),Nt)}const pF=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e}};return m.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},gF=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e,fill:e}};return m.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},wS={[ju.Arrow]:pF,[ju.ArrowClosed]:gF};function mF(e){const t=At();return V.useMemo(()=>{var a,l;return Object.prototype.hasOwnProperty.call(wS,e)?wS[e]:((l=(a=t.getState()).onError)==null||l.call(a,"009",Jn.error009(e)),null)},[e])}const _F=({id:e,type:t,color:n,width:r=12.5,height:a=12.5,markerUnits:l="strokeWidth",strokeWidth:u,orient:o="auto-start-reverse"})=>{const c=mF(t);return c?m.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${a}`,viewBox:"-10 -10 20 20",markerUnits:l,orient:o,refX:"0",refY:"0",children:m.jsx(c,{color:n,strokeWidth:u})}):null},NE=({defaultColor:e,rfId:t})=>{const n=nt(l=>l.edges),r=nt(l=>l.defaultEdgeOptions),a=V.useMemo(()=>pz(n,{id:t,defaultColor:e,defaultMarkerStart:r==null?void 0:r.markerStart,defaultMarkerEnd:r==null?void 0:r.markerEnd}),[n,r,t,e]);return a.length?m.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:m.jsx("defs",{children:a.map(l=>m.jsx(_F,{id:l.id,type:l.type,color:l.color,width:l.width,height:l.height,markerUnits:l.markerUnits,strokeWidth:l.strokeWidth,orient:l.orient},l.id))})}):null};NE.displayName="MarkerDefinitions";var vF=V.memo(NE);function DE({x:e,y:t,label:n,labelStyle:r,labelShowBg:a=!0,labelBgStyle:l,labelBgPadding:u=[2,4],labelBgBorderRadius:o=2,children:c,className:f,...p}){const[d,_]=V.useState({x:1,y:0,width:0,height:0}),v=Pt(["react-flow__edge-textwrapper",f]),w=V.useRef(null);return V.useEffect(()=>{if(w.current){const C=w.current.getBBox();_({x:C.x,y:C.y,width:C.width,height:C.height})}},[n]),n?m.jsxs("g",{transform:`translate(${e-d.width/2} ${t-d.height/2})`,className:v,visibility:d.width?"visible":"hidden",...p,children:[a&&m.jsx("rect",{width:d.width+2*u[0],x:-u[0],y:-u[1],height:d.height+2*u[1],className:"react-flow__edge-textbg",style:l,rx:o,ry:o}),m.jsx("text",{className:"react-flow__edge-text",y:d.height/2,dy:"0.3em",ref:w,style:r,children:n}),c]}):null}DE.displayName="EdgeText";const yF=V.memo(DE);function Ah({path:e,labelX:t,labelY:n,label:r,labelStyle:a,labelShowBg:l,labelBgStyle:u,labelBgPadding:o,labelBgBorderRadius:c,interactionWidth:f=20,...p}){return m.jsxs(m.Fragment,{children:[m.jsx("path",{...p,d:e,fill:"none",className:Pt(["react-flow__edge-path",p.className])}),f?m.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:f,className:"react-flow__edge-interaction"}):null,r&&Kn(t)&&Kn(n)?m.jsx(yF,{x:t,y:n,label:r,labelStyle:a,labelShowBg:l,labelBgStyle:u,labelBgPadding:o,labelBgBorderRadius:c}):null]})}function CS({pos:e,x1:t,y1:n,x2:r,y2:a}){return e===Re.Left||e===Re.Right?[.5*(t+r),n]:[t,.5*(n+a)]}function RE({sourceX:e,sourceY:t,sourcePosition:n=Re.Bottom,targetX:r,targetY:a,targetPosition:l=Re.Top}){const[u,o]=CS({pos:n,x1:e,y1:t,x2:r,y2:a}),[c,f]=CS({pos:l,x1:r,y1:a,x2:e,y2:t}),[p,d,_,v]=JC({sourceX:e,sourceY:t,targetX:r,targetY:a,sourceControlX:u,sourceControlY:o,targetControlX:c,targetControlY:f});return[`M${e},${t} C${u},${o} ${c},${f} ${r},${a}`,p,d,_,v]}function ME(e){return V.memo(({id:t,sourceX:n,sourceY:r,targetX:a,targetY:l,sourcePosition:u,targetPosition:o,label:c,labelStyle:f,labelShowBg:p,labelBgStyle:d,labelBgPadding:_,labelBgBorderRadius:v,style:w,markerEnd:C,markerStart:y,interactionWidth:S})=>{const[x,b,k]=RE({sourceX:n,sourceY:r,sourcePosition:u,targetX:a,targetY:l,targetPosition:o}),D=e.isInternal?void 0:t;return m.jsx(Ah,{id:D,path:x,labelX:b,labelY:k,label:c,labelStyle:f,labelShowBg:p,labelBgStyle:d,labelBgPadding:_,labelBgBorderRadius:v,style:w,markerEnd:C,markerStart:y,interactionWidth:S})})}const bF=ME({isInternal:!1}),LE=ME({isInternal:!0});bF.displayName="SimpleBezierEdge";LE.displayName="SimpleBezierEdgeInternal";function OE(e){return V.memo(({id:t,sourceX:n,sourceY:r,targetX:a,targetY:l,label:u,labelStyle:o,labelShowBg:c,labelBgStyle:f,labelBgPadding:p,labelBgBorderRadius:d,style:_,sourcePosition:v=Re.Bottom,targetPosition:w=Re.Top,markerEnd:C,markerStart:y,pathOptions:S,interactionWidth:x})=>{const[b,k,D]=dg({sourceX:n,sourceY:r,sourcePosition:v,targetX:a,targetY:l,targetPosition:w,borderRadius:S==null?void 0:S.borderRadius,offset:S==null?void 0:S.offset,stepPosition:S==null?void 0:S.stepPosition}),T=e.isInternal?void 0:t;return m.jsx(Ah,{id:T,path:b,labelX:k,labelY:D,label:u,labelStyle:o,labelShowBg:c,labelBgStyle:f,labelBgPadding:p,labelBgBorderRadius:d,style:_,markerEnd:C,markerStart:y,interactionWidth:x})})}const jE=OE({isInternal:!1}),BE=OE({isInternal:!0});jE.displayName="SmoothStepEdge";BE.displayName="SmoothStepEdgeInternal";function IE(e){return V.memo(({id:t,...n})=>{var a;const r=e.isInternal?void 0:t;return m.jsx(jE,{...n,id:r,pathOptions:V.useMemo(()=>{var l;return{borderRadius:0,offset:(l=n.pathOptions)==null?void 0:l.offset}},[(a=n.pathOptions)==null?void 0:a.offset])})})}const SF=IE({isInternal:!1}),zE=IE({isInternal:!0});SF.displayName="StepEdge";zE.displayName="StepEdgeInternal";function HE(e){return V.memo(({id:t,sourceX:n,sourceY:r,targetX:a,targetY:l,label:u,labelStyle:o,labelShowBg:c,labelBgStyle:f,labelBgPadding:p,labelBgBorderRadius:d,style:_,markerEnd:v,markerStart:w,interactionWidth:C})=>{const[y,S,x]=nE({sourceX:n,sourceY:r,targetX:a,targetY:l}),b=e.isInternal?void 0:t;return m.jsx(Ah,{id:b,path:y,labelX:S,labelY:x,label:u,labelStyle:o,labelShowBg:c,labelBgStyle:f,labelBgPadding:p,labelBgBorderRadius:d,style:_,markerEnd:v,markerStart:w,interactionWidth:C})})}const xF=HE({isInternal:!1}),FE=HE({isInternal:!0});xF.displayName="StraightEdge";FE.displayName="StraightEdgeInternal";function PE(e){return V.memo(({id:t,sourceX:n,sourceY:r,targetX:a,targetY:l,sourcePosition:u=Re.Bottom,targetPosition:o=Re.Top,label:c,labelStyle:f,labelShowBg:p,labelBgStyle:d,labelBgPadding:_,labelBgBorderRadius:v,style:w,markerEnd:C,markerStart:y,pathOptions:S,interactionWidth:x})=>{const[b,k,D]=eE({sourceX:n,sourceY:r,sourcePosition:u,targetX:a,targetY:l,targetPosition:o,curvature:S==null?void 0:S.curvature}),T=e.isInternal?void 0:t;return m.jsx(Ah,{id:T,path:b,labelX:k,labelY:D,label:c,labelStyle:f,labelShowBg:p,labelBgStyle:d,labelBgPadding:_,labelBgBorderRadius:v,style:w,markerEnd:C,markerStart:y,interactionWidth:x})})}const wF=PE({isInternal:!1}),UE=PE({isInternal:!0});wF.displayName="BezierEdge";UE.displayName="BezierEdgeInternal";const ES={default:UE,straight:FE,step:zE,smoothstep:BE,simplebezier:LE},kS={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null,zIndex:void 0},CF=(e,t,n)=>n===Re.Left?e-t:n===Re.Right?e+t:e,EF=(e,t,n)=>n===Re.Top?e-t:n===Re.Bottom?e+t:e,AS="react-flow__edgeupdater";function TS({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:a,onMouseEnter:l,onMouseOut:u,type:o}){return m.jsx("circle",{onMouseDown:a,onMouseEnter:l,onMouseOut:u,className:Pt([AS,`${AS}-${o}`]),cx:CF(t,r,e),cy:EF(n,r,e),r,stroke:"transparent",fill:"transparent"})}function kF({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:a,targetX:l,targetY:u,sourcePosition:o,targetPosition:c,onReconnect:f,onReconnectStart:p,onReconnectEnd:d,setReconnecting:_,setUpdateHover:v}){const w=At(),C=(k,D)=>{if(k.button!==0)return;const{autoPanOnConnect:T,domNode:R,connectionMode:N,connectionRadius:M,lib:B,onConnectStart:H,cancelConnection:Y,nodeLookup:F,rfId:z,panBy:q,updateConnection:G}=w.getState(),X=D.type==="target",K=(j,$)=>{_(!1),d==null||d(j,n,D.type,$)},O=j=>f==null?void 0:f(n,j),L=(j,$)=>{_(!0),p==null||p(k,n,D.type),H==null||H(j,$)};mg.onPointerDown(k.nativeEvent,{autoPanOnConnect:T,connectionMode:N,connectionRadius:M,domNode:R,handleId:D.id,nodeId:D.nodeId,nodeLookup:F,isTarget:X,edgeUpdaterType:D.type,lib:B,flowId:z,cancelConnection:Y,panBy:q,isValidConnection:(...j)=>{var $,U;return((U=($=w.getState()).isValidConnection)==null?void 0:U.call($,...j))??!0},onConnect:O,onConnectStart:L,onConnectEnd:(...j)=>{var $,U;return(U=($=w.getState()).onConnectEnd)==null?void 0:U.call($,...j)},onReconnectEnd:K,updateConnection:G,getTransform:()=>w.getState().transform,getFromHandle:()=>w.getState().connection.fromHandle,dragThreshold:w.getState().connectionDragThreshold,handleDomNode:k.currentTarget})},y=k=>C(k,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),S=k=>C(k,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),x=()=>v(!0),b=()=>v(!1);return m.jsxs(m.Fragment,{children:[(e===!0||e==="source")&&m.jsx(TS,{position:o,centerX:r,centerY:a,radius:t,onMouseDown:y,onMouseEnter:x,onMouseOut:b,type:"source"}),(e===!0||e==="target")&&m.jsx(TS,{position:c,centerX:l,centerY:u,radius:t,onMouseDown:S,onMouseEnter:x,onMouseOut:b,type:"target"})]})}function AF({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:a,onDoubleClick:l,onContextMenu:u,onMouseEnter:o,onMouseMove:c,onMouseLeave:f,reconnectRadius:p,onReconnect:d,onReconnectStart:_,onReconnectEnd:v,rfId:w,edgeTypes:C,noPanClassName:y,onError:S,disableKeyboardA11y:x}){let b=nt(he=>he.edgeLookup.get(e));const k=nt(he=>he.defaultEdgeOptions);b=k?{...k,...b}:b;let D=b.type||"default",T=(C==null?void 0:C[D])||ES[D];T===void 0&&(S==null||S("011",Jn.error011(D)),D="default",T=(C==null?void 0:C.default)||ES.default);const R=!!(b.focusable||t&&typeof b.focusable>"u"),N=typeof d<"u"&&(b.reconnectable||n&&typeof b.reconnectable>"u"),M=!!(b.selectable||r&&typeof b.selectable>"u"),B=V.useRef(null),[H,Y]=V.useState(!1),[F,z]=V.useState(!1),q=At(),{zIndex:G=b.zIndex,sourceX:X,sourceY:K,targetX:O,targetY:L,sourcePosition:j,targetPosition:$}=nt(V.useCallback(he=>{const ye=he.nodeLookup.get(b.source),we=he.nodeLookup.get(b.target);if(!ye||!we)return kS;const Ce=dz({id:e,sourceNode:ye,targetNode:we,sourceHandle:b.sourceHandle||null,targetHandle:b.targetHandle||null,connectionMode:he.connectionMode,onError:S}),Ae=sz({selected:b.selected,zIndex:b.zIndex,sourceNode:ye,targetNode:we,elevateOnSelect:he.elevateEdgesOnSelect,zIndexMode:he.zIndexMode});return{...Ce||kS,zIndex:Ae}},[b.source,b.target,b.sourceHandle,b.targetHandle,b.selected,b.zIndex]),Nt),U=V.useMemo(()=>b.markerStart?`url('#${pg(b.markerStart,w)}')`:void 0,[b.markerStart,w]),Q=V.useMemo(()=>b.markerEnd?`url('#${pg(b.markerEnd,w)}')`:void 0,[b.markerEnd,w]);if(b.hidden||X===null||K===null||O===null||L===null)return null;const re=he=>{var Ae;const{addSelectedEdges:ye,unselectNodesAndEdges:we,multiSelectionActive:Ce}=q.getState();M&&(q.setState({nodesSelectionActive:!1}),b.selected&&Ce?(we({nodes:[],edges:[b]}),(Ae=B.current)==null||Ae.blur()):ye([e])),a&&a(he,b)},ae=l?he=>{l(he,{...b})}:void 0,Z=u?he=>{u(he,{...b})}:void 0,P=o?he=>{o(he,{...b})}:void 0,te=c?he=>{c(he,{...b})}:void 0,ie=f?he=>{f(he,{...b})}:void 0,pe=he=>{var ye;if(!x&&zC.includes(he.key)&&M){const{unselectNodesAndEdges:we,addSelectedEdges:Ce}=q.getState();he.key==="Escape"?((ye=B.current)==null||ye.blur(),we({edges:[b]})):Ce([e])}};return m.jsx("svg",{style:{zIndex:G},children:m.jsxs("g",{className:Pt(["react-flow__edge",`react-flow__edge-${D}`,b.className,y,{selected:b.selected,animated:b.animated,inactive:!M&&!a,updating:H,selectable:M}]),onClick:re,onDoubleClick:ae,onContextMenu:Z,onMouseEnter:P,onMouseMove:te,onMouseLeave:ie,onKeyDown:R?pe:void 0,tabIndex:R?0:void 0,role:b.ariaRole??(R?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":b.ariaLabel===null?void 0:b.ariaLabel||`Edge from ${b.source} to ${b.target}`,"aria-describedby":R?`${_E}-${w}`:void 0,ref:B,...b.domAttributes,children:[!F&&m.jsx(T,{id:e,source:b.source,target:b.target,type:b.type,selected:b.selected,animated:b.animated,selectable:M,deletable:b.deletable??!0,label:b.label,labelStyle:b.labelStyle,labelShowBg:b.labelShowBg,labelBgStyle:b.labelBgStyle,labelBgPadding:b.labelBgPadding,labelBgBorderRadius:b.labelBgBorderRadius,sourceX:X,sourceY:K,targetX:O,targetY:L,sourcePosition:j,targetPosition:$,data:b.data,style:b.style,sourceHandleId:b.sourceHandle,targetHandleId:b.targetHandle,markerStart:U,markerEnd:Q,pathOptions:"pathOptions"in b?b.pathOptions:void 0,interactionWidth:b.interactionWidth}),N&&m.jsx(kF,{edge:b,isReconnectable:N,reconnectRadius:p,onReconnect:d,onReconnectStart:_,onReconnectEnd:v,sourceX:X,sourceY:K,targetX:O,targetY:L,sourcePosition:j,targetPosition:$,setUpdateHover:Y,setReconnecting:z})]})})}var TF=V.memo(AF);const NF=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function $E({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:a,onReconnect:l,onEdgeContextMenu:u,onEdgeMouseEnter:o,onEdgeMouseMove:c,onEdgeMouseLeave:f,onEdgeClick:p,reconnectRadius:d,onEdgeDoubleClick:_,onReconnectStart:v,onReconnectEnd:w,disableKeyboardA11y:C}){const{edgesFocusable:y,edgesReconnectable:S,elementsSelectable:x,onError:b}=nt(NF,Nt),k=dF(t);return m.jsxs("div",{className:"react-flow__edges",children:[m.jsx(vF,{defaultColor:e,rfId:n}),k.map(D=>m.jsx(TF,{id:D,edgesFocusable:y,edgesReconnectable:S,elementsSelectable:x,noPanClassName:a,onReconnect:l,onContextMenu:u,onMouseEnter:o,onMouseMove:c,onMouseLeave:f,onClick:p,reconnectRadius:d,onDoubleClick:_,onReconnectStart:v,onReconnectEnd:w,rfId:n,onError:b,edgeTypes:r,disableKeyboardA11y:C},D))]})}$E.displayName="EdgeRenderer";const DF=V.memo($E),NS=e=>`translate(${e[0]}px,${e[1]}px) scale(${e[2]})`;function RF({children:e}){const t=At(),n=V.useRef(null),[r]=V.useState(()=>t.getState().transform);return SE(()=>{let a=null;const l=()=>{const u=t.getState().transform;a&&u[0]===a[0]&&u[1]===a[1]&&u[2]===a[2]||(a=u,n.current&&(n.current.style.transform=NS(u)))};return l(),t.subscribe(l)},[t]),m.jsx("div",{ref:n,className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:NS(r)},children:e})}function MF(e){const t=Um(),n=V.useRef(!1);V.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const LF=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function OF(e){const t=nt(LF),n=At();return V.useEffect(()=>{e&&(t==null||t(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function jF(e){return e.connection.inProgress?{...e.connection,to:pl(e.connection.to,e.transform)}:{...e.connection}}function BF(e){return jF}function IF(e){const t=BF();return nt(t,Nt)}const zF=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function HF({containerStyle:e,style:t,type:n,component:r}){const{nodesConnectable:a,width:l,height:u,isValid:o,inProgress:c}=nt(zF,Nt);return!(l&&a&&c)?null:m.jsx("svg",{style:e,width:l,height:u,className:"react-flow__connectionline react-flow__container",children:m.jsx("g",{className:Pt(["react-flow__connection",PC(o)]),children:m.jsx(GE,{style:t,type:n,CustomComponent:r,isValid:o})})})}const GE=({style:e,type:t=yr.Bezier,CustomComponent:n,isValid:r})=>{const{inProgress:a,from:l,fromNode:u,fromHandle:o,fromPosition:c,to:f,toNode:p,toHandle:d,toPosition:_,pointer:v}=IF();if(!a)return;if(n)return m.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:u,fromHandle:o,fromX:l.x,fromY:l.y,toX:f.x,toY:f.y,fromPosition:c,toPosition:_,connectionStatus:PC(r),toNode:p,toHandle:d,pointer:v});let w="";const C={sourceX:l.x,sourceY:l.y,sourcePosition:c,targetX:f.x,targetY:f.y,targetPosition:_};switch(t){case yr.Bezier:[w]=eE(C);break;case yr.SimpleBezier:[w]=RE(C);break;case yr.Step:[w]=dg({...C,borderRadius:0});break;case yr.SmoothStep:[w]=dg(C);break;default:[w]=nE(C)}return m.jsx("path",{d:w,fill:"none",className:"react-flow__connection-path",style:e})};GE.displayName="ConnectionLine";const FF={};function DS(e=FF){V.useRef(e),At(),V.useEffect(()=>{},[e])}function PF(){At(),V.useRef(!1),V.useEffect(()=>{},[])}function qE({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:a,onNodeDoubleClick:l,onEdgeDoubleClick:u,onNodeMouseEnter:o,onNodeMouseMove:c,onNodeMouseLeave:f,onNodeContextMenu:p,onSelectionContextMenu:d,onSelectionStart:_,onSelectionEnd:v,connectionLineType:w,connectionLineStyle:C,connectionLineComponent:y,connectionLineContainerStyle:S,selectionKeyCode:x,selectionOnDrag:b,selectionMode:k,multiSelectionKeyCode:D,panActivationKeyCode:T,zoomActivationKeyCode:R,deleteKeyCode:N,onlyRenderVisibleElements:M,elementsSelectable:B,defaultViewport:H,translateExtent:Y,minZoom:F,maxZoom:z,preventScrolling:q,defaultMarkerColor:G,zoomOnScroll:X,zoomOnPinch:K,panOnScroll:O,panOnScrollSpeed:L,panOnScrollMode:j,zoomOnDoubleClick:$,panOnDrag:U,autoPanOnSelection:Q,onPaneClick:re,onPaneMouseEnter:ae,onPaneMouseMove:Z,onPaneMouseLeave:P,onPaneScroll:te,onPaneContextMenu:ie,paneClickDistance:pe,nodeClickDistance:he,onEdgeContextMenu:ye,onEdgeMouseEnter:we,onEdgeMouseMove:Ce,onEdgeMouseLeave:Ae,reconnectRadius:xe,onReconnect:Ye,onReconnectStart:lt,onReconnectEnd:dt,noDragClassName:it,noWheelClassName:pt,noPanClassName:rt,disableKeyboardA11y:Ue,nodeExtent:Je,rfId:fe,viewport:ee,onViewportChange:me,nodesDraggable:be}){return DS(e),DS(t),PF(),MF(n),OF(ee),m.jsx(iF,{onPaneClick:re,onPaneMouseEnter:ae,onPaneMouseMove:Z,onPaneMouseLeave:P,onPaneContextMenu:ie,onPaneScroll:te,paneClickDistance:pe,deleteKeyCode:N,selectionKeyCode:x,selectionOnDrag:b,selectionMode:k,onSelectionStart:_,onSelectionEnd:v,multiSelectionKeyCode:D,panActivationKeyCode:T,zoomActivationKeyCode:R,elementsSelectable:B,zoomOnScroll:X,zoomOnPinch:K,zoomOnDoubleClick:$,panOnScroll:O,panOnScrollSpeed:L,panOnScrollMode:j,panOnDrag:U,autoPanOnSelection:Q,defaultViewport:H,translateExtent:Y,minZoom:F,maxZoom:z,onSelectionContextMenu:d,preventScrolling:q,noDragClassName:it,noWheelClassName:pt,noPanClassName:rt,disableKeyboardA11y:Ue,onViewportChange:me,isControlledViewport:!!ee,children:m.jsxs(RF,{children:[m.jsx(DF,{edgeTypes:t,onEdgeClick:a,onEdgeDoubleClick:u,onReconnect:Ye,onReconnectStart:lt,onReconnectEnd:dt,onlyRenderVisibleElements:M,onEdgeContextMenu:ye,onEdgeMouseEnter:we,onEdgeMouseMove:Ce,onEdgeMouseLeave:Ae,reconnectRadius:xe,defaultMarkerColor:G,noPanClassName:rt,disableKeyboardA11y:Ue,rfId:fe}),m.jsx(HF,{style:C,type:w,component:y,containerStyle:S}),m.jsx("div",{className:"react-flow__edgelabel-renderer"}),m.jsx(fF,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:l,onNodeMouseEnter:o,onNodeMouseMove:c,onNodeMouseLeave:f,onNodeContextMenu:p,nodeClickDistance:he,onlyRenderVisibleElements:M,noPanClassName:rt,noDragClassName:it,disableKeyboardA11y:Ue,nodeExtent:Je,rfId:fe,nodesDraggable:be}),m.jsx("div",{className:"react-flow__viewport-portal"})]})})}qE.displayName="GraphView";const UF=V.memo(qE),$F=YC(),RS=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:a,height:l,fitView:u,fitViewOptions:o,minZoom:c=.5,maxZoom:f=2,nodeOrigin:p,nodeExtent:d,zIndexMode:_="basic"}={})=>{const v=new Map,w=new Map,C=new Map,y=new Map,S=r??t??[],x=n??e??[],b=p??[0,0],k=d??Ko;sE(C,y,S);const{nodesInitialized:D}=gg(x,v,w,{nodeOrigin:b,nodeExtent:k,zIndexMode:_});let T=[0,0,1];if(u&&a&&l){const R=fl(v,{filter:H=>!!((H.width||H.initialWidth)&&(H.height||H.initialHeight))}),{x:N,y:M,zoom:B}=jm(R,a,l,c,f,(o==null?void 0:o.padding)??.1);T=[N,M,B]}return{rfId:"1",width:a??0,height:l??0,transform:T,nodes:x,nodesInitialized:D,nodeLookup:v,parentLookup:w,edges:S,edgeLookup:y,connectionLookup:C,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:c,maxZoom:f,translateExtent:Ko,nodeExtent:k,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:ua.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:b,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:u??!1,fitViewOptions:o,fitViewResolver:null,connection:{...FC},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:$F,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:HC,zIndexMode:_,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},GF=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:a,height:l,fitView:u,fitViewOptions:o,minZoom:c,maxZoom:f,nodeOrigin:p,nodeExtent:d,zIndexMode:_})=>nH((v,w)=>{async function C(){const{nodeLookup:y,panZoom:S,fitViewOptions:x,fitViewResolver:b,width:k,height:D,minZoom:T,maxZoom:R}=w();S&&(await Q9({nodes:y,width:k,height:D,panZoom:S,minZoom:T,maxZoom:R},x),b==null||b.resolve(!0),v({fitViewResolver:null}))}return{...RS({nodes:e,edges:t,width:a,height:l,fitView:u,fitViewOptions:o,minZoom:c,maxZoom:f,nodeOrigin:p,nodeExtent:d,defaultNodes:n,defaultEdges:r,zIndexMode:_}),setNodes:y=>{const{nodeLookup:S,parentLookup:x,nodeOrigin:b,elevateNodesOnSelect:k,fitViewQueued:D,zIndexMode:T,nodesSelectionActive:R}=w(),{nodesInitialized:N,hasSelectedNodes:M}=gg(y,S,x,{nodeOrigin:b,nodeExtent:d,elevateNodesOnSelect:k,checkEquality:!0,zIndexMode:T}),B=R&&M;D&&N?(C(),v({nodes:y,nodesInitialized:N,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:B})):v({nodes:y,nodesInitialized:N,nodesSelectionActive:B})},setEdges:y=>{const{connectionLookup:S,edgeLookup:x}=w();sE(S,x,y),v({edges:y})},setDefaultNodesAndEdges:(y,S)=>{if(y){const{setNodes:x}=w();x(y),v({hasDefaultNodes:!0})}if(S){const{setEdges:x}=w();x(S),v({hasDefaultEdges:!0})}},updateNodeInternals:y=>{const{triggerNodeChanges:S,nodeLookup:x,parentLookup:b,domNode:k,nodeOrigin:D,nodeExtent:T,debug:R,fitViewQueued:N,zIndexMode:M}=w(),{changes:B,updatedInternals:H}=Sz(y,x,b,k,D,T,M);H&&(_z(x,b,{nodeOrigin:D,nodeExtent:T,zIndexMode:M}),N?(C(),v({fitViewQueued:!1,fitViewOptions:void 0})):v({}),(B==null?void 0:B.length)>0&&(R&&console.log("React Flow: trigger node changes",B),S==null||S(B)))},updateNodePositions:(y,S=!1)=>{const x=[];let b=[];const{nodeLookup:k,triggerNodeChanges:D,connection:T,updateConnection:R,onNodesChangeMiddlewareMap:N}=w();for(const[M,B]of y){const H=k.get(M),Y=!!(H!=null&&H.expandParent&&(H!=null&&H.parentId)&&(B!=null&&B.position)),F={id:M,type:"position",position:Y?{x:Math.max(0,B.position.x),y:Math.max(0,B.position.y)}:B.position,dragging:S};if(H&&T.inProgress&&T.fromNode.id===H.id){const z=is(H,T.fromHandle,Re.Left,!0);R({...T,from:z})}Y&&H.parentId&&x.push({id:M,parentId:H.parentId,rect:{...B.internals.positionAbsolute,width:B.measured.width??0,height:B.measured.height??0}}),b.push(F)}if(x.length>0){const{parentLookup:M,nodeOrigin:B}=w(),H=Pm(x,k,M,B);b.push(...H)}for(const M of N.values())b=M(b);D(b)},triggerNodeChanges:y=>{const{onNodesChange:S,setNodes:x,nodes:b,hasDefaultNodes:k,debug:D}=w();if(y!=null&&y.length){if(k){const T=wH(y,b);x(T)}D&&console.log("React Flow: trigger node changes",y),S==null||S(y)}},triggerEdgeChanges:y=>{const{onEdgesChange:S,setEdges:x,edges:b,hasDefaultEdges:k,debug:D}=w();if(y!=null&&y.length){if(k){const T=CH(y,b);x(T)}D&&console.log("React Flow: trigger edge changes",y),S==null||S(y)}},addSelectedNodes:y=>{const{multiSelectionActive:S,edgeLookup:x,nodeLookup:b,triggerNodeChanges:k,triggerEdgeChanges:D}=w();if(S){const T=y.map(R=>Yr(R,!0));k(T);return}k(ia(b,new Set([...y]),!0)),D(ia(x))},addSelectedEdges:y=>{const{multiSelectionActive:S,edgeLookup:x,nodeLookup:b,triggerNodeChanges:k,triggerEdgeChanges:D}=w();if(S){const T=y.map(R=>Yr(R,!0));D(T);return}D(ia(x,new Set([...y]))),k(ia(b,new Set,!0))},unselectNodesAndEdges:({nodes:y,edges:S}={})=>{const{edges:x,nodes:b,nodeLookup:k,triggerNodeChanges:D,triggerEdgeChanges:T}=w(),R=y||b,N=S||x,M=[];for(const H of R){if(!H.selected)continue;const Y=k.get(H.id);Y&&(Y.selected=!1),M.push(Yr(H.id,!1))}const B=[];for(const H of N)H.selected&&B.push(Yr(H.id,!1));D(M),T(B)},setMinZoom:y=>{const{panZoom:S,maxZoom:x}=w();S==null||S.setScaleExtent([y,x]),v({minZoom:y})},setMaxZoom:y=>{const{panZoom:S,minZoom:x}=w();S==null||S.setScaleExtent([x,y]),v({maxZoom:y})},setTranslateExtent:y=>{var S;(S=w().panZoom)==null||S.setTranslateExtent(y),v({translateExtent:y})},resetSelectedElements:()=>{const{edges:y,nodes:S,triggerNodeChanges:x,triggerEdgeChanges:b,elementsSelectable:k}=w();if(!k)return;const D=S.reduce((R,N)=>N.selected?[...R,Yr(N.id,!1)]:R,[]),T=y.reduce((R,N)=>N.selected?[...R,Yr(N.id,!1)]:R,[]);x(D),b(T)},setNodeExtent:y=>{const{nodes:S,nodeLookup:x,parentLookup:b,nodeOrigin:k,elevateNodesOnSelect:D,nodeExtent:T,zIndexMode:R}=w();y[0][0]===T[0][0]&&y[0][1]===T[0][1]&&y[1][0]===T[1][0]&&y[1][1]===T[1][1]||(gg(S,x,b,{nodeOrigin:k,nodeExtent:y,elevateNodesOnSelect:D,checkEquality:!1,zIndexMode:R}),v({nodeExtent:y}))},panBy:y=>{const{transform:S,width:x,height:b,panZoom:k,translateExtent:D}=w();return xz({delta:y,panZoom:k,transform:S,translateExtent:D,width:x,height:b})},setCenter:async(y,S,x)=>{const{width:b,height:k,maxZoom:D,panZoom:T}=w();if(!T)return!1;const R=typeof(x==null?void 0:x.zoom)<"u"?x.zoom:D;return await T.setViewport({x:b/2-y*R,y:k/2-S*R,zoom:R},{duration:x==null?void 0:x.duration,ease:x==null?void 0:x.ease,interpolate:x==null?void 0:x.interpolate}),!0},cancelConnection:()=>{v({connection:{...FC}})},updateConnection:y=>{v({connection:y})},reset:()=>v({...RS()})}},Object.is);function qF({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:a,initialHeight:l,initialMinZoom:u,initialMaxZoom:o,initialFitViewOptions:c,fitView:f,nodeOrigin:p,nodeExtent:d,zIndexMode:_,children:v}){const[w]=V.useState(()=>GF({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:a,height:l,fitView:f,minZoom:u,maxZoom:o,fitViewOptions:c,nodeOrigin:p,nodeExtent:d,zIndexMode:_}));return m.jsx(iH,{value:w,children:m.jsx(NH,{children:m.jsx(GH,{children:v})})})}function VF({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:a,width:l,height:u,fitView:o,fitViewOptions:c,minZoom:f,maxZoom:p,nodeOrigin:d,nodeExtent:_,zIndexMode:v}){return V.useContext(Ch)?m.jsx(m.Fragment,{children:e}):m.jsx(qF,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:a,initialWidth:l,initialHeight:u,fitView:o,initialFitViewOptions:c,initialMinZoom:f,initialMaxZoom:p,nodeOrigin:d,nodeExtent:_,zIndexMode:v,children:e})}const YF={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function WF({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:a,nodeTypes:l,edgeTypes:u,onNodeClick:o,onEdgeClick:c,onInit:f,onMove:p,onMoveStart:d,onMoveEnd:_,onConnect:v,onConnectStart:w,onConnectEnd:C,onClickConnectStart:y,onClickConnectEnd:S,onNodeMouseEnter:x,onNodeMouseMove:b,onNodeMouseLeave:k,onNodeContextMenu:D,onNodeDoubleClick:T,onNodeDragStart:R,onNodeDrag:N,onNodeDragStop:M,onNodesDelete:B,onEdgesDelete:H,onDelete:Y,onSelectionChange:F,onSelectionDragStart:z,onSelectionDrag:q,onSelectionDragStop:G,onSelectionContextMenu:X,onSelectionStart:K,onSelectionEnd:O,onBeforeDelete:L,connectionMode:j,connectionLineType:$=yr.Bezier,connectionLineStyle:U,connectionLineComponent:Q,connectionLineContainerStyle:re,deleteKeyCode:ae="Backspace",selectionKeyCode:Z="Shift",selectionOnDrag:P=!1,selectionMode:te=Zo.Full,panActivationKeyCode:ie="Space",multiSelectionKeyCode:pe=Jo()?"Meta":"Control",zoomActivationKeyCode:he=Jo()?"Meta":"Control",snapToGrid:ye,snapGrid:we,onlyRenderVisibleElements:Ce=!1,selectNodesOnDrag:Ae,nodesDraggable:xe,autoPanOnNodeFocus:Ye,nodesConnectable:lt,nodesFocusable:dt,nodeOrigin:it=vE,edgesFocusable:pt,edgesReconnectable:rt,elementsSelectable:Ue=!0,defaultViewport:Je=mH,minZoom:fe=.5,maxZoom:ee=2,translateExtent:me=Ko,preventScrolling:be=!0,nodeExtent:Ee,defaultMarkerColor:Be="#b1b1b7",zoomOnScroll:Ie=!0,zoomOnPinch:Ke=!0,panOnScroll:ct=!1,panOnScrollSpeed:Ut=.5,panOnScrollMode:st=Zr.Free,zoomOnDoubleClick:yn=!0,panOnDrag:Zt=!0,onPaneClick:ls,onPaneMouseEnter:pi,onPaneMouseMove:ue,onPaneMouseLeave:ke,onPaneScroll:Ne,onPaneContextMenu:et,paneClickDistance:ut=1,nodeClickDistance:cs=0,children:nn,onReconnect:Cr,onReconnectStart:Er,onReconnectEnd:Th,onEdgeContextMenu:gl,onEdgeDoubleClick:ml,onEdgeMouseEnter:_l,onEdgeMouseMove:Sa,onEdgeMouseLeave:xa,reconnectRadius:vl=10,onNodesChange:yl,onEdgesChange:ti,noDragClassName:$t="nodrag",noWheelClassName:Qt="nowheel",noPanClassName:gi="nopan",fitView:us,fitViewOptions:bl,connectOnClick:Nh,attributionPosition:Sl,proOptions:kr,defaultEdgeOptions:wa,elevateNodesOnSelect:Pi=!0,elevateEdgesOnSelect:Ui=!1,disableKeyboardA11y:$i=!1,autoPanOnConnect:Gi,autoPanOnNodeDrag:jt,autoPanOnSelection:xl=!0,autoPanSpeed:wl,connectionRadius:mi,isValidConnection:qi,onError:Dh,style:Cl,id:Ca,nodeDragThreshold:Rh,connectionDragThreshold:hs,viewport:fs,onViewportChange:Gn,width:an,height:El,colorMode:Mh="light",debug:Ea,onScroll:Ar,ariaLabelConfig:ds,zIndexMode:kl="basic",...on},ka){const ps=Ca||"1",Aa=bH(Mh),Vi=V.useCallback(Ta=>{Ta.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),Ar==null||Ar(Ta)},[Ar]);return m.jsx("div",{"data-testid":"rf__wrapper",...on,onScroll:Vi,style:{...Cl,...YF},ref:ka,className:Pt(["react-flow",a,Aa]),id:Ca,role:"application",children:m.jsxs(VF,{nodes:e,edges:t,width:an,height:El,fitView:us,fitViewOptions:bl,minZoom:fe,maxZoom:ee,nodeOrigin:it,nodeExtent:Ee,zIndexMode:kl,children:[m.jsx(yH,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:v,onConnectStart:w,onConnectEnd:C,onClickConnectStart:y,onClickConnectEnd:S,nodesDraggable:xe,autoPanOnNodeFocus:Ye,nodesConnectable:lt,nodesFocusable:dt,edgesFocusable:pt,edgesReconnectable:rt,elementsSelectable:Ue,elevateNodesOnSelect:Pi,elevateEdgesOnSelect:Ui,minZoom:fe,maxZoom:ee,nodeExtent:Ee,onNodesChange:yl,onEdgesChange:ti,snapToGrid:ye,snapGrid:we,connectionMode:j,translateExtent:me,connectOnClick:Nh,defaultEdgeOptions:wa,fitView:us,fitViewOptions:bl,onNodesDelete:B,onEdgesDelete:H,onDelete:Y,onNodeDragStart:R,onNodeDrag:N,onNodeDragStop:M,onSelectionDrag:q,onSelectionDragStart:z,onSelectionDragStop:G,onMove:p,onMoveStart:d,onMoveEnd:_,noPanClassName:gi,nodeOrigin:it,rfId:ps,autoPanOnConnect:Gi,autoPanOnNodeDrag:jt,autoPanSpeed:wl,onError:Dh,connectionRadius:mi,isValidConnection:qi,selectNodesOnDrag:Ae,nodeDragThreshold:Rh,connectionDragThreshold:hs,onBeforeDelete:L,debug:Ea,ariaLabelConfig:ds,zIndexMode:kl}),m.jsx(UF,{onInit:f,onNodeClick:o,onEdgeClick:c,onNodeMouseEnter:x,onNodeMouseMove:b,onNodeMouseLeave:k,onNodeContextMenu:D,onNodeDoubleClick:T,nodeTypes:l,edgeTypes:u,connectionLineType:$,connectionLineStyle:U,connectionLineComponent:Q,connectionLineContainerStyle:re,selectionKeyCode:Z,selectionOnDrag:P,selectionMode:te,deleteKeyCode:ae,multiSelectionKeyCode:pe,panActivationKeyCode:ie,zoomActivationKeyCode:he,onlyRenderVisibleElements:Ce,defaultViewport:Je,translateExtent:me,minZoom:fe,maxZoom:ee,preventScrolling:be,zoomOnScroll:Ie,zoomOnPinch:Ke,zoomOnDoubleClick:yn,panOnScroll:ct,panOnScrollSpeed:Ut,panOnScrollMode:st,panOnDrag:Zt,autoPanOnSelection:xl,onPaneClick:ls,onPaneMouseEnter:pi,onPaneMouseMove:ue,onPaneMouseLeave:ke,onPaneScroll:Ne,onPaneContextMenu:et,paneClickDistance:ut,nodeClickDistance:cs,onSelectionContextMenu:X,onSelectionStart:K,onSelectionEnd:O,onReconnect:Cr,onReconnectStart:Er,onReconnectEnd:Th,onEdgeContextMenu:gl,onEdgeDoubleClick:ml,onEdgeMouseEnter:_l,onEdgeMouseMove:Sa,onEdgeMouseLeave:xa,reconnectRadius:vl,defaultMarkerColor:Be,noDragClassName:$t,noWheelClassName:Qt,noPanClassName:gi,rfId:ps,disableKeyboardA11y:$i,nodeExtent:Ee,viewport:fs,onViewportChange:Gn,nodesDraggable:xe}),m.jsx(gH,{onSelectionChange:F}),nn,m.jsx(uH,{proOptions:kr,position:Sl}),m.jsx(cH,{rfId:ps,disableKeyboardA11y:$i})]})})}var XF=bE(WF);function KF({dimensions:e,lineWidth:t,variant:n,className:r}){return m.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:Pt(["react-flow__background-pattern",n,r])})}function ZF({radius:e,className:t}){return m.jsx("circle",{cx:e,cy:e,r:e,className:Pt(["react-flow__background-pattern","dots",t])})}var Bi;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Bi||(Bi={}));const QF={[Bi.Dots]:1,[Bi.Lines]:1,[Bi.Cross]:6},JF=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function VE({id:e,variant:t=Bi.Dots,gap:n=20,size:r,lineWidth:a=1,offset:l=0,color:u,bgColor:o,style:c,className:f,patternClassName:p}){const d=V.useRef(null),{transform:_,patternId:v}=nt(JF,Nt),w=r||QF[t],C=t===Bi.Dots,y=t===Bi.Cross,S=Array.isArray(n)?n:[n,n],x=[S[0]*_[2]||1,S[1]*_[2]||1],b=w*_[2],k=Array.isArray(l)?l:[l,l],D=y?[b,b]:x,T=[k[0]*_[2]||1+D[0]/2,k[1]*_[2]||1+D[1]/2],R=`${v}${e||""}`;return m.jsxs("svg",{className:Pt(["react-flow__background",f]),style:{...c,...kh,"--xy-background-color-props":o,"--xy-background-pattern-color-props":u},ref:d,"data-testid":"rf__background",children:[m.jsx("pattern",{id:R,x:_[0]%x[0],y:_[1]%x[1],width:x[0],height:x[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${T[0]},-${T[1]})`,children:C?m.jsx(ZF,{radius:b/2,className:p}):m.jsx(KF,{dimensions:D,lineWidth:a,variant:t,className:p})}),m.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${R})`})]})}VE.displayName="Background";const eP=V.memo(VE);function tP(){return m.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:m.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function nP(){return m.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:m.jsx("path",{d:"M0 0h32v4.2H0z"})})}function iP(){return m.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:m.jsx("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function rP(){return m.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:m.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function sP(){return m.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:m.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function ru({children:e,className:t,...n}){return m.jsx("button",{type:"button",className:Pt(["react-flow__controls-button",t]),...n,children:e})}const aP=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function YE({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:a,onZoomIn:l,onZoomOut:u,onFitView:o,onInteractiveChange:c,className:f,children:p,position:d="bottom-left",orientation:_="vertical","aria-label":v}){const w=At(),{isInteractive:C,minZoomReached:y,maxZoomReached:S,ariaLabelConfig:x}=nt(aP,Nt),{zoomIn:b,zoomOut:k,fitView:D}=Um(),T=()=>{b(),l==null||l()},R=()=>{k(),u==null||u()},N=()=>{D(a),o==null||o()},M=()=>{w.setState({nodesDraggable:!C,nodesConnectable:!C,elementsSelectable:!C}),c==null||c(!C)},B=_==="horizontal"?"horizontal":"vertical";return m.jsxs(Eh,{className:Pt(["react-flow__controls",B,f]),position:d,style:e,"data-testid":"rf__controls","aria-label":v??x["controls.ariaLabel"],children:[t&&m.jsxs(m.Fragment,{children:[m.jsx(ru,{onClick:T,className:"react-flow__controls-zoomin",title:x["controls.zoomIn.ariaLabel"],"aria-label":x["controls.zoomIn.ariaLabel"],disabled:S,children:m.jsx(tP,{})}),m.jsx(ru,{onClick:R,className:"react-flow__controls-zoomout",title:x["controls.zoomOut.ariaLabel"],"aria-label":x["controls.zoomOut.ariaLabel"],disabled:y,children:m.jsx(nP,{})})]}),n&&m.jsx(ru,{className:"react-flow__controls-fitview",onClick:N,title:x["controls.fitView.ariaLabel"],"aria-label":x["controls.fitView.ariaLabel"],children:m.jsx(iP,{})}),r&&m.jsx(ru,{className:"react-flow__controls-interactive",onClick:M,title:x["controls.interactive.ariaLabel"],"aria-label":x["controls.interactive.ariaLabel"],children:C?m.jsx(sP,{}):m.jsx(rP,{})}),p]})}YE.displayName="Controls";V.memo(YE);function oP({id:e,x:t,y:n,width:r,height:a,style:l,color:u,strokeColor:o,strokeWidth:c,className:f,borderRadius:p,shapeRendering:d,selected:_,onClick:v}){const{background:w,backgroundColor:C}=l||{},y=u||w||C;return m.jsx("rect",{className:Pt(["react-flow__minimap-node",{selected:_},f]),x:t,y:n,rx:p,ry:p,width:r,height:a,style:{fill:y,stroke:o,strokeWidth:c},shapeRendering:d,onClick:v?S=>v(S,e):void 0})}const lP=V.memo(oP),cP=e=>e.nodes.map(t=>t.id),Ap=e=>e instanceof Function?e:()=>e;function uP({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:a,nodeComponent:l=lP,onClick:u}){const o=nt(cP,Nt),c=Ap(t),f=Ap(e),p=Ap(n),d=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return m.jsx(m.Fragment,{children:o.map(_=>m.jsx(fP,{id:_,nodeColorFunc:c,nodeStrokeColorFunc:f,nodeClassNameFunc:p,nodeBorderRadius:r,nodeStrokeWidth:a,NodeComponent:l,onClick:u,shapeRendering:d},_))})}function hP({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:a,nodeStrokeWidth:l,shapeRendering:u,NodeComponent:o,onClick:c}){const{node:f,x:p,y:d,width:_,height:v}=nt(w=>{const C=w.nodeLookup.get(e);if(!C)return{node:void 0,x:0,y:0,width:0,height:0};const y=C.internals.userNode,{x:S,y:x}=C.internals.positionAbsolute,{width:b,height:k}=di(y);return{node:y,x:S,y:x,width:b,height:k}},Nt);return!f||f.hidden||!WC(f)?null:m.jsx(o,{x:p,y:d,width:_,height:v,style:f.style,selected:!!f.selected,className:r(f),color:t(f),borderRadius:a,strokeColor:n(f),strokeWidth:l,shapeRendering:u,onClick:c,id:f.id})}const fP=V.memo(hP);var dP=V.memo(uP);const pP=200,gP=150,mP=e=>!e.hidden,_P=e=>{const t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:t,boundingRect:e.nodeLookup.size>0?qC(fl(e.nodeLookup,{filter:mP}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},MS=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,vP=(e,t)=>MS(e.viewBB,t.viewBB)&&MS(e.boundingRect,t.boundingRect)&&e.rfId===t.rfId&&e.panZoom===t.panZoom&&e.translateExtent===t.translateExtent&&e.flowWidth===t.flowWidth&&e.flowHeight===t.flowHeight&&e.ariaLabelConfig===t.ariaLabelConfig,yP="react-flow__minimap-desc";function WE({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:a="",nodeBorderRadius:l=5,nodeStrokeWidth:u,nodeComponent:o,bgColor:c,maskColor:f,maskStrokeColor:p,maskStrokeWidth:d,position:_="bottom-right",onClick:v,onNodeClick:w,pannable:C=!1,zoomable:y=!1,ariaLabel:S,inversePan:x,zoomStep:b=1,offsetScale:k=5}){const D=At(),T=V.useRef(null),{boundingRect:R,viewBB:N,rfId:M,panZoom:B,translateExtent:H,flowWidth:Y,flowHeight:F,ariaLabelConfig:z}=nt(_P,vP),q=(e==null?void 0:e.width)??pP,G=(e==null?void 0:e.height)??gP,X=R.width/q,K=R.height/G,O=Math.max(X,K),L=O*q,j=O*G,$=k*O,U=R.x-(L-R.width)/2-$,Q=R.y-(j-R.height)/2-$,re=L+$*2,ae=j+$*2,Z=`${yP}-${M}`,P=V.useRef(0),te=V.useRef();P.current=O,V.useEffect(()=>{if(T.current&&B)return te.current=Rz({domNode:T.current,panZoom:B,getTransform:()=>D.getState().transform,getViewScale:()=>P.current}),()=>{var ye;(ye=te.current)==null||ye.destroy()}},[B]),V.useEffect(()=>{var ye;(ye=te.current)==null||ye.update({translateExtent:H,width:Y,height:F,inversePan:x,pannable:C,zoomStep:b,zoomable:y})},[C,y,x,b,H,Y,F]);const ie=v?ye=>{var Ae;const[we,Ce]=((Ae=te.current)==null?void 0:Ae.pointer(ye))||[0,0];v(ye,{x:we,y:Ce})}:void 0,pe=w?V.useCallback((ye,we)=>{const Ce=D.getState().nodeLookup.get(we).internals.userNode;w(ye,Ce)},[]):void 0,he=S??z["minimap.ariaLabel"];return m.jsx(Eh,{position:_,style:{...e,"--xy-minimap-background-color-props":typeof c=="string"?c:void 0,"--xy-minimap-mask-background-color-props":typeof f=="string"?f:void 0,"--xy-minimap-mask-stroke-color-props":typeof p=="string"?p:void 0,"--xy-minimap-mask-stroke-width-props":typeof d=="number"?d*O:void 0,"--xy-minimap-node-background-color-props":typeof r=="string"?r:void 0,"--xy-minimap-node-stroke-color-props":typeof n=="string"?n:void 0,"--xy-minimap-node-stroke-width-props":typeof u=="number"?u:void 0},className:Pt(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:m.jsxs("svg",{width:q,height:G,viewBox:`${U} ${Q} ${re} ${ae}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":Z,ref:T,onClick:ie,children:[he&&m.jsx("title",{id:Z,children:he}),m.jsx(dP,{onClick:pe,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:l,nodeClassName:a,nodeStrokeWidth:u,nodeComponent:o}),m.jsx("path",{className:"react-flow__minimap-mask",d:`M${U-$},${Q-$}h${re+$*2}v${ae+$*2}h${-re-$*2}z - M${N.x},${N.y}h${N.width}v${N.height}h${-N.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}WE.displayName="MiniMap";V.memo(WE);const bP=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,SP={[da.Line]:"right",[da.Handle]:"bottom-right"};function xP({nodeId:e,position:t,variant:n=da.Handle,className:r,style:a=void 0,children:l,color:u,minWidth:o=10,minHeight:c=10,maxWidth:f=Number.MAX_VALUE,maxHeight:p=Number.MAX_VALUE,keepAspectRatio:d=!1,resizeDirection:_,autoScale:v=!0,shouldResize:w,onResizeStart:C,onResize:y,onResizeEnd:S}){const x=EE(),b=typeof e=="string"?e:x,k=At(),D=V.useRef(null),T=n===da.Handle,R=nt(V.useCallback(bP(T&&v),[T,v]),Nt),N=V.useRef(null),M=t??SP[n];V.useEffect(()=>{if(!(!D.current||!b))return N.current||(N.current=Gz({domNode:D.current,nodeId:b,getStoreItems:()=>{const{nodeLookup:H,transform:Y,snapGrid:F,snapToGrid:z,nodeOrigin:q,domNode:G}=k.getState();return{nodeLookup:H,transform:Y,snapGrid:F,snapToGrid:z,nodeOrigin:q,paneDomNode:G}},onChange:(H,Y)=>{const{triggerNodeChanges:F,nodeLookup:z,parentLookup:q,nodeOrigin:G}=k.getState(),X=[],K={x:H.x,y:H.y},O=z.get(b);if(O&&O.expandParent&&O.parentId){const L=O.origin??G,j=H.width??O.measured.width??0,$=H.height??O.measured.height??0,U={id:O.id,parentId:O.parentId,rect:{width:j,height:$,...XC({x:H.x??O.position.x,y:H.y??O.position.y},{width:j,height:$},O.parentId,z,L)}},Q=Pm([U],z,q,G);X.push(...Q),K.x=H.x?Math.max(L[0]*j,H.x):void 0,K.y=H.y?Math.max(L[1]*$,H.y):void 0}if(K.x!==void 0&&K.y!==void 0){const L={id:b,type:"position",position:{...K}};X.push(L)}if(H.width!==void 0&&H.height!==void 0){const j={id:b,type:"dimensions",resizing:!0,setAttributes:_?_==="horizontal"?"width":"height":!0,dimensions:{width:H.width,height:H.height}};X.push(j)}for(const L of Y){const j={...L,type:"position"};X.push(j)}F(X)},onEnd:({width:H,height:Y})=>{const F={id:b,type:"dimensions",resizing:!1,dimensions:{width:H,height:Y}};k.getState().triggerNodeChanges([F])}})),N.current.update({controlPosition:M,boundaries:{minWidth:o,minHeight:c,maxWidth:f,maxHeight:p},keepAspectRatio:d,resizeDirection:_,onResizeStart:C,onResize:y,onResizeEnd:S,shouldResize:w}),()=>{var H;(H=N.current)==null||H.destroy()}},[M,o,c,f,p,d,C,y,S,w]);const B=M.split("-");return m.jsx("div",{className:Pt(["react-flow__resize-control","nodrag",...B,n,r]),ref:D,style:{...a,scale:R,...u&&{[T?"backgroundColor":"borderColor"]:u}},children:l})}V.memo(xP);const vg=240,wP=132,vu=44,CP=72;function EP(e){const t=new Map(e.map(l=>[l.id,{exp:l,children:[]}])),n=[];for(const l of e){const u=t.get(l.id),o=l.parentExperimentId?t.get(l.parentExperimentId):void 0;o?o.children.push(u):n.push(u)}const r=(l,u)=>l.exp.createdAt-u.exp.createdAt,a=l=>{l.children.sort(r),l.children.forEach(a)};return n.sort(r),n.forEach(a),n}function yu(e){if(e.children.length===0)return vg;const t=e.children.reduce((n,r)=>n+yu(r),0)+vu*(e.children.length-1);return Math.max(vg,t)}function kP(e){return e==="done"?"pass":e==="failed"?"fail":e==="running"||e==="starting"?"live":"other"}const AP=V.memo(function({data:t}){const{exp:n,latestRun:r,runs:a,isBaseline:l,selected:u,githubOwner:o,githubRepo:c,onOpenView:f}=t,p=r==null?void 0:r.status,d=p==="running"||p==="starting",_=l?"BASELINE":d?"RUNNING":"EXPERIMENT",v=a.slice(-8);return m.jsxs("div",{className:`exp-node ${u?"selected":""} ${d?"live":""}`,children:[m.jsx(pa,{type:"target",position:Re.Top}),m.jsxs("div",{className:"node-eyebrow",children:[m.jsx("span",{children:_}),m.jsx(Po,{status:p??"idle"})]}),m.jsx("div",{className:"node-head",children:m.jsx("span",{className:"node-slug",children:n.slug})}),(n.title||n.description)&&m.jsx("div",{className:"node-title",children:n.title||n.description}),m.jsxs("div",{className:"node-meta",children:[m.jsx("span",{children:"RUNS"}),v.length>0?m.jsx("span",{className:"run-squares",children:v.map(w=>m.jsx("span",{className:`run-sq ${kP(w.status)}`,title:w.status},w.id))}):m.jsx("span",{children:"no runs"}),m.jsx("span",{style:{flex:1}}),r&&m.jsx("span",{children:ma(r.createdAt)})]}),m.jsxs("div",{className:"node-actions",onClick:w=>w.stopPropagation(),children:[m.jsxs("button",{className:"node-action",title:"Open changes",onClick:()=>f(n.id,"changes"),children:[m.jsx(Uu,{size:13}),"Changes"]}),a.length>0&&m.jsxs("button",{className:"node-action",title:"Open terminal",onClick:()=>f(n.id,"terminal"),children:[m.jsx(US,{size:13}),"Terminal"]}),m.jsxs("a",{className:"node-action",title:`Open ${n.branchName} on GitHub`,href:wg(o,c,n.branchName),target:"_blank",rel:"noopener noreferrer",onClick:w=>w.stopPropagation(),children:[m.jsx(nl,{size:13}),"GitHub"]})]}),m.jsx(pa,{type:"source",position:Re.Bottom})]})}),TP={exp:AP},NP={type:"default",style:{stroke:"var(--text)",strokeWidth:1.5,opacity:.3}};function DP({experiments:e,runs:t,project:n,selectedId:r,onSelect:a,onOpenView:l}){const{nodes:u,edges:o}=V.useMemo(()=>{const c=new Map;for(const w of t){const C=c.get(w.experimentId);C?C.push(w):c.set(w.experimentId,[w])}for(const w of c.values())w.sort((C,y)=>C.createdAt-y.createdAt);const f=[],p=[],d=EP(e);function _(w,C,y){const S=c.get(w.exp.id)??[];if(f.push({id:w.exp.id,type:"exp",position:{x:C-vg/2,y},data:{exp:w.exp,latestRun:S[S.length-1]??null,runs:S,isBaseline:!w.exp.parentExperimentId,selected:w.exp.id===r,githubOwner:n.githubOwner,githubRepo:n.githubRepo,onOpenView:l}}),w.children.length===0)return;const x=w.children.reduce((k,D)=>k+yu(D),0)+vu*(w.children.length-1);let b=C-x/2;for(const k of w.children){const D=yu(k);p.push({id:`e-${w.exp.id}-${k.exp.id}`,source:w.exp.id,target:k.exp.id}),_(k,b+D/2,y+wP+CP),b+=D+vu}}let v=0;for(const w of d){const C=yu(w);_(w,v+C/2,0),v+=C+vu}return{nodes:f,edges:p}},[e,t,r,l,n.githubOwner,n.githubRepo]);return e.length===0?m.jsxs("div",{className:"empty-state empty-state-cta",children:[m.jsx("p",{className:"empty-state-title",children:"No experiments yet"}),m.jsx("p",{className:"empty-state-hint",children:"Ask the agent in chat to create and run your first experiment."})]}):m.jsx(XF,{nodes:u,edges:o,nodeTypes:TP,defaultEdgeOptions:NP,nodesDraggable:!1,nodesConnectable:!1,minZoom:.15,fitView:!0,fitViewOptions:{padding:.25,maxZoom:1},onNodeClick:(c,f)=>a(f.id),onPaneClick:()=>a(null),children:m.jsx(eP,{variant:Bi.Dots,color:"var(--dots-strong)",gap:28,size:1.6})})}const su=(e,t)=>e.id===t.id&&e.view===t.view,au=(e,t)=>e.path===t.path&&e.sessionId===t.sessionId&&e.ref===t.ref,LS=e=>`${e.sessionId??""}:${e.ref??""}:${e.path}`;function RP(e,t){var r;if(t.length===0)return"";const n=t.reduce((a,l)=>l.createdAt>a.createdAt?l:a);return((r=e.find(a=>a.id===n.experimentId))==null?void 0:r.branchName)??""}function MP(e,t,n){let r=e,a;const l=t==null?void 0:t.replace(/\/+$/,"");if(!r.startsWith("/"))a=n;else if(l&&(r===l||r.startsWith(`${l}/`)))r=r.slice(l.length).replace(/^\/+/,"");else{const u=r.match(/\/openresearch\/worktrees\/[^/]+\/[^/]+\/([^/]+)\/(.+)$/),o=u?null:r.match(/\/openresearch\/repos\/[^/]+\/[^/]+\/(.+)$/);u?(a=u[1],r=u[2]):o&&(r=o[1])}return r?{path:r,sessionId:a}:null}const OS="orx:onboarded",XE="orx:panel-width",Hu=360,LP=10,OP=232,jP=380,BP=OP+56,IP=80;function yg(){return Math.max(Hu,window.innerWidth-BP-jP)}function zP(){const e=yg();try{const t=Number(localStorage.getItem(XE));if(Number.isFinite(t)&&t>=Hu)return Math.min(t,e)}catch{}return Math.max(Hu,Math.min(760,e,Math.round(window.innerWidth*.42)))}function ou(e,t){const n=e.findIndex(a=>a.id===t.id);if(n<0)return[...e,t];const r=e.slice();return r[n]=t,r}function HP(){var Je,fe;const[e,t]=V.useState(null),[n,r]=V.useState(null),[a,l]=V.useState([]),[u,o]=V.useState([]),[c,f]=V.useState(null),[p,d]=V.useState("tree"),[_,v]=V.useState(null),[w,C]=V.useState(null),[y,S]=V.useState("experiments"),[x,b]=V.useState([]),[k,D]=V.useState([]),[T,R]=V.useState([]),[N,M]=V.useState([]),[B,H]=V.useState(!0),[Y,F]=V.useState(!1),[z,q]=V.useState(zP),[G,X]=V.useState(!0),[K,O]=V.useState(!1),[L,j]=V.useState("chat"),[$,U]=V.useState(()=>{try{return localStorage.getItem(OS)==="1"}catch{return!0}}),Q=V.useRef(n);Q.current=n,V.useEffect(()=>{ST().then(ee=>{t(ee),r(me=>{var be;return me??((be=ee[0])==null?void 0:be.id)??null})}).catch(()=>t([]))},[]),V.useEffect(()=>{const ee=()=>q(me=>Math.min(me,yg()));return window.addEventListener("resize",ee),()=>window.removeEventListener("resize",ee)},[]),V.useEffect(()=>{n&&(ET(n).catch(()=>{}),l([]),o([]),f(null),v(null),C(null),b([]),D([]),R([]),M([]),S("experiments"),AT(n).then(l).catch(()=>{}),TT(n).then(o).catch(()=>{}),Iy(n).then(f).catch(()=>{}))},[n]);const re=V.useCallback(()=>{const ee=Q.current;ee&&Iy(ee).then(f).catch(()=>{})},[]);bN({onRun:ee=>{ee.projectId===Q.current&&o(me=>ou(me,ee))},onExperiment:ee=>{ee.projectId===Q.current&&l(me=>ou(me,ee))},onProject:ee=>{t(me=>me?ou(me,ee):[ee])},onFiles:ee=>{ee===Q.current&&re()}});const ae=V.useCallback((ee,me="changes")=>{v(ee);const be={id:ee,view:me};b(Ee=>Ee.some(Be=>su(Be,be))?Ee:[...Ee,be]),S(be),H(!0)},[]),Z=V.useCallback(ee=>{const me=x.findIndex(Ee=>su(Ee,ee));if(me===-1)return;const be=x.filter((Ee,Be)=>Be!==me);b(be),typeof y=="object"&&"view"in y&&su(y,ee)&&S(be[Math.min(me,be.length-1)]??"experiments")},[x,y]),P=V.useCallback((ee,me,be)=>{var Ie;const Ee=(Ie=e==null?void 0:e.find(Ke=>Ke.id===n))==null?void 0:Ie.repoPath,Be=MP(ee,Ee,me);Be&&(be&&(Be.ref=be),D(Ke=>Ke.some(ct=>au(ct,Be))?Ke:[...Ke,Be]),S(Be),H(!0))},[e,n]),te=V.useCallback(ee=>{const me=k.findIndex(Ee=>au(Ee,ee));if(me===-1)return;const be=k.filter((Ee,Be)=>Be!==me);D(be),typeof y=="object"&&"path"in y&&au(y,ee)&&S(be[Math.min(me,be.length-1)]??"experiments")},[k,y]),ie=V.useCallback((ee,me,be)=>{const Ee={kind:"plan",sessionId:me,promptId:be,plan:ee};R(Be=>{const Ie=Be.findIndex(ct=>ct.promptId===be);if(Ie===-1)return[...Be,Ee];const Ke=Be.slice();return Ke[Ie]=Ee,Ke}),S(Ee),H(!0)},[]),pe=V.useCallback(ee=>{const me=T.findIndex(Ee=>Ee.promptId===ee.promptId);if(me===-1)return;const be=T.filter((Ee,Be)=>Be!==me);R(be),typeof y=="object"&&"kind"in y&&y.promptId===ee.promptId&&S(be[Math.min(me,be.length-1)]??"experiments")},[T,y]),he=V.useCallback(ee=>{const be=N.find(Ee=>Ee.sessionId===ee)??{code:!0,sessionId:ee,sel:RP(a,u),selPicked:!1,toggled:new Set};M(Ee=>Ee.some(Be=>Be.sessionId===ee)?Ee:[...Ee,be]),S(be),H(!0)},[N,a,u]),ye=V.useCallback((ee,me)=>{M(be=>be.map(Ee=>Ee.sessionId===ee?{...Ee,...me}:Ee))},[]),we=V.useCallback(ee=>{const me=N.findIndex(Ee=>Ee.sessionId===ee.sessionId);if(me===-1)return;const be=N.filter((Ee,Be)=>Be!==me);M(be),typeof y=="object"&&"code"in y&&y.sessionId===ee.sessionId&&S(be[Math.min(me,be.length-1)]??"experiments")},[N,y]),Ce=ee=>{ee.preventDefault(),ee.currentTarget.setPointerCapture(ee.pointerId);const me=document.body.style.userSelect;document.body.style.userSelect="none";const be=Be=>{const Ie=Math.round(window.innerWidth-Be.clientX-LP),Ke=yg();if(Ie>Ke+IP){F(!0);return}F(!1);const ct=Math.min(Math.max(Ie,Hu),Ke);q(ct);try{localStorage.setItem(XE,String(ct))}catch{}},Ee=()=>{window.removeEventListener("pointermove",be),window.removeEventListener("pointerup",Ee),window.removeEventListener("pointercancel",Ee),document.body.style.userSelect=me};window.addEventListener("pointermove",be),window.addEventListener("pointerup",Ee),window.addEventListener("pointercancel",Ee)},Ae=ee=>{t(me=>me?ou(me,ee):[ee]),r(ee.id),O(!1)},xe=ee=>{t(me=>me&&me.filter(be=>be.id!==ee)),n===ee&&r(null)},Ye=typeof y=="object"&&"view"in y?y:null,lt=typeof y=="object"&&"path"in y?y:null,dt=typeof y=="object"&&"kind"in y?y:null,it=typeof y=="object"&&"code"in y?y:null,pt=(e==null?void 0:e.find(ee=>ee.id===n))??null,rt=Ye?a.find(ee=>ee.id===Ye.id)??null:null;if(e===null)return m.jsx("div",{className:"app",children:m.jsx("div",{className:"empty-state",children:m.jsx("span",{className:"spinner"})})});if(e.length===0)return m.jsx("div",{className:"app",children:$?m.jsx(wb,{projects:e,onOpen:r,onCreated:Ae,onDeleted:xe}):m.jsx(rB,{onDone:()=>{try{localStorage.setItem(OS,"1")}catch{}U(!0)}})});const Ue=m.jsx(iB,{projectName:((Je=e.find(ee=>ee.id===n))==null?void 0:Je.name)??"",onHome:()=>O(!0),onCollapse:()=>X(!1)});return m.jsx("div",{className:"app",children:K?m.jsx(wb,{projects:e,onOpen:ee=>{r(ee),O(!1)},onCreated:Ae,onDeleted:xe}):m.jsxs("div",{className:"app-body",children:[n&&m.jsx(gO,{projectId:n,paperId:(fe=e.find(ee=>ee.id===n))==null?void 0:fe.paperId,railHeader:Ue,railOpen:G,onShowRail:()=>X(!0),mainView:L,onSelectMainView:j,panelOpen:B,onTogglePanel:()=>{B&&F(!1),H(!B)},onOpenFile:P,onOpenPlan:ie,onOpenCode:he,children:L==="files"?(()=>{const ee=e.find(me=>me.id===n);return ee?m.jsx(AO,{project:ee,files:c,onChanged:re,onOpenStorage:()=>j("storage")}):null})():L!=="chat"?m.jsx(tO,{tab:L}):null}),L==="chat"&&B&&m.jsxs("aside",{className:`right-pane floating-panel ${Y?"max":""}`,style:Y?void 0:{width:z},children:[!Y&&m.jsx("div",{className:"panel-resizer",onPointerDown:Ce}),m.jsxs("div",{className:"tabs",children:[m.jsxs("div",{className:"tab-strip",children:[m.jsx("button",{className:`tab ${y==="experiments"?"active":""}`,onClick:()=>S("experiments"),children:"Experiments"}),x.map(ee=>{const me=a.find(be=>be.id===ee.id);return m.jsx($c,{active:Ye!==null&&su(Ye,ee),label:me?me.title||me.slug:"…",icon:ee.view==="terminal"?m.jsx(US,{size:12,style:{flexShrink:0}}):m.jsx(Uu,{size:12,style:{flexShrink:0}}),onSelect:()=>{S(ee),v(ee.id)},onClose:()=>Z(ee)},`${ee.id}:${ee.view}`)}),k.map(ee=>m.jsx($c,{active:lt!==null&&au(lt,ee),label:ee.path.split("/").pop()||ee.path,icon:m.jsx(IS,{size:12,style:{flexShrink:0}}),onSelect:()=>S(ee),onClose:()=>te(ee)},`file:${LS(ee)}`)),T.map(ee=>m.jsx($c,{active:dt!==null&&dt.promptId===ee.promptId,label:"Plan",icon:m.jsx(PS,{size:12,style:{flexShrink:0}}),onSelect:()=>S(ee),onClose:()=>pe(ee)},`plan:${ee.promptId}`)),N.map(ee=>m.jsx($c,{active:it!==null&&it.sessionId===ee.sessionId,label:"Code",icon:m.jsx(HS,{size:12,style:{flexShrink:0}}),onSelect:()=>S(ee),onClose:()=>we(ee)},`code:${ee.sessionId}`))]}),m.jsxs("div",{className:"panel-controls",children:[m.jsx("button",{className:"icon-btn",title:Y?"Restore panel":"Expand panel","aria-label":Y?"Restore panel":"Expand panel",onClick:()=>F(ee=>!ee),children:Y?m.jsx(oT,{size:14}):m.jsx(sT,{size:14})}),m.jsx("button",{className:"icon-btn",title:"Close panel","aria-label":"Close panel",onClick:()=>{H(!1),F(!1)},children:m.jsx(jo,{size:14})})]})]}),y==="experiments"?m.jsxs("div",{className:"tab-body",children:[m.jsx("div",{className:"pane-toolbar",children:m.jsxs("div",{className:"seg",children:[m.jsx("button",{className:p==="tree"?"active":"",onClick:()=>d("tree"),children:"Tree"}),m.jsx("button",{className:p==="table"?"active":"",onClick:()=>d("table"),children:"Table"})]})}),m.jsx("div",{className:"pane-content",children:p==="tree"?pt&&m.jsx(DP,{experiments:a,runs:u,project:pt,selectedId:_,onSelect:ee=>{C(null),v(ee)},onOpenView:ae}):m.jsx(pB,{runs:u,experiments:a,onOpen:ee=>{C(ee.id),ae(ee.experimentId,"terminal")},onOpenChanges:ee=>ae(ee,"changes"),onCancel:ee=>void GS(ee).catch(()=>{})})})]}):lt?m.jsx("div",{className:"tab-body",children:n&&m.jsx(nB,{projectId:n,path:lt.path,sessionId:lt.sessionId,gitRef:lt.ref,onOpenFile:P},LS(lt))}):dt?m.jsx("div",{className:"tab-body",children:m.jsx("div",{className:"pane-content plan-tab-content",children:m.jsx(eh,{text:dt.plan,onOpenFile:ee=>P(ee,dt.sessionId)})})}):it?m.jsx("div",{className:"tab-body",children:n&&pt&&(()=>{const ee=N.find(me=>me.sessionId===it.sessionId)??it;return m.jsx(vO,{projectId:n,sessionId:ee.sessionId,project:pt,experiments:a,sel:ee.sel,selPicked:ee.selPicked,toggled:ee.toggled,onSelChange:(me,be)=>ye(ee.sessionId,{sel:me,selPicked:be}),onToggledChange:me=>ye(ee.sessionId,{toggled:me}),onOpenFile:P},`code:${ee.sessionId}`)})()}):m.jsx("div",{className:"tab-body",children:Ye&&rt&&pt&&m.jsx(Q8,{experiment:rt,project:pt,view:Ye.view,runs:u,selectedRunId:w,onSelectRun:C},`${Ye.id}:${Ye.view}`)})]})]})})}uA.createRoot(document.getElementById("root")).render(m.jsx(V.StrictMode,{children:m.jsx(HP,{})})); +`)),p=f.reduce((d,_)=>d.concat(..._),[]);return[f,p]}return[[],[]]},[e]);return V.useEffect(()=>{const c=(t==null?void 0:t.target)??dS,f=(t==null?void 0:t.actInsideInputWithModifier)??!0;if(e!==null){const p=v=>{var b,S;if(a.current=v.ctrlKey||v.metaKey||v.shiftKey||v.altKey,(!a.current||a.current&&!f)&&QC(v))return!1;const C=gS(v.code,o);if(l.current.add(v[C]),pS(u,l.current,!1)){const x=((S=(b=v.composedPath)==null?void 0:b.call(v))==null?void 0:S[0])||v.target,y=(x==null?void 0:x.nodeName)==="BUTTON"||(x==null?void 0:x.nodeName)==="A";t.preventDefault!==!1&&(a.current||!y)&&v.preventDefault(),r(!0)}},d=v=>{const w=gS(v.code,o);pS(u,l.current,!0)?(r(!1),l.current.clear()):l.current.delete(v[w]),v.key==="Meta"&&l.current.clear(),a.current=!1},_=()=>{l.current.clear(),r(!1)};return c==null||c.addEventListener("keydown",p),c==null||c.addEventListener("keyup",d),window.addEventListener("blur",_),window.addEventListener("contextmenu",_),()=>{c==null||c.removeEventListener("keydown",p),c==null||c.removeEventListener("keyup",d),window.removeEventListener("blur",_),window.removeEventListener("contextmenu",_)}}},[e,r]),n}function pS(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(a=>t.has(a)))}function gS(e,t){return t.includes(e)?"code":"key"}const xH=()=>{const e=Ct();return V.useMemo(()=>({zoomIn:async t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,t):!1},zoomOut:async t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,t):!1},zoomTo:async(t,n)=>{const{panZoom:r}=e.getState();return r?r.scaleTo(t,n):!1},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[r,a,l],panZoom:u}=e.getState();return u?(await u.setViewport({x:t.x??r,y:t.y??a,zoom:t.zoom??l},n),!0):!1},getViewport:()=>{const[t,n,r]=e.getState().transform;return{x:t,y:n,zoom:r}},setCenter:async(t,n,r)=>e.getState().setCenter(t,n,r),fitBounds:async(t,n)=>{const{width:r,height:a,minZoom:l,maxZoom:u,panZoom:o}=e.getState(),c=jm(t,r,a,l,u,(n==null?void 0:n.padding)??.1);return o?(await o.setViewport(c,{duration:n==null?void 0:n.duration,ease:n==null?void 0:n.ease,interpolate:n==null?void 0:n.interpolate}),!0):!1},screenToFlowPosition:(t,n={})=>{const{transform:r,snapGrid:a,snapToGrid:l,domNode:u}=e.getState();if(!u)return t;const{x:o,y:c}=u.getBoundingClientRect(),f={x:t.x-o,y:t.y-c},p=n.snapGrid??a,d=n.snapToGrid??l;return dl(f,r,d,p)},flowToScreenPosition:t=>{const{transform:n,domNode:r}=e.getState();if(!r)return t;const{x:a,y:l}=r.getBoundingClientRect(),u=ha(t,n);return{x:u.x+a,y:u.y+l}}}),[])};function b2(e,t){const n=[],r=new Map,a=[];for(const l of e)if(l.type==="add"){a.push(l);continue}else if(l.type==="remove"||l.type==="replace")r.set(l.id,[l]);else{const u=r.get(l.id);u?u.push(l):r.set(l.id,[l])}for(const l of t){const u=r.get(l.id);if(!u){n.push(l);continue}if(u[0].type==="remove")continue;if(u[0].type==="replace"){n.push({...u[0].item});continue}const o={...l};for(const c of u)wH(c,o);n.push(o)}return a.length&&a.forEach(l=>{l.index!==void 0?n.splice(l.index,0,{...l.item}):n.push({...l.item})}),n}function wH(e,t){switch(e.type){case"select":{t.selected=e.selected;break}case"position":{typeof e.position<"u"&&(t.position=e.position),typeof e.dragging<"u"&&(t.dragging=e.dragging);break}case"dimensions":{typeof e.dimensions<"u"&&(t.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes==="width")&&(t.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes==="height")&&(t.height=e.dimensions.height))),typeof e.resizing=="boolean"&&(t.resizing=e.resizing);break}}}function CH(e,t){return b2(e,t)}function EH(e,t){return b2(e,t)}function Vr(e,t){return{id:e,type:"select",selected:t}}function na(e,t=new Set,n=!1){const r=[];for(const[a,l]of e){const u=t.has(a);!(l.selected===void 0&&!u)&&l.selected!==u&&(n&&(l.selected=u),r.push(Vr(l.id,u)))}return r}function mS({items:e=[],lookup:t}){var a;const n=[],r=new Map(e.map(l=>[l.id,l]));for(const[l,u]of e.entries()){const o=t.get(u.id),c=((a=o==null?void 0:o.internals)==null?void 0:a.userNode)??o;c!==void 0&&c!==u&&n.push({id:u.id,item:u,type:"replace"}),c===void 0&&n.push({item:u,type:"add",index:l})}for(const[l]of t)r.get(l)===void 0&&n.push({id:l,type:"remove"});return n}function _S(e){return{id:e.id,type:"remove"}}const kH=WC();function AH(e,t,n={}){return uz(e,t,{...n,onError:n.onError??kH})}const vS=e=>X9(e),TH=e=>$C(e);function S2(e){return V.forwardRef(e)}const x2=typeof window<"u"?V.useLayoutEffect:V.useEffect;function yS(e){const[t,n]=V.useState(BigInt(0)),[r]=V.useState(()=>NH(()=>n(a=>a+BigInt(1))));return x2(()=>{const a=r.get();a.length&&(e(a),r.reset())},[t]),r}function NH(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const w2=V.createContext(null);function DH({children:e}){const t=Ct(),n=V.useCallback(o=>{const{nodes:c=[],setNodes:f,hasDefaultNodes:p,onNodesChange:d,nodeLookup:_,fitViewQueued:v,onNodesChangeMiddlewareMap:w}=t.getState();let C=c;for(const S of o)C=typeof S=="function"?S(C):S;let b=mS({items:C,lookup:_});for(const S of w.values())b=S(b);p&&f(C),b.length>0?d==null||d(b):v&&window.requestAnimationFrame(()=>{const{fitViewQueued:S,nodes:x,setNodes:y}=t.getState();S&&y(x)})},[]),r=yS(n),a=V.useCallback(o=>{const{edges:c=[],setEdges:f,hasDefaultEdges:p,onEdgesChange:d,edgeLookup:_}=t.getState();let v=c;for(const w of o)v=typeof w=="function"?w(v):w;p?f(v):d&&d(mS({items:v,lookup:_}))},[]),l=yS(a),u=V.useMemo(()=>({nodeQueue:r,edgeQueue:l}),[]);return m.jsx(w2.Provider,{value:u,children:e})}function RH(){const e=V.useContext(w2);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const MH=e=>!!e.panZoom;function Um(){const e=xH(),t=Ct(),n=RH(),r=nt(MH),a=V.useMemo(()=>{const l=d=>t.getState().nodeLookup.get(d),u=d=>{n.nodeQueue.push(d)},o=d=>{n.edgeQueue.push(d)},c=d=>{var S,x;const{nodeLookup:_,nodeOrigin:v}=t.getState(),w=vS(d)?d:_.get(d.id),C=w.parentId?KC(w.position,w.measured,w.parentId,_,v):w.position,b={...w,position:C,width:((S=w.measured)==null?void 0:S.width)??w.width,height:((x=w.measured)==null?void 0:x.height)??w.height};return Qo(b)},f=(d,_,v={replace:!1})=>{u(w=>w.map(C=>{if(C.id===d){const b=typeof _=="function"?_(C):_;return v.replace&&vS(b)?b:{...C,...b}}return C}))},p=(d,_,v={replace:!1})=>{o(w=>w.map(C=>{if(C.id===d){const b=typeof _=="function"?_(C):_;return v.replace&&TH(b)?b:{...C,...b}}return C}))};return{getNodes:()=>t.getState().nodes.map(d=>({...d})),getNode:d=>{var _;return(_=l(d))==null?void 0:_.internals.userNode},getInternalNode:l,getEdges:()=>{const{edges:d=[]}=t.getState();return d.map(_=>({..._}))},getEdge:d=>t.getState().edgeLookup.get(d),setNodes:u,setEdges:o,addNodes:d=>{const _=Array.isArray(d)?d:[d];n.nodeQueue.push(v=>[...v,..._])},addEdges:d=>{const _=Array.isArray(d)?d:[d];n.edgeQueue.push(v=>[...v,..._])},toObject:()=>{const{nodes:d=[],edges:_=[],transform:v}=t.getState(),[w,C,b]=v;return{nodes:d.map(S=>({...S})),edges:_.map(S=>({...S})),viewport:{x:w,y:C,zoom:b}}},deleteElements:async({nodes:d=[],edges:_=[]})=>{const{nodes:v,edges:w,onNodesDelete:C,onEdgesDelete:b,triggerNodeChanges:S,triggerEdgeChanges:x,onDelete:y,onBeforeDelete:k}=t.getState(),{nodes:D,edges:T}=await ez({nodesToRemove:d,edgesToRemove:_,nodes:v,edges:w,onBeforeDelete:k}),R=T.length>0,N=D.length>0;if(R){const M=T.map(_S);b==null||b(T),x(M)}if(N){const M=D.map(_S);C==null||C(D),S(M)}return(N||R)&&(y==null||y({nodes:D,edges:T})),{deletedNodes:D,deletedEdges:T}},getIntersectingNodes:(d,_=!0,v)=>{const w=$b(d),C=w?d:c(d),b=v!==void 0;return C?(v||t.getState().nodes).filter(S=>{const x=t.getState().nodeLookup.get(S.id);if(x&&!w&&(S.id===d.id||!x.internals.positionAbsolute))return!1;const y=Qo(b?S:x),k=Bu(y,C);return _&&k>0||k>=y.width*y.height||k>=C.width*C.height}):[]},isNodeIntersecting:(d,_,v=!0)=>{const C=$b(d)?d:c(d);if(!C)return!1;const b=Bu(C,_);return v&&b>0||b>=_.width*_.height||b>=C.width*C.height},updateNode:f,updateNodeData:(d,_,v={replace:!1})=>{f(d,w=>{const C=typeof _=="function"?_(w):_;return v.replace?{...w,data:C}:{...w,data:{...w.data,...C}}},v)},updateEdge:p,updateEdgeData:(d,_,v={replace:!1})=>{p(d,w=>{const C=typeof _=="function"?_(w):_;return v.replace?{...w,data:C}:{...w,data:{...w.data,...C}}},v)},getNodesBounds:d=>{const{nodeLookup:_,nodeOrigin:v}=t.getState();return K9(d,{nodeLookup:_,nodeOrigin:v})},getHandleConnections:({type:d,id:_,nodeId:v})=>{var w;return Array.from(((w=t.getState().connectionLookup.get(`${v}-${d}${_?`-${_}`:""}`))==null?void 0:w.values())??[])},getNodeConnections:({type:d,handleId:_,nodeId:v})=>{var w;return Array.from(((w=t.getState().connectionLookup.get(`${v}${d?_?`-${d}-${_}`:`-${d}`:""}`))==null?void 0:w.values())??[])},fitView:async d=>{const _=t.getState().fitViewResolver??iz();return t.setState({fitViewQueued:!0,fitViewOptions:d,fitViewResolver:_}),n.nodeQueue.push(v=>[...v]),_.promise}}},[]);return V.useMemo(()=>({...a,...e,viewportInitialized:r}),[r])}const bS=e=>e.selected,LH=typeof window<"u"?window:void 0;function OH({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=Ct(),{deleteElements:r}=Um(),a=el(e,{actInsideInputWithModifier:!1}),l=el(t,{target:LH});V.useEffect(()=>{if(a){const{edges:u,nodes:o}=n.getState();r({nodes:o.filter(bS),edges:u.filter(bS)}),n.setState({nodesSelectionActive:!1})}},[a]),V.useEffect(()=>{n.setState({multiSelectionActive:l})},[l])}function jH(e){const t=Ct();V.useEffect(()=>{const n=()=>{var a,l,u,o;if(!e.current||!(((l=(a=e.current).checkVisibility)==null?void 0:l.call(a))??!0))return!1;const r=Bm(e.current);(r.height===0||r.width===0)&&((o=(u=t.getState()).onError)==null||o.call(u,"004",Jn.error004())),t.setState({width:r.width||500,height:r.height||500})};if(e.current){n(),window.addEventListener("resize",n);const r=new ResizeObserver(()=>n());return r.observe(e.current),()=>{window.removeEventListener("resize",n),r&&e.current&&r.unobserve(e.current)}}},[])}const Eh={position:"absolute",width:"100%",height:"100%",top:0,left:0},BH=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function IH({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:a=.5,panOnScrollMode:l=Kr.Free,zoomOnDoubleClick:u=!0,panOnDrag:o=!0,defaultViewport:c,translateExtent:f,minZoom:p,maxZoom:d,zoomActivationKeyCode:_,preventScrolling:v=!0,children:w,noWheelClassName:C,noPanClassName:b,onViewportChange:S,isControlledViewport:x,paneClickDistance:y,selectionOnDrag:k}){const D=Ct(),T=V.useRef(null),{userSelectionActive:R,lib:N,connectionInProgress:M}=nt(BH,At),B=el(_),H=V.useRef();jH(T);const Y=V.useCallback(F=>{S==null||S({x:F[0],y:F[1],zoom:F[2]}),x||D.setState({transform:F})},[S,x]);return V.useEffect(()=>{if(T.current){H.current=Fz({domNode:T.current,minZoom:p,maxZoom:d,translateExtent:f,viewport:c,onDraggingChange:G=>D.setState(X=>X.paneDragging===G?X:{paneDragging:G}),onPanZoomStart:(G,X)=>{const{onViewportChangeStart:K,onMoveStart:O}=D.getState();O==null||O(G,X),K==null||K(X)},onPanZoom:(G,X)=>{const{onViewportChange:K,onMove:O}=D.getState();O==null||O(G,X),K==null||K(X)},onPanZoomEnd:(G,X)=>{const{onViewportChangeEnd:K,onMoveEnd:O}=D.getState();O==null||O(G,X),K==null||K(X)}});const{x:F,y:z,zoom:q}=H.current.getViewport();return D.setState({panZoom:H.current,transform:[F,z,q],domNode:T.current.closest(".react-flow")}),()=>{var G;(G=H.current)==null||G.destroy()}}},[]),V.useEffect(()=>{var F;(F=H.current)==null||F.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:a,panOnScrollMode:l,zoomOnDoubleClick:u,panOnDrag:o,zoomActivationKeyPressed:B,preventScrolling:v,noPanClassName:b,userSelectionActive:R,noWheelClassName:C,lib:N,onTransformChange:Y,connectionInProgress:M,selectionOnDrag:k,paneClickDistance:y})},[e,t,n,r,a,l,u,o,B,v,b,R,C,N,Y,M,k,y]),m.jsx("div",{className:"react-flow__renderer",ref:T,style:Eh,children:w})}const zH=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function HH(){const{userSelectionActive:e,userSelectionRect:t}=nt(zH,At);return e&&t?m.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}const Ep=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},FH=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function PH({isSelecting:e,selectionKeyPressed:t,selectionMode:n=Zo.Full,panOnDrag:r,autoPanOnSelection:a,paneClickDistance:l,selectionOnDrag:u,onSelectionStart:o,onSelectionEnd:c,onPaneClick:f,onPaneContextMenu:p,onPaneScroll:d,onPaneMouseEnter:_,onPaneMouseMove:v,onPaneMouseLeave:w,children:C}){const b=V.useRef(0),S=Ct(),{userSelectionActive:x,elementsSelectable:y,dragging:k,panBy:D,autoPanSpeed:T}=nt(FH,At),R=y&&(e||x),N=V.useRef(null),M=V.useRef(),B=V.useRef(new Set),H=V.useRef(new Set),Y=V.useRef(!1),F=V.useRef(!1),z=V.useRef({x:0,y:0}),q=V.useRef(!1),G=P=>{if(F.current||Y.current||S.getState().connection.inProgress){F.current=!1,Y.current=!1;return}f==null||f(P),S.getState().resetSelectedElements(),S.setState({nodesSelectionActive:!1})},X=P=>{if(Array.isArray(r)&&(r!=null&&r.includes(2))){P.preventDefault();return}p==null||p(P)},K=d?P=>d(P):void 0,O=P=>{F.current&&(P.stopPropagation(),F.current=!1)},L=P=>{var we,at;const{domNode:ee,transform:ie}=S.getState();if(M.current=ee==null?void 0:ee.getBoundingClientRect(),!M.current)return;const ge=P.target===N.current;if(!ge&&!!P.target.closest(".nokey")||!e||!(u&&ge||t)||P.button!==0||!P.isPrimary)return;(at=(we=P.target)==null?void 0:we.setPointerCapture)==null||at.call(we,P.pointerId),F.current=!1;const{x:Se,y:Ae}=Zn(P.nativeEvent,M.current),Ce=dl({x:Se,y:Ae},ie);S.setState({userSelectionRect:{width:0,height:0,startX:Ce.x,startY:Ce.y,x:Se,y:Ae}}),ge||(P.stopPropagation(),P.preventDefault())};function j(P,ee){const{userSelectionRect:ie}=S.getState();if(!ie)return;const{transform:ge,nodeLookup:he,edgeLookup:ye,connectionLookup:Se,triggerNodeChanges:Ae,triggerEdgeChanges:Ce,defaultEdgeOptions:we}=S.getState(),at={x:ie.startX,y:ie.startY},{x:ht,y:Ke}=ha(at,ge),ct={startX:at.x,startY:at.y,x:Pde.id)),H.current=new Set;const $e=(we==null?void 0:we.selectable)??!0;for(const de of B.current){const ne=Se.get(de);if(ne)for(const{edgeId:fe}of ne.values()){const be=ye.get(fe);be&&(be.selectable??$e)&&H.current.add(fe)}}if(!Gb(Rt,B.current)){const de=na(he,B.current,!0);Ae(de)}if(!Gb(Ze,H.current)){const de=na(ye,H.current);Ce(de)}S.setState({userSelectionRect:ct,userSelectionActive:!0,nodesSelectionActive:!1})}function $(){if(!a||!M.current)return;const[P,ee]=Om(z.current,M.current,T);D({x:P,y:ee}).then(ie=>{if(!F.current||!ie){b.current=requestAnimationFrame($);return}const{x:ge,y:he}=z.current;j(ge,he),b.current=requestAnimationFrame($)})}const U=()=>{cancelAnimationFrame(b.current),b.current=0,q.current=!1};V.useEffect(()=>()=>U(),[]);const Q=P=>{const{userSelectionRect:ee,transform:ie,resetSelectedElements:ge}=S.getState();if(!M.current||!ee)return;const{x:he,y:ye}=Zn(P.nativeEvent,M.current);z.current={x:he,y:ye};const Se=ha({x:ee.startX,y:ee.startY},ie);if(!F.current){const Ae=t?0:l;if(Math.hypot(he-Se.x,ye-Se.y)<=Ae)return;ge(),o==null||o(P)}F.current=!0,q.current||($(),q.current=!0),j(he,ye)},re=P=>{var ee,ie;if(!R){P.target===N.current&&S.getState().connection.inProgress&&(Y.current=!0);return}P.button===0&&((ie=(ee=P.target)==null?void 0:ee.releasePointerCapture)==null||ie.call(ee,P.pointerId),!x&&P.target===N.current&&S.getState().userSelectionRect&&(G==null||G(P)),S.setState({userSelectionActive:!1,userSelectionRect:null}),F.current&&(c==null||c(P),S.setState({nodesSelectionActive:B.current.size>0})),U())},ae=P=>{var ee,ie;(ie=(ee=P.target)==null?void 0:ee.releasePointerCapture)==null||ie.call(ee,P.pointerId),U()},Z=r===!0||Array.isArray(r)&&r.includes(0);return m.jsxs("div",{className:Pt(["react-flow__pane",{draggable:Z,dragging:k,selection:e}]),onClick:R?void 0:Ep(G,N),onContextMenu:Ep(X,N),onWheel:Ep(K,N),onPointerEnter:R?void 0:_,onPointerMove:R?Q:v,onPointerUp:re,onPointerCancel:R?ae:void 0,onPointerDownCapture:R?L:void 0,onClickCapture:R?O:void 0,onPointerLeave:w,ref:N,style:Eh,children:[C,m.jsx(HH,{})]})}function mg({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:a,unselectNodesAndEdges:l,multiSelectionActive:u,nodeLookup:o,onError:c}=t.getState(),f=o.get(e);if(!f){c==null||c("012",Jn.error012(e));return}t.setState({nodesSelectionActive:!1}),f.selected?(n||f.selected&&u)&&(l({nodes:[f],edges:[]}),requestAnimationFrame(()=>{var p;return(p=r==null?void 0:r.current)==null?void 0:p.blur()})):a([e])}function C2({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:a,isSelectable:l,nodeClickDistance:u}){const o=Ct(),[c,f]=V.useState(!1),p=V.useRef();return V.useEffect(()=>{if(!t)return p.current=kz({getStoreItems:()=>o.getState(),onNodeMouseDown:d=>{mg({id:d,store:o,nodeRef:e})},onDragStart:()=>{f(!0)},onDragStop:()=>{f(!1)}}),()=>{var d;(d=p.current)==null||d.destroy(),p.current=void 0}},[t,o,e]),V.useEffect(()=>{t||!e.current||!p.current||p.current.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:l,nodeId:a,nodeClickDistance:u})},[n,r,t,l,e,a,u]),c}const UH=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function E2(){const e=Ct();return V.useCallback(n=>{const{nodeExtent:r,snapToGrid:a,snapGrid:l,nodesDraggable:u,onError:o,updateNodePositions:c,nodeLookup:f,nodeOrigin:p}=e.getState(),d=new Map,_=UH(u),v=a?l[0]:5,w=a?l[1]:5,C=n.direction.x*v*n.factor,b=n.direction.y*w*n.factor;for(const[,S]of f){if(!_(S))continue;let x={x:S.internals.positionAbsolute.x+C,y:S.internals.positionAbsolute.y+b};a&&(x=fl(x,l));const{position:y,positionAbsolute:k}=GC({nodeId:S.id,nextPosition:x,nodeLookup:f,nodeExtent:r,nodeOrigin:p,onError:o});S.position=y,S.internals.positionAbsolute=k,d.set(S.id,S)}c(d)},[])}const $m=V.createContext(null),$H=$m.Provider;$m.Consumer;const k2=()=>V.useContext($m),GH=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),A2=V.createContext(null);function qH({children:e}){const t=nt(GH,At);return m.jsx(A2.Provider,{value:t,children:e})}function VH(){const e=V.useContext(A2);if(!e)throw new Error("useHandleConfig must be used within a HandleConfigProvider");return e}const YH={connectingFrom:!1,connectingTo:!1,clickConnecting:!1,isPossibleEndHandle:!0,connectionInProcess:!1,clickConnectionInProcess:!1,valid:!1},WH=(e,t,n)=>r=>{const{connectionClickStartHandle:a,connectionMode:l,connection:u}=r,{fromHandle:o,toHandle:c,isValid:f}=u;if(!o&&!a)return YH;const p=(c==null?void 0:c.nodeId)===e&&(c==null?void 0:c.id)===t&&(c==null?void 0:c.type)===n;return{connectingFrom:(o==null?void 0:o.nodeId)===e&&(o==null?void 0:o.id)===t&&(o==null?void 0:o.type)===n,connectingTo:p,clickConnecting:(a==null?void 0:a.nodeId)===e&&(a==null?void 0:a.id)===t&&(a==null?void 0:a.type)===n,isPossibleEndHandle:l===ca.Strict?(o==null?void 0:o.type)!==n:e!==(o==null?void 0:o.nodeId)||t!==(o==null?void 0:o.id),connectionInProcess:!!o,clickConnectionInProcess:!!a,valid:p&&f}};function XH({type:e="source",position:t=Re.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:a=!0,isConnectableEnd:l=!0,id:u,onConnect:o,children:c,className:f,onMouseDown:p,onTouchStart:d,..._},v){var q,G;const w=u||null,C=e==="target",b=Ct(),S=k2(),{connectOnClick:x,noPanClassName:y,rfId:k}=VH(),{connectingFrom:D,connectingTo:T,clickConnecting:R,isPossibleEndHandle:N,connectionInProcess:M,clickConnectionInProcess:B,valid:H}=nt(WH(S,w,e),At);S||(G=(q=b.getState()).onError)==null||G.call(q,"010",Jn.error010());const Y=X=>{const{defaultEdgeOptions:K,onConnect:O,hasDefaultEdges:L}=b.getState(),j={...K,...X};if(L){const{edges:$,setEdges:U,onError:Q}=b.getState();U(AH(j,$,{onError:Q}))}O==null||O(j),o==null||o(j)},F=X=>{if(!S)return;const K=JC(X.nativeEvent);if(a&&(K&&X.button===0||!K)){const O=b.getState();gg.onPointerDown(X.nativeEvent,{handleDomNode:X.currentTarget,autoPanOnConnect:O.autoPanOnConnect,connectionMode:O.connectionMode,connectionRadius:O.connectionRadius,domNode:O.domNode,nodeLookup:O.nodeLookup,lib:O.lib,isTarget:C,handleId:w,nodeId:S,flowId:O.rfId,panBy:O.panBy,cancelConnection:O.cancelConnection,onConnectStart:O.onConnectStart,onConnectEnd:(...L)=>{var j,$;return($=(j=b.getState()).onConnectEnd)==null?void 0:$.call(j,...L)},updateConnection:O.updateConnection,onConnect:Y,isValidConnection:n||((...L)=>{var j,$;return(($=(j=b.getState()).isValidConnection)==null?void 0:$.call(j,...L))??!0}),getTransform:()=>b.getState().transform,getFromHandle:()=>b.getState().connection.fromHandle,autoPanSpeed:O.autoPanSpeed,dragThreshold:O.connectionDragThreshold})}K?p==null||p(X):d==null||d(X)},z=X=>{const{onClickConnectStart:K,onClickConnectEnd:O,connectionClickStartHandle:L,connectionMode:j,isValidConnection:$,lib:U,rfId:Q,nodeLookup:re,connection:ae}=b.getState();if(!S||!L&&!a)return;if(!L){K==null||K(X.nativeEvent,{nodeId:S,handleId:w,handleType:e}),b.setState({connectionClickStartHandle:{nodeId:S,type:e,id:w}});return}const Z=ZC(X.target),P=n||$,{connection:ee,isValid:ie}=gg.isValid(X.nativeEvent,{handle:{nodeId:S,id:w,type:e},connectionMode:j,fromNodeId:L.nodeId,fromHandleId:L.id||null,fromType:L.type,isValidConnection:P,flowId:Q,doc:Z,lib:U,nodeLookup:re});ie&&ee&&Y(ee);const ge=structuredClone(ae);delete ge.inProgress,ge.toPosition=ge.toHandle?ge.toHandle.position:null,O==null||O(X,ge),b.setState({connectionClickStartHandle:null})};return m.jsx("div",{"data-handleid":w,"data-nodeid":S,"data-handlepos":t,"data-id":`${k}-${S}-${w}-${e}`,className:Pt(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",y,f,{source:!C,target:C,connectable:r,connectablestart:a,connectableend:l,clickconnecting:R,connectingfrom:D,connectingto:T,valid:H,connectionindicator:r&&(!M||N)&&(M||B?l:a)}]),onMouseDown:F,onTouchStart:F,onClick:x?z:void 0,ref:v,..._,children:c})}const da=V.memo(S2(XH));function KH({data:e,isConnectable:t,sourcePosition:n=Re.Bottom}){return m.jsxs(m.Fragment,{children:[e==null?void 0:e.label,m.jsx(da,{type:"source",position:n,isConnectable:t})]})}function ZH({data:e,isConnectable:t,targetPosition:n=Re.Top,sourcePosition:r=Re.Bottom}){return m.jsxs(m.Fragment,{children:[m.jsx(da,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,m.jsx(da,{type:"source",position:r,isConnectable:t})]})}function QH(){return null}function JH({data:e,isConnectable:t,targetPosition:n=Re.Top}){return m.jsxs(m.Fragment,{children:[m.jsx(da,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]})}const Iu={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},SS={input:KH,default:ZH,output:JH,group:QH};function eF(e){var t,n,r,a;return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??((t=e.style)==null?void 0:t.width),height:e.height??e.initialHeight??((n=e.style)==null?void 0:n.height)}:{width:e.width??((r=e.style)==null?void 0:r.width),height:e.height??((a=e.style)==null?void 0:a.height)}}const tF=e=>{const{width:t,height:n,x:r,y:a}=hl(e.nodeLookup,{filter:l=>!!l.selected});return{width:Kn(t)?t:null,height:Kn(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${a}px)`}};function nF({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=Ct(),{width:a,height:l,transformString:u,userSelectionActive:o}=nt(tF,At),c=E2(),f=V.useRef(null);V.useEffect(()=>{var v;n||(v=f.current)==null||v.focus({preventScroll:!0})},[n]);const p=!o&&a!==null&&l!==null;if(C2({nodeRef:f,disabled:!p}),!p)return null;const d=e?v=>{const w=r.getState().nodes.filter(C=>C.selected);e(v,w)}:void 0,_=v=>{Object.prototype.hasOwnProperty.call(Iu,v.key)&&(v.preventDefault(),c({direction:Iu[v.key],factor:v.shiftKey?4:1}))};return m.jsx("div",{className:Pt(["react-flow__nodesselection","react-flow__container",t]),style:{transform:u},children:m.jsx("div",{ref:f,className:"react-flow__nodesselection-rect",onContextMenu:d,tabIndex:n?void 0:-1,onKeyDown:n?void 0:_,style:{width:a,height:l}})})}const xS=typeof window<"u"?window:void 0,iF=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function T2({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:a,onPaneContextMenu:l,onPaneScroll:u,paneClickDistance:o,deleteKeyCode:c,selectionKeyCode:f,selectionOnDrag:p,selectionMode:d,onSelectionStart:_,onSelectionEnd:v,multiSelectionKeyCode:w,panActivationKeyCode:C,zoomActivationKeyCode:b,elementsSelectable:S,zoomOnScroll:x,zoomOnPinch:y,panOnScroll:k,panOnScrollSpeed:D,panOnScrollMode:T,zoomOnDoubleClick:R,panOnDrag:N,autoPanOnSelection:M,defaultViewport:B,translateExtent:H,minZoom:Y,maxZoom:F,preventScrolling:z,onSelectionContextMenu:q,noWheelClassName:G,noPanClassName:X,disableKeyboardA11y:K,onViewportChange:O,isControlledViewport:L}){const{nodesSelectionActive:j,userSelectionActive:$}=nt(iF,At),U=el(f,{target:xS}),Q=el(C,{target:xS}),re=Q||N,ae=Q||k,Z=p&&re!==!0,P=U||$||Z;return OH({deleteKeyCode:c,multiSelectionKeyCode:w}),m.jsx(IH,{onPaneContextMenu:l,elementsSelectable:S,zoomOnScroll:x,zoomOnPinch:y,panOnScroll:ae,panOnScrollSpeed:D,panOnScrollMode:T,zoomOnDoubleClick:R,panOnDrag:!U&&re,defaultViewport:B,translateExtent:H,minZoom:Y,maxZoom:F,zoomActivationKeyCode:b,preventScrolling:z,noWheelClassName:G,noPanClassName:X,onViewportChange:O,isControlledViewport:L,paneClickDistance:o,selectionOnDrag:Z,children:m.jsxs(PH,{onSelectionStart:_,onSelectionEnd:v,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:a,onPaneContextMenu:l,onPaneScroll:u,panOnDrag:re,autoPanOnSelection:M,isSelecting:!!P,selectionMode:d,selectionKeyPressed:U,paneClickDistance:o,selectionOnDrag:Z,children:[e,j&&m.jsx(nF,{onSelectionContextMenu:q,noPanClassName:X,disableKeyboardA11y:K})]})})}T2.displayName="FlowRenderer";const rF=V.memo(T2),sF=e=>t=>e?Lm(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(n=>n.id):Array.from(t.nodeLookup.keys());function aF(e){return nt(V.useCallback(sF(e),[e]),At)}const oF=e=>e.updateNodeInternals;function lF(){const e=nt(oF),[t]=V.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const r=new Map;n.forEach(a=>{const l=a.target.getAttribute("data-id");r.set(l,{id:l,nodeElement:a.target,force:!0})}),e(r)}));return V.useEffect(()=>()=>{t==null||t.disconnect()},[t]),t}function cF({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){const a=Ct(),l=V.useRef(null),u=V.useRef(null),o=V.useRef(e.sourcePosition),c=V.useRef(e.targetPosition),f=V.useRef(t),p=n&&!!e.internals.handleBounds;return V.useEffect(()=>{l.current&&!e.hidden&&(!p||u.current!==l.current)&&(u.current&&(r==null||r.unobserve(u.current)),r==null||r.observe(l.current),u.current=l.current)},[p,e.hidden]),V.useEffect(()=>()=>{u.current&&(r==null||r.unobserve(u.current),u.current=null)},[]),V.useEffect(()=>{if(l.current){const d=f.current!==t,_=o.current!==e.sourcePosition,v=c.current!==e.targetPosition;(d||_||v)&&(f.current=t,o.current=e.sourcePosition,c.current=e.targetPosition,a.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:l.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),l}function uF({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:a,onContextMenu:l,onDoubleClick:u,nodesDraggable:o,elementsSelectable:c,nodesConnectable:f,nodesFocusable:p,resizeObserver:d,noDragClassName:_,noPanClassName:v,disableKeyboardA11y:w,rfId:C,nodeTypes:b,nodeClickDistance:S,onError:x}){const{node:y,internals:k,isParent:D}=nt(P=>{const ee=P.nodeLookup.get(e),ie=P.parentLookup.has(e);return{node:ee,internals:ee.internals,isParent:ie}},At);let T=y.type||"default",R=(b==null?void 0:b[T])||SS[T];R===void 0&&(x==null||x("003",Jn.error003(T)),T="default",R=(b==null?void 0:b.default)||SS.default);const N=!!(y.draggable||o&&typeof y.draggable>"u"),M=!!(y.selectable||c&&typeof y.selectable>"u"),B=!!(y.connectable||f&&typeof y.connectable>"u"),H=!!(y.focusable||p&&typeof y.focusable>"u"),Y=Ct(),F=XC(y),z=cF({node:y,nodeType:T,hasDimensions:F,resizeObserver:d}),q=C2({nodeRef:z,disabled:y.hidden||!N,noDragClassName:_,handleSelector:y.dragHandle,nodeId:e,isSelectable:M,nodeClickDistance:S}),G=E2();if(y.hidden)return null;const X=pi(y),K=eF(y),O=M||N||t||n||r||a,L=n?P=>n(P,{...k.userNode}):void 0,j=r?P=>r(P,{...k.userNode}):void 0,$=a?P=>a(P,{...k.userNode}):void 0,U=l?P=>l(P,{...k.userNode}):void 0,Q=u?P=>u(P,{...k.userNode}):void 0,re=P=>{const{selectNodesOnDrag:ee,nodeDragThreshold:ie}=Y.getState();M&&(!ee||!N||ie>0)&&mg({id:e,store:Y,nodeRef:z}),t&&t(P,{...k.userNode})},ae=P=>{if(!(QC(P.nativeEvent)||w)){if(HC.includes(P.key)&&M){const ee=P.key==="Escape";mg({id:e,store:Y,unselect:ee,nodeRef:z})}else if(N&&y.selected&&Object.prototype.hasOwnProperty.call(Iu,P.key)){P.preventDefault();const{ariaLabelConfig:ee}=Y.getState();Y.setState({ariaLiveMessage:ee["node.a11yDescription.ariaLiveMessage"]({direction:P.key.replace("Arrow","").toLowerCase(),x:~~k.positionAbsolute.x,y:~~k.positionAbsolute.y})}),G({direction:Iu[P.key],factor:P.shiftKey?4:1})}}},Z=()=>{var Se;if(w||!((Se=z.current)!=null&&Se.matches(":focus-visible")))return;const{transform:P,width:ee,height:ie,autoPanOnNodeFocus:ge,setCenter:he}=Y.getState();if(!ge)return;Lm(new Map([[e,y]]),{x:0,y:0,width:ee,height:ie},P,!0).length>0||he(y.position.x+X.width/2,y.position.y+X.height/2,{zoom:P[2]})};return m.jsx("div",{className:Pt(["react-flow__node",`react-flow__node-${T}`,{[v]:N},y.className,{selected:y.selected,selectable:M,parent:D,draggable:N,dragging:q}]),ref:z,style:{zIndex:k.z,transform:`translate(${k.positionAbsolute.x}px,${k.positionAbsolute.y}px)`,pointerEvents:O?"all":"none",visibility:F?"visible":"hidden",...y.style,...K},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:L,onMouseMove:j,onMouseLeave:$,onContextMenu:U,onClick:re,onDoubleClick:Q,onKeyDown:H?ae:void 0,tabIndex:H?0:void 0,onFocus:H?Z:void 0,role:y.ariaRole??(H?"group":void 0),"aria-roledescription":"node","aria-describedby":w?void 0:`${_2}-${C}`,"aria-label":y.ariaLabel,...y.domAttributes,children:m.jsx($H,{value:e,children:m.jsx(R,{id:e,data:y.data,type:T,positionAbsoluteX:k.positionAbsolute.x,positionAbsoluteY:k.positionAbsolute.y,selected:y.selected??!1,selectable:M,draggable:N,deletable:y.deletable??!0,isConnectable:B,sourcePosition:y.sourcePosition,targetPosition:y.targetPosition,dragging:q,dragHandle:y.dragHandle,zIndex:k.z,parentId:y.parentId,...X})})})}var hF=V.memo(uF);const fF=e=>({nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function N2(e){const{nodesConnectable:t,nodesFocusable:n,elementsSelectable:r,onError:a}=nt(fF,At),l=aF(e.onlyRenderVisibleElements),u=lF();return m.jsx("div",{className:"react-flow__nodes",style:Eh,children:l.map(o=>m.jsx(hF,{id:o,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:u,nodesDraggable:e.nodesDraggable??!0,nodesConnectable:t,nodesFocusable:n,elementsSelectable:r,nodeClickDistance:e.nodeClickDistance,onError:a},o))})}N2.displayName="NodeRenderer";const dF=V.memo(N2);function pF(e){return nt(V.useCallback(n=>{if(!e)return n.edges.map(a=>a.id);const r=[];if(n.width&&n.height)for(const a of n.edges){const l=n.nodeLookup.get(a.source),u=n.nodeLookup.get(a.target);l&&u&&oz({sourceNode:l,targetNode:u,width:n.width,height:n.height,transform:n.transform})&&r.push(a.id)}return r},[e]),At)}const gF=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e}};return m.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},mF=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e,fill:e}};return m.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},wS={[Ou.Arrow]:gF,[Ou.ArrowClosed]:mF};function _F(e){const t=Ct();return V.useMemo(()=>{var a,l;return Object.prototype.hasOwnProperty.call(wS,e)?wS[e]:((l=(a=t.getState()).onError)==null||l.call(a,"009",Jn.error009(e)),null)},[e])}const vF=({id:e,type:t,color:n,width:r=12.5,height:a=12.5,markerUnits:l="strokeWidth",strokeWidth:u,orient:o="auto-start-reverse"})=>{const c=_F(t);return c?m.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${a}`,viewBox:"-10 -10 20 20",markerUnits:l,orient:o,refX:"0",refY:"0",children:m.jsx(c,{color:n,strokeWidth:u})}):null},D2=({defaultColor:e,rfId:t})=>{const n=nt(l=>l.edges),r=nt(l=>l.defaultEdgeOptions),a=V.useMemo(()=>gz(n,{id:t,defaultColor:e,defaultMarkerStart:r==null?void 0:r.markerStart,defaultMarkerEnd:r==null?void 0:r.markerEnd}),[n,r,t,e]);return a.length?m.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:m.jsx("defs",{children:a.map(l=>m.jsx(vF,{id:l.id,type:l.type,color:l.color,width:l.width,height:l.height,markerUnits:l.markerUnits,strokeWidth:l.strokeWidth,orient:l.orient},l.id))})}):null};D2.displayName="MarkerDefinitions";var yF=V.memo(D2);function R2({x:e,y:t,label:n,labelStyle:r,labelShowBg:a=!0,labelBgStyle:l,labelBgPadding:u=[2,4],labelBgBorderRadius:o=2,children:c,className:f,...p}){const[d,_]=V.useState({x:1,y:0,width:0,height:0}),v=Pt(["react-flow__edge-textwrapper",f]),w=V.useRef(null);return V.useEffect(()=>{if(w.current){const C=w.current.getBBox();_({x:C.x,y:C.y,width:C.width,height:C.height})}},[n]),n?m.jsxs("g",{transform:`translate(${e-d.width/2} ${t-d.height/2})`,className:v,visibility:d.width?"visible":"hidden",...p,children:[a&&m.jsx("rect",{width:d.width+2*u[0],x:-u[0],y:-u[1],height:d.height+2*u[1],className:"react-flow__edge-textbg",style:l,rx:o,ry:o}),m.jsx("text",{className:"react-flow__edge-text",y:d.height/2,dy:"0.3em",ref:w,style:r,children:n}),c]}):null}R2.displayName="EdgeText";const bF=V.memo(R2);function kh({path:e,labelX:t,labelY:n,label:r,labelStyle:a,labelShowBg:l,labelBgStyle:u,labelBgPadding:o,labelBgBorderRadius:c,interactionWidth:f=20,...p}){return m.jsxs(m.Fragment,{children:[m.jsx("path",{...p,d:e,fill:"none",className:Pt(["react-flow__edge-path",p.className])}),f?m.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:f,className:"react-flow__edge-interaction"}):null,r&&Kn(t)&&Kn(n)?m.jsx(bF,{x:t,y:n,label:r,labelStyle:a,labelShowBg:l,labelBgStyle:u,labelBgPadding:o,labelBgBorderRadius:c}):null]})}function CS({pos:e,x1:t,y1:n,x2:r,y2:a}){return e===Re.Left||e===Re.Right?[.5*(t+r),n]:[t,.5*(n+a)]}function M2({sourceX:e,sourceY:t,sourcePosition:n=Re.Bottom,targetX:r,targetY:a,targetPosition:l=Re.Top}){const[u,o]=CS({pos:n,x1:e,y1:t,x2:r,y2:a}),[c,f]=CS({pos:l,x1:r,y1:a,x2:e,y2:t}),[p,d,_,v]=e2({sourceX:e,sourceY:t,targetX:r,targetY:a,sourceControlX:u,sourceControlY:o,targetControlX:c,targetControlY:f});return[`M${e},${t} C${u},${o} ${c},${f} ${r},${a}`,p,d,_,v]}function L2(e){return V.memo(({id:t,sourceX:n,sourceY:r,targetX:a,targetY:l,sourcePosition:u,targetPosition:o,label:c,labelStyle:f,labelShowBg:p,labelBgStyle:d,labelBgPadding:_,labelBgBorderRadius:v,style:w,markerEnd:C,markerStart:b,interactionWidth:S})=>{const[x,y,k]=M2({sourceX:n,sourceY:r,sourcePosition:u,targetX:a,targetY:l,targetPosition:o}),D=e.isInternal?void 0:t;return m.jsx(kh,{id:D,path:x,labelX:y,labelY:k,label:c,labelStyle:f,labelShowBg:p,labelBgStyle:d,labelBgPadding:_,labelBgBorderRadius:v,style:w,markerEnd:C,markerStart:b,interactionWidth:S})})}const SF=L2({isInternal:!1}),O2=L2({isInternal:!0});SF.displayName="SimpleBezierEdge";O2.displayName="SimpleBezierEdgeInternal";function j2(e){return V.memo(({id:t,sourceX:n,sourceY:r,targetX:a,targetY:l,label:u,labelStyle:o,labelShowBg:c,labelBgStyle:f,labelBgPadding:p,labelBgBorderRadius:d,style:_,sourcePosition:v=Re.Bottom,targetPosition:w=Re.Top,markerEnd:C,markerStart:b,pathOptions:S,interactionWidth:x})=>{const[y,k,D]=fg({sourceX:n,sourceY:r,sourcePosition:v,targetX:a,targetY:l,targetPosition:w,borderRadius:S==null?void 0:S.borderRadius,offset:S==null?void 0:S.offset,stepPosition:S==null?void 0:S.stepPosition}),T=e.isInternal?void 0:t;return m.jsx(kh,{id:T,path:y,labelX:k,labelY:D,label:u,labelStyle:o,labelShowBg:c,labelBgStyle:f,labelBgPadding:p,labelBgBorderRadius:d,style:_,markerEnd:C,markerStart:b,interactionWidth:x})})}const B2=j2({isInternal:!1}),I2=j2({isInternal:!0});B2.displayName="SmoothStepEdge";I2.displayName="SmoothStepEdgeInternal";function z2(e){return V.memo(({id:t,...n})=>{var a;const r=e.isInternal?void 0:t;return m.jsx(B2,{...n,id:r,pathOptions:V.useMemo(()=>{var l;return{borderRadius:0,offset:(l=n.pathOptions)==null?void 0:l.offset}},[(a=n.pathOptions)==null?void 0:a.offset])})})}const xF=z2({isInternal:!1}),H2=z2({isInternal:!0});xF.displayName="StepEdge";H2.displayName="StepEdgeInternal";function F2(e){return V.memo(({id:t,sourceX:n,sourceY:r,targetX:a,targetY:l,label:u,labelStyle:o,labelShowBg:c,labelBgStyle:f,labelBgPadding:p,labelBgBorderRadius:d,style:_,markerEnd:v,markerStart:w,interactionWidth:C})=>{const[b,S,x]=i2({sourceX:n,sourceY:r,targetX:a,targetY:l}),y=e.isInternal?void 0:t;return m.jsx(kh,{id:y,path:b,labelX:S,labelY:x,label:u,labelStyle:o,labelShowBg:c,labelBgStyle:f,labelBgPadding:p,labelBgBorderRadius:d,style:_,markerEnd:v,markerStart:w,interactionWidth:C})})}const wF=F2({isInternal:!1}),P2=F2({isInternal:!0});wF.displayName="StraightEdge";P2.displayName="StraightEdgeInternal";function U2(e){return V.memo(({id:t,sourceX:n,sourceY:r,targetX:a,targetY:l,sourcePosition:u=Re.Bottom,targetPosition:o=Re.Top,label:c,labelStyle:f,labelShowBg:p,labelBgStyle:d,labelBgPadding:_,labelBgBorderRadius:v,style:w,markerEnd:C,markerStart:b,pathOptions:S,interactionWidth:x})=>{const[y,k,D]=t2({sourceX:n,sourceY:r,sourcePosition:u,targetX:a,targetY:l,targetPosition:o,curvature:S==null?void 0:S.curvature}),T=e.isInternal?void 0:t;return m.jsx(kh,{id:T,path:y,labelX:k,labelY:D,label:c,labelStyle:f,labelShowBg:p,labelBgStyle:d,labelBgPadding:_,labelBgBorderRadius:v,style:w,markerEnd:C,markerStart:b,interactionWidth:x})})}const CF=U2({isInternal:!1}),$2=U2({isInternal:!0});CF.displayName="BezierEdge";$2.displayName="BezierEdgeInternal";const ES={default:$2,straight:P2,step:H2,smoothstep:I2,simplebezier:O2},kS={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null,zIndex:void 0},EF=(e,t,n)=>n===Re.Left?e-t:n===Re.Right?e+t:e,kF=(e,t,n)=>n===Re.Top?e-t:n===Re.Bottom?e+t:e,AS="react-flow__edgeupdater";function TS({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:a,onMouseEnter:l,onMouseOut:u,type:o}){return m.jsx("circle",{onMouseDown:a,onMouseEnter:l,onMouseOut:u,className:Pt([AS,`${AS}-${o}`]),cx:EF(t,r,e),cy:kF(n,r,e),r,stroke:"transparent",fill:"transparent"})}function AF({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:a,targetX:l,targetY:u,sourcePosition:o,targetPosition:c,onReconnect:f,onReconnectStart:p,onReconnectEnd:d,setReconnecting:_,setUpdateHover:v}){const w=Ct(),C=(k,D)=>{if(k.button!==0)return;const{autoPanOnConnect:T,domNode:R,connectionMode:N,connectionRadius:M,lib:B,onConnectStart:H,cancelConnection:Y,nodeLookup:F,rfId:z,panBy:q,updateConnection:G}=w.getState(),X=D.type==="target",K=(j,$)=>{_(!1),d==null||d(j,n,D.type,$)},O=j=>f==null?void 0:f(n,j),L=(j,$)=>{_(!0),p==null||p(k,n,D.type),H==null||H(j,$)};gg.onPointerDown(k.nativeEvent,{autoPanOnConnect:T,connectionMode:N,connectionRadius:M,domNode:R,handleId:D.id,nodeId:D.nodeId,nodeLookup:F,isTarget:X,edgeUpdaterType:D.type,lib:B,flowId:z,cancelConnection:Y,panBy:q,isValidConnection:(...j)=>{var $,U;return((U=($=w.getState()).isValidConnection)==null?void 0:U.call($,...j))??!0},onConnect:O,onConnectStart:L,onConnectEnd:(...j)=>{var $,U;return(U=($=w.getState()).onConnectEnd)==null?void 0:U.call($,...j)},onReconnectEnd:K,updateConnection:G,getTransform:()=>w.getState().transform,getFromHandle:()=>w.getState().connection.fromHandle,dragThreshold:w.getState().connectionDragThreshold,handleDomNode:k.currentTarget})},b=k=>C(k,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),S=k=>C(k,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),x=()=>v(!0),y=()=>v(!1);return m.jsxs(m.Fragment,{children:[(e===!0||e==="source")&&m.jsx(TS,{position:o,centerX:r,centerY:a,radius:t,onMouseDown:b,onMouseEnter:x,onMouseOut:y,type:"source"}),(e===!0||e==="target")&&m.jsx(TS,{position:c,centerX:l,centerY:u,radius:t,onMouseDown:S,onMouseEnter:x,onMouseOut:y,type:"target"})]})}function TF({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:a,onDoubleClick:l,onContextMenu:u,onMouseEnter:o,onMouseMove:c,onMouseLeave:f,reconnectRadius:p,onReconnect:d,onReconnectStart:_,onReconnectEnd:v,rfId:w,edgeTypes:C,noPanClassName:b,onError:S,disableKeyboardA11y:x}){let y=nt(he=>he.edgeLookup.get(e));const k=nt(he=>he.defaultEdgeOptions);y=k?{...k,...y}:y;let D=y.type||"default",T=(C==null?void 0:C[D])||ES[D];T===void 0&&(S==null||S("011",Jn.error011(D)),D="default",T=(C==null?void 0:C.default)||ES.default);const R=!!(y.focusable||t&&typeof y.focusable>"u"),N=typeof d<"u"&&(y.reconnectable||n&&typeof y.reconnectable>"u"),M=!!(y.selectable||r&&typeof y.selectable>"u"),B=V.useRef(null),[H,Y]=V.useState(!1),[F,z]=V.useState(!1),q=Ct(),{zIndex:G=y.zIndex,sourceX:X,sourceY:K,targetX:O,targetY:L,sourcePosition:j,targetPosition:$}=nt(V.useCallback(he=>{const ye=he.nodeLookup.get(y.source),Se=he.nodeLookup.get(y.target);if(!ye||!Se)return kS;const Ae=pz({id:e,sourceNode:ye,targetNode:Se,sourceHandle:y.sourceHandle||null,targetHandle:y.targetHandle||null,connectionMode:he.connectionMode,onError:S}),Ce=az({selected:y.selected,zIndex:y.zIndex,sourceNode:ye,targetNode:Se,elevateOnSelect:he.elevateEdgesOnSelect,zIndexMode:he.zIndexMode});return{...Ae||kS,zIndex:Ce}},[y.source,y.target,y.sourceHandle,y.targetHandle,y.selected,y.zIndex]),At),U=V.useMemo(()=>y.markerStart?`url('#${dg(y.markerStart,w)}')`:void 0,[y.markerStart,w]),Q=V.useMemo(()=>y.markerEnd?`url('#${dg(y.markerEnd,w)}')`:void 0,[y.markerEnd,w]);if(y.hidden||X===null||K===null||O===null||L===null)return null;const re=he=>{var Ce;const{addSelectedEdges:ye,unselectNodesAndEdges:Se,multiSelectionActive:Ae}=q.getState();M&&(q.setState({nodesSelectionActive:!1}),y.selected&&Ae?(Se({nodes:[],edges:[y]}),(Ce=B.current)==null||Ce.blur()):ye([e])),a&&a(he,y)},ae=l?he=>{l(he,{...y})}:void 0,Z=u?he=>{u(he,{...y})}:void 0,P=o?he=>{o(he,{...y})}:void 0,ee=c?he=>{c(he,{...y})}:void 0,ie=f?he=>{f(he,{...y})}:void 0,ge=he=>{var ye;if(!x&&HC.includes(he.key)&&M){const{unselectNodesAndEdges:Se,addSelectedEdges:Ae}=q.getState();he.key==="Escape"?((ye=B.current)==null||ye.blur(),Se({edges:[y]})):Ae([e])}};return m.jsx("svg",{style:{zIndex:G},children:m.jsxs("g",{className:Pt(["react-flow__edge",`react-flow__edge-${D}`,y.className,b,{selected:y.selected,animated:y.animated,inactive:!M&&!a,updating:H,selectable:M}]),onClick:re,onDoubleClick:ae,onContextMenu:Z,onMouseEnter:P,onMouseMove:ee,onMouseLeave:ie,onKeyDown:R?ge:void 0,tabIndex:R?0:void 0,role:y.ariaRole??(R?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":y.ariaLabel===null?void 0:y.ariaLabel||`Edge from ${y.source} to ${y.target}`,"aria-describedby":R?`${v2}-${w}`:void 0,ref:B,...y.domAttributes,children:[!F&&m.jsx(T,{id:e,source:y.source,target:y.target,type:y.type,selected:y.selected,animated:y.animated,selectable:M,deletable:y.deletable??!0,label:y.label,labelStyle:y.labelStyle,labelShowBg:y.labelShowBg,labelBgStyle:y.labelBgStyle,labelBgPadding:y.labelBgPadding,labelBgBorderRadius:y.labelBgBorderRadius,sourceX:X,sourceY:K,targetX:O,targetY:L,sourcePosition:j,targetPosition:$,data:y.data,style:y.style,sourceHandleId:y.sourceHandle,targetHandleId:y.targetHandle,markerStart:U,markerEnd:Q,pathOptions:"pathOptions"in y?y.pathOptions:void 0,interactionWidth:y.interactionWidth}),N&&m.jsx(AF,{edge:y,isReconnectable:N,reconnectRadius:p,onReconnect:d,onReconnectStart:_,onReconnectEnd:v,sourceX:X,sourceY:K,targetX:O,targetY:L,sourcePosition:j,targetPosition:$,setUpdateHover:Y,setReconnecting:z})]})})}var NF=V.memo(TF);const DF=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function G2({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:a,onReconnect:l,onEdgeContextMenu:u,onEdgeMouseEnter:o,onEdgeMouseMove:c,onEdgeMouseLeave:f,onEdgeClick:p,reconnectRadius:d,onEdgeDoubleClick:_,onReconnectStart:v,onReconnectEnd:w,disableKeyboardA11y:C}){const{edgesFocusable:b,edgesReconnectable:S,elementsSelectable:x,onError:y}=nt(DF,At),k=pF(t);return m.jsxs("div",{className:"react-flow__edges",children:[m.jsx(yF,{defaultColor:e,rfId:n}),k.map(D=>m.jsx(NF,{id:D,edgesFocusable:b,edgesReconnectable:S,elementsSelectable:x,noPanClassName:a,onReconnect:l,onContextMenu:u,onMouseEnter:o,onMouseMove:c,onMouseLeave:f,onClick:p,reconnectRadius:d,onDoubleClick:_,onReconnectStart:v,onReconnectEnd:w,rfId:n,onError:y,edgeTypes:r,disableKeyboardA11y:C},D))]})}G2.displayName="EdgeRenderer";const RF=V.memo(G2),NS=e=>`translate(${e[0]}px,${e[1]}px) scale(${e[2]})`;function MF({children:e}){const t=Ct(),n=V.useRef(null),[r]=V.useState(()=>t.getState().transform);return x2(()=>{let a=null;const l=()=>{const u=t.getState().transform;a&&u[0]===a[0]&&u[1]===a[1]&&u[2]===a[2]||(a=u,n.current&&(n.current.style.transform=NS(u)))};return l(),t.subscribe(l)},[t]),m.jsx("div",{ref:n,className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:NS(r)},children:e})}function LF(e){const t=Um(),n=V.useRef(!1);V.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const OF=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function jF(e){const t=nt(OF),n=Ct();return V.useEffect(()=>{e&&(t==null||t(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function BF(e){return e.connection.inProgress?{...e.connection,to:dl(e.connection.to,e.transform)}:{...e.connection}}function IF(e){return BF}function zF(e){const t=IF();return nt(t,At)}const HF=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function FF({containerStyle:e,style:t,type:n,component:r}){const{nodesConnectable:a,width:l,height:u,isValid:o,inProgress:c}=nt(HF,At);return!(l&&a&&c)?null:m.jsx("svg",{style:e,width:l,height:u,className:"react-flow__connectionline react-flow__container",children:m.jsx("g",{className:Pt(["react-flow__connection",UC(o)]),children:m.jsx(q2,{style:t,type:n,CustomComponent:r,isValid:o})})})}const q2=({style:e,type:t=yr.Bezier,CustomComponent:n,isValid:r})=>{const{inProgress:a,from:l,fromNode:u,fromHandle:o,fromPosition:c,to:f,toNode:p,toHandle:d,toPosition:_,pointer:v}=zF();if(!a)return;if(n)return m.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:u,fromHandle:o,fromX:l.x,fromY:l.y,toX:f.x,toY:f.y,fromPosition:c,toPosition:_,connectionStatus:UC(r),toNode:p,toHandle:d,pointer:v});let w="";const C={sourceX:l.x,sourceY:l.y,sourcePosition:c,targetX:f.x,targetY:f.y,targetPosition:_};switch(t){case yr.Bezier:[w]=t2(C);break;case yr.SimpleBezier:[w]=M2(C);break;case yr.Step:[w]=fg({...C,borderRadius:0});break;case yr.SmoothStep:[w]=fg(C);break;default:[w]=i2(C)}return m.jsx("path",{d:w,fill:"none",className:"react-flow__connection-path",style:e})};q2.displayName="ConnectionLine";const PF={};function DS(e=PF){V.useRef(e),Ct(),V.useEffect(()=>{},[e])}function UF(){Ct(),V.useRef(!1),V.useEffect(()=>{},[])}function V2({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:a,onNodeDoubleClick:l,onEdgeDoubleClick:u,onNodeMouseEnter:o,onNodeMouseMove:c,onNodeMouseLeave:f,onNodeContextMenu:p,onSelectionContextMenu:d,onSelectionStart:_,onSelectionEnd:v,connectionLineType:w,connectionLineStyle:C,connectionLineComponent:b,connectionLineContainerStyle:S,selectionKeyCode:x,selectionOnDrag:y,selectionMode:k,multiSelectionKeyCode:D,panActivationKeyCode:T,zoomActivationKeyCode:R,deleteKeyCode:N,onlyRenderVisibleElements:M,elementsSelectable:B,defaultViewport:H,translateExtent:Y,minZoom:F,maxZoom:z,preventScrolling:q,defaultMarkerColor:G,zoomOnScroll:X,zoomOnPinch:K,panOnScroll:O,panOnScrollSpeed:L,panOnScrollMode:j,zoomOnDoubleClick:$,panOnDrag:U,autoPanOnSelection:Q,onPaneClick:re,onPaneMouseEnter:ae,onPaneMouseMove:Z,onPaneMouseLeave:P,onPaneScroll:ee,onPaneContextMenu:ie,paneClickDistance:ge,nodeClickDistance:he,onEdgeContextMenu:ye,onEdgeMouseEnter:Se,onEdgeMouseMove:Ae,onEdgeMouseLeave:Ce,reconnectRadius:we,onReconnect:at,onReconnectStart:ht,onReconnectEnd:Ke,noDragClassName:ct,noWheelClassName:Rt,noPanClassName:Ze,disableKeyboardA11y:$e,nodeExtent:de,rfId:ne,viewport:fe,onViewportChange:be,nodesDraggable:Ee}){return DS(e),DS(t),UF(),LF(n),jF(fe),m.jsx(rF,{onPaneClick:re,onPaneMouseEnter:ae,onPaneMouseMove:Z,onPaneMouseLeave:P,onPaneContextMenu:ie,onPaneScroll:ee,paneClickDistance:ge,deleteKeyCode:N,selectionKeyCode:x,selectionOnDrag:y,selectionMode:k,onSelectionStart:_,onSelectionEnd:v,multiSelectionKeyCode:D,panActivationKeyCode:T,zoomActivationKeyCode:R,elementsSelectable:B,zoomOnScroll:X,zoomOnPinch:K,zoomOnDoubleClick:$,panOnScroll:O,panOnScrollSpeed:L,panOnScrollMode:j,panOnDrag:U,autoPanOnSelection:Q,defaultViewport:H,translateExtent:Y,minZoom:F,maxZoom:z,onSelectionContextMenu:d,preventScrolling:q,noDragClassName:ct,noWheelClassName:Rt,noPanClassName:Ze,disableKeyboardA11y:$e,onViewportChange:be,isControlledViewport:!!fe,children:m.jsxs(MF,{children:[m.jsx(RF,{edgeTypes:t,onEdgeClick:a,onEdgeDoubleClick:u,onReconnect:at,onReconnectStart:ht,onReconnectEnd:Ke,onlyRenderVisibleElements:M,onEdgeContextMenu:ye,onEdgeMouseEnter:Se,onEdgeMouseMove:Ae,onEdgeMouseLeave:Ce,reconnectRadius:we,defaultMarkerColor:G,noPanClassName:Ze,disableKeyboardA11y:$e,rfId:ne}),m.jsx(FF,{style:C,type:w,component:b,containerStyle:S}),m.jsx("div",{className:"react-flow__edgelabel-renderer"}),m.jsx(dF,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:l,onNodeMouseEnter:o,onNodeMouseMove:c,onNodeMouseLeave:f,onNodeContextMenu:p,nodeClickDistance:he,onlyRenderVisibleElements:M,noPanClassName:Ze,noDragClassName:ct,disableKeyboardA11y:$e,nodeExtent:de,rfId:ne,nodesDraggable:Ee}),m.jsx("div",{className:"react-flow__viewport-portal"})]})})}V2.displayName="GraphView";const $F=V.memo(V2),GF=WC(),RS=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:a,height:l,fitView:u,fitViewOptions:o,minZoom:c=.5,maxZoom:f=2,nodeOrigin:p,nodeExtent:d,zIndexMode:_="basic"}={})=>{const v=new Map,w=new Map,C=new Map,b=new Map,S=r??t??[],x=n??e??[],y=p??[0,0],k=d??Ko;a2(C,b,S);const{nodesInitialized:D}=pg(x,v,w,{nodeOrigin:y,nodeExtent:k,zIndexMode:_});let T=[0,0,1];if(u&&a&&l){const R=hl(v,{filter:H=>!!((H.width||H.initialWidth)&&(H.height||H.initialHeight))}),{x:N,y:M,zoom:B}=jm(R,a,l,c,f,(o==null?void 0:o.padding)??.1);T=[N,M,B]}return{rfId:"1",width:a??0,height:l??0,transform:T,nodes:x,nodesInitialized:D,nodeLookup:v,parentLookup:w,edges:S,edgeLookup:b,connectionLookup:C,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:c,maxZoom:f,translateExtent:Ko,nodeExtent:k,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:ca.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:y,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:u??!1,fitViewOptions:o,fitViewResolver:null,connection:{...PC},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:GF,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:FC,zIndexMode:_,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},qF=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:a,height:l,fitView:u,fitViewOptions:o,minZoom:c,maxZoom:f,nodeOrigin:p,nodeExtent:d,zIndexMode:_})=>iH((v,w)=>{async function C(){const{nodeLookup:b,panZoom:S,fitViewOptions:x,fitViewResolver:y,width:k,height:D,minZoom:T,maxZoom:R}=w();S&&(await J9({nodes:b,width:k,height:D,panZoom:S,minZoom:T,maxZoom:R},x),y==null||y.resolve(!0),v({fitViewResolver:null}))}return{...RS({nodes:e,edges:t,width:a,height:l,fitView:u,fitViewOptions:o,minZoom:c,maxZoom:f,nodeOrigin:p,nodeExtent:d,defaultNodes:n,defaultEdges:r,zIndexMode:_}),setNodes:b=>{const{nodeLookup:S,parentLookup:x,nodeOrigin:y,elevateNodesOnSelect:k,fitViewQueued:D,zIndexMode:T,nodesSelectionActive:R}=w(),{nodesInitialized:N,hasSelectedNodes:M}=pg(b,S,x,{nodeOrigin:y,nodeExtent:d,elevateNodesOnSelect:k,checkEquality:!0,zIndexMode:T}),B=R&&M;D&&N?(C(),v({nodes:b,nodesInitialized:N,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:B})):v({nodes:b,nodesInitialized:N,nodesSelectionActive:B})},setEdges:b=>{const{connectionLookup:S,edgeLookup:x}=w();a2(S,x,b),v({edges:b})},setDefaultNodesAndEdges:(b,S)=>{if(b){const{setNodes:x}=w();x(b),v({hasDefaultNodes:!0})}if(S){const{setEdges:x}=w();x(S),v({hasDefaultEdges:!0})}},updateNodeInternals:b=>{const{triggerNodeChanges:S,nodeLookup:x,parentLookup:y,domNode:k,nodeOrigin:D,nodeExtent:T,debug:R,fitViewQueued:N,zIndexMode:M}=w(),{changes:B,updatedInternals:H}=xz(b,x,y,k,D,T,M);H&&(vz(x,y,{nodeOrigin:D,nodeExtent:T,zIndexMode:M}),N?(C(),v({fitViewQueued:!1,fitViewOptions:void 0})):v({}),(B==null?void 0:B.length)>0&&(R&&console.log("React Flow: trigger node changes",B),S==null||S(B)))},updateNodePositions:(b,S=!1)=>{const x=[];let y=[];const{nodeLookup:k,triggerNodeChanges:D,connection:T,updateConnection:R,onNodesChangeMiddlewareMap:N}=w();for(const[M,B]of b){const H=k.get(M),Y=!!(H!=null&&H.expandParent&&(H!=null&&H.parentId)&&(B!=null&&B.position)),F={id:M,type:"position",position:Y?{x:Math.max(0,B.position.x),y:Math.max(0,B.position.y)}:B.position,dragging:S};if(H&&T.inProgress&&T.fromNode.id===H.id){const z=ns(H,T.fromHandle,Re.Left,!0);R({...T,from:z})}Y&&H.parentId&&x.push({id:M,parentId:H.parentId,rect:{...B.internals.positionAbsolute,width:B.measured.width??0,height:B.measured.height??0}}),y.push(F)}if(x.length>0){const{parentLookup:M,nodeOrigin:B}=w(),H=Pm(x,k,M,B);y.push(...H)}for(const M of N.values())y=M(y);D(y)},triggerNodeChanges:b=>{const{onNodesChange:S,setNodes:x,nodes:y,hasDefaultNodes:k,debug:D}=w();if(b!=null&&b.length){if(k){const T=CH(b,y);x(T)}D&&console.log("React Flow: trigger node changes",b),S==null||S(b)}},triggerEdgeChanges:b=>{const{onEdgesChange:S,setEdges:x,edges:y,hasDefaultEdges:k,debug:D}=w();if(b!=null&&b.length){if(k){const T=EH(b,y);x(T)}D&&console.log("React Flow: trigger edge changes",b),S==null||S(b)}},addSelectedNodes:b=>{const{multiSelectionActive:S,edgeLookup:x,nodeLookup:y,triggerNodeChanges:k,triggerEdgeChanges:D}=w();if(S){const T=b.map(R=>Vr(R,!0));k(T);return}k(na(y,new Set([...b]),!0)),D(na(x))},addSelectedEdges:b=>{const{multiSelectionActive:S,edgeLookup:x,nodeLookup:y,triggerNodeChanges:k,triggerEdgeChanges:D}=w();if(S){const T=b.map(R=>Vr(R,!0));D(T);return}D(na(x,new Set([...b]))),k(na(y,new Set,!0))},unselectNodesAndEdges:({nodes:b,edges:S}={})=>{const{edges:x,nodes:y,nodeLookup:k,triggerNodeChanges:D,triggerEdgeChanges:T}=w(),R=b||y,N=S||x,M=[];for(const H of R){if(!H.selected)continue;const Y=k.get(H.id);Y&&(Y.selected=!1),M.push(Vr(H.id,!1))}const B=[];for(const H of N)H.selected&&B.push(Vr(H.id,!1));D(M),T(B)},setMinZoom:b=>{const{panZoom:S,maxZoom:x}=w();S==null||S.setScaleExtent([b,x]),v({minZoom:b})},setMaxZoom:b=>{const{panZoom:S,minZoom:x}=w();S==null||S.setScaleExtent([x,b]),v({maxZoom:b})},setTranslateExtent:b=>{var S;(S=w().panZoom)==null||S.setTranslateExtent(b),v({translateExtent:b})},resetSelectedElements:()=>{const{edges:b,nodes:S,triggerNodeChanges:x,triggerEdgeChanges:y,elementsSelectable:k}=w();if(!k)return;const D=S.reduce((R,N)=>N.selected?[...R,Vr(N.id,!1)]:R,[]),T=b.reduce((R,N)=>N.selected?[...R,Vr(N.id,!1)]:R,[]);x(D),y(T)},setNodeExtent:b=>{const{nodes:S,nodeLookup:x,parentLookup:y,nodeOrigin:k,elevateNodesOnSelect:D,nodeExtent:T,zIndexMode:R}=w();b[0][0]===T[0][0]&&b[0][1]===T[0][1]&&b[1][0]===T[1][0]&&b[1][1]===T[1][1]||(pg(S,x,y,{nodeOrigin:k,nodeExtent:b,elevateNodesOnSelect:D,checkEquality:!1,zIndexMode:R}),v({nodeExtent:b}))},panBy:b=>{const{transform:S,width:x,height:y,panZoom:k,translateExtent:D}=w();return wz({delta:b,panZoom:k,transform:S,translateExtent:D,width:x,height:y})},setCenter:async(b,S,x)=>{const{width:y,height:k,maxZoom:D,panZoom:T}=w();if(!T)return!1;const R=typeof(x==null?void 0:x.zoom)<"u"?x.zoom:D;return await T.setViewport({x:y/2-b*R,y:k/2-S*R,zoom:R},{duration:x==null?void 0:x.duration,ease:x==null?void 0:x.ease,interpolate:x==null?void 0:x.interpolate}),!0},cancelConnection:()=>{v({connection:{...PC}})},updateConnection:b=>{v({connection:b})},reset:()=>v({...RS()})}},Object.is);function VF({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:a,initialHeight:l,initialMinZoom:u,initialMaxZoom:o,initialFitViewOptions:c,fitView:f,nodeOrigin:p,nodeExtent:d,zIndexMode:_,children:v}){const[w]=V.useState(()=>qF({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:a,height:l,fitView:f,minZoom:u,maxZoom:o,fitViewOptions:c,nodeOrigin:p,nodeExtent:d,zIndexMode:_}));return m.jsx(rH,{value:w,children:m.jsx(DH,{children:m.jsx(qH,{children:v})})})}function YF({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:a,width:l,height:u,fitView:o,fitViewOptions:c,minZoom:f,maxZoom:p,nodeOrigin:d,nodeExtent:_,zIndexMode:v}){return V.useContext(wh)?m.jsx(m.Fragment,{children:e}):m.jsx(VF,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:a,initialWidth:l,initialHeight:u,fitView:o,initialFitViewOptions:c,initialMinZoom:f,initialMaxZoom:p,nodeOrigin:d,nodeExtent:_,zIndexMode:v,children:e})}const WF={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function XF({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:a,nodeTypes:l,edgeTypes:u,onNodeClick:o,onEdgeClick:c,onInit:f,onMove:p,onMoveStart:d,onMoveEnd:_,onConnect:v,onConnectStart:w,onConnectEnd:C,onClickConnectStart:b,onClickConnectEnd:S,onNodeMouseEnter:x,onNodeMouseMove:y,onNodeMouseLeave:k,onNodeContextMenu:D,onNodeDoubleClick:T,onNodeDragStart:R,onNodeDrag:N,onNodeDragStop:M,onNodesDelete:B,onEdgesDelete:H,onDelete:Y,onSelectionChange:F,onSelectionDragStart:z,onSelectionDrag:q,onSelectionDragStop:G,onSelectionContextMenu:X,onSelectionStart:K,onSelectionEnd:O,onBeforeDelete:L,connectionMode:j,connectionLineType:$=yr.Bezier,connectionLineStyle:U,connectionLineComponent:Q,connectionLineContainerStyle:re,deleteKeyCode:ae="Backspace",selectionKeyCode:Z="Shift",selectionOnDrag:P=!1,selectionMode:ee=Zo.Full,panActivationKeyCode:ie="Space",multiSelectionKeyCode:ge=Jo()?"Meta":"Control",zoomActivationKeyCode:he=Jo()?"Meta":"Control",snapToGrid:ye,snapGrid:Se,onlyRenderVisibleElements:Ae=!1,selectNodesOnDrag:Ce,nodesDraggable:we,autoPanOnNodeFocus:at,nodesConnectable:ht,nodesFocusable:Ke,nodeOrigin:ct=y2,edgesFocusable:Rt,edgesReconnectable:Ze,elementsSelectable:$e=!0,defaultViewport:de=_H,minZoom:ne=.5,maxZoom:fe=2,translateExtent:be=Ko,preventScrolling:Ee=!0,nodeExtent:Oe,defaultMarkerColor:Qe="#b1b1b7",zoomOnScroll:Ie=!0,zoomOnPinch:Tt=!0,panOnScroll:Et=!1,panOnScrollSpeed:Ut=.5,panOnScrollMode:it=Kr.Free,zoomOnDoubleClick:yn=!0,panOnDrag:Zt=!0,onPaneClick:os,onPaneMouseEnter:ue,onPaneMouseMove:ke,onPaneMouseLeave:De,onPaneScroll:Ge,onPaneContextMenu:ut,paneClickDistance:ti=1,nodeClickDistance:sn=0,children:ls,onReconnect:ba,onReconnectStart:Cr,onReconnectEnd:Ah,onEdgeContextMenu:pl,onEdgeDoubleClick:gl,onEdgeMouseEnter:ml,onEdgeMouseMove:Sa,onEdgeMouseLeave:xa,reconnectRadius:_l=10,onNodesChange:vl,onEdgesChange:ni,noDragClassName:$t="nodrag",noWheelClassName:Qt="nowheel",noPanClassName:gi="nopan",fitView:cs,fitViewOptions:yl,connectOnClick:Th,attributionPosition:bl,proOptions:Er,defaultEdgeOptions:wa,elevateNodesOnSelect:Pi=!0,elevateEdgesOnSelect:Ui=!1,disableKeyboardA11y:$i=!1,autoPanOnConnect:Gi,autoPanOnNodeDrag:jt,autoPanOnSelection:Sl=!0,autoPanSpeed:xl,connectionRadius:mi,isValidConnection:qi,onError:Nh,style:wl,id:Ca,nodeDragThreshold:Dh,connectionDragThreshold:us,viewport:hs,onViewportChange:Gn,width:an,height:Cl,colorMode:Rh="light",debug:Ea,onScroll:kr,ariaLabelConfig:fs,zIndexMode:El="basic",...on},ka){const ds=Ca||"1",Aa=SH(Rh),Vi=V.useCallback(Ta=>{Ta.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),kr==null||kr(Ta)},[kr]);return m.jsx("div",{"data-testid":"rf__wrapper",...on,onScroll:Vi,style:{...wl,...WF},ref:ka,className:Pt(["react-flow",a,Aa]),id:Ca,role:"application",children:m.jsxs(YF,{nodes:e,edges:t,width:an,height:Cl,fitView:cs,fitViewOptions:yl,minZoom:ne,maxZoom:fe,nodeOrigin:ct,nodeExtent:Oe,zIndexMode:El,children:[m.jsx(bH,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:v,onConnectStart:w,onConnectEnd:C,onClickConnectStart:b,onClickConnectEnd:S,nodesDraggable:we,autoPanOnNodeFocus:at,nodesConnectable:ht,nodesFocusable:Ke,edgesFocusable:Rt,edgesReconnectable:Ze,elementsSelectable:$e,elevateNodesOnSelect:Pi,elevateEdgesOnSelect:Ui,minZoom:ne,maxZoom:fe,nodeExtent:Oe,onNodesChange:vl,onEdgesChange:ni,snapToGrid:ye,snapGrid:Se,connectionMode:j,translateExtent:be,connectOnClick:Th,defaultEdgeOptions:wa,fitView:cs,fitViewOptions:yl,onNodesDelete:B,onEdgesDelete:H,onDelete:Y,onNodeDragStart:R,onNodeDrag:N,onNodeDragStop:M,onSelectionDrag:q,onSelectionDragStart:z,onSelectionDragStop:G,onMove:p,onMoveStart:d,onMoveEnd:_,noPanClassName:gi,nodeOrigin:ct,rfId:ds,autoPanOnConnect:Gi,autoPanOnNodeDrag:jt,autoPanSpeed:xl,onError:Nh,connectionRadius:mi,isValidConnection:qi,selectNodesOnDrag:Ce,nodeDragThreshold:Dh,connectionDragThreshold:us,onBeforeDelete:L,debug:Ea,ariaLabelConfig:fs,zIndexMode:El}),m.jsx($F,{onInit:f,onNodeClick:o,onEdgeClick:c,onNodeMouseEnter:x,onNodeMouseMove:y,onNodeMouseLeave:k,onNodeContextMenu:D,onNodeDoubleClick:T,nodeTypes:l,edgeTypes:u,connectionLineType:$,connectionLineStyle:U,connectionLineComponent:Q,connectionLineContainerStyle:re,selectionKeyCode:Z,selectionOnDrag:P,selectionMode:ee,deleteKeyCode:ae,multiSelectionKeyCode:ge,panActivationKeyCode:ie,zoomActivationKeyCode:he,onlyRenderVisibleElements:Ae,defaultViewport:de,translateExtent:be,minZoom:ne,maxZoom:fe,preventScrolling:Ee,zoomOnScroll:Ie,zoomOnPinch:Tt,zoomOnDoubleClick:yn,panOnScroll:Et,panOnScrollSpeed:Ut,panOnScrollMode:it,panOnDrag:Zt,autoPanOnSelection:Sl,onPaneClick:os,onPaneMouseEnter:ue,onPaneMouseMove:ke,onPaneMouseLeave:De,onPaneScroll:Ge,onPaneContextMenu:ut,paneClickDistance:ti,nodeClickDistance:sn,onSelectionContextMenu:X,onSelectionStart:K,onSelectionEnd:O,onReconnect:ba,onReconnectStart:Cr,onReconnectEnd:Ah,onEdgeContextMenu:pl,onEdgeDoubleClick:gl,onEdgeMouseEnter:ml,onEdgeMouseMove:Sa,onEdgeMouseLeave:xa,reconnectRadius:_l,defaultMarkerColor:Qe,noDragClassName:$t,noWheelClassName:Qt,noPanClassName:gi,rfId:ds,disableKeyboardA11y:$i,nodeExtent:Oe,viewport:hs,onViewportChange:Gn,nodesDraggable:we}),m.jsx(mH,{onSelectionChange:F}),ls,m.jsx(hH,{proOptions:Er,position:bl}),m.jsx(uH,{rfId:ds,disableKeyboardA11y:$i})]})})}var KF=S2(XF);function ZF({dimensions:e,lineWidth:t,variant:n,className:r}){return m.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:Pt(["react-flow__background-pattern",n,r])})}function QF({radius:e,className:t}){return m.jsx("circle",{cx:e,cy:e,r:e,className:Pt(["react-flow__background-pattern","dots",t])})}var Bi;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Bi||(Bi={}));const JF={[Bi.Dots]:1,[Bi.Lines]:1,[Bi.Cross]:6},eP=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function Y2({id:e,variant:t=Bi.Dots,gap:n=20,size:r,lineWidth:a=1,offset:l=0,color:u,bgColor:o,style:c,className:f,patternClassName:p}){const d=V.useRef(null),{transform:_,patternId:v}=nt(eP,At),w=r||JF[t],C=t===Bi.Dots,b=t===Bi.Cross,S=Array.isArray(n)?n:[n,n],x=[S[0]*_[2]||1,S[1]*_[2]||1],y=w*_[2],k=Array.isArray(l)?l:[l,l],D=b?[y,y]:x,T=[k[0]*_[2]||1+D[0]/2,k[1]*_[2]||1+D[1]/2],R=`${v}${e||""}`;return m.jsxs("svg",{className:Pt(["react-flow__background",f]),style:{...c,...Eh,"--xy-background-color-props":o,"--xy-background-pattern-color-props":u},ref:d,"data-testid":"rf__background",children:[m.jsx("pattern",{id:R,x:_[0]%x[0],y:_[1]%x[1],width:x[0],height:x[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${T[0]},-${T[1]})`,children:C?m.jsx(QF,{radius:y/2,className:p}):m.jsx(ZF,{dimensions:D,lineWidth:a,variant:t,className:p})}),m.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${R})`})]})}Y2.displayName="Background";const tP=V.memo(Y2);function nP(){return m.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:m.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function iP(){return m.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:m.jsx("path",{d:"M0 0h32v4.2H0z"})})}function rP(){return m.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:m.jsx("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function sP(){return m.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:m.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function aP(){return m.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:m.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function iu({children:e,className:t,...n}){return m.jsx("button",{type:"button",className:Pt(["react-flow__controls-button",t]),...n,children:e})}const oP=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function W2({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:a,onZoomIn:l,onZoomOut:u,onFitView:o,onInteractiveChange:c,className:f,children:p,position:d="bottom-left",orientation:_="vertical","aria-label":v}){const w=Ct(),{isInteractive:C,minZoomReached:b,maxZoomReached:S,ariaLabelConfig:x}=nt(oP,At),{zoomIn:y,zoomOut:k,fitView:D}=Um(),T=()=>{y(),l==null||l()},R=()=>{k(),u==null||u()},N=()=>{D(a),o==null||o()},M=()=>{w.setState({nodesDraggable:!C,nodesConnectable:!C,elementsSelectable:!C}),c==null||c(!C)},B=_==="horizontal"?"horizontal":"vertical";return m.jsxs(Ch,{className:Pt(["react-flow__controls",B,f]),position:d,style:e,"data-testid":"rf__controls","aria-label":v??x["controls.ariaLabel"],children:[t&&m.jsxs(m.Fragment,{children:[m.jsx(iu,{onClick:T,className:"react-flow__controls-zoomin",title:x["controls.zoomIn.ariaLabel"],"aria-label":x["controls.zoomIn.ariaLabel"],disabled:S,children:m.jsx(nP,{})}),m.jsx(iu,{onClick:R,className:"react-flow__controls-zoomout",title:x["controls.zoomOut.ariaLabel"],"aria-label":x["controls.zoomOut.ariaLabel"],disabled:b,children:m.jsx(iP,{})})]}),n&&m.jsx(iu,{className:"react-flow__controls-fitview",onClick:N,title:x["controls.fitView.ariaLabel"],"aria-label":x["controls.fitView.ariaLabel"],children:m.jsx(rP,{})}),r&&m.jsx(iu,{className:"react-flow__controls-interactive",onClick:M,title:x["controls.interactive.ariaLabel"],"aria-label":x["controls.interactive.ariaLabel"],children:C?m.jsx(aP,{}):m.jsx(sP,{})}),p]})}W2.displayName="Controls";V.memo(W2);function lP({id:e,x:t,y:n,width:r,height:a,style:l,color:u,strokeColor:o,strokeWidth:c,className:f,borderRadius:p,shapeRendering:d,selected:_,onClick:v}){const{background:w,backgroundColor:C}=l||{},b=u||w||C;return m.jsx("rect",{className:Pt(["react-flow__minimap-node",{selected:_},f]),x:t,y:n,rx:p,ry:p,width:r,height:a,style:{fill:b,stroke:o,strokeWidth:c},shapeRendering:d,onClick:v?S=>v(S,e):void 0})}const cP=V.memo(lP),uP=e=>e.nodes.map(t=>t.id),kp=e=>e instanceof Function?e:()=>e;function hP({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:a,nodeComponent:l=cP,onClick:u}){const o=nt(uP,At),c=kp(t),f=kp(e),p=kp(n),d=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return m.jsx(m.Fragment,{children:o.map(_=>m.jsx(dP,{id:_,nodeColorFunc:c,nodeStrokeColorFunc:f,nodeClassNameFunc:p,nodeBorderRadius:r,nodeStrokeWidth:a,NodeComponent:l,onClick:u,shapeRendering:d},_))})}function fP({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:a,nodeStrokeWidth:l,shapeRendering:u,NodeComponent:o,onClick:c}){const{node:f,x:p,y:d,width:_,height:v}=nt(w=>{const C=w.nodeLookup.get(e);if(!C)return{node:void 0,x:0,y:0,width:0,height:0};const b=C.internals.userNode,{x:S,y:x}=C.internals.positionAbsolute,{width:y,height:k}=pi(b);return{node:b,x:S,y:x,width:y,height:k}},At);return!f||f.hidden||!XC(f)?null:m.jsx(o,{x:p,y:d,width:_,height:v,style:f.style,selected:!!f.selected,className:r(f),color:t(f),borderRadius:a,strokeColor:n(f),strokeWidth:l,shapeRendering:u,onClick:c,id:f.id})}const dP=V.memo(fP);var pP=V.memo(hP);const gP=200,mP=150,_P=e=>!e.hidden,vP=e=>{const t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:t,boundingRect:e.nodeLookup.size>0?VC(hl(e.nodeLookup,{filter:_P}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},MS=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,yP=(e,t)=>MS(e.viewBB,t.viewBB)&&MS(e.boundingRect,t.boundingRect)&&e.rfId===t.rfId&&e.panZoom===t.panZoom&&e.translateExtent===t.translateExtent&&e.flowWidth===t.flowWidth&&e.flowHeight===t.flowHeight&&e.ariaLabelConfig===t.ariaLabelConfig,bP="react-flow__minimap-desc";function X2({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:a="",nodeBorderRadius:l=5,nodeStrokeWidth:u,nodeComponent:o,bgColor:c,maskColor:f,maskStrokeColor:p,maskStrokeWidth:d,position:_="bottom-right",onClick:v,onNodeClick:w,pannable:C=!1,zoomable:b=!1,ariaLabel:S,inversePan:x,zoomStep:y=1,offsetScale:k=5}){const D=Ct(),T=V.useRef(null),{boundingRect:R,viewBB:N,rfId:M,panZoom:B,translateExtent:H,flowWidth:Y,flowHeight:F,ariaLabelConfig:z}=nt(vP,yP),q=(e==null?void 0:e.width)??gP,G=(e==null?void 0:e.height)??mP,X=R.width/q,K=R.height/G,O=Math.max(X,K),L=O*q,j=O*G,$=k*O,U=R.x-(L-R.width)/2-$,Q=R.y-(j-R.height)/2-$,re=L+$*2,ae=j+$*2,Z=`${bP}-${M}`,P=V.useRef(0),ee=V.useRef();P.current=O,V.useEffect(()=>{if(T.current&&B)return ee.current=Mz({domNode:T.current,panZoom:B,getTransform:()=>D.getState().transform,getViewScale:()=>P.current}),()=>{var ye;(ye=ee.current)==null||ye.destroy()}},[B]),V.useEffect(()=>{var ye;(ye=ee.current)==null||ye.update({translateExtent:H,width:Y,height:F,inversePan:x,pannable:C,zoomStep:y,zoomable:b})},[C,b,x,y,H,Y,F]);const ie=v?ye=>{var Ce;const[Se,Ae]=((Ce=ee.current)==null?void 0:Ce.pointer(ye))||[0,0];v(ye,{x:Se,y:Ae})}:void 0,ge=w?V.useCallback((ye,Se)=>{const Ae=D.getState().nodeLookup.get(Se).internals.userNode;w(ye,Ae)},[]):void 0,he=S??z["minimap.ariaLabel"];return m.jsx(Ch,{position:_,style:{...e,"--xy-minimap-background-color-props":typeof c=="string"?c:void 0,"--xy-minimap-mask-background-color-props":typeof f=="string"?f:void 0,"--xy-minimap-mask-stroke-color-props":typeof p=="string"?p:void 0,"--xy-minimap-mask-stroke-width-props":typeof d=="number"?d*O:void 0,"--xy-minimap-node-background-color-props":typeof r=="string"?r:void 0,"--xy-minimap-node-stroke-color-props":typeof n=="string"?n:void 0,"--xy-minimap-node-stroke-width-props":typeof u=="number"?u:void 0},className:Pt(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:m.jsxs("svg",{width:q,height:G,viewBox:`${U} ${Q} ${re} ${ae}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":Z,ref:T,onClick:ie,children:[he&&m.jsx("title",{id:Z,children:he}),m.jsx(pP,{onClick:ge,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:l,nodeClassName:a,nodeStrokeWidth:u,nodeComponent:o}),m.jsx("path",{className:"react-flow__minimap-mask",d:`M${U-$},${Q-$}h${re+$*2}v${ae+$*2}h${-re-$*2}z + M${N.x},${N.y}h${N.width}v${N.height}h${-N.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}X2.displayName="MiniMap";V.memo(X2);const SP=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,xP={[fa.Line]:"right",[fa.Handle]:"bottom-right"};function wP({nodeId:e,position:t,variant:n=fa.Handle,className:r,style:a=void 0,children:l,color:u,minWidth:o=10,minHeight:c=10,maxWidth:f=Number.MAX_VALUE,maxHeight:p=Number.MAX_VALUE,keepAspectRatio:d=!1,resizeDirection:_,autoScale:v=!0,shouldResize:w,onResizeStart:C,onResize:b,onResizeEnd:S}){const x=k2(),y=typeof e=="string"?e:x,k=Ct(),D=V.useRef(null),T=n===fa.Handle,R=nt(V.useCallback(SP(T&&v),[T,v]),At),N=V.useRef(null),M=t??xP[n];V.useEffect(()=>{if(!(!D.current||!y))return N.current||(N.current=qz({domNode:D.current,nodeId:y,getStoreItems:()=>{const{nodeLookup:H,transform:Y,snapGrid:F,snapToGrid:z,nodeOrigin:q,domNode:G}=k.getState();return{nodeLookup:H,transform:Y,snapGrid:F,snapToGrid:z,nodeOrigin:q,paneDomNode:G}},onChange:(H,Y)=>{const{triggerNodeChanges:F,nodeLookup:z,parentLookup:q,nodeOrigin:G}=k.getState(),X=[],K={x:H.x,y:H.y},O=z.get(y);if(O&&O.expandParent&&O.parentId){const L=O.origin??G,j=H.width??O.measured.width??0,$=H.height??O.measured.height??0,U={id:O.id,parentId:O.parentId,rect:{width:j,height:$,...KC({x:H.x??O.position.x,y:H.y??O.position.y},{width:j,height:$},O.parentId,z,L)}},Q=Pm([U],z,q,G);X.push(...Q),K.x=H.x?Math.max(L[0]*j,H.x):void 0,K.y=H.y?Math.max(L[1]*$,H.y):void 0}if(K.x!==void 0&&K.y!==void 0){const L={id:y,type:"position",position:{...K}};X.push(L)}if(H.width!==void 0&&H.height!==void 0){const j={id:y,type:"dimensions",resizing:!0,setAttributes:_?_==="horizontal"?"width":"height":!0,dimensions:{width:H.width,height:H.height}};X.push(j)}for(const L of Y){const j={...L,type:"position"};X.push(j)}F(X)},onEnd:({width:H,height:Y})=>{const F={id:y,type:"dimensions",resizing:!1,dimensions:{width:H,height:Y}};k.getState().triggerNodeChanges([F])}})),N.current.update({controlPosition:M,boundaries:{minWidth:o,minHeight:c,maxWidth:f,maxHeight:p},keepAspectRatio:d,resizeDirection:_,onResizeStart:C,onResize:b,onResizeEnd:S,shouldResize:w}),()=>{var H;(H=N.current)==null||H.destroy()}},[M,o,c,f,p,d,C,b,S,w]);const B=M.split("-");return m.jsx("div",{className:Pt(["react-flow__resize-control","nodrag",...B,n,r]),ref:D,style:{...a,scale:R,...u&&{[T?"backgroundColor":"borderColor"]:u}},children:l})}V.memo(wP);const _g=264,CP=132,_u=44,EP=72;function kP(e){const t=new Map(e.map(l=>[l.id,{exp:l,children:[]}])),n=[];for(const l of e){const u=t.get(l.id),o=l.parentExperimentId?t.get(l.parentExperimentId):void 0;o?o.children.push(u):n.push(u)}const r=(l,u)=>l.exp.createdAt-u.exp.createdAt,a=l=>{l.children.sort(r),l.children.forEach(a)};return n.sort(r),n.forEach(a),n}function vu(e){if(e.children.length===0)return _g;const t=e.children.reduce((n,r)=>n+vu(r),0)+_u*(e.children.length-1);return Math.max(_g,t)}function AP(e){return e==="done"?"pass":e==="failed"?"fail":e==="running"||e==="starting"?"live":"other"}const TP=V.memo(function({data:t}){const{exp:n,latestRun:r,runs:a,isBaseline:l,githubOwner:u,githubRepo:o,onOpenView:c,onOpenCodeBranch:f}=t,p=r==null?void 0:r.status,d=p==="running"||p==="starting",_=l?"BASELINE":d?"RUNNING":"EXPERIMENT",v=a.slice(-8);return m.jsxs("div",{className:`exp-node ${d?"live":""}`,children:[m.jsx(da,{type:"target",position:Re.Top}),m.jsxs("div",{className:"node-eyebrow",children:[m.jsx("span",{children:_}),m.jsx(Po,{status:p??"idle"})]}),m.jsx("div",{className:"node-head",children:m.jsx("span",{className:"node-slug",children:n.slug})}),(n.title||n.description)&&m.jsx("div",{className:"node-title",children:n.title||n.description}),m.jsxs("div",{className:"node-meta",children:[m.jsx("span",{children:"RUNS"}),v.length>0?m.jsx("span",{className:"run-squares",children:v.map(w=>m.jsx("span",{className:`run-sq ${AP(w.status)}`,title:w.status},w.id))}):m.jsx("span",{children:"no runs"}),m.jsx("span",{style:{flex:1}}),r&&m.jsx("span",{children:ga(r.createdAt)})]}),m.jsxs("div",{className:"node-actions",onClick:w=>w.stopPropagation(),children:[m.jsxs("button",{className:"node-action",title:"Open changes",onClick:()=>c(n.id,"changes"),children:[m.jsx(Pu,{size:13}),"Changes"]}),a.length>0&&m.jsxs("button",{className:"node-action",title:"Open terminal",onClick:()=>c(n.id,"terminal"),children:[m.jsx(US,{size:13}),"Logs"]}),m.jsxs("button",{className:"node-action",title:`Browse code on ${n.branchName}`,onClick:()=>f(n.branchName),children:[m.jsx(HS,{size:13}),"Code"]}),m.jsx("a",{className:"node-action node-action-ext",title:`Open ${n.branchName} on GitHub`,"aria-label":`Open ${n.branchName} on GitHub`,href:wg(u,o,n.branchName),target:"_blank",rel:"noopener noreferrer",onClick:w=>w.stopPropagation(),children:m.jsx(kw,{size:13})})]}),m.jsx(da,{type:"source",position:Re.Bottom})]})}),NP={exp:TP},DP={type:"default",style:{stroke:"var(--text)",strokeWidth:1.5,opacity:.3}};function RP({experiments:e,runs:t,project:n,onOpenView:r,onOpenCodeBranch:a}){const{nodes:l,edges:u}=V.useMemo(()=>{const o=new Map;for(const v of t){const w=o.get(v.experimentId);w?w.push(v):o.set(v.experimentId,[v])}for(const v of o.values())v.sort((w,C)=>w.createdAt-C.createdAt);const c=[],f=[],p=kP(e);function d(v,w,C){const b=o.get(v.exp.id)??[];if(c.push({id:v.exp.id,type:"exp",position:{x:w-_g/2,y:C},data:{exp:v.exp,latestRun:b[b.length-1]??null,runs:b,isBaseline:!v.exp.parentExperimentId,githubOwner:n.githubOwner,githubRepo:n.githubRepo,onOpenView:r,onOpenCodeBranch:a}}),v.children.length===0)return;const S=v.children.reduce((y,k)=>y+vu(k),0)+_u*(v.children.length-1);let x=w-S/2;for(const y of v.children){const k=vu(y);f.push({id:`e-${v.exp.id}-${y.exp.id}`,source:v.exp.id,target:y.exp.id}),d(y,x+k/2,C+CP+EP),x+=k+_u}}let _=0;for(const v of p){const w=vu(v);d(v,_+w/2,0),_+=w+_u}return{nodes:c,edges:f}},[e,t,r,a,n.githubOwner,n.githubRepo]);return e.length===0?m.jsxs("div",{className:"empty-state empty-state-cta",children:[m.jsx("p",{className:"empty-state-title",children:"No experiments yet"}),m.jsx("p",{className:"empty-state-hint",children:"Ask the agent in chat to create and run your first experiment."})]}):m.jsx(KF,{nodes:l,edges:u,nodeTypes:NP,defaultEdgeOptions:DP,nodesDraggable:!1,nodesConnectable:!1,minZoom:.15,fitView:!0,fitViewOptions:{padding:.25,maxZoom:1},children:m.jsx(tP,{variant:Bi.Dots,color:"var(--dots-strong)",gap:28,size:1.6})})}const ru=(e,t)=>e.id===t.id&&e.view===t.view,su=(e,t)=>e.path===t.path&&e.sessionId===t.sessionId&&e.ref===t.ref,LS=e=>`${e.sessionId??""}:${e.ref??""}:${e.path}`;function MP(e,t,n){let r=e,a;const l=t==null?void 0:t.replace(/\/+$/,"");if(!r.startsWith("/"))a=n;else if(l&&(r===l||r.startsWith(`${l}/`)))r=r.slice(l.length).replace(/^\/+/,"");else{const u=r.match(/\/openresearch\/worktrees\/[^/]+\/[^/]+\/([^/]+)\/(.+)$/),o=u?null:r.match(/\/openresearch\/repos\/[^/]+\/[^/]+\/(.+)$/);u?(a=u[1],r=u[2]):o&&(r=o[1])}return r?{path:r,sessionId:a}:null}const OS="orx:onboarded",K2="orx:panel-width",zu=360,LP=10,OP=232,jP=380,BP=OP+56,IP=80;function vg(){return Math.max(zu,window.innerWidth-BP-jP)}function zP(){const e=vg();try{const t=Number(localStorage.getItem(K2));if(Number.isFinite(t)&&t>=zu)return Math.min(t,e)}catch{}return Math.max(zu,Math.min(760,e,Math.round(window.innerWidth*.42)))}function au(e,t){const n=e.findIndex(a=>a.id===t.id);if(n<0)return[...e,t];const r=e.slice();return r[n]=t,r}function HP(){var Ze,$e;const[e,t]=V.useState(null),[n,r]=V.useState(null),[a,l]=V.useState([]),[u,o]=V.useState([]),[c,f]=V.useState(null),[p,d]=V.useState("tree"),[_,v]=V.useState(null),[w,C]=V.useState("experiments"),[b,S]=V.useState([]),[x,y]=V.useState([]),[k,D]=V.useState([]),[T,R]=V.useState([]),[N,M]=V.useState(!0),[B,H]=V.useState(!1),[Y,F]=V.useState(zP),[z,q]=V.useState(!0),[G,X]=V.useState(!1),[K,O]=V.useState("chat"),[L,j]=V.useState(()=>{try{return localStorage.getItem(OS)==="1"}catch{return!0}}),$=V.useRef(n);$.current=n,V.useEffect(()=>{xT().then(de=>{t(de),r(ne=>{var fe;return ne??((fe=de[0])==null?void 0:fe.id)??null})}).catch(()=>t([]))},[]),V.useEffect(()=>{const de=()=>F(ne=>Math.min(ne,vg()));return window.addEventListener("resize",de),()=>window.removeEventListener("resize",de)},[]),V.useEffect(()=>{n&&(kT(n).catch(()=>{}),l([]),o([]),f(null),v(null),S([]),y([]),D([]),R([]),C("experiments"),TT(n).then(l).catch(()=>{}),NT(n).then(o).catch(()=>{}),Iy(n).then(f).catch(()=>{}))},[n]);const U=V.useCallback(()=>{const de=$.current;de&&Iy(de).then(f).catch(()=>{})},[]);SN({onRun:de=>{de.projectId===$.current&&o(ne=>au(ne,de))},onExperiment:de=>{de.projectId===$.current&&l(ne=>au(ne,de))},onProject:de=>{t(ne=>ne?au(ne,de):[de])},onFiles:de=>{de===$.current&&U()}});const Q=V.useCallback((de,ne="changes")=>{const fe={id:de,view:ne};S(be=>be.some(Ee=>ru(Ee,fe))?be:[...be,fe]),C(fe),M(!0)},[]),re=V.useCallback(de=>{const ne=b.findIndex(be=>ru(be,de));if(ne===-1)return;const fe=b.filter((be,Ee)=>Ee!==ne);S(fe),typeof w=="object"&&"view"in w&&ru(w,de)&&C(fe[Math.min(ne,fe.length-1)]??"experiments")},[b,w]),ae=V.useCallback((de,ne,fe)=>{var Oe;const be=(Oe=e==null?void 0:e.find(Qe=>Qe.id===n))==null?void 0:Oe.repoPath,Ee=MP(de,be,ne);Ee&&(fe&&(Ee.ref=fe),y(Qe=>Qe.some(Ie=>su(Ie,Ee))?Qe:[...Qe,Ee]),C(Ee),M(!0))},[e,n]),Z=V.useCallback(de=>{const ne=x.findIndex(be=>su(be,de));if(ne===-1)return;const fe=x.filter((be,Ee)=>Ee!==ne);y(fe),typeof w=="object"&&"path"in w&&su(w,de)&&C(fe[Math.min(ne,fe.length-1)]??"experiments")},[x,w]),P=V.useCallback((de,ne,fe)=>{const be={kind:"plan",sessionId:ne,promptId:fe,plan:de};D(Ee=>{const Oe=Ee.findIndex(Ie=>Ie.promptId===fe);if(Oe===-1)return[...Ee,be];const Qe=Ee.slice();return Qe[Oe]=be,Qe}),C(be),M(!0)},[]),ee=V.useCallback(de=>{const ne=k.findIndex(be=>be.promptId===de.promptId);if(ne===-1)return;const fe=k.filter((be,Ee)=>Ee!==ne);D(fe),typeof w=="object"&&"kind"in w&&w.promptId===de.promptId&&C(fe[Math.min(ne,fe.length-1)]??"experiments")},[k,w]),ie=V.useCallback(de=>{const ne=T.find(be=>be.sessionId===null),fe=ne?{...ne,sel:de,selPicked:!0}:{code:!0,sessionId:null,sel:de,selPicked:!0,toggled:new Set};R(be=>be.some(Ee=>Ee.sessionId===null)?be.map(Ee=>Ee.sessionId===null?fe:Ee):[...be,fe]),C(fe),M(!0)},[T]),ge=V.useCallback((de,ne)=>{R(fe=>fe.map(be=>be.sessionId===de?{...be,...ne}:be))},[]),he=V.useCallback(de=>{const ne=T.findIndex(be=>be.sessionId===de.sessionId);if(ne===-1)return;const fe=T.filter((be,Ee)=>Ee!==ne);R(fe),typeof w=="object"&&"code"in w&&w.sessionId===de.sessionId&&C(fe[Math.min(ne,fe.length-1)]??"experiments")},[T,w]),ye=de=>{de.preventDefault(),de.currentTarget.setPointerCapture(de.pointerId);const ne=document.body.style.userSelect;document.body.style.userSelect="none";const fe=Ee=>{const Oe=Math.round(window.innerWidth-Ee.clientX-LP),Qe=vg();if(Oe>Qe+IP){H(!0);return}H(!1);const Ie=Math.min(Math.max(Oe,zu),Qe);F(Ie);try{localStorage.setItem(K2,String(Ie))}catch{}},be=()=>{window.removeEventListener("pointermove",fe),window.removeEventListener("pointerup",be),window.removeEventListener("pointercancel",be),document.body.style.userSelect=ne};window.addEventListener("pointermove",fe),window.addEventListener("pointerup",be),window.addEventListener("pointercancel",be)},Se=de=>{t(ne=>ne?au(ne,de):[de]),r(de.id),X(!1)},Ae=de=>{t(ne=>ne&&ne.filter(fe=>fe.id!==de)),n===de&&r(null)},Ce=typeof w=="object"&&"view"in w?w:null,we=typeof w=="object"&&"path"in w?w:null,at=typeof w=="object"&&"kind"in w?w:null,ht=typeof w=="object"&&"code"in w?w:null,Ke=(e==null?void 0:e.find(de=>de.id===n))??null,ct=Ce?a.find(de=>de.id===Ce.id)??null:null;if(e===null)return m.jsx("div",{className:"app",children:m.jsx("div",{className:"empty-state",children:m.jsx("span",{className:"spinner"})})});if(e.length===0)return m.jsx("div",{className:"app",children:L?m.jsx(wb,{projects:e,onOpen:r,onCreated:Se,onDeleted:Ae}):m.jsx(sB,{onDone:()=>{try{localStorage.setItem(OS,"1")}catch{}j(!0)}})});const Rt=m.jsx(rB,{projectName:((Ze=e.find(de=>de.id===n))==null?void 0:Ze.name)??"",onHome:()=>X(!0),onCollapse:()=>q(!1)});return m.jsx("div",{className:"app",children:G?m.jsx(wb,{projects:e,onOpen:de=>{r(de),X(!1)},onCreated:Se,onDeleted:Ae}):m.jsxs("div",{className:"app-body",children:[n&&m.jsx(mO,{projectId:n,paperId:($e=e.find(de=>de.id===n))==null?void 0:$e.paperId,railHeader:Rt,railOpen:z,onShowRail:()=>q(!0),mainView:K,onSelectMainView:O,panelOpen:N,onTogglePanel:()=>{N&&H(!1),M(!N)},onOpenFile:ae,onOpenPlan:P,children:K==="files"?(()=>{const de=e.find(ne=>ne.id===n);return de?m.jsx(TO,{project:de,files:c,onChanged:U,onOpenStorage:()=>O("storage")}):null})():K!=="chat"?m.jsx(nO,{tab:K}):null}),K==="chat"&&N&&m.jsxs("aside",{className:`right-pane floating-panel ${B?"max":""}`,style:B?void 0:{width:Y},children:[!B&&m.jsx("div",{className:"panel-resizer",onPointerDown:ye}),m.jsxs("div",{className:"tabs",children:[m.jsxs("div",{className:"tab-strip",children:[m.jsx("button",{className:`tab ${w==="experiments"?"active":""}`,onClick:()=>C("experiments"),children:"Experiments"}),b.map(de=>{const ne=a.find(fe=>fe.id===de.id);return m.jsx(Uc,{active:Ce!==null&&ru(Ce,de),label:ne?ne.title||ne.slug:"…",icon:de.view==="terminal"?m.jsx(US,{size:12,style:{flexShrink:0}}):m.jsx(Pu,{size:12,style:{flexShrink:0}}),onSelect:()=>C(de),onClose:()=>re(de)},`${de.id}:${de.view}`)}),x.map(de=>m.jsx(Uc,{active:we!==null&&su(we,de),label:de.path.split("/").pop()||de.path,icon:m.jsx(IS,{size:12,style:{flexShrink:0}}),onSelect:()=>C(de),onClose:()=>Z(de)},`file:${LS(de)}`)),k.map(de=>m.jsx(Uc,{active:at!==null&&at.promptId===de.promptId,label:"Plan",icon:m.jsx(PS,{size:12,style:{flexShrink:0}}),onSelect:()=>C(de),onClose:()=>ee(de)},`plan:${de.promptId}`)),T.map(de=>m.jsx(Uc,{active:ht!==null&&ht.sessionId===de.sessionId,label:"Code",icon:m.jsx(HS,{size:12,style:{flexShrink:0}}),onSelect:()=>C(de),onClose:()=>he(de)},`code:${de.sessionId??"@project"}`))]}),m.jsxs("div",{className:"panel-controls",children:[m.jsx("button",{className:"icon-btn",title:B?"Restore panel":"Expand panel","aria-label":B?"Restore panel":"Expand panel",onClick:()=>H(de=>!de),children:B?m.jsx(lT,{size:14}):m.jsx(aT,{size:14})}),m.jsx("button",{className:"icon-btn",title:"Close panel","aria-label":"Close panel",onClick:()=>{M(!1),H(!1)},children:m.jsx(jo,{size:14})})]})]}),w==="experiments"?m.jsxs("div",{className:"tab-body",children:[m.jsx("div",{className:"pane-toolbar",children:m.jsxs("div",{className:"seg",children:[m.jsx("button",{className:p==="tree"?"active":"",onClick:()=>d("tree"),children:"Tree"}),m.jsx("button",{className:p==="table"?"active":"",onClick:()=>d("table"),children:"Table"})]})}),m.jsx("div",{className:"pane-content",children:p==="tree"?Ke&&m.jsx(RP,{experiments:a,runs:u,project:Ke,onOpenView:Q,onOpenCodeBranch:ie}):m.jsx(gB,{runs:u,experiments:a,onOpen:de=>{v(de.id),Q(de.experimentId,"terminal")},onOpenChanges:de=>Q(de,"changes"),onCancel:de=>void GS(de).catch(()=>{})})})]}):we?m.jsx("div",{className:"tab-body",children:n&&m.jsx(iB,{projectId:n,path:we.path,sessionId:we.sessionId,gitRef:we.ref,onOpenFile:ae},LS(we))}):at?m.jsx("div",{className:"tab-body",children:m.jsx("div",{className:"pane-content plan-tab-content",children:m.jsx(Ju,{text:at.plan,onOpenFile:de=>ae(de,at.sessionId)})})}):ht?m.jsx("div",{className:"tab-body",children:n&&Ke&&(()=>{const de=T.find(ne=>ne.sessionId===ht.sessionId)??ht;return m.jsx(yO,{projectId:n,sessionId:de.sessionId,project:Ke,experiments:a,sel:de.sel,selPicked:de.selPicked,toggled:de.toggled,onSelChange:(ne,fe)=>ge(de.sessionId,{sel:ne,selPicked:fe}),onToggledChange:ne=>ge(de.sessionId,{toggled:ne}),onOpenFile:ae},`code:${de.sessionId??"@project"}`)})()}):m.jsx("div",{className:"tab-body",children:Ce&&ct&&Ke&&m.jsx(J8,{experiment:ct,project:Ke,view:Ce.view,runs:u,selectedRunId:_,onSelectRun:v},`${Ce.id}:${Ce.view}`)})]})]})})}hA.createRoot(document.getElementById("root")).render(m.jsx(V.StrictMode,{children:m.jsx(HP,{})})); diff --git a/ui/dist/assets/index-DHqNmNnI.css b/ui/dist/assets/index-DHqNmNnI.css new file mode 100644 index 00000000..ec265015 --- /dev/null +++ b/ui/dist/assets/index-DHqNmNnI.css @@ -0,0 +1,32 @@ +:root{--diff-background-color:initial;--diff-text-color:initial;--diff-font-family:Consolas,Courier,monospace;--diff-selection-background-color:#b3d7ff;--diff-selection-text-color:var(--diff-text-color);--diff-gutter-insert-background-color:#d6fedb;--diff-gutter-insert-text-color:var(--diff-text-color);--diff-gutter-delete-background-color:#fadde0;--diff-gutter-delete-text-color:var(--diff-text-color);--diff-gutter-selected-background-color:#fffce0;--diff-gutter-selected-text-color:var(--diff-text-color);--diff-code-insert-background-color:#eaffee;--diff-code-insert-text-color:var(--diff-text-color);--diff-code-delete-background-color:#fdeff0;--diff-code-delete-text-color:var(--diff-text-color);--diff-code-insert-edit-background-color:#c0dc91;--diff-code-insert-edit-text-color:var(--diff-text-color);--diff-code-delete-edit-background-color:#f39ea2;--diff-code-delete-edit-text-color:var(--diff-text-color);--diff-code-selected-background-color:#fffce0;--diff-code-selected-text-color:var(--diff-text-color);--diff-omit-gutter-line-color:#cb2a1d}.diff{background-color:var(--diff-background-color);border-collapse:collapse;color:var(--diff-text-color);table-layout:fixed;width:100%}.diff::-moz-selection{background-color:#b3d7ff;background-color:var(--diff-selection-background-color);color:var(--diff-text-color);color:var(--diff-selection-text-color)}.diff::selection{background-color:#b3d7ff;background-color:var(--diff-selection-background-color);color:var(--diff-text-color);color:var(--diff-selection-text-color)}.diff td{padding-bottom:0;padding-top:0;vertical-align:top}.diff-line{font-family:Consolas,Courier,monospace;font-family:var(--diff-font-family);line-height:1.5}.diff-gutter>a{color:inherit;display:block}.diff-gutter{cursor:pointer;padding:0 1ch;text-align:right;-webkit-user-select:none;-moz-user-select:none;user-select:none}.diff-gutter-insert{background-color:#d6fedb;background-color:var(--diff-gutter-insert-background-color);color:var(--diff-text-color);color:var(--diff-gutter-insert-text-color)}.diff-gutter-delete{background-color:#fadde0;background-color:var(--diff-gutter-delete-background-color);color:var(--diff-text-color);color:var(--diff-gutter-delete-text-color)}.diff-gutter-omit{cursor:default}.diff-gutter-selected{background-color:#fffce0;background-color:var(--diff-gutter-selected-background-color);color:var(--diff-text-color);color:var(--diff-gutter-selected-text-color)}.diff-code{word-wrap:break-word;padding:0 0 0 .5em;white-space:pre-wrap;word-break:break-all}.diff-code-edit{color:inherit}.diff-code-insert{background-color:#eaffee;background-color:var(--diff-code-insert-background-color);color:var(--diff-text-color);color:var(--diff-code-insert-text-color)}.diff-code-insert .diff-code-edit{background-color:#c0dc91;background-color:var(--diff-code-insert-edit-background-color);color:var(--diff-text-color);color:var(--diff-code-insert-edit-text-color)}.diff-code-delete{background-color:#fdeff0;background-color:var(--diff-code-delete-background-color);color:var(--diff-text-color);color:var(--diff-code-delete-text-color)}.diff-code-delete .diff-code-edit{background-color:#f39ea2;background-color:var(--diff-code-delete-edit-background-color);color:var(--diff-text-color);color:var(--diff-code-delete-edit-text-color)}.diff-code-selected{background-color:#fffce0;background-color:var(--diff-code-selected-background-color);color:var(--diff-text-color);color:var(--diff-code-selected-text-color)}.diff-widget-content{vertical-align:top}.diff-gutter-col{width:7ch}.diff-gutter-omit{height:0}.diff-gutter-omit:before{background-color:#cb2a1d;background-color:var(--diff-omit-gutter-line-color);content:" ";display:block;height:100%;margin-left:4.6ch;overflow:hidden;white-space:pre;width:2px}.diff-decoration{line-height:1.5;-webkit-user-select:none;-moz-user-select:none;user-select:none}.diff-decoration-content{font-family:Consolas,Courier,monospace;font-family:var(--diff-font-family);padding:0}:root{--base: #ffffff;--canvas: #faf8f4;--panel: #f3f0ea;--surface: #faf7f2;--surface-bright: #fdfbfb;--highlight: #fdf3f1;--text: #1d1b1a;--subtext: #737373;--muted: #a1a1a1;--primary: #9a2036;--primary-subtle: #f7e9ec;--secondary: #4a90e2;--error: #e2a100;--border: #d4d4d4;--border-variant: #e5e5e5;--accent-orange: #da642c;--accent-red: #d94654;--accent-teal: #209a84;--accent-blue: #3a8dff;--accent-pink: #ff2b90;--accent-amber: #da9100;--accent-green: #5eb64c;--accent-purple: #9c5cff;--accent-green-subtle: #e7f4e5;--accent-amber-subtle: #fff3e1;--accent-teal-subtle: #e1f3f0;--accent-red-subtle: #fbe9ea;--accent-blue-subtle: #e5f0ff;--accent-purple-subtle: #f1e8ff;--dots-muted: #e3ded5;--dots-strong: #bdb6a8;--mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;--sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;--readable-col: 760px;--bg: var(--base);--bg-canvas: var(--canvas);--surface-2: var(--panel);--border-strong: var(--border);--accent: var(--primary);--teal: var(--accent-teal);--green: var(--accent-green);--red: var(--accent-red);--amber: var(--accent-amber);--purple: var(--accent-purple);color-scheme:light}@media(prefers-color-scheme:dark){:root{--base: #0e0c0c;--canvas: #141110;--panel: #221f1e;--surface: #1d1b1a;--surface-bright: #130f0f;--highlight: #393433;--text: #e6e1e0;--subtext: #a68e8b;--muted: #737373;--primary: #ffb3ad;--primary-subtle: #33191b;--secondary: #3e7fcf;--error: #ffb951;--border: #525252;--border-variant: #404040;--accent-amber: #e67e22;--accent-green-subtle: #1c2b18;--accent-amber-subtle: #33260f;--accent-teal-subtle: #12332d;--accent-red-subtle: #331418;--accent-blue-subtle: #10233a;--accent-purple-subtle: #251933;--dots-muted: #2a2523;--dots-strong: #555555;color-scheme:dark}}*{box-sizing:border-box}html,body,#root{height:100%;margin:0}body{background:var(--base);color:var(--text);font-family:var(--sans);font-size:14px;line-height:1.45;overflow:hidden}::selection{background:var(--highlight)}button{font:inherit;color:inherit;background:none;border:none;cursor:pointer;padding:0}input,textarea,select{font:inherit;color:var(--text);background:var(--base);border:1px solid var(--border);border-radius:0;padding:6px 10px;outline:none}input:focus,textarea:focus,select:focus{border-color:var(--text)}input::placeholder,textarea::placeholder{color:var(--muted);opacity:1}::-webkit-scrollbar{width:10px;height:10px}::-webkit-scrollbar-thumb{background:var(--border);border-radius:5px;border:2px solid transparent;background-clip:padding-box}::-webkit-scrollbar-track{background:transparent}@keyframes pulse{50%{opacity:.35}}@keyframes spin{to{transform:rotate(360deg)}}.app{display:flex;flex-direction:column;height:100%}.app-body{display:flex;flex:1;min-height:0;padding:0 14px}.home{flex:1;min-height:0;overflow-y:auto;scrollbar-gutter:stable both-edges;background:var(--canvas)}.home-inner{max-width:620px;margin:0 auto;padding:48px 24px 64px}.home-brand{font-weight:800;font-size:28px;letter-spacing:-.02em;margin-bottom:36px}.home-brand span{color:var(--primary)}.home-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:18px}.home-head h2{margin:0;font-size:18px;letter-spacing:-.01em}.home-list{display:flex;flex-direction:column;gap:10px}.project-card{position:relative;display:flex;flex-direction:column;gap:4px;text-align:left;padding:14px 16px;background:var(--base);border:1px solid var(--border);border-radius:10px;cursor:pointer;transition:border-color .12s ease,box-shadow .12s ease}.project-card:hover{border-color:var(--text);box-shadow:0 2px 10px #0000000f}.project-delete{position:absolute;top:10px;right:10px;display:none;padding:5px;border-radius:6px;color:var(--muted);line-height:0}.project-card:hover .project-delete{display:block}.project-delete:hover{color:var(--danger, #d33);background:var(--overlay, rgba(0, 0, 0, .05))}.project-card .name{font-weight:600;font-size:14px}.project-card .repo{color:var(--subtext)}.project-card .paper,.project-card .time{font-size:11px;color:var(--muted)}.rail-brand{display:flex;align-items:center;gap:4px;height:48px;padding:0 8px 0 12px;border-bottom:1px solid var(--border);flex-shrink:0}.rail-brand .brand{display:flex;align-items:center;gap:8px;flex:1;min-width:0;font-weight:600;font-size:13px;color:var(--text);padding:4px 6px 4px 0;border-radius:6px}.rail-brand .brand:hover{color:var(--subtext)}.rail-brand .brand svg{flex-shrink:0}.rail-brand .brand .brand-project{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.icon-btn{position:relative;display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;color:var(--subtext)}.icon-btn:hover{color:var(--text);background:var(--surface)}.btn{display:inline-flex;align-items:center;justify-content:center;gap:6px;padding:6px 14px;font-size:12px;font-weight:600;border:1px solid var(--border);border-radius:8px;background:var(--base);color:var(--text);white-space:nowrap;transition:background .12s ease,border-color .12s ease,color .12s ease}.btn:hover:not(:disabled){background:var(--surface)}.btn:active:not(:disabled){background:var(--highlight)}.btn:disabled{opacity:.45;cursor:default}.btn.primary{background:var(--primary);border-color:var(--primary);color:var(--base)}.btn.primary:hover:not(:disabled){background:color-mix(in oklab,var(--primary) 88%,var(--text));border-color:color-mix(in oklab,var(--primary) 88%,var(--text))}.btn.primary:active:not(:disabled){background:color-mix(in oklab,var(--primary) 80%,var(--text));border-color:color-mix(in oklab,var(--primary) 80%,var(--text))}.btn.danger{color:var(--accent-red)}.btn.danger:hover:not(:disabled){background:color-mix(in oklab,var(--accent-red) 8%,transparent)}.btn.danger:active:not(:disabled){background:color-mix(in oklab,var(--accent-red) 14%,transparent)}.btn.ghost{border-color:transparent;color:var(--subtext)}.btn.ghost:hover:not(:disabled){color:var(--text);background:var(--surface)}.btn.sm{padding:3px 9px;font-size:11px;border-radius:6px}.status-badge{display:inline-flex;align-items:center;gap:6px;font-size:12px;font-weight:500;color:var(--subtext);text-transform:capitalize;white-space:nowrap}.status-badge .dot{width:7px;height:7px;border-radius:50%;background:currentColor;flex-shrink:0}.status-badge.live .dot{animation:pulse 1.2s ease-in-out infinite}.st-done .dot{color:var(--accent-green)}.st-failed .dot{color:var(--accent-red)}.st-running .dot{color:var(--accent-teal)}.st-starting .dot{color:var(--accent-amber)}.st-cancelled .dot{color:var(--accent-orange)}.st-editing .dot{color:var(--accent-purple)}.st-idle .dot{color:var(--muted)}.floating-panel{border:1px solid var(--border);border-radius:10px;box-shadow:0 6px 24px color-mix(in oklab,var(--text) 5%,transparent),0 1px 4px color-mix(in oklab,var(--text) 4%,transparent);overflow:hidden}.session-rail{width:232px;flex-shrink:0;display:flex;flex-direction:column;margin:10px 14px 10px 0;background:var(--base);min-height:0}.rail-nav{display:flex;flex-direction:column;gap:2px;padding:8px;flex-shrink:0}.rail-nav-item{display:flex;align-items:center;gap:10px;padding:7px 10px;font-size:12.5px;color:var(--subtext);border-radius:8px;text-align:left}.rail-nav-item:hover{background:var(--surface);color:var(--text)}.rail-nav-item.active{background:var(--panel);color:var(--text);font-weight:600}.rail-section-label{padding:10px 10px 6px;font-size:12px;font-weight:500;color:var(--muted)}.rail-section-head{display:flex;align-items:center;justify-content:space-between}.rail-filter{position:relative;display:inline-flex;margin-right:2px}.rail-filter-btn{width:24px;height:24px;border-radius:6px}.rail-empty{padding:6px 10px;font-size:12px;color:var(--muted)}.session-rail .rail-body{flex:1;min-height:0;overflow-y:auto;padding:4px 8px}.chat-pane{flex:1;min-width:0;display:flex;flex-direction:column;background:var(--base);min-height:0}.right-pane{position:relative;flex-shrink:0;min-width:0;display:flex;flex-direction:column;margin:10px 0 10px 14px;background:var(--canvas)}.right-pane.max{position:fixed;top:10px;right:10px;bottom:10px;left:10px;margin:0;z-index:60;box-shadow:0 12px 40px color-mix(in oklab,var(--text) 22%,transparent)}.panel-resizer{position:absolute;left:0;top:0;bottom:0;width:6px;cursor:col-resize;z-index:30}.panel-resizer:hover,.panel-resizer:active{background:color-mix(in oklab,var(--text) 12%,transparent)}.panel-controls{display:inline-flex;align-items:center;gap:2px;flex-shrink:0}.tabs{display:flex;align-items:center;gap:4px;padding:0 10px;height:40px;border-bottom:1px solid var(--border);background:var(--base);flex-shrink:0}.tab-strip{display:flex;align-items:center;gap:4px;flex:1;min-width:0;overflow-x:auto;scrollbar-width:none}.tab-strip::-webkit-scrollbar{display:none}.tab.closable{max-width:176px;padding-right:4px}.tab .tab-label{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.tab .tab-close{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;border-radius:4px;color:var(--muted);flex-shrink:0}.tab .tab-close:hover{background:color-mix(in oklab,var(--text) 15%,transparent);color:var(--text)}.tab{display:inline-flex;align-items:center;gap:6px;padding:5px 12px;font-size:12px;font-weight:600;color:var(--subtext);border-radius:6px;white-space:nowrap;flex-shrink:0}.tab:hover{color:var(--text)}.tab.active{color:var(--text);background:var(--surface)}.tab .tab-count{font-family:var(--mono);font-weight:400;color:var(--muted)}.tab-body{flex:1;min-height:0;position:relative;display:flex;flex-direction:column}.pane-toolbar{display:flex;align-items:center;justify-content:flex-end;padding:10px 12px 0;flex-shrink:0}.pane-content{flex:1;min-height:0;position:relative}.seg{display:inline-flex;align-items:center;gap:2px;padding:3px;border-radius:9px;background:color-mix(in oklab,var(--text) 10%,transparent)}.seg button{padding:3px 12px;font-size:12px;font-weight:600;color:var(--subtext);border-radius:6px}.seg button:hover{color:var(--text)}.seg button.active{background:var(--base);color:var(--text);box-shadow:0 1px 3px color-mix(in oklab,var(--text) 25%,transparent)}.chat-header{display:flex;align-items:center;gap:8px;padding:0 16px;background:var(--base);flex-shrink:0;height:48px;position:relative;z-index:4;width:100%;max-width:var(--readable-col);margin:0 auto}.chat-header.rail-hidden{max-width:none;padding:0 2px}.chat-header.rail-hidden>.icon-btn:first-child{margin-right:12px}.chat-header:after{content:"";position:absolute;top:100%;left:0;right:0;height:24px;background:linear-gradient(to bottom,var(--base),transparent);pointer-events:none}.chat-header .title{font-size:13px;font-weight:600;color:var(--text);flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.session-row{position:relative;display:flex;align-items:center;gap:8px;width:100%;text-align:left;padding:7px 10px;border-radius:8px;font-size:12.5px;color:var(--subtext);cursor:pointer;-webkit-user-select:none;user-select:none}.session-row:hover{background:var(--surface);color:var(--text)}.session-row.active{color:var(--text);background:var(--surface);font-weight:500}.session-row .session-dot{width:14px;display:inline-flex;align-items:center;justify-content:center;flex-shrink:0}.session-row .session-title{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.session-row .session-time{font-size:10px;font-family:var(--mono);color:var(--muted);flex-shrink:0}.session-row .session-menu-btn{display:none;align-items:center;justify-content:center;width:18px;height:18px;margin:-2px 0;border-radius:5px;color:var(--muted);flex-shrink:0}.session-row .session-menu-btn:hover{color:var(--text);background:var(--panel)}.session-row:hover .session-menu-btn,.session-row:focus-within .session-menu-btn,.session-row.menu-open .session-menu-btn{display:inline-flex}.session-row:hover .session-time,.session-row:focus-within .session-time,.session-row.menu-open .session-time{display:none}.session-row .busy-dot{width:7px;height:7px;border-radius:50%;background:var(--primary);animation:pulse 1.2s infinite;flex-shrink:0}.session-row .session-title-input{flex:1;min-width:0;padding:1px 5px;margin:-2px 0;font:inherit;color:var(--text);background:var(--base);border:1px solid var(--primary);border-radius:5px;outline:none}.session-row.editing{background:var(--surface);cursor:default}.session-row.editing .session-menu-btn,.session-row.editing .session-time{display:none}.chat-thread{flex:1;min-height:0;overflow-y:auto;scrollbar-gutter:stable both-edges}.chat-thread-inner{max-width:var(--readable-col);margin:0 auto;padding:16px 16px 32px;display:flex;flex-direction:column;gap:16px}.chat-empty{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;color:var(--subtext);padding:20px;text-align:center}.chat-empty h2{margin:0;font-size:34px;font-weight:700;letter-spacing:-.02em;color:var(--text)}.chat-empty h2 span{color:var(--primary)}.chat-empty .chat-empty-hint{font-size:12px;color:var(--muted);max-width:340px;text-align:center}.chat-empty p{margin:0;font-size:13px;max-width:320px}.chat-empty .chat-suggest{font-family:var(--mono);font-size:12px;color:var(--text);background:var(--surface);border:1px solid var(--border);border-radius:999px;padding:6px 14px;cursor:pointer;transition:border-color .12s ease}.chat-empty .chat-suggest:hover{border-color:var(--text)}.msg-user{align-self:flex-end;max-width:88%;background:var(--surface);border-radius:16px;padding:10px 15px;font-size:13px;white-space:pre-wrap;word-break:break-word}.msg-images{display:flex;flex-wrap:wrap;gap:6px;margin-top:8px}.msg-images img{max-width:220px;max-height:160px;border:1px solid var(--border-variant);border-radius:4px;display:block}.msg-assistant{font-size:14px;line-height:1.62;color:var(--text);min-width:0}.reasoning{color:var(--muted);font-size:12px;margin:2px 0}.reasoning summary{cursor:pointer;list-style:none;-webkit-user-select:none;user-select:none;font-weight:600}.reasoning[open]{white-space:pre-wrap}.tool-group{margin:2px 0}.tool-group-summary{display:flex;align-items:center;gap:8px;width:100%;padding:3px 2px;cursor:pointer;color:var(--muted);font-size:12.5px;text-align:left;border-radius:6px}.tool-group-summary:hover{color:var(--subtext);background:var(--surface)}.tool-group.has-error .tool-group-summary{color:var(--accent-red)}.tool-chevron{flex-shrink:0;color:var(--muted);transition:transform .12s ease}.tool-chevron.open{transform:rotate(90deg)}.tool-group-rows{display:flex;flex-direction:column;gap:1px;margin:2px 0 4px 7px;padding-left:10px;border-left:1px solid var(--border-variant)}.tool-row{display:flex;flex-direction:column}.tool-row summary{display:flex;align-items:center;gap:8px;padding:3px 4px;cursor:pointer;list-style:none;-webkit-user-select:none;user-select:none;min-width:0;border-radius:5px}.tool-row summary:hover{background:var(--surface)}.tool-row summary::-webkit-details-marker{display:none}.tool-line{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12.5px;color:var(--subtext)}.tool-open{flex-shrink:0;font-size:11px;color:var(--primary)}.tool-open:hover{text-decoration:underline}.tool-status{width:6px;height:6px;border-radius:50%;flex-shrink:0;background:var(--muted)}.tool-status.running{background:var(--accent-amber);animation:pulse 1.2s ease-in-out infinite}.tool-status.error{background:var(--accent-red)}.tool-detail{margin:2px 0 4px 14px}.tool-cmd-full{padding:6px 10px;font-family:var(--mono);font-size:11px;color:var(--text);background:var(--surface);border-radius:5px;white-space:pre-wrap;word-break:break-word}.tool-output{margin-top:3px;padding:6px 10px;font-family:var(--mono);font-size:11px;color:var(--subtext);white-space:pre-wrap;word-break:break-word;max-height:260px;overflow-y:auto;background:var(--base);border:1px solid var(--border-variant);border-radius:5px}.working{display:flex;align-items:center;gap:8px;color:var(--subtext);font-size:12.5px;padding:2px 0 8px}.spinner{width:13px;height:13px;border:2px solid var(--border);border-top-color:var(--primary);border-radius:50%;animation:spin .8s linear infinite;flex-shrink:0}.composer{padding:0 12px 12px;flex-shrink:0;position:relative;z-index:4;background:var(--base);width:100%;max-width:var(--readable-col);margin:0 auto}.composer:before{content:"";position:absolute;bottom:100%;left:0;right:0;height:24px;background:linear-gradient(to top,var(--base),transparent);pointer-events:none}.composer-box{position:relative;display:flex;flex-direction:column;border:1px solid var(--border);border-radius:8px;background:var(--base)}.composer textarea{border:none;background:none;resize:none;padding:10px 12px 4px;font-size:13px;min-height:42px;max-height:180px}.composer-attachments{display:flex;flex-wrap:wrap;gap:6px;padding:8px 12px 0}.attachment-thumb{position:relative}.attachment-thumb img{width:52px;height:52px;object-fit:cover;border:1px solid var(--border);border-radius:6px;display:block}.attachment-thumb button{position:absolute;top:-5px;right:-5px;display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;padding:0;border:1px solid var(--border);border-radius:50%;background:var(--surface);color:var(--text);cursor:pointer}.attachment-thumb button:hover{background:var(--text);color:var(--base)}.composer-actions{display:flex;justify-content:flex-end;align-items:center;gap:8px;padding:6px 8px 8px}.send-btn{display:inline-flex;align-items:center;justify-content:center;width:32px;height:32px;border-radius:8px;background:var(--primary);color:var(--base);transition:background .1s ease,opacity .1s ease}.send-btn:hover:not(:disabled){background:color-mix(in oklab,var(--primary) 88%,var(--text))}.send-btn:disabled{opacity:.4;cursor:default}.send-btn.stop{background:var(--surface);color:var(--text)}.send-btn.stop:hover:not(:disabled){background:color-mix(in oklab,var(--surface) 88%,var(--text))}.md{min-width:0;word-break:break-word;color:var(--text);line-height:1.62}.md>*:first-child{margin-top:0}.md>*:last-child{margin-bottom:0}.md p{margin:10px 0}.md strong{color:var(--text);font-weight:600}.md pre{background:var(--surface);border:1px solid color-mix(in oklab,var(--border) 50%,transparent);border-radius:8px;padding:8px 12px;overflow-x:auto;font-size:12px;color:var(--text)}.md code{font-family:var(--mono);font-size:.9em;font-weight:500;color:var(--primary);background:var(--panel);border:1px solid var(--border-variant);padding:1px 5px}.md .file-chip{display:inline-flex;align-items:center;gap:4px;max-width:100%;margin:0 1px;padding:0 6px;vertical-align:baseline;font-family:var(--mono);font-size:.9em;font-weight:500;color:var(--text);background:var(--panel);border:1px solid var(--border-variant);cursor:pointer}.md .file-chip:hover:not(:disabled){background:var(--surface);color:var(--primary)}.md .file-chip svg{flex:none;opacity:.6}.md .file-chip-label{max-width:260px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.md pre code{background:none;border:none;color:inherit;padding:0;font-weight:400}.md-code{position:relative;margin:10px 0}.md-code pre{margin:0}.md-code-copy{position:absolute;top:6px;right:6px;display:inline-flex;align-items:center;justify-content:center;width:26px;height:26px;color:var(--muted);background:var(--base);border:1px solid var(--border-variant);border-radius:6px;opacity:0;transition:opacity .12s ease,color .12s ease}.md-code:hover .md-code-copy{opacity:1}.md-code-copy:hover{color:var(--text);border-color:var(--muted)}.md h1,.md h2,.md h3,.md h4{color:var(--text);font-size:1.05em;font-weight:600;margin:12px 0 6px}.md ul,.md ol{margin:6px 0;padding-left:22px}.md li::marker{color:var(--primary)}.md a{color:var(--primary)}.md table{border-collapse:collapse;width:100%;font-size:13px;margin:10px 0;border:1px solid var(--border);border-radius:8px;overflow:hidden}.md th,.md td{border-bottom:1px solid var(--border-variant);padding:8px 14px;text-align:left;color:var(--text)}.md tr:last-child td{border-bottom:none}.md thead th{background:var(--surface);font-weight:500;color:var(--subtext);border-bottom:1px solid var(--border)}.md tbody tr:hover td{background:var(--surface-bright)}.md blockquote{margin:6px 0;padding:2px 0 2px 10px;border-left:3px solid var(--border);color:var(--subtext)}.react-flow__node.react-flow__node-exp.selectable{cursor:default}.react-flow__node.react-flow__node-exp.selectable.selected,.react-flow__node.react-flow__node-exp.selectable:focus,.react-flow__node.react-flow__node-exp.selectable:focus-visible{outline:none;box-shadow:none}.exp-node{width:264px;border:1px solid var(--border);background:var(--base);padding:10px 12px;box-shadow:0 1px 2px #0000000a;font-size:12.5px;transition:box-shadow .12s ease}.exp-node:hover{box-shadow:0 2px 8px #00000014}.exp-node.live{border-color:var(--accent-teal);box-shadow:0 2px 12px #209a8433}.exp-node .node-eyebrow{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:6px;font-family:var(--mono);font-size:9.5px;font-weight:700;letter-spacing:.08em;text-transform:uppercase;color:var(--muted)}.exp-node .node-head{display:flex;align-items:center;gap:7px;min-width:0}.exp-node .node-status{width:8px;height:8px;border-radius:50%;flex-shrink:0}.exp-node .node-slug{font-family:var(--mono);font-size:12px;font-weight:700;color:var(--text);flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.exp-node .node-title{margin-top:4px;color:var(--subtext);font-size:11.5px;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.exp-node .node-meta{margin-top:8px;display:flex;align-items:center;gap:8px;font-size:10px;color:var(--muted);font-family:var(--mono);text-transform:uppercase;letter-spacing:.05em}.exp-node .baseline-chip{font-size:9px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;color:var(--muted);border:1px solid var(--border);padding:0 4px;flex-shrink:0}.exp-node .node-actions{margin-top:8px;padding-top:6px;border-top:1px solid var(--border-variant);display:flex;align-items:center;gap:3px}.exp-node .node-action{display:inline-flex;align-items:center;gap:5px;padding:3px 6px;font-size:10.5px;font-weight:700;color:var(--subtext);border-radius:6px;text-decoration:none}.exp-node .node-action:hover{color:var(--text);background:var(--surface)}.exp-node .node-action-ext{margin-left:auto;padding:3px 5px}.run-squares{display:flex;align-items:center;gap:3px}.run-sq{width:9px;height:9px;flex-shrink:0}.run-sq.pass{background:var(--accent-green)}.run-sq.fail{border:1.5px solid color-mix(in oklab,var(--accent-red) 55%,transparent)}.run-sq.live{background:var(--accent-teal);animation:pulse 1.2s ease-in-out infinite}.run-sq.other{border:1.5px solid var(--border)}.react-flow__handle{opacity:0;pointer-events:none}.react-flow__attribution{display:none!important}.runs-table-wrap{position:absolute;top:0;right:0;bottom:0;left:0;overflow:auto;padding:12px}.runs-table{width:100%;border-collapse:separate;border-spacing:0;font-size:12.5px;background:var(--base);border:1px solid var(--border);border-radius:10px;overflow:hidden}.runs-table th{text-align:left;color:var(--muted);font-size:10.5px;text-transform:uppercase;letter-spacing:.06em;font-weight:600;padding:8px 12px;border-bottom:1px solid var(--border);position:sticky;top:0;background:var(--base);z-index:1}.runs-table td{padding:8px 12px;border-bottom:1px solid color-mix(in oklab,var(--text) 6%,transparent);white-space:nowrap}.runs-table tr:last-child td{border-bottom:none}.runs-table tr.clickable{cursor:pointer}.runs-table tr.clickable:hover td{background:var(--canvas)}.mono{font-family:var(--mono);font-size:11.5px}.instances-section-title{display:flex;align-items:center;gap:8px;margin:22px 0 10px;font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:.05em;color:var(--muted)}.instances-section-title .count-badge{display:inline-flex;align-items:center;justify-content:center;min-width:18px;height:18px;padding:0 5px;border-radius:9px;background:var(--canvas);border:1px solid var(--border);font-size:11px;font-weight:500;letter-spacing:0;color:var(--text)}.instances-table-wrap{overflow-x:auto}.instances-empty{margin:0;padding:14px 16px;border:1px solid var(--border);border-radius:10px;background:var(--base);color:var(--subtext);font-size:12.5px}.backend-cell{display:inline-flex;align-items:center;gap:2px}.backend-cell .icon-btn{width:22px;height:22px}.backend-badge{display:inline-flex;align-items:center;gap:7px}.backend-badge svg{flex:none;display:block}.backend-badge .backend-name{font-weight:500}.backend-badge .backend-detail,.backend-badge.muted{color:var(--muted)}.status-chip{display:inline-flex;align-items:center;gap:6px;font-size:10px;font-weight:600;letter-spacing:.08em;text-transform:uppercase;font-family:var(--mono)}.status-chip .dot{width:8px;height:8px;border-radius:50%}.drawer{position:absolute;top:0;right:0;bottom:0;left:0;background:var(--base);display:flex;flex-direction:column;z-index:20}.drawer-body{flex:1;min-height:0;overflow-y:auto;padding:0 16px 24px;display:flex;flex-direction:column;gap:22px}.drawer-body>:first-child{margin-top:18px}.drawer-section h3{margin:0 0 10px;font-size:10px;text-transform:uppercase;letter-spacing:.08em;font-weight:700;color:var(--muted)}.kv{display:grid;grid-template-columns:auto 1fr;gap:3px 14px;font-size:12.5px}.kv .k{color:var(--muted)}.kv .v{font-family:var(--mono);font-size:11.5px;word-break:break-all}.term-view{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;flex-direction:column;background:var(--base);z-index:20}.term-bar{display:flex;align-items:center;gap:8px;height:40px;padding:0 10px;border-bottom:1px solid var(--border);flex-shrink:0}.term-title{min-width:0;font-size:13px;font-weight:600;color:var(--text);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.term-bar .error{font-size:11.5px;color:var(--accent-red)}.term-bar .btn{display:inline-flex;align-items:center;gap:5px}.term-fill{flex:1;min-height:0;background:#1a1a1a;padding:4px 0 4px 6px}.term-empty{height:100%;display:flex;align-items:center;justify-content:center;padding:24px;text-align:center;font-size:12.5px;color:var(--muted)}.run-history{position:relative;flex-shrink:0}.run-picker{display:inline-flex;align-items:center;gap:8px;padding:4px 6px 4px 10px;border:1px solid var(--border);border-radius:8px;background:var(--base);color:var(--text)}.run-picker:hover{background:var(--surface)}.run-picker .run-label{font-size:12px;font-weight:600}.run-picker-chev{color:var(--muted);flex-shrink:0}.history-menu{position:absolute;top:calc(100% + 6px);right:0;min-width:230px;max-height:320px;overflow-y:auto;background:var(--base);border:1px solid var(--border);border-radius:10px;box-shadow:0 12px 32px #0000002e;padding:5px;z-index:50}.history-item{display:flex;align-items:center;gap:8px;width:100%;text-align:left;padding:6px 8px;font-size:12px;border-radius:6px}.history-item:hover,.history-item.active{background:var(--surface)}.history-item .run-label{font-weight:600}.history-item .when{margin-left:auto;font-size:11px;color:var(--muted)}.changes-branch{display:flex;align-items:center;gap:8px;margin-bottom:10px}.commit-picker{display:flex;align-items:center;gap:8px}.ctl-label{flex-shrink:0;font-family:var(--mono);font-size:9.5px;font-weight:700;letter-spacing:.08em;text-transform:uppercase;color:var(--muted)}.commit-picker select{flex:1;min-width:0;font-family:var(--mono);font-size:11.5px}.uncommitted-dot{display:inline-block;width:8px;height:8px;border-radius:50%;background:var(--accent-purple);flex-shrink:0}.changes-note{font-size:11.5px;color:var(--muted)}.empty-state{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px;padding:24px;text-align:center;color:var(--subtext)}.empty-state p{max-width:46ch;margin:0;font-size:13px;line-height:1.5;text-wrap:balance}.empty-state-cta{gap:6px}.empty-state p.empty-state-title{font-size:18px;font-weight:400;color:var(--text)}.empty-state p.empty-state-hint{font-size:15px;color:var(--subtext)}.onboarding .home-inner{max-width:560px;padding-top:96px}.onb-eyebrow{font-family:var(--mono);font-size:10px;font-weight:600;text-transform:uppercase;letter-spacing:.08em;color:var(--muted);margin-bottom:14px}.onb-eyebrow span{color:var(--primary)}.onb-title{margin:0 0 6px;font-size:22px;letter-spacing:-.01em}.onb-sub{color:var(--subtext);font-size:13.5px;line-height:1.55;margin:0 0 22px;max-width:480px}.onb-cards{display:flex;flex-direction:column;gap:10px}.onb-card{display:flex;flex-direction:column;gap:5px;background:var(--base);border:1px solid var(--border);border-radius:10px;padding:18px 20px}.onb-card-head{display:flex;align-items:center;justify-content:space-between;gap:12px}.onb-card-name{font-weight:600;font-size:14px}.onb-card-detail{font-size:12px}.onb-card-meta{font-size:12px;color:var(--subtext)}.onb-card-meta code{font-family:var(--mono);font-size:11px}.onb-card-row{display:grid;grid-template-columns:56px 1fr auto;align-items:baseline;gap:12px;padding:3px 0}.onb-loading{display:flex;align-items:center;gap:8px;color:var(--subtext);font-size:13px;padding:8px 0}.onb-gh-options{display:flex;flex-direction:column;gap:16px;margin-top:12px;padding-top:14px;border-top:1px solid var(--border-variant)}.onb-gh-option{display:flex;flex-direction:column;gap:8px}.onb-gh-option-label{font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:.05em;color:var(--subtext)}.onb-gh-option-body{display:flex;align-items:center;flex-wrap:wrap;gap:10px}.onb-gh-cmd{font-family:var(--mono);font-size:12px;background:var(--panel);border:1px solid var(--border-variant);border-radius:5px;padding:3px 8px}.onb-gh-hint{font-size:12px;color:var(--subtext)}.onb-gh-hint code{font-family:var(--mono);font-size:11px}.onb-gh-or{display:flex;align-items:center;gap:10px;color:var(--muted);font-size:11px;text-transform:uppercase;letter-spacing:.05em}.onb-gh-or:before,.onb-gh-or:after{content:"";flex:1;height:1px;background:var(--border-variant)}.onb-gh-option .onb-token-form{flex:1;min-width:0;margin-top:0}.onb-token-form{display:flex;align-items:center;flex-wrap:wrap;gap:8px;margin-top:8px}.onb-token-form input{flex:1;min-width:220px;font-family:var(--mono);font-size:12px}.onb-token-form a{font-size:12px;color:var(--subtext);white-space:nowrap}.onb-token-form .error{flex-basis:100%;color:var(--accent-red);font-size:12.5px;white-space:pre-wrap}.onb-actions{display:flex;align-items:center;gap:10px;margin-top:22px}.form .form-seg{align-self:flex-start;margin-bottom:2px}.form .form-seg button{padding:5px 12px}.form .repo-hint{font-family:var(--mono);font-weight:400;text-transform:none;letter-spacing:normal;font-size:11px;color:var(--muted)}.form .repo-hint.ok{color:var(--accent-teal)}.form .paper-results{display:flex;flex-direction:column;border:1px solid var(--border);border-radius:8px;max-height:240px;overflow-y:auto}.form .paper-results button{display:flex;flex-direction:column;align-items:flex-start;gap:2px;padding:8px 10px;background:none;border:none;border-bottom:1px solid var(--border-variant);text-align:left;font:inherit;color:var(--text);cursor:pointer}.form .paper-results button:last-child{border-bottom:none}.form .paper-results button:hover{background:var(--surface)}.form .paper-results .title{font-size:12.5px;font-weight:500}.form .paper-results .id,.form .paper-pick .id{font-family:var(--mono);font-size:11px;color:var(--muted)}.form .paper-pick{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:10px 12px;border:1px solid var(--border);border-radius:8px;background:var(--surface)}.form .paper-pick .meta{min-width:0}.form .paper-pick .title{font-size:13px;font-weight:600}.form{display:flex;flex-direction:column;gap:10px}.form label{display:flex;flex-direction:column;gap:4px;font-size:11px;color:var(--subtext);font-weight:700;text-transform:uppercase;letter-spacing:.05em}.form .row2{display:grid;grid-template-columns:1fr 1fr;gap:10px}.form .actions{display:flex;justify-content:flex-end;gap:10px;margin-top:6px}.form .error,.report-view .error,.settings-card>.error{color:var(--accent-red);font-size:12.5px;white-space:pre-wrap;text-transform:none}.modal-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;background:#1d1b1a66;display:flex;align-items:center;justify-content:center;z-index:100}.modal{width:480px;max-width:94vw;max-height:88vh;overflow-y:auto;background:var(--base);border:1px solid var(--border);border-radius:12px;box-shadow:0 24px 60px #00000038;padding:24px}.modal h2{margin:0 0 14px;font-size:16px}:is(.modal,.home) :is(input,select,textarea){border-radius:8px}.settings-section+.settings-section{margin-top:18px;padding-top:16px;border-top:1px solid var(--border)}.settings-section h3{margin:0 0 8px;font-size:10px;text-transform:uppercase;letter-spacing:.08em;font-weight:700;color:var(--muted)}.settings-loading{display:flex;align-items:center;gap:8px;color:var(--subtext);font-size:12.5px;padding:4px 0}.settings-note{margin:10px 0 0;font-size:12px;padding:8px 10px;border:2px solid var(--accent-amber);background:var(--accent-amber-subtle);color:var(--accent-amber);font-weight:600}.progress{margin:12px 0 4px}.progress-track{height:8px;border-radius:999px;background:var(--surface);border:1px solid var(--border);overflow:hidden}.progress-fill{height:100%;background:var(--accent);border-radius:999px;transition:width .2s ease}.progress-caption{display:flex;justify-content:space-between;margin-top:6px;font-size:12px;color:var(--muted)}.settings-form{margin-top:14px;padding-top:14px;border-top:1px solid var(--border)}.badge{display:inline-flex;align-items:center;font-size:10px;font-weight:700;font-family:var(--mono);text-transform:uppercase;letter-spacing:.06em;padding:1px 7px;border:1px solid var(--border);color:var(--muted)}.badge.ok{color:var(--accent-green);border-color:var(--accent-green);background:var(--accent-green-subtle)}.badge.err{color:var(--accent-red);border-color:var(--accent-red);background:var(--accent-red-subtle)}.badge.warn{color:var(--accent-amber);border-color:var(--accent-amber);background:var(--accent-amber-subtle)}.files-tab{height:100%;overflow-y:auto;padding:20px 24px 48px}.files-col{max-width:var(--readable-col);margin:0 auto;display:flex;flex-direction:column;gap:10px}.files-meta{display:flex;gap:8px;flex-wrap:wrap}.files-pill{display:inline-flex;align-items:center;gap:8px;min-width:0;border:1px solid var(--border);border-radius:8px;padding:7px 11px;background:var(--base);color:var(--text);text-decoration:none}.files-pill code{font-family:var(--mono);font-size:11.5px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.files-pill>svg{flex-shrink:0;color:var(--muted)}a.files-pill:hover{border-color:var(--muted)}.files-pill-dir{flex:1;min-width:240px}.files-pill-dir code{flex:1;color:var(--subtext)}.files-pill-dir .icon-btn{width:22px;height:22px;margin:-4px -6px -4px 0}button.files-pill-link{cursor:pointer;font:inherit;font-size:12px;color:var(--muted);white-space:nowrap}button.files-pill-link:hover{border-color:var(--muted);color:var(--text)}.files-hint{margin:0;font-size:11.5px;line-height:1.5;color:var(--muted)}.files-hint code{font-family:var(--mono);font-size:10.5px}.files-card{border:1px solid var(--border);border-radius:10px;background:var(--base);overflow:hidden;margin-top:4px}.files-card>*+*{border-top:1px solid var(--border-variant)}.ftree-row{display:flex;align-items:center;gap:8px;padding:8px 14px}.ftree-row.clickable{cursor:pointer}.ftree-row:hover{background:var(--surface)}.ftree-children{background:var(--canvas);border-top:1px solid var(--border-variant)}.ftree-children .ftree-row:hover{background:var(--panel)}.ftree-chevron{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;flex-shrink:0;color:var(--muted);transition:transform .12s ease}.ftree-chevron.open{transform:rotate(90deg)}.ftree-chevron.spacer{visibility:hidden}.ftree-dirname{flex:1;min-width:0;font-family:var(--mono);font-size:12px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ftree-title{flex:1;min-width:0;font-size:13px;font-weight:500;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ftree-tag{flex-shrink:0;font-size:11px;color:var(--primary)}.ftree-status{flex-shrink:0;font-family:var(--mono);font-size:10.5px;color:var(--subtext)}.ftree-link{flex:1;min-width:0;display:flex;align-items:center;gap:8px;color:var(--text);text-decoration:none}.ftree-link:hover .ftree-name{text-decoration:underline}.ftree-name{min-width:0;font-size:12.5px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ftree-thumb{width:22px;height:22px;object-fit:cover;border-radius:4px;border:1px solid var(--border-variant);flex-shrink:0}.ftree-del{width:22px;height:22px;visibility:hidden}.ftree-row:hover .ftree-del{visibility:visible}.ftree-del:hover{color:var(--accent-red)}.ftree-date,.ftree-size{flex-shrink:0}.ftree-size{font-family:var(--mono);font-size:10.5px;color:var(--muted);white-space:nowrap}.ftree-divider{padding:10px 14px 4px;font-size:10px;font-weight:700;text-transform:uppercase;letter-spacing:.08em;color:var(--muted)}.files-empty{font-size:12.5px;line-height:1.55;color:var(--subtext);border:1px solid var(--border);border-radius:10px;background:var(--base);padding:18px;margin:4px 0 0}.files-empty code{font-family:var(--mono);font-size:11.5px}.files-truncated{margin:0;padding:8px 14px;font-size:11px;color:var(--muted)}.report-date,.ftree-date{font-size:11px;color:var(--muted);white-space:nowrap}.report-view{height:100%;overflow-y:auto;padding:16px 24px 48px}.report-view-col{max-width:var(--readable-col);margin:0 auto}.report-view-head{display:flex;align-items:center;gap:10px;margin-bottom:16px;padding-bottom:10px;border-bottom:1px solid var(--border-variant)}.report-md table{display:block;width:max-content;max-width:100%;overflow-x:auto}.report-md .report-img{display:block;margin:12px 0}.report-md .report-img img{max-width:100%;height:auto;border:1px solid var(--border)}.report-md .report-img-caption{display:block;margin-top:4px;text-align:center;font-size:11.5px;color:var(--subtext)}.openresearch-diff{display:flex;flex-direction:column;gap:16px}.diff-file-card{border:1px solid var(--border);border-radius:8px;background:var(--base)}.diff-file-header{position:sticky;top:0;z-index:10;display:flex;align-items:center;justify-content:space-between;gap:12px;margin:-1px -1px 0;width:calc(100% + 2px);text-align:left;padding:8px 12px;cursor:pointer}.diff-file-header:before{content:"";position:absolute;top:0;right:0;bottom:0;left:0;z-index:-2;background:var(--base)}.diff-file-header:after{content:"";position:absolute;top:0;right:0;bottom:0;left:0;z-index:-1;background:var(--canvas);border:1px solid var(--border);border-radius:8px 8px 0 0}.diff-file-header .chev{color:var(--muted);font-size:10px;flex-shrink:0;width:12px}.diff-file-header .path{display:flex;align-items:center;gap:8px;min-width:0;flex:1}.diff-file-header .path code{min-width:0;flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-family:var(--mono);font-size:.7rem;font-weight:700;color:var(--text)}.diff-file-header .stats{display:flex;align-items:center;gap:8px;flex-shrink:0;font-family:var(--mono);font-size:.65rem;font-weight:700;font-variant-numeric:tabular-nums}.diff-stat-add{color:var(--accent-green)}.diff-stat-del{color:var(--accent-red)}.diff-empty{padding:8px 12px;color:var(--muted);font-size:12.5px}.truncated-notice{border:2px solid var(--accent-amber);background:var(--accent-amber-subtle);padding:12px 14px;font-size:12.5px}.truncated-notice h4{margin:0 0 4px;font-size:13px;color:var(--accent-amber)}.truncated-notice p{margin:0;color:var(--subtext)}.openresearch-diff .openresearch-diff-file{--openresearch-diff-selection-background-color: color-mix( in oklab, var(--surface) 76%, var(--primary) );--openresearch-diff-gutter-selection-background-color: color-mix( in oklab, var(--surface) 68%, var(--primary) );--openresearch-diff-insert-gutter-background-color: color-mix( in oklab, var(--base) 84%, var(--accent-green) );--openresearch-diff-delete-gutter-background-color: color-mix( in oklab, var(--base) 86%, var(--accent-red) );--openresearch-diff-insert-code-background-color: color-mix( in oklab, var(--base) 91%, var(--accent-green) );--openresearch-diff-delete-code-background-color: color-mix( in oklab, var(--base) 92%, var(--accent-red) );--openresearch-diff-insert-edit-background-color: color-mix( in oklab, var(--base) 72%, var(--accent-green) );--openresearch-diff-delete-edit-background-color: color-mix( in oklab, var(--base) 78%, var(--accent-red) );--openresearch-diff-divider-color: var(--border);--openresearch-diff-omit-gutter-line-color: color-mix(in oklab, var(--base) 86%, var(--text));--openresearch-diff-unified-gutter-text-color: color-mix(in oklab, var(--text) 45%, var(--base));--diff-background-color: var(--base);--diff-text-color: var(--text);--diff-font-family: var(--mono);--diff-selection-text-color: var(--primary);--diff-selection-background-color: var(--openresearch-diff-selection-background-color);--diff-gutter-selected-text-color: var(--diff-selection-text-color);--diff-gutter-selected-background-color: var( --openresearch-diff-gutter-selection-background-color );--diff-code-selected-text-color: var(--diff-selection-text-color);--diff-code-selected-background-color: var(--diff-selection-background-color);--diff-gutter-insert-text-color: var(--accent-green);--diff-gutter-insert-background-color: var(--openresearch-diff-insert-gutter-background-color);--diff-gutter-delete-text-color: var(--accent-red);--diff-gutter-delete-background-color: var(--openresearch-diff-delete-gutter-background-color);--diff-code-insert-text-color: var(--diff-text-color);--diff-code-insert-background-color: var(--openresearch-diff-insert-code-background-color);--diff-code-delete-text-color: var(--diff-text-color);--diff-code-delete-background-color: var(--openresearch-diff-delete-code-background-color);--diff-code-insert-edit-text-color: var(--diff-text-color);--diff-code-insert-edit-background-color: var(--openresearch-diff-insert-edit-background-color);--diff-code-delete-edit-text-color: var(--diff-text-color);--diff-code-delete-edit-background-color: var(--openresearch-diff-delete-edit-background-color);--diff-omit-gutter-line-color: var(--openresearch-diff-omit-gutter-line-color);width:100%;font-size:12px;line-height:1.5}.openresearch-diff .openresearch-diff-file.diff-unified{table-layout:auto}.openresearch-diff .openresearch-diff-file.diff-unified .diff-line>td:first-child{display:none}.openresearch-diff .openresearch-diff-file.diff-unified .diff-line>td:nth-child(2){width:0%;padding:0 .5rem 0 .625rem;white-space:nowrap;text-align:right;color:var(--openresearch-diff-unified-gutter-text-color);border-right:1px solid var(--openresearch-diff-divider-color);-webkit-user-select:none;user-select:none;cursor:default}.openresearch-diff .openresearch-diff-file .diff-line{line-height:1.5}.openresearch-diff .openresearch-diff-file .diff-hunk+.diff-hunk .diff-line:first-child>td{border-top:1px solid var(--openresearch-diff-divider-color)}:is(.md,.openresearch-diff,.file-view) .token.comment,:is(.md,.openresearch-diff,.file-view) .token.prolog,:is(.md,.openresearch-diff,.file-view) .token.cdata{font-style:italic;color:#a0a1a7}:is(.md,.openresearch-diff,.file-view) .token.punctuation{color:#383a42}:is(.md,.openresearch-diff,.file-view) .token.property,:is(.md,.openresearch-diff,.file-view) .token.tag,:is(.md,.openresearch-diff,.file-view) .token.deleted{color:#e45649}:is(.md,.openresearch-diff,.file-view) .token.constant,:is(.md,.openresearch-diff,.file-view) .token.symbol,:is(.md,.openresearch-diff,.file-view) .token.boolean,:is(.md,.openresearch-diff,.file-view) .token.number{color:#986801}:is(.md,.openresearch-diff,.file-view) .token.selector,:is(.md,.openresearch-diff,.file-view) .token.attr-name,:is(.md,.openresearch-diff,.file-view) .token.char,:is(.md,.openresearch-diff,.file-view) .token.inserted,:is(.md,.openresearch-diff,.file-view) .token.string{color:#50a14f}:is(.md,.openresearch-diff,.file-view) .token.builtin{color:#c18401}:is(.md,.openresearch-diff,.file-view) .token.operator,:is(.md,.openresearch-diff,.file-view) .token.entity,:is(.md,.openresearch-diff,.file-view) .token.url{color:#56b6c2}:is(.md,.openresearch-diff,.file-view) .token.atrule,:is(.md,.openresearch-diff,.file-view) .token.attr-value{color:#986801}:is(.md,.openresearch-diff,.file-view) .token.keyword{color:#a626a4}:is(.md,.openresearch-diff,.file-view) .token.function,:is(.md,.openresearch-diff,.file-view) .token.decorator,:is(.md,.openresearch-diff,.file-view) .token.def{color:#4078f2}:is(.md,.openresearch-diff,.file-view) .token.class-name,:is(.md,.openresearch-diff,.file-view) .token.namespace{color:#c18401}:is(.md,.openresearch-diff,.file-view) .token.regex{color:#50a14f}:is(.md,.openresearch-diff,.file-view) .token.important,:is(.md,.openresearch-diff,.file-view) .token.variable{color:#e45649}:is(.md,.openresearch-diff,.file-view) .token.parameter{color:#383a42}@media(prefers-color-scheme:dark){:is(.md,.openresearch-diff,.file-view) .token.comment,:is(.md,.openresearch-diff,.file-view) .token.prolog,:is(.md,.openresearch-diff,.file-view) .token.cdata{font-style:italic;color:#7f848e}:is(.md,.openresearch-diff,.file-view) .token.punctuation{color:#abb2bf}:is(.md,.openresearch-diff,.file-view) .token.property,:is(.md,.openresearch-diff,.file-view) .token.tag,:is(.md,.openresearch-diff,.file-view) .token.deleted{color:#e06c75}:is(.md,.openresearch-diff,.file-view) .token.constant,:is(.md,.openresearch-diff,.file-view) .token.symbol,:is(.md,.openresearch-diff,.file-view) .token.boolean,:is(.md,.openresearch-diff,.file-view) .token.number{color:#d19a66}:is(.md,.openresearch-diff,.file-view) .token.selector,:is(.md,.openresearch-diff,.file-view) .token.attr-name,:is(.md,.openresearch-diff,.file-view) .token.char,:is(.md,.openresearch-diff,.file-view) .token.inserted,:is(.md,.openresearch-diff,.file-view) .token.string{color:#98c379}:is(.md,.openresearch-diff,.file-view) .token.builtin{color:#e5c07b}:is(.md,.openresearch-diff,.file-view) .token.operator,:is(.md,.openresearch-diff,.file-view) .token.entity,:is(.md,.openresearch-diff,.file-view) .token.url{color:#56b6c2}:is(.md,.openresearch-diff,.file-view) .token.atrule,:is(.md,.openresearch-diff,.file-view) .token.attr-value{color:#d19a66}:is(.md,.openresearch-diff,.file-view) .token.keyword{color:#c678dd}:is(.md,.openresearch-diff,.file-view) .token.function,:is(.md,.openresearch-diff,.file-view) .token.decorator,:is(.md,.openresearch-diff,.file-view) .token.def{color:#61afef}:is(.md,.openresearch-diff,.file-view) .token.class-name,:is(.md,.openresearch-diff,.file-view) .token.namespace{color:#e5c07b}:is(.md,.openresearch-diff,.file-view) .token.regex{color:#98c379}:is(.md,.openresearch-diff,.file-view) .token.important,:is(.md,.openresearch-diff,.file-view) .token.variable{color:#e06c75}:is(.md,.openresearch-diff,.file-view) .token.parameter{color:#abb2bf}}.report-back{display:inline-flex;align-items:center;gap:6px;font-size:13px;font-weight:600;color:var(--subtext);padding:4px 8px;border-radius:6px}.report-back:hover{color:var(--text);background:var(--surface)}.settings-view-scroll{flex:1;min-height:0;overflow-y:auto;scrollbar-gutter:stable both-edges}.settings-view{max-width:var(--readable-col);margin:0 auto;padding:24px 32px 60px}.settings-view h1{margin:0 0 6px;font-size:22px}.settings-head-row{display:flex;align-items:center;justify-content:space-between;gap:10px}.settings-head-row h1{margin:0}.settings-view>.error{color:var(--accent-red);font-size:12.5px;white-space:pre-wrap;text-transform:none;margin:0 0 12px}.settings-sub{margin:0 0 18px;color:var(--subtext);font-size:13px}.settings-card{background:var(--base);border:1px solid var(--border);border-radius:10px;padding:16px 18px;margin-bottom:16px}.settings-card h3{margin:0 0 10px;font-size:10px;text-transform:uppercase;letter-spacing:.08em;font-weight:700;color:var(--muted)}.settings-card .settings-sub{margin-bottom:12px}.settings-card-head{display:flex;align-items:center;gap:10px;margin-bottom:12px}.settings-card .kv{gap:6px 18px}.settings-empty{color:var(--muted);font-size:12.5px;margin:4px 0 0}.muted{color:var(--muted)}.harness-tabs{display:flex;gap:4px;margin-bottom:14px;border-bottom:1px solid var(--border-variant)}.harness-tabs button{display:inline-flex;align-items:center;gap:7px;padding:7px 12px;font-size:13px;font-weight:600;color:var(--subtext);border-bottom:2px solid transparent;margin-bottom:-1px}.harness-tabs button:hover{color:var(--text)}.harness-tabs button.active{color:var(--text);border-bottom-color:var(--primary)}.harness-dot{width:7px;height:7px;border-radius:50%;background:var(--muted)}.harness-dot.ok{background:var(--accent-green)}.harness-dot.err{background:var(--accent-red)}.harness-dot.warn{background:var(--accent-amber)}.env-table{width:100%;border-collapse:collapse;font-size:12.5px;table-layout:fixed}.env-table td:first-child{width:32%;overflow-wrap:anywhere}.env-table .badge{margin-left:8px}.env-table input{width:100%;border:none;background:transparent;padding:0}.env-table input:focus{box-shadow:0 1px 0 0 var(--text)}.env-table td{height:36px;padding:0 10px 0 0;vertical-align:middle;border-bottom:1px solid var(--border-variant)}.env-table td:last-child{width:116px;white-space:nowrap;text-align:right}.env-table td[colspan]{white-space:normal;text-align:left}.env-table .icon-btn{margin-left:8px;vertical-align:middle}.env-table .icon-btn:hover{color:var(--accent-red)}.flavor-table{width:100%;border-collapse:collapse;font-size:12.5px}.flavor-table th{padding:5px 10px 5px 0;border-bottom:1px solid var(--border);text-align:left;font-weight:500;color:var(--muted)}.flavor-table td{padding:5px 10px 5px 0;border-bottom:1px solid var(--border-variant)}.ssh-table{table-layout:fixed}.ssh-table th:nth-child(1){width:20%}.ssh-table th:nth-child(2){width:26%}.ssh-table th:nth-child(4){width:108px}.ssh-table th:nth-child(5){width:52px}.ssh-table td{overflow-wrap:anywhere}.ssh-table td:last-child{padding-right:0;text-align:right}.ssh-tested-at{display:block;margin-top:2px;color:var(--muted);font-size:11px}@keyframes settings-spin{to{transform:rotate(360deg)}}.spin{animation:settings-spin .9s linear infinite}.model-picker,.option-picker{position:relative;display:inline-flex}.composer-pill{display:inline-flex;align-items:center;gap:5px;font-family:var(--mono);font-size:11.5px;color:var(--subtext);padding:5px 8px;border-radius:6px}.composer-pill:hover{background:var(--surface);color:var(--text)}.composer-bare{display:inline-flex;align-items:center;gap:3px;font-size:11.5px;color:var(--subtext);padding:5px 4px;border-radius:6px}.composer-bare:hover{color:var(--text)}.model-menu,.option-menu{position:absolute;bottom:calc(100% + 8px);left:0;max-height:380px;display:flex;flex-direction:column;background:var(--base);border:1px solid var(--border);border-radius:10px;box-shadow:0 12px 32px #0000002e;z-index:50;overflow:hidden}.model-menu{width:320px}.option-menu{min-width:190px;padding:6px}.model-menu.align-right,.option-menu.align-right{left:auto;right:0}.option-menu.drop-down{bottom:auto;top:calc(100% + 4px)}.option-menu.session-menu{left:auto;right:6px;top:calc(100% - 2px);min-width:140px}.model-item.danger,.model-item.danger:hover{color:var(--accent-red)}.option-default{color:var(--muted);font-weight:400}.option-sep{height:1px;margin:5px 4px;background:var(--border-variant)}.option-num{color:var(--muted);font-size:11px;font-variant-numeric:tabular-nums}.model-menu input{border:none;border-bottom:1px solid var(--border-variant);background:none;padding:9px 12px;font-size:12.5px;outline:none}.model-menu-list{overflow-y:auto;padding:6px}.model-group{font-size:10px;font-weight:700;text-transform:uppercase;letter-spacing:.07em;color:var(--muted);padding:8px 8px 4px}.model-item{display:flex;align-items:center;justify-content:space-between;gap:8px;width:100%;text-align:left;padding:6px 8px;font-size:12.5px;border-radius:6px}.model-item:hover{background:var(--surface)}.model-item .model-id{display:block;font-family:var(--mono);font-size:10px;color:var(--muted)}.model-more{padding:4px 8px 8px;font-size:11px;color:var(--muted)}.model-locked-note{display:flex;align-items:center;gap:6px;padding:7px 12px;font-size:11px;color:var(--muted);border-top:1px solid var(--border-variant)}.model-locked-note svg{flex-shrink:0}.skill-menu{position:absolute;bottom:calc(100% + 8px);left:0;min-width:340px;max-width:100%;padding:6px;background:var(--base);border:1px solid var(--border);border-radius:10px;box-shadow:0 12px 32px #0000002e;z-index:50;overflow:hidden}.skill-item{display:flex;flex-direction:column;gap:2px;width:100%;text-align:left;padding:7px 8px;border-radius:6px}.skill-item.active{background:var(--surface)}.skill-item .skill-name{font-family:var(--mono);font-size:12px}.skill-item .skill-hint{color:var(--muted)}.skill-item .skill-desc{font-size:11px;color:var(--subtext)}.file-view{display:flex;flex-direction:column;height:100%;min-height:0}.file-view-header{display:flex;align-items:center;gap:8px;padding:4px 12px;border-bottom:1px solid var(--border-variant);color:var(--subtext);flex-shrink:0}.file-view-path{font-family:var(--mono);font-size:12px;color:var(--text);flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.file-view-ref{font-family:var(--mono);font-size:11px;color:var(--muted);border:1px solid var(--border-variant);border-radius:6px;padding:1px 6px;max-width:180px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex-shrink:0}.file-view-body{flex:1;min-height:0;overflow:auto;background:var(--base)}.file-view-codewrap{display:flex;align-items:flex-start;min-width:max-content}.file-view-gutter{margin:0;padding:14px 10px 14px 14px;font-family:var(--mono);font-size:12px;line-height:1.55;text-align:right;color:var(--muted);-webkit-user-select:none;user-select:none;position:sticky;left:0;background:var(--base);border-right:1px solid var(--border-variant);flex-shrink:0}.file-view-code{margin:0;padding:14px 16px;font-family:var(--mono);font-size:12px;line-height:1.55;-moz-tab-size:4;tab-size:4;min-width:max-content}.file-view-note{padding:10px 16px;font-size:12px;color:var(--muted)}.file-view-md{max-width:var(--readable-col);padding:18px 20px 32px}.file-view-md .md{font-size:13.5px}.file-view-md .md h1{font-size:1.5em;margin:18px 0 8px}.file-view-md .md h2{font-size:1.25em;margin:16px 0 8px}.file-view-md .md h3{font-size:1.1em}.icon-btn.active{color:var(--primary);background:var(--surface)}.prompt-card{margin:8px 0;padding:12px 14px;border:1px solid var(--border);border-left:3px solid var(--border);border-radius:6px;background:var(--surface);display:flex;flex-direction:column;gap:9px}.prompt-card.plan{border-left-color:var(--accent-blue)}.prompt-card.permission{border-left-color:var(--accent-amber)}.prompt-card.question{border-left-color:var(--accent-purple)}.prompt-card.resolved{opacity:.6}.prompt-head{font-size:11px;font-weight:600;letter-spacing:.03em;text-transform:uppercase;color:var(--muted)}.prompt-head code{font-family:var(--mono);font-size:11.5px;text-transform:none;color:var(--text)}.prompt-sub{font-family:var(--mono);font-size:12px;color:var(--subtext);word-break:break-word}.prompt-q{font-size:14px;font-weight:600;line-height:1.5;color:var(--text)}.prompt-plan{font-size:13.5px;line-height:1.6;color:var(--text);max-height:340px;overflow-y:auto}.prompt-options{display:flex;flex-direction:column;gap:6px}.prompt-option{display:flex;flex-direction:column;align-items:flex-start;gap:2px;width:100%;padding:8px 11px;text-align:left;border:1px solid var(--border);border-radius:5px;background:var(--base);color:var(--text);cursor:pointer;transition:border-color 80ms ease,background 80ms ease}.prompt-option:hover:not(:disabled){border-color:var(--border-strong);background:var(--surface)}.prompt-option.sel{border-color:var(--primary);background:var(--primary-subtle)}.prompt-option:disabled{cursor:default}.prompt-option-label{display:block;font-size:13px;font-weight:600}.prompt-option-desc{display:block;font-size:12px;font-weight:400;line-height:1.45;color:var(--subtext)}.prompt-actions{display:flex;flex-wrap:wrap;gap:8px}.prompt-actions .btn-primary,.prompt-actions .btn-ghost{display:inline-flex;align-items:center;gap:6px;padding:6px 13px;font-family:inherit;font-size:12px;font-weight:600;border:1px solid transparent;border-radius:5px;cursor:pointer;transition:background 80ms ease,border-color 80ms ease}.prompt-actions .btn-primary{background:var(--primary);color:var(--base)}.prompt-actions .btn-primary:hover:not(:disabled){opacity:.9}.prompt-actions .btn-ghost{background:transparent;border-color:var(--border);color:var(--subtext)}.prompt-actions .btn-ghost:hover:not(:disabled){border-color:var(--border-strong);color:var(--text);background:var(--surface)}.prompt-actions button:disabled{opacity:.5;cursor:default}.prompt-resolved{font-size:11px;font-weight:600;color:var(--muted)}.plan-strip{position:relative;z-index:5;max-width:var(--readable-col);width:calc(100% - 32px);margin:0 auto 6px;padding:9px 12px;display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;border:1px solid var(--border);border-left:3px solid var(--accent-blue);border-radius:8px;background:var(--surface);box-shadow:0 2px 10px #0000000f}.plan-strip-info{display:flex;align-items:center;gap:9px;min-width:0;flex:1}.plan-strip-icon{color:var(--accent-blue);flex-shrink:0}.plan-strip-text{display:flex;flex-direction:column;min-width:0}.plan-strip-title{font-size:12.5px;font-weight:600}.plan-strip-excerpt{font-size:12px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.plan-strip-actions{display:flex;align-items:center;gap:6px;flex-shrink:0}.plan-strip-approve{position:relative;display:flex}.plan-strip-approve .btn-primary:first-child{border-top-right-radius:0;border-bottom-right-radius:0}.plan-strip-caret{border-top-left-radius:0;border-bottom-left-radius:0;padding:0 5px;margin-left:1px;display:flex;align-items:center}.plan-strip-menu{position:absolute;right:0;bottom:calc(100% + 4px);display:flex;flex-direction:column;min-width:190px;padding:4px;border:1px solid var(--border);border-radius:8px;background:var(--surface);box-shadow:0 6px 20px #0000001f;z-index:6}.plan-strip-menu button{text-align:left;padding:7px 9px;border:none;border-radius:5px;background:transparent;color:var(--text);font-size:12.5px;cursor:pointer}.plan-strip-menu button:hover{background:var(--surface-2, rgb(0 0 0 / 5%))}.prompt-plan.clamped{max-height:9.5em;overflow:hidden;position:relative}.prompt-plan.clamped:after{content:"";position:absolute;inset:auto 0 0 0;height:34px;background:linear-gradient(to bottom,transparent,var(--surface));pointer-events:none}.prompt-plan-open{align-self:flex-start;border:none;background:transparent;color:var(--accent-blue);font-size:12px;padding:0;cursor:pointer}.prompt-plan-open:hover{text-decoration:underline}.code-tab{display:flex;flex-direction:column;height:100%;min-height:0}.code-tab-header{display:flex;align-items:center;gap:8px;padding:10px 14px;border-bottom:1px solid var(--border-variant);flex-shrink:0}.code-tab-select{max-width:280px;min-width:0}.code-tab-note{padding:8px 16px;font-size:12px;color:var(--muted);border-bottom:1px solid var(--border-variant);flex-shrink:0}.code-tab-body{flex:1;min-height:0;overflow:auto;background:var(--base)}.code-tree{padding:6px 0;font-size:12.5px}.code-tree-row{display:flex;align-items:center;gap:6px;width:100%;padding:3px 10px;border:none;background:transparent;color:var(--text);text-align:left;cursor:pointer;font-family:inherit;font-size:inherit}.code-tree-row:hover{background:var(--panel)}.code-tree-row>svg{flex-shrink:0;color:var(--subtext)}.code-tree-row>svg.code-tree-chev{color:var(--muted)}.code-tree-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.react-flow{direction:ltr;--xy-edge-stroke-default: #b1b1b7;--xy-edge-stroke-width-default: 1;--xy-edge-stroke-selected-default: #555;--xy-connectionline-stroke-default: #b1b1b7;--xy-connectionline-stroke-width-default: 1;--xy-attribution-background-color-default: rgba(255, 255, 255, .5);--xy-minimap-background-color-default: #fff;--xy-minimap-mask-background-color-default: rgba(240, 240, 240, .6);--xy-minimap-mask-stroke-color-default: transparent;--xy-minimap-mask-stroke-width-default: 1;--xy-minimap-node-background-color-default: #e2e2e2;--xy-minimap-node-stroke-color-default: transparent;--xy-minimap-node-stroke-width-default: 2;--xy-background-color-default: transparent;--xy-background-pattern-dots-color-default: #91919a;--xy-background-pattern-lines-color-default: #eee;--xy-background-pattern-cross-color-default: #e2e2e2;background-color:var(--xy-background-color, var(--xy-background-color-default));--xy-node-color-default: inherit;--xy-node-border-default: 1px solid #1a192b;--xy-node-background-color-default: #fff;--xy-node-group-background-color-default: rgba(240, 240, 240, .25);--xy-node-boxshadow-hover-default: 0 1px 4px 1px rgba(0, 0, 0, .08);--xy-node-boxshadow-selected-default: 0 0 0 .5px #1a192b;--xy-node-border-radius-default: 3px;--xy-handle-background-color-default: #1a192b;--xy-handle-border-color-default: #fff;--xy-selection-background-color-default: rgba(0, 89, 220, .08);--xy-selection-border-default: 1px dotted rgba(0, 89, 220, .8);--xy-controls-button-background-color-default: #fefefe;--xy-controls-button-background-color-hover-default: #f4f4f4;--xy-controls-button-color-default: inherit;--xy-controls-button-color-hover-default: inherit;--xy-controls-button-border-color-default: #eee;--xy-controls-box-shadow-default: 0 0 2px 1px rgba(0, 0, 0, .08);--xy-edge-label-background-color-default: #ffffff;--xy-edge-label-color-default: inherit;--xy-resize-background-color-default: #3367d9}.react-flow.dark{--xy-edge-stroke-default: #3e3e3e;--xy-edge-stroke-width-default: 1;--xy-edge-stroke-selected-default: #727272;--xy-connectionline-stroke-default: #b1b1b7;--xy-connectionline-stroke-width-default: 1;--xy-attribution-background-color-default: rgba(150, 150, 150, .25);--xy-minimap-background-color-default: #141414;--xy-minimap-mask-background-color-default: rgba(60, 60, 60, .6);--xy-minimap-mask-stroke-color-default: transparent;--xy-minimap-mask-stroke-width-default: 1;--xy-minimap-node-background-color-default: #2b2b2b;--xy-minimap-node-stroke-color-default: transparent;--xy-minimap-node-stroke-width-default: 2;--xy-background-color-default: #141414;--xy-background-pattern-dots-color-default: #555;--xy-background-pattern-lines-color-default: #333;--xy-background-pattern-cross-color-default: #333;--xy-node-color-default: #f8f8f8;--xy-node-border-default: 1px solid #3c3c3c;--xy-node-background-color-default: #1e1e1e;--xy-node-group-background-color-default: rgba(240, 240, 240, .25);--xy-node-boxshadow-hover-default: 0 1px 4px 1px rgba(255, 255, 255, .08);--xy-node-boxshadow-selected-default: 0 0 0 .5px #999;--xy-handle-background-color-default: #bebebe;--xy-handle-border-color-default: #1e1e1e;--xy-selection-background-color-default: rgba(200, 200, 220, .08);--xy-selection-border-default: 1px dotted rgba(200, 200, 220, .8);--xy-controls-button-background-color-default: #2b2b2b;--xy-controls-button-background-color-hover-default: #3e3e3e;--xy-controls-button-color-default: #f8f8f8;--xy-controls-button-color-hover-default: #fff;--xy-controls-button-border-color-default: #5b5b5b;--xy-controls-box-shadow-default: 0 0 2px 1px rgba(0, 0, 0, .08);--xy-edge-label-background-color-default: #141414;--xy-edge-label-color-default: #f8f8f8}.react-flow__background{background-color:var(--xy-background-color-props, var(--xy-background-color, var(--xy-background-color-default)));pointer-events:none;z-index:-1}.react-flow__container{position:absolute;width:100%;height:100%;top:0;left:0}.react-flow__pane{z-index:1;touch-action:none}.react-flow__pane.draggable{cursor:grab}.react-flow__pane.dragging{cursor:grabbing}.react-flow__pane.selection{cursor:pointer}.react-flow__viewport{transform-origin:0 0;z-index:2;pointer-events:none}.react-flow__renderer{z-index:4}.react-flow__selection{z-index:6}.react-flow__nodesselection-rect:focus,.react-flow__nodesselection-rect:focus-visible{outline:none}.react-flow__edge-path{stroke:var(--xy-edge-stroke, var(--xy-edge-stroke-default));stroke-width:var(--xy-edge-stroke-width, var(--xy-edge-stroke-width-default));fill:none}.react-flow__connection-path{stroke:var(--xy-connectionline-stroke, var(--xy-connectionline-stroke-default));stroke-width:var(--xy-connectionline-stroke-width, var(--xy-connectionline-stroke-width-default));fill:none}.react-flow .react-flow__edges{position:absolute}.react-flow .react-flow__edges svg{overflow:visible;position:absolute;pointer-events:none}.react-flow__edge{pointer-events:visibleStroke}.react-flow__edge.selectable{cursor:pointer}.react-flow__edge.animated path{stroke-dasharray:5;animation:dashdraw .5s linear infinite}.react-flow__edge.animated path.react-flow__edge-interaction{stroke-dasharray:none;animation:none}.react-flow__edge.inactive{pointer-events:none}.react-flow__edge.selected,.react-flow__edge:focus,.react-flow__edge:focus-visible{outline:none}.react-flow__edge.selected .react-flow__edge-path,.react-flow__edge.selectable:focus .react-flow__edge-path,.react-flow__edge.selectable:focus-visible .react-flow__edge-path{stroke:var(--xy-edge-stroke-selected, var(--xy-edge-stroke-selected-default))}.react-flow__edge-textwrapper{pointer-events:all}.react-flow__edge .react-flow__edge-text{pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__arrowhead polyline{stroke:var(--xy-edge-stroke, var(--xy-edge-stroke-default))}.react-flow__arrowhead polyline.arrowclosed{fill:var(--xy-edge-stroke, var(--xy-edge-stroke-default))}.react-flow__connection{pointer-events:none}.react-flow__connection .animated{stroke-dasharray:5;animation:dashdraw .5s linear infinite}svg.react-flow__connectionline{z-index:1001;overflow:visible;position:absolute}.react-flow__nodes{pointer-events:none;transform-origin:0 0}.react-flow__node{position:absolute;-webkit-user-select:none;-moz-user-select:none;user-select:none;pointer-events:all;transform-origin:0 0;box-sizing:border-box;cursor:default}.react-flow__node.selectable{cursor:pointer}.react-flow__node.draggable{cursor:grab;pointer-events:all}.react-flow__node.draggable.dragging{cursor:grabbing}.react-flow__nodesselection{z-index:3;transform-origin:left top;pointer-events:none}.react-flow__nodesselection-rect{position:absolute;pointer-events:all;cursor:grab}.react-flow__handle{position:absolute;pointer-events:none;min-width:5px;min-height:5px;width:6px;height:6px;background-color:var(--xy-handle-background-color, var(--xy-handle-background-color-default));border:1px solid var(--xy-handle-border-color, var(--xy-handle-border-color-default));border-radius:100%}.react-flow__handle.connectingfrom{pointer-events:all}.react-flow__handle.connectionindicator{pointer-events:all;cursor:crosshair}.react-flow__handle-bottom{top:auto;left:50%;bottom:0;transform:translate(-50%,50%)}.react-flow__handle-top{top:0;left:50%;transform:translate(-50%,-50%)}.react-flow__handle-left{top:50%;left:0;transform:translate(-50%,-50%)}.react-flow__handle-right{top:50%;right:0;transform:translate(50%,-50%)}.react-flow__edgeupdater{cursor:move;pointer-events:all}.react-flow__pane.selection .react-flow__panel{pointer-events:none}.react-flow__panel{position:absolute;z-index:5;margin:15px}.react-flow__panel.top{top:0}.react-flow__panel.bottom{bottom:0}.react-flow__panel.top.center,.react-flow__panel.bottom.center{left:50%;transform:translate(-15px) translate(-50%)}.react-flow__panel.left{left:0}.react-flow__panel.right{right:0}.react-flow__panel.left.center,.react-flow__panel.right.center{top:50%;transform:translateY(-15px) translateY(-50%)}.react-flow__attribution{font-size:10px;background:var(--xy-attribution-background-color, var(--xy-attribution-background-color-default));padding:2px 3px;margin:0}.react-flow__attribution a{text-decoration:none;color:#999}@keyframes dashdraw{0%{stroke-dashoffset:10}}.react-flow__edgelabel-renderer{position:absolute;width:100%;height:100%;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;left:0;top:0}.react-flow__viewport-portal{position:absolute;width:100%;height:100%;left:0;top:0;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__minimap{background:var( --xy-minimap-background-color-props, var(--xy-minimap-background-color, var(--xy-minimap-background-color-default)) )}.react-flow__minimap-svg{display:block}.react-flow__minimap-mask{fill:var( --xy-minimap-mask-background-color-props, var(--xy-minimap-mask-background-color, var(--xy-minimap-mask-background-color-default)) );stroke:var( --xy-minimap-mask-stroke-color-props, var(--xy-minimap-mask-stroke-color, var(--xy-minimap-mask-stroke-color-default)) );stroke-width:var( --xy-minimap-mask-stroke-width-props, var(--xy-minimap-mask-stroke-width, var(--xy-minimap-mask-stroke-width-default)) )}.react-flow__minimap-node{fill:var( --xy-minimap-node-background-color-props, var(--xy-minimap-node-background-color, var(--xy-minimap-node-background-color-default)) );stroke:var( --xy-minimap-node-stroke-color-props, var(--xy-minimap-node-stroke-color, var(--xy-minimap-node-stroke-color-default)) );stroke-width:var( --xy-minimap-node-stroke-width-props, var(--xy-minimap-node-stroke-width, var(--xy-minimap-node-stroke-width-default)) )}.react-flow__background-pattern.dots{fill:var( --xy-background-pattern-color-props, var(--xy-background-pattern-color, var(--xy-background-pattern-dots-color-default)) )}.react-flow__background-pattern.lines{stroke:var( --xy-background-pattern-color-props, var(--xy-background-pattern-color, var(--xy-background-pattern-lines-color-default)) )}.react-flow__background-pattern.cross{stroke:var( --xy-background-pattern-color-props, var(--xy-background-pattern-color, var(--xy-background-pattern-cross-color-default)) )}.react-flow__controls{display:flex;flex-direction:column;box-shadow:var(--xy-controls-box-shadow, var(--xy-controls-box-shadow-default))}.react-flow__controls.horizontal{flex-direction:row}.react-flow__controls-button{display:flex;justify-content:center;align-items:center;height:26px;width:26px;padding:4px;border:none;background:var(--xy-controls-button-background-color, var(--xy-controls-button-background-color-default));border-bottom:1px solid var( --xy-controls-button-border-color-props, var(--xy-controls-button-border-color, var(--xy-controls-button-border-color-default)) );color:var( --xy-controls-button-color-props, var(--xy-controls-button-color, var(--xy-controls-button-color-default)) );cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__controls-button svg{width:100%;max-width:12px;max-height:12px;fill:currentColor}.react-flow__edge.updating .react-flow__edge-path{stroke:#777}.react-flow__edge-text{font-size:10px}.react-flow__node.selectable:focus,.react-flow__node.selectable:focus-visible{outline:none}.react-flow__node-input,.react-flow__node-default,.react-flow__node-output,.react-flow__node-group{padding:10px;border-radius:var(--xy-node-border-radius, var(--xy-node-border-radius-default));width:150px;font-size:12px;color:var(--xy-node-color, var(--xy-node-color-default));text-align:center;border:var(--xy-node-border, var(--xy-node-border-default));background-color:var(--xy-node-background-color, var(--xy-node-background-color-default))}.react-flow__node-input.selectable:hover,.react-flow__node-default.selectable:hover,.react-flow__node-output.selectable:hover,.react-flow__node-group.selectable:hover{box-shadow:var(--xy-node-boxshadow-hover, var(--xy-node-boxshadow-hover-default))}.react-flow__node-input.selectable.selected,.react-flow__node-input.selectable:focus,.react-flow__node-input.selectable:focus-visible,.react-flow__node-default.selectable.selected,.react-flow__node-default.selectable:focus,.react-flow__node-default.selectable:focus-visible,.react-flow__node-output.selectable.selected,.react-flow__node-output.selectable:focus,.react-flow__node-output.selectable:focus-visible,.react-flow__node-group.selectable.selected,.react-flow__node-group.selectable:focus,.react-flow__node-group.selectable:focus-visible{box-shadow:var(--xy-node-boxshadow-selected, var(--xy-node-boxshadow-selected-default))}.react-flow__node-group{background-color:var(--xy-node-group-background-color, var(--xy-node-group-background-color-default))}.react-flow__nodesselection-rect,.react-flow__selection{background:var(--xy-selection-background-color, var(--xy-selection-background-color-default));border:var(--xy-selection-border, var(--xy-selection-border-default))}.react-flow__nodesselection-rect:focus,.react-flow__nodesselection-rect:focus-visible,.react-flow__selection:focus,.react-flow__selection:focus-visible{outline:none}.react-flow__controls-button:hover{background:var( --xy-controls-button-background-color-hover-props, var(--xy-controls-button-background-color-hover, var(--xy-controls-button-background-color-hover-default)) );color:var( --xy-controls-button-color-hover-props, var(--xy-controls-button-color-hover, var(--xy-controls-button-color-hover-default)) )}.react-flow__controls-button:disabled{pointer-events:none}.react-flow__controls-button:disabled svg{fill-opacity:.4}.react-flow__controls-button:last-child{border-bottom:none}.react-flow__controls.horizontal .react-flow__controls-button{border-bottom:none;border-right:1px solid var( --xy-controls-button-border-color-props, var(--xy-controls-button-border-color, var(--xy-controls-button-border-color-default)) )}.react-flow__controls.horizontal .react-flow__controls-button:last-child{border-right:none}.react-flow__resize-control{position:absolute}.react-flow__resize-control.left,.react-flow__resize-control.right{cursor:ew-resize}.react-flow__resize-control.top,.react-flow__resize-control.bottom{cursor:ns-resize}.react-flow__resize-control.top.left,.react-flow__resize-control.bottom.right{cursor:nwse-resize}.react-flow__resize-control.bottom.left,.react-flow__resize-control.top.right{cursor:nesw-resize}.react-flow__resize-control.handle{width:5px;height:5px;border:1px solid #fff;border-radius:1px;background-color:var(--xy-resize-background-color, var(--xy-resize-background-color-default));translate:-50% -50%}.react-flow__resize-control.handle.left{left:0;top:50%}.react-flow__resize-control.handle.right{left:100%;top:50%}.react-flow__resize-control.handle.top{left:50%;top:0}.react-flow__resize-control.handle.bottom{left:50%;top:100%}.react-flow__resize-control.handle.top.left,.react-flow__resize-control.handle.bottom.left{left:0}.react-flow__resize-control.handle.top.right,.react-flow__resize-control.handle.bottom.right{left:100%}.react-flow__resize-control.line{border-color:var(--xy-resize-background-color, var(--xy-resize-background-color-default));border-width:0;border-style:solid}.react-flow__resize-control.line.left,.react-flow__resize-control.line.right{width:1px;transform:translate(-50%);top:0;height:100%}.react-flow__resize-control.line.left{left:0;border-left-width:1px}.react-flow__resize-control.line.right{left:100%;border-right-width:1px}.react-flow__resize-control.line.top,.react-flow__resize-control.line.bottom{height:1px;transform:translateY(-50%);left:0;width:100%}.react-flow__resize-control.line.top{top:0;border-top-width:1px}.react-flow__resize-control.line.bottom{border-bottom-width:1px;top:100%}.react-flow__edge-textbg{fill:var(--xy-edge-label-background-color, var(--xy-edge-label-background-color-default))}.react-flow__edge-text{fill:var(--xy-edge-label-color, var(--xy-edge-label-color-default))}/** + * Copyright (c) 2014 The xterm.js authors. All rights reserved. + * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License) + * https://github.com/chjj/term.js + * @license MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * Originally forked from (with the author's permission): + * Fabrice Bellard's javascript vt100 for jslinux: + * http://bellard.org/jslinux/ + * Copyright (c) 2011 Fabrice Bellard + * The original design remains. The terminal itself + * has been extended to include xterm CSI codes, among + * other features. + */.xterm{cursor:text;position:relative;user-select:none;-ms-user-select:none;-webkit-user-select:none}.xterm.focus,.xterm:focus{outline:none}.xterm .xterm-helpers{position:absolute;top:0;z-index:5}.xterm .xterm-helper-textarea{padding:0;border:0;margin:0;position:absolute;opacity:0;left:-9999em;top:0;width:0;height:0;z-index:-5;white-space:nowrap;overflow:hidden;resize:none}.xterm .composition-view{background:#000;color:#fff;display:none;position:absolute;white-space:nowrap;z-index:1}.xterm .composition-view.active{display:block}.xterm .xterm-viewport{background-color:#000;overflow-y:scroll;cursor:default;position:absolute;right:0;left:0;top:0;bottom:0}.xterm .xterm-screen{position:relative}.xterm .xterm-screen canvas{position:absolute;left:0;top:0}.xterm .xterm-scroll-area{visibility:hidden}.xterm-char-measure-element{display:inline-block;visibility:hidden;position:absolute;top:0;left:-9999em;line-height:normal}.xterm.enable-mouse-events{cursor:default}.xterm.xterm-cursor-pointer,.xterm .xterm-cursor-pointer{cursor:pointer}.xterm.column-select.focus{cursor:crosshair}.xterm .xterm-accessibility:not(.debug),.xterm .xterm-message{position:absolute;left:0;top:0;bottom:0;right:0;z-index:10;color:transparent;pointer-events:none}.xterm .xterm-accessibility-tree:not(.debug) *::selection{color:transparent}.xterm .xterm-accessibility-tree{-webkit-user-select:text;user-select:text;white-space:pre}.xterm .live-region{position:absolute;left:-9999px;width:1px;height:1px;overflow:hidden}.xterm-dim{opacity:1!important}.xterm-underline-1{text-decoration:underline}.xterm-underline-2{text-decoration:double underline}.xterm-underline-3{text-decoration:wavy underline}.xterm-underline-4{text-decoration:dotted underline}.xterm-underline-5{text-decoration:dashed underline}.xterm-overline{text-decoration:overline}.xterm-overline.xterm-underline-1{text-decoration:overline underline}.xterm-overline.xterm-underline-2{text-decoration:overline double underline}.xterm-overline.xterm-underline-3{text-decoration:overline wavy underline}.xterm-overline.xterm-underline-4{text-decoration:overline dotted underline}.xterm-overline.xterm-underline-5{text-decoration:overline dashed underline}.xterm-strikethrough{text-decoration:line-through}.xterm-screen .xterm-decoration-container .xterm-decoration{z-index:6;position:absolute}.xterm-screen .xterm-decoration-container .xterm-decoration.xterm-decoration-top-layer{z-index:7}.xterm-decoration-overview-ruler{z-index:8;position:absolute;top:0;right:0;pointer-events:none}.xterm-decoration-top{z-index:2;position:relative} diff --git a/ui/dist/assets/index-hCeZGmkM.css b/ui/dist/assets/index-hCeZGmkM.css deleted file mode 100644 index 3c38b824..00000000 --- a/ui/dist/assets/index-hCeZGmkM.css +++ /dev/null @@ -1,32 +0,0 @@ -:root{--diff-background-color:initial;--diff-text-color:initial;--diff-font-family:Consolas,Courier,monospace;--diff-selection-background-color:#b3d7ff;--diff-selection-text-color:var(--diff-text-color);--diff-gutter-insert-background-color:#d6fedb;--diff-gutter-insert-text-color:var(--diff-text-color);--diff-gutter-delete-background-color:#fadde0;--diff-gutter-delete-text-color:var(--diff-text-color);--diff-gutter-selected-background-color:#fffce0;--diff-gutter-selected-text-color:var(--diff-text-color);--diff-code-insert-background-color:#eaffee;--diff-code-insert-text-color:var(--diff-text-color);--diff-code-delete-background-color:#fdeff0;--diff-code-delete-text-color:var(--diff-text-color);--diff-code-insert-edit-background-color:#c0dc91;--diff-code-insert-edit-text-color:var(--diff-text-color);--diff-code-delete-edit-background-color:#f39ea2;--diff-code-delete-edit-text-color:var(--diff-text-color);--diff-code-selected-background-color:#fffce0;--diff-code-selected-text-color:var(--diff-text-color);--diff-omit-gutter-line-color:#cb2a1d}.diff{background-color:var(--diff-background-color);border-collapse:collapse;color:var(--diff-text-color);table-layout:fixed;width:100%}.diff::-moz-selection{background-color:#b3d7ff;background-color:var(--diff-selection-background-color);color:var(--diff-text-color);color:var(--diff-selection-text-color)}.diff::selection{background-color:#b3d7ff;background-color:var(--diff-selection-background-color);color:var(--diff-text-color);color:var(--diff-selection-text-color)}.diff td{padding-bottom:0;padding-top:0;vertical-align:top}.diff-line{font-family:Consolas,Courier,monospace;font-family:var(--diff-font-family);line-height:1.5}.diff-gutter>a{color:inherit;display:block}.diff-gutter{cursor:pointer;padding:0 1ch;text-align:right;-webkit-user-select:none;-moz-user-select:none;user-select:none}.diff-gutter-insert{background-color:#d6fedb;background-color:var(--diff-gutter-insert-background-color);color:var(--diff-text-color);color:var(--diff-gutter-insert-text-color)}.diff-gutter-delete{background-color:#fadde0;background-color:var(--diff-gutter-delete-background-color);color:var(--diff-text-color);color:var(--diff-gutter-delete-text-color)}.diff-gutter-omit{cursor:default}.diff-gutter-selected{background-color:#fffce0;background-color:var(--diff-gutter-selected-background-color);color:var(--diff-text-color);color:var(--diff-gutter-selected-text-color)}.diff-code{word-wrap:break-word;padding:0 0 0 .5em;white-space:pre-wrap;word-break:break-all}.diff-code-edit{color:inherit}.diff-code-insert{background-color:#eaffee;background-color:var(--diff-code-insert-background-color);color:var(--diff-text-color);color:var(--diff-code-insert-text-color)}.diff-code-insert .diff-code-edit{background-color:#c0dc91;background-color:var(--diff-code-insert-edit-background-color);color:var(--diff-text-color);color:var(--diff-code-insert-edit-text-color)}.diff-code-delete{background-color:#fdeff0;background-color:var(--diff-code-delete-background-color);color:var(--diff-text-color);color:var(--diff-code-delete-text-color)}.diff-code-delete .diff-code-edit{background-color:#f39ea2;background-color:var(--diff-code-delete-edit-background-color);color:var(--diff-text-color);color:var(--diff-code-delete-edit-text-color)}.diff-code-selected{background-color:#fffce0;background-color:var(--diff-code-selected-background-color);color:var(--diff-text-color);color:var(--diff-code-selected-text-color)}.diff-widget-content{vertical-align:top}.diff-gutter-col{width:7ch}.diff-gutter-omit{height:0}.diff-gutter-omit:before{background-color:#cb2a1d;background-color:var(--diff-omit-gutter-line-color);content:" ";display:block;height:100%;margin-left:4.6ch;overflow:hidden;white-space:pre;width:2px}.diff-decoration{line-height:1.5;-webkit-user-select:none;-moz-user-select:none;user-select:none}.diff-decoration-content{font-family:Consolas,Courier,monospace;font-family:var(--diff-font-family);padding:0}:root{--base: #ffffff;--canvas: #faf8f4;--panel: #f3f0ea;--surface: #faf7f2;--surface-bright: #fdfbfb;--highlight: #fdf3f1;--text: #1d1b1a;--subtext: #737373;--muted: #a1a1a1;--primary: #9a2036;--primary-subtle: #f7e9ec;--secondary: #4a90e2;--error: #e2a100;--border: #d4d4d4;--border-variant: #e5e5e5;--accent-orange: #da642c;--accent-red: #d94654;--accent-teal: #209a84;--accent-blue: #3a8dff;--accent-pink: #ff2b90;--accent-amber: #da9100;--accent-green: #5eb64c;--accent-purple: #9c5cff;--accent-green-subtle: #e7f4e5;--accent-amber-subtle: #fff3e1;--accent-teal-subtle: #e1f3f0;--accent-red-subtle: #fbe9ea;--accent-blue-subtle: #e5f0ff;--accent-purple-subtle: #f1e8ff;--dots-muted: #e3ded5;--dots-strong: #bdb6a8;--mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;--sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;--readable-col: 760px;--bg: var(--base);--bg-canvas: var(--canvas);--surface-2: var(--panel);--border-strong: var(--border);--accent: var(--primary);--teal: var(--accent-teal);--green: var(--accent-green);--red: var(--accent-red);--amber: var(--accent-amber);--purple: var(--accent-purple);color-scheme:light}@media(prefers-color-scheme:dark){:root{--base: #0e0c0c;--canvas: #141110;--panel: #221f1e;--surface: #1d1b1a;--surface-bright: #130f0f;--highlight: #393433;--text: #e6e1e0;--subtext: #a68e8b;--muted: #737373;--primary: #ffb3ad;--primary-subtle: #33191b;--secondary: #3e7fcf;--error: #ffb951;--border: #525252;--border-variant: #404040;--accent-amber: #e67e22;--accent-green-subtle: #1c2b18;--accent-amber-subtle: #33260f;--accent-teal-subtle: #12332d;--accent-red-subtle: #331418;--accent-blue-subtle: #10233a;--accent-purple-subtle: #251933;--dots-muted: #2a2523;--dots-strong: #555555;color-scheme:dark}}*{box-sizing:border-box}html,body,#root{height:100%;margin:0}body{background:var(--base);color:var(--text);font-family:var(--sans);font-size:14px;line-height:1.45;overflow:hidden}::selection{background:var(--highlight)}button{font:inherit;color:inherit;background:none;border:none;cursor:pointer;padding:0}input,textarea,select{font:inherit;color:var(--text);background:var(--base);border:1px solid var(--border);border-radius:0;padding:6px 10px;outline:none}input:focus,textarea:focus,select:focus{border-color:var(--text)}input::placeholder,textarea::placeholder{color:var(--muted);opacity:1}::-webkit-scrollbar{width:10px;height:10px}::-webkit-scrollbar-thumb{background:var(--border);border-radius:5px;border:2px solid transparent;background-clip:padding-box}::-webkit-scrollbar-track{background:transparent}@keyframes pulse{50%{opacity:.35}}@keyframes spin{to{transform:rotate(360deg)}}.app{display:flex;flex-direction:column;height:100%}.app-body{display:flex;flex:1;min-height:0;padding:0 14px}.home{flex:1;min-height:0;overflow-y:auto;scrollbar-gutter:stable both-edges;background:var(--canvas)}.home-inner{max-width:620px;margin:0 auto;padding:48px 24px 64px}.home-brand{font-weight:800;font-size:28px;letter-spacing:-.02em;margin-bottom:36px}.home-brand span{color:var(--primary)}.home-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:18px}.home-head h2{margin:0;font-size:18px;letter-spacing:-.01em}.home-list{display:flex;flex-direction:column;gap:10px}.project-card{position:relative;display:flex;flex-direction:column;gap:4px;text-align:left;padding:14px 16px;background:var(--base);border:1px solid var(--border);border-radius:10px;cursor:pointer;transition:border-color .12s ease,box-shadow .12s ease}.project-card:hover{border-color:var(--text);box-shadow:0 2px 10px #0000000f}.project-delete{position:absolute;top:10px;right:10px;display:none;padding:5px;border-radius:6px;color:var(--muted);line-height:0}.project-card:hover .project-delete{display:block}.project-delete:hover{color:var(--danger, #d33);background:var(--overlay, rgba(0, 0, 0, .05))}.project-card .name{font-weight:600;font-size:14px}.project-card .repo{color:var(--subtext)}.project-card .paper,.project-card .time{font-size:11px;color:var(--muted)}.rail-brand{display:flex;align-items:center;gap:4px;height:48px;padding:0 8px 0 12px;border-bottom:1px solid var(--border);flex-shrink:0}.rail-brand .brand{display:flex;align-items:center;gap:8px;flex:1;min-width:0;font-weight:600;font-size:13px;color:var(--text);padding:4px 6px 4px 0;border-radius:6px}.rail-brand .brand:hover{color:var(--subtext)}.rail-brand .brand svg{flex-shrink:0}.rail-brand .brand .brand-project{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.icon-btn{position:relative;display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;color:var(--subtext)}.icon-btn:hover{color:var(--text);background:var(--surface)}.btn{display:inline-flex;align-items:center;justify-content:center;gap:6px;padding:6px 14px;font-size:12px;font-weight:600;border:1px solid var(--border);border-radius:8px;background:var(--base);color:var(--text);white-space:nowrap;transition:background .12s ease,border-color .12s ease,color .12s ease}.btn:hover:not(:disabled){background:var(--surface)}.btn:active:not(:disabled){background:var(--highlight)}.btn:disabled{opacity:.45;cursor:default}.btn.primary{background:var(--primary);border-color:var(--primary);color:var(--base)}.btn.primary:hover:not(:disabled){background:color-mix(in oklab,var(--primary) 88%,var(--text));border-color:color-mix(in oklab,var(--primary) 88%,var(--text))}.btn.primary:active:not(:disabled){background:color-mix(in oklab,var(--primary) 80%,var(--text));border-color:color-mix(in oklab,var(--primary) 80%,var(--text))}.btn.danger{color:var(--accent-red)}.btn.danger:hover:not(:disabled){background:color-mix(in oklab,var(--accent-red) 8%,transparent)}.btn.danger:active:not(:disabled){background:color-mix(in oklab,var(--accent-red) 14%,transparent)}.btn.ghost{border-color:transparent;color:var(--subtext)}.btn.ghost:hover:not(:disabled){color:var(--text);background:var(--surface)}.btn.sm{padding:3px 9px;font-size:11px;border-radius:6px}.status-badge{display:inline-flex;align-items:center;gap:6px;font-size:12px;font-weight:500;color:var(--subtext);text-transform:capitalize;white-space:nowrap}.status-badge .dot{width:7px;height:7px;border-radius:50%;background:currentColor;flex-shrink:0}.status-badge.live .dot{animation:pulse 1.2s ease-in-out infinite}.st-done .dot{color:var(--accent-green)}.st-failed .dot{color:var(--accent-red)}.st-running .dot{color:var(--accent-teal)}.st-starting .dot{color:var(--accent-amber)}.st-cancelled .dot{color:var(--accent-orange)}.st-editing .dot{color:var(--accent-purple)}.st-idle .dot{color:var(--muted)}.floating-panel{border:1px solid var(--border);border-radius:10px;box-shadow:0 6px 24px color-mix(in oklab,var(--text) 5%,transparent),0 1px 4px color-mix(in oklab,var(--text) 4%,transparent);overflow:hidden}.session-rail{width:232px;flex-shrink:0;display:flex;flex-direction:column;margin:10px 14px 10px 0;background:var(--base);min-height:0}.rail-nav{display:flex;flex-direction:column;gap:2px;padding:8px;flex-shrink:0}.rail-nav-item{display:flex;align-items:center;gap:10px;padding:7px 10px;font-size:12.5px;color:var(--subtext);border-radius:8px;text-align:left}.rail-nav-item:hover{background:var(--surface);color:var(--text)}.rail-nav-item.active{background:var(--panel);color:var(--text);font-weight:600}.rail-section-label{padding:10px 10px 6px;font-size:12px;font-weight:500;color:var(--muted)}.rail-section-head{display:flex;align-items:center;justify-content:space-between}.rail-filter{position:relative;display:inline-flex;margin-right:2px}.rail-filter-btn{width:24px;height:24px;border-radius:6px}.rail-empty{padding:6px 10px;font-size:12px;color:var(--muted)}.session-rail .rail-body{flex:1;min-height:0;overflow-y:auto;padding:4px 8px}.chat-pane{flex:1;min-width:0;display:flex;flex-direction:column;background:var(--base);min-height:0}.right-pane{position:relative;flex-shrink:0;min-width:0;display:flex;flex-direction:column;margin:10px 0 10px 14px;background:var(--canvas)}.right-pane.max{position:fixed;top:10px;right:10px;bottom:10px;left:10px;margin:0;z-index:60;box-shadow:0 12px 40px color-mix(in oklab,var(--text) 22%,transparent)}.panel-resizer{position:absolute;left:0;top:0;bottom:0;width:6px;cursor:col-resize;z-index:30}.panel-resizer:hover,.panel-resizer:active{background:color-mix(in oklab,var(--text) 12%,transparent)}.panel-controls{display:inline-flex;align-items:center;gap:2px;flex-shrink:0}.tabs{display:flex;align-items:center;gap:4px;padding:0 10px;height:40px;border-bottom:1px solid var(--border);background:var(--base);flex-shrink:0}.tab-strip{display:flex;align-items:center;gap:4px;flex:1;min-width:0;overflow-x:auto;scrollbar-width:none}.tab-strip::-webkit-scrollbar{display:none}.tab.closable{max-width:176px;padding-right:4px}.tab .tab-label{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.tab .tab-close{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;border-radius:4px;color:var(--muted);flex-shrink:0}.tab .tab-close:hover{background:color-mix(in oklab,var(--text) 15%,transparent);color:var(--text)}.tab{display:inline-flex;align-items:center;gap:6px;padding:5px 12px;font-size:12px;font-weight:600;color:var(--subtext);border-radius:6px;white-space:nowrap;flex-shrink:0}.tab:hover{color:var(--text)}.tab.active{color:var(--text);background:var(--surface)}.tab .tab-count{font-family:var(--mono);font-weight:400;color:var(--muted)}.tab-body{flex:1;min-height:0;position:relative;display:flex;flex-direction:column}.pane-toolbar{display:flex;align-items:center;justify-content:flex-end;padding:10px 12px 0;flex-shrink:0}.pane-content{flex:1;min-height:0;position:relative}.seg{display:inline-flex;align-items:center;gap:2px;padding:3px;border-radius:9px;background:color-mix(in oklab,var(--text) 10%,transparent)}.seg button{padding:3px 12px;font-size:12px;font-weight:600;color:var(--subtext);border-radius:6px}.seg button:hover{color:var(--text)}.seg button.active{background:var(--base);color:var(--text);box-shadow:0 1px 3px color-mix(in oklab,var(--text) 25%,transparent)}.chat-header{display:flex;align-items:center;gap:8px;padding:0 16px;background:var(--base);flex-shrink:0;height:48px;position:relative;z-index:4;width:100%;max-width:var(--readable-col);margin:0 auto}.chat-header.rail-hidden{max-width:none;padding:0 2px}.chat-header.rail-hidden>.icon-btn:first-child{margin-right:12px}.chat-header:after{content:"";position:absolute;top:100%;left:0;right:0;height:24px;background:linear-gradient(to bottom,var(--base),transparent);pointer-events:none}.chat-header .title{font-size:13px;font-weight:600;color:var(--text);flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.session-row{position:relative;display:flex;align-items:center;gap:8px;width:100%;text-align:left;padding:7px 10px;border-radius:8px;font-size:12.5px;color:var(--subtext);cursor:pointer;-webkit-user-select:none;user-select:none}.session-row:hover{background:var(--surface);color:var(--text)}.session-row.active{color:var(--text);background:var(--surface);font-weight:500}.session-row .session-dot{width:14px;display:inline-flex;align-items:center;justify-content:center;flex-shrink:0}.session-row .session-title{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.session-row .session-time{font-size:10px;font-family:var(--mono);color:var(--muted);flex-shrink:0}.session-row .session-menu-btn{display:none;align-items:center;justify-content:center;width:18px;height:18px;margin:-2px 0;border-radius:5px;color:var(--muted);flex-shrink:0}.session-row .session-menu-btn:hover{color:var(--text);background:var(--panel)}.session-row:hover .session-menu-btn,.session-row:focus-within .session-menu-btn,.session-row.menu-open .session-menu-btn{display:inline-flex}.session-row:hover .session-time,.session-row:focus-within .session-time,.session-row.menu-open .session-time{display:none}.session-row .busy-dot{width:7px;height:7px;border-radius:50%;background:var(--primary);animation:pulse 1.2s infinite;flex-shrink:0}.session-row .session-title-input{flex:1;min-width:0;padding:1px 5px;margin:-2px 0;font:inherit;color:var(--text);background:var(--base);border:1px solid var(--primary);border-radius:5px;outline:none}.session-row.editing{background:var(--surface);cursor:default}.session-row.editing .session-menu-btn,.session-row.editing .session-time{display:none}.chat-thread{flex:1;min-height:0;overflow-y:auto;scrollbar-gutter:stable both-edges}.chat-thread-inner{max-width:var(--readable-col);margin:0 auto;padding:16px 16px 32px;display:flex;flex-direction:column;gap:16px}.chat-empty{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;color:var(--subtext);padding:20px;text-align:center}.chat-empty h2{margin:0;font-size:34px;font-weight:700;letter-spacing:-.02em;color:var(--text)}.chat-empty h2 span{color:var(--primary)}.chat-empty .chat-empty-hint{font-size:12px;color:var(--muted);max-width:340px;text-align:center}.chat-empty p{margin:0;font-size:13px;max-width:320px}.chat-empty .chat-suggest{font-family:var(--mono);font-size:12px;color:var(--text);background:var(--surface);border:1px solid var(--border);border-radius:999px;padding:6px 14px;cursor:pointer;transition:border-color .12s ease}.chat-empty .chat-suggest:hover{border-color:var(--text)}.msg-user{align-self:flex-end;max-width:88%;background:var(--surface);border-radius:16px;padding:10px 15px;font-size:13px;white-space:pre-wrap;word-break:break-word}.msg-images{display:flex;flex-wrap:wrap;gap:6px;margin-top:8px}.msg-images img{max-width:220px;max-height:160px;border:1px solid var(--border-variant);border-radius:4px;display:block}.msg-assistant{font-size:14px;line-height:1.62;color:var(--text);min-width:0}.reasoning{color:var(--muted);font-size:12px;margin:2px 0}.reasoning summary{cursor:pointer;list-style:none;-webkit-user-select:none;user-select:none;font-weight:600}.reasoning[open]{white-space:pre-wrap}.tool-group{margin:2px 0}.tool-group-summary{display:flex;align-items:center;gap:8px;width:100%;padding:3px 2px;cursor:pointer;color:var(--muted);font-size:12.5px;text-align:left;border-radius:6px}.tool-group-summary:hover{color:var(--subtext);background:var(--surface)}.tool-group.has-error .tool-group-summary{color:var(--accent-red)}.tool-chevron{flex-shrink:0;color:var(--muted);transition:transform .12s ease}.tool-chevron.open{transform:rotate(90deg)}.tool-group-rows{display:flex;flex-direction:column;gap:1px;margin:2px 0 4px 7px;padding-left:10px;border-left:1px solid var(--border-variant)}.tool-row{display:flex;flex-direction:column}.tool-row summary{display:flex;align-items:center;gap:8px;padding:3px 4px;cursor:pointer;list-style:none;-webkit-user-select:none;user-select:none;min-width:0;border-radius:5px}.tool-row summary:hover{background:var(--surface)}.tool-row summary::-webkit-details-marker{display:none}.tool-line{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12.5px;color:var(--subtext)}.tool-open{flex-shrink:0;font-size:11px;color:var(--primary)}.tool-open:hover{text-decoration:underline}.tool-status{width:6px;height:6px;border-radius:50%;flex-shrink:0;background:var(--muted)}.tool-status.running{background:var(--accent-amber);animation:pulse 1.2s ease-in-out infinite}.tool-status.error{background:var(--accent-red)}.tool-detail{margin:2px 0 4px 14px}.tool-cmd-full{padding:6px 10px;font-family:var(--mono);font-size:11px;color:var(--text);background:var(--surface);border-radius:5px;white-space:pre-wrap;word-break:break-word}.tool-output{margin-top:3px;padding:6px 10px;font-family:var(--mono);font-size:11px;color:var(--subtext);white-space:pre-wrap;word-break:break-word;max-height:260px;overflow-y:auto;background:var(--base);border:1px solid var(--border-variant);border-radius:5px}.working{display:flex;align-items:center;gap:8px;color:var(--subtext);font-size:12.5px;padding:2px 0 8px}.spinner{width:13px;height:13px;border:2px solid var(--border);border-top-color:var(--primary);border-radius:50%;animation:spin .8s linear infinite;flex-shrink:0}.composer{padding:0 12px 12px;flex-shrink:0;position:relative;z-index:4;background:var(--base);width:100%;max-width:var(--readable-col);margin:0 auto}.composer:before{content:"";position:absolute;bottom:100%;left:0;right:0;height:24px;background:linear-gradient(to top,var(--base),transparent);pointer-events:none}.composer-box{position:relative;display:flex;flex-direction:column;border:1px solid var(--border);border-radius:8px;background:var(--base)}.composer textarea{border:none;background:none;resize:none;padding:10px 12px 4px;font-size:13px;min-height:42px;max-height:180px}.composer-attachments{display:flex;flex-wrap:wrap;gap:6px;padding:8px 12px 0}.attachment-thumb{position:relative}.attachment-thumb img{width:52px;height:52px;object-fit:cover;border:1px solid var(--border);border-radius:6px;display:block}.attachment-thumb button{position:absolute;top:-5px;right:-5px;display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;padding:0;border:1px solid var(--border);border-radius:50%;background:var(--surface);color:var(--text);cursor:pointer}.attachment-thumb button:hover{background:var(--text);color:var(--base)}.composer-actions{display:flex;justify-content:flex-end;align-items:center;gap:8px;padding:6px 8px 8px}.send-btn{display:inline-flex;align-items:center;justify-content:center;width:32px;height:32px;border-radius:8px;background:var(--primary);color:var(--base);transition:background .1s ease,opacity .1s ease}.send-btn:hover:not(:disabled){background:color-mix(in oklab,var(--primary) 88%,var(--text))}.send-btn:disabled{opacity:.4;cursor:default}.send-btn.stop{background:var(--surface);color:var(--text)}.send-btn.stop:hover:not(:disabled){background:color-mix(in oklab,var(--surface) 88%,var(--text))}.md{min-width:0;word-break:break-word;color:var(--text);line-height:1.62}.md>*:first-child{margin-top:0}.md>*:last-child{margin-bottom:0}.md p{margin:10px 0}.md strong{color:var(--text);font-weight:600}.md pre{background:var(--surface);border:1px solid color-mix(in oklab,var(--border) 50%,transparent);border-radius:8px;padding:8px 12px;overflow-x:auto;font-size:12px;color:var(--text)}.md code{font-family:var(--mono);font-size:.9em;font-weight:500;color:var(--primary);background:var(--panel);border:1px solid var(--border-variant);padding:1px 5px}.md .file-chip{display:inline-flex;align-items:center;gap:4px;max-width:100%;margin:0 1px;padding:0 6px;vertical-align:baseline;font-family:var(--mono);font-size:.9em;font-weight:500;color:var(--text);background:var(--panel);border:1px solid var(--border-variant);cursor:pointer}.md .file-chip:hover:not(:disabled){background:var(--surface);color:var(--primary)}.md .file-chip svg{flex:none;opacity:.6}.md .file-chip-label{max-width:260px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.md pre code{background:none;border:none;color:inherit;padding:0;font-weight:400}.md-code{position:relative;margin:10px 0}.md-code pre{margin:0}.md-code-copy{position:absolute;top:6px;right:6px;display:inline-flex;align-items:center;justify-content:center;width:26px;height:26px;color:var(--muted);background:var(--base);border:1px solid var(--border-variant);border-radius:6px;opacity:0;transition:opacity .12s ease,color .12s ease}.md-code:hover .md-code-copy{opacity:1}.md-code-copy:hover{color:var(--text);border-color:var(--muted)}.md h1,.md h2,.md h3,.md h4{color:var(--text);font-size:1.05em;font-weight:600;margin:12px 0 6px}.md ul,.md ol{margin:6px 0;padding-left:22px}.md li::marker{color:var(--primary)}.md a{color:var(--primary)}.md table{border-collapse:collapse;width:100%;font-size:13px;margin:10px 0;border:1px solid var(--border);border-radius:8px;overflow:hidden}.md th,.md td{border-bottom:1px solid var(--border-variant);padding:8px 14px;text-align:left;color:var(--text)}.md tr:last-child td{border-bottom:none}.md thead th{background:var(--surface);font-weight:500;color:var(--subtext);border-bottom:1px solid var(--border)}.md tbody tr:hover td{background:var(--surface-bright)}.md blockquote{margin:6px 0;padding:2px 0 2px 10px;border-left:3px solid var(--border);color:var(--subtext)}.exp-node{width:240px;border:1px solid var(--border);background:var(--base);padding:10px 12px;cursor:pointer;box-shadow:0 1px 2px #0000000a;font-size:12.5px;transition:box-shadow .12s ease}.exp-node:hover{box-shadow:0 2px 8px #00000014}.exp-node.selected{border-color:var(--text);box-shadow:0 0 0 1px var(--text)}.exp-node.live{border-color:var(--accent-teal);box-shadow:0 2px 12px #209a8433}.exp-node .node-eyebrow{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:6px;font-family:var(--mono);font-size:9.5px;font-weight:700;letter-spacing:.08em;text-transform:uppercase;color:var(--muted)}.exp-node .node-head{display:flex;align-items:center;gap:7px;min-width:0}.exp-node .node-status{width:8px;height:8px;border-radius:50%;flex-shrink:0}.exp-node .node-slug{font-family:var(--mono);font-size:12px;font-weight:700;color:var(--text);flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.exp-node .node-title{margin-top:4px;color:var(--subtext);font-size:11.5px;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.exp-node .node-meta{margin-top:8px;display:flex;align-items:center;gap:8px;font-size:10px;color:var(--muted);font-family:var(--mono);text-transform:uppercase;letter-spacing:.05em}.exp-node .baseline-chip{font-size:9px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;color:var(--muted);border:1px solid var(--border);padding:0 4px;flex-shrink:0}.exp-node .node-actions{margin-top:8px;padding-top:6px;border-top:1px solid var(--border-variant);display:flex;align-items:center;gap:4px}.exp-node .node-action{display:inline-flex;align-items:center;gap:5px;padding:3px 8px;font-size:10.5px;font-weight:700;color:var(--subtext);border-radius:6px;text-decoration:none}.exp-node .node-action:hover{color:var(--text);background:var(--surface)}.run-squares{display:flex;align-items:center;gap:3px}.run-sq{width:9px;height:9px;flex-shrink:0}.run-sq.pass{background:var(--accent-green)}.run-sq.fail{border:1.5px solid color-mix(in oklab,var(--accent-red) 55%,transparent)}.run-sq.live{background:var(--accent-teal);animation:pulse 1.2s ease-in-out infinite}.run-sq.other{border:1.5px solid var(--border)}.react-flow__handle{opacity:0;pointer-events:none}.react-flow__attribution{display:none!important}.runs-table-wrap{position:absolute;top:0;right:0;bottom:0;left:0;overflow:auto;padding:12px}.runs-table{width:100%;border-collapse:separate;border-spacing:0;font-size:12.5px;background:var(--base);border:1px solid var(--border);border-radius:10px;overflow:hidden}.runs-table th{text-align:left;color:var(--muted);font-size:10.5px;text-transform:uppercase;letter-spacing:.06em;font-weight:600;padding:8px 12px;border-bottom:1px solid var(--border);position:sticky;top:0;background:var(--base);z-index:1}.runs-table td{padding:8px 12px;border-bottom:1px solid color-mix(in oklab,var(--text) 6%,transparent);white-space:nowrap}.runs-table tr:last-child td{border-bottom:none}.runs-table tr.clickable{cursor:pointer}.runs-table tr.clickable:hover td{background:var(--canvas)}.mono{font-family:var(--mono);font-size:11.5px}.instances-section-title{display:flex;align-items:center;gap:8px;margin:22px 0 10px;font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:.05em;color:var(--muted)}.instances-section-title .count-badge{display:inline-flex;align-items:center;justify-content:center;min-width:18px;height:18px;padding:0 5px;border-radius:9px;background:var(--canvas);border:1px solid var(--border);font-size:11px;font-weight:500;letter-spacing:0;color:var(--text)}.instances-table-wrap{overflow-x:auto}.instances-empty{margin:0;padding:14px 16px;border:1px solid var(--border);border-radius:10px;background:var(--base);color:var(--subtext);font-size:12.5px}.backend-cell{display:inline-flex;align-items:center;gap:2px}.backend-cell .icon-btn{width:22px;height:22px}.backend-badge{display:inline-flex;align-items:center;gap:7px}.backend-badge svg{flex:none;display:block}.backend-badge .backend-name{font-weight:500}.backend-badge .backend-detail,.backend-badge.muted{color:var(--muted)}.status-chip{display:inline-flex;align-items:center;gap:6px;font-size:10px;font-weight:600;letter-spacing:.08em;text-transform:uppercase;font-family:var(--mono)}.status-chip .dot{width:8px;height:8px;border-radius:50%}.drawer{position:absolute;top:0;right:0;bottom:0;left:0;background:var(--base);display:flex;flex-direction:column;z-index:20}.drawer-body{flex:1;min-height:0;overflow-y:auto;padding:0 16px 24px;display:flex;flex-direction:column;gap:22px}.drawer-body>:first-child{margin-top:18px}.drawer-section h3{margin:0 0 10px;font-size:10px;text-transform:uppercase;letter-spacing:.08em;font-weight:700;color:var(--muted)}.kv{display:grid;grid-template-columns:auto 1fr;gap:3px 14px;font-size:12.5px}.kv .k{color:var(--muted)}.kv .v{font-family:var(--mono);font-size:11.5px;word-break:break-all}.term-view{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;flex-direction:column;background:var(--base);z-index:20}.term-bar{display:flex;align-items:center;gap:8px;height:40px;padding:0 10px;border-bottom:1px solid var(--border);flex-shrink:0}.term-title{min-width:0;font-size:13px;font-weight:600;color:var(--text);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.term-bar .error{font-size:11.5px;color:var(--accent-red)}.term-bar .btn{display:inline-flex;align-items:center;gap:5px}.term-fill{flex:1;min-height:0;background:#1a1a1a;padding:4px 0 4px 6px}.term-empty{height:100%;display:flex;align-items:center;justify-content:center;padding:24px;text-align:center;font-size:12.5px;color:var(--muted)}.run-history{position:relative;flex-shrink:0}.run-picker{display:inline-flex;align-items:center;gap:8px;padding:4px 6px 4px 10px;border:1px solid var(--border);border-radius:8px;background:var(--base);color:var(--text)}.run-picker:hover{background:var(--surface)}.run-picker .run-label{font-size:12px;font-weight:600}.run-picker-chev{color:var(--muted);flex-shrink:0}.history-menu{position:absolute;top:calc(100% + 6px);right:0;min-width:230px;max-height:320px;overflow-y:auto;background:var(--base);border:1px solid var(--border);border-radius:10px;box-shadow:0 12px 32px #0000002e;padding:5px;z-index:50}.history-item{display:flex;align-items:center;gap:8px;width:100%;text-align:left;padding:6px 8px;font-size:12px;border-radius:6px}.history-item:hover,.history-item.active{background:var(--surface)}.history-item .run-label{font-weight:600}.history-item .when{margin-left:auto;font-size:11px;color:var(--muted)}.changes-branch{display:flex;margin-bottom:10px}.commit-picker{display:flex;align-items:center;gap:8px}.commit-picker select{flex:1;min-width:0;font-family:var(--mono);font-size:11.5px}.uncommitted-dot{display:inline-block;width:8px;height:8px;border-radius:50%;background:var(--accent-purple);flex-shrink:0}.changes-note{font-size:11.5px;color:var(--muted)}.empty-state{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px;padding:24px;text-align:center;color:var(--subtext)}.empty-state p{max-width:46ch;margin:0;font-size:13px;line-height:1.5;text-wrap:balance}.empty-state-cta{gap:6px}.empty-state p.empty-state-title{font-size:18px;font-weight:400;color:var(--text)}.empty-state p.empty-state-hint{font-size:15px;color:var(--subtext)}.onboarding .home-inner{max-width:560px;padding-top:96px}.onb-eyebrow{font-family:var(--mono);font-size:10px;font-weight:600;text-transform:uppercase;letter-spacing:.08em;color:var(--muted);margin-bottom:14px}.onb-eyebrow span{color:var(--primary)}.onb-title{margin:0 0 6px;font-size:22px;letter-spacing:-.01em}.onb-sub{color:var(--subtext);font-size:13.5px;line-height:1.55;margin:0 0 22px;max-width:480px}.onb-cards{display:flex;flex-direction:column;gap:10px}.onb-card{display:flex;flex-direction:column;gap:5px;background:var(--base);border:1px solid var(--border);border-radius:10px;padding:18px 20px}.onb-card-head{display:flex;align-items:center;justify-content:space-between;gap:12px}.onb-card-name{font-weight:600;font-size:14px}.onb-card-detail{font-size:12px}.onb-card-meta{font-size:12px;color:var(--subtext)}.onb-card-meta code{font-family:var(--mono);font-size:11px}.onb-card-row{display:grid;grid-template-columns:56px 1fr auto;align-items:baseline;gap:12px;padding:3px 0}.onb-loading{display:flex;align-items:center;gap:8px;color:var(--subtext);font-size:13px;padding:8px 0}.onb-gh-options{display:flex;flex-direction:column;gap:16px;margin-top:12px;padding-top:14px;border-top:1px solid var(--border-variant)}.onb-gh-option{display:flex;flex-direction:column;gap:8px}.onb-gh-option-label{font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:.05em;color:var(--subtext)}.onb-gh-option-body{display:flex;align-items:center;flex-wrap:wrap;gap:10px}.onb-gh-cmd{font-family:var(--mono);font-size:12px;background:var(--panel);border:1px solid var(--border-variant);border-radius:5px;padding:3px 8px}.onb-gh-hint{font-size:12px;color:var(--subtext)}.onb-gh-hint code{font-family:var(--mono);font-size:11px}.onb-gh-or{display:flex;align-items:center;gap:10px;color:var(--muted);font-size:11px;text-transform:uppercase;letter-spacing:.05em}.onb-gh-or:before,.onb-gh-or:after{content:"";flex:1;height:1px;background:var(--border-variant)}.onb-gh-option .onb-token-form{flex:1;min-width:0;margin-top:0}.onb-token-form{display:flex;align-items:center;flex-wrap:wrap;gap:8px;margin-top:8px}.onb-token-form input{flex:1;min-width:220px;font-family:var(--mono);font-size:12px}.onb-token-form a{font-size:12px;color:var(--subtext);white-space:nowrap}.onb-token-form .error{flex-basis:100%;color:var(--accent-red);font-size:12.5px;white-space:pre-wrap}.onb-actions{display:flex;align-items:center;gap:10px;margin-top:22px}.form .form-seg{align-self:flex-start;margin-bottom:2px}.form .form-seg button{padding:5px 12px}.form .repo-hint{font-family:var(--mono);font-weight:400;text-transform:none;letter-spacing:normal;font-size:11px;color:var(--muted)}.form .repo-hint.ok{color:var(--accent-teal)}.form .paper-results{display:flex;flex-direction:column;border:1px solid var(--border);border-radius:8px;max-height:240px;overflow-y:auto}.form .paper-results button{display:flex;flex-direction:column;align-items:flex-start;gap:2px;padding:8px 10px;background:none;border:none;border-bottom:1px solid var(--border-variant);text-align:left;font:inherit;color:var(--text);cursor:pointer}.form .paper-results button:last-child{border-bottom:none}.form .paper-results button:hover{background:var(--surface)}.form .paper-results .title{font-size:12.5px;font-weight:500}.form .paper-results .id,.form .paper-pick .id{font-family:var(--mono);font-size:11px;color:var(--muted)}.form .paper-pick{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:10px 12px;border:1px solid var(--border);border-radius:8px;background:var(--surface)}.form .paper-pick .meta{min-width:0}.form .paper-pick .title{font-size:13px;font-weight:600}.form{display:flex;flex-direction:column;gap:10px}.form label{display:flex;flex-direction:column;gap:4px;font-size:11px;color:var(--subtext);font-weight:700;text-transform:uppercase;letter-spacing:.05em}.form .row2{display:grid;grid-template-columns:1fr 1fr;gap:10px}.form .actions{display:flex;justify-content:flex-end;gap:10px;margin-top:6px}.form .error,.report-view .error,.settings-card>.error{color:var(--accent-red);font-size:12.5px;white-space:pre-wrap;text-transform:none}.modal-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;background:#1d1b1a66;display:flex;align-items:center;justify-content:center;z-index:100}.modal{width:480px;max-width:94vw;max-height:88vh;overflow-y:auto;background:var(--base);border:1px solid var(--border);border-radius:12px;box-shadow:0 24px 60px #00000038;padding:24px}.modal h2{margin:0 0 14px;font-size:16px}:is(.modal,.home) :is(input,select,textarea){border-radius:8px}.settings-section+.settings-section{margin-top:18px;padding-top:16px;border-top:1px solid var(--border)}.settings-section h3{margin:0 0 8px;font-size:10px;text-transform:uppercase;letter-spacing:.08em;font-weight:700;color:var(--muted)}.settings-loading{display:flex;align-items:center;gap:8px;color:var(--subtext);font-size:12.5px;padding:4px 0}.settings-note{margin:10px 0 0;font-size:12px;padding:8px 10px;border:2px solid var(--accent-amber);background:var(--accent-amber-subtle);color:var(--accent-amber);font-weight:600}.progress{margin:12px 0 4px}.progress-track{height:8px;border-radius:999px;background:var(--surface);border:1px solid var(--border);overflow:hidden}.progress-fill{height:100%;background:var(--accent);border-radius:999px;transition:width .2s ease}.progress-caption{display:flex;justify-content:space-between;margin-top:6px;font-size:12px;color:var(--muted)}.settings-form{margin-top:14px;padding-top:14px;border-top:1px solid var(--border)}.badge{display:inline-flex;align-items:center;font-size:10px;font-weight:700;font-family:var(--mono);text-transform:uppercase;letter-spacing:.06em;padding:1px 7px;border:1px solid var(--border);color:var(--muted)}.badge.ok{color:var(--accent-green);border-color:var(--accent-green);background:var(--accent-green-subtle)}.badge.err{color:var(--accent-red);border-color:var(--accent-red);background:var(--accent-red-subtle)}.badge.warn{color:var(--accent-amber);border-color:var(--accent-amber);background:var(--accent-amber-subtle)}.files-tab{height:100%;overflow-y:auto;padding:20px 24px 48px}.files-col{max-width:var(--readable-col);margin:0 auto;display:flex;flex-direction:column;gap:10px}.files-meta{display:flex;gap:8px;flex-wrap:wrap}.files-pill{display:inline-flex;align-items:center;gap:8px;min-width:0;border:1px solid var(--border);border-radius:8px;padding:7px 11px;background:var(--base);color:var(--text);text-decoration:none}.files-pill code{font-family:var(--mono);font-size:11.5px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.files-pill>svg{flex-shrink:0;color:var(--muted)}a.files-pill:hover{border-color:var(--muted)}.files-pill-dir{flex:1;min-width:240px}.files-pill-dir code{flex:1;color:var(--subtext)}.files-pill-dir .icon-btn{width:22px;height:22px;margin:-4px -6px -4px 0}button.files-pill-link{cursor:pointer;font:inherit;font-size:12px;color:var(--muted);white-space:nowrap}button.files-pill-link:hover{border-color:var(--muted);color:var(--text)}.files-hint{margin:0;font-size:11.5px;line-height:1.5;color:var(--muted)}.files-hint code{font-family:var(--mono);font-size:10.5px}.files-card{border:1px solid var(--border);border-radius:10px;background:var(--base);overflow:hidden;margin-top:4px}.files-card>*+*{border-top:1px solid var(--border-variant)}.ftree-row{display:flex;align-items:center;gap:8px;padding:8px 14px}.ftree-row.clickable{cursor:pointer}.ftree-row:hover{background:var(--surface)}.ftree-children{background:var(--canvas);border-top:1px solid var(--border-variant)}.ftree-children .ftree-row:hover{background:var(--panel)}.ftree-chevron{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;flex-shrink:0;color:var(--muted);transition:transform .12s ease}.ftree-chevron.open{transform:rotate(90deg)}.ftree-chevron.spacer{visibility:hidden}.ftree-dirname{flex:1;min-width:0;font-family:var(--mono);font-size:12px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ftree-title{flex:1;min-width:0;font-size:13px;font-weight:500;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ftree-tag{flex-shrink:0;font-size:11px;color:var(--primary)}.ftree-status{flex-shrink:0;font-family:var(--mono);font-size:10.5px;color:var(--subtext)}.ftree-link{flex:1;min-width:0;display:flex;align-items:center;gap:8px;color:var(--text);text-decoration:none}.ftree-link:hover .ftree-name{text-decoration:underline}.ftree-name{min-width:0;font-size:12.5px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ftree-thumb{width:22px;height:22px;object-fit:cover;border-radius:4px;border:1px solid var(--border-variant);flex-shrink:0}.ftree-del{width:22px;height:22px;visibility:hidden}.ftree-row:hover .ftree-del{visibility:visible}.ftree-del:hover{color:var(--accent-red)}.ftree-date,.ftree-size{flex-shrink:0}.ftree-size{font-family:var(--mono);font-size:10.5px;color:var(--muted);white-space:nowrap}.ftree-divider{padding:10px 14px 4px;font-size:10px;font-weight:700;text-transform:uppercase;letter-spacing:.08em;color:var(--muted)}.files-empty{font-size:12.5px;line-height:1.55;color:var(--subtext);border:1px solid var(--border);border-radius:10px;background:var(--base);padding:18px;margin:4px 0 0}.files-empty code{font-family:var(--mono);font-size:11.5px}.files-truncated{margin:0;padding:8px 14px;font-size:11px;color:var(--muted)}.report-date,.ftree-date{font-size:11px;color:var(--muted);white-space:nowrap}.report-view{height:100%;overflow-y:auto;padding:16px 24px 48px}.report-view-col{max-width:var(--readable-col);margin:0 auto}.report-view-head{display:flex;align-items:center;gap:10px;margin-bottom:16px;padding-bottom:10px;border-bottom:1px solid var(--border-variant)}.report-md table{display:block;width:max-content;max-width:100%;overflow-x:auto}.report-md .report-img{display:block;margin:12px 0}.report-md .report-img img{max-width:100%;height:auto;border:1px solid var(--border)}.report-md .report-img-caption{display:block;margin-top:4px;text-align:center;font-size:11.5px;color:var(--subtext)}.openresearch-diff{display:flex;flex-direction:column;gap:16px}.diff-file-card{border:1px solid var(--border);border-radius:8px;background:var(--base)}.diff-file-header{position:sticky;top:0;z-index:10;display:flex;align-items:center;justify-content:space-between;gap:12px;margin:-1px -1px 0;width:calc(100% + 2px);text-align:left;padding:8px 12px;cursor:pointer}.diff-file-header:before{content:"";position:absolute;top:0;right:0;bottom:0;left:0;z-index:-2;background:var(--base)}.diff-file-header:after{content:"";position:absolute;top:0;right:0;bottom:0;left:0;z-index:-1;background:var(--canvas);border:1px solid var(--border);border-radius:8px 8px 0 0}.diff-file-header .chev{color:var(--muted);font-size:10px;flex-shrink:0;width:12px}.diff-file-header .path{display:flex;align-items:center;gap:8px;min-width:0;flex:1}.diff-file-header .path code{min-width:0;flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-family:var(--mono);font-size:.7rem;font-weight:700;color:var(--text)}.diff-file-header .stats{display:flex;align-items:center;gap:8px;flex-shrink:0;font-family:var(--mono);font-size:.65rem;font-weight:700;font-variant-numeric:tabular-nums}.diff-stat-add{color:var(--accent-green)}.diff-stat-del{color:var(--accent-red)}.diff-empty{padding:8px 12px;color:var(--muted);font-size:12.5px}.truncated-notice{border:2px solid var(--accent-amber);background:var(--accent-amber-subtle);padding:12px 14px;font-size:12.5px}.truncated-notice h4{margin:0 0 4px;font-size:13px;color:var(--accent-amber)}.truncated-notice p{margin:0;color:var(--subtext)}.openresearch-diff .openresearch-diff-file{--openresearch-diff-selection-background-color: color-mix( in oklab, var(--surface) 76%, var(--primary) );--openresearch-diff-gutter-selection-background-color: color-mix( in oklab, var(--surface) 68%, var(--primary) );--openresearch-diff-insert-gutter-background-color: color-mix( in oklab, var(--base) 84%, var(--accent-green) );--openresearch-diff-delete-gutter-background-color: color-mix( in oklab, var(--base) 86%, var(--accent-red) );--openresearch-diff-insert-code-background-color: color-mix( in oklab, var(--base) 91%, var(--accent-green) );--openresearch-diff-delete-code-background-color: color-mix( in oklab, var(--base) 92%, var(--accent-red) );--openresearch-diff-insert-edit-background-color: color-mix( in oklab, var(--base) 72%, var(--accent-green) );--openresearch-diff-delete-edit-background-color: color-mix( in oklab, var(--base) 78%, var(--accent-red) );--openresearch-diff-divider-color: var(--border);--openresearch-diff-omit-gutter-line-color: color-mix(in oklab, var(--base) 86%, var(--text));--openresearch-diff-unified-gutter-text-color: color-mix(in oklab, var(--text) 45%, var(--base));--diff-background-color: var(--base);--diff-text-color: var(--text);--diff-font-family: var(--mono);--diff-selection-text-color: var(--primary);--diff-selection-background-color: var(--openresearch-diff-selection-background-color);--diff-gutter-selected-text-color: var(--diff-selection-text-color);--diff-gutter-selected-background-color: var( --openresearch-diff-gutter-selection-background-color );--diff-code-selected-text-color: var(--diff-selection-text-color);--diff-code-selected-background-color: var(--diff-selection-background-color);--diff-gutter-insert-text-color: var(--accent-green);--diff-gutter-insert-background-color: var(--openresearch-diff-insert-gutter-background-color);--diff-gutter-delete-text-color: var(--accent-red);--diff-gutter-delete-background-color: var(--openresearch-diff-delete-gutter-background-color);--diff-code-insert-text-color: var(--diff-text-color);--diff-code-insert-background-color: var(--openresearch-diff-insert-code-background-color);--diff-code-delete-text-color: var(--diff-text-color);--diff-code-delete-background-color: var(--openresearch-diff-delete-code-background-color);--diff-code-insert-edit-text-color: var(--diff-text-color);--diff-code-insert-edit-background-color: var(--openresearch-diff-insert-edit-background-color);--diff-code-delete-edit-text-color: var(--diff-text-color);--diff-code-delete-edit-background-color: var(--openresearch-diff-delete-edit-background-color);--diff-omit-gutter-line-color: var(--openresearch-diff-omit-gutter-line-color);width:100%;font-size:12px;line-height:1.5}.openresearch-diff .openresearch-diff-file.diff-unified{table-layout:auto}.openresearch-diff .openresearch-diff-file.diff-unified .diff-line>td:first-child{display:none}.openresearch-diff .openresearch-diff-file.diff-unified .diff-line>td:nth-child(2){width:0%;padding:0 .5rem 0 .625rem;white-space:nowrap;text-align:right;color:var(--openresearch-diff-unified-gutter-text-color);border-right:1px solid var(--openresearch-diff-divider-color);-webkit-user-select:none;user-select:none;cursor:default}.openresearch-diff .openresearch-diff-file .diff-line{line-height:1.5}.openresearch-diff .openresearch-diff-file .diff-hunk+.diff-hunk .diff-line:first-child>td{border-top:1px solid var(--openresearch-diff-divider-color)}:is(.md,.openresearch-diff,.file-view) .token.comment,:is(.md,.openresearch-diff,.file-view) .token.prolog,:is(.md,.openresearch-diff,.file-view) .token.cdata{font-style:italic;color:#a0a1a7}:is(.md,.openresearch-diff,.file-view) .token.punctuation{color:#383a42}:is(.md,.openresearch-diff,.file-view) .token.property,:is(.md,.openresearch-diff,.file-view) .token.tag,:is(.md,.openresearch-diff,.file-view) .token.deleted{color:#e45649}:is(.md,.openresearch-diff,.file-view) .token.constant,:is(.md,.openresearch-diff,.file-view) .token.symbol,:is(.md,.openresearch-diff,.file-view) .token.boolean,:is(.md,.openresearch-diff,.file-view) .token.number{color:#986801}:is(.md,.openresearch-diff,.file-view) .token.selector,:is(.md,.openresearch-diff,.file-view) .token.attr-name,:is(.md,.openresearch-diff,.file-view) .token.char,:is(.md,.openresearch-diff,.file-view) .token.inserted,:is(.md,.openresearch-diff,.file-view) .token.string{color:#50a14f}:is(.md,.openresearch-diff,.file-view) .token.builtin{color:#c18401}:is(.md,.openresearch-diff,.file-view) .token.operator,:is(.md,.openresearch-diff,.file-view) .token.entity,:is(.md,.openresearch-diff,.file-view) .token.url{color:#56b6c2}:is(.md,.openresearch-diff,.file-view) .token.atrule,:is(.md,.openresearch-diff,.file-view) .token.attr-value{color:#986801}:is(.md,.openresearch-diff,.file-view) .token.keyword{color:#a626a4}:is(.md,.openresearch-diff,.file-view) .token.function,:is(.md,.openresearch-diff,.file-view) .token.decorator,:is(.md,.openresearch-diff,.file-view) .token.def{color:#4078f2}:is(.md,.openresearch-diff,.file-view) .token.class-name,:is(.md,.openresearch-diff,.file-view) .token.namespace{color:#c18401}:is(.md,.openresearch-diff,.file-view) .token.regex{color:#50a14f}:is(.md,.openresearch-diff,.file-view) .token.important,:is(.md,.openresearch-diff,.file-view) .token.variable{color:#e45649}:is(.md,.openresearch-diff,.file-view) .token.parameter{color:#383a42}@media(prefers-color-scheme:dark){:is(.md,.openresearch-diff,.file-view) .token.comment,:is(.md,.openresearch-diff,.file-view) .token.prolog,:is(.md,.openresearch-diff,.file-view) .token.cdata{font-style:italic;color:#7f848e}:is(.md,.openresearch-diff,.file-view) .token.punctuation{color:#abb2bf}:is(.md,.openresearch-diff,.file-view) .token.property,:is(.md,.openresearch-diff,.file-view) .token.tag,:is(.md,.openresearch-diff,.file-view) .token.deleted{color:#e06c75}:is(.md,.openresearch-diff,.file-view) .token.constant,:is(.md,.openresearch-diff,.file-view) .token.symbol,:is(.md,.openresearch-diff,.file-view) .token.boolean,:is(.md,.openresearch-diff,.file-view) .token.number{color:#d19a66}:is(.md,.openresearch-diff,.file-view) .token.selector,:is(.md,.openresearch-diff,.file-view) .token.attr-name,:is(.md,.openresearch-diff,.file-view) .token.char,:is(.md,.openresearch-diff,.file-view) .token.inserted,:is(.md,.openresearch-diff,.file-view) .token.string{color:#98c379}:is(.md,.openresearch-diff,.file-view) .token.builtin{color:#e5c07b}:is(.md,.openresearch-diff,.file-view) .token.operator,:is(.md,.openresearch-diff,.file-view) .token.entity,:is(.md,.openresearch-diff,.file-view) .token.url{color:#56b6c2}:is(.md,.openresearch-diff,.file-view) .token.atrule,:is(.md,.openresearch-diff,.file-view) .token.attr-value{color:#d19a66}:is(.md,.openresearch-diff,.file-view) .token.keyword{color:#c678dd}:is(.md,.openresearch-diff,.file-view) .token.function,:is(.md,.openresearch-diff,.file-view) .token.decorator,:is(.md,.openresearch-diff,.file-view) .token.def{color:#61afef}:is(.md,.openresearch-diff,.file-view) .token.class-name,:is(.md,.openresearch-diff,.file-view) .token.namespace{color:#e5c07b}:is(.md,.openresearch-diff,.file-view) .token.regex{color:#98c379}:is(.md,.openresearch-diff,.file-view) .token.important,:is(.md,.openresearch-diff,.file-view) .token.variable{color:#e06c75}:is(.md,.openresearch-diff,.file-view) .token.parameter{color:#abb2bf}}.report-back{display:inline-flex;align-items:center;gap:6px;font-size:13px;font-weight:600;color:var(--subtext);padding:4px 8px;border-radius:6px}.report-back:hover{color:var(--text);background:var(--surface)}.settings-view-scroll{flex:1;min-height:0;overflow-y:auto;scrollbar-gutter:stable both-edges}.settings-view{max-width:var(--readable-col);margin:0 auto;padding:24px 32px 60px}.settings-view h1{margin:0 0 6px;font-size:22px}.settings-head-row{display:flex;align-items:center;justify-content:space-between;gap:10px}.settings-head-row h1{margin:0}.settings-view>.error{color:var(--accent-red);font-size:12.5px;white-space:pre-wrap;text-transform:none;margin:0 0 12px}.settings-sub{margin:0 0 18px;color:var(--subtext);font-size:13px}.settings-card{background:var(--base);border:1px solid var(--border);border-radius:10px;padding:16px 18px;margin-bottom:16px}.settings-card h3{margin:0 0 10px;font-size:10px;text-transform:uppercase;letter-spacing:.08em;font-weight:700;color:var(--muted)}.settings-card .settings-sub{margin-bottom:12px}.settings-card-head{display:flex;align-items:center;gap:10px;margin-bottom:12px}.settings-card .kv{gap:6px 18px}.settings-empty{color:var(--muted);font-size:12.5px;margin:4px 0 0}.muted{color:var(--muted)}.harness-tabs{display:flex;gap:4px;margin-bottom:14px;border-bottom:1px solid var(--border-variant)}.harness-tabs button{display:inline-flex;align-items:center;gap:7px;padding:7px 12px;font-size:13px;font-weight:600;color:var(--subtext);border-bottom:2px solid transparent;margin-bottom:-1px}.harness-tabs button:hover{color:var(--text)}.harness-tabs button.active{color:var(--text);border-bottom-color:var(--primary)}.harness-dot{width:7px;height:7px;border-radius:50%;background:var(--muted)}.harness-dot.ok{background:var(--accent-green)}.harness-dot.err{background:var(--accent-red)}.harness-dot.warn{background:var(--accent-amber)}.env-table{width:100%;border-collapse:collapse;font-size:12.5px;table-layout:fixed}.env-table td:first-child{width:32%;overflow-wrap:anywhere}.env-table .badge{margin-left:8px}.env-table input{width:100%;border:none;background:transparent;padding:0}.env-table input:focus{box-shadow:0 1px 0 0 var(--text)}.env-table td{height:36px;padding:0 10px 0 0;vertical-align:middle;border-bottom:1px solid var(--border-variant)}.env-table td:last-child{width:116px;white-space:nowrap;text-align:right}.env-table td[colspan]{white-space:normal;text-align:left}.env-table .icon-btn{margin-left:8px;vertical-align:middle}.env-table .icon-btn:hover{color:var(--accent-red)}.flavor-table{width:100%;border-collapse:collapse;font-size:12.5px}.flavor-table th{padding:5px 10px 5px 0;border-bottom:1px solid var(--border);text-align:left;font-weight:500;color:var(--muted)}.flavor-table td{padding:5px 10px 5px 0;border-bottom:1px solid var(--border-variant)}.ssh-table{table-layout:fixed}.ssh-table th:nth-child(1){width:20%}.ssh-table th:nth-child(2){width:26%}.ssh-table th:nth-child(4){width:108px}.ssh-table th:nth-child(5){width:52px}.ssh-table td{overflow-wrap:anywhere}.ssh-table td:last-child{padding-right:0;text-align:right}.ssh-tested-at{display:block;margin-top:2px;color:var(--muted);font-size:11px}@keyframes settings-spin{to{transform:rotate(360deg)}}.spin{animation:settings-spin .9s linear infinite}.model-picker,.option-picker{position:relative;display:inline-flex}.composer-pill{display:inline-flex;align-items:center;gap:5px;font-family:var(--mono);font-size:11.5px;color:var(--subtext);padding:5px 8px;border-radius:6px}.composer-pill:hover{background:var(--surface);color:var(--text)}.composer-bare{display:inline-flex;align-items:center;gap:3px;font-size:11.5px;color:var(--subtext);padding:5px 4px;border-radius:6px}.composer-bare:hover{color:var(--text)}.model-menu,.option-menu{position:absolute;bottom:calc(100% + 8px);left:0;max-height:380px;display:flex;flex-direction:column;background:var(--base);border:1px solid var(--border);border-radius:10px;box-shadow:0 12px 32px #0000002e;z-index:50;overflow:hidden}.model-menu{width:320px}.option-menu{min-width:190px;padding:6px}.model-menu.align-right,.option-menu.align-right{left:auto;right:0}.option-menu.drop-down{bottom:auto;top:calc(100% + 4px)}.option-menu.session-menu{left:auto;right:6px;top:calc(100% - 2px);min-width:140px}.model-item.danger,.model-item.danger:hover{color:var(--accent-red)}.option-default{color:var(--muted);font-weight:400}.option-sep{height:1px;margin:5px 4px;background:var(--border-variant)}.option-num{color:var(--muted);font-size:11px;font-variant-numeric:tabular-nums}.model-menu input{border:none;border-bottom:1px solid var(--border-variant);background:none;padding:9px 12px;font-size:12.5px;outline:none}.model-menu-list{overflow-y:auto;padding:6px}.model-group{font-size:10px;font-weight:700;text-transform:uppercase;letter-spacing:.07em;color:var(--muted);padding:8px 8px 4px}.model-item{display:flex;align-items:center;justify-content:space-between;gap:8px;width:100%;text-align:left;padding:6px 8px;font-size:12.5px;border-radius:6px}.model-item:hover{background:var(--surface)}.model-item .model-id{display:block;font-family:var(--mono);font-size:10px;color:var(--muted)}.model-more{padding:4px 8px 8px;font-size:11px;color:var(--muted)}.model-locked-note{display:flex;align-items:center;gap:6px;padding:7px 12px;font-size:11px;color:var(--muted);border-top:1px solid var(--border-variant)}.model-locked-note svg{flex-shrink:0}.skill-menu{position:absolute;bottom:calc(100% + 8px);left:0;min-width:340px;max-width:100%;padding:6px;background:var(--base);border:1px solid var(--border);border-radius:10px;box-shadow:0 12px 32px #0000002e;z-index:50;overflow:hidden}.skill-item{display:flex;flex-direction:column;gap:2px;width:100%;text-align:left;padding:7px 8px;border-radius:6px}.skill-item.active{background:var(--surface)}.skill-item .skill-name{font-family:var(--mono);font-size:12px}.skill-item .skill-hint{color:var(--muted)}.skill-item .skill-desc{font-size:11px;color:var(--subtext)}.file-view{display:flex;flex-direction:column;height:100%;min-height:0}.file-view-header{display:flex;align-items:center;gap:8px;padding:10px 14px;border-bottom:1px solid var(--border-variant);color:var(--subtext);flex-shrink:0}.file-view-path{font-family:var(--mono);font-size:12px;color:var(--text);flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.file-view-ref{font-family:var(--mono);font-size:11px;color:var(--muted);border:1px solid var(--border-variant);border-radius:6px;padding:1px 6px;max-width:180px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex-shrink:0}.file-view-body{flex:1;min-height:0;overflow:auto;background:var(--base)}.file-view-code{margin:0;padding:14px 16px;font-family:var(--mono);font-size:12px;line-height:1.55;-moz-tab-size:4;tab-size:4;min-width:max-content}.file-view-note{padding:10px 16px;font-size:12px;color:var(--muted)}.file-view-md{max-width:var(--readable-col);padding:18px 20px 32px}.file-view-md .md{font-size:13.5px}.file-view-md .md h1{font-size:1.5em;margin:18px 0 8px}.file-view-md .md h2{font-size:1.25em;margin:16px 0 8px}.file-view-md .md h3{font-size:1.1em}.icon-btn.active{color:var(--primary);background:var(--surface)}.prompt-card{margin:8px 0;padding:12px 14px;border:1px solid var(--border);border-left:3px solid var(--border);border-radius:6px;background:var(--surface);display:flex;flex-direction:column;gap:9px}.prompt-card.plan{border-left-color:var(--accent-blue)}.prompt-card.permission{border-left-color:var(--accent-amber)}.prompt-card.question{border-left-color:var(--accent-purple)}.prompt-card.resolved{opacity:.6}.prompt-head{font-size:11px;font-weight:600;letter-spacing:.03em;text-transform:uppercase;color:var(--muted)}.prompt-head code{font-family:var(--mono);font-size:11.5px;text-transform:none;color:var(--text)}.prompt-sub{font-family:var(--mono);font-size:12px;color:var(--subtext);word-break:break-word}.prompt-q{font-size:14px;font-weight:600;line-height:1.5;color:var(--text)}.prompt-plan{font-size:13.5px;line-height:1.6;color:var(--text);max-height:340px;overflow-y:auto}.prompt-options{display:flex;flex-direction:column;gap:6px}.prompt-option{display:flex;flex-direction:column;align-items:flex-start;gap:2px;width:100%;padding:8px 11px;text-align:left;border:1px solid var(--border);border-radius:5px;background:var(--base);color:var(--text);cursor:pointer;transition:border-color 80ms ease,background 80ms ease}.prompt-option:hover:not(:disabled){border-color:var(--border-strong);background:var(--surface)}.prompt-option.sel{border-color:var(--primary);background:var(--primary-subtle)}.prompt-option:disabled{cursor:default}.prompt-option-label{display:block;font-size:13px;font-weight:600}.prompt-option-desc{display:block;font-size:12px;font-weight:400;line-height:1.45;color:var(--subtext)}.prompt-actions{display:flex;flex-wrap:wrap;gap:8px}.prompt-actions .btn-primary,.prompt-actions .btn-ghost{display:inline-flex;align-items:center;gap:6px;padding:6px 13px;font-family:inherit;font-size:12px;font-weight:600;border:1px solid transparent;border-radius:5px;cursor:pointer;transition:background 80ms ease,border-color 80ms ease}.prompt-actions .btn-primary{background:var(--primary);color:var(--base)}.prompt-actions .btn-primary:hover:not(:disabled){opacity:.9}.prompt-actions .btn-ghost{background:transparent;border-color:var(--border);color:var(--subtext)}.prompt-actions .btn-ghost:hover:not(:disabled){border-color:var(--border-strong);color:var(--text);background:var(--surface)}.prompt-actions button:disabled{opacity:.5;cursor:default}.prompt-resolved{font-size:11px;font-weight:600;color:var(--muted)}.plan-strip{position:relative;z-index:5;max-width:var(--readable-col);width:calc(100% - 32px);margin:0 auto 6px;padding:9px 12px;display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;border:1px solid var(--border);border-left:3px solid var(--accent-blue);border-radius:8px;background:var(--surface);box-shadow:0 2px 10px #0000000f}.plan-strip-info{display:flex;align-items:center;gap:9px;min-width:0;flex:1}.plan-strip-icon{color:var(--accent-blue);flex-shrink:0}.plan-strip-text{display:flex;flex-direction:column;min-width:0}.plan-strip-title{font-size:12.5px;font-weight:600}.plan-strip-excerpt{font-size:12px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.plan-strip-actions{display:flex;align-items:center;gap:6px;flex-shrink:0}.plan-strip-approve{position:relative;display:flex}.plan-strip-approve .btn-primary:first-child{border-top-right-radius:0;border-bottom-right-radius:0}.plan-strip-caret{border-top-left-radius:0;border-bottom-left-radius:0;padding:0 5px;margin-left:1px;display:flex;align-items:center}.plan-strip-menu{position:absolute;right:0;bottom:calc(100% + 4px);display:flex;flex-direction:column;min-width:190px;padding:4px;border:1px solid var(--border);border-radius:8px;background:var(--surface);box-shadow:0 6px 20px #0000001f;z-index:6}.plan-strip-menu button{text-align:left;padding:7px 9px;border:none;border-radius:5px;background:transparent;color:var(--text);font-size:12.5px;cursor:pointer}.plan-strip-menu button:hover{background:var(--surface-2, rgb(0 0 0 / 5%))}.prompt-plan.clamped{max-height:9.5em;overflow:hidden;position:relative}.prompt-plan.clamped:after{content:"";position:absolute;inset:auto 0 0 0;height:34px;background:linear-gradient(to bottom,transparent,var(--surface));pointer-events:none}.prompt-plan-open{align-self:flex-start;border:none;background:transparent;color:var(--accent-blue);font-size:12px;padding:0;cursor:pointer}.prompt-plan-open:hover{text-decoration:underline}.code-tab{display:flex;flex-direction:column;height:100%;min-height:0}.code-tab-header{display:flex;align-items:center;gap:8px;padding:10px 14px;border-bottom:1px solid var(--border-variant);flex-shrink:0}.code-tab-select{max-width:280px;min-width:0}.code-tab-note{padding:8px 16px;font-size:12px;color:var(--muted);border-bottom:1px solid var(--border-variant);flex-shrink:0}.code-tab-body{flex:1;min-height:0;overflow:auto;background:var(--base)}.code-tree{padding:6px 0;font-size:12.5px}.code-tree-row{display:flex;align-items:center;gap:6px;width:100%;padding:3px 10px;border:none;background:transparent;color:var(--text);text-align:left;cursor:pointer;font-family:inherit;font-size:inherit}.code-tree-row:hover{background:var(--panel)}.code-tree-row>svg{flex-shrink:0;color:var(--subtext)}.code-tree-row>svg.code-tree-chev{color:var(--muted)}.code-tree-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.react-flow{direction:ltr;--xy-edge-stroke-default: #b1b1b7;--xy-edge-stroke-width-default: 1;--xy-edge-stroke-selected-default: #555;--xy-connectionline-stroke-default: #b1b1b7;--xy-connectionline-stroke-width-default: 1;--xy-attribution-background-color-default: rgba(255, 255, 255, .5);--xy-minimap-background-color-default: #fff;--xy-minimap-mask-background-color-default: rgba(240, 240, 240, .6);--xy-minimap-mask-stroke-color-default: transparent;--xy-minimap-mask-stroke-width-default: 1;--xy-minimap-node-background-color-default: #e2e2e2;--xy-minimap-node-stroke-color-default: transparent;--xy-minimap-node-stroke-width-default: 2;--xy-background-color-default: transparent;--xy-background-pattern-dots-color-default: #91919a;--xy-background-pattern-lines-color-default: #eee;--xy-background-pattern-cross-color-default: #e2e2e2;background-color:var(--xy-background-color, var(--xy-background-color-default));--xy-node-color-default: inherit;--xy-node-border-default: 1px solid #1a192b;--xy-node-background-color-default: #fff;--xy-node-group-background-color-default: rgba(240, 240, 240, .25);--xy-node-boxshadow-hover-default: 0 1px 4px 1px rgba(0, 0, 0, .08);--xy-node-boxshadow-selected-default: 0 0 0 .5px #1a192b;--xy-node-border-radius-default: 3px;--xy-handle-background-color-default: #1a192b;--xy-handle-border-color-default: #fff;--xy-selection-background-color-default: rgba(0, 89, 220, .08);--xy-selection-border-default: 1px dotted rgba(0, 89, 220, .8);--xy-controls-button-background-color-default: #fefefe;--xy-controls-button-background-color-hover-default: #f4f4f4;--xy-controls-button-color-default: inherit;--xy-controls-button-color-hover-default: inherit;--xy-controls-button-border-color-default: #eee;--xy-controls-box-shadow-default: 0 0 2px 1px rgba(0, 0, 0, .08);--xy-edge-label-background-color-default: #ffffff;--xy-edge-label-color-default: inherit;--xy-resize-background-color-default: #3367d9}.react-flow.dark{--xy-edge-stroke-default: #3e3e3e;--xy-edge-stroke-width-default: 1;--xy-edge-stroke-selected-default: #727272;--xy-connectionline-stroke-default: #b1b1b7;--xy-connectionline-stroke-width-default: 1;--xy-attribution-background-color-default: rgba(150, 150, 150, .25);--xy-minimap-background-color-default: #141414;--xy-minimap-mask-background-color-default: rgba(60, 60, 60, .6);--xy-minimap-mask-stroke-color-default: transparent;--xy-minimap-mask-stroke-width-default: 1;--xy-minimap-node-background-color-default: #2b2b2b;--xy-minimap-node-stroke-color-default: transparent;--xy-minimap-node-stroke-width-default: 2;--xy-background-color-default: #141414;--xy-background-pattern-dots-color-default: #555;--xy-background-pattern-lines-color-default: #333;--xy-background-pattern-cross-color-default: #333;--xy-node-color-default: #f8f8f8;--xy-node-border-default: 1px solid #3c3c3c;--xy-node-background-color-default: #1e1e1e;--xy-node-group-background-color-default: rgba(240, 240, 240, .25);--xy-node-boxshadow-hover-default: 0 1px 4px 1px rgba(255, 255, 255, .08);--xy-node-boxshadow-selected-default: 0 0 0 .5px #999;--xy-handle-background-color-default: #bebebe;--xy-handle-border-color-default: #1e1e1e;--xy-selection-background-color-default: rgba(200, 200, 220, .08);--xy-selection-border-default: 1px dotted rgba(200, 200, 220, .8);--xy-controls-button-background-color-default: #2b2b2b;--xy-controls-button-background-color-hover-default: #3e3e3e;--xy-controls-button-color-default: #f8f8f8;--xy-controls-button-color-hover-default: #fff;--xy-controls-button-border-color-default: #5b5b5b;--xy-controls-box-shadow-default: 0 0 2px 1px rgba(0, 0, 0, .08);--xy-edge-label-background-color-default: #141414;--xy-edge-label-color-default: #f8f8f8}.react-flow__background{background-color:var(--xy-background-color-props, var(--xy-background-color, var(--xy-background-color-default)));pointer-events:none;z-index:-1}.react-flow__container{position:absolute;width:100%;height:100%;top:0;left:0}.react-flow__pane{z-index:1;touch-action:none}.react-flow__pane.draggable{cursor:grab}.react-flow__pane.dragging{cursor:grabbing}.react-flow__pane.selection{cursor:pointer}.react-flow__viewport{transform-origin:0 0;z-index:2;pointer-events:none}.react-flow__renderer{z-index:4}.react-flow__selection{z-index:6}.react-flow__nodesselection-rect:focus,.react-flow__nodesselection-rect:focus-visible{outline:none}.react-flow__edge-path{stroke:var(--xy-edge-stroke, var(--xy-edge-stroke-default));stroke-width:var(--xy-edge-stroke-width, var(--xy-edge-stroke-width-default));fill:none}.react-flow__connection-path{stroke:var(--xy-connectionline-stroke, var(--xy-connectionline-stroke-default));stroke-width:var(--xy-connectionline-stroke-width, var(--xy-connectionline-stroke-width-default));fill:none}.react-flow .react-flow__edges{position:absolute}.react-flow .react-flow__edges svg{overflow:visible;position:absolute;pointer-events:none}.react-flow__edge{pointer-events:visibleStroke}.react-flow__edge.selectable{cursor:pointer}.react-flow__edge.animated path{stroke-dasharray:5;animation:dashdraw .5s linear infinite}.react-flow__edge.animated path.react-flow__edge-interaction{stroke-dasharray:none;animation:none}.react-flow__edge.inactive{pointer-events:none}.react-flow__edge.selected,.react-flow__edge:focus,.react-flow__edge:focus-visible{outline:none}.react-flow__edge.selected .react-flow__edge-path,.react-flow__edge.selectable:focus .react-flow__edge-path,.react-flow__edge.selectable:focus-visible .react-flow__edge-path{stroke:var(--xy-edge-stroke-selected, var(--xy-edge-stroke-selected-default))}.react-flow__edge-textwrapper{pointer-events:all}.react-flow__edge .react-flow__edge-text{pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__arrowhead polyline{stroke:var(--xy-edge-stroke, var(--xy-edge-stroke-default))}.react-flow__arrowhead polyline.arrowclosed{fill:var(--xy-edge-stroke, var(--xy-edge-stroke-default))}.react-flow__connection{pointer-events:none}.react-flow__connection .animated{stroke-dasharray:5;animation:dashdraw .5s linear infinite}svg.react-flow__connectionline{z-index:1001;overflow:visible;position:absolute}.react-flow__nodes{pointer-events:none;transform-origin:0 0}.react-flow__node{position:absolute;-webkit-user-select:none;-moz-user-select:none;user-select:none;pointer-events:all;transform-origin:0 0;box-sizing:border-box;cursor:default}.react-flow__node.selectable{cursor:pointer}.react-flow__node.draggable{cursor:grab;pointer-events:all}.react-flow__node.draggable.dragging{cursor:grabbing}.react-flow__nodesselection{z-index:3;transform-origin:left top;pointer-events:none}.react-flow__nodesselection-rect{position:absolute;pointer-events:all;cursor:grab}.react-flow__handle{position:absolute;pointer-events:none;min-width:5px;min-height:5px;width:6px;height:6px;background-color:var(--xy-handle-background-color, var(--xy-handle-background-color-default));border:1px solid var(--xy-handle-border-color, var(--xy-handle-border-color-default));border-radius:100%}.react-flow__handle.connectingfrom{pointer-events:all}.react-flow__handle.connectionindicator{pointer-events:all;cursor:crosshair}.react-flow__handle-bottom{top:auto;left:50%;bottom:0;transform:translate(-50%,50%)}.react-flow__handle-top{top:0;left:50%;transform:translate(-50%,-50%)}.react-flow__handle-left{top:50%;left:0;transform:translate(-50%,-50%)}.react-flow__handle-right{top:50%;right:0;transform:translate(50%,-50%)}.react-flow__edgeupdater{cursor:move;pointer-events:all}.react-flow__pane.selection .react-flow__panel{pointer-events:none}.react-flow__panel{position:absolute;z-index:5;margin:15px}.react-flow__panel.top{top:0}.react-flow__panel.bottom{bottom:0}.react-flow__panel.top.center,.react-flow__panel.bottom.center{left:50%;transform:translate(-15px) translate(-50%)}.react-flow__panel.left{left:0}.react-flow__panel.right{right:0}.react-flow__panel.left.center,.react-flow__panel.right.center{top:50%;transform:translateY(-15px) translateY(-50%)}.react-flow__attribution{font-size:10px;background:var(--xy-attribution-background-color, var(--xy-attribution-background-color-default));padding:2px 3px;margin:0}.react-flow__attribution a{text-decoration:none;color:#999}@keyframes dashdraw{0%{stroke-dashoffset:10}}.react-flow__edgelabel-renderer{position:absolute;width:100%;height:100%;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;left:0;top:0}.react-flow__viewport-portal{position:absolute;width:100%;height:100%;left:0;top:0;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__minimap{background:var( --xy-minimap-background-color-props, var(--xy-minimap-background-color, var(--xy-minimap-background-color-default)) )}.react-flow__minimap-svg{display:block}.react-flow__minimap-mask{fill:var( --xy-minimap-mask-background-color-props, var(--xy-minimap-mask-background-color, var(--xy-minimap-mask-background-color-default)) );stroke:var( --xy-minimap-mask-stroke-color-props, var(--xy-minimap-mask-stroke-color, var(--xy-minimap-mask-stroke-color-default)) );stroke-width:var( --xy-minimap-mask-stroke-width-props, var(--xy-minimap-mask-stroke-width, var(--xy-minimap-mask-stroke-width-default)) )}.react-flow__minimap-node{fill:var( --xy-minimap-node-background-color-props, var(--xy-minimap-node-background-color, var(--xy-minimap-node-background-color-default)) );stroke:var( --xy-minimap-node-stroke-color-props, var(--xy-minimap-node-stroke-color, var(--xy-minimap-node-stroke-color-default)) );stroke-width:var( --xy-minimap-node-stroke-width-props, var(--xy-minimap-node-stroke-width, var(--xy-minimap-node-stroke-width-default)) )}.react-flow__background-pattern.dots{fill:var( --xy-background-pattern-color-props, var(--xy-background-pattern-color, var(--xy-background-pattern-dots-color-default)) )}.react-flow__background-pattern.lines{stroke:var( --xy-background-pattern-color-props, var(--xy-background-pattern-color, var(--xy-background-pattern-lines-color-default)) )}.react-flow__background-pattern.cross{stroke:var( --xy-background-pattern-color-props, var(--xy-background-pattern-color, var(--xy-background-pattern-cross-color-default)) )}.react-flow__controls{display:flex;flex-direction:column;box-shadow:var(--xy-controls-box-shadow, var(--xy-controls-box-shadow-default))}.react-flow__controls.horizontal{flex-direction:row}.react-flow__controls-button{display:flex;justify-content:center;align-items:center;height:26px;width:26px;padding:4px;border:none;background:var(--xy-controls-button-background-color, var(--xy-controls-button-background-color-default));border-bottom:1px solid var( --xy-controls-button-border-color-props, var(--xy-controls-button-border-color, var(--xy-controls-button-border-color-default)) );color:var( --xy-controls-button-color-props, var(--xy-controls-button-color, var(--xy-controls-button-color-default)) );cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__controls-button svg{width:100%;max-width:12px;max-height:12px;fill:currentColor}.react-flow__edge.updating .react-flow__edge-path{stroke:#777}.react-flow__edge-text{font-size:10px}.react-flow__node.selectable:focus,.react-flow__node.selectable:focus-visible{outline:none}.react-flow__node-input,.react-flow__node-default,.react-flow__node-output,.react-flow__node-group{padding:10px;border-radius:var(--xy-node-border-radius, var(--xy-node-border-radius-default));width:150px;font-size:12px;color:var(--xy-node-color, var(--xy-node-color-default));text-align:center;border:var(--xy-node-border, var(--xy-node-border-default));background-color:var(--xy-node-background-color, var(--xy-node-background-color-default))}.react-flow__node-input.selectable:hover,.react-flow__node-default.selectable:hover,.react-flow__node-output.selectable:hover,.react-flow__node-group.selectable:hover{box-shadow:var(--xy-node-boxshadow-hover, var(--xy-node-boxshadow-hover-default))}.react-flow__node-input.selectable.selected,.react-flow__node-input.selectable:focus,.react-flow__node-input.selectable:focus-visible,.react-flow__node-default.selectable.selected,.react-flow__node-default.selectable:focus,.react-flow__node-default.selectable:focus-visible,.react-flow__node-output.selectable.selected,.react-flow__node-output.selectable:focus,.react-flow__node-output.selectable:focus-visible,.react-flow__node-group.selectable.selected,.react-flow__node-group.selectable:focus,.react-flow__node-group.selectable:focus-visible{box-shadow:var(--xy-node-boxshadow-selected, var(--xy-node-boxshadow-selected-default))}.react-flow__node-group{background-color:var(--xy-node-group-background-color, var(--xy-node-group-background-color-default))}.react-flow__nodesselection-rect,.react-flow__selection{background:var(--xy-selection-background-color, var(--xy-selection-background-color-default));border:var(--xy-selection-border, var(--xy-selection-border-default))}.react-flow__nodesselection-rect:focus,.react-flow__nodesselection-rect:focus-visible,.react-flow__selection:focus,.react-flow__selection:focus-visible{outline:none}.react-flow__controls-button:hover{background:var( --xy-controls-button-background-color-hover-props, var(--xy-controls-button-background-color-hover, var(--xy-controls-button-background-color-hover-default)) );color:var( --xy-controls-button-color-hover-props, var(--xy-controls-button-color-hover, var(--xy-controls-button-color-hover-default)) )}.react-flow__controls-button:disabled{pointer-events:none}.react-flow__controls-button:disabled svg{fill-opacity:.4}.react-flow__controls-button:last-child{border-bottom:none}.react-flow__controls.horizontal .react-flow__controls-button{border-bottom:none;border-right:1px solid var( --xy-controls-button-border-color-props, var(--xy-controls-button-border-color, var(--xy-controls-button-border-color-default)) )}.react-flow__controls.horizontal .react-flow__controls-button:last-child{border-right:none}.react-flow__resize-control{position:absolute}.react-flow__resize-control.left,.react-flow__resize-control.right{cursor:ew-resize}.react-flow__resize-control.top,.react-flow__resize-control.bottom{cursor:ns-resize}.react-flow__resize-control.top.left,.react-flow__resize-control.bottom.right{cursor:nwse-resize}.react-flow__resize-control.bottom.left,.react-flow__resize-control.top.right{cursor:nesw-resize}.react-flow__resize-control.handle{width:5px;height:5px;border:1px solid #fff;border-radius:1px;background-color:var(--xy-resize-background-color, var(--xy-resize-background-color-default));translate:-50% -50%}.react-flow__resize-control.handle.left{left:0;top:50%}.react-flow__resize-control.handle.right{left:100%;top:50%}.react-flow__resize-control.handle.top{left:50%;top:0}.react-flow__resize-control.handle.bottom{left:50%;top:100%}.react-flow__resize-control.handle.top.left,.react-flow__resize-control.handle.bottom.left{left:0}.react-flow__resize-control.handle.top.right,.react-flow__resize-control.handle.bottom.right{left:100%}.react-flow__resize-control.line{border-color:var(--xy-resize-background-color, var(--xy-resize-background-color-default));border-width:0;border-style:solid}.react-flow__resize-control.line.left,.react-flow__resize-control.line.right{width:1px;transform:translate(-50%);top:0;height:100%}.react-flow__resize-control.line.left{left:0;border-left-width:1px}.react-flow__resize-control.line.right{left:100%;border-right-width:1px}.react-flow__resize-control.line.top,.react-flow__resize-control.line.bottom{height:1px;transform:translateY(-50%);left:0;width:100%}.react-flow__resize-control.line.top{top:0;border-top-width:1px}.react-flow__resize-control.line.bottom{border-bottom-width:1px;top:100%}.react-flow__edge-textbg{fill:var(--xy-edge-label-background-color, var(--xy-edge-label-background-color-default))}.react-flow__edge-text{fill:var(--xy-edge-label-color, var(--xy-edge-label-color-default))}/** - * Copyright (c) 2014 The xterm.js authors. All rights reserved. - * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License) - * https://github.com/chjj/term.js - * @license MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - * Originally forked from (with the author's permission): - * Fabrice Bellard's javascript vt100 for jslinux: - * http://bellard.org/jslinux/ - * Copyright (c) 2011 Fabrice Bellard - * The original design remains. The terminal itself - * has been extended to include xterm CSI codes, among - * other features. - */.xterm{cursor:text;position:relative;user-select:none;-ms-user-select:none;-webkit-user-select:none}.xterm.focus,.xterm:focus{outline:none}.xterm .xterm-helpers{position:absolute;top:0;z-index:5}.xterm .xterm-helper-textarea{padding:0;border:0;margin:0;position:absolute;opacity:0;left:-9999em;top:0;width:0;height:0;z-index:-5;white-space:nowrap;overflow:hidden;resize:none}.xterm .composition-view{background:#000;color:#fff;display:none;position:absolute;white-space:nowrap;z-index:1}.xterm .composition-view.active{display:block}.xterm .xterm-viewport{background-color:#000;overflow-y:scroll;cursor:default;position:absolute;right:0;left:0;top:0;bottom:0}.xterm .xterm-screen{position:relative}.xterm .xterm-screen canvas{position:absolute;left:0;top:0}.xterm .xterm-scroll-area{visibility:hidden}.xterm-char-measure-element{display:inline-block;visibility:hidden;position:absolute;top:0;left:-9999em;line-height:normal}.xterm.enable-mouse-events{cursor:default}.xterm.xterm-cursor-pointer,.xterm .xterm-cursor-pointer{cursor:pointer}.xterm.column-select.focus{cursor:crosshair}.xterm .xterm-accessibility:not(.debug),.xterm .xterm-message{position:absolute;left:0;top:0;bottom:0;right:0;z-index:10;color:transparent;pointer-events:none}.xterm .xterm-accessibility-tree:not(.debug) *::selection{color:transparent}.xterm .xterm-accessibility-tree{-webkit-user-select:text;user-select:text;white-space:pre}.xterm .live-region{position:absolute;left:-9999px;width:1px;height:1px;overflow:hidden}.xterm-dim{opacity:1!important}.xterm-underline-1{text-decoration:underline}.xterm-underline-2{text-decoration:double underline}.xterm-underline-3{text-decoration:wavy underline}.xterm-underline-4{text-decoration:dotted underline}.xterm-underline-5{text-decoration:dashed underline}.xterm-overline{text-decoration:overline}.xterm-overline.xterm-underline-1{text-decoration:overline underline}.xterm-overline.xterm-underline-2{text-decoration:overline double underline}.xterm-overline.xterm-underline-3{text-decoration:overline wavy underline}.xterm-overline.xterm-underline-4{text-decoration:overline dotted underline}.xterm-overline.xterm-underline-5{text-decoration:overline dashed underline}.xterm-strikethrough{text-decoration:line-through}.xterm-screen .xterm-decoration-container .xterm-decoration{z-index:6;position:absolute}.xterm-screen .xterm-decoration-container .xterm-decoration.xterm-decoration-top-layer{z-index:7}.xterm-decoration-overview-ruler{z-index:8;position:absolute;top:0;right:0;pointer-events:none}.xterm-decoration-top{z-index:2;position:relative} diff --git a/ui/dist/index.html b/ui/dist/index.html index c58c3b62..dc3c7cf8 100644 --- a/ui/dist/index.html +++ b/ui/dist/index.html @@ -8,8 +8,8 @@ html { background: #ffffff; } @media (prefers-color-scheme: dark) { html { background: #0e0c0c; } } - - + +
diff --git a/ui/src/App.tsx b/ui/src/App.tsx index 09e2a8d7..25fe9b3b 100644 --- a/ui/src/App.tsx +++ b/ui/src/App.tsx @@ -79,7 +79,9 @@ interface PlanViewDef { * `code` flag (the other tab kinds discriminate on `view`/`path`/`kind`). */ interface CodeTabDef { code: true; - sessionId: string; + /** Owning chat session, or null for the project-level tab (opened from an + * experiment card's Code shortcut — browses branches via the hub clone). */ + sessionId: string | null; /** Source to browse: "" = live session worktree, else a branch name. */ sel: string; /** Whether `sel` was picked by the user — a seeded default silently falls @@ -89,14 +91,6 @@ interface CodeTabDef { toggled: ReadonlySet; } -/** Branch of the experiment owning the project's most recent run — the code - * the user most likely wants to browse — or "" (live worktree) without runs. */ -function defaultCodeSelection(experiments: Experiment[], runs: Run[]): string { - if (runs.length === 0) return ""; - const latest = runs.reduce((a, b) => (b.createdAt > a.createdAt ? b : a)); - return experiments.find((e) => e.id === latest.experimentId)?.branchName ?? ""; -} - // Map a path an agent reported to a repo-relative one — keeping the session // id when it points into a per-session worktree, so the file is read from the // right checkout. Relative paths name files in the click context's checkout @@ -175,7 +169,6 @@ export default function App() { const [runs, setRuns] = useState([]); const [files, setFiles] = useState(null); const [view, setView] = useState<"tree" | "table">("tree"); - const [selectedExpId, setSelectedExpId] = useState(null); const [selectedRunId, setSelectedRunId] = useState(null); // Right-panel tab strip: the pinned Experiments tab plus a closable tab per // opened experiment view / project file. Views are single-purpose, so the @@ -236,7 +229,6 @@ export default function App() { setExperiments([]); setRuns([]); setFiles(null); - setSelectedExpId(null); setSelectedRunId(null); setExpTabs([]); setFileTabs([]); @@ -274,7 +266,6 @@ export default function App() { // Open an experiment view as a right-panel tab (creating it if needed) and // focus it. const openExperimentTab = useCallback((id: string, view: ExperimentView = "changes") => { - setSelectedExpId(id); const tab = { id, view }; setExpTabs((prev) => (prev.some((t) => sameExpTab(t, tab)) ? prev : [...prev, tab])); setRightTab(tab); @@ -350,34 +341,29 @@ export default function App() { [planTabs, rightTab], ); - // Open the code browser for a chat session — live worktree or experiment - // branches — one tab per session (deduped on sessionId), mirroring the - // file/plan tab handlers. A new tab's source defaults to the latest-run - // experiment's branch; reopening keeps the existing tab's state. - const openCodeTab = useCallback( - (sessionId: string) => { - const existing = codeTabs.find((t) => t.sessionId === sessionId); - const tab: CodeTabDef = existing ?? { - code: true, - sessionId, - sel: defaultCodeSelection(experiments, runs), - selPicked: false, - toggled: new Set(), - }; - // Self-guarding updater: a double invocation must not push duplicates. + // Card shortcut: browse a specific experiment branch in the project-level + // code tab (sessionId null), pinning the pick so it never falls back. + const openCodeTabForBranch = useCallback( + (branch: string) => { + const existing = codeTabs.find((t) => t.sessionId === null); + const tab: CodeTabDef = existing + ? { ...existing, sel: branch, selPicked: true } + : { code: true, sessionId: null, sel: branch, selPicked: true, toggled: new Set() }; setCodeTabs((prev) => - prev.some((t) => t.sessionId === sessionId) ? prev : [...prev, tab], + prev.some((t) => t.sessionId === null) + ? prev.map((t) => (t.sessionId === null ? tab : t)) + : [...prev, tab], ); setRightTab(tab); setPanelOpen(true); }, - [codeTabs, experiments, runs], + [codeTabs], ); // Source/expansion changes persist on the tab def, not in CodeTab state — // the component unmounts whenever another right-pane tab fronts it. const updateCodeTab = useCallback( - (sessionId: string, patch: Partial>) => { + (sessionId: string | null, patch: Partial>) => { setCodeTabs((prev) => prev.map((t) => (t.sessionId === sessionId ? { ...t, ...patch } : t))); }, [], @@ -526,7 +512,6 @@ export default function App() { }} onOpenFile={openFileTab} onOpenPlan={openPlanTab} - onOpenCode={openCodeTab} > {mainView === "files" ? ( (() => { @@ -573,10 +558,7 @@ export default function App() { ) } - onSelect={() => { - setRightTab(t); - setSelectedExpId(t.id); - }} + onSelect={() => setRightTab(t)} onClose={() => closeExperimentTab(t)} /> ); @@ -603,7 +585,7 @@ export default function App() { ))} {codeTabs.map((t) => ( } @@ -659,12 +641,8 @@ export default function App() { experiments={experiments} runs={runs} project={activeProject} - selectedId={selectedExpId} - onSelect={(id) => { - setSelectedRunId(null); - setSelectedExpId(id); - }} onOpenView={openExperimentTab} + onOpenCodeBranch={openCodeTabForBranch} /> ) ) : ( @@ -715,7 +693,7 @@ export default function App() { const def = codeTabs.find((t) => t.sessionId === codeTab.sessionId) ?? codeTab; return (