var QY=Object.defineProperty;var ZY=(e,n,r)=>n in e?QY(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r;var $n=(e,n,r)=>ZY(e,typeof n!="symbol"?n+"":n,r);function JY(e,n){for(var r=0;r<n.length;r++){const i=n[r];if(typeof i!="string"&&!Array.isArray(i)){for(const s in i)if(s!=="default"&&!(s in e)){const a=Object.getOwnPropertyDescriptor(i,s);a&&Object.defineProperty(e,s,a.get?a:{enumerable:!0,get:()=>i[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))i(s);new MutationObserver(s=>{for(const a of s)if(a.type==="childList")for(const o of a.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&i(o)}).observe(document,{childList:!0,subtree:!0});function r(s){const a={};return s.integrity&&(a.integrity=s.integrity),s.referrerPolicy&&(a.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?a.credentials="include":s.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function i(s){if(s.ep)return;s.ep=!0;const a=r(s);fetch(s.href,a)}})();function pu(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var sw={exports:{}},Hp={};/**
 * @license React
 * react-jsx-runtime.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var o3;function eG(){if(o3)return Hp;o3=1;var e=Symbol.for("react.transitional.element"),n=Symbol.for("react.fragment");function r(i,s,a){var o=null;if(a!==void 0&&(o=""+a),s.key!==void 0&&(o=""+s.key),"key"in s){a={};for(var l in s)l!=="key"&&(a[l]=s[l])}else a=s;return s=a.ref,{$$typeof:e,type:i,key:o,ref:s!==void 0?s:null,props:a}}return Hp.Fragment=n,Hp.jsx=r,Hp.jsxs=r,Hp}var l3;function tG(){return l3||(l3=1,sw.exports=eG()),sw.exports}var c=tG(),aw={exports:{}},Qt={};/**
 * @license React
 * react.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var c3;function nG(){if(c3)return Qt;c3=1;var e=Symbol.for("react.transitional.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),a=Symbol.for("react.consumer"),o=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),f=Symbol.for("react.activity"),g=Symbol.iterator;function _(R){return R===null||typeof R!="object"?null:(R=g&&R[g]||R["@@iterator"],typeof R=="function"?R:null)}var x={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},v=Object.assign,S={};function w(R,U,V){this.props=R,this.context=U,this.refs=S,this.updater=V||x}w.prototype.isReactComponent={},w.prototype.setState=function(R,U){if(typeof R!="object"&&typeof R!="function"&&R!=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,R,U,"setState")},w.prototype.forceUpdate=function(R){this.updater.enqueueForceUpdate(this,R,"forceUpdate")};function N(){}N.prototype=w.prototype;function C(R,U,V){this.props=R,this.context=U,this.refs=S,this.updater=V||x}var T=C.prototype=new N;T.constructor=C,v(T,w.prototype),T.isPureReactComponent=!0;var A=Array.isArray;function E(){}var D={H:null,A:null,T:null,S:null},F=Object.prototype.hasOwnProperty;function B(R,U,V){var ie=V.ref;return{$$typeof:e,type:R,key:U,ref:ie!==void 0?ie:null,props:V}}function H(R,U){return B(R.type,U,R.props)}function $(R){return typeof R=="object"&&R!==null&&R.$$typeof===e}function z(R){var U={"=":"=0",":":"=2"};return"$"+R.replace(/[=:]/g,function(V){return U[V]})}var W=/\/+/g;function P(R,U){return typeof R=="object"&&R!==null&&R.key!=null?z(""+R.key):U.toString(36)}function q(R){switch(R.status){case"fulfilled":return R.value;case"rejected":throw R.reason;default:switch(typeof R.status=="string"?R.then(E,E):(R.status="pending",R.then(function(U){R.status==="pending"&&(R.status="fulfilled",R.value=U)},function(U){R.status==="pending"&&(R.status="rejected",R.reason=U)})),R.status){case"fulfilled":return R.value;case"rejected":throw R.reason}}throw R}function I(R,U,V,ie,te){var X=typeof R;(X==="undefined"||X==="boolean")&&(R=null);var se=!1;if(R===null)se=!0;else switch(X){case"bigint":case"string":case"number":se=!0;break;case"object":switch(R.$$typeof){case e:case n:se=!0;break;case p:return se=R._init,I(se(R._payload),U,V,ie,te)}}if(se)return te=te(R),se=ie===""?"."+P(R,0):ie,A(te)?(V="",se!=null&&(V=se.replace(W,"$&/")+"/"),I(te,U,V,"",function(ue){return ue})):te!=null&&($(te)&&(te=H(te,V+(te.key==null||R&&R.key===te.key?"":(""+te.key).replace(W,"$&/")+"/")+se)),U.push(te)),1;se=0;var re=ie===""?".":ie+":";if(A(R))for(var de=0;de<R.length;de++)ie=R[de],X=re+P(ie,de),se+=I(ie,U,V,X,te);else if(de=_(R),typeof de=="function")for(R=de.call(R),de=0;!(ie=R.next()).done;)ie=ie.value,X=re+P(ie,de++),se+=I(ie,U,V,X,te);else if(X==="object"){if(typeof R.then=="function")return I(q(R),U,V,ie,te);throw U=String(R),Error("Objects are not valid as a React child (found: "+(U==="[object Object]"?"object with keys {"+Object.keys(R).join(", ")+"}":U)+"). If you meant to render a collection of children, use an array instead.")}return se}function Q(R,U,V){if(R==null)return R;var ie=[],te=0;return I(R,ie,"","",function(X){return U.call(V,X,te++)}),ie}function K(R){if(R._status===-1){var U=R._result;U=U(),U.then(function(V){(R._status===0||R._status===-1)&&(R._status=1,R._result=V)},function(V){(R._status===0||R._status===-1)&&(R._status=2,R._result=V)}),R._status===-1&&(R._status=0,R._result=U)}if(R._status===1)return R._result.default;throw R._result}var Z=typeof reportError=="function"?reportError:function(R){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var U=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof R=="object"&&R!==null&&typeof R.message=="string"?String(R.message):String(R),error:R});if(!window.dispatchEvent(U))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",R);return}console.error(R)},Y={map:Q,forEach:function(R,U,V){Q(R,function(){U.apply(this,arguments)},V)},count:function(R){var U=0;return Q(R,function(){U++}),U},toArray:function(R){return Q(R,function(U){return U})||[]},only:function(R){if(!$(R))throw Error("React.Children.only expected to receive a single React element child.");return R}};return Qt.Activity=f,Qt.Children=Y,Qt.Component=w,Qt.Fragment=r,Qt.Profiler=s,Qt.PureComponent=C,Qt.StrictMode=i,Qt.Suspense=u,Qt.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=D,Qt.__COMPILER_RUNTIME={__proto__:null,c:function(R){return D.H.useMemoCache(R)}},Qt.cache=function(R){return function(){return R.apply(null,arguments)}},Qt.cacheSignal=function(){return null},Qt.cloneElement=function(R,U,V){if(R==null)throw Error("The argument must be a React element, but you passed "+R+".");var ie=v({},R.props),te=R.key;if(U!=null)for(X in U.key!==void 0&&(te=""+U.key),U)!F.call(U,X)||X==="key"||X==="__self"||X==="__source"||X==="ref"&&U.ref===void 0||(ie[X]=U[X]);var X=arguments.length-2;if(X===1)ie.children=V;else if(1<X){for(var se=Array(X),re=0;re<X;re++)se[re]=arguments[re+2];ie.children=se}return B(R.type,te,ie)},Qt.createContext=function(R){return R={$$typeof:o,_currentValue:R,_currentValue2:R,_threadCount:0,Provider:null,Consumer:null},R.Provider=R,R.Consumer={$$typeof:a,_context:R},R},Qt.createElement=function(R,U,V){var ie,te={},X=null;if(U!=null)for(ie in U.key!==void 0&&(X=""+U.key),U)F.call(U,ie)&&ie!=="key"&&ie!=="__self"&&ie!=="__source"&&(te[ie]=U[ie]);var se=arguments.length-2;if(se===1)te.children=V;else if(1<se){for(var re=Array(se),de=0;de<se;de++)re[de]=arguments[de+2];te.children=re}if(R&&R.defaultProps)for(ie in se=R.defaultProps,se)te[ie]===void 0&&(te[ie]=se[ie]);return B(R,X,te)},Qt.createRef=function(){return{current:null}},Qt.forwardRef=function(R){return{$$typeof:l,render:R}},Qt.isValidElement=$,Qt.lazy=function(R){return{$$typeof:p,_payload:{_status:-1,_result:R},_init:K}},Qt.memo=function(R,U){return{$$typeof:d,type:R,compare:U===void 0?null:U}},Qt.startTransition=function(R){var U=D.T,V={};D.T=V;try{var ie=R(),te=D.S;te!==null&&te(V,ie),typeof ie=="object"&&ie!==null&&typeof ie.then=="function"&&ie.then(E,Z)}catch(X){Z(X)}finally{U!==null&&V.types!==null&&(U.types=V.types),D.T=U}},Qt.unstable_useCacheRefresh=function(){return D.H.useCacheRefresh()},Qt.use=function(R){return D.H.use(R)},Qt.useActionState=function(R,U,V){return D.H.useActionState(R,U,V)},Qt.useCallback=function(R,U){return D.H.useCallback(R,U)},Qt.useContext=function(R){return D.H.useContext(R)},Qt.useDebugValue=function(){},Qt.useDeferredValue=function(R,U){return D.H.useDeferredValue(R,U)},Qt.useEffect=function(R,U){return D.H.useEffect(R,U)},Qt.useEffectEvent=function(R){return D.H.useEffectEvent(R)},Qt.useId=function(){return D.H.useId()},Qt.useImperativeHandle=function(R,U,V){return D.H.useImperativeHandle(R,U,V)},Qt.useInsertionEffect=function(R,U){return D.H.useInsertionEffect(R,U)},Qt.useLayoutEffect=function(R,U){return D.H.useLayoutEffect(R,U)},Qt.useMemo=function(R,U){return D.H.useMemo(R,U)},Qt.useOptimistic=function(R,U){return D.H.useOptimistic(R,U)},Qt.useReducer=function(R,U,V){return D.H.useReducer(R,U,V)},Qt.useRef=function(R){return D.H.useRef(R)},Qt.useState=function(R){return D.H.useState(R)},Qt.useSyncExternalStore=function(R,U,V){return D.H.useSyncExternalStore(R,U,V)},Qt.useTransition=function(){return D.H.useTransition()},Qt.version="19.2.4",Qt}var u3;function Gg(){return u3||(u3=1,aw.exports=nG()),aw.exports}var b=Gg();const Wf=pu(b),QN=JY({__proto__:null,default:Wf},[b]);var ow={exports:{}},Wp={},lw={exports:{}},cw={};/**
 * @license React
 * scheduler.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var d3;function rG(){return d3||(d3=1,(function(e){function n(I,Q){var K=I.length;I.push(Q);e:for(;0<K;){var Z=K-1>>>1,Y=I[Z];if(0<s(Y,Q))I[Z]=Q,I[K]=Y,K=Z;else break e}}function r(I){return I.length===0?null:I[0]}function i(I){if(I.length===0)return null;var Q=I[0],K=I.pop();if(K!==Q){I[0]=K;e:for(var Z=0,Y=I.length,R=Y>>>1;Z<R;){var U=2*(Z+1)-1,V=I[U],ie=U+1,te=I[ie];if(0>s(V,K))ie<Y&&0>s(te,V)?(I[Z]=te,I[ie]=K,Z=ie):(I[Z]=V,I[U]=K,Z=U);else if(ie<Y&&0>s(te,K))I[Z]=te,I[ie]=K,Z=ie;else break e}}return Q}function s(I,Q){var K=I.sortIndex-Q.sortIndex;return K!==0?K:I.id-Q.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,l=o.now();e.unstable_now=function(){return o.now()-l}}var u=[],d=[],p=1,f=null,g=3,_=!1,x=!1,v=!1,S=!1,w=typeof setTimeout=="function"?setTimeout:null,N=typeof clearTimeout=="function"?clearTimeout:null,C=typeof setImmediate<"u"?setImmediate:null;function T(I){for(var Q=r(d);Q!==null;){if(Q.callback===null)i(d);else if(Q.startTime<=I)i(d),Q.sortIndex=Q.expirationTime,n(u,Q);else break;Q=r(d)}}function A(I){if(v=!1,T(I),!x)if(r(u)!==null)x=!0,E||(E=!0,z());else{var Q=r(d);Q!==null&&q(A,Q.startTime-I)}}var E=!1,D=-1,F=5,B=-1;function H(){return S?!0:!(e.unstable_now()-B<F)}function $(){if(S=!1,E){var I=e.unstable_now();B=I;var Q=!0;try{e:{x=!1,v&&(v=!1,N(D),D=-1),_=!0;var K=g;try{t:{for(T(I),f=r(u);f!==null&&!(f.expirationTime>I&&H());){var Z=f.callback;if(typeof Z=="function"){f.callback=null,g=f.priorityLevel;var Y=Z(f.expirationTime<=I);if(I=e.unstable_now(),typeof Y=="function"){f.callback=Y,T(I),Q=!0;break t}f===r(u)&&i(u),T(I)}else i(u);f=r(u)}if(f!==null)Q=!0;else{var R=r(d);R!==null&&q(A,R.startTime-I),Q=!1}}break e}finally{f=null,g=K,_=!1}Q=void 0}}finally{Q?z():E=!1}}}var z;if(typeof C=="function")z=function(){C($)};else if(typeof MessageChannel<"u"){var W=new MessageChannel,P=W.port2;W.port1.onmessage=$,z=function(){P.postMessage(null)}}else z=function(){w($,0)};function q(I,Q){D=w(function(){I(e.unstable_now())},Q)}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(I){I.callback=null},e.unstable_forceFrameRate=function(I){0>I||125<I?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):F=0<I?Math.floor(1e3/I):5},e.unstable_getCurrentPriorityLevel=function(){return g},e.unstable_next=function(I){switch(g){case 1:case 2:case 3:var Q=3;break;default:Q=g}var K=g;g=Q;try{return I()}finally{g=K}},e.unstable_requestPaint=function(){S=!0},e.unstable_runWithPriority=function(I,Q){switch(I){case 1:case 2:case 3:case 4:case 5:break;default:I=3}var K=g;g=I;try{return Q()}finally{g=K}},e.unstable_scheduleCallback=function(I,Q,K){var Z=e.unstable_now();switch(typeof K=="object"&&K!==null?(K=K.delay,K=typeof K=="number"&&0<K?Z+K:Z):K=Z,I){case 1:var Y=-1;break;case 2:Y=250;break;case 5:Y=1073741823;break;case 4:Y=1e4;break;default:Y=5e3}return Y=K+Y,I={id:p++,callback:Q,priorityLevel:I,startTime:K,expirationTime:Y,sortIndex:-1},K>Z?(I.sortIndex=K,n(d,I),r(u)===null&&I===r(d)&&(v?(N(D),D=-1):v=!0,q(A,K-Z))):(I.sortIndex=Y,n(u,I),x||_||(x=!0,E||(E=!0,z()))),I},e.unstable_shouldYield=H,e.unstable_wrapCallback=function(I){var Q=g;return function(){var K=g;g=Q;try{return I.apply(this,arguments)}finally{g=K}}}})(cw)),cw}var h3;function iG(){return h3||(h3=1,lw.exports=rG()),lw.exports}var uw={exports:{}},Pi={};/**
 * @license React
 * react-dom.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var f3;function sG(){if(f3)return Pi;f3=1;var e=Gg();function n(u){var d="https://react.dev/errors/"+u;if(1<arguments.length){d+="?args[]="+encodeURIComponent(arguments[1]);for(var p=2;p<arguments.length;p++)d+="&args[]="+encodeURIComponent(arguments[p])}return"Minified React error #"+u+"; visit "+d+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(){}var i={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},s=Symbol.for("react.portal");function a(u,d,p){var f=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:s,key:f==null?null:""+f,children:u,containerInfo:d,implementation:p}}var o=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function l(u,d){if(u==="font")return"";if(typeof d=="string")return d==="use-credentials"?d:""}return Pi.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,Pi.createPortal=function(u,d){var p=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!d||d.nodeType!==1&&d.nodeType!==9&&d.nodeType!==11)throw Error(n(299));return a(u,d,null,p)},Pi.flushSync=function(u){var d=o.T,p=i.p;try{if(o.T=null,i.p=2,u)return u()}finally{o.T=d,i.p=p,i.d.f()}},Pi.preconnect=function(u,d){typeof u=="string"&&(d?(d=d.crossOrigin,d=typeof d=="string"?d==="use-credentials"?d:"":void 0):d=null,i.d.C(u,d))},Pi.prefetchDNS=function(u){typeof u=="string"&&i.d.D(u)},Pi.preinit=function(u,d){if(typeof u=="string"&&d&&typeof d.as=="string"){var p=d.as,f=l(p,d.crossOrigin),g=typeof d.integrity=="string"?d.integrity:void 0,_=typeof d.fetchPriority=="string"?d.fetchPriority:void 0;p==="style"?i.d.S(u,typeof d.precedence=="string"?d.precedence:void 0,{crossOrigin:f,integrity:g,fetchPriority:_}):p==="script"&&i.d.X(u,{crossOrigin:f,integrity:g,fetchPriority:_,nonce:typeof d.nonce=="string"?d.nonce:void 0})}},Pi.preinitModule=function(u,d){if(typeof u=="string")if(typeof d=="object"&&d!==null){if(d.as==null||d.as==="script"){var p=l(d.as,d.crossOrigin);i.d.M(u,{crossOrigin:p,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0})}}else d==null&&i.d.M(u)},Pi.preload=function(u,d){if(typeof u=="string"&&typeof d=="object"&&d!==null&&typeof d.as=="string"){var p=d.as,f=l(p,d.crossOrigin);i.d.L(u,p,{crossOrigin:f,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0,type:typeof d.type=="string"?d.type:void 0,fetchPriority:typeof d.fetchPriority=="string"?d.fetchPriority:void 0,referrerPolicy:typeof d.referrerPolicy=="string"?d.referrerPolicy:void 0,imageSrcSet:typeof d.imageSrcSet=="string"?d.imageSrcSet:void 0,imageSizes:typeof d.imageSizes=="string"?d.imageSizes:void 0,media:typeof d.media=="string"?d.media:void 0})}},Pi.preloadModule=function(u,d){if(typeof u=="string")if(d){var p=l(d.as,d.crossOrigin);i.d.m(u,{as:typeof d.as=="string"&&d.as!=="script"?d.as:void 0,crossOrigin:p,integrity:typeof d.integrity=="string"?d.integrity:void 0})}else i.d.m(u)},Pi.requestFormReset=function(u){i.d.r(u)},Pi.unstable_batchedUpdates=function(u,d){return u(d)},Pi.useFormState=function(u,d,p){return o.H.useFormState(u,d,p)},Pi.useFormStatus=function(){return o.H.useHostTransitionStatus()},Pi.version="19.2.4",Pi}var p3;function O8(){if(p3)return uw.exports;p3=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(n){console.error(n)}}return e(),uw.exports=sG(),uw.exports}/**
 * @license React
 * react-dom-client.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var m3;function aG(){if(m3)return Wp;m3=1;var e=iG(),n=Gg(),r=O8();function i(h){var m="https://react.dev/errors/"+h;if(1<arguments.length){m+="?args[]="+encodeURIComponent(arguments[1]);for(var y=2;y<arguments.length;y++)m+="&args[]="+encodeURIComponent(arguments[y])}return"Minified React error #"+h+"; visit "+m+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(h){return!(!h||h.nodeType!==1&&h.nodeType!==9&&h.nodeType!==11)}function a(h){var m=h,y=h;if(h.alternate)for(;m.return;)m=m.return;else{h=m;do m=h,(m.flags&4098)!==0&&(y=m.return),h=m.return;while(h)}return m.tag===3?y:null}function o(h){if(h.tag===13){var m=h.memoizedState;if(m===null&&(h=h.alternate,h!==null&&(m=h.memoizedState)),m!==null)return m.dehydrated}return null}function l(h){if(h.tag===31){var m=h.memoizedState;if(m===null&&(h=h.alternate,h!==null&&(m=h.memoizedState)),m!==null)return m.dehydrated}return null}function u(h){if(a(h)!==h)throw Error(i(188))}function d(h){var m=h.alternate;if(!m){if(m=a(h),m===null)throw Error(i(188));return m!==h?null:h}for(var y=h,k=m;;){var j=y.return;if(j===null)break;var M=j.alternate;if(M===null){if(k=j.return,k!==null){y=k;continue}break}if(j.child===M.child){for(M=j.child;M;){if(M===y)return u(j),h;if(M===k)return u(j),m;M=M.sibling}throw Error(i(188))}if(y.return!==k.return)y=j,k=M;else{for(var G=!1,ne=j.child;ne;){if(ne===y){G=!0,y=j,k=M;break}if(ne===k){G=!0,k=j,y=M;break}ne=ne.sibling}if(!G){for(ne=M.child;ne;){if(ne===y){G=!0,y=M,k=j;break}if(ne===k){G=!0,k=M,y=j;break}ne=ne.sibling}if(!G)throw Error(i(189))}}if(y.alternate!==k)throw Error(i(190))}if(y.tag!==3)throw Error(i(188));return y.stateNode.current===y?h:m}function p(h){var m=h.tag;if(m===5||m===26||m===27||m===6)return h;for(h=h.child;h!==null;){if(m=p(h),m!==null)return m;h=h.sibling}return null}var f=Object.assign,g=Symbol.for("react.element"),_=Symbol.for("react.transitional.element"),x=Symbol.for("react.portal"),v=Symbol.for("react.fragment"),S=Symbol.for("react.strict_mode"),w=Symbol.for("react.profiler"),N=Symbol.for("react.consumer"),C=Symbol.for("react.context"),T=Symbol.for("react.forward_ref"),A=Symbol.for("react.suspense"),E=Symbol.for("react.suspense_list"),D=Symbol.for("react.memo"),F=Symbol.for("react.lazy"),B=Symbol.for("react.activity"),H=Symbol.for("react.memo_cache_sentinel"),$=Symbol.iterator;function z(h){return h===null||typeof h!="object"?null:(h=$&&h[$]||h["@@iterator"],typeof h=="function"?h:null)}var W=Symbol.for("react.client.reference");function P(h){if(h==null)return null;if(typeof h=="function")return h.$$typeof===W?null:h.displayName||h.name||null;if(typeof h=="string")return h;switch(h){case v:return"Fragment";case w:return"Profiler";case S:return"StrictMode";case A:return"Suspense";case E:return"SuspenseList";case B:return"Activity"}if(typeof h=="object")switch(h.$$typeof){case x:return"Portal";case C:return h.displayName||"Context";case N:return(h._context.displayName||"Context")+".Consumer";case T:var m=h.render;return h=h.displayName,h||(h=m.displayName||m.name||"",h=h!==""?"ForwardRef("+h+")":"ForwardRef"),h;case D:return m=h.displayName||null,m!==null?m:P(h.type)||"Memo";case F:m=h._payload,h=h._init;try{return P(h(m))}catch{}}return null}var q=Array.isArray,I=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Q=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,K={pending:!1,data:null,method:null,action:null},Z=[],Y=-1;function R(h){return{current:h}}function U(h){0>Y||(h.current=Z[Y],Z[Y]=null,Y--)}function V(h,m){Y++,Z[Y]=h.current,h.current=m}var ie=R(null),te=R(null),X=R(null),se=R(null);function re(h,m){switch(V(X,m),V(te,h),V(ie,null),m.nodeType){case 9:case 11:h=(h=m.documentElement)&&(h=h.namespaceURI)?T5(h):0;break;default:if(h=m.tagName,m=m.namespaceURI)m=T5(m),h=M5(m,h);else switch(h){case"svg":h=1;break;case"math":h=2;break;default:h=0}}U(ie),V(ie,h)}function de(){U(ie),U(te),U(X)}function ue(h){h.memoizedState!==null&&V(se,h);var m=ie.current,y=M5(m,h.type);m!==y&&(V(te,h),V(ie,y))}function ae(h){te.current===h&&(U(ie),U(te)),se.current===h&&(U(se),Bp._currentValue=K)}var pe,J;function me(h){if(pe===void 0)try{throw Error()}catch(y){var m=y.stack.trim().match(/\n( *(at )?)/);pe=m&&m[1]||"",J=-1<y.stack.indexOf(`
    at`)?" (<anonymous>)":-1<y.stack.indexOf("@")?"@unknown:0:0":""}return`
`+pe+h+J}var fe=!1;function ve(h,m){if(!h||fe)return"";fe=!0;var y=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var k={DetermineComponentFrameRoot:function(){try{if(m){var tt=function(){throw Error()};if(Object.defineProperty(tt.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(tt,[])}catch(He){var ze=He}Reflect.construct(h,[],tt)}else{try{tt.call()}catch(He){ze=He}h.call(tt.prototype)}}else{try{throw Error()}catch(He){ze=He}(tt=h())&&typeof tt.catch=="function"&&tt.catch(function(){})}}catch(He){if(He&&ze&&typeof He.stack=="string")return[He.stack,ze.stack]}return[null,null]}};k.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var j=Object.getOwnPropertyDescriptor(k.DetermineComponentFrameRoot,"name");j&&j.configurable&&Object.defineProperty(k.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var M=k.DetermineComponentFrameRoot(),G=M[0],ne=M[1];if(G&&ne){var he=G.split(`
`),De=ne.split(`
`);for(j=k=0;k<he.length&&!he[k].includes("DetermineComponentFrameRoot");)k++;for(;j<De.length&&!De[j].includes("DetermineComponentFrameRoot");)j++;if(k===he.length||j===De.length)for(k=he.length-1,j=De.length-1;1<=k&&0<=j&&he[k]!==De[j];)j--;for(;1<=k&&0<=j;k--,j--)if(he[k]!==De[j]){if(k!==1||j!==1)do if(k--,j--,0>j||he[k]!==De[j]){var Ge=`
`+he[k].replace(" at new "," at ");return h.displayName&&Ge.includes("<anonymous>")&&(Ge=Ge.replace("<anonymous>",h.displayName)),Ge}while(1<=k&&0<=j);break}}}finally{fe=!1,Error.prepareStackTrace=y}return(y=h?h.displayName||h.name:"")?me(y):""}function Ke(h,m){switch(h.tag){case 26:case 27:case 5:return me(h.type);case 16:return me("Lazy");case 13:return h.child!==m&&m!==null?me("Suspense Fallback"):me("Suspense");case 19:return me("SuspenseList");case 0:case 15:return ve(h.type,!1);case 11:return ve(h.type.render,!1);case 1:return ve(h.type,!0);case 31:return me("Activity");default:return""}}function ge(h){try{var m="",y=null;do m+=Ke(h,y),y=h,h=h.return;while(h);return m}catch(k){return`
Error generating stack: `+k.message+`
`+k.stack}}var Ue=Object.prototype.hasOwnProperty,$e=e.unstable_scheduleCallback,Bt=e.unstable_cancelCallback,ct=e.unstable_shouldYield,Mt=e.unstable_requestPaint,Tt=e.unstable_now,Dt=e.unstable_getCurrentPriorityLevel,Re=e.unstable_ImmediatePriority,et=e.unstable_UserBlockingPriority,bt=e.unstable_NormalPriority,yt=e.unstable_LowPriority,O=e.unstable_IdlePriority,ke=e.log,Le=e.unstable_setDisableYieldValue,ye=null,_e=null;function Pe(h){if(typeof ke=="function"&&Le(h),_e&&typeof _e.setStrictMode=="function")try{_e.setStrictMode(ye,h)}catch{}}var ee=Math.clz32?Math.clz32:Te,le=Math.log,je=Math.LN2;function Te(h){return h>>>=0,h===0?32:31-(le(h)/je|0)|0}var Me=256,Ne=262144,Ee=4194304;function rt(h){var m=h&42;if(m!==0)return m;switch(h&-h){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64: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 h&261888;case 262144:case 524288:case 1048576:case 2097152:return h&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return h&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return h}}function Ye(h,m,y){var k=h.pendingLanes;if(k===0)return 0;var j=0,M=h.suspendedLanes,G=h.pingedLanes;h=h.warmLanes;var ne=k&134217727;return ne!==0?(k=ne&~M,k!==0?j=rt(k):(G&=ne,G!==0?j=rt(G):y||(y=ne&~h,y!==0&&(j=rt(y))))):(ne=k&~M,ne!==0?j=rt(ne):G!==0?j=rt(G):y||(y=k&~h,y!==0&&(j=rt(y)))),j===0?0:m!==0&&m!==j&&(m&M)===0&&(M=j&-j,y=m&-m,M>=y||M===32&&(y&4194048)!==0)?m:j}function it(h,m){return(h.pendingLanes&~(h.suspendedLanes&~h.pingedLanes)&m)===0}function kt(h,m){switch(h){case 1:case 2:case 4:case 8:case 64:return m+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 m+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 mt(){var h=Ee;return Ee<<=1,(Ee&62914560)===0&&(Ee=4194304),h}function zt(h){for(var m=[],y=0;31>y;y++)m.push(h);return m}function xe(h,m){h.pendingLanes|=m,m!==268435456&&(h.suspendedLanes=0,h.pingedLanes=0,h.warmLanes=0)}function qe(h,m,y,k,j,M){var G=h.pendingLanes;h.pendingLanes=y,h.suspendedLanes=0,h.pingedLanes=0,h.warmLanes=0,h.expiredLanes&=y,h.entangledLanes&=y,h.errorRecoveryDisabledLanes&=y,h.shellSuspendCounter=0;var ne=h.entanglements,he=h.expirationTimes,De=h.hiddenUpdates;for(y=G&~y;0<y;){var Ge=31-ee(y),tt=1<<Ge;ne[Ge]=0,he[Ge]=-1;var ze=De[Ge];if(ze!==null)for(De[Ge]=null,Ge=0;Ge<ze.length;Ge++){var He=ze[Ge];He!==null&&(He.lane&=-536870913)}y&=~tt}k!==0&&dt(h,k,0),M!==0&&j===0&&h.tag!==0&&(h.suspendedLanes|=M&~(G&~m))}function dt(h,m,y){h.pendingLanes|=m,h.suspendedLanes&=~m;var k=31-ee(m);h.entangledLanes|=m,h.entanglements[k]=h.entanglements[k]|1073741824|y&261930}function sn(h,m){var y=h.entangledLanes|=m;for(h=h.entanglements;y;){var k=31-ee(y),j=1<<k;j&m|h[k]&m&&(h[k]|=m),y&=~j}}function nn(h,m){var y=m&-m;return y=(y&42)!==0?1:Kt(y),(y&(h.suspendedLanes|m))!==0?0:y}function Kt(h){switch(h){case 2:h=1;break;case 8:h=4;break;case 32:h=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:h=128;break;case 268435456:h=134217728;break;default:h=0}return h}function rr(h){return h&=-h,2<h?8<h?(h&134217727)!==0?32:268435456:8:2}function yi(){var h=Q.p;return h!==0?h:(h=window.event,h===void 0?32:e3(h.type))}function un(h,m){var y=Q.p;try{return Q.p=h,m()}finally{Q.p=y}}var Yt=Math.random().toString(36).slice(2),L="__reactFiber$"+Yt,Qe="__reactProps$"+Yt,_t="__reactContainer$"+Yt,Gt="__reactEvents$"+Yt,jr="__reactListeners$"+Yt,Qr="__reactHandles$"+Yt,oo="__reactResources$"+Yt,cs="__reactMarker$"+Yt;function rl(h){delete h[L],delete h[Qe],delete h[Gt],delete h[jr],delete h[Qr]}function us(h){var m=h[L];if(m)return m;for(var y=h.parentNode;y;){if(m=y[_t]||y[L]){if(y=m.alternate,m.child!==null||y!==null&&y.child!==null)for(h=B5(h);h!==null;){if(y=h[L])return y;h=B5(h)}return m}h=y,y=h.parentNode}return null}function Ri(h){if(h=h[L]||h[_t]){var m=h.tag;if(m===5||m===6||m===13||m===31||m===26||m===27||m===3)return h}return null}function Ki(h){var m=h.tag;if(m===5||m===26||m===27||m===6)return h.stateNode;throw Error(i(33))}function Fr(h){var m=h[oo];return m||(m=h[oo]={hoistableStyles:new Map,hoistableScripts:new Map}),m}function Kn(h){h[cs]=!0}var il=new Set,tc={};function Rs(h,m){ra(h,m),ra(h+"Capture",m)}function ra(h,m){for(tc[h]=m,h=0;h<m.length;h++)il.add(m[h])}var _u=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),sl={},Os={};function al(h){return Ue.call(Os,h)?!0:Ue.call(sl,h)?!1:_u.test(h)?Os[h]=!0:(sl[h]=!0,!1)}function hr(h,m,y){if(al(m))if(y===null)h.removeAttribute(m);else{switch(typeof y){case"undefined":case"function":case"symbol":h.removeAttribute(m);return;case"boolean":var k=m.toLowerCase().slice(0,5);if(k!=="data-"&&k!=="aria-"){h.removeAttribute(m);return}}h.setAttribute(m,""+y)}}function Ds(h,m,y){if(y===null)h.removeAttribute(m);else{switch(typeof y){case"undefined":case"function":case"symbol":case"boolean":h.removeAttribute(m);return}h.setAttribute(m,""+y)}}function Zr(h,m,y,k){if(k===null)h.removeAttribute(y);else{switch(typeof k){case"undefined":case"function":case"symbol":case"boolean":h.removeAttribute(y);return}h.setAttributeNS(m,y,""+k)}}function ai(h){switch(typeof h){case"bigint":case"boolean":case"number":case"string":case"undefined":return h;case"object":return h;default:return""}}function lo(h){var m=h.type;return(h=h.nodeName)&&h.toLowerCase()==="input"&&(m==="checkbox"||m==="radio")}function xu(h,m,y){var k=Object.getOwnPropertyDescriptor(h.constructor.prototype,m);if(!h.hasOwnProperty(m)&&typeof k<"u"&&typeof k.get=="function"&&typeof k.set=="function"){var j=k.get,M=k.set;return Object.defineProperty(h,m,{configurable:!0,get:function(){return j.call(this)},set:function(G){y=""+G,M.call(this,G)}}),Object.defineProperty(h,m,{enumerable:k.enumerable}),{getValue:function(){return y},setValue:function(G){y=""+G},stopTracking:function(){h._valueTracker=null,delete h[m]}}}}function _i(h){if(!h._valueTracker){var m=lo(h)?"checked":"value";h._valueTracker=xu(h,m,""+h[m])}}function co(h){if(!h)return!1;var m=h._valueTracker;if(!m)return!0;var y=m.getValue(),k="";return h&&(k=lo(h)?h.checked?"true":"false":h.value),h=k,h!==y?(m.setValue(h),!0):!1}function ce(h){if(h=h||(typeof document<"u"?document:void 0),typeof h>"u")return null;try{return h.activeElement||h.body}catch{return h.body}}var Be=/[\n"\\]/g;function xt(h){return h.replace(Be,function(m){return"\\"+m.charCodeAt(0).toString(16)+" "})}function Ft(h,m,y,k,j,M,G,ne){h.name="",G!=null&&typeof G!="function"&&typeof G!="symbol"&&typeof G!="boolean"?h.type=G:h.removeAttribute("type"),m!=null?G==="number"?(m===0&&h.value===""||h.value!=m)&&(h.value=""+ai(m)):h.value!==""+ai(m)&&(h.value=""+ai(m)):G!=="submit"&&G!=="reset"||h.removeAttribute("value"),m!=null?Oi(h,G,ai(m)):y!=null?Oi(h,G,ai(y)):k!=null&&h.removeAttribute("value"),j==null&&M!=null&&(h.defaultChecked=!!M),j!=null&&(h.checked=j&&typeof j!="function"&&typeof j!="symbol"),ne!=null&&typeof ne!="function"&&typeof ne!="symbol"&&typeof ne!="boolean"?h.name=""+ai(ne):h.removeAttribute("name")}function Yn(h,m,y,k,j,M,G,ne){if(M!=null&&typeof M!="function"&&typeof M!="symbol"&&typeof M!="boolean"&&(h.type=M),m!=null||y!=null){if(!(M!=="submit"&&M!=="reset"||m!=null)){_i(h);return}y=y!=null?""+ai(y):"",m=m!=null?""+ai(m):y,ne||m===h.value||(h.value=m),h.defaultValue=m}k=k??j,k=typeof k!="function"&&typeof k!="symbol"&&!!k,h.checked=ne?h.checked:!!k,h.defaultChecked=!!k,G!=null&&typeof G!="function"&&typeof G!="symbol"&&typeof G!="boolean"&&(h.name=G),_i(h)}function Oi(h,m,y){m==="number"&&ce(h.ownerDocument)===h||h.defaultValue===""+y||(h.defaultValue=""+y)}function Di(h,m,y,k){if(h=h.options,m){m={};for(var j=0;j<y.length;j++)m["$"+y[j]]=!0;for(y=0;y<h.length;y++)j=m.hasOwnProperty("$"+h[y].value),h[y].selected!==j&&(h[y].selected=j),j&&k&&(h[y].defaultSelected=!0)}else{for(y=""+ai(y),m=null,j=0;j<h.length;j++){if(h[j].value===y){h[j].selected=!0,k&&(h[j].defaultSelected=!0);return}m!==null||h[j].disabled||(m=h[j])}m!==null&&(m.selected=!0)}}function tp(h,m,y){if(m!=null&&(m=""+ai(m),m!==h.value&&(h.value=m),y==null)){h.defaultValue!==m&&(h.defaultValue=m);return}h.defaultValue=y!=null?""+ai(y):""}function $d(h,m,y,k){if(m==null){if(k!=null){if(y!=null)throw Error(i(92));if(q(k)){if(1<k.length)throw Error(i(93));k=k[0]}y=k}y==null&&(y=""),m=y}y=ai(m),h.defaultValue=y,k=h.textContent,k===y&&k!==""&&k!==null&&(h.value=k),_i(h)}function uo(h,m){if(m){var y=h.firstChild;if(y&&y===h.lastChild&&y.nodeType===3){y.nodeValue=m;return}}h.textContent=m}var Lv=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function np(h,m,y){var k=m.indexOf("--")===0;y==null||typeof y=="boolean"||y===""?k?h.setProperty(m,""):m==="float"?h.cssFloat="":h[m]="":k?h.setProperty(m,y):typeof y!="number"||y===0||Lv.has(m)?m==="float"?h.cssFloat=y:h[m]=(""+y).trim():h[m]=y+"px"}function Iv(h,m,y){if(m!=null&&typeof m!="object")throw Error(i(62));if(h=h.style,y!=null){for(var k in y)!y.hasOwnProperty(k)||m!=null&&m.hasOwnProperty(k)||(k.indexOf("--")===0?h.setProperty(k,""):k==="float"?h.cssFloat="":h[k]="");for(var j in m)k=m[j],m.hasOwnProperty(j)&&y[j]!==k&&np(h,j,k)}else for(var M in m)m.hasOwnProperty(M)&&np(h,M,m[M])}function rp(h){if(h.indexOf("-")===-1)return!1;switch(h){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var ok=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),lk=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Fd(h){return lk.test(""+h)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":h}function ia(){}var ip=null;function Hd(h){return h=h.target||h.srcElement||window,h.correspondingUseElement&&(h=h.correspondingUseElement),h.nodeType===3?h.parentNode:h}var Ra=null,ho=null;function oe(h){var m=Ri(h);if(m&&(h=m.stateNode)){var y=h[Qe]||null;e:switch(h=m.stateNode,m.type){case"input":if(Ft(h,y.value,y.defaultValue,y.defaultValue,y.checked,y.defaultChecked,y.type,y.name),m=y.name,y.type==="radio"&&m!=null){for(y=h;y.parentNode;)y=y.parentNode;for(y=y.querySelectorAll('input[name="'+xt(""+m)+'"][type="radio"]'),m=0;m<y.length;m++){var k=y[m];if(k!==h&&k.form===h.form){var j=k[Qe]||null;if(!j)throw Error(i(90));Ft(k,j.value,j.defaultValue,j.defaultValue,j.checked,j.defaultChecked,j.type,j.name)}}for(m=0;m<y.length;m++)k=y[m],k.form===h.form&&co(k)}break e;case"textarea":tp(h,y.value,y.defaultValue);break e;case"select":m=y.value,m!=null&&Di(h,!!y.multiple,m,!1)}}}var Se=!1;function Fe(h,m,y){if(Se)return h(m,y);Se=!0;try{var k=h(m);return k}finally{if(Se=!1,(Ra!==null||ho!==null)&&(xy(),Ra&&(m=Ra,h=ho,ho=Ra=null,oe(m),h)))for(m=0;m<h.length;m++)oe(h[m])}}function Ve(h,m){var y=h.stateNode;if(y===null)return null;var k=y[Qe]||null;if(k===null)return null;y=k[m];e:switch(m){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(k=!k.disabled)||(h=h.type,k=!(h==="button"||h==="input"||h==="select"||h==="textarea")),h=!k;break e;default:h=!1}if(h)return null;if(y&&typeof y!="function")throw Error(i(231,m,typeof y));return y}var at=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ht=!1;if(at)try{var Nt={};Object.defineProperty(Nt,"passive",{get:function(){ht=!0}}),window.addEventListener("test",Nt,Nt),window.removeEventListener("test",Nt,Nt)}catch{ht=!1}var dn=null,An=null,rn=null;function Ht(){if(rn)return rn;var h,m=An,y=m.length,k,j="value"in dn?dn.value:dn.textContent,M=j.length;for(h=0;h<y&&m[h]===j[h];h++);var G=y-h;for(k=1;k<=G&&m[y-k]===j[M-k];k++);return rn=j.slice(h,1<k?1-k:void 0)}function wn(h){var m=h.keyCode;return"charCode"in h?(h=h.charCode,h===0&&m===13&&(h=13)):h=m,h===10&&(h=13),32<=h||h===13?h:0}function qt(){return!0}function On(){return!1}function yn(h){function m(y,k,j,M,G){this._reactName=y,this._targetInst=j,this.type=k,this.nativeEvent=M,this.target=G,this.currentTarget=null;for(var ne in h)h.hasOwnProperty(ne)&&(y=h[ne],this[ne]=y?y(M):M[ne]);return this.isDefaultPrevented=(M.defaultPrevented!=null?M.defaultPrevented:M.returnValue===!1)?qt:On,this.isPropagationStopped=On,this}return f(m.prototype,{preventDefault:function(){this.defaultPrevented=!0;var y=this.nativeEvent;y&&(y.preventDefault?y.preventDefault():typeof y.returnValue!="unknown"&&(y.returnValue=!1),this.isDefaultPrevented=qt)},stopPropagation:function(){var y=this.nativeEvent;y&&(y.stopPropagation?y.stopPropagation():typeof y.cancelBubble!="unknown"&&(y.cancelBubble=!0),this.isPropagationStopped=qt)},persist:function(){},isPersistent:qt}),m}var Nr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(h){return h.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Gn=yn(Nr),xi=f({},Nr,{view:0,detail:0}),fo=yn(xi),po,bu,ku,Bv=f({},xi,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:uk,button:0,buttons:0,relatedTarget:function(h){return h.relatedTarget===void 0?h.fromElement===h.srcElement?h.toElement:h.fromElement:h.relatedTarget},movementX:function(h){return"movementX"in h?h.movementX:(h!==ku&&(ku&&h.type==="mousemove"?(po=h.screenX-ku.screenX,bu=h.screenY-ku.screenY):bu=po=0,ku=h),po)},movementY:function(h){return"movementY"in h?h.movementY:bu}}),OT=yn(Bv),XV=f({},Bv,{dataTransfer:0}),QV=yn(XV),ZV=f({},xi,{relatedTarget:0}),ck=yn(ZV),JV=f({},Nr,{animationName:0,elapsedTime:0,pseudoElement:0}),eK=yn(JV),tK=f({},Nr,{clipboardData:function(h){return"clipboardData"in h?h.clipboardData:window.clipboardData}}),nK=yn(tK),rK=f({},Nr,{data:0}),DT=yn(rK),iK={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},sK={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},aK={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function oK(h){var m=this.nativeEvent;return m.getModifierState?m.getModifierState(h):(h=aK[h])?!!m[h]:!1}function uk(){return oK}var lK=f({},xi,{key:function(h){if(h.key){var m=iK[h.key]||h.key;if(m!=="Unidentified")return m}return h.type==="keypress"?(h=wn(h),h===13?"Enter":String.fromCharCode(h)):h.type==="keydown"||h.type==="keyup"?sK[h.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:uk,charCode:function(h){return h.type==="keypress"?wn(h):0},keyCode:function(h){return h.type==="keydown"||h.type==="keyup"?h.keyCode:0},which:function(h){return h.type==="keypress"?wn(h):h.type==="keydown"||h.type==="keyup"?h.keyCode:0}}),cK=yn(lK),uK=f({},Bv,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),PT=yn(uK),dK=f({},xi,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:uk}),hK=yn(dK),fK=f({},Nr,{propertyName:0,elapsedTime:0,pseudoElement:0}),pK=yn(fK),mK=f({},Bv,{deltaX:function(h){return"deltaX"in h?h.deltaX:"wheelDeltaX"in h?-h.wheelDeltaX:0},deltaY:function(h){return"deltaY"in h?h.deltaY:"wheelDeltaY"in h?-h.wheelDeltaY:"wheelDelta"in h?-h.wheelDelta:0},deltaZ:0,deltaMode:0}),gK=yn(mK),vK=f({},Nr,{newState:0,oldState:0}),yK=yn(vK),_K=[9,13,27,32],dk=at&&"CompositionEvent"in window,sp=null;at&&"documentMode"in document&&(sp=document.documentMode);var xK=at&&"TextEvent"in window&&!sp,LT=at&&(!dk||sp&&8<sp&&11>=sp),IT=" ",BT=!1;function zT(h,m){switch(h){case"keyup":return _K.indexOf(m.keyCode)!==-1;case"keydown":return m.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function $T(h){return h=h.detail,typeof h=="object"&&"data"in h?h.data:null}var Wd=!1;function bK(h,m){switch(h){case"compositionend":return $T(m);case"keypress":return m.which!==32?null:(BT=!0,IT);case"textInput":return h=m.data,h===IT&&BT?null:h;default:return null}}function kK(h,m){if(Wd)return h==="compositionend"||!dk&&zT(h,m)?(h=Ht(),rn=An=dn=null,Wd=!1,h):null;switch(h){case"paste":return null;case"keypress":if(!(m.ctrlKey||m.altKey||m.metaKey)||m.ctrlKey&&m.altKey){if(m.char&&1<m.char.length)return m.char;if(m.which)return String.fromCharCode(m.which)}return null;case"compositionend":return LT&&m.locale!=="ko"?null:m.data;default:return null}}var wK={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function FT(h){var m=h&&h.nodeName&&h.nodeName.toLowerCase();return m==="input"?!!wK[h.type]:m==="textarea"}function HT(h,m,y,k){Ra?ho?ho.push(k):ho=[k]:Ra=k,m=Ny(m,"onChange"),0<m.length&&(y=new Gn("onChange","change",null,y,k),h.push({event:y,listeners:m}))}var ap=null,op=null;function SK(h){S5(h,0)}function zv(h){var m=Ki(h);if(co(m))return h}function WT(h,m){if(h==="change")return m}var qT=!1;if(at){var hk;if(at){var fk="oninput"in document;if(!fk){var UT=document.createElement("div");UT.setAttribute("oninput","return;"),fk=typeof UT.oninput=="function"}hk=fk}else hk=!1;qT=hk&&(!document.documentMode||9<document.documentMode)}function VT(){ap&&(ap.detachEvent("onpropertychange",KT),op=ap=null)}function KT(h){if(h.propertyName==="value"&&zv(op)){var m=[];HT(m,op,h,Hd(h)),Fe(SK,m)}}function CK(h,m,y){h==="focusin"?(VT(),ap=m,op=y,ap.attachEvent("onpropertychange",KT)):h==="focusout"&&VT()}function jK(h){if(h==="selectionchange"||h==="keyup"||h==="keydown")return zv(op)}function NK(h,m){if(h==="click")return zv(m)}function EK(h,m){if(h==="input"||h==="change")return zv(m)}function AK(h,m){return h===m&&(h!==0||1/h===1/m)||h!==h&&m!==m}var Ps=typeof Object.is=="function"?Object.is:AK;function lp(h,m){if(Ps(h,m))return!0;if(typeof h!="object"||h===null||typeof m!="object"||m===null)return!1;var y=Object.keys(h),k=Object.keys(m);if(y.length!==k.length)return!1;for(k=0;k<y.length;k++){var j=y[k];if(!Ue.call(m,j)||!Ps(h[j],m[j]))return!1}return!0}function YT(h){for(;h&&h.firstChild;)h=h.firstChild;return h}function GT(h,m){var y=YT(h);h=0;for(var k;y;){if(y.nodeType===3){if(k=h+y.textContent.length,h<=m&&k>=m)return{node:y,offset:m-h};h=k}e:{for(;y;){if(y.nextSibling){y=y.nextSibling;break e}y=y.parentNode}y=void 0}y=YT(y)}}function XT(h,m){return h&&m?h===m?!0:h&&h.nodeType===3?!1:m&&m.nodeType===3?XT(h,m.parentNode):"contains"in h?h.contains(m):h.compareDocumentPosition?!!(h.compareDocumentPosition(m)&16):!1:!1}function QT(h){h=h!=null&&h.ownerDocument!=null&&h.ownerDocument.defaultView!=null?h.ownerDocument.defaultView:window;for(var m=ce(h.document);m instanceof h.HTMLIFrameElement;){try{var y=typeof m.contentWindow.location.href=="string"}catch{y=!1}if(y)h=m.contentWindow;else break;m=ce(h.document)}return m}function pk(h){var m=h&&h.nodeName&&h.nodeName.toLowerCase();return m&&(m==="input"&&(h.type==="text"||h.type==="search"||h.type==="tel"||h.type==="url"||h.type==="password")||m==="textarea"||h.contentEditable==="true")}var TK=at&&"documentMode"in document&&11>=document.documentMode,qd=null,mk=null,cp=null,gk=!1;function ZT(h,m,y){var k=y.window===y?y.document:y.nodeType===9?y:y.ownerDocument;gk||qd==null||qd!==ce(k)||(k=qd,"selectionStart"in k&&pk(k)?k={start:k.selectionStart,end:k.selectionEnd}:(k=(k.ownerDocument&&k.ownerDocument.defaultView||window).getSelection(),k={anchorNode:k.anchorNode,anchorOffset:k.anchorOffset,focusNode:k.focusNode,focusOffset:k.focusOffset}),cp&&lp(cp,k)||(cp=k,k=Ny(mk,"onSelect"),0<k.length&&(m=new Gn("onSelect","select",null,m,y),h.push({event:m,listeners:k}),m.target=qd)))}function wu(h,m){var y={};return y[h.toLowerCase()]=m.toLowerCase(),y["Webkit"+h]="webkit"+m,y["Moz"+h]="moz"+m,y}var Ud={animationend:wu("Animation","AnimationEnd"),animationiteration:wu("Animation","AnimationIteration"),animationstart:wu("Animation","AnimationStart"),transitionrun:wu("Transition","TransitionRun"),transitionstart:wu("Transition","TransitionStart"),transitioncancel:wu("Transition","TransitionCancel"),transitionend:wu("Transition","TransitionEnd")},vk={},JT={};at&&(JT=document.createElement("div").style,"AnimationEvent"in window||(delete Ud.animationend.animation,delete Ud.animationiteration.animation,delete Ud.animationstart.animation),"TransitionEvent"in window||delete Ud.transitionend.transition);function Su(h){if(vk[h])return vk[h];if(!Ud[h])return h;var m=Ud[h],y;for(y in m)if(m.hasOwnProperty(y)&&y in JT)return vk[h]=m[y];return h}var eM=Su("animationend"),tM=Su("animationiteration"),nM=Su("animationstart"),MK=Su("transitionrun"),RK=Su("transitionstart"),OK=Su("transitioncancel"),rM=Su("transitionend"),iM=new Map,yk="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");yk.push("scrollEnd");function Oa(h,m){iM.set(h,m),Rs(m,[h])}var $v=typeof reportError=="function"?reportError:function(h){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var m=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof h=="object"&&h!==null&&typeof h.message=="string"?String(h.message):String(h),error:h});if(!window.dispatchEvent(m))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",h);return}console.error(h)},sa=[],Vd=0,_k=0;function Fv(){for(var h=Vd,m=_k=Vd=0;m<h;){var y=sa[m];sa[m++]=null;var k=sa[m];sa[m++]=null;var j=sa[m];sa[m++]=null;var M=sa[m];if(sa[m++]=null,k!==null&&j!==null){var G=k.pending;G===null?j.next=j:(j.next=G.next,G.next=j),k.pending=j}M!==0&&sM(y,j,M)}}function Hv(h,m,y,k){sa[Vd++]=h,sa[Vd++]=m,sa[Vd++]=y,sa[Vd++]=k,_k|=k,h.lanes|=k,h=h.alternate,h!==null&&(h.lanes|=k)}function xk(h,m,y,k){return Hv(h,m,y,k),Wv(h)}function Cu(h,m){return Hv(h,null,null,m),Wv(h)}function sM(h,m,y){h.lanes|=y;var k=h.alternate;k!==null&&(k.lanes|=y);for(var j=!1,M=h.return;M!==null;)M.childLanes|=y,k=M.alternate,k!==null&&(k.childLanes|=y),M.tag===22&&(h=M.stateNode,h===null||h._visibility&1||(j=!0)),h=M,M=M.return;return h.tag===3?(M=h.stateNode,j&&m!==null&&(j=31-ee(y),h=M.hiddenUpdates,k=h[j],k===null?h[j]=[m]:k.push(m),m.lane=y|536870912),M):null}function Wv(h){if(50<Mp)throw Mp=0,A1=null,Error(i(185));for(var m=h.return;m!==null;)h=m,m=h.return;return h.tag===3?h.stateNode:null}var Kd={};function DK(h,m,y,k){this.tag=h,this.key=y,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=m,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=k,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ls(h,m,y,k){return new DK(h,m,y,k)}function bk(h){return h=h.prototype,!(!h||!h.isReactComponent)}function ol(h,m){var y=h.alternate;return y===null?(y=Ls(h.tag,m,h.key,h.mode),y.elementType=h.elementType,y.type=h.type,y.stateNode=h.stateNode,y.alternate=h,h.alternate=y):(y.pendingProps=m,y.type=h.type,y.flags=0,y.subtreeFlags=0,y.deletions=null),y.flags=h.flags&65011712,y.childLanes=h.childLanes,y.lanes=h.lanes,y.child=h.child,y.memoizedProps=h.memoizedProps,y.memoizedState=h.memoizedState,y.updateQueue=h.updateQueue,m=h.dependencies,y.dependencies=m===null?null:{lanes:m.lanes,firstContext:m.firstContext},y.sibling=h.sibling,y.index=h.index,y.ref=h.ref,y.refCleanup=h.refCleanup,y}function aM(h,m){h.flags&=65011714;var y=h.alternate;return y===null?(h.childLanes=0,h.lanes=m,h.child=null,h.subtreeFlags=0,h.memoizedProps=null,h.memoizedState=null,h.updateQueue=null,h.dependencies=null,h.stateNode=null):(h.childLanes=y.childLanes,h.lanes=y.lanes,h.child=y.child,h.subtreeFlags=0,h.deletions=null,h.memoizedProps=y.memoizedProps,h.memoizedState=y.memoizedState,h.updateQueue=y.updateQueue,h.type=y.type,m=y.dependencies,h.dependencies=m===null?null:{lanes:m.lanes,firstContext:m.firstContext}),h}function qv(h,m,y,k,j,M){var G=0;if(k=h,typeof h=="function")bk(h)&&(G=1);else if(typeof h=="string")G=zY(h,y,ie.current)?26:h==="html"||h==="head"||h==="body"?27:5;else e:switch(h){case B:return h=Ls(31,y,m,j),h.elementType=B,h.lanes=M,h;case v:return ju(y.children,j,M,m);case S:G=8,j|=24;break;case w:return h=Ls(12,y,m,j|2),h.elementType=w,h.lanes=M,h;case A:return h=Ls(13,y,m,j),h.elementType=A,h.lanes=M,h;case E:return h=Ls(19,y,m,j),h.elementType=E,h.lanes=M,h;default:if(typeof h=="object"&&h!==null)switch(h.$$typeof){case C:G=10;break e;case N:G=9;break e;case T:G=11;break e;case D:G=14;break e;case F:G=16,k=null;break e}G=29,y=Error(i(130,h===null?"null":typeof h,"")),k=null}return m=Ls(G,y,m,j),m.elementType=h,m.type=k,m.lanes=M,m}function ju(h,m,y,k){return h=Ls(7,h,k,m),h.lanes=y,h}function kk(h,m,y){return h=Ls(6,h,null,m),h.lanes=y,h}function oM(h){var m=Ls(18,null,null,0);return m.stateNode=h,m}function wk(h,m,y){return m=Ls(4,h.children!==null?h.children:[],h.key,m),m.lanes=y,m.stateNode={containerInfo:h.containerInfo,pendingChildren:null,implementation:h.implementation},m}var lM=new WeakMap;function aa(h,m){if(typeof h=="object"&&h!==null){var y=lM.get(h);return y!==void 0?y:(m={value:h,source:m,stack:ge(m)},lM.set(h,m),m)}return{value:h,source:m,stack:ge(m)}}var Yd=[],Gd=0,Uv=null,up=0,oa=[],la=0,nc=null,mo=1,go="";function ll(h,m){Yd[Gd++]=up,Yd[Gd++]=Uv,Uv=h,up=m}function cM(h,m,y){oa[la++]=mo,oa[la++]=go,oa[la++]=nc,nc=h;var k=mo;h=go;var j=32-ee(k)-1;k&=~(1<<j),y+=1;var M=32-ee(m)+j;if(30<M){var G=j-j%5;M=(k&(1<<G)-1).toString(32),k>>=G,j-=G,mo=1<<32-ee(m)+j|y<<j|k,go=M+h}else mo=1<<M|y<<j|k,go=h}function Sk(h){h.return!==null&&(ll(h,1),cM(h,1,0))}function Ck(h){for(;h===Uv;)Uv=Yd[--Gd],Yd[Gd]=null,up=Yd[--Gd],Yd[Gd]=null;for(;h===nc;)nc=oa[--la],oa[la]=null,go=oa[--la],oa[la]=null,mo=oa[--la],oa[la]=null}function uM(h,m){oa[la++]=mo,oa[la++]=go,oa[la++]=nc,mo=m.id,go=m.overflow,nc=h}var bi=null,ir=null,_n=!1,rc=null,ca=!1,jk=Error(i(519));function ic(h){var m=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw dp(aa(m,h)),jk}function dM(h){var m=h.stateNode,y=h.type,k=h.memoizedProps;switch(m[L]=h,m[Qe]=k,y){case"dialog":pn("cancel",m),pn("close",m);break;case"iframe":case"object":case"embed":pn("load",m);break;case"video":case"audio":for(y=0;y<Op.length;y++)pn(Op[y],m);break;case"source":pn("error",m);break;case"img":case"image":case"link":pn("error",m),pn("load",m);break;case"details":pn("toggle",m);break;case"input":pn("invalid",m),Yn(m,k.value,k.defaultValue,k.checked,k.defaultChecked,k.type,k.name,!0);break;case"select":pn("invalid",m);break;case"textarea":pn("invalid",m),$d(m,k.value,k.defaultValue,k.children)}y=k.children,typeof y!="string"&&typeof y!="number"&&typeof y!="bigint"||m.textContent===""+y||k.suppressHydrationWarning===!0||E5(m.textContent,y)?(k.popover!=null&&(pn("beforetoggle",m),pn("toggle",m)),k.onScroll!=null&&pn("scroll",m),k.onScrollEnd!=null&&pn("scrollend",m),k.onClick!=null&&(m.onclick=ia),m=!0):m=!1,m||ic(h,!0)}function hM(h){for(bi=h.return;bi;)switch(bi.tag){case 5:case 31:case 13:ca=!1;return;case 27:case 3:ca=!0;return;default:bi=bi.return}}function Xd(h){if(h!==bi)return!1;if(!_n)return hM(h),_n=!0,!1;var m=h.tag,y;if((y=m!==3&&m!==27)&&((y=m===5)&&(y=h.type,y=!(y!=="form"&&y!=="button")||q1(h.type,h.memoizedProps)),y=!y),y&&ir&&ic(h),hM(h),m===13){if(h=h.memoizedState,h=h!==null?h.dehydrated:null,!h)throw Error(i(317));ir=I5(h)}else if(m===31){if(h=h.memoizedState,h=h!==null?h.dehydrated:null,!h)throw Error(i(317));ir=I5(h)}else m===27?(m=ir,yc(h.type)?(h=G1,G1=null,ir=h):ir=m):ir=bi?da(h.stateNode.nextSibling):null;return!0}function Nu(){ir=bi=null,_n=!1}function Nk(){var h=rc;return h!==null&&(ps===null?ps=h:ps.push.apply(ps,h),rc=null),h}function dp(h){rc===null?rc=[h]:rc.push(h)}var Ek=R(null),Eu=null,cl=null;function sc(h,m,y){V(Ek,m._currentValue),m._currentValue=y}function ul(h){h._currentValue=Ek.current,U(Ek)}function Ak(h,m,y){for(;h!==null;){var k=h.alternate;if((h.childLanes&m)!==m?(h.childLanes|=m,k!==null&&(k.childLanes|=m)):k!==null&&(k.childLanes&m)!==m&&(k.childLanes|=m),h===y)break;h=h.return}}function Tk(h,m,y,k){var j=h.child;for(j!==null&&(j.return=h);j!==null;){var M=j.dependencies;if(M!==null){var G=j.child;M=M.firstContext;e:for(;M!==null;){var ne=M;M=j;for(var he=0;he<m.length;he++)if(ne.context===m[he]){M.lanes|=y,ne=M.alternate,ne!==null&&(ne.lanes|=y),Ak(M.return,y,h),k||(G=null);break e}M=ne.next}}else if(j.tag===18){if(G=j.return,G===null)throw Error(i(341));G.lanes|=y,M=G.alternate,M!==null&&(M.lanes|=y),Ak(G,y,h),G=null}else G=j.child;if(G!==null)G.return=j;else for(G=j;G!==null;){if(G===h){G=null;break}if(j=G.sibling,j!==null){j.return=G.return,G=j;break}G=G.return}j=G}}function Qd(h,m,y,k){h=null;for(var j=m,M=!1;j!==null;){if(!M){if((j.flags&524288)!==0)M=!0;else if((j.flags&262144)!==0)break}if(j.tag===10){var G=j.alternate;if(G===null)throw Error(i(387));if(G=G.memoizedProps,G!==null){var ne=j.type;Ps(j.pendingProps.value,G.value)||(h!==null?h.push(ne):h=[ne])}}else if(j===se.current){if(G=j.alternate,G===null)throw Error(i(387));G.memoizedState.memoizedState!==j.memoizedState.memoizedState&&(h!==null?h.push(Bp):h=[Bp])}j=j.return}h!==null&&Tk(m,h,y,k),m.flags|=262144}function Vv(h){for(h=h.firstContext;h!==null;){if(!Ps(h.context._currentValue,h.memoizedValue))return!0;h=h.next}return!1}function Au(h){Eu=h,cl=null,h=h.dependencies,h!==null&&(h.firstContext=null)}function ki(h){return fM(Eu,h)}function Kv(h,m){return Eu===null&&Au(h),fM(h,m)}function fM(h,m){var y=m._currentValue;if(m={context:m,memoizedValue:y,next:null},cl===null){if(h===null)throw Error(i(308));cl=m,h.dependencies={lanes:0,firstContext:m},h.flags|=524288}else cl=cl.next=m;return y}var PK=typeof AbortController<"u"?AbortController:function(){var h=[],m=this.signal={aborted:!1,addEventListener:function(y,k){h.push(k)}};this.abort=function(){m.aborted=!0,h.forEach(function(y){return y()})}},LK=e.unstable_scheduleCallback,IK=e.unstable_NormalPriority,Hr={$$typeof:C,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Mk(){return{controller:new PK,data:new Map,refCount:0}}function hp(h){h.refCount--,h.refCount===0&&LK(IK,function(){h.controller.abort()})}var fp=null,Rk=0,Zd=0,Jd=null;function BK(h,m){if(fp===null){var y=fp=[];Rk=0,Zd=P1(),Jd={status:"pending",value:void 0,then:function(k){y.push(k)}}}return Rk++,m.then(pM,pM),m}function pM(){if(--Rk===0&&fp!==null){Jd!==null&&(Jd.status="fulfilled");var h=fp;fp=null,Zd=0,Jd=null;for(var m=0;m<h.length;m++)(0,h[m])()}}function zK(h,m){var y=[],k={status:"pending",value:null,reason:null,then:function(j){y.push(j)}};return h.then(function(){k.status="fulfilled",k.value=m;for(var j=0;j<y.length;j++)(0,y[j])(m)},function(j){for(k.status="rejected",k.reason=j,j=0;j<y.length;j++)(0,y[j])(void 0)}),k}var mM=I.S;I.S=function(h,m){ZR=Tt(),typeof m=="object"&&m!==null&&typeof m.then=="function"&&BK(h,m),mM!==null&&mM(h,m)};var Tu=R(null);function Ok(){var h=Tu.current;return h!==null?h:Xn.pooledCache}function Yv(h,m){m===null?V(Tu,Tu.current):V(Tu,m.pool)}function gM(){var h=Ok();return h===null?null:{parent:Hr._currentValue,pool:h}}var eh=Error(i(460)),Dk=Error(i(474)),Gv=Error(i(542)),Xv={then:function(){}};function vM(h){return h=h.status,h==="fulfilled"||h==="rejected"}function yM(h,m,y){switch(y=h[y],y===void 0?h.push(m):y!==m&&(m.then(ia,ia),m=y),m.status){case"fulfilled":return m.value;case"rejected":throw h=m.reason,xM(h),h;default:if(typeof m.status=="string")m.then(ia,ia);else{if(h=Xn,h!==null&&100<h.shellSuspendCounter)throw Error(i(482));h=m,h.status="pending",h.then(function(k){if(m.status==="pending"){var j=m;j.status="fulfilled",j.value=k}},function(k){if(m.status==="pending"){var j=m;j.status="rejected",j.reason=k}})}switch(m.status){case"fulfilled":return m.value;case"rejected":throw h=m.reason,xM(h),h}throw Ru=m,eh}}function Mu(h){try{var m=h._init;return m(h._payload)}catch(y){throw y!==null&&typeof y=="object"&&typeof y.then=="function"?(Ru=y,eh):y}}var Ru=null;function _M(){if(Ru===null)throw Error(i(459));var h=Ru;return Ru=null,h}function xM(h){if(h===eh||h===Gv)throw Error(i(483))}var th=null,pp=0;function Qv(h){var m=pp;return pp+=1,th===null&&(th=[]),yM(th,h,m)}function mp(h,m){m=m.props.ref,h.ref=m!==void 0?m:null}function Zv(h,m){throw m.$$typeof===g?Error(i(525)):(h=Object.prototype.toString.call(m),Error(i(31,h==="[object Object]"?"object with keys {"+Object.keys(m).join(", ")+"}":h)))}function bM(h){function m(Ae,be){if(h){var Oe=Ae.deletions;Oe===null?(Ae.deletions=[be],Ae.flags|=16):Oe.push(be)}}function y(Ae,be){if(!h)return null;for(;be!==null;)m(Ae,be),be=be.sibling;return null}function k(Ae){for(var be=new Map;Ae!==null;)Ae.key!==null?be.set(Ae.key,Ae):be.set(Ae.index,Ae),Ae=Ae.sibling;return be}function j(Ae,be){return Ae=ol(Ae,be),Ae.index=0,Ae.sibling=null,Ae}function M(Ae,be,Oe){return Ae.index=Oe,h?(Oe=Ae.alternate,Oe!==null?(Oe=Oe.index,Oe<be?(Ae.flags|=67108866,be):Oe):(Ae.flags|=67108866,be)):(Ae.flags|=1048576,be)}function G(Ae){return h&&Ae.alternate===null&&(Ae.flags|=67108866),Ae}function ne(Ae,be,Oe,Je){return be===null||be.tag!==6?(be=kk(Oe,Ae.mode,Je),be.return=Ae,be):(be=j(be,Oe),be.return=Ae,be)}function he(Ae,be,Oe,Je){var $t=Oe.type;return $t===v?Ge(Ae,be,Oe.props.children,Je,Oe.key):be!==null&&(be.elementType===$t||typeof $t=="object"&&$t!==null&&$t.$$typeof===F&&Mu($t)===be.type)?(be=j(be,Oe.props),mp(be,Oe),be.return=Ae,be):(be=qv(Oe.type,Oe.key,Oe.props,null,Ae.mode,Je),mp(be,Oe),be.return=Ae,be)}function De(Ae,be,Oe,Je){return be===null||be.tag!==4||be.stateNode.containerInfo!==Oe.containerInfo||be.stateNode.implementation!==Oe.implementation?(be=wk(Oe,Ae.mode,Je),be.return=Ae,be):(be=j(be,Oe.children||[]),be.return=Ae,be)}function Ge(Ae,be,Oe,Je,$t){return be===null||be.tag!==7?(be=ju(Oe,Ae.mode,Je,$t),be.return=Ae,be):(be=j(be,Oe),be.return=Ae,be)}function tt(Ae,be,Oe){if(typeof be=="string"&&be!==""||typeof be=="number"||typeof be=="bigint")return be=kk(""+be,Ae.mode,Oe),be.return=Ae,be;if(typeof be=="object"&&be!==null){switch(be.$$typeof){case _:return Oe=qv(be.type,be.key,be.props,null,Ae.mode,Oe),mp(Oe,be),Oe.return=Ae,Oe;case x:return be=wk(be,Ae.mode,Oe),be.return=Ae,be;case F:return be=Mu(be),tt(Ae,be,Oe)}if(q(be)||z(be))return be=ju(be,Ae.mode,Oe,null),be.return=Ae,be;if(typeof be.then=="function")return tt(Ae,Qv(be),Oe);if(be.$$typeof===C)return tt(Ae,Kv(Ae,be),Oe);Zv(Ae,be)}return null}function ze(Ae,be,Oe,Je){var $t=be!==null?be.key:null;if(typeof Oe=="string"&&Oe!==""||typeof Oe=="number"||typeof Oe=="bigint")return $t!==null?null:ne(Ae,be,""+Oe,Je);if(typeof Oe=="object"&&Oe!==null){switch(Oe.$$typeof){case _:return Oe.key===$t?he(Ae,be,Oe,Je):null;case x:return Oe.key===$t?De(Ae,be,Oe,Je):null;case F:return Oe=Mu(Oe),ze(Ae,be,Oe,Je)}if(q(Oe)||z(Oe))return $t!==null?null:Ge(Ae,be,Oe,Je,null);if(typeof Oe.then=="function")return ze(Ae,be,Qv(Oe),Je);if(Oe.$$typeof===C)return ze(Ae,be,Kv(Ae,Oe),Je);Zv(Ae,Oe)}return null}function He(Ae,be,Oe,Je,$t){if(typeof Je=="string"&&Je!==""||typeof Je=="number"||typeof Je=="bigint")return Ae=Ae.get(Oe)||null,ne(be,Ae,""+Je,$t);if(typeof Je=="object"&&Je!==null){switch(Je.$$typeof){case _:return Ae=Ae.get(Je.key===null?Oe:Je.key)||null,he(be,Ae,Je,$t);case x:return Ae=Ae.get(Je.key===null?Oe:Je.key)||null,De(be,Ae,Je,$t);case F:return Je=Mu(Je),He(Ae,be,Oe,Je,$t)}if(q(Je)||z(Je))return Ae=Ae.get(Oe)||null,Ge(be,Ae,Je,$t,null);if(typeof Je.then=="function")return He(Ae,be,Oe,Qv(Je),$t);if(Je.$$typeof===C)return He(Ae,be,Oe,Kv(be,Je),$t);Zv(be,Je)}return null}function Rt(Ae,be,Oe,Je){for(var $t=null,Tn=null,Pt=be,en=be=0,vn=null;Pt!==null&&en<Oe.length;en++){Pt.index>en?(vn=Pt,Pt=null):vn=Pt.sibling;var Mn=ze(Ae,Pt,Oe[en],Je);if(Mn===null){Pt===null&&(Pt=vn);break}h&&Pt&&Mn.alternate===null&&m(Ae,Pt),be=M(Mn,be,en),Tn===null?$t=Mn:Tn.sibling=Mn,Tn=Mn,Pt=vn}if(en===Oe.length)return y(Ae,Pt),_n&&ll(Ae,en),$t;if(Pt===null){for(;en<Oe.length;en++)Pt=tt(Ae,Oe[en],Je),Pt!==null&&(be=M(Pt,be,en),Tn===null?$t=Pt:Tn.sibling=Pt,Tn=Pt);return _n&&ll(Ae,en),$t}for(Pt=k(Pt);en<Oe.length;en++)vn=He(Pt,Ae,en,Oe[en],Je),vn!==null&&(h&&vn.alternate!==null&&Pt.delete(vn.key===null?en:vn.key),be=M(vn,be,en),Tn===null?$t=vn:Tn.sibling=vn,Tn=vn);return h&&Pt.forEach(function(wc){return m(Ae,wc)}),_n&&ll(Ae,en),$t}function Vt(Ae,be,Oe,Je){if(Oe==null)throw Error(i(151));for(var $t=null,Tn=null,Pt=be,en=be=0,vn=null,Mn=Oe.next();Pt!==null&&!Mn.done;en++,Mn=Oe.next()){Pt.index>en?(vn=Pt,Pt=null):vn=Pt.sibling;var wc=ze(Ae,Pt,Mn.value,Je);if(wc===null){Pt===null&&(Pt=vn);break}h&&Pt&&wc.alternate===null&&m(Ae,Pt),be=M(wc,be,en),Tn===null?$t=wc:Tn.sibling=wc,Tn=wc,Pt=vn}if(Mn.done)return y(Ae,Pt),_n&&ll(Ae,en),$t;if(Pt===null){for(;!Mn.done;en++,Mn=Oe.next())Mn=tt(Ae,Mn.value,Je),Mn!==null&&(be=M(Mn,be,en),Tn===null?$t=Mn:Tn.sibling=Mn,Tn=Mn);return _n&&ll(Ae,en),$t}for(Pt=k(Pt);!Mn.done;en++,Mn=Oe.next())Mn=He(Pt,Ae,en,Mn.value,Je),Mn!==null&&(h&&Mn.alternate!==null&&Pt.delete(Mn.key===null?en:Mn.key),be=M(Mn,be,en),Tn===null?$t=Mn:Tn.sibling=Mn,Tn=Mn);return h&&Pt.forEach(function(XY){return m(Ae,XY)}),_n&&ll(Ae,en),$t}function Wn(Ae,be,Oe,Je){if(typeof Oe=="object"&&Oe!==null&&Oe.type===v&&Oe.key===null&&(Oe=Oe.props.children),typeof Oe=="object"&&Oe!==null){switch(Oe.$$typeof){case _:e:{for(var $t=Oe.key;be!==null;){if(be.key===$t){if($t=Oe.type,$t===v){if(be.tag===7){y(Ae,be.sibling),Je=j(be,Oe.props.children),Je.return=Ae,Ae=Je;break e}}else if(be.elementType===$t||typeof $t=="object"&&$t!==null&&$t.$$typeof===F&&Mu($t)===be.type){y(Ae,be.sibling),Je=j(be,Oe.props),mp(Je,Oe),Je.return=Ae,Ae=Je;break e}y(Ae,be);break}else m(Ae,be);be=be.sibling}Oe.type===v?(Je=ju(Oe.props.children,Ae.mode,Je,Oe.key),Je.return=Ae,Ae=Je):(Je=qv(Oe.type,Oe.key,Oe.props,null,Ae.mode,Je),mp(Je,Oe),Je.return=Ae,Ae=Je)}return G(Ae);case x:e:{for($t=Oe.key;be!==null;){if(be.key===$t)if(be.tag===4&&be.stateNode.containerInfo===Oe.containerInfo&&be.stateNode.implementation===Oe.implementation){y(Ae,be.sibling),Je=j(be,Oe.children||[]),Je.return=Ae,Ae=Je;break e}else{y(Ae,be);break}else m(Ae,be);be=be.sibling}Je=wk(Oe,Ae.mode,Je),Je.return=Ae,Ae=Je}return G(Ae);case F:return Oe=Mu(Oe),Wn(Ae,be,Oe,Je)}if(q(Oe))return Rt(Ae,be,Oe,Je);if(z(Oe)){if($t=z(Oe),typeof $t!="function")throw Error(i(150));return Oe=$t.call(Oe),Vt(Ae,be,Oe,Je)}if(typeof Oe.then=="function")return Wn(Ae,be,Qv(Oe),Je);if(Oe.$$typeof===C)return Wn(Ae,be,Kv(Ae,Oe),Je);Zv(Ae,Oe)}return typeof Oe=="string"&&Oe!==""||typeof Oe=="number"||typeof Oe=="bigint"?(Oe=""+Oe,be!==null&&be.tag===6?(y(Ae,be.sibling),Je=j(be,Oe),Je.return=Ae,Ae=Je):(y(Ae,be),Je=kk(Oe,Ae.mode,Je),Je.return=Ae,Ae=Je),G(Ae)):y(Ae,be)}return function(Ae,be,Oe,Je){try{pp=0;var $t=Wn(Ae,be,Oe,Je);return th=null,$t}catch(Pt){if(Pt===eh||Pt===Gv)throw Pt;var Tn=Ls(29,Pt,null,Ae.mode);return Tn.lanes=Je,Tn.return=Ae,Tn}finally{}}}var Ou=bM(!0),kM=bM(!1),ac=!1;function Pk(h){h.updateQueue={baseState:h.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Lk(h,m){h=h.updateQueue,m.updateQueue===h&&(m.updateQueue={baseState:h.baseState,firstBaseUpdate:h.firstBaseUpdate,lastBaseUpdate:h.lastBaseUpdate,shared:h.shared,callbacks:null})}function oc(h){return{lane:h,tag:0,payload:null,callback:null,next:null}}function lc(h,m,y){var k=h.updateQueue;if(k===null)return null;if(k=k.shared,(Dn&2)!==0){var j=k.pending;return j===null?m.next=m:(m.next=j.next,j.next=m),k.pending=m,m=Wv(h),sM(h,null,y),m}return Hv(h,k,m,y),Wv(h)}function gp(h,m,y){if(m=m.updateQueue,m!==null&&(m=m.shared,(y&4194048)!==0)){var k=m.lanes;k&=h.pendingLanes,y|=k,m.lanes=y,sn(h,y)}}function Ik(h,m){var y=h.updateQueue,k=h.alternate;if(k!==null&&(k=k.updateQueue,y===k)){var j=null,M=null;if(y=y.firstBaseUpdate,y!==null){do{var G={lane:y.lane,tag:y.tag,payload:y.payload,callback:null,next:null};M===null?j=M=G:M=M.next=G,y=y.next}while(y!==null);M===null?j=M=m:M=M.next=m}else j=M=m;y={baseState:k.baseState,firstBaseUpdate:j,lastBaseUpdate:M,shared:k.shared,callbacks:k.callbacks},h.updateQueue=y;return}h=y.lastBaseUpdate,h===null?y.firstBaseUpdate=m:h.next=m,y.lastBaseUpdate=m}var Bk=!1;function vp(){if(Bk){var h=Jd;if(h!==null)throw h}}function yp(h,m,y,k){Bk=!1;var j=h.updateQueue;ac=!1;var M=j.firstBaseUpdate,G=j.lastBaseUpdate,ne=j.shared.pending;if(ne!==null){j.shared.pending=null;var he=ne,De=he.next;he.next=null,G===null?M=De:G.next=De,G=he;var Ge=h.alternate;Ge!==null&&(Ge=Ge.updateQueue,ne=Ge.lastBaseUpdate,ne!==G&&(ne===null?Ge.firstBaseUpdate=De:ne.next=De,Ge.lastBaseUpdate=he))}if(M!==null){var tt=j.baseState;G=0,Ge=De=he=null,ne=M;do{var ze=ne.lane&-536870913,He=ze!==ne.lane;if(He?(gn&ze)===ze:(k&ze)===ze){ze!==0&&ze===Zd&&(Bk=!0),Ge!==null&&(Ge=Ge.next={lane:0,tag:ne.tag,payload:ne.payload,callback:null,next:null});e:{var Rt=h,Vt=ne;ze=m;var Wn=y;switch(Vt.tag){case 1:if(Rt=Vt.payload,typeof Rt=="function"){tt=Rt.call(Wn,tt,ze);break e}tt=Rt;break e;case 3:Rt.flags=Rt.flags&-65537|128;case 0:if(Rt=Vt.payload,ze=typeof Rt=="function"?Rt.call(Wn,tt,ze):Rt,ze==null)break e;tt=f({},tt,ze);break e;case 2:ac=!0}}ze=ne.callback,ze!==null&&(h.flags|=64,He&&(h.flags|=8192),He=j.callbacks,He===null?j.callbacks=[ze]:He.push(ze))}else He={lane:ze,tag:ne.tag,payload:ne.payload,callback:ne.callback,next:null},Ge===null?(De=Ge=He,he=tt):Ge=Ge.next=He,G|=ze;if(ne=ne.next,ne===null){if(ne=j.shared.pending,ne===null)break;He=ne,ne=He.next,He.next=null,j.lastBaseUpdate=He,j.shared.pending=null}}while(!0);Ge===null&&(he=tt),j.baseState=he,j.firstBaseUpdate=De,j.lastBaseUpdate=Ge,M===null&&(j.shared.lanes=0),fc|=G,h.lanes=G,h.memoizedState=tt}}function wM(h,m){if(typeof h!="function")throw Error(i(191,h));h.call(m)}function SM(h,m){var y=h.callbacks;if(y!==null)for(h.callbacks=null,h=0;h<y.length;h++)wM(y[h],m)}var nh=R(null),Jv=R(0);function CM(h,m){h=_l,V(Jv,h),V(nh,m),_l=h|m.baseLanes}function zk(){V(Jv,_l),V(nh,nh.current)}function $k(){_l=Jv.current,U(nh),U(Jv)}var Is=R(null),ua=null;function cc(h){var m=h.alternate;V(Pr,Pr.current&1),V(Is,h),ua===null&&(m===null||nh.current!==null||m.memoizedState!==null)&&(ua=h)}function Fk(h){V(Pr,Pr.current),V(Is,h),ua===null&&(ua=h)}function jM(h){h.tag===22?(V(Pr,Pr.current),V(Is,h),ua===null&&(ua=h)):uc()}function uc(){V(Pr,Pr.current),V(Is,Is.current)}function Bs(h){U(Is),ua===h&&(ua=null),U(Pr)}var Pr=R(0);function ey(h){for(var m=h;m!==null;){if(m.tag===13){var y=m.memoizedState;if(y!==null&&(y=y.dehydrated,y===null||K1(y)||Y1(y)))return m}else if(m.tag===19&&(m.memoizedProps.revealOrder==="forwards"||m.memoizedProps.revealOrder==="backwards"||m.memoizedProps.revealOrder==="unstable_legacy-backwards"||m.memoizedProps.revealOrder==="together")){if((m.flags&128)!==0)return m}else if(m.child!==null){m.child.return=m,m=m.child;continue}if(m===h)break;for(;m.sibling===null;){if(m.return===null||m.return===h)return null;m=m.return}m.sibling.return=m.return,m=m.sibling}return null}var dl=0,Jt=null,Fn=null,Wr=null,ty=!1,rh=!1,Du=!1,ny=0,_p=0,ih=null,$K=0;function Er(){throw Error(i(321))}function Hk(h,m){if(m===null)return!1;for(var y=0;y<m.length&&y<h.length;y++)if(!Ps(h[y],m[y]))return!1;return!0}function Wk(h,m,y,k,j,M){return dl=M,Jt=m,m.memoizedState=null,m.updateQueue=null,m.lanes=0,I.H=h===null||h.memoizedState===null?cR:i1,Du=!1,M=y(k,j),Du=!1,rh&&(M=EM(m,y,k,j)),NM(h),M}function NM(h){I.H=kp;var m=Fn!==null&&Fn.next!==null;if(dl=0,Wr=Fn=Jt=null,ty=!1,_p=0,ih=null,m)throw Error(i(300));h===null||qr||(h=h.dependencies,h!==null&&Vv(h)&&(qr=!0))}function EM(h,m,y,k){Jt=h;var j=0;do{if(rh&&(ih=null),_p=0,rh=!1,25<=j)throw Error(i(301));if(j+=1,Wr=Fn=null,h.updateQueue!=null){var M=h.updateQueue;M.lastEffect=null,M.events=null,M.stores=null,M.memoCache!=null&&(M.memoCache.index=0)}I.H=uR,M=m(y,k)}while(rh);return M}function FK(){var h=I.H,m=h.useState()[0];return m=typeof m.then=="function"?xp(m):m,h=h.useState()[0],(Fn!==null?Fn.memoizedState:null)!==h&&(Jt.flags|=1024),m}function qk(){var h=ny!==0;return ny=0,h}function Uk(h,m,y){m.updateQueue=h.updateQueue,m.flags&=-2053,h.lanes&=~y}function Vk(h){if(ty){for(h=h.memoizedState;h!==null;){var m=h.queue;m!==null&&(m.pending=null),h=h.next}ty=!1}dl=0,Wr=Fn=Jt=null,rh=!1,_p=ny=0,ih=null}function Yi(){var h={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Wr===null?Jt.memoizedState=Wr=h:Wr=Wr.next=h,Wr}function Lr(){if(Fn===null){var h=Jt.alternate;h=h!==null?h.memoizedState:null}else h=Fn.next;var m=Wr===null?Jt.memoizedState:Wr.next;if(m!==null)Wr=m,Fn=h;else{if(h===null)throw Jt.alternate===null?Error(i(467)):Error(i(310));Fn=h,h={memoizedState:Fn.memoizedState,baseState:Fn.baseState,baseQueue:Fn.baseQueue,queue:Fn.queue,next:null},Wr===null?Jt.memoizedState=Wr=h:Wr=Wr.next=h}return Wr}function ry(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function xp(h){var m=_p;return _p+=1,ih===null&&(ih=[]),h=yM(ih,h,m),m=Jt,(Wr===null?m.memoizedState:Wr.next)===null&&(m=m.alternate,I.H=m===null||m.memoizedState===null?cR:i1),h}function iy(h){if(h!==null&&typeof h=="object"){if(typeof h.then=="function")return xp(h);if(h.$$typeof===C)return ki(h)}throw Error(i(438,String(h)))}function Kk(h){var m=null,y=Jt.updateQueue;if(y!==null&&(m=y.memoCache),m==null){var k=Jt.alternate;k!==null&&(k=k.updateQueue,k!==null&&(k=k.memoCache,k!=null&&(m={data:k.data.map(function(j){return j.slice()}),index:0})))}if(m==null&&(m={data:[],index:0}),y===null&&(y=ry(),Jt.updateQueue=y),y.memoCache=m,y=m.data[m.index],y===void 0)for(y=m.data[m.index]=Array(h),k=0;k<h;k++)y[k]=H;return m.index++,y}function hl(h,m){return typeof m=="function"?m(h):m}function sy(h){var m=Lr();return Yk(m,Fn,h)}function Yk(h,m,y){var k=h.queue;if(k===null)throw Error(i(311));k.lastRenderedReducer=y;var j=h.baseQueue,M=k.pending;if(M!==null){if(j!==null){var G=j.next;j.next=M.next,M.next=G}m.baseQueue=j=M,k.pending=null}if(M=h.baseState,j===null)h.memoizedState=M;else{m=j.next;var ne=G=null,he=null,De=m,Ge=!1;do{var tt=De.lane&-536870913;if(tt!==De.lane?(gn&tt)===tt:(dl&tt)===tt){var ze=De.revertLane;if(ze===0)he!==null&&(he=he.next={lane:0,revertLane:0,gesture:null,action:De.action,hasEagerState:De.hasEagerState,eagerState:De.eagerState,next:null}),tt===Zd&&(Ge=!0);else if((dl&ze)===ze){De=De.next,ze===Zd&&(Ge=!0);continue}else tt={lane:0,revertLane:De.revertLane,gesture:null,action:De.action,hasEagerState:De.hasEagerState,eagerState:De.eagerState,next:null},he===null?(ne=he=tt,G=M):he=he.next=tt,Jt.lanes|=ze,fc|=ze;tt=De.action,Du&&y(M,tt),M=De.hasEagerState?De.eagerState:y(M,tt)}else ze={lane:tt,revertLane:De.revertLane,gesture:De.gesture,action:De.action,hasEagerState:De.hasEagerState,eagerState:De.eagerState,next:null},he===null?(ne=he=ze,G=M):he=he.next=ze,Jt.lanes|=tt,fc|=tt;De=De.next}while(De!==null&&De!==m);if(he===null?G=M:he.next=ne,!Ps(M,h.memoizedState)&&(qr=!0,Ge&&(y=Jd,y!==null)))throw y;h.memoizedState=M,h.baseState=G,h.baseQueue=he,k.lastRenderedState=M}return j===null&&(k.lanes=0),[h.memoizedState,k.dispatch]}function Gk(h){var m=Lr(),y=m.queue;if(y===null)throw Error(i(311));y.lastRenderedReducer=h;var k=y.dispatch,j=y.pending,M=m.memoizedState;if(j!==null){y.pending=null;var G=j=j.next;do M=h(M,G.action),G=G.next;while(G!==j);Ps(M,m.memoizedState)||(qr=!0),m.memoizedState=M,m.baseQueue===null&&(m.baseState=M),y.lastRenderedState=M}return[M,k]}function AM(h,m,y){var k=Jt,j=Lr(),M=_n;if(M){if(y===void 0)throw Error(i(407));y=y()}else y=m();var G=!Ps((Fn||j).memoizedState,y);if(G&&(j.memoizedState=y,qr=!0),j=j.queue,Zk(RM.bind(null,k,j,h),[h]),j.getSnapshot!==m||G||Wr!==null&&Wr.memoizedState.tag&1){if(k.flags|=2048,sh(9,{destroy:void 0},MM.bind(null,k,j,y,m),null),Xn===null)throw Error(i(349));M||(dl&127)!==0||TM(k,m,y)}return y}function TM(h,m,y){h.flags|=16384,h={getSnapshot:m,value:y},m=Jt.updateQueue,m===null?(m=ry(),Jt.updateQueue=m,m.stores=[h]):(y=m.stores,y===null?m.stores=[h]:y.push(h))}function MM(h,m,y,k){m.value=y,m.getSnapshot=k,OM(m)&&DM(h)}function RM(h,m,y){return y(function(){OM(m)&&DM(h)})}function OM(h){var m=h.getSnapshot;h=h.value;try{var y=m();return!Ps(h,y)}catch{return!0}}function DM(h){var m=Cu(h,2);m!==null&&ms(m,h,2)}function Xk(h){var m=Yi();if(typeof h=="function"){var y=h;if(h=y(),Du){Pe(!0);try{y()}finally{Pe(!1)}}}return m.memoizedState=m.baseState=h,m.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:hl,lastRenderedState:h},m}function PM(h,m,y,k){return h.baseState=y,Yk(h,Fn,typeof k=="function"?k:hl)}function HK(h,m,y,k,j){if(ly(h))throw Error(i(485));if(h=m.action,h!==null){var M={payload:j,action:h,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(G){M.listeners.push(G)}};I.T!==null?y(!0):M.isTransition=!1,k(M),y=m.pending,y===null?(M.next=m.pending=M,LM(m,M)):(M.next=y.next,m.pending=y.next=M)}}function LM(h,m){var y=m.action,k=m.payload,j=h.state;if(m.isTransition){var M=I.T,G={};I.T=G;try{var ne=y(j,k),he=I.S;he!==null&&he(G,ne),IM(h,m,ne)}catch(De){Qk(h,m,De)}finally{M!==null&&G.types!==null&&(M.types=G.types),I.T=M}}else try{M=y(j,k),IM(h,m,M)}catch(De){Qk(h,m,De)}}function IM(h,m,y){y!==null&&typeof y=="object"&&typeof y.then=="function"?y.then(function(k){BM(h,m,k)},function(k){return Qk(h,m,k)}):BM(h,m,y)}function BM(h,m,y){m.status="fulfilled",m.value=y,zM(m),h.state=y,m=h.pending,m!==null&&(y=m.next,y===m?h.pending=null:(y=y.next,m.next=y,LM(h,y)))}function Qk(h,m,y){var k=h.pending;if(h.pending=null,k!==null){k=k.next;do m.status="rejected",m.reason=y,zM(m),m=m.next;while(m!==k)}h.action=null}function zM(h){h=h.listeners;for(var m=0;m<h.length;m++)(0,h[m])()}function $M(h,m){return m}function FM(h,m){if(_n){var y=Xn.formState;if(y!==null){e:{var k=Jt;if(_n){if(ir){t:{for(var j=ir,M=ca;j.nodeType!==8;){if(!M){j=null;break t}if(j=da(j.nextSibling),j===null){j=null;break t}}M=j.data,j=M==="F!"||M==="F"?j:null}if(j){ir=da(j.nextSibling),k=j.data==="F!";break e}}ic(k)}k=!1}k&&(m=y[0])}}return y=Yi(),y.memoizedState=y.baseState=m,k={pending:null,lanes:0,dispatch:null,lastRenderedReducer:$M,lastRenderedState:m},y.queue=k,y=aR.bind(null,Jt,k),k.dispatch=y,k=Xk(!1),M=r1.bind(null,Jt,!1,k.queue),k=Yi(),j={state:m,dispatch:null,action:h,pending:null},k.queue=j,y=HK.bind(null,Jt,j,M,y),j.dispatch=y,k.memoizedState=h,[m,y,!1]}function HM(h){var m=Lr();return WM(m,Fn,h)}function WM(h,m,y){if(m=Yk(h,m,$M)[0],h=sy(hl)[0],typeof m=="object"&&m!==null&&typeof m.then=="function")try{var k=xp(m)}catch(G){throw G===eh?Gv:G}else k=m;m=Lr();var j=m.queue,M=j.dispatch;return y!==m.memoizedState&&(Jt.flags|=2048,sh(9,{destroy:void 0},WK.bind(null,j,y),null)),[k,M,h]}function WK(h,m){h.action=m}function qM(h){var m=Lr(),y=Fn;if(y!==null)return WM(m,y,h);Lr(),m=m.memoizedState,y=Lr();var k=y.queue.dispatch;return y.memoizedState=h,[m,k,!1]}function sh(h,m,y,k){return h={tag:h,create:y,deps:k,inst:m,next:null},m=Jt.updateQueue,m===null&&(m=ry(),Jt.updateQueue=m),y=m.lastEffect,y===null?m.lastEffect=h.next=h:(k=y.next,y.next=h,h.next=k,m.lastEffect=h),h}function UM(){return Lr().memoizedState}function ay(h,m,y,k){var j=Yi();Jt.flags|=h,j.memoizedState=sh(1|m,{destroy:void 0},y,k===void 0?null:k)}function oy(h,m,y,k){var j=Lr();k=k===void 0?null:k;var M=j.memoizedState.inst;Fn!==null&&k!==null&&Hk(k,Fn.memoizedState.deps)?j.memoizedState=sh(m,M,y,k):(Jt.flags|=h,j.memoizedState=sh(1|m,M,y,k))}function VM(h,m){ay(8390656,8,h,m)}function Zk(h,m){oy(2048,8,h,m)}function qK(h){Jt.flags|=4;var m=Jt.updateQueue;if(m===null)m=ry(),Jt.updateQueue=m,m.events=[h];else{var y=m.events;y===null?m.events=[h]:y.push(h)}}function KM(h){var m=Lr().memoizedState;return qK({ref:m,nextImpl:h}),function(){if((Dn&2)!==0)throw Error(i(440));return m.impl.apply(void 0,arguments)}}function YM(h,m){return oy(4,2,h,m)}function GM(h,m){return oy(4,4,h,m)}function XM(h,m){if(typeof m=="function"){h=h();var y=m(h);return function(){typeof y=="function"?y():m(null)}}if(m!=null)return h=h(),m.current=h,function(){m.current=null}}function QM(h,m,y){y=y!=null?y.concat([h]):null,oy(4,4,XM.bind(null,m,h),y)}function Jk(){}function ZM(h,m){var y=Lr();m=m===void 0?null:m;var k=y.memoizedState;return m!==null&&Hk(m,k[1])?k[0]:(y.memoizedState=[h,m],h)}function JM(h,m){var y=Lr();m=m===void 0?null:m;var k=y.memoizedState;if(m!==null&&Hk(m,k[1]))return k[0];if(k=h(),Du){Pe(!0);try{h()}finally{Pe(!1)}}return y.memoizedState=[k,m],k}function e1(h,m,y){return y===void 0||(dl&1073741824)!==0&&(gn&261930)===0?h.memoizedState=m:(h.memoizedState=y,h=e5(),Jt.lanes|=h,fc|=h,y)}function eR(h,m,y,k){return Ps(y,m)?y:nh.current!==null?(h=e1(h,y,k),Ps(h,m)||(qr=!0),h):(dl&42)===0||(dl&1073741824)!==0&&(gn&261930)===0?(qr=!0,h.memoizedState=y):(h=e5(),Jt.lanes|=h,fc|=h,m)}function tR(h,m,y,k,j){var M=Q.p;Q.p=M!==0&&8>M?M:8;var G=I.T,ne={};I.T=ne,r1(h,!1,m,y);try{var he=j(),De=I.S;if(De!==null&&De(ne,he),he!==null&&typeof he=="object"&&typeof he.then=="function"){var Ge=zK(he,k);bp(h,m,Ge,Fs(h))}else bp(h,m,k,Fs(h))}catch(tt){bp(h,m,{then:function(){},status:"rejected",reason:tt},Fs())}finally{Q.p=M,G!==null&&ne.types!==null&&(G.types=ne.types),I.T=G}}function UK(){}function t1(h,m,y,k){if(h.tag!==5)throw Error(i(476));var j=nR(h).queue;tR(h,j,m,K,y===null?UK:function(){return rR(h),y(k)})}function nR(h){var m=h.memoizedState;if(m!==null)return m;m={memoizedState:K,baseState:K,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:hl,lastRenderedState:K},next:null};var y={};return m.next={memoizedState:y,baseState:y,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:hl,lastRenderedState:y},next:null},h.memoizedState=m,h=h.alternate,h!==null&&(h.memoizedState=m),m}function rR(h){var m=nR(h);m.next===null&&(m=h.alternate.memoizedState),bp(h,m.next.queue,{},Fs())}function n1(){return ki(Bp)}function iR(){return Lr().memoizedState}function sR(){return Lr().memoizedState}function VK(h){for(var m=h.return;m!==null;){switch(m.tag){case 24:case 3:var y=Fs();h=oc(y);var k=lc(m,h,y);k!==null&&(ms(k,m,y),gp(k,m,y)),m={cache:Mk()},h.payload=m;return}m=m.return}}function KK(h,m,y){var k=Fs();y={lane:k,revertLane:0,gesture:null,action:y,hasEagerState:!1,eagerState:null,next:null},ly(h)?oR(m,y):(y=xk(h,m,y,k),y!==null&&(ms(y,h,k),lR(y,m,k)))}function aR(h,m,y){var k=Fs();bp(h,m,y,k)}function bp(h,m,y,k){var j={lane:k,revertLane:0,gesture:null,action:y,hasEagerState:!1,eagerState:null,next:null};if(ly(h))oR(m,j);else{var M=h.alternate;if(h.lanes===0&&(M===null||M.lanes===0)&&(M=m.lastRenderedReducer,M!==null))try{var G=m.lastRenderedState,ne=M(G,y);if(j.hasEagerState=!0,j.eagerState=ne,Ps(ne,G))return Hv(h,m,j,0),Xn===null&&Fv(),!1}catch{}finally{}if(y=xk(h,m,j,k),y!==null)return ms(y,h,k),lR(y,m,k),!0}return!1}function r1(h,m,y,k){if(k={lane:2,revertLane:P1(),gesture:null,action:k,hasEagerState:!1,eagerState:null,next:null},ly(h)){if(m)throw Error(i(479))}else m=xk(h,y,k,2),m!==null&&ms(m,h,2)}function ly(h){var m=h.alternate;return h===Jt||m!==null&&m===Jt}function oR(h,m){rh=ty=!0;var y=h.pending;y===null?m.next=m:(m.next=y.next,y.next=m),h.pending=m}function lR(h,m,y){if((y&4194048)!==0){var k=m.lanes;k&=h.pendingLanes,y|=k,m.lanes=y,sn(h,y)}}var kp={readContext:ki,use:iy,useCallback:Er,useContext:Er,useEffect:Er,useImperativeHandle:Er,useLayoutEffect:Er,useInsertionEffect:Er,useMemo:Er,useReducer:Er,useRef:Er,useState:Er,useDebugValue:Er,useDeferredValue:Er,useTransition:Er,useSyncExternalStore:Er,useId:Er,useHostTransitionStatus:Er,useFormState:Er,useActionState:Er,useOptimistic:Er,useMemoCache:Er,useCacheRefresh:Er};kp.useEffectEvent=Er;var cR={readContext:ki,use:iy,useCallback:function(h,m){return Yi().memoizedState=[h,m===void 0?null:m],h},useContext:ki,useEffect:VM,useImperativeHandle:function(h,m,y){y=y!=null?y.concat([h]):null,ay(4194308,4,XM.bind(null,m,h),y)},useLayoutEffect:function(h,m){return ay(4194308,4,h,m)},useInsertionEffect:function(h,m){ay(4,2,h,m)},useMemo:function(h,m){var y=Yi();m=m===void 0?null:m;var k=h();if(Du){Pe(!0);try{h()}finally{Pe(!1)}}return y.memoizedState=[k,m],k},useReducer:function(h,m,y){var k=Yi();if(y!==void 0){var j=y(m);if(Du){Pe(!0);try{y(m)}finally{Pe(!1)}}}else j=m;return k.memoizedState=k.baseState=j,h={pending:null,lanes:0,dispatch:null,lastRenderedReducer:h,lastRenderedState:j},k.queue=h,h=h.dispatch=KK.bind(null,Jt,h),[k.memoizedState,h]},useRef:function(h){var m=Yi();return h={current:h},m.memoizedState=h},useState:function(h){h=Xk(h);var m=h.queue,y=aR.bind(null,Jt,m);return m.dispatch=y,[h.memoizedState,y]},useDebugValue:Jk,useDeferredValue:function(h,m){var y=Yi();return e1(y,h,m)},useTransition:function(){var h=Xk(!1);return h=tR.bind(null,Jt,h.queue,!0,!1),Yi().memoizedState=h,[!1,h]},useSyncExternalStore:function(h,m,y){var k=Jt,j=Yi();if(_n){if(y===void 0)throw Error(i(407));y=y()}else{if(y=m(),Xn===null)throw Error(i(349));(gn&127)!==0||TM(k,m,y)}j.memoizedState=y;var M={value:y,getSnapshot:m};return j.queue=M,VM(RM.bind(null,k,M,h),[h]),k.flags|=2048,sh(9,{destroy:void 0},MM.bind(null,k,M,y,m),null),y},useId:function(){var h=Yi(),m=Xn.identifierPrefix;if(_n){var y=go,k=mo;y=(k&~(1<<32-ee(k)-1)).toString(32)+y,m="_"+m+"R_"+y,y=ny++,0<y&&(m+="H"+y.toString(32)),m+="_"}else y=$K++,m="_"+m+"r_"+y.toString(32)+"_";return h.memoizedState=m},useHostTransitionStatus:n1,useFormState:FM,useActionState:FM,useOptimistic:function(h){var m=Yi();m.memoizedState=m.baseState=h;var y={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return m.queue=y,m=r1.bind(null,Jt,!0,y),y.dispatch=m,[h,m]},useMemoCache:Kk,useCacheRefresh:function(){return Yi().memoizedState=VK.bind(null,Jt)},useEffectEvent:function(h){var m=Yi(),y={impl:h};return m.memoizedState=y,function(){if((Dn&2)!==0)throw Error(i(440));return y.impl.apply(void 0,arguments)}}},i1={readContext:ki,use:iy,useCallback:ZM,useContext:ki,useEffect:Zk,useImperativeHandle:QM,useInsertionEffect:YM,useLayoutEffect:GM,useMemo:JM,useReducer:sy,useRef:UM,useState:function(){return sy(hl)},useDebugValue:Jk,useDeferredValue:function(h,m){var y=Lr();return eR(y,Fn.memoizedState,h,m)},useTransition:function(){var h=sy(hl)[0],m=Lr().memoizedState;return[typeof h=="boolean"?h:xp(h),m]},useSyncExternalStore:AM,useId:iR,useHostTransitionStatus:n1,useFormState:HM,useActionState:HM,useOptimistic:function(h,m){var y=Lr();return PM(y,Fn,h,m)},useMemoCache:Kk,useCacheRefresh:sR};i1.useEffectEvent=KM;var uR={readContext:ki,use:iy,useCallback:ZM,useContext:ki,useEffect:Zk,useImperativeHandle:QM,useInsertionEffect:YM,useLayoutEffect:GM,useMemo:JM,useReducer:Gk,useRef:UM,useState:function(){return Gk(hl)},useDebugValue:Jk,useDeferredValue:function(h,m){var y=Lr();return Fn===null?e1(y,h,m):eR(y,Fn.memoizedState,h,m)},useTransition:function(){var h=Gk(hl)[0],m=Lr().memoizedState;return[typeof h=="boolean"?h:xp(h),m]},useSyncExternalStore:AM,useId:iR,useHostTransitionStatus:n1,useFormState:qM,useActionState:qM,useOptimistic:function(h,m){var y=Lr();return Fn!==null?PM(y,Fn,h,m):(y.baseState=h,[h,y.queue.dispatch])},useMemoCache:Kk,useCacheRefresh:sR};uR.useEffectEvent=KM;function s1(h,m,y,k){m=h.memoizedState,y=y(k,m),y=y==null?m:f({},m,y),h.memoizedState=y,h.lanes===0&&(h.updateQueue.baseState=y)}var a1={enqueueSetState:function(h,m,y){h=h._reactInternals;var k=Fs(),j=oc(k);j.payload=m,y!=null&&(j.callback=y),m=lc(h,j,k),m!==null&&(ms(m,h,k),gp(m,h,k))},enqueueReplaceState:function(h,m,y){h=h._reactInternals;var k=Fs(),j=oc(k);j.tag=1,j.payload=m,y!=null&&(j.callback=y),m=lc(h,j,k),m!==null&&(ms(m,h,k),gp(m,h,k))},enqueueForceUpdate:function(h,m){h=h._reactInternals;var y=Fs(),k=oc(y);k.tag=2,m!=null&&(k.callback=m),m=lc(h,k,y),m!==null&&(ms(m,h,y),gp(m,h,y))}};function dR(h,m,y,k,j,M,G){return h=h.stateNode,typeof h.shouldComponentUpdate=="function"?h.shouldComponentUpdate(k,M,G):m.prototype&&m.prototype.isPureReactComponent?!lp(y,k)||!lp(j,M):!0}function hR(h,m,y,k){h=m.state,typeof m.componentWillReceiveProps=="function"&&m.componentWillReceiveProps(y,k),typeof m.UNSAFE_componentWillReceiveProps=="function"&&m.UNSAFE_componentWillReceiveProps(y,k),m.state!==h&&a1.enqueueReplaceState(m,m.state,null)}function Pu(h,m){var y=m;if("ref"in m){y={};for(var k in m)k!=="ref"&&(y[k]=m[k])}if(h=h.defaultProps){y===m&&(y=f({},y));for(var j in h)y[j]===void 0&&(y[j]=h[j])}return y}function fR(h){$v(h)}function pR(h){console.error(h)}function mR(h){$v(h)}function cy(h,m){try{var y=h.onUncaughtError;y(m.value,{componentStack:m.stack})}catch(k){setTimeout(function(){throw k})}}function gR(h,m,y){try{var k=h.onCaughtError;k(y.value,{componentStack:y.stack,errorBoundary:m.tag===1?m.stateNode:null})}catch(j){setTimeout(function(){throw j})}}function o1(h,m,y){return y=oc(y),y.tag=3,y.payload={element:null},y.callback=function(){cy(h,m)},y}function vR(h){return h=oc(h),h.tag=3,h}function yR(h,m,y,k){var j=y.type.getDerivedStateFromError;if(typeof j=="function"){var M=k.value;h.payload=function(){return j(M)},h.callback=function(){gR(m,y,k)}}var G=y.stateNode;G!==null&&typeof G.componentDidCatch=="function"&&(h.callback=function(){gR(m,y,k),typeof j!="function"&&(pc===null?pc=new Set([this]):pc.add(this));var ne=k.stack;this.componentDidCatch(k.value,{componentStack:ne!==null?ne:""})})}function YK(h,m,y,k,j){if(y.flags|=32768,k!==null&&typeof k=="object"&&typeof k.then=="function"){if(m=y.alternate,m!==null&&Qd(m,y,j,!0),y=Is.current,y!==null){switch(y.tag){case 31:case 13:return ua===null?by():y.alternate===null&&Ar===0&&(Ar=3),y.flags&=-257,y.flags|=65536,y.lanes=j,k===Xv?y.flags|=16384:(m=y.updateQueue,m===null?y.updateQueue=new Set([k]):m.add(k),R1(h,k,j)),!1;case 22:return y.flags|=65536,k===Xv?y.flags|=16384:(m=y.updateQueue,m===null?(m={transitions:null,markerInstances:null,retryQueue:new Set([k])},y.updateQueue=m):(y=m.retryQueue,y===null?m.retryQueue=new Set([k]):y.add(k)),R1(h,k,j)),!1}throw Error(i(435,y.tag))}return R1(h,k,j),by(),!1}if(_n)return m=Is.current,m!==null?((m.flags&65536)===0&&(m.flags|=256),m.flags|=65536,m.lanes=j,k!==jk&&(h=Error(i(422),{cause:k}),dp(aa(h,y)))):(k!==jk&&(m=Error(i(423),{cause:k}),dp(aa(m,y))),h=h.current.alternate,h.flags|=65536,j&=-j,h.lanes|=j,k=aa(k,y),j=o1(h.stateNode,k,j),Ik(h,j),Ar!==4&&(Ar=2)),!1;var M=Error(i(520),{cause:k});if(M=aa(M,y),Tp===null?Tp=[M]:Tp.push(M),Ar!==4&&(Ar=2),m===null)return!0;k=aa(k,y),y=m;do{switch(y.tag){case 3:return y.flags|=65536,h=j&-j,y.lanes|=h,h=o1(y.stateNode,k,h),Ik(y,h),!1;case 1:if(m=y.type,M=y.stateNode,(y.flags&128)===0&&(typeof m.getDerivedStateFromError=="function"||M!==null&&typeof M.componentDidCatch=="function"&&(pc===null||!pc.has(M))))return y.flags|=65536,j&=-j,y.lanes|=j,j=vR(j),yR(j,h,y,k),Ik(y,j),!1}y=y.return}while(y!==null);return!1}var l1=Error(i(461)),qr=!1;function wi(h,m,y,k){m.child=h===null?kM(m,null,y,k):Ou(m,h.child,y,k)}function _R(h,m,y,k,j){y=y.render;var M=m.ref;if("ref"in k){var G={};for(var ne in k)ne!=="ref"&&(G[ne]=k[ne])}else G=k;return Au(m),k=Wk(h,m,y,G,M,j),ne=qk(),h!==null&&!qr?(Uk(h,m,j),fl(h,m,j)):(_n&&ne&&Sk(m),m.flags|=1,wi(h,m,k,j),m.child)}function xR(h,m,y,k,j){if(h===null){var M=y.type;return typeof M=="function"&&!bk(M)&&M.defaultProps===void 0&&y.compare===null?(m.tag=15,m.type=M,bR(h,m,M,k,j)):(h=qv(y.type,null,k,m,m.mode,j),h.ref=m.ref,h.return=m,m.child=h)}if(M=h.child,!g1(h,j)){var G=M.memoizedProps;if(y=y.compare,y=y!==null?y:lp,y(G,k)&&h.ref===m.ref)return fl(h,m,j)}return m.flags|=1,h=ol(M,k),h.ref=m.ref,h.return=m,m.child=h}function bR(h,m,y,k,j){if(h!==null){var M=h.memoizedProps;if(lp(M,k)&&h.ref===m.ref)if(qr=!1,m.pendingProps=k=M,g1(h,j))(h.flags&131072)!==0&&(qr=!0);else return m.lanes=h.lanes,fl(h,m,j)}return c1(h,m,y,k,j)}function kR(h,m,y,k){var j=k.children,M=h!==null?h.memoizedState:null;if(h===null&&m.stateNode===null&&(m.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),k.mode==="hidden"){if((m.flags&128)!==0){if(M=M!==null?M.baseLanes|y:y,h!==null){for(k=m.child=h.child,j=0;k!==null;)j=j|k.lanes|k.childLanes,k=k.sibling;k=j&~M}else k=0,m.child=null;return wR(h,m,M,y,k)}if((y&536870912)!==0)m.memoizedState={baseLanes:0,cachePool:null},h!==null&&Yv(m,M!==null?M.cachePool:null),M!==null?CM(m,M):zk(),jM(m);else return k=m.lanes=536870912,wR(h,m,M!==null?M.baseLanes|y:y,y,k)}else M!==null?(Yv(m,M.cachePool),CM(m,M),uc(),m.memoizedState=null):(h!==null&&Yv(m,null),zk(),uc());return wi(h,m,j,y),m.child}function wp(h,m){return h!==null&&h.tag===22||m.stateNode!==null||(m.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),m.sibling}function wR(h,m,y,k,j){var M=Ok();return M=M===null?null:{parent:Hr._currentValue,pool:M},m.memoizedState={baseLanes:y,cachePool:M},h!==null&&Yv(m,null),zk(),jM(m),h!==null&&Qd(h,m,k,!0),m.childLanes=j,null}function uy(h,m){return m=hy({mode:m.mode,children:m.children},h.mode),m.ref=h.ref,h.child=m,m.return=h,m}function SR(h,m,y){return Ou(m,h.child,null,y),h=uy(m,m.pendingProps),h.flags|=2,Bs(m),m.memoizedState=null,h}function GK(h,m,y){var k=m.pendingProps,j=(m.flags&128)!==0;if(m.flags&=-129,h===null){if(_n){if(k.mode==="hidden")return h=uy(m,k),m.lanes=536870912,wp(null,h);if(Fk(m),(h=ir)?(h=L5(h,ca),h=h!==null&&h.data==="&"?h:null,h!==null&&(m.memoizedState={dehydrated:h,treeContext:nc!==null?{id:mo,overflow:go}:null,retryLane:536870912,hydrationErrors:null},y=oM(h),y.return=m,m.child=y,bi=m,ir=null)):h=null,h===null)throw ic(m);return m.lanes=536870912,null}return uy(m,k)}var M=h.memoizedState;if(M!==null){var G=M.dehydrated;if(Fk(m),j)if(m.flags&256)m.flags&=-257,m=SR(h,m,y);else if(m.memoizedState!==null)m.child=h.child,m.flags|=128,m=null;else throw Error(i(558));else if(qr||Qd(h,m,y,!1),j=(y&h.childLanes)!==0,qr||j){if(k=Xn,k!==null&&(G=nn(k,y),G!==0&&G!==M.retryLane))throw M.retryLane=G,Cu(h,G),ms(k,h,G),l1;by(),m=SR(h,m,y)}else h=M.treeContext,ir=da(G.nextSibling),bi=m,_n=!0,rc=null,ca=!1,h!==null&&uM(m,h),m=uy(m,k),m.flags|=4096;return m}return h=ol(h.child,{mode:k.mode,children:k.children}),h.ref=m.ref,m.child=h,h.return=m,h}function dy(h,m){var y=m.ref;if(y===null)h!==null&&h.ref!==null&&(m.flags|=4194816);else{if(typeof y!="function"&&typeof y!="object")throw Error(i(284));(h===null||h.ref!==y)&&(m.flags|=4194816)}}function c1(h,m,y,k,j){return Au(m),y=Wk(h,m,y,k,void 0,j),k=qk(),h!==null&&!qr?(Uk(h,m,j),fl(h,m,j)):(_n&&k&&Sk(m),m.flags|=1,wi(h,m,y,j),m.child)}function CR(h,m,y,k,j,M){return Au(m),m.updateQueue=null,y=EM(m,k,y,j),NM(h),k=qk(),h!==null&&!qr?(Uk(h,m,M),fl(h,m,M)):(_n&&k&&Sk(m),m.flags|=1,wi(h,m,y,M),m.child)}function jR(h,m,y,k,j){if(Au(m),m.stateNode===null){var M=Kd,G=y.contextType;typeof G=="object"&&G!==null&&(M=ki(G)),M=new y(k,M),m.memoizedState=M.state!==null&&M.state!==void 0?M.state:null,M.updater=a1,m.stateNode=M,M._reactInternals=m,M=m.stateNode,M.props=k,M.state=m.memoizedState,M.refs={},Pk(m),G=y.contextType,M.context=typeof G=="object"&&G!==null?ki(G):Kd,M.state=m.memoizedState,G=y.getDerivedStateFromProps,typeof G=="function"&&(s1(m,y,G,k),M.state=m.memoizedState),typeof y.getDerivedStateFromProps=="function"||typeof M.getSnapshotBeforeUpdate=="function"||typeof M.UNSAFE_componentWillMount!="function"&&typeof M.componentWillMount!="function"||(G=M.state,typeof M.componentWillMount=="function"&&M.componentWillMount(),typeof M.UNSAFE_componentWillMount=="function"&&M.UNSAFE_componentWillMount(),G!==M.state&&a1.enqueueReplaceState(M,M.state,null),yp(m,k,M,j),vp(),M.state=m.memoizedState),typeof M.componentDidMount=="function"&&(m.flags|=4194308),k=!0}else if(h===null){M=m.stateNode;var ne=m.memoizedProps,he=Pu(y,ne);M.props=he;var De=M.context,Ge=y.contextType;G=Kd,typeof Ge=="object"&&Ge!==null&&(G=ki(Ge));var tt=y.getDerivedStateFromProps;Ge=typeof tt=="function"||typeof M.getSnapshotBeforeUpdate=="function",ne=m.pendingProps!==ne,Ge||typeof M.UNSAFE_componentWillReceiveProps!="function"&&typeof M.componentWillReceiveProps!="function"||(ne||De!==G)&&hR(m,M,k,G),ac=!1;var ze=m.memoizedState;M.state=ze,yp(m,k,M,j),vp(),De=m.memoizedState,ne||ze!==De||ac?(typeof tt=="function"&&(s1(m,y,tt,k),De=m.memoizedState),(he=ac||dR(m,y,he,k,ze,De,G))?(Ge||typeof M.UNSAFE_componentWillMount!="function"&&typeof M.componentWillMount!="function"||(typeof M.componentWillMount=="function"&&M.componentWillMount(),typeof M.UNSAFE_componentWillMount=="function"&&M.UNSAFE_componentWillMount()),typeof M.componentDidMount=="function"&&(m.flags|=4194308)):(typeof M.componentDidMount=="function"&&(m.flags|=4194308),m.memoizedProps=k,m.memoizedState=De),M.props=k,M.state=De,M.context=G,k=he):(typeof M.componentDidMount=="function"&&(m.flags|=4194308),k=!1)}else{M=m.stateNode,Lk(h,m),G=m.memoizedProps,Ge=Pu(y,G),M.props=Ge,tt=m.pendingProps,ze=M.context,De=y.contextType,he=Kd,typeof De=="object"&&De!==null&&(he=ki(De)),ne=y.getDerivedStateFromProps,(De=typeof ne=="function"||typeof M.getSnapshotBeforeUpdate=="function")||typeof M.UNSAFE_componentWillReceiveProps!="function"&&typeof M.componentWillReceiveProps!="function"||(G!==tt||ze!==he)&&hR(m,M,k,he),ac=!1,ze=m.memoizedState,M.state=ze,yp(m,k,M,j),vp();var He=m.memoizedState;G!==tt||ze!==He||ac||h!==null&&h.dependencies!==null&&Vv(h.dependencies)?(typeof ne=="function"&&(s1(m,y,ne,k),He=m.memoizedState),(Ge=ac||dR(m,y,Ge,k,ze,He,he)||h!==null&&h.dependencies!==null&&Vv(h.dependencies))?(De||typeof M.UNSAFE_componentWillUpdate!="function"&&typeof M.componentWillUpdate!="function"||(typeof M.componentWillUpdate=="function"&&M.componentWillUpdate(k,He,he),typeof M.UNSAFE_componentWillUpdate=="function"&&M.UNSAFE_componentWillUpdate(k,He,he)),typeof M.componentDidUpdate=="function"&&(m.flags|=4),typeof M.getSnapshotBeforeUpdate=="function"&&(m.flags|=1024)):(typeof M.componentDidUpdate!="function"||G===h.memoizedProps&&ze===h.memoizedState||(m.flags|=4),typeof M.getSnapshotBeforeUpdate!="function"||G===h.memoizedProps&&ze===h.memoizedState||(m.flags|=1024),m.memoizedProps=k,m.memoizedState=He),M.props=k,M.state=He,M.context=he,k=Ge):(typeof M.componentDidUpdate!="function"||G===h.memoizedProps&&ze===h.memoizedState||(m.flags|=4),typeof M.getSnapshotBeforeUpdate!="function"||G===h.memoizedProps&&ze===h.memoizedState||(m.flags|=1024),k=!1)}return M=k,dy(h,m),k=(m.flags&128)!==0,M||k?(M=m.stateNode,y=k&&typeof y.getDerivedStateFromError!="function"?null:M.render(),m.flags|=1,h!==null&&k?(m.child=Ou(m,h.child,null,j),m.child=Ou(m,null,y,j)):wi(h,m,y,j),m.memoizedState=M.state,h=m.child):h=fl(h,m,j),h}function NR(h,m,y,k){return Nu(),m.flags|=256,wi(h,m,y,k),m.child}var u1={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function d1(h){return{baseLanes:h,cachePool:gM()}}function h1(h,m,y){return h=h!==null?h.childLanes&~y:0,m&&(h|=$s),h}function ER(h,m,y){var k=m.pendingProps,j=!1,M=(m.flags&128)!==0,G;if((G=M)||(G=h!==null&&h.memoizedState===null?!1:(Pr.current&2)!==0),G&&(j=!0,m.flags&=-129),G=(m.flags&32)!==0,m.flags&=-33,h===null){if(_n){if(j?cc(m):uc(),(h=ir)?(h=L5(h,ca),h=h!==null&&h.data!=="&"?h:null,h!==null&&(m.memoizedState={dehydrated:h,treeContext:nc!==null?{id:mo,overflow:go}:null,retryLane:536870912,hydrationErrors:null},y=oM(h),y.return=m,m.child=y,bi=m,ir=null)):h=null,h===null)throw ic(m);return Y1(h)?m.lanes=32:m.lanes=536870912,null}var ne=k.children;return k=k.fallback,j?(uc(),j=m.mode,ne=hy({mode:"hidden",children:ne},j),k=ju(k,j,y,null),ne.return=m,k.return=m,ne.sibling=k,m.child=ne,k=m.child,k.memoizedState=d1(y),k.childLanes=h1(h,G,y),m.memoizedState=u1,wp(null,k)):(cc(m),f1(m,ne))}var he=h.memoizedState;if(he!==null&&(ne=he.dehydrated,ne!==null)){if(M)m.flags&256?(cc(m),m.flags&=-257,m=p1(h,m,y)):m.memoizedState!==null?(uc(),m.child=h.child,m.flags|=128,m=null):(uc(),ne=k.fallback,j=m.mode,k=hy({mode:"visible",children:k.children},j),ne=ju(ne,j,y,null),ne.flags|=2,k.return=m,ne.return=m,k.sibling=ne,m.child=k,Ou(m,h.child,null,y),k=m.child,k.memoizedState=d1(y),k.childLanes=h1(h,G,y),m.memoizedState=u1,m=wp(null,k));else if(cc(m),Y1(ne)){if(G=ne.nextSibling&&ne.nextSibling.dataset,G)var De=G.dgst;G=De,k=Error(i(419)),k.stack="",k.digest=G,dp({value:k,source:null,stack:null}),m=p1(h,m,y)}else if(qr||Qd(h,m,y,!1),G=(y&h.childLanes)!==0,qr||G){if(G=Xn,G!==null&&(k=nn(G,y),k!==0&&k!==he.retryLane))throw he.retryLane=k,Cu(h,k),ms(G,h,k),l1;K1(ne)||by(),m=p1(h,m,y)}else K1(ne)?(m.flags|=192,m.child=h.child,m=null):(h=he.treeContext,ir=da(ne.nextSibling),bi=m,_n=!0,rc=null,ca=!1,h!==null&&uM(m,h),m=f1(m,k.children),m.flags|=4096);return m}return j?(uc(),ne=k.fallback,j=m.mode,he=h.child,De=he.sibling,k=ol(he,{mode:"hidden",children:k.children}),k.subtreeFlags=he.subtreeFlags&65011712,De!==null?ne=ol(De,ne):(ne=ju(ne,j,y,null),ne.flags|=2),ne.return=m,k.return=m,k.sibling=ne,m.child=k,wp(null,k),k=m.child,ne=h.child.memoizedState,ne===null?ne=d1(y):(j=ne.cachePool,j!==null?(he=Hr._currentValue,j=j.parent!==he?{parent:he,pool:he}:j):j=gM(),ne={baseLanes:ne.baseLanes|y,cachePool:j}),k.memoizedState=ne,k.childLanes=h1(h,G,y),m.memoizedState=u1,wp(h.child,k)):(cc(m),y=h.child,h=y.sibling,y=ol(y,{mode:"visible",children:k.children}),y.return=m,y.sibling=null,h!==null&&(G=m.deletions,G===null?(m.deletions=[h],m.flags|=16):G.push(h)),m.child=y,m.memoizedState=null,y)}function f1(h,m){return m=hy({mode:"visible",children:m},h.mode),m.return=h,h.child=m}function hy(h,m){return h=Ls(22,h,null,m),h.lanes=0,h}function p1(h,m,y){return Ou(m,h.child,null,y),h=f1(m,m.pendingProps.children),h.flags|=2,m.memoizedState=null,h}function AR(h,m,y){h.lanes|=m;var k=h.alternate;k!==null&&(k.lanes|=m),Ak(h.return,m,y)}function m1(h,m,y,k,j,M){var G=h.memoizedState;G===null?h.memoizedState={isBackwards:m,rendering:null,renderingStartTime:0,last:k,tail:y,tailMode:j,treeForkCount:M}:(G.isBackwards=m,G.rendering=null,G.renderingStartTime=0,G.last=k,G.tail=y,G.tailMode=j,G.treeForkCount=M)}function TR(h,m,y){var k=m.pendingProps,j=k.revealOrder,M=k.tail;k=k.children;var G=Pr.current,ne=(G&2)!==0;if(ne?(G=G&1|2,m.flags|=128):G&=1,V(Pr,G),wi(h,m,k,y),k=_n?up:0,!ne&&h!==null&&(h.flags&128)!==0)e:for(h=m.child;h!==null;){if(h.tag===13)h.memoizedState!==null&&AR(h,y,m);else if(h.tag===19)AR(h,y,m);else if(h.child!==null){h.child.return=h,h=h.child;continue}if(h===m)break e;for(;h.sibling===null;){if(h.return===null||h.return===m)break e;h=h.return}h.sibling.return=h.return,h=h.sibling}switch(j){case"forwards":for(y=m.child,j=null;y!==null;)h=y.alternate,h!==null&&ey(h)===null&&(j=y),y=y.sibling;y=j,y===null?(j=m.child,m.child=null):(j=y.sibling,y.sibling=null),m1(m,!1,j,y,M,k);break;case"backwards":case"unstable_legacy-backwards":for(y=null,j=m.child,m.child=null;j!==null;){if(h=j.alternate,h!==null&&ey(h)===null){m.child=j;break}h=j.sibling,j.sibling=y,y=j,j=h}m1(m,!0,y,null,M,k);break;case"together":m1(m,!1,null,null,void 0,k);break;default:m.memoizedState=null}return m.child}function fl(h,m,y){if(h!==null&&(m.dependencies=h.dependencies),fc|=m.lanes,(y&m.childLanes)===0)if(h!==null){if(Qd(h,m,y,!1),(y&m.childLanes)===0)return null}else return null;if(h!==null&&m.child!==h.child)throw Error(i(153));if(m.child!==null){for(h=m.child,y=ol(h,h.pendingProps),m.child=y,y.return=m;h.sibling!==null;)h=h.sibling,y=y.sibling=ol(h,h.pendingProps),y.return=m;y.sibling=null}return m.child}function g1(h,m){return(h.lanes&m)!==0?!0:(h=h.dependencies,!!(h!==null&&Vv(h)))}function XK(h,m,y){switch(m.tag){case 3:re(m,m.stateNode.containerInfo),sc(m,Hr,h.memoizedState.cache),Nu();break;case 27:case 5:ue(m);break;case 4:re(m,m.stateNode.containerInfo);break;case 10:sc(m,m.type,m.memoizedProps.value);break;case 31:if(m.memoizedState!==null)return m.flags|=128,Fk(m),null;break;case 13:var k=m.memoizedState;if(k!==null)return k.dehydrated!==null?(cc(m),m.flags|=128,null):(y&m.child.childLanes)!==0?ER(h,m,y):(cc(m),h=fl(h,m,y),h!==null?h.sibling:null);cc(m);break;case 19:var j=(h.flags&128)!==0;if(k=(y&m.childLanes)!==0,k||(Qd(h,m,y,!1),k=(y&m.childLanes)!==0),j){if(k)return TR(h,m,y);m.flags|=128}if(j=m.memoizedState,j!==null&&(j.rendering=null,j.tail=null,j.lastEffect=null),V(Pr,Pr.current),k)break;return null;case 22:return m.lanes=0,kR(h,m,y,m.pendingProps);case 24:sc(m,Hr,h.memoizedState.cache)}return fl(h,m,y)}function MR(h,m,y){if(h!==null)if(h.memoizedProps!==m.pendingProps)qr=!0;else{if(!g1(h,y)&&(m.flags&128)===0)return qr=!1,XK(h,m,y);qr=(h.flags&131072)!==0}else qr=!1,_n&&(m.flags&1048576)!==0&&cM(m,up,m.index);switch(m.lanes=0,m.tag){case 16:e:{var k=m.pendingProps;if(h=Mu(m.elementType),m.type=h,typeof h=="function")bk(h)?(k=Pu(h,k),m.tag=1,m=jR(null,m,h,k,y)):(m.tag=0,m=c1(null,m,h,k,y));else{if(h!=null){var j=h.$$typeof;if(j===T){m.tag=11,m=_R(null,m,h,k,y);break e}else if(j===D){m.tag=14,m=xR(null,m,h,k,y);break e}}throw m=P(h)||h,Error(i(306,m,""))}}return m;case 0:return c1(h,m,m.type,m.pendingProps,y);case 1:return k=m.type,j=Pu(k,m.pendingProps),jR(h,m,k,j,y);case 3:e:{if(re(m,m.stateNode.containerInfo),h===null)throw Error(i(387));k=m.pendingProps;var M=m.memoizedState;j=M.element,Lk(h,m),yp(m,k,null,y);var G=m.memoizedState;if(k=G.cache,sc(m,Hr,k),k!==M.cache&&Tk(m,[Hr],y,!0),vp(),k=G.element,M.isDehydrated)if(M={element:k,isDehydrated:!1,cache:G.cache},m.updateQueue.baseState=M,m.memoizedState=M,m.flags&256){m=NR(h,m,k,y);break e}else if(k!==j){j=aa(Error(i(424)),m),dp(j),m=NR(h,m,k,y);break e}else{switch(h=m.stateNode.containerInfo,h.nodeType){case 9:h=h.body;break;default:h=h.nodeName==="HTML"?h.ownerDocument.body:h}for(ir=da(h.firstChild),bi=m,_n=!0,rc=null,ca=!0,y=kM(m,null,k,y),m.child=y;y;)y.flags=y.flags&-3|4096,y=y.sibling}else{if(Nu(),k===j){m=fl(h,m,y);break e}wi(h,m,k,y)}m=m.child}return m;case 26:return dy(h,m),h===null?(y=H5(m.type,null,m.pendingProps,null))?m.memoizedState=y:_n||(y=m.type,h=m.pendingProps,k=Ey(X.current).createElement(y),k[L]=m,k[Qe]=h,Si(k,y,h),Kn(k),m.stateNode=k):m.memoizedState=H5(m.type,h.memoizedProps,m.pendingProps,h.memoizedState),null;case 27:return ue(m),h===null&&_n&&(k=m.stateNode=z5(m.type,m.pendingProps,X.current),bi=m,ca=!0,j=ir,yc(m.type)?(G1=j,ir=da(k.firstChild)):ir=j),wi(h,m,m.pendingProps.children,y),dy(h,m),h===null&&(m.flags|=4194304),m.child;case 5:return h===null&&_n&&((j=k=ir)&&(k=jY(k,m.type,m.pendingProps,ca),k!==null?(m.stateNode=k,bi=m,ir=da(k.firstChild),ca=!1,j=!0):j=!1),j||ic(m)),ue(m),j=m.type,M=m.pendingProps,G=h!==null?h.memoizedProps:null,k=M.children,q1(j,M)?k=null:G!==null&&q1(j,G)&&(m.flags|=32),m.memoizedState!==null&&(j=Wk(h,m,FK,null,null,y),Bp._currentValue=j),dy(h,m),wi(h,m,k,y),m.child;case 6:return h===null&&_n&&((h=y=ir)&&(y=NY(y,m.pendingProps,ca),y!==null?(m.stateNode=y,bi=m,ir=null,h=!0):h=!1),h||ic(m)),null;case 13:return ER(h,m,y);case 4:return re(m,m.stateNode.containerInfo),k=m.pendingProps,h===null?m.child=Ou(m,null,k,y):wi(h,m,k,y),m.child;case 11:return _R(h,m,m.type,m.pendingProps,y);case 7:return wi(h,m,m.pendingProps,y),m.child;case 8:return wi(h,m,m.pendingProps.children,y),m.child;case 12:return wi(h,m,m.pendingProps.children,y),m.child;case 10:return k=m.pendingProps,sc(m,m.type,k.value),wi(h,m,k.children,y),m.child;case 9:return j=m.type._context,k=m.pendingProps.children,Au(m),j=ki(j),k=k(j),m.flags|=1,wi(h,m,k,y),m.child;case 14:return xR(h,m,m.type,m.pendingProps,y);case 15:return bR(h,m,m.type,m.pendingProps,y);case 19:return TR(h,m,y);case 31:return GK(h,m,y);case 22:return kR(h,m,y,m.pendingProps);case 24:return Au(m),k=ki(Hr),h===null?(j=Ok(),j===null&&(j=Xn,M=Mk(),j.pooledCache=M,M.refCount++,M!==null&&(j.pooledCacheLanes|=y),j=M),m.memoizedState={parent:k,cache:j},Pk(m),sc(m,Hr,j)):((h.lanes&y)!==0&&(Lk(h,m),yp(m,null,null,y),vp()),j=h.memoizedState,M=m.memoizedState,j.parent!==k?(j={parent:k,cache:k},m.memoizedState=j,m.lanes===0&&(m.memoizedState=m.updateQueue.baseState=j),sc(m,Hr,k)):(k=M.cache,sc(m,Hr,k),k!==j.cache&&Tk(m,[Hr],y,!0))),wi(h,m,m.pendingProps.children,y),m.child;case 29:throw m.pendingProps}throw Error(i(156,m.tag))}function pl(h){h.flags|=4}function v1(h,m,y,k,j){if((m=(h.mode&32)!==0)&&(m=!1),m){if(h.flags|=16777216,(j&335544128)===j)if(h.stateNode.complete)h.flags|=8192;else if(i5())h.flags|=8192;else throw Ru=Xv,Dk}else h.flags&=-16777217}function RR(h,m){if(m.type!=="stylesheet"||(m.state.loading&4)!==0)h.flags&=-16777217;else if(h.flags|=16777216,!K5(m))if(i5())h.flags|=8192;else throw Ru=Xv,Dk}function fy(h,m){m!==null&&(h.flags|=4),h.flags&16384&&(m=h.tag!==22?mt():536870912,h.lanes|=m,ch|=m)}function Sp(h,m){if(!_n)switch(h.tailMode){case"hidden":m=h.tail;for(var y=null;m!==null;)m.alternate!==null&&(y=m),m=m.sibling;y===null?h.tail=null:y.sibling=null;break;case"collapsed":y=h.tail;for(var k=null;y!==null;)y.alternate!==null&&(k=y),y=y.sibling;k===null?m||h.tail===null?h.tail=null:h.tail.sibling=null:k.sibling=null}}function sr(h){var m=h.alternate!==null&&h.alternate.child===h.child,y=0,k=0;if(m)for(var j=h.child;j!==null;)y|=j.lanes|j.childLanes,k|=j.subtreeFlags&65011712,k|=j.flags&65011712,j.return=h,j=j.sibling;else for(j=h.child;j!==null;)y|=j.lanes|j.childLanes,k|=j.subtreeFlags,k|=j.flags,j.return=h,j=j.sibling;return h.subtreeFlags|=k,h.childLanes=y,m}function QK(h,m,y){var k=m.pendingProps;switch(Ck(m),m.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return sr(m),null;case 1:return sr(m),null;case 3:return y=m.stateNode,k=null,h!==null&&(k=h.memoizedState.cache),m.memoizedState.cache!==k&&(m.flags|=2048),ul(Hr),de(),y.pendingContext&&(y.context=y.pendingContext,y.pendingContext=null),(h===null||h.child===null)&&(Xd(m)?pl(m):h===null||h.memoizedState.isDehydrated&&(m.flags&256)===0||(m.flags|=1024,Nk())),sr(m),null;case 26:var j=m.type,M=m.memoizedState;return h===null?(pl(m),M!==null?(sr(m),RR(m,M)):(sr(m),v1(m,j,null,k,y))):M?M!==h.memoizedState?(pl(m),sr(m),RR(m,M)):(sr(m),m.flags&=-16777217):(h=h.memoizedProps,h!==k&&pl(m),sr(m),v1(m,j,h,k,y)),null;case 27:if(ae(m),y=X.current,j=m.type,h!==null&&m.stateNode!=null)h.memoizedProps!==k&&pl(m);else{if(!k){if(m.stateNode===null)throw Error(i(166));return sr(m),null}h=ie.current,Xd(m)?dM(m):(h=z5(j,k,y),m.stateNode=h,pl(m))}return sr(m),null;case 5:if(ae(m),j=m.type,h!==null&&m.stateNode!=null)h.memoizedProps!==k&&pl(m);else{if(!k){if(m.stateNode===null)throw Error(i(166));return sr(m),null}if(M=ie.current,Xd(m))dM(m);else{var G=Ey(X.current);switch(M){case 1:M=G.createElementNS("http://www.w3.org/2000/svg",j);break;case 2:M=G.createElementNS("http://www.w3.org/1998/Math/MathML",j);break;default:switch(j){case"svg":M=G.createElementNS("http://www.w3.org/2000/svg",j);break;case"math":M=G.createElementNS("http://www.w3.org/1998/Math/MathML",j);break;case"script":M=G.createElement("div"),M.innerHTML="<script><\/script>",M=M.removeChild(M.firstChild);break;case"select":M=typeof k.is=="string"?G.createElement("select",{is:k.is}):G.createElement("select"),k.multiple?M.multiple=!0:k.size&&(M.size=k.size);break;default:M=typeof k.is=="string"?G.createElement(j,{is:k.is}):G.createElement(j)}}M[L]=m,M[Qe]=k;e:for(G=m.child;G!==null;){if(G.tag===5||G.tag===6)M.appendChild(G.stateNode);else if(G.tag!==4&&G.tag!==27&&G.child!==null){G.child.return=G,G=G.child;continue}if(G===m)break e;for(;G.sibling===null;){if(G.return===null||G.return===m)break e;G=G.return}G.sibling.return=G.return,G=G.sibling}m.stateNode=M;e:switch(Si(M,j,k),j){case"button":case"input":case"select":case"textarea":k=!!k.autoFocus;break e;case"img":k=!0;break e;default:k=!1}k&&pl(m)}}return sr(m),v1(m,m.type,h===null?null:h.memoizedProps,m.pendingProps,y),null;case 6:if(h&&m.stateNode!=null)h.memoizedProps!==k&&pl(m);else{if(typeof k!="string"&&m.stateNode===null)throw Error(i(166));if(h=X.current,Xd(m)){if(h=m.stateNode,y=m.memoizedProps,k=null,j=bi,j!==null)switch(j.tag){case 27:case 5:k=j.memoizedProps}h[L]=m,h=!!(h.nodeValue===y||k!==null&&k.suppressHydrationWarning===!0||E5(h.nodeValue,y)),h||ic(m,!0)}else h=Ey(h).createTextNode(k),h[L]=m,m.stateNode=h}return sr(m),null;case 31:if(y=m.memoizedState,h===null||h.memoizedState!==null){if(k=Xd(m),y!==null){if(h===null){if(!k)throw Error(i(318));if(h=m.memoizedState,h=h!==null?h.dehydrated:null,!h)throw Error(i(557));h[L]=m}else Nu(),(m.flags&128)===0&&(m.memoizedState=null),m.flags|=4;sr(m),h=!1}else y=Nk(),h!==null&&h.memoizedState!==null&&(h.memoizedState.hydrationErrors=y),h=!0;if(!h)return m.flags&256?(Bs(m),m):(Bs(m),null);if((m.flags&128)!==0)throw Error(i(558))}return sr(m),null;case 13:if(k=m.memoizedState,h===null||h.memoizedState!==null&&h.memoizedState.dehydrated!==null){if(j=Xd(m),k!==null&&k.dehydrated!==null){if(h===null){if(!j)throw Error(i(318));if(j=m.memoizedState,j=j!==null?j.dehydrated:null,!j)throw Error(i(317));j[L]=m}else Nu(),(m.flags&128)===0&&(m.memoizedState=null),m.flags|=4;sr(m),j=!1}else j=Nk(),h!==null&&h.memoizedState!==null&&(h.memoizedState.hydrationErrors=j),j=!0;if(!j)return m.flags&256?(Bs(m),m):(Bs(m),null)}return Bs(m),(m.flags&128)!==0?(m.lanes=y,m):(y=k!==null,h=h!==null&&h.memoizedState!==null,y&&(k=m.child,j=null,k.alternate!==null&&k.alternate.memoizedState!==null&&k.alternate.memoizedState.cachePool!==null&&(j=k.alternate.memoizedState.cachePool.pool),M=null,k.memoizedState!==null&&k.memoizedState.cachePool!==null&&(M=k.memoizedState.cachePool.pool),M!==j&&(k.flags|=2048)),y!==h&&y&&(m.child.flags|=8192),fy(m,m.updateQueue),sr(m),null);case 4:return de(),h===null&&z1(m.stateNode.containerInfo),sr(m),null;case 10:return ul(m.type),sr(m),null;case 19:if(U(Pr),k=m.memoizedState,k===null)return sr(m),null;if(j=(m.flags&128)!==0,M=k.rendering,M===null)if(j)Sp(k,!1);else{if(Ar!==0||h!==null&&(h.flags&128)!==0)for(h=m.child;h!==null;){if(M=ey(h),M!==null){for(m.flags|=128,Sp(k,!1),h=M.updateQueue,m.updateQueue=h,fy(m,h),m.subtreeFlags=0,h=y,y=m.child;y!==null;)aM(y,h),y=y.sibling;return V(Pr,Pr.current&1|2),_n&&ll(m,k.treeForkCount),m.child}h=h.sibling}k.tail!==null&&Tt()>yy&&(m.flags|=128,j=!0,Sp(k,!1),m.lanes=4194304)}else{if(!j)if(h=ey(M),h!==null){if(m.flags|=128,j=!0,h=h.updateQueue,m.updateQueue=h,fy(m,h),Sp(k,!0),k.tail===null&&k.tailMode==="hidden"&&!M.alternate&&!_n)return sr(m),null}else 2*Tt()-k.renderingStartTime>yy&&y!==536870912&&(m.flags|=128,j=!0,Sp(k,!1),m.lanes=4194304);k.isBackwards?(M.sibling=m.child,m.child=M):(h=k.last,h!==null?h.sibling=M:m.child=M,k.last=M)}return k.tail!==null?(h=k.tail,k.rendering=h,k.tail=h.sibling,k.renderingStartTime=Tt(),h.sibling=null,y=Pr.current,V(Pr,j?y&1|2:y&1),_n&&ll(m,k.treeForkCount),h):(sr(m),null);case 22:case 23:return Bs(m),$k(),k=m.memoizedState!==null,h!==null?h.memoizedState!==null!==k&&(m.flags|=8192):k&&(m.flags|=8192),k?(y&536870912)!==0&&(m.flags&128)===0&&(sr(m),m.subtreeFlags&6&&(m.flags|=8192)):sr(m),y=m.updateQueue,y!==null&&fy(m,y.retryQueue),y=null,h!==null&&h.memoizedState!==null&&h.memoizedState.cachePool!==null&&(y=h.memoizedState.cachePool.pool),k=null,m.memoizedState!==null&&m.memoizedState.cachePool!==null&&(k=m.memoizedState.cachePool.pool),k!==y&&(m.flags|=2048),h!==null&&U(Tu),null;case 24:return y=null,h!==null&&(y=h.memoizedState.cache),m.memoizedState.cache!==y&&(m.flags|=2048),ul(Hr),sr(m),null;case 25:return null;case 30:return null}throw Error(i(156,m.tag))}function ZK(h,m){switch(Ck(m),m.tag){case 1:return h=m.flags,h&65536?(m.flags=h&-65537|128,m):null;case 3:return ul(Hr),de(),h=m.flags,(h&65536)!==0&&(h&128)===0?(m.flags=h&-65537|128,m):null;case 26:case 27:case 5:return ae(m),null;case 31:if(m.memoizedState!==null){if(Bs(m),m.alternate===null)throw Error(i(340));Nu()}return h=m.flags,h&65536?(m.flags=h&-65537|128,m):null;case 13:if(Bs(m),h=m.memoizedState,h!==null&&h.dehydrated!==null){if(m.alternate===null)throw Error(i(340));Nu()}return h=m.flags,h&65536?(m.flags=h&-65537|128,m):null;case 19:return U(Pr),null;case 4:return de(),null;case 10:return ul(m.type),null;case 22:case 23:return Bs(m),$k(),h!==null&&U(Tu),h=m.flags,h&65536?(m.flags=h&-65537|128,m):null;case 24:return ul(Hr),null;case 25:return null;default:return null}}function OR(h,m){switch(Ck(m),m.tag){case 3:ul(Hr),de();break;case 26:case 27:case 5:ae(m);break;case 4:de();break;case 31:m.memoizedState!==null&&Bs(m);break;case 13:Bs(m);break;case 19:U(Pr);break;case 10:ul(m.type);break;case 22:case 23:Bs(m),$k(),h!==null&&U(Tu);break;case 24:ul(Hr)}}function Cp(h,m){try{var y=m.updateQueue,k=y!==null?y.lastEffect:null;if(k!==null){var j=k.next;y=j;do{if((y.tag&h)===h){k=void 0;var M=y.create,G=y.inst;k=M(),G.destroy=k}y=y.next}while(y!==j)}}catch(ne){zn(m,m.return,ne)}}function dc(h,m,y){try{var k=m.updateQueue,j=k!==null?k.lastEffect:null;if(j!==null){var M=j.next;k=M;do{if((k.tag&h)===h){var G=k.inst,ne=G.destroy;if(ne!==void 0){G.destroy=void 0,j=m;var he=y,De=ne;try{De()}catch(Ge){zn(j,he,Ge)}}}k=k.next}while(k!==M)}}catch(Ge){zn(m,m.return,Ge)}}function DR(h){var m=h.updateQueue;if(m!==null){var y=h.stateNode;try{SM(m,y)}catch(k){zn(h,h.return,k)}}}function PR(h,m,y){y.props=Pu(h.type,h.memoizedProps),y.state=h.memoizedState;try{y.componentWillUnmount()}catch(k){zn(h,m,k)}}function jp(h,m){try{var y=h.ref;if(y!==null){switch(h.tag){case 26:case 27:case 5:var k=h.stateNode;break;case 30:k=h.stateNode;break;default:k=h.stateNode}typeof y=="function"?h.refCleanup=y(k):y.current=k}}catch(j){zn(h,m,j)}}function vo(h,m){var y=h.ref,k=h.refCleanup;if(y!==null)if(typeof k=="function")try{k()}catch(j){zn(h,m,j)}finally{h.refCleanup=null,h=h.alternate,h!=null&&(h.refCleanup=null)}else if(typeof y=="function")try{y(null)}catch(j){zn(h,m,j)}else y.current=null}function LR(h){var m=h.type,y=h.memoizedProps,k=h.stateNode;try{e:switch(m){case"button":case"input":case"select":case"textarea":y.autoFocus&&k.focus();break e;case"img":y.src?k.src=y.src:y.srcSet&&(k.srcset=y.srcSet)}}catch(j){zn(h,h.return,j)}}function y1(h,m,y){try{var k=h.stateNode;xY(k,h.type,y,m),k[Qe]=m}catch(j){zn(h,h.return,j)}}function IR(h){return h.tag===5||h.tag===3||h.tag===26||h.tag===27&&yc(h.type)||h.tag===4}function _1(h){e:for(;;){for(;h.sibling===null;){if(h.return===null||IR(h.return))return null;h=h.return}for(h.sibling.return=h.return,h=h.sibling;h.tag!==5&&h.tag!==6&&h.tag!==18;){if(h.tag===27&&yc(h.type)||h.flags&2||h.child===null||h.tag===4)continue e;h.child.return=h,h=h.child}if(!(h.flags&2))return h.stateNode}}function x1(h,m,y){var k=h.tag;if(k===5||k===6)h=h.stateNode,m?(y.nodeType===9?y.body:y.nodeName==="HTML"?y.ownerDocument.body:y).insertBefore(h,m):(m=y.nodeType===9?y.body:y.nodeName==="HTML"?y.ownerDocument.body:y,m.appendChild(h),y=y._reactRootContainer,y!=null||m.onclick!==null||(m.onclick=ia));else if(k!==4&&(k===27&&yc(h.type)&&(y=h.stateNode,m=null),h=h.child,h!==null))for(x1(h,m,y),h=h.sibling;h!==null;)x1(h,m,y),h=h.sibling}function py(h,m,y){var k=h.tag;if(k===5||k===6)h=h.stateNode,m?y.insertBefore(h,m):y.appendChild(h);else if(k!==4&&(k===27&&yc(h.type)&&(y=h.stateNode),h=h.child,h!==null))for(py(h,m,y),h=h.sibling;h!==null;)py(h,m,y),h=h.sibling}function BR(h){var m=h.stateNode,y=h.memoizedProps;try{for(var k=h.type,j=m.attributes;j.length;)m.removeAttributeNode(j[0]);Si(m,k,y),m[L]=h,m[Qe]=y}catch(M){zn(h,h.return,M)}}var ml=!1,Ur=!1,b1=!1,zR=typeof WeakSet=="function"?WeakSet:Set,oi=null;function JK(h,m){if(h=h.containerInfo,H1=Py,h=QT(h),pk(h)){if("selectionStart"in h)var y={start:h.selectionStart,end:h.selectionEnd};else e:{y=(y=h.ownerDocument)&&y.defaultView||window;var k=y.getSelection&&y.getSelection();if(k&&k.rangeCount!==0){y=k.anchorNode;var j=k.anchorOffset,M=k.focusNode;k=k.focusOffset;try{y.nodeType,M.nodeType}catch{y=null;break e}var G=0,ne=-1,he=-1,De=0,Ge=0,tt=h,ze=null;t:for(;;){for(var He;tt!==y||j!==0&&tt.nodeType!==3||(ne=G+j),tt!==M||k!==0&&tt.nodeType!==3||(he=G+k),tt.nodeType===3&&(G+=tt.nodeValue.length),(He=tt.firstChild)!==null;)ze=tt,tt=He;for(;;){if(tt===h)break t;if(ze===y&&++De===j&&(ne=G),ze===M&&++Ge===k&&(he=G),(He=tt.nextSibling)!==null)break;tt=ze,ze=tt.parentNode}tt=He}y=ne===-1||he===-1?null:{start:ne,end:he}}else y=null}y=y||{start:0,end:0}}else y=null;for(W1={focusedElem:h,selectionRange:y},Py=!1,oi=m;oi!==null;)if(m=oi,h=m.child,(m.subtreeFlags&1028)!==0&&h!==null)h.return=m,oi=h;else for(;oi!==null;){switch(m=oi,M=m.alternate,h=m.flags,m.tag){case 0:if((h&4)!==0&&(h=m.updateQueue,h=h!==null?h.events:null,h!==null))for(y=0;y<h.length;y++)j=h[y],j.ref.impl=j.nextImpl;break;case 11:case 15:break;case 1:if((h&1024)!==0&&M!==null){h=void 0,y=m,j=M.memoizedProps,M=M.memoizedState,k=y.stateNode;try{var Rt=Pu(y.type,j);h=k.getSnapshotBeforeUpdate(Rt,M),k.__reactInternalSnapshotBeforeUpdate=h}catch(Vt){zn(y,y.return,Vt)}}break;case 3:if((h&1024)!==0){if(h=m.stateNode.containerInfo,y=h.nodeType,y===9)V1(h);else if(y===1)switch(h.nodeName){case"HEAD":case"HTML":case"BODY":V1(h);break;default:h.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((h&1024)!==0)throw Error(i(163))}if(h=m.sibling,h!==null){h.return=m.return,oi=h;break}oi=m.return}}function $R(h,m,y){var k=y.flags;switch(y.tag){case 0:case 11:case 15:vl(h,y),k&4&&Cp(5,y);break;case 1:if(vl(h,y),k&4)if(h=y.stateNode,m===null)try{h.componentDidMount()}catch(G){zn(y,y.return,G)}else{var j=Pu(y.type,m.memoizedProps);m=m.memoizedState;try{h.componentDidUpdate(j,m,h.__reactInternalSnapshotBeforeUpdate)}catch(G){zn(y,y.return,G)}}k&64&&DR(y),k&512&&jp(y,y.return);break;case 3:if(vl(h,y),k&64&&(h=y.updateQueue,h!==null)){if(m=null,y.child!==null)switch(y.child.tag){case 27:case 5:m=y.child.stateNode;break;case 1:m=y.child.stateNode}try{SM(h,m)}catch(G){zn(y,y.return,G)}}break;case 27:m===null&&k&4&&BR(y);case 26:case 5:vl(h,y),m===null&&k&4&&LR(y),k&512&&jp(y,y.return);break;case 12:vl(h,y);break;case 31:vl(h,y),k&4&&WR(h,y);break;case 13:vl(h,y),k&4&&qR(h,y),k&64&&(h=y.memoizedState,h!==null&&(h=h.dehydrated,h!==null&&(y=lY.bind(null,y),EY(h,y))));break;case 22:if(k=y.memoizedState!==null||ml,!k){m=m!==null&&m.memoizedState!==null||Ur,j=ml;var M=Ur;ml=k,(Ur=m)&&!M?yl(h,y,(y.subtreeFlags&8772)!==0):vl(h,y),ml=j,Ur=M}break;case 30:break;default:vl(h,y)}}function FR(h){var m=h.alternate;m!==null&&(h.alternate=null,FR(m)),h.child=null,h.deletions=null,h.sibling=null,h.tag===5&&(m=h.stateNode,m!==null&&rl(m)),h.stateNode=null,h.return=null,h.dependencies=null,h.memoizedProps=null,h.memoizedState=null,h.pendingProps=null,h.stateNode=null,h.updateQueue=null}var fr=null,ds=!1;function gl(h,m,y){for(y=y.child;y!==null;)HR(h,m,y),y=y.sibling}function HR(h,m,y){if(_e&&typeof _e.onCommitFiberUnmount=="function")try{_e.onCommitFiberUnmount(ye,y)}catch{}switch(y.tag){case 26:Ur||vo(y,m),gl(h,m,y),y.memoizedState?y.memoizedState.count--:y.stateNode&&(y=y.stateNode,y.parentNode.removeChild(y));break;case 27:Ur||vo(y,m);var k=fr,j=ds;yc(y.type)&&(fr=y.stateNode,ds=!1),gl(h,m,y),Pp(y.stateNode),fr=k,ds=j;break;case 5:Ur||vo(y,m);case 6:if(k=fr,j=ds,fr=null,gl(h,m,y),fr=k,ds=j,fr!==null)if(ds)try{(fr.nodeType===9?fr.body:fr.nodeName==="HTML"?fr.ownerDocument.body:fr).removeChild(y.stateNode)}catch(M){zn(y,m,M)}else try{fr.removeChild(y.stateNode)}catch(M){zn(y,m,M)}break;case 18:fr!==null&&(ds?(h=fr,D5(h.nodeType===9?h.body:h.nodeName==="HTML"?h.ownerDocument.body:h,y.stateNode),vh(h)):D5(fr,y.stateNode));break;case 4:k=fr,j=ds,fr=y.stateNode.containerInfo,ds=!0,gl(h,m,y),fr=k,ds=j;break;case 0:case 11:case 14:case 15:dc(2,y,m),Ur||dc(4,y,m),gl(h,m,y);break;case 1:Ur||(vo(y,m),k=y.stateNode,typeof k.componentWillUnmount=="function"&&PR(y,m,k)),gl(h,m,y);break;case 21:gl(h,m,y);break;case 22:Ur=(k=Ur)||y.memoizedState!==null,gl(h,m,y),Ur=k;break;default:gl(h,m,y)}}function WR(h,m){if(m.memoizedState===null&&(h=m.alternate,h!==null&&(h=h.memoizedState,h!==null))){h=h.dehydrated;try{vh(h)}catch(y){zn(m,m.return,y)}}}function qR(h,m){if(m.memoizedState===null&&(h=m.alternate,h!==null&&(h=h.memoizedState,h!==null&&(h=h.dehydrated,h!==null))))try{vh(h)}catch(y){zn(m,m.return,y)}}function eY(h){switch(h.tag){case 31:case 13:case 19:var m=h.stateNode;return m===null&&(m=h.stateNode=new zR),m;case 22:return h=h.stateNode,m=h._retryCache,m===null&&(m=h._retryCache=new zR),m;default:throw Error(i(435,h.tag))}}function my(h,m){var y=eY(h);m.forEach(function(k){if(!y.has(k)){y.add(k);var j=cY.bind(null,h,k);k.then(j,j)}})}function hs(h,m){var y=m.deletions;if(y!==null)for(var k=0;k<y.length;k++){var j=y[k],M=h,G=m,ne=G;e:for(;ne!==null;){switch(ne.tag){case 27:if(yc(ne.type)){fr=ne.stateNode,ds=!1;break e}break;case 5:fr=ne.stateNode,ds=!1;break e;case 3:case 4:fr=ne.stateNode.containerInfo,ds=!0;break e}ne=ne.return}if(fr===null)throw Error(i(160));HR(M,G,j),fr=null,ds=!1,M=j.alternate,M!==null&&(M.return=null),j.return=null}if(m.subtreeFlags&13886)for(m=m.child;m!==null;)UR(m,h),m=m.sibling}var Da=null;function UR(h,m){var y=h.alternate,k=h.flags;switch(h.tag){case 0:case 11:case 14:case 15:hs(m,h),fs(h),k&4&&(dc(3,h,h.return),Cp(3,h),dc(5,h,h.return));break;case 1:hs(m,h),fs(h),k&512&&(Ur||y===null||vo(y,y.return)),k&64&&ml&&(h=h.updateQueue,h!==null&&(k=h.callbacks,k!==null&&(y=h.shared.hiddenCallbacks,h.shared.hiddenCallbacks=y===null?k:y.concat(k))));break;case 26:var j=Da;if(hs(m,h),fs(h),k&512&&(Ur||y===null||vo(y,y.return)),k&4){var M=y!==null?y.memoizedState:null;if(k=h.memoizedState,y===null)if(k===null)if(h.stateNode===null){e:{k=h.type,y=h.memoizedProps,j=j.ownerDocument||j;t:switch(k){case"title":M=j.getElementsByTagName("title")[0],(!M||M[cs]||M[L]||M.namespaceURI==="http://www.w3.org/2000/svg"||M.hasAttribute("itemprop"))&&(M=j.createElement(k),j.head.insertBefore(M,j.querySelector("head > title"))),Si(M,k,y),M[L]=h,Kn(M),k=M;break e;case"link":var G=U5("link","href",j).get(k+(y.href||""));if(G){for(var ne=0;ne<G.length;ne++)if(M=G[ne],M.getAttribute("href")===(y.href==null||y.href===""?null:y.href)&&M.getAttribute("rel")===(y.rel==null?null:y.rel)&&M.getAttribute("title")===(y.title==null?null:y.title)&&M.getAttribute("crossorigin")===(y.crossOrigin==null?null:y.crossOrigin)){G.splice(ne,1);break t}}M=j.createElement(k),Si(M,k,y),j.head.appendChild(M);break;case"meta":if(G=U5("meta","content",j).get(k+(y.content||""))){for(ne=0;ne<G.length;ne++)if(M=G[ne],M.getAttribute("content")===(y.content==null?null:""+y.content)&&M.getAttribute("name")===(y.name==null?null:y.name)&&M.getAttribute("property")===(y.property==null?null:y.property)&&M.getAttribute("http-equiv")===(y.httpEquiv==null?null:y.httpEquiv)&&M.getAttribute("charset")===(y.charSet==null?null:y.charSet)){G.splice(ne,1);break t}}M=j.createElement(k),Si(M,k,y),j.head.appendChild(M);break;default:throw Error(i(468,k))}M[L]=h,Kn(M),k=M}h.stateNode=k}else V5(j,h.type,h.stateNode);else h.stateNode=q5(j,k,h.memoizedProps);else M!==k?(M===null?y.stateNode!==null&&(y=y.stateNode,y.parentNode.removeChild(y)):M.count--,k===null?V5(j,h.type,h.stateNode):q5(j,k,h.memoizedProps)):k===null&&h.stateNode!==null&&y1(h,h.memoizedProps,y.memoizedProps)}break;case 27:hs(m,h),fs(h),k&512&&(Ur||y===null||vo(y,y.return)),y!==null&&k&4&&y1(h,h.memoizedProps,y.memoizedProps);break;case 5:if(hs(m,h),fs(h),k&512&&(Ur||y===null||vo(y,y.return)),h.flags&32){j=h.stateNode;try{uo(j,"")}catch(Rt){zn(h,h.return,Rt)}}k&4&&h.stateNode!=null&&(j=h.memoizedProps,y1(h,j,y!==null?y.memoizedProps:j)),k&1024&&(b1=!0);break;case 6:if(hs(m,h),fs(h),k&4){if(h.stateNode===null)throw Error(i(162));k=h.memoizedProps,y=h.stateNode;try{y.nodeValue=k}catch(Rt){zn(h,h.return,Rt)}}break;case 3:if(My=null,j=Da,Da=Ay(m.containerInfo),hs(m,h),Da=j,fs(h),k&4&&y!==null&&y.memoizedState.isDehydrated)try{vh(m.containerInfo)}catch(Rt){zn(h,h.return,Rt)}b1&&(b1=!1,VR(h));break;case 4:k=Da,Da=Ay(h.stateNode.containerInfo),hs(m,h),fs(h),Da=k;break;case 12:hs(m,h),fs(h);break;case 31:hs(m,h),fs(h),k&4&&(k=h.updateQueue,k!==null&&(h.updateQueue=null,my(h,k)));break;case 13:hs(m,h),fs(h),h.child.flags&8192&&h.memoizedState!==null!=(y!==null&&y.memoizedState!==null)&&(vy=Tt()),k&4&&(k=h.updateQueue,k!==null&&(h.updateQueue=null,my(h,k)));break;case 22:j=h.memoizedState!==null;var he=y!==null&&y.memoizedState!==null,De=ml,Ge=Ur;if(ml=De||j,Ur=Ge||he,hs(m,h),Ur=Ge,ml=De,fs(h),k&8192)e:for(m=h.stateNode,m._visibility=j?m._visibility&-2:m._visibility|1,j&&(y===null||he||ml||Ur||Lu(h)),y=null,m=h;;){if(m.tag===5||m.tag===26){if(y===null){he=y=m;try{if(M=he.stateNode,j)G=M.style,typeof G.setProperty=="function"?G.setProperty("display","none","important"):G.display="none";else{ne=he.stateNode;var tt=he.memoizedProps.style,ze=tt!=null&&tt.hasOwnProperty("display")?tt.display:null;ne.style.display=ze==null||typeof ze=="boolean"?"":(""+ze).trim()}}catch(Rt){zn(he,he.return,Rt)}}}else if(m.tag===6){if(y===null){he=m;try{he.stateNode.nodeValue=j?"":he.memoizedProps}catch(Rt){zn(he,he.return,Rt)}}}else if(m.tag===18){if(y===null){he=m;try{var He=he.stateNode;j?P5(He,!0):P5(he.stateNode,!1)}catch(Rt){zn(he,he.return,Rt)}}}else if((m.tag!==22&&m.tag!==23||m.memoizedState===null||m===h)&&m.child!==null){m.child.return=m,m=m.child;continue}if(m===h)break e;for(;m.sibling===null;){if(m.return===null||m.return===h)break e;y===m&&(y=null),m=m.return}y===m&&(y=null),m.sibling.return=m.return,m=m.sibling}k&4&&(k=h.updateQueue,k!==null&&(y=k.retryQueue,y!==null&&(k.retryQueue=null,my(h,y))));break;case 19:hs(m,h),fs(h),k&4&&(k=h.updateQueue,k!==null&&(h.updateQueue=null,my(h,k)));break;case 30:break;case 21:break;default:hs(m,h),fs(h)}}function fs(h){var m=h.flags;if(m&2){try{for(var y,k=h.return;k!==null;){if(IR(k)){y=k;break}k=k.return}if(y==null)throw Error(i(160));switch(y.tag){case 27:var j=y.stateNode,M=_1(h);py(h,M,j);break;case 5:var G=y.stateNode;y.flags&32&&(uo(G,""),y.flags&=-33);var ne=_1(h);py(h,ne,G);break;case 3:case 4:var he=y.stateNode.containerInfo,De=_1(h);x1(h,De,he);break;default:throw Error(i(161))}}catch(Ge){zn(h,h.return,Ge)}h.flags&=-3}m&4096&&(h.flags&=-4097)}function VR(h){if(h.subtreeFlags&1024)for(h=h.child;h!==null;){var m=h;VR(m),m.tag===5&&m.flags&1024&&m.stateNode.reset(),h=h.sibling}}function vl(h,m){if(m.subtreeFlags&8772)for(m=m.child;m!==null;)$R(h,m.alternate,m),m=m.sibling}function Lu(h){for(h=h.child;h!==null;){var m=h;switch(m.tag){case 0:case 11:case 14:case 15:dc(4,m,m.return),Lu(m);break;case 1:vo(m,m.return);var y=m.stateNode;typeof y.componentWillUnmount=="function"&&PR(m,m.return,y),Lu(m);break;case 27:Pp(m.stateNode);case 26:case 5:vo(m,m.return),Lu(m);break;case 22:m.memoizedState===null&&Lu(m);break;case 30:Lu(m);break;default:Lu(m)}h=h.sibling}}function yl(h,m,y){for(y=y&&(m.subtreeFlags&8772)!==0,m=m.child;m!==null;){var k=m.alternate,j=h,M=m,G=M.flags;switch(M.tag){case 0:case 11:case 15:yl(j,M,y),Cp(4,M);break;case 1:if(yl(j,M,y),k=M,j=k.stateNode,typeof j.componentDidMount=="function")try{j.componentDidMount()}catch(De){zn(k,k.return,De)}if(k=M,j=k.updateQueue,j!==null){var ne=k.stateNode;try{var he=j.shared.hiddenCallbacks;if(he!==null)for(j.shared.hiddenCallbacks=null,j=0;j<he.length;j++)wM(he[j],ne)}catch(De){zn(k,k.return,De)}}y&&G&64&&DR(M),jp(M,M.return);break;case 27:BR(M);case 26:case 5:yl(j,M,y),y&&k===null&&G&4&&LR(M),jp(M,M.return);break;case 12:yl(j,M,y);break;case 31:yl(j,M,y),y&&G&4&&WR(j,M);break;case 13:yl(j,M,y),y&&G&4&&qR(j,M);break;case 22:M.memoizedState===null&&yl(j,M,y),jp(M,M.return);break;case 30:break;default:yl(j,M,y)}m=m.sibling}}function k1(h,m){var y=null;h!==null&&h.memoizedState!==null&&h.memoizedState.cachePool!==null&&(y=h.memoizedState.cachePool.pool),h=null,m.memoizedState!==null&&m.memoizedState.cachePool!==null&&(h=m.memoizedState.cachePool.pool),h!==y&&(h!=null&&h.refCount++,y!=null&&hp(y))}function w1(h,m){h=null,m.alternate!==null&&(h=m.alternate.memoizedState.cache),m=m.memoizedState.cache,m!==h&&(m.refCount++,h!=null&&hp(h))}function Pa(h,m,y,k){if(m.subtreeFlags&10256)for(m=m.child;m!==null;)KR(h,m,y,k),m=m.sibling}function KR(h,m,y,k){var j=m.flags;switch(m.tag){case 0:case 11:case 15:Pa(h,m,y,k),j&2048&&Cp(9,m);break;case 1:Pa(h,m,y,k);break;case 3:Pa(h,m,y,k),j&2048&&(h=null,m.alternate!==null&&(h=m.alternate.memoizedState.cache),m=m.memoizedState.cache,m!==h&&(m.refCount++,h!=null&&hp(h)));break;case 12:if(j&2048){Pa(h,m,y,k),h=m.stateNode;try{var M=m.memoizedProps,G=M.id,ne=M.onPostCommit;typeof ne=="function"&&ne(G,m.alternate===null?"mount":"update",h.passiveEffectDuration,-0)}catch(he){zn(m,m.return,he)}}else Pa(h,m,y,k);break;case 31:Pa(h,m,y,k);break;case 13:Pa(h,m,y,k);break;case 23:break;case 22:M=m.stateNode,G=m.alternate,m.memoizedState!==null?M._visibility&2?Pa(h,m,y,k):Np(h,m):M._visibility&2?Pa(h,m,y,k):(M._visibility|=2,ah(h,m,y,k,(m.subtreeFlags&10256)!==0||!1)),j&2048&&k1(G,m);break;case 24:Pa(h,m,y,k),j&2048&&w1(m.alternate,m);break;default:Pa(h,m,y,k)}}function ah(h,m,y,k,j){for(j=j&&((m.subtreeFlags&10256)!==0||!1),m=m.child;m!==null;){var M=h,G=m,ne=y,he=k,De=G.flags;switch(G.tag){case 0:case 11:case 15:ah(M,G,ne,he,j),Cp(8,G);break;case 23:break;case 22:var Ge=G.stateNode;G.memoizedState!==null?Ge._visibility&2?ah(M,G,ne,he,j):Np(M,G):(Ge._visibility|=2,ah(M,G,ne,he,j)),j&&De&2048&&k1(G.alternate,G);break;case 24:ah(M,G,ne,he,j),j&&De&2048&&w1(G.alternate,G);break;default:ah(M,G,ne,he,j)}m=m.sibling}}function Np(h,m){if(m.subtreeFlags&10256)for(m=m.child;m!==null;){var y=h,k=m,j=k.flags;switch(k.tag){case 22:Np(y,k),j&2048&&k1(k.alternate,k);break;case 24:Np(y,k),j&2048&&w1(k.alternate,k);break;default:Np(y,k)}m=m.sibling}}var Ep=8192;function oh(h,m,y){if(h.subtreeFlags&Ep)for(h=h.child;h!==null;)YR(h,m,y),h=h.sibling}function YR(h,m,y){switch(h.tag){case 26:oh(h,m,y),h.flags&Ep&&h.memoizedState!==null&&$Y(y,Da,h.memoizedState,h.memoizedProps);break;case 5:oh(h,m,y);break;case 3:case 4:var k=Da;Da=Ay(h.stateNode.containerInfo),oh(h,m,y),Da=k;break;case 22:h.memoizedState===null&&(k=h.alternate,k!==null&&k.memoizedState!==null?(k=Ep,Ep=16777216,oh(h,m,y),Ep=k):oh(h,m,y));break;default:oh(h,m,y)}}function GR(h){var m=h.alternate;if(m!==null&&(h=m.child,h!==null)){m.child=null;do m=h.sibling,h.sibling=null,h=m;while(h!==null)}}function Ap(h){var m=h.deletions;if((h.flags&16)!==0){if(m!==null)for(var y=0;y<m.length;y++){var k=m[y];oi=k,QR(k,h)}GR(h)}if(h.subtreeFlags&10256)for(h=h.child;h!==null;)XR(h),h=h.sibling}function XR(h){switch(h.tag){case 0:case 11:case 15:Ap(h),h.flags&2048&&dc(9,h,h.return);break;case 3:Ap(h);break;case 12:Ap(h);break;case 22:var m=h.stateNode;h.memoizedState!==null&&m._visibility&2&&(h.return===null||h.return.tag!==13)?(m._visibility&=-3,gy(h)):Ap(h);break;default:Ap(h)}}function gy(h){var m=h.deletions;if((h.flags&16)!==0){if(m!==null)for(var y=0;y<m.length;y++){var k=m[y];oi=k,QR(k,h)}GR(h)}for(h=h.child;h!==null;){switch(m=h,m.tag){case 0:case 11:case 15:dc(8,m,m.return),gy(m);break;case 22:y=m.stateNode,y._visibility&2&&(y._visibility&=-3,gy(m));break;default:gy(m)}h=h.sibling}}function QR(h,m){for(;oi!==null;){var y=oi;switch(y.tag){case 0:case 11:case 15:dc(8,y,m);break;case 23:case 22:if(y.memoizedState!==null&&y.memoizedState.cachePool!==null){var k=y.memoizedState.cachePool.pool;k!=null&&k.refCount++}break;case 24:hp(y.memoizedState.cache)}if(k=y.child,k!==null)k.return=y,oi=k;else e:for(y=h;oi!==null;){k=oi;var j=k.sibling,M=k.return;if(FR(k),k===y){oi=null;break e}if(j!==null){j.return=M,oi=j;break e}oi=M}}}var tY={getCacheForType:function(h){var m=ki(Hr),y=m.data.get(h);return y===void 0&&(y=h(),m.data.set(h,y)),y},cacheSignal:function(){return ki(Hr).controller.signal}},nY=typeof WeakMap=="function"?WeakMap:Map,Dn=0,Xn=null,fn=null,gn=0,Bn=0,zs=null,hc=!1,lh=!1,S1=!1,_l=0,Ar=0,fc=0,Iu=0,C1=0,$s=0,ch=0,Tp=null,ps=null,j1=!1,vy=0,ZR=0,yy=1/0,_y=null,pc=null,Jr=0,mc=null,uh=null,xl=0,N1=0,E1=null,JR=null,Mp=0,A1=null;function Fs(){return(Dn&2)!==0&&gn!==0?gn&-gn:I.T!==null?P1():yi()}function e5(){if($s===0)if((gn&536870912)===0||_n){var h=Ne;Ne<<=1,(Ne&3932160)===0&&(Ne=262144),$s=h}else $s=536870912;return h=Is.current,h!==null&&(h.flags|=32),$s}function ms(h,m,y){(h===Xn&&(Bn===2||Bn===9)||h.cancelPendingCommit!==null)&&(dh(h,0),gc(h,gn,$s,!1)),xe(h,y),((Dn&2)===0||h!==Xn)&&(h===Xn&&((Dn&2)===0&&(Iu|=y),Ar===4&&gc(h,gn,$s,!1)),yo(h))}function t5(h,m,y){if((Dn&6)!==0)throw Error(i(327));var k=!y&&(m&127)===0&&(m&h.expiredLanes)===0||it(h,m),j=k?sY(h,m):M1(h,m,!0),M=k;do{if(j===0){lh&&!k&&gc(h,m,0,!1);break}else{if(y=h.current.alternate,M&&!rY(y)){j=M1(h,m,!1),M=!1;continue}if(j===2){if(M=m,h.errorRecoveryDisabledLanes&M)var G=0;else G=h.pendingLanes&-536870913,G=G!==0?G:G&536870912?536870912:0;if(G!==0){m=G;e:{var ne=h;j=Tp;var he=ne.current.memoizedState.isDehydrated;if(he&&(dh(ne,G).flags|=256),G=M1(ne,G,!1),G!==2){if(S1&&!he){ne.errorRecoveryDisabledLanes|=M,Iu|=M,j=4;break e}M=ps,ps=j,M!==null&&(ps===null?ps=M:ps.push.apply(ps,M))}j=G}if(M=!1,j!==2)continue}}if(j===1){dh(h,0),gc(h,m,0,!0);break}e:{switch(k=h,M=j,M){case 0:case 1:throw Error(i(345));case 4:if((m&4194048)!==m)break;case 6:gc(k,m,$s,!hc);break e;case 2:ps=null;break;case 3:case 5:break;default:throw Error(i(329))}if((m&62914560)===m&&(j=vy+300-Tt(),10<j)){if(gc(k,m,$s,!hc),Ye(k,0,!0)!==0)break e;xl=m,k.timeoutHandle=R5(n5.bind(null,k,y,ps,_y,j1,m,$s,Iu,ch,hc,M,"Throttled",-0,0),j);break e}n5(k,y,ps,_y,j1,m,$s,Iu,ch,hc,M,null,-0,0)}}break}while(!0);yo(h)}function n5(h,m,y,k,j,M,G,ne,he,De,Ge,tt,ze,He){if(h.timeoutHandle=-1,tt=m.subtreeFlags,tt&8192||(tt&16785408)===16785408){tt={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:ia},YR(m,M,tt);var Rt=(M&62914560)===M?vy-Tt():(M&4194048)===M?ZR-Tt():0;if(Rt=FY(tt,Rt),Rt!==null){xl=M,h.cancelPendingCommit=Rt(u5.bind(null,h,m,M,y,k,j,G,ne,he,Ge,tt,null,ze,He)),gc(h,M,G,!De);return}}u5(h,m,M,y,k,j,G,ne,he)}function rY(h){for(var m=h;;){var y=m.tag;if((y===0||y===11||y===15)&&m.flags&16384&&(y=m.updateQueue,y!==null&&(y=y.stores,y!==null)))for(var k=0;k<y.length;k++){var j=y[k],M=j.getSnapshot;j=j.value;try{if(!Ps(M(),j))return!1}catch{return!1}}if(y=m.child,m.subtreeFlags&16384&&y!==null)y.return=m,m=y;else{if(m===h)break;for(;m.sibling===null;){if(m.return===null||m.return===h)return!0;m=m.return}m.sibling.return=m.return,m=m.sibling}}return!0}function gc(h,m,y,k){m&=~C1,m&=~Iu,h.suspendedLanes|=m,h.pingedLanes&=~m,k&&(h.warmLanes|=m),k=h.expirationTimes;for(var j=m;0<j;){var M=31-ee(j),G=1<<M;k[M]=-1,j&=~G}y!==0&&dt(h,y,m)}function xy(){return(Dn&6)===0?(Rp(0),!1):!0}function T1(){if(fn!==null){if(Bn===0)var h=fn.return;else h=fn,cl=Eu=null,Vk(h),th=null,pp=0,h=fn;for(;h!==null;)OR(h.alternate,h),h=h.return;fn=null}}function dh(h,m){var y=h.timeoutHandle;y!==-1&&(h.timeoutHandle=-1,wY(y)),y=h.cancelPendingCommit,y!==null&&(h.cancelPendingCommit=null,y()),xl=0,T1(),Xn=h,fn=y=ol(h.current,null),gn=m,Bn=0,zs=null,hc=!1,lh=it(h,m),S1=!1,ch=$s=C1=Iu=fc=Ar=0,ps=Tp=null,j1=!1,(m&8)!==0&&(m|=m&32);var k=h.entangledLanes;if(k!==0)for(h=h.entanglements,k&=m;0<k;){var j=31-ee(k),M=1<<j;m|=h[j],k&=~M}return _l=m,Fv(),y}function r5(h,m){Jt=null,I.H=kp,m===eh||m===Gv?(m=_M(),Bn=3):m===Dk?(m=_M(),Bn=4):Bn=m===l1?8:m!==null&&typeof m=="object"&&typeof m.then=="function"?6:1,zs=m,fn===null&&(Ar=1,cy(h,aa(m,h.current)))}function i5(){var h=Is.current;return h===null?!0:(gn&4194048)===gn?ua===null:(gn&62914560)===gn||(gn&536870912)!==0?h===ua:!1}function s5(){var h=I.H;return I.H=kp,h===null?kp:h}function a5(){var h=I.A;return I.A=tY,h}function by(){Ar=4,hc||(gn&4194048)!==gn&&Is.current!==null||(lh=!0),(fc&134217727)===0&&(Iu&134217727)===0||Xn===null||gc(Xn,gn,$s,!1)}function M1(h,m,y){var k=Dn;Dn|=2;var j=s5(),M=a5();(Xn!==h||gn!==m)&&(_y=null,dh(h,m)),m=!1;var G=Ar;e:do try{if(Bn!==0&&fn!==null){var ne=fn,he=zs;switch(Bn){case 8:T1(),G=6;break e;case 3:case 2:case 9:case 6:Is.current===null&&(m=!0);var De=Bn;if(Bn=0,zs=null,hh(h,ne,he,De),y&&lh){G=0;break e}break;default:De=Bn,Bn=0,zs=null,hh(h,ne,he,De)}}iY(),G=Ar;break}catch(Ge){r5(h,Ge)}while(!0);return m&&h.shellSuspendCounter++,cl=Eu=null,Dn=k,I.H=j,I.A=M,fn===null&&(Xn=null,gn=0,Fv()),G}function iY(){for(;fn!==null;)o5(fn)}function sY(h,m){var y=Dn;Dn|=2;var k=s5(),j=a5();Xn!==h||gn!==m?(_y=null,yy=Tt()+500,dh(h,m)):lh=it(h,m);e:do try{if(Bn!==0&&fn!==null){m=fn;var M=zs;t:switch(Bn){case 1:Bn=0,zs=null,hh(h,m,M,1);break;case 2:case 9:if(vM(M)){Bn=0,zs=null,l5(m);break}m=function(){Bn!==2&&Bn!==9||Xn!==h||(Bn=7),yo(h)},M.then(m,m);break e;case 3:Bn=7;break e;case 4:Bn=5;break e;case 7:vM(M)?(Bn=0,zs=null,l5(m)):(Bn=0,zs=null,hh(h,m,M,7));break;case 5:var G=null;switch(fn.tag){case 26:G=fn.memoizedState;case 5:case 27:var ne=fn;if(G?K5(G):ne.stateNode.complete){Bn=0,zs=null;var he=ne.sibling;if(he!==null)fn=he;else{var De=ne.return;De!==null?(fn=De,ky(De)):fn=null}break t}}Bn=0,zs=null,hh(h,m,M,5);break;case 6:Bn=0,zs=null,hh(h,m,M,6);break;case 8:T1(),Ar=6;break e;default:throw Error(i(462))}}aY();break}catch(Ge){r5(h,Ge)}while(!0);return cl=Eu=null,I.H=k,I.A=j,Dn=y,fn!==null?0:(Xn=null,gn=0,Fv(),Ar)}function aY(){for(;fn!==null&&!ct();)o5(fn)}function o5(h){var m=MR(h.alternate,h,_l);h.memoizedProps=h.pendingProps,m===null?ky(h):fn=m}function l5(h){var m=h,y=m.alternate;switch(m.tag){case 15:case 0:m=CR(y,m,m.pendingProps,m.type,void 0,gn);break;case 11:m=CR(y,m,m.pendingProps,m.type.render,m.ref,gn);break;case 5:Vk(m);default:OR(y,m),m=fn=aM(m,_l),m=MR(y,m,_l)}h.memoizedProps=h.pendingProps,m===null?ky(h):fn=m}function hh(h,m,y,k){cl=Eu=null,Vk(m),th=null,pp=0;var j=m.return;try{if(YK(h,j,m,y,gn)){Ar=1,cy(h,aa(y,h.current)),fn=null;return}}catch(M){if(j!==null)throw fn=j,M;Ar=1,cy(h,aa(y,h.current)),fn=null;return}m.flags&32768?(_n||k===1?h=!0:lh||(gn&536870912)!==0?h=!1:(hc=h=!0,(k===2||k===9||k===3||k===6)&&(k=Is.current,k!==null&&k.tag===13&&(k.flags|=16384))),c5(m,h)):ky(m)}function ky(h){var m=h;do{if((m.flags&32768)!==0){c5(m,hc);return}h=m.return;var y=QK(m.alternate,m,_l);if(y!==null){fn=y;return}if(m=m.sibling,m!==null){fn=m;return}fn=m=h}while(m!==null);Ar===0&&(Ar=5)}function c5(h,m){do{var y=ZK(h.alternate,h);if(y!==null){y.flags&=32767,fn=y;return}if(y=h.return,y!==null&&(y.flags|=32768,y.subtreeFlags=0,y.deletions=null),!m&&(h=h.sibling,h!==null)){fn=h;return}fn=h=y}while(h!==null);Ar=6,fn=null}function u5(h,m,y,k,j,M,G,ne,he){h.cancelPendingCommit=null;do wy();while(Jr!==0);if((Dn&6)!==0)throw Error(i(327));if(m!==null){if(m===h.current)throw Error(i(177));if(M=m.lanes|m.childLanes,M|=_k,qe(h,y,M,G,ne,he),h===Xn&&(fn=Xn=null,gn=0),uh=m,mc=h,xl=y,N1=M,E1=j,JR=k,(m.subtreeFlags&10256)!==0||(m.flags&10256)!==0?(h.callbackNode=null,h.callbackPriority=0,uY(bt,function(){return m5(),null})):(h.callbackNode=null,h.callbackPriority=0),k=(m.flags&13878)!==0,(m.subtreeFlags&13878)!==0||k){k=I.T,I.T=null,j=Q.p,Q.p=2,G=Dn,Dn|=4;try{JK(h,m,y)}finally{Dn=G,Q.p=j,I.T=k}}Jr=1,d5(),h5(),f5()}}function d5(){if(Jr===1){Jr=0;var h=mc,m=uh,y=(m.flags&13878)!==0;if((m.subtreeFlags&13878)!==0||y){y=I.T,I.T=null;var k=Q.p;Q.p=2;var j=Dn;Dn|=4;try{UR(m,h);var M=W1,G=QT(h.containerInfo),ne=M.focusedElem,he=M.selectionRange;if(G!==ne&&ne&&ne.ownerDocument&&XT(ne.ownerDocument.documentElement,ne)){if(he!==null&&pk(ne)){var De=he.start,Ge=he.end;if(Ge===void 0&&(Ge=De),"selectionStart"in ne)ne.selectionStart=De,ne.selectionEnd=Math.min(Ge,ne.value.length);else{var tt=ne.ownerDocument||document,ze=tt&&tt.defaultView||window;if(ze.getSelection){var He=ze.getSelection(),Rt=ne.textContent.length,Vt=Math.min(he.start,Rt),Wn=he.end===void 0?Vt:Math.min(he.end,Rt);!He.extend&&Vt>Wn&&(G=Wn,Wn=Vt,Vt=G);var Ae=GT(ne,Vt),be=GT(ne,Wn);if(Ae&&be&&(He.rangeCount!==1||He.anchorNode!==Ae.node||He.anchorOffset!==Ae.offset||He.focusNode!==be.node||He.focusOffset!==be.offset)){var Oe=tt.createRange();Oe.setStart(Ae.node,Ae.offset),He.removeAllRanges(),Vt>Wn?(He.addRange(Oe),He.extend(be.node,be.offset)):(Oe.setEnd(be.node,be.offset),He.addRange(Oe))}}}}for(tt=[],He=ne;He=He.parentNode;)He.nodeType===1&&tt.push({element:He,left:He.scrollLeft,top:He.scrollTop});for(typeof ne.focus=="function"&&ne.focus(),ne=0;ne<tt.length;ne++){var Je=tt[ne];Je.element.scrollLeft=Je.left,Je.element.scrollTop=Je.top}}Py=!!H1,W1=H1=null}finally{Dn=j,Q.p=k,I.T=y}}h.current=m,Jr=2}}function h5(){if(Jr===2){Jr=0;var h=mc,m=uh,y=(m.flags&8772)!==0;if((m.subtreeFlags&8772)!==0||y){y=I.T,I.T=null;var k=Q.p;Q.p=2;var j=Dn;Dn|=4;try{$R(h,m.alternate,m)}finally{Dn=j,Q.p=k,I.T=y}}Jr=3}}function f5(){if(Jr===4||Jr===3){Jr=0,Mt();var h=mc,m=uh,y=xl,k=JR;(m.subtreeFlags&10256)!==0||(m.flags&10256)!==0?Jr=5:(Jr=0,uh=mc=null,p5(h,h.pendingLanes));var j=h.pendingLanes;if(j===0&&(pc=null),rr(y),m=m.stateNode,_e&&typeof _e.onCommitFiberRoot=="function")try{_e.onCommitFiberRoot(ye,m,void 0,(m.current.flags&128)===128)}catch{}if(k!==null){m=I.T,j=Q.p,Q.p=2,I.T=null;try{for(var M=h.onRecoverableError,G=0;G<k.length;G++){var ne=k[G];M(ne.value,{componentStack:ne.stack})}}finally{I.T=m,Q.p=j}}(xl&3)!==0&&wy(),yo(h),j=h.pendingLanes,(y&261930)!==0&&(j&42)!==0?h===A1?Mp++:(Mp=0,A1=h):Mp=0,Rp(0)}}function p5(h,m){(h.pooledCacheLanes&=m)===0&&(m=h.pooledCache,m!=null&&(h.pooledCache=null,hp(m)))}function wy(){return d5(),h5(),f5(),m5()}function m5(){if(Jr!==5)return!1;var h=mc,m=N1;N1=0;var y=rr(xl),k=I.T,j=Q.p;try{Q.p=32>y?32:y,I.T=null,y=E1,E1=null;var M=mc,G=xl;if(Jr=0,uh=mc=null,xl=0,(Dn&6)!==0)throw Error(i(331));var ne=Dn;if(Dn|=4,XR(M.current),KR(M,M.current,G,y),Dn=ne,Rp(0,!1),_e&&typeof _e.onPostCommitFiberRoot=="function")try{_e.onPostCommitFiberRoot(ye,M)}catch{}return!0}finally{Q.p=j,I.T=k,p5(h,m)}}function g5(h,m,y){m=aa(y,m),m=o1(h.stateNode,m,2),h=lc(h,m,2),h!==null&&(xe(h,2),yo(h))}function zn(h,m,y){if(h.tag===3)g5(h,h,y);else for(;m!==null;){if(m.tag===3){g5(m,h,y);break}else if(m.tag===1){var k=m.stateNode;if(typeof m.type.getDerivedStateFromError=="function"||typeof k.componentDidCatch=="function"&&(pc===null||!pc.has(k))){h=aa(y,h),y=vR(2),k=lc(m,y,2),k!==null&&(yR(y,k,m,h),xe(k,2),yo(k));break}}m=m.return}}function R1(h,m,y){var k=h.pingCache;if(k===null){k=h.pingCache=new nY;var j=new Set;k.set(m,j)}else j=k.get(m),j===void 0&&(j=new Set,k.set(m,j));j.has(y)||(S1=!0,j.add(y),h=oY.bind(null,h,m,y),m.then(h,h))}function oY(h,m,y){var k=h.pingCache;k!==null&&k.delete(m),h.pingedLanes|=h.suspendedLanes&y,h.warmLanes&=~y,Xn===h&&(gn&y)===y&&(Ar===4||Ar===3&&(gn&62914560)===gn&&300>Tt()-vy?(Dn&2)===0&&dh(h,0):C1|=y,ch===gn&&(ch=0)),yo(h)}function v5(h,m){m===0&&(m=mt()),h=Cu(h,m),h!==null&&(xe(h,m),yo(h))}function lY(h){var m=h.memoizedState,y=0;m!==null&&(y=m.retryLane),v5(h,y)}function cY(h,m){var y=0;switch(h.tag){case 31:case 13:var k=h.stateNode,j=h.memoizedState;j!==null&&(y=j.retryLane);break;case 19:k=h.stateNode;break;case 22:k=h.stateNode._retryCache;break;default:throw Error(i(314))}k!==null&&k.delete(m),v5(h,y)}function uY(h,m){return $e(h,m)}var Sy=null,fh=null,O1=!1,Cy=!1,D1=!1,vc=0;function yo(h){h!==fh&&h.next===null&&(fh===null?Sy=fh=h:fh=fh.next=h),Cy=!0,O1||(O1=!0,hY())}function Rp(h,m){if(!D1&&Cy){D1=!0;do for(var y=!1,k=Sy;k!==null;){if(h!==0){var j=k.pendingLanes;if(j===0)var M=0;else{var G=k.suspendedLanes,ne=k.pingedLanes;M=(1<<31-ee(42|h)+1)-1,M&=j&~(G&~ne),M=M&201326741?M&201326741|1:M?M|2:0}M!==0&&(y=!0,b5(k,M))}else M=gn,M=Ye(k,k===Xn?M:0,k.cancelPendingCommit!==null||k.timeoutHandle!==-1),(M&3)===0||it(k,M)||(y=!0,b5(k,M));k=k.next}while(y);D1=!1}}function dY(){y5()}function y5(){Cy=O1=!1;var h=0;vc!==0&&kY()&&(h=vc);for(var m=Tt(),y=null,k=Sy;k!==null;){var j=k.next,M=_5(k,m);M===0?(k.next=null,y===null?Sy=j:y.next=j,j===null&&(fh=y)):(y=k,(h!==0||(M&3)!==0)&&(Cy=!0)),k=j}Jr!==0&&Jr!==5||Rp(h),vc!==0&&(vc=0)}function _5(h,m){for(var y=h.suspendedLanes,k=h.pingedLanes,j=h.expirationTimes,M=h.pendingLanes&-62914561;0<M;){var G=31-ee(M),ne=1<<G,he=j[G];he===-1?((ne&y)===0||(ne&k)!==0)&&(j[G]=kt(ne,m)):he<=m&&(h.expiredLanes|=ne),M&=~ne}if(m=Xn,y=gn,y=Ye(h,h===m?y:0,h.cancelPendingCommit!==null||h.timeoutHandle!==-1),k=h.callbackNode,y===0||h===m&&(Bn===2||Bn===9)||h.cancelPendingCommit!==null)return k!==null&&k!==null&&Bt(k),h.callbackNode=null,h.callbackPriority=0;if((y&3)===0||it(h,y)){if(m=y&-y,m===h.callbackPriority)return m;switch(k!==null&&Bt(k),rr(y)){case 2:case 8:y=et;break;case 32:y=bt;break;case 268435456:y=O;break;default:y=bt}return k=x5.bind(null,h),y=$e(y,k),h.callbackPriority=m,h.callbackNode=y,m}return k!==null&&k!==null&&Bt(k),h.callbackPriority=2,h.callbackNode=null,2}function x5(h,m){if(Jr!==0&&Jr!==5)return h.callbackNode=null,h.callbackPriority=0,null;var y=h.callbackNode;if(wy()&&h.callbackNode!==y)return null;var k=gn;return k=Ye(h,h===Xn?k:0,h.cancelPendingCommit!==null||h.timeoutHandle!==-1),k===0?null:(t5(h,k,m),_5(h,Tt()),h.callbackNode!=null&&h.callbackNode===y?x5.bind(null,h):null)}function b5(h,m){if(wy())return null;t5(h,m,!0)}function hY(){SY(function(){(Dn&6)!==0?$e(Re,dY):y5()})}function P1(){if(vc===0){var h=Zd;h===0&&(h=Me,Me<<=1,(Me&261888)===0&&(Me=256)),vc=h}return vc}function k5(h){return h==null||typeof h=="symbol"||typeof h=="boolean"?null:typeof h=="function"?h:Fd(""+h)}function w5(h,m){var y=m.ownerDocument.createElement("input");return y.name=m.name,y.value=m.value,h.id&&y.setAttribute("form",h.id),m.parentNode.insertBefore(y,m),h=new FormData(h),y.parentNode.removeChild(y),h}function fY(h,m,y,k,j){if(m==="submit"&&y&&y.stateNode===j){var M=k5((j[Qe]||null).action),G=k.submitter;G&&(m=(m=G[Qe]||null)?k5(m.formAction):G.getAttribute("formAction"),m!==null&&(M=m,G=null));var ne=new Gn("action","action",null,k,j);h.push({event:ne,listeners:[{instance:null,listener:function(){if(k.defaultPrevented){if(vc!==0){var he=G?w5(j,G):new FormData(j);t1(y,{pending:!0,data:he,method:j.method,action:M},null,he)}}else typeof M=="function"&&(ne.preventDefault(),he=G?w5(j,G):new FormData(j),t1(y,{pending:!0,data:he,method:j.method,action:M},M,he))},currentTarget:j}]})}}for(var L1=0;L1<yk.length;L1++){var I1=yk[L1],pY=I1.toLowerCase(),mY=I1[0].toUpperCase()+I1.slice(1);Oa(pY,"on"+mY)}Oa(eM,"onAnimationEnd"),Oa(tM,"onAnimationIteration"),Oa(nM,"onAnimationStart"),Oa("dblclick","onDoubleClick"),Oa("focusin","onFocus"),Oa("focusout","onBlur"),Oa(MK,"onTransitionRun"),Oa(RK,"onTransitionStart"),Oa(OK,"onTransitionCancel"),Oa(rM,"onTransitionEnd"),ra("onMouseEnter",["mouseout","mouseover"]),ra("onMouseLeave",["mouseout","mouseover"]),ra("onPointerEnter",["pointerout","pointerover"]),ra("onPointerLeave",["pointerout","pointerover"]),Rs("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Rs("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Rs("onBeforeInput",["compositionend","keypress","textInput","paste"]),Rs("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Rs("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Rs("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Op="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),gY=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Op));function S5(h,m){m=(m&4)!==0;for(var y=0;y<h.length;y++){var k=h[y],j=k.event;k=k.listeners;e:{var M=void 0;if(m)for(var G=k.length-1;0<=G;G--){var ne=k[G],he=ne.instance,De=ne.currentTarget;if(ne=ne.listener,he!==M&&j.isPropagationStopped())break e;M=ne,j.currentTarget=De;try{M(j)}catch(Ge){$v(Ge)}j.currentTarget=null,M=he}else for(G=0;G<k.length;G++){if(ne=k[G],he=ne.instance,De=ne.currentTarget,ne=ne.listener,he!==M&&j.isPropagationStopped())break e;M=ne,j.currentTarget=De;try{M(j)}catch(Ge){$v(Ge)}j.currentTarget=null,M=he}}}}function pn(h,m){var y=m[Gt];y===void 0&&(y=m[Gt]=new Set);var k=h+"__bubble";y.has(k)||(C5(m,h,2,!1),y.add(k))}function B1(h,m,y){var k=0;m&&(k|=4),C5(y,h,k,m)}var jy="_reactListening"+Math.random().toString(36).slice(2);function z1(h){if(!h[jy]){h[jy]=!0,il.forEach(function(y){y!=="selectionchange"&&(gY.has(y)||B1(y,!1,h),B1(y,!0,h))});var m=h.nodeType===9?h:h.ownerDocument;m===null||m[jy]||(m[jy]=!0,B1("selectionchange",!1,m))}}function C5(h,m,y,k){switch(e3(m)){case 2:var j=qY;break;case 8:j=UY;break;default:j=ew}y=j.bind(null,m,y,h),j=void 0,!ht||m!=="touchstart"&&m!=="touchmove"&&m!=="wheel"||(j=!0),k?j!==void 0?h.addEventListener(m,y,{capture:!0,passive:j}):h.addEventListener(m,y,!0):j!==void 0?h.addEventListener(m,y,{passive:j}):h.addEventListener(m,y,!1)}function $1(h,m,y,k,j){var M=k;if((m&1)===0&&(m&2)===0&&k!==null)e:for(;;){if(k===null)return;var G=k.tag;if(G===3||G===4){var ne=k.stateNode.containerInfo;if(ne===j)break;if(G===4)for(G=k.return;G!==null;){var he=G.tag;if((he===3||he===4)&&G.stateNode.containerInfo===j)return;G=G.return}for(;ne!==null;){if(G=us(ne),G===null)return;if(he=G.tag,he===5||he===6||he===26||he===27){k=M=G;continue e}ne=ne.parentNode}}k=k.return}Fe(function(){var De=M,Ge=Hd(y),tt=[];e:{var ze=iM.get(h);if(ze!==void 0){var He=Gn,Rt=h;switch(h){case"keypress":if(wn(y)===0)break e;case"keydown":case"keyup":He=cK;break;case"focusin":Rt="focus",He=ck;break;case"focusout":Rt="blur",He=ck;break;case"beforeblur":case"afterblur":He=ck;break;case"click":if(y.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":He=OT;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":He=QV;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":He=hK;break;case eM:case tM:case nM:He=eK;break;case rM:He=pK;break;case"scroll":case"scrollend":He=fo;break;case"wheel":He=gK;break;case"copy":case"cut":case"paste":He=nK;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":He=PT;break;case"toggle":case"beforetoggle":He=yK}var Vt=(m&4)!==0,Wn=!Vt&&(h==="scroll"||h==="scrollend"),Ae=Vt?ze!==null?ze+"Capture":null:ze;Vt=[];for(var be=De,Oe;be!==null;){var Je=be;if(Oe=Je.stateNode,Je=Je.tag,Je!==5&&Je!==26&&Je!==27||Oe===null||Ae===null||(Je=Ve(be,Ae),Je!=null&&Vt.push(Dp(be,Je,Oe))),Wn)break;be=be.return}0<Vt.length&&(ze=new He(ze,Rt,null,y,Ge),tt.push({event:ze,listeners:Vt}))}}if((m&7)===0){e:{if(ze=h==="mouseover"||h==="pointerover",He=h==="mouseout"||h==="pointerout",ze&&y!==ip&&(Rt=y.relatedTarget||y.fromElement)&&(us(Rt)||Rt[_t]))break e;if((He||ze)&&(ze=Ge.window===Ge?Ge:(ze=Ge.ownerDocument)?ze.defaultView||ze.parentWindow:window,He?(Rt=y.relatedTarget||y.toElement,He=De,Rt=Rt?us(Rt):null,Rt!==null&&(Wn=a(Rt),Vt=Rt.tag,Rt!==Wn||Vt!==5&&Vt!==27&&Vt!==6)&&(Rt=null)):(He=null,Rt=De),He!==Rt)){if(Vt=OT,Je="onMouseLeave",Ae="onMouseEnter",be="mouse",(h==="pointerout"||h==="pointerover")&&(Vt=PT,Je="onPointerLeave",Ae="onPointerEnter",be="pointer"),Wn=He==null?ze:Ki(He),Oe=Rt==null?ze:Ki(Rt),ze=new Vt(Je,be+"leave",He,y,Ge),ze.target=Wn,ze.relatedTarget=Oe,Je=null,us(Ge)===De&&(Vt=new Vt(Ae,be+"enter",Rt,y,Ge),Vt.target=Oe,Vt.relatedTarget=Wn,Je=Vt),Wn=Je,He&&Rt)t:{for(Vt=vY,Ae=He,be=Rt,Oe=0,Je=Ae;Je;Je=Vt(Je))Oe++;Je=0;for(var $t=be;$t;$t=Vt($t))Je++;for(;0<Oe-Je;)Ae=Vt(Ae),Oe--;for(;0<Je-Oe;)be=Vt(be),Je--;for(;Oe--;){if(Ae===be||be!==null&&Ae===be.alternate){Vt=Ae;break t}Ae=Vt(Ae),be=Vt(be)}Vt=null}else Vt=null;He!==null&&j5(tt,ze,He,Vt,!1),Rt!==null&&Wn!==null&&j5(tt,Wn,Rt,Vt,!0)}}e:{if(ze=De?Ki(De):window,He=ze.nodeName&&ze.nodeName.toLowerCase(),He==="select"||He==="input"&&ze.type==="file")var Tn=WT;else if(FT(ze))if(qT)Tn=EK;else{Tn=jK;var Pt=CK}else He=ze.nodeName,!He||He.toLowerCase()!=="input"||ze.type!=="checkbox"&&ze.type!=="radio"?De&&rp(De.elementType)&&(Tn=WT):Tn=NK;if(Tn&&(Tn=Tn(h,De))){HT(tt,Tn,y,Ge);break e}Pt&&Pt(h,ze,De),h==="focusout"&&De&&ze.type==="number"&&De.memoizedProps.value!=null&&Oi(ze,"number",ze.value)}switch(Pt=De?Ki(De):window,h){case"focusin":(FT(Pt)||Pt.contentEditable==="true")&&(qd=Pt,mk=De,cp=null);break;case"focusout":cp=mk=qd=null;break;case"mousedown":gk=!0;break;case"contextmenu":case"mouseup":case"dragend":gk=!1,ZT(tt,y,Ge);break;case"selectionchange":if(TK)break;case"keydown":case"keyup":ZT(tt,y,Ge)}var en;if(dk)e:{switch(h){case"compositionstart":var vn="onCompositionStart";break e;case"compositionend":vn="onCompositionEnd";break e;case"compositionupdate":vn="onCompositionUpdate";break e}vn=void 0}else Wd?zT(h,y)&&(vn="onCompositionEnd"):h==="keydown"&&y.keyCode===229&&(vn="onCompositionStart");vn&&(LT&&y.locale!=="ko"&&(Wd||vn!=="onCompositionStart"?vn==="onCompositionEnd"&&Wd&&(en=Ht()):(dn=Ge,An="value"in dn?dn.value:dn.textContent,Wd=!0)),Pt=Ny(De,vn),0<Pt.length&&(vn=new DT(vn,h,null,y,Ge),tt.push({event:vn,listeners:Pt}),en?vn.data=en:(en=$T(y),en!==null&&(vn.data=en)))),(en=xK?bK(h,y):kK(h,y))&&(vn=Ny(De,"onBeforeInput"),0<vn.length&&(Pt=new DT("onBeforeInput","beforeinput",null,y,Ge),tt.push({event:Pt,listeners:vn}),Pt.data=en)),fY(tt,h,De,y,Ge)}S5(tt,m)})}function Dp(h,m,y){return{instance:h,listener:m,currentTarget:y}}function Ny(h,m){for(var y=m+"Capture",k=[];h!==null;){var j=h,M=j.stateNode;if(j=j.tag,j!==5&&j!==26&&j!==27||M===null||(j=Ve(h,y),j!=null&&k.unshift(Dp(h,j,M)),j=Ve(h,m),j!=null&&k.push(Dp(h,j,M))),h.tag===3)return k;h=h.return}return[]}function vY(h){if(h===null)return null;do h=h.return;while(h&&h.tag!==5&&h.tag!==27);return h||null}function j5(h,m,y,k,j){for(var M=m._reactName,G=[];y!==null&&y!==k;){var ne=y,he=ne.alternate,De=ne.stateNode;if(ne=ne.tag,he!==null&&he===k)break;ne!==5&&ne!==26&&ne!==27||De===null||(he=De,j?(De=Ve(y,M),De!=null&&G.unshift(Dp(y,De,he))):j||(De=Ve(y,M),De!=null&&G.push(Dp(y,De,he)))),y=y.return}G.length!==0&&h.push({event:m,listeners:G})}var yY=/\r\n?/g,_Y=/\u0000|\uFFFD/g;function N5(h){return(typeof h=="string"?h:""+h).replace(yY,`
`).replace(_Y,"")}function E5(h,m){return m=N5(m),N5(h)===m}function Hn(h,m,y,k,j,M){switch(y){case"children":typeof k=="string"?m==="body"||m==="textarea"&&k===""||uo(h,k):(typeof k=="number"||typeof k=="bigint")&&m!=="body"&&uo(h,""+k);break;case"className":Ds(h,"class",k);break;case"tabIndex":Ds(h,"tabindex",k);break;case"dir":case"role":case"viewBox":case"width":case"height":Ds(h,y,k);break;case"style":Iv(h,k,M);break;case"data":if(m!=="object"){Ds(h,"data",k);break}case"src":case"href":if(k===""&&(m!=="a"||y!=="href")){h.removeAttribute(y);break}if(k==null||typeof k=="function"||typeof k=="symbol"||typeof k=="boolean"){h.removeAttribute(y);break}k=Fd(""+k),h.setAttribute(y,k);break;case"action":case"formAction":if(typeof k=="function"){h.setAttribute(y,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof M=="function"&&(y==="formAction"?(m!=="input"&&Hn(h,m,"name",j.name,j,null),Hn(h,m,"formEncType",j.formEncType,j,null),Hn(h,m,"formMethod",j.formMethod,j,null),Hn(h,m,"formTarget",j.formTarget,j,null)):(Hn(h,m,"encType",j.encType,j,null),Hn(h,m,"method",j.method,j,null),Hn(h,m,"target",j.target,j,null)));if(k==null||typeof k=="symbol"||typeof k=="boolean"){h.removeAttribute(y);break}k=Fd(""+k),h.setAttribute(y,k);break;case"onClick":k!=null&&(h.onclick=ia);break;case"onScroll":k!=null&&pn("scroll",h);break;case"onScrollEnd":k!=null&&pn("scrollend",h);break;case"dangerouslySetInnerHTML":if(k!=null){if(typeof k!="object"||!("__html"in k))throw Error(i(61));if(y=k.__html,y!=null){if(j.children!=null)throw Error(i(60));h.innerHTML=y}}break;case"multiple":h.multiple=k&&typeof k!="function"&&typeof k!="symbol";break;case"muted":h.muted=k&&typeof k!="function"&&typeof k!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(k==null||typeof k=="function"||typeof k=="boolean"||typeof k=="symbol"){h.removeAttribute("xlink:href");break}y=Fd(""+k),h.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",y);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":k!=null&&typeof k!="function"&&typeof k!="symbol"?h.setAttribute(y,""+k):h.removeAttribute(y);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":k&&typeof k!="function"&&typeof k!="symbol"?h.setAttribute(y,""):h.removeAttribute(y);break;case"capture":case"download":k===!0?h.setAttribute(y,""):k!==!1&&k!=null&&typeof k!="function"&&typeof k!="symbol"?h.setAttribute(y,k):h.removeAttribute(y);break;case"cols":case"rows":case"size":case"span":k!=null&&typeof k!="function"&&typeof k!="symbol"&&!isNaN(k)&&1<=k?h.setAttribute(y,k):h.removeAttribute(y);break;case"rowSpan":case"start":k==null||typeof k=="function"||typeof k=="symbol"||isNaN(k)?h.removeAttribute(y):h.setAttribute(y,k);break;case"popover":pn("beforetoggle",h),pn("toggle",h),hr(h,"popover",k);break;case"xlinkActuate":Zr(h,"http://www.w3.org/1999/xlink","xlink:actuate",k);break;case"xlinkArcrole":Zr(h,"http://www.w3.org/1999/xlink","xlink:arcrole",k);break;case"xlinkRole":Zr(h,"http://www.w3.org/1999/xlink","xlink:role",k);break;case"xlinkShow":Zr(h,"http://www.w3.org/1999/xlink","xlink:show",k);break;case"xlinkTitle":Zr(h,"http://www.w3.org/1999/xlink","xlink:title",k);break;case"xlinkType":Zr(h,"http://www.w3.org/1999/xlink","xlink:type",k);break;case"xmlBase":Zr(h,"http://www.w3.org/XML/1998/namespace","xml:base",k);break;case"xmlLang":Zr(h,"http://www.w3.org/XML/1998/namespace","xml:lang",k);break;case"xmlSpace":Zr(h,"http://www.w3.org/XML/1998/namespace","xml:space",k);break;case"is":hr(h,"is",k);break;case"innerText":case"textContent":break;default:(!(2<y.length)||y[0]!=="o"&&y[0]!=="O"||y[1]!=="n"&&y[1]!=="N")&&(y=ok.get(y)||y,hr(h,y,k))}}function F1(h,m,y,k,j,M){switch(y){case"style":Iv(h,k,M);break;case"dangerouslySetInnerHTML":if(k!=null){if(typeof k!="object"||!("__html"in k))throw Error(i(61));if(y=k.__html,y!=null){if(j.children!=null)throw Error(i(60));h.innerHTML=y}}break;case"children":typeof k=="string"?uo(h,k):(typeof k=="number"||typeof k=="bigint")&&uo(h,""+k);break;case"onScroll":k!=null&&pn("scroll",h);break;case"onScrollEnd":k!=null&&pn("scrollend",h);break;case"onClick":k!=null&&(h.onclick=ia);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!tc.hasOwnProperty(y))e:{if(y[0]==="o"&&y[1]==="n"&&(j=y.endsWith("Capture"),m=y.slice(2,j?y.length-7:void 0),M=h[Qe]||null,M=M!=null?M[y]:null,typeof M=="function"&&h.removeEventListener(m,M,j),typeof k=="function")){typeof M!="function"&&M!==null&&(y in h?h[y]=null:h.hasAttribute(y)&&h.removeAttribute(y)),h.addEventListener(m,k,j);break e}y in h?h[y]=k:k===!0?h.setAttribute(y,""):hr(h,y,k)}}}function Si(h,m,y){switch(m){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":pn("error",h),pn("load",h);var k=!1,j=!1,M;for(M in y)if(y.hasOwnProperty(M)){var G=y[M];if(G!=null)switch(M){case"src":k=!0;break;case"srcSet":j=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,m));default:Hn(h,m,M,G,y,null)}}j&&Hn(h,m,"srcSet",y.srcSet,y,null),k&&Hn(h,m,"src",y.src,y,null);return;case"input":pn("invalid",h);var ne=M=G=j=null,he=null,De=null;for(k in y)if(y.hasOwnProperty(k)){var Ge=y[k];if(Ge!=null)switch(k){case"name":j=Ge;break;case"type":G=Ge;break;case"checked":he=Ge;break;case"defaultChecked":De=Ge;break;case"value":M=Ge;break;case"defaultValue":ne=Ge;break;case"children":case"dangerouslySetInnerHTML":if(Ge!=null)throw Error(i(137,m));break;default:Hn(h,m,k,Ge,y,null)}}Yn(h,M,ne,he,De,G,j,!1);return;case"select":pn("invalid",h),k=G=M=null;for(j in y)if(y.hasOwnProperty(j)&&(ne=y[j],ne!=null))switch(j){case"value":M=ne;break;case"defaultValue":G=ne;break;case"multiple":k=ne;default:Hn(h,m,j,ne,y,null)}m=M,y=G,h.multiple=!!k,m!=null?Di(h,!!k,m,!1):y!=null&&Di(h,!!k,y,!0);return;case"textarea":pn("invalid",h),M=j=k=null;for(G in y)if(y.hasOwnProperty(G)&&(ne=y[G],ne!=null))switch(G){case"value":k=ne;break;case"defaultValue":j=ne;break;case"children":M=ne;break;case"dangerouslySetInnerHTML":if(ne!=null)throw Error(i(91));break;default:Hn(h,m,G,ne,y,null)}$d(h,k,j,M);return;case"option":for(he in y)if(y.hasOwnProperty(he)&&(k=y[he],k!=null))switch(he){case"selected":h.selected=k&&typeof k!="function"&&typeof k!="symbol";break;default:Hn(h,m,he,k,y,null)}return;case"dialog":pn("beforetoggle",h),pn("toggle",h),pn("cancel",h),pn("close",h);break;case"iframe":case"object":pn("load",h);break;case"video":case"audio":for(k=0;k<Op.length;k++)pn(Op[k],h);break;case"image":pn("error",h),pn("load",h);break;case"details":pn("toggle",h);break;case"embed":case"source":case"link":pn("error",h),pn("load",h);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(De in y)if(y.hasOwnProperty(De)&&(k=y[De],k!=null))switch(De){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,m));default:Hn(h,m,De,k,y,null)}return;default:if(rp(m)){for(Ge in y)y.hasOwnProperty(Ge)&&(k=y[Ge],k!==void 0&&F1(h,m,Ge,k,y,void 0));return}}for(ne in y)y.hasOwnProperty(ne)&&(k=y[ne],k!=null&&Hn(h,m,ne,k,y,null))}function xY(h,m,y,k){switch(m){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var j=null,M=null,G=null,ne=null,he=null,De=null,Ge=null;for(He in y){var tt=y[He];if(y.hasOwnProperty(He)&&tt!=null)switch(He){case"checked":break;case"value":break;case"defaultValue":he=tt;default:k.hasOwnProperty(He)||Hn(h,m,He,null,k,tt)}}for(var ze in k){var He=k[ze];if(tt=y[ze],k.hasOwnProperty(ze)&&(He!=null||tt!=null))switch(ze){case"type":M=He;break;case"name":j=He;break;case"checked":De=He;break;case"defaultChecked":Ge=He;break;case"value":G=He;break;case"defaultValue":ne=He;break;case"children":case"dangerouslySetInnerHTML":if(He!=null)throw Error(i(137,m));break;default:He!==tt&&Hn(h,m,ze,He,k,tt)}}Ft(h,G,ne,he,De,Ge,M,j);return;case"select":He=G=ne=ze=null;for(M in y)if(he=y[M],y.hasOwnProperty(M)&&he!=null)switch(M){case"value":break;case"multiple":He=he;default:k.hasOwnProperty(M)||Hn(h,m,M,null,k,he)}for(j in k)if(M=k[j],he=y[j],k.hasOwnProperty(j)&&(M!=null||he!=null))switch(j){case"value":ze=M;break;case"defaultValue":ne=M;break;case"multiple":G=M;default:M!==he&&Hn(h,m,j,M,k,he)}m=ne,y=G,k=He,ze!=null?Di(h,!!y,ze,!1):!!k!=!!y&&(m!=null?Di(h,!!y,m,!0):Di(h,!!y,y?[]:"",!1));return;case"textarea":He=ze=null;for(ne in y)if(j=y[ne],y.hasOwnProperty(ne)&&j!=null&&!k.hasOwnProperty(ne))switch(ne){case"value":break;case"children":break;default:Hn(h,m,ne,null,k,j)}for(G in k)if(j=k[G],M=y[G],k.hasOwnProperty(G)&&(j!=null||M!=null))switch(G){case"value":ze=j;break;case"defaultValue":He=j;break;case"children":break;case"dangerouslySetInnerHTML":if(j!=null)throw Error(i(91));break;default:j!==M&&Hn(h,m,G,j,k,M)}tp(h,ze,He);return;case"option":for(var Rt in y)if(ze=y[Rt],y.hasOwnProperty(Rt)&&ze!=null&&!k.hasOwnProperty(Rt))switch(Rt){case"selected":h.selected=!1;break;default:Hn(h,m,Rt,null,k,ze)}for(he in k)if(ze=k[he],He=y[he],k.hasOwnProperty(he)&&ze!==He&&(ze!=null||He!=null))switch(he){case"selected":h.selected=ze&&typeof ze!="function"&&typeof ze!="symbol";break;default:Hn(h,m,he,ze,k,He)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Vt in y)ze=y[Vt],y.hasOwnProperty(Vt)&&ze!=null&&!k.hasOwnProperty(Vt)&&Hn(h,m,Vt,null,k,ze);for(De in k)if(ze=k[De],He=y[De],k.hasOwnProperty(De)&&ze!==He&&(ze!=null||He!=null))switch(De){case"children":case"dangerouslySetInnerHTML":if(ze!=null)throw Error(i(137,m));break;default:Hn(h,m,De,ze,k,He)}return;default:if(rp(m)){for(var Wn in y)ze=y[Wn],y.hasOwnProperty(Wn)&&ze!==void 0&&!k.hasOwnProperty(Wn)&&F1(h,m,Wn,void 0,k,ze);for(Ge in k)ze=k[Ge],He=y[Ge],!k.hasOwnProperty(Ge)||ze===He||ze===void 0&&He===void 0||F1(h,m,Ge,ze,k,He);return}}for(var Ae in y)ze=y[Ae],y.hasOwnProperty(Ae)&&ze!=null&&!k.hasOwnProperty(Ae)&&Hn(h,m,Ae,null,k,ze);for(tt in k)ze=k[tt],He=y[tt],!k.hasOwnProperty(tt)||ze===He||ze==null&&He==null||Hn(h,m,tt,ze,k,He)}function A5(h){switch(h){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function bY(){if(typeof performance.getEntriesByType=="function"){for(var h=0,m=0,y=performance.getEntriesByType("resource"),k=0;k<y.length;k++){var j=y[k],M=j.transferSize,G=j.initiatorType,ne=j.duration;if(M&&ne&&A5(G)){for(G=0,ne=j.responseEnd,k+=1;k<y.length;k++){var he=y[k],De=he.startTime;if(De>ne)break;var Ge=he.transferSize,tt=he.initiatorType;Ge&&A5(tt)&&(he=he.responseEnd,G+=Ge*(he<ne?1:(ne-De)/(he-De)))}if(--k,m+=8*(M+G)/(j.duration/1e3),h++,10<h)break}}if(0<h)return m/h/1e6}return navigator.connection&&(h=navigator.connection.downlink,typeof h=="number")?h:5}var H1=null,W1=null;function Ey(h){return h.nodeType===9?h:h.ownerDocument}function T5(h){switch(h){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function M5(h,m){if(h===0)switch(m){case"svg":return 1;case"math":return 2;default:return 0}return h===1&&m==="foreignObject"?0:h}function q1(h,m){return h==="textarea"||h==="noscript"||typeof m.children=="string"||typeof m.children=="number"||typeof m.children=="bigint"||typeof m.dangerouslySetInnerHTML=="object"&&m.dangerouslySetInnerHTML!==null&&m.dangerouslySetInnerHTML.__html!=null}var U1=null;function kY(){var h=window.event;return h&&h.type==="popstate"?h===U1?!1:(U1=h,!0):(U1=null,!1)}var R5=typeof setTimeout=="function"?setTimeout:void 0,wY=typeof clearTimeout=="function"?clearTimeout:void 0,O5=typeof Promise=="function"?Promise:void 0,SY=typeof queueMicrotask=="function"?queueMicrotask:typeof O5<"u"?function(h){return O5.resolve(null).then(h).catch(CY)}:R5;function CY(h){setTimeout(function(){throw h})}function yc(h){return h==="head"}function D5(h,m){var y=m,k=0;do{var j=y.nextSibling;if(h.removeChild(y),j&&j.nodeType===8)if(y=j.data,y==="/$"||y==="/&"){if(k===0){h.removeChild(j),vh(m);return}k--}else if(y==="$"||y==="$?"||y==="$~"||y==="$!"||y==="&")k++;else if(y==="html")Pp(h.ownerDocument.documentElement);else if(y==="head"){y=h.ownerDocument.head,Pp(y);for(var M=y.firstChild;M;){var G=M.nextSibling,ne=M.nodeName;M[cs]||ne==="SCRIPT"||ne==="STYLE"||ne==="LINK"&&M.rel.toLowerCase()==="stylesheet"||y.removeChild(M),M=G}}else y==="body"&&Pp(h.ownerDocument.body);y=j}while(y);vh(m)}function P5(h,m){var y=h;h=0;do{var k=y.nextSibling;if(y.nodeType===1?m?(y._stashedDisplay=y.style.display,y.style.display="none"):(y.style.display=y._stashedDisplay||"",y.getAttribute("style")===""&&y.removeAttribute("style")):y.nodeType===3&&(m?(y._stashedText=y.nodeValue,y.nodeValue=""):y.nodeValue=y._stashedText||""),k&&k.nodeType===8)if(y=k.data,y==="/$"){if(h===0)break;h--}else y!=="$"&&y!=="$?"&&y!=="$~"&&y!=="$!"||h++;y=k}while(y)}function V1(h){var m=h.firstChild;for(m&&m.nodeType===10&&(m=m.nextSibling);m;){var y=m;switch(m=m.nextSibling,y.nodeName){case"HTML":case"HEAD":case"BODY":V1(y),rl(y);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(y.rel.toLowerCase()==="stylesheet")continue}h.removeChild(y)}}function jY(h,m,y,k){for(;h.nodeType===1;){var j=y;if(h.nodeName.toLowerCase()!==m.toLowerCase()){if(!k&&(h.nodeName!=="INPUT"||h.type!=="hidden"))break}else if(k){if(!h[cs])switch(m){case"meta":if(!h.hasAttribute("itemprop"))break;return h;case"link":if(M=h.getAttribute("rel"),M==="stylesheet"&&h.hasAttribute("data-precedence"))break;if(M!==j.rel||h.getAttribute("href")!==(j.href==null||j.href===""?null:j.href)||h.getAttribute("crossorigin")!==(j.crossOrigin==null?null:j.crossOrigin)||h.getAttribute("title")!==(j.title==null?null:j.title))break;return h;case"style":if(h.hasAttribute("data-precedence"))break;return h;case"script":if(M=h.getAttribute("src"),(M!==(j.src==null?null:j.src)||h.getAttribute("type")!==(j.type==null?null:j.type)||h.getAttribute("crossorigin")!==(j.crossOrigin==null?null:j.crossOrigin))&&M&&h.hasAttribute("async")&&!h.hasAttribute("itemprop"))break;return h;default:return h}}else if(m==="input"&&h.type==="hidden"){var M=j.name==null?null:""+j.name;if(j.type==="hidden"&&h.getAttribute("name")===M)return h}else return h;if(h=da(h.nextSibling),h===null)break}return null}function NY(h,m,y){if(m==="")return null;for(;h.nodeType!==3;)if((h.nodeType!==1||h.nodeName!=="INPUT"||h.type!=="hidden")&&!y||(h=da(h.nextSibling),h===null))return null;return h}function L5(h,m){for(;h.nodeType!==8;)if((h.nodeType!==1||h.nodeName!=="INPUT"||h.type!=="hidden")&&!m||(h=da(h.nextSibling),h===null))return null;return h}function K1(h){return h.data==="$?"||h.data==="$~"}function Y1(h){return h.data==="$!"||h.data==="$?"&&h.ownerDocument.readyState!=="loading"}function EY(h,m){var y=h.ownerDocument;if(h.data==="$~")h._reactRetry=m;else if(h.data!=="$?"||y.readyState!=="loading")m();else{var k=function(){m(),y.removeEventListener("DOMContentLoaded",k)};y.addEventListener("DOMContentLoaded",k),h._reactRetry=k}}function da(h){for(;h!=null;h=h.nextSibling){var m=h.nodeType;if(m===1||m===3)break;if(m===8){if(m=h.data,m==="$"||m==="$!"||m==="$?"||m==="$~"||m==="&"||m==="F!"||m==="F")break;if(m==="/$"||m==="/&")return null}}return h}var G1=null;function I5(h){h=h.nextSibling;for(var m=0;h;){if(h.nodeType===8){var y=h.data;if(y==="/$"||y==="/&"){if(m===0)return da(h.nextSibling);m--}else y!=="$"&&y!=="$!"&&y!=="$?"&&y!=="$~"&&y!=="&"||m++}h=h.nextSibling}return null}function B5(h){h=h.previousSibling;for(var m=0;h;){if(h.nodeType===8){var y=h.data;if(y==="$"||y==="$!"||y==="$?"||y==="$~"||y==="&"){if(m===0)return h;m--}else y!=="/$"&&y!=="/&"||m++}h=h.previousSibling}return null}function z5(h,m,y){switch(m=Ey(y),h){case"html":if(h=m.documentElement,!h)throw Error(i(452));return h;case"head":if(h=m.head,!h)throw Error(i(453));return h;case"body":if(h=m.body,!h)throw Error(i(454));return h;default:throw Error(i(451))}}function Pp(h){for(var m=h.attributes;m.length;)h.removeAttributeNode(m[0]);rl(h)}var ha=new Map,$5=new Set;function Ay(h){return typeof h.getRootNode=="function"?h.getRootNode():h.nodeType===9?h:h.ownerDocument}var bl=Q.d;Q.d={f:AY,r:TY,D:MY,C:RY,L:OY,m:DY,X:LY,S:PY,M:IY};function AY(){var h=bl.f(),m=xy();return h||m}function TY(h){var m=Ri(h);m!==null&&m.tag===5&&m.type==="form"?rR(m):bl.r(h)}var ph=typeof document>"u"?null:document;function F5(h,m,y){var k=ph;if(k&&typeof m=="string"&&m){var j=xt(m);j='link[rel="'+h+'"][href="'+j+'"]',typeof y=="string"&&(j+='[crossorigin="'+y+'"]'),$5.has(j)||($5.add(j),h={rel:h,crossOrigin:y,href:m},k.querySelector(j)===null&&(m=k.createElement("link"),Si(m,"link",h),Kn(m),k.head.appendChild(m)))}}function MY(h){bl.D(h),F5("dns-prefetch",h,null)}function RY(h,m){bl.C(h,m),F5("preconnect",h,m)}function OY(h,m,y){bl.L(h,m,y);var k=ph;if(k&&h&&m){var j='link[rel="preload"][as="'+xt(m)+'"]';m==="image"&&y&&y.imageSrcSet?(j+='[imagesrcset="'+xt(y.imageSrcSet)+'"]',typeof y.imageSizes=="string"&&(j+='[imagesizes="'+xt(y.imageSizes)+'"]')):j+='[href="'+xt(h)+'"]';var M=j;switch(m){case"style":M=mh(h);break;case"script":M=gh(h)}ha.has(M)||(h=f({rel:"preload",href:m==="image"&&y&&y.imageSrcSet?void 0:h,as:m},y),ha.set(M,h),k.querySelector(j)!==null||m==="style"&&k.querySelector(Lp(M))||m==="script"&&k.querySelector(Ip(M))||(m=k.createElement("link"),Si(m,"link",h),Kn(m),k.head.appendChild(m)))}}function DY(h,m){bl.m(h,m);var y=ph;if(y&&h){var k=m&&typeof m.as=="string"?m.as:"script",j='link[rel="modulepreload"][as="'+xt(k)+'"][href="'+xt(h)+'"]',M=j;switch(k){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":M=gh(h)}if(!ha.has(M)&&(h=f({rel:"modulepreload",href:h},m),ha.set(M,h),y.querySelector(j)===null)){switch(k){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(y.querySelector(Ip(M)))return}k=y.createElement("link"),Si(k,"link",h),Kn(k),y.head.appendChild(k)}}}function PY(h,m,y){bl.S(h,m,y);var k=ph;if(k&&h){var j=Fr(k).hoistableStyles,M=mh(h);m=m||"default";var G=j.get(M);if(!G){var ne={loading:0,preload:null};if(G=k.querySelector(Lp(M)))ne.loading=5;else{h=f({rel:"stylesheet",href:h,"data-precedence":m},y),(y=ha.get(M))&&X1(h,y);var he=G=k.createElement("link");Kn(he),Si(he,"link",h),he._p=new Promise(function(De,Ge){he.onload=De,he.onerror=Ge}),he.addEventListener("load",function(){ne.loading|=1}),he.addEventListener("error",function(){ne.loading|=2}),ne.loading|=4,Ty(G,m,k)}G={type:"stylesheet",instance:G,count:1,state:ne},j.set(M,G)}}}function LY(h,m){bl.X(h,m);var y=ph;if(y&&h){var k=Fr(y).hoistableScripts,j=gh(h),M=k.get(j);M||(M=y.querySelector(Ip(j)),M||(h=f({src:h,async:!0},m),(m=ha.get(j))&&Q1(h,m),M=y.createElement("script"),Kn(M),Si(M,"link",h),y.head.appendChild(M)),M={type:"script",instance:M,count:1,state:null},k.set(j,M))}}function IY(h,m){bl.M(h,m);var y=ph;if(y&&h){var k=Fr(y).hoistableScripts,j=gh(h),M=k.get(j);M||(M=y.querySelector(Ip(j)),M||(h=f({src:h,async:!0,type:"module"},m),(m=ha.get(j))&&Q1(h,m),M=y.createElement("script"),Kn(M),Si(M,"link",h),y.head.appendChild(M)),M={type:"script",instance:M,count:1,state:null},k.set(j,M))}}function H5(h,m,y,k){var j=(j=X.current)?Ay(j):null;if(!j)throw Error(i(446));switch(h){case"meta":case"title":return null;case"style":return typeof y.precedence=="string"&&typeof y.href=="string"?(m=mh(y.href),y=Fr(j).hoistableStyles,k=y.get(m),k||(k={type:"style",instance:null,count:0,state:null},y.set(m,k)),k):{type:"void",instance:null,count:0,state:null};case"link":if(y.rel==="stylesheet"&&typeof y.href=="string"&&typeof y.precedence=="string"){h=mh(y.href);var M=Fr(j).hoistableStyles,G=M.get(h);if(G||(j=j.ownerDocument||j,G={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},M.set(h,G),(M=j.querySelector(Lp(h)))&&!M._p&&(G.instance=M,G.state.loading=5),ha.has(h)||(y={rel:"preload",as:"style",href:y.href,crossOrigin:y.crossOrigin,integrity:y.integrity,media:y.media,hrefLang:y.hrefLang,referrerPolicy:y.referrerPolicy},ha.set(h,y),M||BY(j,h,y,G.state))),m&&k===null)throw Error(i(528,""));return G}if(m&&k!==null)throw Error(i(529,""));return null;case"script":return m=y.async,y=y.src,typeof y=="string"&&m&&typeof m!="function"&&typeof m!="symbol"?(m=gh(y),y=Fr(j).hoistableScripts,k=y.get(m),k||(k={type:"script",instance:null,count:0,state:null},y.set(m,k)),k):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,h))}}function mh(h){return'href="'+xt(h)+'"'}function Lp(h){return'link[rel="stylesheet"]['+h+"]"}function W5(h){return f({},h,{"data-precedence":h.precedence,precedence:null})}function BY(h,m,y,k){h.querySelector('link[rel="preload"][as="style"]['+m+"]")?k.loading=1:(m=h.createElement("link"),k.preload=m,m.addEventListener("load",function(){return k.loading|=1}),m.addEventListener("error",function(){return k.loading|=2}),Si(m,"link",y),Kn(m),h.head.appendChild(m))}function gh(h){return'[src="'+xt(h)+'"]'}function Ip(h){return"script[async]"+h}function q5(h,m,y){if(m.count++,m.instance===null)switch(m.type){case"style":var k=h.querySelector('style[data-href~="'+xt(y.href)+'"]');if(k)return m.instance=k,Kn(k),k;var j=f({},y,{"data-href":y.href,"data-precedence":y.precedence,href:null,precedence:null});return k=(h.ownerDocument||h).createElement("style"),Kn(k),Si(k,"style",j),Ty(k,y.precedence,h),m.instance=k;case"stylesheet":j=mh(y.href);var M=h.querySelector(Lp(j));if(M)return m.state.loading|=4,m.instance=M,Kn(M),M;k=W5(y),(j=ha.get(j))&&X1(k,j),M=(h.ownerDocument||h).createElement("link"),Kn(M);var G=M;return G._p=new Promise(function(ne,he){G.onload=ne,G.onerror=he}),Si(M,"link",k),m.state.loading|=4,Ty(M,y.precedence,h),m.instance=M;case"script":return M=gh(y.src),(j=h.querySelector(Ip(M)))?(m.instance=j,Kn(j),j):(k=y,(j=ha.get(M))&&(k=f({},y),Q1(k,j)),h=h.ownerDocument||h,j=h.createElement("script"),Kn(j),Si(j,"link",k),h.head.appendChild(j),m.instance=j);case"void":return null;default:throw Error(i(443,m.type))}else m.type==="stylesheet"&&(m.state.loading&4)===0&&(k=m.instance,m.state.loading|=4,Ty(k,y.precedence,h));return m.instance}function Ty(h,m,y){for(var k=y.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),j=k.length?k[k.length-1]:null,M=j,G=0;G<k.length;G++){var ne=k[G];if(ne.dataset.precedence===m)M=ne;else if(M!==j)break}M?M.parentNode.insertBefore(h,M.nextSibling):(m=y.nodeType===9?y.head:y,m.insertBefore(h,m.firstChild))}function X1(h,m){h.crossOrigin==null&&(h.crossOrigin=m.crossOrigin),h.referrerPolicy==null&&(h.referrerPolicy=m.referrerPolicy),h.title==null&&(h.title=m.title)}function Q1(h,m){h.crossOrigin==null&&(h.crossOrigin=m.crossOrigin),h.referrerPolicy==null&&(h.referrerPolicy=m.referrerPolicy),h.integrity==null&&(h.integrity=m.integrity)}var My=null;function U5(h,m,y){if(My===null){var k=new Map,j=My=new Map;j.set(y,k)}else j=My,k=j.get(y),k||(k=new Map,j.set(y,k));if(k.has(h))return k;for(k.set(h,null),y=y.getElementsByTagName(h),j=0;j<y.length;j++){var M=y[j];if(!(M[cs]||M[L]||h==="link"&&M.getAttribute("rel")==="stylesheet")&&M.namespaceURI!=="http://www.w3.org/2000/svg"){var G=M.getAttribute(m)||"";G=h+G;var ne=k.get(G);ne?ne.push(M):k.set(G,[M])}}return k}function V5(h,m,y){h=h.ownerDocument||h,h.head.insertBefore(y,m==="title"?h.querySelector("head > title"):null)}function zY(h,m,y){if(y===1||m.itemProp!=null)return!1;switch(h){case"meta":case"title":return!0;case"style":if(typeof m.precedence!="string"||typeof m.href!="string"||m.href==="")break;return!0;case"link":if(typeof m.rel!="string"||typeof m.href!="string"||m.href===""||m.onLoad||m.onError)break;switch(m.rel){case"stylesheet":return h=m.disabled,typeof m.precedence=="string"&&h==null;default:return!0}case"script":if(m.async&&typeof m.async!="function"&&typeof m.async!="symbol"&&!m.onLoad&&!m.onError&&m.src&&typeof m.src=="string")return!0}return!1}function K5(h){return!(h.type==="stylesheet"&&(h.state.loading&3)===0)}function $Y(h,m,y,k){if(y.type==="stylesheet"&&(typeof k.media!="string"||matchMedia(k.media).matches!==!1)&&(y.state.loading&4)===0){if(y.instance===null){var j=mh(k.href),M=m.querySelector(Lp(j));if(M){m=M._p,m!==null&&typeof m=="object"&&typeof m.then=="function"&&(h.count++,h=Ry.bind(h),m.then(h,h)),y.state.loading|=4,y.instance=M,Kn(M);return}M=m.ownerDocument||m,k=W5(k),(j=ha.get(j))&&X1(k,j),M=M.createElement("link"),Kn(M);var G=M;G._p=new Promise(function(ne,he){G.onload=ne,G.onerror=he}),Si(M,"link",k),y.instance=M}h.stylesheets===null&&(h.stylesheets=new Map),h.stylesheets.set(y,m),(m=y.state.preload)&&(y.state.loading&3)===0&&(h.count++,y=Ry.bind(h),m.addEventListener("load",y),m.addEventListener("error",y))}}var Z1=0;function FY(h,m){return h.stylesheets&&h.count===0&&Dy(h,h.stylesheets),0<h.count||0<h.imgCount?function(y){var k=setTimeout(function(){if(h.stylesheets&&Dy(h,h.stylesheets),h.unsuspend){var M=h.unsuspend;h.unsuspend=null,M()}},6e4+m);0<h.imgBytes&&Z1===0&&(Z1=62500*bY());var j=setTimeout(function(){if(h.waitingForImages=!1,h.count===0&&(h.stylesheets&&Dy(h,h.stylesheets),h.unsuspend)){var M=h.unsuspend;h.unsuspend=null,M()}},(h.imgBytes>Z1?50:800)+m);return h.unsuspend=y,function(){h.unsuspend=null,clearTimeout(k),clearTimeout(j)}}:null}function Ry(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Dy(this,this.stylesheets);else if(this.unsuspend){var h=this.unsuspend;this.unsuspend=null,h()}}}var Oy=null;function Dy(h,m){h.stylesheets=null,h.unsuspend!==null&&(h.count++,Oy=new Map,m.forEach(HY,h),Oy=null,Ry.call(h))}function HY(h,m){if(!(m.state.loading&4)){var y=Oy.get(h);if(y)var k=y.get(null);else{y=new Map,Oy.set(h,y);for(var j=h.querySelectorAll("link[data-precedence],style[data-precedence]"),M=0;M<j.length;M++){var G=j[M];(G.nodeName==="LINK"||G.getAttribute("media")!=="not all")&&(y.set(G.dataset.precedence,G),k=G)}k&&y.set(null,k)}j=m.instance,G=j.getAttribute("data-precedence"),M=y.get(G)||k,M===k&&y.set(null,j),y.set(G,j),this.count++,k=Ry.bind(this),j.addEventListener("load",k),j.addEventListener("error",k),M?M.parentNode.insertBefore(j,M.nextSibling):(h=h.nodeType===9?h.head:h,h.insertBefore(j,h.firstChild)),m.state.loading|=4}}var Bp={$$typeof:C,Provider:null,Consumer:null,_currentValue:K,_currentValue2:K,_threadCount:0};function WY(h,m,y,k,j,M,G,ne,he){this.tag=1,this.containerInfo=h,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=zt(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=zt(0),this.hiddenUpdates=zt(null),this.identifierPrefix=k,this.onUncaughtError=j,this.onCaughtError=M,this.onRecoverableError=G,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=he,this.incompleteTransitions=new Map}function Y5(h,m,y,k,j,M,G,ne,he,De,Ge,tt){return h=new WY(h,m,y,G,he,De,Ge,tt,ne),m=1,M===!0&&(m|=24),M=Ls(3,null,null,m),h.current=M,M.stateNode=h,m=Mk(),m.refCount++,h.pooledCache=m,m.refCount++,M.memoizedState={element:k,isDehydrated:y,cache:m},Pk(M),h}function G5(h){return h?(h=Kd,h):Kd}function X5(h,m,y,k,j,M){j=G5(j),k.context===null?k.context=j:k.pendingContext=j,k=oc(m),k.payload={element:y},M=M===void 0?null:M,M!==null&&(k.callback=M),y=lc(h,k,m),y!==null&&(ms(y,h,m),gp(y,h,m))}function Q5(h,m){if(h=h.memoizedState,h!==null&&h.dehydrated!==null){var y=h.retryLane;h.retryLane=y!==0&&y<m?y:m}}function J1(h,m){Q5(h,m),(h=h.alternate)&&Q5(h,m)}function Z5(h){if(h.tag===13||h.tag===31){var m=Cu(h,67108864);m!==null&&ms(m,h,67108864),J1(h,67108864)}}function J5(h){if(h.tag===13||h.tag===31){var m=Fs();m=Kt(m);var y=Cu(h,m);y!==null&&ms(y,h,m),J1(h,m)}}var Py=!0;function qY(h,m,y,k){var j=I.T;I.T=null;var M=Q.p;try{Q.p=2,ew(h,m,y,k)}finally{Q.p=M,I.T=j}}function UY(h,m,y,k){var j=I.T;I.T=null;var M=Q.p;try{Q.p=8,ew(h,m,y,k)}finally{Q.p=M,I.T=j}}function ew(h,m,y,k){if(Py){var j=tw(k);if(j===null)$1(h,m,k,Ly,y),t3(h,k);else if(KY(j,h,m,y,k))k.stopPropagation();else if(t3(h,k),m&4&&-1<VY.indexOf(h)){for(;j!==null;){var M=Ri(j);if(M!==null)switch(M.tag){case 3:if(M=M.stateNode,M.current.memoizedState.isDehydrated){var G=rt(M.pendingLanes);if(G!==0){var ne=M;for(ne.pendingLanes|=2,ne.entangledLanes|=2;G;){var he=1<<31-ee(G);ne.entanglements[1]|=he,G&=~he}yo(M),(Dn&6)===0&&(yy=Tt()+500,Rp(0))}}break;case 31:case 13:ne=Cu(M,2),ne!==null&&ms(ne,M,2),xy(),J1(M,2)}if(M=tw(k),M===null&&$1(h,m,k,Ly,y),M===j)break;j=M}j!==null&&k.stopPropagation()}else $1(h,m,k,null,y)}}function tw(h){return h=Hd(h),nw(h)}var Ly=null;function nw(h){if(Ly=null,h=us(h),h!==null){var m=a(h);if(m===null)h=null;else{var y=m.tag;if(y===13){if(h=o(m),h!==null)return h;h=null}else if(y===31){if(h=l(m),h!==null)return h;h=null}else if(y===3){if(m.stateNode.current.memoizedState.isDehydrated)return m.tag===3?m.stateNode.containerInfo:null;h=null}else m!==h&&(h=null)}}return Ly=h,null}function e3(h){switch(h){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Dt()){case Re:return 2;case et:return 8;case bt:case yt:return 32;case O:return 268435456;default:return 32}default:return 32}}var rw=!1,_c=null,xc=null,bc=null,zp=new Map,$p=new Map,kc=[],VY="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function t3(h,m){switch(h){case"focusin":case"focusout":_c=null;break;case"dragenter":case"dragleave":xc=null;break;case"mouseover":case"mouseout":bc=null;break;case"pointerover":case"pointerout":zp.delete(m.pointerId);break;case"gotpointercapture":case"lostpointercapture":$p.delete(m.pointerId)}}function Fp(h,m,y,k,j,M){return h===null||h.nativeEvent!==M?(h={blockedOn:m,domEventName:y,eventSystemFlags:k,nativeEvent:M,targetContainers:[j]},m!==null&&(m=Ri(m),m!==null&&Z5(m)),h):(h.eventSystemFlags|=k,m=h.targetContainers,j!==null&&m.indexOf(j)===-1&&m.push(j),h)}function KY(h,m,y,k,j){switch(m){case"focusin":return _c=Fp(_c,h,m,y,k,j),!0;case"dragenter":return xc=Fp(xc,h,m,y,k,j),!0;case"mouseover":return bc=Fp(bc,h,m,y,k,j),!0;case"pointerover":var M=j.pointerId;return zp.set(M,Fp(zp.get(M)||null,h,m,y,k,j)),!0;case"gotpointercapture":return M=j.pointerId,$p.set(M,Fp($p.get(M)||null,h,m,y,k,j)),!0}return!1}function n3(h){var m=us(h.target);if(m!==null){var y=a(m);if(y!==null){if(m=y.tag,m===13){if(m=o(y),m!==null){h.blockedOn=m,un(h.priority,function(){J5(y)});return}}else if(m===31){if(m=l(y),m!==null){h.blockedOn=m,un(h.priority,function(){J5(y)});return}}else if(m===3&&y.stateNode.current.memoizedState.isDehydrated){h.blockedOn=y.tag===3?y.stateNode.containerInfo:null;return}}}h.blockedOn=null}function Iy(h){if(h.blockedOn!==null)return!1;for(var m=h.targetContainers;0<m.length;){var y=tw(h.nativeEvent);if(y===null){y=h.nativeEvent;var k=new y.constructor(y.type,y);ip=k,y.target.dispatchEvent(k),ip=null}else return m=Ri(y),m!==null&&Z5(m),h.blockedOn=y,!1;m.shift()}return!0}function r3(h,m,y){Iy(h)&&y.delete(m)}function YY(){rw=!1,_c!==null&&Iy(_c)&&(_c=null),xc!==null&&Iy(xc)&&(xc=null),bc!==null&&Iy(bc)&&(bc=null),zp.forEach(r3),$p.forEach(r3)}function By(h,m){h.blockedOn===m&&(h.blockedOn=null,rw||(rw=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,YY)))}var zy=null;function i3(h){zy!==h&&(zy=h,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){zy===h&&(zy=null);for(var m=0;m<h.length;m+=3){var y=h[m],k=h[m+1],j=h[m+2];if(typeof k!="function"){if(nw(k||y)===null)continue;break}var M=Ri(y);M!==null&&(h.splice(m,3),m-=3,t1(M,{pending:!0,data:j,method:y.method,action:k},k,j))}}))}function vh(h){function m(he){return By(he,h)}_c!==null&&By(_c,h),xc!==null&&By(xc,h),bc!==null&&By(bc,h),zp.forEach(m),$p.forEach(m);for(var y=0;y<kc.length;y++){var k=kc[y];k.blockedOn===h&&(k.blockedOn=null)}for(;0<kc.length&&(y=kc[0],y.blockedOn===null);)n3(y),y.blockedOn===null&&kc.shift();if(y=(h.ownerDocument||h).$$reactFormReplay,y!=null)for(k=0;k<y.length;k+=3){var j=y[k],M=y[k+1],G=j[Qe]||null;if(typeof M=="function")G||i3(y);else if(G){var ne=null;if(M&&M.hasAttribute("formAction")){if(j=M,G=M[Qe]||null)ne=G.formAction;else if(nw(j)!==null)continue}else ne=G.action;typeof ne=="function"?y[k+1]=ne:(y.splice(k,3),k-=3),i3(y)}}}function s3(){function h(M){M.canIntercept&&M.info==="react-transition"&&M.intercept({handler:function(){return new Promise(function(G){return j=G})},focusReset:"manual",scroll:"manual"})}function m(){j!==null&&(j(),j=null),k||setTimeout(y,20)}function y(){if(!k&&!navigation.transition){var M=navigation.currentEntry;M&&M.url!=null&&navigation.navigate(M.url,{state:M.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var k=!1,j=null;return navigation.addEventListener("navigate",h),navigation.addEventListener("navigatesuccess",m),navigation.addEventListener("navigateerror",m),setTimeout(y,100),function(){k=!0,navigation.removeEventListener("navigate",h),navigation.removeEventListener("navigatesuccess",m),navigation.removeEventListener("navigateerror",m),j!==null&&(j(),j=null)}}}function iw(h){this._internalRoot=h}$y.prototype.render=iw.prototype.render=function(h){var m=this._internalRoot;if(m===null)throw Error(i(409));var y=m.current,k=Fs();X5(y,k,h,m,null,null)},$y.prototype.unmount=iw.prototype.unmount=function(){var h=this._internalRoot;if(h!==null){this._internalRoot=null;var m=h.containerInfo;X5(h.current,2,null,h,null,null),xy(),m[_t]=null}};function $y(h){this._internalRoot=h}$y.prototype.unstable_scheduleHydration=function(h){if(h){var m=yi();h={blockedOn:null,target:h,priority:m};for(var y=0;y<kc.length&&m!==0&&m<kc[y].priority;y++);kc.splice(y,0,h),y===0&&n3(h)}};var a3=n.version;if(a3!=="19.2.4")throw Error(i(527,a3,"19.2.4"));Q.findDOMNode=function(h){var m=h._reactInternals;if(m===void 0)throw typeof h.render=="function"?Error(i(188)):(h=Object.keys(h).join(","),Error(i(268,h)));return h=d(m),h=h!==null?p(h):null,h=h===null?null:h.stateNode,h};var GY={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:I,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Fy=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Fy.isDisabled&&Fy.supportsFiber)try{ye=Fy.inject(GY),_e=Fy}catch{}}return Wp.createRoot=function(h,m){if(!s(h))throw Error(i(299));var y=!1,k="",j=fR,M=pR,G=mR;return m!=null&&(m.unstable_strictMode===!0&&(y=!0),m.identifierPrefix!==void 0&&(k=m.identifierPrefix),m.onUncaughtError!==void 0&&(j=m.onUncaughtError),m.onCaughtError!==void 0&&(M=m.onCaughtError),m.onRecoverableError!==void 0&&(G=m.onRecoverableError)),m=Y5(h,1,!1,null,null,y,k,null,j,M,G,s3),h[_t]=m.current,z1(h),new iw(m)},Wp.hydrateRoot=function(h,m,y){if(!s(h))throw Error(i(299));var k=!1,j="",M=fR,G=pR,ne=mR,he=null;return y!=null&&(y.unstable_strictMode===!0&&(k=!0),y.identifierPrefix!==void 0&&(j=y.identifierPrefix),y.onUncaughtError!==void 0&&(M=y.onUncaughtError),y.onCaughtError!==void 0&&(G=y.onCaughtError),y.onRecoverableError!==void 0&&(ne=y.onRecoverableError),y.formState!==void 0&&(he=y.formState)),m=Y5(h,1,!0,m,y??null,k,j,he,M,G,ne,s3),m.context=G5(null),y=m.current,k=Fs(),k=Kt(k),j=oc(k),j.callback=null,lc(y,j,k),y=k,m.current.lanes=y,xe(m,y),yo(m),h[_t]=m.current,z1(h),new $y(m)},Wp.version="19.2.4",Wp}var g3;function oG(){if(g3)return ow.exports;g3=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(n){console.error(n)}}return e(),ow.exports=aG(),ow.exports}var lG=oG();const cG=pu(lG);/**
 * react-router v7.18.0
 *
 * Copyright (c) Remix Software Inc.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE.md file in the root directory of this source tree.
 *
 * @license MIT
 */var ZN=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,D8=/^[\\/]{2}/;function uG(e,n){return n+e.replace(/\\/g,"/")}var v3="popstate";function y3(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function dG(e={}){function n(i,s){var d;let a=(d=s.state)==null?void 0:d.masked,{pathname:o,search:l,hash:u}=a||i.location;return eC("",{pathname:o,search:l,hash:u},s.state&&s.state.usr||null,s.state&&s.state.key||"default",a?{pathname:i.location.pathname,search:i.location.search,hash:i.location.hash}:void 0)}function r(i,s){return typeof s=="string"?s:ug(s)}return fG(n,r,null,e)}function xr(e,n){if(e===!1||e===null||typeof e>"u")throw new Error(n)}function Ea(e,n){if(!e){typeof console<"u"&&console.warn(n);try{throw new Error(n)}catch{}}}function hG(){return Math.random().toString(36).substring(2,10)}function _3(e,n){return{usr:e.state,key:e.key,idx:n,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function eC(e,n,r=null,i,s){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof n=="string"?qf(n):n,state:r,key:n&&n.key||i||hG(),mask:s}}function ug({pathname:e="/",search:n="",hash:r=""}){return n&&n!=="?"&&(e+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function qf(e){let n={};if(e){let r=e.indexOf("#");r>=0&&(n.hash=e.substring(r),e=e.substring(0,r));let i=e.indexOf("?");i>=0&&(n.search=e.substring(i),e=e.substring(0,i)),e&&(n.pathname=e)}return n}function fG(e,n,r,i={}){let{window:s=document.defaultView,v5Compat:a=!1}=i,o=s.history,l="POP",u=null,d=p();d==null&&(d=0,o.replaceState({...o.state,idx:d},""));function p(){return(o.state||{idx:null}).idx}function f(){l="POP";let S=p(),w=S==null?null:S-d;d=S,u&&u({action:l,location:v.location,delta:w})}function g(S,w){l="PUSH";let N=y3(S)?S:eC(v.location,S,w);d=p()+1;let C=_3(N,d),T=v.createHref(N.mask||N);try{o.pushState(C,"",T)}catch(A){if(A instanceof DOMException&&A.name==="DataCloneError")throw A;s.location.assign(T)}a&&u&&u({action:l,location:v.location,delta:1})}function _(S,w){l="REPLACE";let N=y3(S)?S:eC(v.location,S,w);d=p();let C=_3(N,d),T=v.createHref(N.mask||N);o.replaceState(C,"",T),a&&u&&u({action:l,location:v.location,delta:0})}function x(S){return pG(s,S)}let v={get action(){return l},get location(){return e(s,o)},listen(S){if(u)throw new Error("A history only accepts one active listener");return s.addEventListener(v3,f),u=S,()=>{s.removeEventListener(v3,f),u=null}},createHref(S){return n(s,S)},createURL:x,encodeLocation(S){let w=x(S);return{pathname:w.pathname,search:w.search,hash:w.hash}},push:g,replace:_,go(S){return o.go(S)}};return v}function pG(e,n,r=!1){let i="http://localhost";e&&(i=e.location.origin!=="null"?e.location.origin:e.location.href),xr(i,"No window.location.(origin|href) available to create URL");let s=typeof n=="string"?n:ug(n);return s=s.replace(/ $/,"%20"),!r&&D8.test(s)&&(s=i+s),new URL(s,i)}function P8(e,n,r="/"){return mG(e,n,r,!1)}function mG(e,n,r,i,s){let a=typeof n=="string"?qf(n):n,o=Wl(a.pathname||"/",r);if(o==null)return null;let l=gG(e),u=null,d=NG(o);for(let p=0;u==null&&p<l.length;++p)u=jG(l[p],d,i);return u}function gG(e){let n=L8(e);return vG(n),n}function L8(e,n=[],r=[],i="",s=!1){let a=(o,l,u=s,d)=>{let p={relativePath:d===void 0?o.path||"":d,caseSensitive:o.caseSensitive===!0,childrenIndex:l,route:o};if(p.relativePath.startsWith("/")){if(!p.relativePath.startsWith(i)&&u)return;xr(p.relativePath.startsWith(i),`Absolute route path "${p.relativePath}" nested under path "${i}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),p.relativePath=p.relativePath.slice(i.length)}let f=Xa([i,p.relativePath]),g=r.concat(p);o.children&&o.children.length>0&&(xr(o.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${f}".`),L8(o.children,n,g,f,u)),!(o.path==null&&!o.index)&&n.push({path:f,score:SG(f,o.index),routesMeta:g.map((_,x)=>{let[v,S]=z8(_.relativePath,_.caseSensitive,x===g.length-1);return{..._,matcher:v,compiledParams:S}})})};return e.forEach((o,l)=>{var u;if(o.path===""||!((u=o.path)!=null&&u.includes("?")))a(o,l);else for(let d of I8(o.path))a(o,l,!0,d)}),n}function I8(e){let n=e.split("/");if(n.length===0)return[];let[r,...i]=n,s=r.endsWith("?"),a=r.replace(/\?$/,"");if(i.length===0)return s?[a,""]:[a];let o=I8(i.join("/")),l=[];return l.push(...o.map(u=>u===""?a:[a,u].join("/"))),s&&l.push(...o),l.map(u=>e.startsWith("/")&&u===""?"/":u)}function vG(e){e.sort((n,r)=>n.score!==r.score?r.score-n.score:CG(n.routesMeta.map(i=>i.childrenIndex),r.routesMeta.map(i=>i.childrenIndex)))}var yG=/^:[\w-]+$/,_G=3,xG=2,bG=1,kG=10,wG=-2,x3=e=>e==="*";function SG(e,n){let r=e.split("/"),i=r.length;return r.some(x3)&&(i+=wG),n&&(i+=xG),r.filter(s=>!x3(s)).reduce((s,a)=>s+(yG.test(a)?_G:a===""?bG:kG),i)}function CG(e,n){return e.length===n.length&&e.slice(0,-1).every((i,s)=>i===n[s])?e[e.length-1]-n[n.length-1]:0}function jG(e,n,r=!1){let{routesMeta:i}=e,s={},a="/",o=[];for(let l=0;l<i.length;++l){let u=i[l],d=l===i.length-1,p=a==="/"?n:n.slice(a.length)||"/",f={path:u.relativePath,caseSensitive:u.caseSensitive,end:d},g=u.matcher&&u.compiledParams?B8(f,p,u.matcher,u.compiledParams):Rx(f,p),_=u.route;if(!g&&d&&r&&!i[i.length-1].route.index&&(g=Rx({path:u.relativePath,caseSensitive:u.caseSensitive,end:!1},p)),!g)return null;Object.assign(s,g.params),o.push({params:s,pathname:Xa([a,g.pathname]),pathnameBase:TG(Xa([a,g.pathnameBase])),route:_}),g.pathnameBase!=="/"&&(a=Xa([a,g.pathnameBase]))}return o}function Rx(e,n){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,i]=z8(e.path,e.caseSensitive,e.end);return B8(e,n,r,i)}function B8(e,n,r,i){let s=n.match(r);if(!s)return null;let a=s[0],o=a.replace(/(.)\/+$/,"$1"),l=s.slice(1);return{params:i.reduce((d,{paramName:p,isOptional:f},g)=>{if(p==="*"){let x=l[g]||"";o=a.slice(0,a.length-x.length).replace(/(.)\/+$/,"$1")}const _=l[g];return f&&!_?d[p]=void 0:d[p]=(_||"").replace(/%2F/g,"/"),d},{}),pathname:a,pathnameBase:o,pattern:e}}function z8(e,n=!1,r=!0){Ea(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let i=[],s="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,l,u,d,p)=>{if(i.push({paramName:l,isOptional:u!=null}),u){let f=p.charAt(d+o.length);return f&&f!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(i.push({paramName:"*"}),s+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?s+="\\/*$":e!==""&&e!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,n?void 0:"i"),i]}function NG(e){try{return e.split("/").map(n=>decodeURIComponent(n).replace(/\//g,"%2F")).join("/")}catch(n){return Ea(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${n}).`),e}}function Wl(e,n){if(n==="/")return e;if(!e.toLowerCase().startsWith(n.toLowerCase()))return null;let r=n.endsWith("/")?n.length-1:n.length,i=e.charAt(r);return i&&i!=="/"?null:e.slice(r)||"/"}function EG(e,n="/"){let{pathname:r,search:i="",hash:s=""}=typeof e=="string"?qf(e):e,a;return r?(r=$8(r),r.startsWith("/")?a=b3(r.substring(1),"/"):a=b3(r,n)):a=n,{pathname:a,search:MG(i),hash:RG(s)}}function b3(e,n){let r=Ox(n).split("/");return e.split("/").forEach(s=>{s===".."?r.length>1&&r.pop():s!=="."&&r.push(s)}),r.length>1?r.join("/"):"/"}function dw(e,n,r,i){return`Cannot include a '${e}' character in a manually specified \`to.${n}\` field [${JSON.stringify(i)}].  Please separate it out to the \`to.${r}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function AG(e){return e.filter((n,r)=>r===0||n.route.path&&n.route.path.length>0)}function JN(e){let n=AG(e);return n.map((r,i)=>i===n.length-1?r.pathname:r.pathnameBase)}function Xb(e,n,r,i=!1){let s;typeof e=="string"?s=qf(e):(s={...e},xr(!s.pathname||!s.pathname.includes("?"),dw("?","pathname","search",s)),xr(!s.pathname||!s.pathname.includes("#"),dw("#","pathname","hash",s)),xr(!s.search||!s.search.includes("#"),dw("#","search","hash",s)));let a=e===""||s.pathname==="",o=a?"/":s.pathname,l;if(o==null)l=r;else{let f=n.length-1;if(!i&&o.startsWith("..")){let g=o.split("/");for(;g[0]==="..";)g.shift(),f-=1;s.pathname=g.join("/")}l=f>=0?n[f]:"/"}let u=EG(s,l),d=o&&o!=="/"&&o.endsWith("/"),p=(a||o===".")&&r.endsWith("/");return!u.pathname.endsWith("/")&&(d||p)&&(u.pathname+="/"),u}var $8=e=>e.replace(/[\\/]{2,}/g,"/"),Xa=e=>$8(e.join("/")),Ox=e=>e.replace(/\/+$/,""),TG=e=>Ox(e).replace(/^\/*/,"/"),MG=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,RG=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,OG=class{constructor(e,n,r,i=!1){this.status=e,this.statusText=n||"",this.internal=i,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}};function DG(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function PG(e){let n=e.map(r=>r.route.path).filter(Boolean);return Xa(n)||"/"}var F8=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function H8(e,n){let r=e;if(typeof r!="string"||!ZN.test(r))return{absoluteURL:void 0,isExternal:!1,to:r};let i=r,s=!1;if(F8)try{let a=new URL(window.location.href),o=D8.test(r)?new URL(uG(r,a.protocol)):new URL(r),l=Wl(o.pathname,n);o.origin===a.origin&&l!=null?r=l+o.search+o.hash:s=!0}catch{Ea(!1,`<Link to="${r}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:i,isExternal:s,to:r}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var W8=["POST","PUT","PATCH","DELETE"];new Set(W8);var LG=["GET",...W8];new Set(LG);var IG=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function BG(e){try{return IG.includes(new URL(e).protocol)}catch{return!1}}var Uf=b.createContext(null);Uf.displayName="DataRouter";var Qb=b.createContext(null);Qb.displayName="DataRouterState";var q8=b.createContext(!1);function zG(){return b.useContext(q8)}var U8=b.createContext({isTransitioning:!1});U8.displayName="ViewTransition";var $G=b.createContext(new Map);$G.displayName="Fetchers";var FG=b.createContext(null);FG.displayName="Await";var ta=b.createContext(null);ta.displayName="Navigation";var Xg=b.createContext(null);Xg.displayName="Location";var to=b.createContext({outlet:null,matches:[],isDataRoute:!1});to.displayName="Route";var eE=b.createContext(null);eE.displayName="RouteError";var V8="REACT_ROUTER_ERROR",HG="REDIRECT",WG="ROUTE_ERROR_RESPONSE";function qG(e){if(e.startsWith(`${V8}:${HG}:{`))try{let n=JSON.parse(e.slice(28));if(typeof n=="object"&&n&&typeof n.status=="number"&&typeof n.statusText=="string"&&typeof n.location=="string"&&typeof n.reloadDocument=="boolean"&&typeof n.replace=="boolean")return n}catch{}}function UG(e){if(e.startsWith(`${V8}:${WG}:{`))try{let n=JSON.parse(e.slice(40));if(typeof n=="object"&&n&&typeof n.status=="number"&&typeof n.statusText=="string")return new OG(n.status,n.statusText,n.data)}catch{}}function VG(e,{relative:n}={}){xr(Vf(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:i}=b.useContext(ta),{hash:s,pathname:a,search:o}=Zg(e,{relative:n}),l=a;return r!=="/"&&(l=a==="/"?r:Xa([r,a])),i.createHref({pathname:l,search:o,hash:s})}function Vf(){return b.useContext(Xg)!=null}function is(){return xr(Vf(),"useLocation() may be used only in the context of a <Router> component."),b.useContext(Xg).location}var K8="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Y8(e){b.useContext(ta).static||b.useLayoutEffect(e)}function Qg(){let{isDataRoute:e}=b.useContext(to);return e?oX():KG()}function KG(){xr(Vf(),"useNavigate() may be used only in the context of a <Router> component.");let e=b.useContext(Uf),{basename:n,navigator:r}=b.useContext(ta),{matches:i}=b.useContext(to),{pathname:s}=is(),a=JSON.stringify(JN(i)),o=b.useRef(!1);return Y8(()=>{o.current=!0}),b.useCallback((u,d={})=>{if(Ea(o.current,K8),!o.current)return;if(typeof u=="number"){r.go(u);return}let p=Xb(u,JSON.parse(a),s,d.relative==="path");e==null&&n!=="/"&&(p.pathname=p.pathname==="/"?n:Xa([n,p.pathname])),(d.replace?r.replace:r.push)(p,d.state,d)},[n,r,a,s,e])}var YG=b.createContext(null);function GG(e){let n=b.useContext(to).outlet;return b.useMemo(()=>n&&b.createElement(YG.Provider,{value:e},n),[n,e])}function Zg(e,{relative:n}={}){let{matches:r}=b.useContext(to),{pathname:i}=is(),s=JSON.stringify(JN(r));return b.useMemo(()=>Xb(e,JSON.parse(s),i,n==="path"),[e,s,i,n])}function XG(e,n){return G8(e,n)}function G8(e,n,r){var S;xr(Vf(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:i}=b.useContext(ta),{matches:s}=b.useContext(to),a=s[s.length-1],o=a?a.params:{},l=a?a.pathname:"/",u=a?a.pathnameBase:"/",d=a&&a.route;{let w=d&&d.path||"";Q8(l,!d||w.endsWith("*")||w.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${l}" (under <Route path="${w}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.

Please change the parent <Route path="${w}"> to <Route path="${w==="/"?"*":`${w}/*`}">.`)}let p=is(),f;if(n){let w=typeof n=="string"?qf(n):n;xr(u==="/"||((S=w.pathname)==null?void 0:S.startsWith(u)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${u}" but pathname "${w.pathname}" was given in the \`location\` prop.`),f=w}else f=p;let g=f.pathname||"/",_=g;if(u!=="/"){let w=u.replace(/^\//,"").split("/");_="/"+g.replace(/^\//,"").split("/").slice(w.length).join("/")}let x=r&&r.state.matches.length?r.state.matches.map(w=>Object.assign(w,{route:r.manifest[w.route.id]||w.route})):P8(e,{pathname:_});Ea(d||x!=null,`No routes matched location "${f.pathname}${f.search}${f.hash}" `),Ea(x==null||x[x.length-1].route.element!==void 0||x[x.length-1].route.Component!==void 0||x[x.length-1].route.lazy!==void 0,`Matched leaf route at location "${f.pathname}${f.search}${f.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let v=tX(x&&x.map(w=>Object.assign({},w,{params:Object.assign({},o,w.params),pathname:Xa([u,i.encodeLocation?i.encodeLocation(w.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:w.pathname]),pathnameBase:w.pathnameBase==="/"?u:Xa([u,i.encodeLocation?i.encodeLocation(w.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:w.pathnameBase])})),s,r);return n&&v?b.createElement(Xg.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...f},navigationType:"POP"}},v):v}function QG(){let e=aX(),n=DG(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,i="rgba(200,200,200, 0.5)",s={padding:"0.5rem",backgroundColor:i},a={padding:"2px 4px",backgroundColor:i},o=null;return console.error("Error handled by React Router default ErrorBoundary:",e),o=b.createElement(b.Fragment,null,b.createElement("p",null,"💿 Hey developer 👋"),b.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",b.createElement("code",{style:a},"ErrorBoundary")," or"," ",b.createElement("code",{style:a},"errorElement")," prop on your route.")),b.createElement(b.Fragment,null,b.createElement("h2",null,"Unexpected Application Error!"),b.createElement("h3",{style:{fontStyle:"italic"}},n),r?b.createElement("pre",{style:s},r):null,o)}var ZG=b.createElement(QG,null),X8=class extends b.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,n){return n.location!==e.location||n.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:n.error,location:n.location,revalidation:e.revalidation||n.revalidation}}componentDidCatch(e,n){this.props.onError?this.props.onError(e,n):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const r=UG(e.digest);r&&(e=r)}let n=e!==void 0?b.createElement(to.Provider,{value:this.props.routeContext},b.createElement(eE.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?b.createElement(JG,{error:e},n):n}};X8.contextType=q8;var hw=new WeakMap;function JG({children:e,error:n}){let{basename:r}=b.useContext(ta);if(typeof n=="object"&&n&&"digest"in n&&typeof n.digest=="string"){let i=qG(n.digest);if(i){let s=hw.get(n);if(s)throw s;let a=H8(i.location,r),o=a.absoluteURL||a.to;if(BG(o))throw new Error("Invalid redirect location");if(F8&&!hw.get(n))if(a.isExternal||i.reloadDocument)window.location.href=o;else{const l=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(a.to,{replace:i.replace}));throw hw.set(n,l),l}return b.createElement("meta",{httpEquiv:"refresh",content:`0;url=${o}`})}}return e}function eX({routeContext:e,match:n,children:r}){let i=b.useContext(Uf);return i&&i.static&&i.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=n.route.id),b.createElement(to.Provider,{value:e},r)}function tX(e,n=[],r){let i=r==null?void 0:r.state;if(e==null){if(!i)return null;if(i.errors)e=i.matches;else if(n.length===0&&!i.initialized&&i.matches.length>0)e=i.matches;else return null}let s=e,a=i==null?void 0:i.errors;if(a!=null){let p=s.findIndex(f=>f.route.id&&(a==null?void 0:a[f.route.id])!==void 0);xr(p>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(",")}`),s=s.slice(0,Math.min(s.length,p+1))}let o=!1,l=-1;if(r&&i){o=i.renderFallback;for(let p=0;p<s.length;p++){let f=s[p];if((f.route.HydrateFallback||f.route.hydrateFallbackElement)&&(l=p),f.route.id){let{loaderData:g,errors:_}=i,x=f.route.loader&&!g.hasOwnProperty(f.route.id)&&(!_||_[f.route.id]===void 0);if(f.route.lazy||x){r.isStatic&&(o=!0),l>=0?s=s.slice(0,l+1):s=[s[0]];break}}}}let u=r==null?void 0:r.onError,d=i&&u?(p,f)=>{var g,_;u(p,{location:i.location,params:((_=(g=i.matches)==null?void 0:g[0])==null?void 0:_.params)??{},pattern:PG(i.matches),errorInfo:f})}:void 0;return s.reduceRight((p,f,g)=>{let _,x=!1,v=null,S=null;i&&(_=a&&f.route.id?a[f.route.id]:void 0,v=f.route.errorElement||ZG,o&&(l<0&&g===0?(Q8("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),x=!0,S=null):l===g&&(x=!0,S=f.route.hydrateFallbackElement||null)));let w=n.concat(s.slice(0,g+1)),N=()=>{let C;return _?C=v:x?C=S:f.route.Component?C=b.createElement(f.route.Component,null):f.route.element?C=f.route.element:C=p,b.createElement(eX,{match:f,routeContext:{outlet:p,matches:w,isDataRoute:i!=null},children:C})};return i&&(f.route.ErrorBoundary||f.route.errorElement||g===0)?b.createElement(X8,{location:i.location,revalidation:i.revalidation,component:v,error:_,children:N(),routeContext:{outlet:null,matches:w,isDataRoute:!0},onError:d}):N()},null)}function tE(e){return`${e} must be used within a data router.  See https://reactrouter.com/en/main/routers/picking-a-router.`}function nX(e){let n=b.useContext(Uf);return xr(n,tE(e)),n}function rX(e){let n=b.useContext(Qb);return xr(n,tE(e)),n}function iX(e){let n=b.useContext(to);return xr(n,tE(e)),n}function nE(e){let n=iX(e),r=n.matches[n.matches.length-1];return xr(r.route.id,`${e} can only be used on routes that contain a unique "id"`),r.route.id}function sX(){return nE("useRouteId")}function aX(){var i;let e=b.useContext(eE),n=rX("useRouteError"),r=nE("useRouteError");return e!==void 0?e:(i=n.errors)==null?void 0:i[r]}function oX(){let{router:e}=nX("useNavigate"),n=nE("useNavigate"),r=b.useRef(!1);return Y8(()=>{r.current=!0}),b.useCallback(async(s,a={})=>{Ea(r.current,K8),r.current&&(typeof s=="number"?await e.navigate(s):await e.navigate(s,{fromRouteId:n,...a}))},[e,n])}var k3={};function Q8(e,n,r){!n&&!k3[e]&&(k3[e]=!0,Ea(!1,r))}b.memo(lX);function lX({routes:e,manifest:n,future:r,state:i,isStatic:s,onError:a}){return G8(e,void 0,{manifest:n,state:i,isStatic:s,onError:a})}function w3({to:e,replace:n,state:r,relative:i}){xr(Vf(),"<Navigate> may be used only in the context of a <Router> component.");let{static:s}=b.useContext(ta);Ea(!s,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:a}=b.useContext(to),{pathname:o}=is(),l=Qg(),u=Xb(e,JN(a),o,i==="path"),d=JSON.stringify(u);return b.useEffect(()=>{l(JSON.parse(d),{replace:n,state:r,relative:i})},[l,d,i,n,r]),null}function cX(e){return GG(e.context)}function gr(e){xr(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function uX({basename:e="/",children:n=null,location:r,navigationType:i="POP",navigator:s,static:a=!1,useTransitions:o}){xr(!Vf(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let l=e.replace(/^\/*/,"/"),u=b.useMemo(()=>({basename:l,navigator:s,static:a,useTransitions:o,future:{}}),[l,s,a,o]);typeof r=="string"&&(r=qf(r));let{pathname:d="/",search:p="",hash:f="",state:g=null,key:_="default",mask:x}=r,v=b.useMemo(()=>{let S=Wl(d,l);return S==null?null:{location:{pathname:S,search:p,hash:f,state:g,key:_,mask:x},navigationType:i}},[l,d,p,f,g,_,i,x]);return Ea(v!=null,`<Router basename="${l}"> is not able to match the URL "${d}${p}${f}" because it does not start with the basename, so the <Router> won't render anything.`),v==null?null:b.createElement(ta.Provider,{value:u},b.createElement(Xg.Provider,{children:n,value:v}))}function S3({children:e,location:n}){return XG(tC(e),n)}function tC(e,n=[]){let r=[];return b.Children.forEach(e,(i,s)=>{if(!b.isValidElement(i))return;let a=[...n,s];if(i.type===b.Fragment){r.push.apply(r,tC(i.props.children,a));return}xr(i.type===gr,`[${typeof i.type=="string"?i.type:i.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),xr(!i.props.index||!i.props.children,"An index route cannot have child routes.");let o={id:i.props.id||a.join("-"),caseSensitive:i.props.caseSensitive,element:i.props.element,Component:i.props.Component,index:i.props.index,path:i.props.path,middleware:i.props.middleware,loader:i.props.loader,action:i.props.action,hydrateFallbackElement:i.props.hydrateFallbackElement,HydrateFallback:i.props.HydrateFallback,errorElement:i.props.errorElement,ErrorBoundary:i.props.ErrorBoundary,hasErrorBoundary:i.props.hasErrorBoundary===!0||i.props.ErrorBoundary!=null||i.props.errorElement!=null,shouldRevalidate:i.props.shouldRevalidate,handle:i.props.handle,lazy:i.props.lazy};i.props.children&&(o.children=tC(i.props.children,a)),r.push(o)}),r}var Z_="get",J_="application/x-www-form-urlencoded";function Zb(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function dX(e){return Zb(e)&&e.tagName.toLowerCase()==="button"}function hX(e){return Zb(e)&&e.tagName.toLowerCase()==="form"}function fX(e){return Zb(e)&&e.tagName.toLowerCase()==="input"}function pX(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function mX(e,n){return e.button===0&&(!n||n==="_self")&&!pX(e)}function nC(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((n,r)=>{let i=e[r];return n.concat(Array.isArray(i)?i.map(s=>[r,s]):[[r,i]])},[]))}function gX(e,n){let r=nC(e);return n&&n.forEach((i,s)=>{r.has(s)||n.getAll(s).forEach(a=>{r.append(s,a)})}),r}var Hy=null;function vX(){if(Hy===null)try{new FormData(document.createElement("form"),0),Hy=!1}catch{Hy=!0}return Hy}var yX=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function fw(e){return e!=null&&!yX.has(e)?(Ea(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${J_}"`),null):e}function _X(e,n){let r,i,s,a,o;if(hX(e)){let l=e.getAttribute("action");i=l?Wl(l,n):null,r=e.getAttribute("method")||Z_,s=fw(e.getAttribute("enctype"))||J_,a=new FormData(e)}else if(dX(e)||fX(e)&&(e.type==="submit"||e.type==="image")){let l=e.form;if(l==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let u=e.getAttribute("formaction")||l.getAttribute("action");if(i=u?Wl(u,n):null,r=e.getAttribute("formmethod")||l.getAttribute("method")||Z_,s=fw(e.getAttribute("formenctype"))||fw(l.getAttribute("enctype"))||J_,a=new FormData(l,e),!vX()){let{name:d,type:p,value:f}=e;if(p==="image"){let g=d?`${d}.`:"";a.append(`${g}x`,"0"),a.append(`${g}y`,"0")}else d&&a.append(d,f)}}else{if(Zb(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=Z_,i=null,s=J_,o=e}return a&&s==="text/plain"&&(o=a,a=void 0),{action:i,method:r.toLowerCase(),encType:s,formData:a,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function rE(e,n){if(e===!1||e===null||typeof e>"u")throw new Error(n)}function Z8(e,n,r,i){let s=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return r?s.pathname.endsWith("/")?s.pathname=`${s.pathname}_.${i}`:s.pathname=`${s.pathname}.${i}`:s.pathname==="/"?s.pathname=`_root.${i}`:n&&Wl(s.pathname,n)==="/"?s.pathname=`${Ox(n)}/_root.${i}`:s.pathname=`${Ox(s.pathname)}.${i}`,s}async function xX(e,n){if(e.id in n)return n[e.id];try{let r=await import(e.module);return n[e.id]=r,r}catch(r){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(r),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function bX(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function kX(e,n,r){let i=await Promise.all(e.map(async s=>{let a=n.routes[s.route.id];if(a){let o=await xX(a,r);return o.links?o.links():[]}return[]}));return jX(i.flat(1).filter(bX).filter(s=>s.rel==="stylesheet"||s.rel==="preload").map(s=>s.rel==="stylesheet"?{...s,rel:"prefetch",as:"style"}:{...s,rel:"prefetch"}))}function C3(e,n,r,i,s,a){let o=(u,d)=>r[d]?u.route.id!==r[d].route.id:!0,l=(u,d)=>{var p;return r[d].pathname!==u.pathname||((p=r[d].route.path)==null?void 0:p.endsWith("*"))&&r[d].params["*"]!==u.params["*"]};return a==="assets"?n.filter((u,d)=>o(u,d)||l(u,d)):a==="data"?n.filter((u,d)=>{var f;let p=i.routes[u.route.id];if(!p||!p.hasLoader)return!1;if(o(u,d)||l(u,d))return!0;if(u.route.shouldRevalidate){let g=u.route.shouldRevalidate({currentUrl:new URL(s.pathname+s.search+s.hash,window.origin),currentParams:((f=r[0])==null?void 0:f.params)||{},nextUrl:new URL(e,window.origin),nextParams:u.params,defaultShouldRevalidate:!0});if(typeof g=="boolean")return g}return!0}):[]}function wX(e,n,{includeHydrateFallback:r}={}){return SX(e.map(i=>{let s=n.routes[i.route.id];if(!s)return[];let a=[s.module];return s.clientActionModule&&(a=a.concat(s.clientActionModule)),s.clientLoaderModule&&(a=a.concat(s.clientLoaderModule)),r&&s.hydrateFallbackModule&&(a=a.concat(s.hydrateFallbackModule)),s.imports&&(a=a.concat(s.imports)),a}).flat(1))}function SX(e){return[...new Set(e)]}function CX(e){let n={},r=Object.keys(e).sort();for(let i of r)n[i]=e[i];return n}function jX(e,n){let r=new Set;return new Set(n),e.reduce((i,s)=>{let a=JSON.stringify(CX(s));return r.has(a)||(r.add(a),i.push({key:a,link:s})),i},[])}function iE(){let e=b.useContext(Uf);return rE(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function NX(){let e=b.useContext(Qb);return rE(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var sE=b.createContext(void 0);sE.displayName="FrameworkContext";function Jb(){let e=b.useContext(sE);return rE(e,"You must render this element inside a <HydratedRouter> element"),e}function EX(e,n){let r=b.useContext(sE),[i,s]=b.useState(!1),[a,o]=b.useState(!1),{onFocus:l,onBlur:u,onMouseEnter:d,onMouseLeave:p,onTouchStart:f}=n,g=b.useRef(null);b.useEffect(()=>{if(e==="render"&&o(!0),e==="viewport"){let v=w=>{w.forEach(N=>{o(N.isIntersecting)})},S=new IntersectionObserver(v,{threshold:.5});return g.current&&S.observe(g.current),()=>{S.disconnect()}}},[e]),b.useEffect(()=>{if(i){let v=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(v)}}},[i]);let _=()=>{s(!0)},x=()=>{s(!1),o(!1)};return r?e!=="intent"?[a,g,{}]:[a,g,{onFocus:qp(l,_),onBlur:qp(u,x),onMouseEnter:qp(d,_),onMouseLeave:qp(p,x),onTouchStart:qp(f,_)}]:[!1,g,{}]}function qp(e,n){return r=>{e&&e(r),r.defaultPrevented||n(r)}}function AX({page:e,...n}){let r=zG(),{nonce:i}=Jb(),{router:s}=iE(),a=b.useMemo(()=>P8(s.routes,e,s.basename),[s.routes,e,s.basename]);return a?(n.nonce==null&&i&&(n={...n,nonce:i}),r?b.createElement(MX,{page:e,matches:a,...n}):b.createElement(RX,{page:e,matches:a,...n})):null}function TX(e){let{manifest:n,routeModules:r}=Jb(),[i,s]=b.useState([]);return b.useEffect(()=>{let a=!1;return kX(e,n,r).then(o=>{a||s(o)}),()=>{a=!0}},[e,n,r]),i}function MX({page:e,matches:n,...r}){let i=is(),{future:s}=Jb(),{basename:a}=iE(),o=b.useMemo(()=>{if(e===i.pathname+i.search+i.hash)return[];let l=Z8(e,a,s.v8_trailingSlashAwareDataRequests,"rsc"),u=!1,d=[];for(let p of n)typeof p.route.shouldRevalidate=="function"?u=!0:d.push(p.route.id);return u&&d.length>0&&l.searchParams.set("_routes",d.join(",")),[l.pathname+l.search]},[a,s.v8_trailingSlashAwareDataRequests,e,i,n]);return b.createElement(b.Fragment,null,o.map(l=>b.createElement("link",{key:l,rel:"prefetch",as:"fetch",href:l,...r})))}function RX({page:e,matches:n,...r}){let i=is(),{future:s,manifest:a,routeModules:o}=Jb(),{basename:l}=iE(),{loaderData:u,matches:d}=NX(),p=b.useMemo(()=>C3(e,n,d,a,i,"data"),[e,n,d,a,i]),f=b.useMemo(()=>C3(e,n,d,a,i,"assets"),[e,n,d,a,i]),g=b.useMemo(()=>{if(e===i.pathname+i.search+i.hash)return[];let v=new Set,S=!1;if(n.forEach(N=>{var T;let C=a.routes[N.route.id];!C||!C.hasLoader||(!p.some(A=>A.route.id===N.route.id)&&N.route.id in u&&((T=o[N.route.id])!=null&&T.shouldRevalidate)||C.hasClientLoader?S=!0:v.add(N.route.id))}),v.size===0)return[];let w=Z8(e,l,s.v8_trailingSlashAwareDataRequests,"data");return S&&v.size>0&&w.searchParams.set("_routes",n.filter(N=>v.has(N.route.id)).map(N=>N.route.id).join(",")),[w.pathname+w.search]},[l,s.v8_trailingSlashAwareDataRequests,u,i,a,p,n,e,o]),_=b.useMemo(()=>wX(f,a),[f,a]),x=TX(f);return b.createElement(b.Fragment,null,g.map(v=>b.createElement("link",{key:v,rel:"prefetch",as:"fetch",href:v,...r})),_.map(v=>b.createElement("link",{key:v,rel:"modulepreload",href:v,...r})),x.map(({key:v,link:S})=>b.createElement("link",{key:v,nonce:r.nonce,...S,crossOrigin:S.crossOrigin??r.crossOrigin})))}function OX(...e){return n=>{e.forEach(r=>{typeof r=="function"?r(n):r!=null&&(r.current=n)})}}var DX=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{DX&&(window.__reactRouterVersion="7.18.0")}catch{}function PX({basename:e,children:n,useTransitions:r,window:i}){let s=b.useRef();s.current==null&&(s.current=dG({window:i,v5Compat:!0}));let a=s.current,[o,l]=b.useState({action:a.action,location:a.location}),u=b.useCallback(d=>{r===!1?l(d):b.startTransition(()=>l(d))},[r]);return b.useLayoutEffect(()=>a.listen(u),[a,u]),b.createElement(uX,{basename:e,children:n,location:o.location,navigationType:o.action,navigator:a,useTransitions:r})}var bs=b.forwardRef(function({onClick:n,discover:r="render",prefetch:i="none",relative:s,reloadDocument:a,replace:o,mask:l,state:u,target:d,to:p,preventScrollReset:f,viewTransition:g,defaultShouldRevalidate:_,...x},v){let{basename:S,navigator:w,useTransitions:N}=b.useContext(ta),C=typeof p=="string"&&ZN.test(p),T=H8(p,S);p=T.to;let A=VG(p,{relative:s}),E=is(),D=null;if(l){let q=Xb(l,[],E.mask?E.mask.pathname:"/",!0);S!=="/"&&(q.pathname=q.pathname==="/"?S:Xa([S,q.pathname])),D=w.createHref(q)}let[F,B,H]=EX(i,x),$=BX(p,{replace:o,mask:l,state:u,target:d,preventScrollReset:f,relative:s,viewTransition:g,defaultShouldRevalidate:_,useTransitions:N});function z(q){n&&n(q),q.defaultPrevented||$(q)}let W=!(T.isExternal||a),P=b.createElement("a",{...x,...H,href:(W?D:void 0)||T.absoluteURL||A,onClick:W?z:n,ref:OX(v,B),target:d,"data-discover":!C&&r==="render"?"true":void 0});return F&&!C?b.createElement(b.Fragment,null,P,b.createElement(AX,{page:A})):P});bs.displayName="Link";var J8=b.forwardRef(function({"aria-current":n="page",caseSensitive:r=!1,className:i="",end:s=!1,style:a,to:o,viewTransition:l,children:u,...d},p){let f=Zg(o,{relative:d.relative}),g=is(),_=b.useContext(Qb),{navigator:x,basename:v}=b.useContext(ta),S=_!=null&&WX(f)&&l===!0,w=x.encodeLocation?x.encodeLocation(f).pathname:f.pathname,N=g.pathname,C=_&&_.navigation&&_.navigation.location?_.navigation.location.pathname:null;r||(N=N.toLowerCase(),C=C?C.toLowerCase():null,w=w.toLowerCase()),C&&v&&(C=Wl(C,v)||C);const T=w!=="/"&&w.endsWith("/")?w.length-1:w.length;let A=N===w||!s&&N.startsWith(w)&&N.charAt(T)==="/",E=C!=null&&(C===w||!s&&C.startsWith(w)&&C.charAt(w.length)==="/"),D={isActive:A,isPending:E,isTransitioning:S},F=A?n:void 0,B;typeof i=="function"?B=i(D):B=[i,A?"active":null,E?"pending":null,S?"transitioning":null].filter(Boolean).join(" ");let H=typeof a=="function"?a(D):a;return b.createElement(bs,{...d,"aria-current":F,className:B,ref:p,style:H,to:o,viewTransition:l},typeof u=="function"?u(D):u)});J8.displayName="NavLink";var LX=b.forwardRef(({discover:e="render",fetcherKey:n,navigate:r,reloadDocument:i,replace:s,state:a,method:o=Z_,action:l,onSubmit:u,relative:d,preventScrollReset:p,viewTransition:f,defaultShouldRevalidate:g,..._},x)=>{let{useTransitions:v}=b.useContext(ta),S=FX(),w=HX(l,{relative:d}),N=o.toLowerCase()==="get"?"get":"post",C=typeof l=="string"&&ZN.test(l),T=A=>{if(u&&u(A),A.defaultPrevented)return;A.preventDefault();let E=A.nativeEvent.submitter,D=(E==null?void 0:E.getAttribute("formmethod"))||o,F=()=>S(E||A.currentTarget,{fetcherKey:n,method:D,navigate:r,replace:s,state:a,relative:d,preventScrollReset:p,viewTransition:f,defaultShouldRevalidate:g});v&&r!==!1?b.startTransition(()=>F()):F()};return b.createElement("form",{ref:x,method:N,action:w,onSubmit:i?u:T,..._,"data-discover":!C&&e==="render"?"true":void 0})});LX.displayName="Form";function IX(e){return`${e} must be used within a data router.  See https://reactrouter.com/en/main/routers/picking-a-router.`}function eB(e){let n=b.useContext(Uf);return xr(n,IX(e)),n}function BX(e,{target:n,replace:r,mask:i,state:s,preventScrollReset:a,relative:o,viewTransition:l,defaultShouldRevalidate:u,useTransitions:d}={}){let p=Qg(),f=is(),g=Zg(e,{relative:o});return b.useCallback(_=>{if(mX(_,n)){_.preventDefault();let x=r!==void 0?r:ug(f)===ug(g),v=()=>p(e,{replace:x,mask:i,state:s,preventScrollReset:a,relative:o,viewTransition:l,defaultShouldRevalidate:u});d?b.startTransition(()=>v()):v()}},[f,p,g,r,i,s,n,e,a,o,l,u,d])}function Jg(e){Ea(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let n=b.useRef(nC(e)),r=b.useRef(!1),i=is(),s=b.useMemo(()=>gX(i.search,r.current?null:n.current),[i.search]),a=Qg(),o=b.useCallback((l,u)=>{const d=nC(typeof l=="function"?l(new URLSearchParams(s)):l);r.current=!0,a("?"+d,u)},[a,s]);return[s,o]}var zX=0,$X=()=>`__${String(++zX)}__`;function FX(){let{router:e}=eB("useSubmit"),{basename:n}=b.useContext(ta),r=sX(),i=e.fetch,s=e.navigate;return b.useCallback(async(a,o={})=>{let{action:l,method:u,encType:d,formData:p,body:f}=_X(a,n);if(o.navigate===!1){let g=o.fetcherKey||$X();await i(g,r,o.action||l,{defaultShouldRevalidate:o.defaultShouldRevalidate,preventScrollReset:o.preventScrollReset,formData:p,body:f,formMethod:o.method||u,formEncType:o.encType||d,flushSync:o.flushSync})}else await s(o.action||l,{defaultShouldRevalidate:o.defaultShouldRevalidate,preventScrollReset:o.preventScrollReset,formData:p,body:f,formMethod:o.method||u,formEncType:o.encType||d,replace:o.replace,state:o.state,fromRouteId:r,flushSync:o.flushSync,viewTransition:o.viewTransition})},[i,s,n,r])}function HX(e,{relative:n}={}){let{basename:r}=b.useContext(ta),i=b.useContext(to);xr(i,"useFormAction must be used inside a RouteContext");let[s]=i.matches.slice(-1),a={...Zg(e||".",{relative:n})},o=is();if(e==null){a.search=o.search;let l=new URLSearchParams(a.search),u=l.getAll("index");if(u.some(p=>p==="")){l.delete("index"),u.filter(f=>f).forEach(f=>l.append("index",f));let p=l.toString();a.search=p?`?${p}`:""}}return(!e||e===".")&&s.route.index&&(a.search=a.search?a.search.replace(/^\?/,"?index&"):"?index"),r!=="/"&&(a.pathname=a.pathname==="/"?r:Xa([r,a.pathname])),ug(a)}function WX(e,{relative:n}={}){let r=b.useContext(U8);xr(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`.  Did you accidentally import `RouterProvider` from `react-router`?");let{basename:i}=eB("useViewTransitionState"),s=Zg(e,{relative:n});if(!r.isTransitioning)return!1;let a=Wl(r.currentLocation.pathname,i)||r.currentLocation.pathname,o=Wl(r.nextLocation.pathname,i)||r.nextLocation.pathname;return Rx(s.pathname,o)!=null||Rx(s.pathname,a)!=null}var na=O8();const qX=pu(na),tB={system:'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',inter:'"Inter", system-ui, sans-serif',segoe:'"Segoe UI", system-ui, sans-serif',sf:'-apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif'},nB={jetbrains:'"JetBrains Mono", "Fira Code", "Cascadia Code", monospace',fira:'"Fira Code", "JetBrains Mono", "Cascadia Code", monospace',cascadia:'"Cascadia Code", "JetBrains Mono", "Fira Code", monospace',"system-mono":'ui-monospace, "SF Mono", "Cascadia Code", "Fira Code", monospace'},rB=b.createContext({theme:"dark",accent:"cyan",colorTheme:"default-dark",uiFont:"system",monoFont:"jetbrains",uiFontSize:15,monoFontSize:14,resolvedTheme:"dark",activeSkinId:null,activeSkinName:null,installedSkins:[],skinsLoading:!1,setTheme:()=>{},setAccent:()=>{},setColorTheme:()=>{},setUiFont:()=>{},setMonoFont:()=>{},setUiFontSize:()=>{},setMonoFontSize:()=>{},refreshSkins:async()=>{},setSkin:()=>{},importSkinZip:async()=>{throw new Error("Skin import unavailable")},deleteSkin:async()=>{},getSkinAsset:()=>null});function Li(e,n,r,i,s,a,o,l,u,d,p){const f=parseInt(d.slice(1,3),16),g=parseInt(d.slice(3,5),16),_=parseInt(d.slice(5,7),16);return{"--pc-bg-base":e,"--color-scheme":"dark","--pc-bg-surface":n,"--pc-bg-elevated":r,"--pc-bg-input":i,"--pc-bg-sidebar":`${e}f2`,"--pc-bg-code":s,"--pc-border":"rgba(255,255,255,0.08)","--pc-border-strong":"rgba(255,255,255,0.12)","--pc-text-primary":a,"--pc-text-secondary":o,"--pc-text-muted":l,"--pc-text-faint":u,"--pc-scrollbar-thumb":u,"--pc-scrollbar-track":n,"--pc-scrollbar-thumb-hover":l,"--pc-hover":"rgba(255,255,255,0.05)","--pc-hover-strong":"rgba(255,255,255,0.08)","--pc-separator":"rgba(255,255,255,0.05)","--pc-accent":d,"--pc-accent-light":p,"--pc-accent-dim":`rgba(${f},${g},${_},0.3)`,"--pc-accent-glow":`rgba(${f},${g},${_},0.1)`,"--pc-accent-rgb":`${f},${g},${_}`}}function Sc(e,n,r,i,s,a,o,l,u,d,p){const f=parseInt(d.slice(1,3),16),g=parseInt(d.slice(3,5),16),_=parseInt(d.slice(5,7),16);return{"--pc-bg-base":e,"--color-scheme":"light","--pc-bg-surface":n,"--pc-bg-elevated":r,"--pc-bg-input":i,"--pc-bg-sidebar":`${n}f2`,"--pc-bg-code":s,"--pc-border":"rgba(0,0,0,0.08)","--pc-border-strong":"rgba(0,0,0,0.12)","--pc-text-primary":a,"--pc-text-secondary":o,"--pc-text-muted":l,"--pc-text-faint":u,"--pc-scrollbar-thumb":l,"--pc-scrollbar-track":"transparent","--pc-scrollbar-thumb-hover":o,"--pc-hover":"rgba(0,0,0,0.04)","--pc-hover-strong":"rgba(0,0,0,0.07)","--pc-separator":"rgba(0,0,0,0.06)","--pc-accent":d,"--pc-accent-light":p,"--pc-accent-dim":`rgba(${f},${g},${_},0.25)`,"--pc-accent-glow":`rgba(${f},${g},${_},0.08)`,"--pc-accent-rgb":`${f},${g},${_}`}}const UX=[{id:"default-dark",name:"Default Dark",scheme:"dark",preview:["#0b0d10","#6f83d6","#8fa8c8","#f6b44b","#f7f8fc"],vars:Li("#0b0d10","#13161d","#191f27","#10141a","#10141a","#f7f8fc","#c8ceda","#929bad","#687386","#6f83d6","#7c8ddd")},{id:"default-light",name:"Default Light",scheme:"light",preview:["#eef1f5","#596cc6","#4f75a8","#b86f00","#111827"],vars:Sc("#eef1f5","#f7f9fb","#e9edf3","#eef2f6","#e5eaf0","#111827","#334155","#64748b","#94a3b8","#596cc6","#6575d3")},{id:"oled-black",name:"OLED Black",scheme:"dark",preview:["#000000","#22d3ee","#8b5cf6","#10b981","#d4d4d8"],vars:Li("#000000","#0a0a0a","#141414","#0a0a0a","#0a0a0a","#d4d4d8","#a1a1aa","#71717a","#3f3f46","#22d3ee","#67e8f9")},{id:"nord-dark",name:"Nord Dark",scheme:"dark",preview:["#2e3440","#88c0d0","#81a1c1","#a3be8c","#eceff4"],vars:Li("#2e3440","#3b4252","#434c5e","#2e3440","#2e3440","#eceff4","#d8dee9","#7b88a1","#4c566a","#88c0d0","#8fbcbb")},{id:"nord-light",name:"Nord Light",scheme:"light",preview:["#eceff4","#5e81ac","#88c0d0","#a3be8c","#2e3440"],vars:Sc("#eceff4","#e5e9f0","#d8dee9","#e5e9f0","#e5e9f0","#2e3440","#3b4252","#4c566a","#7b88a1","#5e81ac","#81a1c1")},{id:"dracula",name:"Dracula",scheme:"dark",preview:["#282a36","#bd93f9","#ff79c6","#50fa7b","#f8f8f2"],vars:Li("#282a36","#21222c","#343746","#1e1f29","#1e1f29","#f8f8f2","#c0c0d0","#6272a4","#44475a","#bd93f9","#caa9fa")},{id:"monokai",name:"Monokai",scheme:"dark",preview:["#272822","#f92672","#a6e22e","#e6db74","#f8f8f2"],vars:Li("#272822","#2d2e27","#3e3d32","#1e1f1c","#1e1f1c","#f8f8f2","#c0c0b0","#75715e","#49483e","#f92672","#fd5fa0")},{id:"solarized-dark",name:"Solarized Dark",scheme:"dark",preview:["#002b36","#268bd2","#2aa198","#b58900","#839496"],vars:Li("#002b36","#073642","#0a4050","#002028","#002028","#839496","#93a1a1","#657b83","#586e75","#268bd2","#6cb6e8")},{id:"solarized-light",name:"Solarized Light",scheme:"light",preview:["#fdf6e3","#268bd2","#2aa198","#b58900","#073642"],vars:Sc("#fdf6e3","#eee8d5","#ddd6c1","#fdf6e3","#eee8d5","#073642","#586e75","#657b83","#93a1a1","#268bd2","#2aa198")},{id:"kanagawa-wave",name:"Kanagawa Wave",scheme:"dark",preview:["#1f1f28","#7e9cd8","#957fb8","#e6c384","#dcd7ba"],vars:Li("#1f1f28","#2a2a37","#363646","#16161d","#16161d","#dcd7ba","#c8c093","#727169","#54546d","#7e9cd8","#7fb4ca")},{id:"kanagawa-dragon",name:"Kanagawa Dragon",scheme:"dark",preview:["#181616","#8ba4b0","#a292a3","#c4b28a","#c5c9c5"],vars:Li("#181616","#201d1d","#2d2a2a","#12120f","#12120f","#c5c9c5","#a6a69c","#737c73","#625e5a","#8ba4b0","#9cabba")},{id:"kanagawa-lotus",name:"Kanagawa Lotus",scheme:"light",preview:["#f2ecbc","#4d699b","#b35b79","#836f4a","#1f1f28"],vars:Sc("#f2ecbc","#e7dba0","#d5cea3","#f2ecbc","#e7dba0","#1f1f28","#545464","#716e61","#8a8980","#4d699b","#6693bf")},{id:"rose-pine",name:"Rosé Pine",scheme:"dark",preview:["#191724","#ebbcba","#c4a7e7","#f6c177","#e0def4"],vars:Li("#191724","#1f1d2e","#26233a","#13111e","#13111e","#e0def4","#908caa","#6e6a86","#524f67","#ebbcba","#f2d5ce")},{id:"rose-pine-moon",name:"Rosé Pine Moon",scheme:"dark",preview:["#232136","#ea9a97","#c4a7e7","#f6c177","#e0def4"],vars:Li("#232136","#2a273f","#393552","#1b1930","#1b1930","#e0def4","#908caa","#6e6a86","#44415a","#ea9a97","#f0b8b6")},{id:"rose-pine-dawn",name:"Rosé Pine Dawn",scheme:"light",preview:["#faf4ed","#d7827e","#907aa9","#ea9d34","#575279"],vars:Sc("#faf4ed","#fffaf3","#f2e9de","#fffaf3","#f2e9de","#575279","#797593","#9893a5","#cecacd","#d7827e","#b4637a")},{id:"night-owl",name:"Night Owl",scheme:"dark",preview:["#011627","#82aaff","#c792ea","#addb67","#d6deeb"],vars:Li("#011627","#0b2942","#122d42","#010e1a","#010e1a","#d6deeb","#a7bbc7","#5f7e97","#37536b","#82aaff","#a0c4ff")},{id:"everforest-dark",name:"Everforest Dark",scheme:"dark",preview:["#2d353b","#a7c080","#83c092","#dbbc7f","#d3c6aa"],vars:Li("#2d353b","#343f44","#3d484d","#272e33","#272e33","#d3c6aa","#9da9a0","#7a8478","#56635f","#a7c080","#83c092")},{id:"everforest-light",name:"Everforest Light",scheme:"light",preview:["#fdf6e3","#8da101","#35a77c","#dfa000","#5c6a72"],vars:Sc("#fdf6e3","#f3ead3","#e9dfc4","#f3ead3","#eee8d5","#5c6a72","#708089","#829181","#a6b0a0","#8da101","#93b259")},{id:"cobalt2",name:"Cobalt2",scheme:"dark",preview:["#193549","#ffc600","#ff9d00","#80ffbb","#ffffff"],vars:Li("#193549","#1f4662","#234d6e","#0d2b3e","#0d2b3e","#ffffff","#a0c4d8","#507a8f","#305a6f","#ffc600","#ffd740")},{id:"flexoki-dark",name:"Flexoki Dark",scheme:"dark",preview:["#100f0f","#ce5d97","#879a39","#da702c","#cecdc3"],vars:Li("#100f0f","#1c1b1a","#282726","#100f0f","#1c1b1a","#cecdc3","#b7b5ac","#878580","#575653","#ce5d97","#d68fb2")},{id:"flexoki-light",name:"Flexoki Light",scheme:"light",preview:["#fffcf0","#ce5d97","#879a39","#da702c","#100f0f"],vars:Sc("#fffcf0","#f2f0e5","#e6e4d9","#fffcf0","#f2f0e5","#100f0f","#343331","#575653","#878580","#ce5d97","#a02f6f")},{id:"hacker-green",name:"Hacker Green",scheme:"dark",preview:["#0a0e0a","#00ff41","#00cc33","#008f11","#33ff66"],vars:Li("#0a0e0a","#0d120d","#121a12","#080c08","#080c08","#00ff41","#00cc33","#008f11","#005a0a","#00ff41","#33ff66")},{id:"material-dark",name:"Material Dark",scheme:"dark",preview:["#212121","#89ddff","#c792ea","#ffcb6b","#eeffff"],vars:Li("#212121","#292929","#333333","#1a1a1a","#1a1a1a","#eeffff","#b0bec5","#616161","#424242","#89ddff","#80cbc4")},{id:"material-light",name:"Material Light",scheme:"light",preview:["#fafafa","#6182b8","#7c4dff","#f76d47","#212121"],vars:Sc("#fafafa","#ffffff","#eaeaea","#ffffff","#f5f5f5","#212121","#424242","#757575","#bdbdbd","#6182b8","#7c4dff")}],Gc=Object.fromEntries(UX.map(e=>[e.id,e])),rC="default-dark",j3="default-light",iB="revka-theme",VX="revka",Bu={theme:"dark",accent:"cyan",colorTheme:"default-dark",uiFont:"system",monoFont:"jetbrains",uiFontSize:15,monoFontSize:14,activeSkinId:VX},KX=["dark","light","oled","system"],YX=["cyan","violet","emerald","amber","rose","blue"];function GX(e){switch(e){case"light":return"default-light";case"oled":return"oled-black";default:return"default-dark"}}function XX(){try{const e=localStorage.getItem(iB);if(e){const n=JSON.parse(e),r=KX.includes(n.theme),i=YX.includes(n.accent),s=tB[n.uiFont]?n.uiFont:Bu.uiFont,a=nB[n.monoFont]?n.monoFont:Bu.monoFont,o=Number.isFinite(n.uiFontSize)?Math.min(20,Math.max(12,Number(n.uiFontSize))):Bu.uiFontSize,l=Number.isFinite(n.monoFontSize)?Math.min(20,Math.max(12,Number(n.monoFontSize))):Bu.monoFontSize,u=Object.prototype.hasOwnProperty.call(n,"activeSkinId"),d=typeof n.activeSkinId=="string"&&n.activeSkinId.trim()?n.activeSkinId:u?null:Bu.activeSkinId;let p=Bu.colorTheme;if(n.colorTheme&&Gc[n.colorTheme]?p=n.colorTheme:r&&(p=GX(n.theme)),r&&i)return{theme:n.theme,accent:n.accent,colorTheme:p,uiFont:s,monoFont:a,uiFontSize:o,monoFontSize:l,activeSkinId:d}}}catch{}return Bu}const N3=new Set;function rf(e,n="400;500;600"){const r=`gfont-${e.replace(/\s+/g,"-").toLowerCase()}`;if(N3.has(r))return;N3.add(r);const i=document.createElement("link");i.id=r,i.rel="stylesheet",i.href=`https://fonts.googleapis.com/css2?family=${encodeURIComponent(e)}:wght@${n}&display=swap`,document.head.appendChild(i)}function E3(e){e==="inter"&&rf("Inter"),e==="segoe"&&rf("Segoe UI"),e==="sf"&&rf("SF Pro Text")}function A3(e){e==="jetbrains"&&rf("JetBrains Mono"),e==="fira"&&rf("Fira Code"),e==="cascadia"&&rf("Cascadia Code")}const QX=["brandLogo","operatorAvatar","dashboardHero","shellTexture","panelDecoration","pageBackdrop","sidebarBackdrop","headerBackdrop","dashboardShowcase","dashboardAccent","graphBackdrop","metricDecoration","runCardDecoration","stepCardDecoration","timelineDecoration","riskRailDecoration","agentRailDecoration","commandBandDecoration","recentRunsDecoration","statusRunningBadge","statusSuccessBadge","statusFailedBadge","statusPendingBadge","statusSkippedBadge"],dg="revka_token",T3="revka_token";try{if(!localStorage.getItem(dg)){const e=localStorage.getItem(T3);e&&(localStorage.setItem(dg,e),localStorage.removeItem(T3))}}catch{}function ns(){try{return localStorage.getItem(dg)}catch{return null}}function sB(e){try{localStorage.setItem(dg,e)}catch{}}function aB(){try{localStorage.removeItem(dg)}catch{}}function pw(){const e=ns();return e!==null&&e.length>0}const Kf=()=>"__TAURI__"in window,ZX=()=>window.__REVKA_GATEWAY__??"http://127.0.0.1:42617",Gr=Kf()?"":(window.__REVKA_BASE__??"").replace(/\/+$/,""),Ti=Kf()?ZX():"",JX=`${Gr}/_app`;function id(e){const n=e.replace(/^\/+/,""),r=JX.replace(/\/+$/,"");return r?`${r}/${n}`:`/${n}`}function zm(e,n){const r=encodeURIComponent(e),i=n.replace(/^\/+/,"").replace(/^assets\//,"").split("/").map(s=>encodeURIComponent(s)).join("/");return`${Ti}${Gr}/api/skins/${r}/assets/${i}`}const M3="revka.editor.session_id";let mw=null;function R3(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`s-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`}function aE(){try{const e=sessionStorage.getItem(M3);if(e)return e;const n=R3();return sessionStorage.setItem(M3,n),n}catch{return mw||(mw=R3()),mw}}const oB="X-Revka-Session";class ql extends Error{constructor(r,i,s,a=null){super(i);$n(this,"status");$n(this,"body");$n(this,"errorCode");if(this.name="ApiError",this.status=r,this.body=s,a===null&&s&&typeof s=="object"){const o=s,l=o.error_code??o.code;this.errorCode=typeof l=="string"?l:null}else this.errorCode=a}}function eQ(e,n){if(n&&n.toLowerCase().startsWith("text/html"))return!0;const r=e.trimStart().slice(0,16).toLowerCase();return r.startsWith("<!doctype")||r.startsWith("<html")}function oE(e,n,r,i){let s=null;if(r)try{s=JSON.parse(r)}catch{s=r}const a=s&&typeof s=="object"&&"error"in s?String(s.error):null,o=eQ(r,i)?`Service temporarily unavailable (HTTP ${e})`:null,l=a||o||(r&&typeof s=="string"?r:null)||n||`API ${e}`;return new ql(e,`API ${e}: ${l}`,s)}class tQ extends Error{constructor(){super("Unauthorized"),this.name="UnauthorizedError"}}async function ut(e,n={}){const r=ns(),i=new Headers(n.headers);r&&i.set("Authorization",`Bearer ${r}`),n.body&&typeof n.body=="string"&&!i.has("Content-Type")&&i.set("Content-Type","application/json");const s=await fetch(`${Ti}${Gr}${e}`,{...n,headers:i});if(s.status===401)throw aB(),window.dispatchEvent(new Event("revka-unauthorized")),new tQ;if(!s.ok){const a=await s.text().catch(()=>""),o=s.headers.get("content-type");throw oE(s.status,s.statusText,a,o)}if(s.status!==204)return s.json()}function In(e,n){if(e!==null&&typeof e=="object"&&!Array.isArray(e)&&n in e){const r=e[n];if(r!==void 0)return r}return e}function hd(e){const n=e==null?void 0:e.trim();return n?n.slice(0,120):void 0}function nQ(){var i;if(typeof navigator>"u")return;const e=navigator,n=hd(((i=e.userAgentData)==null?void 0:i.platform)||e.platform);if(n)return n;const r=navigator.userAgent;if(/android/i.test(r))return"Android";if(/iphone|ipad/i.test(r))return"iOS";if(/windows/i.test(r))return"Windows";if(/macintosh|mac os/i.test(r))return"macOS";if(/linux/i.test(r))return"Linux"}function lB(e){if(typeof navigator>"u")return{device_name:"Dashboard browser",device_type:e??"browser"};const n=navigator.userAgent,r=/android|iphone|ipad|mobile/i.test(n);return{device_name:r?"Dashboard mobile":"Dashboard browser",device_type:e??(r?"mobile":"browser"),hardware:nQ()}}function rQ(e){const n={},r=hd(e==null?void 0:e.device_name),i=hd(e==null?void 0:e.device_type),s=hd(e==null?void 0:e.hardware);return r&&(n["X-Revka-Device-Name"]=r),i&&(n["X-Revka-Device-Type"]=i),s&&(n["X-Revka-Device-Hardware"]=s),n}async function iQ(e,n=lB()){const r=await fetch(`${Ti}${Gr}/pair`,{method:"POST",headers:{"X-Pairing-Code":e,...rQ(n)}});if(!r.ok){const s=await r.text().catch(()=>"");throw new Error(`Pairing failed (${r.status}): ${s||r.statusText}`)}const i=await r.json();return sB(i.token),i}async function sQ(e,n){const r=await fetch(`${Ti}${Gr}/api/pair`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:e,device_name:hd(n.device_name),device_type:hd(n.device_type),hardware:hd(n.hardware)})});if(!r.ok){const i=await r.text().catch(()=>""),s=r.headers.get("content-type");throw oE(r.status,r.statusText,i,s)}return r.json()}async function cB(){const e=await fetch(`${Gr}/pair/code`);if(e.ok)return e.json();const n=await fetch("/admin/paircode");if(!n.ok)throw new Error(`Failed to fetch pairing code (${n.status})`);return n.json()}async function aQ(){const e=await fetch(`${Gr}/health`);if(!e.ok)throw new Error(`Health check failed (${e.status})`);return e.json()}function oQ(){return ut("/api/status")}function lQ(){return ut("/api/config").then(e=>typeof e=="string"?e:e.content)}function cQ(e){return ut("/api/config",{method:"PUT",headers:{"Content-Type":"application/toml"},body:e})}function uQ(){return ut("/api/skins").then(e=>In(e,"skins"))}function dQ(e){return ut("/api/skins/import",{method:"POST",headers:{"Content-Type":e.type||"application/zip"},body:e}).then(n=>In(n,"skin"))}function hQ(e){return ut(`/api/skins/${encodeURIComponent(e)}`,{method:"DELETE"})}function fQ(){return ut("/api/tools").then(e=>In(e,"tools"))}function pQ(){return ut("/api/cron").then(e=>In(e,"jobs"))}function mQ(e){return ut("/api/cron",{method:"POST",body:JSON.stringify(e)}).then(n=>typeof n.job=="object"?n.job:n)}function gQ(e){return ut(`/api/cron/${encodeURIComponent(e)}`,{method:"DELETE"})}function vQ(e,n){return ut(`/api/cron/${encodeURIComponent(e)}`,{method:"PATCH",body:JSON.stringify(n)}).then(r=>typeof r.job=="object"?r.job:r)}function yQ(e,n=20){const r=new URLSearchParams({limit:String(n)});return ut(`/api/cron/${encodeURIComponent(e)}/runs?${r}`).then(i=>In(i,"runs"))}function _Q(){return ut("/api/cron/settings")}function xQ(e){return ut("/api/cron/settings",{method:"PATCH",body:JSON.stringify(e)})}function bQ(){return ut("/api/integrations").then(e=>In(e,"integrations"))}function kQ(e){return ut("/api/mcp/servers/test",{method:"POST",body:JSON.stringify(e)})}function wQ(){return ut("/api/doctor",{method:"POST",body:JSON.stringify({})}).then(e=>Array.isArray(e)?e:e.results)}function uB(){return ut("/api/cost").then(e=>In(e,"cost"))}function SQ(e){const n=new URLSearchParams;n.set("limit",String(e.limit)),e!=null&&e.event_type&&n.set("event_type",e.event_type),e!=null&&e.since&&n.set("since",e.since);const r=n.toString();return ut(`/api/audit${r?`?${r}`:""}`)}function Dx(){return ut("/api/audit/verify")}function dB(){return ut("/api/sessions").then(e=>Array.isArray(e)?{sessions:e,archivedSessionIds:[]}:{sessions:e.sessions,archivedSessionIds:e.archived_session_ids??[]})}function CQ(){return dB().then(e=>e.sessions)}function jQ(e){return ut(`/api/sessions/${encodeURIComponent(e)}/messages`)}function NQ(e){return ut(`/api/sessions/${encodeURIComponent(e)}`,{method:"DELETE"})}function EQ(e,n){return ut(`/api/sessions/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify({name:n})})}function AQ(e,n){const r=new FormData;return r.append("file",n,n.name),ut(`/api/sessions/${encodeURIComponent(e)}/attachments`,{method:"POST",body:r})}function hB(){return ut("/api/channels").then(e=>In(e,"channels"))}function TQ(){return ut("/api/cli-tools").then(e=>In(e,"cli_tools"))}async function lE(e=!1,n=1,r=9){const i=new URLSearchParams;return e&&i.set("include_deprecated","true"),i.set("page",String(n)),i.set("per_page",String(r)),ut(`/api/agents?${i}`)}async function fB(e){return ut("/api/agents",{method:"POST",body:JSON.stringify(e)}).then(n=>In(n,"agent"))}async function MQ(e){const n=e.kref.replace(/^kref:\/\//,"");return ut(`/api/agents/${n}`,{method:"PUT",body:JSON.stringify(e)}).then(r=>In(r,"agent"))}async function iC(e,n){const r=new FormData;return r.append("kref",e),r.append("file",n,n.name),ut("/api/agents/avatar",{method:"POST",body:r}).then(i=>In(i,"agent"))}async function RQ(e,n){return ut("/api/agents/deprecate",{method:"POST",body:JSON.stringify({kref:e,deprecated:n})}).then(r=>In(r,"agent"))}async function OQ(e){const n=e.replace(/^kref:\/\//,"");return ut(`/api/agents/${n}`,{method:"DELETE"})}async function DQ(){return(await ut("/api/auth/profiles")).profiles??[]}async function PQ(e){return ut("/api/auth/profiles",{method:"POST",body:JSON.stringify(e)}).then(n=>In(n,"profile"))}async function LQ(e){return ut(`/api/auth/profiles/${encodeURIComponent(e)}`,{method:"DELETE"})}async function IQ(){return ut("/api/gcloud/configs")}async function BQ(e){return ut("/api/gcloud/configs",{method:"POST",body:JSON.stringify(e)}).then(n=>In(n,"config"))}async function pB(e=!1,n=1,r=9){const i=new URLSearchParams;return e&&i.set("include_deprecated","true"),i.set("page",String(n)),i.set("per_page",String(r)),ut(`/api/skills?${i}`)}async function zQ(e){const n=e.replace("kref://","");return ut(`/api/skills/${n}`).then(r=>r.skill)}async function $Q(e){return ut("/api/skills",{method:"POST",body:JSON.stringify(e)}).then(n=>In(n,"skill"))}async function FQ(e){const n=e.kref.replace(/^kref:\/\//,"");return ut(`/api/skills/${n}`,{method:"PUT",body:JSON.stringify(e)}).then(r=>In(r,"skill"))}async function HQ(e,n){return ut("/api/skills/deprecate",{method:"POST",body:JSON.stringify({kref:e,deprecated:n})}).then(r=>In(r,"skill"))}async function WQ(e){const n=e.replace(/^kref:\/\//,"");return ut(`/api/skills/${n}`,{method:"DELETE"})}function mB(e){return e.map(n=>{const r=n.skill??n,i=n.latestVersion??r.latestVersion??{},s=r.stats??n.stats??{};return{score:n.score??0,slug:r.slug??n.slug??"",displayName:r.displayName??r.name??n.displayName??n.name,name:r.name??r.displayName??n.name??n.displayName,description:r.description??r.summary??n.description??n.summary??"",version:i.version??r.version??n.version??"",downloads:s.downloads??s.installsAllTime??n.downloads,stars:s.stars??n.stars,verified:r.verified??n.verified,updatedAt:r.updatedAt??n.updatedAt}})}async function O3(e,n=20){const r=new URLSearchParams({q:e,limit:String(n)});return ut(`/api/clawhub/search?${r}`).then(i=>{const s=Array.isArray(i)?i:(i==null?void 0:i.results)??(i==null?void 0:i.items)??[];return mB(s)})}async function qQ(e=20){const n=new URLSearchParams({limit:String(e)});return ut(`/api/clawhub/trending?${n}`).then(r=>{const i=Array.isArray(r)?r:(r==null?void 0:r.results)??(r==null?void 0:r.items)??(r==null?void 0:r.skills)??[];return mB(i)})}async function D3(e){return ut(`/api/clawhub/install/${encodeURIComponent(e)}`,{method:"POST"})}async function gB(e=!1,n=!0){const r=new URLSearchParams;return e&&r.set("include_deprecated","true"),n||r.set("include_definition","false"),ut(`/api/workflows?${r}`).then(i=>In(i,"workflows"))}async function UQ(e){return ut("/api/workflows",{method:"POST",body:JSON.stringify(e),headers:{[oB]:aE()}}).then(n=>In(n,"workflow"))}async function VQ(e){const n=e.kref.replace(/^kref:\/\//,"");return ut(`/api/workflows/${n}`,{method:"PUT",body:JSON.stringify(e),headers:{[oB]:aE()}}).then(r=>In(r,"workflow"))}async function KQ(e,n){return ut("/api/workflows/deprecate",{method:"POST",body:JSON.stringify({kref:e,deprecated:n})}).then(r=>In(r,"workflow"))}async function YQ(e){const n=e.replace(/^kref:\/\//,"");return ut(`/api/workflows/${n}`,{method:"DELETE"})}async function e0(e){const n=encodeURIComponent(e.replace(/^kref:\/\//,""));return ut(`/api/workflows/revisions/${n}`).then(r=>In(r,"workflow"))}async function vB(e=20,n){const r=new URLSearchParams({limit:String(e)});return ut(`/api/workflows/runs?${r}`).then(i=>In(i,"runs"))}async function GQ(e){return ut(`/api/workflows/runs/${encodeURIComponent(e)}`,{method:"DELETE"})}async function To(e){return ut(`/api/workflows/runs/${encodeURIComponent(e)}`).then(n=>In(n,"run"))}async function XQ(e,n,r){return ut(`/api/workflows/runs/${encodeURIComponent(e)}/approve`,{method:"POST",body:JSON.stringify({approved:n,feedback:r})})}async function QQ(e,n){return ut(`/api/workflows/runs/${encodeURIComponent(e)}/retry`,{method:"POST",body:JSON.stringify({})})}async function ZQ(e){return ut(`/api/workflows/runs/${encodeURIComponent(e)}/cancel`,{method:"POST",body:JSON.stringify({})})}async function yB(e,n,r,i){const s={inputs:{}};return i!=null&&i.targetStepId&&(s.target_step_id=i.targetStepId),ut(`/api/workflows/run/${encodeURIComponent(e)}`,{method:"POST",body:JSON.stringify(s)})}async function JQ(e){const n=new URLSearchParams({workflow_kref:e});return ut(`/api/architect/revisions?${n}`)}async function eZ(e){return ut("/api/architect/republish",{method:"POST",body:JSON.stringify({revision_kref:e})})}async function tZ(e){return ut("/api/architect/validate_yaml",{method:"POST",body:JSON.stringify(e)})}async function P3(e,n="summary",r=100){return ut(`/api/workflows/agent-activity/${encodeURIComponent(e)}?view=${n}&limit=${r}`)}async function nZ(e=!0){const n=new URLSearchParams;e||n.set("include_definition","false");const r=n.toString();return ut(`/api/workflows/dashboard${r?`?${r}`:""}`).then(i=>In(i,"dashboard"))}async function rZ(e=!1,n=1,r=9){const i=new URLSearchParams;return e&&i.set("include_deprecated","true"),i.set("page",String(n)),i.set("per_page",String(r)),ut(`/api/teams?${i}`)}async function L3(e){const n=e.replace(/^kref:\/\//,"");return ut(`/api/teams/${n}`).then(r=>In(r,"team"))}async function iZ(e){return ut("/api/teams",{method:"POST",body:JSON.stringify(e)}).then(n=>In(n,"team"))}async function sZ(e){const n=e.kref.replace(/^kref:\/\//,"");return ut(`/api/teams/${n}`,{method:"PUT",body:JSON.stringify(e)}).then(r=>In(r,"team"))}async function I3(e,n){const r=new FormData;return r.append("kref",e),r.append("file",n,n.name),ut("/api/teams/avatar",{method:"POST",body:r}).then(i=>In(i,"team"))}async function aZ(e,n){return ut("/api/teams/deprecate",{method:"POST",body:JSON.stringify({kref:e,deprecated:n})})}async function oZ(e){const n=e.replace(/^kref:\/\//,"");return ut(`/api/teams/${n}`,{method:"DELETE"})}async function lZ(e){const n=new URLSearchParams;if(e)for(const[i,s]of Object.entries(e))s!=null&&s!==""&&n.set(i,String(s));const r=n.toString();return ut(`/api/memory/graph${r?`?${r}`:""}`)}async function Eo(e,n){const r=new URLSearchParams;if(n)for(const[a,o]of Object.entries(n))o!=null&&o!==""&&r.set(a,String(o));const i=r.toString(),s=e.startsWith("/")?e.slice(1):e;return ut(`/api/kumiho/${s}${i?`?${i}`:""}`)}async function cZ(e){return ut("/api/assets/projects",{method:"POST",body:JSON.stringify(e)}).then(n=>n.project)}async function uZ(e){return ut("/api/assets/spaces",{method:"POST",body:JSON.stringify(e)}).then(n=>n.space)}async function B3(e){return ut("/api/assets/items",{method:"POST",body:JSON.stringify(e)}).then(n=>n.item)}async function gw(e){return ut("/api/assets/revisions",{method:"POST",body:JSON.stringify(e)}).then(n=>n.revision)}async function dZ(e){return ut("/api/assets/bundles",{method:"POST",body:JSON.stringify(e)}).then(n=>n.bundle)}async function hZ(e,n){const r=new URLSearchParams({project:e});return n&&r.set("space_path",n),ut(`/api/assets/bundles?${r.toString()}`).then(i=>i.bundles)}async function fZ(e){const n=new URLSearchParams({bundle_kref:e});return ut(`/api/assets/bundles/members?${n.toString()}`)}async function pZ(e){await ut("/api/assets/bundles/members",{method:"POST",body:JSON.stringify(e)})}async function mZ(e){await ut("/api/assets/bundles/members",{method:"DELETE",body:JSON.stringify(e)})}async function vw(e){return ut("/api/assets/artifacts",{method:"POST",body:JSON.stringify(e)}).then(n=>n.artifact)}async function gZ(e){return ut("/api/assets/edges",{method:"POST",body:JSON.stringify(e)}).then(n=>n.edge)}async function vZ(e,n){return ut("/api/assets/revisions/tags",{method:"POST",body:JSON.stringify({kref:e,tag:n})}).then(r=>r.revision)}async function yZ(e,n){return ut("/api/assets/revisions/tags",{method:"DELETE",body:JSON.stringify({kref:e,tag:n})}).then(r=>r.revision)}async function _Z(e){const n=new URLSearchParams;for(const[r,i]of Object.entries(e))i!=null&&i!==""&&n.set(r,String(i));return ut(`/api/assets/dependency-graph?${n.toString()}`)}async function xZ(e,n){return ut("/api/assets/items/deprecate",{method:"POST",body:JSON.stringify({kref:e,deprecated:n})}).then(r=>r.item)}async function bZ(e,n){return ut("/api/assets/revisions/deprecate",{method:"POST",body:JSON.stringify({kref:e,deprecated:n})}).then(r=>r.revision)}async function kZ(e){return ut("/api/assets/revisions/publish",{method:"POST",body:JSON.stringify({kref:e})}).then(n=>n.revision)}async function wZ(e,n){return ut("/api/assets/artifacts/deprecate",{method:"POST",body:JSON.stringify({kref:e,deprecated:n})}).then(r=>r.artifact)}async function SZ(e,n,r){return ut("/api/assets/artifacts/content",{method:"PUT",body:JSON.stringify({artifact_kref:e,revision_kref:n,content:r})})}async function CZ(e){const n=ns(),r=new Headers;n&&r.set("Authorization",`Bearer ${n}`);const i=await fetch(`${Ti}${Gr}/api/artifact-body?location=${encodeURIComponent(e)}`,{headers:r});if(!i.ok){const s=await i.text().catch(()=>""),a=i.headers.get("content-type");throw oE(i.status,i.statusText,s,a)}return i.text()}const _B=b.createContext(null);function jZ({children:e}){const[n,r]=b.useState(ns),[i,s]=b.useState(pw),[a,o]=b.useState(!0),[l,u]=b.useState(!pw());b.useEffect(()=>{if(pw())return;let g=!1;return aQ().then(_=>{g||_.require_pairing||(o(!1),s(!0))}).catch(()=>{}).finally(()=>{g||u(!1)}),()=>{g=!0}},[]),b.useEffect(()=>{const g=_=>{if(_.key==="revka_token"){const x=ns();r(x),s(x!==null&&x.length>0)}};return window.addEventListener("storage",g),()=>window.removeEventListener("storage",g)},[]);const d=b.useCallback(async g=>{const{token:_}=await iQ(g);sB(_),r(_),s(!0)},[]),p=b.useCallback(()=>{aB(),r(null),s(!1)},[]),f={token:n,isAuthenticated:i,requiresPairing:a,loading:l,pair:d,logout:p};return Wf.createElement(_B.Provider,{value:f},e)}function xB(){const e=b.useContext(_B);if(!e)throw new Error("useAuth must be used within an <AuthProvider>");return e}const NZ={cyan:{"--pc-accent":"#8fa8c8","--pc-accent-light":"#a4bad6","--pc-accent-dim":"rgba(143,168,200,0.22)","--pc-accent-glow":"rgba(143,168,200,0.08)","--pc-accent-rgb":"143,168,200"},violet:{"--pc-accent":"#8b5cf6","--pc-accent-light":"#a78bfa","--pc-accent-dim":"rgba(139,92,246,0.3)","--pc-accent-glow":"rgba(139,92,246,0.1)","--pc-accent-rgb":"139,92,246"},emerald:{"--pc-accent":"#10b981","--pc-accent-light":"#34d399","--pc-accent-dim":"rgba(16,185,129,0.3)","--pc-accent-glow":"rgba(16,185,129,0.1)","--pc-accent-rgb":"16,185,129"},amber:{"--pc-accent":"#f59e0b","--pc-accent-light":"#fbbf24","--pc-accent-dim":"rgba(245,158,11,0.3)","--pc-accent-glow":"rgba(245,158,11,0.1)","--pc-accent-rgb":"245,158,11"},rose:{"--pc-accent":"#f43f5e","--pc-accent-light":"#fb7185","--pc-accent-dim":"rgba(244,63,94,0.3)","--pc-accent-glow":"rgba(244,63,94,0.1)","--pc-accent-rgb":"244,63,94"},blue:{"--pc-accent":"#6f83d6","--pc-accent-light":"#7c8ddd","--pc-accent-dim":"rgba(111,131,214,0.22)","--pc-accent-glow":"rgba(111,131,214,0.08)","--pc-accent-rgb":"111,131,214"}};function EZ(e){const n=document.documentElement;for(const[r,i]of Object.entries(e))r==="--color-scheme"?n.style.colorScheme=i:n.style.setProperty(r,i)}let z3=new Set;function AZ(e){const n=document.documentElement;for(const r of z3)r in e||n.style.removeProperty(r);z3=new Set(Object.keys(e))}const TZ={"--revka-bg-base":["--pc-bg-base"],"--revka-bg-surface":["--pc-bg-surface"],"--revka-bg-elevated":["--pc-bg-elevated","--pc-bg-code"],"--revka-bg-input":["--pc-bg-input"],"--revka-bg-shell":["--pc-bg-sidebar"],"--revka-border-soft":["--pc-border"],"--revka-border-strong":["--pc-border-strong"],"--revka-text-primary":["--pc-text-primary"],"--revka-text-secondary":["--pc-text-secondary"],"--revka-text-muted":["--pc-text-muted"],"--revka-text-faint":["--pc-text-faint"],"--revka-signal-live":["--pc-accent"],"--revka-signal-selected":["--pc-accent-light"],"--revka-signal-live-soft":["--pc-accent-glow"],"--revka-signal-network-soft":["--pc-hover"],"--revka-border-neutral":["--pc-separator"]};function MZ(e){const n=e.trim().toLowerCase();if(!n.startsWith("#"))return null;const r=n.slice(1);if(r.length===3||r.length===4){const[i,s,a]=r.slice(0,3).split("").map(o=>parseInt(o+o,16));return[i,s,a].every(o=>Number.isFinite(o))?`${i}, ${s}, ${a}`:null}if(r.length===6||r.length===8){const i=parseInt(r.slice(0,2),16),s=parseInt(r.slice(2,4),16),a=parseInt(r.slice(4,6),16);return[i,s,a].every(o=>Number.isFinite(o))?`${i}, ${s}, ${a}`:null}return null}function RZ(e){const n={};for(const[i,s]of Object.entries(TZ)){const a=e[i];if(a)for(const o of s)n[o]=a}const r=e["--revka-signal-live"];if(r){const i=MZ(r);i&&(n["--pc-accent-rgb"]=i),n["--pc-accent-dim"]=`color-mix(in srgb, ${r} 30%, transparent)`,n["--pc-accent-glow"]=e["--revka-signal-live-soft"]??`color-mix(in srgb, ${r} 12%, transparent)`,n["--pc-accent-glow-strong"]=`color-mix(in srgb, ${r} 22%, transparent)`}return n}function bB(e,n){if(e==="system"){const r=window.matchMedia("(prefers-color-scheme: light)").matches,i=Gc[n];return i&&(r&&i.scheme==="light"||!r&&i.scheme==="dark")?n:r?j3:rC}if(e==="oled")return"oled-black";if(e==="light"){const r=Gc[n];return(r==null?void 0:r.scheme)==="light"?n:j3}if(e==="dark"){const r=Gc[n];return(r==null?void 0:r.scheme)==="dark"?n:rC}return n}function $3(e,n){if(e==="oled")return"oled";if(e==="light"||e==="dark")return e;const r=bB(e,n),i=Gc[r];return(i==null?void 0:i.scheme)??"dark"}function OZ(e,n,r,i){return{"--pc-font-ui":tB[e],"--pc-font-mono":nB[n],"--pc-font-size":`${r}px`,"--pc-font-size-mono":`${i}px`}}function kB(e,n){return e?(n==="light"?e.manifest.modes.light:e.manifest.modes.dark)??e.manifest.modes.dark??e.manifest.modes.light??null:null}function DZ(e){return`url("${e.replace(/"/g,"%22")}")`}function PZ(e,n){const r={};for(const i of QX){const s=n[i];r[`--revka-skin-${i}`]=s&&e?DZ(zm(e.id,s)):"none"}return r}function LZ(e){const n={},r=e["--revka-bg-base"],i=e["--revka-bg-surface"],s=e["--revka-bg-panel"],a=e["--revka-bg-panel-strong"],o=e["--revka-border-soft"],l=e["--revka-signal-live"],u=e["--revka-signal-network"],d=e["--revka-signal-selected"]??l,p=a??i??s,f=e["--revka-status-success"]??d??l;if(p&&!e["--revka-bg-input"]&&(n["--revka-bg-input"]=`color-mix(in srgb, ${p} 88%, ${r??"black"})`),(o||d)&&!e["--revka-border-neutral"]){const g=d?`color-mix(in srgb, ${d} 18%, ${o??"transparent"})`:o;g&&(n["--revka-border-neutral"]=g)}return l&&!e["--revka-signal-live-soft"]&&(n["--revka-signal-live-soft"]=`color-mix(in srgb, ${l} 16%, transparent)`),u&&!e["--revka-signal-network-soft"]&&(n["--revka-signal-network-soft"]=`color-mix(in srgb, ${u} 14%, transparent)`),d&&!e["--revka-signal-selected-soft"]&&(n["--revka-signal-selected-soft"]=`color-mix(in srgb, ${d} 18%, transparent)`),d&&!e["--revka-hover-surface"]&&(n["--revka-hover-surface"]=`color-mix(in srgb, ${d} 10%, var(--revka-bg-surface))`),f&&!e["--revka-status-success"]&&(n["--revka-status-success"]=f),f&&!e["--revka-status-ok"]&&(n["--revka-status-ok"]=f),e["--revka-status-danger"]&&!e["--revka-status-error"]&&(n["--revka-status-error"]=e["--revka-status-danger"]),n}function IZ(e,n){const r=kB(e,n),i=(r==null?void 0:r.tokens)??{},s={...LZ(i),...i},a=(r==null?void 0:r.assets)??{};return{...s,...RZ(s),...PZ(e,a)}}function BZ({children:e}){const{isAuthenticated:n,loading:r}=xB(),[i]=b.useState(XX),[s,a]=b.useState(i.theme),[o,l]=b.useState(i.accent),[u,d]=b.useState(i.colorTheme),[p,f]=b.useState(i.uiFont),[g,_]=b.useState(i.monoFont),[x,v]=b.useState(i.uiFontSize),[S,w]=b.useState(i.monoFontSize),[N,C]=b.useState(i.activeSkinId),[T,A]=b.useState([]),[E,D]=b.useState(!1),F=b.useCallback(X=>{localStorage.setItem(iB,JSON.stringify({theme:X.theme,accent:X.accent,colorTheme:X.colorTheme,uiFont:X.uiFont,monoFont:X.monoFont,uiFontSize:X.uiFontSize,monoFontSize:X.monoFontSize,activeSkinId:X.activeSkinId}))},[]),B=b.useCallback(X=>{const se=bB(X.theme,X.colorTheme),re=Gc[se],de=(re==null?void 0:re.vars)??Gc[rC].vars,ue=$3(X.theme,X.colorTheme),ae=T.find(J=>J.id===X.activeSkinId)??null,pe=IZ(ae,ue);document.documentElement.dataset.revkaSkin=(ae==null?void 0:ae.id)??X.activeSkinId??"none",AZ(pe),EZ({...de,...NZ[X.accent],...OZ(X.uiFont,X.monoFont,X.uiFontSize,X.monoFontSize),...pe})},[T]),H=b.useCallback(X=>{a(X);const se={theme:X,accent:o,colorTheme:u,uiFont:p,monoFont:g,uiFontSize:x,monoFontSize:S,activeSkinId:N};B(se),F(se)},[o,u,p,g,x,S,N,B,F]),$=b.useCallback(X=>{l(X);const se={theme:s,accent:X,colorTheme:u,uiFont:p,monoFont:g,uiFontSize:x,monoFontSize:S,activeSkinId:N};B(se),F(se)},[s,u,p,g,x,S,N,B,F]),z=b.useCallback(X=>{d(X);const se=Gc[X];let re=s;se&&s!=="system"&&(X==="oled-black"?re="oled":re=se.scheme,a(re));const de={theme:re,accent:o,colorTheme:X,uiFont:p,monoFont:g,uiFontSize:x,monoFontSize:S,activeSkinId:N};B(de),F(de)},[s,o,p,g,x,S,N,B,F]),W=b.useCallback(X=>{f(X),E3(X);const se={theme:s,accent:o,colorTheme:u,uiFont:X,monoFont:g,uiFontSize:x,monoFontSize:S,activeSkinId:N};B(se),F(se)},[s,o,u,N,B,F,g,x,S]),P=b.useCallback(X=>{_(X),A3(X);const se={theme:s,accent:o,colorTheme:u,uiFont:p,monoFont:X,uiFontSize:x,monoFontSize:S,activeSkinId:N};B(se),F(se)},[s,o,u,N,B,F,p,x,S]),q=b.useCallback(X=>{const se=Math.min(20,Math.max(12,X));v(se);const re={theme:s,accent:o,colorTheme:u,uiFont:p,monoFont:g,uiFontSize:se,monoFontSize:S,activeSkinId:N};B(re),F(re)},[s,o,u,N,B,F,p,g,S]),I=b.useCallback(X=>{const se=Math.min(20,Math.max(12,X));w(se);const re={theme:s,accent:o,colorTheme:u,uiFont:p,monoFont:g,uiFontSize:x,monoFontSize:se,activeSkinId:N};B(re),F(re)},[s,o,u,N,B,F,p,g,x]),Q=b.useCallback(X=>{const se=X&&T.some(de=>de.id===X)?X:null;C(se);const re={theme:s,accent:o,colorTheme:u,uiFont:p,monoFont:g,uiFontSize:x,monoFontSize:S,activeSkinId:se};B(re),F(re)},[s,o,u,p,g,x,S,T,B,F]),K=b.useCallback(async()=>{if(n){D(!0);try{const X=await uQ();if(A(X),N&&!X.some(se=>se.id===N)){C(null);const se={theme:s,accent:o,colorTheme:u,uiFont:p,monoFont:g,uiFontSize:x,monoFontSize:S,activeSkinId:null};B(se),F(se)}}finally{D(!1)}}},[n,N,s,o,u,p,g,x,S,B,F]),Z=b.useCallback(async X=>{const se=await dQ(X);return A(re=>[...re.filter(ue=>ue.id!==se.id),se].sort((ue,ae)=>ue.name.localeCompare(ae.name)||ue.id.localeCompare(ae.id))),se},[]),Y=b.useCallback(async X=>{if(await hQ(X),A(se=>se.filter(re=>re.id!==X)),N===X){C(null);const se={theme:s,accent:o,colorTheme:u,uiFont:p,monoFont:g,uiFontSize:x,monoFontSize:S,activeSkinId:null};B(se),F(se)}},[N,s,o,u,p,g,x,S,B,F]);b.useEffect(()=>{E3(p),A3(g)},[]),b.useEffect(()=>{B({theme:s,accent:o,colorTheme:u,uiFont:p,monoFont:g,uiFontSize:x,monoFontSize:S,activeSkinId:N})},[s,o,u,p,g,x,S,N,B]),b.useEffect(()=>{r||!n||K().catch(()=>{})},[r,n,K]),b.useEffect(()=>{if(s!=="system")return;const X=window.matchMedia("(prefers-color-scheme: light)"),se=()=>B({theme:s,accent:o,colorTheme:u,uiFont:p,monoFont:g,uiFontSize:x,monoFontSize:S,activeSkinId:N});return X.addEventListener("change",se),()=>X.removeEventListener("change",se)},[s,o,u,B,p,g,x,S,N]);const R=$3(s,u),U=T.find(X=>X.id===N)??null,V=(U==null?void 0:U.name)??null,ie=b.useCallback(X=>{var de;const se=kB(U,R),re=(de=se==null?void 0:se.assets)==null?void 0:de[X];return U&&re?zm(U.id,re):null},[U,R]),te={theme:s,accent:o,colorTheme:u,uiFont:p,monoFont:g,uiFontSize:x,monoFontSize:S,resolvedTheme:R,activeSkinId:N,activeSkinName:V,installedSkins:T,skinsLoading:E,setTheme:H,setAccent:$,setColorTheme:z,setUiFont:W,setMonoFont:P,setUiFontSize:q,setMonoFontSize:I,refreshSkins:K,setSkin:Q,importSkinZip:Z,deleteSkin:Y,getSkinAsset:ie};return c.jsx(rB.Provider,{value:te,children:e})}/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const zZ=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),wB=(...e)=>e.filter((n,r,i)=>!!n&&n.trim()!==""&&i.indexOf(n)===r).join(" ").trim();/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */var $Z={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 v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const FZ=b.forwardRef(({color:e="currentColor",size:n=24,strokeWidth:r=2,absoluteStrokeWidth:i,className:s="",children:a,iconNode:o,...l},u)=>b.createElement("svg",{ref:u,...$Z,width:n,height:n,stroke:e,strokeWidth:i?Number(r)*24/Number(n):r,className:wB("lucide",s),...l},[...o.map(([d,p])=>b.createElement(d,p)),...Array.isArray(a)?a:[a]]));/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Xe=(e,n)=>{const r=b.forwardRef(({className:i,...s},a)=>b.createElement(FZ,{ref:a,iconNode:n,className:wB(`lucide-${zZ(e)}`,i),...s}));return r.displayName=`${e}`,r};/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ev=Xe("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const HZ=Xe("Archive",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const WZ=Xe("ArrowDownRight",[["path",{d:"m7 7 10 10",key:"1fmybs"}],["path",{d:"M17 7v10H7",key:"6fjiku"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const qZ=Xe("ArrowDown",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const UZ=Xe("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const VZ=Xe("ArrowRightLeft",[["path",{d:"m16 3 4 4-4 4",key:"1x1c3m"}],["path",{d:"M20 7H4",key:"zbl0bi"}],["path",{d:"m8 21-4-4 4-4",key:"h9nckh"}],["path",{d:"M4 17h16",key:"g4d7ey"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const sf=Xe("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ex=Xe("Ban",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const KZ=Xe("Bell",[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const sC=Xe("BookOpen",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const zl=Xe("Bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const YZ=Xe("Boxes",[["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"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const GZ=Xe("Braces",[["path",{d:"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1",key:"ezmyqa"}],["path",{d:"M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1",key:"e1hn23"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const $m=Xe("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const XZ=Xe("Calculator",[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",key:"1nb95v"}],["line",{x1:"8",x2:"16",y1:"6",y2:"6",key:"x4nwl0"}],["line",{x1:"16",x2:"16",y1:"14",y2:"18",key:"wjye3r"}],["path",{d:"M16 10h.01",key:"1m94wz"}],["path",{d:"M12 10h.01",key:"1nrarc"}],["path",{d:"M8 10h.01",key:"19clt8"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M8 18h.01",key:"lrp35t"}]]);/**
 * @license lucide-react v0.468.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=Xe("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const qo=Xe("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const F3=Xe("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ru=Xe("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const QZ=Xe("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ZZ=Xe("ChevronsLeft",[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const JZ=Xe("ChevronsRight",[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const tv=Xe("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const _f=Xe("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Px=Xe("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const H3=Xe("CirclePause",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"10",x2:"10",y1:"15",y2:"9",key:"c1nkhi"}],["line",{x1:"14",x2:"14",y1:"15",y2:"9",key:"h65svq"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const eJ=Xe("CirclePlay",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polygon",{points:"10 8 16 12 10 16 10 8",key:"1cimsy"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Xc=Xe("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const tJ=Xe("Clipboard",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Lx=Xe("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const nJ=Xe("CloudUpload",[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"m8 17 4-4 4 4",key:"1quai1"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const rJ=Xe("Cloud",[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const SB=Xe("CodeXml",[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const iJ=Xe("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const sJ=Xe("Columns2",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Xl=Xe("Copy",[["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"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const cE=Xe("Crosshair",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"22",x2:"18",y1:"12",y2:"12",key:"l9bcsi"}],["line",{x1:"6",x2:"2",y1:"12",y2:"12",key:"13hhkx"}],["line",{x1:"12",x2:"12",y1:"6",y2:"2",key:"10w3f3"}],["line",{x1:"12",x2:"12",y1:"22",y2:"18",key:"15g9kq"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const aJ=Xe("Crown",[["path",{d:"M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294z",key:"1vdc57"}],["path",{d:"M5 21h14",key:"11awu3"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const t0=Xe("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const uE=Xe("DollarSign",[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const CB=Xe("ExternalLink",[["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"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const dE=Xe("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const nv=Xe("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const oJ=Xe("FileCode2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m5 12-3 3 3 3",key:"oke12k"}],["path",{d:"m9 18 3-3-3-3",key:"112psh"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const lJ=Xe("FileCode",[["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const cJ=Xe("FilePlus2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M3 15h6",key:"4e2qda"}],["path",{d:"M6 12v6",key:"1u72j0"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const rv=Xe("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const uJ=Xe("FileUp",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M12 12v6",key:"3ahymv"}],["path",{d:"m15 15-3-3-3 3",key:"15xj92"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const dJ=Xe("Film",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7 3v18",key:"bbkbws"}],["path",{d:"M3 7.5h4",key:"zfgn84"}],["path",{d:"M3 12h18",key:"1i2n21"}],["path",{d:"M3 16.5h4",key:"1230mu"}],["path",{d:"M17 3v18",key:"in4fa5"}],["path",{d:"M17 7.5h4",key:"myr1c1"}],["path",{d:"M17 16.5h4",key:"go4c1d"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const jB=Xe("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const NB=Xe("FolderOpen",[["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"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const xd=Xe("GitBranch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const hE=Xe("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const fE=Xe("Hash",[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const pE=Xe("History",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const mE=Xe("ImagePlus",[["path",{d:"M16 5h6",key:"1vod17"}],["path",{d:"M19 2v6",key:"4bpg5p"}],["path",{d:"M21 11.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7.5",key:"1ue2ih"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const gE=Xe("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const hJ=Xe("Inbox",[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const fJ=Xe("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const W3=Xe("KeyRound",[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const pJ=Xe("Keyboard",[["path",{d:"M10 8h.01",key:"1r9ogq"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M7 16h10",key:"wp8him"}],["path",{d:"M8 12h.01",key:"czm47f"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const mJ=Xe("Languages",[["path",{d:"m5 8 6 6",key:"1wu5hv"}],["path",{d:"m4 14 6-6 2-3",key:"1k1g8d"}],["path",{d:"M2 5h12",key:"or177f"}],["path",{d:"M7 2h1",key:"1t2jsx"}],["path",{d:"m22 22-5-10-5 10",key:"don7ne"}],["path",{d:"M14 18h6",key:"1m8k6r"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const vE=Xe("Layers",[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const gJ=Xe("LayoutDashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const EB=Xe("LayoutGrid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const vJ=Xe("Link2Off",[["path",{d:"M9 17H7A5 5 0 0 1 7 7",key:"10o201"}],["path",{d:"M15 7h2a5 5 0 0 1 4 8",key:"1d3206"}],["line",{x1:"8",x2:"12",y1:"12",y2:"12",key:"rvw6j4"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const AB=Xe("Link2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const yJ=Xe("ListPlus",[["path",{d:"M11 12H3",key:"51ecnj"}],["path",{d:"M16 6H3",key:"1wxfjs"}],["path",{d:"M16 18H3",key:"12xzn7"}],["path",{d:"M18 9v6",key:"1twb98"}],["path",{d:"M21 12h-6",key:"bt1uis"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Rr=Xe("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const hg=Xe("Lock",[["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"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const _J=Xe("Mail",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const TB=Xe("MapPinned",[["path",{d:"M18 8c0 3.613-3.869 7.429-5.393 8.795a1 1 0 0 1-1.214 0C9.87 15.429 6 11.613 6 8a6 6 0 0 1 12 0",key:"11u0oz"}],["circle",{cx:"12",cy:"8",r:"2",key:"1822b1"}],["path",{d:"M8.714 14h-3.71a1 1 0 0 0-.948.683l-2.004 6A1 1 0 0 0 3 22h18a1 1 0 0 0 .948-1.316l-2-6a1 1 0 0 0-.949-.684h-3.712",key:"q8zwxj"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const xJ=Xe("Menu",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const aC=Xe("MessageSquareText",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}],["path",{d:"M13 8H7",key:"14i4kc"}],["path",{d:"M17 12H7",key:"16if0g"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const fg=Xe("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const q3=Xe("MonitorCog",[["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"m15.2 4.9-.9-.4",key:"12wd2u"}],["path",{d:"m15.2 7.1-.9.4",key:"1r2vl7"}],["path",{d:"m16.9 3.2-.4-.9",key:"3zbo91"}],["path",{d:"m16.9 8.8-.4.9",key:"1qr2dn"}],["path",{d:"m19.5 2.3-.4.9",key:"1rjrkq"}],["path",{d:"m19.5 9.7-.4-.9",key:"heryx5"}],["path",{d:"m21.7 4.5-.9.4",key:"17fqt1"}],["path",{d:"m21.7 7.5-.9-.4",key:"14zyni"}],["path",{d:"M22 13v2a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7",key:"1tnzv8"}],["path",{d:"M8 21h8",key:"1ev6f3"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const MB=Xe("Monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const U3=Xe("MoonStar",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9",key:"4ay0iu"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const xf=Xe("Network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ul=Xe("Package",[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["path",{d:"m3.3 7 7.703 4.734a2 2 0 0 0 1.994 0L20.7 7",key:"yx3hmr"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const oC=Xe("Palette",[["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["path",{d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z",key:"12rzf8"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const bJ=Xe("Paperclip",[["path",{d:"M13.234 20.252 21 12.3",key:"1cbrk9"}],["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 0 2.828 2 2 0 0 0 2.828 0l8.414-8.586a4 4 0 0 0 0-5.656 4 4 0 0 0-5.656 0l-8.415 8.585a6 6 0 1 0 8.486 8.486",key:"1pkts6"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const RB=Xe("Pause",[["rect",{x:"14",y:"4",width:"4",height:"16",rx:"1",key:"zuxfzm"}],["rect",{x:"6",y:"4",width:"4",height:"16",rx:"1",key:"1okwgv"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const OB=Xe("PenLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const iv=Xe("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const n0=Xe("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const rs=Xe("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const r0=Xe("Power",[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const DB=Xe("Puzzle",[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const kJ=Xe("QrCode",[["rect",{width:"5",height:"5",x:"3",y:"3",rx:"1",key:"1tu5fj"}],["rect",{width:"5",height:"5",x:"16",y:"3",rx:"1",key:"1v8r4q"}],["rect",{width:"5",height:"5",x:"3",y:"16",rx:"1",key:"1x03jg"}],["path",{d:"M21 16h-3a2 2 0 0 0-2 2v3",key:"177gqh"}],["path",{d:"M21 21v.01",key:"ents32"}],["path",{d:"M12 7v3a2 2 0 0 1-2 2H7",key:"8crl2c"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M12 3h.01",key:"n36tog"}],["path",{d:"M12 16v.01",key:"133mhm"}],["path",{d:"M16 12h1",key:"1slzba"}],["path",{d:"M21 12v.01",key:"1lwtk9"}],["path",{d:"M12 21v-1",key:"1880an"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const wJ=Xe("RadioTower",[["path",{d:"M4.9 16.1C1 12.2 1 5.8 4.9 1.9",key:"s0qx1y"}],["path",{d:"M7.8 4.7a6.14 6.14 0 0 0-.8 7.5",key:"1idnkw"}],["circle",{cx:"12",cy:"9",r:"2",key:"1092wv"}],["path",{d:"M16.2 4.8c2 2 2.26 5.11.8 7.47",key:"ojru2q"}],["path",{d:"M19.1 1.9a9.96 9.96 0 0 1 0 14.1",key:"rhi7fg"}],["path",{d:"M9.5 18h5",key:"mfy3pd"}],["path",{d:"m8 22 4-11 4 11",key:"25yftu"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ix=Xe("Radio",[["path",{d:"M4.9 19.1C1 15.2 1 8.8 4.9 4.9",key:"1vaf9d"}],["path",{d:"M7.8 16.2c-2.3-2.3-2.3-6.1 0-8.5",key:"u1ii0m"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"M16.2 7.8c2.3 2.3 2.3 6.1 0 8.5",key:"1j5fej"}],["path",{d:"M19.1 4.9C23 8.8 23 15.1 19.1 19",key:"10b0cb"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const PB=Xe("RefreshCcw",[["path",{d:"M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"14sxne"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16",key:"1hlbsb"}],["path",{d:"M16 16h5v5",key:"ccwih5"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const $r=Xe("RefreshCw",[["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"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const SJ=Xe("Repeat",[["path",{d:"m17 2 4 4-4 4",key:"nntrym"}],["path",{d:"M3 11v-1a4 4 0 0 1 4-4h14",key:"84bu3i"}],["path",{d:"m7 22-4-4 4-4",key:"1wqhfi"}],["path",{d:"M21 13v1a4 4 0 0 1-4 4H3",key:"1rx37r"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const CJ=Xe("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const jJ=Xe("RotateCw",[["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"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const NJ=Xe("Rows2",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 12h18",key:"1i2n21"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const yE=Xe("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Aa=Xe("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
 * @license lucide-react v0.468.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=Xe("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const i0=Xe("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const s0=Xe("ShieldAlert",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const sv=Xe("ShieldCheck",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const LB=Xe("Shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const IB=Xe("ShoppingBag",[["path",{d:"M6 2 3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4Z",key:"hou9p0"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M16 10a4 4 0 0 1-8 0",key:"1ltviw"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const EJ=Xe("SlidersHorizontal",[["line",{x1:"21",x2:"14",y1:"4",y2:"4",key:"obuewd"}],["line",{x1:"10",x2:"3",y1:"4",y2:"4",key:"1q6298"}],["line",{x1:"21",x2:"12",y1:"12",y2:"12",key:"1iu8h1"}],["line",{x1:"8",x2:"3",y1:"12",y2:"12",key:"ntss68"}],["line",{x1:"21",x2:"16",y1:"20",y2:"20",key:"14d8ph"}],["line",{x1:"12",x2:"3",y1:"20",y2:"20",key:"m0wm8r"}],["line",{x1:"14",x2:"14",y1:"2",y2:"6",key:"14e1ph"}],["line",{x1:"8",x2:"8",y1:"10",y2:"14",key:"1i6ji0"}],["line",{x1:"16",x2:"16",y1:"18",y2:"22",key:"1lctlv"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const lC=Xe("Smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const iu=Xe("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const AJ=Xe("Split",[["path",{d:"M16 3h5v5",key:"1806ms"}],["path",{d:"M8 3H3v5",key:"15dfkv"}],["path",{d:"M12 22v-8.3a4 4 0 0 0-1.172-2.872L3 3",key:"1qrqzj"}],["path",{d:"m15 9 6-6",key:"ko1vev"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const TJ=Xe("SquareSplitHorizontal",[["path",{d:"M8 19H5c-1 0-2-1-2-2V7c0-1 1-2 2-2h3",key:"lubmu8"}],["path",{d:"M16 5h3c1 0 2 1 2 2v10c0 1-1 2-2 2h-3",key:"1ag34g"}],["line",{x1:"12",x2:"12",y1:"4",y2:"20",key:"1tx1rr"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const MJ=Xe("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const BB=Xe("Stethoscope",[["path",{d:"M11 2v2",key:"1539x4"}],["path",{d:"M5 2v2",key:"1yf1q8"}],["path",{d:"M5 3H4a2 2 0 0 0-2 2v4a6 6 0 0 0 12 0V5a2 2 0 0 0-2-2h-1",key:"rb5t3r"}],["path",{d:"M8 15a6 6 0 0 0 12 0v-3",key:"x18d4x"}],["circle",{cx:"20",cy:"10",r:"2",key:"ts1r5v"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const V3=Xe("SunMedium",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 3v1",key:"1asbbs"}],["path",{d:"M12 20v1",key:"1wcdkc"}],["path",{d:"M3 12h1",key:"lp3yf2"}],["path",{d:"M20 12h1",key:"1vloll"}],["path",{d:"m18.364 5.636-.707.707",key:"1hakh0"}],["path",{d:"m6.343 17.657-.707.707",key:"18m9nf"}],["path",{d:"m5.636 5.636.707.707",key:"1xv1c5"}],["path",{d:"m17.657 17.657.707.707",key:"vl76zb"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Bx=Xe("Tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const zB=Xe("Target",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const av=Xe("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Wi=Xe("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const RJ=Xe("TrendingUp",[["polyline",{points:"22 7 13.5 15.5 8.5 10.5 2 17",key:"126l90"}],["polyline",{points:"16 7 22 7 22 13",key:"kwv8wd"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Cs=Xe("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const a0=Xe("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const $B=Xe("WandSparkles",[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const o0=Xe("Workflow",[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const l0=Xe("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const mi=Xe("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const c0=Xe("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]),zx={zh:{"nav.dashboard":"仪表盘","nav.agent":"智能体","nav.tools":"工具","nav.cron":"定时任务","nav.integrations":"集成","nav.memory":"记忆","nav.config":"配置","nav.cost":"成本追踪","nav.logs":"日志","nav.doctor":"诊断","nav.agents":"智能体池","nav.skills":"技能库","nav.teams":"AI 代理团队","nav.assets":"资产浏览器","nav.skins":"皮肤","nav.memoryAuditor":"记忆审计","nav.audit":"审计追踪","nav.canvas":"画布","nav.workflows":"工作流","dashboard.title":"仪表盘","dashboard.provider":"提供商","dashboard.model":"模型","dashboard.uptime":"运行时间","dashboard.temperature":"温度","dashboard.gateway_port":"网关端口","dashboard.memory_backend":"记忆后端","dashboard.paired":"已配对","dashboard.channels":"频道","dashboard.health":"健康状态","dashboard.status":"状态","dashboard.overview":"概览","dashboard.system_info":"系统信息","dashboard.quick_actions":"快速操作","agent.title":"智能体对话","agent.send":"发送","agent.placeholder":"输入消息...","agent.start_conversation":"发送消息开始对话","agent.type_message":"输入消息...","agent.connecting":"连接中...","agent.connected":"已连接","agent.disconnected":"已断开","agent.reconnecting":"重新连接中...","agent.thinking":"思考中...","agent.tool_call":"工具调用","agent.tool_result":"工具结果","agent.connection_error":"连接错误，正在尝试重连...","agent.tool_call_prefix":"[工具调用]","agent.tool_result_prefix":"[工具结果]","agent.error_prefix":"[错误]","agent.unknown_error":"未知错误","agent.send_error":"发送消息失败，请重试。","agent.copy_message":"复制消息","agent.connected_status":"已连接","agent.disconnected_status":"已断开","agent.copy_code":"复制代码","agent.copied_code":"代码已复制","agent.copy":"复制","agent.copied":"已复制","agent.code_language_fallback":"代码","agent.jump_to_latest":"跳到最新","agent.placeholder_steer_next_step":"引导下一步…","agent.placeholder_queue_next":"排队下一条消息…","agent.placeholder_message":"消息…","agent.placeholder_connecting":"连接中…","agent.send_mode":"发送模式","agent.send_mode_queue":"排队","agent.send_mode_steer":"引导","agent.queue_after_current_response":"当前响应后排队","agent.steer_text_only":"引导仅支持文本；附件会改为排队","agent.steer_next_step":"引导下一步","agent.queue_message":"排队消息","agent.send_message":"发送消息","agent.send_enter":"发送 (Enter)","agent.steer_prefix":"[引导]","agent.tool_output_truncated":"聊天视图中的输出已截断；请复制或检查运行日志以查看完整结果。","agent.activity_input_label":"输入","agent.activity_diff_label":"差异","agent.activity_output_label":"输出","agent.reasoning_trace_label":"思考过程","tools.name":"名称","tools.parameters":"参数","tools.search":"搜索工具...","tools.empty":"暂无可用工具。","tools.count":"工具总数","tools.agent_tools":"智能体工具箱","tools.cli_tools":"CLI 工具箱","tools.path":"路径","tools.version":"版本","tools.category":"类别","tools.load_error":"加载工具失败","cron.title":"定时任务","cron.scheduled_tasks":"定时任务","cron.add":"添加任务","cron.add_job":"添加任务","cron.add_modal_title":"添加 Cron 任务","cron.delete":"删除","cron.enable":"启用","cron.disable":"禁用","cron.name":"名称","cron.name_optional":"名称（可选）","cron.command":"命令","cron.command_required":"命令","cron.schedule":"计划","cron.schedule_required":"计划","cron.next_run":"下次执行","cron.last_run":"上次执行","cron.last_status":"上次状态","cron.enabled":"已启用","cron.enabled_status":"启用","cron.disabled_status":"禁用","cron.empty":"暂无定时任务。","cron.confirm_delete":"确定要删除此任务吗？","cron.load_error":"加载定时任务失败","cron.validation_error":"计划和命令是必需的。","cron.add_error":"添加任务失败","cron.delete_error":"删除任务失败","cron.cancel":"取消","cron.adding":"添加中...","cron.id":"ID","cron.actions":"操作","cron.loading_run_history":"加载运行历史...","cron.load_run_history_error":"加载运行历史失败","cron.no_runs":"暂无运行记录。","cron.recent_runs":"最近运行","cron.yes":"是","cron.no":"否","cron.edit":"编辑","cron.edit_modal_title":"编辑 Cron 任务","cron.edit_error":"更新任务失败","cron.saving":"保存中...","cron.save":"保存","integrations.available":"可用","integrations.active":"活跃","integrations.coming_soon":"即将推出","integrations.category":"类别","integrations.status":"状态","integrations.search":"搜索集成...","integrations.empty":"未找到集成。","integrations.activate":"激活","integrations.deactivate":"停用","integrations.load_error":"加载集成失败","integrations.status_active":"活跃","integrations.status_available":"可用","integrations.status_coming_soon":"即将推出","memory.title":"记忆存储","memory.memory_title":"记忆","memory.search":"搜索记忆...","memory.search_placeholder":"搜索记忆条目...","memory.add":"存储记忆","memory.add_memory":"添加记忆","memory.add_modal_title":"添加记忆","memory.delete":"删除","memory.key":"键","memory.key_required":"键","memory.content":"内容","memory.content_required":"内容","memory.category":"类别","memory.category_optional":"类别（可选）","memory.timestamp":"时间戳","memory.session":"会话","memory.score":"分数","memory.empty":"未找到记忆条目。","memory.confirm_delete":"确定要删除此记忆条目吗？","memory.all_categories":"所有类别","memory.search_button":"搜索","memory.load_error":"加载记忆失败","memory.saving":"保存中...","memory.validation_error":"键和内容是必需的。","memory.store_error":"保存记忆失败","memory.delete_error":"删除记忆失败","memory.delete_confirm":"删除？","memory.yes":"是","memory.no":"否","memory.cancel":"取消","config.title":"配置","config.save":"保存","config.saving":"保存中...","config.reset":"重置","config.saved":"配置保存成功。","config.error":"配置保存失败。","config.loading":"加载配置中...","config.editor_placeholder":"TOML 配置...","config.configuration_title":"配置","config.sensitive_title":"敏感字段已隐藏","config.sensitive_hint":"API 密钥、令牌和密码已隐藏以保护安全。要更新已隐藏的字段，请将整个隐藏值替换为您的新值。","config.save_success":"配置保存成功。","config.save_error":"保存配置失败","config.toml_label":"TOML 配置","config.lines":"行","cost.session":"会话成本","cost.daily":"每日成本","cost.monthly":"每月成本","cost.request_count":"请求数","cost.by_model":"按模型统计","cost.model":"模型","cost.usd":"成本（美元）","cost.load_error":"加载成本数据失败","cost.total_requests":"总请求数","cost.token_statistics":"Token 统计","cost.avg_tokens_per_request":"平均 Token / 请求","cost.cost_per_1k_tokens":"每 1K Token 成本","cost.model_breakdown":"模型细分","cost.cost":"成本","cost.share":"占比","logs.live_logs":"实时日志","logs.clear":"清除","logs.filter":"筛选日志...","logs.filter_label":"筛选","logs.empty":"暂无日志条目。","logs.events":"事件","logs.paused_hint":"日志流已暂停。","logs.waiting_hint":"等待事件...","doctor.diagnostics_title":"系统诊断","doctor.run_diagnostics":"运行诊断","doctor.running_btn":"运行中...","doctor.running_desc":"正在运行诊断...","doctor.running_hint":"这可能需要几秒钟。","doctor.error":"错误","doctor.severity":"严重程度","doctor.category":"类别","doctor.message":"消息","doctor.empty":"尚未运行诊断。","doctor.summary":"诊断摘要","doctor.issues_found":"发现问题","doctor.warnings_summary":"警告","doctor.all_clear":"一切正常","doctor.system_diagnostics":"系统诊断","doctor.empty_hint":'点击"运行诊断"检查您的 Revka 安装。',"auth.pair":"配对设备","auth.pairing_code":"配对码","auth.pair_button":"配对","auth.logout":"退出","auth.pairing_success":"配对成功！","auth.pairing_failed":"配对失败，请重试。","auth.enter_code":"请输入配对码以连接到智能体。","common.loading":"加载中...","common.error":"发生错误。","common.retry":"重试","common.cancel":"取消","common.confirm":"确认","common.save":"保存","common.delete":"删除","common.edit":"编辑","common.execute":"执行","common.close":"关闭","common.yes":"是","common.no":"否","common.search":"搜索...","common.no_data":"暂无数据。","common.refresh":"刷新","common.back":"返回","common.actions":"操作","common.name":"名称","common.description":"描述","common.status":"状态","common.created":"创建时间","common.updated":"更新时间","health.title":"系统健康","health.component":"组件","health.status":"状态","health.last_ok":"上次正常","health.last_error":"上次错误","health.restart_count":"重启次数","health.pid":"进程 ID","health.uptime":"运行时间","health.updated_at":"最后更新","dashboard.provider_model":"提供商 / 模型","dashboard.since_last_restart":"自上次重启","dashboard.paired_yes":"是","dashboard.paired_no":"否","dashboard.cost_overview":"成本概览","dashboard.active_channels":"活跃频道","dashboard.filter_active":"活跃","dashboard.filter_all":"全部","dashboard.no_active_channels":"没有活跃频道","dashboard.component_health":"组件健康","dashboard.load_error":"加载仪表盘失败","dashboard.session_label":"会话","dashboard.daily_label":"每日","dashboard.monthly_label":"每月","dashboard.total_tokens_label":"总 Tokens","dashboard.requests_label":"请求","dashboard.by_model":"按模型","dashboard.no_channels":"未配置频道","dashboard.active":"活跃","dashboard.inactive":"非活跃","dashboard.no_components":"没有组件报告","dashboard.restarts":"重启次数","dashboard.tab_overview":"概览","dashboard.tab_sessions":"会话","dashboard.tab_channels":"频道","dashboard.tab_audit":"审计日志","dashboard.tab_workflows":"工作流","dashboard.audit_disabled":"审计日志未启用。请在配置中启用以查看事件。","dashboard.audit_all_types":"所有事件类型","dashboard.audit_refresh":"刷新","dashboard.audit_verify_chain":"验证链","dashboard.audit_chain_valid":"链完整性已验证","dashboard.audit_chain_invalid":"链完整性验证失败","dashboard.audit_no_events":"未找到审计事件","dashboard.sessions_title":"活跃会话","dashboard.no_sessions":"没有活跃会话","dashboard.session_id":"会话 ID","dashboard.session_channel":"频道","dashboard.session_started":"开始时间","dashboard.session_last_activity":"最近活动","dashboard.session_status":"状态","dashboard.session_messages":"消息数","dashboard.session_details":"会话详情","dashboard.session_history":"查看历史","dashboard.channels_title":"频道状态","dashboard.no_channels_detail":"没有频道详情","dashboard.channel_type":"类型","dashboard.channel_messages":"消息数","dashboard.channel_last_message":"最近消息","dashboard.channel_config":"配置摘要","dashboard.channel_enabled":"已启用","dashboard.channel_disabled":"已禁用","dashboard.loading_sessions":"加载会话中...","dashboard.loading_channels":"加载频道中...","dashboard.load_sessions_error":"加载会话失败","dashboard.load_channels_error":"加载频道失败","dashboard.never":"从未","dashboard.tab_clawhub":"ClawHub","dashboard.tab_nodes":"节点","dashboard.clawhub_title":"ClawHub 市场","dashboard.clawhub_search":"搜索模板、技能、团队…","dashboard.clawhub_no_items":"未找到项目。发布您的第一个模板或技能！","dashboard.clawhub_publish":"发布","dashboard.clawhub_install":"安装","dashboard.clawhub_downloads":"下载次数","dashboard.clawhub_by":"作者","dashboard.nodes_title":"已连接节点","dashboard.nodes_no_nodes":"未连接节点。节点通过 WebSocket 连接到 /ws/nodes。","dashboard.nodes_capabilities":"能力","dashboard.nodes_invoke":"调用","settings.title":"设置","settings.tab.appearance":"外观","settings.tab.typography":"排版","settings.appearance":"外观设置","settings.typography":"字体设置","settings.fontUi":"界面字体","settings.fontMono":"代码字体","settings.fontSize":"界面字号","settings.fontMonoSize":"代码字号","settings.preview":"预览","settings.previewText":"界面字体预览文本","settings.fontNote":"字体设置需要刷新页面后生效","settings.language":"界面语言","chat_panel.ai_assistant":"AI 助手","chat_panel.agent_placeholder":'让我帮你创建一个智能体，例如"创建一个 Rust 安全专家"',"chat_panel.team_placeholder":'让我帮你组建一个团队，例如"组建一个前端迁移团队"',"chat_panel.skill_placeholder":'让我帮你创建一个技能，例如"创建一个代码审查技能"',"chat_panel.close":"关闭","clawhub.tab_local":"本地技能","clawhub.tab_clawhub":"ClawHub","clawhub.search_placeholder":"搜索 ClawHub 技能...","clawhub.trending":"热门","clawhub.install":"安装","clawhub.installing":"安装中...","clawhub.installed":"已安装","clawhub.downloads":"下载","clawhub.stars":"收藏","clawhub.verified":"已验证","clawhub.no_results":"未找到技能","clawhub.search_hint":"搜索 ClawHub 上的 13,000+ 社区技能","clawhub.error":"无法连接 ClawHub","clawhub.details":"详情","clawhub.less":"收起","clawhub.author":"作者","clawhub.tags":"标签","theme.mode":"主题模式","theme.accent":"强调色","theme.system":"跟随系统","theme.dark":"深色","theme.light":"浅色","theme.oled":"纯黑","nav.pairing":"设备配对","nav.section.orchestration":"编排","nav.section.operations":"运营","nav.section.inspection":"检查","nav.dashboard.blurb":"实时运行态势与活动中的 DAG 状态","nav.workflows.blurb":"定义 DAG 并直接查看执行记录","nav.agents.blurb":"可复用的参与者与工作流角色","nav.canvas.blurb":"可视化工作区与编排画布","nav.teams.blurb":"查看委派拓扑与归属关系","nav.assets.blurb":"工件与工作流相关资源","nav.skins.blurb":"基于令牌和资产的界面皮肤","nav.skills.blurb":"可复用的运营能力","nav.tools.blurb":"智能体工具目录与 CLI 二进制文件","nav.integrations.blurb":"已连接的系统与渠道","nav.cron.blurb":"定时任务与补跑行为","nav.pairing.blurb":"设备注册与信任管理","nav.config.blurb":"运行时 TOML 与运维配置","nav.cost.blurb":"按工作流与执行统计的支出与效率","nav.memory.blurb":"Kumiho 记忆图谱浏览器与版本历史","nav.logs.blurb":"运维追踪与节点关联事件","nav.audit.blurb":"信任链与批准验证","nav.doctor.blurb":"诊断与运行时恢复态势","sidebar.brand_subtitle":"智能体操作系统","sidebar.shell":"Revka","sidebar.shell_description":"本地优先的智能体操作系统，在你的项目中编排 AI 工作流、工具与运行时。","header.tagline":"以编排为先的智能体操作系统。","header.runtime_healthy":"运行时健康","header.trust_verified":"信任已验证","header.trust_unverified":"信任未验证","header.trust_checking":"正在验证信任…","header.operator":"操作员","common.duplicate":"复制","common.reenable":"重新启用","common.deprecate":"弃用","common.create":"创建","dashboard.kicker":"编排中心","dashboard.live_orchestration_pane":"实时编排面板","dashboard.active_workflow_posture":"当前工作流状态","dashboard.open_workflow_definition":"打开工作流定义","dashboard.selected_run":"当前运行","dashboard.run_posture":"运行状态","dashboard.signal_focus":"信号焦点","dashboard.hotspots":"热点","dashboard.count.running":"运行中","dashboard.count.failed":"失败","dashboard.count.completed":"已完成","dashboard.count.pending":"待处理","dashboard.count.skipped":"已跳过","dashboard.prev_signal":"上一信号","dashboard.next_signal":"下一信号","dashboard.intervention_points":"{count} 个干预点","dashboard.label.failure":"失败: {id}","dashboard.label.running":"运行中: {id}","dashboard.label.blocked":"受阻: {id}","dashboard.selected_step":"当前步骤","dashboard.inspect_node_in_runs":"在运行工作区中查看该节点","dashboard.open_definition_node":"打开定义节点","dashboard.select_dag_node":"在 DAG 中选择一个节点以查看活动分支。","dashboard.priority_timeline":"优先级时间线","dashboard.no_run_selected":"未选择运行。","dashboard.open_full_run_workspace":"打开完整运行工作区","dashboard.open_all_runs":"打开所有工作流运行","dashboard.status.blocked":"受阻","dashboard.scene.operator":"操作员简报","dashboard.scene.error":"仪表盘遥测出现异常。请先查看运行轨和日志，再继续下一步。","dashboard.scene.selected_run":"{workflow} 当前为 {status}。已完成 {completed}/{total} 个步骤。","dashboard.scene.run_failed":"{workflow} 需要关注：{failed} 个步骤失败，已完成 {completed}/{total} 个步骤。","dashboard.scene.active_overview":"当前有 {active} 个运行中流程，已加载 {definitions} 个定义。","dashboard.scene.idle_overview":"当前没有选中的运行。已准备好 {definitions} 个定义，历史运行总数为 {total}。","workflows.kicker":"编排中心","workflows.title":"工作流","workflows.create":"创建工作流","workflows.workflow_info":"v{version} · {steps} 个节点 · {runs} 次运行","workflows.workflow_info_short":"v{version} · {steps} 个节点","workflows.status.off":"关闭","workflows.status.ready":"就绪","workflows.tab.definition":"定义","workflows.tab.runs":"运行","workflows.loading":"正在加载工作流…","workflows.empty_title":"暂无工作流","workflows.empty_desc":"创建你的第一个工作流以开始。","workflows.definition_unavailable_title":"工作流定义不可用","workflows.definition_unavailable_desc":"运行时返回了空定义——无法渲染图。这是后端数据问题，需要在上游修复。","workflows.no_runs_title":"暂无运行记录","workflows.no_runs_desc":"运行该工作流以查看执行状态。","workflows.open_node_in_runs":"在运行中打开节点","workflows.select_dag_node":"在 DAG 中选择一个节点。","workflows.run_step":"运行步骤","workflows.select_dag_node_step":"在 DAG 中选择一个节点以查看该步骤。","workflows.save_failure":"保存工作流失败","workflows.save_failure_dot":"保存工作流失败。","workflows.run_failure":"启动工作流失败","workflows.status_failure":"更改工作流状态失败","workflows.status_failure_dot":"更改工作流状态失败。","workflows.delete_failure":"删除工作流失败","workflows.delete_failure_dot":"删除工作流失败。","workflows.toast.updated":'工作流 "{name}" 已更新。',"workflows.toast.created":'工作流 "{name}" 已创建。',"workflows.toast.reenabled":'已重新启用工作流 "{name}"。',"workflows.toast.deprecated":'已弃用工作流 "{name}"。',"workflows.toast.deleted":'工作流 "{name}" 已删除。',"workflows.toast.run_started":'工作流 "{name}" 已启动（运行 {runId}）。',"workflows.run_option":"{prefix} — {status} ({completed}/{total})","workflows.copy_suffix":"副本","doctor.kicker":"检查","doctor.title":"诊断器","doctor.description":"运行运行时诊断并检查 Revka 栈中分组的健康发现。","doctor.run":"运行诊断","doctor.running":"正在运行…","doctor.failed_title":"诊断失败","doctor.loading_title":"正在运行系统诊断…","doctor.loading_desc":"检查运行时组件、配置和运行状态。","doctor.health_summary":"健康总览","doctor.passing":"通过","doctor.warnings":"警告","doctor.failures":"失败","doctor.run_context":"运行上下文","doctor.context_p1":"诊断器最强大的时候是像一个检查板，而不是终端转储。此面板首先突出显示整体状态，然后将发现分解为子系统组。","doctor.context_p2":"使用分类面板识别警告集中的位置，然后再深入了解单独的消息。","doctor.subsystem_boards":"子系统面板","doctor.checks":"{count} 项检查","doctor.ok":"ok","doctor.warn":"warn","doctor.fail":"fail","doctor.system_diag_title":"系统诊断","doctor.system_diag_desc":"运行诊断器以检查 Revka 外壳中的警告、故障和全部通过的检查。","doctor.run_failed":"运行诊断失败","cost.kicker":"运营","cost.title":"成本","cost.error_title":"无法加载成本数据","cost.loading_title":"正在加载成本数据…","cost.spend_posture":"支出状态","cost.session_cost":"会话成本","cost.daily_cost":"每日成本","cost.monthly_cost":"每月成本","cost.requests":"请求数","cost.token_efficiency":"令牌效率","cost.total_tokens":"总令牌数","cost.avg_tokens":"每次请求平均令牌","cost.cost_per_1k":"每千令牌成本","cost.model_workspace":"模型工作区","cost.spend_by_model":"按模型划分的支出","cost.no_model_data":"暂无模型数据","cost.no_model_data_desc":"记录请求后会显示模型级别的支出。","cost.tokens_label":"{count} 令牌","cost.requests_label":"{count} 请求","cost.share_label":"{share}% 月度支出","cost.selected_model":"选定模型","cost.no_model_selected":"未选择模型","cost.no_model_selected_desc":"从工作区选择一个模型以检查支出集中度和效率。","cost.monthly_spend":"月度支出","cost.tokens":"令牌","cost.share_monthly":"月度支出占比","cost.interpretation":"解读","cost.interp_p1":"较大的月度占比表示成本集中在单一模型家族上。","cost.interp_p2":"较高的每次请求令牌数与较低的请求次数通常表示长上下文或生成密集型工作流。","logs.kicker":"检查","logs.title":"日志","logs.description":"Revka 守护进程 stderr 日志的实时跟踪。运行时代理事件位于审计页面。","logs.pause":"暂停","logs.resume":"继续","logs.jump_to_bottom":"跳到底部","logs.stream_status":"流状态","logs.connected":"已连接","logs.disconnected":"已断开","logs.visible_lines":"{count} 行可见。正在跟踪 ~/.revka/logs/daemon.stderr.log。","logs.event_filters":"事件过滤器","logs.no_event_types":"暂无事件类型","logs.no_event_types_desc":"流接收到活动后将显示过滤器。","logs.clear_filters":"清除过滤器","logs.live_event_feed":"实时事件流","logs.no_events":"暂无事件","logs.no_events_desc":"SSE 流接收到运行时事件后，代理活动将在此处流式传输。","tools.kicker":"运营","tools.title":"工具","tools.description":"代理可用的工具目录以及运行时可调用的主机 CLI 二进制文件。","tools.reload":"重新加载","tools.search_placeholder":"按名称、描述或类别搜索工具…","tools.loading":"正在加载工具…","tools.agent_tools_count":"代理工具 · {count}","tools.no_matches":"无匹配项","tools.no_agent_tools":"未注册代理工具","tools.try_different":"尝试其他搜索词。","tools.agent_tools_empty_desc":"运行时注册后，代理工具将显示在此处。","tools.parameter_schema":"参数架构","tools.cli_tools_count":"CLI 工具 · {count}","tools.no_cli_tools":"未检测到 CLI 工具","tools.cli_tools_empty_desc":"Revka 会在启动时探测常见的 CLI 二进制文件。安装其中一个并重新加载。","tools.col.name":"名称","tools.col.path":"路径","tools.col.version":"版本","tools.col.category":"类别","tools.failed_load":"加载工具失败: {message}","audit.kicker":"检查","audit.title":"审计","audit.description":"对操作行为进行信任链验证、事件审查和安全状态检查。","audit.refresh":"刷新","audit.verify_chain":"验证链","audit.disabled_title":"审计跟踪已禁用","audit.disabled_desc":"启用审计记录以在此处检查审批、策略和安全事件。","audit.filters":"过滤器","audit.all_event_types":"所有事件类型","audit.event.command_execution":"命令执行","audit.event.file_access":"文件访问","audit.event.config_change":"配置变更","audit.event.auth_success":"认证成功","audit.event.auth_failure":"认证失败","audit.event.policy_violation":"策略违规","audit.event.security_event":"安全事件","audit.chain_verified":"链已验证","audit.chain_invalid":"链无效","audit.entries_verified":"已验证 {count} 条条目。","audit.stream_title":"审计事件流","audit.stream_subtitle":"记录的操作和审批","audit.loading":"正在加载审计事件…","audit.empty_title":"暂无审计事件","audit.empty_desc":"一旦发出操作或审批，记录的事件将显示在此处。","audit.col.sequence":"序列","audit.col.action":"操作","audit.col.result":"结果","audit.col.hash":"哈希","audit.result_success":"成功","audit.result_recorded":"已记录","audit.policy_violation_badge":"策略违规","audit.time.seconds_ago":"{n} 秒前","audit.time.minutes_ago":"{n} 分钟前","audit.time.hours_ago":"{n} 小时前","audit.time.days_ago":"{n} 天前","integrations.kicker":"运营","integrations.title":"集成","integrations.loading":"正在加载集成…","integrations.coverage":"覆盖范围","integrations.metric.active":"活跃","integrations.metric.available":"可用","integrations.metric.coming_soon":"即将推出","integrations.categories":"分类","integrations.category_all":"全部","integrations.workspace":"集成工作区","integrations.all_integrations":"所有集成","integrations.category_integrations":"{category} 集成","integrations.empty_title":"无集成","integrations.empty_desc":"没有集成匹配当前的分类过滤器。","integrations.badge.active":"活跃","integrations.badge.available":"可用","integrations.badge.coming_soon":"即将推出","integrations.selected":"选定的集成","integrations.no_selected_title":"未选择集成","integrations.no_selected_desc":"从工作区选择一个集成以检查其推出状态。","integrations.detail.category":"类别","integrations.detail.status":"状态","integrations.detail.operational_readiness":"运行就绪度","integrations.readiness.active":"已在运行时中激活。","integrations.readiness.available":"操作员准备好后即可启用。","integrations.readiness.coming_soon":"计划中的表面，尚未准备激活。","integrations.legend":"状态图例","integrations.legend.p1":"`Active` 集成已连接到运行时工作流。","integrations.legend.p2":"`Available` 集成可从当前构建安装或连接。","integrations.legend.p3":"`Coming Soon` 集成已规划但尚未可用。","pairing.kicker":"运营","pairing.title":"配对","pairing.description":"发放配对码、渲染用于移动注册的二维码，并管理受信任的设备。","pairing.reload":"重新加载","pairing.pair_new_device":"配对新设备","pairing.generating":"正在生成…","pairing.active_code":"当前配对码","pairing.rendering":"渲染中…","pairing.code_hint":"使用 Revka 配套应用扫描二维码，或在配对设备上输入 6 位代码。当设备完成注册或您生成新代码时，代码会过期。","pairing.copy_code":"复制代码","pairing.rotate":"轮换","pairing.cli_device_name":"CLI 设备名称","pairing.cli_hardware":"硬件","pairing.cli_hardware_placeholder":"可选平台标签","pairing.mint_cli_token":"铸造 CLI 令牌","pairing.minting_token":"正在铸造…","pairing.minted_token":"已铸造的 Bearer 令牌","pairing.copy_token":"复制令牌","pairing.no_code_title":"无活动配对码","pairing.no_code_desc":'按"配对新设备"生成新代码和二维码。代码是短期的，用于单次注册。',"pairing.how_to_scan":"如何扫描","pairing.scan_step1":"在新设备上打开 Revka 配套应用。","pairing.scan_step2_prefix":"选择 ","pairing.scan_step2_action":"与中心配对","pairing.scan_step2_suffix":"。","pairing.scan_step3":"扫描二维码或手动输入 6 位代码。","pairing.scan_step4":"注册完成后，设备将出现在下方列表中。","pairing.paired_devices":"已配对设备 · {count}","pairing.loading_devices":"正在加载设备…","pairing.no_devices_title":"尚未配对任何设备","pairing.no_devices_desc":"成功注册后，已配对的设备将显示在此处。","pairing.col.name":"名称","pairing.col.type":"类型","pairing.col.hardware":"硬件","pairing.col.paired":"配对时间","pairing.col.last_seen":"最后在线","pairing.col.ip":"IP","pairing.col.actions":"操作","pairing.unnamed":"未命名","pairing.unknown":"未知","pairing.device_type.api_client":"API 客户端","pairing.device_type.browser":"浏览器","pairing.device_type.cli":"CLI","pairing.device_type.mobile":"移动设备","pairing.device_type.tablet":"平板","pairing.revoke":"撤销？","pairing.yes":"是","pairing.no":"否","pairing.revoke_title":"撤销设备","pairing.toast.code_generated":"已生成新的配对码。","pairing.toast.code_copied":"代码已复制。","pairing.toast.token_minted":"Bearer 令牌已铸造。请立即复制。","pairing.toast.token_copied":"令牌已复制。","pairing.toast.copy_failed":"复制失败。请手动选择。","pairing.toast.device_revoked":"设备已撤销。","pairing.err.load_devices":"加载设备失败","pairing.err.gen_code":"生成配对码失败","pairing.err.mint_token":"铸造 Bearer 令牌失败","pairing.err.revoke":"撤销设备失败","cron.kicker":"运营","cron.description":"定时任务、追赶行为和最近的运行历史。","cron.reload":"重新加载","cron.startup_behaviour":"启动行为","cron.catch_up_title":"启动时追赶错过的任务","cron.catch_up_desc":"当 Revka 在停机后启动时，运行所有过期任务。","cron.loading_jobs":"正在加载定时任务…","cron.no_jobs_title":"没有预定的任务","cron.no_jobs_desc":"添加一个 cron 任务以按计划运行命令。","cron.col.id":"ID","cron.col.name":"名称","cron.col.command":"命令","cron.col.next_run":"下次运行","cron.col.last_status":"上次状态","cron.col.enabled":"已启用","cron.col.actions":"操作","cron.enabled_badge":"已启用","cron.disabled_badge":"已禁用","cron.toggle_history":"切换运行历史","cron.confirm":"确认？","cron.history.loading":"正在加载运行历史…","cron.history.error_title":"无法加载运行历史","cron.history.retry":"重试","cron.history.no_runs_title":"尚无运行","cron.history.no_runs_desc":"此任务自创建以来尚未执行。","cron.history.refresh":"刷新","cron.history.recent":"最近运行 · {count}","cron.history.refresh_title":"刷新运行","cron.modal.edit_title":"编辑 Cron 任务","cron.modal.add_title":"添加 Cron 任务","cron.modal.description":"名称为可选。计划使用标准 cron 表达式。","cron.form.name":"名称","cron.form.optional":"（可选）","cron.form.name_placeholder":"例如：每日清理","cron.form.schedule":"计划","cron.form.command":"命令","cron.form.command_placeholder":"例如：cleanup --older-than 7d","cron.form.cancel":"取消","cron.form.saving":"保存中…","cron.form.adding":"添加中…","cron.form.save":"保存","cron.err.load":"加载任务失败：{message}","cron.err.settings":"更新设置失败","cron.err.save":"保存任务失败","cron.err.delete":"删除任务失败","cron.err.form_required":"计划和命令是必需的。","cron.toast.updated":'已更新"{name}"。',"cron.toast.added":'已添加"{name}"。',"cron.toast.deleted":"任务已删除。","canvas.kicker":"编排中心","canvas.title":"画布","canvas.reconnect":"重新连接","canvas.control":"画布控制","canvas.connected":"已连接","canvas.disconnected":"已断开","canvas.canvas_id_placeholder":"画布 ID","canvas.switch":"切换","canvas.clear":"清除","canvas.available":"可用画布","canvas.loading_list":"正在加载画布…","canvas.loading_list_desc":"正在轮询实时画布注册表。","canvas.no_active_title":"无活动画布","canvas.no_active_desc":"代理或工作流推送帧后，画布 ID 将显示在此处。","canvas.active":"活跃","canvas.viewport":"画布视口","canvas.live_output":"实时帧输出","canvas.canvas_label":"画布","canvas.connection":"连接","canvas.live":"实时","canvas.offline":"离线","canvas.frame_type":"帧类型","canvas.last_update":"上次更新","canvas.waiting_label":"等待帧","canvas.frame_suffix":"帧","canvas.waiting_for_content":'正在等待"{id}"上的内容',"canvas.waiting_for_content_desc":"代理可以使用画布工具将内容推送到此处。帧到达后会立即在此视口中渲染。","canvas.disconnected_title":"画布套接字已断开","canvas.disconnected_desc":"重新连接到当前画布或切换到另一个实时画布 ID。","canvas.reconnect_button":"重新连接画布","canvas.frame_id":"帧 ID","canvas.guidance":"画布指南","canvas.guidance_desc":"使用助手直接在此视口中生成图表、图示、markdown 报告和 HTML 仪表板。","canvas.history":"帧历史","canvas.hide":"隐藏","canvas.show":"显示","canvas.history_collapsed_title":"历史已折叠","canvas.history_collapsed_desc":"展开此栏以检查活动画布上的先前帧。","canvas.no_frames_title":"尚无帧","canvas.no_frames_desc":"帧到达时将存储在此处以便快速回溯。","skills.kicker":"运营","skills.title":"技能","skills.create_skill":"创建技能","skills.registry_status":"注册表状态","skills.summary.total":"总计","skills.summary.active":"活跃","skills.summary.deprecated":"已弃用","skills.summary.domains":"领域","skills.index":"技能索引","skills.search_placeholder":"搜索技能…","skills.loading":"正在加载技能…","skills.no_skills_title":"未找到技能","skills.no_skills_desc":"创建本地技能以开始填充运营注册表。","skills.status.active":"活跃","skills.status.deprecated":"已弃用","skills.workspace":"技能工作区","skills.select_placeholder":"选择一个技能","skills.description":"描述","skills.content":"技能内容","skills.content_empty":"该技能没有可显示的内容。","skills.edit":"编辑","skills.reenable":"重新启用","skills.deprecate":"弃用","skills.deleting":"删除中…","skills.delete":"删除","skills.no_selected_title":"未选择技能","skills.no_selected_desc":"选择一个技能以检查其内容和运营元数据。","skills.install_github":"从 GitHub 安装","skills.install_github_desc":"粘贴 GitHub 仓库 URL 以直接安装技能。","skills.github_placeholder":"https://github.com/org/skill-repo","skills.installing":"正在安装…","skills.install":"安装","skills.marketplace":"市场","skills.marketplace_shown":"{count} 显示","skills.marketplace_placeholder":"搜索 ClawHub 技能…","skills.search":"搜索","skills.trending":"热门","skills.marketplace_loading":"正在加载市场…","skills.marketplace_empty":"没有市场结果","skills.modal.edit_title":"编辑技能","skills.modal.create_title":"创建技能","skills.modal.description":"技能是可以附加到代理和运行的可重用操作能力。","skills.modal.name_placeholder":"技能名称","skills.modal.description_placeholder":"描述","skills.modal.tags_placeholder":"逗号分隔的标签","skills.modal.content_placeholder":"技能 markdown 内容","skills.modal.cancel":"取消","skills.modal.saving":"保存中…","skills.modal.save_skill":"保存技能","skills.toast.updated":'技能"{name}"已更新。',"skills.toast.created":'技能"{name}"已创建。',"skills.toast.reenabled":'已重新启用技能"{name}"。',"skills.toast.deprecated":'已弃用技能"{name}"。',"skills.toast.deleted":'技能"{name}"已删除。',"skills.toast.installed":'已安装技能"{name}"。',"skills.toast.installed_github":'已从 GitHub 安装技能"{name}"。',"skills.err.save":"保存技能失败。","skills.err.load_detail":"加载技能内容失败。","skills.err.toggle":"更改技能状态失败。","skills.err.delete":"删除技能失败。","skills.err.install":"安装市场技能失败。","skills.err.install_github":"从 GitHub URL 安装技能失败。","teams.kicker":"编排中心","teams.title":"团队","teams.create":"创建团队","teams.refresh":"刷新","teams.count":"{count} 个团队","teams.agent_count":"{count} 个代理","teams.loading":"加载中…","teams.loading_desc":"正在加载团队…","teams.empty_title":"无团队","teams.empty_desc":"创建一个团队以开始。","teams.none_selected_title":"未选择团队","teams.none_selected_desc":"从索引中选择一个团队。","teams.members_suffix":"{members} 成员 · {edges} 边","teams.status.off":"关闭","teams.status.live":"运行","teams.status.deprecated":"已弃用","teams.status.active":"活跃","teams.action.edit":"编辑","teams.action.reenable":"重新启用","teams.action.deprecate":"弃用","teams.action.delete":"删除","teams.stats.members":"成员","teams.stats.edges":"边","teams.stats.status":"状态","teams.tab.summary":"概览","teams.tab.member":"成员","teams.open_agent_registry":"打开代理注册表","teams.modal.edit_title":"编辑团队","teams.modal.create_title":"创建团队","teams.modal.description":"团队编辑器现在直接在新界面中处理身份、组成以及核心报告/依赖边。","teams.form.name":"团队名称","teams.form.description":"描述","teams.form.members":"成员","teams.form.topology_preview":"拓扑预览","teams.form.edge_authoring":"边编辑","teams.form.from_member":"源成员","teams.form.to_member":"目标成员","teams.form.edge_reports_to":"报告给","teams.form.edge_supports":"支持","teams.form.edge_depends_on":"依赖于","teams.form.add_edge":"添加边","teams.form.remove":"移除","teams.form.no_edges":"尚未定义拓扑边。","teams.form.draft_summary":"草稿摘要","teams.form.draft_members":"成员","teams.form.draft_edges":"边","teams.form.draft_hint":"`REPORTS_TO` 用于层级,`SUPPORTS` 用于协作通道,`DEPENDS_ON` 用于阻塞执行关系。","teams.form.draft_team_name":"草稿团队","teams.form.cancel":"取消","teams.form.saving":"保存中…","teams.form.save":"保存团队","teams.toast.updated":"团队 “{name}” 已更新。","teams.toast.created":"团队 “{name}” 已创建。","teams.toast.deleted":"团队 “{name}” 已删除。","teams.toast.reenabled":"团队 “{name}” 已重新启用。","teams.toast.deprecated":"团队 “{name}” 已弃用。","teams.err.save":"保存团队失败。","teams.err.toggle":"更改团队状态失败。","teams.err.delete":"删除团队失败。","agents.kicker":"编排中心","agents.title":"代理","agents.create":"创建代理","agents.refresh":"刷新","agents.search_placeholder":"搜索代理…","agents.filter.all_roles":"所有角色","agents.filter.coder":"编码员","agents.filter.reviewer":"审阅者","agents.filter.researcher":"研究员","agents.filter.hide_disabled":"隐藏已停用","agents.filter.show_disabled":"显示已停用","agents.count":"{count} 个代理","agents.loading":"加载中…","agents.loading_desc":"正在加载代理…","agents.empty_title":"无代理","agents.empty_desc":"调整筛选条件或创建一个。","agents.none_selected_title":"未选择代理","agents.none_selected_desc":"从索引中选择一个代理。","agents.status.disabled":"已停用","agents.status.active":"活跃","agents.stats.registry":"注册表","agents.stats.active":"活跃","agents.stats.codex":"Codex","agents.section.identity":"身份","agents.section.soul":"灵魂","agents.section.soul_empty":"未提供灵魂描述。","agents.section.expertise":"专长","agents.section.no_expertise":"没有专长标签。","agents.section.voice":"语气","agents.section.voice_empty":"未指定","agents.section.revision":"修订","agents.section.created":"创建时间","agents.action.edit":"编辑","agents.action.reenable":"重新启用","agents.action.deprecate":"弃用","agents.action.delete":"删除","agents.action.deleting":"删除中…","agents.tab.summary":"概览","agents.tab.prompt":"提示","agents.summary.name":"名称","agents.summary.role":"角色","agents.summary.type":"类型","agents.summary.model":"模型","agents.summary.model_default":"默认","agents.summary.tone":"语气","agents.summary.revision":"修订","agents.summary.created":"创建时间","agents.prompt.system_hint":"系统提示","agents.prompt.system_hint_empty":"未配置系统提示。","agents.prompt.identity_seed":"身份种子","agents.modal.create_title":"创建代理","agents.modal.edit_title":"编辑代理","agents.modal.description":"代理是以身份驱动的操作者。Revka 将人设、模型和提示表面集中在一处。","agents.form.name":"名称","agents.form.tone":"语气","agents.form.tone_placeholder":"简洁直接","agents.form.identity":"身份","agents.form.soul":"灵魂","agents.form.role":"角色","agents.form.role.coder":"编码员","agents.form.role.reviewer":"审阅者","agents.form.role.researcher":"研究员","agents.form.agent_type":"代理类型","agents.form.model":"模型","agents.form.model_placeholder":"gpt-5.4 / claude-sonnet-4-6","agents.form.expertise":"专长","agents.form.expertise_placeholder":"rust, review, orchestration","agents.form.system_hint":"系统提示","agents.form.cancel":"取消","agents.form.saving":"保存中…","agents.form.save_create":"创建代理","agents.form.save_edit":"保存代理","agents.toast.updated":"代理 “{name}” 已更新。","agents.toast.created":"代理 “{name}” 已创建。","agents.toast.deleted":"代理 “{name}” 已删除。","agents.toast.reenabled":"代理 “{name}” 已重新启用。","agents.toast.deprecated":"代理 “{name}” 已弃用。","agents.err.load":"加载代理失败。","agents.err.save":"保存代理失败。","agents.err.toggle":"更改代理状态失败。","agents.err.delete":"删除代理失败。","runs.kicker":"编排中心","runs.title":"工作流运行","runs.refresh":"刷新","runs.index.title":"运行索引","runs.empty.title":"无运行记录","runs.empty.desc":"执行工作流以填充此索引。","runs.error.title":"加载错误","runs.stats.steps_fraction":"{completed}/{total} 步骤","runs.stats.expanded_steps":"{count} 个展开步骤","runs.stats.loop_fraction":"循环 {iteration}/{total}: {step}","runs.stats.loop_iteration":"循环 {iteration}: {step}","runs.open_definition":"打开定义","runs.action.retry_failed":"重试失败步骤","runs.action.retrying":"重试中…","runs.action.retry_tooltip":"重试失败的步骤","runs.action.stop":"停止","runs.action.stopping":"停止中…","runs.action.stop_tooltip":"停止此运行实例","runs.action.delete_tooltip":"删除运行","runs.none_selected.title":"未选择运行","runs.none_selected.desc":"从索引中选择一个运行。","runs.banner.label":"当前选择","runs.overlay.path_mode":"路径模式","runs.overlay.path.all":"全部","runs.overlay.path.failed":"失败","runs.overlay.path.blocked":"阻塞","runs.overlay.signals":"信号","runs.overlay.prev":"上一个","runs.overlay.next":"下一个","runs.overlay.signal_count":"{count} 个信号","runs.overlay.posture":"状态","runs.overlay.running":"运行中","runs.overlay.failed":"失败","runs.overlay.done":"完成","runs.overlay.pending":"待处理","runs.overlay.skipped":"已跳过","runs.overlay.hotspots":"热点","runs.overlay.legend_running":"运行中","runs.overlay.legend_failure":"失败","runs.overlay.legend_blocked":"阻塞","runs.overlay.legend_skipped":"已跳过","runs.overlay.legend_gate":"门","runs.overlay.fail_label":"失败:{id}","runs.overlay.run_label":"运行:{id}","runs.overlay.block_label":"阻塞:{id}","runs.started_at":"开始于 {time}","runs.inspector.title":"步骤检查器","runs.tab.summary":"概览","runs.tab.output":"输出","runs.tab.tools":"工具","runs.tab.transcript":"记录","runs.tab.jsonl":"JSONL 日志","runs.detail.select_node":"选择 DAG 节点以检查。","runs.detail.no_description":"无描述。","runs.detail.depends_on":"依赖:{list}","runs.detail.depends_none":"无","runs.detail.agent":"代理:{type}{role}","runs.detail.agent_na":"不适用","runs.detail.skills":"技能:{list}","runs.detail.dashboard_link":"仪表板","runs.detail.definition_link":"定义","runs.detail.select_step":"选择一个步骤。","runs.detail.step_output":"步骤输出","runs.detail.agent_output":"代理输出","runs.detail.no_output":"未捕获输出。","runs.detail.loading":"加载中…","runs.detail.tools_calls":"调用","runs.detail.tools_errors":"错误","runs.detail.no_tools":"未记录工具调用。","runs.detail.no_activity":"无代理活动记录。","runs.detail.no_jsonl":"未找到此代理的 JSONL 条目。","runs.detail.no_jsonl_filter":"没有条目匹配筛选条件。","runs.detail.no_transcript":"无记录。","runs.detail.tool_default":"工具","runs.detail.tool_status_ok":"ok","runs.timeline":"时间线 ({count})","runs.toast.retry_started":"运行 {id} 的重试已开始。","runs.toast.stop_requested":"运行 {id} 的停止请求已发送。","runs.toast.deleted":"运行 {id} 已删除。","runs.err.retry":"重试运行失败。","runs.err.stop":"停止运行失败。","runs.err.delete":"删除运行失败。","memory.kicker":"检查","memory.page_title":"记忆","memory.page_description":"记忆图检查,支持种类过滤、空间作用域、搜索高亮和节点关联的详情钻取。","memory.selected_memory":"选中的记忆","memory.loading_detail":"正在加载节点详情…","memory.relative.just_now":"刚刚","memory.relative.minutes":"{count} 分钟前","memory.relative.hours":"{count} 小时前","memory.relative.days":"{count} 天前","memory.detail.metadata":"元数据","memory.detail.bundle_members":"捆绑成员","memory.controls.title":"图控件","memory.controls.search_placeholder":"高亮记忆…","memory.controls.all_spaces":"所有空间","memory.controls.node_limit":"节点数限制","memory.filters.title":"筛选器","memory.filters.empty_title":"尚未加载种类","memory.filters.empty_desc":"一旦记忆数据可用,图筛选器就会显示。","memory.graph.kicker":"记忆图","memory.graph.heading":"语义记忆拓扑","memory.graph.items":"条目","memory.graph.edges":"边","memory.graph.shown":"已显示","memory.graph.matches":"{count} 个匹配","memory.graph.match":"{count} 个匹配","memory.graph.loading_title":"正在加载记忆图…","memory.graph.loading_desc":"正在获取语义记忆拓扑和关系边。","memory.graph.error_title":"无法加载记忆图","memory.graph.retry":"重试","memory.graph.empty_title":"未找到记忆","memory.graph.empty_desc":"调整筛选条件、清除搜索或增加节点数以扩展图。","memory.none_selected_title":"未选择记忆","memory.none_selected_desc":"在图中选择一个节点以查看元数据、基于修订的详情和捆绑成员关系。","memory.err.load":"加载记忆图失败","assets.kicker":"运维","assets.title":"资产","assets.search_placeholder":"搜索资产…","assets.project":"项目","assets.up":"上一级","assets.err.load":"加载 Kumiho 项目失败。请检查 Kumiho API 是否可达。","assets.col.name":"名称","assets.col.kind":"类型","assets.col.author":"作者","assets.col.created":"创建时间","assets.loading.projects":"正在加载项目…","assets.loading.space":"正在加载空间…","assets.loading.generic":"加载中…","assets.folder":"文件夹","assets.empty.title":"空的空间","assets.empty.desc":"此位置没有文件夹或资产。","assets.search.empty_title":"无结果","assets.search.empty_desc":'没有资产匹配 "{query}"。',"assets.search.result_count":'"{query}" 的 {count} 个结果',"assets.copy_kref":"复制 kref","assets.close_inspector":"关闭检查器","assets.deprecated":"已弃用","assets.active":"活跃","assets.rev_count":"{count} 个修订","assets.rev_count_one":"{count} 个修订","assets.by":"由 {author}","assets.section.revisions":"修订","assets.section.artifacts":"工件","assets.section.edges":"边","assets.section.metadata":"元数据","assets.section.revisions_empty":"无修订。","assets.section.artifacts_empty":"无工件。","assets.section.edges_empty":"无边。","assets.section.metadata_empty":"无元数据。","assets.tag.latest":"最新","assets.tag.published":"已发布","assets.action.view":"查看","assets.action.edit":"编辑","assets.action.restore":"恢复","assets.action.deprecate":"弃用","assets.action.publish":"发布","assets.action.published":"已发布","assets.action.save_artifact":"保存工件","assets.action.deprecate_item":"弃用选中项目","assets.action.restore_item":"恢复选中项目","assets.action.deprecate_revision":"弃用选中修订","assets.action.restore_revision":"恢复选中修订","assets.action.publish_revision":"将选中修订标记为已发布","assets.action.edit_artifact":"编辑工件","assets.action.deprecate_artifact":"弃用工件","assets.action.restore_artifact":"恢复工件","assets.toast.item_deprecated":"项目已弃用。","assets.toast.item_restored":"项目已恢复。","assets.toast.revision_deprecated":"修订已弃用。","assets.toast.revision_restored":"修订已恢复。","assets.toast.revision_published":"修订已标记为已发布。","assets.toast.artifact_deprecated":"工件已弃用。","assets.toast.artifact_restored":"工件已恢复。","assets.toast.artifact_saved":"工件内容已更新。","assets.toast.artifact_saved_new_revision":"已创建新修订并附加更新后的工件。","assets.err.action":"资产操作失败。","assets.err.load_artifact":"加载工件内容失败。","assets.editor.title":"编辑 {name}","assets.editor.mutable_desc":"保存会更新当前修订的工件文件。","assets.editor.published_desc":"此修订已发布且不可变。保存会创建新修订并附加更新后的工件。","config.kicker":"运维","config.page_title":"配置","config.reload":"重新加载","config.save_button":"保存配置","config.saving_button":"保存中…","config.loading_title":"正在加载配置…","config.toast.saved":"配置已保存。","config.err.load":"加载配置失败。","config.err.save":"保存配置失败。","config.err.mcp_errors":"保存前请修复 MCP 服务器错误。","config.map":"配置地图","config.workspace":"TOML 工作区","config.workspace.structured_heading":"结构化控件","config.workspace.source_heading":"源代码编辑器","config.tab.structured":"结构化","config.tab.source":"源代码","config.tabs_aria":"配置工作区标签","config.hide_preview":"隐藏预览","config.show_preview":"显示预览","config.mapped_paths":"映射的 TOML 路径","config.structured.error_title":"无法构建结构化控件","config.structured.error_desc":"在显示分组配置控件之前,原始 TOML 必须可解析。","config.summary.title":"解析摘要","config.summary.error_title":"无法解析 TOML","config.summary.error_desc":"只有当编辑器包含可解析的 TOML 段时,摘要面板才会更新。","config.source_health":"源代码健康状况","config.row.workspace_mode":"工作区模式","config.row.preview":"预览","config.row.sections":"段","config.row.parse_status":"解析状态","config.row.parse_valid":"有效","config.row.parse_needs":"需要注意","config.mode.structured":"结构化","config.mode.source":"源代码","config.toggle.enabled":"已启用","config.toggle.disabled":"已禁用","config.section.provider":"提供商","config.section.provider_desc":"默认模型提供商、API 路由和生成参数。","config.section.agent":"代理","config.section.agent_desc":"代理运行时的循环限制、上下文预算和推理默认值。","config.section.memory":"记忆","config.section.memory_desc":"记忆后端、Kumiho 连接和持久化行为。","config.section.runtime":"运行时","config.section.runtime_desc":"网关绑定设置、配对和自治姿态。","config.section.security":"安全/成本","config.section.security_desc":"审计和沙箱设置以及成本限额控制。","config.section.channels":"通道","config.section.channels_desc":"运营通道的 CLI 和消息传递表面行为。","config.section.mcp":"MCP 服务器","config.section.mcp_desc":"模型上下文协议客户端 — 顶层开关和结构化服务器条目。","config.section.extra_desc":"在 config.toml 中发现的附加章节 — 通用编辑器。","config.generic.empty":"此章节暂无字段。","config.generic.empty_array":"（空数组）","config.generic.array_readonly":"数组在通用编辑器中为只读 — 请使用源代码标签修改。","config.provider.default_provider":"默认提供商","config.provider.default_model":"默认模型","config.provider.temperature":"温度","config.provider.timeout":"提供商超时","config.provider.max_tokens":"提供商最大 Token","config.agent.max_tool_iterations":"最大工具迭代次数","config.agent.max_context_tokens":"最大上下文 Token","config.agent.max_history_messages":"最大历史消息数","config.agent.gpt55_context_window":"GPT-5.5 上下文窗口","config.agent.context_window_safety_ratio":"上下文安全比例","config.agent.parallel_tools":"并行工具","config.agent.thinking_level":"思考级别","config.memory.kumiho_enabled":"Kumiho 启用","config.memory.memory_project":"记忆项目","config.memory.harness_project":"Harness 项目","config.memory.retrieval_limit":"检索限制","config.memory.backend":"记忆后端","config.memory.auto_save":"自动保存","config.memory.snapshots":"快照","config.runtime.gateway_host":"网关主机","config.runtime.gateway_port":"网关端口","config.runtime.require_pairing":"需要配对","config.runtime.session_persistence":"会话持久化","config.runtime.autonomy_level":"自治级别","config.runtime.max_actions_hour":"每小时最大操作数","config.security.audit_enabled":"审计已启用","config.security.sandbox_backend":"沙箱后端","config.security.daily_limit":"每日限额 USD","config.security.monthly_limit":"每月限额 USD","config.security.warn_percent":"警告百分比","config.channels.cli":"CLI 通道","config.channels.ack_reactions":"确认反应","config.channels.show_tool_calls":"显示工具调用","config.channels.message_timeout":"消息超时秒数","config.summary.api_url":"API URL","config.summary.provider":"提供商","config.summary.model":"模型","config.summary.temperature":"温度","config.summary.timeout":"超时","config.summary.max_tokens":"最大 Token","config.summary.runtime":"运行时","config.summary.gateway":"网关","config.summary.pairing_required":"需要配对","config.summary.session_persistence":"会话持久化","config.summary.autonomy_level":"自治级别","config.summary.workspace_only":"仅工作区","config.summary.max_actions_hour":"每小时最大操作数","config.summary.memory":"记忆","config.summary.backend":"后端","config.summary.auto_save":"自动保存","config.summary.hygiene":"卫生处理","config.summary.snapshots":"快照","config.summary.kumiho_enabled":"Kumiho 启用","config.summary.memory_project":"记忆项目","config.summary.retrieval_limit":"检索限制","config.summary.safety_cost":"安全/成本","config.summary.audit_enabled":"审计已启用","config.summary.sandbox_backend":"沙箱后端","config.summary.daily_limit":"每日限额","config.summary.monthly_limit":"每月限额","config.summary.warn_percent":"警告百分比","config.summary.channels":"通道","config.summary.cli":"CLI","config.summary.telegram":"Telegram","config.summary.discord":"Discord","config.summary.slack":"Slack","config.summary.matrix":"Matrix","config.summary.signal":"Signal","config.summary.whatsapp":"WhatsApp","config.row.enabled":"已启用","config.row.disabled":"已禁用","config.mcp.title":"MCP","config.mcp.enabled":"MCP 已启用","config.mcp.deferred":"延迟加载","config.mcp.servers":"服务器","config.mcp.no_servers":"尚未配置任何服务器。","config.mcp.server_count":"已配置 {count} 个服务器。","config.mcp.server_count_one":"已配置 1 个服务器。","config.mcp.add_server":"添加 MCP 服务器","config.mcp.confirm_remove":"移除 {label}?","config.mcp.entry_label":"条目 {index}","config.mcp.server_default":"服务器 {index}","config.mcp.stdio_empty":"stdio — 未设置命令","config.mcp.transport_empty":"{transport} — 未设置 url","config.mcp.test":"测试","config.mcp.testing":"测试中…","config.mcp.test_tooltip":"运行 MCP initialize + tools/list 握手","config.mcp.test_blocked":"测试前请修复验证错误","config.mcp.delete_label":"删除 {label}","config.mcp.connecting":"连接中…","config.mcp.tool_count":"{count} 个工具 · {latency}ms","config.mcp.tool_count_one":"1 个工具 · {latency}ms","config.mcp.tools_list":"工具:{list}","config.mcp.handshake_failed":"握手失败","config.mcp.field_name":"名称","config.mcp.field_name_placeholder":"例如 memory","config.mcp.field_transport":"传输","config.mcp.field_command":"命令","config.mcp.field_command_placeholder":"/usr/local/bin/mcp-server","config.mcp.field_args":"参数","config.mcp.field_args_placeholder":"--flag","config.mcp.field_env":"环境变量","config.mcp.field_env_key":"KEY","config.mcp.field_env_value":"value","config.mcp.field_url":"URL","config.mcp.field_url_placeholder":"https://example.com/mcp","config.mcp.field_headers":"头部","config.mcp.field_headers_key":"Header-Name","config.mcp.field_headers_value":"value","config.mcp.field_timeout":"超时 (毫秒)","config.mcp.field_timeout_placeholder":"30000","config.mcp.add_entry":"添加 {label}","config.mcp.remove_entry":"移除 {label} 条目 {index}","landing.skip_link":"跳转到主要内容","landing.nav.aria_label":"站点导航","landing.nav.logo_alt":"Revka 徽标","landing.nav.features":"功能","landing.nav.launch":"打开仪表盘","landing.hero.aria_label":"首屏","landing.hero.badge":"记忆原生 · Rust 原生 · 图原生","landing.hero.tagline":"记忆原生的智能体运行时","landing.hero.description":"基于 Kumiho 的图原生记忆构建。每一次会话、计划、技能和信任分数都存在于图中 — 只要发生过,就可以被查询。","landing.hero.cta_primary":"打开仪表盘","landing.hero.cta_secondary":"浏览功能","landing.hero.banner_alt":"Revka — 记忆原生的智能体运行时仪表盘","landing.hero.scroll_cue":"向下滚动","landing.stats.aria_label":"关键指标","landing.stats.runtime_label":"运行时","landing.stats.namespaces_label":"命名空间","landing.stats.memory_label":"记忆图谱","landing.stats.goals_label":"目标追踪","landing.stats.orchestration_label":"编排","landing.pillars.aria_label":"三大支柱","landing.pillars.badge":"三大支柱","landing.pillars.title":"一个运行时,适配任意界面","landing.pillars.description":"Revka 构建在三大基石之上 — 提供商无关的智能体、图原生的记忆,以及任意渠道的触达。","landing.pillars.agents.title":"智能体","landing.pillars.agents.desc":"提供商无关的智能体(OpenAI、Anthropic、本地模型)通过工作流和集群进行编排 — 全部运行在你的设备上。","landing.pillars.memory.title":"记忆","landing.pillars.memory.desc":"通过 Kumiho、SQLite 或 Markdown 跨会话保留知识。智能体会记住你、你的项目和过往的决策。","landing.pillars.channels.title":"渠道","landing.pillars.channels.desc":"通过 Telegram、Discord、Slack、iMessage、Matrix、邮件等渠道与 Revka 交流。一个运行时,适配任意界面。","landing.features.aria_label":"功能","landing.features.badge":"能力","landing.features.title":"为智能体时代而生","landing.features.description":"每个组件都围绕持久化记忆和多智能体协作设计 — 从生成到退役的全流程。","landing.features.featured_badge":"核心记忆基石","landing.features.memory.title":"Kumiho 记忆","landing.features.memory.desc":"图原生的持久化记忆。每次会话、计划和技能都经过版本管理、链接且可查询 — 不依赖任何回退后端。","landing.features.operator.title":"Operator","landing.features.operator.desc":"多智能体编排,支持角色委派(编码者、审核者、研究员)、带记忆唤起的派生以及信任评分。","landing.features.pool.title":"智能体池","landing.features.pool.desc":"可复用的智能体定义,包含角色、能力和模型偏好。用量追踪会优先呈现表现优秀的智能体。","landing.features.clawhub.title":"ClawHub 市场","landing.features.clawhub.desc":"在共享注册中心发布、搜索和安装智能体模板、技能和团队配置。","landing.features.goals.title":"目标层级","landing.features.goals.desc":"三层目标追踪:战略级、战术级和任务级 — 全部带状态与依赖关系持久化在图中。","landing.features.audit.title":"审计轨迹","landing.features.audit.desc":"Merkle 哈希链防篡改日志。每次操作都以可加密验证的方式记录。","landing.how.aria_label":"工作原理","landing.how.badge":"流程","landing.how.title":"Revka 是如何工作的","landing.how.description":"从智能体部署到持续回忆 — 三个紧密衔接的步骤管理完整生命周期。","landing.how.step1.title":"部署智能体","landing.how.step1.desc":"配置角色、能力和模型偏好。Revka 会将模板存入图中以便复用与回忆。","landing.how.step2.title":"记忆持续累积","landing.how.step2.desc":"每一次会话、计划、技能和交互都会在 Kumiho 中进行版本化和边连接。没有任何东西会丢失。","landing.how.step3.title":"对一切进行查询","landing.how.step3.desc":"利用目标层级、信任评分和图遍历,从所有智能体历史中挖掘洞察。","landing.cli.aria_label":"命令行参考","landing.cli.badge":"命令行","landing.cli.title":"从终端操控一切","landing.cli.description":"守护进程必须运行,仪表盘和渠道才能响应。UI 上的所有操作都对应一个命令。","landing.cli.cmd.onboard":"运行交互式初始化向导","landing.cli.cmd.reinit":"从头重置并重新配置(含隧道)","landing.cli.cmd.daemon":"启动长期运行的运行时","landing.cli.cmd.doctor":"检查守护进程、调度器和渠道的健康状态","landing.cli.cmd.status":"打印完整的系统状态","landing.cli.cmd.channel_list":"列出已配置的渠道","landing.cli.cmd.channel_add":"添加 Telegram 机器人","landing.cli.cmd.providers":"列出受支持的 AI 提供商","landing.cli.cmd.memory_stats":"查看智能体记忆大小","landing.cli.cmd.service_install":"作为 launchd/systemd 用户服务安装","landing.arch.aria_label":"架构","landing.arch.badge":"图原生","landing.arch.title":"一切尽在图中","landing.arch.description":"所有持久化状态都位于 Kumiho 的严格命名空间层级之下 — 版本化、边链接,并可跨会话查询。","landing.arch.ns.agentpool":"可复用的智能体模板","landing.arch.ns.plans":"执行计划和步骤","landing.arch.ns.sessions":"跨会话连续性","landing.arch.ns.goals":"战略目标追踪","landing.arch.ns.clawhub":"已发布的模板和技能","landing.arch.ns.teams":"团队定义","landing.arch.ns.skills":"共享技能库","landing.arch.ns.trust":"信任评分和历史","landing.arch.connection_note":"所有命名空间通过 Kumiho 的图边互相连接","landing.tunnels.aria_label":"关于隧道","landing.tunnels.badge":"隧道","landing.tunnels.title":"公开访问,本地可信","landing.tunnels.description_prefix":"你的网关运行在 ","landing.tunnels.description_suffix":" 上 — 仅本机可访问。基于 Webhook 的渠道(Telegram、Slack 事件、WhatsApp、WeChat)需要公共 URL。隧道可将一个公共主机名转发到你本地的网关,而无需打开防火墙端口。","landing.tunnels.provider.cloudflare.name":"Cloudflare Tunnel","landing.tunnels.provider.cloudflare.desc":"免费且达到生产级别。需要 Zero Trust 账户和一个隧道令牌。","landing.tunnels.provider.ngrok.name":"ngrok","landing.tunnels.provider.ngrok.desc":"快捷且临时,非常适合本地开发和测试。","landing.tunnels.provider.tailscale.name":"Tailscale Funnel","landing.tunnels.provider.tailscale.desc":"使用你的 tailnet 身份将一个 tailnet 服务公开共享。","landing.tunnels.provider.custom.name":"自定义","landing.tunnels.provider.custom.desc":"自带反向代理或公共 URL。","landing.tunnels.setup_hint_prefix":"运行 ","landing.tunnels.setup_hint_suffix":" 并在提示时选择一个提供商。","landing.cta.aria_label":"开始使用","landing.cta.headline_prefix":"准备好","landing.cta.headline_highlight":"开始构建","landing.cta.headline_suffix":"了吗?","landing.cta.description":"打开仪表盘来管理智能体、浏览技能库、编排团队,以及探索图中记录的一切。","landing.cta.button":"打开仪表盘","landing.footer.tagline":"记忆原生的智能体运行时"},en:{"nav.dashboard":"Dashboard","nav.agent":"Agent","nav.tools":"Tools","nav.cron":"Scheduled Jobs","nav.integrations":"Integrations","nav.memory":"Memory","nav.config":"Configuration","nav.cost":"Cost Tracker","nav.logs":"Logs","nav.doctor":"Doctor","nav.agents":"Agent Pool","nav.skills":"Skills Library","nav.teams":"Agent Teams","nav.assets":"Asset Browser","nav.skins":"Skins","nav.memoryAuditor":"Memory Auditor","nav.audit":"Audit Trail","nav.canvas":"Canvas","nav.workflows":"Workflows","dashboard.title":"Dashboard","dashboard.provider":"Provider","dashboard.model":"Model","dashboard.uptime":"Uptime","dashboard.temperature":"Temperature","dashboard.gateway_port":"Gateway Port","dashboard.memory_backend":"Memory Backend","dashboard.paired":"Paired","dashboard.channels":"Channels","dashboard.health":"Health","dashboard.status":"Status","dashboard.overview":"Overview","dashboard.system_info":"System Information","dashboard.quick_actions":"Quick Actions","agent.title":"Agent Chat","agent.send":"Send","agent.placeholder":"Type a message...","agent.start_conversation":"Send a message to start the conversation","agent.type_message":"Type a message...","agent.connecting":"Connecting...","agent.connected":"Connected","agent.disconnected":"Disconnected","agent.reconnecting":"Reconnecting...","agent.thinking":"Thinking...","agent.tool_call":"Tool Call","agent.tool_result":"Tool Result","agent.connection_error":"Connection error. Attempting to reconnect...","agent.tool_call_prefix":"[Tool Call]","agent.tool_result_prefix":"[Tool Result]","agent.error_prefix":"[Error]","agent.unknown_error":"Unknown error","agent.send_error":"Failed to send message. Please try again.","agent.copy_message":"Copy message","agent.connected_status":"Connected","agent.disconnected_status":"Disconnected","agent.copy_code":"Copy code","agent.copied_code":"Copied code","agent.copy":"copy","agent.copied":"copied","agent.code_language_fallback":"code","agent.jump_to_latest":"Jump to latest","agent.placeholder_steer_next_step":"steer next step…","agent.placeholder_queue_next":"queue next message…","agent.placeholder_message":"message…","agent.placeholder_connecting":"connecting…","agent.send_mode":"Send mode","agent.send_mode_queue":"queue","agent.send_mode_steer":"steer","agent.queue_after_current_response":"Queue after current response","agent.steer_text_only":"Steering is text-only; attachments will queue instead","agent.steer_next_step":"Steer next step","agent.queue_message":"Queue message","agent.send_message":"Send message","agent.send_enter":"Send (Enter)","agent.steer_prefix":"[steer]","agent.tool_output_truncated":"Output truncated in chat view; copy or inspect the run log for the full result.","agent.activity_input_label":"Input","agent.activity_diff_label":"Diff","agent.activity_output_label":"Output","agent.reasoning_trace_label":"Reasoning trace","tools.name":"Name","tools.parameters":"Parameters","tools.search":"Search tools...","tools.empty":"No tools available.","tools.count":"Total tools","tools.agent_tools":"Agent Tools","tools.cli_tools":"CLI Tools","tools.path":"Path","tools.version":"Version","tools.category":"Category","tools.load_error":"Failed to load tools","cron.title":"Scheduled Jobs","cron.scheduled_tasks":"Scheduled Tasks","cron.add":"Add Job","cron.add_job":"Add Job","cron.add_modal_title":"Add Cron Job","cron.delete":"Delete","cron.enable":"Enable","cron.disable":"Disable","cron.name":"Name","cron.name_optional":"Name (optional)","cron.command":"Command","cron.command_required":"Command","cron.schedule":"Schedule","cron.schedule_required":"Schedule","cron.next_run":"Next Run","cron.last_run":"Last Run","cron.last_status":"Last Status","cron.enabled":"Enabled","cron.enabled_status":"Enabled","cron.disabled_status":"Disabled","cron.empty":"No scheduled jobs.","cron.confirm_delete":"Are you sure you want to delete this job?","cron.load_error":"Failed to load cron jobs","cron.validation_error":"Schedule and command are required.","cron.add_error":"Failed to add job","cron.delete_error":"Failed to delete job","cron.cancel":"Cancel","cron.adding":"Adding...","cron.id":"ID","cron.actions":"Actions","cron.loading_run_history":"Loading run history...","cron.load_run_history_error":"Failed to load run history","cron.no_runs":"No runs recorded yet.","cron.recent_runs":"Recent Runs","cron.yes":"Yes","cron.no":"No","cron.edit":"Edit","cron.edit_modal_title":"Edit Cron Job","cron.edit_error":"Failed to update job","cron.saving":"Saving...","cron.save":"Save","integrations.available":"Available","integrations.active":"Active","integrations.coming_soon":"Coming Soon","integrations.category":"Category","integrations.status":"Status","integrations.search":"Search integrations...","integrations.empty":"No integrations found.","integrations.activate":"Activate","integrations.deactivate":"Deactivate","integrations.load_error":"Failed to load integrations","integrations.status_active":"Active","integrations.status_available":"Available","integrations.status_coming_soon":"Coming Soon","memory.title":"Memory Store","memory.memory_title":"Memory","memory.search":"Search memory...","memory.search_placeholder":"Search memory entries...","memory.add":"Store Memory","memory.add_memory":"Add Memory","memory.add_modal_title":"Add Memory","memory.delete":"Delete","memory.key":"Key","memory.key_required":"Key","memory.content":"Content","memory.content_required":"Content","memory.category":"Category","memory.category_optional":"Category (optional)","memory.timestamp":"Timestamp","memory.session":"Session","memory.score":"Score","memory.empty":"No memory entries found.","memory.confirm_delete":"Are you sure you want to delete this memory entry?","memory.all_categories":"All Categories","memory.search_button":"Search","memory.load_error":"Failed to load memory","memory.saving":"Saving...","memory.validation_error":"Key and content are required.","memory.store_error":"Failed to store memory","memory.delete_error":"Failed to delete memory","memory.delete_confirm":"Delete?","memory.yes":"Yes","memory.no":"No","memory.cancel":"Cancel","config.title":"Configuration","config.save":"Save","config.saving":"Saving...","config.reset":"Reset","config.saved":"Configuration saved successfully.","config.error":"Failed to save configuration.","config.loading":"Loading configuration...","config.editor_placeholder":"TOML configuration...","config.configuration_title":"Configuration","config.sensitive_title":"Sensitive fields are masked","config.sensitive_hint":"API keys, tokens, and passwords are hidden for security. To update a masked field, replace the entire masked value with your new value.","config.save_success":"Configuration saved successfully.","config.save_error":"Failed to save configuration","config.toml_label":"TOML Configuration","config.lines":"lines","cost.session":"Session Cost","cost.daily":"Daily Cost","cost.monthly":"Monthly Cost","cost.request_count":"Requests","cost.by_model":"Cost by Model","cost.model":"Model","cost.usd":"Cost (USD)","cost.load_error":"Failed to load cost data","cost.total_requests":"Total Requests","cost.token_statistics":"Token Statistics","cost.avg_tokens_per_request":"Avg Tokens / Request","cost.cost_per_1k_tokens":"Cost per 1K Tokens","cost.model_breakdown":"Model Breakdown","cost.cost":"Cost","cost.share":"Share","logs.live_logs":"Live Logs","logs.clear":"Clear","logs.filter":"Filter logs...","logs.filter_label":"Filter","logs.empty":"No log entries.","logs.events":"events","logs.paused_hint":"Log streaming is paused.","logs.waiting_hint":"Waiting for events...","doctor.diagnostics_title":"Diagnostics","doctor.run_diagnostics":"Run Diagnostics","doctor.running_btn":"Running...","doctor.running_desc":"Running diagnostics...","doctor.running_hint":"This may take a few seconds.","doctor.error":"Error","doctor.severity":"Severity","doctor.category":"Category","doctor.message":"Message","doctor.empty":"No diagnostics have been run yet.","doctor.summary":"Diagnostic Summary","doctor.issues_found":"Issues Found","doctor.warnings_summary":"Warnings","doctor.all_clear":"All Clear","doctor.system_diagnostics":"System Diagnostics","doctor.empty_hint":'Click "Run Diagnostics" to check your Revka installation.',"auth.pair":"Pair Device","auth.pairing_code":"Pairing Code","auth.pair_button":"Pair","auth.logout":"Logout","auth.pairing_success":"Pairing successful!","auth.pairing_failed":"Pairing failed. Please try again.","auth.enter_code":"Enter your pairing code to connect to the agent.","common.loading":"Loading...","common.error":"An error occurred.","common.retry":"Retry","common.cancel":"Cancel","common.confirm":"Confirm","common.save":"Save","common.delete":"Delete","common.edit":"Edit","common.execute":"Execute","common.close":"Close","common.yes":"Yes","common.no":"No","common.search":"Search...","common.no_data":"No data available.","common.refresh":"Refresh","common.back":"Back","common.actions":"Actions","common.name":"Name","common.description":"Description","common.status":"Status","common.created":"Created","common.updated":"Updated","health.title":"System Health","health.component":"Component","health.status":"Status","health.last_ok":"Last OK","health.last_error":"Last Error","health.restart_count":"Restarts","health.pid":"Process ID","health.uptime":"Uptime","health.updated_at":"Last Updated","dashboard.provider_model":"Provider / Model","dashboard.since_last_restart":"Since last restart","dashboard.paired_yes":"Yes","dashboard.paired_no":"No","dashboard.cost_overview":"Cost Overview","dashboard.active_channels":"Active Channels","dashboard.filter_active":"Active","dashboard.filter_all":"All","dashboard.no_active_channels":"No active channels","dashboard.component_health":"Component Health","dashboard.load_error":"Failed to load dashboard","dashboard.session_label":"Session","dashboard.daily_label":"Daily","dashboard.monthly_label":"Monthly","dashboard.total_tokens_label":"Total Tokens","dashboard.requests_label":"Requests","dashboard.by_model":"By Model","dashboard.no_channels":"No channels configured","dashboard.active":"Active","dashboard.inactive":"Inactive","dashboard.no_components":"No components reporting","dashboard.restarts":"Restarts","dashboard.tab_overview":"Overview","dashboard.tab_sessions":"Sessions","dashboard.tab_channels":"Channels","dashboard.tab_audit":"Audit Trail","dashboard.tab_workflows":"Workflows","dashboard.audit_disabled":"Audit logging is not enabled. Enable it in config to see events.","dashboard.audit_all_types":"All Event Types","dashboard.audit_refresh":"Refresh","dashboard.audit_verify_chain":"Verify Chain","dashboard.audit_chain_valid":"Chain integrity verified","dashboard.audit_chain_invalid":"Chain integrity check failed","dashboard.audit_no_events":"No audit events found","dashboard.sessions_title":"Active Sessions","dashboard.no_sessions":"No active sessions","dashboard.session_id":"Session ID","dashboard.session_channel":"Channel","dashboard.session_started":"Started","dashboard.session_last_activity":"Last Activity","dashboard.session_status":"Status","dashboard.session_messages":"Messages","dashboard.session_details":"Session Details","dashboard.session_history":"View History","dashboard.channels_title":"Channel Status","dashboard.no_channels_detail":"No channel details available","dashboard.channel_type":"Type","dashboard.channel_messages":"Messages","dashboard.channel_last_message":"Last Message","dashboard.channel_config":"Configuration","dashboard.channel_enabled":"Enabled","dashboard.channel_disabled":"Disabled","dashboard.loading_sessions":"Loading sessions...","dashboard.loading_channels":"Loading channels...","dashboard.load_sessions_error":"Failed to load sessions","dashboard.load_channels_error":"Failed to load channels","dashboard.never":"Never","dashboard.tab_clawhub":"ClawHub","dashboard.tab_nodes":"Nodes","dashboard.clawhub_title":"ClawHub Marketplace","dashboard.clawhub_search":"Search templates, skills, teams…","dashboard.clawhub_no_items":"No items found. Publish your first template or skill!","dashboard.clawhub_publish":"Publish","dashboard.clawhub_install":"Install","dashboard.clawhub_downloads":"downloads","dashboard.clawhub_by":"by","dashboard.nodes_title":"Connected Nodes","dashboard.nodes_no_nodes":"No nodes connected. Nodes connect via WebSocket to /ws/nodes.","dashboard.nodes_capabilities":"Capabilities","dashboard.nodes_invoke":"Invoke","settings.title":"Settings","settings.tab.appearance":"Appearance","settings.tab.typography":"Typography","settings.appearance":"Appearance","settings.typography":"Typography","settings.fontUi":"UI Font","settings.fontMono":"Code Font","settings.fontSize":"UI Font Size","settings.fontMonoSize":"Code Font Size","settings.preview":"Preview","settings.previewText":"The quick brown fox jumps over the lazy dog.","settings.fontNote":"Font changes apply on page reload.","settings.language":"Language","chat_panel.ai_assistant":"AI Assistant","chat_panel.agent_placeholder":'Ask me to create an agent, e.g. "Create a Rust security specialist"',"chat_panel.team_placeholder":'Ask me to build a team, e.g. "Build a team for the frontend migration"',"chat_panel.skill_placeholder":'Ask me to create a skill, e.g. "Create a code review skill"',"chat_panel.close":"Close","clawhub.tab_local":"Local Skills","clawhub.tab_clawhub":"ClawHub","clawhub.search_placeholder":"Search ClawHub skills...","clawhub.trending":"Trending","clawhub.install":"Install","clawhub.installing":"Installing...","clawhub.installed":"Installed","clawhub.downloads":"downloads","clawhub.stars":"stars","clawhub.verified":"Verified","clawhub.no_results":"No skills found","clawhub.search_hint":"Search 13,000+ community skills on ClawHub","clawhub.error":"Could not connect to ClawHub","clawhub.details":"Details","clawhub.less":"Less","clawhub.author":"Author","clawhub.tags":"Tags","theme.mode":"Theme Mode","theme.accent":"Accent Color","theme.system":"System","theme.dark":"Dark","theme.light":"Light","theme.oled":"OLED Black","nav.pairing":"Pairing","nav.section.orchestration":"Orchestration","nav.section.operations":"Operations","nav.section.inspection":"Inspection","nav.dashboard.blurb":"Live runtime posture and active DAG state","nav.workflows.blurb":"Define DAGs and drill into runs from the same flow","nav.agents.blurb":"Reusable actors and workflow participants","nav.canvas.blurb":"Visual workspace and orchestration canvases","nav.teams.blurb":"View delegation topology and ownership","nav.assets.blurb":"Artifacts and workflow-adjacent resources","nav.skins.blurb":"Token and asset based UI skins","nav.skills.blurb":"Reusable operational capabilities","nav.tools.blurb":"Agent tool catalog and CLI binaries","nav.integrations.blurb":"Connected systems and channel surfaces","nav.cron.blurb":"Scheduled jobs and catch-up behaviour","nav.pairing.blurb":"Device enrolment and trust management","nav.config.blurb":"Runtime TOML and operational configuration","nav.cost.blurb":"Spend and efficiency by workflow and run","nav.memory.blurb":"Kumiho memory graph explorer and revisions","nav.logs.blurb":"Operational traces and node-linked events","nav.audit.blurb":"Trust chain and approval verification","nav.doctor.blurb":"Diagnostics and runtime recovery posture","sidebar.brand_subtitle":"Agent OS","sidebar.shell":"Revka","sidebar.shell_description":"A local-first agent OS that orchestrates AI workflows, tools, and runtime across your projects.","header.tagline":"Orchestration-first agent operating system.","header.runtime_healthy":"Runtime healthy","header.trust_verified":"Trust verified","header.trust_unverified":"Trust unverified","header.trust_checking":"Verifying trust…","header.operator":"Operator","common.duplicate":"Duplicate","common.reenable":"Re-enable","common.deprecate":"Deprecate","common.create":"Create","dashboard.kicker":"Orchestration Center","dashboard.live_orchestration_pane":"Live Orchestration Pane","dashboard.active_workflow_posture":"Active workflow posture","dashboard.open_workflow_definition":"Open workflow definition","dashboard.selected_run":"Selected Run","dashboard.run_posture":"Run Posture","dashboard.signal_focus":"Signal Focus","dashboard.hotspots":"Hotspots","dashboard.count.running":"Running","dashboard.count.failed":"Failed","dashboard.count.completed":"Completed","dashboard.count.pending":"Pending","dashboard.count.skipped":"Skipped","dashboard.prev_signal":"Prev Signal","dashboard.next_signal":"Next Signal","dashboard.intervention_points":"{count} intervention points","dashboard.label.failure":"Failure: {id}","dashboard.label.running":"Running: {id}","dashboard.label.blocked":"Blocked: {id}","dashboard.selected_step":"Selected Step","dashboard.inspect_node_in_runs":"Inspect this node in run workspace","dashboard.open_definition_node":"Open definition node","dashboard.select_dag_node":"Select a node in the DAG to inspect the active branch.","dashboard.priority_timeline":"Priority Timeline","dashboard.no_run_selected":"No run selected.","dashboard.open_full_run_workspace":"Open full run workspace","dashboard.open_all_runs":"Open all workflow runs","dashboard.status.blocked":"blocked","dashboard.scene.operator":"Operator Brief","dashboard.scene.error":"Dashboard telemetry is degraded. Check the run rail and logs before committing to the next action.","dashboard.scene.selected_run":"{workflow} is {status}. {completed}/{total} steps are complete.","dashboard.scene.run_failed":"{workflow} needs attention: {failed} steps failed, with {completed}/{total} steps complete.","dashboard.scene.active_overview":"{active} runs are active across {definitions} workflow definitions.","dashboard.scene.idle_overview":"No run is selected. {definitions} definitions are ready, with {total} total runs recorded.","workflows.kicker":"Orchestration Center","workflows.title":"Workflows","workflows.create":"Create Workflow","workflows.workflow_info":"v{version} · {steps} nodes · {runs} runs","workflows.workflow_info_short":"v{version} · {steps} nodes","workflows.status.off":"Off","workflows.status.ready":"Ready","workflows.tab.definition":"Definition","workflows.tab.runs":"Runs","workflows.loading":"Loading workflows…","workflows.empty_title":"No workflows yet","workflows.empty_desc":"Create your first workflow to get started.","workflows.definition_unavailable_title":"Workflow definition unavailable","workflows.definition_unavailable_desc":"The runtime returned an empty definition for this workflow — the graph can't be rendered. This is a backend data issue and needs to be fixed upstream.","workflows.no_runs_title":"No runs yet","workflows.no_runs_desc":"Run this workflow to see execution state.","workflows.open_node_in_runs":"Open node in runs","workflows.select_dag_node":"Select a node in the DAG.","workflows.run_step":"Run Step","workflows.select_dag_node_step":"Select a DAG node to inspect the step.","workflows.save_failure":"Failed to save workflow","workflows.save_failure_dot":"Failed to save workflow.","workflows.run_failure":"Failed to start workflow run","workflows.status_failure":"Failed to change workflow status","workflows.status_failure_dot":"Failed to change workflow status.","workflows.delete_failure":"Failed to delete workflow","workflows.delete_failure_dot":"Failed to delete workflow.","workflows.toast.updated":'Workflow "{name}" updated.',"workflows.toast.created":'Workflow "{name}" created.',"workflows.toast.reenabled":'Re-enabled workflow "{name}".',"workflows.toast.deprecated":'Deprecated workflow "{name}".',"workflows.toast.deleted":'Workflow "{name}" deleted.',"workflows.toast.run_started":'Workflow "{name}" started (run {runId}).',"workflows.run_option":"{prefix} — {status} ({completed}/{total})","workflows.copy_suffix":"Copy","doctor.kicker":"Inspection","doctor.title":"Doctor","doctor.description":"Run runtime diagnostics and inspect grouped health findings across the Revka stack.","doctor.run":"Run Diagnostics","doctor.running":"Running…","doctor.failed_title":"Diagnostics failed","doctor.loading_title":"Running system diagnostics…","doctor.loading_desc":"Checking runtime components, configuration, and operational health.","doctor.health_summary":"Health Summary","doctor.passing":"Passing","doctor.warnings":"Warnings","doctor.failures":"Failures","doctor.run_context":"Run Context","doctor.context_p1":"The doctor is strongest when it behaves like an inspection board, not a terminal dump. This panel highlights overall posture first, then breaks findings into subsystem groups.","doctor.context_p2":"Use the category boards to identify where warnings cluster before diving into individual messages.","doctor.subsystem_boards":"Subsystem Boards","doctor.checks":"{count} checks","doctor.ok":"ok","doctor.warn":"warn","doctor.fail":"fail","doctor.system_diag_title":"System diagnostics","doctor.system_diag_desc":"Run the doctor to inspect warnings, failures, and all-clear checks in the Revka shell.","doctor.run_failed":"Failed to run diagnostics","cost.kicker":"Operations","cost.title":"Cost","cost.error_title":"Unable to load cost data","cost.loading_title":"Loading cost data…","cost.spend_posture":"Spend Posture","cost.session_cost":"Session Cost","cost.daily_cost":"Daily Cost","cost.monthly_cost":"Monthly Cost","cost.requests":"Requests","cost.token_efficiency":"Token Efficiency","cost.total_tokens":"Total Tokens","cost.avg_tokens":"Avg Tokens / Request","cost.cost_per_1k":"Cost / 1K Tokens","cost.model_workspace":"Model Workspace","cost.spend_by_model":"Spend by model","cost.no_model_data":"No model data","cost.no_model_data_desc":"Model-level spend appears after requests have been recorded.","cost.tokens_label":"{count} tokens","cost.requests_label":"{count} requests","cost.share_label":"{share}% of monthly spend","cost.selected_model":"Selected Model","cost.no_model_selected":"No model selected","cost.no_model_selected_desc":"Choose a model from the workspace to inspect spend concentration and efficiency.","cost.monthly_spend":"Monthly Spend","cost.tokens":"Tokens","cost.share_monthly":"Share of Monthly Spend","cost.interpretation":"Interpretation","cost.interp_p1":"Large monthly-share values indicate cost concentration around a single model family.","cost.interp_p2":"High tokens per request with low request counts usually points to long-context or generation-heavy workflows.","logs.kicker":"Inspection","logs.title":"Logs","logs.description":"Tail of the Revka daemon stderr log. Runtime agent events live on the Audit page.","logs.pause":"Pause","logs.resume":"Resume","logs.jump_to_bottom":"Jump To Bottom","logs.stream_status":"Stream Status","logs.connected":"Connected","logs.disconnected":"Disconnected","logs.visible_lines":"{count} visible lines. Tailing ~/.revka/logs/daemon.stderr.log.","logs.event_filters":"Event Filters","logs.no_event_types":"No event types yet","logs.no_event_types_desc":"Filters appear after the stream receives activity.","logs.clear_filters":"Clear Filters","logs.live_event_feed":"Live Event Feed","logs.no_events":"No events yet","logs.no_events_desc":"Agent activity will stream here once the SSE feed receives runtime events.","tools.kicker":"Operations","tools.title":"Tools","tools.description":"Agent-facing tool catalog and host CLI binaries the runtime can shell out to.","tools.reload":"Reload","tools.search_placeholder":"Search tools by name, description, or category…","tools.loading":"Loading tools…","tools.agent_tools_count":"Agent Tools · {count}","tools.no_matches":"No matches","tools.no_agent_tools":"No agent tools registered","tools.try_different":"Try a different search term.","tools.agent_tools_empty_desc":"Agent tools will appear once the runtime registers them.","tools.parameter_schema":"Parameter Schema","tools.cli_tools_count":"CLI Tools · {count}","tools.no_cli_tools":"No CLI tools detected","tools.cli_tools_empty_desc":"Revka probes common CLI binaries at startup. Install one and reload.","tools.col.name":"Name","tools.col.path":"Path","tools.col.version":"Version","tools.col.category":"Category","tools.failed_load":"Failed to load tools: {message}","audit.kicker":"Inspection","audit.title":"Audit","audit.description":"Trust-chain verification, event review, and security posture for operational actions.","audit.refresh":"Refresh","audit.verify_chain":"Verify Chain","audit.disabled_title":"Audit trail is disabled","audit.disabled_desc":"Enable audit recording to inspect approval, policy, and security events here.","audit.filters":"Filters","audit.all_event_types":"All event types","audit.event.command_execution":"Command Execution","audit.event.file_access":"File Access","audit.event.config_change":"Config Change","audit.event.auth_success":"Auth Success","audit.event.auth_failure":"Auth Failure","audit.event.policy_violation":"Policy Violation","audit.event.security_event":"Security Event","audit.chain_verified":"Chain verified","audit.chain_invalid":"Chain invalid","audit.entries_verified":"{count} entries verified.","audit.stream_title":"Audit Event Stream","audit.stream_subtitle":"Recorded actions and approvals","audit.loading":"Loading audit events…","audit.empty_title":"No audit events","audit.empty_desc":"Recorded events will appear here once actions or approvals are emitted.","audit.col.sequence":"Sequence","audit.col.action":"Action","audit.col.result":"Result","audit.col.hash":"Hash","audit.result_success":"Success","audit.result_recorded":"Recorded","audit.policy_violation_badge":"Policy violation","audit.time.seconds_ago":"{n}s ago","audit.time.minutes_ago":"{n}m ago","audit.time.hours_ago":"{n}h ago","audit.time.days_ago":"{n}d ago","integrations.kicker":"Operations","integrations.title":"Integrations","integrations.loading":"Loading integrations…","integrations.coverage":"Coverage","integrations.metric.active":"Active","integrations.metric.available":"Available","integrations.metric.coming_soon":"Coming Soon","integrations.categories":"Categories","integrations.category_all":"all","integrations.workspace":"Integration Workspace","integrations.all_integrations":"All integrations","integrations.category_integrations":"{category} integrations","integrations.empty_title":"No integrations","integrations.empty_desc":"No integrations matched the current category filter.","integrations.badge.active":"Active","integrations.badge.available":"Available","integrations.badge.coming_soon":"Coming Soon","integrations.selected":"Selected Integration","integrations.no_selected_title":"No integration selected","integrations.no_selected_desc":"Choose an integration from the workspace to inspect its rollout posture.","integrations.detail.category":"Category","integrations.detail.status":"Status","integrations.detail.operational_readiness":"Operational Readiness","integrations.readiness.active":"Already active in the runtime.","integrations.readiness.available":"Available to enable when the operator is ready.","integrations.readiness.coming_soon":"Planned surface that is not ready to activate yet.","integrations.legend":"Status Legend","integrations.legend.p1":"`Active` integrations are already wired into runtime workflows.","integrations.legend.p2":"`Available` integrations are installable or connectable from the current build.","integrations.legend.p3":"`Coming Soon` integrations are planned but not yet ready for operators.","pairing.kicker":"Operations","pairing.title":"Pairing","pairing.description":"Issue pairing codes, render a QR for mobile enrolment, and manage trusted devices.","pairing.reload":"Reload","pairing.pair_new_device":"Pair New Device","pairing.generating":"Generating…","pairing.active_code":"Active Pairing Code","pairing.rendering":"Rendering…","pairing.code_hint":"Scan the QR with the Revka companion app, or enter the 6-digit code on the paired device. Codes expire when a device completes enrolment or when you generate a new one.","pairing.copy_code":"Copy Code","pairing.rotate":"Rotate","pairing.cli_device_name":"CLI device name","pairing.cli_hardware":"Hardware","pairing.cli_hardware_placeholder":"Optional platform label","pairing.mint_cli_token":"Mint CLI Token","pairing.minting_token":"Minting…","pairing.minted_token":"Minted Bearer Token","pairing.copy_token":"Copy Token","pairing.no_code_title":"No active pairing code","pairing.no_code_desc":'Press "Pair New Device" to generate a fresh code and QR. Codes are short-lived and intended for a single enrolment.',"pairing.how_to_scan":"How to scan","pairing.scan_step1":"Open the Revka companion app on the new device.","pairing.scan_step2_prefix":"Choose ","pairing.scan_step2_action":"Pair with hub","pairing.scan_step2_suffix":".","pairing.scan_step3":"Scan the QR or type the 6-digit code manually.","pairing.scan_step4":"The device appears in the list below once enrolment completes.","pairing.paired_devices":"Paired Devices · {count}","pairing.loading_devices":"Loading devices…","pairing.no_devices_title":"No devices paired yet","pairing.no_devices_desc":"Paired devices will appear here after a successful enrolment.","pairing.col.name":"Name","pairing.col.type":"Type","pairing.col.hardware":"Hardware","pairing.col.paired":"Paired","pairing.col.last_seen":"Last Seen","pairing.col.ip":"IP","pairing.col.actions":"Actions","pairing.unnamed":"Unnamed","pairing.unknown":"Unknown","pairing.device_type.api_client":"API Client","pairing.device_type.browser":"Browser","pairing.device_type.cli":"CLI","pairing.device_type.mobile":"Mobile","pairing.device_type.tablet":"Tablet","pairing.revoke":"Revoke?","pairing.yes":"Yes","pairing.no":"No","pairing.revoke_title":"Revoke device","pairing.toast.code_generated":"New pairing code generated.","pairing.toast.code_copied":"Code copied.","pairing.toast.token_minted":"Bearer token minted. Copy it now.","pairing.toast.token_copied":"Token copied.","pairing.toast.copy_failed":"Copy failed. Select it manually.","pairing.toast.device_revoked":"Device revoked.","pairing.err.load_devices":"Failed to load devices","pairing.err.gen_code":"Failed to generate pairing code","pairing.err.mint_token":"Failed to mint bearer token","pairing.err.revoke":"Failed to revoke device","cron.kicker":"Operations","cron.description":"Scheduled jobs, catch-up behaviour, and recent run history.","cron.reload":"Reload","cron.startup_behaviour":"Startup Behaviour","cron.catch_up_title":"Catch up missed jobs on startup","cron.catch_up_desc":"Run all overdue jobs when Revka starts after downtime.","cron.loading_jobs":"Loading scheduled jobs…","cron.no_jobs_title":"No scheduled jobs","cron.no_jobs_desc":"Add a cron job to run commands on a schedule.","cron.col.id":"ID","cron.col.name":"Name","cron.col.command":"Command","cron.col.next_run":"Next Run","cron.col.last_status":"Last Status","cron.col.enabled":"Enabled","cron.col.actions":"Actions","cron.enabled_badge":"Enabled","cron.disabled_badge":"Disabled","cron.toggle_history":"Toggle run history","cron.confirm":"Confirm?","cron.history.loading":"Loading run history…","cron.history.error_title":"Unable to load run history","cron.history.retry":"Retry","cron.history.no_runs_title":"No runs yet","cron.history.no_runs_desc":"This job hasn’t executed since it was created.","cron.history.refresh":"Refresh","cron.history.recent":"Recent runs · {count}","cron.history.refresh_title":"Refresh runs","cron.modal.edit_title":"Edit Cron Job","cron.modal.add_title":"Add Cron Job","cron.modal.description":"Name is optional. Schedule uses standard cron expressions.","cron.form.name":"Name","cron.form.optional":"(optional)","cron.form.name_placeholder":"e.g. Daily cleanup","cron.form.schedule":"Schedule","cron.form.command":"Command","cron.form.command_placeholder":"e.g. cleanup --older-than 7d","cron.form.cancel":"Cancel","cron.form.saving":"Saving…","cron.form.adding":"Adding…","cron.form.save":"Save","cron.err.load":"Failed to load jobs: {message}","cron.err.settings":"Failed to update settings","cron.err.save":"Failed to save job","cron.err.delete":"Failed to delete job","cron.err.form_required":"Schedule and command are required.","cron.toast.updated":"Updated “{name}”.","cron.toast.added":"Added “{name}”.","cron.toast.deleted":"Job deleted.","canvas.kicker":"Orchestration Center","canvas.title":"Canvas","canvas.reconnect":"Reconnect","canvas.control":"Canvas Control","canvas.connected":"Connected","canvas.disconnected":"Disconnected","canvas.canvas_id_placeholder":"Canvas ID","canvas.switch":"Switch","canvas.clear":"Clear","canvas.available":"Available Canvases","canvas.loading_list":"Loading canvases…","canvas.loading_list_desc":"Polling the live canvas registry.","canvas.no_active_title":"No active canvases","canvas.no_active_desc":"Canvas IDs will appear here once an agent or workflow pushes a frame.","canvas.active":"Active","canvas.viewport":"Canvas Viewport","canvas.live_output":"Live frame output","canvas.canvas_label":"Canvas","canvas.connection":"Connection","canvas.live":"Live","canvas.offline":"Offline","canvas.frame_type":"Frame Type","canvas.last_update":"Last Update","canvas.waiting_label":"Waiting for frame","canvas.frame_suffix":"frame","canvas.waiting_for_content":'Waiting for content on "{id}"',"canvas.waiting_for_content_desc":"The agent can push content here using the canvas tool. Once a frame arrives it will render immediately in this viewport.","canvas.disconnected_title":"Canvas socket disconnected","canvas.disconnected_desc":"Reconnect to the current canvas or switch to another live canvas ID.","canvas.reconnect_button":"Reconnect Canvas","canvas.frame_id":"Frame ID","canvas.guidance":"Canvas Guidance","canvas.guidance_desc":"Use the assistant to generate charts, diagrams, markdown reports, and HTML dashboards directly into this viewport.","canvas.history":"Frame History","canvas.hide":"Hide","canvas.show":"Show","canvas.history_collapsed_title":"History collapsed","canvas.history_collapsed_desc":"Expand this rail to inspect previous frames on the active canvas.","canvas.no_frames_title":"No frames yet","canvas.no_frames_desc":"As frames arrive they will be stored here for quick backtracking.","skills.kicker":"Operations","skills.title":"Skills","skills.create_skill":"Create Skill","skills.registry_status":"Registry Status","skills.summary.total":"Total","skills.summary.active":"Active","skills.summary.deprecated":"Deprecated","skills.summary.domains":"Domains","skills.index":"Skill Index","skills.search_placeholder":"Search skills…","skills.loading":"Loading skills…","skills.no_skills_title":"No skills found","skills.no_skills_desc":"Create a local skill to start populating the operational registry.","skills.status.active":"Active","skills.status.deprecated":"Deprecated","skills.workspace":"Skill Workspace","skills.select_placeholder":"Select a skill","skills.description":"Description","skills.content":"Skill Content","skills.content_empty":"This skill has no content to display.","skills.edit":"Edit","skills.reenable":"Re-enable","skills.deprecate":"Deprecate","skills.deleting":"Deleting…","skills.delete":"Delete","skills.no_selected_title":"No skill selected","skills.no_selected_desc":"Select a skill to inspect its content and operational metadata.","skills.install_github":"Install from GitHub","skills.install_github_desc":"Paste a GitHub repository URL to install a skill directly.","skills.github_placeholder":"https://github.com/org/skill-repo","skills.installing":"Installing…","skills.install":"Install","skills.marketplace":"Marketplace","skills.marketplace_shown":"{count} shown","skills.marketplace_placeholder":"Search ClawHub skills…","skills.search":"Search","skills.trending":"Trending","skills.marketplace_loading":"Loading marketplace…","skills.marketplace_empty":"No marketplace results","skills.modal.edit_title":"Edit Skill","skills.modal.create_title":"Create Skill","skills.modal.description":"Skills are reusable operational capabilities that can be attached to agents and runs.","skills.modal.name_placeholder":"Skill name","skills.modal.description_placeholder":"Description","skills.modal.tags_placeholder":"comma,separated,tags","skills.modal.content_placeholder":"Skill markdown content","skills.modal.cancel":"Cancel","skills.modal.saving":"Saving…","skills.modal.save_skill":"Save Skill","skills.toast.updated":'Skill "{name}" updated.',"skills.toast.created":'Skill "{name}" created.',"skills.toast.reenabled":'Re-enabled skill "{name}".',"skills.toast.deprecated":'Deprecated skill "{name}".',"skills.toast.deleted":'Skill "{name}" deleted.',"skills.toast.installed":'Installed skill "{name}".',"skills.toast.installed_github":'Installed skill "{name}" from GitHub.',"skills.err.save":"Failed to save skill.","skills.err.load_detail":"Failed to load skill content.","skills.err.toggle":"Failed to change skill status.","skills.err.delete":"Failed to delete skill.","skills.err.install":"Failed to install marketplace skill.","skills.err.install_github":"Failed to install skill from GitHub URL.","teams.kicker":"Orchestration Center","teams.title":"Teams","teams.create":"Create Team","teams.refresh":"Refresh","teams.count":"{count} teams","teams.agent_count":"{count} agents","teams.loading":"Loading…","teams.loading_desc":"Loading teams…","teams.empty_title":"No teams","teams.empty_desc":"Create a team to start.","teams.none_selected_title":"No team selected","teams.none_selected_desc":"Select a team from the index.","teams.members_suffix":"{members} members · {edges} edges","teams.status.off":"Off","teams.status.live":"Live","teams.status.deprecated":"Deprecated","teams.status.active":"Active","teams.action.edit":"Edit","teams.action.reenable":"Re-enable","teams.action.deprecate":"Deprecate","teams.action.delete":"Delete","teams.stats.members":"Members","teams.stats.edges":"Edges","teams.stats.status":"Status","teams.tab.summary":"Summary","teams.tab.member":"Member","teams.open_agent_registry":"Open agent registry","teams.modal.edit_title":"Edit Team","teams.modal.create_title":"Create Team","teams.modal.description":"The team editor now handles identity, composition, and core reporting/dependency edges directly in the new shell.","teams.form.name":"Team Name","teams.form.description":"Description","teams.form.members":"Members","teams.form.topology_preview":"Topology Preview","teams.form.edge_authoring":"Edge Authoring","teams.form.from_member":"From member","teams.form.to_member":"To member","teams.form.edge_reports_to":"Reports To","teams.form.edge_supports":"Supports","teams.form.edge_depends_on":"Depends On","teams.form.add_edge":"Add Edge","teams.form.remove":"Remove","teams.form.no_edges":"No topology edges defined yet.","teams.form.draft_summary":"Draft Summary","teams.form.draft_members":"Members","teams.form.draft_edges":"Edges","teams.form.draft_hint":"Use `REPORTS_TO` for hierarchy, `SUPPORTS` for collaboration lanes, and `DEPENDS_ON` for blocking execution relationships.","teams.form.draft_team_name":"Draft Team","teams.form.cancel":"Cancel","teams.form.saving":"Saving…","teams.form.save":"Save Team","teams.toast.updated":'Team "{name}" updated.',"teams.toast.created":'Team "{name}" created.',"teams.toast.deleted":'Team "{name}" deleted.',"teams.toast.reenabled":'Re-enabled team "{name}".',"teams.toast.deprecated":'Deprecated team "{name}".',"teams.err.save":"Failed to save team.","teams.err.toggle":"Failed to change team status.","teams.err.delete":"Failed to delete team.","agents.kicker":"Orchestration Center","agents.title":"Agents","agents.create":"Create Agent","agents.refresh":"Refresh","agents.search_placeholder":"Search agents…","agents.filter.all_roles":"All roles","agents.filter.coder":"Coder","agents.filter.reviewer":"Reviewer","agents.filter.researcher":"Researcher","agents.filter.hide_disabled":"Hide Disabled","agents.filter.show_disabled":"Show Disabled","agents.count":"{count} agents","agents.loading":"Loading…","agents.loading_desc":"Loading agents…","agents.empty_title":"No agents","agents.empty_desc":"Adjust filters or create one.","agents.none_selected_title":"No agent selected","agents.none_selected_desc":"Select an agent from the index.","agents.status.disabled":"Disabled","agents.status.active":"Active","agents.stats.registry":"Registry","agents.stats.active":"Active","agents.stats.codex":"Codex","agents.section.identity":"Identity","agents.section.soul":"Soul","agents.section.soul_empty":"No soul description provided.","agents.section.expertise":"Expertise","agents.section.no_expertise":"No expertise tags.","agents.section.voice":"Voice","agents.section.voice_empty":"Not specified","agents.section.revision":"Revision","agents.section.created":"Created","agents.action.edit":"Edit","agents.action.reenable":"Re-enable","agents.action.deprecate":"Deprecate","agents.action.delete":"Delete","agents.action.deleting":"Deleting…","agents.tab.summary":"Summary","agents.tab.prompt":"Prompt","agents.summary.name":"Name","agents.summary.role":"Role","agents.summary.type":"Type","agents.summary.model":"Model","agents.summary.model_default":"Default","agents.summary.tone":"Tone","agents.summary.revision":"Revision","agents.summary.created":"Created","agents.prompt.system_hint":"System Hint","agents.prompt.system_hint_empty":"No system hint configured.","agents.prompt.identity_seed":"Identity Seed","agents.modal.create_title":"Create Agent","agents.modal.edit_title":"Edit Agent","agents.modal.description":"Agents are identity-driven operators. Revka keeps the persona, model, and prompting surface in one place.","agents.form.name":"Name","agents.form.tone":"Tone","agents.form.tone_placeholder":"concise and direct","agents.form.identity":"Identity","agents.form.soul":"Soul","agents.form.role":"Role","agents.form.role.coder":"Coder","agents.form.role.reviewer":"Reviewer","agents.form.role.researcher":"Researcher","agents.form.agent_type":"Agent Type","agents.form.model":"Model","agents.form.model_placeholder":"gpt-5.4 / claude-sonnet-4-6","agents.form.expertise":"Expertise","agents.form.expertise_placeholder":"rust, review, orchestration","agents.form.system_hint":"System Hint","agents.form.cancel":"Cancel","agents.form.saving":"Saving…","agents.form.save_create":"Create Agent","agents.form.save_edit":"Save Agent","agents.toast.updated":'Agent "{name}" updated.',"agents.toast.created":'Agent "{name}" created.',"agents.toast.deleted":'Agent "{name}" deleted.',"agents.toast.reenabled":'Re-enabled agent "{name}".',"agents.toast.deprecated":'Deprecated agent "{name}".',"agents.err.load":"Failed to load agents.","agents.err.save":"Failed to save agent.","agents.err.toggle":"Failed to change agent status.","agents.err.delete":"Failed to delete agent.","runs.kicker":"Orchestration Center","runs.title":"Workflow Runs","runs.refresh":"Refresh","runs.index.title":"Run Index","runs.empty.title":"No runs","runs.empty.desc":"Execute a workflow to populate this index.","runs.error.title":"Load error","runs.stats.steps_fraction":"{completed}/{total} steps","runs.stats.expanded_steps":"{count} expanded","runs.stats.loop_fraction":"Loop {iteration}/{total}: {step}","runs.stats.loop_iteration":"Loop {iteration}: {step}","runs.open_definition":"Open definition","runs.action.retry_failed":"Retry failed","runs.action.retrying":"Retrying…","runs.action.retry_tooltip":"Retry failed steps","runs.action.stop":"Stop","runs.action.stopping":"Stopping…","runs.action.stop_tooltip":"Stop this run instance","runs.action.delete_tooltip":"Delete run","runs.none_selected.title":"No run selected","runs.none_selected.desc":"Choose a run from the index.","runs.banner.label":"Active Selection","runs.overlay.path_mode":"Path Mode","runs.overlay.path.all":"All","runs.overlay.path.failed":"Failed","runs.overlay.path.blocked":"Blocked","runs.overlay.signals":"Signals","runs.overlay.prev":"Prev","runs.overlay.next":"Next","runs.overlay.signal_count":"{count} signals","runs.overlay.posture":"Posture","runs.overlay.running":"Running","runs.overlay.failed":"Failed","runs.overlay.done":"Done","runs.overlay.pending":"Pending","runs.overlay.skipped":"Skipped","runs.overlay.hotspots":"Hotspots","runs.overlay.legend_running":"Running","runs.overlay.legend_failure":"Failure","runs.overlay.legend_blocked":"Blocked","runs.overlay.legend_skipped":"Skipped","runs.overlay.legend_gate":"Gate","runs.overlay.fail_label":"Fail: {id}","runs.overlay.run_label":"Run: {id}","runs.overlay.block_label":"Block: {id}","runs.started_at":"Started {time}","runs.inspector.title":"Step Inspector","runs.tab.summary":"Summary","runs.tab.output":"Output","runs.tab.tools":"Tools","runs.tab.transcript":"Transcript","runs.tab.jsonl":"JSONL Log","runs.detail.select_node":"Select a DAG node to inspect.","runs.detail.no_description":"No description.","runs.detail.depends_on":"Depends on: {list}","runs.detail.depends_none":"none","runs.detail.agent":"Agent: {type}{role}","runs.detail.agent_na":"n/a","runs.detail.skills":"Skills: {list}","runs.detail.dashboard_link":"Dashboard","runs.detail.definition_link":"Definition","runs.detail.select_step":"Select a step.","runs.detail.step_output":"Step Output","runs.detail.agent_output":"Agent Output","runs.detail.no_output":"No output captured.","runs.detail.loading":"Loading…","runs.detail.tools_calls":"Calls","runs.detail.tools_errors":"Errors","runs.detail.no_tools":"No tool calls recorded.","runs.detail.no_activity":"No agent activity available.","runs.detail.no_jsonl":"No JSONL entries found for this agent.","runs.detail.no_jsonl_filter":"No entries match your filter.","runs.detail.no_transcript":"No transcript available.","runs.detail.tool_default":"Tool","runs.detail.tool_status_ok":"ok","runs.timeline":"Timeline ({count})","runs.toast.retry_started":"Run {id} retry started.","runs.toast.stop_requested":"Stop requested for run {id}.","runs.toast.deleted":"Run {id} deleted.","runs.err.retry":"Failed to retry run.","runs.err.stop":"Failed to stop run.","runs.err.delete":"Failed to delete run.","memory.kicker":"Inspection","memory.page_title":"Memory","memory.page_description":"Memory graph inspection with kind filters, space scoping, search highlighting, and node-linked detail drilldown.","memory.selected_memory":"Selected Memory","memory.loading_detail":"Loading node details…","memory.relative.just_now":"just now","memory.relative.minutes":"{count}m ago","memory.relative.hours":"{count}h ago","memory.relative.days":"{count}d ago","memory.detail.metadata":"Metadata","memory.detail.bundle_members":"Bundle Members","memory.controls.title":"Graph Controls","memory.controls.search_placeholder":"Highlight memories…","memory.controls.all_spaces":"All spaces","memory.controls.node_limit":"Node limit","memory.filters.title":"Filters","memory.filters.empty_title":"No kinds loaded yet","memory.filters.empty_desc":"Graph filters will appear once memory data is available.","memory.graph.kicker":"Memory Graph","memory.graph.heading":"Semantic memory topology","memory.graph.items":"items","memory.graph.edges":"edges","memory.graph.shown":"shown","memory.graph.matches":"{count} matches","memory.graph.match":"{count} match","memory.graph.loading_title":"Loading memory graph…","memory.graph.loading_desc":"Fetching semantic memory topology and relationship edges.","memory.graph.error_title":"Unable to load memory graph","memory.graph.retry":"Retry","memory.graph.empty_title":"No memories found","memory.graph.empty_desc":"Adjust filters, clear search, or increase the node limit to broaden the graph.","memory.none_selected_title":"No memory selected","memory.none_selected_desc":"Select a node in the graph to inspect metadata, revision-backed detail, and bundle membership.","memory.err.load":"Failed to load memory graph","assets.kicker":"Operations","assets.title":"Assets","assets.search_placeholder":"Search assets…","assets.project":"Project","assets.up":"Up","assets.err.load":"Failed to load Kumiho projects. Check that the Kumiho API is reachable.","assets.col.name":"Name","assets.col.kind":"Kind","assets.col.author":"Author","assets.col.created":"Created","assets.loading.projects":"Loading projects…","assets.loading.space":"Loading space…","assets.loading.generic":"Loading…","assets.folder":"folder","assets.empty.title":"Empty space","assets.empty.desc":"No folders or assets in this location.","assets.search.empty_title":"No results","assets.search.empty_desc":'No assets match "{query}".',"assets.search.result_count":'{count} results for "{query}"',"assets.copy_kref":"Copy kref","assets.close_inspector":"Close inspector","assets.deprecated":"Deprecated","assets.active":"Active","assets.rev_count":"{count} revs","assets.rev_count_one":"{count} rev","assets.by":"by {author}","assets.section.revisions":"Revisions","assets.section.artifacts":"Artifacts","assets.section.edges":"Edges","assets.section.metadata":"Metadata","assets.section.revisions_empty":"No revisions.","assets.section.artifacts_empty":"No artifacts.","assets.section.edges_empty":"No edges.","assets.section.metadata_empty":"No metadata.","assets.tag.latest":"latest","assets.tag.published":"published","assets.action.view":"View","assets.action.edit":"Edit","assets.action.restore":"Restore","assets.action.deprecate":"Deprecate","assets.action.publish":"Publish","assets.action.published":"Published","assets.action.save_artifact":"Save artifact","assets.action.deprecate_item":"Deprecate selected item","assets.action.restore_item":"Restore selected item","assets.action.deprecate_revision":"Deprecate selected revision","assets.action.restore_revision":"Restore selected revision","assets.action.publish_revision":"Tag selected revision as published","assets.action.edit_artifact":"Edit artifact","assets.action.deprecate_artifact":"Deprecate artifact","assets.action.restore_artifact":"Restore artifact","assets.toast.item_deprecated":"Item deprecated.","assets.toast.item_restored":"Item restored.","assets.toast.revision_deprecated":"Revision deprecated.","assets.toast.revision_restored":"Revision restored.","assets.toast.revision_published":"Revision tagged published.","assets.toast.artifact_deprecated":"Artifact deprecated.","assets.toast.artifact_restored":"Artifact restored.","assets.toast.artifact_saved":"Artifact content updated.","assets.toast.artifact_saved_new_revision":"Created a new revision with the updated artifact attached.","assets.err.action":"Asset action failed.","assets.err.load_artifact":"Failed to load artifact content.","assets.editor.title":"Edit {name}","assets.editor.mutable_desc":"Saving updates the artifact file on the current revision.","assets.editor.published_desc":"This revision is published and immutable. Saving creates a new revision with the updated artifact attached.","config.kicker":"Operations","config.page_title":"Config","config.reload":"Reload","config.save_button":"Save Config","config.saving_button":"Saving…","config.loading_title":"Loading configuration…","config.toast.saved":"Configuration saved.","config.err.load":"Failed to load config.","config.err.save":"Failed to save config.","config.err.mcp_errors":"Fix MCP server errors before saving.","config.map":"Config Map","config.workspace":"TOML Workspace","config.workspace.structured_heading":"Structured controls","config.workspace.source_heading":"Source editor","config.tab.structured":"Structured","config.tab.source":"Source","config.tabs_aria":"Config workspace tabs","config.hide_preview":"Hide Preview","config.show_preview":"Show Preview","config.mapped_paths":"Mapped TOML Paths","config.structured.error_title":"Unable to build structured controls","config.structured.error_desc":"The raw TOML needs to be parseable before the grouped config controls can be shown.","config.summary.title":"Parsed Summary","config.summary.error_title":"Unable to parse TOML","config.summary.error_desc":"The summary panel only updates when the editor contains parseable TOML sections.","config.source_health":"Source Health","config.row.workspace_mode":"Workspace Mode","config.row.preview":"Preview","config.row.sections":"Sections","config.row.parse_status":"Parse Status","config.row.parse_valid":"Valid","config.row.parse_needs":"Needs Attention","config.mode.structured":"Structured","config.mode.source":"Source","config.toggle.enabled":"Enabled","config.toggle.disabled":"Disabled","config.section.provider":"Provider","config.section.provider_desc":"Default model provider, API routing, and generation tuning.","config.section.agent":"Agent","config.section.agent_desc":"Loop limits, context budgets, and reasoning defaults for the agent runtime.","config.section.memory":"Memory","config.section.memory_desc":"Memory backend, Kumiho wiring, and persistence behavior.","config.section.runtime":"Runtime","config.section.runtime_desc":"Gateway bind settings, pairing, and autonomy posture.","config.section.security":"Security / Cost","config.section.security_desc":"Audit and sandbox settings plus cost limit controls.","config.section.channels":"Channels","config.section.channels_desc":"CLI and messaging surface behavior for operational channels.","config.section.mcp":"MCP Servers","config.section.mcp_desc":"Model Context Protocol client — top-level toggles and structured server entries.","config.section.extra_desc":"Additional section discovered in config.toml — generic editor.","config.generic.empty":"No fields in this section yet.","config.generic.empty_array":"(empty array)","config.generic.array_readonly":"Arrays are read-only in the generic editor — edit via the Source tab.","config.provider.default_provider":"Default Provider","config.provider.default_model":"Default Model","config.provider.temperature":"Temperature","config.provider.timeout":"Provider Timeout","config.provider.max_tokens":"Provider Max Tokens","config.agent.max_tool_iterations":"Max Tool Iterations","config.agent.max_context_tokens":"Max Context Tokens","config.agent.max_history_messages":"Max History Messages","config.agent.gpt55_context_window":"GPT-5.5 Context Window","config.agent.context_window_safety_ratio":"Context Safety Ratio","config.agent.parallel_tools":"Parallel Tools","config.agent.thinking_level":"Thinking Level","config.memory.kumiho_enabled":"Kumiho Enabled","config.memory.memory_project":"Memory Project","config.memory.harness_project":"Harness Project","config.memory.retrieval_limit":"Retrieval Limit","config.memory.backend":"Memory Backend","config.memory.auto_save":"Auto Save","config.memory.snapshots":"Snapshots","config.runtime.gateway_host":"Gateway Host","config.runtime.gateway_port":"Gateway Port","config.runtime.require_pairing":"Require Pairing","config.runtime.session_persistence":"Session Persistence","config.runtime.autonomy_level":"Autonomy Level","config.runtime.max_actions_hour":"Max Actions / Hour","config.security.audit_enabled":"Audit Enabled","config.security.sandbox_backend":"Sandbox Backend","config.security.daily_limit":"Daily Limit USD","config.security.monthly_limit":"Monthly Limit USD","config.security.warn_percent":"Warn At Percent","config.channels.cli":"CLI Channel","config.channels.ack_reactions":"Ack Reactions","config.channels.show_tool_calls":"Show Tool Calls","config.channels.message_timeout":"Message Timeout Seconds","config.summary.api_url":"API URL","config.summary.provider":"Provider","config.summary.model":"Model","config.summary.temperature":"Temperature","config.summary.timeout":"Timeout","config.summary.max_tokens":"Max Tokens","config.summary.runtime":"Runtime","config.summary.gateway":"Gateway","config.summary.pairing_required":"Pairing Required","config.summary.session_persistence":"Session Persistence","config.summary.autonomy_level":"Autonomy Level","config.summary.workspace_only":"Workspace Only","config.summary.max_actions_hour":"Max Actions / Hour","config.summary.memory":"Memory","config.summary.backend":"Backend","config.summary.auto_save":"Auto Save","config.summary.hygiene":"Hygiene","config.summary.snapshots":"Snapshots","config.summary.kumiho_enabled":"Kumiho Enabled","config.summary.memory_project":"Memory Project","config.summary.retrieval_limit":"Retrieval Limit","config.summary.safety_cost":"Safety / Cost","config.summary.audit_enabled":"Audit Enabled","config.summary.sandbox_backend":"Sandbox Backend","config.summary.daily_limit":"Daily Limit","config.summary.monthly_limit":"Monthly Limit","config.summary.warn_percent":"Warn At %","config.summary.channels":"Channels","config.summary.cli":"CLI","config.summary.telegram":"Telegram","config.summary.discord":"Discord","config.summary.slack":"Slack","config.summary.matrix":"Matrix","config.summary.signal":"Signal","config.summary.whatsapp":"WhatsApp","config.row.enabled":"Enabled","config.row.disabled":"Disabled","config.mcp.title":"MCP","config.mcp.enabled":"MCP Enabled","config.mcp.deferred":"Deferred Loading","config.mcp.servers":"Servers","config.mcp.no_servers":"No servers configured yet.","config.mcp.server_count":"{count} servers configured.","config.mcp.server_count_one":"1 server configured.","config.mcp.add_server":"Add MCP Server","config.mcp.confirm_remove":"Remove {label}?","config.mcp.entry_label":"entry {index}","config.mcp.server_default":"Server {index}","config.mcp.stdio_empty":"stdio — no command set","config.mcp.transport_empty":"{transport} — no url set","config.mcp.test":"Test","config.mcp.testing":"Testing…","config.mcp.test_tooltip":"Run MCP initialize + tools/list handshake","config.mcp.test_blocked":"Fix validation errors before testing","config.mcp.delete_label":"Delete {label}","config.mcp.connecting":"connecting…","config.mcp.tool_count":"{count} tools · {latency}ms","config.mcp.tool_count_one":"1 tool · {latency}ms","config.mcp.tools_list":"tools: {list}","config.mcp.handshake_failed":"handshake failed","config.mcp.field_name":"Name","config.mcp.field_name_placeholder":"e.g. memory","config.mcp.field_transport":"Transport","config.mcp.field_command":"Command","config.mcp.field_command_placeholder":"/usr/local/bin/mcp-server","config.mcp.field_args":"Args","config.mcp.field_args_placeholder":"--flag","config.mcp.field_env":"Env","config.mcp.field_env_key":"KEY","config.mcp.field_env_value":"value","config.mcp.field_url":"URL","config.mcp.field_url_placeholder":"https://example.com/mcp","config.mcp.field_headers":"Headers","config.mcp.field_headers_key":"Header-Name","config.mcp.field_headers_value":"value","config.mcp.field_timeout":"Timeout (ms)","config.mcp.field_timeout_placeholder":"30000","config.mcp.add_entry":"Add {label}","config.mcp.remove_entry":"Remove {label} entry {index}","landing.skip_link":"Skip to main content","landing.nav.aria_label":"Site navigation","landing.nav.logo_alt":"Revka logo","landing.nav.features":"Features","landing.nav.launch":"Launch Dashboard","landing.hero.aria_label":"Hero","landing.hero.badge":"Memory-native · Rust-native · Graph-native","landing.hero.tagline":"Memory-native agent runtime","landing.hero.description":"Built on Kumiho's graph-native memory. Every session, plan, skill, and trust score lives in a graph — if it happened, it's queryable.","landing.hero.cta_primary":"Launch Dashboard","landing.hero.cta_secondary":"Explore Features","landing.hero.banner_alt":"Revka — Memory-native agent runtime dashboard","landing.hero.scroll_cue":"Scroll","landing.stats.aria_label":"Key stats","landing.stats.runtime_label":"Runtime","landing.stats.namespaces_label":"Namespaces","landing.stats.memory_label":"Memory graph","landing.stats.goals_label":"Goal tracking","landing.stats.orchestration_label":"Orchestration","landing.pillars.aria_label":"Pillars","landing.pillars.badge":"Three pillars","landing.pillars.title":"One runtime, any surface","landing.pillars.description":"Revka is built on three foundations — provider-agnostic agents, graph-native memory, and any-channel delivery.","landing.pillars.agents.title":"Agents","landing.pillars.agents.desc":"Provider-agnostic agents (OpenAI, Anthropic, local models) orchestrated through workflows and swarms — all on your machine.","landing.pillars.memory.title":"Memory","landing.pillars.memory.desc":"Persistent knowledge across sessions via Kumiho, SQLite, or Markdown. Your agents remember you, your projects, and prior decisions.","landing.pillars.channels.title":"Channels","landing.pillars.channels.desc":"Talk to Revka from Telegram, Discord, Slack, iMessage, Matrix, email, and more. One runtime, any surface.","landing.features.aria_label":"Features","landing.features.badge":"Capabilities","landing.features.title":"Built for the agentic era","landing.features.description":"Every component is designed around persistent memory and multi-agent collaboration — from spawn to retirement.","landing.features.featured_badge":"Core memory foundation","landing.features.memory.title":"Kumiho Memory","landing.features.memory.desc":"Graph-native persistent memory. Every session, plan, and skill is versioned, linked, and queryable—no fallback backends.","landing.features.operator.title":"Operator","landing.features.operator.desc":"Multi-agent orchestration with role delegation (coder, reviewer, researcher), spawn-with-recall, and trust scoring.","landing.features.pool.title":"Agent Pool","landing.features.pool.desc":"Reusable agent definitions with role, capabilities, and model preferences. Usage tracking surfaces high-performers first.","landing.features.clawhub.title":"ClawHub Marketplace","landing.features.clawhub.desc":"Publish, search, and install agent templates, skills, and team configurations in a shared registry.","landing.features.goals.title":"Goal Hierarchy","landing.features.goals.desc":"Three-tier goal tracking: strategic, tactical, and task-level—all persisted in the graph with status and dependencies.","landing.features.audit.title":"Audit Trail","landing.features.audit.desc":"Merkle hash-chain tamper-evident logging. Every action is recorded with cryptographically verifiable history.","landing.how.aria_label":"How it works","landing.how.badge":"Workflow","landing.how.title":"How Revka works","landing.how.description":"From agent deployment to persistent recall — the full lifecycle managed in three cohesive steps.","landing.how.step1.title":"Deploy your agent","landing.how.step1.desc":"Configure role, capabilities, and model preferences. Revka stores the template in the graph for reuse and recall.","landing.how.step2.title":"Memory accumulates","landing.how.step2.desc":"Every session, plan, skill, and interaction is versioned and edge-linked in Kumiho. Nothing is ever lost.","landing.how.step3.title":"Query everything","landing.how.step3.desc":"Use goal hierarchies, trust scores, and graph traversal to surface insights across all agent history.","landing.cli.aria_label":"CLI reference","landing.cli.badge":"CLI","landing.cli.title":"Drive it from the terminal","landing.cli.description":"The daemon must be running for the dashboard and channels to respond. Everything you can do in the UI maps to a command.","landing.cli.cmd.onboard":"Run the interactive setup wizard","landing.cli.cmd.reinit":"Reset and reconfigure from scratch (incl. tunnel)","landing.cli.cmd.daemon":"Start the long-running runtime","landing.cli.cmd.doctor":"Check daemon, scheduler, and channel health","landing.cli.cmd.status":"Print full system status","landing.cli.cmd.channel_list":"List configured channels","landing.cli.cmd.channel_add":"Add a Telegram bot","landing.cli.cmd.providers":"List supported AI providers","landing.cli.cmd.memory_stats":"Inspect agent memory size","landing.cli.cmd.service_install":"Install as a launchd/systemd user service","landing.arch.aria_label":"Architecture","landing.arch.badge":"Graph-native","landing.arch.title":"Everything in the graph","landing.arch.description":"All persistent state lives under a strict namespace hierarchy in Kumiho — versioned, edge-linked, and queryable across sessions.","landing.arch.ns.agentpool":"Reusable agent templates","landing.arch.ns.plans":"Execution plans & steps","landing.arch.ns.sessions":"Cross-session continuity","landing.arch.ns.goals":"Strategic goal tracking","landing.arch.ns.clawhub":"Published templates & skills","landing.arch.ns.teams":"Team definitions","landing.arch.ns.skills":"Shared skill library","landing.arch.ns.trust":"Trust scores & history","landing.arch.connection_note":"All namespaces connected via Kumiho graph edges","landing.tunnels.aria_label":"About tunnels","landing.tunnels.badge":"Tunnels","landing.tunnels.title":"Public reach, local trust","landing.tunnels.description_prefix":"Your gateway runs on ","landing.tunnels.description_suffix":" — only reachable from this machine. Webhook-based channels (Telegram, Slack events, WhatsApp, WeChat) need a public URL. A tunnel forwards a public hostname to your local gateway without opening firewall ports.","landing.tunnels.provider.cloudflare.name":"Cloudflare Tunnel","landing.tunnels.provider.cloudflare.desc":"Free, production-grade. Needs a Zero Trust account and a tunnel token.","landing.tunnels.provider.ngrok.name":"ngrok","landing.tunnels.provider.ngrok.desc":"Quick and ephemeral. Great for local development and testing.","landing.tunnels.provider.tailscale.name":"Tailscale Funnel","landing.tunnels.provider.tailscale.desc":"Share a tailnet service publicly using your tailnet identity.","landing.tunnels.provider.custom.name":"Custom","landing.tunnels.provider.custom.desc":"Bring your own reverse proxy or public URL.","landing.tunnels.setup_hint_prefix":"Run ","landing.tunnels.setup_hint_suffix":" and pick a provider when prompted.","landing.cta.aria_label":"Get started","landing.cta.headline_prefix":"Ready to ","landing.cta.headline_highlight":"start building","landing.cta.headline_suffix":"?","landing.cta.description":"Open the dashboard to manage agents, browse the skill library, orchestrate teams, and explore everything the graph remembers.","landing.cta.button":"Launch Dashboard","landing.footer.tagline":"Memory-native agent runtime"},tr:{"nav.dashboard":"Kontrol Paneli","nav.agent":"Ajan","nav.tools":"Araçlar","nav.cron":"Zamanlanmış Görevler","nav.integrations":"Entegrasyonlar","nav.memory":"Hafıza","nav.config":"Yapılandırma","nav.cost":"Maliyet Takibi","nav.logs":"Kayıtlar","nav.doctor":"Doktor","nav.agents":"Ajan Havuzu","nav.skills":"Beceri Kütüphanesi","nav.teams":"Ajan Takımları","nav.assets":"Varlik Gezgini","nav.skins":"Görünümler","nav.memoryAuditor":"Bellek Denetcisi","nav.audit":"Denetim İzi","nav.canvas":"Tuval","nav.workflows":"Is Akislari","dashboard.title":"Kontrol Paneli","dashboard.provider":"Sağlayıcı","dashboard.model":"Model","dashboard.uptime":"Çalışma Süresi","dashboard.temperature":"Sıcaklık","dashboard.gateway_port":"Ağ Geçidi Portu","dashboard.locale":"Dil","dashboard.memory_backend":"Hafıza Motoru","dashboard.paired":"Eşleştirilmiş","dashboard.channels":"Kanallar","dashboard.health":"Sağlık","dashboard.status":"Durum","dashboard.overview":"Genel Bakış","dashboard.system_info":"Sistem Bilgisi","dashboard.quick_actions":"Hızlı İşlemler","dashboard.provider_model":"Sağlayıcı / Model","dashboard.since_last_restart":"Son Yeniden Başlatmadan Beri","dashboard.paired_yes":"Evet","dashboard.paired_no":"Hayır","dashboard.cost_overview":"Maliyet Genel Bakışı","dashboard.active_channels":"Aktif Kanallar","dashboard.filter_active":"Aktif","dashboard.filter_all":"Tümü","dashboard.no_active_channels":"Aktif kanal yok","dashboard.component_health":"Bileşen Sağlığı","dashboard.load_error":"Kontrol paneli yüklenemedi","dashboard.session_label":"Oturum","dashboard.daily_label":"Günlük","dashboard.monthly_label":"Aylık","dashboard.total_tokens_label":"Toplam Token","dashboard.requests_label":"İstekler","dashboard.by_model":"Modele Göre","dashboard.no_channels":"Kanal yapılandırılmamış","dashboard.active":"Aktif","dashboard.inactive":"Aktif Değil","dashboard.no_components":"Bileşen raporlamıyor","dashboard.restarts":"Yeniden Başlatmalar","dashboard.tab_overview":"Genel Bakış","dashboard.tab_sessions":"Oturumlar","dashboard.tab_channels":"Kanallar","dashboard.tab_audit":"Denetim İzi","dashboard.tab_workflows":"Is Akislari","dashboard.audit_disabled":"Denetim günlüğü etkin değil.","dashboard.audit_all_types":"Tüm Olay Türleri","dashboard.audit_refresh":"Yenile","dashboard.audit_verify_chain":"Zinciri Doğrula","dashboard.audit_chain_valid":"Zincir bütünlüğü doğrulandı","dashboard.audit_chain_invalid":"Zincir bütünlüğü doğrulaması başarısız","dashboard.audit_no_events":"Denetim olayı bulunamadı","dashboard.sessions_title":"Aktif Oturumlar","dashboard.no_sessions":"Aktif oturum yok","dashboard.session_id":"Oturum Kimliği","dashboard.session_channel":"Kanal","dashboard.session_started":"Başlangıç","dashboard.session_last_activity":"Son Etkinlik","dashboard.session_status":"Durum","dashboard.session_messages":"Mesajlar","dashboard.session_details":"Oturum Ayrıntıları","dashboard.session_history":"Geçmişi Görüntüle","dashboard.channels_title":"Kanal Durumu","dashboard.no_channels_detail":"Kanal ayrıntısı yok","dashboard.channel_type":"Tür","dashboard.channel_messages":"Mesajlar","dashboard.channel_last_message":"Son Mesaj","dashboard.channel_config":"Yapılandırma","dashboard.channel_enabled":"Etkin","dashboard.channel_disabled":"Devre Dışı","dashboard.loading_sessions":"Oturumlar yükleniyor...","dashboard.loading_channels":"Kanallar yükleniyor...","dashboard.load_sessions_error":"Oturumlar yüklenemedi","dashboard.load_channels_error":"Kanallar yüklenemedi","dashboard.never":"Hiç","dashboard.tab_clawhub":"ClawHub","dashboard.tab_nodes":"Düğümler","dashboard.clawhub_title":"ClawHub Pazaryeri","dashboard.clawhub_search":"Şablon, yetenek, takım ara…","dashboard.clawhub_no_items":"Öğe bulunamadı. İlk şablonunuzu veya yeteneğinizi yayınlayın!","dashboard.clawhub_publish":"Yayınla","dashboard.clawhub_install":"Yükle","dashboard.clawhub_downloads":"indirme","dashboard.clawhub_by":"yazar","dashboard.nodes_title":"Bağlı Düğümler","dashboard.nodes_no_nodes":"Bağlı düğüm yok. Düğümler WebSocket ile /ws/nodes üzerinden bağlanır.","dashboard.nodes_capabilities":"Yetenekler","dashboard.nodes_invoke":"Çağır","agent.title":"Ajan Sohbeti","agent.send":"Gönder","agent.placeholder":"Bir mesaj yazın...","agent.start_conversation":"Sohbeti başlatmak için mesaj gönderin","agent.type_message":"Bir mesaj yazın...","agent.connecting":"Bağlanıyor...","agent.connected":"Bağlandı","agent.disconnected":"Bağlantı kesildi","agent.reconnecting":"Yeniden bağlanıyor...","agent.thinking":"Düşünüyor...","agent.tool_call":"Araç Çağrısı","agent.tool_result":"Araç Sonucu","agent.connection_error":"Bağlantı hatası. Yeniden bağlanmaya çalışılıyor...","agent.tool_call_prefix":"[Araç Çağrısı]","agent.tool_result_prefix":"[Araç Sonucu]","agent.error_prefix":"[Hata]","agent.unknown_error":"Bilinmeyen hata","agent.send_error":"Mesaj gönderilemedi. Lütfen tekrar deneyin.","agent.copy_message":"Mesajı kopyala","agent.connected_status":"Bağlandı","agent.disconnected_status":"Bağlantı kesildi","agent.copy_code":"Kodu kopyala","agent.copied_code":"Kod kopyalandı","agent.copy":"kopyala","agent.copied":"kopyalandı","agent.code_language_fallback":"kod","agent.jump_to_latest":"En yeniye git","agent.placeholder_steer_next_step":"sonraki adımı yönlendir…","agent.placeholder_queue_next":"sonraki mesajı sıraya al…","agent.placeholder_message":"mesaj…","agent.placeholder_connecting":"bağlanıyor…","agent.send_mode":"Gönderme modu","agent.send_mode_queue":"sıra","agent.send_mode_steer":"yönlendir","agent.queue_after_current_response":"Geçerli yanıttan sonra sıraya al","agent.steer_text_only":"Yönlendirme yalnızca metindir; ekler sıraya alınır","agent.steer_next_step":"Sonraki adımı yönlendir","agent.queue_message":"Mesajı sıraya al","agent.send_message":"Mesaj gönder","agent.send_enter":"Gönder (Enter)","agent.steer_prefix":"[yönlendir]","agent.tool_output_truncated":"Sohbet görünümünde çıktı kısaltıldı; tam sonuç için kopyalayın veya çalışma günlüğünü inceleyin.","agent.activity_input_label":"Girdi","agent.activity_diff_label":"Diff","agent.activity_output_label":"Çıktı","agent.reasoning_trace_label":"Düşünce izi","tools.name":"Ad","tools.parameters":"Parametreler","tools.search":"Araç ara...","tools.empty":"Araç bulunamadı.","tools.count":"Toplam araç","tools.agent_tools":"Ajan Araçları","tools.cli_tools":"CLI Araçları","tools.path":"Yol","tools.version":"Sürüm","tools.category":"Kategori","tools.load_error":"Araçlar yüklenemedi","cron.title":"Zamanlanmış Görevler","cron.scheduled_tasks":"Zamanlanmış Görevler","cron.add":"Görev Ekle","cron.add_job":"Görev Ekle","cron.add_modal_title":"Cron Görevi Ekle","cron.delete":"Sil","cron.enable":"Etkinleştir","cron.disable":"Devre Dışı Bırak","cron.name":"Ad","cron.name_optional":"Ad (isteğe bağlı)","cron.command":"Komut","cron.command_required":"Komut","cron.schedule":"Zamanlama","cron.schedule_required":"Zamanlama","cron.next_run":"Sonraki Çalıştırma","cron.last_run":"Son Çalıştırma","cron.last_status":"Son Durum","cron.enabled":"Etkin","cron.enabled_status":"Etkin","cron.disabled_status":"Devre Dışı","cron.empty":"Zamanlanmış görev bulunamadı.","cron.confirm_delete":"Bu görevi silmek istediğinizden emin misiniz?","cron.load_error":"Cron görevleri yüklenemedi","cron.validation_error":"Zamanlama ve komut gereklidir.","cron.add_error":"Görev eklenemedi","cron.delete_error":"Görev silinemedi","cron.cancel":"İptal","cron.adding":"Ekleniyor...","cron.id":"ID","cron.actions":"İşlemler","cron.loading_run_history":"Çalıştırma geçmişi yükleniyor...","cron.load_run_history_error":"Çalıştırma geçmişi yüklenemedi","cron.no_runs":"Henüz çalıştırma kaydı yok.","cron.recent_runs":"Son Çalıştırmalar","cron.yes":"Evet","cron.no":"Hayır","cron.edit":"Düzenle","cron.edit_modal_title":"Cron Görevini Düzenle","cron.edit_error":"Görev güncellenemedi","cron.saving":"Kaydediliyor...","cron.save":"Kaydet","integrations.available":"Mevcut","integrations.active":"Aktif","integrations.coming_soon":"Yakında","integrations.category":"Kategori","integrations.status":"Durum","integrations.search":"Entegrasyon ara...","integrations.empty":"Entegrasyon bulunamadı.","integrations.activate":"Etkinleştir","integrations.deactivate":"Devre Dışı Bırak","integrations.load_error":"Entegrasyonlar yüklenemedi","integrations.all":"Tümü","integrations.status_active":"Aktif","integrations.status_available":"Mevcut","integrations.status_coming_soon":"Yakında","memory.title":"Hafıza Deposu","memory.memory_title":"Hafıza","memory.search":"Hafıza ara...","memory.search_placeholder":"Hafıza girişleri ara...","memory.add":"Hafıza Ekle","memory.add_memory":"Hafıza Ekle","memory.add_modal_title":"Hafıza Ekle","memory.delete":"Sil","memory.key":"Anahtar","memory.key_required":"Anahtar","memory.content":"İçerik","memory.content_required":"İçerik","memory.category":"Kategori","memory.category_optional":"Kategori (isteğe bağlı)","memory.timestamp":"Zaman Damgası","memory.session":"Oturum","memory.score":"Puan","memory.empty":"Hafıza girişi bulunamadı.","memory.confirm_delete":"Bu hafıza girişini silmek istediğinizden emin misiniz?","memory.all_categories":"Tüm Kategoriler","memory.search_button":"Ara","memory.load_error":"Hafıza yüklenemedi","memory.saving":"Kaydediliyor...","memory.validation_error":"Anahtar ve içerik gereklidir.","memory.store_error":"Hafıza kaydedilemedi","memory.delete_error":"Hafıza silinemedi","memory.delete_confirm":"Sil?","memory.yes":"Evet","memory.no":"Hayır","memory.cancel":"İptal","config.title":"Yapılandırma","config.save":"Kaydet","config.saving":"Kaydediliyor...","config.reset":"Sıfırla","config.saved":"Yapılandırma başarıyla kaydedildi.","config.error":"Yapılandırma kaydedilemedi.","config.loading":"Yapılandırma yükleniyor...","config.editor_placeholder":"TOML yapılandırması...","config.configuration_title":"Yapılandırma","config.sensitive_title":"Hassas alanlar gizlendi","config.sensitive_hint":"API anahtarları, belirteçler ve parolalar güvenlik için gizlendi. Maskeli bir alanı güncellemek için, tüm maskeli değeri yeni değerinizle değiştirin.","config.save_success":"Yapılandırma başarıyla kaydedildi.","config.save_error":"Yapılandırma kaydedilemedi","config.toml_label":"TOML Yapılandırması","config.lines":"satır","cost.session":"Oturum Maliyeti","cost.daily":"Günlük Maliyet","cost.monthly":"Aylık Maliyet","cost.request_count":"İstek Sayısı","cost.by_model":"Modele Göre Maliyet","cost.model":"Model","cost.usd":"Maliyet (USD)","cost.load_error":"Maliyet verileri yüklenemedi","cost.total_requests":"Toplam İstek","cost.token_statistics":"Token İstatistikleri","cost.avg_tokens_per_request":"Ortalama Token / İstek","cost.cost_per_1k_tokens":"1K Token Başına Maliyet","cost.model_breakdown":"Model Detayı","cost.cost":"Maliyet","cost.share":"Pay","logs.live_logs":"Canlı Kayıtlar","logs.clear":"Temizle","logs.filter":"Kayıtları filtrele...","logs.filter_label":"Filtre","logs.empty":"Kayıt girişi bulunamadı.","logs.events":"olay","logs.paused_hint":"Kayıt akışı duraklatıldı.","logs.waiting_hint":"Olay bekleniyor...","doctor.diagnostics_title":"Tanılar","doctor.run_diagnostics":"Tanı Çalıştır","doctor.running_btn":"Çalıştırılıyor...","doctor.running_desc":"Tanı çalıştırılıyor...","doctor.running_hint":"Bu birkaç saniye sürebilir.","doctor.error":"Hata","doctor.severity":"Şiddet","doctor.category":"Kategori","doctor.message":"Mesaj","doctor.empty":"Henüz tanı çalıştırılmadı.","doctor.summary":"Tanı Özeti","doctor.issues_found":"Sorunlar Bulundu","doctor.warnings_summary":"Uyarılar","doctor.all_clear":"Her Şey Yolunda","doctor.system_diagnostics":"Sistem Tanıları","doctor.empty_hint":'Revka kurulumunuzu kontrol etmek için "Tanı Çalıştır" düğmesine tıklayın.',"auth.pair":"Cihaz Eşleştir","auth.pairing_code":"Eşleştirme Kodu","auth.pair_button":"Eşleştir","auth.logout":"Çıkış Yap","auth.pairing_success":"Eşleştirme başarılı!","auth.pairing_failed":"Eşleştirme başarısız. Lütfen tekrar deneyin.","auth.enter_code":"Akıllı birine bağlanmak için eşleştirme kodunuzu girin.","common.loading":"Yükleniyor...","common.error":"Bir hata oluştu.","common.retry":"Tekrar Dene","common.cancel":"İptal","common.confirm":"Onayla","common.save":"Kaydet","common.delete":"Sil","common.edit":"Düzenle","common.execute":"Çalıştır","common.close":"Kapat","common.yes":"Evet","common.no":"Hayır","common.search":"Ara...","common.no_data":"Veri mevcut değil.","common.refresh":"Yenile","common.back":"Geri","common.actions":"İşlemler","common.name":"Ad","common.description":"Açıklama","common.status":"Durum","common.created":"Oluşturulma","common.updated":"Güncellenme","health.title":"Sistem Sağlığı","health.component":"Bileşen","health.status":"Durum","health.last_ok":"Son Başarılı","health.last_error":"Son Hata","health.restart_count":"Yeniden Başlatmalar","health.pid":"İşlem Kimliği","health.uptime":"Çalışma Süresi","health.updated_at":"Son Güncelleme","settings.title":"Ayarlar","settings.tab.appearance":"Görünüm","settings.tab.typography":"Tipografi","settings.appearance":"Görünüm","settings.typography":"Tipografi","settings.fontUi":"Arayüz Yazı Tipi","settings.fontMono":"Kod Yazı Tipi","settings.fontSize":"Arayüz Boyutu","settings.fontMonoSize":"Kod Boyutu","settings.preview":"Önizleme","settings.previewText":"Tembel köpek üzerinde hızlı kahverengi tilki zıplar.","settings.fontNote":"Yazı tipi değişiklikleri sayfa yeniden yüklendikten sonra geçerli olur.","settings.language":"Dil","chat_panel.ai_assistant":"AI Asistanı","chat_panel.agent_placeholder":'Bir ajan oluşturmamı isteyin, ör. "Bir Rust güvenlik uzmanı oluştur"',"chat_panel.team_placeholder":'Bir takım kurmamı isteyin, ör. "Frontend taşıma için bir takım kur"',"chat_panel.skill_placeholder":'Bir yetenek oluşturmamı isteyin, ör. "Kod inceleme yeteneği oluştur"',"chat_panel.close":"Kapat","clawhub.tab_local":"Yerel Yetenekler","clawhub.tab_clawhub":"ClawHub","clawhub.search_placeholder":"ClawHub yeteneklerini ara...","clawhub.trending":"Trend","clawhub.install":"Yükle","clawhub.installing":"Yükleniyor...","clawhub.installed":"Yüklendi","clawhub.downloads":"indirme","clawhub.stars":"yıldız","clawhub.verified":"Doğrulanmış","clawhub.no_results":"Yetenek bulunamadı","clawhub.search_hint":"ClawHub'daki 13.000+ topluluk yeteneğini arayın","clawhub.error":"ClawHub'a bağlanılamadı","clawhub.details":"Detaylar","clawhub.less":"Kapat","clawhub.author":"Yazar","clawhub.tags":"Etiketler","theme.mode":"Tema Modu","theme.accent":"Vurgu Rengi","theme.system":"Sistem","theme.dark":"Koyu","theme.light":"Açık","theme.oled":"OLED Siyah","nav.pairing":"Eşleştirme","nav.section.orchestration":"Orkestrasyon","nav.section.operations":"İşlemler","nav.section.inspection":"İnceleme","nav.dashboard.blurb":"Canlı çalışma durumu ve aktif DAG durumu","nav.workflows.blurb":"DAG tanımlayın ve çalışmalara aynı akıştan dalın","nav.agents.blurb":"Yeniden kullanılabilir aktörler ve iş akışı katılımcıları","nav.canvas.blurb":"Görsel çalışma alanı ve orkestrasyon tuvalleri","nav.teams.blurb":"Yetki devri topolojisi ve sahipliği görüntüleyin","nav.assets.blurb":"Yapı çıktıları ve iş akışı ile ilgili kaynaklar","nav.skins.blurb":"Belirteç ve varlık tabanlı arayüz görünümleri","nav.skills.blurb":"Yeniden kullanılabilir operasyonel yetenekler","nav.tools.blurb":"Ajan araç kataloğu ve CLI ikili dosyaları","nav.integrations.blurb":"Bağlı sistemler ve kanal yüzeyleri","nav.cron.blurb":"Zamanlanmış işler ve telafi davranışı","nav.pairing.blurb":"Cihaz kaydı ve güven yönetimi","nav.config.blurb":"Çalışma zamanı TOML ve operasyonel yapılandırma","nav.cost.blurb":"İş akışı ve çalışmaya göre harcama ve verimlilik","nav.memory.blurb":"Kumiho bellek grafiği gezgini ve revizyonlar","nav.logs.blurb":"Operasyonel izler ve düğüm bağlantılı olaylar","nav.audit.blurb":"Güven zinciri ve onay doğrulama","nav.doctor.blurb":"Tanılama ve çalışma zamanı kurtarma durumu","sidebar.brand_subtitle":"Ajan OS","sidebar.shell":"Revka","sidebar.shell_description":"Projelerinde AI iş akışlarını, araçları ve çalışma zamanını düzenleyen yerel öncelikli bir ajan işletim sistemi.","header.tagline":"Orkestrasyon öncelikli ajan işletim sistemi.","header.runtime_healthy":"Çalışma zamanı sağlıklı","header.trust_verified":"Güven doğrulandı","header.trust_unverified":"Güven doğrulanmadı","header.trust_checking":"Güven doğrulanıyor…","header.operator":"Operatör","common.duplicate":"Çoğalt","common.reenable":"Yeniden Etkinleştir","common.deprecate":"Kullanımdan Kaldır","common.create":"Oluştur","dashboard.kicker":"Orkestrasyon Merkezi","dashboard.live_orchestration_pane":"Canlı Orkestrasyon Paneli","dashboard.active_workflow_posture":"Aktif iş akışı durumu","dashboard.open_workflow_definition":"İş akışı tanımını aç","dashboard.selected_run":"Seçili Çalıştırma","dashboard.run_posture":"Çalıştırma Durumu","dashboard.signal_focus":"Sinyal Odağı","dashboard.hotspots":"Sıcak Noktalar","dashboard.count.running":"Çalışıyor","dashboard.count.failed":"Başarısız","dashboard.count.completed":"Tamamlandı","dashboard.count.pending":"Bekliyor","dashboard.count.skipped":"Atlandı","dashboard.prev_signal":"Önceki Sinyal","dashboard.next_signal":"Sonraki Sinyal","dashboard.intervention_points":"{count} müdahale noktası","dashboard.label.failure":"Başarısız: {id}","dashboard.label.running":"Çalışıyor: {id}","dashboard.label.blocked":"Engellendi: {id}","dashboard.selected_step":"Seçili Adım","dashboard.inspect_node_in_runs":"Bu düğümü çalıştırma çalışma alanında incele","dashboard.open_definition_node":"Tanım düğümünü aç","dashboard.select_dag_node":"Aktif dalı incelemek için DAG'da bir düğüm seçin.","dashboard.priority_timeline":"Öncelik Zaman Çizelgesi","dashboard.no_run_selected":"Çalıştırma seçilmedi.","dashboard.open_full_run_workspace":"Tam çalıştırma çalışma alanını aç","dashboard.open_all_runs":"Tüm iş akışı çalıştırmalarını aç","dashboard.status.blocked":"engellendi","dashboard.scene.operator":"Operatör Özeti","dashboard.scene.error":"Pano telemetrisi bozuldu. Sonraki adımdan önce çalıştırma rayını ve günlükleri kontrol edin.","dashboard.scene.selected_run":"{workflow} şu anda {status}. {completed}/{total} adım tamamlandı.","dashboard.scene.run_failed":"{workflow} dikkat istiyor: {failed} adım başarısız, {completed}/{total} adım tamamlandı.","dashboard.scene.active_overview":"{definitions} iş akışı tanımı genelinde {active} aktif çalıştırma var.","dashboard.scene.idle_overview":"Seçili çalıştırma yok. {definitions} tanım hazır, toplam {total} çalıştırma kaydedildi.","workflows.kicker":"Orkestrasyon Merkezi","workflows.title":"İş Akışları","workflows.create":"İş Akışı Oluştur","workflows.workflow_info":"v{version} · {steps} düğüm · {runs} çalıştırma","workflows.workflow_info_short":"v{version} · {steps} düğüm","workflows.status.off":"Kapalı","workflows.status.ready":"Hazır","workflows.tab.definition":"Tanım","workflows.tab.runs":"Çalıştırmalar","workflows.loading":"İş akışları yükleniyor…","workflows.empty_title":"Henüz iş akışı yok","workflows.empty_desc":"Başlamak için ilk iş akışınızı oluşturun.","workflows.definition_unavailable_title":"İş akışı tanımı kullanılamıyor","workflows.definition_unavailable_desc":"Çalışma zamanı bu iş akışı için boş bir tanım döndürdü — grafik oluşturulamıyor. Bu bir arka uç veri sorunudur ve yukarı akışta düzeltilmelidir.","workflows.no_runs_title":"Henüz çalıştırma yok","workflows.no_runs_desc":"Yürütme durumunu görmek için bu iş akışını çalıştırın.","workflows.open_node_in_runs":"Düğümü çalıştırmalarda aç","workflows.select_dag_node":"DAG'da bir düğüm seçin.","workflows.run_step":"Çalıştırma Adımı","workflows.select_dag_node_step":"Adımı incelemek için bir DAG düğümü seçin.","workflows.save_failure":"İş akışı kaydedilemedi","workflows.save_failure_dot":"İş akışı kaydedilemedi.","workflows.run_failure":"İş akışı çalıştırılamadı","workflows.status_failure":"İş akışı durumu değiştirilemedi","workflows.status_failure_dot":"İş akışı durumu değiştirilemedi.","workflows.delete_failure":"İş akışı silinemedi","workflows.delete_failure_dot":"İş akışı silinemedi.","workflows.toast.updated":'"{name}" iş akışı güncellendi.',"workflows.toast.created":'"{name}" iş akışı oluşturuldu.',"workflows.toast.reenabled":'"{name}" iş akışı yeniden etkinleştirildi.',"workflows.toast.deprecated":'"{name}" iş akışı kullanımdan kaldırıldı.',"workflows.toast.deleted":'"{name}" iş akışı silindi.',"workflows.toast.run_started":'"{name}" iş akışı başlatıldı (çalıştırma {runId}).',"workflows.run_option":"{prefix} — {status} ({completed}/{total})","workflows.copy_suffix":"Kopya","doctor.kicker":"İnceleme","doctor.title":"Doktor","doctor.description":"Çalışma zamanı tanılamalarını çalıştırın ve Revka yığınındaki gruplanmış sağlık bulgularını inceleyin.","doctor.run":"Tanılamaları Çalıştır","doctor.running":"Çalışıyor…","doctor.failed_title":"Tanılamalar başarısız","doctor.loading_title":"Sistem tanılamaları çalışıyor…","doctor.loading_desc":"Çalışma zamanı bileşenleri, yapılandırma ve operasyonel sağlık kontrol ediliyor.","doctor.health_summary":"Sağlık Özeti","doctor.passing":"Geçen","doctor.warnings":"Uyarılar","doctor.failures":"Başarısızlıklar","doctor.run_context":"Çalıştırma Bağlamı","doctor.context_p1":"Doktor, bir terminal dökümü değil, bir inceleme panosu gibi davrandığında en güçlüdür. Bu panel önce genel durumu vurgular, ardından bulguları alt sistem gruplarına ayırır.","doctor.context_p2":"Bireysel mesajlara dalmadan önce uyarıların nerede kümelendiğini belirlemek için kategori panolarını kullanın.","doctor.subsystem_boards":"Alt Sistem Panoları","doctor.checks":"{count} kontrol","doctor.ok":"ok","doctor.warn":"uyarı","doctor.fail":"hata","doctor.system_diag_title":"Sistem tanılamaları","doctor.system_diag_desc":"Revka kabuğundaki uyarıları, başarısızlıkları ve tüm temiz kontrolleri incelemek için doktoru çalıştırın.","doctor.run_failed":"Tanılamalar çalıştırılamadı","cost.kicker":"İşlemler","cost.title":"Maliyet","cost.error_title":"Maliyet verileri yüklenemiyor","cost.loading_title":"Maliyet verileri yükleniyor…","cost.spend_posture":"Harcama Durumu","cost.session_cost":"Oturum Maliyeti","cost.daily_cost":"Günlük Maliyet","cost.monthly_cost":"Aylık Maliyet","cost.requests":"İstekler","cost.token_efficiency":"Token Verimliliği","cost.total_tokens":"Toplam Token","cost.avg_tokens":"Ort. Token / İstek","cost.cost_per_1k":"Maliyet / 1K Token","cost.model_workspace":"Model Çalışma Alanı","cost.spend_by_model":"Modele göre harcama","cost.no_model_data":"Model verisi yok","cost.no_model_data_desc":"Model düzeyinde harcama, istekler kaydedildikten sonra görünür.","cost.tokens_label":"{count} token","cost.requests_label":"{count} istek","cost.share_label":"Aylık harcamanın %{share}'i","cost.selected_model":"Seçili Model","cost.no_model_selected":"Model seçilmedi","cost.no_model_selected_desc":"Harcama yoğunluğunu ve verimliliği incelemek için çalışma alanından bir model seçin.","cost.monthly_spend":"Aylık Harcama","cost.tokens":"Tokenlar","cost.share_monthly":"Aylık Harcama Payı","cost.interpretation":"Yorum","cost.interp_p1":"Büyük aylık pay değerleri, maliyetin tek bir model ailesinde yoğunlaştığını gösterir.","cost.interp_p2":"Düşük istek sayısıyla yüksek istek başına token genellikle uzun bağlamlı veya üretim yoğun iş akışlarına işaret eder.","logs.kicker":"İnceleme","logs.title":"Kayıtlar","logs.description":"Revka arka plan işlem stderr günlüğünün takibi. Çalışma zamanı ajan olayları Denetim sayfasındadır.","logs.pause":"Duraklat","logs.resume":"Devam Et","logs.jump_to_bottom":"En Alta Git","logs.stream_status":"Akış Durumu","logs.connected":"Bağlı","logs.disconnected":"Bağlantı Kesildi","logs.visible_lines":"{count} görünür satır. ~/.revka/logs/daemon.stderr.log takip ediliyor.","logs.event_filters":"Olay Filtreleri","logs.no_event_types":"Henüz olay türü yok","logs.no_event_types_desc":"Akış etkinlik aldıktan sonra filtreler görünür.","logs.clear_filters":"Filtreleri Temizle","logs.live_event_feed":"Canlı Olay Akışı","logs.no_events":"Henüz olay yok","logs.no_events_desc":"SSE beslemesi çalışma zamanı olaylarını aldıktan sonra ajan etkinlikleri burada akacaktır.","tools.kicker":"İşlemler","tools.title":"Araçlar","tools.description":"Ajan tarafına yönelik araç kataloğu ve çalışma zamanının çağırabileceği ana bilgisayar CLI ikili dosyaları.","tools.reload":"Yeniden Yükle","tools.search_placeholder":"Araçları ada, açıklamaya veya kategoriye göre arayın…","tools.loading":"Araçlar yükleniyor…","tools.agent_tools_count":"Ajan Araçları · {count}","tools.no_matches":"Eşleşme yok","tools.no_agent_tools":"Kayıtlı ajan aracı yok","tools.try_different":"Farklı bir arama terimi deneyin.","tools.agent_tools_empty_desc":"Çalışma zamanı kaydettiğinde ajan araçları görünür.","tools.parameter_schema":"Parametre Şeması","tools.cli_tools_count":"CLI Araçları · {count}","tools.no_cli_tools":"CLI aracı algılanmadı","tools.cli_tools_empty_desc":"Revka başlangıçta yaygın CLI ikili dosyalarını araştırır. Birini yükleyin ve yeniden yükleyin.","tools.col.name":"Ad","tools.col.path":"Yol","tools.col.version":"Sürüm","tools.col.category":"Kategori","tools.failed_load":"Araçlar yüklenemedi: {message}","audit.kicker":"İnceleme","audit.title":"Denetim","audit.description":"Operasyonel eylemler için güven zinciri doğrulaması, olay incelemesi ve güvenlik duruşu.","audit.refresh":"Yenile","audit.verify_chain":"Zinciri Doğrula","audit.disabled_title":"Denetim izi devre dışı","audit.disabled_desc":"Burada onay, politika ve güvenlik olaylarını incelemek için denetim kaydını etkinleştirin.","audit.filters":"Filtreler","audit.all_event_types":"Tüm olay türleri","audit.event.command_execution":"Komut Yürütme","audit.event.file_access":"Dosya Erişimi","audit.event.config_change":"Yapılandırma Değişikliği","audit.event.auth_success":"Kimlik Doğrulama Başarılı","audit.event.auth_failure":"Kimlik Doğrulama Başarısız","audit.event.policy_violation":"Politika İhlali","audit.event.security_event":"Güvenlik Olayı","audit.chain_verified":"Zincir doğrulandı","audit.chain_invalid":"Zincir geçersiz","audit.entries_verified":"{count} giriş doğrulandı.","audit.stream_title":"Denetim Olay Akışı","audit.stream_subtitle":"Kayıtlı eylemler ve onaylar","audit.loading":"Denetim olayları yükleniyor…","audit.empty_title":"Denetim olayı yok","audit.empty_desc":"Eylemler veya onaylar yayıldığında kayıtlı olaylar burada görünecektir.","audit.col.sequence":"Sıra","audit.col.action":"Eylem","audit.col.result":"Sonuç","audit.col.hash":"Hash","audit.result_success":"Başarılı","audit.result_recorded":"Kaydedildi","audit.policy_violation_badge":"Politika ihlali","audit.time.seconds_ago":"{n}s önce","audit.time.minutes_ago":"{n}dk önce","audit.time.hours_ago":"{n}sa önce","audit.time.days_ago":"{n}g önce","integrations.kicker":"Operasyon","integrations.title":"Entegrasyonlar","integrations.loading":"Entegrasyonlar yükleniyor…","integrations.coverage":"Kapsam","integrations.metric.active":"Aktif","integrations.metric.available":"Mevcut","integrations.metric.coming_soon":"Yakında","integrations.categories":"Kategoriler","integrations.category_all":"tümü","integrations.workspace":"Entegrasyon Çalışma Alanı","integrations.all_integrations":"Tüm entegrasyonlar","integrations.category_integrations":"{category} entegrasyonları","integrations.empty_title":"Entegrasyon yok","integrations.empty_desc":"Hiçbir entegrasyon mevcut kategori filtresiyle eşleşmedi.","integrations.badge.active":"Aktif","integrations.badge.available":"Mevcut","integrations.badge.coming_soon":"Yakında","integrations.selected":"Seçili Entegrasyon","integrations.no_selected_title":"Entegrasyon seçilmedi","integrations.no_selected_desc":"Dağıtım duruşunu incelemek için çalışma alanından bir entegrasyon seçin.","integrations.detail.category":"Kategori","integrations.detail.status":"Durum","integrations.detail.operational_readiness":"Operasyonel Hazırlık","integrations.readiness.active":"Çalışma zamanında zaten aktif.","integrations.readiness.available":"Operatör hazır olduğunda etkinleştirilebilir.","integrations.readiness.coming_soon":"Henüz etkinleştirilmeye hazır olmayan planlı yüzey.","integrations.legend":"Durum Açıklaması","integrations.legend.p1":"`Active` entegrasyonlar zaten çalışma zamanı iş akışlarına bağlı.","integrations.legend.p2":"`Available` entegrasyonlar mevcut sürümden kurulabilir veya bağlanabilir.","integrations.legend.p3":"`Coming Soon` entegrasyonlar planlanmış ancak henüz operatörler için hazır değil.","pairing.kicker":"Operasyon","pairing.title":"Eşleştirme","pairing.description":"Eşleştirme kodları verin, mobil kayıt için QR oluşturun ve güvenilen cihazları yönetin.","pairing.reload":"Yeniden Yükle","pairing.pair_new_device":"Yeni Cihaz Eşleştir","pairing.generating":"Oluşturuluyor…","pairing.active_code":"Aktif Eşleştirme Kodu","pairing.rendering":"Render ediliyor…","pairing.code_hint":"QR kodunu Revka yardımcı uygulamasıyla tarayın veya eşleştirilen cihaza 6 haneli kodu girin. Kodlar, bir cihaz kaydı tamamladığında veya yenisini oluşturduğunuzda sona erer.","pairing.copy_code":"Kodu Kopyala","pairing.rotate":"Döndür","pairing.cli_device_name":"CLI cihaz adı","pairing.cli_hardware":"Donanım","pairing.cli_hardware_placeholder":"İsteğe bağlı platform etiketi","pairing.mint_cli_token":"CLI Token Oluştur","pairing.minting_token":"Oluşturuluyor…","pairing.minted_token":"Oluşturulan Bearer Token","pairing.copy_token":"Token Kopyala","pairing.no_code_title":"Aktif eşleştirme kodu yok","pairing.no_code_desc":'Yeni bir kod ve QR oluşturmak için "Yeni Cihaz Eşleştir"e basın. Kodlar kısa ömürlüdür ve tek bir kayıt içindir.',"pairing.how_to_scan":"Nasıl taranır","pairing.scan_step1":"Yeni cihazda Revka yardımcı uygulamasını açın.","pairing.scan_step2_prefix":"Seçin: ","pairing.scan_step2_action":"Hub ile eşleştir","pairing.scan_step2_suffix":".","pairing.scan_step3":"QR kodunu tarayın veya 6 haneli kodu manuel olarak girin.","pairing.scan_step4":"Kayıt tamamlandığında cihaz aşağıdaki listede görünür.","pairing.paired_devices":"Eşleştirilen Cihazlar · {count}","pairing.loading_devices":"Cihazlar yükleniyor…","pairing.no_devices_title":"Henüz eşleştirilmiş cihaz yok","pairing.no_devices_desc":"Başarılı bir kayıttan sonra eşleştirilmiş cihazlar burada görünecek.","pairing.col.name":"Ad","pairing.col.type":"Tür","pairing.col.hardware":"Donanım","pairing.col.paired":"Eşleştirildi","pairing.col.last_seen":"Son Görülme","pairing.col.ip":"IP","pairing.col.actions":"Eylemler","pairing.unnamed":"İsimsiz","pairing.unknown":"Bilinmeyen","pairing.device_type.api_client":"API İstemcisi","pairing.device_type.browser":"Tarayıcı","pairing.device_type.cli":"CLI","pairing.device_type.mobile":"Mobil","pairing.device_type.tablet":"Tablet","pairing.revoke":"İptal et?","pairing.yes":"Evet","pairing.no":"Hayır","pairing.revoke_title":"Cihazı iptal et","pairing.toast.code_generated":"Yeni eşleştirme kodu oluşturuldu.","pairing.toast.code_copied":"Kod kopyalandı.","pairing.toast.token_minted":"Bearer token oluşturuldu. Şimdi kopyalayın.","pairing.toast.token_copied":"Token kopyalandı.","pairing.toast.copy_failed":"Kopyalama başarısız. Manuel olarak seçin.","pairing.toast.device_revoked":"Cihaz iptal edildi.","pairing.err.load_devices":"Cihazlar yüklenemedi","pairing.err.gen_code":"Eşleştirme kodu oluşturulamadı","pairing.err.mint_token":"Bearer token oluşturulamadı","pairing.err.revoke":"Cihaz iptal edilemedi","cron.kicker":"Operasyon","cron.description":"Zamanlanmış görevler, yakalama davranışı ve son çalıştırma geçmişi.","cron.reload":"Yeniden Yükle","cron.startup_behaviour":"Başlangıç Davranışı","cron.catch_up_title":"Başlangıçta kaçırılan görevleri yakala","cron.catch_up_desc":"Revka durgunluktan sonra başlatıldığında gecikmiş tüm görevleri çalıştırın.","cron.loading_jobs":"Zamanlanmış görevler yükleniyor…","cron.no_jobs_title":"Zamanlanmış görev yok","cron.no_jobs_desc":"Bir zamanlamaya göre komut çalıştırmak için bir cron görevi ekleyin.","cron.col.id":"ID","cron.col.name":"Ad","cron.col.command":"Komut","cron.col.next_run":"Sonraki Çalıştırma","cron.col.last_status":"Son Durum","cron.col.enabled":"Etkin","cron.col.actions":"Eylemler","cron.enabled_badge":"Etkin","cron.disabled_badge":"Devre Dışı","cron.toggle_history":"Çalıştırma geçmişini aç/kapat","cron.confirm":"Onaylıyor musunuz?","cron.history.loading":"Çalıştırma geçmişi yükleniyor…","cron.history.error_title":"Çalıştırma geçmişi yüklenemiyor","cron.history.retry":"Tekrar Dene","cron.history.no_runs_title":"Henüz çalıştırma yok","cron.history.no_runs_desc":"Bu görev oluşturulduğundan beri çalıştırılmadı.","cron.history.refresh":"Yenile","cron.history.recent":"Son çalıştırmalar · {count}","cron.history.refresh_title":"Çalıştırmaları yenile","cron.modal.edit_title":"Cron Görevini Düzenle","cron.modal.add_title":"Cron Görevi Ekle","cron.modal.description":"Ad isteğe bağlıdır. Program standart cron ifadelerini kullanır.","cron.form.name":"Ad","cron.form.optional":"(isteğe bağlı)","cron.form.name_placeholder":"örn. Günlük temizlik","cron.form.schedule":"Program","cron.form.command":"Komut","cron.form.command_placeholder":"örn. cleanup --older-than 7d","cron.form.cancel":"İptal","cron.form.saving":"Kaydediliyor…","cron.form.adding":"Ekleniyor…","cron.form.save":"Kaydet","cron.err.load":"Görevler yüklenemedi: {message}","cron.err.settings":"Ayarlar güncellenemedi","cron.err.save":"Görev kaydedilemedi","cron.err.delete":"Görev silinemedi","cron.err.form_required":"Program ve komut gereklidir.","cron.toast.updated":'"{name}" güncellendi.',"cron.toast.added":'"{name}" eklendi.',"cron.toast.deleted":"Görev silindi.","canvas.kicker":"Orkestrasyon Merkezi","canvas.title":"Tuval","canvas.reconnect":"Yeniden Bağlan","canvas.control":"Tuval Kontrolü","canvas.connected":"Bağlı","canvas.disconnected":"Bağlantı Kesildi","canvas.canvas_id_placeholder":"Tuval Kimliği","canvas.switch":"Değiştir","canvas.clear":"Temizle","canvas.available":"Mevcut Tuvaller","canvas.loading_list":"Tuvaller yükleniyor…","canvas.loading_list_desc":"Canlı tuval kaydı sorgulanıyor.","canvas.no_active_title":"Aktif tuval yok","canvas.no_active_desc":"Bir ajan veya iş akışı çerçeve gönderdiğinde tuval kimlikleri burada görünecek.","canvas.active":"Aktif","canvas.viewport":"Tuval Görünümü","canvas.live_output":"Canlı çerçeve çıkışı","canvas.canvas_label":"Tuval","canvas.connection":"Bağlantı","canvas.live":"Canlı","canvas.offline":"Çevrimdışı","canvas.frame_type":"Çerçeve Türü","canvas.last_update":"Son Güncelleme","canvas.waiting_label":"Çerçeve bekleniyor","canvas.frame_suffix":"çerçeve","canvas.waiting_for_content":'"{id}" üzerinde içerik bekleniyor',"canvas.waiting_for_content_desc":"Ajan tuval aracını kullanarak buraya içerik gönderebilir. Bir çerçeve geldiğinde bu görünümde hemen oluşturulur.","canvas.disconnected_title":"Tuval soketi bağlantısı kesildi","canvas.disconnected_desc":"Mevcut tuvale yeniden bağlanın veya başka bir canlı tuval kimliğine geçin.","canvas.reconnect_button":"Tuvali Yeniden Bağla","canvas.frame_id":"Çerçeve Kimliği","canvas.guidance":"Tuval Kılavuzu","canvas.guidance_desc":"Doğrudan bu görünüme grafikler, diyagramlar, markdown raporları ve HTML gösterge panoları oluşturmak için asistanı kullanın.","canvas.history":"Çerçeve Geçmişi","canvas.hide":"Gizle","canvas.show":"Göster","canvas.history_collapsed_title":"Geçmiş daraltıldı","canvas.history_collapsed_desc":"Aktif tuval üzerindeki önceki çerçeveleri incelemek için bu çubuğu genişletin.","canvas.no_frames_title":"Henüz çerçeve yok","canvas.no_frames_desc":"Çerçeveler geldikçe hızlı geri izleme için burada saklanacak.","skills.kicker":"Operasyon","skills.title":"Beceriler","skills.create_skill":"Beceri Oluştur","skills.registry_status":"Kayıt Durumu","skills.summary.total":"Toplam","skills.summary.active":"Aktif","skills.summary.deprecated":"Kullanımdan Kaldırıldı","skills.summary.domains":"Alanlar","skills.index":"Beceri Dizini","skills.search_placeholder":"Becerileri ara…","skills.loading":"Beceriler yükleniyor…","skills.no_skills_title":"Beceri bulunamadı","skills.no_skills_desc":"Operasyonel kaydı doldurmaya başlamak için yerel bir beceri oluşturun.","skills.status.active":"Aktif","skills.status.deprecated":"Kullanımdan Kaldırıldı","skills.workspace":"Beceri Çalışma Alanı","skills.select_placeholder":"Bir beceri seçin","skills.description":"Açıklama","skills.content":"Beceri İçeriği","skills.content_empty":"Bu beceride gösterilecek içerik yok.","skills.edit":"Düzenle","skills.reenable":"Yeniden Etkinleştir","skills.deprecate":"Kullanımdan Kaldır","skills.deleting":"Siliniyor…","skills.delete":"Sil","skills.no_selected_title":"Beceri seçilmedi","skills.no_selected_desc":"İçeriğini ve operasyonel meta verilerini incelemek için bir beceri seçin.","skills.install_github":"GitHub’dan Kur","skills.install_github_desc":"Doğrudan bir beceri kurmak için bir GitHub deposu URL’si yapıştırın.","skills.github_placeholder":"https://github.com/org/skill-repo","skills.installing":"Kuruluyor…","skills.install":"Kur","skills.marketplace":"Pazar Yeri","skills.marketplace_shown":"{count} gösterildi","skills.marketplace_placeholder":"ClawHub becerilerini ara…","skills.search":"Ara","skills.trending":"Popüler","skills.marketplace_loading":"Pazar yeri yükleniyor…","skills.marketplace_empty":"Pazar yeri sonucu yok","skills.modal.edit_title":"Beceriyi Düzenle","skills.modal.create_title":"Beceri Oluştur","skills.modal.description":"Beceriler, ajanlara ve çalıştırmalara eklenebilecek yeniden kullanılabilir operasyonel yeteneklerdir.","skills.modal.name_placeholder":"Beceri adı","skills.modal.description_placeholder":"Açıklama","skills.modal.tags_placeholder":"virgülle,ayrılmış,etiketler","skills.modal.content_placeholder":"Beceri markdown içeriği","skills.modal.cancel":"İptal","skills.modal.saving":"Kaydediliyor…","skills.modal.save_skill":"Beceriyi Kaydet","skills.toast.updated":'"{name}" becerisi güncellendi.',"skills.toast.created":'"{name}" becerisi oluşturuldu.',"skills.toast.reenabled":'"{name}" becerisi yeniden etkinleştirildi.',"skills.toast.deprecated":'"{name}" becerisi kullanımdan kaldırıldı.',"skills.toast.deleted":'"{name}" becerisi silindi.',"skills.toast.installed":'"{name}" becerisi kuruldu.',"skills.toast.installed_github":'"{name}" becerisi GitHub’dan kuruldu.',"skills.err.save":"Beceri kaydedilemedi.","skills.err.load_detail":"Beceri içeriği yüklenemedi.","skills.err.toggle":"Beceri durumu değiştirilemedi.","skills.err.delete":"Beceri silinemedi.","skills.err.install":"Pazar yeri becerisi kurulamadı.","skills.err.install_github":"GitHub URL’sinden beceri kurulamadı.","teams.kicker":"Orkestrasyon Merkezi","teams.title":"Takımlar","teams.create":"Takım Oluştur","teams.refresh":"Yenile","teams.count":"{count} takım","teams.agent_count":"{count} ajan","teams.loading":"Yükleniyor…","teams.loading_desc":"Takımlar yükleniyor…","teams.empty_title":"Takım yok","teams.empty_desc":"Başlamak için bir takım oluşturun.","teams.none_selected_title":"Takım seçilmedi","teams.none_selected_desc":"Dizinden bir takım seçin.","teams.members_suffix":"{members} üye · {edges} kenar","teams.status.off":"Kapalı","teams.status.live":"Canlı","teams.status.deprecated":"Kullanımdan kaldırıldı","teams.status.active":"Aktif","teams.action.edit":"Düzenle","teams.action.reenable":"Yeniden etkinleştir","teams.action.deprecate":"Kullanımdan kaldır","teams.action.delete":"Sil","teams.stats.members":"Üyeler","teams.stats.edges":"Kenarlar","teams.stats.status":"Durum","teams.tab.summary":"Özet","teams.tab.member":"Üye","teams.open_agent_registry":"Ajan kayıt defterini aç","teams.modal.edit_title":"Takımı Düzenle","teams.modal.create_title":"Takım Oluştur","teams.modal.description":"Takım düzenleyici artık kimlik, kompozisyon ve temel raporlama/bağımlılık kenarlarını doğrudan yeni arayüzde yönetiyor.","teams.form.name":"Takım Adı","teams.form.description":"Açıklama","teams.form.members":"Üyeler","teams.form.topology_preview":"Topoloji Önizleme","teams.form.edge_authoring":"Kenar Yazma","teams.form.from_member":"Kaynak üye","teams.form.to_member":"Hedef üye","teams.form.edge_reports_to":"Rapor Verir","teams.form.edge_supports":"Destekler","teams.form.edge_depends_on":"Bağımlı","teams.form.add_edge":"Kenar Ekle","teams.form.remove":"Kaldır","teams.form.no_edges":"Henüz topoloji kenarı tanımlanmadı.","teams.form.draft_summary":"Taslak Özeti","teams.form.draft_members":"Üyeler","teams.form.draft_edges":"Kenarlar","teams.form.draft_hint":"Hiyerarşi için `REPORTS_TO`, işbirliği şeritleri için `SUPPORTS` ve engelleyici yürütme ilişkileri için `DEPENDS_ON` kullanın.","teams.form.draft_team_name":"Taslak Takım","teams.form.cancel":"İptal","teams.form.saving":"Kaydediliyor…","teams.form.save":"Takımı Kaydet","teams.toast.updated":'"{name}" takımı güncellendi.',"teams.toast.created":'"{name}" takımı oluşturuldu.',"teams.toast.deleted":'"{name}" takımı silindi.',"teams.toast.reenabled":'"{name}" takımı yeniden etkinleştirildi.',"teams.toast.deprecated":'"{name}" takımı kullanımdan kaldırıldı.',"teams.err.save":"Takım kaydedilemedi.","teams.err.toggle":"Takım durumu değiştirilemedi.","teams.err.delete":"Takım silinemedi.","agents.kicker":"Orkestrasyon Merkezi","agents.title":"Ajanlar","agents.create":"Ajan Oluştur","agents.refresh":"Yenile","agents.search_placeholder":"Ajan ara…","agents.filter.all_roles":"Tüm roller","agents.filter.coder":"Geliştirici","agents.filter.reviewer":"İnceleyici","agents.filter.researcher":"Araştırmacı","agents.filter.hide_disabled":"Devre Dışı Olanları Gizle","agents.filter.show_disabled":"Devre Dışı Olanları Göster","agents.count":"{count} ajan","agents.loading":"Yükleniyor…","agents.loading_desc":"Ajanlar yükleniyor…","agents.empty_title":"Ajan yok","agents.empty_desc":"Filtreleri ayarlayın veya bir tane oluşturun.","agents.none_selected_title":"Ajan seçilmedi","agents.none_selected_desc":"Dizinden bir ajan seçin.","agents.status.disabled":"Devre dışı","agents.status.active":"Aktif","agents.stats.registry":"Kayıt Defteri","agents.stats.active":"Aktif","agents.stats.codex":"Codex","agents.section.identity":"Kimlik","agents.section.soul":"Ruh","agents.section.soul_empty":"Ruh açıklaması girilmedi.","agents.section.expertise":"Uzmanlık","agents.section.no_expertise":"Uzmanlık etiketi yok.","agents.section.voice":"Ses","agents.section.voice_empty":"Belirtilmedi","agents.section.revision":"Revizyon","agents.section.created":"Oluşturuldu","agents.action.edit":"Düzenle","agents.action.reenable":"Yeniden etkinleştir","agents.action.deprecate":"Kullanımdan kaldır","agents.action.delete":"Sil","agents.action.deleting":"Siliniyor…","agents.tab.summary":"Özet","agents.tab.prompt":"İstem","agents.summary.name":"Ad","agents.summary.role":"Rol","agents.summary.type":"Tür","agents.summary.model":"Model","agents.summary.model_default":"Varsayılan","agents.summary.tone":"Ton","agents.summary.revision":"Revizyon","agents.summary.created":"Oluşturuldu","agents.prompt.system_hint":"Sistem İpucu","agents.prompt.system_hint_empty":"Sistem ipucu yapılandırılmadı.","agents.prompt.identity_seed":"Kimlik Çekirdeği","agents.modal.create_title":"Ajan Oluştur","agents.modal.edit_title":"Ajanı Düzenle","agents.modal.description":"Ajanlar kimlik odaklı operatörlerdir. Revka; persona, model ve istem yüzeyini tek yerde tutar.","agents.form.name":"Ad","agents.form.tone":"Ton","agents.form.tone_placeholder":"kısa ve doğrudan","agents.form.identity":"Kimlik","agents.form.soul":"Ruh","agents.form.role":"Rol","agents.form.role.coder":"Geliştirici","agents.form.role.reviewer":"İnceleyici","agents.form.role.researcher":"Araştırmacı","agents.form.agent_type":"Ajan Türü","agents.form.model":"Model","agents.form.model_placeholder":"gpt-5.4 / claude-sonnet-4-6","agents.form.expertise":"Uzmanlık","agents.form.expertise_placeholder":"rust, review, orchestration","agents.form.system_hint":"Sistem İpucu","agents.form.cancel":"İptal","agents.form.saving":"Kaydediliyor…","agents.form.save_create":"Ajan Oluştur","agents.form.save_edit":"Ajanı Kaydet","agents.toast.updated":'"{name}" ajanı güncellendi.',"agents.toast.created":'"{name}" ajanı oluşturuldu.',"agents.toast.deleted":'"{name}" ajanı silindi.',"agents.toast.reenabled":'"{name}" ajanı yeniden etkinleştirildi.',"agents.toast.deprecated":'"{name}" ajanı kullanımdan kaldırıldı.',"agents.err.load":"Ajanlar yüklenemedi.","agents.err.save":"Ajan kaydedilemedi.","agents.err.toggle":"Ajan durumu değiştirilemedi.","agents.err.delete":"Ajan silinemedi.","runs.kicker":"Orkestrasyon Merkezi","runs.title":"İş Akışı Çalışmaları","runs.refresh":"Yenile","runs.index.title":"Çalışma Dizini","runs.empty.title":"Çalışma yok","runs.empty.desc":"Bu dizini doldurmak için bir iş akışı çalıştırın.","runs.error.title":"Yükleme hatası","runs.stats.steps_fraction":"{completed}/{total} adım","runs.stats.expanded_steps":"{count} genişletilmiş","runs.stats.loop_fraction":"Dongu {iteration}/{total}: {step}","runs.stats.loop_iteration":"Dongu {iteration}: {step}","runs.open_definition":"Tanımı aç","runs.action.retry_failed":"Başarısız olanları yeniden dene","runs.action.retrying":"Yeniden deneniyor…","runs.action.retry_tooltip":"Başarısız adımları yeniden dene","runs.action.stop":"Durdur","runs.action.stopping":"Durduruluyor…","runs.action.stop_tooltip":"Bu çalışma örneğini durdur","runs.action.delete_tooltip":"Çalışmayı sil","runs.none_selected.title":"Çalışma seçilmedi","runs.none_selected.desc":"Dizinden bir çalışma seçin.","runs.banner.label":"Aktif Seçim","runs.overlay.path_mode":"Yol Modu","runs.overlay.path.all":"Tümü","runs.overlay.path.failed":"Başarısız","runs.overlay.path.blocked":"Engelli","runs.overlay.signals":"Sinyaller","runs.overlay.prev":"Önceki","runs.overlay.next":"Sonraki","runs.overlay.signal_count":"{count} sinyal","runs.overlay.posture":"Durum","runs.overlay.running":"Çalışıyor","runs.overlay.failed":"Başarısız","runs.overlay.done":"Tamamlandı","runs.overlay.pending":"Beklemede","runs.overlay.skipped":"Atlandı","runs.overlay.hotspots":"Sıcak Noktalar","runs.overlay.legend_running":"Çalışıyor","runs.overlay.legend_failure":"Başarısızlık","runs.overlay.legend_blocked":"Engelli","runs.overlay.legend_skipped":"Atlandı","runs.overlay.legend_gate":"Kapı","runs.overlay.fail_label":"Başarısız: {id}","runs.overlay.run_label":"Çalışıyor: {id}","runs.overlay.block_label":"Engel: {id}","runs.started_at":"{time} başladı","runs.inspector.title":"Adım İnceleyici","runs.tab.summary":"Özet","runs.tab.output":"Çıktı","runs.tab.tools":"Araçlar","runs.tab.transcript":"Döküm","runs.tab.jsonl":"JSONL Günlüğü","runs.detail.select_node":"İncelemek için bir DAG düğümü seçin.","runs.detail.no_description":"Açıklama yok.","runs.detail.depends_on":"Bağımlı: {list}","runs.detail.depends_none":"yok","runs.detail.agent":"Ajan: {type}{role}","runs.detail.agent_na":"yok","runs.detail.skills":"Beceriler: {list}","runs.detail.dashboard_link":"Kontrol Paneli","runs.detail.definition_link":"Tanım","runs.detail.select_step":"Bir adım seçin.","runs.detail.step_output":"Adım Çıktısı","runs.detail.agent_output":"Ajan Çıktısı","runs.detail.no_output":"Çıktı yakalanmadı.","runs.detail.loading":"Yükleniyor…","runs.detail.tools_calls":"Çağrılar","runs.detail.tools_errors":"Hatalar","runs.detail.no_tools":"Araç çağrısı kaydedilmedi.","runs.detail.no_activity":"Ajan etkinliği bulunamadı.","runs.detail.no_jsonl":"Bu ajan için JSONL girdisi bulunamadı.","runs.detail.no_jsonl_filter":"Filtrenizle eşleşen girdi yok.","runs.detail.no_transcript":"Döküm yok.","runs.detail.tool_default":"Araç","runs.detail.tool_status_ok":"ok","runs.timeline":"Zaman Çizelgesi ({count})","runs.toast.retry_started":"{id} çalışması için yeniden deneme başladı.","runs.toast.stop_requested":"{id} çalışması için durdurma istendi.","runs.toast.deleted":"{id} çalışması silindi.","runs.err.retry":"Çalışma yeniden denenemedi.","runs.err.stop":"Çalışma durdurulamadı.","runs.err.delete":"Çalışma silinemedi.","memory.kicker":"İnceleme","memory.page_title":"Bellek","memory.page_description":"Tür filtreleri, alan kapsamlandırma, arama vurgulama ve düğüme bağlı detay incelemesi sunan bellek grafiği incelemesi.","memory.selected_memory":"Seçilen Bellek","memory.loading_detail":"Düğüm detayları yükleniyor…","memory.relative.just_now":"az önce","memory.relative.minutes":"{count}d önce","memory.relative.hours":"{count}s önce","memory.relative.days":"{count}g önce","memory.detail.metadata":"Meta Veri","memory.detail.bundle_members":"Paket Üyeleri","memory.controls.title":"Grafik Kontrolleri","memory.controls.search_placeholder":"Belleği vurgula…","memory.controls.all_spaces":"Tüm alanlar","memory.controls.node_limit":"Düğüm sınırı","memory.filters.title":"Filtreler","memory.filters.empty_title":"Henüz tür yüklenmedi","memory.filters.empty_desc":"Bellek verisi geldiğinde grafik filtreleri görünecek.","memory.graph.kicker":"Bellek Grafiği","memory.graph.heading":"Anlamsal bellek topolojisi","memory.graph.items":"öğe","memory.graph.edges":"kenar","memory.graph.shown":"gösterilen","memory.graph.matches":"{count} eşleşme","memory.graph.match":"{count} eşleşme","memory.graph.loading_title":"Bellek grafiği yükleniyor…","memory.graph.loading_desc":"Anlamsal bellek topolojisi ve ilişki kenarları getiriliyor.","memory.graph.error_title":"Bellek grafiği yüklenemiyor","memory.graph.retry":"Yeniden dene","memory.graph.empty_title":"Bellek bulunamadı","memory.graph.empty_desc":"Grafiği genişletmek için filtreleri ayarlayın, aramayı temizleyin veya düğüm sınırını artırın.","memory.none_selected_title":"Bellek seçilmedi","memory.none_selected_desc":"Meta veri, revizyon destekli detay ve paket üyeliğini incelemek için grafikte bir düğüm seçin.","memory.err.load":"Bellek grafiği yüklenemedi","assets.kicker":"Operasyonlar","assets.title":"Varlıklar","assets.search_placeholder":"Varlık ara…","assets.project":"Proje","assets.up":"Yukarı","assets.err.load":"Kumiho projeleri yüklenemedi. Kumiho API'sinin erişilebilir olduğundan emin olun.","assets.col.name":"Ad","assets.col.kind":"Tür","assets.col.author":"Yazar","assets.col.created":"Oluşturuldu","assets.loading.projects":"Projeler yükleniyor…","assets.loading.space":"Alan yükleniyor…","assets.loading.generic":"Yükleniyor…","assets.folder":"klasör","assets.empty.title":"Boş alan","assets.empty.desc":"Bu konumda klasör veya varlık yok.","assets.search.empty_title":"Sonuç yok","assets.search.empty_desc":'"{query}" ile eşleşen varlık yok.',"assets.search.result_count":'"{query}" için {count} sonuç',"assets.copy_kref":"kref'i kopyala","assets.close_inspector":"İnceleyiciyi kapat","assets.deprecated":"Kullanımdan kaldırıldı","assets.active":"Aktif","assets.rev_count":"{count} rev","assets.rev_count_one":"{count} rev","assets.by":"yazan: {author}","assets.section.revisions":"Revizyonlar","assets.section.artifacts":"Yapıtlar","assets.section.edges":"Kenarlar","assets.section.metadata":"Meta Veri","assets.section.revisions_empty":"Revizyon yok.","assets.section.artifacts_empty":"Yapıt yok.","assets.section.edges_empty":"Kenar yok.","assets.section.metadata_empty":"Meta veri yok.","assets.tag.latest":"en son","assets.tag.published":"yayınlandı","assets.action.view":"Görüntüle","assets.action.edit":"Düzenle","assets.action.restore":"Geri yükle","assets.action.deprecate":"Kullanımdan kaldır","assets.action.publish":"Yayınla","assets.action.published":"Yayınlandı","assets.action.save_artifact":"Yapıtı kaydet","assets.action.deprecate_item":"Seçili öğeyi kullanımdan kaldır","assets.action.restore_item":"Seçili öğeyi geri yükle","assets.action.deprecate_revision":"Seçili revizyonu kullanımdan kaldır","assets.action.restore_revision":"Seçili revizyonu geri yükle","assets.action.publish_revision":"Seçili revizyonu yayınlandı olarak etiketle","assets.action.edit_artifact":"Yapıtı düzenle","assets.action.deprecate_artifact":"Yapıtı kullanımdan kaldır","assets.action.restore_artifact":"Yapıtı geri yükle","assets.toast.item_deprecated":"Öğe kullanımdan kaldırıldı.","assets.toast.item_restored":"Öğe geri yüklendi.","assets.toast.revision_deprecated":"Revizyon kullanımdan kaldırıldı.","assets.toast.revision_restored":"Revizyon geri yüklendi.","assets.toast.revision_published":"Revizyon yayınlandı olarak etiketlendi.","assets.toast.artifact_deprecated":"Yapıt kullanımdan kaldırıldı.","assets.toast.artifact_restored":"Yapıt geri yüklendi.","assets.toast.artifact_saved":"Yapıt içeriği güncellendi.","assets.toast.artifact_saved_new_revision":"Güncellenen yapıtın eklendiği yeni bir revizyon oluşturuldu.","assets.err.action":"Varlık işlemi başarısız oldu.","assets.err.load_artifact":"Yapıt içeriği yüklenemedi.","assets.editor.title":"{name} düzenle","assets.editor.mutable_desc":"Kaydetmek, geçerli revizyondaki yapıt dosyasını günceller.","assets.editor.published_desc":"Bu revizyon yayınlanmış ve değiştirilemez. Kaydetmek, güncellenen yapıtın eklendiği yeni bir revizyon oluşturur.","config.kicker":"Operasyonlar","config.page_title":"Yapılandırma","config.reload":"Yeniden yükle","config.save_button":"Yapılandırmayı Kaydet","config.saving_button":"Kaydediliyor…","config.loading_title":"Yapılandırma yükleniyor…","config.toast.saved":"Yapılandırma kaydedildi.","config.err.load":"Yapılandırma yüklenemedi.","config.err.save":"Yapılandırma kaydedilemedi.","config.err.mcp_errors":"Kaydetmeden önce MCP sunucu hatalarını düzeltin.","config.map":"Yapılandırma Haritası","config.workspace":"TOML Çalışma Alanı","config.workspace.structured_heading":"Yapılandırılmış kontroller","config.workspace.source_heading":"Kaynak düzenleyici","config.tab.structured":"Yapılandırılmış","config.tab.source":"Kaynak","config.tabs_aria":"Yapılandırma çalışma alanı sekmeleri","config.hide_preview":"Önizlemeyi Gizle","config.show_preview":"Önizlemeyi Göster","config.mapped_paths":"Eşleştirilmiş TOML Yolları","config.structured.error_title":"Yapılandırılmış kontroller oluşturulamıyor","config.structured.error_desc":"Gruplandırılmış yapılandırma kontrollerinin gösterilebilmesi için ham TOML'un ayrıştırılabilir olması gerekir.","config.summary.title":"Ayrıştırılmış Özet","config.summary.error_title":"TOML ayrıştırılamıyor","config.summary.error_desc":"Özet paneli yalnızca düzenleyici ayrıştırılabilir TOML bölümleri içerdiğinde güncellenir.","config.source_health":"Kaynak Sağlığı","config.row.workspace_mode":"Çalışma Alanı Modu","config.row.preview":"Önizleme","config.row.sections":"Bölümler","config.row.parse_status":"Ayrıştırma Durumu","config.row.parse_valid":"Geçerli","config.row.parse_needs":"Dikkat Gerekiyor","config.mode.structured":"Yapılandırılmış","config.mode.source":"Kaynak","config.toggle.enabled":"Etkin","config.toggle.disabled":"Devre dışı","config.section.provider":"Sağlayıcı","config.section.provider_desc":"Varsayılan model sağlayıcısı, API yönlendirmesi ve üretim ayarları.","config.section.agent":"Ajan","config.section.agent_desc":"Ajan çalışma zamanı için döngü sınırları, bağlam bütçeleri ve muhakeme varsayılanları.","config.section.memory":"Bellek","config.section.memory_desc":"Bellek arka ucu, Kumiho bağlantısı ve kalıcılık davranışı.","config.section.runtime":"Çalışma Zamanı","config.section.runtime_desc":"Ağ geçidi bağlama ayarları, eşleştirme ve otonomi duruşu.","config.section.security":"Güvenlik / Maliyet","config.section.security_desc":"Denetim ve korumalı alan ayarları ile maliyet sınırı kontrolleri.","config.section.channels":"Kanallar","config.section.channels_desc":"Operasyonel kanallar için CLI ve mesajlaşma yüzeyi davranışı.","config.section.mcp":"MCP Sunucuları","config.section.mcp_desc":"Model Context Protocol istemcisi — üst düzey anahtarlar ve yapılandırılmış sunucu girdileri.","config.section.extra_desc":"config.toml içinde keşfedilen ek bölüm — genel düzenleyici.","config.generic.empty":"Bu bölümde henüz alan yok.","config.generic.empty_array":"(boş dizi)","config.generic.array_readonly":"Diziler genel düzenleyicide salt okunurdur — Kaynak sekmesinden düzenleyin.","config.provider.default_provider":"Varsayılan Sağlayıcı","config.provider.default_model":"Varsayılan Model","config.provider.temperature":"Sıcaklık","config.provider.timeout":"Sağlayıcı Zaman Aşımı","config.provider.max_tokens":"Sağlayıcı Maks. Token","config.agent.max_tool_iterations":"Maks. Araç Yinelemesi","config.agent.max_context_tokens":"Maks. Bağlam Token'ı","config.agent.max_history_messages":"Maks. Geçmiş Mesajı","config.agent.gpt55_context_window":"GPT-5.5 Bağlam Penceresi","config.agent.context_window_safety_ratio":"Bağlam Güvenlik Oranı","config.agent.parallel_tools":"Paralel Araçlar","config.agent.thinking_level":"Düşünce Seviyesi","config.memory.kumiho_enabled":"Kumiho Etkin","config.memory.memory_project":"Bellek Projesi","config.memory.harness_project":"Harness Projesi","config.memory.retrieval_limit":"Getirme Limiti","config.memory.backend":"Bellek Arka Ucu","config.memory.auto_save":"Otomatik Kaydet","config.memory.snapshots":"Anlık Görüntüler","config.runtime.gateway_host":"Ağ Geçidi Ana Bilgisayarı","config.runtime.gateway_port":"Ağ Geçidi Bağlantı Noktası","config.runtime.require_pairing":"Eşleştirme Gerekli","config.runtime.session_persistence":"Oturum Kalıcılığı","config.runtime.autonomy_level":"Otonomi Seviyesi","config.runtime.max_actions_hour":"Saatte Maks. Eylem","config.security.audit_enabled":"Denetim Etkin","config.security.sandbox_backend":"Korumalı Alan Arka Ucu","config.security.daily_limit":"Günlük Limit USD","config.security.monthly_limit":"Aylık Limit USD","config.security.warn_percent":"Uyarı Yüzdesi","config.channels.cli":"CLI Kanalı","config.channels.ack_reactions":"Ack Tepkileri","config.channels.show_tool_calls":"Araç Çağrılarını Göster","config.channels.message_timeout":"Mesaj Zaman Aşımı (sn)","config.summary.api_url":"API URL","config.summary.provider":"Sağlayıcı","config.summary.model":"Model","config.summary.temperature":"Sıcaklık","config.summary.timeout":"Zaman Aşımı","config.summary.max_tokens":"Maks. Token","config.summary.runtime":"Çalışma Zamanı","config.summary.gateway":"Ağ Geçidi","config.summary.pairing_required":"Eşleştirme Gerekli","config.summary.session_persistence":"Oturum Kalıcılığı","config.summary.autonomy_level":"Otonomi Seviyesi","config.summary.workspace_only":"Yalnızca Çalışma Alanı","config.summary.max_actions_hour":"Saatte Maks. Eylem","config.summary.memory":"Bellek","config.summary.backend":"Arka Uç","config.summary.auto_save":"Otomatik Kaydet","config.summary.hygiene":"Hijyen","config.summary.snapshots":"Anlık Görüntüler","config.summary.kumiho_enabled":"Kumiho Etkin","config.summary.memory_project":"Bellek Projesi","config.summary.retrieval_limit":"Getirme Limiti","config.summary.safety_cost":"Güvenlik / Maliyet","config.summary.audit_enabled":"Denetim Etkin","config.summary.sandbox_backend":"Korumalı Alan Arka Ucu","config.summary.daily_limit":"Günlük Limit","config.summary.monthly_limit":"Aylık Limit","config.summary.warn_percent":"Uyarı %","config.summary.channels":"Kanallar","config.summary.cli":"CLI","config.summary.telegram":"Telegram","config.summary.discord":"Discord","config.summary.slack":"Slack","config.summary.matrix":"Matrix","config.summary.signal":"Signal","config.summary.whatsapp":"WhatsApp","config.row.enabled":"Etkin","config.row.disabled":"Devre dışı","config.mcp.title":"MCP","config.mcp.enabled":"MCP Etkin","config.mcp.deferred":"Geciktirilmiş Yükleme","config.mcp.servers":"Sunucular","config.mcp.no_servers":"Henüz yapılandırılmış sunucu yok.","config.mcp.server_count":"{count} sunucu yapılandırıldı.","config.mcp.server_count_one":"1 sunucu yapılandırıldı.","config.mcp.add_server":"MCP Sunucusu Ekle","config.mcp.confirm_remove":"{label} kaldırılsın mı?","config.mcp.entry_label":"giriş {index}","config.mcp.server_default":"Sunucu {index}","config.mcp.stdio_empty":"stdio — komut ayarlanmadı","config.mcp.transport_empty":"{transport} — url ayarlanmadı","config.mcp.test":"Test","config.mcp.testing":"Test ediliyor…","config.mcp.test_tooltip":"MCP initialize + tools/list el sıkışmasını çalıştır","config.mcp.test_blocked":"Test etmeden önce doğrulama hatalarını düzeltin","config.mcp.delete_label":"{label} sil","config.mcp.connecting":"bağlanıyor…","config.mcp.tool_count":"{count} araç · {latency}ms","config.mcp.tool_count_one":"1 araç · {latency}ms","config.mcp.tools_list":"araçlar: {list}","config.mcp.handshake_failed":"el sıkışma başarısız","config.mcp.field_name":"Ad","config.mcp.field_name_placeholder":"ör. memory","config.mcp.field_transport":"Taşıma","config.mcp.field_command":"Komut","config.mcp.field_command_placeholder":"/usr/local/bin/mcp-server","config.mcp.field_args":"Argümanlar","config.mcp.field_args_placeholder":"--flag","config.mcp.field_env":"Ortam","config.mcp.field_env_key":"KEY","config.mcp.field_env_value":"value","config.mcp.field_url":"URL","config.mcp.field_url_placeholder":"https://example.com/mcp","config.mcp.field_headers":"Başlıklar","config.mcp.field_headers_key":"Header-Name","config.mcp.field_headers_value":"value","config.mcp.field_timeout":"Zaman Aşımı (ms)","config.mcp.field_timeout_placeholder":"30000","config.mcp.add_entry":"{label} Ekle","config.mcp.remove_entry":"{label} girişi {index} kaldır","landing.skip_link":"Ana içeriğe atla","landing.nav.aria_label":"Site gezintisi","landing.nav.logo_alt":"Revka logosu","landing.nav.features":"Özellikler","landing.nav.launch":"Paneli Aç","landing.hero.aria_label":"Tanıtım","landing.hero.badge":"Bellek-yerel · Rust-yerel · Graf-yerel","landing.hero.tagline":"Bellek yerelli ajan çalışma zamanı","landing.hero.description":"Kumiho'nun graf yerelli belleği üzerine kurulu. Her oturum, plan, yetenek ve güven skoru bir grafta yaşar — yaşandıysa, sorgulanabilir.","landing.hero.cta_primary":"Paneli Aç","landing.hero.cta_secondary":"Özellikleri Keşfet","landing.hero.banner_alt":"Revka — Bellek yerelli ajan çalışma zamanı paneli","landing.hero.scroll_cue":"Kaydır","landing.stats.aria_label":"Temel istatistikler","landing.stats.runtime_label":"Çalışma zamanı","landing.stats.namespaces_label":"Ad alanları","landing.stats.memory_label":"Bellek grafı","landing.stats.goals_label":"Hedef takibi","landing.stats.orchestration_label":"Orkestrasyon","landing.pillars.aria_label":"Sütunlar","landing.pillars.badge":"Üç sütun","landing.pillars.title":"Tek çalışma zamanı, her yüzey","landing.pillars.description":"Revka üç temel üzerine kuruludur — sağlayıcıdan bağımsız ajanlar, graf yerelli bellek ve her kanaldan erişim.","landing.pillars.agents.title":"Ajanlar","landing.pillars.agents.desc":"Sağlayıcıdan bağımsız ajanlar (OpenAI, Anthropic, yerel modeller) iş akışları ve sürüler aracılığıyla düzenlenir — hepsi kendi makinende.","landing.pillars.memory.title":"Bellek","landing.pillars.memory.desc":"Kumiho, SQLite veya Markdown üzerinden oturumlar arası kalıcı bilgi. Ajanların seni, projelerini ve önceki kararları hatırlar.","landing.pillars.channels.title":"Kanallar","landing.pillars.channels.desc":"Revka ile Telegram, Discord, Slack, iMessage, Matrix, e-posta ve daha fazlası üzerinden konuş. Tek çalışma zamanı, her yüzey.","landing.features.aria_label":"Özellikler","landing.features.badge":"Yetenekler","landing.features.title":"Ajan çağı için tasarlandı","landing.features.description":"Her bileşen kalıcı bellek ve çok ajanlı iş birliği etrafında tasarlandı — üretimden emekliliğe kadar.","landing.features.featured_badge":"Temel bellek altyapısı","landing.features.memory.title":"Kumiho Bellek","landing.features.memory.desc":"Graf yerelli kalıcı bellek. Her oturum, plan ve yetenek sürümlenir, bağlanır ve sorgulanabilir — yedek arka uç yok.","landing.features.operator.title":"Operator","landing.features.operator.desc":"Rol delegasyonlu (kodlayıcı, inceleyici, araştırmacı) çok ajanlı orkestrasyon, geri çağırmalı üretim ve güven puanlaması.","landing.features.pool.title":"Ajan Havuzu","landing.features.pool.desc":"Rol, yetenek ve model tercihi içeren yeniden kullanılabilir ajan tanımları. Kullanım takibi yüksek performans gösterenleri öne çıkarır.","landing.features.clawhub.title":"ClawHub Pazar Yeri","landing.features.clawhub.desc":"Ajan şablonlarını, yeteneklerini ve takım yapılandırmalarını ortak bir kayıt defterinde yayınla, ara ve kur.","landing.features.goals.title":"Hedef Hiyerarşisi","landing.features.goals.desc":"Üç katmanlı hedef takibi: stratejik, taktik ve görev düzeyi — hepsi durum ve bağımlılıklarla grafta saklanır.","landing.features.audit.title":"Denetim İzi","landing.features.audit.desc":"Merkle karma zincirli, kurcalamaya karşı koruyucu günlükleme. Her eylem kriptografik olarak doğrulanabilir bir geçmişle kayıt altına alınır.","landing.how.aria_label":"Nasıl çalışır","landing.how.badge":"İş akışı","landing.how.title":"Revka nasıl çalışır","landing.how.description":"Ajan dağıtımından kalıcı geri çağırmaya — tüm yaşam döngüsü birbirine bağlı üç adımda yönetilir.","landing.how.step1.title":"Ajanını dağıt","landing.how.step1.desc":"Rol, yetenek ve model tercihlerini yapılandır. Revka şablonu yeniden kullanım ve geri çağırma için grafa kaydeder.","landing.how.step2.title":"Bellek birikir","landing.how.step2.desc":"Her oturum, plan, yetenek ve etkileşim Kumiho'da sürümlenir ve kenarlarla bağlanır. Hiçbir şey kaybolmaz.","landing.how.step3.title":"Her şeyi sorgula","landing.how.step3.desc":"Tüm ajan geçmişinden iç görüler çıkarmak için hedef hiyerarşilerini, güven puanlarını ve graf gezinmesini kullan.","landing.cli.aria_label":"CLI referansı","landing.cli.badge":"CLI","landing.cli.title":"Terminalden yönet","landing.cli.description":"Panelin ve kanalların yanıt vermesi için daemon çalışıyor olmalı. Arayüzde yapabildiğin her şeyin bir komut karşılığı vardır.","landing.cli.cmd.onboard":"İnteraktif kurulum sihirbazını çalıştır","landing.cli.cmd.reinit":"Sıfırdan sıfırla ve yeniden yapılandır (tünel dahil)","landing.cli.cmd.daemon":"Uzun ömürlü çalışma zamanını başlat","landing.cli.cmd.doctor":"Daemon, zamanlayıcı ve kanal sağlığını kontrol et","landing.cli.cmd.status":"Tüm sistem durumunu yazdır","landing.cli.cmd.channel_list":"Yapılandırılmış kanalları listele","landing.cli.cmd.channel_add":"Bir Telegram botu ekle","landing.cli.cmd.providers":"Desteklenen AI sağlayıcılarını listele","landing.cli.cmd.memory_stats":"Ajan bellek boyutunu incele","landing.cli.cmd.service_install":"launchd/systemd kullanıcı servisi olarak kur","landing.arch.aria_label":"Mimari","landing.arch.badge":"Graf-yerel","landing.arch.title":"Her şey grafta","landing.arch.description":"Tüm kalıcı durum, Kumiho içindeki sıkı bir ad alanı hiyerarşisi altında yaşar — sürümlenir, kenarlarla bağlanır ve oturumlar arası sorgulanabilir.","landing.arch.ns.agentpool":"Yeniden kullanılabilir ajan şablonları","landing.arch.ns.plans":"Yürütme planları ve adımları","landing.arch.ns.sessions":"Oturumlar arası süreklilik","landing.arch.ns.goals":"Stratejik hedef takibi","landing.arch.ns.clawhub":"Yayınlanmış şablonlar ve yetenekler","landing.arch.ns.teams":"Takım tanımları","landing.arch.ns.skills":"Paylaşılan yetenek kitaplığı","landing.arch.ns.trust":"Güven puanları ve geçmişi","landing.arch.connection_note":"Tüm ad alanları Kumiho graf kenarlarıyla bağlıdır","landing.tunnels.aria_label":"Tüneller hakkında","landing.tunnels.badge":"Tüneller","landing.tunnels.title":"Herkese açık erişim, yerel güven","landing.tunnels.description_prefix":"Ağ geçidin ","landing.tunnels.description_suffix":" üzerinde çalışır — yalnızca bu makineden erişilebilir. Webhook tabanlı kanallar (Telegram, Slack olayları, WhatsApp, WeChat) genel bir URL gerektirir. Tünel, güvenlik duvarı portları açmadan genel bir ana bilgisayar adını yerel ağ geçidine iletir.","landing.tunnels.provider.cloudflare.name":"Cloudflare Tunnel","landing.tunnels.provider.cloudflare.desc":"Ücretsiz, üretim kalitesinde. Bir Zero Trust hesabı ve tünel belirteci gerektirir.","landing.tunnels.provider.ngrok.name":"ngrok","landing.tunnels.provider.ngrok.desc":"Hızlı ve geçici. Yerel geliştirme ve test için harika.","landing.tunnels.provider.tailscale.name":"Tailscale Funnel","landing.tunnels.provider.tailscale.desc":"Tailnet kimliğinle bir tailnet servisini herkese açık paylaş.","landing.tunnels.provider.custom.name":"Özel","landing.tunnels.provider.custom.desc":"Kendi ters proxy veya genel URL'ini getir.","landing.tunnels.setup_hint_prefix":"Çalıştır: ","landing.tunnels.setup_hint_suffix":" ve sorulduğunda bir sağlayıcı seç.","landing.cta.aria_label":"Başla","landing.cta.headline_prefix":"İnşa etmeye ","landing.cta.headline_highlight":"başlamaya","landing.cta.headline_suffix":" hazır mısın?","landing.cta.description":"Ajanları yönetmek, yetenek kitaplığına göz atmak, takımları düzenlemek ve grafın hatırladığı her şeyi keşfetmek için paneli aç.","landing.cta.button":"Paneli Aç","landing.footer.tagline":"Bellek yerelli ajan çalışma zamanı"},ko:{"nav.dashboard":"대시보드","nav.agent":"에이전트","nav.tools":"도구","nav.cron":"예약 작업","nav.integrations":"연동","nav.memory":"메모리","nav.config":"설정","nav.cost":"비용 추적","nav.logs":"로그","nav.doctor":"진단","nav.agents":"에이전트 풀","nav.skills":"스킬 라이브러리","nav.teams":"에이전트 팀","nav.assets":"자산 브라우저","nav.skins":"스킨","nav.memoryAuditor":"메모리 감사","nav.audit":"감사 추적","nav.canvas":"캔버스","nav.workflows":"워크플로","dashboard.title":"대시보드","dashboard.provider":"제공자","dashboard.model":"모델","dashboard.uptime":"가동 시간","dashboard.temperature":"온도","dashboard.gateway_port":"게이트웨이 포트","dashboard.memory_backend":"메모리 백엔드","dashboard.paired":"페어링","dashboard.channels":"채널","dashboard.health":"상태","dashboard.status":"상태","dashboard.overview":"개요","dashboard.system_info":"시스템 정보","dashboard.quick_actions":"빠른 작업","agent.title":"에이전트 채팅","agent.send":"전송","agent.placeholder":"메시지를 입력하세요...","agent.start_conversation":"대화를 시작하려면 메시지를 보내세요","agent.type_message":"메시지를 입력하세요...","agent.connecting":"연결 중...","agent.connected":"연결됨","agent.disconnected":"연결 끊김","agent.reconnecting":"재연결 중...","agent.thinking":"생각 중...","agent.tool_call":"도구 호출","agent.tool_result":"도구 결과","agent.connection_error":"연결 오류. 재연결을 시도합니다...","agent.tool_call_prefix":"[도구 호출]","agent.tool_result_prefix":"[도구 결과]","agent.error_prefix":"[오류]","agent.unknown_error":"알 수 없는 오류","agent.send_error":"메시지 전송에 실패했습니다. 다시 시도해 주세요.","agent.copy_message":"메시지 복사","agent.connected_status":"연결됨","agent.disconnected_status":"연결 끊김","agent.copy_code":"코드 복사","agent.copied_code":"코드 복사됨","agent.copy":"복사","agent.copied":"복사됨","agent.code_language_fallback":"코드","agent.jump_to_latest":"최신으로 이동","agent.placeholder_steer_next_step":"다음 단계 조정…","agent.placeholder_queue_next":"다음 메시지 대기열 추가…","agent.placeholder_message":"메시지…","agent.placeholder_connecting":"연결 중…","agent.send_mode":"전송 모드","agent.send_mode_queue":"대기열","agent.send_mode_steer":"조정","agent.queue_after_current_response":"현재 응답 뒤에 대기열 추가","agent.steer_text_only":"조정은 텍스트만 지원합니다. 첨부는 대기열에 추가됩니다","agent.steer_next_step":"다음 단계 조정","agent.queue_message":"메시지 대기열 추가","agent.send_message":"메시지 전송","agent.send_enter":"전송 (Enter)","agent.steer_prefix":"[조정]","agent.tool_output_truncated":"채팅 보기에서 출력이 잘렸습니다. 전체 결과는 복사하거나 실행 로그에서 확인하세요.","agent.activity_input_label":"입력","agent.activity_diff_label":"Diff","agent.activity_output_label":"출력","agent.reasoning_trace_label":"사고 과정","tools.name":"이름","tools.parameters":"매개변수","tools.search":"도구 검색...","tools.empty":"사용 가능한 도구가 없습니다.","tools.count":"전체 도구","tools.agent_tools":"에이전트 도구","tools.cli_tools":"CLI 도구","tools.path":"경로","tools.version":"버전","tools.category":"카테고리","tools.load_error":"도구를 불러오지 못했습니다","cron.title":"예약 작업","cron.scheduled_tasks":"예약된 작업","cron.add":"작업 추가","cron.add_job":"작업 추가","cron.add_modal_title":"크론 작업 추가","cron.delete":"삭제","cron.enable":"활성화","cron.disable":"비활성화","cron.name":"이름","cron.name_optional":"이름 (선택)","cron.command":"명령어","cron.command_required":"명령어","cron.schedule":"스케줄","cron.schedule_required":"스케줄","cron.next_run":"다음 실행","cron.last_run":"마지막 실행","cron.last_status":"마지막 상태","cron.enabled":"활성화됨","cron.enabled_status":"활성화됨","cron.disabled_status":"비활성화됨","cron.empty":"예약된 작업이 없습니다.","cron.confirm_delete":"이 작업을 삭제하시겠습니까?","cron.load_error":"크론 작업을 불러오지 못했습니다","cron.validation_error":"스케줄과 명령어가 필요합니다.","cron.add_error":"작업 추가에 실패했습니다","cron.delete_error":"작업 삭제에 실패했습니다","cron.cancel":"취소","cron.adding":"추가 중...","cron.id":"ID","cron.actions":"작업","cron.loading_run_history":"실행 기록 불러오는 중...","cron.load_run_history_error":"실행 기록을 불러오지 못했습니다","cron.no_runs":"아직 실행 기록이 없습니다.","cron.recent_runs":"최근 실행","cron.yes":"예","cron.no":"아니오","cron.edit":"편집","cron.edit_modal_title":"크론 작업 편집","cron.edit_error":"작업 업데이트에 실패했습니다","cron.saving":"저장 중...","cron.save":"저장","integrations.available":"사용 가능","integrations.active":"활성","integrations.coming_soon":"준비 중","integrations.category":"카테고리","integrations.status":"상태","integrations.search":"연동 검색...","integrations.empty":"연동을 찾을 수 없습니다.","integrations.activate":"활성화","integrations.deactivate":"비활성화","integrations.load_error":"연동을 불러오지 못했습니다","integrations.status_active":"활성","integrations.status_available":"사용 가능","integrations.status_coming_soon":"준비 중","memory.title":"메모리 저장소","memory.memory_title":"메모리","memory.search":"메모리 검색...","memory.search_placeholder":"메모리 항목 검색...","memory.add":"메모리 저장","memory.add_memory":"메모리 추가","memory.add_modal_title":"메모리 추가","memory.delete":"삭제","memory.key":"키","memory.key_required":"키","memory.content":"내용","memory.content_required":"내용","memory.category":"카테고리","memory.category_optional":"카테고리 (선택)","memory.timestamp":"타임스탬프","memory.session":"세션","memory.score":"점수","memory.empty":"메모리 항목을 찾을 수 없습니다.","memory.confirm_delete":"이 메모리 항목을 삭제하시겠습니까?","memory.all_categories":"전체 카테고리","memory.search_button":"검색","memory.load_error":"메모리를 불러오지 못했습니다","memory.saving":"저장 중...","memory.validation_error":"키와 내용이 필요합니다.","memory.store_error":"메모리 저장에 실패했습니다","memory.delete_error":"메모리 삭제에 실패했습니다","memory.delete_confirm":"삭제하시겠습니까?","memory.yes":"예","memory.no":"아니오","memory.cancel":"취소","config.title":"설정","config.save":"저장","config.saving":"저장 중...","config.reset":"초기화","config.saved":"설정이 저장되었습니다.","config.error":"설정 저장에 실패했습니다.","config.loading":"설정 불러오는 중...","config.editor_placeholder":"TOML 설정...","config.configuration_title":"설정","config.sensitive_title":"민감한 필드가 마스킹되어 있습니다","config.sensitive_hint":"API 키, 토큰, 비밀번호는 보안을 위해 숨겨져 있습니다. 마스킹된 값을 업데이트하려면 전체 값을 새 값으로 교체하세요.","config.save_success":"설정이 저장되었습니다.","config.save_error":"설정 저장에 실패했습니다","config.toml_label":"TOML 설정","config.lines":"줄","cost.session":"세션 비용","cost.daily":"일일 비용","cost.monthly":"월간 비용","cost.request_count":"요청 수","cost.by_model":"모델별 비용","cost.model":"모델","cost.usd":"비용 (USD)","cost.load_error":"비용 데이터를 불러오지 못했습니다","cost.total_requests":"전체 요청","cost.token_statistics":"토큰 통계","cost.avg_tokens_per_request":"요청당 평균 토큰","cost.cost_per_1k_tokens":"1K 토큰당 비용","cost.model_breakdown":"모델별 분석","cost.cost":"비용","cost.share":"비중","logs.live_logs":"실시간 로그","logs.clear":"지우기","logs.filter":"로그 필터...","logs.filter_label":"필터","logs.empty":"로그 항목이 없습니다.","logs.events":"이벤트","logs.paused_hint":"로그 스트리밍이 일시정지되었습니다.","logs.waiting_hint":"이벤트 대기 중...","doctor.diagnostics_title":"진단","doctor.run_diagnostics":"진단 실행","doctor.running_btn":"실행 중...","doctor.running_desc":"진단을 실행하고 있습니다...","doctor.running_hint":"몇 초 정도 걸릴 수 있습니다.","doctor.error":"오류","doctor.severity":"심각도","doctor.category":"카테고리","doctor.message":"메시지","doctor.empty":"아직 진단이 실행되지 않았습니다.","doctor.summary":"진단 요약","doctor.issues_found":"발견된 문제","doctor.warnings_summary":"경고","doctor.all_clear":"이상 없음","doctor.system_diagnostics":"시스템 진단","doctor.empty_hint":'"진단 실행"을 클릭하여 설치 상태를 확인하세요.',"auth.pair":"기기 페어링","auth.pairing_code":"페어링 코드","auth.pair_button":"페어링","auth.logout":"로그아웃","auth.pairing_success":"페어링 성공!","auth.pairing_failed":"페어링 실패. 다시 시도해 주세요.","auth.enter_code":"에이전트에 연결하려면 페어링 코드를 입력하세요.","common.loading":"불러오는 중...","common.error":"오류가 발생했습니다.","common.retry":"재시도","common.cancel":"취소","common.confirm":"확인","common.save":"저장","common.delete":"삭제","common.edit":"편집","common.execute":"실행","common.close":"닫기","common.yes":"예","common.no":"아니오","common.search":"검색...","common.no_data":"데이터가 없습니다.","common.refresh":"새로고침","common.back":"뒤로","common.actions":"작업","common.name":"이름","common.description":"설명","common.status":"상태","common.created":"생성일","common.updated":"수정일","health.title":"시스템 상태","health.component":"컴포넌트","health.status":"상태","health.last_ok":"마지막 정상","health.last_error":"마지막 오류","health.restart_count":"재시작 횟수","health.pid":"프로세스 ID","health.uptime":"가동 시간","health.updated_at":"마지막 업데이트","dashboard.provider_model":"제공자 / 모델","dashboard.since_last_restart":"마지막 재시작 이후","dashboard.paired_yes":"예","dashboard.paired_no":"아니오","dashboard.cost_overview":"비용 개요","dashboard.active_channels":"활성 채널","dashboard.filter_active":"활성","dashboard.filter_all":"전체","dashboard.no_active_channels":"활성 채널이 없습니다","dashboard.component_health":"컴포넌트 상태","dashboard.load_error":"대시보드를 불러오지 못했습니다","dashboard.session_label":"세션","dashboard.daily_label":"일간","dashboard.monthly_label":"월간","dashboard.total_tokens_label":"전체 토큰","dashboard.requests_label":"요청","dashboard.by_model":"모델별","dashboard.no_channels":"설정된 채널이 없습니다","dashboard.active":"활성","dashboard.inactive":"비활성","dashboard.no_components":"보고 중인 컴포넌트가 없습니다","dashboard.restarts":"재시작","dashboard.tab_overview":"개요","dashboard.tab_sessions":"세션","dashboard.tab_channels":"채널","dashboard.tab_audit":"감사 추적","dashboard.tab_workflows":"워크플로","dashboard.audit_disabled":"감사 로깅이 활성화되지 않았습니다. 이벤트를 보려면 설정에서 활성화하세요.","dashboard.audit_all_types":"모든 이벤트 유형","dashboard.audit_refresh":"새로고침","dashboard.audit_verify_chain":"체인 검증","dashboard.audit_chain_valid":"체인 무결성 검증됨","dashboard.audit_chain_invalid":"체인 무결성 검증 실패","dashboard.audit_no_events":"감사 이벤트를 찾을 수 없습니다","dashboard.sessions_title":"활성 세션","dashboard.no_sessions":"활성 세션이 없습니다","dashboard.session_id":"세션 ID","dashboard.session_channel":"채널","dashboard.session_started":"시작","dashboard.session_last_activity":"마지막 활동","dashboard.session_status":"상태","dashboard.session_messages":"메시지","dashboard.session_details":"세션 상세","dashboard.session_history":"기록 보기","dashboard.channels_title":"채널 상태","dashboard.no_channels_detail":"채널 상세 정보를 사용할 수 없습니다","dashboard.channel_type":"유형","dashboard.channel_messages":"메시지","dashboard.channel_last_message":"마지막 메시지","dashboard.channel_config":"설정","dashboard.channel_enabled":"활성화됨","dashboard.channel_disabled":"비활성화됨","dashboard.loading_sessions":"세션 불러오는 중...","dashboard.loading_channels":"채널 불러오는 중...","dashboard.load_sessions_error":"세션을 불러오지 못했습니다","dashboard.load_channels_error":"채널을 불러오지 못했습니다","dashboard.never":"없음","dashboard.tab_clawhub":"ClawHub","dashboard.tab_nodes":"노드","dashboard.clawhub_title":"ClawHub 마켓플레이스","dashboard.clawhub_search":"템플릿, 스킬, 팀 검색…","dashboard.clawhub_no_items":"항목을 찾을 수 없습니다. 첫 번째 템플릿이나 스킬을 게시하세요!","dashboard.clawhub_publish":"게시","dashboard.clawhub_install":"설치","dashboard.clawhub_downloads":"다운로드","dashboard.clawhub_by":"작성자","dashboard.nodes_title":"연결된 노드","dashboard.nodes_no_nodes":"연결된 노드가 없습니다. 노드는 WebSocket을 통해 /ws/nodes에 연결됩니다.","dashboard.nodes_capabilities":"기능","dashboard.nodes_invoke":"호출","settings.title":"설정","settings.tab.appearance":"외관","settings.tab.typography":"타이포그래피","settings.appearance":"외관","settings.typography":"타이포그래피","settings.fontUi":"UI 글꼴","settings.fontMono":"코드 글꼴","settings.fontSize":"UI 글꼴 크기","settings.fontMonoSize":"코드 글꼴 크기","settings.preview":"미리보기","settings.previewText":"다람쥐 헌 쳇바퀴에 타고파.","settings.fontNote":"글꼴 변경은 페이지 새로고침 후 적용됩니다.","settings.language":"언어","chat_panel.ai_assistant":"AI 어시스턴트","chat_panel.agent_placeholder":'에이전트를 만들어 달라고 요청하세요, 예: "Rust 보안 전문가를 만들어줘"',"chat_panel.team_placeholder":'팀을 구성해 달라고 요청하세요, 예: "프론트엔드 마이그레이션 팀을 만들어줘"',"chat_panel.skill_placeholder":'스킬을 만들어 달라고 요청하세요, 예: "코드 리뷰 스킬을 만들어줘"',"chat_panel.close":"닫기","clawhub.tab_local":"로컬 스킬","clawhub.tab_clawhub":"ClawHub","clawhub.search_placeholder":"ClawHub 스킬 검색...","clawhub.trending":"인기","clawhub.install":"설치","clawhub.installing":"설치 중...","clawhub.installed":"설치됨","clawhub.downloads":"다운로드","clawhub.stars":"스타","clawhub.verified":"인증됨","clawhub.no_results":"스킬을 찾을 수 없습니다","clawhub.search_hint":"ClawHub에서 13,000개 이상의 커뮤니티 스킬 검색","clawhub.error":"ClawHub에 연결할 수 없습니다","clawhub.details":"상세정보","clawhub.less":"접기","clawhub.author":"작성자","clawhub.tags":"태그","theme.mode":"테마 모드","theme.accent":"강조 색상","theme.system":"시스템","theme.dark":"다크","theme.light":"라이트","theme.oled":"OLED 블랙","nav.pairing":"페어링","nav.section.orchestration":"오케스트레이션","nav.section.operations":"운영","nav.section.inspection":"검사","nav.dashboard.blurb":"실시간 런타임 상태 및 활성 DAG 상태","nav.workflows.blurb":"DAG을 정의하고 동일한 흐름에서 실행 기록으로 이동","nav.agents.blurb":"재사용 가능한 행위자 및 워크플로 참여자","nav.canvas.blurb":"시각적 작업 공간 및 오케스트레이션 캔버스","nav.teams.blurb":"위임 토폴로지 및 소유권 보기","nav.assets.blurb":"아티팩트 및 워크플로 관련 리소스","nav.skins.blurb":"토큰 및 자산 기반 UI 스킨","nav.skills.blurb":"재사용 가능한 운영 기능","nav.tools.blurb":"에이전트 도구 카탈로그 및 CLI 바이너리","nav.integrations.blurb":"연결된 시스템 및 채널 표면","nav.cron.blurb":"예약된 작업 및 따라잡기 동작","nav.pairing.blurb":"기기 등록 및 신뢰 관리","nav.config.blurb":"런타임 TOML 및 운영 구성","nav.cost.blurb":"워크플로 및 실행별 지출 및 효율성","nav.memory.blurb":"Kumiho 메모리 그래프 탐색기 및 리비전","nav.logs.blurb":"운영 추적 및 노드 연결 이벤트","nav.audit.blurb":"신뢰 체인 및 승인 검증","nav.doctor.blurb":"진단 및 런타임 복구 상태","sidebar.brand_subtitle":"에이전트 OS","sidebar.shell":"Revka","sidebar.shell_description":"로컬 우선의 에이전트 OS로, 프로젝트 전반의 AI 워크플로, 도구, 런타임을 오케스트레이션합니다.","header.tagline":"오케스트레이션 우선의 에이전트 운영 체제.","header.runtime_healthy":"런타임 정상","header.trust_verified":"신뢰 검증됨","header.trust_unverified":"신뢰 미검증","header.trust_checking":"신뢰 검증 중…","header.operator":"오퍼레이터","common.duplicate":"복제","common.reenable":"다시 활성화","common.deprecate":"사용 중지","common.create":"생성","dashboard.kicker":"오케스트레이션 센터","dashboard.live_orchestration_pane":"실시간 오케스트레이션 패널","dashboard.active_workflow_posture":"활성 워크플로 상태","dashboard.open_workflow_definition":"워크플로 정의 열기","dashboard.selected_run":"선택된 실행","dashboard.run_posture":"실행 상태","dashboard.signal_focus":"신호 포커스","dashboard.hotspots":"핫스팟","dashboard.count.running":"실행 중","dashboard.count.failed":"실패","dashboard.count.completed":"완료","dashboard.count.pending":"대기","dashboard.count.skipped":"건너뜀","dashboard.prev_signal":"이전 신호","dashboard.next_signal":"다음 신호","dashboard.intervention_points":"{count}개의 개입 지점","dashboard.label.failure":"실패: {id}","dashboard.label.running":"실행 중: {id}","dashboard.label.blocked":"차단됨: {id}","dashboard.selected_step":"선택된 단계","dashboard.inspect_node_in_runs":"실행 작업 공간에서 이 노드 검사","dashboard.open_definition_node":"정의 노드 열기","dashboard.select_dag_node":"활성 분기를 검사하려면 DAG에서 노드를 선택하세요.","dashboard.priority_timeline":"우선순위 타임라인","dashboard.no_run_selected":"선택된 실행이 없습니다.","dashboard.open_full_run_workspace":"전체 실행 작업 공간 열기","dashboard.open_all_runs":"모든 워크플로 실행 열기","dashboard.status.blocked":"차단됨","dashboard.scene.operator":"오퍼레이터 브리프","dashboard.scene.error":"대시보드 텔레메트리가 불안정합니다. 다음 액션 전에 실행 레일과 로그를 확인하세요.","dashboard.scene.selected_run":"{workflow}는 현재 {status} 상태입니다. {completed}/{total} 단계가 완료됐습니다.","dashboard.scene.run_failed":"{workflow}에 확인이 필요합니다. {failed}개 단계가 실패했고 {completed}/{total} 단계가 완료됐습니다.","dashboard.scene.active_overview":"{definitions}개 워크플로 정의에서 {active}개 실행이 진행 중입니다.","dashboard.scene.idle_overview":"선택된 실행이 없습니다. {definitions}개 정의가 준비됐고 총 {total}회 실행이 기록됐습니다.","workflows.kicker":"오케스트레이션 센터","workflows.title":"워크플로","workflows.create":"워크플로 생성","workflows.workflow_info":"v{version} · {steps}개 노드 · {runs}회 실행","workflows.workflow_info_short":"v{version} · {steps}개 노드","workflows.status.off":"꺼짐","workflows.status.ready":"준비됨","workflows.tab.definition":"정의","workflows.tab.runs":"실행","workflows.loading":"워크플로를 불러오는 중…","workflows.empty_title":"아직 워크플로가 없습니다","workflows.empty_desc":"시작하려면 첫 번째 워크플로를 생성하세요.","workflows.definition_unavailable_title":"워크플로 정의를 사용할 수 없습니다","workflows.definition_unavailable_desc":"런타임이 이 워크플로에 대해 빈 정의를 반환했습니다 — 그래프를 렌더링할 수 없습니다. 이는 백엔드 데이터 문제이며 업스트림에서 수정해야 합니다.","workflows.no_runs_title":"아직 실행이 없습니다","workflows.no_runs_desc":"실행 상태를 보려면 이 워크플로를 실행하세요.","workflows.open_node_in_runs":"실행에서 노드 열기","workflows.select_dag_node":"DAG에서 노드를 선택하세요.","workflows.run_step":"실행 단계","workflows.select_dag_node_step":"단계를 검사하려면 DAG 노드를 선택하세요.","workflows.save_failure":"워크플로 저장 실패","workflows.save_failure_dot":"워크플로 저장에 실패했습니다.","workflows.run_failure":"워크플로 실행 시작 실패","workflows.status_failure":"워크플로 상태 변경 실패","workflows.status_failure_dot":"워크플로 상태 변경에 실패했습니다.","workflows.delete_failure":"워크플로 삭제 실패","workflows.delete_failure_dot":"워크플로 삭제에 실패했습니다.","workflows.toast.updated":'워크플로 "{name}"이(가) 업데이트되었습니다.',"workflows.toast.created":'워크플로 "{name}"이(가) 생성되었습니다.',"workflows.toast.reenabled":'워크플로 "{name}"이(가) 다시 활성화되었습니다.',"workflows.toast.deprecated":'워크플로 "{name}"이(가) 사용 중지되었습니다.',"workflows.toast.deleted":'워크플로 "{name}"이(가) 삭제되었습니다.',"workflows.toast.run_started":'워크플로 "{name}"이(가) 시작되었습니다 (실행 {runId}).',"workflows.run_option":"{prefix} — {status} ({completed}/{total})","workflows.copy_suffix":"사본","doctor.kicker":"검사","doctor.title":"닥터","doctor.description":"런타임 진단을 실행하고 Revka 스택 전반에 걸친 그룹화된 상태 결과를 검사합니다.","doctor.run":"진단 실행","doctor.running":"실행 중…","doctor.failed_title":"진단 실패","doctor.loading_title":"시스템 진단 실행 중…","doctor.loading_desc":"런타임 구성 요소, 구성 및 운영 상태를 확인하는 중입니다.","doctor.health_summary":"상태 요약","doctor.passing":"통과","doctor.warnings":"경고","doctor.failures":"실패","doctor.run_context":"실행 컨텍스트","doctor.context_p1":"닥터는 터미널 덤프가 아닌 검사 보드처럼 동작할 때 가장 강력합니다. 이 패널은 먼저 전체 상태를 강조한 다음 발견 사항을 하위 시스템 그룹으로 분류합니다.","doctor.context_p2":"개별 메시지를 살펴보기 전에 카테고리 보드를 사용하여 경고가 어디에 모여 있는지 확인하세요.","doctor.subsystem_boards":"하위 시스템 보드","doctor.checks":"{count}개 확인","doctor.ok":"ok","doctor.warn":"경고","doctor.fail":"실패","doctor.system_diag_title":"시스템 진단","doctor.system_diag_desc":"Revka 셸에서 경고, 실패 및 모두 정상 확인을 검사하려면 닥터를 실행하세요.","doctor.run_failed":"진단 실행 실패","cost.kicker":"운영","cost.title":"비용","cost.error_title":"비용 데이터를 불러올 수 없습니다","cost.loading_title":"비용 데이터를 불러오는 중…","cost.spend_posture":"지출 상태","cost.session_cost":"세션 비용","cost.daily_cost":"일일 비용","cost.monthly_cost":"월간 비용","cost.requests":"요청 수","cost.token_efficiency":"토큰 효율","cost.total_tokens":"총 토큰","cost.avg_tokens":"요청당 평균 토큰","cost.cost_per_1k":"1K 토큰당 비용","cost.model_workspace":"모델 작업 공간","cost.spend_by_model":"모델별 지출","cost.no_model_data":"모델 데이터 없음","cost.no_model_data_desc":"요청이 기록된 후 모델 수준의 지출이 표시됩니다.","cost.tokens_label":"{count} 토큰","cost.requests_label":"{count} 요청","cost.share_label":"월간 지출의 {share}%","cost.selected_model":"선택된 모델","cost.no_model_selected":"선택된 모델 없음","cost.no_model_selected_desc":"지출 집중도와 효율성을 검사하려면 작업 공간에서 모델을 선택하세요.","cost.monthly_spend":"월간 지출","cost.tokens":"토큰","cost.share_monthly":"월간 지출 비중","cost.interpretation":"해석","cost.interp_p1":"큰 월간 비중 값은 비용이 단일 모델 제품군에 집중되어 있음을 나타냅니다.","cost.interp_p2":"요청 수는 적지만 요청당 토큰이 많은 경우 일반적으로 긴 컨텍스트 또는 생성 중심 워크플로를 의미합니다.","logs.kicker":"검사","logs.title":"로그","logs.description":"Revka 데몬 stderr 로그의 실시간 추적. 런타임 에이전트 이벤트는 감사 페이지에 있습니다.","logs.pause":"일시 중지","logs.resume":"재개","logs.jump_to_bottom":"하단으로 이동","logs.stream_status":"스트림 상태","logs.connected":"연결됨","logs.disconnected":"연결 끊김","logs.visible_lines":"{count}개의 표시되는 줄. ~/.revka/logs/daemon.stderr.log 추적 중.","logs.event_filters":"이벤트 필터","logs.no_event_types":"아직 이벤트 유형이 없습니다","logs.no_event_types_desc":"스트림이 활동을 수신한 후 필터가 표시됩니다.","logs.clear_filters":"필터 지우기","logs.live_event_feed":"실시간 이벤트 피드","logs.no_events":"아직 이벤트가 없습니다","logs.no_events_desc":"SSE 피드가 런타임 이벤트를 수신하면 에이전트 활동이 여기에 스트리밍됩니다.","tools.kicker":"운영","tools.title":"도구","tools.description":"에이전트용 도구 카탈로그와 런타임이 호출할 수 있는 호스트 CLI 바이너리.","tools.reload":"다시 로드","tools.search_placeholder":"이름, 설명 또는 카테고리로 도구 검색…","tools.loading":"도구를 불러오는 중…","tools.agent_tools_count":"에이전트 도구 · {count}","tools.no_matches":"일치 항목 없음","tools.no_agent_tools":"등록된 에이전트 도구 없음","tools.try_different":"다른 검색어를 시도하세요.","tools.agent_tools_empty_desc":"런타임이 등록하면 에이전트 도구가 표시됩니다.","tools.parameter_schema":"매개변수 스키마","tools.cli_tools_count":"CLI 도구 · {count}","tools.no_cli_tools":"감지된 CLI 도구 없음","tools.cli_tools_empty_desc":"Revka는 시작 시 일반적인 CLI 바이너리를 탐색합니다. 하나를 설치하고 다시 로드하세요.","tools.col.name":"이름","tools.col.path":"경로","tools.col.version":"버전","tools.col.category":"카테고리","tools.failed_load":"도구 로드 실패: {message}","audit.kicker":"검사","audit.title":"감사","audit.description":"운영 작업에 대한 신뢰 체인 검증, 이벤트 검토 및 보안 상태.","audit.refresh":"새로고침","audit.verify_chain":"체인 검증","audit.disabled_title":"감사 추적이 비활성화됨","audit.disabled_desc":"여기에서 승인, 정책 및 보안 이벤트를 검사하려면 감사 기록을 활성화하세요.","audit.filters":"필터","audit.all_event_types":"모든 이벤트 유형","audit.event.command_execution":"명령 실행","audit.event.file_access":"파일 접근","audit.event.config_change":"구성 변경","audit.event.auth_success":"인증 성공","audit.event.auth_failure":"인증 실패","audit.event.policy_violation":"정책 위반","audit.event.security_event":"보안 이벤트","audit.chain_verified":"체인 확인됨","audit.chain_invalid":"체인 무효","audit.entries_verified":"{count}개 항목이 확인되었습니다.","audit.stream_title":"감사 이벤트 스트림","audit.stream_subtitle":"기록된 작업 및 승인","audit.loading":"감사 이벤트 로드 중…","audit.empty_title":"감사 이벤트 없음","audit.empty_desc":"작업 또는 승인이 발생하면 기록된 이벤트가 여기에 표시됩니다.","audit.col.sequence":"순서","audit.col.action":"작업","audit.col.result":"결과","audit.col.hash":"해시","audit.result_success":"성공","audit.result_recorded":"기록됨","audit.policy_violation_badge":"정책 위반","audit.time.seconds_ago":"{n}초 전","audit.time.minutes_ago":"{n}분 전","audit.time.hours_ago":"{n}시간 전","audit.time.days_ago":"{n}일 전","integrations.kicker":"운영","integrations.title":"통합","integrations.loading":"통합 로드 중…","integrations.coverage":"커버리지","integrations.metric.active":"활성","integrations.metric.available":"사용 가능","integrations.metric.coming_soon":"출시 예정","integrations.categories":"카테고리","integrations.category_all":"전체","integrations.workspace":"통합 작업공간","integrations.all_integrations":"모든 통합","integrations.category_integrations":"{category} 통합","integrations.empty_title":"통합 없음","integrations.empty_desc":"현재 카테고리 필터와 일치하는 통합이 없습니다.","integrations.badge.active":"활성","integrations.badge.available":"사용 가능","integrations.badge.coming_soon":"출시 예정","integrations.selected":"선택된 통합","integrations.no_selected_title":"선택된 통합 없음","integrations.no_selected_desc":"배포 상태를 검사하려면 작업공간에서 통합을 선택하세요.","integrations.detail.category":"카테고리","integrations.detail.status":"상태","integrations.detail.operational_readiness":"운영 준비 상태","integrations.readiness.active":"런타임에서 이미 활성화됨.","integrations.readiness.available":"운영자 준비 시 활성화 가능.","integrations.readiness.coming_soon":"아직 활성화할 준비가 되지 않은 계획된 영역.","integrations.legend":"상태 범례","integrations.legend.p1":"`Active` 통합은 이미 런타임 워크플로우에 연결되어 있습니다.","integrations.legend.p2":"`Available` 통합은 현재 빌드에서 설치 또는 연결할 수 있습니다.","integrations.legend.p3":"`Coming Soon` 통합은 계획되었지만 아직 운영자용으로 준비되지 않았습니다.","pairing.kicker":"운영","pairing.title":"페어링","pairing.description":"페어링 코드 발급, 모바일 등록용 QR 생성 및 신뢰 장치 관리.","pairing.reload":"다시 로드","pairing.pair_new_device":"새 장치 페어링","pairing.generating":"생성 중…","pairing.active_code":"활성 페어링 코드","pairing.rendering":"렌더링 중…","pairing.code_hint":"Revka 컴패니언 앱으로 QR을 스캔하거나 페어링된 장치에 6자리 코드를 입력하세요. 장치 등록이 완료되거나 새 코드를 생성하면 코드가 만료됩니다.","pairing.copy_code":"코드 복사","pairing.rotate":"순환","pairing.cli_device_name":"CLI 장치 이름","pairing.cli_hardware":"하드웨어","pairing.cli_hardware_placeholder":"선택적 플랫폼 라벨","pairing.mint_cli_token":"CLI 토큰 발급","pairing.minting_token":"발급 중…","pairing.minted_token":"발급된 Bearer 토큰","pairing.copy_token":"토큰 복사","pairing.no_code_title":"활성 페어링 코드 없음","pairing.no_code_desc":'"새 장치 페어링"을 눌러 새 코드와 QR을 생성하세요. 코드는 단기간용이며 단일 등록용입니다.',"pairing.how_to_scan":"스캔 방법","pairing.scan_step1":"새 장치에서 Revka 컴패니언 앱을 엽니다.","pairing.scan_step2_prefix":"선택: ","pairing.scan_step2_action":"허브와 페어링","pairing.scan_step2_suffix":".","pairing.scan_step3":"QR을 스캔하거나 6자리 코드를 수동으로 입력합니다.","pairing.scan_step4":"등록이 완료되면 장치가 아래 목록에 나타납니다.","pairing.paired_devices":"페어링된 장치 · {count}","pairing.loading_devices":"장치 로드 중…","pairing.no_devices_title":"페어링된 장치가 아직 없습니다","pairing.no_devices_desc":"성공적인 등록 후 페어링된 장치가 여기에 표시됩니다.","pairing.col.name":"이름","pairing.col.type":"유형","pairing.col.hardware":"하드웨어","pairing.col.paired":"페어링됨","pairing.col.last_seen":"마지막 활동","pairing.col.ip":"IP","pairing.col.actions":"작업","pairing.unnamed":"이름 없음","pairing.unknown":"알 수 없음","pairing.device_type.api_client":"API 클라이언트","pairing.device_type.browser":"브라우저","pairing.device_type.cli":"CLI","pairing.device_type.mobile":"모바일","pairing.device_type.tablet":"태블릿","pairing.revoke":"취소?","pairing.yes":"예","pairing.no":"아니오","pairing.revoke_title":"장치 취소","pairing.toast.code_generated":"새 페어링 코드가 생성되었습니다.","pairing.toast.code_copied":"코드가 복사되었습니다.","pairing.toast.token_minted":"Bearer 토큰이 발급되었습니다. 지금 복사하세요.","pairing.toast.token_copied":"토큰이 복사되었습니다.","pairing.toast.copy_failed":"복사 실패. 직접 선택하세요.","pairing.toast.device_revoked":"장치가 취소되었습니다.","pairing.err.load_devices":"장치 로드 실패","pairing.err.gen_code":"페어링 코드 생성 실패","pairing.err.mint_token":"Bearer 토큰 발급 실패","pairing.err.revoke":"장치 취소 실패","cron.kicker":"운영","cron.description":"예약된 작업, 캐치업 동작 및 최근 실행 이력.","cron.reload":"다시 로드","cron.startup_behaviour":"시작 동작","cron.catch_up_title":"시작 시 놓친 작업 따라잡기","cron.catch_up_desc":"다운타임 후 Revka가 시작될 때 기한이 지난 모든 작업을 실행합니다.","cron.loading_jobs":"예약된 작업 로드 중…","cron.no_jobs_title":"예약된 작업이 없습니다","cron.no_jobs_desc":"명령을 예약 실행하려면 cron 작업을 추가하세요.","cron.col.id":"ID","cron.col.name":"이름","cron.col.command":"명령","cron.col.next_run":"다음 실행","cron.col.last_status":"마지막 상태","cron.col.enabled":"활성화됨","cron.col.actions":"작업","cron.enabled_badge":"활성","cron.disabled_badge":"비활성","cron.toggle_history":"실행 이력 토글","cron.confirm":"확인?","cron.history.loading":"실행 이력 로드 중…","cron.history.error_title":"실행 이력을 로드할 수 없습니다","cron.history.retry":"다시 시도","cron.history.no_runs_title":"아직 실행 없음","cron.history.no_runs_desc":"이 작업은 생성된 이후 실행되지 않았습니다.","cron.history.refresh":"새로고침","cron.history.recent":"최근 실행 · {count}","cron.history.refresh_title":"실행 새로고침","cron.modal.edit_title":"Cron 작업 편집","cron.modal.add_title":"Cron 작업 추가","cron.modal.description":"이름은 선택 사항입니다. 일정은 표준 cron 표현식을 사용합니다.","cron.form.name":"이름","cron.form.optional":"(선택)","cron.form.name_placeholder":"예: 매일 정리","cron.form.schedule":"일정","cron.form.command":"명령","cron.form.command_placeholder":"예: cleanup --older-than 7d","cron.form.cancel":"취소","cron.form.saving":"저장 중…","cron.form.adding":"추가 중…","cron.form.save":"저장","cron.err.load":"작업 로드 실패: {message}","cron.err.settings":"설정 업데이트 실패","cron.err.save":"작업 저장 실패","cron.err.delete":"작업 삭제 실패","cron.err.form_required":"일정과 명령이 필요합니다.","cron.toast.updated":'"{name}"이(가) 업데이트되었습니다.',"cron.toast.added":'"{name}"이(가) 추가되었습니다.',"cron.toast.deleted":"작업이 삭제되었습니다.","canvas.kicker":"오케스트레이션 센터","canvas.title":"캔버스","canvas.reconnect":"다시 연결","canvas.control":"캔버스 제어","canvas.connected":"연결됨","canvas.disconnected":"연결 끊김","canvas.canvas_id_placeholder":"캔버스 ID","canvas.switch":"전환","canvas.clear":"지우기","canvas.available":"사용 가능한 캔버스","canvas.loading_list":"캔버스 로드 중…","canvas.loading_list_desc":"실시간 캔버스 레지스트리를 폴링 중.","canvas.no_active_title":"활성 캔버스 없음","canvas.no_active_desc":"에이전트나 워크플로우가 프레임을 푸시하면 캔버스 ID가 여기에 표시됩니다.","canvas.active":"활성","canvas.viewport":"캔버스 뷰포트","canvas.live_output":"실시간 프레임 출력","canvas.canvas_label":"캔버스","canvas.connection":"연결","canvas.live":"실시간","canvas.offline":"오프라인","canvas.frame_type":"프레임 유형","canvas.last_update":"마지막 업데이트","canvas.waiting_label":"프레임 대기 중","canvas.frame_suffix":"프레임","canvas.waiting_for_content":'"{id}"의 콘텐츠 대기 중',"canvas.waiting_for_content_desc":"에이전트는 캔버스 도구를 사용하여 여기에 콘텐츠를 푸시할 수 있습니다. 프레임이 도착하면 이 뷰포트에 즉시 렌더링됩니다.","canvas.disconnected_title":"캔버스 소켓 연결 끊김","canvas.disconnected_desc":"현재 캔버스에 다시 연결하거나 다른 실시간 캔버스 ID로 전환하세요.","canvas.reconnect_button":"캔버스 다시 연결","canvas.frame_id":"프레임 ID","canvas.guidance":"캔버스 안내","canvas.guidance_desc":"어시스턴트를 사용하여 이 뷰포트에 차트, 다이어그램, 마크다운 보고서 및 HTML 대시보드를 직접 생성하세요.","canvas.history":"프레임 이력","canvas.hide":"숨기기","canvas.show":"표시","canvas.history_collapsed_title":"이력 축소됨","canvas.history_collapsed_desc":"활성 캔버스의 이전 프레임을 검사하려면 이 레일을 확장하세요.","canvas.no_frames_title":"아직 프레임 없음","canvas.no_frames_desc":"프레임이 도착하면 빠른 추적을 위해 여기에 저장됩니다.","skills.kicker":"운영","skills.title":"스킬","skills.create_skill":"스킬 생성","skills.registry_status":"레지스트리 상태","skills.summary.total":"전체","skills.summary.active":"활성","skills.summary.deprecated":"사용 중단됨","skills.summary.domains":"도메인","skills.index":"스킬 인덱스","skills.search_placeholder":"스킬 검색…","skills.loading":"스킬 로드 중…","skills.no_skills_title":"스킬을 찾을 수 없습니다","skills.no_skills_desc":"운영 레지스트리를 채우려면 로컬 스킬을 생성하세요.","skills.status.active":"활성","skills.status.deprecated":"사용 중단됨","skills.workspace":"스킬 작업공간","skills.select_placeholder":"스킬 선택","skills.description":"설명","skills.content":"스킬 콘텐츠","skills.content_empty":"이 스킬에는 표시할 콘텐츠가 없습니다.","skills.edit":"편집","skills.reenable":"재활성화","skills.deprecate":"사용 중단","skills.deleting":"삭제 중…","skills.delete":"삭제","skills.no_selected_title":"선택된 스킬 없음","skills.no_selected_desc":"콘텐츠와 운영 메타데이터를 검사하려면 스킬을 선택하세요.","skills.install_github":"GitHub에서 설치","skills.install_github_desc":"GitHub 저장소 URL을 붙여넣어 스킬을 직접 설치하세요.","skills.github_placeholder":"https://github.com/org/skill-repo","skills.installing":"설치 중…","skills.install":"설치","skills.marketplace":"마켓플레이스","skills.marketplace_shown":"{count}개 표시","skills.marketplace_placeholder":"ClawHub 스킬 검색…","skills.search":"검색","skills.trending":"인기","skills.marketplace_loading":"마켓플레이스 로드 중…","skills.marketplace_empty":"마켓플레이스 결과 없음","skills.modal.edit_title":"스킬 편집","skills.modal.create_title":"스킬 생성","skills.modal.description":"스킬은 에이전트와 실행에 연결할 수 있는 재사용 가능한 운영 기능입니다.","skills.modal.name_placeholder":"스킬 이름","skills.modal.description_placeholder":"설명","skills.modal.tags_placeholder":"쉼표,구분,태그","skills.modal.content_placeholder":"스킬 마크다운 콘텐츠","skills.modal.cancel":"취소","skills.modal.saving":"저장 중…","skills.modal.save_skill":"스킬 저장","skills.toast.updated":'"{name}" 스킬이 업데이트되었습니다.',"skills.toast.created":'"{name}" 스킬이 생성되었습니다.',"skills.toast.reenabled":'"{name}" 스킬이 재활성화되었습니다.',"skills.toast.deprecated":'"{name}" 스킬이 사용 중단되었습니다.',"skills.toast.deleted":'"{name}" 스킬이 삭제되었습니다.',"skills.toast.installed":'"{name}" 스킬이 설치되었습니다.',"skills.toast.installed_github":'GitHub에서 "{name}" 스킬을 설치했습니다.',"skills.err.save":"스킬 저장 실패.","skills.err.load_detail":"스킬 콘텐츠를 로드하지 못했습니다.","skills.err.toggle":"스킬 상태 변경 실패.","skills.err.delete":"스킬 삭제에 실패했습니다.","skills.err.install":"마켓플레이스 스킬 설치 실패.","skills.err.install_github":"GitHub URL에서 스킬 설치 실패.","teams.kicker":"오케스트레이션 센터","teams.title":"팀","teams.create":"팀 생성","teams.refresh":"새로고침","teams.count":"{count}개 팀","teams.agent_count":"{count}개 에이전트","teams.loading":"로딩 중…","teams.loading_desc":"팀 로드 중…","teams.empty_title":"팀 없음","teams.empty_desc":"시작하려면 팀을 생성하세요.","teams.none_selected_title":"선택된 팀 없음","teams.none_selected_desc":"인덱스에서 팀을 선택하세요.","teams.members_suffix":"멤버 {members}명 · 엣지 {edges}개","teams.status.off":"꺼짐","teams.status.live":"운영","teams.status.deprecated":"사용 중단됨","teams.status.active":"활성","teams.action.edit":"편집","teams.action.reenable":"재활성화","teams.action.deprecate":"사용 중단","teams.action.delete":"삭제","teams.stats.members":"멤버","teams.stats.edges":"엣지","teams.stats.status":"상태","teams.tab.summary":"요약","teams.tab.member":"멤버","teams.open_agent_registry":"에이전트 레지스트리 열기","teams.modal.edit_title":"팀 편집","teams.modal.create_title":"팀 생성","teams.modal.description":"팀 편집기는 이제 새로운 셸에서 정체성, 구성, 핵심 보고/종속 엣지를 직접 관리합니다.","teams.form.name":"팀 이름","teams.form.description":"설명","teams.form.members":"멤버","teams.form.topology_preview":"토폴로지 미리보기","teams.form.edge_authoring":"엣지 작성","teams.form.from_member":"출발 멤버","teams.form.to_member":"도착 멤버","teams.form.edge_reports_to":"보고 대상","teams.form.edge_supports":"지원","teams.form.edge_depends_on":"의존","teams.form.add_edge":"엣지 추가","teams.form.remove":"제거","teams.form.no_edges":"아직 토폴로지 엣지가 정의되지 않았습니다.","teams.form.draft_summary":"초안 요약","teams.form.draft_members":"멤버","teams.form.draft_edges":"엣지","teams.form.draft_hint":"계층 구조에는 `REPORTS_TO`, 협업 레인에는 `SUPPORTS`, 실행 차단 관계에는 `DEPENDS_ON`을 사용하세요.","teams.form.draft_team_name":"초안 팀","teams.form.cancel":"취소","teams.form.saving":"저장 중…","teams.form.save":"팀 저장","teams.toast.updated":'팀 "{name}"이(가) 업데이트되었습니다.',"teams.toast.created":'팀 "{name}"이(가) 생성되었습니다.',"teams.toast.deleted":'팀 "{name}"이(가) 삭제되었습니다.',"teams.toast.reenabled":'팀 "{name}"이(가) 재활성화되었습니다.',"teams.toast.deprecated":'팀 "{name}"이(가) 사용 중단되었습니다.',"teams.err.save":"팀 저장 실패.","teams.err.toggle":"팀 상태 변경 실패.","teams.err.delete":"팀 삭제 실패.","agents.kicker":"오케스트레이션 센터","agents.title":"에이전트","agents.create":"에이전트 생성","agents.refresh":"새로고침","agents.search_placeholder":"에이전트 검색…","agents.filter.all_roles":"모든 역할","agents.filter.coder":"코더","agents.filter.reviewer":"리뷰어","agents.filter.researcher":"리서처","agents.filter.hide_disabled":"비활성 숨기기","agents.filter.show_disabled":"비활성 표시","agents.count":"{count}개 에이전트","agents.loading":"로딩 중…","agents.loading_desc":"에이전트 로드 중…","agents.empty_title":"에이전트 없음","agents.empty_desc":"필터를 조정하거나 새로 만드세요.","agents.none_selected_title":"선택된 에이전트 없음","agents.none_selected_desc":"인덱스에서 에이전트를 선택하세요.","agents.status.disabled":"비활성","agents.status.active":"활성","agents.stats.registry":"레지스트리","agents.stats.active":"활성","agents.stats.codex":"Codex","agents.section.identity":"정체성","agents.section.soul":"영혼","agents.section.soul_empty":"영혼 설명이 제공되지 않았습니다.","agents.section.expertise":"전문 분야","agents.section.no_expertise":"전문 분야 태그 없음.","agents.section.voice":"보이스","agents.section.voice_empty":"지정되지 않음","agents.section.revision":"리비전","agents.section.created":"생성됨","agents.action.edit":"편집","agents.action.reenable":"재활성화","agents.action.deprecate":"사용 중단","agents.action.delete":"삭제","agents.action.deleting":"삭제 중…","agents.tab.summary":"요약","agents.tab.prompt":"프롬프트","agents.summary.name":"이름","agents.summary.role":"역할","agents.summary.type":"유형","agents.summary.model":"모델","agents.summary.model_default":"기본값","agents.summary.tone":"톤","agents.summary.revision":"리비전","agents.summary.created":"생성됨","agents.prompt.system_hint":"시스템 힌트","agents.prompt.system_hint_empty":"시스템 힌트가 구성되지 않았습니다.","agents.prompt.identity_seed":"정체성 시드","agents.modal.create_title":"에이전트 생성","agents.modal.edit_title":"에이전트 편집","agents.modal.description":"에이전트는 정체성 기반의 오퍼레이터입니다. Revka는 페르소나, 모델, 프롬프트 표면을 한 곳에 모읍니다.","agents.form.name":"이름","agents.form.tone":"톤","agents.form.tone_placeholder":"간결하고 직접적","agents.form.identity":"정체성","agents.form.soul":"영혼","agents.form.role":"역할","agents.form.role.coder":"코더","agents.form.role.reviewer":"리뷰어","agents.form.role.researcher":"리서처","agents.form.agent_type":"에이전트 유형","agents.form.model":"모델","agents.form.model_placeholder":"gpt-5.4 / claude-sonnet-4-6","agents.form.expertise":"전문 분야","agents.form.expertise_placeholder":"rust, review, orchestration","agents.form.system_hint":"시스템 힌트","agents.form.cancel":"취소","agents.form.saving":"저장 중…","agents.form.save_create":"에이전트 생성","agents.form.save_edit":"에이전트 저장","agents.toast.updated":'에이전트 "{name}"이(가) 업데이트되었습니다.',"agents.toast.created":'에이전트 "{name}"이(가) 생성되었습니다.',"agents.toast.deleted":'에이전트 "{name}"이(가) 삭제되었습니다.',"agents.toast.reenabled":'에이전트 "{name}"이(가) 재활성화되었습니다.',"agents.toast.deprecated":'에이전트 "{name}"이(가) 사용 중단되었습니다.',"agents.err.load":"에이전트 로드 실패.","agents.err.save":"에이전트 저장 실패.","agents.err.toggle":"에이전트 상태 변경 실패.","agents.err.delete":"에이전트 삭제 실패.","runs.kicker":"오케스트레이션 센터","runs.title":"워크플로 실행","runs.refresh":"새로고침","runs.index.title":"실행 인덱스","runs.empty.title":"실행 없음","runs.empty.desc":"인덱스를 채우려면 워크플로를 실행하세요.","runs.error.title":"로드 오류","runs.stats.steps_fraction":"{completed}/{total} 단계","runs.stats.expanded_steps":"확장 {count}개","runs.stats.loop_fraction":"반복 {iteration}/{total}: {step}","runs.stats.loop_iteration":"반복 {iteration}: {step}","runs.open_definition":"정의 열기","runs.action.retry_failed":"실패 재시도","runs.action.retrying":"재시도 중…","runs.action.retry_tooltip":"실패한 단계 재시도","runs.action.stop":"중지","runs.action.stopping":"중지 중…","runs.action.stop_tooltip":"이 실행 인스턴스 중지","runs.action.delete_tooltip":"실행 삭제","runs.none_selected.title":"선택된 실행 없음","runs.none_selected.desc":"인덱스에서 실행을 선택하세요.","runs.banner.label":"활성 선택","runs.overlay.path_mode":"경로 모드","runs.overlay.path.all":"전체","runs.overlay.path.failed":"실패","runs.overlay.path.blocked":"차단됨","runs.overlay.signals":"신호","runs.overlay.prev":"이전","runs.overlay.next":"다음","runs.overlay.signal_count":"신호 {count}개","runs.overlay.posture":"상태","runs.overlay.running":"실행 중","runs.overlay.failed":"실패","runs.overlay.done":"완료","runs.overlay.pending":"대기","runs.overlay.skipped":"건너뜀","runs.overlay.hotspots":"핫스팟","runs.overlay.legend_running":"실행 중","runs.overlay.legend_failure":"실패","runs.overlay.legend_blocked":"차단됨","runs.overlay.legend_skipped":"건너뜀","runs.overlay.legend_gate":"게이트","runs.overlay.fail_label":"실패: {id}","runs.overlay.run_label":"실행: {id}","runs.overlay.block_label":"차단: {id}","runs.started_at":"{time}에 시작됨","runs.inspector.title":"단계 인스펙터","runs.tab.summary":"요약","runs.tab.output":"출력","runs.tab.tools":"도구","runs.tab.transcript":"기록","runs.tab.jsonl":"JSONL 로그","runs.detail.select_node":"검사할 DAG 노드를 선택하세요.","runs.detail.no_description":"설명 없음.","runs.detail.depends_on":"의존: {list}","runs.detail.depends_none":"없음","runs.detail.agent":"에이전트: {type}{role}","runs.detail.agent_na":"해당 없음","runs.detail.skills":"스킬: {list}","runs.detail.dashboard_link":"대시보드","runs.detail.definition_link":"정의","runs.detail.select_step":"단계를 선택하세요.","runs.detail.step_output":"단계 출력","runs.detail.agent_output":"에이전트 출력","runs.detail.no_output":"캡처된 출력 없음.","runs.detail.loading":"로딩 중…","runs.detail.tools_calls":"호출","runs.detail.tools_errors":"오류","runs.detail.no_tools":"기록된 도구 호출 없음.","runs.detail.no_activity":"사용 가능한 에이전트 활동 없음.","runs.detail.no_jsonl":"이 에이전트의 JSONL 항목을 찾을 수 없습니다.","runs.detail.no_jsonl_filter":"필터와 일치하는 항목이 없습니다.","runs.detail.no_transcript":"사용 가능한 기록 없음.","runs.detail.tool_default":"도구","runs.detail.tool_status_ok":"ok","runs.timeline":"타임라인 ({count})","runs.toast.retry_started":"실행 {id} 재시도 시작됨.","runs.toast.stop_requested":"실행 {id} 중지가 요청됨.","runs.toast.deleted":"실행 {id} 삭제됨.","runs.err.retry":"실행 재시도 실패.","runs.err.stop":"실행 중지 실패.","runs.err.delete":"실행 삭제 실패.","memory.kicker":"검사","memory.page_title":"메모리","memory.page_description":"종류 필터, 공간 범위, 검색 강조, 노드 연결 세부 드릴다운을 지원하는 메모리 그래프 검사.","memory.selected_memory":"선택된 메모리","memory.loading_detail":"노드 세부 정보 로드 중…","memory.relative.just_now":"방금 전","memory.relative.minutes":"{count}분 전","memory.relative.hours":"{count}시간 전","memory.relative.days":"{count}일 전","memory.detail.metadata":"메타데이터","memory.detail.bundle_members":"번들 멤버","memory.controls.title":"그래프 컨트롤","memory.controls.search_placeholder":"메모리 강조…","memory.controls.all_spaces":"모든 공간","memory.controls.node_limit":"노드 제한","memory.filters.title":"필터","memory.filters.empty_title":"아직 로드된 종류 없음","memory.filters.empty_desc":"메모리 데이터가 사용 가능해지면 그래프 필터가 표시됩니다.","memory.graph.kicker":"메모리 그래프","memory.graph.heading":"의미 메모리 토폴로지","memory.graph.items":"항목","memory.graph.edges":"엣지","memory.graph.shown":"표시됨","memory.graph.matches":"{count}개 일치","memory.graph.match":"{count}개 일치","memory.graph.loading_title":"메모리 그래프 로드 중…","memory.graph.loading_desc":"의미 메모리 토폴로지와 관계 엣지를 가져오는 중입니다.","memory.graph.error_title":"메모리 그래프를 로드할 수 없음","memory.graph.retry":"재시도","memory.graph.empty_title":"메모리를 찾을 수 없음","memory.graph.empty_desc":"그래프를 넓히려면 필터를 조정하거나 검색을 지우거나 노드 제한을 늘리세요.","memory.none_selected_title":"선택된 메모리 없음","memory.none_selected_desc":"메타데이터, 리비전 기반 세부 정보, 번들 멤버십을 검사하려면 그래프에서 노드를 선택하세요.","memory.err.load":"메모리 그래프 로드 실패","assets.kicker":"운영","assets.title":"자산","assets.search_placeholder":"자산 검색…","assets.project":"프로젝트","assets.up":"위로","assets.err.load":"Kumiho 프로젝트 로드에 실패했습니다. Kumiho API에 연결할 수 있는지 확인하세요.","assets.col.name":"이름","assets.col.kind":"종류","assets.col.author":"작성자","assets.col.created":"생성됨","assets.loading.projects":"프로젝트 로드 중…","assets.loading.space":"공간 로드 중…","assets.loading.generic":"로딩 중…","assets.folder":"폴더","assets.empty.title":"빈 공간","assets.empty.desc":"이 위치에 폴더나 자산이 없습니다.","assets.search.empty_title":"결과 없음","assets.search.empty_desc":'"{query}"과(와) 일치하는 자산이 없습니다.',"assets.search.result_count":'"{query}"의 결과 {count}개',"assets.copy_kref":"kref 복사","assets.close_inspector":"인스펙터 닫기","assets.deprecated":"사용 중단됨","assets.active":"활성","assets.rev_count":"리비전 {count}개","assets.rev_count_one":"리비전 {count}개","assets.by":"작성자: {author}","assets.section.revisions":"리비전","assets.section.artifacts":"아티팩트","assets.section.edges":"엣지","assets.section.metadata":"메타데이터","assets.section.revisions_empty":"리비전 없음.","assets.section.artifacts_empty":"아티팩트 없음.","assets.section.edges_empty":"엣지 없음.","assets.section.metadata_empty":"메타데이터 없음.","assets.tag.latest":"최신","assets.tag.published":"게시됨","assets.action.view":"보기","assets.action.edit":"편집","assets.action.restore":"복원","assets.action.deprecate":"사용 중단","assets.action.publish":"게시","assets.action.published":"게시됨","assets.action.save_artifact":"아티팩트 저장","assets.action.deprecate_item":"선택한 항목 사용 중단","assets.action.restore_item":"선택한 항목 복원","assets.action.deprecate_revision":"선택한 리비전 사용 중단","assets.action.restore_revision":"선택한 리비전 복원","assets.action.publish_revision":"선택한 리비전을 게시됨으로 태그","assets.action.edit_artifact":"아티팩트 편집","assets.action.deprecate_artifact":"아티팩트 사용 중단","assets.action.restore_artifact":"아티팩트 복원","assets.toast.item_deprecated":"항목을 사용 중단했습니다.","assets.toast.item_restored":"항목을 복원했습니다.","assets.toast.revision_deprecated":"리비전을 사용 중단했습니다.","assets.toast.revision_restored":"리비전을 복원했습니다.","assets.toast.revision_published":"리비전을 게시됨으로 태그했습니다.","assets.toast.artifact_deprecated":"아티팩트를 사용 중단했습니다.","assets.toast.artifact_restored":"아티팩트를 복원했습니다.","assets.toast.artifact_saved":"아티팩트 내용을 업데이트했습니다.","assets.toast.artifact_saved_new_revision":"업데이트된 아티팩트를 첨부한 새 리비전을 만들었습니다.","assets.err.action":"자산 작업에 실패했습니다.","assets.err.load_artifact":"아티팩트 내용을 불러오지 못했습니다.","assets.editor.title":"{name} 편집","assets.editor.mutable_desc":"저장하면 현재 리비전의 아티팩트 파일을 업데이트합니다.","assets.editor.published_desc":"이 리비전은 게시되어 변경할 수 없습니다. 저장하면 업데이트된 아티팩트를 첨부한 새 리비전을 만듭니다.","config.kicker":"운영","config.page_title":"구성","config.reload":"다시 로드","config.save_button":"구성 저장","config.saving_button":"저장 중…","config.loading_title":"구성 로드 중…","config.toast.saved":"구성이 저장되었습니다.","config.err.load":"구성 로드 실패.","config.err.save":"구성 저장 실패.","config.err.mcp_errors":"저장하기 전에 MCP 서버 오류를 수정하세요.","config.map":"구성 맵","config.workspace":"TOML 작업 공간","config.workspace.structured_heading":"구조화된 컨트롤","config.workspace.source_heading":"소스 편집기","config.tab.structured":"구조화","config.tab.source":"소스","config.tabs_aria":"구성 작업 공간 탭","config.hide_preview":"미리보기 숨기기","config.show_preview":"미리보기 표시","config.mapped_paths":"매핑된 TOML 경로","config.structured.error_title":"구조화된 컨트롤을 구성할 수 없음","config.structured.error_desc":"그룹화된 구성 컨트롤을 표시하려면 원시 TOML을 파싱할 수 있어야 합니다.","config.summary.title":"파싱된 요약","config.summary.error_title":"TOML을 파싱할 수 없음","config.summary.error_desc":"요약 패널은 편집기에 파싱 가능한 TOML 섹션이 있을 때만 업데이트됩니다.","config.source_health":"소스 상태","config.row.workspace_mode":"작업 공간 모드","config.row.preview":"미리보기","config.row.sections":"섹션","config.row.parse_status":"파싱 상태","config.row.parse_valid":"유효","config.row.parse_needs":"확인 필요","config.mode.structured":"구조화","config.mode.source":"소스","config.toggle.enabled":"활성화됨","config.toggle.disabled":"비활성화됨","config.section.provider":"프로바이더","config.section.provider_desc":"기본 모델 프로바이더, API 라우팅, 생성 튜닝.","config.section.agent":"에이전트","config.section.agent_desc":"에이전트 런타임을 위한 루프 제한, 컨텍스트 예산, 추론 기본값.","config.section.memory":"메모리","config.section.memory_desc":"메모리 백엔드, Kumiho 연결, 영속성 동작.","config.section.runtime":"런타임","config.section.runtime_desc":"게이트웨이 바인딩 설정, 페어링, 자율성 정책.","config.section.security":"보안/비용","config.section.security_desc":"감사 및 샌드박스 설정과 비용 한도 제어.","config.section.channels":"채널","config.section.channels_desc":"운영 채널을 위한 CLI 및 메시징 표면 동작.","config.section.mcp":"MCP 서버","config.section.mcp_desc":"Model Context Protocol 클라이언트 — 최상위 토글 및 구조화된 서버 항목.","config.section.extra_desc":"config.toml에서 발견된 추가 섹션 — 범용 편집기.","config.generic.empty":"이 섹션에는 아직 필드가 없습니다.","config.generic.empty_array":"(빈 배열)","config.generic.array_readonly":"배열은 범용 편집기에서 읽기 전용입니다 — 소스 탭에서 편집하세요.","config.provider.default_provider":"기본 프로바이더","config.provider.default_model":"기본 모델","config.provider.temperature":"온도","config.provider.timeout":"프로바이더 타임아웃","config.provider.max_tokens":"프로바이더 최대 토큰","config.agent.max_tool_iterations":"최대 도구 반복","config.agent.max_context_tokens":"최대 컨텍스트 토큰","config.agent.max_history_messages":"최대 기록 메시지","config.agent.gpt55_context_window":"GPT-5.5 컨텍스트 창","config.agent.context_window_safety_ratio":"컨텍스트 안전 비율","config.agent.parallel_tools":"병렬 도구","config.agent.thinking_level":"사고 수준","config.memory.kumiho_enabled":"Kumiho 활성화","config.memory.memory_project":"메모리 프로젝트","config.memory.harness_project":"Harness 프로젝트","config.memory.retrieval_limit":"검색 제한","config.memory.backend":"메모리 백엔드","config.memory.auto_save":"자동 저장","config.memory.snapshots":"스냅샷","config.runtime.gateway_host":"게이트웨이 호스트","config.runtime.gateway_port":"게이트웨이 포트","config.runtime.require_pairing":"페어링 필요","config.runtime.session_persistence":"세션 영속성","config.runtime.autonomy_level":"자율성 수준","config.runtime.max_actions_hour":"시간당 최대 액션","config.security.audit_enabled":"감사 활성화","config.security.sandbox_backend":"샌드박스 백엔드","config.security.daily_limit":"일일 한도 USD","config.security.monthly_limit":"월별 한도 USD","config.security.warn_percent":"경고 백분율","config.channels.cli":"CLI 채널","config.channels.ack_reactions":"확인 반응","config.channels.show_tool_calls":"도구 호출 표시","config.channels.message_timeout":"메시지 타임아웃 초","config.summary.api_url":"API URL","config.summary.provider":"프로바이더","config.summary.model":"모델","config.summary.temperature":"온도","config.summary.timeout":"타임아웃","config.summary.max_tokens":"최대 토큰","config.summary.runtime":"런타임","config.summary.gateway":"게이트웨이","config.summary.pairing_required":"페어링 필요","config.summary.session_persistence":"세션 영속성","config.summary.autonomy_level":"자율성 수준","config.summary.workspace_only":"작업 공간 전용","config.summary.max_actions_hour":"시간당 최대 액션","config.summary.memory":"메모리","config.summary.backend":"백엔드","config.summary.auto_save":"자동 저장","config.summary.hygiene":"정리","config.summary.snapshots":"스냅샷","config.summary.kumiho_enabled":"Kumiho 활성화","config.summary.memory_project":"메모리 프로젝트","config.summary.retrieval_limit":"검색 제한","config.summary.safety_cost":"안전/비용","config.summary.audit_enabled":"감사 활성화","config.summary.sandbox_backend":"샌드박스 백엔드","config.summary.daily_limit":"일일 한도","config.summary.monthly_limit":"월별 한도","config.summary.warn_percent":"경고 %","config.summary.channels":"채널","config.summary.cli":"CLI","config.summary.telegram":"Telegram","config.summary.discord":"Discord","config.summary.slack":"Slack","config.summary.matrix":"Matrix","config.summary.signal":"Signal","config.summary.whatsapp":"WhatsApp","config.row.enabled":"활성화됨","config.row.disabled":"비활성화됨","config.mcp.title":"MCP","config.mcp.enabled":"MCP 활성화","config.mcp.deferred":"지연 로딩","config.mcp.servers":"서버","config.mcp.no_servers":"아직 구성된 서버가 없습니다.","config.mcp.server_count":"서버 {count}개가 구성되었습니다.","config.mcp.server_count_one":"서버 1개가 구성되었습니다.","config.mcp.add_server":"MCP 서버 추가","config.mcp.confirm_remove":"{label}을(를) 제거하시겠습니까?","config.mcp.entry_label":"항목 {index}","config.mcp.server_default":"서버 {index}","config.mcp.stdio_empty":"stdio — 명령이 설정되지 않음","config.mcp.transport_empty":"{transport} — url이 설정되지 않음","config.mcp.test":"테스트","config.mcp.testing":"테스트 중…","config.mcp.test_tooltip":"MCP initialize + tools/list 핸드셰이크 실행","config.mcp.test_blocked":"테스트하기 전에 유효성 검사 오류를 수정하세요","config.mcp.delete_label":"{label} 삭제","config.mcp.connecting":"연결 중…","config.mcp.tool_count":"도구 {count}개 · {latency}ms","config.mcp.tool_count_one":"도구 1개 · {latency}ms","config.mcp.tools_list":"도구: {list}","config.mcp.handshake_failed":"핸드셰이크 실패","config.mcp.field_name":"이름","config.mcp.field_name_placeholder":"예: memory","config.mcp.field_transport":"전송","config.mcp.field_command":"명령","config.mcp.field_command_placeholder":"/usr/local/bin/mcp-server","config.mcp.field_args":"인수","config.mcp.field_args_placeholder":"--flag","config.mcp.field_env":"환경 변수","config.mcp.field_env_key":"KEY","config.mcp.field_env_value":"value","config.mcp.field_url":"URL","config.mcp.field_url_placeholder":"https://example.com/mcp","config.mcp.field_headers":"헤더","config.mcp.field_headers_key":"Header-Name","config.mcp.field_headers_value":"value","config.mcp.field_timeout":"타임아웃 (ms)","config.mcp.field_timeout_placeholder":"30000","config.mcp.add_entry":"{label} 추가","config.mcp.remove_entry":"{label} 항목 {index} 제거","landing.skip_link":"본문으로 건너뛰기","landing.nav.aria_label":"사이트 탐색","landing.nav.logo_alt":"Revka 로고","landing.nav.features":"기능","landing.nav.launch":"대시보드 열기","landing.hero.aria_label":"대표 영역","landing.hero.badge":"메모리 네이티브 · Rust 네이티브 · 그래프 네이티브","landing.hero.tagline":"메모리 네이티브 에이전트 런타임","landing.hero.description":"Kumiho의 그래프 네이티브 메모리를 기반으로 구축되었습니다. 모든 세션, 계획, 스킬, 신뢰 점수가 그래프에 저장되며 — 일어난 일이라면 언제든 조회할 수 있습니다.","landing.hero.cta_primary":"대시보드 열기","landing.hero.cta_secondary":"기능 살펴보기","landing.hero.banner_alt":"Revka — 메모리 네이티브 에이전트 런타임 대시보드","landing.hero.scroll_cue":"스크롤","landing.stats.aria_label":"주요 지표","landing.stats.runtime_label":"런타임","landing.stats.namespaces_label":"네임스페이스","landing.stats.memory_label":"메모리 그래프","landing.stats.goals_label":"목표 추적","landing.stats.orchestration_label":"오케스트레이션","landing.pillars.aria_label":"세 가지 축","landing.pillars.badge":"세 가지 축","landing.pillars.title":"하나의 런타임, 어떤 표면에서든","landing.pillars.description":"Revka는 세 가지 기반 위에 구축됩니다 — 공급자 중립 에이전트, 그래프 네이티브 메모리, 그리고 모든 채널을 통한 전달입니다.","landing.pillars.agents.title":"에이전트","landing.pillars.agents.desc":"공급자에 구애받지 않는 에이전트(OpenAI, Anthropic, 로컬 모델)를 워크플로와 스웜으로 오케스트레이션합니다 — 모두 사용자 기기에서 실행됩니다.","landing.pillars.memory.title":"메모리","landing.pillars.memory.desc":"Kumiho, SQLite 또는 Markdown을 통해 세션 전반에 걸친 지속적인 지식을 유지합니다. 에이전트가 사용자와 프로젝트, 이전 결정을 기억합니다.","landing.pillars.channels.title":"채널","landing.pillars.channels.desc":"Telegram, Discord, Slack, iMessage, Matrix, 이메일 등 다양한 채널에서 Revka와 대화하세요. 하나의 런타임, 어떤 표면에서든.","landing.features.aria_label":"기능","landing.features.badge":"역량","landing.features.title":"에이전트 시대를 위한 설계","landing.features.description":"모든 구성 요소는 지속적 메모리와 다중 에이전트 협업을 중심으로 설계되었습니다 — 생성에서 은퇴까지.","landing.features.featured_badge":"핵심 메모리 기반","landing.features.memory.title":"Kumiho 메모리","landing.features.memory.desc":"그래프 네이티브 지속 메모리입니다. 모든 세션, 계획, 스킬이 버전 관리되고 연결되어 조회 가능하며, 대체 백엔드는 사용하지 않습니다.","landing.features.operator.title":"Operator","landing.features.operator.desc":"역할 위임(코더, 리뷰어, 연구원), 회상을 동반한 스폰, 신뢰 점수 기능을 갖춘 다중 에이전트 오케스트레이션입니다.","landing.features.pool.title":"에이전트 풀","landing.features.pool.desc":"역할, 역량, 모델 선호도를 포함한 재사용 가능한 에이전트 정의입니다. 사용량 추적으로 성과가 좋은 에이전트를 먼저 노출합니다.","landing.features.clawhub.title":"ClawHub 마켓플레이스","landing.features.clawhub.desc":"공유 레지스트리에서 에이전트 템플릿, 스킬, 팀 구성을 게시하고 검색하고 설치합니다.","landing.features.goals.title":"목표 계층","landing.features.goals.desc":"전략적, 전술적, 작업 단위의 3계층 목표 추적 — 모두 상태와 의존성과 함께 그래프에 저장됩니다.","landing.features.audit.title":"감사 추적","landing.features.audit.desc":"머클 해시 체인 기반의 변조 방지 로깅입니다. 모든 행동이 암호학적으로 검증 가능한 이력으로 기록됩니다.","landing.how.aria_label":"작동 방식","landing.how.badge":"워크플로","landing.how.title":"Revka는 이렇게 동작합니다","landing.how.description":"에이전트 배포부터 지속적 회상까지 — 전체 생애주기를 세 단계로 일관되게 관리합니다.","landing.how.step1.title":"에이전트 배포하기","landing.how.step1.desc":"역할, 역량, 모델 선호도를 설정합니다. Revka는 템플릿을 그래프에 저장해 재사용과 회상이 가능하도록 합니다.","landing.how.step2.title":"메모리가 축적됩니다","landing.how.step2.desc":"모든 세션, 계획, 스킬, 상호작용이 Kumiho에서 버전 관리되고 엣지로 연결됩니다. 어떤 것도 사라지지 않습니다.","landing.how.step3.title":"모든 것을 조회하기","landing.how.step3.desc":"목표 계층, 신뢰 점수, 그래프 탐색을 활용해 모든 에이전트 이력에서 통찰을 끌어냅니다.","landing.cli.aria_label":"CLI 참조","landing.cli.badge":"CLI","landing.cli.title":"터미널에서 제어하세요","landing.cli.description":"대시보드와 채널이 응답하려면 데몬이 실행 중이어야 합니다. UI에서 할 수 있는 모든 작업은 명령어로도 매핑됩니다.","landing.cli.cmd.onboard":"대화형 초기 설정 마법사 실행","landing.cli.cmd.reinit":"처음부터 초기화하고 재구성 (터널 포함)","landing.cli.cmd.daemon":"장기 실행 런타임 시작","landing.cli.cmd.doctor":"데몬, 스케줄러, 채널 상태 확인","landing.cli.cmd.status":"전체 시스템 상태 출력","landing.cli.cmd.channel_list":"구성된 채널 목록 보기","landing.cli.cmd.channel_add":"Telegram 봇 추가","landing.cli.cmd.providers":"지원되는 AI 공급자 목록 보기","landing.cli.cmd.memory_stats":"에이전트 메모리 크기 확인","landing.cli.cmd.service_install":"launchd/systemd 사용자 서비스로 설치","landing.arch.aria_label":"아키텍처","landing.arch.badge":"그래프 네이티브","landing.arch.title":"모든 것이 그래프 안에","landing.arch.description":"모든 지속 상태는 Kumiho의 엄격한 네임스페이스 계층 아래에 저장됩니다 — 버전 관리되고, 엣지로 연결되며, 세션 간에 조회할 수 있습니다.","landing.arch.ns.agentpool":"재사용 가능한 에이전트 템플릿","landing.arch.ns.plans":"실행 계획 및 단계","landing.arch.ns.sessions":"세션 간 연속성","landing.arch.ns.goals":"전략적 목표 추적","landing.arch.ns.clawhub":"게시된 템플릿과 스킬","landing.arch.ns.teams":"팀 정의","landing.arch.ns.skills":"공유 스킬 라이브러리","landing.arch.ns.trust":"신뢰 점수와 이력","landing.arch.connection_note":"모든 네임스페이스가 Kumiho 그래프 엣지로 연결되어 있습니다","landing.tunnels.aria_label":"터널 안내","landing.tunnels.badge":"터널","landing.tunnels.title":"공개 도달, 로컬 신뢰","landing.tunnels.description_prefix":"게이트웨이는 ","landing.tunnels.description_suffix":" 에서 실행되며 — 이 기기에서만 접근할 수 있습니다. 웹훅 기반 채널(Telegram, Slack 이벤트, WhatsApp, WeChat)은 공개 URL이 필요합니다. 터널은 방화벽 포트를 열지 않고도 공개 호스트명을 로컬 게이트웨이로 전달합니다.","landing.tunnels.provider.cloudflare.name":"Cloudflare Tunnel","landing.tunnels.provider.cloudflare.desc":"무료이며 프로덕션 수준입니다. Zero Trust 계정과 터널 토큰이 필요합니다.","landing.tunnels.provider.ngrok.name":"ngrok","landing.tunnels.provider.ngrok.desc":"빠르고 일시적입니다. 로컬 개발과 테스트에 적합합니다.","landing.tunnels.provider.tailscale.name":"Tailscale Funnel","landing.tunnels.provider.tailscale.desc":"tailnet 신원을 이용해 tailnet 서비스를 공개적으로 공유합니다.","landing.tunnels.provider.custom.name":"사용자 지정","landing.tunnels.provider.custom.desc":"직접 준비한 리버스 프록시나 공개 URL을 사용합니다.","landing.tunnels.setup_hint_prefix":"다음 명령을 실행하세요: ","landing.tunnels.setup_hint_suffix":" 그리고 안내에 따라 공급자를 선택하세요.","landing.cta.aria_label":"시작하기","landing.cta.headline_prefix":"이제 ","landing.cta.headline_highlight":"구축을 시작할","landing.cta.headline_suffix":" 준비가 되셨나요?","landing.cta.description":"대시보드를 열어 에이전트를 관리하고, 스킬 라이브러리를 둘러보고, 팀을 오케스트레이션하며, 그래프가 기억하는 모든 것을 탐색해 보세요.","landing.cta.button":"대시보드 열기","landing.footer.tagline":"메모리 네이티브 에이전트 런타임"}};let FB="en";function K3(e){FB=e}function Vs(e){var n;return((n=zx[FB])==null?void 0:n[e])??zx.en[e]??e}function HB(e,n){var r;return((r=zx[n])==null?void 0:r[e])??zx.en[e]??e}function OJ(e,n,r={}){return DJ(HB(e,n),r)}function DJ(e,n){return e.replace(/\{(\w+)\}/g,(r,i)=>Object.prototype.hasOwnProperty.call(n,i)?String(n[i]):r)}const WB=[{code:"en",label:"English"},{code:"zh",label:"中文"},{code:"tr",label:"Türkçe"},{code:"ko",label:"한국어"}];function cn(){var o;const{locale:e,setAppLocale:n}=POe(),r=((o=WB.find(l=>l.code===e))==null?void 0:o.code)??"en",i=b.useCallback(l=>HB(l,r),[r]),s=b.useCallback((l,u)=>OJ(l,r,u),[r]),a=b.useCallback(l=>n(l),[n]);return b.useMemo(()=>({locale:r,t:i,tpl:s,setLocale:a}),[r,i,s,a])}function ys(e=.1){const n=b.useRef(null),[r,i]=b.useState(()=>typeof window<"u"?window.matchMedia("(prefers-reduced-motion: reduce)").matches:!1);return b.useEffect(()=>{const s=n.current;if(!s)return;const a=new IntersectionObserver(o=>{const l=o[0];l!=null&&l.isIntersecting&&(i(!0),a.unobserve(s))},{threshold:e});return a.observe(s),()=>a.disconnect()},[e]),{ref:n,visible:r}}function PJ(e=.18){const[n,r]=b.useState(0),i=typeof window<"u"?window.matchMedia("(prefers-reduced-motion: reduce)").matches:!0;return b.useEffect(()=>{if(i)return;const s=()=>r(window.scrollY*e);return window.addEventListener("scroll",s,{passive:!0}),()=>window.removeEventListener("scroll",s)},[e,i]),n}const LJ=[{id:"memory",icon:$m,titleKey:"landing.features.memory.title",descKey:"landing.features.memory.desc",color:"#8fa8c8",featured:!0},{id:"operator",icon:xf,titleKey:"landing.features.operator.title",descKey:"landing.features.operator.desc",color:"#6f83d6",featured:!1},{id:"pool",icon:Ul,titleKey:"landing.features.pool.title",descKey:"landing.features.pool.desc",color:"#6575d3",featured:!1},{id:"clawhub",icon:IB,titleKey:"landing.features.clawhub.title",descKey:"landing.features.clawhub.desc",color:"#f59e0b",featured:!1},{id:"goals",icon:zB,titleKey:"landing.features.goals.title",descKey:"landing.features.goals.desc",color:"#2fbf75",featured:!1},{id:"audit",icon:LB,titleKey:"landing.features.audit.title",descKey:"landing.features.audit.desc",color:"#ff4466",featured:!1}],IJ=[{ns:"Revka/AgentPool/",purposeKey:"landing.arch.ns.agentpool",icon:Ul},{ns:"Revka/Plans/",purposeKey:"landing.arch.ns.plans",icon:zB},{ns:"Revka/Sessions/",purposeKey:"landing.arch.ns.sessions",icon:sC},{ns:"Revka/Goals/",purposeKey:"landing.arch.ns.goals",icon:hE},{ns:"Revka/ClawHub/",purposeKey:"landing.arch.ns.clawhub",icon:IB},{ns:"Revka/Teams/",purposeKey:"landing.arch.ns.teams",icon:xf},{ns:"CognitiveMemory/Skills/",purposeKey:"landing.arch.ns.skills",icon:t0},{ns:"Revka/AgentTrust/",purposeKey:"landing.arch.ns.trust",icon:LB}],BJ=[{value:"Rust",labelKey:"landing.stats.runtime_label"},{value:"8",labelKey:"landing.stats.namespaces_label"},{value:"Neo4j",labelKey:"landing.stats.memory_label"},{value:"3-tier",labelKey:"landing.stats.goals_label"},{value:"MCP",labelKey:"landing.stats.orchestration_label"}],zJ=[{id:"agents",icon:zl,titleKey:"landing.pillars.agents.title",descKey:"landing.pillars.agents.desc",color:"#6f83d6"},{id:"memory",icon:$m,titleKey:"landing.pillars.memory.title",descKey:"landing.pillars.memory.desc",color:"#8fa8c8"},{id:"channels",icon:Ix,titleKey:"landing.pillars.channels.title",descKey:"landing.pillars.channels.desc",color:"#6575d3"}],$J=[{cmd:"revka onboard",descKey:"landing.cli.cmd.onboard"},{cmd:"revka onboard --reinit",descKey:"landing.cli.cmd.reinit"},{cmd:"revka daemon",descKey:"landing.cli.cmd.daemon"},{cmd:"revka doctor",descKey:"landing.cli.cmd.doctor"},{cmd:"revka status",descKey:"landing.cli.cmd.status"},{cmd:"revka channel list",descKey:"landing.cli.cmd.channel_list"},{cmd:`revka channel add telegram '{"bot_token":"..."}'`,descKey:"landing.cli.cmd.channel_add"},{cmd:"revka providers",descKey:"landing.cli.cmd.providers"},{cmd:"revka memory stats",descKey:"landing.cli.cmd.memory_stats"},{cmd:"revka service install",descKey:"landing.cli.cmd.service_install"}],FJ=[{id:"cloudflare",nameKey:"landing.tunnels.provider.cloudflare.name",descKey:"landing.tunnels.provider.cloudflare.desc"},{id:"ngrok",nameKey:"landing.tunnels.provider.ngrok.name",descKey:"landing.tunnels.provider.ngrok.desc"},{id:"tailscale",nameKey:"landing.tunnels.provider.tailscale.name",descKey:"landing.tunnels.provider.tailscale.desc"},{id:"custom",nameKey:"landing.tunnels.provider.custom.name",descKey:"landing.tunnels.provider.custom.desc"}],Y3=[{step:"01",icon:vE,titleKey:"landing.how.step1.title",descKey:"landing.how.step1.desc",color:"#8fa8c8"},{step:"02",icon:xd,titleKey:"landing.how.step2.title",descKey:"landing.how.step2.desc",color:"#6f83d6"},{step:"03",icon:Aa,titleKey:"landing.how.step3.title",descKey:"landing.how.step3.desc",color:"#6575d3"}];function HJ({icon:e,title:n,desc:r,color:i,delay:s,featured:a,featuredBadge:o}){const{ref:l,visible:u}=ys(.08);return c.jsxs("div",{ref:l,className:["card feature-card p-6 flex flex-col",a?"feature-card--featured":""].join(" "),style:{opacity:u?1:0,transform:u?"translateY(0)":"translateY(28px)",transition:`opacity 0.55s ease ${s}ms, transform 0.55s ease ${s}ms`},children:[c.jsx("div",{className:"inline-flex h-11 w-11 items-center justify-center rounded-2xl mb-4 flex-shrink-0",style:{background:`${i}1a`,border:`1px solid ${i}33`},children:c.jsx(e,{className:"h-5 w-5",style:{color:i}})}),c.jsx("h3",{className:"font-semibold text-base mb-2",style:{color:"var(--pc-text-primary)"},children:n}),c.jsx("p",{className:"text-sm leading-relaxed flex-1",style:{color:"var(--pc-text-muted)"},children:r}),a&&c.jsxs("div",{className:"mt-5 pt-4 flex items-center gap-2 text-xs font-medium",style:{borderTop:`1px solid ${i}22`,color:i},children:[c.jsx(c0,{className:"h-3 w-3"}),o]})]})}function WJ({ns:e,purpose:n,icon:r,delay:i}){const{ref:s,visible:a}=ys(.05);return c.jsxs("div",{ref:s,className:"glass-card px-4 py-3.5 flex items-start gap-3",style:{opacity:a?1:0,transform:a?"translateX(0)":"translateX(-16px)",transition:`opacity 0.5s ease ${i}ms, transform 0.5s ease ${i}ms`},children:[c.jsx(r,{className:"h-4 w-4 mt-0.5 flex-shrink-0",style:{color:"var(--pc-accent)"}}),c.jsxs("div",{className:"min-w-0",children:[c.jsx("code",{className:"text-xs font-mono block mb-0.5 truncate",style:{color:"var(--pc-accent-light)"},children:e}),c.jsx("span",{className:"text-xs",style:{color:"var(--pc-text-muted)"},children:n})]})]})}function qJ({step:e,icon:n,title:r,desc:i,color:s,delay:a,isLast:o}){const{ref:l,visible:u}=ys(.1);return c.jsxs("div",{ref:l,className:"how-step relative flex flex-col items-center text-center",style:{opacity:u?1:0,transform:u?"translateY(0)":"translateY(24px)",transition:`opacity 0.6s ease ${a}ms, transform 0.6s ease ${a}ms`},children:[c.jsx("div",{className:"how-step-num mb-4 text-xs font-mono font-bold tracking-widest",style:{color:`${s}99`},children:e}),c.jsx("div",{className:"how-step-icon mb-5",style:{background:`${s}14`,border:`1px solid ${s}33`,boxShadow:`0 0 32px ${s}18`},children:c.jsx(n,{className:"h-7 w-7",style:{color:s}})}),c.jsx("h3",{className:"font-semibold text-lg mb-2",style:{color:"var(--pc-text-primary)"},children:r}),c.jsx("p",{className:"text-sm leading-relaxed max-w-xs",style:{color:"var(--pc-text-muted)"},children:i}),!o&&c.jsx("div",{className:"how-step-connector",style:{background:`linear-gradient(90deg, ${s}44, transparent)`},"aria-hidden":"true"})]})}function UJ(){const e=Qg(),{t:n}=cn(),[r,i]=b.useState(!1),s=b.useRef(null),a=PJ(.12);b.useEffect(()=>{const W=()=>i(window.scrollY>48);return window.addEventListener("scroll",W,{passive:!0}),()=>window.removeEventListener("scroll",W)},[]);const{ref:o,visible:l}=ys(.01),{ref:u,visible:d}=ys(.01),{ref:p,visible:f}=ys(.01),{ref:g,visible:_}=ys(.1),{ref:x,visible:v}=ys(.08),{ref:S,visible:w}=ys(.08),{ref:N,visible:C}=ys(.08),{ref:T,visible:A}=ys(.08),{ref:E,visible:D}=ys(.08),{ref:F,visible:B}=ys(.08),{ref:H,visible:$}=ys(.1),z=b.useCallback(()=>{var P;const W=window.matchMedia("(prefers-reduced-motion: reduce)").matches;(P=s.current)==null||P.scrollIntoView({behavior:W?"auto":"smooth"})},[]);return c.jsxs("div",{className:"landing-page min-h-screen overflow-x-hidden",style:{background:"var(--pc-bg-base)",color:"var(--pc-text-primary)"},children:[c.jsx("a",{href:"#main-content",className:"skip-link",children:n("landing.skip_link")}),c.jsxs("nav",{className:["landing-nav sticky top-0 z-50 flex items-center justify-between px-6 py-4",r?"landing-nav--scrolled":""].join(" "),"aria-label":n("landing.nav.aria_label"),children:[c.jsxs("div",{className:"flex items-center gap-2.5",children:[c.jsx("img",{src:id("revka-icon.png"),alt:n("landing.nav.logo_alt"),className:"revka-brand-logo h-8 w-8 rounded-xl object-contain",onError:W=>{W.currentTarget.style.display="none"}}),c.jsx("span",{className:"font-bold text-base tracking-tight",children:"Revka"})]}),c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx("button",{onClick:z,className:"hidden sm:block text-sm font-medium transition-colors",style:{color:"var(--pc-text-muted)"},onMouseEnter:W=>{W.currentTarget.style.color="var(--pc-text-primary)"},onMouseLeave:W=>{W.currentTarget.style.color="var(--pc-text-muted)"},children:n("landing.nav.features")}),c.jsxs("button",{onClick:()=>e("/dashboard"),className:"btn-electric flex items-center gap-1.5 px-5 py-2 text-sm font-semibold",children:[n("landing.nav.launch"),c.jsx(sf,{className:"h-3.5 w-3.5"})]})]})]}),c.jsxs("main",{id:"main-content",children:[c.jsxs("section",{className:"hero-section relative flex min-h-[96vh] flex-col items-center justify-center px-4 pt-12 pb-0 overflow-hidden","aria-label":n("landing.hero.aria_label"),children:[c.jsx("div",{className:"hero-orb hero-orb-1","aria-hidden":"true"}),c.jsx("div",{className:"hero-orb hero-orb-2","aria-hidden":"true"}),c.jsx("div",{className:"hero-orb hero-orb-3","aria-hidden":"true"}),c.jsxs("div",{ref:o,className:"shell-chip mb-7",style:{opacity:l?1:0,transform:l?"translateY(0)":"translateY(-12px)",transition:"opacity 0.7s ease, transform 0.7s ease"},children:[c.jsx(c0,{className:"h-3 w-3"}),n("landing.hero.badge")]}),c.jsxs("div",{ref:u,className:"text-center mb-10",style:{opacity:d?1:0,transform:d?"translateY(0)":"translateY(20px)",transition:"opacity 0.7s ease 0.1s, transform 0.7s ease 0.1s"},children:[c.jsx("h1",{className:"text-5xl font-bold mb-4 tracking-tight sm:text-6xl lg:text-7xl xl:text-8xl",children:c.jsx("span",{className:"text-gradient-fox text-gradient-fox--shimmer",children:"Revka"})}),c.jsx("p",{className:"text-xl mb-3 max-w-xl mx-auto font-medium sm:text-2xl",style:{color:"var(--pc-text-secondary)"},children:n("landing.hero.tagline")}),c.jsx("p",{className:"text-base mb-10 max-w-lg mx-auto leading-relaxed",style:{color:"var(--pc-text-muted)"},children:n("landing.hero.description")}),c.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:justify-center",children:[c.jsxs("button",{onClick:()=>e("/dashboard"),className:"btn-electric flex items-center justify-center gap-2 px-8 py-3.5 text-base font-semibold rounded-2xl",children:[n("landing.hero.cta_primary"),c.jsx(sf,{className:"h-4 w-4"})]}),c.jsx("button",{onClick:z,className:"shell-pill-button flex items-center justify-center gap-2 px-8 py-3.5 text-base font-semibold rounded-2xl",children:n("landing.hero.cta_secondary")})]})]}),c.jsxs("div",{ref:p,className:"hero-banner-wrap relative w-full",style:{opacity:f?1:0,transform:f?`translateY(${a}px)`:`scale(0.94) translateY(${16+a}px)`,transition:f?"opacity 0.9s ease 0.25s":"opacity 0.9s ease 0.25s, transform 0.9s ease 0.25s"},children:[c.jsx("img",{src:id("revka-banner.png"),alt:n("landing.hero.banner_alt"),className:"hero-banner hero-banner--v2",onError:W=>{W.currentTarget.style.display="none"}}),c.jsx("div",{className:"hero-banner-glow","aria-hidden":"true"}),c.jsx("div",{className:"hero-banner-fade","aria-hidden":"true"})]}),c.jsxs("div",{className:"absolute bottom-8 left-1/2 -translate-x-1/2 flex flex-col items-center gap-2","aria-hidden":"true",style:{opacity:d?.4:0,transition:"opacity 1s ease 1.5s"},children:[c.jsx("span",{className:"text-xs tracking-widest uppercase",style:{color:"var(--pc-text-faint)"},children:n("landing.hero.scroll_cue")}),c.jsx("div",{className:"scroll-cue-line"})]})]}),c.jsx("section",{className:"stats-strip relative px-4 py-12","aria-label":n("landing.stats.aria_label"),children:c.jsx("div",{ref:g,className:"mx-auto max-w-4xl",style:{opacity:_?1:0,transform:_?"translateY(0)":"translateY(16px)",transition:"opacity 0.6s ease, transform 0.6s ease"},children:c.jsx("dl",{className:"stats-list",children:BJ.map((W,P)=>c.jsxs("div",{className:"stat-item",style:{opacity:_?1:0,transform:_?"translateY(0)":"translateY(12px)",transition:`opacity 0.5s ease ${P*80}ms, transform 0.5s ease ${P*80}ms`},children:[c.jsx("dt",{className:"stat-value",children:W.value}),c.jsx("dd",{className:"stat-label",children:n(W.labelKey)})]},W.labelKey))})})}),c.jsx("section",{className:"pillars-section relative px-4 py-20","aria-label":n("landing.pillars.aria_label"),children:c.jsxs("div",{className:"mx-auto max-w-5xl",children:[c.jsxs("div",{ref:x,className:"mb-10 text-center",style:{opacity:v?1:0,transform:v?"translateY(0)":"translateY(20px)",transition:"opacity 0.6s ease, transform 0.6s ease"},children:[c.jsxs("div",{className:"shell-chip inline-flex mb-4",children:[c.jsx(vE,{className:"h-3 w-3"}),n("landing.pillars.badge")]}),c.jsx("h2",{className:"text-3xl font-bold mb-3 sm:text-4xl",style:{color:"var(--pc-text-primary)"},children:n("landing.pillars.title")}),c.jsx("p",{className:"text-base max-w-2xl mx-auto leading-relaxed",style:{color:"var(--pc-text-muted)"},children:n("landing.pillars.description")})]}),c.jsx("div",{className:"grid gap-4 sm:grid-cols-3",children:zJ.map((W,P)=>{const q=W.icon;return c.jsxs("div",{className:"card p-6 flex flex-col",style:{opacity:v?1:0,transform:v?"translateY(0)":"translateY(18px)",transition:`opacity 0.55s ease ${120+P*80}ms, transform 0.55s ease ${120+P*80}ms`},children:[c.jsx("div",{className:"inline-flex h-10 w-10 items-center justify-center rounded-2xl mb-4",style:{background:`${W.color}1a`,border:`1px solid ${W.color}33`},children:c.jsx(q,{className:"h-5 w-5",style:{color:W.color}})}),c.jsx("h3",{className:"font-semibold text-base mb-2",style:{color:"var(--pc-text-primary)"},children:n(W.titleKey)}),c.jsx("p",{className:"text-sm leading-relaxed",style:{color:"var(--pc-text-muted)"},children:n(W.descKey)})]},W.id)})})]})}),c.jsx("section",{ref:s,className:"features-section relative px-4 py-24","aria-label":n("landing.features.aria_label"),children:c.jsxs("div",{className:"mx-auto max-w-6xl",children:[c.jsxs("div",{ref:S,className:"mb-12 text-center",style:{opacity:w?1:0,transform:w?"translateY(0)":"translateY(20px)",transition:"opacity 0.6s ease, transform 0.6s ease"},children:[c.jsxs("div",{className:"shell-chip inline-flex mb-4",children:[c.jsx(fE,{className:"h-3 w-3"}),n("landing.features.badge")]}),c.jsx("h2",{className:"text-3xl font-bold mb-3 sm:text-4xl",style:{color:"var(--pc-text-primary)"},children:n("landing.features.title")}),c.jsx("p",{className:"text-base max-w-2xl mx-auto leading-relaxed",style:{color:"var(--pc-text-muted)"},children:n("landing.features.description")})]}),c.jsx("div",{className:"bento-grid",children:LJ.map((W,P)=>c.jsx("div",{className:W.featured?"bento-cell bento-cell--wide":"bento-cell",children:c.jsx(HJ,{icon:W.icon,title:n(W.titleKey),desc:n(W.descKey),color:W.color,featured:W.featured,delay:P*75,featuredBadge:n("landing.features.featured_badge")})},W.id))})]})}),c.jsxs("section",{className:"how-section relative px-4 py-24","aria-label":n("landing.how.aria_label"),children:[c.jsx("div",{className:"how-bg-orb","aria-hidden":"true"}),c.jsxs("div",{className:"mx-auto max-w-5xl",children:[c.jsxs("div",{ref:N,className:"mb-16 text-center",style:{opacity:C?1:0,transform:C?"translateY(0)":"translateY(20px)",transition:"opacity 0.6s ease, transform 0.6s ease"},children:[c.jsxs("div",{className:"shell-chip inline-flex mb-4",children:[c.jsx(xd,{className:"h-3 w-3"}),n("landing.how.badge")]}),c.jsx("h2",{className:"text-3xl font-bold mb-3 sm:text-4xl",style:{color:"var(--pc-text-primary)"},children:n("landing.how.title")}),c.jsx("p",{className:"text-base max-w-2xl mx-auto leading-relaxed",style:{color:"var(--pc-text-muted)"},children:n("landing.how.description")})]}),c.jsx("div",{className:"how-steps-grid",children:Y3.map((W,P)=>c.jsx(qJ,{step:W.step,icon:W.icon,title:n(W.titleKey),desc:n(W.descKey),color:W.color,delay:P*120,isLast:P===Y3.length-1},W.step))})]})]}),c.jsx("section",{className:"cli-section relative px-4 py-24","aria-label":n("landing.cli.aria_label"),children:c.jsxs("div",{className:"mx-auto max-w-5xl",children:[c.jsxs("div",{ref:T,className:"mb-12 text-center",style:{opacity:A?1:0,transform:A?"translateY(0)":"translateY(20px)",transition:"opacity 0.6s ease, transform 0.6s ease"},children:[c.jsxs("div",{className:"shell-chip inline-flex mb-4",children:[c.jsx(av,{className:"h-3 w-3"}),n("landing.cli.badge")]}),c.jsx("h2",{className:"text-3xl font-bold mb-3 sm:text-4xl",style:{color:"var(--pc-text-primary)"},children:n("landing.cli.title")}),c.jsx("p",{className:"text-base max-w-2xl mx-auto leading-relaxed",style:{color:"var(--pc-text-muted)"},children:n("landing.cli.description")})]}),c.jsx("div",{className:"grid gap-3 sm:grid-cols-2",children:$J.map(({cmd:W,descKey:P},q)=>c.jsxs("div",{className:"glass-card px-4 py-3",style:{opacity:A?1:0,transform:A?"translateY(0)":"translateY(14px)",transition:`opacity 0.5s ease ${100+q*50}ms, transform 0.5s ease ${100+q*50}ms`},children:[c.jsx("code",{className:"text-xs font-mono block mb-1",style:{color:"var(--pc-accent-light)"},children:W}),c.jsx("span",{className:"text-xs",style:{color:"var(--pc-text-muted)"},children:n(P)})]},W))})]})}),c.jsxs("section",{className:"arch-section relative px-4 py-24","aria-label":n("landing.arch.aria_label"),children:[c.jsx("div",{className:"arch-bg-orb","aria-hidden":"true"}),c.jsxs("div",{className:"mx-auto max-w-5xl",children:[c.jsxs("div",{ref:E,className:"mb-12 text-center",style:{opacity:D?1:0,transform:D?"translateY(0)":"translateY(20px)",transition:"opacity 0.6s ease, transform 0.6s ease"},children:[c.jsxs("div",{className:"shell-chip inline-flex mb-4",children:[c.jsx(t0,{className:"h-3 w-3"}),n("landing.arch.badge")]}),c.jsx("h2",{className:"text-3xl font-bold mb-3 sm:text-4xl",style:{color:"var(--pc-text-primary)"},children:n("landing.arch.title")}),c.jsx("p",{className:"text-base max-w-2xl mx-auto leading-relaxed",style:{color:"var(--pc-text-muted)"},children:n("landing.arch.description")})]}),c.jsx("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-4",children:IJ.map((W,P)=>c.jsx(WJ,{ns:W.ns,purpose:n(W.purposeKey),icon:W.icon,delay:P*60},W.ns))}),c.jsx("div",{className:"arch-connect-bar mt-8","aria-hidden":"true"}),c.jsx("p",{className:"text-xs text-center mt-4",style:{color:"var(--pc-text-faint)"},children:n("landing.arch.connection_note")})]})]}),c.jsx("section",{className:"tunnels-section relative px-4 py-24","aria-label":n("landing.tunnels.aria_label"),children:c.jsxs("div",{className:"mx-auto max-w-4xl",children:[c.jsxs("div",{ref:F,className:"mb-10 text-center",style:{opacity:B?1:0,transform:B?"translateY(0)":"translateY(20px)",transition:"opacity 0.6s ease, transform 0.6s ease"},children:[c.jsxs("div",{className:"shell-chip inline-flex mb-4",children:[c.jsx(hE,{className:"h-3 w-3"}),n("landing.tunnels.badge")]}),c.jsx("h2",{className:"text-3xl font-bold mb-3 sm:text-4xl",style:{color:"var(--pc-text-primary)"},children:n("landing.tunnels.title")}),c.jsxs("p",{className:"text-base max-w-2xl mx-auto leading-relaxed",style:{color:"var(--pc-text-muted)"},children:[n("landing.tunnels.description_prefix"),c.jsx("span",{className:"font-mono",style:{color:"var(--pc-accent-light)"},children:"127.0.0.1"}),n("landing.tunnels.description_suffix")]})]}),c.jsx("div",{className:"grid gap-3 sm:grid-cols-2",children:FJ.map((W,P)=>c.jsxs("div",{className:"glass-card px-4 py-4",style:{opacity:B?1:0,transform:B?"translateY(0)":"translateY(14px)",transition:`opacity 0.5s ease ${100+P*70}ms, transform 0.5s ease ${100+P*70}ms`},children:[c.jsx("div",{className:"text-sm font-semibold mb-1",style:{color:"var(--pc-text-primary)"},children:n(W.nameKey)}),c.jsx("p",{className:"text-xs leading-relaxed",style:{color:"var(--pc-text-muted)"},children:n(W.descKey)})]},W.id))}),c.jsxs("p",{className:"text-xs text-center mt-6",style:{color:"var(--pc-text-faint)"},children:[n("landing.tunnels.setup_hint_prefix"),c.jsx("span",{className:"font-mono",style:{color:"var(--pc-accent-light)"},children:"revka onboard --reinit"}),n("landing.tunnels.setup_hint_suffix")]})]})}),c.jsxs("section",{className:"cta-section relative px-4 py-32 text-center overflow-hidden","aria-label":n("landing.cta.aria_label"),children:[c.jsx("div",{className:"cta-orb-1","aria-hidden":"true"}),c.jsx("div",{className:"cta-orb-2","aria-hidden":"true"}),c.jsxs("div",{ref:H,className:"relative mx-auto max-w-2xl",style:{opacity:$?1:0,transform:$?"translateY(0) scale(1)":"translateY(24px) scale(0.97)",transition:"opacity 0.7s ease, transform 0.7s ease"},children:[c.jsx("img",{src:id("revka-icon.png"),alt:"",className:"revka-brand-logo h-20 w-20 rounded-2xl object-contain mx-auto mb-6 animate-float","aria-hidden":"true",onError:W=>{W.currentTarget.style.display="none"}}),c.jsxs("h2",{className:"text-4xl font-bold mb-4 sm:text-5xl",style:{color:"var(--pc-text-primary)"},children:[n("landing.cta.headline_prefix"),c.jsx("span",{className:"text-gradient-fox",children:n("landing.cta.headline_highlight")}),n("landing.cta.headline_suffix")]}),c.jsx("p",{className:"text-base mb-10 max-w-xl mx-auto leading-relaxed",style:{color:"var(--pc-text-muted)"},children:n("landing.cta.description")}),c.jsxs("button",{onClick:()=>e("/dashboard"),className:"btn-electric inline-flex items-center gap-2 px-10 py-4 text-lg font-semibold rounded-2xl",children:[n("landing.cta.button"),c.jsx(sf,{className:"h-5 w-5"})]})]})]})]}),c.jsx("footer",{className:"landing-footer px-6 py-10",style:{borderTop:"1px solid var(--pc-border)"},children:c.jsxs("div",{className:"mx-auto max-w-5xl flex flex-col items-center gap-4 sm:flex-row sm:justify-between",children:[c.jsxs("div",{className:"flex items-center gap-2.5",children:[c.jsx("img",{src:id("revka-icon.png"),alt:"",className:"revka-brand-logo h-6 w-6 rounded-lg object-contain","aria-hidden":"true",onError:W=>{W.currentTarget.style.display="none"}}),c.jsx("span",{className:"text-sm font-semibold",style:{color:"var(--pc-text-secondary)"},children:"Revka"})]}),c.jsx("div",{className:"flex items-center gap-2 flex-wrap justify-center",children:["Rust","React","Kumiho","Neo4j","MCP"].map(W=>c.jsx("span",{className:"footer-tech-chip",children:W},W))}),c.jsx("p",{className:"text-xs",style:{color:"var(--pc-text-faint)"},children:n("landing.footer.tagline")})]})})]})}const Ta=()=>b.useContext(rB);function cr(){if(typeof crypto<"u"&&typeof crypto.randomUUID=="function")return crypto.randomUUID();const e=globalThis.crypto,n=new Uint8Array(16);e.getRandomValues(n),n[6]=n[6]&15|64,n[8]=n[8]&63|128;const r=Array.from(n,i=>i.toString(16).padStart(2,"0")).join("");return`${r.slice(0,8)}-${r.slice(8,12)}-${r.slice(12,16)}-${r.slice(16,20)}-${r.slice(20)}`}const VJ=1e3,KJ=3e4,G3="revka_session_id";function YJ(){let e=sessionStorage.getItem(G3);return e||(e=cr(),sessionStorage.setItem(G3,e)),e}class GJ{constructor(n={}){$n(this,"ws",null);$n(this,"currentDelay");$n(this,"reconnectTimer",null);$n(this,"intentionallyClosed",!1);$n(this,"onMessage",null);$n(this,"onOpen",null);$n(this,"onClose",null);$n(this,"onError",null);$n(this,"baseUrl");$n(this,"sessionId");$n(this,"name");$n(this,"reconnectDelay");$n(this,"maxReconnectDelay");$n(this,"autoReconnect");let r;Kf()&&Ti?r=Ti.replace(/^http/,"ws"):r=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}`,this.baseUrl=n.baseUrl??r,this.sessionId=n.sessionId,this.name=n.name,this.reconnectDelay=n.reconnectDelay??VJ,this.maxReconnectDelay=n.maxReconnectDelay??KJ,this.autoReconnect=n.autoReconnect??!0,this.currentDelay=this.reconnectDelay}connect(){this.intentionallyClosed=!1,this.clearReconnectTimer(),this.ws&&(this.ws.onopen=null,this.ws.onmessage=null,this.ws.onclose=null,this.ws.onerror=null,this.ws.close(),this.ws=null);const n=ns(),r=this.sessionId??YJ(),i=new URLSearchParams;n&&i.set("token",n),i.set("session_id",r),this.name&&i.set("name",this.name);const s=`${this.baseUrl}${Gr}/ws/chat?${i.toString()}`;this.ws=new WebSocket(s,["revka.v1"]),this.ws.onopen=()=>{var a;this.currentDelay=this.reconnectDelay,(a=this.onOpen)==null||a.call(this)},this.ws.onmessage=a=>{var o;try{const l=JSON.parse(a.data);(o=this.onMessage)==null||o.call(this,l)}catch{}},this.ws.onclose=a=>{var o;(o=this.onClose)==null||o.call(this,a),this.scheduleReconnect()},this.ws.onerror=a=>{var o;(o=this.onError)==null||o.call(this,a)}}sendConnect(){!this.ws||this.ws.readyState!==WebSocket.OPEN||this.ws.send(JSON.stringify({type:"connect"}))}sendMessage(n,r,i){if(!this.ws||this.ws.readyState!==WebSocket.OPEN)throw new Error("WebSocket is not connected");const s={type:"message",content:n};r&&(s.page_context=r),i&&i.length>0&&(s.attachments=i),this.ws.send(JSON.stringify(s))}sendSteer(n,r){if(!this.ws||this.ws.readyState!==WebSocket.OPEN)throw new Error("WebSocket is not connected");const i={type:"steer",content:n};r&&(i.page_context=r),this.ws.send(JSON.stringify(i))}sendStop(){if(!this.ws||this.ws.readyState!==WebSocket.OPEN)throw new Error("WebSocket is not connected");this.ws.send(JSON.stringify({type:"stop"}))}disconnect(){this.intentionallyClosed=!0,this.clearReconnectTimer(),this.ws&&(this.ws.close(),this.ws=null)}get connected(){var n;return((n=this.ws)==null?void 0:n.readyState)===WebSocket.OPEN}scheduleReconnect(){this.intentionallyClosed||!this.autoReconnect||(this.reconnectTimer=setTimeout(()=>{this.currentDelay=Math.min(this.currentDelay*2,this.maxReconnectDelay),this.connect()},this.currentDelay))}clearReconnectTimer(){this.reconnectTimer!==null&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null)}}const cC=b.createContext({getDraft:()=>"",setDraft:()=>{},clearDraft:()=>{}});function XJ(){const e=b.useRef(new Map),n=b.useCallback(s=>e.current.get(s)??"",[]),r=b.useCallback((s,a)=>{e.current.set(s,a)},[]),i=b.useCallback(s=>{e.current.delete(s)},[]);return b.useMemo(()=>({getDraft:n,setDraft:r,clearDraft:i}),[n,r,i])}const QJ=100,ZJ="revka_chat_history_v1:";function qB(e){return`${ZJ}${e}`}function yw(e){var n;try{const r=localStorage.getItem(qB(e));if(!r)return[];const i=JSON.parse(r);return(n=i.messages)!=null&&n.length?i.messages:[]}catch{return[]}}function JJ(e,n){try{const r=n.slice(-QJ);localStorage.setItem(qB(e),JSON.stringify({messages:r}))}catch{}}function eee(e){const n=Date.now()-e.length*1e3,r=[];let i=0;for(const s of e){if(s.role==="system")continue;const a=new Date(n+i*1e3).toISOString();i+=1,s.role==="user"?r.push({id:cr(),role:"user",content:s.content,timestamp:a}):s.role==="assistant"?r.push({id:cr(),role:"agent",content:s.content,markdown:!0,timestamp:a}):r.push({id:cr(),role:"agent",content:s.content,markdown:!1,timestamp:a})}return r}function X3(e){return e.map(n=>({id:n.id,role:n.role,content:n.content,thinking:n.thinking,markdown:n.markdown,timestamp:new Date(n.timestamp)}))}function tee(e){return e.map(n=>({id:n.id,role:n.role,content:n.content,thinking:n.thinking,markdown:n.markdown,timestamp:n.timestamp.toISOString()}))}function _w(e){return{save_agent:"Creating agent",save_agent_template:"Saving agent template",create_team:"Building team",search_agents:"Searching agents",search_agent_pool:"Searching agent pool",search_teams:"Searching teams",list_agent_templates:"Listing agents",list_teams:"Listing teams",get_team:"Fetching team details",save_plan:"Saving plan",save_skill:"Saving skill",set_agent_trust:"Setting trust level",set_agent_goal:"Setting agent goal",shell:"Running command",search_clawhub:"Searching ClawHub",browse_clawhub:"Browsing ClawHub",install_from_clawhub:"Installing from ClawHub",render_canvas:"Rendering to canvas",clear_canvas:"Clearing canvas"}[e]||e.replace(/_/g," ")}function Q3(e){switch(e){case"spawning":return"🤖";case"waiting":return"⏳";case"delegating":return"📨";case"collecting":case"collected":return"📋";case"checking":case"listing":case"searching":return"🔍";case"saving":return"💾";case"steering":return"🎯";case"finalizing":return"⏳";case"spawned":case"completed":return"✅";case"failed":return"❌";case"blocked":return"🛑";case"running":return"🏃";default:return"⚙️"}}function Z3(e){return!!e&&!["completed","spawned","collected","failed","blocked"].includes(e)}async function Ja(e){var n;if(typeof navigator<"u"&&((n=navigator.clipboard)!=null&&n.writeText)&&window.isSecureContext)try{return await navigator.clipboard.writeText(e),!0}catch{}return nee(e)}function nee(e){if(typeof document>"u")return!1;const n=document.createElement("textarea");n.value=e,n.setAttribute("readonly",""),n.style.position="fixed",n.style.top="0",n.style.left="0",n.style.opacity="0",document.body.appendChild(n);const r=document.getSelection(),i=r&&r.rangeCount>0?r.getRangeAt(0):null;n.select(),n.setSelectionRange(0,e.length);let s=!1;try{s=document.execCommand("copy")}catch{s=!1}finally{document.body.removeChild(n),i&&r&&(r.removeAllRanges(),r.addRange(i))}return s}const ree=500,iee=12e3;function see(e){return e?/(^|\n)(diff --git|@@ |--- |\+\+\+ |\*\*\* Begin Patch|\*\*\* Update File:)/.test(e):!1}function aee(e){return e==="file_edit"||e==="file_write"}function oee(e,n){if(!n)return n;const r=see(n)||aee(e)?iee:ree;return n.length<=r?n:`${n.slice(0,r)}

${Vs("agent.tool_output_truncated")}`}function lee(e){if(e)try{const n=JSON.parse(e);return n&&typeof n=="object"&&!Array.isArray(n)?n:void 0}catch{return}}function J3(e,n){return(n.length>0?n.split(/\r?\n/):[""]).map(i=>`${e}${i}`)}function cee(e,n){const r=lee(n),i=typeof(r==null?void 0:r.path)=="string"?r.path:"file";if(e==="file_edit"){const s=typeof(r==null?void 0:r.old_string)=="string"?r.old_string:void 0,a=typeof(r==null?void 0:r.new_string)=="string"?r.new_string:void 0;return s===void 0||a===void 0?void 0:[`--- ${i}`,`+++ ${i}`,"@@",...J3("-",s),...J3("+",a)].join(`
`)}}function UB({sessionId:e,sessionName:n,draftKey:r,pageContext:i,onUserMessage:s,onToolResult:a}){const{getDraft:o,setDraft:l,clearDraft:u}=b.useContext(cC),[d,p]=b.useState([]),[f,g]=b.useState(!1),[_,x]=b.useState(()=>o(r)),[v,S]=b.useState(!1),[w,N]=b.useState(!1),[C,T]=b.useState(null),[A,E]=b.useState([]),[D,F]=b.useState(""),[B,H]=b.useState(""),[$,z]=b.useState(null),[W,P]=b.useState([]),[q,I]=b.useState([]),[Q,K]=b.useState(!1),[Z,Y]=b.useState([]),[R,U]=b.useState(0),V=b.useRef(null),ie=b.useRef(null),te=b.useRef(""),X=b.useRef(""),se=b.useRef(""),re=b.useRef([]),de=b.useRef(null),ue=b.useRef(null),ae=b.useRef(!1),pe=b.useRef(!1),J=b.useRef(new Map),me=b.useRef(!1),fe=b.useRef(s);fe.current=s;const ve=b.useRef(a);ve.current=a;const Ke=b.useRef(r);Ke.current=r;const ge=b.useRef(!1);b.useEffect(()=>{ae.current=v},[v]);const Ue=b.useCallback(()=>{if(de.current===null){if(typeof window>"u"||typeof window.requestAnimationFrame!="function"){F(te.current),H(X.current);return}de.current=window.requestAnimationFrame(()=>{de.current=null,F(te.current),H(X.current)})}},[]),$e=b.useCallback(()=>{de.current!==null&&typeof window<"u"&&(window.cancelAnimationFrame(de.current),de.current=null),F(te.current),H(X.current)},[]),Bt=b.useCallback(()=>{if(ue.current===null){if(typeof window>"u"||typeof window.requestAnimationFrame!="function"){E(re.current);return}ue.current=window.requestAnimationFrame(()=>{ue.current=null,E(re.current)})}},[]),ct=b.useCallback(()=>{ue.current!==null&&typeof window<"u"&&(window.cancelAnimationFrame(ue.current),ue.current=null),E(re.current)},[]);b.useEffect(()=>()=>{de.current!==null&&typeof window<"u"&&window.cancelAnimationFrame(de.current),ue.current!==null&&typeof window<"u"&&window.cancelAnimationFrame(ue.current)},[]);const Mt=b.useCallback(()=>{J.current.size===0&&!me.current||(J.current.clear(),me.current=!1,p(le=>{let je=!1;const Te=le.map(Me=>Me.deliveryStatus!=="sending"?Me:(je=!0,{...Me,deliveryStatus:"sent"}));return je?Te:le}))},[]),Tt=b.useCallback(()=>{const le=Array.from(J.current.values()),je=le[le.length-1];return je?(J.current.delete(je.id),I(Te=>Te.some(Me=>Me.id===je.id)?Te:[je,...Te]),p(Te=>Te.map(Me=>Me.id===je.id?{...Me,deliveryStatus:"queued"}:Me)),!0):!1},[]);b.useEffect(()=>{x(o(r))},[e]),b.useEffect(()=>{l(Ke.current,_)},[_,l]),b.useEffect(()=>{let le=!1;return p([]),E([]),P([]),I([]),pe.current=!1,J.current.clear(),me.current=!1,K(!1),re.current=[],ue.current!==null&&typeof window<"u"&&(window.cancelAnimationFrame(ue.current),ue.current=null),de.current!==null&&typeof window<"u"&&(window.cancelAnimationFrame(de.current),de.current=null),F(""),H(""),S(!1),T(null),g(!1),ge.current=!1,(async()=>{try{const je=await jQ(e);if(le)return;const Te=yw(e),Me=je.session_persistence?eee(je.messages):[],Ne=Me.length>0?Me:Te;Ne.length>0&&(ge.current=!0),p(Ne.length?X3(Ne):[])}catch{if(!le){const je=yw(e);je.length>0&&(ge.current=!0),p(je.length?X3(je):[])}}finally{le||g(!0)}})(),()=>{le=!0}},[e]),b.useEffect(()=>{if(!f)return;const le=tee(d.filter(je=>je.role!=="operator"));if(le.length>0)ge.current=!0;else if(!ge.current&&yw(e).length>0)return;JJ(e,le)},[f,d,e]),b.useEffect(()=>{let le=!1,je=null;const Te=setTimeout(()=>{if(le)return;je=new GJ({sessionId:e,name:n}),je.onOpen=()=>{le||(N(!0),T(null))};const Me=()=>{S(!1),J.current.clear(),me.current=!1,te.current="",X.current="",se.current="",$e(),re.current=[],ct(),K(!1)};je.onClose=Ne=>{if(!le&&(N(!1),Me(),Ne.code!==1e3&&Ne.code!==1001)){const Ee=Ne.code===1006?"Connection interrupted; reconnecting...":`Connection closed unexpectedly (code: ${Ne.code}). Reconnecting...`;T(Ee)}},je.onError=()=>{le||(Me(),T(Vs("agent.connection_error")))},je.onMessage=Ne=>{if(!le)switch(Ne.type){case"session_start":case"connected":break;case"thinking":{Mt(),S(!0);const Ee=Ne.content??"";X.current+=Ee,Ue();const rt=re.current,Ye=rt[rt.length-1],it=(Ye==null?void 0:Ye.kind)==="thinking"?[...rt.slice(0,-1),{...Ye,label:Vs("agent.reasoning_trace_label"),detail:(Ye.detail??"")+Ee}]:[...rt,{id:cr(),kind:"thinking",label:Vs("agent.reasoning_trace_label"),detail:Ee||void 0,timestamp:new Date}];re.current=it,Bt();break}case"chunk":Mt(),S(!0),te.current+=Ne.content??"",Ue();break;case"chunk_reset":se.current=X.current,te.current="",X.current="",$e();break;case"message":case"done":{const Ee=Ne.full_response??Ne.content??te.current,rt=se.current||X.current||void 0,Ye=re.current.filter(it=>it.kind!=="thinking"||!!it.detail);re.current=[],ct(),Ee?p(it=>[...it,{id:cr(),role:"agent",content:Ee,thinking:rt,markdown:!0,timestamp:new Date,activityLog:Ye.length>0?Ye:void 0}]):Ye.length>0&&p(it=>[...it,{id:cr(),role:"operator",content:Ye.map(kt=>kt.label).join(`
`),operatorPhase:"completed",timestamp:new Date,activityLog:Ye}]),te.current="",X.current="",se.current="",$e(),Mt(),S(!1),K(!1);break}case"tool_call":{Mt(),S(!0);const Ee=Ne.name??"tool",rt=[...re.current,{id:cr(),kind:"tool_call",label:_w(Ee),detail:Ne.args?typeof Ne.args=="string"?Ne.args:JSON.stringify(Ne.args,null,2):void 0,toolName:Ee,status:"running",timestamp:new Date}];re.current=rt,E(rt);break}case"tool_result":{Mt();const Ee=Ne.name??"tool",rt=oee(Ee,Ne.output),Ye=re.current,it=[...Ye].reverse().findIndex(zt=>zt.kind==="tool_call"&&zt.toolName===Ee&&zt.status!=="done"),kt=it>=0?Ye.length-1-it:-1,mt=kt>=0?Ye.map((zt,xe)=>{var nn;if(xe!==kt)return zt;const qe=(nn=zt.detail)==null?void 0:nn.trim(),dt=cee(Ee,qe),sn=[qe?`${Vs("agent.activity_input_label")}
${qe}`:"",dt?`${Vs("agent.activity_diff_label")}
${dt}`:"",rt?`${Vs("agent.activity_output_label")}
${rt}`:""].filter(Boolean).join(`

`);return{...zt,kind:"tool_result",label:`${_w(Ee)} - done`,detail:sn||void 0,status:"done",timestamp:new Date}}):[...Ye,{id:cr(),kind:"tool_result",label:`${_w(Ee)} - done`,detail:rt,toolName:Ee,status:"done",timestamp:new Date}];re.current=mt,E(mt),ve.current&&Ne.name&&ve.current({id:cr(),name:Ne.name,output:Ne.output??""});break}case"stopped":{const Ee=re.current;re.current=[],ct(),te.current="",X.current="",se.current="",$e(),Mt(),S(!1),K(!1),p(rt=>[...rt,{id:cr(),role:"operator",content:Ne.message??"Stopped current Operator turn.",operatorPhase:"stopped",timestamp:new Date,activityLog:Ee.length>0?Ee:void 0}]);break}case"operator_status":{const Ee=Ne.phase??"working",rt=Ne.detail??"";Ee==="queued"?Tt():Mt(),S(!0);const Ye={id:cr(),kind:"operator",label:`${Q3(Ee)} ${rt}`,detail:rt||void 0,timestamp:new Date},it=re.current,kt=it[it.length-1],mt=Z3(Ee)&&(kt==null?void 0:kt.kind)==="operator"?[...it.slice(0,-1),{...Ye,id:kt.id}]:[...it,Ye];re.current=mt,E(mt),Z3(Ee)||p(zt=>[...zt,{id:cr(),role:"operator",content:`${Q3(Ee)} ${rt}`,operatorPhase:Ee,timestamp:new Date}]);break}case"agent_event":{const Ee=Ne.event;Ee&&P(rt=>[...rt,Ee]);break}case"error":p(Ee=>[...Ee,{id:cr(),role:"agent",content:`${Vs("agent.error_prefix")} ${Ne.message??Vs("agent.unknown_error")}`,timestamp:new Date}]),Ne.code==="AGENT_INIT_FAILED"||Ne.code==="AUTH_ERROR"||Ne.code==="PROVIDER_ERROR"?T(`Configuration error: ${Ne.message}. Please check your provider settings (API key, model, etc.).`):(Ne.code==="INVALID_JSON"||Ne.code==="UNKNOWN_MESSAGE_TYPE"||Ne.code==="EMPTY_CONTENT")&&T(`Message error: ${Ne.message}`),S(!1),te.current="",X.current="",se.current="",$e(),re.current=[],ct(),Mt(),K(!1);break}},je.connect(),V.current=je},50);return()=>{le=!0,clearTimeout(Te),je&&je.disconnect(),V.current=null}},[ct,$e,Mt,Tt,Bt,Ue,e,n]);const Dt=b.useCallback((le,je)=>{var Te,Me;if(!((Te=V.current)!=null&&Te.connected))return!1;try{V.current.sendMessage(le.content,i,le.attachments.map(Ne=>Ne.file_id)),J.current.set(le.id,le),(Me=fe.current)==null||Me.call(fe,le.content),je&&(me.current=!0,p(Ne=>Ne.map(Ee=>Ee.id===le.id?{...Ee,deliveryStatus:"sending"}:Ee))),S(!0),te.current="",X.current="",se.current="",$e(),re.current=[],ct()}catch{return T(Vs("agent.send_error")),!1}return!0},[ct,$e,i]),Re=b.useCallback(()=>{var Ne;const le=_.trim();if(!le&&Z.length===0||!((Ne=V.current)!=null&&Ne.connected)||R>0)return!1;const je=Z.length>0?`
`+Z.map(Ee=>`[Attached: ${Ee.filename} (${Ee.size}b)]`).join(`
`):"",Te=le+je,Me={id:cr(),content:le,attachments:Z};if(ae.current)I(Ee=>[...Ee,Me]),p(Ee=>[...Ee,{id:Me.id,role:"user",content:Te,deliveryStatus:"queued",timestamp:new Date}]);else if(me.current=!0,p(Ee=>[...Ee,{id:Me.id,role:"user",content:Te,deliveryStatus:"sending",timestamp:new Date}]),!Dt(Me,!1))return!1;return x(""),Y([]),u(Ke.current),ie.current&&(ie.current.style.height="auto",ie.current.focus()),!0},[Z,u,_,Dt,R]);b.useEffect(()=>{if(v||!w||q.length===0||pe.current)return;const le=q[0];if(!le)return;const je=q.slice(1);pe.current=!0,I(je),Dt(le,!0)||I(Te=>[le,...Te]),queueMicrotask(()=>{pe.current=!1})},[w,q,Dt,v]);const et=b.useCallback(()=>{var le;if(!ae.current||!((le=V.current)!=null&&le.connected)||Q)return!1;try{return V.current.sendStop(),K(!0),!0}catch{return T(Vs("agent.send_error")),!1}},[Q]),bt=b.useCallback(()=>{var je;const le=_.trim();if(!le||!ae.current||!((je=V.current)!=null&&je.connected)||Z.length>0||R>0)return!1;try{return V.current.sendSteer(le,i),me.current=!0,p(Te=>[...Te,{id:cr(),role:"user",content:`${Vs("agent.steer_prefix")} ${le}`,deliveryStatus:"sending",timestamp:new Date}]),x(""),u(Ke.current),ie.current&&(ie.current.style.height="auto",ie.current.focus()),!0}catch{return T(Vs("agent.send_error")),!1}},[Z.length,u,_,i,R]),yt=b.useCallback(le=>{var Me;const je=le.trim();if(!je||!((Me=V.current)!=null&&Me.connected))return!1;const Te={id:cr(),content:je,attachments:[]};return ae.current?(I(Ne=>[...Ne,Te]),p(Ne=>[...Ne,{id:Te.id,role:"user",content:je,deliveryStatus:"queued",timestamp:new Date}]),!0):(me.current=!0,p(Ne=>[...Ne,{id:Te.id,role:"user",content:je,deliveryStatus:"sending",timestamp:new Date}]),Dt(Te,!1))},[Dt]),O=b.useCallback(async le=>{U(je=>je+1);try{const je=await AQ(e,le);let Te;je.mime.startsWith("image/")&&(Te=await new Promise(Ne=>{const Ee=new FileReader;Ee.onload=()=>Ne(typeof Ee.result=="string"?Ee.result:void 0),Ee.onerror=()=>Ne(void 0),Ee.readAsDataURL(le)}));const Me={...je,previewUrl:Te};return Y(Ne=>[...Ne,Me]),Me}catch(je){const Te=je instanceof Error?je.message:"upload failed";return T(`Attachment upload failed: ${Te}`),null}finally{U(je=>Math.max(0,je-1))}},[e]),ke=b.useCallback(le=>{Y(je=>je.filter(Te=>Te.file_id!==le))},[]),Le=b.useCallback(()=>{Y([])},[]),ye=b.useCallback(le=>{x(le.target.value),le.target.style.height="auto",le.target.style.height=`${Math.min(le.target.scrollHeight,200)}px`},[]),_e=b.useCallback(()=>{ge.current=!0,p([]),re.current=[],te.current="",X.current="",se.current="",ct(),$e(),me.current=!1,S(!1),T(null)},[ct,$e]),Pe=b.useCallback(le=>{p(je=>[...je,{id:cr(),role:"operator",content:le,operatorPhase:"completed",timestamp:new Date}])},[]),ee=b.useCallback(async(le,je)=>{await Ja(je)&&(z(le),setTimeout(()=>z(Te=>Te===le?null:Te),2e3))},[]);return{activities:A,addAttachment:O,agentEvents:W,appendSystemMessage:Pe,attachments:Z,clearAttachments:Le,clearMessages:_e,connected:w,copiedId:$,copyMessage:ee,error:C,handleSend:Re,handleTextareaChange:ye,input:_,inputRef:ie,messages:d,removeAttachment:ke,setInput:x,streamingContent:D,streamingThinking:B,queuedTurns:q,stopCurrentTurn:et,steerCurrentTurn:bt,stopping:Q,submitMessage:yt,typing:v,uploadingCount:R}}const VB=b.createContext({open:!1,openAssistant:()=>{},closeAssistant:()=>{},toggleAssistant:()=>{}});function xE(){return b.useContext(VB)}function uee({children:e}){const[n,r]=b.useState(!1),[i,s]=b.useState(),[a,o]=b.useState(),[l,u]=b.useState(),d=b.useMemo(()=>({open:n,pageContextOverride:i,titleOverride:a,placeholderOverride:l,openAssistant:p=>{s(p==null?void 0:p.pageContext),o(p==null?void 0:p.title),u(p==null?void 0:p.placeholder),r(!0)},closeAssistant:()=>{r(!1),s(void 0),o(void 0),u(void 0)},toggleAssistant:()=>{n?(r(!1),s(void 0),o(void 0),u(void 0)):r(!0)}}),[n,i,l,a]);return c.jsx(VB.Provider,{value:d,children:e})}const KB=[{id:"orchestration",label:"Orchestration",labelKey:"nav.section.orchestration",items:[{to:"/dashboard",label:"Dashboard",labelKey:"nav.dashboard",icon:gJ,blurb:"Live runtime posture and active DAG state",blurbKey:"nav.dashboard.blurb"},{to:"/workflows",label:"Workflows",labelKey:"nav.workflows",icon:o0,blurb:"Define DAGs and drill into runs from the same flow",blurbKey:"nav.workflows.blurb"},{to:"/agents",label:"Agents",labelKey:"nav.agents",icon:zl,blurb:"Reusable actors and workflow participants",blurbKey:"nav.agents.blurb"},{to:"/canvas",label:"Canvas",labelKey:"nav.canvas",icon:MB,blurb:"Visual workspace and orchestration canvases",blurbKey:"nav.canvas.blurb"},{to:"/teams",label:"Teams",labelKey:"nav.teams",icon:a0,blurb:"View delegation topology and ownership",blurbKey:"nav.teams.blurb"}]},{id:"operations",label:"Operations",labelKey:"nav.section.operations",items:[{to:"/assets",label:"Assets",labelKey:"nav.assets",icon:t0,blurb:"Artifacts and workflow-adjacent resources",blurbKey:"nav.assets.blurb"},{to:"/skills",label:"Skills",labelKey:"nav.skills",icon:iu,blurb:"Reusable operational capabilities",blurbKey:"nav.skills.blurb"},{to:"/tools",label:"Tools",labelKey:"nav.tools",icon:l0,blurb:"Agent tool catalog and CLI binaries",blurbKey:"nav.tools.blurb"},{to:"/integrations",label:"Integrations",labelKey:"nav.integrations",icon:DB,blurb:"Connected systems and channel surfaces",blurbKey:"nav.integrations.blurb"},{to:"/cron",label:"Cron",labelKey:"nav.cron",icon:Lx,blurb:"Scheduled jobs and catch-up behaviour",blurbKey:"nav.cron.blurb"},{to:"/pairing",label:"Pairing",labelKey:"nav.pairing",icon:lC,blurb:"Device enrolment and trust management",blurbKey:"nav.pairing.blurb"},{to:"/config",label:"Config",labelKey:"nav.config",icon:i0,blurb:"Runtime TOML and operational configuration",blurbKey:"nav.config.blurb"},{to:"/cost",label:"Cost",labelKey:"nav.cost",icon:uE,blurb:"Spend and efficiency by workflow and run",blurbKey:"nav.cost.blurb"},{to:"/skins",label:"Skins",labelKey:"nav.skins",icon:oC,blurb:"Token and asset based UI skins",blurbKey:"nav.skins.blurb"}]},{id:"inspection",label:"Inspection",labelKey:"nav.section.inspection",items:[{to:"/memory",label:"Memory",labelKey:"nav.memory",icon:xf,blurb:"Kumiho memory graph explorer and revisions",blurbKey:"nav.memory.blurb"},{to:"/logs",label:"Logs",labelKey:"nav.logs",icon:ev,blurb:"Operational traces and node-linked events",blurbKey:"nav.logs.blurb"},{to:"/audit",label:"Audit",labelKey:"nav.audit",icon:sv,blurb:"Trust chain and approval verification",blurbKey:"nav.audit.blurb"},{to:"/doctor",label:"Doctor",labelKey:"nav.doctor",icon:BB,blurb:"Diagnostics and runtime recovery posture",blurbKey:"nav.doctor.blurb"}]}],YB=Object.fromEntries(KB.flatMap(e=>e.items.map(n=>[n.to,{title:n.label,description:n.blurb,titleKey:n.labelKey,descriptionKey:n.blurbKey}]))),Fm={matrix:{label:"Matrix",colors:{primary:"#7dff9b",secondary:"#72d8ff",user:"#e6e6e6",system:"#72d8ff",glow:"0 0 6px rgba(125,255,155,0.25)",glowSecondary:"0 0 6px rgba(114,216,255,0.25)",cursorColor:"#7dff9b"}},amber:{label:"Amber",colors:{primary:"#ffc857",secondary:"#ff9f43",user:"#e6e6e6",system:"#ff9f43",glow:"0 0 6px rgba(255,200,87,0.25)",glowSecondary:"0 0 6px rgba(255,159,67,0.25)",cursorColor:"#ffc857"}},cyan:{label:"Revka",colors:{primary:"#8fa8c8",secondary:"#6f83d6",user:"#e6e6e6",system:"#7c8ddd",glow:"0 0 6px rgba(143,168,200,0.18)",glowSecondary:"0 0 6px rgba(111,131,214,0.18)",cursorColor:"#8fa8c8"}},minimal:{label:"Minimal",colors:{primary:"#b0b0b0",secondary:"#808080",user:"#e6e6e6",system:"#808080",glow:"none",glowSecondary:"none",cursorColor:"#e6e6e6"}}},dee=Object.keys(Fm),GB="revka-assistant-config",Hm={colorScheme:"cyan",fontSize:13,cursorBlink:!0,panelHeightPercent:60,panelOpacity:1};function hee(){try{const e=localStorage.getItem(GB);return e?{...Hm,...JSON.parse(e)}:Hm}catch{return Hm}}function eO(e){try{localStorage.setItem(GB,JSON.stringify(e))}catch{}}function fee(){const[e,n]=b.useState(hee),r=b.useMemo(()=>Fm[e.colorScheme].colors,[e.colorScheme]),i=b.useCallback(a=>{n(o=>{const l={...o,...a};return eO(l),l})},[]),s=b.useCallback(()=>{n(Hm),eO(Hm)},[]);return{config:e,colors:r,updateConfig:i,resetConfig:s}}/**
 * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
 * @license MIT
 *
 * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
 * @license MIT
 *
 * Originally forked from (with the author's permission):
 *   Fabrice Bellard's javascript vt100 for jslinux:
 *   http://bellard.org/jslinux/
 *   Copyright (c) 2011 Fabrice Bellard
 */var XB=Object.defineProperty,pee=Object.getOwnPropertyDescriptor,mee=(e,n)=>{for(var r in n)XB(e,r,{get:n[r],enumerable:!0})},Dr=(e,n,r,i)=>{for(var s=i>1?void 0:i?pee(n,r):n,a=e.length-1,o;a>=0;a--)(o=e[a])&&(s=(i?o(n,r,s):o(s))||s);return i&&s&&XB(n,r,s),s},At=(e,n)=>(r,i)=>n(r,i,e),tO="Terminal input",uC={get:()=>tO,set:e=>tO=e},nO="Too much output to announce, navigate to rows manually to read",dC={get:()=>nO,set:e=>nO=e};function gee(e){return e.replace(/\r?\n/g,"\r")}function vee(e,n){return n?"\x1B[200~"+e+"\x1B[201~":e}function yee(e,n){e.clipboardData&&e.clipboardData.setData("text/plain",n.selectionText),e.preventDefault()}function _ee(e,n,r,i){if(e.stopPropagation(),e.clipboardData){let s=e.clipboardData.getData("text/plain");QB(s,n,r,i)}}function QB(e,n,r,i){e=gee(e),e=vee(e,r.decPrivateModes.bracketedPasteMode&&i.rawOptions.ignoreBracketedPasteMode!==!0),r.triggerDataEvent(e,!0),n.value=""}function ZB(e,n,r){let i=r.getBoundingClientRect(),s=e.clientX-i.left-10,a=e.clientY-i.top-10;n.style.width="20px",n.style.height="20px",n.style.left=`${s}px`,n.style.top=`${a}px`,n.style.zIndex="1000",n.focus()}function rO(e,n,r,i,s){ZB(e,n,r),s&&i.rightClickSelect(e),n.value=i.selectionText,n.select()}function Ic(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function u0(e,n=0,r=e.length){let i="";for(let s=n;s<r;++s){let a=e[s];a>65535?(a-=65536,i+=String.fromCharCode((a>>10)+55296)+String.fromCharCode(a%1024+56320)):i+=String.fromCharCode(a)}return i}var xee=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,n){let r=e.length;if(!r)return 0;let i=0,s=0;if(this._interim){let a=e.charCodeAt(s++);56320<=a&&a<=57343?n[i++]=(this._interim-55296)*1024+a-56320+65536:(n[i++]=this._interim,n[i++]=a),this._interim=0}for(let a=s;a<r;++a){let o=e.charCodeAt(a);if(55296<=o&&o<=56319){if(++a>=r)return this._interim=o,i;let l=e.charCodeAt(a);56320<=l&&l<=57343?n[i++]=(o-55296)*1024+l-56320+65536:(n[i++]=o,n[i++]=l);continue}o!==65279&&(n[i++]=o)}return i}},bee=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,n){let r=e.length;if(!r)return 0;let i=0,s,a,o,l,u=0,d=0;if(this.interim[0]){let g=!1,_=this.interim[0];_&=(_&224)===192?31:(_&240)===224?15:7;let x=0,v;for(;(v=this.interim[++x]&63)&&x<4;)_<<=6,_|=v;let S=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,w=S-x;for(;d<w;){if(d>=r)return 0;if(v=e[d++],(v&192)!==128){d--,g=!0;break}else this.interim[x++]=v,_<<=6,_|=v&63}g||(S===2?_<128?d--:n[i++]=_:S===3?_<2048||_>=55296&&_<=57343||_===65279||(n[i++]=_):_<65536||_>1114111||(n[i++]=_)),this.interim.fill(0)}let p=r-4,f=d;for(;f<r;){for(;f<p&&!((s=e[f])&128)&&!((a=e[f+1])&128)&&!((o=e[f+2])&128)&&!((l=e[f+3])&128);)n[i++]=s,n[i++]=a,n[i++]=o,n[i++]=l,f+=4;if(s=e[f++],s<128)n[i++]=s;else if((s&224)===192){if(f>=r)return this.interim[0]=s,i;if(a=e[f++],(a&192)!==128){f--;continue}if(u=(s&31)<<6|a&63,u<128){f--;continue}n[i++]=u}else if((s&240)===224){if(f>=r)return this.interim[0]=s,i;if(a=e[f++],(a&192)!==128){f--;continue}if(f>=r)return this.interim[0]=s,this.interim[1]=a,i;if(o=e[f++],(o&192)!==128){f--;continue}if(u=(s&15)<<12|(a&63)<<6|o&63,u<2048||u>=55296&&u<=57343||u===65279)continue;n[i++]=u}else if((s&248)===240){if(f>=r)return this.interim[0]=s,i;if(a=e[f++],(a&192)!==128){f--;continue}if(f>=r)return this.interim[0]=s,this.interim[1]=a,i;if(o=e[f++],(o&192)!==128){f--;continue}if(f>=r)return this.interim[0]=s,this.interim[1]=a,this.interim[2]=o,i;if(l=e[f++],(l&192)!==128){f--;continue}if(u=(s&7)<<18|(a&63)<<12|(o&63)<<6|l&63,u<65536||u>1114111)continue;n[i++]=u}}return i}},JB="",Vc=" ",ov=class ez{constructor(){this.fg=0,this.bg=0,this.extended=new $x}static toColorRGB(n){return[n>>>16&255,n>>>8&255,n&255]}static fromColorRGB(n){return(n[0]&255)<<16|(n[1]&255)<<8|n[2]&255}clone(){let n=new ez;return n.fg=this.fg,n.bg=this.bg,n.extended=this.extended.clone(),n}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},$x=class tz{constructor(n=0,r=0){this._ext=0,this._urlId=0,this._ext=n,this._urlId=r}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(n){this._ext=n}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(n){this._ext&=-469762049,this._ext|=n<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(n){this._ext&=-67108864,this._ext|=n&67108863}get urlId(){return this._urlId}set urlId(n){this._urlId=n}get underlineVariantOffset(){let n=(this._ext&3758096384)>>29;return n<0?n^4294967288:n}set underlineVariantOffset(n){this._ext&=536870911,this._ext|=n<<29&3758096384}clone(){return new tz(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},ja=class nz extends ov{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new $x,this.combinedData=""}static fromCharData(n){let r=new nz;return r.setFromCharData(n),r}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?Ic(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(n){this.fg=n[0],this.bg=0;let r=!1;if(n[1].length>2)r=!0;else if(n[1].length===2){let i=n[1].charCodeAt(0);if(55296<=i&&i<=56319){let s=n[1].charCodeAt(1);56320<=s&&s<=57343?this.content=(i-55296)*1024+s-56320+65536|n[2]<<22:r=!0}else r=!0}else this.content=n[1].charCodeAt(0)|n[2]<<22;r&&(this.combinedData=n[1],this.content=2097152|n[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},iO="di$target",hC="di$dependencies",xw=new Map;function kee(e){return e[hC]||[]}function gi(e){if(xw.has(e))return xw.get(e);let n=function(r,i,s){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");wee(n,r,s)};return n._id=e,xw.set(e,n),n}function wee(e,n,r){n[iO]===n?n[hC].push({id:e,index:r}):(n[hC]=[{id:e,index:r}],n[iO]=n)}var ss=gi("BufferService"),rz=gi("CoreMouseService"),Dd=gi("CoreService"),See=gi("CharsetService"),bE=gi("InstantiationService"),iz=gi("LogService"),as=gi("OptionsService"),sz=gi("OscLinkService"),Cee=gi("UnicodeService"),lv=gi("DecorationService"),fC=class{constructor(e,n,r){this._bufferService=e,this._optionsService=n,this._oscLinkService=r}provideLinks(e,n){var p;let r=this._bufferService.buffer.lines.get(e-1);if(!r){n(void 0);return}let i=[],s=this._optionsService.rawOptions.linkHandler,a=new ja,o=r.getTrimmedLength(),l=-1,u=-1,d=!1;for(let f=0;f<o;f++)if(!(u===-1&&!r.hasContent(f))){if(r.loadCell(f,a),a.hasExtendedAttrs()&&a.extended.urlId)if(u===-1){u=f,l=a.extended.urlId;continue}else d=a.extended.urlId!==l;else u!==-1&&(d=!0);if(d||u!==-1&&f===o-1){let g=(p=this._oscLinkService.getLinkData(l))==null?void 0:p.uri;if(g){let _={start:{x:u+1,y:e},end:{x:f+(!d&&f===o-1?1:0),y:e}},x=!1;if(!(s!=null&&s.allowNonHttpProtocols))try{let v=new URL(g);["http:","https:"].includes(v.protocol)||(x=!0)}catch{x=!0}x||i.push({text:g,range:_,activate:(v,S)=>s?s.activate(v,S,_):jee(v,S),hover:(v,S)=>{var w;return(w=s==null?void 0:s.hover)==null?void 0:w.call(s,v,S,_)},leave:(v,S)=>{var w;return(w=s==null?void 0:s.leave)==null?void 0:w.call(s,v,S,_)}})}d=!1,a.hasExtendedAttrs()&&a.extended.urlId?(u=f,l=a.extended.urlId):(u=-1,l=-1)}}n(i)}};fC=Dr([At(0,ss),At(1,as),At(2,sz)],fC);function jee(e,n){if(confirm(`Do you want to navigate to ${n}?

WARNING: This link could potentially be dangerous`)){let r=window.open();if(r){try{r.opener=null}catch{}r.location.href=n}else console.warn("Opening link blocked as opener could not be cleared")}}var d0=gi("CharSizeService"),Ql=gi("CoreBrowserService"),kE=gi("MouseService"),Zl=gi("RenderService"),Nee=gi("SelectionService"),az=gi("CharacterJoinerService"),Yf=gi("ThemeService"),oz=gi("LinkProviderService"),Eee=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?sO.isErrorNoTelemetry(e)?new sO(e.message+`

`+e.stack):new Error(e.message+`

`+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(n=>{n(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}},Aee=new Eee;function tx(e){Tee(e)||Aee.onUnexpectedError(e)}var pC="Canceled";function Tee(e){return e instanceof Mee?!0:e instanceof Error&&e.name===pC&&e.message===pC}var Mee=class extends Error{constructor(){super(pC),this.name=this.message}};function Ree(e){return new Error(`Illegal argument: ${e}`)}var sO=class mC extends Error{constructor(n){super(n),this.name="CodeExpectedError"}static fromError(n){if(n instanceof mC)return n;let r=new mC;return r.message=n.message,r.stack=n.stack,r}static isErrorNoTelemetry(n){return n.name==="CodeExpectedError"}},gC=class lz extends Error{constructor(n){super(n||"An unexpected bug occurred."),Object.setPrototypeOf(this,lz.prototype)}};function Hs(e,n=0){return e[e.length-(1+n)]}var Oee;(e=>{function n(a){return a<0}e.isLessThan=n;function r(a){return a<=0}e.isLessThanOrEqual=r;function i(a){return a>0}e.isGreaterThan=i;function s(a){return a===0}e.isNeitherLessOrGreaterThan=s,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(Oee||(Oee={}));function Dee(e,n){let r=this,i=!1,s;return function(){return i||(i=!0,n||(s=e.apply(r,arguments))),s}}var cz;(e=>{function n(T){return T&&typeof T=="object"&&typeof T[Symbol.iterator]=="function"}e.is=n;let r=Object.freeze([]);function i(){return r}e.empty=i;function*s(T){yield T}e.single=s;function a(T){return n(T)?T:s(T)}e.wrap=a;function o(T){return T||r}e.from=o;function*l(T){for(let A=T.length-1;A>=0;A--)yield T[A]}e.reverse=l;function u(T){return!T||T[Symbol.iterator]().next().done===!0}e.isEmpty=u;function d(T){return T[Symbol.iterator]().next().value}e.first=d;function p(T,A){let E=0;for(let D of T)if(A(D,E++))return!0;return!1}e.some=p;function f(T,A){for(let E of T)if(A(E))return E}e.find=f;function*g(T,A){for(let E of T)A(E)&&(yield E)}e.filter=g;function*_(T,A){let E=0;for(let D of T)yield A(D,E++)}e.map=_;function*x(T,A){let E=0;for(let D of T)yield*A(D,E++)}e.flatMap=x;function*v(...T){for(let A of T)yield*A}e.concat=v;function S(T,A,E){let D=E;for(let F of T)D=A(D,F);return D}e.reduce=S;function*w(T,A,E=T.length){for(A<0&&(A+=T.length),E<0?E+=T.length:E>T.length&&(E=T.length);A<E;A++)yield T[A]}e.slice=w;function N(T,A=Number.POSITIVE_INFINITY){let E=[];if(A===0)return[E,T];let D=T[Symbol.iterator]();for(let F=0;F<A;F++){let B=D.next();if(B.done)return[E,e.empty()];E.push(B.value)}return[E,{[Symbol.iterator](){return D}}]}e.consume=N;async function C(T){let A=[];for await(let E of T)A.push(E);return Promise.resolve(A)}e.asyncToArray=C})(cz||(cz={}));function bd(e){if(cz.is(e)){let n=[];for(let r of e)if(r)try{r.dispose()}catch(i){n.push(i)}if(n.length===1)throw n[0];if(n.length>1)throw new AggregateError(n,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function Pee(...e){return br(()=>bd(e))}function br(e){return{dispose:Dee(()=>{e()})}}var uz=class dz{constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{bd(this._toDispose)}finally{this._toDispose.clear()}}add(n){if(!n)return n;if(n===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?dz.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(n),n}delete(n){if(n){if(n===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(n),n.dispose()}}deleteAndLeak(n){n&&this._toDispose.has(n)&&(this._toDispose.delete(n),void 0)}};uz.DISABLE_DISPOSED_WARNING=!1;var Qc=uz,ln=class{constructor(){this._store=new Qc,this._store}dispose(){this._store.dispose()}_register(n){if(n===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(n)}};ln.None=Object.freeze({dispose(){}});var bf=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(n){var r;this._isDisposed||n===this._value||((r=this._value)==null||r.dispose(),this._value=n)}clear(){this.value=void 0}dispose(){var n;this._isDisposed=!0,(n=this._value)==null||n.dispose(),this._value=void 0}clearAndLeak(){let n=this._value;return this._value=void 0,n}},Ll=typeof window=="object"?window:globalThis,vC=class yC{constructor(n){this.element=n,this.next=yC.Undefined,this.prev=yC.Undefined}};vC.Undefined=new vC(void 0);var wr=vC,aO=class{constructor(){this._first=wr.Undefined,this._last=wr.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===wr.Undefined}clear(){let e=this._first;for(;e!==wr.Undefined;){let n=e.next;e.prev=wr.Undefined,e.next=wr.Undefined,e=n}this._first=wr.Undefined,this._last=wr.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,n){let r=new wr(e);if(this._first===wr.Undefined)this._first=r,this._last=r;else if(n){let s=this._last;this._last=r,r.prev=s,s.next=r}else{let s=this._first;this._first=r,r.next=s,s.prev=r}this._size+=1;let i=!1;return()=>{i||(i=!0,this._remove(r))}}shift(){if(this._first!==wr.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==wr.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==wr.Undefined&&e.next!==wr.Undefined){let n=e.prev;n.next=e.next,e.next.prev=n}else e.prev===wr.Undefined&&e.next===wr.Undefined?(this._first=wr.Undefined,this._last=wr.Undefined):e.next===wr.Undefined?(this._last=this._last.prev,this._last.next=wr.Undefined):e.prev===wr.Undefined&&(this._first=this._first.next,this._first.prev=wr.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==wr.Undefined;)yield e.element,e=e.next}},Lee=globalThis.performance&&typeof globalThis.performance.now=="function",Iee=class hz{static create(n){return new hz(n)}constructor(n){this._now=Lee&&n===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},Ei;(e=>{e.None=()=>ln.None;function n(z,W){return f(z,()=>{},0,void 0,!0,void 0,W)}e.defer=n;function r(z){return(W,P=null,q)=>{let I=!1,Q;return Q=z(K=>{if(!I)return Q?Q.dispose():I=!0,W.call(P,K)},null,q),I&&Q.dispose(),Q}}e.once=r;function i(z,W,P){return d((q,I=null,Q)=>z(K=>q.call(I,W(K)),null,Q),P)}e.map=i;function s(z,W,P){return d((q,I=null,Q)=>z(K=>{W(K),q.call(I,K)},null,Q),P)}e.forEach=s;function a(z,W,P){return d((q,I=null,Q)=>z(K=>W(K)&&q.call(I,K),null,Q),P)}e.filter=a;function o(z){return z}e.signal=o;function l(...z){return(W,P=null,q)=>{let I=Pee(...z.map(Q=>Q(K=>W.call(P,K))));return p(I,q)}}e.any=l;function u(z,W,P,q){let I=P;return i(z,Q=>(I=W(I,Q),I),q)}e.reduce=u;function d(z,W){let P,q={onWillAddFirstListener(){P=z(I.fire,I)},onDidRemoveLastListener(){P==null||P.dispose()}},I=new gt(q);return W==null||W.add(I),I.event}function p(z,W){return W instanceof Array?W.push(z):W&&W.add(z),z}function f(z,W,P=100,q=!1,I=!1,Q,K){let Z,Y,R,U=0,V,ie={leakWarningThreshold:Q,onWillAddFirstListener(){Z=z(X=>{U++,Y=W(Y,X),q&&!R&&(te.fire(Y),Y=void 0),V=()=>{let se=Y;Y=void 0,R=void 0,(!q||U>1)&&te.fire(se),U=0},typeof P=="number"?(clearTimeout(R),R=setTimeout(V,P)):R===void 0&&(R=0,queueMicrotask(V))})},onWillRemoveListener(){I&&U>0&&(V==null||V())},onDidRemoveLastListener(){V=void 0,Z.dispose()}},te=new gt(ie);return K==null||K.add(te),te.event}e.debounce=f;function g(z,W=0,P){return e.debounce(z,(q,I)=>q?(q.push(I),q):[I],W,void 0,!0,void 0,P)}e.accumulate=g;function _(z,W=(q,I)=>q===I,P){let q=!0,I;return a(z,Q=>{let K=q||!W(Q,I);return q=!1,I=Q,K},P)}e.latch=_;function x(z,W,P){return[e.filter(z,W,P),e.filter(z,q=>!W(q),P)]}e.split=x;function v(z,W=!1,P=[],q){let I=P.slice(),Q=z(Y=>{I?I.push(Y):Z.fire(Y)});q&&q.add(Q);let K=()=>{I==null||I.forEach(Y=>Z.fire(Y)),I=null},Z=new gt({onWillAddFirstListener(){Q||(Q=z(Y=>Z.fire(Y)),q&&q.add(Q))},onDidAddFirstListener(){I&&(W?setTimeout(K):K())},onDidRemoveLastListener(){Q&&Q.dispose(),Q=null}});return q&&q.add(Z),Z.event}e.buffer=v;function S(z,W){return(P,q,I)=>{let Q=W(new N);return z(function(K){let Z=Q.evaluate(K);Z!==w&&P.call(q,Z)},void 0,I)}}e.chain=S;let w=Symbol("HaltChainable");class N{constructor(){this.steps=[]}map(W){return this.steps.push(W),this}forEach(W){return this.steps.push(P=>(W(P),P)),this}filter(W){return this.steps.push(P=>W(P)?P:w),this}reduce(W,P){let q=P;return this.steps.push(I=>(q=W(q,I),q)),this}latch(W=(P,q)=>P===q){let P=!0,q;return this.steps.push(I=>{let Q=P||!W(I,q);return P=!1,q=I,Q?I:w}),this}evaluate(W){for(let P of this.steps)if(W=P(W),W===w)break;return W}}function C(z,W,P=q=>q){let q=(...Z)=>K.fire(P(...Z)),I=()=>z.on(W,q),Q=()=>z.removeListener(W,q),K=new gt({onWillAddFirstListener:I,onDidRemoveLastListener:Q});return K.event}e.fromNodeEventEmitter=C;function T(z,W,P=q=>q){let q=(...Z)=>K.fire(P(...Z)),I=()=>z.addEventListener(W,q),Q=()=>z.removeEventListener(W,q),K=new gt({onWillAddFirstListener:I,onDidRemoveLastListener:Q});return K.event}e.fromDOMEventEmitter=T;function A(z){return new Promise(W=>r(z)(W))}e.toPromise=A;function E(z){let W=new gt;return z.then(P=>{W.fire(P)},()=>{W.fire(void 0)}).finally(()=>{W.dispose()}),W.event}e.fromPromise=E;function D(z,W){return z(P=>W.fire(P))}e.forward=D;function F(z,W,P){return W(P),z(q=>W(q))}e.runAndSubscribe=F;class B{constructor(W,P){this._observable=W,this._counter=0,this._hasChanged=!1;let q={onWillAddFirstListener:()=>{W.addObserver(this)},onDidRemoveLastListener:()=>{W.removeObserver(this)}};this.emitter=new gt(q),P&&P.add(this.emitter)}beginUpdate(W){this._counter++}handlePossibleChange(W){}handleChange(W,P){this._hasChanged=!0}endUpdate(W){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function H(z,W){return new B(z,W).emitter.event}e.fromObservable=H;function $(z){return(W,P,q)=>{let I=0,Q=!1,K={beginUpdate(){I++},endUpdate(){I--,I===0&&(z.reportChanges(),Q&&(Q=!1,W.call(P)))},handlePossibleChange(){},handleChange(){Q=!0}};z.addObserver(K),z.reportChanges();let Z={dispose(){z.removeObserver(K)}};return q instanceof Qc?q.add(Z):Array.isArray(q)&&q.push(Z),Z}}e.fromObservableLight=$})(Ei||(Ei={}));var _C=class xC{constructor(n){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${n}_${xC._idPool++}`,xC.all.add(this)}start(n){this._stopWatch=new Iee,this.listenerCount=n}stop(){if(this._stopWatch){let n=this._stopWatch.elapsed();this.durations.push(n),this.elapsedOverall+=n,this.invocationCount+=1,this._stopWatch=void 0}}};_C.all=new Set,_C._idPool=0;var Bee=_C,zee=-1,fz=class pz{constructor(n,r,i=(pz._idPool++).toString(16).padStart(3,"0")){this._errorHandler=n,this.threshold=r,this.name=i,this._warnCountdown=0}dispose(){var n;(n=this._stacks)==null||n.clear()}check(n,r){let i=this.threshold;if(i<=0||r<i)return;this._stacks||(this._stacks=new Map);let s=this._stacks.get(n.value)||0;if(this._stacks.set(n.value,s+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=i*.5;let[a,o]=this.getMostFrequentStack(),l=`[${this.name}] potential listener LEAK detected, having ${r} listeners already. MOST frequent listener (${o}):`;console.warn(l),console.warn(a);let u=new Hee(l,a);this._errorHandler(u)}return()=>{let a=this._stacks.get(n.value)||0;this._stacks.set(n.value,a-1)}}getMostFrequentStack(){if(!this._stacks)return;let n,r=0;for(let[i,s]of this._stacks)(!n||r<s)&&(n=[i,s],r=s);return n}};fz._idPool=1;var $ee=fz,Fee=class mz{constructor(n){this.value=n}static create(){let n=new Error;return new mz(n.stack??"")}print(){console.warn(this.value.split(`
`).slice(2).join(`
`))}},Hee=class extends Error{constructor(e,n){super(e),this.name="ListenerLeakError",this.stack=n}},Wee=class extends Error{constructor(e,n){super(e),this.name="ListenerRefusalError",this.stack=n}},qee=0,bw=class{constructor(e){this.value=e,this.id=qee++}},Uee=2,Vee,gt=class{constructor(n){var r,i,s,a;this._size=0,this._options=n,this._leakageMon=(r=this._options)!=null&&r.leakWarningThreshold?new $ee((n==null?void 0:n.onListenerError)??tx,((i=this._options)==null?void 0:i.leakWarningThreshold)??zee):void 0,this._perfMon=(s=this._options)!=null&&s._profName?new Bee(this._options._profName):void 0,this._deliveryQueue=(a=this._options)==null?void 0:a.deliveryQueue}dispose(){var n,r,i,s;this._disposed||(this._disposed=!0,((n=this._deliveryQueue)==null?void 0:n.current)===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),(i=(r=this._options)==null?void 0:r.onDidRemoveLastListener)==null||i.call(r),(s=this._leakageMon)==null||s.dispose())}get event(){return this._event??(this._event=(n,r,i)=>{var l,u,d,p,f;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let g=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(g);let _=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],x=new Wee(`${g}. HINT: Stack shows most frequent listener (${_[1]}-times)`,_[0]);return(((l=this._options)==null?void 0:l.onListenerError)||tx)(x),ln.None}if(this._disposed)return ln.None;r&&(n=n.bind(r));let s=new bw(n),a;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(s.stack=Fee.create(),a=this._leakageMon.check(s.stack,this._size+1)),this._listeners?this._listeners instanceof bw?(this._deliveryQueue??(this._deliveryQueue=new Kee),this._listeners=[this._listeners,s]):this._listeners.push(s):((d=(u=this._options)==null?void 0:u.onWillAddFirstListener)==null||d.call(u,this),this._listeners=s,(f=(p=this._options)==null?void 0:p.onDidAddFirstListener)==null||f.call(p,this)),this._size++;let o=br(()=>{a==null||a(),this._removeListener(s)});return i instanceof Qc?i.add(o):Array.isArray(i)&&i.push(o),o}),this._event}_removeListener(n){var a,o,l,u;if((o=(a=this._options)==null?void 0:a.onWillRemoveListener)==null||o.call(a,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(u=(l=this._options)==null?void 0:l.onDidRemoveLastListener)==null||u.call(l,this),this._size=0;return}let r=this._listeners,i=r.indexOf(n);if(i===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,r[i]=void 0;let s=this._deliveryQueue.current===this;if(this._size*Uee<=r.length){let d=0;for(let p=0;p<r.length;p++)r[p]?r[d++]=r[p]:s&&(this._deliveryQueue.end--,d<this._deliveryQueue.i&&this._deliveryQueue.i--);r.length=d}}_deliver(n,r){var s;if(!n)return;let i=((s=this._options)==null?void 0:s.onListenerError)||tx;if(!i){n.value(r);return}try{n.value(r)}catch(a){i(a)}}_deliverQueue(n){let r=n.current._listeners;for(;n.i<n.end;)this._deliver(r[n.i++],n.value);n.reset()}fire(n){var r,i,s,a;if((r=this._deliveryQueue)!=null&&r.current&&(this._deliverQueue(this._deliveryQueue),(i=this._perfMon)==null||i.stop()),(s=this._perfMon)==null||s.start(this._size),this._listeners)if(this._listeners instanceof bw)this._deliver(this._listeners,n);else{let o=this._deliveryQueue;o.enqueue(this,n,this._listeners.length),this._deliverQueue(o)}(a=this._perfMon)==null||a.stop()}hasListeners(){return this._size>0}},Kee=class{constructor(){this.i=-1,this.end=0}enqueue(e,n,r){this.i=0,this.end=r,this.current=e,this.value=n}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},bC=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new gt,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new gt,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(n){return this.mapWindowIdToZoomLevel.get(this.getWindowId(n))??0}setZoomLevel(n,r){if(this.getZoomLevel(r)===n)return;let i=this.getWindowId(r);this.mapWindowIdToZoomLevel.set(i,n),this._onDidChangeZoomLevel.fire(i)}getZoomFactor(n){return this.mapWindowIdToZoomFactor.get(this.getWindowId(n))??1}setZoomFactor(n,r){this.mapWindowIdToZoomFactor.set(this.getWindowId(r),n)}setFullscreen(n,r){if(this.isFullscreen(r)===n)return;let i=this.getWindowId(r);this.mapWindowIdToFullScreen.set(i,n),this._onDidChangeFullscreen.fire(i)}isFullscreen(n){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(n))}getWindowId(n){return n.vscodeWindowId}};bC.INSTANCE=new bC;var wE=bC;function Yee(e,n,r){typeof n=="string"&&(n=e.matchMedia(n)),n.addEventListener("change",r)}wE.INSTANCE.onDidChangeZoomLevel;function Gee(e){return wE.INSTANCE.getZoomFactor(e)}wE.INSTANCE.onDidChangeFullscreen;var Gf=typeof navigator=="object"?navigator.userAgent:"",kC=Gf.indexOf("Firefox")>=0,Xee=Gf.indexOf("AppleWebKit")>=0,SE=Gf.indexOf("Chrome")>=0,Qee=!SE&&Gf.indexOf("Safari")>=0;Gf.indexOf("Electron/")>=0;Gf.indexOf("Android")>=0;var kw=!1;if(typeof Ll.matchMedia=="function"){let e=Ll.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),n=Ll.matchMedia("(display-mode: fullscreen)");kw=e.matches,Yee(Ll,e,({matches:r})=>{kw&&n.matches||(kw=r)})}var Vh="en",wC=!1,SC=!1,nx=!1,gz=!1,Wy,rx=Vh,oO=Vh,Zee,La,fd=globalThis,ji,T8;typeof fd.vscode<"u"&&typeof fd.vscode.process<"u"?ji=fd.vscode.process:typeof process<"u"&&typeof((T8=process==null?void 0:process.versions)==null?void 0:T8.node)=="string"&&(ji=process);var M8,Jee=typeof((M8=ji==null?void 0:ji.versions)==null?void 0:M8.electron)=="string",ete=Jee&&(ji==null?void 0:ji.type)==="renderer",R8;if(typeof ji=="object"){wC=ji.platform==="win32",SC=ji.platform==="darwin",nx=ji.platform==="linux",nx&&ji.env.SNAP&&ji.env.SNAP_REVISION,ji.env.CI||ji.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Wy=Vh,rx=Vh;let e=ji.env.VSCODE_NLS_CONFIG;if(e)try{let n=JSON.parse(e);Wy=n.userLocale,oO=n.osLocale,rx=n.resolvedLanguage||Vh,Zee=(R8=n.languagePack)==null?void 0:R8.translationsConfigFile}catch{}gz=!0}else typeof navigator=="object"&&!ete?(La=navigator.userAgent,wC=La.indexOf("Windows")>=0,SC=La.indexOf("Macintosh")>=0,(La.indexOf("Macintosh")>=0||La.indexOf("iPad")>=0||La.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,nx=La.indexOf("Linux")>=0,(La==null?void 0:La.indexOf("Mobi"))>=0,rx=globalThis._VSCODE_NLS_LANGUAGE||Vh,Wy=navigator.language.toLowerCase(),oO=Wy):console.error("Unable to resolve platform.");var vz=wC,Uo=SC,tte=nx,lO=gz,Yo=La,Cc=rx,nte;(e=>{function n(){return Cc}e.value=n;function r(){return Cc.length===2?Cc==="en":Cc.length>=3?Cc[0]==="e"&&Cc[1]==="n"&&Cc[2]==="-":!1}e.isDefaultVariant=r;function i(){return Cc==="en"}e.isDefault=i})(nte||(nte={}));var rte=typeof fd.postMessage=="function"&&!fd.importScripts;(()=>{if(rte){let e=[];fd.addEventListener("message",r=>{if(r.data&&r.data.vscodeScheduleAsyncWork)for(let i=0,s=e.length;i<s;i++){let a=e[i];if(a.id===r.data.vscodeScheduleAsyncWork){e.splice(i,1),a.callback();return}}});let n=0;return r=>{let i=++n;e.push({id:i,callback:r}),fd.postMessage({vscodeScheduleAsyncWork:i},"*")}}return e=>setTimeout(e)})();var ite=!!(Yo&&Yo.indexOf("Chrome")>=0);Yo&&Yo.indexOf("Firefox")>=0;!ite&&Yo&&Yo.indexOf("Safari")>=0;Yo&&Yo.indexOf("Edg/")>=0;Yo&&Yo.indexOf("Android")>=0;var yh=typeof navigator=="object"?navigator:{};lO||document.queryCommandSupported&&document.queryCommandSupported("copy")||yh&&yh.clipboard&&yh.clipboard.writeText,lO||yh&&yh.clipboard&&yh.clipboard.readText;var CE=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,n){this._keyCodeToStr[e]=n,this._strToKeyCode[n.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},ww=new CE,cO=new CE,uO=new CE,ste=new Array(230),yz;(e=>{function n(l){return ww.keyCodeToStr(l)}e.toString=n;function r(l){return ww.strToKeyCode(l)}e.fromString=r;function i(l){return cO.keyCodeToStr(l)}e.toUserSettingsUS=i;function s(l){return uO.keyCodeToStr(l)}e.toUserSettingsGeneral=s;function a(l){return cO.strToKeyCode(l)||uO.strToKeyCode(l)}e.fromUserSettings=a;function o(l){if(l>=98&&l<=113)return null;switch(l){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return ww.keyCodeToStr(l)}e.toElectronAccelerator=o})(yz||(yz={}));var ate=class _z{constructor(n,r,i,s,a){this.ctrlKey=n,this.shiftKey=r,this.altKey=i,this.metaKey=s,this.keyCode=a}equals(n){return n instanceof _z&&this.ctrlKey===n.ctrlKey&&this.shiftKey===n.shiftKey&&this.altKey===n.altKey&&this.metaKey===n.metaKey&&this.keyCode===n.keyCode}getHashCode(){let n=this.ctrlKey?"1":"0",r=this.shiftKey?"1":"0",i=this.altKey?"1":"0",s=this.metaKey?"1":"0";return`K${n}${r}${i}${s}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new ote([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},ote=class{constructor(e){if(e.length===0)throw Ree("chords");this.chords=e}getHashCode(){let e="";for(let n=0,r=this.chords.length;n<r;n++)n!==0&&(e+=";"),e+=this.chords[n].getHashCode();return e}equals(e){if(e===null||this.chords.length!==e.chords.length)return!1;for(let n=0;n<this.chords.length;n++)if(!this.chords[n].equals(e.chords[n]))return!1;return!0}};function lte(e){if(e.charCode){let r=String.fromCharCode(e.charCode).toUpperCase();return yz.fromString(r)}let n=e.keyCode;if(n===3)return 7;if(kC)switch(n){case 59:return 85;case 60:if(tte)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(Uo)return 57;break}else if(Xee&&(Uo&&n===93||!Uo&&n===92))return 57;return ste[n]||0}var cte=Uo?256:2048,ute=512,dte=1024,hte=Uo?2048:256,dO=class{constructor(e){var r;this._standardKeyboardEventBrand=!0;let n=e;this.browserEvent=n,this.target=n.target,this.ctrlKey=n.ctrlKey,this.shiftKey=n.shiftKey,this.altKey=n.altKey,this.metaKey=n.metaKey,this.altGraphKey=(r=n.getModifierState)==null?void 0:r.call(n,"AltGraph"),this.keyCode=lte(n),this.code=n.code,this.ctrlKey=this.ctrlKey||this.keyCode===5,this.altKey=this.altKey||this.keyCode===6,this.shiftKey=this.shiftKey||this.keyCode===4,this.metaKey=this.metaKey||this.keyCode===57,this._asKeybinding=this._computeKeybinding(),this._asKeyCodeChord=this._computeKeyCodeChord()}preventDefault(){this.browserEvent&&this.browserEvent.preventDefault&&this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent&&this.browserEvent.stopPropagation&&this.browserEvent.stopPropagation()}toKeyCodeChord(){return this._asKeyCodeChord}equals(e){return this._asKeybinding===e}_computeKeybinding(){let e=0;this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode);let n=0;return this.ctrlKey&&(n|=cte),this.altKey&&(n|=ute),this.shiftKey&&(n|=dte),this.metaKey&&(n|=hte),n|=e,n}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new ate(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},hO=new WeakMap;function fte(e){if(!e.parent||e.parent===e)return null;try{let n=e.location,r=e.parent.location;if(n.origin!=="null"&&r.origin!=="null"&&n.origin!==r.origin)return null}catch{return null}return e.parent}var pte=class{static getSameOriginWindowChain(e){let n=hO.get(e);if(!n){n=[],hO.set(e,n);let r=e,i;do i=fte(r),i?n.push({window:new WeakRef(r),iframeElement:r.frameElement||null}):n.push({window:new WeakRef(r),iframeElement:null}),r=i;while(r)}return n.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,n){if(!n||e===n)return{top:0,left:0};let r=0,i=0,s=this.getSameOriginWindowChain(e);for(let a of s){let o=a.window.deref();if(r+=(o==null?void 0:o.scrollY)??0,i+=(o==null?void 0:o.scrollX)??0,o===n||!a.iframeElement)break;let l=a.iframeElement.getBoundingClientRect();r+=l.top,i+=l.left}return{top:r,left:i}}},qy=class{constructor(e,n){this.timestamp=Date.now(),this.browserEvent=n,this.leftButton=n.button===0,this.middleButton=n.button===1,this.rightButton=n.button===2,this.buttons=n.buttons,this.target=n.target,this.detail=n.detail||1,n.type==="dblclick"&&(this.detail=2),this.ctrlKey=n.ctrlKey,this.shiftKey=n.shiftKey,this.altKey=n.altKey,this.metaKey=n.metaKey,typeof n.pageX=="number"?(this.posx=n.pageX,this.posy=n.pageY):(this.posx=n.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=n.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let r=pte.getPositionOfChildWindowRelativeToAncestorWindow(e,n.view);this.posx-=r.left,this.posy-=r.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},fO=class{constructor(e,n=0,r=0){var s;this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=r,this.deltaX=n;let i=!1;if(SE){let a=navigator.userAgent.match(/Chrome\/(\d+)/);i=(a?parseInt(a[1]):123)<=122}if(e){let a=e,o=e,l=((s=e.view)==null?void 0:s.devicePixelRatio)||1;if(typeof a.wheelDeltaY<"u")i?this.deltaY=a.wheelDeltaY/(120*l):this.deltaY=a.wheelDeltaY/120;else if(typeof o.VERTICAL_AXIS<"u"&&o.axis===o.VERTICAL_AXIS)this.deltaY=-o.detail/3;else if(e.type==="wheel"){let u=e;u.deltaMode===u.DOM_DELTA_LINE?kC&&!Uo?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof a.wheelDeltaX<"u")Qee&&vz?this.deltaX=-(a.wheelDeltaX/120):i?this.deltaX=a.wheelDeltaX/(120*l):this.deltaX=a.wheelDeltaX/120;else if(typeof o.HORIZONTAL_AXIS<"u"&&o.axis===o.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type==="wheel"){let u=e;u.deltaMode===u.DOM_DELTA_LINE?kC&&!Uo?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(i?this.deltaY=e.wheelDelta/(120*l):this.deltaY=e.wheelDelta/120)}}preventDefault(){var e;(e=this.browserEvent)==null||e.preventDefault()}stopPropagation(){var e;(e=this.browserEvent)==null||e.stopPropagation()}},xz=Object.freeze(function(e,n){let r=setTimeout(e.bind(n),0);return{dispose(){clearTimeout(r)}}}),mte;(e=>{function n(r){return r===e.None||r===e.Cancelled||r instanceof gte?!0:!r||typeof r!="object"?!1:typeof r.isCancellationRequested=="boolean"&&typeof r.onCancellationRequested=="function"}e.isCancellationToken=n,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Ei.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:xz})})(mte||(mte={}));var gte=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?xz:(this._emitter||(this._emitter=new gt),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},jE=class{constructor(e,n){this._isDisposed=!1,this._token=-1,typeof e=="function"&&typeof n=="number"&&this.setIfNotSet(e,n)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(e,n){if(this._isDisposed)throw new gC("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},n)}setIfNotSet(e,n){if(this._isDisposed)throw new gC("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},n))}},vte=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){var e;(e=this.disposable)==null||e.dispose(),this.disposable=void 0}cancelAndSet(e,n,r=globalThis){if(this.isDisposed)throw new gC("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let i=r.setInterval(()=>{e()},n);this.disposable=br(()=>{r.clearInterval(i),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},yte;(e=>{async function n(i){let s,a=await Promise.all(i.map(o=>o.then(l=>l,l=>{s||(s=l)})));if(typeof s<"u")throw s;return a}e.settled=n;function r(i){return new Promise(async(s,a)=>{try{await i(s,a)}catch(o){a(o)}})}e.withAsyncBody=r})(yte||(yte={}));var pO=class ga{static fromArray(n){return new ga(r=>{r.emitMany(n)})}static fromPromise(n){return new ga(async r=>{r.emitMany(await n)})}static fromPromises(n){return new ga(async r=>{await Promise.all(n.map(async i=>r.emitOne(await i)))})}static merge(n){return new ga(async r=>{await Promise.all(n.map(async i=>{for await(let s of i)r.emitOne(s)}))})}constructor(n,r){this._state=0,this._results=[],this._error=null,this._onReturn=r,this._onStateChanged=new gt,queueMicrotask(async()=>{let i={emitOne:s=>this.emitOne(s),emitMany:s=>this.emitMany(s),reject:s=>this.reject(s)};try{await Promise.resolve(n(i)),this.resolve()}catch(s){this.reject(s)}finally{i.emitOne=void 0,i.emitMany=void 0,i.reject=void 0}})}[Symbol.asyncIterator](){let n=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(n<this._results.length)return{done:!1,value:this._results[n++]};if(this._state===1)return{done:!0,value:void 0};await Ei.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>{var r;return(r=this._onReturn)==null||r.call(this),{done:!0,value:void 0}}}}static map(n,r){return new ga(async i=>{for await(let s of n)i.emitOne(r(s))})}map(n){return ga.map(this,n)}static filter(n,r){return new ga(async i=>{for await(let s of n)r(s)&&i.emitOne(s)})}filter(n){return ga.filter(this,n)}static coalesce(n){return ga.filter(n,r=>!!r)}coalesce(){return ga.coalesce(this)}static async toPromise(n){let r=[];for await(let i of n)r.push(i);return r}toPromise(){return ga.toPromise(this)}emitOne(n){this._state===0&&(this._results.push(n),this._onStateChanged.fire())}emitMany(n){this._state===0&&(this._results=this._results.concat(n),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(n){this._state===0&&(this._state=2,this._error=n,this._onStateChanged.fire())}};pO.EMPTY=pO.fromArray([]);var{getWindow:Io,getWindowId:_te,onDidRegisterWindow:xte}=(function(){let e=new Map,n={window:Ll,disposables:new Qc};e.set(Ll.vscodeWindowId,n);let r=new gt,i=new gt,s=new gt;function a(o,l){return(typeof o=="number"?e.get(o):void 0)??(l?n:void 0)}return{onDidRegisterWindow:r.event,onWillUnregisterWindow:s.event,onDidUnregisterWindow:i.event,registerWindow(o){if(e.has(o.vscodeWindowId))return ln.None;let l=new Qc,u={window:o,disposables:l.add(new Qc)};return e.set(o.vscodeWindowId,u),l.add(br(()=>{e.delete(o.vscodeWindowId),i.fire(o)})),l.add(Xt(o,li.BEFORE_UNLOAD,()=>{s.fire(o)})),r.fire(u),l},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(o){return o.vscodeWindowId},hasWindow(o){return e.has(o)},getWindowById:a,getWindow(o){var d;let l=o;if((d=l==null?void 0:l.ownerDocument)!=null&&d.defaultView)return l.ownerDocument.defaultView.window;let u=o;return u!=null&&u.view?u.view.window:Ll},getDocument(o){return Io(o).document}}})(),bte=class{constructor(e,n,r,i){this._node=e,this._type=n,this._handler=r,this._options=i||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function Xt(e,n,r,i){return new bte(e,n,r,i)}var mO=function(e,n,r,i){return Xt(e,n,r,i)},NE,kte=class extends vte{constructor(e){super(),this.defaultTarget=e&&Io(e)}cancelAndSet(e,n,r){return super.cancelAndSet(e,n,r??this.defaultTarget)}},gO=class{constructor(e,n=0){this._runner=e,this.priority=n,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){tx(e)}}static sort(e,n){return n.priority-e.priority}};(function(){let e=new Map,n=new Map,r=new Map,i=new Map,s=a=>{r.set(a,!1);let o=e.get(a)??[];for(n.set(a,o),e.set(a,[]),i.set(a,!0);o.length>0;)o.sort(gO.sort),o.shift().execute();i.set(a,!1)};NE=(a,o,l=0)=>{let u=_te(a),d=new gO(o,l),p=e.get(u);return p||(p=[],e.set(u,p)),p.push(d),r.get(u)||(r.set(u,!0),a.requestAnimationFrame(()=>s(u))),d}})();function wte(e){let n=e.getBoundingClientRect(),r=Io(e);return{left:n.left+r.scrollX,top:n.top+r.scrollY,width:n.width,height:n.height}}var li={CLICK:"click",MOUSE_DOWN:"mousedown",MOUSE_OVER:"mouseover",MOUSE_LEAVE:"mouseleave",MOUSE_WHEEL:"wheel",POINTER_UP:"pointerup",POINTER_DOWN:"pointerdown",POINTER_MOVE:"pointermove",KEY_DOWN:"keydown",KEY_UP:"keyup",BEFORE_UNLOAD:"beforeunload",CHANGE:"change",FOCUS:"focus",BLUR:"blur",INPUT:"input"},Ste=class{constructor(e){this.domNode=e,this._maxWidth="",this._width="",this._height="",this._top="",this._left="",this._bottom="",this._right="",this._paddingTop="",this._paddingLeft="",this._paddingBottom="",this._paddingRight="",this._fontFamily="",this._fontWeight="",this._fontSize="",this._fontStyle="",this._fontFeatureSettings="",this._fontVariationSettings="",this._textDecoration="",this._lineHeight="",this._letterSpacing="",this._className="",this._display="",this._position="",this._visibility="",this._color="",this._backgroundColor="",this._layerHint=!1,this._contain="none",this._boxShadow=""}setMaxWidth(e){let n=gs(e);this._maxWidth!==n&&(this._maxWidth=n,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let n=gs(e);this._width!==n&&(this._width=n,this.domNode.style.width=this._width)}setHeight(e){let n=gs(e);this._height!==n&&(this._height=n,this.domNode.style.height=this._height)}setTop(e){let n=gs(e);this._top!==n&&(this._top=n,this.domNode.style.top=this._top)}setLeft(e){let n=gs(e);this._left!==n&&(this._left=n,this.domNode.style.left=this._left)}setBottom(e){let n=gs(e);this._bottom!==n&&(this._bottom=n,this.domNode.style.bottom=this._bottom)}setRight(e){let n=gs(e);this._right!==n&&(this._right=n,this.domNode.style.right=this._right)}setPaddingTop(e){let n=gs(e);this._paddingTop!==n&&(this._paddingTop=n,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let n=gs(e);this._paddingLeft!==n&&(this._paddingLeft=n,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let n=gs(e);this._paddingBottom!==n&&(this._paddingBottom=n,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let n=gs(e);this._paddingRight!==n&&(this._paddingRight=n,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(e){this._fontFamily!==e&&(this._fontFamily=e,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(e){let n=gs(e);this._fontSize!==n&&(this._fontSize=n,this.domNode.style.fontSize=this._fontSize)}setFontStyle(e){this._fontStyle!==e&&(this._fontStyle=e,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(e){this._fontFeatureSettings!==e&&(this._fontFeatureSettings=e,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(e){this._fontVariationSettings!==e&&(this._fontVariationSettings=e,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(e){this._textDecoration!==e&&(this._textDecoration=e,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(e){let n=gs(e);this._lineHeight!==n&&(this._lineHeight=n,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let n=gs(e);this._letterSpacing!==n&&(this._letterSpacing=n,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(e){this._className!==e&&(this._className=e,this.domNode.className=this._className)}toggleClassName(e,n){this.domNode.classList.toggle(e,n),this._className=this.domNode.className}setDisplay(e){this._display!==e&&(this._display=e,this.domNode.style.display=this._display)}setPosition(e){this._position!==e&&(this._position=e,this.domNode.style.position=this._position)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this.domNode.style.visibility=this._visibility)}setColor(e){this._color!==e&&(this._color=e,this.domNode.style.color=this._color)}setBackgroundColor(e){this._backgroundColor!==e&&(this._backgroundColor=e,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(e){this._layerHint!==e&&(this._layerHint=e,this.domNode.style.transform=this._layerHint?"translate3d(0px, 0px, 0px)":"")}setBoxShadow(e){this._boxShadow!==e&&(this._boxShadow=e,this.domNode.style.boxShadow=e)}setContain(e){this._contain!==e&&(this._contain=e,this.domNode.style.contain=this._contain)}setAttribute(e,n){this.domNode.setAttribute(e,n)}removeAttribute(e){this.domNode.removeAttribute(e)}appendChild(e){this.domNode.appendChild(e.domNode)}removeChild(e){this.domNode.removeChild(e.domNode)}};function gs(e){return typeof e=="number"?`${e}px`:e}function Wm(e){return new Ste(e)}var bz=class{constructor(){this._hooks=new Qc,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,n){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let r=this._onStopCallback;this._onStopCallback=null,e&&r&&r(n)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,n,r,i,s){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=i,this._onStopCallback=s;let a=e;try{e.setPointerCapture(n),this._hooks.add(br(()=>{try{e.releasePointerCapture(n)}catch{}}))}catch{a=Io(e)}this._hooks.add(Xt(a,li.POINTER_MOVE,o=>{if(o.buttons!==r){this.stopMonitoring(!0);return}o.preventDefault(),this._pointerMoveCallback(o)})),this._hooks.add(Xt(a,li.POINTER_UP,o=>this.stopMonitoring(!0)))}};function Cte(e,n,r){let i=null,s=null;if(typeof r.value=="function"?(i="value",s=r.value,s.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof r.get=="function"&&(i="get",s=r.get),!s)throw new Error("not supported");let a=`$memoize$${n}`;r[i]=function(...o){return this.hasOwnProperty(a)||Object.defineProperty(this,a,{configurable:!1,enumerable:!1,writable:!1,value:s.apply(this,o)}),this[a]}}var Co;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(Co||(Co={}));var Cm=class zi extends ln{constructor(){super(),this.dispatched=!1,this.targets=new aO,this.ignoreTargets=new aO,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(Ei.runAndSubscribe(xte,({window:n,disposables:r})=>{r.add(Xt(n.document,"touchstart",i=>this.onTouchStart(i),{passive:!1})),r.add(Xt(n.document,"touchend",i=>this.onTouchEnd(n,i))),r.add(Xt(n.document,"touchmove",i=>this.onTouchMove(i),{passive:!1}))},{window:Ll,disposables:this._store}))}static addTarget(n){if(!zi.isTouchDevice())return ln.None;zi.INSTANCE||(zi.INSTANCE=new zi);let r=zi.INSTANCE.targets.push(n);return br(r)}static ignoreTarget(n){if(!zi.isTouchDevice())return ln.None;zi.INSTANCE||(zi.INSTANCE=new zi);let r=zi.INSTANCE.ignoreTargets.push(n);return br(r)}static isTouchDevice(){return"ontouchstart"in Ll||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(n){let r=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let i=0,s=n.targetTouches.length;i<s;i++){let a=n.targetTouches.item(i);this.activeTouches[a.identifier]={id:a.identifier,initialTarget:a.target,initialTimeStamp:r,initialPageX:a.pageX,initialPageY:a.pageY,rollingTimestamps:[r],rollingPageX:[a.pageX],rollingPageY:[a.pageY]};let o=this.newGestureEvent(Co.Start,a.target);o.pageX=a.pageX,o.pageY=a.pageY,this.dispatchEvent(o)}this.dispatched&&(n.preventDefault(),n.stopPropagation(),this.dispatched=!1)}onTouchEnd(n,r){let i=Date.now(),s=Object.keys(this.activeTouches).length;for(let a=0,o=r.changedTouches.length;a<o;a++){let l=r.changedTouches.item(a);if(!this.activeTouches.hasOwnProperty(String(l.identifier))){console.warn("move of an UNKNOWN touch",l);continue}let u=this.activeTouches[l.identifier],d=Date.now()-u.initialTimeStamp;if(d<zi.HOLD_DELAY&&Math.abs(u.initialPageX-Hs(u.rollingPageX))<30&&Math.abs(u.initialPageY-Hs(u.rollingPageY))<30){let p=this.newGestureEvent(Co.Tap,u.initialTarget);p.pageX=Hs(u.rollingPageX),p.pageY=Hs(u.rollingPageY),this.dispatchEvent(p)}else if(d>=zi.HOLD_DELAY&&Math.abs(u.initialPageX-Hs(u.rollingPageX))<30&&Math.abs(u.initialPageY-Hs(u.rollingPageY))<30){let p=this.newGestureEvent(Co.Contextmenu,u.initialTarget);p.pageX=Hs(u.rollingPageX),p.pageY=Hs(u.rollingPageY),this.dispatchEvent(p)}else if(s===1){let p=Hs(u.rollingPageX),f=Hs(u.rollingPageY),g=Hs(u.rollingTimestamps)-u.rollingTimestamps[0],_=p-u.rollingPageX[0],x=f-u.rollingPageY[0],v=[...this.targets].filter(S=>u.initialTarget instanceof Node&&S.contains(u.initialTarget));this.inertia(n,v,i,Math.abs(_)/g,_>0?1:-1,p,Math.abs(x)/g,x>0?1:-1,f)}this.dispatchEvent(this.newGestureEvent(Co.End,u.initialTarget)),delete this.activeTouches[l.identifier]}this.dispatched&&(r.preventDefault(),r.stopPropagation(),this.dispatched=!1)}newGestureEvent(n,r){let i=document.createEvent("CustomEvent");return i.initEvent(n,!1,!0),i.initialTarget=r,i.tapCount=0,i}dispatchEvent(n){if(n.type===Co.Tap){let r=new Date().getTime(),i=0;r-this._lastSetTapCountTime>zi.CLEAR_TAP_COUNT_TIME?i=1:i=2,this._lastSetTapCountTime=r,n.tapCount=i}else(n.type===Co.Change||n.type===Co.Contextmenu)&&(this._lastSetTapCountTime=0);if(n.initialTarget instanceof Node){for(let i of this.ignoreTargets)if(i.contains(n.initialTarget))return;let r=[];for(let i of this.targets)if(i.contains(n.initialTarget)){let s=0,a=n.initialTarget;for(;a&&a!==i;)s++,a=a.parentElement;r.push([s,i])}r.sort((i,s)=>i[0]-s[0]);for(let[i,s]of r)s.dispatchEvent(n),this.dispatched=!0}}inertia(n,r,i,s,a,o,l,u,d){this.handle=NE(n,()=>{let p=Date.now(),f=p-i,g=0,_=0,x=!0;s+=zi.SCROLL_FRICTION*f,l+=zi.SCROLL_FRICTION*f,s>0&&(x=!1,g=a*s*f),l>0&&(x=!1,_=u*l*f);let v=this.newGestureEvent(Co.Change);v.translationX=g,v.translationY=_,r.forEach(S=>S.dispatchEvent(v)),x||this.inertia(n,r,p,s,a,o+g,l,u,d+_)})}onTouchMove(n){let r=Date.now();for(let i=0,s=n.changedTouches.length;i<s;i++){let a=n.changedTouches.item(i);if(!this.activeTouches.hasOwnProperty(String(a.identifier))){console.warn("end of an UNKNOWN touch",a);continue}let o=this.activeTouches[a.identifier],l=this.newGestureEvent(Co.Change,o.initialTarget);l.translationX=a.pageX-Hs(o.rollingPageX),l.translationY=a.pageY-Hs(o.rollingPageY),l.pageX=a.pageX,l.pageY=a.pageY,this.dispatchEvent(l),o.rollingPageX.length>3&&(o.rollingPageX.shift(),o.rollingPageY.shift(),o.rollingTimestamps.shift()),o.rollingPageX.push(a.pageX),o.rollingPageY.push(a.pageY),o.rollingTimestamps.push(r)}this.dispatched&&(n.preventDefault(),n.stopPropagation(),this.dispatched=!1)}};Cm.SCROLL_FRICTION=-.005,Cm.HOLD_DELAY=700,Cm.CLEAR_TAP_COUNT_TIME=400,Dr([Cte],Cm,"isTouchDevice",1);var jte=Cm,EE=class extends ln{onclick(e,n){this._register(Xt(e,li.CLICK,r=>n(new qy(Io(e),r))))}onmousedown(e,n){this._register(Xt(e,li.MOUSE_DOWN,r=>n(new qy(Io(e),r))))}onmouseover(e,n){this._register(Xt(e,li.MOUSE_OVER,r=>n(new qy(Io(e),r))))}onmouseleave(e,n){this._register(Xt(e,li.MOUSE_LEAVE,r=>n(new qy(Io(e),r))))}onkeydown(e,n){this._register(Xt(e,li.KEY_DOWN,r=>n(new dO(r))))}onkeyup(e,n){this._register(Xt(e,li.KEY_UP,r=>n(new dO(r))))}oninput(e,n){this._register(Xt(e,li.INPUT,n))}onblur(e,n){this._register(Xt(e,li.BLUR,n))}onfocus(e,n){this._register(Xt(e,li.FOCUS,n))}onchange(e,n){this._register(Xt(e,li.CHANGE,n))}ignoreGesture(e){return jte.ignoreTarget(e)}},vO=11,Nte=class extends EE{constructor(e){super(),this._onActivate=e.onActivate,this.bgDomNode=document.createElement("div"),this.bgDomNode.className="arrow-background",this.bgDomNode.style.position="absolute",this.bgDomNode.style.width=e.bgWidth+"px",this.bgDomNode.style.height=e.bgHeight+"px",typeof e.top<"u"&&(this.bgDomNode.style.top="0px"),typeof e.left<"u"&&(this.bgDomNode.style.left="0px"),typeof e.bottom<"u"&&(this.bgDomNode.style.bottom="0px"),typeof e.right<"u"&&(this.bgDomNode.style.right="0px"),this.domNode=document.createElement("div"),this.domNode.className=e.className,this.domNode.style.position="absolute",this.domNode.style.width=vO+"px",this.domNode.style.height=vO+"px",typeof e.top<"u"&&(this.domNode.style.top=e.top+"px"),typeof e.left<"u"&&(this.domNode.style.left=e.left+"px"),typeof e.bottom<"u"&&(this.domNode.style.bottom=e.bottom+"px"),typeof e.right<"u"&&(this.domNode.style.right=e.right+"px"),this._pointerMoveMonitor=this._register(new bz),this._register(mO(this.bgDomNode,li.POINTER_DOWN,n=>this._arrowPointerDown(n))),this._register(mO(this.domNode,li.POINTER_DOWN,n=>this._arrowPointerDown(n))),this._pointerdownRepeatTimer=this._register(new kte),this._pointerdownScheduleRepeatTimer=this._register(new jE)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let n=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,Io(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(n,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,r=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},Ete=class CC{constructor(n,r,i,s,a,o,l){this._forceIntegerValues=n,this._scrollStateBrand=void 0,this._forceIntegerValues&&(r=r|0,i=i|0,s=s|0,a=a|0,o=o|0,l=l|0),this.rawScrollLeft=s,this.rawScrollTop=l,r<0&&(r=0),s+r>i&&(s=i-r),s<0&&(s=0),a<0&&(a=0),l+a>o&&(l=o-a),l<0&&(l=0),this.width=r,this.scrollWidth=i,this.scrollLeft=s,this.height=a,this.scrollHeight=o,this.scrollTop=l}equals(n){return this.rawScrollLeft===n.rawScrollLeft&&this.rawScrollTop===n.rawScrollTop&&this.width===n.width&&this.scrollWidth===n.scrollWidth&&this.scrollLeft===n.scrollLeft&&this.height===n.height&&this.scrollHeight===n.scrollHeight&&this.scrollTop===n.scrollTop}withScrollDimensions(n,r){return new CC(this._forceIntegerValues,typeof n.width<"u"?n.width:this.width,typeof n.scrollWidth<"u"?n.scrollWidth:this.scrollWidth,r?this.rawScrollLeft:this.scrollLeft,typeof n.height<"u"?n.height:this.height,typeof n.scrollHeight<"u"?n.scrollHeight:this.scrollHeight,r?this.rawScrollTop:this.scrollTop)}withScrollPosition(n){return new CC(this._forceIntegerValues,this.width,this.scrollWidth,typeof n.scrollLeft<"u"?n.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof n.scrollTop<"u"?n.scrollTop:this.rawScrollTop)}createScrollEvent(n,r){let i=this.width!==n.width,s=this.scrollWidth!==n.scrollWidth,a=this.scrollLeft!==n.scrollLeft,o=this.height!==n.height,l=this.scrollHeight!==n.scrollHeight,u=this.scrollTop!==n.scrollTop;return{inSmoothScrolling:r,oldWidth:n.width,oldScrollWidth:n.scrollWidth,oldScrollLeft:n.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:n.height,oldScrollHeight:n.scrollHeight,oldScrollTop:n.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:i,scrollWidthChanged:s,scrollLeftChanged:a,heightChanged:o,scrollHeightChanged:l,scrollTopChanged:u}}},Ate=class extends ln{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new gt),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new Ete(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,n){var i;let r=this._state.withScrollDimensions(e,n);this._setState(r,!!this._smoothScrolling),(i=this._smoothScrolling)==null||i.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let n=this._state.withScrollPosition(e);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(n,!1)}setScrollPositionSmooth(e,n){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:typeof e.scrollLeft>"u"?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>"u"?this._smoothScrolling.to.scrollTop:e.scrollTop};let r=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===r.scrollLeft&&this._smoothScrolling.to.scrollTop===r.scrollTop)return;let i;n?i=new _O(this._smoothScrolling.from,r,this._smoothScrolling.startTime,this._smoothScrolling.duration):i=this._smoothScrolling.combine(this._state,r,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=i}else{let r=this._state.withScrollPosition(e);this._smoothScrolling=_O.start(this._state,r,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let e=this._smoothScrolling.tick(),n=this._state.withScrollPosition(e);if(this._setState(n,!0),!!this._smoothScrolling){if(e.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,n){let r=this._state;r.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(r,n)))}},yO=class{constructor(e,n,r){this.scrollLeft=e,this.scrollTop=n,this.isDone=r}};function Sw(e,n){let r=n-e;return function(i){return e+r*Rte(i)}}function Tte(e,n,r){return function(i){return i<r?e(i/r):n((i-r)/(1-r))}}var _O=class jC{constructor(n,r,i,s){this.from=n,this.to=r,this.duration=s,this.startTime=i,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(n,r,i){if(Math.abs(n-r)>2.5*i){let s,a;return n<r?(s=n+.75*i,a=r-.75*i):(s=n-.75*i,a=r+.75*i),Tte(Sw(n,s),Sw(a,r),.33)}return Sw(n,r)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(n){this.to=n.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(n){let r=(n-this.startTime)/this.duration;if(r<1){let i=this.scrollLeft(r),s=this.scrollTop(r);return new yO(i,s,!1)}return new yO(this.to.scrollLeft,this.to.scrollTop,!0)}combine(n,r,i){return jC.start(n,r,i)}static start(n,r,i){i=i+10;let s=Date.now()-10;return new jC(n,r,s,i)}};function Mte(e){return Math.pow(e,3)}function Rte(e){return 1-Mte(1-e)}var Ote=class extends ln{constructor(e,n,r){super(),this._visibility=e,this._visibleClassName=n,this._invisibleClassName=r,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new jE)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this._updateShouldBeVisible())}setShouldBeVisible(e){this._rawShouldBeVisible=e,this._updateShouldBeVisible()}_applyVisibilitySetting(){return this._visibility===2?!1:this._visibility===3?!0:this._rawShouldBeVisible}_updateShouldBeVisible(){let e=this._applyVisibilitySetting();this._shouldBeVisible!==e&&(this._shouldBeVisible=e,this.ensureVisibility())}setIsNeeded(e){this._isNeeded!==e&&(this._isNeeded=e,this.ensureVisibility())}setDomNode(e){this._domNode=e,this._domNode.setClassName(this._invisibleClassName),this.setShouldBeVisible(!1)}ensureVisibility(){if(!this._isNeeded){this._hide(!1);return}this._shouldBeVisible?this._reveal():this._hide(!0)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet(()=>{var e;(e=this._domNode)==null||e.setClassName(this._visibleClassName)},0))}_hide(e){var n;this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,(n=this._domNode)==null||n.setClassName(this._invisibleClassName+(e?" fade":"")))}},Dte=140,kz=class extends EE{constructor(e){super(),this._lazyRender=e.lazyRender,this._host=e.host,this._scrollable=e.scrollable,this._scrollByPage=e.scrollByPage,this._scrollbarState=e.scrollbarState,this._visibilityController=this._register(new Ote(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new bz),this._shouldRender=!0,this.domNode=Wm(document.createElement("div")),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this._visibilityController.setDomNode(this.domNode),this.domNode.setPosition("absolute"),this._register(Xt(this.domNode.domNode,li.POINTER_DOWN,n=>this._domNodePointerDown(n)))}_createArrow(e){let n=this._register(new Nte(e));this.domNode.domNode.appendChild(n.bgDomNode),this.domNode.domNode.appendChild(n.domNode)}_createSlider(e,n,r,i){this.slider=Wm(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(n),typeof r=="number"&&this.slider.setWidth(r),typeof i=="number"&&this.slider.setHeight(i),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(Xt(this.slider.domNode,li.POINTER_DOWN,s=>{s.button===0&&(s.preventDefault(),this._sliderPointerDown(s))})),this.onclick(this.slider.domNode,s=>{s.leftButton&&s.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){let n=this.domNode.domNode.getClientRects()[0].top,r=n+this._scrollbarState.getSliderPosition(),i=n+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),s=this._sliderPointerPosition(e);r<=s&&s<=i?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let n,r;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")n=e.offsetX,r=e.offsetY;else{let s=wte(this.domNode.domNode);n=e.pageX-s.left,r=e.pageY-s.top}let i=this._pointerDownRelativePosition(n,r);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(i):this._scrollbarState.getDesiredScrollPositionFromOffset(i)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let n=this._sliderPointerPosition(e),r=this._sliderOrthogonalPointerPosition(e),i=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,s=>{let a=this._sliderOrthogonalPointerPosition(s),o=Math.abs(a-r);if(vz&&o>Dte){this._setDesiredScrollPositionNow(i.getScrollPosition());return}let l=this._sliderPointerPosition(s)-n;this._setDesiredScrollPositionNow(i.getDesiredScrollPositionFromDelta(l))},()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let n={};this.writeScrollPosition(n,e),this._scrollable.setScrollPositionNow(n)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},wz=class NC{constructor(n,r,i,s,a,o){this._scrollbarSize=Math.round(r),this._oppositeScrollbarSize=Math.round(i),this._arrowSize=Math.round(n),this._visibleSize=s,this._scrollSize=a,this._scrollPosition=o,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new NC(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(n){let r=Math.round(n);return this._visibleSize!==r?(this._visibleSize=r,this._refreshComputedValues(),!0):!1}setScrollSize(n){let r=Math.round(n);return this._scrollSize!==r?(this._scrollSize=r,this._refreshComputedValues(),!0):!1}setScrollPosition(n){let r=Math.round(n);return this._scrollPosition!==r?(this._scrollPosition=r,this._refreshComputedValues(),!0):!1}setScrollbarSize(n){this._scrollbarSize=Math.round(n)}setOppositeScrollbarSize(n){this._oppositeScrollbarSize=Math.round(n)}static _computeValues(n,r,i,s,a){let o=Math.max(0,i-n),l=Math.max(0,o-2*r),u=s>0&&s>i;if(!u)return{computedAvailableSize:Math.round(o),computedIsNeeded:u,computedSliderSize:Math.round(l),computedSliderRatio:0,computedSliderPosition:0};let d=Math.round(Math.max(20,Math.floor(i*l/s))),p=(l-d)/(s-i),f=a*p;return{computedAvailableSize:Math.round(o),computedIsNeeded:u,computedSliderSize:Math.round(d),computedSliderRatio:p,computedSliderPosition:Math.round(f)}}_refreshComputedValues(){let n=NC._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=n.computedAvailableSize,this._computedIsNeeded=n.computedIsNeeded,this._computedSliderSize=n.computedSliderSize,this._computedSliderRatio=n.computedSliderRatio,this._computedSliderPosition=n.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(n){if(!this._computedIsNeeded)return 0;let r=n-this._arrowSize-this._computedSliderSize/2;return Math.round(r/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(n){if(!this._computedIsNeeded)return 0;let r=n-this._arrowSize,i=this._scrollPosition;return r<this._computedSliderPosition?i-=this._visibleSize:i+=this._visibleSize,i}getDesiredScrollPositionFromDelta(n){if(!this._computedIsNeeded)return 0;let r=this._computedSliderPosition+n;return Math.round(r/this._computedSliderRatio)}},Pte=class extends kz{constructor(e,n,r){let i=e.getScrollDimensions(),s=e.getCurrentScrollPosition();if(super({lazyRender:n.lazyRender,host:r,scrollbarState:new wz(n.horizontalHasArrows?n.arrowSize:0,n.horizontal===2?0:n.horizontalScrollbarSize,n.vertical===2?0:n.verticalScrollbarSize,i.width,i.scrollWidth,s.scrollLeft),visibility:n.horizontal,extraScrollbarClassName:"horizontal",scrollable:e,scrollByPage:n.scrollByPage}),n.horizontalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(Math.floor((n.horizontalScrollbarSize-n.horizontalSliderSize)/2),0,void 0,n.horizontalSliderSize)}_updateSlider(e,n){this.slider.setWidth(e),this.slider.setLeft(n)}_renderDomNode(e,n){this.domNode.setWidth(e),this.domNode.setHeight(n),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(e.width)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,n){return e}_sliderPointerPosition(e){return e.pageX}_sliderOrthogonalPointerPosition(e){return e.pageY}_updateScrollbarSize(e){this.slider.setHeight(e)}writeScrollPosition(e,n){e.scrollLeft=n}updateOptions(e){this.updateScrollbarSize(e.horizontal===2?0:e.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._visibilityController.setVisibility(e.horizontal),this._scrollByPage=e.scrollByPage}},Lte=class extends kz{constructor(e,n,r){let i=e.getScrollDimensions(),s=e.getCurrentScrollPosition();if(super({lazyRender:n.lazyRender,host:r,scrollbarState:new wz(n.verticalHasArrows?n.arrowSize:0,n.vertical===2?0:n.verticalScrollbarSize,0,i.height,i.scrollHeight,s.scrollTop),visibility:n.vertical,extraScrollbarClassName:"vertical",scrollable:e,scrollByPage:n.scrollByPage}),n.verticalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(0,Math.floor((n.verticalScrollbarSize-n.verticalSliderSize)/2),n.verticalSliderSize,void 0)}_updateSlider(e,n){this.slider.setHeight(e),this.slider.setTop(n)}_renderDomNode(e,n){this.domNode.setWidth(n),this.domNode.setHeight(e),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(e.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,n){return n}_sliderPointerPosition(e){return e.pageY}_sliderOrthogonalPointerPosition(e){return e.pageX}_updateScrollbarSize(e){this.slider.setWidth(e)}writeScrollPosition(e,n){e.scrollTop=n}updateOptions(e){this.updateScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(e.vertical),this._scrollByPage=e.scrollByPage}},Ite=500,xO=50,Bte=class{constructor(e,n,r){this.timestamp=e,this.deltaX=n,this.deltaY=r,this.score=0}},EC=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let n=1,r=0,i=1,s=this._rear;do{let a=s===this._front?n:Math.pow(2,-i);if(n-=a,r+=this._memory[s].score*a,s===this._front)break;s=(this._capacity+s-1)%this._capacity,i++}while(!0);return r<=.5}acceptStandardWheelEvent(n){if(SE){let r=Io(n.browserEvent),i=Gee(r);this.accept(Date.now(),n.deltaX*i,n.deltaY*i)}else this.accept(Date.now(),n.deltaX,n.deltaY)}accept(n,r,i){let s=null,a=new Bte(n,r,i);this._front===-1&&this._rear===-1?(this._memory[0]=a,this._front=0,this._rear=0):(s=this._memory[this._rear],this._rear=(this._rear+1)%this._capacity,this._rear===this._front&&(this._front=(this._front+1)%this._capacity),this._memory[this._rear]=a),a.score=this._computeScore(a,s)}_computeScore(n,r){if(Math.abs(n.deltaX)>0&&Math.abs(n.deltaY)>0)return 1;let i=.5;if((!this._isAlmostInt(n.deltaX)||!this._isAlmostInt(n.deltaY))&&(i+=.25),r){let s=Math.abs(n.deltaX),a=Math.abs(n.deltaY),o=Math.abs(r.deltaX),l=Math.abs(r.deltaY),u=Math.max(Math.min(s,o),1),d=Math.max(Math.min(a,l),1),p=Math.max(s,o),f=Math.max(a,l);p%u===0&&f%d===0&&(i-=.5)}return Math.min(Math.max(i,0),1)}_isAlmostInt(n){return Math.abs(Math.round(n)-n)<.01}};EC.INSTANCE=new EC;var zte=EC,$te=class extends EE{constructor(e,n,r){super(),this._onScroll=this._register(new gt),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new gt),this.onWillScroll=this._onWillScroll.event,this._options=Hte(n),this._scrollable=r,this._register(this._scrollable.onScroll(s=>{this._onWillScroll.fire(s),this._onDidScroll(s),this._onScroll.fire(s)}));let i={onMouseWheel:s=>this._onMouseWheel(s),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new Lte(this._scrollable,this._options,i)),this._horizontalScrollbar=this._register(new Pte(this._scrollable,this._options,i)),this._domNode=document.createElement("div"),this._domNode.className="xterm-scrollable-element "+this._options.className,this._domNode.setAttribute("role","presentation"),this._domNode.style.position="relative",this._domNode.appendChild(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=Wm(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=Wm(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=Wm(document.createElement("div")),this._topLeftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topLeftShadowDomNode.domNode)):(this._leftShadowDomNode=null,this._topShadowDomNode=null,this._topLeftShadowDomNode=null),this._listenOnDomNode=this._options.listenOnDomNode||this._domNode,this._mouseWheelToDispose=[],this._setListeningToMouseWheel(this._options.handleMouseWheel),this.onmouseover(this._listenOnDomNode,s=>this._onMouseOver(s)),this.onmouseleave(this._listenOnDomNode,s=>this._onMouseLeave(s)),this._hideTimeout=this._register(new jE),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=bd(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(e){this._verticalScrollbar.delegatePointerDown(e)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(e){this._scrollable.setScrollDimensions(e,!1)}updateClassName(e){this._options.className=e,Uo&&(this._options.className+=" mac"),this._domNode.className="xterm-scrollable-element "+this._options.className}updateOptions(e){typeof e.handleMouseWheel<"u"&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof e.mouseWheelScrollSensitivity<"u"&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),typeof e.fastScrollSensitivity<"u"&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),typeof e.scrollPredominantAxis<"u"&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),typeof e.horizontal<"u"&&(this._options.horizontal=e.horizontal),typeof e.vertical<"u"&&(this._options.vertical=e.vertical),typeof e.horizontalScrollbarSize<"u"&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),typeof e.verticalScrollbarSize<"u"&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),typeof e.scrollByPage<"u"&&(this._options.scrollByPage=e.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(e){this._revealOnScroll=e}delegateScrollFromMouseWheelEvent(e){this._onMouseWheel(new fO(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=bd(this._mouseWheelToDispose),e)){let n=r=>{this._onMouseWheel(new fO(r))};this._mouseWheelToDispose.push(Xt(this._listenOnDomNode,li.MOUSE_WHEEL,n,{passive:!1}))}}_onMouseWheel(e){var s;if((s=e.browserEvent)!=null&&s.defaultPrevented)return;let n=zte.INSTANCE;n.acceptStandardWheelEvent(e);let r=!1;if(e.deltaY||e.deltaX){let a=e.deltaY*this._options.mouseWheelScrollSensitivity,o=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&o+a===0?o=a=0:Math.abs(a)>=Math.abs(o)?o=0:a=0),this._options.flipAxes&&([a,o]=[o,a]);let l=!Uo&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||l)&&!o&&(o=a,a=0),e.browserEvent&&e.browserEvent.altKey&&(o=o*this._options.fastScrollSensitivity,a=a*this._options.fastScrollSensitivity);let u=this._scrollable.getFutureScrollPosition(),d={};if(a){let p=xO*a,f=u.scrollTop-(p<0?Math.floor(p):Math.ceil(p));this._verticalScrollbar.writeScrollPosition(d,f)}if(o){let p=xO*o,f=u.scrollLeft-(p<0?Math.floor(p):Math.ceil(p));this._horizontalScrollbar.writeScrollPosition(d,f)}d=this._scrollable.validateScrollPosition(d),(u.scrollLeft!==d.scrollLeft||u.scrollTop!==d.scrollTop)&&(this._options.mouseWheelSmoothScroll&&n.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(d):this._scrollable.setScrollPositionNow(d),r=!0)}let i=r;!i&&this._options.alwaysConsumeMouseWheel&&(i=!0),!i&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(i=!0),i&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw new Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),n=e.scrollTop>0,r=e.scrollLeft>0,i=r?" left":"",s=n?" top":"",a=r||n?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${i}`),this._topShadowDomNode.setClassName(`shadow${s}`),this._topLeftShadowDomNode.setClassName(`shadow${a}${s}${i}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),Ite)}},Fte=class extends $te{constructor(e,n,r){super(e,n,r)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function Hte(e){let n={lazyRender:typeof e.lazyRender<"u"?e.lazyRender:!1,className:typeof e.className<"u"?e.className:"",useShadows:typeof e.useShadows<"u"?e.useShadows:!0,handleMouseWheel:typeof e.handleMouseWheel<"u"?e.handleMouseWheel:!0,flipAxes:typeof e.flipAxes<"u"?e.flipAxes:!1,consumeMouseWheelIfScrollbarIsNeeded:typeof e.consumeMouseWheelIfScrollbarIsNeeded<"u"?e.consumeMouseWheelIfScrollbarIsNeeded:!1,alwaysConsumeMouseWheel:typeof e.alwaysConsumeMouseWheel<"u"?e.alwaysConsumeMouseWheel:!1,scrollYToX:typeof e.scrollYToX<"u"?e.scrollYToX:!1,mouseWheelScrollSensitivity:typeof e.mouseWheelScrollSensitivity<"u"?e.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof e.fastScrollSensitivity<"u"?e.fastScrollSensitivity:5,scrollPredominantAxis:typeof e.scrollPredominantAxis<"u"?e.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof e.mouseWheelSmoothScroll<"u"?e.mouseWheelSmoothScroll:!0,arrowSize:typeof e.arrowSize<"u"?e.arrowSize:11,listenOnDomNode:typeof e.listenOnDomNode<"u"?e.listenOnDomNode:null,horizontal:typeof e.horizontal<"u"?e.horizontal:1,horizontalScrollbarSize:typeof e.horizontalScrollbarSize<"u"?e.horizontalScrollbarSize:10,horizontalSliderSize:typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:0,horizontalHasArrows:typeof e.horizontalHasArrows<"u"?e.horizontalHasArrows:!1,vertical:typeof e.vertical<"u"?e.vertical:1,verticalScrollbarSize:typeof e.verticalScrollbarSize<"u"?e.verticalScrollbarSize:10,verticalHasArrows:typeof e.verticalHasArrows<"u"?e.verticalHasArrows:!1,verticalSliderSize:typeof e.verticalSliderSize<"u"?e.verticalSliderSize:0,scrollByPage:typeof e.scrollByPage<"u"?e.scrollByPage:!1};return n.horizontalSliderSize=typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:n.horizontalScrollbarSize,n.verticalSliderSize=typeof e.verticalSliderSize<"u"?e.verticalSliderSize:n.verticalScrollbarSize,Uo&&(n.className+=" mac"),n}var AC=class extends ln{constructor(e,n,r,i,s,a,o,l){super(),this._bufferService=r,this._optionsService=o,this._renderService=l,this._onRequestScrollLines=this._register(new gt),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let u=this._register(new Ate({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:d=>NE(i.window,d)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{u.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new Fte(n,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},u)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(s.onProtocolChange(d=>{this._scrollableElement.updateOptions({handleMouseWheel:!(d&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(Ei.runAndSubscribe(a.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=a.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(br(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=i.mainDocument.createElement("style"),n.appendChild(this._styleElement),this._register(br(()=>this._styleElement.remove())),this._register(Ei.runAndSubscribe(a.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",`  background: ${a.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",`  background: ${a.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",`  background: ${a.colors.scrollbarSliderActiveBackground.css};`,"}"].join(`
`)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll(d=>this._handleScroll(d)))}scrollLines(e){let n=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:n.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,n){n&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!n,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){var e;return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:((e=this._optionsService.rawOptions.overviewRuler)==null?void 0:e.width)||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let n=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),r=n-this._bufferService.buffer.ydisp;r!==0&&(this._latestYDisp=n,this._onRequestScrollLines.fire(r)),this._isHandlingScroll=!1}};AC=Dr([At(2,ss),At(3,Ql),At(4,rz),At(5,Yf),At(6,as),At(7,Zl)],AC);var TC=class extends ln{constructor(e,n,r,i,s){super(),this._screenElement=e,this._bufferService=n,this._coreBrowserService=r,this._decorationService=i,this._renderService=s,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(a=>this._removeDecoration(a))),this._register(br(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){var i;let n=this._coreBrowserService.mainDocument.createElement("div");n.classList.add("xterm-decoration"),n.classList.toggle("xterm-decoration-top-layer",((i=e==null?void 0:e.options)==null?void 0:i.layer)==="top"),n.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,n.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,n.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,n.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let r=e.options.x??0;return r&&r>this._bufferService.cols&&(n.style.display="none"),this._refreshXPosition(e,n),n}_refreshStyle(e){let n=e.marker.line-this._bufferService.buffers.active.ydisp;if(n<0||n>=this._bufferService.rows)e.element&&(e.element.style.display="none",e.onRenderEmitter.fire(e.element));else{let r=this._decorationElements.get(e);r||(r=this._createElement(e),e.element=r,this._decorationElements.set(e,r),this._container.appendChild(r),e.onDispose(()=>{this._decorationElements.delete(e),r.remove()})),r.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(r.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,r.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,r.style.top=`${n*this._renderService.dimensions.css.cell.height}px`,r.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(r)}}_refreshXPosition(e,n=e.element){if(!n)return;let r=e.options.x??0;(e.options.anchor||"left")==="right"?n.style.right=r?`${r*this._renderService.dimensions.css.cell.width}px`:"":n.style.left=r?`${r*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(e){var n;(n=this._decorationElements.get(e))==null||n.remove(),this._decorationElements.delete(e),e.dispose()}};TC=Dr([At(1,ss),At(2,Ql),At(3,lv),At(4,Zl)],TC);var Wte=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(e){if(e.options.overviewRulerOptions){for(let n of this._zones)if(n.color===e.options.overviewRulerOptions.color&&n.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(n,e.marker.line))return;if(this._lineAdjacentToZone(n,e.marker.line,e.options.overviewRulerOptions.position)){this._addLineToZone(n,e.marker.line);return}}if(this._zonePoolIndex<this._zonePool.length){this._zonePool[this._zonePoolIndex].color=e.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=e.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=e.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=e.marker.line,this._zones.push(this._zonePool[this._zonePoolIndex++]);return}this._zones.push({color:e.options.overviewRulerOptions.color,position:e.options.overviewRulerOptions.position,startBufferLine:e.marker.line,endBufferLine:e.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(e){this._linePadding=e}_lineIntersectsZone(e,n){return n>=e.startBufferLine&&n<=e.endBufferLine}_lineAdjacentToZone(e,n,r){return n>=e.startBufferLine-this._linePadding[r||"full"]&&n<=e.endBufferLine+this._linePadding[r||"full"]}_addLineToZone(e,n){e.startBufferLine=Math.min(e.startBufferLine,n),e.endBufferLine=Math.max(e.endBufferLine,n)}},_o={full:0,left:0,center:0,right:0},jc={full:0,left:0,center:0,right:0},Up={full:0,left:0,center:0,right:0},Fx=class extends ln{constructor(e,n,r,i,s,a,o,l){var d;super(),this._viewportElement=e,this._screenElement=n,this._bufferService=r,this._decorationService=i,this._renderService=s,this._optionsService=a,this._themeService=o,this._coreBrowserService=l,this._colorZoneStore=new Wte,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(),(d=this._viewportElement.parentElement)==null||d.insertBefore(this._canvas,this._viewportElement),this._register(br(()=>{var p;return(p=this._canvas)==null?void 0:p.remove()}));let u=this._canvas.getContext("2d");if(u)this._ctx=u;else throw new Error("Ctx cannot be null");this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),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())})),this._register(this._renderService.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange("overviewRuler",()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){var e;return((e=this._optionsService.options.overviewRuler)==null?void 0:e.width)||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),n=Math.ceil((this._canvas.width-1)/3);jc.full=this._canvas.width,jc.left=e,jc.center=n,jc.right=e,this._refreshDrawHeightConstants(),Up.full=1,Up.left=1,Up.center=1+jc.left,Up.right=1+jc.left+jc.center}_refreshDrawHeightConstants(){_o.full=Math.round(2*this._coreBrowserService.dpr);let e=this._canvas.height/this._bufferService.buffer.lines.length,n=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);_o.left=n,_o.center=n,_o.right=n}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*_o.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*_o.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*_o.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*_o.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(let n of this._decorationService.decorations)this._colorZoneStore.addDecoration(n);this._ctx.lineWidth=1,this._renderRulerOutline();let e=this._colorZoneStore.zones;for(let n of e)n.position!=="full"&&this._renderColorZone(n);for(let n of e)n.position==="full"&&this._renderColorZone(n);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.showBottomBorder&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(Up[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-_o[e.position||"full"]/2),jc[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+_o[e.position||"full"]))}_queueRefresh(e,n){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=n||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};Fx=Dr([At(2,ss),At(3,lv),At(4,Zl),At(5,as),At(6,Yf),At(7,Ql)],Fx);var nt;(e=>(e.NUL="\0",e.SOH="",e.STX="",e.ETX="",e.EOT="",e.ENQ="",e.ACK="",e.BEL="\x07",e.BS="\b",e.HT="	",e.LF=`
`,e.VT="\v",e.FF="\f",e.CR="\r",e.SO="",e.SI="",e.DLE="",e.DC1="",e.DC2="",e.DC3="",e.DC4="",e.NAK="",e.SYN="",e.ETB="",e.CAN="",e.EM="",e.SUB="",e.ESC="\x1B",e.FS="",e.GS="",e.RS="",e.US="",e.SP=" ",e.DEL=""))(nt||(nt={}));var ix;(e=>(e.PAD="",e.HOP="",e.BPH="",e.NBH="",e.IND="",e.NEL="",e.SSA="",e.ESA="",e.HTS="",e.HTJ="",e.VTS="",e.PLD="",e.PLU="",e.RI="",e.SS2="",e.SS3="",e.DCS="",e.PU1="",e.PU2="",e.STS="",e.CCH="",e.MW="",e.SPA="",e.EPA="",e.SOS="",e.SGCI="",e.SCI="",e.CSI="",e.ST="",e.OSC="",e.PM="",e.APC=""))(ix||(ix={}));var Sz;(e=>e.ST=`${nt.ESC}\\`)(Sz||(Sz={}));var MC=class{constructor(e,n,r,i,s,a){this._textarea=e,this._compositionView=n,this._bufferService=r,this._optionsService=i,this._coreService=s,this._renderService=a,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode===229?(this._handleAnyTextareaChanges(),!1):!0}_finalizeComposition(e){if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){let n={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let r;n.start+=this._dataAlreadySent.length,this._isComposing?r=this._textarea.value.substring(n.start,this._compositionPosition.start):r=this._textarea.value.substring(n.start),r.length>0&&this._coreService.triggerDataEvent(r,!0)}},0)}else{this._isSendingComposition=!1;let n=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(n,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let n=this._textarea.value,r=n.replace(e,"");this._dataAlreadySent=r,n.length>e.length?this._coreService.triggerDataEvent(r,!0):n.length<e.length?this._coreService.triggerDataEvent(`${nt.DEL}`,!0):n.length===e.length&&n!==e&&this._coreService.triggerDataEvent(n,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let n=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),r=this._renderService.dimensions.css.cell.height,i=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,s=n*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=s+"px",this._compositionView.style.top=i+"px",this._compositionView.style.height=r+"px",this._compositionView.style.lineHeight=r+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let a=this._compositionView.getBoundingClientRect();this._textarea.style.left=s+"px",this._textarea.style.top=i+"px",this._textarea.style.width=Math.max(a.width,1)+"px",this._textarea.style.height=Math.max(a.height,1)+"px",this._textarea.style.lineHeight=a.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};MC=Dr([At(2,ss),At(3,as),At(4,Dd),At(5,Zl)],MC);var ci=0,ui=0,di=0,Tr=0,bO={css:"#00000000",rgba:0},Yr;(e=>{function n(s,a,o,l){return l!==void 0?`#${zu(s)}${zu(a)}${zu(o)}${zu(l)}`:`#${zu(s)}${zu(a)}${zu(o)}`}e.toCss=n;function r(s,a,o,l=255){return(s<<24|a<<16|o<<8|l)>>>0}e.toRgba=r;function i(s,a,o,l){return{css:e.toCss(s,a,o,l),rgba:e.toRgba(s,a,o,l)}}e.toColor=i})(Yr||(Yr={}));var lr;(e=>{function n(u,d){if(Tr=(d.rgba&255)/255,Tr===1)return{css:d.css,rgba:d.rgba};let p=d.rgba>>24&255,f=d.rgba>>16&255,g=d.rgba>>8&255,_=u.rgba>>24&255,x=u.rgba>>16&255,v=u.rgba>>8&255;ci=_+Math.round((p-_)*Tr),ui=x+Math.round((f-x)*Tr),di=v+Math.round((g-v)*Tr);let S=Yr.toCss(ci,ui,di),w=Yr.toRgba(ci,ui,di);return{css:S,rgba:w}}e.blend=n;function r(u){return(u.rgba&255)===255}e.isOpaque=r;function i(u,d,p){let f=sx.ensureContrastRatio(u.rgba,d.rgba,p);if(f)return Yr.toColor(f>>24&255,f>>16&255,f>>8&255)}e.ensureContrastRatio=i;function s(u){let d=(u.rgba|255)>>>0;return[ci,ui,di]=sx.toChannels(d),{css:Yr.toCss(ci,ui,di),rgba:d}}e.opaque=s;function a(u,d){return Tr=Math.round(d*255),[ci,ui,di]=sx.toChannels(u.rgba),{css:Yr.toCss(ci,ui,di,Tr),rgba:Yr.toRgba(ci,ui,di,Tr)}}e.opacity=a;function o(u,d){return Tr=u.rgba&255,a(u,Tr*d/255)}e.multiplyOpacity=o;function l(u){return[u.rgba>>24&255,u.rgba>>16&255,u.rgba>>8&255]}e.toColorRGB=l})(lr||(lr={}));var Sr;(e=>{let n,r;try{let s=document.createElement("canvas");s.width=1,s.height=1;let a=s.getContext("2d",{willReadFrequently:!0});a&&(n=a,n.globalCompositeOperation="copy",r=n.createLinearGradient(0,0,1,1))}catch{}function i(s){if(s.match(/#[\da-f]{3,8}/i))switch(s.length){case 4:return ci=parseInt(s.slice(1,2).repeat(2),16),ui=parseInt(s.slice(2,3).repeat(2),16),di=parseInt(s.slice(3,4).repeat(2),16),Yr.toColor(ci,ui,di);case 5:return ci=parseInt(s.slice(1,2).repeat(2),16),ui=parseInt(s.slice(2,3).repeat(2),16),di=parseInt(s.slice(3,4).repeat(2),16),Tr=parseInt(s.slice(4,5).repeat(2),16),Yr.toColor(ci,ui,di,Tr);case 7:return{css:s,rgba:(parseInt(s.slice(1),16)<<8|255)>>>0};case 9:return{css:s,rgba:parseInt(s.slice(1),16)>>>0}}let a=s.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(a)return ci=parseInt(a[1]),ui=parseInt(a[2]),di=parseInt(a[3]),Tr=Math.round((a[5]===void 0?1:parseFloat(a[5]))*255),Yr.toColor(ci,ui,di,Tr);if(!n||!r)throw new Error("css.toColor: Unsupported css format");if(n.fillStyle=r,n.fillStyle=s,typeof n.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(n.fillRect(0,0,1,1),[ci,ui,di,Tr]=n.getImageData(0,0,1,1).data,Tr!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Yr.toRgba(ci,ui,di,Tr),css:s}}e.toColor=i})(Sr||(Sr={}));var Gi;(e=>{function n(i){return r(i>>16&255,i>>8&255,i&255)}e.relativeLuminance=n;function r(i,s,a){let o=i/255,l=s/255,u=a/255,d=o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4),p=l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4),f=u<=.03928?u/12.92:Math.pow((u+.055)/1.055,2.4);return d*.2126+p*.7152+f*.0722}e.relativeLuminance2=r})(Gi||(Gi={}));var sx;(e=>{function n(o,l){if(Tr=(l&255)/255,Tr===1)return l;let u=l>>24&255,d=l>>16&255,p=l>>8&255,f=o>>24&255,g=o>>16&255,_=o>>8&255;return ci=f+Math.round((u-f)*Tr),ui=g+Math.round((d-g)*Tr),di=_+Math.round((p-_)*Tr),Yr.toRgba(ci,ui,di)}e.blend=n;function r(o,l,u){let d=Gi.relativeLuminance(o>>8),p=Gi.relativeLuminance(l>>8);if(kl(d,p)<u){if(p<d){let _=i(o,l,u),x=kl(d,Gi.relativeLuminance(_>>8));if(x<u){let v=s(o,l,u),S=kl(d,Gi.relativeLuminance(v>>8));return x>S?_:v}return _}let f=s(o,l,u),g=kl(d,Gi.relativeLuminance(f>>8));if(g<u){let _=i(o,l,u),x=kl(d,Gi.relativeLuminance(_>>8));return g>x?f:_}return f}}e.ensureContrastRatio=r;function i(o,l,u){let d=o>>24&255,p=o>>16&255,f=o>>8&255,g=l>>24&255,_=l>>16&255,x=l>>8&255,v=kl(Gi.relativeLuminance2(g,_,x),Gi.relativeLuminance2(d,p,f));for(;v<u&&(g>0||_>0||x>0);)g-=Math.max(0,Math.ceil(g*.1)),_-=Math.max(0,Math.ceil(_*.1)),x-=Math.max(0,Math.ceil(x*.1)),v=kl(Gi.relativeLuminance2(g,_,x),Gi.relativeLuminance2(d,p,f));return(g<<24|_<<16|x<<8|255)>>>0}e.reduceLuminance=i;function s(o,l,u){let d=o>>24&255,p=o>>16&255,f=o>>8&255,g=l>>24&255,_=l>>16&255,x=l>>8&255,v=kl(Gi.relativeLuminance2(g,_,x),Gi.relativeLuminance2(d,p,f));for(;v<u&&(g<255||_<255||x<255);)g=Math.min(255,g+Math.ceil((255-g)*.1)),_=Math.min(255,_+Math.ceil((255-_)*.1)),x=Math.min(255,x+Math.ceil((255-x)*.1)),v=kl(Gi.relativeLuminance2(g,_,x),Gi.relativeLuminance2(d,p,f));return(g<<24|_<<16|x<<8|255)>>>0}e.increaseLuminance=s;function a(o){return[o>>24&255,o>>16&255,o>>8&255,o&255]}e.toChannels=a})(sx||(sx={}));function zu(e){let n=e.toString(16);return n.length<2?"0"+n:n}function kl(e,n){return e<n?(n+.05)/(e+.05):(e+.05)/(n+.05)}var qte=class extends ov{constructor(e,n,r){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=n,this._width=r}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Hx=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new ja}register(e){let n={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(n),n.id}deregister(e){for(let n=0;n<this._characterJoiners.length;n++)if(this._characterJoiners[n].id===e)return this._characterJoiners.splice(n,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let n=this._bufferService.buffer.lines.get(e);if(!n||n.length===0)return[];let r=[],i=n.translateToString(!0),s=0,a=0,o=0,l=n.getFg(0),u=n.getBg(0);for(let d=0;d<n.getTrimmedLength();d++)if(n.loadCell(d,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==l||this._workCell.bg!==u){if(d-s>1){let p=this._getJoinedRanges(i,o,a,n,s);for(let f=0;f<p.length;f++)r.push(p[f])}s=d,o=a,l=this._workCell.fg,u=this._workCell.bg}a+=this._workCell.getChars().length||Vc.length}if(this._bufferService.cols-s>1){let d=this._getJoinedRanges(i,o,a,n,s);for(let p=0;p<d.length;p++)r.push(d[p])}return r}_getJoinedRanges(e,n,r,i,s){let a=e.substring(n,r),o=[];try{o=this._characterJoiners[0].handler(a)}catch(l){console.error(l)}for(let l=1;l<this._characterJoiners.length;l++)try{let u=this._characterJoiners[l].handler(a);for(let d=0;d<u.length;d++)Hx._mergeRanges(o,u[d])}catch(u){console.error(u)}return this._stringRangesToCellRanges(o,i,s),o}_stringRangesToCellRanges(e,n,r){let i=0,s=!1,a=0,o=e[i];if(o){for(let l=r;l<this._bufferService.cols;l++){let u=n.getWidth(l),d=n.getString(l).length||Vc.length;if(u!==0){if(!s&&o[0]<=a&&(o[0]=l,s=!0),o[1]<=a){if(o[1]=l,o=e[++i],!o)break;o[0]<=a?(o[0]=l,s=!0):s=!1}a+=d}}o&&(o[1]=this._bufferService.cols)}}static _mergeRanges(e,n){let r=!1;for(let i=0;i<e.length;i++){let s=e[i];if(r){if(n[1]<=s[0])return e[i-1][1]=n[1],e;if(n[1]<=s[1])return e[i-1][1]=Math.max(n[1],s[1]),e.splice(i,1),e;e.splice(i,1),i--}else{if(n[1]<=s[0])return e.splice(i,0,n),e;if(n[1]<=s[1])return s[0]=Math.min(n[0],s[0]),e;n[0]<s[1]&&(s[0]=Math.min(n[0],s[0]),r=!0);continue}}return r?e[e.length-1][1]=n[1]:e.push(n),e}};Hx=Dr([At(0,ss)],Hx);function Ute(e){return 57508<=e&&e<=57558}function Vte(e){return 9472<=e&&e<=9631}function Kte(e){return Ute(e)||Vte(e)}function Yte(){return{css:{canvas:Uy(),cell:Uy()},device:{canvas:Uy(),cell:Uy(),char:{width:0,height:0,left:0,top:0}}}}function Uy(){return{width:0,height:0}}var RC=class{constructor(e,n,r,i,s,a,o){this._document=e,this._characterJoinerService=n,this._optionsService=r,this._coreBrowserService=i,this._coreService=s,this._decorationService=a,this._themeService=o,this._workCell=new ja,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,n,r){this._selectionStart=e,this._selectionEnd=n,this._columnSelectMode=r}createRow(e,n,r,i,s,a,o,l,u,d,p){let f=[],g=this._characterJoinerService.getJoinedCharacters(n),_=this._themeService.colors,x=e.getNoBgTrimmedLength();r&&x<a+1&&(x=a+1);let v,S=0,w="",N=0,C=0,T=0,A=0,E=!1,D=0,F=!1,B=0,H=0,$=[],z=d!==-1&&p!==-1;for(let W=0;W<x;W++){e.loadCell(W,this._workCell);let P=this._workCell.getWidth();if(P===0)continue;let q=!1,I=W>=H,Q=W,K=this._workCell;if(g.length>0&&W===g[0][0]&&I){let J=g.shift(),me=this._isCellInSelection(J[0],n);for(N=J[0]+1;N<J[1];N++)I&&(I=me===this._isCellInSelection(N,n));I&&(I=!r||a<J[0]||a>=J[1]),I?(q=!0,K=new qte(this._workCell,e.translateToString(!0,J[0],J[1]),J[1]-J[0]),Q=J[1]-1,P=K.getWidth()):H=J[1]}let Z=this._isCellInSelection(W,n),Y=r&&W===a,R=z&&W>=d&&W<=p,U=!1;this._decorationService.forEachDecorationAtCell(W,n,void 0,J=>{U=!0});let V=K.getChars()||Vc;if(V===" "&&(K.isUnderline()||K.isOverline())&&(V=" "),B=P*l-u.get(V,K.isBold(),K.isItalic()),!v)v=this._document.createElement("span");else if(S&&(Z&&F||!Z&&!F&&K.bg===C)&&(Z&&F&&_.selectionForeground||K.fg===T)&&K.extended.ext===A&&R===E&&B===D&&!Y&&!q&&!U&&I){K.isInvisible()?w+=Vc:w+=V,S++;continue}else S&&(v.textContent=w),v=this._document.createElement("span"),S=0,w="";if(C=K.bg,T=K.fg,A=K.extended.ext,E=R,D=B,F=Z,q&&a>=W&&a<=Q&&(a=W),!this._coreService.isCursorHidden&&Y&&this._coreService.isCursorInitialized){if($.push("xterm-cursor"),this._coreBrowserService.isFocused)o&&$.push("xterm-cursor-blink"),$.push(i==="bar"?"xterm-cursor-bar":i==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(s)switch(s){case"outline":$.push("xterm-cursor-outline");break;case"block":$.push("xterm-cursor-block");break;case"bar":$.push("xterm-cursor-bar");break;case"underline":$.push("xterm-cursor-underline");break}}if(K.isBold()&&$.push("xterm-bold"),K.isItalic()&&$.push("xterm-italic"),K.isDim()&&$.push("xterm-dim"),K.isInvisible()?w=Vc:w=K.getChars()||Vc,K.isUnderline()&&($.push(`xterm-underline-${K.extended.underlineStyle}`),w===" "&&(w=" "),!K.isUnderlineColorDefault()))if(K.isUnderlineColorRGB())v.style.textDecorationColor=`rgb(${ov.toColorRGB(K.getUnderlineColor()).join(",")})`;else{let J=K.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&K.isBold()&&J<8&&(J+=8),v.style.textDecorationColor=_.ansi[J].css}K.isOverline()&&($.push("xterm-overline"),w===" "&&(w=" ")),K.isStrikethrough()&&$.push("xterm-strikethrough"),R&&(v.style.textDecoration="underline");let ie=K.getFgColor(),te=K.getFgColorMode(),X=K.getBgColor(),se=K.getBgColorMode(),re=!!K.isInverse();if(re){let J=ie;ie=X,X=J;let me=te;te=se,se=me}let de,ue,ae=!1;this._decorationService.forEachDecorationAtCell(W,n,void 0,J=>{J.options.layer!=="top"&&ae||(J.backgroundColorRGB&&(se=50331648,X=J.backgroundColorRGB.rgba>>8&16777215,de=J.backgroundColorRGB),J.foregroundColorRGB&&(te=50331648,ie=J.foregroundColorRGB.rgba>>8&16777215,ue=J.foregroundColorRGB),ae=J.options.layer==="top")}),!ae&&Z&&(de=this._coreBrowserService.isFocused?_.selectionBackgroundOpaque:_.selectionInactiveBackgroundOpaque,X=de.rgba>>8&16777215,se=50331648,ae=!0,_.selectionForeground&&(te=50331648,ie=_.selectionForeground.rgba>>8&16777215,ue=_.selectionForeground)),ae&&$.push("xterm-decoration-top");let pe;switch(se){case 16777216:case 33554432:pe=_.ansi[X],$.push(`xterm-bg-${X}`);break;case 50331648:pe=Yr.toColor(X>>16,X>>8&255,X&255),this._addStyle(v,`background-color:#${kO((X>>>0).toString(16),"0",6)}`);break;case 0:default:re?(pe=_.foreground,$.push("xterm-bg-257")):pe=_.background}switch(de||K.isDim()&&(de=lr.multiplyOpacity(pe,.5)),te){case 16777216:case 33554432:K.isBold()&&ie<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(ie+=8),this._applyMinimumContrast(v,pe,_.ansi[ie],K,de,void 0)||$.push(`xterm-fg-${ie}`);break;case 50331648:let J=Yr.toColor(ie>>16&255,ie>>8&255,ie&255);this._applyMinimumContrast(v,pe,J,K,de,ue)||this._addStyle(v,`color:#${kO(ie.toString(16),"0",6)}`);break;case 0:default:this._applyMinimumContrast(v,pe,_.foreground,K,de,ue)||re&&$.push("xterm-fg-257")}$.length&&(v.className=$.join(" "),$.length=0),!Y&&!q&&!U&&I?S++:v.textContent=w,B!==this.defaultSpacing&&(v.style.letterSpacing=`${B}px`),f.push(v),W=Q}return v&&S&&(v.textContent=w),f}_applyMinimumContrast(e,n,r,i,s,a){if(this._optionsService.rawOptions.minimumContrastRatio===1||Kte(i.getCode()))return!1;let o=this._getContrastCache(i),l;if(!s&&!a&&(l=o.getColor(n.rgba,r.rgba)),l===void 0){let u=this._optionsService.rawOptions.minimumContrastRatio/(i.isDim()?2:1);l=lr.ensureContrastRatio(s||n,a||r,u),o.setColor((s||n).rgba,(a||r).rgba,l??null)}return l?(this._addStyle(e,`color:${l.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,n){e.setAttribute("style",`${e.getAttribute("style")||""}${n};`)}_isCellInSelection(e,n){let r=this._selectionStart,i=this._selectionEnd;return!r||!i?!1:this._columnSelectMode?r[0]<=i[0]?e>=r[0]&&n>=r[1]&&e<i[0]&&n<=i[1]:e<r[0]&&n>=r[1]&&e>=i[0]&&n<=i[1]:n>r[1]&&n<i[1]||r[1]===i[1]&&n===r[1]&&e>=r[0]&&e<i[0]||r[1]<i[1]&&n===i[1]&&e<i[0]||r[1]<i[1]&&n===r[1]&&e>=r[0]}};RC=Dr([At(1,az),At(2,as),At(3,Ql),At(4,Dd),At(5,lv),At(6,Yf)],RC);function kO(e,n,r){for(;e.length<r;)e=n+e;return e}var Gte=class{constructor(e,n){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=e.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";let r=e.createElement("span");r.classList.add("xterm-char-measure-element");let i=e.createElement("span");i.classList.add("xterm-char-measure-element"),i.style.fontWeight="bold";let s=e.createElement("span");s.classList.add("xterm-char-measure-element"),s.style.fontStyle="italic";let a=e.createElement("span");a.classList.add("xterm-char-measure-element"),a.style.fontWeight="bold",a.style.fontStyle="italic",this._measureElements=[r,i,s,a],this._container.appendChild(r),this._container.appendChild(i),this._container.appendChild(s),this._container.appendChild(a),n.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(e,n,r,i){e===this._font&&n===this._fontSize&&r===this._weight&&i===this._weightBold||(this._font=e,this._fontSize=n,this._weight=r,this._weightBold=i,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${r}`,this._measureElements[1].style.fontWeight=`${i}`,this._measureElements[2].style.fontWeight=`${r}`,this._measureElements[3].style.fontWeight=`${i}`,this.clear())}get(e,n,r){let i=0;if(!n&&!r&&e.length===1&&(i=e.charCodeAt(0))<256){if(this._flat[i]!==-9999)return this._flat[i];let o=this._measure(e,0);return o>0&&(this._flat[i]=o),o}let s=e;n&&(s+="B"),r&&(s+="I");let a=this._holey.get(s);if(a===void 0){let o=0;n&&(o|=1),r&&(o|=2),a=this._measure(e,o),a>0&&this._holey.set(s,a)}return a}_measure(e,n){let r=this._measureElements[n];return r.textContent=e.repeat(32),r.offsetWidth/32}},Xte=class{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(e,n,r,i=!1){if(this.selectionStart=n,this.selectionEnd=r,!n||!r||n[0]===r[0]&&n[1]===r[1]){this.clear();return}let s=e.buffers.active.ydisp,a=n[1]-s,o=r[1]-s,l=Math.max(a,0),u=Math.min(o,e.rows-1);if(l>=e.rows||u<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=i,this.viewportStartRow=a,this.viewportEndRow=o,this.viewportCappedStartRow=l,this.viewportCappedEndRow=u,this.startCol=n[0],this.endCol=r[0]}isCellSelected(e,n,r){return this.hasSelection?(r-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?n>=this.startCol&&r>=this.viewportCappedStartRow&&n<this.endCol&&r<=this.viewportCappedEndRow:n<this.startCol&&r>=this.viewportCappedStartRow&&n>=this.endCol&&r<=this.viewportCappedEndRow:r>this.viewportStartRow&&r<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&r===this.viewportStartRow&&n>=this.startCol&&n<this.endCol||this.viewportStartRow<this.viewportEndRow&&r===this.viewportEndRow&&n<this.endCol||this.viewportStartRow<this.viewportEndRow&&r===this.viewportStartRow&&n>=this.startCol):!1}};function Qte(){return new Xte}var Cw="xterm-dom-renderer-owner-",fa="xterm-rows",Vy="xterm-fg-",wO="xterm-bg-",Vp="xterm-focus",Ky="xterm-selection",Zte=1,OC=class extends ln{constructor(e,n,r,i,s,a,o,l,u,d,p,f,g,_){super(),this._terminal=e,this._document=n,this._element=r,this._screenElement=i,this._viewportElement=s,this._helperContainer=a,this._linkifier2=o,this._charSizeService=u,this._optionsService=d,this._bufferService=p,this._coreService=f,this._coreBrowserService=g,this._themeService=_,this._terminalClass=Zte++,this._rowElements=[],this._selectionRenderModel=Qte(),this.onRequestRedraw=this._register(new gt).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(fa),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(Ky),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=Yte(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(x=>this._injectCss(x))),this._injectCss(this._themeService.colors),this._rowFactory=l.createInstance(RC,document),this._element.classList.add(Cw+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(x=>this._handleLinkHover(x))),this._register(this._linkifier2.onHideLinkUnderline(x=>this._handleLinkLeave(x))),this._register(br(()=>{this._element.classList.remove(Cw+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new Gte(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(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),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/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),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(let r of this._rowElements)r.style.width=`${this.dimensions.css.canvas.width}px`,r.style.height=`${this.dimensions.css.cell.height}px`,r.style.lineHeight=`${this.dimensions.css.cell.height}px`,r.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let n=`${this._terminalSelector} .${fa} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=n,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(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let n=`${this._terminalSelector} .${fa} { pointer-events: none; color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;n+=`${this._terminalSelector} .${fa} .xterm-dim { color: ${lr.multiplyOpacity(e.foreground,.5).css};}`,n+=`${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;}`;let r=`blink_underline_${this._terminalClass}`,i=`blink_bar_${this._terminalClass}`,s=`blink_block_${this._terminalClass}`;n+=`@keyframes ${r} { 50% {  border-bottom-style: hidden; }}`,n+=`@keyframes ${i} { 50% {  box-shadow: none; }}`,n+=`@keyframes ${s} { 0% {  background-color: ${e.cursor.css};  color: ${e.cursorAccent.css}; } 50% {  background-color: inherit;  color: ${e.cursor.css}; }}`,n+=`${this._terminalSelector} .${fa}.${Vp} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${fa}.${Vp} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${fa}.${Vp} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${s} 1s step-end infinite;}${this._terminalSelector} .${fa} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${fa} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${fa} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${fa} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${fa} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,n+=`${this._terminalSelector} .${Ky} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${Ky} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${Ky} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[a,o]of e.ansi.entries())n+=`${this._terminalSelector} .${Vy}${a} { color: ${o.css}; }${this._terminalSelector} .${Vy}${a}.xterm-dim { color: ${lr.multiplyOpacity(o,.5).css}; }${this._terminalSelector} .${wO}${a} { background-color: ${o.css}; }`;n+=`${this._terminalSelector} .${Vy}257 { color: ${lr.opaque(e.background).css}; }${this._terminalSelector} .${Vy}257.xterm-dim { color: ${lr.multiplyOpacity(lr.opaque(e.background),.5).css}; }${this._terminalSelector} .${wO}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=n}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,n){for(let r=this._rowElements.length;r<=n;r++){let i=this._document.createElement("div");this._rowContainer.appendChild(i),this._rowElements.push(i)}for(;this._rowElements.length>n;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,n){this._refreshRowElements(e,n),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(Vp),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(Vp),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,n,r){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,n,r),this.renderRows(0,this._bufferService.rows-1),!e||!n||(this._selectionRenderModel.update(this._terminal,e,n,r),!this._selectionRenderModel.hasSelection))return;let i=this._selectionRenderModel.viewportStartRow,s=this._selectionRenderModel.viewportEndRow,a=this._selectionRenderModel.viewportCappedStartRow,o=this._selectionRenderModel.viewportCappedEndRow,l=this._document.createDocumentFragment();if(r){let u=e[0]>n[0];l.appendChild(this._createSelectionElement(a,u?n[0]:e[0],u?e[0]:n[0],o-a+1))}else{let u=i===a?e[0]:0,d=a===s?n[0]:this._bufferService.cols;l.appendChild(this._createSelectionElement(a,u,d));let p=o-a-1;if(l.appendChild(this._createSelectionElement(a+1,0,this._bufferService.cols,p)),a!==o){let f=s===o?n[0]:this._bufferService.cols;l.appendChild(this._createSelectionElement(o,0,f))}}this._selectionContainer.appendChild(l)}_createSelectionElement(e,n,r,i=1){let s=this._document.createElement("div"),a=n*this.dimensions.css.cell.width,o=this.dimensions.css.cell.width*(r-n);return a+o>this.dimensions.css.canvas.width&&(o=this.dimensions.css.canvas.width-a),s.style.height=`${i*this.dimensions.css.cell.height}px`,s.style.top=`${e*this.dimensions.css.cell.height}px`,s.style.left=`${a}px`,s.style.width=`${o}px`,s}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(let e of this._rowElements)e.replaceChildren()}renderRows(e,n){let r=this._bufferService.buffer,i=r.ybase+r.y,s=Math.min(r.x,this._bufferService.cols-1),a=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,o=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,l=this._optionsService.rawOptions.cursorInactiveStyle;for(let u=e;u<=n;u++){let d=u+r.ydisp,p=this._rowElements[u],f=r.lines.get(d);if(!p||!f)break;p.replaceChildren(...this._rowFactory.createRow(f,d,d===i,o,l,s,a,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${Cw}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,n,r,i,s,a){r<0&&(e=0),i<0&&(n=0);let o=this._bufferService.rows-1;r=Math.max(Math.min(r,o),0),i=Math.max(Math.min(i,o),0),s=Math.min(s,this._bufferService.cols);let l=this._bufferService.buffer,u=l.ybase+l.y,d=Math.min(l.x,s-1),p=this._optionsService.rawOptions.cursorBlink,f=this._optionsService.rawOptions.cursorStyle,g=this._optionsService.rawOptions.cursorInactiveStyle;for(let _=r;_<=i;++_){let x=_+l.ydisp,v=this._rowElements[_],S=l.lines.get(x);if(!v||!S)break;v.replaceChildren(...this._rowFactory.createRow(S,x,x===u,f,g,d,p,this.dimensions.css.cell.width,this._widthCache,a?_===r?e:0:-1,a?(_===i?n:s)-1:-1))}}};OC=Dr([At(7,bE),At(8,d0),At(9,as),At(10,ss),At(11,Dd),At(12,Ql),At(13,Yf)],OC);var DC=class extends ln{constructor(e,n,r){super(),this._optionsService=r,this.width=0,this.height=0,this._onCharSizeChange=this._register(new gt),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new ene(this._optionsService))}catch{this._measureStrategy=this._register(new Jte(e,n,this._optionsService))}this._register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}get hasValidSize(){return this.width>0&&this.height>0}measure(){let e=this._measureStrategy.measure();(e.width!==this.width||e.height!==this.height)&&(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};DC=Dr([At(2,as)],DC);var Cz=class extends ln{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,n){e!==void 0&&e>0&&n!==void 0&&n>0&&(this._result.width=e,this._result.height=n)}},Jte=class extends Cz{constructor(e,n,r){super(),this._document=e,this._parentElement=n,this._optionsService=r,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}},ene=class extends Cz{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let n=this._ctx.measureText("W");if(!("width"in n&&"fontBoundingBoxAscent"in n&&"fontBoundingBoxDescent"in n))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let e=this._ctx.measureText("W");return this._validateAndSet(e.width,e.fontBoundingBoxAscent+e.fontBoundingBoxDescent),this._result}},tne=class extends ln{constructor(e,n,r){super(),this._textarea=e,this._window=n,this.mainDocument=r,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new nne(this._window)),this._onDprChange=this._register(new gt),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new gt),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(i=>this._screenDprMonitor.setWindow(i))),this._register(Ei.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(Xt(this._textarea,"focus",()=>this._isFocused=!0)),this._register(Xt(this._textarea,"blur",()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,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}},nne=class extends ln{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new bf),this._onDprChange=this._register(new gt),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(br(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=Xt(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var e;this._outerListener&&((e=this._resolutionMediaMatchList)==null||e.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)}},rne=class extends ln{constructor(){super(),this.linkProviders=[],this._register(br(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let n=this.linkProviders.indexOf(e);n!==-1&&this.linkProviders.splice(n,1)}}}};function AE(e,n,r){let i=r.getBoundingClientRect(),s=e.getComputedStyle(r),a=parseInt(s.getPropertyValue("padding-left")),o=parseInt(s.getPropertyValue("padding-top"));return[n.clientX-i.left-a,n.clientY-i.top-o]}function ine(e,n,r,i,s,a,o,l,u){if(!a)return;let d=AE(e,n,r);if(d)return d[0]=Math.ceil((d[0]+(u?o/2:0))/o),d[1]=Math.ceil(d[1]/l),d[0]=Math.min(Math.max(d[0],1),i+(u?1:0)),d[1]=Math.min(Math.max(d[1],1),s),d}var PC=class{constructor(e,n){this._renderService=e,this._charSizeService=n}getCoords(e,n,r,i,s){return ine(window,e,n,r,i,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,s)}getMouseReportCoords(e,n){let r=AE(window,e,n);if(this._charSizeService.hasValidSize)return r[0]=Math.min(Math.max(r[0],0),this._renderService.dimensions.css.canvas.width-1),r[1]=Math.min(Math.max(r[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(r[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(r[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(r[0]),y:Math.floor(r[1])}}};PC=Dr([At(0,Zl),At(1,d0)],PC);var sne=class{constructor(e,n){this._renderCallback=e,this._coreBrowserService=n,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(e,n,r){this._rowCount=r,e=e!==void 0?e:0,n=n!==void 0?n:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,n):n,!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){this._runRefreshCallbacks();return}let e=Math.max(this._rowStart,0),n=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,n),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},jz={};mee(jz,{getSafariVersion:()=>one,isChromeOS:()=>Tz,isFirefox:()=>Nz,isIpad:()=>lne,isIphone:()=>cne,isLegacyEdge:()=>ane,isLinux:()=>TE,isMac:()=>Wx,isNode:()=>h0,isSafari:()=>Ez,isWindows:()=>Az});var h0=typeof process<"u"&&"title"in process,cv=h0?"node":navigator.userAgent,uv=h0?"node":navigator.platform,Nz=cv.includes("Firefox"),ane=cv.includes("Edge"),Ez=/^((?!chrome|android).)*safari/i.test(cv);function one(){if(!Ez)return 0;let e=cv.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var Wx=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(uv),lne=uv==="iPad",cne=uv==="iPhone",Az=["Windows","Win16","Win32","WinCE"].includes(uv),TE=uv.indexOf("Linux")>=0,Tz=/\bCrOS\b/.test(cv),Mz=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(e){this._idleCallback=void 0;let n=0,r=0,i=e.timeRemaining(),s=0;for(;this._i<this._tasks.length;){if(n=performance.now(),this._tasks[this._i]()||this._i++,n=Math.max(1,performance.now()-n),r=Math.max(n,r),s=e.timeRemaining(),r*1.5>s){i-n<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(i-n))}ms`),this._start();return}i=s}this.clear()}},une=class extends Mz{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let n=performance.now()+e;return{timeRemaining:()=>Math.max(0,n-performance.now())}}},dne=class extends Mz{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},qx=!h0&&"requestIdleCallback"in window?dne:une,hne=class{constructor(){this._queue=new qx}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},LC=class extends ln{constructor(e,n,r,i,s,a,o,l,u){super(),this._rowCount=e,this._optionsService=r,this._charSizeService=i,this._coreService=s,this._coreBrowserService=l,this._renderer=this._register(new bf),this._pausedResizeTask=new hne,this._observerDisposable=this._register(new bf),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 gt),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new gt),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new gt),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new gt),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new sne((d,p)=>this._renderRows(d,p),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new fne(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(br(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(o.onResize(()=>this._fullRefresh())),this._register(o.buffers.onBufferActivate(()=>{var d;return(d=this._renderer.value)==null?void 0:d.clear()})),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(a.onDecorationRegistered(()=>this._fullRefresh())),this._register(a.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(o.cols,o.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(o.buffer.y,o.buffer.y,!0))),this._register(u.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,n),this._register(this._coreBrowserService.onWindowChange(d=>this._registerIntersectionObserver(d,n)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,n){if("IntersectionObserver"in e){let r=new e.IntersectionObserver(i=>this._handleIntersectionChange(i[i.length-1]),{threshold:0});r.observe(n),this._observerDisposable.value=br(()=>r.disconnect())}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.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(e,n,r=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,n);return}let i=this._syncOutputHandler.flush();i&&(e=Math.min(e,i.start),n=Math.max(n,i.end)),r||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,n,this._rowCount)}_renderRows(e,n){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,n);return}e=Math.min(e,this._rowCount-1),n=Math.min(n,this._rowCount-1),this._renderer.value.renderRows(e,n),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:n}),this._onRender.fire({start:e,end:n}),this._isNextRenderRedrawOnly=!0}}resize(e,n){this._rowCount=n,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(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(n=>this.refreshRows(n.start,n.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var e,n;this._renderer.value&&((n=(e=this._renderer.value).clearTextureAtlas)==null||n.call(e),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,n){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>{var r;return(r=this._renderer.value)==null?void 0:r.handleResize(e,n)}):this._renderer.value.handleResize(e,n),this._fullRefresh())}handleCharSizeChanged(){var e;(e=this._renderer.value)==null||e.handleCharSizeChanged()}handleBlur(){var e;(e=this._renderer.value)==null||e.handleBlur()}handleFocus(){var e;(e=this._renderer.value)==null||e.handleFocus()}handleSelectionChanged(e,n,r){var i;this._selectionState.start=e,this._selectionState.end=n,this._selectionState.columnSelectMode=r,(i=this._renderer.value)==null||i.handleSelectionChanged(e,n,r)}handleCursorMove(){var e;(e=this._renderer.value)==null||e.handleCursorMove()}clear(){var e;(e=this._renderer.value)==null||e.clear()}};LC=Dr([At(2,as),At(3,d0),At(4,Dd),At(5,lv),At(6,ss),At(7,Ql),At(8,Yf)],LC);var fne=class{constructor(e,n,r){this._coreBrowserService=e,this._coreService=n,this._onTimeout=r,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(e,n){this._isBuffering?(this._start=Math.min(this._start,e),this._end=Math.max(this._end,n)):(this._start=e,this._end=n,this._isBuffering=!0),this._timeout===void 0&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let e={start:this._start,end:this._end};return this._isBuffering=!1,e}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function pne(e,n,r,i){let s=r.buffer.x,a=r.buffer.y;if(!r.buffer.hasScrollback)return vne(s,a,e,n,r,i)+f0(a,n,r,i)+yne(s,a,e,n,r,i);let o;if(a===n)return o=s>e?"D":"C",mg(Math.abs(s-e),pg(o,i));o=a>n?"D":"C";let l=Math.abs(a-n),u=gne(a>n?e:s,r)+(l-1)*r.cols+1+mne(a>n?s:e);return mg(u,pg(o,i))}function mne(e,n){return e-1}function gne(e,n){return n.cols-e}function vne(e,n,r,i,s,a){return f0(n,i,s,a).length===0?"":mg(Oz(e,n,e,n-kd(n,s),!1,s).length,pg("D",a))}function f0(e,n,r,i){let s=e-kd(e,r),a=n-kd(n,r),o=Math.abs(s-a)-_ne(e,n,r);return mg(o,pg(Rz(e,n),i))}function yne(e,n,r,i,s,a){let o;f0(n,i,s,a).length>0?o=i-kd(i,s):o=n;let l=i,u=xne(e,n,r,i,s,a);return mg(Oz(e,o,r,l,u==="C",s).length,pg(u,a))}function _ne(e,n,r){var o;let i=0,s=e-kd(e,r),a=n-kd(n,r);for(let l=0;l<Math.abs(s-a);l++){let u=Rz(e,n)==="A"?-1:1;(o=r.buffer.lines.get(s+u*l))!=null&&o.isWrapped&&i++}return i}function kd(e,n){let r=0,i=n.buffer.lines.get(e),s=i==null?void 0:i.isWrapped;for(;s&&e>=0&&e<n.rows;)r++,i=n.buffer.lines.get(--e),s=i==null?void 0:i.isWrapped;return r}function xne(e,n,r,i,s,a){let o;return f0(r,i,s,a).length>0?o=i-kd(i,s):o=n,e<r&&o<=i||e>=r&&o<i?"C":"D"}function Rz(e,n){return e>n?"A":"B"}function Oz(e,n,r,i,s,a){let o=e,l=n,u="";for(;(o!==r||l!==i)&&l>=0&&l<a.buffer.lines.length;)o+=s?1:-1,s&&o>a.cols-1?(u+=a.buffer.translateBufferLineToString(l,!1,e,o),o=0,e=0,l++):!s&&o<0&&(u+=a.buffer.translateBufferLineToString(l,!1,0,e+1),o=a.cols-1,e=o,l--);return u+a.buffer.translateBufferLineToString(l,!1,e,o)}function pg(e,n){let r=n?"O":"[";return nt.ESC+r+e}function mg(e,n){e=Math.floor(e);let r="";for(let i=0;i<e;i++)r+=n;return r}var bne=class{constructor(e){this._bufferService=e,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.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()){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?e%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)-1]:[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[Math.max(e,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let e=this.selectionStart,n=this.selectionEnd;return!e||!n?!1:e[1]>n[1]||e[1]===n[1]&&e[0]>n[0]}handleTrim(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function SO(e,n){if(e.start.y>e.end.y)throw new Error(`Buffer range end (${e.end.x}, ${e.end.y}) cannot be before start (${e.start.x}, ${e.start.y})`);return n*(e.end.y-e.start.y)+(e.end.x-e.start.x+1)}var jw=50,kne=15,wne=50,Sne=500,Cne=" ",jne=new RegExp(Cne,"g"),IC=class extends ln{constructor(e,n,r,i,s,a,o,l,u){super(),this._element=e,this._screenElement=n,this._linkifier=r,this._bufferService=i,this._coreService=s,this._mouseService=a,this._optionsService=o,this._renderService=l,this._coreBrowserService=u,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new ja,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new gt),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new gt),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new gt),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new gt),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=d=>this._handleMouseMove(d),this._mouseUpListener=d=>this._handleMouseUp(d),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(d=>this._handleTrim(d)),this._register(this._bufferService.buffers.onBufferActivate(d=>this._handleBufferActivate(d))),this.enable(),this._model=new bne(this._bufferService),this._activeSelectionMode=0,this._register(br(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(d=>{d.rowsChanged&&this.clearSelection()}))}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(){let e=this._model.finalSelectionStart,n=this._model.finalSelectionEnd;return!e||!n?!1:e[0]!==n[0]||e[1]!==n[1]}get selectionText(){let e=this._model.finalSelectionStart,n=this._model.finalSelectionEnd;if(!e||!n)return"";let r=this._bufferService.buffer,i=[];if(this._activeSelectionMode===3){if(e[0]===n[0])return"";let s=e[0]<n[0]?e[0]:n[0],a=e[0]<n[0]?n[0]:e[0];for(let o=e[1];o<=n[1];o++){let l=r.translateBufferLineToString(o,!0,s,a);i.push(l)}}else{let s=e[1]===n[1]?n[0]:void 0;i.push(r.translateBufferLineToString(e[1],!0,e[0],s));for(let a=e[1]+1;a<=n[1]-1;a++){let o=r.lines.get(a),l=r.translateBufferLineToString(a,!0);o!=null&&o.isWrapped?i[i.length-1]+=l:i.push(l)}if(e[1]!==n[1]){let a=r.lines.get(n[1]),o=r.translateBufferLineToString(n[1],!0,0,n[0]);a&&a.isWrapped?i[i.length-1]+=o:i.push(o)}}return i.map(s=>s.replace(jne," ")).join(Az?`\r
`:`
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),TE&&e&&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(e){let n=this._getMouseBufferCoords(e),r=this._model.finalSelectionStart,i=this._model.finalSelectionEnd;return!r||!i||!n?!1:this._areCoordsInSelection(n,r,i)}isCellInSelection(e,n){let r=this._model.finalSelectionStart,i=this._model.finalSelectionEnd;return!r||!i?!1:this._areCoordsInSelection([e,n],r,i)}_areCoordsInSelection(e,n,r){return e[1]>n[1]&&e[1]<r[1]||n[1]===r[1]&&e[1]===n[1]&&e[0]>=n[0]&&e[0]<r[0]||n[1]<r[1]&&e[1]===r[1]&&e[0]<r[0]||n[1]<r[1]&&e[1]===n[1]&&e[0]>=n[0]}_selectWordAtCursor(e,n){var s,a;let r=(a=(s=this._linkifier.currentLink)==null?void 0:s.link)==null?void 0:a.range;if(r)return this._model.selectionStart=[r.start.x-1,r.start.y-1],this._model.selectionStartLength=SO(r,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let i=this._getMouseBufferCoords(e);return i?(this._selectWordAt(i,n),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,n){this._model.clearSelection(),e=Math.max(e,0),n=Math.min(n,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,n],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let n=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(n)return n[0]--,n[1]--,n[1]+=this._bufferService.buffer.ydisp,n}_getMouseEventScrollAmount(e){let n=AE(this._coreBrowserService.window,e,this._screenElement)[1],r=this._renderService.dimensions.css.canvas.height;return n>=0&&n<=r?0:(n>r&&(n-=r),n=Math.min(Math.max(n,-jw),jw),n/=jw,n/Math.abs(n)+Math.round(n*(kne-1)))}shouldForceSelection(e){return Wx?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,!(e.button===2&&this.hasSelection)&&e.button===0){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):e.detail===1?this._handleSingleClick(e):e.detail===2?this._handleDoubleClick(e):e.detail===3&&this._handleTripleClick(e),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(),wne)}_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(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let n=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);n&&n.length!==this._model.selectionStart[0]&&n.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let n=this._getMouseBufferCoords(e);n&&(this._activeSelectionMode=2,this._selectLineAt(n[1]))}shouldColumnSelect(e){return e.altKey&&!(Wx&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let n=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(!0);return}this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let r=this._bufferService.buffer;if(this._model.selectionEnd[1]<r.lines.length){let i=r.lines.get(this._model.selectionEnd[1]);i&&i.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}(!n||n[0]!==this._model.selectionEnd[0]||n[1]!==this._model.selectionEnd[1])&&this.refresh(!0)}_dragScroll(){if(!(!this._model.selectionEnd||!this._model.selectionStart)&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});let e=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let n=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&n<Sne&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let r=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(r&&r[0]!==void 0&&r[1]!==void 0){let i=pne(r[0]-1,r[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(i,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,n=this._model.finalSelectionEnd,r=!!e&&!!n&&(e[0]!==n[0]||e[1]!==n[1]);if(!r){this._oldHasSelection&&this._fireOnSelectionChange(e,n,r);return}!e||!n||(!this._oldSelectionStart||!this._oldSelectionEnd||e[0]!==this._oldSelectionStart[0]||e[1]!==this._oldSelectionStart[1]||n[0]!==this._oldSelectionEnd[0]||n[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(e,n,r)}_fireOnSelectionChange(e,n,r){this._oldSelectionStart=e,this._oldSelectionEnd=n,this._oldHasSelection=r,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(n=>this._handleTrim(n))}_convertViewportColToCharacterIndex(e,n){let r=n;for(let i=0;n>=i;i++){let s=e.loadCell(i,this._workCell).getChars().length;this._workCell.getWidth()===0?r--:s>1&&n!==i&&(r+=s-1)}return r}setSelection(e,n,r){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,n],this._model.selectionStartLength=r,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,n,r=!0,i=!0){if(e[0]>=this._bufferService.cols)return;let s=this._bufferService.buffer,a=s.lines.get(e[1]);if(!a)return;let o=s.translateBufferLineToString(e[1],!1),l=this._convertViewportColToCharacterIndex(a,e[0]),u=l,d=e[0]-l,p=0,f=0,g=0,_=0;if(o.charAt(l)===" "){for(;l>0&&o.charAt(l-1)===" ";)l--;for(;u<o.length&&o.charAt(u+1)===" ";)u++}else{let S=e[0],w=e[0];a.getWidth(S)===0&&(p++,S--),a.getWidth(w)===2&&(f++,w++);let N=a.getString(w).length;for(N>1&&(_+=N-1,u+=N-1);S>0&&l>0&&!this._isCharWordSeparator(a.loadCell(S-1,this._workCell));){a.loadCell(S-1,this._workCell);let C=this._workCell.getChars().length;this._workCell.getWidth()===0?(p++,S--):C>1&&(g+=C-1,l-=C-1),l--,S--}for(;w<a.length&&u+1<o.length&&!this._isCharWordSeparator(a.loadCell(w+1,this._workCell));){a.loadCell(w+1,this._workCell);let C=this._workCell.getChars().length;this._workCell.getWidth()===2?(f++,w++):C>1&&(_+=C-1,u+=C-1),u++,w++}}u++;let x=l+d-p+g,v=Math.min(this._bufferService.cols,u-l+p+f-g-_);if(!(!n&&o.slice(l,u).trim()==="")){if(r&&x===0&&a.getCodePoint(0)!==32){let S=s.lines.get(e[1]-1);if(S&&a.isWrapped&&S.getCodePoint(this._bufferService.cols-1)!==32){let w=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(w){let N=this._bufferService.cols-w.start;x-=N,v+=N}}}if(i&&x+v===this._bufferService.cols&&a.getCodePoint(this._bufferService.cols-1)!==32){let S=s.lines.get(e[1]+1);if(S!=null&&S.isWrapped&&S.getCodePoint(0)!==32){let w=this._getWordAt([0,e[1]+1],!1,!1,!0);w&&(v+=w.length)}}return{start:x,length:v}}}_selectWordAt(e,n){let r=this._getWordAt(e,n);if(r){for(;r.start<0;)r.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[r.start,e[1]],this._model.selectionStartLength=r.length}}_selectToWordAt(e){let n=this._getWordAt(e,!0);if(n){let r=e[1];for(;n.start<0;)n.start+=this._bufferService.cols,r--;if(!this._model.areSelectionValuesReversed())for(;n.start+n.length>this._bufferService.cols;)n.length-=this._bufferService.cols,r++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?n.start:n.start+n.length,r]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let n=this._bufferService.buffer.getWrappedRangeForLine(e),r={start:{x:0,y:n.first},end:{x:this._bufferService.cols-1,y:n.last}};this._model.selectionStart=[0,n.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=SO(r,this._bufferService.cols)}};IC=Dr([At(3,ss),At(4,Dd),At(5,kE),At(6,as),At(7,Zl),At(8,Ql)],IC);var CO=class{constructor(){this._data={}}set(e,n,r){this._data[e]||(this._data[e]={}),this._data[e][n]=r}get(e,n){return this._data[e]?this._data[e][n]:void 0}clear(){this._data={}}},jO=class{constructor(){this._color=new CO,this._css=new CO}setCss(e,n,r){this._css.set(e,n,r)}getCss(e,n){return this._css.get(e,n)}setColor(e,n,r){this._color.set(e,n,r)}getColor(e,n){return this._color.get(e,n)}clear(){this._color.clear(),this._css.clear()}},ei=Object.freeze((()=>{let e=[Sr.toColor("#2e3436"),Sr.toColor("#cc0000"),Sr.toColor("#4e9a06"),Sr.toColor("#c4a000"),Sr.toColor("#3465a4"),Sr.toColor("#75507b"),Sr.toColor("#06989a"),Sr.toColor("#d3d7cf"),Sr.toColor("#555753"),Sr.toColor("#ef2929"),Sr.toColor("#8ae234"),Sr.toColor("#fce94f"),Sr.toColor("#729fcf"),Sr.toColor("#ad7fa8"),Sr.toColor("#34e2e2"),Sr.toColor("#eeeeec")],n=[0,95,135,175,215,255];for(let r=0;r<216;r++){let i=n[r/36%6|0],s=n[r/6%6|0],a=n[r%6];e.push({css:Yr.toCss(i,s,a),rgba:Yr.toRgba(i,s,a)})}for(let r=0;r<24;r++){let i=8+r*10;e.push({css:Yr.toCss(i,i,i),rgba:Yr.toRgba(i,i,i)})}return e})()),Ku=Sr.toColor("#ffffff"),jm=Sr.toColor("#000000"),NO=Sr.toColor("#ffffff"),EO=jm,Kp={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},Nne=Ku,BC=class extends ln{constructor(e){super(),this._optionsService=e,this._contrastCache=new jO,this._halfContrastCache=new jO,this._onChangeColors=this._register(new gt),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:Ku,background:jm,cursor:NO,cursorAccent:EO,selectionForeground:void 0,selectionBackgroundTransparent:Kp,selectionBackgroundOpaque:lr.blend(jm,Kp),selectionInactiveBackgroundTransparent:Kp,selectionInactiveBackgroundOpaque:lr.blend(jm,Kp),scrollbarSliderBackground:lr.opacity(Ku,.2),scrollbarSliderHoverBackground:lr.opacity(Ku,.4),scrollbarSliderActiveBackground:lr.opacity(Ku,.5),overviewRulerBorder:Ku,ansi:ei.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)))}get colors(){return this._colors}_setTheme(e={}){let n=this._colors;if(n.foreground=qn(e.foreground,Ku),n.background=qn(e.background,jm),n.cursor=lr.blend(n.background,qn(e.cursor,NO)),n.cursorAccent=lr.blend(n.background,qn(e.cursorAccent,EO)),n.selectionBackgroundTransparent=qn(e.selectionBackground,Kp),n.selectionBackgroundOpaque=lr.blend(n.background,n.selectionBackgroundTransparent),n.selectionInactiveBackgroundTransparent=qn(e.selectionInactiveBackground,n.selectionBackgroundTransparent),n.selectionInactiveBackgroundOpaque=lr.blend(n.background,n.selectionInactiveBackgroundTransparent),n.selectionForeground=e.selectionForeground?qn(e.selectionForeground,bO):void 0,n.selectionForeground===bO&&(n.selectionForeground=void 0),lr.isOpaque(n.selectionBackgroundTransparent)&&(n.selectionBackgroundTransparent=lr.opacity(n.selectionBackgroundTransparent,.3)),lr.isOpaque(n.selectionInactiveBackgroundTransparent)&&(n.selectionInactiveBackgroundTransparent=lr.opacity(n.selectionInactiveBackgroundTransparent,.3)),n.scrollbarSliderBackground=qn(e.scrollbarSliderBackground,lr.opacity(n.foreground,.2)),n.scrollbarSliderHoverBackground=qn(e.scrollbarSliderHoverBackground,lr.opacity(n.foreground,.4)),n.scrollbarSliderActiveBackground=qn(e.scrollbarSliderActiveBackground,lr.opacity(n.foreground,.5)),n.overviewRulerBorder=qn(e.overviewRulerBorder,Nne),n.ansi=ei.slice(),n.ansi[0]=qn(e.black,ei[0]),n.ansi[1]=qn(e.red,ei[1]),n.ansi[2]=qn(e.green,ei[2]),n.ansi[3]=qn(e.yellow,ei[3]),n.ansi[4]=qn(e.blue,ei[4]),n.ansi[5]=qn(e.magenta,ei[5]),n.ansi[6]=qn(e.cyan,ei[6]),n.ansi[7]=qn(e.white,ei[7]),n.ansi[8]=qn(e.brightBlack,ei[8]),n.ansi[9]=qn(e.brightRed,ei[9]),n.ansi[10]=qn(e.brightGreen,ei[10]),n.ansi[11]=qn(e.brightYellow,ei[11]),n.ansi[12]=qn(e.brightBlue,ei[12]),n.ansi[13]=qn(e.brightMagenta,ei[13]),n.ansi[14]=qn(e.brightCyan,ei[14]),n.ansi[15]=qn(e.brightWhite,ei[15]),e.extendedAnsi){let r=Math.min(n.ansi.length-16,e.extendedAnsi.length);for(let i=0;i<r;i++)n.ansi[i+16]=qn(e.extendedAnsi[i],ei[i+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(e){this._restoreColor(e),this._onChangeColors.fire(this.colors)}_restoreColor(e){if(e===void 0){for(let n=0;n<this._restoreColors.ansi.length;++n)this._colors.ansi[n]=this._restoreColors.ansi[n];return}switch(e){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[e]=this._restoreColors.ansi[e]}}modifyColors(e){e(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};BC=Dr([At(0,as)],BC);function qn(e,n){if(e!==void 0)try{return Sr.toColor(e)}catch{}return n}var Ene=class{constructor(...e){this._entries=new Map;for(let[n,r]of e)this.set(n,r)}set(e,n){let r=this._entries.get(e);return this._entries.set(e,n),r}forEach(e){for(let[n,r]of this._entries.entries())e(n,r)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},Ane=class{constructor(){this._services=new Ene,this._services.set(bE,this)}setService(e,n){this._services.set(e,n)}getService(e){return this._services.get(e)}createInstance(e,...n){let r=kee(e).sort((a,o)=>a.index-o.index),i=[];for(let a of r){let o=this._services.get(a.id);if(!o)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${a.id._id}.`);i.push(o)}let s=r.length>0?r[0].index:n.length;if(n.length!==s)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${s+1} conflicts with ${n.length} static arguments`);return new e(...n,...i)}},Tne={trace:0,debug:1,info:2,warn:3,error:4,off:5},Mne="xterm.js: ",zC=class extends ln{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=Tne[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let n=0;n<e.length;n++)typeof e[n]=="function"&&(e[n]=e[n]())}_log(e,n,r){this._evalLazyOptionalParams(r),e.call(console,(this._optionsService.options.logger?"":Mne)+n,...r)}trace(e,...n){var r;this._logLevel<=0&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.trace.bind(this._optionsService.options.logger))??console.log,e,n)}debug(e,...n){var r;this._logLevel<=1&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.debug.bind(this._optionsService.options.logger))??console.log,e,n)}info(e,...n){var r;this._logLevel<=2&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.info.bind(this._optionsService.options.logger))??console.info,e,n)}warn(e,...n){var r;this._logLevel<=3&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.warn.bind(this._optionsService.options.logger))??console.warn,e,n)}error(e,...n){var r;this._logLevel<=4&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.error.bind(this._optionsService.options.logger))??console.error,e,n)}};zC=Dr([At(0,as)],zC);var AO=class extends ln{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new gt),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new gt),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new gt),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let n=new Array(e);for(let r=0;r<Math.min(e,this.length);r++)n[r]=this._array[this._getCyclicIndex(r)];this._array=n,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let n=this._length;n<e;n++)this._array[n]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,n){this._array[this._getCyclicIndex(e)]=n}push(e){this._array[this._getCyclicIndex(this._length)]=e,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(e,n,...r){if(n){for(let i=e;i<this._length-n;i++)this._array[this._getCyclicIndex(i)]=this._array[this._getCyclicIndex(i+n)];this._length-=n,this.onDeleteEmitter.fire({index:e,amount:n})}for(let i=this._length-1;i>=e;i--)this._array[this._getCyclicIndex(i+r.length)]=this._array[this._getCyclicIndex(i)];for(let i=0;i<r.length;i++)this._array[this._getCyclicIndex(e+i)]=r[i];if(r.length&&this.onInsertEmitter.fire({index:e,amount:r.length}),this._length+r.length>this._maxLength){let i=this._length+r.length-this._maxLength;this._startIndex+=i,this._length=this._maxLength,this.onTrimEmitter.fire(i)}else this._length+=r.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,n,r){if(!(n<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+r<0)throw new Error("Cannot shift elements in list beyond index 0");if(r>0){for(let s=n-1;s>=0;s--)this.set(e+s+r,this.get(e+s));let i=e+n+r-this._length;if(i>0)for(this._length+=i;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let i=0;i<n;i++)this.set(e+i+r,this.get(e+i))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},an=3,Kr=Object.freeze(new ov),Yy=0,Nw=2,Nm=class Dz{constructor(n,r,i=!1){this.isWrapped=i,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(n*an);let s=r||ja.fromCharData([0,JB,1,0]);for(let a=0;a<n;++a)this.setCell(a,s);this.length=n}get(n){let r=this._data[n*an+0],i=r&2097151;return[this._data[n*an+1],r&2097152?this._combined[n]:i?Ic(i):"",r>>22,r&2097152?this._combined[n].charCodeAt(this._combined[n].length-1):i]}set(n,r){this._data[n*an+1]=r[0],r[1].length>1?(this._combined[n]=r[1],this._data[n*an+0]=n|2097152|r[2]<<22):this._data[n*an+0]=r[1].charCodeAt(0)|r[2]<<22}getWidth(n){return this._data[n*an+0]>>22}hasWidth(n){return this._data[n*an+0]&12582912}getFg(n){return this._data[n*an+1]}getBg(n){return this._data[n*an+2]}hasContent(n){return this._data[n*an+0]&4194303}getCodePoint(n){let r=this._data[n*an+0];return r&2097152?this._combined[n].charCodeAt(this._combined[n].length-1):r&2097151}isCombined(n){return this._data[n*an+0]&2097152}getString(n){let r=this._data[n*an+0];return r&2097152?this._combined[n]:r&2097151?Ic(r&2097151):""}isProtected(n){return this._data[n*an+2]&536870912}loadCell(n,r){return Yy=n*an,r.content=this._data[Yy+0],r.fg=this._data[Yy+1],r.bg=this._data[Yy+2],r.content&2097152&&(r.combinedData=this._combined[n]),r.bg&268435456&&(r.extended=this._extendedAttrs[n]),r}setCell(n,r){r.content&2097152&&(this._combined[n]=r.combinedData),r.bg&268435456&&(this._extendedAttrs[n]=r.extended),this._data[n*an+0]=r.content,this._data[n*an+1]=r.fg,this._data[n*an+2]=r.bg}setCellFromCodepoint(n,r,i,s){s.bg&268435456&&(this._extendedAttrs[n]=s.extended),this._data[n*an+0]=r|i<<22,this._data[n*an+1]=s.fg,this._data[n*an+2]=s.bg}addCodepointToCell(n,r,i){let s=this._data[n*an+0];s&2097152?this._combined[n]+=Ic(r):s&2097151?(this._combined[n]=Ic(s&2097151)+Ic(r),s&=-2097152,s|=2097152):s=r|1<<22,i&&(s&=-12582913,s|=i<<22),this._data[n*an+0]=s}insertCells(n,r,i){if(n%=this.length,n&&this.getWidth(n-1)===2&&this.setCellFromCodepoint(n-1,0,1,i),r<this.length-n){let s=new ja;for(let a=this.length-n-r-1;a>=0;--a)this.setCell(n+r+a,this.loadCell(n+a,s));for(let a=0;a<r;++a)this.setCell(n+a,i)}else for(let s=n;s<this.length;++s)this.setCell(s,i);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,i)}deleteCells(n,r,i){if(n%=this.length,r<this.length-n){let s=new ja;for(let a=0;a<this.length-n-r;++a)this.setCell(n+a,this.loadCell(n+r+a,s));for(let a=this.length-r;a<this.length;++a)this.setCell(a,i)}else for(let s=n;s<this.length;++s)this.setCell(s,i);n&&this.getWidth(n-1)===2&&this.setCellFromCodepoint(n-1,0,1,i),this.getWidth(n)===0&&!this.hasContent(n)&&this.setCellFromCodepoint(n,0,1,i)}replaceCells(n,r,i,s=!1){if(s){for(n&&this.getWidth(n-1)===2&&!this.isProtected(n-1)&&this.setCellFromCodepoint(n-1,0,1,i),r<this.length&&this.getWidth(r-1)===2&&!this.isProtected(r)&&this.setCellFromCodepoint(r,0,1,i);n<r&&n<this.length;)this.isProtected(n)||this.setCell(n,i),n++;return}for(n&&this.getWidth(n-1)===2&&this.setCellFromCodepoint(n-1,0,1,i),r<this.length&&this.getWidth(r-1)===2&&this.setCellFromCodepoint(r,0,1,i);n<r&&n<this.length;)this.setCell(n++,i)}resize(n,r){if(n===this.length)return this._data.length*4*Nw<this._data.buffer.byteLength;let i=n*an;if(n>this.length){if(this._data.buffer.byteLength>=i*4)this._data=new Uint32Array(this._data.buffer,0,i);else{let s=new Uint32Array(i);s.set(this._data),this._data=s}for(let s=this.length;s<n;++s)this.setCell(s,r)}else{this._data=this._data.subarray(0,i);let s=Object.keys(this._combined);for(let o=0;o<s.length;o++){let l=parseInt(s[o],10);l>=n&&delete this._combined[l]}let a=Object.keys(this._extendedAttrs);for(let o=0;o<a.length;o++){let l=parseInt(a[o],10);l>=n&&delete this._extendedAttrs[l]}}return this.length=n,i*4*Nw<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*Nw<this._data.buffer.byteLength){let n=new Uint32Array(this._data.length);return n.set(this._data),this._data=n,1}return 0}fill(n,r=!1){if(r){for(let i=0;i<this.length;++i)this.isProtected(i)||this.setCell(i,n);return}this._combined={},this._extendedAttrs={};for(let i=0;i<this.length;++i)this.setCell(i,n)}copyFrom(n){this.length!==n.length?this._data=new Uint32Array(n._data):this._data.set(n._data),this.length=n.length,this._combined={};for(let r in n._combined)this._combined[r]=n._combined[r];this._extendedAttrs={};for(let r in n._extendedAttrs)this._extendedAttrs[r]=n._extendedAttrs[r];this.isWrapped=n.isWrapped}clone(){let n=new Dz(0);n._data=new Uint32Array(this._data),n.length=this.length;for(let r in this._combined)n._combined[r]=this._combined[r];for(let r in this._extendedAttrs)n._extendedAttrs[r]=this._extendedAttrs[r];return n.isWrapped=this.isWrapped,n}getTrimmedLength(){for(let n=this.length-1;n>=0;--n)if(this._data[n*an+0]&4194303)return n+(this._data[n*an+0]>>22);return 0}getNoBgTrimmedLength(){for(let n=this.length-1;n>=0;--n)if(this._data[n*an+0]&4194303||this._data[n*an+2]&50331648)return n+(this._data[n*an+0]>>22);return 0}copyCellsFrom(n,r,i,s,a){let o=n._data;if(a)for(let u=s-1;u>=0;u--){for(let d=0;d<an;d++)this._data[(i+u)*an+d]=o[(r+u)*an+d];o[(r+u)*an+2]&268435456&&(this._extendedAttrs[i+u]=n._extendedAttrs[r+u])}else for(let u=0;u<s;u++){for(let d=0;d<an;d++)this._data[(i+u)*an+d]=o[(r+u)*an+d];o[(r+u)*an+2]&268435456&&(this._extendedAttrs[i+u]=n._extendedAttrs[r+u])}let l=Object.keys(n._combined);for(let u=0;u<l.length;u++){let d=parseInt(l[u],10);d>=r&&(this._combined[d-r+i]=n._combined[d])}}translateToString(n,r,i,s){r=r??0,i=i??this.length,n&&(i=Math.min(i,this.getTrimmedLength())),s&&(s.length=0);let a="";for(;r<i;){let o=this._data[r*an+0],l=o&2097151,u=o&2097152?this._combined[r]:l?Ic(l):Vc;if(a+=u,s)for(let d=0;d<u.length;++d)s.push(r);r+=o>>22||1}return s&&s.push(r),a}};function Rne(e,n,r,i,s,a){let o=[];for(let l=0;l<e.length-1;l++){let u=l,d=e.get(++u);if(!d.isWrapped)continue;let p=[e.get(l)];for(;u<e.length&&d.isWrapped;)p.push(d),d=e.get(++u);if(!a&&i>=l&&i<u){l+=p.length-1;continue}let f=0,g=gg(p,f,n),_=1,x=0;for(;_<p.length;){let S=gg(p,_,n),w=S-x,N=r-g,C=Math.min(w,N);p[f].copyCellsFrom(p[_],x,g,C,!1),g+=C,g===r&&(f++,g=0),x+=C,x===S&&(_++,x=0),g===0&&f!==0&&p[f-1].getWidth(r-1)===2&&(p[f].copyCellsFrom(p[f-1],r-1,g++,1,!1),p[f-1].setCell(r-1,s))}p[f].replaceCells(g,r,s);let v=0;for(let S=p.length-1;S>0&&(S>f||p[S].getTrimmedLength()===0);S--)v++;v>0&&(o.push(l+p.length-v),o.push(v)),l+=p.length-1}return o}function One(e,n){let r=[],i=0,s=n[i],a=0;for(let o=0;o<e.length;o++)if(s===o){let l=n[++i];e.onDeleteEmitter.fire({index:o-a,amount:l}),o+=l-1,a+=l,s=n[++i]}else r.push(o);return{layout:r,countRemoved:a}}function Dne(e,n){let r=[];for(let i=0;i<n.length;i++)r.push(e.get(n[i]));for(let i=0;i<r.length;i++)e.set(i,r[i]);e.length=n.length}function Pne(e,n,r){let i=[],s=e.map((u,d)=>gg(e,d,n)).reduce((u,d)=>u+d),a=0,o=0,l=0;for(;l<s;){if(s-l<r){i.push(s-l);break}a+=r;let u=gg(e,o,n);a>u&&(a-=u,o++);let d=e[o].getWidth(a-1)===2;d&&a--;let p=d?r-1:r;i.push(p),l+=p}return i}function gg(e,n,r){if(n===e.length-1)return e[n].getTrimmedLength();let i=!e[n].hasContent(r-1)&&e[n].getWidth(r-1)===1,s=e[n+1].getWidth(0)===2;return i&&s?r-1:r}var Pz=class Lz{constructor(n){this.line=n,this.isDisposed=!1,this._disposables=[],this._id=Lz._nextId++,this._onDispose=this.register(new gt),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),bd(this._disposables),this._disposables.length=0)}register(n){return this._disposables.push(n),n}};Pz._nextId=1;var Lne=Pz,ii={},Yu=ii.B;ii[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:"≥","{":"π","|":"≠","}":"£","~":"·"};ii.A={"#":"£"};ii.B=void 0;ii[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};ii.C=ii[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};ii.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};ii.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};ii.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};ii.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};ii.E=ii[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};ii.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};ii.H=ii[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};ii["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var TO=4294967295,MO=class{constructor(e,n,r){this._hasScrollback=e,this._optionsService=n,this._bufferService=r,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=Kr.clone(),this.savedCharset=Yu,this.markers=[],this._nullCell=ja.fromCharData([0,JB,1,0]),this._whitespaceCell=ja.fromCharData([0,Vc,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new qx,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new AO(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new $x),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new $x),this._whitespaceCell}getBlankLine(e,n){return new Nm(this._bufferService.cols,this.getNullCell(e),n)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&e<this._rows}_getCorrectBufferLength(e){if(!this._hasScrollback)return e;let n=e+this._optionsService.rawOptions.scrollback;return n>TO?TO:n}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=Kr);let n=this._rows;for(;n--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new AO(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,n){let r=this.getNullCell(Kr),i=0,s=this._getCorrectBufferLength(n);if(s>this.lines.maxLength&&(this.lines.maxLength=s),this.lines.length>0){if(this._cols<e)for(let o=0;o<this.lines.length;o++)i+=+this.lines.get(o).resize(e,r);let a=0;if(this._rows<n)for(let o=this._rows;o<n;o++)this.lines.length<n+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new Nm(e,r)):this.ybase>0&&this.lines.length<=this.ybase+this.y+a+1?(this.ybase--,a++,this.ydisp>0&&this.ydisp--):this.lines.push(new Nm(e,r)));else for(let o=this._rows;o>n;o--)this.lines.length>n+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(s<this.lines.maxLength){let o=this.lines.length-s;o>0&&(this.lines.trimStart(o),this.ybase=Math.max(this.ybase-o,0),this.ydisp=Math.max(this.ydisp-o,0),this.savedY=Math.max(this.savedY-o,0)),this.lines.maxLength=s}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,n-1),a&&(this.y+=a),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=n-1,this._isReflowEnabled&&(this._reflow(e,n),this._cols>e))for(let a=0;a<this.lines.length;a++)i+=+this.lines.get(a).resize(e,r);this._cols=e,this._rows=n,this._memoryCleanupQueue.clear(),i>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let n=0;for(;this._memoryCleanupPosition<this.lines.length;)if(n+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),n>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend==="conpty"&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,n){this._cols!==e&&(e>this._cols?this._reflowLarger(e,n):this._reflowSmaller(e,n))}_reflowLarger(e,n){let r=this._optionsService.rawOptions.reflowCursorLine,i=Rne(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(Kr),r);if(i.length>0){let s=One(this.lines,i);Dne(this.lines,s.layout),this._reflowLargerAdjustViewport(e,n,s.countRemoved)}}_reflowLargerAdjustViewport(e,n,r){let i=this.getNullCell(Kr),s=r;for(;s-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<n&&this.lines.push(new Nm(e,i))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-r,0)}_reflowSmaller(e,n){let r=this._optionsService.rawOptions.reflowCursorLine,i=this.getNullCell(Kr),s=[],a=0;for(let o=this.lines.length-1;o>=0;o--){let l=this.lines.get(o);if(!l||!l.isWrapped&&l.getTrimmedLength()<=e)continue;let u=[l];for(;l.isWrapped&&o>0;)l=this.lines.get(--o),u.unshift(l);if(!r){let C=this.ybase+this.y;if(C>=o&&C<o+u.length)continue}let d=u[u.length-1].getTrimmedLength(),p=Pne(u,this._cols,e),f=p.length-u.length,g;this.ybase===0&&this.y!==this.lines.length-1?g=Math.max(0,this.y-this.lines.maxLength+f):g=Math.max(0,this.lines.length-this.lines.maxLength+f);let _=[];for(let C=0;C<f;C++){let T=this.getBlankLine(Kr,!0);_.push(T)}_.length>0&&(s.push({start:o+u.length+a,newLines:_}),a+=_.length),u.push(..._);let x=p.length-1,v=p[x];v===0&&(x--,v=p[x]);let S=u.length-f-1,w=d;for(;S>=0;){let C=Math.min(w,v);if(u[x]===void 0)break;if(u[x].copyCellsFrom(u[S],w-C,v-C,C,!0),v-=C,v===0&&(x--,v=p[x]),w-=C,w===0){S--;let T=Math.max(S,0);w=gg(u,T,this._cols)}}for(let C=0;C<u.length;C++)p[C]<e&&u[C].setCell(p[C],i);let N=f-g;for(;N-- >0;)this.ybase===0?this.y<n-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+a)-n&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+f,this.ybase+n-1)}if(s.length>0){let o=[],l=[];for(let v=0;v<this.lines.length;v++)l.push(this.lines.get(v));let u=this.lines.length,d=u-1,p=0,f=s[p];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+a);let g=0;for(let v=Math.min(this.lines.maxLength-1,u+a-1);v>=0;v--)if(f&&f.start>d+g){for(let S=f.newLines.length-1;S>=0;S--)this.lines.set(v--,f.newLines[S]);v++,o.push({index:d+1,amount:f.newLines.length}),g+=f.newLines.length,f=s[++p]}else this.lines.set(v,l[d--]);let _=0;for(let v=o.length-1;v>=0;v--)o[v].index+=_,this.lines.onInsertEmitter.fire(o[v]),_+=o[v].amount;let x=Math.max(0,u+a-this.lines.maxLength);x>0&&this.lines.onTrimEmitter.fire(x)}}translateBufferLineToString(e,n,r=0,i){let s=this.lines.get(e);return s?s.translateToString(n,r,i):""}getWrappedRangeForLine(e){let n=e,r=e;for(;n>0&&this.lines.get(n).isWrapped;)n--;for(;r+1<this.lines.length&&this.lines.get(r+1).isWrapped;)r++;return{first:n,last:r}}setupTabStops(e){for(e!=null?this.tabs[e]||(e=this.prevStop(e)):(this.tabs={},e=0);e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e==null&&(e=this.x);!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e==null&&(e=this.x);!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let n=0;n<this.markers.length;n++)this.markers[n].line===e&&(this.markers[n].dispose(),this.markers.splice(n--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose();this.markers.length=0,this._isClearing=!1}addMarker(e){let n=new Lne(e);return this.markers.push(n),n.register(this.lines.onTrim(r=>{n.line-=r,n.line<0&&n.dispose()})),n.register(this.lines.onInsert(r=>{n.line>=r.index&&(n.line+=r.amount)})),n.register(this.lines.onDelete(r=>{n.line>=r.index&&n.line<r.index+r.amount&&n.dispose(),n.line>r.index&&(n.line-=r.amount)})),n.register(n.onDispose(()=>this._removeMarker(n))),n}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},Ine=class extends ln{constructor(e,n){super(),this._optionsService=e,this._bufferService=n,this._onBufferActivate=this._register(new gt),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 MO(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new MO(!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(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),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(e,n){this._normal.resize(e,n),this._alt.resize(e,n),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}},Iz=2,Bz=1,$C=class extends ln{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new gt),this.onResize=this._onResize.event,this._onScroll=this._register(new gt),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,Iz),this.rows=Math.max(e.rawOptions.rows||0,Bz),this.buffers=this._register(new Ine(e,this)),this._register(this.buffers.onBufferActivate(n=>{this._onScroll.fire(n.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,n){let r=this.cols!==e,i=this.rows!==n;this.cols=e,this.rows=n,this.buffers.resize(e,n),this._onResize.fire({cols:e,rows:n,colsChanged:r,rowsChanged:i})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,n=!1){let r=this.buffer,i;i=this._cachedBlankLine,(!i||i.length!==this.cols||i.getFg(0)!==e.fg||i.getBg(0)!==e.bg)&&(i=r.getBlankLine(e,n),this._cachedBlankLine=i),i.isWrapped=n;let s=r.ybase+r.scrollTop,a=r.ybase+r.scrollBottom;if(r.scrollTop===0){let o=r.lines.isFull;a===r.lines.length-1?o?r.lines.recycle().copyFrom(i):r.lines.push(i.clone()):r.lines.splice(a+1,0,i.clone()),o?this.isUserScrolling&&(r.ydisp=Math.max(r.ydisp-1,0)):(r.ybase++,this.isUserScrolling||r.ydisp++)}else{let o=a-s+1;r.lines.shiftElements(s+1,o-1,-1),r.lines.set(a,i.clone())}this.isUserScrolling||(r.ydisp=r.ybase),this._onScroll.fire(r.ydisp)}scrollLines(e,n){let r=this.buffer;if(e<0){if(r.ydisp===0)return;this.isUserScrolling=!0}else e+r.ydisp>=r.ybase&&(this.isUserScrolling=!1);let i=r.ydisp;r.ydisp=Math.max(Math.min(r.ydisp+e,r.ybase),0),i!==r.ydisp&&(n||this._onScroll.fire(r.ydisp))}};$C=Dr([At(0,as)],$C);var _h={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnEraseInDisplay:!1,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},reflowCursorLine:!1,rescaleOverlappingGlyphs:!1,rightClickSelectsWord:Wx,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},Bne=["normal","bold","100","200","300","400","500","600","700","800","900"],zne=class extends ln{constructor(e){super(),this._onOptionChange=this._register(new gt),this.onOptionChange=this._onOptionChange.event;let n={..._h};for(let r in e)if(r in n)try{let i=e[r];n[r]=this._sanitizeAndValidateOption(r,i)}catch(i){console.error(i)}this.rawOptions=n,this.options={...n},this._setupOptions(),this._register(br(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,n){return this.onOptionChange(r=>{r===e&&n(this.rawOptions[e])})}onMultipleOptionChange(e,n){return this.onOptionChange(r=>{e.indexOf(r)!==-1&&n()})}_setupOptions(){let e=r=>{if(!(r in _h))throw new Error(`No option with key "${r}"`);return this.rawOptions[r]},n=(r,i)=>{if(!(r in _h))throw new Error(`No option with key "${r}"`);i=this._sanitizeAndValidateOption(r,i),this.rawOptions[r]!==i&&(this.rawOptions[r]=i,this._onOptionChange.fire(r))};for(let r in this.rawOptions){let i={get:e.bind(this,r),set:n.bind(this,r)};Object.defineProperty(this.options,r,i)}}_sanitizeAndValidateOption(e,n){switch(e){case"cursorStyle":if(n||(n=_h[e]),!$ne(n))throw new Error(`"${n}" is not a valid value for ${e}`);break;case"wordSeparator":n||(n=_h[e]);break;case"fontWeight":case"fontWeightBold":if(typeof n=="number"&&1<=n&&n<=1e3)break;n=Bne.includes(n)?n:_h[e];break;case"cursorWidth":n=Math.floor(n);case"lineHeight":case"tabStopWidth":if(n<1)throw new Error(`${e} cannot be less than 1, value: ${n}`);break;case"minimumContrastRatio":n=Math.max(1,Math.min(21,Math.round(n*10)/10));break;case"scrollback":if(n=Math.min(n,4294967295),n<0)throw new Error(`${e} cannot be less than 0, value: ${n}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(n<=0)throw new Error(`${e} cannot be less than or equal to 0, value: ${n}`);break;case"rows":case"cols":if(!n&&n!==0)throw new Error(`${e} must be numeric, value: ${n}`);break;case"windowsPty":n=n??{};break}return n}};function $ne(e){return e==="block"||e==="underline"||e==="bar"}function Em(e,n=5){if(typeof e!="object")return e;let r=Array.isArray(e)?[]:{};for(let i in e)r[i]=n<=1?e[i]:e[i]&&Em(e[i],n-1);return r}var RO=Object.freeze({insertMode:!1}),OO=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),FC=class extends ln{constructor(e,n,r){super(),this._bufferService=e,this._logService=n,this._optionsService=r,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new gt),this.onData=this._onData.event,this._onUserInput=this._register(new gt),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new gt),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new gt),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=Em(RO),this.decPrivateModes=Em(OO)}reset(){this.modes=Em(RO),this.decPrivateModes=Em(OO)}triggerDataEvent(e,n=!1){if(this._optionsService.rawOptions.disableStdin)return;let r=this._bufferService.buffer;n&&this._optionsService.rawOptions.scrollOnUserInput&&r.ybase!==r.ydisp&&this._onRequestScrollToBottom.fire(),n&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(i=>i.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`),this._logService.trace("sending binary (codes)",()=>e.split("").map(n=>n.charCodeAt(0))),this._onBinary.fire(e))}};FC=Dr([At(0,ss),At(1,iz),At(2,as)],FC);var DO={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>e.button===4||e.action!==1?!1:(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>e.action!==32},DRAG:{events:23,restrict:e=>!(e.action===32&&e.button===3)},ANY:{events:31,restrict:e=>!0}};function Ew(e,n){let r=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(r|=64,r|=e.action):(r|=e.button&3,e.button&4&&(r|=64),e.button&8&&(r|=128),e.action===32?r|=32:e.action===0&&!n&&(r|=3)),r}var Aw=String.fromCharCode,PO={DEFAULT:e=>{let n=[Ew(e,!1)+32,e.col+32,e.row+32];return n[0]>255||n[1]>255||n[2]>255?"":`\x1B[M${Aw(n[0])}${Aw(n[1])}${Aw(n[2])}`},SGR:e=>{let n=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${Ew(e,!0)};${e.col};${e.row}${n}`},SGR_PIXELS:e=>{let n=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${Ew(e,!0)};${e.x};${e.y}${n}`}},HC=class extends ln{constructor(e,n,r){super(),this._bufferService=e,this._coreService=n,this._optionsService=r,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new gt),this.onProtocolChange=this._onProtocolChange.event;for(let i of Object.keys(DO))this.addProtocol(i,DO[i]);for(let i of Object.keys(PO))this.addEncoding(i,PO[i]);this.reset()}addProtocol(e,n){this._protocols[e]=n}addEncoding(e,n){this._encodings[e]=n}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(e){if(!this._protocols[e])throw new Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw new Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,n,r){if(e.deltaY===0||e.shiftKey||n===void 0||r===void 0)return 0;let i=n/r,s=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(s/=i+0,Math.abs(e.deltaY)<50&&(s*=.3),this._wheelPartialScroll+=s,s=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(s*=this._bufferService.rows),s}_applyScrollModifier(e,n){return n.altKey||n.ctrlKey||n.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||e.button===4&&e.action===32||e.button===3&&e.action!==32||e.button!==4&&(e.action===2||e.action===3)||(e.col++,e.row++,e.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(e))return!1;let n=this._encodings[this._activeEncoding](e);return n&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(n):this._coreService.triggerDataEvent(n,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(e&1),up:!!(e&2),drag:!!(e&4),move:!!(e&8),wheel:!!(e&16)}}_equalEvents(e,n,r){if(r){if(e.x!==n.x||e.y!==n.y)return!1}else if(e.col!==n.col||e.row!==n.row)return!1;return!(e.button!==n.button||e.action!==n.action||e.ctrl!==n.ctrl||e.alt!==n.alt||e.shift!==n.shift)}};HC=Dr([At(0,ss),At(1,Dd),At(2,as)],HC);var Tw=[[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]],Fne=[[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]],ti;function Hne(e,n){let r=0,i=n.length-1,s;if(e<n[0][0]||e>n[i][1])return!1;for(;i>=r;)if(s=r+i>>1,e>n[s][1])r=s+1;else if(e<n[s][0])i=s-1;else return!0;return!1}var Wne=class{constructor(){if(this.version="6",!ti){ti=new Uint8Array(65536),ti.fill(1),ti[0]=0,ti.fill(0,1,32),ti.fill(0,127,160),ti.fill(2,4352,4448),ti[9001]=2,ti[9002]=2,ti.fill(2,11904,42192),ti[12351]=1,ti.fill(2,44032,55204),ti.fill(2,63744,64256),ti.fill(2,65040,65050),ti.fill(2,65072,65136),ti.fill(2,65280,65377),ti.fill(2,65504,65511);for(let e=0;e<Tw.length;++e)ti.fill(0,Tw[e][0],Tw[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?ti[e]:Hne(e,Fne)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,n){let r=this.wcwidth(e),i=r===0&&n!==0;if(i){let s=sd.extractWidth(n);s===0?i=!1:s>r&&(r=s)}return sd.createPropertyValue(0,r,i)}},sd=class ax{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new gt,this.onChange=this._onChange.event;let n=new Wne;this.register(n),this._active=n.version,this._activeProvider=n}static extractShouldJoin(n){return(n&1)!==0}static extractWidth(n){return n>>1&3}static extractCharKind(n){return n>>3}static createPropertyValue(n,r,i=!1){return(n&16777215)<<3|(r&3)<<1|(i?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(n){if(!this._providers[n])throw new Error(`unknown Unicode version "${n}"`);this._active=n,this._activeProvider=this._providers[n],this._onChange.fire(n)}register(n){this._providers[n.version]=n}wcwidth(n){return this._activeProvider.wcwidth(n)}getStringCellWidth(n){let r=0,i=0,s=n.length;for(let a=0;a<s;++a){let o=n.charCodeAt(a);if(55296<=o&&o<=56319){if(++a>=s)return r+this.wcwidth(o);let d=n.charCodeAt(a);56320<=d&&d<=57343?o=(o-55296)*1024+d-56320+65536:r+=this.wcwidth(d)}let l=this.charProperties(o,i),u=ax.extractWidth(l);ax.extractShouldJoin(l)&&(u-=ax.extractWidth(i)),r+=u,i=l}return r}charProperties(n,r){return this._activeProvider.charProperties(n,r)}},qne=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(e){this.glevel=e,this.charset=this._charsets[e]}setgCharset(e,n){this._charsets[e]=n,this.glevel===e&&(this.charset=n)}};function LO(e){var i;let n=(i=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1))==null?void 0:i.get(e.cols-1),r=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);r&&n&&(r.isWrapped=n[3]!==0&&n[3]!==32)}var Yp=2147483647,Une=256,zz=class WC{constructor(n=32,r=32){if(this.maxLength=n,this.maxSubParamsLength=r,r>Une)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(n),this.length=0,this._subParams=new Int32Array(r),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(n),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(n){let r=new WC;if(!n.length)return r;for(let i=Array.isArray(n[0])?1:0;i<n.length;++i){let s=n[i];if(Array.isArray(s))for(let a=0;a<s.length;++a)r.addSubParam(s[a]);else r.addParam(s)}return r}clone(){let n=new WC(this.maxLength,this.maxSubParamsLength);return n.params.set(this.params),n.length=this.length,n._subParams.set(this._subParams),n._subParamsLength=this._subParamsLength,n._subParamsIdx.set(this._subParamsIdx),n._rejectDigits=this._rejectDigits,n._rejectSubDigits=this._rejectSubDigits,n._digitIsSub=this._digitIsSub,n}toArray(){let n=[];for(let r=0;r<this.length;++r){n.push(this.params[r]);let i=this._subParamsIdx[r]>>8,s=this._subParamsIdx[r]&255;s-i>0&&n.push(Array.prototype.slice.call(this._subParams,i,s))}return n}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(n){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(n<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=n>Yp?Yp:n}addSubParam(n){if(this._digitIsSub=!0,!!this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(n<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=n>Yp?Yp:n,this._subParamsIdx[this.length-1]++}}hasSubParams(n){return(this._subParamsIdx[n]&255)-(this._subParamsIdx[n]>>8)>0}getSubParams(n){let r=this._subParamsIdx[n]>>8,i=this._subParamsIdx[n]&255;return i-r>0?this._subParams.subarray(r,i):null}getSubParamsAll(){let n={};for(let r=0;r<this.length;++r){let i=this._subParamsIdx[r]>>8,s=this._subParamsIdx[r]&255;s-i>0&&(n[r]=this._subParams.slice(i,s))}return n}addDigit(n){let r;if(this._rejectDigits||!(r=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let i=this._digitIsSub?this._subParams:this.params,s=i[r-1];i[r-1]=~s?Math.min(s*10+n,Yp):n}},Gp=[],Vne=class{constructor(){this._state=0,this._active=Gp,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,n){this._handlers[e]===void 0&&(this._handlers[e]=[]);let r=this._handlers[e];return r.push(n),{dispose:()=>{let i=r.indexOf(n);i!==-1&&r.splice(i,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Gp}reset(){if(this._state===2)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].end(!1);this._stack.paused=!1,this._active=Gp,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||Gp,!this._active.length)this._handlerFb(this._id,"START");else for(let e=this._active.length-1;e>=0;e--)this._active[e].start()}_put(e,n,r){if(!this._active.length)this._handlerFb(this._id,"PUT",u0(e,n,r));else for(let i=this._active.length-1;i>=0;i--)this._active[i].put(e,n,r)}start(){this.reset(),this._state=1}put(e,n,r){if(this._state!==3){if(this._state===1)for(;n<r;){let i=e[n++];if(i===59){this._state=2,this._start();break}if(i<48||57<i){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+i-48}this._state===2&&r-n>0&&this._put(e,n,r)}}end(e,n=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,"END",e);else{let r=!1,i=this._active.length-1,s=!1;if(this._stack.paused&&(i=this._stack.loopPosition-1,r=n,s=this._stack.fallThrough,this._stack.paused=!1),!s&&r===!1){for(;i>=0&&(r=this._active[i].end(e),r!==!0);i--)if(r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!1,r;i--}for(;i>=0;i--)if(r=this._active[i].end(!1),r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!0,r}this._active=Gp,this._id=-1,this._state=0}}},Ws=class{constructor(n){this._handler=n,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(n,r,i){this._hitLimit||(this._data+=u0(n,r,i),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}end(n){let r=!1;if(this._hitLimit)r=!1;else if(n&&(r=this._handler(this._data),r instanceof Promise))return r.then(i=>(this._data="",this._hitLimit=!1,i));return this._data="",this._hitLimit=!1,r}},Xp=[],Kne=class{constructor(){this._handlers=Object.create(null),this._active=Xp,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Xp}registerHandler(e,n){this._handlers[e]===void 0&&(this._handlers[e]=[]);let r=this._handlers[e];return r.push(n),{dispose:()=>{let i=r.indexOf(n);i!==-1&&r.splice(i,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=Xp,this._ident=0}hook(e,n){if(this.reset(),this._ident=e,this._active=this._handlers[e]||Xp,!this._active.length)this._handlerFb(this._ident,"HOOK",n);else for(let r=this._active.length-1;r>=0;r--)this._active[r].hook(n)}put(e,n,r){if(!this._active.length)this._handlerFb(this._ident,"PUT",u0(e,n,r));else for(let i=this._active.length-1;i>=0;i--)this._active[i].put(e,n,r)}unhook(e,n=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let r=!1,i=this._active.length-1,s=!1;if(this._stack.paused&&(i=this._stack.loopPosition-1,r=n,s=this._stack.fallThrough,this._stack.paused=!1),!s&&r===!1){for(;i>=0&&(r=this._active[i].unhook(e),r!==!0);i--)if(r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!1,r;i--}for(;i>=0;i--)if(r=this._active[i].unhook(!1),r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!0,r}this._active=Xp,this._ident=0}},Am=new zz;Am.addParam(0);var IO=class{constructor(e){this._handler=e,this._data="",this._params=Am,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():Am,this._data="",this._hitLimit=!1}put(e,n,r){this._hitLimit||(this._data+=u0(e,n,r),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}unhook(e){let n=!1;if(this._hitLimit)n=!1;else if(e&&(n=this._handler(this._data,this._params),n instanceof Promise))return n.then(r=>(this._params=Am,this._data="",this._hitLimit=!1,r));return this._params=Am,this._data="",this._hitLimit=!1,n}},Yne=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,n){this.table.fill(e<<4|n)}add(e,n,r,i){this.table[n<<8|e]=r<<4|i}addMany(e,n,r,i){for(let s=0;s<e.length;s++)this.table[n<<8|e[s]]=r<<4|i}},ya=160,Gne=(function(){let e=new Yne(4095),n=Array.apply(null,Array(256)).map((l,u)=>u),r=(l,u)=>n.slice(l,u),i=r(32,127),s=r(0,24);s.push(25),s.push.apply(s,r(28,32));let a=r(0,14),o;e.setDefault(1,0),e.addMany(i,0,2,0);for(o in a)e.addMany([24,26,153,154],o,3,0),e.addMany(r(128,144),o,3,0),e.addMany(r(144,152),o,3,0),e.add(156,o,0,0),e.add(27,o,11,1),e.add(157,o,4,8),e.addMany([152,158,159],o,0,7),e.add(155,o,11,3),e.add(144,o,11,9);return e.addMany(s,0,3,0),e.addMany(s,1,3,1),e.add(127,1,0,1),e.addMany(s,8,0,8),e.addMany(s,3,3,3),e.add(127,3,0,3),e.addMany(s,4,3,4),e.add(127,4,0,4),e.addMany(s,6,3,6),e.addMany(s,5,3,5),e.add(127,5,0,5),e.addMany(s,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(i,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(r(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(i,7,0,7),e.addMany(s,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(r(64,127),3,7,0),e.addMany(r(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(r(48,60),4,8,4),e.addMany(r(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(r(32,64),6,0,6),e.add(127,6,0,6),e.addMany(r(64,127),6,0,0),e.addMany(r(32,48),3,9,5),e.addMany(r(32,48),5,9,5),e.addMany(r(48,64),5,0,6),e.addMany(r(64,127),5,7,0),e.addMany(r(32,48),4,9,5),e.addMany(r(32,48),1,9,2),e.addMany(r(32,48),2,9,2),e.addMany(r(48,127),2,10,0),e.addMany(r(48,80),1,10,0),e.addMany(r(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(r(96,127),1,10,0),e.add(80,1,11,9),e.addMany(s,9,0,9),e.add(127,9,0,9),e.addMany(r(28,32),9,0,9),e.addMany(r(32,48),9,9,12),e.addMany(r(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(s,11,0,11),e.addMany(r(32,128),11,0,11),e.addMany(r(28,32),11,0,11),e.addMany(s,10,0,10),e.add(127,10,0,10),e.addMany(r(28,32),10,0,10),e.addMany(r(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(r(32,48),10,9,12),e.addMany(s,12,0,12),e.add(127,12,0,12),e.addMany(r(28,32),12,0,12),e.addMany(r(32,48),12,9,12),e.addMany(r(48,64),12,0,11),e.addMany(r(64,127),12,12,13),e.addMany(r(64,127),10,12,13),e.addMany(r(64,127),9,12,13),e.addMany(s,13,13,13),e.addMany(i,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(ya,0,2,0),e.add(ya,8,5,8),e.add(ya,6,0,6),e.add(ya,11,0,11),e.add(ya,13,13,13),e})(),Xne=class extends ln{constructor(e=Gne){super(),this._transitions=e,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new zz,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(n,r,i)=>{},this._executeHandlerFb=n=>{},this._csiHandlerFb=(n,r)=>{},this._escHandlerFb=n=>{},this._errorHandlerFb=n=>n,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(br(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new Vne),this._dcsParser=this._register(new Kne),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,n=[64,126]){let r=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(r=e.prefix.charCodeAt(0),r&&60>r||r>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let s=0;s<e.intermediates.length;++s){let a=e.intermediates.charCodeAt(s);if(32>a||a>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");r<<=8,r|=a}}if(e.final.length!==1)throw new Error("final must be a single byte");let i=e.final.charCodeAt(0);if(n[0]>i||i>n[1])throw new Error(`final must be in range ${n[0]} .. ${n[1]}`);return r<<=8,r|=i,r}identToString(e){let n=[];for(;e;)n.push(String.fromCharCode(e&255)),e>>=8;return n.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,n){let r=this._identifier(e,[48,126]);this._escHandlers[r]===void 0&&(this._escHandlers[r]=[]);let i=this._escHandlers[r];return i.push(n),{dispose:()=>{let s=i.indexOf(n);s!==-1&&i.splice(s,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,n){this._executeHandlers[e.charCodeAt(0)]=n}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,n){let r=this._identifier(e);this._csiHandlers[r]===void 0&&(this._csiHandlers[r]=[]);let i=this._csiHandlers[r];return i.push(n),{dispose:()=>{let s=i.indexOf(n);s!==-1&&i.splice(s,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,n){return this._dcsParser.registerHandler(this._identifier(e),n)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,n){return this._oscParser.registerHandler(e,n)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}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(e,n,r,i,s){this._parseStack.state=e,this._parseStack.handlers=n,this._parseStack.handlerPos=r,this._parseStack.transition=i,this._parseStack.chunkPos=s}parse(e,n,r){let i=0,s=0,a=0,o;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,a=this._parseStack.chunkPos+1;else{if(r===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let l=this._parseStack.handlers,u=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(r===!1&&u>-1){for(;u>=0&&(o=l[u](this._params),o!==!0);u--)if(o instanceof Promise)return this._parseStack.handlerPos=u,o}this._parseStack.handlers=[];break;case 4:if(r===!1&&u>-1){for(;u>=0&&(o=l[u](),o!==!0);u--)if(o instanceof Promise)return this._parseStack.handlerPos=u,o}this._parseStack.handlers=[];break;case 6:if(i=e[this._parseStack.chunkPos],o=this._dcsParser.unhook(i!==24&&i!==26,r),o)return o;i===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(i=e[this._parseStack.chunkPos],o=this._oscParser.end(i!==24&&i!==26,r),o)return o;i===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,a=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let l=a;l<n;++l){switch(i=e[l],s=this._transitions.table[this.currentState<<8|(i<160?i:ya)],s>>4){case 2:for(let g=l+1;;++g){if(g>=n||(i=e[g])<32||i>126&&i<ya){this._printHandler(e,l,g),l=g-1;break}if(++g>=n||(i=e[g])<32||i>126&&i<ya){this._printHandler(e,l,g),l=g-1;break}if(++g>=n||(i=e[g])<32||i>126&&i<ya){this._printHandler(e,l,g),l=g-1;break}if(++g>=n||(i=e[g])<32||i>126&&i<ya){this._printHandler(e,l,g),l=g-1;break}}break;case 3:this._executeHandlers[i]?this._executeHandlers[i]():this._executeHandlerFb(i),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:l,code:i,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let u=this._csiHandlers[this._collect<<8|i],d=u?u.length-1:-1;for(;d>=0&&(o=u[d](this._params),o!==!0);d--)if(o instanceof Promise)return this._preserveStack(3,u,d,s,l),o;d<0&&this._csiHandlerFb(this._collect<<8|i,this._params),this.precedingJoinState=0;break;case 8:do switch(i){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(i-48)}while(++l<n&&(i=e[l])>47&&i<60);l--;break;case 9:this._collect<<=8,this._collect|=i;break;case 10:let p=this._escHandlers[this._collect<<8|i],f=p?p.length-1:-1;for(;f>=0&&(o=p[f](),o!==!0);f--)if(o instanceof Promise)return this._preserveStack(4,p,f,s,l),o;f<0&&this._escHandlerFb(this._collect<<8|i),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|i,this._params);break;case 13:for(let g=l+1;;++g)if(g>=n||(i=e[g])===24||i===26||i===27||i>127&&i<ya){this._dcsParser.put(e,l,g),l=g-1;break}break;case 14:if(o=this._dcsParser.unhook(i!==24&&i!==26),o)return this._preserveStack(6,[],0,s,l),o;i===27&&(s|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let g=l+1;;g++)if(g>=n||(i=e[g])<32||i>127&&i<ya){this._oscParser.put(e,l,g),l=g-1;break}break;case 6:if(o=this._oscParser.end(i!==24&&i!==26),o)return this._preserveStack(5,[],0,s,l),o;i===27&&(s|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=s&15}}},Qne=/^([\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})$/,Zne=/^[\da-f]+$/;function BO(e){if(!e)return;let n=e.toLowerCase();if(n.indexOf("rgb:")===0){n=n.slice(4);let r=Qne.exec(n);if(r){let i=r[1]?15:r[4]?255:r[7]?4095:65535;return[Math.round(parseInt(r[1]||r[4]||r[7]||r[10],16)/i*255),Math.round(parseInt(r[2]||r[5]||r[8]||r[11],16)/i*255),Math.round(parseInt(r[3]||r[6]||r[9]||r[12],16)/i*255)]}}else if(n.indexOf("#")===0&&(n=n.slice(1),Zne.exec(n)&&[3,6,9,12].includes(n.length))){let r=n.length/3,i=[0,0,0];for(let s=0;s<3;++s){let a=parseInt(n.slice(r*s,r*s+r),16);i[s]=r===1?a<<4:r===2?a:r===3?a>>4:a>>8}return i}}function Mw(e,n){let r=e.toString(16),i=r.length<2?"0"+r:r;switch(n){case 4:return r[0];case 8:return i;case 12:return(i+i).slice(0,3);default:return i+i}}function Jne(e,n=16){let[r,i,s]=e;return`rgb:${Mw(r,n)}/${Mw(i,n)}/${Mw(s,n)}`}var ere={"(":0,")":1,"*":2,"+":3,"-":1,".":2},Nc=131072,zO=10;function $O(e,n){if(e>24)return n.setWinLines||!1;switch(e){case 1:return!!n.restoreWin;case 2:return!!n.minimizeWin;case 3:return!!n.setWinPosition;case 4:return!!n.setWinSizePixels;case 5:return!!n.raiseWin;case 6:return!!n.lowerWin;case 7:return!!n.refreshWin;case 8:return!!n.setWinSizeChars;case 9:return!!n.maximizeWin;case 10:return!!n.fullscreenWin;case 11:return!!n.getWinState;case 13:return!!n.getWinPosition;case 14:return!!n.getWinSizePixels;case 15:return!!n.getScreenSizePixels;case 16:return!!n.getCellSizePixels;case 18:return!!n.getWinSizeChars;case 19:return!!n.getScreenSizeChars;case 20:return!!n.getIconTitle;case 21:return!!n.getWinTitle;case 22:return!!n.pushTitle;case 23:return!!n.popTitle;case 24:return!!n.setWinLines}return!1}var FO=5e3,HO=0,tre=class extends ln{constructor(e,n,r,i,s,a,o,l,u=new Xne){super(),this._bufferService=e,this._charsetService=n,this._coreService=r,this._logService=i,this._optionsService=s,this._oscLinkService=a,this._coreMouseService=o,this._unicodeService=l,this._parser=u,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new xee,this._utf8Decoder=new bee,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=Kr.clone(),this._eraseAttrDataInternal=Kr.clone(),this._onRequestBell=this._register(new gt),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new gt),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new gt),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new gt),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new gt),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new gt),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new gt),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new gt),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new gt),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new gt),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new gt),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new gt),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new gt),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 qC(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(d=>this._activeBuffer=d.activeBuffer)),this._parser.setCsiHandlerFallback((d,p)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(d),params:p.toArray()})}),this._parser.setEscHandlerFallback(d=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(d)})}),this._parser.setExecuteHandlerFallback(d=>{this._logService.debug("Unknown EXECUTE code: ",{code:d})}),this._parser.setOscHandlerFallback((d,p,f)=>{this._logService.debug("Unknown OSC code: ",{identifier:d,action:p,data:f})}),this._parser.setDcsHandlerFallback((d,p,f)=>{p==="HOOK"&&(f=f.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(d),action:p,payload:f})}),this._parser.setPrintHandler((d,p,f)=>this.print(d,p,f)),this._parser.registerCsiHandler({final:"@"},d=>this.insertChars(d)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},d=>this.scrollLeft(d)),this._parser.registerCsiHandler({final:"A"},d=>this.cursorUp(d)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},d=>this.scrollRight(d)),this._parser.registerCsiHandler({final:"B"},d=>this.cursorDown(d)),this._parser.registerCsiHandler({final:"C"},d=>this.cursorForward(d)),this._parser.registerCsiHandler({final:"D"},d=>this.cursorBackward(d)),this._parser.registerCsiHandler({final:"E"},d=>this.cursorNextLine(d)),this._parser.registerCsiHandler({final:"F"},d=>this.cursorPrecedingLine(d)),this._parser.registerCsiHandler({final:"G"},d=>this.cursorCharAbsolute(d)),this._parser.registerCsiHandler({final:"H"},d=>this.cursorPosition(d)),this._parser.registerCsiHandler({final:"I"},d=>this.cursorForwardTab(d)),this._parser.registerCsiHandler({final:"J"},d=>this.eraseInDisplay(d,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},d=>this.eraseInDisplay(d,!0)),this._parser.registerCsiHandler({final:"K"},d=>this.eraseInLine(d,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},d=>this.eraseInLine(d,!0)),this._parser.registerCsiHandler({final:"L"},d=>this.insertLines(d)),this._parser.registerCsiHandler({final:"M"},d=>this.deleteLines(d)),this._parser.registerCsiHandler({final:"P"},d=>this.deleteChars(d)),this._parser.registerCsiHandler({final:"S"},d=>this.scrollUp(d)),this._parser.registerCsiHandler({final:"T"},d=>this.scrollDown(d)),this._parser.registerCsiHandler({final:"X"},d=>this.eraseChars(d)),this._parser.registerCsiHandler({final:"Z"},d=>this.cursorBackwardTab(d)),this._parser.registerCsiHandler({final:"`"},d=>this.charPosAbsolute(d)),this._parser.registerCsiHandler({final:"a"},d=>this.hPositionRelative(d)),this._parser.registerCsiHandler({final:"b"},d=>this.repeatPrecedingCharacter(d)),this._parser.registerCsiHandler({final:"c"},d=>this.sendDeviceAttributesPrimary(d)),this._parser.registerCsiHandler({prefix:">",final:"c"},d=>this.sendDeviceAttributesSecondary(d)),this._parser.registerCsiHandler({final:"d"},d=>this.linePosAbsolute(d)),this._parser.registerCsiHandler({final:"e"},d=>this.vPositionRelative(d)),this._parser.registerCsiHandler({final:"f"},d=>this.hVPosition(d)),this._parser.registerCsiHandler({final:"g"},d=>this.tabClear(d)),this._parser.registerCsiHandler({final:"h"},d=>this.setMode(d)),this._parser.registerCsiHandler({prefix:"?",final:"h"},d=>this.setModePrivate(d)),this._parser.registerCsiHandler({final:"l"},d=>this.resetMode(d)),this._parser.registerCsiHandler({prefix:"?",final:"l"},d=>this.resetModePrivate(d)),this._parser.registerCsiHandler({final:"m"},d=>this.charAttributes(d)),this._parser.registerCsiHandler({final:"n"},d=>this.deviceStatus(d)),this._parser.registerCsiHandler({prefix:"?",final:"n"},d=>this.deviceStatusPrivate(d)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},d=>this.softReset(d)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},d=>this.setCursorStyle(d)),this._parser.registerCsiHandler({final:"r"},d=>this.setScrollRegion(d)),this._parser.registerCsiHandler({final:"s"},d=>this.saveCursor(d)),this._parser.registerCsiHandler({final:"t"},d=>this.windowOptions(d)),this._parser.registerCsiHandler({final:"u"},d=>this.restoreCursor(d)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},d=>this.insertColumns(d)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},d=>this.deleteColumns(d)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},d=>this.selectProtected(d)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},d=>this.requestMode(d,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},d=>this.requestMode(d,!1)),this._parser.setExecuteHandler(nt.BEL,()=>this.bell()),this._parser.setExecuteHandler(nt.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(nt.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(nt.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(nt.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(nt.BS,()=>this.backspace()),this._parser.setExecuteHandler(nt.HT,()=>this.tab()),this._parser.setExecuteHandler(nt.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(nt.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(ix.IND,()=>this.index()),this._parser.setExecuteHandler(ix.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(ix.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new Ws(d=>(this.setTitle(d),this.setIconName(d),!0))),this._parser.registerOscHandler(1,new Ws(d=>this.setIconName(d))),this._parser.registerOscHandler(2,new Ws(d=>this.setTitle(d))),this._parser.registerOscHandler(4,new Ws(d=>this.setOrReportIndexedColor(d))),this._parser.registerOscHandler(8,new Ws(d=>this.setHyperlink(d))),this._parser.registerOscHandler(10,new Ws(d=>this.setOrReportFgColor(d))),this._parser.registerOscHandler(11,new Ws(d=>this.setOrReportBgColor(d))),this._parser.registerOscHandler(12,new Ws(d=>this.setOrReportCursorColor(d))),this._parser.registerOscHandler(104,new Ws(d=>this.restoreIndexedColor(d))),this._parser.registerOscHandler(110,new Ws(d=>this.restoreFgColor(d))),this._parser.registerOscHandler(111,new Ws(d=>this.restoreBgColor(d))),this._parser.registerOscHandler(112,new Ws(d=>this.restoreCursorColor(d))),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(let d in ii)this._parser.registerEscHandler({intermediates:"(",final:d},()=>this.selectCharset("("+d)),this._parser.registerEscHandler({intermediates:")",final:d},()=>this.selectCharset(")"+d)),this._parser.registerEscHandler({intermediates:"*",final:d},()=>this.selectCharset("*"+d)),this._parser.registerEscHandler({intermediates:"+",final:d},()=>this.selectCharset("+"+d)),this._parser.registerEscHandler({intermediates:"-",final:d},()=>this.selectCharset("-"+d)),this._parser.registerEscHandler({intermediates:".",final:d},()=>this.selectCharset("."+d)),this._parser.registerEscHandler({intermediates:"/",final:d},()=>this.selectCharset("/"+d));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(d=>(this._logService.error("Parsing error: ",d),d)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new IO((d,p)=>this.requestStatusString(d,p)))}getAttrData(){return this._curAttrData}_preserveStack(e,n,r,i){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=n,this._parseStack.decodedLength=r,this._parseStack.position=i}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((n,r)=>setTimeout(()=>r("#SLOW_TIMEOUT"),FO))]).catch(n=>{if(n!=="#SLOW_TIMEOUT")throw n;console.warn(`async parser handler taking longer than ${FO} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,n){let r,i=this._activeBuffer.x,s=this._activeBuffer.y,a=0,o=this._parseStack.paused;if(o){if(r=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,n))return this._logSlowResolvingAsync(r),r;i=this._parseStack.cursorStartX,s=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>Nc&&(a=this._parseStack.position+Nc)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e=="string"?` "${e}"`:` "${Array.prototype.map.call(e,d=>String.fromCharCode(d)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof e=="string"?e.split("").map(d=>d.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<Nc&&(this._parseBuffer=new Uint32Array(Math.min(e.length,Nc))),o||this._dirtyRowTracker.clearRange(),e.length>Nc)for(let d=a;d<e.length;d+=Nc){let p=d+Nc<e.length?d+Nc:e.length,f=typeof e=="string"?this._stringDecoder.decode(e.substring(d,p),this._parseBuffer):this._utf8Decoder.decode(e.subarray(d,p),this._parseBuffer);if(r=this._parser.parse(this._parseBuffer,f))return this._preserveStack(i,s,f,d),this._logSlowResolvingAsync(r),r}else if(!o){let d=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(r=this._parser.parse(this._parseBuffer,d))return this._preserveStack(i,s,d,0),this._logSlowResolvingAsync(r),r}(this._activeBuffer.x!==i||this._activeBuffer.y!==s)&&this._onCursorMove.fire();let l=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),u=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);u<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(u,this._bufferService.rows-1),end:Math.min(l,this._bufferService.rows-1)})}print(e,n,r){let i,s,a=this._charsetService.charset,o=this._optionsService.rawOptions.screenReaderMode,l=this._bufferService.cols,u=this._coreService.decPrivateModes.wraparound,d=this._coreService.modes.insertMode,p=this._curAttrData,f=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&r-n>0&&f.getWidth(this._activeBuffer.x-1)===2&&f.setCellFromCodepoint(this._activeBuffer.x-1,0,1,p);let g=this._parser.precedingJoinState;for(let _=n;_<r;++_){if(i=e[_],i<127&&a){let w=a[String.fromCharCode(i)];w&&(i=w.charCodeAt(0))}let x=this._unicodeService.charProperties(i,g);s=sd.extractWidth(x);let v=sd.extractShouldJoin(x),S=v?sd.extractWidth(g):0;if(g=x,o&&this._onA11yChar.fire(Ic(i)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+s-S>l){if(u){let w=f,N=this._activeBuffer.x-S;for(this._activeBuffer.x=S,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),f=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),S>0&&f instanceof Nm&&f.copyCellsFrom(w,N,0,S,!1);N<l;)w.setCellFromCodepoint(N++,0,1,p)}else if(this._activeBuffer.x=l-1,s===2)continue}if(v&&this._activeBuffer.x){let w=f.getWidth(this._activeBuffer.x-1)?1:2;f.addCodepointToCell(this._activeBuffer.x-w,i,s);for(let N=s-S;--N>=0;)f.setCellFromCodepoint(this._activeBuffer.x++,0,0,p);continue}if(d&&(f.insertCells(this._activeBuffer.x,s-S,this._activeBuffer.getNullCell(p)),f.getWidth(l-1)===2&&f.setCellFromCodepoint(l-1,0,1,p)),f.setCellFromCodepoint(this._activeBuffer.x++,i,s,p),s>0)for(;--s;)f.setCellFromCodepoint(this._activeBuffer.x++,0,0,p)}this._parser.precedingJoinState=g,this._activeBuffer.x<l&&r-n>0&&f.getWidth(this._activeBuffer.x)===0&&!f.hasContent(this._activeBuffer.x)&&f.setCellFromCodepoint(this._activeBuffer.x,0,1,p),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,n){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,r=>$O(r.params[0],this._optionsService.rawOptions.windowOptions)?n(r):!0):this._parser.registerCsiHandler(e,n)}registerDcsHandler(e,n){return this._parser.registerDcsHandler(e,new IO(n))}registerEscHandler(e,n){return this._parser.registerEscHandler(e,n)}registerOscHandler(e,n){return this._parser.registerOscHandler(e,new Ws(n))}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 e;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&&((e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&e.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);n.hasWidth(this._activeBuffer.x)&&!n.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,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(e,n){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+n):(this._activeBuffer.x=e,this._activeBuffer.y=n),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,n){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+n)}cursorUp(e){let n=this._activeBuffer.y-this._activeBuffer.scrollTop;return n>=0?this._moveCursor(0,-Math.min(n,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let n=this._activeBuffer.scrollBottom-this._activeBuffer.y;return n>=0?this._moveCursor(0,Math.min(n,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let n=e.params[0];return n===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:n===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let n=e.params[0]||1;for(;n--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let n=e.params[0]||1;for(;n--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let n=e.params[0];return n===1&&(this._curAttrData.bg|=536870912),(n===2||n===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,n,r,i=!1,s=!1){let a=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);a.replaceCells(n,r,this._activeBuffer.getNullCell(this._eraseAttrData()),s),i&&(a.isWrapped=!1)}_resetBufferLine(e,n=!1){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);r&&(r.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),n),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),r.isWrapped=!1)}eraseInDisplay(e,n=!1){var i;this._restrictCursor(this._bufferService.cols);let r;switch(e.params[0]){case 0:for(r=this._activeBuffer.y,this._dirtyRowTracker.markDirty(r),this._eraseInBufferLine(r++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,n);r<this._bufferService.rows;r++)this._resetBufferLine(r,n);this._dirtyRowTracker.markDirty(r);break;case 1:for(r=this._activeBuffer.y,this._dirtyRowTracker.markDirty(r),this._eraseInBufferLine(r,0,this._activeBuffer.x+1,!0,n),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(r+1).isWrapped=!1);r--;)this._resetBufferLine(r,n);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(r=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,r-1);r--&&!((i=this._activeBuffer.lines.get(this._activeBuffer.ybase+r))!=null&&i.getTrimmedLength()););for(;r>=0;r--)this._bufferService.scroll(this._eraseAttrData())}else{for(r=this._bufferService.rows,this._dirtyRowTracker.markDirty(r-1);r--;)this._resetBufferLine(r,n);this._dirtyRowTracker.markDirty(0)}break;case 3:let s=this._activeBuffer.lines.length-this._bufferService.rows;s>0&&(this._activeBuffer.lines.trimStart(s),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-s,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-s,0),this._onScroll.fire(0));break}return!0}eraseInLine(e,n=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,n);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,n);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,n);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let n=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let r=this._activeBuffer.ybase+this._activeBuffer.y,i=this._bufferService.rows-1-this._activeBuffer.scrollBottom,s=this._bufferService.rows-1+this._activeBuffer.ybase-i+1;for(;n--;)this._activeBuffer.lines.splice(s-1,1),this._activeBuffer.lines.splice(r,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(e){this._restrictCursor();let n=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let r=this._activeBuffer.ybase+this._activeBuffer.y,i;for(i=this._bufferService.rows-1-this._activeBuffer.scrollBottom,i=this._bufferService.rows-1+this._activeBuffer.ybase-i;n--;)this._activeBuffer.lines.splice(r,1),this._activeBuffer.lines.splice(i,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(e){this._restrictCursor();let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return n&&(n.insertCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(e){this._restrictCursor();let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return n&&(n.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let n=e.params[0]||1;for(;n--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(e){let n=e.params[0]||1;for(;n--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(Kr));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=e.params[0]||1;for(let r=this._activeBuffer.scrollTop;r<=this._activeBuffer.scrollBottom;++r){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+r);i.deleteCells(0,n,this._activeBuffer.getNullCell(this._eraseAttrData())),i.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=e.params[0]||1;for(let r=this._activeBuffer.scrollTop;r<=this._activeBuffer.scrollBottom;++r){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+r);i.insertCells(0,n,this._activeBuffer.getNullCell(this._eraseAttrData())),i.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=e.params[0]||1;for(let r=this._activeBuffer.scrollTop;r<=this._activeBuffer.scrollBottom;++r){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+r);i.insertCells(this._activeBuffer.x,n,this._activeBuffer.getNullCell(this._eraseAttrData())),i.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=e.params[0]||1;for(let r=this._activeBuffer.scrollTop;r<=this._activeBuffer.scrollBottom;++r){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+r);i.deleteCells(this._activeBuffer.x,n,this._activeBuffer.getNullCell(this._eraseAttrData())),i.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return n&&(n.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(e.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(e){let n=this._parser.precedingJoinState;if(!n)return!0;let r=e.params[0]||1,i=sd.extractWidth(n),s=this._activeBuffer.x-i,a=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(s),o=new Uint32Array(a.length*r),l=0;for(let d=0;d<a.length;){let p=a.codePointAt(d)||0;o[l++]=p,d+=p>65535?2:1}let u=l;for(let d=1;d<r;++d)o.copyWithin(u,0,l),u+=l;return this.print(o,0,u),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(nt.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(nt.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(nt.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(nt.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(nt.ESC+"[>83;40003;0c")),!0}_is(e){return(this._optionsService.rawOptions.termName+"").indexOf(e)===0}setMode(e){for(let n=0;n<e.length;n++)switch(e.params[n]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0;break}return!0}setModePrivate(e){for(let n=0;n<e.length;n++)switch(e.params[n]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,Yu),this._charsetService.setgCharset(1,Yu),this._charsetService.setgCharset(2,Yu),this._charsetService.setgCharset(3,Yu);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0;break}return!0}resetMode(e){for(let n=0;n<e.length;n++)switch(e.params[n]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1;break}return!0}resetModePrivate(e){for(let n=0;n<e.length;n++)switch(e.params[n]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),e.params[n]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0);break}return!0}requestMode(e,n){(v=>(v[v.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",v[v.SET=1]="SET",v[v.RESET=2]="RESET",v[v.PERMANENTLY_SET=3]="PERMANENTLY_SET",v[v.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(void 0||(r={}));let i=this._coreService.decPrivateModes,{activeProtocol:s,activeEncoding:a}=this._coreMouseService,o=this._coreService,{buffers:l,cols:u}=this._bufferService,{active:d,alt:p}=l,f=this._optionsService.rawOptions,g=(v,S)=>(o.triggerDataEvent(`${nt.ESC}[${n?"":"?"}${v};${S}$y`),!0),_=v=>v?1:2,x=e.params[0];return n?x===2?g(x,4):x===4?g(x,_(o.modes.insertMode)):x===12?g(x,3):x===20?g(x,_(f.convertEol)):g(x,0):x===1?g(x,_(i.applicationCursorKeys)):x===3?g(x,f.windowOptions.setWinLines?u===80?2:u===132?1:0:0):x===6?g(x,_(i.origin)):x===7?g(x,_(i.wraparound)):x===8?g(x,3):x===9?g(x,_(s==="X10")):x===12?g(x,_(f.cursorBlink)):x===25?g(x,_(!o.isCursorHidden)):x===45?g(x,_(i.reverseWraparound)):x===66?g(x,_(i.applicationKeypad)):x===67?g(x,4):x===1e3?g(x,_(s==="VT200")):x===1002?g(x,_(s==="DRAG")):x===1003?g(x,_(s==="ANY")):x===1004?g(x,_(i.sendFocus)):x===1005?g(x,4):x===1006?g(x,_(a==="SGR")):x===1015?g(x,4):x===1016?g(x,_(a==="SGR_PIXELS")):x===1048?g(x,1):x===47||x===1047||x===1049?g(x,_(d===p)):x===2004?g(x,_(i.bracketedPasteMode)):x===2026?g(x,_(i.synchronizedOutput)):g(x,0)}_updateAttrColor(e,n,r,i,s){return n===2?(e|=50331648,e&=-16777216,e|=ov.fromColorRGB([r,i,s])):n===5&&(e&=-50331904,e|=33554432|r&255),e}_extractColor(e,n,r){let i=[0,0,-1,0,0,0],s=0,a=0;do{if(i[a+s]=e.params[n+a],e.hasSubParams(n+a)){let o=e.getSubParams(n+a),l=0;do i[1]===5&&(s=1),i[a+l+1+s]=o[l];while(++l<o.length&&l+a+1+s<i.length);break}if(i[1]===5&&a+s>=2||i[1]===2&&a+s>=5)break;i[1]&&(s=1)}while(++a+n<e.length&&a+s<i.length);for(let o=2;o<i.length;++o)i[o]===-1&&(i[o]=0);switch(i[0]){case 38:r.fg=this._updateAttrColor(r.fg,i[1],i[3],i[4],i[5]);break;case 48:r.bg=this._updateAttrColor(r.bg,i[1],i[3],i[4],i[5]);break;case 58:r.extended=r.extended.clone(),r.extended.underlineColor=this._updateAttrColor(r.extended.underlineColor,i[1],i[3],i[4],i[5])}return a}_processUnderline(e,n){n.extended=n.extended.clone(),(!~e||e>5)&&(e=1),n.extended.underlineStyle=e,n.fg|=268435456,e===0&&(n.fg&=-268435457),n.updateExtended()}_processSGR0(e){e.fg=Kr.fg,e.bg=Kr.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(e.length===1&&e.params[0]===0)return this._processSGR0(this._curAttrData),!0;let n=e.length,r,i=this._curAttrData;for(let s=0;s<n;s++)r=e.params[s],r>=30&&r<=37?(i.fg&=-50331904,i.fg|=16777216|r-30):r>=40&&r<=47?(i.bg&=-50331904,i.bg|=16777216|r-40):r>=90&&r<=97?(i.fg&=-50331904,i.fg|=16777216|r-90|8):r>=100&&r<=107?(i.bg&=-50331904,i.bg|=16777216|r-100|8):r===0?this._processSGR0(i):r===1?i.fg|=134217728:r===3?i.bg|=67108864:r===4?(i.fg|=268435456,this._processUnderline(e.hasSubParams(s)?e.getSubParams(s)[0]:1,i)):r===5?i.fg|=536870912:r===7?i.fg|=67108864:r===8?i.fg|=1073741824:r===9?i.fg|=2147483648:r===2?i.bg|=134217728:r===21?this._processUnderline(2,i):r===22?(i.fg&=-134217729,i.bg&=-134217729):r===23?i.bg&=-67108865:r===24?(i.fg&=-268435457,this._processUnderline(0,i)):r===25?i.fg&=-536870913:r===27?i.fg&=-67108865:r===28?i.fg&=-1073741825:r===29?i.fg&=2147483647:r===39?(i.fg&=-67108864,i.fg|=Kr.fg&16777215):r===49?(i.bg&=-67108864,i.bg|=Kr.bg&16777215):r===38||r===48||r===58?s+=this._extractColor(e,s,i):r===53?i.bg|=1073741824:r===55?i.bg&=-1073741825:r===59?(i.extended=i.extended.clone(),i.extended.underlineColor=-1,i.updateExtended()):r===100?(i.fg&=-67108864,i.fg|=Kr.fg&16777215,i.bg&=-67108864,i.bg|=Kr.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",r);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${nt.ESC}[0n`);break;case 6:let n=this._activeBuffer.y+1,r=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${nt.ESC}[${n};${r}R`);break}return!0}deviceStatusPrivate(e){switch(e.params[0]){case 6:let n=this._activeBuffer.y+1,r=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${nt.ESC}[?${n};${r}R`);break}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=Kr.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(e){let n=e.length===0?1:e.params[0];if(n===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(n){case 1:case 2:this._coreService.decPrivateModes.cursorStyle="block";break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle="underline";break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle="bar";break}let r=n%2===1;this._coreService.decPrivateModes.cursorBlink=r}return!0}setScrollRegion(e){let n=e.params[0]||1,r;return(e.length<2||(r=e.params[1])>this._bufferService.rows||r===0)&&(r=this._bufferService.rows),r>n&&(this._activeBuffer.scrollTop=n-1,this._activeBuffer.scrollBottom=r-1,this._setCursor(0,0)),!0}windowOptions(e){if(!$O(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let n=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:n!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${nt.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(n===0||n===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>zO&&this._windowTitleStack.shift()),(n===0||n===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>zO&&this._iconNameStack.shift());break;case 23:(n===0||n===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(n===0||n===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop());break}return!0}saveCursor(e){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(e){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(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let n=[],r=e.split(";");for(;r.length>1;){let i=r.shift(),s=r.shift();if(/^\d+$/.exec(i)){let a=parseInt(i);if(WO(a))if(s==="?")n.push({type:0,index:a});else{let o=BO(s);o&&n.push({type:1,index:a,color:o})}}}return n.length&&this._onColor.fire(n),!0}setHyperlink(e){let n=e.indexOf(";");if(n===-1)return!0;let r=e.slice(0,n).trim(),i=e.slice(n+1);return i?this._createHyperlink(r,i):r.trim()?!1:this._finishHyperlink()}_createHyperlink(e,n){this._getCurrentLinkId()&&this._finishHyperlink();let r=e.split(":"),i,s=r.findIndex(a=>a.startsWith("id="));return s!==-1&&(i=r[s].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:i,uri:n}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,n){let r=e.split(";");for(let i=0;i<r.length&&!(n>=this._specialColors.length);++i,++n)if(r[i]==="?")this._onColor.fire([{type:0,index:this._specialColors[n]}]);else{let s=BO(r[i]);s&&this._onColor.fire([{type:1,index:this._specialColors[n],color:s}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;let n=[],r=e.split(";");for(let i=0;i<r.length;++i)if(/^\d+$/.exec(r[i])){let s=parseInt(r[i]);WO(s)&&n.push({type:2,index:s})}return n.length&&this._onColor.fire(n),!0}restoreFgColor(e){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(e){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(e){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,Yu),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(ere[e[0]],ii[e[1]]||Yu),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let e=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,e,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=Kr.clone(),this._eraseAttrDataInternal=Kr.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new ja;e.content=1<<22|69,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let n=0;n<this._bufferService.rows;++n){let r=this._activeBuffer.ybase+this._activeBuffer.y+n,i=this._activeBuffer.lines.get(r);i&&(i.fill(e),i.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,n){let r=o=>(this._coreService.triggerDataEvent(`${nt.ESC}${o}${nt.ESC}\\`),!0),i=this._bufferService.buffer,s=this._optionsService.rawOptions;return r(e==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:e==='"p'?'P1$r61;1"p':e==="r"?`P1$r${i.scrollTop+1};${i.scrollBottom+1}r`:e==="m"?"P1$r0m":e===" q"?`P1$r${{block:2,underline:4,bar:6}[s.cursorStyle]-(s.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,n){this._dirtyRowTracker.markRangeDirty(e,n)}},qC=class{constructor(e){this._bufferService=e,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(e){e<this.start?this.start=e:e>this.end&&(this.end=e)}markRangeDirty(e,n){e>n&&(HO=e,e=n,n=HO),e<this.start&&(this.start=e),n>this.end&&(this.end=n)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};qC=Dr([At(0,ss)],qC);function WO(e){return 0<=e&&e<256}var nre=5e7,qO=12,rre=50,ire=class extends ln{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new gt),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,n){if(n!==void 0&&this._syncCalls>n){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let r;for(;r=this._writeBuffer.shift();){this._action(r);let i=this._callbacks.shift();i&&i()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,n){if(this._pendingData>nre)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(n),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(n)}_innerWrite(e=0,n=!0){let r=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let i=this._writeBuffer[this._bufferOffset],s=this._action(i,n);if(s){let o=l=>performance.now()-r>=qO?setTimeout(()=>this._innerWrite(0,l)):this._innerWrite(r,l);s.catch(l=>(queueMicrotask(()=>{throw l}),Promise.resolve(!1))).then(o);return}let a=this._callbacks[this._bufferOffset];if(a&&a(),this._bufferOffset++,this._pendingData-=i.length,performance.now()-r>=qO)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>rre&&(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()}},UC=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let n=this._bufferService.buffer;if(e.id===void 0){let l=n.addMarker(n.ybase+n.y),u={data:e,id:this._nextId++,lines:[l]};return l.onDispose(()=>this._removeMarkerFromLink(u,l)),this._dataByLinkId.set(u.id,u),u.id}let r=e,i=this._getEntryIdKey(r),s=this._entriesWithId.get(i);if(s)return this.addLineToLink(s.id,n.ybase+n.y),s.id;let a=n.addMarker(n.ybase+n.y),o={id:this._nextId++,key:this._getEntryIdKey(r),data:r,lines:[a]};return a.onDispose(()=>this._removeMarkerFromLink(o,a)),this._entriesWithId.set(o.key,o),this._dataByLinkId.set(o.id,o),o.id}addLineToLink(e,n){let r=this._dataByLinkId.get(e);if(r&&r.lines.every(i=>i.line!==n)){let i=this._bufferService.buffer.addMarker(n);r.lines.push(i),i.onDispose(()=>this._removeMarkerFromLink(r,i))}}getLinkData(e){var n;return(n=this._dataByLinkId.get(e))==null?void 0:n.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,n){let r=e.lines.indexOf(n);r!==-1&&(e.lines.splice(r,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};UC=Dr([At(0,ss)],UC);var UO=!1,sre=class extends ln{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new bf),this._onBinary=this._register(new gt),this.onBinary=this._onBinary.event,this._onData=this._register(new gt),this.onData=this._onData.event,this._onLineFeed=this._register(new gt),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new gt),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new gt),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new gt),this._instantiationService=new Ane,this.optionsService=this._register(new zne(e)),this._instantiationService.setService(as,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance($C)),this._instantiationService.setService(ss,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(zC)),this._instantiationService.setService(iz,this._logService),this.coreService=this._register(this._instantiationService.createInstance(FC)),this._instantiationService.setService(Dd,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(HC)),this._instantiationService.setService(rz,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(sd)),this._instantiationService.setService(Cee,this.unicodeService),this._charsetService=this._instantiationService.createInstance(qne),this._instantiationService.setService(See,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(UC),this._instantiationService.setService(sz,this._oscLinkService),this._inputHandler=this._register(new tre(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(Ei.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(Ei.forward(this._bufferService.onResize,this._onResize)),this._register(Ei.forward(this.coreService.onData,this._onData)),this._register(Ei.forward(this.coreService.onBinary,this._onBinary)),this._register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom(!0))),this._register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this._register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],()=>this._handleWindowsPtyOptionChange())),this._register(this._bufferService.onScroll(()=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this._register(new ire((n,r)=>this._inputHandler.parse(n,r))),this._register(Ei.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new gt),this._onScroll.event(e=>{var n;(n=this._onScrollApi)==null||n.fire(e.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(e){for(let n in e)this.optionsService.options[n]=e[n]}write(e,n){this._writeBuffer.write(e,n)}writeSync(e,n){this._logService.logLevel<=3&&!UO&&(this._logService.warn("writeSync is unreliable and will be removed soon."),UO=!0),this._writeBuffer.writeSync(e,n)}input(e,n=!0){this.coreService.triggerDataEvent(e,n)}resize(e,n){isNaN(e)||isNaN(n)||(e=Math.max(e,Iz),n=Math.max(n,Bz),this._bufferService.resize(e,n))}scroll(e,n=!1){this._bufferService.scroll(e,n)}scrollLines(e,n){this._bufferService.scrollLines(e,n)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let n=e-this._bufferService.buffer.ydisp;n!==0&&this.scrollLines(n)}registerEscHandler(e,n){return this._inputHandler.registerEscHandler(e,n)}registerDcsHandler(e,n){return this._inputHandler.registerDcsHandler(e,n)}registerCsiHandler(e,n){return this._inputHandler.registerCsiHandler(e,n)}registerOscHandler(e,n){return this._inputHandler.registerOscHandler(e,n)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,n=this.optionsService.rawOptions.windowsPty;n&&n.buildNumber!==void 0&&n.buildNumber!==void 0?e=n.backend==="conpty"&&n.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(e=!0),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let e=[];e.push(this.onLineFeed(LO.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(LO(this._bufferService),!1))),this._windowsWrappingHeuristics.value=br(()=>{for(let n of e)n.dispose()})}}},are={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:["'",'"']};function ore(e,n,r,i){var o;let s={type:0,cancel:!1,key:void 0},a=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key==="UIKeyInputUpArrow"?n?s.key=nt.ESC+"OA":s.key=nt.ESC+"[A":e.key==="UIKeyInputLeftArrow"?n?s.key=nt.ESC+"OD":s.key=nt.ESC+"[D":e.key==="UIKeyInputRightArrow"?n?s.key=nt.ESC+"OC":s.key=nt.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(n?s.key=nt.ESC+"OB":s.key=nt.ESC+"[B");break;case 8:s.key=e.ctrlKey?"\b":nt.DEL,e.altKey&&(s.key=nt.ESC+s.key);break;case 9:if(e.shiftKey){s.key=nt.ESC+"[Z";break}s.key=nt.HT,s.cancel=!0;break;case 13:s.key=e.altKey?nt.ESC+nt.CR:nt.CR,s.cancel=!0;break;case 27:s.key=nt.ESC,e.altKey&&(s.key=nt.ESC+nt.ESC),s.cancel=!0;break;case 37:if(e.metaKey)break;a?s.key=nt.ESC+"[1;"+(a+1)+"D":n?s.key=nt.ESC+"OD":s.key=nt.ESC+"[D";break;case 39:if(e.metaKey)break;a?s.key=nt.ESC+"[1;"+(a+1)+"C":n?s.key=nt.ESC+"OC":s.key=nt.ESC+"[C";break;case 38:if(e.metaKey)break;a?s.key=nt.ESC+"[1;"+(a+1)+"A":n?s.key=nt.ESC+"OA":s.key=nt.ESC+"[A";break;case 40:if(e.metaKey)break;a?s.key=nt.ESC+"[1;"+(a+1)+"B":n?s.key=nt.ESC+"OB":s.key=nt.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(s.key=nt.ESC+"[2~");break;case 46:a?s.key=nt.ESC+"[3;"+(a+1)+"~":s.key=nt.ESC+"[3~";break;case 36:a?s.key=nt.ESC+"[1;"+(a+1)+"H":n?s.key=nt.ESC+"OH":s.key=nt.ESC+"[H";break;case 35:a?s.key=nt.ESC+"[1;"+(a+1)+"F":n?s.key=nt.ESC+"OF":s.key=nt.ESC+"[F";break;case 33:e.shiftKey?s.type=2:e.ctrlKey?s.key=nt.ESC+"[5;"+(a+1)+"~":s.key=nt.ESC+"[5~";break;case 34:e.shiftKey?s.type=3:e.ctrlKey?s.key=nt.ESC+"[6;"+(a+1)+"~":s.key=nt.ESC+"[6~";break;case 112:a?s.key=nt.ESC+"[1;"+(a+1)+"P":s.key=nt.ESC+"OP";break;case 113:a?s.key=nt.ESC+"[1;"+(a+1)+"Q":s.key=nt.ESC+"OQ";break;case 114:a?s.key=nt.ESC+"[1;"+(a+1)+"R":s.key=nt.ESC+"OR";break;case 115:a?s.key=nt.ESC+"[1;"+(a+1)+"S":s.key=nt.ESC+"OS";break;case 116:a?s.key=nt.ESC+"[15;"+(a+1)+"~":s.key=nt.ESC+"[15~";break;case 117:a?s.key=nt.ESC+"[17;"+(a+1)+"~":s.key=nt.ESC+"[17~";break;case 118:a?s.key=nt.ESC+"[18;"+(a+1)+"~":s.key=nt.ESC+"[18~";break;case 119:a?s.key=nt.ESC+"[19;"+(a+1)+"~":s.key=nt.ESC+"[19~";break;case 120:a?s.key=nt.ESC+"[20;"+(a+1)+"~":s.key=nt.ESC+"[20~";break;case 121:a?s.key=nt.ESC+"[21;"+(a+1)+"~":s.key=nt.ESC+"[21~";break;case 122:a?s.key=nt.ESC+"[23;"+(a+1)+"~":s.key=nt.ESC+"[23~";break;case 123:a?s.key=nt.ESC+"[24;"+(a+1)+"~":s.key=nt.ESC+"[24~";break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?s.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?s.key=nt.NUL:e.keyCode>=51&&e.keyCode<=55?s.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?s.key=nt.DEL:e.keyCode===219?s.key=nt.ESC:e.keyCode===220?s.key=nt.FS:e.keyCode===221&&(s.key=nt.GS);else if((!r||i)&&e.altKey&&!e.metaKey){let l=(o=are[e.keyCode])==null?void 0:o[e.shiftKey?1:0];if(l)s.key=nt.ESC+l;else if(e.keyCode>=65&&e.keyCode<=90){let u=e.ctrlKey?e.keyCode-64:e.keyCode+32,d=String.fromCharCode(u);e.shiftKey&&(d=d.toUpperCase()),s.key=nt.ESC+d}else if(e.keyCode===32)s.key=nt.ESC+(e.ctrlKey?nt.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let u=e.code.slice(3,4);e.shiftKey||(u=u.toLowerCase()),s.key=nt.ESC+u,s.cancel=!0}}else r&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(s.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?s.key=e.key:e.key&&e.ctrlKey&&(e.key==="_"&&(s.key=nt.US),e.key==="@"&&(s.key=nt.NUL));break}return s}var Ir=0,lre=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new qx,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new qx,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(e){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((s,a)=>this._getKey(s)-this._getKey(a)),n=0,r=0,i=new Array(this._array.length+this._insertedValues.length);for(let s=0;s<i.length;s++)r>=this._array.length||this._getKey(e[n])<=this._getKey(this._array[r])?(i[s]=e[n],n++):i[s]=this._array[r++];this._array=i,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),this._array.length===0)return!1;let n=this._getKey(e);if(n===void 0||(Ir=this._search(n),Ir===-1)||this._getKey(this._array[Ir])!==n)return!1;do if(this._array[Ir]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(Ir),!0;while(++Ir<this._array.length&&this._getKey(this._array[Ir])===n);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((s,a)=>s-a),n=0,r=new Array(this._array.length-e.length),i=0;for(let s=0;s<this._array.length;s++)e[n]===s?n++:r[i++]=this._array[s];this._array=r,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(Ir=this._search(e),!(Ir<0||Ir>=this._array.length)&&this._getKey(this._array[Ir])===e))do yield this._array[Ir];while(++Ir<this._array.length&&this._getKey(this._array[Ir])===e)}forEachByKey(e,n){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(Ir=this._search(e),!(Ir<0||Ir>=this._array.length)&&this._getKey(this._array[Ir])===e))do n(this._array[Ir]);while(++Ir<this._array.length&&this._getKey(this._array[Ir])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let n=0,r=this._array.length-1;for(;r>=n;){let i=n+r>>1,s=this._getKey(this._array[i]);if(s>e)r=i-1;else if(s<e)n=i+1;else{for(;i>0&&this._getKey(this._array[i-1])===e;)i--;return i}}return n}},Rw=0,VO=0,cre=class extends ln{constructor(){super(),this._decorations=new lre(e=>e==null?void 0:e.marker.line),this._onDecorationRegistered=this._register(new gt),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new gt),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(br(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let n=new ure(e);if(n){let r=n.marker.onDispose(()=>n.dispose()),i=n.onDispose(()=>{i.dispose(),n&&(this._decorations.delete(n)&&this._onDecorationRemoved.fire(n),r.dispose())});this._decorations.insert(n),this._onDecorationRegistered.fire(n)}return n}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,n,r){let i=0,s=0;for(let a of this._decorations.getKeyIterator(n))i=a.options.x??0,s=i+(a.options.width??1),e>=i&&e<s&&(!r||(a.options.layer??"bottom")===r)&&(yield a)}forEachDecorationAtCell(e,n,r,i){this._decorations.forEachByKey(n,s=>{Rw=s.options.x??0,VO=Rw+(s.options.width??1),e>=Rw&&e<VO&&(!r||(s.options.layer??"bottom")===r)&&i(s)})}},ure=class extends Qc{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new gt),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new gt),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=Sr.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=Sr.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},dre=1e3,hre=class{constructor(e,n=dre){this._renderCallback=e,this._debounceThresholdMS=n,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,n,r){this._rowCount=r,e=e!==void 0?e:0,n=n!==void 0?n:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,n):n;let i=performance.now();if(i-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=i,this._innerRefresh();else if(!this._additionalRefreshRequested){let s=i-this._lastRefreshMs,a=this._debounceThresholdMS-s;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},a)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),n=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,n)}},KO=20,Ux=class extends ln{constructor(e,n,r,i){super(),this._terminal=e,this._coreBrowserService=r,this._renderService=i,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let s=this._coreBrowserService.mainDocument;this._accessibilityContainer=s.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=s.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let a=0;a<this._terminal.rows;a++)this._rowElements[a]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[a]);if(this._topBoundaryFocusListener=a=>this._handleBoundaryFocus(a,0),this._bottomBoundaryFocusListener=a=>this._handleBoundaryFocus(a,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=s.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new hre(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(a=>this._handleResize(a.rows))),this._register(this._terminal.onRender(a=>this._refreshRows(a.start,a.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(a=>this._handleChar(a))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
`))),this._register(this._terminal.onA11yTab(a=>this._handleTab(a))),this._register(this._terminal.onKey(a=>this._handleKey(a.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(Xt(s,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(br(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let n=0;n<e;n++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<KO+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===KO+1&&(this._liveRegion.textContent+=dC.get())))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(e)||this._charsToConsume.push(e)}_refreshRows(e,n){this._liveRegionDebouncer.refresh(e,n,this._terminal.rows)}_renderRows(e,n){let r=this._terminal.buffer,i=r.lines.length.toString();for(let s=e;s<=n;s++){let a=r.lines.get(r.ydisp+s),o=[],l=(a==null?void 0:a.translateToString(!0,void 0,void 0,o))||"",u=(r.ydisp+s+1).toString(),d=this._rowElements[s];d&&(l.length===0?(d.textContent=" ",this._rowColumns.set(d,[0,1])):(d.textContent=l,this._rowColumns.set(d,o)),d.setAttribute("aria-posinset",u),d.setAttribute("aria-setsize",i),this._alignRowWidth(d))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,n){let r=e.target,i=this._rowElements[n===0?1:this._rowElements.length-2],s=r.getAttribute("aria-posinset"),a=n===0?"1":`${this._terminal.buffer.lines.length}`;if(s===a||e.relatedTarget!==i)return;let o,l;if(n===0?(o=r,l=this._rowElements.pop(),this._rowContainer.removeChild(l)):(o=this._rowElements.shift(),l=r,this._rowContainer.removeChild(o)),o.removeEventListener("focus",this._topBoundaryFocusListener),l.removeEventListener("focus",this._bottomBoundaryFocusListener),n===0){let u=this._createAccessibilityTreeNode();this._rowElements.unshift(u),this._rowContainer.insertAdjacentElement("afterbegin",u)}else{let u=this._createAccessibilityTreeNode();this._rowElements.push(u),this._rowContainer.appendChild(u)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(n===0?-1:1),this._rowElements[n===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){var l;if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error("anchorNode and/or focusNode are null");return}let n={node:e.anchorNode,offset:e.anchorOffset},r={node:e.focusNode,offset:e.focusOffset};if((n.node.compareDocumentPosition(r.node)&Node.DOCUMENT_POSITION_PRECEDING||n.node===r.node&&n.offset>r.offset)&&([n,r]=[r,n]),n.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(n={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(n.node))return;let i=this._rowElements.slice(-1)[0];if(r.node.compareDocumentPosition(i)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(r={node:i,offset:((l=i.textContent)==null?void 0:l.length)??0}),!this._rowContainer.contains(r.node))return;let s=({node:u,offset:d})=>{let p=u instanceof Text?u.parentNode:u,f=parseInt(p==null?void 0:p.getAttribute("aria-posinset"),10)-1;if(isNaN(f))return console.warn("row is invalid. Race condition?"),null;let g=this._rowColumns.get(p);if(!g)return console.warn("columns is null. Race condition?"),null;let _=d<g.length?g[d]:g.slice(-1)[0]+1;return _>=this._terminal.cols&&(++f,_=0),{row:f,column:_}},a=s(n),o=s(r);if(!(!a||!o)){if(a.row>o.row||a.row===o.row&&a.column>=o.column)throw new Error("invalid range");this._terminal.select(a.column,a.row,(o.row-a.row)*this._terminal.cols-a.column+o.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let n=this._rowContainer.children.length;n<this._terminal.rows;n++)this._rowElements[n]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[n]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){var s,a;e.style.transform="";let n=e.getBoundingClientRect().width,r=(a=(s=this._rowColumns.get(e))==null?void 0:s.slice(-1))==null?void 0:a[0];if(!r)return;let i=r*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${i/n})`}};Ux=Dr([At(1,bE),At(2,Ql),At(3,Zl)],Ux);var VC=class extends ln{constructor(e,n,r,i,s){super(),this._element=e,this._mouseService=n,this._renderService=r,this._bufferService=i,this._linkProviderService=s,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new gt),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new gt),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(br(()=>{var a;bd(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,(a=this._activeProviderReplies)==null||a.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(Xt(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(Xt(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(Xt(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(Xt(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let n=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!n)return;this._isMouseOut=!1;let r=e.composedPath();for(let i=0;i<r.length;i++){let s=r[i];if(s.classList.contains("xterm"))break;if(s.classList.contains("xterm-hover"))return}(!this._lastBufferCell||n.x!==this._lastBufferCell.x||n.y!==this._lastBufferCell.y)&&(this._handleHover(n),this._lastBufferCell=n)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized){this._clearCurrentLink(),this._askForLink(e,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,n){var i,s;(!this._activeProviderReplies||!n)&&((i=this._activeProviderReplies)==null||i.forEach(a=>{a==null||a.forEach(o=>{o.link.dispose&&o.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let r=!1;for(let[a,o]of this._linkProviderService.linkProviders.entries())n?(s=this._activeProviderReplies)!=null&&s.get(a)&&(r=this._checkLinkProviderResult(a,e,r)):o.provideLinks(e.y,l=>{var d,p;if(this._isMouseOut)return;let u=l==null?void 0:l.map(f=>({link:f}));(d=this._activeProviderReplies)==null||d.set(a,u),r=this._checkLinkProviderResult(a,e,r),((p=this._activeProviderReplies)==null?void 0:p.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,n){let r=new Set;for(let i=0;i<n.size;i++){let s=n.get(i);if(s)for(let a=0;a<s.length;a++){let o=s[a],l=o.link.range.start.y<e?0:o.link.range.start.x,u=o.link.range.end.y>e?this._bufferService.cols:o.link.range.end.x;for(let d=l;d<=u;d++){if(r.has(d)){s.splice(a--,1);break}r.add(d)}}}}_checkLinkProviderResult(e,n,r){var a;if(!this._activeProviderReplies)return r;let i=this._activeProviderReplies.get(e),s=!1;for(let o=0;o<e;o++)(!this._activeProviderReplies.has(o)||this._activeProviderReplies.get(o))&&(s=!0);if(!s&&i){let o=i.find(l=>this._linkAtPosition(l.link,n));o&&(r=!0,this._handleNewLink(o))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!r)for(let o=0;o<this._activeProviderReplies.size;o++){let l=(a=this._activeProviderReplies.get(o))==null?void 0:a.find(u=>this._linkAtPosition(u.link,n));if(l){r=!0,this._handleNewLink(l);break}}return r}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let n=this._positionFromMouseEvent(e,this._element,this._mouseService);n&&this._mouseDownLink&&fre(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,n)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,n){!this._currentLink||!this._lastMouseEvent||(!e||!n||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=n)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,bd(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let n=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);n&&this._linkAtPosition(e.link,n)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0?!0:e.link.decorations.underline,pointerCursor:e.link.decorations===void 0?!0:e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>{var r,i;return(i=(r=this._currentLink)==null?void 0:r.state)==null?void 0:i.decorations.pointerCursor},set:r=>{var i;(i=this._currentLink)!=null&&i.state&&this._currentLink.state.decorations.pointerCursor!==r&&(this._currentLink.state.decorations.pointerCursor=r,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",r))}},underline:{get:()=>{var r,i;return(i=(r=this._currentLink)==null?void 0:r.state)==null?void 0:i.decorations.underline},set:r=>{var i,s,a;(i=this._currentLink)!=null&&i.state&&((a=(s=this._currentLink)==null?void 0:s.state)==null?void 0:a.decorations.underline)!==r&&(this._currentLink.state.decorations.underline=r,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,r))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(r=>{if(!this._currentLink)return;let i=r.start===0?0:r.start+1+this._bufferService.buffer.ydisp,s=this._bufferService.buffer.ydisp+1+r.end;if(this._currentLink.link.range.start.y>=i&&this._currentLink.link.range.end.y<=s&&(this._clearCurrentLink(i,s),this._lastMouseEvent)){let a=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);a&&this._askForLink(a,!1)}})))}_linkHover(e,n,r){var i;(i=this._currentLink)!=null&&i.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(n,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),n.hover&&n.hover(r,n.text)}_fireUnderlineEvent(e,n){let r=e.range,i=this._bufferService.buffer.ydisp,s=this._createLinkUnderlineEvent(r.start.x-1,r.start.y-i-1,r.end.x,r.end.y-i-1,void 0);(n?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(s)}_linkLeave(e,n,r){var i;(i=this._currentLink)!=null&&i.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(n,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),n.leave&&n.leave(r,n.text)}_linkAtPosition(e,n){let r=e.range.start.y*this._bufferService.cols+e.range.start.x,i=e.range.end.y*this._bufferService.cols+e.range.end.x,s=n.y*this._bufferService.cols+n.x;return r<=s&&s<=i}_positionFromMouseEvent(e,n,r){let i=r.getCoords(e,n,this._bufferService.cols,this._bufferService.rows);if(i)return{x:i[0],y:i[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,n,r,i,s){return{x1:e,y1:n,x2:r,y2:i,cols:this._bufferService.cols,fg:s}}};VC=Dr([At(1,kE),At(2,Zl),At(3,ss),At(4,oz)],VC);function fre(e,n){return e.text===n.text&&e.range.start.x===n.range.start.x&&e.range.start.y===n.range.start.y&&e.range.end.x===n.range.end.x&&e.range.end.y===n.range.end.y}var pre=class extends sre{constructor(e={}){super(e),this._linkifier=this._register(new bf),this.browser=jz,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new bf),this._onCursorMove=this._register(new gt),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new gt),this.onKey=this._onKey.event,this._onRender=this._register(new gt),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new gt),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new gt),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new gt),this.onBell=this._onBell.event,this._onFocus=this._register(new gt),this._onBlur=this._register(new gt),this._onA11yCharEmitter=this._register(new gt),this._onA11yTabEmitter=this._register(new gt),this._onWillOpen=this._register(new gt),this._setup(),this._decorationService=this._instantiationService.createInstance(cre),this._instantiationService.setService(lv,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(rne),this._instantiationService.setService(oz,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(fC)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(n=>this.refresh((n==null?void 0:n.start)??0,(n==null?void 0:n.end)??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(n=>this._reportWindowsOptions(n))),this._register(this._inputHandler.onColor(n=>this._handleColorEvent(n))),this._register(Ei.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(Ei.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(Ei.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(Ei.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(n=>this._afterResize(n.cols,n.rows))),this._register(br(()=>{var n,r;this._customKeyEventHandler=void 0,(r=(n=this.element)==null?void 0:n.parentNode)==null||r.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}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}_handleColorEvent(e){if(this._themeService)for(let n of e){let r,i="";switch(n.index){case 256:r="foreground",i="10";break;case 257:r="background",i="11";break;case 258:r="cursor",i="12";break;default:r="ansi",i="4;"+n.index}switch(n.type){case 0:let s=lr.toColorRGB(r==="ansi"?this._themeService.colors.ansi[n.index]:this._themeService.colors[r]);this.coreService.triggerDataEvent(`${nt.ESC}]${i};${Jne(s)}${Sz.ST}`);break;case 1:if(r==="ansi")this._themeService.modifyColors(a=>a.ansi[n.index]=Yr.toColor(...n.color));else{let a=r;this._themeService.modifyColors(o=>o[a]=Yr.toColor(...n.color))}break;case 2:this._themeService.restoreColor(n.index);break}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(Ux,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(nt.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var e;return(e=this.textarea)==null?void 0:e.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(nt.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,n=this.buffer.lines.get(e);if(!n)return;let r=Math.min(this.buffer.x,this.cols-1),i=this._renderService.dimensions.css.cell.height,s=n.getWidth(r),a=this._renderService.dimensions.css.cell.width*s,o=this.buffer.y*this._renderService.dimensions.css.cell.height,l=r*this._renderService.dimensions.css.cell.width;this.textarea.style.left=l+"px",this.textarea.style.top=o+"px",this.textarea.style.width=a+"px",this.textarea.style.height=i+"px",this.textarea.style.lineHeight=i+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(Xt(this.element,"copy",n=>{this.hasSelection()&&yee(n,this._selectionService)}));let e=n=>_ee(n,this.textarea,this.coreService,this.optionsService);this._register(Xt(this.textarea,"paste",e)),this._register(Xt(this.element,"paste",e)),Nz?this._register(Xt(this.element,"mousedown",n=>{n.button===2&&rO(n,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(Xt(this.element,"contextmenu",n=>{rO(n,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),TE&&this._register(Xt(this.element,"auxclick",n=>{n.button===1&&ZB(n,this.textarea,this.screenElement)}))}_bindKeys(){this._register(Xt(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(Xt(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(Xt(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(Xt(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(Xt(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(Xt(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(Xt(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){var s;if(!e)throw new Error("Terminal requires a parent element.");if(e.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((s=this.element)==null?void 0:s.ownerDocument.defaultView)&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=e.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"),e.appendChild(this.element);let n=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),n.appendChild(this._viewportElement),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._register(Xt(this.screenElement,"mousemove",a=>this.updateCursorStyle(a))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),n.appendChild(this.screenElement);let r=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",uC.get()),Tz||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._register(this.optionsService.onSpecificOptionChange("disableStdin",()=>r.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(tne,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(Ql,this._coreBrowserService),this._register(Xt(this.textarea,"focus",a=>this._handleTextAreaFocus(a))),this._register(Xt(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(DC,this._document,this._helperContainer),this._instantiationService.setService(d0,this._charSizeService),this._themeService=this._instantiationService.createInstance(BC),this._instantiationService.setService(Yf,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(Hx),this._instantiationService.setService(az,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(LC,this.rows,this.screenElement)),this._instantiationService.setService(Zl,this._renderService),this._register(this._renderService.onRenderedViewportChange(a=>this._onRender.fire(a))),this.onResize(a=>this._renderService.resize(a.cols,a.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(MC,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(PC),this._instantiationService.setService(kE,this._mouseService);let i=this._linkifier.value=this._register(this._instantiationService.createInstance(VC,this.screenElement));this.element.appendChild(n);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),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._viewport=this._register(this._instantiationService.createInstance(AC,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(a=>{super.scrollLines(a,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(IC,this.element,this.screenElement,i)),this._instantiationService.setService(Nee,this._selectionService),this._register(this._selectionService.onRequestScrollLines(a=>this.scrollLines(a.amount,a.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(a=>this._renderService.handleSelectionChanged(a.start,a.end,a.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(a=>{this.textarea.value=a,this.textarea.focus(),this.textarea.select()})),this._register(Ei.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{var a;this._selectionService.refresh(),(a=this._viewport)==null||a.queueSync()})),this._register(this._instantiationService.createInstance(TC,this.screenElement)),this._register(Xt(this.element,"mousedown",a=>this._selectionService.handleMouseDown(a))),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(Ux,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",a=>this._handleScreenReaderModeOptionChange(a))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Fx,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",a=>{!this._overviewRulerRenderer&&a&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Fx,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(OC,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,n=this.element;function r(a){var d,p,f,g,_;let o=e._mouseService.getMouseReportCoords(a,e.screenElement);if(!o)return!1;let l,u;switch(a.overrideType||a.type){case"mousemove":u=32,a.buttons===void 0?(l=3,a.button!==void 0&&(l=a.button<3?a.button:3)):l=a.buttons&1?0:a.buttons&4?1:a.buttons&2?2:3;break;case"mouseup":u=0,l=a.button<3?a.button:3;break;case"mousedown":u=1,l=a.button<3?a.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(a)===!1)return!1;let x=a.deltaY;if(x===0||e.coreMouseService.consumeWheelEvent(a,(g=(f=(p=(d=e._renderService)==null?void 0:d.dimensions)==null?void 0:p.device)==null?void 0:f.cell)==null?void 0:g.height,(_=e._coreBrowserService)==null?void 0:_.dpr)===0)return!1;u=x<0?0:1,l=4;break;default:return!1}return u===void 0||l===void 0||l>4?!1:e.coreMouseService.triggerMouseEvent({col:o.col,row:o.row,x:o.x,y:o.y,button:l,action:u,ctrl:a.ctrlKey,alt:a.altKey,shift:a.shiftKey})}let i={mouseup:null,wheel:null,mousedrag:null,mousemove:null},s={mouseup:a=>(r(a),a.buttons||(this._document.removeEventListener("mouseup",i.mouseup),i.mousedrag&&this._document.removeEventListener("mousemove",i.mousedrag)),this.cancel(a)),wheel:a=>(r(a),this.cancel(a,!0)),mousedrag:a=>{a.buttons&&r(a)},mousemove:a=>{a.buttons||r(a)}};this._register(this.coreMouseService.onProtocolChange(a=>{a?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(a)),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()),a&8?i.mousemove||(n.addEventListener("mousemove",s.mousemove),i.mousemove=s.mousemove):(n.removeEventListener("mousemove",i.mousemove),i.mousemove=null),a&16?i.wheel||(n.addEventListener("wheel",s.wheel,{passive:!1}),i.wheel=s.wheel):(n.removeEventListener("wheel",i.wheel),i.wheel=null),a&2?i.mouseup||(i.mouseup=s.mouseup):(this._document.removeEventListener("mouseup",i.mouseup),i.mouseup=null),a&4?i.mousedrag||(i.mousedrag=s.mousedrag):(this._document.removeEventListener("mousemove",i.mousedrag),i.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(Xt(n,"mousedown",a=>{if(a.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(a)))return r(a),i.mouseup&&this._document.addEventListener("mouseup",i.mouseup),i.mousedrag&&this._document.addEventListener("mousemove",i.mousedrag),this.cancel(a)})),this._register(Xt(n,"wheel",a=>{var o,l,u,d,p;if(!i.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(a)===!1)return!1;if(!this.buffer.hasScrollback){if(a.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(a,(d=(u=(l=(o=e._renderService)==null?void 0:o.dimensions)==null?void 0:l.device)==null?void 0:u.cell)==null?void 0:d.height,(p=e._coreBrowserService)==null?void 0:p.dpr)===0)return this.cancel(a,!0);let f=nt.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(a.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(f,!0),this.cancel(a,!0)}}},{passive:!1}))}refresh(e,n){var r;(r=this._renderService)==null||r.refreshRows(e,n)}updateCursorStyle(e){var n;(n=this._selectionService)!=null&&n.shouldColumnSelect(e)?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(e,n){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,n),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let n=e-this._bufferService.buffer.ydisp;n!==0&&this.scrollLines(n)}paste(e){QB(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let n=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),n}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return this._selectionService?this._selectionService.hasSelection:!1}select(e,n,r){this._selectionService.setSelection(e,n,r)}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 e;(e=this._selectionService)==null||e.clearSelection()}selectAll(){var e;(e=this._selectionService)==null||e.selectAll()}selectLines(e,n){var r;(r=this._selectionService)==null||r.selectLines(e,n)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;let n=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!n&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!n&&(e.key==="Dead"||e.key==="AltGraph")&&(this._unprocessedDeadKey=!0);let r=ore(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),r.type===3||r.type===2){let i=this.rows-1;return this.scrollLines(r.type===2?-i:i),this.cancel(e,!0)}if(r.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(r.cancel&&this.cancel(e,!0),!r.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((r.key===nt.ETX||r.key===nt.CR)&&(this.textarea.value=""),this._onKey.fire({key:r.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(r.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,n){let r=e.isMac&&!this.options.macOptionIsMeta&&n.altKey&&!n.ctrlKey&&!n.metaKey||e.isWindows&&n.altKey&&n.ctrlKey&&!n.metaKey||e.isWindows&&n.getModifierState("AltGraph");return n.type==="keypress"?r:r&&(!n.keyCode||n.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(mre(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let n;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;if(this.cancel(e),e.charCode)n=e.charCode;else if(e.which===null||e.which===void 0)n=e.keyCode;else if(e.which!==0&&e.charCode!==0)n=e.which;else return!1;return!n||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)?!1:(n=String.fromCharCode(n),this._onKey.fire({key:n,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(n,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(e){if(e.data&&e.inputType==="insertText"&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let n=e.data;return this.coreService.triggerDataEvent(n,!0),this.cancel(e),!0}return!1}resize(e,n){if(e===this.cols&&n===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,n)}_afterResize(e,n){var r;(r=this._charSizeService)==null||r.measure()}clear(){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 e=1;e<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(Kr));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){var n;this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),(n=this._selectionService)==null||n.reset(),this._decorationService.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){var e;(e=this._renderService)==null||e.clearTextureAtlas()}_reportFocus(){var e;(e=this.element)!=null&&e.classList.contains("focus")?this.coreService.triggerDataEvent(nt.ESC+"[I"):this.coreService.triggerDataEvent(nt.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let n=this._renderService.dimensions.css.canvas.width.toFixed(0),r=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${nt.ESC}[4;${r};${n}t`);break;case 1:let i=this._renderService.dimensions.css.cell.width.toFixed(0),s=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${nt.ESC}[6;${s};${i}t`);break}}cancel(e,n){if(!(!this.options.cancelEvents&&!n))return e.preventDefault(),e.stopPropagation(),!1}};function mre(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var gre=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,n){let r={instance:n,dispose:n.dispose,isDisposed:!1};this._addons.push(r),n.dispose=()=>this._wrappedAddonDispose(r),n.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let n=-1;for(let r=0;r<this._addons.length;r++)if(this._addons[r]===e){n=r;break}if(n===-1)throw new Error("Could not dispose an addon that has not been loaded");e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(n,1)}},vre=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,n){if(!(e<0||e>=this._line.length))return n?(this._line.loadCell(e,n),n):this._line.loadCell(e,new ja)}translateToString(e,n,r){return this._line.translateToString(e,n,r)}},YO=class{constructor(e,n){this._buffer=e,this.type=n}init(e){return this._buffer=e,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(e){let n=this._buffer.lines.get(e);if(n)return new vre(n)}getNullCell(){return new ja}},yre=class extends ln{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new gt),this.onBufferChange=this._onBufferChange.event,this._normal=new YO(this._core.buffers.normal,"normal"),this._alternate=new YO(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)}},_re=class{constructor(e){this._core=e}registerCsiHandler(e,n){return this._core.registerCsiHandler(e,r=>n(r.toArray()))}addCsiHandler(e,n){return this.registerCsiHandler(e,n)}registerDcsHandler(e,n){return this._core.registerDcsHandler(e,(r,i)=>n(r,i.toArray()))}addDcsHandler(e,n){return this.registerDcsHandler(e,n)}registerEscHandler(e,n){return this._core.registerEscHandler(e,n)}addEscHandler(e,n){return this.registerEscHandler(e,n)}registerOscHandler(e,n){return this._core.registerOscHandler(e,n)}addOscHandler(e,n){return this.registerOscHandler(e,n)}},xre=class{constructor(e){this._core=e}register(e){this._core.unicodeService.register(e)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(e){this._core.unicodeService.activeVersion=e}},bre=["cols","rows"],xo=0,$z=class extends ln{constructor(e){super(),this._core=this._register(new pre(e)),this._addonManager=this._register(new gre),this._publicOptions={...this._core.options};let n=i=>this._core.options[i],r=(i,s)=>{this._checkReadonlyOptions(i),this._core.options[i]=s};for(let i in this._core.options){let s={get:n.bind(this,i),set:r.bind(this,i)};Object.defineProperty(this._publicOptions,i,s)}}_checkReadonlyOptions(e){if(bre.includes(e))throw new Error(`Option "${e}" 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 _re(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new xre(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 yre(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,n="none";switch(this._core.coreMouseService.activeProtocol){case"X10":n="x10";break;case"VT200":n="vt200";break;case"DRAG":n="drag";break;case"ANY":n="any";break}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:n,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,synchronizedOutputMode:e.synchronizedOutput,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let n in e)this._publicOptions[n]=e[n]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,n=!0){this._core.input(e,n)}resize(e,n){this._verifyIntegers(e,n),this._core.resize(e,n)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,n,r){this._verifyIntegers(e,n,r),this._core.select(e,n,r)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,n){this._verifyIntegers(e,n),this._core.selectLines(e,n)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,n){this._core.write(e,n)}writeln(e,n){this._core.write(e),this._core.write(`\r
`,n)}paste(e){this._core.paste(e)}refresh(e,n){this._verifyIntegers(e,n),this._core.refresh(e,n)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return uC.get()},set promptLabel(e){uC.set(e)},get tooMuchOutput(){return dC.get()},set tooMuchOutput(e){dC.set(e)}}}_verifyIntegers(...e){for(xo of e)if(xo===1/0||isNaN(xo)||xo%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(xo of e)if(xo&&(xo===1/0||isNaN(xo)||xo%1!==0||xo<0))throw new Error("This API only accepts positive integers")}};/**
 * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
 * @license MIT
 *
 * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
 * @license MIT
 *
 * Originally forked from (with the author's permission):
 *   Fabrice Bellard's javascript vt100 for jslinux:
 *   http://bellard.org/jslinux/
 *   Copyright (c) 2011 Fabrice Bellard
 */var kre=2,wre=1,Fz=class{activate(n){this._terminal=n}dispose(){}fit(){let n=this.proposeDimensions();if(!n||!this._terminal||isNaN(n.cols)||isNaN(n.rows))return;let r=this._terminal._core;(this._terminal.rows!==n.rows||this._terminal.cols!==n.cols)&&(r._renderService.clear(),this._terminal.resize(n.cols,n.rows))}proposeDimensions(){var g;if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let n=this._terminal._core._renderService.dimensions;if(n.css.cell.width===0||n.css.cell.height===0)return;let r=this._terminal.options.scrollback===0?0:((g=this._terminal.options.overviewRuler)==null?void 0:g.width)||14,i=window.getComputedStyle(this._terminal.element.parentElement),s=parseInt(i.getPropertyValue("height")),a=Math.max(0,parseInt(i.getPropertyValue("width"))),o=window.getComputedStyle(this._terminal.element),l={top:parseInt(o.getPropertyValue("padding-top")),bottom:parseInt(o.getPropertyValue("padding-bottom")),right:parseInt(o.getPropertyValue("padding-right")),left:parseInt(o.getPropertyValue("padding-left"))},u=l.top+l.bottom,d=l.right+l.left,p=s-u,f=a-d-r;return{cols:Math.max(kre,Math.floor(f/n.css.cell.width)),rows:Math.max(wre,Math.floor(p/n.css.cell.height))}}};/**
 * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
 * @license MIT
 *
 * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
 * @license MIT
 *
 * Originally forked from (with the author's permission):
 *   Fabrice Bellard's javascript vt100 for jslinux:
 *   http://bellard.org/jslinux/
 *   Copyright (c) 2011 Fabrice Bellard
 */var Sre=class{constructor(n,r,i,s={}){this._terminal=n,this._regex=r,this._handler=i,this._options=s}provideLinks(n,r){let i=jre.computeLink(n,this._regex,this._terminal,this._handler);r(this._addCallbacks(i))}_addCallbacks(n){return n.map(r=>(r.leave=this._options.leave,r.hover=(i,s)=>{if(this._options.hover){let{range:a}=r;this._options.hover(i,s,a)}},r))}};function Cre(e){try{let n=new URL(e),r=n.password&&n.username?`${n.protocol}//${n.username}:${n.password}@${n.host}`:n.username?`${n.protocol}//${n.username}@${n.host}`:`${n.protocol}//${n.host}`;return e.toLocaleLowerCase().startsWith(r.toLocaleLowerCase())}catch{return!1}}var jre=class ox{static computeLink(n,r,i,s){let a=new RegExp(r.source,(r.flags||"")+"g"),[o,l]=ox._getWindowedLineStrings(n-1,i),u=o.join(""),d,p=[];for(;d=a.exec(u);){let f=d[0];if(!Cre(f))continue;let[g,_]=ox._mapStrIdx(i,l,0,d.index),[x,v]=ox._mapStrIdx(i,g,_,f.length);if(g===-1||_===-1||x===-1||v===-1)continue;let S={start:{x:_+1,y:g+1},end:{x:v,y:x+1}};p.push({range:S,text:f,activate:s})}return p}static _getWindowedLineStrings(n,r){let i,s=n,a=n,o=0,l="",u=[];if(i=r.buffer.active.getLine(n)){let d=i.translateToString(!0);if(i.isWrapped&&d[0]!==" "){for(o=0;(i=r.buffer.active.getLine(--s))&&o<2048&&(l=i.translateToString(!0),o+=l.length,u.push(l),!(!i.isWrapped||l.indexOf(" ")!==-1)););u.reverse()}for(u.push(d),o=0;(i=r.buffer.active.getLine(++a))&&i.isWrapped&&o<2048&&(l=i.translateToString(!0),o+=l.length,u.push(l),l.indexOf(" ")===-1););}return[u,s]}static _mapStrIdx(n,r,i,s){let a=n.buffer.active,o=a.getNullCell(),l=i;for(;s;){let u=a.getLine(r);if(!u)return[-1,-1];for(let d=l;d<u.length;++d){u.getCell(d,o);let p=o.getChars();if(o.getWidth()&&(s-=p.length||1,d===u.length-1&&p==="")){let f=a.getLine(r+1);f&&f.isWrapped&&(f.getCell(0,o),o.getWidth()===2&&(s+=1))}if(s<0)return[r,d]}r++,l=0}return[r,l]}},Nre=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function Ere(e,n){let r=window.open();if(r){try{r.opener=null}catch{}r.location.href=n}else console.warn("Opening link blocked as opener could not be cleared")}var Hz=class{constructor(n=Ere,r={}){this._handler=n,this._options=r}activate(n){this._terminal=n;let r=this._options,i=r.urlRegex||Nre;this._linkProvider=this._terminal.registerLinkProvider(new Sre(this._terminal,i,this._handler,r))}dispose(){var n;(n=this._linkProvider)==null||n.dispose()}};const Are={status:"/api/status",cost:"/api/cost",agents:"/api/agents",config:"/api/config",sessions:"/api/sessions",health:"/api/health",integrations:"/api/integrations"},Tre=["","\x1B[36m  Available commands:\x1B[0m","    status        runtime status","    cost          cost summary","    agents        list agents","    config        show config","    sessions      active sessions","    health        health snapshot","    integrations  list integrations","    clear         clear terminal","    help          this message",""].join(`\r
`),Mre=["","\x1B[36m  ╔═══════════════════════════════════════╗\x1B[0m","\x1B[36m  ║\x1B[0m  Revka Terminal v2.0                \x1B[36m║\x1B[0m",'\x1B[36m  ║\x1B[0m  Type \x1B[32m"help"\x1B[0m for available commands   \x1B[36m║\x1B[0m',"\x1B[36m  ╚═══════════════════════════════════════╝\x1B[0m",""].join(`\r
`);function GO(e){return{background:"#0b0d10",foreground:e.primary,cursor:e.cursorColor,cursorAccent:"#0b0d10",selectionBackground:"rgba(111,131,214,0.18)",selectionForeground:"#ffffff",black:"#1a1a1a",red:"#ff6b7a",green:"#2fbf75",yellow:"#ffc857",blue:"#8fa8c8",magenta:"#7c8ddd",cyan:"#8fa8c8",white:"#e6e6e6",brightBlack:"#4a4a4a",brightRed:"#ff8a97",brightGreen:"#55d18f",brightYellow:"#ffd980",brightBlue:"#a4bad6",brightMagenta:"#95a2e6",brightCyan:"#a4bad6",brightWhite:"#ffffff"}}function Rre(e,n,r){let i;Kf()&&Ti?i=Ti.replace(/^http/,"ws"):i=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}`;const s=new URLSearchParams,a=ns();return a&&s.set("token",a),s.set("session_id",e),n>0&&s.set("cols",String(n)),r>0&&s.set("rows",String(r)),`${i}${Gr}/ws/terminal?${s.toString()}`}function Ore({sessionId:e,config:n,colors:r,visible:i}){const s=b.useRef(null),a=b.useRef(null),o=b.useRef(null),l=b.useRef(null),u=b.useRef(""),[d,p]=b.useState("connecting"),f=b.useRef(d);f.current=d;const g=b.useRef(!1),_=b.useCallback(()=>{var v;(v=a.current)==null||v.write("\x1B[32m❯\x1B[0m ")},[]),x=b.useCallback(async v=>{const S=a.current;if(!S)return;const w=v.trim().toLowerCase();if(!w){_();return}if(w==="clear"){S.clear(),_();return}if(w==="help"){S.write(Tre),_();return}const N=Are[w];if(!N){S.write(`\x1B[31m  unknown command: ${w}\x1B[0m\r
`),S.write(`  type \x1B[32m"help"\x1B[0m to see available commands\r
`),_();return}g.current=!0,S.write("\x1B[33m  fetching…\x1B[0m");try{const C=await ut(N),T=JSON.stringify(C,null,2);S.write("\r\x1B[K");const A=T.split(`
`);for(const E of A)S.write(`  \x1B[32m${E}\x1B[0m\r
`)}catch(C){S.write("\r\x1B[K"),S.write(`\x1B[31m  error: ${C instanceof Error?C.message:String(C)}\x1B[0m\r
`)}finally{g.current=!1,_()}},[_]);return b.useEffect(()=>{if(!s.current)return;const v=new $z({cursorBlink:n.cursorBlink,cursorStyle:"bar",fontSize:n.fontSize,fontFamily:"JetBrains Mono, SF Mono, Menlo, Monaco, Consolas, monospace",lineHeight:1.2,scrollback:1e4,allowProposedApi:!0,theme:GO(r)}),S=new Fz;v.loadAddon(S),v.loadAddon(new Hz),v.open(s.current);try{S.fit()}catch{}a.current=v,o.current=S,v.write(Mre);let w=null,N=!1;try{const T=Rre(e,v.cols,v.rows);w=new WebSocket(T),w.binaryType="arraybuffer",l.current=w;const A=setTimeout(()=>{N=!0,w&&w.readyState!==WebSocket.OPEN&&w.close()},3e3);w.onopen=()=>{if(clearTimeout(A),N)return;p("pty"),v.write(`\x1B[36m  Connected to PTY terminal.\x1B[0m\r
\r
`);const E=JSON.stringify({type:"resize",cols:v.cols,rows:v.rows});w.send(E)},w.onmessage=E=>{typeof E.data=="string"?v.write(E.data):v.write(new Uint8Array(E.data))},w.onerror=()=>{clearTimeout(A),f.current!=="pty"&&(p("api"),v.write(`\x1B[33m  PTY not available — running in API command mode.\x1B[0m\r
\r
`),_())},w.onclose=()=>{clearTimeout(A),f.current==="pty"?(v.write(`\r
\x1B[33m  Terminal session ended.\x1B[0m\r
`),p("api"),_()):f.current==="connecting"&&(p("api"),v.write(`\x1B[33m  PTY not available — running in API command mode.\x1B[0m\r
\r
`),_())}}catch{p("api"),v.write(`\x1B[33m  PTY not available — running in API command mode.\x1B[0m\r
\r
`),_()}v.onData(T=>{var A;if(f.current==="pty"&&((A=l.current)==null?void 0:A.readyState)===WebSocket.OPEN){l.current.send(T);return}if(!(f.current!=="api"||g.current))for(const E of T)if(E==="\r"){v.write(`\r
`);const D=u.current;u.current="",x(D)}else E===""||E==="\b"?u.current.length>0&&(u.current=u.current.slice(0,-1),v.write("\b \b")):E===""?(v.write(`^C\r
`),u.current="",_()):E==="\f"?(v.clear(),_()):E>=" "&&(u.current+=E,v.write(E))}),v.onResize(({cols:T,rows:A})=>{var E;((E=l.current)==null?void 0:E.readyState)===WebSocket.OPEN&&l.current.send(JSON.stringify({type:"resize",cols:T,rows:A}))});const C=new ResizeObserver(()=>{try{S.fit()}catch{}});return C.observe(s.current),()=>{C.disconnect(),w&&(w.onopen=null,w.onmessage=null,w.onclose=null,w.onerror=null,w.close()),v.dispose(),a.current=null,o.current=null,l.current=null}},[e]),b.useEffect(()=>{a.current&&(a.current.options.theme=GO(r))},[r]),b.useEffect(()=>{a.current&&(a.current.options.cursorBlink=n.cursorBlink)},[n.cursorBlink]),b.useEffect(()=>{var v;if(a.current){a.current.options.fontSize=n.fontSize;try{(v=o.current)==null||v.fit()}catch{}}},[n.fontSize]),b.useEffect(()=>{i&&requestAnimationFrame(()=>{var v,S;try{(v=o.current)==null||v.fit()}catch{}(S=a.current)==null||S.focus()})},[i]),c.jsx("div",{ref:s,className:"min-h-0 flex-1",style:{display:i?"block":"none",padding:"4px 0"}})}const Wz=[{key:"claude",label:"Claude Code"},{key:"codex",label:"Codex"},{key:"opencode",label:"OpenCode"},{key:"gemini",label:"Gemini CLI"},{key:"operator",label:"Revka Operator"}],qz="revka-code-recent-repos",Uz=10;function vg(e){var n;return((n=Wz.find(r=>r.key===e))==null?void 0:n.label)??e}function Vz(e){if(!e)return"";const n=e.replace(/\/+$/,""),r=n.lastIndexOf("/");return r>=0?n.slice(r+1):n}function KC(){try{const e=localStorage.getItem(qz);if(!e)return[];const n=JSON.parse(e);return Array.isArray(n)?n.filter(r=>typeof r=="string").slice(0,Uz):[]}catch{return[]}}function Dre(e){try{const n=KC(),r=[e,...n.filter(i=>i!==e)].slice(0,Uz);localStorage.setItem(qz,JSON.stringify(r))}catch{}}function XO(){return null}async function Pre(e){const n={},r=ns();r&&(n.Authorization=`Bearer ${r}`);const i=await fetch(`${Gr}/api/mcp/discovery`,{signal:e,headers:n});return i.ok?await i.json():{available:!1,reason:`discovery http ${i.status}`}}function QO(e){return{background:"#0b0d10",foreground:e.primary,cursor:e.cursorColor,cursorAccent:"#0b0d10",selectionBackground:"rgba(111,131,214,0.18)",selectionForeground:"#ffffff",black:"#1a1a1a",red:"#ff6b7a",green:"#2fbf75",yellow:"#ffc857",blue:"#8fa8c8",magenta:"#7c8ddd",cyan:"#8fa8c8",white:"#e6e6e6",brightBlack:"#4a4a4a",brightRed:"#ff8a97",brightGreen:"#55d18f",brightYellow:"#ffd980",brightBlue:"#a4bad6",brightMagenta:"#95a2e6",brightCyan:"#a4bad6",brightWhite:"#ffffff"}}function Kz(){return Kf()&&Ti?Ti.replace(/^http/,"ws"):`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}`}function Lre(e,n,r){const i=new URLSearchParams,s=ns();return s&&i.set("token",s),i.set("tool",e.toolKey),i.set("cwd",e.cwd),i.set("mcp_session",e.sessionId),i.set("mcp_token",e.token),n>0&&i.set("cols",String(n)),r>0&&i.set("rows",String(r)),`${Kz()}${Gr}/ws/terminal?${i.toString()}`}function Ire(e){const n=new URLSearchParams,r=ns();return r&&n.set("token",r),n.set("session_id",e.sessionId),n.set("mcp_token",e.token),`${Kz()}${Gr}/ws/mcp/events?${n.toString()}`}function Bre(e){const n=e.tool&&e.tool.trim()?e.tool:`tool #${e.token}`,r=e.total??null;let i,s=null;r&&r>0?(i=`${e.progress} / ${r}`,s=Math.max(0,Math.min(1,e.progress/r))):e.message&&e.message.trim()?i=e.message:i=`step ${e.progress}`;const a=Date.parse(e.timestamp),o=Number.isFinite(a)?a:Date.now();return{title:n,progressLine:i,ratio:s,timestampMs:o,id:`${e.token}-${o}`}}function zre(e,n){const r=Math.max(0,Math.floor((n-e)/1e3));if(r<1)return"now";if(r<60)return`${r}s ago`;const i=Math.floor(r/60);return i<60?`${i}m ago`:`${Math.floor(i/60)}h ago`}const ZO=30,$re=2e4,Fre=3;function Hre(e){const[n,r]=b.useState([]),[i,s]=b.useState("connecting"),a=b.useRef(null),o=b.useRef(null),l=b.useRef(0),u=b.useRef(!1);return b.useEffect(()=>{if(!e)return;u.current=!1,l.current=0;const d=()=>{if(u.current)return;s("connecting");let f;try{f=new WebSocket(Ire(e))}catch{p();return}a.current=f,f.onopen=()=>{u.current||(l.current=0,s("open"))},f.onmessage=g=>{if(typeof g.data=="string")try{const _=JSON.parse(g.data);if("error"in _&&_.error){s("offline");return}if(typeof _.token!="number"||typeof _.progress!="number")return;r(x=>{const v=[...x,_];return v.length>ZO?v.slice(v.length-ZO):v})}catch{}},f.onerror=()=>{},f.onclose=()=>{u.current||p()}},p=()=>{if(u.current)return;if(l.current>=Fre){s("offline");return}const f=l.current;l.current=f+1;const g=500+f*1e3+f*f*500;o.current=window.setTimeout(d,g)};return d(),()=>{u.current=!0,o.current!==null&&(window.clearTimeout(o.current),o.current=null);const f=a.current;if(f){f.onopen=null,f.onmessage=null,f.onerror=null,f.onclose=null;try{f.close()}catch{}}a.current=null}},[e]),{events:n,status:i}}function Wre({events:e,status:n,colors:r}){const[i,s]=b.useState(()=>Date.now());b.useEffect(()=>{const l=window.setInterval(()=>s(Date.now()),1e3);return()=>window.clearInterval(l)},[]);const a=b.useMemo(()=>e.map(Bre),[e]),o={borderColor:"var(--revka-border-soft)",background:"color-mix(in srgb, var(--revka-bg-surface) 92%, transparent)",minHeight:64,maxHeight:96};return n==="offline"?c.jsxs("div",{role:"status","aria-live":"polite",className:"flex items-center gap-2 border-b px-3 py-2 text-[11px]",style:o,children:[c.jsx("span",{className:"inline-block h-1.5 w-1.5 rounded-full",style:{background:"var(--revka-text-faint)"}}),c.jsx("span",{style:{color:"var(--revka-text-faint)"},children:"progress stream offline"})]}):a.length===0?c.jsxs("div",{role:"status","aria-live":"polite",className:"flex items-center gap-2 border-b px-3 py-2 text-[11px]",style:o,children:[c.jsx("span",{className:"inline-block h-1.5 w-1.5 rounded-full animate-pulse",style:{background:n==="open"?r.primary:"var(--revka-text-faint)"}}),c.jsx("span",{style:{color:"var(--revka-text-muted)"},children:"waiting for Revka tool activity"})]}):c.jsx("div",{role:"status","aria-live":"polite",className:"flex gap-2 overflow-x-auto border-b px-3 py-2",style:o,children:a.map(l=>{const d=i-l.timestampMs>$re;return c.jsxs("div",{className:"shrink-0 rounded border px-2 py-1.5",style:{minWidth:150,maxWidth:240,borderColor:d?"var(--revka-border-soft)":"color-mix(in srgb, "+r.primary+" 40%, var(--revka-border-soft))",background:"var(--revka-bg-surface)",opacity:d?.55:1,transition:"opacity 600ms ease"},children:[c.jsx("div",{className:"truncate text-[10px] font-semibold uppercase tracking-[0.1em]",style:{color:d?"var(--revka-text-faint)":r.primary,textShadow:d?"none":r.glow},title:l.title,children:l.title}),c.jsx("div",{className:"truncate text-[11px]",style:{color:d?"var(--revka-text-faint)":"var(--revka-text-primary)"},title:l.progressLine,children:l.progressLine}),l.ratio!==null&&c.jsx("div",{className:"mt-1 h-1 w-full overflow-hidden rounded",style:{background:"var(--revka-border-soft)"},children:c.jsx("div",{className:"h-full",style:{width:`${Math.round(l.ratio*100)}%`,background:d?"var(--revka-text-faint)":r.primary,transition:"width 300ms ease"}})}),c.jsx("div",{className:"mt-1 text-[10px]",style:{color:"var(--revka-text-faint)"},children:zre(l.timestampMs,i)})]},l.id)})})}function qre({session:e,config:n,colors:r,visible:i}){const s=b.useRef(null),a=b.useRef(null),o=b.useRef(null),l=b.useRef(null);return b.useEffect(()=>{if(!s.current)return;const u=new $z({cursorBlink:n.cursorBlink,cursorStyle:"bar",fontSize:n.fontSize,fontFamily:"JetBrains Mono, SF Mono, Menlo, Monaco, Consolas, monospace",lineHeight:1.2,scrollback:1e4,allowProposedApi:!0,theme:QO(r)}),d=new Fz;u.loadAddon(d),u.loadAddon(new Hz),u.open(s.current);try{d.fit()}catch{}a.current=u,o.current=d,u.write(`\x1B[36m  Launching ${vg(e.toolKey)} in ${e.cwd}…\x1B[0m\r
\r
`);let p=null;try{p=new WebSocket(Lre(e,u.cols,u.rows)),p.binaryType="arraybuffer",l.current=p,p.onopen=()=>{p.send(JSON.stringify({type:"resize",cols:u.cols,rows:u.rows}))},p.onmessage=g=>{typeof g.data=="string"?u.write(g.data):u.write(new Uint8Array(g.data))},p.onerror=()=>{u.write(`\r
\x1B[31m  WebSocket error.\x1B[0m\r
`)},p.onclose=()=>{u.write(`\r
\x1B[33m  Session ended.\x1B[0m\r
`)}}catch(g){u.write(`\x1B[31m  Failed to open WebSocket: ${g instanceof Error?g.message:String(g)}\x1B[0m\r
`)}u.onData(g=>{var _;((_=l.current)==null?void 0:_.readyState)===WebSocket.OPEN&&l.current.send(g)}),u.onResize(({cols:g,rows:_})=>{var x;((x=l.current)==null?void 0:x.readyState)===WebSocket.OPEN&&l.current.send(JSON.stringify({type:"resize",cols:g,rows:_}))});const f=new ResizeObserver(()=>{try{d.fit()}catch{}});return f.observe(s.current),()=>{f.disconnect(),p&&(p.onopen=null,p.onmessage=null,p.onclose=null,p.onerror=null,p.close()),u.dispose(),a.current=null,o.current=null,l.current=null}},[e.sessionId]),b.useEffect(()=>{a.current&&(a.current.options.theme=QO(r))},[r]),b.useEffect(()=>{a.current&&(a.current.options.cursorBlink=n.cursorBlink)},[n.cursorBlink]),b.useEffect(()=>{var u;if(a.current){a.current.options.fontSize=n.fontSize;try{(u=o.current)==null||u.fit()}catch{}}},[n.fontSize]),b.useEffect(()=>{i&&requestAnimationFrame(()=>{var u,d;try{(u=o.current)==null||u.fit()}catch{}(d=a.current)==null||d.focus()})},[i]),c.jsx("div",{ref:s,className:"min-h-0 flex-1",style:{display:i?"block":"none",padding:"4px 0"}})}function Ure({session:e,config:n,colors:r,visible:i,onSessionEnd:s}){const{events:a,status:o}=Hre(e);return c.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",style:{display:i?"flex":"none"},children:[c.jsxs("div",{className:"flex items-center gap-2 border-b px-3 py-1.5 text-[11px]",style:{borderColor:"var(--revka-border-soft)",background:"var(--revka-bg-surface)"},children:[c.jsx("span",{style:{color:r.primary,textShadow:r.glow,fontWeight:600},children:vg(e.toolKey)}),c.jsx("span",{style:{color:"var(--revka-text-faint)"},children:"·"}),c.jsx("span",{className:"truncate",style:{color:"var(--revka-text-muted)",maxWidth:"40ch"},title:e.cwd,children:e.cwd}),c.jsx("div",{className:"flex-1"}),c.jsxs("button",{type:"button",className:"flex items-center gap-1 rounded px-2 py-0.5 text-[10px] font-semibold uppercase tracking-[0.1em] transition-colors hover:bg-white/5",onClick:s,style:{color:"var(--revka-text-secondary)",border:"1px solid var(--revka-border-soft)"},title:"End session",children:[c.jsx(mi,{className:"h-3 w-3"}),"End session"]})]}),c.jsx(Wre,{events:a,status:o,colors:r}),c.jsx(qre,{session:e,config:n,colors:r,visible:i})]})}function Vre({config:e,colors:n,visible:r,session:i,onSessionStart:s,onSessionEnd:a,onDelegateToChat:o}){const[l,u]=b.useState("claude"),[d,p]=b.useState(""),[f,g]=b.useState(!1),[_,x]=b.useState(null),[v,S]=b.useState(()=>KC()),[w,N]=b.useState("checking"),[C,T]=b.useState(null);b.useEffect(()=>{if(i)return;let F=!1;const B=new AbortController;return(async()=>{try{const H=XO();if(H){const z=await fetch(`${H}/health`,{signal:B.signal});if(F)return;N(z.ok?"ready":"missing"),T(z.ok?null:`health http ${z.status}`);return}const $=await Pre(B.signal);if(F)return;$.available?(N("ready"),T(null)):(N("missing"),T($.reason))}catch{F||(N("missing"),T("discovery request failed"))}})(),()=>{F=!0,B.abort()}},[i]);const A=b.useCallback(async()=>{if(x(null),l==="operator"){o("v2:code:operator","Operator");return}const F=d.trim();if(!F){x("Repository path is required.");return}g(!0);try{const B=XO(),H=B?`${B}/session`:`${Gr}/api/mcp/session`,$={"Content-Type":"application/json"};if(!B){const q=ns();q&&($.Authorization=`Bearer ${q}`)}const z=await fetch(H,{method:"POST",headers:$,body:JSON.stringify({cwd:F,label:`${vg(l)} · ${Vz(F)}`})});if(!z.ok){const q=await z.text().catch(()=>"");throw new Error(`Session request failed (${z.status})${q?`: ${q}`:""}`)}const W=await z.json(),P={sessionId:W.session_id,token:W.token,cwd:W.cwd||F,toolKey:l};Dre(P.cwd),S(KC()),s(P,vg(l),P.cwd)}catch(B){x(B instanceof Error?B.message:String(B))}finally{g(!1)}},[l,d,s,o]),E=b.useMemo(()=>w==="checking"?"Revka MCP: checking…":w==="ready"?"Revka MCP: ready":`Revka MCP: not running — start revka-mcp first${C?` (${C})`:""}`,[w,C]),D=b.useMemo(()=>w==="ready"?"var(--revka-status-success)":w==="missing"?"var(--revka-status-danger)":"var(--revka-text-faint)",[w]);return i?c.jsx(Ure,{session:i,config:e,colors:n,visible:r,onSessionEnd:a}):c.jsx("div",{className:"flex min-h-0 flex-1 flex-col overflow-y-auto p-4",style:{display:r?"flex":"none"},children:c.jsxs("div",{className:"mx-auto w-full max-w-md space-y-4",children:[c.jsxs("div",{children:[c.jsx("h3",{className:"text-xs font-semibold uppercase tracking-[0.14em]",style:{color:n.primary,textShadow:n.glow},children:"Launch Code Session"}),c.jsx("p",{className:"mt-1 text-[11px]",style:{color:"var(--revka-text-muted)"},children:"Start a CLI coding agent in a terminal, wired to the shared Revka MCP daemon."})]}),c.jsxs("div",{className:"flex items-center gap-2 rounded border px-3 py-2 text-[11px]",style:{borderColor:"var(--revka-border-soft)",background:"color-mix(in srgb, var(--revka-bg-surface) 95%, transparent)"},children:[c.jsx("span",{className:"inline-block h-1.5 w-1.5 rounded-full",style:{background:D}}),c.jsx("span",{style:{color:"var(--revka-text-secondary)"},children:E})]}),c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block font-semibold uppercase tracking-[0.1em]",style:{color:"var(--revka-text-faint)",fontSize:"10px"},children:"Tool"}),c.jsx("select",{value:l,onChange:F=>u(F.target.value),className:"w-full rounded border bg-transparent px-2 py-1.5 text-xs outline-none",style:{borderColor:"var(--revka-border-soft)",color:"var(--revka-text-primary)",background:"var(--revka-bg-surface)"},children:Wz.map(F=>c.jsx("option",{value:F.key,style:{background:"var(--revka-bg-panel-strong)"},children:F.label},F.key))})]}),l!=="operator"&&c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block font-semibold uppercase tracking-[0.1em]",style:{color:"var(--revka-text-faint)",fontSize:"10px"},children:"Repository Root"}),c.jsx("input",{type:"text",value:d,onChange:F=>p(F.target.value),placeholder:"/path/to/repo",className:"w-full rounded border bg-transparent px-2 py-1.5 font-mono text-xs outline-none",style:{borderColor:"var(--revka-border-soft)",color:"var(--revka-text-primary)",background:"var(--revka-bg-surface)"}}),v.length>0&&c.jsxs("div",{className:"mt-2",children:[c.jsx("label",{className:"mb-1 block font-semibold uppercase tracking-[0.1em]",style:{color:"var(--revka-text-faint)",fontSize:"10px"},children:"Recent"}),c.jsxs("select",{value:"",onChange:F=>{F.target.value&&p(F.target.value)},className:"w-full rounded border bg-transparent px-2 py-1.5 font-mono text-xs outline-none",style:{borderColor:"var(--revka-border-soft)",color:"var(--revka-text-primary)",background:"var(--revka-bg-surface)"},children:[c.jsx("option",{value:"",style:{background:"var(--revka-bg-panel-strong)"},children:"Select recent…"}),v.map(F=>c.jsx("option",{value:F,style:{background:"var(--revka-bg-panel-strong)"},children:F},F))]})]})]}),l==="operator"&&c.jsx("p",{className:"text-[11px]",style:{color:"var(--revka-text-muted)"},children:"Revka Operator runs as a chat conversation, not a PTY. Starting it will open a Chat tab with the Operator context."}),_&&c.jsxs("div",{className:"flex items-start gap-2 rounded border px-3 py-2 text-[11px]",style:{borderColor:"rgba(255,107,122,0.3)",background:"rgba(255,107,122,0.06)",color:"var(--revka-status-danger)"},children:[c.jsx(tv,{className:"mt-0.5 h-3 w-3 shrink-0"}),c.jsx("span",{children:_})]}),c.jsxs("button",{type:"button",onClick:A,disabled:f,className:"flex w-full items-center justify-center gap-1.5 rounded px-3 py-2 text-xs font-semibold uppercase tracking-[0.12em] transition-colors disabled:opacity-50",style:{background:n.primary+"22",color:n.primary,textShadow:n.glow,border:`1px solid ${n.primary}`},children:[c.jsx(n0,{className:"h-3 w-3"}),f?"Starting…":"Start Session"]})]})})}function Kre(e){const n=e.split(/\r?\n/),r=n.some(a=>a.startsWith("diff --git")||a.startsWith("@@")||a.startsWith("--- ")||a.startsWith("+++ ")||a.startsWith("*** Begin Patch")||a.startsWith("*** Update File:")||a.startsWith("*** Add File:")||a.startsWith("*** Delete File:")),i=n.some(a=>a.startsWith("+")&&!a.startsWith("+++")),s=n.some(a=>a.startsWith("-")&&!a.startsWith("---"));return r||i&&s}function Yre({detail:e,fontSize:n}){return c.jsx("div",{className:"overflow-auto rounded-[4px] border font-mono",style:{borderColor:"var(--revka-border-soft)",background:"var(--revka-bg-base)",fontSize:n,lineHeight:1.45,maxHeight:"28rem",textShadow:"none"},children:e.split(/\r?\n/).map((r,i)=>{const s=r.startsWith("+")&&!r.startsWith("+++"),a=r.startsWith("-")&&!r.startsWith("---"),o=r.startsWith("diff --git")||r.startsWith("@@")||r.startsWith("--- ")||r.startsWith("+++ ")||r.startsWith("*** ");return c.jsxs("div",{className:"grid min-w-max grid-cols-[2.5rem_1fr]",style:{background:s?"color-mix(in srgb, var(--revka-status-success) 12%, transparent)":a?"color-mix(in srgb, var(--revka-status-danger) 12%, transparent)":o?"color-mix(in srgb, var(--revka-bg-surface) 75%, transparent)":"transparent",color:s?"var(--revka-status-success)":a?"var(--revka-status-danger)":o?"var(--revka-text-primary)":"var(--revka-text-secondary)"},children:[c.jsx("span",{className:"select-none border-r px-2 text-right",style:{borderColor:"var(--revka-border-soft)",color:"var(--revka-text-faint)"},children:s?"+":a?"-":""}),c.jsx("span",{className:"whitespace-pre px-2",children:r})]},`${i}-${r.slice(0,16)}`)})})}function Gre({event:e,accent:n,fontSize:r}){const[i,s]=b.useState(e.kind==="thinking"),[a,o]=b.useState(!1),l=!!e.detail&&e.detail.trim().length>0,u=r?`${r-1}px`:void 0,d=r?`${r-2}px`:"11px",p=async _=>{_.stopPropagation(),e.detail&&await Ja(e.detail)&&(o(!0),setTimeout(()=>o(!1),1200))},f=e.kind==="tool_call"?"▸":e.kind==="tool_result"?"▾":e.kind==="thinking"?"…":"•",g=n??"var(--revka-text-faint)";return c.jsxs("div",{className:"my-0.5 rounded-[4px] border-l-2",style:{borderLeftColor:g,background:i?"color-mix(in srgb, var(--revka-bg-surface) 60%, transparent)":"transparent"},children:[c.jsxs("button",{type:"button",onClick:()=>l&&s(_=>!_),disabled:!l,className:"flex w-full items-center gap-2 px-2 py-1 text-left transition-colors",style:{cursor:l?"pointer":"default",color:"var(--revka-text-muted)",fontSize:u},children:[l?c.jsx(ru,{className:"h-3 w-3 shrink-0 transition-transform",style:{color:"var(--revka-text-faint)",transform:i?"rotate(90deg)":"rotate(0deg)"}}):c.jsx("span",{className:"inline-block h-3 w-3 shrink-0 text-center",style:{color:"var(--revka-text-faint)"},children:f}),c.jsxs("span",{className:"truncate font-mono",children:[c.jsxs("span",{style:{color:"var(--revka-text-faint)"},children:["sys ",">"," "]}),e.label]})]}),l&&i&&c.jsxs("div",{className:"relative border-t px-3 py-2",style:{borderColor:"var(--revka-border-soft)",background:"var(--revka-bg-base)"},children:[Kre(e.detail??"")?c.jsx(Yre,{detail:e.detail??"",fontSize:d}):c.jsx("pre",{className:"overflow-x-auto whitespace-pre-wrap break-words font-mono",style:{color:"var(--revka-text-secondary)",fontSize:d,lineHeight:1.5,maxHeight:"20rem",overflowY:"auto"},children:e.detail}),c.jsx("button",{type:"button",onClick:p,"aria-label":a?"Copied":"Copy detail",title:a?"Copied":"Copy",className:"absolute right-1 top-1 inline-flex h-5 w-5 items-center justify-center rounded transition-colors hover:bg-white/5 focus:outline-none focus-visible:ring-1 focus-visible:ring-current",style:{color:"var(--revka-text-faint)"},children:a?c.jsx(Za,{className:"h-3 w-3"}):c.jsx(Xl,{className:"h-3 w-3"})})]})]})}const Vx=b.memo(Gre);function Xre({attachment:e,onRemove:n,accent:r}){const i=e.mime.startsWith("image/"),s=r??"var(--revka-text-muted)";return c.jsxs("div",{className:"group inline-flex max-w-[220px] items-center gap-1.5 rounded-md border px-1.5 py-1 text-[11px] transition-colors",style:{borderColor:"var(--revka-border-soft)",background:"var(--revka-bg-surface)",color:"var(--revka-text-secondary)"},title:`${e.filename} · ${JO(e.size)} · ${e.mime}`,children:[i&&e.previewUrl?c.jsx("img",{src:e.previewUrl,alt:e.filename,className:"h-6 w-6 shrink-0 rounded-sm object-cover"}):i?c.jsx(gE,{className:"h-3.5 w-3.5 shrink-0",style:{color:s}}):c.jsx(rv,{className:"h-3.5 w-3.5 shrink-0",style:{color:s}}),c.jsx("span",{className:"min-w-0 flex-1 truncate font-mono",children:e.filename}),c.jsx("span",{className:"shrink-0 text-[10px]",style:{color:"var(--revka-text-faint)"},children:JO(e.size)}),c.jsx("button",{type:"button",onClick:()=>n(e.file_id),"aria-label":`Remove ${e.filename}`,title:"Remove",className:"ml-0.5 inline-flex h-4 w-4 shrink-0 items-center justify-center rounded transition-colors hover:bg-white/10 focus:outline-none focus-visible:ring-1 focus-visible:ring-current",style:{color:"var(--revka-text-faint)"},children:c.jsx(mi,{className:"h-2.5 w-2.5"})})]})}function JO(e){return e<1024?`${e} B`:e<1024*1024?`${Math.round(e/1024)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function Qre(e,n){const r={};return(e[e.length-1]===""?[...e,""]:e).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const Zre=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Jre=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,eie={};function e4(e,n){return(eie.jsx?Jre:Zre).test(e)}const tie=/[ \t\n\f\r]/g;function nie(e){return typeof e=="object"?e.type==="text"?t4(e.value):!1:t4(e)}function t4(e){return e.replace(tie,"")===""}let dv=class{constructor(n,r,i){this.normal=r,this.property=n,i&&(this.space=i)}};dv.prototype.normal={};dv.prototype.property={};dv.prototype.space=void 0;function Yz(e,n){const r={},i={};for(const s of e)Object.assign(r,s.property),Object.assign(i,s.normal);return new dv(r,i,n)}function YC(e){return e.toLowerCase()}class Ts{constructor(n,r){this.attribute=r,this.property=n}}Ts.prototype.attribute="";Ts.prototype.booleanish=!1;Ts.prototype.boolean=!1;Ts.prototype.commaOrSpaceSeparated=!1;Ts.prototype.commaSeparated=!1;Ts.prototype.defined=!1;Ts.prototype.mustUseProperty=!1;Ts.prototype.number=!1;Ts.prototype.overloadedBoolean=!1;Ts.prototype.property="";Ts.prototype.spaceSeparated=!1;Ts.prototype.space=void 0;let rie=0;const tn=Pd(),Vr=Pd(),GC=Pd(),ft=Pd(),tr=Pd(),af=Pd(),Ks=Pd();function Pd(){return 2**++rie}const XC=Object.freeze(Object.defineProperty({__proto__:null,boolean:tn,booleanish:Vr,commaOrSpaceSeparated:Ks,commaSeparated:af,number:ft,overloadedBoolean:GC,spaceSeparated:tr},Symbol.toStringTag,{value:"Module"})),Ow=Object.keys(XC);class ME extends Ts{constructor(n,r,i,s){let a=-1;if(super(n,r),n4(this,"space",s),typeof i=="number")for(;++a<Ow.length;){const o=Ow[a];n4(this,Ow[a],(i&XC[o])===XC[o])}}}ME.prototype.defined=!0;function n4(e,n,r){r&&(e[n]=r)}function Xf(e){const n={},r={};for(const[i,s]of Object.entries(e.properties)){const a=new ME(i,e.transform(e.attributes||{},i),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(i)&&(a.mustUseProperty=!0),n[i]=a,r[YC(i)]=i,r[YC(a.attribute)]=i}return new dv(n,r,e.space)}const Gz=Xf({properties:{ariaActiveDescendant:null,ariaAtomic:Vr,ariaAutoComplete:null,ariaBusy:Vr,ariaChecked:Vr,ariaColCount:ft,ariaColIndex:ft,ariaColSpan:ft,ariaControls:tr,ariaCurrent:null,ariaDescribedBy:tr,ariaDetails:null,ariaDisabled:Vr,ariaDropEffect:tr,ariaErrorMessage:null,ariaExpanded:Vr,ariaFlowTo:tr,ariaGrabbed:Vr,ariaHasPopup:null,ariaHidden:Vr,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:tr,ariaLevel:ft,ariaLive:null,ariaModal:Vr,ariaMultiLine:Vr,ariaMultiSelectable:Vr,ariaOrientation:null,ariaOwns:tr,ariaPlaceholder:null,ariaPosInSet:ft,ariaPressed:Vr,ariaReadOnly:Vr,ariaRelevant:null,ariaRequired:Vr,ariaRoleDescription:tr,ariaRowCount:ft,ariaRowIndex:ft,ariaRowSpan:ft,ariaSelected:Vr,ariaSetSize:ft,ariaSort:null,ariaValueMax:ft,ariaValueMin:ft,ariaValueNow:ft,ariaValueText:null,role:null},transform(e,n){return n==="role"?n:"aria-"+n.slice(4).toLowerCase()}});function Xz(e,n){return n in e?e[n]:n}function Qz(e,n){return Xz(e,n.toLowerCase())}const iie=Xf({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:af,acceptCharset:tr,accessKey:tr,action:null,allow:null,allowFullScreen:tn,allowPaymentRequest:tn,allowUserMedia:tn,alt:null,as:null,async:tn,autoCapitalize:null,autoComplete:tr,autoFocus:tn,autoPlay:tn,blocking:tr,capture:null,charSet:null,checked:tn,cite:null,className:tr,cols:ft,colSpan:null,content:null,contentEditable:Vr,controls:tn,controlsList:tr,coords:ft|af,crossOrigin:null,data:null,dateTime:null,decoding:null,default:tn,defer:tn,dir:null,dirName:null,disabled:tn,download:GC,draggable:Vr,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:tn,formTarget:null,headers:tr,height:ft,hidden:GC,high:ft,href:null,hrefLang:null,htmlFor:tr,httpEquiv:tr,id:null,imageSizes:null,imageSrcSet:null,inert:tn,inputMode:null,integrity:null,is:null,isMap:tn,itemId:null,itemProp:tr,itemRef:tr,itemScope:tn,itemType:tr,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:tn,low:ft,manifest:null,max:null,maxLength:ft,media:null,method:null,min:null,minLength:ft,multiple:tn,muted:tn,name:null,nonce:null,noModule:tn,noValidate:tn,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:tn,optimum:ft,pattern:null,ping:tr,placeholder:null,playsInline:tn,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:tn,referrerPolicy:null,rel:tr,required:tn,reversed:tn,rows:ft,rowSpan:ft,sandbox:tr,scope:null,scoped:tn,seamless:tn,selected:tn,shadowRootClonable:tn,shadowRootDelegatesFocus:tn,shadowRootMode:null,shape:null,size:ft,sizes:null,slot:null,span:ft,spellCheck:Vr,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ft,step:null,style:null,tabIndex:ft,target:null,title:null,translate:null,type:null,typeMustMatch:tn,useMap:null,value:Vr,width:ft,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:tr,axis:null,background:null,bgColor:null,border:ft,borderColor:null,bottomMargin:ft,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:tn,declare:tn,event:null,face:null,frame:null,frameBorder:null,hSpace:ft,leftMargin:ft,link:null,longDesc:null,lowSrc:null,marginHeight:ft,marginWidth:ft,noResize:tn,noHref:tn,noShade:tn,noWrap:tn,object:null,profile:null,prompt:null,rev:null,rightMargin:ft,rules:null,scheme:null,scrolling:Vr,standby:null,summary:null,text:null,topMargin:ft,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ft,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:tn,disableRemotePlayback:tn,prefix:null,property:null,results:ft,security:null,unselectable:null},space:"html",transform:Qz}),sie=Xf({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Ks,accentHeight:ft,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ft,amplitude:ft,arabicForm:null,ascent:ft,attributeName:null,attributeType:null,azimuth:ft,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ft,by:null,calcMode:null,capHeight:ft,className:tr,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:ft,diffuseConstant:ft,direction:null,display:null,dur:null,divisor:ft,dominantBaseline:null,download:tn,dx:null,dy:null,edgeMode:null,editable:null,elevation:ft,enableBackground:null,end:null,event:null,exponent:ft,externalResourcesRequired:null,fill:null,fillOpacity:ft,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:af,g2:af,glyphName:af,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ft,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ft,horizOriginX:ft,horizOriginY:ft,id:null,ideographic:ft,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ft,k:ft,k1:ft,k2:ft,k3:ft,k4:ft,kernelMatrix:Ks,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ft,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:ft,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:ft,overlineThickness:ft,paintOrder:null,panose1:null,path:null,pathLength:ft,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:tr,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ft,pointsAtY:ft,pointsAtZ:ft,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Ks,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Ks,rev:Ks,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Ks,requiredFeatures:Ks,requiredFonts:Ks,requiredFormats:Ks,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:ft,specularExponent:ft,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ft,strikethroughThickness:ft,string:null,stroke:null,strokeDashArray:Ks,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ft,strokeOpacity:ft,strokeWidth:null,style:null,surfaceScale:ft,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Ks,tabIndex:ft,tableValues:null,target:null,targetX:ft,targetY:ft,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Ks,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ft,underlineThickness:ft,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ft,values:null,vAlphabetic:ft,vMathematical:ft,vectorEffect:null,vHanging:ft,vIdeographic:ft,version:null,vertAdvY:ft,vertOriginX:ft,vertOriginY:ft,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ft,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Xz}),Zz=Xf({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,n){return"xlink:"+n.slice(5).toLowerCase()}}),Jz=Xf({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Qz}),e9=Xf({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,n){return"xml:"+n.slice(3).toLowerCase()}}),aie={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},oie=/[A-Z]/g,r4=/-[a-z]/g,lie=/^data[-\w.:]+$/i;function cie(e,n){const r=YC(n);let i=n,s=Ts;if(r in e.normal)return e.property[e.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&lie.test(n)){if(n.charAt(4)==="-"){const a=n.slice(5).replace(r4,die);i="data"+a.charAt(0).toUpperCase()+a.slice(1)}else{const a=n.slice(4);if(!r4.test(a)){let o=a.replace(oie,uie);o.charAt(0)!=="-"&&(o="-"+o),n="data"+o}}s=ME}return new s(i,n)}function uie(e){return"-"+e.toLowerCase()}function die(e){return e.charAt(1).toUpperCase()}const hie=Yz([Gz,iie,Zz,Jz,e9],"html"),RE=Yz([Gz,sie,Zz,Jz,e9],"svg");function fie(e){return e.join(" ").trim()}var xh={},Dw,i4;function pie(){if(i4)return Dw;i4=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,n=/\n/g,r=/^\s*/,i=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,s=/^:\s*/,a=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,o=/^[;\s]*/,l=/^\s+|\s+$/g,u=`
`,d="/",p="*",f="",g="comment",_="declaration";function x(S,w){if(typeof S!="string")throw new TypeError("First argument must be a string");if(!S)return[];w=w||{};var N=1,C=1;function T(P){var q=P.match(n);q&&(N+=q.length);var I=P.lastIndexOf(u);C=~I?P.length-I:C+P.length}function A(){var P={line:N,column:C};return function(q){return q.position=new E(P),B(),q}}function E(P){this.start=P,this.end={line:N,column:C},this.source=w.source}E.prototype.content=S;function D(P){var q=new Error(w.source+":"+N+":"+C+": "+P);if(q.reason=P,q.filename=w.source,q.line=N,q.column=C,q.source=S,!w.silent)throw q}function F(P){var q=P.exec(S);if(q){var I=q[0];return T(I),S=S.slice(I.length),q}}function B(){F(r)}function H(P){var q;for(P=P||[];q=$();)q!==!1&&P.push(q);return P}function $(){var P=A();if(!(d!=S.charAt(0)||p!=S.charAt(1))){for(var q=2;f!=S.charAt(q)&&(p!=S.charAt(q)||d!=S.charAt(q+1));)++q;if(q+=2,f===S.charAt(q-1))return D("End of comment missing");var I=S.slice(2,q-2);return C+=2,T(I),S=S.slice(q),C+=2,P({type:g,comment:I})}}function z(){var P=A(),q=F(i);if(q){if($(),!F(s))return D("property missing ':'");var I=F(a),Q=P({type:_,property:v(q[0].replace(e,f)),value:I?v(I[0].replace(e,f)):f});return F(o),Q}}function W(){var P=[];H(P);for(var q;q=z();)q!==!1&&(P.push(q),H(P));return P}return B(),W()}function v(S){return S?S.replace(l,f):f}return Dw=x,Dw}var s4;function mie(){if(s4)return xh;s4=1;var e=xh&&xh.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(xh,"__esModule",{value:!0}),xh.default=r;const n=e(pie());function r(i,s){let a=null;if(!i||typeof i!="string")return a;const o=(0,n.default)(i),l=typeof s=="function";return o.forEach(u=>{if(u.type!=="declaration")return;const{property:d,value:p}=u;l?s(d,p,u):p&&(a=a||{},a[d]=p)}),a}return xh}var Qp={},a4;function gie(){if(a4)return Qp;a4=1,Object.defineProperty(Qp,"__esModule",{value:!0}),Qp.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,s=/^-(ms)-/,a=function(d){return!d||r.test(d)||e.test(d)},o=function(d,p){return p.toUpperCase()},l=function(d,p){return"".concat(p,"-")},u=function(d,p){return p===void 0&&(p={}),a(d)?d:(d=d.toLowerCase(),p.reactCompat?d=d.replace(s,l):d=d.replace(i,l),d.replace(n,o))};return Qp.camelCase=u,Qp}var Zp,o4;function vie(){if(o4)return Zp;o4=1;var e=Zp&&Zp.__importDefault||function(s){return s&&s.__esModule?s:{default:s}},n=e(mie()),r=gie();function i(s,a){var o={};return!s||typeof s!="string"||(0,n.default)(s,function(l,u){l&&u&&(o[(0,r.camelCase)(l,a)]=u)}),o}return i.default=i,Zp=i,Zp}var yie=vie();const _ie=pu(yie),t9=n9("end"),OE=n9("start");function n9(e){return n;function n(r){const i=r&&r.position&&r.position[e]||{};if(typeof i.line=="number"&&i.line>0&&typeof i.column=="number"&&i.column>0)return{line:i.line,column:i.column,offset:typeof i.offset=="number"&&i.offset>-1?i.offset:void 0}}}function xie(e){const n=OE(e),r=t9(e);if(n&&r)return{start:n,end:r}}function qm(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?l4(e.position):"start"in e||"end"in e?l4(e):"line"in e||"column"in e?QC(e):""}function QC(e){return c4(e&&e.line)+":"+c4(e&&e.column)}function l4(e){return QC(e&&e.start)+"-"+QC(e&&e.end)}function c4(e){return e&&typeof e=="number"?e:1}class Ui extends Error{constructor(n,r,i){super(),typeof r=="string"&&(i=r,r=void 0);let s="",a={},o=!1;if(r&&("line"in r&&"column"in r?a={place:r}:"start"in r&&"end"in r?a={place:r}:"type"in r?a={ancestors:[r],place:r.position}:a={...r}),typeof n=="string"?s=n:!a.cause&&n&&(o=!0,s=n.message,a.cause=n),!a.ruleId&&!a.source&&typeof i=="string"){const u=i.indexOf(":");u===-1?a.ruleId=i:(a.source=i.slice(0,u),a.ruleId=i.slice(u+1))}if(!a.place&&a.ancestors&&a.ancestors){const u=a.ancestors[a.ancestors.length-1];u&&(a.place=u.position)}const l=a.place&&"start"in a.place?a.place.start:a.place;this.ancestors=a.ancestors||void 0,this.cause=a.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=l?l.line:void 0,this.name=qm(a.place)||"1:1",this.place=a.place||void 0,this.reason=this.message,this.ruleId=a.ruleId||void 0,this.source=a.source||void 0,this.stack=o&&a.cause&&typeof a.cause.stack=="string"?a.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Ui.prototype.file="";Ui.prototype.name="";Ui.prototype.reason="";Ui.prototype.message="";Ui.prototype.stack="";Ui.prototype.column=void 0;Ui.prototype.line=void 0;Ui.prototype.ancestors=void 0;Ui.prototype.cause=void 0;Ui.prototype.fatal=void 0;Ui.prototype.place=void 0;Ui.prototype.ruleId=void 0;Ui.prototype.source=void 0;const DE={}.hasOwnProperty,bie=new Map,kie=/[A-Z]/g,wie=new Set(["table","tbody","thead","tfoot","tr"]),Sie=new Set(["td","th"]),r9="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Cie(e,n){if(!n||n.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const r=n.filePath||void 0;let i;if(n.development){if(typeof n.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");i=Oie(r,n.jsxDEV)}else{if(typeof n.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof n.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");i=Rie(r,n.jsx,n.jsxs)}const s={Fragment:n.Fragment,ancestors:[],components:n.components||{},create:i,elementAttributeNameCase:n.elementAttributeNameCase||"react",evaluater:n.createEvaluater?n.createEvaluater():void 0,filePath:r,ignoreInvalidStyle:n.ignoreInvalidStyle||!1,passKeys:n.passKeys!==!1,passNode:n.passNode||!1,schema:n.space==="svg"?RE:hie,stylePropertyNameCase:n.stylePropertyNameCase||"dom",tableCellAlignToStyle:n.tableCellAlignToStyle!==!1},a=i9(s,e,void 0);return a&&typeof a!="string"?a:s.create(e,s.Fragment,{children:a||void 0},void 0)}function i9(e,n,r){if(n.type==="element")return jie(e,n,r);if(n.type==="mdxFlowExpression"||n.type==="mdxTextExpression")return Nie(e,n);if(n.type==="mdxJsxFlowElement"||n.type==="mdxJsxTextElement")return Aie(e,n,r);if(n.type==="mdxjsEsm")return Eie(e,n);if(n.type==="root")return Tie(e,n,r);if(n.type==="text")return Mie(e,n)}function jie(e,n,r){const i=e.schema;let s=i;n.tagName.toLowerCase()==="svg"&&i.space==="html"&&(s=RE,e.schema=s),e.ancestors.push(n);const a=a9(e,n.tagName,!1),o=Die(e,n);let l=LE(e,n);return wie.has(n.tagName)&&(l=l.filter(function(u){return typeof u=="string"?!nie(u):!0})),s9(e,o,a,n),PE(o,l),e.ancestors.pop(),e.schema=i,e.create(n,a,o,r)}function Nie(e,n){if(n.data&&n.data.estree&&e.evaluater){const i=n.data.estree.body[0];return i.type,e.evaluater.evaluateExpression(i.expression)}yg(e,n.position)}function Eie(e,n){if(n.data&&n.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(n.data.estree);yg(e,n.position)}function Aie(e,n,r){const i=e.schema;let s=i;n.name==="svg"&&i.space==="html"&&(s=RE,e.schema=s),e.ancestors.push(n);const a=n.name===null?e.Fragment:a9(e,n.name,!0),o=Pie(e,n),l=LE(e,n);return s9(e,o,a,n),PE(o,l),e.ancestors.pop(),e.schema=i,e.create(n,a,o,r)}function Tie(e,n,r){const i={};return PE(i,LE(e,n)),e.create(n,e.Fragment,i,r)}function Mie(e,n){return n.value}function s9(e,n,r,i){typeof r!="string"&&r!==e.Fragment&&e.passNode&&(n.node=i)}function PE(e,n){if(n.length>0){const r=n.length>1?n:n[0];r&&(e.children=r)}}function Rie(e,n,r){return i;function i(s,a,o,l){const d=Array.isArray(o.children)?r:n;return l?d(a,o,l):d(a,o)}}function Oie(e,n){return r;function r(i,s,a,o){const l=Array.isArray(a.children),u=OE(i);return n(s,a,o,l,{columnNumber:u?u.column-1:void 0,fileName:e,lineNumber:u?u.line:void 0},void 0)}}function Die(e,n){const r={};let i,s;for(s in n.properties)if(s!=="children"&&DE.call(n.properties,s)){const a=Lie(e,s,n.properties[s]);if(a){const[o,l]=a;e.tableCellAlignToStyle&&o==="align"&&typeof l=="string"&&Sie.has(n.tagName)?i=l:r[o]=l}}if(i){const a=r.style||(r.style={});a[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=i}return r}function Pie(e,n){const r={};for(const i of n.attributes)if(i.type==="mdxJsxExpressionAttribute")if(i.data&&i.data.estree&&e.evaluater){const a=i.data.estree.body[0];a.type;const o=a.expression;o.type;const l=o.properties[0];l.type,Object.assign(r,e.evaluater.evaluateExpression(l.argument))}else yg(e,n.position);else{const s=i.name;let a;if(i.value&&typeof i.value=="object")if(i.value.data&&i.value.data.estree&&e.evaluater){const l=i.value.data.estree.body[0];l.type,a=e.evaluater.evaluateExpression(l.expression)}else yg(e,n.position);else a=i.value===null?!0:i.value;r[s]=a}return r}function LE(e,n){const r=[];let i=-1;const s=e.passKeys?new Map:bie;for(;++i<n.children.length;){const a=n.children[i];let o;if(e.passKeys){const u=a.type==="element"?a.tagName:a.type==="mdxJsxFlowElement"||a.type==="mdxJsxTextElement"?a.name:void 0;if(u){const d=s.get(u)||0;o=u+"-"+d,s.set(u,d+1)}}const l=i9(e,a,o);l!==void 0&&r.push(l)}return r}function Lie(e,n,r){const i=cie(e.schema,n);if(!(r==null||typeof r=="number"&&Number.isNaN(r))){if(Array.isArray(r)&&(r=i.commaSeparated?Qre(r):fie(r)),i.property==="style"){let s=typeof r=="object"?r:Iie(e,String(r));return e.stylePropertyNameCase==="css"&&(s=Bie(s)),["style",s]}return[e.elementAttributeNameCase==="react"&&i.space?aie[i.property]||i.property:i.attribute,r]}}function Iie(e,n){try{return _ie(n,{reactCompat:!0})}catch(r){if(e.ignoreInvalidStyle)return{};const i=r,s=new Ui("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:i,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw s.file=e.filePath||void 0,s.url=r9+"#cannot-parse-style-attribute",s}}function a9(e,n,r){let i;if(!r)i={type:"Literal",value:n};else if(n.includes(".")){const s=n.split(".");let a=-1,o;for(;++a<s.length;){const l=e4(s[a])?{type:"Identifier",name:s[a]}:{type:"Literal",value:s[a]};o=o?{type:"MemberExpression",object:o,property:l,computed:!!(a&&l.type==="Literal"),optional:!1}:l}i=o}else i=e4(n)&&!/^[a-z]/.test(n)?{type:"Identifier",name:n}:{type:"Literal",value:n};if(i.type==="Literal"){const s=i.value;return DE.call(e.components,s)?e.components[s]:s}if(e.evaluater)return e.evaluater.evaluateExpression(i);yg(e)}function yg(e,n){const r=new Ui("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:n,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw r.file=e.filePath||void 0,r.url=r9+"#cannot-handle-mdx-estrees-without-createevaluater",r}function Bie(e){const n={};let r;for(r in e)DE.call(e,r)&&(n[zie(r)]=e[r]);return n}function zie(e){let n=e.replace(kie,$ie);return n.slice(0,3)==="ms-"&&(n="-"+n),n}function $ie(e){return"-"+e.toLowerCase()}const Pw={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},Fie={};function IE(e,n){const r=Fie,i=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,s=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return o9(e,i,s)}function o9(e,n,r){if(Hie(e)){if("value"in e)return e.type==="html"&&!r?"":e.value;if(n&&"alt"in e&&e.alt)return e.alt;if("children"in e)return u4(e.children,n,r)}return Array.isArray(e)?u4(e,n,r):""}function u4(e,n,r){const i=[];let s=-1;for(;++s<e.length;)i[s]=o9(e[s],n,r);return i.join("")}function Hie(e){return!!(e&&typeof e=="object")}const d4=document.createElement("i");function BE(e){const n="&"+e+";";d4.innerHTML=n;const r=d4.textContent;return r.charCodeAt(r.length-1)===59&&e!=="semi"||r===n?!1:r}function Js(e,n,r,i){const s=e.length;let a=0,o;if(n<0?n=-n>s?0:s+n:n=n>s?s:n,r=r>0?r:0,i.length<1e4)o=Array.from(i),o.unshift(n,r),e.splice(...o);else for(r&&e.splice(n,r);a<i.length;)o=i.slice(a,a+1e4),o.unshift(n,0),e.splice(...o),a+=1e4,n+=1e4}function xa(e,n){return e.length>0?(Js(e,e.length,0,n),e):n}const h4={}.hasOwnProperty;function l9(e){const n={};let r=-1;for(;++r<e.length;)Wie(n,e[r]);return n}function Wie(e,n){let r;for(r in n){const s=(h4.call(e,r)?e[r]:void 0)||(e[r]={}),a=n[r];let o;if(a)for(o in a){h4.call(s,o)||(s[o]=[]);const l=a[o];qie(s[o],Array.isArray(l)?l:l?[l]:[])}}}function qie(e,n){let r=-1;const i=[];for(;++r<n.length;)(n[r].add==="after"?e:i).push(n[r]);Js(e,0,0,i)}function c9(e,n){const r=Number.parseInt(e,n);return r<9||r===11||r>13&&r<32||r>126&&r<160||r>55295&&r<57344||r>64975&&r<65008||(r&65535)===65535||(r&65535)===65534||r>1114111?"�":String.fromCodePoint(r)}function Qa(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Qi=mu(/[A-Za-z]/),Hi=mu(/[\dA-Za-z]/),Uie=mu(/[#-'*+\--9=?A-Z^-~]/);function Kx(e){return e!==null&&(e<32||e===127)}const ZC=mu(/\d/),Vie=mu(/[\dA-Fa-f]/),Kie=mu(/[!-/:-@[-`{-~]/);function Ut(e){return e!==null&&e<-2}function er(e){return e!==null&&(e<0||e===32)}function mn(e){return e===-2||e===-1||e===32}const p0=mu(new RegExp("\\p{P}|\\p{S}","u")),wd=mu(/\s/);function mu(e){return n;function n(r){return r!==null&&r>-1&&e.test(String.fromCharCode(r))}}function Qf(e){const n=[];let r=-1,i=0,s=0;for(;++r<e.length;){const a=e.charCodeAt(r);let o="";if(a===37&&Hi(e.charCodeAt(r+1))&&Hi(e.charCodeAt(r+2)))s=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(o=String.fromCharCode(a));else if(a>55295&&a<57344){const l=e.charCodeAt(r+1);a<56320&&l>56319&&l<57344?(o=String.fromCharCode(a,l),s=1):o="�"}else o=String.fromCharCode(a);o&&(n.push(e.slice(i,r),encodeURIComponent(o)),i=r+s+1,o=""),s&&(r+=s,s=0)}return n.join("")+e.slice(i)}function jn(e,n,r,i){const s=i?i-1:Number.POSITIVE_INFINITY;let a=0;return o;function o(u){return mn(u)?(e.enter(r),l(u)):n(u)}function l(u){return mn(u)&&a++<s?(e.consume(u),l):(e.exit(r),n(u))}}const Yie={tokenize:Gie};function Gie(e){const n=e.attempt(this.parser.constructs.contentInitial,i,s);let r;return n;function i(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),jn(e,n,"linePrefix")}function s(l){return e.enter("paragraph"),a(l)}function a(l){const u=e.enter("chunkText",{contentType:"text",previous:r});return r&&(r.next=u),r=u,o(l)}function o(l){if(l===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(l);return}return Ut(l)?(e.consume(l),e.exit("chunkText"),a):(e.consume(l),o)}}const Xie={tokenize:Qie},f4={tokenize:Zie};function Qie(e){const n=this,r=[];let i=0,s,a,o;return l;function l(C){if(i<r.length){const T=r[i];return n.containerState=T[1],e.attempt(T[0].continuation,u,d)(C)}return d(C)}function u(C){if(i++,n.containerState._closeFlow){n.containerState._closeFlow=void 0,s&&N();const T=n.events.length;let A=T,E;for(;A--;)if(n.events[A][0]==="exit"&&n.events[A][1].type==="chunkFlow"){E=n.events[A][1].end;break}w(i);let D=T;for(;D<n.events.length;)n.events[D][1].end={...E},D++;return Js(n.events,A+1,0,n.events.slice(T)),n.events.length=D,d(C)}return l(C)}function d(C){if(i===r.length){if(!s)return g(C);if(s.currentConstruct&&s.currentConstruct.concrete)return x(C);n.interrupt=!!(s.currentConstruct&&!s._gfmTableDynamicInterruptHack)}return n.containerState={},e.check(f4,p,f)(C)}function p(C){return s&&N(),w(i),g(C)}function f(C){return n.parser.lazy[n.now().line]=i!==r.length,o=n.now().offset,x(C)}function g(C){return n.containerState={},e.attempt(f4,_,x)(C)}function _(C){return i++,r.push([n.currentConstruct,n.containerState]),g(C)}function x(C){if(C===null){s&&N(),w(0),e.consume(C);return}return s=s||n.parser.flow(n.now()),e.enter("chunkFlow",{_tokenizer:s,contentType:"flow",previous:a}),v(C)}function v(C){if(C===null){S(e.exit("chunkFlow"),!0),w(0),e.consume(C);return}return Ut(C)?(e.consume(C),S(e.exit("chunkFlow")),i=0,n.interrupt=void 0,l):(e.consume(C),v)}function S(C,T){const A=n.sliceStream(C);if(T&&A.push(null),C.previous=a,a&&(a.next=C),a=C,s.defineSkip(C.start),s.write(A),n.parser.lazy[C.start.line]){let E=s.events.length;for(;E--;)if(s.events[E][1].start.offset<o&&(!s.events[E][1].end||s.events[E][1].end.offset>o))return;const D=n.events.length;let F=D,B,H;for(;F--;)if(n.events[F][0]==="exit"&&n.events[F][1].type==="chunkFlow"){if(B){H=n.events[F][1].end;break}B=!0}for(w(i),E=D;E<n.events.length;)n.events[E][1].end={...H},E++;Js(n.events,F+1,0,n.events.slice(D)),n.events.length=E}}function w(C){let T=r.length;for(;T-- >C;){const A=r[T];n.containerState=A[1],A[0].exit.call(n,e)}r.length=C}function N(){s.write([null]),a=void 0,s=void 0,n.containerState._closeFlow=void 0}}function Zie(e,n,r){return jn(e,e.attempt(this.parser.constructs.document,n,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function kf(e){if(e===null||er(e)||wd(e))return 1;if(p0(e))return 2}function m0(e,n,r){const i=[];let s=-1;for(;++s<e.length;){const a=e[s].resolveAll;a&&!i.includes(a)&&(n=a(n,r),i.push(a))}return n}const JC={name:"attention",resolveAll:Jie,tokenize:ese};function Jie(e,n){let r=-1,i,s,a,o,l,u,d,p;for(;++r<e.length;)if(e[r][0]==="enter"&&e[r][1].type==="attentionSequence"&&e[r][1]._close){for(i=r;i--;)if(e[i][0]==="exit"&&e[i][1].type==="attentionSequence"&&e[i][1]._open&&n.sliceSerialize(e[i][1]).charCodeAt(0)===n.sliceSerialize(e[r][1]).charCodeAt(0)){if((e[i][1]._close||e[r][1]._open)&&(e[r][1].end.offset-e[r][1].start.offset)%3&&!((e[i][1].end.offset-e[i][1].start.offset+e[r][1].end.offset-e[r][1].start.offset)%3))continue;u=e[i][1].end.offset-e[i][1].start.offset>1&&e[r][1].end.offset-e[r][1].start.offset>1?2:1;const f={...e[i][1].end},g={...e[r][1].start};p4(f,-u),p4(g,u),o={type:u>1?"strongSequence":"emphasisSequence",start:f,end:{...e[i][1].end}},l={type:u>1?"strongSequence":"emphasisSequence",start:{...e[r][1].start},end:g},a={type:u>1?"strongText":"emphasisText",start:{...e[i][1].end},end:{...e[r][1].start}},s={type:u>1?"strong":"emphasis",start:{...o.start},end:{...l.end}},e[i][1].end={...o.start},e[r][1].start={...l.end},d=[],e[i][1].end.offset-e[i][1].start.offset&&(d=xa(d,[["enter",e[i][1],n],["exit",e[i][1],n]])),d=xa(d,[["enter",s,n],["enter",o,n],["exit",o,n],["enter",a,n]]),d=xa(d,m0(n.parser.constructs.insideSpan.null,e.slice(i+1,r),n)),d=xa(d,[["exit",a,n],["enter",l,n],["exit",l,n],["exit",s,n]]),e[r][1].end.offset-e[r][1].start.offset?(p=2,d=xa(d,[["enter",e[r][1],n],["exit",e[r][1],n]])):p=0,Js(e,i-1,r-i+3,d),r=i+d.length-p-2;break}}for(r=-1;++r<e.length;)e[r][1].type==="attentionSequence"&&(e[r][1].type="data");return e}function ese(e,n){const r=this.parser.constructs.attentionMarkers.null,i=this.previous,s=kf(i);let a;return o;function o(u){return a=u,e.enter("attentionSequence"),l(u)}function l(u){if(u===a)return e.consume(u),l;const d=e.exit("attentionSequence"),p=kf(u),f=!p||p===2&&s||r.includes(u),g=!s||s===2&&p||r.includes(i);return d._open=!!(a===42?f:f&&(s||!g)),d._close=!!(a===42?g:g&&(p||!f)),n(u)}}function p4(e,n){e.column+=n,e.offset+=n,e._bufferIndex+=n}const tse={name:"autolink",tokenize:nse};function nse(e,n,r){let i=0;return s;function s(_){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(_),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),a}function a(_){return Qi(_)?(e.consume(_),o):_===64?r(_):d(_)}function o(_){return _===43||_===45||_===46||Hi(_)?(i=1,l(_)):d(_)}function l(_){return _===58?(e.consume(_),i=0,u):(_===43||_===45||_===46||Hi(_))&&i++<32?(e.consume(_),l):(i=0,d(_))}function u(_){return _===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(_),e.exit("autolinkMarker"),e.exit("autolink"),n):_===null||_===32||_===60||Kx(_)?r(_):(e.consume(_),u)}function d(_){return _===64?(e.consume(_),p):Uie(_)?(e.consume(_),d):r(_)}function p(_){return Hi(_)?f(_):r(_)}function f(_){return _===46?(e.consume(_),i=0,p):_===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(_),e.exit("autolinkMarker"),e.exit("autolink"),n):g(_)}function g(_){if((_===45||Hi(_))&&i++<63){const x=_===45?g:f;return e.consume(_),x}return r(_)}}const hv={partial:!0,tokenize:rse};function rse(e,n,r){return i;function i(a){return mn(a)?jn(e,s,"linePrefix")(a):s(a)}function s(a){return a===null||Ut(a)?n(a):r(a)}}const u9={continuation:{tokenize:sse},exit:ase,name:"blockQuote",tokenize:ise};function ise(e,n,r){const i=this;return s;function s(o){if(o===62){const l=i.containerState;return l.open||(e.enter("blockQuote",{_container:!0}),l.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(o),e.exit("blockQuoteMarker"),a}return r(o)}function a(o){return mn(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),n):(e.exit("blockQuotePrefix"),n(o))}}function sse(e,n,r){const i=this;return s;function s(o){return mn(o)?jn(e,a,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):a(o)}function a(o){return e.attempt(u9,n,r)(o)}}function ase(e){e.exit("blockQuote")}const d9={name:"characterEscape",tokenize:ose};function ose(e,n,r){return i;function i(a){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(a),e.exit("escapeMarker"),s}function s(a){return Kie(a)?(e.enter("characterEscapeValue"),e.consume(a),e.exit("characterEscapeValue"),e.exit("characterEscape"),n):r(a)}}const h9={name:"characterReference",tokenize:lse};function lse(e,n,r){const i=this;let s=0,a,o;return l;function l(f){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(f),e.exit("characterReferenceMarker"),u}function u(f){return f===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(f),e.exit("characterReferenceMarkerNumeric"),d):(e.enter("characterReferenceValue"),a=31,o=Hi,p(f))}function d(f){return f===88||f===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(f),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),a=6,o=Vie,p):(e.enter("characterReferenceValue"),a=7,o=ZC,p(f))}function p(f){if(f===59&&s){const g=e.exit("characterReferenceValue");return o===Hi&&!BE(i.sliceSerialize(g))?r(f):(e.enter("characterReferenceMarker"),e.consume(f),e.exit("characterReferenceMarker"),e.exit("characterReference"),n)}return o(f)&&s++<a?(e.consume(f),p):r(f)}}const m4={partial:!0,tokenize:use},g4={concrete:!0,name:"codeFenced",tokenize:cse};function cse(e,n,r){const i=this,s={partial:!0,tokenize:A};let a=0,o=0,l;return u;function u(E){return d(E)}function d(E){const D=i.events[i.events.length-1];return a=D&&D[1].type==="linePrefix"?D[2].sliceSerialize(D[1],!0).length:0,l=E,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),p(E)}function p(E){return E===l?(o++,e.consume(E),p):o<3?r(E):(e.exit("codeFencedFenceSequence"),mn(E)?jn(e,f,"whitespace")(E):f(E))}function f(E){return E===null||Ut(E)?(e.exit("codeFencedFence"),i.interrupt?n(E):e.check(m4,v,T)(E)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),g(E))}function g(E){return E===null||Ut(E)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),f(E)):mn(E)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),jn(e,_,"whitespace")(E)):E===96&&E===l?r(E):(e.consume(E),g)}function _(E){return E===null||Ut(E)?f(E):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),x(E))}function x(E){return E===null||Ut(E)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),f(E)):E===96&&E===l?r(E):(e.consume(E),x)}function v(E){return e.attempt(s,T,S)(E)}function S(E){return e.enter("lineEnding"),e.consume(E),e.exit("lineEnding"),w}function w(E){return a>0&&mn(E)?jn(e,N,"linePrefix",a+1)(E):N(E)}function N(E){return E===null||Ut(E)?e.check(m4,v,T)(E):(e.enter("codeFlowValue"),C(E))}function C(E){return E===null||Ut(E)?(e.exit("codeFlowValue"),N(E)):(e.consume(E),C)}function T(E){return e.exit("codeFenced"),n(E)}function A(E,D,F){let B=0;return H;function H(q){return E.enter("lineEnding"),E.consume(q),E.exit("lineEnding"),$}function $(q){return E.enter("codeFencedFence"),mn(q)?jn(E,z,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(q):z(q)}function z(q){return q===l?(E.enter("codeFencedFenceSequence"),W(q)):F(q)}function W(q){return q===l?(B++,E.consume(q),W):B>=o?(E.exit("codeFencedFenceSequence"),mn(q)?jn(E,P,"whitespace")(q):P(q)):F(q)}function P(q){return q===null||Ut(q)?(E.exit("codeFencedFence"),D(q)):F(q)}}}function use(e,n,r){const i=this;return s;function s(o){return o===null?r(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),a)}function a(o){return i.parser.lazy[i.now().line]?r(o):n(o)}}const Lw={name:"codeIndented",tokenize:hse},dse={partial:!0,tokenize:fse};function hse(e,n,r){const i=this;return s;function s(d){return e.enter("codeIndented"),jn(e,a,"linePrefix",5)(d)}function a(d){const p=i.events[i.events.length-1];return p&&p[1].type==="linePrefix"&&p[2].sliceSerialize(p[1],!0).length>=4?o(d):r(d)}function o(d){return d===null?u(d):Ut(d)?e.attempt(dse,o,u)(d):(e.enter("codeFlowValue"),l(d))}function l(d){return d===null||Ut(d)?(e.exit("codeFlowValue"),o(d)):(e.consume(d),l)}function u(d){return e.exit("codeIndented"),n(d)}}function fse(e,n,r){const i=this;return s;function s(o){return i.parser.lazy[i.now().line]?r(o):Ut(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),s):jn(e,a,"linePrefix",5)(o)}function a(o){const l=i.events[i.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?n(o):Ut(o)?s(o):r(o)}}const pse={name:"codeText",previous:gse,resolve:mse,tokenize:vse};function mse(e){let n=e.length-4,r=3,i,s;if((e[r][1].type==="lineEnding"||e[r][1].type==="space")&&(e[n][1].type==="lineEnding"||e[n][1].type==="space")){for(i=r;++i<n;)if(e[i][1].type==="codeTextData"){e[r][1].type="codeTextPadding",e[n][1].type="codeTextPadding",r+=2,n-=2;break}}for(i=r-1,n++;++i<=n;)s===void 0?i!==n&&e[i][1].type!=="lineEnding"&&(s=i):(i===n||e[i][1].type==="lineEnding")&&(e[s][1].type="codeTextData",i!==s+2&&(e[s][1].end=e[i-1][1].end,e.splice(s+2,i-s-2),n-=i-s-2,i=s+2),s=void 0);return e}function gse(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function vse(e,n,r){let i=0,s,a;return o;function o(f){return e.enter("codeText"),e.enter("codeTextSequence"),l(f)}function l(f){return f===96?(e.consume(f),i++,l):(e.exit("codeTextSequence"),u(f))}function u(f){return f===null?r(f):f===32?(e.enter("space"),e.consume(f),e.exit("space"),u):f===96?(a=e.enter("codeTextSequence"),s=0,p(f)):Ut(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),u):(e.enter("codeTextData"),d(f))}function d(f){return f===null||f===32||f===96||Ut(f)?(e.exit("codeTextData"),u(f)):(e.consume(f),d)}function p(f){return f===96?(e.consume(f),s++,p):s===i?(e.exit("codeTextSequence"),e.exit("codeText"),n(f)):(a.type="codeTextData",d(f))}}class yse{constructor(n){this.left=n?[...n]:[],this.right=[]}get(n){if(n<0||n>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+n+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return n<this.left.length?this.left[n]:this.right[this.right.length-n+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(n,r){const i=r??Number.POSITIVE_INFINITY;return i<this.left.length?this.left.slice(n,i):n>this.left.length?this.right.slice(this.right.length-i+this.left.length,this.right.length-n+this.left.length).reverse():this.left.slice(n).concat(this.right.slice(this.right.length-i+this.left.length).reverse())}splice(n,r,i){const s=r||0;this.setCursor(Math.trunc(n));const a=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return i&&Jp(this.left,i),a.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(n){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(n)}pushMany(n){this.setCursor(Number.POSITIVE_INFINITY),Jp(this.left,n)}unshift(n){this.setCursor(0),this.right.push(n)}unshiftMany(n){this.setCursor(0),Jp(this.right,n.reverse())}setCursor(n){if(!(n===this.left.length||n>this.left.length&&this.right.length===0||n<0&&this.left.length===0))if(n<this.left.length){const r=this.left.splice(n,Number.POSITIVE_INFINITY);Jp(this.right,r.reverse())}else{const r=this.right.splice(this.left.length+this.right.length-n,Number.POSITIVE_INFINITY);Jp(this.left,r.reverse())}}}function Jp(e,n){let r=0;if(n.length<1e4)e.push(...n);else for(;r<n.length;)e.push(...n.slice(r,r+1e4)),r+=1e4}function f9(e){const n={};let r=-1,i,s,a,o,l,u,d;const p=new yse(e);for(;++r<p.length;){for(;r in n;)r=n[r];if(i=p.get(r),r&&i[1].type==="chunkFlow"&&p.get(r-1)[1].type==="listItemPrefix"&&(u=i[1]._tokenizer.events,a=0,a<u.length&&u[a][1].type==="lineEndingBlank"&&(a+=2),a<u.length&&u[a][1].type==="content"))for(;++a<u.length&&u[a][1].type!=="content";)u[a][1].type==="chunkText"&&(u[a][1]._isInFirstContentOfListItem=!0,a++);if(i[0]==="enter")i[1].contentType&&(Object.assign(n,_se(p,r)),r=n[r],d=!0);else if(i[1]._container){for(a=r,s=void 0;a--;)if(o=p.get(a),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(s&&(p.get(s)[1].type="lineEndingBlank"),o[1].type="lineEnding",s=a);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;s&&(i[1].end={...p.get(s)[1].start},l=p.slice(s,r),l.unshift(i),p.splice(s,r-s+1,l))}}return Js(e,0,Number.POSITIVE_INFINITY,p.slice(0)),!d}function _se(e,n){const r=e.get(n)[1],i=e.get(n)[2];let s=n-1;const a=[];let o=r._tokenizer;o||(o=i.parser[r.contentType](r.start),r._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const l=o.events,u=[],d={};let p,f,g=-1,_=r,x=0,v=0;const S=[v];for(;_;){for(;e.get(++s)[1]!==_;);a.push(s),_._tokenizer||(p=i.sliceStream(_),_.next||p.push(null),f&&o.defineSkip(_.start),_._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(p),_._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),f=_,_=_.next}for(_=r;++g<l.length;)l[g][0]==="exit"&&l[g-1][0]==="enter"&&l[g][1].type===l[g-1][1].type&&l[g][1].start.line!==l[g][1].end.line&&(v=g+1,S.push(v),_._tokenizer=void 0,_.previous=void 0,_=_.next);for(o.events=[],_?(_._tokenizer=void 0,_.previous=void 0):S.pop(),g=S.length;g--;){const w=l.slice(S[g],S[g+1]),N=a.pop();u.push([N,N+w.length-1]),e.splice(N,2,w)}for(u.reverse(),g=-1;++g<u.length;)d[x+u[g][0]]=x+u[g][1],x+=u[g][1]-u[g][0]-1;return d}const xse={resolve:kse,tokenize:wse},bse={partial:!0,tokenize:Sse};function kse(e){return f9(e),e}function wse(e,n){let r;return i;function i(l){return e.enter("content"),r=e.enter("chunkContent",{contentType:"content"}),s(l)}function s(l){return l===null?a(l):Ut(l)?e.check(bse,o,a)(l):(e.consume(l),s)}function a(l){return e.exit("chunkContent"),e.exit("content"),n(l)}function o(l){return e.consume(l),e.exit("chunkContent"),r.next=e.enter("chunkContent",{contentType:"content",previous:r}),r=r.next,s}}function Sse(e,n,r){const i=this;return s;function s(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),jn(e,a,"linePrefix")}function a(o){if(o===null||Ut(o))return r(o);const l=i.events[i.events.length-1];return!i.parser.constructs.disable.null.includes("codeIndented")&&l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?n(o):e.interrupt(i.parser.constructs.flow,r,n)(o)}}function p9(e,n,r,i,s,a,o,l,u){const d=u||Number.POSITIVE_INFINITY;let p=0;return f;function f(w){return w===60?(e.enter(i),e.enter(s),e.enter(a),e.consume(w),e.exit(a),g):w===null||w===32||w===41||Kx(w)?r(w):(e.enter(i),e.enter(o),e.enter(l),e.enter("chunkString",{contentType:"string"}),v(w))}function g(w){return w===62?(e.enter(a),e.consume(w),e.exit(a),e.exit(s),e.exit(i),n):(e.enter(l),e.enter("chunkString",{contentType:"string"}),_(w))}function _(w){return w===62?(e.exit("chunkString"),e.exit(l),g(w)):w===null||w===60||Ut(w)?r(w):(e.consume(w),w===92?x:_)}function x(w){return w===60||w===62||w===92?(e.consume(w),_):_(w)}function v(w){return!p&&(w===null||w===41||er(w))?(e.exit("chunkString"),e.exit(l),e.exit(o),e.exit(i),n(w)):p<d&&w===40?(e.consume(w),p++,v):w===41?(e.consume(w),p--,v):w===null||w===32||w===40||Kx(w)?r(w):(e.consume(w),w===92?S:v)}function S(w){return w===40||w===41||w===92?(e.consume(w),v):v(w)}}function m9(e,n,r,i,s,a){const o=this;let l=0,u;return d;function d(_){return e.enter(i),e.enter(s),e.consume(_),e.exit(s),e.enter(a),p}function p(_){return l>999||_===null||_===91||_===93&&!u||_===94&&!l&&"_hiddenFootnoteSupport"in o.parser.constructs?r(_):_===93?(e.exit(a),e.enter(s),e.consume(_),e.exit(s),e.exit(i),n):Ut(_)?(e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),p):(e.enter("chunkString",{contentType:"string"}),f(_))}function f(_){return _===null||_===91||_===93||Ut(_)||l++>999?(e.exit("chunkString"),p(_)):(e.consume(_),u||(u=!mn(_)),_===92?g:f)}function g(_){return _===91||_===92||_===93?(e.consume(_),l++,f):f(_)}}function g9(e,n,r,i,s,a){let o;return l;function l(g){return g===34||g===39||g===40?(e.enter(i),e.enter(s),e.consume(g),e.exit(s),o=g===40?41:g,u):r(g)}function u(g){return g===o?(e.enter(s),e.consume(g),e.exit(s),e.exit(i),n):(e.enter(a),d(g))}function d(g){return g===o?(e.exit(a),u(o)):g===null?r(g):Ut(g)?(e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),jn(e,d,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),p(g))}function p(g){return g===o||g===null||Ut(g)?(e.exit("chunkString"),d(g)):(e.consume(g),g===92?f:p)}function f(g){return g===o||g===92?(e.consume(g),p):p(g)}}function Um(e,n){let r;return i;function i(s){return Ut(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),r=!0,i):mn(s)?jn(e,i,r?"linePrefix":"lineSuffix")(s):n(s)}}const Cse={name:"definition",tokenize:Nse},jse={partial:!0,tokenize:Ese};function Nse(e,n,r){const i=this;let s;return a;function a(_){return e.enter("definition"),o(_)}function o(_){return m9.call(i,e,l,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(_)}function l(_){return s=Qa(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)),_===58?(e.enter("definitionMarker"),e.consume(_),e.exit("definitionMarker"),u):r(_)}function u(_){return er(_)?Um(e,d)(_):d(_)}function d(_){return p9(e,p,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(_)}function p(_){return e.attempt(jse,f,f)(_)}function f(_){return mn(_)?jn(e,g,"whitespace")(_):g(_)}function g(_){return _===null||Ut(_)?(e.exit("definition"),i.parser.defined.push(s),n(_)):r(_)}}function Ese(e,n,r){return i;function i(l){return er(l)?Um(e,s)(l):r(l)}function s(l){return g9(e,a,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function a(l){return mn(l)?jn(e,o,"whitespace")(l):o(l)}function o(l){return l===null||Ut(l)?n(l):r(l)}}const Ase={name:"hardBreakEscape",tokenize:Tse};function Tse(e,n,r){return i;function i(a){return e.enter("hardBreakEscape"),e.consume(a),s}function s(a){return Ut(a)?(e.exit("hardBreakEscape"),n(a)):r(a)}}const Mse={name:"headingAtx",resolve:Rse,tokenize:Ose};function Rse(e,n){let r=e.length-2,i=3,s,a;return e[i][1].type==="whitespace"&&(i+=2),r-2>i&&e[r][1].type==="whitespace"&&(r-=2),e[r][1].type==="atxHeadingSequence"&&(i===r-1||r-4>i&&e[r-2][1].type==="whitespace")&&(r-=i+1===r?2:4),r>i&&(s={type:"atxHeadingText",start:e[i][1].start,end:e[r][1].end},a={type:"chunkText",start:e[i][1].start,end:e[r][1].end,contentType:"text"},Js(e,i,r-i+1,[["enter",s,n],["enter",a,n],["exit",a,n],["exit",s,n]])),e}function Ose(e,n,r){let i=0;return s;function s(p){return e.enter("atxHeading"),a(p)}function a(p){return e.enter("atxHeadingSequence"),o(p)}function o(p){return p===35&&i++<6?(e.consume(p),o):p===null||er(p)?(e.exit("atxHeadingSequence"),l(p)):r(p)}function l(p){return p===35?(e.enter("atxHeadingSequence"),u(p)):p===null||Ut(p)?(e.exit("atxHeading"),n(p)):mn(p)?jn(e,l,"whitespace")(p):(e.enter("atxHeadingText"),d(p))}function u(p){return p===35?(e.consume(p),u):(e.exit("atxHeadingSequence"),l(p))}function d(p){return p===null||p===35||er(p)?(e.exit("atxHeadingText"),l(p)):(e.consume(p),d)}}const Dse=["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"],v4=["pre","script","style","textarea"],Pse={concrete:!0,name:"htmlFlow",resolveTo:Bse,tokenize:zse},Lse={partial:!0,tokenize:Fse},Ise={partial:!0,tokenize:$se};function Bse(e){let n=e.length;for(;n--&&!(e[n][0]==="enter"&&e[n][1].type==="htmlFlow"););return n>1&&e[n-2][1].type==="linePrefix"&&(e[n][1].start=e[n-2][1].start,e[n+1][1].start=e[n-2][1].start,e.splice(n-2,2)),e}function zse(e,n,r){const i=this;let s,a,o,l,u;return d;function d(V){return p(V)}function p(V){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(V),f}function f(V){return V===33?(e.consume(V),g):V===47?(e.consume(V),a=!0,v):V===63?(e.consume(V),s=3,i.interrupt?n:Y):Qi(V)?(e.consume(V),o=String.fromCharCode(V),S):r(V)}function g(V){return V===45?(e.consume(V),s=2,_):V===91?(e.consume(V),s=5,l=0,x):Qi(V)?(e.consume(V),s=4,i.interrupt?n:Y):r(V)}function _(V){return V===45?(e.consume(V),i.interrupt?n:Y):r(V)}function x(V){const ie="CDATA[";return V===ie.charCodeAt(l++)?(e.consume(V),l===ie.length?i.interrupt?n:z:x):r(V)}function v(V){return Qi(V)?(e.consume(V),o=String.fromCharCode(V),S):r(V)}function S(V){if(V===null||V===47||V===62||er(V)){const ie=V===47,te=o.toLowerCase();return!ie&&!a&&v4.includes(te)?(s=1,i.interrupt?n(V):z(V)):Dse.includes(o.toLowerCase())?(s=6,ie?(e.consume(V),w):i.interrupt?n(V):z(V)):(s=7,i.interrupt&&!i.parser.lazy[i.now().line]?r(V):a?N(V):C(V))}return V===45||Hi(V)?(e.consume(V),o+=String.fromCharCode(V),S):r(V)}function w(V){return V===62?(e.consume(V),i.interrupt?n:z):r(V)}function N(V){return mn(V)?(e.consume(V),N):H(V)}function C(V){return V===47?(e.consume(V),H):V===58||V===95||Qi(V)?(e.consume(V),T):mn(V)?(e.consume(V),C):H(V)}function T(V){return V===45||V===46||V===58||V===95||Hi(V)?(e.consume(V),T):A(V)}function A(V){return V===61?(e.consume(V),E):mn(V)?(e.consume(V),A):C(V)}function E(V){return V===null||V===60||V===61||V===62||V===96?r(V):V===34||V===39?(e.consume(V),u=V,D):mn(V)?(e.consume(V),E):F(V)}function D(V){return V===u?(e.consume(V),u=null,B):V===null||Ut(V)?r(V):(e.consume(V),D)}function F(V){return V===null||V===34||V===39||V===47||V===60||V===61||V===62||V===96||er(V)?A(V):(e.consume(V),F)}function B(V){return V===47||V===62||mn(V)?C(V):r(V)}function H(V){return V===62?(e.consume(V),$):r(V)}function $(V){return V===null||Ut(V)?z(V):mn(V)?(e.consume(V),$):r(V)}function z(V){return V===45&&s===2?(e.consume(V),I):V===60&&s===1?(e.consume(V),Q):V===62&&s===4?(e.consume(V),R):V===63&&s===3?(e.consume(V),Y):V===93&&s===5?(e.consume(V),Z):Ut(V)&&(s===6||s===7)?(e.exit("htmlFlowData"),e.check(Lse,U,W)(V)):V===null||Ut(V)?(e.exit("htmlFlowData"),W(V)):(e.consume(V),z)}function W(V){return e.check(Ise,P,U)(V)}function P(V){return e.enter("lineEnding"),e.consume(V),e.exit("lineEnding"),q}function q(V){return V===null||Ut(V)?W(V):(e.enter("htmlFlowData"),z(V))}function I(V){return V===45?(e.consume(V),Y):z(V)}function Q(V){return V===47?(e.consume(V),o="",K):z(V)}function K(V){if(V===62){const ie=o.toLowerCase();return v4.includes(ie)?(e.consume(V),R):z(V)}return Qi(V)&&o.length<8?(e.consume(V),o+=String.fromCharCode(V),K):z(V)}function Z(V){return V===93?(e.consume(V),Y):z(V)}function Y(V){return V===62?(e.consume(V),R):V===45&&s===2?(e.consume(V),Y):z(V)}function R(V){return V===null||Ut(V)?(e.exit("htmlFlowData"),U(V)):(e.consume(V),R)}function U(V){return e.exit("htmlFlow"),n(V)}}function $se(e,n,r){const i=this;return s;function s(o){return Ut(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),a):r(o)}function a(o){return i.parser.lazy[i.now().line]?r(o):n(o)}}function Fse(e,n,r){return i;function i(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(hv,n,r)}}const Hse={name:"htmlText",tokenize:Wse};function Wse(e,n,r){const i=this;let s,a,o;return l;function l(Y){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(Y),u}function u(Y){return Y===33?(e.consume(Y),d):Y===47?(e.consume(Y),A):Y===63?(e.consume(Y),C):Qi(Y)?(e.consume(Y),F):r(Y)}function d(Y){return Y===45?(e.consume(Y),p):Y===91?(e.consume(Y),a=0,x):Qi(Y)?(e.consume(Y),N):r(Y)}function p(Y){return Y===45?(e.consume(Y),_):r(Y)}function f(Y){return Y===null?r(Y):Y===45?(e.consume(Y),g):Ut(Y)?(o=f,Q(Y)):(e.consume(Y),f)}function g(Y){return Y===45?(e.consume(Y),_):f(Y)}function _(Y){return Y===62?I(Y):Y===45?g(Y):f(Y)}function x(Y){const R="CDATA[";return Y===R.charCodeAt(a++)?(e.consume(Y),a===R.length?v:x):r(Y)}function v(Y){return Y===null?r(Y):Y===93?(e.consume(Y),S):Ut(Y)?(o=v,Q(Y)):(e.consume(Y),v)}function S(Y){return Y===93?(e.consume(Y),w):v(Y)}function w(Y){return Y===62?I(Y):Y===93?(e.consume(Y),w):v(Y)}function N(Y){return Y===null||Y===62?I(Y):Ut(Y)?(o=N,Q(Y)):(e.consume(Y),N)}function C(Y){return Y===null?r(Y):Y===63?(e.consume(Y),T):Ut(Y)?(o=C,Q(Y)):(e.consume(Y),C)}function T(Y){return Y===62?I(Y):C(Y)}function A(Y){return Qi(Y)?(e.consume(Y),E):r(Y)}function E(Y){return Y===45||Hi(Y)?(e.consume(Y),E):D(Y)}function D(Y){return Ut(Y)?(o=D,Q(Y)):mn(Y)?(e.consume(Y),D):I(Y)}function F(Y){return Y===45||Hi(Y)?(e.consume(Y),F):Y===47||Y===62||er(Y)?B(Y):r(Y)}function B(Y){return Y===47?(e.consume(Y),I):Y===58||Y===95||Qi(Y)?(e.consume(Y),H):Ut(Y)?(o=B,Q(Y)):mn(Y)?(e.consume(Y),B):I(Y)}function H(Y){return Y===45||Y===46||Y===58||Y===95||Hi(Y)?(e.consume(Y),H):$(Y)}function $(Y){return Y===61?(e.consume(Y),z):Ut(Y)?(o=$,Q(Y)):mn(Y)?(e.consume(Y),$):B(Y)}function z(Y){return Y===null||Y===60||Y===61||Y===62||Y===96?r(Y):Y===34||Y===39?(e.consume(Y),s=Y,W):Ut(Y)?(o=z,Q(Y)):mn(Y)?(e.consume(Y),z):(e.consume(Y),P)}function W(Y){return Y===s?(e.consume(Y),s=void 0,q):Y===null?r(Y):Ut(Y)?(o=W,Q(Y)):(e.consume(Y),W)}function P(Y){return Y===null||Y===34||Y===39||Y===60||Y===61||Y===96?r(Y):Y===47||Y===62||er(Y)?B(Y):(e.consume(Y),P)}function q(Y){return Y===47||Y===62||er(Y)?B(Y):r(Y)}function I(Y){return Y===62?(e.consume(Y),e.exit("htmlTextData"),e.exit("htmlText"),n):r(Y)}function Q(Y){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(Y),e.exit("lineEnding"),K}function K(Y){return mn(Y)?jn(e,Z,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(Y):Z(Y)}function Z(Y){return e.enter("htmlTextData"),o(Y)}}const zE={name:"labelEnd",resolveAll:Kse,resolveTo:Yse,tokenize:Gse},qse={tokenize:Xse},Use={tokenize:Qse},Vse={tokenize:Zse};function Kse(e){let n=-1;const r=[];for(;++n<e.length;){const i=e[n][1];if(r.push(e[n]),i.type==="labelImage"||i.type==="labelLink"||i.type==="labelEnd"){const s=i.type==="labelImage"?4:2;i.type="data",n+=s}}return e.length!==r.length&&Js(e,0,e.length,r),e}function Yse(e,n){let r=e.length,i=0,s,a,o,l;for(;r--;)if(s=e[r][1],a){if(s.type==="link"||s.type==="labelLink"&&s._inactive)break;e[r][0]==="enter"&&s.type==="labelLink"&&(s._inactive=!0)}else if(o){if(e[r][0]==="enter"&&(s.type==="labelImage"||s.type==="labelLink")&&!s._balanced&&(a=r,s.type!=="labelLink")){i=2;break}}else s.type==="labelEnd"&&(o=r);const u={type:e[a][1].type==="labelLink"?"link":"image",start:{...e[a][1].start},end:{...e[e.length-1][1].end}},d={type:"label",start:{...e[a][1].start},end:{...e[o][1].end}},p={type:"labelText",start:{...e[a+i+2][1].end},end:{...e[o-2][1].start}};return l=[["enter",u,n],["enter",d,n]],l=xa(l,e.slice(a+1,a+i+3)),l=xa(l,[["enter",p,n]]),l=xa(l,m0(n.parser.constructs.insideSpan.null,e.slice(a+i+4,o-3),n)),l=xa(l,[["exit",p,n],e[o-2],e[o-1],["exit",d,n]]),l=xa(l,e.slice(o+1)),l=xa(l,[["exit",u,n]]),Js(e,a,e.length,l),e}function Gse(e,n,r){const i=this;let s=i.events.length,a,o;for(;s--;)if((i.events[s][1].type==="labelImage"||i.events[s][1].type==="labelLink")&&!i.events[s][1]._balanced){a=i.events[s][1];break}return l;function l(g){return a?a._inactive?f(g):(o=i.parser.defined.includes(Qa(i.sliceSerialize({start:a.end,end:i.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(g),e.exit("labelMarker"),e.exit("labelEnd"),u):r(g)}function u(g){return g===40?e.attempt(qse,p,o?p:f)(g):g===91?e.attempt(Use,p,o?d:f)(g):o?p(g):f(g)}function d(g){return e.attempt(Vse,p,f)(g)}function p(g){return n(g)}function f(g){return a._balanced=!0,r(g)}}function Xse(e,n,r){return i;function i(f){return e.enter("resource"),e.enter("resourceMarker"),e.consume(f),e.exit("resourceMarker"),s}function s(f){return er(f)?Um(e,a)(f):a(f)}function a(f){return f===41?p(f):p9(e,o,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(f)}function o(f){return er(f)?Um(e,u)(f):p(f)}function l(f){return r(f)}function u(f){return f===34||f===39||f===40?g9(e,d,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(f):p(f)}function d(f){return er(f)?Um(e,p)(f):p(f)}function p(f){return f===41?(e.enter("resourceMarker"),e.consume(f),e.exit("resourceMarker"),e.exit("resource"),n):r(f)}}function Qse(e,n,r){const i=this;return s;function s(l){return m9.call(i,e,a,o,"reference","referenceMarker","referenceString")(l)}function a(l){return i.parser.defined.includes(Qa(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)))?n(l):r(l)}function o(l){return r(l)}}function Zse(e,n,r){return i;function i(a){return e.enter("reference"),e.enter("referenceMarker"),e.consume(a),e.exit("referenceMarker"),s}function s(a){return a===93?(e.enter("referenceMarker"),e.consume(a),e.exit("referenceMarker"),e.exit("reference"),n):r(a)}}const Jse={name:"labelStartImage",resolveAll:zE.resolveAll,tokenize:eae};function eae(e,n,r){const i=this;return s;function s(l){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(l),e.exit("labelImageMarker"),a}function a(l){return l===91?(e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelImage"),o):r(l)}function o(l){return l===94&&"_hiddenFootnoteSupport"in i.parser.constructs?r(l):n(l)}}const tae={name:"labelStartLink",resolveAll:zE.resolveAll,tokenize:nae};function nae(e,n,r){const i=this;return s;function s(o){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelLink"),a}function a(o){return o===94&&"_hiddenFootnoteSupport"in i.parser.constructs?r(o):n(o)}}const Iw={name:"lineEnding",tokenize:rae};function rae(e,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),jn(e,n,"linePrefix")}}const lx={name:"thematicBreak",tokenize:iae};function iae(e,n,r){let i=0,s;return a;function a(d){return e.enter("thematicBreak"),o(d)}function o(d){return s=d,l(d)}function l(d){return d===s?(e.enter("thematicBreakSequence"),u(d)):i>=3&&(d===null||Ut(d))?(e.exit("thematicBreak"),n(d)):r(d)}function u(d){return d===s?(e.consume(d),i++,u):(e.exit("thematicBreakSequence"),mn(d)?jn(e,l,"whitespace")(d):l(d))}}const vs={continuation:{tokenize:lae},exit:uae,name:"list",tokenize:oae},sae={partial:!0,tokenize:dae},aae={partial:!0,tokenize:cae};function oae(e,n,r){const i=this,s=i.events[i.events.length-1];let a=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,o=0;return l;function l(_){const x=i.containerState.type||(_===42||_===43||_===45?"listUnordered":"listOrdered");if(x==="listUnordered"?!i.containerState.marker||_===i.containerState.marker:ZC(_)){if(i.containerState.type||(i.containerState.type=x,e.enter(x,{_container:!0})),x==="listUnordered")return e.enter("listItemPrefix"),_===42||_===45?e.check(lx,r,d)(_):d(_);if(!i.interrupt||_===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),u(_)}return r(_)}function u(_){return ZC(_)&&++o<10?(e.consume(_),u):(!i.interrupt||o<2)&&(i.containerState.marker?_===i.containerState.marker:_===41||_===46)?(e.exit("listItemValue"),d(_)):r(_)}function d(_){return e.enter("listItemMarker"),e.consume(_),e.exit("listItemMarker"),i.containerState.marker=i.containerState.marker||_,e.check(hv,i.interrupt?r:p,e.attempt(sae,g,f))}function p(_){return i.containerState.initialBlankLine=!0,a++,g(_)}function f(_){return mn(_)?(e.enter("listItemPrefixWhitespace"),e.consume(_),e.exit("listItemPrefixWhitespace"),g):r(_)}function g(_){return i.containerState.size=a+i.sliceSerialize(e.exit("listItemPrefix"),!0).length,n(_)}}function lae(e,n,r){const i=this;return i.containerState._closeFlow=void 0,e.check(hv,s,a);function s(l){return i.containerState.furtherBlankLines=i.containerState.furtherBlankLines||i.containerState.initialBlankLine,jn(e,n,"listItemIndent",i.containerState.size+1)(l)}function a(l){return i.containerState.furtherBlankLines||!mn(l)?(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,o(l)):(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,e.attempt(aae,n,o)(l))}function o(l){return i.containerState._closeFlow=!0,i.interrupt=void 0,jn(e,e.attempt(vs,n,r),"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function cae(e,n,r){const i=this;return jn(e,s,"listItemIndent",i.containerState.size+1);function s(a){const o=i.events[i.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===i.containerState.size?n(a):r(a)}}function uae(e){e.exit(this.containerState.type)}function dae(e,n,r){const i=this;return jn(e,s,"listItemPrefixWhitespace",i.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(a){const o=i.events[i.events.length-1];return!mn(a)&&o&&o[1].type==="listItemPrefixWhitespace"?n(a):r(a)}}const y4={name:"setextUnderline",resolveTo:hae,tokenize:fae};function hae(e,n){let r=e.length,i,s,a;for(;r--;)if(e[r][0]==="enter"){if(e[r][1].type==="content"){i=r;break}e[r][1].type==="paragraph"&&(s=r)}else e[r][1].type==="content"&&e.splice(r,1),!a&&e[r][1].type==="definition"&&(a=r);const o={type:"setextHeading",start:{...e[i][1].start},end:{...e[e.length-1][1].end}};return e[s][1].type="setextHeadingText",a?(e.splice(s,0,["enter",o,n]),e.splice(a+1,0,["exit",e[i][1],n]),e[i][1].end={...e[a][1].end}):e[i][1]=o,e.push(["exit",o,n]),e}function fae(e,n,r){const i=this;let s;return a;function a(d){let p=i.events.length,f;for(;p--;)if(i.events[p][1].type!=="lineEnding"&&i.events[p][1].type!=="linePrefix"&&i.events[p][1].type!=="content"){f=i.events[p][1].type==="paragraph";break}return!i.parser.lazy[i.now().line]&&(i.interrupt||f)?(e.enter("setextHeadingLine"),s=d,o(d)):r(d)}function o(d){return e.enter("setextHeadingLineSequence"),l(d)}function l(d){return d===s?(e.consume(d),l):(e.exit("setextHeadingLineSequence"),mn(d)?jn(e,u,"lineSuffix")(d):u(d))}function u(d){return d===null||Ut(d)?(e.exit("setextHeadingLine"),n(d)):r(d)}}const pae={tokenize:mae};function mae(e){const n=this,r=e.attempt(hv,i,e.attempt(this.parser.constructs.flowInitial,s,jn(e,e.attempt(this.parser.constructs.flow,s,e.attempt(xse,s)),"linePrefix")));return r;function i(a){if(a===null){e.consume(a);return}return e.enter("lineEndingBlank"),e.consume(a),e.exit("lineEndingBlank"),n.currentConstruct=void 0,r}function s(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n.currentConstruct=void 0,r}}const gae={resolveAll:y9()},vae=v9("string"),yae=v9("text");function v9(e){return{resolveAll:y9(e==="text"?_ae:void 0),tokenize:n};function n(r){const i=this,s=this.parser.constructs[e],a=r.attempt(s,o,l);return o;function o(p){return d(p)?a(p):l(p)}function l(p){if(p===null){r.consume(p);return}return r.enter("data"),r.consume(p),u}function u(p){return d(p)?(r.exit("data"),a(p)):(r.consume(p),u)}function d(p){if(p===null)return!0;const f=s[p];let g=-1;if(f)for(;++g<f.length;){const _=f[g];if(!_.previous||_.previous.call(i,i.previous))return!0}return!1}}}function y9(e){return n;function n(r,i){let s=-1,a;for(;++s<=r.length;)a===void 0?r[s]&&r[s][1].type==="data"&&(a=s,s++):(!r[s]||r[s][1].type!=="data")&&(s!==a+2&&(r[a][1].end=r[s-1][1].end,r.splice(a+2,s-a-2),s=a+2),a=void 0);return e?e(r,i):r}}function _ae(e,n){let r=0;for(;++r<=e.length;)if((r===e.length||e[r][1].type==="lineEnding")&&e[r-1][1].type==="data"){const i=e[r-1][1],s=n.sliceStream(i);let a=s.length,o=-1,l=0,u;for(;a--;){const d=s[a];if(typeof d=="string"){for(o=d.length;d.charCodeAt(o-1)===32;)l++,o--;if(o)break;o=-1}else if(d===-2)u=!0,l++;else if(d!==-1){a++;break}}if(n._contentTypeTextTrailing&&r===e.length&&(l=0),l){const d={type:r===e.length||u||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:a?o:i.start._bufferIndex+o,_index:i.start._index+a,line:i.end.line,column:i.end.column-l,offset:i.end.offset-l},end:{...i.end}};i.end={...d.start},i.start.offset===i.end.offset?Object.assign(i,d):(e.splice(r,0,["enter",d,n],["exit",d,n]),r+=2)}r++}return e}const xae={42:vs,43:vs,45:vs,48:vs,49:vs,50:vs,51:vs,52:vs,53:vs,54:vs,55:vs,56:vs,57:vs,62:u9},bae={91:Cse},kae={[-2]:Lw,[-1]:Lw,32:Lw},wae={35:Mse,42:lx,45:[y4,lx],60:Pse,61:y4,95:lx,96:g4,126:g4},Sae={38:h9,92:d9},Cae={[-5]:Iw,[-4]:Iw,[-3]:Iw,33:Jse,38:h9,42:JC,60:[tse,Hse],91:tae,92:[Ase,d9],93:zE,95:JC,96:pse},jae={null:[JC,gae]},Nae={null:[42,95]},Eae={null:[]},Aae=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:Nae,contentInitial:bae,disable:Eae,document:xae,flow:wae,flowInitial:kae,insideSpan:jae,string:Sae,text:Cae},Symbol.toStringTag,{value:"Module"}));function Tae(e,n,r){let i={_bufferIndex:-1,_index:0,line:r&&r.line||1,column:r&&r.column||1,offset:r&&r.offset||0};const s={},a=[];let o=[],l=[];const u={attempt:D(A),check:D(E),consume:N,enter:C,exit:T,interrupt:D(E,{interrupt:!0})},d={code:null,containerState:{},defineSkip:v,events:[],now:x,parser:e,previous:null,sliceSerialize:g,sliceStream:_,write:f};let p=n.tokenize.call(d,u);return n.resolveAll&&a.push(n),d;function f($){return o=xa(o,$),S(),o[o.length-1]!==null?[]:(F(n,0),d.events=m0(a,d.events,d),d.events)}function g($,z){return Rae(_($),z)}function _($){return Mae(o,$)}function x(){const{_bufferIndex:$,_index:z,line:W,column:P,offset:q}=i;return{_bufferIndex:$,_index:z,line:W,column:P,offset:q}}function v($){s[$.line]=$.column,H()}function S(){let $;for(;i._index<o.length;){const z=o[i._index];if(typeof z=="string")for($=i._index,i._bufferIndex<0&&(i._bufferIndex=0);i._index===$&&i._bufferIndex<z.length;)w(z.charCodeAt(i._bufferIndex));else w(z)}}function w($){p=p($)}function N($){Ut($)?(i.line++,i.column=1,i.offset+=$===-3?2:1,H()):$!==-1&&(i.column++,i.offset++),i._bufferIndex<0?i._index++:(i._bufferIndex++,i._bufferIndex===o[i._index].length&&(i._bufferIndex=-1,i._index++)),d.previous=$}function C($,z){const W=z||{};return W.type=$,W.start=x(),d.events.push(["enter",W,d]),l.push(W),W}function T($){const z=l.pop();return z.end=x(),d.events.push(["exit",z,d]),z}function A($,z){F($,z.from)}function E($,z){z.restore()}function D($,z){return W;function W(P,q,I){let Q,K,Z,Y;return Array.isArray(P)?U(P):"tokenize"in P?U([P]):R(P);function R(X){return se;function se(re){const de=re!==null&&X[re],ue=re!==null&&X.null,ae=[...Array.isArray(de)?de:de?[de]:[],...Array.isArray(ue)?ue:ue?[ue]:[]];return U(ae)(re)}}function U(X){return Q=X,K=0,X.length===0?I:V(X[K])}function V(X){return se;function se(re){return Y=B(),Z=X,X.partial||(d.currentConstruct=X),X.name&&d.parser.constructs.disable.null.includes(X.name)?te():X.tokenize.call(z?Object.assign(Object.create(d),z):d,u,ie,te)(re)}}function ie(X){return $(Z,Y),q}function te(X){return Y.restore(),++K<Q.length?V(Q[K]):I}}}function F($,z){$.resolveAll&&!a.includes($)&&a.push($),$.resolve&&Js(d.events,z,d.events.length-z,$.resolve(d.events.slice(z),d)),$.resolveTo&&(d.events=$.resolveTo(d.events,d))}function B(){const $=x(),z=d.previous,W=d.currentConstruct,P=d.events.length,q=Array.from(l);return{from:P,restore:I};function I(){i=$,d.previous=z,d.currentConstruct=W,d.events.length=P,l=q,H()}}function H(){i.line in s&&i.column<2&&(i.column=s[i.line],i.offset+=s[i.line]-1)}}function Mae(e,n){const r=n.start._index,i=n.start._bufferIndex,s=n.end._index,a=n.end._bufferIndex;let o;if(r===s)o=[e[r].slice(i,a)];else{if(o=e.slice(r,s),i>-1){const l=o[0];typeof l=="string"?o[0]=l.slice(i):o.shift()}a>0&&o.push(e[s].slice(0,a))}return o}function Rae(e,n){let r=-1;const i=[];let s;for(;++r<e.length;){const a=e[r];let o;if(typeof a=="string")o=a;else switch(a){case-5:{o="\r";break}case-4:{o=`
`;break}case-3:{o=`\r
`;break}case-2:{o=n?" ":"	";break}case-1:{if(!n&&s)continue;o=" ";break}default:o=String.fromCharCode(a)}s=a===-2,i.push(o)}return i.join("")}function Oae(e){const i={constructs:l9([Aae,...(e||{}).extensions||[]]),content:s(Yie),defined:[],document:s(Xie),flow:s(pae),lazy:{},string:s(vae),text:s(yae)};return i;function s(a){return o;function o(l){return Tae(i,a,l)}}}function Dae(e){for(;!f9(e););return e}const _4=/[\0\t\n\r]/g;function Pae(){let e=1,n="",r=!0,i;return s;function s(a,o,l){const u=[];let d,p,f,g,_;for(a=n+(typeof a=="string"?a.toString():new TextDecoder(o||void 0).decode(a)),f=0,n="",r&&(a.charCodeAt(0)===65279&&f++,r=void 0);f<a.length;){if(_4.lastIndex=f,d=_4.exec(a),g=d&&d.index!==void 0?d.index:a.length,_=a.charCodeAt(g),!d){n=a.slice(f);break}if(_===10&&f===g&&i)u.push(-3),i=void 0;else switch(i&&(u.push(-5),i=void 0),f<g&&(u.push(a.slice(f,g)),e+=g-f),_){case 0:{u.push(65533),e++;break}case 9:{for(p=Math.ceil(e/4)*4,u.push(-2);e++<p;)u.push(-1);break}case 10:{u.push(-4),e=1;break}default:i=!0,e=1}f=g+1}return l&&(i&&u.push(-5),n&&u.push(n),u.push(null)),u}}const Lae=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Iae(e){return e.replace(Lae,Bae)}function Bae(e,n,r){if(n)return n;if(r.charCodeAt(0)===35){const s=r.charCodeAt(1),a=s===120||s===88;return c9(r.slice(a?2:1),a?16:10)}return BE(r)||e}const _9={}.hasOwnProperty;function zae(e,n,r){return n&&typeof n=="object"&&(r=n,n=void 0),$ae(r)(Dae(Oae(r).document().write(Pae()(e,n,!0))))}function $ae(e){const n={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:a(Ue),autolinkProtocol:B,autolinkEmail:B,atxHeading:a(fe),blockQuote:a(ue),characterEscape:B,characterReference:B,codeFenced:a(ae),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:a(ae,o),codeText:a(pe,o),codeTextData:B,data:B,codeFlowValue:B,definition:a(J),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:a(me),hardBreakEscape:a(ve),hardBreakTrailing:a(ve),htmlFlow:a(Ke,o),htmlFlowData:B,htmlText:a(Ke,o),htmlTextData:B,image:a(ge),label:o,link:a(Ue),listItem:a(Bt),listItemValue:g,listOrdered:a($e,f),listUnordered:a($e),paragraph:a(ct),reference:V,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:a(fe),strong:a(Mt),thematicBreak:a(Dt)},exit:{atxHeading:u(),atxHeadingSequence:A,autolink:u(),autolinkEmail:de,autolinkProtocol:re,blockQuote:u(),characterEscapeValue:H,characterReferenceMarkerHexadecimal:te,characterReferenceMarkerNumeric:te,characterReferenceValue:X,characterReference:se,codeFenced:u(S),codeFencedFence:v,codeFencedFenceInfo:_,codeFencedFenceMeta:x,codeFlowValue:H,codeIndented:u(w),codeText:u(q),codeTextData:H,data:H,definition:u(),definitionDestinationString:T,definitionLabelString:N,definitionTitleString:C,emphasis:u(),hardBreakEscape:u(z),hardBreakTrailing:u(z),htmlFlow:u(W),htmlFlowData:H,htmlText:u(P),htmlTextData:H,image:u(Q),label:Z,labelText:K,lineEnding:$,link:u(I),listItem:u(),listOrdered:u(),listUnordered:u(),paragraph:u(),referenceString:ie,resourceDestinationString:Y,resourceTitleString:R,resource:U,setextHeading:u(F),setextHeadingLineSequence:D,setextHeadingText:E,strong:u(),thematicBreak:u()}};x9(n,(e||{}).mdastExtensions||[]);const r={};return i;function i(Re){let et={type:"root",children:[]};const bt={stack:[et],tokenStack:[],config:n,enter:l,exit:d,buffer:o,resume:p,data:r},yt=[];let O=-1;for(;++O<Re.length;)if(Re[O][1].type==="listOrdered"||Re[O][1].type==="listUnordered")if(Re[O][0]==="enter")yt.push(O);else{const ke=yt.pop();O=s(Re,ke,O)}for(O=-1;++O<Re.length;){const ke=n[Re[O][0]];_9.call(ke,Re[O][1].type)&&ke[Re[O][1].type].call(Object.assign({sliceSerialize:Re[O][2].sliceSerialize},bt),Re[O][1])}if(bt.tokenStack.length>0){const ke=bt.tokenStack[bt.tokenStack.length-1];(ke[1]||x4).call(bt,void 0,ke[0])}for(et.position={start:Ec(Re.length>0?Re[0][1].start:{line:1,column:1,offset:0}),end:Ec(Re.length>0?Re[Re.length-2][1].end:{line:1,column:1,offset:0})},O=-1;++O<n.transforms.length;)et=n.transforms[O](et)||et;return et}function s(Re,et,bt){let yt=et-1,O=-1,ke=!1,Le,ye,_e,Pe;for(;++yt<=bt;){const ee=Re[yt];switch(ee[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{ee[0]==="enter"?O++:O--,Pe=void 0;break}case"lineEndingBlank":{ee[0]==="enter"&&(Le&&!Pe&&!O&&!_e&&(_e=yt),Pe=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Pe=void 0}if(!O&&ee[0]==="enter"&&ee[1].type==="listItemPrefix"||O===-1&&ee[0]==="exit"&&(ee[1].type==="listUnordered"||ee[1].type==="listOrdered")){if(Le){let le=yt;for(ye=void 0;le--;){const je=Re[le];if(je[1].type==="lineEnding"||je[1].type==="lineEndingBlank"){if(je[0]==="exit")continue;ye&&(Re[ye][1].type="lineEndingBlank",ke=!0),je[1].type="lineEnding",ye=le}else if(!(je[1].type==="linePrefix"||je[1].type==="blockQuotePrefix"||je[1].type==="blockQuotePrefixWhitespace"||je[1].type==="blockQuoteMarker"||je[1].type==="listItemIndent"))break}_e&&(!ye||_e<ye)&&(Le._spread=!0),Le.end=Object.assign({},ye?Re[ye][1].start:ee[1].end),Re.splice(ye||yt,0,["exit",Le,ee[2]]),yt++,bt++}if(ee[1].type==="listItemPrefix"){const le={type:"listItem",_spread:!1,start:Object.assign({},ee[1].start),end:void 0};Le=le,Re.splice(yt,0,["enter",le,ee[2]]),yt++,bt++,_e=void 0,Pe=!0}}}return Re[et][1]._spread=ke,bt}function a(Re,et){return bt;function bt(yt){l.call(this,Re(yt),yt),et&&et.call(this,yt)}}function o(){this.stack.push({type:"fragment",children:[]})}function l(Re,et,bt){this.stack[this.stack.length-1].children.push(Re),this.stack.push(Re),this.tokenStack.push([et,bt||void 0]),Re.position={start:Ec(et.start),end:void 0}}function u(Re){return et;function et(bt){Re&&Re.call(this,bt),d.call(this,bt)}}function d(Re,et){const bt=this.stack.pop(),yt=this.tokenStack.pop();if(yt)yt[0].type!==Re.type&&(et?et.call(this,Re,yt[0]):(yt[1]||x4).call(this,Re,yt[0]));else throw new Error("Cannot close `"+Re.type+"` ("+qm({start:Re.start,end:Re.end})+"): it’s not open");bt.position.end=Ec(Re.end)}function p(){return IE(this.stack.pop())}function f(){this.data.expectingFirstListItemValue=!0}function g(Re){if(this.data.expectingFirstListItemValue){const et=this.stack[this.stack.length-2];et.start=Number.parseInt(this.sliceSerialize(Re),10),this.data.expectingFirstListItemValue=void 0}}function _(){const Re=this.resume(),et=this.stack[this.stack.length-1];et.lang=Re}function x(){const Re=this.resume(),et=this.stack[this.stack.length-1];et.meta=Re}function v(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function S(){const Re=this.resume(),et=this.stack[this.stack.length-1];et.value=Re.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function w(){const Re=this.resume(),et=this.stack[this.stack.length-1];et.value=Re.replace(/(\r?\n|\r)$/g,"")}function N(Re){const et=this.resume(),bt=this.stack[this.stack.length-1];bt.label=et,bt.identifier=Qa(this.sliceSerialize(Re)).toLowerCase()}function C(){const Re=this.resume(),et=this.stack[this.stack.length-1];et.title=Re}function T(){const Re=this.resume(),et=this.stack[this.stack.length-1];et.url=Re}function A(Re){const et=this.stack[this.stack.length-1];if(!et.depth){const bt=this.sliceSerialize(Re).length;et.depth=bt}}function E(){this.data.setextHeadingSlurpLineEnding=!0}function D(Re){const et=this.stack[this.stack.length-1];et.depth=this.sliceSerialize(Re).codePointAt(0)===61?1:2}function F(){this.data.setextHeadingSlurpLineEnding=void 0}function B(Re){const bt=this.stack[this.stack.length-1].children;let yt=bt[bt.length-1];(!yt||yt.type!=="text")&&(yt=Tt(),yt.position={start:Ec(Re.start),end:void 0},bt.push(yt)),this.stack.push(yt)}function H(Re){const et=this.stack.pop();et.value+=this.sliceSerialize(Re),et.position.end=Ec(Re.end)}function $(Re){const et=this.stack[this.stack.length-1];if(this.data.atHardBreak){const bt=et.children[et.children.length-1];bt.position.end=Ec(Re.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&n.canContainEols.includes(et.type)&&(B.call(this,Re),H.call(this,Re))}function z(){this.data.atHardBreak=!0}function W(){const Re=this.resume(),et=this.stack[this.stack.length-1];et.value=Re}function P(){const Re=this.resume(),et=this.stack[this.stack.length-1];et.value=Re}function q(){const Re=this.resume(),et=this.stack[this.stack.length-1];et.value=Re}function I(){const Re=this.stack[this.stack.length-1];if(this.data.inReference){const et=this.data.referenceType||"shortcut";Re.type+="Reference",Re.referenceType=et,delete Re.url,delete Re.title}else delete Re.identifier,delete Re.label;this.data.referenceType=void 0}function Q(){const Re=this.stack[this.stack.length-1];if(this.data.inReference){const et=this.data.referenceType||"shortcut";Re.type+="Reference",Re.referenceType=et,delete Re.url,delete Re.title}else delete Re.identifier,delete Re.label;this.data.referenceType=void 0}function K(Re){const et=this.sliceSerialize(Re),bt=this.stack[this.stack.length-2];bt.label=Iae(et),bt.identifier=Qa(et).toLowerCase()}function Z(){const Re=this.stack[this.stack.length-1],et=this.resume(),bt=this.stack[this.stack.length-1];if(this.data.inReference=!0,bt.type==="link"){const yt=Re.children;bt.children=yt}else bt.alt=et}function Y(){const Re=this.resume(),et=this.stack[this.stack.length-1];et.url=Re}function R(){const Re=this.resume(),et=this.stack[this.stack.length-1];et.title=Re}function U(){this.data.inReference=void 0}function V(){this.data.referenceType="collapsed"}function ie(Re){const et=this.resume(),bt=this.stack[this.stack.length-1];bt.label=et,bt.identifier=Qa(this.sliceSerialize(Re)).toLowerCase(),this.data.referenceType="full"}function te(Re){this.data.characterReferenceType=Re.type}function X(Re){const et=this.sliceSerialize(Re),bt=this.data.characterReferenceType;let yt;bt?(yt=c9(et,bt==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):yt=BE(et);const O=this.stack[this.stack.length-1];O.value+=yt}function se(Re){const et=this.stack.pop();et.position.end=Ec(Re.end)}function re(Re){H.call(this,Re);const et=this.stack[this.stack.length-1];et.url=this.sliceSerialize(Re)}function de(Re){H.call(this,Re);const et=this.stack[this.stack.length-1];et.url="mailto:"+this.sliceSerialize(Re)}function ue(){return{type:"blockquote",children:[]}}function ae(){return{type:"code",lang:null,meta:null,value:""}}function pe(){return{type:"inlineCode",value:""}}function J(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function me(){return{type:"emphasis",children:[]}}function fe(){return{type:"heading",depth:0,children:[]}}function ve(){return{type:"break"}}function Ke(){return{type:"html",value:""}}function ge(){return{type:"image",title:null,url:"",alt:null}}function Ue(){return{type:"link",title:null,url:"",children:[]}}function $e(Re){return{type:"list",ordered:Re.type==="listOrdered",start:null,spread:Re._spread,children:[]}}function Bt(Re){return{type:"listItem",spread:Re._spread,checked:null,children:[]}}function ct(){return{type:"paragraph",children:[]}}function Mt(){return{type:"strong",children:[]}}function Tt(){return{type:"text",value:""}}function Dt(){return{type:"thematicBreak"}}}function Ec(e){return{line:e.line,column:e.column,offset:e.offset}}function x9(e,n){let r=-1;for(;++r<n.length;){const i=n[r];Array.isArray(i)?x9(e,i):Fae(e,i)}}function Fae(e,n){let r;for(r in n)if(_9.call(n,r))switch(r){case"canContainEols":{const i=n[r];i&&e[r].push(...i);break}case"transforms":{const i=n[r];i&&e[r].push(...i);break}case"enter":case"exit":{const i=n[r];i&&Object.assign(e[r],i);break}}}function x4(e,n){throw e?new Error("Cannot close `"+e.type+"` ("+qm({start:e.start,end:e.end})+"): a different token (`"+n.type+"`, "+qm({start:n.start,end:n.end})+") is open"):new Error("Cannot close document, a token (`"+n.type+"`, "+qm({start:n.start,end:n.end})+") is still open")}function Hae(e){const n=this;n.parser=r;function r(i){return zae(i,{...n.data("settings"),...e,extensions:n.data("micromarkExtensions")||[],mdastExtensions:n.data("fromMarkdownExtensions")||[]})}}function Wae(e,n){const r={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(n),!0)};return e.patch(n,r),e.applyData(n,r)}function qae(e,n){const r={type:"element",tagName:"br",properties:{},children:[]};return e.patch(n,r),[e.applyData(n,r),{type:"text",value:`
`}]}function Uae(e,n){const r=n.value?n.value+`
`:"",i={},s=n.lang?n.lang.split(/\s+/):[];s.length>0&&(i.className=["language-"+s[0]]);let a={type:"element",tagName:"code",properties:i,children:[{type:"text",value:r}]};return n.meta&&(a.data={meta:n.meta}),e.patch(n,a),a=e.applyData(n,a),a={type:"element",tagName:"pre",properties:{},children:[a]},e.patch(n,a),a}function Vae(e,n){const r={type:"element",tagName:"del",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function Kae(e,n){const r={type:"element",tagName:"em",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function Yae(e,n){const r=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",i=String(n.identifier).toUpperCase(),s=Qf(i.toLowerCase()),a=e.footnoteOrder.indexOf(i);let o,l=e.footnoteCounts.get(i);l===void 0?(l=0,e.footnoteOrder.push(i),o=e.footnoteOrder.length):o=a+1,l+=1,e.footnoteCounts.set(i,l);const u={type:"element",tagName:"a",properties:{href:"#"+r+"fn-"+s,id:r+"fnref-"+s+(l>1?"-"+l:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};e.patch(n,u);const d={type:"element",tagName:"sup",properties:{},children:[u]};return e.patch(n,d),e.applyData(n,d)}function Gae(e,n){const r={type:"element",tagName:"h"+n.depth,properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function Xae(e,n){if(e.options.allowDangerousHtml){const r={type:"raw",value:n.value};return e.patch(n,r),e.applyData(n,r)}}function b9(e,n){const r=n.referenceType;let i="]";if(r==="collapsed"?i+="[]":r==="full"&&(i+="["+(n.label||n.identifier)+"]"),n.type==="imageReference")return[{type:"text",value:"!["+n.alt+i}];const s=e.all(n),a=s[0];a&&a.type==="text"?a.value="["+a.value:s.unshift({type:"text",value:"["});const o=s[s.length-1];return o&&o.type==="text"?o.value+=i:s.push({type:"text",value:i}),s}function Qae(e,n){const r=String(n.identifier).toUpperCase(),i=e.definitionById.get(r);if(!i)return b9(e,n);const s={src:Qf(i.url||""),alt:n.alt};i.title!==null&&i.title!==void 0&&(s.title=i.title);const a={type:"element",tagName:"img",properties:s,children:[]};return e.patch(n,a),e.applyData(n,a)}function Zae(e,n){const r={src:Qf(n.url)};n.alt!==null&&n.alt!==void 0&&(r.alt=n.alt),n.title!==null&&n.title!==void 0&&(r.title=n.title);const i={type:"element",tagName:"img",properties:r,children:[]};return e.patch(n,i),e.applyData(n,i)}function Jae(e,n){const r={type:"text",value:n.value.replace(/\r?\n|\r/g," ")};e.patch(n,r);const i={type:"element",tagName:"code",properties:{},children:[r]};return e.patch(n,i),e.applyData(n,i)}function eoe(e,n){const r=String(n.identifier).toUpperCase(),i=e.definitionById.get(r);if(!i)return b9(e,n);const s={href:Qf(i.url||"")};i.title!==null&&i.title!==void 0&&(s.title=i.title);const a={type:"element",tagName:"a",properties:s,children:e.all(n)};return e.patch(n,a),e.applyData(n,a)}function toe(e,n){const r={href:Qf(n.url)};n.title!==null&&n.title!==void 0&&(r.title=n.title);const i={type:"element",tagName:"a",properties:r,children:e.all(n)};return e.patch(n,i),e.applyData(n,i)}function noe(e,n,r){const i=e.all(n),s=r?roe(r):k9(n),a={},o=[];if(typeof n.checked=="boolean"){const p=i[0];let f;p&&p.type==="element"&&p.tagName==="p"?f=p:(f={type:"element",tagName:"p",properties:{},children:[]},i.unshift(f)),f.children.length>0&&f.children.unshift({type:"text",value:" "}),f.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:n.checked,disabled:!0},children:[]}),a.className=["task-list-item"]}let l=-1;for(;++l<i.length;){const p=i[l];(s||l!==0||p.type!=="element"||p.tagName!=="p")&&o.push({type:"text",value:`
`}),p.type==="element"&&p.tagName==="p"&&!s?o.push(...p.children):o.push(p)}const u=i[i.length-1];u&&(s||u.type!=="element"||u.tagName!=="p")&&o.push({type:"text",value:`
`});const d={type:"element",tagName:"li",properties:a,children:o};return e.patch(n,d),e.applyData(n,d)}function roe(e){let n=!1;if(e.type==="list"){n=e.spread||!1;const r=e.children;let i=-1;for(;!n&&++i<r.length;)n=k9(r[i])}return n}function k9(e){const n=e.spread;return n??e.children.length>1}function ioe(e,n){const r={},i=e.all(n);let s=-1;for(typeof n.start=="number"&&n.start!==1&&(r.start=n.start);++s<i.length;){const o=i[s];if(o.type==="element"&&o.tagName==="li"&&o.properties&&Array.isArray(o.properties.className)&&o.properties.className.includes("task-list-item")){r.className=["contains-task-list"];break}}const a={type:"element",tagName:n.ordered?"ol":"ul",properties:r,children:e.wrap(i,!0)};return e.patch(n,a),e.applyData(n,a)}function soe(e,n){const r={type:"element",tagName:"p",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function aoe(e,n){const r={type:"root",children:e.wrap(e.all(n))};return e.patch(n,r),e.applyData(n,r)}function ooe(e,n){const r={type:"element",tagName:"strong",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function loe(e,n){const r=e.all(n),i=r.shift(),s=[];if(i){const o={type:"element",tagName:"thead",properties:{},children:e.wrap([i],!0)};e.patch(n.children[0],o),s.push(o)}if(r.length>0){const o={type:"element",tagName:"tbody",properties:{},children:e.wrap(r,!0)},l=OE(n.children[1]),u=t9(n.children[n.children.length-1]);l&&u&&(o.position={start:l,end:u}),s.push(o)}const a={type:"element",tagName:"table",properties:{},children:e.wrap(s,!0)};return e.patch(n,a),e.applyData(n,a)}function coe(e,n,r){const i=r?r.children:void 0,a=(i?i.indexOf(n):1)===0?"th":"td",o=r&&r.type==="table"?r.align:void 0,l=o?o.length:n.children.length;let u=-1;const d=[];for(;++u<l;){const f=n.children[u],g={},_=o?o[u]:void 0;_&&(g.align=_);let x={type:"element",tagName:a,properties:g,children:[]};f&&(x.children=e.all(f),e.patch(f,x),x=e.applyData(f,x)),d.push(x)}const p={type:"element",tagName:"tr",properties:{},children:e.wrap(d,!0)};return e.patch(n,p),e.applyData(n,p)}function uoe(e,n){const r={type:"element",tagName:"td",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}const b4=9,k4=32;function doe(e){const n=String(e),r=/\r?\n|\r/g;let i=r.exec(n),s=0;const a=[];for(;i;)a.push(w4(n.slice(s,i.index),s>0,!0),i[0]),s=i.index+i[0].length,i=r.exec(n);return a.push(w4(n.slice(s),s>0,!1)),a.join("")}function w4(e,n,r){let i=0,s=e.length;if(n){let a=e.codePointAt(i);for(;a===b4||a===k4;)i++,a=e.codePointAt(i)}if(r){let a=e.codePointAt(s-1);for(;a===b4||a===k4;)s--,a=e.codePointAt(s-1)}return s>i?e.slice(i,s):""}function hoe(e,n){const r={type:"text",value:doe(String(n.value))};return e.patch(n,r),e.applyData(n,r)}function foe(e,n){const r={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(n,r),e.applyData(n,r)}const poe={blockquote:Wae,break:qae,code:Uae,delete:Vae,emphasis:Kae,footnoteReference:Yae,heading:Gae,html:Xae,imageReference:Qae,image:Zae,inlineCode:Jae,linkReference:eoe,link:toe,listItem:noe,list:ioe,paragraph:soe,root:aoe,strong:ooe,table:loe,tableCell:uoe,tableRow:coe,text:hoe,thematicBreak:foe,toml:Gy,yaml:Gy,definition:Gy,footnoteDefinition:Gy};function Gy(){}const w9=-1,g0=0,Vm=1,Yx=2,$E=3,FE=4,HE=5,WE=6,S9=7,C9=8,S4=typeof self=="object"?self:globalThis,moe=(e,n)=>{const r=(s,a)=>(e.set(a,s),s),i=s=>{if(e.has(s))return e.get(s);const[a,o]=n[s];switch(a){case g0:case w9:return r(o,s);case Vm:{const l=r([],s);for(const u of o)l.push(i(u));return l}case Yx:{const l=r({},s);for(const[u,d]of o)l[i(u)]=i(d);return l}case $E:return r(new Date(o),s);case FE:{const{source:l,flags:u}=o;return r(new RegExp(l,u),s)}case HE:{const l=r(new Map,s);for(const[u,d]of o)l.set(i(u),i(d));return l}case WE:{const l=r(new Set,s);for(const u of o)l.add(i(u));return l}case S9:{const{name:l,message:u}=o;return r(new S4[l](u),s)}case C9:return r(BigInt(o),s);case"BigInt":return r(Object(BigInt(o)),s);case"ArrayBuffer":return r(new Uint8Array(o).buffer,o);case"DataView":{const{buffer:l}=new Uint8Array(o);return r(new DataView(l),o)}}return r(new S4[a](o),s)};return i},C4=e=>moe(new Map,e)(0),bh="",{toString:goe}={},{keys:voe}=Object,em=e=>{const n=typeof e;if(n!=="object"||!e)return[g0,n];const r=goe.call(e).slice(8,-1);switch(r){case"Array":return[Vm,bh];case"Object":return[Yx,bh];case"Date":return[$E,bh];case"RegExp":return[FE,bh];case"Map":return[HE,bh];case"Set":return[WE,bh];case"DataView":return[Vm,r]}return r.includes("Array")?[Vm,r]:r.includes("Error")?[S9,r]:[Yx,r]},Xy=([e,n])=>e===g0&&(n==="function"||n==="symbol"),yoe=(e,n,r,i)=>{const s=(o,l)=>{const u=i.push(o)-1;return r.set(l,u),u},a=o=>{if(r.has(o))return r.get(o);let[l,u]=em(o);switch(l){case g0:{let p=o;switch(u){case"bigint":l=C9,p=o.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+u);p=null;break;case"undefined":return s([w9],o)}return s([l,p],o)}case Vm:{if(u){let g=o;return u==="DataView"?g=new Uint8Array(o.buffer):u==="ArrayBuffer"&&(g=new Uint8Array(o)),s([u,[...g]],o)}const p=[],f=s([l,p],o);for(const g of o)p.push(a(g));return f}case Yx:{if(u)switch(u){case"BigInt":return s([u,o.toString()],o);case"Boolean":case"Number":case"String":return s([u,o.valueOf()],o)}if(n&&"toJSON"in o)return a(o.toJSON());const p=[],f=s([l,p],o);for(const g of voe(o))(e||!Xy(em(o[g])))&&p.push([a(g),a(o[g])]);return f}case $E:return s([l,o.toISOString()],o);case FE:{const{source:p,flags:f}=o;return s([l,{source:p,flags:f}],o)}case HE:{const p=[],f=s([l,p],o);for(const[g,_]of o)(e||!(Xy(em(g))||Xy(em(_))))&&p.push([a(g),a(_)]);return f}case WE:{const p=[],f=s([l,p],o);for(const g of o)(e||!Xy(em(g)))&&p.push(a(g));return f}}const{message:d}=o;return s([l,{name:u,message:d}],o)};return a},j4=(e,{json:n,lossy:r}={})=>{const i=[];return yoe(!(n||r),!!n,new Map,i)(e),i},Gx=typeof structuredClone=="function"?(e,n)=>n&&("json"in n||"lossy"in n)?C4(j4(e,n)):structuredClone(e):(e,n)=>C4(j4(e,n));function _oe(e,n){const r=[{type:"text",value:"↩"}];return n>1&&r.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(n)}]}),r}function xoe(e,n){return"Back to reference "+(e+1)+(n>1?"-"+n:"")}function boe(e){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=e.options.footnoteBackContent||_oe,i=e.options.footnoteBackLabel||xoe,s=e.options.footnoteLabel||"Footnotes",a=e.options.footnoteLabelTagName||"h2",o=e.options.footnoteLabelProperties||{className:["sr-only"]},l=[];let u=-1;for(;++u<e.footnoteOrder.length;){const d=e.footnoteById.get(e.footnoteOrder[u]);if(!d)continue;const p=e.all(d),f=String(d.identifier).toUpperCase(),g=Qf(f.toLowerCase());let _=0;const x=[],v=e.footnoteCounts.get(f);for(;v!==void 0&&++_<=v;){x.length>0&&x.push({type:"text",value:" "});let N=typeof r=="string"?r:r(u,_);typeof N=="string"&&(N={type:"text",value:N}),x.push({type:"element",tagName:"a",properties:{href:"#"+n+"fnref-"+g+(_>1?"-"+_:""),dataFootnoteBackref:"",ariaLabel:typeof i=="string"?i:i(u,_),className:["data-footnote-backref"]},children:Array.isArray(N)?N:[N]})}const S=p[p.length-1];if(S&&S.type==="element"&&S.tagName==="p"){const N=S.children[S.children.length-1];N&&N.type==="text"?N.value+=" ":S.children.push({type:"text",value:" "}),S.children.push(...x)}else p.push(...x);const w={type:"element",tagName:"li",properties:{id:n+"fn-"+g},children:e.wrap(p,!0)};e.patch(d,w),l.push(w)}if(l.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:a,properties:{...Gx(o),id:"footnote-label"},children:[{type:"text",value:s}]},{type:"text",value:`
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(l,!0)},{type:"text",value:`
`}]}}const v0=(function(e){if(e==null)return Coe;if(typeof e=="function")return y0(e);if(typeof e=="object")return Array.isArray(e)?koe(e):woe(e);if(typeof e=="string")return Soe(e);throw new Error("Expected function, string, or object as test")});function koe(e){const n=[];let r=-1;for(;++r<e.length;)n[r]=v0(e[r]);return y0(i);function i(...s){let a=-1;for(;++a<n.length;)if(n[a].apply(this,s))return!0;return!1}}function woe(e){const n=e;return y0(r);function r(i){const s=i;let a;for(a in e)if(s[a]!==n[a])return!1;return!0}}function Soe(e){return y0(n);function n(r){return r&&r.type===e}}function y0(e){return n;function n(r,i,s){return!!(joe(r)&&e.call(this,r,typeof i=="number"?i:void 0,s||void 0))}}function Coe(){return!0}function joe(e){return e!==null&&typeof e=="object"&&"type"in e}const j9=[],Noe=!0,ej=!1,Eoe="skip";function N9(e,n,r,i){let s;typeof n=="function"&&typeof r!="function"?(i=r,r=n):s=n;const a=v0(s),o=i?-1:1;l(e,void 0,[])();function l(u,d,p){const f=u&&typeof u=="object"?u:{};if(typeof f.type=="string"){const _=typeof f.tagName=="string"?f.tagName:typeof f.name=="string"?f.name:void 0;Object.defineProperty(g,"name",{value:"node ("+(u.type+(_?"<"+_+">":""))+")"})}return g;function g(){let _=j9,x,v,S;if((!n||a(u,d,p[p.length-1]||void 0))&&(_=Aoe(r(u,p)),_[0]===ej))return _;if("children"in u&&u.children){const w=u;if(w.children&&_[0]!==Eoe)for(v=(i?w.children.length:-1)+o,S=p.concat(w);v>-1&&v<w.children.length;){const N=w.children[v];if(x=l(N,v,S)(),x[0]===ej)return x;v=typeof x[1]=="number"?x[1]:v+o}}return _}}}function Aoe(e){return Array.isArray(e)?e:typeof e=="number"?[Noe,e]:e==null?j9:[e]}function qE(e,n,r,i){let s,a,o;typeof n=="function"&&typeof r!="function"?(a=void 0,o=n,s=r):(a=n,o=r,s=i),N9(e,a,l,s);function l(u,d){const p=d[d.length-1],f=p?p.children.indexOf(u):void 0;return o(u,f,p)}}const tj={}.hasOwnProperty,Toe={};function Moe(e,n){const r=n||Toe,i=new Map,s=new Map,a=new Map,o={...poe,...r.handlers},l={all:d,applyData:Ooe,definitionById:i,footnoteById:s,footnoteCounts:a,footnoteOrder:[],handlers:o,one:u,options:r,patch:Roe,wrap:Poe};return qE(e,function(p){if(p.type==="definition"||p.type==="footnoteDefinition"){const f=p.type==="definition"?i:s,g=String(p.identifier).toUpperCase();f.has(g)||f.set(g,p)}}),l;function u(p,f){const g=p.type,_=l.handlers[g];if(tj.call(l.handlers,g)&&_)return _(l,p,f);if(l.options.passThrough&&l.options.passThrough.includes(g)){if("children"in p){const{children:v,...S}=p,w=Gx(S);return w.children=l.all(p),w}return Gx(p)}return(l.options.unknownHandler||Doe)(l,p,f)}function d(p){const f=[];if("children"in p){const g=p.children;let _=-1;for(;++_<g.length;){const x=l.one(g[_],p);if(x){if(_&&g[_-1].type==="break"&&(!Array.isArray(x)&&x.type==="text"&&(x.value=N4(x.value)),!Array.isArray(x)&&x.type==="element")){const v=x.children[0];v&&v.type==="text"&&(v.value=N4(v.value))}Array.isArray(x)?f.push(...x):f.push(x)}}}return f}}function Roe(e,n){e.position&&(n.position=xie(e))}function Ooe(e,n){let r=n;if(e&&e.data){const i=e.data.hName,s=e.data.hChildren,a=e.data.hProperties;if(typeof i=="string")if(r.type==="element")r.tagName=i;else{const o="children"in r?r.children:[r];r={type:"element",tagName:i,properties:{},children:o}}r.type==="element"&&a&&Object.assign(r.properties,Gx(a)),"children"in r&&r.children&&s!==null&&s!==void 0&&(r.children=s)}return r}function Doe(e,n){const r=n.data||{},i="value"in n&&!(tj.call(r,"hProperties")||tj.call(r,"hChildren"))?{type:"text",value:n.value}:{type:"element",tagName:"div",properties:{},children:e.all(n)};return e.patch(n,i),e.applyData(n,i)}function Poe(e,n){const r=[];let i=-1;for(n&&r.push({type:"text",value:`
`});++i<e.length;)i&&r.push({type:"text",value:`
`}),r.push(e[i]);return n&&e.length>0&&r.push({type:"text",value:`
`}),r}function N4(e){let n=0,r=e.charCodeAt(n);for(;r===9||r===32;)n++,r=e.charCodeAt(n);return e.slice(n)}function E4(e,n){const r=Moe(e,n),i=r.one(e,void 0),s=boe(r),a=Array.isArray(i)?{type:"root",children:i}:i||{type:"root",children:[]};return s&&a.children.push({type:"text",value:`
`},s),a}function Loe(e,n){return e&&"run"in e?async function(r,i){const s=E4(r,{file:i,...n});await e.run(s,i)}:function(r,i){return E4(r,{file:i,...e||n})}}function A4(e){if(e)throw e}var Bw,T4;function Ioe(){if(T4)return Bw;T4=1;var e=Object.prototype.hasOwnProperty,n=Object.prototype.toString,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,s=function(d){return typeof Array.isArray=="function"?Array.isArray(d):n.call(d)==="[object Array]"},a=function(d){if(!d||n.call(d)!=="[object Object]")return!1;var p=e.call(d,"constructor"),f=d.constructor&&d.constructor.prototype&&e.call(d.constructor.prototype,"isPrototypeOf");if(d.constructor&&!p&&!f)return!1;var g;for(g in d);return typeof g>"u"||e.call(d,g)},o=function(d,p){r&&p.name==="__proto__"?r(d,p.name,{enumerable:!0,configurable:!0,value:p.newValue,writable:!0}):d[p.name]=p.newValue},l=function(d,p){if(p==="__proto__")if(e.call(d,p)){if(i)return i(d,p).value}else return;return d[p]};return Bw=function u(){var d,p,f,g,_,x,v=arguments[0],S=1,w=arguments.length,N=!1;for(typeof v=="boolean"&&(N=v,v=arguments[1]||{},S=2),(v==null||typeof v!="object"&&typeof v!="function")&&(v={});S<w;++S)if(d=arguments[S],d!=null)for(p in d)f=l(v,p),g=l(d,p),v!==g&&(N&&g&&(a(g)||(_=s(g)))?(_?(_=!1,x=f&&s(f)?f:[]):x=f&&a(f)?f:{},o(v,{name:p,newValue:u(N,x,g)})):typeof g<"u"&&o(v,{name:p,newValue:g}));return v},Bw}var Boe=Ioe();const zw=pu(Boe);function nj(e){if(typeof e!="object"||e===null)return!1;const n=Object.getPrototypeOf(e);return(n===null||n===Object.prototype||Object.getPrototypeOf(n)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function zoe(){const e=[],n={run:r,use:i};return n;function r(...s){let a=-1;const o=s.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);l(null,...s);function l(u,...d){const p=e[++a];let f=-1;if(u){o(u);return}for(;++f<s.length;)(d[f]===null||d[f]===void 0)&&(d[f]=s[f]);s=d,p?$oe(p,l)(...d):o(null,...d)}}function i(s){if(typeof s!="function")throw new TypeError("Expected `middelware` to be a function, not "+s);return e.push(s),n}}function $oe(e,n){let r;return i;function i(...o){const l=e.length>o.length;let u;l&&o.push(s);try{u=e.apply(this,o)}catch(d){const p=d;if(l&&r)throw p;return s(p)}l||(u&&u.then&&typeof u.then=="function"?u.then(a,s):u instanceof Error?s(u):a(u))}function s(o,...l){r||(r=!0,n(o,...l))}function a(o){s(null,o)}}const Ao={basename:Foe,dirname:Hoe,extname:Woe,join:qoe,sep:"/"};function Foe(e,n){if(n!==void 0&&typeof n!="string")throw new TypeError('"ext" argument must be a string');fv(e);let r=0,i=-1,s=e.length,a;if(n===void 0||n.length===0||n.length>e.length){for(;s--;)if(e.codePointAt(s)===47){if(a){r=s+1;break}}else i<0&&(a=!0,i=s+1);return i<0?"":e.slice(r,i)}if(n===e)return"";let o=-1,l=n.length-1;for(;s--;)if(e.codePointAt(s)===47){if(a){r=s+1;break}}else o<0&&(a=!0,o=s+1),l>-1&&(e.codePointAt(s)===n.codePointAt(l--)?l<0&&(i=s):(l=-1,i=o));return r===i?i=o:i<0&&(i=e.length),e.slice(r,i)}function Hoe(e){if(fv(e),e.length===0)return".";let n=-1,r=e.length,i;for(;--r;)if(e.codePointAt(r)===47){if(i){n=r;break}}else i||(i=!0);return n<0?e.codePointAt(0)===47?"/":".":n===1&&e.codePointAt(0)===47?"//":e.slice(0,n)}function Woe(e){fv(e);let n=e.length,r=-1,i=0,s=-1,a=0,o;for(;n--;){const l=e.codePointAt(n);if(l===47){if(o){i=n+1;break}continue}r<0&&(o=!0,r=n+1),l===46?s<0?s=n:a!==1&&(a=1):s>-1&&(a=-1)}return s<0||r<0||a===0||a===1&&s===r-1&&s===i+1?"":e.slice(s,r)}function qoe(...e){let n=-1,r;for(;++n<e.length;)fv(e[n]),e[n]&&(r=r===void 0?e[n]:r+"/"+e[n]);return r===void 0?".":Uoe(r)}function Uoe(e){fv(e);const n=e.codePointAt(0)===47;let r=Voe(e,!n);return r.length===0&&!n&&(r="."),r.length>0&&e.codePointAt(e.length-1)===47&&(r+="/"),n?"/"+r:r}function Voe(e,n){let r="",i=0,s=-1,a=0,o=-1,l,u;for(;++o<=e.length;){if(o<e.length)l=e.codePointAt(o);else{if(l===47)break;l=47}if(l===47){if(!(s===o-1||a===1))if(s!==o-1&&a===2){if(r.length<2||i!==2||r.codePointAt(r.length-1)!==46||r.codePointAt(r.length-2)!==46){if(r.length>2){if(u=r.lastIndexOf("/"),u!==r.length-1){u<0?(r="",i=0):(r=r.slice(0,u),i=r.length-1-r.lastIndexOf("/")),s=o,a=0;continue}}else if(r.length>0){r="",i=0,s=o,a=0;continue}}n&&(r=r.length>0?r+"/..":"..",i=2)}else r.length>0?r+="/"+e.slice(s+1,o):r=e.slice(s+1,o),i=o-s-1;s=o,a=0}else l===46&&a>-1?a++:a=-1}return r}function fv(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const Koe={cwd:Yoe};function Yoe(){return"/"}function rj(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function Goe(e){if(typeof e=="string")e=new URL(e);else if(!rj(e)){const n=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw n.code="ERR_INVALID_ARG_TYPE",n}if(e.protocol!=="file:"){const n=new TypeError("The URL must be of scheme file");throw n.code="ERR_INVALID_URL_SCHEME",n}return Xoe(e)}function Xoe(e){if(e.hostname!==""){const i=new TypeError('File URL host must be "localhost" or empty on darwin');throw i.code="ERR_INVALID_FILE_URL_HOST",i}const n=e.pathname;let r=-1;for(;++r<n.length;)if(n.codePointAt(r)===37&&n.codePointAt(r+1)===50){const i=n.codePointAt(r+2);if(i===70||i===102){const s=new TypeError("File URL path must not include encoded / characters");throw s.code="ERR_INVALID_FILE_URL_PATH",s}}return decodeURIComponent(n)}const $w=["history","path","basename","stem","extname","dirname"];class E9{constructor(n){let r;n?rj(n)?r={path:n}:typeof n=="string"||Qoe(n)?r={value:n}:r=n:r={},this.cwd="cwd"in r?"":Koe.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let i=-1;for(;++i<$w.length;){const a=$w[i];a in r&&r[a]!==void 0&&r[a]!==null&&(this[a]=a==="history"?[...r[a]]:r[a])}let s;for(s in r)$w.includes(s)||(this[s]=r[s])}get basename(){return typeof this.path=="string"?Ao.basename(this.path):void 0}set basename(n){Hw(n,"basename"),Fw(n,"basename"),this.path=Ao.join(this.dirname||"",n)}get dirname(){return typeof this.path=="string"?Ao.dirname(this.path):void 0}set dirname(n){M4(this.basename,"dirname"),this.path=Ao.join(n||"",this.basename)}get extname(){return typeof this.path=="string"?Ao.extname(this.path):void 0}set extname(n){if(Fw(n,"extname"),M4(this.dirname,"extname"),n){if(n.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(n.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Ao.join(this.dirname,this.stem+(n||""))}get path(){return this.history[this.history.length-1]}set path(n){rj(n)&&(n=Goe(n)),Hw(n,"path"),this.path!==n&&this.history.push(n)}get stem(){return typeof this.path=="string"?Ao.basename(this.path,this.extname):void 0}set stem(n){Hw(n,"stem"),Fw(n,"stem"),this.path=Ao.join(this.dirname||"",n+(this.extname||""))}fail(n,r,i){const s=this.message(n,r,i);throw s.fatal=!0,s}info(n,r,i){const s=this.message(n,r,i);return s.fatal=void 0,s}message(n,r,i){const s=new Ui(n,r,i);return this.path&&(s.name=this.path+":"+s.name,s.file=this.path),s.fatal=!1,this.messages.push(s),s}toString(n){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(n||void 0).decode(this.value)}}function Fw(e,n){if(e&&e.includes(Ao.sep))throw new Error("`"+n+"` cannot be a path: did not expect `"+Ao.sep+"`")}function Hw(e,n){if(!e)throw new Error("`"+n+"` cannot be empty")}function M4(e,n){if(!e)throw new Error("Setting `"+n+"` requires `path` to be set too")}function Qoe(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Zoe=(function(e){const i=this.constructor.prototype,s=i[e],a=function(){return s.apply(a,arguments)};return Object.setPrototypeOf(a,i),a}),Joe={}.hasOwnProperty;class UE extends Zoe{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=zoe()}copy(){const n=new UE;let r=-1;for(;++r<this.attachers.length;){const i=this.attachers[r];n.use(...i)}return n.data(zw(!0,{},this.namespace)),n}data(n,r){return typeof n=="string"?arguments.length===2?(Uw("data",this.frozen),this.namespace[n]=r,this):Joe.call(this.namespace,n)&&this.namespace[n]||void 0:n?(Uw("data",this.frozen),this.namespace=n,this):this.namespace}freeze(){if(this.frozen)return this;const n=this;for(;++this.freezeIndex<this.attachers.length;){const[r,...i]=this.attachers[this.freezeIndex];if(i[0]===!1)continue;i[0]===!0&&(i[0]=void 0);const s=r.call(n,...i);typeof s=="function"&&this.transformers.use(s)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(n){this.freeze();const r=Qy(n),i=this.parser||this.Parser;return Ww("parse",i),i(String(r),r)}process(n,r){const i=this;return this.freeze(),Ww("process",this.parser||this.Parser),qw("process",this.compiler||this.Compiler),r?s(void 0,r):new Promise(s);function s(a,o){const l=Qy(n),u=i.parse(l);i.run(u,l,function(p,f,g){if(p||!f||!g)return d(p);const _=f,x=i.stringify(_,g);nle(x)?g.value=x:g.result=x,d(p,g)});function d(p,f){p||!f?o(p):a?a(f):r(void 0,f)}}}processSync(n){let r=!1,i;return this.freeze(),Ww("processSync",this.parser||this.Parser),qw("processSync",this.compiler||this.Compiler),this.process(n,s),O4("processSync","process",r),i;function s(a,o){r=!0,A4(a),i=o}}run(n,r,i){R4(n),this.freeze();const s=this.transformers;return!i&&typeof r=="function"&&(i=r,r=void 0),i?a(void 0,i):new Promise(a);function a(o,l){const u=Qy(r);s.run(n,u,d);function d(p,f,g){const _=f||n;p?l(p):o?o(_):i(void 0,_,g)}}}runSync(n,r){let i=!1,s;return this.run(n,r,a),O4("runSync","run",i),s;function a(o,l){A4(o),s=l,i=!0}}stringify(n,r){this.freeze();const i=Qy(r),s=this.compiler||this.Compiler;return qw("stringify",s),R4(n),s(n,i)}use(n,...r){const i=this.attachers,s=this.namespace;if(Uw("use",this.frozen),n!=null)if(typeof n=="function")u(n,r);else if(typeof n=="object")Array.isArray(n)?l(n):o(n);else throw new TypeError("Expected usable value, not `"+n+"`");return this;function a(d){if(typeof d=="function")u(d,[]);else if(typeof d=="object")if(Array.isArray(d)){const[p,...f]=d;u(p,f)}else o(d);else throw new TypeError("Expected usable value, not `"+d+"`")}function o(d){if(!("plugins"in d)&&!("settings"in d))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");l(d.plugins),d.settings&&(s.settings=zw(!0,s.settings,d.settings))}function l(d){let p=-1;if(d!=null)if(Array.isArray(d))for(;++p<d.length;){const f=d[p];a(f)}else throw new TypeError("Expected a list of plugins, not `"+d+"`")}function u(d,p){let f=-1,g=-1;for(;++f<i.length;)if(i[f][0]===d){g=f;break}if(g===-1)i.push([d,...p]);else if(p.length>0){let[_,...x]=p;const v=i[g][1];nj(v)&&nj(_)&&(_=zw(!0,v,_)),i[g]=[d,_,...x]}}}}const ele=new UE().freeze();function Ww(e,n){if(typeof n!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function qw(e,n){if(typeof n!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Uw(e,n){if(n)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function R4(e){if(!nj(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function O4(e,n,r){if(!r)throw new Error("`"+e+"` finished async. Use `"+n+"` instead")}function Qy(e){return tle(e)?e:new E9(e)}function tle(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function nle(e){return typeof e=="string"||rle(e)}function rle(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const ile="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",D4=[],P4={allowDangerousHtml:!0},sle=/^(https?|ircs?|mailto|xmpp)$/i,ale=[{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 VE(e){const n=ole(e),r=lle(e);return cle(n.runSync(n.parse(r),r),e)}function ole(e){const n=e.rehypePlugins||D4,r=e.remarkPlugins||D4,i=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...P4}:P4;return ele().use(Hae).use(r).use(Loe,i).use(n)}function lle(e){const n=e.children||"",r=new E9;return typeof n=="string"&&(r.value=n),r}function cle(e,n){const r=n.allowedElements,i=n.allowElement,s=n.components,a=n.disallowedElements,o=n.skipHtml,l=n.unwrapDisallowed,u=n.urlTransform||ule;for(const p of ale)Object.hasOwn(n,p.from)&&(""+p.from+(p.to?"use `"+p.to+"` instead":"remove it")+ile+p.id,void 0);return qE(e,d),Cie(e,{Fragment:c.Fragment,components:s,ignoreInvalidStyle:!0,jsx:c.jsx,jsxs:c.jsxs,passKeys:!0,passNode:!0});function d(p,f,g){if(p.type==="raw"&&g&&typeof f=="number")return o?g.children.splice(f,1):g.children[f]={type:"text",value:p.value},f;if(p.type==="element"){let _;for(_ in Pw)if(Object.hasOwn(Pw,_)&&Object.hasOwn(p.properties,_)){const x=p.properties[_],v=Pw[_];(v===null||v.includes(p.tagName))&&(p.properties[_]=u(String(x||""),_,p))}}if(p.type==="element"){let _=r?!r.includes(p.tagName):a?a.includes(p.tagName):!1;if(!_&&i&&typeof f=="number"&&(_=!i(p,f,g)),_&&g&&typeof f=="number")return l&&p.children?g.children.splice(f,1,...p.children):g.children.splice(f,1),f}}}function ule(e){const n=e.indexOf(":"),r=e.indexOf("?"),i=e.indexOf("#"),s=e.indexOf("/");return n===-1||s!==-1&&n>s||r!==-1&&n>r||i!==-1&&n>i||sle.test(e.slice(0,n))?e:""}function L4(e,n){const r=String(e);if(typeof n!="string")throw new TypeError("Expected character");let i=0,s=r.indexOf(n);for(;s!==-1;)i++,s=r.indexOf(n,s+n.length);return i}function dle(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function hle(e,n,r){const s=v0((r||{}).ignore||[]),a=fle(n);let o=-1;for(;++o<a.length;)N9(e,"text",l);function l(d,p){let f=-1,g;for(;++f<p.length;){const _=p[f],x=g?g.children:void 0;if(s(_,x?x.indexOf(_):void 0,g))return;g=_}if(g)return u(d,p)}function u(d,p){const f=p[p.length-1],g=a[o][0],_=a[o][1];let x=0;const S=f.children.indexOf(d);let w=!1,N=[];g.lastIndex=0;let C=g.exec(d.value);for(;C;){const T=C.index,A={index:C.index,input:C.input,stack:[...p,d]};let E=_(...C,A);if(typeof E=="string"&&(E=E.length>0?{type:"text",value:E}:void 0),E===!1?g.lastIndex=T+1:(x!==T&&N.push({type:"text",value:d.value.slice(x,T)}),Array.isArray(E)?N.push(...E):E&&N.push(E),x=T+C[0].length,w=!0),!g.global)break;C=g.exec(d.value)}return w?(x<d.value.length&&N.push({type:"text",value:d.value.slice(x)}),f.children.splice(S,1,...N)):N=[d],S+N.length}}function fle(e){const n=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const r=!e[0]||Array.isArray(e[0])?e:[e];let i=-1;for(;++i<r.length;){const s=r[i];n.push([ple(s[0]),mle(s[1])])}return n}function ple(e){return typeof e=="string"?new RegExp(dle(e),"g"):e}function mle(e){return typeof e=="function"?e:function(){return e}}const Vw="phrasing",Kw=["autolink","link","image","label"];function gle(){return{transforms:[wle],enter:{literalAutolink:yle,literalAutolinkEmail:Yw,literalAutolinkHttp:Yw,literalAutolinkWww:Yw},exit:{literalAutolink:kle,literalAutolinkEmail:ble,literalAutolinkHttp:_le,literalAutolinkWww:xle}}}function vle(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Vw,notInConstruct:Kw},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Vw,notInConstruct:Kw},{character:":",before:"[ps]",after:"\\/",inConstruct:Vw,notInConstruct:Kw}]}}function yle(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Yw(e){this.config.enter.autolinkProtocol.call(this,e)}function _le(e){this.config.exit.autolinkProtocol.call(this,e)}function xle(e){this.config.exit.data.call(this,e);const n=this.stack[this.stack.length-1];n.type,n.url="http://"+this.sliceSerialize(e)}function ble(e){this.config.exit.autolinkEmail.call(this,e)}function kle(e){this.exit(e)}function wle(e){hle(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,Sle],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),Cle]],{ignore:["link","linkReference"]})}function Sle(e,n,r,i,s){let a="";if(!A9(s)||(/^w/i.test(n)&&(r=n+r,n="",a="http://"),!jle(r)))return!1;const o=Nle(r+i);if(!o[0])return!1;const l={type:"link",title:null,url:a+n+o[0],children:[{type:"text",value:n+o[0]}]};return o[1]?[l,{type:"text",value:o[1]}]:l}function Cle(e,n,r,i){return!A9(i,!0)||/[-\d_]$/.test(r)?!1:{type:"link",title:null,url:"mailto:"+n+"@"+r,children:[{type:"text",value:n+"@"+r}]}}function jle(e){const n=e.split(".");return!(n.length<2||n[n.length-1]&&(/_/.test(n[n.length-1])||!/[a-zA-Z\d]/.test(n[n.length-1]))||n[n.length-2]&&(/_/.test(n[n.length-2])||!/[a-zA-Z\d]/.test(n[n.length-2])))}function Nle(e){const n=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!n)return[e,void 0];e=e.slice(0,n.index);let r=n[0],i=r.indexOf(")");const s=L4(e,"(");let a=L4(e,")");for(;i!==-1&&s>a;)e+=r.slice(0,i+1),r=r.slice(i+1),i=r.indexOf(")"),a++;return[e,r]}function A9(e,n){const r=e.input.charCodeAt(e.index-1);return(e.index===0||wd(r)||p0(r))&&(!n||r!==47)}T9.peek=Lle;function Ele(){this.buffer()}function Ale(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function Tle(){this.buffer()}function Mle(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function Rle(e){const n=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=Qa(this.sliceSerialize(e)).toLowerCase(),r.label=n}function Ole(e){this.exit(e)}function Dle(e){const n=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=Qa(this.sliceSerialize(e)).toLowerCase(),r.label=n}function Ple(e){this.exit(e)}function Lle(){return"["}function T9(e,n,r,i){const s=r.createTracker(i);let a=s.move("[^");const o=r.enter("footnoteReference"),l=r.enter("reference");return a+=s.move(r.safe(r.associationId(e),{after:"]",before:a})),l(),o(),a+=s.move("]"),a}function Ile(){return{enter:{gfmFootnoteCallString:Ele,gfmFootnoteCall:Ale,gfmFootnoteDefinitionLabelString:Tle,gfmFootnoteDefinition:Mle},exit:{gfmFootnoteCallString:Rle,gfmFootnoteCall:Ole,gfmFootnoteDefinitionLabelString:Dle,gfmFootnoteDefinition:Ple}}}function Ble(e){let n=!1;return e&&e.firstLineBlank&&(n=!0),{handlers:{footnoteDefinition:r,footnoteReference:T9},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function r(i,s,a,o){const l=a.createTracker(o);let u=l.move("[^");const d=a.enter("footnoteDefinition"),p=a.enter("label");return u+=l.move(a.safe(a.associationId(i),{before:u,after:"]"})),p(),u+=l.move("]:"),i.children&&i.children.length>0&&(l.shift(4),u+=l.move((n?`
`:" ")+a.indentLines(a.containerFlow(i,l.current()),n?M9:zle))),d(),u}}function zle(e,n,r){return n===0?e:M9(e,n,r)}function M9(e,n,r){return(r?"":"    ")+e}const $le=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];R9.peek=Ule;function Fle(){return{canContainEols:["delete"],enter:{strikethrough:Wle},exit:{strikethrough:qle}}}function Hle(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:$le}],handlers:{delete:R9}}}function Wle(e){this.enter({type:"delete",children:[]},e)}function qle(e){this.exit(e)}function R9(e,n,r,i){const s=r.createTracker(i),a=r.enter("strikethrough");let o=s.move("~~");return o+=r.containerPhrasing(e,{...s.current(),before:o,after:"~"}),o+=s.move("~~"),a(),o}function Ule(){return"~"}function Vle(e){return e.length}function Kle(e,n){const r=n||{},i=(r.align||[]).concat(),s=r.stringLength||Vle,a=[],o=[],l=[],u=[];let d=0,p=-1;for(;++p<e.length;){const v=[],S=[];let w=-1;for(e[p].length>d&&(d=e[p].length);++w<e[p].length;){const N=Yle(e[p][w]);if(r.alignDelimiters!==!1){const C=s(N);S[w]=C,(u[w]===void 0||C>u[w])&&(u[w]=C)}v.push(N)}o[p]=v,l[p]=S}let f=-1;if(typeof i=="object"&&"length"in i)for(;++f<d;)a[f]=I4(i[f]);else{const v=I4(i);for(;++f<d;)a[f]=v}f=-1;const g=[],_=[];for(;++f<d;){const v=a[f];let S="",w="";v===99?(S=":",w=":"):v===108?S=":":v===114&&(w=":");let N=r.alignDelimiters===!1?1:Math.max(1,u[f]-S.length-w.length);const C=S+"-".repeat(N)+w;r.alignDelimiters!==!1&&(N=S.length+N+w.length,N>u[f]&&(u[f]=N),_[f]=N),g[f]=C}o.splice(1,0,g),l.splice(1,0,_),p=-1;const x=[];for(;++p<o.length;){const v=o[p],S=l[p];f=-1;const w=[];for(;++f<d;){const N=v[f]||"";let C="",T="";if(r.alignDelimiters!==!1){const A=u[f]-(S[f]||0),E=a[f];E===114?C=" ".repeat(A):E===99?A%2?(C=" ".repeat(A/2+.5),T=" ".repeat(A/2-.5)):(C=" ".repeat(A/2),T=C):T=" ".repeat(A)}r.delimiterStart!==!1&&!f&&w.push("|"),r.padding!==!1&&!(r.alignDelimiters===!1&&N==="")&&(r.delimiterStart!==!1||f)&&w.push(" "),r.alignDelimiters!==!1&&w.push(C),w.push(N),r.alignDelimiters!==!1&&w.push(T),r.padding!==!1&&w.push(" "),(r.delimiterEnd!==!1||f!==d-1)&&w.push("|")}x.push(r.delimiterEnd===!1?w.join("").replace(/ +$/,""):w.join(""))}return x.join(`
`)}function Yle(e){return e==null?"":String(e)}function I4(e){const n=typeof e=="string"?e.codePointAt(0):0;return n===67||n===99?99:n===76||n===108?108:n===82||n===114?114:0}function Gle(e,n,r,i){const s=r.enter("blockquote"),a=r.createTracker(i);a.move("> "),a.shift(2);const o=r.indentLines(r.containerFlow(e,a.current()),Xle);return s(),o}function Xle(e,n,r){return">"+(r?"":" ")+e}function Qle(e,n){return B4(e,n.inConstruct,!0)&&!B4(e,n.notInConstruct,!1)}function B4(e,n,r){if(typeof n=="string"&&(n=[n]),!n||n.length===0)return r;let i=-1;for(;++i<n.length;)if(e.includes(n[i]))return!0;return!1}function z4(e,n,r,i){let s=-1;for(;++s<r.unsafe.length;)if(r.unsafe[s].character===`
`&&Qle(r.stack,r.unsafe[s]))return/[ \t]/.test(i.before)?"":" ";return`\\
`}function Zle(e,n){const r=String(e);let i=r.indexOf(n),s=i,a=0,o=0;if(typeof n!="string")throw new TypeError("Expected substring");for(;i!==-1;)i===s?++a>o&&(o=a):a=1,s=i+n.length,i=r.indexOf(n,s);return o}function Jle(e,n){return!!(n.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function ece(e){const n=e.options.fence||"`";if(n!=="`"&&n!=="~")throw new Error("Cannot serialize code with `"+n+"` for `options.fence`, expected `` ` `` or `~`");return n}function tce(e,n,r,i){const s=ece(r),a=e.value||"",o=s==="`"?"GraveAccent":"Tilde";if(Jle(e,r)){const f=r.enter("codeIndented"),g=r.indentLines(a,nce);return f(),g}const l=r.createTracker(i),u=s.repeat(Math.max(Zle(a,s)+1,3)),d=r.enter("codeFenced");let p=l.move(u);if(e.lang){const f=r.enter(`codeFencedLang${o}`);p+=l.move(r.safe(e.lang,{before:p,after:" ",encode:["`"],...l.current()})),f()}if(e.lang&&e.meta){const f=r.enter(`codeFencedMeta${o}`);p+=l.move(" "),p+=l.move(r.safe(e.meta,{before:p,after:`
`,encode:["`"],...l.current()})),f()}return p+=l.move(`
`),a&&(p+=l.move(a+`
`)),p+=l.move(u),d(),p}function nce(e,n,r){return(r?"":"    ")+e}function KE(e){const n=e.options.quote||'"';if(n!=='"'&&n!=="'")throw new Error("Cannot serialize title with `"+n+"` for `options.quote`, expected `\"`, or `'`");return n}function rce(e,n,r,i){const s=KE(r),a=s==='"'?"Quote":"Apostrophe",o=r.enter("definition");let l=r.enter("label");const u=r.createTracker(i);let d=u.move("[");return d+=u.move(r.safe(r.associationId(e),{before:d,after:"]",...u.current()})),d+=u.move("]: "),l(),!e.url||/[\0- \u007F]/.test(e.url)?(l=r.enter("destinationLiteral"),d+=u.move("<"),d+=u.move(r.safe(e.url,{before:d,after:">",...u.current()})),d+=u.move(">")):(l=r.enter("destinationRaw"),d+=u.move(r.safe(e.url,{before:d,after:e.title?" ":`
`,...u.current()}))),l(),e.title&&(l=r.enter(`title${a}`),d+=u.move(" "+s),d+=u.move(r.safe(e.title,{before:d,after:s,...u.current()})),d+=u.move(s),l()),o(),d}function ice(e){const n=e.options.emphasis||"*";if(n!=="*"&&n!=="_")throw new Error("Cannot serialize emphasis with `"+n+"` for `options.emphasis`, expected `*`, or `_`");return n}function _g(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Xx(e,n,r){const i=kf(e),s=kf(n);return i===void 0?s===void 0?r==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:i===1?s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}O9.peek=sce;function O9(e,n,r,i){const s=ice(r),a=r.enter("emphasis"),o=r.createTracker(i),l=o.move(s);let u=o.move(r.containerPhrasing(e,{after:s,before:l,...o.current()}));const d=u.charCodeAt(0),p=Xx(i.before.charCodeAt(i.before.length-1),d,s);p.inside&&(u=_g(d)+u.slice(1));const f=u.charCodeAt(u.length-1),g=Xx(i.after.charCodeAt(0),f,s);g.inside&&(u=u.slice(0,-1)+_g(f));const _=o.move(s);return a(),r.attentionEncodeSurroundingInfo={after:g.outside,before:p.outside},l+u+_}function sce(e,n,r){return r.options.emphasis||"*"}function ace(e,n){let r=!1;return qE(e,function(i){if("value"in i&&/\r?\n|\r/.test(i.value)||i.type==="break")return r=!0,ej}),!!((!e.depth||e.depth<3)&&IE(e)&&(n.options.setext||r))}function oce(e,n,r,i){const s=Math.max(Math.min(6,e.depth||1),1),a=r.createTracker(i);if(ace(e,r)){const p=r.enter("headingSetext"),f=r.enter("phrasing"),g=r.containerPhrasing(e,{...a.current(),before:`
`,after:`
`});return f(),p(),g+`
`+(s===1?"=":"-").repeat(g.length-(Math.max(g.lastIndexOf("\r"),g.lastIndexOf(`
`))+1))}const o="#".repeat(s),l=r.enter("headingAtx"),u=r.enter("phrasing");a.move(o+" ");let d=r.containerPhrasing(e,{before:"# ",after:`
`,...a.current()});return/^[\t ]/.test(d)&&(d=_g(d.charCodeAt(0))+d.slice(1)),d=d?o+" "+d:o,r.options.closeAtx&&(d+=" "+o),u(),l(),d}D9.peek=lce;function D9(e){return e.value||""}function lce(){return"<"}P9.peek=cce;function P9(e,n,r,i){const s=KE(r),a=s==='"'?"Quote":"Apostrophe",o=r.enter("image");let l=r.enter("label");const u=r.createTracker(i);let d=u.move("![");return d+=u.move(r.safe(e.alt,{before:d,after:"]",...u.current()})),d+=u.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=r.enter("destinationLiteral"),d+=u.move("<"),d+=u.move(r.safe(e.url,{before:d,after:">",...u.current()})),d+=u.move(">")):(l=r.enter("destinationRaw"),d+=u.move(r.safe(e.url,{before:d,after:e.title?" ":")",...u.current()}))),l(),e.title&&(l=r.enter(`title${a}`),d+=u.move(" "+s),d+=u.move(r.safe(e.title,{before:d,after:s,...u.current()})),d+=u.move(s),l()),d+=u.move(")"),o(),d}function cce(){return"!"}L9.peek=uce;function L9(e,n,r,i){const s=e.referenceType,a=r.enter("imageReference");let o=r.enter("label");const l=r.createTracker(i);let u=l.move("![");const d=r.safe(e.alt,{before:u,after:"]",...l.current()});u+=l.move(d+"]["),o();const p=r.stack;r.stack=[],o=r.enter("reference");const f=r.safe(r.associationId(e),{before:u,after:"]",...l.current()});return o(),r.stack=p,a(),s==="full"||!d||d!==f?u+=l.move(f+"]"):s==="shortcut"?u=u.slice(0,-1):u+=l.move("]"),u}function uce(){return"!"}I9.peek=dce;function I9(e,n,r){let i=e.value||"",s="`",a=-1;for(;new RegExp("(^|[^`])"+s+"([^`]|$)").test(i);)s+="`";for(/[^ \r\n]/.test(i)&&(/^[ \r\n]/.test(i)&&/[ \r\n]$/.test(i)||/^`|`$/.test(i))&&(i=" "+i+" ");++a<r.unsafe.length;){const o=r.unsafe[a],l=r.compilePattern(o);let u;if(o.atBreak)for(;u=l.exec(i);){let d=u.index;i.charCodeAt(d)===10&&i.charCodeAt(d-1)===13&&d--,i=i.slice(0,d)+" "+i.slice(u.index+1)}}return s+i+s}function dce(){return"`"}function B9(e,n){const r=IE(e);return!!(!n.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(r===e.url||"mailto:"+r===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}z9.peek=hce;function z9(e,n,r,i){const s=KE(r),a=s==='"'?"Quote":"Apostrophe",o=r.createTracker(i);let l,u;if(B9(e,r)){const p=r.stack;r.stack=[],l=r.enter("autolink");let f=o.move("<");return f+=o.move(r.containerPhrasing(e,{before:f,after:">",...o.current()})),f+=o.move(">"),l(),r.stack=p,f}l=r.enter("link"),u=r.enter("label");let d=o.move("[");return d+=o.move(r.containerPhrasing(e,{before:d,after:"](",...o.current()})),d+=o.move("]("),u(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(u=r.enter("destinationLiteral"),d+=o.move("<"),d+=o.move(r.safe(e.url,{before:d,after:">",...o.current()})),d+=o.move(">")):(u=r.enter("destinationRaw"),d+=o.move(r.safe(e.url,{before:d,after:e.title?" ":")",...o.current()}))),u(),e.title&&(u=r.enter(`title${a}`),d+=o.move(" "+s),d+=o.move(r.safe(e.title,{before:d,after:s,...o.current()})),d+=o.move(s),u()),d+=o.move(")"),l(),d}function hce(e,n,r){return B9(e,r)?"<":"["}$9.peek=fce;function $9(e,n,r,i){const s=e.referenceType,a=r.enter("linkReference");let o=r.enter("label");const l=r.createTracker(i);let u=l.move("[");const d=r.containerPhrasing(e,{before:u,after:"]",...l.current()});u+=l.move(d+"]["),o();const p=r.stack;r.stack=[],o=r.enter("reference");const f=r.safe(r.associationId(e),{before:u,after:"]",...l.current()});return o(),r.stack=p,a(),s==="full"||!d||d!==f?u+=l.move(f+"]"):s==="shortcut"?u=u.slice(0,-1):u+=l.move("]"),u}function fce(){return"["}function YE(e){const n=e.options.bullet||"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bullet`, expected `*`, `+`, or `-`");return n}function pce(e){const n=YE(e),r=e.options.bulletOther;if(!r)return n==="*"?"-":"*";if(r!=="*"&&r!=="+"&&r!=="-")throw new Error("Cannot serialize items with `"+r+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(r===n)throw new Error("Expected `bullet` (`"+n+"`) and `bulletOther` (`"+r+"`) to be different");return r}function mce(e){const n=e.options.bulletOrdered||".";if(n!=="."&&n!==")")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOrdered`, expected `.` or `)`");return n}function F9(e){const n=e.options.rule||"*";if(n!=="*"&&n!=="-"&&n!=="_")throw new Error("Cannot serialize rules with `"+n+"` for `options.rule`, expected `*`, `-`, or `_`");return n}function gce(e,n,r,i){const s=r.enter("list"),a=r.bulletCurrent;let o=e.ordered?mce(r):YE(r);const l=e.ordered?o==="."?")":".":pce(r);let u=n&&r.bulletLastUsed?o===r.bulletLastUsed:!1;if(!e.ordered){const p=e.children?e.children[0]:void 0;if((o==="*"||o==="-")&&p&&(!p.children||!p.children[0])&&r.stack[r.stack.length-1]==="list"&&r.stack[r.stack.length-2]==="listItem"&&r.stack[r.stack.length-3]==="list"&&r.stack[r.stack.length-4]==="listItem"&&r.indexStack[r.indexStack.length-1]===0&&r.indexStack[r.indexStack.length-2]===0&&r.indexStack[r.indexStack.length-3]===0&&(u=!0),F9(r)===o&&p){let f=-1;for(;++f<e.children.length;){const g=e.children[f];if(g&&g.type==="listItem"&&g.children&&g.children[0]&&g.children[0].type==="thematicBreak"){u=!0;break}}}}u&&(o=l),r.bulletCurrent=o;const d=r.containerFlow(e,i);return r.bulletLastUsed=o,r.bulletCurrent=a,s(),d}function vce(e){const n=e.options.listItemIndent||"one";if(n!=="tab"&&n!=="one"&&n!=="mixed")throw new Error("Cannot serialize items with `"+n+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return n}function yce(e,n,r,i){const s=vce(r);let a=r.bulletCurrent||YE(r);n&&n.type==="list"&&n.ordered&&(a=(typeof n.start=="number"&&n.start>-1?n.start:1)+(r.options.incrementListMarker===!1?0:n.children.indexOf(e))+a);let o=a.length+1;(s==="tab"||s==="mixed"&&(n&&n.type==="list"&&n.spread||e.spread))&&(o=Math.ceil(o/4)*4);const l=r.createTracker(i);l.move(a+" ".repeat(o-a.length)),l.shift(o);const u=r.enter("listItem"),d=r.indentLines(r.containerFlow(e,l.current()),p);return u(),d;function p(f,g,_){return g?(_?"":" ".repeat(o))+f:(_?a:a+" ".repeat(o-a.length))+f}}function _ce(e,n,r,i){const s=r.enter("paragraph"),a=r.enter("phrasing"),o=r.containerPhrasing(e,i);return a(),s(),o}const xce=v0(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function bce(e,n,r,i){return(e.children.some(function(o){return xce(o)})?r.containerPhrasing:r.containerFlow).call(r,e,i)}function kce(e){const n=e.options.strong||"*";if(n!=="*"&&n!=="_")throw new Error("Cannot serialize strong with `"+n+"` for `options.strong`, expected `*`, or `_`");return n}H9.peek=wce;function H9(e,n,r,i){const s=kce(r),a=r.enter("strong"),o=r.createTracker(i),l=o.move(s+s);let u=o.move(r.containerPhrasing(e,{after:s,before:l,...o.current()}));const d=u.charCodeAt(0),p=Xx(i.before.charCodeAt(i.before.length-1),d,s);p.inside&&(u=_g(d)+u.slice(1));const f=u.charCodeAt(u.length-1),g=Xx(i.after.charCodeAt(0),f,s);g.inside&&(u=u.slice(0,-1)+_g(f));const _=o.move(s+s);return a(),r.attentionEncodeSurroundingInfo={after:g.outside,before:p.outside},l+u+_}function wce(e,n,r){return r.options.strong||"*"}function Sce(e,n,r,i){return r.safe(e.value,i)}function Cce(e){const n=e.options.ruleRepetition||3;if(n<3)throw new Error("Cannot serialize rules with repetition `"+n+"` for `options.ruleRepetition`, expected `3` or more");return n}function jce(e,n,r){const i=(F9(r)+(r.options.ruleSpaces?" ":"")).repeat(Cce(r));return r.options.ruleSpaces?i.slice(0,-1):i}const W9={blockquote:Gle,break:z4,code:tce,definition:rce,emphasis:O9,hardBreak:z4,heading:oce,html:D9,image:P9,imageReference:L9,inlineCode:I9,link:z9,linkReference:$9,list:gce,listItem:yce,paragraph:_ce,root:bce,strong:H9,text:Sce,thematicBreak:jce};function Nce(){return{enter:{table:Ece,tableData:$4,tableHeader:$4,tableRow:Tce},exit:{codeText:Mce,table:Ace,tableData:Gw,tableHeader:Gw,tableRow:Gw}}}function Ece(e){const n=e._align;this.enter({type:"table",align:n.map(function(r){return r==="none"?null:r}),children:[]},e),this.data.inTable=!0}function Ace(e){this.exit(e),this.data.inTable=void 0}function Tce(e){this.enter({type:"tableRow",children:[]},e)}function Gw(e){this.exit(e)}function $4(e){this.enter({type:"tableCell",children:[]},e)}function Mce(e){let n=this.resume();this.data.inTable&&(n=n.replace(/\\([\\|])/g,Rce));const r=this.stack[this.stack.length-1];r.type,r.value=n,this.exit(e)}function Rce(e,n){return n==="|"?n:e}function Oce(e){const n=e||{},r=n.tableCellPadding,i=n.tablePipeAlign,s=n.stringLength,a=r?" ":"|";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:g,table:o,tableCell:u,tableRow:l}};function o(_,x,v,S){return d(p(_,v,S),_.align)}function l(_,x,v,S){const w=f(_,v,S),N=d([w]);return N.slice(0,N.indexOf(`
`))}function u(_,x,v,S){const w=v.enter("tableCell"),N=v.enter("phrasing"),C=v.containerPhrasing(_,{...S,before:a,after:a});return N(),w(),C}function d(_,x){return Kle(_,{align:x,alignDelimiters:i,padding:r,stringLength:s})}function p(_,x,v){const S=_.children;let w=-1;const N=[],C=x.enter("table");for(;++w<S.length;)N[w]=f(S[w],x,v);return C(),N}function f(_,x,v){const S=_.children;let w=-1;const N=[],C=x.enter("tableRow");for(;++w<S.length;)N[w]=u(S[w],_,x,v);return C(),N}function g(_,x,v){let S=W9.inlineCode(_,x,v);return v.stack.includes("tableCell")&&(S=S.replace(/\|/g,"\\$&")),S}}function Dce(){return{exit:{taskListCheckValueChecked:F4,taskListCheckValueUnchecked:F4,paragraph:Lce}}}function Pce(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:Ice}}}function F4(e){const n=this.stack[this.stack.length-2];n.type,n.checked=e.type==="taskListCheckValueChecked"}function Lce(e){const n=this.stack[this.stack.length-2];if(n&&n.type==="listItem"&&typeof n.checked=="boolean"){const r=this.stack[this.stack.length-1];r.type;const i=r.children[0];if(i&&i.type==="text"){const s=n.children;let a=-1,o;for(;++a<s.length;){const l=s[a];if(l.type==="paragraph"){o=l;break}}o===r&&(i.value=i.value.slice(1),i.value.length===0?r.children.shift():r.position&&i.position&&typeof i.position.start.offset=="number"&&(i.position.start.column++,i.position.start.offset++,r.position.start=Object.assign({},i.position.start)))}}this.exit(e)}function Ice(e,n,r,i){const s=e.children[0],a=typeof e.checked=="boolean"&&s&&s.type==="paragraph",o="["+(e.checked?"x":" ")+"] ",l=r.createTracker(i);a&&l.move(o);let u=W9.listItem(e,n,r,{...i,...l.current()});return a&&(u=u.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,d)),u;function d(p){return p+o}}function Bce(){return[gle(),Ile(),Fle(),Nce(),Dce()]}function zce(e){return{extensions:[vle(),Ble(e),Hle(),Oce(e),Pce()]}}const $ce={tokenize:Vce,partial:!0},q9={tokenize:Kce,partial:!0},U9={tokenize:Yce,partial:!0},V9={tokenize:Gce,partial:!0},Fce={tokenize:Xce,partial:!0},K9={name:"wwwAutolink",tokenize:qce,previous:G9},Y9={name:"protocolAutolink",tokenize:Uce,previous:X9},Jl={name:"emailAutolink",tokenize:Wce,previous:Q9},Jo={};function Hce(){return{text:Jo}}let $u=48;for(;$u<123;)Jo[$u]=Jl,$u++,$u===58?$u=65:$u===91&&($u=97);Jo[43]=Jl;Jo[45]=Jl;Jo[46]=Jl;Jo[95]=Jl;Jo[72]=[Jl,Y9];Jo[104]=[Jl,Y9];Jo[87]=[Jl,K9];Jo[119]=[Jl,K9];function Wce(e,n,r){const i=this;let s,a;return o;function o(f){return!ij(f)||!Q9.call(i,i.previous)||GE(i.events)?r(f):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),l(f))}function l(f){return ij(f)?(e.consume(f),l):f===64?(e.consume(f),u):r(f)}function u(f){return f===46?e.check(Fce,p,d)(f):f===45||f===95||Hi(f)?(a=!0,e.consume(f),u):p(f)}function d(f){return e.consume(f),s=!0,u}function p(f){return a&&s&&Qi(i.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),n(f)):r(f)}}function qce(e,n,r){const i=this;return s;function s(o){return o!==87&&o!==119||!G9.call(i,i.previous)||GE(i.events)?r(o):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check($ce,e.attempt(q9,e.attempt(U9,a),r),r)(o))}function a(o){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),n(o)}}function Uce(e,n,r){const i=this;let s="",a=!1;return o;function o(f){return(f===72||f===104)&&X9.call(i,i.previous)&&!GE(i.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),s+=String.fromCodePoint(f),e.consume(f),l):r(f)}function l(f){if(Qi(f)&&s.length<5)return s+=String.fromCodePoint(f),e.consume(f),l;if(f===58){const g=s.toLowerCase();if(g==="http"||g==="https")return e.consume(f),u}return r(f)}function u(f){return f===47?(e.consume(f),a?d:(a=!0,u)):r(f)}function d(f){return f===null||Kx(f)||er(f)||wd(f)||p0(f)?r(f):e.attempt(q9,e.attempt(U9,p),r)(f)}function p(f){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),n(f)}}function Vce(e,n,r){let i=0;return s;function s(o){return(o===87||o===119)&&i<3?(i++,e.consume(o),s):o===46&&i===3?(e.consume(o),a):r(o)}function a(o){return o===null?r(o):n(o)}}function Kce(e,n,r){let i,s,a;return o;function o(d){return d===46||d===95?e.check(V9,u,l)(d):d===null||er(d)||wd(d)||d!==45&&p0(d)?u(d):(a=!0,e.consume(d),o)}function l(d){return d===95?i=!0:(s=i,i=void 0),e.consume(d),o}function u(d){return s||i||!a?r(d):n(d)}}function Yce(e,n){let r=0,i=0;return s;function s(o){return o===40?(r++,e.consume(o),s):o===41&&i<r?a(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?e.check(V9,n,a)(o):o===null||er(o)||wd(o)?n(o):(e.consume(o),s)}function a(o){return o===41&&i++,e.consume(o),s}}function Gce(e,n,r){return i;function i(l){return l===33||l===34||l===39||l===41||l===42||l===44||l===46||l===58||l===59||l===63||l===95||l===126?(e.consume(l),i):l===38?(e.consume(l),a):l===93?(e.consume(l),s):l===60||l===null||er(l)||wd(l)?n(l):r(l)}function s(l){return l===null||l===40||l===91||er(l)||wd(l)?n(l):i(l)}function a(l){return Qi(l)?o(l):r(l)}function o(l){return l===59?(e.consume(l),i):Qi(l)?(e.consume(l),o):r(l)}}function Xce(e,n,r){return i;function i(a){return e.consume(a),s}function s(a){return Hi(a)?r(a):n(a)}}function G9(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||er(e)}function X9(e){return!Qi(e)}function Q9(e){return!(e===47||ij(e))}function ij(e){return e===43||e===45||e===46||e===95||Hi(e)}function GE(e){let n=e.length,r=!1;for(;n--;){const i=e[n][1];if((i.type==="labelLink"||i.type==="labelImage")&&!i._balanced){r=!0;break}if(i._gfmAutolinkLiteralWalkedInto){r=!1;break}}return e.length>0&&!r&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),r}const Qce={tokenize:sue,partial:!0};function Zce(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:nue,continuation:{tokenize:rue},exit:iue}},text:{91:{name:"gfmFootnoteCall",tokenize:tue},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:Jce,resolveTo:eue}}}}function Jce(e,n,r){const i=this;let s=i.events.length;const a=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let o;for(;s--;){const u=i.events[s][1];if(u.type==="labelImage"){o=u;break}if(u.type==="gfmFootnoteCall"||u.type==="labelLink"||u.type==="label"||u.type==="image"||u.type==="link")break}return l;function l(u){if(!o||!o._balanced)return r(u);const d=Qa(i.sliceSerialize({start:o.end,end:i.now()}));return d.codePointAt(0)!==94||!a.includes(d.slice(1))?r(u):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(u),e.exit("gfmFootnoteCallLabelMarker"),n(u))}}function eue(e,n){let r=e.length;for(;r--;)if(e[r][1].type==="labelImage"&&e[r][0]==="enter"){e[r][1];break}e[r+1][1].type="data",e[r+3][1].type="gfmFootnoteCallLabelMarker";const i={type:"gfmFootnoteCall",start:Object.assign({},e[r+3][1].start),end:Object.assign({},e[e.length-1][1].end)},s={type:"gfmFootnoteCallMarker",start:Object.assign({},e[r+3][1].end),end:Object.assign({},e[r+3][1].end)};s.end.column++,s.end.offset++,s.end._bufferIndex++;const a={type:"gfmFootnoteCallString",start:Object.assign({},s.end),end:Object.assign({},e[e.length-1][1].start)},o={type:"chunkString",contentType:"string",start:Object.assign({},a.start),end:Object.assign({},a.end)},l=[e[r+1],e[r+2],["enter",i,n],e[r+3],e[r+4],["enter",s,n],["exit",s,n],["enter",a,n],["enter",o,n],["exit",o,n],["exit",a,n],e[e.length-2],e[e.length-1],["exit",i,n]];return e.splice(r,e.length-r+1,...l),e}function tue(e,n,r){const i=this,s=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let a=0,o;return l;function l(f){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),u}function u(f){return f!==94?r(f):(e.enter("gfmFootnoteCallMarker"),e.consume(f),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",d)}function d(f){if(a>999||f===93&&!o||f===null||f===91||er(f))return r(f);if(f===93){e.exit("chunkString");const g=e.exit("gfmFootnoteCallString");return s.includes(Qa(i.sliceSerialize(g)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),n):r(f)}return er(f)||(o=!0),a++,e.consume(f),f===92?p:d}function p(f){return f===91||f===92||f===93?(e.consume(f),a++,d):d(f)}}function nue(e,n,r){const i=this,s=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let a,o=0,l;return u;function u(x){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(x),e.exit("gfmFootnoteDefinitionLabelMarker"),d}function d(x){return x===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(x),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",p):r(x)}function p(x){if(o>999||x===93&&!l||x===null||x===91||er(x))return r(x);if(x===93){e.exit("chunkString");const v=e.exit("gfmFootnoteDefinitionLabelString");return a=Qa(i.sliceSerialize(v)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(x),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),g}return er(x)||(l=!0),o++,e.consume(x),x===92?f:p}function f(x){return x===91||x===92||x===93?(e.consume(x),o++,p):p(x)}function g(x){return x===58?(e.enter("definitionMarker"),e.consume(x),e.exit("definitionMarker"),s.includes(a)||s.push(a),jn(e,_,"gfmFootnoteDefinitionWhitespace")):r(x)}function _(x){return n(x)}}function rue(e,n,r){return e.check(hv,n,e.attempt(Qce,n,r))}function iue(e){e.exit("gfmFootnoteDefinition")}function sue(e,n,r){const i=this;return jn(e,s,"gfmFootnoteDefinitionIndent",5);function s(a){const o=i.events[i.events.length-1];return o&&o[1].type==="gfmFootnoteDefinitionIndent"&&o[2].sliceSerialize(o[1],!0).length===4?n(a):r(a)}}function aue(e){let r=(e||{}).singleTilde;const i={name:"strikethrough",tokenize:a,resolveAll:s};return r==null&&(r=!0),{text:{126:i},insideSpan:{null:[i]},attentionMarkers:{null:[126]}};function s(o,l){let u=-1;for(;++u<o.length;)if(o[u][0]==="enter"&&o[u][1].type==="strikethroughSequenceTemporary"&&o[u][1]._close){let d=u;for(;d--;)if(o[d][0]==="exit"&&o[d][1].type==="strikethroughSequenceTemporary"&&o[d][1]._open&&o[u][1].end.offset-o[u][1].start.offset===o[d][1].end.offset-o[d][1].start.offset){o[u][1].type="strikethroughSequence",o[d][1].type="strikethroughSequence";const p={type:"strikethrough",start:Object.assign({},o[d][1].start),end:Object.assign({},o[u][1].end)},f={type:"strikethroughText",start:Object.assign({},o[d][1].end),end:Object.assign({},o[u][1].start)},g=[["enter",p,l],["enter",o[d][1],l],["exit",o[d][1],l],["enter",f,l]],_=l.parser.constructs.insideSpan.null;_&&Js(g,g.length,0,m0(_,o.slice(d+1,u),l)),Js(g,g.length,0,[["exit",f,l],["enter",o[u][1],l],["exit",o[u][1],l],["exit",p,l]]),Js(o,d-1,u-d+3,g),u=d+g.length-2;break}}for(u=-1;++u<o.length;)o[u][1].type==="strikethroughSequenceTemporary"&&(o[u][1].type="data");return o}function a(o,l,u){const d=this.previous,p=this.events;let f=0;return g;function g(x){return d===126&&p[p.length-1][1].type!=="characterEscape"?u(x):(o.enter("strikethroughSequenceTemporary"),_(x))}function _(x){const v=kf(d);if(x===126)return f>1?u(x):(o.consume(x),f++,_);if(f<2&&!r)return u(x);const S=o.exit("strikethroughSequenceTemporary"),w=kf(x);return S._open=!w||w===2&&!!v,S._close=!v||v===2&&!!w,l(x)}}}class oue{constructor(){this.map=[]}add(n,r,i){lue(this,n,r,i)}consume(n){if(this.map.sort(function(a,o){return a[0]-o[0]}),this.map.length===0)return;let r=this.map.length;const i=[];for(;r>0;)r-=1,i.push(n.slice(this.map[r][0]+this.map[r][1]),this.map[r][2]),n.length=this.map[r][0];i.push(n.slice()),n.length=0;let s=i.pop();for(;s;){for(const a of s)n.push(a);s=i.pop()}this.map.length=0}}function lue(e,n,r,i){let s=0;if(!(r===0&&i.length===0)){for(;s<e.map.length;){if(e.map[s][0]===n){e.map[s][1]+=r,e.map[s][2].push(...i);return}s+=1}e.map.push([n,r,i])}}function cue(e,n){let r=!1;const i=[];for(;n<e.length;){const s=e[n];if(r){if(s[0]==="enter")s[1].type==="tableContent"&&i.push(e[n+1][1].type==="tableDelimiterMarker"?"left":"none");else if(s[1].type==="tableContent"){if(e[n-1][1].type==="tableDelimiterMarker"){const a=i.length-1;i[a]=i[a]==="left"?"center":"right"}}else if(s[1].type==="tableDelimiterRow")break}else s[0]==="enter"&&s[1].type==="tableDelimiterRow"&&(r=!0);n+=1}return i}function uue(){return{flow:{null:{name:"table",tokenize:due,resolveAll:hue}}}}function due(e,n,r){const i=this;let s=0,a=0,o;return l;function l(H){let $=i.events.length-1;for(;$>-1;){const P=i.events[$][1].type;if(P==="lineEnding"||P==="linePrefix")$--;else break}const z=$>-1?i.events[$][1].type:null,W=z==="tableHead"||z==="tableRow"?E:u;return W===E&&i.parser.lazy[i.now().line]?r(H):W(H)}function u(H){return e.enter("tableHead"),e.enter("tableRow"),d(H)}function d(H){return H===124||(o=!0,a+=1),p(H)}function p(H){return H===null?r(H):Ut(H)?a>1?(a=0,i.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(H),e.exit("lineEnding"),_):r(H):mn(H)?jn(e,p,"whitespace")(H):(a+=1,o&&(o=!1,s+=1),H===124?(e.enter("tableCellDivider"),e.consume(H),e.exit("tableCellDivider"),o=!0,p):(e.enter("data"),f(H)))}function f(H){return H===null||H===124||er(H)?(e.exit("data"),p(H)):(e.consume(H),H===92?g:f)}function g(H){return H===92||H===124?(e.consume(H),f):f(H)}function _(H){return i.interrupt=!1,i.parser.lazy[i.now().line]?r(H):(e.enter("tableDelimiterRow"),o=!1,mn(H)?jn(e,x,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(H):x(H))}function x(H){return H===45||H===58?S(H):H===124?(o=!0,e.enter("tableCellDivider"),e.consume(H),e.exit("tableCellDivider"),v):A(H)}function v(H){return mn(H)?jn(e,S,"whitespace")(H):S(H)}function S(H){return H===58?(a+=1,o=!0,e.enter("tableDelimiterMarker"),e.consume(H),e.exit("tableDelimiterMarker"),w):H===45?(a+=1,w(H)):H===null||Ut(H)?T(H):A(H)}function w(H){return H===45?(e.enter("tableDelimiterFiller"),N(H)):A(H)}function N(H){return H===45?(e.consume(H),N):H===58?(o=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(H),e.exit("tableDelimiterMarker"),C):(e.exit("tableDelimiterFiller"),C(H))}function C(H){return mn(H)?jn(e,T,"whitespace")(H):T(H)}function T(H){return H===124?x(H):H===null||Ut(H)?!o||s!==a?A(H):(e.exit("tableDelimiterRow"),e.exit("tableHead"),n(H)):A(H)}function A(H){return r(H)}function E(H){return e.enter("tableRow"),D(H)}function D(H){return H===124?(e.enter("tableCellDivider"),e.consume(H),e.exit("tableCellDivider"),D):H===null||Ut(H)?(e.exit("tableRow"),n(H)):mn(H)?jn(e,D,"whitespace")(H):(e.enter("data"),F(H))}function F(H){return H===null||H===124||er(H)?(e.exit("data"),D(H)):(e.consume(H),H===92?B:F)}function B(H){return H===92||H===124?(e.consume(H),F):F(H)}}function hue(e,n){let r=-1,i=!0,s=0,a=[0,0,0,0],o=[0,0,0,0],l=!1,u=0,d,p,f;const g=new oue;for(;++r<e.length;){const _=e[r],x=_[1];_[0]==="enter"?x.type==="tableHead"?(l=!1,u!==0&&(H4(g,n,u,d,p),p=void 0,u=0),d={type:"table",start:Object.assign({},x.start),end:Object.assign({},x.end)},g.add(r,0,[["enter",d,n]])):x.type==="tableRow"||x.type==="tableDelimiterRow"?(i=!0,f=void 0,a=[0,0,0,0],o=[0,r+1,0,0],l&&(l=!1,p={type:"tableBody",start:Object.assign({},x.start),end:Object.assign({},x.end)},g.add(r,0,[["enter",p,n]])),s=x.type==="tableDelimiterRow"?2:p?3:1):s&&(x.type==="data"||x.type==="tableDelimiterMarker"||x.type==="tableDelimiterFiller")?(i=!1,o[2]===0&&(a[1]!==0&&(o[0]=o[1],f=Zy(g,n,a,s,void 0,f),a=[0,0,0,0]),o[2]=r)):x.type==="tableCellDivider"&&(i?i=!1:(a[1]!==0&&(o[0]=o[1],f=Zy(g,n,a,s,void 0,f)),a=o,o=[a[1],r,0,0])):x.type==="tableHead"?(l=!0,u=r):x.type==="tableRow"||x.type==="tableDelimiterRow"?(u=r,a[1]!==0?(o[0]=o[1],f=Zy(g,n,a,s,r,f)):o[1]!==0&&(f=Zy(g,n,o,s,r,f)),s=0):s&&(x.type==="data"||x.type==="tableDelimiterMarker"||x.type==="tableDelimiterFiller")&&(o[3]=r)}for(u!==0&&H4(g,n,u,d,p),g.consume(n.events),r=-1;++r<n.events.length;){const _=n.events[r];_[0]==="enter"&&_[1].type==="table"&&(_[1]._align=cue(n.events,r))}return e}function Zy(e,n,r,i,s,a){const o=i===1?"tableHeader":i===2?"tableDelimiter":"tableData",l="tableContent";r[0]!==0&&(a.end=Object.assign({},Ih(n.events,r[0])),e.add(r[0],0,[["exit",a,n]]));const u=Ih(n.events,r[1]);if(a={type:o,start:Object.assign({},u),end:Object.assign({},u)},e.add(r[1],0,[["enter",a,n]]),r[2]!==0){const d=Ih(n.events,r[2]),p=Ih(n.events,r[3]),f={type:l,start:Object.assign({},d),end:Object.assign({},p)};if(e.add(r[2],0,[["enter",f,n]]),i!==2){const g=n.events[r[2]],_=n.events[r[3]];if(g[1].end=Object.assign({},_[1].end),g[1].type="chunkText",g[1].contentType="text",r[3]>r[2]+1){const x=r[2]+1,v=r[3]-r[2]-1;e.add(x,v,[])}}e.add(r[3]+1,0,[["exit",f,n]])}return s!==void 0&&(a.end=Object.assign({},Ih(n.events,s)),e.add(s,0,[["exit",a,n]]),a=void 0),a}function H4(e,n,r,i,s){const a=[],o=Ih(n.events,r);s&&(s.end=Object.assign({},o),a.push(["exit",s,n])),i.end=Object.assign({},o),a.push(["exit",i,n]),e.add(r+1,0,a)}function Ih(e,n){const r=e[n],i=r[0]==="enter"?"start":"end";return r[1][i]}const fue={name:"tasklistCheck",tokenize:mue};function pue(){return{text:{91:fue}}}function mue(e,n,r){const i=this;return s;function s(u){return i.previous!==null||!i._gfmTasklistFirstContentOfListItem?r(u):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(u),e.exit("taskListCheckMarker"),a)}function a(u){return er(u)?(e.enter("taskListCheckValueUnchecked"),e.consume(u),e.exit("taskListCheckValueUnchecked"),o):u===88||u===120?(e.enter("taskListCheckValueChecked"),e.consume(u),e.exit("taskListCheckValueChecked"),o):r(u)}function o(u){return u===93?(e.enter("taskListCheckMarker"),e.consume(u),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),l):r(u)}function l(u){return Ut(u)?n(u):mn(u)?e.check({tokenize:gue},n,r)(u):r(u)}}function gue(e,n,r){return jn(e,i,"whitespace");function i(s){return s===null?r(s):n(s)}}function vue(e){return l9([Hce(),Zce(),aue(e),uue(),pue()])}const yue={};function XE(e){const n=this,r=e||yue,i=n.data(),s=i.micromarkExtensions||(i.micromarkExtensions=[]),a=i.fromMarkdownExtensions||(i.fromMarkdownExtensions=[]),o=i.toMarkdownExtensions||(i.toMarkdownExtensions=[]);s.push(vue(r)),a.push(Bce()),o.push(zce(r))}function Z9(e){return typeof e=="string"||typeof e=="number"?String(e):Array.isArray(e)?e.map(Z9).join(""):""}function _ue({code:e,language:n}){const[r,i]=b.useState(!1),{t:s}=cn(),a=b.useCallback(async()=>{await Ja(e)&&(i(!0),setTimeout(()=>i(!1),1200))},[e]);return c.jsxs("div",{className:"group/code relative my-2 overflow-hidden rounded-md border",style:{borderColor:"var(--revka-border-soft)",background:"var(--revka-bg-base)"},children:[c.jsxs("div",{className:"flex items-center justify-between border-b px-2 py-1",style:{borderColor:"var(--revka-border-soft)",color:"var(--revka-text-faint)"},children:[c.jsx("span",{className:"font-mono text-[10px] uppercase",children:n||s("agent.code_language_fallback")}),c.jsxs("button",{type:"button",onClick:a,"aria-label":s(r?"agent.copied_code":"agent.copy_code"),title:s(r?"agent.copied":"agent.copy_code"),className:"inline-flex h-5 items-center gap-1 rounded px-1.5 font-mono text-[10px] transition-colors hover:bg-white/5 focus:outline-none focus-visible:ring-1 focus-visible:ring-current",style:{color:r?"var(--revka-status-success)":"var(--revka-text-muted)"},children:[r?c.jsx(Za,{className:"h-3 w-3"}):c.jsx(Xl,{className:"h-3 w-3"}),s(r?"agent.copied":"agent.copy")]})]}),c.jsx("pre",{className:"m-0 max-h-[28rem] overflow-auto p-3 font-mono text-[0.86em] leading-6",style:{color:"var(--revka-text-secondary)",textShadow:"none"},children:c.jsx("code",{children:e})})]})}function xue({content:e,color:n,textShadow:r}){return c.jsx("div",{className:"chat-markdown min-w-0 break-words leading-relaxed",style:{color:n,textShadow:r},children:c.jsx(VE,{remarkPlugins:[XE],components:{pre({children:i}){return c.jsx(c.Fragment,{children:i})},code({children:i,className:s,node:a,...o}){var p;const l=Z9(i).replace(/\n$/,""),u=(p=/language-([\w-]+)/.exec(s??""))==null?void 0:p[1];return!!u||l.includes(`
`)?c.jsx(_ue,{code:l,language:u}):c.jsx("code",{...o,className:s,style:{background:"color-mix(in srgb, var(--revka-bg-surface) 75%, transparent)",color:"var(--revka-text-secondary)",textShadow:"none"},children:i})}},children:e})})}const W4=b.memo(xue);function J9({anchorRef:e,matches:n,selectedIndex:r,onPick:i}){const s=b.useRef(null),[a,o]=b.useState(null);return b.useLayoutEffect(()=>{const l=()=>{var d;const u=(d=e.current)==null?void 0:d.getBoundingClientRect();u&&o({bottom:window.innerHeight-u.top+6,left:u.left,width:u.width})};return l(),window.addEventListener("resize",l),window.addEventListener("scroll",l,!0),()=>{window.removeEventListener("resize",l),window.removeEventListener("scroll",l,!0)}},[e]),b.useEffect(()=>{var u;const l=(u=s.current)==null?void 0:u.querySelector(`[data-slash-index="${r}"]`);l==null||l.scrollIntoView({block:"nearest"})},[r]),n.length===0||!a?null:na.createPortal(c.jsx("div",{ref:s,className:"fixed z-[200] overflow-y-auto rounded-[8px] border py-1 shadow-lg",style:{bottom:a.bottom,left:a.left,width:a.width,maxHeight:"40vh",background:"var(--revka-bg-panel-strong)",borderColor:"var(--revka-border-strong)"},role:"listbox","aria-label":"Slash commands",children:n.map((l,u)=>{const d=u===r;return c.jsxs("button",{type:"button","data-slash-index":u,role:"option","aria-selected":d,onMouseDown:p=>{p.preventDefault(),i(u)},className:"flex w-full items-center justify-between gap-3 px-3 py-1.5 text-left text-xs transition-colors",style:{background:d?"color-mix(in srgb, var(--revka-signal-live) 12%, transparent)":"transparent",color:d?"var(--revka-text-primary)":"var(--revka-text-secondary)"},children:[c.jsxs("span",{className:"flex min-w-0 items-baseline gap-2",children:[c.jsxs("span",{className:"font-mono font-semibold",style:{color:d?"var(--revka-signal-live)":"var(--revka-text-primary)"},children:["/",l.name]}),l.args?c.jsx("span",{className:"font-mono text-[10px]",style:{color:"var(--revka-text-faint)"},children:l.args}):null,l.aliases&&l.aliases.length>0?c.jsxs("span",{className:"font-mono text-[10px]",style:{color:"var(--revka-text-faint)"},children:["· ",l.aliases.map(p=>`/${p}`).join(" ")]}):null]}),c.jsx("span",{className:"truncate text-[11px]",style:{color:"var(--revka-text-muted)"},children:l.description})]},l.name)})}),document.body)}function e$(e){return e.trim().toLowerCase().replace(/^\//,"")}const QE=[{name:"help",aliases:["?"],description:"List available slash commands",example:"/help",handler:e=>{const n=[];n.push("Available commands:"),n.push("");for(const r of QE){const i=r.args?`/${r.name} ${r.args}`:`/${r.name}`,s=r.aliases&&r.aliases.length>0?`  (aka ${r.aliases.map(a=>`/${a}`).join(", ")})`:"";n.push(`  ${i.padEnd(28)} — ${r.description}${s}`)}n.push(""),n.push("Tip: type / to open the menu and arrow keys to navigate."),e.appendSystemMessage(n.join(`
`))}},{name:"clear",aliases:["cls"],description:"Clear chat scrollback (session stays connected)",example:"/clear",handler:e=>{e.clearMessages()}},{name:"new",description:"Open the new-tab menu",example:"/new",handler:e=>{e.openNewTabMenu()}},{name:"chat",description:"Open a new chat tab",example:"/chat",handler:e=>{e.addTab("chat")}},{name:"terminal",aliases:["term"],description:"Open a new terminal tab",example:"/terminal",handler:e=>{e.addTab("terminal")}},{name:"code",description:"Open a new code tab",example:"/code",handler:e=>{e.addTab("code")}},{name:"attach",aliases:["file"],description:"Pick a file to attach (opens OS file picker)",example:"/attach",handler:e=>{e.openFilePicker()}},{name:"theme",description:"Switch UI theme",args:"<dark|light|oled|system>",example:"/theme dark",handler:(e,n)=>{const r=n.trim().toLowerCase();r==="dark"||r==="light"||r==="system"||r==="oled"?e.setTheme(r):e.appendSystemMessage(`Unknown theme: "${n.trim()}". Expected dark, light, oled, or system.`)}},{name:"lang",aliases:["language"],description:"Switch UI language",args:"<en|zh|tr|ko>",example:"/lang ko",handler:(e,n)=>{const r=n.trim().toLowerCase();if(!r){e.appendSystemMessage("Usage: /lang <en|zh|tr|ko>");return}e.setLang(r)}},{name:"close",description:"Close the active tab",example:"/close",handler:e=>{e.closeActiveTab()}},{name:"architect",description:"Architect — describe a workflow change",args:"<description of the change>",example:"/architect add a python step that prints hello",scopes:["workflow_editor"],handler:(e,n)=>{const r=n.trim();if(!r){e.appendSystemMessage("Usage: /architect <describe the change you want>");return}if(!e.submitMessage){e.appendSystemMessage("The /architect command only works inside the workflow editor (open a workflow and press ⌘J).");return}e.submitMessage(`Please apply this change: ${r}`)||e.appendSystemMessage("Could not send — chat is not connected yet.")}}];function t$(e,n="global"){const r=e$(e),i=a=>!a.scopes||a.scopes.includes(n),s=QE.filter(i);return r===""?s:s.filter(a=>{var o;return!!(a.name.startsWith(r)||(o=a.aliases)!=null&&o.some(l=>l.startsWith(r)))})}function n$(e){const n=e.trimStart();if(!n.startsWith("/")||n.includes(`
`))return null;const r=n.slice(1),i=r.indexOf(" ");return i<0?{name:r,args:""}:{name:r.slice(0,i),args:r.slice(i+1)}}function r$(e){const n=e$(e);return QE.find(r=>{var i;return r.name===n||((i=r.aliases)==null?void 0:i.includes(n))})??null}function bue(e){return e.replace(/^\//,"")}const i$="operator-main",s$="revka_assistant_tabs_v1",a$="revka_assistant_archived_session_ids_v1",o$=12;function Xw(){return[{id:"chat-main",type:"chat",title:"Chat",sessionId:i$},{id:"terminal-main",type:"terminal",title:"Terminal",sessionId:cr()}]}function q4(){return{id:"chat-main",type:"chat",title:"Chat",sessionId:cr()}}function kue(){var e,n;try{const r=localStorage.getItem(s$);if(!r)return{tabs:Xw(),activeTabId:"chat-main"};const i=JSON.parse(r),s=Array.isArray(i.tabs)?i.tabs.filter(f=>!!f&&typeof f.id=="string"&&typeof f.title=="string"&&typeof f.sessionId=="string"&&(f.type==="chat"||f.type==="terminal"||f.type==="code")):[],a=s.some(f=>f.id===i.activeTabId)?i.activeTabId:(e=s[0])==null?void 0:e.id,o=s.filter(f=>f.type==="chat"),l=s.filter(f=>f.type!=="chat"),u=a?o.find(f=>f.id===a):void 0,p=[...[...u?[u]:[],...o.filter(f=>f.id!==(u==null?void 0:u.id))].slice(0,o$),...l];return p.length===0?{tabs:Xw(),activeTabId:"chat-main"}:{tabs:p,activeTabId:p.some(f=>f.id===a)?a:(n=p[0])==null?void 0:n.id}}catch{return{tabs:Xw(),activeTabId:"chat-main"}}}function l$(){try{const e=localStorage.getItem(a$);if(!e)return new Set;const n=JSON.parse(e);return Array.isArray(n)?new Set(n.filter(r=>typeof r=="string"&&r.length>0)):new Set}catch{return new Set}}function wue(e){try{localStorage.setItem(a$,JSON.stringify([...e]))}catch{}}function Sue(e){const n=l$();n.add(e),wue(n)}function Cue(e,n){try{const r=e.map(i=>({id:i.id,type:i.type,title:i.title,sessionId:i.sessionId,codeSession:i.type==="code"?null:void 0,pageContextOverride:i.pageContextOverride}));localStorage.setItem(s$,JSON.stringify({tabs:r,activeTabId:n}))}catch{}}function jue({config:e,updateConfig:n}){return c.jsx("div",{className:"border-b px-4 py-3",style:{borderColor:"var(--revka-border-soft)",background:"color-mix(in srgb, var(--revka-bg-surface) 95%, transparent)"},children:c.jsxs("div",{className:"grid grid-cols-2 gap-x-6 gap-y-3 text-xs",children:[c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block font-semibold uppercase tracking-[0.1em]",style:{color:"var(--revka-text-faint)",fontSize:"10px"},children:"Color Scheme"}),c.jsx("div",{className:"flex gap-1.5",children:dee.map(r=>c.jsx("button",{type:"button",onClick:()=>n({colorScheme:r}),className:"rounded px-2 py-1 text-[10px] font-semibold uppercase tracking-wider transition-colors",style:{background:e.colorScheme===r?Fm[r].colors.primary:"transparent",color:e.colorScheme===r?"#0c0c0c":"var(--revka-text-secondary)",border:`1px solid ${e.colorScheme===r?Fm[r].colors.primary:"var(--revka-border-soft)"}`},children:Fm[r].label},r))})]}),c.jsxs("div",{children:[c.jsxs("label",{className:"mb-1 block font-semibold uppercase tracking-[0.1em]",style:{color:"var(--revka-text-faint)",fontSize:"10px"},children:["Font Size — ",e.fontSize,"px"]}),c.jsx("input",{type:"range",min:10,max:20,step:1,value:e.fontSize,onChange:r=>n({fontSize:Number(r.target.value)}),className:"w-full accent-current",style:{color:"var(--revka-signal-live)"}})]}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("label",{className:"font-semibold uppercase tracking-[0.1em]",style:{color:"var(--revka-text-faint)",fontSize:"10px"},children:"Cursor Blink"}),c.jsx("button",{type:"button",onClick:()=>n({cursorBlink:!e.cursorBlink}),className:"relative h-5 w-9 rounded-full transition-colors",style:{background:e.cursorBlink?"var(--revka-signal-live)":"var(--revka-border-strong)"},children:c.jsx("span",{className:"absolute top-0.5 block h-4 w-4 rounded-full bg-white shadow transition-transform",style:{transform:e.cursorBlink?"translateX(18px)":"translateX(2px)"}})})]}),c.jsxs("div",{children:[c.jsxs("label",{className:"mb-1 block font-semibold uppercase tracking-[0.1em]",style:{color:"var(--revka-text-faint)",fontSize:"10px"},children:["Panel Height — ",e.panelHeightPercent,"%"]}),c.jsx("input",{type:"range",min:25,max:90,step:5,value:e.panelHeightPercent,onChange:r=>n({panelHeightPercent:Number(r.target.value)}),className:"w-full accent-current",style:{color:"var(--revka-signal-live)"}})]}),c.jsxs("div",{children:[c.jsxs("label",{className:"mb-1 block font-semibold uppercase tracking-[0.1em]",style:{color:"var(--revka-text-faint)",fontSize:"10px"},children:["Panel Opacity — ",Math.round(e.panelOpacity*100),"%"]}),c.jsx("input",{type:"range",min:.5,max:1,step:.05,value:e.panelOpacity,onChange:r=>n({panelOpacity:Number(r.target.value)}),className:"w-full accent-current",style:{color:"var(--revka-signal-live)"}})]})]})})}function Nue(e,n){return e==="user"?n.user:e==="operator"?n.secondary:n.primary}function Eue(e,n){return e==="agent"?n.glow:e==="operator"?n.glowSecondary:"none"}const Aue=b.memo(function({messages:n,typing:r,activities:i,streamingContent:s,streamingThinking:a,copiedId:o,colors:l,fontSize:u,placeholder:d,copyMessage:p}){return n.length===0&&!r?c.jsxs("div",{className:"flex h-full flex-col items-center justify-center text-center",children:[c.jsx("pre",{className:"text-xs",style:{color:"var(--revka-text-faint)"},children:`┌──────────────────────────────┐
│  session ready · ask away    │
└──────────────────────────────┘`}),c.jsx("p",{className:"mt-3 max-w-xs text-xs leading-5",style:{color:"var(--revka-text-muted)"},children:d})]}):c.jsxs("div",{className:"space-y-3",children:[n.map(f=>{const g=f.role==="user"?"you":f.role==="operator"?"sys":"op",_=Nue(f.role,l),x=Eue(f.role,l),v=o===f.id,S=f.role==="user"?"var(--revka-text-secondary)":_;return c.jsxs("div",{className:"group",children:[f.activityLog&&f.activityLog.length>0&&c.jsx("div",{className:"mb-1 space-y-0.5",children:f.activityLog.map(w=>c.jsx(Vx,{event:w,accent:w.kind==="tool_result"?"var(--revka-status-success)":l.secondary,fontSize:u},w.id))}),c.jsxs("div",{className:"flex min-w-0 items-start gap-1 break-words",children:[c.jsxs("span",{className:"shrink-0",style:{color:_,textShadow:x,fontWeight:600},children:[g," ",">"," "]}),c.jsx("div",{className:"min-w-0 flex-1",style:{color:S,textShadow:x},children:f.markdown&&f.role!=="user"?c.jsx(W4,{content:f.content,color:S,textShadow:x}):c.jsx("span",{className:"whitespace-pre-wrap break-words",children:f.content})})]}),c.jsxs("div",{className:"mt-0.5 flex items-center justify-end gap-2 text-[10px]",style:{color:"var(--revka-text-faint)"},children:[f.deliveryStatus==="queued"&&c.jsx("span",{className:"mr-auto inline-flex items-center rounded border px-1.5 py-0.5 uppercase tracking-[0.12em]",style:{borderColor:"var(--revka-border-soft)",color:"var(--revka-text-faint)"},children:"queued"}),f.deliveryStatus==="sending"&&c.jsxs("span",{className:"mr-auto inline-flex items-center gap-1 rounded border px-1.5 py-0.5 uppercase tracking-[0.12em]",style:{borderColor:"var(--revka-border-soft)",color:l.primary,textShadow:l.glow},children:[c.jsx(Rr,{className:"h-2.5 w-2.5 animate-spin"}),"sending"]}),c.jsxs("button",{type:"button",onClick:()=>p(f.id,f.content),"aria-label":v?"Copied":"Copy message",title:v?"Copied":"Copy",className:"inline-flex items-center gap-1 rounded px-1.5 py-0.5 opacity-50 transition-all hover:bg-white/5 hover:opacity-100 focus:opacity-100 focus:outline-none focus-visible:ring-1 focus-visible:ring-current group-hover:opacity-80",style:{color:"var(--revka-text-muted)"},children:[v?c.jsx(Za,{className:"h-3 w-3"}):c.jsx(Xl,{className:"h-3 w-3"}),c.jsx("span",{children:v?"copied":"copy"})]})]})]},f.id)}),r&&i.length>0&&c.jsx("div",{className:"space-y-0.5",children:i.map(f=>c.jsx(Vx,{event:f,accent:f.kind==="tool_result"?"var(--revka-status-success)":f.kind==="thinking"?"var(--revka-text-faint)":l.secondary,fontSize:u},f.id))}),r&&(s||a)&&c.jsxs("div",{className:"flex min-w-0 items-start gap-1 break-words",children:[c.jsxs("span",{className:"shrink-0",style:{color:l.primary,textShadow:l.glow,fontWeight:600},children:["op ",">"," "]}),c.jsx("div",{className:"min-w-0 flex-1",children:s?c.jsx(W4,{content:s,color:l.primary,textShadow:l.glow}):c.jsx("span",{style:{color:l.primary,textShadow:l.glow},children:"…"})})]}),r&&!s&&!a&&i.length===0&&c.jsxs("div",{className:"animate-pulse",style:{color:l.primary,textShadow:l.glow},children:["op ",">"," ▊"]})]})});function U4({tabId:e,sessionId:n,sessionName:r,pageContext:i,placeholder:s,config:a,colors:o,visible:l,onAddTab:u,onCloseActiveTab:d,onOpenNewTabMenu:p,onLiveStateChange:f}){const{open:g}=xE(),{setTheme:_}=Ta(),{setLocale:x,t:v}=cn(),{activities:S,addAttachment:w,appendSystemMessage:N,attachments:C,clearMessages:T,connected:A,error:E,handleSend:D,handleTextareaChange:F,input:B,inputRef:H,messages:$,removeAttachment:z,setInput:W,streamingContent:P,streamingThinking:q,queuedTurns:I,steerCurrentTurn:Q,stopCurrentTurn:K,stopping:Z,typing:Y,uploadingCount:R}=UB({sessionId:n,sessionName:r,draftKey:`revka-assistant:${n}`,pageContext:i}),U=b.useRef(null),V=b.useRef(null),ie=b.useRef(null),[te,X]=b.useState(null),[se,re]=b.useState(!1),[de,ue]=b.useState(0),[ae,pe]=b.useState(!1),[J,me]=b.useState("queue"),[fe,ve]=b.useState(!0),Ke=b.useRef(!0),ge=b.useCallback(async ye=>{const _e=Array.from(ye);await Promise.all(_e.map(Pe=>w(Pe)))},[w]),Ue=b.useCallback(()=>{var ye;(ye=V.current)==null||ye.click()},[]),$e=b.useMemo(()=>{if(ae)return[];const ye=B.trimStart();return ye.startsWith("/")?ye.includes(" ")||ye.includes(`
`)?[]:t$(ye):[]},[B,ae]);b.useEffect(()=>{de>=$e.length&&ue($e.length===0?0:$e.length-1)},[$e.length,de]),b.useEffect(()=>{ae&&!B.startsWith("/")&&pe(!1)},[B,ae]);const Bt=b.useMemo(()=>({clearMessages:T,appendSystemMessage:N,openFilePicker:()=>{var ye;return(ye=V.current)==null?void 0:ye.click()},addTab:u,openNewTabMenu:p,closeActiveTab:d,setLang:ye=>{x(ye)},setTheme:ye=>{_(ye)}}),[T,N,u,p,d,x,_]),ct=b.useCallback(()=>{const ye=n$(B);if(!ye)return!1;const _e=r$(ye.name);if(!_e)return!1;W(""),ue(0),pe(!1),H.current&&(H.current.style.height="auto");try{_e.handler(Bt,ye.args)}catch(Pe){const ee=Pe instanceof Error?Pe.message:String(Pe);N(`Command "/${_e.name}" failed: ${ee}`)}return!0},[B,Bt,W,H,N]),Mt=b.useCallback(ye=>{var Pe;const _e=$e[ye];if(_e)if(_e.args)W(`/${_e.name} `),ue(0),(Pe=H.current)==null||Pe.focus();else{W(""),ue(0),H.current&&(H.current.style.height="auto");try{_e.handler(Bt,"")}catch(ee){const le=ee instanceof Error?ee.message:String(ee);N(`Command "/${_e.name}" failed: ${le}`)}}},[$e,Bt,W,H,N]),Tt=b.useCallback(ye=>{var ee;const Pe=Array.from(((ee=ye.clipboardData)==null?void 0:ee.items)??[]).filter(le=>le.kind==="file").map(le=>le.getAsFile()).filter(le=>le!==null);Pe.length>0&&(ye.preventDefault(),ge(Pe))},[ge]),Dt=b.useCallback(ye=>{var _e,Pe;ye.preventDefault(),(Pe=(_e=ye.dataTransfer)==null?void 0:_e.types)!=null&&Pe.includes("Files")&&re(!0)},[]),Re=b.useCallback(ye=>{ye.currentTarget===ye.target&&re(!1)},[]),et=b.useCallback(ye=>{var Pe;ye.preventDefault(),re(!1);const _e=(Pe=ye.dataTransfer)==null?void 0:Pe.files;_e&&_e.length>0&&ge(_e)},[ge]),bt=b.useCallback(async(ye,_e)=>{await Ja(_e)&&(X(ye),setTimeout(()=>X(Pe=>Pe===ye?null:Pe),1200))},[]),yt=b.useCallback((ye="auto")=>{var _e;(_e=U.current)==null||_e.scrollTo({top:U.current.scrollHeight,behavior:ye})},[]),O=b.useCallback(()=>{const ye=U.current;if(!ye)return;const _e=ye.scrollHeight-ye.scrollTop-ye.clientHeight<72;Ke.current=_e,ve(_e)},[]);b.useLayoutEffect(()=>{if(!l||!Ke.current)return;const ye=requestAnimationFrame(()=>{yt("auto")});return()=>cancelAnimationFrame(ye)},[S,$.length,yt,P,q,Y,l]),b.useEffect(()=>{if(!g||!l)return;Ke.current=!0,ve(!0);const ye=requestAnimationFrame(()=>yt("auto"));return()=>cancelAnimationFrame(ye)},[g,yt,l]),b.useEffect(()=>{if(!g||!l)return;const ye=setTimeout(()=>{var _e;return(_e=H.current)==null?void 0:_e.focus()},320);return()=>clearTimeout(ye)},[g,l,H]);const ke=b.useCallback(()=>{Y&&J==="steer"&&C.length===0&&Q()||D()},[C.length,D,J,Q,Y]),Le=Y||I.length>0||Z;return b.useEffect(()=>(f==null||f(e,Le),()=>f==null?void 0:f(e,!1)),[Le,f,e]),c.jsxs("div",{className:"min-h-0 flex-1 flex-col",style:{display:l?"flex":"none"},children:[Y&&c.jsx("div",{className:"h-[2px] overflow-hidden",style:{background:"var(--revka-bg-surface)"},children:c.jsx("div",{className:"h-full",style:{background:o.primary,width:"40%",animation:"revka-assistant-sweep 1.4s ease-in-out infinite alternate"}})}),E&&c.jsx("div",{className:"border-b px-4 py-2 text-xs",style:{borderColor:"rgba(255,107,122,0.2)",background:"rgba(255,107,122,0.06)",color:"var(--revka-status-danger)"},children:c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(tv,{className:"h-3 w-3 shrink-0"}),c.jsx("span",{children:E})]})}),c.jsxs("div",{className:"relative min-h-0 flex-1",children:[c.jsx("div",{ref:U,onScroll:O,className:"h-full overflow-y-auto overflow-x-hidden p-4 font-mono leading-6",style:{fontSize:`${a.fontSize}px`},children:c.jsx(Aue,{messages:$,typing:Y,activities:S,streamingContent:P,streamingThinking:q,copiedId:te,colors:o,fontSize:a.fontSize,placeholder:s,copyMessage:bt})}),!fe&&c.jsx("button",{type:"button",onClick:()=>{Ke.current=!0,ve(!0),yt("smooth")},className:"absolute bottom-3 right-4 z-10 rounded border px-2 py-1 font-mono text-[10px] uppercase shadow-lg transition-colors hover:bg-white/5 focus:outline-none focus-visible:ring-1 focus-visible:ring-current",style:{borderColor:"var(--revka-border-soft)",background:"var(--revka-bg-surface)",color:o.primary,textShadow:o.glow},children:v("agent.jump_to_latest")})]}),c.jsxs("div",{ref:ie,className:"relative border-t px-4 py-3",style:{borderColor:"var(--revka-border-soft)"},onDragEnter:Dt,onDragOver:ye=>{var _e,Pe;ye.preventDefault(),(Pe=(_e=ye.dataTransfer)==null?void 0:_e.types)!=null&&Pe.includes("Files")&&re(!0)},onDragLeave:Re,onDrop:et,children:[c.jsx("input",{ref:V,type:"file",multiple:!0,className:"hidden",onChange:ye=>{const _e=ye.target.files;_e&&_e.length>0&&ge(_e),ye.target.value=""}}),(C.length>0||R>0)&&c.jsxs("div",{className:"mb-2 flex flex-wrap gap-1.5",children:[C.map(ye=>c.jsx(Xre,{attachment:ye,onRemove:z,accent:o.secondary},ye.file_id)),R>0&&c.jsxs("span",{className:"inline-flex items-center gap-1.5 rounded-md border px-2 py-1 text-[10px]",style:{borderColor:"var(--revka-border-soft)",background:"var(--revka-bg-surface)",color:"var(--revka-text-faint)"},children:[c.jsx(Rr,{className:"h-3 w-3 animate-spin"}),"uploading ",R,"…"]})]}),c.jsxs("div",{className:"flex items-end gap-2 rounded-md border px-2 py-1.5 transition-colors",style:{borderColor:se?o.primary:"var(--revka-border-soft)",background:se?"color-mix(in srgb, var(--revka-bg-surface) 85%, transparent)":"transparent",color:o.primary},children:[c.jsx("button",{type:"button",onClick:Ue,disabled:!A,"aria-label":"Attach files",title:"Attach files",className:"inline-flex h-7 w-7 shrink-0 items-center justify-center rounded transition-all hover:bg-white/5 focus:outline-none focus-visible:ring-2 focus-visible:ring-current disabled:cursor-not-allowed disabled:opacity-30",style:{color:"var(--revka-text-muted)"},children:c.jsx(bJ,{className:"h-3.5 w-3.5"})}),c.jsxs("span",{className:"shrink-0 pb-[3px] font-mono text-sm font-semibold",style:{color:o.primary,textShadow:o.glow},children:[">",c.jsx("span",{className:a.cursorBlink?"revka-cursor-blink":"",children:"_"})]}),c.jsx("textarea",{ref:H,rows:1,value:B,onChange:F,onKeyDown:ye=>{if($e.length>0){if(ye.key==="ArrowDown"){ye.preventDefault(),ue(Pe=>(Pe+1)%$e.length);return}if(ye.key==="ArrowUp"){ye.preventDefault(),ue(Pe=>(Pe-1+$e.length)%$e.length);return}if(ye.key==="Tab"){ye.preventDefault(),Mt(de);return}if(ye.key==="Escape"){ye.preventDefault(),pe(!0);return}if(ye.key==="Enter"&&!ye.shiftKey){ye.preventDefault(),Mt(de);return}}if(ye.key==="Enter"&&!ye.shiftKey){if(ye.preventDefault(),ct())return;ke()}},onPaste:Tt,placeholder:v(A?Y?J==="steer"?"agent.placeholder_steer_next_step":"agent.placeholder_queue_next":"agent.placeholder_message":"agent.placeholder_connecting"),disabled:!A,className:"min-h-[1.75rem] min-w-0 flex-1 resize-none bg-transparent font-mono outline-none focus:outline-none focus-visible:outline-none disabled:opacity-50",style:{color:"var(--revka-text-primary)",caretColor:o.cursorColor,maxHeight:"6rem",fontSize:`${Math.max(16,a.fontSize)}px`}}),Y&&c.jsxs("div",{className:"flex h-7 shrink-0 items-center overflow-hidden rounded border",style:{borderColor:"var(--revka-border-soft)"},"aria-label":v("agent.send_mode"),children:[c.jsxs("button",{type:"button",onClick:()=>me("queue"),title:v("agent.queue_after_current_response"),className:"inline-flex h-full items-center gap-1 px-1.5 font-mono text-[10px] uppercase transition-colors hover:bg-white/5 focus:outline-none focus-visible:ring-1 focus-visible:ring-current",style:{background:J==="queue"?"color-mix(in srgb, var(--revka-bg-surface) 88%, transparent)":"transparent",color:J==="queue"?o.secondary:"var(--revka-text-faint)",textShadow:J==="queue"?o.glowSecondary:"none"},children:[c.jsx(yJ,{className:"h-3 w-3"}),v("agent.send_mode_queue")]}),c.jsxs("button",{type:"button",onClick:()=>me("steer"),title:C.length>0?v("agent.steer_text_only"):v("agent.steer_next_step"),disabled:C.length>0||R>0,className:"inline-flex h-full items-center gap-1 border-l px-1.5 font-mono text-[10px] uppercase transition-colors hover:bg-white/5 focus:outline-none focus-visible:ring-1 focus-visible:ring-current disabled:cursor-not-allowed disabled:opacity-35",style:{borderColor:"var(--revka-border-soft)",background:J==="steer"?"color-mix(in srgb, var(--revka-bg-surface) 88%, transparent)":"transparent",color:J==="steer"?o.primary:"var(--revka-text-faint)",textShadow:J==="steer"?o.glow:"none"},children:[c.jsx(xd,{className:"h-3 w-3"}),v("agent.send_mode_steer")]})]}),Y&&c.jsx("button",{type:"button",onClick:K,disabled:!A||Z,"aria-label":Z?"Stopping Operator":"Stop Operator",title:Z?"Stopping…":"Stop current response",className:"inline-flex h-7 w-7 shrink-0 items-center justify-center rounded transition-all hover:bg-white/5 focus:outline-none focus-visible:ring-2 focus-visible:ring-current disabled:cursor-not-allowed disabled:opacity-30",style:{color:Z?"var(--revka-text-faint)":"var(--revka-status-danger)"},children:Z?c.jsx(Rr,{className:"h-3.5 w-3.5 animate-spin"}):c.jsx(MJ,{className:"h-3.5 w-3.5"})}),c.jsx("button",{type:"button",onClick:ke,disabled:!A||!B.trim()&&C.length===0||R>0,"aria-label":Y&&J==="steer"&&C.length===0?v("agent.steer_next_step"):v(Y?"agent.queue_message":"agent.send_message"),title:A?Y?J==="steer"&&C.length===0?v("agent.steer_next_step"):v("agent.queue_after_current_response"):v("agent.send_enter"):v("agent.disconnected"),className:"inline-flex h-7 w-7 shrink-0 items-center justify-center rounded transition-all hover:bg-white/5 focus:outline-none focus-visible:ring-2 focus-visible:ring-current disabled:cursor-not-allowed disabled:opacity-30",style:{color:(B.trim()||C.length>0)&&A&&R===0&&!Y?o.primary:(B.trim()||C.length>0)&&A&&R===0&&Y?o.secondary:"var(--revka-text-faint)",textShadow:(B.trim()||C.length>0)&&A&&R===0&&!Y?o.glow:(B.trim()||C.length>0)&&A&&R===0&&Y?o.glowSecondary:"none"},children:c.jsx(_E,{className:"h-3.5 w-3.5"})})]}),se&&c.jsx("div",{className:"pointer-events-none absolute inset-2 flex items-center justify-center rounded-md border-2 border-dashed text-xs",style:{borderColor:o.primary,background:"color-mix(in srgb, var(--revka-bg-base) 70%, transparent)",color:o.primary,textShadow:o.glow},children:"drop files to attach"}),c.jsxs("div",{className:"mt-2 flex items-center gap-3",children:[c.jsxs("span",{className:"flex shrink-0 items-center gap-1.5 text-[10px] font-semibold uppercase tracking-[0.12em]",style:{color:"var(--revka-text-faint)"},children:[c.jsx("span",{className:"inline-block h-1.5 w-1.5 rounded-full",style:{background:A?"var(--revka-status-success)":"var(--revka-status-danger)"}}),A?"live":"offline"]}),Y&&c.jsxs("span",{className:"flex shrink-0 items-center gap-1.5 text-[10px] font-semibold uppercase tracking-[0.12em]",style:{color:o.primary,textShadow:o.glow},children:[c.jsx(Rr,{className:"h-3 w-3 animate-spin"}),"Operator is responding…"]}),I.length>0&&c.jsxs("span",{className:"flex shrink-0 items-center gap-1.5 text-[10px] font-semibold uppercase tracking-[0.12em]",style:{color:o.secondary,textShadow:o.glowSecondary},children:[I.length," queued"]}),c.jsx("span",{className:"min-w-0 flex-1 truncate text-[10px]",style:{color:"var(--revka-text-faint)"},title:i,children:i})]}),c.jsx(J9,{anchorRef:ie,matches:$e,selectedIndex:de,onPick:Mt})]})]})}function Tue({anchorRef:e,onSelect:n,onClose:r}){const i=b.useRef(null),[s,a]=b.useState(null);return b.useLayoutEffect(()=>{const o=()=>{var u;const l=(u=e.current)==null?void 0:u.getBoundingClientRect();l&&a({top:l.bottom+4,left:l.left})};return o(),window.addEventListener("resize",o),window.addEventListener("scroll",o,!0),()=>{window.removeEventListener("resize",o),window.removeEventListener("scroll",o,!0)}},[e]),b.useEffect(()=>{const o=l=>{const u=l.target;i.current&&i.current.contains(u)||e.current&&e.current.contains(u)||r()};return document.addEventListener("mousedown",o),()=>document.removeEventListener("mousedown",o)},[e,r]),s?na.createPortal(c.jsxs("div",{ref:i,className:"fixed z-[200] rounded-[8px] border py-1 shadow-lg",style:{top:s.top,left:s.left,background:"var(--revka-bg-panel-strong)",borderColor:"var(--revka-border-strong)",minWidth:"10rem"},children:[c.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 px-3 py-1.5 text-left text-xs transition-colors hover:bg-white/5",style:{color:"var(--revka-text-secondary)"},onClick:()=>{n("chat"),r()},children:[c.jsx(fg,{className:"h-3.5 w-3.5"}),"New Chat"]}),c.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 px-3 py-1.5 text-left text-xs transition-colors hover:bg-white/5",style:{color:"var(--revka-text-secondary)"},onClick:()=>{n("terminal"),r()},children:[c.jsx(av,{className:"h-3.5 w-3.5"}),"New Terminal"]}),c.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 px-3 py-1.5 text-left text-xs transition-colors hover:bg-white/5",style:{color:"var(--revka-text-secondary)"},onClick:()=>{n("code"),r()},children:[c.jsx(SB,{className:"h-3.5 w-3.5"}),"New Code"]})]}),document.body):null}function Mue(){var pe;const e=is(),{open:n,closeAssistant:r,pageContextOverride:i,placeholderOverride:s}=xE(),{config:a,colors:o,updateConfig:l}=fee(),u=YB[e.pathname],d=i??`v2:${bue(e.pathname)||"dashboard"}`,p=s??`Ask about ${((pe=u==null?void 0:u.title)==null?void 0:pe.toLowerCase())??"this workspace"}.`,f=b.useRef(null);f.current===null&&(f.current=kue());const[g,_]=b.useState(()=>f.current.tabs),[x,v]=b.useState(()=>f.current.activeTabId??"chat-main"),[S,w]=b.useState(!1),N=b.useRef(null),[C,T]=b.useState(!1),[A,E]=b.useState(n),[D,F]=b.useState(null),[B,H]=b.useState("vertical"),[$,z]=b.useState(()=>new Set),[W,P]=b.useState(null),[q,I]=b.useState("");b.useEffect(()=>{Cue(g,x)},[g,x]),b.useEffect(()=>{var J;g.length>0&&g.some(me=>me.id===x)||v(((J=g[0])==null?void 0:J.id)??"chat-main")},[g,x]),b.useEffect(()=>{let J=!1;return(async()=>{try{const{sessions:me,archivedSessionIds:fe}=await dB();if(J)return;const ve=new Set([...fe,...l$()]),Ke=me.filter(Ue=>Ue.channel==="dashboard"||Ue.channel==="gateway").filter(Ue=>!ve.has(Ue.id)).filter(Ue=>Ue.message_count>0).sort((Ue,$e)=>new Date($e.last_activity).getTime()-new Date(Ue.last_activity).getTime()).slice(0,o$),ge=new Set(Ke.map(Ue=>Ue.id));_(Ue=>{const $e=Ue.filter(Tt=>Tt.type!=="chat"||!ve.has(Tt.sessionId)&&(Tt.id===x||Tt.sessionId===i$||ge.has(Tt.sessionId))),Bt=new Set($e.filter(Tt=>Tt.type==="chat").map(Tt=>Tt.sessionId)),ct=Ke.filter(Tt=>!Bt.has(Tt.id)).map((Tt,Dt)=>({id:`chat-${Tt.id}`,type:"chat",title:Tt.name||(Dt===0?"Chat":`Chat ${Dt+1}`),sessionId:Tt.id})),Mt=ct.length>0?[...$e,...ct]:$e;return Mt.length>0?Mt:[q4()]})}catch{}})(),()=>{J=!0}},[]),b.useEffect(()=>{if(!n)return;const J=me=>{me.key==="Escape"&&r()};return window.addEventListener("keydown",J),()=>window.removeEventListener("keydown",J)},[n,r]),b.useEffect(()=>{n&&E(!0)},[n]);const Q=b.useCallback(J=>{const me=cr();_(fe=>{const ve=fe.filter(Ue=>Ue.type===J).length;let Ke;J==="chat"?Ke=`Chat ${ve+1}`:J==="terminal"?Ke=`Terminal ${ve+1}`:Ke="Code";const ge={id:me,type:J,title:Ke,sessionId:cr(),codeSession:J==="code"?null:void 0};return[...fe,ge]}),v(me)},[]),K=b.useCallback((J,me)=>{_(fe=>fe.map(ve=>ve.id===J?{...ve,...me}:ve))},[]),Z=b.useCallback(async J=>{const me=q.trim();if(P(null),!me||me===J.title){I("");return}const fe=J.title;if(K(J.id,{title:me}),I(""),J.type==="chat"&&J.sessionId)try{await EQ(J.sessionId,me)}catch(ve){K(J.id,{title:fe}),console.error("Rename failed:",ve)}},[q,K]),Y=b.useCallback(()=>{P(null),I("")},[]),R=b.useCallback(J=>(me,fe,ve)=>{K(J,{codeSession:me,title:`${vg(me.toolKey)} · ${Vz(ve)}`})},[K]),U=b.useCallback(J=>()=>{K(J,{codeSession:null,title:"Code"})},[K]),V=b.useCallback(J=>(me,fe)=>{K(J,{type:"chat",title:fe,sessionId:cr(),codeSession:void 0,pageContextOverride:me})},[K]),ie=b.useCallback(J=>{const me=g.find(fe=>fe.id===J);(me==null?void 0:me.type)==="chat"&&(Sue(me.sessionId),NQ(me.sessionId).catch(()=>{})),_(fe=>{const ve=fe.filter(Ke=>Ke.id!==J);return ve.length===0?[q4()]:ve}),v(fe=>{if(fe!==J)return fe;const ve=g.findIndex(ge=>ge.id===J),Ke=g.filter(ge=>ge.id!==J);return Ke.length===0?"chat-main":Ke[Math.min(ve,Ke.length-1)].id}),F(fe=>fe===J?null:fe),z(fe=>{if(!fe.has(J))return fe;const ve=new Set(fe);return ve.delete(J),ve})},[g]),te=b.useCallback(()=>{if(D){H(me=>me==="vertical"?"horizontal":"vertical");return}const J=cr();_(me=>{const fe=me.filter(Ke=>Ke.type==="chat").length,ve={id:J,type:"chat",title:`Chat ${fe+1}`,sessionId:cr()};return[...me,ve]}),F(J)},[D]),X=b.useCallback(()=>{F(null)},[]),se=b.useCallback((J,me)=>{z(fe=>{if(fe.has(J)===me)return fe;const ve=new Set(fe);return me?ve.add(J):ve.delete(J),ve})},[]),re=g.find(J=>J.id===x)??null,de=D?g.find(J=>J.id===D)??null:null,ue=(re==null?void 0:re.type)==="chat"&&(de==null?void 0:de.type)==="chat"&&re.id!==de.id,ae=`${a.panelHeightPercent}vh`;return c.jsxs(c.Fragment,{children:[n&&c.jsx("div",{className:"absolute inset-0 z-[50]",style:{background:"rgba(0,0,0,0.25)"},onClick:r}),c.jsxs("div",{className:"absolute inset-x-0 top-0 z-[60] flex min-w-0 flex-col overflow-hidden border-b border-l border-r",style:{height:n?ae:"0px",maxHeight:n?"90vh":"0px",opacity:n?a.panelOpacity:0,transform:n?"translateY(0)":"translateY(-0.75rem)",transition:"height 300ms ease-out, max-height 300ms ease-out, opacity 200ms ease-out, transform 300ms ease-out",borderColor:n?"var(--revka-border-strong)":"transparent",background:"var(--revka-bg-base)",boxShadow:n?"var(--revka-shadow-overlay)":"none",pointerEvents:n?"auto":"none",borderRadius:"0 0 14px 14px"},children:[c.jsx("div",{className:"pointer-events-none absolute inset-0 z-[5]",style:{background:"repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(125,255,155,0.012) 2px, rgba(125,255,155,0.012) 4px)",mixBlendMode:"overlay"}}),c.jsxs("div",{className:"relative z-20 flex items-center border-b",style:{borderColor:"var(--revka-border-soft)",background:"var(--revka-bg-surface)"},children:[c.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-0.5 overflow-x-auto px-2 py-1 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:[g.map(J=>{const me=x===J.id,fe=W===J.id;return c.jsxs("button",{type:"button",className:"group flex shrink-0 items-center gap-1.5 px-2.5 py-1.5 font-mono text-[11px] transition-colors",onClick:()=>v(J.id),onDoubleClick:ve=>{J.type==="chat"&&(ve.stopPropagation(),P(J.id),I(J.title))},title:J.type==="chat"?"Double-click to rename":void 0,style:{background:me?o.primary+"18":"transparent",color:me?o.primary:"var(--revka-text-muted)",textShadow:me?o.glow:"none",borderBottom:me?`2px solid ${o.primary}`:"2px solid transparent"},children:[J.type==="terminal"?c.jsx(av,{className:"h-3 w-3"}):J.type==="code"?c.jsx(SB,{className:"h-3 w-3"}):c.jsx(fg,{className:"h-3 w-3"}),fe?c.jsx("input",{value:q,onChange:ve=>I(ve.target.value),onClick:ve=>ve.stopPropagation(),onBlur:()=>Z(J),onKeyDown:ve=>{ve.key==="Enter"?(ve.preventDefault(),Z(J)):ve.key==="Escape"&&(ve.preventDefault(),Y())},autoFocus:!0,maxLength:64,style:{background:"transparent",border:"none",outline:"none",color:"inherit",font:"inherit",width:"min(180px, 100%)",padding:0}}):c.jsx(c.Fragment,{children:J.title}),g.length>1&&c.jsx("span",{className:"ml-0.5 p-0.5 opacity-0 transition-opacity hover:bg-white/10 group-hover:opacity-100",onClick:ve=>{ve.stopPropagation(),ie(J.id)},role:"button",tabIndex:-1,children:c.jsx(mi,{className:"h-2.5 w-2.5"})})]},J.id)}),c.jsxs("div",{className:"shrink-0",children:[c.jsxs("button",{ref:N,type:"button",className:"flex items-center gap-0.5 p-1.5 transition-colors hover:bg-white/5",onClick:()=>w(J=>!J),style:{color:"var(--revka-text-faint)"},title:"New tab",children:[c.jsx(rs,{className:"h-3 w-3"}),c.jsx(qo,{className:"h-2.5 w-2.5"})]}),S&&c.jsx(Tue,{anchorRef:N,onSelect:Q,onClose:()=>w(!1)})]})]}),c.jsxs("div",{className:"flex shrink-0 items-center px-1",children:[(re==null?void 0:re.type)==="chat"&&c.jsxs(c.Fragment,{children:[c.jsx("button",{type:"button",className:"p-1.5 transition-colors hover:bg-white/5",onClick:te,style:{color:ue?o.primary:"var(--revka-text-faint)"},title:ue?`Switch split: ${B==="vertical"?"side-by-side":"stacked"} → ${B==="vertical"?"stacked":"side-by-side"}`:"Split chat (new chat tab side-by-side)",children:ue?B==="vertical"?c.jsx(sJ,{className:"h-3.5 w-3.5"}):c.jsx(NJ,{className:"h-3.5 w-3.5"}):c.jsx(TJ,{className:"h-3.5 w-3.5"})}),ue&&c.jsx("button",{type:"button",className:"p-1.5 transition-colors hover:bg-white/5",onClick:X,style:{color:"var(--revka-text-faint)"},title:"Close split",children:c.jsx(mi,{className:"h-3.5 w-3.5"})})]}),c.jsx("button",{type:"button",className:"p-1.5 transition-colors hover:bg-white/5",onClick:()=>T(J=>!J),style:{color:C?o.primary:"var(--revka-text-faint)"},title:"Settings",children:c.jsx(i0,{className:"h-3.5 w-3.5"})}),c.jsx("button",{type:"button",className:"p-1.5 transition-colors hover:bg-white/5",onClick:r,style:{color:"var(--revka-text-faint)"},title:"Dismiss (Esc)",children:c.jsx(QZ,{className:"h-3.5 w-3.5"})})]})]}),C&&c.jsx(jue,{config:a,updateConfig:l}),A&&c.jsxs("div",{className:"relative z-10 flex min-h-0 flex-1 flex-col",children:[g.filter(J=>J.type==="terminal").map(J=>c.jsx(Ore,{sessionId:J.sessionId,config:a,colors:o,visible:x===J.id},J.id)),g.filter(J=>J.type==="code").map(J=>c.jsx(Vre,{tabId:J.id,config:a,colors:o,visible:x===J.id,session:J.codeSession??null,onSessionStart:R(J.id),onSessionEnd:U(J.id),onDelegateToChat:V(J.id)},J.id)),ue?c.jsx("div",{className:"flex min-h-0 flex-1",style:{flexDirection:B==="vertical"?"row":"column"},children:g.filter(J=>J.type==="chat").map(J=>{const me=J.id===x||J.id===D;return n&&me||$.has(J.id)?c.jsx("div",{className:"flex min-h-0 min-w-0",style:{flex:me?"1 1 50%":"0 0 0",borderLeft:me&&B==="vertical"&&J.id===D?"1px solid var(--revka-border-soft)":void 0,borderTop:me&&B==="horizontal"&&J.id===D?"1px solid var(--revka-border-soft)":void 0},children:c.jsx(U4,{tabId:J.id,sessionId:J.sessionId,sessionName:J.title,pageContext:J.pageContextOverride??d,placeholder:p,config:a,colors:o,visible:n&&me,onAddTab:Q,onCloseActiveTab:()=>ie(J.id),onOpenNewTabMenu:()=>w(!0),onLiveStateChange:se})},J.id):null})}):g.filter(J=>J.type==="chat").map(J=>{const me=x===J.id;return n&&me||$.has(J.id)?c.jsx(U4,{tabId:J.id,sessionId:J.sessionId,sessionName:J.title,pageContext:J.pageContextOverride??d,placeholder:p,config:a,colors:o,visible:n&&me,onAddTab:Q,onCloseActiveTab:()=>ie(J.id),onOpenNewTabMenu:()=>w(!0),onLiveStateChange:se},J.id):null})]})]}),c.jsx("style",{children:`
        @keyframes revka-assistant-sweep {
          from { transform: translateX(-10%); }
          to   { transform: translateX(160%); }
        }
        @keyframes revka-cursor-blink-anim {
          0%, 49% { opacity: 1; }
          50%, 100% { opacity: 0; }
        }
        .revka-cursor-blink {
          animation: revka-cursor-blink-anim 1s step-end infinite;
        }
      `})]})}const sj="2026.6.27",Rue=1e3,Oue=3e4;class pv{constructor(n={}){$n(this,"controller",null);$n(this,"reconnectTimer",null);$n(this,"currentDelay");$n(this,"intentionallyClosed",!1);$n(this,"onEvent",null);$n(this,"onError",null);$n(this,"onConnect",null);$n(this,"path");$n(this,"reconnectDelay");$n(this,"maxReconnectDelay");$n(this,"autoReconnect");this.path=n.path??`${Ti}${Gr}/api/events`,this.reconnectDelay=n.reconnectDelay??Rue,this.maxReconnectDelay=n.maxReconnectDelay??Oue,this.autoReconnect=n.autoReconnect??!0,this.currentDelay=this.reconnectDelay}connect(){this.intentionallyClosed=!1,this.clearReconnectTimer(),this.controller=new AbortController;const n=ns(),r={Accept:"text/event-stream"};n&&(r.Authorization=`Bearer ${n}`),fetch(this.path,{headers:r,signal:this.controller.signal}).then(i=>{var s;if(!i.ok)throw new Error(`SSE connection failed: ${i.status}`);if(!i.body)throw new Error("SSE response has no body");return this.currentDelay=this.reconnectDelay,(s=this.onConnect)==null||s.call(this),this.consumeStream(i.body)}).catch(i=>{var s;i instanceof DOMException&&i.name==="AbortError"||((s=this.onError)==null||s.call(this,i instanceof Error?i:new Error(String(i))),this.scheduleReconnect())})}reconnectNow(){this.clearReconnectTimer(),this.controller&&(this.controller.abort(),this.controller=null),this.currentDelay=this.reconnectDelay,this.connect()}disconnect(){this.intentionallyClosed=!0,this.clearReconnectTimer(),this.controller&&(this.controller.abort(),this.controller=null)}async consumeStream(n){var a;const r=n.getReader(),i=new TextDecoder;let s="";try{for(;;){const{done:o,value:l}=await r.read();if(o)break;s+=i.decode(l,{stream:!0});const u=s.split(`

`);s=u.pop()??"";for(const d of u)this.parseEvent(d)}}catch(o){if(o instanceof DOMException&&o.name==="AbortError")return;(a=this.onError)==null||a.call(this,o instanceof Error?o:new Error(String(o)))}finally{r.releaseLock()}this.scheduleReconnect()}parseEvent(n){var o;let r="message";const i=[];for(const l of n.split(`
`))l.startsWith("event:")?r=l.slice(6).trim():l.startsWith("data:")&&i.push(l.slice(5).trim());if(i.length===0)return;const s=i.join(`
`);let a;try{a=JSON.parse(s),a.type=a.type??r}catch{a={type:r,data:s}}(o=this.onEvent)==null||o.call(this,a)}scheduleReconnect(){this.intentionallyClosed||!this.autoReconnect||(this.reconnectTimer=setTimeout(()=>{this.currentDelay=Math.min(this.currentDelay*2,this.maxReconnectDelay),this.connect()},this.currentDelay))}clearReconnectTimer(){this.reconnectTimer!==null&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null)}}const c$="revka-pending-approvals-v1",u$=b.createContext({pending:[],toasts:[],dismissToast:()=>{},dismiss:()=>{}}),ZE=()=>b.useContext(u$);function Due(){try{const e=sessionStorage.getItem(c$);if(e){const n=JSON.parse(e);if(Array.isArray(n))return n}}catch{}return[]}function Pue(e){try{sessionStorage.setItem(c$,JSON.stringify(e))}catch{}}function Lue({children:e}){const[n,r]=b.useState(Due),[i,s]=b.useState([]),a=b.useRef(0);b.useEffect(()=>{Pue(n)},[n]);const o=b.useCallback(d=>{s(p=>p.filter(f=>f.toastId!==d))},[]),l=b.useCallback(d=>{d&&(r(p=>p.filter(f=>f.runId!==d)),s(p=>p.filter(f=>f.runId!==d)))},[]);b.useEffect(()=>{const d=new pv;return d.onEvent=p=>{if(p.type==="human_approval_request"){const f={runId:String(p.run_id??""),stepId:String(p.step_id??""),workflowName:String(p.workflow_name??""),title:String(p.title??"Human approval needed"),message:String(p.message??""),timestamp:String(p.timestamp??new Date().toISOString())};if(!f.runId)return;r(_=>_.some(x=>x.runId===f.runId&&x.stepId===f.stepId)?_:[..._,f]);const g=++a.current;s(_=>[..._,{...f,toastId:g}]),setTimeout(()=>{s(_=>_.filter(x=>x.toastId!==g))},8e3);return}if(p.type==="human_approval_resolved"){const f=String(p.run_id??"");if(!f)return;r(g=>g.filter(_=>_.runId!==f));return}},d.connect(),()=>d.disconnect()},[]);const u=b.useMemo(()=>({pending:n,toasts:i,dismissToast:o,dismiss:l}),[n,i,o,l]);return c.jsx(u$.Provider,{value:u,children:e})}function V4(){const{pending:e}=ZE(),[n,r]=b.useState(!1),i=b.useRef(null);return b.useEffect(()=>{if(!n)return;const s=a=>{i.current&&!i.current.contains(a.target)&&r(!1)};return document.addEventListener("mousedown",s),()=>document.removeEventListener("mousedown",s)},[n]),e.length===0?null:c.jsxs("div",{className:"relative",ref:i,children:[c.jsxs("button",{type:"button",className:"revka-button relative px-2 py-1 text-xs",style:{background:"var(--revka-signal-live-soft)",color:"var(--revka-signal-live)",borderColor:"var(--revka-signal-live)"},onClick:()=>r(s=>!s),"aria-label":`${e.length} pending approval${e.length===1?"":"s"}`,title:`${e.length} pending approval${e.length===1?"":"s"}`,children:[c.jsx(s0,{className:"h-4 w-4"}),c.jsx("span",{className:"ml-1 font-semibold tabular-nums",children:e.length})]}),n?c.jsxs("div",{className:"revka-panel absolute right-0 z-40 mt-2 w-80 p-2 shadow-lg",style:{background:"var(--revka-surface-raised, var(--revka-surface))"},children:[c.jsx("div",{className:"revka-kicker mb-1 px-1 text-[10px]",children:"Pending approvals"}),c.jsx("ul",{className:"max-h-80 space-y-1 overflow-auto",children:e.map(s=>c.jsx("li",{children:c.jsxs(bs,{to:`/runs?run=${encodeURIComponent(s.runId)}`,className:"flex flex-col rounded px-2 py-1.5 text-xs hover:bg-[var(--revka-surface-hover,rgba(255,255,255,0.04))]",onClick:()=>r(!1),children:[c.jsx("span",{className:"font-medium truncate",children:s.workflowName||s.title||"Workflow"}),c.jsx("span",{className:"truncate",style:{color:"var(--revka-text-secondary)"},children:s.message||`Step ${s.stepId}`})]})},`${s.runId}:${s.stepId}`))})]}):null]})}function Iue(){const{locale:e,setLocale:n}=cn();return c.jsxs("label",{className:"revka-status-pill relative cursor-pointer",title:"Language",children:[c.jsx(mJ,{className:"h-3.5 w-3.5"}),c.jsx("select",{"aria-label":"Language",value:e,onChange:r=>n(r.target.value),className:"bg-transparent text-xs font-medium focus:outline-none",style:{color:"inherit"},children:WB.map(r=>c.jsx("option",{value:r.code,style:{color:"#111"},children:r.label},r.code))})]})}function Bue({onOpenMobileNav:e}){const n=is(),{theme:r,resolvedTheme:i,setTheme:s,activeSkinName:a}=Ta(),{open:o,toggleAssistant:l}=xE(),{t:u}=cn(),d=YB[n.pathname],p=d?u(d.titleKey):"Revka",[f,g]=b.useState(null);return b.useEffect(()=>{let _=!1;const x=()=>{Dx().then(S=>{_||g(S)}).catch(S=>{_||g({verified:!1,error:S instanceof Error?S.message:String(S)})})};x();const v=window.setInterval(x,6e4);return()=>{_=!0,window.clearInterval(v)}},[]),c.jsx("header",{className:"px-4 py-3 lg:px-6 lg:py-4",children:c.jsxs("div",{className:"revka-panel revka-header-panel p-3 lg:p-4",children:[c.jsxs("div",{className:"flex items-center gap-2 lg:hidden",children:[c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsxs("div",{className:"revka-kicker text-[10px]",children:["Revka v",sj]}),c.jsx("h1",{className:"revka-title mt-0.5 truncate text-lg",children:p})]}),a?c.jsxs("span",{className:"revka-status-pill max-w-[8rem] truncate px-2 py-1 text-[10px]",title:a,children:[c.jsx(oC,{className:"h-3.5 w-3.5 shrink-0"}),c.jsx("span",{className:"truncate",children:a})]}):null,c.jsx(V4,{}),c.jsx("button",{type:"button",className:"revka-button px-2 py-1 text-xs",onClick:()=>s(r==="dark"?"light":r==="light"?"system":"dark"),"aria-label":`Theme: ${r}. Tap to cycle.`,title:`Theme: ${r==="system"?`system (${i})`:r}`,children:r==="dark"?c.jsx(U3,{className:"h-4 w-4"}):r==="light"?c.jsx(V3,{className:"h-4 w-4"}):c.jsx(q3,{className:"h-4 w-4"})}),c.jsx("button",{type:"button",className:"revka-button px-2 py-1 text-xs",onClick:l,"aria-label":"Toggle operator",style:o?{background:"var(--revka-signal-selected-soft, color-mix(in srgb, var(--revka-signal-selected) 18%, transparent))",color:"var(--revka-signal-selected)",borderColor:"var(--revka-signal-selected)"}:void 0,children:c.jsx(fg,{className:"h-4 w-4"})}),e?c.jsx("button",{type:"button",className:"revka-sidebar-collapse-btn",onClick:e,"aria-label":"Open navigation",title:"Open navigation",children:c.jsx(xJ,{className:"h-4 w-4"})}):null]}),c.jsxs("div",{className:"hidden flex-col gap-4 lg:flex lg:flex-row lg:items-center lg:justify-between",children:[c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsxs("div",{className:"revka-kicker text-[10px]",children:["Revka v",sj]}),c.jsx("h1",{className:"revka-title mt-1 truncate text-2xl",children:p})]}),c.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[c.jsx(V4,{}),a?c.jsxs("span",{className:"revka-status-pill max-w-[14rem]",title:a,children:[c.jsx(oC,{className:"h-3.5 w-3.5 shrink-0"}),c.jsx("span",{className:"truncate",children:a})]}):null,c.jsxs("span",{className:"revka-status-pill",title:f===null?u("header.trust_checking"):f.verified?`${u("header.runtime_healthy")} · ${u("header.trust_verified")}`:f.error??u("header.trust_unverified"),style:f!=null&&f.verified?{color:"var(--revka-status-success)",borderColor:"color-mix(in srgb, var(--revka-status-success) 26%, transparent)",background:"color-mix(in srgb, var(--revka-status-success) 6%, transparent)"}:f&&!f.verified?{color:"var(--revka-status-warning)",borderColor:"color-mix(in srgb, var(--revka-status-warning) 40%, transparent)",background:"color-mix(in srgb, var(--revka-status-warning) 10%, transparent)"}:void 0,children:[c.jsx("span",{className:"revka-dot",style:{background:(f==null?void 0:f.verified)===!1?"var(--revka-status-warning)":"var(--revka-status-success)"}}),f===null?c.jsx(Rr,{className:"h-3.5 w-3.5 animate-spin"}):f.verified?c.jsx(sv,{className:"h-3.5 w-3.5"}):c.jsx(s0,{className:"h-3.5 w-3.5"}),f!=null&&f.verified?u("header.trust_verified"):f&&!f.verified?u("header.trust_unverified"):u("header.trust_checking")]}),c.jsx(Iue,{}),c.jsxs("div",{className:"revka-theme-toggle",role:"group","aria-label":u("theme.mode"),children:[c.jsx("button",{type:"button",className:"revka-theme-toggle-button","data-active":String(r==="dark"),onClick:()=>s("dark"),title:u("theme.dark"),"aria-label":u("theme.dark"),children:c.jsx(U3,{className:"h-4 w-4"})}),c.jsx("button",{type:"button",className:"revka-theme-toggle-button","data-active":String(r==="light"),onClick:()=>s("light"),title:u("theme.light"),"aria-label":u("theme.light"),children:c.jsx(V3,{className:"h-4 w-4"})}),c.jsx("button",{type:"button",className:"revka-theme-toggle-button","data-active":String(r==="system"),onClick:()=>s("system"),title:u("theme.system"),"aria-label":u("theme.system"),children:c.jsx(q3,{className:"h-4 w-4"})})]}),c.jsxs("button",{type:"button",className:"revka-button text-sm",onClick:l,style:o?{background:"var(--revka-signal-selected-soft, color-mix(in srgb, var(--revka-signal-selected) 18%, transparent))",color:"var(--revka-signal-selected)",borderColor:"var(--revka-signal-selected)"}:void 0,children:[c.jsx(fg,{className:"h-4 w-4"}),u("header.operator")]})]})]})]})})}const Qw=id("revka-icon.png"),d$="revka-sidebar-collapsed";function zue(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(d$)==="1"}catch{return!1}}function $ue({mobileOpen:e=!1,onCloseMobile:n}){const[r,i]=b.useState(zue),{t:s}=cn(),{getSkinAsset:a}=Ta(),o=a("brandLogo")??Qw;b.useEffect(()=>{try{window.localStorage.setItem(d$,r?"1":"0")}catch{}},[r]);const l=r?"4.5rem":"var(--revka-shell-width)";return c.jsxs(c.Fragment,{children:[e?c.jsx("div",{className:"fixed inset-0 z-40 lg:hidden",style:{background:"rgba(0,0,0,0.55)"},onClick:n,"aria-hidden":"true"}):null,c.jsxs("aside",{className:`revka-sidebar fixed inset-y-0 left-0 z-50 flex flex-col overflow-hidden border-r transition-transform duration-200 lg:static lg:z-auto lg:flex lg:h-screen lg:flex-shrink-0 lg:translate-x-0 ${e?"translate-x-0":"-translate-x-full lg:translate-x-0"}`,style:{borderColor:"var(--revka-border-soft)",backgroundColor:"var(--revka-bg-shell)",width:l,padding:r?"1rem 0.5rem":"1rem 0.75rem",transition:"width 0.18s ease, padding 0.18s ease, transform 0.2s ease"},"data-collapsed":String(r),children:[r?c.jsxs("div",{className:"flex flex-col items-center gap-3",children:[c.jsx("img",{src:o,alt:"Revka",title:"Revka",className:"revka-brand-logo h-11 w-11 rounded-[14px] object-contain",draggable:!1,onError:u=>{u.currentTarget.src=Qw}}),c.jsx("button",{type:"button",className:"revka-sidebar-collapse-btn",onClick:()=>i(!1),"aria-label":"Expand sidebar",title:"Expand sidebar",children:c.jsx(JZ,{className:"h-4 w-4"})})]}):c.jsx("div",{className:"revka-panel p-4",children:c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx("img",{src:o,alt:"Revka",className:"revka-brand-logo h-11 w-11 rounded-[14px] object-contain",draggable:!1,onError:u=>{u.currentTarget.src=Qw}}),c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsx("div",{className:"revka-kicker",children:"Revka"}),c.jsx("div",{className:"truncate text-sm font-semibold",style:{color:"var(--revka-text-primary)"},children:s("sidebar.brand_subtitle")})]}),c.jsx("button",{type:"button",className:"revka-sidebar-collapse-btn",onClick:()=>i(!0),"aria-label":"Collapse sidebar",title:"Collapse sidebar",children:c.jsx(ZZ,{className:"h-4 w-4"})})]})}),c.jsx("nav",{className:"revka-sidebar-scroll mt-5 min-h-0 flex-1 overflow-y-auto",style:{paddingRight:r?0:"0.25rem"},children:c.jsx("div",{className:r?"space-y-4":"space-y-5",children:KB.map(u=>c.jsxs("section",{children:[r?c.jsx("div",{className:"mx-auto mb-2 h-px w-6",style:{background:"var(--revka-border-soft)"},"aria-hidden":"true"}):c.jsx("div",{className:"mb-2 px-2 text-[11px] font-semibold uppercase tracking-[0.18em]",style:{color:"var(--revka-text-faint)"},children:s(u.labelKey)}),c.jsx("div",{className:"space-y-1.5",children:u.items.map(d=>{const p=d.icon,f=s(d.labelKey),g=s(d.blurbKey);return c.jsx(J8,{to:d.to,title:r?f:g,children:({isActive:_})=>c.jsxs("div",{className:"revka-sidebar-link w-full","data-active":String(_),"data-collapsed":String(r),children:[c.jsx(p,{className:"h-4 w-4 shrink-0"}),r?null:c.jsxs("div",{className:"min-w-0",children:[c.jsx("div",{className:"text-sm font-medium",children:f}),c.jsx("div",{className:"truncate text-xs",style:{color:_?"var(--revka-text-secondary)":"var(--revka-text-faint)"},children:g})]})]})},d.to)})})]},u.id))})}),r?null:c.jsxs("div",{className:"revka-panel mt-5 p-4","data-variant":"utility",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(YZ,{className:"h-4 w-4",style:{color:"var(--revka-signal-network)"}}),c.jsx("span",{className:"text-sm font-medium",style:{color:"var(--revka-text-primary)"},children:s("sidebar.shell")})]}),c.jsx("p",{className:"mt-2 text-xs leading-5",style:{color:"var(--revka-text-secondary)"},children:s("sidebar.shell_description")}),c.jsxs("div",{className:"mt-3 text-[11px] font-medium",style:{color:"var(--revka-text-faint)"},children:["v",sj]})]})]})]})}function Fue(){const{theme:e,resolvedTheme:n}=Ta(),r=e==="system"?n:e,[i,s]=b.useState(!1),a=is();return b.useEffect(()=>{const o=document.documentElement;return o.dataset.theme=r,()=>{o.dataset.theme===r&&delete o.dataset.theme}},[r]),b.useEffect(()=>{s(!1)},[a.pathname]),c.jsx(uee,{children:c.jsxs("div",{className:"revka-shell lg:flex lg:h-screen lg:overflow-hidden",children:[c.jsx($ue,{mobileOpen:i,onCloseMobile:()=>s(!1)}),c.jsxs("div",{className:"min-w-0 flex-1 lg:flex lg:h-screen lg:flex-col lg:overflow-hidden",children:[c.jsx(Bue,{onOpenMobileNav:()=>s(!0)}),c.jsxs("div",{className:"relative min-h-0 flex-1",children:[c.jsx("main",{className:"h-full overflow-y-auto px-4 pb-6 lg:px-6 lg:pb-8",children:c.jsx(cX,{})}),c.jsx(Mue,{})]})]})]})})}/*! js-yaml 4.2.0 https://github.com/nodeca/js-yaml @license MIT */var Hue=Object.create,h$=Object.defineProperty,Wue=Object.getOwnPropertyDescriptor,que=Object.getOwnPropertyNames,Uue=Object.getPrototypeOf,Vue=Object.prototype.hasOwnProperty,ur=(e,n)=>()=>(n||(e((n={exports:{}}).exports,n),e=null),n.exports),Kue=(e,n,r,i)=>{if(n&&typeof n=="object"||typeof n=="function")for(var s=que(n),a=0,o=s.length,l;a<o;a++)l=s[a],!Vue.call(e,l)&&l!==r&&h$(e,l,{get:(u=>n[u]).bind(null,l),enumerable:!(i=Wue(n,l))||i.enumerable});return e},Yue=(e,n,r)=>(r=e!=null?Hue(Uue(e)):{},Kue(h$(r,"default",{value:e,enumerable:!0}),e)),mv=ur(((e,n)=>{function r(u){return typeof u>"u"||u===null}function i(u){return typeof u=="object"&&u!==null}function s(u){return Array.isArray(u)?u:r(u)?[]:[u]}function a(u,d){if(d){const p=Object.keys(d);for(let f=0,g=p.length;f<g;f+=1){const _=p[f];u[_]=d[_]}}return u}function o(u,d){let p="";for(let f=0;f<d;f+=1)p+=u;return p}function l(u){return u===0&&Number.NEGATIVE_INFINITY===1/u}n.exports.isNothing=r,n.exports.isObject=i,n.exports.toArray=s,n.exports.repeat=o,n.exports.isNegativeZero=l,n.exports.extend=a})),gv=ur(((e,n)=>{function r(s,a){let o="";const l=s.reason||"(unknown reason)";return s.mark?(s.mark.name&&(o+='in "'+s.mark.name+'" '),o+="("+(s.mark.line+1)+":"+(s.mark.column+1)+")",!a&&s.mark.snippet&&(o+=`

`+s.mark.snippet),l+" "+o):l}function i(s,a){Error.call(this),this.name="YAMLException",this.reason=s,this.mark=a,this.message=r(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}i.prototype=Object.create(Error.prototype),i.prototype.constructor=i,i.prototype.toString=function(a){return this.name+": "+r(this,a)},n.exports=i})),Gue=ur(((e,n)=>{var r=mv();function i(o,l,u,d,p){let f="",g="";const _=Math.floor(p/2)-1;return d-l>_&&(f=" ... ",l=d-_+f.length),u-d>_&&(g=" ...",u=d+_-g.length),{str:f+o.slice(l,u).replace(/\t/g,"→")+g,pos:d-l+f.length}}function s(o,l){return r.repeat(" ",l-o.length)+o}function a(o,l){if(l=Object.create(l||null),!o.buffer)return null;l.maxLength||(l.maxLength=79),typeof l.indent!="number"&&(l.indent=1),typeof l.linesBefore!="number"&&(l.linesBefore=3),typeof l.linesAfter!="number"&&(l.linesAfter=2);const u=/\r?\n|\r|\0/g,d=[0],p=[];let f,g=-1;for(;f=u.exec(o.buffer);)p.push(f.index),d.push(f.index+f[0].length),o.position<=f.index&&g<0&&(g=d.length-2);g<0&&(g=d.length-1);let _="";const x=Math.min(o.line+l.linesAfter,p.length).toString().length,v=l.maxLength-(l.indent+x+3);for(let w=1;w<=l.linesBefore&&!(g-w<0);w++){const N=i(o.buffer,d[g-w],p[g-w],o.position-(d[g]-d[g-w]),v);_=r.repeat(" ",l.indent)+s((o.line-w+1).toString(),x)+" | "+N.str+`
`+_}const S=i(o.buffer,d[g],p[g],o.position,v);_+=r.repeat(" ",l.indent)+s((o.line+1).toString(),x)+" | "+S.str+`
`,_+=r.repeat("-",l.indent+x+3+S.pos)+`^
`;for(let w=1;w<=l.linesAfter&&!(g+w>=p.length);w++){const N=i(o.buffer,d[g+w],p[g+w],o.position-(d[g]-d[g+w]),v);_+=r.repeat(" ",l.indent)+s((o.line+w+1).toString(),x)+" | "+N.str+`
`}return _.replace(/\n$/,"")}n.exports=a})),os=ur(((e,n)=>{var r=gv(),i=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],s=["scalar","sequence","mapping"];function a(l){const u={};return l!==null&&Object.keys(l).forEach(function(d){l[d].forEach(function(p){u[String(p)]=d})}),u}function o(l,u){if(u=u||{},Object.keys(u).forEach(function(d){if(i.indexOf(d)===-1)throw new r('Unknown option "'+d+'" is met in definition of "'+l+'" YAML type.')}),this.options=u,this.tag=l,this.kind=u.kind||null,this.resolve=u.resolve||function(){return!0},this.construct=u.construct||function(d){return d},this.instanceOf=u.instanceOf||null,this.predicate=u.predicate||null,this.represent=u.represent||null,this.representName=u.representName||null,this.defaultStyle=u.defaultStyle||null,this.multi=u.multi||!1,this.styleAliases=a(u.styleAliases||null),s.indexOf(this.kind)===-1)throw new r('Unknown kind "'+this.kind+'" is specified for "'+l+'" YAML type.')}n.exports=o})),f$=ur(((e,n)=>{var r=gv(),i=os();function s(l,u){const d=[];return l[u].forEach(function(p){let f=d.length;d.forEach(function(g,_){g.tag===p.tag&&g.kind===p.kind&&g.multi===p.multi&&(f=_)}),d[f]=p}),d}function a(){const l={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}};function u(d){d.multi?(l.multi[d.kind].push(d),l.multi.fallback.push(d)):l[d.kind][d.tag]=l.fallback[d.tag]=d}for(let d=0,p=arguments.length;d<p;d+=1)arguments[d].forEach(u);return l}function o(l){return this.extend(l)}o.prototype.extend=function(u){let d=[],p=[];if(u instanceof i)p.push(u);else if(Array.isArray(u))p=p.concat(u);else if(u&&(Array.isArray(u.implicit)||Array.isArray(u.explicit)))u.implicit&&(d=d.concat(u.implicit)),u.explicit&&(p=p.concat(u.explicit));else throw new r("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");d.forEach(function(g){if(!(g instanceof i))throw new r("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(g.loadKind&&g.loadKind!=="scalar")throw new r("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(g.multi)throw new r("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),p.forEach(function(g){if(!(g instanceof i))throw new r("Specified list of YAML types (or a single Type object) contains a non-Type object.")});const f=Object.create(o.prototype);return f.implicit=(this.implicit||[]).concat(d),f.explicit=(this.explicit||[]).concat(p),f.compiledImplicit=s(f,"implicit"),f.compiledExplicit=s(f,"explicit"),f.compiledTypeMap=a(f.compiledImplicit,f.compiledExplicit),f},n.exports=o})),p$=ur(((e,n)=>{n.exports=new(os())("tag:yaml.org,2002:str",{kind:"scalar",construct:function(r){return r!==null?r:""}})})),m$=ur(((e,n)=>{n.exports=new(os())("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(r){return r!==null?r:[]}})})),g$=ur(((e,n)=>{n.exports=new(os())("tag:yaml.org,2002:map",{kind:"mapping",construct:function(r){return r!==null?r:{}}})})),v$=ur(((e,n)=>{n.exports=new(f$())({explicit:[p$(),m$(),g$()]})})),y$=ur(((e,n)=>{var r=os();function i(o){if(o===null)return!0;const l=o.length;return l===1&&o==="~"||l===4&&(o==="null"||o==="Null"||o==="NULL")}function s(){return null}function a(o){return o===null}n.exports=new r("tag:yaml.org,2002:null",{kind:"scalar",resolve:i,construct:s,predicate:a,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"})})),_$=ur(((e,n)=>{var r=os();function i(o){if(o===null)return!1;const l=o.length;return l===4&&(o==="true"||o==="True"||o==="TRUE")||l===5&&(o==="false"||o==="False"||o==="FALSE")}function s(o){return o==="true"||o==="True"||o==="TRUE"}function a(o){return Object.prototype.toString.call(o)==="[object Boolean]"}n.exports=new r("tag:yaml.org,2002:bool",{kind:"scalar",resolve:i,construct:s,predicate:a,represent:{lowercase:function(o){return o?"true":"false"},uppercase:function(o){return o?"TRUE":"FALSE"},camelcase:function(o){return o?"True":"False"}},defaultStyle:"lowercase"})})),x$=ur(((e,n)=>{var r=mv(),i=os();function s(f){return f>=48&&f<=57||f>=65&&f<=70||f>=97&&f<=102}function a(f){return f>=48&&f<=55}function o(f){return f>=48&&f<=57}function l(f){if(f===null)return!1;const g=f.length;let _=0,x=!1;if(!g)return!1;let v=f[_];if((v==="-"||v==="+")&&(v=f[++_]),v==="0"){if(_+1===g)return!0;if(v=f[++_],v==="b"){for(_++;_<g;_++){if(v=f[_],v!=="0"&&v!=="1")return!1;x=!0}return x&&Number.isFinite(u(f))}if(v==="x"){for(_++;_<g;_++){if(!s(f.charCodeAt(_)))return!1;x=!0}return x&&Number.isFinite(u(f))}if(v==="o"){for(_++;_<g;_++){if(!a(f.charCodeAt(_)))return!1;x=!0}return x&&Number.isFinite(u(f))}}for(;_<g;_++){if(!o(f.charCodeAt(_)))return!1;x=!0}return x?Number.isFinite(u(f)):!1}function u(f){let g=f,_=1,x=g[0];if((x==="-"||x==="+")&&(x==="-"&&(_=-1),g=g.slice(1),x=g[0]),g==="0")return 0;if(x==="0"){if(g[1]==="b")return _*parseInt(g.slice(2),2);if(g[1]==="x")return _*parseInt(g.slice(2),16);if(g[1]==="o")return _*parseInt(g.slice(2),8)}return _*parseInt(g,10)}function d(f){return u(f)}function p(f){return Object.prototype.toString.call(f)==="[object Number]"&&f%1===0&&!r.isNegativeZero(f)}n.exports=new i("tag:yaml.org,2002:int",{kind:"scalar",resolve:l,construct:d,predicate:p,represent:{binary:function(f){return f>=0?"0b"+f.toString(2):"-0b"+f.toString(2).slice(1)},octal:function(f){return f>=0?"0o"+f.toString(8):"-0o"+f.toString(8).slice(1)},decimal:function(f){return f.toString(10)},hexadecimal:function(f){return f>=0?"0x"+f.toString(16).toUpperCase():"-0x"+f.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}})})),b$=ur(((e,n)=>{var r=mv(),i=os(),s=new RegExp("^(?:[-+]?(?:[0-9]+)(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"),a=new RegExp("^(?:[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function o(f){return f===null||!s.test(f)?!1:Number.isFinite(parseFloat(f,10))?!0:a.test(f)}function l(f){let g=f.toLowerCase();const _=g[0]==="-"?-1:1;return"+-".indexOf(g[0])>=0&&(g=g.slice(1)),g===".inf"?_===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:g===".nan"?NaN:_*parseFloat(g,10)}var u=/^[-+]?[0-9]+e/;function d(f,g){if(isNaN(f))switch(g){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===f)switch(g){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===f)switch(g){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(r.isNegativeZero(f))return"-0.0";const _=f.toString(10);return u.test(_)?_.replace("e",".e"):_}function p(f){return Object.prototype.toString.call(f)==="[object Number]"&&(f%1!==0||r.isNegativeZero(f))}n.exports=new i("tag:yaml.org,2002:float",{kind:"scalar",resolve:o,construct:l,predicate:p,represent:d,defaultStyle:"lowercase"})})),k$=ur(((e,n)=>{n.exports=v$().extend({implicit:[y$(),_$(),x$(),b$()]})})),w$=ur(((e,n)=>{n.exports=k$()})),S$=ur(((e,n)=>{var r=os(),i=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),s=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");function a(u){return u===null?!1:i.exec(u)!==null||s.exec(u)!==null}function o(u){let d=0,p=null,f=i.exec(u);if(f===null&&(f=s.exec(u)),f===null)throw new Error("Date resolve error");const g=+f[1],_=+f[2]-1,x=+f[3];if(!f[4])return new Date(Date.UTC(g,_,x));const v=+f[4],S=+f[5],w=+f[6];if(f[7]){for(d=f[7].slice(0,3);d.length<3;)d+="0";d=+d}if(f[9]){const C=+f[10],T=+(f[11]||0);p=(C*60+T)*6e4,f[9]==="-"&&(p=-p)}const N=new Date(Date.UTC(g,_,x,v,S,w,d));return p&&N.setTime(N.getTime()-p),N}function l(u){return u.toISOString()}n.exports=new r("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:a,construct:o,instanceOf:Date,represent:l})})),C$=ur(((e,n)=>{var r=os();function i(s){return s==="<<"||s===null}n.exports=new r("tag:yaml.org,2002:merge",{kind:"scalar",resolve:i})})),j$=ur(((e,n)=>{var r=os(),i=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
\r`;function s(u){if(u===null)return!1;let d=0;const p=u.length,f=i;for(let g=0;g<p;g++){const _=f.indexOf(u.charAt(g));if(!(_>64)){if(_<0)return!1;d+=6}}return d%8===0}function a(u){const d=u.replace(/[\r\n=]/g,""),p=d.length,f=i;let g=0;const _=[];for(let v=0;v<p;v++)v%4===0&&v&&(_.push(g>>16&255),_.push(g>>8&255),_.push(g&255)),g=g<<6|f.indexOf(d.charAt(v));const x=p%4*6;return x===0?(_.push(g>>16&255),_.push(g>>8&255),_.push(g&255)):x===18?(_.push(g>>10&255),_.push(g>>2&255)):x===12&&_.push(g>>4&255),new Uint8Array(_)}function o(u){let d="",p=0;const f=u.length,g=i;for(let x=0;x<f;x++)x%3===0&&x&&(d+=g[p>>18&63],d+=g[p>>12&63],d+=g[p>>6&63],d+=g[p&63]),p=(p<<8)+u[x];const _=f%3;return _===0?(d+=g[p>>18&63],d+=g[p>>12&63],d+=g[p>>6&63],d+=g[p&63]):_===2?(d+=g[p>>10&63],d+=g[p>>4&63],d+=g[p<<2&63],d+=g[64]):_===1&&(d+=g[p>>2&63],d+=g[p<<4&63],d+=g[64],d+=g[64]),d}function l(u){return Object.prototype.toString.call(u)==="[object Uint8Array]"}n.exports=new r("tag:yaml.org,2002:binary",{kind:"scalar",resolve:s,construct:a,predicate:l,represent:o})})),N$=ur(((e,n)=>{var r=os(),i=Object.prototype.hasOwnProperty,s=Object.prototype.toString;function a(l){if(l===null)return!0;const u=[],d=l;for(let p=0,f=d.length;p<f;p+=1){const g=d[p];let _=!1;if(s.call(g)!=="[object Object]")return!1;let x;for(x in g)if(i.call(g,x))if(!_)_=!0;else return!1;if(!_)return!1;if(u.indexOf(x)===-1)u.push(x);else return!1}return!0}function o(l){return l!==null?l:[]}n.exports=new r("tag:yaml.org,2002:omap",{kind:"sequence",resolve:a,construct:o})})),E$=ur(((e,n)=>{var r=os(),i=Object.prototype.toString;function s(o){if(o===null)return!0;const l=o,u=new Array(l.length);for(let d=0,p=l.length;d<p;d+=1){const f=l[d];if(i.call(f)!=="[object Object]")return!1;const g=Object.keys(f);if(g.length!==1)return!1;u[d]=[g[0],f[g[0]]]}return!0}function a(o){if(o===null)return[];const l=o,u=new Array(l.length);for(let d=0,p=l.length;d<p;d+=1){const f=l[d],g=Object.keys(f);u[d]=[g[0],f[g[0]]]}return u}n.exports=new r("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:s,construct:a})})),A$=ur(((e,n)=>{var r=os(),i=Object.prototype.hasOwnProperty;function s(o){if(o===null)return!0;const l=o;for(const u in l)if(i.call(l,u)&&l[u]!==null)return!1;return!0}function a(o){return o!==null?o:{}}n.exports=new r("tag:yaml.org,2002:set",{kind:"mapping",resolve:s,construct:a})})),JE=ur(((e,n)=>{n.exports=w$().extend({implicit:[S$(),C$()],explicit:[j$(),N$(),E$(),A$()]})})),Xue=ur(((e,n)=>{var r=mv(),i=gv(),s=Gue(),a=JE(),o=Object.prototype.hasOwnProperty,l=1,u=2,d=3,p=4,f=1,g=2,_=3,x=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,v=/[\x85\u2028\u2029]/,S=/[,\[\]{}]/,w=/^(?:!|!!|![0-9A-Za-z-]+!)$/,N=/^(?:!|[^,\[\]{}])(?:%[0-9a-f]{2}|[0-9a-z\-#;/?:@&=+$,_.!~*'()\[\]])*$/i;function C(O){return Object.prototype.toString.call(O)}function T(O){return O===10||O===13}function A(O){return O===9||O===32}function E(O){return O===9||O===32||O===10||O===13}function D(O){return O===44||O===91||O===93||O===123||O===125}function F(O){if(O>=48&&O<=57)return O-48;const ke=O|32;return ke>=97&&ke<=102?ke-97+10:-1}function B(O){return O===120?2:O===117?4:O===85?8:0}function H(O){return O>=48&&O<=57?O-48:-1}function $(O){switch(O){case 48:return"\0";case 97:return"\x07";case 98:return"\b";case 116:return"	";case 9:return"	";case 110:return`
`;case 118:return"\v";case 102:return"\f";case 114:return"\r";case 101:return"\x1B";case 32:return" ";case 34:return'"';case 47:return"/";case 92:return"\\";case 78:return"";case 95:return" ";case 76:return"\u2028";case 80:return"\u2029";default:return""}}function z(O){return O<=65535?String.fromCharCode(O):String.fromCharCode((O-65536>>10)+55296,(O-65536&1023)+56320)}function W(O,ke,Le){ke==="__proto__"?Object.defineProperty(O,ke,{configurable:!0,enumerable:!0,writable:!0,value:Le}):O[ke]=Le}var P=new Array(256),q=new Array(256);for(let O=0;O<256;O++)P[O]=$(O)?1:0,q[O]=$(O);function I(O,ke){this.input=O,this.filename=ke.filename||null,this.schema=ke.schema||a,this.onWarning=ke.onWarning||null,this.legacy=ke.legacy||!1,this.json=ke.json||!1,this.listener=ke.listener||null,this.maxDepth=typeof ke.maxDepth=="number"?ke.maxDepth:100,this.maxMergeSeqLength=typeof ke.maxMergeSeqLength=="number"?ke.maxMergeSeqLength:20,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=O.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.depth=0,this.firstTabInLine=-1,this.documents=[],this.anchorMapTransactions=[]}function Q(O,ke){const Le={name:O.filename,buffer:O.input.slice(0,-1),position:O.position,line:O.line,column:O.position-O.lineStart};return Le.snippet=s(Le),new i(ke,Le)}function K(O,ke){throw Q(O,ke)}function Z(O,ke){O.onWarning&&O.onWarning.call(null,Q(O,ke))}function Y(O,ke,Le){const ye=O.anchorMapTransactions;if(ye.length!==0){const _e=ye[ye.length-1];o.call(_e,ke)||(_e[ke]={existed:o.call(O.anchorMap,ke),value:O.anchorMap[ke]})}O.anchorMap[ke]=Le}function R(O){O.anchorMapTransactions.push(Object.create(null))}function U(O){const ke=O.anchorMapTransactions.pop(),Le=O.anchorMapTransactions;if(Le.length===0)return;const ye=Le[Le.length-1],_e=Object.keys(ke);for(let Pe=0,ee=_e.length;Pe<ee;Pe+=1){const le=_e[Pe];o.call(ye,le)||(ye[le]=ke[le])}}function V(O){const ke=O.anchorMapTransactions.pop(),Le=Object.keys(ke);for(let ye=Le.length-1;ye>=0;ye-=1){const _e=ke[Le[ye]];_e.existed?O.anchorMap[Le[ye]]=_e.value:delete O.anchorMap[Le[ye]]}}function ie(O){return{position:O.position,line:O.line,lineStart:O.lineStart,lineIndent:O.lineIndent,firstTabInLine:O.firstTabInLine,tag:O.tag,anchor:O.anchor,kind:O.kind,result:O.result}}function te(O,ke){O.position=ke.position,O.line=ke.line,O.lineStart=ke.lineStart,O.lineIndent=ke.lineIndent,O.firstTabInLine=ke.firstTabInLine,O.tag=ke.tag,O.anchor=ke.anchor,O.kind=ke.kind,O.result=ke.result}var X={YAML:function(ke,Le,ye){ke.version!==null&&K(ke,"duplication of %YAML directive"),ye.length!==1&&K(ke,"YAML directive accepts exactly one argument");const _e=/^([0-9]+)\.([0-9]+)$/.exec(ye[0]);_e===null&&K(ke,"ill-formed argument of the YAML directive");const Pe=parseInt(_e[1],10),ee=parseInt(_e[2],10);Pe!==1&&K(ke,"unacceptable YAML version of the document"),ke.version=ye[0],ke.checkLineBreaks=ee<2,ee!==1&&ee!==2&&Z(ke,"unsupported YAML version of the document")},TAG:function(ke,Le,ye){let _e;ye.length!==2&&K(ke,"TAG directive accepts exactly two arguments");const Pe=ye[0];_e=ye[1],w.test(Pe)||K(ke,"ill-formed tag handle (first argument) of the TAG directive"),o.call(ke.tagMap,Pe)&&K(ke,'there is a previously declared suffix for "'+Pe+'" tag handle'),N.test(_e)||K(ke,"ill-formed tag prefix (second argument) of the TAG directive");try{_e=decodeURIComponent(_e)}catch{K(ke,"tag prefix is malformed: "+_e)}ke.tagMap[Pe]=_e}};function se(O,ke,Le,ye){if(ke<Le){const _e=O.input.slice(ke,Le);if(ye)for(let Pe=0,ee=_e.length;Pe<ee;Pe+=1){const le=_e.charCodeAt(Pe);le===9||le>=32&&le<=1114111||K(O,"expected valid JSON character")}else x.test(_e)&&K(O,"the stream contains non-printable characters");O.result+=_e}}function re(O,ke,Le,ye){r.isObject(Le)||K(O,"cannot merge mappings; the provided source object is unacceptable");const _e=Object.keys(Le);for(let Pe=0,ee=_e.length;Pe<ee;Pe+=1){const le=_e[Pe];o.call(ke,le)||(W(ke,le,Le[le]),ye[le]=!0)}}function de(O,ke,Le,ye,_e,Pe,ee,le,je){if(Array.isArray(_e)){_e=Array.prototype.slice.call(_e);for(let Te=0,Me=_e.length;Te<Me;Te+=1)Array.isArray(_e[Te])&&K(O,"nested arrays are not supported inside keys"),typeof _e=="object"&&C(_e[Te])==="[object Object]"&&(_e[Te]="[object Object]")}if(typeof _e=="object"&&C(_e)==="[object Object]"&&(_e="[object Object]"),_e=String(_e),ke===null&&(ke={}),ye==="tag:yaml.org,2002:merge")if(Array.isArray(Pe)){Pe.length>O.maxMergeSeqLength&&K(O,"merge sequence length exceeded maxMergeSeqLength ("+O.maxMergeSeqLength+")");const Te=new Set;for(let Me=0,Ne=Pe.length;Me<Ne;Me+=1){const Ee=Pe[Me];Te.has(Ee)||(Te.add(Ee),re(O,ke,Ee,Le))}}else re(O,ke,Pe,Le);else!O.json&&!o.call(Le,_e)&&o.call(ke,_e)&&(O.line=ee||O.line,O.lineStart=le||O.lineStart,O.position=je||O.position,K(O,"duplicated mapping key")),W(ke,_e,Pe),delete Le[_e];return ke}function ue(O){const ke=O.input.charCodeAt(O.position);ke===10?O.position++:ke===13?(O.position++,O.input.charCodeAt(O.position)===10&&O.position++):K(O,"a line break is expected"),O.line+=1,O.lineStart=O.position,O.firstTabInLine=-1}function ae(O,ke,Le){let ye=0,_e=O.input.charCodeAt(O.position);for(;_e!==0;){for(;A(_e);)_e===9&&O.firstTabInLine===-1&&(O.firstTabInLine=O.position),_e=O.input.charCodeAt(++O.position);if(ke&&_e===35)do _e=O.input.charCodeAt(++O.position);while(_e!==10&&_e!==13&&_e!==0);if(T(_e))for(ue(O),_e=O.input.charCodeAt(O.position),ye++,O.lineIndent=0;_e===32;)O.lineIndent++,_e=O.input.charCodeAt(++O.position);else break}return Le!==-1&&ye!==0&&O.lineIndent<Le&&Z(O,"deficient indentation"),ye}function pe(O){let ke=O.position,Le=O.input.charCodeAt(ke);return!!((Le===45||Le===46)&&Le===O.input.charCodeAt(ke+1)&&Le===O.input.charCodeAt(ke+2)&&(ke+=3,Le=O.input.charCodeAt(ke),Le===0||E(Le)))}function J(O,ke){ke===1?O.result+=" ":ke>1&&(O.result+=r.repeat(`
`,ke-1))}function me(O,ke,Le){let ye,_e,Pe,ee,le,je;const Te=O.kind,Me=O.result;let Ne=O.input.charCodeAt(O.position);if(E(Ne)||D(Ne)||Ne===35||Ne===38||Ne===42||Ne===33||Ne===124||Ne===62||Ne===39||Ne===34||Ne===37||Ne===64||Ne===96)return!1;if(Ne===63||Ne===45){const Ee=O.input.charCodeAt(O.position+1);if(E(Ee)||Le&&D(Ee))return!1}for(O.kind="scalar",O.result="",ye=_e=O.position,Pe=!1;Ne!==0;){if(Ne===58){const Ee=O.input.charCodeAt(O.position+1);if(E(Ee)||Le&&D(Ee))break}else if(Ne===35){if(E(O.input.charCodeAt(O.position-1)))break}else{if(O.position===O.lineStart&&pe(O)||Le&&D(Ne))break;if(T(Ne))if(ee=O.line,le=O.lineStart,je=O.lineIndent,ae(O,!1,-1),O.lineIndent>=ke){Pe=!0,Ne=O.input.charCodeAt(O.position);continue}else{O.position=_e,O.line=ee,O.lineStart=le,O.lineIndent=je;break}}Pe&&(se(O,ye,_e,!1),J(O,O.line-ee),ye=_e=O.position,Pe=!1),A(Ne)||(_e=O.position+1),Ne=O.input.charCodeAt(++O.position)}return se(O,ye,_e,!1),O.result?!0:(O.kind=Te,O.result=Me,!1)}function fe(O,ke){let Le,ye,_e=O.input.charCodeAt(O.position);if(_e!==39)return!1;for(O.kind="scalar",O.result="",O.position++,Le=ye=O.position;(_e=O.input.charCodeAt(O.position))!==0;)if(_e===39)if(se(O,Le,O.position,!0),_e=O.input.charCodeAt(++O.position),_e===39)Le=O.position,O.position++,ye=O.position;else return!0;else T(_e)?(se(O,Le,ye,!0),J(O,ae(O,!1,ke)),Le=ye=O.position):O.position===O.lineStart&&pe(O)?K(O,"unexpected end of the document within a single quoted scalar"):(O.position++,A(_e)||(ye=O.position));K(O,"unexpected end of the stream within a single quoted scalar")}function ve(O,ke){let Le,ye,_e,Pe=O.input.charCodeAt(O.position);if(Pe!==34)return!1;for(O.kind="scalar",O.result="",O.position++,Le=ye=O.position;(Pe=O.input.charCodeAt(O.position))!==0;){if(Pe===34)return se(O,Le,O.position,!0),O.position++,!0;if(Pe===92){if(se(O,Le,O.position,!0),Pe=O.input.charCodeAt(++O.position),T(Pe))ae(O,!1,ke);else if(Pe<256&&P[Pe])O.result+=q[Pe],O.position++;else if((_e=B(Pe))>0){let ee=_e,le=0;for(;ee>0;ee--)Pe=O.input.charCodeAt(++O.position),(_e=F(Pe))>=0?le=(le<<4)+_e:K(O,"expected hexadecimal character");O.result+=z(le),O.position++}else K(O,"unknown escape sequence");Le=ye=O.position}else T(Pe)?(se(O,Le,ye,!0),J(O,ae(O,!1,ke)),Le=ye=O.position):O.position===O.lineStart&&pe(O)?K(O,"unexpected end of the document within a double quoted scalar"):(O.position++,A(Pe)||(ye=O.position))}K(O,"unexpected end of the stream within a double quoted scalar")}function Ke(O,ke){let Le=!0,ye,_e,Pe;const ee=O.tag;let le;const je=O.anchor;let Te,Me,Ne,Ee;const rt=Object.create(null);let Ye,it,kt,mt=O.input.charCodeAt(O.position);if(mt===91)Te=93,Ee=!1,le=[];else if(mt===123)Te=125,Ee=!0,le={};else return!1;for(O.anchor!==null&&Y(O,O.anchor,le),mt=O.input.charCodeAt(++O.position);mt!==0;){if(ae(O,!0,ke),mt=O.input.charCodeAt(O.position),mt===Te)return O.position++,O.tag=ee,O.anchor=je,O.kind=Ee?"mapping":"sequence",O.result=le,!0;Le?mt===44&&K(O,"expected the node content, but found ','"):K(O,"missed comma between flow collection entries"),it=Ye=kt=null,Me=Ne=!1,mt===63&&E(O.input.charCodeAt(O.position+1))&&(Me=Ne=!0,O.position++,ae(O,!0,ke)),ye=O.line,_e=O.lineStart,Pe=O.position,Dt(O,ke,l,!1,!0),it=O.tag,Ye=O.result,ae(O,!0,ke),mt=O.input.charCodeAt(O.position),(Ne||O.line===ye)&&mt===58&&(Me=!0,mt=O.input.charCodeAt(++O.position),ae(O,!0,ke),Dt(O,ke,l,!1,!0),kt=O.result),Ee?de(O,le,rt,it,Ye,kt,ye,_e,Pe):Me?le.push(de(O,null,rt,it,Ye,kt,ye,_e,Pe)):le.push(Ye),ae(O,!0,ke),mt=O.input.charCodeAt(O.position),mt===44?(Le=!0,mt=O.input.charCodeAt(++O.position)):Le=!1}K(O,"unexpected end of the stream within a flow collection")}function ge(O,ke){let Le,ye=f,_e=!1,Pe=!1,ee=ke,le=0,je=!1,Te,Me=O.input.charCodeAt(O.position);if(Me===124)Le=!1;else if(Me===62)Le=!0;else return!1;for(O.kind="scalar",O.result="";Me!==0;)if(Me=O.input.charCodeAt(++O.position),Me===43||Me===45)f===ye?ye=Me===43?_:g:K(O,"repeat of a chomping mode identifier");else if((Te=H(Me))>=0)Te===0?K(O,"bad explicit indentation width of a block scalar; it cannot be less than one"):Pe?K(O,"repeat of an indentation width identifier"):(ee=ke+Te-1,Pe=!0);else break;if(A(Me)){do Me=O.input.charCodeAt(++O.position);while(A(Me));if(Me===35)do Me=O.input.charCodeAt(++O.position);while(!T(Me)&&Me!==0)}for(;Me!==0;){for(ue(O),O.lineIndent=0,Me=O.input.charCodeAt(O.position);(!Pe||O.lineIndent<ee)&&Me===32;)O.lineIndent++,Me=O.input.charCodeAt(++O.position);if(!Pe&&O.lineIndent>ee&&(ee=O.lineIndent),T(Me)){le++;continue}if(!Pe&&ee===0&&K(O,"missing indentation for block scalar"),O.lineIndent<ee){ye===_?O.result+=r.repeat(`
`,_e?1+le:le):ye===f&&_e&&(O.result+=`
`);break}Le?A(Me)?(je=!0,O.result+=r.repeat(`
`,_e?1+le:le)):je?(je=!1,O.result+=r.repeat(`
`,le+1)):le===0?_e&&(O.result+=" "):O.result+=r.repeat(`
`,le):O.result+=r.repeat(`
`,_e?1+le:le),_e=!0,Pe=!0,le=0;const Ne=O.position;for(;!T(Me)&&Me!==0;)Me=O.input.charCodeAt(++O.position);se(O,Ne,O.position,!1)}return!0}function Ue(O,ke){const Le=O.tag,ye=O.anchor,_e=[];let Pe=!1;if(O.firstTabInLine!==-1)return!1;O.anchor!==null&&Y(O,O.anchor,_e);let ee=O.input.charCodeAt(O.position);for(;ee!==0&&(O.firstTabInLine!==-1&&(O.position=O.firstTabInLine,K(O,"tab characters must not be used in indentation")),!(ee!==45||!E(O.input.charCodeAt(O.position+1))));){if(Pe=!0,O.position++,ae(O,!0,-1)&&O.lineIndent<=ke){_e.push(null),ee=O.input.charCodeAt(O.position);continue}const le=O.line;if(Dt(O,ke,d,!1,!0),_e.push(O.result),ae(O,!0,-1),ee=O.input.charCodeAt(O.position),(O.line===le||O.lineIndent>ke)&&ee!==0)K(O,"bad indentation of a sequence entry");else if(O.lineIndent<ke)break}return Pe?(O.tag=Le,O.anchor=ye,O.kind="sequence",O.result=_e,!0):!1}function $e(O,ke,Le){let ye,_e,Pe,ee;const le=O.tag,je=O.anchor,Te={},Me=Object.create(null);let Ne=null,Ee=null,rt=null,Ye=!1,it=!1;if(O.firstTabInLine!==-1)return!1;O.anchor!==null&&Y(O,O.anchor,Te);let kt=O.input.charCodeAt(O.position);for(;kt!==0;){!Ye&&O.firstTabInLine!==-1&&(O.position=O.firstTabInLine,K(O,"tab characters must not be used in indentation"));const mt=O.input.charCodeAt(O.position+1),zt=O.line;if((kt===63||kt===58)&&E(mt))kt===63?(Ye&&(de(O,Te,Me,Ne,Ee,null,_e,Pe,ee),Ne=Ee=rt=null),it=!0,Ye=!0,ye=!0):Ye?(Ye=!1,ye=!0):K(O,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),O.position+=1,kt=mt;else{if(_e=O.line,Pe=O.lineStart,ee=O.position,!Dt(O,Le,u,!1,!0))break;if(O.line===zt){for(kt=O.input.charCodeAt(O.position);A(kt);)kt=O.input.charCodeAt(++O.position);if(kt===58)kt=O.input.charCodeAt(++O.position),E(kt)||K(O,"a whitespace character is expected after the key-value separator within a block mapping"),Ye&&(de(O,Te,Me,Ne,Ee,null,_e,Pe,ee),Ne=Ee=rt=null),it=!0,Ye=!1,ye=!1,Ne=O.tag,Ee=O.result;else if(it)K(O,"can not read an implicit mapping pair; a colon is missed");else return O.tag=le,O.anchor=je,!0}else if(it)K(O,"can not read a block mapping entry; a multiline key may not be an implicit key");else return O.tag=le,O.anchor=je,!0}if((O.line===zt||O.lineIndent>ke)&&(Ye&&(_e=O.line,Pe=O.lineStart,ee=O.position),Dt(O,ke,p,!0,ye)&&(Ye?Ee=O.result:rt=O.result),Ye||(de(O,Te,Me,Ne,Ee,rt,_e,Pe,ee),Ne=Ee=rt=null),ae(O,!0,-1),kt=O.input.charCodeAt(O.position)),(O.line===zt||O.lineIndent>ke)&&kt!==0)K(O,"bad indentation of a mapping entry");else if(O.lineIndent<ke)break}return Ye&&de(O,Te,Me,Ne,Ee,null,_e,Pe,ee),it&&(O.tag=le,O.anchor=je,O.kind="mapping",O.result=Te),it}function Bt(O){let ke=!1,Le=!1,ye,_e,Pe=O.input.charCodeAt(O.position);if(Pe!==33)return!1;O.tag!==null&&K(O,"duplication of a tag property"),Pe=O.input.charCodeAt(++O.position),Pe===60?(ke=!0,Pe=O.input.charCodeAt(++O.position)):Pe===33?(Le=!0,ye="!!",Pe=O.input.charCodeAt(++O.position)):ye="!";let ee=O.position;if(ke){do Pe=O.input.charCodeAt(++O.position);while(Pe!==0&&Pe!==62);O.position<O.length?(_e=O.input.slice(ee,O.position),Pe=O.input.charCodeAt(++O.position)):K(O,"unexpected end of the stream within a verbatim tag")}else{for(;Pe!==0&&!E(Pe);)Pe===33&&(Le?K(O,"tag suffix cannot contain exclamation marks"):(ye=O.input.slice(ee-1,O.position+1),w.test(ye)||K(O,"named tag handle cannot contain such characters"),Le=!0,ee=O.position+1)),Pe=O.input.charCodeAt(++O.position);_e=O.input.slice(ee,O.position),S.test(_e)&&K(O,"tag suffix cannot contain flow indicator characters")}_e&&!N.test(_e)&&K(O,"tag name cannot contain such characters: "+_e);try{_e=decodeURIComponent(_e)}catch{K(O,"tag name is malformed: "+_e)}return ke?O.tag=_e:o.call(O.tagMap,ye)?O.tag=O.tagMap[ye]+_e:ye==="!"?O.tag="!"+_e:ye==="!!"?O.tag="tag:yaml.org,2002:"+_e:K(O,'undeclared tag handle "'+ye+'"'),!0}function ct(O){let ke=O.input.charCodeAt(O.position);if(ke!==38)return!1;O.anchor!==null&&K(O,"duplication of an anchor property"),ke=O.input.charCodeAt(++O.position);const Le=O.position;for(;ke!==0&&!E(ke)&&!D(ke);)ke=O.input.charCodeAt(++O.position);return O.position===Le&&K(O,"name of an anchor node must contain at least one character"),O.anchor=O.input.slice(Le,O.position),!0}function Mt(O){let ke=O.input.charCodeAt(O.position);if(ke!==42)return!1;ke=O.input.charCodeAt(++O.position);const Le=O.position;for(;ke!==0&&!E(ke)&&!D(ke);)ke=O.input.charCodeAt(++O.position);O.position===Le&&K(O,"name of an alias node must contain at least one character");const ye=O.input.slice(Le,O.position);return o.call(O.anchorMap,ye)||K(O,'unidentified alias "'+ye+'"'),O.result=O.anchorMap[ye],ae(O,!0,-1),!0}function Tt(O,ke,Le,ye){const _e=ie(O);return R(O),te(O,ke),O.tag=null,O.anchor=null,O.kind=null,O.result=null,$e(O,Le,ye)&&O.kind==="mapping"?(U(O),!0):(V(O),te(O,_e),!1)}function Dt(O,ke,Le,ye,_e){let Pe,ee,le=1,je=!1,Te=!1,Me=null,Ne,Ee,rt;O.depth>=O.maxDepth&&K(O,"nesting exceeded maxDepth ("+O.maxDepth+")"),O.depth+=1,O.listener!==null&&O.listener("open",O),O.tag=null,O.anchor=null,O.kind=null,O.result=null;const Ye=Pe=ee=p===Le||d===Le;if(ye&&ae(O,!0,-1)&&(je=!0,O.lineIndent>ke?le=1:O.lineIndent===ke?le=0:O.lineIndent<ke&&(le=-1)),le===1)for(;;){const it=O.input.charCodeAt(O.position),kt=ie(O);if(je&&(it===33&&O.tag!==null||it===38&&O.anchor!==null)||!Bt(O)&&!ct(O))break;Me===null&&(Me=kt),ae(O,!0,-1)?(je=!0,ee=Ye,O.lineIndent>ke?le=1:O.lineIndent===ke?le=0:O.lineIndent<ke&&(le=-1)):ee=!1}if(ee&&(ee=je||_e),le===1||p===Le)if(l===Le||u===Le?Ee=ke:Ee=ke+1,rt=O.position-O.lineStart,le===1)if(ee&&(Ue(O,rt)||$e(O,rt,Ee))||Ke(O,Ee))Te=!0;else{const it=O.input.charCodeAt(O.position);Me!==null&&Ye&&!ee&&it!==124&&it!==62&&Tt(O,Me,Me.position-Me.lineStart,Ee)||Pe&&ge(O,Ee)||fe(O,Ee)||ve(O,Ee)?Te=!0:Mt(O)?(Te=!0,(O.tag!==null||O.anchor!==null)&&K(O,"alias node should not have any properties")):me(O,Ee,l===Le)&&(Te=!0,O.tag===null&&(O.tag="?")),O.anchor!==null&&Y(O,O.anchor,O.result)}else le===0&&(Te=ee&&Ue(O,rt));if(O.tag===null)O.anchor!==null&&Y(O,O.anchor,O.result);else if(O.tag==="?"){O.result!==null&&O.kind!=="scalar"&&K(O,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+O.kind+'"');for(let it=0,kt=O.implicitTypes.length;it<kt;it+=1)if(Ne=O.implicitTypes[it],Ne.resolve(O.result)){O.result=Ne.construct(O.result),O.tag=Ne.tag,O.anchor!==null&&Y(O,O.anchor,O.result);break}}else if(O.tag!=="!"){if(o.call(O.typeMap[O.kind||"fallback"],O.tag))Ne=O.typeMap[O.kind||"fallback"][O.tag];else{Ne=null;const it=O.typeMap.multi[O.kind||"fallback"];for(let kt=0,mt=it.length;kt<mt;kt+=1)if(O.tag.slice(0,it[kt].tag.length)===it[kt].tag){Ne=it[kt];break}}Ne||K(O,"unknown tag !<"+O.tag+">"),O.result!==null&&Ne.kind!==O.kind&&K(O,"unacceptable node kind for !<"+O.tag+'> tag; it should be "'+Ne.kind+'", not "'+O.kind+'"'),Ne.resolve(O.result,O.tag)?(O.result=Ne.construct(O.result,O.tag),O.anchor!==null&&Y(O,O.anchor,O.result)):K(O,"cannot resolve a node with !<"+O.tag+"> explicit tag")}return O.listener!==null&&O.listener("close",O),O.depth-=1,O.tag!==null||O.anchor!==null||Te}function Re(O){const ke=O.position;let Le=!1,ye;for(O.version=null,O.checkLineBreaks=O.legacy,O.tagMap=Object.create(null),O.anchorMap=Object.create(null);(ye=O.input.charCodeAt(O.position))!==0&&(ae(O,!0,-1),ye=O.input.charCodeAt(O.position),!(O.lineIndent>0||ye!==37));){Le=!0,ye=O.input.charCodeAt(++O.position);let _e=O.position;for(;ye!==0&&!E(ye);)ye=O.input.charCodeAt(++O.position);const Pe=O.input.slice(_e,O.position),ee=[];for(Pe.length<1&&K(O,"directive name must not be less than one character in length");ye!==0;){for(;A(ye);)ye=O.input.charCodeAt(++O.position);if(ye===35){do ye=O.input.charCodeAt(++O.position);while(ye!==0&&!T(ye));break}if(T(ye))break;for(_e=O.position;ye!==0&&!E(ye);)ye=O.input.charCodeAt(++O.position);ee.push(O.input.slice(_e,O.position))}ye!==0&&ue(O),o.call(X,Pe)?X[Pe](O,Pe,ee):Z(O,'unknown document directive "'+Pe+'"')}if(ae(O,!0,-1),O.lineIndent===0&&O.input.charCodeAt(O.position)===45&&O.input.charCodeAt(O.position+1)===45&&O.input.charCodeAt(O.position+2)===45?(O.position+=3,ae(O,!0,-1)):Le&&K(O,"directives end mark is expected"),Dt(O,O.lineIndent-1,p,!1,!0),ae(O,!0,-1),O.checkLineBreaks&&v.test(O.input.slice(ke,O.position))&&Z(O,"non-ASCII line breaks are interpreted as content"),O.documents.push(O.result),O.position===O.lineStart&&pe(O)){O.input.charCodeAt(O.position)===46&&(O.position+=3,ae(O,!0,-1));return}O.position<O.length-1&&K(O,"end of the stream or a document separator is expected")}function et(O,ke){O=String(O),ke=ke||{},O.length!==0&&(O.charCodeAt(O.length-1)!==10&&O.charCodeAt(O.length-1)!==13&&(O+=`
`),O.charCodeAt(0)===65279&&(O=O.slice(1)));const Le=new I(O,ke),ye=O.indexOf("\0");for(ye!==-1&&(Le.position=ye,K(Le,"null byte is not allowed in input")),Le.input+="\0";Le.input.charCodeAt(Le.position)===32;)Le.lineIndent+=1,Le.position+=1;for(;Le.position<Le.length-1;)Re(Le);return Le.documents}function bt(O,ke,Le){ke!==null&&typeof ke=="object"&&typeof Le>"u"&&(Le=ke,ke=null);const ye=et(O,Le);if(typeof ke!="function")return ye;for(let _e=0,Pe=ye.length;_e<Pe;_e+=1)ke(ye[_e])}function yt(O,ke){const Le=et(O,ke);if(Le.length!==0){if(Le.length===1)return Le[0];throw new i("expected a single document in the stream, but found more")}}n.exports.loadAll=bt,n.exports.load=yt})),Que=ur(((e,n)=>{var r=mv(),i=gv(),s=JE(),a=Object.prototype.toString,o=Object.prototype.hasOwnProperty,l=65279,u=9,d=10,p=13,f=32,g=33,_=34,x=35,v=37,S=38,w=39,N=42,C=44,T=45,A=58,E=61,D=62,F=63,B=64,H=91,$=93,z=96,W=123,P=124,q=125,I={};I[0]="\\0",I[7]="\\a",I[8]="\\b",I[9]="\\t",I[10]="\\n",I[11]="\\v",I[12]="\\f",I[13]="\\r",I[27]="\\e",I[34]='\\"',I[92]="\\\\",I[133]="\\N",I[160]="\\_",I[8232]="\\L",I[8233]="\\P";var Q=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],K=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function Z(ee,le){if(le===null)return{};const je={},Te=Object.keys(le);for(let Me=0,Ne=Te.length;Me<Ne;Me+=1){let Ee=Te[Me],rt=String(le[Ee]);Ee.slice(0,2)==="!!"&&(Ee="tag:yaml.org,2002:"+Ee.slice(2));const Ye=ee.compiledTypeMap.fallback[Ee];Ye&&o.call(Ye.styleAliases,rt)&&(rt=Ye.styleAliases[rt]),je[Ee]=rt}return je}function Y(ee){let le,je;const Te=ee.toString(16).toUpperCase();if(ee<=255)le="x",je=2;else if(ee<=65535)le="u",je=4;else if(ee<=4294967295)le="U",je=8;else throw new i("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+le+r.repeat("0",je-Te.length)+Te}var R=1,U=2;function V(ee){this.schema=ee.schema||s,this.indent=Math.max(1,ee.indent||2),this.noArrayIndent=ee.noArrayIndent||!1,this.skipInvalid=ee.skipInvalid||!1,this.flowLevel=r.isNothing(ee.flowLevel)?-1:ee.flowLevel,this.styleMap=Z(this.schema,ee.styles||null),this.sortKeys=ee.sortKeys||!1,this.lineWidth=ee.lineWidth||80,this.noRefs=ee.noRefs||!1,this.noCompatMode=ee.noCompatMode||!1,this.condenseFlow=ee.condenseFlow||!1,this.quotingType=ee.quotingType==='"'?U:R,this.forceQuotes=ee.forceQuotes||!1,this.replacer=typeof ee.replacer=="function"?ee.replacer:null,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function ie(ee,le){const je=r.repeat(" ",le);let Te=0,Me="";const Ne=ee.length;for(;Te<Ne;){let Ee;const rt=ee.indexOf(`
`,Te);rt===-1?(Ee=ee.slice(Te),Te=Ne):(Ee=ee.slice(Te,rt+1),Te=rt+1),Ee.length&&Ee!==`
`&&(Me+=je),Me+=Ee}return Me}function te(ee,le){return`
`+r.repeat(" ",ee.indent*le)}function X(ee,le){for(let je=0,Te=ee.implicitTypes.length;je<Te;je+=1)if(ee.implicitTypes[je].resolve(le))return!0;return!1}function se(ee){return ee===f||ee===u}function re(ee){return ee>=32&&ee<=126||ee>=161&&ee<=55295&&ee!==8232&&ee!==8233||ee>=57344&&ee<=65533&&ee!==l||ee>=65536&&ee<=1114111}function de(ee){return re(ee)&&ee!==l&&ee!==p&&ee!==d}function ue(ee,le,je){const Te=de(ee),Me=Te&&!se(ee);return(je?Te:Te&&ee!==C&&ee!==H&&ee!==$&&ee!==W&&ee!==q)&&ee!==x&&!(le===A&&!Me)||de(le)&&!se(le)&&ee===x||le===A&&Me}function ae(ee){return re(ee)&&ee!==l&&!se(ee)&&ee!==T&&ee!==F&&ee!==A&&ee!==C&&ee!==H&&ee!==$&&ee!==W&&ee!==q&&ee!==x&&ee!==S&&ee!==N&&ee!==g&&ee!==P&&ee!==E&&ee!==D&&ee!==w&&ee!==_&&ee!==v&&ee!==B&&ee!==z}function pe(ee){return!se(ee)&&ee!==A}function J(ee,le){const je=ee.charCodeAt(le);let Te;return je>=55296&&je<=56319&&le+1<ee.length&&(Te=ee.charCodeAt(le+1),Te>=56320&&Te<=57343)?(je-55296)*1024+Te-56320+65536:je}function me(ee){return/^\n* /.test(ee)}var fe=1,ve=2,Ke=3,ge=4,Ue=5;function $e(ee,le,je,Te,Me,Ne,Ee,rt){let Ye,it=0,kt=null,mt=!1,zt=!1;const xe=Te!==-1;let qe=-1,dt=ae(J(ee,0))&&pe(J(ee,ee.length-1));if(le||Ee)for(Ye=0;Ye<ee.length;it>=65536?Ye+=2:Ye++){if(it=J(ee,Ye),!re(it))return Ue;dt=dt&&ue(it,kt,rt),kt=it}else{for(Ye=0;Ye<ee.length;it>=65536?Ye+=2:Ye++){if(it=J(ee,Ye),it===d)mt=!0,xe&&(zt=zt||Ye-qe-1>Te&&ee[qe+1]!==" ",qe=Ye);else if(!re(it))return Ue;dt=dt&&ue(it,kt,rt),kt=it}zt=zt||xe&&Ye-qe-1>Te&&ee[qe+1]!==" "}return!mt&&!zt?dt&&!Ee&&!Me(ee)?fe:Ne===U?Ue:ve:je>9&&me(ee)?Ue:Ee?Ne===U?Ue:ve:zt?ge:Ke}function Bt(ee,le,je,Te,Me){ee.dump=(function(){if(le.length===0)return ee.quotingType===U?'""':"''";if(!ee.noCompatMode&&(Q.indexOf(le)!==-1||K.test(le)))return ee.quotingType===U?'"'+le+'"':"'"+le+"'";const Ne=ee.indent*Math.max(1,je),Ee=ee.lineWidth===-1?-1:Math.max(Math.min(ee.lineWidth,40),ee.lineWidth-Ne),rt=Te||ee.flowLevel>-1&&je>=ee.flowLevel;function Ye(it){return X(ee,it)}switch($e(le,rt,ee.indent,Ee,Ye,ee.quotingType,ee.forceQuotes&&!Te,Me)){case fe:return le;case ve:return"'"+le.replace(/'/g,"''")+"'";case Ke:return"|"+ct(le,ee.indent)+Mt(ie(le,Ne));case ge:return">"+ct(le,ee.indent)+Mt(ie(Tt(le,Ee),Ne));case Ue:return'"'+Re(le)+'"';default:throw new i("impossible error: invalid scalar style")}})()}function ct(ee,le){const je=me(ee)?String(le):"",Te=ee[ee.length-1]===`
`;return je+(Te&&(ee[ee.length-2]===`
`||ee===`
`)?"+":Te?"":"-")+`
`}function Mt(ee){return ee[ee.length-1]===`
`?ee.slice(0,-1):ee}function Tt(ee,le){const je=/(\n+)([^\n]*)/g;let Te=(function(){let rt=ee.indexOf(`
`);return rt=rt!==-1?rt:ee.length,je.lastIndex=rt,Dt(ee.slice(0,rt),le)})(),Me=ee[0]===`
`||ee[0]===" ",Ne,Ee;for(;Ee=je.exec(ee);){const rt=Ee[1],Ye=Ee[2];Ne=Ye[0]===" ",Te+=rt+(!Me&&!Ne&&Ye!==""?`
`:"")+Dt(Ye,le),Me=Ne}return Te}function Dt(ee,le){if(ee===""||ee[0]===" ")return ee;const je=/ [^ ]/g;let Te,Me=0,Ne,Ee=0,rt=0,Ye="";for(;Te=je.exec(ee);)rt=Te.index,rt-Me>le&&(Ne=Ee>Me?Ee:rt,Ye+=`
`+ee.slice(Me,Ne),Me=Ne+1),Ee=rt;return Ye+=`
`,ee.length-Me>le&&Ee>Me?Ye+=ee.slice(Me,Ee)+`
`+ee.slice(Ee+1):Ye+=ee.slice(Me),Ye.slice(1)}function Re(ee){let le="",je=0;for(let Te=0;Te<ee.length;je>=65536?Te+=2:Te++){je=J(ee,Te);const Me=I[je];!Me&&re(je)?(le+=ee[Te],je>=65536&&(le+=ee[Te+1])):le+=Me||Y(je)}return le}function et(ee,le,je){let Te="";const Me=ee.tag;for(let Ne=0,Ee=je.length;Ne<Ee;Ne+=1){let rt=je[Ne];ee.replacer&&(rt=ee.replacer.call(je,String(Ne),rt)),(Le(ee,le,rt,!1,!1)||typeof rt>"u"&&Le(ee,le,null,!1,!1))&&(Te!==""&&(Te+=","+(ee.condenseFlow?"":" ")),Te+=ee.dump)}ee.tag=Me,ee.dump="["+Te+"]"}function bt(ee,le,je,Te){let Me="";const Ne=ee.tag;for(let Ee=0,rt=je.length;Ee<rt;Ee+=1){let Ye=je[Ee];ee.replacer&&(Ye=ee.replacer.call(je,String(Ee),Ye)),(Le(ee,le+1,Ye,!0,!0,!1,!0)||typeof Ye>"u"&&Le(ee,le+1,null,!0,!0,!1,!0))&&((!Te||Me!=="")&&(Me+=te(ee,le)),ee.dump&&d===ee.dump.charCodeAt(0)?Me+="-":Me+="- ",Me+=ee.dump)}ee.tag=Ne,ee.dump=Me||"[]"}function yt(ee,le,je){let Te="";const Me=ee.tag,Ne=Object.keys(je);for(let Ee=0,rt=Ne.length;Ee<rt;Ee+=1){let Ye="";Te!==""&&(Ye+=", "),ee.condenseFlow&&(Ye+='"');const it=Ne[Ee];let kt=je[it];ee.replacer&&(kt=ee.replacer.call(je,it,kt)),Le(ee,le,it,!1,!1)&&(ee.dump.length>1024&&(Ye+="? "),Ye+=ee.dump+(ee.condenseFlow?'"':"")+":"+(ee.condenseFlow?"":" "),Le(ee,le,kt,!1,!1)&&(Ye+=ee.dump,Te+=Ye))}ee.tag=Me,ee.dump="{"+Te+"}"}function O(ee,le,je,Te){let Me="";const Ne=ee.tag,Ee=Object.keys(je);if(ee.sortKeys===!0)Ee.sort();else if(typeof ee.sortKeys=="function")Ee.sort(ee.sortKeys);else if(ee.sortKeys)throw new i("sortKeys must be a boolean or a function");for(let rt=0,Ye=Ee.length;rt<Ye;rt+=1){let it="";(!Te||Me!=="")&&(it+=te(ee,le));const kt=Ee[rt];let mt=je[kt];if(ee.replacer&&(mt=ee.replacer.call(je,kt,mt)),!Le(ee,le+1,kt,!0,!0,!0))continue;const zt=ee.tag!==null&&ee.tag!=="?"||ee.dump&&ee.dump.length>1024;zt&&(ee.dump&&d===ee.dump.charCodeAt(0)?it+="?":it+="? "),it+=ee.dump,zt&&(it+=te(ee,le)),Le(ee,le+1,mt,!0,zt)&&(ee.dump&&d===ee.dump.charCodeAt(0)?it+=":":it+=": ",it+=ee.dump,Me+=it)}ee.tag=Ne,ee.dump=Me||"{}"}function ke(ee,le,je){const Te=je?ee.explicitTypes:ee.implicitTypes;for(let Me=0,Ne=Te.length;Me<Ne;Me+=1){const Ee=Te[Me];if((Ee.instanceOf||Ee.predicate)&&(!Ee.instanceOf||typeof le=="object"&&le instanceof Ee.instanceOf)&&(!Ee.predicate||Ee.predicate(le))){if(je?Ee.multi&&Ee.representName?ee.tag=Ee.representName(le):ee.tag=Ee.tag:ee.tag="?",Ee.represent){const rt=ee.styleMap[Ee.tag]||Ee.defaultStyle;let Ye;if(a.call(Ee.represent)==="[object Function]")Ye=Ee.represent(le,rt);else if(o.call(Ee.represent,rt))Ye=Ee.represent[rt](le,rt);else throw new i("!<"+Ee.tag+'> tag resolver accepts not "'+rt+'" style');ee.dump=Ye}return!0}}return!1}function Le(ee,le,je,Te,Me,Ne,Ee){ee.tag=null,ee.dump=je,ke(ee,je,!1)||ke(ee,je,!0);const rt=a.call(ee.dump),Ye=Te;Te&&(Te=ee.flowLevel<0||ee.flowLevel>le);const it=rt==="[object Object]"||rt==="[object Array]";let kt,mt;if(it&&(kt=ee.duplicates.indexOf(je),mt=kt!==-1),(ee.tag!==null&&ee.tag!=="?"||mt||ee.indent!==2&&le>0)&&(Me=!1),mt&&ee.usedDuplicates[kt])ee.dump="*ref_"+kt;else{if(it&&mt&&!ee.usedDuplicates[kt]&&(ee.usedDuplicates[kt]=!0),rt==="[object Object]")Te&&Object.keys(ee.dump).length!==0?(O(ee,le,ee.dump,Me),mt&&(ee.dump="&ref_"+kt+ee.dump)):(yt(ee,le,ee.dump),mt&&(ee.dump="&ref_"+kt+" "+ee.dump));else if(rt==="[object Array]")Te&&ee.dump.length!==0?(ee.noArrayIndent&&!Ee&&le>0?bt(ee,le-1,ee.dump,Me):bt(ee,le,ee.dump,Me),mt&&(ee.dump="&ref_"+kt+ee.dump)):(et(ee,le,ee.dump),mt&&(ee.dump="&ref_"+kt+" "+ee.dump));else if(rt==="[object String]")ee.tag!=="?"&&Bt(ee,ee.dump,le,Ne,Ye);else{if(rt==="[object Undefined]")return!1;if(ee.skipInvalid)return!1;throw new i("unacceptable kind of an object to dump "+rt)}if(ee.tag!==null&&ee.tag!=="?"){let zt=encodeURI(ee.tag[0]==="!"?ee.tag.slice(1):ee.tag).replace(/!/g,"%21");ee.tag[0]==="!"?zt="!"+zt:zt.slice(0,18)==="tag:yaml.org,2002:"?zt="!!"+zt.slice(18):zt="!<"+zt+">",ee.dump=zt+" "+ee.dump}}return!0}function ye(ee,le){const je=[],Te=[];_e(ee,je,Te);const Me=Te.length;for(let Ne=0;Ne<Me;Ne+=1)le.duplicates.push(je[Te[Ne]]);le.usedDuplicates=new Array(Me)}function _e(ee,le,je){if(ee!==null&&typeof ee=="object"){const Te=le.indexOf(ee);if(Te!==-1)je.indexOf(Te)===-1&&je.push(Te);else if(le.push(ee),Array.isArray(ee))for(let Me=0,Ne=ee.length;Me<Ne;Me+=1)_e(ee[Me],le,je);else{const Me=Object.keys(ee);for(let Ne=0,Ee=Me.length;Ne<Ee;Ne+=1)_e(ee[Me[Ne]],le,je)}}}function Pe(ee,le){le=le||{};const je=new V(le);je.noRefs||ye(ee,je);let Te=ee;return je.replacer&&(Te=je.replacer.call({"":Te},"",Te)),Le(je,0,Te,!0,!0)?je.dump+`
`:""}n.exports.dump=Pe})),T$=Yue(ur(((e,n)=>{var r=Xue(),i=Que();function s(a,o){return function(){throw new Error("Function yaml."+a+" is removed in js-yaml 4. Use yaml."+o+" instead, which is now safe by default.")}}n.exports.Type=os(),n.exports.Schema=f$(),n.exports.FAILSAFE_SCHEMA=v$(),n.exports.JSON_SCHEMA=k$(),n.exports.CORE_SCHEMA=w$(),n.exports.DEFAULT_SCHEMA=JE(),n.exports.load=r.load,n.exports.loadAll=r.loadAll,n.exports.dump=i.dump,n.exports.YAMLException=gv(),n.exports.types={binary:j$(),float:b$(),map:g$(),null:y$(),pairs:E$(),set:A$(),timestamp:S$(),bool:_$(),int:x$(),merge:C$(),omap:N$(),seq:m$(),str:p$()},n.exports.safeLoad=s("safeLoad","load"),n.exports.safeLoadAll=s("safeLoadAll","loadAll"),n.exports.safeDump=s("safeDump","dump")}))()),{Type:XOe,Schema:QOe,FAILSAFE_SCHEMA:ZOe,JSON_SCHEMA:JOe,CORE_SCHEMA:e4e,DEFAULT_SCHEMA:t4e,load:n4e,loadAll:r4e,dump:i4e,YAMLException:s4e,types:a4e,safeLoad:o4e,safeLoadAll:l4e,safeDump:c4e}=T$.default,M$=T$.default;const Zue=new Set(["template_name","agent_type","role","managed_agent_id","sidecar_id","artifact_path","exit_code","stderr_tail","skills","structured_output_missing"]),K4=/(^|[^A-Za-z0-9_.-])([A-Za-z0-9_-]+)\.output_data\.([A-Za-z_][A-Za-z0-9_]*)/g;function Jue(e){const n=[];if(!e)return n;K4.lastIndex=0;let r;for(;(r=K4.exec(e))!==null;){const i=r[2],s=r[3];!i||!s||n.push({stepId:i,field:s})}return n}function aj(e,n){if(typeof e=="string"){n.push(e);return}if(Array.isArray(e)){for(const r of e)aj(r,n);return}if(e&&typeof e=="object")for(const r of Object.values(e))aj(r,n)}function ede(e){const n=new Map,r=new Set(e.map(s=>s.id)),i=new Map;for(const s of e){n.set(s.id,s);const a=s.id.replace(/-/g,"_");a!==s.id&&i.set(a,(i.get(a)??0)+1)}for(const s of e){const a=s.id.replace(/-/g,"_");a!==s.id&&!r.has(a)&&i.get(a)===1&&n.set(a,s)}return n}function tde(e){const n=[],r=ede(e),i=new Set;for(const s of e){const a=[];aj(s,a);for(const o of a)for(const l of Jue(o)){const u=r.get(l.stepId);if(!u||u.type!=="agent"||Zue.has(l.field)||(u.agent_output_fields??[]).includes(l.field))continue;const d=`${s.id}|${u.id}|${l.field}`;i.has(d)||(i.add(d),n.push({consumerStepId:s.id,sourceStepId:u.id,field:l.field,message:`${u.id}.output_data.${l.field} is referenced by ${s.id}, but ${u.id} does not declare ${l.field} as a required structured output field.`}))}}return n}const nde={research:"agent",code:"agent",review:"agent",deploy:"agent",test:"agent",build:"agent",notify:"notify",summarize:"agent",task:"agent",approve:"human_approval",gate:"conditional",human_input:"human_input",agent:"agent",parallel:"parallel",shell:"shell",goto:"goto",output:"output",conditional:"conditional",group_chat:"group_chat",supervisor:"supervisor",map_reduce:"map_reduce",handoff:"handoff",a2a:"a2a",resolve:"resolve",for_each:"for_each",kumiho_context:"kumiho_context",kumiho_bundle_update:"kumiho_bundle_update",kumiho_patch_apply:"kumiho_patch_apply",human_approval:"human_approval",python:"python",compute:"compute",email:"email",tag:"tag",deprecate:"deprecate",manus:"manus"};function rde(e){return nde[e]??e}const Lt=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Ie=e=>{if(e!=null){if(typeof e=="string")return e;if(typeof e=="number"||typeof e=="boolean")return String(e)}},Cn=e=>{if(typeof e=="number")return e;if(typeof e=="string"&&e.trim()!==""){const n=Number(e);return Number.isFinite(n)?n:void 0}},Nn=e=>{if(typeof e=="boolean")return e;if(typeof e=="string"){const n=e.toLowerCase();if(n==="true")return!0;if(n==="false")return!1}},En=e=>Array.isArray(e)?e.map(r=>Ie(r)).filter(r=>!!r&&r.length>0):void 0,R$=e=>{if(Lt(e))try{return JSON.parse(JSON.stringify(e))}catch{return{...e}}},pa=(e,n)=>{const r=e==null?void 0:e[n];return Lt(r)?r:void 0},ide=e=>{if(!Lt(e))return;const n=Cn(e.x),r=Cn(e.y);if(!(n===void 0||r===void 0)&&!(!Number.isFinite(n)||!Number.isFinite(r)))return{x:n,y:r}},Qx=e=>{if(!Number.isFinite(e))return 0;const n=Math.round(e*100)/100;return Object.is(n,-0)?0:n},sde=e=>({x:Qx((e==null?void 0:e.x)??0),y:Qx((e==null?void 0:e.y)??0)});function Km(e){var i;const n=e.goto.trim();return{condition:e.condition.trim()||(n?"default":""),goto:n,value:((i=e.value)==null?void 0:i.trim())||void 0}}function eA(e){return e.some(n=>n.position!==void 0)}function Bo(e){const n=M$.load(e);if(!Lt(n))return[];const r=n.steps;if(!Array.isArray(r))return[];const i=[];for(const s of r){if(!Lt(s))continue;const a=ade(s);a&&i.push(a)}return i}function ade(e){const n=Ie(e.id);if(!n)return null;const r=Ie(e.type)??Ie(e.action)??Ie(e.task)??"agent",i=rde(r);let s=[];const a=e.depends_on??e.dependsOn??e.after;if(Array.isArray(a))s=En(a)??[];else{const R=Ie(a);R&&(s=[R])}const o=e.agent_hints??e.agentHints;let l=[];if(Array.isArray(o))l=En(o)??[];else{const R=Ie(o);R&&(l=[R])}let u=[];if(Array.isArray(e.skills))u=En(e.skills)??[];else{const R=Ie(e.skills);R&&(u=[R])}let d;if(Array.isArray(e.channels))d=En(e.channels);else{const R=Ie(e.channels);R&&(d=[R])}let p=0;const f=e.params??e.parameters??e.config;Lt(f)&&(p=Object.keys(f).length);const g={id:n,name:Ie(e.name)??n,description:Ie(e.description)??Ie(e.desc)??"",type:i,agent_hints:l,skills:u,depends_on:s,position:ide(e.position),params:p>0?{_count:String(p)}:void 0,assign:Ie(e.assign),disabled:Nn(e.disabled),compression:Nn(e.compression),retry:Cn(e.retry),retry_delay:Cn(e.retry_delay)??Cn(e.retryDelay),channel:Ie(e.channel),channels:d,condition:Ie(e.condition),on_true:Ie(e.on_true)??Ie(e.onTrue),on_false:Ie(e.on_false)??Ie(e.onFalse),on_true_value:Ie(e.on_true_value)??Ie(e.onTrueValue),on_false_value:Ie(e.on_false_value)??Ie(e.onFalseValue)},_=Lt(e.agent)?e.agent:void 0;if(_){g.agent_type=Ie(_.agent_type),g.role=Ie(_.role),g.template=Ie(_.template),g.prompt=Ie(_.prompt),g.timeout=Cn(_.timeout),g.model=Ie(_.model),g.agent_max_turns=Cn(_.max_turns);const R=Ie(_.tools);(R==="all"||R==="memory"||R==="google_agentops"||R==="none")&&(g.agent_tools=R),g.agent_required_tools=En(_.required_tools),g.agent_output_fields=En(_.output_fields);const U=Lt(_.quality_check)?_.quality_check:void 0;U&&(g.agent_quality_enabled=Nn(U.enabled),g.agent_quality_threshold=Cn(U.threshold),g.agent_quality_criteria=En(U.criteria),g.agent_quality_model=Ie(U.model)),Ie(_.auth)&&(g.auth=Ie(_.auth))}const x=Lt(e.parallel)?e.parallel:void 0;if(x){const R=En(x.steps);R&&R.length&&(g.parallel_steps=R),g.parallel_join=Ie(x.join),g.parallel_max_concurrency=Cn(x.max_concurrency)}const v=Lt(e.goto)?e.goto:void 0;v&&(g.goto_target=Ie(v.target),g.goto_max_iterations=Cn(v.max_iterations),g.goto_condition=Ie(v.condition));const S=Lt(e.group_chat)?e.group_chat:void 0;S&&(g.group_chat_topic=Ie(S.topic),g.group_chat_max_rounds=Cn(S.max_rounds),g.group_chat_participants=En(S.participants),g.group_chat_moderator=Ie(S.moderator),g.group_chat_strategy=Ie(S.strategy),g.group_chat_timeout=Cn(S.timeout));const w=Lt(e.supervisor)?e.supervisor:void 0;w&&(g.supervisor_task=Ie(w.task),g.supervisor_max_iterations=Cn(w.max_iterations),g.supervisor_type=Ie(w.supervisor_type),g.supervisor_templates=En(w.templates),g.supervisor_timeout=Cn(w.timeout));const N=Lt(e.shell)?e.shell:void 0;N&&(g.shell_command=Ie(N.command),g.shell_timeout=Cn(N.timeout),g.shell_allow_failure=Nn(N.allow_failure),Ie(N.auth)&&(g.auth=Ie(N.auth)));const C=Lt(e.python)?e.python:void 0;if(C){g.python_script=Ie(C.script),g.python_code=Ie(C.code);const R=C.args;if(typeof R=="string")g.python_args=R;else if(R!=null)try{g.python_args=JSON.stringify(R)}catch{}g.python_interpreter=Ie(C.python),g.python_timeout=Cn(C.timeout),g.python_allow_failure=Nn(C.allow_failure),Ie(C.auth)&&(g.auth=Ie(C.auth))}const T=Lt(e.compute)?e.compute:void 0;if(T&&Lt(T.outputs)){const R={};for(const[U,V]of Object.entries(T.outputs)){const ie=Ie(V);ie!==void 0&&(R[U]=ie)}Object.keys(R).length>0&&(g.compute_outputs=R)}const A=Lt(e.email)?e.email:void 0;if(A){g.email_to=Ie(A.to),g.email_subject=Ie(A.subject),g.email_body=Ie(A.body),g.email_body_html=Ie(A.body_html),g.email_from=Ie(A.from_address);const R=En(A.cc);if(R)g.email_cc=R.join(", ");else{const V=Ie(A.cc);V&&(g.email_cc=V)}const U=En(A.bcc);if(U)g.email_bcc=U.join(", ");else{const V=Ie(A.bcc);V&&(g.email_bcc=V)}g.email_reply_to=Ie(A.reply_to),g.email_track_clicks=Nn(A.track_clicks),g.email_track_kref=Ie(A.track_kref),g.email_track_secret_env=Ie(A.track_secret_env),g.email_track_base_url=Ie(A.track_base_url),g.email_smtp_host=Ie(A.smtp_host),g.email_smtp_port=Cn(A.smtp_port),g.email_smtp_tls=Nn(A.smtp_tls),g.email_smtp_username=Ie(A.smtp_username),g.email_smtp_password_env=Ie(A.smtp_password_env),g.email_dry_run=Nn(A.dry_run),g.email_timeout=Cn(A.timeout),Ie(A.auth)&&(g.auth=Ie(A.auth))}const E=Lt(e.image)?e.image:void 0;if(E){g.image_prompt=Ie(E.prompt),g.image_count=Cn(E.count);const R=E.canvas;typeof R=="boolean"?g.image_canvas=R:typeof R=="string"&&(g.image_canvas=R,g.image_canvas_target=R),g.image_register_artifact=Nn(E.register_artifact),g.image_space=Ie(E.space),g.image_item_name=Ie(E.item_name),g.image_output_path=Ie(E.output_path),g.image_output_pattern=Ie(E.output_pattern);const U=En(E.input_images);if(U)g.image_input_images=U;else{const V=Ie(E.input_images);V&&(g.image_input_images=[V])}g.image_sandbox=Ie(E.sandbox),g.image_cwd=Ie(E.cwd),g.image_timeout=Cn(E.timeout)}const D=Lt(e.output)?e.output:void 0;if(D&&(g.output_format=Ie(D.format),g.output_template=Ie(D.template),g.entity_name=Ie(D.entity_name),g.entity_kind=Ie(D.entity_kind),g.entity_tag=Ie(D.entity_tag),g.entity_space=Ie(D.entity_space),g.metadata_target=Ie(D.metadata_target),g.artifact_summary_model=Ie(D.artifact_summary_model),Lt(D.entity_metadata))){const R={};for(const[U,V]of Object.entries(D.entity_metadata)){const ie=Ie(V);ie!==void 0&&(R[U]=ie)}Object.keys(R).length&&(g.entity_metadata=R)}const F=Lt(e.notify)?e.notify:void 0;if(F){const R=En(F.channels);R&&R.length&&(g.channels=tA(R)),g.notify_channel_id=Ie(F.channel_id),g.notify_message=Ie(F.message),g.notify_title=Ie(F.title)}const B=Lt(e.handoff)?e.handoff:void 0;B&&(g.handoff_from=Ie(B.from_step),g.handoff_to=Ie(B.to_agent_type),g.handoff_reason=Ie(B.reason),g.handoff_task=Ie(B.task),g.handoff_timeout=Cn(B.timeout));const H=Lt(e.human_input)?e.human_input:void 0;H&&(g.human_input_message=Ie(H.message),g.human_input_timeout=Cn(H.timeout),Ie(H.channel)&&(g.channel=Ie(H.channel)));const $=Lt(e.human_approval)?e.human_approval:void 0;$&&(g.human_approval_message=Ie($.message),g.human_approval_timeout=Cn($.timeout),g.human_approval_channel=Ie($.channel),g.human_approval_channel_id=Ie($.channel_id),g.human_approval_on_reject_goto=Ie($.on_reject_goto),g.human_approval_on_reject_max=Cn($.on_reject_max),g.human_approval_approve_keywords=En($.approve_keywords),g.human_approval_reject_keywords=En($.reject_keywords));const z=Lt(e.a2a)?e.a2a:void 0;z&&(g.a2a_url=Ie(z.url),g.a2a_skill_id=Ie(z.skill_id),g.a2a_message=Ie(z.message),g.a2a_timeout=Cn(z.timeout),Ie(z.cloud_run_auth)==="gcloud"&&(g.a2a_cloud_run_auth="gcloud"),g.a2a_cloud_run_config=Ie(z.cloud_run_config),g.a2a_cloud_run_audience=Ie(z.cloud_run_audience),g.a2a_cloud_run_auth_timeout=Cn(z.cloud_run_auth_timeout),Ie(z.auth)&&(g.auth=Ie(z.auth)));const W=Lt(e.map_reduce)?e.map_reduce:void 0;W&&(g.map_reduce_task=Ie(W.task),g.map_reduce_mapper=Ie(W.mapper),g.map_reduce_reducer=Ie(W.reducer),g.map_reduce_concurrency=Cn(W.concurrency),g.map_reduce_timeout=Cn(W.timeout),g.map_reduce_splits=En(W.splits));const P=Lt(e.for_each)?e.for_each:void 0;P&&(g.for_each_steps=En(P.steps),g.for_each_range=Ie(P.range),g.for_each_items=En(P.items),g.for_each_variable=Ie(P.variable),g.for_each_carry_forward=Nn(P.carry_forward),g.for_each_fail_fast=Nn(P.fail_fast),g.for_each_max_iterations=Cn(P.max_iterations));const q=Lt(e.resolve)?e.resolve:void 0;q&&(g.resolve_kind=Ie(q.kind),g.resolve_tag=Ie(q.tag),g.resolve_name_pattern=Ie(q.name_pattern),g.resolve_space=Ie(q.space),g.resolve_artifact_name=Ie(q.artifact_name),g.resolve_mode=Ie(q.mode),g.resolve_fields=En(q.fields),g.resolve_metadata_source=Ie(q.metadata_source),g.resolve_fail_if_missing=Nn(q.fail_if_missing));const I=Lt(e.kumiho)?e.kumiho:void 0;if(I){g.kumiho_config=R$(I),g.kumiho_project=Ie(I.project),g.kumiho_mode=Ie(I.mode);const R=pa(I,"seed");R&&(g.kumiho_seed_bundles=En(R.bundles),g.kumiho_seed_krefs=En(R.krefs),g.kumiho_seed_queries=En(R.queries),Array.isArray(R.items)&&(g.kumiho_seed_items=R.items));const U=pa(I,"traversal");U&&(g.kumiho_traversal_max_depth=Cn(U.max_depth),g.kumiho_traversal_direction=Ie(U.direction),g.kumiho_traversal_edge_types=En(U.edge_types));const V=pa(I,"filters");V&&(g.kumiho_filters_include_kinds=En(V.include_kinds),g.kumiho_filters_exclude_tags=En(V.exclude_tags),g.kumiho_filters_max_items=Cn(V.max_items));const ie=pa(I,"ranking");ie&&(g.kumiho_ranking_method=Ie(ie.method),g.kumiho_ranking_semantic_query=Ie(ie.semantic_query));const te=pa(I,"lock");te&&(g.kumiho_lock_tag_preference=En(te.tag_preference));const X=pa(I,"output");X&&(g.kumiho_output_format=Ie(X.format),g.kumiho_output_include_artifact_summaries=Nn(X.include_artifact_summaries),g.kumiho_output_include_artifact_content=Nn(X.include_artifact_content),g.kumiho_output_max_artifact_chars_per_item=Cn(X.max_artifact_chars_per_item),g.kumiho_output_include_edge_map=Nn(X.include_edge_map),g.kumiho_output_include_conflict_warnings=Nn(X.include_conflict_warnings),g.kumiho_output_include_missing_context=Nn(X.include_missing_context)),g.kumiho_create_if_missing=Nn(I.create_if_missing),g.kumiho_idempotent=Nn(I.idempotent),g.kumiho_fail_if_missing_bundle=Nn(I.fail_if_missing_bundle),g.kumiho_fail_if_missing_item=Nn(I.fail_if_missing_item),g.kumiho_allow_protected=Nn(I.allow_protected),Array.isArray(I.updates)&&(g.kumiho_updates=I.updates),g.kumiho_patch_kref=Ie(I.patch_kref),g.kumiho_dry_run=Nn(I.dry_run),g.kumiho_allow_auto_apply=Nn(I.allow_auto_apply);const se=pa(I,"approval");se&&(g.kumiho_approval_required=Nn(se.required),g.kumiho_approval_approved=typeof se.approved=="boolean"?se.approved:Ie(se.approved),g.kumiho_approval_approved_by=Ie(se.approved_by),g.kumiho_approval_note=Ie(se.approval_note));const re=pa(I,"apply");re&&(g.kumiho_apply_create_revisions=Nn(re.create_revisions),g.kumiho_apply_create_edges=Nn(re.create_edges),g.kumiho_apply_update_tags=Nn(re.update_tags),g.kumiho_apply_untag_previous_current=Nn(re.untag_previous_current),g.kumiho_apply_update_bundles=Nn(re.update_bundles),g.kumiho_apply_save_apply_report=Nn(re.save_apply_report));const de=pa(I,"tag_policy");if(de){g.kumiho_new_revision_tags=En(de.new_revision_tags);const pe=pa(de,"patch_tags");pe&&(g.kumiho_patch_tags_remove=En(pe.remove),g.kumiho_patch_tags_add=En(pe.add))}const ue=pa(I,"bundle_policy");ue&&(g.kumiho_pending_patch_bundle=Ie(ue.pending_patch_bundle),g.kumiho_applied_patch_bundle=Ie(ue.applied_patch_bundle),g.kumiho_current_state_bundle=Ie(ue.current_state_bundle),g.kumiho_active_storyline_bundle=Ie(ue.active_storyline_bundle),g.kumiho_active_foreshadow_bundle=Ie(ue.active_foreshadow_bundle),g.kumiho_timeline_bundle=Ie(ue.timeline_bundle));const ae=pa(I,"evidence");ae&&(g.kumiho_require_evidence_locator=Nn(ae.require_evidence_locator),g.kumiho_source_episode_kref=Ie(ae.source_episode_kref),g.kumiho_source_context_pack_kref=Ie(ae.source_context_pack_kref))}const Q=Lt(e.tag_step)?e.tag_step:void 0;Q&&(g.tag_item_kref=Ie(Q.item_kref),g.tag_value=Ie(Q.tag),g.tag_untag=Ie(Q.untag));const K=Lt(e.deprecate_step)?e.deprecate_step:void 0;K&&(g.deprecate_item_kref=Ie(K.item_kref),g.deprecate_reason=Ie(K.reason));const Z=Lt(e.manus)?e.manus:void 0;if(Z){if(g.manus_prompt=Ie(Z.prompt),Z.structured_output_schema!==void 0&&Z.structured_output_schema!==null)try{g.manus_structured_output_schema=JSON.stringify(Z.structured_output_schema,null,2)}catch{}g.manus_connectors=En(Z.connectors),g.manus_enable_skills=En(Z.enable_skills),g.manus_force_skills=En(Z.force_skills),g.manus_agent_profile=Ie(Z.agent_profile),g.manus_locale=Ie(Z.locale),g.manus_project_id=Ie(Z.project_id),g.manus_title=Ie(Z.title),g.manus_timeout_seconds=Cn(Z.timeout_seconds),g.manus_poll_interval_seconds=Cn(Z.poll_interval_seconds),g.manus_allow_failure=Nn(Z.allow_failure),g.manus_credentials_ref=Ie(Z.credentials_ref);const R=Lt(Z.register_output)?Z.register_output:void 0;if(R){g.manus_register_enabled=!0,g.manus_register_entity_name=Ie(R.entity_name),g.manus_register_entity_kind=Ie(R.entity_kind);const U=Ie(R.entity_tag);U&&(g.manus_register_entity_tag=U);const V=Ie(R.entity_space);V&&(g.manus_register_entity_space=V),R.register_attachments===!1?g.manus_register_attachments=!1:R.register_attachments===!0&&(g.manus_register_attachments=!0);const ie=Ie(R.content_source);(ie==="structured"||ie==="message")&&(g.manus_register_content_source=ie)}}const Y=Lt(e.conditional)?e.conditional:void 0;if(Y&&Array.isArray(Y.branches)){const R=[];for(const U of Y.branches){if(!Lt(U))continue;const V=Ie(U.condition),ie=Ie(U.goto),te=Ie(U.value);ie&&R.push(Km({condition:V??"",goto:ie,value:te||void 0}))}R.length>0&&(g.conditional_branches=R,Object.assign(g,O$(R)))}if(!g.auth){const R=Ie(e.auth);R&&(g.auth=R)}return g}function Kh(e){const n={name:"",version:"1.0",description:"",tags:[],triggers:[],inputs:[],outputs:[],defaultCwd:"",defaultTimeout:300,maxTotalTime:3600,checkpoint:!0},r=e.split(`
`);let i=0;for(;i<r.length;){const a=r[i].trim();if(/^steps\s*:/.test(a))break;const o=a.match(/^(\w[\w_]*):\s*(.*)/);if(o){const l=o[1],u=(o[2]??"").trim().replace(/^["']|["']$/g,"");if(l==="name")n.name=u;else if(l==="version")n.version=u;else if(l==="description")if(u.startsWith(">")||u.startsWith("|")){let d="";for(i++;i<r.length&&r[i].match(/^\s+\S/);)d+=(d?" ":"")+r[i].trim(),i++;n.description=d;continue}else n.description=u;else if(l==="tags")u.startsWith("[")&&(n.tags=u.slice(1,-1).split(",").map(d=>d.trim().replace(/["']/g,"")).filter(Boolean));else if(l==="default_cwd")n.defaultCwd=u;else if(l==="default_timeout")n.defaultTimeout=parseFloat(u)||300;else if(l==="max_total_time")n.maxTotalTime=parseFloat(u)||3600;else if(l==="checkpoint")n.checkpoint=u!=="false";else if(l==="triggers"){for(i++;i<r.length;){const d=r[i],p=d.trim();if(p.startsWith("- on_kind:")||p.startsWith("- cron:")){const f={onKind:"",onTag:"ready",onNamePattern:"",onSpace:"",inputMap:{}};for(p.startsWith("- on_kind:")?f.onKind=p.replace(/^-\s*on_kind:\s*/,"").replace(/["']/g,"").trim():p.startsWith("- cron:")&&(f.inputMap.__cron=p.replace(/^-\s*cron:\s*/,"").replace(/["']/g,"").trim()),i++;i<r.length;){const g=r[i].trim();if(!g||g.startsWith("- ")||!r[i].match(/^\s/))break;if(g.startsWith("#")){i++;continue}const _=g.match(/^(\w[\w_]*):\s*(.*)/);if(_){const x=_[1],v=(_[2]??"").trim().replace(/^["']|["']$/g,"");if(x==="on_tag")f.onTag=v;else if(x==="on_name_pattern")f.onNamePattern=v;else if(x==="on_space")f.onSpace=v;else if(x==="on_kind")f.onKind=v;else if(x==="cron")f.inputMap.__cron=v;else if(x==="input_map"){for(i++;i<r.length;){const S=r[i].trim();if(!S||!r[i].match(/^\s{4,}/))break;if(S.startsWith("#")){i++;continue}const w=S.match(/^(\w[\w_]*):\s*(.*)/);w&&(f.inputMap[w[1]]=(w[2]??"").trim().replace(/^["']|["']$/g,"")),i++}continue}}i++}n.triggers.push(f);continue}if(p&&!d.match(/^\s/)&&!p.startsWith("#"))break;if(!p){i++;continue}i++}continue}else if(l==="inputs"){for(i++;i<r.length;){const d=r[i],p=d.trim();if(p.startsWith("- name:")){const f={name:p.replace(/^-\s*name:\s*/,"").replace(/["']/g,"").trim(),type:"string",required:!0,default:"",description:""};for(i++;i<r.length;){const g=r[i].trim();if(!g||g.startsWith("- ")||!r[i].match(/^\s/))break;if(g.startsWith("#")){i++;continue}const _=g.match(/^(\w[\w_]*):\s*(.*)/);if(_){const x=_[1],v=(_[2]??"").trim().replace(/^["']|["']$/g,"");x==="type"?f.type=v:x==="required"?f.required=v!=="false":x==="default"?f.default=v:x==="description"&&(f.description=v)}i++}f.name&&n.inputs.push(f);continue}if(p&&!d.match(/^\s/)&&!p.startsWith("#"))break;i++}continue}else if(l==="outputs"){for(i++;i<r.length;){const d=r[i],p=d.trim();if(p.startsWith("- name:")){const f={name:p.replace(/^-\s*name:\s*/,"").replace(/["']/g,"").trim(),source:"",description:""};for(i++;i<r.length;){const g=r[i].trim();if(!g||g.startsWith("- ")||!r[i].match(/^\s/))break;if(g.startsWith("#")){i++;continue}const _=g.match(/^(\w[\w_]*):\s*(.*)/);if(_){const x=_[1],v=(_[2]??"").trim().replace(/^["']|["']$/g,"");x==="source"?f.source=v:x==="description"&&(f.description=v)}i++}n.outputs.push(f);continue}if(p&&!d.match(/^\s/)&&!p.startsWith("#"))break;i++}continue}}i++}return n}function tA(e){const n=new Set,r=[];for(const i of e){const s=i.toLowerCase();n.has(s)||(n.add(s),r.push(i))}return r}const hi={true:{stroke:"var(--revka-status-success)",strokeWidth:2},false:{stroke:"var(--revka-status-danger)",strokeWidth:2},default:{stroke:"var(--revka-signal-selected)",strokeWidth:2}};function Zc(e){return`branch-${e}`}function vv(e){if(!e)return null;if(e==="true")return 0;if(e==="false")return 1;const n=/^branch-(\d+)$/.exec(e);return n?Number(n[1]):null}function Yh(e){return e==="true"||e==="false"||vv(e)!==null}function _0(e,n){return e.condition.trim()==="default"?"default":n===0?"true":`case ${n+1}`}function wf(e,n){return e.condition.trim()==="default"?hi.false:n===0?hi.true:hi.default}function Zw(e){return e==="true"?hi.true:e==="false"?hi.false:(vv(e)!==null,hi.default)}function cx(e){if(e.conditional_branches&&e.conditional_branches.length>0)return e.conditional_branches.map(Km).filter(r=>r.goto);const n=[];return e.condition&&e.on_true&&n.push(Km({condition:e.condition,goto:e.on_true,value:e.on_true_value||void 0})),e.on_false&&n.push(Km({condition:"default",goto:e.on_false,value:e.on_false_value||void 0})),n}function O$(e){const n=e.find(i=>i.condition!=="default"),r=e.find(i=>i.condition==="default")??e.find(i=>i!==n);return{condition:n==null?void 0:n.condition,on_true:n==null?void 0:n.goto,on_false:r==null?void 0:r.goto,on_true_value:n==null?void 0:n.value,on_false_value:r==null?void 0:r.value}}function ad(e){const n=p=>p.type==="conditional",r=e.map((p,f)=>({id:p.id,type:n(p)?"gateNode":"taskNode",position:p.position??{x:0,y:f*150},width:n(p)?220:280,height:n(p)?Math.max(96,86+cx(p).length*24):140,data:{label:p.name||p.id,taskId:p.id,name:p.name||p.id,description:p.description,type:p.type,agentHints:p.agent_hints,skills:p.skills,disabled:p.disabled??!1,compression:p.compression??!1,assign:p.assign||"",template:p.template||"",paramCount:p.params?Object.keys(p.params).length:0,dependencyCount:p.depends_on.length,condition:p.condition||"",onTrueValue:p.on_true_value||"",onFalseValue:p.on_false_value||"",conditionalBranches:cx(p),channel:p.channel||"",channels:p.channels||[],agentType:p.agent_type||"",role:p.role||"",prompt:p.prompt||"",timeout:p.timeout||300,agentMaxTurns:p.agent_max_turns??3,agentTools:p.agent_tools??"none",agentRequiredTools:p.agent_required_tools||[],agentOutputFields:p.agent_output_fields||[],agentQualityEnabled:p.agent_quality_enabled??!1,agentQualityThreshold:p.agent_quality_threshold??.7,agentQualityCriteria:p.agent_quality_criteria||[],agentQualityModel:p.agent_quality_model||"claude-haiku-4-5-20251001",parallelJoin:p.parallel_join||"all",gotoTarget:p.goto_target||"",gotoMaxIterations:p.goto_max_iterations||3,groupChatTopic:p.group_chat_topic||"",groupChatParticipants:p.group_chat_participants||[],groupChatMaxRounds:p.group_chat_max_rounds||8,supervisorTask:p.supervisor_task||"",supervisorMaxIterations:p.supervisor_max_iterations||5,supervisorTemplates:p.supervisor_templates||[],shellCommand:p.shell_command||"",outputFormat:p.output_format||"markdown",entityName:p.entity_name||"",entityKind:p.entity_kind||"",entityTag:p.entity_tag||"",entitySpace:p.entity_space||"",entityMetadata:p.entity_metadata||{},entityMetadataTarget:p.metadata_target||"item",artifactSummaryModel:p.artifact_summary_model||"",handoffFrom:p.handoff_from||"",handoffTo:p.handoff_to||"",handoffReason:p.handoff_reason||"",retry:p.retry||0,retryDelay:p.retry_delay||5,model:p.model||"",shellTimeout:p.shell_timeout||60,shellAllowFailure:p.shell_allow_failure||!1,gotoCondition:p.goto_condition||"",parallelMaxConcurrency:p.parallel_max_concurrency||5,humanInputMessage:p.human_input_message||"",humanInputTimeout:p.human_input_timeout||3600,humanApprovalMessage:p.human_approval_message||"",humanApprovalTimeout:p.human_approval_timeout||3600,humanApprovalChannel:p.human_approval_channel||"dashboard",humanApprovalChannelId:p.human_approval_channel_id||"",humanApprovalOnRejectGoto:p.human_approval_on_reject_goto||"",humanApprovalOnRejectMax:p.human_approval_on_reject_max||3,humanApprovalApproveKeywords:p.human_approval_approve_keywords||["approve","approved","yes","lgtm"],humanApprovalRejectKeywords:p.human_approval_reject_keywords||["reject","rejected","no"],outputTemplate:p.output_template||"",a2aUrl:p.a2a_url||"",a2aSkillId:p.a2a_skill_id||"",a2aMessage:p.a2a_message||"",a2aTimeout:p.a2a_timeout||300,a2aCloudRunAuth:p.a2a_cloud_run_auth||"",a2aCloudRunConfig:p.a2a_cloud_run_config||"",a2aCloudRunAudience:p.a2a_cloud_run_audience||"",a2aCloudRunAuthTimeout:p.a2a_cloud_run_auth_timeout||20,mapReduceTask:p.map_reduce_task||"",mapReduceSplits:p.map_reduce_splits||[],mapReduceMapper:p.map_reduce_mapper||"claude",mapReduceReducer:p.map_reduce_reducer||"claude",mapReduceConcurrency:p.map_reduce_concurrency||3,mapReduceTimeout:p.map_reduce_timeout||300,supervisorType:p.supervisor_type||"claude",supervisorTimeout:p.supervisor_timeout||300,groupChatModerator:p.group_chat_moderator||"claude",groupChatStrategy:p.group_chat_strategy||"moderator_selected",groupChatTimeout:p.group_chat_timeout||120,handoffTask:p.handoff_task||"",handoffTimeout:p.handoff_timeout||300,resolveKind:p.resolve_kind??"",resolveTag:p.resolve_tag??"published",resolveNamePattern:p.resolve_name_pattern??"",resolveSpace:p.resolve_space??"",resolveArtifactName:p.resolve_artifact_name??"",resolveMode:p.resolve_mode??"latest",resolveFields:p.resolve_fields??[],resolveMetadataSource:p.resolve_metadata_source??"revision",resolveFailIfMissing:p.resolve_fail_if_missing??!0,kumihoConfig:p.kumiho_config??{},kumihoProject:p.kumiho_project??"",kumihoMode:p.kumiho_mode??(p.type==="kumiho_bundle_update"?"add_members":"graph_augmented_context"),kumihoSeedBundles:p.kumiho_seed_bundles??[],kumihoSeedKrefs:p.kumiho_seed_krefs??[],kumihoSeedQueries:p.kumiho_seed_queries??[],kumihoSeedItems:p.kumiho_seed_items??[],kumihoTraversalMaxDepth:p.kumiho_traversal_max_depth??2,kumihoTraversalDirection:p.kumiho_traversal_direction??"both",kumihoTraversalEdgeTypes:p.kumiho_traversal_edge_types??["DEPENDS_ON","REFERENCES","ADVANCES","UPDATES","CONTRADICTS"],kumihoFiltersIncludeKinds:p.kumiho_filters_include_kinds??[],kumihoFiltersExcludeTags:p.kumiho_filters_exclude_tags??["deprecated"],kumihoFiltersMaxItems:p.kumiho_filters_max_items??50,kumihoRankingMethod:p.kumiho_ranking_method??"hybrid",kumihoRankingSemanticQuery:p.kumiho_ranking_semantic_query??"",kumihoLockTagPreference:p.kumiho_lock_tag_preference??["current","active","production-ready","ready","published","latest"],kumihoOutputFormat:p.kumiho_output_format??"context_pack",kumihoOutputIncludeArtifactSummaries:p.kumiho_output_include_artifact_summaries??!0,kumihoOutputIncludeArtifactContent:p.kumiho_output_include_artifact_content??!1,kumihoOutputMaxArtifactCharsPerItem:p.kumiho_output_max_artifact_chars_per_item??3e3,kumihoOutputIncludeEdgeMap:p.kumiho_output_include_edge_map??!0,kumihoOutputIncludeConflictWarnings:p.kumiho_output_include_conflict_warnings??!0,kumihoOutputIncludeMissingContext:p.kumiho_output_include_missing_context??!0,kumihoCreateIfMissing:p.kumiho_create_if_missing??!1,kumihoIdempotent:p.kumiho_idempotent??!0,kumihoFailIfMissingBundle:p.kumiho_fail_if_missing_bundle??!0,kumihoFailIfMissingItem:p.kumiho_fail_if_missing_item??!0,kumihoAllowProtected:p.kumiho_allow_protected??!1,kumihoUpdates:p.kumiho_updates??[],kumihoPatchKref:p.kumiho_patch_kref??"",kumihoDryRun:p.kumiho_dry_run??!0,kumihoAllowAutoApply:p.kumiho_allow_auto_apply??!1,kumihoApprovalRequired:p.kumiho_approval_required??!0,kumihoApprovalApproved:p.kumiho_approval_approved??!1,kumihoApprovalApprovedBy:p.kumiho_approval_approved_by??"",kumihoApprovalNote:p.kumiho_approval_note??"",kumihoApplyCreateRevisions:p.kumiho_apply_create_revisions??!0,kumihoApplyCreateEdges:p.kumiho_apply_create_edges??!0,kumihoApplyUpdateTags:p.kumiho_apply_update_tags??!0,kumihoApplyUntagPreviousCurrent:p.kumiho_apply_untag_previous_current??!0,kumihoApplyUpdateBundles:p.kumiho_apply_update_bundles??!0,kumihoApplySaveApplyReport:p.kumiho_apply_save_apply_report??!0,kumihoNewRevisionTags:p.kumiho_new_revision_tags??["current","approved"],kumihoPatchTagsRemove:p.kumiho_patch_tags_remove??["candidate"],kumihoPatchTagsAdd:p.kumiho_patch_tags_add??["applied"],kumihoPendingPatchBundle:p.kumiho_pending_patch_bundle??"",kumihoAppliedPatchBundle:p.kumiho_applied_patch_bundle??"",kumihoCurrentStateBundle:p.kumiho_current_state_bundle??"",kumihoActiveStorylineBundle:p.kumiho_active_storyline_bundle??"",kumihoActiveForeshadowBundle:p.kumiho_active_foreshadow_bundle??"",kumihoTimelineBundle:p.kumiho_timeline_bundle??"",kumihoRequireEvidenceLocator:p.kumiho_require_evidence_locator??!0,kumihoSourceEpisodeKref:p.kumiho_source_episode_kref??"",kumihoSourceContextPackKref:p.kumiho_source_context_pack_kref??"",forEachSteps:p.for_each_steps||[],forEachRange:p.for_each_range||"",forEachItems:p.for_each_items||[],forEachVariable:p.for_each_variable||"item",forEachCarryForward:p.for_each_carry_forward??!0,forEachFailFast:p.for_each_fail_fast??!0,forEachMaxIterations:p.for_each_max_iterations||20,notifyMessage:p.notify_message||"",notifyTitle:p.notify_title||"",notifyChannelId:p.notify_channel_id||"",pythonScript:p.python_script||"",pythonCode:p.python_code||"",pythonArgs:p.python_args||"",pythonInterpreter:p.python_interpreter||"",pythonTimeout:p.python_timeout||60,pythonAllowFailure:p.python_allow_failure||!1,computeOutputs:p.compute_outputs||{},emailTo:p.email_to||"",emailSubject:p.email_subject||"",emailBody:p.email_body||"",emailBodyHtml:p.email_body_html||"",emailFrom:p.email_from||"",emailCc:p.email_cc||"",emailBcc:p.email_bcc||"",emailReplyTo:p.email_reply_to||"",emailTrackClicks:p.email_track_clicks||!1,emailTrackKref:p.email_track_kref||"",emailTrackSecretEnv:p.email_track_secret_env||"",emailTrackBaseUrl:p.email_track_base_url||"",emailSmtpHost:p.email_smtp_host||"",emailSmtpPort:p.email_smtp_port||0,emailSmtpTls:p.email_smtp_tls??!0,emailSmtpUsername:p.email_smtp_username||"",emailSmtpPasswordEnv:p.email_smtp_password_env||"",emailDryRun:p.email_dry_run||!1,emailTimeout:p.email_timeout||30,imagePrompt:p.image_prompt||"",imageCount:p.image_count??1,imageCanvas:p.image_canvas!==!1,imageCanvasTarget:p.image_canvas_target||(typeof p.image_canvas=="string"?p.image_canvas:""),imageRegisterArtifact:p.image_register_artifact!==!1,imageSpace:p.image_space||"",imageItemName:p.image_item_name||"",imageOutputPath:p.image_output_path||"",imageOutputPattern:p.image_output_pattern||"",imageInputImages:p.image_input_images||[],imageSandbox:p.image_sandbox||"",imageCwd:p.image_cwd||"",imageTimeout:p.image_timeout||1200,tagItemKref:p.tag_item_kref||"",tagValue:p.tag_value||"",tagUntag:p.tag_untag||"",deprecateItemKref:p.deprecate_item_kref||"",deprecateReason:p.deprecate_reason||"",manusPrompt:p.manus_prompt||"",manusStructuredOutputSchema:p.manus_structured_output_schema||"",manusConnectors:p.manus_connectors||[],manusEnableSkills:p.manus_enable_skills||[],manusForceSkills:p.manus_force_skills||[],manusAgentProfile:p.manus_agent_profile||"",manusLocale:p.manus_locale||"",manusProjectId:p.manus_project_id||"",manusTitle:p.manus_title||"",manusTimeoutSeconds:p.manus_timeout_seconds??600,manusPollIntervalSeconds:p.manus_poll_interval_seconds??5,manusAllowFailure:p.manus_allow_failure||!1,manusCredentialsRef:p.manus_credentials_ref||"",manusRegisterEnabled:p.manus_register_enabled===!0,manusRegisterEntityName:p.manus_register_entity_name||"",manusRegisterEntityKind:p.manus_register_entity_kind||"",manusRegisterEntityTag:p.manus_register_entity_tag||"",manusRegisterEntitySpace:p.manus_register_entity_space||"",manusRegisterAttachments:p.manus_register_attachments!==!1,manusRegisterContentSource:p.manus_register_content_source||"message",auth:p.auth||""}})),i=[],s=new Set(e.map(p=>p.id)),a=new Set,o=p=>{const f=`${p.source}:${p.sourceHandle??""}->${p.target}`;a.has(f)||(a.add(f),i.push(p))},l=new Map;for(const p of e)if(p.parallel_steps&&p.parallel_steps.length>0){const f=p.parallel_steps.filter(g=>s.has(g));f.length>0&&l.set(p.id,f)}const u=new Map,d=new Map;for(const p of e)if(p.for_each_steps&&p.for_each_steps.length>0){const f=p.for_each_steps.filter(g=>s.has(g));if(f.length>0){u.set(p.id,f);for(const g of f)d.set(g,p.id)}}for(const p of e)for(const f of p.depends_on){if(d.get(p.id)===f)continue;const g=l.get(f);if(g)for(const _ of g)o({id:`${_}->${p.id}`,source:_,target:p.id,type:"default",animated:!1,selectable:!0,interactionWidth:20,style:hi.default});else if(u.has(f)){const _=u.get(f),x=_[_.length-1];o({id:`${x}->${p.id}`,source:x,target:p.id,type:"default",animated:!1,selectable:!0,interactionWidth:20,style:hi.default})}else s.has(f)&&o({id:`${f}->${p.id}`,source:f,target:p.id,type:"default",animated:!1,selectable:!0,interactionWidth:20,style:hi.default})}for(const[p,f]of l)for(const g of f)o({id:`par:${p}->${g}`,source:p,target:g,type:"default",animated:!1,selectable:!0,interactionWidth:20,style:hi.default,data:{synthetic:!0}});for(const[p,f]of u)for(let g=0;g<f.length;g++){const _=f[g];if(g===0)o({id:`fe:${p}->${_}`,source:p,target:_,type:"default",animated:!1,selectable:!0,interactionWidth:20,style:{stroke:"var(--revka-signal-live)",strokeWidth:2},data:{synthetic:!0}});else{const x=f[g-1];o({id:`fe:${x}->${_}`,source:x,target:_,type:"default",animated:!1,selectable:!0,interactionWidth:20,style:{stroke:"var(--revka-signal-live)",strokeWidth:2},data:{synthetic:!0}})}}for(const p of e){if(!n(p))continue;cx(p).forEach((g,_)=>{if(!s.has(g.goto))return;const x=Zc(_),v=wf(g,_),S=_0(g,_);o({id:`${p.id}->${x}->${g.goto}`,source:p.id,sourceHandle:x,target:g.goto,type:"default",animated:!1,selectable:!0,interactionWidth:20,style:v,label:S,labelStyle:{fill:v.stroke,fontSize:10,fontWeight:600}})})}for(const p of e){const f=hde(p,s);for(const g of f)g!==p.id&&d.get(p.id)!==g&&o({id:`ref:${g}->${p.id}`,source:g,target:p.id,type:"default",animated:!1,selectable:!0,interactionWidth:20,style:hi.default,data:{inferred:"interpolation"}})}return{nodes:r,edges:i}}function ode(e,n="kumiho_context"){var d;const r=Lt(e.kumihoConfig)?R$(e.kumihoConfig)??{}:{};if(n==="kumiho_bundle_update")return{...r,project:e.kumihoProject||"",mode:e.kumihoMode||"add_members",create_if_missing:e.kumihoCreateIfMissing??!1,idempotent:e.kumihoIdempotent??!0,fail_if_missing_bundle:e.kumihoFailIfMissingBundle??!0,fail_if_missing_item:e.kumihoFailIfMissingItem??!0,allow_protected:e.kumihoAllowProtected??!1,updates:e.kumihoUpdates||[]};if(n==="kumiho_patch_apply"){const p=Lt(r.approval)?{...r.approval}:{},f=Lt(r.apply)?{...r.apply}:{},g=Lt(r.tag_policy)?{...r.tag_policy}:{},_=Lt(g.patch_tags)?{...g.patch_tags}:{},x=Lt(r.bundle_policy)?{...r.bundle_policy}:{},v=Lt(r.evidence)?{...r.evidence}:{};return p.required=e.kumihoApprovalRequired??!0,p.approved=e.kumihoApprovalApproved??!1,p.approved_by=e.kumihoApprovalApprovedBy||"",p.approval_note=e.kumihoApprovalNote||"",f.create_revisions=e.kumihoApplyCreateRevisions??!0,f.create_edges=e.kumihoApplyCreateEdges??!0,f.update_tags=e.kumihoApplyUpdateTags??!0,f.untag_previous_current=e.kumihoApplyUntagPreviousCurrent??!0,f.update_bundles=e.kumihoApplyUpdateBundles??!0,f.save_apply_report=e.kumihoApplySaveApplyReport??!0,g.new_revision_tags=e.kumihoNewRevisionTags||["current","approved"],_.remove=e.kumihoPatchTagsRemove||["candidate"],_.add=e.kumihoPatchTagsAdd||["applied"],g.patch_tags=_,x.pending_patch_bundle=e.kumihoPendingPatchBundle||"",x.applied_patch_bundle=e.kumihoAppliedPatchBundle||"",x.current_state_bundle=e.kumihoCurrentStateBundle||"",x.active_storyline_bundle=e.kumihoActiveStorylineBundle||"",x.active_foreshadow_bundle=e.kumihoActiveForeshadowBundle||"",x.timeline_bundle=e.kumihoTimelineBundle||"",v.require_evidence_locator=e.kumihoRequireEvidenceLocator??!0,v.source_episode_kref=e.kumihoSourceEpisodeKref||"",v.source_context_pack_kref=e.kumihoSourceContextPackKref||"",{...r,project:e.kumihoProject||"",patch_kref:e.kumihoPatchKref||"",dry_run:e.kumihoDryRun??!0,allow_auto_apply:e.kumihoAllowAutoApply??!1,approval:p,apply:f,tag_policy:g,bundle_policy:x,evidence:v}}const i=Lt(r.seed)?{...r.seed}:{},s=Lt(r.traversal)?{...r.traversal}:{},a=Lt(r.filters)?{...r.filters}:{},o=Lt(r.ranking)?{...r.ranking}:{},l=Lt(r.lock)?{...r.lock}:{},u=Lt(r.output)?{...r.output}:{};return i.bundles=e.kumihoSeedBundles||[],i.krefs=e.kumihoSeedKrefs||[],i.queries=e.kumihoSeedQueries||[],(d=e.kumihoSeedItems)!=null&&d.length&&(i.items=e.kumihoSeedItems),s.max_depth=e.kumihoTraversalMaxDepth??2,s.direction=e.kumihoTraversalDirection||"both",s.edge_types=e.kumihoTraversalEdgeTypes||[],a.include_kinds=e.kumihoFiltersIncludeKinds||[],a.exclude_tags=e.kumihoFiltersExcludeTags||["deprecated"],a.max_items=e.kumihoFiltersMaxItems??50,o.method=e.kumihoRankingMethod||"hybrid",o.semantic_query=e.kumihoRankingSemanticQuery||"",o.prefer_recent=o.prefer_recent??!0,o.prefer_current_tags=o.prefer_current_tags??!0,l.revisions=l.revisions??!0,l.tag_preference=e.kumihoLockTagPreference||[],u.format=e.kumihoOutputFormat||"context_pack",u.include_artifact_summaries=e.kumihoOutputIncludeArtifactSummaries??!0,u.include_artifact_content=e.kumihoOutputIncludeArtifactContent??!1,u.max_artifact_chars_per_item=e.kumihoOutputMaxArtifactCharsPerItem??3e3,u.include_edge_map=e.kumihoOutputIncludeEdgeMap??!0,u.include_conflict_warnings=e.kumihoOutputIncludeConflictWarnings??!0,u.include_missing_context=e.kumihoOutputIncludeMissingContext??!0,{...r,project:e.kumihoProject||"",mode:e.kumihoMode||"graph_augmented_context",seed:i,traversal:s,filters:a,ranking:o,lock:l,output:u}}const lde=["prompt","shell_command","python_code","python_args","python_script","email_body","email_body_html","email_subject","email_to","email_cc","email_bcc","image_prompt","output_template","entity_name","entity_kind","entity_tag","entity_space","resolve_kind","resolve_tag","resolve_name_pattern","resolve_space","resolve_artifact_name","condition","goto_condition","human_input_message","human_approval_message","notify_message","notify_title","group_chat_topic","supervisor_task","a2a_url","a2a_message","a2a_cloud_run_config","a2a_cloud_run_audience","map_reduce_task","handoff_reason","manus_prompt","manus_title"],Y4=new Set(["input","inputs","trigger","env","outputs","context","loop","for_each","previous","rejection","run_id"]),G4=/\$\{(?!\{)([a-zA-Z_][a-zA-Z0-9_-]*)(?:\.[a-zA-Z_][a-zA-Z0-9_.-]*)?\}/g,X4=/\$\{\{\s*([\s\S]*?)\s*\}\}/g;function cde(e){return/[A-Za-z_]/.test(e)}function ude(e){return/[A-Za-z0-9_-]/.test(e)}function dde(e){const n=new Set;let r=null;for(let i=0;i<e.length;){const s=e[i];if(r){if(s==="\\"){i+=2;continue}s===r&&(r=null),i+=1;continue}if(s==='"'||s==="'"){r=s,i+=1;continue}if(!cde(s)){i+=1;continue}const a=i;for(i+=1;i<e.length&&ude(e[i]);)i+=1;const o=e.slice(a,i),l=a>0?e[a-1]:"";if(l&&/[A-Za-z0-9_.]/.test(l))continue;let u=i;for(;u<e.length&&/\s/.test(e[u]);)u+=1;e[u]==="."&&n.add(o)}return[...n]}function Jy(e,n,r,i){G4.lastIndex=0;let s;for(;(s=G4.exec(e))!==null;){const o=s[1],l=i.get(o)??o;Y4.has(o)||n.has(l)&&r.add(l)}X4.lastIndex=0;let a;for(;(a=X4.exec(e))!==null;){const o=a[1]??"";for(const l of dde(o)){const u=i.get(l)??l;Y4.has(l)||n.has(u)&&r.add(u)}}}function hde(e,n){const r=new Set,i=new Map;for(const s of n){const a=s.replace(/-/g,"_");a!==s&&!n.has(a)&&i.set(a,s)}for(const s of lde){const a=e[s];typeof a!="string"||!a||Jy(a,n,r,i)}if(e.compute_outputs)for(const s of Object.values(e.compute_outputs))typeof s=="string"&&s&&Jy(s,n,r,i);if(e.entity_metadata)for(const s of Object.values(e.entity_metadata))typeof s=="string"&&s&&Jy(s,n,r,i);if(e.kumiho_config){const s=a=>{typeof a=="string"&&a?Jy(a,n,r,i):Array.isArray(a)?a.forEach(s):Lt(a)&&Object.values(a).forEach(s)};s(e.kumiho_config)}return r}function fde(e,n){const r=new Map(e.map(u=>[u.id,u]));if(!r.has(n))return[];const i=new Map;for(const u of e){if(u.type==="parallel"&&u.parallel_steps)for(const d of u.parallel_steps)i.has(d)||i.set(d,new Set),i.get(d).add(u.id);if(u.type==="for_each"&&u.for_each_steps)for(const d of u.for_each_steps)i.has(d)||i.set(d,new Set),i.get(d).add(u.id)}const s=new Set,a=new Set,o=[n];for(;o.length>0;){const u=o.pop();if(a.has(u))continue;a.add(u);const d=r.get(u);if(!d)continue;for(const f of d.depends_on){const g=r.get(f);g&&(g.type==="parallel"||g.type==="for_each")&&s.add(f),!a.has(f)&&r.has(f)&&o.push(f)}const p=i.get(u);if(p)for(const f of p)a.has(f)||o.push(f)}const l=[];for(const u of s){const d=r.get(u);if(d){if(d.type==="parallel"&&d.parallel_steps)for(const p of d.parallel_steps)a.has(p)||l.push(p);if(d.type==="for_each"&&d.for_each_steps)for(const p of d.for_each_steps)a.has(p)||l.push(p)}}for(;l.length>0;){const u=l.pop();if(a.has(u))continue;a.add(u);const d=r.get(u);if(!d)continue;for(const f of d.depends_on){const g=r.get(f);if(g&&(g.type==="parallel"||g.type==="for_each")&&!s.has(f)){if(s.add(f),g.type==="parallel"&&g.parallel_steps)for(const _ of g.parallel_steps)a.has(_)||l.push(_);if(g.type==="for_each"&&g.for_each_steps)for(const _ of g.for_each_steps)a.has(_)||l.push(_)}!a.has(f)&&r.has(f)&&l.push(f)}const p=i.get(u);if(p)for(const f of p)a.has(f)||l.push(f)}return e.filter(u=>a.has(u.id)).map(u=>u.id)}function jo(e,n){const r=new Map,i=new Map,s=new Map,a=new Map,o=new Map,l=new Set(e.filter(p=>p.data.type==="parallel").map(p=>p.id)),u=new Map(e.map(p=>[p.id,p.data.taskId])),d=new Map;for(const p of e)if(p.data.type==="for_each")for(const f of p.data.forEachSteps??[])d.set(f,p.id);for(const p of n){const f=p.data;if((f==null?void 0:f.inferred)==="interpolation")continue;if(l.has(p.source)){const _=u.get(p.target);if(_){const x=o.get(p.source)||[];x.includes(_)||x.push(_),o.set(p.source,x)}continue}if(f!=null&&f.synthetic)continue;const g=vv(p.sourceHandle);if(g!==null){const _=a.get(p.source)??new Map;_.set(g,p.target),a.set(p.source,_)}else if(p.sourceHandle==="true")i.set(p.source,p.target);else if(p.sourceHandle==="false")s.set(p.source,p.target);else{const _=u.get(p.target)??p.target;if(d.get(_)===p.source)continue;const x=r.get(p.target)||[];x.push(p.source),r.set(p.target,x)}}return e.map(p=>{var S,w,N,C,T,A,E,D,F,B;const f=p.data,g=f.type||"agent",_=g==="conditional"?(()=>{const H=(f.conditionalBranches&&f.conditionalBranches.length>0?f.conditionalBranches:[...f.condition?[{condition:f.condition,goto:"",value:f.onTrueValue||void 0}]:[],...f.onFalseValue?[{condition:"default",goto:"",value:f.onFalseValue}]:[]]).map(P=>({...P})),$=a.get(p.id);if($)for(const[P,q]of $)H[P]&&(H[P]={...H[P],goto:q});const z=i.get(p.id);if(z){const P=H.findIndex(q=>q.condition!=="default");P>=0?H[P]={...H[P],goto:z}:H.unshift({condition:f.condition||"true",goto:z,value:f.onTrueValue||void 0})}const W=s.get(p.id);if(W){const P=H.findIndex(q=>q.condition==="default");P>=0?H[P]={...H[P],goto:W}:H.push({condition:"default",goto:W,value:f.onFalseValue||void 0})}return H.map(Km).filter(P=>P.goto)})():[],x=O$(_),v={id:f.taskId,name:f.name,description:f.description,type:g,agent_hints:f.agentHints,skills:f.skills,depends_on:r.get(p.id)||[],position:sde(p.position),condition:g==="conditional"?x.condition:void 0,on_true:g==="conditional"?x.on_true:void 0,on_false:g==="conditional"?x.on_false:void 0,conditional_branches:g==="conditional"&&_.length>0?_:void 0,on_true_value:g==="conditional"?x.on_true_value:void 0,on_false_value:g==="conditional"?x.on_false_value:void 0,channel:g==="human_input"&&f.channel?f.channel:void 0,channels:g==="notify"&&f.channels.length>0?tA(f.channels):void 0,notify_message:g==="notify"&&f.notifyMessage?f.notifyMessage:void 0,notify_title:g==="notify"&&f.notifyTitle?f.notifyTitle:void 0,notify_channel_id:g==="notify"&&f.notifyChannelId?f.notifyChannelId:void 0,retry:f.retry>0?f.retry:void 0,retry_delay:f.retryDelay!==5?f.retryDelay:void 0,disabled:f.disabled===!0?!0:void 0,compression:f.compression===!0?!0:void 0,auth:["agent","shell","python","email","a2a"].includes(g)&&f.auth?f.auth:void 0};if(g==="agent"&&(f.agentType&&(v.agent_type=f.agentType),f.role&&(v.role=f.role),f.prompt&&(v.prompt=f.prompt),f.timeout&&f.timeout!==300&&(v.timeout=f.timeout),f.assign&&(v.assign=f.assign),f.template&&(v.template=f.template),f.model&&(v.model=f.model),f.agentMaxTurns&&f.agentMaxTurns!==3&&(v.agent_max_turns=f.agentMaxTurns),f.agentTools&&f.agentTools!=="none"&&(v.agent_tools=f.agentTools),(S=f.agentRequiredTools)!=null&&S.length&&(v.agent_required_tools=f.agentRequiredTools),(w=f.agentOutputFields)!=null&&w.length&&(v.agent_output_fields=f.agentOutputFields),f.agentQualityEnabled&&(v.agent_quality_enabled=!0,v.agent_quality_threshold=f.agentQualityThreshold||.7,(N=f.agentQualityCriteria)!=null&&N.length&&(v.agent_quality_criteria=f.agentQualityCriteria),f.agentQualityModel&&(v.agent_quality_model=f.agentQualityModel))),g==="parallel"){v.parallel_join=f.parallelJoin||"all",v.parallel_max_concurrency=f.parallelMaxConcurrency||5;const H=o.get(p.id);H&&H.length>0&&(v.parallel_steps=H)}return g==="goto"&&(f.gotoTarget&&(v.goto_target=f.gotoTarget),f.gotoMaxIterations&&(v.goto_max_iterations=f.gotoMaxIterations),f.gotoCondition&&(v.goto_condition=f.gotoCondition)),g==="group_chat"&&(f.groupChatTopic&&(v.group_chat_topic=f.groupChatTopic),f.groupChatParticipants.length>0&&(v.group_chat_participants=f.groupChatParticipants),f.groupChatMaxRounds&&(v.group_chat_max_rounds=f.groupChatMaxRounds),f.groupChatModerator!=="claude"&&(v.group_chat_moderator=f.groupChatModerator),f.groupChatStrategy!=="moderator_selected"&&(v.group_chat_strategy=f.groupChatStrategy),f.groupChatTimeout!==120&&(v.group_chat_timeout=f.groupChatTimeout)),g==="supervisor"&&(f.supervisorTask&&(v.supervisor_task=f.supervisorTask),f.supervisorMaxIterations&&(v.supervisor_max_iterations=f.supervisorMaxIterations),f.supervisorType!=="claude"&&(v.supervisor_type=f.supervisorType),(C=f.supervisorTemplates)!=null&&C.length&&(v.supervisor_templates=f.supervisorTemplates),f.supervisorTimeout!==300&&(v.supervisor_timeout=f.supervisorTimeout)),g==="shell"&&(f.shellCommand&&(v.shell_command=f.shellCommand),f.shellTimeout&&f.shellTimeout!==60&&(v.shell_timeout=f.shellTimeout),f.shellAllowFailure&&(v.shell_allow_failure=!0)),g==="python"&&(f.pythonScript&&(v.python_script=f.pythonScript),f.pythonCode&&(v.python_code=f.pythonCode),f.pythonArgs&&(v.python_args=f.pythonArgs),f.pythonInterpreter&&(v.python_interpreter=f.pythonInterpreter),f.pythonTimeout&&f.pythonTimeout!==60&&(v.python_timeout=f.pythonTimeout),f.pythonAllowFailure&&(v.python_allow_failure=!0)),g==="compute"&&Object.keys(f.computeOutputs).length>0&&(v.compute_outputs=f.computeOutputs),g==="email"&&(f.emailTo&&(v.email_to=f.emailTo),f.emailSubject&&(v.email_subject=f.emailSubject),f.emailBody&&(v.email_body=f.emailBody),f.emailBodyHtml&&(v.email_body_html=f.emailBodyHtml),f.emailFrom&&(v.email_from=f.emailFrom),f.emailCc&&(v.email_cc=f.emailCc),f.emailBcc&&(v.email_bcc=f.emailBcc),f.emailReplyTo&&(v.email_reply_to=f.emailReplyTo),f.emailTrackClicks&&(v.email_track_clicks=!0),f.emailTrackKref&&(v.email_track_kref=f.emailTrackKref),f.emailTrackSecretEnv&&(v.email_track_secret_env=f.emailTrackSecretEnv),f.emailTrackBaseUrl&&(v.email_track_base_url=f.emailTrackBaseUrl),f.emailSmtpHost&&(v.email_smtp_host=f.emailSmtpHost),f.emailSmtpPort&&(v.email_smtp_port=f.emailSmtpPort),f.emailSmtpTls===!1&&(v.email_smtp_tls=!1),f.emailSmtpUsername&&(v.email_smtp_username=f.emailSmtpUsername),f.emailSmtpPasswordEnv&&(v.email_smtp_password_env=f.emailSmtpPasswordEnv),f.emailDryRun&&(v.email_dry_run=!0),f.emailTimeout&&f.emailTimeout!==30&&(v.email_timeout=f.emailTimeout)),g==="image"&&(f.imagePrompt&&(v.image_prompt=f.imagePrompt),f.imageCount&&f.imageCount!==1&&(v.image_count=f.imageCount),f.imageCanvasTarget&&(v.image_canvas=f.imageCanvasTarget),f.imageCanvas===!1&&(v.image_canvas=!1),f.imageRegisterArtifact===!1&&(v.image_register_artifact=!1),f.imageSpace&&(v.image_space=f.imageSpace),f.imageItemName&&(v.image_item_name=f.imageItemName),f.imageOutputPath&&(v.image_output_path=f.imageOutputPath),f.imageOutputPattern&&(v.image_output_pattern=f.imageOutputPattern),Array.isArray(f.imageInputImages)&&f.imageInputImages.length>0&&(v.image_input_images=f.imageInputImages),f.imageSandbox&&(v.image_sandbox=f.imageSandbox),f.imageCwd&&(v.image_cwd=f.imageCwd),f.imageTimeout&&f.imageTimeout!==1200&&(v.image_timeout=f.imageTimeout)),g==="output"&&(f.outputFormat&&(v.output_format=f.outputFormat),f.outputTemplate&&(v.output_template=f.outputTemplate),f.entityName&&(v.entity_name=f.entityName),f.entityKind&&(v.entity_kind=f.entityKind),f.entityTag&&(v.entity_tag=f.entityTag),f.entitySpace&&(v.entity_space=f.entitySpace),Object.keys(f.entityMetadata).length>0&&(v.entity_metadata=f.entityMetadata),f.entityMetadataTarget&&f.entityMetadataTarget!=="item"&&(v.metadata_target=f.entityMetadataTarget),f.artifactSummaryModel&&(v.artifact_summary_model=f.artifactSummaryModel)),g==="handoff"&&(f.handoffFrom&&(v.handoff_from=f.handoffFrom),f.handoffTo&&(v.handoff_to=f.handoffTo),f.handoffReason&&(v.handoff_reason=f.handoffReason),f.handoffTask&&(v.handoff_task=f.handoffTask),f.handoffTimeout!==300&&(v.handoff_timeout=f.handoffTimeout)),g==="human_input"&&(f.humanInputMessage&&(v.human_input_message=f.humanInputMessage),f.humanInputTimeout&&f.humanInputTimeout!==3600&&(v.human_input_timeout=f.humanInputTimeout)),g==="human_approval"&&(f.humanApprovalMessage&&(v.human_approval_message=f.humanApprovalMessage),f.humanApprovalTimeout&&f.humanApprovalTimeout!==3600&&(v.human_approval_timeout=f.humanApprovalTimeout),f.humanApprovalChannel&&f.humanApprovalChannel!=="dashboard"&&(v.human_approval_channel=f.humanApprovalChannel),f.humanApprovalChannelId&&(v.human_approval_channel_id=f.humanApprovalChannelId),f.humanApprovalOnRejectGoto&&(v.human_approval_on_reject_goto=f.humanApprovalOnRejectGoto),f.humanApprovalOnRejectMax&&f.humanApprovalOnRejectMax!==3&&(v.human_approval_on_reject_max=f.humanApprovalOnRejectMax),(T=f.humanApprovalApproveKeywords)!=null&&T.length&&(v.human_approval_approve_keywords=f.humanApprovalApproveKeywords),(A=f.humanApprovalRejectKeywords)!=null&&A.length&&(v.human_approval_reject_keywords=f.humanApprovalRejectKeywords)),g==="a2a"&&(f.a2aUrl&&(v.a2a_url=f.a2aUrl),f.a2aSkillId&&(v.a2a_skill_id=f.a2aSkillId),f.a2aMessage&&(v.a2a_message=f.a2aMessage),f.a2aTimeout&&f.a2aTimeout!==300&&(v.a2a_timeout=f.a2aTimeout),f.a2aCloudRunAuth==="gcloud"&&(v.a2a_cloud_run_auth="gcloud"),f.a2aCloudRunConfig&&(v.a2a_cloud_run_config=f.a2aCloudRunConfig),f.a2aCloudRunAudience&&(v.a2a_cloud_run_audience=f.a2aCloudRunAudience),f.a2aCloudRunAuthTimeout&&f.a2aCloudRunAuthTimeout!==20&&(v.a2a_cloud_run_auth_timeout=f.a2aCloudRunAuthTimeout)),g==="map_reduce"&&(f.mapReduceTask&&(v.map_reduce_task=f.mapReduceTask),f.mapReduceSplits.length>0&&(v.map_reduce_splits=f.mapReduceSplits),f.mapReduceMapper!=="claude"&&(v.map_reduce_mapper=f.mapReduceMapper),f.mapReduceReducer!=="claude"&&(v.map_reduce_reducer=f.mapReduceReducer),f.mapReduceConcurrency!==3&&(v.map_reduce_concurrency=f.mapReduceConcurrency),f.mapReduceTimeout!==300&&(v.map_reduce_timeout=f.mapReduceTimeout)),g==="resolve"&&(f.resolveKind&&(v.resolve_kind=f.resolveKind),f.resolveTag&&(v.resolve_tag=f.resolveTag),f.resolveNamePattern&&(v.resolve_name_pattern=f.resolveNamePattern),f.resolveSpace&&(v.resolve_space=f.resolveSpace),f.resolveArtifactName&&(v.resolve_artifact_name=f.resolveArtifactName),f.resolveMode&&(v.resolve_mode=f.resolveMode),(E=f.resolveFields)!=null&&E.length&&(v.resolve_fields=f.resolveFields),f.resolveMetadataSource&&f.resolveMetadataSource!=="revision"&&(v.resolve_metadata_source=f.resolveMetadataSource),f.resolveFailIfMissing===!1&&(v.resolve_fail_if_missing=!1)),(g==="kumiho_context"||g==="kumiho_bundle_update"||g==="kumiho_patch_apply")&&(v.kumiho_config=ode(f,g),v.kumiho_project=f.kumihoProject,v.kumiho_mode=f.kumihoMode,v.kumiho_seed_bundles=f.kumihoSeedBundles,v.kumiho_seed_krefs=f.kumihoSeedKrefs,v.kumiho_seed_queries=f.kumihoSeedQueries,v.kumiho_seed_items=f.kumihoSeedItems,v.kumiho_traversal_max_depth=f.kumihoTraversalMaxDepth,v.kumiho_traversal_direction=f.kumihoTraversalDirection,v.kumiho_traversal_edge_types=f.kumihoTraversalEdgeTypes,v.kumiho_filters_include_kinds=f.kumihoFiltersIncludeKinds,v.kumiho_filters_exclude_tags=f.kumihoFiltersExcludeTags,v.kumiho_filters_max_items=f.kumihoFiltersMaxItems,v.kumiho_ranking_method=f.kumihoRankingMethod,v.kumiho_ranking_semantic_query=f.kumihoRankingSemanticQuery,v.kumiho_lock_tag_preference=f.kumihoLockTagPreference,v.kumiho_output_format=f.kumihoOutputFormat,v.kumiho_output_include_artifact_summaries=f.kumihoOutputIncludeArtifactSummaries,v.kumiho_output_include_artifact_content=f.kumihoOutputIncludeArtifactContent,v.kumiho_output_max_artifact_chars_per_item=f.kumihoOutputMaxArtifactCharsPerItem,v.kumiho_output_include_edge_map=f.kumihoOutputIncludeEdgeMap,v.kumiho_output_include_conflict_warnings=f.kumihoOutputIncludeConflictWarnings,v.kumiho_output_include_missing_context=f.kumihoOutputIncludeMissingContext,v.kumiho_create_if_missing=f.kumihoCreateIfMissing,v.kumiho_idempotent=f.kumihoIdempotent,v.kumiho_fail_if_missing_bundle=f.kumihoFailIfMissingBundle,v.kumiho_fail_if_missing_item=f.kumihoFailIfMissingItem,v.kumiho_allow_protected=f.kumihoAllowProtected,v.kumiho_updates=f.kumihoUpdates,v.kumiho_patch_kref=f.kumihoPatchKref,v.kumiho_dry_run=f.kumihoDryRun,v.kumiho_allow_auto_apply=f.kumihoAllowAutoApply,v.kumiho_approval_required=f.kumihoApprovalRequired,v.kumiho_approval_approved=f.kumihoApprovalApproved,v.kumiho_approval_approved_by=f.kumihoApprovalApprovedBy,v.kumiho_approval_note=f.kumihoApprovalNote,v.kumiho_apply_create_revisions=f.kumihoApplyCreateRevisions,v.kumiho_apply_create_edges=f.kumihoApplyCreateEdges,v.kumiho_apply_update_tags=f.kumihoApplyUpdateTags,v.kumiho_apply_untag_previous_current=f.kumihoApplyUntagPreviousCurrent,v.kumiho_apply_update_bundles=f.kumihoApplyUpdateBundles,v.kumiho_apply_save_apply_report=f.kumihoApplySaveApplyReport,v.kumiho_new_revision_tags=f.kumihoNewRevisionTags,v.kumiho_patch_tags_remove=f.kumihoPatchTagsRemove,v.kumiho_patch_tags_add=f.kumihoPatchTagsAdd,v.kumiho_pending_patch_bundle=f.kumihoPendingPatchBundle,v.kumiho_applied_patch_bundle=f.kumihoAppliedPatchBundle,v.kumiho_current_state_bundle=f.kumihoCurrentStateBundle,v.kumiho_active_storyline_bundle=f.kumihoActiveStorylineBundle,v.kumiho_active_foreshadow_bundle=f.kumihoActiveForeshadowBundle,v.kumiho_timeline_bundle=f.kumihoTimelineBundle,v.kumiho_require_evidence_locator=f.kumihoRequireEvidenceLocator,v.kumiho_source_episode_kref=f.kumihoSourceEpisodeKref,v.kumiho_source_context_pack_kref=f.kumihoSourceContextPackKref),g==="for_each"&&(f.forEachSteps.length>0&&(v.for_each_steps=f.forEachSteps),f.forEachRange&&(v.for_each_range=f.forEachRange),f.forEachItems.length>0&&(v.for_each_items=f.forEachItems),f.forEachVariable&&f.forEachVariable!=="item"&&(v.for_each_variable=f.forEachVariable),f.forEachCarryForward||(v.for_each_carry_forward=!1),f.forEachFailFast||(v.for_each_fail_fast=!1),f.forEachMaxIterations&&f.forEachMaxIterations!==20&&(v.for_each_max_iterations=f.forEachMaxIterations)),g==="tag"&&(f.tagItemKref&&(v.tag_item_kref=f.tagItemKref),f.tagValue&&(v.tag_value=f.tagValue),f.tagUntag&&(v.tag_untag=f.tagUntag)),g==="deprecate"&&(f.deprecateItemKref&&(v.deprecate_item_kref=f.deprecateItemKref),f.deprecateReason&&(v.deprecate_reason=f.deprecateReason)),g==="manus"&&(f.manusPrompt&&(v.manus_prompt=f.manusPrompt),f.manusStructuredOutputSchema&&(v.manus_structured_output_schema=f.manusStructuredOutputSchema),(D=f.manusConnectors)!=null&&D.length&&(v.manus_connectors=f.manusConnectors),(F=f.manusEnableSkills)!=null&&F.length&&(v.manus_enable_skills=f.manusEnableSkills),(B=f.manusForceSkills)!=null&&B.length&&(v.manus_force_skills=f.manusForceSkills),f.manusAgentProfile&&(v.manus_agent_profile=f.manusAgentProfile),f.manusLocale&&(v.manus_locale=f.manusLocale),f.manusProjectId&&(v.manus_project_id=f.manusProjectId),f.manusTitle&&(v.manus_title=f.manusTitle),f.manusTimeoutSeconds&&f.manusTimeoutSeconds!==600&&(v.manus_timeout_seconds=f.manusTimeoutSeconds),f.manusPollIntervalSeconds&&f.manusPollIntervalSeconds!==5&&(v.manus_poll_interval_seconds=f.manusPollIntervalSeconds),f.manusAllowFailure&&(v.manus_allow_failure=!0),f.manusCredentialsRef&&(v.manus_credentials_ref=f.manusCredentialsRef),f.manusRegisterEnabled===!0&&(v.manus_register_enabled=!0,v.manus_register_entity_name=f.manusRegisterEntityName||"",v.manus_register_entity_kind=f.manusRegisterEntityKind||"",f.manusRegisterEntityTag&&f.manusRegisterEntityTag!=="published"&&(v.manus_register_entity_tag=f.manusRegisterEntityTag),f.manusRegisterEntitySpace&&(v.manus_register_entity_space=f.manusRegisterEntitySpace),f.manusRegisterAttachments===!1&&(v.manus_register_attachments=!1),f.manusRegisterContentSource&&f.manusRegisterContentSource!=="message"&&(v.manus_register_content_source=f.manusRegisterContentSource))),v})}function pde(e){var r;const n=e.kumiho_config?{...e.kumiho_config}:{};if(e.type==="kumiho_bundle_update")return{...n,project:e.kumiho_project||String(n.project||""),mode:e.kumiho_mode||String(n.mode||"add_members"),create_if_missing:e.kumiho_create_if_missing??!1,idempotent:e.kumiho_idempotent??!0,fail_if_missing_bundle:e.kumiho_fail_if_missing_bundle??!0,fail_if_missing_item:e.kumiho_fail_if_missing_item??!0,allow_protected:e.kumiho_allow_protected??!1,updates:e.kumiho_updates||[]};if(e.type==="kumiho_patch_apply"){const i=Lt(n.approval)?{...n.approval}:{},s=Lt(n.apply)?{...n.apply}:{},a=Lt(n.tag_policy)?{...n.tag_policy}:{},o=Lt(a.patch_tags)?{...a.patch_tags}:{},l=Lt(n.bundle_policy)?{...n.bundle_policy}:{},u=Lt(n.evidence)?{...n.evidence}:{};return i.required=e.kumiho_approval_required??!0,i.approved=e.kumiho_approval_approved??!1,i.approved_by=e.kumiho_approval_approved_by||"",i.approval_note=e.kumiho_approval_note||"",s.create_revisions=e.kumiho_apply_create_revisions??!0,s.create_edges=e.kumiho_apply_create_edges??!0,s.update_tags=e.kumiho_apply_update_tags??!0,s.untag_previous_current=e.kumiho_apply_untag_previous_current??!0,s.update_bundles=e.kumiho_apply_update_bundles??!0,s.save_apply_report=e.kumiho_apply_save_apply_report??!0,a.new_revision_tags=e.kumiho_new_revision_tags||["current","approved"],o.remove=e.kumiho_patch_tags_remove||["candidate"],o.add=e.kumiho_patch_tags_add||["applied"],a.patch_tags=o,l.pending_patch_bundle=e.kumiho_pending_patch_bundle||"",l.applied_patch_bundle=e.kumiho_applied_patch_bundle||"",l.current_state_bundle=e.kumiho_current_state_bundle||"",l.active_storyline_bundle=e.kumiho_active_storyline_bundle||"",l.active_foreshadow_bundle=e.kumiho_active_foreshadow_bundle||"",l.timeline_bundle=e.kumiho_timeline_bundle||"",u.require_evidence_locator=e.kumiho_require_evidence_locator??!0,u.source_episode_kref=e.kumiho_source_episode_kref||"",u.source_context_pack_kref=e.kumiho_source_context_pack_kref||"",{...n,project:e.kumiho_project||String(n.project||""),patch_kref:e.kumiho_patch_kref||String(n.patch_kref||""),dry_run:e.kumiho_dry_run??!0,allow_auto_apply:e.kumiho_allow_auto_apply??!1,approval:i,apply:s,tag_policy:a,bundle_policy:l,evidence:u}}return{...n,project:e.kumiho_project||String(n.project||""),mode:e.kumiho_mode||String(n.mode||"graph_augmented_context"),seed:{...Lt(n.seed)?n.seed:{},bundles:e.kumiho_seed_bundles||[],krefs:e.kumiho_seed_krefs||[],queries:e.kumiho_seed_queries||[],...(r=e.kumiho_seed_items)!=null&&r.length?{items:e.kumiho_seed_items}:{}},traversal:{...Lt(n.traversal)?n.traversal:{},max_depth:e.kumiho_traversal_max_depth??2,direction:e.kumiho_traversal_direction||"both",edge_types:e.kumiho_traversal_edge_types||[]},filters:{...Lt(n.filters)?n.filters:{},include_kinds:e.kumiho_filters_include_kinds||[],exclude_tags:e.kumiho_filters_exclude_tags||["deprecated"],max_items:e.kumiho_filters_max_items??50},ranking:{...Lt(n.ranking)?n.ranking:{},method:e.kumiho_ranking_method||"hybrid",semantic_query:e.kumiho_ranking_semantic_query||""},lock:{...Lt(n.lock)?n.lock:{},revisions:!0,tag_preference:e.kumiho_lock_tag_preference||[]},output:{...Lt(n.output)?n.output:{},format:e.kumiho_output_format||"context_pack",include_artifact_summaries:e.kumiho_output_include_artifact_summaries??!0,include_artifact_content:e.kumiho_output_include_artifact_content??!1,max_artifact_chars_per_item:e.kumiho_output_max_artifact_chars_per_item??3e3,include_edge_map:e.kumiho_output_include_edge_map??!0,include_conflict_warnings:e.kumiho_output_include_conflict_warnings??!0,include_missing_context:e.kumiho_output_include_missing_context??!0}}}function mde(e,n,r){const i=M$.dump(r,{noRefs:!0,lineWidth:-1,sortKeys:!1}).trimEnd(),s=" ".repeat(n);for(const a of i.split(`
`))e.push(`${s}${a}`)}function Gu(e,n){var s,a,o,l,u,d,p,f,g,_,x;const r=[];if(n!=null&&n.name&&r.push(`name: ${n.name}`),n!=null&&n.version&&r.push(`version: "${n.version}"`),n!=null&&n.description&&r.push(`description: ${ot(n.description)}`),n!=null&&n.tags&&n.tags.length>0&&r.push(`tags: [${n.tags.join(", ")}]`),n!=null&&n.triggers&&n.triggers.length>0){r.push(""),r.push("triggers:");for(const v of n.triggers){v.inputMap.__cron?r.push(`  - cron: ${ot(v.inputMap.__cron)}`):r.push(`  - on_kind: ${ot(v.onKind)}`),v.onTag&&v.onTag!=="ready"&&r.push(`    on_tag: ${ot(v.onTag)}`),v.onNamePattern&&r.push(`    on_name_pattern: ${ot(v.onNamePattern)}`),v.onSpace&&r.push(`    on_space: ${ot(v.onSpace)}`);const S=Object.entries(v.inputMap).filter(([w])=>w!=="__cron");if(S.length>0){r.push("    input_map:");for(const[w,N]of S)r.push(`      ${w}: ${ot(N)}`)}}}const i=((n==null?void 0:n.inputs)??[]).filter(v=>v.name.trim());if(i.length>0){r.push(""),r.push("inputs:");for(const v of i)r.push(`  - name: ${v.name.trim()}`),v.type!=="string"&&r.push(`    type: ${v.type}`),v.required||r.push("    required: false"),v.default&&r.push(`    default: ${ot(v.default)}`),v.description&&r.push(`    description: ${ot(v.description)}`)}if(n!=null&&n.outputs&&n.outputs.length>0){r.push(""),r.push("outputs:");for(const v of n.outputs)r.push(`  - name: ${v.name}`),r.push(`    source: ${ot(v.source)}`),v.description&&r.push(`    description: ${ot(v.description)}`)}n!=null&&n.defaultCwd&&r.push(`default_cwd: ${ot(n.defaultCwd)}`),n!=null&&n.defaultTimeout&&n.defaultTimeout!==300&&r.push(`default_timeout: ${n.defaultTimeout}`),n!=null&&n.maxTotalTime&&n.maxTotalTime!==3600&&r.push(`max_total_time: ${n.maxTotalTime}`),(n==null?void 0:n.checkpoint)===!1&&r.push("checkpoint: false"),r.length>0&&r.push(""),r.push("steps:");for(const v of e){r.push(`  - id: ${v.id}`),v.name&&v.name!==v.id&&r.push(`    name: ${ot(v.name)}`);const S=v.type||"agent";if(r.push(`    type: ${S}`),v.position&&(r.push("    position:"),r.push(`      x: ${Qx(v.position.x)}`),r.push(`      y: ${Qx(v.position.y)}`)),v.description&&r.push(`    description: ${ot(v.description)}`),v.retry&&v.retry>0&&r.push(`    retry: ${v.retry}`),v.retry_delay&&v.retry_delay!==5&&r.push(`    retry_delay: ${v.retry_delay}`),v.disabled===!0&&r.push("    disabled: true"),v.compression===!0&&r.push("    compression: true"),S==="conditional"){const w=[];for(const N of cx(v))!N.condition||!N.goto||(w.push(`      - condition: ${ot(N.condition)}`),w.push(`        goto: ${N.goto}`),N.value&&w.push(`        value: ${ot(N.value)}`));w.length>0&&(r.push("    conditional:"),r.push("      branches:"),r.push(...w))}if(S==="human_input"&&v.channel&&r.push(`    channel: ${v.channel}`),S==="notify"&&(v.channels&&v.channels.length>0||v.notify_message||v.notify_title||v.notify_channel_id)){r.push("    notify:"),r.push(`      channels: [${tA(v.channels||["dashboard"]).join(", ")}]`);const w=v.notify_message||"";if(w)if(w.includes(`
`)){r.push("      message: |");for(const C of w.split(`
`))r.push(`        ${C}`)}else r.push(`      message: ${ot(w)}`);const N=v.notify_title||"";N&&r.push(`      title: ${ot(N)}`),v.notify_channel_id&&r.push(`      channel_id: ${ot(v.notify_channel_id)}`)}if(S==="agent"&&(v.agent_type||v.role||v.prompt||v.template||v.auth||(s=v.agent_required_tools)!=null&&s.length)){if(r.push("    agent:"),v.agent_type&&r.push(`      agent_type: ${v.agent_type}`),v.role&&r.push(`      role: ${v.role}`),v.template&&r.push(`      template: ${v.template}`),v.prompt)if(v.prompt.includes(`
`)){r.push("      prompt: |");for(const w of v.prompt.split(`
`))r.push(`        ${w}`)}else r.push(`      prompt: ${ot(v.prompt)}`);v.timeout&&v.timeout!==300&&r.push(`      timeout: ${v.timeout}`),v.model&&r.push(`      model: ${v.model}`),v.agent_max_turns&&v.agent_max_turns!==3&&r.push(`      max_turns: ${v.agent_max_turns}`),v.agent_tools&&v.agent_tools!=="none"&&r.push(`      tools: ${v.agent_tools}`),(a=v.agent_required_tools)!=null&&a.length&&r.push(`      required_tools: [${v.agent_required_tools.map(ot).join(", ")}]`),(o=v.agent_output_fields)!=null&&o.length&&r.push(`      output_fields: [${v.agent_output_fields.map(ot).join(", ")}]`),v.agent_quality_enabled&&(r.push("      quality_check:"),r.push("        enabled: true"),v.agent_quality_threshold!==void 0&&v.agent_quality_threshold!==.7&&r.push(`        threshold: ${v.agent_quality_threshold}`),(l=v.agent_quality_criteria)!=null&&l.length&&r.push(`        criteria: [${v.agent_quality_criteria.map(ot).join(", ")}]`),v.agent_quality_model&&r.push(`        model: ${v.agent_quality_model}`)),v.auth&&r.push(`      auth: ${ot(v.auth)}`)}if(S==="parallel"&&(r.push("    parallel:"),v.parallel_steps&&v.parallel_steps.length>0&&r.push(`      steps: [${v.parallel_steps.join(", ")}]`),r.push(`      join: ${v.parallel_join||"all"}`),r.push(`      max_concurrency: ${v.parallel_max_concurrency||5}`)),S==="goto"&&(r.push("    goto:"),v.goto_target&&r.push(`      target: ${v.goto_target}`),v.goto_max_iterations&&r.push(`      max_iterations: ${v.goto_max_iterations}`),v.goto_condition&&r.push(`      condition: ${ot(v.goto_condition)}`)),S==="group_chat"&&(r.push("    group_chat:"),v.group_chat_topic&&r.push(`      topic: ${ot(v.group_chat_topic)}`),v.group_chat_participants&&v.group_chat_participants.length>0&&r.push(`      participants: [${v.group_chat_participants.join(", ")}]`),v.group_chat_max_rounds&&r.push(`      max_rounds: ${v.group_chat_max_rounds}`),v.group_chat_moderator&&v.group_chat_moderator!=="claude"&&r.push(`      moderator: ${v.group_chat_moderator}`),v.group_chat_strategy&&v.group_chat_strategy!=="moderator_selected"&&r.push(`      strategy: ${v.group_chat_strategy}`),v.group_chat_timeout&&v.group_chat_timeout!==120&&r.push(`      timeout: ${v.group_chat_timeout}`)),S==="supervisor"&&(r.push("    supervisor:"),v.supervisor_task&&r.push(`      task: ${ot(v.supervisor_task)}`),v.supervisor_max_iterations&&r.push(`      max_iterations: ${v.supervisor_max_iterations}`),v.supervisor_type&&v.supervisor_type!=="claude"&&r.push(`      supervisor_type: ${v.supervisor_type}`),(u=v.supervisor_templates)!=null&&u.length&&r.push(`      templates: [${v.supervisor_templates.map(ot).join(", ")}]`),v.supervisor_timeout&&v.supervisor_timeout!==300&&r.push(`      timeout: ${v.supervisor_timeout}`)),S==="shell"&&(r.push("    shell:"),v.shell_command&&r.push(`      command: ${ot(v.shell_command)}`),v.shell_timeout&&v.shell_timeout!==60&&r.push(`      timeout: ${v.shell_timeout}`),v.shell_allow_failure&&r.push("      allow_failure: true"),v.auth&&r.push(`      auth: ${ot(v.auth)}`)),S==="python"){if(r.push("    python:"),v.python_script&&r.push(`      script: ${ot(v.python_script)}`),v.python_code)if(v.python_code.includes(`
`)){r.push("      code: |");for(const w of v.python_code.split(`
`))r.push(`        ${w}`)}else r.push(`      code: ${ot(v.python_code)}`);v.python_args&&r.push(`      args: ${v.python_args}`),v.python_interpreter&&r.push(`      python: ${ot(v.python_interpreter)}`),v.python_timeout&&v.python_timeout!==60&&r.push(`      timeout: ${v.python_timeout}`),v.python_allow_failure&&r.push("      allow_failure: true"),v.auth&&r.push(`      auth: ${ot(v.auth)}`)}if(S==="compute"){r.push("    compute:"),r.push("      outputs:");for(const[w,N]of Object.entries(v.compute_outputs||{}))r.push(`        ${w}: ${ot(String(N))}`)}if(S==="email"){if(r.push("    email:"),v.email_to&&r.push(`      to: ${ot(v.email_to)}`),v.email_subject&&r.push(`      subject: ${ot(v.email_subject)}`),v.email_body)if(v.email_body.includes(`
`)){r.push("      body: |");for(const w of v.email_body.split(`
`))r.push(`        ${w}`)}else r.push(`      body: ${ot(v.email_body)}`);if(v.email_body_html)if(v.email_body_html.includes(`
`)){r.push("      body_html: |");for(const w of v.email_body_html.split(`
`))r.push(`        ${w}`)}else r.push(`      body_html: ${ot(v.email_body_html)}`);if(v.email_from&&r.push(`      from_address: ${ot(v.email_from)}`),v.email_cc){const w=v.email_cc.split(",").map(N=>N.trim()).filter(Boolean);w.length>0&&r.push(`      cc: [${w.map(ot).join(", ")}]`)}if(v.email_bcc){const w=v.email_bcc.split(",").map(N=>N.trim()).filter(Boolean);w.length>0&&r.push(`      bcc: [${w.map(ot).join(", ")}]`)}v.email_reply_to&&r.push(`      reply_to: ${ot(v.email_reply_to)}`),v.email_track_clicks&&r.push("      track_clicks: true"),v.email_track_kref&&r.push(`      track_kref: ${ot(v.email_track_kref)}`),v.email_track_secret_env&&r.push(`      track_secret_env: ${ot(v.email_track_secret_env)}`),v.email_track_base_url&&r.push(`      track_base_url: ${ot(v.email_track_base_url)}`),v.email_smtp_host&&r.push(`      smtp_host: ${ot(v.email_smtp_host)}`),v.email_smtp_port&&r.push(`      smtp_port: ${v.email_smtp_port}`),v.email_smtp_tls===!1&&r.push("      smtp_tls: false"),v.email_smtp_username&&r.push(`      smtp_username: ${ot(v.email_smtp_username)}`),v.email_smtp_password_env&&r.push(`      smtp_password_env: ${ot(v.email_smtp_password_env)}`),v.email_dry_run&&r.push("      dry_run: true"),v.email_timeout&&v.email_timeout!==30&&r.push(`      timeout: ${v.email_timeout}`),v.auth&&r.push(`      auth: ${ot(v.auth)}`)}if(S==="image"){if(r.push("    image:"),v.image_prompt)if(v.image_prompt.includes(`
`)){r.push("      prompt: |");for(const w of v.image_prompt.split(`
`))r.push(`        ${w}`)}else r.push(`      prompt: ${ot(v.image_prompt)}`);v.image_count&&v.image_count!==1&&r.push(`      count: ${v.image_count}`),typeof v.image_canvas=="string"&&v.image_canvas?r.push(`      canvas: ${ot(v.image_canvas)}`):v.image_canvas_target?r.push(`      canvas: ${ot(v.image_canvas_target)}`):v.image_canvas===!1&&r.push("      canvas: false"),v.image_register_artifact===!1&&r.push("      register_artifact: false"),v.image_space&&r.push(`      space: ${ot(v.image_space)}`),v.image_item_name&&r.push(`      item_name: ${ot(v.image_item_name)}`),v.image_output_path&&r.push(`      output_path: ${ot(v.image_output_path)}`),v.image_output_pattern&&r.push(`      output_pattern: ${ot(v.image_output_pattern)}`),v.image_input_images&&v.image_input_images.length>0&&r.push(`      input_images: [${v.image_input_images.map(ot).join(", ")}]`),v.image_sandbox&&r.push(`      sandbox: ${v.image_sandbox}`),v.image_cwd&&r.push(`      cwd: ${ot(v.image_cwd)}`),v.image_timeout&&v.image_timeout!==1200&&r.push(`      timeout: ${v.image_timeout}`)}if(S==="output"){if(r.push("    output:"),v.output_format&&r.push(`      format: ${v.output_format}`),v.output_template)if(v.output_template.includes(`
`)){r.push("      template: |");for(const w of v.output_template.split(`
`))r.push(`        ${w}`)}else r.push(`      template: ${ot(v.output_template)}`);if(v.entity_name&&r.push(`      entity_name: ${ot(v.entity_name)}`),v.entity_kind&&r.push(`      entity_kind: ${ot(v.entity_kind)}`),v.entity_tag&&r.push(`      entity_tag: ${ot(v.entity_tag)}`),v.entity_space&&r.push(`      entity_space: ${ot(v.entity_space)}`),v.artifact_summary_model&&r.push(`      artifact_summary_model: ${ot(v.artifact_summary_model)}`),v.metadata_target&&v.metadata_target!=="item"&&r.push(`      metadata_target: ${ot(v.metadata_target)}`),v.entity_metadata&&Object.keys(v.entity_metadata).length>0){r.push("      entity_metadata:");for(const[w,N]of Object.entries(v.entity_metadata))r.push(`        ${w}: "${String(N).replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`)}}if(S==="handoff"&&(r.push("    handoff:"),v.handoff_from&&r.push(`      from_step: ${v.handoff_from}`),v.handoff_to&&r.push(`      to_agent_type: ${v.handoff_to}`),v.handoff_reason&&r.push(`      reason: ${ot(v.handoff_reason)}`),v.handoff_task&&r.push(`      task: ${ot(v.handoff_task)}`),v.handoff_timeout&&v.handoff_timeout!==300&&r.push(`      timeout: ${v.handoff_timeout}`)),S==="human_input"){if(r.push("    human_input:"),v.human_input_message)if(v.human_input_message.includes(`
`)){r.push("      message: |");for(const w of v.human_input_message.split(`
`))r.push(`        ${w}`)}else r.push(`      message: ${ot(v.human_input_message)}`);v.channel&&r.push(`      channel: ${v.channel}`),v.human_input_timeout&&v.human_input_timeout!==3600&&r.push(`      timeout: ${v.human_input_timeout}`)}if(S==="human_approval"){if(r.push("    human_approval:"),v.human_approval_channel&&v.human_approval_channel!=="dashboard"&&r.push(`      channel: ${v.human_approval_channel}`),v.human_approval_channel_id&&r.push(`      channel_id: "${v.human_approval_channel_id}"`),v.human_approval_message)if(v.human_approval_message.includes(`
`)){r.push("      message: |");for(const w of v.human_approval_message.split(`
`))r.push(`        ${w}`)}else r.push(`      message: ${ot(v.human_approval_message)}`);v.human_approval_timeout&&v.human_approval_timeout!==3600&&r.push(`      timeout: ${v.human_approval_timeout}`),v.human_approval_on_reject_goto&&r.push(`      on_reject_goto: ${v.human_approval_on_reject_goto}`),v.human_approval_on_reject_max&&v.human_approval_on_reject_max!==3&&r.push(`      on_reject_max: ${v.human_approval_on_reject_max}`),(d=v.human_approval_approve_keywords)!=null&&d.length&&r.push(`      approve_keywords: [${v.human_approval_approve_keywords.map(ot).join(", ")}]`),(p=v.human_approval_reject_keywords)!=null&&p.length&&r.push(`      reject_keywords: [${v.human_approval_reject_keywords.map(ot).join(", ")}]`)}if(S==="a2a"&&(r.push("    a2a:"),v.a2a_url&&r.push(`      url: ${v.a2a_url}`),v.a2a_skill_id&&r.push(`      skill_id: ${v.a2a_skill_id}`),v.a2a_message&&r.push(`      message: ${ot(v.a2a_message)}`),v.a2a_timeout&&v.a2a_timeout!==300&&r.push(`      timeout: ${v.a2a_timeout}`),v.auth&&r.push(`      auth: ${ot(v.auth)}`),v.a2a_cloud_run_auth&&r.push(`      cloud_run_auth: ${v.a2a_cloud_run_auth}`),v.a2a_cloud_run_config&&r.push(`      cloud_run_config: ${ot(v.a2a_cloud_run_config)}`),v.a2a_cloud_run_audience&&r.push(`      cloud_run_audience: ${ot(v.a2a_cloud_run_audience)}`),v.a2a_cloud_run_auth_timeout&&v.a2a_cloud_run_auth_timeout!==20&&r.push(`      cloud_run_auth_timeout: ${v.a2a_cloud_run_auth_timeout}`)),S==="map_reduce"&&(r.push("    map_reduce:"),v.map_reduce_task&&r.push(`      task: ${ot(v.map_reduce_task)}`),v.map_reduce_splits&&v.map_reduce_splits.length>0&&r.push(`      splits: [${v.map_reduce_splits.map(w=>ot(w)).join(", ")}]`),v.map_reduce_mapper&&v.map_reduce_mapper!=="claude"&&r.push(`      mapper: ${v.map_reduce_mapper}`),v.map_reduce_reducer&&v.map_reduce_reducer!=="claude"&&r.push(`      reducer: ${v.map_reduce_reducer}`),v.map_reduce_concurrency&&v.map_reduce_concurrency!==3&&r.push(`      concurrency: ${v.map_reduce_concurrency}`),v.map_reduce_timeout&&v.map_reduce_timeout!==300&&r.push(`      timeout: ${v.map_reduce_timeout}`)),S==="resolve"&&(r.push("    resolve:"),r.push(`      kind: "${v.resolve_kind||""}"`),r.push(`      tag: "${v.resolve_tag||"published"}"`),r.push(`      name_pattern: "${v.resolve_name_pattern||""}"`),r.push(`      space: "${v.resolve_space||""}"`),v.resolve_artifact_name&&r.push(`      artifact_name: ${ot(v.resolve_artifact_name)}`),r.push(`      mode: "${v.resolve_mode||"latest"}"`),v.resolve_metadata_source&&v.resolve_metadata_source!=="revision"&&r.push(`      metadata_source: ${ot(v.resolve_metadata_source)}`),(f=v.resolve_fields)!=null&&f.length?r.push(`      fields: [${v.resolve_fields.map(w=>`"${w}"`).join(", ")}]`):r.push("      fields: []"),r.push(`      fail_if_missing: ${v.resolve_fail_if_missing!==!1?"true":"false"}`)),(S==="kumiho_context"||S==="kumiho_bundle_update"||S==="kumiho_patch_apply")&&(r.push("    kumiho:"),mde(r,6,pde(v))),S==="for_each"&&v.for_each_steps&&v.for_each_steps.length>0&&(r.push("    for_each:"),v.for_each_range&&r.push(`      range: "${v.for_each_range}"`),v.for_each_items&&v.for_each_items.length>0&&r.push(`      items: [${v.for_each_items.map(w=>`"${w}"`).join(", ")}]`),v.for_each_variable&&v.for_each_variable!=="item"&&r.push(`      variable: ${v.for_each_variable}`),r.push(`      steps: [${v.for_each_steps.join(", ")}]`),v.for_each_carry_forward===!1&&r.push("      carry_forward: false"),v.for_each_fail_fast===!1&&r.push("      fail_fast: false"),v.for_each_max_iterations&&v.for_each_max_iterations!==20&&r.push(`      max_iterations: ${v.for_each_max_iterations}`)),S==="tag"&&(r.push("    tag_step:"),v.tag_item_kref&&r.push(`      item_kref: ${ot(v.tag_item_kref)}`),v.tag_value&&r.push(`      tag: ${ot(v.tag_value)}`),v.tag_untag&&r.push(`      untag: ${ot(v.tag_untag)}`)),S==="deprecate"&&(r.push("    deprecate_step:"),v.deprecate_item_kref&&r.push(`      item_kref: ${ot(v.deprecate_item_kref)}`),v.deprecate_reason&&r.push(`      reason: ${ot(v.deprecate_reason)}`)),S==="manus"){if(r.push("    manus:"),v.manus_prompt)if(v.manus_prompt.includes(`
`)){r.push("      prompt: |");for(const w of v.manus_prompt.split(`
`))r.push(`        ${w}`)}else r.push(`      prompt: ${ot(v.manus_prompt)}`);if(v.manus_structured_output_schema)try{const w=JSON.parse(v.manus_structured_output_schema);r.push(`      structured_output_schema: ${JSON.stringify(w)}`)}catch{r.push(`      structured_output_schema: ${ot(v.manus_structured_output_schema)}`)}(g=v.manus_connectors)!=null&&g.length&&r.push(`      connectors: [${v.manus_connectors.map(ot).join(", ")}]`),(_=v.manus_enable_skills)!=null&&_.length&&r.push(`      enable_skills: [${v.manus_enable_skills.map(ot).join(", ")}]`),(x=v.manus_force_skills)!=null&&x.length&&r.push(`      force_skills: [${v.manus_force_skills.map(ot).join(", ")}]`),v.manus_agent_profile&&r.push(`      agent_profile: ${ot(v.manus_agent_profile)}`),v.manus_locale&&r.push(`      locale: ${ot(v.manus_locale)}`),v.manus_project_id&&r.push(`      project_id: ${ot(v.manus_project_id)}`),v.manus_title&&r.push(`      title: ${ot(v.manus_title)}`),v.manus_timeout_seconds&&v.manus_timeout_seconds!==600&&r.push(`      timeout_seconds: ${v.manus_timeout_seconds}`),v.manus_poll_interval_seconds&&v.manus_poll_interval_seconds!==5&&r.push(`      poll_interval_seconds: ${v.manus_poll_interval_seconds}`),v.manus_allow_failure&&r.push("      allow_failure: true"),v.manus_credentials_ref&&r.push(`      credentials_ref: ${ot(v.manus_credentials_ref)}`),v.manus_register_enabled===!0&&(r.push("      register_output:"),r.push(`        entity_name: ${ot(v.manus_register_entity_name||"")}`),r.push(`        entity_kind: ${ot(v.manus_register_entity_kind||"")}`),v.manus_register_entity_tag&&v.manus_register_entity_tag!=="published"&&r.push(`        entity_tag: ${ot(v.manus_register_entity_tag)}`),v.manus_register_entity_space&&r.push(`        entity_space: ${ot(v.manus_register_entity_space)}`),v.manus_register_attachments===!1&&r.push("        register_attachments: false"),v.manus_register_content_source&&v.manus_register_content_source!=="message"&&r.push(`        content_source: ${ot(v.manus_register_content_source)}`))}v.agent_hints.length>0&&r.push(`    agent_hints: [${v.agent_hints.join(", ")}]`),v.skills.length>0&&r.push(`    skills: [${v.skills.join(", ")}]`),v.assign&&r.push(`    assign: ${v.assign}`),v.depends_on.length>0&&r.push(`    depends_on: [${v.depends_on.join(", ")}]`)}return r.join(`
`)+`
`}function ot(e){return/[:#\[\]{}&*!|>'"%@`]/.test(e)||e.includes(`
`)?`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`:e}function st({children:e,className:n="",variant:r="primary",skinSlot:i}){return c.jsx("section",{className:`revka-panel ${n}`.trim(),"data-variant":r,"data-skin-slot":i,children:e})}function $a({status:e}){const{getSkinAsset:n}=Ta(),r=e.toLowerCase(),i=(()=>{switch(r){case"running":return{icon:eJ,color:"var(--revka-signal-live)",bg:"var(--revka-signal-live-soft)",assetSlot:"statusRunningBadge"};case"completed":case"success":return{icon:Px,color:"var(--revka-status-success)",bg:"color-mix(in srgb, var(--revka-status-success) 8%, transparent)",assetSlot:"statusSuccessBadge"};case"failed":return{icon:Xc,color:"var(--revka-status-danger)",bg:"color-mix(in srgb, var(--revka-status-danger) 12%, transparent)",assetSlot:"statusFailedBadge"};case"paused":case"blocked":case"pending":return{icon:H3,color:"var(--revka-status-warning)",bg:"color-mix(in srgb, var(--revka-status-warning) 12%, transparent)",assetSlot:"statusPendingBadge"};case"skipped":return{icon:H3,color:"var(--revka-status-idle)",bg:"color-mix(in srgb, var(--revka-status-idle) 12%, transparent)",assetSlot:"statusSkippedBadge"};case"stale":return{icon:pE,color:"var(--revka-status-idle)",bg:"color-mix(in srgb, var(--revka-status-idle) 14%, transparent)",assetSlot:"statusSkippedBadge"};default:return{icon:Cs,color:"var(--revka-text-muted)",bg:"color-mix(in srgb, var(--revka-text-muted) 10%, transparent)",assetSlot:"statusPendingBadge"}}})(),s=i.icon,a=n(i.assetSlot);return c.jsxs("span",{className:"revka-status-pill",style:{color:i.color,background:i.bg,borderColor:"transparent"},children:[a?c.jsx("img",{src:a,alt:"",className:"revka-status-asset",draggable:!1}):c.jsx(s,{className:"h-3.5 w-3.5"}),e]})}function gde({definitionsCount:e,activeRuns:n,totalRuns:r,error:i}){return i?c.jsxs("p",{className:"mt-4 text-sm",style:{color:"var(--revka-status-danger)"},children:["Failed to load workflow dashboard: ",i]}):c.jsxs("div",{className:"mt-5 grid gap-4 md:grid-cols-3",children:[c.jsx(Jw,{label:"Definitions",value:e??"..."}),c.jsx(Jw,{label:"Active Runs",value:n??"..."}),c.jsx(Jw,{label:"Total Runs",value:r??"..."})]})}function Jw({label:e,value:n}){return c.jsxs("div",{className:"revka-dashboard-stat",children:[c.jsx("div",{className:"revka-kicker",children:e}),c.jsx("div",{className:"revka-metric-value mt-2",children:n})]})}function vde({selectedRunStatus:e,audit:n,provider:r,model:i}){return c.jsxs(st,{className:"p-4",skinSlot:"commandBand",children:[c.jsx("div",{className:"revka-kicker",children:"Command Band"}),c.jsxs("div",{className:"mt-3 grid gap-2 text-sm",children:[c.jsx($a,{status:e??"running"}),c.jsxs("span",{className:"revka-status-pill",children:[c.jsx(sv,{className:"h-3.5 w-3.5"}),n!=null&&n.verified?"Trust verified":"Trust check pending"]}),c.jsxs("div",{className:"rounded-[8px] border p-3",style:{borderColor:"var(--revka-border-soft)"},children:[c.jsx("div",{className:"revka-kicker",children:"Runtime"}),c.jsx("div",{className:"mt-2 text-sm font-semibold",style:{color:"var(--revka-text-primary)"},children:r??"Unknown provider"}),c.jsx("div",{className:"mt-1 text-xs",style:{color:"var(--revka-text-secondary)"},children:i||"No model reported"})]})]})]})}function yde({sessions:e,channels:n,activeSessionCount:r,activeChannelCount:i}){return c.jsxs(st,{className:"p-4",variant:"secondary",skinSlot:"agentRail",children:[c.jsx("div",{className:"revka-kicker",children:"Agent Rail"}),c.jsxs("div",{className:"mt-3 space-y-3",children:[c.jsx(Ym,{icon:c.jsx(a0,{className:"h-4 w-4",style:{color:"var(--revka-signal-live)"}}),label:"Sessions",value:r,detail:`${e.length} tracked conversations`}),c.jsx(Ym,{icon:c.jsx(Ix,{className:"h-4 w-4",style:{color:"var(--revka-signal-network)"}}),label:"Channels",value:i,detail:`${n.length} integrated surfaces`}),c.jsxs(st,{className:"p-3",variant:"utility",children:[c.jsx("div",{className:"revka-kicker",children:"Recent session activity"}),c.jsxs("div",{className:"mt-2 space-y-2",children:[e.slice(0,3).map(s=>c.jsxs("div",{className:"flex items-center justify-between gap-2 text-xs",children:[c.jsx("span",{className:"truncate",style:{color:"var(--revka-text-primary)"},children:s.channel}),c.jsx($a,{status:s.status})]},s.id)),e.length===0?c.jsx("div",{className:"text-sm",style:{color:"var(--revka-text-faint)"},children:"No active sessions."}):null]})]})]})]})}function _de({audit:e,cost:n,degradedComponentCount:r}){var i,s;return c.jsxs(st,{className:"p-4",variant:"secondary",skinSlot:"riskRail",children:[c.jsx("div",{className:"revka-kicker",children:"Risk Rail"}),c.jsxs("div",{className:"mt-3 space-y-3",children:[c.jsx(Ym,{icon:c.jsx(sv,{className:"h-4 w-4",style:{color:e!=null&&e.verified?"var(--revka-status-success)":"var(--revka-status-warning)"}}),label:"Audit chain",value:e!=null&&e.verified?"Verified":"Pending verification"}),c.jsx(Ym,{icon:c.jsx(uE,{className:"h-4 w-4",style:{color:"var(--revka-signal-network)"}}),label:"Spend",value:`$${((i=n==null?void 0:n.daily_cost_usd)==null?void 0:i.toFixed(2))??"..."}`,detail:`daily / $${((s=n==null?void 0:n.monthly_cost_usd)==null?void 0:s.toFixed(2))??"..."} monthly`}),c.jsx(Ym,{icon:c.jsx(ev,{className:"h-4 w-4",style:{color:r>0?"var(--revka-status-warning)":"var(--revka-status-success)"}}),label:"Component health",value:r>0?`${r} degraded`:"All healthy"})]})]})}function xde({runs:e,onSelectRun:n,selectedRunId:r,footer:i}){return c.jsxs(st,{className:"p-4",variant:"utility",skinSlot:"recentRuns",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(ev,{className:"h-4 w-4",style:{color:"var(--revka-signal-network)"}}),c.jsx("span",{className:"text-sm font-medium",children:"Recent runs"})]}),c.jsxs("div",{className:"mt-3 max-h-[24rem] space-y-2 overflow-y-auto pr-1",children:[e.slice(0,4).map(s=>c.jsxs("button",{type:"button",onClick:()=>n(s.run_id),"data-active":s.run_id===r,className:"revka-run-selection-card",children:[c.jsxs("div",{className:"flex items-center justify-between gap-2",children:[c.jsx("span",{className:"truncate text-sm font-medium",children:s.workflow_name}),c.jsx($a,{status:s.status})]}),s.run_id===r?c.jsx("div",{className:"mt-2 text-[10px] font-semibold uppercase tracking-[0.14em]",style:{color:"var(--revka-signal-selected)"},children:"Active selection"}):null,c.jsx("div",{className:"mt-2 text-xs font-mono",style:{color:"var(--revka-text-faint)"},children:s.run_id.slice(0,8)})]},s.run_id)),e.length===0?c.jsx("div",{className:"text-sm",style:{color:"var(--revka-text-faint)"},children:"Loading recent runs…"}):null]}),i?c.jsx("div",{className:"mt-4",children:i}):null]})}function Ym({icon:e,label:n,value:r,detail:i}){return c.jsxs("div",{className:"revka-mini-metric-card rounded-[8px] border p-3",style:{borderColor:"var(--revka-border-soft)"},children:[c.jsxs("div",{className:"flex items-center gap-2",children:[e,c.jsx("span",{className:"text-sm font-medium",style:{color:"var(--revka-text-primary)"},children:n})]}),c.jsx("div",{className:"mt-2 text-2xl font-semibold",style:{color:"var(--revka-text-primary)"},children:r}),i?c.jsx("div",{className:"mt-1 text-xs",style:{color:"var(--revka-text-secondary)"},children:i}):null]})}function bde({avatarUrl:e,message:n,speaker:r,tone:i="steady"}){return c.jsxs("aside",{className:"revka-dashboard-dialogue","data-tone":i,"aria-live":"polite",children:[c.jsx("div",{className:"revka-dashboard-dialogue-portrait","aria-hidden":!e,children:e?c.jsx("img",{src:e,alt:"",draggable:!1}):c.jsx("span",{children:"OP"})}),c.jsxs("div",{className:"revka-dashboard-dialogue-box",children:[c.jsx("div",{className:"revka-dashboard-dialogue-nameplate",children:r}),c.jsxs("p",{children:[c.jsx("span",{"aria-hidden":"true",className:"revka-dashboard-dialogue-mark",children:"“"}),n]}),c.jsx("span",{"aria-hidden":"true",className:"revka-dashboard-dialogue-cue"})]})]})}function qc({title:e,children:n}){return c.jsxs("div",{className:"revka-operator-card",children:[c.jsx("div",{className:"mb-2 text-[10px] font-semibold uppercase tracking-[0.14em]",style:{color:"var(--revka-text-faint)"},children:e}),n]})}function Zx({label:e,hint:n,onClick:r}){return c.jsxs("button",{type:"button",onClick:r,className:"revka-signal-chip inline-flex items-center gap-2 font-semibold transition-colors",style:{borderColor:"var(--revka-border-soft)",background:"color-mix(in srgb, var(--revka-bg-panel-strong) 92%, transparent)",color:"var(--revka-text-primary)"},children:[c.jsx("span",{children:e}),c.jsx("span",{className:"revka-kbd",children:n})]})}function of({label:e,tone:n,onClick:r}){return c.jsx("button",{type:"button",onClick:r,className:"revka-signal-chip text-left",style:{borderColor:`color-mix(in srgb, ${n} 28%, transparent)`,background:"color-mix(in srgb, var(--revka-bg-panel-strong) 92%, transparent)",color:n},children:e})}function Ro({label:e,value:n,tone:r,compact:i=!1,assetSlot:s}){const{getSkinAsset:a}=Ta(),o=s?a(s):null;return c.jsxs("div",{className:i?"rounded-[8px] border px-3 py-2":"revka-signal-chip",style:{borderColor:`color-mix(in srgb, ${r} 30%, var(--revka-border-soft))`,background:"color-mix(in srgb, var(--revka-bg-panel-strong) 92%, transparent)",backdropFilter:i?void 0:"blur(10px)"},children:[c.jsxs("div",{className:"flex items-center justify-between gap-2",children:[c.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-[0.12em]",style:{color:"var(--revka-text-faint)"},children:e}),o?c.jsx("img",{src:o,alt:"",className:"revka-status-asset",draggable:!1}):null]}),c.jsx("div",{className:i?"mt-1 text-lg font-semibold":"mt-1 text-base font-semibold",style:{color:r},children:n})]})}function tm({label:e,tone:n}){return c.jsxs("span",{className:"inline-flex items-center gap-2 rounded-[999px] border px-2.5 py-1 text-[10px] font-semibold uppercase tracking-[0.12em]",style:{borderColor:`color-mix(in srgb, ${n} 25%, var(--revka-border-soft))`,background:"color-mix(in srgb, var(--revka-bg-panel-strong) 94%, transparent)",color:"var(--revka-text-secondary)"},children:[c.jsx("span",{className:"h-2 w-2 rounded-full",style:{background:n}}),e]})}function Q4(e){if(e==null||e==="")return null;const n=Number(e);return Number.isFinite(n)?n:null}function nA(e){const n=Q4(e.expanded_steps_completed);if(n===null)return null;const r=Q4(e.steps_completed)??0;return n>r?n:null}function rA(e,n){const r=e.current_iteration??"",i=e.current_step_instance??"";if(!r||!i)return null;const s=e.current_loop_total??"";return s?n("runs.stats.loop_fraction",{iteration:r,total:s,step:i}):n("runs.stats.loop_iteration",{iteration:r,step:i})}function js({src:e,alt:n="Agent",size:r=28,radius:i=8,iconSize:s,kind:a="agent",className:o,style:l}){const[u,d]=b.useState(!1);b.useEffect(()=>{d(!1)},[e]);const p={width:r,height:r,minWidth:r,borderRadius:i,border:"1px solid var(--revka-border-soft)",boxShadow:"inset 0 1px 0 rgba(255,255,255,0.06)",...l};if(e&&!u)return c.jsx("img",{className:o,src:e,alt:n,onError:()=>d(!0),style:{...p,display:"block",objectFit:"cover",background:"var(--revka-bg-elevated)"}});const f=a==="team"?a0:zl;return c.jsx("span",{className:o,"aria-hidden":"true",style:{...p,display:"inline-flex",alignItems:"center",justifyContent:"center",background:"color-mix(in srgb, var(--revka-signal-network-soft) 72%, var(--revka-bg-elevated))",color:"var(--revka-signal-network)"},children:c.jsx(f,{size:s??Math.max(12,Math.round(r*.5))})})}function Sf(e){if(!e)return"";const n=new Date(e);return Number.isNaN(n.getTime())?e:n.toLocaleString()}function kde({workflow:e}){const n=e?Kh(e.definition):null;return c.jsxs(st,{className:"p-4",variant:"utility",children:[c.jsx("div",{className:"revka-kicker",children:"Workflow Metadata"}),e?c.jsxs("div",{className:"mt-3 space-y-2 text-sm",children:[c.jsxs("div",{children:[c.jsx("span",{style:{color:"var(--revka-text-faint)"},children:"Version"}),": ",c.jsx("span",{style:{color:"var(--revka-text-primary)"},children:e.version})]}),c.jsxs("div",{children:[c.jsx("span",{style:{color:"var(--revka-text-faint)"},children:"Steps"}),": ",c.jsx("span",{style:{color:"var(--revka-text-primary)"},children:e.steps})]}),c.jsxs("div",{children:[c.jsx("span",{style:{color:"var(--revka-text-faint)"},children:"Tags"}),": ",c.jsx("span",{style:{color:"var(--revka-text-primary)"},children:e.tags.join(", ")||"None"})]}),c.jsxs("div",{children:[c.jsx("span",{style:{color:"var(--revka-text-faint)"},children:"Triggers"}),": ",c.jsx("span",{style:{color:"var(--revka-text-primary)"},children:(n==null?void 0:n.triggers.length)??0})]})]}):c.jsx("div",{className:"mt-3 text-sm",style:{color:"var(--revka-text-faint)"},children:"No workflow selected."})]})}function wde(e){if(!e||typeof e!="object")return!1;const n=e;return typeof n.speaker=="string"&&typeof n.content=="string"&&(typeof n.round=="number"||typeof n.round=="string")}function Sde(e){return Array.isArray(e)?e.filter(wde).map(n=>({speaker:n.speaker,content:n.content,round:Number(n.round)||0})):[]}function Cde(e){var r;if(!e)return[];if((r=e.transcript)!=null&&r.length)return e.transcript;const n=e.output_data;return Sde((n==null?void 0:n.transcript)??(n==null?void 0:n.chat_events))}function D$({task:e,step:n,title:r="Selected Node",emptyText:i,footer:s,onViewArtifact:a}){var u;const{t:o}=cn(),l=Cde(n);return c.jsxs(st,{className:"p-4",variant:"secondary",skinSlot:"stepCard",children:[c.jsx("div",{className:"revka-kicker",children:r}),e?c.jsxs("div",{className:"mt-3 space-y-2",children:[c.jsxs("div",{className:"flex items-center justify-between gap-2",children:[c.jsx("div",{className:"text-sm font-semibold",style:{color:"var(--revka-text-primary)"},children:e.name||e.id}),n?c.jsx($a,{status:n.status}):null]}),c.jsx("div",{className:"text-xs uppercase tracking-[0.12em]",style:{color:"var(--revka-text-faint)"},children:e.type}),c.jsx("p",{className:"text-sm leading-6",style:{color:"var(--revka-text-secondary)"},children:e.description||"No description provided."}),n?null:c.jsxs("div",{className:"text-xs",style:{color:"var(--revka-text-secondary)"},children:["Depends on: ",e.depends_on.join(", ")||"none"]}),n!=null&&n.output_preview?c.jsxs("div",{className:"rounded-[8px] border p-3 text-xs leading-6",style:{borderColor:"var(--revka-border-soft)",color:"var(--revka-text-secondary)"},children:[c.jsxs("div",{className:"mb-2 flex items-center justify-between gap-2",children:[c.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-[0.12em]",style:{color:"var(--revka-text-faint)"},children:"Output preview"}),n.artifact_path&&a?c.jsxs("button",{type:"button",onClick:()=>a(n),className:"inline-flex items-center gap-1 rounded-[6px] px-2 py-0.5 text-[10px] font-medium uppercase tracking-wider transition",style:{background:"var(--revka-bg-elevated)",color:"var(--revka-text-secondary)",border:"1px solid var(--revka-border-strong)"},children:[c.jsx(nv,{className:"h-3 w-3"}),"View full"]}):null]}),c.jsx("pre",{className:"whitespace-pre-wrap",style:{fontFamily:"var(--pc-font-mono)"},children:n.output_preview})]}):null,l.length?c.jsxs("div",{className:"rounded-[8px] border p-3",style:{borderColor:"var(--revka-border-soft)"},children:[c.jsxs("div",{className:"mb-2 flex items-center gap-2 text-[10px] font-semibold uppercase tracking-[0.12em]",style:{color:"var(--revka-text-faint)"},children:[c.jsx(aC,{className:"h-3 w-3"}),o("runs.tab.transcript")]}),c.jsx("div",{className:"max-h-72 space-y-2 overflow-y-auto pr-1",children:l.map((d,p)=>c.jsxs("div",{className:"rounded-[8px] border p-2",style:{borderColor:"var(--revka-border-soft)"},children:[c.jsxs("div",{className:"flex items-center justify-between gap-2 text-[10px] font-semibold uppercase tracking-[0.12em]",style:{color:"var(--revka-text-faint)"},children:[c.jsx("span",{className:"truncate",children:d.speaker}),c.jsxs("span",{children:["R",d.round]})]}),c.jsx("pre",{className:"mt-1 whitespace-pre-wrap text-xs leading-6",style:{color:"var(--revka-text-secondary)",fontFamily:"var(--pc-font-mono)"},children:d.content})]},`${d.round}-${d.speaker}-${p}`))})]}):null,n?c.jsxs("div",{className:"text-xs",style:{color:"var(--revka-text-secondary)"},children:["Agent: ",n.agent_type||"n/a"," ",n.role?`/ ${n.role}`:""]}):null,(u=n==null?void 0:n.skills)!=null&&u.length?c.jsxs("div",{className:"text-xs",style:{color:"var(--revka-text-secondary)"},children:["Skills: ",n.skills.join(", ")]}):null,n!=null&&n.agent_id?c.jsxs("div",{className:"text-xs font-mono",style:{color:"var(--revka-text-faint)"},children:["Agent ID: ",n.agent_id]}):null,s?c.jsx("div",{className:"pt-1",children:s}):null]}):c.jsx("div",{className:"mt-3 text-sm",style:{color:"var(--revka-text-faint)"},children:i})]})}function jde({run:e,workflowHref:n}){const{tpl:r}=cn(),i=e?nA(e):null,s=e?rA(e,r):null;return c.jsxs(st,{className:"p-4",variant:"utility",skinSlot:"runCard",children:[c.jsx("div",{className:"revka-kicker",children:"Run Summary"}),e?c.jsxs("div",{className:"mt-3 space-y-2 text-sm",children:[c.jsxs("div",{className:"flex items-center justify-between gap-2",children:[c.jsx("span",{style:{color:"var(--revka-text-faint)"},children:"Status"}),c.jsx($a,{status:e.status})]}),c.jsxs("div",{children:[c.jsx("span",{style:{color:"var(--revka-text-faint)"},children:"Started"}),": ",c.jsx("span",{style:{color:"var(--revka-text-primary)"},children:Sf(e.started_at)||"-"})]}),c.jsxs("div",{children:[c.jsx("span",{style:{color:"var(--revka-text-faint)"},children:"Completed"}),": ",c.jsx("span",{style:{color:"var(--revka-text-primary)"},children:Sf(e.completed_at)||"-"})]}),c.jsxs("div",{children:[c.jsx("span",{style:{color:"var(--revka-text-faint)"},children:"Steps"}),": ",c.jsxs("span",{style:{color:"var(--revka-text-primary)"},children:[e.steps_completed||"0"," / ",e.steps_total||"?"]})]}),i!==null?c.jsxs("div",{children:[c.jsx("span",{style:{color:"var(--revka-text-faint)"},children:"Expanded"}),": ",c.jsx("span",{style:{color:"var(--revka-text-primary)"},children:i})]}):null,s?c.jsxs("div",{children:[c.jsx("span",{style:{color:"var(--revka-text-faint)"},children:"Loop"}),": ",c.jsx("span",{className:"font-mono",style:{color:"var(--revka-text-primary)"},children:s})]}):null,e.error?c.jsx("div",{className:"rounded-[8px] border p-3 text-xs",style:{borderColor:"color-mix(in srgb, var(--revka-status-danger) 28%, transparent)",color:"var(--revka-status-danger)"},children:e.error}):null,n?c.jsx(bs,{to:n,className:"inline-flex items-center gap-2 text-sm",style:{color:"var(--revka-signal-network)"},children:"Open workflow definition"}):null]}):c.jsx("div",{className:"mt-3 text-sm",style:{color:"var(--revka-text-faint)"},children:"No run selected."})]})}function Nde({team:e}){return c.jsxs(st,{className:"p-4",variant:"utility",children:[c.jsx("div",{className:"revka-kicker",children:"Team Summary"}),e?c.jsxs("div",{className:"mt-3 space-y-2 text-sm",children:[c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx(js,{src:e.avatar_url,alt:e.name,size:44,radius:12,kind:"team"}),c.jsx("div",{className:"min-w-0 text-sm font-semibold",style:{color:"var(--revka-text-primary)"},children:e.name})]}),c.jsxs("div",{children:[c.jsx("span",{style:{color:"var(--revka-text-faint)"},children:"Members"}),": ",c.jsx("span",{style:{color:"var(--revka-text-primary)"},children:e.members.length||e.member_count||0})]}),c.jsxs("div",{children:[c.jsx("span",{style:{color:"var(--revka-text-faint)"},children:"Edges"}),": ",c.jsx("span",{style:{color:"var(--revka-text-primary)"},children:e.edges.length||e.edge_count||0})]}),c.jsx("p",{style:{color:"var(--revka-text-secondary)"},children:e.description||"No description."})]}):c.jsx("div",{className:"mt-3 text-sm",style:{color:"var(--revka-text-faint)"},children:"No team selected."})]})}function Ede({member:e,footer:n}){return c.jsxs(st,{className:"p-4",variant:"secondary",children:[c.jsx("div",{className:"revka-kicker",children:"Selected Member"}),e?c.jsxs("div",{className:"mt-3 space-y-2",children:[c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx(js,{src:e.avatar_url,alt:e.name,size:40,radius:10}),c.jsx("div",{className:"min-w-0 text-sm font-semibold",style:{color:"var(--revka-text-primary)"},children:e.name})]}),c.jsxs("div",{className:"text-xs uppercase tracking-[0.12em]",style:{color:"var(--revka-text-faint)"},children:[e.role," / ",e.agent_type]}),c.jsx("p",{className:"text-sm leading-6",style:{color:"var(--revka-text-secondary)"},children:e.identity}),c.jsxs("div",{className:"text-xs",style:{color:"var(--revka-text-secondary)"},children:["Expertise: ",e.expertise.join(", ")||"None"]}),n?c.jsx("div",{className:"pt-1",children:n}):null]}):c.jsx("div",{className:"mt-3 text-sm",style:{color:"var(--revka-text-faint)"},children:"Select a team member in the topology graph to inspect details."})]})}function P$({run:e,active:n=!1,label:r="Selected Run"}){const{tpl:i}=cn();if(!e)return null;const s=nA(e),a=rA(e,i);return c.jsx("div",{className:`revka-run-focus-banner ${n?"is-active":""}`,"aria-live":"polite",children:c.jsxs("div",{className:"flex items-start justify-between gap-3",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsx("div",{className:"revka-kicker",children:r}),c.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2",children:[c.jsxs("div",{className:"inline-flex items-center gap-2 text-sm font-semibold",style:{color:"var(--revka-text-primary)"},children:[c.jsx(ev,{className:"h-4 w-4",style:{color:"var(--revka-signal-network)"}}),c.jsx("span",{className:"truncate",children:e.workflow_name})]}),c.jsx("span",{className:"text-xs font-mono",style:{color:"var(--revka-text-faint)"},children:e.run_id.slice(0,8)})]}),c.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2 text-xs",style:{color:"var(--revka-text-secondary)"},children:[c.jsxs("span",{children:[e.steps_completed||"0"," / ",e.steps_total||"?"," steps"]}),s!==null?c.jsxs(c.Fragment,{children:[c.jsx("span",{"aria-hidden":"true",children:"•"}),c.jsx("span",{children:i("runs.stats.expanded_steps",{count:s})})]}):null,a?c.jsxs(c.Fragment,{children:[c.jsx("span",{"aria-hidden":"true",children:"•"}),c.jsx("span",{className:"font-mono",children:a})]}):null,c.jsx("span",{"aria-hidden":"true",children:"•"}),c.jsx("span",{children:Sf(e.started_at)||"start time unavailable"}),n?c.jsxs(c.Fragment,{children:[c.jsx("span",{"aria-hidden":"true",children:"•"}),c.jsxs("span",{className:"inline-flex items-center gap-1 font-semibold",style:{color:"var(--revka-signal-live)"},children:[c.jsx(WZ,{className:"h-3.5 w-3.5"}),"Workspace updated below"]})]}):null]})]}),c.jsx($a,{status:e.status})]})})}function si({kicker:e,description:n,actions:r}){return!e&&!n&&!r?null:c.jsxs("div",{className:"flex flex-col gap-3 lg:flex-row lg:items-end lg:justify-between",children:[c.jsxs("div",{children:[e?c.jsx("div",{className:"revka-kicker",children:e}):null,n?c.jsx("p",{className:"mt-2 max-w-3xl text-sm",style:{color:"var(--revka-text-secondary)"},children:n}):null]}),r?c.jsx("div",{className:"flex flex-wrap items-center gap-2",children:r}):null]})}const Ade={REPORTS_TO:{stroke:"#a855f7"},SUPPORTS:{stroke:"#22c55e",strokeDasharray:"5 5"},DEPENDS_ON:{stroke:"#f97316",animated:!0}},Tde={stroke:"#6b7280"},Mde=e=>Ade[e]??Tde,Rde={REPORTS_TO:"Reports To",SUPPORTS:"Supports",DEPENDS_ON:"Depends On"},Ode=e=>Rde[e]??e.replace(/_/g," ");function Dde(e){return e==="coder"?"var(--pc-accent)":e==="reviewer"?"#a855f7":"#22c55e"}function L$(e,n){var g,_;if(e.length===0)return e;const r=new Map,i=new Map;for(const x of e)r.set(x.id,[]),i.set(x.id,[]);for(const x of n)(g=r.get(x.source))==null||g.push(x.target),(_=i.get(x.target))==null||_.push(x.source);const s=e.filter(x=>(i.get(x.id)??[]).length===0);if(s.length===0)return e.map((x,v)=>({...x,position:{x:v*250,y:0}}));const a=new Map,o=new Set,l=[];for(const x of s)a.set(x.id,0),l.push(x.id),o.add(x.id);for(;l.length>0;){const x=l.shift(),v=a.get(x)??0;for(const S of r.get(x)??[])o.has(S)||(o.add(S),a.set(S,v+1),l.push(S))}for(const x of e)a.has(x.id)||a.set(x.id,0);const u=new Map;for(const[x,v]of a)u.has(v)||u.set(v,[]),u.get(v).push(x);const d=340,p=260,f=new Map;for(const[x,v]of[...u.entries()].sort((S,w)=>S[0]-w[0])){const S=d,N=-((v.length-1)*S)/2;v.forEach((C,T)=>{f.set(C,{x:N+T*S,y:x*p})})}return e.map(x=>({...x,position:f.get(x.id)??{x:0,y:0}}))}function Xr(e){if(typeof e=="string"||typeof e=="number")return""+e;let n="";if(Array.isArray(e))for(let r=0,i;r<e.length;r++)(i=Xr(e[r]))!==""&&(n+=(n&&" ")+i);else for(let r in e)e[r]&&(n+=(n&&" ")+r);return n}var Pde={value:()=>{}};function yv(){for(var e=0,n=arguments.length,r={},i;e<n;++e){if(!(i=arguments[e]+"")||i in r||/[\s.]/.test(i))throw new Error("illegal type: "+i);r[i]=[]}return new ux(r)}function ux(e){this._=e}function Lde(e,n){return e.trim().split(/^|\s+/).map(function(r){var i="",s=r.indexOf(".");if(s>=0&&(i=r.slice(s+1),r=r.slice(0,s)),r&&!n.hasOwnProperty(r))throw new Error("unknown type: "+r);return{type:r,name:i}})}ux.prototype=yv.prototype={constructor:ux,on:function(e,n){var r=this._,i=Lde(e+"",r),s,a=-1,o=i.length;if(arguments.length<2){for(;++a<o;)if((s=(e=i[a]).type)&&(s=Ide(r[s],e.name)))return s;return}if(n!=null&&typeof n!="function")throw new Error("invalid callback: "+n);for(;++a<o;)if(s=(e=i[a]).type)r[s]=Z4(r[s],e.name,n);else if(n==null)for(s in r)r[s]=Z4(r[s],e.name,null);return this},copy:function(){var e={},n=this._;for(var r in n)e[r]=n[r].slice();return new ux(e)},call:function(e,n){if((s=arguments.length-2)>0)for(var r=new Array(s),i=0,s,a;i<s;++i)r[i]=arguments[i+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(a=this._[e],i=0,s=a.length;i<s;++i)a[i].value.apply(n,r)},apply:function(e,n,r){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var i=this._[e],s=0,a=i.length;s<a;++s)i[s].value.apply(n,r)}};function Ide(e,n){for(var r=0,i=e.length,s;r<i;++r)if((s=e[r]).name===n)return s.value}function Z4(e,n,r){for(var i=0,s=e.length;i<s;++i)if(e[i].name===n){e[i]=Pde,e=e.slice(0,i).concat(e.slice(i+1));break}return r!=null&&e.push({name:n,value:r}),e}var oj="http://www.w3.org/1999/xhtml";const J4={svg:"http://www.w3.org/2000/svg",xhtml:oj,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function x0(e){var n=e+="",r=n.indexOf(":");return r>=0&&(n=e.slice(0,r))!=="xmlns"&&(e=e.slice(r+1)),J4.hasOwnProperty(n)?{space:J4[n],local:e}:e}function Bde(e){return function(){var n=this.ownerDocument,r=this.namespaceURI;return r===oj&&n.documentElement.namespaceURI===oj?n.createElement(e):n.createElementNS(r,e)}}function zde(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function I$(e){var n=x0(e);return(n.local?zde:Bde)(n)}function $de(){}function iA(e){return e==null?$de:function(){return this.querySelector(e)}}function Fde(e){typeof e!="function"&&(e=iA(e));for(var n=this._groups,r=n.length,i=new Array(r),s=0;s<r;++s)for(var a=n[s],o=a.length,l=i[s]=new Array(o),u,d,p=0;p<o;++p)(u=a[p])&&(d=e.call(u,u.__data__,p,a))&&("__data__"in u&&(d.__data__=u.__data__),l[p]=d);return new ea(i,this._parents)}function Hde(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Wde(){return[]}function B$(e){return e==null?Wde:function(){return this.querySelectorAll(e)}}function qde(e){return function(){return Hde(e.apply(this,arguments))}}function Ude(e){typeof e=="function"?e=qde(e):e=B$(e);for(var n=this._groups,r=n.length,i=[],s=[],a=0;a<r;++a)for(var o=n[a],l=o.length,u,d=0;d<l;++d)(u=o[d])&&(i.push(e.call(u,u.__data__,d,o)),s.push(u));return new ea(i,s)}function z$(e){return function(){return this.matches(e)}}function $$(e){return function(n){return n.matches(e)}}var Vde=Array.prototype.find;function Kde(e){return function(){return Vde.call(this.children,e)}}function Yde(){return this.firstElementChild}function Gde(e){return this.select(e==null?Yde:Kde(typeof e=="function"?e:$$(e)))}var Xde=Array.prototype.filter;function Qde(){return Array.from(this.children)}function Zde(e){return function(){return Xde.call(this.children,e)}}function Jde(e){return this.selectAll(e==null?Qde:Zde(typeof e=="function"?e:$$(e)))}function ehe(e){typeof e!="function"&&(e=z$(e));for(var n=this._groups,r=n.length,i=new Array(r),s=0;s<r;++s)for(var a=n[s],o=a.length,l=i[s]=[],u,d=0;d<o;++d)(u=a[d])&&e.call(u,u.__data__,d,a)&&l.push(u);return new ea(i,this._parents)}function F$(e){return new Array(e.length)}function the(){return new ea(this._enter||this._groups.map(F$),this._parents)}function Jx(e,n){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=n}Jx.prototype={constructor:Jx,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,n){return this._parent.insertBefore(e,n)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function nhe(e){return function(){return e}}function rhe(e,n,r,i,s,a){for(var o=0,l,u=n.length,d=a.length;o<d;++o)(l=n[o])?(l.__data__=a[o],i[o]=l):r[o]=new Jx(e,a[o]);for(;o<u;++o)(l=n[o])&&(s[o]=l)}function ihe(e,n,r,i,s,a,o){var l,u,d=new Map,p=n.length,f=a.length,g=new Array(p),_;for(l=0;l<p;++l)(u=n[l])&&(g[l]=_=o.call(u,u.__data__,l,n)+"",d.has(_)?s[l]=u:d.set(_,u));for(l=0;l<f;++l)_=o.call(e,a[l],l,a)+"",(u=d.get(_))?(i[l]=u,u.__data__=a[l],d.delete(_)):r[l]=new Jx(e,a[l]);for(l=0;l<p;++l)(u=n[l])&&d.get(g[l])===u&&(s[l]=u)}function she(e){return e.__data__}function ahe(e,n){if(!arguments.length)return Array.from(this,she);var r=n?ihe:rhe,i=this._parents,s=this._groups;typeof e!="function"&&(e=nhe(e));for(var a=s.length,o=new Array(a),l=new Array(a),u=new Array(a),d=0;d<a;++d){var p=i[d],f=s[d],g=f.length,_=ohe(e.call(p,p&&p.__data__,d,i)),x=_.length,v=l[d]=new Array(x),S=o[d]=new Array(x),w=u[d]=new Array(g);r(p,f,v,S,w,_,n);for(var N=0,C=0,T,A;N<x;++N)if(T=v[N]){for(N>=C&&(C=N+1);!(A=S[C])&&++C<x;);T._next=A||null}}return o=new ea(o,i),o._enter=l,o._exit=u,o}function ohe(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function lhe(){return new ea(this._exit||this._groups.map(F$),this._parents)}function che(e,n,r){var i=this.enter(),s=this,a=this.exit();return typeof e=="function"?(i=e(i),i&&(i=i.selection())):i=i.append(e+""),n!=null&&(s=n(s),s&&(s=s.selection())),r==null?a.remove():r(a),i&&s?i.merge(s).order():s}function uhe(e){for(var n=e.selection?e.selection():e,r=this._groups,i=n._groups,s=r.length,a=i.length,o=Math.min(s,a),l=new Array(s),u=0;u<o;++u)for(var d=r[u],p=i[u],f=d.length,g=l[u]=new Array(f),_,x=0;x<f;++x)(_=d[x]||p[x])&&(g[x]=_);for(;u<s;++u)l[u]=r[u];return new ea(l,this._parents)}function dhe(){for(var e=this._groups,n=-1,r=e.length;++n<r;)for(var i=e[n],s=i.length-1,a=i[s],o;--s>=0;)(o=i[s])&&(a&&o.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(o,a),a=o);return this}function hhe(e){e||(e=fhe);function n(f,g){return f&&g?e(f.__data__,g.__data__):!f-!g}for(var r=this._groups,i=r.length,s=new Array(i),a=0;a<i;++a){for(var o=r[a],l=o.length,u=s[a]=new Array(l),d,p=0;p<l;++p)(d=o[p])&&(u[p]=d);u.sort(n)}return new ea(s,this._parents).order()}function fhe(e,n){return e<n?-1:e>n?1:e>=n?0:NaN}function phe(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function mhe(){return Array.from(this)}function ghe(){for(var e=this._groups,n=0,r=e.length;n<r;++n)for(var i=e[n],s=0,a=i.length;s<a;++s){var o=i[s];if(o)return o}return null}function vhe(){let e=0;for(const n of this)++e;return e}function yhe(){return!this.node()}function _he(e){for(var n=this._groups,r=0,i=n.length;r<i;++r)for(var s=n[r],a=0,o=s.length,l;a<o;++a)(l=s[a])&&e.call(l,l.__data__,a,s);return this}function xhe(e){return function(){this.removeAttribute(e)}}function bhe(e){return function(){this.removeAttributeNS(e.space,e.local)}}function khe(e,n){return function(){this.setAttribute(e,n)}}function whe(e,n){return function(){this.setAttributeNS(e.space,e.local,n)}}function She(e,n){return function(){var r=n.apply(this,arguments);r==null?this.removeAttribute(e):this.setAttribute(e,r)}}function Che(e,n){return function(){var r=n.apply(this,arguments);r==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,r)}}function jhe(e,n){var r=x0(e);if(arguments.length<2){var i=this.node();return r.local?i.getAttributeNS(r.space,r.local):i.getAttribute(r)}return this.each((n==null?r.local?bhe:xhe:typeof n=="function"?r.local?Che:She:r.local?whe:khe)(r,n))}function H$(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Nhe(e){return function(){this.style.removeProperty(e)}}function Ehe(e,n,r){return function(){this.style.setProperty(e,n,r)}}function Ahe(e,n,r){return function(){var i=n.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,r)}}function The(e,n,r){return arguments.length>1?this.each((n==null?Nhe:typeof n=="function"?Ahe:Ehe)(e,n,r??"")):Cf(this.node(),e)}function Cf(e,n){return e.style.getPropertyValue(n)||H$(e).getComputedStyle(e,null).getPropertyValue(n)}function Mhe(e){return function(){delete this[e]}}function Rhe(e,n){return function(){this[e]=n}}function Ohe(e,n){return function(){var r=n.apply(this,arguments);r==null?delete this[e]:this[e]=r}}function Dhe(e,n){return arguments.length>1?this.each((n==null?Mhe:typeof n=="function"?Ohe:Rhe)(e,n)):this.node()[e]}function W$(e){return e.trim().split(/^|\s+/)}function sA(e){return e.classList||new q$(e)}function q$(e){this._node=e,this._names=W$(e.getAttribute("class")||"")}q$.prototype={add:function(e){var n=this._names.indexOf(e);n<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var n=this._names.indexOf(e);n>=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function U$(e,n){for(var r=sA(e),i=-1,s=n.length;++i<s;)r.add(n[i])}function V$(e,n){for(var r=sA(e),i=-1,s=n.length;++i<s;)r.remove(n[i])}function Phe(e){return function(){U$(this,e)}}function Lhe(e){return function(){V$(this,e)}}function Ihe(e,n){return function(){(n.apply(this,arguments)?U$:V$)(this,e)}}function Bhe(e,n){var r=W$(e+"");if(arguments.length<2){for(var i=sA(this.node()),s=-1,a=r.length;++s<a;)if(!i.contains(r[s]))return!1;return!0}return this.each((typeof n=="function"?Ihe:n?Phe:Lhe)(r,n))}function zhe(){this.textContent=""}function $he(e){return function(){this.textContent=e}}function Fhe(e){return function(){var n=e.apply(this,arguments);this.textContent=n??""}}function Hhe(e){return arguments.length?this.each(e==null?zhe:(typeof e=="function"?Fhe:$he)(e)):this.node().textContent}function Whe(){this.innerHTML=""}function qhe(e){return function(){this.innerHTML=e}}function Uhe(e){return function(){var n=e.apply(this,arguments);this.innerHTML=n??""}}function Vhe(e){return arguments.length?this.each(e==null?Whe:(typeof e=="function"?Uhe:qhe)(e)):this.node().innerHTML}function Khe(){this.nextSibling&&this.parentNode.appendChild(this)}function Yhe(){return this.each(Khe)}function Ghe(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Xhe(){return this.each(Ghe)}function Qhe(e){var n=typeof e=="function"?e:I$(e);return this.select(function(){return this.appendChild(n.apply(this,arguments))})}function Zhe(){return null}function Jhe(e,n){var r=typeof e=="function"?e:I$(e),i=n==null?Zhe:typeof n=="function"?n:iA(n);return this.select(function(){return this.insertBefore(r.apply(this,arguments),i.apply(this,arguments)||null)})}function efe(){var e=this.parentNode;e&&e.removeChild(this)}function tfe(){return this.each(efe)}function nfe(){var e=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function rfe(){var e=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function ife(e){return this.select(e?rfe:nfe)}function sfe(e){return arguments.length?this.property("__data__",e):this.node().__data__}function afe(e){return function(n){e.call(this,n,this.__data__)}}function ofe(e){return e.trim().split(/^|\s+/).map(function(n){var r="",i=n.indexOf(".");return i>=0&&(r=n.slice(i+1),n=n.slice(0,i)),{type:n,name:r}})}function lfe(e){return function(){var n=this.__on;if(n){for(var r=0,i=-1,s=n.length,a;r<s;++r)a=n[r],(!e.type||a.type===e.type)&&a.name===e.name?this.removeEventListener(a.type,a.listener,a.options):n[++i]=a;++i?n.length=i:delete this.__on}}}function cfe(e,n,r){return function(){var i=this.__on,s,a=afe(n);if(i){for(var o=0,l=i.length;o<l;++o)if((s=i[o]).type===e.type&&s.name===e.name){this.removeEventListener(s.type,s.listener,s.options),this.addEventListener(s.type,s.listener=a,s.options=r),s.value=n;return}}this.addEventListener(e.type,a,r),s={type:e.type,name:e.name,value:n,listener:a,options:r},i?i.push(s):this.__on=[s]}}function ufe(e,n,r){var i=ofe(e+""),s,a=i.length,o;if(arguments.length<2){var l=this.node().__on;if(l){for(var u=0,d=l.length,p;u<d;++u)for(s=0,p=l[u];s<a;++s)if((o=i[s]).type===p.type&&o.name===p.name)return p.value}return}for(l=n?cfe:lfe,s=0;s<a;++s)this.each(l(i[s],n,r));return this}function K$(e,n,r){var i=H$(e),s=i.CustomEvent;typeof s=="function"?s=new s(n,r):(s=i.document.createEvent("Event"),r?(s.initEvent(n,r.bubbles,r.cancelable),s.detail=r.detail):s.initEvent(n,!1,!1)),e.dispatchEvent(s)}function dfe(e,n){return function(){return K$(this,e,n)}}function hfe(e,n){return function(){return K$(this,e,n.apply(this,arguments))}}function ffe(e,n){return this.each((typeof n=="function"?hfe:dfe)(e,n))}function*pfe(){for(var e=this._groups,n=0,r=e.length;n<r;++n)for(var i=e[n],s=0,a=i.length,o;s<a;++s)(o=i[s])&&(yield o)}var Y$=[null];function ea(e,n){this._groups=e,this._parents=n}function _v(){return new ea([[document.documentElement]],Y$)}function mfe(){return this}ea.prototype=_v.prototype={constructor:ea,select:Fde,selectAll:Ude,selectChild:Gde,selectChildren:Jde,filter:ehe,data:ahe,enter:the,exit:lhe,join:che,merge:uhe,selection:mfe,order:dhe,sort:hhe,call:phe,nodes:mhe,node:ghe,size:vhe,empty:yhe,each:_he,attr:jhe,style:The,property:Dhe,classed:Bhe,text:Hhe,html:Vhe,raise:Yhe,lower:Xhe,append:Qhe,insert:Jhe,remove:tfe,clone:ife,datum:sfe,on:ufe,dispatch:ffe,[Symbol.iterator]:pfe};function Fi(e){return typeof e=="string"?new ea([[document.querySelector(e)]],[document.documentElement]):new ea([[e]],Y$)}function gfe(e){let n;for(;n=e.sourceEvent;)e=n;return e}function _a(e,n){if(e=gfe(e),n===void 0&&(n=e.currentTarget),n){var r=n.ownerSVGElement||n;if(r.createSVGPoint){var i=r.createSVGPoint();return i.x=e.clientX,i.y=e.clientY,i=i.matrixTransform(n.getScreenCTM().inverse()),[i.x,i.y]}if(n.getBoundingClientRect){var s=n.getBoundingClientRect();return[e.clientX-s.left-n.clientLeft,e.clientY-s.top-n.clientTop]}}return[e.pageX,e.pageY]}const vfe={passive:!1},xg={capture:!0,passive:!1};function eS(e){e.stopImmediatePropagation()}function lf(e){e.preventDefault(),e.stopImmediatePropagation()}function G$(e){var n=e.document.documentElement,r=Fi(e).on("dragstart.drag",lf,xg);"onselectstart"in n?r.on("selectstart.drag",lf,xg):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}function X$(e,n){var r=e.document.documentElement,i=Fi(e).on("dragstart.drag",null);n&&(i.on("click.drag",lf,xg),setTimeout(function(){i.on("click.drag",null)},0)),"onselectstart"in r?i.on("selectstart.drag",null):(r.style.MozUserSelect=r.__noselect,delete r.__noselect)}const e_=e=>()=>e;function lj(e,{sourceEvent:n,subject:r,target:i,identifier:s,active:a,x:o,y:l,dx:u,dy:d,dispatch:p}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},subject:{value:r,enumerable:!0,configurable:!0},target:{value:i,enumerable:!0,configurable:!0},identifier:{value:s,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:o,enumerable:!0,configurable:!0},y:{value:l,enumerable:!0,configurable:!0},dx:{value:u,enumerable:!0,configurable:!0},dy:{value:d,enumerable:!0,configurable:!0},_:{value:p}})}lj.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function yfe(e){return!e.ctrlKey&&!e.button}function _fe(){return this.parentNode}function xfe(e,n){return n??{x:e.x,y:e.y}}function bfe(){return navigator.maxTouchPoints||"ontouchstart"in this}function aA(){var e=yfe,n=_fe,r=xfe,i=bfe,s={},a=yv("start","drag","end"),o=0,l,u,d,p,f=0;function g(T){T.on("mousedown.drag",_).filter(i).on("touchstart.drag",S).on("touchmove.drag",w,vfe).on("touchend.drag touchcancel.drag",N).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function _(T,A){if(!(p||!e.call(this,T,A))){var E=C(this,n.call(this,T,A),T,A,"mouse");E&&(Fi(T.view).on("mousemove.drag",x,xg).on("mouseup.drag",v,xg),G$(T.view),eS(T),d=!1,l=T.clientX,u=T.clientY,E("start",T))}}function x(T){if(lf(T),!d){var A=T.clientX-l,E=T.clientY-u;d=A*A+E*E>f}s.mouse("drag",T)}function v(T){Fi(T.view).on("mousemove.drag mouseup.drag",null),X$(T.view,d),lf(T),s.mouse("end",T)}function S(T,A){if(e.call(this,T,A)){var E=T.changedTouches,D=n.call(this,T,A),F=E.length,B,H;for(B=0;B<F;++B)(H=C(this,D,T,A,E[B].identifier,E[B]))&&(eS(T),H("start",T,E[B]))}}function w(T){var A=T.changedTouches,E=A.length,D,F;for(D=0;D<E;++D)(F=s[A[D].identifier])&&(lf(T),F("drag",T,A[D]))}function N(T){var A=T.changedTouches,E=A.length,D,F;for(p&&clearTimeout(p),p=setTimeout(function(){p=null},500),D=0;D<E;++D)(F=s[A[D].identifier])&&(eS(T),F("end",T,A[D]))}function C(T,A,E,D,F,B){var H=a.copy(),$=_a(B||E,A),z,W,P;if((P=r.call(T,new lj("beforestart",{sourceEvent:E,target:g,identifier:F,active:o,x:$[0],y:$[1],dx:0,dy:0,dispatch:H}),D))!=null)return z=P.x-$[0]||0,W=P.y-$[1]||0,function q(I,Q,K){var Z=$,Y;switch(I){case"start":s[F]=q,Y=o++;break;case"end":delete s[F],--o;case"drag":$=_a(K||Q,A),Y=o;break}H.call(I,T,new lj(I,{sourceEvent:Q,subject:P,target:g,identifier:F,active:Y,x:$[0]+z,y:$[1]+W,dx:$[0]-Z[0],dy:$[1]-Z[1],dispatch:H}),D)}}return g.filter=function(T){return arguments.length?(e=typeof T=="function"?T:e_(!!T),g):e},g.container=function(T){return arguments.length?(n=typeof T=="function"?T:e_(T),g):n},g.subject=function(T){return arguments.length?(r=typeof T=="function"?T:e_(T),g):r},g.touchable=function(T){return arguments.length?(i=typeof T=="function"?T:e_(!!T),g):i},g.on=function(){var T=a.on.apply(a,arguments);return T===a?g:T},g.clickDistance=function(T){return arguments.length?(f=(T=+T)*T,g):Math.sqrt(f)},g}function oA(e,n,r){e.prototype=n.prototype=r,r.constructor=e}function Q$(e,n){var r=Object.create(e.prototype);for(var i in n)r[i]=n[i];return r}function xv(){}var bg=.7,eb=1/bg,cf="\\s*([+-]?\\d+)\\s*",kg="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Vo="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",kfe=/^#([0-9a-f]{3,8})$/,wfe=new RegExp(`^rgb\\(${cf},${cf},${cf}\\)$`),Sfe=new RegExp(`^rgb\\(${Vo},${Vo},${Vo}\\)$`),Cfe=new RegExp(`^rgba\\(${cf},${cf},${cf},${kg}\\)$`),jfe=new RegExp(`^rgba\\(${Vo},${Vo},${Vo},${kg}\\)$`),Nfe=new RegExp(`^hsl\\(${kg},${Vo},${Vo}\\)$`),Efe=new RegExp(`^hsla\\(${kg},${Vo},${Vo},${kg}\\)$`),eD={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};oA(xv,Sd,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:tD,formatHex:tD,formatHex8:Afe,formatHsl:Tfe,formatRgb:nD,toString:nD});function tD(){return this.rgb().formatHex()}function Afe(){return this.rgb().formatHex8()}function Tfe(){return Z$(this).formatHsl()}function nD(){return this.rgb().formatRgb()}function Sd(e){var n,r;return e=(e+"").trim().toLowerCase(),(n=kfe.exec(e))?(r=n[1].length,n=parseInt(n[1],16),r===6?rD(n):r===3?new ws(n>>8&15|n>>4&240,n>>4&15|n&240,(n&15)<<4|n&15,1):r===8?t_(n>>24&255,n>>16&255,n>>8&255,(n&255)/255):r===4?t_(n>>12&15|n>>8&240,n>>8&15|n>>4&240,n>>4&15|n&240,((n&15)<<4|n&15)/255):null):(n=wfe.exec(e))?new ws(n[1],n[2],n[3],1):(n=Sfe.exec(e))?new ws(n[1]*255/100,n[2]*255/100,n[3]*255/100,1):(n=Cfe.exec(e))?t_(n[1],n[2],n[3],n[4]):(n=jfe.exec(e))?t_(n[1]*255/100,n[2]*255/100,n[3]*255/100,n[4]):(n=Nfe.exec(e))?aD(n[1],n[2]/100,n[3]/100,1):(n=Efe.exec(e))?aD(n[1],n[2]/100,n[3]/100,n[4]):eD.hasOwnProperty(e)?rD(eD[e]):e==="transparent"?new ws(NaN,NaN,NaN,0):null}function rD(e){return new ws(e>>16&255,e>>8&255,e&255,1)}function t_(e,n,r,i){return i<=0&&(e=n=r=NaN),new ws(e,n,r,i)}function Mfe(e){return e instanceof xv||(e=Sd(e)),e?(e=e.rgb(),new ws(e.r,e.g,e.b,e.opacity)):new ws}function cj(e,n,r,i){return arguments.length===1?Mfe(e):new ws(e,n,r,i??1)}function ws(e,n,r,i){this.r=+e,this.g=+n,this.b=+r,this.opacity=+i}oA(ws,cj,Q$(xv,{brighter(e){return e=e==null?eb:Math.pow(eb,e),new ws(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?bg:Math.pow(bg,e),new ws(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new ws(pd(this.r),pd(this.g),pd(this.b),tb(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:iD,formatHex:iD,formatHex8:Rfe,formatRgb:sD,toString:sD}));function iD(){return`#${od(this.r)}${od(this.g)}${od(this.b)}`}function Rfe(){return`#${od(this.r)}${od(this.g)}${od(this.b)}${od((isNaN(this.opacity)?1:this.opacity)*255)}`}function sD(){const e=tb(this.opacity);return`${e===1?"rgb(":"rgba("}${pd(this.r)}, ${pd(this.g)}, ${pd(this.b)}${e===1?")":`, ${e})`}`}function tb(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function pd(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function od(e){return e=pd(e),(e<16?"0":"")+e.toString(16)}function aD(e,n,r,i){return i<=0?e=n=r=NaN:r<=0||r>=1?e=n=NaN:n<=0&&(e=NaN),new Fa(e,n,r,i)}function Z$(e){if(e instanceof Fa)return new Fa(e.h,e.s,e.l,e.opacity);if(e instanceof xv||(e=Sd(e)),!e)return new Fa;if(e instanceof Fa)return e;e=e.rgb();var n=e.r/255,r=e.g/255,i=e.b/255,s=Math.min(n,r,i),a=Math.max(n,r,i),o=NaN,l=a-s,u=(a+s)/2;return l?(n===a?o=(r-i)/l+(r<i)*6:r===a?o=(i-n)/l+2:o=(n-r)/l+4,l/=u<.5?a+s:2-a-s,o*=60):l=u>0&&u<1?0:o,new Fa(o,l,u,e.opacity)}function Ofe(e,n,r,i){return arguments.length===1?Z$(e):new Fa(e,n,r,i??1)}function Fa(e,n,r,i){this.h=+e,this.s=+n,this.l=+r,this.opacity=+i}oA(Fa,Ofe,Q$(xv,{brighter(e){return e=e==null?eb:Math.pow(eb,e),new Fa(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?bg:Math.pow(bg,e),new Fa(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,n=isNaN(e)||isNaN(this.s)?0:this.s,r=this.l,i=r+(r<.5?r:1-r)*n,s=2*r-i;return new ws(tS(e>=240?e-240:e+120,s,i),tS(e,s,i),tS(e<120?e+240:e-120,s,i),this.opacity)},clamp(){return new Fa(oD(this.h),n_(this.s),n_(this.l),tb(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=tb(this.opacity);return`${e===1?"hsl(":"hsla("}${oD(this.h)}, ${n_(this.s)*100}%, ${n_(this.l)*100}%${e===1?")":`, ${e})`}`}}));function oD(e){return e=(e||0)%360,e<0?e+360:e}function n_(e){return Math.max(0,Math.min(1,e||0))}function tS(e,n,r){return(e<60?n+(r-n)*e/60:e<180?r:e<240?n+(r-n)*(240-e)/60:n)*255}const lA=e=>()=>e;function Dfe(e,n){return function(r){return e+r*n}}function Pfe(e,n,r){return e=Math.pow(e,r),n=Math.pow(n,r)-e,r=1/r,function(i){return Math.pow(e+i*n,r)}}function Lfe(e){return(e=+e)==1?J$:function(n,r){return r-n?Pfe(n,r,e):lA(isNaN(n)?r:n)}}function J$(e,n){var r=n-e;return r?Dfe(e,r):lA(isNaN(e)?n:e)}const nb=(function e(n){var r=Lfe(n);function i(s,a){var o=r((s=cj(s)).r,(a=cj(a)).r),l=r(s.g,a.g),u=r(s.b,a.b),d=J$(s.opacity,a.opacity);return function(p){return s.r=o(p),s.g=l(p),s.b=u(p),s.opacity=d(p),s+""}}return i.gamma=e,i})(1);function Ife(e,n){n||(n=[]);var r=e?Math.min(n.length,e.length):0,i=n.slice(),s;return function(a){for(s=0;s<r;++s)i[s]=e[s]*(1-a)+n[s]*a;return i}}function Bfe(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function zfe(e,n){var r=n?n.length:0,i=e?Math.min(r,e.length):0,s=new Array(i),a=new Array(r),o;for(o=0;o<i;++o)s[o]=Gm(e[o],n[o]);for(;o<r;++o)a[o]=n[o];return function(l){for(o=0;o<i;++o)a[o]=s[o](l);return a}}function $fe(e,n){var r=new Date;return e=+e,n=+n,function(i){return r.setTime(e*(1-i)+n*i),r}}function Mo(e,n){return e=+e,n=+n,function(r){return e*(1-r)+n*r}}function Ffe(e,n){var r={},i={},s;(e===null||typeof e!="object")&&(e={}),(n===null||typeof n!="object")&&(n={});for(s in n)s in e?r[s]=Gm(e[s],n[s]):i[s]=n[s];return function(a){for(s in r)i[s]=r[s](a);return i}}var uj=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,nS=new RegExp(uj.source,"g");function Hfe(e){return function(){return e}}function Wfe(e){return function(n){return e(n)+""}}function e7(e,n){var r=uj.lastIndex=nS.lastIndex=0,i,s,a,o=-1,l=[],u=[];for(e=e+"",n=n+"";(i=uj.exec(e))&&(s=nS.exec(n));)(a=s.index)>r&&(a=n.slice(r,a),l[o]?l[o]+=a:l[++o]=a),(i=i[0])===(s=s[0])?l[o]?l[o]+=s:l[++o]=s:(l[++o]=null,u.push({i:o,x:Mo(i,s)})),r=nS.lastIndex;return r<n.length&&(a=n.slice(r),l[o]?l[o]+=a:l[++o]=a),l.length<2?u[0]?Wfe(u[0].x):Hfe(n):(n=u.length,function(d){for(var p=0,f;p<n;++p)l[(f=u[p]).i]=f.x(d);return l.join("")})}function Gm(e,n){var r=typeof n,i;return n==null||r==="boolean"?lA(n):(r==="number"?Mo:r==="string"?(i=Sd(n))?(n=i,nb):e7:n instanceof Sd?nb:n instanceof Date?$fe:Bfe(n)?Ife:Array.isArray(n)?zfe:typeof n.valueOf!="function"&&typeof n.toString!="function"||isNaN(n)?Ffe:Mo)(e,n)}var lD=180/Math.PI,dj={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function t7(e,n,r,i,s,a){var o,l,u;return(o=Math.sqrt(e*e+n*n))&&(e/=o,n/=o),(u=e*r+n*i)&&(r-=e*u,i-=n*u),(l=Math.sqrt(r*r+i*i))&&(r/=l,i/=l,u/=l),e*i<n*r&&(e=-e,n=-n,u=-u,o=-o),{translateX:s,translateY:a,rotate:Math.atan2(n,e)*lD,skewX:Math.atan(u)*lD,scaleX:o,scaleY:l}}var r_;function qfe(e){const n=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return n.isIdentity?dj:t7(n.a,n.b,n.c,n.d,n.e,n.f)}function Ufe(e){return e==null||(r_||(r_=document.createElementNS("http://www.w3.org/2000/svg","g")),r_.setAttribute("transform",e),!(e=r_.transform.baseVal.consolidate()))?dj:(e=e.matrix,t7(e.a,e.b,e.c,e.d,e.e,e.f))}function n7(e,n,r,i){function s(d){return d.length?d.pop()+" ":""}function a(d,p,f,g,_,x){if(d!==f||p!==g){var v=_.push("translate(",null,n,null,r);x.push({i:v-4,x:Mo(d,f)},{i:v-2,x:Mo(p,g)})}else(f||g)&&_.push("translate("+f+n+g+r)}function o(d,p,f,g){d!==p?(d-p>180?p+=360:p-d>180&&(d+=360),g.push({i:f.push(s(f)+"rotate(",null,i)-2,x:Mo(d,p)})):p&&f.push(s(f)+"rotate("+p+i)}function l(d,p,f,g){d!==p?g.push({i:f.push(s(f)+"skewX(",null,i)-2,x:Mo(d,p)}):p&&f.push(s(f)+"skewX("+p+i)}function u(d,p,f,g,_,x){if(d!==f||p!==g){var v=_.push(s(_)+"scale(",null,",",null,")");x.push({i:v-4,x:Mo(d,f)},{i:v-2,x:Mo(p,g)})}else(f!==1||g!==1)&&_.push(s(_)+"scale("+f+","+g+")")}return function(d,p){var f=[],g=[];return d=e(d),p=e(p),a(d.translateX,d.translateY,p.translateX,p.translateY,f,g),o(d.rotate,p.rotate,f,g),l(d.skewX,p.skewX,f,g),u(d.scaleX,d.scaleY,p.scaleX,p.scaleY,f,g),d=p=null,function(_){for(var x=-1,v=g.length,S;++x<v;)f[(S=g[x]).i]=S.x(_);return f.join("")}}}var Vfe=n7(qfe,"px, ","px)","deg)"),Kfe=n7(Ufe,", ",")",")"),Yfe=1e-12;function cD(e){return((e=Math.exp(e))+1/e)/2}function Gfe(e){return((e=Math.exp(e))-1/e)/2}function Xfe(e){return((e=Math.exp(2*e))-1)/(e+1)}const dx=(function e(n,r,i){function s(a,o){var l=a[0],u=a[1],d=a[2],p=o[0],f=o[1],g=o[2],_=p-l,x=f-u,v=_*_+x*x,S,w;if(v<Yfe)w=Math.log(g/d)/n,S=function(D){return[l+D*_,u+D*x,d*Math.exp(n*D*w)]};else{var N=Math.sqrt(v),C=(g*g-d*d+i*v)/(2*d*r*N),T=(g*g-d*d-i*v)/(2*g*r*N),A=Math.log(Math.sqrt(C*C+1)-C),E=Math.log(Math.sqrt(T*T+1)-T);w=(E-A)/n,S=function(D){var F=D*w,B=cD(A),H=d/(r*N)*(B*Xfe(n*F+A)-Gfe(A));return[l+H*_,u+H*x,d*B/cD(n*F+A)]}}return S.duration=w*1e3*n/Math.SQRT2,S}return s.rho=function(a){var o=Math.max(.001,+a),l=o*o,u=l*l;return e(o,l,u)},s})(Math.SQRT2,2,4);var jf=0,Tm=0,nm=0,r7=1e3,rb,Mm,ib=0,Cd=0,b0=0,wg=typeof performance=="object"&&performance.now?performance:Date,i7=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function cA(){return Cd||(i7(Qfe),Cd=wg.now()+b0)}function Qfe(){Cd=0}function sb(){this._call=this._time=this._next=null}sb.prototype=uA.prototype={constructor:sb,restart:function(e,n,r){if(typeof e!="function")throw new TypeError("callback is not a function");r=(r==null?cA():+r)+(n==null?0:+n),!this._next&&Mm!==this&&(Mm?Mm._next=this:rb=this,Mm=this),this._call=e,this._time=r,hj()},stop:function(){this._call&&(this._call=null,this._time=1/0,hj())}};function uA(e,n,r){var i=new sb;return i.restart(e,n,r),i}function Zfe(){cA(),++jf;for(var e=rb,n;e;)(n=Cd-e._time)>=0&&e._call.call(void 0,n),e=e._next;--jf}function uD(){Cd=(ib=wg.now())+b0,jf=Tm=0;try{Zfe()}finally{jf=0,epe(),Cd=0}}function Jfe(){var e=wg.now(),n=e-ib;n>r7&&(b0-=n,ib=e)}function epe(){for(var e,n=rb,r,i=1/0;n;)n._call?(i>n._time&&(i=n._time),e=n,n=n._next):(r=n._next,n._next=null,n=e?e._next=r:rb=r);Mm=e,hj(i)}function hj(e){if(!jf){Tm&&(Tm=clearTimeout(Tm));var n=e-Cd;n>24?(e<1/0&&(Tm=setTimeout(uD,e-wg.now()-b0)),nm&&(nm=clearInterval(nm))):(nm||(ib=wg.now(),nm=setInterval(Jfe,r7)),jf=1,i7(uD))}}function dD(e,n,r){var i=new sb;return n=n==null?0:+n,i.restart(s=>{i.stop(),e(s+n)},n,r),i}var tpe=yv("start","end","cancel","interrupt"),npe=[],s7=0,hD=1,fj=2,hx=3,fD=4,pj=5,fx=6;function k0(e,n,r,i,s,a){var o=e.__transition;if(!o)e.__transition={};else if(r in o)return;rpe(e,r,{name:n,index:i,group:s,on:tpe,tween:npe,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:s7})}function dA(e,n){var r=no(e,n);if(r.state>s7)throw new Error("too late; already scheduled");return r}function el(e,n){var r=no(e,n);if(r.state>hx)throw new Error("too late; already running");return r}function no(e,n){var r=e.__transition;if(!r||!(r=r[n]))throw new Error("transition not found");return r}function rpe(e,n,r){var i=e.__transition,s;i[n]=r,r.timer=uA(a,0,r.time);function a(d){r.state=hD,r.timer.restart(o,r.delay,r.time),r.delay<=d&&o(d-r.delay)}function o(d){var p,f,g,_;if(r.state!==hD)return u();for(p in i)if(_=i[p],_.name===r.name){if(_.state===hx)return dD(o);_.state===fD?(_.state=fx,_.timer.stop(),_.on.call("interrupt",e,e.__data__,_.index,_.group),delete i[p]):+p<n&&(_.state=fx,_.timer.stop(),_.on.call("cancel",e,e.__data__,_.index,_.group),delete i[p])}if(dD(function(){r.state===hx&&(r.state=fD,r.timer.restart(l,r.delay,r.time),l(d))}),r.state=fj,r.on.call("start",e,e.__data__,r.index,r.group),r.state===fj){for(r.state=hx,s=new Array(g=r.tween.length),p=0,f=-1;p<g;++p)(_=r.tween[p].value.call(e,e.__data__,r.index,r.group))&&(s[++f]=_);s.length=f+1}}function l(d){for(var p=d<r.duration?r.ease.call(null,d/r.duration):(r.timer.restart(u),r.state=pj,1),f=-1,g=s.length;++f<g;)s[f].call(e,p);r.state===pj&&(r.on.call("end",e,e.__data__,r.index,r.group),u())}function u(){r.state=fx,r.timer.stop(),delete i[n];for(var d in i)return;delete e.__transition}}function px(e,n){var r=e.__transition,i,s,a=!0,o;if(r){n=n==null?null:n+"";for(o in r){if((i=r[o]).name!==n){a=!1;continue}s=i.state>fj&&i.state<pj,i.state=fx,i.timer.stop(),i.on.call(s?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete r[o]}a&&delete e.__transition}}function ipe(e){return this.each(function(){px(this,e)})}function spe(e,n){var r,i;return function(){var s=el(this,e),a=s.tween;if(a!==r){i=r=a;for(var o=0,l=i.length;o<l;++o)if(i[o].name===n){i=i.slice(),i.splice(o,1);break}}s.tween=i}}function ape(e,n,r){var i,s;if(typeof r!="function")throw new Error;return function(){var a=el(this,e),o=a.tween;if(o!==i){s=(i=o).slice();for(var l={name:n,value:r},u=0,d=s.length;u<d;++u)if(s[u].name===n){s[u]=l;break}u===d&&s.push(l)}a.tween=s}}function ope(e,n){var r=this._id;if(e+="",arguments.length<2){for(var i=no(this.node(),r).tween,s=0,a=i.length,o;s<a;++s)if((o=i[s]).name===e)return o.value;return null}return this.each((n==null?spe:ape)(r,e,n))}function hA(e,n,r){var i=e._id;return e.each(function(){var s=el(this,i);(s.value||(s.value={}))[n]=r.apply(this,arguments)}),function(s){return no(s,i).value[n]}}function a7(e,n){var r;return(typeof n=="number"?Mo:n instanceof Sd?nb:(r=Sd(n))?(n=r,nb):e7)(e,n)}function lpe(e){return function(){this.removeAttribute(e)}}function cpe(e){return function(){this.removeAttributeNS(e.space,e.local)}}function upe(e,n,r){var i,s=r+"",a;return function(){var o=this.getAttribute(e);return o===s?null:o===i?a:a=n(i=o,r)}}function dpe(e,n,r){var i,s=r+"",a;return function(){var o=this.getAttributeNS(e.space,e.local);return o===s?null:o===i?a:a=n(i=o,r)}}function hpe(e,n,r){var i,s,a;return function(){var o,l=r(this),u;return l==null?void this.removeAttribute(e):(o=this.getAttribute(e),u=l+"",o===u?null:o===i&&u===s?a:(s=u,a=n(i=o,l)))}}function fpe(e,n,r){var i,s,a;return function(){var o,l=r(this),u;return l==null?void this.removeAttributeNS(e.space,e.local):(o=this.getAttributeNS(e.space,e.local),u=l+"",o===u?null:o===i&&u===s?a:(s=u,a=n(i=o,l)))}}function ppe(e,n){var r=x0(e),i=r==="transform"?Kfe:a7;return this.attrTween(e,typeof n=="function"?(r.local?fpe:hpe)(r,i,hA(this,"attr."+e,n)):n==null?(r.local?cpe:lpe)(r):(r.local?dpe:upe)(r,i,n))}function mpe(e,n){return function(r){this.setAttribute(e,n.call(this,r))}}function gpe(e,n){return function(r){this.setAttributeNS(e.space,e.local,n.call(this,r))}}function vpe(e,n){var r,i;function s(){var a=n.apply(this,arguments);return a!==i&&(r=(i=a)&&gpe(e,a)),r}return s._value=n,s}function ype(e,n){var r,i;function s(){var a=n.apply(this,arguments);return a!==i&&(r=(i=a)&&mpe(e,a)),r}return s._value=n,s}function _pe(e,n){var r="attr."+e;if(arguments.length<2)return(r=this.tween(r))&&r._value;if(n==null)return this.tween(r,null);if(typeof n!="function")throw new Error;var i=x0(e);return this.tween(r,(i.local?vpe:ype)(i,n))}function xpe(e,n){return function(){dA(this,e).delay=+n.apply(this,arguments)}}function bpe(e,n){return n=+n,function(){dA(this,e).delay=n}}function kpe(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?xpe:bpe)(n,e)):no(this.node(),n).delay}function wpe(e,n){return function(){el(this,e).duration=+n.apply(this,arguments)}}function Spe(e,n){return n=+n,function(){el(this,e).duration=n}}function Cpe(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?wpe:Spe)(n,e)):no(this.node(),n).duration}function jpe(e,n){if(typeof n!="function")throw new Error;return function(){el(this,e).ease=n}}function Npe(e){var n=this._id;return arguments.length?this.each(jpe(n,e)):no(this.node(),n).ease}function Epe(e,n){return function(){var r=n.apply(this,arguments);if(typeof r!="function")throw new Error;el(this,e).ease=r}}function Ape(e){if(typeof e!="function")throw new Error;return this.each(Epe(this._id,e))}function Tpe(e){typeof e!="function"&&(e=z$(e));for(var n=this._groups,r=n.length,i=new Array(r),s=0;s<r;++s)for(var a=n[s],o=a.length,l=i[s]=[],u,d=0;d<o;++d)(u=a[d])&&e.call(u,u.__data__,d,a)&&l.push(u);return new Vl(i,this._parents,this._name,this._id)}function Mpe(e){if(e._id!==this._id)throw new Error;for(var n=this._groups,r=e._groups,i=n.length,s=r.length,a=Math.min(i,s),o=new Array(i),l=0;l<a;++l)for(var u=n[l],d=r[l],p=u.length,f=o[l]=new Array(p),g,_=0;_<p;++_)(g=u[_]||d[_])&&(f[_]=g);for(;l<i;++l)o[l]=n[l];return new Vl(o,this._parents,this._name,this._id)}function Rpe(e){return(e+"").trim().split(/^|\s+/).every(function(n){var r=n.indexOf(".");return r>=0&&(n=n.slice(0,r)),!n||n==="start"})}function Ope(e,n,r){var i,s,a=Rpe(n)?dA:el;return function(){var o=a(this,e),l=o.on;l!==i&&(s=(i=l).copy()).on(n,r),o.on=s}}function Dpe(e,n){var r=this._id;return arguments.length<2?no(this.node(),r).on.on(e):this.each(Ope(r,e,n))}function Ppe(e){return function(){var n=this.parentNode;for(var r in this.__transition)if(+r!==e)return;n&&n.removeChild(this)}}function Lpe(){return this.on("end.remove",Ppe(this._id))}function Ipe(e){var n=this._name,r=this._id;typeof e!="function"&&(e=iA(e));for(var i=this._groups,s=i.length,a=new Array(s),o=0;o<s;++o)for(var l=i[o],u=l.length,d=a[o]=new Array(u),p,f,g=0;g<u;++g)(p=l[g])&&(f=e.call(p,p.__data__,g,l))&&("__data__"in p&&(f.__data__=p.__data__),d[g]=f,k0(d[g],n,r,g,d,no(p,r)));return new Vl(a,this._parents,n,r)}function Bpe(e){var n=this._name,r=this._id;typeof e!="function"&&(e=B$(e));for(var i=this._groups,s=i.length,a=[],o=[],l=0;l<s;++l)for(var u=i[l],d=u.length,p,f=0;f<d;++f)if(p=u[f]){for(var g=e.call(p,p.__data__,f,u),_,x=no(p,r),v=0,S=g.length;v<S;++v)(_=g[v])&&k0(_,n,r,v,g,x);a.push(g),o.push(p)}return new Vl(a,o,n,r)}var zpe=_v.prototype.constructor;function $pe(){return new zpe(this._groups,this._parents)}function Fpe(e,n){var r,i,s;return function(){var a=Cf(this,e),o=(this.style.removeProperty(e),Cf(this,e));return a===o?null:a===r&&o===i?s:s=n(r=a,i=o)}}function o7(e){return function(){this.style.removeProperty(e)}}function Hpe(e,n,r){var i,s=r+"",a;return function(){var o=Cf(this,e);return o===s?null:o===i?a:a=n(i=o,r)}}function Wpe(e,n,r){var i,s,a;return function(){var o=Cf(this,e),l=r(this),u=l+"";return l==null&&(u=l=(this.style.removeProperty(e),Cf(this,e))),o===u?null:o===i&&u===s?a:(s=u,a=n(i=o,l))}}function qpe(e,n){var r,i,s,a="style."+n,o="end."+a,l;return function(){var u=el(this,e),d=u.on,p=u.value[a]==null?l||(l=o7(n)):void 0;(d!==r||s!==p)&&(i=(r=d).copy()).on(o,s=p),u.on=i}}function Upe(e,n,r){var i=(e+="")=="transform"?Vfe:a7;return n==null?this.styleTween(e,Fpe(e,i)).on("end.style."+e,o7(e)):typeof n=="function"?this.styleTween(e,Wpe(e,i,hA(this,"style."+e,n))).each(qpe(this._id,e)):this.styleTween(e,Hpe(e,i,n),r).on("end.style."+e,null)}function Vpe(e,n,r){return function(i){this.style.setProperty(e,n.call(this,i),r)}}function Kpe(e,n,r){var i,s;function a(){var o=n.apply(this,arguments);return o!==s&&(i=(s=o)&&Vpe(e,o,r)),i}return a._value=n,a}function Ype(e,n,r){var i="style."+(e+="");if(arguments.length<2)return(i=this.tween(i))&&i._value;if(n==null)return this.tween(i,null);if(typeof n!="function")throw new Error;return this.tween(i,Kpe(e,n,r??""))}function Gpe(e){return function(){this.textContent=e}}function Xpe(e){return function(){var n=e(this);this.textContent=n??""}}function Qpe(e){return this.tween("text",typeof e=="function"?Xpe(hA(this,"text",e)):Gpe(e==null?"":e+""))}function Zpe(e){return function(n){this.textContent=e.call(this,n)}}function Jpe(e){var n,r;function i(){var s=e.apply(this,arguments);return s!==r&&(n=(r=s)&&Zpe(s)),n}return i._value=e,i}function eme(e){var n="text";if(arguments.length<1)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!="function")throw new Error;return this.tween(n,Jpe(e))}function tme(){for(var e=this._name,n=this._id,r=l7(),i=this._groups,s=i.length,a=0;a<s;++a)for(var o=i[a],l=o.length,u,d=0;d<l;++d)if(u=o[d]){var p=no(u,n);k0(u,e,r,d,o,{time:p.time+p.delay+p.duration,delay:0,duration:p.duration,ease:p.ease})}return new Vl(i,this._parents,e,r)}function nme(){var e,n,r=this,i=r._id,s=r.size();return new Promise(function(a,o){var l={value:o},u={value:function(){--s===0&&a()}};r.each(function(){var d=el(this,i),p=d.on;p!==e&&(n=(e=p).copy(),n._.cancel.push(l),n._.interrupt.push(l),n._.end.push(u)),d.on=n}),s===0&&a()})}var rme=0;function Vl(e,n,r,i){this._groups=e,this._parents=n,this._name=r,this._id=i}function l7(){return++rme}var wl=_v.prototype;Vl.prototype={constructor:Vl,select:Ipe,selectAll:Bpe,selectChild:wl.selectChild,selectChildren:wl.selectChildren,filter:Tpe,merge:Mpe,selection:$pe,transition:tme,call:wl.call,nodes:wl.nodes,node:wl.node,size:wl.size,empty:wl.empty,each:wl.each,on:Dpe,attr:ppe,attrTween:_pe,style:Upe,styleTween:Ype,text:Qpe,textTween:eme,remove:Lpe,tween:ope,delay:kpe,duration:Cpe,ease:Npe,easeVarying:Ape,end:nme,[Symbol.iterator]:wl[Symbol.iterator]};function ime(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var sme={time:null,delay:0,duration:250,ease:ime};function ame(e,n){for(var r;!(r=e.__transition)||!(r=r[n]);)if(!(e=e.parentNode))throw new Error(`transition ${n} not found`);return r}function ome(e){var n,r;e instanceof Vl?(n=e._id,e=e._name):(n=l7(),(r=sme).time=cA(),e=e==null?null:e+"");for(var i=this._groups,s=i.length,a=0;a<s;++a)for(var o=i[a],l=o.length,u,d=0;d<l;++d)(u=o[d])&&k0(u,e,n,d,o,r||ame(u,n));return new Vl(i,this._parents,e,n)}_v.prototype.interrupt=ipe;_v.prototype.transition=ome;const i_=e=>()=>e;function lme(e,{sourceEvent:n,target:r,transform:i,dispatch:s}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},transform:{value:i,enumerable:!0,configurable:!0},_:{value:s}})}function Il(e,n,r){this.k=e,this.x=n,this.y=r}Il.prototype={constructor:Il,scale:function(e){return e===1?this:new Il(this.k*e,this.x,this.y)},translate:function(e,n){return e===0&n===0?this:new Il(this.k,this.x+this.k*e,this.y+this.k*n)},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 w0=new Il(1,0,0);Ba.prototype=Il.prototype;function Ba(e){for(;!e.__zoom;)if(!(e=e.parentNode))return w0;return e.__zoom}function rS(e){e.stopImmediatePropagation()}function rm(e){e.preventDefault(),e.stopImmediatePropagation()}function cme(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function ume(){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 pD(){return this.__zoom||w0}function dme(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function hme(){return navigator.maxTouchPoints||"ontouchstart"in this}function fme(e,n,r){var i=e.invertX(n[0][0])-r[0][0],s=e.invertX(n[1][0])-r[1][0],a=e.invertY(n[0][1])-r[0][1],o=e.invertY(n[1][1])-r[1][1];return e.translate(s>i?(i+s)/2:Math.min(0,i)||Math.max(0,s),o>a?(a+o)/2:Math.min(0,a)||Math.max(0,o))}function fA(){var e=cme,n=ume,r=fme,i=dme,s=hme,a=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],l=250,u=dx,d=yv("start","zoom","end"),p,f,g,_=500,x=150,v=0,S=10;function w(P){P.property("__zoom",pD).on("wheel.zoom",F,{passive:!1}).on("mousedown.zoom",B).on("dblclick.zoom",H).filter(s).on("touchstart.zoom",$).on("touchmove.zoom",z).on("touchend.zoom touchcancel.zoom",W).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}w.transform=function(P,q,I,Q){var K=P.selection?P.selection():P;K.property("__zoom",pD),P!==K?A(P,q,I,Q):K.interrupt().each(function(){E(this,arguments).event(Q).start().zoom(null,typeof q=="function"?q.apply(this,arguments):q).end()})},w.scaleBy=function(P,q,I,Q){w.scaleTo(P,function(){var K=this.__zoom.k,Z=typeof q=="function"?q.apply(this,arguments):q;return K*Z},I,Q)},w.scaleTo=function(P,q,I,Q){w.transform(P,function(){var K=n.apply(this,arguments),Z=this.__zoom,Y=I==null?T(K):typeof I=="function"?I.apply(this,arguments):I,R=Z.invert(Y),U=typeof q=="function"?q.apply(this,arguments):q;return r(C(N(Z,U),Y,R),K,o)},I,Q)},w.translateBy=function(P,q,I,Q){w.transform(P,function(){return r(this.__zoom.translate(typeof q=="function"?q.apply(this,arguments):q,typeof I=="function"?I.apply(this,arguments):I),n.apply(this,arguments),o)},null,Q)},w.translateTo=function(P,q,I,Q,K){w.transform(P,function(){var Z=n.apply(this,arguments),Y=this.__zoom,R=Q==null?T(Z):typeof Q=="function"?Q.apply(this,arguments):Q;return r(w0.translate(R[0],R[1]).scale(Y.k).translate(typeof q=="function"?-q.apply(this,arguments):-q,typeof I=="function"?-I.apply(this,arguments):-I),Z,o)},Q,K)};function N(P,q){return q=Math.max(a[0],Math.min(a[1],q)),q===P.k?P:new Il(q,P.x,P.y)}function C(P,q,I){var Q=q[0]-I[0]*P.k,K=q[1]-I[1]*P.k;return Q===P.x&&K===P.y?P:new Il(P.k,Q,K)}function T(P){return[(+P[0][0]+ +P[1][0])/2,(+P[0][1]+ +P[1][1])/2]}function A(P,q,I,Q){P.on("start.zoom",function(){E(this,arguments).event(Q).start()}).on("interrupt.zoom end.zoom",function(){E(this,arguments).event(Q).end()}).tween("zoom",function(){var K=this,Z=arguments,Y=E(K,Z).event(Q),R=n.apply(K,Z),U=I==null?T(R):typeof I=="function"?I.apply(K,Z):I,V=Math.max(R[1][0]-R[0][0],R[1][1]-R[0][1]),ie=K.__zoom,te=typeof q=="function"?q.apply(K,Z):q,X=u(ie.invert(U).concat(V/ie.k),te.invert(U).concat(V/te.k));return function(se){if(se===1)se=te;else{var re=X(se),de=V/re[2];se=new Il(de,U[0]-re[0]*de,U[1]-re[1]*de)}Y.zoom(null,se)}})}function E(P,q,I){return!I&&P.__zooming||new D(P,q)}function D(P,q){this.that=P,this.args=q,this.active=0,this.sourceEvent=null,this.extent=n.apply(P,q),this.taps=0}D.prototype={event:function(P){return P&&(this.sourceEvent=P),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(P,q){return this.mouse&&P!=="mouse"&&(this.mouse[1]=q.invert(this.mouse[0])),this.touch0&&P!=="touch"&&(this.touch0[1]=q.invert(this.touch0[0])),this.touch1&&P!=="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(P){var q=Fi(this.that).datum();d.call(P,this.that,new lme(P,{sourceEvent:this.sourceEvent,target:w,transform:this.that.__zoom,dispatch:d}),q)}};function F(P,...q){if(!e.apply(this,arguments))return;var I=E(this,q).event(P),Q=this.__zoom,K=Math.max(a[0],Math.min(a[1],Q.k*Math.pow(2,i.apply(this,arguments)))),Z=_a(P);if(I.wheel)(I.mouse[0][0]!==Z[0]||I.mouse[0][1]!==Z[1])&&(I.mouse[1]=Q.invert(I.mouse[0]=Z)),clearTimeout(I.wheel);else{if(Q.k===K)return;I.mouse=[Z,Q.invert(Z)],px(this),I.start()}rm(P),I.wheel=setTimeout(Y,x),I.zoom("mouse",r(C(N(Q,K),I.mouse[0],I.mouse[1]),I.extent,o));function Y(){I.wheel=null,I.end()}}function B(P,...q){if(g||!e.apply(this,arguments))return;var I=P.currentTarget,Q=E(this,q,!0).event(P),K=Fi(P.view).on("mousemove.zoom",U,!0).on("mouseup.zoom",V,!0),Z=_a(P,I),Y=P.clientX,R=P.clientY;G$(P.view),rS(P),Q.mouse=[Z,this.__zoom.invert(Z)],px(this),Q.start();function U(ie){if(rm(ie),!Q.moved){var te=ie.clientX-Y,X=ie.clientY-R;Q.moved=te*te+X*X>v}Q.event(ie).zoom("mouse",r(C(Q.that.__zoom,Q.mouse[0]=_a(ie,I),Q.mouse[1]),Q.extent,o))}function V(ie){K.on("mousemove.zoom mouseup.zoom",null),X$(ie.view,Q.moved),rm(ie),Q.event(ie).end()}}function H(P,...q){if(e.apply(this,arguments)){var I=this.__zoom,Q=_a(P.changedTouches?P.changedTouches[0]:P,this),K=I.invert(Q),Z=I.k*(P.shiftKey?.5:2),Y=r(C(N(I,Z),Q,K),n.apply(this,q),o);rm(P),l>0?Fi(this).transition().duration(l).call(A,Y,Q,P):Fi(this).call(w.transform,Y,Q,P)}}function $(P,...q){if(e.apply(this,arguments)){var I=P.touches,Q=I.length,K=E(this,q,P.changedTouches.length===Q).event(P),Z,Y,R,U;for(rS(P),Y=0;Y<Q;++Y)R=I[Y],U=_a(R,this),U=[U,this.__zoom.invert(U),R.identifier],K.touch0?!K.touch1&&K.touch0[2]!==U[2]&&(K.touch1=U,K.taps=0):(K.touch0=U,Z=!0,K.taps=1+!!p);p&&(p=clearTimeout(p)),Z&&(K.taps<2&&(f=U[0],p=setTimeout(function(){p=null},_)),px(this),K.start())}}function z(P,...q){if(this.__zooming){var I=E(this,q).event(P),Q=P.changedTouches,K=Q.length,Z,Y,R,U;for(rm(P),Z=0;Z<K;++Z)Y=Q[Z],R=_a(Y,this),I.touch0&&I.touch0[2]===Y.identifier?I.touch0[0]=R:I.touch1&&I.touch1[2]===Y.identifier&&(I.touch1[0]=R);if(Y=I.that.__zoom,I.touch1){var V=I.touch0[0],ie=I.touch0[1],te=I.touch1[0],X=I.touch1[1],se=(se=te[0]-V[0])*se+(se=te[1]-V[1])*se,re=(re=X[0]-ie[0])*re+(re=X[1]-ie[1])*re;Y=N(Y,Math.sqrt(se/re)),R=[(V[0]+te[0])/2,(V[1]+te[1])/2],U=[(ie[0]+X[0])/2,(ie[1]+X[1])/2]}else if(I.touch0)R=I.touch0[0],U=I.touch0[1];else return;I.zoom("touch",r(C(Y,R,U),I.extent,o))}}function W(P,...q){if(this.__zooming){var I=E(this,q).event(P),Q=P.changedTouches,K=Q.length,Z,Y;for(rS(P),g&&clearTimeout(g),g=setTimeout(function(){g=null},_),Z=0;Z<K;++Z)Y=Q[Z],I.touch0&&I.touch0[2]===Y.identifier?delete I.touch0:I.touch1&&I.touch1[2]===Y.identifier&&delete I.touch1;if(I.touch1&&!I.touch0&&(I.touch0=I.touch1,delete I.touch1),I.touch0)I.touch0[1]=this.__zoom.invert(I.touch0[0]);else if(I.end(),I.taps===2&&(Y=_a(Y,this),Math.hypot(f[0]-Y[0],f[1]-Y[1])<S)){var R=Fi(this).on("dblclick.zoom");R&&R.apply(this,arguments)}}}return w.wheelDelta=function(P){return arguments.length?(i=typeof P=="function"?P:i_(+P),w):i},w.filter=function(P){return arguments.length?(e=typeof P=="function"?P:i_(!!P),w):e},w.touchable=function(P){return arguments.length?(s=typeof P=="function"?P:i_(!!P),w):s},w.extent=function(P){return arguments.length?(n=typeof P=="function"?P:i_([[+P[0][0],+P[0][1]],[+P[1][0],+P[1][1]]]),w):n},w.scaleExtent=function(P){return arguments.length?(a[0]=+P[0],a[1]=+P[1],w):[a[0],a[1]]},w.translateExtent=function(P){return arguments.length?(o[0][0]=+P[0][0],o[1][0]=+P[1][0],o[0][1]=+P[0][1],o[1][1]=+P[1][1],w):[[o[0][0],o[0][1]],[o[1][0],o[1][1]]]},w.constrain=function(P){return arguments.length?(r=P,w):r},w.duration=function(P){return arguments.length?(l=+P,w):l},w.interpolate=function(P){return arguments.length?(u=P,w):u},w.on=function(){var P=d.on.apply(d,arguments);return P===d?w:P},w.clickDistance=function(P){return arguments.length?(v=(P=+P)*P,w):Math.sqrt(v)},w.tapDistance=function(P){return arguments.length?(S=+P,w):S},w}const Go={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.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 React Flow 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:n,sourceHandle:r,targetHandle:i})=>`Couldn't create edge for ${e} handle id: "${e==="source"?r:i}", edge id: ${n}.`,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."},Sg=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],c7=["Enter"," ","Escape"],u7={"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:n,y:r})=>`Moved selected node ${e}. New position, x: ${n}, y: ${r}`,"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 Nf;(function(e){e.Strict="strict",e.Loose="loose"})(Nf||(Nf={}));var md;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(md||(md={}));var Cg;(function(e){e.Partial="partial",e.Full="full"})(Cg||(Cg={}));const d7={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Ha;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Ha||(Ha={}));var za;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(za||(za={}));var Ot;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Ot||(Ot={}));const mD={[Ot.Left]:Ot.Right,[Ot.Right]:Ot.Left,[Ot.Top]:Ot.Bottom,[Ot.Bottom]:Ot.Top};function h7(e){return e===null?null:e?"valid":"invalid"}const f7=e=>"id"in e&&"source"in e&&"target"in e,pme=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),pA=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),bv=(e,n=[0,0])=>{const{width:r,height:i}=ec(e),s=e.origin??n,a=r*s[0],o=i*s[1];return{x:e.position.x-a,y:e.position.y-o}},mme=(e,n={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const r=e.reduce((i,s)=>{const a=typeof s=="string";let o=!n.nodeLookup&&!a?s:void 0;n.nodeLookup&&(o=a?n.nodeLookup.get(s):pA(s)?s:n.nodeLookup.get(s.id));const l=o?ab(o,n.nodeOrigin):{x:0,y:0,x2:0,y2:0};return S0(i,l)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return C0(r)},kv=(e,n={})=>{let r={x:1/0,y:1/0,x2:-1/0,y2:-1/0},i=!1;return e.forEach(s=>{(n.filter===void 0||n.filter(s))&&(r=S0(r,ab(s)),i=!0)}),i?C0(r):{x:0,y:0,width:0,height:0}},mA=(e,n,[r,i,s]=[0,0,1],a=!1,o=!1)=>{const l={...Sv(n,[r,i,s]),width:n.width/s,height:n.height/s},u=[];for(const d of e.values()){const{measured:p,selectable:f=!0,hidden:g=!1}=d;if(o&&!f||g)continue;const _=p.width??d.width??d.initialWidth??null,x=p.height??d.height??d.initialHeight??null,v=jg(l,Af(d)),S=(_??0)*(x??0),w=a&&v>0;(!d.internals.handleBounds||w||v>=S||d.dragging)&&u.push(d)}return u},gme=(e,n)=>{const r=new Set;return e.forEach(i=>{r.add(i.id)}),n.filter(i=>r.has(i.source)||r.has(i.target))};function vme(e,n){const r=new Map,i=n!=null&&n.nodes?new Set(n.nodes.map(s=>s.id)):null;return e.forEach(s=>{s.measured.width&&s.measured.height&&((n==null?void 0:n.includeHiddenNodes)||!s.hidden)&&(!i||i.has(s.id))&&r.set(s.id,s)}),r}async function yme({nodes:e,width:n,height:r,panZoom:i,minZoom:s,maxZoom:a},o){if(e.size===0)return Promise.resolve(!0);const l=vme(e,o),u=kv(l),d=gA(u,n,r,(o==null?void 0:o.minZoom)??s,(o==null?void 0:o.maxZoom)??a,(o==null?void 0:o.padding)??.1);return await i.setViewport(d,{duration:o==null?void 0:o.duration,ease:o==null?void 0:o.ease,interpolate:o==null?void 0:o.interpolate}),Promise.resolve(!0)}function p7({nodeId:e,nextPosition:n,nodeLookup:r,nodeOrigin:i=[0,0],nodeExtent:s,onError:a}){const o=r.get(e),l=o.parentId?r.get(o.parentId):void 0,{x:u,y:d}=l?l.internals.positionAbsolute:{x:0,y:0},p=o.origin??i;let f=o.extent||s;if(o.extent==="parent"&&!o.expandParent)if(!l)a==null||a("005",Go.error005());else{const _=l.measured.width,x=l.measured.height;_&&x&&(f=[[u,d],[u+_,d+x]])}else l&&Tf(o.extent)&&(f=[[o.extent[0][0]+u,o.extent[0][1]+d],[o.extent[1][0]+u,o.extent[1][1]+d]]);const g=Tf(f)?jd(n,f,o.measured):n;return(o.measured.width===void 0||o.measured.height===void 0)&&(a==null||a("015",Go.error015())),{position:{x:g.x-u+(o.measured.width??0)*p[0],y:g.y-d+(o.measured.height??0)*p[1]},positionAbsolute:g}}async function _me({nodesToRemove:e=[],edgesToRemove:n=[],nodes:r,edges:i,onBeforeDelete:s}){const a=new Set(e.map(g=>g.id)),o=[];for(const g of r){if(g.deletable===!1)continue;const _=a.has(g.id),x=!_&&g.parentId&&o.find(v=>v.id===g.parentId);(_||x)&&o.push(g)}const l=new Set(n.map(g=>g.id)),u=i.filter(g=>g.deletable!==!1),p=gme(o,u);for(const g of u)l.has(g.id)&&!p.find(x=>x.id===g.id)&&p.push(g);if(!s)return{edges:p,nodes:o};const f=await s({nodes:o,edges:p});return typeof f=="boolean"?f?{edges:p,nodes:o}:{edges:[],nodes:[]}:f}const Ef=(e,n=0,r=1)=>Math.min(Math.max(e,n),r),jd=(e={x:0,y:0},n,r)=>({x:Ef(e.x,n[0][0],n[1][0]-((r==null?void 0:r.width)??0)),y:Ef(e.y,n[0][1],n[1][1]-((r==null?void 0:r.height)??0))});function m7(e,n,r){const{width:i,height:s}=ec(r),{x:a,y:o}=r.internals.positionAbsolute;return jd(e,[[a,o],[a+i,o+s]],n)}const gD=(e,n,r)=>e<n?Ef(Math.abs(e-n),1,n)/n:e>r?-Ef(Math.abs(e-r),1,n)/n:0,g7=(e,n,r=15,i=40)=>{const s=gD(e.x,i,n.width-i)*r,a=gD(e.y,i,n.height-i)*r;return[s,a]},S0=(e,n)=>({x:Math.min(e.x,n.x),y:Math.min(e.y,n.y),x2:Math.max(e.x2,n.x2),y2:Math.max(e.y2,n.y2)}),mj=({x:e,y:n,width:r,height:i})=>({x:e,y:n,x2:e+r,y2:n+i}),C0=({x:e,y:n,x2:r,y2:i})=>({x:e,y:n,width:r-e,height:i-n}),Af=(e,n=[0,0])=>{var s,a;const{x:r,y:i}=pA(e)?e.internals.positionAbsolute:bv(e,n);return{x:r,y:i,width:((s=e.measured)==null?void 0:s.width)??e.width??e.initialWidth??0,height:((a=e.measured)==null?void 0:a.height)??e.height??e.initialHeight??0}},ab=(e,n=[0,0])=>{var s,a;const{x:r,y:i}=pA(e)?e.internals.positionAbsolute:bv(e,n);return{x:r,y:i,x2:r+(((s=e.measured)==null?void 0:s.width)??e.width??e.initialWidth??0),y2:i+(((a=e.measured)==null?void 0:a.height)??e.height??e.initialHeight??0)}},v7=(e,n)=>C0(S0(mj(e),mj(n))),jg=(e,n)=>{const r=Math.max(0,Math.min(e.x+e.width,n.x+n.width)-Math.max(e.x,n.x)),i=Math.max(0,Math.min(e.y+e.height,n.y+n.height)-Math.max(e.y,n.y));return Math.ceil(r*i)},vD=e=>Ua(e.width)&&Ua(e.height)&&Ua(e.x)&&Ua(e.y),Ua=e=>!isNaN(e)&&isFinite(e),xme=(e,n)=>{},wv=(e,n=[1,1])=>({x:n[0]*Math.round(e.x/n[0]),y:n[1]*Math.round(e.y/n[1])}),Sv=({x:e,y:n},[r,i,s],a=!1,o=[1,1])=>{const l={x:(e-r)/s,y:(n-i)/s};return a?wv(l,o):l},ob=({x:e,y:n},[r,i,s])=>({x:e*s+r,y:n*s+i});function kh(e,n){if(typeof e=="number")return Math.floor((n-n/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const r=parseFloat(e);if(!Number.isNaN(r))return Math.floor(r)}if(typeof e=="string"&&e.endsWith("%")){const r=parseFloat(e);if(!Number.isNaN(r))return Math.floor(n*r*.01)}return console.error(`[React Flow] The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function bme(e,n,r){if(typeof e=="string"||typeof e=="number"){const i=kh(e,r),s=kh(e,n);return{top:i,right:s,bottom:i,left:s,x:s*2,y:i*2}}if(typeof e=="object"){const i=kh(e.top??e.y??0,r),s=kh(e.bottom??e.y??0,r),a=kh(e.left??e.x??0,n),o=kh(e.right??e.x??0,n);return{top:i,right:o,bottom:s,left:a,x:a+o,y:i+s}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function kme(e,n,r,i,s,a){const{x:o,y:l}=ob(e,[n,r,i]),{x:u,y:d}=ob({x:e.x+e.width,y:e.y+e.height},[n,r,i]),p=s-u,f=a-d;return{left:Math.floor(o),top:Math.floor(l),right:Math.floor(p),bottom:Math.floor(f)}}const gA=(e,n,r,i,s,a)=>{const o=bme(a,n,r),l=(n-o.x)/e.width,u=(r-o.y)/e.height,d=Math.min(l,u),p=Ef(d,i,s),f=e.x+e.width/2,g=e.y+e.height/2,_=n/2-f*p,x=r/2-g*p,v=kme(e,_,x,p,n,r),S={left:Math.min(v.left-o.left,0),top:Math.min(v.top-o.top,0),right:Math.min(v.right-o.right,0),bottom:Math.min(v.bottom-o.bottom,0)};return{x:_-S.left+S.right,y:x-S.top+S.bottom,zoom:p}},Ng=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function Tf(e){return e!=null&&e!=="parent"}function ec(e){var n,r;return{width:((n=e.measured)==null?void 0:n.width)??e.width??e.initialWidth??0,height:((r=e.measured)==null?void 0:r.height)??e.height??e.initialHeight??0}}function y7(e){var n,r;return(((n=e.measured)==null?void 0:n.width)??e.width??e.initialWidth)!==void 0&&(((r=e.measured)==null?void 0:r.height)??e.height??e.initialHeight)!==void 0}function _7(e,n={width:0,height:0},r,i,s){const a={...e},o=i.get(r);if(o){const l=o.origin||s;a.x+=o.internals.positionAbsolute.x-(n.width??0)*l[0],a.y+=o.internals.positionAbsolute.y-(n.height??0)*l[1]}return a}function yD(e,n){if(e.size!==n.size)return!1;for(const r of e)if(!n.has(r))return!1;return!0}function wme(){let e,n;return{promise:new Promise((i,s)=>{e=i,n=s}),resolve:e,reject:n}}function Sme(e){return{...u7,...e||{}}}function Xm(e,{snapGrid:n=[0,0],snapToGrid:r=!1,transform:i,containerBounds:s}){const{x:a,y:o}=Va(e),l=Sv({x:a-((s==null?void 0:s.left)??0),y:o-((s==null?void 0:s.top)??0)},i),{x:u,y:d}=r?wv(l,n):l;return{xSnapped:u,ySnapped:d,...l}}const vA=e=>({width:e.offsetWidth,height:e.offsetHeight}),x7=e=>{var n;return((n=e==null?void 0:e.getRootNode)==null?void 0:n.call(e))||(window==null?void 0:window.document)},Cme=["INPUT","SELECT","TEXTAREA"];function b7(e){var i,s;const n=((s=(i=e.composedPath)==null?void 0:i.call(e))==null?void 0:s[0])||e.target;return(n==null?void 0:n.nodeType)!==1?!1:Cme.includes(n.nodeName)||n.hasAttribute("contenteditable")||!!n.closest(".nokey")}const k7=e=>"clientX"in e,Va=(e,n)=>{var a,o;const r=k7(e),i=r?e.clientX:(a=e.touches)==null?void 0:a[0].clientX,s=r?e.clientY:(o=e.touches)==null?void 0:o[0].clientY;return{x:i-((n==null?void 0:n.left)??0),y:s-((n==null?void 0:n.top)??0)}},_D=(e,n,r,i,s)=>{const a=n.querySelectorAll(`.${e}`);return!a||!a.length?null:Array.from(a).map(o=>{const l=o.getBoundingClientRect();return{id:o.getAttribute("data-handleid"),type:e,nodeId:s,position:o.getAttribute("data-handlepos"),x:(l.left-r.left)/i,y:(l.top-r.top)/i,...vA(o)}})};function w7({sourceX:e,sourceY:n,targetX:r,targetY:i,sourceControlX:s,sourceControlY:a,targetControlX:o,targetControlY:l}){const u=e*.125+s*.375+o*.375+r*.125,d=n*.125+a*.375+l*.375+i*.125,p=Math.abs(u-e),f=Math.abs(d-n);return[u,d,p,f]}function s_(e,n){return e>=0?.5*e:n*25*Math.sqrt(-e)}function xD({pos:e,x1:n,y1:r,x2:i,y2:s,c:a}){switch(e){case Ot.Left:return[n-s_(n-i,a),r];case Ot.Right:return[n+s_(i-n,a),r];case Ot.Top:return[n,r-s_(r-s,a)];case Ot.Bottom:return[n,r+s_(s-r,a)]}}function yA({sourceX:e,sourceY:n,sourcePosition:r=Ot.Bottom,targetX:i,targetY:s,targetPosition:a=Ot.Top,curvature:o=.25}){const[l,u]=xD({pos:r,x1:e,y1:n,x2:i,y2:s,c:o}),[d,p]=xD({pos:a,x1:i,y1:s,x2:e,y2:n,c:o}),[f,g,_,x]=w7({sourceX:e,sourceY:n,targetX:i,targetY:s,sourceControlX:l,sourceControlY:u,targetControlX:d,targetControlY:p});return[`M${e},${n} C${l},${u} ${d},${p} ${i},${s}`,f,g,_,x]}function S7({sourceX:e,sourceY:n,targetX:r,targetY:i}){const s=Math.abs(r-e)/2,a=r<e?r+s:r-s,o=Math.abs(i-n)/2,l=i<n?i+o:i-o;return[a,l,s,o]}function jme({sourceNode:e,targetNode:n,selected:r=!1,zIndex:i=0,elevateOnSelect:s=!1,zIndexMode:a="basic"}){if(a==="manual")return i;const o=s&&r?i+1e3:i,l=Math.max(e.parentId||s&&e.selected?e.internals.z:0,n.parentId||s&&n.selected?n.internals.z:0);return o+l}function Nme({sourceNode:e,targetNode:n,width:r,height:i,transform:s}){const a=S0(ab(e),ab(n));a.x===a.x2&&(a.x2+=1),a.y===a.y2&&(a.y2+=1);const o={x:-s[0]/s[2],y:-s[1]/s[2],width:r/s[2],height:i/s[2]};return jg(o,C0(a))>0}const Eme=({source:e,sourceHandle:n,target:r,targetHandle:i})=>`xy-edge__${e}${n||""}-${r}${i||""}`,Ame=(e,n)=>n.some(r=>r.source===e.source&&r.target===e.target&&(r.sourceHandle===e.sourceHandle||!r.sourceHandle&&!e.sourceHandle)&&(r.targetHandle===e.targetHandle||!r.targetHandle&&!e.targetHandle)),Tme=(e,n,r={})=>{if(!e.source||!e.target)return n;const i=r.getEdgeId||Eme;let s;return f7(e)?s={...e}:s={...e,id:i(e)},Ame(s,n)?n:(s.sourceHandle===null&&delete s.sourceHandle,s.targetHandle===null&&delete s.targetHandle,n.concat(s))};function C7({sourceX:e,sourceY:n,targetX:r,targetY:i}){const[s,a,o,l]=S7({sourceX:e,sourceY:n,targetX:r,targetY:i});return[`M ${e},${n}L ${r},${i}`,s,a,o,l]}const bD={[Ot.Left]:{x:-1,y:0},[Ot.Right]:{x:1,y:0},[Ot.Top]:{x:0,y:-1},[Ot.Bottom]:{x:0,y:1}},Mme=({source:e,sourcePosition:n=Ot.Bottom,target:r})=>n===Ot.Left||n===Ot.Right?e.x<r.x?{x:1,y:0}:{x:-1,y:0}:e.y<r.y?{x:0,y:1}:{x:0,y:-1},kD=(e,n)=>Math.sqrt(Math.pow(n.x-e.x,2)+Math.pow(n.y-e.y,2));function Rme({source:e,sourcePosition:n=Ot.Bottom,target:r,targetPosition:i=Ot.Top,center:s,offset:a,stepPosition:o}){const l=bD[n],u=bD[i],d={x:e.x+l.x*a,y:e.y+l.y*a},p={x:r.x+u.x*a,y:r.y+u.y*a},f=Mme({source:d,sourcePosition:n,target:p}),g=f.x!==0?"x":"y",_=f[g];let x=[],v,S;const w={x:0,y:0},N={x:0,y:0},[,,C,T]=S7({sourceX:e.x,sourceY:e.y,targetX:r.x,targetY:r.y});if(l[g]*u[g]===-1){g==="x"?(v=s.x??d.x+(p.x-d.x)*o,S=s.y??(d.y+p.y)/2):(v=s.x??(d.x+p.x)/2,S=s.y??d.y+(p.y-d.y)*o);const F=[{x:v,y:d.y},{x:v,y:p.y}],B=[{x:d.x,y:S},{x:p.x,y:S}];l[g]===_?x=g==="x"?F:B:x=g==="x"?B:F}else{const F=[{x:d.x,y:p.y}],B=[{x:p.x,y:d.y}];if(g==="x"?x=l.x===_?B:F:x=l.y===_?F:B,n===i){const P=Math.abs(e[g]-r[g]);if(P<=a){const q=Math.min(a-1,a-P);l[g]===_?w[g]=(d[g]>e[g]?-1:1)*q:N[g]=(p[g]>r[g]?-1:1)*q}}if(n!==i){const P=g==="x"?"y":"x",q=l[g]===u[P],I=d[P]>p[P],Q=d[P]<p[P];(l[g]===1&&(!q&&I||q&&Q)||l[g]!==1&&(!q&&Q||q&&I))&&(x=g==="x"?F:B)}const H={x:d.x+w.x,y:d.y+w.y},$={x:p.x+N.x,y:p.y+N.y},z=Math.max(Math.abs(H.x-x[0].x),Math.abs($.x-x[0].x)),W=Math.max(Math.abs(H.y-x[0].y),Math.abs($.y-x[0].y));z>=W?(v=(H.x+$.x)/2,S=x[0].y):(v=x[0].x,S=(H.y+$.y)/2)}const A={x:d.x+w.x,y:d.y+w.y},E={x:p.x+N.x,y:p.y+N.y};return[[e,...A.x!==x[0].x||A.y!==x[0].y?[A]:[],...x,...E.x!==x[x.length-1].x||E.y!==x[x.length-1].y?[E]:[],r],v,S,C,T]}function Ome(e,n,r,i){const s=Math.min(kD(e,n)/2,kD(n,r)/2,i),{x:a,y:o}=n;if(e.x===a&&a===r.x||e.y===o&&o===r.y)return`L${a} ${o}`;if(e.y===o){const d=e.x<r.x?-1:1,p=e.y<r.y?1:-1;return`L ${a+s*d},${o}Q ${a},${o} ${a},${o+s*p}`}const l=e.x<r.x?1:-1,u=e.y<r.y?-1:1;return`L ${a},${o+s*u}Q ${a},${o} ${a+s*l},${o}`}function gj({sourceX:e,sourceY:n,sourcePosition:r=Ot.Bottom,targetX:i,targetY:s,targetPosition:a=Ot.Top,borderRadius:o=5,centerX:l,centerY:u,offset:d=20,stepPosition:p=.5}){const[f,g,_,x,v]=Rme({source:{x:e,y:n},sourcePosition:r,target:{x:i,y:s},targetPosition:a,center:{x:l,y:u},offset:d,stepPosition:p});let S=`M${f[0].x} ${f[0].y}`;for(let w=1;w<f.length-1;w++)S+=Ome(f[w-1],f[w],f[w+1],o);return S+=`L${f[f.length-1].x} ${f[f.length-1].y}`,[S,g,_,x,v]}function wD(e){var n;return e&&!!(e.internals.handleBounds||(n=e.handles)!=null&&n.length)&&!!(e.measured.width||e.width||e.initialWidth)}function Dme(e){var f;const{sourceNode:n,targetNode:r}=e;if(!wD(n)||!wD(r))return null;const i=n.internals.handleBounds||SD(n.handles),s=r.internals.handleBounds||SD(r.handles),a=CD((i==null?void 0:i.source)??[],e.sourceHandle),o=CD(e.connectionMode===Nf.Strict?(s==null?void 0:s.target)??[]:((s==null?void 0:s.target)??[]).concat((s==null?void 0:s.source)??[]),e.targetHandle);if(!a||!o)return(f=e.onError)==null||f.call(e,"008",Go.error008(a?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const l=(a==null?void 0:a.position)||Ot.Bottom,u=(o==null?void 0:o.position)||Ot.Top,d=Nd(n,a,l),p=Nd(r,o,u);return{sourceX:d.x,sourceY:d.y,targetX:p.x,targetY:p.y,sourcePosition:l,targetPosition:u}}function SD(e){if(!e)return null;const n=[],r=[];for(const i of e)i.width=i.width??1,i.height=i.height??1,i.type==="source"?n.push(i):i.type==="target"&&r.push(i);return{source:n,target:r}}function Nd(e,n,r=Ot.Left,i=!1){const s=((n==null?void 0:n.x)??0)+e.internals.positionAbsolute.x,a=((n==null?void 0:n.y)??0)+e.internals.positionAbsolute.y,{width:o,height:l}=n??ec(e);if(i)return{x:s+o/2,y:a+l/2};switch((n==null?void 0:n.position)??r){case Ot.Top:return{x:s+o/2,y:a};case Ot.Right:return{x:s+o,y:a+l/2};case Ot.Bottom:return{x:s+o/2,y:a+l};case Ot.Left:return{x:s,y:a+l/2}}}function CD(e,n){return e&&(n?e.find(r=>r.id===n):e[0])||null}function vj(e,n){return e?typeof e=="string"?e:`${n?`${n}__`:""}${Object.keys(e).sort().map(i=>`${i}=${e[i]}`).join("&")}`:""}function Pme(e,{id:n,defaultColor:r,defaultMarkerStart:i,defaultMarkerEnd:s}){const a=new Set;return e.reduce((o,l)=>([l.markerStart||i,l.markerEnd||s].forEach(u=>{if(u&&typeof u=="object"){const d=vj(u,n);a.has(d)||(o.push({id:d,color:u.color||r,...u}),a.add(d))}}),o),[]).sort((o,l)=>o.id.localeCompare(l.id))}const j7=1e3,Lme=10,_A={nodeOrigin:[0,0],nodeExtent:Sg,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},Ime={..._A,checkEquality:!0};function xA(e,n){const r={...e};for(const i in n)n[i]!==void 0&&(r[i]=n[i]);return r}function Bme(e,n,r){const i=xA(_A,r);for(const s of e.values())if(s.parentId)kA(s,e,n,i);else{const a=bv(s,i.nodeOrigin),o=Tf(s.extent)?s.extent:i.nodeExtent,l=jd(a,o,ec(s));s.internals.positionAbsolute=l}}function zme(e,n){if(!e.handles)return e.measured?n==null?void 0:n.internals.handleBounds:void 0;const r=[],i=[];for(const s of e.handles){const a={id:s.id,width:s.width??1,height:s.height??1,nodeId:e.id,x:s.x,y:s.y,position:s.position,type:s.type};s.type==="source"?r.push(a):s.type==="target"&&i.push(a)}return{source:r,target:i}}function bA(e){return e==="manual"}function yj(e,n,r,i={}){var p,f;const s=xA(Ime,i),a={i:0},o=new Map(n),l=s!=null&&s.elevateNodesOnSelect&&!bA(s.zIndexMode)?j7:0;let u=e.length>0,d=!1;n.clear(),r.clear();for(const g of e){let _=o.get(g.id);if(s.checkEquality&&g===(_==null?void 0:_.internals.userNode))n.set(g.id,_);else{const x=bv(g,s.nodeOrigin),v=Tf(g.extent)?g.extent:s.nodeExtent,S=jd(x,v,ec(g));_={...s.defaults,...g,measured:{width:(p=g.measured)==null?void 0:p.width,height:(f=g.measured)==null?void 0:f.height},internals:{positionAbsolute:S,handleBounds:zme(g,_),z:N7(g,l,s.zIndexMode),userNode:g}},n.set(g.id,_)}(_.measured===void 0||_.measured.width===void 0||_.measured.height===void 0)&&!_.hidden&&(u=!1),g.parentId&&kA(_,n,r,i,a),d||(d=g.selected??!1)}return{nodesInitialized:u,hasSelectedNodes:d}}function $me(e,n){if(!e.parentId)return;const r=n.get(e.parentId);r?r.set(e.id,e):n.set(e.parentId,new Map([[e.id,e]]))}function kA(e,n,r,i,s){const{elevateNodesOnSelect:a,nodeOrigin:o,nodeExtent:l,zIndexMode:u}=xA(_A,i),d=e.parentId,p=n.get(d);if(!p){console.warn(`Parent node ${d} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}$me(e,r),s&&!p.parentId&&p.internals.rootParentIndex===void 0&&u==="auto"&&(p.internals.rootParentIndex=++s.i,p.internals.z=p.internals.z+s.i*Lme),s&&p.internals.rootParentIndex!==void 0&&(s.i=p.internals.rootParentIndex);const f=a&&!bA(u)?j7:0,{x:g,y:_,z:x}=Fme(e,p,o,l,f,u),{positionAbsolute:v}=e.internals,S=g!==v.x||_!==v.y;(S||x!==e.internals.z)&&n.set(e.id,{...e,internals:{...e.internals,positionAbsolute:S?{x:g,y:_}:v,z:x}})}function N7(e,n,r){const i=Ua(e.zIndex)?e.zIndex:0;return bA(r)?i:i+(e.selected?n:0)}function Fme(e,n,r,i,s,a){const{x:o,y:l}=n.internals.positionAbsolute,u=ec(e),d=bv(e,r),p=Tf(e.extent)?jd(d,e.extent,u):d;let f=jd({x:o+p.x,y:l+p.y},i,u);e.extent==="parent"&&(f=m7(f,u,n));const g=N7(e,s,a),_=n.internals.z??0;return{x:f.x,y:f.y,z:_>=g?_+1:g}}function wA(e,n,r,i=[0,0]){var o;const s=[],a=new Map;for(const l of e){const u=n.get(l.parentId);if(!u)continue;const d=((o=a.get(l.parentId))==null?void 0:o.expandedRect)??Af(u),p=v7(d,l.rect);a.set(l.parentId,{expandedRect:p,parent:u})}return a.size>0&&a.forEach(({expandedRect:l,parent:u},d)=>{var C;const p=u.internals.positionAbsolute,f=ec(u),g=u.origin??i,_=l.x<p.x?Math.round(Math.abs(p.x-l.x)):0,x=l.y<p.y?Math.round(Math.abs(p.y-l.y)):0,v=Math.max(f.width,Math.round(l.width)),S=Math.max(f.height,Math.round(l.height)),w=(v-f.width)*g[0],N=(S-f.height)*g[1];(_>0||x>0||w||N)&&(s.push({id:d,type:"position",position:{x:u.position.x-_+w,y:u.position.y-x+N}}),(C=r.get(d))==null||C.forEach(T=>{e.some(A=>A.id===T.id)||s.push({id:T.id,type:"position",position:{x:T.position.x+_,y:T.position.y+x}})})),(f.width<l.width||f.height<l.height||_||x)&&s.push({id:d,type:"dimensions",setAttributes:!0,dimensions:{width:v+(_?g[0]*_-w:0),height:S+(x?g[1]*x-N:0)}})}),s}function Hme(e,n,r,i,s,a,o){const l=i==null?void 0:i.querySelector(".xyflow__viewport");let u=!1;if(!l)return{changes:[],updatedInternals:u};const d=[],p=window.getComputedStyle(l),{m22:f}=new window.DOMMatrixReadOnly(p.transform),g=[];for(const _ of e.values()){const x=n.get(_.id);if(!x)continue;if(x.hidden){n.set(x.id,{...x,internals:{...x.internals,handleBounds:void 0}}),u=!0;continue}const v=vA(_.nodeElement),S=x.measured.width!==v.width||x.measured.height!==v.height;if(!!(v.width&&v.height&&(S||!x.internals.handleBounds||_.force))){const N=_.nodeElement.getBoundingClientRect(),C=Tf(x.extent)?x.extent:a;let{positionAbsolute:T}=x.internals;x.parentId&&x.extent==="parent"?T=m7(T,v,n.get(x.parentId)):C&&(T=jd(T,C,v));const A={...x,measured:v,internals:{...x.internals,positionAbsolute:T,handleBounds:{source:_D("source",_.nodeElement,N,f,x.id),target:_D("target",_.nodeElement,N,f,x.id)}}};n.set(x.id,A),x.parentId&&kA(A,n,r,{nodeOrigin:s,zIndexMode:o}),u=!0,S&&(d.push({id:x.id,type:"dimensions",dimensions:v}),x.expandParent&&x.parentId&&g.push({id:x.id,parentId:x.parentId,rect:Af(A,s)}))}}if(g.length>0){const _=wA(g,n,r,s);d.push(..._)}return{changes:d,updatedInternals:u}}async function Wme({delta:e,panZoom:n,transform:r,translateExtent:i,width:s,height:a}){if(!n||!e.x&&!e.y)return Promise.resolve(!1);const o=await n.setViewportConstrained({x:r[0]+e.x,y:r[1]+e.y,zoom:r[2]},[[0,0],[s,a]],i),l=!!o&&(o.x!==r[0]||o.y!==r[1]||o.k!==r[2]);return Promise.resolve(l)}function jD(e,n,r,i,s,a){let o=s;const l=i.get(o)||new Map;i.set(o,l.set(r,n)),o=`${s}-${e}`;const u=i.get(o)||new Map;if(i.set(o,u.set(r,n)),a){o=`${s}-${e}-${a}`;const d=i.get(o)||new Map;i.set(o,d.set(r,n))}}function E7(e,n,r){e.clear(),n.clear();for(const i of r){const{source:s,target:a,sourceHandle:o=null,targetHandle:l=null}=i,u={edgeId:i.id,source:s,target:a,sourceHandle:o,targetHandle:l},d=`${s}-${o}--${a}-${l}`,p=`${a}-${l}--${s}-${o}`;jD("source",u,p,e,s,o),jD("target",u,d,e,a,l),n.set(i.id,i)}}function A7(e,n){if(!e.parentId)return!1;const r=n.get(e.parentId);return r?r.selected?!0:A7(r,n):!1}function ND(e,n,r){var s;let i=e;do{if((s=i==null?void 0:i.matches)!=null&&s.call(i,n))return!0;if(i===r)return!1;i=i==null?void 0:i.parentElement}while(i);return!1}function qme(e,n,r,i){const s=new Map;for(const[a,o]of e)if((o.selected||o.id===i)&&(!o.parentId||!A7(o,e))&&(o.draggable||n&&typeof o.draggable>"u")){const l=e.get(a);l&&s.set(a,{id:a,position:l.position||{x:0,y:0},distance:{x:r.x-l.internals.positionAbsolute.x,y:r.y-l.internals.positionAbsolute.y},extent:l.extent,parentId:l.parentId,origin:l.origin,expandParent:l.expandParent,internals:{positionAbsolute:l.internals.positionAbsolute||{x:0,y:0}},measured:{width:l.measured.width??0,height:l.measured.height??0}})}return s}function iS({nodeId:e,dragItems:n,nodeLookup:r,dragging:i=!0}){var o,l,u;const s=[];for(const[d,p]of n){const f=(o=r.get(d))==null?void 0:o.internals.userNode;f&&s.push({...f,position:p.position,dragging:i})}if(!e)return[s[0],s];const a=(l=r.get(e))==null?void 0:l.internals.userNode;return[a?{...a,position:((u=n.get(e))==null?void 0:u.position)||a.position,dragging:i}:s[0],s]}function Ume({dragItems:e,snapGrid:n,x:r,y:i}){const s=e.values().next().value;if(!s)return null;const a={x:r-s.distance.x,y:i-s.distance.y},o=wv(a,n);return{x:o.x-a.x,y:o.y-a.y}}function Vme({onNodeMouseDown:e,getStoreItems:n,onDragStart:r,onDrag:i,onDragStop:s}){let a={x:null,y:null},o=0,l=new Map,u=!1,d={x:0,y:0},p=null,f=!1,g=null,_=!1,x=!1,v=null;function S({noDragClassName:N,handleSelector:C,domNode:T,isSelectable:A,nodeId:E,nodeClickDistance:D=0}){g=Fi(T);function F({x:z,y:W}){const{nodeLookup:P,nodeExtent:q,snapGrid:I,snapToGrid:Q,nodeOrigin:K,onNodeDrag:Z,onSelectionDrag:Y,onError:R,updateNodePositions:U}=n();a={x:z,y:W};let V=!1;const ie=l.size>1,te=ie&&q?mj(kv(l)):null,X=ie&&Q?Ume({dragItems:l,snapGrid:I,x:z,y:W}):null;for(const[se,re]of l){if(!P.has(se))continue;let de={x:z-re.distance.x,y:W-re.distance.y};Q&&(de=X?{x:Math.round(de.x+X.x),y:Math.round(de.y+X.y)}:wv(de,I));let ue=null;if(ie&&q&&!re.extent&&te){const{positionAbsolute:J}=re.internals,me=J.x-te.x+q[0][0],fe=J.x+re.measured.width-te.x2+q[1][0],ve=J.y-te.y+q[0][1],Ke=J.y+re.measured.height-te.y2+q[1][1];ue=[[me,ve],[fe,Ke]]}const{position:ae,positionAbsolute:pe}=p7({nodeId:se,nextPosition:de,nodeLookup:P,nodeExtent:ue||q,nodeOrigin:K,onError:R});V=V||re.position.x!==ae.x||re.position.y!==ae.y,re.position=ae,re.internals.positionAbsolute=pe}if(x=x||V,!!V&&(U(l,!0),v&&(i||Z||!E&&Y))){const[se,re]=iS({nodeId:E,dragItems:l,nodeLookup:P});i==null||i(v,l,se,re),Z==null||Z(v,se,re),E||Y==null||Y(v,re)}}async function B(){if(!p)return;const{transform:z,panBy:W,autoPanSpeed:P,autoPanOnNodeDrag:q}=n();if(!q){u=!1,cancelAnimationFrame(o);return}const[I,Q]=g7(d,p,P);(I!==0||Q!==0)&&(a.x=(a.x??0)-I/z[2],a.y=(a.y??0)-Q/z[2],await W({x:I,y:Q})&&F(a)),o=requestAnimationFrame(B)}function H(z){var ie;const{nodeLookup:W,multiSelectionActive:P,nodesDraggable:q,transform:I,snapGrid:Q,snapToGrid:K,selectNodesOnDrag:Z,onNodeDragStart:Y,onSelectionDragStart:R,unselectNodesAndEdges:U}=n();f=!0,(!Z||!A)&&!P&&E&&((ie=W.get(E))!=null&&ie.selected||U()),A&&Z&&E&&(e==null||e(E));const V=Xm(z.sourceEvent,{transform:I,snapGrid:Q,snapToGrid:K,containerBounds:p});if(a=V,l=qme(W,q,V,E),l.size>0&&(r||Y||!E&&R)){const[te,X]=iS({nodeId:E,dragItems:l,nodeLookup:W});r==null||r(z.sourceEvent,l,te,X),Y==null||Y(z.sourceEvent,te,X),E||R==null||R(z.sourceEvent,X)}}const $=aA().clickDistance(D).on("start",z=>{const{domNode:W,nodeDragThreshold:P,transform:q,snapGrid:I,snapToGrid:Q}=n();p=(W==null?void 0:W.getBoundingClientRect())||null,_=!1,x=!1,v=z.sourceEvent,P===0&&H(z),a=Xm(z.sourceEvent,{transform:q,snapGrid:I,snapToGrid:Q,containerBounds:p}),d=Va(z.sourceEvent,p)}).on("drag",z=>{const{autoPanOnNodeDrag:W,transform:P,snapGrid:q,snapToGrid:I,nodeDragThreshold:Q,nodeLookup:K}=n(),Z=Xm(z.sourceEvent,{transform:P,snapGrid:q,snapToGrid:I,containerBounds:p});if(v=z.sourceEvent,(z.sourceEvent.type==="touchmove"&&z.sourceEvent.touches.length>1||E&&!K.has(E))&&(_=!0),!_){if(!u&&W&&f&&(u=!0,B()),!f){const Y=Va(z.sourceEvent,p),R=Y.x-d.x,U=Y.y-d.y;Math.sqrt(R*R+U*U)>Q&&H(z)}(a.x!==Z.xSnapped||a.y!==Z.ySnapped)&&l&&f&&(d=Va(z.sourceEvent,p),F(Z))}}).on("end",z=>{if(!(!f||_)&&(u=!1,f=!1,cancelAnimationFrame(o),l.size>0)){const{nodeLookup:W,updateNodePositions:P,onNodeDragStop:q,onSelectionDragStop:I}=n();if(x&&(P(l,!1),x=!1),s||q||!E&&I){const[Q,K]=iS({nodeId:E,dragItems:l,nodeLookup:W,dragging:!1});s==null||s(z.sourceEvent,l,Q,K),q==null||q(z.sourceEvent,Q,K),E||I==null||I(z.sourceEvent,K)}}}).filter(z=>{const W=z.target;return!z.button&&(!N||!ND(W,`.${N}`,T))&&(!C||ND(W,C,T))});g.call($)}function w(){g==null||g.on(".drag",null)}return{update:S,destroy:w}}function Kme(e,n,r){const i=[],s={x:e.x-r,y:e.y-r,width:r*2,height:r*2};for(const a of n.values())jg(s,Af(a))>0&&i.push(a);return i}const Yme=250;function Gme(e,n,r,i){var l,u;let s=[],a=1/0;const o=Kme(e,r,n+Yme);for(const d of o){const p=[...((l=d.internals.handleBounds)==null?void 0:l.source)??[],...((u=d.internals.handleBounds)==null?void 0:u.target)??[]];for(const f of p){if(i.nodeId===f.nodeId&&i.type===f.type&&i.id===f.id)continue;const{x:g,y:_}=Nd(d,f,f.position,!0),x=Math.sqrt(Math.pow(g-e.x,2)+Math.pow(_-e.y,2));x>n||(x<a?(s=[{...f,x:g,y:_}],a=x):x===a&&s.push({...f,x:g,y:_}))}}if(!s.length)return null;if(s.length>1){const d=i.type==="source"?"target":"source";return s.find(p=>p.type===d)??s[0]}return s[0]}function T7(e,n,r,i,s,a=!1){var d,p,f;const o=i.get(e);if(!o)return null;const l=s==="strict"?(d=o.internals.handleBounds)==null?void 0:d[n]:[...((p=o.internals.handleBounds)==null?void 0:p.source)??[],...((f=o.internals.handleBounds)==null?void 0:f.target)??[]],u=(r?l==null?void 0:l.find(g=>g.id===r):l==null?void 0:l[0])??null;return u&&a?{...u,...Nd(o,u,u.position,!0)}:u}function M7(e,n){return e||(n!=null&&n.classList.contains("target")?"target":n!=null&&n.classList.contains("source")?"source":null)}function Xme(e,n){let r=null;return n?r=!0:e&&!n&&(r=!1),r}const R7=()=>!0;function Qme(e,{connectionMode:n,connectionRadius:r,handleId:i,nodeId:s,edgeUpdaterType:a,isTarget:o,domNode:l,nodeLookup:u,lib:d,autoPanOnConnect:p,flowId:f,panBy:g,cancelConnection:_,onConnectStart:x,onConnect:v,onConnectEnd:S,isValidConnection:w=R7,onReconnectEnd:N,updateConnection:C,getTransform:T,getFromHandle:A,autoPanSpeed:E,dragThreshold:D=1,handleDomNode:F}){const B=x7(e.target);let H=0,$;const{x:z,y:W}=Va(e),P=M7(a,F),q=l==null?void 0:l.getBoundingClientRect();let I=!1;if(!q||!P)return;const Q=T7(s,P,i,u,n);if(!Q)return;let K=Va(e,q),Z=!1,Y=null,R=!1,U=null;function V(){if(!p||!q)return;const[ae,pe]=g7(K,q,E);g({x:ae,y:pe}),H=requestAnimationFrame(V)}const ie={...Q,nodeId:s,type:P,position:Q.position},te=u.get(s);let se={inProgress:!0,isValid:null,from:Nd(te,ie,Ot.Left,!0),fromHandle:ie,fromPosition:ie.position,fromNode:te,to:K,toHandle:null,toPosition:mD[ie.position],toNode:null,pointer:K};function re(){I=!0,C(se),x==null||x(e,{nodeId:s,handleId:i,handleType:P})}D===0&&re();function de(ae){if(!I){const{x:Ke,y:ge}=Va(ae),Ue=Ke-z,$e=ge-W;if(!(Ue*Ue+$e*$e>D*D))return;re()}if(!A()||!ie){ue(ae);return}const pe=T();K=Va(ae,q),$=Gme(Sv(K,pe,!1,[1,1]),r,u,ie),Z||(V(),Z=!0);const J=O7(ae,{handle:$,connectionMode:n,fromNodeId:s,fromHandleId:i,fromType:o?"target":"source",isValidConnection:w,doc:B,lib:d,flowId:f,nodeLookup:u});U=J.handleDomNode,Y=J.connection,R=Xme(!!$,J.isValid);const me=u.get(s),fe=me?Nd(me,ie,Ot.Left,!0):se.from,ve={...se,from:fe,isValid:R,to:J.toHandle&&R?ob({x:J.toHandle.x,y:J.toHandle.y},pe):K,toHandle:J.toHandle,toPosition:R&&J.toHandle?J.toHandle.position:mD[ie.position],toNode:J.toHandle?u.get(J.toHandle.nodeId):null,pointer:K};C(ve),se=ve}function ue(ae){if(!("touches"in ae&&ae.touches.length>0)){if(I){($||U)&&Y&&R&&(v==null||v(Y));const{inProgress:pe,...J}=se,me={...J,toPosition:se.toHandle?se.toPosition:null};S==null||S(ae,me),a&&(N==null||N(ae,me))}_(),cancelAnimationFrame(H),Z=!1,R=!1,Y=null,U=null,B.removeEventListener("mousemove",de),B.removeEventListener("mouseup",ue),B.removeEventListener("touchmove",de),B.removeEventListener("touchend",ue)}}B.addEventListener("mousemove",de),B.addEventListener("mouseup",ue),B.addEventListener("touchmove",de),B.addEventListener("touchend",ue)}function O7(e,{handle:n,connectionMode:r,fromNodeId:i,fromHandleId:s,fromType:a,doc:o,lib:l,flowId:u,isValidConnection:d=R7,nodeLookup:p}){const f=a==="target",g=n?o.querySelector(`.${l}-flow__handle[data-id="${u}-${n==null?void 0:n.nodeId}-${n==null?void 0:n.id}-${n==null?void 0:n.type}"]`):null,{x:_,y:x}=Va(e),v=o.elementFromPoint(_,x),S=v!=null&&v.classList.contains(`${l}-flow__handle`)?v:g,w={handleDomNode:S,isValid:!1,connection:null,toHandle:null};if(S){const N=M7(void 0,S),C=S.getAttribute("data-nodeid"),T=S.getAttribute("data-handleid"),A=S.classList.contains("connectable"),E=S.classList.contains("connectableend");if(!C||!N)return w;const D={source:f?C:i,sourceHandle:f?T:s,target:f?i:C,targetHandle:f?s:T};w.connection=D;const B=A&&E&&(r===Nf.Strict?f&&N==="source"||!f&&N==="target":C!==i||T!==s);w.isValid=B&&d(D),w.toHandle=T7(C,N,T,p,r,!0)}return w}const _j={onPointerDown:Qme,isValid:O7};function Zme({domNode:e,panZoom:n,getTransform:r,getViewScale:i}){const s=Fi(e);function a({translateExtent:l,width:u,height:d,zoomStep:p=1,pannable:f=!0,zoomable:g=!0,inversePan:_=!1}){const x=C=>{if(C.sourceEvent.type!=="wheel"||!n)return;const T=r(),A=C.sourceEvent.ctrlKey&&Ng()?10:1,E=-C.sourceEvent.deltaY*(C.sourceEvent.deltaMode===1?.05:C.sourceEvent.deltaMode?1:.002)*p,D=T[2]*Math.pow(2,E*A);n.scaleTo(D)};let v=[0,0];const S=C=>{(C.sourceEvent.type==="mousedown"||C.sourceEvent.type==="touchstart")&&(v=[C.sourceEvent.clientX??C.sourceEvent.touches[0].clientX,C.sourceEvent.clientY??C.sourceEvent.touches[0].clientY])},w=C=>{const T=r();if(C.sourceEvent.type!=="mousemove"&&C.sourceEvent.type!=="touchmove"||!n)return;const A=[C.sourceEvent.clientX??C.sourceEvent.touches[0].clientX,C.sourceEvent.clientY??C.sourceEvent.touches[0].clientY],E=[A[0]-v[0],A[1]-v[1]];v=A;const D=i()*Math.max(T[2],Math.log(T[2]))*(_?-1:1),F={x:T[0]-E[0]*D,y:T[1]-E[1]*D},B=[[0,0],[u,d]];n.setViewportConstrained({x:F.x,y:F.y,zoom:T[2]},B,l)},N=fA().on("start",S).on("zoom",f?w:null).on("zoom.wheel",g?x:null);s.call(N,{})}function o(){s.on("zoom",null)}return{update:a,destroy:o,pointer:_a}}const j0=e=>({x:e.x,y:e.y,zoom:e.k}),sS=({x:e,y:n,zoom:r})=>w0.translate(e,n).scale(r),Gh=(e,n)=>e.target.closest(`.${n}`),D7=(e,n)=>n===2&&Array.isArray(e)&&e.includes(2),Jme=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,aS=(e,n=0,r=Jme,i=()=>{})=>{const s=typeof n=="number"&&n>0;return s||i(),s?e.transition().duration(n).ease(r).on("end",i):e},P7=e=>{const n=e.ctrlKey&&Ng()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*n};function ege({zoomPanValues:e,noWheelClassName:n,d3Selection:r,d3Zoom:i,panOnScrollMode:s,panOnScrollSpeed:a,zoomOnPinch:o,onPanZoomStart:l,onPanZoom:u,onPanZoomEnd:d}){return p=>{if(Gh(p,n))return p.ctrlKey&&p.preventDefault(),!1;p.preventDefault(),p.stopImmediatePropagation();const f=r.property("__zoom").k||1;if(p.ctrlKey&&o){const S=_a(p),w=P7(p),N=f*Math.pow(2,w);i.scaleTo(r,N,S,p);return}const g=p.deltaMode===1?20:1;let _=s===md.Vertical?0:p.deltaX*g,x=s===md.Horizontal?0:p.deltaY*g;!Ng()&&p.shiftKey&&s!==md.Vertical&&(_=p.deltaY*g,x=0),i.translateBy(r,-(_/f)*a,-(x/f)*a,{internal:!0});const v=j0(r.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(u==null||u(p,v),e.panScrollTimeout=setTimeout(()=>{d==null||d(p,v),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,l==null||l(p,v))}}function tge({noWheelClassName:e,preventScrolling:n,d3ZoomHandler:r}){return function(i,s){const a=i.type==="wheel",o=!n&&a&&!i.ctrlKey,l=Gh(i,e);if(i.ctrlKey&&a&&l&&i.preventDefault(),o||l)return null;i.preventDefault(),r.call(this,i,s)}}function nge({zoomPanValues:e,onDraggingChange:n,onPanZoomStart:r}){return i=>{var a,o,l;if((a=i.sourceEvent)!=null&&a.internal)return;const s=j0(i.transform);e.mouseButton=((o=i.sourceEvent)==null?void 0:o.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=s,((l=i.sourceEvent)==null?void 0:l.type)==="mousedown"&&n(!0),r&&(r==null||r(i.sourceEvent,s))}}function rge({zoomPanValues:e,panOnDrag:n,onPaneContextMenu:r,onTransformChange:i,onPanZoom:s}){return a=>{var o,l;e.usedRightMouseButton=!!(r&&D7(n,e.mouseButton??0)),(o=a.sourceEvent)!=null&&o.sync||i([a.transform.x,a.transform.y,a.transform.k]),s&&!((l=a.sourceEvent)!=null&&l.internal)&&(s==null||s(a.sourceEvent,j0(a.transform)))}}function ige({zoomPanValues:e,panOnDrag:n,panOnScroll:r,onDraggingChange:i,onPanZoomEnd:s,onPaneContextMenu:a}){return o=>{var l;if(!((l=o.sourceEvent)!=null&&l.internal)&&(e.isZoomingOrPanning=!1,a&&D7(n,e.mouseButton??0)&&!e.usedRightMouseButton&&o.sourceEvent&&a(o.sourceEvent),e.usedRightMouseButton=!1,i(!1),s)){const u=j0(o.transform);e.prevViewport=u,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{s==null||s(o.sourceEvent,u)},r?150:0)}}}function sge({zoomActivationKeyPressed:e,zoomOnScroll:n,zoomOnPinch:r,panOnDrag:i,panOnScroll:s,zoomOnDoubleClick:a,userSelectionActive:o,noWheelClassName:l,noPanClassName:u,lib:d,connectionInProgress:p}){return f=>{var S;const g=e||n,_=r&&f.ctrlKey,x=f.type==="wheel";if(f.button===1&&f.type==="mousedown"&&(Gh(f,`${d}-flow__node`)||Gh(f,`${d}-flow__edge`)))return!0;if(!i&&!g&&!s&&!a&&!r||o||p&&!x||Gh(f,l)&&x||Gh(f,u)&&(!x||s&&x&&!e)||!r&&f.ctrlKey&&x)return!1;if(!r&&f.type==="touchstart"&&((S=f.touches)==null?void 0:S.length)>1)return f.preventDefault(),!1;if(!g&&!s&&!_&&x||!i&&(f.type==="mousedown"||f.type==="touchstart")||Array.isArray(i)&&!i.includes(f.button)&&f.type==="mousedown")return!1;const v=Array.isArray(i)&&i.includes(f.button)||!f.button||f.button<=1;return(!f.ctrlKey||x)&&v}}function age({domNode:e,minZoom:n,maxZoom:r,translateExtent:i,viewport:s,onPanZoom:a,onPanZoomStart:o,onPanZoomEnd:l,onDraggingChange:u}){const d={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},p=e.getBoundingClientRect(),f=fA().scaleExtent([n,r]).translateExtent(i),g=Fi(e).call(f);N({x:s.x,y:s.y,zoom:Ef(s.zoom,n,r)},[[0,0],[p.width,p.height]],i);const _=g.on("wheel.zoom"),x=g.on("dblclick.zoom");f.wheelDelta(P7);function v($,z){return g?new Promise(W=>{f==null||f.interpolate((z==null?void 0:z.interpolate)==="linear"?Gm:dx).transform(aS(g,z==null?void 0:z.duration,z==null?void 0:z.ease,()=>W(!0)),$)}):Promise.resolve(!1)}function S({noWheelClassName:$,noPanClassName:z,onPaneContextMenu:W,userSelectionActive:P,panOnScroll:q,panOnDrag:I,panOnScrollMode:Q,panOnScrollSpeed:K,preventScrolling:Z,zoomOnPinch:Y,zoomOnScroll:R,zoomOnDoubleClick:U,zoomActivationKeyPressed:V,lib:ie,onTransformChange:te,connectionInProgress:X,paneClickDistance:se,selectionOnDrag:re}){P&&!d.isZoomingOrPanning&&w();const de=q&&!V&&!P;f.clickDistance(re?1/0:!Ua(se)||se<0?0:se);const ue=de?ege({zoomPanValues:d,noWheelClassName:$,d3Selection:g,d3Zoom:f,panOnScrollMode:Q,panOnScrollSpeed:K,zoomOnPinch:Y,onPanZoomStart:o,onPanZoom:a,onPanZoomEnd:l}):tge({noWheelClassName:$,preventScrolling:Z,d3ZoomHandler:_});if(g.on("wheel.zoom",ue,{passive:!1}),!P){const pe=nge({zoomPanValues:d,onDraggingChange:u,onPanZoomStart:o});f.on("start",pe);const J=rge({zoomPanValues:d,panOnDrag:I,onPaneContextMenu:!!W,onPanZoom:a,onTransformChange:te});f.on("zoom",J);const me=ige({zoomPanValues:d,panOnDrag:I,panOnScroll:q,onPaneContextMenu:W,onPanZoomEnd:l,onDraggingChange:u});f.on("end",me)}const ae=sge({zoomActivationKeyPressed:V,panOnDrag:I,zoomOnScroll:R,panOnScroll:q,zoomOnDoubleClick:U,zoomOnPinch:Y,userSelectionActive:P,noPanClassName:z,noWheelClassName:$,lib:ie,connectionInProgress:X});f.filter(ae),U?g.on("dblclick.zoom",x):g.on("dblclick.zoom",null)}function w(){f.on("zoom",null)}async function N($,z,W){const P=sS($),q=f==null?void 0:f.constrain()(P,z,W);return q&&await v(q),new Promise(I=>I(q))}async function C($,z){const W=sS($);return await v(W,z),new Promise(P=>P(W))}function T($){if(g){const z=sS($),W=g.property("__zoom");(W.k!==$.zoom||W.x!==$.x||W.y!==$.y)&&(f==null||f.transform(g,z,null,{sync:!0}))}}function A(){const $=g?Ba(g.node()):{x:0,y:0,k:1};return{x:$.x,y:$.y,zoom:$.k}}function E($,z){return g?new Promise(W=>{f==null||f.interpolate((z==null?void 0:z.interpolate)==="linear"?Gm:dx).scaleTo(aS(g,z==null?void 0:z.duration,z==null?void 0:z.ease,()=>W(!0)),$)}):Promise.resolve(!1)}function D($,z){return g?new Promise(W=>{f==null||f.interpolate((z==null?void 0:z.interpolate)==="linear"?Gm:dx).scaleBy(aS(g,z==null?void 0:z.duration,z==null?void 0:z.ease,()=>W(!0)),$)}):Promise.resolve(!1)}function F($){f==null||f.scaleExtent($)}function B($){f==null||f.translateExtent($)}function H($){const z=!Ua($)||$<0?0:$;f==null||f.clickDistance(z)}return{update:S,destroy:w,setViewport:C,setViewportConstrained:N,getViewport:A,scaleTo:E,scaleBy:D,setScaleExtent:F,setTranslateExtent:B,syncViewport:T,setClickDistance:H}}var Mf;(function(e){e.Line="line",e.Handle="handle"})(Mf||(Mf={}));function oge({width:e,prevWidth:n,height:r,prevHeight:i,affectsX:s,affectsY:a}){const o=e-n,l=r-i,u=[o>0?1:o<0?-1:0,l>0?1:l<0?-1:0];return o&&s&&(u[0]=u[0]*-1),l&&a&&(u[1]=u[1]*-1),u}function ED(e){const n=e.includes("right")||e.includes("left"),r=e.includes("bottom")||e.includes("top"),i=e.includes("left"),s=e.includes("top");return{isHorizontal:n,isVertical:r,affectsX:i,affectsY:s}}function Ac(e,n){return Math.max(0,n-e)}function Tc(e,n){return Math.max(0,e-n)}function a_(e,n,r){return Math.max(0,n-e,e-r)}function AD(e,n){return e?!n:n}function lge(e,n,r,i,s,a,o,l){let{affectsX:u,affectsY:d}=n;const{isHorizontal:p,isVertical:f}=n,g=p&&f,{xSnapped:_,ySnapped:x}=r,{minWidth:v,maxWidth:S,minHeight:w,maxHeight:N}=i,{x:C,y:T,width:A,height:E,aspectRatio:D}=e;let F=Math.floor(p?_-e.pointerX:0),B=Math.floor(f?x-e.pointerY:0);const H=A+(u?-F:F),$=E+(d?-B:B),z=-a[0]*A,W=-a[1]*E;let P=a_(H,v,S),q=a_($,w,N);if(o){let K=0,Z=0;u&&F<0?K=Ac(C+F+z,o[0][0]):!u&&F>0&&(K=Tc(C+H+z,o[1][0])),d&&B<0?Z=Ac(T+B+W,o[0][1]):!d&&B>0&&(Z=Tc(T+$+W,o[1][1])),P=Math.max(P,K),q=Math.max(q,Z)}if(l){let K=0,Z=0;u&&F>0?K=Tc(C+F,l[0][0]):!u&&F<0&&(K=Ac(C+H,l[1][0])),d&&B>0?Z=Tc(T+B,l[0][1]):!d&&B<0&&(Z=Ac(T+$,l[1][1])),P=Math.max(P,K),q=Math.max(q,Z)}if(s){if(p){const K=a_(H/D,w,N)*D;if(P=Math.max(P,K),o){let Z=0;!u&&!d||u&&!d&&g?Z=Tc(T+W+H/D,o[1][1])*D:Z=Ac(T+W+(u?F:-F)/D,o[0][1])*D,P=Math.max(P,Z)}if(l){let Z=0;!u&&!d||u&&!d&&g?Z=Ac(T+H/D,l[1][1])*D:Z=Tc(T+(u?F:-F)/D,l[0][1])*D,P=Math.max(P,Z)}}if(f){const K=a_($*D,v,S)/D;if(q=Math.max(q,K),o){let Z=0;!u&&!d||d&&!u&&g?Z=Tc(C+$*D+z,o[1][0])/D:Z=Ac(C+(d?B:-B)*D+z,o[0][0])/D,q=Math.max(q,Z)}if(l){let Z=0;!u&&!d||d&&!u&&g?Z=Ac(C+$*D,l[1][0])/D:Z=Tc(C+(d?B:-B)*D,l[0][0])/D,q=Math.max(q,Z)}}}B=B+(B<0?q:-q),F=F+(F<0?P:-P),s&&(g?H>$*D?B=(AD(u,d)?-F:F)/D:F=(AD(u,d)?-B:B)*D:p?(B=F/D,d=u):(F=B*D,u=d));const I=u?C+F:C,Q=d?T+B:T;return{width:A+(u?-F:F),height:E+(d?-B:B),x:a[0]*F*(u?-1:1)+I,y:a[1]*B*(d?-1:1)+Q}}const L7={width:0,height:0,x:0,y:0},cge={...L7,pointerX:0,pointerY:0,aspectRatio:1};function uge(e){return[[0,0],[e.measured.width,e.measured.height]]}function dge(e,n,r){const i=n.position.x+e.position.x,s=n.position.y+e.position.y,a=e.measured.width??0,o=e.measured.height??0,l=r[0]*a,u=r[1]*o;return[[i-l,s-u],[i+a-l,s+o-u]]}function hge({domNode:e,nodeId:n,getStoreItems:r,onChange:i,onEnd:s}){const a=Fi(e);let o={controlDirection:ED("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function l({controlPosition:d,boundaries:p,keepAspectRatio:f,resizeDirection:g,onResizeStart:_,onResize:x,onResizeEnd:v,shouldResize:S}){let w={...L7},N={...cge};o={boundaries:p,resizeDirection:g,keepAspectRatio:f,controlDirection:ED(d)};let C,T=null,A=[],E,D,F,B=!1;const H=aA().on("start",$=>{const{nodeLookup:z,transform:W,snapGrid:P,snapToGrid:q,nodeOrigin:I,paneDomNode:Q}=r();if(C=z.get(n),!C)return;T=(Q==null?void 0:Q.getBoundingClientRect())??null;const{xSnapped:K,ySnapped:Z}=Xm($.sourceEvent,{transform:W,snapGrid:P,snapToGrid:q,containerBounds:T});w={width:C.measured.width??0,height:C.measured.height??0,x:C.position.x??0,y:C.position.y??0},N={...w,pointerX:K,pointerY:Z,aspectRatio:w.width/w.height},E=void 0,C.parentId&&(C.extent==="parent"||C.expandParent)&&(E=z.get(C.parentId),D=E&&C.extent==="parent"?uge(E):void 0),A=[],F=void 0;for(const[Y,R]of z)if(R.parentId===n&&(A.push({id:Y,position:{...R.position},extent:R.extent}),R.extent==="parent"||R.expandParent)){const U=dge(R,C,R.origin??I);F?F=[[Math.min(U[0][0],F[0][0]),Math.min(U[0][1],F[0][1])],[Math.max(U[1][0],F[1][0]),Math.max(U[1][1],F[1][1])]]:F=U}_==null||_($,{...w})}).on("drag",$=>{const{transform:z,snapGrid:W,snapToGrid:P,nodeOrigin:q}=r(),I=Xm($.sourceEvent,{transform:z,snapGrid:W,snapToGrid:P,containerBounds:T}),Q=[];if(!C)return;const{x:K,y:Z,width:Y,height:R}=w,U={},V=C.origin??q,{width:ie,height:te,x:X,y:se}=lge(N,o.controlDirection,I,o.boundaries,o.keepAspectRatio,V,D,F),re=ie!==Y,de=te!==R,ue=X!==K&&re,ae=se!==Z&&de;if(!ue&&!ae&&!re&&!de)return;if((ue||ae||V[0]===1||V[1]===1)&&(U.x=ue?X:w.x,U.y=ae?se:w.y,w.x=U.x,w.y=U.y,A.length>0)){const fe=X-K,ve=se-Z;for(const Ke of A)Ke.position={x:Ke.position.x-fe+V[0]*(ie-Y),y:Ke.position.y-ve+V[1]*(te-R)},Q.push(Ke)}if((re||de)&&(U.width=re&&(!o.resizeDirection||o.resizeDirection==="horizontal")?ie:w.width,U.height=de&&(!o.resizeDirection||o.resizeDirection==="vertical")?te:w.height,w.width=U.width,w.height=U.height),E&&C.expandParent){const fe=V[0]*(U.width??0);U.x&&U.x<fe&&(w.x=fe,N.x=N.x-(U.x-fe));const ve=V[1]*(U.height??0);U.y&&U.y<ve&&(w.y=ve,N.y=N.y-(U.y-ve))}const pe=oge({width:w.width,prevWidth:Y,height:w.height,prevHeight:R,affectsX:o.controlDirection.affectsX,affectsY:o.controlDirection.affectsY}),J={...w,direction:pe};(S==null?void 0:S($,J))!==!1&&(B=!0,x==null||x($,J),i(U,Q))}).on("end",$=>{B&&(v==null||v($,{...w}),s==null||s({...w}),B=!1)});a.call(H)}function u(){a.on(".drag",null)}return{update:l,destroy:u}}var oS={exports:{}},lS={},cS={exports:{}},uS={};/**
 * @license React
 * use-sync-external-store-shim.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var TD;function fge(){if(TD)return uS;TD=1;var e=Gg();function n(f,g){return f===g&&(f!==0||1/f===1/g)||f!==f&&g!==g}var r=typeof Object.is=="function"?Object.is:n,i=e.useState,s=e.useEffect,a=e.useLayoutEffect,o=e.useDebugValue;function l(f,g){var _=g(),x=i({inst:{value:_,getSnapshot:g}}),v=x[0].inst,S=x[1];return a(function(){v.value=_,v.getSnapshot=g,u(v)&&S({inst:v})},[f,_,g]),s(function(){return u(v)&&S({inst:v}),f(function(){u(v)&&S({inst:v})})},[f]),o(_),_}function u(f){var g=f.getSnapshot;f=f.value;try{var _=g();return!r(f,_)}catch{return!0}}function d(f,g){return g()}var p=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?d:l;return uS.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:p,uS}var MD;function pge(){return MD||(MD=1,cS.exports=fge()),cS.exports}/**
 * @license React
 * use-sync-external-store-shim/with-selector.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var RD;function mge(){if(RD)return lS;RD=1;var e=Gg(),n=pge();function r(d,p){return d===p&&(d!==0||1/d===1/p)||d!==d&&p!==p}var i=typeof Object.is=="function"?Object.is:r,s=n.useSyncExternalStore,a=e.useRef,o=e.useEffect,l=e.useMemo,u=e.useDebugValue;return lS.useSyncExternalStoreWithSelector=function(d,p,f,g,_){var x=a(null);if(x.current===null){var v={hasValue:!1,value:null};x.current=v}else v=x.current;x=l(function(){function w(E){if(!N){if(N=!0,C=E,E=g(E),_!==void 0&&v.hasValue){var D=v.value;if(_(D,E))return T=D}return T=E}if(D=T,i(C,E))return D;var F=g(E);return _!==void 0&&_(D,F)?(C=E,D):(C=E,T=F)}var N=!1,C,T,A=f===void 0?null:f;return[function(){return w(p())},A===null?void 0:function(){return w(A())}]},[p,f,g,_]);var S=s(d,x[0],x[1]);return o(function(){v.hasValue=!0,v.value=S},[S]),u(S),S},lS}var OD;function gge(){return OD||(OD=1,oS.exports=mge()),oS.exports}var vge=gge();const yge=pu(vge),_ge={},DD=e=>{let n;const r=new Set,i=(p,f)=>{const g=typeof p=="function"?p(n):p;if(!Object.is(g,n)){const _=n;n=f??(typeof g!="object"||g===null)?g:Object.assign({},n,g),r.forEach(x=>x(n,_))}},s=()=>n,u={setState:i,getState:s,getInitialState:()=>d,subscribe:p=>(r.add(p),()=>r.delete(p)),destroy:()=>{(_ge?"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."),r.clear()}},d=n=e(i,s,u);return u},xge=e=>e?DD(e):DD,{useDebugValue:bge}=Wf,{useSyncExternalStoreWithSelector:kge}=yge,wge=e=>e;function I7(e,n=wge,r){const i=kge(e.subscribe,e.getState,e.getServerState||e.getInitialState,n,r);return bge(i),i}const PD=(e,n)=>{const r=xge(e),i=(s,a=n)=>I7(r,s,a);return Object.assign(i,r),i},Sge=(e,n)=>e?PD(e,n):PD;function kr(e,n){if(Object.is(e,n))return!0;if(typeof e!="object"||e===null||typeof n!="object"||n===null)return!1;if(e instanceof Map&&n instanceof Map){if(e.size!==n.size)return!1;for(const[i,s]of e)if(!Object.is(s,n.get(i)))return!1;return!0}if(e instanceof Set&&n instanceof Set){if(e.size!==n.size)return!1;for(const i of e)if(!n.has(i))return!1;return!0}const r=Object.keys(e);if(r.length!==Object.keys(n).length)return!1;for(const i of r)if(!Object.prototype.hasOwnProperty.call(n,i)||!Object.is(e[i],n[i]))return!1;return!0}const N0=b.createContext(null),Cge=N0.Provider,B7=Go.error001();function kn(e,n){const r=b.useContext(N0);if(r===null)throw new Error(B7);return I7(r,e,n)}function dr(){const e=b.useContext(N0);if(e===null)throw new Error(B7);return b.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const LD={display:"none"},jge={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},z7="react-flow__node-desc",$7="react-flow__edge-desc",Nge="react-flow__aria-live",Ege=e=>e.ariaLiveMessage,Age=e=>e.ariaLabelConfig;function Tge({rfId:e}){const n=kn(Ege);return c.jsx("div",{id:`${Nge}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:jge,children:n})}function Mge({rfId:e,disableKeyboardA11y:n}){const r=kn(Age);return c.jsxs(c.Fragment,{children:[c.jsx("div",{id:`${z7}-${e}`,style:LD,children:n?r["node.a11yDescription.default"]:r["node.a11yDescription.keyboardDisabled"]}),c.jsx("div",{id:`${$7}-${e}`,style:LD,children:r["edge.a11yDescription.default"]}),!n&&c.jsx(Tge,{rfId:e})]})}const E0=b.forwardRef(({position:e="top-left",children:n,className:r,style:i,...s},a)=>{const o=`${e}`.split("-");return c.jsx("div",{className:Xr(["react-flow__panel",r,...o]),style:i,ref:a,...s,children:n})});E0.displayName="Panel";function Rge({proOptions:e,position:n="bottom-right"}){return e!=null&&e.hideAttribution?null:c.jsx(E0,{position:n,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:c.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const Oge=e=>{const n=[],r=[];for(const[,i]of e.nodeLookup)i.selected&&n.push(i.internals.userNode);for(const[,i]of e.edgeLookup)i.selected&&r.push(i);return{selectedNodes:n,selectedEdges:r}},o_=e=>e.id;function Dge(e,n){return kr(e.selectedNodes.map(o_),n.selectedNodes.map(o_))&&kr(e.selectedEdges.map(o_),n.selectedEdges.map(o_))}function Pge({onSelectionChange:e}){const n=dr(),{selectedNodes:r,selectedEdges:i}=kn(Oge,Dge);return b.useEffect(()=>{const s={nodes:r,edges:i};e==null||e(s),n.getState().onSelectionChangeHandlers.forEach(a=>a(s))},[r,i,e]),null}const Lge=e=>!!e.onSelectionChangeHandlers;function Ige({onSelectionChange:e}){const n=kn(Lge);return e||n?c.jsx(Pge,{onSelectionChange:e}):null}const xj=typeof window<"u"?b.useLayoutEffect:b.useEffect,F7=[0,0],Bge={x:0,y:0,zoom:1},zge=["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"],ID=[...zge,"rfId"],$ge=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}),BD={translateExtent:Sg,nodeOrigin:F7,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function Fge(e){const{setNodes:n,setEdges:r,setMinZoom:i,setMaxZoom:s,setTranslateExtent:a,setNodeExtent:o,reset:l,setDefaultNodesAndEdges:u}=kn($ge,kr),d=dr();xj(()=>(u(e.defaultNodes,e.defaultEdges),()=>{p.current=BD,l()}),[]);const p=b.useRef(BD);return xj(()=>{for(const f of ID){const g=e[f],_=p.current[f];g!==_&&(typeof e[f]>"u"||(f==="nodes"?n(g):f==="edges"?r(g):f==="minZoom"?i(g):f==="maxZoom"?s(g):f==="translateExtent"?a(g):f==="nodeExtent"?o(g):f==="ariaLabelConfig"?d.setState({ariaLabelConfig:Sme(g)}):f==="fitView"?d.setState({fitViewQueued:g}):f==="fitViewOptions"?d.setState({fitViewOptions:g}):d.setState({[f]:g})))}p.current=e},ID.map(f=>e[f])),null}function zD(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function Hge(e){var i;const[n,r]=b.useState(e==="system"?null:e);return b.useEffect(()=>{if(e!=="system"){r(e);return}const s=zD(),a=()=>r(s!=null&&s.matches?"dark":"light");return a(),s==null||s.addEventListener("change",a),()=>{s==null||s.removeEventListener("change",a)}},[e]),n!==null?n:(i=zD())!=null&&i.matches?"dark":"light"}const $D=typeof document<"u"?document:null;function Eg(e=null,n={target:$D,actInsideInputWithModifier:!0}){const[r,i]=b.useState(!1),s=b.useRef(!1),a=b.useRef(new Set([])),[o,l]=b.useMemo(()=>{if(e!==null){const d=(Array.isArray(e)?e:[e]).filter(f=>typeof f=="string").map(f=>f.replace("+",`
`).replace(`

`,`
+`).split(`
`)),p=d.reduce((f,g)=>f.concat(...g),[]);return[d,p]}return[[],[]]},[e]);return b.useEffect(()=>{const u=(n==null?void 0:n.target)??$D,d=(n==null?void 0:n.actInsideInputWithModifier)??!0;if(e!==null){const p=_=>{var S,w;if(s.current=_.ctrlKey||_.metaKey||_.shiftKey||_.altKey,(!s.current||s.current&&!d)&&b7(_))return!1;const v=HD(_.code,l);if(a.current.add(_[v]),FD(o,a.current,!1)){const N=((w=(S=_.composedPath)==null?void 0:S.call(_))==null?void 0:w[0])||_.target,C=(N==null?void 0:N.nodeName)==="BUTTON"||(N==null?void 0:N.nodeName)==="A";n.preventDefault!==!1&&(s.current||!C)&&_.preventDefault(),i(!0)}},f=_=>{const x=HD(_.code,l);FD(o,a.current,!0)?(i(!1),a.current.clear()):a.current.delete(_[x]),_.key==="Meta"&&a.current.clear(),s.current=!1},g=()=>{a.current.clear(),i(!1)};return u==null||u.addEventListener("keydown",p),u==null||u.addEventListener("keyup",f),window.addEventListener("blur",g),window.addEventListener("contextmenu",g),()=>{u==null||u.removeEventListener("keydown",p),u==null||u.removeEventListener("keyup",f),window.removeEventListener("blur",g),window.removeEventListener("contextmenu",g)}}},[e,i]),r}function FD(e,n,r){return e.filter(i=>r||i.length===n.size).some(i=>i.every(s=>n.has(s)))}function HD(e,n){return n.includes(e)?"code":"key"}const Wge=()=>{const e=dr();return b.useMemo(()=>({zoomIn:n=>{const{panZoom:r}=e.getState();return r?r.scaleBy(1.2,n):Promise.resolve(!1)},zoomOut:n=>{const{panZoom:r}=e.getState();return r?r.scaleBy(1/1.2,n):Promise.resolve(!1)},zoomTo:(n,r)=>{const{panZoom:i}=e.getState();return i?i.scaleTo(n,r):Promise.resolve(!1)},getZoom:()=>e.getState().transform[2],setViewport:async(n,r)=>{const{transform:[i,s,a],panZoom:o}=e.getState();return o?(await o.setViewport({x:n.x??i,y:n.y??s,zoom:n.zoom??a},r),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[n,r,i]=e.getState().transform;return{x:n,y:r,zoom:i}},setCenter:async(n,r,i)=>e.getState().setCenter(n,r,i),fitBounds:async(n,r)=>{const{width:i,height:s,minZoom:a,maxZoom:o,panZoom:l}=e.getState(),u=gA(n,i,s,a,o,(r==null?void 0:r.padding)??.1);return l?(await l.setViewport(u,{duration:r==null?void 0:r.duration,ease:r==null?void 0:r.ease,interpolate:r==null?void 0:r.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(n,r={})=>{const{transform:i,snapGrid:s,snapToGrid:a,domNode:o}=e.getState();if(!o)return n;const{x:l,y:u}=o.getBoundingClientRect(),d={x:n.x-l,y:n.y-u},p=r.snapGrid??s,f=r.snapToGrid??a;return Sv(d,i,f,p)},flowToScreenPosition:n=>{const{transform:r,domNode:i}=e.getState();if(!i)return n;const{x:s,y:a}=i.getBoundingClientRect(),o=ob(n,r);return{x:o.x+s,y:o.y+a}}}),[])};function H7(e,n){const r=[],i=new Map,s=[];for(const a of e)if(a.type==="add"){s.push(a);continue}else if(a.type==="remove"||a.type==="replace")i.set(a.id,[a]);else{const o=i.get(a.id);o?o.push(a):i.set(a.id,[a])}for(const a of n){const o=i.get(a.id);if(!o){r.push(a);continue}if(o[0].type==="remove")continue;if(o[0].type==="replace"){r.push({...o[0].item});continue}const l={...a};for(const u of o)qge(u,l);r.push(l)}return s.length&&s.forEach(a=>{a.index!==void 0?r.splice(a.index,0,{...a.item}):r.push({...a.item})}),r}function qge(e,n){switch(e.type){case"select":{n.selected=e.selected;break}case"position":{typeof e.position<"u"&&(n.position=e.position),typeof e.dragging<"u"&&(n.dragging=e.dragging);break}case"dimensions":{typeof e.dimensions<"u"&&(n.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes==="width")&&(n.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes==="height")&&(n.height=e.dimensions.height))),typeof e.resizing=="boolean"&&(n.resizing=e.resizing);break}}}function W7(e,n){return H7(e,n)}function q7(e,n){return H7(e,n)}function Xu(e,n){return{id:e,type:"select",selected:n}}function Xh(e,n=new Set,r=!1){const i=[];for(const[s,a]of e){const o=n.has(s);!(a.selected===void 0&&!o)&&a.selected!==o&&(r&&(a.selected=o),i.push(Xu(a.id,o)))}return i}function WD({items:e=[],lookup:n}){var s;const r=[],i=new Map(e.map(a=>[a.id,a]));for(const[a,o]of e.entries()){const l=n.get(o.id),u=((s=l==null?void 0:l.internals)==null?void 0:s.userNode)??l;u!==void 0&&u!==o&&r.push({id:o.id,item:o,type:"replace"}),u===void 0&&r.push({item:o,type:"add",index:a})}for(const[a]of n)i.get(a)===void 0&&r.push({id:a,type:"remove"});return r}function qD(e){return{id:e.id,type:"remove"}}const UD=e=>pme(e),Uge=e=>f7(e);function U7(e){return b.forwardRef(e)}function VD(e){const[n,r]=b.useState(BigInt(0)),[i]=b.useState(()=>Vge(()=>r(s=>s+BigInt(1))));return xj(()=>{const s=i.get();s.length&&(e(s),i.reset())},[n]),i}function Vge(e){let n=[];return{get:()=>n,reset:()=>{n=[]},push:r=>{n.push(r),e()}}}const V7=b.createContext(null);function Kge({children:e}){const n=dr(),r=b.useCallback(l=>{const{nodes:u=[],setNodes:d,hasDefaultNodes:p,onNodesChange:f,nodeLookup:g,fitViewQueued:_,onNodesChangeMiddlewareMap:x}=n.getState();let v=u;for(const w of l)v=typeof w=="function"?w(v):w;let S=WD({items:v,lookup:g});for(const w of x.values())S=w(S);p&&d(v),S.length>0?f==null||f(S):_&&window.requestAnimationFrame(()=>{const{fitViewQueued:w,nodes:N,setNodes:C}=n.getState();w&&C(N)})},[]),i=VD(r),s=b.useCallback(l=>{const{edges:u=[],setEdges:d,hasDefaultEdges:p,onEdgesChange:f,edgeLookup:g}=n.getState();let _=u;for(const x of l)_=typeof x=="function"?x(_):x;p?d(_):f&&f(WD({items:_,lookup:g}))},[]),a=VD(s),o=b.useMemo(()=>({nodeQueue:i,edgeQueue:a}),[]);return c.jsx(V7.Provider,{value:o,children:e})}function Yge(){const e=b.useContext(V7);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const Gge=e=>!!e.panZoom;function A0(){const e=Wge(),n=dr(),r=Yge(),i=kn(Gge),s=b.useMemo(()=>{const a=f=>n.getState().nodeLookup.get(f),o=f=>{r.nodeQueue.push(f)},l=f=>{r.edgeQueue.push(f)},u=f=>{var w,N;const{nodeLookup:g,nodeOrigin:_}=n.getState(),x=UD(f)?f:g.get(f.id),v=x.parentId?_7(x.position,x.measured,x.parentId,g,_):x.position,S={...x,position:v,width:((w=x.measured)==null?void 0:w.width)??x.width,height:((N=x.measured)==null?void 0:N.height)??x.height};return Af(S)},d=(f,g,_={replace:!1})=>{o(x=>x.map(v=>{if(v.id===f){const S=typeof g=="function"?g(v):g;return _.replace&&UD(S)?S:{...v,...S}}return v}))},p=(f,g,_={replace:!1})=>{l(x=>x.map(v=>{if(v.id===f){const S=typeof g=="function"?g(v):g;return _.replace&&Uge(S)?S:{...v,...S}}return v}))};return{getNodes:()=>n.getState().nodes.map(f=>({...f})),getNode:f=>{var g;return(g=a(f))==null?void 0:g.internals.userNode},getInternalNode:a,getEdges:()=>{const{edges:f=[]}=n.getState();return f.map(g=>({...g}))},getEdge:f=>n.getState().edgeLookup.get(f),setNodes:o,setEdges:l,addNodes:f=>{const g=Array.isArray(f)?f:[f];r.nodeQueue.push(_=>[..._,...g])},addEdges:f=>{const g=Array.isArray(f)?f:[f];r.edgeQueue.push(_=>[..._,...g])},toObject:()=>{const{nodes:f=[],edges:g=[],transform:_}=n.getState(),[x,v,S]=_;return{nodes:f.map(w=>({...w})),edges:g.map(w=>({...w})),viewport:{x,y:v,zoom:S}}},deleteElements:async({nodes:f=[],edges:g=[]})=>{const{nodes:_,edges:x,onNodesDelete:v,onEdgesDelete:S,triggerNodeChanges:w,triggerEdgeChanges:N,onDelete:C,onBeforeDelete:T}=n.getState(),{nodes:A,edges:E}=await _me({nodesToRemove:f,edgesToRemove:g,nodes:_,edges:x,onBeforeDelete:T}),D=E.length>0,F=A.length>0;if(D){const B=E.map(qD);S==null||S(E),N(B)}if(F){const B=A.map(qD);v==null||v(A),w(B)}return(F||D)&&(C==null||C({nodes:A,edges:E})),{deletedNodes:A,deletedEdges:E}},getIntersectingNodes:(f,g=!0,_)=>{const x=vD(f),v=x?f:u(f),S=_!==void 0;return v?(_||n.getState().nodes).filter(w=>{const N=n.getState().nodeLookup.get(w.id);if(N&&!x&&(w.id===f.id||!N.internals.positionAbsolute))return!1;const C=Af(S?w:N),T=jg(C,v);return g&&T>0||T>=C.width*C.height||T>=v.width*v.height}):[]},isNodeIntersecting:(f,g,_=!0)=>{const v=vD(f)?f:u(f);if(!v)return!1;const S=jg(v,g);return _&&S>0||S>=g.width*g.height||S>=v.width*v.height},updateNode:d,updateNodeData:(f,g,_={replace:!1})=>{d(f,x=>{const v=typeof g=="function"?g(x):g;return _.replace?{...x,data:v}:{...x,data:{...x.data,...v}}},_)},updateEdge:p,updateEdgeData:(f,g,_={replace:!1})=>{p(f,x=>{const v=typeof g=="function"?g(x):g;return _.replace?{...x,data:v}:{...x,data:{...x.data,...v}}},_)},getNodesBounds:f=>{const{nodeLookup:g,nodeOrigin:_}=n.getState();return mme(f,{nodeLookup:g,nodeOrigin:_})},getHandleConnections:({type:f,id:g,nodeId:_})=>{var x;return Array.from(((x=n.getState().connectionLookup.get(`${_}-${f}${g?`-${g}`:""}`))==null?void 0:x.values())??[])},getNodeConnections:({type:f,handleId:g,nodeId:_})=>{var x;return Array.from(((x=n.getState().connectionLookup.get(`${_}${f?g?`-${f}-${g}`:`-${f}`:""}`))==null?void 0:x.values())??[])},fitView:async f=>{const g=n.getState().fitViewResolver??wme();return n.setState({fitViewQueued:!0,fitViewOptions:f,fitViewResolver:g}),r.nodeQueue.push(_=>[..._]),g.promise}}},[]);return b.useMemo(()=>({...s,...e,viewportInitialized:i}),[i])}const KD=e=>e.selected,Xge=typeof window<"u"?window:void 0;function Qge({deleteKeyCode:e,multiSelectionKeyCode:n}){const r=dr(),{deleteElements:i}=A0(),s=Eg(e,{actInsideInputWithModifier:!1}),a=Eg(n,{target:Xge});b.useEffect(()=>{if(s){const{edges:o,nodes:l}=r.getState();i({nodes:l.filter(KD),edges:o.filter(KD)}),r.setState({nodesSelectionActive:!1})}},[s]),b.useEffect(()=>{r.setState({multiSelectionActive:a})},[a])}function Zge(e){const n=dr();b.useEffect(()=>{const r=()=>{var s,a,o,l;if(!e.current||!(((a=(s=e.current).checkVisibility)==null?void 0:a.call(s))??!0))return!1;const i=vA(e.current);(i.height===0||i.width===0)&&((l=(o=n.getState()).onError)==null||l.call(o,"004",Go.error004())),n.setState({width:i.width||500,height:i.height||500})};if(e.current){r(),window.addEventListener("resize",r);const i=new ResizeObserver(()=>r());return i.observe(e.current),()=>{window.removeEventListener("resize",r),i&&e.current&&i.unobserve(e.current)}}},[])}const T0={position:"absolute",width:"100%",height:"100%",top:0,left:0},Jge=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function eve({onPaneContextMenu:e,zoomOnScroll:n=!0,zoomOnPinch:r=!0,panOnScroll:i=!1,panOnScrollSpeed:s=.5,panOnScrollMode:a=md.Free,zoomOnDoubleClick:o=!0,panOnDrag:l=!0,defaultViewport:u,translateExtent:d,minZoom:p,maxZoom:f,zoomActivationKeyCode:g,preventScrolling:_=!0,children:x,noWheelClassName:v,noPanClassName:S,onViewportChange:w,isControlledViewport:N,paneClickDistance:C,selectionOnDrag:T}){const A=dr(),E=b.useRef(null),{userSelectionActive:D,lib:F,connectionInProgress:B}=kn(Jge,kr),H=Eg(g),$=b.useRef();Zge(E);const z=b.useCallback(W=>{w==null||w({x:W[0],y:W[1],zoom:W[2]}),N||A.setState({transform:W})},[w,N]);return b.useEffect(()=>{if(E.current){$.current=age({domNode:E.current,minZoom:p,maxZoom:f,translateExtent:d,viewport:u,onDraggingChange:I=>A.setState(Q=>Q.paneDragging===I?Q:{paneDragging:I}),onPanZoomStart:(I,Q)=>{const{onViewportChangeStart:K,onMoveStart:Z}=A.getState();Z==null||Z(I,Q),K==null||K(Q)},onPanZoom:(I,Q)=>{const{onViewportChange:K,onMove:Z}=A.getState();Z==null||Z(I,Q),K==null||K(Q)},onPanZoomEnd:(I,Q)=>{const{onViewportChangeEnd:K,onMoveEnd:Z}=A.getState();Z==null||Z(I,Q),K==null||K(Q)}});const{x:W,y:P,zoom:q}=$.current.getViewport();return A.setState({panZoom:$.current,transform:[W,P,q],domNode:E.current.closest(".react-flow")}),()=>{var I;(I=$.current)==null||I.destroy()}}},[]),b.useEffect(()=>{var W;(W=$.current)==null||W.update({onPaneContextMenu:e,zoomOnScroll:n,zoomOnPinch:r,panOnScroll:i,panOnScrollSpeed:s,panOnScrollMode:a,zoomOnDoubleClick:o,panOnDrag:l,zoomActivationKeyPressed:H,preventScrolling:_,noPanClassName:S,userSelectionActive:D,noWheelClassName:v,lib:F,onTransformChange:z,connectionInProgress:B,selectionOnDrag:T,paneClickDistance:C})},[e,n,r,i,s,a,o,l,H,_,S,D,v,F,z,B,T,C]),c.jsx("div",{className:"react-flow__renderer",ref:E,style:T0,children:x})}const tve=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function nve(){const{userSelectionActive:e,userSelectionRect:n}=kn(tve,kr);return e&&n?c.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:n.width,height:n.height,transform:`translate(${n.x}px, ${n.y}px)`}}):null}const dS=(e,n)=>r=>{r.target===n.current&&(e==null||e(r))},rve=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function ive({isSelecting:e,selectionKeyPressed:n,selectionMode:r=Cg.Full,panOnDrag:i,paneClickDistance:s,selectionOnDrag:a,onSelectionStart:o,onSelectionEnd:l,onPaneClick:u,onPaneContextMenu:d,onPaneScroll:p,onPaneMouseEnter:f,onPaneMouseMove:g,onPaneMouseLeave:_,children:x}){const v=dr(),{userSelectionActive:S,elementsSelectable:w,dragging:N,connectionInProgress:C}=kn(rve,kr),T=w&&(e||S),A=b.useRef(null),E=b.useRef(),D=b.useRef(new Set),F=b.useRef(new Set),B=b.useRef(!1),H=K=>{if(B.current||C){B.current=!1;return}u==null||u(K),v.getState().resetSelectedElements(),v.setState({nodesSelectionActive:!1})},$=K=>{if(Array.isArray(i)&&(i!=null&&i.includes(2))){K.preventDefault();return}d==null||d(K)},z=p?K=>p(K):void 0,W=K=>{B.current&&(K.stopPropagation(),B.current=!1)},P=K=>{var te,X;const{domNode:Z}=v.getState();if(E.current=Z==null?void 0:Z.getBoundingClientRect(),!E.current)return;const Y=K.target===A.current;if(!Y&&!!K.target.closest(".nokey")||!e||!(a&&Y||n)||K.button!==0||!K.isPrimary)return;(X=(te=K.target)==null?void 0:te.setPointerCapture)==null||X.call(te,K.pointerId),B.current=!1;const{x:V,y:ie}=Va(K.nativeEvent,E.current);v.setState({userSelectionRect:{width:0,height:0,startX:V,startY:ie,x:V,y:ie}}),Y||(K.stopPropagation(),K.preventDefault())},q=K=>{const{userSelectionRect:Z,transform:Y,nodeLookup:R,edgeLookup:U,connectionLookup:V,triggerNodeChanges:ie,triggerEdgeChanges:te,defaultEdgeOptions:X,resetSelectedElements:se}=v.getState();if(!E.current||!Z)return;const{x:re,y:de}=Va(K.nativeEvent,E.current),{startX:ue,startY:ae}=Z;if(!B.current){const ve=n?0:s;if(Math.hypot(re-ue,de-ae)<=ve)return;se(),o==null||o(K)}B.current=!0;const pe={startX:ue,startY:ae,x:re<ue?re:ue,y:de<ae?de:ae,width:Math.abs(re-ue),height:Math.abs(de-ae)},J=D.current,me=F.current;D.current=new Set(mA(R,pe,Y,r===Cg.Partial,!0).map(ve=>ve.id)),F.current=new Set;const fe=(X==null?void 0:X.selectable)??!0;for(const ve of D.current){const Ke=V.get(ve);if(Ke)for(const{edgeId:ge}of Ke.values()){const Ue=U.get(ge);Ue&&(Ue.selectable??fe)&&F.current.add(ge)}}if(!yD(J,D.current)){const ve=Xh(R,D.current,!0);ie(ve)}if(!yD(me,F.current)){const ve=Xh(U,F.current);te(ve)}v.setState({userSelectionRect:pe,userSelectionActive:!0,nodesSelectionActive:!1})},I=K=>{var Z,Y;K.button===0&&((Y=(Z=K.target)==null?void 0:Z.releasePointerCapture)==null||Y.call(Z,K.pointerId),!S&&K.target===A.current&&v.getState().userSelectionRect&&(H==null||H(K)),v.setState({userSelectionActive:!1,userSelectionRect:null}),B.current&&(l==null||l(K),v.setState({nodesSelectionActive:D.current.size>0})))},Q=i===!0||Array.isArray(i)&&i.includes(0);return c.jsxs("div",{className:Xr(["react-flow__pane",{draggable:Q,dragging:N,selection:e}]),onClick:T?void 0:dS(H,A),onContextMenu:dS($,A),onWheel:dS(z,A),onPointerEnter:T?void 0:f,onPointerMove:T?q:g,onPointerUp:T?I:void 0,onPointerDownCapture:T?P:void 0,onClickCapture:T?W:void 0,onPointerLeave:_,ref:A,style:T0,children:[x,c.jsx(nve,{})]})}function bj({id:e,store:n,unselect:r=!1,nodeRef:i}){const{addSelectedNodes:s,unselectNodesAndEdges:a,multiSelectionActive:o,nodeLookup:l,onError:u}=n.getState(),d=l.get(e);if(!d){u==null||u("012",Go.error012(e));return}n.setState({nodesSelectionActive:!1}),d.selected?(r||d.selected&&o)&&(a({nodes:[d],edges:[]}),requestAnimationFrame(()=>{var p;return(p=i==null?void 0:i.current)==null?void 0:p.blur()})):s([e])}function K7({nodeRef:e,disabled:n=!1,noDragClassName:r,handleSelector:i,nodeId:s,isSelectable:a,nodeClickDistance:o}){const l=dr(),[u,d]=b.useState(!1),p=b.useRef();return b.useEffect(()=>{p.current=Vme({getStoreItems:()=>l.getState(),onNodeMouseDown:f=>{bj({id:f,store:l,nodeRef:e})},onDragStart:()=>{d(!0)},onDragStop:()=>{d(!1)}})},[]),b.useEffect(()=>{if(!(n||!e.current||!p.current))return p.current.update({noDragClassName:r,handleSelector:i,domNode:e.current,isSelectable:a,nodeId:s,nodeClickDistance:o}),()=>{var f;(f=p.current)==null||f.destroy()}},[r,i,n,a,e,s,o]),u}const sve=e=>n=>n.selected&&(n.draggable||e&&typeof n.draggable>"u");function Y7(){const e=dr();return b.useCallback(r=>{const{nodeExtent:i,snapToGrid:s,snapGrid:a,nodesDraggable:o,onError:l,updateNodePositions:u,nodeLookup:d,nodeOrigin:p}=e.getState(),f=new Map,g=sve(o),_=s?a[0]:5,x=s?a[1]:5,v=r.direction.x*_*r.factor,S=r.direction.y*x*r.factor;for(const[,w]of d){if(!g(w))continue;let N={x:w.internals.positionAbsolute.x+v,y:w.internals.positionAbsolute.y+S};s&&(N=wv(N,a));const{position:C,positionAbsolute:T}=p7({nodeId:w.id,nextPosition:N,nodeLookup:d,nodeExtent:i,nodeOrigin:p,onError:l});w.position=C,w.internals.positionAbsolute=T,f.set(w.id,w)}u(f)},[])}const SA=b.createContext(null),ave=SA.Provider;SA.Consumer;const G7=()=>b.useContext(SA),ove=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),lve=(e,n,r)=>i=>{const{connectionClickStartHandle:s,connectionMode:a,connection:o}=i,{fromHandle:l,toHandle:u,isValid:d}=o,p=(u==null?void 0:u.nodeId)===e&&(u==null?void 0:u.id)===n&&(u==null?void 0:u.type)===r;return{connectingFrom:(l==null?void 0:l.nodeId)===e&&(l==null?void 0:l.id)===n&&(l==null?void 0:l.type)===r,connectingTo:p,clickConnecting:(s==null?void 0:s.nodeId)===e&&(s==null?void 0:s.id)===n&&(s==null?void 0:s.type)===r,isPossibleEndHandle:a===Nf.Strict?(l==null?void 0:l.type)!==r:e!==(l==null?void 0:l.nodeId)||n!==(l==null?void 0:l.id),connectionInProcess:!!l,clickConnectionInProcess:!!s,valid:p&&d}};function cve({type:e="source",position:n=Ot.Top,isValidConnection:r,isConnectable:i=!0,isConnectableStart:s=!0,isConnectableEnd:a=!0,id:o,onConnect:l,children:u,className:d,onMouseDown:p,onTouchStart:f,...g},_){var q,I;const x=o||null,v=e==="target",S=dr(),w=G7(),{connectOnClick:N,noPanClassName:C,rfId:T}=kn(ove,kr),{connectingFrom:A,connectingTo:E,clickConnecting:D,isPossibleEndHandle:F,connectionInProcess:B,clickConnectionInProcess:H,valid:$}=kn(lve(w,x,e),kr);w||(I=(q=S.getState()).onError)==null||I.call(q,"010",Go.error010());const z=Q=>{const{defaultEdgeOptions:K,onConnect:Z,hasDefaultEdges:Y}=S.getState(),R={...K,...Q};if(Y){const{edges:U,setEdges:V}=S.getState();V(Tme(R,U))}Z==null||Z(R),l==null||l(R)},W=Q=>{if(!w)return;const K=k7(Q.nativeEvent);if(s&&(K&&Q.button===0||!K)){const Z=S.getState();_j.onPointerDown(Q.nativeEvent,{handleDomNode:Q.currentTarget,autoPanOnConnect:Z.autoPanOnConnect,connectionMode:Z.connectionMode,connectionRadius:Z.connectionRadius,domNode:Z.domNode,nodeLookup:Z.nodeLookup,lib:Z.lib,isTarget:v,handleId:x,nodeId:w,flowId:Z.rfId,panBy:Z.panBy,cancelConnection:Z.cancelConnection,onConnectStart:Z.onConnectStart,onConnectEnd:(...Y)=>{var R,U;return(U=(R=S.getState()).onConnectEnd)==null?void 0:U.call(R,...Y)},updateConnection:Z.updateConnection,onConnect:z,isValidConnection:r||((...Y)=>{var R,U;return((U=(R=S.getState()).isValidConnection)==null?void 0:U.call(R,...Y))??!0}),getTransform:()=>S.getState().transform,getFromHandle:()=>S.getState().connection.fromHandle,autoPanSpeed:Z.autoPanSpeed,dragThreshold:Z.connectionDragThreshold})}K?p==null||p(Q):f==null||f(Q)},P=Q=>{const{onClickConnectStart:K,onClickConnectEnd:Z,connectionClickStartHandle:Y,connectionMode:R,isValidConnection:U,lib:V,rfId:ie,nodeLookup:te,connection:X}=S.getState();if(!w||!Y&&!s)return;if(!Y){K==null||K(Q.nativeEvent,{nodeId:w,handleId:x,handleType:e}),S.setState({connectionClickStartHandle:{nodeId:w,type:e,id:x}});return}const se=x7(Q.target),re=r||U,{connection:de,isValid:ue}=_j.isValid(Q.nativeEvent,{handle:{nodeId:w,id:x,type:e},connectionMode:R,fromNodeId:Y.nodeId,fromHandleId:Y.id||null,fromType:Y.type,isValidConnection:re,flowId:ie,doc:se,lib:V,nodeLookup:te});ue&&de&&z(de);const ae=structuredClone(X);delete ae.inProgress,ae.toPosition=ae.toHandle?ae.toHandle.position:null,Z==null||Z(Q,ae),S.setState({connectionClickStartHandle:null})};return c.jsx("div",{"data-handleid":x,"data-nodeid":w,"data-handlepos":n,"data-id":`${T}-${w}-${x}-${e}`,className:Xr(["react-flow__handle",`react-flow__handle-${n}`,"nodrag",C,d,{source:!v,target:v,connectable:i,connectablestart:s,connectableend:a,clickconnecting:D,connectingfrom:A,connectingto:E,valid:$,connectionindicator:i&&(!B||F)&&(B||H?a:s)}]),onMouseDown:W,onTouchStart:W,onClick:N?P:void 0,ref:_,...g,children:u})}const Ns=b.memo(U7(cve));function uve({data:e,isConnectable:n,sourcePosition:r=Ot.Bottom}){return c.jsxs(c.Fragment,{children:[e==null?void 0:e.label,c.jsx(Ns,{type:"source",position:r,isConnectable:n})]})}function dve({data:e,isConnectable:n,targetPosition:r=Ot.Top,sourcePosition:i=Ot.Bottom}){return c.jsxs(c.Fragment,{children:[c.jsx(Ns,{type:"target",position:r,isConnectable:n}),e==null?void 0:e.label,c.jsx(Ns,{type:"source",position:i,isConnectable:n})]})}function hve(){return null}function fve({data:e,isConnectable:n,targetPosition:r=Ot.Top}){return c.jsxs(c.Fragment,{children:[c.jsx(Ns,{type:"target",position:r,isConnectable:n}),e==null?void 0:e.label]})}const lb={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},YD={input:uve,default:dve,output:fve,group:hve};function pve(e){var n,r,i,s;return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??((n=e.style)==null?void 0:n.width),height:e.height??e.initialHeight??((r=e.style)==null?void 0:r.height)}:{width:e.width??((i=e.style)==null?void 0:i.width),height:e.height??((s=e.style)==null?void 0:s.height)}}const mve=e=>{const{width:n,height:r,x:i,y:s}=kv(e.nodeLookup,{filter:a=>!!a.selected});return{width:Ua(n)?n:null,height:Ua(r)?r:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${i}px,${s}px)`}};function gve({onSelectionContextMenu:e,noPanClassName:n,disableKeyboardA11y:r}){const i=dr(),{width:s,height:a,transformString:o,userSelectionActive:l}=kn(mve,kr),u=Y7(),d=b.useRef(null);b.useEffect(()=>{var _;r||(_=d.current)==null||_.focus({preventScroll:!0})},[r]);const p=!l&&s!==null&&a!==null;if(K7({nodeRef:d,disabled:!p}),!p)return null;const f=e?_=>{const x=i.getState().nodes.filter(v=>v.selected);e(_,x)}:void 0,g=_=>{Object.prototype.hasOwnProperty.call(lb,_.key)&&(_.preventDefault(),u({direction:lb[_.key],factor:_.shiftKey?4:1}))};return c.jsx("div",{className:Xr(["react-flow__nodesselection","react-flow__container",n]),style:{transform:o},children:c.jsx("div",{ref:d,className:"react-flow__nodesselection-rect",onContextMenu:f,tabIndex:r?void 0:-1,onKeyDown:r?void 0:g,style:{width:s,height:a}})})}const GD=typeof window<"u"?window:void 0,vve=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function X7({children:e,onPaneClick:n,onPaneMouseEnter:r,onPaneMouseMove:i,onPaneMouseLeave:s,onPaneContextMenu:a,onPaneScroll:o,paneClickDistance:l,deleteKeyCode:u,selectionKeyCode:d,selectionOnDrag:p,selectionMode:f,onSelectionStart:g,onSelectionEnd:_,multiSelectionKeyCode:x,panActivationKeyCode:v,zoomActivationKeyCode:S,elementsSelectable:w,zoomOnScroll:N,zoomOnPinch:C,panOnScroll:T,panOnScrollSpeed:A,panOnScrollMode:E,zoomOnDoubleClick:D,panOnDrag:F,defaultViewport:B,translateExtent:H,minZoom:$,maxZoom:z,preventScrolling:W,onSelectionContextMenu:P,noWheelClassName:q,noPanClassName:I,disableKeyboardA11y:Q,onViewportChange:K,isControlledViewport:Z}){const{nodesSelectionActive:Y,userSelectionActive:R}=kn(vve,kr),U=Eg(d,{target:GD}),V=Eg(v,{target:GD}),ie=V||F,te=V||T,X=p&&ie!==!0,se=U||R||X;return Qge({deleteKeyCode:u,multiSelectionKeyCode:x}),c.jsx(eve,{onPaneContextMenu:a,elementsSelectable:w,zoomOnScroll:N,zoomOnPinch:C,panOnScroll:te,panOnScrollSpeed:A,panOnScrollMode:E,zoomOnDoubleClick:D,panOnDrag:!U&&ie,defaultViewport:B,translateExtent:H,minZoom:$,maxZoom:z,zoomActivationKeyCode:S,preventScrolling:W,noWheelClassName:q,noPanClassName:I,onViewportChange:K,isControlledViewport:Z,paneClickDistance:l,selectionOnDrag:X,children:c.jsxs(ive,{onSelectionStart:g,onSelectionEnd:_,onPaneClick:n,onPaneMouseEnter:r,onPaneMouseMove:i,onPaneMouseLeave:s,onPaneContextMenu:a,onPaneScroll:o,panOnDrag:ie,isSelecting:!!se,selectionMode:f,selectionKeyPressed:U,paneClickDistance:l,selectionOnDrag:X,children:[e,Y&&c.jsx(gve,{onSelectionContextMenu:P,noPanClassName:I,disableKeyboardA11y:Q})]})})}X7.displayName="FlowRenderer";const yve=b.memo(X7),_ve=e=>n=>e?mA(n.nodeLookup,{x:0,y:0,width:n.width,height:n.height},n.transform,!0).map(r=>r.id):Array.from(n.nodeLookup.keys());function xve(e){return kn(b.useCallback(_ve(e),[e]),kr)}const bve=e=>e.updateNodeInternals;function kve(){const e=kn(bve),[n]=b.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(r=>{const i=new Map;r.forEach(s=>{const a=s.target.getAttribute("data-id");i.set(a,{id:a,nodeElement:s.target,force:!0})}),e(i)}));return b.useEffect(()=>()=>{n==null||n.disconnect()},[n]),n}function wve({node:e,nodeType:n,hasDimensions:r,resizeObserver:i}){const s=dr(),a=b.useRef(null),o=b.useRef(null),l=b.useRef(e.sourcePosition),u=b.useRef(e.targetPosition),d=b.useRef(n),p=r&&!!e.internals.handleBounds;return b.useEffect(()=>{a.current&&!e.hidden&&(!p||o.current!==a.current)&&(o.current&&(i==null||i.unobserve(o.current)),i==null||i.observe(a.current),o.current=a.current)},[p,e.hidden]),b.useEffect(()=>()=>{o.current&&(i==null||i.unobserve(o.current),o.current=null)},[]),b.useEffect(()=>{if(a.current){const f=d.current!==n,g=l.current!==e.sourcePosition,_=u.current!==e.targetPosition;(f||g||_)&&(d.current=n,l.current=e.sourcePosition,u.current=e.targetPosition,s.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:a.current,force:!0}]])))}},[e.id,n,e.sourcePosition,e.targetPosition]),a}function Sve({id:e,onClick:n,onMouseEnter:r,onMouseMove:i,onMouseLeave:s,onContextMenu:a,onDoubleClick:o,nodesDraggable:l,elementsSelectable:u,nodesConnectable:d,nodesFocusable:p,resizeObserver:f,noDragClassName:g,noPanClassName:_,disableKeyboardA11y:x,rfId:v,nodeTypes:S,nodeClickDistance:w,onError:N}){const{node:C,internals:T,isParent:A}=kn(re=>{const de=re.nodeLookup.get(e),ue=re.parentLookup.has(e);return{node:de,internals:de.internals,isParent:ue}},kr);let E=C.type||"default",D=(S==null?void 0:S[E])||YD[E];D===void 0&&(N==null||N("003",Go.error003(E)),E="default",D=(S==null?void 0:S.default)||YD.default);const F=!!(C.draggable||l&&typeof C.draggable>"u"),B=!!(C.selectable||u&&typeof C.selectable>"u"),H=!!(C.connectable||d&&typeof C.connectable>"u"),$=!!(C.focusable||p&&typeof C.focusable>"u"),z=dr(),W=y7(C),P=wve({node:C,nodeType:E,hasDimensions:W,resizeObserver:f}),q=K7({nodeRef:P,disabled:C.hidden||!F,noDragClassName:g,handleSelector:C.dragHandle,nodeId:e,isSelectable:B,nodeClickDistance:w}),I=Y7();if(C.hidden)return null;const Q=ec(C),K=pve(C),Z=B||F||n||r||i||s,Y=r?re=>r(re,{...T.userNode}):void 0,R=i?re=>i(re,{...T.userNode}):void 0,U=s?re=>s(re,{...T.userNode}):void 0,V=a?re=>a(re,{...T.userNode}):void 0,ie=o?re=>o(re,{...T.userNode}):void 0,te=re=>{const{selectNodesOnDrag:de,nodeDragThreshold:ue}=z.getState();B&&(!de||!F||ue>0)&&bj({id:e,store:z,nodeRef:P}),n&&n(re,{...T.userNode})},X=re=>{if(!(b7(re.nativeEvent)||x)){if(c7.includes(re.key)&&B){const de=re.key==="Escape";bj({id:e,store:z,unselect:de,nodeRef:P})}else if(F&&C.selected&&Object.prototype.hasOwnProperty.call(lb,re.key)){re.preventDefault();const{ariaLabelConfig:de}=z.getState();z.setState({ariaLiveMessage:de["node.a11yDescription.ariaLiveMessage"]({direction:re.key.replace("Arrow","").toLowerCase(),x:~~T.positionAbsolute.x,y:~~T.positionAbsolute.y})}),I({direction:lb[re.key],factor:re.shiftKey?4:1})}}},se=()=>{var me;if(x||!((me=P.current)!=null&&me.matches(":focus-visible")))return;const{transform:re,width:de,height:ue,autoPanOnNodeFocus:ae,setCenter:pe}=z.getState();if(!ae)return;mA(new Map([[e,C]]),{x:0,y:0,width:de,height:ue},re,!0).length>0||pe(C.position.x+Q.width/2,C.position.y+Q.height/2,{zoom:re[2]})};return c.jsx("div",{className:Xr(["react-flow__node",`react-flow__node-${E}`,{[_]:F},C.className,{selected:C.selected,selectable:B,parent:A,draggable:F,dragging:q}]),ref:P,style:{zIndex:T.z,transform:`translate(${T.positionAbsolute.x}px,${T.positionAbsolute.y}px)`,pointerEvents:Z?"all":"none",visibility:W?"visible":"hidden",...C.style,...K},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:Y,onMouseMove:R,onMouseLeave:U,onContextMenu:V,onClick:te,onDoubleClick:ie,onKeyDown:$?X:void 0,tabIndex:$?0:void 0,onFocus:$?se:void 0,role:C.ariaRole??($?"group":void 0),"aria-roledescription":"node","aria-describedby":x?void 0:`${z7}-${v}`,"aria-label":C.ariaLabel,...C.domAttributes,children:c.jsx(ave,{value:e,children:c.jsx(D,{id:e,data:C.data,type:E,positionAbsoluteX:T.positionAbsolute.x,positionAbsoluteY:T.positionAbsolute.y,selected:C.selected??!1,selectable:B,draggable:F,deletable:C.deletable??!0,isConnectable:H,sourcePosition:C.sourcePosition,targetPosition:C.targetPosition,dragging:q,dragHandle:C.dragHandle,zIndex:T.z,parentId:C.parentId,...Q})})})}var Cve=b.memo(Sve);const jve=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function Q7(e){const{nodesDraggable:n,nodesConnectable:r,nodesFocusable:i,elementsSelectable:s,onError:a}=kn(jve,kr),o=xve(e.onlyRenderVisibleElements),l=kve();return c.jsx("div",{className:"react-flow__nodes",style:T0,children:o.map(u=>c.jsx(Cve,{id:u,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:l,nodesDraggable:n,nodesConnectable:r,nodesFocusable:i,elementsSelectable:s,nodeClickDistance:e.nodeClickDistance,onError:a},u))})}Q7.displayName="NodeRenderer";const Nve=b.memo(Q7);function Eve(e){return kn(b.useCallback(r=>{if(!e)return r.edges.map(s=>s.id);const i=[];if(r.width&&r.height)for(const s of r.edges){const a=r.nodeLookup.get(s.source),o=r.nodeLookup.get(s.target);a&&o&&Nme({sourceNode:a,targetNode:o,width:r.width,height:r.height,transform:r.transform})&&i.push(s.id)}return i},[e]),kr)}const Ave=({color:e="none",strokeWidth:n=1})=>{const r={strokeWidth:n,...e&&{stroke:e}};return c.jsx("polyline",{className:"arrow",style:r,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},Tve=({color:e="none",strokeWidth:n=1})=>{const r={strokeWidth:n,...e&&{stroke:e,fill:e}};return c.jsx("polyline",{className:"arrowclosed",style:r,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},XD={[za.Arrow]:Ave,[za.ArrowClosed]:Tve};function Mve(e){const n=dr();return b.useMemo(()=>{var s,a;return Object.prototype.hasOwnProperty.call(XD,e)?XD[e]:((a=(s=n.getState()).onError)==null||a.call(s,"009",Go.error009(e)),null)},[e])}const Rve=({id:e,type:n,color:r,width:i=12.5,height:s=12.5,markerUnits:a="strokeWidth",strokeWidth:o,orient:l="auto-start-reverse"})=>{const u=Mve(n);return u?c.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${i}`,markerHeight:`${s}`,viewBox:"-10 -10 20 20",markerUnits:a,orient:l,refX:"0",refY:"0",children:c.jsx(u,{color:r,strokeWidth:o})}):null},Z7=({defaultColor:e,rfId:n})=>{const r=kn(a=>a.edges),i=kn(a=>a.defaultEdgeOptions),s=b.useMemo(()=>Pme(r,{id:n,defaultColor:e,defaultMarkerStart:i==null?void 0:i.markerStart,defaultMarkerEnd:i==null?void 0:i.markerEnd}),[r,i,n,e]);return s.length?c.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:c.jsx("defs",{children:s.map(a=>c.jsx(Rve,{id:a.id,type:a.type,color:a.color,width:a.width,height:a.height,markerUnits:a.markerUnits,strokeWidth:a.strokeWidth,orient:a.orient},a.id))})}):null};Z7.displayName="MarkerDefinitions";var Ove=b.memo(Z7);function J7({x:e,y:n,label:r,labelStyle:i,labelShowBg:s=!0,labelBgStyle:a,labelBgPadding:o=[2,4],labelBgBorderRadius:l=2,children:u,className:d,...p}){const[f,g]=b.useState({x:1,y:0,width:0,height:0}),_=Xr(["react-flow__edge-textwrapper",d]),x=b.useRef(null);return b.useEffect(()=>{if(x.current){const v=x.current.getBBox();g({x:v.x,y:v.y,width:v.width,height:v.height})}},[r]),r?c.jsxs("g",{transform:`translate(${e-f.width/2} ${n-f.height/2})`,className:_,visibility:f.width?"visible":"hidden",...p,children:[s&&c.jsx("rect",{width:f.width+2*o[0],x:-o[0],y:-o[1],height:f.height+2*o[1],className:"react-flow__edge-textbg",style:a,rx:l,ry:l}),c.jsx("text",{className:"react-flow__edge-text",y:f.height/2,dy:"0.3em",ref:x,style:i,children:r}),u]}):null}J7.displayName="EdgeText";const Dve=b.memo(J7);function Rf({path:e,labelX:n,labelY:r,label:i,labelStyle:s,labelShowBg:a,labelBgStyle:o,labelBgPadding:l,labelBgBorderRadius:u,interactionWidth:d=20,...p}){return c.jsxs(c.Fragment,{children:[c.jsx("path",{...p,d:e,fill:"none",className:Xr(["react-flow__edge-path",p.className])}),d?c.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:d,className:"react-flow__edge-interaction"}):null,i&&Ua(n)&&Ua(r)?c.jsx(Dve,{x:n,y:r,label:i,labelStyle:s,labelShowBg:a,labelBgStyle:o,labelBgPadding:l,labelBgBorderRadius:u}):null]})}function QD({pos:e,x1:n,y1:r,x2:i,y2:s}){return e===Ot.Left||e===Ot.Right?[.5*(n+i),r]:[n,.5*(r+s)]}function eF({sourceX:e,sourceY:n,sourcePosition:r=Ot.Bottom,targetX:i,targetY:s,targetPosition:a=Ot.Top}){const[o,l]=QD({pos:r,x1:e,y1:n,x2:i,y2:s}),[u,d]=QD({pos:a,x1:i,y1:s,x2:e,y2:n}),[p,f,g,_]=w7({sourceX:e,sourceY:n,targetX:i,targetY:s,sourceControlX:o,sourceControlY:l,targetControlX:u,targetControlY:d});return[`M${e},${n} C${o},${l} ${u},${d} ${i},${s}`,p,f,g,_]}function tF(e){return b.memo(({id:n,sourceX:r,sourceY:i,targetX:s,targetY:a,sourcePosition:o,targetPosition:l,label:u,labelStyle:d,labelShowBg:p,labelBgStyle:f,labelBgPadding:g,labelBgBorderRadius:_,style:x,markerEnd:v,markerStart:S,interactionWidth:w})=>{const[N,C,T]=eF({sourceX:r,sourceY:i,sourcePosition:o,targetX:s,targetY:a,targetPosition:l}),A=e.isInternal?void 0:n;return c.jsx(Rf,{id:A,path:N,labelX:C,labelY:T,label:u,labelStyle:d,labelShowBg:p,labelBgStyle:f,labelBgPadding:g,labelBgBorderRadius:_,style:x,markerEnd:v,markerStart:S,interactionWidth:w})})}const Pve=tF({isInternal:!1}),nF=tF({isInternal:!0});Pve.displayName="SimpleBezierEdge";nF.displayName="SimpleBezierEdgeInternal";function rF(e){return b.memo(({id:n,sourceX:r,sourceY:i,targetX:s,targetY:a,label:o,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:p,labelBgBorderRadius:f,style:g,sourcePosition:_=Ot.Bottom,targetPosition:x=Ot.Top,markerEnd:v,markerStart:S,pathOptions:w,interactionWidth:N})=>{const[C,T,A]=gj({sourceX:r,sourceY:i,sourcePosition:_,targetX:s,targetY:a,targetPosition:x,borderRadius:w==null?void 0:w.borderRadius,offset:w==null?void 0:w.offset,stepPosition:w==null?void 0:w.stepPosition}),E=e.isInternal?void 0:n;return c.jsx(Rf,{id:E,path:C,labelX:T,labelY:A,label:o,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:p,labelBgBorderRadius:f,style:g,markerEnd:v,markerStart:S,interactionWidth:N})})}const iF=rF({isInternal:!1}),sF=rF({isInternal:!0});iF.displayName="SmoothStepEdge";sF.displayName="SmoothStepEdgeInternal";function aF(e){return b.memo(({id:n,...r})=>{var s;const i=e.isInternal?void 0:n;return c.jsx(iF,{...r,id:i,pathOptions:b.useMemo(()=>{var a;return{borderRadius:0,offset:(a=r.pathOptions)==null?void 0:a.offset}},[(s=r.pathOptions)==null?void 0:s.offset])})})}const Lve=aF({isInternal:!1}),oF=aF({isInternal:!0});Lve.displayName="StepEdge";oF.displayName="StepEdgeInternal";function lF(e){return b.memo(({id:n,sourceX:r,sourceY:i,targetX:s,targetY:a,label:o,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:p,labelBgBorderRadius:f,style:g,markerEnd:_,markerStart:x,interactionWidth:v})=>{const[S,w,N]=C7({sourceX:r,sourceY:i,targetX:s,targetY:a}),C=e.isInternal?void 0:n;return c.jsx(Rf,{id:C,path:S,labelX:w,labelY:N,label:o,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:p,labelBgBorderRadius:f,style:g,markerEnd:_,markerStart:x,interactionWidth:v})})}const Ive=lF({isInternal:!1}),cF=lF({isInternal:!0});Ive.displayName="StraightEdge";cF.displayName="StraightEdgeInternal";function uF(e){return b.memo(({id:n,sourceX:r,sourceY:i,targetX:s,targetY:a,sourcePosition:o=Ot.Bottom,targetPosition:l=Ot.Top,label:u,labelStyle:d,labelShowBg:p,labelBgStyle:f,labelBgPadding:g,labelBgBorderRadius:_,style:x,markerEnd:v,markerStart:S,pathOptions:w,interactionWidth:N})=>{const[C,T,A]=yA({sourceX:r,sourceY:i,sourcePosition:o,targetX:s,targetY:a,targetPosition:l,curvature:w==null?void 0:w.curvature}),E=e.isInternal?void 0:n;return c.jsx(Rf,{id:E,path:C,labelX:T,labelY:A,label:u,labelStyle:d,labelShowBg:p,labelBgStyle:f,labelBgPadding:g,labelBgBorderRadius:_,style:x,markerEnd:v,markerStart:S,interactionWidth:N})})}const Bve=uF({isInternal:!1}),dF=uF({isInternal:!0});Bve.displayName="BezierEdge";dF.displayName="BezierEdgeInternal";const ZD={default:dF,straight:cF,step:oF,smoothstep:sF,simplebezier:nF},JD={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},zve=(e,n,r)=>r===Ot.Left?e-n:r===Ot.Right?e+n:e,$ve=(e,n,r)=>r===Ot.Top?e-n:r===Ot.Bottom?e+n:e,eP="react-flow__edgeupdater";function tP({position:e,centerX:n,centerY:r,radius:i=10,onMouseDown:s,onMouseEnter:a,onMouseOut:o,type:l}){return c.jsx("circle",{onMouseDown:s,onMouseEnter:a,onMouseOut:o,className:Xr([eP,`${eP}-${l}`]),cx:zve(n,i,e),cy:$ve(r,i,e),r:i,stroke:"transparent",fill:"transparent"})}function Fve({isReconnectable:e,reconnectRadius:n,edge:r,sourceX:i,sourceY:s,targetX:a,targetY:o,sourcePosition:l,targetPosition:u,onReconnect:d,onReconnectStart:p,onReconnectEnd:f,setReconnecting:g,setUpdateHover:_}){const x=dr(),v=(T,A)=>{if(T.button!==0)return;const{autoPanOnConnect:E,domNode:D,connectionMode:F,connectionRadius:B,lib:H,onConnectStart:$,cancelConnection:z,nodeLookup:W,rfId:P,panBy:q,updateConnection:I}=x.getState(),Q=A.type==="target",K=(R,U)=>{g(!1),f==null||f(R,r,A.type,U)},Z=R=>d==null?void 0:d(r,R),Y=(R,U)=>{g(!0),p==null||p(T,r,A.type),$==null||$(R,U)};_j.onPointerDown(T.nativeEvent,{autoPanOnConnect:E,connectionMode:F,connectionRadius:B,domNode:D,handleId:A.id,nodeId:A.nodeId,nodeLookup:W,isTarget:Q,edgeUpdaterType:A.type,lib:H,flowId:P,cancelConnection:z,panBy:q,isValidConnection:(...R)=>{var U,V;return((V=(U=x.getState()).isValidConnection)==null?void 0:V.call(U,...R))??!0},onConnect:Z,onConnectStart:Y,onConnectEnd:(...R)=>{var U,V;return(V=(U=x.getState()).onConnectEnd)==null?void 0:V.call(U,...R)},onReconnectEnd:K,updateConnection:I,getTransform:()=>x.getState().transform,getFromHandle:()=>x.getState().connection.fromHandle,dragThreshold:x.getState().connectionDragThreshold,handleDomNode:T.currentTarget})},S=T=>v(T,{nodeId:r.target,id:r.targetHandle??null,type:"target"}),w=T=>v(T,{nodeId:r.source,id:r.sourceHandle??null,type:"source"}),N=()=>_(!0),C=()=>_(!1);return c.jsxs(c.Fragment,{children:[(e===!0||e==="source")&&c.jsx(tP,{position:l,centerX:i,centerY:s,radius:n,onMouseDown:S,onMouseEnter:N,onMouseOut:C,type:"source"}),(e===!0||e==="target")&&c.jsx(tP,{position:u,centerX:a,centerY:o,radius:n,onMouseDown:w,onMouseEnter:N,onMouseOut:C,type:"target"})]})}function Hve({id:e,edgesFocusable:n,edgesReconnectable:r,elementsSelectable:i,onClick:s,onDoubleClick:a,onContextMenu:o,onMouseEnter:l,onMouseMove:u,onMouseLeave:d,reconnectRadius:p,onReconnect:f,onReconnectStart:g,onReconnectEnd:_,rfId:x,edgeTypes:v,noPanClassName:S,onError:w,disableKeyboardA11y:N}){let C=kn(pe=>pe.edgeLookup.get(e));const T=kn(pe=>pe.defaultEdgeOptions);C=T?{...T,...C}:C;let A=C.type||"default",E=(v==null?void 0:v[A])||ZD[A];E===void 0&&(w==null||w("011",Go.error011(A)),A="default",E=(v==null?void 0:v.default)||ZD.default);const D=!!(C.focusable||n&&typeof C.focusable>"u"),F=typeof f<"u"&&(C.reconnectable||r&&typeof C.reconnectable>"u"),B=!!(C.selectable||i&&typeof C.selectable>"u"),H=b.useRef(null),[$,z]=b.useState(!1),[W,P]=b.useState(!1),q=dr(),{zIndex:I,sourceX:Q,sourceY:K,targetX:Z,targetY:Y,sourcePosition:R,targetPosition:U}=kn(b.useCallback(pe=>{const J=pe.nodeLookup.get(C.source),me=pe.nodeLookup.get(C.target);if(!J||!me)return{zIndex:C.zIndex,...JD};const fe=Dme({id:e,sourceNode:J,targetNode:me,sourceHandle:C.sourceHandle||null,targetHandle:C.targetHandle||null,connectionMode:pe.connectionMode,onError:w});return{zIndex:jme({selected:C.selected,zIndex:C.zIndex,sourceNode:J,targetNode:me,elevateOnSelect:pe.elevateEdgesOnSelect,zIndexMode:pe.zIndexMode}),...fe||JD}},[C.source,C.target,C.sourceHandle,C.targetHandle,C.selected,C.zIndex]),kr),V=b.useMemo(()=>C.markerStart?`url('#${vj(C.markerStart,x)}')`:void 0,[C.markerStart,x]),ie=b.useMemo(()=>C.markerEnd?`url('#${vj(C.markerEnd,x)}')`:void 0,[C.markerEnd,x]);if(C.hidden||Q===null||K===null||Z===null||Y===null)return null;const te=pe=>{var ve;const{addSelectedEdges:J,unselectNodesAndEdges:me,multiSelectionActive:fe}=q.getState();B&&(q.setState({nodesSelectionActive:!1}),C.selected&&fe?(me({nodes:[],edges:[C]}),(ve=H.current)==null||ve.blur()):J([e])),s&&s(pe,C)},X=a?pe=>{a(pe,{...C})}:void 0,se=o?pe=>{o(pe,{...C})}:void 0,re=l?pe=>{l(pe,{...C})}:void 0,de=u?pe=>{u(pe,{...C})}:void 0,ue=d?pe=>{d(pe,{...C})}:void 0,ae=pe=>{var J;if(!N&&c7.includes(pe.key)&&B){const{unselectNodesAndEdges:me,addSelectedEdges:fe}=q.getState();pe.key==="Escape"?((J=H.current)==null||J.blur(),me({edges:[C]})):fe([e])}};return c.jsx("svg",{style:{zIndex:I},children:c.jsxs("g",{className:Xr(["react-flow__edge",`react-flow__edge-${A}`,C.className,S,{selected:C.selected,animated:C.animated,inactive:!B&&!s,updating:$,selectable:B}]),onClick:te,onDoubleClick:X,onContextMenu:se,onMouseEnter:re,onMouseMove:de,onMouseLeave:ue,onKeyDown:D?ae:void 0,tabIndex:D?0:void 0,role:C.ariaRole??(D?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":C.ariaLabel===null?void 0:C.ariaLabel||`Edge from ${C.source} to ${C.target}`,"aria-describedby":D?`${$7}-${x}`:void 0,ref:H,...C.domAttributes,children:[!W&&c.jsx(E,{id:e,source:C.source,target:C.target,type:C.type,selected:C.selected,animated:C.animated,selectable:B,deletable:C.deletable??!0,label:C.label,labelStyle:C.labelStyle,labelShowBg:C.labelShowBg,labelBgStyle:C.labelBgStyle,labelBgPadding:C.labelBgPadding,labelBgBorderRadius:C.labelBgBorderRadius,sourceX:Q,sourceY:K,targetX:Z,targetY:Y,sourcePosition:R,targetPosition:U,data:C.data,style:C.style,sourceHandleId:C.sourceHandle,targetHandleId:C.targetHandle,markerStart:V,markerEnd:ie,pathOptions:"pathOptions"in C?C.pathOptions:void 0,interactionWidth:C.interactionWidth}),F&&c.jsx(Fve,{edge:C,isReconnectable:F,reconnectRadius:p,onReconnect:f,onReconnectStart:g,onReconnectEnd:_,sourceX:Q,sourceY:K,targetX:Z,targetY:Y,sourcePosition:R,targetPosition:U,setUpdateHover:z,setReconnecting:P})]})})}var Wve=b.memo(Hve);const qve=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function hF({defaultMarkerColor:e,onlyRenderVisibleElements:n,rfId:r,edgeTypes:i,noPanClassName:s,onReconnect:a,onEdgeContextMenu:o,onEdgeMouseEnter:l,onEdgeMouseMove:u,onEdgeMouseLeave:d,onEdgeClick:p,reconnectRadius:f,onEdgeDoubleClick:g,onReconnectStart:_,onReconnectEnd:x,disableKeyboardA11y:v}){const{edgesFocusable:S,edgesReconnectable:w,elementsSelectable:N,onError:C}=kn(qve,kr),T=Eve(n);return c.jsxs("div",{className:"react-flow__edges",children:[c.jsx(Ove,{defaultColor:e,rfId:r}),T.map(A=>c.jsx(Wve,{id:A,edgesFocusable:S,edgesReconnectable:w,elementsSelectable:N,noPanClassName:s,onReconnect:a,onContextMenu:o,onMouseEnter:l,onMouseMove:u,onMouseLeave:d,onClick:p,reconnectRadius:f,onDoubleClick:g,onReconnectStart:_,onReconnectEnd:x,rfId:r,onError:C,edgeTypes:i,disableKeyboardA11y:v},A))]})}hF.displayName="EdgeRenderer";const Uve=b.memo(hF),Vve=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function Kve({children:e}){const n=kn(Vve);return c.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:n},children:e})}function Yve(e){const n=A0(),r=b.useRef(!1);b.useEffect(()=>{!r.current&&n.viewportInitialized&&e&&(setTimeout(()=>e(n),1),r.current=!0)},[e,n.viewportInitialized])}const Gve=e=>{var n;return(n=e.panZoom)==null?void 0:n.syncViewport};function Xve(e){const n=kn(Gve),r=dr();return b.useEffect(()=>{e&&(n==null||n(e),r.setState({transform:[e.x,e.y,e.zoom]}))},[e,n]),null}function Qve(e){return e.connection.inProgress?{...e.connection,to:Sv(e.connection.to,e.transform)}:{...e.connection}}function Zve(e){return Qve}function Jve(e){const n=Zve();return kn(n,kr)}const eye=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function tye({containerStyle:e,style:n,type:r,component:i}){const{nodesConnectable:s,width:a,height:o,isValid:l,inProgress:u}=kn(eye,kr);return!(a&&s&&u)?null:c.jsx("svg",{style:e,width:a,height:o,className:"react-flow__connectionline react-flow__container",children:c.jsx("g",{className:Xr(["react-flow__connection",h7(l)]),children:c.jsx(fF,{style:n,type:r,CustomComponent:i,isValid:l})})})}const fF=({style:e,type:n=Ha.Bezier,CustomComponent:r,isValid:i})=>{const{inProgress:s,from:a,fromNode:o,fromHandle:l,fromPosition:u,to:d,toNode:p,toHandle:f,toPosition:g,pointer:_}=Jve();if(!s)return;if(r)return c.jsx(r,{connectionLineType:n,connectionLineStyle:e,fromNode:o,fromHandle:l,fromX:a.x,fromY:a.y,toX:d.x,toY:d.y,fromPosition:u,toPosition:g,connectionStatus:h7(i),toNode:p,toHandle:f,pointer:_});let x="";const v={sourceX:a.x,sourceY:a.y,sourcePosition:u,targetX:d.x,targetY:d.y,targetPosition:g};switch(n){case Ha.Bezier:[x]=yA(v);break;case Ha.SimpleBezier:[x]=eF(v);break;case Ha.Step:[x]=gj({...v,borderRadius:0});break;case Ha.SmoothStep:[x]=gj(v);break;default:[x]=C7(v)}return c.jsx("path",{d:x,fill:"none",className:"react-flow__connection-path",style:e})};fF.displayName="ConnectionLine";const nye={};function nP(e=nye){b.useRef(e),dr(),b.useEffect(()=>{},[e])}function rye(){dr(),b.useRef(!1),b.useEffect(()=>{},[])}function pF({nodeTypes:e,edgeTypes:n,onInit:r,onNodeClick:i,onEdgeClick:s,onNodeDoubleClick:a,onEdgeDoubleClick:o,onNodeMouseEnter:l,onNodeMouseMove:u,onNodeMouseLeave:d,onNodeContextMenu:p,onSelectionContextMenu:f,onSelectionStart:g,onSelectionEnd:_,connectionLineType:x,connectionLineStyle:v,connectionLineComponent:S,connectionLineContainerStyle:w,selectionKeyCode:N,selectionOnDrag:C,selectionMode:T,multiSelectionKeyCode:A,panActivationKeyCode:E,zoomActivationKeyCode:D,deleteKeyCode:F,onlyRenderVisibleElements:B,elementsSelectable:H,defaultViewport:$,translateExtent:z,minZoom:W,maxZoom:P,preventScrolling:q,defaultMarkerColor:I,zoomOnScroll:Q,zoomOnPinch:K,panOnScroll:Z,panOnScrollSpeed:Y,panOnScrollMode:R,zoomOnDoubleClick:U,panOnDrag:V,onPaneClick:ie,onPaneMouseEnter:te,onPaneMouseMove:X,onPaneMouseLeave:se,onPaneScroll:re,onPaneContextMenu:de,paneClickDistance:ue,nodeClickDistance:ae,onEdgeContextMenu:pe,onEdgeMouseEnter:J,onEdgeMouseMove:me,onEdgeMouseLeave:fe,reconnectRadius:ve,onReconnect:Ke,onReconnectStart:ge,onReconnectEnd:Ue,noDragClassName:$e,noWheelClassName:Bt,noPanClassName:ct,disableKeyboardA11y:Mt,nodeExtent:Tt,rfId:Dt,viewport:Re,onViewportChange:et}){return nP(e),nP(n),rye(),Yve(r),Xve(Re),c.jsx(yve,{onPaneClick:ie,onPaneMouseEnter:te,onPaneMouseMove:X,onPaneMouseLeave:se,onPaneContextMenu:de,onPaneScroll:re,paneClickDistance:ue,deleteKeyCode:F,selectionKeyCode:N,selectionOnDrag:C,selectionMode:T,onSelectionStart:g,onSelectionEnd:_,multiSelectionKeyCode:A,panActivationKeyCode:E,zoomActivationKeyCode:D,elementsSelectable:H,zoomOnScroll:Q,zoomOnPinch:K,zoomOnDoubleClick:U,panOnScroll:Z,panOnScrollSpeed:Y,panOnScrollMode:R,panOnDrag:V,defaultViewport:$,translateExtent:z,minZoom:W,maxZoom:P,onSelectionContextMenu:f,preventScrolling:q,noDragClassName:$e,noWheelClassName:Bt,noPanClassName:ct,disableKeyboardA11y:Mt,onViewportChange:et,isControlledViewport:!!Re,children:c.jsxs(Kve,{children:[c.jsx(Uve,{edgeTypes:n,onEdgeClick:s,onEdgeDoubleClick:o,onReconnect:Ke,onReconnectStart:ge,onReconnectEnd:Ue,onlyRenderVisibleElements:B,onEdgeContextMenu:pe,onEdgeMouseEnter:J,onEdgeMouseMove:me,onEdgeMouseLeave:fe,reconnectRadius:ve,defaultMarkerColor:I,noPanClassName:ct,disableKeyboardA11y:Mt,rfId:Dt}),c.jsx(tye,{style:v,type:x,component:S,containerStyle:w}),c.jsx("div",{className:"react-flow__edgelabel-renderer"}),c.jsx(Nve,{nodeTypes:e,onNodeClick:i,onNodeDoubleClick:a,onNodeMouseEnter:l,onNodeMouseMove:u,onNodeMouseLeave:d,onNodeContextMenu:p,nodeClickDistance:ae,onlyRenderVisibleElements:B,noPanClassName:ct,noDragClassName:$e,disableKeyboardA11y:Mt,nodeExtent:Tt,rfId:Dt}),c.jsx("div",{className:"react-flow__viewport-portal"})]})})}pF.displayName="GraphView";const iye=b.memo(pF),rP=({nodes:e,edges:n,defaultNodes:r,defaultEdges:i,width:s,height:a,fitView:o,fitViewOptions:l,minZoom:u=.5,maxZoom:d=2,nodeOrigin:p,nodeExtent:f,zIndexMode:g="basic"}={})=>{const _=new Map,x=new Map,v=new Map,S=new Map,w=i??n??[],N=r??e??[],C=p??[0,0],T=f??Sg;E7(v,S,w);const{nodesInitialized:A}=yj(N,_,x,{nodeOrigin:C,nodeExtent:T,zIndexMode:g});let E=[0,0,1];if(o&&s&&a){const D=kv(_,{filter:$=>!!(($.width||$.initialWidth)&&($.height||$.initialHeight))}),{x:F,y:B,zoom:H}=gA(D,s,a,u,d,(l==null?void 0:l.padding)??.1);E=[F,B,H]}return{rfId:"1",width:s??0,height:a??0,transform:E,nodes:N,nodesInitialized:A,nodeLookup:_,parentLookup:x,edges:w,edgeLookup:S,connectionLookup:v,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:r!==void 0,hasDefaultEdges:i!==void 0,panZoom:null,minZoom:u,maxZoom:d,translateExtent:Sg,nodeExtent:T,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:Nf.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:C,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:o??!1,fitViewOptions:l,fitViewResolver:null,connection:{...d7},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:xme,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:u7,zIndexMode:g,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},sye=({nodes:e,edges:n,defaultNodes:r,defaultEdges:i,width:s,height:a,fitView:o,fitViewOptions:l,minZoom:u,maxZoom:d,nodeOrigin:p,nodeExtent:f,zIndexMode:g})=>Sge((_,x)=>{async function v(){const{nodeLookup:S,panZoom:w,fitViewOptions:N,fitViewResolver:C,width:T,height:A,minZoom:E,maxZoom:D}=x();w&&(await yme({nodes:S,width:T,height:A,panZoom:w,minZoom:E,maxZoom:D},N),C==null||C.resolve(!0),_({fitViewResolver:null}))}return{...rP({nodes:e,edges:n,width:s,height:a,fitView:o,fitViewOptions:l,minZoom:u,maxZoom:d,nodeOrigin:p,nodeExtent:f,defaultNodes:r,defaultEdges:i,zIndexMode:g}),setNodes:S=>{const{nodeLookup:w,parentLookup:N,nodeOrigin:C,elevateNodesOnSelect:T,fitViewQueued:A,zIndexMode:E,nodesSelectionActive:D}=x(),{nodesInitialized:F,hasSelectedNodes:B}=yj(S,w,N,{nodeOrigin:C,nodeExtent:f,elevateNodesOnSelect:T,checkEquality:!0,zIndexMode:E}),H=D&&B;A&&F?(v(),_({nodes:S,nodesInitialized:F,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:H})):_({nodes:S,nodesInitialized:F,nodesSelectionActive:H})},setEdges:S=>{const{connectionLookup:w,edgeLookup:N}=x();E7(w,N,S),_({edges:S})},setDefaultNodesAndEdges:(S,w)=>{if(S){const{setNodes:N}=x();N(S),_({hasDefaultNodes:!0})}if(w){const{setEdges:N}=x();N(w),_({hasDefaultEdges:!0})}},updateNodeInternals:S=>{const{triggerNodeChanges:w,nodeLookup:N,parentLookup:C,domNode:T,nodeOrigin:A,nodeExtent:E,debug:D,fitViewQueued:F,zIndexMode:B}=x(),{changes:H,updatedInternals:$}=Hme(S,N,C,T,A,E,B);$&&(Bme(N,C,{nodeOrigin:A,nodeExtent:E,zIndexMode:B}),F?(v(),_({fitViewQueued:!1,fitViewOptions:void 0})):_({}),(H==null?void 0:H.length)>0&&(D&&console.log("React Flow: trigger node changes",H),w==null||w(H)))},updateNodePositions:(S,w=!1)=>{const N=[];let C=[];const{nodeLookup:T,triggerNodeChanges:A,connection:E,updateConnection:D,onNodesChangeMiddlewareMap:F}=x();for(const[B,H]of S){const $=T.get(B),z=!!($!=null&&$.expandParent&&($!=null&&$.parentId)&&(H!=null&&H.position)),W={id:B,type:"position",position:z?{x:Math.max(0,H.position.x),y:Math.max(0,H.position.y)}:H.position,dragging:w};if($&&E.inProgress&&E.fromNode.id===$.id){const P=Nd($,E.fromHandle,Ot.Left,!0);D({...E,from:P})}z&&$.parentId&&N.push({id:B,parentId:$.parentId,rect:{...H.internals.positionAbsolute,width:H.measured.width??0,height:H.measured.height??0}}),C.push(W)}if(N.length>0){const{parentLookup:B,nodeOrigin:H}=x(),$=wA(N,T,B,H);C.push(...$)}for(const B of F.values())C=B(C);A(C)},triggerNodeChanges:S=>{const{onNodesChange:w,setNodes:N,nodes:C,hasDefaultNodes:T,debug:A}=x();if(S!=null&&S.length){if(T){const E=W7(S,C);N(E)}A&&console.log("React Flow: trigger node changes",S),w==null||w(S)}},triggerEdgeChanges:S=>{const{onEdgesChange:w,setEdges:N,edges:C,hasDefaultEdges:T,debug:A}=x();if(S!=null&&S.length){if(T){const E=q7(S,C);N(E)}A&&console.log("React Flow: trigger edge changes",S),w==null||w(S)}},addSelectedNodes:S=>{const{multiSelectionActive:w,edgeLookup:N,nodeLookup:C,triggerNodeChanges:T,triggerEdgeChanges:A}=x();if(w){const E=S.map(D=>Xu(D,!0));T(E);return}T(Xh(C,new Set([...S]),!0)),A(Xh(N))},addSelectedEdges:S=>{const{multiSelectionActive:w,edgeLookup:N,nodeLookup:C,triggerNodeChanges:T,triggerEdgeChanges:A}=x();if(w){const E=S.map(D=>Xu(D,!0));A(E);return}A(Xh(N,new Set([...S]))),T(Xh(C,new Set,!0))},unselectNodesAndEdges:({nodes:S,edges:w}={})=>{const{edges:N,nodes:C,nodeLookup:T,triggerNodeChanges:A,triggerEdgeChanges:E}=x(),D=S||C,F=w||N,B=[];for(const $ of D){if(!$.selected)continue;const z=T.get($.id);z&&(z.selected=!1),B.push(Xu($.id,!1))}const H=[];for(const $ of F)$.selected&&H.push(Xu($.id,!1));A(B),E(H)},setMinZoom:S=>{const{panZoom:w,maxZoom:N}=x();w==null||w.setScaleExtent([S,N]),_({minZoom:S})},setMaxZoom:S=>{const{panZoom:w,minZoom:N}=x();w==null||w.setScaleExtent([N,S]),_({maxZoom:S})},setTranslateExtent:S=>{var w;(w=x().panZoom)==null||w.setTranslateExtent(S),_({translateExtent:S})},resetSelectedElements:()=>{const{edges:S,nodes:w,triggerNodeChanges:N,triggerEdgeChanges:C,elementsSelectable:T}=x();if(!T)return;const A=w.reduce((D,F)=>F.selected?[...D,Xu(F.id,!1)]:D,[]),E=S.reduce((D,F)=>F.selected?[...D,Xu(F.id,!1)]:D,[]);N(A),C(E)},setNodeExtent:S=>{const{nodes:w,nodeLookup:N,parentLookup:C,nodeOrigin:T,elevateNodesOnSelect:A,nodeExtent:E,zIndexMode:D}=x();S[0][0]===E[0][0]&&S[0][1]===E[0][1]&&S[1][0]===E[1][0]&&S[1][1]===E[1][1]||(yj(w,N,C,{nodeOrigin:T,nodeExtent:S,elevateNodesOnSelect:A,checkEquality:!1,zIndexMode:D}),_({nodeExtent:S}))},panBy:S=>{const{transform:w,width:N,height:C,panZoom:T,translateExtent:A}=x();return Wme({delta:S,panZoom:T,transform:w,translateExtent:A,width:N,height:C})},setCenter:async(S,w,N)=>{const{width:C,height:T,maxZoom:A,panZoom:E}=x();if(!E)return Promise.resolve(!1);const D=typeof(N==null?void 0:N.zoom)<"u"?N.zoom:A;return await E.setViewport({x:C/2-S*D,y:T/2-w*D,zoom:D},{duration:N==null?void 0:N.duration,ease:N==null?void 0:N.ease,interpolate:N==null?void 0:N.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{_({connection:{...d7}})},updateConnection:S=>{_({connection:S})},reset:()=>_({...rP()})}},Object.is);function CA({initialNodes:e,initialEdges:n,defaultNodes:r,defaultEdges:i,initialWidth:s,initialHeight:a,initialMinZoom:o,initialMaxZoom:l,initialFitViewOptions:u,fitView:d,nodeOrigin:p,nodeExtent:f,zIndexMode:g,children:_}){const[x]=b.useState(()=>sye({nodes:e,edges:n,defaultNodes:r,defaultEdges:i,width:s,height:a,fitView:d,minZoom:o,maxZoom:l,fitViewOptions:u,nodeOrigin:p,nodeExtent:f,zIndexMode:g}));return c.jsx(Cge,{value:x,children:c.jsx(Kge,{children:_})})}function aye({children:e,nodes:n,edges:r,defaultNodes:i,defaultEdges:s,width:a,height:o,fitView:l,fitViewOptions:u,minZoom:d,maxZoom:p,nodeOrigin:f,nodeExtent:g,zIndexMode:_}){return b.useContext(N0)?c.jsx(c.Fragment,{children:e}):c.jsx(CA,{initialNodes:n,initialEdges:r,defaultNodes:i,defaultEdges:s,initialWidth:a,initialHeight:o,fitView:l,initialFitViewOptions:u,initialMinZoom:d,initialMaxZoom:p,nodeOrigin:f,nodeExtent:g,zIndexMode:_,children:e})}const oye={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function lye({nodes:e,edges:n,defaultNodes:r,defaultEdges:i,className:s,nodeTypes:a,edgeTypes:o,onNodeClick:l,onEdgeClick:u,onInit:d,onMove:p,onMoveStart:f,onMoveEnd:g,onConnect:_,onConnectStart:x,onConnectEnd:v,onClickConnectStart:S,onClickConnectEnd:w,onNodeMouseEnter:N,onNodeMouseMove:C,onNodeMouseLeave:T,onNodeContextMenu:A,onNodeDoubleClick:E,onNodeDragStart:D,onNodeDrag:F,onNodeDragStop:B,onNodesDelete:H,onEdgesDelete:$,onDelete:z,onSelectionChange:W,onSelectionDragStart:P,onSelectionDrag:q,onSelectionDragStop:I,onSelectionContextMenu:Q,onSelectionStart:K,onSelectionEnd:Z,onBeforeDelete:Y,connectionMode:R,connectionLineType:U=Ha.Bezier,connectionLineStyle:V,connectionLineComponent:ie,connectionLineContainerStyle:te,deleteKeyCode:X="Backspace",selectionKeyCode:se="Shift",selectionOnDrag:re=!1,selectionMode:de=Cg.Full,panActivationKeyCode:ue="Space",multiSelectionKeyCode:ae=Ng()?"Meta":"Control",zoomActivationKeyCode:pe=Ng()?"Meta":"Control",snapToGrid:J,snapGrid:me,onlyRenderVisibleElements:fe=!1,selectNodesOnDrag:ve,nodesDraggable:Ke,autoPanOnNodeFocus:ge,nodesConnectable:Ue,nodesFocusable:$e,nodeOrigin:Bt=F7,edgesFocusable:ct,edgesReconnectable:Mt,elementsSelectable:Tt=!0,defaultViewport:Dt=Bge,minZoom:Re=.5,maxZoom:et=2,translateExtent:bt=Sg,preventScrolling:yt=!0,nodeExtent:O,defaultMarkerColor:ke="#b1b1b7",zoomOnScroll:Le=!0,zoomOnPinch:ye=!0,panOnScroll:_e=!1,panOnScrollSpeed:Pe=.5,panOnScrollMode:ee=md.Free,zoomOnDoubleClick:le=!0,panOnDrag:je=!0,onPaneClick:Te,onPaneMouseEnter:Me,onPaneMouseMove:Ne,onPaneMouseLeave:Ee,onPaneScroll:rt,onPaneContextMenu:Ye,paneClickDistance:it=1,nodeClickDistance:kt=0,children:mt,onReconnect:zt,onReconnectStart:xe,onReconnectEnd:qe,onEdgeContextMenu:dt,onEdgeDoubleClick:sn,onEdgeMouseEnter:nn,onEdgeMouseMove:Kt,onEdgeMouseLeave:rr,reconnectRadius:yi=10,onNodesChange:un,onEdgesChange:Yt,noDragClassName:L="nodrag",noWheelClassName:Qe="nowheel",noPanClassName:_t="nopan",fitView:Gt,fitViewOptions:jr,connectOnClick:Qr,attributionPosition:oo,proOptions:cs,defaultEdgeOptions:rl,elevateNodesOnSelect:us=!0,elevateEdgesOnSelect:Ri=!1,disableKeyboardA11y:Ki=!1,autoPanOnConnect:Fr,autoPanOnNodeDrag:Kn,autoPanSpeed:il,connectionRadius:tc,isValidConnection:Rs,onError:ra,style:_u,id:sl,nodeDragThreshold:Os,connectionDragThreshold:al,viewport:hr,onViewportChange:Ds,width:Zr,height:ai,colorMode:lo="light",debug:xu,onScroll:_i,ariaLabelConfig:co,zIndexMode:ce="basic",...Be},xt){const Ft=sl||"1",Yn=Hge(lo),Oi=b.useCallback(Di=>{Di.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),_i==null||_i(Di)},[_i]);return c.jsx("div",{"data-testid":"rf__wrapper",...Be,onScroll:Oi,style:{..._u,...oye},ref:xt,className:Xr(["react-flow",s,Yn]),id:sl,role:"application",children:c.jsxs(aye,{nodes:e,edges:n,width:Zr,height:ai,fitView:Gt,fitViewOptions:jr,minZoom:Re,maxZoom:et,nodeOrigin:Bt,nodeExtent:O,zIndexMode:ce,children:[c.jsx(Fge,{nodes:e,edges:n,defaultNodes:r,defaultEdges:i,onConnect:_,onConnectStart:x,onConnectEnd:v,onClickConnectStart:S,onClickConnectEnd:w,nodesDraggable:Ke,autoPanOnNodeFocus:ge,nodesConnectable:Ue,nodesFocusable:$e,edgesFocusable:ct,edgesReconnectable:Mt,elementsSelectable:Tt,elevateNodesOnSelect:us,elevateEdgesOnSelect:Ri,minZoom:Re,maxZoom:et,nodeExtent:O,onNodesChange:un,onEdgesChange:Yt,snapToGrid:J,snapGrid:me,connectionMode:R,translateExtent:bt,connectOnClick:Qr,defaultEdgeOptions:rl,fitView:Gt,fitViewOptions:jr,onNodesDelete:H,onEdgesDelete:$,onDelete:z,onNodeDragStart:D,onNodeDrag:F,onNodeDragStop:B,onSelectionDrag:q,onSelectionDragStart:P,onSelectionDragStop:I,onMove:p,onMoveStart:f,onMoveEnd:g,noPanClassName:_t,nodeOrigin:Bt,rfId:Ft,autoPanOnConnect:Fr,autoPanOnNodeDrag:Kn,autoPanSpeed:il,onError:ra,connectionRadius:tc,isValidConnection:Rs,selectNodesOnDrag:ve,nodeDragThreshold:Os,connectionDragThreshold:al,onBeforeDelete:Y,debug:xu,ariaLabelConfig:co,zIndexMode:ce}),c.jsx(iye,{onInit:d,onNodeClick:l,onEdgeClick:u,onNodeMouseEnter:N,onNodeMouseMove:C,onNodeMouseLeave:T,onNodeContextMenu:A,onNodeDoubleClick:E,nodeTypes:a,edgeTypes:o,connectionLineType:U,connectionLineStyle:V,connectionLineComponent:ie,connectionLineContainerStyle:te,selectionKeyCode:se,selectionOnDrag:re,selectionMode:de,deleteKeyCode:X,multiSelectionKeyCode:ae,panActivationKeyCode:ue,zoomActivationKeyCode:pe,onlyRenderVisibleElements:fe,defaultViewport:Dt,translateExtent:bt,minZoom:Re,maxZoom:et,preventScrolling:yt,zoomOnScroll:Le,zoomOnPinch:ye,zoomOnDoubleClick:le,panOnScroll:_e,panOnScrollSpeed:Pe,panOnScrollMode:ee,panOnDrag:je,onPaneClick:Te,onPaneMouseEnter:Me,onPaneMouseMove:Ne,onPaneMouseLeave:Ee,onPaneScroll:rt,onPaneContextMenu:Ye,paneClickDistance:it,nodeClickDistance:kt,onSelectionContextMenu:Q,onSelectionStart:K,onSelectionEnd:Z,onReconnect:zt,onReconnectStart:xe,onReconnectEnd:qe,onEdgeContextMenu:dt,onEdgeDoubleClick:sn,onEdgeMouseEnter:nn,onEdgeMouseMove:Kt,onEdgeMouseLeave:rr,reconnectRadius:yi,defaultMarkerColor:ke,noDragClassName:L,noWheelClassName:Qe,noPanClassName:_t,rfId:Ft,disableKeyboardA11y:Ki,nodeExtent:O,viewport:hr,onViewportChange:Ds}),c.jsx(Ige,{onSelectionChange:W}),mt,c.jsx(Rge,{proOptions:cs,position:oo}),c.jsx(Mge,{rfId:Ft,disableKeyboardA11y:Ki})]})})}var mF=U7(lye);const cye=e=>{var n;return(n=e.domNode)==null?void 0:n.querySelector(".react-flow__edgelabel-renderer")};function uye({children:e}){const n=kn(cye);return n?na.createPortal(e,n):null}function dye(){const e=dr();return b.useCallback(n=>{const{domNode:r,updateNodeInternals:i}=e.getState(),s=Array.isArray(n)?n:[n],a=new Map;s.forEach(o=>{const l=r==null?void 0:r.querySelector(`.react-flow__node[data-id="${o}"]`);l&&a.set(o,{id:o,nodeElement:l,force:!0})}),requestAnimationFrame(()=>i(a,{triggerFitView:!1}))},[])}function hye(e){const[n,r]=b.useState(e),i=b.useCallback(s=>r(a=>W7(s,a)),[]);return[n,r,i]}function fye(e){const[n,r]=b.useState(e),i=b.useCallback(s=>r(a=>q7(s,a)),[]);return[n,r,i]}function pye({dimensions:e,lineWidth:n,variant:r,className:i}){return c.jsx("path",{strokeWidth:n,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:Xr(["react-flow__background-pattern",r,i])})}function mye({radius:e,className:n}){return c.jsx("circle",{cx:e,cy:e,r:e,className:Xr(["react-flow__background-pattern","dots",n])})}var Jc;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Jc||(Jc={}));const gye={[Jc.Dots]:1,[Jc.Lines]:1,[Jc.Cross]:6},vye=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function gF({id:e,variant:n=Jc.Dots,gap:r=20,size:i,lineWidth:s=1,offset:a=0,color:o,bgColor:l,style:u,className:d,patternClassName:p}){const f=b.useRef(null),{transform:g,patternId:_}=kn(vye,kr),x=i||gye[n],v=n===Jc.Dots,S=n===Jc.Cross,w=Array.isArray(r)?r:[r,r],N=[w[0]*g[2]||1,w[1]*g[2]||1],C=x*g[2],T=Array.isArray(a)?a:[a,a],A=S?[C,C]:N,E=[T[0]*g[2]||1+A[0]/2,T[1]*g[2]||1+A[1]/2],D=`${_}${e||""}`;return c.jsxs("svg",{className:Xr(["react-flow__background",d]),style:{...u,...T0,"--xy-background-color-props":l,"--xy-background-pattern-color-props":o},ref:f,"data-testid":"rf__background",children:[c.jsx("pattern",{id:D,x:g[0]%N[0],y:g[1]%N[1],width:N[0],height:N[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${E[0]},-${E[1]})`,children:v?c.jsx(mye,{radius:C/2,className:p}):c.jsx(pye,{dimensions:A,lineWidth:s,variant:n,className:p})}),c.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${D})`})]})}gF.displayName="Background";const vF=b.memo(gF);function yye(){return c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:c.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function _ye(){return c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:c.jsx("path",{d:"M0 0h32v4.2H0z"})})}function xye(){return c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:c.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 bye(){return c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:c.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 kye(){return c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:c.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 l_({children:e,className:n,...r}){return c.jsx("button",{type:"button",className:Xr(["react-flow__controls-button",n]),...r,children:e})}const wye=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function yF({style:e,showZoom:n=!0,showFitView:r=!0,showInteractive:i=!0,fitViewOptions:s,onZoomIn:a,onZoomOut:o,onFitView:l,onInteractiveChange:u,className:d,children:p,position:f="bottom-left",orientation:g="vertical","aria-label":_}){const x=dr(),{isInteractive:v,minZoomReached:S,maxZoomReached:w,ariaLabelConfig:N}=kn(wye,kr),{zoomIn:C,zoomOut:T,fitView:A}=A0(),E=()=>{C(),a==null||a()},D=()=>{T(),o==null||o()},F=()=>{A(s),l==null||l()},B=()=>{x.setState({nodesDraggable:!v,nodesConnectable:!v,elementsSelectable:!v}),u==null||u(!v)},H=g==="horizontal"?"horizontal":"vertical";return c.jsxs(E0,{className:Xr(["react-flow__controls",H,d]),position:f,style:e,"data-testid":"rf__controls","aria-label":_??N["controls.ariaLabel"],children:[n&&c.jsxs(c.Fragment,{children:[c.jsx(l_,{onClick:E,className:"react-flow__controls-zoomin",title:N["controls.zoomIn.ariaLabel"],"aria-label":N["controls.zoomIn.ariaLabel"],disabled:w,children:c.jsx(yye,{})}),c.jsx(l_,{onClick:D,className:"react-flow__controls-zoomout",title:N["controls.zoomOut.ariaLabel"],"aria-label":N["controls.zoomOut.ariaLabel"],disabled:S,children:c.jsx(_ye,{})})]}),r&&c.jsx(l_,{className:"react-flow__controls-fitview",onClick:F,title:N["controls.fitView.ariaLabel"],"aria-label":N["controls.fitView.ariaLabel"],children:c.jsx(xye,{})}),i&&c.jsx(l_,{className:"react-flow__controls-interactive",onClick:B,title:N["controls.interactive.ariaLabel"],"aria-label":N["controls.interactive.ariaLabel"],children:v?c.jsx(kye,{}):c.jsx(bye,{})}),p]})}yF.displayName="Controls";const _F=b.memo(yF);function Sye({id:e,x:n,y:r,width:i,height:s,style:a,color:o,strokeColor:l,strokeWidth:u,className:d,borderRadius:p,shapeRendering:f,selected:g,onClick:_}){const{background:x,backgroundColor:v}=a||{},S=o||x||v;return c.jsx("rect",{className:Xr(["react-flow__minimap-node",{selected:g},d]),x:n,y:r,rx:p,ry:p,width:i,height:s,style:{fill:S,stroke:l,strokeWidth:u},shapeRendering:f,onClick:_?w=>_(w,e):void 0})}const Cye=b.memo(Sye),jye=e=>e.nodes.map(n=>n.id),hS=e=>e instanceof Function?e:()=>e;function Nye({nodeStrokeColor:e,nodeColor:n,nodeClassName:r="",nodeBorderRadius:i=5,nodeStrokeWidth:s,nodeComponent:a=Cye,onClick:o}){const l=kn(jye,kr),u=hS(n),d=hS(e),p=hS(r),f=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return c.jsx(c.Fragment,{children:l.map(g=>c.jsx(Aye,{id:g,nodeColorFunc:u,nodeStrokeColorFunc:d,nodeClassNameFunc:p,nodeBorderRadius:i,nodeStrokeWidth:s,NodeComponent:a,onClick:o,shapeRendering:f},g))})}function Eye({id:e,nodeColorFunc:n,nodeStrokeColorFunc:r,nodeClassNameFunc:i,nodeBorderRadius:s,nodeStrokeWidth:a,shapeRendering:o,NodeComponent:l,onClick:u}){const{node:d,x:p,y:f,width:g,height:_}=kn(x=>{const v=x.nodeLookup.get(e);if(!v)return{node:void 0,x:0,y:0,width:0,height:0};const S=v.internals.userNode,{x:w,y:N}=v.internals.positionAbsolute,{width:C,height:T}=ec(S);return{node:S,x:w,y:N,width:C,height:T}},kr);return!d||d.hidden||!y7(d)?null:c.jsx(l,{x:p,y:f,width:g,height:_,style:d.style,selected:!!d.selected,className:i(d),color:n(d),borderRadius:s,strokeColor:r(d),strokeWidth:a,shapeRendering:o,onClick:u,id:d.id})}const Aye=b.memo(Eye);var Tye=b.memo(Nye);const Mye=200,Rye=150,Oye=e=>!e.hidden,Dye=e=>{const n={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:n,boundingRect:e.nodeLookup.size>0?v7(kv(e.nodeLookup,{filter:Oye}),n):n,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},Pye="react-flow__minimap-desc";function xF({style:e,className:n,nodeStrokeColor:r,nodeColor:i,nodeClassName:s="",nodeBorderRadius:a=5,nodeStrokeWidth:o,nodeComponent:l,bgColor:u,maskColor:d,maskStrokeColor:p,maskStrokeWidth:f,position:g="bottom-right",onClick:_,onNodeClick:x,pannable:v=!1,zoomable:S=!1,ariaLabel:w,inversePan:N,zoomStep:C=1,offsetScale:T=5}){const A=dr(),E=b.useRef(null),{boundingRect:D,viewBB:F,rfId:B,panZoom:H,translateExtent:$,flowWidth:z,flowHeight:W,ariaLabelConfig:P}=kn(Dye,kr),q=(e==null?void 0:e.width)??Mye,I=(e==null?void 0:e.height)??Rye,Q=D.width/q,K=D.height/I,Z=Math.max(Q,K),Y=Z*q,R=Z*I,U=T*Z,V=D.x-(Y-D.width)/2-U,ie=D.y-(R-D.height)/2-U,te=Y+U*2,X=R+U*2,se=`${Pye}-${B}`,re=b.useRef(0),de=b.useRef();re.current=Z,b.useEffect(()=>{if(E.current&&H)return de.current=Zme({domNode:E.current,panZoom:H,getTransform:()=>A.getState().transform,getViewScale:()=>re.current}),()=>{var J;(J=de.current)==null||J.destroy()}},[H]),b.useEffect(()=>{var J;(J=de.current)==null||J.update({translateExtent:$,width:z,height:W,inversePan:N,pannable:v,zoomStep:C,zoomable:S})},[v,S,N,C,$,z,W]);const ue=_?J=>{var ve;const[me,fe]=((ve=de.current)==null?void 0:ve.pointer(J))||[0,0];_(J,{x:me,y:fe})}:void 0,ae=x?b.useCallback((J,me)=>{const fe=A.getState().nodeLookup.get(me).internals.userNode;x(J,fe)},[]):void 0,pe=w??P["minimap.ariaLabel"];return c.jsx(E0,{position:g,style:{...e,"--xy-minimap-background-color-props":typeof u=="string"?u:void 0,"--xy-minimap-mask-background-color-props":typeof d=="string"?d:void 0,"--xy-minimap-mask-stroke-color-props":typeof p=="string"?p:void 0,"--xy-minimap-mask-stroke-width-props":typeof f=="number"?f*Z:void 0,"--xy-minimap-node-background-color-props":typeof i=="string"?i:void 0,"--xy-minimap-node-stroke-color-props":typeof r=="string"?r:void 0,"--xy-minimap-node-stroke-width-props":typeof o=="number"?o:void 0},className:Xr(["react-flow__minimap",n]),"data-testid":"rf__minimap",children:c.jsxs("svg",{width:q,height:I,viewBox:`${V} ${ie} ${te} ${X}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":se,ref:E,onClick:ue,children:[pe&&c.jsx("title",{id:se,children:pe}),c.jsx(Tye,{onClick:ae,nodeColor:i,nodeStrokeColor:r,nodeBorderRadius:a,nodeClassName:s,nodeStrokeWidth:o,nodeComponent:l}),c.jsx("path",{className:"react-flow__minimap-mask",d:`M${V-U},${ie-U}h${te+U*2}v${X+U*2}h${-te-U*2}z
        M${F.x},${F.y}h${F.width}v${F.height}h${-F.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}xF.displayName="MiniMap";const bF=b.memo(xF),Lye=e=>n=>e?`${Math.max(1/n.transform[2],1)}`:void 0,Iye={[Mf.Line]:"right",[Mf.Handle]:"bottom-right"};function Bye({nodeId:e,position:n,variant:r=Mf.Handle,className:i,style:s=void 0,children:a,color:o,minWidth:l=10,minHeight:u=10,maxWidth:d=Number.MAX_VALUE,maxHeight:p=Number.MAX_VALUE,keepAspectRatio:f=!1,resizeDirection:g,autoScale:_=!0,shouldResize:x,onResizeStart:v,onResize:S,onResizeEnd:w}){const N=G7(),C=typeof e=="string"?e:N,T=dr(),A=b.useRef(null),E=r===Mf.Handle,D=kn(b.useCallback(Lye(E&&_),[E,_]),kr),F=b.useRef(null),B=n??Iye[r];b.useEffect(()=>{if(!(!A.current||!C))return F.current||(F.current=hge({domNode:A.current,nodeId:C,getStoreItems:()=>{const{nodeLookup:$,transform:z,snapGrid:W,snapToGrid:P,nodeOrigin:q,domNode:I}=T.getState();return{nodeLookup:$,transform:z,snapGrid:W,snapToGrid:P,nodeOrigin:q,paneDomNode:I}},onChange:($,z)=>{const{triggerNodeChanges:W,nodeLookup:P,parentLookup:q,nodeOrigin:I}=T.getState(),Q=[],K={x:$.x,y:$.y},Z=P.get(C);if(Z&&Z.expandParent&&Z.parentId){const Y=Z.origin??I,R=$.width??Z.measured.width??0,U=$.height??Z.measured.height??0,V={id:Z.id,parentId:Z.parentId,rect:{width:R,height:U,..._7({x:$.x??Z.position.x,y:$.y??Z.position.y},{width:R,height:U},Z.parentId,P,Y)}},ie=wA([V],P,q,I);Q.push(...ie),K.x=$.x?Math.max(Y[0]*R,$.x):void 0,K.y=$.y?Math.max(Y[1]*U,$.y):void 0}if(K.x!==void 0&&K.y!==void 0){const Y={id:C,type:"position",position:{...K}};Q.push(Y)}if($.width!==void 0&&$.height!==void 0){const R={id:C,type:"dimensions",resizing:!0,setAttributes:g?g==="horizontal"?"width":"height":!0,dimensions:{width:$.width,height:$.height}};Q.push(R)}for(const Y of z){const R={...Y,type:"position"};Q.push(R)}W(Q)},onEnd:({width:$,height:z})=>{const W={id:C,type:"dimensions",resizing:!1,dimensions:{width:$,height:z}};T.getState().triggerNodeChanges([W])}})),F.current.update({controlPosition:B,boundaries:{minWidth:l,minHeight:u,maxWidth:d,maxHeight:p},keepAspectRatio:f,resizeDirection:g,onResizeStart:v,onResize:S,onResizeEnd:w,shouldResize:x}),()=>{var $;($=F.current)==null||$.destroy()}},[B,l,u,d,p,f,v,S,w,x]);const H=B.split("-");return c.jsx("div",{className:Xr(["react-flow__resize-control","nodrag",...H,r,i]),ref:A,style:{...s,scale:D,...o&&{[E?"backgroundColor":"borderColor"]:o}},children:a})}b.memo(Bye);function zye({nodes:e,edges:n,nodeTypes:r,edgeTypes:i,onNodeClick:s,minimapColor:a,height:o="30rem",fill:l,onlyRenderVisibleElements:u=!1,showMiniMap:d=!0,emptyState:p="No graph data available.",overlay:f}){const g=l?{flex:"1 1 auto",minHeight:0,width:"100%",height:"100%"}:{width:"100%",height:o};return e.length===0?c.jsx("div",{className:"revka-graph revka-graph-empty flex items-center justify-center rounded-[8px] border border-dashed p-6 text-sm",style:{...g,minHeight:l?0:o,borderColor:"var(--revka-border-strong)",color:"var(--revka-text-secondary)"},children:p}):c.jsxs("div",{className:"revka-graph overflow-hidden rounded-[8px] border",style:{...g,borderColor:"var(--revka-border-soft)"},children:[f?c.jsx("div",{className:"revka-graph-overlay",children:f}):null,c.jsxs(mF,{nodes:e,edges:n,nodeTypes:r,edgeTypes:i,fitView:!0,fitViewOptions:{padding:.2},onNodeClick:s,nodesDraggable:!1,nodesConnectable:!1,panOnDrag:!0,elementsSelectable:!0,onlyRenderVisibleElements:u,minZoom:.35,maxZoom:2,proOptions:{hideAttribution:!0},style:{background:"transparent"},children:[c.jsx(vF,{gap:24,size:1,color:"var(--revka-grid-line)"}),c.jsx(_F,{showInteractive:!1,style:{background:"var(--revka-bg-panel-strong)",borderColor:"var(--revka-border-soft)",borderRadius:"8px"}}),d?c.jsx(bF,{position:"bottom-right",pannable:!0,zoomable:!0,nodeColor:a,style:{background:"var(--revka-bg-panel-strong)",border:"1px solid var(--revka-border-soft)",borderRadius:"8px",width:220,height:150},maskColor:"color-mix(in srgb, var(--revka-bg-base) 54%, transparent)"}):null]})]})}function kF(e){return c.jsx(CA,{children:c.jsx(zye,{...e})})}function $ye({id:e,sourceX:n,sourceY:r,targetX:i,targetY:s,sourcePosition:a,targetPosition:o,style:l,label:u,labelStyle:d}){const[p,f,g]=yA({sourceX:n,sourceY:r,targetX:i,targetY:s,sourcePosition:a,targetPosition:o});return c.jsxs(c.Fragment,{children:[c.jsx(Rf,{id:`${e}-track`,path:p,style:{stroke:"var(--revka-border-soft)",strokeWidth:4,opacity:.42,fill:"none"}}),c.jsx(Rf,{id:e,path:p,style:l}),u?c.jsx(uye,{children:c.jsx("div",{className:"nodrag nopan absolute -translate-x-1/2 -translate-y-1/2 rounded-md border px-1.5 py-0.5 text-[10px] font-semibold tracking-[0.08em]",style:{transform:`translate(-50%, -50%) translate(${f}px, ${g}px)`,borderColor:"var(--revka-border-strong)",background:"color-mix(in srgb, var(--revka-bg-panel-strong) 96%, transparent)",color:"var(--revka-text-primary)",boxShadow:"0 8px 18px rgba(0, 0, 0, 0.10)",...d??{}},children:u})}):null]})}const Fye={default:$ye};function Hye(e){switch(e){case"success":return"completed";case"error":return"failed";case"queued":case"waiting":case"blocked":case"approval_required":case"paused":return"pending";case"retrying":return"running";case"cancelled":return"skipped";default:return e??"pending"}}function Xs(e){return{status:Hye(e.status),agent_id:e.agent_id,agent_type:e.agent_type,role:e.role,template_name:e.template_name,skills:e.skills,transcript:e.transcript,error:e.error,output_preview:e.output_preview,input_data:e.input_data,output_data:e.output_data}}const wh="var(--revka-signal-live)",Mc="var(--revka-signal-network)",c_="var(--revka-signal-selected)",Sh="var(--revka-status-warning)",iP="var(--revka-status-idle)",fS={code:wh,build:wh,test:wh,research:wh,for_each:wh,shell:wh,agent:Mc,deploy:Mc,notify:Mc,a2a:Mc,handoff:Mc,group_chat:Mc,map_reduce:Mc,supervisor:Mc,review:c_,summarize:c_,resolve:c_,output:c_,human_input:Sh,human_approval:Sh,approve:Sh,gate:Sh,conditional:Sh,goto:Sh,parallel:iP,task:iP};function wF(e){if(typeof window>"u")return e;const n=e.match(/^var\((--[\w-]+)\)$/),r=n==null?void 0:n[1];return r&&getComputedStyle(document.documentElement).getPropertyValue(r).trim()||e}function SF(e){const n=e.toLowerCase();if(fS[n])return fS[n];for(const[r,i]of Object.entries(fS))if(n.includes(r))return i;return"var(--revka-status-idle)"}function CF(e){switch(e){case"running":return"var(--revka-signal-live)";case"completed":return"var(--revka-signal-selected)";case"failed":return"var(--revka-status-danger)";case"skipped":return"var(--revka-status-idle)";case"pending":default:return"var(--revka-text-faint)"}}function jF(e){const n=new Map(e.map(i=>[i.id,i])),r=new Map;for(const i of ad(e).edges){if(!n.has(i.source)||!n.has(i.target))continue;const s=r.get(i.target)??[];s.includes(i.source)||s.push(i.source),r.set(i.target,s)}return r}function Wye({edge:e,tasksById:n,stepResults:r,selectedTaskId:i}){var p,f,g;const s=(p=r==null?void 0:r[e.source])==null?void 0:p.status,a=(f=r==null?void 0:r[e.target])==null?void 0:f.status,o=CF(a??s),l=r?o:"var(--revka-text-faint)",u=i&&(e.source===i||e.target===i),d=e.sourceHandle==="true"?"TRUE":e.sourceHandle==="false"?"FALSE":typeof e.label=="string"?e.label:void 0;return{animated:s==="running"||a==="running",label:d,labelStyle:d?{...e.labelStyle??{},fill:e.sourceHandle==="false"?"var(--revka-status-danger)":((g=e.labelStyle)==null?void 0:g.fill)??"var(--revka-status-success)",fontSize:10,fontWeight:700}:void 0,style:{stroke:u?l:`color-mix(in srgb, ${l} ${r?"62%":"42%"}, var(--revka-border-soft))`,strokeWidth:a==="failed"?2.6:u?2.4:1.55,strokeDasharray:a==="skipped"?"5 4":void 0,opacity:a==="failed"?1:u?.96:.68,filter:a==="failed"?`drop-shadow(0 0 6px color-mix(in srgb, ${l} 28%, transparent))`:void 0}}}function NF({tasks:e,stepResults:n}){var o;const r=new Set,i=jF(e),s=new Set(Object.entries(n).filter(([,l])=>l.status==="failed").map(([l])=>l));let a=!0;for(;a;){a=!1;for(const l of e){if(r.has(l.id)||s.has(l.id)||((o=n[l.id])==null?void 0:o.status)!=="pending")continue;(i.get(l.id)??[]).some(p=>s.has(p)||r.has(p))&&(r.add(l.id),a=!0)}}return[...r]}function sP({startTaskIds:e,tasks:n}){const r=jF(n),i=new Set,s=[...e];for(;s.length>0;){const a=s.pop();if(!(!a||i.has(a))){i.add(a);for(const o of r.get(a)??[])s.push(o)}}return[...i]}function qye(e){return`url("${e.replace(/"/g,"%22")}")`}function EF(e){const n=dye(),r=b.useRef(null);return b.useEffect(()=>{const i=r.current;if(!i)return;const s=new ResizeObserver(()=>n(e));return s.observe(i),()=>s.disconnect()},[e,n]),r}function Qm(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}function Bh(e){if(e==null)return"";if(typeof e=="string")return e;if(typeof e=="number"||typeof e=="boolean")return String(e);try{return JSON.stringify(e)}catch{return String(e)}}function AF(e,n=110){const r=e.replace(/\s+/g," ").trim();return r.length>n?`${r.slice(0,n-1)}…`:r}function Uye(e){if(!e||e.status!=="failed")return"";const n=Qm(e.output_data),r=Qm(e.input_data),i=[e.error,n.error,n.entity_error,n.entity_artifact_error,n.entity_tag_error,n.register_output_error,n.structured_output_error,Qm(n.error_message).content,n.stderr,n.stderr_preview,r.command?`command: ${r.command}`:""];for(const s of i){const a=AF(Bh(s));if(a)return a}return""}function Vye(e){if(!e||e.status!=="completed")return"";const n=Qm(e.input_data),r=Qm(e.output_data),i=Bh(r.matched_branch_index??n.matched_branch_index),s=Bh(r.matched_goto),a=Bh(r.matched_condition??n.matched_condition),o=Bh(r.matched_output??e.output_preview),l=[],u=Number(i),d=Bh(r.matched_branch_label);return d?l.push(d):Number.isFinite(u)&&u>=0&&l.push(`branch ${u+1}`),s&&l.push(`to ${s}`),a&&l.push(`if ${a}`),o&&l.push(`out ${o}`),AF(l.join(" · "),120)}function Kye({id:e,data:n,selected:r}){var v,S,w,N,C,T,A,E,D,F,B;const i=EF(e),s=n.runInfo?CF(n.runInfo.status):SF(n.type),a=n.failing?"var(--revka-status-danger)":n.blocked?"var(--revka-status-warning)":n.running?"var(--revka-signal-live)":s,o=Uye(n.runInfo),l=n.type==="conditional"?Vye(n.runInfo):"",u=((v=n.runInfo)==null?void 0:v.template_name)||n.assign||n.template,d=n.failing?"danger":n.blocked?"warning":n.running?"running":((S=n.runInfo)==null?void 0:S.status)??"idle",p=r?`linear-gradient(135deg, color-mix(in srgb, ${a} var(--revka-node-accent-selected), transparent), transparent 78%)`:`linear-gradient(180deg, color-mix(in srgb, ${a} var(--revka-node-accent-idle), transparent), transparent 42%)`,f=!!n.agentAvatarUrl,g=f?["linear-gradient(90deg, var(--revka-bg-panel-strong) 0%, color-mix(in srgb, var(--revka-bg-panel-strong) 88%, transparent) 50%, color-mix(in srgb, var(--revka-bg-panel-strong) 32%, transparent) 100%)",p,qye(n.agentAvatarUrl)].join(", "):p,_={"--revka-node-accent":a,width:"100%",minHeight:140,minWidth:220,maxWidth:280,borderColor:r?a:"color-mix(in srgb, var(--revka-border-soft) 82%, transparent)",backgroundColor:"var(--revka-bg-panel-strong)",backgroundImage:g,backgroundRepeat:"no-repeat",backgroundPosition:f?"0 0, 0 0, right -22px center":void 0,backgroundSize:f?"100% 100%, 100% 100%, 56% auto":void 0,boxShadow:r?`0 0 0 1px color-mix(in srgb, ${a} 70%, var(--revka-border-strong)), 0 16px 32px color-mix(in srgb, ${a} 12%, transparent)`:n.failing?"0 14px 28px color-mix(in srgb, var(--revka-status-danger) 10%, transparent)":n.blocked?"0 14px 26px color-mix(in srgb, var(--revka-status-warning) 8%, transparent)":"var(--revka-shadow-panel)"},x={width:10,height:10,zIndex:2};return c.jsxs("div",{ref:i,className:"revka-workflow-node rounded-[8px] border px-4 py-3 shadow-sm flex flex-col","data-selected":r?"true":"false","data-state":d,title:[n.name||n.taskId,`Type: ${n.type}`,(w=n.runInfo)!=null&&w.status?`Status: ${n.runInfo.status}`:null,(N=n.runInfo)!=null&&N.agent_type?`Agent: ${n.runInfo.agent_type}${n.runInfo.role?` / ${n.runInfo.role}`:""}`:null,l?`Resolved: ${l}`:null,o?`Failure: ${o}`:null,n.blocked?"Blocked by upstream failure":null,n.failing?"On failure path":null,(T=(C=n.runInfo)==null?void 0:C.skills)!=null&&T.length?`Skills: ${n.runInfo.skills.join(", ")}`:null].filter(Boolean).join(`
`),style:_,children:[c.jsx(Ns,{className:"revka-workflow-handle",type:"target",position:Ot.Top,style:x}),c.jsxs("div",{className:"relative z-[1] flex min-h-full flex-col",children:[c.jsxs("div",{className:"flex items-start justify-between gap-2",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsx("div",{className:"truncate text-sm font-semibold",style:{color:"var(--revka-text-primary)"},children:n.name||n.taskId}),c.jsxs("div",{className:"mt-1 flex flex-wrap gap-1.5",children:[c.jsx("span",{className:"rounded-md px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-[0.12em]",style:{background:"color-mix(in srgb, var(--revka-bg-elevated) 80%, transparent)",color:a},children:n.type}),n.runInfo?c.jsx("span",{className:"rounded-md px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-[0.12em]",style:{background:"color-mix(in srgb, var(--revka-bg-elevated) 80%, transparent)",color:a},children:n.runInfo.status}):null,n.failing?c.jsx("span",{className:"rounded-md px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-[0.12em]",style:{background:"color-mix(in srgb, var(--revka-status-danger) 12%, transparent)",color:"var(--revka-status-danger)"},children:"failure path"}):null,n.blocked?c.jsx("span",{className:"rounded-md px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-[0.12em]",style:{background:"color-mix(in srgb, var(--revka-status-warning) 12%, transparent)",color:"var(--revka-status-warning)"},children:"blocked"}):null]})]}),u?c.jsxs("span",{className:"inline-flex max-w-[116px] items-center gap-1 rounded-md px-1.5 py-0.5 text-[10px] font-medium",style:{background:"var(--revka-signal-network-soft)",color:"var(--revka-signal-network)"},title:n.agentDisplayName||u,children:[c.jsx(js,{src:n.agentAvatarUrl,alt:n.agentDisplayName||u,size:16,radius:4,iconSize:10}),c.jsx("span",{className:"truncate",children:u})]}):(A=n.runInfo)!=null&&A.agent_type?c.jsx("span",{className:"rounded-md px-1.5 py-0.5 text-[10px] font-medium",style:{background:"var(--revka-signal-network-soft)",color:"var(--revka-signal-network)"},children:n.runInfo.agent_type}):null]}),n.description?c.jsx("p",{className:"mt-2 line-clamp-2 text-[11px] leading-5",style:{color:"var(--revka-text-secondary)"},children:n.description}):null,c.jsxs("div",{className:"mt-3 flex flex-wrap gap-1.5",children:[n.agentHints.slice(0,2).map(H=>c.jsx("span",{className:"rounded-md px-1.5 py-0.5 text-[10px] font-medium",style:{background:"var(--revka-bg-elevated)",color:"var(--revka-text-secondary)"},children:H},H)),n.skills.slice(0,2).map(H=>c.jsx("span",{className:"rounded-md px-1.5 py-0.5 text-[10px] font-medium",style:{background:"var(--revka-signal-live-soft)",color:"var(--revka-signal-selected)"},children:H.replace(/^kref:\/\/.*\//,"").replace(/\.skilldef$/,"")},H)),(D=(E=n.runInfo)==null?void 0:E.transcript)!=null&&D.length?c.jsxs("span",{className:"rounded-md px-1.5 py-0.5 text-[10px] font-medium",style:{background:"var(--revka-signal-network-soft)",color:"var(--revka-signal-network)"},children:[n.runInfo.transcript.length," rounds"]}):null,(B=(F=n.runInfo)==null?void 0:F.skills)!=null&&B.length?c.jsxs("span",{className:"rounded-md px-1.5 py-0.5 text-[10px] font-medium",style:{background:"color-mix(in srgb, var(--revka-status-warning) 14%, transparent)",color:"var(--revka-status-warning)"},children:[n.runInfo.skills.length," skills"]}):null]}),l?c.jsx("div",{className:"mt-2 rounded-md px-2 py-1 text-[10px] leading-4",style:{background:"color-mix(in srgb, var(--revka-status-success) 10%, transparent)",color:"var(--revka-text-secondary)"},children:l}):null,o?c.jsx("div",{className:"mt-2 rounded-md px-2 py-1 text-[10px] leading-4",style:{background:"color-mix(in srgb, var(--revka-status-danger) 10%, transparent)",color:"var(--revka-status-danger)"},children:o}):null]}),c.jsx(Ns,{className:"revka-workflow-handle",type:"source",position:Ot.Bottom,style:x})]})}function Yye(e){var r;if(((r=e.conditionalBranches)==null?void 0:r.length)>0)return e.conditionalBranches;const n=[];return(e.condition||e.onTrueValue)&&n.push({condition:e.condition||"",goto:"",value:e.onTrueValue||void 0}),e.onFalseValue&&n.push({condition:"default",goto:"",value:e.onFalseValue||void 0}),n.length>0?n:[{condition:e.condition||"",goto:"",value:e.onTrueValue||void 0},{condition:"default",goto:"",value:e.onFalseValue||void 0}]}function Gye({id:e,data:n,selected:r}){var d;const i="var(--revka-status-warning)",s=EF(e),a=Yye(n),o=(d=a.find(p=>p.condition.trim()!=="default"))==null?void 0:d.condition,l={"--revka-node-accent":i,width:"100%",minHeight:96,minWidth:200,maxWidth:250,borderColor:r?i:"color-mix(in srgb, var(--revka-border-soft) 82%, transparent)",background:r?`linear-gradient(135deg, color-mix(in srgb, ${i} var(--revka-node-accent-selected), transparent), transparent 78%), var(--revka-bg-panel-strong)`:`linear-gradient(180deg, color-mix(in srgb, ${i} var(--revka-node-accent-idle), transparent), transparent 42%), var(--revka-bg-panel-strong)`,boxShadow:r?`0 0 0 1px color-mix(in srgb, ${i} 70%, var(--revka-border-strong)), 0 16px 30px color-mix(in srgb, ${i} 12%, transparent)`:"var(--revka-shadow-panel)"},u={width:10,height:10,zIndex:2};return c.jsxs("div",{ref:s,className:"revka-workflow-node rounded-[8px] border px-4 py-3 shadow-sm flex flex-col","data-selected":r?"true":"false","data-state":"gate",style:l,children:[c.jsx(Ns,{className:"revka-workflow-handle",type:"target",position:Ot.Top,style:u}),c.jsxs("div",{className:"relative z-[1] flex min-h-full flex-col",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("div",{className:"h-4 w-4 rotate-45 border",style:{borderColor:i,background:"color-mix(in srgb, var(--revka-bg-panel-strong) 82%, transparent)"}}),c.jsxs("div",{className:"min-w-0",children:[c.jsx("div",{className:"truncate text-sm font-semibold",style:{color:"var(--revka-text-primary)"},children:n.name||n.taskId}),c.jsx("div",{className:"mt-1 text-[11px] font-mono",style:{color:"var(--revka-text-secondary)"},children:o||n.condition||"No condition set"})]})]}),c.jsx("div",{className:"mt-3 flex flex-col gap-1.5 text-[10px] font-semibold uppercase tracking-[0.12em]",children:a.map((p,f)=>{const g=wf(p,f);return c.jsxs("div",{className:"flex items-center justify-between gap-2",children:[c.jsx("span",{className:"truncate",style:{color:g.stroke},children:_0(p,f)}),p.value?c.jsx("span",{className:"truncate font-mono normal-case tracking-normal",style:{color:g.stroke},children:p.value}):null]},Zc(f))})})]}),a.map((p,f)=>{const g=wf(p,f),_=`${(f+1)/(a.length+1)*100}%`;return c.jsx(Ns,{className:"revka-workflow-handle",type:"source",position:Ot.Bottom,id:Zc(f),style:{...u,left:_,"--revka-node-accent":g.stroke}},Zc(f))})]})}const Xye={taskNode:Kye,gateNode:Gye};function TF(e){return(e??"").trim().toLowerCase()}function Qye(e){const n=new Map;for(const r of e){const i={avatarUrl:r.avatar_url,displayName:r.name||r.item_name};for(const s of[r.item_name,r.name,r.kref]){const a=TF(s);a&&!n.has(a)&&n.set(a,i)}}return n}function Zye(e,n){var r;for(const i of[(r=e.runInfo)==null?void 0:r.template_name,e.assign,e.template]){const s=n.get(TF(i));if(s)return s}return null}function MF(e,n){if(n.length===0)return e;const r=Qye(n);return e.map(i=>{const s=Zye(i.data,r),a=(s==null?void 0:s.avatarUrl)??void 0,o=(s==null?void 0:s.displayName)??void 0;return i.data.agentAvatarUrl===a&&i.data.agentDisplayName===o?i:{...i,data:{...i.data,agentAvatarUrl:a,agentDisplayName:o}}})}let Rl=null,Qu=null;const kj=new Set;function aP(){kj.forEach(e=>e())}function oP(){return Rl?Promise.resolve(Rl):Qu||(Qu=lE(!1,1,100).then(e=>(Rl=e.agents,Qu=null,aP(),Rl)).catch(e=>{throw Qu=null,Rl=[],aP(),e}),Qu)}function jA(){const[,e]=b.useState(0),[n,r]=b.useState(Rl===null);b.useEffect(()=>{const s=()=>e(a=>a+1);return kj.add(s),Rl===null?(r(!0),oP().catch(()=>{}).finally(()=>r(!1))):r(!1),()=>{kj.delete(s)}},[]);const i=b.useCallback(async()=>{Rl=null,Qu=null,r(!0);try{await oP()}finally{r(!1)}},[]);return{agents:Rl??[],loading:n,refresh:i}}const Jye=40,e_e=60;function NA({definition:e,stepResults:n,onSelectTask:r,selectedTaskId:i,height:s,fill:a,overlay:o,hiddenTaskIds:l,blockedTaskIds:u,failingTaskIds:d,runningTaskIds:p}){const{agents:f}=jA(),{nodes:g,edges:_,tasks:x,largeGraphMode:v}=b.useMemo(()=>{const w=Bo(e),N=ad(w),C=N.nodes.length>Jye||N.edges.length>e_e,T=new Map(w.map($=>[$.id,$])),A=new Set(l??[]),E=new Set(u??[]),D=new Set(d??[]),F=new Set(p??[]);if(n)for(const $ of N.nodes){const z=$.data,W=n[z.taskId];W&&(z.runInfo=W),z.blocked=E.has(z.taskId),z.failing=D.has(z.taskId),z.running=F.has(z.taskId)}const H=eA(w)?N.nodes:L$(N.nodes,N.edges);return{tasks:w,nodes:MF(H,f).map($=>({...$,selected:$.id===i,hidden:A.has($.id)})),edges:N.edges.map($=>{const z=Wye({edge:$,tasksById:T,stepResults:n,selectedTaskId:i});return{...$,...z,animated:C?!1:z.animated,hidden:A.has($.source)||A.has($.target)}}),largeGraphMode:C}},[f,u,e,d,l,p,i,n]),S=(w,N)=>{const C=N.data.taskId;r(x.find(T=>T.id===C)??null)};return c.jsx(kF,{nodes:g,edges:_,nodeTypes:Xye,edgeTypes:Fye,onNodeClick:S,height:s,fill:a,overlay:o,onlyRenderVisibleElements:v,showMiniMap:!v,minimapColor:w=>{const N=w.data;return wF(SF(N.type))},emptyState:"Select a workflow to inspect its DAG."})}function t_e(){const{t:e,tpl:n}=cn(),{getSkinAsset:r}=Ta(),i=r("dashboardHero"),s=r("dashboardShowcase"),a=r("operatorAvatar"),o=s??i,[l,u]=Jg(),[d,p]=b.useState(null),[f,g]=b.useState(null),[_,x]=b.useState(null),[v,S]=b.useState(null),[w,N]=b.useState([]),[C,T]=b.useState([]),[A,E]=b.useState(null),[D,F]=b.useState(null),[B,H]=b.useState(null),[$,z]=b.useState(null),[W,P]=b.useState(!1),[q,I]=b.useState(!1),Q=b.useRef(null),K=()=>(I(!0),Promise.all([nZ(!0),oQ(),uB(),Dx(),CQ(),hB()]).then(([ge,Ue,$e,Bt,ct,Mt])=>{var Re;p(ge),g(Ue),x($e),S(Bt),N(ct),T(Mt);const Dt=l.get("run")??((Re=ge.recent_runs[0])==null?void 0:Re.run_id)??null;return Dt?To(Dt).then(E):null}).catch(ge=>z(ge.message)).finally(()=>I(!1)));b.useEffect(()=>{K()},[]),b.useEffect(()=>{let ge=!1;const Ue=()=>{Dx().then(ct=>{ge||S(ct)}).catch(ct=>{ge||S({verified:!1,error:ct instanceof Error?ct.message:String(ct)})})},$e=window.setInterval(Ue,6e4),Bt=()=>Ue();return window.addEventListener("focus",Bt),()=>{ge=!0,window.clearInterval($e),window.removeEventListener("focus",Bt)}},[]),b.useEffect(()=>{var ge,Ue;!W||!A||((ge=Q.current)==null||ge.scrollIntoView({behavior:"smooth",block:"start"}),(Ue=Q.current)==null||Ue.focus({preventScroll:!0}),P(!1))},[A,W]),b.useEffect(()=>{if(!(A!=null&&A.workflow_revision_kref)){F(null);return}let ge=!1;return F(null),e0(A.workflow_revision_kref).then(Ue=>{ge||F(Ue)}).catch(()=>{ge||F(null)}),()=>{ge=!0}},[A==null?void 0:A.workflow_revision_kref]);const Z=b.useMemo(()=>{if(!d||!A)return null;if(D)return D;const ge=A.workflow_name.toLowerCase();return d.definitions.find(Ue=>Ue.name.toLowerCase()===ge)??null},[d,D,A]),Y=b.useMemo(()=>Z?Bo(Z.definition):[],[Z]),R=b.useMemo(()=>A?Object.fromEntries(A.steps.map(ge=>[ge.step_id,Xs(ge)])):{},[A]),U=b.useMemo(()=>B&&A?A.steps.find(ge=>ge.step_id===B.id)??null:null,[A,B]),V=b.useMemo(()=>{const ge={pending:0,running:0,completed:0,failed:0,skipped:0};if(!A)return ge;for(const Ue of A.steps){const $e=Xs(Ue).status;ge[$e]+=1}return ge},[A]),ie=b.useMemo(()=>NF({tasks:Y,stepResults:R}),[Y,R]),te=b.useMemo(()=>(A==null?void 0:A.steps.filter(ge=>Xs(ge).status==="failed"))??[],[A]),X=b.useMemo(()=>(A==null?void 0:A.steps.filter(ge=>Xs(ge).status==="running"))??[],[A]),se=b.useMemo(()=>Y.filter(ge=>ie.includes(ge.id)),[ie,Y]),re=b.useMemo(()=>[...te.map(ge=>Y.find(Ue=>Ue.id===ge.step_id)??null).filter(ge=>ge!==null),...X.map(ge=>Y.find(Ue=>Ue.id===ge.step_id)??null).filter(ge=>ge!==null).filter(ge=>!te.some(Ue=>Ue.step_id===ge.id)),...se.filter(ge=>!te.some(Ue=>Ue.step_id===ge.id))],[se,te,X,Y]);b.useEffect(()=>{A&&u(ge=>{const Ue=new URLSearchParams(ge);return Ue.set("run",A.run_id),B!=null&&B.id?Ue.set("node",B.id):Ue.delete("node"),Ue},{replace:!0})},[A==null?void 0:A.run_id,B==null?void 0:B.id,u]),b.useEffect(()=>{const ge=l.get("node");if(!ge){H(null);return}H(Y.find(Ue=>Ue.id===ge)??null)},[l,Y]);const de=b.useMemo(()=>w.filter(ge=>ge.status==="active").length,[w]),ue=b.useMemo(()=>C.filter(ge=>ge.status==="active").length,[C]),ae=b.useMemo(()=>Object.values((f==null?void 0:f.health.components)??{}).filter(ge=>ge.status!=="healthy"&&ge.status!=="ok").length,[f==null?void 0:f.health.components]),pe=b.useMemo(()=>o?{"--revka-dashboard-scene-image":`url("${o.replace(/"/g,"%22")}")`}:void 0,[o]),J=b.useMemo(()=>{var ge,Ue;return $||((ge=A==null?void 0:A.status)==null?void 0:ge.toLowerCase())==="failed"?"danger":ae>0?"warn":((Ue=A==null?void 0:A.status)==null?void 0:Ue.toLowerCase())==="running"?"live":"steady"},[ae,$,A==null?void 0:A.status]),me=b.useMemo(()=>{if($)return e("dashboard.scene.error");if(A){const ge=A.steps_total||A.steps.length||"?",Ue=A.steps_completed||0,$e=A.steps.filter(Bt=>Xs(Bt).status==="failed").length;return $e>0?n("dashboard.scene.run_failed",{workflow:A.workflow_name,failed:$e,completed:Ue,total:ge}):n("dashboard.scene.selected_run",{workflow:A.workflow_name,status:A.status,completed:Ue,total:ge})}return((d==null?void 0:d.active_runs)??0)>0?n("dashboard.scene.active_overview",{active:(d==null?void 0:d.active_runs)??0,definitions:(d==null?void 0:d.definitions_count)??0}):n("dashboard.scene.idle_overview",{definitions:(d==null?void 0:d.definitions_count)??0,total:(d==null?void 0:d.total_runs)??0})},[d==null?void 0:d.active_runs,d==null?void 0:d.definitions_count,d==null?void 0:d.total_runs,$,A,e,n]);b.useEffect(()=>{const ge=Ue=>{if(Ue.metaKey||Ue.ctrlKey||Ue.altKey)return;const $e=Ue.target;if($e&&["INPUT","TEXTAREA","SELECT"].includes($e.tagName)||re.length===0)return;const Bt=re.findIndex(ct=>ct.id===(B==null?void 0:B.id));if(Ue.key==="j"){Ue.preventDefault();const ct=Bt>=0?(Bt+1)%re.length:0;H(re[ct]??null)}if(Ue.key==="k"){Ue.preventDefault();const ct=Bt>=0?(Bt-1+re.length)%re.length:re.length-1;H(re[ct]??null)}};return window.addEventListener("keydown",ge),()=>window.removeEventListener("keydown",ge)},[B==null?void 0:B.id,re]);const fe=ge=>{H(Y.find(Ue=>Ue.id===ge)??null)},ve=()=>{const ge=re.findIndex($e=>$e.id===(B==null?void 0:B.id)),Ue=ge>=0?(ge-1+re.length)%re.length:re.length-1;H(re[Ue]??null)},Ke=()=>{const ge=re.findIndex($e=>$e.id===(B==null?void 0:B.id)),Ue=ge>=0?(ge+1)%re.length:0;H(re[Ue]??null)};return c.jsxs("div",{className:"flex min-h-[calc(100vh-6rem)] flex-col gap-3 lg:h-[calc(100vh-6rem)]",children:[c.jsx(si,{kicker:e("dashboard.kicker"),title:e("nav.dashboard"),actions:c.jsxs("button",{type:"button",className:"revka-button",onClick:()=>void K(),disabled:q,children:[c.jsx($r,{className:`h-4 w-4 ${q?"animate-spin":""}`}),e("common.refresh")]})}),o?c.jsx(st,{className:"revka-dashboard-showcase overflow-hidden p-0",variant:"utility",children:c.jsx("div",{className:"revka-dashboard-scene",style:pe,children:c.jsx(bde,{avatarUrl:a,message:me,speaker:e("dashboard.scene.operator"),tone:J})})}):null,c.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:min-h-0 lg:flex-1 lg:grid-cols-[minmax(0,1fr)_24rem] lg:[grid-template-rows:minmax(0,1fr)]",children:[c.jsxs(st,{className:"flex flex-col p-5 lg:min-h-0",children:[c.jsxs("div",{className:"flex items-center justify-between gap-3",children:[c.jsxs("div",{children:[c.jsx("div",{className:"revka-kicker",children:e("dashboard.live_orchestration_pane")}),c.jsx("h3",{className:"mt-2 text-lg font-semibold",children:A?`${A.workflow_name} / ${A.run_id.slice(0,8)}`:e("dashboard.active_workflow_posture")})]}),c.jsx(o0,{className:"h-5 w-5",style:{color:"var(--revka-signal-network)"}})]}),c.jsx(gde,{definitionsCount:d==null?void 0:d.definitions_count,activeRuns:d==null?void 0:d.active_runs,totalRuns:d==null?void 0:d.total_runs,error:$}),Z?c.jsx("div",{className:"mt-3",children:c.jsx(bs,{to:`/workflows?workflow=${encodeURIComponent(Z.kref)}${B?`&node=${encodeURIComponent(B.id)}`:""}`,className:"inline-flex items-center gap-2 text-sm",style:{color:"var(--revka-signal-network)"},children:e("dashboard.open_workflow_definition")})}):null,c.jsx(P$,{run:A,active:W,label:e("dashboard.selected_run")}),c.jsxs("div",{ref:Q,tabIndex:-1,className:"mt-6 grid gap-4 outline-none lg:min-h-0 lg:flex-1 lg:grid-cols-[minmax(0,1fr)_22rem] lg:[grid-template-rows:minmax(0,1fr)]",children:[c.jsx("div",{className:"flex min-h-0 flex-col",children:c.jsx(NA,{fill:!0,definition:(Z==null?void 0:Z.definition)??"",stepResults:R,onSelectTask:H,selectedTaskId:B==null?void 0:B.id,blockedTaskIds:ie,failingTaskIds:te.map(ge=>ge.step_id),runningTaskIds:X.map(ge=>ge.step_id),overlay:A?c.jsxs("div",{className:"space-y-2",children:[c.jsx(qc,{title:e("dashboard.run_posture"),children:c.jsxs("div",{className:"grid gap-2 sm:grid-cols-2 xl:grid-cols-5",children:[c.jsx(Ro,{label:e("dashboard.count.running"),value:V.running,tone:"var(--revka-signal-live)",compact:!0,assetSlot:"statusRunningBadge"}),c.jsx(Ro,{label:e("dashboard.count.failed"),value:V.failed,tone:"var(--revka-status-danger)",compact:!0,assetSlot:"statusFailedBadge"}),c.jsx(Ro,{label:e("dashboard.count.completed"),value:V.completed,tone:"var(--revka-status-success)",compact:!0,assetSlot:"statusSuccessBadge"}),c.jsx(Ro,{label:e("dashboard.count.pending"),value:V.pending,tone:"var(--revka-text-faint)",compact:!0,assetSlot:"statusPendingBadge"}),c.jsx(Ro,{label:e("dashboard.count.skipped"),value:V.skipped,tone:"var(--revka-status-idle)",compact:!0,assetSlot:"statusSkippedBadge"})]})}),re.length>0?c.jsx(qc,{title:e("dashboard.signal_focus"),children:c.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[c.jsx(Zx,{label:e("dashboard.prev_signal"),hint:"K",onClick:ve}),c.jsx(Zx,{label:e("dashboard.next_signal"),hint:"J",onClick:Ke}),c.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-[0.12em]",style:{color:"var(--revka-text-faint)"},children:n("dashboard.intervention_points",{count:re.length})})]})}):null,te.length>0||X.length>0||se.length>0?c.jsx(qc,{title:e("dashboard.hotspots"),children:c.jsxs("div",{className:"flex flex-wrap gap-2",children:[te.slice(0,3).map(ge=>c.jsx(of,{label:n("dashboard.label.failure",{id:ge.step_id}),tone:"var(--revka-status-danger)",onClick:()=>fe(ge.step_id)},ge.step_id)),X.slice(0,2).map(ge=>c.jsx(of,{label:n("dashboard.label.running",{id:ge.step_id}),tone:"var(--revka-signal-live)",onClick:()=>fe(ge.step_id)},ge.step_id)),se.slice(0,3).map(ge=>c.jsx(of,{label:n("dashboard.label.blocked",{id:ge.id}),tone:"var(--revka-status-warning)",onClick:()=>fe(ge.id)},ge.id))]})}):null]}):void 0})}),c.jsxs("div",{className:"space-y-4 lg:min-h-0 lg:overflow-y-auto lg:pr-1",children:[c.jsx(jde,{run:A,workflowHref:Z?`/workflows?workflow=${encodeURIComponent(Z.kref)}${B?`&node=${encodeURIComponent(B.id)}`:""}`:void 0}),A?c.jsx("div",{className:"px-1",children:c.jsx(bs,{to:`/runs?run=${encodeURIComponent(A.run_id)}&workflow=${encodeURIComponent(A.workflow_name)}${B?`&node=${encodeURIComponent(B.id)}`:""}`,className:"inline-flex items-center gap-2 text-sm",style:{color:"var(--revka-signal-network)"},children:e("dashboard.open_full_run_workspace")})}):null,c.jsx(D$,{title:e("dashboard.selected_step"),task:B,step:U,footer:B&&A?c.jsxs("div",{className:"flex flex-wrap gap-3 text-xs",children:[c.jsx(bs,{to:`/runs?run=${encodeURIComponent(A.run_id)}&workflow=${encodeURIComponent(A.workflow_name)}&node=${encodeURIComponent(B.id)}`,style:{color:"var(--revka-signal-network)"},children:e("dashboard.inspect_node_in_runs")}),Z?c.jsx(bs,{to:`/workflows?workflow=${encodeURIComponent(Z.kref)}&node=${encodeURIComponent(B.id)}`,style:{color:"var(--revka-signal-network)"},children:e("dashboard.open_definition_node")}):null]}):void 0,emptyText:e("dashboard.select_dag_node")}),c.jsxs(st,{className:"p-4",variant:"utility",skinSlot:"timeline",children:[c.jsx("div",{className:"revka-kicker",children:e("dashboard.priority_timeline")}),c.jsx("div",{className:"mt-3 space-y-2",children:(A==null?void 0:A.steps.map(ge=>c.jsxs("button",{type:"button",onClick:()=>fe(ge.step_id),className:"block w-full rounded-[8px] border p-3 text-left",style:{borderColor:(B==null?void 0:B.id)===ge.step_id?"var(--revka-border-strong)":"var(--revka-border-soft)"},children:[c.jsxs("div",{className:"flex items-center justify-between gap-2",children:[c.jsx("span",{className:"truncate text-sm font-medium",style:{color:"var(--revka-text-primary)"},children:ge.step_id}),c.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-[0.14em]",style:{color:Xs(ge).status==="failed"?"var(--revka-status-danger)":Xs(ge).status==="running"?"var(--revka-signal-live)":ie.includes(ge.step_id)?"var(--revka-status-warning)":"var(--revka-text-faint)"},children:ie.includes(ge.step_id)&&Xs(ge).status==="pending"?e("dashboard.status.blocked"):Xs(ge).status})]}),ge.output_preview?c.jsx("div",{className:"mt-2 line-clamp-2 text-xs",style:{color:"var(--revka-text-secondary)"},children:ge.output_preview}):null]},ge.step_id)))??c.jsx("div",{className:"text-sm",style:{color:"var(--revka-text-faint)"},children:e("dashboard.no_run_selected")})})]})]})]})]}),c.jsxs("div",{className:"flex flex-col gap-4 lg:max-h-[calc(100vh-9rem)] lg:min-h-0 lg:overflow-y-auto lg:pr-1 [&>*]:shrink-0",children:[c.jsx(_de,{audit:v,cost:_,degradedComponentCount:ae}),c.jsx(yde,{sessions:w,channels:C,activeSessionCount:de,activeChannelCount:ue}),c.jsx(vde,{selectedRunStatus:A==null?void 0:A.status,audit:v,provider:f==null?void 0:f.provider,model:f==null?void 0:f.model}),c.jsx(xde,{runs:(d==null?void 0:d.recent_runs)??[],selectedRunId:A==null?void 0:A.run_id,onSelectRun:ge=>{H(null),P(!0),To(ge).then(E).catch(Ue=>z(Ue.message))},footer:c.jsx(bs,{to:"/runs",className:"inline-flex items-center gap-2 text-sm",style:{color:"var(--revka-signal-network)"},children:e("dashboard.open_all_runs")})})]})]})]})}function wj(){return wj=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var i in r)({}).hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},wj.apply(null,arguments)}function n_e(e,n){if(e==null)return{};var r={};for(var i in e)if({}.hasOwnProperty.call(e,i)){if(n.indexOf(i)!==-1)continue;r[i]=e[i]}return r}let Sj=[],RF=[];(()=>{let e="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(n=>n?parseInt(n,36):1);for(let n=0,r=0;n<e.length;n++)(n%2?RF:Sj).push(r=r+e[n])})();function r_e(e){if(e<768)return!1;for(let n=0,r=Sj.length;;){let i=n+r>>1;if(e<Sj[i])r=i;else if(e>=RF[i])n=i+1;else return!0;if(n==r)return!1}}function lP(e){return e>=127462&&e<=127487}const cP=8205;function i_e(e,n,r=!0,i=!0){return(r?OF:s_e)(e,n,i)}function OF(e,n,r){if(n==e.length)return n;n&&DF(e.charCodeAt(n))&&PF(e.charCodeAt(n-1))&&n--;let i=pS(e,n);for(n+=uP(i);n<e.length;){let s=pS(e,n);if(i==cP||s==cP||r&&r_e(s))n+=uP(s),i=s;else if(lP(s)){let a=0,o=n-2;for(;o>=0&&lP(pS(e,o));)a++,o-=2;if(a%2==0)break;n+=2}else break}return n}function s_e(e,n,r){for(;n>0;){let i=OF(e,n-2,r);if(i<n)return i;n--}return 0}function pS(e,n){let r=e.charCodeAt(n);if(!PF(r)||n+1==e.length)return r;let i=e.charCodeAt(n+1);return DF(i)?(r-55296<<10)+(i-56320)+65536:r}function DF(e){return e>=56320&&e<57344}function PF(e){return e>=55296&&e<56320}function uP(e){return e<65536?1:2}let Pn=class LF{lineAt(n){if(n<0||n>this.length)throw new RangeError(`Invalid position ${n} in document of length ${this.length}`);return this.lineInner(n,!1,1,0)}line(n){if(n<1||n>this.lines)throw new RangeError(`Invalid line number ${n} in ${this.lines}-line document`);return this.lineInner(n,!0,1,0)}replace(n,r,i){[n,r]=Of(this,n,r);let s=[];return this.decompose(0,n,s,2),i.length&&i.decompose(0,i.length,s,3),this.decompose(r,this.length,s,1),Oo.from(s,this.length-(r-n)+i.length)}append(n){return this.replace(this.length,this.length,n)}slice(n,r=this.length){[n,r]=Of(this,n,r);let i=[];return this.decompose(n,r,i,0),Oo.from(i,r-n)}eq(n){if(n==this)return!0;if(n.length!=this.length||n.lines!=this.lines)return!1;let r=this.scanIdentical(n,1),i=this.length-this.scanIdentical(n,-1),s=new Zm(this),a=new Zm(n);for(let o=r,l=r;;){if(s.next(o),a.next(o),o=0,s.lineBreak!=a.lineBreak||s.done!=a.done||s.value!=a.value)return!1;if(l+=s.value.length,s.done||l>=i)return!0}}iter(n=1){return new Zm(this,n)}iterRange(n,r=this.length){return new IF(this,n,r)}iterLines(n,r){let i;if(n==null)i=this.iter();else{r==null&&(r=this.lines+1);let s=this.line(n).from;i=this.iterRange(s,Math.max(s,r==this.lines+1?this.length:r<=1?0:this.line(r-1).to))}return new BF(i)}toString(){return this.sliceString(0)}toJSON(){let n=[];return this.flatten(n),n}constructor(){}static of(n){if(n.length==0)throw new RangeError("A document must have at least one line");return n.length==1&&!n[0]?LF.empty:n.length<=32?new Br(n):Oo.from(Br.split(n,[]))}};class Br extends Pn{constructor(n,r=a_e(n)){super(),this.text=n,this.length=r}get lines(){return this.text.length}get children(){return null}lineInner(n,r,i,s){for(let a=0;;a++){let o=this.text[a],l=s+o.length;if((r?i:l)>=n)return new o_e(s,l,i,o);s=l+1,i++}}decompose(n,r,i,s){let a=n<=0&&r>=this.length?this:new Br(dP(this.text,n,r),Math.min(r,this.length)-Math.max(0,n));if(s&1){let o=i.pop(),l=mx(a.text,o.text.slice(),0,a.length);if(l.length<=32)i.push(new Br(l,o.length+a.length));else{let u=l.length>>1;i.push(new Br(l.slice(0,u)),new Br(l.slice(u)))}}else i.push(a)}replace(n,r,i){if(!(i instanceof Br))return super.replace(n,r,i);[n,r]=Of(this,n,r);let s=mx(this.text,mx(i.text,dP(this.text,0,n)),r),a=this.length+i.length-(r-n);return s.length<=32?new Br(s,a):Oo.from(Br.split(s,[]),a)}sliceString(n,r=this.length,i=`
`){[n,r]=Of(this,n,r);let s="";for(let a=0,o=0;a<=r&&o<this.text.length;o++){let l=this.text[o],u=a+l.length;a>n&&o&&(s+=i),n<u&&r>a&&(s+=l.slice(Math.max(0,n-a),r-a)),a=u+1}return s}flatten(n){for(let r of this.text)n.push(r)}scanIdentical(){return 0}static split(n,r){let i=[],s=-1;for(let a of n)i.push(a),s+=a.length+1,i.length==32&&(r.push(new Br(i,s)),i=[],s=-1);return s>-1&&r.push(new Br(i,s)),r}}class Oo extends Pn{constructor(n,r){super(),this.children=n,this.length=r,this.lines=0;for(let i of n)this.lines+=i.lines}lineInner(n,r,i,s){for(let a=0;;a++){let o=this.children[a],l=s+o.length,u=i+o.lines-1;if((r?u:l)>=n)return o.lineInner(n,r,i,s);s=l+1,i=u+1}}decompose(n,r,i,s){for(let a=0,o=0;o<=r&&a<this.children.length;a++){let l=this.children[a],u=o+l.length;if(n<=u&&r>=o){let d=s&((o<=n?1:0)|(u>=r?2:0));o>=n&&u<=r&&!d?i.push(l):l.decompose(n-o,r-o,i,d)}o=u+1}}replace(n,r,i){if([n,r]=Of(this,n,r),i.lines<this.lines)for(let s=0,a=0;s<this.children.length;s++){let o=this.children[s],l=a+o.length;if(n>=a&&r<=l){let u=o.replace(n-a,r-a,i),d=this.lines-o.lines+u.lines;if(u.lines<d>>4&&u.lines>d>>6){let p=this.children.slice();return p[s]=u,new Oo(p,this.length-(r-n)+i.length)}return super.replace(a,l,u)}a=l+1}return super.replace(n,r,i)}sliceString(n,r=this.length,i=`
`){[n,r]=Of(this,n,r);let s="";for(let a=0,o=0;a<this.children.length&&o<=r;a++){let l=this.children[a],u=o+l.length;o>n&&a&&(s+=i),n<u&&r>o&&(s+=l.sliceString(n-o,r-o,i)),o=u+1}return s}flatten(n){for(let r of this.children)r.flatten(n)}scanIdentical(n,r){if(!(n instanceof Oo))return 0;let i=0,[s,a,o,l]=r>0?[0,0,this.children.length,n.children.length]:[this.children.length-1,n.children.length-1,-1,-1];for(;;s+=r,a+=r){if(s==o||a==l)return i;let u=this.children[s],d=n.children[a];if(u!=d)return i+u.scanIdentical(d,r);i+=u.length+1}}static from(n,r=n.reduce((i,s)=>i+s.length+1,-1)){let i=0;for(let _ of n)i+=_.lines;if(i<32){let _=[];for(let x of n)x.flatten(_);return new Br(_,r)}let s=Math.max(32,i>>5),a=s<<1,o=s>>1,l=[],u=0,d=-1,p=[];function f(_){let x;if(_.lines>a&&_ instanceof Oo)for(let v of _.children)f(v);else _.lines>o&&(u>o||!u)?(g(),l.push(_)):_ instanceof Br&&u&&(x=p[p.length-1])instanceof Br&&_.lines+x.lines<=32?(u+=_.lines,d+=_.length+1,p[p.length-1]=new Br(x.text.concat(_.text),x.length+1+_.length)):(u+_.lines>s&&g(),u+=_.lines,d+=_.length+1,p.push(_))}function g(){u!=0&&(l.push(p.length==1?p[0]:Oo.from(p,d)),d=-1,u=p.length=0)}for(let _ of n)f(_);return g(),l.length==1?l[0]:new Oo(l,r)}}Pn.empty=new Br([""],0);function a_e(e){let n=-1;for(let r of e)n+=r.length+1;return n}function mx(e,n,r=0,i=1e9){for(let s=0,a=0,o=!0;a<e.length&&s<=i;a++){let l=e[a],u=s+l.length;u>=r&&(u>i&&(l=l.slice(0,i-s)),s<r&&(l=l.slice(r-s)),o?(n[n.length-1]+=l,o=!1):n.push(l)),s=u+1}return n}function dP(e,n,r){return mx(e,[""],n,r)}class Zm{constructor(n,r=1){this.dir=r,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[n],this.offsets=[r>0?1:(n instanceof Br?n.text.length:n.children.length)<<1]}nextInner(n,r){for(this.done=this.lineBreak=!1;;){let i=this.nodes.length-1,s=this.nodes[i],a=this.offsets[i],o=a>>1,l=s instanceof Br?s.text.length:s.children.length;if(o==(r>0?l:0)){if(i==0)return this.done=!0,this.value="",this;r>0&&this.offsets[i-1]++,this.nodes.pop(),this.offsets.pop()}else if((a&1)==(r>0?0:1)){if(this.offsets[i]+=r,n==0)return this.lineBreak=!0,this.value=`
`,this;n--}else if(s instanceof Br){let u=s.text[o+(r<0?-1:0)];if(this.offsets[i]+=r,u.length>Math.max(0,n))return this.value=n==0?u:r>0?u.slice(n):u.slice(0,u.length-n),this;n-=u.length}else{let u=s.children[o+(r<0?-1:0)];n>u.length?(n-=u.length,this.offsets[i]+=r):(r<0&&this.offsets[i]--,this.nodes.push(u),this.offsets.push(r>0?1:(u instanceof Br?u.text.length:u.children.length)<<1))}}}next(n=0){return n<0&&(this.nextInner(-n,-this.dir),n=this.value.length),this.nextInner(n,this.dir)}}class IF{constructor(n,r,i){this.value="",this.done=!1,this.cursor=new Zm(n,r>i?-1:1),this.pos=r>i?n.length:0,this.from=Math.min(r,i),this.to=Math.max(r,i)}nextInner(n,r){if(r<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;n+=Math.max(0,r<0?this.pos-this.to:this.from-this.pos);let i=r<0?this.pos-this.from:this.to-this.pos;n>i&&(n=i),i-=n;let{value:s}=this.cursor.next(n);return this.pos+=(s.length+n)*r,this.value=s.length<=i?s:r<0?s.slice(s.length-i):s.slice(0,i),this.done=!this.value,this}next(n=0){return n<0?n=Math.max(n,this.from-this.pos):n>0&&(n=Math.min(n,this.to-this.pos)),this.nextInner(n,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class BF{constructor(n){this.inner=n,this.afterBreak=!0,this.value="",this.done=!1}next(n=0){let{done:r,lineBreak:i,value:s}=this.inner.next(n);return r&&this.afterBreak?(this.value="",this.afterBreak=!1):r?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=s,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(Pn.prototype[Symbol.iterator]=function(){return this.iter()},Zm.prototype[Symbol.iterator]=IF.prototype[Symbol.iterator]=BF.prototype[Symbol.iterator]=function(){return this});class o_e{constructor(n,r,i,s){this.from=n,this.to=r,this.number=i,this.text=s}get length(){return this.to-this.from}}function Of(e,n,r){return n=Math.max(0,Math.min(e.length,n)),[n,Math.max(n,Math.min(e.length,r))]}function pi(e,n,r=!0,i=!0){return i_e(e,n,r,i)}function l_e(e){return e>=56320&&e<57344}function c_e(e){return e>=55296&&e<56320}function _s(e,n){let r=e.charCodeAt(n);if(!c_e(r)||n+1==e.length)return r;let i=e.charCodeAt(n+1);return l_e(i)?(r-55296<<10)+(i-56320)+65536:r}function EA(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320))}function Do(e){return e<65536?1:2}const Cj=/\r\n?|\n/;var Zi=(function(e){return e[e.Simple=0]="Simple",e[e.TrackDel=1]="TrackDel",e[e.TrackBefore=2]="TrackBefore",e[e.TrackAfter=3]="TrackAfter",e})(Zi||(Zi={}));class Ko{constructor(n){this.sections=n}get length(){let n=0;for(let r=0;r<this.sections.length;r+=2)n+=this.sections[r];return n}get newLength(){let n=0;for(let r=0;r<this.sections.length;r+=2){let i=this.sections[r+1];n+=i<0?this.sections[r]:i}return n}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(n){for(let r=0,i=0,s=0;r<this.sections.length;){let a=this.sections[r++],o=this.sections[r++];o<0?(n(i,s,a),s+=a):s+=o,i+=a}}iterChangedRanges(n,r=!1){jj(this,n,r)}get invertedDesc(){let n=[];for(let r=0;r<this.sections.length;){let i=this.sections[r++],s=this.sections[r++];s<0?n.push(i,s):n.push(s,i)}return new Ko(n)}composeDesc(n){return this.empty?n:n.empty?this:zF(this,n)}mapDesc(n,r=!1){return n.empty?this:Nj(this,n,r)}mapPos(n,r=-1,i=Zi.Simple){let s=0,a=0;for(let o=0;o<this.sections.length;){let l=this.sections[o++],u=this.sections[o++],d=s+l;if(u<0){if(d>n)return a+(n-s);a+=l}else{if(i!=Zi.Simple&&d>=n&&(i==Zi.TrackDel&&s<n&&d>n||i==Zi.TrackBefore&&s<n||i==Zi.TrackAfter&&d>n))return null;if(d>n||d==n&&r<0&&!l)return n==s||r<0?a:a+u;a+=u}s=d}if(n>s)throw new RangeError(`Position ${n} is out of range for changeset of length ${s}`);return a}touchesRange(n,r=n){for(let i=0,s=0;i<this.sections.length&&s<=r;){let a=this.sections[i++],o=this.sections[i++],l=s+a;if(o>=0&&s<=r&&l>=n)return s<n&&l>r?"cover":!0;s=l}return!1}toString(){let n="";for(let r=0;r<this.sections.length;){let i=this.sections[r++],s=this.sections[r++];n+=(n?" ":"")+i+(s>=0?":"+s:"")}return n}toJSON(){return this.sections}static fromJSON(n){if(!Array.isArray(n)||n.length%2||n.some(r=>typeof r!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new Ko(n)}static create(n){return new Ko(n)}}class ni extends Ko{constructor(n,r){super(n),this.inserted=r}apply(n){if(this.length!=n.length)throw new RangeError("Applying change set to a document with the wrong length");return jj(this,(r,i,s,a,o)=>n=n.replace(s,s+(i-r),o),!1),n}mapDesc(n,r=!1){return Nj(this,n,r,!0)}invert(n){let r=this.sections.slice(),i=[];for(let s=0,a=0;s<r.length;s+=2){let o=r[s],l=r[s+1];if(l>=0){r[s]=l,r[s+1]=o;let u=s>>1;for(;i.length<u;)i.push(Pn.empty);i.push(o?n.slice(a,a+o):Pn.empty)}a+=o}return new ni(r,i)}compose(n){return this.empty?n:n.empty?this:zF(this,n,!0)}map(n,r=!1){return n.empty?this:Nj(this,n,r,!0)}iterChanges(n,r=!1){jj(this,n,r)}get desc(){return Ko.create(this.sections)}filter(n){let r=[],i=[],s=[],a=new Ag(this);e:for(let o=0,l=0;;){let u=o==n.length?1e9:n[o++];for(;l<u||l==u&&a.len==0;){if(a.done)break e;let p=Math.min(a.len,u-l);$i(s,p,-1);let f=a.ins==-1?-1:a.off==0?a.ins:0;$i(r,p,f),f>0&&Kc(i,r,a.text),a.forward(p),l+=p}let d=n[o++];for(;l<d;){if(a.done)break e;let p=Math.min(a.len,d-l);$i(r,p,-1),$i(s,p,a.ins==-1?-1:a.off==0?a.ins:0),a.forward(p),l+=p}}return{changes:new ni(r,i),filtered:Ko.create(s)}}toJSON(){let n=[];for(let r=0;r<this.sections.length;r+=2){let i=this.sections[r],s=this.sections[r+1];s<0?n.push(i):s==0?n.push([i]):n.push([i].concat(this.inserted[r>>1].toJSON()))}return n}static of(n,r,i){let s=[],a=[],o=0,l=null;function u(p=!1){if(!p&&!s.length)return;o<r&&$i(s,r-o,-1);let f=new ni(s,a);l=l?l.compose(f.map(l)):f,s=[],a=[],o=0}function d(p){if(Array.isArray(p))for(let f of p)d(f);else if(p instanceof ni){if(p.length!=r)throw new RangeError(`Mismatched change set length (got ${p.length}, expected ${r})`);u(),l=l?l.compose(p.map(l)):p}else{let{from:f,to:g=f,insert:_}=p;if(f>g||f<0||g>r)throw new RangeError(`Invalid change range ${f} to ${g} (in doc of length ${r})`);let x=_?typeof _=="string"?Pn.of(_.split(i||Cj)):_:Pn.empty,v=x.length;if(f==g&&v==0)return;f<o&&u(),f>o&&$i(s,f-o,-1),$i(s,g-f,v),Kc(a,s,x),o=g}}return d(n),u(!l),l}static empty(n){return new ni(n?[n,-1]:[],[])}static fromJSON(n){if(!Array.isArray(n))throw new RangeError("Invalid JSON representation of ChangeSet");let r=[],i=[];for(let s=0;s<n.length;s++){let a=n[s];if(typeof a=="number")r.push(a,-1);else{if(!Array.isArray(a)||typeof a[0]!="number"||a.some((o,l)=>l&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(a.length==1)r.push(a[0],0);else{for(;i.length<s;)i.push(Pn.empty);i[s]=Pn.of(a.slice(1)),r.push(a[0],i[s].length)}}}return new ni(r,i)}static createSet(n,r){return new ni(n,r)}}function $i(e,n,r,i=!1){if(n==0&&r<=0)return;let s=e.length-2;s>=0&&r<=0&&r==e[s+1]?e[s]+=n:s>=0&&n==0&&e[s]==0?e[s+1]+=r:i?(e[s]+=n,e[s+1]+=r):e.push(n,r)}function Kc(e,n,r){if(r.length==0)return;let i=n.length-2>>1;if(i<e.length)e[e.length-1]=e[e.length-1].append(r);else{for(;e.length<i;)e.push(Pn.empty);e.push(r)}}function jj(e,n,r){let i=e.inserted;for(let s=0,a=0,o=0;o<e.sections.length;){let l=e.sections[o++],u=e.sections[o++];if(u<0)s+=l,a+=l;else{let d=s,p=a,f=Pn.empty;for(;d+=l,p+=u,u&&i&&(f=f.append(i[o-2>>1])),!(r||o==e.sections.length||e.sections[o+1]<0);)l=e.sections[o++],u=e.sections[o++];n(s,d,a,p,f),s=d,a=p}}}function Nj(e,n,r,i=!1){let s=[],a=i?[]:null,o=new Ag(e),l=new Ag(n);for(let u=-1;;){if(o.done&&l.len||l.done&&o.len)throw new Error("Mismatched change set lengths");if(o.ins==-1&&l.ins==-1){let d=Math.min(o.len,l.len);$i(s,d,-1),o.forward(d),l.forward(d)}else if(l.ins>=0&&(o.ins<0||u==o.i||o.off==0&&(l.len<o.len||l.len==o.len&&!r))){let d=l.len;for($i(s,l.ins,-1);d;){let p=Math.min(o.len,d);o.ins>=0&&u<o.i&&o.len<=p&&($i(s,0,o.ins),a&&Kc(a,s,o.text),u=o.i),o.forward(p),d-=p}l.next()}else if(o.ins>=0){let d=0,p=o.len;for(;p;)if(l.ins==-1){let f=Math.min(p,l.len);d+=f,p-=f,l.forward(f)}else if(l.ins==0&&l.len<p)p-=l.len,l.next();else break;$i(s,d,u<o.i?o.ins:0),a&&u<o.i&&Kc(a,s,o.text),u=o.i,o.forward(o.len-p)}else{if(o.done&&l.done)return a?ni.createSet(s,a):Ko.create(s);throw new Error("Mismatched change set lengths")}}}function zF(e,n,r=!1){let i=[],s=r?[]:null,a=new Ag(e),o=new Ag(n);for(let l=!1;;){if(a.done&&o.done)return s?ni.createSet(i,s):Ko.create(i);if(a.ins==0)$i(i,a.len,0,l),a.next();else if(o.len==0&&!o.done)$i(i,0,o.ins,l),s&&Kc(s,i,o.text),o.next();else{if(a.done||o.done)throw new Error("Mismatched change set lengths");{let u=Math.min(a.len2,o.len),d=i.length;if(a.ins==-1){let p=o.ins==-1?-1:o.off?0:o.ins;$i(i,u,p,l),s&&p&&Kc(s,i,o.text)}else o.ins==-1?($i(i,a.off?0:a.len,u,l),s&&Kc(s,i,a.textBit(u))):($i(i,a.off?0:a.len,o.off?0:o.ins,l),s&&!o.off&&Kc(s,i,o.text));l=(a.ins>u||o.ins>=0&&o.len>u)&&(l||i.length>d),a.forward2(u),o.forward(u)}}}}class Ag{constructor(n){this.set=n,this.i=0,this.next()}next(){let{sections:n}=this.set;this.i<n.length?(this.len=n[this.i++],this.ins=n[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:n}=this.set,r=this.i-2>>1;return r>=n.length?Pn.empty:n[r]}textBit(n){let{inserted:r}=this.set,i=this.i-2>>1;return i>=r.length&&!n?Pn.empty:r[i].slice(this.off,n==null?void 0:this.off+n)}forward(n){n==this.len?this.next():(this.len-=n,this.off+=n)}forward2(n){this.ins==-1?this.forward(n):n==this.ins?this.next():(this.ins-=n,this.off+=n)}}class ld{constructor(n,r,i){this.from=n,this.to=r,this.flags=i}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let n=this.flags&7;return n==7?null:n}get goalColumn(){let n=this.flags>>6;return n==16777215?void 0:n}map(n,r=-1){let i,s;return this.empty?i=s=n.mapPos(this.from,r):(i=n.mapPos(this.from,1),s=n.mapPos(this.to,-1)),i==this.from&&s==this.to?this:new ld(i,s,this.flags)}extend(n,r=n,i=0){if(n<=this.anchor&&r>=this.anchor)return Ze.range(n,r,void 0,void 0,i);let s=Math.abs(n-this.anchor)>Math.abs(r-this.anchor)?n:r;return Ze.range(this.anchor,s,void 0,void 0,i)}eq(n,r=!1){return this.anchor==n.anchor&&this.head==n.head&&this.goalColumn==n.goalColumn&&(!r||!this.empty||this.assoc==n.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(n){if(!n||typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return Ze.range(n.anchor,n.head)}static create(n,r,i){return new ld(n,r,i)}}class Ze{constructor(n,r){this.ranges=n,this.mainIndex=r}map(n,r=-1){return n.empty?this:Ze.create(this.ranges.map(i=>i.map(n,r)),this.mainIndex)}eq(n,r=!1){if(this.ranges.length!=n.ranges.length||this.mainIndex!=n.mainIndex)return!1;for(let i=0;i<this.ranges.length;i++)if(!this.ranges[i].eq(n.ranges[i],r))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new Ze([this.main],0)}addRange(n,r=!0){return Ze.create([n].concat(this.ranges),r?0:this.mainIndex+1)}replaceRange(n,r=this.mainIndex){let i=this.ranges.slice();return i[r]=n,Ze.create(i,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(n=>n.toJSON()),main:this.mainIndex}}static fromJSON(n){if(!n||!Array.isArray(n.ranges)||typeof n.main!="number"||n.main>=n.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new Ze(n.ranges.map(r=>ld.fromJSON(r)),n.main)}static single(n,r=n){return new Ze([Ze.range(n,r)],0)}static create(n,r=0){if(n.length==0)throw new RangeError("A selection needs at least one range");for(let i=0,s=0;s<n.length;s++){let a=n[s];if(a.empty?a.from<=i:a.from<i)return Ze.normalized(n.slice(),r);i=a.to}return new Ze(n,r)}static cursor(n,r=0,i,s){return ld.create(n,n,(r==0?0:r<0?8:16)|(i==null?7:Math.min(6,i))|(s??16777215)<<6)}static range(n,r,i,s,a){let o=(i??16777215)<<6|(s==null?7:Math.min(6,s));return!a&&n!=r&&(a=r<n?1:-1),r<n?ld.create(r,n,48|o):ld.create(n,r,(a?a<0?8:16:0)|o)}static normalized(n,r=0){let i=n[r];n.sort((s,a)=>s.from-a.from),r=n.indexOf(i);for(let s=1;s<n.length;s++){let a=n[s],o=n[s-1];if(a.empty?a.from<=o.to:a.from<o.to){let l=o.from,u=Math.max(a.to,o.to);s<=r&&r--,n.splice(--s,2,a.anchor>a.head?Ze.range(u,l):Ze.range(l,u))}}return new Ze(n,r)}}function $F(e,n){for(let r of e.ranges)if(r.to>n)throw new RangeError("Selection points outside of document")}let AA=0;class jt{constructor(n,r,i,s,a){this.combine=n,this.compareInput=r,this.compare=i,this.isStatic=s,this.id=AA++,this.default=n([]),this.extensions=typeof a=="function"?a(this):a}get reader(){return this}static define(n={}){return new jt(n.combine||(r=>r),n.compareInput||((r,i)=>r===i),n.compare||(n.combine?(r,i)=>r===i:TA),!!n.static,n.enables)}of(n){return new gx([],this,0,n)}compute(n,r){if(this.isStatic)throw new Error("Can't compute a static facet");return new gx(n,this,1,r)}computeN(n,r){if(this.isStatic)throw new Error("Can't compute a static facet");return new gx(n,this,2,r)}from(n,r){return r||(r=i=>i),this.compute([n],i=>r(i.field(n)))}}function TA(e,n){return e==n||e.length==n.length&&e.every((r,i)=>r===n[i])}class gx{constructor(n,r,i,s){this.dependencies=n,this.facet=r,this.type=i,this.value=s,this.id=AA++}dynamicSlot(n){var r;let i=this.value,s=this.facet.compareInput,a=this.id,o=n[a]>>1,l=this.type==2,u=!1,d=!1,p=[];for(let f of this.dependencies)f=="doc"?u=!0:f=="selection"?d=!0:(((r=n[f.id])!==null&&r!==void 0?r:1)&1)==0&&p.push(n[f.id]);return{create(f){return f.values[o]=i(f),1},update(f,g){if(u&&g.docChanged||d&&(g.docChanged||g.selection)||Ej(f,p)){let _=i(f);if(l?!hP(_,f.values[o],s):!s(_,f.values[o]))return f.values[o]=_,1}return 0},reconfigure:(f,g)=>{let _,x=g.config.address[a];if(x!=null){let v=ub(g,x);if(this.dependencies.every(S=>S instanceof jt?g.facet(S)===f.facet(S):S instanceof vi?g.field(S,!1)==f.field(S,!1):!0)||(l?hP(_=i(f),v,s):s(_=i(f),v)))return f.values[o]=v,0}else _=i(f);return f.values[o]=_,1}}}}function hP(e,n,r){if(e.length!=n.length)return!1;for(let i=0;i<e.length;i++)if(!r(e[i],n[i]))return!1;return!0}function Ej(e,n){let r=!1;for(let i of n)Jm(e,i)&1&&(r=!0);return r}function u_e(e,n,r){let i=r.map(u=>e[u.id]),s=r.map(u=>u.type),a=i.filter(u=>!(u&1)),o=e[n.id]>>1;function l(u){let d=[];for(let p=0;p<i.length;p++){let f=ub(u,i[p]);if(s[p]==2)for(let g of f)d.push(g);else d.push(f)}return n.combine(d)}return{create(u){for(let d of i)Jm(u,d);return u.values[o]=l(u),1},update(u,d){if(!Ej(u,a))return 0;let p=l(u);return n.compare(p,u.values[o])?0:(u.values[o]=p,1)},reconfigure(u,d){let p=Ej(u,i),f=d.config.facets[n.id],g=d.facet(n);if(f&&!p&&TA(r,f))return u.values[o]=g,0;let _=l(u);return n.compare(_,g)?(u.values[o]=g,0):(u.values[o]=_,1)}}}const u_=jt.define({static:!0});class vi{constructor(n,r,i,s,a){this.id=n,this.createF=r,this.updateF=i,this.compareF=s,this.spec=a,this.provides=void 0}static define(n){let r=new vi(AA++,n.create,n.update,n.compare||((i,s)=>i===s),n);return n.provide&&(r.provides=n.provide(r)),r}create(n){let r=n.facet(u_).find(i=>i.field==this);return((r==null?void 0:r.create)||this.createF)(n)}slot(n){let r=n[this.id]>>1;return{create:i=>(i.values[r]=this.create(i),1),update:(i,s)=>{let a=i.values[r],o=this.updateF(a,s);return this.compareF(a,o)?0:(i.values[r]=o,1)},reconfigure:(i,s)=>{let a=i.facet(u_),o=s.facet(u_),l;return(l=a.find(u=>u.field==this))&&l!=o.find(u=>u.field==this)?(i.values[r]=l.create(i),1):s.config.address[this.id]!=null?(i.values[r]=s.field(this),0):(i.values[r]=this.create(i),1)}}}init(n){return[this,u_.of({field:this,create:n})]}get extension(){return this}}const td={lowest:4,low:3,default:2,high:1,highest:0};function im(e){return n=>new FF(n,e)}const Ld={highest:im(td.highest),high:im(td.high),default:im(td.default),low:im(td.low),lowest:im(td.lowest)};class FF{constructor(n,r){this.inner=n,this.prec=r}}class M0{of(n){return new Aj(this,n)}reconfigure(n){return M0.reconfigure.of({compartment:this,extension:n})}get(n){return n.config.compartments.get(this)}}class Aj{constructor(n,r){this.compartment=n,this.inner=r}}class cb{constructor(n,r,i,s,a,o){for(this.base=n,this.compartments=r,this.dynamicSlots=i,this.address=s,this.staticValues=a,this.facets=o,this.statusTemplate=[];this.statusTemplate.length<i.length;)this.statusTemplate.push(0)}staticFacet(n){let r=this.address[n.id];return r==null?n.default:this.staticValues[r>>1]}static resolve(n,r,i){let s=[],a=Object.create(null),o=new Map;for(let g of d_e(n,r,o))g instanceof vi?s.push(g):(a[g.facet.id]||(a[g.facet.id]=[])).push(g);let l=Object.create(null),u=[],d=[];for(let g of s)l[g.id]=d.length<<1,d.push(_=>g.slot(_));let p=i==null?void 0:i.config.facets;for(let g in a){let _=a[g],x=_[0].facet,v=p&&p[g]||[];if(_.every(S=>S.type==0))if(l[x.id]=u.length<<1|1,TA(v,_))u.push(i.facet(x));else{let S=x.combine(_.map(w=>w.value));u.push(i&&x.compare(S,i.facet(x))?i.facet(x):S)}else{for(let S of _)S.type==0?(l[S.id]=u.length<<1|1,u.push(S.value)):(l[S.id]=d.length<<1,d.push(w=>S.dynamicSlot(w)));l[x.id]=d.length<<1,d.push(S=>u_e(S,x,_))}}let f=d.map(g=>g(l));return new cb(n,o,f,l,u,a)}}function d_e(e,n,r){let i=[[],[],[],[],[]],s=new Map;function a(o,l){let u=s.get(o);if(u!=null){if(u<=l)return;let d=i[u].indexOf(o);d>-1&&i[u].splice(d,1),o instanceof Aj&&r.delete(o.compartment)}if(s.set(o,l),Array.isArray(o))for(let d of o)a(d,l);else if(o instanceof Aj){if(r.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let d=n.get(o.compartment)||o.inner;r.set(o.compartment,d),a(d,l)}else if(o instanceof FF)a(o.inner,o.prec);else if(o instanceof vi)i[l].push(o),o.provides&&a(o.provides,l);else if(o instanceof gx)i[l].push(o),o.facet.extensions&&a(o.facet.extensions,td.default);else{let d=o.extension;if(!d)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);a(d,l)}}return a(e,td.default),i.reduce((o,l)=>o.concat(l))}function Jm(e,n){if(n&1)return 2;let r=n>>1,i=e.status[r];if(i==4)throw new Error("Cyclic dependency between fields and/or facets");if(i&2)return i;e.status[r]=4;let s=e.computeSlot(e,e.config.dynamicSlots[r]);return e.status[r]=2|s}function ub(e,n){return n&1?e.config.staticValues[n>>1]:e.values[n>>1]}const HF=jt.define(),Tj=jt.define({combine:e=>e.some(n=>n),static:!0}),WF=jt.define({combine:e=>e.length?e[0]:void 0,static:!0}),qF=jt.define(),UF=jt.define(),VF=jt.define(),KF=jt.define({combine:e=>e.length?e[0]:!1});class tl{constructor(n,r){this.type=n,this.value=r}static define(){return new h_e}}class h_e{of(n){return new tl(this,n)}}class f_e{constructor(n){this.map=n}of(n){return new Zt(this,n)}}class Zt{constructor(n,r){this.type=n,this.value=r}map(n){let r=this.type.map(this.value,n);return r===void 0?void 0:r==this.value?this:new Zt(this.type,r)}is(n){return this.type==n}static define(n={}){return new f_e(n.map||(r=>r))}static mapEffects(n,r){if(!n.length)return n;let i=[];for(let s of n){let a=s.map(r);a&&i.push(a)}return i}}Zt.reconfigure=Zt.define();Zt.appendConfig=Zt.define();class ri{constructor(n,r,i,s,a,o){this.startState=n,this.changes=r,this.selection=i,this.effects=s,this.annotations=a,this.scrollIntoView=o,this._doc=null,this._state=null,i&&$F(i,r.newLength),a.some(l=>l.type==ri.time)||(this.annotations=a.concat(ri.time.of(Date.now())))}static create(n,r,i,s,a,o){return new ri(n,r,i,s,a,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(n){for(let r of this.annotations)if(r.type==n)return r.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(n){let r=this.annotation(ri.userEvent);return!!(r&&(r==n||r.length>n.length&&r.slice(0,n.length)==n&&r[n.length]=="."))}}ri.time=tl.define();ri.userEvent=tl.define();ri.addToHistory=tl.define();ri.remote=tl.define();function p_e(e,n){let r=[];for(let i=0,s=0;;){let a,o;if(i<e.length&&(s==n.length||n[s]>=e[i]))a=e[i++],o=e[i++];else if(s<n.length)a=n[s++],o=n[s++];else return r;!r.length||r[r.length-1]<a?r.push(a,o):r[r.length-1]<o&&(r[r.length-1]=o)}}function YF(e,n,r){var i;let s,a,o;return r?(s=n.changes,a=ni.empty(n.changes.length),o=e.changes.compose(n.changes)):(s=n.changes.map(e.changes),a=e.changes.mapDesc(n.changes,!0),o=e.changes.compose(s)),{changes:o,selection:n.selection?n.selection.map(a):(i=e.selection)===null||i===void 0?void 0:i.map(s),effects:Zt.mapEffects(e.effects,s).concat(Zt.mapEffects(n.effects,a)),annotations:e.annotations.length?e.annotations.concat(n.annotations):n.annotations,scrollIntoView:e.scrollIntoView||n.scrollIntoView}}function Mj(e,n,r){let i=n.selection,s=uf(n.annotations);return n.userEvent&&(s=s.concat(ri.userEvent.of(n.userEvent))),{changes:n.changes instanceof ni?n.changes:ni.of(n.changes||[],r,e.facet(WF)),selection:i&&(i instanceof Ze?i:Ze.single(i.anchor,i.head)),effects:uf(n.effects),annotations:s,scrollIntoView:!!n.scrollIntoView}}function GF(e,n,r){let i=Mj(e,n.length?n[0]:{},e.doc.length);n.length&&n[0].filter===!1&&(r=!1);for(let a=1;a<n.length;a++){n[a].filter===!1&&(r=!1);let o=!!n[a].sequential;i=YF(i,Mj(e,n[a],o?i.changes.newLength:e.doc.length),o)}let s=ri.create(e,i.changes,i.selection,i.effects,i.annotations,i.scrollIntoView);return g_e(r?m_e(s):s)}function m_e(e){let n=e.startState,r=!0;for(let s of n.facet(qF)){let a=s(e);if(a===!1){r=!1;break}Array.isArray(a)&&(r=r===!0?a:p_e(r,a))}if(r!==!0){let s,a;if(r===!1)a=e.changes.invertedDesc,s=ni.empty(n.doc.length);else{let o=e.changes.filter(r);s=o.changes,a=o.filtered.mapDesc(o.changes).invertedDesc}e=ri.create(n,s,e.selection&&e.selection.map(a),Zt.mapEffects(e.effects,a),e.annotations,e.scrollIntoView)}let i=n.facet(UF);for(let s=i.length-1;s>=0;s--){let a=i[s](e);a instanceof ri?e=a:Array.isArray(a)&&a.length==1&&a[0]instanceof ri?e=a[0]:e=GF(n,uf(a),!1)}return e}function g_e(e){let n=e.startState,r=n.facet(VF),i=e;for(let s=r.length-1;s>=0;s--){let a=r[s](e);a&&Object.keys(a).length&&(i=YF(i,Mj(n,a,e.changes.newLength),!0))}return i==e?e:ri.create(n,e.changes,e.selection,i.effects,i.annotations,i.scrollIntoView)}const v_e=[];function uf(e){return e==null?v_e:Array.isArray(e)?e:[e]}var yr=(function(e){return e[e.Word=0]="Word",e[e.Space=1]="Space",e[e.Other=2]="Other",e})(yr||(yr={}));const y_e=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let Rj;try{Rj=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function __e(e){if(Rj)return Rj.test(e);for(let n=0;n<e.length;n++){let r=e[n];if(/\w/.test(r)||r>""&&(r.toUpperCase()!=r.toLowerCase()||y_e.test(r)))return!0}return!1}function x_e(e){return n=>{if(!/\S/.test(n))return yr.Space;if(__e(n))return yr.Word;for(let r=0;r<e.length;r++)if(n.indexOf(e[r])>-1)return yr.Word;return yr.Other}}class bn{constructor(n,r,i,s,a,o){this.config=n,this.doc=r,this.selection=i,this.values=s,this.status=n.statusTemplate.slice(),this.computeSlot=a,o&&(o._state=this);for(let l=0;l<this.config.dynamicSlots.length;l++)Jm(this,l<<1);this.computeSlot=null}field(n,r=!0){let i=this.config.address[n.id];if(i==null){if(r)throw new RangeError("Field is not present in this state");return}return Jm(this,i),ub(this,i)}update(...n){return GF(this,n,!0)}applyTransaction(n){let r=this.config,{base:i,compartments:s}=r;for(let l of n.effects)l.is(M0.reconfigure)?(r&&(s=new Map,r.compartments.forEach((u,d)=>s.set(d,u)),r=null),s.set(l.value.compartment,l.value.extension)):l.is(Zt.reconfigure)?(r=null,i=l.value):l.is(Zt.appendConfig)&&(r=null,i=uf(i).concat(l.value));let a;r?a=n.startState.values.slice():(r=cb.resolve(i,s,this),a=new bn(r,this.doc,this.selection,r.dynamicSlots.map(()=>null),(u,d)=>d.reconfigure(u,this),null).values);let o=n.startState.facet(Tj)?n.newSelection:n.newSelection.asSingle();new bn(r,n.newDoc,o,a,(l,u)=>u.update(l,n),n)}replaceSelection(n){return typeof n=="string"&&(n=this.toText(n)),this.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:n},range:Ze.cursor(r.from+n.length)}))}changeByRange(n){let r=this.selection,i=n(r.ranges[0]),s=this.changes(i.changes),a=[i.range],o=uf(i.effects);for(let l=1;l<r.ranges.length;l++){let u=n(r.ranges[l]),d=this.changes(u.changes),p=d.map(s);for(let g=0;g<l;g++)a[g]=a[g].map(p);let f=s.mapDesc(d,!0);a.push(u.range.map(f)),s=s.compose(p),o=Zt.mapEffects(o,p).concat(Zt.mapEffects(uf(u.effects),f))}return{changes:s,selection:Ze.create(a,r.mainIndex),effects:o}}changes(n=[]){return n instanceof ni?n:ni.of(n,this.doc.length,this.facet(bn.lineSeparator))}toText(n){return Pn.of(n.split(this.facet(bn.lineSeparator)||Cj))}sliceDoc(n=0,r=this.doc.length){return this.doc.sliceString(n,r,this.lineBreak)}facet(n){let r=this.config.address[n.id];return r==null?n.default:(Jm(this,r),ub(this,r))}toJSON(n){let r={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(n)for(let i in n){let s=n[i];s instanceof vi&&this.config.address[s.id]!=null&&(r[i]=s.spec.toJSON(this.field(n[i]),this))}return r}static fromJSON(n,r={},i){if(!n||typeof n.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let s=[];if(i){for(let a in i)if(Object.prototype.hasOwnProperty.call(n,a)){let o=i[a],l=n[a];s.push(o.init(u=>o.spec.fromJSON(l,u)))}}return bn.create({doc:n.doc,selection:Ze.fromJSON(n.selection),extensions:r.extensions?s.concat([r.extensions]):s})}static create(n={}){let r=cb.resolve(n.extensions||[],new Map),i=n.doc instanceof Pn?n.doc:Pn.of((n.doc||"").split(r.staticFacet(bn.lineSeparator)||Cj)),s=n.selection?n.selection instanceof Ze?n.selection:Ze.single(n.selection.anchor,n.selection.head):Ze.single(0);return $F(s,i.length),r.staticFacet(Tj)||(s=s.asSingle()),new bn(r,i,s,r.dynamicSlots.map(()=>null),(a,o)=>o.create(a),null)}get tabSize(){return this.facet(bn.tabSize)}get lineBreak(){return this.facet(bn.lineSeparator)||`
`}get readOnly(){return this.facet(KF)}phrase(n,...r){for(let i of this.facet(bn.phrases))if(Object.prototype.hasOwnProperty.call(i,n)){n=i[n];break}return r.length&&(n=n.replace(/\$(\$|\d*)/g,(i,s)=>{if(s=="$")return"$";let a=+(s||1);return!a||a>r.length?i:r[a-1]})),n}languageDataAt(n,r,i=-1){let s=[];for(let a of this.facet(HF))for(let o of a(this,r,i))Object.prototype.hasOwnProperty.call(o,n)&&s.push(o[n]);return s}charCategorizer(n){let r=this.languageDataAt("wordChars",n);return x_e(r.length?r[0]:"")}wordAt(n){let{text:r,from:i,length:s}=this.doc.lineAt(n),a=this.charCategorizer(n),o=n-i,l=n-i;for(;o>0;){let u=pi(r,o,!1);if(a(r.slice(u,o))!=yr.Word)break;o=u}for(;l<s;){let u=pi(r,l);if(a(r.slice(l,u))!=yr.Word)break;l=u}return o==l?null:Ze.range(o+i,l+i)}}bn.allowMultipleSelections=Tj;bn.tabSize=jt.define({combine:e=>e.length?e[0]:4});bn.lineSeparator=WF;bn.readOnly=KF;bn.phrases=jt.define({compare(e,n){let r=Object.keys(e),i=Object.keys(n);return r.length==i.length&&r.every(s=>e[s]==n[s])}});bn.languageData=HF;bn.changeFilter=qF;bn.transactionFilter=UF;bn.transactionExtender=VF;M0.reconfigure=Zt.define();function ro(e,n,r={}){let i={};for(let s of e)for(let a of Object.keys(s)){let o=s[a],l=i[a];if(l===void 0)i[a]=o;else if(!(l===o||o===void 0))if(Object.hasOwnProperty.call(r,a))i[a]=r[a](l,o);else throw new Error("Config merge conflict for field "+a)}for(let s in n)i[s]===void 0&&(i[s]=n[s]);return i}class su{eq(n){return this==n}range(n,r=n){return Oj.create(n,r,this)}}su.prototype.startSide=su.prototype.endSide=0;su.prototype.point=!1;su.prototype.mapMode=Zi.TrackDel;function MA(e,n){return e==n||e.constructor==n.constructor&&e.eq(n)}let Oj=class XF{constructor(n,r,i){this.from=n,this.to=r,this.value=i}static create(n,r,i){return new XF(n,r,i)}};function Dj(e,n){return e.from-n.from||e.value.startSide-n.value.startSide}class RA{constructor(n,r,i,s){this.from=n,this.to=r,this.value=i,this.maxPoint=s}get length(){return this.to[this.to.length-1]}findIndex(n,r,i,s=0){let a=i?this.to:this.from;for(let o=s,l=a.length;;){if(o==l)return o;let u=o+l>>1,d=a[u]-n||(i?this.value[u].endSide:this.value[u].startSide)-r;if(u==o)return d>=0?o:l;d>=0?l=u:o=u+1}}between(n,r,i,s){for(let a=this.findIndex(r,-1e9,!0),o=this.findIndex(i,1e9,!1,a);a<o;a++)if(s(this.from[a]+n,this.to[a]+n,this.value[a])===!1)return!1}map(n,r){let i=[],s=[],a=[],o=-1,l=-1;for(let u=0;u<this.value.length;u++){let d=this.value[u],p=this.from[u]+n,f=this.to[u]+n,g,_;if(p==f){let x=r.mapPos(p,d.startSide,d.mapMode);if(x==null||(g=_=x,d.startSide!=d.endSide&&(_=r.mapPos(p,d.endSide),_<g)))continue}else if(g=r.mapPos(p,d.startSide),_=r.mapPos(f,d.endSide),g>_||g==_&&d.startSide>0&&d.endSide<=0)continue;(_-g||d.endSide-d.startSide)<0||(o<0&&(o=g),d.point&&(l=Math.max(l,_-g)),i.push(d),s.push(g-o),a.push(_-o))}return{mapped:i.length?new RA(s,a,i,l):null,pos:o}}}class on{constructor(n,r,i,s){this.chunkPos=n,this.chunk=r,this.nextLayer=i,this.maxPoint=s}static create(n,r,i,s){return new on(n,r,i,s)}get length(){let n=this.chunk.length-1;return n<0?0:Math.max(this.chunkEnd(n),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let n=this.nextLayer.size;for(let r of this.chunk)n+=r.value.length;return n}chunkEnd(n){return this.chunkPos[n]+this.chunk[n].length}update(n){let{add:r=[],sort:i=!1,filterFrom:s=0,filterTo:a=this.length}=n,o=n.filter;if(r.length==0&&!o)return this;if(i&&(r=r.slice().sort(Dj)),this.isEmpty)return r.length?on.of(r):this;let l=new QF(this,null,-1).goto(0),u=0,d=[],p=new Kl;for(;l.value||u<r.length;)if(u<r.length&&(l.from-r[u].from||l.startSide-r[u].value.startSide)>=0){let f=r[u++];p.addInner(f.from,f.to,f.value)||d.push(f)}else l.rangeIndex==1&&l.chunkIndex<this.chunk.length&&(u==r.length||this.chunkEnd(l.chunkIndex)<r[u].from)&&(!o||s>this.chunkEnd(l.chunkIndex)||a<this.chunkPos[l.chunkIndex])&&p.addChunk(this.chunkPos[l.chunkIndex],this.chunk[l.chunkIndex])?l.nextChunk():((!o||s>l.to||a<l.from||o(l.from,l.to,l.value))&&(p.addInner(l.from,l.to,l.value)||d.push(Oj.create(l.from,l.to,l.value))),l.next());return p.finishInner(this.nextLayer.isEmpty&&!d.length?on.empty:this.nextLayer.update({add:d,filter:o,filterFrom:s,filterTo:a}))}map(n){if(n.empty||this.isEmpty)return this;let r=[],i=[],s=-1;for(let o=0;o<this.chunk.length;o++){let l=this.chunkPos[o],u=this.chunk[o],d=n.touchesRange(l,l+u.length);if(d===!1)s=Math.max(s,u.maxPoint),r.push(u),i.push(n.mapPos(l));else if(d===!0){let{mapped:p,pos:f}=u.map(l,n);p&&(s=Math.max(s,p.maxPoint),r.push(p),i.push(f))}}let a=this.nextLayer.map(n);return r.length==0?a:new on(i,r,a||on.empty,s)}between(n,r,i){if(!this.isEmpty){for(let s=0;s<this.chunk.length;s++){let a=this.chunkPos[s],o=this.chunk[s];if(r>=a&&n<=a+o.length&&o.between(a,n-a,r-a,i)===!1)return}this.nextLayer.between(n,r,i)}}iter(n=0){return Tg.from([this]).goto(n)}get isEmpty(){return this.nextLayer==this}static iter(n,r=0){return Tg.from(n).goto(r)}static compare(n,r,i,s,a=-1){let o=n.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=a),l=r.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=a),u=fP(o,l,i),d=new sm(o,u,a),p=new sm(l,u,a);i.iterGaps((f,g,_)=>pP(d,f,p,g,_,s)),i.empty&&i.length==0&&pP(d,0,p,0,0,s)}static eq(n,r,i=0,s){s==null&&(s=999999999);let a=n.filter(p=>!p.isEmpty&&r.indexOf(p)<0),o=r.filter(p=>!p.isEmpty&&n.indexOf(p)<0);if(a.length!=o.length)return!1;if(!a.length)return!0;let l=fP(a,o),u=new sm(a,l,0).goto(i),d=new sm(o,l,0).goto(i);for(;;){if(u.to!=d.to||!Pj(u.active,d.active)||u.point&&(!d.point||!MA(u.point,d.point)))return!1;if(u.to>s)return!0;u.next(),d.next()}}static spans(n,r,i,s,a=-1){let o=new sm(n,null,a).goto(r),l=r,u=o.openStart;for(;;){let d=Math.min(o.to,i);if(o.point){let p=o.activeForPoint(o.to),f=o.pointFrom<r?p.length+1:o.point.startSide<0?p.length:Math.min(p.length,u);s.point(l,d,o.point,p,f,o.pointRank),u=Math.min(o.openEnd(d),p.length)}else d>l&&(s.span(l,d,o.active,u),u=o.openEnd(d));if(o.to>i)return u+(o.point&&o.to>i?1:0);l=o.to,o.next()}}static of(n,r=!1){let i=new Kl;for(let s of n instanceof Oj?[n]:r?b_e(n):n)i.add(s.from,s.to,s.value);return i.finish()}static join(n){if(!n.length)return on.empty;let r=n[n.length-1];for(let i=n.length-2;i>=0;i--)for(let s=n[i];s!=on.empty;s=s.nextLayer)r=new on(s.chunkPos,s.chunk,r,Math.max(s.maxPoint,r.maxPoint));return r}}on.empty=new on([],[],null,-1);function b_e(e){if(e.length>1)for(let n=e[0],r=1;r<e.length;r++){let i=e[r];if(Dj(n,i)>0)return e.slice().sort(Dj);n=i}return e}on.empty.nextLayer=on.empty;class Kl{finishChunk(n){this.chunks.push(new RA(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,n&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(n,r,i){this.addInner(n,r,i)||(this.nextLayer||(this.nextLayer=new Kl)).add(n,r,i)}addInner(n,r,i){let s=n-this.lastTo||i.startSide-this.last.endSide;if(s<=0&&(n-this.lastFrom||i.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return s<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=n),this.from.push(n-this.chunkStart),this.to.push(r-this.chunkStart),this.last=i,this.lastFrom=n,this.lastTo=r,this.value.push(i),i.point&&(this.maxPoint=Math.max(this.maxPoint,r-n)),!0)}addChunk(n,r){if((n-this.lastTo||r.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,r.maxPoint),this.chunks.push(r),this.chunkPos.push(n);let i=r.value.length-1;return this.last=r.value[i],this.lastFrom=r.from[i]+n,this.lastTo=r.to[i]+n,!0}finish(){return this.finishInner(on.empty)}finishInner(n){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return n;let r=on.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(n):n,this.setMaxPoint);return this.from=null,r}}function fP(e,n,r){let i=new Map;for(let a of e)for(let o=0;o<a.chunk.length;o++)a.chunk[o].maxPoint<=0&&i.set(a.chunk[o],a.chunkPos[o]);let s=new Set;for(let a of n)for(let o=0;o<a.chunk.length;o++){let l=i.get(a.chunk[o]);l!=null&&(r?r.mapPos(l):l)==a.chunkPos[o]&&!(r!=null&&r.touchesRange(l,l+a.chunk[o].length))&&s.add(a.chunk[o])}return s}class QF{constructor(n,r,i,s=0){this.layer=n,this.skip=r,this.minPoint=i,this.rank=s}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(n,r=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(n,r,!1),this}gotoInner(n,r,i){for(;this.chunkIndex<this.layer.chunk.length;){let s=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(s)||this.layer.chunkEnd(this.chunkIndex)<n||s.maxPoint<this.minPoint))break;this.chunkIndex++,i=!1}if(this.chunkIndex<this.layer.chunk.length){let s=this.layer.chunk[this.chunkIndex].findIndex(n-this.layer.chunkPos[this.chunkIndex],r,!0);(!i||this.rangeIndex<s)&&this.setRangeIndex(s)}this.next()}forward(n,r){(this.to-n||this.endSide-r)<0&&this.gotoInner(n,r,!0)}next(){for(;;)if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}else{let n=this.layer.chunkPos[this.chunkIndex],r=this.layer.chunk[this.chunkIndex],i=n+r.from[this.rangeIndex];if(this.from=i,this.to=n+r.to[this.rangeIndex],this.value=r.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}setRangeIndex(n){if(n==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex<this.layer.chunk.length&&this.skip.has(this.layer.chunk[this.chunkIndex]);)this.chunkIndex++;this.rangeIndex=0}else this.rangeIndex=n}nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next()}compare(n){return this.from-n.from||this.startSide-n.startSide||this.rank-n.rank||this.to-n.to||this.endSide-n.endSide}}class Tg{constructor(n){this.heap=n}static from(n,r=null,i=-1){let s=[];for(let a=0;a<n.length;a++)for(let o=n[a];!o.isEmpty;o=o.nextLayer)o.maxPoint>=i&&s.push(new QF(o,r,i,a));return s.length==1?s[0]:new Tg(s)}get startSide(){return this.value?this.value.startSide:0}goto(n,r=-1e9){for(let i of this.heap)i.goto(n,r);for(let i=this.heap.length>>1;i>=0;i--)mS(this.heap,i);return this.next(),this}forward(n,r){for(let i of this.heap)i.forward(n,r);for(let i=this.heap.length>>1;i>=0;i--)mS(this.heap,i);(this.to-n||this.value.endSide-r)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let n=this.heap[0];this.from=n.from,this.to=n.to,this.value=n.value,this.rank=n.rank,n.value&&n.next(),mS(this.heap,0)}}}function mS(e,n){for(let r=e[n];;){let i=(n<<1)+1;if(i>=e.length)break;let s=e[i];if(i+1<e.length&&s.compare(e[i+1])>=0&&(s=e[i+1],i++),r.compare(s)<0)break;e[i]=r,e[n]=s,n=i}}class sm{constructor(n,r,i){this.minPoint=i,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=Tg.from(n,r,i)}goto(n,r=-1e9){return this.cursor.goto(n,r),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=n,this.endSide=r,this.openStart=-1,this.next(),this}forward(n,r){for(;this.minActive>-1&&(this.activeTo[this.minActive]-n||this.active[this.minActive].endSide-r)<0;)this.removeActive(this.minActive);this.cursor.forward(n,r)}removeActive(n){d_(this.active,n),d_(this.activeTo,n),d_(this.activeRank,n),this.minActive=mP(this.active,this.activeTo)}addActive(n){let r=0,{value:i,to:s,rank:a}=this.cursor;for(;r<this.activeRank.length&&(a-this.activeRank[r]||s-this.activeTo[r])>0;)r++;h_(this.active,r,i),h_(this.activeTo,r,s),h_(this.activeRank,r,a),n&&h_(n,r,this.cursor.from),this.minActive=mP(this.active,this.activeTo)}next(){let n=this.to,r=this.point;this.point=null;let i=this.openStart<0?[]:null;for(;;){let s=this.minActive;if(s>-1&&(this.activeTo[s]-this.cursor.from||this.active[s].endSide-this.cursor.startSide)<0){if(this.activeTo[s]>n){this.to=this.activeTo[s],this.endSide=this.active[s].endSide;break}this.removeActive(s),i&&d_(i,s)}else if(this.cursor.value)if(this.cursor.from>n){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let a=this.cursor.value;if(!a.point)this.addActive(i),this.cursor.next();else if(r&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)this.cursor.next();else{this.point=a,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=a.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}}else{this.to=this.endSide=1e9;break}}if(i){this.openStart=0;for(let s=i.length-1;s>=0&&i[s]<n;s--)this.openStart++}}activeForPoint(n){if(!this.active.length)return this.active;let r=[];for(let i=this.active.length-1;i>=0&&!(this.activeRank[i]<this.pointRank);i--)(this.activeTo[i]>n||this.activeTo[i]==n&&this.active[i].endSide>=this.point.endSide)&&r.push(this.active[i]);return r.reverse()}openEnd(n){let r=0;for(let i=this.activeTo.length-1;i>=0&&this.activeTo[i]>n;i--)r++;return r}}function pP(e,n,r,i,s,a){e.goto(n),r.goto(i);let o=i+s,l=i,u=i-n,d=!!a.boundChange;for(let p=!1;;){let f=e.to+u-r.to,g=f||e.endSide-r.endSide,_=g<0?e.to+u:r.to,x=Math.min(_,o);if(e.point||r.point?(e.point&&r.point&&MA(e.point,r.point)&&Pj(e.activeForPoint(e.to),r.activeForPoint(r.to))||a.comparePoint(l,x,e.point,r.point),p=!1):(p&&a.boundChange(l),x>l&&!Pj(e.active,r.active)&&a.compareRange(l,x,e.active,r.active),d&&x<o&&(f||e.openEnd(_)!=r.openEnd(_))&&(p=!0)),_>o)break;l=_,g<=0&&e.next(),g>=0&&r.next()}}function Pj(e,n){if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!=n[r]&&!MA(e[r],n[r]))return!1;return!0}function d_(e,n){for(let r=n,i=e.length-1;r<i;r++)e[r]=e[r+1];e.pop()}function h_(e,n,r){for(let i=e.length-1;i>=n;i--)e[i+1]=e[i];e[n]=r}function mP(e,n){let r=-1,i=1e9;for(let s=0;s<n.length;s++)(n[s]-i||e[s].endSide-e[r].endSide)<0&&(r=s,i=n[s]);return r}function Zf(e,n,r=e.length){let i=0;for(let s=0;s<r&&s<e.length;)e.charCodeAt(s)==9?(i+=n-i%n,s++):(i++,s=pi(e,s));return i}function Lj(e,n,r,i){for(let s=0,a=0;;){if(a>=n)return s;if(s==e.length)break;a+=e.charCodeAt(s)==9?r-a%r:1,s=pi(e,s)}return i===!0?-1:e.length}const Ij="ͼ",gP=typeof Symbol>"u"?"__"+Ij:Symbol.for(Ij),Bj=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),vP=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class au{constructor(n,r){this.rules=[];let{finish:i}=r||{};function s(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function a(o,l,u,d){let p=[],f=/^@(\w+)\b/.exec(o[0]),g=f&&f[1]=="keyframes";if(f&&l==null)return u.push(o[0]+";");for(let _ in l){let x=l[_];if(/&/.test(_))a(_.split(/,\s*/).map(v=>o.map(S=>v.replace(/&/,S))).reduce((v,S)=>v.concat(S)),x,u);else if(x&&typeof x=="object"){if(!f)throw new RangeError("The value of a property ("+_+") should be a primitive value.");a(s(_),x,p,g)}else x!=null&&p.push(_.replace(/_.*/,"").replace(/[A-Z]/g,v=>"-"+v.toLowerCase())+": "+x+";")}(p.length||g)&&u.push((i&&!f&&!d?o.map(i):o).join(", ")+" {"+p.join(" ")+"}")}for(let o in n)a(s(o),n[o],this.rules)}getRules(){return this.rules.join(`
`)}static newName(){let n=vP[gP]||1;return vP[gP]=n+1,Ij+n.toString(36)}static mount(n,r,i){let s=n[Bj],a=i&&i.nonce;s?a&&s.setNonce(a):s=new k_e(n,a),s.mount(Array.isArray(r)?r:[r],n)}}let yP=new Map;class k_e{constructor(n,r){let i=n.ownerDocument||n,s=i.defaultView;if(!n.head&&n.adoptedStyleSheets&&s.CSSStyleSheet){let a=yP.get(i);if(a)return n[Bj]=a;this.sheet=new s.CSSStyleSheet,yP.set(i,this)}else this.styleTag=i.createElement("style"),r&&this.styleTag.setAttribute("nonce",r);this.modules=[],n[Bj]=this}mount(n,r){let i=this.sheet,s=0,a=0;for(let o=0;o<n.length;o++){let l=n[o],u=this.modules.indexOf(l);if(u<a&&u>-1&&(this.modules.splice(u,1),a--,u=-1),u==-1){if(this.modules.splice(a++,0,l),i)for(let d=0;d<l.rules.length;d++)i.insertRule(l.rules[d],s++)}else{for(;a<u;)s+=this.modules[a++].rules.length;s+=l.rules.length,a++}}if(i)r.adoptedStyleSheets.indexOf(this.sheet)<0&&(r.adoptedStyleSheets=[this.sheet,...r.adoptedStyleSheets]);else{let o="";for(let u=0;u<this.modules.length;u++)o+=this.modules[u].getRules()+`
`;this.styleTag.textContent=o;let l=r.head||r;this.styleTag.parentNode!=l&&l.insertBefore(this.styleTag,l.firstChild)}}setNonce(n){this.styleTag&&this.styleTag.getAttribute("nonce")!=n&&this.styleTag.setAttribute("nonce",n)}}var ou={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Mg={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},w_e=typeof navigator<"u"&&/Mac/.test(navigator.platform),S_e=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Ni=0;Ni<10;Ni++)ou[48+Ni]=ou[96+Ni]=String(Ni);for(var Ni=1;Ni<=24;Ni++)ou[Ni+111]="F"+Ni;for(var Ni=65;Ni<=90;Ni++)ou[Ni]=String.fromCharCode(Ni+32),Mg[Ni]=String.fromCharCode(Ni);for(var gS in ou)Mg.hasOwnProperty(gS)||(Mg[gS]=ou[gS]);function C_e(e){var n=w_e&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||S_e&&e.shiftKey&&e.key&&e.key.length==1||e.key=="Unidentified",r=!n&&e.key||(e.shiftKey?Mg:ou)[e.keyCode]||e.key||"Unidentified";return r=="Esc"&&(r="Escape"),r=="Del"&&(r="Delete"),r=="Left"&&(r="ArrowLeft"),r=="Up"&&(r="ArrowUp"),r=="Right"&&(r="ArrowRight"),r=="Down"&&(r="ArrowDown"),r}function Vn(){var e=arguments[0];typeof e=="string"&&(e=document.createElement(e));var n=1,r=arguments[1];if(r&&typeof r=="object"&&r.nodeType==null&&!Array.isArray(r)){for(var i in r)if(Object.prototype.hasOwnProperty.call(r,i)){var s=r[i];typeof s=="string"?e.setAttribute(i,s):s!=null&&(e[i]=s)}n++}for(;n<arguments.length;n++)ZF(e,arguments[n]);return e}function ZF(e,n){if(typeof n=="string")e.appendChild(document.createTextNode(n));else if(n!=null)if(n.nodeType!=null)e.appendChild(n);else if(Array.isArray(n))for(var r=0;r<n.length;r++)ZF(e,n[r]);else throw new RangeError("Unsupported child node: "+n)}let Xi=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},zj=typeof document<"u"?document:{documentElement:{style:{}}};const $j=/Edge\/(\d+)/.exec(Xi.userAgent),JF=/MSIE \d/.test(Xi.userAgent),Fj=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Xi.userAgent),R0=!!(JF||Fj||$j),_P=!R0&&/gecko\/(\d+)/i.test(Xi.userAgent),vS=!R0&&/Chrome\/(\d+)/.exec(Xi.userAgent),xP="webkitFontSmoothing"in zj.documentElement.style,Hj=!R0&&/Apple Computer/.test(Xi.vendor),bP=Hj&&(/Mobile\/\w+/.test(Xi.userAgent)||Xi.maxTouchPoints>2);var Et={mac:bP||/Mac/.test(Xi.platform),windows:/Win/.test(Xi.platform),linux:/Linux|X11/.test(Xi.platform),ie:R0,ie_version:JF?zj.documentMode||6:Fj?+Fj[1]:$j?+$j[1]:0,gecko:_P,gecko_version:_P?+(/Firefox\/(\d+)/.exec(Xi.userAgent)||[0,0])[1]:0,chrome:!!vS,chrome_version:vS?+vS[1]:0,ios:bP,android:/Android\b/.test(Xi.userAgent),webkit:xP,webkit_version:xP?+(/\bAppleWebKit\/(\d+)/.exec(Xi.userAgent)||[0,0])[1]:0,safari:Hj,safari_version:Hj?+(/\bVersion\/(\d+(\.\d+)?)/.exec(Xi.userAgent)||[0,0])[1]:0,tabSize:zj.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function OA(e,n){for(let r in e)r=="class"&&n.class?n.class+=" "+e.class:r=="style"&&n.style?n.style+=";"+e.style:n[r]=e[r];return n}const db=Object.create(null);function DA(e,n,r){if(e==n)return!0;e||(e=db),n||(n=db);let i=Object.keys(e),s=Object.keys(n);if(i.length-0!=s.length-0)return!1;for(let a of i)if(a!=r&&(s.indexOf(a)==-1||e[a]!==n[a]))return!1;return!0}function j_e(e,n){for(let r=e.attributes.length-1;r>=0;r--){let i=e.attributes[r].name;n[i]==null&&e.removeAttribute(i)}for(let r in n){let i=n[r];r=="style"?e.style.cssText=i:e.getAttribute(r)!=i&&e.setAttribute(r,i)}}function kP(e,n,r){let i=!1;if(n)for(let s in n)r&&s in r||(i=!0,s=="style"?e.style.cssText="":e.removeAttribute(s));if(r)for(let s in r)n&&n[s]==r[s]||(i=!0,s=="style"?e.style.cssText=r[s]:e.setAttribute(s,r[s]));return i}function N_e(e){let n=Object.create(null);for(let r=0;r<e.attributes.length;r++){let i=e.attributes[r];n[i.name]=i.value}return n}class nl{eq(n){return!1}updateDOM(n,r,i){return!1}compare(n){return this==n||this.constructor==n.constructor&&this.eq(n)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(n){return!0}coordsAt(n,r,i){return null}get isHidden(){return!1}get editable(){return!1}destroy(n){}}var Ai=(function(e){return e[e.Text=0]="Text",e[e.WidgetBefore=1]="WidgetBefore",e[e.WidgetAfter=2]="WidgetAfter",e[e.WidgetRange=3]="WidgetRange",e})(Ai||(Ai={}));class Wt extends su{constructor(n,r,i,s){super(),this.startSide=n,this.endSide=r,this.widget=i,this.spec=s}get heightRelevant(){return!1}static mark(n){return new Cv(n)}static widget(n){let r=Math.max(-1e4,Math.min(1e4,n.side||0)),i=!!n.block;return r+=i&&!n.inlineOrder?r>0?3e8:-4e8:r>0?1e8:-1e8,new Ed(n,r,r,i,n.widget||null,!1)}static replace(n){let r=!!n.block,i,s;if(n.isBlockGap)i=-5e8,s=4e8;else{let{start:a,end:o}=eH(n,r);i=(a?r?-3e8:-1:5e8)-1,s=(o?r?2e8:1:-6e8)+1}return new Ed(n,i,s,r,n.widget||null,!0)}static line(n){return new jv(n)}static set(n,r=!1){return on.of(n,r)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}Wt.none=on.empty;class Cv extends Wt{constructor(n){let{start:r,end:i}=eH(n);super(r?-1:5e8,i?1:-6e8,null,n),this.tagName=n.tagName||"span",this.attrs=n.class&&n.attributes?OA(n.attributes,{class:n.class}):n.class?{class:n.class}:n.attributes||db}eq(n){return this==n||n instanceof Cv&&this.tagName==n.tagName&&DA(this.attrs,n.attrs)}range(n,r=n){if(n>=r)throw new RangeError("Mark decorations may not be empty");return super.range(n,r)}}Cv.prototype.point=!1;class jv extends Wt{constructor(n){super(-2e8,-2e8,null,n)}eq(n){return n instanceof jv&&this.spec.class==n.spec.class&&DA(this.spec.attributes,n.spec.attributes)}range(n,r=n){if(r!=n)throw new RangeError("Line decoration ranges must be zero-length");return super.range(n,r)}}jv.prototype.mapMode=Zi.TrackBefore;jv.prototype.point=!0;class Ed extends Wt{constructor(n,r,i,s,a,o){super(r,i,a,n),this.block=s,this.isReplace=o,this.mapMode=s?r<=0?Zi.TrackBefore:Zi.TrackAfter:Zi.TrackDel}get type(){return this.startSide!=this.endSide?Ai.WidgetRange:this.startSide<=0?Ai.WidgetBefore:Ai.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(n){return n instanceof Ed&&E_e(this.widget,n.widget)&&this.block==n.block&&this.startSide==n.startSide&&this.endSide==n.endSide}range(n,r=n){if(this.isReplace&&(n>r||n==r&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&r!=n)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(n,r)}}Ed.prototype.point=!0;function eH(e,n=!1){let{inclusiveStart:r,inclusiveEnd:i}=e;return r==null&&(r=e.inclusive),i==null&&(i=e.inclusive),{start:r??n,end:i??n}}function E_e(e,n){return e==n||!!(e&&n&&e.compare(n))}function df(e,n,r,i=0){let s=r.length-1;s>=0&&r[s]+i>=e?r[s]=Math.max(r[s],n):r.push(e,n)}class Rg extends su{constructor(n,r){super(),this.tagName=n,this.attributes=r}eq(n){return n==this||n instanceof Rg&&this.tagName==n.tagName&&DA(this.attributes,n.attributes)}static create(n){return new Rg(n.tagName,n.attributes||db)}static set(n,r=!1){return on.of(n,r)}}Rg.prototype.startSide=Rg.prototype.endSide=-1;function Og(e){let n;return e.nodeType==11?n=e.getSelection?e:e.ownerDocument:n=e,n.getSelection()}function Wj(e,n){return n?e==n||e.contains(n.nodeType!=1?n.parentNode:n):!1}function eg(e,n){if(!n.anchorNode)return!1;try{return Wj(e,n.anchorNode)}catch{return!1}}function tg(e){return e.nodeType==3?Pg(e,0,e.nodeValue.length).getClientRects():e.nodeType==1?e.getClientRects():[]}function ng(e,n,r,i){return r?wP(e,n,r,i,-1)||wP(e,n,r,i,1):!1}function lu(e){for(var n=0;;n++)if(e=e.previousSibling,!e)return n}function hb(e){return e.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(e.nodeName)}function wP(e,n,r,i,s){for(;;){if(e==r&&n==i)return!0;if(n==(s<0?0:Yl(e))){if(e.nodeName=="DIV")return!1;let a=e.parentNode;if(!a||a.nodeType!=1)return!1;n=lu(e)+(s<0?0:1),e=a}else if(e.nodeType==1){if(e=e.childNodes[n+(s<0?-1:0)],e.nodeType==1&&e.contentEditable=="false")return!1;n=s<0?Yl(e):0}else return!1}}function Yl(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function Dg(e,n){let r=n?e.left:e.right;return{left:r,right:r,top:e.top,bottom:e.bottom}}function A_e(e){let n=e.visualViewport;return n?{left:0,right:n.width,top:0,bottom:n.height}:{left:0,right:e.innerWidth,top:0,bottom:e.innerHeight}}function tH(e,n){let r=n.width/e.offsetWidth,i=n.height/e.offsetHeight;return(r>.995&&r<1.005||!isFinite(r)||Math.abs(n.width-e.offsetWidth)<1)&&(r=1),(i>.995&&i<1.005||!isFinite(i)||Math.abs(n.height-e.offsetHeight)<1)&&(i=1),{scaleX:r,scaleY:i}}function T_e(e,n,r,i,s,a,o,l){let u=e.ownerDocument,d=u.defaultView||window;for(let p=e,f=!1;p&&!f;)if(p.nodeType==1){let g,_=p==u.body,x=1,v=1;if(_)g=A_e(d);else{if(/^(fixed|sticky)$/.test(getComputedStyle(p).position)&&(f=!0),p.scrollHeight<=p.clientHeight&&p.scrollWidth<=p.clientWidth){p=p.assignedSlot||p.parentNode;continue}let N=p.getBoundingClientRect();({scaleX:x,scaleY:v}=tH(p,N)),g={left:N.left,right:N.left+p.clientWidth*x,top:N.top,bottom:N.top+p.clientHeight*v}}let S=0,w=0;if(s=="nearest")n.top<g.top+o?(w=n.top-(g.top+o),r>0&&n.bottom>g.bottom+w&&(w=n.bottom-g.bottom+o)):n.bottom>g.bottom-o&&(w=n.bottom-g.bottom+o,r<0&&n.top-w<g.top&&(w=n.top-(g.top+o)));else{let N=n.bottom-n.top,C=g.bottom-g.top;w=(s=="center"&&N<=C?n.top+N/2-C/2:s=="start"||s=="center"&&r<0?n.top-o:n.bottom-C+o)-g.top}if(i=="nearest"?n.left<g.left+a?(S=n.left-(g.left+a),r>0&&n.right>g.right+S&&(S=n.right-g.right+a)):n.right>g.right-a&&(S=n.right-g.right+a,r<0&&n.left<g.left+S&&(S=n.left-(g.left+a))):S=(i=="center"?n.left+(n.right-n.left)/2-(g.right-g.left)/2:i=="start"==l?n.left-a:n.right-(g.right-g.left)+a)-g.left,S||w)if(_)d.scrollBy(S,w);else{let N=0,C=0;if(w){let T=p.scrollTop;p.scrollTop+=w/v,C=(p.scrollTop-T)*v}if(S){let T=p.scrollLeft;p.scrollLeft+=S/x,N=(p.scrollLeft-T)*x}n={left:n.left-N,top:n.top-C,right:n.right-N,bottom:n.bottom-C},N&&Math.abs(N-S)<1&&(i="nearest"),C&&Math.abs(C-w)<1&&(s="nearest")}if(_)break;(n.top<g.top||n.bottom>g.bottom||n.left<g.left||n.right>g.right)&&(n={left:Math.max(n.left,g.left),right:Math.min(n.right,g.right),top:Math.max(n.top,g.top),bottom:Math.min(n.bottom,g.bottom)}),p=p.assignedSlot||p.parentNode}else if(p.nodeType==11)p=p.host;else break}function nH(e,n=!0){let r=e.ownerDocument,i=null,s=null;for(let a=e.parentNode;a&&!(a==r.body||(!n||i)&&s);)if(a.nodeType==1)!s&&a.scrollHeight>a.clientHeight&&(s=a),n&&!i&&a.scrollWidth>a.clientWidth&&(i=a),a=a.assignedSlot||a.parentNode;else if(a.nodeType==11)a=a.host;else break;return{x:i,y:s}}class M_e{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(n){return this.anchorNode==n.anchorNode&&this.anchorOffset==n.anchorOffset&&this.focusNode==n.focusNode&&this.focusOffset==n.focusOffset}setRange(n){let{anchorNode:r,focusNode:i}=n;this.set(r,Math.min(n.anchorOffset,r?Yl(r):0),i,Math.min(n.focusOffset,i?Yl(i):0))}set(n,r,i,s){this.anchorNode=n,this.anchorOffset=r,this.focusNode=i,this.focusOffset=s}}let Zu=null;Et.safari&&Et.safari_version>=26&&(Zu=!1);function rH(e){if(e.setActive)return e.setActive();if(Zu)return e.focus(Zu);let n=[];for(let r=e;r&&(n.push(r,r.scrollTop,r.scrollLeft),r!=r.ownerDocument);r=r.parentNode);if(e.focus(Zu==null?{get preventScroll(){return Zu={preventScroll:!0},!0}}:void 0),!Zu){Zu=!1;for(let r=0;r<n.length;){let i=n[r++],s=n[r++],a=n[r++];i.scrollTop!=s&&(i.scrollTop=s),i.scrollLeft!=a&&(i.scrollLeft=a)}}}let SP;function Pg(e,n,r=n){let i=SP||(SP=document.createRange());return i.setEnd(e,r),i.setStart(e,n),i}function hf(e,n,r,i){let s={key:n,code:n,keyCode:r,which:r,cancelable:!0};i&&({altKey:s.altKey,ctrlKey:s.ctrlKey,shiftKey:s.shiftKey,metaKey:s.metaKey}=i);let a=new KeyboardEvent("keydown",s);a.synthetic=!0,e.dispatchEvent(a);let o=new KeyboardEvent("keyup",s);return o.synthetic=!0,e.dispatchEvent(o),a.defaultPrevented||o.defaultPrevented}function R_e(e){for(;e;){if(e&&(e.nodeType==9||e.nodeType==11&&e.host))return e;e=e.assignedSlot||e.parentNode}return null}function O_e(e,n){let r=n.focusNode,i=n.focusOffset;if(!r||n.anchorNode!=r||n.anchorOffset!=i)return!1;for(i=Math.min(i,Yl(r));;)if(i){if(r.nodeType!=1)return!1;let s=r.childNodes[i-1];s.contentEditable=="false"?i--:(r=s,i=Yl(r))}else{if(r==e)return!0;i=lu(r),r=r.parentNode}}function iH(e){return e instanceof Window?e.pageYOffset>Math.max(0,e.document.documentElement.scrollHeight-e.innerHeight-4):e.scrollTop>Math.max(1,e.scrollHeight-e.clientHeight-4)}function sH(e,n){for(let r=e,i=n;;){if(r.nodeType==3&&i>0)return{node:r,offset:i};if(r.nodeType==1&&i>0){if(r.contentEditable=="false")return null;r=r.childNodes[i-1],i=Yl(r)}else if(r.parentNode&&!hb(r))i=lu(r),r=r.parentNode;else return null}}function aH(e,n){for(let r=e,i=n;;){if(r.nodeType==3&&i<r.nodeValue.length)return{node:r,offset:i};if(r.nodeType==1&&i<r.childNodes.length){if(r.contentEditable=="false")return null;r=r.childNodes[i],i=0}else if(r.parentNode&&!hb(r))i=lu(r)+1,r=r.parentNode;else return null}}class Ka{constructor(n,r,i=!0){this.node=n,this.offset=r,this.precise=i}static before(n,r){return new Ka(n.parentNode,lu(n),r)}static after(n,r){return new Ka(n.parentNode,lu(n)+1,r)}}var Jn=(function(e){return e[e.LTR=0]="LTR",e[e.RTL=1]="RTL",e})(Jn||(Jn={}));const Ad=Jn.LTR,PA=Jn.RTL;function oH(e){let n=[];for(let r=0;r<e.length;r++)n.push(1<<+e[r]);return n}const D_e=oH("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),P_e=oH("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),qj=Object.create(null),bo=[];for(let e of["()","[]","{}"]){let n=e.charCodeAt(0),r=e.charCodeAt(1);qj[n]=r,qj[r]=-n}function lH(e){return e<=247?D_e[e]:1424<=e&&e<=1524?2:1536<=e&&e<=1785?P_e[e-1536]:1774<=e&&e<=2220?4:8192<=e&&e<=8204?256:64336<=e&&e<=65023?4:1}const L_e=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class zo{get dir(){return this.level%2?PA:Ad}constructor(n,r,i){this.from=n,this.to=r,this.level=i}side(n,r){return this.dir==r==n?this.to:this.from}forward(n,r){return n==(this.dir==r)}static find(n,r,i,s){let a=-1;for(let o=0;o<n.length;o++){let l=n[o];if(l.from<=r&&l.to>=r){if(l.level==i)return o;(a<0||(s!=0?s<0?l.from<r:l.to>r:n[a].level>l.level))&&(a=o)}}if(a<0)throw new RangeError("Index out of range");return a}}function cH(e,n){if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++){let i=e[r],s=n[r];if(i.from!=s.from||i.to!=s.to||i.direction!=s.direction||!cH(i.inner,s.inner))return!1}return!0}const Qn=[];function I_e(e,n,r,i,s){for(let a=0;a<=i.length;a++){let o=a?i[a-1].to:n,l=a<i.length?i[a].from:r,u=a?256:s;for(let d=o,p=u,f=u;d<l;d++){let g=lH(e.charCodeAt(d));g==512?g=p:g==8&&f==4&&(g=16),Qn[d]=g==4?2:g,g&7&&(f=g),p=g}for(let d=o,p=u,f=u;d<l;d++){let g=Qn[d];if(g==128)d<l-1&&p==Qn[d+1]&&p&24?g=Qn[d]=p:Qn[d]=256;else if(g==64){let _=d+1;for(;_<l&&Qn[_]==64;)_++;let x=d&&p==8||_<r&&Qn[_]==8?f==1?1:8:256;for(let v=d;v<_;v++)Qn[v]=x;d=_-1}else g==8&&f==1&&(Qn[d]=1);p=g,g&7&&(f=g)}}}function B_e(e,n,r,i,s){let a=s==1?2:1;for(let o=0,l=0,u=0;o<=i.length;o++){let d=o?i[o-1].to:n,p=o<i.length?i[o].from:r;for(let f=d,g,_,x;f<p;f++)if(_=qj[g=e.charCodeAt(f)])if(_<0){for(let v=l-3;v>=0;v-=3)if(bo[v+1]==-_){let S=bo[v+2],w=S&2?s:S&4?S&1?a:s:0;w&&(Qn[f]=Qn[bo[v]]=w),l=v;break}}else{if(bo.length==189)break;bo[l++]=f,bo[l++]=g,bo[l++]=u}else if((x=Qn[f])==2||x==1){let v=x==s;u=v?0:1;for(let S=l-3;S>=0;S-=3){let w=bo[S+2];if(w&2)break;if(v)bo[S+2]|=2;else{if(w&4)break;bo[S+2]|=4}}}}}function z_e(e,n,r,i){for(let s=0,a=i;s<=r.length;s++){let o=s?r[s-1].to:e,l=s<r.length?r[s].from:n;for(let u=o;u<l;){let d=Qn[u];if(d==256){let p=u+1;for(;;)if(p==l){if(s==r.length)break;p=r[s++].to,l=s<r.length?r[s].from:n}else if(Qn[p]==256)p++;else break;let f=a==1,g=(p<n?Qn[p]:i)==1,_=f==g?f?1:2:i;for(let x=p,v=s,S=v?r[v-1].to:e;x>u;)x==S&&(x=r[--v].from,S=v?r[v-1].to:e),Qn[--x]=_;u=p}else a=d,u++}}}function Uj(e,n,r,i,s,a,o){let l=i%2?2:1;if(i%2==s%2)for(let u=n,d=0;u<r;){let p=!0,f=!1;if(d==a.length||u<a[d].from){let v=Qn[u];v!=l&&(p=!1,f=v==16)}let g=!p&&l==1?[]:null,_=p?i:i+1,x=u;e:for(;;)if(d<a.length&&x==a[d].from){if(f)break e;let v=a[d];if(!p)for(let S=v.to,w=d+1;;){if(S==r)break e;if(w<a.length&&a[w].from==S)S=a[w++].to;else{if(Qn[S]==l)break e;break}}if(d++,g)g.push(v);else{v.from>u&&o.push(new zo(u,v.from,_));let S=v.direction==Ad!=!(_%2);Vj(e,S?i+1:i,s,v.inner,v.from,v.to,o),u=v.to}x=v.to}else{if(x==r||(p?Qn[x]!=l:Qn[x]==l))break;x++}g?Uj(e,u,x,i+1,s,g,o):u<x&&o.push(new zo(u,x,_)),u=x}else for(let u=r,d=a.length;u>n;){let p=!0,f=!1;if(!d||u>a[d-1].to){let v=Qn[u-1];v!=l&&(p=!1,f=v==16)}let g=!p&&l==1?[]:null,_=p?i:i+1,x=u;e:for(;;)if(d&&x==a[d-1].to){if(f)break e;let v=a[--d];if(!p)for(let S=v.from,w=d;;){if(S==n)break e;if(w&&a[w-1].to==S)S=a[--w].from;else{if(Qn[S-1]==l)break e;break}}if(g)g.push(v);else{v.to<u&&o.push(new zo(v.to,u,_));let S=v.direction==Ad!=!(_%2);Vj(e,S?i+1:i,s,v.inner,v.from,v.to,o),u=v.from}x=v.from}else{if(x==n||(p?Qn[x-1]!=l:Qn[x-1]==l))break;x--}g?Uj(e,x,u,i+1,s,g,o):x<u&&o.push(new zo(x,u,_)),u=x}}function Vj(e,n,r,i,s,a,o){let l=n%2?2:1;I_e(e,s,a,i,l),B_e(e,s,a,i,l),z_e(s,a,i,l),Uj(e,s,a,n,r,i,o)}function $_e(e,n,r){if(!e)return[new zo(0,0,n==PA?1:0)];if(n==Ad&&!r.length&&!L_e.test(e))return uH(e.length);if(r.length)for(;e.length>Qn.length;)Qn[Qn.length]=256;let i=[],s=n==Ad?0:1;return Vj(e,s,s,r,0,e.length,i),i}function uH(e){return[new zo(0,e,0)]}let dH="";function F_e(e,n,r,i,s){var a;let o=i.head-e.from,l=zo.find(n,o,(a=i.bidiLevel)!==null&&a!==void 0?a:-1,i.assoc),u=n[l],d=u.side(s,r);if(o==d){let g=l+=s?1:-1;if(g<0||g>=n.length)return null;u=n[l=g],o=u.side(!s,r),d=u.side(s,r)}let p=pi(e.text,o,u.forward(s,r));(p<u.from||p>u.to)&&(p=d),dH=e.text.slice(Math.min(o,p),Math.max(o,p));let f=l==(s?n.length-1:0)?null:n[l+(s?1:-1)];return f&&p==d&&f.level+(s?0:1)<u.level?Ze.cursor(f.side(!s,r)+e.from,f.forward(s,r)?1:-1,f.level):Ze.cursor(p+e.from,u.forward(s,r)?-1:1,u.level)}function H_e(e,n,r){for(let i=n;i<r;i++){let s=lH(e.charCodeAt(i));if(s==1)return Ad;if(s==2||s==4)return PA}return Ad}const hH=jt.define(),fH=jt.define(),pH=jt.define(),mH=jt.define(),Kj=jt.define(),gH=jt.define(),vH=jt.define(),LA=jt.define(),IA=jt.define(),yH=jt.define({combine:e=>e.some(n=>n)}),_H=jt.define({combine:e=>e.some(n=>n)}),xH=jt.define();class ff{constructor(n,r,i,s,a,o=!1){this.range=n,this.y=r,this.x=i,this.yMargin=s,this.xMargin=a,this.isSnapshot=o}map(n){return n.empty?this:new ff(this.range.map(n),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(n){return this.range.to<=n.doc.length?this:new ff(Ze.cursor(n.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const f_=Zt.define({map:(e,n)=>e.map(n)}),bH=Zt.define();function es(e,n,r){let i=e.facet(mH);i.length?i[0](n):window.onerror&&window.onerror(String(n),r,void 0,void 0,n)||(r?console.error(r+":",n):console.error(n))}const Ol=jt.define({combine:e=>e.length?e[0]:!0});let W_e=0;const Qh=jt.define({combine(e){return e.filter((n,r)=>{for(let i=0;i<r;i++)if(e[i].plugin==n.plugin)return!1;return!0})}});class Cr{constructor(n,r,i,s,a){this.id=n,this.create=r,this.domEventHandlers=i,this.domEventObservers=s,this.baseExtensions=a(this),this.extension=this.baseExtensions.concat(Qh.of({plugin:this,arg:void 0}))}of(n){return this.baseExtensions.concat(Qh.of({plugin:this,arg:n}))}static define(n,r){const{eventHandlers:i,eventObservers:s,provide:a,decorations:o}=r||{};return new Cr(W_e++,n,i,s,l=>{let u=[];return o&&u.push(O0.of(d=>{let p=d.plugin(l);return p?o(p):Wt.none})),a&&u.push(a(l)),u})}static fromClass(n,r){return Cr.define((i,s)=>new n(i,s),r)}}class yS{constructor(n){this.spec=n,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(n){if(this.value){if(this.mustUpdate){let r=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(r)}catch(i){if(es(r.state,i,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(n,this.spec.arg)}catch(r){es(n.state,r,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(n){var r;if(!((r=this.value)===null||r===void 0)&&r.destroy)try{this.value.destroy()}catch(i){es(n.state,i,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const kH=jt.define(),BA=jt.define(),O0=jt.define(),wH=jt.define(),zA=jt.define(),Nv=jt.define(),SH=jt.define();function CP(e,n){let r=e.state.facet(SH);if(!r.length)return r;let i=r.map(a=>a instanceof Function?a(e):a),s=[];return on.spans(i,n.from,n.to,{point(){},span(a,o,l,u){let d=a-n.from,p=o-n.from,f=s;for(let g=l.length-1;g>=0;g--,u--){let _=l[g].spec.bidiIsolate,x;if(_==null&&(_=H_e(n.text,d,p)),u>0&&f.length&&(x=f[f.length-1]).to==d&&x.direction==_)x.to=p,f=x.inner;else{let v={from:d,to:p,direction:_,inner:[]};f.push(v),f=v.inner}}}}),s}const CH=jt.define();function $A(e){let n=0,r=0,i=0,s=0;for(let a of e.state.facet(CH)){let o=a(e);o&&(o.left!=null&&(n=Math.max(n,o.left)),o.right!=null&&(r=Math.max(r,o.right)),o.top!=null&&(i=Math.max(i,o.top)),o.bottom!=null&&(s=Math.max(s,o.bottom)))}return{left:n,right:r,top:i,bottom:s}}const Rm=jt.define();class wa{constructor(n,r,i,s){this.fromA=n,this.toA=r,this.fromB=i,this.toB=s}join(n){return new wa(Math.min(this.fromA,n.fromA),Math.max(this.toA,n.toA),Math.min(this.fromB,n.fromB),Math.max(this.toB,n.toB))}addToSet(n){let r=n.length,i=this;for(;r>0;r--){let s=n[r-1];if(!(s.fromA>i.toA)){if(s.toA<i.fromA)break;i=i.join(s),n.splice(r-1,1)}}return n.splice(r,0,i),n}static extendWithRanges(n,r){if(r.length==0)return n;let i=[];for(let s=0,a=0,o=0;;){let l=s<n.length?n[s].fromB:1e9,u=a<r.length?r[a]:1e9,d=Math.min(l,u);if(d==1e9)break;let p=d+o,f=d,g=p;for(;;)if(a<r.length&&r[a]<=f){let _=r[a+1];a+=2,f=Math.max(f,_);for(let x=s;x<n.length&&n[x].fromB<=f;x++)o=n[x].toA-n[x].toB;g=Math.max(g,_+o)}else if(s<n.length&&n[s].fromB<=f){let _=n[s++];f=Math.max(f,_.toB),g=Math.max(g,_.toA),o=_.toA-_.toB}else break;i.push(new wa(p,g,d,f))}return i}}class fb{constructor(n,r,i){this.view=n,this.state=r,this.transactions=i,this.flags=0,this.startState=n.state,this.changes=ni.empty(this.startState.doc.length);for(let a of i)this.changes=this.changes.compose(a.changes);let s=[];this.changes.iterChangedRanges((a,o,l,u)=>s.push(new wa(a,o,l,u))),this.changedRanges=s}static create(n,r,i){return new fb(n,r,i)}get viewportChanged(){return(this.flags&4)>0}get viewportMoved(){return(this.flags&8)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&18)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(n=>n.selection)}get empty(){return this.flags==0&&this.transactions.length==0}}const q_e=[];class Or{constructor(n,r,i=0){this.dom=n,this.length=r,this.flags=i,this.parent=null,n.cmTile=this}get breakAfter(){return this.flags&1}get children(){return q_e}isWidget(){return!1}get isHidden(){return!1}isComposite(){return!1}isLine(){return!1}isText(){return!1}isBlock(){return!1}get domAttrs(){return null}sync(n){if(this.flags|=2,this.flags&4){this.flags&=-5;let r=this.domAttrs;r&&j_e(this.dom,r)}}toString(){return this.constructor.name+(this.children.length?`(${this.children})`:"")+(this.breakAfter?"#":"")}destroy(){this.parent=null}setDOM(n){this.dom=n,n.cmTile=this}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(n,r=this.posAtStart){let i=r;for(let s of this.children){if(s==n)return i;i+=s.length+s.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(n){return this.posBefore(n)+n.length}covers(n){return!0}coordsIn(n,r){return null}domPosFor(n,r){let i=lu(this.dom),s=this.length?n>0:r>0;return new Ka(this.parent.dom,i+(s?1:0),n==0||n==this.length)}markDirty(n){this.flags&=-3,n&&(this.flags|=4),this.parent&&this.parent.flags&2&&this.parent.markDirty(!1)}get overrideDOMText(){return null}get root(){for(let n=this;n;n=n.parent)if(n instanceof P0)return n;return null}static get(n){return n.cmTile}}class D0 extends Or{constructor(n){super(n,0),this._children=[]}isComposite(){return!0}get children(){return this._children}get lastChild(){return this.children.length?this.children[this.children.length-1]:null}append(n){this.children.push(n),n.parent=this}sync(n){if(this.flags&2)return;super.sync(n);let r=this.dom,i=null,s,a=(n==null?void 0:n.node)==r?n:null,o=0;for(let l of this.children){if(l.sync(n),o+=l.length+l.breakAfter,s=i?i.nextSibling:r.firstChild,a&&s!=l.dom&&(a.written=!0),l.dom.parentNode==r)for(;s&&s!=l.dom;)s=jP(s);else r.insertBefore(l.dom,s);i=l.dom}for(s=i?i.nextSibling:r.firstChild,a&&s&&(a.written=!0);s;)s=jP(s);this.length=o}}function jP(e){let n=e.nextSibling;return e.parentNode.removeChild(e),n}class P0 extends D0{constructor(n,r){super(r),this.view=n}owns(n){for(;n;n=n.parent)if(n==this)return!0;return!1}isBlock(){return!0}nearest(n){for(;;){if(!n)return null;let r=Or.get(n);if(r&&this.owns(r))return r;n=n.parentNode}}blockTiles(n){for(let r=[],i=this,s=0,a=0;;)if(s==i.children.length){if(!r.length)return;i=i.parent,i.breakAfter&&a++,s=r.pop()}else{let o=i.children[s++];if(o instanceof $l)r.push(s),i=o,s=0;else{let l=a+o.length,u=n(o,a);if(u!==void 0)return u;a=l+o.breakAfter}}}resolveBlock(n,r){let i,s=-1,a,o=-1;if(this.blockTiles((l,u)=>{let d=u+l.length;if(n>=u&&n<=d){if(l.isWidget()&&r>=-1&&r<=1){if(l.flags&32)return!0;l.flags&16&&(i=void 0)}(u<n||n==d&&(r<-1?l.length:l.covers(1)))&&(!i||!l.isWidget()&&i.isWidget())&&(i=l,s=n-u),(d>n||n==u&&(r>1?l.length:l.covers(-1)))&&(!a||!l.isWidget()&&a.isWidget())&&(a=l,o=n-u)}}),!i&&!a)throw new Error("No tile at position "+n);return i&&r<0||!a?{tile:i,offset:s}:{tile:a,offset:o}}}class $l extends D0{constructor(n,r){super(n),this.wrapper=r}isBlock(){return!0}covers(n){return this.children.length?n<0?this.children[0].covers(-1):this.lastChild.covers(1):!1}get domAttrs(){return this.wrapper.attributes}static of(n,r){let i=new $l(r||document.createElement(n.tagName),n);return r||(i.flags|=4),i}}class Df extends D0{constructor(n,r){super(n),this.attrs=r}isLine(){return!0}static start(n,r,i){let s=new Df(r||document.createElement("div"),n);return(!r||!i)&&(s.flags|=4),s}get domAttrs(){return this.attrs}resolveInline(n,r,i){let s=null,a=-1,o=null,l=-1;function u(p,f){for(let g=0,_=0;g<p.children.length&&_<=f;g++){let x=p.children[g],v=_+x.length;v>=f&&(x.isComposite()?u(x,f-_):(!o||o.isHidden&&(r>0||i&&V_e(o,x)))&&(v>f||x.flags&32)?(o=x,l=f-_):(_<f||x.flags&16&&!x.isHidden)&&(s=x,a=f-_)),_=v}}u(this,n);let d=(r<0?s:o)||s||o;return d?{tile:d,offset:d==s?a:l}:null}coordsIn(n,r){let i=this.resolveInline(n,r,!0);return i?i.tile.coordsIn(Math.max(0,i.offset),r):U_e(this)}domIn(n,r){let i=this.resolveInline(n,r);if(i){let{tile:s,offset:a}=i;if(this.dom.contains(s.dom))return s.isText()?new Ka(s.dom,Math.min(s.dom.nodeValue.length,a)):s.domPosFor(a,s.flags&16?1:s.flags&32?-1:r);let o=i.tile.parent,l=!1;for(let u of o.children){if(l)return new Ka(u.dom,0);u==i.tile&&(l=!0)}}return new Ka(this.dom,0)}}function U_e(e){let n=e.dom.lastChild;if(!n)return e.dom.getBoundingClientRect();let r=tg(n);return r[r.length-1]||null}function V_e(e,n){let r=e.coordsIn(0,1),i=n.coordsIn(0,1);return r&&i&&i.top<r.bottom}class ks extends D0{constructor(n,r){super(n),this.mark=r}get domAttrs(){return this.mark.attrs}static of(n,r){let i=new ks(r||document.createElement(n.tagName),n);return r||(i.flags|=4),i}}class cd extends Or{constructor(n,r){super(n,r.length),this.text=r}sync(n){this.flags&2||(super.sync(n),this.dom.nodeValue!=this.text&&(n&&n.node==this.dom&&(n.written=!0),this.dom.nodeValue=this.text))}isText(){return!0}toString(){return JSON.stringify(this.text)}coordsIn(n,r){let i=this.dom.nodeValue.length;n>i&&(n=i);let s=n,a=n,o=0;n==0&&r<0||n==i&&r>=0?Et.chrome||Et.gecko||(n?(s--,o=1):a<i&&(a++,o=-1)):r<0?s--:a<i&&a++;let l=Pg(this.dom,s,a).getClientRects();if(!l.length)return null;let u=l[(o?o<0:r>=0)?0:l.length-1];return Et.safari&&!o&&u.width==0&&(u=Array.prototype.find.call(l,d=>d.width)||u),o?Dg(u,o<0):u||null}static of(n,r){let i=new cd(r||document.createTextNode(n),n);return r||(i.flags|=2),i}}class Td extends Or{constructor(n,r,i,s){super(n,r,s),this.widget=i}isWidget(){return!0}get isHidden(){return this.widget.isHidden}covers(n){return this.flags&48?!1:(this.flags&(n<0?64:128))>0}coordsIn(n,r){return this.coordsInWidget(n,r,!1)}coordsInWidget(n,r,i){let s=this.widget.coordsAt(this.dom,n,r);if(s)return s;if(i)return Dg(this.dom.getBoundingClientRect(),this.length?n==0:r<=0);{let a=this.dom.getClientRects(),o=null;if(!a.length)return null;let l=this.flags&16?!0:this.flags&32?!1:n>0;for(let u=l?a.length-1:0;o=a[u],!(n>0?u==0:u==a.length-1||o.top<o.bottom);u+=l?-1:1);return Dg(o,!l)}}get overrideDOMText(){if(!this.length)return Pn.empty;let{root:n}=this;if(!n)return Pn.empty;let r=this.posAtStart;return n.view.state.doc.slice(r,r+this.length)}destroy(){super.destroy(),this.widget.destroy(this.dom)}static of(n,r,i,s,a){return a||(a=n.toDOM(r),n.editable||(a.contentEditable="false")),new Td(a,i,n,s)}}class pb extends Or{constructor(n){let r=document.createElement("img");r.className="cm-widgetBuffer",r.setAttribute("aria-hidden","true"),super(r,0,n)}get isHidden(){return!0}get overrideDOMText(){return Pn.empty}coordsIn(n){return this.dom.getBoundingClientRect()}}class K_e{constructor(n){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=n}advance(n,r,i){let{tile:s,index:a,beforeBreak:o,parents:l}=this;for(;n||r>0;)if(s.isComposite())if(o){if(!n)break;i&&i.break(),n--,o=!1}else if(a==s.children.length){if(!n&&!l.length)break;i&&i.leave(s),o=!!s.breakAfter,{tile:s,index:a}=l.pop(),a++}else{let u=s.children[a],d=u.breakAfter;(r>0?u.length<=n:u.length<n)&&(!i||i.skip(u,0,u.length)!==!1||!u.isComposite)?(o=!!d,a++,n-=u.length):(l.push({tile:s,index:a}),s=u,a=0,i&&u.isComposite()&&i.enter(u))}else if(a==s.length)o=!!s.breakAfter,{tile:s,index:a}=l.pop(),a++;else if(n){let u=Math.min(n,s.length-a);i&&i.skip(s,a,a+u),n-=u,a+=u}else break;return this.tile=s,this.index=a,this.beforeBreak=o,this}get root(){return this.parents.length?this.parents[0].tile:this.tile}}class Y_e{constructor(n,r,i,s){this.from=n,this.to=r,this.wrapper=i,this.rank=s}}class G_e{constructor(n,r,i){this.cache=n,this.root=r,this.blockWrappers=i,this.curLine=null,this.lastBlock=null,this.afterWidget=null,this.pos=0,this.wrappers=[],this.wrapperPos=0}addText(n,r,i,s){var a;this.flushBuffer();let o=this.ensureMarks(r,i),l=o.lastChild;if(l&&l.isText()&&!(l.flags&8)&&l.length+n.length<512){this.cache.reused.set(l,2);let u=o.children[o.children.length-1]=new cd(l.dom,l.text+n);u.parent=o}else o.append(s||cd.of(n,(a=this.cache.find(cd))===null||a===void 0?void 0:a.dom));this.pos+=n.length,this.afterWidget=null}addComposition(n,r){let i=this.curLine;i.dom!=r.line.dom&&(i.setDOM(this.cache.reused.has(r.line)?_S(r.line.dom):r.line.dom),this.cache.reused.set(r.line,2));let s=i;for(let l=r.marks.length-1;l>=0;l--){let u=r.marks[l],d=s.lastChild;if(d instanceof ks&&d.mark.eq(u.mark))d.dom!=u.dom&&d.setDOM(_S(u.dom)),s=d;else{if(this.cache.reused.get(u)){let f=Or.get(u.dom);f&&f.setDOM(_S(u.dom))}let p=ks.of(u.mark,u.dom);s.append(p),s=p}this.cache.reused.set(u,2)}let a=Or.get(n.text);a&&this.cache.reused.set(a,2);let o=new cd(n.text,n.text.nodeValue);o.flags|=8,s.append(o)}addInlineWidget(n,r,i){let s=this.afterWidget&&n.flags&48&&(this.afterWidget.flags&48)==(n.flags&48);s||this.flushBuffer();let a=this.ensureMarks(r,i);!s&&!(n.flags&16)&&a.append(this.getBuffer(1)),a.append(n),this.pos+=n.length,this.afterWidget=n}addMark(n,r,i){this.flushBuffer(),this.ensureMarks(r,i).append(n),this.pos+=n.length,this.afterWidget=null}addBlockWidget(n){this.getBlockPos().append(n),this.pos+=n.length,this.lastBlock=n,this.endLine()}continueWidget(n){let r=this.afterWidget||this.lastBlock;r.length+=n,this.pos+=n}addLineStart(n,r){var i;n||(n=jH);let s=Df.start(n,r||((i=this.cache.find(Df))===null||i===void 0?void 0:i.dom),!!r);this.getBlockPos().append(this.lastBlock=this.curLine=s)}addLine(n){this.getBlockPos().append(n),this.pos+=n.length,this.lastBlock=n,this.endLine()}addBreak(){this.lastBlock.flags|=1,this.endLine(),this.pos++}addLineStartIfNotCovered(n){this.blockPosCovered()||this.addLineStart(n)}ensureLine(n){this.curLine||this.addLineStart(n)}ensureMarks(n,r){var i;let s=this.curLine;for(let a=n.length-1;a>=0;a--){let o=n[a],l;if(r>0&&(l=s.lastChild)&&l instanceof ks&&l.mark.eq(o))s=l,r--;else{let u=ks.of(o,(i=this.cache.find(ks,d=>d.mark.eq(o)))===null||i===void 0?void 0:i.dom);s.append(u),s=u,r=0}}return s}endLine(){if(this.curLine){this.flushBuffer();let n=this.curLine.lastChild;(!n||!NP(this.curLine,!1)||n.dom.nodeName!="BR"&&n.isWidget()&&!(Et.ios&&NP(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(xS,0,32)||new Td(xS.toDOM(),0,xS,32)),this.curLine=this.afterWidget=null}}updateBlockWrappers(){this.wrapperPos>this.pos+1e4&&(this.blockWrappers.goto(this.pos),this.wrappers.length=0);for(let n=this.wrappers.length-1;n>=0;n--)this.wrappers[n].to<this.pos&&this.wrappers.splice(n,1);for(let n=this.blockWrappers;n.value&&n.from<=this.pos;n.next())if(n.to>=this.pos){let r=new Y_e(n.from,n.to,n.value,n.rank),i=this.wrappers.length;for(;i>0&&(this.wrappers[i-1].rank-r.rank||this.wrappers[i-1].to-r.to)<0;)i--;this.wrappers.splice(i,0,r)}this.wrapperPos=this.pos}getBlockPos(){var n;this.updateBlockWrappers();let r=this.root;for(let i of this.wrappers){let s=r.lastChild;if(i.from<this.pos&&s instanceof $l&&s.wrapper.eq(i.wrapper))r=s;else{let a=$l.of(i.wrapper,(n=this.cache.find($l,o=>o.wrapper.eq(i.wrapper)))===null||n===void 0?void 0:n.dom);r.append(a),r=a}}return r}blockPosCovered(){let n=this.lastBlock;return n!=null&&!n.breakAfter&&(!n.isWidget()||(n.flags&160)>0)}getBuffer(n){let r=2|(n<0?16:32),i=this.cache.find(pb,void 0,1);return i&&(i.flags=r),i||new pb(r)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}}class X_e{constructor(n){this.skipCount=0,this.text="",this.textOff=0,this.cursor=n.iter()}skip(n){this.textOff+n<=this.text.length?this.textOff+=n:(this.skipCount+=n-(this.text.length-this.textOff),this.text="",this.textOff=0)}next(n){if(this.textOff==this.text.length){let{value:s,lineBreak:a,done:o}=this.cursor.next(this.skipCount);if(this.skipCount=0,o)throw new Error("Ran out of text content when drawing inline views");this.text=s;let l=this.textOff=Math.min(n,s.length);return a?null:s.slice(0,l)}let r=Math.min(this.text.length,this.textOff+n),i=this.text.slice(this.textOff,r);return this.textOff=r,i}}const mb=[Td,Df,cd,ks,pb,$l,P0];for(let e=0;e<mb.length;e++)mb[e].bucket=e;class Q_e{constructor(n){this.view=n,this.buckets=mb.map(()=>[]),this.index=mb.map(()=>0),this.reused=new Map}add(n){let r=n.constructor.bucket,i=this.buckets[r];i.length<6?i.push(n):i[this.index[r]=(this.index[r]+1)%6]=n}find(n,r,i=2){let s=n.bucket,a=this.buckets[s],o=this.index[s];for(let l=a.length-1;l>=0;l--){let u=(l+o)%a.length,d=a[u];if((!r||r(d))&&!this.reused.has(d))return a.splice(u,1),u<o&&this.index[s]--,this.reused.set(d,i),d}return null}findWidget(n,r,i){let s=this.buckets[0];if(s.length)for(let a=0,o=0;;a++){if(a==s.length){if(o)return null;o=1,a=0}let l=s[a];if(!this.reused.has(l)&&(o==0?l.widget.compare(n):l.widget.constructor==n.constructor&&n.updateDOM(l.dom,this.view,l.widget)))return s.splice(a,1),a<this.index[0]&&this.index[0]--,l.widget==n&&l.length==r&&(l.flags&497)==i?(this.reused.set(l,1),l):(this.reused.set(l,2),new Td(l.dom,r,n,l.flags&-498|i))}}reuse(n){return this.reused.set(n,1),n}maybeReuse(n,r=2){if(!this.reused.has(n))return this.reused.set(n,r),n.dom}clear(){for(let n=0;n<this.buckets.length;n++)this.buckets[n].length=this.index[n]=0}}class Z_e{constructor(n,r,i,s,a){this.view=n,this.decorations=s,this.disallowBlockEffectsFor=a,this.openWidget=!1,this.openMarks=0,this.cache=new Q_e(n),this.text=new X_e(n.state.doc),this.builder=new G_e(this.cache,new P0(n,n.contentDOM),on.iter(i)),this.cache.reused.set(r,2),this.old=new K_e(r),this.reuseWalker={skip:(o,l,u)=>{if(this.cache.add(o),o.isComposite())return!1},enter:o=>this.cache.add(o),leave:()=>{},break:()=>{}}}run(n,r){let i=r&&this.getCompositionContext(r.text);for(let s=0,a=0,o=0;;){let l=o<n.length?n[o++]:null,u=l?l.fromA:this.old.root.length;if(u>s){let d=u-s;this.preserve(d,!o,!l),s=u,a+=d}if(!l)break;r&&l.fromA<=r.range.fromA&&l.toA>=r.range.toA?(this.forward(l.fromA,r.range.fromA,r.range.fromA<r.range.toA?1:-1),this.emit(a,r.range.fromB),this.cache.clear(),this.builder.addComposition(r,i),this.text.skip(r.range.toB-r.range.fromB),this.forward(r.range.fromA,l.toA),this.emit(r.range.toB,l.toB)):(this.forward(l.fromA,l.toA),this.emit(a,l.toB)),a=l.toB,s=l.toA}return this.builder.curLine&&this.builder.endLine(),this.builder.root}preserve(n,r,i){let s=txe(this.old),a=this.openMarks;this.old.advance(n,i?1:-1,{skip:(o,l,u)=>{if(o.isWidget())if(this.openWidget)this.builder.continueWidget(u-l);else{let d=u>0||l<o.length?Td.of(o.widget,this.view,u-l,o.flags&496,this.cache.maybeReuse(o)):this.cache.reuse(o);d.flags&256?(d.flags&=-2,this.builder.addBlockWidget(d)):(this.builder.ensureLine(null),this.builder.addInlineWidget(d,s,a),a=s.length)}else if(o.isText())this.builder.ensureLine(null),!l&&u==o.length&&!this.cache.reused.has(o)?this.builder.addText(o.text,s,a,this.cache.reuse(o)):(this.cache.add(o),this.builder.addText(o.text.slice(l,u),s,a)),a=s.length;else if(o.isLine())o.flags&=-2,this.cache.reused.set(o,1),this.builder.addLine(o);else if(o instanceof pb)this.cache.add(o);else if(o instanceof ks)this.builder.ensureLine(null),this.builder.addMark(o,s,a),this.cache.reused.set(o,1),a=s.length;else return!1;this.openWidget=!1},enter:o=>{o.isLine()?this.builder.addLineStart(o.attrs,this.cache.maybeReuse(o)):(this.cache.add(o),o instanceof ks&&s.unshift(o.mark)),this.openWidget=!1},leave:o=>{o.isLine()?s.length&&(s.length=a=0):o instanceof ks&&(s.shift(),a=Math.min(a,s.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(n)}emit(n,r){let i=null,s=this.builder,a=0,o=on.spans(this.decorations,n,r,{point:(l,u,d,p,f,g)=>{if(d instanceof Ed){if(this.disallowBlockEffectsFor[g]){if(d.block)throw new RangeError("Block decorations may not be specified via plugins");if(u>this.view.state.doc.lineAt(l).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}if(a=p.length,f>p.length)s.continueWidget(u-l);else{let _=d.widget||(d.block?Pf.block:Pf.inline),x=J_e(d),v=this.cache.findWidget(_,u-l,x)||Td.of(_,this.view,u-l,x);d.block?(d.startSide>0&&s.addLineStartIfNotCovered(i),s.addBlockWidget(v)):(s.ensureLine(i),s.addInlineWidget(v,p,f))}i=null}else i=exe(i,d);u>l&&this.text.skip(u-l)},span:(l,u,d,p)=>{for(let f=l;f<u;){let g=this.text.next(Math.min(512,u-f));g==null?(s.addLineStartIfNotCovered(i),s.addBreak(),f++):(s.ensureLine(i),s.addText(g,d,f==l?p:d.length),f+=g.length),i=null}}});s.addLineStartIfNotCovered(i),this.openWidget=o>a,this.openMarks=o}forward(n,r,i=1){r-n<=10?this.old.advance(r-n,i,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(r-n-10,-1),this.old.advance(5,i,this.reuseWalker))}getCompositionContext(n){let r=[],i=null;for(let s=n.parentNode;;s=s.parentNode){let a=Or.get(s);if(s==this.view.contentDOM)break;a instanceof ks?r.push(a):a!=null&&a.isLine()?i=a:a instanceof $l||(s.nodeName=="DIV"&&!i&&s!=this.view.contentDOM?i=new Df(s,jH):i||r.push(ks.of(new Cv({tagName:s.nodeName.toLowerCase(),attributes:N_e(s)}),s)))}return{line:i,marks:r}}}function NP(e,n){let r=i=>{for(let s of i.children)if((n?s.isText():s.length)||r(s))return!0;return!1};return r(e)}function J_e(e){let n=e.isReplace?(e.startSide<0?64:0)|(e.endSide>0?128:0):e.startSide>0?32:16;return e.block&&(n|=256),n}const jH={class:"cm-line"};function exe(e,n){let r=n.spec.attributes,i=n.spec.class;return!r&&!i||(e||(e={class:"cm-line"}),r&&OA(r,e),i&&(e.class+=" "+i)),e}function txe(e){let n=[];for(let r=e.parents.length;r>1;r--){let i=r==e.parents.length?e.tile:e.parents[r].tile;i instanceof ks&&n.push(i.mark)}return n}function _S(e){let n=Or.get(e);return n&&n.setDOM(e.cloneNode()),e}class Pf extends nl{constructor(n){super(),this.tag=n}eq(n){return n.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(n){return n.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}Pf.inline=new Pf("span");Pf.block=new Pf("div");const xS=new class extends nl{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}};class EP{constructor(n){this.view=n,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=Wt.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.updateDeco(),this.tile=new P0(n,n.contentDOM),this.updateInner([new wa(0,0,0,n.state.doc.length)],null)}update(n){var r;let i=n.changedRanges;this.minWidth>0&&i.length&&(i.every(({fromA:p,toA:f})=>f<this.minWidthFrom||p>this.minWidthTo)?(this.minWidthFrom=n.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=n.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(n);let s=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((r=this.domChanged)===null||r===void 0)&&r.newSel?s=this.domChanged.newSel.head:!uxe(n.changes,this.hasComposition)&&!n.selectionSet&&(s=n.state.selection.main.head));let a=s>-1?rxe(this.view,n.changes,s):null;if(this.domChanged=null,this.hasComposition){let{from:p,to:f}=this.hasComposition;i=new wa(p,f,n.changes.mapPos(p,-1),n.changes.mapPos(f,1)).addToSet(i.slice())}this.hasComposition=a?{from:a.range.fromB,to:a.range.toB}:null,(Et.ie||Et.chrome)&&!a&&n&&n.state.doc.lines!=n.startState.doc.lines&&(this.forceSelection=!0);let o=this.decorations,l=this.blockWrappers;this.updateDeco();let u=axe(o,this.decorations,n.changes);u.length&&(i=wa.extendWithRanges(i,u));let d=lxe(l,this.blockWrappers,n.changes);return d.length&&(i=wa.extendWithRanges(i,d)),a&&!i.some(p=>p.fromA<=a.range.fromA&&p.toA>=a.range.toA)&&(i=a.range.addToSet(i.slice())),this.tile.flags&2&&i.length==0?!1:(this.updateInner(i,a),n.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(n,r){this.view.viewState.mustMeasureContent=!0;let{observer:i}=this.view;i.ignore(()=>{if(r||n.length){let o=this.tile,l=new Z_e(this.view,o,this.blockWrappers,this.decorations,this.dynamicDecorationMap);r&&Or.get(r.text)&&l.cache.reused.set(Or.get(r.text),2),this.tile=l.run(n,r),Yj(o,l.cache.reused)}this.tile.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.tile.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let a=Et.chrome||Et.ios?{node:i.selectionRange.focusNode,written:!1}:void 0;this.tile.sync(a),a&&(a.written||i.selectionRange.focusNode!=a.node||!this.tile.dom.contains(a.node))&&(this.forceSelection=!0),this.tile.dom.style.height=""});let s=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let a of this.tile.children)a.isWidget()&&a.widget instanceof bS&&s.push(a.dom);i.updateGaps(s)}updateEditContextFormatting(n){this.editContextFormatting=this.editContextFormatting.map(n.changes);for(let r of n.transactions)for(let i of r.effects)i.is(bH)&&(this.editContextFormatting=i.value)}updateSelection(n=!1,r=!1){(n||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let{dom:i}=this.tile,s=this.view.root.activeElement,a=s==i,o=!a&&!(this.view.state.facet(Ol)||i.tabIndex>-1)&&eg(i,this.view.observer.selectionRange)&&!(s&&i.contains(s));if(!(a||r||o))return;let l=this.forceSelection;this.forceSelection=!1;let u=this.view.state.selection.main,d,p;if(u.empty?p=d=this.inlineDOMNearPos(u.anchor,u.assoc||1):(p=this.inlineDOMNearPos(u.head,u.head==u.from?1:-1),d=this.inlineDOMNearPos(u.anchor,u.anchor==u.from?1:-1)),Et.gecko&&u.empty&&!this.hasComposition&&nxe(d)){let g=document.createTextNode("");this.view.observer.ignore(()=>d.node.insertBefore(g,d.node.childNodes[d.offset]||null)),d=p=new Ka(g,0),l=!0}let f=this.view.observer.selectionRange;(l||!f.focusNode||(!ng(d.node,d.offset,f.anchorNode,f.anchorOffset)||!ng(p.node,p.offset,f.focusNode,f.focusOffset))&&!this.suppressWidgetCursorChange(f,u))&&(this.view.observer.ignore(()=>{Et.android&&Et.chrome&&i.contains(f.focusNode)&&cxe(f.focusNode,i)&&(i.blur(),i.focus({preventScroll:!0}));let g=Og(this.view.root);if(g)if(u.empty){if(Et.gecko){let _=ixe(d.node,d.offset);if(_&&_!=3){let x=(_==1?sH:aH)(d.node,d.offset);x&&(d=new Ka(x.node,x.offset))}}g.collapse(d.node,d.offset),u.bidiLevel!=null&&g.caretBidiLevel!==void 0&&(g.caretBidiLevel=u.bidiLevel)}else if(g.extend){g.collapse(d.node,d.offset);try{g.extend(p.node,p.offset)}catch{}}else{let _=document.createRange();u.anchor>u.head&&([d,p]=[p,d]),_.setEnd(p.node,p.offset),_.setStart(d.node,d.offset),g.removeAllRanges(),g.addRange(_)}o&&this.view.root.activeElement==i&&(i.blur(),s&&s.focus())}),this.view.observer.setSelectionRange(d,p)),this.impreciseAnchor=d.precise?null:new Ka(f.anchorNode,f.anchorOffset),this.impreciseHead=p.precise?null:new Ka(f.focusNode,f.focusOffset)}suppressWidgetCursorChange(n,r){return this.hasComposition&&r.empty&&ng(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)&&this.posFromDOM(n.focusNode,n.focusOffset)==r.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:n}=this,r=n.state.selection.main,i=Og(n.root),{anchorNode:s,anchorOffset:a}=n.observer.selectionRange;if(!i||!r.empty||!r.assoc||!i.modify)return;let o=this.lineAt(r.head,r.assoc);if(!o)return;let l=o.posAtStart;if(r.head==l||r.head==l+o.length)return;let u=this.coordsAt(r.head,-1),d=this.coordsAt(r.head,1);if(!u||!d||u.bottom>d.top)return;let p=this.domAtPos(r.head+r.assoc,r.assoc);i.collapse(p.node,p.offset),i.modify("move",r.assoc<0?"forward":"backward","lineboundary"),n.observer.readSelectionRange();let f=n.observer.selectionRange;n.docView.posFromDOM(f.anchorNode,f.anchorOffset)!=r.from&&i.collapse(s,a)}posFromDOM(n,r){let i=this.tile.nearest(n);if(!i)return this.tile.dom.compareDocumentPosition(n)&2?0:this.view.state.doc.length;let s=i.posAtStart;if(i.isComposite()){let a;if(n==i.dom)a=i.dom.childNodes[r];else{let o=Yl(n)==0?0:r==0?-1:1;for(;;){let l=n.parentNode;if(l==i.dom)break;o==0&&l.firstChild!=l.lastChild&&(n==l.firstChild?o=-1:o=1),n=l}o<0?a=n:a=n.nextSibling}if(a==i.dom.firstChild)return s;for(;a&&!Or.get(a);)a=a.nextSibling;if(!a)return s+i.length;for(let o=0,l=s;;o++){let u=i.children[o];if(u.dom==a)return l;l+=u.length+u.breakAfter}}else return i.isText()?n==i.dom?s+r:s+(r?i.length:0):s}domAtPos(n,r){let{tile:i,offset:s}=this.tile.resolveBlock(n,r);return i.isWidget()?i.domPosFor(n,r):i.domIn(s,r)}inlineDOMNearPos(n,r){let i,s=-1,a=!1,o,l=-1,u=!1;return this.tile.blockTiles((d,p)=>{if(d.isWidget()){if(d.flags&32&&p>=n)return!0;d.flags&16&&(a=!0)}else{let f=p+d.length;if(p<=n&&(i=d,s=n-p,a=f<n),f>=n&&!o&&(o=d,l=n-p,u=p>n),p>n&&o)return!0}}),!i&&!o?this.domAtPos(n,r):(a&&o?i=null:u&&i&&(o=null),i&&r<0||!o?i.domIn(s,r):o.domIn(l,r))}coordsAt(n,r){let{tile:i,offset:s}=this.tile.resolveBlock(n,r);return i.isWidget()?i.widget instanceof bS?null:i.coordsInWidget(s,r,!0):i.coordsIn(s,r)}lineAt(n,r){let{tile:i}=this.tile.resolveBlock(n,r);return i.isLine()?i:null}coordsForChar(n){let{tile:r,offset:i}=this.tile.resolveBlock(n,1);if(!r.isLine())return null;function s(a,o){if(a.isComposite())for(let l of a.children){if(l.length>=o){let u=s(l,o);if(u)return u}if(o-=l.length,o<0)break}else if(a.isText()&&o<a.length){let l=pi(a.text,o);if(l==o)return null;let u=Pg(a.dom,o,l).getClientRects();for(let d=0;d<u.length;d++){let p=u[d];if(d==u.length-1||p.top<p.bottom&&p.left<p.right)return p}}return null}return s(r,i)}measureVisibleLineHeights(n){let r=[],{from:i,to:s}=n,a=this.view.contentDOM.clientWidth,o=a>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,l=-1,u=this.view.textDirection==Jn.LTR,d=0,p=(f,g,_)=>{for(let x=0;x<f.children.length&&!(g>s);x++){let v=f.children[x],S=g+v.length,w=v.dom.getBoundingClientRect(),{height:N}=w;if(_&&!x&&(d+=w.top-_.top),v instanceof $l)S>i&&p(v,g,w);else if(g>=i&&(d>0&&r.push(-d),r.push(N+d),d=0,o)){let C=v.dom.lastChild,T=C?tg(C):[];if(T.length){let A=T[T.length-1],E=u?A.right-w.left:w.right-A.left;E>l&&(l=E,this.minWidth=a,this.minWidthFrom=g,this.minWidthTo=S)}}_&&x==f.children.length-1&&(d+=_.bottom-w.bottom),g=S+v.breakAfter}};return p(this.tile,0,null),r}textDirectionAt(n){let{tile:r}=this.tile.resolveBlock(n,1);return getComputedStyle(r.dom).direction=="rtl"?Jn.RTL:Jn.LTR}measureTextSize(){let n=this.tile.blockTiles(o=>{if(o.isLine()&&o.children.length&&o.length<=20){let l=0,u;for(let d of o.children){if(!d.isText()||/[^ -~]/.test(d.text))return;let p=tg(d.dom);if(p.length!=1)return;l+=p[0].width,u=p[0].height}if(l)return{lineHeight:o.dom.getBoundingClientRect().height,charWidth:l/o.length,textHeight:u}}});if(n)return n;let r=document.createElement("div"),i,s,a;return r.className="cm-line",r.style.width="99999px",r.style.position="absolute",r.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.tile.dom.appendChild(r);let o=tg(r.firstChild)[0];i=r.getBoundingClientRect().height,s=o&&o.width?o.width/27:7,a=o&&o.height?o.height:i,r.remove()}),{lineHeight:i,charWidth:s,textHeight:a}}computeBlockGapDeco(){let n=[],r=this.view.viewState;for(let i=0,s=0;;s++){let a=s==r.viewports.length?null:r.viewports[s],o=a?a.from-1:this.view.state.doc.length;if(o>i){let l=(r.lineBlockAt(o).bottom-r.lineBlockAt(i).top)/this.view.scaleY;n.push(Wt.replace({widget:new bS(l),block:!0,inclusive:!0,isBlockGap:!0}).range(i,o))}if(!a)break;i=a.to+1}return Wt.set(n)}updateDeco(){let n=1,r=this.view.state.facet(O0).map(a=>(this.dynamicDecorationMap[n++]=typeof a=="function")?a(this.view):a),i=!1,s=this.view.state.facet(zA).map((a,o)=>{let l=typeof a=="function";return l&&(i=!0),l?a(this.view):a});for(s.length&&(this.dynamicDecorationMap[n++]=i,r.push(on.join(s))),this.decorations=[this.editContextFormatting,...r,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];n<this.decorations.length;)this.dynamicDecorationMap[n++]=!1;this.blockWrappers=this.view.state.facet(wH).map(a=>typeof a=="function"?a(this.view):a)}scrollIntoView(n){var r;if(n.isSnapshot){let p=this.view.viewState.lineBlockAt(n.range.head);this.view.scrollDOM.scrollTop=p.top-n.yMargin,this.view.scrollDOM.scrollLeft=n.xMargin;return}for(let p of this.view.state.facet(xH))try{if(p(this.view,n.range,n))return!0}catch(f){es(this.view.state,f,"scroll handler")}let{range:i}=n,s=this.coordsAt(i.head,(r=i.assoc)!==null&&r!==void 0?r:i.empty?0:i.head>i.anchor?-1:1),a;if(!s)return;!i.empty&&(a=this.coordsAt(i.anchor,i.anchor>i.head?-1:1))&&(s={left:Math.min(s.left,a.left),top:Math.min(s.top,a.top),right:Math.max(s.right,a.right),bottom:Math.max(s.bottom,a.bottom)});let o=$A(this.view),l={left:s.left-o.left,top:s.top-o.top,right:s.right+o.right,bottom:s.bottom+o.bottom},{offsetWidth:u,offsetHeight:d}=this.view.scrollDOM;if(T_e(this.view.scrollDOM,l,i.head<i.anchor?-1:1,n.x,n.y,Math.max(Math.min(n.xMargin,u),-u),Math.max(Math.min(n.yMargin,d),-d),this.view.textDirection==Jn.LTR),window.visualViewport&&window.innerHeight-window.visualViewport.height>1&&(s.top>window.pageYOffset+window.visualViewport.offsetTop+window.visualViewport.height||s.bottom<window.pageYOffset+window.visualViewport.offsetTop)){let p=this.view.docView.lineAt(i.head,1);p&&p.dom.scrollIntoView({block:"nearest"})}}lineHasWidget(n){let r=i=>i.isWidget()||i.children.some(r);return r(this.tile.resolveBlock(n,1).tile)}destroy(){Yj(this.tile)}}function Yj(e,n){let r=n==null?void 0:n.get(e);if(r!=1){r==null&&e.destroy();for(let i of e.children)Yj(i,n)}}function nxe(e){return e.node.nodeType==1&&e.node.firstChild&&(e.offset==0||e.node.childNodes[e.offset-1].contentEditable=="false")&&(e.offset==e.node.childNodes.length||e.node.childNodes[e.offset].contentEditable=="false")}function NH(e,n){let r=e.observer.selectionRange;if(!r.focusNode)return null;let i=sH(r.focusNode,r.focusOffset),s=aH(r.focusNode,r.focusOffset),a=i||s;if(s&&i&&s.node!=i.node){let l=Or.get(s.node);if(!l||l.isText()&&l.text!=s.node.nodeValue)a=s;else if(e.docView.lastCompositionAfterCursor){let u=Or.get(i.node);!u||u.isText()&&u.text!=i.node.nodeValue||(a=s)}}if(e.docView.lastCompositionAfterCursor=a!=i,!a)return null;let o=n-a.offset;return{from:o,to:o+a.node.nodeValue.length,node:a.node}}function rxe(e,n,r){let i=NH(e,r);if(!i)return null;let{node:s,from:a,to:o}=i,l=s.nodeValue;if(/[\n\r]/.test(l)||e.state.doc.sliceString(i.from,i.to)!=l)return null;let u=n.invertedDesc;return{range:new wa(u.mapPos(a),u.mapPos(o),a,o),text:s}}function ixe(e,n){return e.nodeType!=1?0:(n&&e.childNodes[n-1].contentEditable=="false"?1:0)|(n<e.childNodes.length&&e.childNodes[n].contentEditable=="false"?2:0)}let sxe=class{constructor(){this.changes=[]}compareRange(n,r){df(n,r,this.changes)}comparePoint(n,r){df(n,r,this.changes)}boundChange(n){df(n,n,this.changes)}};function axe(e,n,r){let i=new sxe;return on.compare(e,n,r,i),i.changes}class oxe{constructor(){this.changes=[]}compareRange(n,r){df(n,r,this.changes)}comparePoint(){}boundChange(n){df(n,n,this.changes)}}function lxe(e,n,r){let i=new oxe;return on.compare(e,n,r,i),i.changes}function cxe(e,n){for(let r=e;r&&r!=n;r=r.assignedSlot||r.parentNode)if(r.nodeType==1&&r.contentEditable=="false")return!0;return!1}function uxe(e,n){let r=!1;return n&&e.iterChangedRanges((i,s)=>{i<n.to&&s>n.from&&(r=!0)}),r}class bS extends nl{constructor(n){super(),this.height=n}toDOM(){let n=document.createElement("div");return n.className="cm-gap",this.updateDOM(n),n}eq(n){return n.height==this.height}updateDOM(n){return n.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}function dxe(e,n,r=1){let i=e.charCategorizer(n),s=e.doc.lineAt(n),a=n-s.from;if(s.length==0)return Ze.cursor(n);a==0?r=1:a==s.length&&(r=-1);let o=a,l=a;r<0?o=pi(s.text,a,!1):l=pi(s.text,a);let u=i(s.text.slice(o,l));for(;o>0;){let d=pi(s.text,o,!1);if(i(s.text.slice(d,o))!=u)break;o=d}for(;l<s.length;){let d=pi(s.text,l);if(i(s.text.slice(l,d))!=u)break;l=d}return Ze.range(o+s.from,l+s.from)}function hxe(e,n,r,i,s){let a=Math.round((i-n.left)*e.defaultCharacterWidth);if(e.lineWrapping&&r.height>e.defaultLineHeight*1.5){let l=e.viewState.heightOracle.textHeight,u=Math.floor((s-r.top-(e.defaultLineHeight-l)*.5)/l);a+=u*e.viewState.heightOracle.lineLength}let o=e.state.sliceDoc(r.from,r.to);return r.from+Lj(o,a,e.state.tabSize)}function Gj(e,n,r){let i=e.lineBlockAt(n);if(Array.isArray(i.type)){let s;for(let a of i.type){if(a.from>n)break;if(!(a.to<n)){if(a.from<n&&a.to>n)return a;(!s||a.type==Ai.Text&&(s.type!=a.type||(r<0?a.from<n:a.to>n)))&&(s=a)}}return s||i}return i}function fxe(e,n,r,i){let s=Gj(e,n.head,n.assoc||-1),a=!i||s.type!=Ai.Text||!(e.lineWrapping||s.widgetLineBreaks)?null:e.coordsAtPos(n.assoc<0&&n.head>s.from?n.head-1:n.head);if(a){let o=e.dom.getBoundingClientRect(),l=e.textDirectionAt(s.from),u=e.posAtCoords({x:r==(l==Jn.LTR)?o.right-1:o.left+1,y:(a.top+a.bottom)/2});if(u!=null)return Ze.cursor(u,r?-1:1)}return Ze.cursor(r?s.to:s.from,r?-1:1)}function AP(e,n,r,i){let s=e.state.doc.lineAt(n.head),a=e.bidiSpans(s),o=e.textDirectionAt(s.from);for(let l=n,u=null;;){let d=F_e(s,a,o,l,r),p=dH;if(!d){if(s.number==(r?e.state.doc.lines:1))return l;p=`
`,s=e.state.doc.line(s.number+(r?1:-1)),a=e.bidiSpans(s),d=e.visualLineSide(s,!r)}if(u){if(!u(p))return l}else{if(!i)return d;u=i(p)}l=d}}function pxe(e,n,r){let i=e.state.charCategorizer(n),s=i(r);return a=>{let o=i(a);return s==yr.Space&&(s=o),s==o}}function mxe(e,n,r,i){let s=n.head,a=r?1:-1;if(s==(r?e.state.doc.length:0))return Ze.cursor(s,n.assoc);let o=n.goalColumn,l,u=e.contentDOM.getBoundingClientRect(),d=e.coordsAtPos(s,n.assoc||((n.empty?r:n.head==n.from)?1:-1)),p=e.documentTop;if(d)o==null&&(o=d.left-u.left),l=a<0?d.top:d.bottom;else{let x=e.viewState.lineBlockAt(s);o==null&&(o=Math.min(u.right-u.left,e.defaultCharacterWidth*(s-x.from))),l=(a<0?x.top:x.bottom)+p}let f=u.left+o,g=e.viewState.heightOracle.textHeight>>1,_=i??g;for(let x=0;;x+=g){let v=l+(_+x)*a,S=Xj(e,{x:f,y:v},!1,a);if(r?v>u.bottom:v<u.top)return Ze.cursor(S.pos,S.assoc);let w=e.coordsAtPos(S.pos,S.assoc),N=w?(w.top+w.bottom)/2:0;if(!w||(r?N>l:N<l))return Ze.cursor(S.pos,S.assoc,void 0,o)}}function rg(e,n,r){for(;;){let i=0;for(let s of e)s.between(n-1,n+1,(a,o,l)=>{if(n>a&&n<o){let u=i||r||(n-a<o-n?-1:1);n=u<0?a:o,i=u}});if(!i)return n}}function EH(e,n){let r=null;for(let i=0;i<n.ranges.length;i++){let s=n.ranges[i],a=null;if(s.empty){let o=rg(e,s.from,0);o!=s.from&&(a=Ze.cursor(o,-1))}else{let o=rg(e,s.from,-1),l=rg(e,s.to,1);(o!=s.from||l!=s.to)&&(a=Ze.range(s.from==s.anchor?o:l,s.from==s.head?o:l))}a&&(r||(r=n.ranges.slice()),r[i]=a)}return r?Ze.create(r,n.mainIndex):n}function kS(e,n,r){let i=rg(e.state.facet(Nv).map(s=>s(e)),r.from,n.head>r.from?-1:1);return i==r.from?r:Ze.cursor(i,i<r.from?1:-1)}class Po{constructor(n,r){this.pos=n,this.assoc=r}}function Xj(e,n,r,i){let s=e.contentDOM.getBoundingClientRect(),a=s.top+e.viewState.paddingTop,{x:o,y:l}=n,u=l-a,d;for(;;){if(u<0)return new Po(0,1);if(u>e.viewState.docHeight)return new Po(e.state.doc.length,-1);if(d=e.elementAtHeight(u),i==null)break;if(d.type==Ai.Text){if(i<0?d.to<e.viewport.from:d.from>e.viewport.to)break;let g=e.docView.coordsAt(i<0?d.from:d.to,i>0?-1:1);if(g&&(i<0?g.top<=u+a:g.bottom>=u+a))break}let f=e.viewState.heightOracle.textHeight/2;u=i>0?d.bottom+f:d.top-f}if(e.viewport.from>=d.to||e.viewport.to<=d.from){if(r)return null;if(d.type==Ai.Text){let f=hxe(e,s,d,o,l);return new Po(f,f==d.from?1:-1)}}if(d.type!=Ai.Text)return u<(d.top+d.bottom)/2?new Po(d.from,1):new Po(d.to,-1);let p=e.docView.lineAt(d.from,2);return(!p||p.length!=d.length)&&(p=e.docView.lineAt(d.from,-2)),new gxe(e,o,l,e.textDirectionAt(d.from)).scanTile(p,d.from)}class gxe{constructor(n,r,i,s){this.view=n,this.x=r,this.y=i,this.baseDir=s,this.line=null,this.spans=null}bidiSpansAt(n){return(!this.line||this.line.from>n||this.line.to<n)&&(this.line=this.view.state.doc.lineAt(n),this.spans=this.view.bidiSpans(this.line)),this}baseDirAt(n,r){let{line:i,spans:s}=this.bidiSpansAt(n);return s[zo.find(s,n-i.from,-1,r)].level==this.baseDir}dirAt(n,r){let{line:i,spans:s}=this.bidiSpansAt(n);return s[zo.find(s,n-i.from,-1,r)].dir}bidiIn(n,r){let{spans:i,line:s}=this.bidiSpansAt(n);return i.length>1||i.length&&(i[0].level!=this.baseDir||i[0].to+s.from<r)}scan(n,r){let i=0,s=n.length-1,a=new Set,o=this.bidiIn(n[0],n[s]),l,u,d=-1,p=1e9,f;e:for(;i<s;){let _=s-i,x=i+s>>1;t:if(a.has(x)){let S=i+Math.floor(Math.random()*_);for(let w=0;w<_;w++){if(!a.has(S)){x=S;break t}S++,S==s&&(S=i)}break e}a.add(x);let v=r(x);if(v)for(let S=0;S<v.length;S++){let w=v[S],N=0;if(!(w.width==0&&v.length>1)){if(w.bottom<this.y)(!l||l.bottom<w.bottom)&&(l=w),N=1;else if(w.top>this.y)(!u||u.top>w.top)&&(u=w),N=-1;else{let C=w.left>this.x?this.x-w.left:w.right<this.x?this.x-w.right:0,T=Math.abs(C);T<p&&(d=x,p=T,f=w),C&&(N=C<0==(this.baseDir==Jn.LTR)?-1:1)}N==-1&&(!o||this.baseDirAt(n[x],1))?s=x:N==1&&(!o||this.baseDirAt(n[x+1],-1))&&(i=x+1)}}}if(!f){let _=l&&(!u||this.y-l.bottom<u.top-this.y)?l:u;return this.y=(_.top+_.bottom)/2,this.scan(n,r)}if(p){if(l&&l.bottom>f.top)return this.y=l.bottom-1,this.scan(n,r);if(u&&u.top<f.bottom)return this.y=u.top+1,this.scan(n,r)}let g=(o?this.dirAt(n[d],1):this.baseDir)==Jn.LTR;return{i:d,after:this.x>(f.left+f.right)/2==g}}scanText(n,r){let i=[];for(let a=0;a<n.length;a=pi(n.text,a))i.push(r+a);i.push(r+n.length);let s=this.scan(i,a=>{let o=i[a]-r,l=i[a+1]-r;return Pg(n.dom,o,l).getClientRects()});return s.after?new Po(i[s.i+1],-1):new Po(i[s.i],1)}scanTile(n,r){if(!n.length)return new Po(r,1);if(n.children.length==1){let l=n.children[0];if(l.isText())return this.scanText(l,r);if(l.isComposite())return this.scanTile(l,r)}let i=[r];for(let l=0,u=r;l<n.children.length;l++)i.push(u+=n.children[l].length);let s=this.scan(i,l=>{let u=n.children[l];return u.flags&48?null:(u.dom.nodeType==1?u.dom:Pg(u.dom,0,u.length)).getClientRects()}),a=n.children[s.i],o=i[s.i];return a.isText()?this.scanText(a,o):a.isComposite()?this.scanTile(a,o):s.after?new Po(i[s.i+1],-1):new Po(o,1)}}const zh="";class vxe{constructor(n,r){this.points=n,this.view=r,this.text="",this.lineSeparator=r.state.facet(bn.lineSeparator)}append(n){this.text+=n}lineBreak(){this.text+=zh}readRange(n,r){if(!n)return this;let i=n.parentNode;for(let s=n;;){this.findPointBefore(i,s);let a=this.text.length;this.readNode(s);let o=Or.get(s),l=s.nextSibling;if(l==r){o!=null&&o.breakAfter&&!l&&i!=this.view.contentDOM&&this.lineBreak();break}let u=Or.get(l);(o&&u?o.breakAfter:(o?o.breakAfter:hb(s))||hb(l)&&(s.nodeName!="BR"||o!=null&&o.isWidget())&&this.text.length>a)&&!_xe(l,r)&&this.lineBreak(),s=l}return this.findPointBefore(i,r),this}readTextNode(n){let r=n.nodeValue;for(let i of this.points)i.node==n&&(i.pos=this.text.length+Math.min(i.offset,r.length));for(let i=0,s=this.lineSeparator?null:/\r\n?|\n/g;;){let a=-1,o=1,l;if(this.lineSeparator?(a=r.indexOf(this.lineSeparator,i),o=this.lineSeparator.length):(l=s.exec(r))&&(a=l.index,o=l[0].length),this.append(r.slice(i,a<0?r.length:a)),a<0)break;if(this.lineBreak(),o>1)for(let u of this.points)u.node==n&&u.pos>this.text.length&&(u.pos-=o-1);i=a+o}}readNode(n){let r=Or.get(n),i=r&&r.overrideDOMText;if(i!=null){this.findPointInside(n,i.length);for(let s=i.iter();!s.next().done;)s.lineBreak?this.lineBreak():this.append(s.value)}else n.nodeType==3?this.readTextNode(n):n.nodeName=="BR"?n.nextSibling&&this.lineBreak():n.nodeType==1&&this.readRange(n.firstChild,null)}findPointBefore(n,r){for(let i of this.points)i.node==n&&n.childNodes[i.offset]==r&&(i.pos=this.text.length)}findPointInside(n,r){for(let i of this.points)(n.nodeType==3?i.node==n:n.contains(i.node))&&(i.pos=this.text.length+(yxe(n,i.node,i.offset)?r:0))}}function yxe(e,n,r){for(;;){if(!n||r<Yl(n))return!1;if(n==e)return!0;r=lu(n)+1,n=n.parentNode}}function _xe(e,n){let r;for(;!(e==n||!e);e=e.nextSibling){let i=Or.get(e);if(!(i!=null&&i.isWidget()))return!1;i&&(r||(r=[])).push(i)}if(r)for(let i of r){let s=i.overrideDOMText;if(s!=null&&s.length)return!1}return!0}class TP{constructor(n,r){this.node=n,this.offset=r,this.pos=-1}}class xxe{constructor(n,r,i,s){this.typeOver=s,this.bounds=null,this.text="",this.domChanged=r>-1;let{impreciseHead:a,impreciseAnchor:o}=n.docView,l=n.state.selection;if(n.state.readOnly&&r>-1)this.newSel=null;else if(r>-1&&(this.bounds=AH(n.docView.tile,r,i,0))){let u=a||o?[]:kxe(n),d=new vxe(u,n);d.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=d.text,this.newSel=wxe(u,this.bounds.from)}else{let u=n.observer.selectionRange,d=a&&a.node==u.focusNode&&a.offset==u.focusOffset||!Wj(n.contentDOM,u.focusNode)?l.main.head:n.docView.posFromDOM(u.focusNode,u.focusOffset),p=o&&o.node==u.anchorNode&&o.offset==u.anchorOffset||!Wj(n.contentDOM,u.anchorNode)?l.main.anchor:n.docView.posFromDOM(u.anchorNode,u.anchorOffset),f=n.viewport;if((Et.ios||Et.chrome)&&l.main.empty&&d!=p&&(f.from>0||f.to<n.state.doc.length)){let g=Math.min(d,p),_=Math.max(d,p),x=f.from-g,v=f.to-_;(x==0||x==1||g==0)&&(v==0||v==-1||_==n.state.doc.length)&&(d=0,p=n.state.doc.length)}if(n.inputState.composing>-1&&l.ranges.length>1)this.newSel=l.replaceRange(Ze.range(p,d));else if(n.lineWrapping&&p==d&&!(l.main.empty&&l.main.head==d)&&n.inputState.lastTouchTime>Date.now()-100){let g=n.coordsAtPos(d,-1),_=0;g&&(_=n.inputState.lastTouchY<=g.bottom?-1:1),this.newSel=Ze.create([Ze.cursor(d,_)])}else this.newSel=Ze.single(p,d)}}}function AH(e,n,r,i){if(e.isComposite()){let s=-1,a=-1,o=-1,l=-1;for(let u=0,d=i,p=i;u<e.children.length;u++){let f=e.children[u],g=d+f.length;if(d<n&&g>r)return AH(f,n,r,d);if(g>=n&&s==-1&&(s=u,a=d),d>r&&f.dom.parentNode==e.dom){o=u,l=p;break}p=g,d=g+f.breakAfter}return{from:a,to:l<0?i+e.length:l,startDOM:(s?e.children[s-1].dom.nextSibling:null)||e.dom.firstChild,endDOM:o<e.children.length&&o>=0?e.children[o].dom:null}}else return e.isText()?{from:i,to:i+e.length,startDOM:e.dom,endDOM:e.dom.nextSibling}:null}function TH(e,n){let r,{newSel:i}=n,{state:s}=e,a=s.selection.main,o=e.inputState.lastKeyTime>Date.now()-100?e.inputState.lastKeyCode:-1;if(n.bounds){let{from:l,to:u}=n.bounds,d=a.from,p=null;(o===8||Et.android&&n.text.length<u-l)&&(d=a.to,p="end");let f=s.doc.sliceString(l,u,zh),g,_;!a.empty&&a.from>=l&&a.to<=u&&(n.typeOver||f!=n.text)&&f.slice(0,a.from-l)==n.text.slice(0,a.from-l)&&f.slice(a.to-l)==n.text.slice(g=n.text.length-(f.length-(a.to-l)))?r={from:a.from,to:a.to,insert:Pn.of(n.text.slice(a.from-l,g).split(zh))}:(_=MH(f,n.text,d-l,p))&&(Et.chrome&&o==13&&_.toB==_.from+2&&n.text.slice(_.from,_.toB)==zh+zh&&_.toB--,r={from:l+_.from,to:l+_.toA,insert:Pn.of(n.text.slice(_.from,_.toB).split(zh))})}else i&&(!e.hasFocus&&s.facet(Ol)||gb(i,a))&&(i=null);if(!r&&!i)return!1;if((Et.mac||Et.android)&&r&&r.from==r.to&&r.from==a.head-1&&/^\. ?$/.test(r.insert.toString())&&e.contentDOM.getAttribute("autocorrect")=="off"?(i&&r.insert.length==2&&(i=Ze.single(i.main.anchor-1,i.main.head-1)),r={from:r.from,to:r.to,insert:Pn.of([r.insert.toString().replace("."," ")])}):s.doc.lineAt(a.from).to<a.to&&e.docView.lineHasWidget(a.to)&&e.inputState.insertingTextAt>Date.now()-50?r={from:a.from,to:a.to,insert:s.toText(e.inputState.insertingText)}:Et.chrome&&r&&r.from==r.to&&r.from==a.head&&r.insert.toString()==`
 `&&e.lineWrapping&&(i&&(i=Ze.single(i.main.anchor-1,i.main.head-1)),r={from:a.from,to:a.to,insert:Pn.of([" "])}),r)return FA(e,r,i,o);if(i&&!gb(i,a)){let l=!1,u="select";return e.inputState.lastSelectionTime>Date.now()-50&&(e.inputState.lastSelectionOrigin=="select"&&(l=!0),u=e.inputState.lastSelectionOrigin,u=="select.pointer"&&(i=EH(s.facet(Nv).map(d=>d(e)),i))),e.dispatch({selection:i,scrollIntoView:l,userEvent:u}),!0}else return!1}function FA(e,n,r,i=-1){if(Et.ios&&e.inputState.flushIOSKey(n))return!0;let s=e.state.selection.main;if(Et.android&&(n.to==s.to&&(n.from==s.from||n.from==s.from-1&&e.state.sliceDoc(n.from,s.from)==" ")&&n.insert.length==1&&n.insert.lines==2&&hf(e.contentDOM,"Enter",13)||(n.from==s.from-1&&n.to==s.to&&n.insert.length==0||i==8&&n.insert.length<n.to-n.from&&n.to>s.head)&&hf(e.contentDOM,"Backspace",8)||n.from==s.from&&n.to==s.to+1&&n.insert.length==0&&hf(e.contentDOM,"Delete",46)))return!0;let a=n.insert.toString();e.inputState.composing>=0&&e.inputState.composing++;let o,l=()=>o||(o=bxe(e,n,r));return e.state.facet(gH).some(u=>u(e,n.from,n.to,a,l))||e.dispatch(l()),!0}function bxe(e,n,r){let i,s=e.state,a=s.selection.main,o=-1;if(n.from==n.to&&n.from<a.from||n.from>a.to){let u=n.from<a.from?-1:1,d=u<0?a.from:a.to,p=rg(s.facet(Nv).map(f=>f(e)),d,u);n.from==p&&(o=p)}if(o>-1)i={changes:n,selection:Ze.cursor(n.from+n.insert.length,-1)};else if(n.from>=a.from&&n.to<=a.to&&n.to-n.from>=(a.to-a.from)/3&&(!r||r.main.empty&&r.main.from==n.from+n.insert.length)&&e.inputState.composing<0){let u=a.from<n.from?s.sliceDoc(a.from,n.from):"",d=a.to>n.to?s.sliceDoc(n.to,a.to):"";i=s.replaceSelection(e.state.toText(u+n.insert.sliceString(0,void 0,e.state.lineBreak)+d))}else{let u=s.changes(n),d=r&&r.main.to<=u.newLength?r.main:void 0;if(s.selection.ranges.length>1&&(e.inputState.composing>=0||e.inputState.compositionPendingChange)&&n.to<=a.to+10&&n.to>=a.to-10){let p=e.state.sliceDoc(n.from,n.to),f,g=r&&NH(e,r.main.head);if(g){let x=n.insert.length-(n.to-n.from);f={from:g.from,to:g.to-x}}else f=e.state.doc.lineAt(a.head);let _=a.to-n.to;i=s.changeByRange(x=>{if(x.from==a.from&&x.to==a.to)return{changes:u,range:d||x.map(u)};let v=x.to-_,S=v-p.length;if(e.state.sliceDoc(S,v)!=p||v>=f.from&&S<=f.to)return{range:x};let w=s.changes({from:S,to:v,insert:n.insert}),N=x.to-a.to;return{changes:w,range:d?Ze.range(Math.max(0,d.anchor+N),Math.max(0,d.head+N)):x.map(w)}})}else i={changes:u,selection:d&&s.selection.replaceRange(d)}}let l="input.type";return(e.composing||e.inputState.compositionPendingChange&&e.inputState.compositionEndedAt>Date.now()-50)&&(e.inputState.compositionPendingChange=!1,l+=".compose",e.inputState.compositionFirstChange&&(l+=".start",e.inputState.compositionFirstChange=!1)),s.update(i,{userEvent:l,scrollIntoView:!0})}function MH(e,n,r,i){let s=Math.min(e.length,n.length),a=0;for(;a<s&&e.charCodeAt(a)==n.charCodeAt(a);)a++;if(a==s&&e.length==n.length)return null;let o=e.length,l=n.length;for(;o>0&&l>0&&e.charCodeAt(o-1)==n.charCodeAt(l-1);)o--,l--;if(i=="end"){let u=Math.max(0,a-Math.min(o,l));r-=o+u-a}if(o<a&&e.length<n.length){let u=r<=a&&r>=o?a-r:0;a-=u,l=a+(l-o),o=a}else if(l<a){let u=r<=a&&r>=l?a-r:0;a-=u,o=a+(o-l),l=a}return{from:a,toA:o,toB:l}}function kxe(e){let n=[];if(e.root.activeElement!=e.contentDOM)return n;let{anchorNode:r,anchorOffset:i,focusNode:s,focusOffset:a}=e.observer.selectionRange;return r&&(n.push(new TP(r,i)),(s!=r||a!=i)&&n.push(new TP(s,a))),n}function wxe(e,n){if(e.length==0)return null;let r=e[0].pos,i=e.length==2?e[1].pos:r;return r>-1&&i>-1?Ze.single(r+n,i+n):null}function gb(e,n){return n.head==e.main.head&&n.anchor==e.main.anchor}class Sxe{setSelectionOrigin(n){this.lastSelectionOrigin=n,this.lastSelectionTime=Date.now()}constructor(n){this.view=n,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastTouchX=0,this.lastTouchY=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.lastWheelEvent=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=n.hasFocus,Et.safari&&n.contentDOM.addEventListener("input",()=>null),Et.gecko&&zxe(n.contentDOM.ownerDocument)}handleEvent(n){!Rxe(this.view,n)||this.ignoreDuringComposition(n)||n.type=="keydown"&&this.keydown(n)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(n.type,n)):this.runHandlers(n.type,n))}runHandlers(n,r){let i=this.handlers[n];if(i){for(let s of i.observers)s(this.view,r);for(let s of i.handlers){if(r.defaultPrevented)break;if(s(this.view,r)){r.preventDefault();break}}}}ensureHandlers(n){let r=Cxe(n),i=this.handlers,s=this.view.contentDOM;for(let a in r)if(a!="scroll"){let o=!r[a].handlers.length,l=i[a];l&&o!=!l.handlers.length&&(s.removeEventListener(a,this.handleEvent),l=null),l||s.addEventListener(a,this.handleEvent,{passive:o})}for(let a in i)a!="scroll"&&!r[a]&&s.removeEventListener(a,this.handleEvent);this.handlers=r}keydown(n){if(this.lastKeyCode=n.keyCode,this.lastKeyTime=Date.now(),n.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&n.keyCode!=27&&OH.indexOf(n.keyCode)<0&&(this.tabFocusMode=-1),Et.android&&Et.chrome&&!n.synthetic&&(n.keyCode==13||n.keyCode==8))return this.view.observer.delayAndroidKey(n.key,n.keyCode),!0;let r;return Et.ios&&!n.synthetic&&!n.altKey&&!n.metaKey&&!n.shiftKey&&((r=RH.find(i=>i.keyCode==n.keyCode))&&!n.ctrlKey||jxe.indexOf(n.key)>-1&&n.ctrlKey)?(this.pendingIOSKey=r||n,setTimeout(()=>this.flushIOSKey(),250),!0):(n.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(n){let r=this.pendingIOSKey;return!r||r.key=="Enter"&&n&&n.from<n.to&&/^\S+$/.test(n.insert.toString())?!1:(this.pendingIOSKey=void 0,hf(this.view.contentDOM,r.key,r.keyCode,r instanceof KeyboardEvent?r:void 0))}ignoreDuringComposition(n){return!/^key/.test(n.type)||n.synthetic?!1:this.composing>0?!0:Et.safari&&!Et.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1}startMouseSelection(n){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=n}update(n){this.view.observer.update(n),this.mouseSelection&&this.mouseSelection.update(n),this.draggedContent&&n.docChanged&&(this.draggedContent=this.draggedContent.map(n.changes)),n.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function MP(e,n){return(r,i)=>{try{return n.call(e,i,r)}catch(s){es(r.state,s)}}}function Cxe(e){let n=Object.create(null);function r(i){return n[i]||(n[i]={observers:[],handlers:[]})}for(let i of e){let s=i.spec,a=s&&s.plugin.domEventHandlers,o=s&&s.plugin.domEventObservers;if(a)for(let l in a){let u=a[l];u&&r(l).handlers.push(MP(i.value,u))}if(o)for(let l in o){let u=o[l];u&&r(l).observers.push(MP(i.value,u))}}for(let i in eo)r(i).handlers.push(eo[i]);for(let i in Es)r(i).observers.push(Es[i]);return n}const RH=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],jxe="dthko",OH=[16,17,18,20,91,92,224,225],p_=6;function m_(e){return Math.max(0,e)*.7+8}function Nxe(e,n){return Math.max(Math.abs(e.clientX-n.clientX),Math.abs(e.clientY-n.clientY))}class Exe{constructor(n,r,i,s){this.view=n,this.startEvent=r,this.style=i,this.mustSelect=s,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=r,this.scrollParents=nH(n.contentDOM),this.atoms=n.state.facet(Nv).map(o=>o(n));let a=n.contentDOM.ownerDocument;a.addEventListener("mousemove",this.move=this.move.bind(this)),a.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=r.shiftKey,this.multiple=n.state.facet(bn.allowMultipleSelections)&&Axe(n,r),this.dragging=Mxe(n,r)&&LH(r)==1?null:!1}start(n){this.dragging===!1&&this.select(n)}move(n){if(n.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&Nxe(this.startEvent,n)<10)return;this.select(this.lastEvent=n);let r=0,i=0,s=0,a=0,o=this.view.win.innerWidth,l=this.view.win.innerHeight;this.scrollParents.x&&({left:s,right:o}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:a,bottom:l}=this.scrollParents.y.getBoundingClientRect());let u=$A(this.view);n.clientX-u.left<=s+p_?r=-m_(s-n.clientX):n.clientX+u.right>=o-p_&&(r=m_(n.clientX-o)),n.clientY-u.top<=a+p_?i=-m_(a-n.clientY):n.clientY+u.bottom>=l-p_&&(i=m_(n.clientY-l)),this.setScrollSpeed(r,i)}up(n){this.dragging==null&&this.select(this.lastEvent),this.dragging||n.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let n=this.view.contentDOM.ownerDocument;n.removeEventListener("mousemove",this.move),n.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(n,r){this.scrollSpeed={x:n,y:r},n||r?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:n,y:r}=this.scrollSpeed;n&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=n,n=0),r&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=r,r=0),(n||r)&&this.view.win.scrollBy(n,r),this.dragging===!1&&this.select(this.lastEvent)}select(n){let{view:r}=this,i=EH(this.atoms,this.style.get(n,this.extend,this.multiple));(this.mustSelect||!i.eq(r.state.selection,this.dragging===!1))&&this.view.dispatch({selection:i,userEvent:"select.pointer"}),this.mustSelect=!1}update(n){n.transactions.some(r=>r.isUserEvent("input.type"))?this.destroy():this.style.update(n)&&setTimeout(()=>this.select(this.lastEvent),20)}}function Axe(e,n){let r=e.state.facet(hH);return r.length?r[0](n):Et.mac?n.metaKey:n.ctrlKey}function Txe(e,n){let r=e.state.facet(fH);return r.length?r[0](n):Et.mac?!n.altKey:!n.ctrlKey}function Mxe(e,n){let{main:r}=e.state.selection;if(r.empty)return!1;let i=Og(e.root);if(!i||i.rangeCount==0)return!0;let s=i.getRangeAt(0).getClientRects();for(let a=0;a<s.length;a++){let o=s[a];if(o.left<=n.clientX&&o.right>=n.clientX&&o.top<=n.clientY&&o.bottom>=n.clientY)return!0}return!1}function Rxe(e,n){if(!n.bubbles)return!0;if(n.defaultPrevented)return!1;for(let r=n.target,i;r!=e.contentDOM;r=r.parentNode)if(!r||r.nodeType==11||(i=Or.get(r))&&i.isWidget()&&!i.isHidden&&i.widget.ignoreEvent(n))return!1;return!0}const eo=Object.create(null),Es=Object.create(null),DH=Et.ie&&Et.ie_version<15||Et.ios&&Et.webkit_version<604;function Oxe(e){let n=e.dom.parentNode;if(!n)return;let r=n.appendChild(document.createElement("textarea"));r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus(),setTimeout(()=>{e.focus(),r.remove(),PH(e,r.value)},50)}function L0(e,n,r){for(let i of e.facet(n))r=i(r,e);return r}function PH(e,n){n=L0(e.state,LA,n);let{state:r}=e,i,s=1,a=r.toText(n),o=a.lines==r.selection.ranges.length;if(Qj!=null&&r.selection.ranges.every(u=>u.empty)&&Qj==a.toString()){let u=-1;i=r.changeByRange(d=>{let p=r.doc.lineAt(d.from);if(p.from==u)return{range:d};u=p.from;let f=r.toText((o?a.line(s++).text:n)+r.lineBreak);return{changes:{from:p.from,insert:f},range:Ze.cursor(d.from+f.length)}})}else o?i=r.changeByRange(u=>{let d=a.line(s++);return{changes:{from:u.from,to:u.to,insert:d.text},range:Ze.cursor(u.from+d.length)}}):i=r.replaceSelection(a);e.dispatch(i,{userEvent:"input.paste",scrollIntoView:!0})}Es.scroll=e=>{e.inputState.lastScrollTop=e.scrollDOM.scrollTop,e.inputState.lastScrollLeft=e.scrollDOM.scrollLeft};Es.wheel=Es.mousewheel=e=>{e.inputState.lastWheelEvent=Date.now()};eo.keydown=(e,n)=>(e.inputState.setSelectionOrigin("select"),n.keyCode==27&&e.inputState.tabFocusMode!=0&&(e.inputState.tabFocusMode=Date.now()+2e3),!1);Es.touchstart=(e,n)=>{let r=e.inputState,i=n.targetTouches[0];r.lastTouchTime=Date.now(),i&&(r.lastTouchX=i.clientX,r.lastTouchY=i.clientY),r.setSelectionOrigin("select.pointer")};Es.touchmove=e=>{e.inputState.setSelectionOrigin("select.pointer")};eo.mousedown=(e,n)=>{if(e.observer.flush(),e.inputState.lastTouchTime>Date.now()-2e3)return!1;let r=null;for(let i of e.state.facet(pH))if(r=i(e,n),r)break;if(!r&&n.button==0&&(r=Pxe(e,n)),r){let i=!e.hasFocus;e.inputState.startMouseSelection(new Exe(e,n,r,i)),i&&e.observer.ignore(()=>{rH(e.contentDOM);let a=e.root.activeElement;a&&!a.contains(e.contentDOM)&&a.blur()});let s=e.inputState.mouseSelection;if(s)return s.start(n),s.dragging===!1}else e.inputState.setSelectionOrigin("select.pointer");return!1};function RP(e,n,r,i){if(i==1)return Ze.cursor(n,r);if(i==2)return dxe(e.state,n,r);{let s=e.docView.lineAt(n,r),a=e.state.doc.lineAt(s?s.posAtEnd:n),o=s?s.posAtStart:a.from,l=s?s.posAtEnd:a.to;return l<e.state.doc.length&&l==a.to&&l++,Ze.range(o,l)}}const Dxe=Et.ie&&Et.ie_version<=11;let OP=null,DP=0,PP=0;function LH(e){if(!Dxe)return e.detail;let n=OP,r=PP;return OP=e,PP=Date.now(),DP=!n||r>Date.now()-400&&Math.abs(n.clientX-e.clientX)<2&&Math.abs(n.clientY-e.clientY)<2?(DP+1)%3:1}function Pxe(e,n){let r=e.posAndSideAtCoords({x:n.clientX,y:n.clientY},!1),i=LH(n),s=e.state.selection;return{update(a){a.docChanged&&(r.pos=a.changes.mapPos(r.pos),s=s.map(a.changes))},get(a,o,l){let u=e.posAndSideAtCoords({x:a.clientX,y:a.clientY},!1),d,p=RP(e,u.pos,u.assoc,i);if(r.pos!=u.pos&&!o){let f=RP(e,r.pos,r.assoc,i),g=Math.min(f.from,p.from),_=Math.max(f.to,p.to);p=g<p.from?Ze.range(g,_,p.assoc):Ze.range(_,g,p.assoc)}return o?s.replaceRange(s.main.extend(p.from,p.to,p.assoc)):l&&i==1&&s.ranges.length>1&&(d=Lxe(s,u.pos))?d:l?s.addRange(p):Ze.create([p])}}}function Lxe(e,n){for(let r=0;r<e.ranges.length;r++){let{from:i,to:s}=e.ranges[r];if(i<=n&&s>=n)return Ze.create(e.ranges.slice(0,r).concat(e.ranges.slice(r+1)),e.mainIndex==r?0:e.mainIndex-(e.mainIndex>r?1:0))}return null}eo.dragstart=(e,n)=>{let{selection:{main:r}}=e.state;if(n.target.draggable){let s=e.docView.tile.nearest(n.target);if(s&&s.isWidget()){let a=s.posAtStart,o=a+s.length;(a>=r.to||o<=r.from)&&(r=Ze.range(a,o))}}let{inputState:i}=e;return i.mouseSelection&&(i.mouseSelection.dragging=!0),i.draggedContent=r,n.dataTransfer&&(n.dataTransfer.setData("Text",L0(e.state,IA,e.state.sliceDoc(r.from,r.to))),n.dataTransfer.effectAllowed="copyMove"),!1};eo.dragend=e=>(e.inputState.draggedContent=null,!1);function LP(e,n,r,i){if(r=L0(e.state,LA,r),!r)return;let s=e.posAtCoords({x:n.clientX,y:n.clientY},!1),{draggedContent:a}=e.inputState,o=i&&a&&Txe(e,n)?{from:a.from,to:a.to}:null,l={from:s,insert:r},u=e.state.changes(o?[o,l]:l);e.focus(),e.dispatch({changes:u,selection:{anchor:u.mapPos(s,-1),head:u.mapPos(s,1)},userEvent:o?"move.drop":"input.drop"}),e.inputState.draggedContent=null}eo.drop=(e,n)=>{if(!n.dataTransfer)return!1;if(e.state.readOnly)return!0;let r=n.dataTransfer.files;if(r&&r.length){let i=Array(r.length),s=0,a=()=>{++s==r.length&&LP(e,n,i.filter(o=>o!=null).join(e.state.lineBreak),!1)};for(let o=0;o<r.length;o++){let l=new FileReader;l.onerror=a,l.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(l.result)||(i[o]=l.result),a()},l.readAsText(r[o])}return!0}else{let i=n.dataTransfer.getData("Text");if(i)return LP(e,n,i,!0),!0}return!1};eo.paste=(e,n)=>{if(e.state.readOnly)return!0;e.observer.flush();let r=DH?null:n.clipboardData;return r?(PH(e,r.getData("text/plain")||r.getData("text/uri-list")),!0):(Oxe(e),!1)};function Ixe(e,n){let r=e.dom.parentNode;if(!r)return;let i=r.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.value=n,i.focus(),i.selectionEnd=n.length,i.selectionStart=0,setTimeout(()=>{i.remove(),e.focus()},50)}function Bxe(e){let n=[],r=[],i=!1;for(let s of e.selection.ranges)s.empty||(n.push(e.sliceDoc(s.from,s.to)),r.push(s));if(!n.length){let s=-1;for(let{from:a}of e.selection.ranges){let o=e.doc.lineAt(a);o.number>s&&(n.push(o.text),r.push({from:o.from,to:Math.min(e.doc.length,o.to+1)})),s=o.number}i=!0}return{text:L0(e,IA,n.join(e.lineBreak)),ranges:r,linewise:i}}let Qj=null;eo.copy=eo.cut=(e,n)=>{if(!eg(e.contentDOM,e.observer.selectionRange))return!1;let{text:r,ranges:i,linewise:s}=Bxe(e.state);if(!r&&!s)return!1;Qj=s?r:null,n.type=="cut"&&!e.state.readOnly&&e.dispatch({changes:i,scrollIntoView:!0,userEvent:"delete.cut"});let a=DH?null:n.clipboardData;return a?(a.clearData(),a.setData("text/plain",r),!0):(Ixe(e,r),!1)};const IH=tl.define();function BH(e,n){let r=[];for(let i of e.facet(vH)){let s=i(e,n);s&&r.push(s)}return r.length?e.update({effects:r,annotations:IH.of(!0)}):null}function zH(e){setTimeout(()=>{let n=e.hasFocus;if(n!=e.inputState.notifiedFocused){let r=BH(e.state,n);r?e.dispatch(r):e.update([])}},10)}Es.focus=e=>{e.inputState.lastFocusTime=Date.now(),!e.scrollDOM.scrollTop&&(e.inputState.lastScrollTop||e.inputState.lastScrollLeft)&&(e.scrollDOM.scrollTop=e.inputState.lastScrollTop,e.scrollDOM.scrollLeft=e.inputState.lastScrollLeft),zH(e)};Es.blur=e=>{e.observer.clearSelectionRange(),zH(e)};Es.compositionstart=Es.compositionupdate=e=>{e.observer.editContext||(e.inputState.compositionFirstChange==null&&(e.inputState.compositionFirstChange=!0),e.inputState.composing<0&&(e.inputState.composing=0))};Es.compositionend=e=>{e.observer.editContext||(e.inputState.composing=-1,e.inputState.compositionEndedAt=Date.now(),e.inputState.compositionPendingKey=!0,e.inputState.compositionPendingChange=e.observer.pendingRecords().length>0,e.inputState.compositionFirstChange=null,Et.chrome&&Et.android?e.observer.flushSoon():e.inputState.compositionPendingChange?Promise.resolve().then(()=>e.observer.flush()):setTimeout(()=>{e.inputState.composing<0&&e.docView.hasComposition&&e.update([])},50))};Es.contextmenu=e=>{e.inputState.lastContextMenu=Date.now()};eo.beforeinput=(e,n)=>{var r,i;if((n.inputType=="insertText"||n.inputType=="insertCompositionText")&&(e.inputState.insertingText=n.data,e.inputState.insertingTextAt=Date.now()),n.inputType=="insertReplacementText"&&e.observer.editContext){let a=(r=n.dataTransfer)===null||r===void 0?void 0:r.getData("text/plain"),o=n.getTargetRanges();if(a&&o.length){let l=o[0],u=e.posAtDOM(l.startContainer,l.startOffset),d=e.posAtDOM(l.endContainer,l.endOffset);return FA(e,{from:u,to:d,insert:e.state.toText(a)},null),!0}}let s;if(Et.chrome&&Et.android&&(s=RH.find(a=>a.inputType==n.inputType))&&(e.observer.delayAndroidKey(s.key,s.keyCode),s.key=="Backspace"||s.key=="Delete")){let a=((i=window.visualViewport)===null||i===void 0?void 0:i.height)||0;setTimeout(()=>{var o;(((o=window.visualViewport)===null||o===void 0?void 0:o.height)||0)>a+10&&e.hasFocus&&(e.contentDOM.blur(),e.focus())},100)}return Et.ios&&n.inputType=="deleteContentForward"&&e.observer.flushSoon(),Et.safari&&n.inputType=="insertText"&&e.inputState.composing>=0&&setTimeout(()=>Es.compositionend(e,n),20),!1};const IP=new Set;function zxe(e){IP.has(e)||(IP.add(e),e.addEventListener("copy",()=>{}),e.addEventListener("cut",()=>{}))}const BP=["pre-wrap","normal","pre-line","break-spaces"];let Lf=!1;function zP(){Lf=!1}class $xe{constructor(n){this.lineWrapping=n,this.doc=Pn.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(n,r){let i=this.doc.lineAt(r).number-this.doc.lineAt(n).number+1;return this.lineWrapping&&(i+=Math.max(0,Math.ceil((r-n-i*this.lineLength*.5)/this.lineLength))),this.lineHeight*i}heightForLine(n){return this.lineWrapping?(1+Math.max(0,Math.ceil((n-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(n){return this.doc=n,this}mustRefreshForWrapping(n){return BP.indexOf(n)>-1!=this.lineWrapping}mustRefreshForHeights(n){let r=!1;for(let i=0;i<n.length;i++){let s=n[i];s<0?i++:this.heightSamples[Math.floor(s*10)]||(r=!0,this.heightSamples[Math.floor(s*10)]=!0)}return r}refresh(n,r,i,s,a,o){let l=BP.indexOf(n)>-1,u=Math.abs(r-this.lineHeight)>.3||this.lineWrapping!=l||Math.abs(i-this.charWidth)>.1;if(this.lineWrapping=l,this.lineHeight=r,this.charWidth=i,this.textHeight=s,this.lineLength=a,u){this.heightSamples={};for(let d=0;d<o.length;d++){let p=o[d];p<0?d++:this.heightSamples[Math.floor(p*10)]=!0}}return u}}class Fxe{constructor(n,r){this.from=n,this.heights=r,this.index=0}get more(){return this.index<this.heights.length}}class Wa{constructor(n,r,i,s,a){this.from=n,this.length=r,this.top=i,this.height=s,this._content=a}get type(){return typeof this._content=="number"?Ai.Text:Array.isArray(this._content)?this._content:this._content.type}get to(){return this.from+this.length}get bottom(){return this.top+this.height}get widget(){return this._content instanceof Ed?this._content.widget:null}get widgetLineBreaks(){return typeof this._content=="number"?this._content:0}join(n){let r=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(n._content)?n._content:[n]);return new Wa(this.from,this.length+n.length,this.top,this.height+n.height,r)}}var nr=(function(e){return e[e.ByPos=0]="ByPos",e[e.ByHeight=1]="ByHeight",e[e.ByPosNoHeight=2]="ByPosNoHeight",e})(nr||(nr={}));const vx=.001;class ts{constructor(n,r,i=2){this.length=n,this.height=r,this.flags=i}get outdated(){return(this.flags&2)>0}set outdated(n){this.flags=(n?2:0)|this.flags&-3}setHeight(n){this.height!=n&&(Math.abs(this.height-n)>vx&&(Lf=!0),this.height=n)}replace(n,r,i){return ts.of(i)}decomposeLeft(n,r){r.push(this)}decomposeRight(n,r){r.push(this)}applyChanges(n,r,i,s){let a=this,o=i.doc;for(let l=s.length-1;l>=0;l--){let{fromA:u,toA:d,fromB:p,toB:f}=s[l],g=a.lineAt(u,nr.ByPosNoHeight,i.setDoc(r),0,0),_=g.to>=d?g:a.lineAt(d,nr.ByPosNoHeight,i,0,0);for(f+=_.to-d,d=_.to;l>0&&g.from<=s[l-1].toA;)u=s[l-1].fromA,p=s[l-1].fromB,l--,u<g.from&&(g=a.lineAt(u,nr.ByPosNoHeight,i,0,0));p+=g.from-u,u=g.from;let x=HA.build(i.setDoc(o),n,p,f);a=vb(a,a.replace(u,d,x))}return a.updateHeight(i,0)}static empty(){return new Qs(0,0,0)}static of(n){if(n.length==1)return n[0];let r=0,i=n.length,s=0,a=0;for(;;)if(r==i)if(s>a*2){let l=n[r-1];l.break?n.splice(--r,1,l.left,null,l.right):n.splice(--r,1,l.left,l.right),i+=1+l.break,s-=l.size}else if(a>s*2){let l=n[i];l.break?n.splice(i,1,l.left,null,l.right):n.splice(i,1,l.left,l.right),i+=2+l.break,a-=l.size}else break;else if(s<a){let l=n[r++];l&&(s+=l.size)}else{let l=n[--i];l&&(a+=l.size)}let o=0;return n[r-1]==null?(o=1,r--):n[r]==null&&(o=1,i++),new Wxe(ts.of(n.slice(0,r)),o,ts.of(n.slice(i)))}}function vb(e,n){return e==n?e:(e.constructor!=n.constructor&&(Lf=!0),n)}ts.prototype.size=1;const Hxe=Wt.replace({});class $H extends ts{constructor(n,r,i){super(n,r),this.deco=i,this.spaceAbove=0}mainBlock(n,r){return new Wa(r,this.length,n+this.spaceAbove,this.height-this.spaceAbove,this.deco||0)}blockAt(n,r,i,s){return this.spaceAbove&&n<i+this.spaceAbove?new Wa(s,0,i,this.spaceAbove,Hxe):this.mainBlock(i,s)}lineAt(n,r,i,s,a){let o=this.mainBlock(s,a);return this.spaceAbove?this.blockAt(0,i,s,a).join(o):o}forEachLine(n,r,i,s,a,o){n<=a+this.length&&r>=a&&o(this.lineAt(0,nr.ByPos,i,s,a))}setMeasuredHeight(n){let r=n.heights[n.index++];r<0?(this.spaceAbove=-r,r=n.heights[n.index++]):this.spaceAbove=0,this.setHeight(r)}updateHeight(n,r=0,i=!1,s){return s&&s.from<=r&&s.more&&this.setMeasuredHeight(s),this.outdated=!1,this}toString(){return`block(${this.length})`}}class Qs extends $H{constructor(n,r,i){super(n,r,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=i}mainBlock(n,r){return new Wa(r,this.length,n+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(n,r,i){let s=i[0];return i.length==1&&(s instanceof Qs||s instanceof Ci&&s.flags&4)&&Math.abs(this.length-s.length)<10?(s instanceof Ci?s=new Qs(s.length,this.height,this.spaceAbove):s.height=this.height,this.outdated||(s.outdated=!1),s):ts.of(i)}updateHeight(n,r=0,i=!1,s){return s&&s.from<=r&&s.more?this.setMeasuredHeight(s):(i||this.outdated)&&(this.spaceAbove=0,this.setHeight(Math.max(this.widgetHeight,n.heightForLine(this.length-this.collapsed))+this.breaks*n.lineHeight)),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class Ci extends ts{constructor(n){super(n,0)}heightMetrics(n,r){let i=n.doc.lineAt(r).number,s=n.doc.lineAt(r+this.length).number,a=s-i+1,o,l=0;if(n.lineWrapping){let u=Math.min(this.height,n.lineHeight*a);o=u/a,this.length>a+1&&(l=(this.height-u)/(this.length-a-1))}else o=this.height/a;return{firstLine:i,lastLine:s,perLine:o,perChar:l}}blockAt(n,r,i,s){let{firstLine:a,lastLine:o,perLine:l,perChar:u}=this.heightMetrics(r,s);if(r.lineWrapping){let d=s+(n<r.lineHeight?0:Math.round(Math.max(0,Math.min(1,(n-i)/this.height))*this.length)),p=r.doc.lineAt(d),f=l+p.length*u,g=Math.max(i,n-f/2);return new Wa(p.from,p.length,g,f,0)}else{let d=Math.max(0,Math.min(o-a,Math.floor((n-i)/l))),{from:p,length:f}=r.doc.line(a+d);return new Wa(p,f,i+l*d,l,0)}}lineAt(n,r,i,s,a){if(r==nr.ByHeight)return this.blockAt(n,i,s,a);if(r==nr.ByPosNoHeight){let{from:_,to:x}=i.doc.lineAt(n);return new Wa(_,x-_,0,0,0)}let{firstLine:o,perLine:l,perChar:u}=this.heightMetrics(i,a),d=i.doc.lineAt(n),p=l+d.length*u,f=d.number-o,g=s+l*f+u*(d.from-a-f);return new Wa(d.from,d.length,Math.max(s,Math.min(g,s+this.height-p)),p,0)}forEachLine(n,r,i,s,a,o){n=Math.max(n,a),r=Math.min(r,a+this.length);let{firstLine:l,perLine:u,perChar:d}=this.heightMetrics(i,a);for(let p=n,f=s;p<=r;){let g=i.doc.lineAt(p);if(p==n){let x=g.number-l;f+=u*x+d*(n-a-x)}let _=u+d*g.length;o(new Wa(g.from,g.length,f,_,0)),f+=_,p=g.to+1}}replace(n,r,i){let s=this.length-r;if(s>0){let a=i[i.length-1];a instanceof Ci?i[i.length-1]=new Ci(a.length+s):i.push(null,new Ci(s-1))}if(n>0){let a=i[0];a instanceof Ci?i[0]=new Ci(n+a.length):i.unshift(new Ci(n-1),null)}return ts.of(i)}decomposeLeft(n,r){r.push(new Ci(n-1),null)}decomposeRight(n,r){r.push(null,new Ci(this.length-n-1))}updateHeight(n,r=0,i=!1,s){let a=r+this.length;if(s&&s.from<=r+this.length&&s.more){let o=[],l=Math.max(r,s.from),u=-1;for(s.from>r&&o.push(new Ci(s.from-r-1).updateHeight(n,r));l<=a&&s.more;){let p=n.doc.lineAt(l).length;o.length&&o.push(null);let f=s.heights[s.index++],g=0;f<0&&(g=-f,f=s.heights[s.index++]),u==-1?u=f:Math.abs(f-u)>=vx&&(u=-2);let _=new Qs(p,f,g);_.outdated=!1,o.push(_),l+=p+1}l<=a&&o.push(null,new Ci(a-l).updateHeight(n,l));let d=ts.of(o);return(u<0||Math.abs(d.height-this.height)>=vx||Math.abs(u-this.heightMetrics(n,r).perLine)>=vx)&&(Lf=!0),vb(this,d)}else(i||this.outdated)&&(this.setHeight(n.heightForGap(r,r+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class Wxe extends ts{constructor(n,r,i){super(n.length+r+i.length,n.height+i.height,r|(n.outdated||i.outdated?2:0)),this.left=n,this.right=i,this.size=n.size+i.size}get break(){return this.flags&1}blockAt(n,r,i,s){let a=i+this.left.height;return n<a?this.left.blockAt(n,r,i,s):this.right.blockAt(n,r,a,s+this.left.length+this.break)}lineAt(n,r,i,s,a){let o=s+this.left.height,l=a+this.left.length+this.break,u=r==nr.ByHeight?n<o:n<l,d=u?this.left.lineAt(n,r,i,s,a):this.right.lineAt(n,r,i,o,l);if(this.break||(u?d.to<l:d.from>l))return d;let p=r==nr.ByPosNoHeight?nr.ByPosNoHeight:nr.ByPos;return u?d.join(this.right.lineAt(l,p,i,o,l)):this.left.lineAt(l,p,i,s,a).join(d)}forEachLine(n,r,i,s,a,o){let l=s+this.left.height,u=a+this.left.length+this.break;if(this.break)n<u&&this.left.forEachLine(n,r,i,s,a,o),r>=u&&this.right.forEachLine(n,r,i,l,u,o);else{let d=this.lineAt(u,nr.ByPos,i,s,a);n<d.from&&this.left.forEachLine(n,d.from-1,i,s,a,o),d.to>=n&&d.from<=r&&o(d),r>d.to&&this.right.forEachLine(d.to+1,r,i,l,u,o)}}replace(n,r,i){let s=this.left.length+this.break;if(r<s)return this.balanced(this.left.replace(n,r,i),this.right);if(n>this.left.length)return this.balanced(this.left,this.right.replace(n-s,r-s,i));let a=[];n>0&&this.decomposeLeft(n,a);let o=a.length;for(let l of i)a.push(l);if(n>0&&$P(a,o-1),r<this.length){let l=a.length;this.decomposeRight(r,a),$P(a,l)}return ts.of(a)}decomposeLeft(n,r){let i=this.left.length;if(n<=i)return this.left.decomposeLeft(n,r);r.push(this.left),this.break&&(i++,n>=i&&r.push(null)),n>i&&this.right.decomposeLeft(n-i,r)}decomposeRight(n,r){let i=this.left.length,s=i+this.break;if(n>=s)return this.right.decomposeRight(n-s,r);n<i&&this.left.decomposeRight(n,r),this.break&&n<s&&r.push(null),r.push(this.right)}balanced(n,r){return n.size>2*r.size||r.size>2*n.size?ts.of(this.break?[n,null,r]:[n,r]):(this.left=vb(this.left,n),this.right=vb(this.right,r),this.setHeight(n.height+r.height),this.outdated=n.outdated||r.outdated,this.size=n.size+r.size,this.length=n.length+this.break+r.length,this)}updateHeight(n,r=0,i=!1,s){let{left:a,right:o}=this,l=r+a.length+this.break,u=null;return s&&s.from<=r+a.length&&s.more?u=a=a.updateHeight(n,r,i,s):a.updateHeight(n,r,i),s&&s.from<=l+o.length&&s.more?u=o=o.updateHeight(n,l,i,s):o.updateHeight(n,l,i),u?this.balanced(a,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function $P(e,n){let r,i;e[n]==null&&(r=e[n-1])instanceof Ci&&(i=e[n+1])instanceof Ci&&e.splice(n-1,3,new Ci(r.length+1+i.length))}const qxe=5;class HA{constructor(n,r){this.pos=n,this.oracle=r,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=n}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(n,r){if(this.lineStart>-1){let i=Math.min(r,this.lineEnd),s=this.nodes[this.nodes.length-1];s instanceof Qs?s.length+=i-this.pos:(i>this.pos||!this.isCovered)&&this.nodes.push(new Qs(i-this.pos,-1,0)),this.writtenTo=i,r>i&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=r}point(n,r,i){if(n<r||i.heightRelevant){let s=i.widget?i.widget.estimatedHeight:0,a=i.widget?i.widget.lineBreaks:0;s<0&&(s=this.oracle.lineHeight);let o=r-n;i.block?this.addBlock(new $H(o,s,i)):(o||a||s>=qxe)&&this.addLineDeco(s,a,o)}else r>n&&this.span(n,r);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:n,to:r}=this.oracle.doc.lineAt(this.pos);this.lineStart=n,this.lineEnd=r,this.writtenTo<n&&((this.writtenTo<n-1||this.nodes[this.nodes.length-1]==null)&&this.nodes.push(this.blankContent(this.writtenTo,n-1)),this.nodes.push(null)),this.pos>n&&this.nodes.push(new Qs(this.pos-n,-1,0)),this.writtenTo=this.pos}blankContent(n,r){let i=new Ci(r-n);return this.oracle.doc.lineAt(n).to==r&&(i.flags|=4),i}ensureLine(){this.enterLine();let n=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(n instanceof Qs)return n;let r=new Qs(0,-1,0);return this.nodes.push(r),r}addBlock(n){this.enterLine();let r=n.deco;r&&r.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(n),this.writtenTo=this.pos=this.pos+n.length,r&&r.endSide>0&&(this.covering=n)}addLineDeco(n,r,i){let s=this.ensureLine();s.length+=i,s.collapsed+=i,s.widgetHeight=Math.max(s.widgetHeight,n),s.breaks+=r,this.writtenTo=this.pos=this.pos+i}finish(n){let r=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(r instanceof Qs)&&!this.isCovered?this.nodes.push(new Qs(0,-1,0)):(this.writtenTo<this.pos||r==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let i=n;for(let s of this.nodes)s instanceof Qs&&s.updateHeight(this.oracle,i),i+=s?s.length:1;return this.nodes}static build(n,r,i,s){let a=new HA(i,n);return on.spans(r,i,s,a,0),a.finish(i)}}function Uxe(e,n,r){let i=new Vxe;return on.compare(e,n,r,i,0),i.changes}class Vxe{constructor(){this.changes=[]}compareRange(){}comparePoint(n,r,i,s){(n<r||i&&i.heightRelevant||s&&s.heightRelevant)&&df(n,r,this.changes,5)}}function Kxe(e,n){let r=e.getBoundingClientRect(),i=e.ownerDocument,s=i.defaultView||window,a=Math.max(0,r.left),o=Math.min(s.innerWidth,r.right),l=Math.max(0,r.top),u=Math.min(s.innerHeight,r.bottom);for(let d=e.parentNode;d&&d!=i.body;)if(d.nodeType==1){let p=d,f=window.getComputedStyle(p);if((p.scrollHeight>p.clientHeight||p.scrollWidth>p.clientWidth)&&f.overflow!="visible"){let g=p.getBoundingClientRect();a=Math.max(a,g.left),o=Math.min(o,g.right),l=Math.max(l,g.top),u=Math.min(d==e.parentNode?s.innerHeight:u,g.bottom)}d=f.position=="absolute"||f.position=="fixed"?p.offsetParent:p.parentNode}else if(d.nodeType==11)d=d.host;else break;return{left:a-r.left,right:Math.max(a,o)-r.left,top:l-(r.top+n),bottom:Math.max(l,u)-(r.top+n)}}function Yxe(e){let n=e.getBoundingClientRect(),r=e.ownerDocument.defaultView||window;return n.left<r.innerWidth&&n.right>0&&n.top<r.innerHeight&&n.bottom>0}function Gxe(e,n){let r=e.getBoundingClientRect();return{left:0,right:r.right-r.left,top:n,bottom:r.bottom-(r.top+n)}}class wS{constructor(n,r,i,s){this.from=n,this.to=r,this.size=i,this.displaySize=s}static same(n,r){if(n.length!=r.length)return!1;for(let i=0;i<n.length;i++){let s=n[i],a=r[i];if(s.from!=a.from||s.to!=a.to||s.size!=a.size)return!1}return!0}draw(n,r){return Wt.replace({widget:new Xxe(this.displaySize*(r?n.scaleY:n.scaleX),r)}).range(this.from,this.to)}}class Xxe extends nl{constructor(n,r){super(),this.size=n,this.vertical=r}eq(n){return n.size==this.size&&n.vertical==this.vertical}toDOM(){let n=document.createElement("div");return this.vertical?n.style.height=this.size+"px":(n.style.width=this.size+"px",n.style.height="2px",n.style.display="inline-block"),n}get estimatedHeight(){return this.vertical?this.size:-1}}class FP{constructor(n,r){this.view=n,this.state=r,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scaleX=1,this.scaleY=1,this.scrollOffset=0,this.scrolledToBottom=!1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=HP,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=Jn.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let i=r.facet(BA).some(s=>typeof s!="function"&&s.class=="cm-lineWrapping");this.heightOracle=new $xe(i),this.stateDeco=WP(r),this.heightMap=ts.empty().applyChanges(this.stateDeco,Pn.empty,this.heightOracle.setDoc(r.doc),[new wa(0,0,0,r.doc.length)]);for(let s=0;s<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());s++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=Wt.set(this.lineGaps.map(s=>s.draw(this,!1))),this.scrollParent=n.scrollDOM,this.computeVisibleRanges()}updateForViewport(){let n=[this.viewport],{main:r}=this.state.selection;for(let i=0;i<=1;i++){let s=i?r.head:r.anchor;if(!n.some(({from:a,to:o})=>s>=a&&s<=o)){let{from:a,to:o}=this.lineBlockAt(s);n.push(new g_(a,o))}}return this.viewports=n.sort((i,s)=>i.from-s.from),this.updateScaler()}updateScaler(){let n=this.scaler;return this.scaler=this.heightMap.height<=7e6?HP:new WA(this.heightOracle,this.heightMap,this.viewports),n.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,n=>{this.viewportLines.push(Om(n,this.scaler))})}update(n,r=null){this.state=n.state;let i=this.stateDeco;this.stateDeco=WP(this.state);let s=n.changedRanges,a=wa.extendWithRanges(s,Uxe(i,this.stateDeco,n?n.changes:ni.empty(this.state.doc.length))),o=this.heightMap.height,l=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);zP(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,n.startState.doc,this.heightOracle.setDoc(this.state.doc),a),(this.heightMap.height!=o||Lf)&&(n.flags|=2),l?(this.scrollAnchorPos=n.changes.mapPos(l.from,-1),this.scrollAnchorHeight=l.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=o);let u=a.length?this.mapViewport(this.viewport,n.changes):this.viewport;(r&&(r.range.head<u.from||r.range.head>u.to)||!this.viewportIsAppropriate(u))&&(u=this.getViewport(0,r));let d=u.from!=this.viewport.from||u.to!=this.viewport.to;this.viewport=u,n.flags|=this.updateForViewport(),(d||!n.changes.empty||n.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,n.changes))),n.flags|=this.computeVisibleRanges(n.changes),r&&(this.scrollTarget=r),!this.mustEnforceCursorAssoc&&(n.selectionSet||n.focusChanged)&&n.view.lineWrapping&&n.state.selection.main.empty&&n.state.selection.main.assoc&&!n.state.facet(_H)&&(this.mustEnforceCursorAssoc=!0)}measure(){let{view:n}=this,r=n.contentDOM,i=window.getComputedStyle(r),s=this.heightOracle,a=i.whiteSpace;this.defaultTextDirection=i.direction=="rtl"?Jn.RTL:Jn.LTR;let o=this.heightOracle.mustRefreshForWrapping(a)||this.mustMeasureContent==="refresh",l=r.getBoundingClientRect(),u=o||this.mustMeasureContent||this.contentDOMHeight!=l.height;this.contentDOMHeight=l.height,this.mustMeasureContent=!1;let d=0,p=0;if(l.width&&l.height){let{scaleX:A,scaleY:E}=tH(r,l);(A>.005&&Math.abs(this.scaleX-A)>.005||E>.005&&Math.abs(this.scaleY-E)>.005)&&(this.scaleX=A,this.scaleY=E,d|=16,o=u=!0)}let f=(parseInt(i.paddingTop)||0)*this.scaleY,g=(parseInt(i.paddingBottom)||0)*this.scaleY;(this.paddingTop!=f||this.paddingBottom!=g)&&(this.paddingTop=f,this.paddingBottom=g,d|=18),this.editorWidth!=n.scrollDOM.clientWidth&&(s.lineWrapping&&(u=!0),this.editorWidth=n.scrollDOM.clientWidth,d|=16);let _=nH(this.view.contentDOM,!1).y;_!=this.scrollParent&&(this.scrollParent=_,this.scrollAnchorHeight=-1,this.scrollOffset=0);let x=this.getScrollOffset();this.scrollOffset!=x&&(this.scrollAnchorHeight=-1,this.scrollOffset=x),this.scrolledToBottom=iH(this.scrollParent||n.win);let v=(this.printing?Gxe:Kxe)(r,this.paddingTop),S=v.top-this.pixelViewport.top,w=v.bottom-this.pixelViewport.bottom;this.pixelViewport=v;let N=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(N!=this.inView&&(this.inView=N,N&&(u=!0)),!this.inView&&!this.scrollTarget&&!Yxe(n.dom))return 0;let C=l.width;if((this.contentDOMWidth!=C||this.editorHeight!=n.scrollDOM.clientHeight)&&(this.contentDOMWidth=l.width,this.editorHeight=n.scrollDOM.clientHeight,d|=16),u){let A=n.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(A)&&(o=!0),o||s.lineWrapping&&Math.abs(C-this.contentDOMWidth)>s.charWidth){let{lineHeight:E,charWidth:D,textHeight:F}=n.docView.measureTextSize();o=E>0&&s.refresh(a,E,D,F,Math.max(5,C/D),A),o&&(n.docView.minWidth=0,d|=16)}S>0&&w>0?p=Math.max(S,w):S<0&&w<0&&(p=Math.min(S,w)),zP();for(let E of this.viewports){let D=E.from==this.viewport.from?A:n.docView.measureVisibleLineHeights(E);this.heightMap=(o?ts.empty().applyChanges(this.stateDeco,Pn.empty,this.heightOracle,[new wa(0,0,0,n.state.doc.length)]):this.heightMap).updateHeight(s,0,o,new Fxe(E.from,D))}Lf&&(d|=2)}let T=!this.viewportIsAppropriate(this.viewport,p)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return T&&(d&2&&(d|=this.updateScaler()),this.viewport=this.getViewport(p,this.scrollTarget),d|=this.updateForViewport()),(d&2||T)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,n)),d|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,n.docView.enforceCursorAssoc()),d}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(n,r){let i=.5-Math.max(-.5,Math.min(.5,n/1e3/2)),s=this.heightMap,a=this.heightOracle,{visibleTop:o,visibleBottom:l}=this,u=new g_(s.lineAt(o-i*1e3,nr.ByHeight,a,0,0).from,s.lineAt(l+(1-i)*1e3,nr.ByHeight,a,0,0).to);if(r){let{head:d}=r.range;if(d<u.from||d>u.to){let p=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),f=s.lineAt(d,nr.ByPos,a,0,0),g;r.y=="center"?g=(f.top+f.bottom)/2-p/2:r.y=="start"||r.y=="nearest"&&d<u.from?g=f.top:g=f.bottom-p,u=new g_(s.lineAt(g-1e3/2,nr.ByHeight,a,0,0).from,s.lineAt(g+p+1e3/2,nr.ByHeight,a,0,0).to)}}return u}mapViewport(n,r){let i=r.mapPos(n.from,-1),s=r.mapPos(n.to,1);return new g_(this.heightMap.lineAt(i,nr.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(s,nr.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:n,to:r},i=0){if(!this.inView)return!0;let{top:s}=this.heightMap.lineAt(n,nr.ByPos,this.heightOracle,0,0),{bottom:a}=this.heightMap.lineAt(r,nr.ByPos,this.heightOracle,0,0),{visibleTop:o,visibleBottom:l}=this;return(n==0||s<=o-Math.max(10,Math.min(-i,250)))&&(r==this.state.doc.length||a>=l+Math.max(10,Math.min(i,250)))&&s>o-2*1e3&&a<l+2*1e3}mapLineGaps(n,r){if(!n.length||r.empty)return n;let i=[];for(let s of n)r.touchesRange(s.from,s.to)||i.push(new wS(r.mapPos(s.from),r.mapPos(s.to),s.size,s.displaySize));return i}ensureLineGaps(n,r){let i=this.heightOracle.lineWrapping,s=i?1e4:2e3,a=s>>1,o=s<<1;if(this.defaultTextDirection!=Jn.LTR&&!i)return[];let l=[],u=(p,f,g,_)=>{if(f-p<a)return;let x=this.state.selection.main,v=[x.from];x.empty||v.push(x.to);for(let w of v)if(w>p&&w<f){u(p,w-10,g,_),u(w+10,f,g,_);return}let S=Zxe(n,w=>w.from>=g.from&&w.to<=g.to&&Math.abs(w.from-p)<a&&Math.abs(w.to-f)<a&&!v.some(N=>w.from<N&&w.to>N));if(!S){if(f<g.to&&r&&i&&r.visibleRanges.some(C=>C.from<=f&&C.to>=f)){let C=r.moveToLineBoundary(Ze.cursor(f),!1,!0).head;C>p&&(f=C)}let w=this.gapSize(g,p,f,_),N=i||w<2e6?w:2e6;S=new wS(p,f,w,N)}l.push(S)},d=p=>{if(p.length<o||p.type!=Ai.Text)return;let f=Qxe(p.from,p.to,this.stateDeco);if(f.total<o)return;let g=this.scrollTarget?this.scrollTarget.range.head:null,_,x;if(i){let v=s/this.heightOracle.lineLength*this.heightOracle.lineHeight,S,w;if(g!=null){let N=y_(f,g),C=((this.visibleBottom-this.visibleTop)/2+v)/p.height;S=N-C,w=N+C}else S=(this.visibleTop-p.top-v)/p.height,w=(this.visibleBottom-p.top+v)/p.height;_=v_(f,S),x=v_(f,w)}else{let v=f.total*this.heightOracle.charWidth,S=s*this.heightOracle.charWidth,w=0;if(v>2e6)for(let E of n)E.from>=p.from&&E.from<p.to&&E.size!=E.displaySize&&E.from*this.heightOracle.charWidth+w<this.pixelViewport.left&&(w=E.size-E.displaySize);let N=this.pixelViewport.left+w,C=this.pixelViewport.right+w,T,A;if(g!=null){let E=y_(f,g),D=((C-N)/2+S)/v;T=E-D,A=E+D}else T=(N-S)/v,A=(C+S)/v;_=v_(f,T),x=v_(f,A)}_>p.from&&u(p.from,_,p,f),x<p.to&&u(x,p.to,p,f)};for(let p of this.viewportLines)Array.isArray(p.type)?p.type.forEach(d):d(p);return l}gapSize(n,r,i,s){let a=y_(s,i)-y_(s,r);return this.heightOracle.lineWrapping?n.height*a:s.total*this.heightOracle.charWidth*a}updateLineGaps(n){wS.same(n,this.lineGaps)||(this.lineGaps=n,this.lineGapDeco=Wt.set(n.map(r=>r.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(n){let r=this.stateDeco;this.lineGaps.length&&(r=r.concat(this.lineGapDeco));let i=[];on.spans(r,this.viewport.from,this.viewport.to,{span(a,o){i.push({from:a,to:o})},point(){}},20);let s=0;if(i.length!=this.visibleRanges.length)s=12;else for(let a=0;a<i.length&&!(s&8);a++){let o=this.visibleRanges[a],l=i[a];(o.from!=l.from||o.to!=l.to)&&(s|=4,n&&n.mapPos(o.from,-1)==l.from&&n.mapPos(o.to,1)==l.to||(s|=8))}return this.visibleRanges=i,s}lineBlockAt(n){return n>=this.viewport.from&&n<=this.viewport.to&&this.viewportLines.find(r=>r.from<=n&&r.to>=n)||Om(this.heightMap.lineAt(n,nr.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(n){return n>=this.viewportLines[0].top&&n<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(r=>r.top<=n&&r.bottom>=n)||Om(this.heightMap.lineAt(this.scaler.fromDOM(n),nr.ByHeight,this.heightOracle,0,0),this.scaler)}getScrollOffset(){return(this.scrollParent==this.view.scrollDOM?this.scrollParent.scrollTop:(this.scrollParent?this.scrollParent.getBoundingClientRect().top:0)-this.view.contentDOM.getBoundingClientRect().top)*this.scaleY}scrollAnchorAt(n){let r=this.lineBlockAtHeight(n+8);return r.from>=this.viewport.from||this.viewportLines[0].top-n>200?r:this.viewportLines[0]}elementAtHeight(n){return Om(this.heightMap.blockAt(this.scaler.fromDOM(n),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class g_{constructor(n,r){this.from=n,this.to=r}}function Qxe(e,n,r){let i=[],s=e,a=0;return on.spans(r,e,n,{span(){},point(o,l){o>s&&(i.push({from:s,to:o}),a+=o-s),s=l}},20),s<n&&(i.push({from:s,to:n}),a+=n-s),{total:a,ranges:i}}function v_({total:e,ranges:n},r){if(r<=0)return n[0].from;if(r>=1)return n[n.length-1].to;let i=Math.floor(e*r);for(let s=0;;s++){let{from:a,to:o}=n[s],l=o-a;if(i<=l)return a+i;i-=l}}function y_(e,n){let r=0;for(let{from:i,to:s}of e.ranges){if(n<=s){r+=n-i;break}r+=s-i}return r/e.total}function Zxe(e,n){for(let r of e)if(n(r))return r}const HP={toDOM(e){return e},fromDOM(e){return e},scale:1,eq(e){return e==this}};function WP(e){let n=e.facet(O0).filter(i=>typeof i!="function"),r=e.facet(zA).filter(i=>typeof i!="function");return r.length&&n.push(on.join(r)),n}class WA{constructor(n,r,i){let s=0,a=0,o=0;this.viewports=i.map(({from:l,to:u})=>{let d=r.lineAt(l,nr.ByPos,n,0,0).top,p=r.lineAt(u,nr.ByPos,n,0,0).bottom;return s+=p-d,{from:l,to:u,top:d,bottom:p,domTop:0,domBottom:0}}),this.scale=(7e6-s)/(r.height-s);for(let l of this.viewports)l.domTop=o+(l.top-a)*this.scale,o=l.domBottom=l.domTop+(l.bottom-l.top),a=l.bottom}toDOM(n){for(let r=0,i=0,s=0;;r++){let a=r<this.viewports.length?this.viewports[r]:null;if(!a||n<a.top)return s+(n-i)*this.scale;if(n<=a.bottom)return a.domTop+(n-a.top);i=a.bottom,s=a.domBottom}}fromDOM(n){for(let r=0,i=0,s=0;;r++){let a=r<this.viewports.length?this.viewports[r]:null;if(!a||n<a.domTop)return i+(n-s)/this.scale;if(n<=a.domBottom)return a.top+(n-a.domTop);i=a.bottom,s=a.domBottom}}eq(n){return n instanceof WA?this.scale==n.scale&&this.viewports.length==n.viewports.length&&this.viewports.every((r,i)=>r.from==n.viewports[i].from&&r.to==n.viewports[i].to):!1}}function Om(e,n){if(n.scale==1)return e;let r=n.toDOM(e.top),i=n.toDOM(e.bottom);return new Wa(e.from,e.length,r,i-r,Array.isArray(e._content)?e._content.map(s=>Om(s,n)):e._content)}const __=jt.define({combine:e=>e.join(" ")}),Zj=jt.define({combine:e=>e.indexOf(!0)>-1}),Jj=au.newName(),FH=au.newName(),HH=au.newName(),WH={"&light":"."+FH,"&dark":"."+HH};function eN(e,n,r){return new au(n,{finish(i){return/&/.test(i)?i.replace(/&\w*/,s=>{if(s=="&")return e;if(!r||!r[s])throw new RangeError(`Unsupported selector: ${s}`);return r[s]}):e+" "+i}})}const Jxe=eN("."+Jj,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-selectionHandle":{backgroundColor:"currentColor",width:"1.5px"},".cm-selectionHandle-start::before, .cm-selectionHandle-end::before":{content:'""',backgroundColor:"inherit",borderRadius:"50%",width:"8px",height:"8px",position:"absolute",left:"-3.25px"},".cm-selectionHandle-start::before":{top:"-8px"},".cm-selectionHandle-end::before":{bottom:"-8px"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top",userSelect:"none"},".cm-highlightSpace":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"center"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},WH),ebe={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},SS=Et.ie&&Et.ie_version<=11;class tbe{constructor(n){this.view=n,this.active=!1,this.editContext=null,this.selectionRange=new M_e,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=n.contentDOM,this.observer=new MutationObserver(r=>{for(let i of r)this.queue.push(i);(Et.ie&&Et.ie_version<=11||Et.ios&&n.composing)&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&Et.android&&n.constructor.EDIT_CONTEXT!==!1&&!(Et.chrome&&Et.chrome_version<126)&&(this.editContext=new rbe(n),n.state.facet(Ol)&&(n.contentDOM.editContext=this.editContext.editContext)),SS&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var r;((r=this.view.docView)===null||r===void 0?void 0:r.lastUpdate)<Date.now()-75&&this.onResize()}),this.resizeScroll.observe(n.scrollDOM)),this.addWindowListeners(this.win=n.win),this.start(),typeof IntersectionObserver=="function"&&(this.intersection=new IntersectionObserver(r=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),r.length>0&&r[r.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(r=>{r.length>0&&r[r.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(n){this.view.inputState.runHandlers("scroll",n),this.intersecting&&this.view.measure()}onScroll(n){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(n)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(n){(n.type=="change"||!n.type)&&!n.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(n){if(this.gapIntersection&&(n.length!=this.gaps.length||this.gaps.some((r,i)=>r!=n[i]))){this.gapIntersection.disconnect();for(let r of n)this.gapIntersection.observe(r);this.gaps=n}}onSelectionChange(n){let r=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:i}=this,s=this.selectionRange;if(i.state.facet(Ol)?i.root.activeElement!=this.dom:!eg(this.dom,s))return;let a=s.anchorNode&&i.docView.tile.nearest(s.anchorNode);if(a&&a.isWidget()&&a.widget.ignoreEvent(n)){r||(this.selectionChanged=!1);return}(Et.ie&&Et.ie_version<=11||Et.android&&Et.chrome)&&!i.state.selection.main.empty&&s.focusNode&&ng(s.focusNode,s.focusOffset,s.anchorNode,s.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:n}=this,r=Og(n.root);if(!r)return!1;let i=Et.safari&&n.root.nodeType==11&&n.root.activeElement==this.dom&&nbe(this.view,r)||r;if(!i||this.selectionRange.eq(i))return!1;let s=eg(this.dom,i);return s&&!this.selectionChanged&&n.inputState.lastFocusTime>Date.now()-200&&n.inputState.lastTouchTime<Date.now()-300&&O_e(this.dom,i)?(this.view.inputState.lastFocusTime=0,n.docView.updateSelection(),!1):(this.selectionRange.setRange(i),s&&(this.selectionChanged=!0),!0)}setSelectionRange(n,r){this.selectionRange.set(n.node,n.offset,r.node,r.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let n=0,r=null;for(let i=this.dom;i;)if(i.nodeType==1)!r&&n<this.scrollTargets.length&&this.scrollTargets[n]==i?n++:r||(r=this.scrollTargets.slice(0,n)),r&&r.push(i),i=i.assignedSlot||i.parentNode;else if(i.nodeType==11)i=i.host;else break;if(n<this.scrollTargets.length&&!r&&(r=this.scrollTargets.slice(0,n)),r){for(let i of this.scrollTargets)i.removeEventListener("scroll",this.onScroll);for(let i of this.scrollTargets=r)i.addEventListener("scroll",this.onScroll)}}ignore(n){if(!this.active)return n();try{return this.stop(),n()}finally{this.start(),this.clear()}}start(){this.active||(this.observer.observe(this.dom,ebe),SS&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),SS&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(n,r){var i;if(!this.delayedAndroidKey){let s=()=>{let a=this.delayedAndroidKey;a&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=a.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&a.force&&hf(this.dom,a.key,a.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(s)}(!this.delayedAndroidKey||n=="Enter")&&(this.delayedAndroidKey={key:n,keyCode:r,force:this.lastChange<Date.now()-50||!!(!((i=this.delayedAndroidKey)===null||i===void 0)&&i.force)})}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(()=>{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let n of this.observer.takeRecords())this.queue.push(n);return this.queue}processRecords(){let n=this.pendingRecords();n.length&&(this.queue=[]);let r=-1,i=-1,s=!1;for(let a of n){let o=this.readMutation(a);o&&(o.typeOver&&(s=!0),r==-1?{from:r,to:i}=o:(r=Math.min(o.from,r),i=Math.max(o.to,i)))}return{from:r,to:i,typeOver:s}}readChange(){let{from:n,to:r,typeOver:i}=this.processRecords(),s=this.selectionChanged&&eg(this.dom,this.selectionRange);if(n<0&&!s)return null;n>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let a=new xxe(this.view,n,r,i);return this.view.docView.domChanged={newSel:a.newSel?a.newSel.main:null},a}flush(n=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;n&&this.readSelectionRange();let r=this.readChange();if(!r)return this.view.requestMeasure(),!1;let i=this.view.state,s=TH(this.view,r);return this.view.state==i&&(r.domChanged||r.newSel&&!gb(this.view.state.selection,r.newSel.main))&&this.view.update([]),s}readMutation(n){let r=this.view.docView.tile.nearest(n.target);if(!r||r.isWidget())return null;if(r.markDirty(n.type=="attributes"),n.type=="childList"){let i=qP(r,n.previousSibling||n.target.previousSibling,-1),s=qP(r,n.nextSibling||n.target.nextSibling,1);return{from:i?r.posAfter(i):r.posAtStart,to:s?r.posBefore(s):r.posAtEnd,typeOver:!1}}else return n.type=="characterData"?{from:r.posAtStart,to:r.posAtEnd,typeOver:n.target.nodeValue==n.oldValue}:null}setWindow(n){n!=this.win&&(this.removeWindowListeners(this.win),this.win=n,this.addWindowListeners(this.win))}addWindowListeners(n){n.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):n.addEventListener("beforeprint",this.onPrint),n.addEventListener("scroll",this.onScroll),n.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(n){n.removeEventListener("scroll",this.onScroll),n.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):n.removeEventListener("beforeprint",this.onPrint),n.document.removeEventListener("selectionchange",this.onSelectionChange)}update(n){this.editContext&&(this.editContext.update(n),n.startState.facet(Ol)!=n.state.facet(Ol)&&(n.view.contentDOM.editContext=n.state.facet(Ol)?this.editContext.editContext:null))}destroy(){var n,r,i;this.stop(),(n=this.intersection)===null||n===void 0||n.disconnect(),(r=this.gapIntersection)===null||r===void 0||r.disconnect(),(i=this.resizeScroll)===null||i===void 0||i.disconnect();for(let s of this.scrollTargets)s.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function qP(e,n,r){for(;n;){let i=Or.get(n);if(i&&i.parent==e)return i;let s=n.parentNode;n=s!=e.dom?s:r>0?n.nextSibling:n.previousSibling}return null}function UP(e,n){let r=n.startContainer,i=n.startOffset,s=n.endContainer,a=n.endOffset,o=e.docView.domAtPos(e.state.selection.main.anchor,1);return ng(o.node,o.offset,s,a)&&([r,i,s,a]=[s,a,r,i]),{anchorNode:r,anchorOffset:i,focusNode:s,focusOffset:a}}function nbe(e,n){if(n.getComposedRanges){let s=n.getComposedRanges(e.root)[0];if(s)return UP(e,s)}let r=null;function i(s){s.preventDefault(),s.stopImmediatePropagation(),r=s.getTargetRanges()[0]}return e.contentDOM.addEventListener("beforeinput",i,!0),e.dom.ownerDocument.execCommand("indent"),e.contentDOM.removeEventListener("beforeinput",i,!0),r?UP(e,r):null}class rbe{constructor(n){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(n.state);let r=this.editContext=new window.EditContext({text:n.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,n.state.selection.main.anchor))),selectionEnd:this.toContextPos(n.state.selection.main.head)});this.handlers.textupdate=i=>{let s=n.state.selection.main,{anchor:a,head:o}=s,l=this.toEditorPos(i.updateRangeStart),u=this.toEditorPos(i.updateRangeEnd);n.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:i.updateRangeStart,editorBase:l,drifted:!1});let d=u-l>i.text.length;l==this.from&&a<this.from?l=a:u==this.to&&a>this.to&&(u=a);let p=MH(n.state.sliceDoc(l,u),i.text,(d?s.from:s.to)-l,d?"end":null);if(!p){let g=Ze.single(this.toEditorPos(i.selectionStart),this.toEditorPos(i.selectionEnd));gb(g,s)||n.dispatch({selection:g,userEvent:"select"});return}let f={from:p.from+l,to:p.toA+l,insert:Pn.of(i.text.slice(p.from,p.toB).split(`
`))};if((Et.mac||Et.android)&&f.from==o-1&&/^\. ?$/.test(i.text)&&n.contentDOM.getAttribute("autocorrect")=="off"&&(f={from:l,to:u,insert:Pn.of([i.text.replace("."," ")])}),this.pendingContextChange=f,!n.state.readOnly){let g=this.to-this.from+(f.to-f.from+f.insert.length);FA(n,f,Ze.single(this.toEditorPos(i.selectionStart,g),this.toEditorPos(i.selectionEnd,g)))}this.pendingContextChange&&(this.revertPending(n.state),this.setSelection(n.state)),f.from<f.to&&!f.insert.length&&n.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(r.text.slice(Math.max(0,i.updateRangeStart-1),Math.min(r.text.length,i.updateRangeStart+1)))&&this.handlers.compositionend(i)},this.handlers.characterboundsupdate=i=>{let s=[],a=null;for(let o=this.toEditorPos(i.rangeStart),l=this.toEditorPos(i.rangeEnd);o<l;o++){let u=n.coordsForChar(o);a=u&&new DOMRect(u.left,u.top,u.right-u.left,u.bottom-u.top)||a||new DOMRect,s.push(a)}r.updateCharacterBounds(i.rangeStart,s)},this.handlers.textformatupdate=i=>{let s=[];for(let a of i.getTextFormats()){let o=a.underlineStyle,l=a.underlineThickness;if(!/none/i.test(o)&&!/none/i.test(l)){let u=this.toEditorPos(a.rangeStart),d=this.toEditorPos(a.rangeEnd);if(u<d){let p=`text-decoration: underline ${/^[a-z]/.test(o)?o+" ":o=="Dashed"?"dashed ":o=="Squiggle"?"wavy ":""}${/thin/i.test(l)?1:2}px`;s.push(Wt.mark({attributes:{style:p}}).range(u,d))}}}n.dispatch({effects:bH.of(Wt.set(s))})},this.handlers.compositionstart=()=>{n.inputState.composing<0&&(n.inputState.composing=0,n.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(n.inputState.composing=-1,n.inputState.compositionFirstChange=null,this.composing){let{drifted:i}=this.composing;this.composing=null,i&&this.reset(n.state)}};for(let i in this.handlers)r.addEventListener(i,this.handlers[i]);this.measureReq={read:i=>{this.editContext.updateControlBounds(i.contentDOM.getBoundingClientRect());let s=Og(i.root);s&&s.rangeCount&&this.editContext.updateSelectionBounds(s.getRangeAt(0).getBoundingClientRect())}}}applyEdits(n){let r=0,i=!1,s=this.pendingContextChange;return n.changes.iterChanges((a,o,l,u,d)=>{if(i)return;let p=d.length-(o-a);if(s&&o>=s.to)if(s.from==a&&s.to==o&&s.insert.eq(d)){s=this.pendingContextChange=null,r+=p,this.to+=p;return}else s=null,this.revertPending(n.state);if(a+=r,o+=r,o<=this.from)this.from+=p,this.to+=p;else if(a<this.to){if(a<this.from||o>this.to||this.to-this.from+d.length>3e4){i=!0;return}this.editContext.updateText(this.toContextPos(a),this.toContextPos(o),d.toString()),this.to+=p}r+=p}),s&&!i&&this.revertPending(n.state),!i}update(n){let r=this.pendingContextChange,i=n.startState.selection.main;this.composing&&(this.composing.drifted||!n.changes.touchesRange(i.from,i.to)&&n.transactions.some(s=>!s.isUserEvent("input.type")&&s.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=n.changes.mapPos(this.composing.editorBase)):!this.applyEdits(n)||!this.rangeIsValid(n.state)?(this.pendingContextChange=null,this.reset(n.state)):(n.docChanged||n.selectionSet||r)&&this.setSelection(n.state),(n.geometryChanged||n.docChanged||n.selectionSet)&&n.view.requestMeasure(this.measureReq)}resetRange(n){let{head:r}=n.selection.main;this.from=Math.max(0,r-1e4),this.to=Math.min(n.doc.length,r+1e4)}reset(n){this.resetRange(n),this.editContext.updateText(0,this.editContext.text.length,n.doc.sliceString(this.from,this.to)),this.setSelection(n)}revertPending(n){let r=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(r.from),this.toContextPos(r.from+r.insert.length),n.doc.sliceString(r.from,r.to))}setSelection(n){let{main:r}=n.selection,i=this.toContextPos(Math.max(this.from,Math.min(this.to,r.anchor))),s=this.toContextPos(r.head);(this.editContext.selectionStart!=i||this.editContext.selectionEnd!=s)&&this.editContext.updateSelection(i,s)}rangeIsValid(n){let{head:r}=n.selection.main;return!(this.from>0&&r-this.from<500||this.to<n.doc.length&&this.to-r<500||this.to-this.from>1e4*3)}toEditorPos(n,r=this.to-this.from){n=Math.min(n,r);let i=this.composing;return i&&i.drifted?i.editorBase+(n-i.contextBase):n+this.from}toContextPos(n){let r=this.composing;return r&&r.drifted?r.contextBase+(n-r.editorBase):n-this.from}destroy(){for(let n in this.handlers)this.editContext.removeEventListener(n,this.handlers[n])}}class St{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(n={}){var r;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),n.parent&&n.parent.appendChild(this.dom);let{dispatch:i}=n;this.dispatchTransactions=n.dispatchTransactions||i&&(s=>s.forEach(a=>i(a,this)))||(s=>this.update(s)),this.dispatch=this.dispatch.bind(this),this._root=n.root||R_e(n.parent)||document,this.viewState=new FP(this,n.state||bn.create(n)),n.scrollTo&&n.scrollTo.is(f_)&&(this.viewState.scrollTarget=n.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Qh).map(s=>new yS(s));for(let s of this.plugins)s.update(this);this.observer=new tbe(this),this.inputState=new Sxe(this),this.inputState.ensureHandlers(this.plugins),this.docView=new EP(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((r=document.fonts)===null||r===void 0)&&r.ready&&document.fonts.ready.then(()=>{this.viewState.mustMeasureContent="refresh",this.requestMeasure()})}dispatch(...n){let r=n.length==1&&n[0]instanceof ri?n:n.length==1&&Array.isArray(n[0])?n[0]:[this.state.update(...n)];this.dispatchTransactions(r,this)}update(n){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let r=!1,i=!1,s,a=this.state;for(let g of n){if(g.startState!=a)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");a=g.state}if(this.destroyed){this.viewState.state=a;return}let o=this.hasFocus,l=0,u=null;n.some(g=>g.annotation(IH))?(this.inputState.notifiedFocused=o,l=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,u=BH(a,o),u||(l=1));let d=this.observer.delayedAndroidKey,p=null;if(d?(this.observer.clearDelayedAndroidKey(),p=this.observer.readChange(),(p&&!this.state.doc.eq(a.doc)||!this.state.selection.eq(a.selection))&&(p=null)):this.observer.clear(),a.facet(bn.phrases)!=this.state.facet(bn.phrases))return this.setState(a);s=fb.create(this,a,n),s.flags|=l;let f=this.viewState.scrollTarget;try{this.updateState=2;for(let g of n){if(f&&(f=f.map(g.changes)),g.scrollIntoView){let{main:_}=g.state.selection,{x,y:v}=this.state.facet(St.cursorScrollMargin);f=new ff(_.empty?_:Ze.cursor(_.head,_.head>_.anchor?-1:1),"nearest","nearest",v,x)}for(let _ of g.effects)_.is(f_)&&(f=_.value.clip(this.state))}this.viewState.update(s,f),this.bidiCache=yb.update(this.bidiCache,s.changes),s.empty||(this.updatePlugins(s),this.inputState.update(s)),r=this.docView.update(s),this.state.facet(Rm)!=this.styleModules&&this.mountStyles(),i=this.updateAttrs(),this.showAnnouncements(n),this.docView.updateSelection(r,n.some(g=>g.isUserEvent("select.pointer")))}finally{this.updateState=0}if(s.startState.facet(__)!=s.state.facet(__)&&(this.viewState.mustMeasureContent=!0),(r||i||f||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),r&&this.docViewUpdate(),!s.empty)for(let g of this.state.facet(Kj))try{g(s)}catch(_){es(this.state,_,"update listener")}(u||p)&&Promise.resolve().then(()=>{u&&this.state==u.startState&&this.dispatch(u),p&&!TH(this,p)&&d.force&&hf(this.contentDOM,d.key,d.keyCode)})}setState(n){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=n;return}this.updateState=2;let r=this.hasFocus;try{for(let i of this.plugins)i.destroy(this);this.viewState=new FP(this,n),this.plugins=n.facet(Qh).map(i=>new yS(i)),this.pluginMap.clear();for(let i of this.plugins)i.update(this);this.docView.destroy(),this.docView=new EP(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}r&&this.focus(),this.requestMeasure()}updatePlugins(n){let r=n.startState.facet(Qh),i=n.state.facet(Qh);if(r!=i){let s=[];for(let a of i){let o=r.indexOf(a);if(o<0)s.push(new yS(a));else{let l=this.plugins[o];l.mustUpdate=n,s.push(l)}}for(let a of this.plugins)a.mustUpdate!=n&&a.destroy(this);this.plugins=s,this.pluginMap.clear()}else for(let s of this.plugins)s.mustUpdate=n;for(let s=0;s<this.plugins.length;s++)this.plugins[s].update(this);r!=i&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let n of this.plugins){let r=n.value;if(r&&r.docViewUpdate)try{r.docViewUpdate(this)}catch(i){es(this.state,i,"doc view update listener")}}}measure(n=!0){if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,n&&this.observer.forceFlush();let r=null,i=this.viewState.scrollParent,s=this.viewState.getScrollOffset(),{scrollAnchorPos:a,scrollAnchorHeight:o}=this.viewState;Math.abs(s-this.viewState.scrollOffset)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let l=0;;l++){if(o<0)if(iH(i||this.win))a=-1,o=this.viewState.heightMap.height;else{let _=this.viewState.scrollAnchorAt(s);a=_.from,o=_.top}this.updateState=1;let u=this.viewState.measure();if(!u&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(l>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let d=[];u&4||([this.measureRequests,d]=[d,this.measureRequests]);let p=d.map(_=>{try{return _.read(this)}catch(x){return es(this.state,x),VP}}),f=fb.create(this,this.state,[]),g=!1;f.flags|=u,r?r.flags|=u:r=f,this.updateState=2,f.empty||(this.updatePlugins(f),this.inputState.update(f),this.updateAttrs(),g=this.docView.update(f),g&&this.docViewUpdate());for(let _=0;_<d.length;_++)if(p[_]!=VP)try{let x=d[_];x.write&&x.write(p[_],this)}catch(x){es(this.state,x)}if(g&&this.docView.updateSelection(!0),!f.viewportChanged&&this.measureRequests.length==0){if(this.viewState.editorHeight)if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,o=-1;continue}else{let x=((a<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(a).top)-o)/this.scaleY;if((x>1||x<-1)&&(i==this.scrollDOM||this.hasFocus||Math.max(this.inputState.lastWheelEvent,this.inputState.lastTouchTime)>Date.now()-100)){s=s+x,i?i.scrollTop+=x:this.win.scrollBy(0,x),o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(r&&!r.empty)for(let l of this.state.facet(Kj))l(r)}get themeClasses(){return Jj+" "+(this.state.facet(Zj)?HH:FH)+" "+this.state.facet(__)}updateAttrs(){let n=KP(this,kH,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),r={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(Ol)?"true":"false",class:"cm-content",style:`${Et.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(r["aria-readonly"]="true"),KP(this,BA,r);let i=this.observer.ignore(()=>{let s=kP(this.contentDOM,this.contentAttrs,r),a=kP(this.dom,this.editorAttrs,n);return s||a});return this.editorAttrs=n,this.contentAttrs=r,i}showAnnouncements(n){let r=!0;for(let i of n)for(let s of i.effects)if(s.is(St.announce)){r&&(this.announceDOM.textContent=""),r=!1;let a=this.announceDOM.appendChild(document.createElement("div"));a.textContent=s.value}}mountStyles(){this.styleModules=this.state.facet(Rm);let n=this.state.facet(St.cspNonce);au.mount(this.root,this.styleModules.concat(Jxe).reverse(),n?{nonce:n}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(n){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),n){if(this.measureRequests.indexOf(n)>-1)return;if(n.key!=null){for(let r=0;r<this.measureRequests.length;r++)if(this.measureRequests[r].key===n.key){this.measureRequests[r]=n;return}}this.measureRequests.push(n)}}plugin(n){let r=this.pluginMap.get(n);return(r===void 0||r&&r.plugin!=n)&&this.pluginMap.set(n,r=this.plugins.find(i=>i.plugin==n)||null),r&&r.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(n){return this.readMeasured(),this.viewState.elementAtHeight(n)}lineBlockAtHeight(n){return this.readMeasured(),this.viewState.lineBlockAtHeight(n)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(n){return this.viewState.lineBlockAt(n)}get contentHeight(){return this.viewState.contentHeight}moveByChar(n,r,i){return kS(this,n,AP(this,n,r,i))}moveByGroup(n,r){return kS(this,n,AP(this,n,r,i=>pxe(this,n.head,i)))}visualLineSide(n,r){let i=this.bidiSpans(n),s=this.textDirectionAt(n.from),a=i[r?i.length-1:0];return Ze.cursor(a.side(r,s)+n.from,a.forward(!r,s)?1:-1)}moveToLineBoundary(n,r,i=!0){return fxe(this,n,r,i)}moveVertically(n,r,i){return kS(this,n,mxe(this,n,r,i))}domAtPos(n,r=1){return this.docView.domAtPos(n,r)}posAtDOM(n,r=0){return this.docView.posFromDOM(n,r)}posAtCoords(n,r=!0){this.readMeasured();let i=Xj(this,n,r);return i&&i.pos}posAndSideAtCoords(n,r=!0){return this.readMeasured(),Xj(this,n,r)}coordsAtPos(n,r=1){this.readMeasured();let i=this.docView.coordsAt(n,r);if(!i||i.left==i.right)return i;let s=this.state.doc.lineAt(n),a=this.bidiSpans(s),o=a[zo.find(a,n-s.from,-1,r)];return Dg(i,o.dir==Jn.LTR==r>0)}coordsForChar(n){return this.readMeasured(),this.docView.coordsForChar(n)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(n){return!this.state.facet(yH)||n<this.viewport.from||n>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(n))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(n){if(n.length>ibe)return uH(n.length);let r=this.textDirectionAt(n.from),i;for(let a of this.bidiCache)if(a.from==n.from&&a.dir==r&&(a.fresh||cH(a.isolates,i=CP(this,n))))return a.order;i||(i=CP(this,n));let s=$_e(n.text,r,i);return this.bidiCache.push(new yb(n.from,n.to,r,i,!0,s)),s}get hasFocus(){var n;return(this.dom.ownerDocument.hasFocus()||Et.safari&&((n=this.inputState)===null||n===void 0?void 0:n.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{rH(this.contentDOM),this.docView.updateSelection()})}setRoot(n){this._root!=n&&(this._root=n,this.observer.setWindow((n.nodeType==9?n:n.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let n of this.plugins)n.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(n,r={}){var i,s,a,o;return f_.of(new ff(typeof n=="number"?Ze.cursor(n):n,(i=r.y)!==null&&i!==void 0?i:"nearest",(s=r.x)!==null&&s!==void 0?s:"nearest",(a=r.yMargin)!==null&&a!==void 0?a:5,(o=r.xMargin)!==null&&o!==void 0?o:5))}scrollSnapshot(){let{scrollTop:n,scrollLeft:r}=this.scrollDOM,i=this.viewState.scrollAnchorAt(n);return f_.of(new ff(Ze.cursor(i.from),"start","start",i.top-n,r,!0))}setTabFocusMode(n){n==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof n=="boolean"?this.inputState.tabFocusMode=n?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+n)}static domEventHandlers(n){return Cr.define(()=>({}),{eventHandlers:n})}static domEventObservers(n){return Cr.define(()=>({}),{eventObservers:n})}static theme(n,r){let i=au.newName(),s=[__.of(i),Rm.of(eN(`.${i}`,n))];return r&&r.dark&&s.push(Zj.of(!0)),s}static baseTheme(n){return Ld.lowest(Rm.of(eN("."+Jj,n,WH)))}static findFromDOM(n){var r;let i=n.querySelector(".cm-content"),s=i&&Or.get(i)||Or.get(n);return((r=s==null?void 0:s.root)===null||r===void 0?void 0:r.view)||null}}St.styleModule=Rm;St.inputHandler=gH;St.clipboardInputFilter=LA;St.clipboardOutputFilter=IA;St.scrollHandler=xH;St.focusChangeEffect=vH;St.perLineTextDirection=yH;St.exceptionSink=mH;St.updateListener=Kj;St.editable=Ol;St.mouseSelectionStyle=pH;St.dragMovesSelection=fH;St.clickAddsSelectionRange=hH;St.decorations=O0;St.blockWrappers=wH;St.outerDecorations=zA;St.atomicRanges=Nv;St.bidiIsolatedRanges=SH;St.cursorScrollMargin=jt.define({combine:e=>{let n=5,r=5;for(let i of e)typeof i=="number"?n=r=i:{x:n,y:r}=i;return{x:n,y:r}}});St.scrollMargins=CH;St.darkTheme=Zj;St.cspNonce=jt.define({combine:e=>e.length?e[0]:""});St.contentAttributes=BA;St.editorAttributes=kH;St.lineWrapping=St.contentAttributes.of({class:"cm-lineWrapping"});St.announce=Zt.define();const ibe=4096,VP={};class yb{constructor(n,r,i,s,a,o){this.from=n,this.to=r,this.dir=i,this.isolates=s,this.fresh=a,this.order=o}static update(n,r){if(r.empty&&!n.some(a=>a.fresh))return n;let i=[],s=n.length?n[n.length-1].dir:Jn.LTR;for(let a=Math.max(0,n.length-10);a<n.length;a++){let o=n[a];o.dir==s&&!r.touchesRange(o.from,o.to)&&i.push(new yb(r.mapPos(o.from,1),r.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return i}}function KP(e,n,r){for(let i=e.state.facet(n),s=i.length-1;s>=0;s--){let a=i[s],o=typeof a=="function"?a(e):a;o&&OA(o,r)}return r}const sbe=Et.mac?"mac":Et.windows?"win":Et.linux?"linux":"key";function abe(e,n){const r=e.split(/-(?!$)/);let i=r[r.length-1];i=="Space"&&(i=" ");let s,a,o,l;for(let u=0;u<r.length-1;++u){const d=r[u];if(/^(cmd|meta|m)$/i.test(d))l=!0;else if(/^a(lt)?$/i.test(d))s=!0;else if(/^(c|ctrl|control)$/i.test(d))a=!0;else if(/^s(hift)?$/i.test(d))o=!0;else if(/^mod$/i.test(d))n=="mac"?l=!0:a=!0;else throw new Error("Unrecognized modifier name: "+d)}return s&&(i="Alt-"+i),a&&(i="Ctrl-"+i),l&&(i="Meta-"+i),o&&(i="Shift-"+i),i}function x_(e,n,r){return n.altKey&&(e="Alt-"+e),n.ctrlKey&&(e="Ctrl-"+e),n.metaKey&&(e="Meta-"+e),r!==!1&&n.shiftKey&&(e="Shift-"+e),e}const obe=Ld.default(St.domEventHandlers({keydown(e,n){return UH(qH(n.state),e,n,"editor")}})),I0=jt.define({enables:obe}),YP=new WeakMap;function qH(e){let n=e.facet(I0),r=YP.get(n);return r||YP.set(n,r=ube(n.reduce((i,s)=>i.concat(s),[]))),r}function lbe(e,n,r){return UH(qH(e.state),n,e,r)}let Uc=null;const cbe=4e3;function ube(e,n=sbe){let r=Object.create(null),i=Object.create(null),s=(o,l)=>{let u=i[o];if(u==null)i[o]=l;else if(u!=l)throw new Error("Key binding "+o+" is used both as a regular binding and as a multi-stroke prefix")},a=(o,l,u,d,p)=>{var f,g;let _=r[o]||(r[o]=Object.create(null)),x=l.split(/ (?!$)/).map(w=>abe(w,n));for(let w=1;w<x.length;w++){let N=x.slice(0,w).join(" ");s(N,!0),_[N]||(_[N]={preventDefault:!0,stopPropagation:!1,run:[C=>{let T=Uc={view:C,prefix:N,scope:o};return setTimeout(()=>{Uc==T&&(Uc=null)},cbe),!0}]})}let v=x.join(" ");s(v,!1);let S=_[v]||(_[v]={preventDefault:!1,stopPropagation:!1,run:((g=(f=_._any)===null||f===void 0?void 0:f.run)===null||g===void 0?void 0:g.slice())||[]});u&&S.run.push(u),d&&(S.preventDefault=!0),p&&(S.stopPropagation=!0)};for(let o of e){let l=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let d of l){let p=r[d]||(r[d]=Object.create(null));p._any||(p._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:f}=o;for(let g in p)p[g].run.push(_=>f(_,tN))}let u=o[n]||o.key;if(u)for(let d of l)a(d,u,o.run,o.preventDefault,o.stopPropagation),o.shift&&a(d,"Shift-"+u,o.shift,o.preventDefault,o.stopPropagation)}return r}let tN=null;function UH(e,n,r,i){tN=n;let s=C_e(n),a=_s(s,0),o=Do(a)==s.length&&s!=" ",l="",u=!1,d=!1,p=!1;Uc&&Uc.view==r&&Uc.scope==i&&(l=Uc.prefix+" ",OH.indexOf(n.keyCode)<0&&(d=!0,Uc=null));let f=new Set,g=S=>{if(S){for(let w of S.run)if(!f.has(w)&&(f.add(w),w(r)))return S.stopPropagation&&(p=!0),!0;S.preventDefault&&(S.stopPropagation&&(p=!0),d=!0)}return!1},_=e[i],x,v;return _&&(g(_[l+x_(s,n,!o)])?u=!0:o&&(n.altKey||n.metaKey||n.ctrlKey)&&!(Et.windows&&n.ctrlKey&&n.altKey)&&!(Et.mac&&n.altKey&&!(n.ctrlKey||n.metaKey))&&(x=ou[n.keyCode])&&x!=s?(g(_[l+x_(x,n,!0)])||n.shiftKey&&(v=Mg[n.keyCode])!=s&&v!=x&&g(_[l+x_(v,n,!1)]))&&(u=!0):o&&n.shiftKey&&g(_[l+x_(s,n,!0)])&&(u=!0),!u&&g(_._any)&&(u=!0)),d&&(u=!0),u&&p&&n.stopPropagation(),tN=null,u}class gd{constructor(n,r,i,s,a){this.className=n,this.left=r,this.top=i,this.width=s,this.height=a}draw(){let n=document.createElement("div");return n.className=this.className,this.adjust(n),n}update(n,r){return r.className!=this.className?!1:(this.adjust(n),!0)}adjust(n){n.style.left=this.left+"px",n.style.top=this.top+"px",this.width!=null&&(n.style.width=this.width+"px"),n.style.height=this.height+"px"}eq(n){return this.left==n.left&&this.top==n.top&&this.width==n.width&&this.height==n.height&&this.className==n.className}static forRange(n,r,i){if(i.empty){let s=n.coordsAtPos(i.head,i.assoc||1);if(!s)return[];let a=VH(n);return[new gd(r,s.left-a.left,s.top-a.top,null,s.bottom-s.top)]}else return dbe(n,r,i)}}function VH(e){let n=e.scrollDOM.getBoundingClientRect();return{left:(e.textDirection==Jn.LTR?n.left:n.right-e.scrollDOM.clientWidth*e.scaleX)-e.scrollDOM.scrollLeft*e.scaleX,top:n.top-e.scrollDOM.scrollTop*e.scaleY}}function GP(e,n,r,i){let s=e.coordsAtPos(n,r*2);if(!s)return i;let a=e.dom.getBoundingClientRect(),o=(s.top+s.bottom)/2,l=e.posAtCoords({x:a.left+1,y:o}),u=e.posAtCoords({x:a.right-1,y:o});return l==null||u==null?i:{from:Math.max(i.from,Math.min(l,u)),to:Math.min(i.to,Math.max(l,u))}}function dbe(e,n,r){if(r.to<=e.viewport.from||r.from>=e.viewport.to)return[];let i=Math.max(r.from,e.viewport.from),s=Math.min(r.to,e.viewport.to),a=e.textDirection==Jn.LTR,o=e.contentDOM,l=o.getBoundingClientRect(),u=VH(e),d=o.querySelector(".cm-line"),p=d&&window.getComputedStyle(d),f=l.left+(p?parseInt(p.paddingLeft)+Math.min(0,parseInt(p.textIndent)):0),g=l.right-(p?parseInt(p.paddingRight):0),_=Gj(e,i,1),x=Gj(e,s,-1),v=_.type==Ai.Text?_:null,S=x.type==Ai.Text?x:null;if(v&&(e.lineWrapping||_.widgetLineBreaks)&&(v=GP(e,i,1,v)),S&&(e.lineWrapping||x.widgetLineBreaks)&&(S=GP(e,s,-1,S)),v&&S&&v.from==S.from&&v.to==S.to)return N(C(r.from,r.to,v));{let A=v?C(r.from,null,v):T(_,!1),E=S?C(null,r.to,S):T(x,!0),D=[];return(v||_).to<(S||x).from-(v&&S?1:0)||_.widgetLineBreaks>1&&A.bottom+e.defaultLineHeight/2<E.top?D.push(w(f,A.bottom,g,E.top)):A.bottom<E.top&&e.elementAtHeight((A.bottom+E.top)/2).type==Ai.Text&&(A.bottom=E.top=(A.bottom+E.top)/2),N(A).concat(D).concat(N(E))}function w(A,E,D,F){return new gd(n,A-u.left,E-u.top,Math.max(0,D-A),F-E)}function N({top:A,bottom:E,horizontal:D}){let F=[];for(let B=0;B<D.length;B+=2)F.push(w(D[B],A,D[B+1],E));return F}function C(A,E,D){let F=1e9,B=-1e9,H=[];function $(P,q,I,Q,K){let Z=e.coordsAtPos(P,P==D.to?-2:2),Y=e.coordsAtPos(I,I==D.from?2:-2);!Z||!Y||(F=Math.min(Z.top,Y.top,F),B=Math.max(Z.bottom,Y.bottom,B),K==Jn.LTR?H.push(a&&q?f:Z.left,a&&Q?g:Y.right):H.push(!a&&Q?f:Y.left,!a&&q?g:Z.right))}let z=A??D.from,W=E??D.to;for(let P of e.visibleRanges)if(P.to>z&&P.from<W)for(let q=Math.max(P.from,z),I=Math.min(P.to,W);;){let Q=e.state.doc.lineAt(q);for(let K of e.bidiSpans(Q)){let Z=K.from+Q.from,Y=K.to+Q.from;if(Z>=I)break;Y>q&&$(Math.max(Z,q),A==null&&Z<=z,Math.min(Y,I),E==null&&Y>=W,K.dir)}if(q=Q.to+1,q>=I)break}return H.length==0&&$(z,A==null,W,E==null,e.textDirection),{top:F,bottom:B,horizontal:H}}function T(A,E){let D=l.top+(E?A.top:A.bottom);return{top:D,bottom:D,horizontal:[]}}}function hbe(e,n){return e.constructor==n.constructor&&e.eq(n)}class fbe{constructor(n,r){this.view=n,this.layer=r,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=n.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),r.above&&this.dom.classList.add("cm-layer-above"),r.class&&this.dom.classList.add(r.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(n.state),n.requestMeasure(this.measureReq),r.mount&&r.mount(this.dom,n)}update(n){n.startState.facet(yx)!=n.state.facet(yx)&&this.setOrder(n.state),(this.layer.update(n,this.dom)||n.geometryChanged)&&(this.scale(),n.view.requestMeasure(this.measureReq))}docViewUpdate(n){this.layer.updateOnDocViewUpdate!==!1&&n.requestMeasure(this.measureReq)}setOrder(n){let r=0,i=n.facet(yx);for(;r<i.length&&i[r]!=this.layer;)r++;this.dom.style.zIndex=String((this.layer.above?150:-1)-r)}measure(){return this.layer.markers(this.view)}scale(){let{scaleX:n,scaleY:r}=this.view;(n!=this.scaleX||r!=this.scaleY)&&(this.scaleX=n,this.scaleY=r,this.dom.style.transform=`scale(${1/n}, ${1/r})`)}draw(n){if(n.length!=this.drawn.length||n.some((r,i)=>!hbe(r,this.drawn[i]))){let r=this.dom.firstChild,i=0;for(let s of n)s.update&&r&&s.constructor&&this.drawn[i].constructor&&s.update(r,this.drawn[i])?(r=r.nextSibling,i++):this.dom.insertBefore(s.draw(),r);for(;r;){let s=r.nextSibling;r.remove(),r=s}this.drawn=n,Et.webkit&&(this.dom.style.display=this.dom.firstChild?"":"none")}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const yx=jt.define();function KH(e){return[Cr.define(n=>new fbe(n,e)),yx.of(e)]}const If=jt.define({combine(e){return ro(e,{cursorBlinkRate:1200,drawRangeCursor:!0,iosSelectionHandles:!0},{cursorBlinkRate:(n,r)=>Math.min(n,r),drawRangeCursor:(n,r)=>n||r})}});function pbe(e={}){return[If.of(e),mbe,gbe,vbe,_H.of(!0)]}function YH(e){return e.startState.facet(If)!=e.state.facet(If)}const mbe=KH({above:!0,markers(e){let{state:n}=e,r=n.facet(If),i=[];for(let s of n.selection.ranges){let a=s==n.selection.main;if(s.empty||r.drawRangeCursor&&!(a&&Et.ios&&r.iosSelectionHandles)){let o=a?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",l=s.empty?s:Ze.cursor(s.head,s.assoc);for(let u of gd.forRange(e,o,l))i.push(u)}}return i},update(e,n){e.transactions.some(i=>i.selection)&&(n.style.animationName=n.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let r=YH(e);return r&&XP(e.state,n),e.docChanged||e.selectionSet||r},mount(e,n){XP(n.state,e)},class:"cm-cursorLayer"});function XP(e,n){n.style.animationDuration=e.facet(If).cursorBlinkRate+"ms"}const gbe=KH({above:!1,markers(e){let n=[],{main:r,ranges:i}=e.state.selection;for(let s of i)if(!s.empty)for(let a of gd.forRange(e,"cm-selectionBackground",s))n.push(a);if(Et.ios&&!r.empty&&e.state.facet(If).iosSelectionHandles){for(let s of gd.forRange(e,"cm-selectionHandle cm-selectionHandle-start",Ze.cursor(r.from,1)))n.push(s);for(let s of gd.forRange(e,"cm-selectionHandle cm-selectionHandle-end",Ze.cursor(r.to,1)))n.push(s)}return n},update(e,n){return e.docChanged||e.selectionSet||e.viewportChanged||YH(e)},class:"cm-selectionLayer"}),vbe=Ld.highest(St.theme({".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"},caretColor:"transparent !important"},".cm-content":{caretColor:"transparent !important","& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}})),GH=Zt.define({map(e,n){return e==null?null:n.mapPos(e)}}),Dm=vi.define({create(){return null},update(e,n){return e!=null&&(e=n.changes.mapPos(e)),n.effects.reduce((r,i)=>i.is(GH)?i.value:r,e)}}),ybe=Cr.fromClass(class{constructor(e){this.view=e,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(e){var n;let r=e.state.field(Dm);r==null?this.cursor!=null&&((n=this.cursor)===null||n===void 0||n.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(e.startState.field(Dm)!=r||e.docChanged||e.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:e}=this,n=e.state.field(Dm),r=n!=null&&e.coordsAtPos(n);if(!r)return null;let i=e.scrollDOM.getBoundingClientRect();return{left:r.left-i.left+e.scrollDOM.scrollLeft*e.scaleX,top:r.top-i.top+e.scrollDOM.scrollTop*e.scaleY,height:r.bottom-r.top}}drawCursor(e){if(this.cursor){let{scaleX:n,scaleY:r}=this.view;e?(this.cursor.style.left=e.left/n+"px",this.cursor.style.top=e.top/r+"px",this.cursor.style.height=e.height/r+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(e){this.view.state.field(Dm)!=e&&this.view.dispatch({effects:GH.of(e)})}},{eventObservers:{dragover(e){this.setDropPos(this.view.posAtCoords({x:e.clientX,y:e.clientY}))},dragleave(e){(e.target==this.view.contentDOM||!this.view.contentDOM.contains(e.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function _be(){return[Dm,ybe]}function QP(e,n,r,i,s){n.lastIndex=0;for(let a=e.iterRange(r,i),o=r,l;!a.next().done;o+=a.value.length)if(!a.lineBreak)for(;l=n.exec(a.value);)s(o+l.index,l)}function xbe(e,n){let r=e.visibleRanges;if(r.length==1&&r[0].from==e.viewport.from&&r[0].to==e.viewport.to)return r;let i=[];for(let{from:s,to:a}of r)s=Math.max(e.state.doc.lineAt(s).from,s-n),a=Math.min(e.state.doc.lineAt(a).to,a+n),i.length&&i[i.length-1].to>=s?i[i.length-1].to=a:i.push({from:s,to:a});return i}class bbe{constructor(n){const{regexp:r,decoration:i,decorate:s,boundary:a,maxLength:o=1e3}=n;if(!r.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=r,s)this.addMatch=(l,u,d,p)=>s(p,d,d+l[0].length,l,u);else if(typeof i=="function")this.addMatch=(l,u,d,p)=>{let f=i(l,u,d);f&&p(d,d+l[0].length,f)};else if(i)this.addMatch=(l,u,d,p)=>p(d,d+l[0].length,i);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=a,this.maxLength=o}createDeco(n){let r=new Kl,i=r.add.bind(r);for(let{from:s,to:a}of xbe(n,this.maxLength))QP(n.state.doc,this.regexp,s,a,(o,l)=>this.addMatch(l,n,o,i));return r.finish()}updateDeco(n,r){let i=1e9,s=-1;return n.docChanged&&n.changes.iterChanges((a,o,l,u)=>{u>=n.view.viewport.from&&l<=n.view.viewport.to&&(i=Math.min(l,i),s=Math.max(u,s))}),n.viewportMoved||s-i>1e3?this.createDeco(n.view):s>-1?this.updateRange(n.view,r.map(n.changes),i,s):r}updateRange(n,r,i,s){for(let a of n.visibleRanges){let o=Math.max(a.from,i),l=Math.min(a.to,s);if(l>=o){let u=n.state.doc.lineAt(o),d=u.to<l?n.state.doc.lineAt(l):u,p=Math.max(a.from,u.from),f=Math.min(a.to,d.to);if(this.boundary){for(;o>u.from;o--)if(this.boundary.test(u.text[o-1-u.from])){p=o;break}for(;l<d.to;l++)if(this.boundary.test(d.text[l-d.from])){f=l;break}}let g=[],_,x=(v,S,w)=>g.push(w.range(v,S));if(u==d)for(this.regexp.lastIndex=p-u.from;(_=this.regexp.exec(u.text))&&_.index<f-u.from;)this.addMatch(_,n,_.index+u.from,x);else QP(n.state.doc,this.regexp,p,f,(v,S)=>this.addMatch(S,n,v,x));r=r.update({filterFrom:p,filterTo:f,filter:(v,S)=>v<p||S>f,add:g})}}return r}}const nN=/x/.unicode!=null?"gu":"g",kbe=new RegExp(`[\0-\b
--­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF￹-￼]`,nN),wbe={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let CS=null;function Sbe(){var e;if(CS==null&&typeof document<"u"&&document.body){let n=document.body.style;CS=((e=n.tabSize)!==null&&e!==void 0?e:n.MozTabSize)!=null}return CS||!1}const _x=jt.define({combine(e){let n=ro(e,{render:null,specialChars:kbe,addSpecialChars:null});return(n.replaceTabs=!Sbe())&&(n.specialChars=new RegExp("	|"+n.specialChars.source,nN)),n.addSpecialChars&&(n.specialChars=new RegExp(n.specialChars.source+"|"+n.addSpecialChars.source,nN)),n}});function Cbe(e={}){return[_x.of(e),jbe()]}let ZP=null;function jbe(){return ZP||(ZP=Cr.fromClass(class{constructor(e){this.view=e,this.decorations=Wt.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(e.state.facet(_x)),this.decorations=this.decorator.createDeco(e)}makeDecorator(e){return new bbe({regexp:e.specialChars,decoration:(n,r,i)=>{let{doc:s}=r.state,a=_s(n[0],0);if(a==9){let o=s.lineAt(i),l=r.state.tabSize,u=Zf(o.text,l,i-o.from);return Wt.replace({widget:new Tbe((l-u%l)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[a]||(this.decorationCache[a]=Wt.replace({widget:new Abe(e,a)}))},boundary:e.replaceTabs?void 0:/[^]/})}update(e){let n=e.state.facet(_x);e.startState.facet(_x)!=n?(this.decorator=this.makeDecorator(n),this.decorations=this.decorator.createDeco(e.view)):this.decorations=this.decorator.updateDeco(e,this.decorations)}},{decorations:e=>e.decorations}))}const Nbe="•";function Ebe(e){return e>=32?Nbe:e==10?"␤":String.fromCharCode(9216+e)}class Abe extends nl{constructor(n,r){super(),this.options=n,this.code=r}eq(n){return n.code==this.code}toDOM(n){let r=Ebe(this.code),i=n.state.phrase("Control character")+" "+(wbe[this.code]||"0x"+this.code.toString(16)),s=this.options.render&&this.options.render(this.code,i,r);if(s)return s;let a=document.createElement("span");return a.textContent=r,a.title=i,a.setAttribute("aria-label",i),a.className="cm-specialChar",a}ignoreEvent(){return!1}}class Tbe extends nl{constructor(n){super(),this.width=n}eq(n){return n.width==this.width}toDOM(){let n=document.createElement("span");return n.textContent="	",n.className="cm-tab",n.style.width=this.width+"px",n}ignoreEvent(){return!1}}function Mbe(){return Obe}const Rbe=Wt.line({class:"cm-activeLine"}),Obe=Cr.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.docChanged||e.selectionSet)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let n=-1,r=[];for(let i of e.state.selection.ranges){let s=e.lineBlockAt(i.head);s.from>n&&(r.push(Rbe.range(s.from)),n=s.from)}return Wt.set(r)}},{decorations:e=>e.decorations});class Dbe extends nl{constructor(n){super(),this.content=n}toDOM(n){let r=document.createElement("span");return r.className="cm-placeholder",r.style.pointerEvents="none",r.appendChild(typeof this.content=="string"?document.createTextNode(this.content):typeof this.content=="function"?this.content(n):this.content.cloneNode(!0)),r.setAttribute("aria-hidden","true"),r}coordsAt(n){let r=n.firstChild?tg(n.firstChild):[];if(!r.length)return null;let i=window.getComputedStyle(n.parentNode),s=Dg(r[0],i.direction!="rtl"),a=parseInt(i.lineHeight);return s.bottom-s.top>a*1.5?{left:s.left,right:s.right,top:s.top,bottom:s.top+a}:s}ignoreEvent(){return!1}}function Pbe(e){let n=Cr.fromClass(class{constructor(r){this.view=r,this.placeholder=e?Wt.set([Wt.widget({widget:new Dbe(e),side:1}).range(0)]):Wt.none}get decorations(){return this.view.state.doc.length?Wt.none:this.placeholder}},{decorations:r=>r.decorations});return typeof e=="string"?[n,St.contentAttributes.of({"aria-placeholder":e})]:n}const rN=2e3;function Lbe(e,n,r){let i=Math.min(n.line,r.line),s=Math.max(n.line,r.line),a=[];if(n.off>rN||r.off>rN||n.col<0||r.col<0){let o=Math.min(n.off,r.off),l=Math.max(n.off,r.off);for(let u=i;u<=s;u++){let d=e.doc.line(u);d.length<=l&&a.push(Ze.range(d.from+o,d.to+l))}}else{let o=Math.min(n.col,r.col),l=Math.max(n.col,r.col);for(let u=i;u<=s;u++){let d=e.doc.line(u),p=Lj(d.text,o,e.tabSize,!0);if(p<0)a.push(Ze.cursor(d.to));else{let f=Lj(d.text,l,e.tabSize);a.push(Ze.range(d.from+p,d.from+f))}}}return a}function Ibe(e,n){let r=e.coordsAtPos(e.viewport.from);return r?Math.round(Math.abs((r.left-n)/e.defaultCharacterWidth)):-1}function JP(e,n){let r=e.posAtCoords({x:n.clientX,y:n.clientY},!1),i=e.state.doc.lineAt(r),s=r-i.from,a=s>rN?-1:s==i.length?Ibe(e,n.clientX):Zf(i.text,e.state.tabSize,r-i.from);return{line:i.number,col:a,off:s}}function Bbe(e,n){let r=JP(e,n),i=e.state.selection;return r?{update(s){if(s.docChanged){let a=s.changes.mapPos(s.startState.doc.line(r.line).from),o=s.state.doc.lineAt(a);r={line:o.number,col:r.col,off:Math.min(r.off,o.length)},i=i.map(s.changes)}},get(s,a,o){let l=JP(e,s);if(!l)return i;let u=Lbe(e.state,r,l);return u.length?o?Ze.create(u.concat(i.ranges)):Ze.create(u):i}}:null}function zbe(e){let n=(r=>r.altKey&&r.button==0);return St.mouseSelectionStyle.of((r,i)=>n(i)?Bbe(r,i):null)}const $be={Alt:[18,e=>!!e.altKey],Control:[17,e=>!!e.ctrlKey],Shift:[16,e=>!!e.shiftKey],Meta:[91,e=>!!e.metaKey]},Fbe={style:"cursor: crosshair"};function Hbe(e={}){let[n,r]=$be[e.key||"Alt"],i=Cr.fromClass(class{constructor(s){this.view=s,this.isDown=!1}set(s){this.isDown!=s&&(this.isDown=s,this.view.update([]))}},{eventObservers:{keydown(s){this.set(s.keyCode==n||r(s))},keyup(s){(s.keyCode==n||!r(s))&&this.set(!1)},mousemove(s){this.set(r(s))}}});return[i,St.contentAttributes.of(s=>{var a;return!((a=s.plugin(i))===null||a===void 0)&&a.isDown?Fbe:null})]}const b_="-10000px";class XH{constructor(n,r,i,s){this.facet=r,this.createTooltipView=i,this.removeTooltipView=s,this.input=n.state.facet(r),this.tooltips=this.input.filter(o=>o);let a=null;this.tooltipViews=this.tooltips.map(o=>a=i(o,a))}update(n,r){var i;let s=n.state.facet(this.facet),a=s.filter(u=>u);if(s===this.input){for(let u of this.tooltipViews)u.update&&u.update(n);return!1}let o=[],l=r?[]:null;for(let u=0;u<a.length;u++){let d=a[u],p=-1;if(d){for(let f=0;f<this.tooltips.length;f++){let g=this.tooltips[f];g&&g.create==d.create&&(p=f)}if(p<0)o[u]=this.createTooltipView(d,u?o[u-1]:null),l&&(l[u]=!!d.above);else{let f=o[u]=this.tooltipViews[p];l&&(l[u]=r[p]),f.update&&f.update(n)}}}for(let u of this.tooltipViews)o.indexOf(u)<0&&(this.removeTooltipView(u),(i=u.destroy)===null||i===void 0||i.call(u));return r&&(l.forEach((u,d)=>r[d]=u),r.length=l.length),this.input=s,this.tooltips=a,this.tooltipViews=o,!0}}function Wbe(e){let n=e.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:n.clientHeight,right:n.clientWidth}}const jS=jt.define({combine:e=>{var n,r,i;return{position:Et.ios?"absolute":((n=e.find(s=>s.position))===null||n===void 0?void 0:n.position)||"fixed",parent:((r=e.find(s=>s.parent))===null||r===void 0?void 0:r.parent)||null,tooltipSpace:((i=e.find(s=>s.tooltipSpace))===null||i===void 0?void 0:i.tooltipSpace)||Wbe}}}),eL=new WeakMap,qA=Cr.fromClass(class{constructor(e){this.view=e,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let n=e.state.facet(jS);this.position=n.position,this.parent=n.parent,this.classes=e.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver=typeof ResizeObserver=="function"?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new XH(e,B0,(r,i)=>this.createTooltip(r,i),r=>{this.resizeObserver&&this.resizeObserver.unobserve(r.dom),r.dom.remove()}),this.above=this.manager.tooltips.map(r=>!!r.above),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(r=>{Date.now()>this.lastTransaction-50&&r.length>0&&r[r.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),e.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let e of this.manager.tooltipViews)this.intersectionObserver.observe(e.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(e){e.transactions.length&&(this.lastTransaction=Date.now());let n=this.manager.update(e,this.above);n&&this.observeIntersection();let r=n||e.geometryChanged,i=e.state.facet(jS);if(i.position!=this.position&&!this.madeAbsolute){this.position=i.position;for(let s of this.manager.tooltipViews)s.dom.style.position=this.position;r=!0}if(i.parent!=this.parent){this.parent&&this.container.remove(),this.parent=i.parent,this.createContainer();for(let s of this.manager.tooltipViews)this.container.appendChild(s.dom);r=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);r&&this.maybeMeasure()}createTooltip(e,n){let r=e.create(this.view),i=n?n.dom:null;if(r.dom.classList.add("cm-tooltip"),e.arrow&&!r.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let s=document.createElement("div");s.className="cm-tooltip-arrow",r.dom.appendChild(s)}return r.dom.style.position=this.position,r.dom.style.top=b_,r.dom.style.left="0px",this.container.insertBefore(r.dom,i),r.mount&&r.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(r.dom),r}destroy(){var e,n,r;this.view.win.removeEventListener("resize",this.measureSoon);for(let i of this.manager.tooltipViews)i.dom.remove(),(e=i.destroy)===null||e===void 0||e.call(i);this.parent&&this.container.remove(),(n=this.resizeObserver)===null||n===void 0||n.disconnect(),(r=this.intersectionObserver)===null||r===void 0||r.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let e=1,n=1,r=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:a}=this.manager.tooltipViews[0];if(Et.safari){let o=a.getBoundingClientRect();r=Math.abs(o.top+1e4)>1||Math.abs(o.left)>1}else r=!!a.offsetParent&&a.offsetParent!=this.container.ownerDocument.body}if(r||this.position=="absolute")if(this.parent){let a=this.parent.getBoundingClientRect();a.width&&a.height&&(e=a.width/this.parent.offsetWidth,n=a.height/this.parent.offsetHeight)}else({scaleX:e,scaleY:n}=this.view.viewState);let i=this.view.scrollDOM.getBoundingClientRect(),s=$A(this.view);return{visible:{left:i.left+s.left,top:i.top+s.top,right:i.right-s.right,bottom:i.bottom-s.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((a,o)=>{let l=this.manager.tooltipViews[o];return l.getCoords?l.getCoords(a.pos):this.view.coordsAtPos(a.pos)}),size:this.manager.tooltipViews.map(({dom:a})=>a.getBoundingClientRect()),space:this.view.state.facet(jS).tooltipSpace(this.view),scaleX:e,scaleY:n,makeAbsolute:r}}writeMeasure(e){var n;if(e.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let l of this.manager.tooltipViews)l.dom.style.position="absolute"}let{visible:r,space:i,scaleX:s,scaleY:a}=e,o=[];for(let l=0;l<this.manager.tooltips.length;l++){let u=this.manager.tooltips[l],d=this.manager.tooltipViews[l],{dom:p}=d,f=e.pos[l],g=e.size[l];if(!f||u.clip!==!1&&(f.bottom<=Math.max(r.top,i.top)||f.top>=Math.min(r.bottom,i.bottom)||f.right<Math.max(r.left,i.left)-.1||f.left>Math.min(r.right,i.right)+.1)){p.style.top=b_;continue}let _=u.arrow?d.dom.querySelector(".cm-tooltip-arrow"):null,x=_?7:0,v=g.right-g.left,S=(n=eL.get(d))!==null&&n!==void 0?n:g.bottom-g.top,w=d.offset||Ube,N=this.view.textDirection==Jn.LTR,C=g.width>i.right-i.left?N?i.left:i.right-g.width:N?Math.max(i.left,Math.min(f.left-(_?14:0)+w.x,i.right-v)):Math.min(Math.max(i.left,f.left-v+(_?14:0)-w.x),i.right-v),T=this.above[l];!u.strictSide&&(T?f.top-S-x-w.y<i.top:f.bottom+S+x+w.y>i.bottom)&&T==i.bottom-f.bottom>f.top-i.top&&(T=this.above[l]=!T);let A=(T?f.top-i.top:i.bottom-f.bottom)-x;if(A<S&&d.resize!==!1){if(A<this.view.defaultLineHeight){p.style.top=b_;continue}eL.set(d,S),p.style.height=(S=A)/a+"px"}else p.style.height&&(p.style.height="");let E=T?f.top-S-x-w.y:f.bottom+x+w.y,D=C+v;if(d.overlap!==!0)for(let F of o)F.left<D&&F.right>C&&F.top<E+S&&F.bottom>E&&(E=T?F.top-S-2-x:F.bottom+x+2);if(this.position=="absolute"?(p.style.top=(E-e.parent.top)/a+"px",tL(p,(C-e.parent.left)/s)):(p.style.top=E/a+"px",tL(p,C/s)),_){let F=f.left+(N?w.x:-w.x)-(C+14-7);_.style.left=F/s+"px"}d.overlap!==!0&&o.push({left:C,top:E,right:D,bottom:E+S}),p.classList.toggle("cm-tooltip-above",T),p.classList.toggle("cm-tooltip-below",!T),d.positioned&&d.positioned(e.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let e of this.manager.tooltipViews)e.dom.style.top=b_}},{eventObservers:{scroll(){this.maybeMeasure()}}});function tL(e,n){let r=parseInt(e.style.left,10);(isNaN(r)||Math.abs(n-r)>1)&&(e.style.left=n+"px")}const qbe=St.baseTheme({".cm-tooltip":{zIndex:500,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:"14px",position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),Ube={x:0,y:0},B0=jt.define({enables:[qA,qbe]}),_b=jt.define({combine:e=>e.reduce((n,r)=>n.concat(r),[])});class z0{static create(n){return new z0(n)}constructor(n){this.view=n,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new XH(n,_b,(r,i)=>this.createHostedView(r,i),r=>r.dom.remove())}createHostedView(n,r){let i=n.create(this.view);return i.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(i.dom,r?r.dom.nextSibling:this.dom.firstChild),this.mounted&&i.mount&&i.mount(this.view),i}mount(n){for(let r of this.manager.tooltipViews)r.mount&&r.mount(n);this.mounted=!0}positioned(n){for(let r of this.manager.tooltipViews)r.positioned&&r.positioned(n)}update(n){this.manager.update(n)}destroy(){var n;for(let r of this.manager.tooltipViews)(n=r.destroy)===null||n===void 0||n.call(r)}passProp(n){let r;for(let i of this.manager.tooltipViews){let s=i[n];if(s!==void 0){if(r===void 0)r=s;else if(r!==s)return}}return r}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}const Vbe=B0.compute([_b],e=>{let n=e.facet(_b);return n.length===0?null:{pos:Math.min(...n.map(r=>r.pos)),end:Math.max(...n.map(r=>{var i;return(i=r.end)!==null&&i!==void 0?i:r.pos})),create:z0.create,above:n[0].above,arrow:n.some(r=>r.arrow)}});class Kbe{constructor(n,r,i,s,a){this.view=n,this.source=r,this.field=i,this.setHover=s,this.hoverTime=a,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:n.dom,time:0},this.checkHover=this.checkHover.bind(this),n.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),n.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let n=Date.now()-this.lastMove.time;n<this.hoverTime?this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime-n):this.startHover()}startHover(){clearTimeout(this.restartTimeout);let{view:n,lastMove:r}=this,i=n.docView.tile.nearest(r.target);if(!i)return;let s,a=1;if(i.isWidget())s=i.posAtStart;else{if(s=n.posAtCoords(r),s==null)return;let l=n.coordsAtPos(s);if(!l||r.y<l.top||r.y>l.bottom||r.x<l.left-n.defaultCharacterWidth||r.x>l.right+n.defaultCharacterWidth)return;let u=n.bidiSpans(n.state.doc.lineAt(s)).find(p=>p.from<=s&&p.to>=s),d=u&&u.dir==Jn.RTL?-1:1;a=r.x<l.left?-d:d}let o=this.source(n,s,a);if(o!=null&&o.then){let l=this.pending={pos:s};o.then(u=>{this.pending==l&&(this.pending=null,u&&!(Array.isArray(u)&&!u.length)&&n.dispatch({effects:this.setHover.of(Array.isArray(u)?u:[u])}))},u=>es(n.state,u,"hover tooltip"))}else o&&!(Array.isArray(o)&&!o.length)&&n.dispatch({effects:this.setHover.of(Array.isArray(o)?o:[o])})}get tooltip(){let n=this.view.plugin(qA),r=n?n.manager.tooltips.findIndex(i=>i.create==z0.create):-1;return r>-1?n.manager.tooltipViews[r]:null}mousemove(n){var r,i;this.lastMove={x:n.clientX,y:n.clientY,target:n.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:s,tooltip:a}=this;if(s.length&&a&&!Ybe(a.dom,n)||this.pending){let{pos:o}=s[0]||this.pending,l=(i=(r=s[0])===null||r===void 0?void 0:r.end)!==null&&i!==void 0?i:o;(o==l?this.view.posAtCoords(this.lastMove)!=o:!Gbe(this.view,o,l,n.clientX,n.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(n){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:r}=this;if(r.length){let{tooltip:i}=this;i&&i.dom.contains(n.relatedTarget)?this.watchTooltipLeave(i.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(n){let r=i=>{n.removeEventListener("mouseleave",r),this.active.length&&!this.view.dom.contains(i.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};n.addEventListener("mouseleave",r)}destroy(){clearTimeout(this.hoverTimeout),clearTimeout(this.restartTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const k_=4;function Ybe(e,n){let{left:r,right:i,top:s,bottom:a}=e.getBoundingClientRect(),o;if(o=e.querySelector(".cm-tooltip-arrow")){let l=o.getBoundingClientRect();s=Math.min(l.top,s),a=Math.max(l.bottom,a)}return n.clientX>=r-k_&&n.clientX<=i+k_&&n.clientY>=s-k_&&n.clientY<=a+k_}function Gbe(e,n,r,i,s,a){let o=e.scrollDOM.getBoundingClientRect(),l=e.documentTop+e.documentPadding.top+e.contentHeight;if(o.left>i||o.right<i||o.top>s||Math.min(o.bottom,l)<s)return!1;let u=e.posAtCoords({x:i,y:s},!1);return u>=n&&u<=r}function Xbe(e,n={}){let r=Zt.define(),i=vi.define({create(){return[]},update(s,a){if(s.length&&(n.hideOnChange&&(a.docChanged||a.selection)?s=[]:n.hideOn&&(s=s.filter(o=>!n.hideOn(a,o))),a.docChanged)){let o=[];for(let l of s){let u=a.changes.mapPos(l.pos,-1,Zi.TrackDel);if(u!=null){let d=Object.assign(Object.create(null),l);d.pos=u,d.end!=null&&(d.end=a.changes.mapPos(d.end)),o.push(d)}}s=o}for(let o of a.effects)o.is(r)&&(s=o.value),o.is(Qbe)&&(s=[]);return s},provide:s=>_b.from(s)});return{active:i,extension:[i,Cr.define(s=>new Kbe(s,e,i,r,n.hoverTime||300)),Vbe]}}function QH(e,n){let r=e.plugin(qA);if(!r)return null;let i=r.manager.tooltips.indexOf(n);return i<0?null:r.manager.tooltipViews[i]}const Qbe=Zt.define(),nL=jt.define({combine(e){let n,r;for(let i of e)n=n||i.topContainer,r=r||i.bottomContainer;return{topContainer:n,bottomContainer:r}}});function UA(e,n){let r=e.plugin(ZH),i=r?r.specs.indexOf(n):-1;return i>-1?r.panels[i]:null}const ZH=Cr.fromClass(class{constructor(e){this.input=e.state.facet(Lg),this.specs=this.input.filter(r=>r),this.panels=this.specs.map(r=>r(e));let n=e.state.facet(nL);this.top=new w_(e,!0,n.topContainer),this.bottom=new w_(e,!1,n.bottomContainer),this.top.sync(this.panels.filter(r=>r.top)),this.bottom.sync(this.panels.filter(r=>!r.top));for(let r of this.panels)r.dom.classList.add("cm-panel"),r.mount&&r.mount()}update(e){let n=e.state.facet(nL);this.top.container!=n.topContainer&&(this.top.sync([]),this.top=new w_(e.view,!0,n.topContainer)),this.bottom.container!=n.bottomContainer&&(this.bottom.sync([]),this.bottom=new w_(e.view,!1,n.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let r=e.state.facet(Lg);if(r!=this.input){let i=r.filter(u=>u),s=[],a=[],o=[],l=[];for(let u of i){let d=this.specs.indexOf(u),p;d<0?(p=u(e.view),l.push(p)):(p=this.panels[d],p.update&&p.update(e)),s.push(p),(p.top?a:o).push(p)}this.specs=i,this.panels=s,this.top.sync(a),this.bottom.sync(o);for(let u of l)u.dom.classList.add("cm-panel"),u.mount&&u.mount()}else for(let i of this.panels)i.update&&i.update(e)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:e=>St.scrollMargins.of(n=>{let r=n.plugin(e);return r&&{top:r.top.scrollMargin(),bottom:r.bottom.scrollMargin()}})});class w_{constructor(n,r,i){this.view=n,this.top=r,this.container=i,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(n){for(let r of this.panels)r.destroy&&n.indexOf(r)<0&&r.destroy();this.panels=n,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let r=this.container||this.view.dom;r.insertBefore(this.dom,this.top?r.firstChild:null)}let n=this.dom.firstChild;for(let r of this.panels)if(r.dom.parentNode==this.dom){for(;n!=r.dom;)n=rL(n);n=n.nextSibling}else this.dom.insertBefore(r.dom,n);for(;n;)n=rL(n)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(!(!this.container||this.classes==this.view.themeClasses)){for(let n of this.classes.split(" "))n&&this.container.classList.remove(n);for(let n of(this.classes=this.view.themeClasses).split(" "))n&&this.container.classList.add(n)}}}function rL(e){let n=e.nextSibling;return e.remove(),n}const Lg=jt.define({enables:ZH});function Zbe(e,n){let r,i=new Promise(o=>r=o),s=o=>Jbe(o,n,r);e.state.field(NS,!1)?e.dispatch({effects:JH.of(s)}):e.dispatch({effects:Zt.appendConfig.of(NS.init(()=>[s]))});let a=eW.of(s);return{close:a,result:i.then(o=>((e.win.queueMicrotask||(u=>e.win.setTimeout(u,10)))(()=>{e.state.field(NS).indexOf(s)>-1&&e.dispatch({effects:a})}),o))}}const NS=vi.define({create(){return[]},update(e,n){for(let r of n.effects)r.is(JH)?e=[r.value].concat(e):r.is(eW)&&(e=e.filter(i=>i!=r.value));return e},provide:e=>Lg.computeN([e],n=>n.field(e))}),JH=Zt.define(),eW=Zt.define();function Jbe(e,n,r){let i=n.content?n.content(e,()=>o(null)):null;if(!i){if(i=Vn("form"),n.input){let l=Vn("input",n.input);/^(text|password|number|email|tel|url)$/.test(l.type)&&l.classList.add("cm-textfield"),l.name||(l.name="input"),i.appendChild(Vn("label",(n.label||"")+": ",l))}else i.appendChild(document.createTextNode(n.label||""));i.appendChild(document.createTextNode(" ")),i.appendChild(Vn("button",{class:"cm-button",type:"submit"},n.submitLabel||"OK"))}let s=i.nodeName=="FORM"?[i]:i.querySelectorAll("form");for(let l=0;l<s.length;l++){let u=s[l];u.addEventListener("keydown",d=>{d.keyCode==27?(d.preventDefault(),o(null)):d.keyCode==13&&(d.preventDefault(),o(u))}),u.addEventListener("submit",d=>{d.preventDefault(),o(u)})}let a=Vn("div",i,Vn("button",{onclick:()=>o(null),"aria-label":e.state.phrase("close"),class:"cm-dialog-close",type:"button"},["×"]));n.class&&(a.className=n.class),a.classList.add("cm-dialog");function o(l){a.contains(a.ownerDocument.activeElement)&&e.focus(),r(l)}return{dom:a,top:n.top,mount:()=>{if(n.focus){let l;typeof n.focus=="string"?l=i.querySelector(n.focus):l=i.querySelector("input")||i.querySelector("button"),l&&"select"in l?l.select():l&&"focus"in l&&l.focus()}}}}class Xo extends su{compare(n){return this==n||this.constructor==n.constructor&&this.eq(n)}eq(n){return!1}destroy(n){}}Xo.prototype.elementClass="";Xo.prototype.toDOM=void 0;Xo.prototype.mapMode=Zi.TrackBefore;Xo.prototype.startSide=Xo.prototype.endSide=-1;Xo.prototype.point=!0;const xx=jt.define(),e0e=jt.define(),t0e={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>on.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},ig=jt.define();function tW(e){return[nW(),ig.of({...t0e,...e})]}const iL=jt.define({combine:e=>e.some(n=>n)});function nW(e){return[n0e]}const n0e=Cr.fromClass(class{constructor(e){this.view=e,this.domAfter=null,this.prevViewport=e.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters cm-gutters-before",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=e.state.facet(ig).map(n=>new aL(e,n)),this.fixed=!e.state.facet(iL);for(let n of this.gutters)n.config.side=="after"?this.getDOMAfter().appendChild(n.dom):this.dom.appendChild(n.dom);this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),e.scrollDOM.insertBefore(this.dom,e.contentDOM)}getDOMAfter(){return this.domAfter||(this.domAfter=document.createElement("div"),this.domAfter.className="cm-gutters cm-gutters-after",this.domAfter.setAttribute("aria-hidden","true"),this.domAfter.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.domAfter.style.position=this.fixed?"sticky":"",this.view.scrollDOM.appendChild(this.domAfter)),this.domAfter}update(e){if(this.updateGutters(e)){let n=this.prevViewport,r=e.view.viewport,i=Math.min(n.to,r.to)-Math.max(n.from,r.from);this.syncGutters(i<(r.to-r.from)*.8)}if(e.geometryChanged){let n=this.view.contentHeight/this.view.scaleY+"px";this.dom.style.minHeight=n,this.domAfter&&(this.domAfter.style.minHeight=n)}this.view.state.facet(iL)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=e.view.viewport}syncGutters(e){let n=this.dom.nextSibling;e&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let r=on.iter(this.view.state.facet(xx),this.view.viewport.from),i=[],s=this.gutters.map(a=>new r0e(a,this.view.viewport,-this.view.documentPadding.top));for(let a of this.view.viewportLineBlocks)if(i.length&&(i=[]),Array.isArray(a.type)){let o=!0;for(let l of a.type)if(l.type==Ai.Text&&o){iN(r,i,l.from);for(let u of s)u.line(this.view,l,i);o=!1}else if(l.widget)for(let u of s)u.widget(this.view,l)}else if(a.type==Ai.Text){iN(r,i,a.from);for(let o of s)o.line(this.view,a,i)}else if(a.widget)for(let o of s)o.widget(this.view,a);for(let a of s)a.finish();e&&(this.view.scrollDOM.insertBefore(this.dom,n),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(e){let n=e.startState.facet(ig),r=e.state.facet(ig),i=e.docChanged||e.heightChanged||e.viewportChanged||!on.eq(e.startState.facet(xx),e.state.facet(xx),e.view.viewport.from,e.view.viewport.to);if(n==r)for(let s of this.gutters)s.update(e)&&(i=!0);else{i=!0;let s=[];for(let a of r){let o=n.indexOf(a);o<0?s.push(new aL(this.view,a)):(this.gutters[o].update(e),s.push(this.gutters[o]))}for(let a of this.gutters)a.dom.remove(),s.indexOf(a)<0&&a.destroy();for(let a of s)a.config.side=="after"?this.getDOMAfter().appendChild(a.dom):this.dom.appendChild(a.dom);this.gutters=s}return i}destroy(){for(let e of this.gutters)e.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:e=>St.scrollMargins.of(n=>{let r=n.plugin(e);if(!r||r.gutters.length==0||!r.fixed)return null;let i=r.dom.offsetWidth*n.scaleX,s=r.domAfter?r.domAfter.offsetWidth*n.scaleX:0;return n.textDirection==Jn.LTR?{left:i,right:s}:{right:i,left:s}})});function sL(e){return Array.isArray(e)?e:[e]}function iN(e,n,r){for(;e.value&&e.from<=r;)e.from==r&&n.push(e.value),e.next()}class r0e{constructor(n,r,i){this.gutter=n,this.height=i,this.i=0,this.cursor=on.iter(n.markers,r.from)}addElement(n,r,i){let{gutter:s}=this,a=(r.top-this.height)/n.scaleY,o=r.height/n.scaleY;if(this.i==s.elements.length){let l=new rW(n,o,a,i);s.elements.push(l),s.dom.appendChild(l.dom)}else s.elements[this.i].update(n,o,a,i);this.height=r.bottom,this.i++}line(n,r,i){let s=[];iN(this.cursor,s,r.from),i.length&&(s=s.concat(i));let a=this.gutter.config.lineMarker(n,r,s);a&&s.unshift(a);let o=this.gutter;s.length==0&&!o.config.renderEmptyElements||this.addElement(n,r,s)}widget(n,r){let i=this.gutter.config.widgetMarker(n,r.widget,r),s=i?[i]:null;for(let a of n.state.facet(e0e)){let o=a(n,r.widget,r);o&&(s||(s=[])).push(o)}s&&this.addElement(n,r,s)}finish(){let n=this.gutter;for(;n.elements.length>this.i;){let r=n.elements.pop();n.dom.removeChild(r.dom),r.destroy()}}}class aL{constructor(n,r){this.view=n,this.config=r,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let i in r.domEventHandlers)this.dom.addEventListener(i,s=>{let a=s.target,o;if(a!=this.dom&&this.dom.contains(a)){for(;a.parentNode!=this.dom;)a=a.parentNode;let u=a.getBoundingClientRect();o=(u.top+u.bottom)/2}else o=s.clientY;let l=n.lineBlockAtHeight(o-n.documentTop);r.domEventHandlers[i](n,l,s)&&s.preventDefault()});this.markers=sL(r.markers(n)),r.initialSpacer&&(this.spacer=new rW(n,0,0,[r.initialSpacer(n)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(n){let r=this.markers;if(this.markers=sL(this.config.markers(n.view)),this.spacer&&this.config.updateSpacer){let s=this.config.updateSpacer(this.spacer.markers[0],n);s!=this.spacer.markers[0]&&this.spacer.update(n.view,0,0,[s])}let i=n.view.viewport;return!on.eq(this.markers,r,i.from,i.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(n):!1)}destroy(){for(let n of this.elements)n.destroy()}}class rW{constructor(n,r,i,s){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(n,r,i,s)}update(n,r,i,s){this.height!=r&&(this.height=r,this.dom.style.height=r+"px"),this.above!=i&&(this.dom.style.marginTop=(this.above=i)?i+"px":""),i0e(this.markers,s)||this.setMarkers(n,s)}setMarkers(n,r){let i="cm-gutterElement",s=this.dom.firstChild;for(let a=0,o=0;;){let l=o,u=a<r.length?r[a++]:null,d=!1;if(u){let p=u.elementClass;p&&(i+=" "+p);for(let f=o;f<this.markers.length;f++)if(this.markers[f].compare(u)){l=f,d=!0;break}}else l=this.markers.length;for(;o<l;){let p=this.markers[o++];if(p.toDOM){p.destroy(s);let f=s.nextSibling;s.remove(),s=f}}if(!u)break;u.toDOM&&(d?s=s.nextSibling:this.dom.insertBefore(u.toDOM(n),s)),d&&o++}this.dom.className=i,this.markers=r}destroy(){this.setMarkers(null,[])}}function i0e(e,n){if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].compare(n[r]))return!1;return!0}const s0e=jt.define(),a0e=jt.define(),Zh=jt.define({combine(e){return ro(e,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(n,r){let i=Object.assign({},n);for(let s in r){let a=i[s],o=r[s];i[s]=a?(l,u,d)=>a(l,u,d)||o(l,u,d):o}return i}})}});class ES extends Xo{constructor(n){super(),this.number=n}eq(n){return this.number==n.number}toDOM(){return document.createTextNode(this.number)}}function AS(e,n){return e.state.facet(Zh).formatNumber(n,e.state)}const o0e=ig.compute([Zh],e=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(n){return n.state.facet(s0e)},lineMarker(n,r,i){return i.some(s=>s.toDOM)?null:new ES(AS(n,n.state.doc.lineAt(r.from).number))},widgetMarker:(n,r,i)=>{for(let s of n.state.facet(a0e)){let a=s(n,r,i);if(a)return a}return null},lineMarkerChange:n=>n.startState.facet(Zh)!=n.state.facet(Zh),initialSpacer(n){return new ES(AS(n,oL(n.state.doc.lines)))},updateSpacer(n,r){let i=AS(r.view,oL(r.view.state.doc.lines));return i==n.number?n:new ES(i)},domEventHandlers:e.facet(Zh).domEventHandlers,side:"before"}));function l0e(e={}){return[Zh.of(e),nW(),o0e]}function oL(e){let n=9;for(;n<e;)n=n*10+9;return n}const c0e=new class extends Xo{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},u0e=xx.compute(["selection"],e=>{let n=[],r=-1;for(let i of e.selection.ranges){let s=e.doc.lineAt(i.head).from;s>r&&(r=s,n.push(c0e.range(s)))}return on.of(n)});function d0e(){return u0e}const iW=1024;let h0e=0;class TS{constructor(n,r){this.from=n,this.to=r}}class hn{constructor(n={}){this.id=h0e++,this.perNode=!!n.perNode,this.deserialize=n.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=n.combine||null}add(n){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof n!="function"&&(n=As.match(n)),r=>{let i=n(r);return i===void 0?null:[this,i]}}}hn.closedBy=new hn({deserialize:e=>e.split(" ")});hn.openedBy=new hn({deserialize:e=>e.split(" ")});hn.group=new hn({deserialize:e=>e.split(" ")});hn.isolate=new hn({deserialize:e=>{if(e&&e!="rtl"&&e!="ltr"&&e!="auto")throw new RangeError("Invalid value for isolate: "+e);return e||"auto"}});hn.contextHash=new hn({perNode:!0});hn.lookAhead=new hn({perNode:!0});hn.mounted=new hn({perNode:!0});class sg{constructor(n,r,i,s=!1){this.tree=n,this.overlay=r,this.parser=i,this.bracketed=s}static get(n){return n&&n.props&&n.props[hn.mounted.id]}}const f0e=Object.create(null);class As{constructor(n,r,i,s=0){this.name=n,this.props=r,this.id=i,this.flags=s}static define(n){let r=n.props&&n.props.length?Object.create(null):f0e,i=(n.top?1:0)|(n.skipped?2:0)|(n.error?4:0)|(n.name==null?8:0),s=new As(n.name||"",r,n.id,i);if(n.props){for(let a of n.props)if(Array.isArray(a)||(a=a(s)),a){if(a[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");r[a[0].id]=a[1]}}return s}prop(n){return this.props[n.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(n){if(typeof n=="string"){if(this.name==n)return!0;let r=this.prop(hn.group);return r?r.indexOf(n)>-1:!1}return this.id==n}static match(n){let r=Object.create(null);for(let i in n)for(let s of i.split(" "))r[s]=n[i];return i=>{for(let s=i.prop(hn.group),a=-1;a<(s?s.length:0);a++){let o=r[a<0?i.name:s[a]];if(o)return o}}}}As.none=new As("",Object.create(null),0,8);class VA{constructor(n){this.types=n;for(let r=0;r<n.length;r++)if(n[r].id!=r)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...n){let r=[];for(let i of this.types){let s=null;for(let a of n){let o=a(i);if(o){s||(s=Object.assign({},i.props));let l=o[1],u=o[0];u.combine&&u.id in s&&(l=u.combine(s[u.id],l)),s[u.id]=l}}r.push(s?new As(i.name,s,i.id,i.flags):i)}return new VA(r)}}const S_=new WeakMap,lL=new WeakMap;var Mr;(function(e){e[e.ExcludeBuffers=1]="ExcludeBuffers",e[e.IncludeAnonymous=2]="IncludeAnonymous",e[e.IgnoreMounts=4]="IgnoreMounts",e[e.IgnoreOverlays=8]="IgnoreOverlays",e[e.EnterBracketed=16]="EnterBracketed"})(Mr||(Mr={}));class zr{constructor(n,r,i,s,a){if(this.type=n,this.children=r,this.positions=i,this.length=s,this.props=null,a&&a.length){this.props=Object.create(null);for(let[o,l]of a)this.props[typeof o=="number"?o:o.id]=l}}toString(){let n=sg.get(this);if(n&&!n.overlay)return n.tree.toString();let r="";for(let i of this.children){let s=i.toString();s&&(r&&(r+=","),r+=s)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(r.length?"("+r+")":""):r}cursor(n=0){return new aN(this.topNode,n)}cursorAt(n,r=0,i=0){let s=S_.get(this)||this.topNode,a=new aN(s);return a.moveTo(n,r),S_.set(this,a._tree),a}get topNode(){return new Na(this,0,0,null)}resolve(n,r=0){let i=Ig(S_.get(this)||this.topNode,n,r,!1);return S_.set(this,i),i}resolveInner(n,r=0){let i=Ig(lL.get(this)||this.topNode,n,r,!0);return lL.set(this,i),i}resolveStack(n,r=0){return g0e(this,n,r)}iterate(n){let{enter:r,leave:i,from:s=0,to:a=this.length}=n,o=n.mode||0,l=(o&Mr.IncludeAnonymous)>0;for(let u=this.cursor(o|Mr.IncludeAnonymous);;){let d=!1;if(u.from<=a&&u.to>=s&&(!l&&u.type.isAnonymous||r(u)!==!1)){if(u.firstChild())continue;d=!0}for(;d&&i&&(l||!u.type.isAnonymous)&&i(u),!u.nextSibling();){if(!u.parent())return;d=!0}}}prop(n){return n.perNode?this.props?this.props[n.id]:void 0:this.type.prop(n)}get propValues(){let n=[];if(this.props)for(let r in this.props)n.push([+r,this.props[r]]);return n}balance(n={}){return this.children.length<=8?this:GA(As.none,this.children,this.positions,0,this.children.length,0,this.length,(r,i,s)=>new zr(this.type,r,i,s,this.propValues),n.makeTree||((r,i,s)=>new zr(As.none,r,i,s)))}static build(n){return v0e(n)}}zr.empty=new zr(As.none,[],[],0);class KA{constructor(n,r){this.buffer=n,this.index=r}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new KA(this.buffer,this.index)}}class cu{constructor(n,r,i){this.buffer=n,this.length=r,this.set=i}get type(){return As.none}toString(){let n=[];for(let r=0;r<this.buffer.length;)n.push(this.childString(r)),r=this.buffer[r+3];return n.join(",")}childString(n){let r=this.buffer[n],i=this.buffer[n+3],s=this.set.types[r],a=s.name;if(/\W/.test(a)&&!s.isError&&(a=JSON.stringify(a)),n+=4,i==n)return a;let o=[];for(;n<i;)o.push(this.childString(n)),n=this.buffer[n+3];return a+"("+o.join(",")+")"}findChild(n,r,i,s,a){let{buffer:o}=this,l=-1;for(let u=n;u!=r&&!(sW(a,s,o[u+1],o[u+2])&&(l=u,i>0));u=o[u+3]);return l}slice(n,r,i){let s=this.buffer,a=new Uint16Array(r-n),o=0;for(let l=n,u=0;l<r;){a[u++]=s[l++],a[u++]=s[l++]-i;let d=a[u++]=s[l++]-i;a[u++]=s[l++]-n,o=Math.max(o,d)}return new cu(a,o,this.set)}}function sW(e,n,r,i){switch(e){case-2:return r<n;case-1:return i>=n&&r<n;case 0:return r<n&&i>n;case 1:return r<=n&&i>n;case 2:return i>n;case 4:return!0}}function Ig(e,n,r,i){for(var s;e.from==e.to||(r<1?e.from>=n:e.from>n)||(r>-1?e.to<=n:e.to<n);){let o=!i&&e instanceof Na&&e.index<0?null:e.parent;if(!o)return e;e=o}let a=i?0:Mr.IgnoreOverlays;if(i)for(let o=e,l=o.parent;l;o=l,l=o.parent)o instanceof Na&&o.index<0&&((s=l.enter(n,r,a))===null||s===void 0?void 0:s.from)!=o.from&&(e=l);for(;;){let o=e.enter(n,r,a);if(!o)return e;e=o}}class aW{cursor(n=0){return new aN(this,n)}getChild(n,r=null,i=null){let s=cL(this,n,r,i);return s.length?s[0]:null}getChildren(n,r=null,i=null){return cL(this,n,r,i)}resolve(n,r=0){return Ig(this,n,r,!1)}resolveInner(n,r=0){return Ig(this,n,r,!0)}matchContext(n){return sN(this.parent,n)}enterUnfinishedNodesBefore(n){let r=this.childBefore(n),i=this;for(;r;){let s=r.lastChild;if(!s||s.to!=r.to)break;s.type.isError&&s.from==s.to?(i=r,r=s.prevSibling):r=s}return i}get node(){return this}get next(){return this.parent}}class Na extends aW{constructor(n,r,i,s){super(),this._tree=n,this.from=r,this.index=i,this._parent=s}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(n,r,i,s,a=0){for(let o=this;;){for(let{children:l,positions:u}=o._tree,d=r>0?l.length:-1;n!=d;n+=r){let p=l[n],f=u[n]+o.from,g;if(!(!(a&Mr.EnterBracketed&&p instanceof zr&&(g=sg.get(p))&&!g.overlay&&g.bracketed&&i>=f&&i<=f+p.length)&&!sW(s,i,f,f+p.length))){if(p instanceof cu){if(a&Mr.ExcludeBuffers)continue;let _=p.findChild(0,p.buffer.length,r,i-f,s);if(_>-1)return new Yc(new p0e(o,p,n,f),null,_)}else if(a&Mr.IncludeAnonymous||!p.type.isAnonymous||YA(p)){let _;if(!(a&Mr.IgnoreMounts)&&(_=sg.get(p))&&!_.overlay)return new Na(_.tree,f,n,o);let x=new Na(p,f,n,o);return a&Mr.IncludeAnonymous||!x.type.isAnonymous?x:x.nextChild(r<0?p.children.length-1:0,r,i,s,a)}}}if(a&Mr.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?n=o.index+r:n=r<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(n){return this.nextChild(0,1,n,2)}childBefore(n){return this.nextChild(this._tree.children.length-1,-1,n,-2)}prop(n){return this._tree.prop(n)}enter(n,r,i=0){let s;if(!(i&Mr.IgnoreOverlays)&&(s=sg.get(this._tree))&&s.overlay){let a=n-this.from,o=i&Mr.EnterBracketed&&s.bracketed;for(let{from:l,to:u}of s.overlay)if((r>0||o?l<=a:l<a)&&(r<0||o?u>=a:u>a))return new Na(s.tree,s.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,n,r,i)}nextSignificantParent(){let n=this;for(;n.type.isAnonymous&&n._parent;)n=n._parent;return n}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function cL(e,n,r,i){let s=e.cursor(),a=[];if(!s.firstChild())return a;if(r!=null){for(let o=!1;!o;)if(o=s.type.is(r),!s.nextSibling())return a}for(;;){if(i!=null&&s.type.is(i))return a;if(s.type.is(n)&&a.push(s.node),!s.nextSibling())return i==null?a:[]}}function sN(e,n,r=n.length-1){for(let i=e;r>=0;i=i.parent){if(!i)return!1;if(!i.type.isAnonymous){if(n[r]&&n[r]!=i.name)return!1;r--}}return!0}class p0e{constructor(n,r,i,s){this.parent=n,this.buffer=r,this.index=i,this.start=s}}class Yc extends aW{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(n,r,i){super(),this.context=n,this._parent=r,this.index=i,this.type=n.buffer.set.types[n.buffer.buffer[i]]}child(n,r,i){let{buffer:s}=this.context,a=s.findChild(this.index+4,s.buffer[this.index+3],n,r-this.context.start,i);return a<0?null:new Yc(this.context,this,a)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(n){return this.child(1,n,2)}childBefore(n){return this.child(-1,n,-2)}prop(n){return this.type.prop(n)}enter(n,r,i=0){if(i&Mr.ExcludeBuffers)return null;let{buffer:s}=this.context,a=s.findChild(this.index+4,s.buffer[this.index+3],r>0?1:-1,n-this.context.start,r);return a<0?null:new Yc(this.context,this,a)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(n){return this._parent?null:this.context.parent.nextChild(this.context.index+n,n,0,4)}get nextSibling(){let{buffer:n}=this.context,r=n.buffer[this.index+3];return r<(this._parent?n.buffer[this._parent.index+3]:n.buffer.length)?new Yc(this.context,this._parent,r):this.externalSibling(1)}get prevSibling(){let{buffer:n}=this.context,r=this._parent?this._parent.index+4:0;return this.index==r?this.externalSibling(-1):new Yc(this.context,this._parent,n.findChild(r,this.index,-1,0,4))}get tree(){return null}toTree(){let n=[],r=[],{buffer:i}=this.context,s=this.index+4,a=i.buffer[this.index+3];if(a>s){let o=i.buffer[this.index+1];n.push(i.slice(s,a,o)),r.push(0)}return new zr(this.type,n,r,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function oW(e){if(!e.length)return null;let n=0,r=e[0];for(let a=1;a<e.length;a++){let o=e[a];(o.from>r.from||o.to<r.to)&&(r=o,n=a)}let i=r instanceof Na&&r.index<0?null:r.parent,s=e.slice();return i?s[n]=i:s.splice(n,1),new m0e(s,r)}class m0e{constructor(n,r){this.heads=n,this.node=r}get next(){return oW(this.heads)}}function g0e(e,n,r){let i=e.resolveInner(n,r),s=null;for(let a=i instanceof Na?i:i.context.parent;a;a=a.parent)if(a.index<0){let o=a.parent;(s||(s=[i])).push(o.resolve(n,r)),a=o}else{let o=sg.get(a.tree);if(o&&o.overlay&&o.overlay[0].from<=n&&o.overlay[o.overlay.length-1].to>=n){let l=new Na(o.tree,o.overlay[0].from+a.from,-1,a);(s||(s=[i])).push(Ig(l,n,r,!1))}}return s?oW(s):i}class aN{get name(){return this.type.name}constructor(n,r=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=r&~Mr.EnterBracketed,n instanceof Na)this.yieldNode(n);else{this._tree=n.context.parent,this.buffer=n.context;for(let i=n._parent;i;i=i._parent)this.stack.unshift(i.index);this.bufferNode=n,this.yieldBuf(n.index)}}yieldNode(n){return n?(this._tree=n,this.type=n.type,this.from=n.from,this.to=n.to,!0):!1}yieldBuf(n,r){this.index=n;let{start:i,buffer:s}=this.buffer;return this.type=r||s.set.types[s.buffer[n]],this.from=i+s.buffer[n+1],this.to=i+s.buffer[n+2],!0}yield(n){return n?n instanceof Na?(this.buffer=null,this.yieldNode(n)):(this.buffer=n.context,this.yieldBuf(n.index,n.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(n,r,i){if(!this.buffer)return this.yield(this._tree.nextChild(n<0?this._tree._tree.children.length-1:0,n,r,i,this.mode));let{buffer:s}=this.buffer,a=s.findChild(this.index+4,s.buffer[this.index+3],n,r-this.buffer.start,i);return a<0?!1:(this.stack.push(this.index),this.yieldBuf(a))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(n){return this.enterChild(1,n,2)}childBefore(n){return this.enterChild(-1,n,-2)}enter(n,r,i=this.mode){return this.buffer?i&Mr.ExcludeBuffers?!1:this.enterChild(1,n,r):this.yield(this._tree.enter(n,r,i))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Mr.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let n=this.mode&Mr.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(n)}sibling(n){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+n,n,0,4,this.mode)):!1;let{buffer:r}=this.buffer,i=this.stack.length-1;if(n<0){let s=i<0?0:this.stack[i]+4;if(this.index!=s)return this.yieldBuf(r.findChild(s,this.index,-1,0,4))}else{let s=r.buffer[this.index+3];if(s<(i<0?r.buffer.length:r.buffer[this.stack[i]+3]))return this.yieldBuf(s)}return i<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+n,n,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(n){let r,i,{buffer:s}=this;if(s){if(n>0){if(this.index<s.buffer.buffer.length)return!1}else for(let a=0;a<this.index;a++)if(s.buffer.buffer[a+3]<this.index)return!1;({index:r,parent:i}=s)}else({index:r,_parent:i}=this._tree);for(;i;{index:r,_parent:i}=i)if(r>-1)for(let a=r+n,o=n<0?-1:i._tree.children.length;a!=o;a+=n){let l=i._tree.children[a];if(this.mode&Mr.IncludeAnonymous||l instanceof cu||!l.type.isAnonymous||YA(l))return!1}return!0}move(n,r){if(r&&this.enterChild(n,0,4))return!0;for(;;){if(this.sibling(n))return!0;if(this.atLastNode(n)||!this.parent())return!1}}next(n=!0){return this.move(1,n)}prev(n=!0){return this.move(-1,n)}moveTo(n,r=0){for(;(this.from==this.to||(r<1?this.from>=n:this.from>n)||(r>-1?this.to<=n:this.to<n))&&this.parent(););for(;this.enterChild(1,n,r););return this}get node(){if(!this.buffer)return this._tree;let n=this.bufferNode,r=null,i=0;if(n&&n.context==this.buffer)e:for(let s=this.index,a=this.stack.length;a>=0;){for(let o=n;o;o=o._parent)if(o.index==s){if(s==this.index)return o;r=o,i=a+1;break e}s=this.stack[--a]}for(let s=i;s<this.stack.length;s++)r=new Yc(this.buffer,r,this.stack[s]);return this.bufferNode=new Yc(this.buffer,r,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(n,r){for(let i=0;;){let s=!1;if(this.type.isAnonymous||n(this)!==!1){if(this.firstChild()){i++;continue}this.type.isAnonymous||(s=!0)}for(;;){if(s&&r&&r(this),s=this.type.isAnonymous,!i)return;if(this.nextSibling())break;this.parent(),i--,s=!0}}}matchContext(n){if(!this.buffer)return sN(this.node.parent,n);let{buffer:r}=this.buffer,{types:i}=r.set;for(let s=n.length-1,a=this.stack.length-1;s>=0;a--){if(a<0)return sN(this._tree,n,s);let o=i[r.buffer[this.stack[a]]];if(!o.isAnonymous){if(n[s]&&n[s]!=o.name)return!1;s--}}return!0}}function YA(e){return e.children.some(n=>n instanceof cu||!n.type.isAnonymous||YA(n))}function v0e(e){var n;let{buffer:r,nodeSet:i,maxBufferLength:s=iW,reused:a=[],minRepeatType:o=i.types.length}=e,l=Array.isArray(r)?new KA(r,r.length):r,u=i.types,d=0,p=0;function f(A,E,D,F,B,H){let{id:$,start:z,end:W,size:P}=l,q=p,I=d;if(P<0)if(l.next(),P==-1){let R=a[$];D.push(R),F.push(z-A);return}else if(P==-3){d=$;return}else if(P==-4){p=$;return}else throw new RangeError(`Unrecognized record size: ${P}`);let Q=u[$],K,Z,Y=z-A;if(W-z<=s&&(Z=S(l.pos-E,B))){let R=new Uint16Array(Z.size-Z.skip),U=l.pos-Z.size,V=R.length;for(;l.pos>U;)V=w(Z.start,R,V);K=new cu(R,W-Z.start,i),Y=Z.start-A}else{let R=l.pos-P;l.next();let U=[],V=[],ie=$>=o?$:-1,te=0,X=W;for(;l.pos>R;)ie>=0&&l.id==ie&&l.size>=0?(l.end<=X-s&&(x(U,V,z,te,l.end,X,ie,q,I),te=U.length,X=l.end),l.next()):H>2500?g(z,R,U,V):f(z,R,U,V,ie,H+1);if(ie>=0&&te>0&&te<U.length&&x(U,V,z,te,z,X,ie,q,I),U.reverse(),V.reverse(),ie>-1&&te>0){let se=_(Q,I);K=GA(Q,U,V,0,U.length,0,W-z,se,se)}else K=v(Q,U,V,W-z,q-W,I)}D.push(K),F.push(Y)}function g(A,E,D,F){let B=[],H=0,$=-1;for(;l.pos>E;){let{id:z,start:W,end:P,size:q}=l;if(q>4)l.next();else{if($>-1&&W<$)break;$<0&&($=P-s),B.push(z,W,P),H++,l.next()}}if(H){let z=new Uint16Array(H*4),W=B[B.length-2];for(let P=B.length-3,q=0;P>=0;P-=3)z[q++]=B[P],z[q++]=B[P+1]-W,z[q++]=B[P+2]-W,z[q++]=q;D.push(new cu(z,B[2]-W,i)),F.push(W-A)}}function _(A,E){return(D,F,B)=>{let H=0,$=D.length-1,z,W;if($>=0&&(z=D[$])instanceof zr){if(!$&&z.type==A&&z.length==B)return z;(W=z.prop(hn.lookAhead))&&(H=F[$]+z.length+W)}return v(A,D,F,B,H,E)}}function x(A,E,D,F,B,H,$,z,W){let P=[],q=[];for(;A.length>F;)P.push(A.pop()),q.push(E.pop()+D-B);A.push(v(i.types[$],P,q,H-B,z-H,W)),E.push(B-D)}function v(A,E,D,F,B,H,$){if(H){let z=[hn.contextHash,H];$=$?[z].concat($):[z]}if(B>25){let z=[hn.lookAhead,B];$=$?[z].concat($):[z]}return new zr(A,E,D,F,$)}function S(A,E){let D=l.fork(),F=0,B=0,H=0,$=D.end-s,z={size:0,start:0,skip:0};e:for(let W=D.pos-A;D.pos>W;){let P=D.size;if(D.id==E&&P>=0){z.size=F,z.start=B,z.skip=H,H+=4,F+=4,D.next();continue}let q=D.pos-P;if(P<0||q<W||D.start<$)break;let I=D.id>=o?4:0,Q=D.start;for(D.next();D.pos>q;){if(D.size<0)if(D.size==-3||D.size==-4)I+=4;else break e;else D.id>=o&&(I+=4);D.next()}B=Q,F+=P,H+=I}return(E<0||F==A)&&(z.size=F,z.start=B,z.skip=H),z.size>4?z:void 0}function w(A,E,D){let{id:F,start:B,end:H,size:$}=l;if(l.next(),$>=0&&F<o){let z=D;if($>4){let W=l.pos-($-4);for(;l.pos>W;)D=w(A,E,D)}E[--D]=z,E[--D]=H-A,E[--D]=B-A,E[--D]=F}else $==-3?d=F:$==-4&&(p=F);return D}let N=[],C=[];for(;l.pos>0;)f(e.start||0,e.bufferStart||0,N,C,-1,0);let T=(n=e.length)!==null&&n!==void 0?n:N.length?C[0]+N[0].length:0;return new zr(u[e.topID],N.reverse(),C.reverse(),T)}const uL=new WeakMap;function bx(e,n){if(!e.isAnonymous||n instanceof cu||n.type!=e)return 1;let r=uL.get(n);if(r==null){r=1;for(let i of n.children){if(i.type!=e||!(i instanceof zr)){r=1;break}r+=bx(e,i)}uL.set(n,r)}return r}function GA(e,n,r,i,s,a,o,l,u){let d=0;for(let x=i;x<s;x++)d+=bx(e,n[x]);let p=Math.ceil(d*1.5/8),f=[],g=[];function _(x,v,S,w,N){for(let C=S;C<w;){let T=C,A=v[C],E=bx(e,x[C]);for(C++;C<w;C++){let D=bx(e,x[C]);if(E+D>=p)break;E+=D}if(C==T+1){if(E>p){let D=x[T];_(D.children,D.positions,0,D.children.length,v[T]+N);continue}f.push(x[T])}else{let D=v[C-1]+x[C-1].length-A;f.push(GA(e,x,v,T,C,A,D,null,u))}g.push(A+N-a)}}return _(n,r,i,s,0),(l||u)(f,g,o)}class vd{constructor(n,r,i,s,a=!1,o=!1){this.from=n,this.to=r,this.tree=i,this.offset=s,this.open=(a?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(n,r=[],i=!1){let s=[new vd(0,n.length,n,0,!1,i)];for(let a of r)a.to>n.length&&s.push(a);return s}static applyChanges(n,r,i=128){if(!r.length)return n;let s=[],a=1,o=n.length?n[0]:null;for(let l=0,u=0,d=0;;l++){let p=l<r.length?r[l]:null,f=p?p.fromA:1e9;if(f-u>=i)for(;o&&o.from<f;){let g=o;if(u>=g.from||f<=g.to||d){let _=Math.max(g.from,u)-d,x=Math.min(g.to,f)-d;g=_>=x?null:new vd(_,x,g.tree,g.offset+d,l>0,!!p)}if(g&&s.push(g),o.to>f)break;o=a<n.length?n[a++]:null}if(!p)break;u=p.toA,d=p.toA-p.toB}return s}}class lW{startParse(n,r,i){return typeof n=="string"&&(n=new y0e(n)),i=i?i.length?i.map(s=>new TS(s.from,s.to)):[new TS(0,0)]:[new TS(0,n.length)],this.createParse(n,r||[],i)}parse(n,r,i){let s=this.startParse(n,r,i);for(;;){let a=s.advance();if(a)return a}}}class y0e{constructor(n){this.string=n}get length(){return this.string.length}chunk(n){return this.string.slice(n)}get lineChunks(){return!1}read(n,r){return this.string.slice(n,r)}}new hn({perNode:!0});let _0e=0,Al=class oN{constructor(n,r,i,s){this.name=n,this.set=r,this.base=i,this.modified=s,this.id=_0e++}toString(){let{name:n}=this;for(let r of this.modified)r.name&&(n=`${r.name}(${n})`);return n}static define(n,r){let i=typeof n=="string"?n:"?";if(n instanceof oN&&(r=n),r!=null&&r.base)throw new Error("Can not derive from a modified tag");let s=new oN(i,[],null,[]);if(s.set.push(s),r)for(let a of r.set)s.set.push(a);return s}static defineModifier(n){let r=new xb(n);return i=>i.modified.indexOf(r)>-1?i:xb.get(i.base||i,i.modified.concat(r).sort((s,a)=>s.id-a.id))}},x0e=0;class xb{constructor(n){this.name=n,this.instances=[],this.id=x0e++}static get(n,r){if(!r.length)return n;let i=r[0].instances.find(l=>l.base==n&&b0e(r,l.modified));if(i)return i;let s=[],a=new Al(n.name,s,n,r);for(let l of r)l.instances.push(a);let o=k0e(r);for(let l of n.set)if(!l.modified.length)for(let u of o)s.push(xb.get(l,u));return a}}function b0e(e,n){return e.length==n.length&&e.every((r,i)=>r==n[i])}function k0e(e){let n=[[]];for(let r=0;r<e.length;r++)for(let i=0,s=n.length;i<s;i++)n.push(n[i].concat(e[r]));return n.sort((r,i)=>i.length-r.length)}function cW(e){let n=Object.create(null);for(let r in e){let i=e[r];Array.isArray(i)||(i=[i]);for(let s of r.split(" "))if(s){let a=[],o=2,l=s;for(let f=0;;){if(l=="..."&&f>0&&f+3==s.length){o=1;break}let g=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(l);if(!g)throw new RangeError("Invalid path: "+s);if(a.push(g[0]=="*"?"":g[0][0]=='"'?JSON.parse(g[0]):g[0]),f+=g[0].length,f==s.length)break;let _=s[f++];if(f==s.length&&_=="!"){o=0;break}if(_!="/")throw new RangeError("Invalid path: "+s);l=s.slice(f)}let u=a.length-1,d=a[u];if(!d)throw new RangeError("Invalid path: "+s);let p=new Bg(i,o,u>0?a.slice(0,u):null);n[d]=p.sort(n[d])}}return uW.add(n)}const uW=new hn({combine(e,n){let r,i,s;for(;e||n;){if(!e||n&&e.depth>=n.depth?(s=n,n=n.next):(s=e,e=e.next),r&&r.mode==s.mode&&!s.context&&!r.context)continue;let a=new Bg(s.tags,s.mode,s.context);r?r.next=a:i=a,r=a}return i}});class Bg{constructor(n,r,i,s){this.tags=n,this.mode=r,this.context=i,this.next=s}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(n){return!n||n.depth<this.depth?(this.next=n,this):(n.next=this.sort(n.next),n)}get depth(){return this.context?this.context.length:0}}Bg.empty=new Bg([],2,null);function dW(e,n){let r=Object.create(null);for(let a of e)if(!Array.isArray(a.tag))r[a.tag.id]=a.class;else for(let o of a.tag)r[o.id]=a.class;let{scope:i,all:s=null}=n||{};return{style:a=>{let o=s;for(let l of a)for(let u of l.set){let d=r[u.id];if(d){o=o?o+" "+d:d;break}}return o},scope:i}}function w0e(e,n){let r=null;for(let i of e){let s=i.style(n);s&&(r=r?r+" "+s:s)}return r}function S0e(e,n,r,i=0,s=e.length){let a=new C0e(i,Array.isArray(n)?n:[n],r);a.highlightRange(e.cursor(),i,s,"",a.highlighters),a.flush(s)}class C0e{constructor(n,r,i){this.at=n,this.highlighters=r,this.span=i,this.class=""}startSpan(n,r){r!=this.class&&(this.flush(n),n>this.at&&(this.at=n),this.class=r)}flush(n){n>this.at&&this.class&&this.span(this.at,n,this.class)}highlightRange(n,r,i,s,a){let{type:o,from:l,to:u}=n;if(l>=i||u<=r)return;o.isTop&&(a=this.highlighters.filter(_=>!_.scope||_.scope(o)));let d=s,p=j0e(n)||Bg.empty,f=w0e(a,p.tags);if(f&&(d&&(d+=" "),d+=f,p.mode==1&&(s+=(s?" ":"")+f)),this.startSpan(Math.max(r,l),d),p.opaque)return;let g=n.tree&&n.tree.prop(hn.mounted);if(g&&g.overlay){let _=n.node.enter(g.overlay[0].from+l,1),x=this.highlighters.filter(S=>!S.scope||S.scope(g.tree.type)),v=n.firstChild();for(let S=0,w=l;;S++){let N=S<g.overlay.length?g.overlay[S]:null,C=N?N.from+l:u,T=Math.max(r,w),A=Math.min(i,C);if(T<A&&v)for(;n.from<A&&(this.highlightRange(n,T,A,s,a),this.startSpan(Math.min(A,n.to),d),!(n.to>=C||!n.nextSibling())););if(!N||C>i)break;w=N.to+l,w>r&&(this.highlightRange(_.cursor(),Math.max(r,N.from+l),Math.min(i,w),"",x),this.startSpan(Math.min(i,w),d))}v&&n.parent()}else if(n.firstChild()){g&&(s="");do if(!(n.to<=r)){if(n.from>=i)break;this.highlightRange(n,r,i,s,a),this.startSpan(Math.min(i,n.to),d)}while(n.nextSibling());n.parent()}}}function j0e(e){let n=e.type.prop(uW);for(;n&&n.context&&!e.matchContext(n.context);)n=n.next;return n||null}const wt=Al.define,C_=wt(),Bc=wt(),dL=wt(Bc),hL=wt(Bc),zc=wt(),j_=wt(zc),MS=wt(zc),No=wt(),Fu=wt(No),ko=wt(),wo=wt(),lN=wt(),am=wt(lN),N_=wt(),We={comment:C_,lineComment:wt(C_),blockComment:wt(C_),docComment:wt(C_),name:Bc,variableName:wt(Bc),typeName:dL,tagName:wt(dL),propertyName:hL,attributeName:wt(hL),className:wt(Bc),labelName:wt(Bc),namespace:wt(Bc),macroName:wt(Bc),literal:zc,string:j_,docString:wt(j_),character:wt(j_),attributeValue:wt(j_),number:MS,integer:wt(MS),float:wt(MS),bool:wt(zc),regexp:wt(zc),escape:wt(zc),color:wt(zc),url:wt(zc),keyword:ko,self:wt(ko),null:wt(ko),atom:wt(ko),unit:wt(ko),modifier:wt(ko),operatorKeyword:wt(ko),controlKeyword:wt(ko),definitionKeyword:wt(ko),moduleKeyword:wt(ko),operator:wo,derefOperator:wt(wo),arithmeticOperator:wt(wo),logicOperator:wt(wo),bitwiseOperator:wt(wo),compareOperator:wt(wo),updateOperator:wt(wo),definitionOperator:wt(wo),typeOperator:wt(wo),controlOperator:wt(wo),punctuation:lN,separator:wt(lN),bracket:am,angleBracket:wt(am),squareBracket:wt(am),paren:wt(am),brace:wt(am),content:No,heading:Fu,heading1:wt(Fu),heading2:wt(Fu),heading3:wt(Fu),heading4:wt(Fu),heading5:wt(Fu),heading6:wt(Fu),contentSeparator:wt(No),list:wt(No),quote:wt(No),emphasis:wt(No),strong:wt(No),link:wt(No),monospace:wt(No),strikethrough:wt(No),inserted:wt(),deleted:wt(),changed:wt(),invalid:wt(),meta:N_,documentMeta:wt(N_),annotation:wt(N_),processingInstruction:wt(N_),definition:Al.defineModifier("definition"),constant:Al.defineModifier("constant"),function:Al.defineModifier("function"),standard:Al.defineModifier("standard"),local:Al.defineModifier("local"),special:Al.defineModifier("special")};for(let e in We){let n=We[e];n instanceof Al&&(n.name=e)}dW([{tag:We.link,class:"tok-link"},{tag:We.heading,class:"tok-heading"},{tag:We.emphasis,class:"tok-emphasis"},{tag:We.strong,class:"tok-strong"},{tag:We.keyword,class:"tok-keyword"},{tag:We.atom,class:"tok-atom"},{tag:We.bool,class:"tok-bool"},{tag:We.url,class:"tok-url"},{tag:We.labelName,class:"tok-labelName"},{tag:We.inserted,class:"tok-inserted"},{tag:We.deleted,class:"tok-deleted"},{tag:We.literal,class:"tok-literal"},{tag:We.string,class:"tok-string"},{tag:We.number,class:"tok-number"},{tag:[We.regexp,We.escape,We.special(We.string)],class:"tok-string2"},{tag:We.variableName,class:"tok-variableName"},{tag:We.local(We.variableName),class:"tok-variableName tok-local"},{tag:We.definition(We.variableName),class:"tok-variableName tok-definition"},{tag:We.special(We.variableName),class:"tok-variableName2"},{tag:We.definition(We.propertyName),class:"tok-propertyName tok-definition"},{tag:We.typeName,class:"tok-typeName"},{tag:We.namespace,class:"tok-namespace"},{tag:We.className,class:"tok-className"},{tag:We.macroName,class:"tok-macroName"},{tag:We.propertyName,class:"tok-propertyName"},{tag:We.operator,class:"tok-operator"},{tag:We.comment,class:"tok-comment"},{tag:We.meta,class:"tok-meta"},{tag:We.invalid,class:"tok-invalid"},{tag:We.punctuation,class:"tok-punctuation"}]);var RS;const Jh=new hn;function N0e(e){return jt.define({combine:e?n=>n.concat(e):void 0})}const E0e=new hn;class Ya{constructor(n,r,i=[],s=""){this.data=n,this.name=s,bn.prototype.hasOwnProperty("tree")||Object.defineProperty(bn.prototype,"tree",{get(){return qi(this)}}),this.parser=r,this.extension=[uu.of(this),bn.languageData.of((a,o,l)=>{let u=fL(a,o,l),d=u.type.prop(Jh);if(!d)return[];let p=a.facet(d),f=u.type.prop(E0e);if(f){let g=u.resolve(o-u.from,l);for(let _ of f)if(_.test(g,a)){let x=a.facet(_.facet);return _.type=="replace"?x:x.concat(p)}}return p})].concat(i)}isActiveAt(n,r,i=-1){return fL(n,r,i).type.prop(Jh)==this.data}findRegions(n){let r=n.facet(uu);if((r==null?void 0:r.data)==this.data)return[{from:0,to:n.doc.length}];if(!r||!r.allowsNesting)return[];let i=[],s=(a,o)=>{if(a.prop(Jh)==this.data){i.push({from:o,to:o+a.length});return}let l=a.prop(hn.mounted);if(l){if(l.tree.prop(Jh)==this.data){if(l.overlay)for(let u of l.overlay)i.push({from:u.from+o,to:u.to+o});else i.push({from:o,to:o+a.length});return}else if(l.overlay){let u=i.length;if(s(l.tree,l.overlay[0].from+o),i.length>u)return}}for(let u=0;u<a.children.length;u++){let d=a.children[u];d instanceof zr&&s(d,a.positions[u]+o)}};return s(qi(n),0),i}get allowsNesting(){return!0}}Ya.setState=Zt.define();function fL(e,n,r){let i=e.facet(uu),s=qi(e).topNode;if(!i||i.allowsNesting)for(let a=s;a;a=a.enter(n,r,Mr.ExcludeBuffers|Mr.EnterBracketed))a.type.isTop&&(s=a);return s}class bb extends Ya{constructor(n,r,i){super(n,r,[],i),this.parser=r}static define(n){let r=N0e(n.languageData);return new bb(r,n.parser.configure({props:[Jh.add(i=>i.isTop?r:void 0)]}),n.name)}configure(n,r){return new bb(this.data,this.parser.configure(n),r||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function qi(e){let n=e.field(Ya.state,!1);return n?n.tree:zr.empty}class A0e{constructor(n){this.doc=n,this.cursorPos=0,this.string="",this.cursor=n.iter()}get length(){return this.doc.length}syncTo(n){return this.string=this.cursor.next(n-this.cursorPos).value,this.cursorPos=n+this.string.length,this.cursorPos-this.string.length}chunk(n){return this.syncTo(n),this.string}get lineChunks(){return!0}read(n,r){let i=this.cursorPos-this.string.length;return n<i||r>=this.cursorPos?this.doc.sliceString(n,r):this.string.slice(n-i,r-i)}}let om=null;class kb{constructor(n,r,i=[],s,a,o,l,u){this.parser=n,this.state=r,this.fragments=i,this.tree=s,this.treeLen=a,this.viewport=o,this.skipped=l,this.scheduleOn=u,this.parse=null,this.tempSkipped=[]}static create(n,r,i){return new kb(n,r,[],zr.empty,0,i,[],null)}startParse(){return this.parser.startParse(new A0e(this.state.doc),this.fragments)}work(n,r){return r!=null&&r>=this.state.doc.length&&(r=void 0),this.tree!=zr.empty&&this.isDone(r??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var i;if(typeof n=="number"){let s=Date.now()+n;n=()=>Date.now()>s}for(this.parse||(this.parse=this.startParse()),r!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>r)&&r<this.state.doc.length&&this.parse.stopAt(r);;){let s=this.parse.advance();if(s)if(this.fragments=this.withoutTempSkipped(vd.addTree(s,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(i=this.parse.stoppedAt)!==null&&i!==void 0?i:this.state.doc.length,this.tree=s,this.parse=null,this.treeLen<(r??this.state.doc.length))this.parse=this.startParse();else return!0;if(n())return!1}})}takeTree(){let n,r;this.parse&&(n=this.parse.parsedPos)>=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>n)&&this.parse.stopAt(n),this.withContext(()=>{for(;!(r=this.parse.advance()););}),this.treeLen=n,this.tree=r,this.fragments=this.withoutTempSkipped(vd.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(n){let r=om;om=this;try{return n()}finally{om=r}}withoutTempSkipped(n){for(let r;r=this.tempSkipped.pop();)n=pL(n,r.from,r.to);return n}changes(n,r){let{fragments:i,tree:s,treeLen:a,viewport:o,skipped:l}=this;if(this.takeTree(),!n.empty){let u=[];if(n.iterChangedRanges((d,p,f,g)=>u.push({fromA:d,toA:p,fromB:f,toB:g})),i=vd.applyChanges(i,u),s=zr.empty,a=0,o={from:n.mapPos(o.from,-1),to:n.mapPos(o.to,1)},this.skipped.length){l=[];for(let d of this.skipped){let p=n.mapPos(d.from,1),f=n.mapPos(d.to,-1);p<f&&l.push({from:p,to:f})}}}return new kb(this.parser,r,i,s,a,o,l,this.scheduleOn)}updateViewport(n){if(this.viewport.from==n.from&&this.viewport.to==n.to)return!1;this.viewport=n;let r=this.skipped.length;for(let i=0;i<this.skipped.length;i++){let{from:s,to:a}=this.skipped[i];s<n.to&&a>n.from&&(this.fragments=pL(this.fragments,s,a),this.skipped.splice(i--,1))}return this.skipped.length>=r?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(n,r){this.skipped.push({from:n,to:r})}static getSkippingParser(n){return new class extends lW{createParse(r,i,s){let a=s[0].from,o=s[s.length-1].to;return{parsedPos:a,advance(){let u=om;if(u){for(let d of s)u.tempSkipped.push(d);n&&(u.scheduleOn=u.scheduleOn?Promise.all([u.scheduleOn,n]):n)}return this.parsedPos=o,new zr(As.none,[],[],o-a)},stoppedAt:null,stopAt(){}}}}}isDone(n){n=Math.min(n,this.state.doc.length);let r=this.fragments;return this.treeLen>=n&&r.length&&r[0].from==0&&r[0].to>=n}static get(){return om}}function pL(e,n,r){return vd.applyChanges(e,[{fromA:n,toA:r,fromB:n,toB:r}])}class Bf{constructor(n){this.context=n,this.tree=n.tree}apply(n){if(!n.docChanged&&this.tree==this.context.tree)return this;let r=this.context.changes(n.changes,n.state),i=this.context.treeLen==n.startState.doc.length?void 0:Math.max(n.changes.mapPos(this.context.treeLen),r.viewport.to);return r.work(20,i)||r.takeTree(),new Bf(r)}static init(n){let r=Math.min(3e3,n.doc.length),i=kb.create(n.facet(uu).parser,n,{from:0,to:r});return i.work(20,r)||i.takeTree(),new Bf(i)}}Ya.state=vi.define({create:Bf.init,update(e,n){for(let r of n.effects)if(r.is(Ya.setState))return r.value;return n.startState.facet(uu)!=n.state.facet(uu)?Bf.init(n.state):e.apply(n)}});let hW=e=>{let n=setTimeout(()=>e(),500);return()=>clearTimeout(n)};typeof requestIdleCallback<"u"&&(hW=e=>{let n=-1,r=setTimeout(()=>{n=requestIdleCallback(e,{timeout:400})},100);return()=>n<0?clearTimeout(r):cancelIdleCallback(n)});const OS=typeof navigator<"u"&&(!((RS=navigator.scheduling)===null||RS===void 0)&&RS.isInputPending)?()=>navigator.scheduling.isInputPending():null,T0e=Cr.fromClass(class{constructor(n){this.view=n,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(n){let r=this.view.state.field(Ya.state).context;(r.updateViewport(n.view.viewport)||this.view.viewport.to>r.treeLen)&&this.scheduleWork(),(n.docChanged||n.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(r)}scheduleWork(){if(this.working)return;let{state:n}=this.view,r=n.field(Ya.state);(r.tree!=r.context.tree||!r.context.isDone(n.doc.length))&&(this.working=hW(this.work))}work(n){this.working=null;let r=Date.now();if(this.chunkEnd<r&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=r+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:i,viewport:{to:s}}=this.view,a=i.field(Ya.state);if(a.tree==a.context.tree&&a.context.isDone(s+1e5))return;let o=Date.now()+Math.min(this.chunkBudget,100,n&&!OS?Math.max(25,n.timeRemaining()-5):1e9),l=a.context.treeLen<s&&i.doc.length>s+1e3,u=a.context.work(()=>OS&&OS()||Date.now()>o,s+(l?0:1e5));this.chunkBudget-=Date.now()-r,(u||this.chunkBudget<=0)&&(a.context.takeTree(),this.view.dispatch({effects:Ya.setState.of(new Bf(a.context))})),this.chunkBudget>0&&!(u&&!l)&&this.scheduleWork(),this.checkAsyncSchedule(a.context)}checkAsyncSchedule(n){n.scheduleOn&&(this.workScheduled++,n.scheduleOn.then(()=>this.scheduleWork()).catch(r=>es(this.view.state,r)).then(()=>this.workScheduled--),n.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),uu=jt.define({combine(e){return e.length?e[0]:null},enables:e=>[Ya.state,T0e,St.contentAttributes.compute([e],n=>{let r=n.facet(e);return r&&r.name?{"data-language":r.name}:{}})]});class M0e{constructor(n,r=[]){this.language=n,this.support=r,this.extension=[n,r]}}const R0e=jt.define(),$0=jt.define({combine:e=>{if(!e.length)return"  ";let n=e[0];if(!n||/\S/.test(n)||Array.from(n).some(r=>r!=n[0]))throw new Error("Invalid indent unit: "+JSON.stringify(e[0]));return n}});function wb(e){let n=e.facet($0);return n.charCodeAt(0)==9?e.tabSize*n.length:n.length}function zg(e,n){let r="",i=e.tabSize,s=e.facet($0)[0];if(s=="	"){for(;n>=i;)r+="	",n-=i;s=" "}for(let a=0;a<n;a++)r+=s;return r}function XA(e,n){e instanceof bn&&(e=new F0(e));for(let i of e.state.facet(R0e)){let s=i(e,n);if(s!==void 0)return s}let r=qi(e.state);return r.length>=n?O0e(e,r,n):null}class F0{constructor(n,r={}){this.state=n,this.options=r,this.unit=wb(n)}lineAt(n,r=1){let i=this.state.doc.lineAt(n),{simulateBreak:s,simulateDoubleBreak:a}=this.options;return s!=null&&s>=i.from&&s<=i.to?a&&s==n?{text:"",from:n}:(r<0?s<n:s<=n)?{text:i.text.slice(s-i.from),from:s}:{text:i.text.slice(0,s-i.from),from:i.from}:i}textAfterPos(n,r=1){if(this.options.simulateDoubleBreak&&n==this.options.simulateBreak)return"";let{text:i,from:s}=this.lineAt(n,r);return i.slice(n-s,Math.min(i.length,n+100-s))}column(n,r=1){let{text:i,from:s}=this.lineAt(n,r),a=this.countColumn(i,n-s),o=this.options.overrideIndentation?this.options.overrideIndentation(s):-1;return o>-1&&(a+=o-this.countColumn(i,i.search(/\S|$/))),a}countColumn(n,r=n.length){return Zf(n,this.state.tabSize,r)}lineIndent(n,r=1){let{text:i,from:s}=this.lineAt(n,r),a=this.options.overrideIndentation;if(a){let o=a(s);if(o>-1)return o}return this.countColumn(i,i.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const fW=new hn;function O0e(e,n,r){let i=n.resolveStack(r),s=n.resolveInner(r,-1).resolve(r,0).enterUnfinishedNodesBefore(r);if(s!=i.node){let a=[];for(let o=s;o&&!(o.from<i.node.from||o.to>i.node.to||o.from==i.node.from&&o.type==i.node.type);o=o.parent)a.push(o);for(let o=a.length-1;o>=0;o--)i={node:a[o],next:i}}return pW(i,e,r)}function pW(e,n,r){for(let i=e;i;i=i.next){let s=P0e(i.node);if(s)return s(QA.create(n,r,i))}return 0}function D0e(e){return e.pos==e.options.simulateBreak&&e.options.simulateDoubleBreak}function P0e(e){let n=e.type.prop(fW);if(n)return n;let r=e.firstChild,i;if(r&&(i=r.type.prop(hn.closedBy))){let s=e.lastChild,a=s&&i.indexOf(s.name)>-1;return o=>mW(o,!0,1,void 0,a&&!D0e(o)?s.from:void 0)}return e.parent==null?L0e:null}function L0e(){return 0}class QA extends F0{constructor(n,r,i){super(n.state,n.options),this.base=n,this.pos=r,this.context=i}get node(){return this.context.node}static create(n,r,i){return new QA(n,r,i)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(n){let r=this.state.doc.lineAt(n.from);for(;;){let i=n.resolve(r.from);for(;i.parent&&i.parent.from==i.from;)i=i.parent;if(I0e(i,n))break;r=this.state.doc.lineAt(i.from)}return this.lineIndent(r.from)}continue(){return pW(this.context.next,this.base,this.pos)}}function I0e(e,n){for(let r=n;r;r=r.parent)if(e==r)return!0;return!1}function B0e(e){let n=e.node,r=n.childAfter(n.from),i=n.lastChild;if(!r)return null;let s=e.options.simulateBreak,a=e.state.doc.lineAt(r.from),o=s==null||s<=a.from?a.to:Math.min(a.to,s);for(let l=r.to;;){let u=n.childAfter(l);if(!u||u==i)return null;if(!u.type.isSkipped){if(u.from>=o)return null;let d=/^ */.exec(a.text.slice(r.to-a.from))[0].length;return{from:r.from,to:r.to+d}}l=u.to}}function mL({closing:e,align:n=!0,units:r=1}){return i=>mW(i,n,r,e)}function mW(e,n,r,i,s){let a=e.textAfter,o=a.match(/^\s*/)[0].length,l=i&&a.slice(o,o+i.length)==i||s==e.pos+o,u=n?B0e(e):null;return u?l?e.column(u.from):e.column(u.to):e.baseIndent+(l?0:e.unit*r)}const z0e=200;function $0e(){return bn.transactionFilter.of(e=>{if(!e.docChanged||!e.isUserEvent("input.type")&&!e.isUserEvent("input.complete"))return e;let n=e.startState.languageDataAt("indentOnInput",e.startState.selection.main.head);if(!n.length)return e;let r=e.newDoc,{head:i}=e.newSelection.main,s=r.lineAt(i);if(i>s.from+z0e)return e;let a=r.sliceString(s.from,i);if(!n.some(d=>d.test(a)))return e;let{state:o}=e,l=-1,u=[];for(let{head:d}of o.selection.ranges){let p=o.doc.lineAt(d);if(p.from==l)continue;l=p.from;let f=XA(o,p.from);if(f==null)continue;let g=/^\s*/.exec(p.text)[0],_=zg(o,f);g!=_&&u.push({from:p.from,to:p.from+g.length,insert:_})}return u.length?[e,{changes:u,sequential:!0}]:e})}const F0e=jt.define(),gW=new hn;function H0e(e){let n=e.firstChild,r=e.lastChild;return n&&n.to<r.from?{from:n.to,to:r.type.isError?e.to:r.from}:null}function W0e(e,n,r){let i=qi(e);if(i.length<r)return null;let s=i.resolveStack(r,1),a=null;for(let o=s;o;o=o.next){let l=o.node;if(l.to<=r||l.from>r)continue;if(a&&l.from<n)break;let u=l.type.prop(gW);if(u&&(l.to<i.length-50||i.length==e.doc.length||!q0e(l))){let d=u(l,e);d&&d.from<=r&&d.from>=n&&d.to>r&&(a=d)}}return a}function q0e(e){let n=e.lastChild;return n&&n.to==e.to&&n.type.isError}function Sb(e,n,r){for(let i of e.facet(F0e)){let s=i(e,n,r);if(s)return s}return W0e(e,n,r)}function vW(e,n){let r=n.mapPos(e.from,1),i=n.mapPos(e.to,-1);return r>=i?void 0:{from:r,to:i}}const H0=Zt.define({map:vW}),Ev=Zt.define({map:vW});function yW(e){let n=[];for(let{head:r}of e.state.selection.ranges)n.some(i=>i.from<=r&&i.to>=r)||n.push(e.lineBlockAt(r));return n}const Md=vi.define({create(){return Wt.none},update(e,n){n.isUserEvent("delete")&&n.changes.iterChangedRanges((r,i)=>e=gL(e,r,i)),e=e.map(n.changes);for(let r of n.effects)if(r.is(H0)&&!U0e(e,r.value.from,r.value.to)){let{preparePlaceholder:i}=n.state.facet(bW),s=i?Wt.replace({widget:new Z0e(i(n.state,r.value))}):vL;e=e.update({add:[s.range(r.value.from,r.value.to)]})}else r.is(Ev)&&(e=e.update({filter:(i,s)=>r.value.from!=i||r.value.to!=s,filterFrom:r.value.from,filterTo:r.value.to}));return n.selection&&(e=gL(e,n.selection.main.head)),e},provide:e=>St.decorations.from(e),toJSON(e,n){let r=[];return e.between(0,n.doc.length,(i,s)=>{r.push(i,s)}),r},fromJSON(e){if(!Array.isArray(e)||e.length%2)throw new RangeError("Invalid JSON for fold state");let n=[];for(let r=0;r<e.length;){let i=e[r++],s=e[r++];if(typeof i!="number"||typeof s!="number")throw new RangeError("Invalid JSON for fold state");n.push(vL.range(i,s))}return Wt.set(n,!0)}});function gL(e,n,r=n){let i=!1;return e.between(n,r,(s,a)=>{s<r&&a>n&&(i=!0)}),i?e.update({filterFrom:n,filterTo:r,filter:(s,a)=>s>=r||a<=n}):e}function Cb(e,n,r){var i;let s=null;return(i=e.field(Md,!1))===null||i===void 0||i.between(n,r,(a,o)=>{(!s||s.from>a)&&(s={from:a,to:o})}),s}function U0e(e,n,r){let i=!1;return e.between(n,n,(s,a)=>{s==n&&a==r&&(i=!0)}),i}function _W(e,n){return e.field(Md,!1)?n:n.concat(Zt.appendConfig.of(kW()))}const V0e=e=>{for(let n of yW(e)){let r=Sb(e.state,n.from,n.to);if(r)return e.dispatch({effects:_W(e.state,[H0.of(r),xW(e,r)])}),!0}return!1},K0e=e=>{if(!e.state.field(Md,!1))return!1;let n=[];for(let r of yW(e)){let i=Cb(e.state,r.from,r.to);i&&n.push(Ev.of(i),xW(e,i,!1))}return n.length&&e.dispatch({effects:n}),n.length>0};function xW(e,n,r=!0){let i=e.state.doc.lineAt(n.from).number,s=e.state.doc.lineAt(n.to).number;return St.announce.of(`${e.state.phrase(r?"Folded lines":"Unfolded lines")} ${i} ${e.state.phrase("to")} ${s}.`)}const Y0e=e=>{let{state:n}=e,r=[];for(let i=0;i<n.doc.length;){let s=e.lineBlockAt(i),a=Sb(n,s.from,s.to);a&&r.push(H0.of(a)),i=(a?e.lineBlockAt(a.to):s).to+1}return r.length&&e.dispatch({effects:_W(e.state,r)}),!!r.length},G0e=e=>{let n=e.state.field(Md,!1);if(!n||!n.size)return!1;let r=[];return n.between(0,e.state.doc.length,(i,s)=>{r.push(Ev.of({from:i,to:s}))}),e.dispatch({effects:r}),!0},X0e=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:V0e},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:K0e},{key:"Ctrl-Alt-[",run:Y0e},{key:"Ctrl-Alt-]",run:G0e}],Q0e={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},bW=jt.define({combine(e){return ro(e,Q0e)}});function kW(e){return[Md,tke]}function wW(e,n){let{state:r}=e,i=r.facet(bW),s=o=>{let l=e.lineBlockAt(e.posAtDOM(o.target)),u=Cb(e.state,l.from,l.to);u&&e.dispatch({effects:Ev.of(u)}),o.preventDefault()};if(i.placeholderDOM)return i.placeholderDOM(e,s,n);let a=document.createElement("span");return a.textContent=i.placeholderText,a.setAttribute("aria-label",r.phrase("folded code")),a.title=r.phrase("unfold"),a.className="cm-foldPlaceholder",a.onclick=s,a}const vL=Wt.replace({widget:new class extends nl{toDOM(e){return wW(e,null)}}});class Z0e extends nl{constructor(n){super(),this.value=n}eq(n){return this.value==n.value}toDOM(n){return wW(n,this.value)}}const J0e={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class DS extends Xo{constructor(n,r){super(),this.config=n,this.open=r}eq(n){return this.config==n.config&&this.open==n.open}toDOM(n){if(this.config.markerDOM)return this.config.markerDOM(this.open);let r=document.createElement("span");return r.textContent=this.open?this.config.openText:this.config.closedText,r.title=n.state.phrase(this.open?"Fold line":"Unfold line"),r}}function eke(e={}){let n={...J0e,...e},r=new DS(n,!0),i=new DS(n,!1),s=Cr.fromClass(class{constructor(o){this.from=o.viewport.from,this.markers=this.buildMarkers(o)}update(o){(o.docChanged||o.viewportChanged||o.startState.facet(uu)!=o.state.facet(uu)||o.startState.field(Md,!1)!=o.state.field(Md,!1)||qi(o.startState)!=qi(o.state)||n.foldingChanged(o))&&(this.markers=this.buildMarkers(o.view))}buildMarkers(o){let l=new Kl;for(let u of o.viewportLineBlocks){let d=Cb(o.state,u.from,u.to)?i:Sb(o.state,u.from,u.to)?r:null;d&&l.add(u.from,u.from,d)}return l.finish()}}),{domEventHandlers:a}=n;return[s,tW({class:"cm-foldGutter",markers(o){var l;return((l=o.plugin(s))===null||l===void 0?void 0:l.markers)||on.empty},initialSpacer(){return new DS(n,!1)},domEventHandlers:{...a,click:(o,l,u)=>{if(a.click&&a.click(o,l,u))return!0;let d=Cb(o.state,l.from,l.to);if(d)return o.dispatch({effects:Ev.of(d)}),!0;let p=Sb(o.state,l.from,l.to);return p?(o.dispatch({effects:H0.of(p)}),!0):!1}}}),kW()]}const tke=St.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class Av{constructor(n,r){this.specs=n;let i;function s(l){let u=au.newName();return(i||(i=Object.create(null)))["."+u]=l,u}const a=typeof r.all=="string"?r.all:r.all?s(r.all):void 0,o=r.scope;this.scope=o instanceof Ya?l=>l.prop(Jh)==o.data:o?l=>l==o:void 0,this.style=dW(n.map(l=>({tag:l.tag,class:l.class||s(Object.assign({},l,{tag:null}))})),{all:a}).style,this.module=i?new au(i):null,this.themeType=r.themeType}static define(n,r){return new Av(n,r||{})}}const cN=jt.define(),SW=jt.define({combine(e){return e.length?[e[0]]:null}});function PS(e){let n=e.facet(cN);return n.length?n:e.facet(SW)}function CW(e,n){let r=[rke],i;return e instanceof Av&&(e.module&&r.push(St.styleModule.of(e.module)),i=e.themeType),n!=null&&n.fallback?r.push(SW.of(e)):i?r.push(cN.computeN([St.darkTheme],s=>s.facet(St.darkTheme)==(i=="dark")?[e]:[])):r.push(cN.of(e)),r}class nke{constructor(n){this.markCache=Object.create(null),this.tree=qi(n.state),this.decorations=this.buildDeco(n,PS(n.state)),this.decoratedTo=n.viewport.to}update(n){let r=qi(n.state),i=PS(n.state),s=i!=PS(n.startState),{viewport:a}=n.view,o=n.changes.mapPos(this.decoratedTo,1);r.length<a.to&&!s&&r.type==this.tree.type&&o>=a.to?(this.decorations=this.decorations.map(n.changes),this.decoratedTo=o):(r!=this.tree||n.viewportChanged||s)&&(this.tree=r,this.decorations=this.buildDeco(n.view,i),this.decoratedTo=a.to)}buildDeco(n,r){if(!r||!this.tree.length)return Wt.none;let i=new Kl;for(let{from:s,to:a}of n.visibleRanges)S0e(this.tree,r,(o,l,u)=>{i.add(o,l,this.markCache[u]||(this.markCache[u]=Wt.mark({class:u})))},s,a);return i.finish()}}const rke=Ld.high(Cr.fromClass(nke,{decorations:e=>e.decorations})),ike=Av.define([{tag:We.meta,color:"#404740"},{tag:We.link,textDecoration:"underline"},{tag:We.heading,textDecoration:"underline",fontWeight:"bold"},{tag:We.emphasis,fontStyle:"italic"},{tag:We.strong,fontWeight:"bold"},{tag:We.strikethrough,textDecoration:"line-through"},{tag:We.keyword,color:"#708"},{tag:[We.atom,We.bool,We.url,We.contentSeparator,We.labelName],color:"#219"},{tag:[We.literal,We.inserted],color:"#164"},{tag:[We.string,We.deleted],color:"#a11"},{tag:[We.regexp,We.escape,We.special(We.string)],color:"#e40"},{tag:We.definition(We.variableName),color:"#00f"},{tag:We.local(We.variableName),color:"#30a"},{tag:[We.typeName,We.namespace],color:"#085"},{tag:We.className,color:"#167"},{tag:[We.special(We.variableName),We.macroName],color:"#256"},{tag:We.definition(We.propertyName),color:"#00c"},{tag:We.comment,color:"#940"},{tag:We.invalid,color:"#f00"}]),ske=St.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),jW=1e4,NW="()[]{}",EW=jt.define({combine(e){return ro(e,{afterCursor:!0,brackets:NW,maxScanDistance:jW,renderMatch:lke})}}),ake=Wt.mark({class:"cm-matchingBracket"}),oke=Wt.mark({class:"cm-nonmatchingBracket"});function lke(e){let n=[],r=e.matched?ake:oke;return n.push(r.range(e.start.from,e.start.to)),e.end&&n.push(r.range(e.end.from,e.end.to)),n}function yL(e){let n=[],r=e.facet(EW);for(let i of e.selection.ranges){if(!i.empty)continue;let s=$o(e,i.head,-1,r)||i.head>0&&$o(e,i.head-1,1,r)||r.afterCursor&&($o(e,i.head,1,r)||i.head<e.doc.length&&$o(e,i.head+1,-1,r));s&&(n=n.concat(r.renderMatch(s,e)))}return Wt.set(n,!0)}const cke=Cr.fromClass(class{constructor(e){this.paused=!1,this.decorations=yL(e.state)}update(e){(e.docChanged||e.selectionSet||this.paused)&&(e.view.composing?(this.decorations=this.decorations.map(e.changes),this.paused=!0):(this.decorations=yL(e.state),this.paused=!1))}},{decorations:e=>e.decorations}),uke=[cke,ske];function dke(e={}){return[EW.of(e),uke]}const hke=new hn;function uN(e,n,r){let i=e.prop(n<0?hn.openedBy:hn.closedBy);if(i)return i;if(e.name.length==1){let s=r.indexOf(e.name);if(s>-1&&s%2==(n<0?1:0))return[r[s+n]]}return null}function dN(e){let n=e.type.prop(hke);return n?n(e.node):e}function $o(e,n,r,i={}){let s=i.maxScanDistance||jW,a=i.brackets||NW,o=qi(e),l=o.resolveInner(n,r);for(let u=l;u;u=u.parent){let d=uN(u.type,r,a);if(d&&u.from<u.to){let p=dN(u);if(p&&(r>0?n>=p.from&&n<p.to:n>p.from&&n<=p.to))return fke(e,n,r,u,p,d,a)}}return pke(e,n,r,o,l.type,s,a)}function fke(e,n,r,i,s,a,o){let l=i.parent,u={from:s.from,to:s.to},d=0,p=l==null?void 0:l.cursor();if(p&&(r<0?p.childBefore(i.from):p.childAfter(i.to)))do if(r<0?p.to<=i.from:p.from>=i.to){if(d==0&&a.indexOf(p.type.name)>-1&&p.from<p.to){let f=dN(p);return{start:u,end:f?{from:f.from,to:f.to}:void 0,matched:!0}}else if(uN(p.type,r,o))d++;else if(uN(p.type,-r,o)){if(d==0){let f=dN(p);return{start:u,end:f&&f.from<f.to?{from:f.from,to:f.to}:void 0,matched:!1}}d--}}while(r<0?p.prevSibling():p.nextSibling());return{start:u,matched:!1}}function pke(e,n,r,i,s,a,o){if(r<0?!n:n==e.doc.length)return null;let l=r<0?e.sliceDoc(n-1,n):e.sliceDoc(n,n+1),u=o.indexOf(l);if(u<0||u%2==0!=r>0)return null;let d={from:r<0?n-1:n,to:r>0?n+1:n},p=e.doc.iterRange(n,r>0?e.doc.length:0),f=0;for(let g=0;!p.next().done&&g<=a;){let _=p.value;r<0&&(g+=_.length);let x=n+g*r;for(let v=r>0?0:_.length-1,S=r>0?_.length:-1;v!=S;v+=r){let w=o.indexOf(_[v]);if(!(w<0||i.resolveInner(x+v,1).type!=s))if(w%2==0==r>0)f++;else{if(f==1)return{start:d,end:{from:x+v,to:x+v+1},matched:w>>1==u>>1};f--}}r>0&&(g+=_.length)}return p.done?{start:d,matched:!1}:null}const mke=Object.create(null),_L=[As.none],xL=[],bL=Object.create(null),gke=Object.create(null);for(let[e,n]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])gke[e]=vke(mke,n);function LS(e,n){xL.indexOf(e)>-1||(xL.push(e),console.warn(n))}function vke(e,n){let r=[];for(let l of n.split(" ")){let u=[];for(let d of l.split(".")){let p=e[d]||We[d];p?typeof p=="function"?u.length?u=u.map(p):LS(d,`Modifier ${d} used at start of tag`):u.length?LS(d,`Tag ${d} used as modifier`):u=Array.isArray(p)?p:[p]:LS(d,`Unknown highlighting tag ${d}`)}for(let d of u)r.push(d)}if(!r.length)return 0;let i=n.replace(/ /g,"_"),s=i+" "+r.map(l=>l.id),a=bL[s];if(a)return a.id;let o=bL[s]=As.define({id:_L.length,name:i,props:[cW({[i]:r})]});return _L.push(o),o.id}Jn.RTL,Jn.LTR;const yke=e=>{let{state:n}=e,r=n.doc.lineAt(n.selection.main.from),i=JA(e.state,r.from);return i.line?_ke(e):i.block?bke(e):!1};function ZA(e,n){return({state:r,dispatch:i})=>{if(r.readOnly)return!1;let s=e(n,r);return s?(i(r.update(s)),!0):!1}}const _ke=ZA(Ske,0),xke=ZA(AW,0),bke=ZA((e,n)=>AW(e,n,wke(n)),0);function JA(e,n){let r=e.languageDataAt("commentTokens",n,1);return r.length?r[0]:{}}const lm=50;function kke(e,{open:n,close:r},i,s){let a=e.sliceDoc(i-lm,i),o=e.sliceDoc(s,s+lm),l=/\s*$/.exec(a)[0].length,u=/^\s*/.exec(o)[0].length,d=a.length-l;if(a.slice(d-n.length,d)==n&&o.slice(u,u+r.length)==r)return{open:{pos:i-l,margin:l&&1},close:{pos:s+u,margin:u&&1}};let p,f;s-i<=2*lm?p=f=e.sliceDoc(i,s):(p=e.sliceDoc(i,i+lm),f=e.sliceDoc(s-lm,s));let g=/^\s*/.exec(p)[0].length,_=/\s*$/.exec(f)[0].length,x=f.length-_-r.length;return p.slice(g,g+n.length)==n&&f.slice(x,x+r.length)==r?{open:{pos:i+g+n.length,margin:/\s/.test(p.charAt(g+n.length))?1:0},close:{pos:s-_-r.length,margin:/\s/.test(f.charAt(x-1))?1:0}}:null}function wke(e){let n=[];for(let r of e.selection.ranges){let i=e.doc.lineAt(r.from),s=r.to<=i.to?i:e.doc.lineAt(r.to);s.from>i.from&&s.from==r.to&&(s=r.to==i.to+1?i:e.doc.lineAt(r.to-1));let a=n.length-1;a>=0&&n[a].to>i.from?n[a].to=s.to:n.push({from:i.from+/^\s*/.exec(i.text)[0].length,to:s.to})}return n}function AW(e,n,r=n.selection.ranges){let i=r.map(a=>JA(n,a.from).block);if(!i.every(a=>a))return null;let s=r.map((a,o)=>kke(n,i[o],a.from,a.to));if(e!=2&&!s.every(a=>a))return{changes:n.changes(r.map((a,o)=>s[o]?[]:[{from:a.from,insert:i[o].open+" "},{from:a.to,insert:" "+i[o].close}]))};if(e!=1&&s.some(a=>a)){let a=[];for(let o=0,l;o<s.length;o++)if(l=s[o]){let u=i[o],{open:d,close:p}=l;a.push({from:d.pos-u.open.length,to:d.pos+d.margin},{from:p.pos-p.margin,to:p.pos+u.close.length})}return{changes:a}}return null}function Ske(e,n,r=n.selection.ranges){let i=[],s=-1;e:for(let{from:a,to:o}of r){let l=i.length,u=1e9,d;for(let p=a;p<=o;){let f=n.doc.lineAt(p);if(d==null&&(d=JA(n,f.from).line,!d))continue e;if(f.from>s&&(a==o||o>f.from)){s=f.from;let g=/^\s*/.exec(f.text)[0].length,_=g==f.length,x=f.text.slice(g,g+d.length)==d?g:-1;g<f.text.length&&g<u&&(u=g),i.push({line:f,comment:x,token:d,indent:g,empty:_,single:!1})}p=f.to+1}if(u<1e9)for(let p=l;p<i.length;p++)i[p].indent<i[p].line.text.length&&(i[p].indent=u);i.length==l+1&&(i[l].single=!0)}if(e!=2&&i.some(a=>a.comment<0&&(!a.empty||a.single))){let a=[];for(let{line:l,token:u,indent:d,empty:p,single:f}of i)(f||!p)&&a.push({from:l.from+d,insert:u+" "});let o=n.changes(a);return{changes:o,selection:n.selection.map(o,1)}}else if(e!=1&&i.some(a=>a.comment>=0)){let a=[];for(let{line:o,comment:l,token:u}of i)if(l>=0){let d=o.from+l,p=d+u.length;o.text[p-o.from]==" "&&p++,a.push({from:d,to:p})}return{changes:a}}return null}const hN=tl.define(),Cke=tl.define(),jke=jt.define(),TW=jt.define({combine(e){return ro(e,{minDepth:100,newGroupDelay:500,joinToEvent:(n,r)=>r},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(n,r)=>(i,s)=>n(i,s)||r(i,s)})}}),MW=vi.define({create(){return Fo.empty},update(e,n){let r=n.state.facet(TW),i=n.annotation(hN);if(i){let u=Ss.fromTransaction(n,i.selection),d=i.side,p=d==0?e.undone:e.done;return u?p=jb(p,p.length,r.minDepth,u):p=DW(p,n.startState.selection),new Fo(d==0?i.rest:p,d==0?p:i.rest)}let s=n.annotation(Cke);if((s=="full"||s=="before")&&(e=e.isolate()),n.annotation(ri.addToHistory)===!1)return n.changes.empty?e:e.addMapping(n.changes.desc);let a=Ss.fromTransaction(n),o=n.annotation(ri.time),l=n.annotation(ri.userEvent);return a?e=e.addChanges(a,o,l,r,n):n.selection&&(e=e.addSelection(n.startState.selection,o,l,r.newGroupDelay)),(s=="full"||s=="after")&&(e=e.isolate()),e},toJSON(e){return{done:e.done.map(n=>n.toJSON()),undone:e.undone.map(n=>n.toJSON())}},fromJSON(e){return new Fo(e.done.map(Ss.fromJSON),e.undone.map(Ss.fromJSON))}});function Nke(e={}){return[MW,TW.of(e),St.domEventHandlers({beforeinput(n,r){let i=n.inputType=="historyUndo"?RW:n.inputType=="historyRedo"?fN:null;return i?(n.preventDefault(),i(r)):!1}})]}function W0(e,n){return function({state:r,dispatch:i}){if(!n&&r.readOnly)return!1;let s=r.field(MW,!1);if(!s)return!1;let a=s.pop(e,r,n);return a?(i(a),!0):!1}}const RW=W0(0,!1),fN=W0(1,!1),Eke=W0(0,!0),Ake=W0(1,!0);class Ss{constructor(n,r,i,s,a){this.changes=n,this.effects=r,this.mapped=i,this.startSelection=s,this.selectionsAfter=a}setSelAfter(n){return new Ss(this.changes,this.effects,this.mapped,this.startSelection,n)}toJSON(){var n,r,i;return{changes:(n=this.changes)===null||n===void 0?void 0:n.toJSON(),mapped:(r=this.mapped)===null||r===void 0?void 0:r.toJSON(),startSelection:(i=this.startSelection)===null||i===void 0?void 0:i.toJSON(),selectionsAfter:this.selectionsAfter.map(s=>s.toJSON())}}static fromJSON(n){return new Ss(n.changes&&ni.fromJSON(n.changes),[],n.mapped&&Ko.fromJSON(n.mapped),n.startSelection&&Ze.fromJSON(n.startSelection),n.selectionsAfter.map(Ze.fromJSON))}static fromTransaction(n,r){let i=Sa;for(let s of n.startState.facet(jke)){let a=s(n);a.length&&(i=i.concat(a))}return!i.length&&n.changes.empty?null:new Ss(n.changes.invert(n.startState.doc),i,void 0,r||n.startState.selection,Sa)}static selection(n){return new Ss(void 0,Sa,void 0,void 0,n)}}function jb(e,n,r,i){let s=n+1>r+20?n-r-1:0,a=e.slice(s,n);return a.push(i),a}function Tke(e,n){let r=[],i=!1;return e.iterChangedRanges((s,a)=>r.push(s,a)),n.iterChangedRanges((s,a,o,l)=>{for(let u=0;u<r.length;){let d=r[u++],p=r[u++];l>=d&&o<=p&&(i=!0)}}),i}function Mke(e,n){return e.ranges.length==n.ranges.length&&e.ranges.filter((r,i)=>r.empty!=n.ranges[i].empty).length===0}function OW(e,n){return e.length?n.length?e.concat(n):e:n}const Sa=[],Rke=200;function DW(e,n){if(e.length){let r=e[e.length-1],i=r.selectionsAfter.slice(Math.max(0,r.selectionsAfter.length-Rke));return i.length&&i[i.length-1].eq(n)?e:(i.push(n),jb(e,e.length-1,1e9,r.setSelAfter(i)))}else return[Ss.selection([n])]}function Oke(e){let n=e[e.length-1],r=e.slice();return r[e.length-1]=n.setSelAfter(n.selectionsAfter.slice(0,n.selectionsAfter.length-1)),r}function IS(e,n){if(!e.length)return e;let r=e.length,i=Sa;for(;r;){let s=Dke(e[r-1],n,i);if(s.changes&&!s.changes.empty||s.effects.length){let a=e.slice(0,r);return a[r-1]=s,a}else n=s.mapped,r--,i=s.selectionsAfter}return i.length?[Ss.selection(i)]:Sa}function Dke(e,n,r){let i=OW(e.selectionsAfter.length?e.selectionsAfter.map(l=>l.map(n)):Sa,r);if(!e.changes)return Ss.selection(i);let s=e.changes.map(n),a=n.mapDesc(e.changes,!0),o=e.mapped?e.mapped.composeDesc(a):a;return new Ss(s,Zt.mapEffects(e.effects,n),o,e.startSelection.map(a),i)}const Pke=/^(input\.type|delete)($|\.)/;class Fo{constructor(n,r,i=0,s=void 0){this.done=n,this.undone=r,this.prevTime=i,this.prevUserEvent=s}isolate(){return this.prevTime?new Fo(this.done,this.undone):this}addChanges(n,r,i,s,a){let o=this.done,l=o[o.length-1];return l&&l.changes&&!l.changes.empty&&n.changes&&(!i||Pke.test(i))&&(!l.selectionsAfter.length&&r-this.prevTime<s.newGroupDelay&&s.joinToEvent(a,Tke(l.changes,n.changes))||i=="input.type.compose")?o=jb(o,o.length-1,s.minDepth,new Ss(n.changes.compose(l.changes),OW(Zt.mapEffects(n.effects,l.changes),l.effects),l.mapped,l.startSelection,Sa)):o=jb(o,o.length,s.minDepth,n),new Fo(o,Sa,r,i)}addSelection(n,r,i,s){let a=this.done.length?this.done[this.done.length-1].selectionsAfter:Sa;return a.length>0&&r-this.prevTime<s&&i==this.prevUserEvent&&i&&/^select($|\.)/.test(i)&&Mke(a[a.length-1],n)?this:new Fo(DW(this.done,n),this.undone,r,i)}addMapping(n){return new Fo(IS(this.done,n),IS(this.undone,n),this.prevTime,this.prevUserEvent)}pop(n,r,i){let s=n==0?this.done:this.undone;if(s.length==0)return null;let a=s[s.length-1],o=a.selectionsAfter[0]||(a.startSelection?a.startSelection.map(a.changes.invertedDesc,1):r.selection);if(i&&a.selectionsAfter.length)return r.update({selection:a.selectionsAfter[a.selectionsAfter.length-1],annotations:hN.of({side:n,rest:Oke(s),selection:o}),userEvent:n==0?"select.undo":"select.redo",scrollIntoView:!0});if(a.changes){let l=s.length==1?Sa:s.slice(0,s.length-1);return a.mapped&&(l=IS(l,a.mapped)),r.update({changes:a.changes,selection:a.startSelection,effects:a.effects,annotations:hN.of({side:n,rest:l,selection:o}),filter:!1,userEvent:n==0?"undo":"redo",scrollIntoView:!0})}else return null}}Fo.empty=new Fo(Sa,Sa);const Lke=[{key:"Mod-z",run:RW,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:fN,preventDefault:!0},{linux:"Ctrl-Shift-z",run:fN,preventDefault:!0},{key:"Mod-u",run:Eke,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:Ake,preventDefault:!0}];function Jf(e,n){return Ze.create(e.ranges.map(n),e.mainIndex)}function io(e,n){return e.update({selection:n,scrollIntoView:!0,userEvent:"select"})}function so({state:e,dispatch:n},r){let i=Jf(e.selection,r);return i.eq(e.selection,!0)?!1:(n(io(e,i)),!0)}function q0(e,n){return Ze.cursor(n?e.to:e.from)}function PW(e,n){return so(e,r=>r.empty?e.moveByChar(r,n):q0(r,n))}function Vi(e){return e.textDirectionAt(e.state.selection.main.head)==Jn.LTR}const LW=e=>PW(e,!Vi(e)),IW=e=>PW(e,Vi(e));function BW(e,n){return so(e,r=>r.empty?e.moveByGroup(r,n):q0(r,n))}const Ike=e=>BW(e,!Vi(e)),Bke=e=>BW(e,Vi(e));function zke(e,n,r){if(n.type.prop(r))return!0;let i=n.to-n.from;return i&&(i>2||/[^\s,.;:]/.test(e.sliceDoc(n.from,n.to)))||n.firstChild}function U0(e,n,r){let i=qi(e).resolveInner(n.head),s=r?hn.closedBy:hn.openedBy;for(let u=n.head;;){let d=r?i.childAfter(u):i.childBefore(u);if(!d)break;zke(e,d,s)?i=d:u=r?d.to:d.from}let a=i.type.prop(s),o,l;return a&&(o=r?$o(e,i.from,1):$o(e,i.to,-1))&&o.matched?l=r?o.end.to:o.end.from:l=r?i.to:i.from,Ze.cursor(l,r?-1:1)}const $ke=e=>so(e,n=>U0(e.state,n,!Vi(e))),Fke=e=>so(e,n=>U0(e.state,n,Vi(e)));function zW(e,n){return so(e,r=>{if(!r.empty)return q0(r,n);let i=e.moveVertically(r,n);return i.head!=r.head?i:e.moveToLineBoundary(r,n)})}const $W=e=>zW(e,!1),FW=e=>zW(e,!0);function HW(e){let n=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,r=0,i=0,s;if(n){for(let a of e.state.facet(St.scrollMargins)){let o=a(e);o!=null&&o.top&&(r=Math.max(o==null?void 0:o.top,r)),o!=null&&o.bottom&&(i=Math.max(o==null?void 0:o.bottom,i))}s=e.scrollDOM.clientHeight-r-i}else s=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:r,marginBottom:i,selfScroll:n,height:Math.max(e.defaultLineHeight,s-5)}}function WW(e,n){let r=HW(e),{state:i}=e,s=Jf(i.selection,o=>o.empty?e.moveVertically(o,n,r.height):q0(o,n));if(s.eq(i.selection))return!1;let a;if(r.selfScroll){let o=e.coordsAtPos(i.selection.main.head),l=e.scrollDOM.getBoundingClientRect(),u=l.top+r.marginTop,d=l.bottom-r.marginBottom;o&&o.top>u&&o.bottom<d&&(a=St.scrollIntoView(s.main.head,{y:"start",yMargin:o.top-u}))}return e.dispatch(io(i,s),{effects:a}),!0}const kL=e=>WW(e,!1),pN=e=>WW(e,!0);function gu(e,n,r){let i=e.lineBlockAt(n.head),s=e.moveToLineBoundary(n,r);if(s.head==n.head&&s.head!=(r?i.to:i.from)&&(s=e.moveToLineBoundary(n,r,!1)),!r&&s.head==i.from&&i.length){let a=/^\s*/.exec(e.state.sliceDoc(i.from,Math.min(i.from+100,i.to)))[0].length;a&&n.head!=i.from+a&&(s=Ze.cursor(i.from+a))}return s}const Hke=e=>so(e,n=>gu(e,n,!0)),Wke=e=>so(e,n=>gu(e,n,!1)),qke=e=>so(e,n=>gu(e,n,!Vi(e))),Uke=e=>so(e,n=>gu(e,n,Vi(e))),Vke=e=>so(e,n=>Ze.cursor(e.lineBlockAt(n.head).from,1)),Kke=e=>so(e,n=>Ze.cursor(e.lineBlockAt(n.head).to,-1));function Yke(e,n,r){let i=!1,s=Jf(e.selection,a=>{let o=$o(e,a.head,-1)||$o(e,a.head,1)||a.head>0&&$o(e,a.head-1,1)||a.head<e.doc.length&&$o(e,a.head+1,-1);if(!o||!o.end)return a;i=!0;let l=o.start.from==a.head?o.end.to:o.end.from;return Ze.cursor(l)});return i?(n(io(e,s)),!0):!1}const Gke=({state:e,dispatch:n})=>Yke(e,n);function Ma(e,n){let r=Jf(e.state.selection,i=>{let s=n(i);return Ze.range(i.anchor,s.head,s.goalColumn,s.bidiLevel||void 0,s.assoc)});return r.eq(e.state.selection)?!1:(e.dispatch(io(e.state,r)),!0)}function qW(e,n){return Ma(e,r=>e.moveByChar(r,n))}const UW=e=>qW(e,!Vi(e)),VW=e=>qW(e,Vi(e));function KW(e,n){return Ma(e,r=>e.moveByGroup(r,n))}const Xke=e=>KW(e,!Vi(e)),Qke=e=>KW(e,Vi(e)),Zke=e=>Ma(e,n=>U0(e.state,n,!Vi(e))),Jke=e=>Ma(e,n=>U0(e.state,n,Vi(e)));function YW(e,n){return Ma(e,r=>e.moveVertically(r,n))}const GW=e=>YW(e,!1),XW=e=>YW(e,!0);function QW(e,n){return Ma(e,r=>e.moveVertically(r,n,HW(e).height))}const wL=e=>QW(e,!1),SL=e=>QW(e,!0),e1e=e=>Ma(e,n=>gu(e,n,!0)),t1e=e=>Ma(e,n=>gu(e,n,!1)),n1e=e=>Ma(e,n=>gu(e,n,!Vi(e))),r1e=e=>Ma(e,n=>gu(e,n,Vi(e))),i1e=e=>Ma(e,n=>Ze.cursor(e.lineBlockAt(n.head).from)),s1e=e=>Ma(e,n=>Ze.cursor(e.lineBlockAt(n.head).to)),CL=({state:e,dispatch:n})=>(n(io(e,{anchor:0})),!0),jL=({state:e,dispatch:n})=>(n(io(e,{anchor:e.doc.length})),!0),NL=({state:e,dispatch:n})=>(n(io(e,{anchor:e.selection.main.anchor,head:0})),!0),EL=({state:e,dispatch:n})=>(n(io(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),a1e=({state:e,dispatch:n})=>(n(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0),o1e=({state:e,dispatch:n})=>{let r=V0(e).map(({from:i,to:s})=>Ze.range(i,Math.min(s+1,e.doc.length)));return n(e.update({selection:Ze.create(r),userEvent:"select"})),!0},l1e=({state:e,dispatch:n})=>{let r=Jf(e.selection,i=>{let s=qi(e),a=s.resolveStack(i.from,1);if(i.empty){let o=s.resolveStack(i.from,-1);o.node.from>=a.node.from&&o.node.to<=a.node.to&&(a=o)}for(let o=a;o;o=o.next){let{node:l}=o;if((l.from<i.from&&l.to>=i.to||l.to>i.to&&l.from<=i.from)&&o.next)return Ze.range(l.to,l.from)}return i});return r.eq(e.selection)?!1:(n(io(e,r)),!0)};function ZW(e,n){let{state:r}=e,i=r.selection,s=r.selection.ranges.slice();for(let a of r.selection.ranges){let o=r.doc.lineAt(a.head);if(n?o.to<e.state.doc.length:o.from>0)for(let l=a;;){let u=e.moveVertically(l,n);if(u.head<o.from||u.head>o.to){s.some(d=>d.head==u.head)||s.push(u);break}else{if(u.head==l.head)break;l=u}}}return s.length==i.ranges.length?!1:(e.dispatch(io(r,Ze.create(s,s.length-1))),!0)}const c1e=e=>ZW(e,!1),u1e=e=>ZW(e,!0),d1e=({state:e,dispatch:n})=>{let r=e.selection,i=null;return r.ranges.length>1?i=Ze.create([r.main]):r.main.empty||(i=Ze.create([Ze.cursor(r.main.head)])),i?(n(io(e,i)),!0):!1};function Tv(e,n){if(e.state.readOnly)return!1;let r="delete.selection",{state:i}=e,s=i.changeByRange(a=>{let{from:o,to:l}=a;if(o==l){let u=n(a);u<o?(r="delete.backward",u=E_(e,u,!1)):u>o&&(r="delete.forward",u=E_(e,u,!0)),o=Math.min(o,u),l=Math.max(l,u)}else o=E_(e,o,!1),l=E_(e,l,!0);return o==l?{range:a}:{changes:{from:o,to:l},range:Ze.cursor(o,o<a.head?-1:1)}});return s.changes.empty?!1:(e.dispatch(i.update(s,{scrollIntoView:!0,userEvent:r,effects:r=="delete.selection"?St.announce.of(i.phrase("Selection deleted")):void 0})),!0)}function E_(e,n,r){if(e instanceof St)for(let i of e.state.facet(St.atomicRanges).map(s=>s(e)))i.between(n,n,(s,a)=>{s<n&&a>n&&(n=r?a:s)});return n}const JW=(e,n,r)=>Tv(e,i=>{let s=i.from,{state:a}=e,o=a.doc.lineAt(s),l,u;if(r&&!n&&s>o.from&&s<o.from+200&&!/[^ \t]/.test(l=o.text.slice(0,s-o.from))){if(l[l.length-1]=="	")return s-1;let d=Zf(l,a.tabSize),p=d%wb(a)||wb(a);for(let f=0;f<p&&l[l.length-1-f]==" ";f++)s--;u=s}else u=pi(o.text,s-o.from,n,n)+o.from,u==s&&o.number!=(n?a.doc.lines:1)?u+=n?1:-1:!n&&/[\ufe00-\ufe0f]/.test(o.text.slice(u-o.from,s-o.from))&&(u=pi(o.text,u-o.from,!1,!1)+o.from);return u}),mN=e=>JW(e,!1,!0),eq=e=>JW(e,!0,!1),tq=(e,n)=>Tv(e,r=>{let i=r.head,{state:s}=e,a=s.doc.lineAt(i),o=s.charCategorizer(i);for(let l=null;;){if(i==(n?a.to:a.from)){i==r.head&&a.number!=(n?s.doc.lines:1)&&(i+=n?1:-1);break}let u=pi(a.text,i-a.from,n)+a.from,d=a.text.slice(Math.min(i,u)-a.from,Math.max(i,u)-a.from),p=o(d);if(l!=null&&p!=l)break;(d!=" "||i!=r.head)&&(l=p),i=u}return i}),nq=e=>tq(e,!1),h1e=e=>tq(e,!0),f1e=e=>Tv(e,n=>{let r=e.lineBlockAt(n.head).to;return n.head<r?r:Math.min(e.state.doc.length,n.head+1)}),p1e=e=>Tv(e,n=>{let r=e.moveToLineBoundary(n,!1).head;return n.head>r?r:Math.max(0,n.head-1)}),m1e=e=>Tv(e,n=>{let r=e.moveToLineBoundary(n,!0).head;return n.head<r?r:Math.min(e.state.doc.length,n.head+1)}),g1e=({state:e,dispatch:n})=>{if(e.readOnly)return!1;let r=e.changeByRange(i=>({changes:{from:i.from,to:i.to,insert:Pn.of(["",""])},range:Ze.cursor(i.from)}));return n(e.update(r,{scrollIntoView:!0,userEvent:"input"})),!0},v1e=({state:e,dispatch:n})=>{if(e.readOnly)return!1;let r=e.changeByRange(i=>{if(!i.empty||i.from==0||i.from==e.doc.length)return{range:i};let s=i.from,a=e.doc.lineAt(s),o=s==a.from?s-1:pi(a.text,s-a.from,!1)+a.from,l=s==a.to?s+1:pi(a.text,s-a.from,!0)+a.from;return{changes:{from:o,to:l,insert:e.doc.slice(s,l).append(e.doc.slice(o,s))},range:Ze.cursor(l)}});return r.changes.empty?!1:(n(e.update(r,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function V0(e){let n=[],r=-1;for(let i of e.selection.ranges){let s=e.doc.lineAt(i.from),a=e.doc.lineAt(i.to);if(!i.empty&&i.to==a.from&&(a=e.doc.lineAt(i.to-1)),r>=s.number){let o=n[n.length-1];o.to=a.to,o.ranges.push(i)}else n.push({from:s.from,to:a.to,ranges:[i]});r=a.number+1}return n}function rq(e,n,r){if(e.readOnly)return!1;let i=[],s=[];for(let a of V0(e)){if(r?a.to==e.doc.length:a.from==0)continue;let o=e.doc.lineAt(r?a.to+1:a.from-1),l=o.length+1;if(r){i.push({from:a.to,to:o.to},{from:a.from,insert:o.text+e.lineBreak});for(let u of a.ranges)s.push(Ze.range(Math.min(e.doc.length,u.anchor+l),Math.min(e.doc.length,u.head+l)))}else{i.push({from:o.from,to:a.from},{from:a.to,insert:e.lineBreak+o.text});for(let u of a.ranges)s.push(Ze.range(u.anchor-l,u.head-l))}}return i.length?(n(e.update({changes:i,scrollIntoView:!0,selection:Ze.create(s,e.selection.mainIndex),userEvent:"move.line"})),!0):!1}const y1e=({state:e,dispatch:n})=>rq(e,n,!1),_1e=({state:e,dispatch:n})=>rq(e,n,!0);function iq(e,n,r){if(e.readOnly)return!1;let i=[];for(let a of V0(e))r?i.push({from:a.from,insert:e.doc.slice(a.from,a.to)+e.lineBreak}):i.push({from:a.to,insert:e.lineBreak+e.doc.slice(a.from,a.to)});let s=e.changes(i);return n(e.update({changes:s,selection:e.selection.map(s,r?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const x1e=({state:e,dispatch:n})=>iq(e,n,!1),b1e=({state:e,dispatch:n})=>iq(e,n,!0),k1e=e=>{if(e.state.readOnly)return!1;let{state:n}=e,r=n.changes(V0(n).map(({from:s,to:a})=>(s>0?s--:a<n.doc.length&&a++,{from:s,to:a}))),i=Jf(n.selection,s=>{let a;if(e.lineWrapping){let o=e.lineBlockAt(s.head),l=e.coordsAtPos(s.head,s.assoc||1);l&&(a=o.bottom+e.documentTop-l.bottom+e.defaultLineHeight/2)}return e.moveVertically(s,!0,a)}).map(r);return e.dispatch({changes:r,selection:i,scrollIntoView:!0,userEvent:"delete.line"}),!0};function w1e(e,n){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(n-1,n+1)))return{from:n,to:n};let r=qi(e).resolveInner(n),i=r.childBefore(n),s=r.childAfter(n),a;return i&&s&&i.to<=n&&s.from>=n&&(a=i.type.prop(hn.closedBy))&&a.indexOf(s.name)>-1&&e.doc.lineAt(i.to).from==e.doc.lineAt(s.from).from&&!/\S/.test(e.sliceDoc(i.to,s.from))?{from:i.to,to:s.from}:null}const AL=sq(!1),S1e=sq(!0);function sq(e){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let i=n.changeByRange(s=>{let{from:a,to:o}=s,l=n.doc.lineAt(a),u=!e&&a==o&&w1e(n,a);e&&(a=o=(o<=l.to?l:n.doc.lineAt(o)).to);let d=new F0(n,{simulateBreak:a,simulateDoubleBreak:!!u}),p=XA(d,a);for(p==null&&(p=Zf(/^\s*/.exec(n.doc.lineAt(a).text)[0],n.tabSize));o<l.to&&/\s/.test(l.text[o-l.from]);)o++;u?{from:a,to:o}=u:a>l.from&&a<l.from+100&&!/\S/.test(l.text.slice(0,a))&&(a=l.from);let f=["",zg(n,p)];return u&&f.push(zg(n,d.lineIndent(l.from,-1))),{changes:{from:a,to:o,insert:Pn.of(f)},range:Ze.cursor(a+1+f[1].length)}});return r(n.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}function eT(e,n){let r=-1;return e.changeByRange(i=>{let s=[];for(let o=i.from;o<=i.to;){let l=e.doc.lineAt(o);l.number>r&&(i.empty||i.to>l.from)&&(n(l,s,i),r=l.number),o=l.to+1}let a=e.changes(s);return{changes:s,range:Ze.range(a.mapPos(i.anchor,1),a.mapPos(i.head,1))}})}const C1e=({state:e,dispatch:n})=>{if(e.readOnly)return!1;let r=Object.create(null),i=new F0(e,{overrideIndentation:a=>{let o=r[a];return o??-1}}),s=eT(e,(a,o,l)=>{let u=XA(i,a.from);if(u==null)return;/\S/.test(a.text)||(u=0);let d=/^\s*/.exec(a.text)[0],p=zg(e,u);(d!=p||l.from<a.from+d.length)&&(r[a.from]=u,o.push({from:a.from,to:a.from+d.length,insert:p}))});return s.changes.empty||n(e.update(s,{userEvent:"indent"})),!0},aq=({state:e,dispatch:n})=>e.readOnly?!1:(n(e.update(eT(e,(r,i)=>{i.push({from:r.from,insert:e.facet($0)})}),{userEvent:"input.indent"})),!0),oq=({state:e,dispatch:n})=>e.readOnly?!1:(n(e.update(eT(e,(r,i)=>{let s=/^\s*/.exec(r.text)[0];if(!s)return;let a=Zf(s,e.tabSize),o=0,l=zg(e,Math.max(0,a-wb(e)));for(;o<s.length&&o<l.length&&s.charCodeAt(o)==l.charCodeAt(o);)o++;i.push({from:r.from+o,to:r.from+s.length,insert:l.slice(o)})}),{userEvent:"delete.dedent"})),!0),j1e=e=>(e.setTabFocusMode(),!0),N1e=[{key:"Ctrl-b",run:LW,shift:UW,preventDefault:!0},{key:"Ctrl-f",run:IW,shift:VW},{key:"Ctrl-p",run:$W,shift:GW},{key:"Ctrl-n",run:FW,shift:XW},{key:"Ctrl-a",run:Vke,shift:i1e},{key:"Ctrl-e",run:Kke,shift:s1e},{key:"Ctrl-d",run:eq},{key:"Ctrl-h",run:mN},{key:"Ctrl-k",run:f1e},{key:"Ctrl-Alt-h",run:nq},{key:"Ctrl-o",run:g1e},{key:"Ctrl-t",run:v1e},{key:"Ctrl-v",run:pN}],E1e=[{key:"ArrowLeft",run:LW,shift:UW,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:Ike,shift:Xke,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:qke,shift:n1e,preventDefault:!0},{key:"ArrowRight",run:IW,shift:VW,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:Bke,shift:Qke,preventDefault:!0},{mac:"Cmd-ArrowRight",run:Uke,shift:r1e,preventDefault:!0},{key:"ArrowUp",run:$W,shift:GW,preventDefault:!0},{mac:"Cmd-ArrowUp",run:CL,shift:NL},{mac:"Ctrl-ArrowUp",run:kL,shift:wL},{key:"ArrowDown",run:FW,shift:XW,preventDefault:!0},{mac:"Cmd-ArrowDown",run:jL,shift:EL},{mac:"Ctrl-ArrowDown",run:pN,shift:SL},{key:"PageUp",run:kL,shift:wL},{key:"PageDown",run:pN,shift:SL},{key:"Home",run:Wke,shift:t1e,preventDefault:!0},{key:"Mod-Home",run:CL,shift:NL},{key:"End",run:Hke,shift:e1e,preventDefault:!0},{key:"Mod-End",run:jL,shift:EL},{key:"Enter",run:AL,shift:AL},{key:"Mod-a",run:a1e},{key:"Backspace",run:mN,shift:mN,preventDefault:!0},{key:"Delete",run:eq,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:nq,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:h1e,preventDefault:!0},{mac:"Mod-Backspace",run:p1e,preventDefault:!0},{mac:"Mod-Delete",run:m1e,preventDefault:!0}].concat(N1e.map(e=>({mac:e.key,run:e.run,shift:e.shift}))),A1e=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:$ke,shift:Zke},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:Fke,shift:Jke},{key:"Alt-ArrowUp",run:y1e},{key:"Shift-Alt-ArrowUp",run:x1e},{key:"Alt-ArrowDown",run:_1e},{key:"Shift-Alt-ArrowDown",run:b1e},{key:"Mod-Alt-ArrowUp",run:c1e},{key:"Mod-Alt-ArrowDown",run:u1e},{key:"Escape",run:d1e},{key:"Mod-Enter",run:S1e},{key:"Alt-l",mac:"Ctrl-l",run:o1e},{key:"Mod-i",run:l1e,preventDefault:!0},{key:"Mod-[",run:oq},{key:"Mod-]",run:aq},{key:"Mod-Alt-\\",run:C1e},{key:"Shift-Mod-k",run:k1e},{key:"Shift-Mod-\\",run:Gke},{key:"Mod-/",run:yke},{key:"Alt-A",run:xke},{key:"Ctrl-m",mac:"Shift-Alt-m",run:j1e}].concat(E1e),T1e={key:"Tab",run:aq,shift:oq},TL=typeof String.prototype.normalize=="function"?e=>e.normalize("NFKD"):e=>e;class zf{constructor(n,r,i=0,s=n.length,a,o){this.test=o,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=n.iterRange(i,s),this.bufferStart=i,this.normalize=a?l=>a(TL(l)):TL,this.query=this.normalize(r)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return _s(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let n=this.peek();if(n<0)return this.done=!0,this;let r=EA(n),i=this.bufferStart+this.bufferPos;this.bufferPos+=Do(n);let s=this.normalize(r);if(s.length)for(let a=0,o=i;;a++){let l=s.charCodeAt(a),u=this.match(l,o,this.bufferPos+this.bufferStart);if(a==s.length-1){if(u)return this.value=u,this;break}o==i&&a<r.length&&r.charCodeAt(a)==l&&o++}}}match(n,r,i){let s=null;for(let a=0;a<this.matches.length;a+=2){let o=this.matches[a],l=!1;this.query.charCodeAt(o)==n&&(o==this.query.length-1?s={from:this.matches[a+1],to:i}:(this.matches[a]++,l=!0)),l||(this.matches.splice(a,2),a-=2)}return this.query.charCodeAt(0)==n&&(this.query.length==1?s={from:r,to:i}:this.matches.push(1,r)),s&&this.test&&!this.test(s.from,s.to,this.buffer,this.bufferStart)&&(s=null),s}}typeof Symbol<"u"&&(zf.prototype[Symbol.iterator]=function(){return this});const lq={from:-1,to:-1,match:/.*/.exec("")},tT="gm"+(/x/.unicode==null?"":"u");class cq{constructor(n,r,i,s=0,a=n.length){if(this.text=n,this.to=a,this.curLine="",this.done=!1,this.value=lq,/\\[sWDnr]|\n|\r|\[\^/.test(r))return new uq(n,r,i,s,a);this.re=new RegExp(r,tT+(i!=null&&i.ignoreCase?"i":"")),this.test=i==null?void 0:i.test,this.iter=n.iter();let o=n.lineAt(s);this.curLineStart=o.from,this.matchPos=Nb(n,s),this.getLine(this.curLineStart)}getLine(n){this.iter.next(n),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let n=this.matchPos-this.curLineStart;;){this.re.lastIndex=n;let r=this.matchPos<=this.to&&this.re.exec(this.curLine);if(r){let i=this.curLineStart+r.index,s=i+r[0].length;if(this.matchPos=Nb(this.text,s+(i==s?1:0)),i==this.curLineStart+this.curLine.length&&this.nextLine(),(i<s||i>this.value.to)&&(!this.test||this.test(i,s,r)))return this.value={from:i,to:s,match:r},this;n=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),n=0;else return this.done=!0,this}}}const BS=new WeakMap;class pf{constructor(n,r){this.from=n,this.text=r}get to(){return this.from+this.text.length}static get(n,r,i){let s=BS.get(n);if(!s||s.from>=i||s.to<=r){let l=new pf(r,n.sliceString(r,i));return BS.set(n,l),l}if(s.from==r&&s.to==i)return s;let{text:a,from:o}=s;return o>r&&(a=n.sliceString(r,o)+a,o=r),s.to<i&&(a+=n.sliceString(s.to,i)),BS.set(n,new pf(o,a)),new pf(r,a.slice(r-o,i-o))}}class uq{constructor(n,r,i,s,a){this.text=n,this.to=a,this.done=!1,this.value=lq,this.matchPos=Nb(n,s),this.re=new RegExp(r,tT+(i!=null&&i.ignoreCase?"i":"")),this.test=i==null?void 0:i.test,this.flat=pf.get(n,s,this.chunkEnd(s+5e3))}chunkEnd(n){return n>=this.to?this.to:this.text.lineAt(n).to}next(){for(;;){let n=this.re.lastIndex=this.matchPos-this.flat.from,r=this.re.exec(this.flat.text);if(r&&!r[0]&&r.index==n&&(this.re.lastIndex=n+1,r=this.re.exec(this.flat.text)),r){let i=this.flat.from+r.index,s=i+r[0].length;if((this.flat.to>=this.to||r.index+r[0].length<=this.flat.text.length-10)&&(!this.test||this.test(i,s,r)))return this.value={from:i,to:s,match:r},this.matchPos=Nb(this.text,s+(i==s?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=pf.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(cq.prototype[Symbol.iterator]=uq.prototype[Symbol.iterator]=function(){return this});function M1e(e){try{return new RegExp(e,tT),!0}catch{return!1}}function Nb(e,n){if(n>=e.length)return n;let r=e.lineAt(n),i;for(;n<r.to&&(i=r.text.charCodeAt(n-r.from))>=56320&&i<57344;)n++;return n}const R1e=e=>{let{state:n}=e,r=String(n.doc.lineAt(e.state.selection.main.head).number),{close:i,result:s}=Zbe(e,{label:n.phrase("Go to line"),input:{type:"text",name:"line",value:r},focus:!0,submitLabel:n.phrase("go")});return s.then(a=>{let o=a&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(a.elements.line.value);if(!o){e.dispatch({effects:i});return}let l=n.doc.lineAt(n.selection.main.head),[,u,d,p,f]=o,g=p?+p.slice(1):0,_=d?+d:l.number;if(d&&f){let S=_/100;u&&(S=S*(u=="-"?-1:1)+l.number/n.doc.lines),_=Math.round(n.doc.lines*S)}else d&&u&&(_=_*(u=="-"?-1:1)+l.number);let x=n.doc.line(Math.max(1,Math.min(n.doc.lines,_))),v=Ze.cursor(x.from+Math.max(0,Math.min(g,x.length)));e.dispatch({effects:[i,St.scrollIntoView(v.from,{y:"center"})],selection:v})}),!0},O1e={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},D1e=jt.define({combine(e){return ro(e,O1e,{highlightWordAroundCursor:(n,r)=>n||r,minSelectionLength:Math.min,maxMatches:Math.min})}});function P1e(e){return[$1e,z1e]}const L1e=Wt.mark({class:"cm-selectionMatch"}),I1e=Wt.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function ML(e,n,r,i){return(r==0||e(n.sliceDoc(r-1,r))!=yr.Word)&&(i==n.doc.length||e(n.sliceDoc(i,i+1))!=yr.Word)}function B1e(e,n,r,i){return e(n.sliceDoc(r,r+1))==yr.Word&&e(n.sliceDoc(i-1,i))==yr.Word}const z1e=Cr.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.selectionSet||e.docChanged||e.viewportChanged)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let n=e.state.facet(D1e),{state:r}=e,i=r.selection;if(i.ranges.length>1)return Wt.none;let s=i.main,a,o=null;if(s.empty){if(!n.highlightWordAroundCursor)return Wt.none;let u=r.wordAt(s.head);if(!u)return Wt.none;o=r.charCategorizer(s.head),a=r.sliceDoc(u.from,u.to)}else{let u=s.to-s.from;if(u<n.minSelectionLength||u>200)return Wt.none;if(n.wholeWords){if(a=r.sliceDoc(s.from,s.to),o=r.charCategorizer(s.head),!(ML(o,r,s.from,s.to)&&B1e(o,r,s.from,s.to)))return Wt.none}else if(a=r.sliceDoc(s.from,s.to),!a)return Wt.none}let l=[];for(let u of e.visibleRanges){let d=new zf(r.doc,a,u.from,u.to);for(;!d.next().done;){let{from:p,to:f}=d.value;if((!o||ML(o,r,p,f))&&(s.empty&&p<=s.from&&f>=s.to?l.push(I1e.range(p,f)):(p>=s.to||f<=s.from)&&l.push(L1e.range(p,f)),l.length>n.maxMatches))return Wt.none}}return Wt.set(l)}},{decorations:e=>e.decorations}),$1e=St.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),F1e=({state:e,dispatch:n})=>{let{selection:r}=e,i=Ze.create(r.ranges.map(s=>e.wordAt(s.head)||Ze.cursor(s.head)),r.mainIndex);return i.eq(r)?!1:(n(e.update({selection:i})),!0)};function H1e(e,n){let{main:r,ranges:i}=e.selection,s=e.wordAt(r.head),a=s&&s.from==r.from&&s.to==r.to;for(let o=!1,l=new zf(e.doc,n,i[i.length-1].to);;)if(l.next(),l.done){if(o)return null;l=new zf(e.doc,n,0,Math.max(0,i[i.length-1].from-1)),o=!0}else{if(o&&i.some(u=>u.from==l.value.from))continue;if(a){let u=e.wordAt(l.value.from);if(!u||u.from!=l.value.from||u.to!=l.value.to)continue}return l.value}}const W1e=({state:e,dispatch:n})=>{let{ranges:r}=e.selection;if(r.some(a=>a.from===a.to))return F1e({state:e,dispatch:n});let i=e.sliceDoc(r[0].from,r[0].to);if(e.selection.ranges.some(a=>e.sliceDoc(a.from,a.to)!=i))return!1;let s=H1e(e,i);return s?(n(e.update({selection:e.selection.addRange(Ze.range(s.from,s.to),!1),effects:St.scrollIntoView(s.to)})),!0):!1},ep=jt.define({combine(e){return ro(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:n=>new rwe(n),scrollToMatch:n=>St.scrollIntoView(n)})}});class dq{constructor(n){this.search=n.search,this.caseSensitive=!!n.caseSensitive,this.literal=!!n.literal,this.regexp=!!n.regexp,this.replace=n.replace||"",this.valid=!!this.search&&(!this.regexp||M1e(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!n.wholeWord,this.test=n.test}unquote(n){return this.literal?n:n.replace(/\\([nrt\\])/g,(r,i)=>i=="n"?`
`:i=="r"?"\r":i=="t"?"	":"\\")}eq(n){return this.search==n.search&&this.replace==n.replace&&this.caseSensitive==n.caseSensitive&&this.regexp==n.regexp&&this.wholeWord==n.wholeWord&&this.test==n.test}create(){return this.regexp?new G1e(this):new V1e(this)}getCursor(n,r=0,i){let s=n.doc?n:bn.create({doc:n});return i==null&&(i=s.doc.length),this.regexp?Fh(this,s,r,i):$h(this,s,r,i)}}class hq{constructor(n){this.spec=n}}function q1e(e,n,r){return(i,s,a,o)=>{if(r&&!r(i,s,a,o))return!1;let l=i>=o&&s<=o+a.length?a.slice(i-o,s-o):n.doc.sliceString(i,s);return e(l,n,i,s)}}function $h(e,n,r,i){let s;return e.wholeWord&&(s=U1e(n.doc,n.charCategorizer(n.selection.main.head))),e.test&&(s=q1e(e.test,n,s)),new zf(n.doc,e.unquoted,r,i,e.caseSensitive?void 0:a=>a.toLowerCase(),s)}function U1e(e,n){return(r,i,s,a)=>((a>r||a+s.length<i)&&(a=Math.max(0,r-2),s=e.sliceString(a,Math.min(e.length,i+2))),(n(Eb(s,r-a))!=yr.Word||n(Ab(s,r-a))!=yr.Word)&&(n(Ab(s,i-a))!=yr.Word||n(Eb(s,i-a))!=yr.Word))}class V1e extends hq{constructor(n){super(n)}nextMatch(n,r,i){let s=$h(this.spec,n,i,n.doc.length).nextOverlapping();if(s.done){let a=Math.min(n.doc.length,r+this.spec.unquoted.length);s=$h(this.spec,n,0,a).nextOverlapping()}return s.done||s.value.from==r&&s.value.to==i?null:s.value}prevMatchInRange(n,r,i){for(let s=i;;){let a=Math.max(r,s-1e4-this.spec.unquoted.length),o=$h(this.spec,n,a,s),l=null;for(;!o.nextOverlapping().done;)l=o.value;if(l)return l;if(a==r)return null;s-=1e4}}prevMatch(n,r,i){let s=this.prevMatchInRange(n,0,r);return s||(s=this.prevMatchInRange(n,Math.max(0,i-this.spec.unquoted.length),n.doc.length)),s&&(s.from!=r||s.to!=i)?s:null}getReplacement(n){return this.spec.unquote(this.spec.replace)}matchAll(n,r){let i=$h(this.spec,n,0,n.doc.length),s=[];for(;!i.next().done;){if(s.length>=r)return null;s.push(i.value)}return s}highlight(n,r,i,s){let a=$h(this.spec,n,Math.max(0,r-this.spec.unquoted.length),Math.min(i+this.spec.unquoted.length,n.doc.length));for(;!a.next().done;)s(a.value.from,a.value.to)}}function K1e(e,n,r){return(i,s,a)=>(!r||r(i,s,a))&&e(a[0],n,i,s)}function Fh(e,n,r,i){let s;return e.wholeWord&&(s=Y1e(n.charCategorizer(n.selection.main.head))),e.test&&(s=K1e(e.test,n,s)),new cq(n.doc,e.search,{ignoreCase:!e.caseSensitive,test:s},r,i)}function Eb(e,n){return e.slice(pi(e,n,!1),n)}function Ab(e,n){return e.slice(n,pi(e,n))}function Y1e(e){return(n,r,i)=>!i[0].length||(e(Eb(i.input,i.index))!=yr.Word||e(Ab(i.input,i.index))!=yr.Word)&&(e(Ab(i.input,i.index+i[0].length))!=yr.Word||e(Eb(i.input,i.index+i[0].length))!=yr.Word)}class G1e extends hq{nextMatch(n,r,i){let s=Fh(this.spec,n,i,n.doc.length).next();return s.done&&(s=Fh(this.spec,n,0,r).next()),s.done?null:s.value}prevMatchInRange(n,r,i){for(let s=1;;s++){let a=Math.max(r,i-s*1e4),o=Fh(this.spec,n,a,i),l=null;for(;!o.next().done;)l=o.value;if(l&&(a==r||l.from>a+10))return l;if(a==r)return null}}prevMatch(n,r,i){return this.prevMatchInRange(n,0,r)||this.prevMatchInRange(n,i,n.doc.length)}getReplacement(n){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(r,i)=>{if(i=="&")return n.match[0];if(i=="$")return"$";for(let s=i.length;s>0;s--){let a=+i.slice(0,s);if(a>0&&a<n.match.length)return n.match[a]+i.slice(s)}return r})}matchAll(n,r){let i=Fh(this.spec,n,0,n.doc.length),s=[];for(;!i.next().done;){if(s.length>=r)return null;s.push(i.value)}return s}highlight(n,r,i,s){let a=Fh(this.spec,n,Math.max(0,r-250),Math.min(i+250,n.doc.length));for(;!a.next().done;)s(a.value.from,a.value.to)}}const $g=Zt.define(),nT=Zt.define(),eu=vi.define({create(e){return new zS(gN(e).create(),null)},update(e,n){for(let r of n.effects)r.is($g)?e=new zS(r.value.create(),e.panel):r.is(nT)&&(e=new zS(e.query,r.value?rT:null));return e},provide:e=>Lg.from(e,n=>n.panel)});class zS{constructor(n,r){this.query=n,this.panel=r}}const X1e=Wt.mark({class:"cm-searchMatch"}),Q1e=Wt.mark({class:"cm-searchMatch cm-searchMatch-selected"}),Z1e=Cr.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(eu))}update(e){let n=e.state.field(eu);(n!=e.startState.field(eu)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(n))}highlight({query:e,panel:n}){if(!n||!e.spec.valid)return Wt.none;let{view:r}=this,i=new Kl;for(let s=0,a=r.visibleRanges,o=a.length;s<o;s++){let{from:l,to:u}=a[s];for(;s<o-1&&u>a[s+1].from-500;)u=a[++s].to;e.highlight(r.state,l,u,(d,p)=>{let f=r.state.selection.ranges.some(g=>g.from==d&&g.to==p);i.add(d,p,f?Q1e:X1e)})}return i.finish()}},{decorations:e=>e.decorations});function Mv(e){return n=>{let r=n.state.field(eu,!1);return r&&r.query.spec.valid?e(n,r):mq(n)}}const Tb=Mv((e,{query:n})=>{let{to:r}=e.state.selection.main,i=n.nextMatch(e.state,r,r);if(!i)return!1;let s=Ze.single(i.from,i.to),a=e.state.facet(ep);return e.dispatch({selection:s,effects:[iT(e,i),a.scrollToMatch(s.main,e)],userEvent:"select.search"}),pq(e),!0}),Mb=Mv((e,{query:n})=>{let{state:r}=e,{from:i}=r.selection.main,s=n.prevMatch(r,i,i);if(!s)return!1;let a=Ze.single(s.from,s.to),o=e.state.facet(ep);return e.dispatch({selection:a,effects:[iT(e,s),o.scrollToMatch(a.main,e)],userEvent:"select.search"}),pq(e),!0}),J1e=Mv((e,{query:n})=>{let r=n.matchAll(e.state,1e3);return!r||!r.length?!1:(e.dispatch({selection:Ze.create(r.map(i=>Ze.range(i.from,i.to))),userEvent:"select.search.matches"}),!0)}),ewe=({state:e,dispatch:n})=>{let r=e.selection;if(r.ranges.length>1||r.main.empty)return!1;let{from:i,to:s}=r.main,a=[],o=0;for(let l=new zf(e.doc,e.sliceDoc(i,s));!l.next().done;){if(a.length>1e3)return!1;l.value.from==i&&(o=a.length),a.push(Ze.range(l.value.from,l.value.to))}return n(e.update({selection:Ze.create(a,o),userEvent:"select.search.matches"})),!0},RL=Mv((e,{query:n})=>{let{state:r}=e,{from:i,to:s}=r.selection.main;if(r.readOnly)return!1;let a=n.nextMatch(r,i,i);if(!a)return!1;let o=a,l=[],u,d,p=[];o.from==i&&o.to==s&&(d=r.toText(n.getReplacement(o)),l.push({from:o.from,to:o.to,insert:d}),o=n.nextMatch(r,o.from,o.to),p.push(St.announce.of(r.phrase("replaced match on line $",r.doc.lineAt(i).number)+".")));let f=e.state.changes(l);return o&&(u=Ze.single(o.from,o.to).map(f),p.push(iT(e,o)),p.push(r.facet(ep).scrollToMatch(u.main,e))),e.dispatch({changes:f,selection:u,effects:p,userEvent:"input.replace"}),!0}),twe=Mv((e,{query:n})=>{if(e.state.readOnly)return!1;let r=n.matchAll(e.state,1e9).map(s=>{let{from:a,to:o}=s;return{from:a,to:o,insert:n.getReplacement(s)}});if(!r.length)return!1;let i=e.state.phrase("replaced $ matches",r.length)+".";return e.dispatch({changes:r,effects:St.announce.of(i),userEvent:"input.replace.all"}),!0});function rT(e){return e.state.facet(ep).createPanel(e)}function gN(e,n){var r,i,s,a,o;let l=e.selection.main,u=l.empty||l.to>l.from+100?"":e.sliceDoc(l.from,l.to);if(n&&!u)return n;let d=e.facet(ep);return new dq({search:((r=n==null?void 0:n.literal)!==null&&r!==void 0?r:d.literal)?u:u.replace(/\n/g,"\\n"),caseSensitive:(i=n==null?void 0:n.caseSensitive)!==null&&i!==void 0?i:d.caseSensitive,literal:(s=n==null?void 0:n.literal)!==null&&s!==void 0?s:d.literal,regexp:(a=n==null?void 0:n.regexp)!==null&&a!==void 0?a:d.regexp,wholeWord:(o=n==null?void 0:n.wholeWord)!==null&&o!==void 0?o:d.wholeWord})}function fq(e){let n=UA(e,rT);return n&&n.dom.querySelector("[main-field]")}function pq(e){let n=fq(e);n&&n==e.root.activeElement&&n.select()}const mq=e=>{let n=e.state.field(eu,!1);if(n&&n.panel){let r=fq(e);if(r&&r!=e.root.activeElement){let i=gN(e.state,n.query.spec);i.valid&&e.dispatch({effects:$g.of(i)}),r.focus(),r.select()}}else e.dispatch({effects:[nT.of(!0),n?$g.of(gN(e.state,n.query.spec)):Zt.appendConfig.of(swe)]});return!0},gq=e=>{let n=e.state.field(eu,!1);if(!n||!n.panel)return!1;let r=UA(e,rT);return r&&r.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:nT.of(!1)}),!0},nwe=[{key:"Mod-f",run:mq,scope:"editor search-panel"},{key:"F3",run:Tb,shift:Mb,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:Tb,shift:Mb,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:gq,scope:"editor search-panel"},{key:"Mod-Shift-l",run:ewe},{key:"Mod-Alt-g",run:R1e},{key:"Mod-d",run:W1e,preventDefault:!0}];class rwe{constructor(n){this.view=n;let r=this.query=n.state.field(eu).query.spec;this.commit=this.commit.bind(this),this.searchField=Vn("input",{value:r.search,placeholder:qs(n,"Find"),"aria-label":qs(n,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=Vn("input",{value:r.replace,placeholder:qs(n,"Replace"),"aria-label":qs(n,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=Vn("input",{type:"checkbox",name:"case",form:"",checked:r.caseSensitive,onchange:this.commit}),this.reField=Vn("input",{type:"checkbox",name:"re",form:"",checked:r.regexp,onchange:this.commit}),this.wordField=Vn("input",{type:"checkbox",name:"word",form:"",checked:r.wholeWord,onchange:this.commit});function i(s,a,o){return Vn("button",{class:"cm-button",name:s,onclick:a,type:"button"},o)}this.dom=Vn("div",{onkeydown:s=>this.keydown(s),class:"cm-search"},[this.searchField,i("next",()=>Tb(n),[qs(n,"next")]),i("prev",()=>Mb(n),[qs(n,"previous")]),i("select",()=>J1e(n),[qs(n,"all")]),Vn("label",null,[this.caseField,qs(n,"match case")]),Vn("label",null,[this.reField,qs(n,"regexp")]),Vn("label",null,[this.wordField,qs(n,"by word")]),...n.state.readOnly?[]:[Vn("br"),this.replaceField,i("replace",()=>RL(n),[qs(n,"replace")]),i("replaceAll",()=>twe(n),[qs(n,"replace all")])],Vn("button",{name:"close",onclick:()=>gq(n),"aria-label":qs(n,"close"),type:"button"},["×"])])}commit(){let n=new dq({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});n.eq(this.query)||(this.query=n,this.view.dispatch({effects:$g.of(n)}))}keydown(n){lbe(this.view,n,"search-panel")?n.preventDefault():n.keyCode==13&&n.target==this.searchField?(n.preventDefault(),(n.shiftKey?Mb:Tb)(this.view)):n.keyCode==13&&n.target==this.replaceField&&(n.preventDefault(),RL(this.view))}update(n){for(let r of n.transactions)for(let i of r.effects)i.is($g)&&!i.value.eq(this.query)&&this.setQuery(i.value)}setQuery(n){this.query=n,this.searchField.value=n.search,this.replaceField.value=n.replace,this.caseField.checked=n.caseSensitive,this.reField.checked=n.regexp,this.wordField.checked=n.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(ep).top}}function qs(e,n){return e.state.phrase(n)}const A_=30,T_=/[\s\.,:;?!]/;function iT(e,{from:n,to:r}){let i=e.state.doc.lineAt(n),s=e.state.doc.lineAt(r).to,a=Math.max(i.from,n-A_),o=Math.min(s,r+A_),l=e.state.sliceDoc(a,o);if(a!=i.from){for(let u=0;u<A_;u++)if(!T_.test(l[u+1])&&T_.test(l[u])){l=l.slice(u);break}}if(o!=s){for(let u=l.length-1;u>l.length-A_;u--)if(!T_.test(l[u-1])&&T_.test(l[u])){l=l.slice(0,u);break}}return St.announce.of(`${e.state.phrase("current match")}. ${l} ${e.state.phrase("on line")} ${i.number}.`)}const iwe=St.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),swe=[eu,Ld.low(Z1e),iwe];class vq{constructor(n,r,i,s){this.state=n,this.pos=r,this.explicit=i,this.view=s,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(n){let r=qi(this.state).resolveInner(this.pos,-1);for(;r&&n.indexOf(r.name)<0;)r=r.parent;return r?{from:r.from,to:this.pos,text:this.state.sliceDoc(r.from,this.pos),type:r.type}:null}matchBefore(n){let r=this.state.doc.lineAt(this.pos),i=Math.max(r.from,this.pos-250),s=r.text.slice(i-r.from,this.pos-r.from),a=s.search(yq(n,!1));return a<0?null:{from:i+a,to:this.pos,text:s.slice(a)}}get aborted(){return this.abortListeners==null}addEventListener(n,r,i){n=="abort"&&this.abortListeners&&(this.abortListeners.push(r),i&&i.onDocChange&&(this.abortOnDocChange=!0))}}function OL(e){let n=Object.keys(e).join(""),r=/\w/.test(n);return r&&(n=n.replace(/\w/g,"")),`[${r?"\\w":""}${n.replace(/[^\w\s]/g,"\\$&")}]`}function awe(e){let n=Object.create(null),r=Object.create(null);for(let{label:s}of e){n[s[0]]=!0;for(let a=1;a<s.length;a++)r[s[a]]=!0}let i=OL(n)+OL(r)+"*$";return[new RegExp("^"+i),new RegExp(i)]}function owe(e){let n=e.map(s=>typeof s=="string"?{label:s}:s),[r,i]=n.every(s=>/^\w+$/.test(s.label))?[/\w*$/,/\w+$/]:awe(n);return s=>{let a=s.matchBefore(i);return a||s.explicit?{from:a?a.from:s.pos,options:n,validFor:r}:null}}class DL{constructor(n,r,i,s){this.completion=n,this.source=r,this.match=i,this.score=s}}function yd(e){return e.selection.main.from}function yq(e,n){var r;let{source:i}=e,s=n&&i[0]!="^",a=i[i.length-1]!="$";return!s&&!a?e:new RegExp(`${s?"^":""}(?:${i})${a?"$":""}`,(r=e.flags)!==null&&r!==void 0?r:e.ignoreCase?"i":"")}const _q=tl.define();function lwe(e,n,r,i){let{main:s}=e.selection,a=r-s.from,o=i-s.from;return{...e.changeByRange(l=>{if(l!=s&&r!=i&&e.sliceDoc(l.from+a,l.from+o)!=e.sliceDoc(r,i))return{range:l};let u=e.toText(n);return{changes:{from:l.from+a,to:i==s.from?l.to:l.from+o,insert:u},range:Ze.cursor(l.from+a+u.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const PL=new WeakMap;function cwe(e){if(!Array.isArray(e))return e;let n=PL.get(e);return n||PL.set(e,n=owe(e)),n}const Rb=Zt.define(),Fg=Zt.define();class uwe{constructor(n){this.pattern=n,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let r=0;r<n.length;){let i=_s(n,r),s=Do(i);this.chars.push(i);let a=n.slice(r,r+s),o=a.toUpperCase();this.folded.push(_s(o==a?a.toLowerCase():o,0)),r+=s}this.astral=n.length!=this.chars.length}ret(n,r){return this.score=n,this.matched=r,this}match(n){if(this.pattern.length==0)return this.ret(-100,[]);if(n.length<this.pattern.length)return null;let{chars:r,folded:i,any:s,precise:a,byWord:o}=this;if(r.length==1){let N=_s(n,0),C=Do(N),T=C==n.length?0:-100;if(N!=r[0])if(N==i[0])T+=-200;else return null;return this.ret(T,[0,C])}let l=n.indexOf(this.pattern);if(l==0)return this.ret(n.length==this.pattern.length?0:-100,[0,this.pattern.length]);let u=r.length,d=0;if(l<0){for(let N=0,C=Math.min(n.length,200);N<C&&d<u;){let T=_s(n,N);(T==r[d]||T==i[d])&&(s[d++]=N),N+=Do(T)}if(d<u)return null}let p=0,f=0,g=!1,_=0,x=-1,v=-1,S=/[a-z]/.test(n),w=!0;for(let N=0,C=Math.min(n.length,200),T=0;N<C&&f<u;){let A=_s(n,N);l<0&&(p<u&&A==r[p]&&(a[p++]=N),_<u&&(A==r[_]||A==i[_]?(_==0&&(x=N),v=N+1,_++):_=0));let E,D=A<255?A>=48&&A<=57||A>=97&&A<=122?2:A>=65&&A<=90?1:0:(E=EA(A))!=E.toLowerCase()?1:E!=E.toUpperCase()?2:0;(!N||D==1&&S||T==0&&D!=0)&&(r[f]==A||i[f]==A&&(g=!0)?o[f++]=N:o.length&&(w=!1)),T=D,N+=Do(A)}return f==u&&o[0]==0&&w?this.result(-100+(g?-200:0),o,n):_==u&&x==0?this.ret(-200-n.length+(v==n.length?0:-100),[0,v]):l>-1?this.ret(-700-n.length,[l,l+this.pattern.length]):_==u?this.ret(-900-n.length,[x,v]):f==u?this.result(-100+(g?-200:0)+-700+(w?0:-1100),o,n):r.length==2?null:this.result((s[0]?-700:0)+-200+-1100,s,n)}result(n,r,i){let s=[],a=0;for(let o of r){let l=o+(this.astral?Do(_s(i,o)):1);a&&s[a-1]==o?s[a-1]=l:(s[a++]=o,s[a++]=l)}return this.ret(n-i.length,s)}}class dwe{constructor(n){this.pattern=n,this.matched=[],this.score=0,this.folded=n.toLowerCase()}match(n){if(n.length<this.pattern.length)return null;let r=n.slice(0,this.pattern.length),i=r==this.pattern?0:r.toLowerCase()==this.folded?-200:null;return i==null?null:(this.matched=[0,r.length],this.score=i+(n.length==this.pattern.length?0:-100),this)}}const fi=jt.define({combine(e){return ro(e,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:hwe,filterStrict:!1,compareCompletions:(n,r)=>(n.sortText||n.label).localeCompare(r.sortText||r.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(n,r)=>n&&r,closeOnBlur:(n,r)=>n&&r,icons:(n,r)=>n&&r,tooltipClass:(n,r)=>i=>LL(n(i),r(i)),optionClass:(n,r)=>i=>LL(n(i),r(i)),addToOptions:(n,r)=>n.concat(r),filterStrict:(n,r)=>n||r})}});function LL(e,n){return e?n?e+" "+n:e:n}function hwe(e,n,r,i,s,a){let o=e.textDirection==Jn.RTL,l=o,u=!1,d="top",p,f,g=n.left-s.left,_=s.right-n.right,x=i.right-i.left,v=i.bottom-i.top;if(l&&g<Math.min(x,_)?l=!1:!l&&_<Math.min(x,g)&&(l=!0),x<=(l?g:_))p=Math.max(s.top,Math.min(r.top,s.bottom-v))-n.top,f=Math.min(400,l?g:_);else{u=!0,f=Math.min(400,(o?n.right:s.right-n.left)-30);let N=s.bottom-n.bottom;N>=v||N>n.top?p=r.bottom-n.top:(d="bottom",p=n.bottom-r.top)}let S=(n.bottom-n.top)/a.offsetHeight,w=(n.right-n.left)/a.offsetWidth;return{style:`${d}: ${p/S}px; max-width: ${f/w}px`,class:"cm-completionInfo-"+(u?o?"left-narrow":"right-narrow":l?"left":"right")}}const sT=Zt.define();function fwe(e){let n=e.addToOptions.slice();return e.icons&&n.push({render(r){let i=document.createElement("div");return i.classList.add("cm-completionIcon"),r.type&&i.classList.add(...r.type.split(/\s+/g).map(s=>"cm-completionIcon-"+s)),i.setAttribute("aria-hidden","true"),i},position:20}),n.push({render(r,i,s,a){let o=document.createElement("span");o.className="cm-completionLabel";let l=r.displayLabel||r.label,u=0;for(let d=0;d<a.length;){let p=a[d++],f=a[d++];p>u&&o.appendChild(document.createTextNode(l.slice(u,p)));let g=o.appendChild(document.createElement("span"));g.appendChild(document.createTextNode(l.slice(p,f))),g.className="cm-completionMatchedText",u=f}return u<l.length&&o.appendChild(document.createTextNode(l.slice(u))),o},position:50},{render(r){if(!r.detail)return null;let i=document.createElement("span");return i.className="cm-completionDetail",i.textContent=r.detail,i},position:80}),n.sort((r,i)=>r.position-i.position).map(r=>r.render)}function $S(e,n,r){if(e<=r)return{from:0,to:e};if(n<0&&(n=0),n<=e>>1){let s=Math.floor(n/r);return{from:s*r,to:(s+1)*r}}let i=Math.floor((e-n)/r);return{from:e-(i+1)*r,to:e-i*r}}class pwe{constructor(n,r,i){this.view=n,this.stateField=r,this.applyCompletion=i,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:u=>this.placeInfo(u),key:this},this.space=null,this.currentClass="";let s=n.state.field(r),{options:a,selected:o}=s.open,l=n.state.facet(fi);this.optionContent=fwe(l),this.optionClass=l.optionClass,this.tooltipClass=l.tooltipClass,this.range=$S(a.length,o,l.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(n.state),this.dom.addEventListener("mousedown",u=>{let{options:d}=n.state.field(r).open;for(let p=u.target,f;p&&p!=this.dom;p=p.parentNode)if(p.nodeName=="LI"&&(f=/-(\d+)$/.exec(p.id))&&+f[1]<d.length){this.applyCompletion(n,d[+f[1]]),u.preventDefault();return}if(u.target==this.list){let p=this.list.classList.contains("cm-completionListIncompleteTop")&&u.clientY<this.list.firstChild.getBoundingClientRect().top?this.range.from-1:this.list.classList.contains("cm-completionListIncompleteBottom")&&u.clientY>this.list.lastChild.getBoundingClientRect().bottom?this.range.to:null;p!=null&&(n.dispatch({effects:sT.of(p)}),u.preventDefault())}}),this.dom.addEventListener("focusout",u=>{let d=n.state.field(this.stateField,!1);d&&d.tooltip&&n.state.facet(fi).closeOnBlur&&u.relatedTarget!=n.contentDOM&&n.dispatch({effects:Fg.of(null)})}),this.showOptions(a,s.id)}mount(){this.updateSel()}showOptions(n,r){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(n,r,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(n){var r;let i=n.state.field(this.stateField),s=n.startState.field(this.stateField);if(this.updateTooltipClass(n.state),i!=s){let{options:a,selected:o,disabled:l}=i.open;(!s.open||s.open.options!=a)&&(this.range=$S(a.length,o,n.state.facet(fi).maxRenderedOptions),this.showOptions(a,i.id)),this.updateSel(),l!=((r=s.open)===null||r===void 0?void 0:r.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!l)}}updateTooltipClass(n){let r=this.tooltipClass(n);if(r!=this.currentClass){for(let i of this.currentClass.split(" "))i&&this.dom.classList.remove(i);for(let i of r.split(" "))i&&this.dom.classList.add(i);this.currentClass=r}}positioned(n){this.space=n,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let n=this.view.state.field(this.stateField),r=n.open;(r.selected>-1&&r.selected<this.range.from||r.selected>=this.range.to)&&(this.range=$S(r.options.length,r.selected,this.view.state.facet(fi).maxRenderedOptions),this.showOptions(r.options,n.id));let i=this.updateSelectedOption(r.selected);if(i){this.destroyInfo();let{completion:s}=r.options[r.selected],{info:a}=s;if(!a)return;let o=typeof a=="string"?document.createTextNode(a):a(s);if(!o)return;"then"in o?o.then(l=>{l&&this.view.state.field(this.stateField,!1)==n&&this.addInfoPane(l,s)}).catch(l=>es(this.view.state,l,"completion info")):(this.addInfoPane(o,s),i.setAttribute("aria-describedby",this.info.id))}}addInfoPane(n,r){this.destroyInfo();let i=this.info=document.createElement("div");if(i.className="cm-tooltip cm-completionInfo",i.id="cm-completionInfo-"+Math.floor(Math.random()*65535).toString(16),n.nodeType!=null)i.appendChild(n),this.infoDestroy=null;else{let{dom:s,destroy:a}=n;i.appendChild(s),this.infoDestroy=a||null}this.dom.appendChild(i),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(n){let r=null;for(let i=this.list.firstChild,s=this.range.from;i;i=i.nextSibling,s++)i.nodeName!="LI"||!i.id?s--:s==n?i.hasAttribute("aria-selected")||(i.setAttribute("aria-selected","true"),r=i):i.hasAttribute("aria-selected")&&(i.removeAttribute("aria-selected"),i.removeAttribute("aria-describedby"));return r&&gwe(this.list,r),r}measureInfo(){let n=this.dom.querySelector("[aria-selected]");if(!n||!this.info)return null;let r=this.dom.getBoundingClientRect(),i=this.info.getBoundingClientRect(),s=n.getBoundingClientRect(),a=this.space;if(!a){let o=this.dom.ownerDocument.documentElement;a={left:0,top:0,right:o.clientWidth,bottom:o.clientHeight}}return s.top>Math.min(a.bottom,r.bottom)-10||s.bottom<Math.max(a.top,r.top)+10?null:this.view.state.facet(fi).positionInfo(this.view,r,s,i,a,this.dom)}placeInfo(n){this.info&&(n?(n.style&&(this.info.style.cssText=n.style),this.info.className="cm-tooltip cm-completionInfo "+(n.class||"")):this.info.style.cssText="top: -1e6px")}createListBox(n,r,i){const s=document.createElement("ul");s.id=r,s.setAttribute("role","listbox"),s.setAttribute("aria-expanded","true"),s.setAttribute("aria-label",this.view.state.phrase("Completions")),s.addEventListener("mousedown",o=>{o.target==s&&o.preventDefault()});let a=null;for(let o=i.from;o<i.to;o++){let{completion:l,match:u}=n[o],{section:d}=l;if(d){let g=typeof d=="string"?d:d.name;if(g!=a&&(o>i.from||i.from==0))if(a=g,typeof d!="string"&&d.header)s.appendChild(d.header(d));else{let _=s.appendChild(document.createElement("completion-section"));_.textContent=g}}const p=s.appendChild(document.createElement("li"));p.id=r+"-"+o,p.setAttribute("role","option");let f=this.optionClass(l);f&&(p.className=f);for(let g of this.optionContent){let _=g(l,this.view.state,this.view,u);_&&p.appendChild(_)}}return i.from&&s.classList.add("cm-completionListIncompleteTop"),i.to<n.length&&s.classList.add("cm-completionListIncompleteBottom"),s}destroyInfo(){this.info&&(this.infoDestroy&&this.infoDestroy(),this.info.remove(),this.info=null)}destroy(){this.destroyInfo()}}function mwe(e,n){return r=>new pwe(r,e,n)}function gwe(e,n){let r=e.getBoundingClientRect(),i=n.getBoundingClientRect(),s=r.height/e.offsetHeight;i.top<r.top?e.scrollTop-=(r.top-i.top)/s:i.bottom>r.bottom&&(e.scrollTop+=(i.bottom-r.bottom)/s)}function IL(e){return(e.boost||0)*100+(e.apply?10:0)+(e.info?5:0)+(e.type?1:0)}function vwe(e,n){let r=[],i=null,s=null,a=p=>{r.push(p);let{section:f}=p.completion;if(f){i||(i=[]);let g=typeof f=="string"?f:f.name;i.some(_=>_.name==g)||i.push(typeof f=="string"?{name:g}:f)}},o=n.facet(fi);for(let p of e)if(p.hasResult()){let f=p.result.getMatch;if(p.result.filter===!1)for(let g of p.result.options)a(new DL(g,p.source,f?f(g):[],1e9-r.length));else{let g=n.sliceDoc(p.from,p.to),_,x=o.filterStrict?new dwe(g):new uwe(g);for(let v of p.result.options)if(_=x.match(v.label)){let S=v.displayLabel?f?f(v,_.matched):[]:_.matched,w=_.score+(v.boost||0);if(a(new DL(v,p.source,S,w)),typeof v.section=="object"&&v.section.rank==="dynamic"){let{name:N}=v.section;s||(s=Object.create(null)),s[N]=Math.max(w,s[N]||-1e9)}}}}if(i){let p=Object.create(null),f=0,g=(_,x)=>(_.rank==="dynamic"&&x.rank==="dynamic"?s[x.name]-s[_.name]:0)||(typeof _.rank=="number"?_.rank:1e9)-(typeof x.rank=="number"?x.rank:1e9)||(_.name<x.name?-1:1);for(let _ of i.sort(g))f-=1e5,p[_.name]=f;for(let _ of r){let{section:x}=_.completion;x&&(_.score+=p[typeof x=="string"?x:x.name])}}let l=[],u=null,d=o.compareCompletions;for(let p of r.sort((f,g)=>g.score-f.score||d(f.completion,g.completion))){let f=p.completion;!u||u.label!=f.label||u.detail!=f.detail||u.type!=null&&f.type!=null&&u.type!=f.type||u.apply!=f.apply||u.boost!=f.boost?l.push(p):IL(p.completion)>IL(u)&&(l[l.length-1]=p),u=p.completion}return l}class ef{constructor(n,r,i,s,a,o){this.options=n,this.attrs=r,this.tooltip=i,this.timestamp=s,this.selected=a,this.disabled=o}setSelected(n,r){return n==this.selected||n>=this.options.length?this:new ef(this.options,BL(r,n),this.tooltip,this.timestamp,n,this.disabled)}static build(n,r,i,s,a,o){if(s&&!o&&n.some(d=>d.isPending))return s.setDisabled();let l=vwe(n,r);if(!l.length)return s&&n.some(d=>d.isPending)?s.setDisabled():null;let u=r.facet(fi).selectOnOpen?0:-1;if(s&&s.selected!=u&&s.selected!=-1){let d=s.options[s.selected].completion;for(let p=0;p<l.length;p++)if(l[p].completion==d){u=p;break}}return new ef(l,BL(i,u),{pos:n.reduce((d,p)=>p.hasResult()?Math.min(d,p.from):d,1e8),create:wwe,above:a.aboveCursor},s?s.timestamp:Date.now(),u,!1)}map(n){return new ef(this.options,this.attrs,{...this.tooltip,pos:n.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new ef(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class Ob{constructor(n,r,i){this.active=n,this.id=r,this.open=i}static start(){return new Ob(bwe,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(n){let{state:r}=n,i=r.facet(fi),a=(i.override||r.languageDataAt("autocomplete",yd(r)).map(cwe)).map(u=>(this.active.find(p=>p.source==u)||new Ca(u,this.active.some(p=>p.state!=0)?1:0)).update(n,i));a.length==this.active.length&&a.every((u,d)=>u==this.active[d])&&(a=this.active);let o=this.open,l=n.effects.some(u=>u.is(aT));o&&n.docChanged&&(o=o.map(n.changes)),n.selection||a.some(u=>u.hasResult()&&n.changes.touchesRange(u.from,u.to))||!ywe(a,this.active)||l?o=ef.build(a,r,this.id,o,i,l):o&&o.disabled&&!a.some(u=>u.isPending)&&(o=null),!o&&a.every(u=>!u.isPending)&&a.some(u=>u.hasResult())&&(a=a.map(u=>u.hasResult()?new Ca(u.source,0):u));for(let u of n.effects)u.is(sT)&&(o=o&&o.setSelected(u.value,this.id));return a==this.active&&o==this.open?this:new Ob(a,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?_we:xwe}}function ywe(e,n){if(e==n)return!0;for(let r=0,i=0;;){for(;r<e.length&&!e[r].hasResult();)r++;for(;i<n.length&&!n[i].hasResult();)i++;let s=r==e.length,a=i==n.length;if(s||a)return s==a;if(e[r++].result!=n[i++].result)return!1}}const _we={"aria-autocomplete":"list"},xwe={};function BL(e,n){let r={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":e};return n>-1&&(r["aria-activedescendant"]=e+"-"+n),r}const bwe=[];function xq(e,n){if(e.isUserEvent("input.complete")){let i=e.annotation(_q);if(i&&n.activateOnCompletion(i))return 12}let r=e.isUserEvent("input.type");return r&&n.activateOnTyping?5:r?1:e.isUserEvent("delete.backward")?2:e.selection?8:e.docChanged?16:0}class Ca{constructor(n,r,i=!1){this.source=n,this.state=r,this.explicit=i}hasResult(){return!1}get isPending(){return this.state==1}update(n,r){let i=xq(n,r),s=this;(i&8||i&16&&this.touches(n))&&(s=new Ca(s.source,0)),i&4&&s.state==0&&(s=new Ca(this.source,1)),s=s.updateFor(n,i);for(let a of n.effects)if(a.is(Rb))s=new Ca(s.source,1,a.value);else if(a.is(Fg))s=new Ca(s.source,0);else if(a.is(aT))for(let o of a.value)o.source==s.source&&(s=o);return s}updateFor(n,r){return this.map(n.changes)}map(n){return this}touches(n){return n.changes.touchesRange(yd(n.state))}}class mf extends Ca{constructor(n,r,i,s,a,o){super(n,3,r),this.limit=i,this.result=s,this.from=a,this.to=o}hasResult(){return!0}updateFor(n,r){var i;if(!(r&3))return this.map(n.changes);let s=this.result;s.map&&!n.changes.empty&&(s=s.map(s,n.changes));let a=n.changes.mapPos(this.from),o=n.changes.mapPos(this.to,1),l=yd(n.state);if(l>o||!s||r&2&&(yd(n.startState)==this.from||l<this.limit))return new Ca(this.source,r&4?1:0);let u=n.changes.mapPos(this.limit);return kwe(s.validFor,n.state,a,o)?new mf(this.source,this.explicit,u,s,a,o):s.update&&(s=s.update(s,a,o,new vq(n.state,l,!1)))?new mf(this.source,this.explicit,u,s,s.from,(i=s.to)!==null&&i!==void 0?i:yd(n.state)):new Ca(this.source,1,this.explicit)}map(n){return n.empty?this:(this.result.map?this.result.map(this.result,n):this.result)?new mf(this.source,this.explicit,n.mapPos(this.limit),this.result,n.mapPos(this.from),n.mapPos(this.to,1)):new Ca(this.source,0)}touches(n){return n.changes.touchesRange(this.from,this.to)}}function kwe(e,n,r,i){if(!e)return!1;let s=n.sliceDoc(r,i);return typeof e=="function"?e(s,r,i,n):yq(e,!0).test(s)}const aT=Zt.define({map(e,n){return e.map(r=>r.map(n))}}),xs=vi.define({create(){return Ob.start()},update(e,n){return e.update(n)},provide:e=>[B0.from(e,n=>n.tooltip),St.contentAttributes.from(e,n=>n.attrs)]});function oT(e,n){const r=n.completion.apply||n.completion.label;let i=e.state.field(xs).active.find(s=>s.source==n.source);return i instanceof mf?(typeof r=="string"?e.dispatch({...lwe(e.state,r,i.from,i.to),annotations:_q.of(n.completion)}):r(e,n.completion,i.from,i.to),!0):!1}const wwe=mwe(xs,oT);function M_(e,n="option"){return r=>{let i=r.state.field(xs,!1);if(!i||!i.open||i.open.disabled||Date.now()-i.open.timestamp<r.state.facet(fi).interactionDelay)return!1;let s=1,a;n=="page"&&(a=QH(r,i.open.tooltip))&&(s=Math.max(2,Math.floor(a.dom.offsetHeight/a.dom.querySelector("li").offsetHeight)-1));let{length:o}=i.open.options,l=i.open.selected>-1?i.open.selected+s*(e?1:-1):e?0:o-1;return l<0?l=n=="page"?0:o-1:l>=o&&(l=n=="page"?o-1:0),r.dispatch({effects:sT.of(l)}),!0}}const Swe=e=>{let n=e.state.field(xs,!1);return e.state.readOnly||!n||!n.open||n.open.selected<0||n.open.disabled||Date.now()-n.open.timestamp<e.state.facet(fi).interactionDelay?!1:oT(e,n.open.options[n.open.selected])},FS=e=>e.state.field(xs,!1)?(e.dispatch({effects:Rb.of(!0)}),!0):!1,Cwe=e=>{let n=e.state.field(xs,!1);return!n||!n.active.some(r=>r.state!=0)?!1:(e.dispatch({effects:Fg.of(null)}),!0)};class jwe{constructor(n,r){this.active=n,this.context=r,this.time=Date.now(),this.updates=[],this.done=void 0}}const Nwe=50,Ewe=1e3,Awe=Cr.fromClass(class{constructor(e){this.view=e,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let n of e.state.field(xs).active)n.isPending&&this.startQuery(n)}update(e){let n=e.state.field(xs),r=e.state.facet(fi);if(!e.selectionSet&&!e.docChanged&&e.startState.field(xs)==n)return;let i=e.transactions.some(a=>{let o=xq(a,r);return o&8||(a.selection||a.docChanged)&&!(o&3)});for(let a=0;a<this.running.length;a++){let o=this.running[a];if(i||o.context.abortOnDocChange&&e.docChanged||o.updates.length+e.transactions.length>Nwe&&Date.now()-o.time>Ewe){for(let l of o.context.abortListeners)try{l()}catch(u){es(this.view.state,u)}o.context.abortListeners=null,this.running.splice(a--,1)}else o.updates.push(...e.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),e.transactions.some(a=>a.effects.some(o=>o.is(Rb)))&&(this.pendingStart=!0);let s=this.pendingStart?50:r.activateOnTypingDelay;if(this.debounceUpdate=n.active.some(a=>a.isPending&&!this.running.some(o=>o.active.source==a.source))?setTimeout(()=>this.startUpdate(),s):-1,this.composing!=0)for(let a of e.transactions)a.isUserEvent("input.type")?this.composing=2:this.composing==2&&a.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:e}=this.view,n=e.field(xs);for(let r of n.active)r.isPending&&!this.running.some(i=>i.active.source==r.source)&&this.startQuery(r);this.running.length&&n.open&&n.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(fi).updateSyncTime))}startQuery(e){let{state:n}=this.view,r=yd(n),i=new vq(n,r,e.explicit,this.view),s=new jwe(e,i);this.running.push(s),Promise.resolve(e.source(i)).then(a=>{s.context.aborted||(s.done=a||null,this.scheduleAccept())},a=>{this.view.dispatch({effects:Fg.of(null)}),es(this.view.state,a)})}scheduleAccept(){this.running.every(e=>e.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(fi).updateSyncTime))}accept(){var e;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let n=[],r=this.view.state.facet(fi),i=this.view.state.field(xs);for(let s=0;s<this.running.length;s++){let a=this.running[s];if(a.done===void 0)continue;if(this.running.splice(s--,1),a.done){let l=yd(a.updates.length?a.updates[0].startState:this.view.state),u=Math.min(l,a.done.from+(a.active.explicit?0:1)),d=new mf(a.active.source,a.active.explicit,u,a.done,a.done.from,(e=a.done.to)!==null&&e!==void 0?e:l);for(let p of a.updates)d=d.update(p,r);if(d.hasResult()){n.push(d);continue}}let o=i.active.find(l=>l.source==a.active.source);if(o&&o.isPending)if(a.done==null){let l=new Ca(a.active.source,0);for(let u of a.updates)l=l.update(u,r);l.isPending||n.push(l)}else this.startQuery(o)}(n.length||i.open&&i.open.disabled)&&this.view.dispatch({effects:aT.of(n)})}},{eventHandlers:{blur(e){let n=this.view.state.field(xs,!1);if(n&&n.tooltip&&this.view.state.facet(fi).closeOnBlur){let r=n.open&&QH(this.view,n.open.tooltip);(!r||!r.dom.contains(e.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:Fg.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:Rb.of(!1)}),20),this.composing=0}}}),Twe=typeof navigator=="object"&&/Win/.test(navigator.platform),Mwe=Ld.highest(St.domEventHandlers({keydown(e,n){let r=n.state.field(xs,!1);if(!r||!r.open||r.open.disabled||r.open.selected<0||e.key.length>1||e.ctrlKey&&!(Twe&&e.altKey)||e.metaKey)return!1;let i=r.open.options[r.open.selected],s=r.active.find(o=>o.source==i.source),a=i.completion.commitCharacters||s.result.commitCharacters;return a&&a.indexOf(e.key)>-1&&oT(n,i),!1}})),Rwe=St.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}}),Hg={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},ud=Zt.define({map(e,n){let r=n.mapPos(e,-1,Zi.TrackAfter);return r??void 0}}),lT=new class extends su{};lT.startSide=1;lT.endSide=-1;const bq=vi.define({create(){return on.empty},update(e,n){if(e=e.map(n.changes),n.selection){let r=n.state.doc.lineAt(n.selection.main.head);e=e.update({filter:i=>i>=r.from&&i<=r.to})}for(let r of n.effects)r.is(ud)&&(e=e.update({add:[lT.range(r.value,r.value+1)]}));return e}});function Owe(){return[Pwe,bq]}const HS="()[]{}<>«»»«［］｛｝";function kq(e){for(let n=0;n<HS.length;n+=2)if(HS.charCodeAt(n)==e)return HS.charAt(n+1);return EA(e<128?e:e+1)}function wq(e,n){return e.languageDataAt("closeBrackets",n)[0]||Hg}const Dwe=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),Pwe=St.inputHandler.of((e,n,r,i)=>{if((Dwe?e.composing:e.compositionStarted)||e.state.readOnly)return!1;let s=e.state.selection.main;if(i.length>2||i.length==2&&Do(_s(i,0))==1||n!=s.from||r!=s.to)return!1;let a=Bwe(e.state,i);return a?(e.dispatch(a),!0):!1}),Lwe=({state:e,dispatch:n})=>{if(e.readOnly)return!1;let i=wq(e,e.selection.main.head).brackets||Hg.brackets,s=null,a=e.changeByRange(o=>{if(o.empty){let l=zwe(e.doc,o.head);for(let u of i)if(u==l&&K0(e.doc,o.head)==kq(_s(u,0)))return{changes:{from:o.head-u.length,to:o.head+u.length},range:Ze.cursor(o.head-u.length)}}return{range:s=o}});return s||n(e.update(a,{scrollIntoView:!0,userEvent:"delete.backward"})),!s},Iwe=[{key:"Backspace",run:Lwe}];function Bwe(e,n){let r=wq(e,e.selection.main.head),i=r.brackets||Hg.brackets;for(let s of i){let a=kq(_s(s,0));if(n==s)return a==s?Hwe(e,s,i.indexOf(s+s+s)>-1,r):$we(e,s,a,r.before||Hg.before);if(n==a&&Sq(e,e.selection.main.from))return Fwe(e,s,a)}return null}function Sq(e,n){let r=!1;return e.field(bq).between(0,e.doc.length,i=>{i==n&&(r=!0)}),r}function K0(e,n){let r=e.sliceString(n,n+2);return r.slice(0,Do(_s(r,0)))}function zwe(e,n){let r=e.sliceString(n-2,n);return Do(_s(r,0))==r.length?r:r.slice(1)}function $we(e,n,r,i){let s=null,a=e.changeByRange(o=>{if(!o.empty)return{changes:[{insert:n,from:o.from},{insert:r,from:o.to}],effects:ud.of(o.to+n.length),range:Ze.range(o.anchor+n.length,o.head+n.length)};let l=K0(e.doc,o.head);return!l||/\s/.test(l)||i.indexOf(l)>-1?{changes:{insert:n+r,from:o.head},effects:ud.of(o.head+n.length),range:Ze.cursor(o.head+n.length)}:{range:s=o}});return s?null:e.update(a,{scrollIntoView:!0,userEvent:"input.type"})}function Fwe(e,n,r){let i=null,s=e.changeByRange(a=>a.empty&&K0(e.doc,a.head)==r?{changes:{from:a.head,to:a.head+r.length,insert:r},range:Ze.cursor(a.head+r.length)}:i={range:a});return i?null:e.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function Hwe(e,n,r,i){let s=i.stringPrefixes||Hg.stringPrefixes,a=null,o=e.changeByRange(l=>{if(!l.empty)return{changes:[{insert:n,from:l.from},{insert:n,from:l.to}],effects:ud.of(l.to+n.length),range:Ze.range(l.anchor+n.length,l.head+n.length)};let u=l.head,d=K0(e.doc,u),p;if(d==n){if(zL(e,u))return{changes:{insert:n+n,from:u},effects:ud.of(u+n.length),range:Ze.cursor(u+n.length)};if(Sq(e,u)){let g=r&&e.sliceDoc(u,u+n.length*3)==n+n+n?n+n+n:n;return{changes:{from:u,to:u+g.length,insert:g},range:Ze.cursor(u+g.length)}}}else{if(r&&e.sliceDoc(u-2*n.length,u)==n+n&&(p=$L(e,u-2*n.length,s))>-1&&zL(e,p))return{changes:{insert:n+n+n+n,from:u},effects:ud.of(u+n.length),range:Ze.cursor(u+n.length)};if(e.charCategorizer(u)(d)!=yr.Word&&$L(e,u,s)>-1&&!Wwe(e,u,n,s))return{changes:{insert:n+n,from:u},effects:ud.of(u+n.length),range:Ze.cursor(u+n.length)}}return{range:a=l}});return a?null:e.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function zL(e,n){let r=qi(e).resolveInner(n+1);return r.parent&&r.from==n}function Wwe(e,n,r,i){let s=qi(e).resolveInner(n,-1),a=i.reduce((o,l)=>Math.max(o,l.length),0);for(let o=0;o<5;o++){let l=e.sliceDoc(s.from,Math.min(s.to,s.from+r.length+a)),u=l.indexOf(r);if(!u||u>-1&&i.indexOf(l.slice(0,u))>-1){let p=s.firstChild;for(;p&&p.from==s.from&&p.to-p.from>r.length+u;){if(e.sliceDoc(p.to-r.length,p.to)==r)return!1;p=p.firstChild}return!0}let d=s.to==n&&s.parent;if(!d)break;s=d}return!1}function $L(e,n,r){let i=e.charCategorizer(n);if(i(e.sliceDoc(n-1,n))!=yr.Word)return n;for(let s of r){let a=n-s.length;if(e.sliceDoc(a,n)==s&&i(e.sliceDoc(a-1,a))!=yr.Word)return a}return-1}function qwe(e={}){return[Mwe,xs,fi.of(e),Awe,Uwe,Rwe]}const Cq=[{key:"Ctrl-Space",run:FS},{mac:"Alt-`",run:FS},{mac:"Alt-i",run:FS},{key:"Escape",run:Cwe},{key:"ArrowDown",run:M_(!0)},{key:"ArrowUp",run:M_(!1)},{key:"PageDown",run:M_(!0,"page")},{key:"PageUp",run:M_(!1,"page")},{key:"Enter",run:Swe}],Uwe=Ld.highest(I0.computeN([fi],e=>e.facet(fi).defaultKeymap?[Cq]:[]));class FL{constructor(n,r,i){this.from=n,this.to=r,this.diagnostic=i}}class nd{constructor(n,r,i){this.diagnostics=n,this.panel=r,this.selected=i}static init(n,r,i){let s=i.facet(Ho).markerFilter;s&&(n=s(n,i));let a=n.slice().sort((_,x)=>_.from-x.from||_.to-x.to),o=new Kl,l=[],u=0,d=i.doc.iter(),p=0,f=i.doc.length;for(let _=0;;){let x=_==a.length?null:a[_];if(!x&&!l.length)break;let v,S;if(l.length)v=u,S=l.reduce((C,T)=>Math.min(C,T.to),x&&x.from>v?x.from:1e8);else{if(v=x.from,v>f)break;S=x.to,l.push(x),_++}for(;_<a.length;){let C=a[_];if(C.from==v&&(C.to>C.from||C.to==v))l.push(C),_++,S=Math.min(C.to,S);else{S=Math.min(C.from,S);break}}S=Math.min(S,f);let w=!1;if(l.some(C=>C.from==v&&(C.to==S||S==f))&&(w=v==S,!w&&S-v<10)){let C=v-(p+d.value.length);C>0&&(d.next(C),p=v);for(let T=v;;){if(T>=S){w=!0;break}if(!d.lineBreak&&p+d.value.length>T)break;T=p+d.value.length,p+=d.value.length,d.next()}}let N=Rq(l);if(w)o.add(v,v,Wt.widget({widget:new tSe(N),diagnostics:l.slice()}));else{let C=l.reduce((T,A)=>A.markClass?T+" "+A.markClass:T,"");o.add(v,S,Wt.mark({class:"cm-lintRange cm-lintRange-"+N+C,diagnostics:l.slice(),inclusiveEnd:l.some(T=>T.to>S)}))}if(u=S,u==f)break;for(let C=0;C<l.length;C++)l[C].to<=u&&l.splice(C--,1)}let g=o.finish();return new nd(g,r,du(g))}}function du(e,n=null,r=0){let i=null;return e.between(r,1e9,(s,a,{spec:o})=>{if(!(n&&o.diagnostics.indexOf(n)<0))if(!i)i=new FL(s,a,n||o.diagnostics[0]);else{if(o.diagnostics.indexOf(i.diagnostic)<0)return!1;i=new FL(i.from,a,i.diagnostic)}}),i}function jq(e,n){let r=n.pos,i=n.end||r,s=e.state.facet(Ho).hideOn(e,r,i);if(s!=null)return s;let a=e.startState.doc.lineAt(n.pos);return!!(e.effects.some(o=>o.is(Y0))||e.changes.touchesRange(a.from,Math.max(a.to,i)))}function Nq(e,n){return e.field(Zs,!1)?n:n.concat(Zt.appendConfig.of(Pq))}function Vwe(e,n){return{effects:Nq(e,[Y0.of(n)])}}const Y0=Zt.define(),cT=Zt.define(),Eq=Zt.define(),Zs=vi.define({create(){return new nd(Wt.none,null,null)},update(e,n){if(n.docChanged&&e.diagnostics.size){let r=e.diagnostics.map(n.changes),i=null,s=e.panel;if(e.selected){let a=n.changes.mapPos(e.selected.from,1);i=du(r,e.selected.diagnostic,a)||du(r,null,a)}!r.size&&s&&n.state.facet(Ho).autoPanel&&(s=null),e=new nd(r,s,i)}for(let r of n.effects)if(r.is(Y0)){let i=n.state.facet(Ho).autoPanel?r.value.length?Wg.open:null:e.panel;e=nd.init(r.value,i,n.state)}else r.is(cT)?e=new nd(e.diagnostics,r.value?Wg.open:null,e.selected):r.is(Eq)&&(e=new nd(e.diagnostics,e.panel,r.value));return e},provide:e=>[Lg.from(e,n=>n.panel),St.decorations.from(e,n=>n.diagnostics)]}),Kwe=Wt.mark({class:"cm-lintRange cm-lintRange-active"});function Ywe(e,n,r){let{diagnostics:i}=e.state.field(Zs),s,a=-1,o=-1;i.between(n-(r<0?1:0),n+(r>0?1:0),(u,d,{spec:p})=>{if(n>=u&&n<=d&&(u==d||(n>u||r>0)&&(n<d||r<0)))return s=p.diagnostics,a=u,o=d,!1});let l=e.state.facet(Ho).tooltipFilter;return s&&l&&(s=l(s,e.state)),s?{pos:a,end:o,above:e.state.doc.lineAt(a).to<o,create(){return{dom:Aq(e,s)}}}:null}function Aq(e,n){return Vn("ul",{class:"cm-tooltip-lint"},n.map(r=>Mq(e,r,!1)))}const Gwe=e=>{let n=e.state.field(Zs,!1);(!n||!n.panel)&&e.dispatch({effects:Nq(e.state,[cT.of(!0)])});let r=UA(e,Wg.open);return r&&r.dom.querySelector(".cm-panel-lint ul").focus(),!0},HL=e=>{let n=e.state.field(Zs,!1);return!n||!n.panel?!1:(e.dispatch({effects:cT.of(!1)}),!0)},Xwe=e=>{let n=e.state.field(Zs,!1);if(!n)return!1;let r=e.state.selection.main,i=du(n.diagnostics,null,r.to+1);return!i&&(i=du(n.diagnostics,null,0),!i||i.from==r.from&&i.to==r.to)?!1:(e.dispatch({selection:{anchor:i.from,head:i.to},scrollIntoView:!0}),!0)},Qwe=[{key:"Mod-Shift-m",run:Gwe,preventDefault:!0},{key:"F8",run:Xwe}],Zwe=Cr.fromClass(class{constructor(e){this.view=e,this.timeout=-1,this.set=!0;let{delay:n}=e.state.facet(Ho);this.lintTime=Date.now()+n,this.run=this.run.bind(this),this.timeout=setTimeout(this.run,n)}run(){clearTimeout(this.timeout);let e=Date.now();if(e<this.lintTime-10)this.timeout=setTimeout(this.run,this.lintTime-e);else{this.set=!1;let{state:n}=this.view,{sources:r}=n.facet(Ho);r.length&&Jwe(r.map(i=>Promise.resolve(i(this.view))),i=>{this.view.state.doc==n.doc&&this.view.dispatch(Vwe(this.view.state,i.reduce((s,a)=>s.concat(a))))},i=>{es(this.view.state,i)})}}update(e){let n=e.state.facet(Ho);(e.docChanged||n!=e.startState.facet(Ho)||n.needsRefresh&&n.needsRefresh(e))&&(this.lintTime=Date.now()+n.delay,this.set||(this.set=!0,this.timeout=setTimeout(this.run,n.delay)))}force(){this.set&&(this.lintTime=Date.now(),this.run())}destroy(){clearTimeout(this.timeout)}});function Jwe(e,n,r){let i=[],s=-1;for(let a of e)a.then(o=>{i.push(o),clearTimeout(s),i.length==e.length?n(i):s=setTimeout(()=>n(i),200)},r)}const Ho=jt.define({combine(e){return{sources:e.map(n=>n.source).filter(n=>n!=null),...ro(e.map(n=>n.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:WL,tooltipFilter:WL,needsRefresh:(n,r)=>n?r?i=>n(i)||r(i):n:r,hideOn:(n,r)=>n?r?(i,s,a)=>n(i,s,a)||r(i,s,a):n:r,autoPanel:(n,r)=>n||r})}}});function WL(e,n){return e?n?(r,i)=>n(e(r,i),i):e:n}function eSe(e,n={}){return[Ho.of({source:e,config:n}),Zwe,Pq]}function Tq(e){let n=[];if(e)e:for(let{name:r}of e){for(let i=0;i<r.length;i++){let s=r[i];if(/[a-zA-Z]/.test(s)&&!n.some(a=>a.toLowerCase()==s.toLowerCase())){n.push(s);continue e}}n.push("")}return n}function Mq(e,n,r){var i;let s=r?Tq(n.actions):[];return Vn("li",{class:"cm-diagnostic cm-diagnostic-"+n.severity},Vn("span",{class:"cm-diagnosticText"},n.renderMessage?n.renderMessage(e):n.message),(i=n.actions)===null||i===void 0?void 0:i.map((a,o)=>{let l=!1,u=_=>{if(_.preventDefault(),l)return;l=!0;let x=du(e.state.field(Zs).diagnostics,n);x&&a.apply(e,x.from,x.to)},{name:d}=a,p=s[o]?d.indexOf(s[o]):-1,f=p<0?d:[d.slice(0,p),Vn("u",d.slice(p,p+1)),d.slice(p+1)],g=a.markClass?" "+a.markClass:"";return Vn("button",{type:"button",class:"cm-diagnosticAction"+g,onclick:u,onmousedown:u,"aria-label":` Action: ${d}${p<0?"":` (access key "${s[o]})"`}.`},f)}),n.source&&Vn("div",{class:"cm-diagnosticSource"},n.source))}class tSe extends nl{constructor(n){super(),this.sev=n}eq(n){return n.sev==this.sev}toDOM(){return Vn("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class qL{constructor(n,r){this.diagnostic=r,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=Mq(n,r,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class Wg{constructor(n){this.view=n,this.items=[];let r=s=>{if(!(s.ctrlKey||s.altKey||s.metaKey)){if(s.keyCode==27)HL(this.view),this.view.focus();else if(s.keyCode==38||s.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(s.keyCode==40||s.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(s.keyCode==36)this.moveSelection(0);else if(s.keyCode==35)this.moveSelection(this.items.length-1);else if(s.keyCode==13)this.view.focus();else if(s.keyCode>=65&&s.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:a}=this.items[this.selectedIndex],o=Tq(a.actions);for(let l=0;l<o.length;l++)if(o[l].toUpperCase().charCodeAt(0)==s.keyCode){let u=du(this.view.state.field(Zs).diagnostics,a);u&&a.actions[l].apply(n,u.from,u.to)}}else return;s.preventDefault()}},i=s=>{for(let a=0;a<this.items.length;a++)this.items[a].dom.contains(s.target)&&this.moveSelection(a)};this.list=Vn("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:r,onclick:i}),this.dom=Vn("div",{class:"cm-panel-lint"},this.list,Vn("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>HL(this.view)},"×")),this.update()}get selectedIndex(){let n=this.view.state.field(Zs).selected;if(!n)return-1;for(let r=0;r<this.items.length;r++)if(this.items[r].diagnostic==n.diagnostic)return r;return-1}update(){let{diagnostics:n,selected:r}=this.view.state.field(Zs),i=0,s=!1,a=null,o=new Set;for(n.between(0,this.view.state.doc.length,(l,u,{spec:d})=>{for(let p of d.diagnostics){if(o.has(p))continue;o.add(p);let f=-1,g;for(let _=i;_<this.items.length;_++)if(this.items[_].diagnostic==p){f=_;break}f<0?(g=new qL(this.view,p),this.items.splice(i,0,g),s=!0):(g=this.items[f],f>i&&(this.items.splice(i,f-i),s=!0)),r&&g.diagnostic==r.diagnostic?g.dom.hasAttribute("aria-selected")||(g.dom.setAttribute("aria-selected","true"),a=g):g.dom.hasAttribute("aria-selected")&&g.dom.removeAttribute("aria-selected"),i++}});i<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)s=!0,this.items.pop();this.items.length==0&&(this.items.push(new qL(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),s=!0),a?(this.list.setAttribute("aria-activedescendant",a.id),this.view.requestMeasure({key:this,read:()=>({sel:a.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:l,panel:u})=>{let d=u.height/this.list.offsetHeight;l.top<u.top?this.list.scrollTop-=(u.top-l.top)/d:l.bottom>u.bottom&&(this.list.scrollTop+=(l.bottom-u.bottom)/d)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),s&&this.sync()}sync(){let n=this.list.firstChild;function r(){let i=n;n=i.nextSibling,i.remove()}for(let i of this.items)if(i.dom.parentNode==this.list){for(;n!=i.dom;)r();n=i.dom.nextSibling}else this.list.insertBefore(i.dom,n);for(;n;)r()}moveSelection(n){if(this.selectedIndex<0)return;let r=this.view.state.field(Zs),i=du(r.diagnostics,this.items[n].diagnostic);i&&this.view.dispatch({selection:{anchor:i.from,head:i.to},scrollIntoView:!0,effects:Eq.of(i)})}static open(n){return new Wg(n)}}function kx(e,n='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${n}>${encodeURIComponent(e)}</svg>')`}function R_(e){return kx(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${e}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}const nSe=St.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:R_("#d11")},".cm-lintRange-warning":{backgroundImage:R_("orange")},".cm-lintRange-info":{backgroundImage:R_("#999")},".cm-lintRange-hint":{backgroundImage:R_("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}},"&dark .cm-lintRange-active":{backgroundColor:"#86714a80"},"&dark .cm-panel.cm-panel-lint ul":{"& [aria-selected]":{backgroundColor:"#2e343e"}}});function rSe(e){return e=="error"?4:e=="warning"?3:e=="info"?2:1}function Rq(e){let n="hint",r=1;for(let i of e){let s=rSe(i.severity);s>r&&(r=s,n=i.severity)}return n}class Oq extends Xo{constructor(n){super(),this.diagnostics=n,this.severity=Rq(n)}toDOM(n){let r=document.createElement("div");r.className="cm-lint-marker cm-lint-marker-"+this.severity;let i=this.diagnostics,s=n.state.facet(G0).tooltipFilter;return s&&(i=s(i,n.state)),i.length&&(r.onmouseover=()=>sSe(n,r,i)),r}}function iSe(e,n){let r=i=>{let s=n.getBoundingClientRect();if(!(i.clientX>s.left-10&&i.clientX<s.right+10&&i.clientY>s.top-10&&i.clientY<s.bottom+10)){for(let a=i.target;a;a=a.parentNode)if(a.nodeType==1&&a.classList.contains("cm-tooltip-lint"))return;window.removeEventListener("mousemove",r),e.state.field(Dq)&&e.dispatch({effects:uT.of(null)})}};window.addEventListener("mousemove",r)}function sSe(e,n,r){function i(){let o=e.elementAtHeight(n.getBoundingClientRect().top+5-e.documentTop);e.coordsAtPos(o.from)&&e.dispatch({effects:uT.of({pos:o.from,above:!1,clip:!1,create(){return{dom:Aq(e,r),getCoords:()=>n.getBoundingClientRect()}}})}),n.onmouseout=n.onmousemove=null,iSe(e,n)}let{hoverTime:s}=e.state.facet(G0),a=setTimeout(i,s);n.onmouseout=()=>{clearTimeout(a),n.onmouseout=n.onmousemove=null},n.onmousemove=()=>{clearTimeout(a),a=setTimeout(i,s)}}function aSe(e,n){let r=Object.create(null);for(let s of n){let a=e.lineAt(s.from);(r[a.from]||(r[a.from]=[])).push(s)}let i=[];for(let s in r)i.push(new Oq(r[s]).range(+s));return on.of(i,!0)}const oSe=tW({class:"cm-gutter-lint",markers:e=>e.state.field(vN),widgetMarker:(e,n,r)=>{let i=[];return e.state.field(vN).between(r.from,r.to,(s,a,o)=>{s>r.from&&s<r.to&&i.push(...o.diagnostics)}),i.length?new Oq(i):null}}),vN=vi.define({create(){return on.empty},update(e,n){e=e.map(n.changes);let r=n.state.facet(G0).markerFilter;for(let i of n.effects)if(i.is(Y0)){let s=i.value;r&&(s=r(s||[],n.state)),e=aSe(n.state.doc,s.slice(0))}return e}}),uT=Zt.define(),Dq=vi.define({create(){return null},update(e,n){return e&&n.docChanged&&(e=jq(n,e)?null:{...e,pos:n.changes.mapPos(e.pos)}),n.effects.reduce((r,i)=>i.is(uT)?i.value:r,e)},provide:e=>B0.from(e)}),lSe=St.baseTheme({".cm-gutter-lint":{width:"1.4em","& .cm-gutterElement":{padding:".2em"}},".cm-lint-marker":{width:"1em",height:"1em"},".cm-lint-marker-info":{content:kx('<path fill="#aaf" stroke="#77e" stroke-width="6" stroke-linejoin="round" d="M5 5L35 5L35 35L5 35Z"/>')},".cm-lint-marker-warning":{content:kx('<path fill="#fe8" stroke="#fd7" stroke-width="6" stroke-linejoin="round" d="M20 6L37 35L3 35Z"/>')},".cm-lint-marker-error":{content:kx('<circle cx="20" cy="20" r="15" fill="#f87" stroke="#f43" stroke-width="6"/>')}}),Pq=[Zs,St.decorations.compute([Zs],e=>{let{selected:n,panel:r}=e.field(Zs);return!n||!r||n.from==n.to?Wt.none:Wt.set([Kwe.range(n.from,n.to)])}),Xbe(Ywe,{hideOn:jq}),nSe],G0=jt.define({combine(e){return ro(e,{hoverTime:300,markerFilter:null,tooltipFilter:null})}});function cSe(e={}){return[G0.of(e),vN,oSe,lSe,Dq]}var UL=function(n){n===void 0&&(n={});var{crosshairCursor:r=!1}=n,i=[];n.closeBracketsKeymap!==!1&&(i=i.concat(Iwe)),n.defaultKeymap!==!1&&(i=i.concat(A1e)),n.searchKeymap!==!1&&(i=i.concat(nwe)),n.historyKeymap!==!1&&(i=i.concat(Lke)),n.foldKeymap!==!1&&(i=i.concat(X0e)),n.completionKeymap!==!1&&(i=i.concat(Cq)),n.lintKeymap!==!1&&(i=i.concat(Qwe));var s=[];return n.lineNumbers!==!1&&s.push(l0e()),n.highlightActiveLineGutter!==!1&&s.push(d0e()),n.highlightSpecialChars!==!1&&s.push(Cbe()),n.history!==!1&&s.push(Nke()),n.foldGutter!==!1&&s.push(eke()),n.drawSelection!==!1&&s.push(pbe()),n.dropCursor!==!1&&s.push(_be()),n.allowMultipleSelections!==!1&&s.push(bn.allowMultipleSelections.of(!0)),n.indentOnInput!==!1&&s.push($0e()),n.syntaxHighlighting!==!1&&s.push(CW(ike,{fallback:!0})),n.bracketMatching!==!1&&s.push(dke()),n.closeBrackets!==!1&&s.push(Owe()),n.autocompletion!==!1&&s.push(qwe()),n.rectangularSelection!==!1&&s.push(zbe()),r!==!1&&s.push(Hbe()),n.highlightActiveLine!==!1&&s.push(Mbe()),n.highlightSelectionMatches!==!1&&s.push(P1e()),n.tabSize&&typeof n.tabSize=="number"&&s.push($0.of(" ".repeat(n.tabSize))),s.concat([I0.of(i.flat())]).filter(Boolean)};const uSe="#e5c07b",VL="#e06c75",dSe="#56b6c2",hSe="#ffffff",wx="#abb2bf",yN="#7d8799",fSe="#61afef",pSe="#98c379",KL="#d19a66",mSe="#c678dd",gSe="#21252b",YL="#2c313a",GL="#282c34",WS="#353a42",vSe="#3E4451",XL="#528bff",ySe=St.theme({"&":{color:wx,backgroundColor:GL},".cm-content":{caretColor:XL},".cm-cursor, .cm-dropCursor":{borderLeftColor:XL},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:vSe},".cm-panels":{backgroundColor:gSe,color:wx},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:"1px solid #457dff"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff2f"},".cm-activeLine":{backgroundColor:"#6699ff0b"},".cm-selectionMatch":{backgroundColor:"#aafe661a"},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bad0f847"},".cm-gutters":{backgroundColor:GL,color:yN,border:"none"},".cm-activeLineGutter":{backgroundColor:YL},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:WS},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:WS,borderBottomColor:WS},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:YL,color:wx}}},{dark:!0}),_Se=Av.define([{tag:We.keyword,color:mSe},{tag:[We.name,We.deleted,We.character,We.propertyName,We.macroName],color:VL},{tag:[We.function(We.variableName),We.labelName],color:fSe},{tag:[We.color,We.constant(We.name),We.standard(We.name)],color:KL},{tag:[We.definition(We.name),We.separator],color:wx},{tag:[We.typeName,We.className,We.number,We.changed,We.annotation,We.modifier,We.self,We.namespace],color:uSe},{tag:[We.operator,We.operatorKeyword,We.url,We.escape,We.regexp,We.link,We.special(We.string)],color:dSe},{tag:[We.meta,We.comment],color:yN},{tag:We.strong,fontWeight:"bold"},{tag:We.emphasis,fontStyle:"italic"},{tag:We.strikethrough,textDecoration:"line-through"},{tag:We.link,color:yN,textDecoration:"underline"},{tag:We.heading,fontWeight:"bold",color:VL},{tag:[We.atom,We.bool,We.special(We.variableName)],color:KL},{tag:[We.processingInstruction,We.string,We.inserted],color:pSe},{tag:We.invalid,color:hSe}]),xSe=[ySe,CW(_Se)];var bSe=St.theme({"&":{backgroundColor:"#fff"}},{dark:!1}),kSe=function(n){n===void 0&&(n={});var{indentWithTab:r=!0,editable:i=!0,readOnly:s=!1,theme:a="light",placeholder:o="",basicSetup:l=!0}=n,u=[];switch(r&&u.unshift(I0.of([T1e])),l&&(typeof l=="boolean"?u.unshift(UL()):u.unshift(UL(l))),o&&u.unshift(Pbe(o)),a){case"light":u.push(bSe);break;case"dark":u.push(xSe);break;case"none":break;default:u.push(a);break}return i===!1&&u.push(St.editable.of(!1)),s&&u.push(bn.readOnly.of(!0)),[...u]},wSe=e=>({line:e.state.doc.lineAt(e.state.selection.main.from),lineCount:e.state.doc.lines,lineBreak:e.state.lineBreak,length:e.state.doc.length,readOnly:e.state.readOnly,tabSize:e.state.tabSize,selection:e.state.selection,selectionAsSingle:e.state.selection.asSingle().main,ranges:e.state.selection.ranges,selectionCode:e.state.sliceDoc(e.state.selection.main.from,e.state.selection.main.to),selections:e.state.selection.ranges.map(n=>e.state.sliceDoc(n.from,n.to)),selectedText:e.state.selection.ranges.some(n=>!n.empty)});class SSe{constructor(n,r){this.timeLeftMS=void 0,this.timeoutMS=void 0,this.isCancelled=!1,this.isTimeExhausted=!1,this.callbacks=[],this.timeLeftMS=r,this.timeoutMS=r,this.callbacks.push(n)}tick(){if(!this.isCancelled&&!this.isTimeExhausted&&(this.timeLeftMS--,this.timeLeftMS<=0)){this.isTimeExhausted=!0;var n=this.callbacks.slice();this.callbacks.length=0,n.forEach(r=>{try{r()}catch(i){console.error("TimeoutLatch callback error:",i)}})}}cancel(){this.isCancelled=!0,this.callbacks.length=0}reset(){this.timeLeftMS=this.timeoutMS,this.isCancelled=!1,this.isTimeExhausted=!1}get isDone(){return this.isCancelled||this.isTimeExhausted}}class QL{constructor(){this.interval=null,this.latches=new Set}add(n){this.latches.add(n),this.start()}remove(n){this.latches.delete(n),this.latches.size===0&&this.stop()}start(){this.interval===null&&(this.interval=setInterval(()=>{this.latches.forEach(n=>{n.tick(),n.isDone&&this.remove(n)})},1))}stop(){this.interval!==null&&(clearInterval(this.interval),this.interval=null)}}var qS=null,CSe=()=>typeof window>"u"?new QL:(qS||(qS=new QL),qS),ZL=tl.define(),jSe=200,NSe=[];function ESe(e){var{value:n,selection:r,onChange:i,onStatistics:s,onCreateEditor:a,onUpdate:o,extensions:l=NSe,autoFocus:u,theme:d="light",height:p=null,minHeight:f=null,maxHeight:g=null,width:_=null,minWidth:x=null,maxWidth:v=null,placeholder:S="",editable:w=!0,readOnly:N=!1,indentWithTab:C=!0,basicSetup:T=!0,root:A,initialState:E}=e,[D,F]=b.useState(),[B,H]=b.useState(),[$,z]=b.useState(),W=b.useState(()=>({current:null}))[0],P=b.useState(()=>({current:null}))[0],q=St.theme({"&":{height:p,minHeight:f,maxHeight:g,width:_,minWidth:x,maxWidth:v},"& .cm-scroller":{height:"100% !important"}}),I=St.updateListener.of(Z=>{if(Z.docChanged&&typeof i=="function"&&!Z.transactions.some(U=>U.annotation(ZL))){W.current?W.current.reset():(W.current=new SSe(()=>{if(P.current){var U=P.current;P.current=null,U()}W.current=null},jSe),CSe().add(W.current));var Y=Z.state.doc,R=Y.toString();i(R,Z)}s&&s(wSe(Z))}),Q=kSe({theme:d,editable:w,readOnly:N,placeholder:S,indentWithTab:C,basicSetup:T}),K=[I,q,...Q];return o&&typeof o=="function"&&K.push(St.updateListener.of(o)),K=K.concat(l),b.useLayoutEffect(()=>{if(D&&!$){var Z={doc:n,selection:r,extensions:K},Y=E?bn.fromJSON(E.json,Z,E.fields):bn.create(Z);if(z(Y),!B){var R=new St({state:Y,parent:D,root:A});H(R),a&&a(R,Y)}}return()=>{B&&(z(void 0),H(void 0))}},[D,$]),b.useEffect(()=>{e.container&&F(e.container)},[e.container]),b.useEffect(()=>()=>{B&&(B.destroy(),H(void 0)),W.current&&(W.current.cancel(),W.current=null)},[B]),b.useEffect(()=>{u&&B&&B.focus()},[u,B]),b.useEffect(()=>{B&&B.dispatch({effects:Zt.reconfigure.of(K)})},[d,l,p,f,g,_,x,v,S,w,N,C,T,i,o]),b.useEffect(()=>{if(n!==void 0){var Z=B?B.state.doc.toString():"";if(B&&n!==Z){var Y=W.current&&!W.current.isDone,R=()=>{B&&n!==B.state.doc.toString()&&B.dispatch({changes:{from:0,to:B.state.doc.toString().length,insert:n||""},annotations:[ZL.of(!0)]})};Y?P.current=R:R()}}},[n,B]),{state:$,setState:z,view:B,setView:H,container:D,setContainer:F}}var ASe=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"],Lq=b.forwardRef((e,n)=>{var{className:r,value:i="",selection:s,extensions:a=[],onChange:o,onStatistics:l,onCreateEditor:u,onUpdate:d,autoFocus:p,theme:f="light",height:g,minHeight:_,maxHeight:x,width:v,minWidth:S,maxWidth:w,basicSetup:N,placeholder:C,indentWithTab:T,editable:A,readOnly:E,root:D,initialState:F}=e,B=n_e(e,ASe),H=b.useRef(null),{state:$,view:z,container:W,setContainer:P}=ESe({root:D,value:i,autoFocus:p,theme:f,height:g,minHeight:_,maxHeight:x,width:v,minWidth:S,maxWidth:w,basicSetup:N,placeholder:C,indentWithTab:T,editable:A,readOnly:E,selection:s,onChange:o,onStatistics:l,onCreateEditor:u,onUpdate:d,extensions:a,initialState:F});b.useImperativeHandle(n,()=>({editor:H.current,state:$,view:z}),[H,W,$,z]);var q=b.useCallback(Q=>{H.current=Q,P(Q)},[P]);if(typeof i!="string")throw new Error("value must be typeof string but got "+typeof i);var I=typeof f=="string"?"cm-theme-"+f:"cm-theme";return c.jsx("div",wj({ref:q,className:""+I+(r?" "+r:"")},B))});Lq.displayName="CodeMirror";var JL={};class Db{constructor(n,r,i,s,a,o,l,u,d,p=0,f){this.p=n,this.stack=r,this.state=i,this.reducePos=s,this.pos=a,this.score=o,this.buffer=l,this.bufferBase=u,this.curContext=d,this.lookAhead=p,this.parent=f}toString(){return`[${this.stack.filter((n,r)=>r%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(n,r,i=0){let s=n.parser.context;return new Db(n,[],r,i,i,0,[],0,s?new e6(s,s.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(n,r){this.stack.push(this.state,r,this.bufferBase+this.buffer.length),this.state=n}reduce(n){var r;let i=n>>19,s=n&65535,{parser:a}=this.p,o=this.reducePos<this.pos-25&&this.setLookAhead(this.pos),l=a.dynamicPrecedence(s);if(l&&(this.score+=l),i==0){s<a.minRepeatTerm&&this.reducePos<this.pos&&(this.reducePos=this.pos),this.pushState(a.getGoto(this.state,s,!0),this.reducePos),s<a.minRepeatTerm&&this.storeNode(s,this.reducePos,this.reducePos,o?8:4,!0),this.reduceContext(s,this.reducePos);return}let u=this.stack.length-(i-1)*3-(n&262144?6:0),d=u?this.stack[u-2]:this.p.ranges[0].from;s<a.minRepeatTerm&&d==this.reducePos&&this.reducePos<this.pos&&(this.reducePos=this.pos);let p=this.reducePos-d;p>=2e3&&!(!((r=this.p.parser.nodeSet.types[s])===null||r===void 0)&&r.isAnonymous)&&(d==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=p):this.p.lastBigReductionSize<p&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=d,this.p.lastBigReductionSize=p));let f=u?this.stack[u-1]:0,g=this.bufferBase+this.buffer.length-f;if(s<a.minRepeatTerm||n&131072){let _=a.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(s,d,_,g+4,!0)}if(n&262144)this.state=this.stack[u];else{let _=this.stack[u-3];this.state=a.getGoto(_,s,!0)}for(;this.stack.length>u;)this.stack.pop();this.reduceContext(s,d)}storeNode(n,r,i,s=4,a=!1){if(n==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let o=this,l=this.buffer.length;if(l==0&&o.parent&&(l=o.bufferBase-o.parent.bufferBase,o=o.parent),l>0&&o.buffer[l-4]==0&&o.buffer[l-1]>-1){if(r==i)return;if(o.buffer[l-2]>=r){o.buffer[l-2]=i;return}}}if(!a||this.pos==i)this.buffer.push(n,r,i,s);else{let o=this.buffer.length;if(o>0&&(this.buffer[o-4]!=0||this.buffer[o-1]<0)){let l=!1;for(let u=o;u>0&&this.buffer[u-2]>i;u-=4)if(this.buffer[u-1]>=0){l=!0;break}if(l)for(;o>0&&this.buffer[o-2]>i;)this.buffer[o]=this.buffer[o-4],this.buffer[o+1]=this.buffer[o-3],this.buffer[o+2]=this.buffer[o-2],this.buffer[o+3]=this.buffer[o-1],o-=4,s>4&&(s-=4)}this.buffer[o]=n,this.buffer[o+1]=r,this.buffer[o+2]=i,this.buffer[o+3]=s}}shift(n,r,i,s){if(n&131072)this.pushState(n&65535,this.pos);else if((n&262144)==0){let a=n,{parser:o}=this.p;this.pos=s;let l=o.stateFlag(a,1);!l&&(s>i||r<=o.maxNode)&&(this.reducePos=s),this.pushState(a,l?i:Math.min(i,this.reducePos)),this.shiftContext(r,i),r<=o.maxNode&&this.buffer.push(r,i,s,4)}else this.pos=s,this.shiftContext(r,i),r<=this.p.parser.maxNode&&this.buffer.push(r,i,s,4)}apply(n,r,i,s){n&65536?this.reduce(n):this.shift(n,r,i,s)}useNode(n,r){let i=this.p.reused.length-1;(i<0||this.p.reused[i]!=n)&&(this.p.reused.push(n),i++);let s=this.pos;this.reducePos=this.pos=s+n.length,this.pushState(r,s),this.buffer.push(i,s,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,n,this,this.p.stream.reset(this.pos-n.length)))}split(){let n=this,r=n.buffer.length;for(;r>0&&n.buffer[r-2]>n.reducePos;)r-=4;let i=n.buffer.slice(r),s=n.bufferBase+r;for(;n&&s==n.bufferBase;)n=n.parent;return new Db(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,i,s,this.curContext,this.lookAhead,n)}recoverByDelete(n,r){let i=n<=this.p.parser.maxNode;i&&this.storeNode(n,this.pos,r,4),this.storeNode(0,this.pos,r,i?8:4),this.pos=this.reducePos=r,this.score-=190}canShift(n){for(let r=new TSe(this);;){let i=this.p.parser.stateSlot(r.state,4)||this.p.parser.hasAction(r.state,n);if(i==0)return!1;if((i&65536)==0)return!0;r.reduce(i)}}recoverByInsert(n){if(this.stack.length>=300)return[];let r=this.p.parser.nextStates(this.state);if(r.length>8||this.stack.length>=120){let s=[];for(let a=0,o;a<r.length;a+=2)(o=r[a+1])!=this.state&&this.p.parser.hasAction(o,n)&&s.push(r[a],o);if(this.stack.length<120)for(let a=0;s.length<8&&a<r.length;a+=2){let o=r[a+1];s.some((l,u)=>u&1&&l==o)||s.push(r[a],o)}r=s}let i=[];for(let s=0;s<r.length&&i.length<4;s+=2){let a=r[s+1];if(a==this.state)continue;let o=this.split();o.pushState(a,this.pos),o.storeNode(0,o.pos,o.pos,4,!0),o.shiftContext(r[s],this.pos),o.reducePos=this.pos,o.score-=200,i.push(o)}return i}forceReduce(){let{parser:n}=this.p,r=n.stateSlot(this.state,5);if((r&65536)==0)return!1;if(!n.validAction(this.state,r)){let i=r>>19,s=r&65535,a=this.stack.length-i*3;if(a<0||n.getGoto(this.stack[a],s,!1)<0){let o=this.findForcedReduction();if(o==null)return!1;r=o}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(r),!0}findForcedReduction(){let{parser:n}=this.p,r=[],i=(s,a)=>{if(!r.includes(s))return r.push(s),n.allActions(s,o=>{if(!(o&393216))if(o&65536){let l=(o>>19)-a;if(l>1){let u=o&65535,d=this.stack.length-l*3;if(d>=0&&n.getGoto(this.stack[d],u,!1)>=0)return l<<19|65536|u}}else{let l=i(o,a+1);if(l!=null)return l}})};return i(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:n}=this.p;return n.data[n.stateSlot(this.state,1)]==65535&&!n.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(n){if(this.state!=n.state||this.stack.length!=n.stack.length)return!1;for(let r=0;r<this.stack.length;r+=3)if(this.stack[r]!=n.stack[r])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(n){return this.p.parser.dialect.flags[n]}shiftContext(n,r){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,n,this,this.p.stream.reset(r)))}reduceContext(n,r){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,n,this,this.p.stream.reset(r)))}emitContext(){let n=this.buffer.length-1;(n<0||this.buffer[n]!=-3)&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let n=this.buffer.length-1;(n<0||this.buffer[n]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(n){if(n!=this.curContext.context){let r=new e6(this.curContext.tracker,n);r.hash!=this.curContext.hash&&this.emitContext(),this.curContext=r}}setLookAhead(n){return n<=this.lookAhead?!1:(this.emitLookAhead(),this.lookAhead=n,!0)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class e6{constructor(n,r){this.tracker=n,this.context=r,this.hash=n.strict?n.hash(r):0}}class TSe{constructor(n){this.start=n,this.state=n.state,this.stack=n.stack,this.base=this.stack.length}reduce(n){let r=n&65535,i=n>>19;i==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(i-1)*3;let s=this.start.p.parser.getGoto(this.stack[this.base-3],r,!0);this.state=s}}class Pb{constructor(n,r,i){this.stack=n,this.pos=r,this.index=i,this.buffer=n.buffer,this.index==0&&this.maybeNext()}static create(n,r=n.bufferBase+n.buffer.length){return new Pb(n,r,r-n.bufferBase)}maybeNext(){let n=this.stack.parent;n!=null&&(this.index=this.stack.bufferBase-n.bufferBase,this.stack=n,this.buffer=n.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new Pb(this.stack,this.pos,this.index)}}function O_(e,n=Uint16Array){if(typeof e!="string")return e;let r=null;for(let i=0,s=0;i<e.length;){let a=0;for(;;){let o=e.charCodeAt(i++),l=!1;if(o==126){a=65535;break}o>=92&&o--,o>=34&&o--;let u=o-32;if(u>=46&&(u-=46,l=!0),a+=u,l)break;a*=46}r?r[s++]=a:r=new n(a)}return r}class Sx{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const t6=new Sx;class MSe{constructor(n,r){this.input=n,this.ranges=r,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=t6,this.rangeIndex=0,this.pos=this.chunkPos=r[0].from,this.range=r[0],this.end=r[r.length-1].to,this.readNext()}resolveOffset(n,r){let i=this.range,s=this.rangeIndex,a=this.pos+n;for(;a<i.from;){if(!s)return null;let o=this.ranges[--s];a-=i.from-o.to,i=o}for(;r<0?a>i.to:a>=i.to;){if(s==this.ranges.length-1)return null;let o=this.ranges[++s];a+=o.from-i.to,i=o}return a}clipPos(n){if(n>=this.range.from&&n<this.range.to)return n;for(let r of this.ranges)if(r.to>n)return Math.max(n,r.from);return this.end}peek(n){let r=this.chunkOff+n,i,s;if(r>=0&&r<this.chunk.length)i=this.pos+n,s=this.chunk.charCodeAt(r);else{let a=this.resolveOffset(n,1);if(a==null)return-1;if(i=a,i>=this.chunk2Pos&&i<this.chunk2Pos+this.chunk2.length)s=this.chunk2.charCodeAt(i-this.chunk2Pos);else{let o=this.rangeIndex,l=this.range;for(;l.to<=i;)l=this.ranges[++o];this.chunk2=this.input.chunk(this.chunk2Pos=i),i+this.chunk2.length>l.to&&(this.chunk2=this.chunk2.slice(0,l.to-i)),s=this.chunk2.charCodeAt(0)}}return i>=this.token.lookAhead&&(this.token.lookAhead=i+1),s}acceptToken(n,r=0){let i=r?this.resolveOffset(r,-1):this.pos;if(i==null||i<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=n,this.token.end=i}acceptTokenTo(n,r){this.token.value=n,this.token.end=r}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:n,chunkPos:r}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=n,this.chunk2Pos=r,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let n=this.input.chunk(this.pos),r=this.pos+n.length;this.chunk=r>this.range.to?n.slice(0,this.range.to-this.pos):n,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(n=1){for(this.chunkOff+=n;this.pos+n>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();n-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=n,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(n,r){if(r?(this.token=r,r.start=n,r.lookAhead=n+1,r.value=r.extended=-1):this.token=t6,this.pos!=n){if(this.pos=n,n==this.end)return this.setDone(),this;for(;n<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;n>=this.range.to;)this.range=this.ranges[++this.rangeIndex];n>=this.chunkPos&&n<this.chunkPos+this.chunk.length?this.chunkOff=n-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(n,r){if(n>=this.chunkPos&&r<=this.chunkPos+this.chunk.length)return this.chunk.slice(n-this.chunkPos,r-this.chunkPos);if(n>=this.chunk2Pos&&r<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(n-this.chunk2Pos,r-this.chunk2Pos);if(n>=this.range.from&&r<=this.range.to)return this.input.read(n,r);let i="";for(let s of this.ranges){if(s.from>=r)break;s.to>n&&(i+=this.input.read(Math.max(s.from,n),Math.min(s.to,r)))}return i}}class gf{constructor(n,r){this.data=n,this.id=r}token(n,r){let{parser:i}=r.p;RSe(this.data,n,r,this.id,i.data,i.tokenPrecTable)}}gf.prototype.contextual=gf.prototype.fallback=gf.prototype.extend=!1;gf.prototype.fallback=gf.prototype.extend=!1;class X0{constructor(n,r={}){this.token=n,this.contextual=!!r.contextual,this.fallback=!!r.fallback,this.extend=!!r.extend}}function RSe(e,n,r,i,s,a){let o=0,l=1<<i,{dialect:u}=r.p.parser;e:for(;(l&e[o])!=0;){let d=e[o+1];for(let _=o+3;_<d;_+=2)if((e[_+1]&l)>0){let x=e[_];if(u.allows(x)&&(n.token.value==-1||n.token.value==x||OSe(x,n.token.value,s,a))){n.acceptToken(x);break}}let p=n.next,f=0,g=e[o+2];if(n.next<0&&g>f&&e[d+g*3-3]==65535){o=e[d+g*3-1];continue e}for(;f<g;){let _=f+g>>1,x=d+_+(_<<1),v=e[x],S=e[x+1]||65536;if(p<v)g=_;else if(p>=S)f=_+1;else{o=e[x+2],n.advance();continue e}}break}}function n6(e,n,r){for(let i=n,s;(s=e[i])!=65535;i++)if(s==r)return i-n;return-1}function OSe(e,n,r,i){let s=n6(r,i,n);return s<0||n6(r,i,e)<s}const Us=typeof process<"u"&&JL&&/\bparse\b/.test(JL.LOG);let US=null;function r6(e,n,r){let i=e.cursor(Mr.IncludeAnonymous);for(i.moveTo(n);;)if(!(r<0?i.childBefore(n):i.childAfter(n)))for(;;){if((r<0?i.to<n:i.from>n)&&!i.type.isError)return r<0?Math.max(0,Math.min(i.to-1,n-25)):Math.min(e.length,Math.max(i.from+1,n+25));if(r<0?i.prevSibling():i.nextSibling())break;if(!i.parent())return r<0?0:e.length}}class DSe{constructor(n,r){this.fragments=n,this.nodeSet=r,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let n=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(n){for(this.safeFrom=n.openStart?r6(n.tree,n.from+n.offset,1)-n.offset:n.from,this.safeTo=n.openEnd?r6(n.tree,n.to+n.offset,-1)-n.offset:n.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(n.tree),this.start.push(-n.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(n){if(n<this.nextStart)return null;for(;this.fragment&&this.safeTo<=n;)this.nextFragment();if(!this.fragment)return null;for(;;){let r=this.trees.length-1;if(r<0)return this.nextFragment(),null;let i=this.trees[r],s=this.index[r];if(s==i.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let a=i.children[s],o=this.start[r]+i.positions[s];if(o>n)return this.nextStart=o,null;if(a instanceof zr){if(o==n){if(o<this.safeFrom)return null;let l=o+a.length;if(l<=this.safeTo){let u=a.prop(hn.lookAhead);if(!u||l+u<this.fragment.to)return a}}this.index[r]++,o+a.length>=Math.max(this.safeFrom,n)&&(this.trees.push(a),this.start.push(o),this.index.push(0))}else this.index[r]++,this.nextStart=o+a.length}}}class PSe{constructor(n,r){this.stream=r,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=n.tokenizers.map(i=>new Sx)}getActions(n){let r=0,i=null,{parser:s}=n.p,{tokenizers:a}=s,o=s.stateSlot(n.state,3),l=n.curContext?n.curContext.hash:0,u=0;for(let d=0;d<a.length;d++){if((1<<d&o)==0)continue;let p=a[d],f=this.tokens[d];if(!(i&&!p.fallback)&&((p.contextual||f.start!=n.pos||f.mask!=o||f.context!=l)&&(this.updateCachedToken(f,p,n),f.mask=o,f.context=l),f.lookAhead>f.end+25&&(u=Math.max(f.lookAhead,u)),f.value!=0)){let g=r;if(f.extended>-1&&(r=this.addActions(n,f.extended,f.end,r)),r=this.addActions(n,f.value,f.end,r),!p.extend&&(i=f,r>g))break}}for(;this.actions.length>r;)this.actions.pop();return u&&n.setLookAhead(u),!i&&n.pos==this.stream.end&&(i=new Sx,i.value=n.p.parser.eofTerm,i.start=i.end=n.pos,r=this.addActions(n,i.value,i.end,r)),this.mainToken=i,this.actions}getMainToken(n){if(this.mainToken)return this.mainToken;let r=new Sx,{pos:i,p:s}=n;return r.start=i,r.end=Math.min(i+1,s.stream.end),r.value=i==s.stream.end?s.parser.eofTerm:0,r}updateCachedToken(n,r,i){let s=this.stream.clipPos(i.pos);if(r.token(this.stream.reset(s,n),i),n.value>-1){let{parser:a}=i.p;for(let o=0;o<a.specialized.length;o++)if(a.specialized[o]==n.value){let l=a.specializers[o](this.stream.read(n.start,n.end),i);if(l>=0&&i.p.parser.dialect.allows(l>>1)){(l&1)==0?n.value=l>>1:n.extended=l>>1;break}}}else n.value=0,n.end=this.stream.clipPos(s+1)}putAction(n,r,i,s){for(let a=0;a<s;a+=3)if(this.actions[a]==n)return s;return this.actions[s++]=n,this.actions[s++]=r,this.actions[s++]=i,s}addActions(n,r,i,s){let{state:a}=n,{parser:o}=n.p,{data:l}=o;for(let u=0;u<2;u++)for(let d=o.stateSlot(a,u?2:1);;d+=3){if(l[d]==65535)if(l[d+1]==1)d=Tl(l,d+2);else{s==0&&l[d+1]==2&&(s=this.putAction(Tl(l,d+2),r,i,s));break}l[d]==r&&(s=this.putAction(Tl(l,d+1),r,i,s))}return s}}class LSe{constructor(n,r,i,s){this.parser=n,this.input=r,this.ranges=s,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new MSe(r,s),this.tokens=new PSe(n,this.stream),this.topTerm=n.top[1];let{from:a}=s[0];this.stacks=[Db.start(this,n.top[0],a)],this.fragments=i.length&&this.stream.end-a>n.bufferLength*4?new DSe(i,n.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let n=this.stacks,r=this.minStackPos,i=this.stacks=[],s,a;if(this.bigReductionCount>300&&n.length==1){let[o]=n;for(;o.forceReduce()&&o.stack.length&&o.stack[o.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let o=0;o<n.length;o++){let l=n[o];for(;;){if(this.tokens.mainToken=null,l.pos>r)i.push(l);else{if(this.advanceStack(l,i,n))continue;{s||(s=[],a=[]),s.push(l);let u=this.tokens.getMainToken(l);a.push(u.value,u.end)}}break}}if(!i.length){let o=s&&zSe(s);if(o)return Us&&console.log("Finish with "+this.stackID(o)),this.stackToTree(o);if(this.parser.strict)throw Us&&s&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+r);this.recovering||(this.recovering=5)}if(this.recovering&&s){let o=this.stoppedAt!=null&&s[0].pos>this.stoppedAt?s[0]:this.runRecovery(s,a,i);if(o)return Us&&console.log("Force-finish "+this.stackID(o)),this.stackToTree(o.forceAll())}if(this.recovering){let o=this.recovering==1?1:this.recovering*3;if(i.length>o)for(i.sort((l,u)=>u.score-l.score);i.length>o;)i.pop();i.some(l=>l.reducePos>r)&&this.recovering--}else if(i.length>1){e:for(let o=0;o<i.length-1;o++){let l=i[o];for(let u=o+1;u<i.length;u++){let d=i[u];if(l.sameState(d)||l.buffer.length>500&&d.buffer.length>500)if((l.score-d.score||l.buffer.length-d.buffer.length)>0)i.splice(u--,1);else{i.splice(o--,1);continue e}}}i.length>12&&(i.sort((o,l)=>l.score-o.score),i.splice(12,i.length-12))}this.minStackPos=i[0].pos;for(let o=1;o<i.length;o++)i[o].pos<this.minStackPos&&(this.minStackPos=i[o].pos);return null}stopAt(n){if(this.stoppedAt!=null&&this.stoppedAt<n)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=n}advanceStack(n,r,i){let s=n.pos,{parser:a}=this,o=Us?this.stackID(n)+" -> ":"";if(this.stoppedAt!=null&&s>this.stoppedAt)return n.forceReduce()?n:null;if(this.fragments){let d=n.curContext&&n.curContext.tracker.strict,p=d?n.curContext.hash:0;for(let f=this.fragments.nodeAt(s);f;){let g=this.parser.nodeSet.types[f.type.id]==f.type?a.getGoto(n.state,f.type.id):-1;if(g>-1&&f.length&&(!d||(f.prop(hn.contextHash)||0)==p))return n.useNode(f,g),Us&&console.log(o+this.stackID(n)+` (via reuse of ${a.getName(f.type.id)})`),!0;if(!(f instanceof zr)||f.children.length==0||f.positions[0]>0)break;let _=f.children[0];if(_ instanceof zr&&f.positions[0]==0)f=_;else break}}let l=a.stateSlot(n.state,4);if(l>0)return n.reduce(l),Us&&console.log(o+this.stackID(n)+` (via always-reduce ${a.getName(l&65535)})`),!0;if(n.stack.length>=8400)for(;n.stack.length>6e3&&n.forceReduce(););let u=this.tokens.getActions(n);for(let d=0;d<u.length;){let p=u[d++],f=u[d++],g=u[d++],_=d==u.length||!i,x=_?n:n.split(),v=this.tokens.mainToken;if(x.apply(p,f,v?v.start:x.pos,g),Us&&console.log(o+this.stackID(x)+` (via ${(p&65536)==0?"shift":`reduce of ${a.getName(p&65535)}`} for ${a.getName(f)} @ ${s}${x==n?"":", split"})`),_)return!0;x.pos>s?r.push(x):i.push(x)}return!1}advanceFully(n,r){let i=n.pos;for(;;){if(!this.advanceStack(n,null,null))return!1;if(n.pos>i)return i6(n,r),!0}}runRecovery(n,r,i){let s=null,a=!1;for(let o=0;o<n.length;o++){let l=n[o],u=r[o<<1],d=r[(o<<1)+1],p=Us?this.stackID(l)+" -> ":"";if(l.deadEnd&&(a||(a=!0,l.restart(),Us&&console.log(p+this.stackID(l)+" (restarted)"),this.advanceFully(l,i))))continue;let f=l.split(),g=p;for(let _=0;_<10&&f.forceReduce()&&(Us&&console.log(g+this.stackID(f)+" (via force-reduce)"),!this.advanceFully(f,i));_++)Us&&(g=this.stackID(f)+" -> ");for(let _ of l.recoverByInsert(u))Us&&console.log(p+this.stackID(_)+" (via recover-insert)"),this.advanceFully(_,i);this.stream.end>l.pos?(d==l.pos&&(d++,u=0),l.recoverByDelete(u,d),Us&&console.log(p+this.stackID(l)+` (via recover-delete ${this.parser.getName(u)})`),i6(l,i)):(!s||s.score<f.score)&&(s=f)}return s}stackToTree(n){return n.close(),zr.build({buffer:Pb.create(n),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:n.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(n){let r=(US||(US=new WeakMap)).get(n);return r||US.set(n,r=String.fromCodePoint(this.nextStackID++)),r+n}}function i6(e,n){for(let r=0;r<n.length;r++){let i=n[r];if(i.pos==e.pos&&i.sameState(e)){n[r].score<e.score&&(n[r]=e);return}}n.push(e)}class ISe{constructor(n,r,i){this.source=n,this.flags=r,this.disabled=i}allows(n){return!this.disabled||this.disabled[n]==0}}const VS=e=>e;class BSe{constructor(n){this.start=n.start,this.shift=n.shift||VS,this.reduce=n.reduce||VS,this.reuse=n.reuse||VS,this.hash=n.hash||(()=>0),this.strict=n.strict!==!1}}class Lb extends lW{constructor(n){if(super(),this.wrappers=[],n.version!=14)throw new RangeError(`Parser version (${n.version}) doesn't match runtime version (14)`);let r=n.nodeNames.split(" ");this.minRepeatTerm=r.length;for(let l=0;l<n.repeatNodeCount;l++)r.push("");let i=Object.keys(n.topRules).map(l=>n.topRules[l][1]),s=[];for(let l=0;l<r.length;l++)s.push([]);function a(l,u,d){s[l].push([u,u.deserialize(String(d))])}if(n.nodeProps)for(let l of n.nodeProps){let u=l[0];typeof u=="string"&&(u=hn[u]);for(let d=1;d<l.length;){let p=l[d++];if(p>=0)a(p,u,l[d++]);else{let f=l[d+-p];for(let g=-p;g>0;g--)a(l[d++],u,f);d++}}}this.nodeSet=new VA(r.map((l,u)=>As.define({name:u>=this.minRepeatTerm?void 0:l,id:u,props:s[u],top:i.indexOf(u)>-1,error:u==0,skipped:n.skippedNodes&&n.skippedNodes.indexOf(u)>-1}))),n.propSources&&(this.nodeSet=this.nodeSet.extend(...n.propSources)),this.strict=!1,this.bufferLength=iW;let o=O_(n.tokenData);this.context=n.context,this.specializerSpecs=n.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let l=0;l<this.specializerSpecs.length;l++)this.specialized[l]=this.specializerSpecs[l].term;this.specializers=this.specializerSpecs.map(s6),this.states=O_(n.states,Uint32Array),this.data=O_(n.stateData),this.goto=O_(n.goto),this.maxTerm=n.maxTerm,this.tokenizers=n.tokenizers.map(l=>typeof l=="number"?new gf(o,l):l),this.topRules=n.topRules,this.dialects=n.dialects||{},this.dynamicPrecedences=n.dynamicPrecedences||null,this.tokenPrecTable=n.tokenPrec,this.termNames=n.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(n,r,i){let s=new LSe(this,n,r,i);for(let a of this.wrappers)s=a(s,n,r,i);return s}getGoto(n,r,i=!1){let s=this.goto;if(r>=s[0])return-1;for(let a=s[r+1];;){let o=s[a++],l=o&1,u=s[a++];if(l&&i)return u;for(let d=a+(o>>1);a<d;a++)if(s[a]==n)return u;if(l)return-1}}hasAction(n,r){let i=this.data;for(let s=0;s<2;s++)for(let a=this.stateSlot(n,s?2:1),o;;a+=3){if((o=i[a])==65535)if(i[a+1]==1)o=i[a=Tl(i,a+2)];else{if(i[a+1]==2)return Tl(i,a+2);break}if(o==r||o==0)return Tl(i,a+1)}return 0}stateSlot(n,r){return this.states[n*6+r]}stateFlag(n,r){return(this.stateSlot(n,0)&r)>0}validAction(n,r){return!!this.allActions(n,i=>i==r?!0:null)}allActions(n,r){let i=this.stateSlot(n,4),s=i?r(i):void 0;for(let a=this.stateSlot(n,1);s==null;a+=3){if(this.data[a]==65535)if(this.data[a+1]==1)a=Tl(this.data,a+2);else break;s=r(Tl(this.data,a+1))}return s}nextStates(n){let r=[];for(let i=this.stateSlot(n,1);;i+=3){if(this.data[i]==65535)if(this.data[i+1]==1)i=Tl(this.data,i+2);else break;if((this.data[i+2]&1)==0){let s=this.data[i+1];r.some((a,o)=>o&1&&a==s)||r.push(this.data[i],s)}}return r}configure(n){let r=Object.assign(Object.create(Lb.prototype),this);if(n.props&&(r.nodeSet=this.nodeSet.extend(...n.props)),n.top){let i=this.topRules[n.top];if(!i)throw new RangeError(`Invalid top rule name ${n.top}`);r.top=i}return n.tokenizers&&(r.tokenizers=this.tokenizers.map(i=>{let s=n.tokenizers.find(a=>a.from==i);return s?s.to:i})),n.specializers&&(r.specializers=this.specializers.slice(),r.specializerSpecs=this.specializerSpecs.map((i,s)=>{let a=n.specializers.find(l=>l.from==i.external);if(!a)return i;let o=Object.assign(Object.assign({},i),{external:a.to});return r.specializers[s]=s6(o),o})),n.contextTracker&&(r.context=n.contextTracker),n.dialect&&(r.dialect=this.parseDialect(n.dialect)),n.strict!=null&&(r.strict=n.strict),n.wrap&&(r.wrappers=r.wrappers.concat(n.wrap)),n.bufferLength!=null&&(r.bufferLength=n.bufferLength),r}hasWrappers(){return this.wrappers.length>0}getName(n){return this.termNames?this.termNames[n]:String(n<=this.maxNode&&this.nodeSet.types[n].name||n)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(n){let r=this.dynamicPrecedences;return r==null?0:r[n]||0}parseDialect(n){let r=Object.keys(this.dialects),i=r.map(()=>!1);if(n)for(let a of n.split(" ")){let o=r.indexOf(a);o>=0&&(i[o]=!0)}let s=null;for(let a=0;a<r.length;a++)if(!i[a])for(let o=this.dialects[r[a]],l;(l=this.data[o++])!=65535;)(s||(s=new Uint8Array(this.maxTerm+1)))[l]=1;return new ISe(n,i,s)}static deserialize(n){return new Lb(n)}}function Tl(e,n){return e[n]|e[n+1]<<16}function zSe(e){let n=null;for(let r of e){let i=r.p.stoppedAt;(r.pos==r.p.stream.end||i!=null&&r.pos>i)&&r.p.parser.stateFlag(r.state,2)&&(!n||n.score<r.score)&&(n=r)}return n}function s6(e){if(e.external){let n=e.extend?1:0;return(r,i)=>e.external(r,i)<<1|n}return e.get}const Hh=63,a6=64,$Se=1,FSe=2,Iq=3,HSe=4,Bq=5,WSe=6,qSe=7,zq=65,USe=66,VSe=8,KSe=9,YSe=10,GSe=11,XSe=12,$q=13,QSe=19,ZSe=20,JSe=29,e2e=33,t2e=34,n2e=47,r2e=0,dT=1,_N=2,qg=3,xN=4;class rd{constructor(n,r,i){this.parent=n,this.depth=r,this.type=i,this.hash=(n?n.hash+n.hash<<8:0)+r+(r<<4)+i}}rd.top=new rd(null,-1,r2e);function ag(e,n){for(let r=0,i=n-e.pos-1;;i--,r++){let s=e.peek(i);if(Gl(s)||s==-1)return r}}function bN(e){return e==32||e==9}function Gl(e){return e==10||e==13}function Fq(e){return bN(e)||Gl(e)}function dd(e){return e<0||Fq(e)}const i2e=new BSe({start:rd.top,reduce(e,n){return e.type==qg&&(n==ZSe||n==t2e)?e.parent:e},shift(e,n,r,i){if(n==Iq)return new rd(e,ag(i,i.pos),dT);if(n==zq||n==Bq)return new rd(e,ag(i,i.pos),_N);if(n==Hh)return e.parent;if(n==QSe||n==e2e)return new rd(e,0,qg);if(n==$q&&e.type==xN)return e.parent;if(n==n2e){let s=/[1-9]/.exec(i.read(i.pos,r.pos));if(s)return new rd(e,e.depth+ +s[0],xN)}return e},hash(e){return e.hash}});function $f(e,n,r=0){return e.peek(r)==n&&e.peek(r+1)==n&&e.peek(r+2)==n&&dd(e.peek(r+3))}const s2e=new X0((e,n)=>{if(e.next==-1&&n.canShift(a6))return e.acceptToken(a6);let r=e.peek(-1);if((Gl(r)||r<0)&&n.context.type!=qg){if($f(e,45))if(n.canShift(Hh))e.acceptToken(Hh);else return e.acceptToken($Se,3);if($f(e,46))if(n.canShift(Hh))e.acceptToken(Hh);else return e.acceptToken(FSe,3);let i=0;for(;e.next==32;)i++,e.advance();(i<n.context.depth||i==n.context.depth&&n.context.type==dT&&(e.next!=45||!dd(e.peek(1))))&&e.next!=-1&&!Gl(e.next)&&e.next!=35&&e.acceptToken(Hh,-i)}},{contextual:!0}),a2e=new X0((e,n)=>{if(n.context.type==qg){e.next==63&&(e.advance(),dd(e.next)&&e.acceptToken(qSe));return}if(e.next==45)e.advance(),dd(e.next)&&e.acceptToken(n.context.type==dT&&n.context.depth==ag(e,e.pos-1)?HSe:Iq);else if(e.next==63)e.advance(),dd(e.next)&&e.acceptToken(n.context.type==_N&&n.context.depth==ag(e,e.pos-1)?WSe:Bq);else{let r=e.pos;for(;;)if(bN(e.next)){if(e.pos==r)return;e.advance()}else if(e.next==33)Hq(e);else if(e.next==38)kN(e);else if(e.next==42){kN(e);break}else if(e.next==39||e.next==34){if(hT(e,!0))break;return}else if(e.next==91||e.next==123){if(!l2e(e))return;break}else{Wq(e,!0,!1,0);break}for(;bN(e.next);)e.advance();if(e.next==58){if(e.pos==r&&n.canShift(JSe))return;let i=e.peek(1);dd(i)&&e.acceptTokenTo(n.context.type==_N&&n.context.depth==ag(e,r)?USe:zq,r)}}},{contextual:!0});function o2e(e){return e>32&&e<127&&e!=34&&e!=37&&e!=44&&e!=60&&e!=62&&e!=92&&e!=94&&e!=96&&e!=123&&e!=124&&e!=125}function o6(e){return e>=48&&e<=57||e>=97&&e<=102||e>=65&&e<=70}function l6(e,n){return e.next==37?(e.advance(),o6(e.next)&&e.advance(),o6(e.next)&&e.advance(),!0):o2e(e.next)||n&&e.next==44?(e.advance(),!0):!1}function Hq(e){if(e.advance(),e.next==60){for(e.advance();;)if(!l6(e,!0)){e.next==62&&e.advance();break}}else for(;l6(e,!1););}function kN(e){for(e.advance();!dd(e.next)&&Ib(e.next)!="f";)e.advance()}function hT(e,n){let r=e.next,i=!1,s=e.pos;for(e.advance();;){let a=e.next;if(a<0)break;if(e.advance(),a==r)if(a==39)if(e.next==39)e.advance();else break;else break;else if(a==92&&r==34)e.next>=0&&e.advance();else if(Gl(a)){if(n)return!1;i=!0}else if(n&&e.pos>=s+1024)return!1}return!i}function l2e(e){for(let n=[],r=e.pos+1024;;)if(e.next==91||e.next==123)n.push(e.next),e.advance();else if(e.next==39||e.next==34){if(!hT(e,!0))return!1}else if(e.next==93||e.next==125){if(n[n.length-1]!=e.next-2)return!1;if(n.pop(),e.advance(),!n.length)return!0}else{if(e.next<0||e.pos>r||Gl(e.next))return!1;e.advance()}}const c2e="iiisiiissisfissssssssssssisssiiissssssssssssssssssssssssssfsfssissssssssssssssssssssssssssfif";function Ib(e){return e<33?"u":e>125?"s":c2e[e-33]}function KS(e,n){let r=Ib(e);return r!="u"&&!(n&&r=="f")}function Wq(e,n,r,i){if(Ib(e.next)=="s"||(e.next==63||e.next==58||e.next==45)&&KS(e.peek(1),r))e.advance();else return!1;let s=e.pos;for(;;){let a=e.next,o=0,l=i+1;for(;Fq(a);){if(Gl(a)){if(n)return!1;l=0}else l++;a=e.peek(++o)}if(!(a>=0&&(a==58?KS(e.peek(o+1),r):a==35?e.peek(o-1)!=32:KS(a,r)))||!r&&l<=i||l==0&&!r&&($f(e,45,o)||$f(e,46,o)))break;if(n&&Ib(a)=="f")return!1;for(let d=o;d>=0;d--)e.advance();if(n&&e.pos>s+1024)return!1}return!0}const u2e=new X0((e,n)=>{if(e.next==33)Hq(e),e.acceptToken(XSe);else if(e.next==38||e.next==42){let r=e.next==38?YSe:GSe;kN(e),e.acceptToken(r)}else e.next==39||e.next==34?(hT(e,!1),e.acceptToken(KSe)):Wq(e,!1,n.context.type==qg,n.context.depth)&&e.acceptToken(VSe)}),d2e=new X0((e,n)=>{let r=n.context.type==xN?n.context.depth:-1,i=e.pos;e:for(;;){let s=0,a=e.next;for(;a==32;)a=e.peek(++s);if(!s&&($f(e,45,s)||$f(e,46,s))||!Gl(a)&&(r<0&&(r=Math.max(n.context.depth+1,s)),s<r))break;for(;;){if(e.next<0)break e;let o=Gl(e.next);if(e.advance(),o)continue e;i=e.pos}}e.acceptTokenTo($q,i)}),h2e=cW({DirectiveName:We.keyword,DirectiveContent:We.attributeValue,"DirectiveEnd DocEnd":We.meta,QuotedLiteral:We.string,BlockLiteralHeader:We.special(We.string),BlockLiteralContent:We.content,Literal:We.content,"Key/Literal Key/QuotedLiteral":We.definition(We.propertyName),"Anchor Alias":We.labelName,Tag:We.typeName,Comment:We.lineComment,": , -":We.separator,"?":We.punctuation,"[ ]":We.squareBracket,"{ }":We.brace}),f2e=Lb.deserialize({version:14,states:"5lQ!ZQgOOO#PQfO'#CpO#uQfO'#DOOOQR'#Dv'#DvO$qQgO'#DRO%gQdO'#DUO%nQgO'#DUO&ROaO'#D[OOQR'#Du'#DuO&{QgO'#D^O'rQgO'#D`OOQR'#Dt'#DtO(iOqO'#DbOOQP'#Dj'#DjO(zQaO'#CmO)YQgO'#CmOOQP'#Cm'#CmQ)jQaOOQ)uQgOOQ]QgOOO*PQdO'#CrO*nQdO'#CtOOQO'#Dw'#DwO+]Q`O'#CxO+hQdO'#CwO+rQ`O'#CwOOQO'#Cv'#CvO+wQdO'#CvOOQO'#Cq'#CqO,UQ`O,59[O,^QfO,59[OOQR,59[,59[OOQO'#Cx'#CxO,eQ`O'#DPO,pQdO'#DPOOQO'#Dx'#DxO,zQdO'#DxO-XQ`O,59jO-aQfO,59jOOQR,59j,59jOOQR'#DS'#DSO-hQcO,59mO-sQgO'#DVO.TQ`O'#DVO.YQcO,59pOOQR'#DX'#DXO#|QfO'#DWO.hQcO'#DWOOQR,59v,59vO.yOWO,59vO/OOaO,59vO/WOaO,59vO/cQgO'#D_OOQR,59x,59xO0VQgO'#DaOOQR,59z,59zOOQP,59|,59|O0yOaO,59|O1ROaO,59|O1aOqO,59|OOQP-E7h-E7hO1oQgO,59XOOQP,59X,59XO2PQaO'#DeO2_QgO'#DeO2oQgO'#DkOOQP'#Dk'#DkQ)jQaOOO3PQdO'#CsOOQO,59^,59^O3kQdO'#CuOOQO,59`,59`OOQO,59c,59cO4VQdO,59cO4aQdO'#CzO4kQ`O'#CzOOQO,59b,59bOOQU,5:Q,5:QOOQR1G.v1G.vO4pQ`O1G.vOOQU-E7d-E7dO4xQdO,59kOOQO,59k,59kO5SQdO'#DQO5^Q`O'#DQOOQO,5:d,5:dOOQU,5:R,5:ROOQR1G/U1G/UO5cQ`O1G/UOOQU-E7e-E7eO5kQgO'#DhO5xQcO1G/XOOQR1G/X1G/XOOQR,59q,59qO6TQgO,59qO6eQdO'#DiO6lQgO'#DiO7PQcO1G/[OOQR1G/[1G/[OOQR,59r,59rO#|QfO,59rOOQR1G/b1G/bO7_OWO1G/bO7dOaO1G/bOOQR,59y,59yOOQR,59{,59{OOQP1G/h1G/hO7lOaO1G/hO7tOaO1G/hO8POaO1G/hOOQP1G.s1G.sO8_QgO,5:POOQP,5:P,5:POOQP,5:V,5:VOOQP-E7i-E7iOOQO,59_,59_OOQO,59a,59aOOQO1G.}1G.}OOQO,59f,59fO8oQdO,59fOOQR7+$b7+$bP,XQ`O'#DfOOQO1G/V1G/VOOQO,59l,59lO8yQdO,59lOOQR7+$p7+$pP9TQ`O'#DgOOQR'#DT'#DTOOQR,5:S,5:SOOQR-E7f-E7fOOQR7+$s7+$sOOQR1G/]1G/]O9YQgO'#DYO9jQ`O'#DYOOQR,5:T,5:TO#|QfO'#DZO9oQcO'#DZOOQR-E7g-E7gOOQR7+$v7+$vOOQR1G/^1G/^OOQR7+$|7+$|O:QOWO7+$|OOQP7+%S7+%SO:VOaO7+%SO:_OaO7+%SOOQP1G/k1G/kOOQO1G/Q1G/QOOQO1G/W1G/WOOQR,59t,59tO:jQgO,59tOOQR,59u,59uO#|QfO,59uOOQR<<Hh<<HhOOQP<<Hn<<HnO:zOaO<<HnOOQR1G/`1G/`OOQR1G/a1G/aOOQPAN>YAN>Y",stateData:";S~O!fOS!gOS^OS~OP_OQbORSOTUOWROXROYYOZZO[XOcPOqQO!PVO!V[O!cTO~O`cO~P]OVkOWROXROYeOZfO[dOcPOmhOqQO~OboO~P!bOVtOWROXROYeOZfO[dOcPOmrOqQO~OpwO~P#WORSOTUOWROXROYYOZZO[XOcPOqQO!PVO!cTO~OSvP!avP!bvP~P#|OWROXROYeOZfO[dOcPOqQO~OmzO~P%OOm!OOUzP!azP!bzP!dzP~P#|O^!SO!b!QO!f!TO!g!RO~ORSOTUOWROXROcPOqQO!PVO!cTO~OY!UOP!QXQ!QX!V!QX!`!QXS!QX!a!QX!b!QXU!QXm!QX!d!QX~P&aO[!WOP!SXQ!SX!V!SX!`!SXS!SX!a!SX!b!SXU!SXm!SX!d!SX~P&aO^!ZO!W![O!b!YO!f!]O!g!YO~OP!_O!V[OQaX!`aX~OPaXQaX!VaX!`aX~P#|OP!bOQ!cO!V[O~OP_O!V[O~P#|OWROXROY!fOcPOqQObfXmfXofXpfX~OWROXRO[!hOcPOqQObhXmhXohXphX~ObeXmlXoeX~ObkXokX~P%OOm!kO~Om!lObnPonP~P%OOb!pOo!oO~Ob!pO~P!bOm!sOosXpsX~OosXpsX~P%OOm!uOotPptP~P%OOo!xOp!yO~Op!yO~P#WOS!|O!a#OO!b#OO~OUyX!ayX!byX!dyX~P#|Om#QO~OU#SO!a#UO!b#UO!d#RO~Om#WOUzX!azX!bzX!dzX~O]#XO~O!b#XO!g#YO~O^#ZO!b#XO!g#YO~OP!RXQ!RX!V!RX!`!RXS!RX!a!RX!b!RXU!RXm!RX!d!RX~P&aOP!TXQ!TX!V!TX!`!TXS!TX!a!TX!b!TXU!TXm!TX!d!TX~P&aO!b#^O!g#^O~O^#_O!b#^O!f#`O!g#^O~O^#_O!W#aO!b#^O!g#^O~OPaaQaa!Vaa!`aa~P#|OP#cO!V[OQ!XX!`!XX~OP!XXQ!XX!V!XX!`!XX~P#|OP_O!V[OQ!_X!`!_X~P#|OWROXROcPOqQObgXmgXogXpgX~OWROXROcPOqQObiXmiXoiXpiX~Obkaoka~P%OObnXonX~P%OOm#kO~Ob#lOo!oO~Oosapsa~P%OOotXptX~P%OOm#pO~Oo!xOp#qO~OSwP!awP!bwP~P#|OS!|O!a#vO!b#vO~OUya!aya!bya!dya~P#|Om#xO~P%OOm#{OU}P!a}P!b}P!d}P~P#|OU#SO!a$OO!b$OO!d#RO~O]$QO~O!b$QO!g$RO~O!b$SO!g$SO~O^$TO!b$SO!g$SO~O^$TO!b$SO!f$UO!g$SO~OP!XaQ!Xa!V!Xa!`!Xa~P#|Obnaona~P%OOotapta~P%OOo!xO~OU|X!a|X!b|X!d|X~P#|Om$ZO~Om$]OU}X!a}X!b}X!d}X~O]$^O~O!b$_O!g$_O~O^$`O!b$_O!g$_O~OU|a!a|a!b|a!d|a~P#|O!b$cO!g$cO~O",goto:",]!mPPPPPPPPPPPPPPPPP!nPP!v#v#|$`#|$c$f$j$nP%VPPP!v%Y%^%a%{&O%a&R&U&X&_&b%aP&e&{&e'O'RPP']'a'g'm's'y(XPPPPPPPP(_)e*X+c,VUaObcR#e!c!{ROPQSTUXY_bcdehknrtvz!O!U!W!_!b!c!f!h!k!l!s!u!|#Q#R#S#W#c#k#p#x#{$Z$]QmPR!qnqfPQThknrtv!k!l!s!u#R#k#pR!gdR!ieTlPnTjPnSiPnSqQvQ{TQ!mkQ!trQ!vtR#y#RR!nkTsQvR!wt!RWOSUXY_bcz!O!U!W!_!b!c!|#Q#S#W#c#x#{$Z$]RySR#t!|R|TR|UQ!PUR#|#SR#z#RR#z#SyZOSU_bcz!O!_!b!c!|#Q#S#W#c#x#{$Z$]R!VXR!XYa]O^abc!a!c!eT!da!eQnPR!rnQvQR!{vQ!}yR#u!}Q#T|R#}#TW^Obc!cS!^^!aT!aa!eQ!eaR#f!eW`Obc!cQxSS}U#SQ!`_Q#PzQ#V!OQ#b!_Q#d!bQ#s!|Q#w#QQ$P#WQ$V#cQ$Y#xQ$[#{Q$a$ZR$b$]xZOSU_bcz!O!_!b!c!|#Q#S#W#c#x#{$Z$]Q!VXQ!XYQ#[!UR#]!W!QWOSUXY_bcz!O!U!W!_!b!c!|#Q#S#W#c#x#{$Z$]pfPQThknrtv!k!l!s!u#R#k#pQ!gdQ!ieQ#g!fR#h!hSgPn^pQTkrtv#RQ!jhQ#i!kQ#j!lQ#n!sQ#o!uQ$W#kR$X#pQuQR!zv",nodeNames:"⚠ DirectiveEnd DocEnd - - ? ? ? Literal QuotedLiteral Anchor Alias Tag BlockLiteralContent Comment Stream BOM Document ] [ FlowSequence Item Tagged Anchored Anchored Tagged FlowMapping Pair Key : Pair , } { FlowMapping Pair Pair BlockSequence Item Item BlockMapping Pair Pair Key Pair Pair BlockLiteral BlockLiteralHeader Tagged Anchored Anchored Tagged Directive DirectiveName DirectiveContent Document",maxTerm:74,context:i2e,nodeProps:[["isolate",-3,8,9,14,""],["openedBy",18,"[",32,"{"],["closedBy",19,"]",33,"}"]],propSources:[h2e],skippedNodes:[0],repeatNodeCount:6,tokenData:"-Y~RnOX#PXY$QYZ$]Z]#P]^$]^p#Ppq$Qqs#Pst$btu#Puv$yv|#P|}&e}![#P![!]'O!]!`#P!`!a'i!a!}#P!}#O*g#O#P#P#P#Q+Q#Q#o#P#o#p+k#p#q'i#q#r,U#r;'S#P;'S;=`#z<%l?HT#P?HT?HU,o?HUO#PQ#UU!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PQ#kTOY#PZs#Pt;'S#P;'S;=`#z<%lO#PQ#}P;=`<%l#P~$VQ!f~XY$Qpq$Q~$bO!g~~$gS^~OY$bZ;'S$b;'S;=`$s<%lO$b~$vP;=`<%l$bR%OX!WQOX%kXY#PZ]%k]^#P^p%kpq#hq;'S%k;'S;=`&_<%lO%kR%rX!WQ!VPOX%kXY#PZ]%k]^#P^p%kpq#hq;'S%k;'S;=`&_<%lO%kR&bP;=`<%l%kR&lUoP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR'VUmP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR'p[!PP!WQOY#PZp#Ppq#hq{#P{|(f|}#P}!O(f!O!R#P!R![)p![;'S#P;'S;=`#z<%lO#PR(mW!PP!WQOY#PZp#Ppq#hq!R#P!R![)V![;'S#P;'S;=`#z<%lO#PR)^U!PP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR)wY!PP!WQOY#PZp#Ppq#hq{#P{|)V|}#P}!O)V!O;'S#P;'S;=`#z<%lO#PR*nUcP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR+XUbP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR+rUqP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR,]UpP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR,vU`P!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#P",tokenizers:[s2e,a2e,u2e,d2e,0,1],topRules:{Stream:[0,15]},tokenPrec:0}),p2e=bb.define({name:"yaml",parser:f2e.configure({props:[fW.add({Stream:e=>{for(let n=e.node.resolve(e.pos,-1);n&&n.to>=e.pos;n=n.parent){if(n.name=="BlockLiteralContent"&&n.from<n.to)return e.baseIndentFor(n);if(n.name=="BlockLiteral")return e.baseIndentFor(n)+e.unit;if(n.name=="BlockSequence"||n.name=="BlockMapping")return e.column(n.firstChild.from,1);if(n.name=="QuotedLiteral")return null;if(n.name=="Literal"){let r=e.column(n.from,1);if(r==e.lineIndent(n.from,1))return r;if(n.to>e.pos)return null}}return null},FlowMapping:mL({closing:"}"}),FlowSequence:mL({closing:"]"})}),gW.add({"FlowMapping FlowSequence":H0e,"Item Pair BlockLiteral":(e,n)=>({from:n.doc.lineAt(e.from).to,to:e.to})})]}),languageData:{commentTokens:{line:"#"},indentOnInput:/^\s*[\]\}]$/}});function m2e(){return new M0e(p2e)}const wN="revka:add-step";function g2e(e){window.dispatchEvent(new CustomEvent(wN,{detail:e}))}const SN="revka:open-agent-picker";function fT(e){window.dispatchEvent(new CustomEvent(SN,{detail:e}))}const v2e={code:"accent",review:"network",research:"live",deploy:"warning",test:"network",build:"warning",notify:"network",approve:"network",summarize:"live",greet:"network",human_input:"warning",task:"muted",agent:"network",parallel:"network",shell:"muted",compute:"accent",goto:"warning",output:"live",conditional:"warning",group_chat:"network",supervisor:"warning",map_reduce:"network",handoff:"network",a2a:"live",resolve:"network",for_each:"live"};function y2e(e){const n=e.toLowerCase().replace(/[^a-z]/g,"");for(const[r,i]of Object.entries(v2e))if(n.startsWith(r)||n.includes(r))return i;return"muted"}function cm(e){switch(e){case"live":return"var(--revka-signal-live)";case"network":return"var(--revka-signal-network)";case"warning":return"var(--revka-status-warning)";case"danger":return"var(--revka-status-danger)";case"accent":return"var(--pc-accent)";case"muted":return"var(--revka-status-idle)"}}function um(e){switch(e){case"live":return"var(--revka-signal-live-soft)";case"network":return"var(--revka-signal-network-soft)";case"warning":return"color-mix(in srgb, var(--revka-status-warning) 16%, transparent)";case"danger":return"color-mix(in srgb, var(--revka-status-danger) 16%, transparent)";case"accent":return"var(--pc-accent-glow)";case"muted":return"color-mix(in srgb, var(--revka-status-idle) 16%, transparent)"}}const c6={coder:"accent",researcher:"live",reviewer:"network"},_2e={completed:"accent",running:"live",failed:"danger",pending:"muted",skipped:"muted"},x2e={claude:"network",codex:"warning"};function b2e(e){return`url("${e.replace(/"/g,"%22")}")`}function k2e({id:e,data:n,selected:r}){const i=y2e(n.type),s=cm(i),a=um(i),o=(n.type||"agent")==="agent",l=r?`linear-gradient(135deg, ${a} 0%, ${a} 40%, transparent 100%)`:`linear-gradient(135deg, ${a} 0%, color-mix(in srgb, var(--revka-bg-elevated) 72%, transparent) 50%, transparent 100%)`,u=!!n.agentAvatarUrl,d=u?["linear-gradient(90deg, var(--revka-bg-panel-strong) 0%, color-mix(in srgb, var(--revka-bg-panel-strong) 86%, transparent) 54%, color-mix(in srgb, var(--revka-bg-panel-strong) 32%, transparent) 100%)",l,b2e(n.agentAvatarUrl)].join(", "):l,p=f=>{f.stopPropagation();const g=f.currentTarget.getBoundingClientRect();fT({taskId:e,anchorRect:g})};return c.jsxs("div",{className:`px-4 py-3 rounded-xl shadow-lg transition-all${n.justUpdated?" step-updated-pulse":""}`,style:{position:"relative",backgroundColor:r?"var(--revka-bg-panel-strong)":"var(--revka-bg-surface)",backgroundImage:d,backgroundRepeat:"no-repeat",backgroundPosition:u?"0 0, 0 0, right -18px center":void 0,backgroundSize:u?"100% 100%, 100% 100%, 56% auto":void 0,border:`2px solid ${r?s:"var(--revka-border-strong)"}`,minWidth:220,maxWidth:280,minHeight:142,boxShadow:r?`0 0 20px ${a}, inset 0 1px 0 ${a}`:"0 4px 12px rgba(0, 0, 0, 0.3), inset 0 1px 0 var(--revka-border-soft)"},children:[c.jsx(Ns,{type:"target",position:Ot.Top,style:{background:s,width:10,height:10}}),c.jsx("div",{className:"text-sm font-bold truncate",style:{color:r?"var(--revka-signal-selected)":"var(--pc-text-primary)"},children:n.name||n.taskId}),c.jsxs("div",{className:"flex items-center gap-1.5 mt-1.5 flex-wrap",children:[c.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-semibold uppercase tracking-wider",style:{background:a,color:s},children:n.type}),n.paramCount>0&&c.jsxs("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{background:"var(--pc-hover)",color:"var(--pc-text-secondary)"},children:[n.paramCount," param",n.paramCount!==1?"s":""]})]}),n.description&&c.jsx("div",{className:"text-[11px] mt-1.5 line-clamp-2",style:{color:"var(--pc-text-muted)",lineHeight:"1.3"},children:n.description}),n.assign&&!n.runInfo&&c.jsxs("button",{type:"button",onClick:o?p:void 0,onMouseDown:f=>f.stopPropagation(),className:"mt-1.5 px-2 py-0.5 rounded-md text-[10px] font-semibold truncate inline-flex items-center gap-1",style:{background:"var(--revka-signal-network-soft)",color:"var(--revka-signal-network)",border:"1px solid var(--revka-border-strong)",maxWidth:"100%",cursor:o?"pointer":"default",font:"inherit"},title:`Assigned: ${n.assign}${o?" — click to change":""}`,children:[c.jsx(js,{src:n.agentAvatarUrl,alt:n.agentDisplayName||n.assign,size:14,radius:4,iconSize:9}),n.assign]}),!n.assign&&n.template&&o&&!n.runInfo&&c.jsxs("button",{type:"button",onClick:p,onMouseDown:f=>f.stopPropagation(),className:"mt-1.5 px-2 py-0.5 rounded-md text-[10px] font-semibold truncate inline-flex items-center gap-1",style:{background:"transparent",color:"var(--revka-text-secondary)",border:"1px solid var(--revka-border-strong)",maxWidth:"100%",cursor:"pointer",font:"inherit"},title:`Pool persona "${n.template}" — click to change`,children:[c.jsx(js,{src:n.agentAvatarUrl,alt:n.agentDisplayName||n.template,size:14,radius:4,iconSize:9}),"Persona · ",n.template]}),!n.assign&&!n.template&&o&&!n.runInfo&&(()=>{const f=n.agentType?n.agentType.charAt(0).toUpperCase()+n.agentType.slice(1):"",g=!!n.agentType;return c.jsxs("button",{type:"button",onClick:p,onMouseDown:_=>_.stopPropagation(),className:"mt-1.5 px-2 py-0.5 rounded-md text-[10px] font-medium truncate inline-flex items-center gap-1",style:{background:g?"transparent":"color-mix(in srgb, var(--revka-status-warning) 16%, transparent)",color:g?"var(--revka-text-muted)":"var(--revka-status-warning)",border:g?"1px solid var(--revka-border-soft)":"1px solid var(--revka-status-warning)",maxWidth:"100%",cursor:"pointer",font:"inherit"},title:g?`Default ${n.agentType} agent — click to assign a specific pool agent`:"No pool agent assigned — click to choose",children:[c.jsx(zl,{size:10}),g?`Default · ${f}`:"Unassigned"]})})(),n.agentHints.length>0&&c.jsx("div",{className:"flex gap-1 mt-1.5 flex-wrap",children:n.agentHints.map(f=>{const g=c6[f]||"muted";return c.jsx("span",{className:"px-1.5 py-0.5 rounded text-[9px] font-medium",style:{background:um(g),color:cm(g)},children:f},f)})}),n.auth&&c.jsx("div",{className:"flex items-center gap-1 mt-1",title:`Auth: ${n.auth}`,style:{color:"var(--revka-text-faint)"},children:c.jsx(hg,{size:12})}),n.skills.length>0&&c.jsxs("div",{className:"flex gap-1 mt-1 flex-wrap",children:[n.skills.slice(0,3).map(f=>{const g=f.replace(/^kref:\/\/.*\//,"").replace(/\.skilldef$/,"");return c.jsx("span",{className:"px-1.5 py-0.5 rounded text-[9px] font-medium truncate",style:{background:"var(--pc-accent-glow)",color:"var(--pc-accent-light)",maxWidth:"100%"},title:f,children:g},f)}),n.skills.length>3&&c.jsxs("span",{className:"px-1.5 py-0.5 rounded text-[9px] font-medium",style:{background:"var(--pc-hover)",color:"var(--pc-text-faint)"},children:["+",n.skills.length-3]})]}),n.runInfo&&c.jsxs("div",{className:"mt-2 pt-2",style:{borderTop:"1px solid var(--revka-border-soft)"},children:[c.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[(()=>{const f=_2e[n.runInfo.status]||"muted";return c.jsx("span",{className:"px-1.5 py-0.5 rounded text-[9px] font-semibold uppercase tracking-wider",style:{background:um(f),color:cm(f)},children:n.runInfo.status})})(),n.runInfo.agent_type&&(()=>{const f=x2e[n.runInfo.agent_type]||"muted";return c.jsx("span",{className:"px-1.5 py-0.5 rounded text-[9px] font-medium",style:{background:um(f),color:cm(f)},children:n.runInfo.agent_type})})(),n.runInfo.role&&(()=>{const f=c6[n.runInfo.role]||"muted";return c.jsx("span",{className:"px-1.5 py-0.5 rounded text-[9px] font-medium",style:{background:um(f),color:cm(f)},children:n.runInfo.role})})()]}),n.runInfo.template_name&&c.jsxs("div",{className:"mt-1.5 px-2 py-0.5 rounded-md text-[10px] font-semibold truncate inline-flex items-center gap-1",style:{background:"var(--revka-signal-network-soft)",color:"var(--revka-signal-network)",border:"1px solid var(--revka-border-strong)",maxWidth:"100%"},title:`Pool Agent: ${n.runInfo.template_name}`,children:[c.jsx(js,{src:n.agentAvatarUrl,alt:n.agentDisplayName||n.runInfo.template_name,size:14,radius:4,iconSize:9}),n.runInfo.template_name]}),n.runInfo.agent_id&&c.jsxs("div",{className:"text-[8px] mt-1 font-mono truncate",style:{color:"var(--pc-text-faint)",letterSpacing:"0.02em"},title:n.runInfo.agent_id,children:["id:",n.runInfo.agent_id.slice(0,12)]}),n.runInfo.skills&&n.runInfo.skills.length>0&&c.jsxs("div",{className:"flex gap-1 mt-1.5 flex-wrap",children:[n.runInfo.skills.slice(0,3).map(f=>c.jsxs("span",{className:"px-1.5 py-0.5 rounded text-[8px] font-medium inline-flex items-center gap-0.5",style:{background:n.runInfo.status==="running"?"var(--revka-signal-network-soft)":n.runInfo.status==="completed"?"var(--revka-signal-selected-soft)":"var(--pc-accent-glow)",color:n.runInfo.status==="running"?"var(--revka-signal-network)":n.runInfo.status==="completed"?"var(--revka-signal-selected)":"var(--pc-accent-light)"},children:[n.runInfo.status==="running"&&c.jsx("span",{className:"inline-block h-1 w-1 rounded-full",style:{background:"var(--revka-signal-network)",animation:"pulse-dot 1.5s ease-in-out infinite"}}),n.runInfo.status==="completed"&&c.jsx("span",{style:{fontSize:"7px"},children:"✓"}),f]},f)),n.runInfo.skills.length>3&&c.jsxs("span",{className:"px-1.5 py-0.5 rounded text-[8px] font-medium",style:{background:"var(--pc-hover)",color:"var(--pc-text-faint)"},children:["+",n.runInfo.skills.length-3]})]}),c.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[n.runInfo.duration_s!=null&&n.runInfo.duration_s>0&&c.jsx("span",{className:"text-[9px]",style:{color:"var(--pc-text-faint)"},children:n.runInfo.duration_s<60?`${n.runInfo.duration_s.toFixed(1)}s`:`${(n.runInfo.duration_s/60).toFixed(1)}m`}),n.runInfo.trust_score!=null&&c.jsxs("span",{className:"text-[9px] font-medium",style:{color:n.runInfo.trust_score>=.8?"var(--revka-status-success)":n.runInfo.trust_score>=.5?"var(--revka-status-warning)":"var(--revka-status-danger)"},children:["trust ",(n.runInfo.trust_score*100).toFixed(0),"%"]})]})]}),c.jsx(Ns,{type:"source",position:Ot.Bottom,style:{background:s,width:10,height:10}})]})}const w2e={taskNode:k2e},D_="var(--revka-status-warning)",Ch="color-mix(in srgb, var(--revka-status-warning) 16%, transparent)";function S2e(e){var r;if(((r=e.conditionalBranches)==null?void 0:r.length)>0)return e.conditionalBranches;const n=[];return(e.condition||e.onTrueValue)&&n.push({condition:e.condition||"",goto:"",value:e.onTrueValue||void 0}),e.onFalseValue&&n.push({condition:"default",goto:"",value:e.onFalseValue}),n.length>0?n:[{condition:e.condition||"",goto:"",value:e.onTrueValue||void 0},{condition:"default",goto:"",value:e.onFalseValue||void 0}]}function C2e({data:e,selected:n}){var s;const r=S2e(e),i=(s=r.find(a=>a.condition.trim()!=="default"))==null?void 0:s.condition;return c.jsxs("div",{className:"px-4 py-3 rounded-xl shadow-lg transition-all",style:{position:"relative",background:n?`linear-gradient(135deg, ${Ch} 0%, ${Ch} 40%, var(--revka-bg-panel-strong) 100%)`:`linear-gradient(135deg, ${Ch} 0%, var(--revka-bg-elevated) 50%, var(--revka-bg-surface) 100%)`,border:`2px solid ${n?D_:"var(--revka-border-strong)"}`,minWidth:200,maxWidth:260,boxShadow:n?`0 0 20px ${Ch}, inset 0 1px 0 ${Ch}`:"0 4px 12px rgba(0, 0, 0, 0.3), inset 0 1px 0 var(--revka-border-soft)"},children:[c.jsx(Ns,{type:"target",position:Ot.Top,style:{background:D_,width:10,height:10}}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("div",{className:"w-5 h-5 flex items-center justify-center flex-shrink-0",style:{color:D_},children:c.jsx("svg",{viewBox:"0 0 16 16",width:"16",height:"16",fill:"currentColor",children:c.jsx("path",{d:"M8 1L15 8L8 15L1 8Z"})})}),c.jsx("div",{className:"text-sm font-bold truncate",style:{color:n?"var(--revka-signal-selected)":"var(--pc-text-primary)"},children:e.name||e.taskId})]}),c.jsx("div",{className:"flex items-center gap-1.5 mt-1.5",children:c.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-semibold uppercase tracking-wider",style:{background:Ch,color:D_},children:r.length>2?`${r.length} branches`:"if / else"})}),i?c.jsx("div",{className:"text-[11px] mt-1.5 font-mono truncate",style:{color:"var(--pc-text-muted)",lineHeight:"1.3"},children:i}):c.jsx("div",{className:"text-[10px] mt-1.5 italic",style:{color:"var(--pc-text-faint)"},children:"no condition set"}),e.description&&c.jsx("div",{className:"text-[10px] mt-1 line-clamp-1",style:{color:"var(--pc-text-faint)"},children:e.description}),c.jsx("div",{className:"flex flex-col gap-1.5 mt-2.5",children:r.map((a,o)=>{const l=wf(a,o),u=_0(a,o);return c.jsxs("div",{className:"flex items-center justify-between gap-2",children:[c.jsxs("div",{className:"flex items-center gap-1 min-w-0",children:[c.jsx("div",{className:"w-2.5 h-2.5 rounded-full flex-shrink-0",style:{background:l.stroke}}),c.jsx("span",{className:"text-[9px] font-semibold uppercase truncate",style:{color:l.stroke},children:u})]}),a.value&&c.jsxs("span",{className:"text-[9px] font-mono px-1 rounded truncate max-w-[120px]",style:{background:"color-mix(in srgb, var(--revka-status-warning) 14%, transparent)",color:l.stroke},title:`emits: ${a.value}`,children:["= ",a.value]})]},Zc(o))})}),r.map((a,o)=>{const l=wf(a,o),u=`${(o+1)/(r.length+1)*100}%`;return c.jsx(Ns,{type:"source",position:Ot.Bottom,id:Zc(o),style:{background:l.stroke,width:10,height:10,left:u}},Zc(o))})]})}const j2e={gateNode:C2e};function N2e(e,n){var l;const r=new Set(e.map(u=>u.id)),i=new Map,s=new Map;for(const u of r)i.set(u,[]),s.set(u,0);for(const u of n){const d=u.data;d!=null&&d.synthetic||((l=i.get(u.source))==null||l.push(u.target),s.set(u.target,(s.get(u.target)??0)+1))}const a=[];for(const[u,d]of s)d===0&&a.push(u);let o=0;for(;a.length>0;){const u=a.shift();o++;for(const d of i.get(u)??[]){const p=(s.get(d)??1)-1;s.set(d,p),p===0&&a.push(d)}}return o<r.size}function qq(e,n){var g,_;if(e.length===0)return e;const r=new Map,i=new Map;for(const x of e)r.set(x.id,[]),i.set(x.id,[]);for(const x of n)(g=r.get(x.source))==null||g.push(x.target),(_=i.get(x.target))==null||_.push(x.source);const s=e.filter(x=>(i.get(x.id)??[]).length===0);if(s.length===0)return e.map((x,v)=>({...x,position:{x:v*250,y:0}}));const a=new Map,o=new Set,l=[];for(const x of s)a.set(x.id,0),l.push(x.id),o.add(x.id);for(;l.length>0;){const x=l.shift(),v=a.get(x)??0;for(const S of r.get(x)??[])o.has(S)||(o.add(S),a.set(S,v+1),l.push(S))}for(const x of e)a.has(x.id)||a.set(x.id,0);const u=new Map;for(const[x,v]of a)u.has(v)||u.set(v,[]),u.get(v).push(x);const d=340,p=260,f=new Map;for(const[x,v]of[...u.entries()].sort((S,w)=>S[0]-w[0])){const S=d,N=-((v.length-1)*S)/2;v.forEach((C,T)=>{f.set(C,{x:N+T*S,y:x*p})})}return e.map(x=>({...x,position:f.get(x.id)??{x:0,y:0}}))}const E2e=typeof navigator<"u"&&/mac/i.test(navigator.platform);function YS({keys:e}){return c.jsx("span",{style:{display:"inline-flex",alignItems:"center",gap:4},children:e.map(n=>c.jsx("kbd",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",minWidth:22,height:22,padding:"0 6px",borderRadius:6,border:"1px solid var(--revka-border-soft)",background:"var(--pc-bg-input)",color:"var(--revka-text-secondary)",fontFamily:"var(--pc-font-mono, ui-monospace, monospace)",fontSize:11,fontWeight:600},children:n},n))})}function A2e({onAddStep:e,onImportYaml:n,onGenerate:r,modKey:i}){const s=i??(E2e?"⌘":"Ctrl"),a=!r;return c.jsx("div",{style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",pointerEvents:"none"},children:c.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:18,maxWidth:360,padding:"24px 28px",pointerEvents:"auto"},children:[c.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:10},children:[c.jsx("img",{src:id("revka-icon.png"),alt:"Revka",className:"revka-brand-logo",style:{height:56,width:56,borderRadius:14,objectFit:"contain",opacity:.85},onError:o=>{o.currentTarget.style.display="none"}}),c.jsx("div",{className:"revka-kicker",style:{letterSpacing:"0.24em"},children:"Workflow Editor"})]}),c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4,width:"100%"},children:[c.jsxs("button",{type:"button",onClick:e,style:P_(),children:[c.jsx("span",{style:GS(),children:c.jsx(rs,{size:14})}),c.jsx("span",{style:{flex:1,textAlign:"left"},children:"Add Step"}),c.jsx(YS,{keys:[s,"K"]})]}),c.jsxs("button",{type:"button",onClick:n,style:P_(),children:[c.jsx("span",{style:GS(),children:c.jsx(uJ,{size:14})}),c.jsx("span",{style:{flex:1,textAlign:"left"},children:"Import YAML"}),c.jsx(YS,{keys:[s,"I"]})]}),c.jsxs("button",{type:"button",onClick:r,disabled:a,title:a?"Coming with Operator copilot (P2)":"Open Architect with a prompt",style:a?{...P_(),opacity:.5,cursor:"not-allowed"}:P_(),children:[c.jsx("span",{style:GS(),children:c.jsx(iu,{size:14})}),c.jsx("span",{style:{flex:1,textAlign:"left"},children:"Generate from prompt"}),a?c.jsx("span",{style:{fontSize:10,color:"var(--revka-text-faint)",letterSpacing:"0.12em",textTransform:"uppercase"},children:"soon"}):c.jsx(YS,{keys:[s,"G"]})]})]}),c.jsx("p",{style:{fontSize:11,color:"var(--revka-text-faint)",textAlign:"center",lineHeight:1.5},children:"Right-click the canvas for more actions, or drag a noodle from a node into empty space to insert and wire a step."})]})})}function P_(){return{display:"flex",alignItems:"center",gap:12,padding:"10px 12px",borderRadius:10,border:"1px solid var(--revka-border-soft)",background:"color-mix(in srgb, var(--revka-bg-panel-strong) 78%, transparent)",color:"var(--revka-text-secondary)",fontSize:13,fontWeight:500,cursor:"pointer",transition:"border-color 0.15s ease, color 0.15s ease, background 0.15s ease"}}function GS(){return{display:"inline-flex",alignItems:"center",justifyContent:"center",width:22,height:22,borderRadius:6,background:"var(--pc-accent-glow)",color:"var(--pc-accent)",flexShrink:0}}const T2e={execution:{label:"Execution",description:"Run agents, code, shells, and emit outputs."},control:{label:"Control",description:"Branch, loop, and orchestrate flow."},coordination:{label:"Coordination",description:"Multi-agent collaboration and delegation."},human:{label:"Human",description:"Pause for input, approval, or notifications."},memory:{label:"Memory",description:"Resolve, compile, tag, and deprecate Kumiho entities."}},Wh=[{type:"agent",label:"Agent",category:"execution",icon:zl,description:"Run an LLM agent (Claude, Codex) with a prompt and skills.",searchTags:["research","code","review","test","build","deploy","summarize","task","llm","claude","codex"]},{type:"shell",label:"Shell",category:"execution",icon:av,description:"Execute a shell command and capture stdout/stderr.",searchTags:["bash","command","exec","cli"]},{type:"python",label:"Python",category:"execution",icon:lJ,description:"Run a Python script or inline code with JSON in/out.",searchTags:["script","code","py","subprocess"]},{type:"compute",label:"Compute",category:"execution",icon:XZ,description:"Evaluate safe expressions into typed output fields.",searchTags:["math","expression","transform","calculate","derive"]},{type:"output",label:"Output",category:"execution",icon:_E,description:"Format and publish a result, optionally as a Kumiho entity.",searchTags:["publish","emit","result","render","template"]},{type:"email",label:"Email",category:"execution",icon:_J,description:"Send an outbound email via SMTP with optional click tracking.",searchTags:["smtp","send","mail","message","outreach"]},{type:"image",label:"Image",category:"execution",icon:gE,description:"Generate an image via codex and push it to canvas + Kumiho artifact.",searchTags:["codex","png","render","visual","canvas","artwork","illustration"]},{type:"conditional",label:"Conditional",category:"control",icon:xd,description:"Branch on ordered expressions with one handle per route.",searchTags:["if","else","gate","branch","condition"]},{type:"parallel",label:"Parallel",category:"control",icon:AJ,description:"Fan out to multiple branches and join with all/any/majority.",searchTags:["fork","fanout","concurrent","split"]},{type:"for_each",label:"For Each",category:"control",icon:SJ,description:"Loop sub-steps over a range or list, sequentially.",searchTags:["loop","iterate","range","foreach","iteration"]},{type:"goto",label:"Goto",category:"control",icon:jJ,description:"Jump back to an earlier step, optionally guarded by condition.",searchTags:["loop","jump","iterate","rerun"]},{type:"map_reduce",label:"Map / Reduce",category:"control",icon:EB,description:"Split a task across mappers and combine with a reducer.",searchTags:["fan-out","reduce","aggregate","split"]},{type:"supervisor",label:"Supervisor",category:"coordination",icon:aJ,description:"Decompose a task and delegate to sub-agents.",searchTags:["orchestrator","manager","delegate"]},{type:"group_chat",label:"Group Chat",category:"coordination",icon:a0,description:"Multiple agents discuss a topic with a moderator.",searchTags:["conversation","discussion","multi-agent","debate"]},{type:"handoff",label:"Handoff",category:"coordination",icon:VZ,description:"Transfer execution to a different agent type with context.",searchTags:["transfer","delegate","pass"]},{type:"a2a",label:"A2A Call",category:"coordination",icon:xf,description:"Call a remote agent over the Agent-to-Agent protocol.",searchTags:["remote","protocol","agent","http"]},{type:"manus",label:"Manus",category:"coordination",icon:hE,description:"Delegate web research to a hosted Manus AI task with optional structured output.",searchTags:["manus","web","research","browse","agent","browser","remote"]},{type:"human_input",label:"Human Input",category:"human",icon:pJ,description:"Pause and collect free-text input from a human via channel.",searchTags:["input","prompt","ask","wait"]},{type:"human_approval",label:"Human Approval",category:"human",icon:_f,description:"Pause until a human approves or rejects via dashboard/Slack/Discord.",searchTags:["approve","review","gate","confirm","sign-off"]},{type:"notify",label:"Notify",category:"human",icon:KZ,description:"Broadcast a message to one or more channels (no wait).",searchTags:["alert","message","broadcast","send"]},{type:"resolve",label:"Resolve",category:"memory",icon:Aa,description:"Look up a Kumiho entity by kind/tag/name and load its fields.",searchTags:["lookup","fetch","find","kumiho","entity"]},{type:"kumiho_context",label:"Kumiho Context",category:"memory",icon:xf,description:"Compile locked graph context from Kumiho bundles, krefs, and queries.",searchTags:["context","graph","canon","bundle","kumiho","memory"]},{type:"kumiho_bundle_update",label:"Bundle Update",category:"memory",icon:xd,description:"Add, remove, or replace Kumiho bundle members idempotently.",searchTags:["bundle","membership","kumiho","mutation","append"]},{type:"kumiho_patch_apply",label:"Patch Apply",category:"memory",icon:_f,description:"Dry-run or apply an approved Kumiho canon patch.",searchTags:["patch","canon","apply","approval","kumiho","mutation"]},{type:"tag",label:"Tag",category:"memory",icon:Bx,description:"Apply a tag to a Kumiho entity revision (and optionally untag).",searchTags:["label","mark","kumiho","revision"]},{type:"deprecate",label:"Deprecate",category:"memory",icon:HZ,description:"Mark a Kumiho item as deprecated with an optional reason.",searchTags:["archive","retire","kumiho","remove"]}],M2e=Object.fromEntries(Wh.map(e=>[e.type,e])),R2e={execution:Wh.filter(e=>e.category==="execution"),control:Wh.filter(e=>e.category==="control"),coordination:Wh.filter(e=>e.category==="coordination"),human:Wh.filter(e=>e.category==="human"),memory:Wh.filter(e=>e.category==="memory")},O2e=["execution","control","coordination","human","memory"];var u6=1,D2e=.9,P2e=.8,L2e=.17,XS=.1,QS=.999,I2e=.9999,B2e=.99,z2e=/[\\\/_+.#"@\[\(\{&]/,$2e=/[\\\/_+.#"@\[\(\{&]/g,F2e=/[\s-]/,Uq=/[\s-]/g;function CN(e,n,r,i,s,a,o){if(a===n.length)return s===e.length?u6:B2e;var l=`${s},${a}`;if(o[l]!==void 0)return o[l];for(var u=i.charAt(a),d=r.indexOf(u,s),p=0,f,g,_,x;d>=0;)f=CN(e,n,r,i,d+1,a+1,o),f>p&&(d===s?f*=u6:z2e.test(e.charAt(d-1))?(f*=P2e,_=e.slice(s,d-1).match($2e),_&&s>0&&(f*=Math.pow(QS,_.length))):F2e.test(e.charAt(d-1))?(f*=D2e,x=e.slice(s,d-1).match(Uq),x&&s>0&&(f*=Math.pow(QS,x.length))):(f*=L2e,s>0&&(f*=Math.pow(QS,d-s))),e.charAt(d)!==n.charAt(a)&&(f*=I2e)),(f<XS&&r.charAt(d-1)===i.charAt(a+1)||i.charAt(a+1)===i.charAt(a)&&r.charAt(d-1)!==i.charAt(a))&&(g=CN(e,n,r,i,d+1,a+2,o),g*XS>f&&(f=g*XS)),f>p&&(p=f),d=r.indexOf(u,d+1);return o[l]=p,p}function d6(e){return e.toLowerCase().replace(Uq," ")}function H2e(e,n,r){return e=r&&r.length>0?`${e+" "+r.join(" ")}`:e,CN(e,n,d6(e),d6(n),0,0,{})}function tu(e,n,{checkForDefaultPrevented:r=!0}={}){return function(s){if(e==null||e(s),r===!1||!s.defaultPrevented)return n==null?void 0:n(s)}}function h6(e,n){if(typeof e=="function")return e(n);e!=null&&(e.current=n)}function hu(...e){return n=>{let r=!1;const i=e.map(s=>{const a=h6(s,n);return!r&&typeof a=="function"&&(r=!0),a});if(r)return()=>{for(let s=0;s<i.length;s++){const a=i[s];typeof a=="function"?a():h6(e[s],null)}}}}function Id(...e){return b.useCallback(hu(...e),e)}function W2e(e,n){const r=b.createContext(n),i=a=>{const{children:o,...l}=a,u=b.useMemo(()=>l,Object.values(l));return c.jsx(r.Provider,{value:u,children:o})};i.displayName=e+"Provider";function s(a){const o=b.useContext(r);if(o)return o;if(n!==void 0)return n;throw new Error(`\`${a}\` must be used within \`${e}\``)}return[i,s]}function q2e(e,n=[]){let r=[];function i(a,o){const l=b.createContext(o),u=r.length;r=[...r,o];const d=f=>{var w;const{scope:g,children:_,...x}=f,v=((w=g==null?void 0:g[e])==null?void 0:w[u])||l,S=b.useMemo(()=>x,Object.values(x));return c.jsx(v.Provider,{value:S,children:_})};d.displayName=a+"Provider";function p(f,g){var v;const _=((v=g==null?void 0:g[e])==null?void 0:v[u])||l,x=b.useContext(_);if(x)return x;if(o!==void 0)return o;throw new Error(`\`${f}\` must be used within \`${a}\``)}return[d,p]}const s=()=>{const a=r.map(o=>b.createContext(o));return function(l){const u=(l==null?void 0:l[e])||a;return b.useMemo(()=>({[`__scope${e}`]:{...l,[e]:u}}),[l,u])}};return s.scopeName=e,[i,U2e(s,...n)]}function U2e(...e){const n=e[0];if(e.length===1)return n;const r=()=>{const i=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(a){const o=i.reduce((l,{useScope:u,scopeName:d})=>{const f=u(a)[`__scope${d}`];return{...l,...f}},{});return b.useMemo(()=>({[`__scope${n.scopeName}`]:o}),[o])}};return r.scopeName=n.scopeName,r}var Ug=globalThis!=null&&globalThis.document?b.useLayoutEffect:()=>{},V2e=QN[" useId ".trim().toString()]||(()=>{}),K2e=0;function Fl(e){const[n,r]=b.useState(V2e());return Ug(()=>{r(i=>i??String(K2e++))},[e]),n?`radix-${n}`:""}var Y2e=QN[" useInsertionEffect ".trim().toString()]||Ug;function G2e({prop:e,defaultProp:n,onChange:r=()=>{},caller:i}){const[s,a,o]=X2e({defaultProp:n,onChange:r}),l=e!==void 0,u=l?e:s;{const p=b.useRef(e!==void 0);b.useEffect(()=>{const f=p.current;f!==l&&console.warn(`${i} is changing from ${f?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),p.current=l},[l,i])}const d=b.useCallback(p=>{var f;if(l){const g=Q2e(p)?p(e):p;g!==e&&((f=o.current)==null||f.call(o,g))}else a(p)},[l,e,a,o]);return[u,d]}function X2e({defaultProp:e,onChange:n}){const[r,i]=b.useState(e),s=b.useRef(r),a=b.useRef(n);return Y2e(()=>{a.current=n},[n]),b.useEffect(()=>{var o;s.current!==r&&((o=a.current)==null||o.call(a,r),s.current=r)},[r,s]),[r,i,a]}function Q2e(e){return typeof e=="function"}function Rv(e){const n=Z2e(e),r=b.forwardRef((i,s)=>{const{children:a,...o}=i,l=b.Children.toArray(a),u=l.find(eCe);if(u){const d=u.props.children,p=l.map(f=>f===u?b.Children.count(d)>1?b.Children.only(null):b.isValidElement(d)?d.props.children:null:f);return c.jsx(n,{...o,ref:s,children:b.isValidElement(d)?b.cloneElement(d,void 0,p):null})}return c.jsx(n,{...o,ref:s,children:a})});return r.displayName=`${e}.Slot`,r}function Z2e(e){const n=b.forwardRef((r,i)=>{const{children:s,...a}=r;if(b.isValidElement(s)){const o=nCe(s),l=tCe(a,s.props);return s.type!==b.Fragment&&(l.ref=i?hu(i,o):o),b.cloneElement(s,l)}return b.Children.count(s)>1?b.Children.only(null):null});return n.displayName=`${e}.SlotClone`,n}var J2e=Symbol("radix.slottable");function eCe(e){return b.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===J2e}function tCe(e,n){const r={...n};for(const i in n){const s=e[i],a=n[i];/^on[A-Z]/.test(i)?s&&a?r[i]=(...l)=>{const u=a(...l);return s(...l),u}:s&&(r[i]=s):i==="style"?r[i]={...s,...a}:i==="className"&&(r[i]=[s,a].filter(Boolean).join(" "))}return{...e,...r}}function nCe(e){var i,s;let n=(i=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:i.get,r=n&&"isReactWarning"in n&&n.isReactWarning;return r?e.ref:(n=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,r=n&&"isReactWarning"in n&&n.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var rCe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Vq=rCe.reduce((e,n)=>{const r=Rv(`Primitive.${n}`),i=b.forwardRef((s,a)=>{const{asChild:o,...l}=s,u=o?r:n;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),c.jsx(u,{...l,ref:a})});return i.displayName=`Primitive.${n}`,{...e,[n]:i}},{});function iCe(e,n){e&&na.flushSync(()=>e.dispatchEvent(n))}function Vg(e){const n=b.useRef(e);return b.useEffect(()=>{n.current=e}),b.useMemo(()=>(...r)=>{var i;return(i=n.current)==null?void 0:i.call(n,...r)},[])}function sCe(e,n=globalThis==null?void 0:globalThis.document){const r=Vg(e);b.useEffect(()=>{const i=s=>{s.key==="Escape"&&r(s)};return n.addEventListener("keydown",i,{capture:!0}),()=>n.removeEventListener("keydown",i,{capture:!0})},[r,n])}var aCe="DismissableLayer",jN="dismissableLayer.update",oCe="dismissableLayer.pointerDownOutside",lCe="dismissableLayer.focusOutside",f6,Kq=b.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Yq=b.forwardRef((e,n)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:a,onInteractOutside:o,onDismiss:l,...u}=e,d=b.useContext(Kq),[p,f]=b.useState(null),g=(p==null?void 0:p.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,_]=b.useState({}),x=Id(n,D=>f(D)),v=Array.from(d.layers),[S]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),w=v.indexOf(S),N=p?v.indexOf(p):-1,C=d.layersWithOutsidePointerEventsDisabled.size>0,T=N>=w,A=dCe(D=>{const F=D.target,B=[...d.branches].some(H=>H.contains(F));!T||B||(s==null||s(D),o==null||o(D),D.defaultPrevented||l==null||l())},g),E=hCe(D=>{const F=D.target;[...d.branches].some(H=>H.contains(F))||(a==null||a(D),o==null||o(D),D.defaultPrevented||l==null||l())},g);return sCe(D=>{N===d.layers.size-1&&(i==null||i(D),!D.defaultPrevented&&l&&(D.preventDefault(),l()))},g),b.useEffect(()=>{if(p)return r&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(f6=g.body.style.pointerEvents,g.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(p)),d.layers.add(p),p6(),()=>{r&&d.layersWithOutsidePointerEventsDisabled.size===1&&(g.body.style.pointerEvents=f6)}},[p,g,r,d]),b.useEffect(()=>()=>{p&&(d.layers.delete(p),d.layersWithOutsidePointerEventsDisabled.delete(p),p6())},[p,d]),b.useEffect(()=>{const D=()=>_({});return document.addEventListener(jN,D),()=>document.removeEventListener(jN,D)},[]),c.jsx(Vq.div,{...u,ref:x,style:{pointerEvents:C?T?"auto":"none":void 0,...e.style},onFocusCapture:tu(e.onFocusCapture,E.onFocusCapture),onBlurCapture:tu(e.onBlurCapture,E.onBlurCapture),onPointerDownCapture:tu(e.onPointerDownCapture,A.onPointerDownCapture)})});Yq.displayName=aCe;var cCe="DismissableLayerBranch",uCe=b.forwardRef((e,n)=>{const r=b.useContext(Kq),i=b.useRef(null),s=Id(n,i);return b.useEffect(()=>{const a=i.current;if(a)return r.branches.add(a),()=>{r.branches.delete(a)}},[r.branches]),c.jsx(Vq.div,{...e,ref:s})});uCe.displayName=cCe;function dCe(e,n=globalThis==null?void 0:globalThis.document){const r=Vg(e),i=b.useRef(!1),s=b.useRef(()=>{});return b.useEffect(()=>{const a=l=>{if(l.target&&!i.current){let u=function(){Gq(oCe,r,d,{discrete:!0})};const d={originalEvent:l};l.pointerType==="touch"?(n.removeEventListener("click",s.current),s.current=u,n.addEventListener("click",s.current,{once:!0})):u()}else n.removeEventListener("click",s.current);i.current=!1},o=window.setTimeout(()=>{n.addEventListener("pointerdown",a)},0);return()=>{window.clearTimeout(o),n.removeEventListener("pointerdown",a),n.removeEventListener("click",s.current)}},[n,r]),{onPointerDownCapture:()=>i.current=!0}}function hCe(e,n=globalThis==null?void 0:globalThis.document){const r=Vg(e),i=b.useRef(!1);return b.useEffect(()=>{const s=a=>{a.target&&!i.current&&Gq(lCe,r,{originalEvent:a},{discrete:!1})};return n.addEventListener("focusin",s),()=>n.removeEventListener("focusin",s)},[n,r]),{onFocusCapture:()=>i.current=!0,onBlurCapture:()=>i.current=!1}}function p6(){const e=new CustomEvent(jN);document.dispatchEvent(e)}function Gq(e,n,r,{discrete:i}){const s=r.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});n&&s.addEventListener(e,n,{once:!0}),i?iCe(s,a):s.dispatchEvent(a)}var fCe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],pCe=fCe.reduce((e,n)=>{const r=Rv(`Primitive.${n}`),i=b.forwardRef((s,a)=>{const{asChild:o,...l}=s,u=o?r:n;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),c.jsx(u,{...l,ref:a})});return i.displayName=`Primitive.${n}`,{...e,[n]:i}},{}),ZS="focusScope.autoFocusOnMount",JS="focusScope.autoFocusOnUnmount",m6={bubbles:!1,cancelable:!0},mCe="FocusScope",Xq=b.forwardRef((e,n)=>{const{loop:r=!1,trapped:i=!1,onMountAutoFocus:s,onUnmountAutoFocus:a,...o}=e,[l,u]=b.useState(null),d=Vg(s),p=Vg(a),f=b.useRef(null),g=Id(n,v=>u(v)),_=b.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;b.useEffect(()=>{if(i){let v=function(C){if(_.paused||!l)return;const T=C.target;l.contains(T)?f.current=T:Lc(f.current,{select:!0})},S=function(C){if(_.paused||!l)return;const T=C.relatedTarget;T!==null&&(l.contains(T)||Lc(f.current,{select:!0}))},w=function(C){if(document.activeElement===document.body)for(const A of C)A.removedNodes.length>0&&Lc(l)};document.addEventListener("focusin",v),document.addEventListener("focusout",S);const N=new MutationObserver(w);return l&&N.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",v),document.removeEventListener("focusout",S),N.disconnect()}}},[i,l,_.paused]),b.useEffect(()=>{if(l){v6.add(_);const v=document.activeElement;if(!l.contains(v)){const w=new CustomEvent(ZS,m6);l.addEventListener(ZS,d),l.dispatchEvent(w),w.defaultPrevented||(gCe(bCe(Qq(l)),{select:!0}),document.activeElement===v&&Lc(l))}return()=>{l.removeEventListener(ZS,d),setTimeout(()=>{const w=new CustomEvent(JS,m6);l.addEventListener(JS,p),l.dispatchEvent(w),w.defaultPrevented||Lc(v??document.body,{select:!0}),l.removeEventListener(JS,p),v6.remove(_)},0)}}},[l,d,p,_]);const x=b.useCallback(v=>{if(!r&&!i||_.paused)return;const S=v.key==="Tab"&&!v.altKey&&!v.ctrlKey&&!v.metaKey,w=document.activeElement;if(S&&w){const N=v.currentTarget,[C,T]=vCe(N);C&&T?!v.shiftKey&&w===T?(v.preventDefault(),r&&Lc(C,{select:!0})):v.shiftKey&&w===C&&(v.preventDefault(),r&&Lc(T,{select:!0})):w===N&&v.preventDefault()}},[r,i,_.paused]);return c.jsx(pCe.div,{tabIndex:-1,...o,ref:g,onKeyDown:x})});Xq.displayName=mCe;function gCe(e,{select:n=!1}={}){const r=document.activeElement;for(const i of e)if(Lc(i,{select:n}),document.activeElement!==r)return}function vCe(e){const n=Qq(e),r=g6(n,e),i=g6(n.reverse(),e);return[r,i]}function Qq(e){const n=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:i=>{const s=i.tagName==="INPUT"&&i.type==="hidden";return i.disabled||i.hidden||s?NodeFilter.FILTER_SKIP:i.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)n.push(r.currentNode);return n}function g6(e,n){for(const r of e)if(!yCe(r,{upTo:n}))return r}function yCe(e,{upTo:n}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(n!==void 0&&e===n)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function _Ce(e){return e instanceof HTMLInputElement&&"select"in e}function Lc(e,{select:n=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&_Ce(e)&&n&&e.select()}}var v6=xCe();function xCe(){let e=[];return{add(n){const r=e[0];n!==r&&(r==null||r.pause()),e=y6(e,n),e.unshift(n)},remove(n){var r;e=y6(e,n),(r=e[0])==null||r.resume()}}}function y6(e,n){const r=[...e],i=r.indexOf(n);return i!==-1&&r.splice(i,1),r}function bCe(e){return e.filter(n=>n.tagName!=="A")}var kCe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],wCe=kCe.reduce((e,n)=>{const r=Rv(`Primitive.${n}`),i=b.forwardRef((s,a)=>{const{asChild:o,...l}=s,u=o?r:n;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),c.jsx(u,{...l,ref:a})});return i.displayName=`Primitive.${n}`,{...e,[n]:i}},{}),SCe="Portal",Zq=b.forwardRef((e,n)=>{var l;const{container:r,...i}=e,[s,a]=b.useState(!1);Ug(()=>a(!0),[]);const o=r||s&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return o?qX.createPortal(c.jsx(wCe.div,{...i,ref:n}),o):null});Zq.displayName=SCe;function CCe(e,n){return b.useReducer((r,i)=>n[r][i]??r,e)}var Q0=e=>{const{present:n,children:r}=e,i=jCe(n),s=typeof r=="function"?r({present:i.isPresent}):b.Children.only(r),a=Id(i.ref,NCe(s));return typeof r=="function"||i.isPresent?b.cloneElement(s,{ref:a}):null};Q0.displayName="Presence";function jCe(e){const[n,r]=b.useState(),i=b.useRef(null),s=b.useRef(e),a=b.useRef("none"),o=e?"mounted":"unmounted",[l,u]=CCe(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return b.useEffect(()=>{const d=L_(i.current);a.current=l==="mounted"?d:"none"},[l]),Ug(()=>{const d=i.current,p=s.current;if(p!==e){const g=a.current,_=L_(d);e?u("MOUNT"):_==="none"||(d==null?void 0:d.display)==="none"?u("UNMOUNT"):u(p&&g!==_?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,u]),Ug(()=>{if(n){let d;const p=n.ownerDocument.defaultView??window,f=_=>{const v=L_(i.current).includes(CSS.escape(_.animationName));if(_.target===n&&v&&(u("ANIMATION_END"),!s.current)){const S=n.style.animationFillMode;n.style.animationFillMode="forwards",d=p.setTimeout(()=>{n.style.animationFillMode==="forwards"&&(n.style.animationFillMode=S)})}},g=_=>{_.target===n&&(a.current=L_(i.current))};return n.addEventListener("animationstart",g),n.addEventListener("animationcancel",f),n.addEventListener("animationend",f),()=>{p.clearTimeout(d),n.removeEventListener("animationstart",g),n.removeEventListener("animationcancel",f),n.removeEventListener("animationend",f)}}else u("ANIMATION_END")},[n,u]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:b.useCallback(d=>{i.current=d?getComputedStyle(d):null,r(d)},[])}}function L_(e){return(e==null?void 0:e.animationName)||"none"}function NCe(e){var i,s;let n=(i=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:i.get,r=n&&"isReactWarning"in n&&n.isReactWarning;return r?e.ref:(n=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,r=n&&"isReactWarning"in n&&n.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var ECe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ov=ECe.reduce((e,n)=>{const r=Rv(`Primitive.${n}`),i=b.forwardRef((s,a)=>{const{asChild:o,...l}=s,u=o?r:n;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),c.jsx(u,{...l,ref:a})});return i.displayName=`Primitive.${n}`,{...e,[n]:i}},{}),e2=0;function ACe(){b.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??_6()),document.body.insertAdjacentElement("beforeend",e[1]??_6()),e2++,()=>{e2===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(n=>n.remove()),e2--}},[])}function _6(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Lo=function(){return Lo=Object.assign||function(n){for(var r,i=1,s=arguments.length;i<s;i++){r=arguments[i];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(n[a]=r[a])}return n},Lo.apply(this,arguments)};function Jq(e,n){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&n.indexOf(i)<0&&(r[i]=e[i]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,i=Object.getOwnPropertySymbols(e);s<i.length;s++)n.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(e,i[s])&&(r[i[s]]=e[i[s]]);return r}function TCe(e,n,r){if(r||arguments.length===2)for(var i=0,s=n.length,a;i<s;i++)(a||!(i in n))&&(a||(a=Array.prototype.slice.call(n,0,i)),a[i]=n[i]);return e.concat(a||Array.prototype.slice.call(n))}var Cx="right-scroll-bar-position",jx="width-before-scroll-bar",MCe="with-scroll-bars-hidden",RCe="--removed-body-scroll-bar-size";function t2(e,n){return typeof e=="function"?e(n):e&&(e.current=n),e}function OCe(e,n){var r=b.useState(function(){return{value:e,callback:n,facade:{get current(){return r.value},set current(i){var s=r.value;s!==i&&(r.value=i,r.callback(i,s))}}}})[0];return r.callback=n,r.facade}var DCe=typeof window<"u"?b.useLayoutEffect:b.useEffect,x6=new WeakMap;function PCe(e,n){var r=OCe(null,function(i){return e.forEach(function(s){return t2(s,i)})});return DCe(function(){var i=x6.get(r);if(i){var s=new Set(i),a=new Set(e),o=r.current;s.forEach(function(l){a.has(l)||t2(l,null)}),a.forEach(function(l){s.has(l)||t2(l,o)})}x6.set(r,e)},[e]),r}function LCe(e){return e}function ICe(e,n){n===void 0&&(n=LCe);var r=[],i=!1,s={read:function(){if(i)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:e},useMedium:function(a){var o=n(a,i);return r.push(o),function(){r=r.filter(function(l){return l!==o})}},assignSyncMedium:function(a){for(i=!0;r.length;){var o=r;r=[],o.forEach(a)}r={push:function(l){return a(l)},filter:function(){return r}}},assignMedium:function(a){i=!0;var o=[];if(r.length){var l=r;r=[],l.forEach(a),o=r}var u=function(){var p=o;o=[],p.forEach(a)},d=function(){return Promise.resolve().then(u)};d(),r={push:function(p){o.push(p),d()},filter:function(p){return o=o.filter(p),r}}}};return s}function BCe(e){e===void 0&&(e={});var n=ICe(null);return n.options=Lo({async:!0,ssr:!1},e),n}var eU=function(e){var n=e.sideCar,r=Jq(e,["sideCar"]);if(!n)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var i=n.read();if(!i)throw new Error("Sidecar medium not found");return b.createElement(i,Lo({},r))};eU.isSideCarExport=!0;function zCe(e,n){return e.useMedium(n),eU}var tU=BCe(),n2=function(){},Z0=b.forwardRef(function(e,n){var r=b.useRef(null),i=b.useState({onScrollCapture:n2,onWheelCapture:n2,onTouchMoveCapture:n2}),s=i[0],a=i[1],o=e.forwardProps,l=e.children,u=e.className,d=e.removeScrollBar,p=e.enabled,f=e.shards,g=e.sideCar,_=e.noRelative,x=e.noIsolation,v=e.inert,S=e.allowPinchZoom,w=e.as,N=w===void 0?"div":w,C=e.gapMode,T=Jq(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),A=g,E=PCe([r,n]),D=Lo(Lo({},T),s);return b.createElement(b.Fragment,null,p&&b.createElement(A,{sideCar:tU,removeScrollBar:d,shards:f,noRelative:_,noIsolation:x,inert:v,setCallbacks:a,allowPinchZoom:!!S,lockRef:r,gapMode:C}),o?b.cloneElement(b.Children.only(l),Lo(Lo({},D),{ref:E})):b.createElement(N,Lo({},D,{className:u,ref:E}),l))});Z0.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Z0.classNames={fullWidth:jx,zeroRight:Cx};var $Ce=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function FCe(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var n=$Ce();return n&&e.setAttribute("nonce",n),e}function HCe(e,n){e.styleSheet?e.styleSheet.cssText=n:e.appendChild(document.createTextNode(n))}function WCe(e){var n=document.head||document.getElementsByTagName("head")[0];n.appendChild(e)}var qCe=function(){var e=0,n=null;return{add:function(r){e==0&&(n=FCe())&&(HCe(n,r),WCe(n)),e++},remove:function(){e--,!e&&n&&(n.parentNode&&n.parentNode.removeChild(n),n=null)}}},UCe=function(){var e=qCe();return function(n,r){b.useEffect(function(){return e.add(n),function(){e.remove()}},[n&&r])}},nU=function(){var e=UCe(),n=function(r){var i=r.styles,s=r.dynamic;return e(i,s),null};return n},VCe={left:0,top:0,right:0,gap:0},r2=function(e){return parseInt(e||"",10)||0},KCe=function(e){var n=window.getComputedStyle(document.body),r=n[e==="padding"?"paddingLeft":"marginLeft"],i=n[e==="padding"?"paddingTop":"marginTop"],s=n[e==="padding"?"paddingRight":"marginRight"];return[r2(r),r2(i),r2(s)]},YCe=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return VCe;var n=KCe(e),r=document.documentElement.clientWidth,i=window.innerWidth;return{left:n[0],top:n[1],right:n[2],gap:Math.max(0,i-r+n[2]-n[0])}},GCe=nU(),vf="data-scroll-locked",XCe=function(e,n,r,i){var s=e.left,a=e.top,o=e.right,l=e.gap;return r===void 0&&(r="margin"),`
  .`.concat(MCe,` {
   overflow: hidden `).concat(i,`;
   padding-right: `).concat(l,"px ").concat(i,`;
  }
  body[`).concat(vf,`] {
    overflow: hidden `).concat(i,`;
    overscroll-behavior: contain;
    `).concat([n&&"position: relative ".concat(i,";"),r==="margin"&&`
    padding-left: `.concat(s,`px;
    padding-top: `).concat(a,`px;
    padding-right: `).concat(o,`px;
    margin-left:0;
    margin-top:0;
    margin-right: `).concat(l,"px ").concat(i,`;
    `),r==="padding"&&"padding-right: ".concat(l,"px ").concat(i,";")].filter(Boolean).join(""),`
  }
  
  .`).concat(Cx,` {
    right: `).concat(l,"px ").concat(i,`;
  }
  
  .`).concat(jx,` {
    margin-right: `).concat(l,"px ").concat(i,`;
  }
  
  .`).concat(Cx," .").concat(Cx,` {
    right: 0 `).concat(i,`;
  }
  
  .`).concat(jx," .").concat(jx,` {
    margin-right: 0 `).concat(i,`;
  }
  
  body[`).concat(vf,`] {
    `).concat(RCe,": ").concat(l,`px;
  }
`)},b6=function(){var e=parseInt(document.body.getAttribute(vf)||"0",10);return isFinite(e)?e:0},QCe=function(){b.useEffect(function(){return document.body.setAttribute(vf,(b6()+1).toString()),function(){var e=b6()-1;e<=0?document.body.removeAttribute(vf):document.body.setAttribute(vf,e.toString())}},[])},ZCe=function(e){var n=e.noRelative,r=e.noImportant,i=e.gapMode,s=i===void 0?"margin":i;QCe();var a=b.useMemo(function(){return YCe(s)},[s]);return b.createElement(GCe,{styles:XCe(a,!n,s,r?"":"!important")})},NN=!1;if(typeof window<"u")try{var I_=Object.defineProperty({},"passive",{get:function(){return NN=!0,!0}});window.addEventListener("test",I_,I_),window.removeEventListener("test",I_,I_)}catch{NN=!1}var jh=NN?{passive:!1}:!1,JCe=function(e){return e.tagName==="TEXTAREA"},rU=function(e,n){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return r[n]!=="hidden"&&!(r.overflowY===r.overflowX&&!JCe(e)&&r[n]==="visible")},eje=function(e){return rU(e,"overflowY")},tje=function(e){return rU(e,"overflowX")},k6=function(e,n){var r=n.ownerDocument,i=n;do{typeof ShadowRoot<"u"&&i instanceof ShadowRoot&&(i=i.host);var s=iU(e,i);if(s){var a=sU(e,i),o=a[1],l=a[2];if(o>l)return!0}i=i.parentNode}while(i&&i!==r.body);return!1},nje=function(e){var n=e.scrollTop,r=e.scrollHeight,i=e.clientHeight;return[n,r,i]},rje=function(e){var n=e.scrollLeft,r=e.scrollWidth,i=e.clientWidth;return[n,r,i]},iU=function(e,n){return e==="v"?eje(n):tje(n)},sU=function(e,n){return e==="v"?nje(n):rje(n)},ije=function(e,n){return e==="h"&&n==="rtl"?-1:1},sje=function(e,n,r,i,s){var a=ije(e,window.getComputedStyle(n).direction),o=a*i,l=r.target,u=n.contains(l),d=!1,p=o>0,f=0,g=0;do{if(!l)break;var _=sU(e,l),x=_[0],v=_[1],S=_[2],w=v-S-a*x;(x||w)&&iU(e,l)&&(f+=w,g+=x);var N=l.parentNode;l=N&&N.nodeType===Node.DOCUMENT_FRAGMENT_NODE?N.host:N}while(!u&&l!==document.body||u&&(n.contains(l)||n===l));return(p&&Math.abs(f)<1||!p&&Math.abs(g)<1)&&(d=!0),d},B_=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},w6=function(e){return[e.deltaX,e.deltaY]},S6=function(e){return e&&"current"in e?e.current:e},aje=function(e,n){return e[0]===n[0]&&e[1]===n[1]},oje=function(e){return`
  .block-interactivity-`.concat(e,` {pointer-events: none;}
  .allow-interactivity-`).concat(e,` {pointer-events: all;}
`)},lje=0,Nh=[];function cje(e){var n=b.useRef([]),r=b.useRef([0,0]),i=b.useRef(),s=b.useState(lje++)[0],a=b.useState(nU)[0],o=b.useRef(e);b.useEffect(function(){o.current=e},[e]),b.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(s));var v=TCe([e.lockRef.current],(e.shards||[]).map(S6),!0).filter(Boolean);return v.forEach(function(S){return S.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),v.forEach(function(S){return S.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var l=b.useCallback(function(v,S){if("touches"in v&&v.touches.length===2||v.type==="wheel"&&v.ctrlKey)return!o.current.allowPinchZoom;var w=B_(v),N=r.current,C="deltaX"in v?v.deltaX:N[0]-w[0],T="deltaY"in v?v.deltaY:N[1]-w[1],A,E=v.target,D=Math.abs(C)>Math.abs(T)?"h":"v";if("touches"in v&&D==="h"&&E.type==="range")return!1;var F=window.getSelection(),B=F&&F.anchorNode,H=B?B===E||B.contains(E):!1;if(H)return!1;var $=k6(D,E);if(!$)return!0;if($?A=D:(A=D==="v"?"h":"v",$=k6(D,E)),!$)return!1;if(!i.current&&"changedTouches"in v&&(C||T)&&(i.current=A),!A)return!0;var z=i.current||A;return sje(z,S,v,z==="h"?C:T)},[]),u=b.useCallback(function(v){var S=v;if(!(!Nh.length||Nh[Nh.length-1]!==a)){var w="deltaY"in S?w6(S):B_(S),N=n.current.filter(function(A){return A.name===S.type&&(A.target===S.target||S.target===A.shadowParent)&&aje(A.delta,w)})[0];if(N&&N.should){S.cancelable&&S.preventDefault();return}if(!N){var C=(o.current.shards||[]).map(S6).filter(Boolean).filter(function(A){return A.contains(S.target)}),T=C.length>0?l(S,C[0]):!o.current.noIsolation;T&&S.cancelable&&S.preventDefault()}}},[]),d=b.useCallback(function(v,S,w,N){var C={name:v,delta:S,target:w,should:N,shadowParent:uje(w)};n.current.push(C),setTimeout(function(){n.current=n.current.filter(function(T){return T!==C})},1)},[]),p=b.useCallback(function(v){r.current=B_(v),i.current=void 0},[]),f=b.useCallback(function(v){d(v.type,w6(v),v.target,l(v,e.lockRef.current))},[]),g=b.useCallback(function(v){d(v.type,B_(v),v.target,l(v,e.lockRef.current))},[]);b.useEffect(function(){return Nh.push(a),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:g}),document.addEventListener("wheel",u,jh),document.addEventListener("touchmove",u,jh),document.addEventListener("touchstart",p,jh),function(){Nh=Nh.filter(function(v){return v!==a}),document.removeEventListener("wheel",u,jh),document.removeEventListener("touchmove",u,jh),document.removeEventListener("touchstart",p,jh)}},[]);var _=e.removeScrollBar,x=e.inert;return b.createElement(b.Fragment,null,x?b.createElement(a,{styles:oje(s)}):null,_?b.createElement(ZCe,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function uje(e){for(var n=null;e!==null;)e instanceof ShadowRoot&&(n=e.host,e=e.host),e=e.parentNode;return n}const dje=zCe(tU,cje);var aU=b.forwardRef(function(e,n){return b.createElement(Z0,Lo({},e,{ref:n,sideCar:dje}))});aU.classNames=Z0.classNames;var hje=function(e){if(typeof document>"u")return null;var n=Array.isArray(e)?e[0]:e;return n.ownerDocument.body},Eh=new WeakMap,z_=new WeakMap,$_={},i2=0,oU=function(e){return e&&(e.host||oU(e.parentNode))},fje=function(e,n){return n.map(function(r){if(e.contains(r))return r;var i=oU(r);return i&&e.contains(i)?i:(console.error("aria-hidden",r,"in not contained inside",e,". Doing nothing"),null)}).filter(function(r){return!!r})},pje=function(e,n,r,i){var s=fje(n,Array.isArray(e)?e:[e]);$_[r]||($_[r]=new WeakMap);var a=$_[r],o=[],l=new Set,u=new Set(s),d=function(f){!f||l.has(f)||(l.add(f),d(f.parentNode))};s.forEach(d);var p=function(f){!f||u.has(f)||Array.prototype.forEach.call(f.children,function(g){if(l.has(g))p(g);else try{var _=g.getAttribute(i),x=_!==null&&_!=="false",v=(Eh.get(g)||0)+1,S=(a.get(g)||0)+1;Eh.set(g,v),a.set(g,S),o.push(g),v===1&&x&&z_.set(g,!0),S===1&&g.setAttribute(r,"true"),x||g.setAttribute(i,"true")}catch(w){console.error("aria-hidden: cannot operate on ",g,w)}})};return p(n),l.clear(),i2++,function(){o.forEach(function(f){var g=Eh.get(f)-1,_=a.get(f)-1;Eh.set(f,g),a.set(f,_),g||(z_.has(f)||f.removeAttribute(i),z_.delete(f)),_||f.removeAttribute(r)}),i2--,i2||(Eh=new WeakMap,Eh=new WeakMap,z_=new WeakMap,$_={})}},mje=function(e,n,r){r===void 0&&(r="data-aria-hidden");var i=Array.from(Array.isArray(e)?e:[e]),s=hje(e);return s?(i.push.apply(i,Array.from(s.querySelectorAll("[aria-live], script"))),pje(i,s,r,"aria-hidden")):function(){return null}},J0="Dialog",[lU]=q2e(J0),[gje,ao]=lU(J0),cU=e=>{const{__scopeDialog:n,children:r,open:i,defaultOpen:s,onOpenChange:a,modal:o=!0}=e,l=b.useRef(null),u=b.useRef(null),[d,p]=G2e({prop:i,defaultProp:s??!1,onChange:a,caller:J0});return c.jsx(gje,{scope:n,triggerRef:l,contentRef:u,contentId:Fl(),titleId:Fl(),descriptionId:Fl(),open:d,onOpenChange:p,onOpenToggle:b.useCallback(()=>p(f=>!f),[p]),modal:o,children:r})};cU.displayName=J0;var uU="DialogTrigger",vje=b.forwardRef((e,n)=>{const{__scopeDialog:r,...i}=e,s=ao(uU,r),a=Id(n,s.triggerRef);return c.jsx(Ov.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":gT(s.open),...i,ref:a,onClick:tu(e.onClick,s.onOpenToggle)})});vje.displayName=uU;var pT="DialogPortal",[yje,dU]=lU(pT,{forceMount:void 0}),hU=e=>{const{__scopeDialog:n,forceMount:r,children:i,container:s}=e,a=ao(pT,n);return c.jsx(yje,{scope:n,forceMount:r,children:b.Children.map(i,o=>c.jsx(Q0,{present:r||a.open,children:c.jsx(Zq,{asChild:!0,container:s,children:o})}))})};hU.displayName=pT;var Bb="DialogOverlay",fU=b.forwardRef((e,n)=>{const r=dU(Bb,e.__scopeDialog),{forceMount:i=r.forceMount,...s}=e,a=ao(Bb,e.__scopeDialog);return a.modal?c.jsx(Q0,{present:i||a.open,children:c.jsx(xje,{...s,ref:n})}):null});fU.displayName=Bb;var _je=Rv("DialogOverlay.RemoveScroll"),xje=b.forwardRef((e,n)=>{const{__scopeDialog:r,...i}=e,s=ao(Bb,r);return c.jsx(aU,{as:_je,allowPinchZoom:!0,shards:[s.contentRef],children:c.jsx(Ov.div,{"data-state":gT(s.open),...i,ref:n,style:{pointerEvents:"auto",...i.style}})})}),Rd="DialogContent",pU=b.forwardRef((e,n)=>{const r=dU(Rd,e.__scopeDialog),{forceMount:i=r.forceMount,...s}=e,a=ao(Rd,e.__scopeDialog);return c.jsx(Q0,{present:i||a.open,children:a.modal?c.jsx(bje,{...s,ref:n}):c.jsx(kje,{...s,ref:n})})});pU.displayName=Rd;var bje=b.forwardRef((e,n)=>{const r=ao(Rd,e.__scopeDialog),i=b.useRef(null),s=Id(n,r.contentRef,i);return b.useEffect(()=>{const a=i.current;if(a)return mje(a)},[]),c.jsx(mU,{...e,ref:s,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:tu(e.onCloseAutoFocus,a=>{var o;a.preventDefault(),(o=r.triggerRef.current)==null||o.focus()}),onPointerDownOutside:tu(e.onPointerDownOutside,a=>{const o=a.detail.originalEvent,l=o.button===0&&o.ctrlKey===!0;(o.button===2||l)&&a.preventDefault()}),onFocusOutside:tu(e.onFocusOutside,a=>a.preventDefault())})}),kje=b.forwardRef((e,n)=>{const r=ao(Rd,e.__scopeDialog),i=b.useRef(!1),s=b.useRef(!1);return c.jsx(mU,{...e,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{var o,l;(o=e.onCloseAutoFocus)==null||o.call(e,a),a.defaultPrevented||(i.current||(l=r.triggerRef.current)==null||l.focus(),a.preventDefault()),i.current=!1,s.current=!1},onInteractOutside:a=>{var u,d;(u=e.onInteractOutside)==null||u.call(e,a),a.defaultPrevented||(i.current=!0,a.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const o=a.target;((d=r.triggerRef.current)==null?void 0:d.contains(o))&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&s.current&&a.preventDefault()}})}),mU=b.forwardRef((e,n)=>{const{__scopeDialog:r,trapFocus:i,onOpenAutoFocus:s,onCloseAutoFocus:a,...o}=e,l=ao(Rd,r),u=b.useRef(null),d=Id(n,u);return ACe(),c.jsxs(c.Fragment,{children:[c.jsx(Xq,{asChild:!0,loop:!0,trapped:i,onMountAutoFocus:s,onUnmountAutoFocus:a,children:c.jsx(Yq,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":gT(l.open),...o,ref:d,onDismiss:()=>l.onOpenChange(!1)})}),c.jsxs(c.Fragment,{children:[c.jsx(jje,{titleId:l.titleId}),c.jsx(Eje,{contentRef:u,descriptionId:l.descriptionId})]})]})}),mT="DialogTitle",wje=b.forwardRef((e,n)=>{const{__scopeDialog:r,...i}=e,s=ao(mT,r);return c.jsx(Ov.h2,{id:s.titleId,...i,ref:n})});wje.displayName=mT;var gU="DialogDescription",Sje=b.forwardRef((e,n)=>{const{__scopeDialog:r,...i}=e,s=ao(gU,r);return c.jsx(Ov.p,{id:s.descriptionId,...i,ref:n})});Sje.displayName=gU;var vU="DialogClose",Cje=b.forwardRef((e,n)=>{const{__scopeDialog:r,...i}=e,s=ao(vU,r);return c.jsx(Ov.button,{type:"button",...i,ref:n,onClick:tu(e.onClick,()=>s.onOpenChange(!1))})});Cje.displayName=vU;function gT(e){return e?"open":"closed"}var yU="DialogTitleWarning",[h4e,_U]=W2e(yU,{contentName:Rd,titleName:mT,docsSlug:"dialog"}),jje=({titleId:e})=>{const n=_U(yU),r=`\`${n.contentName}\` requires a \`${n.titleName}\` for the component to be accessible for screen reader users.

If you want to hide the \`${n.titleName}\`, you can wrap it with our VisuallyHidden component.

For more information, see https://radix-ui.com/primitives/docs/components/${n.docsSlug}`;return b.useEffect(()=>{e&&(document.getElementById(e)||console.error(r))},[r,e]),null},Nje="DialogDescriptionWarning",Eje=({contentRef:e,descriptionId:n})=>{const i=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${_U(Nje).contentName}}.`;return b.useEffect(()=>{var a;const s=(a=e.current)==null?void 0:a.getAttribute("aria-describedby");n&&s&&(document.getElementById(n)||console.warn(i))},[i,e,n]),null},Aje=cU,Tje=hU,Mje=fU,Rje=pU,Oje=Symbol.for("react.lazy"),zb=QN[" use ".trim().toString()];function Dje(e){return typeof e=="object"&&e!==null&&"then"in e}function xU(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===Oje&&"_payload"in e&&Dje(e._payload)}function Pje(e){const n=Lje(e),r=b.forwardRef((i,s)=>{let{children:a,...o}=i;xU(a)&&typeof zb=="function"&&(a=zb(a._payload));const l=b.Children.toArray(a),u=l.find(Bje);if(u){const d=u.props.children,p=l.map(f=>f===u?b.Children.count(d)>1?b.Children.only(null):b.isValidElement(d)?d.props.children:null:f);return c.jsx(n,{...o,ref:s,children:b.isValidElement(d)?b.cloneElement(d,void 0,p):null})}return c.jsx(n,{...o,ref:s,children:a})});return r.displayName=`${e}.Slot`,r}function Lje(e){const n=b.forwardRef((r,i)=>{let{children:s,...a}=r;if(xU(s)&&typeof zb=="function"&&(s=zb(s._payload)),b.isValidElement(s)){const o=$je(s),l=zje(a,s.props);return s.type!==b.Fragment&&(l.ref=i?hu(i,o):o),b.cloneElement(s,l)}return b.Children.count(s)>1?b.Children.only(null):null});return n.displayName=`${e}.SlotClone`,n}var Ije=Symbol("radix.slottable");function Bje(e){return b.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Ije}function zje(e,n){const r={...n};for(const i in n){const s=e[i],a=n[i];/^on[A-Z]/.test(i)?s&&a?r[i]=(...l)=>{const u=a(...l);return s(...l),u}:s&&(r[i]=s):i==="style"?r[i]={...s,...a}:i==="className"&&(r[i]=[s,a].filter(Boolean).join(" "))}return{...e,...r}}function $je(e){var i,s;let n=(i=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:i.get,r=n&&"isReactWarning"in n&&n.isReactWarning;return r?e.ref:(n=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,r=n&&"isReactWarning"in n&&n.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var Fje=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],vu=Fje.reduce((e,n)=>{const r=Pje(`Primitive.${n}`),i=b.forwardRef((s,a)=>{const{asChild:o,...l}=s,u=o?r:n;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),c.jsx(u,{...l,ref:a})});return i.displayName=`Primitive.${n}`,{...e,[n]:i}},{}),dm='[cmdk-group=""]',s2='[cmdk-group-items=""]',Hje='[cmdk-group-heading=""]',bU='[cmdk-item=""]',C6=`${bU}:not([aria-disabled="true"])`,EN="cmdk-item-select",qh="data-value",Wje=(e,n,r)=>H2e(e,n,r),kU=b.createContext(void 0),Dv=()=>b.useContext(kU),wU=b.createContext(void 0),vT=()=>b.useContext(wU),SU=b.createContext(void 0),CU=b.forwardRef((e,n)=>{let r=Uh(()=>{var U,V;return{search:"",value:(V=(U=e.value)!=null?U:e.defaultValue)!=null?V:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),i=Uh(()=>new Set),s=Uh(()=>new Map),a=Uh(()=>new Map),o=Uh(()=>new Set),l=jU(e),{label:u,children:d,value:p,onValueChange:f,filter:g,shouldFilter:_,loop:x,disablePointerSelection:v=!1,vimBindings:S=!0,...w}=e,N=Fl(),C=Fl(),T=Fl(),A=b.useRef(null),E=eNe();Od(()=>{if(p!==void 0){let U=p.trim();r.current.value=U,D.emit()}},[p]),Od(()=>{E(6,W)},[]);let D=b.useMemo(()=>({subscribe:U=>(o.current.add(U),()=>o.current.delete(U)),snapshot:()=>r.current,setState:(U,V,ie)=>{var te,X,se,re;if(!Object.is(r.current[U],V)){if(r.current[U]=V,U==="search")z(),H(),E(1,$);else if(U==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let de=document.getElementById(T);de?de.focus():(te=document.getElementById(N))==null||te.focus()}if(E(7,()=>{var de;r.current.selectedItemId=(de=P())==null?void 0:de.id,D.emit()}),ie||E(5,W),((X=l.current)==null?void 0:X.value)!==void 0){let de=V??"";(re=(se=l.current).onValueChange)==null||re.call(se,de);return}}D.emit()}},emit:()=>{o.current.forEach(U=>U())}}),[]),F=b.useMemo(()=>({value:(U,V,ie)=>{var te;V!==((te=a.current.get(U))==null?void 0:te.value)&&(a.current.set(U,{value:V,keywords:ie}),r.current.filtered.items.set(U,B(V,ie)),E(2,()=>{H(),D.emit()}))},item:(U,V)=>(i.current.add(U),V&&(s.current.has(V)?s.current.get(V).add(U):s.current.set(V,new Set([U]))),E(3,()=>{z(),H(),r.current.value||$(),D.emit()}),()=>{a.current.delete(U),i.current.delete(U),r.current.filtered.items.delete(U);let ie=P();E(4,()=>{z(),(ie==null?void 0:ie.getAttribute("id"))===U&&$(),D.emit()})}),group:U=>(s.current.has(U)||s.current.set(U,new Set),()=>{a.current.delete(U),s.current.delete(U)}),filter:()=>l.current.shouldFilter,label:u||e["aria-label"],getDisablePointerSelection:()=>l.current.disablePointerSelection,listId:N,inputId:T,labelId:C,listInnerRef:A}),[]);function B(U,V){var ie,te;let X=(te=(ie=l.current)==null?void 0:ie.filter)!=null?te:Wje;return U?X(U,r.current.search,V):0}function H(){if(!r.current.search||l.current.shouldFilter===!1)return;let U=r.current.filtered.items,V=[];r.current.filtered.groups.forEach(te=>{let X=s.current.get(te),se=0;X.forEach(re=>{let de=U.get(re);se=Math.max(de,se)}),V.push([te,se])});let ie=A.current;q().sort((te,X)=>{var se,re;let de=te.getAttribute("id"),ue=X.getAttribute("id");return((se=U.get(ue))!=null?se:0)-((re=U.get(de))!=null?re:0)}).forEach(te=>{let X=te.closest(s2);X?X.appendChild(te.parentElement===X?te:te.closest(`${s2} > *`)):ie.appendChild(te.parentElement===ie?te:te.closest(`${s2} > *`))}),V.sort((te,X)=>X[1]-te[1]).forEach(te=>{var X;let se=(X=A.current)==null?void 0:X.querySelector(`${dm}[${qh}="${encodeURIComponent(te[0])}"]`);se==null||se.parentElement.appendChild(se)})}function $(){let U=q().find(ie=>ie.getAttribute("aria-disabled")!=="true"),V=U==null?void 0:U.getAttribute(qh);D.setState("value",V||void 0)}function z(){var U,V,ie,te;if(!r.current.search||l.current.shouldFilter===!1){r.current.filtered.count=i.current.size;return}r.current.filtered.groups=new Set;let X=0;for(let se of i.current){let re=(V=(U=a.current.get(se))==null?void 0:U.value)!=null?V:"",de=(te=(ie=a.current.get(se))==null?void 0:ie.keywords)!=null?te:[],ue=B(re,de);r.current.filtered.items.set(se,ue),ue>0&&X++}for(let[se,re]of s.current)for(let de of re)if(r.current.filtered.items.get(de)>0){r.current.filtered.groups.add(se);break}r.current.filtered.count=X}function W(){var U,V,ie;let te=P();te&&(((U=te.parentElement)==null?void 0:U.firstChild)===te&&((ie=(V=te.closest(dm))==null?void 0:V.querySelector(Hje))==null||ie.scrollIntoView({block:"nearest"})),te.scrollIntoView({block:"nearest"}))}function P(){var U;return(U=A.current)==null?void 0:U.querySelector(`${bU}[aria-selected="true"]`)}function q(){var U;return Array.from(((U=A.current)==null?void 0:U.querySelectorAll(C6))||[])}function I(U){let V=q()[U];V&&D.setState("value",V.getAttribute(qh))}function Q(U){var V;let ie=P(),te=q(),X=te.findIndex(re=>re===ie),se=te[X+U];(V=l.current)!=null&&V.loop&&(se=X+U<0?te[te.length-1]:X+U===te.length?te[0]:te[X+U]),se&&D.setState("value",se.getAttribute(qh))}function K(U){let V=P(),ie=V==null?void 0:V.closest(dm),te;for(;ie&&!te;)ie=U>0?Zje(ie,dm):Jje(ie,dm),te=ie==null?void 0:ie.querySelector(C6);te?D.setState("value",te.getAttribute(qh)):Q(U)}let Z=()=>I(q().length-1),Y=U=>{U.preventDefault(),U.metaKey?Z():U.altKey?K(1):Q(1)},R=U=>{U.preventDefault(),U.metaKey?I(0):U.altKey?K(-1):Q(-1)};return b.createElement(vu.div,{ref:n,tabIndex:-1,...w,"cmdk-root":"",onKeyDown:U=>{var V;(V=w.onKeyDown)==null||V.call(w,U);let ie=U.nativeEvent.isComposing||U.keyCode===229;if(!(U.defaultPrevented||ie))switch(U.key){case"n":case"j":{S&&U.ctrlKey&&Y(U);break}case"ArrowDown":{Y(U);break}case"p":case"k":{S&&U.ctrlKey&&R(U);break}case"ArrowUp":{R(U);break}case"Home":{U.preventDefault(),I(0);break}case"End":{U.preventDefault(),Z();break}case"Enter":{U.preventDefault();let te=P();if(te){let X=new Event(EN);te.dispatchEvent(X)}}}}},b.createElement("label",{"cmdk-label":"",htmlFor:F.inputId,id:F.labelId,style:nNe},u),ek(e,U=>b.createElement(wU.Provider,{value:D},b.createElement(kU.Provider,{value:F},U))))}),qje=b.forwardRef((e,n)=>{var r,i;let s=Fl(),a=b.useRef(null),o=b.useContext(SU),l=Dv(),u=jU(e),d=(i=(r=u.current)==null?void 0:r.forceMount)!=null?i:o==null?void 0:o.forceMount;Od(()=>{if(!d)return l.item(s,o==null?void 0:o.id)},[d]);let p=NU(s,a,[e.value,e.children,a],e.keywords),f=vT(),g=fu(E=>E.value&&E.value===p.current),_=fu(E=>d||l.filter()===!1?!0:E.search?E.filtered.items.get(s)>0:!0);b.useEffect(()=>{let E=a.current;if(!(!E||e.disabled))return E.addEventListener(EN,x),()=>E.removeEventListener(EN,x)},[_,e.onSelect,e.disabled]);function x(){var E,D;v(),(D=(E=u.current).onSelect)==null||D.call(E,p.current)}function v(){f.setState("value",p.current,!0)}if(!_)return null;let{disabled:S,value:w,onSelect:N,forceMount:C,keywords:T,...A}=e;return b.createElement(vu.div,{ref:hu(a,n),...A,id:s,"cmdk-item":"",role:"option","aria-disabled":!!S,"aria-selected":!!g,"data-disabled":!!S,"data-selected":!!g,onPointerMove:S||l.getDisablePointerSelection()?void 0:v,onClick:S?void 0:x},e.children)}),Uje=b.forwardRef((e,n)=>{let{heading:r,children:i,forceMount:s,...a}=e,o=Fl(),l=b.useRef(null),u=b.useRef(null),d=Fl(),p=Dv(),f=fu(_=>s||p.filter()===!1?!0:_.search?_.filtered.groups.has(o):!0);Od(()=>p.group(o),[]),NU(o,l,[e.value,e.heading,u]);let g=b.useMemo(()=>({id:o,forceMount:s}),[s]);return b.createElement(vu.div,{ref:hu(l,n),...a,"cmdk-group":"",role:"presentation",hidden:f?void 0:!0},r&&b.createElement("div",{ref:u,"cmdk-group-heading":"","aria-hidden":!0,id:d},r),ek(e,_=>b.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?d:void 0},b.createElement(SU.Provider,{value:g},_))))}),Vje=b.forwardRef((e,n)=>{let{alwaysRender:r,...i}=e,s=b.useRef(null),a=fu(o=>!o.search);return!r&&!a?null:b.createElement(vu.div,{ref:hu(s,n),...i,"cmdk-separator":"",role:"separator"})}),Kje=b.forwardRef((e,n)=>{let{onValueChange:r,...i}=e,s=e.value!=null,a=vT(),o=fu(d=>d.search),l=fu(d=>d.selectedItemId),u=Dv();return b.useEffect(()=>{e.value!=null&&a.setState("search",e.value)},[e.value]),b.createElement(vu.input,{ref:n,...i,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":u.listId,"aria-labelledby":u.labelId,"aria-activedescendant":l,id:u.inputId,type:"text",value:s?e.value:o,onChange:d=>{s||a.setState("search",d.target.value),r==null||r(d.target.value)}})}),Yje=b.forwardRef((e,n)=>{let{children:r,label:i="Suggestions",...s}=e,a=b.useRef(null),o=b.useRef(null),l=fu(d=>d.selectedItemId),u=Dv();return b.useEffect(()=>{if(o.current&&a.current){let d=o.current,p=a.current,f,g=new ResizeObserver(()=>{f=requestAnimationFrame(()=>{let _=d.offsetHeight;p.style.setProperty("--cmdk-list-height",_.toFixed(1)+"px")})});return g.observe(d),()=>{cancelAnimationFrame(f),g.unobserve(d)}}},[]),b.createElement(vu.div,{ref:hu(a,n),...s,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":l,"aria-label":i,id:u.listId},ek(e,d=>b.createElement("div",{ref:hu(o,u.listInnerRef),"cmdk-list-sizer":""},d)))}),Gje=b.forwardRef((e,n)=>{let{open:r,onOpenChange:i,overlayClassName:s,contentClassName:a,container:o,...l}=e;return b.createElement(Aje,{open:r,onOpenChange:i},b.createElement(Tje,{container:o},b.createElement(Mje,{"cmdk-overlay":"",className:s}),b.createElement(Rje,{"aria-label":e.label,"cmdk-dialog":"",className:a},b.createElement(CU,{ref:n,...l}))))}),Xje=b.forwardRef((e,n)=>fu(r=>r.filtered.count===0)?b.createElement(vu.div,{ref:n,...e,"cmdk-empty":"",role:"presentation"}):null),Qje=b.forwardRef((e,n)=>{let{progress:r,children:i,label:s="Loading...",...a}=e;return b.createElement(vu.div,{ref:n,...a,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":s},ek(e,o=>b.createElement("div",{"aria-hidden":!0},o)))}),ba=Object.assign(CU,{List:Yje,Item:qje,Input:Kje,Group:Uje,Separator:Vje,Dialog:Gje,Empty:Xje,Loading:Qje});function Zje(e,n){let r=e.nextElementSibling;for(;r;){if(r.matches(n))return r;r=r.nextElementSibling}}function Jje(e,n){let r=e.previousElementSibling;for(;r;){if(r.matches(n))return r;r=r.previousElementSibling}}function jU(e){let n=b.useRef(e);return Od(()=>{n.current=e}),n}var Od=typeof window>"u"?b.useEffect:b.useLayoutEffect;function Uh(e){let n=b.useRef();return n.current===void 0&&(n.current=e()),n}function fu(e){let n=vT(),r=()=>e(n.snapshot());return b.useSyncExternalStore(n.subscribe,r,r)}function NU(e,n,r,i=[]){let s=b.useRef(),a=Dv();return Od(()=>{var o;let l=(()=>{var d;for(let p of r){if(typeof p=="string")return p.trim();if(typeof p=="object"&&"current"in p)return p.current?(d=p.current.textContent)==null?void 0:d.trim():s.current}})(),u=i.map(d=>d.trim());a.value(e,l,u),(o=n.current)==null||o.setAttribute(qh,l),s.current=l}),s}var eNe=()=>{let[e,n]=b.useState(),r=Uh(()=>new Map);return Od(()=>{r.current.forEach(i=>i()),r.current=new Map},[e]),(i,s)=>{r.current.set(i,s),n({})}};function tNe(e){let n=e.type;return typeof n=="function"?n(e.props):"render"in n?n.render(e.props):e}function ek({asChild:e,children:n},r){return e&&b.isValidElement(n)?b.cloneElement(tNe(n),{ref:n.ref},r(n.props.children)):r(n)}var nNe={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};let Dl=null,Ju=null;const AN=new Set;function j6(){AN.forEach(e=>e())}function N6(){return Dl?Promise.resolve(Dl):Ju||(Ju=DQ().then(e=>(Dl=e,Ju=null,j6(),Dl)).catch(e=>{throw Ju=null,Dl=[],j6(),e}),Ju)}function EU(){const[,e]=b.useState(0),[n,r]=b.useState(Dl===null);b.useEffect(()=>{const s=()=>e(a=>a+1);return AN.add(s),Dl===null?(r(!0),N6().catch(()=>{}).finally(()=>r(!1))):r(!1),()=>{AN.delete(s)}},[]);const i=b.useCallback(async()=>{Dl=null,Ju=null,r(!0);try{await N6()}finally{r(!1)}},[]);return{profiles:Dl??[],loading:n,refresh:i}}const AU={"openai-codex":"OpenAI Codex",openai:"OpenAI",anthropic:"Anthropic","claude-code":"Claude Code",gmail:"Gmail",google:"Google",slack:"Slack",discord:"Discord",matrix:"Matrix",notion:"Notion",github:"GitHub",gitlab:"GitLab",linear:"Linear",jira:"Jira",manus:"Manus"};function TN(e){return AU[e]??e}function nu(e,n="item"){return(e??"").normalize("NFKD").replace(/[̀-ͯ]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,64).replace(/-+$/g,"")||n}function rNe(e,n){const r=new Set(n);if(!r.has(e))return e;for(let i=2;i<1e3;i++){const s=`${e}-${i}`;if(!r.has(s))return s}return`${e}-${Date.now()}`}const iNe=9099,sNe=9100,TU={width:"100%",padding:"8px 10px",borderRadius:8,border:"1px solid var(--pc-border)",background:"var(--pc-bg-input)",color:"var(--pc-text-primary)",fontSize:12.5,outline:"none"},a2={...TU,fontFamily:"var(--pc-font-mono, ui-monospace, monospace)"},hm={display:"block",fontSize:10.5,fontWeight:600,color:"var(--revka-text-faint)",textTransform:"uppercase",letterSpacing:"0.08em",marginBottom:6};function aNe({open:e,onClose:n,onCreated:r,defaultProvider:i}){const s=b.useRef(null),[a,o]=b.useState(""),[l,u]=b.useState(""),[d,p]=b.useState(!1),[f,g]=b.useState(""),[_,x]=b.useState(""),[v,S]=b.useState(!1),[w,N]=b.useState(!1),[C,T]=b.useState(null);b.useEffect(()=>{e&&(o(i??""),u(""),p(!1),g(""),x(""),S(!1),N(!1),T(null),requestAnimationFrame(()=>{var H;return(H=s.current)==null?void 0:H.focus()}))},[e,i]),b.useEffect(()=>{d||a.trim()&&!l&&u("default")},[a,l,d]),b.useEffect(()=>{if(!e)return;const H=$=>{$.key==="Escape"&&($.preventDefault(),w||n())};return window.addEventListener("keydown",H),()=>window.removeEventListener("keydown",H)},[e,n,w]);const A=b.useMemo(()=>!!(a.trim()&&l.trim()&&f&&!w),[a,l,f,w]),E=b.useMemo(()=>Object.entries(AU),[]);if(!e||typeof document>"u")return null;const D=H=>{H.target===H.currentTarget&&!w&&n()},F=async H=>{if(H.preventDefault(),!A)return;N(!0),T(null);const $=nu(a,"provider"),z=nu(l,"default");try{const W=await PQ({provider:$,profile_name:z,token:f,account_id:_.trim()||void 0,kind:"token"});await r(W.id)}catch(W){let P="Failed to create auth profile";W instanceof ql?W.status===409?P="A profile with that provider+name already exists":P=W.message.replace(/^API \d+: /,"")||P:W instanceof Error&&(P=W.message),T(P),N(!1)}},B=c.jsx("div",{role:"dialog","aria-modal":"true","aria-label":"Create auth profile",onClick:D,style:{position:"fixed",inset:0,zIndex:iNe,background:"rgba(0, 0, 0, 0.48)",backdropFilter:"blur(6px)",display:"flex",alignItems:"flex-start",justifyContent:"center",paddingTop:"12vh"},children:c.jsxs("form",{onSubmit:F,className:"revka-panel","data-variant":"primary",style:{width:"min(540px, calc(100vw - 32px))",maxHeight:"calc(100vh - 24vh)",display:"flex",flexDirection:"column",borderRadius:14,borderColor:"var(--revka-border-strong)",boxShadow:"0 32px 80px rgba(0,0,0,0.48)",zIndex:sNe,overflow:"hidden"},onClick:H=>H.stopPropagation(),children:[c.jsxs("div",{style:{padding:"14px 16px",borderBottom:"1px solid var(--revka-border-soft)",display:"flex",alignItems:"center",gap:10},children:[c.jsx("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:28,height:28,borderRadius:8,background:"color-mix(in srgb, var(--pc-accent-glow) 60%, transparent)",color:"var(--pc-accent)"},children:c.jsx(hg,{size:15})}),c.jsxs("div",{style:{flex:1,minWidth:0},children:[c.jsx("div",{style:{fontSize:13,fontWeight:700,color:"var(--revka-text-primary)"},children:"New auth profile"}),c.jsx("div",{style:{fontSize:11,color:"var(--revka-text-faint)"},children:"Static token only — for OAuth providers, use the gateway's /config flow."})]}),c.jsx("button",{type:"button",onClick:()=>{w||n()},disabled:w,"aria-label":"Close",style:{background:"transparent",border:0,padding:4,cursor:w?"not-allowed":"pointer",color:"var(--revka-text-faint)",opacity:w?.5:1},children:c.jsx(mi,{size:16})})]}),c.jsxs("div",{style:{padding:"14px 16px",display:"flex",flexDirection:"column",gap:12,overflowY:"auto"},children:[c.jsxs("div",{children:[c.jsx("label",{style:hm,htmlFor:"new-auth-provider",children:"Provider *"}),c.jsx("input",{id:"new-auth-provider",ref:s,type:"text",value:a,onChange:H=>o(H.target.value),list:"new-auth-provider-options",placeholder:"openai, anthropic, github…",style:a2,disabled:w,autoComplete:"off"}),c.jsx("datalist",{id:"new-auth-provider-options",children:E.map(([H,$])=>c.jsx("option",{value:H,children:$},H))})]}),c.jsxs("div",{children:[c.jsx("label",{style:hm,htmlFor:"new-auth-profile-name",children:"Profile name *"}),c.jsx("input",{id:"new-auth-profile-name",type:"text",value:l,onChange:H=>{u(nu(H.target.value,"default")),p(!0)},placeholder:"default",style:a2,disabled:w,autoComplete:"off"})]}),c.jsxs("div",{children:[c.jsx("label",{style:hm,children:"Kind"}),c.jsx("div",{style:{padding:"6px 10px",borderRadius:8,border:"1px solid var(--pc-border)",background:"var(--pc-bg-input)",color:"var(--revka-text-secondary)",fontSize:12,display:"inline-flex",alignItems:"center",gap:6},children:"API key / token"})]}),c.jsxs("div",{children:[c.jsx("label",{style:hm,htmlFor:"new-auth-token",children:"Token *"}),c.jsxs("div",{style:{position:"relative"},children:[c.jsx("input",{id:"new-auth-token",type:v?"text":"password",value:f,onChange:H=>g(H.target.value),placeholder:"sk-… / ghp_… / xoxb-…",style:{...a2,paddingRight:36},disabled:w,autoComplete:"off",spellCheck:!1}),c.jsx("button",{type:"button",onClick:()=>S(H=>!H),"aria-label":v?"Hide token":"Show token",disabled:w,style:{position:"absolute",top:"50%",right:6,transform:"translateY(-50%)",background:"transparent",border:0,padding:4,cursor:w?"not-allowed":"pointer",color:"var(--revka-text-faint)"},children:v?c.jsx(dE,{size:14}):c.jsx(nv,{size:14})})]})]}),c.jsxs("div",{children:[c.jsx("label",{style:hm,htmlFor:"new-auth-account-id",children:"Account ID"}),c.jsx("input",{id:"new-auth-account-id",type:"text",value:_,onChange:H=>x(H.target.value),placeholder:"email or id, for your reference",style:TU,disabled:w,autoComplete:"off"})]}),C&&c.jsx("div",{role:"alert",style:{padding:"8px 10px",borderRadius:8,background:"color-mix(in srgb, var(--revka-status-danger) 14%, transparent)",border:"1px solid var(--revka-status-danger)",color:"var(--revka-status-danger)",fontSize:11.5},children:C})]}),c.jsxs("div",{style:{padding:"12px 16px",borderTop:"1px solid var(--revka-border-soft)",display:"flex",alignItems:"center",justifyContent:"flex-end",gap:8},children:[c.jsx("button",{type:"button",onClick:()=>{w||n()},disabled:w,className:"revka-button",children:"Cancel"}),c.jsxs("button",{type:"submit",disabled:!A,className:"revka-button","data-variant":"primary",style:{display:"inline-flex",alignItems:"center",gap:6},children:[w&&c.jsx(Rr,{size:13,className:"animate-spin"}),w?"Creating…":"Create profile"]})]})]})});return na.createPortal(B,document.body)}const MU=360,MN=400,oNe=8,lNe=24,cNe=9e3,uNe=9001;function dNe(e){const n=window.innerWidth,r=window.innerHeight,i=Math.min(e.bottom+oNe,r-MN-8),s=Math.max(8,n-e.right);return{position:"fixed",top:Math.max(8,i),right:s,width:MU,maxHeight:MN}}function hNe(){return{position:"fixed",top:"20vh",left:"50%",transform:"translateX(-50%)",width:MU,maxHeight:MN}}function fNe(e){if(e.kind!=="oauth"||!e.expires_at)return null;const n=Date.parse(e.expires_at);if(isNaN(n))return null;const r=Date.now();return n<=r?{tone:"danger",label:"expired"}:n-r<=lNe*36e5?{tone:"warning",label:"expires soon"}:null}function E6({open:e,onOpenChange:n,value:r,onSelect:i,anchorRect:s,providerFilter:a}){const o=b.useRef(null),{profiles:l,loading:u,refresh:d}=EU(),[p,f]=b.useState(""),[g,_]=b.useState(!1);b.useEffect(()=>{e&&(f(""),requestAnimationFrame(()=>{var C;return(C=o.current)==null?void 0:C.focus()}))},[e]),b.useEffect(()=>{if(!e)return;const C=T=>{T.key==="Escape"&&(T.preventDefault(),n(!1))};return window.addEventListener("keydown",C),()=>window.removeEventListener("keydown",C)},[e,n]);const x=b.useMemo(()=>s?dNe(s):hNe(),[s]),v=b.useMemo(()=>{const C=new Map;for(const T of l){if(a&&T.provider!==a)continue;const A=C.get(T.provider)??[];A.push(T),C.set(T.provider,A)}return Array.from(C.entries()).sort((T,A)=>T[0].localeCompare(A[0]))},[l,a]);if(!e||typeof document>"u")return null;const S=C=>{i(C),n(!1)},w=async C=>{if(window.confirm(`Delete auth profile "${C.provider}:${C.profile_name}"? Workflow steps bound to this profile will fail until rebound.`))try{await LQ(C.id),r===C.id&&i(null),await d()}catch(A){const E=A instanceof ql?A.message.replace(/^API \d+: /,""):A instanceof Error?A.message:"Delete failed";window.alert(`Failed to delete auth profile: ${E}`)}},N=c.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":"Choose auth profile",onClick:C=>{C.target===C.currentTarget&&n(!1)},style:{position:"fixed",inset:0,zIndex:cNe,background:"transparent"},children:[c.jsx("div",{className:"revka-panel","data-variant":"primary",style:{...x,display:"flex",flexDirection:"column",borderRadius:12,borderColor:"var(--revka-border-strong)",boxShadow:"0 24px 64px rgba(0,0,0,0.36)",overflow:"hidden",zIndex:uNe},onClick:C=>C.stopPropagation(),children:c.jsxs(ba,{label:"Choose auth profile",loop:!0,shouldFilter:!0,children:[c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"10px 12px",borderBottom:"1px solid var(--revka-border-soft)"},children:[c.jsx(Aa,{size:14,style:{color:"var(--revka-text-faint)"}}),c.jsx(ba.Input,{ref:o,value:p,onValueChange:f,placeholder:"Search auth profiles…",style:{flex:1,background:"transparent",border:0,outline:"none",color:"var(--revka-text-primary)",fontSize:13}}),c.jsx("kbd",{className:"revka-kbd",style:{fontSize:10,padding:"2px 6px",borderRadius:6,color:"var(--revka-text-faint)",background:"var(--pc-bg-input)",border:"1px solid var(--revka-border-soft)"},children:"ESC"})]}),c.jsxs(ba.List,{style:{flex:1,maxHeight:280,overflowY:"auto",padding:"6px"},children:[c.jsx(ba.Empty,{style:{padding:"20px 16px",textAlign:"center",fontSize:12,color:"var(--revka-text-faint)"},children:u?"Loading auth profiles…":"No auth profiles match"}),v.map(([C,T])=>c.jsx(ba.Group,{heading:TN(C),style:{fontSize:10,fontWeight:700,textTransform:"uppercase",letterSpacing:"0.08em",color:"var(--revka-text-faint)"},children:T.map(A=>{const E=r===A.id,D=fNe(A);return c.jsxs("div",{style:{position:"relative"},onPointerEnter:F=>{const B=F.currentTarget.querySelector("[data-auth-row-delete]");B&&(B.style.opacity="1")},onPointerLeave:F=>{const B=F.currentTarget.querySelector("[data-auth-row-delete]");B&&(B.style.opacity="0")},children:[c.jsx(ba.Item,{value:`${A.provider} ${A.profile_name} ${A.id} ${A.account_id??""}`,keywords:[A.kind,A.provider,A.account_id??""],onSelect:()=>S(A.id),asChild:!0,children:c.jsxs("button",{type:"button",style:{display:"flex",alignItems:"center",gap:10,padding:"8px 10px",paddingRight:34,borderRadius:8,cursor:"pointer",color:"var(--revka-text-primary)",width:"100%",textAlign:"left",background:"transparent",border:0,font:"inherit"},children:[c.jsx("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:24,height:24,borderRadius:6,background:E?"var(--revka-signal-network-soft)":"color-mix(in srgb, var(--pc-accent-glow) 60%, transparent)",color:E?"var(--revka-signal-network)":"var(--pc-accent)",flexShrink:0},children:c.jsx(hg,{size:13})}),c.jsxs("span",{style:{display:"flex",flexDirection:"column",minWidth:0,flex:1},children:[c.jsx("span",{style:{fontSize:12.5,fontWeight:600,fontFamily:"var(--pc-font-mono, ui-monospace, monospace)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:A.profile_name}),A.account_id&&c.jsxs("span",{style:{fontSize:10.5,color:"var(--revka-text-faint)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:["as ",A.account_id]})]}),c.jsx("span",{style:{fontFamily:"var(--pc-font-mono, ui-monospace, monospace)",fontSize:9.5,padding:"2px 6px",borderRadius:4,background:"var(--pc-hover)",color:"var(--revka-text-faint)",flexShrink:0,textTransform:"uppercase",letterSpacing:"0.04em"},children:A.kind}),D&&c.jsxs("span",{title:D.tone==="danger"?`Expired at ${A.expires_at}`:`Expires at ${A.expires_at}`,style:{display:"inline-flex",alignItems:"center",gap:3,fontSize:9.5,padding:"2px 6px",borderRadius:4,background:D.tone==="danger"?"color-mix(in srgb, var(--revka-status-danger) 18%, transparent)":"color-mix(in srgb, var(--revka-status-warning) 18%, transparent)",color:D.tone==="danger"?"var(--revka-status-danger)":"var(--revka-status-warning)",flexShrink:0,textTransform:"uppercase",letterSpacing:"0.04em"},children:[c.jsx(Cs,{size:9}),D.label]})]})}),c.jsx("button",{type:"button","data-auth-row-delete":!0,title:"Delete auth profile","aria-label":`Delete ${A.provider}:${A.profile_name}`,onClick:F=>{F.preventDefault(),F.stopPropagation(),w(A)},style:{position:"absolute",top:"50%",right:8,transform:"translateY(-50%)",opacity:0,transition:"opacity 80ms ease",background:"transparent",border:0,padding:4,borderRadius:6,cursor:"pointer",color:"var(--revka-status-danger)"},children:c.jsx(Wi,{size:12})})]},A.id)})},C))]}),r&&c.jsx("button",{type:"button",onClick:()=>S(null),style:{margin:"0 8px 8px",padding:"6px 10px",fontSize:11,fontWeight:600,borderRadius:6,border:"1px solid var(--revka-status-warning)",background:"color-mix(in srgb, var(--revka-status-warning) 14%, transparent)",color:"var(--revka-status-warning)",cursor:"pointer"},children:"Clear auth profile"}),c.jsxs("div",{style:{padding:"8px 12px",borderTop:"1px solid var(--revka-border-soft)",display:"flex",alignItems:"center",justifyContent:"space-between",fontSize:11,color:"var(--revka-text-faint)"},children:[c.jsxs("span",{children:[l.length," profile",l.length===1?"":"s"]}),c.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:10},children:[c.jsx("a",{href:"/config",target:"_blank",rel:"noreferrer",style:{color:"var(--revka-text-faint)",textDecoration:"none",fontWeight:500},children:"Open config →"}),c.jsx("button",{type:"button",onClick:()=>_(!0),style:{background:"transparent",border:0,padding:0,cursor:"pointer",color:"var(--pc-accent)",fontWeight:600,fontSize:11},children:"+ New auth profile"})]})]})]})}),c.jsx("style",{children:`
        [cmdk-item][data-selected='true'] {
          background: var(--pc-accent-glow);
          box-shadow: inset 2px 0 0 var(--pc-accent);
        }
        [cmdk-item]:hover {
          background: var(--pc-hover);
        }
        [cmdk-group-heading] {
          padding: 6px 10px 4px;
        }
      `})]});return c.jsxs(c.Fragment,{children:[na.createPortal(N,document.body),c.jsx(aNe,{open:g,onClose:()=>_(!1),defaultProvider:a,onCreated:async C=>{await d(),_(!1),S(C)}})]})}const pNe=9099,mNe=9100,gNe={width:"100%",padding:"8px 10px",borderRadius:8,border:"1px solid var(--pc-border)",background:"var(--pc-bg-input)",color:"var(--pc-text-primary)",fontSize:12.5,outline:"none"},fm={...gNe,fontFamily:"var(--pc-font-mono, ui-monospace, monospace)"},pm={display:"block",fontSize:10.5,fontWeight:600,color:"var(--revka-text-faint)",textTransform:"uppercase",letterSpacing:"0.08em",marginBottom:6};function vNe({open:e,onClose:n,onCreated:r,defaultAccount:i,defaultProject:s,defaultRunRegion:a,defaultComputeRegion:o}){const l=b.useRef(null),[u,d]=b.useState(""),[p,f]=b.useState(""),[g,_]=b.useState(""),[x,v]=b.useState(""),[S,w]=b.useState(""),[N,C]=b.useState(!1),[T,A]=b.useState(null);b.useEffect(()=>{e&&(d("revka-cloud-run"),f(i??""),_(s??""),v(a??""),w(o??a??""),C(!1),A(null),requestAnimationFrame(()=>{var H;return(H=l.current)==null?void 0:H.focus()}))},[e,i,s,a,o]),b.useEffect(()=>{if(!e)return;const H=$=>{$.key==="Escape"&&($.preventDefault(),N||n())};return window.addEventListener("keydown",H),()=>window.removeEventListener("keydown",H)},[e,n,N]);const E=b.useMemo(()=>!!(u.trim()&&g.trim()&&!N),[u,g,N]);if(!e||typeof document>"u")return null;const D=H=>{H.target===H.currentTarget&&!N&&n()},F=async H=>{if(H.preventDefault(),!E)return;C(!0),A(null);const $=nu(u,"revka-cloud-run");try{const z=await BQ({name:$,project:g.trim(),account:p.trim()||void 0,run_region:x.trim()||void 0,compute_region:S.trim()||void 0});await r(z.name)}catch(z){let W="Failed to create gcloud config";z instanceof ql?z.status===409?W="A gcloud configuration with that name already exists":W=z.message.replace(/^API \d+: /,"")||W:z instanceof Error&&(W=z.message),A(W),C(!1)}},B=c.jsx("div",{role:"dialog","aria-modal":"true","aria-label":"Create gcloud config",onClick:D,style:{position:"fixed",inset:0,zIndex:pNe,background:"rgba(0, 0, 0, 0.48)",backdropFilter:"blur(6px)",display:"flex",alignItems:"flex-start",justifyContent:"center",paddingTop:"12vh"},children:c.jsxs("form",{onSubmit:F,className:"revka-panel","data-variant":"primary",style:{width:"min(540px, calc(100vw - 32px))",maxHeight:"calc(100vh - 24vh)",display:"flex",flexDirection:"column",borderRadius:14,borderColor:"var(--revka-border-strong)",boxShadow:"0 32px 80px rgba(0,0,0,0.48)",zIndex:mNe,overflow:"hidden"},onClick:H=>H.stopPropagation(),children:[c.jsxs("div",{style:{padding:"14px 16px",borderBottom:"1px solid var(--revka-border-soft)",display:"flex",alignItems:"center",gap:10},children:[c.jsx("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:28,height:28,borderRadius:8,background:"color-mix(in srgb, var(--pc-accent-glow) 60%, transparent)",color:"var(--pc-accent)"},children:c.jsx(rJ,{size:15})}),c.jsxs("div",{style:{flex:1,minWidth:0},children:[c.jsx("div",{style:{fontSize:13,fontWeight:700,color:"var(--revka-text-primary)"},children:"New gcloud config"}),c.jsx("div",{style:{fontSize:11,color:"var(--revka-text-faint)"},children:"Uses the local Cloud SDK credential store. No token bytes are saved to the workflow."})]}),c.jsx("button",{type:"button",onClick:()=>{N||n()},disabled:N,"aria-label":"Close",style:{background:"transparent",border:0,padding:4,cursor:N?"not-allowed":"pointer",color:"var(--revka-text-faint)",opacity:N?.5:1},children:c.jsx(mi,{size:16})})]}),c.jsxs("div",{style:{padding:"14px 16px",display:"flex",flexDirection:"column",gap:12,overflowY:"auto"},children:[c.jsxs("div",{children:[c.jsx("label",{style:pm,htmlFor:"new-gcloud-config-name",children:"Config name *"}),c.jsx("input",{id:"new-gcloud-config-name",ref:l,type:"text",value:u,onChange:H=>d(nu(H.target.value,"revka-cloud-run")),placeholder:"revka-cloud-run",style:fm,disabled:N,autoComplete:"off"})]}),c.jsxs("div",{children:[c.jsx("label",{style:pm,htmlFor:"new-gcloud-account",children:"Account"}),c.jsx("input",{id:"new-gcloud-account",type:"text",value:p,onChange:H=>f(H.target.value),placeholder:"support@example.com",style:fm,disabled:N,autoComplete:"off"})]}),c.jsxs("div",{children:[c.jsx("label",{style:pm,htmlFor:"new-gcloud-project",children:"Project *"}),c.jsx("input",{id:"new-gcloud-project",type:"text",value:g,onChange:H=>_(H.target.value),placeholder:"construct-498201",style:fm,disabled:N,autoComplete:"off"})]}),c.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:8},children:[c.jsxs("div",{children:[c.jsx("label",{style:pm,htmlFor:"new-gcloud-run-region",children:"Cloud Run region"}),c.jsx("input",{id:"new-gcloud-run-region",type:"text",value:x,onChange:H=>v(H.target.value),placeholder:"us-central1",style:fm,disabled:N,autoComplete:"off"})]}),c.jsxs("div",{children:[c.jsx("label",{style:pm,htmlFor:"new-gcloud-compute-region",children:"Compute region"}),c.jsx("input",{id:"new-gcloud-compute-region",type:"text",value:S,onChange:H=>w(H.target.value),placeholder:"us-central1",style:fm,disabled:N,autoComplete:"off"})]})]}),T&&c.jsx("div",{role:"alert",style:{padding:"8px 10px",borderRadius:8,background:"color-mix(in srgb, var(--revka-status-danger) 14%, transparent)",border:"1px solid var(--revka-status-danger)",color:"var(--revka-status-danger)",fontSize:11.5},children:T})]}),c.jsxs("div",{style:{padding:"12px 16px",borderTop:"1px solid var(--revka-border-soft)",display:"flex",alignItems:"center",justifyContent:"flex-end",gap:8},children:[c.jsx("button",{type:"button",onClick:()=>{N||n()},disabled:N,className:"revka-button",children:"Cancel"}),c.jsxs("button",{type:"submit",disabled:!E,className:"revka-button","data-variant":"primary",style:{display:"inline-flex",alignItems:"center",gap:6},children:[N&&c.jsx(Rr,{size:13,className:"animate-spin"}),N?"Creating...":"Create config"]})]})]})});return na.createPortal(B,document.body)}const yNe=9100,A6=12,_Ne=240,RU=360,Nx=280,mm=8;function xNe(e,n,r){const i=[];for(const s of e)s&&(i.push({insert:`\${${s}}`,label:`\${${s}}`,group:"Steps"}),i.push({insert:`\${${s}.output}`,label:`\${${s}.output}`,group:"Steps"}),i.push({insert:`\${${s}.status}`,label:`\${${s}.status}`,group:"Steps"}),i.push({insert:`\${${s}.error}`,label:`\${${s}.error}`,group:"Steps"}));for(const s of n)s&&i.push({insert:`\${input.${s}}`,label:`\${input.${s}}`,group:"Inputs"});for(const s of r)s&&i.push({insert:`\${trigger.${s}}`,label:`\${trigger.${s}}`,group:"Trigger"});return i.push({insert:"${env.<name>}",label:"${env.<name>}",group:"Env"}),i}function bNe(e,n){if(!n)return e.slice(0,A6);const r=n.toLowerCase();return e.map(s=>{const a=s.label.replace(/^\$\{/,"").toLowerCase();let o=-1;return a.startsWith(r)?o=2:a.includes(r)&&(o=1),{s,score:o}}).filter(s=>s.score>=0).sort((s,a)=>a.score-s.score).slice(0,A6).map(s=>s.s)}const kNe=["boxSizing","width","height","overflowX","overflowY","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","borderStyle","paddingTop","paddingRight","paddingBottom","paddingLeft","fontStyle","fontVariant","fontWeight","fontStretch","fontSize","fontSizeAdjust","lineHeight","fontFamily","textAlign","textTransform","textIndent","textDecoration","letterSpacing","wordSpacing","tabSize","whiteSpace","wordBreak","overflowWrap"];function T6(e,n){const r=e.ownerDocument,i=r.createElement("div"),s=window.getComputedStyle(e);for(const g of kNe)i.style[g]=s[g]??"";i.style.position="absolute",i.style.visibility="hidden",i.style.top="0",i.style.left="0",i.style.whiteSpace="pre-wrap",i.style.wordWrap="break-word";const a=e.value.substring(0,n);i.textContent=a;const o=r.createElement("span");o.textContent="​",i.appendChild(o),r.body.appendChild(i);const l=o.getBoundingClientRect(),u=i.getBoundingClientRect();r.body.removeChild(i);const d=e.getBoundingClientRect(),p=l.left-u.left,f=l.bottom-u.top;return{left:d.left+p-e.scrollLeft,bottom:d.top+f-e.scrollTop}}function wNe(e,n){const{width:r,height:i}=n,s=Math.max(mm,Math.min(e.left,r-RU-mm)),a=e.bottom+4,l=a+Nx+mm>i?Math.max(mm,e.bottom-4-Nx):Math.min(a,i-Nx-mm);return{left:s,top:l}}function SNe(e,n){for(let r=n-2;r>=0;r--){const i=e[r];if(i==="}")return-1;if(i==="$"&&e[r+1]==="{")return r}return-1}function ar({value:e,onChange:n,placeholder:r,rows:i,style:s,stepIds:a,workflowInputs:o=[],triggerFields:l=[]}){const u=b.useRef(null),[d,p]=b.useState(!1),[f,g]=b.useState(""),_=b.useRef(-1),[x,v]=b.useState(0),[S,w]=b.useState({left:0,bottom:0}),[N,C]=b.useState(()=>typeof window<"u"?{width:window.innerWidth,height:window.innerHeight}:{width:0,height:0}),T=b.useMemo(()=>xNe(a,o,l),[a,o,l]),A=b.useMemo(()=>bNe(T,f),[T,f]);b.useEffect(()=>{v(0)},[f,d]);const E=b.useCallback(()=>{const I=u.current;if(!I)return;const Q=I.selectionStart??0,K=SNe(I.value,Q);if(K<0){_.current=-1,p(!1);return}const Z=I.value.substring(K+2,Q);if(/[\s\n\r]/.test(Z)){_.current=-1,p(!1);return}_.current=K,g(Z),w(T6(I,Q)),p(!0)},[]),D=b.useCallback(I=>{n(I.target.value),requestAnimationFrame(()=>E())},[n,E]),F=b.useCallback(I=>{const Q=u.current;if(!Q)return;const K=_.current;if(K<0)return;const Z=Q.selectionStart??0,Y=Q.value.substring(0,K),R=Q.value.substring(Z),U=Y+I.insert+R,V=Y.length+I.insert.length;n(U),requestAnimationFrame(()=>{const ie=u.current;ie&&(ie.setSelectionRange(V,V),ie.focus())}),p(!1)},[n]),B=b.useCallback(I=>{if(!(!d||A.length===0))if(I.key==="ArrowDown")I.preventDefault(),v(Q=>(Q+1)%A.length);else if(I.key==="ArrowUp")I.preventDefault(),v(Q=>(Q-1+A.length)%A.length);else if(I.key==="Tab"||I.key==="Enter"){I.preventDefault();const Q=A[x];Q&&F(Q)}else I.key==="Escape"?(I.preventDefault(),p(!1)):(I.key==="ArrowLeft"||I.key==="ArrowRight")&&p(!1)},[d,A,x,F]),H=b.useCallback(()=>{E()},[E]),$=b.useCallback(()=>{p(!1)},[]);b.useLayoutEffect(()=>{if(!d)return;const I=()=>{const Q=u.current;if(!Q)return;const K=Q.selectionStart??0;w(T6(Q,K)),C({width:window.innerWidth,height:window.innerHeight})};return window.addEventListener("scroll",I,!0),window.addEventListener("resize",I),()=>{window.removeEventListener("scroll",I,!0),window.removeEventListener("resize",I)}},[d]);const z=b.useMemo(()=>wNe(S,N),[S,N]),W=b.useMemo(()=>{const I=["Steps","Inputs","Trigger","Env"],Q=new Map;for(const K of A){const Z=Q.get(K.group)??[];Z.push(K),Q.set(K.group,Z)}return I.map(K=>({group:K,items:Q.get(K)??[]})).filter(K=>K.items.length>0)},[A]),P=b.useCallback(I=>A.indexOf(I),[A]),q=d&&A.length>0&&typeof document<"u"?na.createPortal(c.jsx("div",{onMouseDown:I=>I.preventDefault(),style:{position:"fixed",left:z.left,top:z.top,zIndex:yNe,minWidth:_Ne,maxWidth:RU,maxHeight:Nx,overflowY:"auto",background:"var(--pc-bg-elevated)",border:"1px solid var(--pc-border)",borderRadius:10,boxShadow:"0 12px 32px rgba(0,0,0,0.32)",padding:4,fontSize:12,color:"var(--pc-text-primary)"},children:W.map(({group:I,items:Q})=>c.jsxs("div",{style:{marginBottom:2},children:[c.jsx("div",{style:{fontSize:9,fontWeight:700,textTransform:"uppercase",letterSpacing:"0.12em",color:"var(--pc-text-faint)",padding:"6px 8px 2px"},children:I}),Q.map(K=>{const Z=P(K),Y=Z===x;return c.jsx("div",{role:"option","aria-selected":Y,onMouseEnter:()=>v(Z),onMouseDown:R=>{R.preventDefault(),F(K)},style:{padding:"6px 8px",borderRadius:6,cursor:"pointer",fontFamily:"var(--pc-font-mono, ui-monospace, monospace)",background:Y?"var(--pc-accent-glow)":"transparent",boxShadow:Y?"inset 2px 0 0 var(--pc-accent)":"none",color:Y?"var(--pc-text-primary)":"var(--pc-text-secondary)"},children:K.label},K.label)})]},I))}),document.body):null;return c.jsxs(c.Fragment,{children:[c.jsx("textarea",{ref:u,value:e,onChange:D,onKeyDown:B,onSelect:H,onClick:H,onBlur:$,placeholder:r,rows:i,style:s}),q]})}let Pl=null,RN=!0,ON=null,ed=null;const DN=new Set;function M6(){DN.forEach(e=>e())}function R6(){return Pl?Promise.resolve(Pl):ed||(ed=IQ().then(e=>(RN=e.available,ON=e.error,Pl=e.configs??[],ed=null,M6(),Pl)).catch(e=>{throw RN=!1,ON=e instanceof Error?e.message:"Failed to load gcloud configs",Pl=[],ed=null,M6(),e}),ed)}function CNe(){const[,e]=b.useState(0),[n,r]=b.useState(Pl===null);b.useEffect(()=>{const s=()=>e(a=>a+1);return DN.add(s),Pl===null?(r(!0),R6().catch(()=>{}).finally(()=>r(!1))):r(!1),()=>{DN.delete(s)}},[]);const i=b.useCallback(async()=>{Pl=null,ed=null,r(!0);try{await R6()}finally{r(!1)}},[]);return{configs:Pl??[],available:RN,error:ON,loading:n,refresh:i}}const tk=["google_agents_cli","a2a_discover","a2a_send_task","a2a_get_remote_task"],jNe=new Set(tk);function $b(e){const n=new Set,r=[];for(const i of e){const s=String(i||"").trim();!s||n.has(s)||(n.add(s),r.push(s))}return r}function o2(e){const n=$b(e);return n.includes("google_agents_cli")?$b([...n,...tk]):n}function NNe(e){const n=new Set($b(e));return tk.every(r=>n.has(r))}function O6(e){return $b(e).some(n=>jNe.has(n))}const ENe=new Set(["agent","shell","python","email","a2a"]),ANe=["coder","researcher","reviewer"],Ah=["claude","codex","agy","agent","opencode"];function El(e){return e.split(/\r?\n|,/).map(n=>n.trim()).filter(Boolean)}function Ii(e,n){const r=e.join(", "),[i,s]=b.useState(r),[a,o]=b.useState(!1);b.useEffect(()=>{a||s(r)},[a,r]),b.useEffect(()=>{o(!1),s(r)},[n]);const l=b.useCallback(()=>{const u=El(i);return s(u.join(", ")),o(!1),u},[i]);return{draft:i,setDraft:s,startEditing:()=>o(!0),commit:l}}function TNe(e){var r;if(((r=e.conditionalBranches)==null?void 0:r.length)>0)return e.conditionalBranches.map(i=>({...i}));const n=[];return(e.condition||e.onTrueValue)&&n.push({condition:e.condition||"",goto:"",value:e.onTrueValue||void 0}),e.onFalseValue&&n.push({condition:"default",goto:"",value:e.onFalseValue}),n.length>0?n:[{condition:"",goto:"",value:void 0},{condition:"default",goto:"",value:void 0}]}function MNe(e){const n=e.map(s=>({condition:s.condition,goto:s.goto,value:s.value||void 0})),r=n.find(s=>s.condition.trim()!=="default"),i=n.find(s=>s.condition.trim()==="default")??n.find(s=>s!==r);return{conditionalBranches:n,condition:(r==null?void 0:r.condition)??"",onTrueValue:(r==null?void 0:r.value)??"",onFalseValue:(i==null?void 0:i.value)??""}}function gm(e){return nu(e,"step")}function l2(e,n){return rNe(e,n)}const vt={width:"100%",padding:"6px 8px",borderRadius:8,border:"1px solid var(--pc-border)",background:"var(--pc-bg-input)",color:"var(--pc-text-primary)",fontSize:12,outline:"none"},lt={...vt,fontFamily:"var(--pc-font-mono, ui-monospace, monospace)"},Ce={display:"block",fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.08em",color:"var(--pc-text-faint)",marginBottom:4},pr={padding:12,borderRadius:10,border:"1px solid var(--pc-border)",background:"var(--pc-bg-base)",display:"flex",flexDirection:"column",gap:10},Un={fontSize:10,fontWeight:700,textTransform:"uppercase",letterSpacing:"0.12em",color:"var(--pc-text-faint)"};function mr(){return{fontSize:10,color:"var(--pc-text-faint)",marginTop:2}}function RNe({node:e,existingTaskIds:n,onUpdate:r,onRenameStep:i,onDelete:s,onChangeType:a,dagContext:o,onRunToHere:l,runToHereDisabled:u=!1,runToHereDisabledReason:d,computeRunToHereClosure:p}){const f=(o==null?void 0:o.stepIds)??[],g=(o==null?void 0:o.workflowInputs)??[],_=(o==null?void 0:o.triggerFields)??[],x=e.data,v=x.type??"agent",S=M2e[v],w=b.useMemo(()=>TNe(x),[x]),N=b.useMemo(()=>n.filter(L=>L!==x.taskId),[n,x.taskId]),C=b.useCallback(L=>{r(e.id,MNe(L))},[e.id,r]),[T,A]=b.useState(()=>gm(x.name||"")===x.taskId);b.useEffect(()=>{A(gm(x.name||"")===x.taskId)},[e.id]);const E=b.useMemo(()=>n.filter(L=>L!==x.taskId),[n,x.taskId]),D=Ii(x.agentRequiredTools||[],e.id),F=Ii(x.agentOutputFields||[],e.id),B=Ii(x.agentQualityCriteria||[],e.id),H=Ii(x.humanApprovalApproveKeywords||[],e.id),$=Ii(x.humanApprovalRejectKeywords||[],e.id),z=Ii(x.mapReduceSplits||[],e.id),W=Ii(x.kumihoSeedBundles||[],e.id),P=Ii(x.kumihoSeedKrefs||[],e.id),q=Ii(x.kumihoSeedQueries||[],e.id),I=Ii(x.kumihoTraversalEdgeTypes||[],e.id),Q=Ii(x.kumihoFiltersIncludeKinds||[],e.id),K=Ii(x.kumihoFiltersExcludeTags||[],e.id),Z=Ii(x.kumihoLockTagPreference||[],e.id),Y=Ii(x.kumihoNewRevisionTags||[],e.id),R=Ii(x.kumihoPatchTagsRemove||[],e.id),U=Ii(x.kumihoPatchTagsAdd||[],e.id),V=b.useCallback(L=>{r(e.id,{name:L,label:L})},[e.id,r]),ie=b.useCallback(L=>{if(T){const Qe=l2(gm(L),E);Qe!==x.taskId&&i(x.taskId,Qe)}},[T,x.taskId,E,i]),te=b.useCallback(L=>{F.setDraft(L),r(e.id,{agentOutputFields:El(L)})},[F,e.id,r]),X=b.useCallback(()=>{r(e.id,{agentOutputFields:F.commit()})},[F,e.id,r]),se=b.useCallback(L=>{const Qe=El(L),_t=o2(Qe),Gt=_t.length===Qe.length&&_t.every((jr,Qr)=>jr===Qe[Qr]);D.setDraft(Gt?L:_t.join(", ")),r(e.id,{agentRequiredTools:_t,...O6(_t)&&!["all","google_agentops"].includes(x.agentTools||"none")?{agentTools:"google_agentops"}:{}})},[D,x.agentTools,e.id,r]),re=b.useCallback(()=>{const L=D.commit(),Qe=o2(L);Qe.join(", ")!==L.join(", ")&&D.setDraft(Qe.join(", ")),r(e.id,{agentRequiredTools:Qe,...O6(Qe)&&!["all","google_agentops"].includes(x.agentTools||"none")?{agentTools:"google_agentops"}:{}})},[D,x.agentTools,e.id,r]),de=b.useCallback(()=>{const L=o2([...x.agentRequiredTools||[],"google_agents_cli"]);D.setDraft(L.join(", ")),r(e.id,{agentRequiredTools:L,agentTools:"google_agentops"})},[D,x.agentRequiredTools,e.id,r]),[ue,ae]=b.useState(x.taskId);b.useEffect(()=>{ae(x.taskId)},[x.taskId]);const pe=b.useCallback(L=>{ae(L),A(!1)},[]),J=b.useCallback(()=>{const L=gm(ue);if(L===x.taskId){ae(x.taskId);return}const Qe=l2(L,E);i(x.taskId,Qe)},[ue,x.taskId,E,i]),me=b.useCallback(()=>{const L=l2(gm(x.name||""),E);L!==x.taskId&&i(x.taskId,L),A(!0)},[x.name,x.taskId,E,i]),[fe,ve]=b.useState(""),[Ke,ge]=b.useState(!1),[Ue,$e]=b.useState([]),[Bt,ct]=b.useState(!1),[Mt,Tt]=b.useState([{value:"dashboard",label:"Dashboard"}]),{profiles:Dt}=EU(),{configs:Re,loading:et,available:bt,error:yt,refresh:O}=CNe(),[ke,Le]=b.useState(!1),[ye,_e]=b.useState(null),[Pe,ee]=b.useState(!1),[le,je]=b.useState(!1),[Te,Me]=b.useState(null);b.useEffect(()=>{Le(!1),_e(null),je(!1),Me(null),ee(!1)},[e.id]);const Ne=ENe.has(v),Ee=b.useMemo(()=>Dt.find(L=>L.id===x.auth)??null,[Dt,x.auth]),rt=b.useMemo(()=>Dt.find(L=>L.id===x.manusCredentialsRef)??null,[Dt,x.manusCredentialsRef]),Ye=b.useMemo(()=>Re.find(L=>L.name===x.a2aCloudRunConfig)??null,[Re,x.a2aCloudRunConfig]),it=b.useMemo(()=>Ye??Re.find(L=>L.is_active)??Re[0]??null,[Re,Ye]);b.useEffect(()=>{v!=="human_input"&&v!=="notify"&&v!=="human_approval"||hB().then(L=>{const Qe=new Map;Qe.set("dashboard",{value:"dashboard",label:"Dashboard"});for(const _t of L){if(!_t.enabled||_t.status!=="active"||_t.notify_capable===!1)continue;const Gt=_t.id??_t.name;Qe.set(Gt,{value:Gt,label:_t.display_name??_t.name})}Tt(Array.from(Qe.values()))}).catch(()=>Tt([{value:"dashboard",label:"Dashboard"}]))},[v]),b.useEffect(()=>{!Ke||Ue.length>0||(ct(!0),pB(!1,1,50).then(L=>$e(L.skills)).catch(()=>$e([])).finally(()=>ct(!1)))},[Ke,Ue.length]);const kt=b.useMemo(()=>{const L=new Set(x.skills),Qe=Ue.filter(Gt=>!L.has(Gt.name));if(!fe)return Qe;const _t=fe.toLowerCase();return Qe.filter(Gt=>Gt.name.toLowerCase().includes(_t)||Gt.description&&Gt.description.toLowerCase().includes(_t)||Gt.domain&&Gt.domain.toLowerCase().includes(_t))},[fe,x.skills,Ue]),mt=b.useCallback(L=>{const Qe=x.agentHints.includes(L)?x.agentHints.filter(_t=>_t!==L):[...x.agentHints,L];r(e.id,{agentHints:Qe})},[e.id,x.agentHints,r]),zt=b.useCallback(L=>{x.skills.includes(L)||r(e.id,{skills:[...x.skills,L]})},[e.id,x.skills,r]),xe=b.useCallback(L=>{r(e.id,{skills:x.skills.filter(Qe=>Qe!==L)})},[e.id,x.skills,r]),qe=b.useCallback(L=>{const Qe=x.channels??[],_t=Qe.includes(L)?Qe.filter(Gt=>Gt!==L):[...Qe,L];r(e.id,{channels:_t})},[e.id,x.channels,r]),dt=b.useCallback((L,Qe,_t)=>{fT({taskId:e.id,anchorRect:Qe.currentTarget.getBoundingClientRect(),target:L,participantIndex:_t})},[e.id]),[sn,nn]=b.useState(!1),Kt=b.useMemo(()=>sn&&p?p(x.taskId):[],[sn,p,x.taskId]);b.useEffect(()=>{nn(!1)},[e.id]);const rr=b.useCallback(()=>{l&&(l(x.taskId,Kt),nn(!1))},[l,x.taskId,Kt]),yi=v!=="conditional"&&v!=="compute"&&v!=="kumiho_context"&&v!=="kumiho_bundle_update"&&v!=="kumiho_patch_apply"&&v!=="human_input"&&v!=="notify"&&v!=="tag"&&v!=="deprecate"?c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Skills"}),x.skills.length>0&&c.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:4,marginBottom:6},children:x.skills.map(L=>c.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4,padding:"2px 8px",borderRadius:6,fontSize:10,fontWeight:500,background:"var(--pc-accent-glow)",color:"var(--pc-accent-light)",border:"1px solid var(--pc-accent-dim)"},children:[L,c.jsx("button",{type:"button",onClick:()=>xe(L),style:{background:"transparent",border:0,color:"inherit",cursor:"pointer",padding:0},children:c.jsx(mi,{size:10})})]},L))}),c.jsxs("button",{type:"button",onClick:()=>ge(!Ke),style:{display:"inline-flex",alignItems:"center",gap:4,padding:"4px 10px",borderRadius:8,border:"1px solid var(--pc-accent-dim)",background:Ke?"var(--pc-accent-glow)":"transparent",color:"var(--pc-accent-light)",fontSize:11,fontWeight:500,cursor:"pointer"},children:[c.jsx(iu,{size:12}),Ke?"Hide skill picker":"Add skills"]}),Ke&&c.jsxs("div",{style:{marginTop:8,borderRadius:10,border:"1px solid var(--pc-border)",background:"var(--pc-bg-input)",overflow:"hidden"},children:[c.jsxs("div",{style:{position:"relative",padding:8},children:[c.jsx(Aa,{size:12,style:{position:"absolute",left:16,top:"50%",transform:"translateY(-50%)",color:"var(--pc-text-faint)"}}),c.jsx("input",{type:"text",value:fe,onChange:L=>ve(L.target.value),placeholder:"Search skills…",style:{...vt,paddingLeft:26}})]}),c.jsx("div",{style:{maxHeight:144,overflowY:"auto"},children:Bt?c.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:6,padding:12,fontSize:10,color:"var(--pc-text-faint)"},children:[c.jsx(Rr,{size:11,className:"animate-spin"})," Loading skills…"]}):kt.length===0?c.jsx("p",{style:{textAlign:"center",padding:12,fontSize:10,color:"var(--pc-text-faint)"},children:Ue.length===0?"No skills available":"No matching skills"}):kt.slice(0,20).map(L=>c.jsxs("button",{type:"button",onClick:()=>zt(L.name),style:{display:"block",width:"100%",textAlign:"left",padding:"6px 12px",fontSize:11,border:0,background:"transparent",color:"var(--pc-text-secondary)",cursor:"pointer"},onMouseEnter:Qe=>Qe.currentTarget.style.background="var(--pc-hover)",onMouseLeave:Qe=>Qe.currentTarget.style.background="transparent",children:[c.jsx("div",{style:{fontWeight:500,color:"var(--pc-text-primary)"},children:L.name}),L.description&&c.jsx("div",{style:{fontSize:10,color:"var(--pc-text-faint)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:L.description})]},L.kref))})]})]}):null,un=S==null?void 0:S.icon,Yt=NNe(x.agentRequiredTools||[]);return c.jsx(st,{variant:"primary",className:"overflow-hidden",children:c.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%"},children:[c.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"14px 16px",borderBottom:"1px solid var(--revka-border-soft)",position:"relative"},children:[c.jsx("div",{className:"revka-kicker",children:"Step Details"}),c.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[l?c.jsxs("button",{type:"button",onClick:()=>nn(L=>!L),disabled:u,title:u&&d?d:"Run every ancestor of this step plus the step itself, then stop",style:{display:"inline-flex",alignItems:"center",gap:4,padding:"4px 8px",borderRadius:8,border:"1px solid var(--revka-border-soft)",background:"transparent",color:u?"var(--pc-text-faint)":"var(--revka-signal-selected)",fontSize:11,cursor:u?"not-allowed":"pointer",opacity:u?.6:1},children:[c.jsx(cE,{size:12}),"Run to here"]}):null,c.jsxs("button",{type:"button",onClick:()=>s(e.id),title:"Delete step",style:{display:"inline-flex",alignItems:"center",gap:4,padding:"4px 8px",borderRadius:8,border:"1px solid var(--revka-border-soft)",background:"transparent",color:"var(--revka-status-danger)",fontSize:11,cursor:"pointer"},children:[c.jsx(Wi,{size:12}),"Delete"]})]}),sn&&l?c.jsxs("div",{role:"dialog","aria-label":"Run to here confirmation",style:{position:"absolute",top:"calc(100% + 4px)",right:12,zIndex:50,width:280,padding:12,borderRadius:10,border:"1px solid var(--revka-border-soft)",background:"var(--pc-bg-base)",boxShadow:"0 8px 24px rgba(0, 0, 0, 0.25)",display:"flex",flexDirection:"column",gap:10},children:[c.jsx("div",{style:{fontSize:11,color:"var(--pc-text-primary)"},children:Kt.length<=1?"Just this one step will run.":`This will run ${Kt.length} steps in order:`}),Kt.length>1?c.jsx("ol",{style:{margin:0,padding:"0 0 0 18px",fontSize:11,color:"var(--pc-text-faint)",maxHeight:160,overflowY:"auto",fontFamily:"var(--pc-font-mono, ui-monospace, monospace)"},children:Kt.map(L=>c.jsxs("li",{style:{color:L===x.taskId?"var(--revka-signal-selected)":"var(--pc-text-faint)",fontWeight:L===x.taskId?600:400},children:[L,L===x.taskId?"  ← target":""]},L))}):null,c.jsxs("div",{style:{display:"flex",gap:6,justifyContent:"flex-end"},children:[c.jsx("button",{type:"button",onClick:()=>nn(!1),style:{padding:"4px 10px",borderRadius:6,border:"1px solid var(--revka-border-soft)",background:"transparent",color:"var(--pc-text-primary)",fontSize:11,cursor:"pointer"},children:"Cancel"}),c.jsx("button",{type:"button",onClick:rr,style:{padding:"4px 10px",borderRadius:6,border:"1px solid var(--revka-signal-selected)",background:"var(--revka-signal-selected)",color:"var(--pc-bg-base)",fontSize:11,fontWeight:600,cursor:"pointer"},children:"Run"})]})]}):null]}),c.jsxs("div",{style:{overflowY:"auto",padding:16,display:"flex",flexDirection:"column",gap:14},children:[c.jsxs("div",{children:[c.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,marginBottom:4},children:[c.jsx("label",{style:{...Ce,marginBottom:0},children:"Step ID"}),T?c.jsxs("span",{title:"Step ID auto-derives from Name. Edit it manually to break the link.",style:{display:"inline-flex",alignItems:"center",gap:4,padding:"2px 6px",borderRadius:999,fontSize:9.5,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.06em",color:"var(--revka-text-faint)",background:"color-mix(in srgb, var(--revka-text-faint) 12%, transparent)",border:"1px solid var(--revka-border-soft)"},children:[c.jsx(AB,{size:10}),"linked"]}):c.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[c.jsxs("span",{title:"Step ID was edited manually — Name changes no longer touch it.",style:{display:"inline-flex",alignItems:"center",gap:4,padding:"2px 6px",borderRadius:999,fontSize:9.5,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.06em",color:"var(--revka-status-warning)",background:"color-mix(in srgb, var(--revka-status-warning) 14%, transparent)",border:"1px solid color-mix(in srgb, var(--revka-status-warning) 36%, transparent)"},children:[c.jsx(vJ,{size:10}),"manual"]}),c.jsx("button",{type:"button",onClick:me,title:"Reset Step ID to slugify(Name) and re-link",style:{padding:"2px 8px",fontSize:10,fontWeight:600,borderRadius:6,border:"1px solid var(--pc-accent-dim)",background:"transparent",color:"var(--pc-accent-light)",cursor:"pointer"},children:"Re-link"})]})]}),c.jsx("input",{type:"text",value:ue,onChange:L=>pe(L.target.value),onBlur:J,onKeyDown:L=>{L.key==="Enter"&&(L.preventDefault(),L.currentTarget.blur())},spellCheck:!1,style:lt})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Name"}),c.jsx("input",{type:"text",value:x.name,onChange:L=>V(L.target.value),onBlur:L=>ie(L.currentTarget.value),onKeyDown:L=>{L.key==="Enter"&&(L.preventDefault(),L.currentTarget.blur())},style:vt})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Type"}),c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[c.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,padding:"6px 10px",borderRadius:999,background:"var(--pc-accent-glow)",color:"var(--pc-accent)",border:"1px solid var(--pc-accent-dim)",fontSize:12,fontWeight:600,flex:1,minWidth:0},children:[un?c.jsx(un,{size:12}):null,c.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:(S==null?void 0:S.label)??v})]}),c.jsx("button",{type:"button",onClick:a,className:"revka-button",style:{padding:"6px 10px",fontSize:11},children:"Change"})]}),c.jsx("p",{style:{fontSize:11,fontStyle:"italic",color:"var(--pc-text-faint)",marginTop:4},children:"What kind of step this is — determines how it runs."})]}),v==="conditional"&&c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[c.jsx("span",{style:{display:"inline-flex",alignSelf:"flex-start",alignItems:"center",gap:6,padding:"4px 10px",borderRadius:999,fontSize:11,fontWeight:600,background:"color-mix(in srgb, var(--revka-status-warning) 18%, transparent)",color:"var(--revka-status-warning)",border:"1px solid color-mix(in srgb, var(--revka-status-warning) 36%, transparent)"},children:"Conditional Gate"}),c.jsx("div",{style:{display:"flex",flexDirection:"column",gap:10},children:w.map((L,Qe)=>c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6,padding:10,borderRadius:8,border:"1px solid var(--pc-border)",background:"var(--pc-bg-panel)"},children:[c.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8},children:[c.jsxs("span",{style:{...Un,color:"var(--pc-text-muted)"},children:["Branch ",Qe+1]}),c.jsx("button",{type:"button",onClick:()=>{if(w.length<=1){C([{condition:"",goto:"",value:void 0}]);return}C(w.filter((_t,Gt)=>Gt!==Qe))},className:"revka-icon-button",title:"Remove branch","aria-label":"Remove branch",style:{width:24,height:24},children:c.jsx(Wi,{size:12})})]}),c.jsx("label",{style:Ce,children:"Condition"}),c.jsx("textarea",{value:L.condition,onChange:_t=>{const Gt=w.map((jr,Qr)=>Qr===Qe?{...jr,condition:_t.target.value}:jr);C(Gt)},placeholder:Qe===w.length-1?"default":"e.g. review.status == 'passed'",rows:2,style:lt}),c.jsx("label",{style:Ce,children:"Target Step"}),c.jsxs("select",{value:L.goto,onChange:_t=>{const Gt=w.map((jr,Qr)=>Qr===Qe?{...jr,goto:_t.target.value}:jr);C(Gt)},style:vt,children:[c.jsx("option",{value:"",children:"Select target..."}),N.map(_t=>c.jsx("option",{value:_t,children:_t},_t))]}),c.jsx("label",{style:Ce,children:"Output Value (optional)"}),c.jsx("input",{type:"text",value:L.value||"",onChange:_t=>{const Gt=w.map((jr,Qr)=>Qr===Qe?{...jr,value:_t.target.value||void 0}:jr);C(Gt)},placeholder:"e.g. 'approved' or review.output_data.score",style:lt})]},`branch-${Qe}`))}),c.jsx("button",{type:"button",className:"revka-button",onClick:()=>C([...w,{condition:"",goto:"",value:void 0}]),style:{justifyContent:"center"},children:"+ Branch"})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Description"}),c.jsx("textarea",{value:x.description,onChange:L=>r(e.id,{description:L.target.value}),placeholder:v==="conditional"?"What this gate checks…":"What this step does…",rows:3,style:vt})]}),yi,c.jsxs("div",{style:{display:"flex",gap:8},children:[c.jsxs("div",{style:{flex:1},children:[c.jsx("label",{style:Ce,children:"Retry"}),c.jsx("input",{type:"number",min:0,max:5,value:x.retry,onChange:L=>r(e.id,{retry:parseInt(L.target.value)||0}),style:vt})]}),c.jsxs("div",{style:{flex:1},children:[c.jsx("label",{style:Ce,children:"Retry Delay (s)"}),c.jsx("input",{type:"number",min:0,step:1,value:x.retryDelay,onChange:L=>r(e.id,{retryDelay:parseFloat(L.target.value)||5}),style:vt})]})]}),v==="agent"&&c.jsxs("div",{style:pr,children:[c.jsx("div",{style:Un,children:"Agent Config"}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Pool Agent"}),c.jsx("button",{type:"button",onClick:L=>{dt("assign",L)},style:{...lt,textAlign:"left",cursor:"pointer",color:x.assign?"var(--pc-text-primary)":"var(--pc-text-faint)"},children:x.assign||"Choose agent…"}),x.assign&&c.jsxs("div",{style:{marginTop:4,padding:"2px 8px",borderRadius:6,fontSize:10,fontWeight:600,display:"inline-flex",alignItems:"center",gap:4,background:"var(--pc-accent-glow)",color:"var(--pc-accent-light)",border:"1px solid var(--pc-accent-dim)"},children:[c.jsx("span",{children:"●"}),x.assign]})]}),c.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:8},children:[c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Type"}),c.jsxs("select",{value:x.agentType||"claude",onChange:L=>r(e.id,{agentType:L.target.value}),style:vt,children:[c.jsx("option",{value:"claude",children:"claude"}),c.jsx("option",{value:"codex",children:"codex"}),c.jsx("option",{value:"agy",children:"agy (Antigravity)"}),c.jsx("option",{value:"agent",children:"agent (Cursor)"}),c.jsx("option",{value:"opencode",children:"opencode (OpenCode)"})]})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Role"}),c.jsx("input",{type:"text",value:x.role||"",onChange:L=>r(e.id,{role:L.target.value}),placeholder:"coder",style:vt})]})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Timeout (sec)"}),c.jsx("input",{type:"number",min:10,max:3600,value:x.timeout||300,onChange:L=>r(e.id,{timeout:parseInt(L.target.value)||300}),style:{...vt,width:100}})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Model Override"}),c.jsx("input",{type:"text",value:x.model,onChange:L=>r(e.id,{model:L.target.value}),placeholder:"e.g. claude-sonnet-4-5-20250514",style:lt})]}),c.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:8},children:[c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Max Turns"}),c.jsx("input",{type:"number",min:1,max:200,value:x.agentMaxTurns??3,onChange:L=>r(e.id,{agentMaxTurns:parseInt(L.target.value)||3}),style:vt})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Tools"}),c.jsxs("select",{value:x.agentTools||"none",onChange:L=>r(e.id,{agentTools:L.target.value}),style:vt,children:[c.jsx("option",{value:"none",children:"none"}),c.jsx("option",{value:"memory",children:"memory"}),c.jsx("option",{value:"google_agentops",children:"google_agentops"}),c.jsx("option",{value:"all",children:"all"})]})]})]}),c.jsxs("div",{children:[c.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8},children:[c.jsx("label",{style:Ce,children:"Required Tools"}),c.jsxs("button",{type:"button",onClick:de,title:"Add Google Agents CLI and A2A companion tools",style:{display:"inline-flex",alignItems:"center",gap:4,padding:"3px 8px",borderRadius:8,border:Yt?"1px solid var(--revka-signal-selected)":"1px solid var(--pc-accent-dim)",background:Yt?"color-mix(in srgb, var(--revka-signal-selected) 18%, transparent)":"transparent",color:Yt?"var(--revka-signal-selected)":"var(--pc-accent-light)",fontSize:10,fontWeight:700,cursor:"pointer",whiteSpace:"nowrap"},children:[c.jsx(iu,{size:11}),"Google AgentOps"]})]}),Yt&&c.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:4,marginBottom:6},children:tk.map(L=>c.jsx("span",{style:{display:"inline-flex",alignItems:"center",padding:"2px 6px",borderRadius:6,border:"1px solid var(--revka-border-soft)",background:"var(--pc-bg-input)",color:"var(--pc-text-faint)",fontSize:9.5,fontFamily:"var(--pc-font-mono, ui-monospace, monospace)"},children:L},L))}),c.jsx("input",{type:"text",value:D.draft,onFocus:D.startEditing,onChange:L=>se(L.target.value),onBlur:re,onKeyDown:L=>{L.key==="Enter"&&(L.preventDefault(),L.currentTarget.blur())},placeholder:"capture_skill, tag_revision",style:lt})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Required Structured Output Fields"}),c.jsx("input",{type:"text",value:F.draft,onFocus:F.startEditing,onChange:L=>te(L.target.value),onBlur:X,onKeyDown:L=>{L.key==="Enter"&&(L.preventDefault(),L.currentTarget.blur())},placeholder:"verdict, production_ready",style:lt}),c.jsx("p",{style:mr(),children:"Revka appends final-output instructions and fails this step if any named field is missing."}),c.jsx("pre",{style:{...mr(),fontFamily:"var(--font-mono)",whiteSpace:"pre-wrap"},children:`FINAL_OUTPUT:
  verdict: ...
  production_ready: ...`})]}),c.jsxs("div",{style:{paddingTop:8,borderTop:"1px solid var(--pc-border)"},children:[c.jsx(Sn,{checked:x.agentQualityEnabled||!1,onChange:L=>r(e.id,{agentQualityEnabled:L}),label:"Quality check"}),x.agentQualityEnabled&&c.jsxs("div",{style:{marginTop:8,display:"flex",flexDirection:"column",gap:8},children:[c.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:8},children:[c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Threshold"}),c.jsx("input",{type:"number",min:0,max:1,step:.05,value:x.agentQualityThreshold??.7,onChange:L=>r(e.id,{agentQualityThreshold:parseFloat(L.target.value)||.7}),style:vt})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Validator Model"}),c.jsx("input",{type:"text",value:x.agentQualityModel||"",onChange:L=>r(e.id,{agentQualityModel:L.target.value}),placeholder:"claude-haiku-4-5-20251001",style:lt})]})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Criteria"}),c.jsx("input",{type:"text",value:B.draft,onFocus:B.startEditing,onChange:L=>{B.setDraft(L.target.value),r(e.id,{agentQualityCriteria:El(L.target.value)})},onBlur:()=>r(e.id,{agentQualityCriteria:B.commit()}),onKeyDown:L=>{L.key==="Enter"&&(L.preventDefault(),L.currentTarget.blur())},placeholder:"on_mandate, depth, language_ko",style:lt})]})]})]}),c.jsxs("div",{children:[c.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,marginBottom:4},children:[c.jsx("label",{style:{...Ce,marginBottom:0},children:"Prompt"}),c.jsx(Sn,{checked:x.compression||!1,onChange:L=>r(e.id,{compression:L}),label:"Compress Output Handoff",title:"Compresses this step's completed output before later steps use it. It does not reduce this step's input prompt; artifacts/files stay unchanged."})]}),c.jsx(ar,{value:x.prompt,onChange:L=>r(e.id,{prompt:L}),placeholder:"Agent prompt template (prefer ${step_id.output_data.artifact_path} for full upstream output)",rows:6,style:lt,stepIds:f,workflowInputs:g,triggerFields:_})]})]}),v==="parallel"&&c.jsxs("div",{style:pr,children:[c.jsx("div",{style:Un,children:"Parallel Config"}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Join Strategy"}),c.jsxs("select",{value:x.parallelJoin||"all",onChange:L=>r(e.id,{parallelJoin:L.target.value}),style:vt,children:[c.jsx("option",{value:"all",children:"all — wait for every branch"}),c.jsx("option",{value:"any",children:"any — first success wins"}),c.jsx("option",{value:"majority",children:"majority — >50% must succeed"})]})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Max Concurrency"}),c.jsx("input",{type:"number",min:1,max:10,value:x.parallelMaxConcurrency,onChange:L=>r(e.id,{parallelMaxConcurrency:parseInt(L.target.value)||5}),style:vt})]}),c.jsx("p",{style:mr(),children:"Children are wired by connecting nodes on the canvas."})]}),v==="for_each"&&c.jsxs("div",{style:pr,children:[c.jsx("div",{style:{...Un,color:"var(--revka-signal-selected)"},children:"ForEach Config"}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Range"}),c.jsx("input",{type:"text",value:x.forEachRange||"",onChange:L=>r(e.id,{forEachRange:L.target.value}),placeholder:"e.g. 1..8 or ${resolve_arc.output_data.episode_range}",style:lt}),c.jsx("p",{style:mr(),children:"Numeric range (N..M or N-M). Supports interpolation."})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Items (alternative to range)"}),c.jsx("input",{type:"text",defaultValue:(x.forEachItems||[]).join(", "),onBlur:L=>r(e.id,{forEachItems:L.target.value.split(",").map(Qe=>Qe.trim()).filter(Boolean)}),placeholder:"item1, item2, item3",style:lt}),c.jsx("p",{style:mr(),children:"Comma-separated values. Used when range is empty."})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Loop Variable"}),c.jsx("input",{type:"text",value:x.forEachVariable||"item",onChange:L=>r(e.id,{forEachVariable:L.target.value}),placeholder:"item",style:lt}),c.jsxs("p",{style:mr(),children:["Access via ",`\${for_each.${x.forEachVariable||"item"}}`,", ","${for_each.index}",","," ","${for_each.iteration}","."]})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Sub-steps"}),c.jsx("input",{type:"text",defaultValue:(x.forEachSteps||[]).join(", "),onBlur:L=>r(e.id,{forEachSteps:L.target.value.split(",").map(Qe=>Qe.trim()).filter(Boolean)}),placeholder:"step_a, step_b, step_c",style:lt}),c.jsx("p",{style:mr(),children:"Comma-separated step IDs executed sequentially per iteration."})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Max Iterations"}),c.jsx("input",{type:"number",min:1,max:100,value:x.forEachMaxIterations||20,onChange:L=>r(e.id,{forEachMaxIterations:parseInt(L.target.value)||20}),style:{...vt,width:100}})]}),c.jsxs("div",{style:{display:"flex",gap:16},children:[c.jsx(Sn,{checked:x.forEachCarryForward??!0,onChange:L=>r(e.id,{forEachCarryForward:L}),label:"Carry forward"}),c.jsx(Sn,{checked:x.forEachFailFast??!0,onChange:L=>r(e.id,{forEachFailFast:L}),label:"Fail fast"})]})]}),v==="goto"&&c.jsxs("div",{style:pr,children:[c.jsx("div",{style:Un,children:"Loop Config"}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Target Step"}),c.jsx("input",{type:"text",value:x.gotoTarget||"",onChange:L=>r(e.id,{gotoTarget:L.target.value}),placeholder:"step-id to loop back to",style:lt})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Max Iterations"}),c.jsx("input",{type:"number",min:1,max:20,value:x.gotoMaxIterations||3,onChange:L=>r(e.id,{gotoMaxIterations:parseInt(L.target.value)||3}),style:{...vt,width:100}})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Condition Guard"}),c.jsx("input",{type:"text",value:x.gotoCondition,onChange:L=>r(e.id,{gotoCondition:L.target.value}),placeholder:"Optional: only goto if expression is truthy",style:lt})]})]}),v==="group_chat"&&c.jsxs("div",{style:pr,children:[c.jsx("div",{style:Un,children:"Group Chat Config"}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Topic"}),c.jsx("input",{type:"text",value:x.groupChatTopic||"",onChange:L=>r(e.id,{groupChatTopic:L.target.value}),placeholder:"Discussion topic",style:vt})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Participants"}),c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[(x.groupChatParticipants||[]).map((L,Qe)=>c.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center"},children:[c.jsx("button",{type:"button",onClick:_t=>dt("groupChatParticipant",_t,Qe),style:{...lt,flex:1,textAlign:"left",cursor:"pointer"},title:"Click to replace with a pool agent",children:L}),c.jsx("button",{type:"button",onClick:()=>r(e.id,{groupChatParticipants:(x.groupChatParticipants||[]).filter((_t,Gt)=>Gt!==Qe)}),style:{padding:"5px 8px",borderRadius:6,border:"1px solid var(--revka-border-soft)",background:"transparent",color:"var(--revka-status-danger)",cursor:"pointer"},title:"Remove participant",children:"×"})]},`${L}-${Qe}`)),c.jsxs("div",{style:{display:"flex",gap:6,flexWrap:"wrap"},children:[Ah.map(L=>c.jsxs("button",{type:"button",onClick:()=>r(e.id,{groupChatParticipants:[...x.groupChatParticipants||[],L]}),style:{padding:"4px 8px",borderRadius:6,border:"1px solid var(--revka-border-soft)",background:"transparent",color:"var(--pc-text-primary)",fontSize:11,cursor:"pointer"},children:["+ ",L]},L)),c.jsx("button",{type:"button",onClick:L=>dt("groupChatParticipant",L),style:{padding:"4px 8px",borderRadius:6,border:"1px solid var(--pc-accent-dim)",background:"var(--pc-accent-glow)",color:"var(--pc-accent-light)",fontSize:11,cursor:"pointer"},children:"+ Pool agent"})]})]})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Max Rounds"}),c.jsx("input",{type:"number",min:2,max:20,value:x.groupChatMaxRounds||8,onChange:L=>r(e.id,{groupChatMaxRounds:parseInt(L.target.value)||8}),style:{...vt,width:100}})]}),c.jsxs("div",{style:{display:"flex",gap:8},children:[c.jsxs("div",{style:{flex:1},children:[c.jsx("label",{style:Ce,children:"Moderator"}),c.jsx("button",{type:"button",onClick:L=>dt("groupChatModerator",L),style:{...lt,textAlign:"left",cursor:"pointer"},title:"Pick a moderator pool agent",children:x.groupChatModerator||"claude"}),c.jsx("div",{style:{display:"flex",gap:6,marginTop:6},children:Ah.map(L=>c.jsx("button",{type:"button",onClick:()=>r(e.id,{groupChatModerator:L}),style:{padding:"2px 6px",borderRadius:6,border:"1px solid var(--revka-border-soft)",background:(x.groupChatModerator||"claude")===L?"var(--pc-accent-glow)":"transparent",color:"var(--pc-text-primary)",fontSize:10,cursor:"pointer"},children:L},L))})]}),c.jsxs("div",{style:{flex:1},children:[c.jsx("label",{style:Ce,children:"Strategy"}),c.jsxs("select",{value:x.groupChatStrategy,onChange:L=>r(e.id,{groupChatStrategy:L.target.value}),style:vt,children:[c.jsx("option",{value:"moderator_selected",children:"Moderator Selected"}),c.jsx("option",{value:"round_robin",children:"Round Robin"})]})]})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Timeout (s)"}),c.jsx("input",{type:"number",min:1,value:x.groupChatTimeout,onChange:L=>r(e.id,{groupChatTimeout:parseInt(L.target.value)||120}),style:vt})]})]}),v==="supervisor"&&c.jsxs("div",{style:pr,children:[c.jsx("div",{style:Un,children:"Supervisor Config"}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Task"}),c.jsx("textarea",{value:x.supervisorTask||"",onChange:L=>r(e.id,{supervisorTask:L.target.value}),placeholder:"Task to decompose and delegate",rows:2,style:vt})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Max Iterations"}),c.jsx("input",{type:"number",min:1,max:10,value:x.supervisorMaxIterations||5,onChange:L=>r(e.id,{supervisorMaxIterations:parseInt(L.target.value)||5}),style:{...vt,width:100}})]}),c.jsxs("div",{style:{display:"flex",gap:8},children:[c.jsxs("div",{style:{flex:1},children:[c.jsx("label",{style:Ce,children:"Supervisor Agent"}),c.jsx("button",{type:"button",onClick:L=>dt("supervisorAgent",L),style:{...lt,textAlign:"left",cursor:"pointer"},title:"Pick the supervisor controller from the pool",children:x.supervisorType||"claude"}),c.jsx("div",{style:{display:"flex",gap:6,marginTop:6},children:Ah.map(L=>c.jsx("button",{type:"button",onClick:()=>r(e.id,{supervisorType:L}),style:{padding:"2px 6px",borderRadius:6,border:"1px solid var(--revka-border-soft)",background:(x.supervisorType||"claude")===L?"var(--pc-accent-glow)":"transparent",color:"var(--pc-text-primary)",fontSize:10,cursor:"pointer"},children:L},L))})]}),c.jsxs("div",{style:{flex:1},children:[c.jsx("label",{style:Ce,children:"Timeout (s)"}),c.jsx("input",{type:"number",min:1,value:x.supervisorTimeout,onChange:L=>r(e.id,{supervisorTimeout:parseInt(L.target.value)||300}),style:vt})]})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Specialist Pool"}),c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[(x.supervisorTemplates||[]).map((L,Qe)=>c.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center"},children:[c.jsx("input",{type:"text",readOnly:!0,value:L,style:{...lt,flex:1}}),c.jsx("button",{type:"button",onClick:()=>r(e.id,{supervisorTemplates:(x.supervisorTemplates||[]).filter((_t,Gt)=>Gt!==Qe)}),style:{padding:"5px 8px",borderRadius:6,border:"1px solid var(--revka-border-soft)",background:"transparent",color:"var(--revka-status-danger)",cursor:"pointer"},children:"×"})]},`${L}-${Qe}`)),c.jsx("button",{type:"button",onClick:L=>dt("supervisorTemplate",L),style:{alignSelf:"flex-start",padding:"4px 8px",borderRadius:6,border:"1px solid var(--pc-accent-dim)",background:"var(--pc-accent-glow)",color:"var(--pc-accent-light)",fontSize:11,cursor:"pointer"},children:"+ Pool agent"})]})]})]}),v==="shell"&&c.jsxs("div",{style:pr,children:[c.jsx("div",{style:Un,children:"Shell Config"}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Command"}),c.jsx("input",{type:"text",value:x.shellCommand||"",onChange:L=>r(e.id,{shellCommand:L.target.value}),placeholder:"e.g. npm run build",style:lt})]}),c.jsxs("div",{style:{display:"flex",gap:8},children:[c.jsxs("div",{style:{flex:1},children:[c.jsx("label",{style:Ce,children:"Timeout (s)"}),c.jsx("input",{type:"number",min:1,value:x.shellTimeout,onChange:L=>r(e.id,{shellTimeout:parseInt(L.target.value)||60}),style:vt})]}),c.jsx("div",{style:{flex:1,display:"flex",alignItems:"flex-end",paddingBottom:4},children:c.jsx(Sn,{checked:x.shellAllowFailure,onChange:L=>r(e.id,{shellAllowFailure:L}),label:"Allow failure"})})]})]}),v==="python"&&c.jsxs("div",{style:pr,children:[c.jsx("div",{style:Un,children:"Python Config"}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Script (path or builtin) — XOR with Code"}),c.jsx("input",{type:"text",value:x.pythonScript||"",onChange:L=>r(e.id,{pythonScript:L.target.value}),placeholder:"e.g. kref_encode.py",style:lt})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Code (inline) — XOR with Script"}),c.jsx("textarea",{value:x.pythonCode||"",onChange:L=>r(e.id,{pythonCode:L.target.value}),placeholder:`import json, sys
json.dump({'ok': True}, sys.stdout)`,rows:4,style:lt})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Args (JSON object)"}),c.jsx("input",{type:"text",value:x.pythonArgs||"",onChange:L=>r(e.id,{pythonArgs:L.target.value}),placeholder:'{"op": "encode", "kref": "${trigger.entity_kref}"}',style:lt})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Python Interpreter"}),c.jsx("input",{type:"text",value:x.pythonInterpreter||"",onChange:L=>r(e.id,{pythonInterpreter:L.target.value}),placeholder:"optional: /path/to/.venv/bin/python",style:lt})]}),c.jsxs("div",{style:{display:"flex",gap:8},children:[c.jsxs("div",{style:{flex:1},children:[c.jsx("label",{style:Ce,children:"Timeout (s)"}),c.jsx("input",{type:"number",min:1,value:x.pythonTimeout||60,onChange:L=>r(e.id,{pythonTimeout:parseInt(L.target.value)||60}),style:vt})]}),c.jsx("div",{style:{flex:1,display:"flex",alignItems:"flex-end",paddingBottom:4},children:c.jsx(Sn,{checked:x.pythonAllowFailure||!1,onChange:L=>r(e.id,{pythonAllowFailure:L}),label:"Allow failure"})})]})]}),v==="compute"&&c.jsxs("div",{style:pr,children:[c.jsx("div",{style:Un,children:"Compute Outputs"}),Object.entries(x.computeOutputs||{}).map(([L,Qe],_t)=>c.jsxs("div",{style:{display:"grid",gridTemplateColumns:"minmax(92px, 0.45fr) minmax(0, 1fr) auto",gap:6,alignItems:"start"},children:[c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Key"}),c.jsx("input",{type:"text",value:L,onChange:Gt=>{const jr=Gt.target.value.trim(),Qr={...x.computeOutputs||{}};delete Qr[L],jr&&(Qr[jr]=Qe),r(e.id,{computeOutputs:Qr})},placeholder:"start",spellCheck:!1,style:lt})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Value"}),c.jsx(ar,{value:Qe,onChange:Gt=>r(e.id,{computeOutputs:{...x.computeOutputs||{},[L]:Gt}}),rows:2,placeholder:"${{ int(inputs.end) + 1 }}",style:lt,stepIds:f,workflowInputs:g,triggerFields:_})]}),c.jsx("button",{type:"button",className:"revka-icon-button",title:"Remove output","aria-label":"Remove output",onClick:()=>{const Gt={...x.computeOutputs||{}};delete Gt[L],r(e.id,{computeOutputs:Gt})},style:{width:28,height:28,marginTop:18},children:c.jsx(Wi,{size:13})})]},`${L}-${_t}`)),c.jsx("button",{type:"button",className:"revka-button",onClick:()=>{const L=x.computeOutputs||{};let Qe="value",_t=2;for(;Object.prototype.hasOwnProperty.call(L,Qe);)Qe=`value_${_t}`,_t+=1;r(e.id,{computeOutputs:{...L,[Qe]:"${{ 1 }}"}})},style:{justifyContent:"center"},children:"+ Output"})]}),v==="email"&&c.jsxs("div",{style:pr,children:[c.jsx("div",{style:Un,children:"Email Config"}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"To"}),c.jsx("input",{type:"text",value:x.emailTo||"",onChange:L=>r(e.id,{emailTo:L.target.value}),placeholder:"lead@example.com or ${steps.lead.output_data.email}",style:vt})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Subject"}),c.jsx("input",{type:"text",value:x.emailSubject||"",onChange:L=>r(e.id,{emailSubject:L.target.value}),placeholder:"Hi ${steps.lead.output_data.first_name}",style:vt})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Body (plain text)"}),c.jsx(ar,{value:x.emailBody||"",onChange:L=>r(e.id,{emailBody:L}),rows:5,placeholder:`Hi there,

Saw you're working on…`,style:vt,stepIds:f,workflowInputs:g,triggerFields:_})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Body HTML"}),c.jsx(ar,{value:x.emailBodyHtml||"",onChange:L=>r(e.id,{emailBodyHtml:L}),rows:5,placeholder:"<p>Optional HTML body</p>",style:lt,stepIds:f,workflowInputs:g,triggerFields:_})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"From (override)"}),c.jsx("input",{type:"text",value:x.emailFrom||"",onChange:L=>r(e.id,{emailFrom:L.target.value}),placeholder:"default: from config.toml",style:vt})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Reply-To"}),c.jsx("input",{type:"text",value:x.emailReplyTo||"",onChange:L=>r(e.id,{emailReplyTo:L.target.value}),placeholder:"optional reply-to address",style:vt})]}),c.jsxs("div",{style:{display:"flex",gap:8},children:[c.jsxs("div",{style:{flex:1},children:[c.jsx("label",{style:Ce,children:"CC"}),c.jsx("input",{type:"text",value:x.emailCc||"",onChange:L=>r(e.id,{emailCc:L.target.value}),style:vt})]}),c.jsxs("div",{style:{flex:1},children:[c.jsx("label",{style:Ce,children:"BCC"}),c.jsx("input",{type:"text",value:x.emailBcc||"",onChange:L=>r(e.id,{emailBcc:L.target.value}),style:vt})]})]}),c.jsxs("div",{style:{paddingTop:8,borderTop:"1px solid var(--pc-border)"},children:[c.jsx(Sn,{checked:x.emailTrackClicks||!1,onChange:L=>r(e.id,{emailTrackClicks:L}),label:"Track clicks (rewrite URLs)"}),x.emailTrackClicks&&c.jsxs("div",{style:{paddingLeft:24,marginTop:8,display:"flex",flexDirection:"column",gap:8},children:[c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Track kref (required)"}),c.jsx("input",{type:"text",value:x.emailTrackKref||"",onChange:L=>r(e.id,{emailTrackKref:L.target.value}),placeholder:"${trigger.entity_kref}",style:lt})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Track secret env"}),c.jsx("input",{type:"text",value:x.emailTrackSecretEnv||"",onChange:L=>r(e.id,{emailTrackSecretEnv:L.target.value}),placeholder:"CLICK_TRACKING_SECRET",style:lt})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Track base URL"}),c.jsx("input",{type:"text",value:x.emailTrackBaseUrl||"",onChange:L=>r(e.id,{emailTrackBaseUrl:L.target.value}),placeholder:"https://gateway.example.com",style:lt})]})]})]}),c.jsxs("div",{style:{paddingTop:8,borderTop:"1px solid var(--pc-border)"},children:[c.jsx("div",{style:{...Un,marginBottom:8},children:"SMTP Overrides"}),c.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:8},children:[c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"SMTP Host"}),c.jsx("input",{type:"text",value:x.emailSmtpHost||"",onChange:L=>r(e.id,{emailSmtpHost:L.target.value}),placeholder:"smtp.example.com",style:lt})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"SMTP Port"}),c.jsx("input",{type:"number",min:1,value:x.emailSmtpPort||"",onChange:L=>r(e.id,{emailSmtpPort:parseInt(L.target.value)||0}),placeholder:"465",style:vt})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"SMTP Username"}),c.jsx("input",{type:"text",value:x.emailSmtpUsername||"",onChange:L=>r(e.id,{emailSmtpUsername:L.target.value}),placeholder:"optional username override",style:vt})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Password Env"}),c.jsx("input",{type:"text",value:x.emailSmtpPasswordEnv||"",onChange:L=>r(e.id,{emailSmtpPasswordEnv:L.target.value}),placeholder:"SMTP_PASSWORD",style:lt})]})]}),c.jsx("div",{style:{marginTop:8},children:c.jsx(Sn,{checked:x.emailSmtpTls??!0,onChange:L=>r(e.id,{emailSmtpTls:L}),label:"Use TLS"})})]}),c.jsxs("div",{style:{display:"flex",gap:8,paddingTop:8,borderTop:"1px solid var(--pc-border)"},children:[c.jsxs("div",{style:{flex:1},children:[c.jsx("label",{style:Ce,children:"Timeout (s)"}),c.jsx("input",{type:"number",min:1,value:x.emailTimeout||30,onChange:L=>r(e.id,{emailTimeout:parseInt(L.target.value)||30}),style:vt})]}),c.jsx("div",{style:{flex:1,display:"flex",alignItems:"flex-end",paddingBottom:4},children:c.jsx(Sn,{checked:x.emailDryRun||!1,onChange:L=>r(e.id,{emailDryRun:L}),label:"Dry run"})})]})]}),v==="image"&&c.jsxs("div",{style:pr,children:[c.jsx("div",{style:Un,children:"Image Config"}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Prompt"}),c.jsx(ar,{value:x.imagePrompt||"",onChange:L=>r(e.id,{imagePrompt:L}),rows:5,placeholder:"Architectural panel of Seoul Station 2040, golden hour…",style:vt,stepIds:f,workflowInputs:g,triggerFields:_})]}),c.jsxs("div",{style:{display:"flex",gap:8},children:[c.jsxs("div",{style:{flex:1},children:[c.jsx("label",{style:Ce,children:"Count (1–5)"}),c.jsx("input",{type:"number",min:1,max:5,value:x.imageCount??1,onChange:L=>r(e.id,{imageCount:Math.max(1,Math.min(5,parseInt(L.target.value)||1))}),style:vt})]}),c.jsxs("div",{style:{flex:1},children:[c.jsx("label",{style:Ce,children:"Timeout (s)"}),c.jsx("input",{type:"number",min:1,value:x.imageTimeout??1200,onChange:L=>r(e.id,{imageTimeout:parseInt(L.target.value)||1200}),style:vt})]})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Item name (override)"}),c.jsx("input",{type:"text",value:x.imageItemName||"",onChange:L=>r(e.id,{imageItemName:L.target.value}),placeholder:"default: derived from step id",style:vt})]}),c.jsxs("div",{style:{display:"flex",gap:8},children:[c.jsxs("div",{style:{flex:1},children:[c.jsx("label",{style:Ce,children:"Space"}),c.jsx("input",{type:"text",value:x.imageSpace||"",onChange:L=>r(e.id,{imageSpace:L.target.value}),placeholder:"default: Images (under harness)",style:vt})]}),c.jsxs("div",{style:{flex:1},children:[c.jsx("label",{style:Ce,children:"Sandbox"}),c.jsxs("select",{value:x.imageSandbox||"",onChange:L=>r(e.id,{imageSandbox:L.target.value}),style:vt,children:[c.jsx("option",{value:"",children:"auto (platform default)"}),c.jsx("option",{value:"read-only",children:"read-only"}),c.jsx("option",{value:"workspace-write",children:"workspace-write"}),c.jsx("option",{value:"danger-full-access",children:"danger-full-access"})]})]})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Output filename (override)"}),c.jsx("input",{type:"text",value:x.imageOutputPath||"",onChange:L=>r(e.id,{imageOutputPath:L.target.value}),placeholder:"default: <step_id>.png",style:lt})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Working Directory"}),c.jsx("input",{type:"text",value:x.imageCwd||"",onChange:L=>r(e.id,{imageCwd:L.target.value}),placeholder:"default: ~/.revka/workspace",style:lt})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Output pattern (count > 1)"}),c.jsx("input",{type:"text",value:x.imageOutputPattern||"",onChange:L=>r(e.id,{imageOutputPattern:L.target.value}),placeholder:"e.g. panel-{n}.png",style:lt})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Input image paths"}),c.jsx("textarea",{value:(x.imageInputImages||[]).join(`
`),onChange:L=>r(e.id,{imageInputImages:L.target.value.split(/\r?\n|,/).map(Qe=>Qe.trim()).filter(Boolean)}),placeholder:"/workspace/reference.png",style:{...lt,minHeight:72,resize:"vertical"}})]}),c.jsxs("div",{style:{display:"flex",gap:16,paddingTop:8,borderTop:"1px solid var(--pc-border)"},children:[c.jsx(Sn,{checked:x.imageCanvas!==!1,onChange:L=>r(e.id,{imageCanvas:L}),label:"Push to canvas"}),c.jsx(Sn,{checked:x.imageRegisterArtifact!==!1,onChange:L=>r(e.id,{imageRegisterArtifact:L}),label:"Register Kumiho artifact"})]}),x.imageCanvas!==!1&&c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Canvas ID"}),c.jsx("input",{type:"text",value:x.imageCanvasTarget||"",onChange:L=>r(e.id,{imageCanvasTarget:L.target.value}),placeholder:"optional canvas id; blank uses default",style:lt})]})]}),v==="output"&&c.jsxs("div",{style:pr,children:[c.jsx("div",{style:Un,children:"Output Config"}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Format"}),c.jsxs("select",{value:x.outputFormat||"markdown",onChange:L=>r(e.id,{outputFormat:L.target.value}),style:vt,children:[c.jsx("option",{value:"markdown",children:"markdown"}),c.jsx("option",{value:"json",children:"json"}),c.jsx("option",{value:"text",children:"text"})]})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Template"}),c.jsx(ar,{value:x.outputTemplate,onChange:L=>r(e.id,{outputTemplate:L}),placeholder:"Output template with ${step_id.output} interpolation",rows:6,style:lt,stepIds:f,workflowInputs:g,triggerFields:_})]}),c.jsxs("div",{style:{paddingTop:8,borderTop:"1px solid var(--pc-border)"},children:[c.jsx("div",{style:{...Un,color:"var(--pc-accent-light)",marginBottom:8},children:"Kumiho Entity"}),c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Entity Name"}),c.jsx("input",{type:"text",value:x.entityName||"",onChange:L=>r(e.id,{entityName:L.target.value}),placeholder:"e.g. ep-${inputs.episode}-draft",style:lt})]}),c.jsxs("div",{style:{display:"flex",gap:8},children:[c.jsxs("div",{style:{flex:1},children:[c.jsx("label",{style:Ce,children:"Kind"}),c.jsx("input",{type:"text",value:x.entityKind||"",onChange:L=>r(e.id,{entityKind:L.target.value}),placeholder:"e.g. qs-episode-draft",style:lt})]}),c.jsxs("div",{style:{width:96},children:[c.jsx("label",{style:Ce,children:"Tag"}),c.jsx("input",{type:"text",value:x.entityTag||"",onChange:L=>r(e.id,{entityTag:L.target.value}),placeholder:"ready",style:lt})]})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Space"}),c.jsx("input",{type:"text",value:x.entitySpace||"",onChange:L=>r(e.id,{entitySpace:L.target.value}),placeholder:"CognitiveMemory/creative/...",style:lt})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Metadata Target"}),c.jsxs("select",{value:x.entityMetadataTarget||"item",onChange:L=>r(e.id,{entityMetadataTarget:L.target.value}),style:vt,children:[c.jsx("option",{value:"item",children:"item"}),c.jsx("option",{value:"revision",children:"revision"}),c.jsx("option",{value:"artifact",children:"artifact"})]}),c.jsx("p",{style:mr(),children:"Item keeps trigger auto-mapping; revision is the resolve default."})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Artifact Summary Model"}),c.jsx("input",{type:"text",value:x.artifactSummaryModel||"",onChange:L=>r(e.id,{artifactSummaryModel:L.target.value}),placeholder:"claude-haiku-4-5-20251001",style:lt})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Metadata"}),Object.entries(x.entityMetadata||{}).map(([L,Qe])=>c.jsxs("div",{style:{display:"flex",gap:4,alignItems:"center",marginBottom:4},children:[c.jsx("input",{type:"text",readOnly:!0,value:L,style:{...lt,width:120,opacity:.7}}),c.jsx("span",{style:{fontSize:11,color:"var(--pc-text-faint)"},children:"="}),c.jsx("input",{type:"text",value:String(Qe??""),onChange:_t=>r(e.id,{entityMetadata:{...x.entityMetadata,[L]:_t.target.value}}),style:{...lt,flex:1}}),c.jsx("button",{onClick:()=>{const _t={...x.entityMetadata};delete _t[L],r(e.id,{entityMetadata:_t})},style:{background:"transparent",border:0,color:"var(--pc-text-faint)",cursor:"pointer"},children:"×"})]},L)),c.jsx("button",{onClick:()=>{const L=window.prompt("Metadata key:");L&&r(e.id,{entityMetadata:{...x.entityMetadata||{},[L]:""}})},style:{fontSize:10,padding:"4px 8px",borderRadius:6,border:"1px solid var(--pc-accent-dim)",background:"var(--pc-accent-glow)",color:"var(--pc-accent-light)",cursor:"pointer"},children:"+ Add metadata"})]}),c.jsx("p",{style:mr(),children:"Publishes output as a Kumiho entity for downstream triggers."})]})]})]}),v==="handoff"&&c.jsxs("div",{style:pr,children:[c.jsx("div",{style:Un,children:"Handoff Config"}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"From Step"}),c.jsx("input",{type:"text",value:x.handoffFrom||"",onChange:L=>r(e.id,{handoffFrom:L.target.value}),placeholder:"step-id",style:lt})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Receiving Agent"}),c.jsx("button",{type:"button",onClick:L=>dt("handoffTo",L),style:{...lt,textAlign:"left",cursor:"pointer"},title:"Pick the receiving agent from the pool",children:x.handoffTo||"codex"}),c.jsx("div",{style:{display:"flex",gap:6,marginTop:6},children:Ah.map(L=>c.jsx("button",{type:"button",onClick:()=>r(e.id,{handoffTo:L}),style:{padding:"2px 6px",borderRadius:6,border:"1px solid var(--revka-border-soft)",background:(x.handoffTo||"codex")===L?"var(--pc-accent-glow)":"transparent",color:"var(--pc-text-primary)",fontSize:10,cursor:"pointer"},children:L},L))})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Reason"}),c.jsx("input",{type:"text",value:x.handoffReason||"",onChange:L=>r(e.id,{handoffReason:L.target.value}),placeholder:"Continuing the task",style:vt})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Task"}),c.jsx("textarea",{value:x.handoffTask,onChange:L=>r(e.id,{handoffTask:L.target.value}),placeholder:"Specific task for the receiving agent",rows:2,style:vt})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Timeout (s)"}),c.jsx("input",{type:"number",min:1,value:x.handoffTimeout,onChange:L=>r(e.id,{handoffTimeout:parseInt(L.target.value)||300}),style:vt})]})]}),v==="human_input"&&c.jsxs("div",{style:pr,children:[c.jsx("div",{style:{...Un,color:"var(--revka-status-warning)"},children:"Human Input Config"}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Message"}),c.jsx("textarea",{value:x.humanInputMessage,onChange:L=>r(e.id,{humanInputMessage:L.target.value}),placeholder:"Prompt sent to the channel",rows:4,style:vt})]}),c.jsxs("div",{style:{display:"flex",gap:8},children:[c.jsxs("div",{style:{flex:1},children:[c.jsx("label",{style:Ce,children:"Channel"}),c.jsx("select",{value:x.channel,onChange:L=>r(e.id,{channel:L.target.value}),style:vt,children:Mt.map(L=>c.jsx("option",{value:L.value,children:L.label},L.value))})]}),c.jsxs("div",{style:{flex:1},children:[c.jsx("label",{style:Ce,children:"Timeout (s)"}),c.jsx("input",{type:"number",min:60,value:x.humanInputTimeout,onChange:L=>r(e.id,{humanInputTimeout:parseInt(L.target.value)||3600}),style:vt})]})]})]}),v==="human_approval"&&c.jsxs("div",{style:pr,children:[c.jsx("div",{style:{...Un,color:"var(--revka-status-warning)"},children:"Human Approval Config"}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Channel"}),c.jsx("select",{value:x.humanApprovalChannel,onChange:L=>r(e.id,{humanApprovalChannel:L.target.value}),style:vt,children:Mt.map(L=>c.jsx("option",{value:L.value,children:L.label},L.value))})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Channel ID Override"}),c.jsx("input",{type:"text",value:x.humanApprovalChannelId,onChange:L=>r(e.id,{humanApprovalChannelId:L.target.value}),placeholder:"optional channel/thread override",style:vt})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Approval Message"}),c.jsx("textarea",{value:x.humanApprovalMessage,onChange:L=>r(e.id,{humanApprovalMessage:L.target.value}),placeholder:"Message shown when requesting approval",rows:3,style:vt})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Timeout (s)"}),c.jsx("input",{type:"number",min:60,value:x.humanApprovalTimeout,onChange:L=>r(e.id,{humanApprovalTimeout:parseInt(L.target.value)||3600}),style:vt})]}),c.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:8},children:[c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"On Reject Goto"}),c.jsx("input",{type:"text",value:x.humanApprovalOnRejectGoto,onChange:L=>r(e.id,{humanApprovalOnRejectGoto:L.target.value}),placeholder:"optional step id",style:lt})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"On Reject Max"}),c.jsx("input",{type:"number",min:1,max:10,value:x.humanApprovalOnRejectMax??3,onChange:L=>r(e.id,{humanApprovalOnRejectMax:parseInt(L.target.value)||3}),style:vt})]})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Approve Keywords"}),c.jsx("input",{type:"text",value:H.draft,onFocus:H.startEditing,onChange:L=>{H.setDraft(L.target.value),r(e.id,{humanApprovalApproveKeywords:El(L.target.value)})},onBlur:()=>r(e.id,{humanApprovalApproveKeywords:H.commit()}),onKeyDown:L=>{L.key==="Enter"&&(L.preventDefault(),L.currentTarget.blur())},placeholder:"approve, approved, yes, lgtm",style:lt})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Reject Keywords"}),c.jsx("input",{type:"text",value:$.draft,onFocus:$.startEditing,onChange:L=>{$.setDraft(L.target.value),r(e.id,{humanApprovalRejectKeywords:El(L.target.value)})},onBlur:()=>r(e.id,{humanApprovalRejectKeywords:$.commit()}),onKeyDown:L=>{L.key==="Enter"&&(L.preventDefault(),L.currentTarget.blur())},placeholder:"reject, rejected, no",style:lt})]})]}),v==="manus"&&c.jsxs("div",{style:pr,children:[c.jsx("div",{style:{...Un,color:"var(--revka-signal-network)"},children:"Manus Config"}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Prompt"}),c.jsx(ar,{value:x.manusPrompt||"",onChange:L=>r(e.id,{manusPrompt:L}),rows:5,placeholder:"Research the top 5 startups in Seoul working on robotics — return names + one-line descriptions.",style:vt,stepIds:f,workflowInputs:g,triggerFields:_}),c.jsxs("p",{style:mr(),children:["Free-text task for the Manus web agent. Supports $","${...}"," interpolation."]})]}),c.jsxs("div",{style:{display:"flex",gap:8},children:[c.jsxs("div",{style:{flex:1},children:[c.jsx("label",{style:Ce,children:"Agent profile"}),c.jsx("input",{type:"text",value:x.manusAgentProfile||"",onChange:L=>r(e.id,{manusAgentProfile:L.target.value}),placeholder:"manus-1.6",style:vt})]}),c.jsxs("div",{style:{flex:1},children:[c.jsx("label",{style:Ce,children:"Locale"}),c.jsx("input",{type:"text",value:x.manusLocale||"",onChange:L=>r(e.id,{manusLocale:L.target.value}),placeholder:"auto",style:vt})]})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Connectors"}),c.jsx("input",{type:"text",defaultValue:(x.manusConnectors||[]).join(", "),onBlur:L=>r(e.id,{manusConnectors:L.target.value.split(",").map(Qe=>Qe.trim()).filter(Boolean)}),placeholder:"gmail, drive, slack",style:lt}),c.jsx("p",{style:mr(),children:"Comma-separated connector ids enabled for this task."})]}),c.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:8},children:[c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Enable Skills"}),c.jsx("input",{type:"text",defaultValue:(x.manusEnableSkills||[]).join(", "),onBlur:L=>r(e.id,{manusEnableSkills:El(L.target.value)}),placeholder:"skill ids",style:lt})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Force Skills"}),c.jsx("input",{type:"text",defaultValue:(x.manusForceSkills||[]).join(", "),onBlur:L=>r(e.id,{manusForceSkills:El(L.target.value)}),placeholder:"required skill ids",style:lt})]})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Title (optional)"}),c.jsx("input",{type:"text",value:x.manusTitle||"",onChange:L=>r(e.id,{manusTitle:L.target.value}),placeholder:"Robotics startup scan — Seoul",style:vt})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Project ID"}),c.jsx("input",{type:"text",value:x.manusProjectId||"",onChange:L=>r(e.id,{manusProjectId:L.target.value}),placeholder:"optional Manus project id",style:lt})]}),c.jsxs("div",{style:{display:"flex",gap:8},children:[c.jsxs("div",{style:{flex:1},children:[c.jsx("label",{style:Ce,children:"Timeout (s)"}),c.jsx("input",{type:"number",min:30,value:x.manusTimeoutSeconds??600,onChange:L=>r(e.id,{manusTimeoutSeconds:parseInt(L.target.value)||600}),style:vt})]}),c.jsxs("div",{style:{flex:1},children:[c.jsx("label",{style:Ce,children:"Poll interval (s)"}),c.jsx("input",{type:"number",min:1,value:x.manusPollIntervalSeconds??5,onChange:L=>r(e.id,{manusPollIntervalSeconds:parseInt(L.target.value)||5}),style:vt})]})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Structured output schema (JSON, optional)"}),c.jsx("textarea",{value:x.manusStructuredOutputSchema||"",onChange:L=>r(e.id,{manusStructuredOutputSchema:L.target.value}),rows:5,placeholder:'{"type": "object", "properties": {"companies": {"type": "array"}}}',style:lt}),c.jsxs("p",{style:mr(),children:["When set, Manus returns a value matching this schema; available as $","${step.output_data.structured_output}","."]})]}),c.jsx("div",{style:{paddingTop:8,borderTop:"1px solid var(--pc-border)"},children:c.jsx(Sn,{checked:x.manusAllowFailure||!1,onChange:L=>r(e.id,{manusAllowFailure:L}),label:"Allow failure (continue workflow on Manus error)"})}),c.jsxs("div",{style:{paddingTop:8,borderTop:"1px solid var(--pc-border)"},children:[c.jsx("label",{style:Ce,children:"Manus credential"}),c.jsxs("button",{type:"button",onClick:L=>{Me(L.currentTarget.getBoundingClientRect()),je(!0)},style:{...vt,display:"flex",alignItems:"center",gap:8,textAlign:"left",cursor:"pointer",color:x.manusCredentialsRef?"var(--pc-text-primary)":"var(--pc-text-faint)"},children:[c.jsx(hg,{size:12,style:{color:"var(--revka-text-faint)",flexShrink:0}}),c.jsx("span",{style:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:rt?`${TN(rt.provider)} · ${rt.profile_name}`:x.manusCredentialsRef||"None — falls back to MANUS_API_KEY env var"})]}),x.manusCredentialsRef&&c.jsx("button",{type:"button",onClick:()=>r(e.id,{manusCredentialsRef:""}),style:{marginTop:6,padding:"4px 10px",fontSize:11,fontWeight:600,borderRadius:6,border:"1px solid var(--revka-status-warning)",background:"color-mix(in srgb, var(--revka-status-warning) 14%, transparent)",color:"var(--revka-status-warning)",cursor:"pointer"},children:"Clear"}),c.jsx("p",{style:mr(),children:"Optional. Encrypted Manus API key from the auth-profile store. When set, the runtime resolves it at execution time and skips the MANUS_API_KEY env var."}),c.jsx(E6,{open:le,onOpenChange:je,value:x.manusCredentialsRef,anchorRect:Te,providerFilter:"manus",onSelect:L=>r(e.id,{manusCredentialsRef:L??""})})]}),c.jsx("div",{style:{paddingTop:8,borderTop:"1px solid var(--pc-border)"},children:c.jsx(Sn,{checked:x.manusRegisterEnabled===!0,onChange:L=>r(e.id,{manusRegisterEnabled:L}),label:"Register output as Kumiho entity"})}),x.manusRegisterEnabled&&c.jsxs("div",{style:{paddingTop:8},children:[c.jsx("div",{style:{...Un,color:"var(--pc-accent-light)",marginBottom:8},children:"Kumiho Entity"}),c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Entity Name"}),c.jsx("input",{type:"text",value:x.manusRegisterEntityName||"",onChange:L=>r(e.id,{manusRegisterEntityName:L.target.value}),placeholder:"e.g. report-${inputs.topic}",style:lt})]}),c.jsxs("div",{style:{display:"flex",gap:8},children:[c.jsxs("div",{style:{flex:1},children:[c.jsx("label",{style:Ce,children:"Kind"}),c.jsx("input",{type:"text",value:x.manusRegisterEntityKind||"",onChange:L=>r(e.id,{manusRegisterEntityKind:L.target.value}),placeholder:"e.g. research-report",style:lt})]}),c.jsxs("div",{style:{width:96},children:[c.jsx("label",{style:Ce,children:"Tag"}),c.jsx("input",{type:"text",value:x.manusRegisterEntityTag||"",onChange:L=>r(e.id,{manusRegisterEntityTag:L.target.value}),placeholder:"published",style:lt})]})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Space"}),c.jsx("input",{type:"text",value:x.manusRegisterEntitySpace||"",onChange:L=>r(e.id,{manusRegisterEntitySpace:L.target.value}),placeholder:"Revka/WorkflowOutputs/Research",style:lt})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Content source"}),c.jsxs("select",{value:x.manusRegisterContentSource||"message",onChange:L=>r(e.id,{manusRegisterContentSource:L.target.value}),style:vt,children:[c.jsx("option",{value:"message",children:"message (assistant text)"}),c.jsx("option",{value:"structured",children:"structured (structured_output JSON)"})]})]}),c.jsx(Sn,{checked:x.manusRegisterAttachments??!0,onChange:L=>r(e.id,{manusRegisterAttachments:L}),label:"Download attachments to entity_dir/attachments/"}),c.jsxs("p",{style:mr(),children:["Content is written to",c.jsx("code",{children:" ~/.revka/artifacts/<space>/<kind>/<name>/content.md"}),". Each attachment lands under the same dir's ",c.jsx("code",{children:"attachments/"}),"."]})]})]})]}),v==="a2a"&&c.jsxs("div",{style:pr,children:[c.jsx("div",{style:{...Un,color:"var(--revka-signal-network)"},children:"A2A Config"}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Endpoint URL"}),c.jsx(ar,{value:x.a2aUrl,onChange:L=>r(e.id,{a2aUrl:L}),placeholder:"https://agent.example.com/a2a",rows:1,style:lt,stepIds:f,workflowInputs:g,triggerFields:_})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Skill ID"}),c.jsxs("div",{style:{display:"flex",gap:6},children:[c.jsx("input",{type:"text",value:x.a2aSkillId,onChange:L=>r(e.id,{a2aSkillId:L.target.value}),placeholder:"Optional skill ID",style:{...lt,flex:1}}),c.jsx("button",{type:"button",onClick:L=>dt("a2aSkill",L),style:{padding:"6px 8px",borderRadius:8,border:"1px solid var(--pc-accent-dim)",background:"var(--pc-accent-glow)",color:"var(--pc-accent-light)",fontSize:11,cursor:"pointer"},title:"Use a pool-agent template name as the A2A skill id",children:"Pool"})]})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Message"}),c.jsx("textarea",{value:x.a2aMessage,onChange:L=>r(e.id,{a2aMessage:L.target.value}),rows:3,style:vt})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Timeout (s)"}),c.jsx("input",{type:"number",min:1,value:x.a2aTimeout,onChange:L=>r(e.id,{a2aTimeout:parseInt(L.target.value)||300}),style:vt})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Cloud Run IAM"}),c.jsxs("select",{value:x.a2aCloudRunAuth||"",onChange:L=>r(e.id,{a2aCloudRunAuth:L.target.value}),style:vt,children:[c.jsx("option",{value:"",children:"none"}),c.jsx("option",{value:"gcloud",children:"gcloud"})]})]}),x.a2aCloudRunAuth==="gcloud"&&c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Gcloud Config"}),c.jsxs("div",{style:{display:"flex",gap:6},children:[c.jsxs("select",{value:x.a2aCloudRunConfig||"",onChange:L=>r(e.id,{a2aCloudRunConfig:L.target.value}),style:{...vt,flex:1},disabled:!bt,children:[c.jsx("option",{value:"",children:et?"loading...":"active gcloud config"}),Re.map(L=>c.jsxs("option",{value:L.name,children:[L.name,L.project?` - ${L.project}`:"",L.is_active?" (active)":""]},L.name))]}),c.jsxs("button",{type:"button",onClick:()=>ee(!0),title:"Create gcloud config",style:{padding:"6px 8px",borderRadius:8,border:"1px solid var(--pc-accent-dim)",background:"var(--pc-accent-glow)",color:"var(--pc-accent-light)",fontSize:11,cursor:"pointer",display:"inline-flex",alignItems:"center",gap:5},children:[c.jsx(rs,{size:12}),"New"]})]}),c.jsx("p",{style:mr(),children:yt||(Ye?`${Ye.account||"account unset"} / ${Ye.project||"project unset"}`:"Uses the active Cloud SDK config unless a profile is selected.")})]}),c.jsxs("div",{style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr) 112px",gap:8},children:[c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Cloud Run Audience"}),c.jsx(ar,{value:x.a2aCloudRunAudience||"",onChange:L=>r(e.id,{a2aCloudRunAudience:L}),placeholder:"Defaults to endpoint origin",rows:1,style:lt,stepIds:f,workflowInputs:g,triggerFields:_})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Auth Timeout"}),c.jsx("input",{type:"number",min:1,max:120,value:x.a2aCloudRunAuthTimeout||20,onChange:L=>r(e.id,{a2aCloudRunAuthTimeout:parseInt(L.target.value)||20}),style:vt})]})]}),c.jsx(vNe,{open:Pe,onClose:()=>ee(!1),defaultAccount:it==null?void 0:it.account,defaultProject:it==null?void 0:it.project,defaultRunRegion:it==null?void 0:it.run_region,defaultComputeRegion:it==null?void 0:it.compute_region,onCreated:async L=>{await O(),ee(!1),r(e.id,{a2aCloudRunAuth:"gcloud",a2aCloudRunConfig:L})}})]})]}),v==="resolve"&&c.jsxs("div",{style:pr,children:[c.jsx("div",{style:Un,children:"Resolve Config"}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Entity Kind"}),c.jsx(ar,{value:x.resolveKind||"",onChange:L=>r(e.id,{resolveKind:L}),placeholder:"e.g. qs-episode-draft",rows:1,style:lt,stepIds:f,workflowInputs:g,triggerFields:_})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Tag"}),c.jsx(ar,{value:x.resolveTag||"published",onChange:L=>r(e.id,{resolveTag:L}),placeholder:"published",rows:1,style:lt,stepIds:f,workflowInputs:g,triggerFields:_})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Name Pattern"}),c.jsx(ar,{value:x.resolveNamePattern||"",onChange:L=>r(e.id,{resolveNamePattern:L}),placeholder:"e.g. qs-episode-*",rows:1,style:lt,stepIds:f,workflowInputs:g,triggerFields:_})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Space"}),c.jsx(ar,{value:x.resolveSpace||"",onChange:L=>r(e.id,{resolveSpace:L}),placeholder:"e.g. Revka/${inputs.team}/WorkflowOutputs",rows:1,style:lt,stepIds:f,workflowInputs:g,triggerFields:_})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Artifact Name"}),c.jsx(ar,{value:x.resolveArtifactName||"",onChange:L=>r(e.id,{resolveArtifactName:L}),placeholder:"SKILL.md",rows:1,style:lt,stepIds:f,workflowInputs:g,triggerFields:_})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Mode"}),c.jsxs("select",{value:x.resolveMode||"latest",onChange:L=>r(e.id,{resolveMode:L.target.value}),style:vt,children:[c.jsx("option",{value:"latest",children:"latest"}),c.jsx("option",{value:"all",children:"all"})]})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Metadata Source"}),c.jsxs("select",{value:x.resolveMetadataSource||"revision",onChange:L=>r(e.id,{resolveMetadataSource:L.target.value}),style:vt,children:[c.jsx("option",{value:"revision",children:"revision"}),c.jsx("option",{value:"item",children:"item"}),c.jsx("option",{value:"artifact",children:"artifact"})]})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Fields"}),c.jsx("input",{type:"text",defaultValue:(x.resolveFields||[]).join(", "),onBlur:L=>r(e.id,{resolveFields:L.target.value.split(",").map(Qe=>Qe.trim()).filter(Boolean)}),placeholder:"part, episode_number, episode_goal",style:lt}),c.jsx("p",{style:mr(),children:"Comma-separated metadata fields to extract."})]}),c.jsx(Sn,{checked:x.resolveFailIfMissing??!0,onChange:L=>r(e.id,{resolveFailIfMissing:L}),label:"Fail if missing"})]}),v==="kumiho_context"&&c.jsxs("div",{style:pr,children:[c.jsx("div",{style:Un,children:"Kumiho Context Config"}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Project"}),c.jsx(ar,{value:x.kumihoProject||"",onChange:L=>r(e.id,{kumihoProject:L}),placeholder:"StoryProject",rows:1,style:lt,stepIds:f,workflowInputs:g,triggerFields:_})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Mode"}),c.jsxs("select",{value:x.kumihoMode||"graph_augmented_context",onChange:L=>r(e.id,{kumihoMode:L.target.value}),style:vt,children:[c.jsx("option",{value:"graph_augmented_context",children:"graph_augmented_context"}),c.jsx("option",{value:"bundle_context",children:"bundle_context"}),c.jsx("option",{value:"semantic_context",children:"semantic_context"})]})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Seed Bundles"}),c.jsx("textarea",{value:W.draft,onFocus:W.startEditing,onChange:L=>W.setDraft(L.target.value),onBlur:()=>r(e.id,{kumihoSeedBundles:W.commit()}),placeholder:"series-main-canon, series-active-storylines",rows:2,style:lt})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Seed Krefs"}),c.jsx("textarea",{value:P.draft,onFocus:P.startEditing,onChange:L=>P.setDraft(L.target.value),onBlur:()=>r(e.id,{kumihoSeedKrefs:P.commit()}),placeholder:"${latest-production-episode.output_data.kref}",rows:2,style:lt})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Seed Queries"}),c.jsx("textarea",{value:q.draft,onFocus:q.startEditing,onChange:L=>q.setDraft(L.target.value),onBlur:()=>r(e.id,{kumihoSeedQueries:q.commit()}),placeholder:"${inputs.episode_goal}, ${inputs.must_include}",rows:3,style:lt})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Traversal Depth"}),c.jsx("input",{type:"number",min:0,max:3,value:x.kumihoTraversalMaxDepth??2,onChange:L=>r(e.id,{kumihoTraversalMaxDepth:Math.min(3,Math.max(0,parseInt(L.target.value)||0))}),style:vt})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Traversal Direction"}),c.jsxs("select",{value:x.kumihoTraversalDirection||"both",onChange:L=>r(e.id,{kumihoTraversalDirection:L.target.value}),style:vt,children:[c.jsx("option",{value:"both",children:"both"}),c.jsx("option",{value:"out",children:"out"}),c.jsx("option",{value:"in",children:"in"})]})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Edge Types"}),c.jsx("input",{type:"text",value:I.draft,onFocus:I.startEditing,onChange:L=>I.setDraft(L.target.value),onBlur:()=>r(e.id,{kumihoTraversalEdgeTypes:I.commit()}),placeholder:"DEPENDS_ON, REFERENCES, ADVANCES, UPDATES, CONTRADICTS",style:lt})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Include Kinds"}),c.jsx("textarea",{value:Q.draft,onFocus:Q.startEditing,onChange:L=>Q.setDraft(L.target.value),onBlur:()=>r(e.id,{kumihoFiltersIncludeKinds:Q.commit()}),placeholder:"canon-rule, character-state, storyline, webnovel-episode",rows:2,style:lt})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Exclude Tags"}),c.jsx("input",{type:"text",value:K.draft,onFocus:K.startEditing,onChange:L=>K.setDraft(L.target.value),onBlur:()=>r(e.id,{kumihoFiltersExcludeTags:K.commit()}),placeholder:"deprecated",style:lt})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Max Items"}),c.jsx("input",{type:"number",min:1,max:100,value:x.kumihoFiltersMaxItems??50,onChange:L=>r(e.id,{kumihoFiltersMaxItems:Math.min(100,Math.max(1,parseInt(L.target.value)||50))}),style:vt})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Ranking Method"}),c.jsxs("select",{value:x.kumihoRankingMethod||"hybrid",onChange:L=>r(e.id,{kumihoRankingMethod:L.target.value}),style:vt,children:[c.jsx("option",{value:"hybrid",children:"hybrid"}),c.jsx("option",{value:"graph",children:"graph"}),c.jsx("option",{value:"semantic",children:"semantic"}),c.jsx("option",{value:"none",children:"none"})]})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Semantic Query"}),c.jsx(ar,{value:x.kumihoRankingSemanticQuery||"",onChange:L=>r(e.id,{kumihoRankingSemanticQuery:L}),placeholder:"${inputs.episode_goal} ${inputs.must_include}",rows:2,style:lt,stepIds:f,workflowInputs:g,triggerFields:_})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Tag Preference"}),c.jsx("input",{type:"text",value:Z.draft,onFocus:Z.startEditing,onChange:L=>Z.setDraft(L.target.value),onBlur:()=>r(e.id,{kumihoLockTagPreference:Z.commit()}),placeholder:"current, active, production-ready, ready, published, latest",style:lt})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Output Format"}),c.jsx("input",{type:"text",value:x.kumihoOutputFormat||"context_pack",onChange:L=>r(e.id,{kumihoOutputFormat:L.target.value}),placeholder:"episode_context_pack",style:lt})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Max Artifact Chars"}),c.jsx("input",{type:"number",min:0,value:x.kumihoOutputMaxArtifactCharsPerItem??3e3,onChange:L=>r(e.id,{kumihoOutputMaxArtifactCharsPerItem:Math.max(0,parseInt(L.target.value)||0)}),style:vt})]}),c.jsx(Sn,{checked:x.kumihoOutputIncludeArtifactSummaries??!0,onChange:L=>r(e.id,{kumihoOutputIncludeArtifactSummaries:L}),label:"Artifact summaries"}),c.jsx(Sn,{checked:x.kumihoOutputIncludeArtifactContent??!1,onChange:L=>r(e.id,{kumihoOutputIncludeArtifactContent:L}),label:"Artifact content"}),c.jsx(Sn,{checked:x.kumihoOutputIncludeEdgeMap??!0,onChange:L=>r(e.id,{kumihoOutputIncludeEdgeMap:L}),label:"Edge map"}),c.jsx(Sn,{checked:x.kumihoOutputIncludeConflictWarnings??!0,onChange:L=>r(e.id,{kumihoOutputIncludeConflictWarnings:L}),label:"Conflict warnings"}),c.jsx(Sn,{checked:x.kumihoOutputIncludeMissingContext??!0,onChange:L=>r(e.id,{kumihoOutputIncludeMissingContext:L}),label:"Missing context"})]}),v==="kumiho_bundle_update"&&c.jsxs("div",{style:pr,children:[c.jsx("div",{style:Un,children:"Kumiho Bundle Update Config"}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Project"}),c.jsx(ar,{value:x.kumihoProject||"",onChange:L=>r(e.id,{kumihoProject:L}),placeholder:"StoryProject",rows:1,style:lt,stepIds:f,workflowInputs:g,triggerFields:_})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Mode"}),c.jsxs("select",{value:x.kumihoMode||"add_members",onChange:L=>r(e.id,{kumihoMode:L.target.value}),style:vt,children:[c.jsx("option",{value:"add_members",children:"add_members"}),c.jsx("option",{value:"remove_members",children:"remove_members"}),c.jsx("option",{value:"replace_members",children:"replace_members"}),c.jsx("option",{value:"mixed",children:"mixed"})]})]}),c.jsx(Sn,{checked:x.kumihoCreateIfMissing??!1,onChange:L=>r(e.id,{kumihoCreateIfMissing:L}),label:"Create missing bundles"}),c.jsx(Sn,{checked:x.kumihoIdempotent??!0,onChange:L=>r(e.id,{kumihoIdempotent:L}),label:"Idempotent"}),c.jsx(Sn,{checked:x.kumihoFailIfMissingBundle??!0,onChange:L=>r(e.id,{kumihoFailIfMissingBundle:L}),label:"Fail if bundle missing"}),c.jsx(Sn,{checked:x.kumihoFailIfMissingItem??!0,onChange:L=>r(e.id,{kumihoFailIfMissingItem:L}),label:"Fail if item missing"}),c.jsx(Sn,{checked:x.kumihoAllowProtected??!1,onChange:L=>r(e.id,{kumihoAllowProtected:L}),label:"Allow protected bundles"}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Updates JSON"}),c.jsx("textarea",{defaultValue:JSON.stringify(x.kumihoUpdates||[],null,2),onBlur:L=>{try{const Qe=JSON.parse(L.target.value||"[]");r(e.id,{kumihoUpdates:Array.isArray(Qe)?Qe:[]})}catch{}},rows:8,style:lt},`kumiho-updates-${e.id}`),c.jsx("p",{style:mr(),children:"Array of bundle update objects. Advanced YAML fields are preserved through kumiho_config."})]})]}),v==="kumiho_patch_apply"&&c.jsxs("div",{style:pr,children:[c.jsx("div",{style:Un,children:"Kumiho Patch Apply Config"}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Project"}),c.jsx(ar,{value:x.kumihoProject||"",onChange:L=>r(e.id,{kumihoProject:L}),placeholder:"StoryProject",rows:1,style:lt,stepIds:f,workflowInputs:g,triggerFields:_})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Patch Kref"}),c.jsx(ar,{value:x.kumihoPatchKref||"",onChange:L=>r(e.id,{kumihoPatchKref:L}),placeholder:"${canon-patch-loader.output_data.kref}",rows:1,style:lt,stepIds:f,workflowInputs:g,triggerFields:_})]}),c.jsx(Sn,{checked:x.kumihoDryRun??!0,onChange:L=>r(e.id,{kumihoDryRun:L}),label:"Dry run"}),c.jsx(Sn,{checked:x.kumihoApprovalRequired??!0,onChange:L=>r(e.id,{kumihoApprovalRequired:L}),label:"Approval required"}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Approved Expression"}),c.jsx(ar,{value:String(x.kumihoApprovalApproved??!1),onChange:L=>r(e.id,{kumihoApprovalApproved:L}),placeholder:"${patch-approval.output_data.approved}",rows:1,style:lt,stepIds:f,workflowInputs:g,triggerFields:_})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Approved By"}),c.jsx(ar,{value:x.kumihoApprovalApprovedBy||"",onChange:L=>r(e.id,{kumihoApprovalApprovedBy:L}),placeholder:"${patch-approval.output_data.approved_by}",rows:1,style:lt,stepIds:f,workflowInputs:g,triggerFields:_})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Approval Note"}),c.jsx(ar,{value:x.kumihoApprovalNote||"",onChange:L=>r(e.id,{kumihoApprovalNote:L}),placeholder:"${patch-approval.output_data.note}",rows:2,style:lt,stepIds:f,workflowInputs:g,triggerFields:_})]}),c.jsx(Sn,{checked:x.kumihoApplyCreateRevisions??!0,onChange:L=>r(e.id,{kumihoApplyCreateRevisions:L}),label:"Create revisions"}),c.jsx(Sn,{checked:x.kumihoApplyCreateEdges??!0,onChange:L=>r(e.id,{kumihoApplyCreateEdges:L}),label:"Create edges"}),c.jsx(Sn,{checked:x.kumihoApplyUpdateTags??!0,onChange:L=>r(e.id,{kumihoApplyUpdateTags:L}),label:"Update tags"}),c.jsx(Sn,{checked:x.kumihoApplyUntagPreviousCurrent??!0,onChange:L=>r(e.id,{kumihoApplyUntagPreviousCurrent:L}),label:"Untag previous current"}),c.jsx(Sn,{checked:x.kumihoApplyUpdateBundles??!0,onChange:L=>r(e.id,{kumihoApplyUpdateBundles:L}),label:"Update bundles"}),c.jsx(Sn,{checked:x.kumihoApplySaveApplyReport??!0,onChange:L=>r(e.id,{kumihoApplySaveApplyReport:L}),label:"Save apply report"}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"New Revision Tags"}),c.jsx("input",{type:"text",value:Y.draft,onFocus:Y.startEditing,onChange:L=>Y.setDraft(L.target.value),onBlur:()=>r(e.id,{kumihoNewRevisionTags:Y.commit()}),placeholder:"current, approved",style:lt})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Patch Tags Remove"}),c.jsx("input",{type:"text",value:R.draft,onFocus:R.startEditing,onChange:L=>R.setDraft(L.target.value),onBlur:()=>r(e.id,{kumihoPatchTagsRemove:R.commit()}),placeholder:"candidate",style:lt})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Patch Tags Add"}),c.jsx("input",{type:"text",value:U.draft,onFocus:U.startEditing,onChange:L=>U.setDraft(L.target.value),onBlur:()=>r(e.id,{kumihoPatchTagsAdd:U.commit()}),placeholder:"applied",style:lt})]}),[["Pending Patch Bundle","kumihoPendingPatchBundle","pending-canon-patches"],["Applied Patch Bundle","kumihoAppliedPatchBundle","applied-canon-patches"],["Current State Bundle","kumihoCurrentStateBundle","current-character-states"],["Active Storyline Bundle","kumihoActiveStorylineBundle","active-storylines"],["Active Foreshadow Bundle","kumihoActiveForeshadowBundle","active-foreshadow"],["Timeline Bundle","kumihoTimelineBundle","timeline-events"]].map(([L,Qe,_t])=>c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:L}),c.jsx("input",{type:"text",value:String(x[Qe]||""),onChange:Gt=>r(e.id,{[Qe]:Gt.target.value}),placeholder:_t,style:lt})]},String(Qe))),c.jsx(Sn,{checked:x.kumihoRequireEvidenceLocator??!0,onChange:L=>r(e.id,{kumihoRequireEvidenceLocator:L}),label:"Require evidence_locator"}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Source Episode Kref"}),c.jsx(ar,{value:x.kumihoSourceEpisodeKref||"",onChange:L=>r(e.id,{kumihoSourceEpisodeKref:L}),placeholder:"${episode-loader.output_data.kref}",rows:1,style:lt,stepIds:f,workflowInputs:g,triggerFields:_})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Source Context Pack Kref"}),c.jsx(ar,{value:x.kumihoSourceContextPackKref||"",onChange:L=>r(e.id,{kumihoSourceContextPackKref:L}),placeholder:"${context-pack-loader.output_data.kref}",rows:1,style:lt,stepIds:f,workflowInputs:g,triggerFields:_})]})]}),v==="map_reduce"&&c.jsxs("div",{style:pr,children:[c.jsx("div",{style:{...Un,color:"var(--pc-accent)"},children:"MapReduce Config"}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Task"}),c.jsx("textarea",{value:x.mapReduceTask,onChange:L=>r(e.id,{mapReduceTask:L.target.value}),placeholder:"Overall task description",rows:2,style:vt})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Splits (comma-separated)"}),c.jsx("input",{type:"text",value:z.draft,onFocus:z.startEditing,onChange:L=>{z.setDraft(L.target.value),r(e.id,{mapReduceSplits:El(L.target.value)})},onBlur:()=>r(e.id,{mapReduceSplits:z.commit()}),onKeyDown:L=>{L.key==="Enter"&&(L.preventDefault(),L.currentTarget.blur())},placeholder:"segment1, segment2, segment3",style:vt})]}),c.jsxs("div",{style:{display:"flex",gap:8},children:[c.jsxs("div",{style:{flex:1},children:[c.jsx("label",{style:Ce,children:"Mapper"}),c.jsx("button",{type:"button",onClick:L=>dt("mapReduceMapper",L),style:{...lt,textAlign:"left",cursor:"pointer"},children:x.mapReduceMapper||"claude"})]}),c.jsxs("div",{style:{flex:1},children:[c.jsx("label",{style:Ce,children:"Reducer"}),c.jsx("button",{type:"button",onClick:L=>dt("mapReduceReducer",L),style:{...lt,textAlign:"left",cursor:"pointer"},children:x.mapReduceReducer||"claude"})]})]}),c.jsxs("div",{style:{display:"flex",gap:6},children:[Ah.map(L=>c.jsxs("button",{type:"button",onClick:()=>r(e.id,{mapReduceMapper:L}),style:{padding:"2px 6px",borderRadius:6,border:"1px solid var(--revka-border-soft)",background:(x.mapReduceMapper||"claude")===L?"var(--pc-accent-glow)":"transparent",color:"var(--pc-text-primary)",fontSize:10,cursor:"pointer"},children:["mapper ",L]},`mapper-${L}`)),Ah.map(L=>c.jsxs("button",{type:"button",onClick:()=>r(e.id,{mapReduceReducer:L}),style:{padding:"2px 6px",borderRadius:6,border:"1px solid var(--revka-border-soft)",background:(x.mapReduceReducer||"claude")===L?"var(--pc-accent-glow)":"transparent",color:"var(--pc-text-primary)",fontSize:10,cursor:"pointer"},children:["reducer ",L]},`reducer-${L}`))]}),c.jsxs("div",{style:{display:"flex",gap:8},children:[c.jsxs("div",{style:{flex:1},children:[c.jsx("label",{style:Ce,children:"Concurrency"}),c.jsx("input",{type:"number",min:1,max:10,value:x.mapReduceConcurrency,onChange:L=>r(e.id,{mapReduceConcurrency:parseInt(L.target.value)||3}),style:vt})]}),c.jsxs("div",{style:{flex:1},children:[c.jsx("label",{style:Ce,children:"Timeout (s)"}),c.jsx("input",{type:"number",min:1,value:x.mapReduceTimeout,onChange:L=>r(e.id,{mapReduceTimeout:parseInt(L.target.value)||300}),style:vt})]})]})]}),v==="notify"&&c.jsxs(c.Fragment,{children:[c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Channels"}),c.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:Mt.map(L=>{const Qe=(x.channels??[]).includes(L.value);return c.jsx("button",{type:"button",onClick:()=>qe(L.value),style:{padding:"4px 10px",borderRadius:8,fontSize:11,fontWeight:600,background:Qe?"var(--pc-accent-glow)":"var(--pc-bg-input)",color:Qe?"var(--pc-accent-light)":"var(--pc-text-muted)",border:`1px solid ${Qe?"var(--pc-accent-dim)":"var(--pc-border)"}`,cursor:"pointer"},children:L.label},L.value)})}),c.jsx("p",{style:mr(),children:"Select one or more channels to broadcast to."})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Channel ID Override"}),c.jsx("input",{type:"text",value:x.notifyChannelId??"",onChange:L=>r(e.id,{notifyChannelId:L.target.value}),placeholder:"optional channel/thread/chat id",style:lt})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Notify Title"}),c.jsx("input",{type:"text",value:x.notifyTitle??"",onChange:L=>r(e.id,{notifyTitle:L.target.value}),placeholder:"Header shown above the message",style:vt})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Notify Message"}),c.jsx(ar,{value:x.notifyMessage??"",onChange:L=>r(e.id,{notifyMessage:L}),placeholder:"Body — supports ${step_id.output} templating",rows:6,style:lt,stepIds:f,workflowInputs:g,triggerFields:_})]})]}),v==="tag"&&c.jsxs("div",{style:pr,children:[c.jsx("div",{style:Un,children:"Tag Config"}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Item kref"}),c.jsx("input",{type:"text",value:x.tagItemKref||"",onChange:L=>r(e.id,{tagItemKref:L.target.value}),placeholder:"${trigger.entity_kref}",style:lt}),c.jsxs("p",{style:mr(),children:["Supports ","${...}"," interpolation."]})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Tag"}),c.jsx("input",{type:"text",value:x.tagValue||"",onChange:L=>r(e.id,{tagValue:L.target.value}),placeholder:"published",style:lt})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Untag (optional)"}),c.jsx("input",{type:"text",value:x.tagUntag||"",onChange:L=>r(e.id,{tagUntag:L.target.value}),placeholder:"draft",style:lt}),c.jsx("p",{style:mr(),children:"Tag to remove before applying the new one."})]})]}),v==="deprecate"&&c.jsxs("div",{style:pr,children:[c.jsx("div",{style:Un,children:"Deprecate Config"}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Item kref"}),c.jsx("input",{type:"text",value:x.deprecateItemKref||"",onChange:L=>r(e.id,{deprecateItemKref:L.target.value}),placeholder:"${trigger.entity_kref}",style:lt}),c.jsxs("p",{style:mr(),children:["Supports ","${...}"," interpolation."]})]}),c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Reason"}),c.jsx("textarea",{value:x.deprecateReason||"",onChange:L=>r(e.id,{deprecateReason:L.target.value}),placeholder:"Why this item is being deprecated",rows:3,style:vt})]})]}),Ne&&c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Auth profile"}),c.jsxs("button",{type:"button",onClick:L=>{_e(L.currentTarget.getBoundingClientRect()),Le(!0)},style:{...vt,display:"flex",alignItems:"center",gap:8,textAlign:"left",cursor:"pointer",color:x.auth?"var(--pc-text-primary)":"var(--pc-text-faint)"},children:[c.jsx(hg,{size:12,style:{color:"var(--revka-text-faint)",flexShrink:0}}),c.jsx("span",{style:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:Ee?`${TN(Ee.provider)} · ${Ee.profile_name}`:x.auth||"None"})]}),x.auth&&c.jsx("button",{type:"button",onClick:()=>r(e.id,{auth:""}),style:{marginTop:6,padding:"4px 10px",fontSize:11,fontWeight:600,borderRadius:6,border:"1px solid var(--revka-status-warning)",background:"color-mix(in srgb, var(--revka-status-warning) 14%, transparent)",color:"var(--revka-status-warning)",cursor:"pointer"},children:"Clear"}),c.jsx("p",{style:mr(),children:"Optional. Bound credential for external API calls."}),c.jsx(E6,{open:ke,onOpenChange:Le,value:x.auth,anchorRect:ye,onSelect:L=>r(e.id,{auth:L??""})})]}),v!=="conditional"&&v!=="human_input"&&v!=="notify"&&v!=="tag"&&v!=="kumiho_context"&&v!=="kumiho_bundle_update"&&v!=="kumiho_patch_apply"&&v!=="deprecate"&&c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Agent Hints"}),c.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:ANe.map(L=>{const Qe=x.agentHints.includes(L);return c.jsx("button",{type:"button",onClick:()=>mt(L),style:{padding:"4px 10px",borderRadius:8,fontSize:11,fontWeight:600,background:Qe?"var(--pc-accent-glow)":"var(--pc-bg-input)",color:Qe?"var(--pc-accent-light)":"var(--pc-text-muted)",border:`1px solid ${Qe?"var(--pc-accent-dim)":"var(--pc-border)"}`,cursor:"pointer"},children:L},L)})}),c.jsx("p",{style:mr(),children:"Suggestions for the operator — final assignment is automatic."})]}),x.dependencyCount>0&&c.jsxs("div",{children:[c.jsx("label",{style:Ce,children:"Dependencies"}),c.jsxs("div",{style:{fontSize:11,color:"var(--pc-text-muted)"},children:[x.dependencyCount," incoming ",x.dependencyCount===1?"dependency":"dependencies"]}),c.jsx("p",{style:mr(),children:"Managed by connecting nodes on the canvas."})]})]})]})})}function Sn({checked:e,onChange:n,label:r,title:i}){return c.jsxs("label",{title:i,style:{display:"inline-flex",alignItems:"center",gap:6,cursor:"pointer",userSelect:"none"},children:[c.jsx("input",{type:"checkbox",checked:e,onChange:s=>n(s.target.checked),style:{accentColor:"var(--pc-accent)"}}),c.jsx("span",{style:{fontSize:11,color:"var(--pc-text-muted)"},children:r})]})}const ONe=9e3,DNe=9001;function PNe({open:e,onOpenChange:n,context:r,actionLabel:i,onSelect:s}){const a=b.useRef(null);if(b.useEffect(()=>{e&&requestAnimationFrame(()=>{var u;return(u=a.current)==null?void 0:u.focus()})},[e]),b.useEffect(()=>{if(!e)return;const u=d=>{d.key==="Escape"&&(d.preventDefault(),n(!1))};return window.addEventListener("keydown",u),()=>window.removeEventListener("keydown",u)},[e,n]),!e||typeof document>"u")return null;const o=u=>{s?s(u):g2e({type:u,...r??{}}),n(!1)},l=c.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":i??"Add Step",onClick:u=>{u.target===u.currentTarget&&n(!1)},style:{position:"fixed",inset:0,zIndex:ONe,display:"flex",alignItems:"flex-start",justifyContent:"center",paddingTop:"14vh",background:"color-mix(in srgb, var(--revka-bg-base) 70%, transparent)",backdropFilter:"blur(2px)"},children:[c.jsx("div",{className:"revka-panel","data-variant":"primary",style:{width:"min(640px, 92vw)",maxHeight:"70vh",display:"flex",flexDirection:"column",borderRadius:12,borderColor:"var(--revka-border-strong)",boxShadow:"0 24px 64px rgba(0,0,0,0.36)",overflow:"hidden",zIndex:DNe},children:c.jsxs(ba,{label:i??"Add Step",loop:!0,shouldFilter:!0,children:[c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"12px 14px",borderBottom:"1px solid var(--revka-border-soft)"},children:[c.jsx(Aa,{size:16,style:{color:"var(--revka-text-faint)"}}),c.jsx(ba.Input,{ref:a,placeholder:"Search steps, skills, channels...",style:{flex:1,background:"transparent",border:0,outline:"none",color:"var(--revka-text-primary)",fontSize:14}}),c.jsx("kbd",{className:"revka-kbd",style:{fontSize:10,padding:"2px 6px",borderRadius:6,color:"var(--revka-text-faint)",background:"var(--pc-bg-input)",border:"1px solid var(--revka-border-soft)"},children:"ESC"})]}),c.jsxs(ba.List,{style:{maxHeight:"54vh",overflowY:"auto",padding:"6px"},children:[c.jsx(ba.Empty,{style:{padding:"24px 16px",textAlign:"center",fontSize:13,color:"var(--revka-text-faint)"},children:"No steps match"}),O2e.map(u=>{const d=T2e[u],p=R2e[u];return c.jsx(ba.Group,{heading:c.jsx("div",{className:"revka-kicker",style:{padding:"8px 10px 4px",letterSpacing:"0.16em"},children:d.label}),children:p.map(f=>{const g=f.icon;return c.jsx(ba.Item,{value:`${f.label} ${f.type} ${f.description} ${f.searchTags.join(" ")}`,keywords:[f.type,...f.searchTags],onSelect:()=>o(f.type),asChild:!0,children:c.jsxs("button",{type:"button",style:{display:"flex",alignItems:"center",gap:12,padding:"10px 12px",borderRadius:10,cursor:"pointer",color:"var(--revka-text-primary)",width:"100%",textAlign:"left",background:"transparent",border:0,font:"inherit"},children:[c.jsx("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:28,height:28,borderRadius:8,background:"color-mix(in srgb, var(--pc-accent-glow) 60%, transparent)",color:"var(--pc-accent)",flexShrink:0},children:c.jsx(g,{size:16})}),c.jsxs("span",{style:{display:"flex",flexDirection:"column",minWidth:0,flex:1},children:[c.jsx("span",{style:{fontSize:13,fontWeight:600},children:f.label}),c.jsx("span",{style:{fontSize:11.5,color:"var(--revka-text-secondary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:f.description})]}),c.jsx("span",{style:{fontFamily:"var(--pc-font-mono, ui-monospace, monospace)",fontSize:10,color:"var(--revka-text-faint)",flexShrink:0},children:f.type})]})},f.type)})},u)})]})]})}),c.jsx("style",{children:`
        [cmdk-item][data-selected='true'] {
          background: var(--pc-accent-glow);
          box-shadow: inset 2px 0 0 var(--pc-accent);
        }
        [cmdk-item][data-selected='true'] span:first-child {
          background: color-mix(in srgb, var(--pc-accent-glow) 90%, transparent);
        }
        [cmdk-item]:hover {
          background: var(--pc-hover);
        }
        [cmdk-group-heading] {
          padding: 0;
        }
      `})]});return na.createPortal(l,document.body)}const LNe=9099,INe=9100,BNe=[{value:"coder",label:"Coder"},{value:"researcher",label:"Researcher"},{value:"reviewer",label:"Reviewer"}],Ex={width:"100%",padding:"8px 10px",borderRadius:8,border:"1px solid var(--pc-border)",background:"var(--pc-bg-input)",color:"var(--pc-text-primary)",fontSize:12.5,outline:"none"},c2={...Ex,fontFamily:"var(--pc-font-mono, ui-monospace, monospace)"},Hu={display:"block",fontSize:10.5,fontWeight:600,color:"var(--revka-text-faint)",textTransform:"uppercase",letterSpacing:"0.08em",marginBottom:6};function zNe({open:e,onClose:n,onCreated:r}){const i=b.useRef(null),[s,a]=b.useState(""),[o,l]=b.useState(!1),[u,d]=b.useState(""),[p,f]=b.useState("claude"),[g,_]=b.useState("coder"),[x,v]=b.useState(""),[S,w]=b.useState(""),[N,C]=b.useState(""),[T,A]=b.useState(null),[E,D]=b.useState(!1),[F,B]=b.useState(null),[H,$]=b.useState(null);b.useEffect(()=>{e&&(a(""),d(""),l(!1),f("claude"),_("coder"),v(""),w(""),C(""),A(null),$(null),D(!1),B(null),requestAnimationFrame(()=>{var I;return(I=i.current)==null?void 0:I.focus()}))},[e]),b.useEffect(()=>{if(!T){$(null);return}const I=URL.createObjectURL(T);return $(I),()=>URL.revokeObjectURL(I)},[T]),b.useEffect(()=>{o||d(s?nu(s,"agent"):"")},[s,o]),b.useEffect(()=>{if(!e)return;const I=Q=>{Q.key==="Escape"&&(Q.preventDefault(),E||n())};return window.addEventListener("keydown",I),()=>window.removeEventListener("keydown",I)},[e,n,E]);const z=b.useMemo(()=>!!(s.trim()&&u.trim()&&g.trim()&&!E),[s,u,g,E]);if(!e||typeof document>"u")return null;const W=I=>{I.target===I.currentTarget&&!E&&n()},P=async I=>{if(I.preventDefault(),!!z){D(!0),B(null);try{const Q={name:u.trim(),identity:S.trim()||s.trim(),soul:"",expertise:[],tone:"",role:g.trim(),agent_type:p,model:x.trim()||void 0,system_hint:N.trim()||void 0};let K=await fB(Q);T&&(K=await iC(K.kref,T)),await r(K)}catch(Q){let K="Failed to create agent";Q instanceof ql?K=Q.message.replace(/^API \d+: /,"")||K:Q instanceof Error&&(K=Q.message),B(K),D(!1)}}},q=c.jsx("div",{role:"dialog","aria-modal":"true","aria-label":"Create pool agent",onClick:W,style:{position:"fixed",inset:0,zIndex:LNe,background:"rgba(0, 0, 0, 0.48)",backdropFilter:"blur(6px)",display:"flex",alignItems:"flex-start",justifyContent:"center",paddingTop:"12vh"},children:c.jsxs("form",{onSubmit:P,className:"revka-panel","data-variant":"primary",style:{width:"min(560px, calc(100vw - 32px))",maxHeight:"calc(100vh - 24vh)",display:"flex",flexDirection:"column",borderRadius:14,borderColor:"var(--revka-border-strong)",boxShadow:"0 32px 80px rgba(0,0,0,0.48)",zIndex:INe,overflow:"hidden"},onClick:I=>I.stopPropagation(),children:[c.jsxs("div",{style:{padding:"14px 16px",borderBottom:"1px solid var(--revka-border-soft)",display:"flex",alignItems:"center",gap:10},children:[c.jsx("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:28,height:28,borderRadius:8,background:"color-mix(in srgb, var(--pc-accent-glow) 60%, transparent)",color:"var(--pc-accent)"},children:c.jsx(zl,{size:15})}),c.jsxs("div",{style:{flex:1,minWidth:0},children:[c.jsx("div",{style:{fontSize:13,fontWeight:700,color:"var(--revka-text-primary)"},children:"New pool agent"}),c.jsx("div",{style:{fontSize:11,color:"var(--revka-text-faint)"},children:"Create a reusable agent for workflow steps"})]}),c.jsx("button",{type:"button",onClick:()=>{E||n()},disabled:E,"aria-label":"Close",style:{background:"transparent",border:0,padding:4,cursor:E?"not-allowed":"pointer",color:"var(--revka-text-faint)",opacity:E?.5:1},children:c.jsx(mi,{size:16})})]}),c.jsxs("div",{style:{padding:"14px 16px",display:"flex",flexDirection:"column",gap:12,overflowY:"auto"},children:[c.jsxs("div",{children:[c.jsx("label",{style:Hu,htmlFor:"new-agent-name",children:"Name *"}),c.jsx("input",{id:"new-agent-name",ref:i,type:"text",value:s,onChange:I=>a(I.target.value),placeholder:"Senior Rust reviewer",style:Ex,disabled:E})]}),c.jsxs("div",{children:[c.jsx("label",{style:Hu,htmlFor:"new-agent-slug",children:"Item name (slug) *"}),c.jsx("input",{id:"new-agent-slug",type:"text",value:u,onChange:I=>{d(nu(I.target.value,"agent")),l(!0)},placeholder:"senior-rust-reviewer",style:c2,disabled:E})]}),c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:10,borderRadius:10,border:"1px solid var(--revka-border-soft)",background:"color-mix(in srgb, var(--revka-bg-panel-strong) 78%, transparent)"},children:[c.jsx(js,{src:H,alt:s||u||"Agent",size:42,radius:10}),c.jsxs("div",{style:{flex:1,minWidth:0},children:[c.jsx("div",{style:{fontSize:11.5,fontWeight:700,color:"var(--revka-text-primary)"},children:"Profile image"}),c.jsx("div",{style:{marginTop:2,fontSize:10.5,color:"var(--revka-text-faint)"},children:"PNG, JPEG, or WebP"})]}),c.jsxs("label",{className:"revka-button",style:{cursor:E?"not-allowed":"pointer"},children:[c.jsx(mE,{size:13}),"Upload",c.jsx("input",{type:"file",accept:"image/png,image/jpeg,image/webp",disabled:E,className:"sr-only",onChange:I=>{var Q;return A(((Q=I.target.files)==null?void 0:Q[0])??null)}})]})]}),c.jsxs("div",{children:[c.jsx("label",{style:Hu,children:"Agent type"}),c.jsx("div",{role:"radiogroup","aria-label":"Agent type",style:{display:"inline-flex",borderRadius:8,border:"1px solid var(--pc-border)",background:"var(--pc-bg-input)",padding:2},children:["claude","codex","agy","agent","opencode"].map(I=>{const Q=p===I;return c.jsx("button",{type:"button",role:"radio","aria-checked":Q,onClick:()=>f(I),disabled:E,style:{padding:"5px 14px",fontSize:11.5,fontWeight:600,borderRadius:6,border:0,cursor:E?"not-allowed":"pointer",background:Q?"var(--pc-accent-glow)":"transparent",color:Q?"var(--pc-accent)":"var(--revka-text-secondary)",textTransform:"capitalize"},children:I},I)})})]}),c.jsxs("div",{children:[c.jsx("label",{style:Hu,htmlFor:"new-agent-role",children:"Role"}),c.jsx("input",{id:"new-agent-role",type:"text",value:g,onChange:I=>_(I.target.value),list:"new-agent-role-options",placeholder:"coder",style:Ex,disabled:E}),c.jsx("datalist",{id:"new-agent-role-options",children:BNe.map(I=>c.jsx("option",{value:I.value,children:I.label},I.value))})]}),c.jsxs("div",{children:[c.jsx("label",{style:Hu,htmlFor:"new-agent-model",children:"Model override"}),c.jsx("input",{id:"new-agent-model",type:"text",value:x,onChange:I=>v(I.target.value),placeholder:"claude-opus-4-7 (optional)",style:c2,disabled:E})]}),c.jsxs("div",{children:[c.jsx("label",{style:Hu,htmlFor:"new-agent-prompt",children:"Prompt template"}),c.jsx("textarea",{id:"new-agent-prompt",value:N,onChange:I=>C(I.target.value),placeholder:"System prompt or guidance for this agent…",rows:5,style:{...c2,resize:"vertical",minHeight:80},disabled:E})]}),c.jsxs("div",{children:[c.jsx("label",{style:Hu,htmlFor:"new-agent-identity",children:"Description / notes"}),c.jsx("textarea",{id:"new-agent-identity",value:S,onChange:I=>w(I.target.value),placeholder:"Senior engineer focused on Rust systems work…",rows:2,style:{...Ex,resize:"vertical",minHeight:50},disabled:E})]}),F&&c.jsx("div",{role:"alert",style:{padding:"8px 10px",borderRadius:8,background:"color-mix(in srgb, var(--revka-status-danger) 14%, transparent)",border:"1px solid var(--revka-status-danger)",color:"var(--revka-status-danger)",fontSize:11.5},children:F})]}),c.jsxs("div",{style:{padding:"12px 16px",borderTop:"1px solid var(--revka-border-soft)",display:"flex",alignItems:"center",justifyContent:"flex-end",gap:8},children:[c.jsx("button",{type:"button",onClick:()=>{E||n()},disabled:E,className:"revka-button",children:"Cancel"}),c.jsxs("button",{type:"submit",disabled:!z,className:"revka-button","data-variant":"primary",style:{display:"inline-flex",alignItems:"center",gap:6},children:[E&&c.jsx(Rr,{size:13,className:"animate-spin"}),E?"Creating…":"Create agent"]})]})]})});return na.createPortal(q,document.body)}const OU=340,PN=360,$Ne=8,FNe=9e3,HNe=9001,WNe=50;function qNe(e){const n=window.innerWidth,r=window.innerHeight,i=Math.min(e.bottom+$Ne,r-PN-8),s=Math.max(8,n-e.right);return{position:"fixed",top:Math.max(8,i),right:s,width:OU,maxHeight:PN}}function UNe(){return{position:"fixed",top:"20vh",left:"50%",transform:"translateX(-50%)",width:OU,maxHeight:PN}}function VNe(e,n){return n?[e.item_name,e.name,e.role,e.agent_type,(e.expertise??[]).join(" ")].join(" ").toLowerCase().includes(n.toLowerCase()):!0}function KNe({open:e,onOpenChange:n,value:r,onSelect:i,anchorRect:s}){const a=b.useRef(null),{agents:o,loading:l,refresh:u}=jA(),[d,p]=b.useState(""),[f,g]=b.useState(0),[_,x]=b.useState(!1);b.useEffect(()=>{e&&(p(""),g(0),requestAnimationFrame(()=>{var E;return(E=a.current)==null?void 0:E.focus()}))},[e]);const v=b.useMemo(()=>o.filter(E=>VNe(E,d)).slice(0,WNe),[o,d]);b.useEffect(()=>{f>=v.length&&g(v.length===0?0:v.length-1)},[v.length,f]);const S=b.useMemo(()=>s?qNe(s):UNe(),[s]);if(!e||typeof document>"u")return null;const w=()=>{p(""),g(0),n(!1)},N=E=>{i(E),w()},C=E=>{if(E.key==="ArrowDown"){if(E.preventDefault(),v.length===0)return;g(D=>(D+1)%v.length)}else if(E.key==="ArrowUp"){if(E.preventDefault(),v.length===0)return;g(D=>(D-1+v.length)%v.length)}else if(E.key==="Enter"){E.preventDefault();const D=v[f];D&&N(D.item_name)}else E.key==="Escape"&&(E.preventDefault(),w())},T=l?"Loading agents…":o.length===0?"No pool agents — click + New pool agent":"No agents match",A=c.jsx("div",{role:"dialog","aria-modal":"true","aria-label":"Choose pool agent",onClick:E=>{E.target===E.currentTarget&&w()},style:{position:"fixed",inset:0,zIndex:FNe,background:"transparent"},children:c.jsxs("div",{className:"revka-panel","data-variant":"primary",style:{...S,display:"flex",flexDirection:"column",borderRadius:12,borderColor:"var(--revka-border-strong)",boxShadow:"0 24px 64px rgba(0,0,0,0.36)",overflow:"hidden",zIndex:HNe},onClick:E=>E.stopPropagation(),children:[c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"10px 12px",borderBottom:"1px solid var(--revka-border-soft)"},children:[c.jsx(Aa,{size:14,style:{color:"var(--revka-text-faint)"}}),c.jsx("input",{ref:a,type:"text",value:d,onChange:E=>{p(E.target.value),g(0)},onKeyDown:C,placeholder:"Search pool agents…",style:{flex:1,background:"transparent",border:0,outline:"none",color:"var(--revka-text-primary)",fontSize:13}}),c.jsx("kbd",{className:"revka-kbd",style:{fontSize:10,padding:"2px 6px",borderRadius:6,color:"var(--revka-text-faint)",background:"var(--pc-bg-input)",border:"1px solid var(--revka-border-soft)"},children:"ESC"})]}),c.jsx("div",{style:{flex:1,maxHeight:240,overflowY:"auto",padding:"6px"},children:v.length===0?c.jsx("div",{style:{padding:"20px 16px",textAlign:"center",fontSize:12,color:"var(--revka-text-faint)"},children:T}):c.jsx("ul",{style:{listStyle:"none",margin:0,padding:0},children:v.map((E,D)=>{const F=r===E.item_name,B=D===f;return c.jsx("li",{style:{margin:0,padding:0},children:c.jsxs("button",{type:"button","data-active":B,onMouseEnter:()=>g(D),onClick:H=>{H.preventDefault(),H.stopPropagation(),N(E.item_name)},style:{display:"flex",alignItems:"center",gap:10,padding:"8px 10px",borderRadius:8,cursor:"pointer",color:"var(--revka-text-primary)",width:"100%",textAlign:"left",background:B?"var(--pc-accent-glow)":"transparent",boxShadow:B?"inset 2px 0 0 var(--pc-accent)":"none",border:0,font:"inherit"},children:[c.jsx(js,{src:E.avatar_url,alt:E.name||E.item_name,size:24,radius:6,iconSize:13,style:{background:F?"var(--revka-signal-network-soft)":"color-mix(in srgb, var(--pc-accent-glow) 60%, transparent)",color:F?"var(--revka-signal-network)":"var(--pc-accent)",flexShrink:0}}),c.jsxs("span",{style:{display:"flex",flexDirection:"column",minWidth:0,flex:1},children:[c.jsx("span",{style:{fontSize:12.5,fontWeight:600,fontFamily:"var(--pc-font-mono, ui-monospace, monospace)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:E.item_name}),E.identity&&c.jsx("span",{style:{fontSize:10.5,color:"var(--revka-text-secondary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:E.identity})]}),c.jsx("span",{style:{fontFamily:"var(--pc-font-mono, ui-monospace, monospace)",fontSize:9.5,padding:"2px 6px",borderRadius:4,background:"var(--pc-hover)",color:"var(--revka-text-faint)",flexShrink:0,textTransform:"uppercase",letterSpacing:"0.04em"},children:E.agent_type})]})},E.kref)})})}),r&&c.jsx("button",{type:"button",onClick:()=>N(null),style:{margin:"0 8px 8px",padding:"6px 10px",fontSize:11,fontWeight:600,borderRadius:6,border:"1px solid var(--revka-status-warning)",background:"color-mix(in srgb, var(--revka-status-warning) 14%, transparent)",color:"var(--revka-status-warning)",cursor:"pointer"},children:"Clear assignment"}),c.jsxs("div",{style:{padding:"8px 12px",borderTop:"1px solid var(--revka-border-soft)",display:"flex",alignItems:"center",justifyContent:"space-between",fontSize:11,color:"var(--revka-text-faint)"},children:[c.jsx("span",{children:v.length===o.length?`${o.length} agent${o.length===1?"":"s"}`:`${v.length} of ${o.length}`}),c.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:10},children:[c.jsx("a",{href:"/agents",target:"_blank",rel:"noreferrer",style:{color:"var(--revka-text-faint)",textDecoration:"none",fontWeight:500},children:"Open agents page →"}),c.jsx("button",{type:"button",onClick:()=>x(!0),style:{background:"transparent",border:0,padding:0,cursor:"pointer",color:"var(--pc-accent)",fontWeight:600,fontSize:11},children:"+ New pool agent"})]})]})]})});return c.jsxs(c.Fragment,{children:[na.createPortal(A,document.body),c.jsx(zNe,{open:_,onClose:()=>x(!1),onCreated:async E=>{await u(),x(!1),N(E.item_name)}})]})}function YNe(e){const n=e?`revka.architect.session_id:${e}`:"revka.architect.session_id:new";try{const r=sessionStorage.getItem(n);if(r)return r;const i=typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`arch-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`;return sessionStorage.setItem(n,i),i}catch{return`arch-${e??"new"}`}}function GNe(e){return["You are the Architect for the Revka workflow editor.","","CRITICAL: The user CANNOT see workflows you write in chat. They only see what you submit via `propose_workflow_yaml`. A YAML code block in your chat reply is invisible to the editor — it does NOT render on the canvas, and the user has no way to save it.","","Your ONE proposal tool: `propose_workflow_yaml(proposed_yaml=<YAML>, intent_summary=<one line>, base_yaml=<editor's current YAML, or empty>)`.","","DO NOT:","- Print the YAML in chat instead of calling propose_workflow_yaml","- Call create_workflow, revise_workflow, register_workflow, save_workflow_yaml, save_workflow_preset (they're not available; the editor handles persistence)","","Process:","1. If the user describes a workflow, design it from available primitives.","2. Optionally call get_workflow_metadata first to check available step types, agents, skills, auth profiles.","3. Revka the complete YAML.","4. **If base_yaml is non-empty, EXTEND it.** Treat existing steps as fixed. Add new steps after them. Do NOT remove or modify existing steps unless the user explicitly asks.","5. Call propose_workflow_yaml(...) with your YAML. The tool validates and the editor receives the proposal.","6. After the call returns, summarize what you proposed in a single short paragraph in chat. The summary is for the user to read — but the actual workflow goes through the tool, not the chat.","","Parallel execution:","- For most cases, you do NOT need a `parallel` wrapper. Sibling steps with no `depends_on` between them run in parallel naturally — the runtime parallelizes by default whenever steps are independent.","- ONLY use a `type: parallel` step when you need to explicitly group children, e.g. for join-strategy semantics or sub-workflow encapsulation. When you do use it, you MUST populate `parallel.steps: [child_id_1, child_id_2, ...]` listing each child step ID.","- Wrong: `type: parallel` with no `parallel.steps` — the step is an orphan and `propose_workflow_yaml` will reject it.","- Right (preferred for simple cases): just declare the steps as siblings without depends_on. They parallelize automatically. Add depends_on on the consumer step (e.g. `combine_report.depends_on: [research_a, research_b]`) so the consumer waits for all of them.","- Whenever a step's prompt/command/template references another step via placeholders such as `STEP_ID.output_data.artifact_path`, `STEP_ID.output`, or `STEP_ID.status`, also list that step ID in `depends_on`. The runtime infers missing deps automatically, but explicit declarations are clearer.","- Chaining steps — concrete example. WRONG (proposal will be REJECTED):",'    prompt: "Combine the two upstream research reports."',"    depends_on: [research_a, research_b]","  RIGHT:",'    prompt: "Combine these two reports.\\n\\nA artifact: ${research_a.output_data.artifact_path}\\n\\nB artifact: ${research_b.output_data.artifact_path}\\n\\nRead both artifacts before synthesizing."',"    depends_on: [research_a, research_b]","  The runtime cannot auto-inject prior results into prompts. If an agent step needs information from another step, prefer `${other_step.output_data.artifact_path}` and tell the agent to read that file for full context. Use `${other_step.output}` only for short inline handoffs. The validator rejects agent steps with depends_on entries that are not referenced in the prompt.","","Persona discovery (do this BEFORE proposing YAML when a step needs a specific role/expertise):","- Call `search_agent_pool` or `list_agent_templates` to find existing personas. If one fits, set `agent.template: <name>` on the step — agent_type/role/model resolve from the template at dispatch.","- If no fit AND the user described a recurring named role, call `save_agent_template` with required fields: `name` (kebab-case), `agent_type` (claude|codex), `role` (one of: coder, reviewer, researcher, tester, architect, planner), `capabilities` (string array of tags), `description`. Optional: `system_hint`, `identity`, `soul`, `tone`, `model`. Then reference the new template via `agent.template`.","- Skip persona creation for one-shot generic steps; bare `agent_type: claude/codex` (no template) is correct there.","- In your post-proposal summary, briefly note which personas were reused vs created.","","If propose_workflow_yaml returns valid: false, read the errors and call it again with a fixed YAML. Don't print the broken YAML in chat — the user can't fix it from there.","","Workflow context:",`- Current name: ${e||"(unnamed)"}`,"- The editor's current YAML state will be in your message context as the editor-state block."].join(`
`)}function XNe(e){const n=/```(?:yaml|yml)\n([\s\S]*?)\n```/g;let r=null,i;for(;(i=n.exec(e))!==null;)r=i[1]??null;return r}function QNe(e,n){const r=n.split(`
`).map(s=>`  ${s}`).join(`
`);return["v2:workflow_editor:architect","<architect-instructions>",GNe(e).split(`
`).map(s=>s.length>0?`  ${s}`:s).join(`
`),"</architect-instructions>","<editor-state>",`  <workflow_name>${e||"(unnamed)"}</workflow_name>`,"  <current_yaml>",r||"    (empty)","  </current_yaml>","</editor-state>"].join(`
`)}function ZNe({open:e,onOpenChange:n,workflowKref:r,workflowName:i,currentYaml:s,onYamlProposed:a,initialPrompt:o}){const l=b.useMemo(()=>YNe(r),[r]),u=b.useMemo(()=>QNe(i,s),[i,s]),d=r?`revka-architect:${r}`:"revka-architect:new",{setTheme:p}=Ta(),{setLocale:f}=cn(),g=b.useRef(null),_=b.useRef(!1),x=b.useRef(new Set),v=b.useCallback(ue=>{if((ue.name.includes("__")?ue.name.split("__").pop()??ue.name:ue.name)!=="propose_workflow_yaml"||g.current===ue.id)return;g.current=ue.id;let pe=null;try{const J=JSON.parse(ue.output);if(J&&typeof J=="object"&&Array.isArray(J.content)){const fe=J.content[0];if(fe&&fe.type==="text"&&typeof fe.text=="string")try{pe=JSON.parse(fe.text)}catch{pe=null}else pe=J}else pe=J}catch{const J=ue.output.indexOf("{"),me=ue.output.lastIndexOf("}");if(J>=0&&me>J)try{pe=JSON.parse(ue.output.slice(J,me+1))}catch{pe=null}}pe&&pe.valid&&typeof pe.yaml=="string"&&pe.yaml.trim()&&(a(pe.yaml,pe.summary??""),_.current=!0)},[a]),S=b.useCallback(()=>{_.current=!1},[]),{activities:w,appendSystemMessage:N,clearMessages:C,connected:T,error:A,handleSend:E,handleTextareaChange:D,input:F,inputRef:B,messages:H,setInput:$,streamingContent:z,streamingThinking:W,submitMessage:P,typing:q}=UB({sessionId:l,draftKey:d,pageContext:u,onToolResult:v,onUserMessage:S});b.useEffect(()=>{if(q||_.current||H.length===0)return;const ue=H[H.length-1];if(!ue||ue.role!=="agent"||x.current.has(ue.id))return;x.current.add(ue.id);const ae=XNe(ue.content);if(!ae||!ae.trim())return;_.current=!0;let pe=!1;return(async()=>{let J=null;try{J=await tZ({yaml:ae,base_yaml:s,intent_summary:"<chat-fallback>"})}catch(ve){if(pe)return;if(ve instanceof ql)N(`Architect wrote YAML in chat instead of calling propose_workflow_yaml. Fallback validation failed (HTTP ${ve.status}); canvas not updated.`);else{const Ke=ve instanceof Error?ve.message:String(ve);N(`Architect wrote YAML in chat instead of calling propose_workflow_yaml. Fallback validation failed (${Ke}); canvas not updated.`)}return}if(pe||!J)return;if(J.valid){const ve=typeof J.yaml=="string"&&J.yaml.trim()?J.yaml:ae;a(ve,"<chat-fallback>: extracted from chat content because propose_workflow_yaml was not called"),N("Architect wrote YAML in chat instead of calling propose_workflow_yaml. Validated via fallback and applied. The DAG canvas updated.");return}const fe=(J.errors??[]).map(ve=>{const Ke=(ve==null?void 0:ve.message)??"validation error",ge=(ve==null?void 0:ve.path)??[ve==null?void 0:ve.step_id,ve==null?void 0:ve.field].filter(Boolean).join(".")??"";return ge?`- ${Ke} (at ${ge})`:`- ${Ke}`}).join(`
`)||"- (no error detail returned)";N(`Architect wrote YAML in chat instead of calling propose_workflow_yaml AND that YAML failed validation. Canvas not updated.

Validator errors:
${fe}`)})(),()=>{pe=!0}},[H,q,a,N,s]);const I=b.useRef(null);b.useEffect(()=>{e&&o&&I.current!==l&&(F.trim().length===0&&$(o),I.current=l)},[e,o,l,F,$]);const Q=b.useRef(null),[K,Z]=b.useState(0),[Y,R]=b.useState(!1),[U,V]=b.useState(null),ie=b.useMemo(()=>{if(Y)return[];const ue=F.trimStart();return ue.startsWith("/")?ue.includes(" ")||ue.includes(`
`)?[]:t$(ue,"workflow_editor"):[]},[F,Y]);b.useEffect(()=>{K>=ie.length&&Z(ie.length===0?0:ie.length-1)},[ie.length,K]),b.useEffect(()=>{Y&&!F.startsWith("/")&&R(!1)},[F,Y]);const te=b.useMemo(()=>({clearMessages:C,appendSystemMessage:N,openFilePicker:()=>{},addTab:()=>{},openNewTabMenu:()=>{},closeActiveTab:()=>n(!1),setLang:ue=>{f(ue)},setTheme:ue=>{p(ue)},submitMessage:P,workflowKref:r??void 0,workflowName:i}),[C,N,n,f,p,P,r,i]),X=b.useCallback(()=>{const ue=n$(F);if(!ue)return!1;const ae=r$(ue.name);if(!ae)return!1;$(""),Z(0),R(!1),B.current&&(B.current.style.height="auto");try{ae.handler(te,ue.args)}catch(pe){const J=pe instanceof Error?pe.message:String(pe);N(`Command "/${ae.name}" failed: ${J}`)}return!0},[F,te,$,B,N]),se=b.useCallback(ue=>{var pe;const ae=ie[ue];if(ae)if(ae.args)$(`/${ae.name} `),Z(0),(pe=B.current)==null||pe.focus();else{$(""),Z(0),B.current&&(B.current.style.height="auto");try{ae.handler(te,"")}catch(J){const me=J instanceof Error?J.message:String(J);N(`Command "/${ae.name}" failed: ${me}`)}}},[ie,te,$,B,N]),re=b.useRef(null);b.useEffect(()=>{var ue;(ue=re.current)==null||ue.scrollTo({top:re.current.scrollHeight,behavior:"smooth"})},[w,H,z,q]),b.useEffect(()=>{if(!e)return;const ue=setTimeout(()=>{var ae;return(ae=B.current)==null?void 0:ae.focus()},220);return()=>clearTimeout(ue)},[e,B]);const de=b.useCallback(async(ue,ae)=>{await Ja(ae)&&(V(ue),setTimeout(()=>V(pe=>pe===ue?null:pe),1200))},[]);return c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"flex items-center justify-end border-b px-3 py-1",style:{borderColor:"var(--revka-border-soft)",background:"var(--revka-bg-surface)"},children:c.jsxs("span",{className:"flex shrink-0 items-center gap-1.5 text-[10px] font-semibold uppercase tracking-[0.12em]",style:{color:"var(--revka-text-faint)"},children:[c.jsx("span",{className:"inline-block h-1.5 w-1.5 rounded-full",style:{background:T?"var(--revka-status-success)":"var(--revka-status-danger)"}}),T?"live":"offline"]})}),q&&c.jsx("div",{className:"h-[2px] overflow-hidden",style:{background:"var(--revka-bg-surface)"},children:c.jsx("div",{className:"h-full",style:{background:"var(--revka-signal-network)",width:"40%",animation:"revka-architect-sweep 1.4s ease-in-out infinite alternate"}})}),A&&c.jsx("div",{className:"border-b px-3 py-2 text-xs",style:{borderColor:"color-mix(in srgb, var(--revka-status-danger) 32%, transparent)",background:"color-mix(in srgb, var(--revka-status-danger) 10%, transparent)",color:"var(--revka-status-danger)"},children:A}),c.jsx("div",{ref:re,className:"min-h-0 flex-1 overflow-y-auto overflow-x-hidden px-3 py-3 font-mono leading-6",style:{fontSize:13},children:H.length===0&&!q?c.jsxs("div",{className:"flex h-full flex-col items-center justify-center text-center",children:[c.jsx("pre",{className:"text-xs",style:{color:"var(--revka-text-faint)"},children:`┌──────────────────────────────┐
│  architect ready · describe  │
│  the workflow you want       │
└──────────────────────────────┘`}),c.jsx("p",{className:"mt-3 max-w-xs text-xs leading-5",style:{color:"var(--revka-text-muted)"},children:"Try /architect add a python step that prints hello"})]}):c.jsxs("div",{className:"space-y-3",children:[H.map(ue=>{const ae=ue.role==="user"?"you":ue.role==="operator"?"sys":"architect",pe=ue.role==="user"?"var(--revka-text-secondary)":ue.role==="operator"?"var(--revka-signal-network)":"var(--revka-signal-live)",J=U===ue.id;return c.jsxs("div",{className:"group",children:[ue.activityLog&&ue.activityLog.length>0&&c.jsx("div",{className:"mb-1 space-y-0.5",children:ue.activityLog.map(me=>c.jsx(Vx,{event:me,accent:me.kind==="tool_result"?"var(--revka-status-success)":"var(--revka-signal-network)",fontSize:13},me.id))}),c.jsxs("div",{className:"whitespace-pre-wrap break-words",children:[c.jsxs("span",{style:{color:pe,fontWeight:600},children:[ae," ",">"," "]}),c.jsx("span",{style:{color:pe},children:ue.content})]}),c.jsx("div",{className:"mt-0.5 flex items-center justify-end gap-2 text-[10px]",style:{color:"var(--revka-text-faint)"},children:c.jsxs("button",{type:"button",onClick:()=>de(ue.id,ue.content),"aria-label":J?"Copied":"Copy message",title:J?"Copied":"Copy",className:"inline-flex items-center gap-1 rounded px-1.5 py-0.5 opacity-50 transition-all hover:bg-white/5 hover:opacity-100 group-hover:opacity-80",style:{color:"var(--revka-text-muted)"},children:[J?c.jsx(Za,{className:"h-3 w-3"}):c.jsx(Xl,{className:"h-3 w-3"}),c.jsx("span",{children:J?"copied":"copy"})]})})]},ue.id)}),q&&w.length>0&&c.jsx("div",{className:"space-y-0.5",children:w.map(ue=>c.jsx(Vx,{event:ue,accent:ue.kind==="tool_result"?"var(--revka-status-success)":ue.kind==="thinking"?"var(--revka-text-faint)":"var(--revka-signal-network)",fontSize:13},ue.id))}),q&&(z||W)&&c.jsxs("div",{className:"whitespace-pre-wrap break-words",children:[c.jsxs("span",{style:{color:"var(--revka-signal-live)",fontWeight:600},children:["architect ",">"," "]}),c.jsx("span",{style:{color:"var(--revka-signal-live)"},children:z||"…"})]}),q&&!z&&!W&&w.length===0&&c.jsxs("div",{className:"animate-pulse",style:{color:"var(--revka-signal-live)"},children:["architect ",">"," ",c.jsx(Rr,{className:"inline h-3 w-3 animate-spin"})]})]})}),c.jsxs("div",{ref:Q,className:"relative border-t px-3 py-2",style:{borderColor:"var(--revka-border-soft)"},children:[c.jsxs("div",{className:"flex items-end gap-2 rounded-md border px-2 py-1.5",style:{borderColor:"var(--revka-border-soft)",color:"var(--revka-signal-network)"},children:[c.jsxs("span",{className:"shrink-0 pb-[3px] font-mono text-sm font-semibold",style:{color:"var(--revka-signal-network)"},children:[">",c.jsx("span",{className:"revka-cursor-blink",children:"_"})]}),c.jsx("textarea",{ref:B,rows:1,value:F,onChange:D,onKeyDown:ue=>{if(ie.length>0){if(ue.key==="ArrowDown"){ue.preventDefault(),Z(pe=>(pe+1)%ie.length);return}if(ue.key==="ArrowUp"){ue.preventDefault(),Z(pe=>(pe-1+ie.length)%ie.length);return}if(ue.key==="Tab"){ue.preventDefault(),se(K);return}if(ue.key==="Escape"){ue.preventDefault(),R(!0);return}if(ue.key==="Enter"&&!ue.shiftKey){ue.preventDefault(),se(K);return}}if(ue.key==="Enter"&&!ue.shiftKey){if(ue.preventDefault(),X())return;E()}},placeholder:T?"Describe a change… (try /architect)":"connecting…",disabled:!T,className:"min-h-[1.75rem] min-w-0 flex-1 resize-none bg-transparent font-mono outline-none focus:outline-none focus-visible:outline-none disabled:opacity-50",style:{color:"var(--revka-text-primary)",caretColor:"var(--revka-signal-network)",maxHeight:"6rem",fontSize:16}}),c.jsx("button",{type:"button",onClick:()=>E(),disabled:!T||!F.trim(),"aria-label":"Send message",title:T?"Send (Enter)":"Disconnected",className:"inline-flex h-7 w-7 shrink-0 items-center justify-center rounded transition-all hover:bg-white/5 disabled:cursor-not-allowed disabled:opacity-30",style:{color:F.trim()&&T?"var(--revka-signal-network)":"var(--revka-text-faint)"},children:c.jsx(_E,{className:"h-3.5 w-3.5"})})]}),c.jsx(J9,{anchorRef:Q,matches:ie,selectedIndex:K,onPick:se})]})]})}function JNe({open:e,onOpenChange:n,workflowKref:r,workflowName:i,currentYaml:s,onYamlProposed:a,initialPrompt:o}){b.useEffect(()=>{if(!e)return;const u=d=>{d.key==="Escape"&&n(!1)};return window.addEventListener("keydown",u),()=>window.removeEventListener("keydown",u)},[e,n]);const l=i??"workflow";return c.jsxs(c.Fragment,{children:[e&&c.jsx("div",{className:"fixed inset-0 z-[80]",style:{background:"rgba(0,0,0,0.18)"},onClick:()=>n(!1)}),c.jsxs("aside",{className:"fixed right-0 top-0 z-[90] flex h-full flex-col border-l",style:{width:480,maxWidth:"100vw",transform:e?"translateX(0)":"translateX(100%)",transition:"transform 280ms ease-out",background:"var(--revka-bg-base)",borderColor:"var(--revka-border-strong)",boxShadow:e?"var(--revka-shadow-overlay)":"none",pointerEvents:e?"auto":"none"},"aria-hidden":!e,children:[c.jsxs("div",{className:"flex items-center gap-2 border-b px-3 py-2",style:{borderColor:"var(--revka-border-soft)",background:"var(--revka-bg-surface)"},children:[c.jsx($B,{size:14,style:{color:"var(--revka-signal-network)"},"aria-hidden":!0}),c.jsx("span",{className:"text-[12px] font-semibold uppercase tracking-[0.14em]",style:{color:"var(--revka-text-primary)"},children:"Architect"}),c.jsx("span",{className:"ml-1 truncate rounded px-2 py-0.5 text-[11px]",style:{background:"var(--pc-bg-input)",color:"var(--revka-text-muted)",maxWidth:220},title:r?`${l} · ${r}`:l,children:l}),c.jsx("div",{className:"flex-1"}),c.jsx("button",{type:"button",onClick:()=>n(!1),"aria-label":"Close Architect",title:"Close (Esc)",className:"ml-1 rounded p-1 transition-colors hover:bg-white/5",style:{color:"var(--revka-text-faint)"},children:c.jsx(mi,{size:14})})]}),c.jsx(ZNe,{open:e,onOpenChange:n,workflowKref:r,workflowName:l,currentYaml:s,onYamlProposed:a,initialPrompt:o}),c.jsx("div",{className:"border-t px-3 py-1.5 text-center text-[10px] uppercase tracking-[0.16em]",style:{borderColor:"var(--revka-border-soft)",color:"var(--pc-text-faint, var(--revka-text-faint))",background:"var(--revka-bg-surface)"},children:"Powered by Operator"})]}),c.jsx("style",{children:`
        @keyframes revka-architect-sweep {
          from { transform: translateX(-10%); }
          to   { transform: translateX(160%); }
        }
      `})]})}function eEe(e,n){if(e.type!=="workflow.revision.published")return!1;const r=e.workflow_kref;return typeof r=="string"&&r===n}function tEe(e,n){if(e.type!=="workflow.revision.republished")return!1;const r=e.revision_kref;if(typeof r!="string")return!1;const i=r.split("?",1)[0],s=n.split("?",1)[0];return i===s}function nEe({workflowKref:e,onChange:n}){const r=b.useRef(n);r.current=n,b.useEffect(()=>{if(!e)return;const i=new pv;return i.onEvent=s=>{if(eEe(s,e)){r.current(s);return}tEe(s,e)&&r.current(s)},i.connect(),()=>{i.disconnect()}},[e])}const rEe=9099,iEe=9100;function D6(e){return e.tags.includes("published")}function DU(e){var r;const n=(r=e.metadata)==null?void 0:r.rationale;if(typeof n=="string"&&n.trim().length>0)return n.trim();for(const i of e.tags)if(i.startsWith("rationale:")){const s=i.slice(10).trim();return s.length>0?s:null}return null}function sEe(e){if(!e)return"—";const n=Date.parse(e);if(Number.isNaN(n))return"—";const r=Date.now()-n;if(r<0)return"just now";const i=Math.round(r/1e3);if(i<45)return"just now";const s=Math.round(i/60);if(s<60)return`${s}m ago`;const a=Math.round(s/60);if(a<24)return`${a}h ago`;const o=Math.round(a/24);if(o<30)return`${o}d ago`;try{return new Date(n).toLocaleDateString()}catch{return`${o}d ago`}}function aEe(e){if(!e)return"unknown time";const n=Date.parse(e);if(Number.isNaN(n))return e;try{return new Date(n).toLocaleString()}catch{return e}}function oEe({open:e,revision:n,onCancel:r,onConfirm:i,submitting:s,error:a}){if(b.useEffect(()=>{if(!e)return;const d=p=>{p.key==="Escape"&&(p.preventDefault(),s||r())};return window.addEventListener("keydown",d),()=>window.removeEventListener("keydown",d)},[e,s,r]),!e||!n||typeof document>"u")return null;const o=DU(n),l=d=>{d.target===d.currentTarget&&!s&&r()},u=c.jsx("div",{role:"dialog","aria-modal":"true","aria-label":`Revert to revision r${n.number}`,onClick:l,style:{position:"fixed",inset:0,zIndex:rEe,background:"rgba(0, 0, 0, 0.48)",backdropFilter:"blur(6px)",display:"flex",alignItems:"flex-start",justifyContent:"center",paddingTop:"14vh"},children:c.jsxs("div",{className:"revka-panel","data-variant":"primary",onClick:d=>d.stopPropagation(),style:{width:"min(460px, calc(100vw - 32px))",display:"flex",flexDirection:"column",borderRadius:14,borderColor:"var(--revka-border-strong)",boxShadow:"0 32px 80px rgba(0,0,0,0.48)",zIndex:iEe,overflow:"hidden"},children:[c.jsxs("div",{style:{padding:"14px 16px",borderBottom:"1px solid var(--revka-border-soft)",display:"flex",alignItems:"center",gap:10},children:[c.jsx("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:28,height:28,borderRadius:8,background:"color-mix(in srgb, var(--revka-status-warning) 28%, transparent)",color:"var(--revka-status-warning)"},children:c.jsx(pE,{size:15})}),c.jsxs("div",{style:{flex:1,minWidth:0},children:[c.jsxs("div",{style:{fontSize:13,fontWeight:700,color:"var(--revka-text-primary)"},children:["Revert to revision r",n.number,"?"]}),o?c.jsx("div",{style:{fontSize:11,color:"var(--revka-text-faint)",marginTop:2,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:o,children:o}):null]}),c.jsx("button",{type:"button",onClick:()=>{s||r()},disabled:s,"aria-label":"Close",style:{background:"transparent",border:0,padding:4,cursor:s?"not-allowed":"pointer",color:"var(--revka-text-faint)",opacity:s?.5:1},children:c.jsx(mi,{size:16})})]}),c.jsxs("div",{style:{padding:"14px 16px",display:"flex",flexDirection:"column",gap:10},children:[c.jsxs("p",{style:{fontSize:12.5,lineHeight:1.5,color:"var(--revka-text-secondary)",margin:0},children:["This will create a new published revision with revision r",n.number,"'s content. Other tabs viewing this workflow will auto-update."]}),a?c.jsx("div",{role:"alert",style:{padding:"8px 10px",borderRadius:8,background:"color-mix(in srgb, var(--revka-status-danger) 14%, transparent)",border:"1px solid var(--revka-status-danger)",color:"var(--revka-status-danger)",fontSize:11.5},children:a}):null]}),c.jsxs("div",{style:{padding:"12px 16px",borderTop:"1px solid var(--revka-border-soft)",display:"flex",alignItems:"center",justifyContent:"flex-end",gap:8},children:[c.jsx("button",{type:"button",onClick:()=>{s||r()},disabled:s,className:"revka-button",children:"Cancel"}),c.jsxs("button",{type:"button",onClick:()=>{i()},disabled:s,className:"revka-button","data-variant":"primary",style:{display:"inline-flex",alignItems:"center",gap:6,background:"color-mix(in srgb, var(--revka-status-warning) 80%, transparent)",borderColor:"var(--revka-status-warning)",color:"var(--revka-text-primary)"},children:[s&&c.jsx(Rr,{size:13,className:"animate-spin"}),s?"Reverting…":"Revert"]})]})]})});return na.createPortal(u,document.body)}function lEe({workflowKref:e,onRepublished:n}){const[r,i]=b.useState([]),[s,a]=b.useState(null),[o,l]=b.useState(null),[u,d]=b.useState(!1),[p,f]=b.useState(null),g=b.useRef(null),_=b.useRef(!1),x=b.useCallback(async()=>{if(g.current)return _.current=!0,g.current;const C=(async()=>{try{const T=await JQ(e);i(T.revisions??[]),a(null)}catch(T){const A=T instanceof ql?T.message.replace(/^API \d+: /,"")||"Failed to load revisions":T instanceof Error?T.message:"Failed to load revisions";a(A)}})();g.current=C;try{await C}finally{g.current=null,_.current&&(_.current=!1,x())}},[e]);b.useEffect(()=>{i([]),a(null),x()},[x]),nEe({workflowKref:e,onChange:()=>{x()}});const v=b.useCallback(C=>{D6(C)||(f(null),l(C))},[]),S=b.useCallback(()=>{u||(l(null),f(null))},[u]),w=b.useCallback(async()=>{if(o){d(!0),f(null);try{const C=await eZ(o.kref);l(null),x(),n==null||n(C.revision_kref)}catch(C){const T=C instanceof ql?C.message.replace(/^API \d+: /,"")||"Republish failed":C instanceof Error?C.message:"Republish failed";console.error("[RevisionHistoryStrip] republish failed:",C),f(T)}finally{d(!1)}}},[o,x,n]),N=b.useMemo(()=>{const C=[...r];return C.sort((T,A)=>A.number-T.number),C},[r]);return c.jsxs(c.Fragment,{children:[c.jsxs("div",{role:"region","aria-label":"Workflow revisions",style:{position:"relative",height:36,display:"flex",alignItems:"center",gap:10,padding:"0 12px",borderTop:"1px solid var(--pc-border)",borderBottom:"1px solid var(--pc-border)",background:"var(--pc-bg-elevated)",flexShrink:0},children:[c.jsx("span",{className:"revka-kicker",style:{flexShrink:0},children:"Revisions"}),c.jsx("div",{className:"revka-rev-strip-scroller",style:{flex:1,minWidth:0,display:"flex",alignItems:"center",gap:6,overflowX:"auto",overflowY:"hidden",scrollbarWidth:"none"},children:s?c.jsx("span",{style:{fontSize:11,color:"var(--revka-status-danger)"},title:s,children:s}):N.length===0?c.jsx("span",{style:{fontSize:11,color:"var(--revka-text-faint)",fontStyle:"italic"},children:"No revisions yet"}):N.map(C=>{const T=D6(C),A=DU(C),E=[`r${C.number}`,aEe(C.created_at),A?`— ${A}`:null].filter(Boolean).join(" · ");return c.jsxs("button",{type:"button",onClick:()=>v(C),disabled:T,className:"revka-rev-capsule","data-live":T?"true":"false",title:E,style:{display:"inline-flex",alignItems:"center",gap:6,height:22,padding:"0 8px",borderRadius:999,fontSize:10.5,fontFamily:"var(--pc-font-mono, ui-monospace, monospace)",fontWeight:600,flexShrink:0,cursor:T?"default":"pointer",transition:"transform 120ms ease, background 120ms ease",border:T?"1px solid var(--pc-accent)":"1px solid var(--pc-border)",background:T?"var(--pc-accent-glow)":"transparent",color:T?"var(--pc-accent)":"var(--revka-text-muted)",animation:"revka-rev-capsule-in 240ms ease-out both"},children:[T?c.jsx("span",{"aria-hidden":!0,style:{display:"inline-block",width:6,height:6,borderRadius:999,background:"var(--revka-signal-selected)",boxShadow:"0 0 6px color-mix(in srgb, var(--revka-signal-selected) 60%, transparent)"}}):null,c.jsxs("span",{children:["r",C.number]}),c.jsx("span",{style:{color:T?"var(--pc-accent)":"var(--revka-text-faint)",fontWeight:500},children:sEe(C.created_at)})]},C.kref)})})]}),c.jsx(oEe,{open:o!==null,revision:o,onCancel:S,onConfirm:w,submitting:u,error:p}),c.jsx("style",{children:`
        .revka-rev-strip-scroller::-webkit-scrollbar {
          height: 0;
          background: transparent;
        }
        .revka-rev-strip-scroller:hover {
          scrollbar-width: thin;
        }
        .revka-rev-strip-scroller:hover::-webkit-scrollbar {
          height: 6px;
        }
        .revka-rev-strip-scroller:hover::-webkit-scrollbar-thumb {
          background: var(--pc-border);
          border-radius: 3px;
        }
        .revka-rev-capsule:not(:disabled):hover {
          transform: translateY(-1px);
          background: color-mix(in srgb, var(--pc-accent-glow) 35%, transparent);
          color: var(--revka-text-primary);
        }
        @keyframes revka-rev-capsule-in {
          from { opacity: 0; transform: translateY(2px); }
          to   { opacity: 1; transform: translateY(0); }
        }
      `})]})}function cEe(e){return e==="agent"}function uEe(e,n,r){return n!=="agent"||!cEe(r)?`\${${e}.output}`:[`Dependency handoff from ${e}:`,`- status: \${${e}.status}`,`- artifact_path: \${${e}.output_data.artifact_path}`,`- files_touched: \${${e}.files}`,"Read artifact_path when exact upstream context is needed. The artifact is the full output; this prompt only carries the reference."].join(`
`)}function dEe(e){return e.type==="workflow.revision.published"&&typeof e.workflow_kref=="string"&&typeof e.revision_kref=="string"}function hEe({workflowKref:e,onRevisionPublished:n}){const r=b.useRef(n);r.current=n;const i=b.useRef(e);i.current=e,b.useEffect(()=>{if(!e)return;const s=aE(),a=new pv;return a.onEvent=o=>{dEe(o)&&o.workflow_kref===i.current&&(o.originating_session&&o.originating_session===s||r.current(o))},a.connect(),()=>{a.disconnect()}},[e])}const fEe={...w2e,...j2e};function pEe(e){return c.jsx(CA,{children:c.jsx(GEe,{...e})})}const mEe={agent:"prompt",shell:"shellCommand",output:"outputTemplate",conditional:"condition",notify:"notifyMessage",email:"emailBody",python:"pythonCode"},PU=["prompt","shellCommand","pythonCode","pythonArgs","pythonScript","emailBody","emailBodyHtml","emailSubject","emailTo","emailCc","emailBcc","imagePrompt","outputTemplate","resolveArtifactName","condition","gotoCondition","humanInputMessage","humanApprovalMessage","notifyMessage","notifyTitle","groupChatTopic","supervisorTask","a2aUrl","a2aMessage","a2aCloudRunConfig","a2aCloudRunAudience","mapReduceTask","handoffReason"],P6=/\$\{([a-zA-Z_][a-zA-Z0-9_-]*)(?:\.[a-zA-Z_][a-zA-Z0-9_.-]*)?\}/g;function gEe(e,n){for(const r of PU){const i=e[r];if(typeof i!="string"||!i)continue;P6.lastIndex=0;let s;for(;(s=P6.exec(i))!==null;)if(s[1]===n)return!0}return!1}function vEe(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function yEe(e,n){if(!e)return e;const r=new RegExp(`\\$\\{${vEe(n)}(?:\\.[a-zA-Z_][a-zA-Z0-9_.-]*)?\\}`,"g");if(!r.test(e))return e;const i=e.includes(`\r
`)?`\r
`:`
`,s=e.split(/\r?\n/),a=[];for(const l of s){if(r.lastIndex=0,!r.test(l)){a.push(l);continue}r.lastIndex=0;const u=l.replace(r,"").replace(/[ \t]+$/g,"");u.trim().length>0&&a.push(u)}let o=a.join(i).replace(/(\r?\n){3,}/g,`${i}${i}`);for(;o.startsWith(i);)o=o.slice(i.length);for(;o.endsWith(i);)o=o.slice(0,-i.length);return o}function _Ee(e,n){let r=e;for(const i of PU){const s=r[i];if(typeof s!="string"||!s)continue;const a=yEe(s,n);a!==s&&(r={...r,[i]:a})}return r}function L6(e){const n=Date.parse(e);if(Number.isNaN(n))return e;const r=Math.max(0,Math.round((Date.now()-n)/1e3));if(r<5)return"just now";if(r<60)return`${r}s ago`;const i=Math.round(r/60);return i<60?`${i}m ago`:`${Math.round(i/60)}h ago`}function u2(e){var r;if(!Yh(e))return;if(e==="true"||e==="false")return e;const n=Number(((r=/^branch-(\d+)$/.exec(e??""))==null?void 0:r[1])??0);return n===0?"true":`case ${n+1}`}function LU(e){var r;if(((r=e.conditionalBranches)==null?void 0:r.length)>0)return e.conditionalBranches.map(i=>({...i}));const n=[];return(e.condition||e.onTrueValue)&&n.push({condition:e.condition||"",goto:"",value:e.onTrueValue||void 0}),e.onFalseValue&&n.push({condition:"default",goto:"",value:e.onFalseValue}),n.length>0?n:[{condition:e.condition||"",goto:"",value:e.onTrueValue||void 0},{condition:"default",goto:"",value:e.onFalseValue||void 0}]}function Ax(e){const n=e.find(i=>i.condition.trim()!=="default"),r=e.find(i=>i.condition.trim()==="default")??e.find(i=>i!==n);return{conditionalBranches:e,condition:(n==null?void 0:n.condition)??"",onTrueValue:(n==null?void 0:n.value)??"",onFalseValue:(r==null?void 0:r.value)??""}}function xEe(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function bEe(e){return/[A-Za-z_]/.test(e)}function kEe(e){return/[A-Za-z0-9_-]/.test(e)}function wEe(e,n,r){if(!e.includes("${{"))return e;const i=n.replace(/-/g,"_"),s=r.replace(/-/g,"_"),a=new Set([n,i]);if(a.size===1&&a.has(s))return e;const o=l=>{let u="",d=null;for(let p=0;p<l.length;){const f=l[p];if(d){if(u+=f,f==="\\"&&p+1<l.length){u+=l[p+1],p+=2;continue}f===d&&(d=null),p+=1;continue}if(f==='"'||f==="'"){d=f,u+=f,p+=1;continue}if(!bEe(f)){u+=f,p+=1;continue}const g=p;for(p+=1;p<l.length&&kEe(l[p]);)p+=1;const _=l.slice(g,p),x=g>0?l[g-1]:"";let v=p;for(;v<l.length&&/\s/.test(l[v]);)v+=1;const S=(!x||!/[A-Za-z0-9_.]/.test(x))&&l[v]===".";u+=S&&a.has(_)?s:_}return u};return e.replace(/\$\{\{\s*([\s\S]*?)\s*\}\}/g,(l,u)=>{const d=o(u);return d===u?l:"${{ "+d+" }}"})}function LN(e,n,r){if(typeof e=="string"){const i=new RegExp(`\\$\\{${xEe(n)}(?=\\.|\\})`,"g");return wEe(e.replace(i,`\${${r}`),n,r)}if(Array.isArray(e))return e.map(i=>LN(i,n,r));if(e&&typeof e=="object"){const i={};for(const[s,a]of Object.entries(e))i[s]=LN(a,n,r);return i}return e}function IU(e,n,r){return LN(e,n,r)}function I6(e,n,r){const i=vv(n);if(i===null)return e;const s=LU(e);for(;s.length<=i;)s.push({condition:s.length===1?"default":"",goto:"",value:void 0});return s[i]={...s[i],goto:r},{...e,...Ax(s)}}function B6(e,n){return{label:e,taskId:e,name:e,description:"",type:"agent",agentHints:[],skills:[],compression:!1,assign:"",template:"",paramCount:0,dependencyCount:0,condition:"",onTrueValue:"",onFalseValue:"",conditionalBranches:[],channel:"",channels:[],agentType:"",role:"",prompt:"",timeout:300,agentMaxTurns:3,agentTools:"none",agentRequiredTools:[],agentOutputFields:[],agentQualityEnabled:!1,agentQualityThreshold:.7,agentQualityCriteria:[],agentQualityModel:"claude-haiku-4-5-20251001",parallelJoin:"all",gotoTarget:"",gotoMaxIterations:3,groupChatTopic:"",groupChatParticipants:[],groupChatMaxRounds:8,supervisorTask:"",supervisorMaxIterations:5,supervisorTemplates:[],shellCommand:"",outputFormat:"markdown",entityName:"",entityKind:"",entityTag:"",entitySpace:"",entityMetadata:{},entityMetadataTarget:"item",artifactSummaryModel:"",handoffFrom:"",handoffTo:"",handoffReason:"",retry:0,retryDelay:5,model:"",shellTimeout:60,shellAllowFailure:!1,gotoCondition:"",parallelMaxConcurrency:5,humanInputMessage:"",humanInputTimeout:3600,humanApprovalMessage:"",humanApprovalTimeout:3600,humanApprovalChannel:"dashboard",humanApprovalChannelId:"",humanApprovalOnRejectGoto:"",humanApprovalOnRejectMax:3,humanApprovalApproveKeywords:["approve","approved","yes","lgtm"],humanApprovalRejectKeywords:["reject","rejected","no"],outputTemplate:"",a2aUrl:"",a2aSkillId:"",a2aMessage:"",a2aTimeout:300,a2aCloudRunAuth:"",a2aCloudRunConfig:"",a2aCloudRunAudience:"",a2aCloudRunAuthTimeout:20,resolveKind:"",resolveTag:"published",resolveNamePattern:"",resolveSpace:"",resolveArtifactName:"",resolveMode:"latest",resolveFields:[],resolveMetadataSource:"revision",resolveFailIfMissing:!0,kumihoConfig:{},kumihoProject:"",kumihoMode:"graph_augmented_context",kumihoSeedBundles:[],kumihoSeedKrefs:[],kumihoSeedQueries:[],kumihoSeedItems:[],kumihoTraversalMaxDepth:2,kumihoTraversalDirection:"both",kumihoTraversalEdgeTypes:["DEPENDS_ON","REFERENCES","ADVANCES","UPDATES","CONTRADICTS"],kumihoFiltersIncludeKinds:[],kumihoFiltersExcludeTags:["deprecated"],kumihoFiltersMaxItems:50,kumihoRankingMethod:"hybrid",kumihoRankingSemanticQuery:"",kumihoLockTagPreference:["current","active","production-ready","ready","published","latest"],kumihoOutputFormat:"context_pack",kumihoOutputIncludeArtifactSummaries:!0,kumihoOutputIncludeArtifactContent:!1,kumihoOutputMaxArtifactCharsPerItem:3e3,kumihoOutputIncludeEdgeMap:!0,kumihoOutputIncludeConflictWarnings:!0,kumihoOutputIncludeMissingContext:!0,kumihoCreateIfMissing:!1,kumihoIdempotent:!0,kumihoFailIfMissingBundle:!0,kumihoFailIfMissingItem:!0,kumihoAllowProtected:!1,kumihoUpdates:[],kumihoPatchKref:"",kumihoDryRun:!0,kumihoAllowAutoApply:!1,kumihoApprovalRequired:!0,kumihoApprovalApproved:!1,kumihoApprovalApprovedBy:"",kumihoApprovalNote:"",kumihoApplyCreateRevisions:!0,kumihoApplyCreateEdges:!0,kumihoApplyUpdateTags:!0,kumihoApplyUntagPreviousCurrent:!0,kumihoApplyUpdateBundles:!0,kumihoApplySaveApplyReport:!0,kumihoNewRevisionTags:["current","approved"],kumihoPatchTagsRemove:["candidate"],kumihoPatchTagsAdd:["applied"],kumihoPendingPatchBundle:"",kumihoAppliedPatchBundle:"",kumihoCurrentStateBundle:"",kumihoActiveStorylineBundle:"",kumihoActiveForeshadowBundle:"",kumihoTimelineBundle:"",kumihoRequireEvidenceLocator:!0,kumihoSourceEpisodeKref:"",kumihoSourceContextPackKref:"",mapReduceTask:"",mapReduceSplits:[],mapReduceMapper:"claude",mapReduceReducer:"claude",mapReduceConcurrency:3,mapReduceTimeout:300,supervisorType:"claude",supervisorTimeout:300,groupChatModerator:"claude",groupChatStrategy:"moderator_selected",groupChatTimeout:120,handoffTask:"",handoffTimeout:300,forEachSteps:[],forEachRange:"",forEachItems:[],forEachVariable:"item",forEachCarryForward:!0,forEachFailFast:!0,forEachMaxIterations:20,notifyMessage:"",notifyTitle:"",notifyChannelId:"",pythonScript:"",pythonCode:"",pythonArgs:"",pythonInterpreter:"",pythonTimeout:60,pythonAllowFailure:!1,computeOutputs:{},emailTo:"",emailSubject:"",emailBody:"",emailBodyHtml:"",emailFrom:"",emailCc:"",emailBcc:"",emailReplyTo:"",emailTrackClicks:!1,emailTrackKref:"",emailTrackSecretEnv:"",emailTrackBaseUrl:"",emailSmtpHost:"",emailSmtpPort:0,emailSmtpTls:!0,emailSmtpUsername:"",emailSmtpPasswordEnv:"",emailDryRun:!1,emailTimeout:30,imagePrompt:"",imageCount:1,imageCanvas:!0,imageCanvasTarget:"",imageRegisterArtifact:!0,imageSpace:"",imageItemName:"",imageOutputPath:"",imageOutputPattern:"",imageInputImages:[],imageSandbox:"",imageCwd:"",imageTimeout:1200,tagItemKref:"",tagValue:"",tagUntag:"",deprecateItemKref:"",deprecateReason:"",manusPrompt:"",manusStructuredOutputSchema:"",manusConnectors:[],manusEnableSkills:[],manusForceSkills:[],manusAgentProfile:"",manusLocale:"",manusProjectId:"",manusTitle:"",manusTimeoutSeconds:600,manusPollIntervalSeconds:5,manusAllowFailure:!1,manusCredentialsRef:"",manusRegisterEnabled:!1,manusRegisterEntityName:"",manusRegisterEntityKind:"",manusRegisterEntityTag:"",manusRegisterEntitySpace:"",manusRegisterAttachments:!0,manusRegisterContentSource:"message",...n}}function z6(e){return e==="compute"?{type:e,computeOutputs:{value:"${{ 1 }}"}}:e==="kumiho_bundle_update"?{type:e,kumihoMode:"add_members",kumihoIdempotent:!0}:e==="kumiho_patch_apply"?{type:e,kumihoDryRun:!0,kumihoApprovalRequired:!0}:{type:e}}function SEe({runLog:e,onClose:n,onRefresh:r}){const i=e.detail,s=(i==null?void 0:i.status)||e.status,a=(i==null?void 0:i.steps)??[],o=a.find(p=>p.step_id===e.targetStepId),l=(o==null?void 0:o.output_preview)||YEe(o==null?void 0:o.output_data),u=(o==null?void 0:o.error)||(i==null?void 0:i.error)||e.error,d=!!(e.runId&&!i&&!e.error);return c.jsxs("div",{role:"dialog","aria-label":"Run to here log",style:{position:"fixed",right:20,bottom:20,zIndex:70,width:"min(440px, calc(100vw - 32px))",maxHeight:"min(560px, calc(100vh - 96px))",display:"flex",flexDirection:"column",overflow:"hidden",borderRadius:12,border:"1px solid var(--revka-border-strong)",background:"var(--revka-bg-panel-strong)",boxShadow:"0 18px 48px rgba(0,0,0,0.42)"},children:[c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"12px 14px",borderBottom:"1px solid var(--revka-border-soft)"},children:[c.jsx(cE,{size:14,style:{color:"var(--revka-signal-network)"}}),c.jsxs("div",{style:{minWidth:0,flex:1},children:[c.jsx("div",{style:{fontSize:12,fontWeight:700,color:"var(--revka-text-primary)"},children:"Run to here"}),c.jsxs("div",{style:{fontSize:10,color:"var(--revka-text-faint)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[e.workflowName," · ",e.targetStepId]})]}),c.jsx("span",{style:{flexShrink:0,padding:"3px 8px",borderRadius:999,border:"1px solid color-mix(in srgb, currentColor 38%, transparent)",color:W6(s),fontSize:10,fontWeight:700,textTransform:"uppercase",letterSpacing:"0.08em"},children:s}),c.jsx("button",{type:"button",onClick:()=>void r(),disabled:!e.runId,className:"revka-button",title:"Refresh run log","aria-label":"Refresh run log",style:{width:28,height:28,padding:0,justifyContent:"center",opacity:e.runId?1:.45},children:c.jsx($r,{size:13})}),c.jsx("button",{type:"button",onClick:n,className:"revka-button",title:"Close run log","aria-label":"Close run log",style:{width:28,height:28,padding:0,justifyContent:"center"},children:c.jsx(mi,{size:13})})]}),c.jsxs("div",{style:{overflowY:"auto",padding:14,display:"flex",flexDirection:"column",gap:12},children:[c.jsxs("div",{style:{display:"grid",gridTemplateColumns:"80px minmax(0, 1fr)",rowGap:5,columnGap:10,fontSize:11},children:[c.jsx("span",{style:{color:"var(--revka-text-faint)"},children:"Run ID"}),c.jsx("span",{style:{color:"var(--revka-text-secondary)",fontFamily:"var(--pc-font-mono, ui-monospace, monospace)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.runId||"Starting..."}),c.jsx("span",{style:{color:"var(--revka-text-faint)"},children:"Started"}),c.jsx("span",{style:{color:"var(--revka-text-secondary)"},children:KEe((i==null?void 0:i.started_at)||e.startedAt)}),c.jsx("span",{style:{color:"var(--revka-text-faint)"},children:"Progress"}),c.jsx("span",{style:{color:"var(--revka-text-secondary)"},children:i?`${i.steps_completed||"0"} / ${i.steps_total||a.length||"?"}`:"Waiting for run details"})]}),u?c.jsx("div",{style:{padding:10,borderRadius:10,border:"1px solid color-mix(in srgb, var(--revka-status-danger) 34%, transparent)",background:"color-mix(in srgb, var(--revka-status-danger) 10%, transparent)",color:"var(--revka-status-danger)",fontSize:11,whiteSpace:"pre-wrap"},children:u}):null,c.jsxs("div",{children:[c.jsx("div",{className:"revka-kicker",style:{marginBottom:8},children:"Target Output"}),l?c.jsx("pre",{style:{margin:0,maxHeight:180,overflow:"auto",padding:10,borderRadius:10,border:"1px solid var(--revka-border-soft)",background:"var(--pc-bg-code)",color:"var(--revka-text-secondary)",fontFamily:"var(--pc-font-mono, ui-monospace, monospace)",fontSize:11,lineHeight:1.55,whiteSpace:"pre-wrap"},children:l}):c.jsx("div",{style:{fontSize:11,color:"var(--revka-text-faint)"},children:d?"Waiting for the run log...":o?"The target step has not produced output yet.":"The target step has not appeared in the run log yet."})]}),c.jsxs("div",{children:[c.jsx("div",{className:"revka-kicker",style:{marginBottom:8},children:"Steps"}),a.length>0?c.jsx("div",{style:{display:"flex",flexDirection:"column",gap:6},children:a.map(p=>c.jsxs("div",{style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr) auto",alignItems:"center",gap:8,padding:"7px 9px",borderRadius:8,border:p.step_id===e.targetStepId?"1px solid color-mix(in srgb, var(--revka-signal-network) 48%, transparent)":"1px solid var(--revka-border-soft)",background:p.step_id===e.targetStepId?"color-mix(in srgb, var(--revka-signal-network) 10%, transparent)":"var(--revka-bg-surface)"},children:[c.jsx("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:"var(--revka-text-primary)",fontSize:11,fontFamily:"var(--pc-font-mono, ui-monospace, monospace)"},children:p.step_id}),c.jsx("span",{style:{color:W6(p.status),fontSize:10,fontWeight:700,textTransform:"uppercase",letterSpacing:"0.08em"},children:p.status||"pending"})]},p.step_id))}):c.jsx("div",{style:{fontSize:11,color:"var(--revka-text-faint)"},children:e.error||"No step log entries yet."})]})]})]})}const BU="revka.workflowEditor.wireStyle",zU="revka.workflowEditor.yamlPanelWidth",$U="revka.workflowEditor.detailsPanelWidth",CEe=320,jEe=760,d2=440,NEe=300,EEe=620,h2=352,$6=36,AEe=80,TEe=120,FU=[{value:"default",label:"Curved",title:"Curved Bezier wires"},{value:"straight",label:"Straight",title:"Direct straight wires"},{value:"step",label:"Angled",title:"Right-angle stepped wires"}],MEe={default:Ha.Bezier,straight:Ha.Straight,step:Ha.Step};function REe(){if(typeof localStorage>"u")return"default";try{const e=localStorage.getItem(BU);return FU.some(n=>n.value===e)?e:"default"}catch{return"default"}}function Tx(e,n){return e.type===n?e:{...e,type:n}}function Th(e,n){return e.map(r=>Tx(r,n))}function F6(e){return e.type!=="select"&&e.type!=="dimensions"}function OEe(e){if(!e||typeof e!="object")return!1;const n=e;return Number.isFinite(n.x)&&Number.isFinite(n.y)}function DEe(e,n,r){return eA(e)?n:qq(n,r)}function PEe(e,n,r){if(eA(n)||!e||typeof localStorage>"u")return r;try{const i=JSON.parse(localStorage.getItem(`wf-positions:${e}`)||"{}");return Object.keys(i).length===0?r:r.map(s=>{const a=i[s.id];return OEe(a)?{...s,position:{x:a.x,y:a.y}}:s})}catch{return r}}function Pm(e,n,r,i){return PEe(e,n,DEe(n,r,i))}function LEe(e,n,r){const i=Bo(e),s=Kh(e),{nodes:a,edges:o}=ad(i),l=Pm(r,i,a,o);return Gu(jo(l,o),{...s,...n})}function HU(e){return Math.max(NEe,Math.min(EEe,Math.round(e)))}function WU(e){return Math.max(CEe,Math.min(jEe,Math.round(e)))}function IEe(){if(typeof localStorage>"u")return d2;try{const e=Number(localStorage.getItem(zU));return Number.isFinite(e)?WU(e):d2}catch{return d2}}function BEe(){if(typeof localStorage>"u")return h2;try{const e=Number(localStorage.getItem($U));return Number.isFinite(e)?HU(e):h2}catch{return h2}}function zEe(e){return e&&typeof e=="object"?e:{}}function qU(e){var a,o;const n=zEe(e),r=typeof((a=n.mark)==null?void 0:a.line)=="number"?n.mark.line+1:void 0,i=typeof((o=n.mark)==null?void 0:o.column)=="number"?n.mark.column+1:void 0,s=n.reason||n.message||(e instanceof Error?e.message:String(e));return{status:"invalid",message:r?`YAML syntax error at ${r}:${i??1}`:"YAML syntax error",detail:s,line:r,column:i}}function UU(e){if(!e.trim())return{status:"empty",message:"No YAML",detail:"The editor is empty."};try{const n=Bo(e);return n.length===0?{status:"invalid",message:"Valid YAML, but no workflow steps were found",detail:"Add a top-level steps list before applying this YAML to the graph."}:{status:"valid",message:`Valid YAML · ${n.length} ${n.length===1?"step":"steps"}`,taskCount:n.length}}catch(n){return qU(n)}}const $Ee=eSe(e=>{const n=UU(e.state.doc.toString());if(n.status==="valid"||n.status==="empty")return[];const r=Math.min(Math.max(n.line??1,1),e.state.doc.lines),i=e.state.doc.line(r),s=Math.max((n.column??1)-1,0),a=Math.min(i.to,i.from+s),o=Math.max(a,Math.min(i.to,a+1));return[{from:a,to:o,severity:"error",message:n.detail?`${n.message}: ${n.detail}`:n.message}]}),FEe=[m2e(),cSe(),$Ee];function HEe(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"step"}function WEe(e,n){const r=new Set(n),i=HEe(`${e}-copy`);if(!r.has(i))return i;let s=2;for(;r.has(`${i}-${s}`);)s+=1;return`${i}-${s}`}function VU(e){return JSON.parse(JSON.stringify(e))}function qEe(e,n){let r=e;for(const[i,s]of n)i!==s&&(r=IU(r,i,s));return r}function UEe(e,n,r=new Map){var o;const i=qEe(VU(e),r),s=(o=e.name)!=null&&o.trim()?`${e.name.trim()} Copy`:n,a=l=>l?r.get(l)??"":"";return{...i,taskId:n,label:s,name:s,dependencyCount:0,conditionalBranches:(i.conditionalBranches||[]).map(l=>({...l,goto:a(l.goto)})),gotoTarget:a(i.gotoTarget),humanApprovalOnRejectGoto:a(i.humanApprovalOnRejectGoto),forEachSteps:(i.forEachSteps||[]).map(l=>r.get(l)).filter(l=>!!l)}}function VEe(e,n){const r=new Map;for(const i of n)Yh(i.sourceHandle)||r.set(i.target,(r.get(i.target)||0)+1);return e.map(i=>{const s=r.get(i.id)||0,a=i.data;return a.dependencyCount===s?i:{...i,data:{...a,dependencyCount:s}}})}function H6(e){return e?["completed","failed","cancelled","canceled","error","success"].includes(e.toLowerCase()):!1}function W6(e){const n=(e||"").toLowerCase();return["completed","success"].includes(n)?"var(--revka-signal-selected)":["failed","error","cancelled","canceled"].includes(n)?"var(--revka-status-danger)":["running","starting","queued","pending"].includes(n)?"var(--revka-signal-live)":"var(--revka-text-faint)"}function KEe(e){if(!e)return"";const n=new Date(e);return Number.isNaN(n.getTime())?e:n.toLocaleString()}function YEe(e){if(e==null)return null;try{const n=JSON.stringify(e,null,2);return n.length>1800?`${n.slice(0,1800)}
…`:n}catch{return null}}function GEe({workflow:e,onSave:n,onCancel:r,saving:i,mode:s,containerClassName:a}){const o=s??(e?"edit":"create"),l=typeof navigator<"u"&&/mac/i.test(navigator.platform),[u,d]=b.useState((e==null?void 0:e.name)??""),[p,f]=b.useState((e==null?void 0:e.description)??""),[g,_]=b.useState(e!=null&&e.tags?[...e.tags]:[]),[x,v]=b.useState(""),[S,w]=b.useState(null),[N,C]=b.useState(null),[T,A]=b.useState(!1),[E,D]=b.useState((e==null?void 0:e.definition)??""),[F,B]=b.useState(!1),[H,$]=b.useState(IEe),[z,W]=b.useState(!1),[P,q]=b.useState(REe),[I,Q]=b.useState(BEe),[K,Z]=b.useState(!1),Y=b.useRef(null),R=b.useRef(null),U=b.useRef(null),[V,ie]=b.useState(!1),te=b.useRef(0),[X,se]=b.useState(null),re=b.useMemo(()=>UU(E),[E]),[de,ue]=b.useState({name:"",version:"1.0",description:"",tags:[],triggers:[],inputs:[],outputs:[],defaultCwd:"",defaultTimeout:300,maxTotalTime:3600,checkpoint:!0}),[ae,pe]=b.useState(null),[J,me]=b.useState(!1),[fe,ve]=b.useState(!1),[Ke,ge]=b.useState(void 0),[Ue,$e]=b.useState(void 0),[Bt,ct]=b.useState(null),[Mt,Tt]=b.useState(null),[Dt,Re]=b.useState(null),{agents:et}=jA(),bt=b.useRef(0),yt=b.useRef(null),O=b.useRef(!1),{screenToFlowPosition:ke,fitView:Le}=A0(),ye=b.useRef(null),_e=b.useRef(null),Pe=b.useRef(null),ee=b.useRef(null),le=b.useRef(""),je=b.useRef(!0),[Te,Me]=b.useState(!1),Ne=b.useCallback(()=>{je.current||Me(!0)},[]),{initialNodes:Ee,initialEdges:rt}=b.useMemo(()=>{if(!(e!=null&&e.definition))return{initialNodes:[],initialEdges:[]};const oe=Bo(e.definition),Se=Kh(e.definition);ue(Se);const{nodes:Fe,edges:Ve}=ad(oe),at=Pm(e.name,oe,Fe,Ve);return bt.current=oe.length,{initialNodes:at,initialEdges:Th(Ve,P)}},[e]),[Ye,it,kt]=hye(Ee),[mt,zt,xe]=fye(rt),qe=b.useCallback(oe=>{Ne(),it(oe)},[Ne,it]),dt=b.useCallback(oe=>{Ne(),zt(oe)},[Ne,zt]),sn=b.useCallback(oe=>{oe.some(F6)&&Ne(),kt(oe)},[Ne,kt]),nn=b.useCallback(oe=>{oe.some(F6)&&Ne(),xe(oe)},[Ne,xe]),Kt=b.useMemo(()=>MF(VEe(Ye,mt),et),[Ye,mt,et]),rr=Kt.length>AEe||mt.length>TEe,yi=b.useMemo(()=>mt.some(oe=>oe.animated)?mt.map(oe=>oe.animated===!1?oe:{...oe,animated:!1}):mt,[mt]);b.useEffect(()=>{try{localStorage.setItem(BU,P)}catch{}zt(oe=>Th(oe,P))},[P,zt]);const un=b.useMemo(()=>ae?Kt.find(oe=>oe.id===ae)??null:null,[ae,Kt]),Yt=b.useMemo(()=>{const oe=Kt.filter(Se=>Se.selected);return oe.length>0?oe:un?[un]:[]},[Kt,un]),L=b.useMemo(()=>{const oe=Kt.map(ht=>ht.data.taskId).filter(ht=>!!ht),Se=de.inputs.map(ht=>ht.name).filter(Boolean),Fe=["entity_kref","kind","tag","name","metadata"],Ve=new Set;for(const ht of de.triggers)for(const Nt of Object.keys(ht.inputMap||{}))Nt&&!Nt.startsWith("__")&&Ve.add(Nt);const at=Array.from(new Set([...Fe,...Ve]));return{stepIds:oe,workflowInputs:Se,triggerFields:at}},[Kt,de.inputs,de.triggers]),Qe=b.useCallback(()=>{const oe=ye.current;if(!oe)return{x:200,y:200};const Se=oe.getBoundingClientRect();return ke({x:Se.left+Se.width/2,y:Se.top+Se.height/2})},[ke]),_t=b.useCallback((oe,Se)=>{const Fe=ke({x:oe,y:Se});return _e.current=Fe,Fe},[ke]),Gt=b.useCallback((oe,Se)=>{ee.current={clientX:oe,clientY:Se},Pe.current===null&&(Pe.current=window.requestAnimationFrame(()=>{Pe.current=null;const Fe=ee.current;ee.current=null,Fe&&_t(Fe.clientX,Fe.clientY)}))},[_t]);b.useEffect(()=>()=>{Pe.current!==null&&(window.cancelAnimationFrame(Pe.current),Pe.current=null)},[]),b.useEffect(()=>{try{localStorage.setItem(zU,String(H))}catch{}},[H]),b.useEffect(()=>{try{localStorage.setItem($U,String(I))}catch{}},[I]);const jr=b.useCallback(oe=>{oe.preventDefault(),Y.current={startX:oe.clientX,startWidth:H},W(!0)},[H]),Qr=b.useCallback(oe=>{oe.preventDefault(),R.current={startX:oe.clientX,startWidth:I},Z(!0)},[I]);b.useEffect(()=>{if(!z)return;const oe=Fe=>{const Ve=Y.current;if(!Ve)return;const at=Fe.clientX-Ve.startX;$(WU(Ve.startWidth+at))},Se=()=>{Y.current=null,W(!1)};return window.addEventListener("mousemove",oe),window.addEventListener("mouseup",Se),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{window.removeEventListener("mousemove",oe),window.removeEventListener("mouseup",Se),document.body.style.cursor="",document.body.style.userSelect=""}},[z]),b.useEffect(()=>{if(!K)return;const oe=Fe=>{const Ve=R.current;if(!Ve)return;const at=Fe.clientX-Ve.startX;Q(HU(Ve.startWidth-at))},Se=()=>{R.current=null,Z(!1)};return window.addEventListener("mousemove",oe),window.addEventListener("mouseup",Se),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{window.removeEventListener("mousemove",oe),window.removeEventListener("mouseup",Se),document.body.style.cursor="",document.body.style.userSelect=""}},[K]);const oo=b.useCallback(()=>{if(Yt.length===0)return;const oe=new Set(Yt.map(Fe=>Fe.id)),Se=Yt.reduce((Fe,Ve)=>({x:Math.min(Fe.x,Ve.position.x),y:Math.min(Fe.y,Ve.position.y)}),{x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY});U.current={nodes:Yt.map(Fe=>({id:Fe.id,data:VU(Fe.data),nodeType:Fe.type,position:{...Fe.position}})),edges:mt.filter(Fe=>oe.has(Fe.source)&&oe.has(Fe.target)).map(Fe=>({...Fe})),origin:Se},te.current=0,ie(!0)},[mt,Yt]),cs=b.useCallback(oe=>{var wn;const Se=U.current;if(!Se||Se.nodes.length===0)return;te.current+=1;const Fe=new Set(Kt.map(qt=>qt.data.taskId||qt.id)),Ve=new Map;for(const qt of Se.nodes){const On=qt.data.taskId||qt.id||qt.data.name||"step",yn=WEe(On,Fe);Fe.add(yn),Ve.set(qt.id,yn),qt.data.taskId&&Ve.set(qt.data.taskId,yn)}const at=oe?null:_e.current,ht=$6*Math.max(0,te.current-1),Nt=$6*te.current,dn=oe??(at?{x:at.x+ht,y:at.y+ht}:{x:Se.origin.x+Nt,y:Se.origin.y+Nt}),An={x:dn.x-Se.origin.x,y:dn.y-Se.origin.y},rn=Se.nodes.map(qt=>{const On=Ve.get(qt.id),yn=UEe(qt.data,On,Ve),Nr=yn.type==="conditional"?"gateNode":qt.nodeType||"taskNode";return{id:On,type:Nr,position:{x:qt.position.x+An.x,y:qt.position.y+An.y},data:yn,selected:!0}}),Ht=Se.edges.map(qt=>{const On=Ve.get(qt.source),yn=Ve.get(qt.target);if(!On||!yn)return null;const Nr=qt.sourceHandle??null,Gn=Yh(Nr)?Zw(Nr):hi.default,xi=Gn.stroke,fo=u2(Nr),po={...qt,id:`${On}->${Nr?Nr+"->":""}${yn}`,source:On,target:yn,type:P,animated:!1,selectable:!0,interactionWidth:20,style:Gn,markerEnd:{type:za.ArrowClosed,color:xi},...fo?{label:fo,labelStyle:{fill:xi,fontSize:10,fontWeight:600}}:{label:void 0,labelStyle:void 0}};return Tx(po,P)}).filter(qt=>qt!==null);qe(qt=>[...qt.map(On=>({...On,selected:!1})),...rn]),Ht.length>0&&dt(qt=>[...qt,...Ht]),pe(((wn=rn[rn.length-1])==null?void 0:wn.id)??null),Tt(null)},[Kt,dt,qe,P]),rl=b.useCallback(()=>{const oe=`wf-positions:${u}`,Se={};for(const Fe of Ye)Se[Fe.id]=Fe.position;try{localStorage.setItem(oe,JSON.stringify(Se))}catch{}},[Ye,u]),us=b.useCallback(oe=>{var An,rn;const Se=`step-${++bt.current}`,Fe=oe.type==="conditional",Ve=oe.position??(()=>{const Ht=Qe();return{x:Ht.x-110,y:Ht.y-40}})(),at=B6(Se,z6(oe.type));oe.presetSkill&&!at.skills.includes(oe.presetSkill)&&(at.skills=[...at.skills,oe.presetSkill]);const ht={id:Se,type:Fe?"gateNode":"taskNode",position:Ve,data:at};let Nt=null,dn=null;if((An=oe.source)!=null&&An.taskId){const Ht=oe.source.handle??null,wn=Yh(Ht),qt=wn?Zw(Ht):hi.default,On=qt.stroke,yn=u2(Ht);wn&&(dn=Ht),Nt={id:`${oe.source.taskId}->${Ht?Ht+"->":""}${Se}`,source:oe.source.taskId,target:Se,sourceHandle:Ht,type:P,animated:!1,selectable:!0,interactionWidth:20,style:qt,markerEnd:{type:za.ArrowClosed,color:On},...yn?{label:yn,labelStyle:{fill:On,fontSize:10,fontWeight:600}}:{}}}else if((rn=oe.target)!=null&&rn.taskId){const Ht=hi.default,wn=Ht.stroke;Nt={id:`${Se}->${oe.target.taskId}`,source:Se,target:oe.target.taskId,sourceHandle:null,type:P,animated:!1,selectable:!0,interactionWidth:20,style:Ht,markerEnd:{type:za.ArrowClosed,color:wn}}}qe(Ht=>[...Nt&&dn?Ht.map(qt=>qt.id===Nt.source?{...qt,data:I6(qt.data,dn,Se)}:qt):Ht,ht]),Nt&&dt(Ht=>[...Ht,Tx(Nt,P)]),pe(Se),oe.type==="agent"&&requestAnimationFrame(()=>{const Ht=document.querySelector(`.react-flow__node[data-id="${Se}"] button[title^="No pool agent"], .react-flow__node[data-id="${Se}"] button[title^="Assigned"]`),wn=(Ht==null?void 0:Ht.getBoundingClientRect())??null;wn?fT({taskId:Se,anchorRect:wn}):Re({taskId:Se,anchorRect:null,target:"assign"})})},[Qe,qe,dt,P]);b.useEffect(()=>{const oe=Se=>{const Fe=Se;Fe.detail&&us(Fe.detail)};return window.addEventListener(wN,oe),()=>window.removeEventListener(wN,oe)},[us]),b.useEffect(()=>{const oe=Se=>{const Fe=Se;Fe.detail&&Re({taskId:Fe.detail.taskId,anchorRect:Fe.detail.anchorRect,target:Fe.detail.target??"assign",participantIndex:Fe.detail.participantIndex})};return window.addEventListener(SN,oe),()=>window.removeEventListener(SN,oe)},[]),b.useEffect(()=>{if(je.current=!0,Me(!1),!(e!=null&&e.definition)){le.current="";return}try{const oe=LEe(e.definition,{name:e.name,description:e.description},e.name);le.current=oe}catch{le.current=e.definition}},[e==null?void 0:e.kref,e==null?void 0:e.definition,e==null?void 0:e.name,e==null?void 0:e.description]),b.useEffect(()=>{if(je.current){je.current=!1;return}Me(!0)},[de,u,p,g]);const[Ri,Ki]=b.useState(null),[Fr,Kn]=b.useState(null);b.useEffect(()=>{if(!Fr)return;const oe=Math.max(0,Fr.expiresAt-Date.now()),Se=setTimeout(()=>Kn(null),oe);return()=>clearTimeout(Se)},[Fr]);const il=b.useRef(()=>{});b.useEffect(()=>{const oe=Se=>{const Fe=Se.target,Ve=Fe&&(Fe.tagName==="INPUT"||Fe.tagName==="TEXTAREA"||Fe.tagName==="SELECT"||Fe.isContentEditable),at=l?Se.metaKey:Se.ctrlKey;if(at&&Se.key.toLowerCase()==="j"){Se.preventDefault(),ve(Nt=>!Nt);return}if(!Ve){if(at&&Se.key.toLowerCase()==="c"&&Yt.length>0){Se.preventDefault(),oo();return}if(at&&Se.key.toLowerCase()==="v"&&V){Se.preventDefault(),cs();return}at&&Se.key.toLowerCase()==="k"?(Se.preventDefault(),$e(void 0),ct(null),me(!0)):at&&Se.key.toLowerCase()==="i"&&(Se.preventDefault(),il.current())}};return window.addEventListener("keydown",oe),()=>window.removeEventListener("keydown",oe)},[l,Yt.length,oo,V,cs]);const tc=b.useCallback(oe=>{if(O.current=!0,!oe.source||!oe.target||mt.some(Ht=>Ht.source===oe.source&&Ht.target===oe.target&&Ht.sourceHandle===(oe.sourceHandle??null)))return;const Fe=oe.sourceHandle??null,Ve=Yh(Fe),at=Ve?Zw(Fe):hi.default,ht=at.stroke,Nt=u2(Fe),dn={id:`${oe.source}->${Fe?Fe+"->":""}${oe.target}`,source:oe.source,sourceHandle:oe.sourceHandle,target:oe.target,type:P,animated:!1,selectable:!0,interactionWidth:20,style:at,markerEnd:{type:za.ArrowClosed,color:ht},...Nt?{label:Nt,labelStyle:{fill:ht,fontSize:10,fontWeight:600}}:{}};dt(Ht=>[...Ht,Tx(dn,P)]);const An=oe.source,rn=oe.target;qe(Ht=>Ht.map(wn=>{var yn;if(Ve&&wn.id===An)return{...wn,data:I6(wn.data,Fe,rn)};if(wn.id!==rn)return wn;const qt=wn.data;let On=qt;if(An!==rn&&!Ve){const Nr=mEe[On.type];if(Nr&&!gEe(On,An)){const Gn=Ht.find(ku=>ku.id===An),xi=(yn=Gn==null?void 0:Gn.data)==null?void 0:yn.type,fo=On[Nr]??"",po=uEe(An,On.type,xi),bu=fo.length===0?po:`${fo}

${po}`;On={...On,[Nr]:bu}}}return On===qt?wn:{...wn,data:On}}))},[mt,dt,qe,P]),Rs=b.useCallback((oe,Se)=>{O.current=!1,Se.nodeId&&Se.handleType&&(yt.current={nodeId:Se.nodeId,handleType:Se.handleType,handleId:Se.handleId||null})},[]),ra=b.useCallback(oe=>{var dn;const Se=yt.current;if(yt.current=null,!Se||O.current)return;const Fe=oe.target;if(Fe!=null&&Fe.closest(".react-flow__node")||Fe!=null&&Fe.closest(".react-flow__handle"))return;const Ve="changedTouches"in oe?(dn=oe.changedTouches)==null?void 0:dn[0]:null,at=Ve?Ve.clientX:oe.clientX,ht=Ve?Ve.clientY:oe.clientY,Nt=_t(at,ht);if(Se.handleType==="source")$e({position:Nt,source:{taskId:Se.nodeId,handle:Se.handleId}});else if(Se.handleType==="target")$e({position:Nt,target:{taskId:Se.nodeId}});else return;ct(null),me(!0)},[_t]),_u=b.useCallback(oe=>{var at;const Se=new Map,Fe=new Map,Ve=[];for(const ht of oe){const Nt=vv(ht.sourceHandle);if(Nt!==null){const An=Se.get(ht.source)??new Set;An.add(Nt),Se.set(ht.source,An);continue}if((at=ht.data)!=null&&at.synthetic){Ve.push({source:ht.source,target:ht.target});continue}const dn=Fe.get(ht.target)??new Set;dn.add(ht.source),Fe.set(ht.target,dn)}qe(ht=>ht.map(Nt=>{const dn=Se.get(Nt.id),An=Fe.get(Nt.id);let rn=Nt.data;if(dn&&dn.size>0){let Ht=LU(rn);Ht=Ht.map((wn,qt)=>dn.has(qt)?{...wn,goto:""}:wn),rn={...rn,...Ax(Ht)}}if(An&&An.size>0)for(const Ht of An)rn=_Ee(rn,Ht);if(Ve.length>0&&rn.type==="for_each"&&rn.forEachSteps.length>0){let Ht=rn.forEachSteps;for(const wn of Ve){const qt=Ht.indexOf(wn.target);if(qt<0)continue;const On=wn.source===Nt.id&&qt===0,yn=qt>0&&Ht[qt-1]===wn.source;!On&&!yn||(Ht=Ht.filter((Nr,Gn)=>Gn!==qt))}Ht!==rn.forEachSteps&&(rn={...rn,forEachSteps:Ht})}return rn===Nt.data?Nt:{...Nt,data:rn}}))},[qe]),sl=b.useCallback((oe,Se)=>{pe(Se.id)},[]),Os=b.useCallback(()=>{pe(null),Tt(null)},[]),al=b.useCallback(oe=>{oe.preventDefault();const Se=oe.clientX,Fe=oe.clientY,Ve=_t(Se,Fe);Tt({screenX:Se,screenY:Fe,flowX:Ve.x,flowY:Ve.y})},[_t]),hr=b.useCallback((oe,Se)=>{qe(Fe=>Fe.map(Ve=>Ve.id===oe?{...Ve,data:{...Ve.data,...Se}}:Ve)),Se.conditionalBranches&&dt(Fe=>{const Ve=Fe.filter(ht=>!(ht.source===oe&&Yh(ht.sourceHandle))),at=Se.conditionalBranches.map((ht,Nt)=>{if(!ht.goto)return null;const dn=Zc(Nt),An=wf(ht,Nt),rn=_0(ht,Nt);return{id:`${oe}->${dn}->${ht.goto}`,source:oe,sourceHandle:dn,target:ht.goto,type:P,animated:!1,selectable:!0,interactionWidth:20,style:An,markerEnd:{type:za.ArrowClosed,color:An.stroke},label:rn,labelStyle:{fill:An.stroke,fontSize:10,fontWeight:600}}}).filter(ht=>ht!==null);return[...Ve,...Th(at,P)]})},[qe,dt,P]),Ds=b.useCallback((oe,Se)=>{oe!==Se&&(qe(Fe=>Fe.map(Ve=>{var An;const at=IU(Ve.data,oe,Se),ht=Ve.id===oe?{...Ve,id:Se,data:{...at,taskId:Se,label:at.label===oe?Se:at.label}}:{...Ve,data:at},Nt=ht.data;if(!((An=Nt.conditionalBranches)!=null&&An.some(rn=>rn.goto===oe)))return ht;const dn=Nt.conditionalBranches.map(rn=>rn.goto===oe?{...rn,goto:Se}:rn);return{...ht,data:{...Nt,...Ax(dn)}}})),dt(Fe=>Fe.map(Ve=>{const at={...Ve};let ht=!1;if(Ve.source===oe&&(at.source=Se,ht=!0),Ve.target===oe&&(at.target=Se,ht=!0),ht){const Nt=Ve.sourceHandle?`${Ve.sourceHandle}->`:"";at.id=`${at.source}->${Nt}${at.target}`}return at})),ae===oe&&pe(Se))},[qe,dt,ae]),Zr=b.useCallback(oe=>{qe(Se=>Se.filter(Fe=>Fe.id!==oe).map(Fe=>{var ht;const Ve=Fe.data;if(Ve.type!=="conditional"||!((ht=Ve.conditionalBranches)!=null&&ht.some(Nt=>Nt.goto===oe)))return Fe;const at=Ve.conditionalBranches.map(Nt=>Nt.goto===oe?{...Nt,goto:""}:Nt);return{...Fe,data:{...Ve,...Ax(at)}}})),dt(Se=>Se.filter(Fe=>Fe.source!==oe&&Fe.target!==oe)),ae===oe&&pe(null)},[qe,dt,ae]),ai=b.useCallback((oe,Se)=>{qe(Fe=>Fe.map(Ve=>{if(Ve.id!==oe)return Ve;const at=Ve.data,ht=B6(at.taskId,{...z6(Se),taskId:at.taskId,label:at.label,name:at.name,description:at.description,agentHints:at.agentHints,skills:at.skills,assign:at.assign,template:at.template,paramCount:at.paramCount,dependencyCount:at.dependencyCount,retry:at.retry,retryDelay:at.retryDelay,channels:at.channels,channel:at.channel});return{...Ve,type:Se==="conditional"?"gateNode":"taskNode",data:ht}}))},[qe]),lo=b.useCallback((oe,Se,Fe)=>{var at,ht;const Ve=(at=Ye.find(Nt=>Nt.id===oe))==null?void 0:at.data;if(Ve)switch(Se){case"assign":return Ve.assign||void 0;case"groupChatParticipant":return Fe===void 0?void 0:((ht=Ve.groupChatParticipants)==null?void 0:ht[Fe])||void 0;case"groupChatModerator":return Ve.groupChatModerator||void 0;case"supervisorAgent":return Ve.supervisorType||void 0;case"supervisorTemplate":return;case"handoffTo":return Ve.handoffTo||void 0;case"a2aSkill":return Ve.a2aSkillId||void 0;case"mapReduceMapper":return Ve.mapReduceMapper||void 0;case"mapReduceReducer":return Ve.mapReduceReducer||void 0}},[Ye]),xu=b.useCallback((oe,Se)=>{var at;const Fe=(at=Ye.find(ht=>ht.id===oe.taskId))==null?void 0:at.data,Ve=Se?et.find(ht=>ht.item_name===Se):void 0;if(Fe){if(oe.target==="assign"){if(Se===null){hr(oe.taskId,{assign:""});return}hr(oe.taskId,{assign:Se,agentType:(Ve==null?void 0:Ve.agent_type)||Fe.agentType||"claude",role:(Ve==null?void 0:Ve.role)||Fe.role||"coder"});return}if(oe.target==="groupChatParticipant"){const ht=[...Fe.groupChatParticipants||[]];oe.participantIndex===void 0?Se&&!ht.includes(Se)&&ht.push(Se):Se===null?ht.splice(oe.participantIndex,1):ht[oe.participantIndex]=Se,hr(oe.taskId,{groupChatParticipants:ht.filter(Boolean)});return}if(oe.target==="groupChatModerator"){hr(oe.taskId,{groupChatModerator:Se??"claude"});return}if(oe.target==="supervisorAgent"){hr(oe.taskId,{supervisorType:Se??"claude"});return}if(oe.target==="supervisorTemplate"){if(!Se)return;const ht=[...Fe.supervisorTemplates||[]];ht.includes(Se)||ht.push(Se),hr(oe.taskId,{supervisorTemplates:ht});return}if(oe.target==="handoffTo"){hr(oe.taskId,{handoffTo:Se??"codex"});return}if(oe.target==="a2aSkill"){hr(oe.taskId,{a2aSkillId:Se??""});return}if(oe.target==="mapReduceMapper"){hr(oe.taskId,{mapReduceMapper:Se??"claude"});return}oe.target==="mapReduceReducer"&&hr(oe.taskId,{mapReduceReducer:Se??"claude"})}},[hr,Ye,et]),_i=b.useCallback(oe=>{$e(oe?{position:oe}:void 0),ct(null),me(!0)},[]),co=b.useCallback(()=>{qe(oe=>qq([...oe],mt)),requestAnimationFrame(()=>{try{Le({padding:.2,duration:240})}catch{}})},[mt,qe,Le]),ce=b.useCallback(()=>{try{Le({padding:.2,duration:240})}catch{}},[Le]),Be=b.useCallback(()=>{if(re.status!=="valid"){w(re.detail?`${re.message}: ${re.detail}`:re.message);return}try{const oe=Bo(E);if(oe.length===0){w('No tasks found in YAML. Ensure the YAML has a "steps:" section.');return}const Se=Kh(E);ue(Se);const{nodes:Fe,edges:Ve}=ad(oe),at=Se.name||u,ht=Se.description||p,Nt=Pm(at,oe,Fe,Ve);qe(Nt),dt(Th(Ve,P)),d(at),f(ht),_(Se.tags),bt.current=oe.length,D(Gu(jo(Nt,Ve),{...Se,name:at,description:ht})),B(!1),A(!1),w(null)}catch(oe){const Se=qU(oe);w(Se.detail?`${Se.message}: ${Se.detail}`:Se.message)}},[E,re,u,p,qe,dt,P]),xt=b.useCallback(()=>{const oe=jo(Ye,mt);D(Gu(oe,{...de,name:u,description:p})),B(!1),A(!0)},[Ye,mt,de,u,p]);il.current=xt;const Ft=oe=>{if(oe.key==="Enter"||oe.key===","){oe.preventDefault();const Se=x.trim().toLowerCase();Se&&!g.includes(Se)&&_(Fe=>[...Fe,Se]),v("")}oe.key==="Backspace"&&x===""&&g.length>0&&_(Se=>Se.slice(0,-1))},Yn=b.useMemo(()=>{if(!fe)return le.current;const oe=jo(Ye,mt);return Gu(oe,{...de,name:u,description:p})},[fe,Ye,mt,de,u,p]),Oi=b.useMemo(()=>{const oe=jo(Ye,mt);return tde(oe)},[Ye,mt]),Di=Oi[0],tp=Di?Oi.length===1?Di.message:`${Di.message} (+${Oi.length-1} more)`:null,$d=b.useMemo(()=>N2e(Ye,mt),[Ye,mt]),uo=b.useCallback(async oe=>{try{const Se=await e0(oe.revision_kref),Fe=Se.definition??"",Ve=Bo(Fe),at=Kh(Fe),{nodes:ht,edges:Nt}=ad(Ve),dn=Se.name??oe.name,An=Se.description??"",rn=Pm(dn,Ve,ht,Nt),Ht=jo(rn,Nt),wn=jo(Kt,mt),qt=new Map(wn.map(Gn=>[Gn.id,JSON.stringify(Gn)])),On=new Set;for(const Gn of Ht){const xi=qt.get(Gn.id);(xi===void 0||xi!==JSON.stringify(Gn))&&On.add(Gn.id)}const yn=rn.map(Gn=>On.has(Gn.id)?{...Gn,data:{...Gn.data,justUpdated:!0}}:Gn),Nr=Gu(Ht,{...at,name:dn,description:An});le.current=Nr,je.current=!0,Me(!1),it(yn),zt(Th(Nt,P)),ue(at),d(dn),f(An),B(!1),bt.current=Ve.length,Ki(null),Kn({publishedAt:oe.published_at,expiresAt:Date.now()+4e3}),On.size>0&&setTimeout(()=>{it(Gn=>Gn.map(xi=>{const fo=xi.data;if(!fo.justUpdated)return xi;const{justUpdated:po,...bu}=fo;return{...xi,data:bu}}))},1200)}catch(Se){C(`Couldn't apply remote update: ${Se instanceof Error?Se.message:String(Se)}`)}},[Kt,mt,it,zt,P]),Lv=b.useRef(Te);Lv.current=Te;const np=b.useRef(uo);np.current=uo,hEe({workflowKref:(e==null?void 0:e.kref)??null,onRevisionPublished:b.useCallback(oe=>{Lv.current?Ki(oe):np.current(oe)},[])});const Iv=b.useCallback((oe,Se)=>{try{const Fe=Bo(oe),Ve=Kh(oe),{nodes:at,edges:ht}=ad(Fe),Nt=Ve.name||u,dn=Pm(Nt,Fe,at,ht);qe(dn),dt(Th(ht,P)),ue(Ve),Ve.name&&d(Ve.name),Ve.description&&f(Ve.description),B(!1),bt.current=Fe.length,w(null),Kn({publishedAt:Se||new Date().toISOString(),expiresAt:Date.now()+4e3})}catch(Fe){C(`Couldn't apply Architect proposal: ${Fe instanceof Error?Fe.message:String(Fe)}`)}},[u,qe,dt,P]),rp=b.useCallback(async()=>{if(w(null),C(null),!u.trim())return w("Workflow name is required.");if(!p.trim())return w("Workflow description is required.");if(Kt.length===0)return w("Add at least one step to the workflow.");if($d)return w("Cannot save: workflow has cycles.");if(F)return w("Apply the YAML changes to the graph before saving.");const oe=jo(Ye,mt),Se=Gu(oe,{...de,name:u.trim(),description:p.trim()});try{await n({name:u.trim(),description:p.trim(),definition:Se,version:de.version||"",tags:g}),le.current=Se,Me(!1),r()}catch(Fe){const Ve=Fe instanceof Error?Fe.message:"Save failed.";w(Ve)}},[u,p,g,Kt.length,Ye,mt,de,F,$d,n,r]);b.useEffect(()=>{if(T&&!F){const oe=jo(Ye,mt);D(Gu(oe,{...de,name:u,description:p}))}},[T,F,Ye,mt,de,u,p]);const ok=b.useCallback(oe=>{const Se=jo(Kt,mt);return fde(Se,oe)},[Kt,mt]),lk=b.useCallback(async oe=>{const Se=(e==null?void 0:e.name)??u;if(!Se){w('Save the workflow before using "Run to here".');return}se({open:!0,workflowName:Se,targetStepId:oe,status:"starting",startedAt:new Date().toISOString()});try{const Fe=await yB(Se,void 0,void 0,{targetStepId:oe});se(Ve=>({open:!0,workflowName:Fe.workflow||(Ve==null?void 0:Ve.workflowName)||Se,targetStepId:oe,status:Fe.status||"running",runId:Fe.run_id,startedAt:(Ve==null?void 0:Ve.startedAt)??new Date().toISOString(),detail:Ve==null?void 0:Ve.detail}))}catch(Fe){const Ve=Fe instanceof Error?Fe.message:"Run-to-here failed.";w(Ve),se(at=>({open:!0,workflowName:(at==null?void 0:at.workflowName)||Se,targetStepId:oe,status:"failed",startedAt:(at==null?void 0:at.startedAt)??new Date().toISOString(),error:Ve}))}},[e==null?void 0:e.name,u]),Fd=b.useCallback(async()=>{const oe=X==null?void 0:X.runId;if(oe)try{const Se=await To(oe);se(Fe=>(Fe==null?void 0:Fe.runId)===oe?{...Fe,detail:Se,status:Se.status||Fe.status,error:void 0}:Fe)}catch(Se){const Fe=Se instanceof Error?Se.message:"Failed to load run log.";se(Ve=>(Ve==null?void 0:Ve.runId)===oe?{...Ve,error:Fe}:Ve)}},[X==null?void 0:X.runId]),ia=!!(X!=null&&X.detail);b.useEffect(()=>{const oe=X==null?void 0:X.runId;if(!(X!=null&&X.open)||!oe||H6(X.status)&&ia)return;let Se=!1;const Fe=async()=>{try{const at=await To(oe);if(Se)return;se(ht=>(ht==null?void 0:ht.runId)===oe?{...ht,detail:at,status:at.status||ht.status,error:void 0}:ht)}catch(at){if(Se)return;const ht=at instanceof Error?at.message:"Waiting for run log...";se(Nt=>(Nt==null?void 0:Nt.runId)===oe?{...Nt,error:ht}:Nt)}};Fe();const Ve=window.setInterval(()=>void Fe(),2e3);return()=>{Se=!0,window.clearInterval(Ve)}},[X==null?void 0:X.open,X==null?void 0:X.runId,X==null?void 0:X.status,ia]);const ip=Kt.length===0,Hd=!!(X!=null&&X.open&&!H6(X.status)),Ra=re.status!=="valid",ho=re.status==="valid"?"var(--revka-status-success)":re.status==="empty"?"var(--revka-status-warning)":"var(--revka-status-danger)";return c.jsxs("div",{className:`editor-chrome ${a??"flex h-[calc(100vh-3.5rem)] flex-col"}`,style:{background:"var(--revka-bg-base, var(--pc-bg-base))"},children:[c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,padding:"10px 20px",borderBottom:"1px solid var(--revka-border-soft)",background:"var(--revka-bg-surface)"},children:[c.jsx("button",{type:"button",onClick:r,title:"Back",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:32,height:32,borderRadius:8,border:"1px solid var(--revka-border-soft)",background:"transparent",color:"var(--revka-text-secondary)",cursor:"pointer"},children:c.jsx(UZ,{size:16})}),c.jsxs("div",{style:{display:"flex",flex:1,minWidth:0,gap:12,alignItems:"center"},children:[c.jsx("input",{type:"text",value:u,onChange:oe=>d(oe.target.value),placeholder:"Workflow name",disabled:o==="edit",style:{background:"transparent",border:0,outline:"none",fontSize:16,fontWeight:700,color:"var(--revka-text-primary)",minWidth:180,maxWidth:320}}),c.jsx("input",{type:"text",value:p,onChange:oe=>f(oe.target.value),placeholder:"Description",style:{background:"transparent",border:0,outline:"none",fontSize:13,color:"var(--revka-text-secondary)",flex:1,minWidth:0}}),Fr?c.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,padding:"3px 8px",borderRadius:999,border:"1px solid var(--revka-border-soft)",background:"var(--revka-signal-network-soft)",color:"var(--revka-signal-network)",fontSize:11,fontWeight:600,whiteSpace:"nowrap"},title:`Updated at ${Fr.publishedAt}`,children:[c.jsx("span",{"aria-hidden":!0,style:{width:6,height:6,borderRadius:"50%",background:"var(--revka-signal-network)"}}),c.jsx(Ix,{size:11}),"Operator edited · ",L6(Fr.publishedAt)]}):null]}),c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e&&c.jsxs("span",{style:{fontFamily:"var(--pc-font-mono, ui-monospace, monospace)",fontSize:11,padding:"2px 8px",borderRadius:6,color:"var(--revka-text-faint)",background:"var(--pc-bg-input)"},children:["rev ",e.revision_number]}),c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4,padding:"4px 8px",borderRadius:8,border:"1px solid var(--pc-border)",background:"var(--pc-bg-input)",minWidth:120,maxWidth:240,flexWrap:"wrap"},children:[g.map(oe=>c.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:2,padding:"2px 6px",borderRadius:4,fontSize:10,fontWeight:500,background:"var(--pc-accent-glow)",color:"var(--pc-accent-light)"},children:[oe,c.jsx("button",{type:"button",onClick:()=>_(Se=>Se.filter(Fe=>Fe!==oe)),style:{background:"transparent",border:0,color:"inherit",cursor:"pointer",padding:0},children:c.jsx(mi,{size:9})})]},oe)),c.jsx("input",{type:"text",value:x,onChange:oe=>v(oe.target.value),onKeyDown:Ft,placeholder:g.length===0?"Tags…":"",style:{flex:1,minWidth:40,background:"transparent",border:0,outline:"none",fontSize:11,color:"var(--pc-text-primary)"}})]}),c.jsx("button",{type:"button",onClick:r,className:"revka-button",style:{padding:"6px 12px",fontSize:12},children:"Cancel"}),c.jsx("button",{type:"button",onClick:rp,disabled:i,className:"revka-button","data-variant":"primary",style:{padding:"6px 14px",fontSize:12,fontWeight:600},children:i?"Saving…":o==="edit"?"Update":o==="duplicate"?"Create Copy":"Save"})]})]}),S&&c.jsxs("div",{style:{margin:"8px 20px 0",padding:"8px 12px",borderRadius:10,border:"1px solid color-mix(in srgb, var(--revka-status-danger) 32%, transparent)",background:"color-mix(in srgb, var(--revka-status-danger) 10%, transparent)",color:"var(--revka-status-danger)",fontSize:13,display:"flex",alignItems:"center",justifyContent:"space-between"},children:[c.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[c.jsx(Cs,{size:14}),S]}),c.jsx("button",{onClick:()=>w(null),style:{background:"transparent",border:0,color:"inherit",cursor:"pointer"},children:c.jsx(mi,{size:14})})]}),N&&c.jsxs("div",{style:{margin:"8px 20px 0",padding:"8px 12px",borderRadius:10,border:"1px solid color-mix(in srgb, var(--revka-status-warning) 32%, transparent)",background:"color-mix(in srgb, var(--revka-status-warning) 10%, transparent)",color:"var(--revka-status-warning)",fontSize:13},children:[c.jsx(Cs,{size:14,style:{display:"inline",marginRight:6}}),N]}),tp&&c.jsxs("div",{style:{margin:"8px 20px 0",padding:"8px 12px",borderRadius:10,border:"1px solid color-mix(in srgb, var(--revka-status-warning) 32%, transparent)",background:"color-mix(in srgb, var(--revka-status-warning) 10%, transparent)",color:"var(--revka-status-warning)",fontSize:13},children:[c.jsx(Cs,{size:14,style:{display:"inline",marginRight:6}}),"Missing output contract: ",tp]}),Ri?c.jsxs("div",{className:"revka-panel","data-variant":"utility",style:{margin:"8px 20px 0",padding:"10px 14px",display:"flex",alignItems:"center",gap:12,flexWrap:"wrap"},children:[c.jsx(Ix,{size:14,style:{color:"var(--revka-signal-network)"}}),c.jsxs("span",{style:{flex:1,fontSize:13,color:"var(--revka-text-primary)",minWidth:0},children:["Operator updated this workflow",Ri.published_at?` ${L6(Ri.published_at)}`:""," — your edits aren't saved yet."]}),c.jsx("button",{type:"button",className:"revka-button","data-variant":"primary",onClick:()=>{Ri&&uo(Ri)},style:{padding:"4px 12px",fontSize:12,fontWeight:600},children:"Apply"}),c.jsx("button",{type:"button",className:"revka-button",onClick:()=>Ki(null),style:{padding:"4px 12px",fontSize:12},children:"Keep mine"})]}):null,c.jsxs("div",{style:{display:"grid",gridTemplateColumns:`minmax(0, 1fr) 12px ${I}px`,gap:0,padding:12,flex:1,minHeight:0},children:[c.jsx(st,{className:"overflow-hidden",children:c.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%"},children:[c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"10px 12px",borderBottom:"1px solid var(--revka-border-soft)"},children:[c.jsx("div",{className:"revka-kicker",children:"Graph"}),c.jsxs("span",{style:{fontSize:11,color:"var(--revka-text-faint)",marginLeft:6},children:[Kt.length," step",Kt.length===1?"":"s"," · ",mt.length," edge",mt.length===1?"":"s",$d?c.jsxs(c.Fragment,{children:[" · ",c.jsx("span",{style:{color:"var(--revka-status-danger)"},children:"cycle detected"})]}):null]}),c.jsx("div",{style:{flex:1}}),c.jsx("div",{role:"group","aria-label":"Wire style",title:"Wire style",style:{display:"inline-flex",alignItems:"center",padding:2,gap:2,borderRadius:8,border:"1px solid var(--revka-border-soft)",background:"var(--revka-bg-panel)"},children:FU.map(oe=>c.jsx("button",{type:"button",onClick:()=>q(oe.value),className:"revka-button","data-variant":P===oe.value?"primary":void 0,title:oe.title,"aria-pressed":P===oe.value,style:{padding:"4px 8px",fontSize:11,border:0,minWidth:0},children:oe.label},oe.value))}),c.jsx("button",{type:"button",onClick:oo,disabled:Yt.length===0,className:"revka-button","aria-label":"Copy selected steps",title:`Copy selected step${Yt.length>1?"s":""} (${l?"⌘":"Ctrl"}+C)`,style:{width:32,height:32,padding:0,justifyContent:"center",opacity:Yt.length>0?1:.48,cursor:Yt.length>0?"pointer":"not-allowed"},children:c.jsx(Xl,{size:14})}),c.jsx("button",{type:"button",onClick:()=>cs(),disabled:!V,className:"revka-button","aria-label":"Paste step",title:`Paste step (${l?"⌘":"Ctrl"}+V)`,style:{width:32,height:32,padding:0,justifyContent:"center",opacity:V?1:.48,cursor:V?"pointer":"not-allowed"},children:c.jsx(tJ,{size:14})}),c.jsxs("button",{type:"button",onClick:()=>_i(),className:"revka-button","data-variant":"primary",title:`Add Step (${l?"⌘":"Ctrl"}+K)`,style:{padding:"6px 12px",fontSize:12,fontWeight:600},children:[c.jsx(rs,{size:14}),"Add Step"]}),c.jsx("button",{type:"button",onClick:co,className:"revka-button",title:"Auto-layout",style:{padding:"6px 10px"},children:c.jsx(EB,{size:14})}),c.jsx("button",{type:"button",onClick:ce,className:"revka-button",title:"Fit to view",style:{padding:"6px 10px"},children:c.jsx(cE,{size:14})}),c.jsx("button",{type:"button",onClick:()=>A(oe=>!oe),className:"revka-button","data-variant":T?"primary":void 0,title:"Toggle YAML",style:{padding:"6px 10px"},children:c.jsx(iJ,{size:14})}),c.jsx("button",{type:"button",onClick:()=>ve(oe=>!oe),className:"revka-button","data-variant":fe?"primary":void 0,title:e!=null&&e.kref?`Architect (${l?"⌘":"Ctrl"}+J)`:"Architect — save the workflow first to start revising",style:{padding:"6px 10px"},children:c.jsx($B,{size:14})})]}),e!=null&&e.kref?c.jsx(lEe,{workflowKref:e.kref}):null,c.jsxs("div",{style:{display:"flex",flex:1,minHeight:0},children:[T&&c.jsxs(c.Fragment,{children:[c.jsxs("div",{style:{width:H,flexShrink:0,borderRight:"1px solid var(--revka-border-soft)",display:"flex",flexDirection:"column",minHeight:0,background:"var(--revka-bg-surface)"},children:[c.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:12,padding:"8px 12px",borderBottom:"1px solid var(--revka-border-soft)"},children:[c.jsx("span",{className:"revka-kicker",children:"YAML"}),c.jsxs("button",{type:"button",onClick:Be,className:"revka-button","data-variant":"primary",disabled:Ra,title:Ra?re.message:"Apply YAML to graph",style:{padding:"4px 10px",fontSize:11,opacity:Ra?.55:1,cursor:Ra?"not-allowed":"pointer"},children:[c.jsx(c0,{size:12}),"Apply to graph"]})]}),F?c.jsx("div",{className:"border-b px-3 py-2 text-xs",style:{borderColor:"var(--revka-border-soft)",color:"var(--revka-status-warning)",background:"color-mix(in srgb, var(--revka-status-warning) 8%, transparent)"},children:"YAML edits are not saved until applied to the graph."}):null,c.jsxs("div",{style:{borderBottom:"1px solid var(--revka-border-soft)",padding:"8px 12px",background:"color-mix(in srgb, var(--revka-bg-elevated) 70%, transparent)"},children:[c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,color:ho,fontSize:11,fontWeight:600},children:[c.jsx("span",{"aria-hidden":"true",style:{width:7,height:7,borderRadius:999,background:ho,boxShadow:`0 0 8px ${ho}`,flexShrink:0}}),c.jsx("span",{children:re.message})]}),re.detail&&re.status!=="valid"?c.jsx("div",{style:{marginTop:6,color:"var(--revka-text-secondary)",fontFamily:"var(--pc-font-mono, ui-monospace, monospace)",fontSize:10.5,lineHeight:1.45,overflowWrap:"anywhere"},children:re.detail}):null]}),c.jsx("div",{style:{flex:1,minHeight:0},children:c.jsx(Lq,{value:E,height:"100%",extensions:FEe,basicSetup:{lineNumbers:!0,foldGutter:!0,highlightActiveLine:!0,highlightSelectionMatches:!0,closeBrackets:!0,autocompletion:!0},theme:"dark",className:"workflow-yaml-editor",onChange:oe=>{D(oe),B(!0)}})})]}),c.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":"Resize YAML panel",title:"Resize YAML panel",onMouseDown:jr,style:{cursor:"col-resize",display:"flex",alignItems:"stretch",justifyContent:"center",padding:"0 5px",flexShrink:0,borderRight:"1px solid var(--revka-border-soft)",background:"var(--revka-bg-surface)"},children:c.jsx("div",{style:{width:2,borderRadius:999,background:z?"var(--pc-accent)":"var(--revka-border-soft)"}})})]}),c.jsxs("div",{ref:ye,className:"revka-graph",style:{flex:1,position:"relative"},onMouseMove:oe=>{Gt(oe.clientX,oe.clientY)},onMouseDown:oe=>{_t(oe.clientX,oe.clientY)},onContextMenu:oe=>{const Se=oe.target;Se.closest(".react-flow__node")||Se.closest(".react-flow__handle")||al(oe)},children:[c.jsxs(mF,{nodes:Kt,edges:yi,onNodesChange:sn,onEdgesChange:nn,onConnect:tc,onConnectStart:Rs,onConnectEnd:ra,onEdgesDelete:_u,onNodeClick:sl,onSelectionChange:({nodes:oe})=>{var Se;oe.length===0?pe(null):pe(((Se=oe[oe.length-1])==null?void 0:Se.id)??null)},onNodeDragStop:rl,onPaneClick:Os,nodeTypes:fEe,connectionLineType:MEe[P],fitView:!0,onlyRenderVisibleElements:rr,elementsSelectable:!0,edgesFocusable:!0,deleteKeyCode:["Backspace","Delete"],style:{background:"transparent"},defaultEdgeOptions:{type:P,animated:!1,selectable:!0,style:hi.default,markerEnd:{type:za.ArrowClosed,color:hi.default.stroke},interactionWidth:20},children:[c.jsx(vF,{color:"var(--revka-grid-line, var(--pc-border))",gap:20,size:1}),c.jsx(_F,{showInteractive:!1,style:{background:"var(--revka-bg-panel-strong)",borderColor:"var(--revka-border-soft)",borderRadius:12,overflow:"hidden"}}),Kt.length>0&&Kt.length<=40&&c.jsx(bF,{position:"bottom-right",pannable:!0,zoomable:!0,style:{background:"var(--revka-bg-panel-strong)",border:"1px solid var(--revka-border-soft)",borderRadius:12,width:200,height:140},maskColor:"rgba(0,0,0,0.32)",nodeColor:()=>wF("var(--revka-signal-selected)")})]}),ip&&c.jsx(A2e,{onAddStep:()=>_i(),onImportYaml:xt,onGenerate:()=>{ge("Describe the workflow you want to build…"),ve(!0)}}),Mt&&c.jsx(XEe,{state:Mt,canPaste:V,onClose:()=>Tt(null),onAddStep:()=>{const oe=Mt;Tt(null),_i({x:oe.flowX,y:oe.flowY})},onPaste:()=>{const oe=Mt;cs({x:oe.flowX,y:oe.flowY})},onAutoLayout:()=>{Tt(null),co()},onFitToView:()=>{Tt(null),ce()},isMac:l})]})]})]})}),c.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":"Resize step details panel",title:"Resize step details panel",onMouseDown:Qr,style:{cursor:"col-resize",display:"flex",alignItems:"stretch",justifyContent:"center",padding:"0 5px"},children:c.jsx("div",{style:{width:2,borderRadius:999,background:K?"var(--pc-accent)":"var(--revka-border-soft)"}})}),un?c.jsx(RNe,{node:un,existingTaskIds:Kt.map(oe=>oe.data.taskId),onUpdate:hr,onRenameStep:Ds,onDelete:Zr,onChangeType:()=>{ct(un.id),$e(void 0),me(!0)},dagContext:L,onRunToHere:lk,computeRunToHereClosure:ok,runToHereDisabled:!(e!=null&&e.name)&&!u||Te||Hd,runToHereDisabledReason:Te?"Save your edits first — Run to here uses the saved revision.":Hd?"A Run to here request is already in progress.":void 0}):c.jsx(ZEe,{meta:de,setMeta:ue})]}),c.jsx(PNe,{open:J,onOpenChange:oe=>{me(oe),oe||ct(null)},context:Ue,onSelect:Bt?oe=>{ai(Bt,oe)}:void 0}),c.jsx(JNe,{open:fe,onOpenChange:oe=>{ve(oe),oe||ge(void 0)},workflowKref:(e==null?void 0:e.kref)??null,workflowName:(e==null?void 0:e.name)??u??null,currentYaml:Yn,onYamlProposed:Iv,initialPrompt:Ke}),X!=null&&X.open?c.jsx(SEe,{runLog:X,onClose:()=>se(null),onRefresh:Fd}):null,c.jsx(KNe,{open:Dt!==null,onOpenChange:oe=>{oe||Re(null)},value:Dt?lo(Dt.taskId,Dt.target,Dt.participantIndex):void 0,anchorRect:(Dt==null?void 0:Dt.anchorRect)??null,onSelect:oe=>{Dt&&xu(Dt,oe)}})]})}function XEe({state:e,canPaste:n,onClose:r,onAddStep:i,onPaste:s,onAutoLayout:a,onFitToView:o,isMac:l}){return b.useEffect(()=>{const u=()=>r();return window.addEventListener("mousedown",u),()=>window.removeEventListener("mousedown",u)},[r]),c.jsxs("div",{onMouseDown:u=>u.stopPropagation(),style:{position:"fixed",left:e.screenX,top:e.screenY,zIndex:50,minWidth:200,padding:4,borderRadius:10,border:"1px solid var(--revka-border-strong)",background:"var(--revka-bg-panel-strong)",boxShadow:"0 12px 32px rgba(0,0,0,0.32)"},children:[c.jsx(F_,{onClick:i,label:"Add Step",shortcut:`${l?"⌘":"Ctrl"} K`}),c.jsx(F_,{onClick:s,label:"Paste Step",shortcut:`${l?"⌘":"Ctrl"} V`,disabled:!n}),c.jsx(QEe,{}),c.jsx(F_,{onClick:a,label:"Auto-layout"}),c.jsx(F_,{onClick:o,label:"Fit to View"})]})}function F_({onClick:e,label:n,shortcut:r,disabled:i}){return c.jsxs("button",{type:"button",onClick:i?void 0:e,disabled:i,style:{width:"100%",display:"flex",alignItems:"center",gap:8,padding:"6px 10px",borderRadius:8,border:0,background:"transparent",color:i?"var(--revka-text-faint)":"var(--revka-text-primary)",fontSize:12,textAlign:"left",cursor:i?"not-allowed":"pointer"},onMouseEnter:s=>{i||(s.currentTarget.style.background="var(--pc-hover)")},onMouseLeave:s=>s.currentTarget.style.background="transparent",children:[c.jsx("span",{style:{flex:1},children:n}),r?c.jsx("span",{style:{fontFamily:"var(--pc-font-mono, ui-monospace, monospace)",fontSize:10,color:"var(--revka-text-faint)"},children:r}):null]})}function QEe(){return c.jsx("div",{style:{height:1,margin:"4px 6px",background:"var(--revka-border-soft)"}})}function ZEe({meta:e,setMeta:n}){const r={display:"block",fontSize:10,fontWeight:700,textTransform:"uppercase",letterSpacing:"0.08em",color:"var(--pc-text-faint)",marginBottom:4},i={width:"100%",padding:"6px 8px",borderRadius:8,border:"1px solid var(--pc-border)",background:"var(--pc-bg-input)",color:"var(--pc-text-primary)",fontSize:12,outline:"none"};return c.jsx(st,{variant:"primary",className:"overflow-hidden",children:c.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%"},children:[c.jsx("div",{style:{padding:"14px 16px",borderBottom:"1px solid var(--revka-border-soft)"},children:c.jsx("div",{className:"revka-kicker",children:"Workflow Settings"})}),c.jsxs("div",{style:{overflowY:"auto",padding:16,display:"flex",flexDirection:"column",gap:14},children:[c.jsxs("div",{children:[c.jsx("label",{style:r,children:"Version"}),c.jsx("input",{type:"text",value:e.version,onChange:s=>n(a=>({...a,version:s.target.value})),style:i})]}),c.jsxs("div",{style:{display:"flex",gap:8},children:[c.jsxs("div",{style:{flex:1},children:[c.jsx("label",{style:r,children:"Step Timeout (s)"}),c.jsx("input",{type:"number",value:e.defaultTimeout,onChange:s=>n(a=>({...a,defaultTimeout:parseInt(s.target.value)||300})),style:i})]}),c.jsxs("div",{style:{flex:1},children:[c.jsx("label",{style:r,children:"Max Total (s)"}),c.jsx("input",{type:"number",value:e.maxTotalTime,onChange:s=>n(a=>({...a,maxTotalTime:parseInt(s.target.value)||3600})),style:i})]})]}),c.jsxs("label",{style:{display:"inline-flex",alignItems:"center",gap:6,cursor:"pointer"},children:[c.jsx("input",{type:"checkbox",checked:e.checkpoint,onChange:s=>n(a=>({...a,checkpoint:s.target.checked})),style:{accentColor:"var(--pc-accent)"}}),c.jsx("span",{style:{fontSize:12,color:"var(--pc-text-muted)"},children:"Enable checkpoints"})]}),c.jsx(f2,{kicker:"Triggers",count:e.triggers.length,addSlot:c.jsxs("div",{style:{display:"flex",gap:4},children:[c.jsx("button",{type:"button",onClick:()=>n(s=>({...s,triggers:[...s.triggers,{onKind:"",onTag:"",onNamePattern:"",onSpace:"",inputMap:{__cron:""}}]})),className:"revka-button",style:{padding:"2px 8px",fontSize:10},title:"Run on a cron schedule",children:"+ Cron"}),c.jsx("button",{type:"button",onClick:()=>n(s=>({...s,triggers:[...s.triggers,{onKind:"",onTag:"ready",onNamePattern:"",onSpace:"",inputMap:{}}]})),className:"revka-button",style:{padding:"2px 8px",fontSize:10},title:"Run when an entity matches",children:"+ Entity"})]}),children:e.triggers.map((s,a)=>c.jsxs("div",{style:{padding:8,borderRadius:8,border:"1px solid var(--pc-border)",background:"var(--pc-bg-base)",display:"flex",flexDirection:"column",gap:6},children:[c.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[c.jsx("span",{style:{fontSize:10,color:"var(--pc-text-faint)"},children:s.inputMap.__cron?"Cron":"Entity"}),c.jsx("button",{onClick:()=>n(o=>({...o,triggers:o.triggers.filter((l,u)=>u!==a)})),style:{background:"transparent",border:0,color:"var(--revka-status-danger)",fontSize:10,cursor:"pointer"},children:"Remove"})]}),s.inputMap.__cron?c.jsx("input",{type:"text",value:s.inputMap.__cron,onChange:o=>n(l=>{const u=[...l.triggers];return u[a]={...u[a],inputMap:{...u[a].inputMap,__cron:o.target.value}},{...l,triggers:u}}),placeholder:"0 9 * * 1 (cron)",style:{...i,fontFamily:"var(--pc-font-mono, ui-monospace, monospace)"}}):c.jsxs("div",{style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr) 96px",gap:6},children:[c.jsx("input",{type:"text",value:s.onKind,onChange:o=>n(l=>{const u=[...l.triggers];return u[a]={...u[a],onKind:o.target.value},{...l,triggers:u}}),placeholder:"Entity kind",style:{...i,fontFamily:"var(--pc-font-mono, ui-monospace, monospace)"}}),c.jsx("input",{type:"text",value:s.onTag,onChange:o=>n(l=>{const u=[...l.triggers];return u[a]={...u[a],onTag:o.target.value},{...l,triggers:u}}),placeholder:"Tag",style:{...i,fontFamily:"var(--pc-font-mono, ui-monospace, monospace)"}}),c.jsx("input",{type:"text",value:s.onNamePattern,onChange:o=>n(l=>{const u=[...l.triggers];return u[a]={...u[a],onNamePattern:o.target.value},{...l,triggers:u}}),placeholder:"Name pattern",style:{...i,fontFamily:"var(--pc-font-mono, ui-monospace, monospace)"}}),c.jsx("input",{type:"text",value:s.onSpace??"",onChange:o=>n(l=>{const u=[...l.triggers];return u[a]={...u[a],onSpace:o.target.value},{...l,triggers:u}}),placeholder:"Space prefix",style:{...i,fontFamily:"var(--pc-font-mono, ui-monospace, monospace)"}})]})]},a))}),c.jsx(f2,{kicker:"Inputs",count:e.inputs.length,onAdd:()=>n(s=>({...s,inputs:[...s.inputs,{name:"",type:"string",required:!0,default:"",description:""}]})),children:e.inputs.map((s,a)=>c.jsxs("div",{style:{padding:8,borderRadius:8,border:"1px solid var(--pc-border)",background:"var(--pc-bg-base)",display:"flex",flexDirection:"column",gap:6},children:[c.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center"},children:[c.jsx("input",{type:"text",value:s.name,onChange:o=>n(l=>{const u=[...l.inputs];return u[a]={...u[a],name:o.target.value},{...l,inputs:u}}),placeholder:"Param name",style:{...i,flex:1,fontFamily:"var(--pc-font-mono, ui-monospace, monospace)"}}),c.jsxs("select",{value:s.type,onChange:o=>n(l=>{const u=[...l.inputs];return u[a]={...u[a],type:o.target.value},{...l,inputs:u}}),style:{...i,width:90},children:[c.jsx("option",{value:"string",children:"string"}),c.jsx("option",{value:"number",children:"number"}),c.jsx("option",{value:"boolean",children:"boolean"}),c.jsx("option",{value:"list",children:"list"})]}),c.jsx("button",{type:"button",onClick:()=>n(o=>({...o,inputs:o.inputs.filter((l,u)=>u!==a)})),style:{background:"transparent",border:0,color:"var(--revka-status-danger)",cursor:"pointer"},children:"×"})]}),c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[c.jsxs("label",{style:{display:"inline-flex",alignItems:"center",gap:4,cursor:"pointer"},children:[c.jsx("input",{type:"checkbox",checked:s.required,onChange:o=>n(l=>{const u=[...l.inputs];return u[a]={...u[a],required:o.target.checked},{...l,inputs:u}}),style:{accentColor:"var(--pc-accent)"}}),c.jsx("span",{style:{fontSize:10,color:"var(--pc-text-muted)"},children:"Required"})]}),c.jsx("input",{type:"text",value:s.default,onChange:o=>n(l=>{const u=[...l.inputs];return u[a]={...u[a],default:o.target.value},{...l,inputs:u}}),placeholder:"Default",style:{...i,flex:1}})]}),c.jsx("input",{type:"text",value:s.description,onChange:o=>n(l=>{const u=[...l.inputs];return u[a]={...u[a],description:o.target.value},{...l,inputs:u}}),placeholder:"Description",style:i})]},a))}),c.jsx(f2,{kicker:"Outputs",count:e.outputs.length,onAdd:()=>n(s=>({...s,outputs:[...s.outputs,{name:"",source:"",description:""}]})),children:e.outputs.map((s,a)=>c.jsxs("div",{style:{padding:8,borderRadius:8,border:"1px solid var(--pc-border)",background:"var(--pc-bg-base)",display:"flex",flexDirection:"column",gap:6},children:[c.jsxs("div",{style:{display:"flex",gap:6},children:[c.jsx("input",{type:"text",value:s.name,onChange:o=>n(l=>{const u=[...l.outputs];return u[a]={...u[a],name:o.target.value},{...l,outputs:u}}),placeholder:"Output name",style:{...i,flex:1,fontFamily:"var(--pc-font-mono, ui-monospace, monospace)"}}),c.jsx("button",{onClick:()=>n(o=>({...o,outputs:o.outputs.filter((l,u)=>u!==a)})),style:{background:"transparent",border:0,color:"var(--revka-status-danger)",cursor:"pointer"},children:"×"})]}),c.jsx("input",{type:"text",value:s.source,onChange:o=>n(l=>{const u=[...l.outputs];return u[a]={...u[a],source:o.target.value},{...l,outputs:u}}),placeholder:"${step_id.output}",style:{...i,fontFamily:"var(--pc-font-mono, ui-monospace, monospace)"}})]},a))})]})]})})}function f2({kicker:e,count:n,onAdd:r,addSlot:i,children:s}){return c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[c.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[c.jsxs("span",{className:"revka-kicker",children:[e," (",n,")"]}),i??(r?c.jsx("button",{type:"button",onClick:r,className:"revka-button",style:{padding:"2px 8px",fontSize:10},children:"+ Add"}):null)]}),s]})}function Qo({tone:e,message:n,onDismiss:r}){const i=e==="success"?{icon:Px,color:"var(--revka-status-success)",border:"color-mix(in srgb, var(--revka-status-success) 26%, transparent)"}:e==="error"?{icon:Cs,color:"var(--revka-status-danger)",border:"color-mix(in srgb, var(--revka-status-danger) 26%, transparent)"}:{icon:fJ,color:"var(--revka-signal-network)",border:"color-mix(in srgb, var(--revka-signal-network) 26%, transparent)"},s=i.icon;return c.jsxs("div",{className:"revka-panel revka-notice flex items-start justify-between gap-3 p-3",style:{borderColor:i.border,background:"color-mix(in srgb, var(--revka-bg-panel-strong) 94%, transparent)"},children:[c.jsxs("div",{className:"flex items-start gap-3",children:[c.jsx(s,{className:"mt-0.5 h-4 w-4 shrink-0",style:{color:i.color}}),c.jsx("div",{className:"text-sm whitespace-pre-wrap",style:{color:"var(--revka-text-primary)"},children:n})]}),r?c.jsx("button",{type:"button",className:"text-xs font-semibold uppercase tracking-[0.12em]",style:{color:"var(--revka-text-faint)"},onClick:r,children:"Close"}):null]})}function Ct({tone:e="empty",title:n,description:r,compact:i=!1,action:s}){const a=(()=>{switch(e){case"loading":return{icon:Rr,iconClassName:"animate-spin",color:"var(--revka-signal-network)",borderColor:"color-mix(in srgb, var(--revka-signal-network) 22%, var(--revka-border-soft))",background:"color-mix(in srgb, var(--revka-signal-network-soft) 38%, transparent)"};case"error":return{icon:Cs,iconClassName:"",color:"var(--revka-status-danger)",borderColor:"color-mix(in srgb, var(--revka-status-danger) 24%, var(--revka-border-soft))",background:"color-mix(in srgb, var(--revka-status-danger) 8%, transparent)"};default:return{icon:hJ,iconClassName:"",color:"var(--revka-signal-selected)",borderColor:"color-mix(in srgb, var(--revka-signal-selected) 22%, var(--revka-border-soft))",background:"linear-gradient(135deg, color-mix(in srgb, var(--revka-signal-selected) 5%, transparent), transparent 58%), color-mix(in srgb, var(--revka-bg-panel-strong) 92%, transparent)"}}})(),o=a.icon;return c.jsx("div",{className:`rounded-[14px] border ${i?"p-3":"p-4"}`,style:{borderColor:a.borderColor,background:a.background},children:c.jsxs("div",{className:"flex items-start gap-3",children:[c.jsx("span",{className:"inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-[12px] border",style:{borderColor:"color-mix(in srgb, currentColor 18%, transparent)",color:a.color,background:"color-mix(in srgb, currentColor 8%, transparent)"},children:c.jsx(o,{className:`h-4 w-4 ${a.iconClassName}`.trim()})}),c.jsxs("div",{className:"min-w-0",children:[c.jsx("div",{className:"text-sm font-semibold",style:{color:"var(--revka-text-primary)"},children:n}),r?c.jsx("p",{className:"mt-1 text-sm leading-6",style:{color:"var(--revka-text-secondary)"},children:r}):null,s?c.jsx("div",{className:"mt-3",children:s}):null]})]})})}function JEe(){var pe;const{t:e,tpl:n}=cn(),r=Qg(),[i,s]=Jg(),[a,o]=b.useState([]),[l,u]=b.useState([]),[d,p]=b.useState(null),[f,g]=b.useState(!0),[_,x]=b.useState(!1),[v,S]=b.useState(null),[w,N]=b.useState(null),[C,T]=b.useState(null),[A,E]=b.useState(null),[D,F]=b.useState(!1),[B,H]=b.useState(!1),[$,z]=b.useState(!1),[W,P]=b.useState(null),[q,I]=b.useState(!1),Q=b.useRef(null),K=async()=>(g(!0),Promise.all([gB(!0,!1),vB(40)]).then(([J,me])=>{o(J),u(me);const fe=i.get("workflow"),ve=fe?J.find(Ke=>Ke.kref===fe||Ke.name.toLowerCase()===fe.toLowerCase()):null;N(Ke=>{var ge;return Ke??(ve==null?void 0:ve.kref)??((ge=J[0])==null?void 0:ge.kref)??null})}).catch(J=>p(J.message)).finally(()=>g(!1))),Z=J=>{o(me=>{const fe=me.findIndex(Ke=>Ke.kref===J.kref);if(fe===-1)return[J,...me];const ve=[...me];return ve[fe]={...ve[fe],...J},ve})},Y=()=>{K()};b.useEffect(()=>{K()},[]),b.useEffect(()=>{if(!q)return;const J=me=>{Q.current&&!Q.current.contains(me.target)&&I(!1)};return document.addEventListener("mousedown",J),()=>document.removeEventListener("mousedown",J)},[q]);const R=b.useMemo(()=>a.find(J=>J.kref===w)??a[0]??null,[a,w]),U=b.useCallback((J,me)=>{const fe=new URLSearchParams;R!=null&&R.name?fe.set("workflow",R.name):R!=null&&R.kref&&fe.set("workflow",R.kref),J&&fe.set("run",J),me&&fe.set("node",me);const ve=i.get("path");(ve==="all"||ve==="failed"||ve==="blocked")&&fe.set("path",ve);const Ke=fe.toString();return Ke?`/runs?${Ke}`:"/runs"},[i,R==null?void 0:R.kref,R==null?void 0:R.name]);b.useEffect(()=>{i.get("tab")!=="runs"||!R||r(U(i.get("run"),i.get("node")??(C==null?void 0:C.id)),{replace:!0})},[U,r,i,C==null?void 0:C.id,R]),b.useEffect(()=>{if(!R||R.definition){x(!1),S(null);return}if(!R.kref.startsWith("kref://")||R.revision_number<=0){x(!1);return}let J=!1;return x(!0),S(null),e0(`${R.kref}?r=${R.revision_number}`).then(me=>{J||o(fe=>fe.map(ve=>ve.kref===R.kref?{...ve,...me}:ve))}).catch(me=>{J||S(me instanceof Error?me.message:String(me))}).finally(()=>{J||x(!1)}),()=>{J=!0}},[R==null?void 0:R.definition,R==null?void 0:R.kref,R==null?void 0:R.revision_number]);const V=b.useMemo(()=>R?l.filter(J=>J.workflow_name.toLowerCase()===R.name.toLowerCase()).slice(0,20):[],[l,R]),ie=(R==null?void 0:R.definition)??"",te=_,X=b.useMemo(()=>R?R.definition?Bo(R.definition):[]:[],[R]);b.useEffect(()=>{const J=i.get("node");if(!J){T(null);return}T(X.find(me=>me.id===J)??null)},[i,X]),b.useEffect(()=>{R!=null&&R.kref&&i.get("tab")!=="runs"&&s(J=>{const me=new URLSearchParams(J);return me.set("workflow",R.kref),me.delete("tab"),me.delete("run"),C!=null&&C.id?me.set("node",C.id):me.delete("node"),me},{replace:!0})},[i,C==null?void 0:C.id,R==null?void 0:R.kref,s]);const se=(J,me)=>{if(J instanceof ql&&J.body&&typeof J.body=="object"){const fe=J.body;if(Array.isArray(fe.errors)&&fe.errors.length>0){const ve=fe.errors.slice(0,8).map(ge=>{if(ge&&typeof ge=="object"){const Ue=ge;return`• ${Ue.step_id?`[${Ue.step_id}] `:Ue.field?`[${Ue.field}] `:""}${Ue.message??JSON.stringify(ge)}`}return`• ${String(ge)}`});return[fe.error??"Validation failed",...ve].join(`
`)}if(fe.error)return String(fe.error)}return J instanceof Error?J.message:me},re=async J=>{F(!0),p(null);try{if(A==="edit"&&R){const me={kref:R.kref,name:J.name,description:J.description,version:J.version,tags:J.tags,definition:J.definition},fe=await VQ(me);Z(fe),N(fe.kref),P({tone:"success",message:n("workflows.toast.updated",{name:fe.name})}),Y()}else{const me={name:J.name,description:J.description,version:J.version,tags:J.tags,definition:J.definition},fe=await UQ(me);Z(fe),N(fe.kref),P({tone:"success",message:n("workflows.toast.created",{name:fe.name})}),Y()}E(null)}catch(me){const fe=se(me,e("workflows.save_failure"));throw p(fe),P({tone:"error",message:fe}),new Error(fe)}finally{F(!1)}},de=async()=>{if(!(!R||R.source==="builtin"))try{await KQ(R.kref,!R.deprecated),await K(),P({tone:"success",message:n(R.deprecated?"workflows.toast.reenabled":"workflows.toast.deprecated",{name:R.name})})}catch(J){p(J instanceof Error?J.message:e("workflows.status_failure")),P({tone:"error",message:J instanceof Error?J.message:e("workflows.status_failure_dot")})}},ue=async()=>{if(!(!R||$)){z(!0);try{const J=await yB(R.name);P({tone:"success",message:n("workflows.toast.run_started",{name:R.name,runId:J.run_id.slice(0,8)})}),r(U(J.run_id,null))}catch(J){const me=se(J,e("workflows.run_failure"));P({tone:"error",message:me})}finally{z(!1)}}},ae=async()=>{if(!(!R||R.source==="builtin")){H(!0);try{const J=R.name;await YQ(R.kref),T(null),N(null),await K(),P({tone:"success",message:n("workflows.toast.deleted",{name:J})})}catch(J){p(J instanceof Error?J.message:e("workflows.delete_failure")),P({tone:"error",message:J instanceof Error?J.message:e("workflows.delete_failure_dot")})}finally{H(!1)}}};return c.jsxs("div",{className:"flex h-[calc(100vh-6rem)] flex-col gap-3",children:[W?c.jsx(Qo,{tone:W.tone,message:W.message,onDismiss:()=>P(null)}):null,c.jsx(si,{kicker:e("workflows.kicker"),title:e("workflows.title"),actions:c.jsxs(c.Fragment,{children:[c.jsxs("button",{className:"revka-button","data-variant":"primary",onClick:()=>E("create"),children:[c.jsx(rs,{className:"h-4 w-4"})," ",e("workflows.create")]}),c.jsxs("button",{className:"revka-button",onClick:()=>void K(),disabled:f,children:[c.jsx($r,{className:`h-4 w-4 ${f?"animate-spin":""}`})," ",e("common.refresh")]})]})}),d?c.jsx("div",{className:"text-sm",style:{color:"var(--revka-status-danger)"},children:d}):null,R?c.jsxs("div",{className:"flex shrink-0 flex-wrap items-center gap-3",children:[c.jsxs("div",{ref:Q,className:"relative",children:[c.jsxs("button",{type:"button",className:"revka-button flex items-center gap-2",onClick:()=>I(J=>!J),children:[c.jsx(o0,{className:"h-4 w-4",style:{color:"var(--revka-signal-network)"}}),c.jsx("span",{className:"max-w-[18rem] truncate text-sm font-semibold",style:{color:"var(--revka-text-primary)"},children:R.name}),c.jsx(qo,{className:"h-3.5 w-3.5",style:{color:"var(--revka-text-faint)"}})]}),q?c.jsx("div",{className:"absolute left-0 top-full z-50 mt-1 max-h-[24rem] w-[22rem] overflow-y-auto rounded-[12px] border shadow-lg",style:{borderColor:"var(--revka-border-strong)",background:"var(--revka-bg-panel-strong)"},children:a.map(J=>{const me=J.kref===R.kref;return c.jsxs("button",{type:"button",className:"w-full border-b px-4 py-2.5 text-left transition last:border-b-0",style:{borderColor:"var(--revka-border-soft)",background:me?"color-mix(in srgb, var(--revka-signal-selected) 14%, var(--revka-bg-panel))":"transparent"},onClick:()=>{N(J.kref),T(null),I(!1)},children:[c.jsxs("div",{className:"flex items-center justify-between gap-2",children:[c.jsx("span",{className:"truncate text-sm font-medium",style:{color:"var(--revka-text-primary)"},children:J.name}),c.jsx("span",{className:"shrink-0 rounded-full px-2 py-0.5 text-[10px] font-semibold uppercase",style:{background:J.deprecated?"color-mix(in srgb, var(--revka-status-danger) 12%, transparent)":"var(--revka-signal-selected-soft, color-mix(in srgb, var(--revka-signal-selected) 14%, transparent))",color:J.deprecated?"var(--revka-status-danger)":"var(--revka-signal-selected)"},children:J.deprecated?e("workflows.status.off"):e("workflows.status.ready")})]}),c.jsx("div",{className:"mt-0.5 text-xs",style:{color:"var(--revka-text-faint)"},children:n("workflows.workflow_info_short",{version:J.version,steps:J.steps})})]},J.kref)})}):null]}),c.jsx("span",{className:"text-xs",style:{color:"var(--revka-text-faint)"},children:n("workflows.workflow_info",{version:R.version,steps:R.steps,runs:V.length})}),c.jsx("div",{className:"flex-1"}),c.jsx("div",{className:"revka-tab-strip",role:"tablist",children:["definition","runs"].map(J=>c.jsx("button",{type:"button",className:"revka-tab-button","data-active":String(J==="definition"),"aria-selected":J==="definition",onClick:()=>{var me;if(J==="runs"){r(U(((me=V[0])==null?void 0:me.run_id)??null,C==null?void 0:C.id));return}},children:e(J==="definition"?"workflows.tab.definition":"workflows.tab.runs")},J))}),c.jsxs("button",{className:"revka-button","data-variant":"primary",onClick:ue,disabled:$||R.deprecated,title:e("common.execute"),children:[$?c.jsx($r,{className:"h-3.5 w-3.5 animate-spin"}):c.jsx(n0,{className:"h-3.5 w-3.5"}),c.jsx("span",{className:"text-xs",children:e("common.execute")})]}),c.jsx("button",{className:"revka-button",onClick:()=>R&&E(R.source==="builtin"?"duplicate":"edit"),title:R.source==="builtin"?e("common.duplicate"):e("common.edit"),children:c.jsx(iv,{className:"h-3.5 w-3.5"})}),c.jsx("button",{className:"revka-button",onClick:de,disabled:R.source==="builtin",title:R.deprecated?e("common.reenable"):e("common.deprecate"),children:c.jsx(r0,{className:"h-3.5 w-3.5"})}),c.jsx("button",{className:"revka-button",onClick:ae,disabled:R.source==="builtin"||B,title:e("common.delete"),children:c.jsx(Wi,{className:"h-3.5 w-3.5"})})]}):null,R?c.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-4 lg:flex-row",children:[c.jsx("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:ie?c.jsx(NA,{definition:ie,onSelectTask:T,selectedTaskId:C==null?void 0:C.id,fill:!0}):c.jsx(st,{className:"flex flex-1 items-center justify-center",variant:"secondary",children:c.jsx(Ct,{tone:te?"loading":"empty",title:e(te?"workflows.loading":"workflows.definition_unavailable_title"),description:v??e("workflows.definition_unavailable_desc")})})}),C?c.jsxs("div",{className:"min-h-0 w-full shrink-0 space-y-3 overflow-y-auto lg:w-[22rem]",children:[c.jsx(kde,{workflow:R}),c.jsx(D$,{task:C,footer:c.jsx("div",{className:"flex flex-wrap gap-3 text-xs",children:c.jsx(bs,{to:U(((pe=V[0])==null?void 0:pe.run_id)??null,C.id),style:{color:"var(--revka-signal-network)"},children:e("workflows.open_node_in_runs")})}),emptyText:e("workflows.select_dag_node")})]}):null]}):c.jsx(st,{className:"flex min-h-0 flex-1 items-center justify-center p-5",children:c.jsx(Ct,{tone:f?"loading":"empty",title:e(f?"workflows.loading":"workflows.empty_title"),description:e("workflows.empty_desc")})}),A?c.jsx("div",{className:"fixed inset-0 z-50",style:{background:"var(--revka-bg-base, var(--pc-bg-base))"},children:c.jsx(pEe,{mode:A,workflow:A==="create"?null:A==="duplicate"&&R?{...R,name:`${R.name} ${e("workflows.copy_suffix")}`}:R,saving:D,onCancel:()=>E(null),onSave:re,containerClassName:"flex h-screen w-screen flex-col animate-fade-in"})}):null]})}function eAe({runId:e,stepId:n,stepName:r,message:i,approveKeywords:s,rejectKeywords:a,onResolved:o}){const[l,u]=b.useState("idle"),[d,p]=b.useState(""),[f,g]=b.useState(""),_=s&&s.length>0,x=a&&a.length>0;async function v(N,C){u("loading"),g("");try{await XQ(e,N,C||void 0),u(N?"approved":"rejected"),o==null||o()}catch(T){g(T instanceof Error?T.message:String(T)),u("error")}}function S(){v(!0,"")}function w(){v(!1,d)}return l==="approved"?c.jsxs("div",{className:"rounded-xl border-2 px-4 py-3 flex items-center gap-3",style:{borderColor:"#34d399",background:"rgba(52,211,153,0.08)"},children:[c.jsx(Px,{className:"h-5 w-5 shrink-0",style:{color:"#34d399"}}),c.jsxs("div",{children:[c.jsx("p",{className:"text-sm font-semibold",style:{color:"#34d399"},children:"Approved"}),c.jsx("p",{className:"text-[11px] mt-0.5",style:{color:"var(--pc-text-muted)"},children:"Workflow is resuming."})]})]}):l==="rejected"?c.jsxs("div",{className:"rounded-xl border-2 px-4 py-3 flex items-center gap-3",style:{borderColor:"#f87171",background:"rgba(248,113,113,0.08)"},children:[c.jsx(Xc,{className:"h-5 w-5 shrink-0",style:{color:"#f87171"}}),c.jsxs("div",{children:[c.jsx("p",{className:"text-sm font-semibold",style:{color:"#f87171"},children:"Rejected"}),c.jsx("p",{className:"text-[11px] mt-0.5",style:{color:"var(--pc-text-muted)"},children:"The workflow step has been rejected."})]})]}):c.jsxs("div",{className:"rounded-xl border-2 px-4 py-3 flex flex-col gap-3 animate-fade-in",style:{borderColor:"#f59e0b",background:"rgba(245,158,11,0.07)"},children:[c.jsxs("div",{className:"flex items-start gap-2",children:[c.jsx(Lx,{className:"h-4 w-4 shrink-0 mt-0.5",style:{color:"#f59e0b"}}),c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"#f59e0b"},children:"Awaiting Approval"}),c.jsx("p",{className:"text-sm font-medium mt-0.5 truncate",style:{color:"var(--pc-text-primary)"},children:r})]})]}),i&&c.jsx("p",{className:"text-[12px] leading-relaxed",style:{color:"var(--pc-text-secondary)"},children:i}),(_||x)&&c.jsxs("div",{className:"flex flex-col gap-1",children:[_&&c.jsxs("p",{className:"text-[10px]",style:{color:"var(--pc-text-faint)"},children:[c.jsx("span",{style:{color:"#34d399"},children:"Approve keywords:"})," ",s.join(", ")]}),x&&c.jsxs("p",{className:"text-[10px]",style:{color:"var(--pc-text-faint)"},children:[c.jsx("span",{style:{color:"#f87171"},children:"Reject keywords:"})," ",a.join(", ")]})]}),l==="error"&&f&&c.jsxs("div",{className:"flex items-center gap-2 rounded-lg px-3 py-2",style:{background:"rgba(248,113,113,0.12)"},children:[c.jsx(Cs,{className:"h-3.5 w-3.5 shrink-0",style:{color:"#f87171"}}),c.jsx("p",{className:"text-[11px]",style:{color:"#f87171"},children:f})]}),l==="confirming_reject"&&c.jsxs("div",{className:"flex flex-col gap-2",children:[c.jsx("label",{className:"text-[11px]",style:{color:"var(--pc-text-muted)"},children:"Rejection feedback (required)"}),c.jsx("textarea",{className:"w-full rounded-lg border px-3 py-2 text-[12px] resize-none focus:outline-none focus:ring-1",style:{borderColor:"var(--pc-border)",background:"var(--pc-bg-base)",color:"var(--pc-text-primary)",minHeight:"72px"},placeholder:"Explain why you're rejecting this step...",value:d,onChange:N=>p(N.target.value),autoFocus:!0})]}),c.jsxs("div",{className:"flex items-center gap-2",children:[l==="loading"?c.jsxs("div",{className:"flex items-center gap-2",style:{color:"var(--pc-text-muted)"},children:[c.jsx(Rr,{className:"h-4 w-4 animate-spin"}),c.jsx("span",{className:"text-[12px]",children:"Processing..."})]}):l==="confirming_reject"?c.jsxs(c.Fragment,{children:[c.jsxs("button",{type:"button",disabled:!d.trim(),onClick:w,className:"flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-[12px] font-medium disabled:opacity-40 disabled:cursor-not-allowed",style:{background:"rgba(248,113,113,0.18)",color:"#f87171"},children:[c.jsx(Xc,{className:"h-3.5 w-3.5"}),"Confirm Reject"]}),c.jsx("button",{type:"button",onClick:()=>{u("idle"),p("")},className:"px-3 py-1.5 rounded-lg text-[12px]",style:{color:"var(--pc-text-muted)",background:"var(--pc-bg-elevated)"},children:"Cancel"})]}):c.jsxs(c.Fragment,{children:[c.jsxs("button",{type:"button",onClick:S,className:"flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-[12px] font-medium",style:{background:"rgba(52,211,153,0.18)",color:"#34d399"},children:[c.jsx(Px,{className:"h-3.5 w-3.5"}),"Approve"]}),c.jsxs("button",{type:"button",onClick:()=>u("confirming_reject"),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-[12px] font-medium",style:{background:"rgba(248,113,113,0.18)",color:"#f87171"},children:[c.jsx(Xc,{className:"h-3.5 w-3.5"}),"Reject"]})]}),c.jsx("span",{className:"ml-auto text-[10px] font-mono",style:{color:"var(--pc-text-faint)"},children:n})]})]})}const tAe={md:"max-w-3xl",lg:"max-w-4xl",xl:"max-w-5xl","2xl":"max-w-6xl"};function yu({title:e,description:n,children:r,onClose:i,size:s="md"}){return c.jsx("div",{className:"fixed inset-0 z-[120] flex items-center justify-center p-4",style:{background:"rgba(5, 8, 10, 0.64)",backdropFilter:"blur(10px)"},onClick:a=>{a.target===a.currentTarget&&i()},role:"dialog","aria-modal":"true",children:c.jsxs("div",{className:`revka-panel revka-modal-shell w-full ${tAe[s]} p-5`,children:[c.jsxs("div",{className:"mb-4 shrink-0",children:[c.jsx("div",{className:"revka-kicker",children:"Action Surface"}),c.jsx("h3",{className:"mt-2 text-lg font-semibold",style:{color:"var(--revka-text-primary)"},children:e}),n?c.jsx("p",{className:"mt-2 text-sm",style:{color:"var(--revka-text-secondary)"},children:n}):null]}),c.jsx("div",{className:"revka-modal-body",children:r})]})})}const nAe=new Set(["md","markdown","mdx"]),rAe=new Set(["txt","log","json","yaml","yml","toml","ini","csv","tsv","xml","html","css","js","ts","tsx","jsx","py","rs","go","sh","bash","zsh","sql","env"]),iAe=new Set(["png","jpg","jpeg","gif","webp","svg","bmp","ico","avif"]),sAe=new Set(["mp4","webm","mov","m4v","ogv"]);function KU(e){const n=(e.split("?")[0]??"").split("#")[0]??"",r=n.lastIndexOf(".");return r<0?"":n.slice(r+1).toLowerCase()}function aAe(e){const n=KU(e);return nAe.has(n)?"markdown":rAe.has(n)?"text":iAe.has(n)?"image":sAe.has(n)?"video":"binary"}function oAe(e){switch(e){case"markdown":case"text":return rv;case"image":return gE;case"video":return dJ;default:return Ul}}function YU(e){const n=encodeURIComponent(e);return`${Ti}${Gr}/api/artifact-body?location=${n}`}async function yT(e){const n=ns(),r=new Headers;return n&&r.set("Authorization",`Bearer ${n}`),await fetch(YU(e),{headers:r})}function GU({artifact:e,onClose:n}){const r=b.useMemo(()=>aAe(e.location),[e.location]),i=oAe(r);return c.jsxs(yu,{title:e.name||"Artifact",description:e.location,onClose:n,size:"2xl",children:[c.jsxs("div",{className:"flex items-center gap-2 mb-3 text-xs",style:{color:"var(--revka-text-faint)"},children:[c.jsx(i,{className:"h-3.5 w-3.5"}),c.jsx("span",{className:"uppercase tracking-wider",children:r}),c.jsx("span",{children:"·"}),c.jsx("span",{className:"font-mono truncate",children:e.kref})]}),c.jsx(lAe,{artifact:e,kind:r}),c.jsx(fAe,{artifact:e})]})}function lAe({artifact:e,kind:n}){return n==="markdown"||n==="text"?c.jsx(cAe,{artifact:e,asMarkdown:n==="markdown"}):n==="image"?c.jsx(uAe,{artifact:e}):n==="video"?c.jsx(dAe,{artifact:e}):c.jsx(hAe,{artifact:e})}function cAe({artifact:e,asMarkdown:n}){const[r,i]=b.useState(null),[s,a]=b.useState(null);return b.useEffect(()=>{let o=!1;return i(null),a(null),yT(e.location).then(async l=>{if(!l.ok){const u=await l.text().catch(()=>"");throw new Error(u||`HTTP ${l.status}`)}return l.text()}).then(l=>{o||i(l)}).catch(l=>{o||a(l instanceof Error?l.message:String(l))}),()=>{o=!0}},[e.location]),s?c.jsx(xT,{message:s}):r===null?c.jsx(_T,{}):n?c.jsx("div",{className:"rounded-[12px] p-4 overflow-auto max-h-[60vh] text-sm chat-markdown",style:{background:"color-mix(in srgb, var(--revka-bg-elevated) 50%, transparent)",color:"var(--revka-text-primary)"},children:c.jsx(VE,{remarkPlugins:[XE],children:r})}):c.jsx("pre",{className:"rounded-[12px] p-4 overflow-auto max-h-[60vh] text-xs font-mono whitespace-pre-wrap break-words",style:{background:"color-mix(in srgb, var(--revka-bg-elevated) 50%, transparent)",color:"var(--revka-text-primary)"},children:r})}function uAe({artifact:e}){const[n,r]=b.useState(null),[i,s]=b.useState(null);return b.useEffect(()=>{let a=!1,o=null;return r(null),s(null),yT(e.location).then(async l=>{if(!l.ok){const u=await l.text().catch(()=>"");throw new Error(u||`HTTP ${l.status}`)}return l.blob()}).then(l=>{a||(o=URL.createObjectURL(l),r(o))}).catch(l=>{a||s(l instanceof Error?l.message:String(l))}),()=>{a=!0,o&&URL.revokeObjectURL(o)}},[e.location]),i?c.jsx(xT,{message:i}):n?c.jsx("div",{className:"rounded-[12px] p-3 overflow-auto max-h-[60vh] flex items-center justify-center",style:{background:"color-mix(in srgb, var(--revka-bg-elevated) 50%, transparent)"},children:c.jsx("img",{src:n,alt:e.name,className:"max-w-full max-h-[56vh] object-contain",style:{imageRendering:"auto"}})}):c.jsx(_T,{})}function dAe({artifact:e}){const[n,r]=b.useState(null),[i,s]=b.useState(null),[a,o]=b.useState(!1),l=b.useRef(null);return b.useEffect(()=>{let u=!1,d=null;return r(null),s(null),o(!1),yT(e.location).then(async p=>{if(!p.ok){const f=await p.text().catch(()=>"");throw new Error(f||`HTTP ${p.status}`)}return p.blob()}).then(p=>{u||(d=URL.createObjectURL(p),r(d))}).catch(p=>{u||s(p instanceof Error?p.message:String(p))}),()=>{u=!0,d&&URL.revokeObjectURL(d)}},[e.location]),i?c.jsx(xT,{message:i}):n?a?c.jsxs("div",{className:"space-y-3",children:[c.jsxs("div",{className:"rounded-[12px] p-4 flex items-start gap-3 text-sm",style:{background:"color-mix(in srgb, var(--revka-status-warning) 10%, transparent)",color:"var(--revka-text-primary)",border:"1px solid color-mix(in srgb, var(--revka-status-warning) 30%, transparent)"},children:[c.jsx(tv,{className:"h-4 w-4 shrink-0 mt-0.5",style:{color:"var(--revka-status-warning)"}}),c.jsxs("div",{className:"space-y-1",children:[c.jsx("div",{className:"font-medium",children:"Browser can't decode this video"}),c.jsx("div",{className:"text-xs",style:{color:"var(--revka-text-secondary)"},children:"Web video viewers support MP4 (H.264/H.265), WebM (VP8/VP9/AV1), and Ogg. Other codecs (ProRes, DNxHD, MXF, etc.) need an external player."})]})]}),c.jsx(XU,{artifact:e})]}):c.jsx("div",{className:"rounded-[12px] p-3 overflow-hidden max-h-[60vh] flex items-center justify-center",style:{background:"color-mix(in srgb, var(--revka-bg-elevated) 50%, transparent)"},children:c.jsx("video",{ref:l,src:n,controls:!0,className:"max-w-full max-h-[56vh]",onError:()=>o(!0),children:"Your browser does not support the video tag."})}):c.jsx(_T,{})}function hAe({artifact:e}){return c.jsxs("div",{className:"space-y-3",children:[c.jsxs("div",{className:"rounded-[12px] p-4 flex items-start gap-3 text-sm",style:{background:"color-mix(in srgb, var(--revka-bg-elevated) 50%, transparent)",color:"var(--revka-text-secondary)"},children:[c.jsx(Ul,{className:"h-4 w-4 shrink-0 mt-0.5",style:{color:"var(--revka-text-faint)"}}),c.jsxs("div",{children:["No inline preview for ",c.jsxs("span",{className:"font-mono",children:[".",KU(e.location)||"bin"]})," files. Open externally or copy the path below."]})]}),c.jsx(XU,{artifact:e})]})}function XU({artifact:e}){const[n,r]=b.useState(!1),i=async()=>{try{await navigator.clipboard.writeText(e.location),r(!0),setTimeout(()=>r(!1),1600)}catch{}},s=()=>{const a=YU(e.location);window.open(a,"_blank","noopener,noreferrer")};return c.jsxs("div",{className:"rounded-[12px] p-3 space-y-2",style:{background:"color-mix(in srgb, var(--revka-bg-elevated) 50%, transparent)"},children:[c.jsx("div",{className:"text-xs font-mono break-all",style:{color:"var(--revka-text-secondary)"},children:e.location}),c.jsxs("div",{className:"flex gap-2",children:[c.jsxs("button",{type:"button",onClick:i,className:"inline-flex items-center gap-1.5 rounded-[8px] px-2.5 py-1.5 text-xs font-medium transition",style:{background:"var(--revka-bg-elevated)",color:"var(--revka-text-primary)",border:"1px solid var(--revka-border-strong)"},children:[n?c.jsx(Za,{className:"h-3.5 w-3.5"}):c.jsx(Xl,{className:"h-3.5 w-3.5"}),n?"Copied":"Copy path"]}),c.jsxs("button",{type:"button",onClick:s,className:"inline-flex items-center gap-1.5 rounded-[8px] px-2.5 py-1.5 text-xs font-medium transition",style:{background:"var(--revka-bg-elevated)",color:"var(--revka-text-primary)",border:"1px solid var(--revka-border-strong)"},children:[c.jsx(CB,{className:"h-3.5 w-3.5"}),"Open externally"]})]})]})}function fAe({artifact:e}){const n=e.created_at?new Date(e.created_at):null,r=n&&!Number.isNaN(n.getTime())?n.toLocaleString():null;return c.jsxs("div",{className:"mt-4 pt-3 border-t text-xs flex items-center gap-3 flex-wrap",style:{borderColor:"var(--revka-border)",color:"var(--revka-text-faint)"},children:[r?c.jsxs("span",{children:["Created ",r]}):null,e.deprecated?c.jsx("span",{style:{color:"var(--revka-status-warning)"},children:"Deprecated"}):null]})}function _T(){return c.jsx("div",{className:"rounded-[12px] p-6 text-center text-sm",style:{background:"color-mix(in srgb, var(--revka-bg-elevated) 50%, transparent)",color:"var(--revka-text-faint)"},children:"Loading…"})}function xT({message:e}){return c.jsxs("div",{className:"rounded-[12px] p-4 flex items-start gap-3 text-sm",style:{background:"color-mix(in srgb, var(--revka-status-error) 10%, transparent)",color:"var(--revka-text-primary)",border:"1px solid color-mix(in srgb, var(--revka-status-error) 30%, transparent)"},children:[c.jsx(tv,{className:"h-4 w-4 shrink-0 mt-0.5",style:{color:"var(--revka-status-error)"}}),c.jsx("div",{className:"break-words",children:e})]})}function p2(e){return e instanceof Error&&/\bAPI 404\b/.test(e.message)}function q6(e,n){if(!e)return null;const r=e.toLowerCase(),i=n.find(s=>s.kref.toLowerCase()===r||s.name.toLowerCase()===r);return(i==null?void 0:i.name)??e}function yf(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}function $c(e){if(e==null)return"";if(typeof e=="string")return e;if(typeof e=="number"||typeof e=="boolean")return String(e);try{return JSON.stringify(e)}catch{return String(e)}}function QU(e,n=220){const r=e.replace(/\s+/g," ").trim();return r.length>n?`${r.slice(0,n-1)}…`:r}function H_(e){const n=yf(e);return Object.keys(n).length>0}function pAe(e){try{return JSON.stringify(e??{},null,2)}catch{return $c(e)}}function U6(e){if(!e||e.status!=="failed")return"";const n=yf(e.input_data),r=yf(e.output_data),i=[e.error,r.error,r.entity_error,r.entity_artifact_error,r.entity_tag_error,r.register_output_error,r.structured_output_error,r.stderr,r.stderr_preview,yf(r.error_message).content,n.command?`command: ${n.command}`:"",n.code_preview?`python: ${n.code_preview}`:""];for(const s of i){const a=QU($c(s));if(a)return a}return""}function mAe({run:e,className:n=""}){const{tpl:r}=cn(),i=nA(e),s=rA(e,r);return c.jsxs("div",{className:n,style:{color:"var(--revka-text-faint)"},children:[c.jsx("span",{children:r("runs.stats.steps_fraction",{completed:e.steps_completed||"0",total:e.steps_total||"?"})}),i!==null?c.jsx("span",{children:r("runs.stats.expanded_steps",{count:i})}):null,s?c.jsx("span",{className:"font-mono",children:s}):null]})}function V6(e){if(!e||e.status!=="completed")return null;const n=yf(e.input_data),r=yf(e.output_data),i=r.matched_branch_index??n.matched_branch_index,s=typeof i=="number"?i:Number($c(i)),o=$c(r.matched_branch_label)||(Number.isFinite(s)&&s>=0?`Branch ${s+1}`:"No branch matched"),l=$c(r.matched_output??e.output_preview);return{label:o,goto:$c(r.matched_goto),condition:$c(r.matched_condition??n.matched_condition),valueExpr:$c(r.matched_value_expr??n.matched_value_expr),output:l}}function gAe(){var Ee,rt,Ye,it,kt,mt,zt;const{t:e,tpl:n}=cn(),{dismiss:r}=ZE(),[i,s]=Jg(),[a,o]=b.useState([]),[l,u]=b.useState([]),[d,p]=b.useState(null),[f,g]=b.useState(null),[_,x]=b.useState(null),[v,S]=b.useState(null),[w,N]=b.useState(null),[C,T]=b.useState(!1),[A,E]=b.useState(!1),[D,F]=b.useState(null),[B,H]=b.useState(!1),[$,z]=b.useState(!1),[W,P]=b.useState(!1),[q,I]=b.useState("all"),[Q,K]=b.useState("summary"),[Z,Y]=b.useState([]),[R,U]=b.useState(!1),[V,ie]=b.useState("formatted"),[te,X]=b.useState(""),[se,re]=b.useState(null),[de,ue]=b.useState(null),[ae,pe]=b.useState(!1),J=b.useRef(null),me=async()=>(E(!0),Promise.all([vB(25),gB(!0,!1)]).then(async([xe,qe])=>{var Yt,L;const dt=i.get("run"),sn=i.get("workflow");let nn=xe,Kt=!1;if(dt&&!xe.some(Qe=>Qe.run_id===dt)){const Qe=await To(dt).catch(_t=>{if(p2(_t))return r(dt),Kt=!0,null;throw _t});if(Qe){const{steps:_t,...Gt}=Qe;nn=[Gt,...xe]}}Kt&&s(Qe=>{const _t=new URLSearchParams(Qe);return _t.delete("run"),_t},{replace:!0}),o(nn),u(qe);const rr=q6(sn,qe),yi=rr?nn.filter(Qe=>Qe.workflow_name.toLowerCase()===rr.toLowerCase()):nn;p((Kt?null:dt)??((Yt=yi[0])==null?void 0:Yt.run_id)??((L=nn[0])==null?void 0:L.run_id)??null)}).catch(xe=>F(xe.message)).finally(()=>E(!1)));b.useEffect(()=>{me()},[]);const fe=i.get("run");b.useEffect(()=>{!fe||fe===d||(p(fe),a.some(xe=>xe.run_id===fe)||To(fe).then(xe=>{const{steps:qe,...dt}=xe;o(sn=>sn.some(nn=>nn.run_id===fe)?sn:[dt,...sn])}).catch(xe=>{p2(xe)&&(r(fe),s(qe=>{const dt=new URLSearchParams(qe);return dt.delete("run"),dt},{replace:!0}))}))},[fe]),b.useEffect(()=>{if(!d)return;const xe=d;x(null);let qe=!1,dt=null,sn=null;const nn=new Set(["completed","failed","cancelled"]),Kt=4e3,rr=un=>{dt=setTimeout(yi,un)},yi=()=>{To(xe).then(un=>{if(qe)return;g(un);const{steps:Yt,...L}=un;if(o(Qe=>Qe.map(_t=>_t.run_id===un.run_id?{..._t,...L}:_t)),un.workflow_revision_kref&&un.workflow_revision_kref!==sn&&(sn=un.workflow_revision_kref,e0(un.workflow_revision_kref).then(Qe=>{qe||x(Qe)}).catch(()=>{qe||x(null)})),un.status==="running"||un.status==="pending"||un.status==="paused")rr(Kt);else if(!nn.has(un.status))return}).catch(un=>{if(!qe){if(p2(un)){r(xe),g(null),p(null),s(Yt=>{const L=new URLSearchParams(Yt);return L.delete("run"),L},{replace:!0});return}F(un instanceof Error?un.message:String(un))}})};return yi(),()=>{qe=!0,dt&&clearTimeout(dt)}},[d]),b.useEffect(()=>{var xe,qe;!ae||!f||((xe=J.current)==null||xe.scrollIntoView({behavior:"smooth",block:"start"}),(qe=J.current)==null||qe.focus({preventScroll:!0}),pe(!1))},[f,ae]);const ve=b.useMemo(()=>{if(!f)return null;if(_)return _;const xe=f.workflow_name.toLowerCase();return l.find(qe=>qe.name.toLowerCase()===xe)??null},[l,_,f]),Ke=b.useMemo(()=>{const xe=q6(i.get("workflow"),l);if(!xe)return a;const qe=xe.toLowerCase();return a.filter(dt=>dt.workflow_name.toLowerCase()===qe)},[l,a,i]),ge=b.useMemo(()=>ve?Bo(ve.definition):[],[ve]);b.useEffect(()=>{const xe=i.get("node");if(!xe){S(null);return}S(ge.find(qe=>qe.id===xe)??null)},[i,ge]),b.useEffect(()=>{const xe=i.get("path");(xe==="failed"||xe==="blocked"||xe==="all")&&I(xe)},[i]);const Ue=b.useMemo(()=>f?Object.fromEntries(f.steps.map(xe=>[xe.step_id,Xs(xe)])):{},[f]),$e=b.useMemo(()=>v&&f?f.steps.find(xe=>xe.step_id===v.id)??null:null,[f,v]);b.useEffect(()=>{if(!v){K("summary");return}K($e!=null&&$e.agent_id?"jsonl":"summary")},[d,v==null?void 0:v.id,$e==null?void 0:$e.agent_id]);const Bt=b.useMemo(()=>U6($e),[$e]),ct=b.useMemo(()=>(v==null?void 0:v.type)==="conditional"?V6($e):null,[$e,v==null?void 0:v.type]),Mt=b.useMemo(()=>(f==null?void 0:f.steps.find(xe=>{var qe;return((qe=xe.output_data)==null?void 0:qe.awaiting_approval)===!0}))??null,[f]),Tt=b.useMemo(()=>{const xe={pending:0,running:0,completed:0,failed:0,skipped:0};if(!f)return xe;for(const qe of f.steps){const dt=Xs(qe).status;xe[dt]+=1}return xe},[f]),Dt=b.useMemo(()=>NF({tasks:ge,stepResults:Ue}),[ge,Ue]),Re=b.useMemo(()=>(f==null?void 0:f.steps.filter(xe=>Xs(xe).status==="failed"))??[],[f]),et=b.useMemo(()=>(f==null?void 0:f.steps.filter(xe=>Xs(xe).status==="running"))??[],[f]),bt=b.useMemo(()=>ge.filter(xe=>Dt.includes(xe.id)),[Dt,ge]),yt=b.useMemo(()=>[...Re.map(xe=>ge.find(qe=>qe.id===xe.step_id)??null).filter(xe=>xe!==null),...et.map(xe=>ge.find(qe=>qe.id===xe.step_id)??null).filter(xe=>xe!==null).filter(xe=>!Re.some(qe=>qe.step_id===xe.id)),...bt.filter(xe=>!Re.some(qe=>qe.step_id===xe.id))],[bt,Re,et,ge]),O=b.useMemo(()=>sP({startTaskIds:Re.map(xe=>xe.step_id),tasks:ge}),[Re,ge]),ke=b.useMemo(()=>sP({startTaskIds:Dt,tasks:ge}),[Dt,ge]),Le=b.useMemo(()=>{if(q==="all")return[];const xe=new Set(q==="failed"?O:ke);return ge.map(qe=>qe.id).filter(qe=>!xe.has(qe))},[ke,O,q,ge]),ye=b.useMemo(()=>{if(!te)return Z;const xe=te.toLowerCase();return Z.filter(qe=>{try{return JSON.stringify(qe).toLowerCase().includes(xe)}catch{return!1}})},[Z,te]);b.useEffect(()=>{const xe=$e==null?void 0:$e.agent_id;if(!xe){N(null),T(!1);return}T(!0),P3(xe,"summary",50).then(qe=>N(qe)).catch(()=>N(null)).finally(()=>T(!1))},[$e==null?void 0:$e.agent_id]),b.useEffect(()=>{const xe=$e==null?void 0:$e.agent_id;if(!xe||Q!=="jsonl"){Y([]);return}let qe=!1;return U(!0),P3(xe,"full",150).then(dt=>{qe||Y(dt.entries||[])}).catch(()=>{qe||Y([])}).finally(()=>{qe||U(!1)}),()=>{qe=!0}},[$e==null?void 0:$e.agent_id,Q,f]),b.useEffect(()=>{const xe=qe=>{if(qe.metaKey||qe.ctrlKey||qe.altKey)return;const dt=qe.target;if(dt&&["INPUT","TEXTAREA","SELECT"].includes(dt.tagName)||yt.length===0)return;const sn=yt.findIndex(nn=>nn.id===(v==null?void 0:v.id));qe.key==="j"&&(qe.preventDefault(),S(yt[sn>=0?(sn+1)%yt.length:0]??null)),qe.key==="k"&&(qe.preventDefault(),S(yt[sn>=0?(sn-1+yt.length)%yt.length:yt.length-1]??null))};return window.addEventListener("keydown",xe),()=>window.removeEventListener("keydown",xe)},[yt,v==null?void 0:v.id]),b.useEffect(()=>{f&&s(xe=>{const qe=new URLSearchParams(xe);return qe.set("run",d??f.run_id),qe.set("workflow",f.workflow_name),qe.set("path",q),v!=null&&v.id?qe.set("node",v.id):qe.delete("node"),qe},{replace:!0})},[q,d,f==null?void 0:f.run_id,f==null?void 0:f.workflow_name,v==null?void 0:v.id,s]);const _e=async()=>{if(f){z(!0);try{const xe=f.run_id.slice(0,8);await QQ(f.run_id),re({tone:"success",message:n("runs.toast.retry_started",{id:xe})});const qe=await To(f.run_id).catch(()=>null);qe&&g(qe),await me()}catch(xe){re({tone:"error",message:xe instanceof Error?xe.message:e("runs.err.retry")})}finally{z(!1)}}},Pe=async()=>{if(!(!f||W)){P(!0);try{const xe=f.run_id.slice(0,8);await ZQ(f.run_id),re({tone:"success",message:n("runs.toast.stop_requested",{id:xe})});const qe=await To(f.run_id).catch(()=>null);qe&&g(qe),await me()}catch(xe){re({tone:"error",message:xe instanceof Error?xe.message:e("runs.err.stop")})}finally{P(!1)}}},ee=async()=>{if(f){H(!0);try{const xe=f.run_id.slice(0,8);await GQ(f.run_id),S(null),g(null),p(null),await me(),re({tone:"success",message:n("runs.toast.deleted",{id:xe})})}catch(xe){F(xe instanceof Error?xe.message:e("runs.err.delete")),re({tone:"error",message:xe instanceof Error?xe.message:e("runs.err.delete")})}finally{H(!1)}}},le=xe=>{S(ge.find(qe=>qe.id===xe)??null)},je=()=>{const xe=yt.findIndex(qe=>qe.id===(v==null?void 0:v.id));S(yt[xe>=0?(xe-1+yt.length)%yt.length:yt.length-1]??null)},Te=()=>{const xe=yt.findIndex(qe=>qe.id===(v==null?void 0:v.id));S(yt[xe>=0?(xe+1)%yt.length:0]??null)},Me={summary:e("runs.tab.summary"),output:e("runs.tab.output"),tools:e("runs.tab.tools"),transcript:e("runs.tab.transcript"),jsonl:e("runs.tab.jsonl")},Ne={summary:c.jsx(rv,{className:"h-4 w-4"}),output:c.jsx(oJ,{className:"h-4 w-4"}),tools:c.jsx(l0,{className:"h-4 w-4"}),transcript:c.jsx(aC,{className:"h-4 w-4"}),jsonl:c.jsx(GZ,{className:"h-4 w-4"})};return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"flex min-h-[calc(100vh-6rem)] flex-col gap-4",children:[se?c.jsx(Qo,{tone:se.tone,message:se.message,onDismiss:()=>re(null)}):null,c.jsx(si,{kicker:e("runs.kicker"),title:e("runs.title"),actions:c.jsxs("button",{className:"revka-button",onClick:()=>void me(),disabled:A,children:[c.jsx($r,{className:`h-4 w-4 ${A?"animate-spin":""}`})," ",e("runs.refresh")]})}),c.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-4",children:[c.jsxs("div",{ref:J,tabIndex:-1,className:"flex min-h-0 flex-col gap-3 outline-none lg:h-[clamp(38rem,64vh,52rem)]",children:[f?c.jsxs("div",{className:"flex shrink-0 flex-wrap items-center justify-between gap-3",children:[c.jsxs("div",{className:"flex min-w-0 flex-1 flex-wrap items-center gap-3",children:[c.jsx("select",{className:"revka-input min-h-[2.5rem] w-full max-w-full py-2 text-sm sm:w-[24rem]",value:d??"","aria-label":e("runs.index.title"),onChange:xe=>{const qe=xe.target.value||null;p(qe),S(null),pe(!0),s(dt=>{const sn=new URLSearchParams(dt);return qe?sn.set("run",qe):sn.delete("run"),sn},{replace:!0})},children:Ke.map(xe=>c.jsxs("option",{value:xe.run_id,children:[xe.workflow_name," / ",xe.run_id.slice(0,8)," · ",xe.status," · ",xe.steps_completed||0,"/",xe.steps_total||"?"]},xe.run_id))}),c.jsxs("span",{className:"min-w-0 truncate text-sm font-semibold",style:{color:"var(--revka-text-primary)"},children:[f.workflow_name," / ",f.run_id.slice(0,8)]}),c.jsx($a,{status:f.status}),ve?c.jsx(bs,{to:`/workflows?workflow=${encodeURIComponent(ve.kref)}${v?`&node=${encodeURIComponent(v.id)}`:""}`,className:"text-xs",style:{color:"var(--revka-signal-network)"},children:e("runs.open_definition")}):null]}),c.jsxs("div",{className:"flex items-center gap-2",children:[f.status==="failed"?c.jsxs("button",{className:"revka-button",onClick:_e,disabled:$,title:e("runs.action.retry_tooltip"),style:{background:"var(--revka-signal-selected-soft, color-mix(in srgb, var(--revka-signal-selected) 18%, transparent))",color:"var(--revka-signal-selected)",borderColor:"var(--revka-signal-selected)"},children:[c.jsx(CJ,{className:`h-3.5 w-3.5 ${$?"animate-spin":""}`}),c.jsx("span",{className:"ml-1 text-xs",children:e($?"runs.action.retrying":"runs.action.retry_failed")})]}):null,f.status==="running"||f.status==="pending"||f.status==="paused"?c.jsxs("button",{className:"revka-button",onClick:Pe,disabled:W,title:e("runs.action.stop_tooltip"),children:[W?c.jsx($r,{className:"h-3.5 w-3.5 animate-spin"}):c.jsx(RB,{className:"h-3.5 w-3.5"}),c.jsx("span",{className:"ml-1 text-xs",children:e(W?"runs.action.stopping":"runs.action.stop")})]}):null,c.jsx("button",{className:"revka-button",onClick:ee,disabled:B,title:e("runs.action.delete_tooltip"),children:c.jsx(Wi,{className:"h-3.5 w-3.5"})})]})]}):null,c.jsx(P$,{run:f,active:ae,label:e("runs.banner.label")}),f&&ve?c.jsx("div",{className:"md:hidden",children:c.jsx(qc,{title:e("runs.overlay.path_mode"),children:c.jsxs("div",{className:"flex flex-wrap gap-2",children:[c.jsx(Mh,{label:e("runs.overlay.path.all"),active:q==="all",onClick:()=>I("all")}),c.jsx(Mh,{label:e("runs.overlay.path.failed"),active:q==="failed",onClick:()=>I("failed")}),c.jsx(Mh,{label:e("runs.overlay.path.blocked"),active:q==="blocked",onClick:()=>I("blocked")})]})})}):null,c.jsx("div",{className:"flex h-[30rem] min-h-0 flex-col lg:h-auto lg:flex-1",children:f&&ve?c.jsx(NA,{definition:ve.definition,stepResults:Ue,onSelectTask:S,selectedTaskId:v==null?void 0:v.id,hiddenTaskIds:Le,blockedTaskIds:Dt,failingTaskIds:Re.map(xe=>xe.step_id),runningTaskIds:et.map(xe=>xe.step_id),fill:!0,overlay:c.jsxs("div",{className:"hidden space-y-2 md:block",children:[c.jsxs(qc,{title:e("runs.overlay.path_mode"),children:[c.jsx(vAe,{}),c.jsxs("div",{className:"flex flex-wrap gap-2",children:[c.jsx(Mh,{label:e("runs.overlay.path.all"),active:q==="all",onClick:()=>I("all")}),c.jsx(Mh,{label:e("runs.overlay.path.failed"),active:q==="failed",onClick:()=>I("failed")}),c.jsx(Mh,{label:e("runs.overlay.path.blocked"),active:q==="blocked",onClick:()=>I("blocked")})]})]}),yt.length>0?c.jsx(qc,{title:e("runs.overlay.signals"),children:c.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[c.jsx(Zx,{label:e("runs.overlay.prev"),hint:"K",onClick:je}),c.jsx(Zx,{label:e("runs.overlay.next"),hint:"J",onClick:Te}),c.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-[0.12em]",style:{color:"var(--revka-text-faint)"},children:n("runs.overlay.signal_count",{count:yt.length})})]})}):null,c.jsx(qc,{title:e("runs.overlay.posture"),children:c.jsxs("div",{className:"grid gap-2 sm:grid-cols-2 xl:grid-cols-5",children:[c.jsx(Ro,{label:e("runs.overlay.running"),value:Tt.running,tone:"var(--revka-signal-live)"}),c.jsx(Ro,{label:e("runs.overlay.failed"),value:Tt.failed,tone:"var(--revka-status-danger)"}),c.jsx(Ro,{label:e("runs.overlay.done"),value:Tt.completed,tone:"var(--revka-signal-selected)"}),c.jsx(Ro,{label:e("runs.overlay.pending"),value:Tt.pending,tone:"var(--revka-text-faint)"}),c.jsx(Ro,{label:e("runs.overlay.skipped"),value:Tt.skipped,tone:"var(--revka-status-idle)"})]})}),Re.length>0||et.length>0||bt.length>0?c.jsx(qc,{title:e("runs.overlay.hotspots"),children:c.jsxs("div",{className:"flex flex-wrap gap-2",children:[Re.slice(0,3).map(xe=>c.jsx(of,{label:n("runs.overlay.fail_label",{id:xe.step_id}),tone:"var(--revka-status-danger)",onClick:()=>le(xe.step_id)},xe.step_id)),et.slice(0,2).map(xe=>c.jsx(of,{label:n("runs.overlay.run_label",{id:xe.step_id}),tone:"var(--revka-signal-live)",onClick:()=>le(xe.step_id)},xe.step_id)),bt.slice(0,3).map(xe=>c.jsx(of,{label:n("runs.overlay.block_label",{id:xe.id}),tone:"var(--revka-status-warning)",onClick:()=>le(xe.id)},xe.id))]})}):null]})}):c.jsx(st,{className:"flex h-full items-center justify-center",variant:"secondary",children:c.jsx(Ct,{tone:D?"error":Ke.length===0?"empty":void 0,title:D?e("runs.error.title"):Ke.length===0?e("runs.empty.title"):e("runs.none_selected.title"),description:D??(Ke.length===0?e("runs.empty.desc"):e("runs.none_selected.desc"))})})})]}),c.jsxs("div",{className:"grid gap-4 lg:grid-cols-[minmax(14rem,0.24fr)_minmax(0,1fr)]",children:[c.jsxs("div",{className:"min-h-0 max-h-[18rem] space-y-3 overflow-y-auto lg:max-h-[24rem]",children:[f?c.jsxs(st,{className:"mb-3 p-3",variant:"utility",children:[c.jsxs("div",{className:"flex items-center justify-between gap-2 text-xs",children:[c.jsx($a,{status:f.status}),c.jsx(mAe,{className:"flex flex-wrap items-center justify-end gap-2",run:f})]}),f.started_at?c.jsx("div",{className:"mt-2 text-xs",style:{color:"var(--revka-text-faint)"},children:n("runs.started_at",{time:Sf(f.started_at)})}):null,f.error?c.jsx("div",{className:"mt-2 rounded-[10px] border p-2 text-xs",style:{borderColor:"color-mix(in srgb, var(--revka-status-danger) 28%, transparent)",color:"var(--revka-status-danger)"},children:f.error}):null]}):null,f&&Mt?c.jsx("div",{className:"mb-3",children:c.jsx(eAe,{runId:f.run_id,stepId:Mt.step_id,stepName:Mt.step_id,message:typeof((Ee=Mt.output_data)==null?void 0:Ee.approval_message)=="string"?Mt.output_data.approval_message:"",approveKeywords:Array.isArray((rt=Mt.output_data)==null?void 0:rt.approve_keywords)?Mt.output_data.approve_keywords.map(String):void 0,rejectKeywords:Array.isArray((Ye=Mt.output_data)==null?void 0:Ye.reject_keywords)?Mt.output_data.reject_keywords.map(String):void 0,onResolved:()=>{To(f.run_id).then(g).catch(()=>{}),me()}},Mt.step_id)}):null,f?c.jsxs(st,{className:"p-3",variant:"utility",children:[c.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-[0.14em]",style:{color:"var(--revka-text-faint)"},children:n("runs.timeline",{count:f.steps.length})}),c.jsx("div",{className:"mt-2 space-y-1",children:f.steps.map(xe=>{var sn;const qe=U6(xe),dt=((sn=ge.find(nn=>nn.id===xe.step_id))==null?void 0:sn.type)==="conditional"?V6(xe):null;return c.jsxs("button",{type:"button",onClick:()=>S(ge.find(nn=>nn.id===xe.step_id)??null),className:"flex w-full items-center justify-between gap-2 rounded-[10px] px-3 py-2 text-left transition",style:{background:(v==null?void 0:v.id)===xe.step_id?"var(--revka-signal-selected-soft, color-mix(in srgb, var(--revka-signal-selected) 18%, transparent))":"transparent"},children:[c.jsxs("span",{className:"min-w-0 flex-1",children:[c.jsx("span",{className:"block truncate text-sm",style:{color:"var(--revka-text-primary)"},children:xe.step_id}),qe?c.jsx("span",{className:"mt-0.5 block truncate text-[11px]",style:{color:"var(--revka-status-danger)"},children:qe}):dt?c.jsxs("span",{className:"mt-0.5 block truncate text-[11px]",style:{color:"var(--revka-text-secondary)"},children:[dt.label,dt.goto?` -> ${dt.goto}`:"",dt.output?` · ${QU(dt.output,90)}`:""]}):null]}),c.jsx($a,{status:xe.status})]},xe.step_id)})})]}):null]}),c.jsxs(st,{className:"min-w-0 overflow-hidden p-4",variant:"secondary",children:[c.jsxs("div",{className:"flex flex-col gap-3",children:[c.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[c.jsx("span",{className:"min-w-0 truncate text-[11px] font-semibold uppercase tracking-[0.14em]",style:{color:"var(--revka-text-faint)"},children:v?v.name||v.id:e("runs.inspector.title")}),$e?c.jsx($a,{status:$e.status}):null]}),c.jsx("div",{className:"revka-run-tab-grid",role:"tablist","aria-label":e("runs.inspector.title"),children:["summary","output","tools","transcript","jsonl"].map(xe=>c.jsxs("button",{type:"button",role:"tab","aria-selected":Q===xe,className:"revka-run-tab-button","data-active":String(Q===xe),onClick:()=>K(xe),children:[Ne[xe],c.jsx("span",{children:Me[xe]})]},xe))})]}),c.jsxs("div",{className:"mt-3 min-w-0 overflow-visible pr-1 lg:max-h-[34rem] lg:overflow-y-auto",children:[Q==="summary"?v?c.jsxs("div",{className:"space-y-2",children:[c.jsxs("div",{className:"flex items-center justify-between gap-2",children:[c.jsx("span",{className:"text-sm font-semibold",style:{color:"var(--revka-text-primary)"},children:v.name||v.id}),$e?c.jsx($a,{status:$e.status}):null]}),c.jsx("div",{className:"text-xs uppercase tracking-[0.12em]",style:{color:"var(--revka-text-faint)"},children:v.type}),c.jsx("p",{className:"text-sm leading-6",style:{color:"var(--revka-text-secondary)"},children:v.description||e("runs.detail.no_description")}),c.jsx("div",{className:"text-xs",style:{color:"var(--revka-text-secondary)"},children:n("runs.detail.depends_on",{list:v.depends_on.join(", ")||e("runs.detail.depends_none")})}),$e?c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"text-xs",style:{color:"var(--revka-text-secondary)"},children:n("runs.detail.agent",{type:$e.agent_type||e("runs.detail.agent_na"),role:$e.role?` / ${$e.role}`:""})}),(it=$e.skills)!=null&&it.length?c.jsx("div",{className:"text-xs",style:{color:"var(--revka-text-secondary)"},children:n("runs.detail.skills",{list:$e.skills.join(", ")})}):null,$e.output_preview?c.jsx("div",{className:"rounded-[10px] border p-2 text-xs leading-6 break-words",style:{borderColor:"var(--revka-border-soft)",color:"var(--revka-text-secondary)"},children:$e.output_preview}):null,ct?c.jsx(K6,{title:"Resolved Branch",tone:"success",children:c.jsxs("div",{className:"space-y-1",children:[c.jsxs("div",{children:[ct.label,ct.goto?` -> ${ct.goto}`:""]}),ct.condition?c.jsxs("div",{children:["Condition: ",ct.condition]}):null,ct.valueExpr?c.jsxs("div",{children:["Value: ",ct.valueExpr]}):null,ct.output?c.jsxs("div",{children:["Output: ",ct.output]}):null]})}):null,Bt?c.jsx(K6,{title:"Failure Detail",tone:"danger",children:Bt}):null]}):null,ve?c.jsx("div",{className:"flex flex-wrap gap-3 pt-1 text-xs",children:c.jsx(bs,{to:`/workflows?workflow=${encodeURIComponent(ve.kref)}&node=${encodeURIComponent(v.id)}`,style:{color:"var(--revka-signal-network)"},children:e("runs.detail.definition_link")})}):null]}):c.jsx("div",{className:"text-sm",style:{color:"var(--revka-text-faint)"},children:e("runs.detail.select_node")}):null,Q==="output"?$e?c.jsxs("div",{className:"space-y-3",children:[$e.input_data&&H_($e.input_data)?c.jsx(Y6,{title:"Resolved Inputs",value:$e.input_data}):null,$e.output_data&&H_($e.output_data)?c.jsx(Y6,{title:"Structured Output",value:$e.output_data}):null,$e.output_preview?c.jsxs("div",{className:"rounded-[10px] border p-3",style:{borderColor:"var(--revka-border-soft)"},children:[c.jsxs("div",{className:"mb-2 flex items-center justify-between gap-2",children:[c.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-[0.12em]",style:{color:"var(--revka-text-faint)"},children:e("runs.detail.step_output")}),$e.artifact_path?c.jsxs("button",{type:"button",onClick:()=>ue({kref:`step:${$e.step_id}`,name:$e.step_id,location:$e.artifact_path??"",revision_kref:"",item_kref:"",deprecated:!1}),className:"inline-flex items-center gap-1 rounded-[6px] px-2 py-0.5 text-[10px] font-medium uppercase tracking-wider transition",style:{background:"var(--revka-bg-elevated)",color:"var(--revka-text-secondary)",border:"1px solid var(--revka-border-strong)"},children:[c.jsx(nv,{className:"h-3 w-3"}),"View full"]}):null]}),c.jsx("pre",{className:"whitespace-pre-wrap break-words text-xs leading-6",style:{color:"var(--revka-text-secondary)",fontFamily:"var(--pc-font-mono)"},children:$e.output_preview})]}):null,w!=null&&w.last_message?c.jsxs("div",{className:"rounded-[10px] border p-3",style:{borderColor:"var(--revka-border-soft)"},children:[c.jsxs("div",{className:"mb-2 flex items-center gap-2 text-[10px] font-semibold uppercase tracking-[0.12em]",style:{color:"var(--revka-text-faint)"},children:[c.jsx(aC,{className:"h-3 w-3"})," ",e("runs.detail.agent_output")]}),c.jsx("pre",{className:"whitespace-pre-wrap break-words text-xs leading-6",style:{color:"var(--revka-text-secondary)",fontFamily:"var(--pc-font-mono)"},children:w.last_message})]}):null,!$e.output_preview&&!(w!=null&&w.last_message)&&!H_($e.input_data)&&!H_($e.output_data)?c.jsx("div",{className:"text-sm",style:{color:"var(--revka-text-faint)"},children:e("runs.detail.no_output")}):null]}):c.jsx("div",{className:"text-sm",style:{color:"var(--revka-text-faint)"},children:e("runs.detail.select_step")}):null,Q==="tools"?$e?C?c.jsx("div",{className:"text-sm",style:{color:"var(--revka-text-faint)"},children:e("runs.detail.loading")}):w?c.jsxs("div",{className:"space-y-2",children:[c.jsxs("div",{className:"grid gap-2 grid-cols-2 text-xs",children:[c.jsxs("div",{className:"rounded-[10px] border p-2",style:{borderColor:"var(--revka-border-soft)"},children:[c.jsx("div",{className:"text-[10px] uppercase tracking-[0.12em]",style:{color:"var(--revka-text-faint)"},children:e("runs.detail.tools_calls")}),c.jsx("div",{className:"mt-1 text-sm font-semibold",style:{color:"var(--revka-text-primary)"},children:w.tool_call_count??((kt=w.recent_tools)==null?void 0:kt.length)??0})]}),c.jsxs("div",{className:"rounded-[10px] border p-2",style:{borderColor:"var(--revka-border-soft)"},children:[c.jsx("div",{className:"text-[10px] uppercase tracking-[0.12em]",style:{color:"var(--revka-text-faint)"},children:e("runs.detail.tools_errors")}),c.jsx("div",{className:"mt-1 text-sm font-semibold",style:{color:"var(--revka-text-primary)"},children:w.error_count??0})]})]}),(w.recent_tools??[]).slice(0,8).map((xe,qe)=>c.jsx(yAe,{tool:xe},`${xe.name??xe.kind}-${xe.ts??qe}`)),(((mt=w.recent_tools)==null?void 0:mt.length)??0)===0?c.jsx("div",{className:"text-sm",style:{color:"var(--revka-text-faint)"},children:e("runs.detail.no_tools")}):null]}):c.jsx("div",{className:"text-sm",style:{color:"var(--revka-text-faint)"},children:e("runs.detail.no_activity")}):c.jsx("div",{className:"text-sm",style:{color:"var(--revka-text-faint)"},children:e("runs.detail.select_step")}):null,Q==="transcript"?$e?(zt=$e.transcript)!=null&&zt.length?c.jsx("div",{className:"space-y-2",children:$e.transcript.map((xe,qe)=>c.jsxs("div",{className:"rounded-[10px] border p-2",style:{borderColor:"var(--revka-border-soft)"},children:[c.jsxs("div",{className:"flex items-center justify-between gap-2 text-[10px] font-semibold uppercase tracking-[0.12em]",style:{color:"var(--revka-text-faint)"},children:[c.jsx("span",{children:xe.speaker}),c.jsxs("span",{children:["R",xe.round]})]}),c.jsx("pre",{className:"mt-1 whitespace-pre-wrap text-xs leading-6",style:{color:"var(--revka-text-secondary)",fontFamily:"var(--pc-font-mono)"},children:xe.content})]},`${xe.round}-${xe.speaker}-${qe}`))}):c.jsx("div",{className:"text-sm",style:{color:"var(--revka-text-faint)"},children:e("runs.detail.no_transcript")}):c.jsx("div",{className:"text-sm",style:{color:"var(--revka-text-faint)"},children:e("runs.detail.select_step")}):null,Q==="jsonl"?$e?R&&Z.length===0?c.jsx("div",{className:"text-sm",style:{color:"var(--revka-text-faint)"},children:e("runs.detail.loading")}):c.jsxs("div",{className:"space-y-3",children:[c.jsxs("div",{className:"flex flex-col gap-2 rounded-[10px] border p-2.5",style:{borderColor:"var(--revka-border-soft)",background:"color-mix(in srgb, var(--revka-bg-panel-strong) 40%, transparent)"},children:[c.jsxs("div",{className:"flex items-center justify-between gap-2",children:[c.jsxs("span",{className:"text-[10px] font-semibold uppercase tracking-[0.12em]",style:{color:"var(--revka-text-faint)"},children:["JSONL Log Entries (",ye.length,")"]}),c.jsxs("div",{className:"flex items-center gap-1.5",children:[c.jsx("button",{type:"button",onClick:()=>ie("formatted"),className:"rounded-[6px] px-2 py-0.5 text-[10px] font-medium uppercase tracking-wider transition",style:{background:V==="formatted"?"var(--revka-signal-selected-soft, color-mix(in srgb, var(--revka-signal-selected) 18%, transparent))":"transparent",color:V==="formatted"?"var(--revka-signal-selected)":"var(--revka-text-faint)",border:V==="formatted"?"1px solid var(--revka-signal-selected)":"1px solid transparent"},children:"Formatted"}),c.jsx("button",{type:"button",onClick:()=>ie("raw"),className:"rounded-[6px] px-2 py-0.5 text-[10px] font-medium uppercase tracking-wider transition",style:{background:V==="raw"?"var(--revka-signal-selected-soft, color-mix(in srgb, var(--revka-signal-selected) 18%, transparent))":"transparent",color:V==="raw"?"var(--revka-signal-selected)":"var(--revka-text-faint)",border:V==="raw"?"1px solid var(--revka-signal-selected)":"1px solid transparent"},children:"Raw JSONL"})]})]}),c.jsx("input",{type:"text",value:te,onChange:xe=>X(xe.target.value),placeholder:"Filter log entries...",className:"w-full rounded-[8px] border px-2.5 py-1.5 text-xs outline-none transition",style:{background:"var(--revka-bg-input)",borderColor:"var(--revka-border-soft)",color:"var(--revka-text-primary)"}})]}),ye.length===0?c.jsx("div",{className:"text-center py-4 text-xs",style:{color:"var(--revka-text-faint)"},children:e(te?"runs.detail.no_jsonl_filter":"runs.detail.no_jsonl")}):V==="raw"?c.jsx("div",{className:"rounded-[10px] border p-2 overflow-x-auto max-h-[28rem]",style:{borderColor:"var(--revka-border-soft)",background:"var(--revka-bg-input)"},children:c.jsx("pre",{className:"text-[11px] leading-5",style:{color:"var(--revka-text-secondary)",fontFamily:"var(--pc-font-mono)"},children:ye.map((xe,qe)=>c.jsxs("div",{className:"hover:bg-slate-800/10 dark:hover:bg-slate-200/5 py-0.5 px-1 rounded truncate whitespace-pre",children:[c.jsx("span",{className:"select-none text-slate-500 mr-2 inline-block w-6 text-right",children:qe+1}),JSON.stringify(xe)]},qe))})}):c.jsx("div",{className:"space-y-2 max-h-[32rem] overflow-y-auto pr-1",children:ye.map((xe,qe)=>{const dt=xe.kind||"unknown",sn=xe.ts?new Date(xe.ts).toLocaleTimeString():"";let nn="var(--revka-bg-elevated)",Kt="var(--revka-text-muted)",rr="var(--revka-border-soft)";return dt==="tool_call"?(nn="color-mix(in srgb, var(--revka-signal-network) 12%, transparent)",Kt="var(--revka-signal-network)"):dt==="message"||dt==="user_message"?(nn="color-mix(in srgb, var(--revka-signal-selected) 12%, transparent)",Kt="var(--revka-signal-selected)"):dt==="reasoning"?(nn="color-mix(in srgb, var(--revka-text-faint) 10%, transparent)",Kt="var(--revka-text-faint)"):dt==="error"||dt==="turn_failed"?(nn="color-mix(in srgb, var(--revka-status-danger) 12%, transparent)",Kt="var(--revka-status-danger)",rr="color-mix(in srgb, var(--revka-status-danger) 30%, transparent)"):(dt==="turn_started"||dt==="turn_completed")&&(nn="color-mix(in srgb, var(--revka-status-success) 12%, transparent)",Kt="var(--revka-status-success)"),c.jsxs("div",{className:"rounded-[10px] border p-2.5 transition-all text-xs",style:{borderColor:rr,background:"color-mix(in srgb, var(--revka-bg-panel-strong) 94%, transparent)"},children:[c.jsxs("div",{className:"flex items-center justify-between gap-2 mb-1.5",children:[c.jsxs("div",{className:"flex items-center gap-1.5",children:[c.jsx("span",{className:"rounded-[6px] px-1.5 py-0.5 text-[9px] font-bold uppercase tracking-wider",style:{background:nn,color:Kt},children:dt}),xe.name&&c.jsx("span",{className:"font-semibold",style:{color:"var(--revka-text-primary)"},children:xe.name})]}),c.jsx("span",{className:"text-[10px] font-mono",style:{color:"var(--revka-text-faint)"},children:sn})]}),c.jsx("div",{className:"pl-1 leading-5",style:{color:"var(--revka-text-secondary)"},children:dt==="message"||dt==="user_message"?c.jsx("div",{className:"whitespace-pre-wrap font-sans",style:{color:"var(--revka-text-secondary)"},children:xe.text}):dt==="reasoning"?c.jsx("div",{className:"italic font-serif pl-2 border-l-2",style:{color:"var(--revka-text-muted)",borderColor:"var(--revka-border-soft)"},children:xe.text}):dt==="tool_call"?c.jsxs("div",{className:"space-y-1 font-mono text-[11px]",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{style:{color:"var(--revka-text-faint)"},children:"Status:"}),c.jsx("span",{className:"font-bold uppercase text-[9px]",style:{color:xe.status==="completed"?"var(--revka-status-success)":xe.status==="failed"?"var(--revka-status-danger)":"var(--revka-status-warning)"},children:xe.status||"running"})]}),xe.args&&c.jsxs("div",{className:"mt-1",children:[c.jsx("div",{className:"text-[10px] uppercase tracking-wider mb-0.5",style:{color:"var(--revka-text-faint)"},children:"Arguments:"}),c.jsx("pre",{className:"p-1.5 rounded-[6px] overflow-x-auto whitespace-pre-wrap",style:{background:"var(--revka-bg-input)",borderColor:"var(--revka-border-soft)",border:"1px solid"},children:xe.args})]}),xe.result&&c.jsxs("div",{className:"mt-1",children:[c.jsx("div",{className:"text-[10px] uppercase tracking-wider mb-0.5",style:{color:"var(--revka-text-faint)"},children:"Result:"}),c.jsx("pre",{className:"p-1.5 rounded-[6px] overflow-x-auto whitespace-pre-wrap max-h-40",style:{background:"var(--revka-bg-input)",borderColor:"var(--revka-border-soft)",border:"1px solid"},children:xe.result})]}),xe.error&&c.jsx("div",{className:"mt-1 p-1.5 rounded-[6px] border text-[11px]",style:{borderColor:"color-mix(in srgb, var(--revka-status-danger) 28%, transparent)",background:"color-mix(in srgb, var(--revka-status-danger) 6%, transparent)",color:"var(--revka-status-danger)"},children:xe.error})]}):dt==="error"?c.jsx("div",{className:"font-mono text-xs text-red-500 whitespace-pre-wrap",children:xe.message}):dt==="turn_started"?c.jsxs("div",{className:"font-mono text-[11px]",style:{color:"var(--revka-text-muted)"},children:["Started execution turn ",c.jsx("span",{className:"font-semibold",children:xe.turn_id})]}):dt==="turn_completed"?c.jsxs("div",{className:"font-mono text-[11px] space-y-1",style:{color:"var(--revka-text-muted)"},children:[c.jsxs("div",{children:["Completed execution turn ",c.jsx("span",{className:"font-semibold",children:xe.turn_id})]}),xe.usage&&c.jsxs("div",{className:"flex flex-wrap gap-2.5 text-[10px] mt-0.5",style:{color:"var(--revka-text-faint)"},children:[c.jsxs("span",{children:["In: ",xe.usage.inputTokens||0," t"]}),c.jsxs("span",{children:["Out: ",xe.usage.outputTokens||0," t"]}),c.jsxs("span",{children:["Cost: $",Number(xe.usage.totalCostUsd||0).toFixed(5)]})]})]}):c.jsx("pre",{className:"font-mono text-[10px] p-1.5 rounded-[6px] overflow-x-auto",style:{background:"var(--revka-bg-input)",border:"1px solid var(--revka-border-soft)"},children:JSON.stringify(xe,null,2)})})]},qe)})})]}):c.jsx("div",{className:"text-sm",style:{color:"var(--revka-text-faint)"},children:e("runs.detail.select_step")}):null]})]})]})]})]}),de?c.jsx(GU,{artifact:de,onClose:()=>ue(null)}):null]})}function Mh({label:e,active:n,onClick:r}){return c.jsx("button",{type:"button",onClick:r,className:"min-h-[2.75rem] rounded-[12px] border px-3 py-2 text-xs font-semibold transition-colors",style:{borderColor:n?"var(--revka-border-strong)":"var(--revka-border-soft)",background:n?"var(--revka-signal-selected-soft, color-mix(in srgb, var(--revka-signal-selected) 18%, transparent))":"color-mix(in srgb, var(--revka-bg-panel-strong) 92%, transparent)",color:n?"var(--revka-text-primary)":"var(--revka-text-secondary)"},children:e})}function vAe(){const{t:e}=cn();return c.jsxs("div",{className:"flex flex-wrap gap-2",children:[c.jsx(tm,{label:e("runs.overlay.legend_running"),tone:"var(--revka-signal-live)"}),c.jsx(tm,{label:e("runs.overlay.legend_failure"),tone:"var(--revka-status-danger)"}),c.jsx(tm,{label:e("runs.overlay.legend_blocked"),tone:"var(--revka-status-warning)"}),c.jsx(tm,{label:e("runs.overlay.legend_skipped"),tone:"var(--revka-status-idle)"}),c.jsx(tm,{label:e("runs.overlay.legend_gate"),tone:"var(--revka-signal-network)"})]})}function K6({title:e,tone:n="neutral",children:r}){const i=n==="danger"?"var(--revka-status-danger)":n==="success"?"var(--revka-signal-selected)":"var(--revka-text-faint)",s=n==="neutral"?"transparent":`color-mix(in srgb, ${i} 10%, transparent)`;return c.jsxs("div",{className:"rounded-[10px] border p-2 text-xs leading-6",style:{borderColor:n==="neutral"?"var(--revka-border-soft)":`color-mix(in srgb, ${i} 34%, transparent)`,background:s,color:n==="danger"?"var(--revka-status-danger)":"var(--revka-text-secondary)"},children:[c.jsx("div",{className:"mb-1 text-[10px] font-semibold uppercase tracking-[0.12em]",style:{color:i},children:e}),r]})}function Y6({title:e,value:n}){return c.jsxs("div",{className:"rounded-[10px] border p-3",style:{borderColor:"var(--revka-border-soft)"},children:[c.jsx("div",{className:"mb-2 text-[10px] font-semibold uppercase tracking-[0.12em]",style:{color:"var(--revka-text-faint)"},children:e}),c.jsx("pre",{className:"max-h-72 overflow-auto whitespace-pre-wrap break-words text-xs leading-6",style:{color:"var(--revka-text-secondary)",fontFamily:"var(--pc-font-mono)"},children:pAe(n)})]})}function yAe({tool:e}){const{t:n}=cn(),r=(()=>{try{const s=typeof e.args=="string"?JSON.parse(e.args||"{}"):e.args||{};return e.name==="Bash"||e.name==="execute_command"?s.command||e.command||"":e.name==="WebSearch"||e.name==="web_search"?s.query||"":e.name==="WebFetch"||e.name==="web_fetch"?s.url||"":(e.name==="Read"||e.name==="Write"||e.name==="Edit")&&(s.file_path||s.path)||""}catch{return""}})(),i=e.status==="failed"?"var(--revka-status-danger)":e.status==="completed"?"var(--revka-signal-selected)":"var(--revka-status-warning)";return c.jsxs("div",{className:"rounded-[10px] border p-2",style:{borderColor:"var(--revka-border-soft)"},children:[c.jsxs("div",{className:"flex items-center justify-between gap-2",children:[c.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[c.jsx(l0,{className:"h-3 w-3 shrink-0",style:{color:"var(--revka-signal-network)"}}),c.jsx("span",{className:"truncate text-sm",style:{color:"var(--revka-text-primary)"},children:e.name||e.kind||n("runs.detail.tool_default")})]}),c.jsx("span",{className:"text-[10px] font-semibold uppercase",style:{color:i},children:e.status||n("runs.detail.tool_status_ok")})]}),r?c.jsx("div",{className:"mt-1 truncate text-xs",style:{color:"var(--revka-text-secondary)"},children:r}):null,e.error?c.jsx("div",{className:"mt-1 text-xs",style:{color:"var(--revka-status-danger)"},children:e.error}):null]})}function _Ae(e){return`url("${e.replace(/"/g,"%22")}")`}function xAe({data:e,selected:n}){const r=Dde(e.role),i=n?`linear-gradient(135deg, color-mix(in srgb, ${r} var(--revka-node-accent-selected), transparent), transparent 78%)`:`linear-gradient(180deg, color-mix(in srgb, ${r} var(--revka-node-accent-idle), transparent), transparent 42%)`,s=typeof e.avatarUrl=="string"&&e.avatarUrl?["linear-gradient(90deg, var(--revka-bg-panel-strong) 0%, color-mix(in srgb, var(--revka-bg-panel-strong) 86%, transparent) 52%, color-mix(in srgb, var(--revka-bg-panel-strong) 36%, transparent) 100%)",i,_Ae(e.avatarUrl)].join(", "):i;return c.jsxs("div",{className:"rounded-[8px] border px-4 py-3 shadow-sm",style:{minWidth:200,maxWidth:240,minHeight:132,borderColor:n?r:"color-mix(in srgb, var(--revka-border-soft) 75%, transparent)",backgroundColor:"var(--revka-bg-panel-strong)",backgroundImage:s,backgroundRepeat:"no-repeat",backgroundPosition:e.avatarUrl?"0 0, 0 0, right -18px center":void 0,backgroundSize:e.avatarUrl?"100% 100%, 100% 100%, 58% auto":void 0,boxShadow:n?`0 0 0 1px ${r}, 0 0 26px color-mix(in srgb, ${r} 24%, transparent)`:"var(--revka-shadow-panel)"},children:[c.jsx(Ns,{type:"target",position:Ot.Top,style:{background:r,width:9,height:9}}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(js,{src:e.avatarUrl,alt:e.label,size:28,radius:8}),c.jsx("div",{className:"truncate text-sm font-semibold",style:{color:"var(--revka-text-primary)"},children:e.label})]}),c.jsx("p",{className:"mt-2 line-clamp-2 text-[11px] leading-5",style:{color:"var(--revka-text-secondary)"},children:e.identity}),c.jsxs("div",{className:"mt-3 flex flex-wrap gap-1.5",children:[c.jsx("span",{className:"rounded-md px-1.5 py-0.5 text-[10px] font-medium",style:{background:"color-mix(in srgb, var(--revka-bg-elevated) 85%, transparent)",color:r},children:e.role}),c.jsx("span",{className:"rounded-md px-1.5 py-0.5 text-[10px] font-medium",style:{background:"var(--revka-signal-network-soft)",color:"var(--revka-signal-network)"},children:e.agentType})]}),c.jsx(Ns,{type:"source",position:Ot.Bottom,style:{background:r,width:9,height:9}})]})}const bAe={agentNode:xAe};function ZU({team:e,onSelectMember:n,selectedMemberKref:r}){const{nodes:i,edges:s}=b.useMemo(()=>{if(!e)return{nodes:[],edges:[]};const o=e.members.map(u=>({id:u.kref,type:"agentNode",position:{x:0,y:0},selected:u.kref===r,data:{label:u.name,role:u.role,agentType:u.agent_type,identity:u.identity,kref:u.kref,avatarUrl:u.avatar_url}})),l=e.edges.map(u=>{const d=Mde(u.edge_type);return{id:`${u.from_kref}-${u.to_kref}-${u.edge_type}`,source:u.from_kref,target:u.to_kref,label:Ode(u.edge_type),type:"default",style:{stroke:d.stroke,strokeWidth:2,strokeDasharray:d.strokeDasharray},animated:d.animated??!1,markerEnd:{type:za.ArrowClosed,color:d.stroke}}});return{nodes:L$(o,l),edges:l}},[r,e]),a=(o,l)=>{n(l.id)};return c.jsx(kF,{nodes:i,edges:s,nodeTypes:bAe,onNodeClick:a,minimapColor:o=>{const l=o.data;return l.role==="reviewer"?"#6575d3":l.role==="coder"?"#2fbf75":"#4f75a8"},emptyState:"Select a team to inspect its topology."})}function kAe(){const{t:e,tpl:n}=cn(),[r,i]=Jg(),[s,a]=b.useState([]),[o,l]=b.useState(null),[u,d]=b.useState(null),[p,f]=b.useState(null),[g,_]=b.useState(!0),[x,v]=b.useState(!1),[S,w]=b.useState("summary"),[N,C]=b.useState([]),[T,A]=b.useState(!1),[E,D]=b.useState(!1),[F,B]=b.useState(null),H=async()=>(_(!0),rZ(!0,1,50).then(q=>{a(q.teams);const I=r.get("team"),Q=q.teams.find(K=>K.kref===I||K.name.toLowerCase()===(I==null?void 0:I.toLowerCase()))??q.teams[0]??null;Q&&L3(Q.kref).then(l).catch(()=>{})}).catch(q=>f(q.message)).finally(()=>_(!1)));b.useEffect(()=>{H()},[]),b.useEffect(()=>{lE(!0,1,200).then(q=>C(q.agents)).catch(()=>{})},[]);const $=b.useMemo(()=>(o==null?void 0:o.members.find(q=>q.kref===u))??null,[u,o]);b.useEffect(()=>{const q=r.get("member");if(!q){d(null);return}d(q)},[r,o==null?void 0:o.kref]),b.useEffect(()=>{o!=null&&o.kref&&i(q=>{const I=new URLSearchParams(q);return I.set("team",o.kref),u?I.set("member",u):I.delete("member"),I},{replace:!0})},[u,o==null?void 0:o.kref,i]),b.useEffect(()=>{w(u?"member":"summary")},[o==null?void 0:o.kref,u]);const z=async q=>{A(!0),f(null);try{const I=q.avatarFile??null;if(o){const Q={kref:o.kref,name:q.name,description:q.description,members:q.memberKrefs,edges:q.edges};let K=await sZ(Q);I&&(K=await I3(K.kref,I)),l(K),B({tone:"success",message:n("teams.toast.updated",{name:K.name})})}else{const Q={name:q.name,description:q.description,members:q.memberKrefs,edges:q.edges};let K=await iZ(Q);I&&(K=await I3(K.kref,I)),l(K),B({tone:"success",message:n("teams.toast.created",{name:K.name})})}await H(),v(!1)}catch(I){f(I instanceof Error?I.message:e("teams.err.save")),B({tone:"error",message:I instanceof Error?I.message:e("teams.err.save")})}finally{A(!1)}},W=async()=>{if(o)try{await aZ(o.kref,!o.deprecated),await H();const q=o.deprecated?"teams.toast.reenabled":"teams.toast.deprecated";B({tone:"success",message:n(q,{name:o.name})})}catch(q){f(q instanceof Error?q.message:e("teams.err.toggle")),B({tone:"error",message:q instanceof Error?q.message:e("teams.err.toggle")})}},P=async()=>{if(o){D(!0);try{const q=o.name;await oZ(o.kref),l(null),d(null),await H(),B({tone:"success",message:n("teams.toast.deleted",{name:q})})}catch(q){f(q instanceof Error?q.message:e("teams.err.delete")),B({tone:"error",message:q instanceof Error?q.message:e("teams.err.delete")})}finally{D(!1)}}};return c.jsxs("div",{className:"flex min-h-[calc(100vh-6rem)] flex-col gap-3 md:h-[calc(100vh-6rem)]",children:[F?c.jsx(Qo,{tone:F.tone,message:F.message,onDismiss:()=>B(null)}):null,c.jsx(si,{kicker:e("teams.kicker"),title:e("teams.title"),actions:c.jsxs(c.Fragment,{children:[c.jsxs("button",{className:"revka-button","data-variant":"primary",onClick:()=>{l(null),v(!0)},children:[c.jsx(rs,{className:"h-4 w-4"}),e("teams.create")]}),c.jsxs("button",{className:"revka-button",onClick:()=>void H(),disabled:g,children:[c.jsx($r,{className:`h-4 w-4 ${g?"animate-spin":""}`}),e("teams.refresh")]})]})}),p?c.jsx("div",{className:"text-sm",style:{color:"var(--revka-status-danger)"},children:p}):null,c.jsxs("div",{className:`grid gap-4 grid-cols-1 md:min-h-0 md:flex-1 ${o?"lg:grid-cols-[20rem_minmax(0,1fr)_24rem]":"md:grid-cols-[20rem_1fr]"}`,children:[c.jsxs(st,{className:"flex flex-col overflow-hidden p-0",children:[c.jsxs("div",{className:"flex items-center justify-between border-b px-3 py-2",style:{borderColor:"var(--revka-border-soft)"},children:[c.jsx("span",{className:"text-xs font-semibold uppercase tracking-[0.12em]",style:{color:"var(--revka-text-faint)"},children:n("teams.count",{count:s.length})}),c.jsx("span",{className:"text-xs",style:{color:"var(--revka-text-secondary)"},children:n("teams.agent_count",{count:N.length})})]}),c.jsx("div",{className:"flex-1 overflow-y-auto p-2",children:g?c.jsx(Ct,{compact:!0,tone:"loading",title:e("teams.loading")}):s.length===0?c.jsx(Ct,{compact:!0,title:e("teams.empty_title"),description:e("teams.empty_desc")}):s.map(q=>c.jsxs("button",{type:"button",className:"mb-1 w-full rounded-[12px] border px-3 py-3 text-left transition",style:{borderColor:q.kref===(o==null?void 0:o.kref)?"var(--revka-border-strong)":"var(--revka-border-soft)",background:q.kref===(o==null?void 0:o.kref)?"color-mix(in srgb, var(--revka-signal-selected) 14%, var(--revka-bg-panel-strong))":"transparent"},onClick:()=>{d(null),L3(q.kref).then(l).catch(I=>f(I.message))},children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(js,{src:q.avatar_url,alt:q.name,size:30,radius:8,kind:"team"}),c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsx("div",{className:"text-sm font-semibold",children:q.name}),c.jsx("div",{className:"mt-0.5 text-[11px]",style:{color:"var(--revka-text-secondary)"},children:n("teams.members_suffix",{members:q.members.length||q.member_count||0,edges:q.edges.length||q.edge_count||0})})]}),c.jsx("span",{className:"shrink-0 rounded-full px-2 py-0.5 text-[10px] font-semibold uppercase tracking-[0.12em]",style:{background:q.deprecated?"color-mix(in srgb, var(--revka-status-danger) 12%, transparent)":"color-mix(in srgb, var(--revka-status-success) 12%, transparent)",color:q.deprecated?"var(--revka-status-danger)":"var(--revka-status-success)"},children:q.deprecated?e("teams.status.off"):e("teams.status.live")})]}),q.description?c.jsx("p",{className:"mt-1.5 line-clamp-2 text-[11px] leading-4",style:{color:"var(--revka-text-faint)"},children:q.description}):null]},q.kref))})]}),c.jsx(st,{className:"flex flex-col overflow-y-auto p-4",children:o?c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"flex items-center justify-between gap-3",children:[c.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[c.jsx(js,{src:o.avatar_url,alt:o.name,size:48,radius:12,kind:"team"}),c.jsxs("div",{className:"min-w-0",children:[c.jsx("div",{className:"truncate text-sm font-semibold",style:{color:"var(--revka-text-primary)"},children:o.name}),c.jsx("div",{className:"mt-1",children:c.jsx("span",{className:"rounded-full px-2.5 py-1 text-[10px] font-semibold uppercase tracking-[0.12em]",style:{background:o.deprecated?"color-mix(in srgb, var(--revka-status-danger) 12%, transparent)":"color-mix(in srgb, var(--revka-status-success) 12%, transparent)",color:o.deprecated?"var(--revka-status-danger)":"var(--revka-status-success)"},children:o.deprecated?e("teams.status.deprecated"):e("teams.status.active")})})]})]}),c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx("button",{className:"revka-button",onClick:()=>v(!0),title:e("teams.action.edit"),children:c.jsx(iv,{className:"h-3.5 w-3.5"})}),c.jsx("button",{className:"revka-button",onClick:W,title:o.deprecated?e("teams.action.reenable"):e("teams.action.deprecate"),children:c.jsx(r0,{className:"h-3.5 w-3.5"})}),c.jsx("button",{className:"revka-button",onClick:P,disabled:E,title:e("teams.action.delete"),children:c.jsx(Wi,{className:"h-3.5 w-3.5"})})]})]}),c.jsxs("div",{className:"mt-3 grid gap-3 grid-cols-3",children:[c.jsxs(st,{className:"p-3",variant:"utility",children:[c.jsx("div",{className:"revka-kicker",children:e("teams.stats.members")}),c.jsx("div",{className:"mt-1 text-lg font-semibold",style:{color:"var(--revka-text-primary)"},children:o.members.length||o.member_count||0})]}),c.jsxs(st,{className:"p-3",variant:"utility",children:[c.jsx("div",{className:"revka-kicker",children:e("teams.stats.edges")}),c.jsx("div",{className:"mt-1 text-lg font-semibold",style:{color:"var(--revka-text-primary)"},children:o.edges.length||o.edge_count||0})]}),c.jsxs(st,{className:"p-3",variant:"utility",children:[c.jsx("div",{className:"revka-kicker",children:e("teams.stats.status")}),c.jsx("div",{className:"mt-1 text-sm font-semibold",style:{color:o.deprecated?"var(--revka-status-danger)":"var(--revka-status-success)"},children:o.deprecated?e("teams.status.deprecated"):e("teams.status.active")})]})]}),c.jsx("div",{className:"mt-4 min-h-0 flex-1",children:c.jsx(ZU,{team:o,onSelectMember:d,selectedMemberKref:u})})]}):c.jsx("div",{className:"flex flex-1 items-center justify-center",children:c.jsx(Ct,{tone:g?"loading":"empty",title:e(g?"teams.loading_desc":"teams.none_selected_title"),description:e("teams.none_selected_desc")})})}),o?c.jsxs(st,{className:"flex flex-col overflow-hidden p-0",children:[c.jsx("div",{className:"flex items-center gap-1 border-b px-3 py-2",style:{borderColor:"var(--revka-border-soft)"},children:[["summary",e("teams.tab.summary")],["member",e("teams.tab.member")]].map(([q,I])=>c.jsx("button",{type:"button",className:"revka-tab-button","data-active":String(S===q),"aria-selected":S===q,onClick:()=>w(q),children:I},q))}),c.jsxs("div",{className:"flex-1 overflow-y-auto p-3",children:[S==="summary"?c.jsx(Nde,{team:o}):null,S==="member"?c.jsx(Ede,{member:$,footer:$?c.jsx(bs,{to:"/agents",style:{color:"var(--revka-signal-network)"},className:"text-xs",children:e("teams.open_agent_registry")}):void 0}):null]})]}):null]}),x?c.jsx(wAe,{team:o,agents:N,saving:T,onClose:()=>v(!1),onSave:z}):null]})}function wAe({team:e,agents:n,saving:r,onClose:i,onSave:s}){const{t:a}=cn(),[o,l]=b.useState((e==null?void 0:e.name)??""),[u,d]=b.useState((e==null?void 0:e.description)??""),[p,f]=b.useState((e==null?void 0:e.members.map($=>$.kref))??[]),[g,_]=b.useState((e==null?void 0:e.edges)??[]),[x,v]=b.useState(""),[S,w]=b.useState(""),[N,C]=b.useState("REPORTS_TO"),[T,A]=b.useState(null),[E,D]=b.useState((e==null?void 0:e.avatar_url)??null);b.useEffect(()=>{l((e==null?void 0:e.name)??""),d((e==null?void 0:e.description)??""),f((e==null?void 0:e.members.map($=>$.kref))??[]),_((e==null?void 0:e.edges)??[]),A(null)},[e]),b.useEffect(()=>{if(!T){D((e==null?void 0:e.avatar_url)??null);return}const $=URL.createObjectURL(T);return D($),()=>URL.revokeObjectURL($)},[T,e==null?void 0:e.avatar_url]),b.useEffect(()=>{_($=>$.filter(z=>p.includes(z.from_kref)&&p.includes(z.to_kref))),v($=>p.includes($)?$:p[0]??""),w($=>p.includes($)?$:p[1]??p[0]??"")},[p]);const F=b.useMemo(()=>n.filter($=>p.includes($.kref)),[n,p]),B=b.useMemo(()=>({kref:(e==null?void 0:e.kref)??"draft://team",name:o||a("teams.form.draft_team_name"),description:u,deprecated:!1,created_at:(e==null?void 0:e.created_at)??"",members:F.map($=>({kref:$.kref,name:$.name,role:$.role,agent_type:$.agent_type,model:$.model,identity:$.identity,expertise:$.expertise,avatar_url:$.avatar_url})),edges:g,member_count:F.length,edge_count:g.length}),[u,g,o,F,e==null?void 0:e.created_at,e==null?void 0:e.kref,a]),H=()=>{!x||!S||x===S||_($=>$.some(W=>W.from_kref===x&&W.to_kref===S&&W.edge_type===N)?$:[...$,{from_kref:x,to_kref:S,edge_type:N}])};return c.jsxs(yu,{title:a(e?"teams.modal.edit_title":"teams.modal.create_title"),description:a("teams.modal.description"),onClose:i,children:[c.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[c.jsxs("label",{className:"grid gap-2 text-sm",children:[c.jsx("span",{style:{color:"var(--revka-text-secondary)"},children:a("teams.form.name")}),c.jsx("input",{className:"revka-input",value:o,onChange:$=>l($.target.value)})]}),c.jsxs("label",{className:"grid gap-2 text-sm",children:[c.jsx("span",{style:{color:"var(--revka-text-secondary)"},children:a("teams.form.description")}),c.jsx("input",{className:"revka-input",value:u,onChange:$=>d($.target.value)})]})]}),c.jsxs("div",{className:"mt-4 flex items-center gap-3 rounded-[12px] border p-3",style:{borderColor:"var(--revka-border-soft)"},children:[c.jsx(js,{src:E,alt:o||(e==null?void 0:e.name)||"Team",size:58,radius:14,kind:"team"}),c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsx("div",{className:"text-sm font-semibold",style:{color:"var(--revka-text-primary)"},children:"Team profile image"}),c.jsx("div",{className:"mt-1 text-xs",style:{color:"var(--revka-text-faint)"},children:"PNG, JPEG, or WebP"})]}),c.jsxs("label",{className:"revka-button cursor-pointer",children:[c.jsx(mE,{className:"h-4 w-4"}),"Upload",c.jsx("input",{type:"file",accept:"image/png,image/jpeg,image/webp",className:"sr-only",disabled:r,onChange:$=>{var z;return A(((z=$.target.files)==null?void 0:z[0])??null)}})]})]}),c.jsxs("div",{className:"mt-4",children:[c.jsx("div",{className:"revka-kicker",children:a("teams.form.members")}),c.jsx("div",{className:"mt-3 grid max-h-[22rem] gap-2 overflow-auto md:grid-cols-2",children:n.map($=>{const z=p.includes($.kref);return c.jsxs("label",{className:"flex items-start gap-3 rounded-[12px] border p-3",style:{borderColor:z?"var(--revka-border-strong)":"var(--revka-border-soft)"},children:[c.jsx("input",{type:"checkbox",checked:z,onChange:W=>{f(P=>W.target.checked?[...P,$.kref]:P.filter(q=>q!==$.kref))}}),c.jsx(js,{src:$.avatar_url,alt:$.name,size:34,radius:9}),c.jsxs("div",{className:"min-w-0",children:[c.jsx("div",{className:"text-sm font-medium",style:{color:"var(--revka-text-primary)"},children:$.name}),c.jsxs("div",{className:"text-xs",style:{color:"var(--revka-text-secondary)"},children:[$.role," / ",$.agent_type]}),c.jsx("div",{className:"mt-1 line-clamp-2 text-xs",style:{color:"var(--revka-text-faint)"},children:$.identity})]})]},$.kref)})})]}),c.jsxs("div",{className:"mt-5 grid gap-4 lg:grid-cols-[minmax(0,1fr)_20rem]",children:[c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{children:[c.jsx("div",{className:"revka-kicker",children:a("teams.form.topology_preview")}),c.jsx("div",{className:"mt-3",children:c.jsx(ZU,{team:B,onSelectMember:()=>{}})})]}),c.jsxs(st,{className:"p-4",variant:"utility",children:[c.jsx("div",{className:"revka-kicker",children:a("teams.form.edge_authoring")}),c.jsxs("div",{className:"mt-3 grid gap-2 md:grid-cols-[minmax(0,1fr)_minmax(0,1fr)_10rem_auto]",children:[c.jsxs("select",{className:"revka-input",value:x,onChange:$=>v($.target.value),children:[c.jsx("option",{value:"",children:a("teams.form.from_member")}),F.map($=>c.jsx("option",{value:$.kref,children:$.name},$.kref))]}),c.jsxs("select",{className:"revka-input",value:S,onChange:$=>w($.target.value),children:[c.jsx("option",{value:"",children:a("teams.form.to_member")}),F.map($=>c.jsx("option",{value:$.kref,children:$.name},$.kref))]}),c.jsxs("select",{className:"revka-input",value:N,onChange:$=>C($.target.value),children:[c.jsx("option",{value:"REPORTS_TO",children:a("teams.form.edge_reports_to")}),c.jsx("option",{value:"SUPPORTS",children:a("teams.form.edge_supports")}),c.jsx("option",{value:"DEPENDS_ON",children:a("teams.form.edge_depends_on")})]}),c.jsx("button",{className:"revka-button",onClick:H,disabled:!x||!S||x===S,children:a("teams.form.add_edge")})]}),c.jsxs("div",{className:"mt-3 space-y-2",children:[g.map($=>{var P,q;const z=((P=F.find(I=>I.kref===$.from_kref))==null?void 0:P.name)??$.from_kref,W=((q=F.find(I=>I.kref===$.to_kref))==null?void 0:q.name)??$.to_kref;return c.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-[12px] border p-3 text-sm",style:{borderColor:"var(--revka-border-soft)"},children:[c.jsxs("div",{style:{color:"var(--revka-text-primary)"},children:[z," ",c.jsx("span",{style:{color:"var(--revka-text-faint)"},children:$.edge_type})," ",W]}),c.jsx("button",{className:"text-xs",style:{color:"var(--revka-status-danger)"},onClick:()=>_(I=>I.filter(Q=>!(Q.from_kref===$.from_kref&&Q.to_kref===$.to_kref&&Q.edge_type===$.edge_type))),children:a("teams.form.remove")})]},`${$.from_kref}-${$.to_kref}-${$.edge_type}`)}),g.length===0?c.jsx("div",{className:"text-sm",style:{color:"var(--revka-text-faint)"},children:a("teams.form.no_edges")}):null]})]})]}),c.jsxs(st,{className:"p-4",variant:"secondary",children:[c.jsx("div",{className:"revka-kicker",children:a("teams.form.draft_summary")}),c.jsxs("div",{className:"mt-3 space-y-2 text-sm",children:[c.jsxs("div",{children:[c.jsx("span",{style:{color:"var(--revka-text-faint)"},children:a("teams.form.draft_members")}),": ",c.jsx("span",{style:{color:"var(--revka-text-primary)"},children:F.length})]}),c.jsxs("div",{children:[c.jsx("span",{style:{color:"var(--revka-text-faint)"},children:a("teams.form.draft_edges")}),": ",c.jsx("span",{style:{color:"var(--revka-text-primary)"},children:g.length})]}),c.jsx("p",{style:{color:"var(--revka-text-secondary)"},children:a("teams.form.draft_hint")})]})]})]}),c.jsxs("div",{className:"mt-5 flex flex-wrap justify-end gap-2",children:[c.jsx("button",{className:"revka-button",onClick:i,children:a("teams.form.cancel")}),c.jsx("button",{className:"revka-button","data-variant":"primary",disabled:r||!o.trim()||p.length===0,onClick:()=>s({name:o.trim(),description:u.trim(),memberKrefs:p,edges:g,avatarFile:T}),children:a(r?"teams.form.saving":e?"teams.form.save":"teams.modal.create_title")})]})]})}function SAe(){const{t:e,tpl:n}=cn(),[r,i]=b.useState("default"),[s,a]=b.useState("default"),[o,l]=b.useState(null),[u,d]=b.useState([]),[p,f]=b.useState(!1),[g,_]=b.useState(!0),[x,v]=b.useState([]),[S,w]=b.useState(!0),N=b.useRef(null),{resolvedTheme:C}=Ta(),T=b.useCallback(W=>{const P=ns(),q=P?`?token=${encodeURIComponent(P)}`:"";let I;return Kf()&&Ti?I=Ti.replace(/^http/,"ws"):I=`${location.protocol==="https:"?"wss:":"ws:"}//${location.host}`,`${I}${Gr||""}/ws/canvas/${encodeURIComponent(W)}${q}`},[]),A=b.useCallback(W=>{var Q;(Q=N.current)==null||Q.close();const P=ns(),q=P?["revka.v1",`bearer.${P}`]:["revka.v1"],I=new WebSocket(T(W),q);I.onopen=()=>f(!0),I.onclose=()=>f(!1),I.onerror=()=>f(!1),I.onmessage=K=>{try{const Z=JSON.parse(K.data);if(Z.type!=="frame"||!Z.frame)return;const Y=Z.frame;if(Y.content_type==="clear"){l(null),d([]);return}l(Y),d(R=>{var U;return R.length>0&&((U=R[R.length-1])==null?void 0:U.frame_id)===Y.frame_id?R:[...R.slice(-49),Y]})}catch{}},N.current=I},[T]);b.useEffect(()=>(A(r),()=>{var W;(W=N.current)==null||W.close()}),[r,A]),b.useEffect(()=>{const W=async()=>{try{const q=await ut("/api/canvas");v(q.canvases||[])}catch{v([])}finally{w(!1)}};W();const P=setInterval(W,5e3);return()=>clearInterval(P)},[]);const E=b.useMemo(()=>{if(typeof window>"u")return{bg:C==="light"?"#f9f2f4":"#070607",text:C==="light"?"#261019":"#fff3f5"};const W=getComputedStyle(document.documentElement);return{bg:W.getPropertyValue("--revka-bg-base").trim()||(C==="light"?"#f9f2f4":"#070607"),text:W.getPropertyValue("--revka-text-primary").trim()||(C==="light"?"#261019":"#fff3f5")}},[C]),D=b.useMemo(()=>{if(!o||o.content_type==="eval")return;const W=E.bg,P=E.text;if(o.content_type==="svg")return`<!DOCTYPE html><html><head><style>body{margin:0;display:flex;align-items:center;justify-content:center;min-height:100vh;background:${W};color:${P};}</style></head><body>${o.content}</body></html>`;if(o.content_type==="markdown"){const q=o.content.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");return`<!DOCTYPE html><html><head><style>body{margin:1rem;font-family:system-ui,sans-serif;color:${P};background:${W};line-height:1.6;}pre{white-space:pre-wrap;word-wrap:break-word;}</style></head><body><pre>${q}</pre></body></html>`}if(o.content_type==="text"){const q=o.content.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");return`<!DOCTYPE html><html><head><style>body{margin:1rem;font-family:monospace;color:${P};background:${W};white-space:pre-wrap;}</style></head><body>${q}</body></html>`}return o.content},[o,E]),F=()=>{const W=s.trim();W&&(i(W),l(null),d([]))},B=async()=>{try{await ut(`/api/canvas/${encodeURIComponent(r)}`,{method:"DELETE"}),l(null),d([])}catch{}},H=C==="light"?"linear-gradient(180deg, color-mix(in srgb, var(--revka-bg-surface) 74%, transparent), var(--revka-bg-base))":"linear-gradient(180deg, color-mix(in srgb, var(--revka-bg-surface) 92%, transparent), var(--revka-bg-base))",$="var(--revka-grid-line)",z=o?new Date(o.timestamp).toLocaleString():"--";return c.jsxs("div",{className:"flex min-h-[calc(100vh-6rem)] flex-col gap-3 lg:h-[calc(100vh-6rem)]",children:[c.jsx(si,{kicker:e("canvas.kicker"),title:e("canvas.title"),actions:c.jsxs("button",{className:"revka-button",onClick:()=>A(r),children:[c.jsx($r,{className:"h-4 w-4"}),e("canvas.reconnect")]})}),c.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:min-h-0 lg:flex-1 lg:grid-cols-[20rem_minmax(0,1fr)_18rem]",children:[c.jsxs("div",{className:"flex flex-col gap-4 lg:overflow-y-auto lg:min-h-0",children:[c.jsxs(st,{className:"p-4",children:[c.jsx("div",{className:"revka-kicker",children:e("canvas.control")}),c.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[c.jsxs("span",{className:"revka-status-pill",style:{color:p?"var(--revka-signal-selected)":"var(--revka-status-danger)",background:p?"color-mix(in srgb, var(--revka-signal-selected) 12%, transparent)":"color-mix(in srgb, var(--revka-status-danger) 12%, transparent)",borderColor:"transparent"},children:[c.jsx("span",{className:"revka-dot",style:{background:p?"var(--revka-signal-selected)":"var(--revka-status-danger)"}}),e(p?"canvas.connected":"canvas.disconnected")]}),c.jsxs("span",{className:"revka-status-pill",style:{color:"var(--revka-text-secondary)"},children:[c.jsx(MB,{className:"h-3.5 w-3.5"}),r]})]}),c.jsxs("div",{className:"mt-4 space-y-3",children:[c.jsx("input",{type:"text",value:s,onChange:W=>a(W.target.value),onKeyDown:W=>{W.key==="Enter"&&F()},placeholder:e("canvas.canvas_id_placeholder"),className:"revka-input"}),c.jsxs("div",{className:"grid gap-2 sm:grid-cols-2",children:[c.jsx("button",{className:"revka-button","data-variant":"primary",onClick:F,children:e("canvas.switch")}),c.jsxs("button",{className:"revka-button",onClick:B,children:[c.jsx(Wi,{className:"h-4 w-4"}),e("canvas.clear")]})]})]})]}),c.jsxs(st,{className:"p-4",variant:"secondary",children:[c.jsx("div",{className:"revka-kicker",children:e("canvas.available")}),c.jsx("div",{className:"mt-3 space-y-2",children:S?c.jsx(Ct,{tone:"loading",compact:!0,title:e("canvas.loading_list"),description:e("canvas.loading_list_desc")}):x.length===0?c.jsx(Ct,{compact:!0,title:e("canvas.no_active_title"),description:e("canvas.no_active_desc")}):x.map(W=>c.jsx("button",{type:"button","data-active":W===r,"data-accent":"workflow",className:"revka-selection-card",onClick:()=>{a(W),i(W),l(null),d([])},children:c.jsxs("div",{className:"flex items-center justify-between gap-2",children:[c.jsx("span",{className:"truncate text-sm font-medium",style:{color:"var(--revka-text-primary)"},children:W}),W===r?c.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-[0.14em]",style:{color:"var(--revka-signal-selected)"},children:e("canvas.active")}):null]})},W))})]})]}),c.jsxs(st,{className:"p-5 lg:overflow-y-auto",children:[c.jsx("div",{className:"revka-kicker",children:e("canvas.viewport")}),c.jsx("h3",{className:"mt-2 text-lg font-semibold",children:e("canvas.live_output")}),c.jsxs("div",{className:"mt-4 grid gap-3 md:grid-cols-4",children:[c.jsxs(st,{className:"p-3",variant:"utility",children:[c.jsx("div",{className:"revka-kicker",children:e("canvas.canvas_label")}),c.jsx("div",{className:"mt-2 text-sm font-semibold",style:{color:"var(--revka-text-primary)"},children:r})]}),c.jsxs(st,{className:"p-3",variant:"utility",children:[c.jsx("div",{className:"revka-kicker",children:e("canvas.connection")}),c.jsx("div",{className:"mt-2 text-sm font-semibold",style:{color:p?"var(--revka-signal-selected)":"var(--revka-status-danger)"},children:e(p?"canvas.live":"canvas.offline")})]}),c.jsxs(st,{className:"p-3",variant:"utility",children:[c.jsx("div",{className:"revka-kicker",children:e("canvas.frame_type")}),c.jsx("div",{className:"mt-2 text-sm font-semibold",style:{color:"var(--revka-text-primary)"},children:(o==null?void 0:o.content_type)??"--"})]}),c.jsxs(st,{className:"p-3",variant:"utility",children:[c.jsx("div",{className:"revka-kicker",children:e("canvas.last_update")}),c.jsx("div",{className:"mt-2 text-sm font-semibold",style:{color:"var(--revka-text-primary)"},children:z})]})]}),c.jsxs("div",{className:"mt-5 overflow-hidden rounded-[18px] border",style:{borderColor:"var(--revka-border-soft)",background:H,minHeight:"48rem",position:"relative"},children:[c.jsx("div",{"aria-hidden":"true",style:{position:"absolute",inset:0,pointerEvents:"none",backgroundImage:`linear-gradient(${$} 1px, transparent 1px), linear-gradient(90deg, ${$} 1px, transparent 1px)`,backgroundSize:"24px 24px",maskImage:"linear-gradient(180deg, rgba(255,255,255,0.35), transparent 85%)"}}),c.jsxs("div",{className:"flex items-center justify-between gap-3 border-b px-4 py-3",style:{borderColor:"var(--revka-border-soft)",position:"relative",zIndex:1,background:"color-mix(in srgb, var(--revka-bg-panel-strong) 86%, transparent)"},children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"h-2.5 w-2.5 rounded-full",style:{background:"var(--revka-status-danger)"}}),c.jsx("span",{className:"h-2.5 w-2.5 rounded-full",style:{background:"var(--revka-status-warning)"}}),c.jsx("span",{className:"h-2.5 w-2.5 rounded-full",style:{background:"var(--revka-status-success)"}})]}),c.jsx("div",{className:"text-xs font-semibold uppercase tracking-[0.14em]",style:{color:"var(--revka-text-faint)"},children:o?`${o.content_type} ${e("canvas.frame_suffix")}`:e("canvas.waiting_label")})]}),o?c.jsx("iframe",{sandbox:"allow-scripts",srcDoc:D,className:"h-[calc(48rem-3.25rem)] w-full border-0",title:`Canvas: ${r}`,style:{background:"transparent",position:"relative",zIndex:1}}):c.jsx("div",{className:"flex h-[calc(48rem-3.25rem)] items-center justify-center p-6",style:{position:"relative",zIndex:1},children:c.jsx(Ct,{tone:p?"empty":"error",title:p?n("canvas.waiting_for_content",{id:r}):e("canvas.disconnected_title"),description:e(p?"canvas.waiting_for_content_desc":"canvas.disconnected_desc"),action:p?void 0:c.jsxs("button",{className:"revka-button",onClick:()=>A(r),children:[c.jsx($r,{className:"h-4 w-4"}),e("canvas.reconnect_button")]})})})]}),o?c.jsxs("div",{className:"mt-4 grid gap-3 md:grid-cols-2",children:[c.jsxs(st,{className:"p-3",variant:"utility",children:[c.jsx("div",{className:"revka-kicker",children:e("canvas.frame_id")}),c.jsx("div",{className:"mt-2 text-sm font-mono",style:{color:"var(--revka-text-primary)"},children:o.frame_id})]}),c.jsxs(st,{className:"p-3",variant:"utility",children:[c.jsx("div",{className:"revka-kicker",children:e("canvas.guidance")}),c.jsx("div",{className:"mt-2 text-sm leading-6",style:{color:"var(--revka-text-secondary)"},children:e("canvas.guidance_desc")})]})]}):null]}),c.jsxs(st,{className:"p-4 lg:overflow-y-auto",variant:"utility",children:[c.jsxs("div",{className:"flex items-center justify-between gap-2",children:[c.jsx("div",{className:"revka-kicker",children:e("canvas.history")}),c.jsxs("button",{className:"revka-button",onClick:()=>_(W=>!W),children:[c.jsx(pE,{className:"h-4 w-4"}),e(g?"canvas.hide":"canvas.show")]})]}),c.jsx("div",{className:"mt-3 space-y-2",children:g?u.length===0?c.jsx(Ct,{compact:!0,title:e("canvas.no_frames_title"),description:e("canvas.no_frames_desc")}):[...u].reverse().map(W=>c.jsxs("button",{type:"button","data-active":(o==null?void 0:o.frame_id)===W.frame_id,"data-accent":"team",className:"revka-selection-card",onClick:()=>l(W),children:[c.jsxs("div",{className:"flex items-center justify-between gap-2",children:[c.jsx("span",{className:"truncate text-xs font-semibold uppercase tracking-[0.12em]",style:{color:"var(--revka-signal-network)"},children:W.content_type}),c.jsx("span",{className:"text-[11px]",style:{color:"var(--revka-text-faint)"},children:new Date(W.timestamp).toLocaleTimeString()})]}),c.jsx("div",{className:"mt-2 text-xs font-mono",style:{color:"var(--revka-text-faint)"},children:W.frame_id.slice(0,8)}),c.jsxs("div",{className:"mt-2 line-clamp-2 text-xs",style:{color:"var(--revka-text-secondary)"},children:[W.content.slice(0,96),W.content.length>96?"…":""]})]},W.frame_id)):c.jsx(Ct,{compact:!0,title:e("canvas.history_collapsed_title"),description:e("canvas.history_collapsed_desc")})})]})]})]})}const Rc={name:"",identity:"",soul:"",tone:"",role:"coder",agent_type:"claude",model:"",system_hint:""};function G6(e){return e?`url("${e.replace(/"/g,"%22")}")`:"none"}function CAe(){const{t:e,tpl:n}=cn(),[r,i]=b.useState([]),[s,a]=b.useState(null),[o,l]=b.useState(""),[u,d]=b.useState("all"),[p,f]=b.useState(!0),[g,_]=b.useState(!0),[x,v]=b.useState(!1),[S,w]=b.useState(!1),[N,C]=b.useState(null),[T,A]=b.useState("summary"),[E,D]=b.useState(null),[F,B]=b.useState(null),H=async()=>{_(!0),D(null);try{const K=await lE(!0,1,200);i(K.agents),a(Z=>{var Y;return Z??((Y=K.agents[0])==null?void 0:Y.kref)??null})}catch(K){D(K instanceof Error?K.message:e("agents.err.load"))}finally{_(!1)}};b.useEffect(()=>{H()},[]);const $=b.useMemo(()=>{const K=o.trim().toLowerCase();return r.filter(Z=>!p&&Z.deprecated||u!=="all"&&Z.role!==u?!1:K?Z.name.toLowerCase().includes(K)||Z.identity.toLowerCase().includes(K)||Z.soul.toLowerCase().includes(K)||Z.expertise.some(Y=>Y.toLowerCase().includes(K)):!0)},[r,u,o,p]),z=b.useMemo(()=>$.find(K=>K.kref===s)??r.find(K=>K.kref===s)??$[0]??r[0]??null,[r,$,s]);b.useEffect(()=>{var K;!z&&$.length>0&&a(((K=$[0])==null?void 0:K.kref)??null)},[$,z]),b.useEffect(()=>{A("summary")},[z==null?void 0:z.kref]);const W=b.useMemo(()=>r.filter(K=>!K.deprecated).length,[r]),P=b.useMemo(()=>r.filter(K=>K.agent_type==="codex").length,[r]),q=async K=>{v(!0);try{const{avatarFile:Z,...Y}=K;if(N==="edit"&&z){const R={...Y,kref:z.kref,model:K.model||void 0,system_hint:K.system_hint||void 0};let U=await MQ(R);Z&&(U=await iC(U.kref,Z)),i(V=>V.map(ie=>ie.kref===U.kref?U:ie)),a(U.kref),B({tone:"success",message:n("agents.toast.updated",{name:U.name})})}else{const R={...Y,model:K.model||void 0,system_hint:K.system_hint||void 0};let U=await fB(R);Z&&(U=await iC(U.kref,Z)),i(V=>[U,...V]),a(U.kref),B({tone:"success",message:n("agents.toast.created",{name:U.name})})}C(null)}catch(Z){B({tone:"error",message:Z instanceof Error?Z.message:e("agents.err.save")})}finally{v(!1)}},I=async()=>{if(z)try{const K=await RQ(z.kref,!z.deprecated);i(Y=>Y.map(R=>R.kref===K.kref?K:R));const Z=K.deprecated?"agents.toast.deprecated":"agents.toast.reenabled";B({tone:"success",message:n(Z,{name:K.name})})}catch(K){B({tone:"error",message:K instanceof Error?K.message:e("agents.err.toggle")})}},Q=async()=>{if(z){w(!0);try{const K=z.name;await OQ(z.kref),i(Z=>Z.filter(Y=>Y.kref!==z.kref)),a(null),B({tone:"success",message:n("agents.toast.deleted",{name:K})})}catch(K){B({tone:"error",message:K instanceof Error?K.message:e("agents.err.delete")})}finally{w(!1)}}};return c.jsxs("div",{className:"flex min-h-[calc(100vh-6rem)] flex-col gap-3 md:h-[calc(100vh-6rem)]",children:[F?c.jsx(Qo,{tone:F.tone,message:F.message,onDismiss:()=>B(null)}):null,c.jsx(si,{kicker:e("agents.kicker"),title:e("agents.title"),actions:c.jsxs(c.Fragment,{children:[c.jsxs("button",{className:"revka-button","data-variant":"primary",onClick:()=>C("create"),children:[c.jsx(rs,{className:"h-4 w-4"}),e("agents.create")]}),c.jsxs("button",{className:"revka-button",onClick:()=>void H(),disabled:g,children:[c.jsx($r,{className:`h-4 w-4 ${g?"animate-spin":""}`}),e("agents.refresh")]})]})}),c.jsxs("div",{className:"revka-agent-toolbar",children:[c.jsxs("div",{className:"revka-agent-search relative",children:[c.jsx(Aa,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2",style:{color:"var(--revka-text-faint)"}}),c.jsx("input",{value:o,onChange:K=>l(K.target.value),className:"revka-input revka-agent-search-input pl-10",placeholder:e("agents.search_placeholder")})]}),c.jsxs("select",{className:"revka-input revka-agent-filter-select w-auto",value:u,onChange:K=>d(K.target.value),children:[c.jsx("option",{value:"all",children:e("agents.filter.all_roles")}),c.jsx("option",{value:"coder",children:e("agents.filter.coder")}),c.jsx("option",{value:"reviewer",children:e("agents.filter.reviewer")}),c.jsx("option",{value:"researcher",children:e("agents.filter.researcher")})]}),c.jsxs("button",{type:"button",className:"revka-button revka-agent-filter-button",onClick:()=>f(K=>!K),children:[c.jsx(jB,{className:"h-4 w-4"}),e(p?"agents.filter.hide_disabled":"agents.filter.show_disabled")]})]}),E?c.jsx("div",{className:"text-sm",style:{color:"var(--revka-status-danger)"},children:E}):null,c.jsxs("div",{className:`grid gap-4 grid-cols-1 md:min-h-0 md:flex-1 ${z?"lg:grid-cols-[20rem_minmax(0,1fr)_26rem]":"md:grid-cols-[20rem_1fr]"}`,children:[c.jsxs(st,{className:"flex flex-col overflow-hidden p-0",children:[c.jsx("div",{className:"flex items-center justify-between border-b px-3 py-2",style:{borderColor:"var(--revka-border-soft)"},children:c.jsx("span",{className:"text-xs font-semibold uppercase tracking-[0.12em]",style:{color:"var(--revka-text-faint)"},children:n("agents.count",{count:$.length})})}),c.jsx("div",{className:"flex-1 overflow-y-auto p-2",children:g?c.jsx(Ct,{compact:!0,tone:"loading",title:e("agents.loading")}):$.length===0?c.jsx(Ct,{compact:!0,title:e("agents.empty_title"),description:e("agents.empty_desc")}):$.map(K=>c.jsxs("button",{type:"button",className:"revka-agent-list-card mb-1","data-active":String(K.kref===(z==null?void 0:z.kref)),"data-has-avatar":String(!!K.avatar_url),style:{opacity:K.deprecated?.68:1,"--revka-agent-card-avatar":G6(K.avatar_url)},onClick:()=>a(K.kref),children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"revka-agent-list-icon","aria-hidden":"true",children:c.jsx($m,{className:"h-4 w-4"})}),c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsx("div",{className:"text-sm font-semibold",children:K.name}),c.jsxs("div",{className:"mt-0.5 flex items-center gap-1.5 text-[11px]",style:{color:"var(--revka-text-secondary)"},children:[c.jsx("span",{children:K.role}),c.jsx("span",{style:{color:"var(--revka-text-faint)"},children:"/"}),c.jsx("span",{children:K.agent_type}),K.model?c.jsxs(c.Fragment,{children:[c.jsx("span",{style:{color:"var(--revka-text-faint)"},children:"/"}),c.jsx("span",{className:"truncate",children:K.model})]}):null]})]})]}),c.jsx("p",{className:"mt-1.5 line-clamp-2 text-[11px] leading-4",style:{color:"var(--revka-text-faint)"},children:K.identity}),K.expertise.length>0?c.jsxs("div",{className:"mt-2 flex flex-wrap gap-1",children:[K.expertise.slice(0,3).map(Z=>c.jsx("span",{className:"rounded-full px-1.5 py-0.5 text-[9px] font-semibold",style:{background:"var(--revka-signal-network-soft)",color:"var(--revka-signal-network)"},children:Z},Z)),K.expertise.length>3?c.jsxs("span",{className:"text-[9px] py-0.5",style:{color:"var(--revka-text-faint)"},children:["+",K.expertise.length-3]}):null]}):null]},K.kref))})]}),c.jsx(st,{className:"flex flex-col overflow-y-auto p-4",children:z?c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"revka-agent-profile-hero","data-has-avatar":String(!!z.avatar_url),style:{"--revka-agent-profile-image":G6(z.avatar_url)},children:[c.jsx("div",{className:"revka-agent-profile-image","aria-hidden":"true",children:z.avatar_url?c.jsx("img",{src:z.avatar_url,alt:""}):c.jsx($m,{className:"h-10 w-10"})}),c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"revka-agent-profile-icon","aria-hidden":"true",children:c.jsx($m,{className:"h-4 w-4"})}),c.jsx("div",{className:"truncate text-sm font-semibold",style:{color:"var(--revka-text-primary)"},children:z.name})]}),c.jsxs("div",{className:"mt-1 text-xs",style:{color:"var(--revka-text-secondary)"},children:[z.role," / ",z.agent_type,z.model?` / ${z.model}`:""]})]}),c.jsx("span",{className:"revka-agent-status-pill","data-status":z.deprecated?"disabled":"active",children:z.deprecated?e("agents.status.disabled"):e("agents.status.active")})]}),c.jsxs("div",{className:"mt-3 grid gap-3 grid-cols-3",children:[c.jsxs(st,{className:"p-3",variant:"utility",children:[c.jsx("div",{className:"revka-kicker",children:e("agents.stats.registry")}),c.jsx("div",{className:"mt-1 text-lg font-semibold",style:{color:"var(--revka-text-primary)"},children:r.length})]}),c.jsxs(st,{className:"p-3",variant:"utility",children:[c.jsx("div",{className:"revka-kicker",children:e("agents.stats.active")}),c.jsx("div",{className:"mt-1 text-lg font-semibold",style:{color:"var(--revka-text-primary)"},children:W})]}),c.jsxs(st,{className:"p-3",variant:"utility",children:[c.jsx("div",{className:"revka-kicker",children:e("agents.stats.codex")}),c.jsx("div",{className:"mt-1 text-lg font-semibold",style:{color:"var(--revka-text-primary)"},children:P})]})]}),c.jsxs("div",{className:"mt-4 grid gap-4 xl:grid-cols-[minmax(0,1.2fr)_minmax(0,0.8fr)]",children:[c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{children:[c.jsx("div",{className:"revka-kicker",children:e("agents.section.identity")}),c.jsx("p",{className:"mt-2 text-sm leading-6",style:{color:"var(--revka-text-secondary)"},children:z.identity})]}),c.jsxs("div",{children:[c.jsx("div",{className:"revka-kicker",children:e("agents.section.soul")}),c.jsx("p",{className:"mt-2 text-sm leading-7",style:{color:"var(--revka-text-secondary)"},children:z.soul||e("agents.section.soul_empty")})]}),c.jsxs("div",{children:[c.jsx("div",{className:"revka-kicker",children:e("agents.section.expertise")}),c.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:z.expertise.length>0?z.expertise.map(K=>c.jsx("span",{className:"rounded-full px-3 py-1 text-xs font-semibold",style:{background:"var(--revka-signal-network-soft)",color:"var(--revka-text-primary)",border:"1px solid var(--revka-border-soft)"},children:K},K)):c.jsx("span",{className:"text-sm",style:{color:"var(--revka-text-faint)"},children:e("agents.section.no_expertise")})})]})]}),c.jsxs("div",{className:"rounded-[16px] border p-4",style:{borderColor:"var(--revka-border-soft)"},children:[c.jsx("div",{className:"revka-kicker",children:e("agents.section.voice")}),c.jsx("div",{className:"mt-2 text-sm font-semibold",style:{color:"var(--revka-text-primary)"},children:z.tone||e("agents.section.voice_empty")}),c.jsxs("div",{className:"mt-4 grid gap-3 text-sm",children:[c.jsxs("div",{children:[c.jsx("div",{style:{color:"var(--revka-text-faint)"},children:e("agents.section.revision")}),c.jsx("div",{className:"mt-1 font-semibold",style:{color:"var(--revka-text-primary)"},children:z.revision_number??z.revision??"--"})]}),c.jsxs("div",{children:[c.jsx("div",{style:{color:"var(--revka-text-faint)"},children:e("agents.section.created")}),c.jsx("div",{className:"mt-1 font-semibold",style:{color:"var(--revka-text-primary)"},children:Sf(z.created_at)||"--"})]})]})]})]}),c.jsxs("div",{className:"mt-4 flex gap-2",children:[c.jsxs("button",{className:"revka-button",onClick:()=>C("edit"),children:[c.jsx(iv,{className:"h-4 w-4"}),e("agents.action.edit")]}),c.jsxs("button",{className:"revka-button",onClick:I,children:[c.jsx(r0,{className:"h-4 w-4"}),z.deprecated?e("agents.action.reenable"):e("agents.action.deprecate")]}),c.jsxs("button",{className:"revka-button",onClick:Q,disabled:S,children:[c.jsx(Wi,{className:"h-4 w-4"}),e(S?"agents.action.deleting":"agents.action.delete")]})]})]}):c.jsx("div",{className:"flex flex-1 items-center justify-center",children:c.jsx(Ct,{tone:g?"loading":"empty",title:e(g?"agents.loading_desc":"agents.none_selected_title"),description:e("agents.none_selected_desc")})})}),z?c.jsxs(st,{className:"flex flex-col overflow-hidden p-0",children:[c.jsx("div",{className:"flex items-center gap-1 border-b px-3 py-2",style:{borderColor:"var(--revka-border-soft)"},children:[["summary",e("agents.tab.summary")],["prompt",e("agents.tab.prompt")]].map(([K,Z])=>c.jsx("button",{type:"button",className:"revka-tab-button","data-active":String(T===K),"aria-selected":T===K,onClick:()=>A(K),children:Z},K))}),c.jsxs("div",{className:"flex-1 overflow-y-auto p-3",children:[T==="summary"?c.jsx("div",{className:"space-y-3 text-sm",children:[[e("agents.summary.name"),z.name],[e("agents.summary.role"),z.role],[e("agents.summary.type"),z.agent_type],[e("agents.summary.model"),z.model||e("agents.summary.model_default")],[e("agents.summary.tone"),z.tone||"--"],[e("agents.summary.revision"),String(z.revision_number??z.revision??"--")],[e("agents.summary.created"),Sf(z.created_at)||"--"]].map(([K,Z])=>c.jsxs("div",{className:"rounded-[12px] border p-3",style:{borderColor:"var(--revka-border-soft)"},children:[c.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-[0.14em]",style:{color:"var(--revka-text-faint)"},children:K}),c.jsx("div",{className:"mt-1 text-sm font-semibold",style:{color:"var(--revka-text-primary)"},children:Z})]},K))}):null,T==="prompt"?c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{children:[c.jsx("div",{className:"revka-kicker",children:e("agents.prompt.system_hint")}),c.jsx("pre",{className:"mt-2 whitespace-pre-wrap text-xs leading-6",style:{color:"var(--revka-text-secondary)",fontFamily:"var(--pc-font-mono)"},children:z.system_hint||e("agents.prompt.system_hint_empty")})]}),c.jsxs("div",{children:[c.jsx("div",{className:"revka-kicker",children:e("agents.prompt.identity_seed")}),c.jsx("pre",{className:"mt-2 whitespace-pre-wrap text-xs leading-6",style:{color:"var(--revka-text-secondary)",fontFamily:"var(--pc-font-mono)"},children:z.identity})]})]}):null]})]}):null]}),N?c.jsx(jAe,{mode:N,agent:N==="edit"?z:null,saving:x,onClose:()=>C(null),onSave:q}):null]})}function jAe({mode:e,agent:n,saving:r,onClose:i,onSave:s}){const{t:a}=cn(),[o,l]=b.useState((n==null?void 0:n.name)??""),[u,d]=b.useState((n==null?void 0:n.identity)??""),[p,f]=b.useState((n==null?void 0:n.soul)??""),[g,_]=b.useState((n==null?void 0:n.tone)??""),[x,v]=b.useState((n==null?void 0:n.role)??"coder"),[S,w]=b.useState((n==null?void 0:n.agent_type)??"claude"),[N,C]=b.useState((n==null?void 0:n.model)??""),[T,A]=b.useState((n==null?void 0:n.system_hint)??""),[E,D]=b.useState((n==null?void 0:n.expertise.join(", "))??""),[F,B]=b.useState(null);b.useEffect(()=>{l((n==null?void 0:n.name)??Rc.name),d((n==null?void 0:n.identity)??Rc.identity),f((n==null?void 0:n.soul)??Rc.soul),_((n==null?void 0:n.tone)??Rc.tone),v((n==null?void 0:n.role)??Rc.role),w((n==null?void 0:n.agent_type)??Rc.agent_type),C((n==null?void 0:n.model)??Rc.model),A((n==null?void 0:n.system_hint)??Rc.system_hint),D((n==null?void 0:n.expertise.join(", "))??""),B(null)},[n]);const[H,$]=b.useState((n==null?void 0:n.avatar_url)??null);b.useEffect(()=>{if(!F){$((n==null?void 0:n.avatar_url)??null);return}const W=URL.createObjectURL(F);return $(W),()=>URL.revokeObjectURL(W)},[n==null?void 0:n.avatar_url,F]);const z=o.trim()&&u.trim()&&p.trim();return c.jsxs(yu,{title:a(e==="create"?"agents.modal.create_title":"agents.modal.edit_title"),description:a("agents.modal.description"),onClose:i,children:[c.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[c.jsxs("label",{className:"grid gap-2 text-sm",children:[c.jsx("span",{style:{color:"var(--revka-text-secondary)"},children:a("agents.form.name")}),c.jsx("input",{className:"revka-input",value:o,onChange:W=>l(W.target.value)})]}),c.jsxs("label",{className:"grid gap-2 text-sm",children:[c.jsx("span",{style:{color:"var(--revka-text-secondary)"},children:a("agents.form.tone")}),c.jsx("input",{className:"revka-input",value:g,onChange:W=>_(W.target.value),placeholder:a("agents.form.tone_placeholder")})]})]}),c.jsxs("div",{className:"mt-4 flex items-center gap-3 rounded-[12px] border p-3",style:{borderColor:"var(--revka-border-soft)"},children:[c.jsx(js,{src:H,alt:o||(n==null?void 0:n.name)||"Agent",size:54,radius:14}),c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsx("div",{className:"text-sm font-semibold",style:{color:"var(--revka-text-primary)"},children:"Profile image"}),c.jsx("div",{className:"mt-1 text-xs",style:{color:"var(--revka-text-faint)"},children:"PNG, JPEG, or WebP."})]}),c.jsxs("label",{className:"revka-button cursor-pointer",children:[c.jsx(mE,{className:"h-4 w-4"}),"Upload",c.jsx("input",{type:"file",accept:"image/png,image/jpeg,image/webp",className:"sr-only",disabled:r,onChange:W=>{var P;return B(((P=W.target.files)==null?void 0:P[0])??null)}})]})]}),c.jsxs("label",{className:"mt-4 grid gap-2 text-sm",children:[c.jsx("span",{style:{color:"var(--revka-text-secondary)"},children:a("agents.form.identity")}),c.jsx("textarea",{className:"revka-input min-h-[7rem]",value:u,onChange:W=>d(W.target.value)})]}),c.jsxs("label",{className:"mt-4 grid gap-2 text-sm",children:[c.jsx("span",{style:{color:"var(--revka-text-secondary)"},children:a("agents.form.soul")}),c.jsx("textarea",{className:"revka-input min-h-[7rem]",value:p,onChange:W=>f(W.target.value)})]}),c.jsxs("div",{className:"mt-4 grid gap-4 md:grid-cols-2",children:[c.jsxs("label",{className:"grid gap-2 text-sm",children:[c.jsx("span",{style:{color:"var(--revka-text-secondary)"},children:a("agents.form.role")}),c.jsxs("select",{className:"revka-input",value:x,onChange:W=>v(W.target.value),children:[c.jsx("option",{value:"coder",children:a("agents.form.role.coder")}),c.jsx("option",{value:"reviewer",children:a("agents.form.role.reviewer")}),c.jsx("option",{value:"researcher",children:a("agents.form.role.researcher")})]})]}),c.jsxs("label",{className:"grid gap-2 text-sm",children:[c.jsx("span",{style:{color:"var(--revka-text-secondary)"},children:a("agents.form.agent_type")}),c.jsxs("select",{className:"revka-input",value:S,onChange:W=>w(W.target.value),children:[c.jsx("option",{value:"claude",children:"Claude"}),c.jsx("option",{value:"codex",children:"Codex"}),c.jsx("option",{value:"agy",children:"Antigravity (agy)"}),c.jsx("option",{value:"agent",children:"Cursor (agent)"}),c.jsx("option",{value:"opencode",children:"OpenCode (opencode)"})]})]})]}),c.jsxs("div",{className:"mt-4 grid gap-4 md:grid-cols-2",children:[c.jsxs("label",{className:"grid gap-2 text-sm",children:[c.jsx("span",{style:{color:"var(--revka-text-secondary)"},children:a("agents.form.model")}),c.jsx("input",{className:"revka-input",value:N,onChange:W=>C(W.target.value),placeholder:a("agents.form.model_placeholder")})]}),c.jsxs("label",{className:"grid gap-2 text-sm",children:[c.jsx("span",{style:{color:"var(--revka-text-secondary)"},children:a("agents.form.expertise")}),c.jsx("input",{className:"revka-input",value:E,onChange:W=>D(W.target.value),placeholder:a("agents.form.expertise_placeholder")})]})]}),c.jsxs("label",{className:"mt-4 grid gap-2 text-sm",children:[c.jsx("span",{style:{color:"var(--revka-text-secondary)"},children:a("agents.form.system_hint")}),c.jsx("textarea",{className:"revka-input min-h-[8rem]",value:T,onChange:W=>A(W.target.value),style:{fontFamily:"var(--pc-font-mono)"}})]}),c.jsxs("div",{className:"mt-5 flex flex-wrap justify-end gap-2",children:[c.jsx("button",{className:"revka-button",onClick:i,children:a("agents.form.cancel")}),c.jsx("button",{className:"revka-button","data-variant":"primary",disabled:r||!z,onClick:()=>s({name:o.trim(),identity:u.trim(),soul:p.trim(),expertise:E.split(",").map(W=>W.trim()).filter(Boolean),tone:g.trim(),role:x,agent_type:S,model:N.trim(),system_hint:T,avatarFile:F}),children:a(r?"agents.form.saving":e==="create"?"agents.form.save_create":"agents.form.save_edit")})]})]})}function NAe(e,n){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var i,s,a,o,l=[],u=!0,d=!1;try{if(a=(r=r.call(e)).next,n===0){if(Object(r)!==r)return;u=!1}else for(;!(u=(i=a.call(r)).done)&&(l.push(i.value),l.length!==n);u=!0);}catch(p){d=!0,s=p}finally{try{if(!u&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(d)throw s}}return l}}function EAe(e,n,r){return n=LAe(n),n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function X6(e,n){return MAe(e)||NAe(e,n)||JU(e,n)||DAe()}function AAe(e){return TAe(e)||RAe(e)||JU(e)||OAe()}function TAe(e){if(Array.isArray(e))return IN(e)}function MAe(e){if(Array.isArray(e))return e}function RAe(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function JU(e,n){if(e){if(typeof e=="string")return IN(e,n);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return IN(e,n)}}function IN(e,n){(n==null||n>e.length)&&(n=e.length);for(var r=0,i=new Array(n);r<n;r++)i[r]=e[r];return i}function OAe(){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 DAe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function PAe(e,n){if(typeof e!="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,n);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}function LAe(e){var n=PAe(e,"string");return typeof n=="symbol"?n:String(n)}var IAe=function(n,r){var i=new Set(r);return Object.assign.apply(Object,[{}].concat(AAe(Object.entries(n).filter(function(s){var a=X6(s,1),o=a[0];return!i.has(o)}).map(function(s){var a=X6(s,2),o=a[0],l=a[1];return EAe({},o,l)}))))};function BN(e,n){(n==null||n>e.length)&&(n=e.length);for(var r=0,i=Array(n);r<n;r++)i[r]=e[r];return i}function BAe(e){if(Array.isArray(e))return e}function zAe(e){if(Array.isArray(e))return BN(e)}function $Ae(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function FAe(e,n){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var i,s,a,o,l=[],u=!0,d=!1;try{if(a=(r=r.call(e)).next,n!==0)for(;!(u=(i=a.call(r)).done)&&(l.push(i.value),l.length!==n);u=!0);}catch(p){d=!0,s=p}finally{try{if(!u&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(d)throw s}}return l}}function HAe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function WAe(){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 qAe(e,n){return BAe(e)||FAe(e,n)||eV(e,n)||HAe()}function Q6(e){return zAe(e)||$Ae(e)||eV(e)||WAe()}function eV(e,n){if(e){if(typeof e=="string")return BN(e,n);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?BN(e,n):void 0}}function UAe(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=n.wrapperElementType,i=r===void 0?"div":r,s=n.nodeMapper,a=s===void 0?function(p){return p}:s,o=n.methodNames,l=o===void 0?[]:o,u=n.initPropNames,d=u===void 0?[]:u;return b.forwardRef(function(p,f){var g=b.useRef(),_=b.useMemo(function(){var S=Object.fromEntries(d.filter(function(w){return p.hasOwnProperty(w)}).map(function(w){return[w,p[w]]}));return e(S)},[]);Z6(function(){_(a(g.current))},b.useLayoutEffect),Z6(function(){return _._destructor instanceof Function?_._destructor:void 0});var x=b.useCallback(function(S){for(var w=arguments.length,N=new Array(w>1?w-1:0),C=1;C<w;C++)N[C-1]=arguments[C];return _[S]instanceof Function?_[S].apply(_,N):void 0},[_]),v=b.useRef({});return Object.keys(IAe(p,[].concat(Q6(l),Q6(d)))).filter(function(S){return v.current[S]!==p[S]}).forEach(function(S){return x(S,p[S])}),v.current=p,b.useImperativeHandle(f,function(){return Object.fromEntries(l.map(function(S){return[S,function(){for(var w=arguments.length,N=new Array(w),C=0;C<w;C++)N[C]=arguments[C];return x.apply(void 0,[S].concat(N))}]}))},[x]),Wf.createElement(i,{ref:g})})}function Z6(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:b.useEffect,r=b.useRef(),i=b.useRef(!1),s=b.useRef(!1),a=b.useState(0),o=qAe(a,2);o[0];var l=o[1];i.current&&(s.current=!0),n(function(){return i.current||(r.current=e(),i.current=!0),l(function(u){return u+1}),function(){s.current&&r.current&&r.current()}},[])}class J6 extends Map{constructor(n,r=YAe){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:r}}),n!=null)for(const[i,s]of n)this.set(i,s)}get(n){return super.get(eI(this,n))}has(n){return super.has(eI(this,n))}set(n,r){return super.set(VAe(this,n),r)}delete(n){return super.delete(KAe(this,n))}}function eI({_intern:e,_key:n},r){const i=n(r);return e.has(i)?e.get(i):r}function VAe({_intern:e,_key:n},r){const i=n(r);return e.has(i)?e.get(i):(e.set(i,r),r)}function KAe({_intern:e,_key:n},r){const i=n(r);return e.has(i)&&(r=e.get(i),e.delete(i)),r}function YAe(e){return e!==null&&typeof e=="object"?e.valueOf():e}function tI(e,n){let r;if(n===void 0)for(const i of e)i!=null&&(r<i||r===void 0&&i>=i)&&(r=i);else{let i=-1;for(let s of e)(s=n(s,++i,e))!=null&&(r<s||r===void 0&&s>=s)&&(r=s)}return r}function nI(e,n){let r;if(n===void 0)for(const i of e)i!=null&&(r>i||r===void 0&&i>=i)&&(r=i);else{let i=-1;for(let s of e)(s=n(s,++i,e))!=null&&(r>s||r===void 0&&s>=s)&&(r=s)}return r}function GAe(e,n){let r=0;for(let i of e)(i=+i)&&(r+=i);return r}var XAe=typeof global=="object"&&global&&global.Object===Object&&global,QAe=typeof self=="object"&&self&&self.Object===Object&&self,tV=XAe||QAe||Function("return this")(),Fb=tV.Symbol,nV=Object.prototype,ZAe=nV.hasOwnProperty,JAe=nV.toString,vm=Fb?Fb.toStringTag:void 0;function eTe(e){var n=ZAe.call(e,vm),r=e[vm];try{e[vm]=void 0;var i=!0}catch{}var s=JAe.call(e);return i&&(n?e[vm]=r:delete e[vm]),s}var tTe=Object.prototype,nTe=tTe.toString;function rTe(e){return nTe.call(e)}var iTe="[object Null]",sTe="[object Undefined]",rI=Fb?Fb.toStringTag:void 0;function aTe(e){return e==null?e===void 0?sTe:iTe:rI&&rI in Object(e)?eTe(e):rTe(e)}function oTe(e){return e!=null&&typeof e=="object"}var lTe="[object Symbol]";function cTe(e){return typeof e=="symbol"||oTe(e)&&aTe(e)==lTe}var uTe=/\s/;function dTe(e){for(var n=e.length;n--&&uTe.test(e.charAt(n)););return n}var hTe=/^\s+/;function fTe(e){return e&&e.slice(0,dTe(e)+1).replace(hTe,"")}function Hb(e){var n=typeof e;return e!=null&&(n=="object"||n=="function")}var iI=NaN,pTe=/^[-+]0x[0-9a-f]+$/i,mTe=/^0b[01]+$/i,gTe=/^0o[0-7]+$/i,vTe=parseInt;function sI(e){if(typeof e=="number")return e;if(cTe(e))return iI;if(Hb(e)){var n=typeof e.valueOf=="function"?e.valueOf():e;e=Hb(n)?n+"":n}if(typeof e!="string")return e===0?e:+e;e=fTe(e);var r=mTe.test(e);return r||gTe.test(e)?vTe(e.slice(2),r?2:8):pTe.test(e)?iI:+e}var m2=function(){return tV.Date.now()},yTe="Expected a function",_Te=Math.max,xTe=Math.min;function rV(e,n,r){var i,s,a,o,l,u,d=0,p=!1,f=!1,g=!0;if(typeof e!="function")throw new TypeError(yTe);n=sI(n)||0,Hb(r)&&(p=!!r.leading,f="maxWait"in r,a=f?_Te(sI(r.maxWait)||0,n):a,g="trailing"in r?!!r.trailing:g);function _(E){var D=i,F=s;return i=s=void 0,d=E,o=e.apply(F,D),o}function x(E){return d=E,l=setTimeout(w,n),p?_(E):o}function v(E){var D=E-u,F=E-d,B=n-D;return f?xTe(B,a-F):B}function S(E){var D=E-u,F=E-d;return u===void 0||D>=n||D<0||f&&F>=a}function w(){var E=m2();if(S(E))return N(E);l=setTimeout(w,v(E))}function N(E){return l=void 0,g&&i?_(E):(i=s=void 0,o)}function C(){l!==void 0&&clearTimeout(l),d=0,i=u=s=l=void 0}function T(){return l===void 0?o:N(m2())}function A(){var E=m2(),D=S(E);if(i=arguments,s=this,u=E,D){if(l===void 0)return x(u);if(f)return clearTimeout(l),l=setTimeout(w,n),_(u)}return l===void 0&&(l=setTimeout(w,n)),o}return A.cancel=C,A.flush=T,A}var bTe="Expected a function";function kTe(e,n,r){var i=!0,s=!0;if(typeof e!="function")throw new TypeError(bTe);return Hb(r)&&(i="leading"in r?!!r.leading:i,s="trailing"in r?!!r.trailing:s),rV(e,n,{leading:i,maxWait:n,trailing:s})}var _d=Object.freeze({Linear:Object.freeze({None:function(e){return e},In:function(e){return e},Out:function(e){return e},InOut:function(e){return e}}),Quadratic:Object.freeze({In:function(e){return e*e},Out:function(e){return e*(2-e)},InOut:function(e){return(e*=2)<1?.5*e*e:-.5*(--e*(e-2)-1)}}),Cubic:Object.freeze({In:function(e){return e*e*e},Out:function(e){return--e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e:.5*((e-=2)*e*e+2)}}),Quartic:Object.freeze({In:function(e){return e*e*e*e},Out:function(e){return 1- --e*e*e*e},InOut:function(e){return(e*=2)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2)}}),Quintic:Object.freeze({In:function(e){return e*e*e*e*e},Out:function(e){return--e*e*e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2)}}),Sinusoidal:Object.freeze({In:function(e){return 1-Math.sin((1-e)*Math.PI/2)},Out:function(e){return Math.sin(e*Math.PI/2)},InOut:function(e){return .5*(1-Math.sin(Math.PI*(.5-e)))}}),Exponential:Object.freeze({In:function(e){return e===0?0:Math.pow(1024,e-1)},Out:function(e){return e===1?1:1-Math.pow(2,-10*e)},InOut:function(e){return e===0?0:e===1?1:(e*=2)<1?.5*Math.pow(1024,e-1):.5*(-Math.pow(2,-10*(e-1))+2)}}),Circular:Object.freeze({In:function(e){return 1-Math.sqrt(1-e*e)},Out:function(e){return Math.sqrt(1- --e*e)},InOut:function(e){return(e*=2)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1)}}),Elastic:Object.freeze({In:function(e){return e===0?0:e===1?1:-Math.pow(2,10*(e-1))*Math.sin((e-1.1)*5*Math.PI)},Out:function(e){return e===0?0:e===1?1:Math.pow(2,-10*e)*Math.sin((e-.1)*5*Math.PI)+1},InOut:function(e){return e===0?0:e===1?1:(e*=2,e<1?-.5*Math.pow(2,10*(e-1))*Math.sin((e-1.1)*5*Math.PI):.5*Math.pow(2,-10*(e-1))*Math.sin((e-1.1)*5*Math.PI)+1)}}),Back:Object.freeze({In:function(e){var n=1.70158;return e===1?1:e*e*((n+1)*e-n)},Out:function(e){var n=1.70158;return e===0?0:--e*e*((n+1)*e+n)+1},InOut:function(e){var n=2.5949095;return(e*=2)<1?.5*(e*e*((n+1)*e-n)):.5*((e-=2)*e*((n+1)*e+n)+2)}}),Bounce:Object.freeze({In:function(e){return 1-_d.Bounce.Out(1-e)},Out:function(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},InOut:function(e){return e<.5?_d.Bounce.In(e*2)*.5:_d.Bounce.Out(e*2-1)*.5+.5}}),generatePow:function(e){return e===void 0&&(e=4),e=e<Number.EPSILON?Number.EPSILON:e,e=e>1e4?1e4:e,{In:function(n){return Math.pow(n,e)},Out:function(n){return 1-Math.pow(1-n,e)},InOut:function(n){return n<.5?Math.pow(n*2,e)/2:(1-Math.pow(2-n*2,e))/2+.5}}}}),Lm=function(){return performance.now()},iV=(function(){function e(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];this._tweens={},this._tweensAddedDuringUpdate={},this.add.apply(this,n)}return e.prototype.getAll=function(){var n=this;return Object.keys(this._tweens).map(function(r){return n._tweens[r]})},e.prototype.removeAll=function(){this._tweens={}},e.prototype.add=function(){for(var n,r=[],i=0;i<arguments.length;i++)r[i]=arguments[i];for(var s=0,a=r;s<a.length;s++){var o=a[s];(n=o._group)===null||n===void 0||n.remove(o),o._group=this,this._tweens[o.getId()]=o,this._tweensAddedDuringUpdate[o.getId()]=o}},e.prototype.remove=function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];for(var i=0,s=n;i<s.length;i++){var a=s[i];a._group=void 0,delete this._tweens[a.getId()],delete this._tweensAddedDuringUpdate[a.getId()]}},e.prototype.allStopped=function(){return this.getAll().every(function(n){return!n.isPlaying()})},e.prototype.update=function(n,r){n===void 0&&(n=Lm()),r===void 0&&(r=!0);var i=Object.keys(this._tweens);if(i.length!==0)for(;i.length>0;){this._tweensAddedDuringUpdate={};for(var s=0;s<i.length;s++){var a=this._tweens[i[s]],o=!r;a&&a.update(n,o)===!1&&!r&&this.remove(a)}i=Object.keys(this._tweensAddedDuringUpdate)}},e})(),zN={Linear:function(e,n){var r=e.length-1,i=r*n,s=Math.floor(i),a=zN.Utils.Linear;return n<0?a(e[0],e[1],i):n>1?a(e[r],e[r-1],r-i):a(e[s],e[s+1>r?r:s+1],i-s)},Utils:{Linear:function(e,n,r){return(n-e)*r+e}}},sV=(function(){function e(){}return e.nextId=function(){return e._nextId++},e._nextId=0,e})(),$N=new iV,aI=(function(){function e(n,r){this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._isDynamic=!1,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=_d.Linear.None,this._interpolationFunction=zN.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=sV.nextId(),this._isChainStopped=!1,this._propertiesAreSetUp=!1,this._goToEnd=!1,this._object=n,typeof r=="object"?(this._group=r,r.add(this)):r===!0&&(this._group=$N,$N.add(this))}return e.prototype.getId=function(){return this._id},e.prototype.isPlaying=function(){return this._isPlaying},e.prototype.isPaused=function(){return this._isPaused},e.prototype.getDuration=function(){return this._duration},e.prototype.to=function(n,r){if(r===void 0&&(r=1e3),this._isPlaying)throw new Error("Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.");return this._valuesEnd=n,this._propertiesAreSetUp=!1,this._duration=r<0?0:r,this},e.prototype.duration=function(n){return n===void 0&&(n=1e3),this._duration=n<0?0:n,this},e.prototype.dynamic=function(n){return n===void 0&&(n=!1),this._isDynamic=n,this},e.prototype.start=function(n,r){if(n===void 0&&(n=Lm()),r===void 0&&(r=!1),this._isPlaying)return this;if(this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(var i in this._valuesStartRepeat)this._swapEndStartRepeatValues(i),this._valuesStart[i]=this._valuesStartRepeat[i]}if(this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=n,this._startTime+=this._delayTime,!this._propertiesAreSetUp||r){if(this._propertiesAreSetUp=!0,!this._isDynamic){var s={};for(var a in this._valuesEnd)s[a]=this._valuesEnd[a];this._valuesEnd=s}this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,r)}return this},e.prototype.startFromCurrentValues=function(n){return this.start(n,!0)},e.prototype._setupProperties=function(n,r,i,s,a){for(var o in i){var l=n[o],u=Array.isArray(l),d=u?"array":typeof l,p=!u&&Array.isArray(i[o]);if(!(d==="undefined"||d==="function")){if(p){var f=i[o];if(f.length===0)continue;for(var g=[l],_=0,x=f.length;_<x;_+=1){var v=this._handleRelativeValue(l,f[_]);if(isNaN(v)){p=!1,console.warn("Found invalid interpolation list. Skipping.");break}g.push(v)}p&&(i[o]=g)}if((d==="object"||u)&&l&&!p){r[o]=u?[]:{};var S=l;for(var w in S)r[o][w]=S[w];s[o]=u?[]:{};var f=i[o];if(!this._isDynamic){var N={};for(var w in f)N[w]=f[w];i[o]=f=N}this._setupProperties(S,r[o],f,s[o],a)}else(typeof r[o]>"u"||a)&&(r[o]=l),u||(r[o]*=1),p?s[o]=i[o].slice().reverse():s[o]=r[o]||0}}},e.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},e.prototype.end=function(){return this._goToEnd=!0,this.update(this._startTime+this._duration),this},e.prototype.pause=function(n){return n===void 0&&(n=Lm()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=n,this)},e.prototype.resume=function(n){return n===void 0&&(n=Lm()),!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=n-this._pauseStart,this._pauseStart=0,this)},e.prototype.stopChainedTweens=function(){for(var n=0,r=this._chainedTweens.length;n<r;n++)this._chainedTweens[n].stop();return this},e.prototype.group=function(n){return n?(n.add(this),this):(console.warn("tween.group() without args has been removed, use group.add(tween) instead."),this)},e.prototype.remove=function(){var n;return(n=this._group)===null||n===void 0||n.remove(this),this},e.prototype.delay=function(n){return n===void 0&&(n=0),this._delayTime=n,this},e.prototype.repeat=function(n){return n===void 0&&(n=0),this._initialRepeat=n,this._repeat=n,this},e.prototype.repeatDelay=function(n){return this._repeatDelayTime=n,this},e.prototype.yoyo=function(n){return n===void 0&&(n=!1),this._yoyo=n,this},e.prototype.easing=function(n){return n===void 0&&(n=_d.Linear.None),this._easingFunction=n,this},e.prototype.interpolation=function(n){return n===void 0&&(n=zN.Linear),this._interpolationFunction=n,this},e.prototype.chain=function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return this._chainedTweens=n,this},e.prototype.onStart=function(n){return this._onStartCallback=n,this},e.prototype.onEveryStart=function(n){return this._onEveryStartCallback=n,this},e.prototype.onUpdate=function(n){return this._onUpdateCallback=n,this},e.prototype.onRepeat=function(n){return this._onRepeatCallback=n,this},e.prototype.onComplete=function(n){return this._onCompleteCallback=n,this},e.prototype.onStop=function(n){return this._onStopCallback=n,this},e.prototype.update=function(n,r){var i=this,s;if(n===void 0&&(n=Lm()),r===void 0&&(r=e.autoStartOnUpdate),this._isPaused)return!0;var a;if(!this._goToEnd&&!this._isPlaying)if(r)this.start(n,!0);else return!1;if(this._goToEnd=!1,n<this._startTime)return!0;this._onStartCallbackFired===!1&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),this._onEveryStartCallbackFired===!1&&(this._onEveryStartCallback&&this._onEveryStartCallback(this._object),this._onEveryStartCallbackFired=!0);var o=n-this._startTime,l=this._duration+((s=this._repeatDelayTime)!==null&&s!==void 0?s:this._delayTime),u=this._duration+this._repeat*l,d=function(){if(i._duration===0||o>u)return 1;var v=Math.trunc(o/l),S=o-v*l,w=Math.min(S/i._duration,1);return w===0&&o===i._duration?1:w},p=d(),f=this._easingFunction(p);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,f),this._onUpdateCallback&&this._onUpdateCallback(this._object,p),this._duration===0||o>=this._duration)if(this._repeat>0){var g=Math.min(Math.trunc((o-this._duration)/l)+1,this._repeat);isFinite(this._repeat)&&(this._repeat-=g);for(a in this._valuesStartRepeat)!this._yoyo&&typeof this._valuesEnd[a]=="string"&&(this._valuesStartRepeat[a]=this._valuesStartRepeat[a]+parseFloat(this._valuesEnd[a])),this._yoyo&&this._swapEndStartRepeatValues(a),this._valuesStart[a]=this._valuesStartRepeat[a];return this._yoyo&&(this._reversed=!this._reversed),this._startTime+=l*g,this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1,!0}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var _=0,x=this._chainedTweens.length;_<x;_++)this._chainedTweens[_].start(this._startTime+this._duration,!1);return this._isPlaying=!1,!1}return!0},e.prototype._updateProperties=function(n,r,i,s){for(var a in i)if(r[a]!==void 0){var o=r[a]||0,l=i[a],u=Array.isArray(n[a]),d=Array.isArray(l),p=!u&&d;p?n[a]=this._interpolationFunction(l,s):typeof l=="object"&&l?this._updateProperties(n[a],o,l,s):(l=this._handleRelativeValue(o,l),typeof l=="number"&&(n[a]=o+(l-o)*s))}},e.prototype._handleRelativeValue=function(n,r){return typeof r!="string"?r:r.charAt(0)==="+"||r.charAt(0)==="-"?n+parseFloat(r):parseFloat(r)},e.prototype._swapEndStartRepeatValues=function(n){var r=this._valuesStartRepeat[n],i=this._valuesEnd[n];typeof i=="string"?this._valuesStartRepeat[n]=this._valuesStartRepeat[n]+parseFloat(i):this._valuesStartRepeat[n]=this._valuesEnd[n],this._valuesEnd[n]=r},e.autoStartOnUpdate=!1,e})();sV.nextId;var Zo=$N;Zo.getAll.bind(Zo);Zo.removeAll.bind(Zo);Zo.add.bind(Zo);Zo.remove.bind(Zo);Zo.update.bind(Zo);function oI(e,n){(n==null||n>e.length)&&(n=e.length);for(var r=0,i=Array(n);r<n;r++)i[r]=e[r];return i}function wTe(e){if(Array.isArray(e))return e}function STe(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}function CTe(e,n,r){return Object.defineProperty(e,"prototype",{writable:!1}),e}function jTe(e,n){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var i,s,a,o,l=[],u=!0,d=!1;try{if(a=(r=r.call(e)).next,n!==0)for(;!(u=(i=a.call(r)).done)&&(l.push(i.value),l.length!==n);u=!0);}catch(p){d=!0,s=p}finally{try{if(!u&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(d)throw s}}return l}}function NTe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ETe(e,n){return wTe(e)||jTe(e,n)||ATe(e,n)||NTe()}function ATe(e,n){if(e){if(typeof e=="string")return oI(e,n);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?oI(e,n):void 0}}var TTe=CTe(function e(n,r){var i=r.default,s=i===void 0?null:i,a=r.triggerUpdate,o=a===void 0?!0:a,l=r.onChange,u=l===void 0?function(d,p){}:l;STe(this,e),this.name=n,this.defaultVal=s,this.triggerUpdate=o,this.onChange=u});function bT(e){var n=e.stateInit,r=n===void 0?function(){return{}}:n,i=e.props,s=i===void 0?{}:i,a=e.methods,o=a===void 0?{}:a,l=e.aliases,u=l===void 0?{}:l,d=e.init,p=d===void 0?function(){}:d,f=e.update,g=f===void 0?function(){}:f,_=Object.keys(s).map(function(x){return new TTe(x,s[x])});return function x(){for(var v=arguments.length,S=new Array(v),w=0;w<v;w++)S[w]=arguments[w];var N=!!(this instanceof x&&this.constructor),C=N?S.shift():void 0,T=S[0],A=T===void 0?{}:T,E=Object.assign({},r instanceof Function?r(A):r,{initialised:!1}),D={};function F($){return B($,A),H(),F}var B=function(z,W){p.call(F,z,E,W),E.initialised=!0},H=rV(function(){E.initialised&&(g.call(F,E,D),D={})},1);return _.forEach(function($){F[$.name]=z($);function z(W){var P=W.name,q=W.triggerUpdate,I=q===void 0?!1:q,Q=W.onChange,K=Q===void 0?function(R,U){}:Q,Z=W.defaultVal,Y=Z===void 0?null:Z;return function(R){var U=E[P];if(!arguments.length)return U;var V=R===void 0?Y:R;return E[P]=V,K.call(F,V,E,U),!D.hasOwnProperty(P)&&(D[P]=U),I&&H(),F}}}),Object.keys(o).forEach(function($){F[$]=function(){for(var z,W=arguments.length,P=new Array(W),q=0;q<W;q++)P[q]=arguments[q];return(z=o[$]).call.apply(z,[F,E].concat(P))}}),Object.entries(u).forEach(function($){var z=ETe($,2),W=z[0],P=z[1];return F[W]=F[P]}),F.resetProps=function(){return _.forEach(function($){F[$.name]($.defaultVal)}),F},F.resetProps(),E._rerender=H,N&&C&&F(C),F}}var Ln=(function(e){return typeof e=="function"?e:typeof e=="string"?function(n){return n[e]}:function(n){return e}});function Wb(e){"@babel/helpers - typeof";return Wb=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},Wb(e)}var MTe=/^\s+/,RTe=/\s+$/;function It(e,n){if(e=e||"",n=n||{},e instanceof It)return e;if(!(this instanceof It))return new It(e,n);var r=OTe(e);this._originalInput=e,this._r=r.r,this._g=r.g,this._b=r.b,this._a=r.a,this._roundA=Math.round(100*this._a)/100,this._format=n.format||r.format,this._gradientType=n.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=r.ok}It.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var n=this.toRgb();return(n.r*299+n.g*587+n.b*114)/1e3},getLuminance:function(){var n=this.toRgb(),r,i,s,a,o,l;return r=n.r/255,i=n.g/255,s=n.b/255,r<=.03928?a=r/12.92:a=Math.pow((r+.055)/1.055,2.4),i<=.03928?o=i/12.92:o=Math.pow((i+.055)/1.055,2.4),s<=.03928?l=s/12.92:l=Math.pow((s+.055)/1.055,2.4),.2126*a+.7152*o+.0722*l},setAlpha:function(n){return this._a=aV(n),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var n=cI(this._r,this._g,this._b);return{h:n.h*360,s:n.s,v:n.v,a:this._a}},toHsvString:function(){var n=cI(this._r,this._g,this._b),r=Math.round(n.h*360),i=Math.round(n.s*100),s=Math.round(n.v*100);return this._a==1?"hsv("+r+", "+i+"%, "+s+"%)":"hsva("+r+", "+i+"%, "+s+"%, "+this._roundA+")"},toHsl:function(){var n=lI(this._r,this._g,this._b);return{h:n.h*360,s:n.s,l:n.l,a:this._a}},toHslString:function(){var n=lI(this._r,this._g,this._b),r=Math.round(n.h*360),i=Math.round(n.s*100),s=Math.round(n.l*100);return this._a==1?"hsl("+r+", "+i+"%, "+s+"%)":"hsla("+r+", "+i+"%, "+s+"%, "+this._roundA+")"},toHex:function(n){return uI(this._r,this._g,this._b,n)},toHexString:function(n){return"#"+this.toHex(n)},toHex8:function(n){return ITe(this._r,this._g,this._b,this._a,n)},toHex8String:function(n){return"#"+this.toHex8(n)},toRgb:function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:Math.round(vr(this._r,255)*100)+"%",g:Math.round(vr(this._g,255)*100)+"%",b:Math.round(vr(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+Math.round(vr(this._r,255)*100)+"%, "+Math.round(vr(this._g,255)*100)+"%, "+Math.round(vr(this._b,255)*100)+"%)":"rgba("+Math.round(vr(this._r,255)*100)+"%, "+Math.round(vr(this._g,255)*100)+"%, "+Math.round(vr(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:GTe[uI(this._r,this._g,this._b,!0)]||!1},toFilter:function(n){var r="#"+dI(this._r,this._g,this._b,this._a),i=r,s=this._gradientType?"GradientType = 1, ":"";if(n){var a=It(n);i="#"+dI(a._r,a._g,a._b,a._a)}return"progid:DXImageTransform.Microsoft.gradient("+s+"startColorstr="+r+",endColorstr="+i+")"},toString:function(n){var r=!!n;n=n||this._format;var i=!1,s=this._a<1&&this._a>=0,a=!r&&s&&(n==="hex"||n==="hex6"||n==="hex3"||n==="hex4"||n==="hex8"||n==="name");return a?n==="name"&&this._a===0?this.toName():this.toRgbString():(n==="rgb"&&(i=this.toRgbString()),n==="prgb"&&(i=this.toPercentageRgbString()),(n==="hex"||n==="hex6")&&(i=this.toHexString()),n==="hex3"&&(i=this.toHexString(!0)),n==="hex4"&&(i=this.toHex8String(!0)),n==="hex8"&&(i=this.toHex8String()),n==="name"&&(i=this.toName()),n==="hsl"&&(i=this.toHslString()),n==="hsv"&&(i=this.toHsvString()),i||this.toHexString())},clone:function(){return It(this.toString())},_applyModification:function(n,r){var i=n.apply(null,[this].concat([].slice.call(r)));return this._r=i._r,this._g=i._g,this._b=i._b,this.setAlpha(i._a),this},lighten:function(){return this._applyModification(FTe,arguments)},brighten:function(){return this._applyModification(HTe,arguments)},darken:function(){return this._applyModification(WTe,arguments)},desaturate:function(){return this._applyModification(BTe,arguments)},saturate:function(){return this._applyModification(zTe,arguments)},greyscale:function(){return this._applyModification($Te,arguments)},spin:function(){return this._applyModification(qTe,arguments)},_applyCombination:function(n,r){return n.apply(null,[this].concat([].slice.call(r)))},analogous:function(){return this._applyCombination(KTe,arguments)},complement:function(){return this._applyCombination(UTe,arguments)},monochromatic:function(){return this._applyCombination(YTe,arguments)},splitcomplement:function(){return this._applyCombination(VTe,arguments)},triad:function(){return this._applyCombination(hI,[3])},tetrad:function(){return this._applyCombination(hI,[4])}};It.fromRatio=function(e,n){if(Wb(e)=="object"){var r={};for(var i in e)e.hasOwnProperty(i)&&(i==="a"?r[i]=e[i]:r[i]=Im(e[i]));e=r}return It(e,n)};function OTe(e){var n={r:0,g:0,b:0},r=1,i=null,s=null,a=null,o=!1,l=!1;return typeof e=="string"&&(e=JTe(e)),Wb(e)=="object"&&(Sl(e.r)&&Sl(e.g)&&Sl(e.b)?(n=DTe(e.r,e.g,e.b),o=!0,l=String(e.r).substr(-1)==="%"?"prgb":"rgb"):Sl(e.h)&&Sl(e.s)&&Sl(e.v)?(i=Im(e.s),s=Im(e.v),n=LTe(e.h,i,s),o=!0,l="hsv"):Sl(e.h)&&Sl(e.s)&&Sl(e.l)&&(i=Im(e.s),a=Im(e.l),n=PTe(e.h,i,a),o=!0,l="hsl"),e.hasOwnProperty("a")&&(r=e.a)),r=aV(r),{ok:o,format:e.format||l,r:Math.min(255,Math.max(n.r,0)),g:Math.min(255,Math.max(n.g,0)),b:Math.min(255,Math.max(n.b,0)),a:r}}function DTe(e,n,r){return{r:vr(e,255)*255,g:vr(n,255)*255,b:vr(r,255)*255}}function lI(e,n,r){e=vr(e,255),n=vr(n,255),r=vr(r,255);var i=Math.max(e,n,r),s=Math.min(e,n,r),a,o,l=(i+s)/2;if(i==s)a=o=0;else{var u=i-s;switch(o=l>.5?u/(2-i-s):u/(i+s),i){case e:a=(n-r)/u+(n<r?6:0);break;case n:a=(r-e)/u+2;break;case r:a=(e-n)/u+4;break}a/=6}return{h:a,s:o,l}}function PTe(e,n,r){var i,s,a;e=vr(e,360),n=vr(n,100),r=vr(r,100);function o(d,p,f){return f<0&&(f+=1),f>1&&(f-=1),f<1/6?d+(p-d)*6*f:f<1/2?p:f<2/3?d+(p-d)*(2/3-f)*6:d}if(n===0)i=s=a=r;else{var l=r<.5?r*(1+n):r+n-r*n,u=2*r-l;i=o(u,l,e+1/3),s=o(u,l,e),a=o(u,l,e-1/3)}return{r:i*255,g:s*255,b:a*255}}function cI(e,n,r){e=vr(e,255),n=vr(n,255),r=vr(r,255);var i=Math.max(e,n,r),s=Math.min(e,n,r),a,o,l=i,u=i-s;if(o=i===0?0:u/i,i==s)a=0;else{switch(i){case e:a=(n-r)/u+(n<r?6:0);break;case n:a=(r-e)/u+2;break;case r:a=(e-n)/u+4;break}a/=6}return{h:a,s:o,v:l}}function LTe(e,n,r){e=vr(e,360)*6,n=vr(n,100),r=vr(r,100);var i=Math.floor(e),s=e-i,a=r*(1-n),o=r*(1-s*n),l=r*(1-(1-s)*n),u=i%6,d=[r,o,a,a,l,r][u],p=[l,r,r,o,a,a][u],f=[a,a,l,r,r,o][u];return{r:d*255,g:p*255,b:f*255}}function uI(e,n,r,i){var s=[Ga(Math.round(e).toString(16)),Ga(Math.round(n).toString(16)),Ga(Math.round(r).toString(16))];return i&&s[0].charAt(0)==s[0].charAt(1)&&s[1].charAt(0)==s[1].charAt(1)&&s[2].charAt(0)==s[2].charAt(1)?s[0].charAt(0)+s[1].charAt(0)+s[2].charAt(0):s.join("")}function ITe(e,n,r,i,s){var a=[Ga(Math.round(e).toString(16)),Ga(Math.round(n).toString(16)),Ga(Math.round(r).toString(16)),Ga(oV(i))];return s&&a[0].charAt(0)==a[0].charAt(1)&&a[1].charAt(0)==a[1].charAt(1)&&a[2].charAt(0)==a[2].charAt(1)&&a[3].charAt(0)==a[3].charAt(1)?a[0].charAt(0)+a[1].charAt(0)+a[2].charAt(0)+a[3].charAt(0):a.join("")}function dI(e,n,r,i){var s=[Ga(oV(i)),Ga(Math.round(e).toString(16)),Ga(Math.round(n).toString(16)),Ga(Math.round(r).toString(16))];return s.join("")}It.equals=function(e,n){return!e||!n?!1:It(e).toRgbString()==It(n).toRgbString()};It.random=function(){return It.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function BTe(e,n){n=n===0?0:n||10;var r=It(e).toHsl();return r.s-=n/100,r.s=nk(r.s),It(r)}function zTe(e,n){n=n===0?0:n||10;var r=It(e).toHsl();return r.s+=n/100,r.s=nk(r.s),It(r)}function $Te(e){return It(e).desaturate(100)}function FTe(e,n){n=n===0?0:n||10;var r=It(e).toHsl();return r.l+=n/100,r.l=nk(r.l),It(r)}function HTe(e,n){n=n===0?0:n||10;var r=It(e).toRgb();return r.r=Math.max(0,Math.min(255,r.r-Math.round(255*-(n/100)))),r.g=Math.max(0,Math.min(255,r.g-Math.round(255*-(n/100)))),r.b=Math.max(0,Math.min(255,r.b-Math.round(255*-(n/100)))),It(r)}function WTe(e,n){n=n===0?0:n||10;var r=It(e).toHsl();return r.l-=n/100,r.l=nk(r.l),It(r)}function qTe(e,n){var r=It(e).toHsl(),i=(r.h+n)%360;return r.h=i<0?360+i:i,It(r)}function UTe(e){var n=It(e).toHsl();return n.h=(n.h+180)%360,It(n)}function hI(e,n){if(isNaN(n)||n<=0)throw new Error("Argument to polyad must be a positive number");for(var r=It(e).toHsl(),i=[It(e)],s=360/n,a=1;a<n;a++)i.push(It({h:(r.h+a*s)%360,s:r.s,l:r.l}));return i}function VTe(e){var n=It(e).toHsl(),r=n.h;return[It(e),It({h:(r+72)%360,s:n.s,l:n.l}),It({h:(r+216)%360,s:n.s,l:n.l})]}function KTe(e,n,r){n=n||6,r=r||30;var i=It(e).toHsl(),s=360/r,a=[It(e)];for(i.h=(i.h-(s*n>>1)+720)%360;--n;)i.h=(i.h+s)%360,a.push(It(i));return a}function YTe(e,n){n=n||6;for(var r=It(e).toHsv(),i=r.h,s=r.s,a=r.v,o=[],l=1/n;n--;)o.push(It({h:i,s,v:a})),a=(a+l)%1;return o}It.mix=function(e,n,r){r=r===0?0:r||50;var i=It(e).toRgb(),s=It(n).toRgb(),a=r/100,o={r:(s.r-i.r)*a+i.r,g:(s.g-i.g)*a+i.g,b:(s.b-i.b)*a+i.b,a:(s.a-i.a)*a+i.a};return It(o)};It.readability=function(e,n){var r=It(e),i=It(n);return(Math.max(r.getLuminance(),i.getLuminance())+.05)/(Math.min(r.getLuminance(),i.getLuminance())+.05)};It.isReadable=function(e,n,r){var i=It.readability(e,n),s,a;switch(a=!1,s=eMe(r),s.level+s.size){case"AAsmall":case"AAAlarge":a=i>=4.5;break;case"AAlarge":a=i>=3;break;case"AAAsmall":a=i>=7;break}return a};It.mostReadable=function(e,n,r){var i=null,s=0,a,o,l,u;r=r||{},o=r.includeFallbackColors,l=r.level,u=r.size;for(var d=0;d<n.length;d++)a=It.readability(e,n[d]),a>s&&(s=a,i=It(n[d]));return It.isReadable(e,i,{level:l,size:u})||!o?i:(r.includeFallbackColors=!1,It.mostReadable(e,["#fff","#000"],r))};var FN=It.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},GTe=It.hexNames=XTe(FN);function XTe(e){var n={};for(var r in e)e.hasOwnProperty(r)&&(n[e[r]]=r);return n}function aV(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function vr(e,n){QTe(e)&&(e="100%");var r=ZTe(e);return e=Math.min(n,Math.max(0,parseFloat(e))),r&&(e=parseInt(e*n,10)/100),Math.abs(e-n)<1e-6?1:e%n/parseFloat(n)}function nk(e){return Math.min(1,Math.max(0,e))}function Ys(e){return parseInt(e,16)}function QTe(e){return typeof e=="string"&&e.indexOf(".")!=-1&&parseFloat(e)===1}function ZTe(e){return typeof e=="string"&&e.indexOf("%")!=-1}function Ga(e){return e.length==1?"0"+e:""+e}function Im(e){return e<=1&&(e=e*100+"%"),e}function oV(e){return Math.round(parseFloat(e)*255).toString(16)}function fI(e){return Ys(e)/255}var Ia=(function(){var e="[-\\+]?\\d+%?",n="[-\\+]?\\d*\\.\\d+%?",r="(?:"+n+")|(?:"+e+")",i="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?",s="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?";return{CSS_UNIT:new RegExp(r),rgb:new RegExp("rgb"+i),rgba:new RegExp("rgba"+s),hsl:new RegExp("hsl"+i),hsla:new RegExp("hsla"+s),hsv:new RegExp("hsv"+i),hsva:new RegExp("hsva"+s),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}})();function Sl(e){return!!Ia.CSS_UNIT.exec(e)}function JTe(e){e=e.replace(MTe,"").replace(RTe,"").toLowerCase();var n=!1;if(FN[e])e=FN[e],n=!0;else if(e=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var r;return(r=Ia.rgb.exec(e))?{r:r[1],g:r[2],b:r[3]}:(r=Ia.rgba.exec(e))?{r:r[1],g:r[2],b:r[3],a:r[4]}:(r=Ia.hsl.exec(e))?{h:r[1],s:r[2],l:r[3]}:(r=Ia.hsla.exec(e))?{h:r[1],s:r[2],l:r[3],a:r[4]}:(r=Ia.hsv.exec(e))?{h:r[1],s:r[2],v:r[3]}:(r=Ia.hsva.exec(e))?{h:r[1],s:r[2],v:r[3],a:r[4]}:(r=Ia.hex8.exec(e))?{r:Ys(r[1]),g:Ys(r[2]),b:Ys(r[3]),a:fI(r[4]),format:n?"name":"hex8"}:(r=Ia.hex6.exec(e))?{r:Ys(r[1]),g:Ys(r[2]),b:Ys(r[3]),format:n?"name":"hex"}:(r=Ia.hex4.exec(e))?{r:Ys(r[1]+""+r[1]),g:Ys(r[2]+""+r[2]),b:Ys(r[3]+""+r[3]),a:fI(r[4]+""+r[4]),format:n?"name":"hex8"}:(r=Ia.hex3.exec(e))?{r:Ys(r[1]+""+r[1]),g:Ys(r[2]+""+r[2]),b:Ys(r[3]+""+r[3]),format:n?"name":"hex"}:!1}function eMe(e){var n,r;return e=e||{level:"AA",size:"small"},n=(e.level||"AA").toUpperCase(),r=(e.size||"small").toLowerCase(),n!=="AA"&&n!=="AAA"&&(n="AA"),r!=="small"&&r!=="large"&&(r="small"),{level:n,size:r}}function HN(e,n){(n==null||n>e.length)&&(n=e.length);for(var r=0,i=Array(n);r<n;r++)i[r]=e[r];return i}function tMe(e){if(Array.isArray(e))return HN(e)}function lV(e,n,r){if(typeof e=="function"?e===n:e.has(n))return arguments.length<3?n:r;throw new TypeError("Private element is not present on this object")}function nMe(e,n){if(n.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function rMe(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}function ma(e,n){return e.get(lV(e,n))}function pI(e,n,r){nMe(e,n),n.set(e,r)}function mI(e,n,r){return e.set(lV(e,n),r),r}function iMe(e,n){for(var r=0;r<n.length;r++){var i=n[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,uMe(i.key),i)}}function sMe(e,n,r){return n&&iMe(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function aMe(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function oMe(){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 lMe(e){return tMe(e)||aMe(e)||dMe(e)||oMe()}function cMe(e,n){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,n);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function uMe(e){var n=cMe(e,"string");return typeof n=="symbol"?n:n+""}function dMe(e,n){if(e){if(typeof e=="string")return HN(e,n);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?HN(e,n):void 0}}var hMe=123,fMe=function(n){return"#".concat(Math.min(n,Math.pow(2,24)).toString(16).padStart(6,"0"))},cV=function(n,r,i){return(n<<16)+(r<<8)+i},pMe=function(n){var r=It(n).toRgb(),i=r.r,s=r.g,a=r.b;return cV(i,s,a)},gI=function(n,r){return n*hMe%Math.pow(2,r)},Wu=new WeakMap,Cl=new WeakMap,mMe=(function(){function e(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:6;rMe(this,e),pI(this,Wu,void 0),pI(this,Cl,void 0),mI(Cl,this,n),this.reset()}return sMe(e,[{key:"reset",value:function(){mI(Wu,this,["__reserved for background__"])}},{key:"register",value:function(r){if(ma(Wu,this).length>=Math.pow(2,24-ma(Cl,this)))return null;var i=ma(Wu,this).length,s=gI(i,ma(Cl,this)),a=fMe(i+(s<<24-ma(Cl,this)));return ma(Wu,this).push(r),a}},{key:"lookup",value:function(r){if(!r)return null;var i=typeof r=="string"?pMe(r):cV.apply(void 0,lMe(r));if(!i)return null;var s=i&Math.pow(2,24-ma(Cl,this))-1,a=i>>24-ma(Cl,this)&Math.pow(2,ma(Cl,this))-1;return gI(s,ma(Cl,this))!==a||s>=ma(Wu,this).length?null:ma(Wu,this)[s]}}])})(),Pv,_r,uV,dV,Fc,vI,hV,fV,pV,kT,WN,qN,qb={},Ub=[],gMe=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,rk=Array.isArray;function Wo(e,n){for(var r in n)e[r]=n[r];return e}function wT(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function vMe(e,n,r){var i,s,a,o={};for(a in n)a=="key"?i=n[a]:a=="ref"?s=n[a]:o[a]=n[a];if(arguments.length>2&&(o.children=arguments.length>3?Pv.call(arguments,2):r),typeof e=="function"&&e.defaultProps!=null)for(a in e.defaultProps)o[a]===void 0&&(o[a]=e.defaultProps[a]);return og(e,o,i,s,null)}function og(e,n,r,i,s){var a={type:e,props:n,key:r,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:s??++uV,__i:-1,__u:0};return s==null&&_r.vnode!=null&&_r.vnode(a),a}function ik(e){return e.children}function Mx(e,n){this.props=e,this.context=n}function Ff(e,n){if(n==null)return e.__?Ff(e.__,e.__i+1):null;for(var r;n<e.__k.length;n++)if((r=e.__k[n])!=null&&r.__e!=null)return r.__e;return typeof e.type=="function"?Ff(e):null}function yMe(e){if(e.__P&&e.__d){var n=e.__v,r=n.__e,i=[],s=[],a=Wo({},n);a.__v=n.__v+1,_r.vnode&&_r.vnode(a),ST(e.__P,a,n,e.__n,e.__P.namespaceURI,32&n.__u?[r]:null,i,r??Ff(n),!!(32&n.__u),s),a.__v=n.__v,a.__.__k[a.__i]=a,yV(i,a,s),n.__e=n.__=null,a.__e!=r&&mV(a)}}function mV(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(n){if(n!=null&&n.__e!=null)return e.__e=e.__c.base=n.__e}),mV(e)}function yI(e){(!e.__d&&(e.__d=!0)&&Fc.push(e)&&!Vb.__r++||vI!=_r.debounceRendering)&&((vI=_r.debounceRendering)||hV)(Vb)}function Vb(){try{for(var e,n=1;Fc.length;)Fc.length>n&&Fc.sort(fV),e=Fc.shift(),n=Fc.length,yMe(e)}finally{Fc.length=Vb.__r=0}}function gV(e,n,r,i,s,a,o,l,u,d,p){var f,g,_,x,v,S,w,N=i&&i.__k||Ub,C=n.length;for(u=_Me(r,n,N,u,C),f=0;f<C;f++)(_=r.__k[f])!=null&&(g=_.__i!=-1&&N[_.__i]||qb,_.__i=f,S=ST(e,_,g,s,a,o,l,u,d,p),x=_.__e,_.ref&&g.ref!=_.ref&&(g.ref&&CT(g.ref,null,_),p.push(_.ref,_.__c||x,_)),v==null&&x!=null&&(v=x),(w=!!(4&_.__u))||g.__k===_.__k?u=vV(_,u,e,w):typeof _.type=="function"&&S!==void 0?u=S:x&&(u=x.nextSibling),_.__u&=-7);return r.__e=v,u}function _Me(e,n,r,i,s){var a,o,l,u,d,p=r.length,f=p,g=0;for(e.__k=new Array(s),a=0;a<s;a++)(o=n[a])!=null&&typeof o!="boolean"&&typeof o!="function"?(typeof o=="string"||typeof o=="number"||typeof o=="bigint"||o.constructor==String?o=e.__k[a]=og(null,o,null,null,null):rk(o)?o=e.__k[a]=og(ik,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?o=e.__k[a]=og(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):e.__k[a]=o,u=a+g,o.__=e,o.__b=e.__b+1,l=null,(d=o.__i=xMe(o,r,u,f))!=-1&&(f--,(l=r[d])&&(l.__u|=2)),l==null||l.__v==null?(d==-1&&(s>p?g--:s<p&&g++),typeof o.type!="function"&&(o.__u|=4)):d!=u&&(d==u-1?g--:d==u+1?g++:(d>u?g--:g++,o.__u|=4))):e.__k[a]=null;if(f)for(a=0;a<p;a++)(l=r[a])!=null&&(2&l.__u)==0&&(l.__e==i&&(i=Ff(l)),xV(l,l));return i}function vV(e,n,r,i){var s,a;if(typeof e.type=="function"){for(s=e.__k,a=0;s&&a<s.length;a++)s[a]&&(s[a].__=e,n=vV(s[a],n,r,i));return n}e.__e!=n&&(i&&(n&&e.type&&!n.parentNode&&(n=Ff(e)),r.insertBefore(e.__e,n||null)),n=e.__e);do n=n&&n.nextSibling;while(n!=null&&n.nodeType==8);return n}function xMe(e,n,r,i){var s,a,o,l=e.key,u=e.type,d=n[r],p=d!=null&&(2&d.__u)==0;if(d===null&&l==null||p&&l==d.key&&u==d.type)return r;if(i>(p?1:0)){for(s=r-1,a=r+1;s>=0||a<n.length;)if((d=n[o=s>=0?s--:a++])!=null&&(2&d.__u)==0&&l==d.key&&u==d.type)return o}return-1}function _I(e,n,r){n[0]=="-"?e.setProperty(n,r??""):e[n]=r==null?"":typeof r!="number"||gMe.test(n)?r:r+"px"}function W_(e,n,r,i,s){var a,o;e:if(n=="style")if(typeof r=="string")e.style.cssText=r;else{if(typeof i=="string"&&(e.style.cssText=i=""),i)for(n in i)r&&n in r||_I(e.style,n,"");if(r)for(n in r)i&&r[n]==i[n]||_I(e.style,n,r[n])}else if(n[0]=="o"&&n[1]=="n")a=n!=(n=n.replace(pV,"$1")),o=n.toLowerCase(),n=o in e||n=="onFocusOut"||n=="onFocusIn"?o.slice(2):n.slice(2),e.l||(e.l={}),e.l[n+a]=r,r?i?r.u=i.u:(r.u=kT,e.addEventListener(n,a?qN:WN,a)):e.removeEventListener(n,a?qN:WN,a);else{if(s=="http://www.w3.org/2000/svg")n=n.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(n!="width"&&n!="height"&&n!="href"&&n!="list"&&n!="form"&&n!="tabIndex"&&n!="download"&&n!="rowSpan"&&n!="colSpan"&&n!="role"&&n!="popover"&&n in e)try{e[n]=r??"";break e}catch{}typeof r=="function"||(r==null||r===!1&&n[4]!="-"?e.removeAttribute(n):e.setAttribute(n,n=="popover"&&r==1?"":r))}}function xI(e){return function(n){if(this.l){var r=this.l[n.type+e];if(n.t==null)n.t=kT++;else if(n.t<r.u)return;return r(_r.event?_r.event(n):n)}}}function ST(e,n,r,i,s,a,o,l,u,d){var p,f,g,_,x,v,S,w,N,C,T,A,E,D,F,B=n.type;if(n.constructor!==void 0)return null;128&r.__u&&(u=!!(32&r.__u),a=[l=n.__e=r.__e]),(p=_r.__b)&&p(n);e:if(typeof B=="function")try{if(w=n.props,N=B.prototype&&B.prototype.render,C=(p=B.contextType)&&i[p.__c],T=p?C?C.props.value:p.__:i,r.__c?S=(f=n.__c=r.__c).__=f.__E:(N?n.__c=f=new B(w,T):(n.__c=f=new Mx(w,T),f.constructor=B,f.render=kMe),C&&C.sub(f),f.state||(f.state={}),f.__n=i,g=f.__d=!0,f.__h=[],f._sb=[]),N&&f.__s==null&&(f.__s=f.state),N&&B.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=Wo({},f.__s)),Wo(f.__s,B.getDerivedStateFromProps(w,f.__s))),_=f.props,x=f.state,f.__v=n,g)N&&B.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),N&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(N&&B.getDerivedStateFromProps==null&&w!==_&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(w,T),n.__v==r.__v||!f.__e&&f.shouldComponentUpdate!=null&&f.shouldComponentUpdate(w,f.__s,T)===!1){n.__v!=r.__v&&(f.props=w,f.state=f.__s,f.__d=!1),n.__e=r.__e,n.__k=r.__k,n.__k.some(function(H){H&&(H.__=n)}),Ub.push.apply(f.__h,f._sb),f._sb=[],f.__h.length&&o.push(f);break e}f.componentWillUpdate!=null&&f.componentWillUpdate(w,f.__s,T),N&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(_,x,v)})}if(f.context=T,f.props=w,f.__P=e,f.__e=!1,A=_r.__r,E=0,N)f.state=f.__s,f.__d=!1,A&&A(n),p=f.render(f.props,f.state,f.context),Ub.push.apply(f.__h,f._sb),f._sb=[];else do f.__d=!1,A&&A(n),p=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++E<25);f.state=f.__s,f.getChildContext!=null&&(i=Wo(Wo({},i),f.getChildContext())),N&&!g&&f.getSnapshotBeforeUpdate!=null&&(v=f.getSnapshotBeforeUpdate(_,x)),D=p!=null&&p.type===ik&&p.key==null?_V(p.props.children):p,l=gV(e,rk(D)?D:[D],n,r,i,s,a,o,l,u,d),f.base=n.__e,n.__u&=-161,f.__h.length&&o.push(f),S&&(f.__E=f.__=null)}catch(H){if(n.__v=null,u||a!=null)if(H.then){for(n.__u|=u?160:128;l&&l.nodeType==8&&l.nextSibling;)l=l.nextSibling;a[a.indexOf(l)]=null,n.__e=l}else{for(F=a.length;F--;)wT(a[F]);UN(n)}else n.__e=r.__e,n.__k=r.__k,H.then||UN(n);_r.__e(H,n,r)}else a==null&&n.__v==r.__v?(n.__k=r.__k,n.__e=r.__e):l=n.__e=bMe(r.__e,n,r,i,s,a,o,u,d);return(p=_r.diffed)&&p(n),128&n.__u?void 0:l}function UN(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(UN))}function yV(e,n,r){for(var i=0;i<r.length;i++)CT(r[i],r[++i],r[++i]);_r.__c&&_r.__c(n,e),e.some(function(s){try{e=s.__h,s.__h=[],e.some(function(a){a.call(s)})}catch(a){_r.__e(a,s.__v)}})}function _V(e){return typeof e!="object"||e==null||e.__b>0?e:rk(e)?e.map(_V):Wo({},e)}function bMe(e,n,r,i,s,a,o,l,u){var d,p,f,g,_,x,v,S=r.props||qb,w=n.props,N=n.type;if(N=="svg"?s="http://www.w3.org/2000/svg":N=="math"?s="http://www.w3.org/1998/Math/MathML":s||(s="http://www.w3.org/1999/xhtml"),a!=null){for(d=0;d<a.length;d++)if((_=a[d])&&"setAttribute"in _==!!N&&(N?_.localName==N:_.nodeType==3)){e=_,a[d]=null;break}}if(e==null){if(N==null)return document.createTextNode(w);e=document.createElementNS(s,N,w.is&&w),l&&(_r.__m&&_r.__m(n,a),l=!1),a=null}if(N==null)S===w||l&&e.data==w||(e.data=w);else{if(a=a&&Pv.call(e.childNodes),!l&&a!=null)for(S={},d=0;d<e.attributes.length;d++)S[(_=e.attributes[d]).name]=_.value;for(d in S)_=S[d],d=="dangerouslySetInnerHTML"?f=_:d=="children"||d in w||d=="value"&&"defaultValue"in w||d=="checked"&&"defaultChecked"in w||W_(e,d,null,_,s);for(d in w)_=w[d],d=="children"?g=_:d=="dangerouslySetInnerHTML"?p=_:d=="value"?x=_:d=="checked"?v=_:l&&typeof _!="function"||S[d]===_||W_(e,d,_,S[d],s);if(p)l||f&&(p.__html==f.__html||p.__html==e.innerHTML)||(e.innerHTML=p.__html),n.__k=[];else if(f&&(e.innerHTML=""),gV(n.type=="template"?e.content:e,rk(g)?g:[g],n,r,i,N=="foreignObject"?"http://www.w3.org/1999/xhtml":s,a,o,a?a[0]:r.__k&&Ff(r,0),l,u),a!=null)for(d=a.length;d--;)wT(a[d]);l||(d="value",N=="progress"&&x==null?e.removeAttribute("value"):x!=null&&(x!==e[d]||N=="progress"&&!x||N=="option"&&x!=S[d])&&W_(e,d,x,S[d],s),d="checked",v!=null&&v!=e[d]&&W_(e,d,v,S[d],s))}return e}function CT(e,n,r){try{if(typeof e=="function"){var i=typeof e.__u=="function";i&&e.__u(),i&&n==null||(e.__u=e(n))}else e.current=n}catch(s){_r.__e(s,r)}}function xV(e,n,r){var i,s;if(_r.unmount&&_r.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||CT(i,null,n)),(i=e.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(a){_r.__e(a,n)}i.base=i.__P=null}if(i=e.__k)for(s=0;s<i.length;s++)i[s]&&xV(i[s],n,r||typeof e.type!="function");r||wT(e.__e),e.__c=e.__=e.__e=void 0}function kMe(e,n,r){return this.constructor(e,r)}function wMe(e,n,r){var i,s,a,o;n==document&&(n=document.documentElement),_r.__&&_r.__(e,n),s=(i=!1)?null:n.__k,a=[],o=[],ST(n,e=n.__k=vMe(ik,null,[e]),s||qb,qb,n.namespaceURI,s?null:n.firstChild?Pv.call(n.childNodes):null,a,s?s.__e:n.firstChild,i,o),yV(a,e,o)}function bV(e,n,r){var i,s,a,o,l=Wo({},e.props);for(a in e.type&&e.type.defaultProps&&(o=e.type.defaultProps),n)a=="key"?i=n[a]:a=="ref"?s=n[a]:l[a]=n[a]===void 0&&o!=null?o[a]:n[a];return arguments.length>2&&(l.children=arguments.length>3?Pv.call(arguments,2):r),og(e.type,l,i||e.key,s||e.ref,null)}Pv=Ub.slice,_r={__e:function(e,n,r,i){for(var s,a,o;n=n.__;)if((s=n.__c)&&!s.__)try{if((a=s.constructor)&&a.getDerivedStateFromError!=null&&(s.setState(a.getDerivedStateFromError(e)),o=s.__d),s.componentDidCatch!=null&&(s.componentDidCatch(e,i||{}),o=s.__d),o)return s.__E=s}catch(l){e=l}throw e}},uV=0,dV=function(e){return e!=null&&e.constructor===void 0},Mx.prototype.setState=function(e,n){var r;r=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Wo({},this.state),typeof e=="function"&&(e=e(Wo({},r),this.props)),e&&Wo(r,e),e!=null&&this.__v&&(n&&this._sb.push(n),yI(this))},Mx.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),yI(this))},Mx.prototype.render=ik,Fc=[],hV=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,fV=function(e,n){return e.__v.__b-n.__v.__b},Vb.__r=0,pV=/(PointerCapture)$|Capture$/i,kT=0,WN=xI(!1),qN=xI(!0);function bI(e,n){(n==null||n>e.length)&&(n=e.length);for(var r=0,i=Array(n);r<n;r++)i[r]=e[r];return i}function SMe(e){if(Array.isArray(e))return e}function CMe(e,n,r){return(n=MMe(n))in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function jMe(e,n){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var i,s,a,o,l=[],u=!0,d=!1;try{if(a=(r=r.call(e)).next,n!==0)for(;!(u=(i=a.call(r)).done)&&(l.push(i.value),l.length!==n);u=!0);}catch(p){d=!0,s=p}finally{try{if(!u&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(d)throw s}}return l}}function NMe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function kI(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,i)}return r}function EMe(e){for(var n=1;n<arguments.length;n++){var r=arguments[n]!=null?arguments[n]:{};n%2?kI(Object(r),!0).forEach(function(i){CMe(e,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):kI(Object(r)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(r,i))})}return e}function AMe(e,n){return SMe(e)||jMe(e,n)||RMe(e,n)||NMe()}function TMe(e,n){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,n);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}function MMe(e){var n=TMe(e,"string");return typeof n=="symbol"?n:n+""}function Kb(e){"@babel/helpers - typeof";return Kb=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},Kb(e)}function RMe(e,n){if(e){if(typeof e=="string")return bI(e,n);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?bI(e,n):void 0}}var VN=function(n){if(Kb(n)!=="object")return n;var r=bV(n);if(r.props){var i;r.props=EMe({},r.props),r!=null&&(i=r.props)!==null&&i!==void 0&&i.children&&(r.props.children=Array.isArray(r.props.children)?r.props.children.map(VN):VN(r.props.children))}return r},OMe=function(n){return dV(bV(n))},DMe=function(n,r){delete r.__k,wMe(VN(n),r)};function PMe(e,n){n===void 0&&(n={});var r=n.insertAt;if(!(typeof document>"u")){var i=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.type="text/css",r==="top"&&i.firstChild?i.insertBefore(s,i.firstChild):i.appendChild(s),s.styleSheet?s.styleSheet.cssText=e:s.appendChild(document.createTextNode(e))}}var LMe=`.float-tooltip-kap {
  position: absolute;
  width: max-content; /* prevent shrinking near right edge */
  max-width: max(50%, 150px);
  padding: 3px 5px;
  border-radius: 3px;
  font: 12px sans-serif;
  color: #eee;
  background: rgba(0,0,0,0.6);
  pointer-events: none;
}
`;PMe(LMe);var IMe=bT({props:{content:{default:!1},offsetX:{triggerUpdate:!1},offsetY:{triggerUpdate:!1}},init:function(n,r){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},s=i.style,a=s===void 0?{}:s,o=!!n&&Kb(n)==="object"&&!!n.node&&typeof n.node=="function",l=Fi(o?n.node():n);l.style("position")==="static"&&l.style("position","relative"),r.tooltipEl=l.append("div").attr("class","float-tooltip-kap"),Object.entries(a).forEach(function(d){var p=AMe(d,2),f=p[0],g=p[1];return r.tooltipEl.style(f,g)}),r.tooltipEl.style("left","-10000px").style("display","none");var u="tooltip-".concat(Math.round(Math.random()*1e12));r.mouseInside=!1,l.on("mousemove.".concat(u),function(d){r.mouseInside=!0;var p=_a(d),f=l.node(),g=f.offsetWidth,_=f.offsetHeight,x=[r.offsetX===null||r.offsetX===void 0?"-".concat(p[0]/g*100,"%"):typeof r.offsetX=="number"?"calc(-50% + ".concat(r.offsetX,"px)"):r.offsetX,r.offsetY===null||r.offsetY===void 0?_>130&&_-p[1]<100?"calc(-100% - 6px)":"21px":typeof r.offsetY=="number"?r.offsetY<0?"calc(-100% - ".concat(Math.abs(r.offsetY),"px)"):"".concat(r.offsetY,"px"):r.offsetY];r.tooltipEl.style("left",p[0]+"px").style("top",p[1]+"px").style("transform","translate(".concat(x.join(","),")")),r.content&&r.tooltipEl.style("display","inline")}),l.on("mouseover.".concat(u),function(){r.mouseInside=!0,r.content&&r.tooltipEl.style("display","inline")}),l.on("mouseout.".concat(u),function(){r.mouseInside=!1,r.tooltipEl.style("display","none")})},update:function(n){n.tooltipEl.style("display",n.content&&n.mouseInside?"inline":"none"),n.content?n.content instanceof HTMLElement?(n.tooltipEl.text(""),n.tooltipEl.append(function(){return n.content})):typeof n.content=="string"?n.tooltipEl.html(n.content):OMe(n.content)?(n.tooltipEl.text(""),DMe(n.content,n.tooltipEl.node())):(n.tooltipEl.style("display","none"),console.warn("Tooltip content is invalid, skipping.",n.content,n.content.toString())):n.tooltipEl.text("")}});function BMe(e,n,r){var i,s=1;e==null&&(e=0),n==null&&(n=0),r==null&&(r=0);function a(){var o,l=i.length,u,d=0,p=0,f=0;for(o=0;o<l;++o)u=i[o],d+=u.x||0,p+=u.y||0,f+=u.z||0;for(d=(d/l-e)*s,p=(p/l-n)*s,f=(f/l-r)*s,o=0;o<l;++o)u=i[o],d&&(u.x-=d),p&&(u.y-=p),f&&(u.z-=f)}return a.initialize=function(o){i=o},a.x=function(o){return arguments.length?(e=+o,a):e},a.y=function(o){return arguments.length?(n=+o,a):n},a.z=function(o){return arguments.length?(r=+o,a):r},a.strength=function(o){return arguments.length?(s=+o,a):s},a}function zMe(e){const n=+this._x.call(null,e);return kV(this.cover(n),n,e)}function kV(e,n,r){if(isNaN(n))return e;var i,s=e._root,a={data:r},o=e._x0,l=e._x1,u,d,p,f,g;if(!s)return e._root=a,e;for(;s.length;)if((p=n>=(u=(o+l)/2))?o=u:l=u,i=s,!(s=s[f=+p]))return i[f]=a,e;if(d=+e._x.call(null,s.data),n===d)return a.next=s,i?i[f]=a:e._root=a,e;do i=i?i[f]=new Array(2):e._root=new Array(2),(p=n>=(u=(o+l)/2))?o=u:l=u;while((f=+p)==(g=+(d>=u)));return i[g]=s,i[f]=a,e}function $Me(e){Array.isArray(e)||(e=Array.from(e));const n=e.length,r=new Float64Array(n);let i=1/0,s=-1/0;for(let a=0,o;a<n;++a)isNaN(o=+this._x.call(null,e[a]))||(r[a]=o,o<i&&(i=o),o>s&&(s=o));if(i>s)return this;this.cover(i).cover(s);for(let a=0;a<n;++a)kV(this,r[a],e[a]);return this}function FMe(e){if(isNaN(e=+e))return this;var n=this._x0,r=this._x1;if(isNaN(n))r=(n=Math.floor(e))+1;else{for(var i=r-n||1,s=this._root,a,o;n>e||e>=r;)switch(o=+(e<n),a=new Array(2),a[o]=s,s=a,i*=2,o){case 0:r=n+i;break;case 1:n=r-i;break}this._root&&this._root.length&&(this._root=s)}return this._x0=n,this._x1=r,this}function HMe(){var e=[];return this.visit(function(n){if(!n.length)do e.push(n.data);while(n=n.next)}),e}function WMe(e){return arguments.length?this.cover(+e[0][0]).cover(+e[1][0]):isNaN(this._x0)?void 0:[[this._x0],[this._x1]]}function Hl(e,n,r){this.node=e,this.x0=n,this.x1=r}function qMe(e,n){var r,i=this._x0,s,a,o=this._x1,l=[],u=this._root,d,p;for(u&&l.push(new Hl(u,i,o)),n==null?n=1/0:(i=e-n,o=e+n);d=l.pop();)if(!(!(u=d.node)||(s=d.x0)>o||(a=d.x1)<i))if(u.length){var f=(s+a)/2;l.push(new Hl(u[1],f,a),new Hl(u[0],s,f)),(p=+(e>=f))&&(d=l[l.length-1],l[l.length-1]=l[l.length-1-p],l[l.length-1-p]=d)}else{var g=Math.abs(e-+this._x.call(null,u.data));g<n&&(n=g,i=e-g,o=e+g,r=u.data)}return r}function UMe(e){if(isNaN(u=+this._x.call(null,e)))return this;var n,r=this._root,i,s,a,o=this._x0,l=this._x1,u,d,p,f,g;if(!r)return this;if(r.length)for(;;){if((p=u>=(d=(o+l)/2))?o=d:l=d,n=r,!(r=r[f=+p]))return this;if(!r.length)break;n[f+1&1]&&(i=n,g=f)}for(;r.data!==e;)if(s=r,!(r=r.next))return this;return(a=r.next)&&delete r.next,s?(a?s.next=a:delete s.next,this):n?(a?n[f]=a:delete n[f],(r=n[0]||n[1])&&r===(n[1]||n[0])&&!r.length&&(i?i[g]=r:this._root=r),this):(this._root=a,this)}function VMe(e){for(var n=0,r=e.length;n<r;++n)this.remove(e[n]);return this}function KMe(){return this._root}function YMe(){var e=0;return this.visit(function(n){if(!n.length)do++e;while(n=n.next)}),e}function GMe(e){var n=[],r,i=this._root,s,a,o;for(i&&n.push(new Hl(i,this._x0,this._x1));r=n.pop();)if(!e(i=r.node,a=r.x0,o=r.x1)&&i.length){var l=(a+o)/2;(s=i[1])&&n.push(new Hl(s,l,o)),(s=i[0])&&n.push(new Hl(s,a,l))}return this}function XMe(e){var n=[],r=[],i;for(this._root&&n.push(new Hl(this._root,this._x0,this._x1));i=n.pop();){var s=i.node;if(s.length){var a,o=i.x0,l=i.x1,u=(o+l)/2;(a=s[0])&&n.push(new Hl(a,o,u)),(a=s[1])&&n.push(new Hl(a,u,l))}r.push(i)}for(;i=r.pop();)e(i.node,i.x0,i.x1);return this}function QMe(e){return e[0]}function ZMe(e){return arguments.length?(this._x=e,this):this._x}function wV(e,n){var r=new jT(n??QMe,NaN,NaN);return e==null?r:r.addAll(e)}function jT(e,n,r){this._x=e,this._x0=n,this._x1=r,this._root=void 0}function wI(e){for(var n={data:e.data},r=n;e=e.next;)r=r.next={data:e.data};return n}var Ms=wV.prototype=jT.prototype;Ms.copy=function(){var e=new jT(this._x,this._x0,this._x1),n=this._root,r,i;if(!n)return e;if(!n.length)return e._root=wI(n),e;for(r=[{source:n,target:e._root=new Array(2)}];n=r.pop();)for(var s=0;s<2;++s)(i=n.source[s])&&(i.length?r.push({source:i,target:n.target[s]=new Array(2)}):n.target[s]=wI(i));return e};Ms.add=zMe;Ms.addAll=$Me;Ms.cover=FMe;Ms.data=HMe;Ms.extent=WMe;Ms.find=qMe;Ms.remove=UMe;Ms.removeAll=VMe;Ms.root=KMe;Ms.size=YMe;Ms.visit=GMe;Ms.visitAfter=XMe;Ms.x=ZMe;function JMe(e){const n=+this._x.call(null,e),r=+this._y.call(null,e);return SV(this.cover(n,r),n,r,e)}function SV(e,n,r,i){if(isNaN(n)||isNaN(r))return e;var s,a=e._root,o={data:i},l=e._x0,u=e._y0,d=e._x1,p=e._y1,f,g,_,x,v,S,w,N;if(!a)return e._root=o,e;for(;a.length;)if((v=n>=(f=(l+d)/2))?l=f:d=f,(S=r>=(g=(u+p)/2))?u=g:p=g,s=a,!(a=a[w=S<<1|v]))return s[w]=o,e;if(_=+e._x.call(null,a.data),x=+e._y.call(null,a.data),n===_&&r===x)return o.next=a,s?s[w]=o:e._root=o,e;do s=s?s[w]=new Array(4):e._root=new Array(4),(v=n>=(f=(l+d)/2))?l=f:d=f,(S=r>=(g=(u+p)/2))?u=g:p=g;while((w=S<<1|v)===(N=(x>=g)<<1|_>=f));return s[N]=a,s[w]=o,e}function eRe(e){var n,r,i=e.length,s,a,o=new Array(i),l=new Array(i),u=1/0,d=1/0,p=-1/0,f=-1/0;for(r=0;r<i;++r)isNaN(s=+this._x.call(null,n=e[r]))||isNaN(a=+this._y.call(null,n))||(o[r]=s,l[r]=a,s<u&&(u=s),s>p&&(p=s),a<d&&(d=a),a>f&&(f=a));if(u>p||d>f)return this;for(this.cover(u,d).cover(p,f),r=0;r<i;++r)SV(this,o[r],l[r],e[r]);return this}function tRe(e,n){if(isNaN(e=+e)||isNaN(n=+n))return this;var r=this._x0,i=this._y0,s=this._x1,a=this._y1;if(isNaN(r))s=(r=Math.floor(e))+1,a=(i=Math.floor(n))+1;else{for(var o=s-r||1,l=this._root,u,d;r>e||e>=s||i>n||n>=a;)switch(d=(n<i)<<1|e<r,u=new Array(4),u[d]=l,l=u,o*=2,d){case 0:s=r+o,a=i+o;break;case 1:r=s-o,a=i+o;break;case 2:s=r+o,i=a-o;break;case 3:r=s-o,i=a-o;break}this._root&&this._root.length&&(this._root=l)}return this._x0=r,this._y0=i,this._x1=s,this._y1=a,this}function nRe(){var e=[];return this.visit(function(n){if(!n.length)do e.push(n.data);while(n=n.next)}),e}function rRe(e){return arguments.length?this.cover(+e[0][0],+e[0][1]).cover(+e[1][0],+e[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}function Ji(e,n,r,i,s){this.node=e,this.x0=n,this.y0=r,this.x1=i,this.y1=s}function iRe(e,n,r){var i,s=this._x0,a=this._y0,o,l,u,d,p=this._x1,f=this._y1,g=[],_=this._root,x,v;for(_&&g.push(new Ji(_,s,a,p,f)),r==null?r=1/0:(s=e-r,a=n-r,p=e+r,f=n+r,r*=r);x=g.pop();)if(!(!(_=x.node)||(o=x.x0)>p||(l=x.y0)>f||(u=x.x1)<s||(d=x.y1)<a))if(_.length){var S=(o+u)/2,w=(l+d)/2;g.push(new Ji(_[3],S,w,u,d),new Ji(_[2],o,w,S,d),new Ji(_[1],S,l,u,w),new Ji(_[0],o,l,S,w)),(v=(n>=w)<<1|e>=S)&&(x=g[g.length-1],g[g.length-1]=g[g.length-1-v],g[g.length-1-v]=x)}else{var N=e-+this._x.call(null,_.data),C=n-+this._y.call(null,_.data),T=N*N+C*C;if(T<r){var A=Math.sqrt(r=T);s=e-A,a=n-A,p=e+A,f=n+A,i=_.data}}return i}function sRe(e){if(isNaN(p=+this._x.call(null,e))||isNaN(f=+this._y.call(null,e)))return this;var n,r=this._root,i,s,a,o=this._x0,l=this._y0,u=this._x1,d=this._y1,p,f,g,_,x,v,S,w;if(!r)return this;if(r.length)for(;;){if((x=p>=(g=(o+u)/2))?o=g:u=g,(v=f>=(_=(l+d)/2))?l=_:d=_,n=r,!(r=r[S=v<<1|x]))return this;if(!r.length)break;(n[S+1&3]||n[S+2&3]||n[S+3&3])&&(i=n,w=S)}for(;r.data!==e;)if(s=r,!(r=r.next))return this;return(a=r.next)&&delete r.next,s?(a?s.next=a:delete s.next,this):n?(a?n[S]=a:delete n[S],(r=n[0]||n[1]||n[2]||n[3])&&r===(n[3]||n[2]||n[1]||n[0])&&!r.length&&(i?i[w]=r:this._root=r),this):(this._root=a,this)}function aRe(e){for(var n=0,r=e.length;n<r;++n)this.remove(e[n]);return this}function oRe(){return this._root}function lRe(){var e=0;return this.visit(function(n){if(!n.length)do++e;while(n=n.next)}),e}function cRe(e){var n=[],r,i=this._root,s,a,o,l,u;for(i&&n.push(new Ji(i,this._x0,this._y0,this._x1,this._y1));r=n.pop();)if(!e(i=r.node,a=r.x0,o=r.y0,l=r.x1,u=r.y1)&&i.length){var d=(a+l)/2,p=(o+u)/2;(s=i[3])&&n.push(new Ji(s,d,p,l,u)),(s=i[2])&&n.push(new Ji(s,a,p,d,u)),(s=i[1])&&n.push(new Ji(s,d,o,l,p)),(s=i[0])&&n.push(new Ji(s,a,o,d,p))}return this}function uRe(e){var n=[],r=[],i;for(this._root&&n.push(new Ji(this._root,this._x0,this._y0,this._x1,this._y1));i=n.pop();){var s=i.node;if(s.length){var a,o=i.x0,l=i.y0,u=i.x1,d=i.y1,p=(o+u)/2,f=(l+d)/2;(a=s[0])&&n.push(new Ji(a,o,l,p,f)),(a=s[1])&&n.push(new Ji(a,p,l,u,f)),(a=s[2])&&n.push(new Ji(a,o,f,p,d)),(a=s[3])&&n.push(new Ji(a,p,f,u,d))}r.push(i)}for(;i=r.pop();)e(i.node,i.x0,i.y0,i.x1,i.y1);return this}function dRe(e){return e[0]}function hRe(e){return arguments.length?(this._x=e,this):this._x}function fRe(e){return e[1]}function pRe(e){return arguments.length?(this._y=e,this):this._y}function CV(e,n,r){var i=new NT(n??dRe,r??fRe,NaN,NaN,NaN,NaN);return e==null?i:i.addAll(e)}function NT(e,n,r,i,s,a){this._x=e,this._y=n,this._x0=r,this._y0=i,this._x1=s,this._y1=a,this._root=void 0}function SI(e){for(var n={data:e.data},r=n;e=e.next;)r=r.next={data:e.data};return n}var ls=CV.prototype=NT.prototype;ls.copy=function(){var e=new NT(this._x,this._y,this._x0,this._y0,this._x1,this._y1),n=this._root,r,i;if(!n)return e;if(!n.length)return e._root=SI(n),e;for(r=[{source:n,target:e._root=new Array(4)}];n=r.pop();)for(var s=0;s<4;++s)(i=n.source[s])&&(i.length?r.push({source:i,target:n.target[s]=new Array(4)}):n.target[s]=SI(i));return e};ls.add=JMe;ls.addAll=eRe;ls.cover=tRe;ls.data=nRe;ls.extent=rRe;ls.find=iRe;ls.remove=sRe;ls.removeAll=aRe;ls.root=oRe;ls.size=lRe;ls.visit=cRe;ls.visitAfter=uRe;ls.x=hRe;ls.y=pRe;function mRe(e){const n=+this._x.call(null,e),r=+this._y.call(null,e),i=+this._z.call(null,e);return jV(this.cover(n,r,i),n,r,i,e)}function jV(e,n,r,i,s){if(isNaN(n)||isNaN(r)||isNaN(i))return e;var a,o=e._root,l={data:s},u=e._x0,d=e._y0,p=e._z0,f=e._x1,g=e._y1,_=e._z1,x,v,S,w,N,C,T,A,E,D,F;if(!o)return e._root=l,e;for(;o.length;)if((T=n>=(x=(u+f)/2))?u=x:f=x,(A=r>=(v=(d+g)/2))?d=v:g=v,(E=i>=(S=(p+_)/2))?p=S:_=S,a=o,!(o=o[D=E<<2|A<<1|T]))return a[D]=l,e;if(w=+e._x.call(null,o.data),N=+e._y.call(null,o.data),C=+e._z.call(null,o.data),n===w&&r===N&&i===C)return l.next=o,a?a[D]=l:e._root=l,e;do a=a?a[D]=new Array(8):e._root=new Array(8),(T=n>=(x=(u+f)/2))?u=x:f=x,(A=r>=(v=(d+g)/2))?d=v:g=v,(E=i>=(S=(p+_)/2))?p=S:_=S;while((D=E<<2|A<<1|T)===(F=(C>=S)<<2|(N>=v)<<1|w>=x));return a[F]=o,a[D]=l,e}function gRe(e){Array.isArray(e)||(e=Array.from(e));const n=e.length,r=new Float64Array(n),i=new Float64Array(n),s=new Float64Array(n);let a=1/0,o=1/0,l=1/0,u=-1/0,d=-1/0,p=-1/0;for(let f=0,g,_,x,v;f<n;++f)isNaN(_=+this._x.call(null,g=e[f]))||isNaN(x=+this._y.call(null,g))||isNaN(v=+this._z.call(null,g))||(r[f]=_,i[f]=x,s[f]=v,_<a&&(a=_),_>u&&(u=_),x<o&&(o=x),x>d&&(d=x),v<l&&(l=v),v>p&&(p=v));if(a>u||o>d||l>p)return this;this.cover(a,o,l).cover(u,d,p);for(let f=0;f<n;++f)jV(this,r[f],i[f],s[f],e[f]);return this}function vRe(e,n,r){if(isNaN(e=+e)||isNaN(n=+n)||isNaN(r=+r))return this;var i=this._x0,s=this._y0,a=this._z0,o=this._x1,l=this._y1,u=this._z1;if(isNaN(i))o=(i=Math.floor(e))+1,l=(s=Math.floor(n))+1,u=(a=Math.floor(r))+1;else{for(var d=o-i||1,p=this._root,f,g;i>e||e>=o||s>n||n>=l||a>r||r>=u;)switch(g=(r<a)<<2|(n<s)<<1|e<i,f=new Array(8),f[g]=p,p=f,d*=2,g){case 0:o=i+d,l=s+d,u=a+d;break;case 1:i=o-d,l=s+d,u=a+d;break;case 2:o=i+d,s=l-d,u=a+d;break;case 3:i=o-d,s=l-d,u=a+d;break;case 4:o=i+d,l=s+d,a=u-d;break;case 5:i=o-d,l=s+d,a=u-d;break;case 6:o=i+d,s=l-d,a=u-d;break;case 7:i=o-d,s=l-d,a=u-d;break}this._root&&this._root.length&&(this._root=p)}return this._x0=i,this._y0=s,this._z0=a,this._x1=o,this._y1=l,this._z1=u,this}function yRe(){var e=[];return this.visit(function(n){if(!n.length)do e.push(n.data);while(n=n.next)}),e}function _Re(e){return arguments.length?this.cover(+e[0][0],+e[0][1],+e[0][2]).cover(+e[1][0],+e[1][1],+e[1][2]):isNaN(this._x0)?void 0:[[this._x0,this._y0,this._z0],[this._x1,this._y1,this._z1]]}function Zn(e,n,r,i,s,a,o){this.node=e,this.x0=n,this.y0=r,this.z0=i,this.x1=s,this.y1=a,this.z1=o}function xRe(e,n,r,i){var s,a=this._x0,o=this._y0,l=this._z0,u,d,p,f,g,_,x=this._x1,v=this._y1,S=this._z1,w=[],N=this._root,C,T;for(N&&w.push(new Zn(N,a,o,l,x,v,S)),i==null?i=1/0:(a=e-i,o=n-i,l=r-i,x=e+i,v=n+i,S=r+i,i*=i);C=w.pop();)if(!(!(N=C.node)||(u=C.x0)>x||(d=C.y0)>v||(p=C.z0)>S||(f=C.x1)<a||(g=C.y1)<o||(_=C.z1)<l))if(N.length){var A=(u+f)/2,E=(d+g)/2,D=(p+_)/2;w.push(new Zn(N[7],A,E,D,f,g,_),new Zn(N[6],u,E,D,A,g,_),new Zn(N[5],A,d,D,f,E,_),new Zn(N[4],u,d,D,A,E,_),new Zn(N[3],A,E,p,f,g,D),new Zn(N[2],u,E,p,A,g,D),new Zn(N[1],A,d,p,f,E,D),new Zn(N[0],u,d,p,A,E,D)),(T=(r>=D)<<2|(n>=E)<<1|e>=A)&&(C=w[w.length-1],w[w.length-1]=w[w.length-1-T],w[w.length-1-T]=C)}else{var F=e-+this._x.call(null,N.data),B=n-+this._y.call(null,N.data),H=r-+this._z.call(null,N.data),$=F*F+B*B+H*H;if($<i){var z=Math.sqrt(i=$);a=e-z,o=n-z,l=r-z,x=e+z,v=n+z,S=r+z,s=N.data}}return s}const bRe=(e,n,r,i,s,a)=>Math.sqrt((e-i)**2+(n-s)**2+(r-a)**2);function kRe(e,n,r,i){const s=[],a=e-i,o=n-i,l=r-i,u=e+i,d=n+i,p=r+i;return this.visit((f,g,_,x,v,S,w)=>{if(!f.length)do{const N=f.data;bRe(e,n,r,this._x(N),this._y(N),this._z(N))<=i&&s.push(N)}while(f=f.next);return g>u||_>d||x>p||v<a||S<o||w<l}),s}function wRe(e){if(isNaN(g=+this._x.call(null,e))||isNaN(_=+this._y.call(null,e))||isNaN(x=+this._z.call(null,e)))return this;var n,r=this._root,i,s,a,o=this._x0,l=this._y0,u=this._z0,d=this._x1,p=this._y1,f=this._z1,g,_,x,v,S,w,N,C,T,A,E;if(!r)return this;if(r.length)for(;;){if((N=g>=(v=(o+d)/2))?o=v:d=v,(C=_>=(S=(l+p)/2))?l=S:p=S,(T=x>=(w=(u+f)/2))?u=w:f=w,n=r,!(r=r[A=T<<2|C<<1|N]))return this;if(!r.length)break;(n[A+1&7]||n[A+2&7]||n[A+3&7]||n[A+4&7]||n[A+5&7]||n[A+6&7]||n[A+7&7])&&(i=n,E=A)}for(;r.data!==e;)if(s=r,!(r=r.next))return this;return(a=r.next)&&delete r.next,s?(a?s.next=a:delete s.next,this):n?(a?n[A]=a:delete n[A],(r=n[0]||n[1]||n[2]||n[3]||n[4]||n[5]||n[6]||n[7])&&r===(n[7]||n[6]||n[5]||n[4]||n[3]||n[2]||n[1]||n[0])&&!r.length&&(i?i[E]=r:this._root=r),this):(this._root=a,this)}function SRe(e){for(var n=0,r=e.length;n<r;++n)this.remove(e[n]);return this}function CRe(){return this._root}function jRe(){var e=0;return this.visit(function(n){if(!n.length)do++e;while(n=n.next)}),e}function NRe(e){var n=[],r,i=this._root,s,a,o,l,u,d,p;for(i&&n.push(new Zn(i,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));r=n.pop();)if(!e(i=r.node,a=r.x0,o=r.y0,l=r.z0,u=r.x1,d=r.y1,p=r.z1)&&i.length){var f=(a+u)/2,g=(o+d)/2,_=(l+p)/2;(s=i[7])&&n.push(new Zn(s,f,g,_,u,d,p)),(s=i[6])&&n.push(new Zn(s,a,g,_,f,d,p)),(s=i[5])&&n.push(new Zn(s,f,o,_,u,g,p)),(s=i[4])&&n.push(new Zn(s,a,o,_,f,g,p)),(s=i[3])&&n.push(new Zn(s,f,g,l,u,d,_)),(s=i[2])&&n.push(new Zn(s,a,g,l,f,d,_)),(s=i[1])&&n.push(new Zn(s,f,o,l,u,g,_)),(s=i[0])&&n.push(new Zn(s,a,o,l,f,g,_))}return this}function ERe(e){var n=[],r=[],i;for(this._root&&n.push(new Zn(this._root,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));i=n.pop();){var s=i.node;if(s.length){var a,o=i.x0,l=i.y0,u=i.z0,d=i.x1,p=i.y1,f=i.z1,g=(o+d)/2,_=(l+p)/2,x=(u+f)/2;(a=s[0])&&n.push(new Zn(a,o,l,u,g,_,x)),(a=s[1])&&n.push(new Zn(a,g,l,u,d,_,x)),(a=s[2])&&n.push(new Zn(a,o,_,u,g,p,x)),(a=s[3])&&n.push(new Zn(a,g,_,u,d,p,x)),(a=s[4])&&n.push(new Zn(a,o,l,x,g,_,f)),(a=s[5])&&n.push(new Zn(a,g,l,x,d,_,f)),(a=s[6])&&n.push(new Zn(a,o,_,x,g,p,f)),(a=s[7])&&n.push(new Zn(a,g,_,x,d,p,f))}r.push(i)}for(;i=r.pop();)e(i.node,i.x0,i.y0,i.z0,i.x1,i.y1,i.z1);return this}function ARe(e){return e[0]}function TRe(e){return arguments.length?(this._x=e,this):this._x}function MRe(e){return e[1]}function RRe(e){return arguments.length?(this._y=e,this):this._y}function ORe(e){return e[2]}function DRe(e){return arguments.length?(this._z=e,this):this._z}function NV(e,n,r,i){var s=new ET(n??ARe,r??MRe,i??ORe,NaN,NaN,NaN,NaN,NaN,NaN);return e==null?s:s.addAll(e)}function ET(e,n,r,i,s,a,o,l,u){this._x=e,this._y=n,this._z=r,this._x0=i,this._y0=s,this._z0=a,this._x1=o,this._y1=l,this._z1=u,this._root=void 0}function CI(e){for(var n={data:e.data},r=n;e=e.next;)r=r.next={data:e.data};return n}var Mi=NV.prototype=ET.prototype;Mi.copy=function(){var e=new ET(this._x,this._y,this._z,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1),n=this._root,r,i;if(!n)return e;if(!n.length)return e._root=CI(n),e;for(r=[{source:n,target:e._root=new Array(8)}];n=r.pop();)for(var s=0;s<8;++s)(i=n.source[s])&&(i.length?r.push({source:i,target:n.target[s]=new Array(8)}):n.target[s]=CI(i));return e};Mi.add=mRe;Mi.addAll=gRe;Mi.cover=vRe;Mi.data=yRe;Mi.extent=_Re;Mi.find=xRe;Mi.findAllWithinRadius=kRe;Mi.remove=wRe;Mi.removeAll=SRe;Mi.root=CRe;Mi.size=jRe;Mi.visit=NRe;Mi.visitAfter=ERe;Mi.x=TRe;Mi.y=RRe;Mi.z=DRe;function Bl(e){return function(){return e}}function Ml(e){return(e()-.5)*1e-6}function PRe(e){return e.index}function jI(e,n){var r=e.get(n);if(!r)throw new Error("node not found: "+n);return r}function LRe(e){var n=PRe,r=g,i,s=Bl(30),a,o,l,u,d,p,f=1;e==null&&(e=[]);function g(w){return 1/Math.min(u[w.source.index],u[w.target.index])}function _(w){for(var N=0,C=e.length;N<f;++N)for(var T=0,A,E,D,F=0,B=0,H=0,$,z;T<C;++T)A=e[T],E=A.source,D=A.target,F=D.x+D.vx-E.x-E.vx||Ml(p),l>1&&(B=D.y+D.vy-E.y-E.vy||Ml(p)),l>2&&(H=D.z+D.vz-E.z-E.vz||Ml(p)),$=Math.sqrt(F*F+B*B+H*H),$=($-a[T])/$*w*i[T],F*=$,B*=$,H*=$,D.vx-=F*(z=d[T]),l>1&&(D.vy-=B*z),l>2&&(D.vz-=H*z),E.vx+=F*(z=1-z),l>1&&(E.vy+=B*z),l>2&&(E.vz+=H*z)}function x(){if(o){var w,N=o.length,C=e.length,T=new Map(o.map((E,D)=>[n(E,D,o),E])),A;for(w=0,u=new Array(N);w<C;++w)A=e[w],A.index=w,typeof A.source!="object"&&(A.source=jI(T,A.source)),typeof A.target!="object"&&(A.target=jI(T,A.target)),u[A.source.index]=(u[A.source.index]||0)+1,u[A.target.index]=(u[A.target.index]||0)+1;for(w=0,d=new Array(C);w<C;++w)A=e[w],d[w]=u[A.source.index]/(u[A.source.index]+u[A.target.index]);i=new Array(C),v(),a=new Array(C),S()}}function v(){if(o)for(var w=0,N=e.length;w<N;++w)i[w]=+r(e[w],w,e)}function S(){if(o)for(var w=0,N=e.length;w<N;++w)a[w]=+s(e[w],w,e)}return _.initialize=function(w,...N){o=w,p=N.find(C=>typeof C=="function")||Math.random,l=N.find(C=>[1,2,3].includes(C))||2,x()},_.links=function(w){return arguments.length?(e=w,x(),_):e},_.id=function(w){return arguments.length?(n=w,_):n},_.iterations=function(w){return arguments.length?(f=+w,_):f},_.strength=function(w){return arguments.length?(r=typeof w=="function"?w:Bl(+w),v(),_):r},_.distance=function(w){return arguments.length?(s=typeof w=="function"?w:Bl(+w),S(),_):s},_}const IRe=1664525,BRe=1013904223,NI=4294967296;function zRe(){let e=1;return()=>(e=(IRe*e+BRe)%NI)/NI}var EI=3;function g2(e){return e.x}function AI(e){return e.y}function $Re(e){return e.z}var FRe=10,HRe=Math.PI*(3-Math.sqrt(5)),WRe=Math.PI*20/(9+Math.sqrt(221));function qRe(e,n){n=n||2;var r=Math.min(EI,Math.max(1,Math.round(n))),i,s=1,a=.001,o=1-Math.pow(a,1/300),l=0,u=.6,d=new Map,p=uA(_),f=yv("tick","end"),g=zRe();e==null&&(e=[]);function _(){x(),f.call("tick",i),s<a&&(p.stop(),f.call("end",i))}function x(w){var N,C=e.length,T;w===void 0&&(w=1);for(var A=0;A<w;++A)for(s+=(l-s)*o,d.forEach(function(E){E(s)}),N=0;N<C;++N)T=e[N],T.fx==null?T.x+=T.vx*=u:(T.x=T.fx,T.vx=0),r>1&&(T.fy==null?T.y+=T.vy*=u:(T.y=T.fy,T.vy=0)),r>2&&(T.fz==null?T.z+=T.vz*=u:(T.z=T.fz,T.vz=0));return i}function v(){for(var w=0,N=e.length,C;w<N;++w){if(C=e[w],C.index=w,C.fx!=null&&(C.x=C.fx),C.fy!=null&&(C.y=C.fy),C.fz!=null&&(C.z=C.fz),isNaN(C.x)||r>1&&isNaN(C.y)||r>2&&isNaN(C.z)){var T=FRe*(r>2?Math.cbrt(.5+w):r>1?Math.sqrt(.5+w):w),A=w*HRe,E=w*WRe;r===1?C.x=T:r===2?(C.x=T*Math.cos(A),C.y=T*Math.sin(A)):(C.x=T*Math.sin(A)*Math.cos(E),C.y=T*Math.cos(A),C.z=T*Math.sin(A)*Math.sin(E))}(isNaN(C.vx)||r>1&&isNaN(C.vy)||r>2&&isNaN(C.vz))&&(C.vx=0,r>1&&(C.vy=0),r>2&&(C.vz=0))}}function S(w){return w.initialize&&w.initialize(e,g,r),w}return v(),i={tick:x,restart:function(){return p.restart(_),i},stop:function(){return p.stop(),i},numDimensions:function(w){return arguments.length?(r=Math.min(EI,Math.max(1,Math.round(w))),d.forEach(S),i):r},nodes:function(w){return arguments.length?(e=w,v(),d.forEach(S),i):e},alpha:function(w){return arguments.length?(s=+w,i):s},alphaMin:function(w){return arguments.length?(a=+w,i):a},alphaDecay:function(w){return arguments.length?(o=+w,i):+o},alphaTarget:function(w){return arguments.length?(l=+w,i):l},velocityDecay:function(w){return arguments.length?(u=1-w,i):1-u},randomSource:function(w){return arguments.length?(g=w,d.forEach(S),i):g},force:function(w,N){return arguments.length>1?(N==null?d.delete(w):d.set(w,S(N)),i):d.get(w)},find:function(){var w=Array.prototype.slice.call(arguments),N=w.shift()||0,C=(r>1?w.shift():null)||0,T=(r>2?w.shift():null)||0,A=w.shift()||1/0,E=0,D=e.length,F,B,H,$,z,W;for(A*=A,E=0;E<D;++E)z=e[E],F=N-z.x,B=C-(z.y||0),H=T-(z.z||0),$=F*F+B*B+H*H,$<A&&(W=z,A=$);return W},on:function(w,N){return arguments.length>1?(f.on(w,N),i):f.on(w)}}}function URe(){var e,n,r,i,s,a=Bl(-30),o,l=1,u=1/0,d=.81;function p(x){var v,S=e.length,w=(n===1?wV(e,g2):n===2?CV(e,g2,AI):n===3?NV(e,g2,AI,$Re):null).visitAfter(g);for(s=x,v=0;v<S;++v)r=e[v],w.visit(_)}function f(){if(e){var x,v=e.length,S;for(o=new Array(v),x=0;x<v;++x)S=e[x],o[S.index]=+a(S,x,e)}}function g(x){var v=0,S,w,N=0,C,T,A,E,D=x.length;if(D){for(C=T=A=E=0;E<D;++E)(S=x[E])&&(w=Math.abs(S.value))&&(v+=S.value,N+=w,C+=w*(S.x||0),T+=w*(S.y||0),A+=w*(S.z||0));v*=Math.sqrt(4/D),x.x=C/N,n>1&&(x.y=T/N),n>2&&(x.z=A/N)}else{S=x,S.x=S.data.x,n>1&&(S.y=S.data.y),n>2&&(S.z=S.data.z);do v+=o[S.data.index];while(S=S.next)}x.value=v}function _(x,v,S,w,N){if(!x.value)return!0;var C=[S,w,N][n-1],T=x.x-r.x,A=n>1?x.y-r.y:0,E=n>2?x.z-r.z:0,D=C-v,F=T*T+A*A+E*E;if(D*D/d<F)return F<u&&(T===0&&(T=Ml(i),F+=T*T),n>1&&A===0&&(A=Ml(i),F+=A*A),n>2&&E===0&&(E=Ml(i),F+=E*E),F<l&&(F=Math.sqrt(l*F)),r.vx+=T*x.value*s/F,n>1&&(r.vy+=A*x.value*s/F),n>2&&(r.vz+=E*x.value*s/F)),!0;if(x.length||F>=u)return;(x.data!==r||x.next)&&(T===0&&(T=Ml(i),F+=T*T),n>1&&A===0&&(A=Ml(i),F+=A*A),n>2&&E===0&&(E=Ml(i),F+=E*E),F<l&&(F=Math.sqrt(l*F)));do x.data!==r&&(D=o[x.data.index]*s/F,r.vx+=T*D,n>1&&(r.vy+=A*D),n>2&&(r.vz+=E*D));while(x=x.next)}return p.initialize=function(x,...v){e=x,i=v.find(S=>typeof S=="function")||Math.random,n=v.find(S=>[1,2,3].includes(S))||2,f()},p.strength=function(x){return arguments.length?(a=typeof x=="function"?x:Bl(+x),f(),p):a},p.distanceMin=function(x){return arguments.length?(l=x*x,p):Math.sqrt(l)},p.distanceMax=function(x){return arguments.length?(u=x*x,p):Math.sqrt(u)},p.theta=function(x){return arguments.length?(d=x*x,p):Math.sqrt(d)},p}function VRe(e,n,r,i){var s,a,o=Bl(.1),l,u;typeof e!="function"&&(e=Bl(+e)),n==null&&(n=0),r==null&&(r=0),i==null&&(i=0);function d(f){for(var g=0,_=s.length;g<_;++g){var x=s[g],v=x.x-n||1e-6,S=(x.y||0)-r||1e-6,w=(x.z||0)-i||1e-6,N=Math.sqrt(v*v+S*S+w*w),C=(u[g]-N)*l[g]*f/N;x.vx+=v*C,a>1&&(x.vy+=S*C),a>2&&(x.vz+=w*C)}}function p(){if(s){var f,g=s.length;for(l=new Array(g),u=new Array(g),f=0;f<g;++f)u[f]=+e(s[f],f,s),l[f]=isNaN(u[f])?0:+o(s[f],f,s)}}return d.initialize=function(f,...g){s=f,a=g.find(_=>[1,2,3].includes(_))||2,p()},d.strength=function(f){return arguments.length?(o=typeof f=="function"?f:Bl(+f),p(),d):o},d.radius=function(f){return arguments.length?(e=typeof f=="function"?f:Bl(+f),p(),d):e},d.x=function(f){return arguments.length?(n=+f,d):n},d.y=function(f){return arguments.length?(r=+f,d):r},d.z=function(f){return arguments.length?(i=+f,d):i},d}const{abs:ym,cos:jl,sin:Rh,acos:KRe,atan2:_m,sqrt:Oc,pow:va}=Math;function xm(e){return e<0?-va(-e,1/3):va(e,1/3)}const EV=Math.PI,q_=2*EV,Dc=EV/2,YRe=1e-6,v2=Number.MAX_SAFE_INTEGER||9007199254740991,y2=Number.MIN_SAFE_INTEGER||-9007199254740991,GRe={x:0,y:0,z:0},pt={Tvalues:[-.06405689286260563,.06405689286260563,-.1911188674736163,.1911188674736163,-.3150426796961634,.3150426796961634,-.4337935076260451,.4337935076260451,-.5454214713888396,.5454214713888396,-.6480936519369755,.6480936519369755,-.7401241915785544,.7401241915785544,-.820001985973903,.820001985973903,-.8864155270044011,.8864155270044011,-.9382745520027328,.9382745520027328,-.9747285559713095,.9747285559713095,-.9951872199970213,.9951872199970213],Cvalues:[.12793819534675216,.12793819534675216,.1258374563468283,.1258374563468283,.12167047292780339,.12167047292780339,.1155056680537256,.1155056680537256,.10744427011596563,.10744427011596563,.09761865210411388,.09761865210411388,.08619016153195327,.08619016153195327,.0733464814110803,.0733464814110803,.05929858491543678,.05929858491543678,.04427743881741981,.04427743881741981,.028531388628933663,.028531388628933663,.0123412297999872,.0123412297999872],arcfn:function(e,n){const r=n(e);let i=r.x*r.x+r.y*r.y;return typeof r.z<"u"&&(i+=r.z*r.z),Oc(i)},compute:function(e,n,r){if(e===0)return n[0].t=0,n[0];const i=n.length-1;if(e===1)return n[i].t=1,n[i];const s=1-e;let a=n;if(i===0)return n[0].t=e,n[0];if(i===1){const l={x:s*a[0].x+e*a[1].x,y:s*a[0].y+e*a[1].y,t:e};return r&&(l.z=s*a[0].z+e*a[1].z),l}if(i<4){let l=s*s,u=e*e,d,p,f,g=0;i===2?(a=[a[0],a[1],a[2],GRe],d=l,p=s*e*2,f=u):i===3&&(d=l*s,p=l*e*3,f=s*u*3,g=e*u);const _={x:d*a[0].x+p*a[1].x+f*a[2].x+g*a[3].x,y:d*a[0].y+p*a[1].y+f*a[2].y+g*a[3].y,t:e};return r&&(_.z=d*a[0].z+p*a[1].z+f*a[2].z+g*a[3].z),_}const o=JSON.parse(JSON.stringify(n));for(;o.length>1;){for(let l=0;l<o.length-1;l++)o[l]={x:o[l].x+(o[l+1].x-o[l].x)*e,y:o[l].y+(o[l+1].y-o[l].y)*e},typeof o[l].z<"u"&&(o[l].z=o[l].z+(o[l+1].z-o[l].z)*e);o.splice(o.length-1,1)}return o[0].t=e,o[0]},computeWithRatios:function(e,n,r,i){const s=1-e,a=r,o=n;let l=a[0],u=a[1],d=a[2],p=a[3],f;if(l*=s,u*=e,o.length===2)return f=l+u,{x:(l*o[0].x+u*o[1].x)/f,y:(l*o[0].y+u*o[1].y)/f,z:i?(l*o[0].z+u*o[1].z)/f:!1,t:e};if(l*=s,u*=2*s,d*=e*e,o.length===3)return f=l+u+d,{x:(l*o[0].x+u*o[1].x+d*o[2].x)/f,y:(l*o[0].y+u*o[1].y+d*o[2].y)/f,z:i?(l*o[0].z+u*o[1].z+d*o[2].z)/f:!1,t:e};if(l*=s,u*=1.5*s,d*=3*s,p*=e*e*e,o.length===4)return f=l+u+d+p,{x:(l*o[0].x+u*o[1].x+d*o[2].x+p*o[3].x)/f,y:(l*o[0].y+u*o[1].y+d*o[2].y+p*o[3].y)/f,z:i?(l*o[0].z+u*o[1].z+d*o[2].z+p*o[3].z)/f:!1,t:e}},derive:function(e,n){const r=[];for(let i=e,s=i.length,a=s-1;s>1;s--,a--){const o=[];for(let l=0,u;l<a;l++)u={x:a*(i[l+1].x-i[l].x),y:a*(i[l+1].y-i[l].y)},n&&(u.z=a*(i[l+1].z-i[l].z)),o.push(u);r.push(o),i=o}return r},between:function(e,n,r){return n<=e&&e<=r||pt.approximately(e,n)||pt.approximately(e,r)},approximately:function(e,n,r){return ym(e-n)<=(r||YRe)},length:function(e){const r=pt.Tvalues.length;let i=0;for(let s=0,a;s<r;s++)a=.5*pt.Tvalues[s]+.5,i+=pt.Cvalues[s]*pt.arcfn(a,e);return .5*i},map:function(e,n,r,i,s){const a=r-n,o=s-i,l=e-n,u=l/a;return i+o*u},lerp:function(e,n,r){const i={x:n.x+e*(r.x-n.x),y:n.y+e*(r.y-n.y)};return n.z!==void 0&&r.z!==void 0&&(i.z=n.z+e*(r.z-n.z)),i},pointToString:function(e){let n=e.x+"/"+e.y;return typeof e.z<"u"&&(n+="/"+e.z),n},pointsToString:function(e){return"["+e.map(pt.pointToString).join(", ")+"]"},copy:function(e){return JSON.parse(JSON.stringify(e))},angle:function(e,n,r){const i=n.x-e.x,s=n.y-e.y,a=r.x-e.x,o=r.y-e.y,l=i*o-s*a,u=i*a+s*o;return _m(l,u)},round:function(e,n){const r=""+e,i=r.indexOf(".");return parseFloat(r.substring(0,i+1+n))},dist:function(e,n){const r=e.x-n.x,i=e.y-n.y;return Oc(r*r+i*i)},closest:function(e,n){let r=va(2,63),i,s;return e.forEach(function(a,o){s=pt.dist(n,a),s<r&&(r=s,i=o)}),{mdist:r,mpos:i}},abcratio:function(e,n){if(n!==2&&n!==3)return!1;if(typeof e>"u")e=.5;else if(e===0||e===1)return e;const r=va(e,n)+va(1-e,n),i=r-1;return ym(i/r)},projectionratio:function(e,n){if(n!==2&&n!==3)return!1;if(typeof e>"u")e=.5;else if(e===0||e===1)return e;const r=va(1-e,n),i=va(e,n)+r;return r/i},lli8:function(e,n,r,i,s,a,o,l){const u=(e*i-n*r)*(s-o)-(e-r)*(s*l-a*o),d=(e*i-n*r)*(a-l)-(n-i)*(s*l-a*o),p=(e-r)*(a-l)-(n-i)*(s-o);return p==0?!1:{x:u/p,y:d/p}},lli4:function(e,n,r,i){const s=e.x,a=e.y,o=n.x,l=n.y,u=r.x,d=r.y,p=i.x,f=i.y;return pt.lli8(s,a,o,l,u,d,p,f)},lli:function(e,n){return pt.lli4(e,e.c,n,n.c)},makeline:function(e,n){return new or(e.x,e.y,(e.x+n.x)/2,(e.y+n.y)/2,n.x,n.y)},findbbox:function(e){let n=v2,r=v2,i=y2,s=y2;return e.forEach(function(a){const o=a.bbox();n>o.x.min&&(n=o.x.min),r>o.y.min&&(r=o.y.min),i<o.x.max&&(i=o.x.max),s<o.y.max&&(s=o.y.max)}),{x:{min:n,mid:(n+i)/2,max:i,size:i-n},y:{min:r,mid:(r+s)/2,max:s,size:s-r}}},shapeintersections:function(e,n,r,i,s){if(!pt.bboxoverlap(n,i))return[];const a=[],o=[e.startcap,e.forward,e.back,e.endcap],l=[r.startcap,r.forward,r.back,r.endcap];return o.forEach(function(u){u.virtual||l.forEach(function(d){if(d.virtual)return;const p=u.intersects(d,s);p.length>0&&(p.c1=u,p.c2=d,p.s1=e,p.s2=r,a.push(p))})}),a},makeshape:function(e,n,r){const i=n.points.length,s=e.points.length,a=pt.makeline(n.points[i-1],e.points[0]),o=pt.makeline(e.points[s-1],n.points[0]),l={startcap:a,forward:e,back:n,endcap:o,bbox:pt.findbbox([a,e,n,o])};return l.intersections=function(u){return pt.shapeintersections(l,l.bbox,u,u.bbox,r)},l},getminmax:function(e,n,r){if(!r)return{min:0,max:0};let i=v2,s=y2,a,o;r.indexOf(0)===-1&&(r=[0].concat(r)),r.indexOf(1)===-1&&r.push(1);for(let l=0,u=r.length;l<u;l++)a=r[l],o=e.get(a),o[n]<i&&(i=o[n]),o[n]>s&&(s=o[n]);return{min:i,mid:(i+s)/2,max:s,size:s-i}},align:function(e,n){const r=n.p1.x,i=n.p1.y,s=-_m(n.p2.y-i,n.p2.x-r),a=function(o){return{x:(o.x-r)*jl(s)-(o.y-i)*Rh(s),y:(o.x-r)*Rh(s)+(o.y-i)*jl(s)}};return e.map(a)},roots:function(e,n){n=n||{p1:{x:0,y:0},p2:{x:1,y:0}};const r=e.length-1,i=pt.align(e,n),s=function(D){return 0<=D&&D<=1};if(r===2){const D=i[0].y,F=i[1].y,B=i[2].y,H=D-2*F+B;if(H!==0){const $=-Oc(F*F-D*B),z=-D+F,W=-($+z)/H,P=-(-$+z)/H;return[W,P].filter(s)}else if(F!==B&&H===0)return[(2*F-B)/(2*F-2*B)].filter(s);return[]}const a=i[0].y,o=i[1].y,l=i[2].y,u=i[3].y;let d=-a+3*o-3*l+u,p=3*a-6*o+3*l,f=-3*a+3*o,g=a;if(pt.approximately(d,0)){if(pt.approximately(p,0))return pt.approximately(f,0)?[]:[-g/f].filter(s);const D=Oc(f*f-4*p*g),F=2*p;return[(D-f)/F,(-f-D)/F].filter(s)}p/=d,f/=d,g/=d;const _=(3*f-p*p)/3,x=_/3,v=(2*p*p*p-9*p*f+27*g)/27,S=v/2,w=S*S+x*x*x;let N,C,T,A,E;if(w<0){const D=-_/3,F=D*D*D,B=Oc(F),H=-v/(2*B),$=H<-1?-1:H>1?1:H,z=KRe($),W=xm(B),P=2*W;return T=P*jl(z/3)-p/3,A=P*jl((z+q_)/3)-p/3,E=P*jl((z+2*q_)/3)-p/3,[T,A,E].filter(s)}else{if(w===0)return N=S<0?xm(-S):-xm(S),T=2*N-p/3,A=-N-p/3,[T,A].filter(s);{const D=Oc(w);return N=xm(-S+D),C=xm(S+D),[N-C-p/3].filter(s)}}},droots:function(e){if(e.length===3){const n=e[0],r=e[1],i=e[2],s=n-2*r+i;if(s!==0){const a=-Oc(r*r-n*i),o=-n+r,l=-(a+o)/s,u=-(-a+o)/s;return[l,u]}else if(r!==i&&s===0)return[(2*r-i)/(2*(r-i))];return[]}if(e.length===2){const n=e[0],r=e[1];return n!==r?[n/(n-r)]:[]}return[]},curvature:function(e,n,r,i,s){let a,o,l,u,d=0,p=0;const f=pt.compute(e,n),g=pt.compute(e,r),_=f.x*f.x+f.y*f.y;if(i?(a=Oc(va(f.y*g.z-g.y*f.z,2)+va(f.z*g.x-g.z*f.x,2)+va(f.x*g.y-g.x*f.y,2)),o=va(_+f.z*f.z,3/2)):(a=f.x*g.y-f.y*g.x,o=va(_,3/2)),a===0||o===0)return{k:0,r:0};if(d=a/o,p=o/a,!s){const x=pt.curvature(e-.001,n,r,i,!0).k,v=pt.curvature(e+.001,n,r,i,!0).k;u=(v-d+(d-x))/2,l=(ym(v-d)+ym(d-x))/2}return{k:d,r:p,dk:u,adk:l}},inflections:function(e){if(e.length<4)return[];const n=pt.align(e,{p1:e[0],p2:e.slice(-1)[0]}),r=n[2].x*n[1].y,i=n[3].x*n[1].y,s=n[1].x*n[2].y,a=n[3].x*n[2].y,o=18*(-3*r+2*i+3*s-a),l=18*(3*r-i-3*s),u=18*(s-r);if(pt.approximately(o,0)){if(!pt.approximately(l,0)){let g=-u/l;if(0<=g&&g<=1)return[g]}return[]}const d=2*o;if(pt.approximately(d,0))return[];const p=l*l-4*o*u;if(p<0)return[];const f=Math.sqrt(p);return[(f-l)/d,-(l+f)/d].filter(function(g){return 0<=g&&g<=1})},bboxoverlap:function(e,n){const r=["x","y"],i=r.length;for(let s=0,a,o,l,u;s<i;s++)if(a=r[s],o=e[a].mid,l=n[a].mid,u=(e[a].size+n[a].size)/2,ym(o-l)>=u)return!1;return!0},expandbox:function(e,n){n.x.min<e.x.min&&(e.x.min=n.x.min),n.y.min<e.y.min&&(e.y.min=n.y.min),n.z&&n.z.min<e.z.min&&(e.z.min=n.z.min),n.x.max>e.x.max&&(e.x.max=n.x.max),n.y.max>e.y.max&&(e.y.max=n.y.max),n.z&&n.z.max>e.z.max&&(e.z.max=n.z.max),e.x.mid=(e.x.min+e.x.max)/2,e.y.mid=(e.y.min+e.y.max)/2,e.z&&(e.z.mid=(e.z.min+e.z.max)/2),e.x.size=e.x.max-e.x.min,e.y.size=e.y.max-e.y.min,e.z&&(e.z.size=e.z.max-e.z.min)},pairiteration:function(e,n,r){const i=e.bbox(),s=n.bbox(),a=1e5,o=r||.5;if(i.x.size+i.y.size<o&&s.x.size+s.y.size<o)return[(a*(e._t1+e._t2)/2|0)/a+"/"+(a*(n._t1+n._t2)/2|0)/a];let l=e.split(.5),u=n.split(.5),d=[{left:l.left,right:u.left},{left:l.left,right:u.right},{left:l.right,right:u.right},{left:l.right,right:u.left}];d=d.filter(function(f){return pt.bboxoverlap(f.left.bbox(),f.right.bbox())});let p=[];return d.length===0||(d.forEach(function(f){p=p.concat(pt.pairiteration(f.left,f.right,o))}),p=p.filter(function(f,g){return p.indexOf(f)===g})),p},getccenter:function(e,n,r){const i=n.x-e.x,s=n.y-e.y,a=r.x-n.x,o=r.y-n.y,l=i*jl(Dc)-s*Rh(Dc),u=i*Rh(Dc)+s*jl(Dc),d=a*jl(Dc)-o*Rh(Dc),p=a*Rh(Dc)+o*jl(Dc),f=(e.x+n.x)/2,g=(e.y+n.y)/2,_=(n.x+r.x)/2,x=(n.y+r.y)/2,v=f+l,S=g+u,w=_+d,N=x+p,C=pt.lli8(f,g,v,S,_,x,w,N),T=pt.dist(C,e);let A=_m(e.y-C.y,e.x-C.x),E=_m(n.y-C.y,n.x-C.x),D=_m(r.y-C.y,r.x-C.x),F;return A<D?((A>E||E>D)&&(A+=q_),A>D&&(F=D,D=A,A=F)):D<E&&E<A?(F=D,D=A,A=F):D+=q_,C.s=A,C.e=D,C.r=T,C},numberSort:function(e,n){return e-n}};class lg{constructor(n){this.curves=[],this._3d=!1,n&&(this.curves=n,this._3d=this.curves[0]._3d)}valueOf(){return this.toString()}toString(){return"["+this.curves.map(function(n){return pt.pointsToString(n.points)}).join(", ")+"]"}addCurve(n){this.curves.push(n),this._3d=this._3d||n._3d}length(){return this.curves.map(function(n){return n.length()}).reduce(function(n,r){return n+r})}curve(n){return this.curves[n]}bbox(){const n=this.curves;for(var r=n[0].bbox(),i=1;i<n.length;i++)pt.expandbox(r,n[i].bbox());return r}offset(n){const r=[];return this.curves.forEach(function(i){r.push(...i.offset(n))}),new lg(r)}}const{abs:bm,min:TI,max:MI,cos:XRe,sin:QRe,acos:ZRe,sqrt:km}=Math,JRe=Math.PI;class or{constructor(n){let r=n&&n.forEach?n:Array.from(arguments).slice(),i=!1;if(typeof r[0]=="object"){i=r.length;const _=[];r.forEach(function(x){["x","y","z"].forEach(function(v){typeof x[v]<"u"&&_.push(x[v])})}),r=_}let s=!1;const a=r.length;if(i){if(i>4){if(arguments.length!==1)throw new Error("Only new Bezier(point[]) is accepted for 4th and higher order curves");s=!0}}else if(a!==6&&a!==8&&a!==9&&a!==12&&arguments.length!==1)throw new Error("Only new Bezier(point[]) is accepted for 4th and higher order curves");const o=this._3d=!s&&(a===9||a===12)||n&&n[0]&&typeof n[0].z<"u",l=this.points=[];for(let _=0,x=o?3:2;_<a;_+=x){var u={x:r[_],y:r[_+1]};o&&(u.z=r[_+2]),l.push(u)}const d=this.order=l.length-1,p=this.dims=["x","y"];o&&p.push("z"),this.dimlen=p.length;const f=pt.align(l,{p1:l[0],p2:l[d]}),g=pt.dist(l[0],l[d]);this._linear=f.reduce((_,x)=>_+bm(x.y),0)<g/50,this._lut=[],this._t1=0,this._t2=1,this.update()}static quadraticFromPoints(n,r,i,s){if(typeof s>"u"&&(s=.5),s===0)return new or(r,r,i);if(s===1)return new or(n,r,r);const a=or.getABC(2,n,r,i,s);return new or(n,a.A,i)}static cubicFromPoints(n,r,i,s,a){typeof s>"u"&&(s=.5);const o=or.getABC(3,n,r,i,s);typeof a>"u"&&(a=pt.dist(r,o.C));const l=a*(1-s)/s,u=pt.dist(n,i),d=(i.x-n.x)/u,p=(i.y-n.y)/u,f=a*d,g=a*p,_=l*d,x=l*p,v={x:r.x-f,y:r.y-g},S={x:r.x+_,y:r.y+x},w=o.A,N={x:w.x+(v.x-w.x)/(1-s),y:w.y+(v.y-w.y)/(1-s)},C={x:w.x+(S.x-w.x)/s,y:w.y+(S.y-w.y)/s},T={x:n.x+(N.x-n.x)/s,y:n.y+(N.y-n.y)/s},A={x:i.x+(C.x-i.x)/(1-s),y:i.y+(C.y-i.y)/(1-s)};return new or(n,T,A,i)}static getUtils(){return pt}getUtils(){return or.getUtils()}static get PolyBezier(){return lg}valueOf(){return this.toString()}toString(){return pt.pointsToString(this.points)}toSVG(){if(this._3d)return!1;const n=this.points,r=n[0].x,i=n[0].y,s=["M",r,i,this.order===2?"Q":"C"];for(let a=1,o=n.length;a<o;a++)s.push(n[a].x),s.push(n[a].y);return s.join(" ")}setRatios(n){if(n.length!==this.points.length)throw new Error("incorrect number of ratio values");this.ratios=n,this._lut=[]}verify(){const n=this.coordDigest();n!==this._print&&(this._print=n,this.update())}coordDigest(){return this.points.map(function(n,r){return""+r+n.x+n.y+(n.z?n.z:0)}).join("")}update(){this._lut=[],this.dpoints=pt.derive(this.points,this._3d),this.computedirection()}computedirection(){const n=this.points,r=pt.angle(n[0],n[this.order],n[1]);this.clockwise=r>0}length(){return pt.length(this.derivative.bind(this))}static getABC(n=2,r,i,s,a=.5){const o=pt.projectionratio(a,n),l=1-o,u={x:o*r.x+l*s.x,y:o*r.y+l*s.y},d=pt.abcratio(a,n);return{A:{x:i.x+(i.x-u.x)/d,y:i.y+(i.y-u.y)/d},B:i,C:u,S:r,E:s}}getABC(n,r){r=r||this.get(n);let i=this.points[0],s=this.points[this.order];return or.getABC(this.order,i,r,s,n)}getLUT(n){if(this.verify(),n=n||100,this._lut.length===n+1)return this._lut;this._lut=[],n++,this._lut=[];for(let r=0,i,s;r<n;r++)s=r/(n-1),i=this.compute(s),i.t=s,this._lut.push(i);return this._lut}on(n,r){r=r||5;const i=this.getLUT(),s=[];for(let a=0,o,l=0;a<i.length;a++)o=i[a],pt.dist(o,n)<r&&(s.push(o),l+=a/i.length);return s.length?t/=s.length:!1}project(n){const r=this.getLUT(),i=r.length-1,s=pt.closest(r,n),a=s.mpos,o=(a-1)/i,l=(a+1)/i,u=.1/i;let d=s.mdist,p=o,f=p,g;d+=1;for(let _;p<l+u;p+=u)g=this.compute(p),_=pt.dist(n,g),_<d&&(d=_,f=p);return f=f<0?0:f>1?1:f,g=this.compute(f),g.t=f,g.d=d,g}get(n){return this.compute(n)}point(n){return this.points[n]}compute(n){return this.ratios?pt.computeWithRatios(n,this.points,this.ratios,this._3d):pt.compute(n,this.points,this._3d,this.ratios)}raise(){const n=this.points,r=[n[0]],i=n.length;for(let s=1,a,o;s<i;s++)a=n[s],o=n[s-1],r[s]={x:(i-s)/i*a.x+s/i*o.x,y:(i-s)/i*a.y+s/i*o.y};return r[i]=n[i-1],new or(r)}derivative(n){return pt.compute(n,this.dpoints[0],this._3d)}dderivative(n){return pt.compute(n,this.dpoints[1],this._3d)}align(){let n=this.points;return new or(pt.align(n,{p1:n[0],p2:n[n.length-1]}))}curvature(n){return pt.curvature(n,this.dpoints[0],this.dpoints[1],this._3d)}inflections(){return pt.inflections(this.points)}normal(n){return this._3d?this.__normal3(n):this.__normal2(n)}__normal2(n){const r=this.derivative(n),i=km(r.x*r.x+r.y*r.y);return{t:n,x:-r.y/i,y:r.x/i}}__normal3(n){const r=this.derivative(n),i=this.derivative(n+.01),s=km(r.x*r.x+r.y*r.y+r.z*r.z),a=km(i.x*i.x+i.y*i.y+i.z*i.z);r.x/=s,r.y/=s,r.z/=s,i.x/=a,i.y/=a,i.z/=a;const o={x:i.y*r.z-i.z*r.y,y:i.z*r.x-i.x*r.z,z:i.x*r.y-i.y*r.x},l=km(o.x*o.x+o.y*o.y+o.z*o.z);o.x/=l,o.y/=l,o.z/=l;const u=[o.x*o.x,o.x*o.y-o.z,o.x*o.z+o.y,o.x*o.y+o.z,o.y*o.y,o.y*o.z-o.x,o.x*o.z-o.y,o.y*o.z+o.x,o.z*o.z];return{t:n,x:u[0]*r.x+u[1]*r.y+u[2]*r.z,y:u[3]*r.x+u[4]*r.y+u[5]*r.z,z:u[6]*r.x+u[7]*r.y+u[8]*r.z}}hull(n){let r=this.points,i=[],s=[],a=0;for(s[a++]=r[0],s[a++]=r[1],s[a++]=r[2],this.order===3&&(s[a++]=r[3]);r.length>1;){i=[];for(let o=0,l,u=r.length-1;o<u;o++)l=pt.lerp(n,r[o],r[o+1]),s[a++]=l,i.push(l);r=i}return s}split(n,r){if(n===0&&r)return this.split(r).left;if(r===1)return this.split(n).right;const i=this.hull(n),s={left:this.order===2?new or([i[0],i[3],i[5]]):new or([i[0],i[4],i[7],i[9]]),right:this.order===2?new or([i[5],i[4],i[2]]):new or([i[9],i[8],i[6],i[3]]),span:i};return s.left._t1=pt.map(0,0,1,this._t1,this._t2),s.left._t2=pt.map(n,0,1,this._t1,this._t2),s.right._t1=pt.map(n,0,1,this._t1,this._t2),s.right._t2=pt.map(1,0,1,this._t1,this._t2),r?(r=pt.map(r,n,1,0,1),s.right.split(r).left):s}extrema(){const n={};let r=[];return this.dims.forEach((function(i){let s=function(o){return o[i]},a=this.dpoints[0].map(s);n[i]=pt.droots(a),this.order===3&&(a=this.dpoints[1].map(s),n[i]=n[i].concat(pt.droots(a))),n[i]=n[i].filter(function(o){return o>=0&&o<=1}),r=r.concat(n[i].sort(pt.numberSort))}).bind(this)),n.values=r.sort(pt.numberSort).filter(function(i,s){return r.indexOf(i)===s}),n}bbox(){const n=this.extrema(),r={};return this.dims.forEach((function(i){r[i]=pt.getminmax(this,i,n[i])}).bind(this)),r}overlaps(n){const r=this.bbox(),i=n.bbox();return pt.bboxoverlap(r,i)}offset(n,r){if(typeof r<"u"){const i=this.get(n),s=this.normal(n),a={c:i,n:s,x:i.x+s.x*r,y:i.y+s.y*r};return this._3d&&(a.z=i.z+s.z*r),a}if(this._linear){const i=this.normal(0),s=this.points.map(function(a){const o={x:a.x+n*i.x,y:a.y+n*i.y};return a.z&&i.z&&(o.z=a.z+n*i.z),o});return[new or(s)]}return this.reduce().map(function(i){return i._linear?i.offset(n)[0]:i.scale(n)})}simple(){if(this.order===3){const s=pt.angle(this.points[0],this.points[3],this.points[1]),a=pt.angle(this.points[0],this.points[3],this.points[2]);if(s>0&&a<0||s<0&&a>0)return!1}const n=this.normal(0),r=this.normal(1);let i=n.x*r.x+n.y*r.y;return this._3d&&(i+=n.z*r.z),bm(ZRe(i))<JRe/3}reduce(){let n,r=0,i=0,s=.01,a,o=[],l=[],u=this.extrema().values;for(u.indexOf(0)===-1&&(u=[0].concat(u)),u.indexOf(1)===-1&&u.push(1),r=u[0],n=1;n<u.length;n++)i=u[n],a=this.split(r,i),a._t1=r,a._t2=i,o.push(a),r=i;return o.forEach(function(d){for(r=0,i=0;i<=1;)for(i=r+s;i<=1+s;i+=s)if(a=d.split(r,i),!a.simple()){if(i-=s,bm(r-i)<s)return[];a=d.split(r,i),a._t1=pt.map(r,0,1,d._t1,d._t2),a._t2=pt.map(i,0,1,d._t1,d._t2),l.push(a),r=i;break}r<1&&(a=d.split(r,1),a._t1=pt.map(r,0,1,d._t1,d._t2),a._t2=d._t2,l.push(a))}),l}translate(n,r,i){i=typeof i=="number"?i:r;const s=this.order;let a=this.points.map((o,l)=>(1-l/s)*r+l/s*i);return new or(this.points.map((o,l)=>({x:o.x+n.x*a[l],y:o.y+n.y*a[l]})))}scale(n){const r=this.order;let i=!1;if(typeof n=="function"&&(i=n),i&&r===2)return this.raise().scale(i);const s=this.clockwise,a=this.points;if(this._linear)return this.translate(this.normal(0),i?i(0):n,i?i(1):n);const o=i?i(0):n,l=i?i(1):n,u=[this.offset(0,10),this.offset(1,10)],d=[],p=pt.lli4(u[0],u[0].c,u[1],u[1].c);if(!p)throw new Error("cannot scale this curve. Try reducing it first.");return[0,1].forEach(function(f){const g=d[f*r]=pt.copy(a[f*r]);g.x+=(f?l:o)*u[f].n.x,g.y+=(f?l:o)*u[f].n.y}),i?([0,1].forEach(function(f){if(!(r===2&&f)){var g=a[f+1],_={x:g.x-p.x,y:g.y-p.y},x=i?i((f+1)/r):n;i&&!s&&(x=-x);var v=km(_.x*_.x+_.y*_.y);_.x/=v,_.y/=v,d[f+1]={x:g.x+x*_.x,y:g.y+x*_.y}}}),new or(d)):([0,1].forEach(f=>{if(r===2&&f)return;const g=d[f*r],_=this.derivative(f),x={x:g.x+_.x,y:g.y+_.y};d[f+1]=pt.lli4(g,x,p,a[f+1])}),new or(d))}outline(n,r,i,s){if(r=r===void 0?n:r,this._linear){const A=this.normal(0),E=this.points[0],D=this.points[this.points.length-1];let F,B,H;i===void 0&&(i=n,s=r),F={x:E.x+A.x*n,y:E.y+A.y*n},H={x:D.x+A.x*i,y:D.y+A.y*i},B={x:(F.x+H.x)/2,y:(F.y+H.y)/2};const $=[F,B,H];F={x:E.x-A.x*r,y:E.y-A.y*r},H={x:D.x-A.x*s,y:D.y-A.y*s},B={x:(F.x+H.x)/2,y:(F.y+H.y)/2};const z=[H,B,F],W=pt.makeline(z[2],$[0]),P=pt.makeline($[2],z[0]),q=[W,new or($),P,new or(z)];return new lg(q)}const a=this.reduce(),o=a.length,l=[];let u=[],d,p=0,f=this.length();const g=typeof i<"u"&&typeof s<"u";function _(A,E,D,F,B){return function(H){const $=F/D,z=(F+B)/D,W=E-A;return pt.map(H,0,1,A+$*W,A+z*W)}}a.forEach(function(A){const E=A.length();g?(l.push(A.scale(_(n,i,f,p,E))),u.push(A.scale(_(-r,-s,f,p,E)))):(l.push(A.scale(n)),u.push(A.scale(-r))),p+=E}),u=u.map(function(A){return d=A.points,d[3]?A.points=[d[3],d[2],d[1],d[0]]:A.points=[d[2],d[1],d[0]],A}).reverse();const x=l[0].points[0],v=l[o-1].points[l[o-1].points.length-1],S=u[o-1].points[u[o-1].points.length-1],w=u[0].points[0],N=pt.makeline(S,x),C=pt.makeline(v,w),T=[N].concat(l).concat([C]).concat(u);return new lg(T)}outlineshapes(n,r,i){r=r||n;const s=this.outline(n,r).curves,a=[];for(let o=1,l=s.length;o<l/2;o++){const u=pt.makeshape(s[o],s[l-o],i);u.startcap.virtual=o>1,u.endcap.virtual=o<l/2-1,a.push(u)}return a}intersects(n,r){return n?n.p1&&n.p2?this.lineIntersects(n):(n instanceof or&&(n=n.reduce()),this.curveintersects(this.reduce(),n,r)):this.selfintersects(r)}lineIntersects(n){const r=TI(n.p1.x,n.p2.x),i=TI(n.p1.y,n.p2.y),s=MI(n.p1.x,n.p2.x),a=MI(n.p1.y,n.p2.y);return pt.roots(this.points,n).filter(o=>{var l=this.get(o);return pt.between(l.x,r,s)&&pt.between(l.y,i,a)})}selfintersects(n){const r=this.reduce(),i=r.length-2,s=[];for(let a=0,o,l,u;a<i;a++)l=r.slice(a,a+1),u=r.slice(a+2),o=this.curveintersects(l,u,n),s.push(...o);return s}curveintersects(n,r,i){const s=[];n.forEach(function(o){r.forEach(function(l){o.overlaps(l)&&s.push({left:o,right:l})})});let a=[];return s.forEach(function(o){const l=pt.pairiteration(o.left,o.right,i);l.length>0&&(a=a.concat(l))}),a}arcs(n){return n=n||.5,this._iterate(n,[])}_error(n,r,i,s){const a=(s-i)/4,o=this.get(i+a),l=this.get(s-a),u=pt.dist(n,r),d=pt.dist(n,o),p=pt.dist(n,l);return bm(d-u)+bm(p-u)}_iterate(n,r){let i=0,s=1,a;do{a=0,s=1;let o=this.get(i),l,u,d,p,f=!1,g=!1,_,x=s,v=1;do if(g=f,p=d,x=(i+s)/2,l=this.get(x),u=this.get(s),d=pt.getccenter(o,l,u),d.interval={start:i,end:s},f=this._error(d,o,i,s)<=n,_=g&&!f,_||(v=s),f){if(s>=1){if(d.interval.end=v=1,p=d,s>1){let w={x:d.x+d.r*XRe(d.e),y:d.y+d.r*QRe(d.e)};d.e+=pt.angle({x:d.x,y:d.y},w,this.get(1))}break}s=s+(s-i)/2}else s=x;while(!_&&a++<100);if(a>=100)break;p=p||d,r.push(p),i=v}while(s<1);return r}}function KN(e,n){(n==null||n>e.length)&&(n=e.length);for(var r=0,i=Array(n);r<n;r++)i[r]=e[r];return i}function e5e(e){if(Array.isArray(e))return e}function t5e(e){if(Array.isArray(e))return KN(e)}function n5e(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function r5e(e,n){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var i,s,a,o,l=[],u=!0,d=!1;try{if(a=(r=r.call(e)).next,n!==0)for(;!(u=(i=a.call(r)).done)&&(l.push(i.value),l.length!==n);u=!0);}catch(p){d=!0,s=p}finally{try{if(!u&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(d)throw s}}return l}}function i5e(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function s5e(){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 a5e(e,n){if(e==null)return{};var r,i,s=o5e(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],n.includes(r)||{}.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}function o5e(e,n){if(e==null)return{};var r={};for(var i in e)if({}.hasOwnProperty.call(e,i)){if(n.includes(i))continue;r[i]=e[i]}return r}function l5e(e,n){return e5e(e)||r5e(e,n)||AV(e,n)||i5e()}function c5e(e){return t5e(e)||n5e(e)||AV(e)||s5e()}function u5e(e,n){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,n);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function d5e(e){var n=u5e(e,"string");return typeof n=="symbol"?n:n+""}function AV(e,n){if(e){if(typeof e=="string")return KN(e,n);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?KN(e,n):void 0}}var h5e=(function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,s=(n instanceof Array?n.length?n:[void 0]:[n]).map(function(l){return{keyAccessor:l,isProp:!(l instanceof Function)}}),a=e.reduce(function(l,u){var d=l,p=u;return s.forEach(function(f,g){var _=f.keyAccessor,x=f.isProp,v;if(x){var S=p,w=S[_],N=a5e(S,[_].map(d5e));v=w,p=N}else v=_(p,g);g+1<s.length?(d.hasOwnProperty(v)||(d[v]={}),d=d[v]):r?(d.hasOwnProperty(v)||(d[v]=[]),d[v].push(p)):d[v]=p}),l},{});r instanceof Function&&(function l(u){var d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;d===s.length?Object.keys(u).forEach(function(p){return u[p]=r(u[p])}):Object.values(u).forEach(function(p){return l(p,d+1)})})(a);var o=a;return i&&(o=[],(function l(u){var d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];d.length===s.length?o.push({keys:d,vals:u}):Object.entries(u).forEach(function(p){var f=l5e(p,2),g=f[0],_=f[1];return l(_,[].concat(c5e(d),[g]))})})(a),n instanceof Array&&n.length===0&&o.length===1&&(o[0].keys=[])),o});function f5e(e,n){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(n).domain(e);break}return this}const RI=Symbol("implicit");function TV(){var e=new J6,n=[],r=[],i=RI;function s(a){let o=e.get(a);if(o===void 0){if(i!==RI)return i;e.set(a,o=n.push(a)-1)}return r[o%r.length]}return s.domain=function(a){if(!arguments.length)return n.slice();n=[],e=new J6;for(const o of a)e.has(o)||e.set(o,n.push(o)-1);return s},s.range=function(a){return arguments.length?(r=Array.from(a),s):r.slice()},s.unknown=function(a){return arguments.length?(i=a,s):i},s.copy=function(){return TV(n,r).unknown(i)},f5e.apply(s,arguments),s}function p5e(e){for(var n=e.length/6|0,r=new Array(n),i=0;i<n;)r[i]="#"+e.slice(i*6,++i*6);return r}const m5e=p5e("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928");function g5e(e,n){n===void 0&&(n={});var r=n.insertAt;if(!(typeof document>"u")){var i=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.type="text/css",r==="top"&&i.firstChild?i.insertBefore(s,i.firstChild):i.appendChild(s),s.styleSheet?s.styleSheet.cssText=e:s.appendChild(document.createTextNode(e))}}var v5e=`.force-graph-container canvas {
  display: block;
  user-select: none;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

.force-graph-container .clickable {
  cursor: pointer;
}

.force-graph-container .grabbable {
  cursor: move;
  cursor: grab;
  cursor: -moz-grab;
  cursor: -webkit-grab;
}

.force-graph-container .grabbable:active {
  cursor: grabbing;
  cursor: -moz-grabbing;
  cursor: -webkit-grabbing;
}
`;g5e(v5e);function YN(e,n){(n==null||n>e.length)&&(n=e.length);for(var r=0,i=Array(n);r<n;r++)i[r]=e[r];return i}function y5e(e){if(Array.isArray(e))return e}function _5e(e){if(Array.isArray(e))return YN(e)}function OI(e,n,r){if(MV())return Reflect.construct.apply(null,arguments);var i=[null];i.push.apply(i,n);var s=new(e.bind.apply(e,i));return s}function Kg(e,n,r){return(n=C5e(n))in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function MV(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(MV=function(){return!!e})()}function x5e(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function b5e(e,n){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var i,s,a,o,l=[],u=!0,d=!1;try{if(a=(r=r.call(e)).next,n!==0)for(;!(u=(i=a.call(r)).done)&&(l.push(i.value),l.length!==n);u=!0);}catch(p){d=!0,s=p}finally{try{if(!u&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(d)throw s}}return l}}function k5e(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function w5e(){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 DI(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,i)}return r}function Oh(e){for(var n=1;n<arguments.length;n++){var r=arguments[n]!=null?arguments[n]:{};n%2?DI(Object(r),!0).forEach(function(i){Kg(e,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):DI(Object(r)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(r,i))})}return e}function cg(e,n){return y5e(e)||b5e(e,n)||RV(e,n)||k5e()}function ka(e){return _5e(e)||x5e(e)||RV(e)||w5e()}function S5e(e,n){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,n);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}function C5e(e){var n=S5e(e,"string");return typeof n=="symbol"?n:n+""}function GN(e){"@babel/helpers - typeof";return GN=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},GN(e)}function RV(e,n){if(e){if(typeof e=="string")return YN(e,n);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?YN(e,n):void 0}}var j5e=TV(m5e);function PI(e,n,r){!n||typeof r!="string"||e.filter(function(i){return!i[r]}).forEach(function(i){i[r]=j5e(n(i))})}function N5e(e,n){var r=e.nodes,i=e.links,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=s.nodeFilter,o=a===void 0?function(){return!0}:a,l=s.onLoopError,u=l===void 0?function(_){throw"Invalid DAG structure! Found cycle in node path: ".concat(_.join(" -> "),".")}:l,d={};r.forEach(function(_){return d[n(_)]={data:_,out:[],depth:-1,skip:!o(_)}}),i.forEach(function(_){var x=_.source,v=_.target,S=T(x),w=T(v);if(!d.hasOwnProperty(S))throw"Missing source node with id: ".concat(S);if(!d.hasOwnProperty(w))throw"Missing target node with id: ".concat(w);var N=d[S],C=d[w];N.out.push(C);function T(A){return GN(A)==="object"?n(A):A}});var p=[];g(Object.values(d));var f=Object.assign.apply(Object,[{}].concat(ka(Object.entries(d).filter(function(_){var x=cg(_,2),v=x[1];return!v.skip}).map(function(_){var x=cg(_,2),v=x[0],S=x[1];return Kg({},v,S.depth)}))));return f;function g(_){for(var x=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],v=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,S=function(){var T=_[w];if(x.indexOf(T)!==-1){var A=[].concat(ka(x.slice(x.indexOf(T))),[T]).map(function(E){return n(E.data)});return p.some(function(E){return E.length===A.length&&E.every(function(D,F){return D===A[F]})})||(p.push(A),u(A)),1}v>T.depth&&(T.depth=v,g(T.out,[].concat(ka(x),[T]),v+(T.skip?0:1)))},w=0,N=_.length;w<N;w++)S()}}var E5e=2,Bi=function(n,r){return r.onNeedsRedraw&&r.onNeedsRedraw()},LI=function(n,r){if(!r.isShadow){var i=Ln(r.linkDirectionalParticles);r.graphData.links.forEach(function(s){var a=Math.round(Math.abs(i(s)));a?s.__photons=ka(Array(a)).map(function(){return{}}):delete s.__photons})}},Yb=bT({props:{graphData:{default:{nodes:[],links:[]},onChange:function(n,r){r.engineRunning=!1,LI(n,r)}},dagMode:{onChange:function(n,r){!n&&(r.graphData.nodes||[]).forEach(function(i){return i.fx=i.fy=void 0})}},dagLevelDistance:{},dagNodeFilter:{default:function(n){return!0}},onDagError:{triggerUpdate:!1},nodeRelSize:{default:4,triggerUpdate:!1,onChange:Bi},nodeId:{default:"id"},nodeVal:{default:"val",triggerUpdate:!1,onChange:Bi},nodeColor:{default:"color",triggerUpdate:!1,onChange:Bi},nodeAutoColorBy:{},nodeCanvasObject:{triggerUpdate:!1,onChange:Bi},nodeCanvasObjectMode:{default:function(){return"replace"},triggerUpdate:!1,onChange:Bi},nodeVisibility:{default:!0,triggerUpdate:!1,onChange:Bi},linkSource:{default:"source"},linkTarget:{default:"target"},linkVisibility:{default:!0,triggerUpdate:!1,onChange:Bi},linkColor:{default:"color",triggerUpdate:!1,onChange:Bi},linkAutoColorBy:{},linkLineDash:{triggerUpdate:!1,onChange:Bi},linkWidth:{default:1,triggerUpdate:!1,onChange:Bi},linkCurvature:{default:0,triggerUpdate:!1,onChange:Bi},linkCanvasObject:{triggerUpdate:!1,onChange:Bi},linkCanvasObjectMode:{default:function(){return"replace"},triggerUpdate:!1,onChange:Bi},linkDirectionalArrowLength:{default:0,triggerUpdate:!1,onChange:Bi},linkDirectionalArrowColor:{triggerUpdate:!1,onChange:Bi},linkDirectionalArrowRelPos:{default:.5,triggerUpdate:!1,onChange:Bi},linkDirectionalParticles:{default:0,triggerUpdate:!1,onChange:LI},linkDirectionalParticleSpeed:{default:.01,triggerUpdate:!1},linkDirectionalParticleOffset:{default:0,triggerUpdate:!1},linkDirectionalParticleWidth:{default:4,triggerUpdate:!1},linkDirectionalParticleColor:{triggerUpdate:!1},linkDirectionalParticleCanvasObject:{triggerUpdate:!1},globalScale:{default:1,triggerUpdate:!1},d3AlphaMin:{default:0,triggerUpdate:!1},d3AlphaDecay:{default:.0228,triggerUpdate:!1,onChange:function(n,r){r.forceLayout.alphaDecay(n)}},d3AlphaTarget:{default:0,triggerUpdate:!1,onChange:function(n,r){r.forceLayout.alphaTarget(n)}},d3VelocityDecay:{default:.4,triggerUpdate:!1,onChange:function(n,r){r.forceLayout.velocityDecay(n)}},warmupTicks:{default:0,triggerUpdate:!1},cooldownTicks:{default:1/0,triggerUpdate:!1},cooldownTime:{default:15e3,triggerUpdate:!1},onUpdate:{default:function(){},triggerUpdate:!1},onFinishUpdate:{default:function(){},triggerUpdate:!1},onEngineTick:{default:function(){},triggerUpdate:!1},onEngineStop:{default:function(){},triggerUpdate:!1},onNeedsRedraw:{triggerUpdate:!1},isShadow:{default:!1,triggerUpdate:!1}},methods:{d3Force:function(n,r,i){return i===void 0?n.forceLayout.force(r):(n.forceLayout.force(r,i),this)},d3ReheatSimulation:function(n){return n.forceLayout.alpha(1),this.resetCountdown(),this},resetCountdown:function(n){return n.cntTicks=0,n.startTickTime=new Date,n.engineRunning=!0,this},isEngineRunning:function(n){return!!n.engineRunning},tickFrame:function(n){return!n.isShadow&&r(),s(),!n.isShadow&&a(),!n.isShadow&&o(),i(),this;function r(){n.engineRunning&&(++n.cntTicks>n.cooldownTicks||new Date-n.startTickTime>n.cooldownTime||n.d3AlphaMin>0&&n.forceLayout.alpha()<n.d3AlphaMin?(n.engineRunning=!1,n.onEngineStop()):(n.forceLayout.tick(),n.onEngineTick()))}function i(){var l=Ln(n.nodeVisibility),u=Ln(n.nodeVal),d=Ln(n.nodeColor),p=Ln(n.nodeCanvasObjectMode),f=n.ctx,g=n.isShadow/n.globalScale,_=n.graphData.nodes.filter(l);f.save(),_.forEach(function(x){var v=p(x);if(n.nodeCanvasObject&&(v==="before"||v==="replace")&&(n.nodeCanvasObject(x,f,n.globalScale),v==="replace")){f.restore();return}var S=Math.sqrt(Math.max(0,u(x)||1))*n.nodeRelSize+g;f.beginPath(),f.arc(x.x,x.y,S,0,2*Math.PI,!1),f.fillStyle=d(x)||"rgba(31, 120, 180, 0.92)",f.fill(),n.nodeCanvasObject&&v==="after"&&n.nodeCanvasObject(x,n.ctx,n.globalScale)}),f.restore()}function s(){var l=Ln(n.linkVisibility),u=Ln(n.linkColor),d=Ln(n.linkWidth),p=Ln(n.linkLineDash),f=Ln(n.linkCurvature),g=Ln(n.linkCanvasObjectMode),_=n.ctx,x=n.isShadow*2,v=n.graphData.links.filter(l);v.forEach(E);var S=[],w=[],N=v;if(n.linkCanvasObject){var C=[],T=[];v.forEach(function(D){return({before:S,after:w,replace:C}[g(D)]||T).push(D)}),N=[].concat(ka(S),w,T),S=S.concat(C)}_.save(),S.forEach(function(D){return n.linkCanvasObject(D,_,n.globalScale)}),_.restore();var A=h5e(N,[u,d,p]);_.save(),Object.entries(A).forEach(function(D){var F=cg(D,2),B=F[0],H=F[1],$=!B||B==="undefined"?"rgba(0,0,0,0.15)":B;Object.entries(H).forEach(function(z){var W=cg(z,2),P=W[0],q=W[1],I=(P||1)/n.globalScale+x;Object.entries(q).forEach(function(Q){var K=cg(Q,2);K[0];var Z=K[1],Y=p(Z[0]);_.beginPath(),Z.forEach(function(R){var U=R.source,V=R.target;if(!(!U||!V||!U.hasOwnProperty("x")||!V.hasOwnProperty("x"))){_.moveTo(U.x,U.y);var ie=R.__controlPoints;ie?_[ie.length===2?"quadraticCurveTo":"bezierCurveTo"].apply(_,ka(ie).concat([V.x,V.y])):_.lineTo(V.x,V.y)}}),_.strokeStyle=$,_.lineWidth=I,_.setLineDash(Y||[]),_.stroke()})})}),_.restore(),_.save(),w.forEach(function(D){return n.linkCanvasObject(D,_,n.globalScale)}),_.restore();function E(D){var F=f(D);if(!F){D.__controlPoints=null;return}var B=D.source,H=D.target;if(!(!B||!H||!B.hasOwnProperty("x")||!H.hasOwnProperty("x"))){var $=Math.sqrt(Math.pow(H.x-B.x,2)+Math.pow(H.y-B.y,2));if($>0){var z=Math.atan2(H.y-B.y,H.x-B.x),W=$*F,P={x:(B.x+H.x)/2+W*Math.cos(z-Math.PI/2),y:(B.y+H.y)/2+W*Math.sin(z-Math.PI/2)};D.__controlPoints=[P.x,P.y]}else{var q=F*70;D.__controlPoints=[H.x,H.y-q,H.x+q,H.y]}}}}function a(){var l=1.6,u=.2,d=Ln(n.linkDirectionalArrowLength),p=Ln(n.linkDirectionalArrowRelPos),f=Ln(n.linkVisibility),g=Ln(n.linkDirectionalArrowColor||n.linkColor),_=Ln(n.nodeVal),x=n.ctx;x.save(),n.graphData.links.filter(f).forEach(function(v){var S=d(v);if(!(!S||S<0)){var w=v.source,N=v.target;if(!(!w||!N||!w.hasOwnProperty("x")||!N.hasOwnProperty("x"))){var C=Math.sqrt(Math.max(0,_(w)||1))*n.nodeRelSize,T=Math.sqrt(Math.max(0,_(N)||1))*n.nodeRelSize,A=Math.min(1,Math.max(0,p(v))),E=g(v)||"rgba(0,0,0,0.28)",D=S/l/2,F=v.__controlPoints&&OI(or,[w.x,w.y].concat(ka(v.__controlPoints),[N.x,N.y])),B=F?function(I){return F.get(I)}:function(I){return{x:w.x+(N.x-w.x)*I||0,y:w.y+(N.y-w.y)*I||0}},H=F?F.length():Math.sqrt(Math.pow(N.x-w.x,2)+Math.pow(N.y-w.y,2)),$=C+S+(H-C-T-S)*A,z=B($/H),W=B(($-S)/H),P=B(($-S*(1-u))/H),q=Math.atan2(z.y-W.y,z.x-W.x)-Math.PI/2;x.beginPath(),x.moveTo(z.x,z.y),x.lineTo(W.x+D*Math.cos(q),W.y+D*Math.sin(q)),x.lineTo(P.x,P.y),x.lineTo(W.x-D*Math.cos(q),W.y-D*Math.sin(q)),x.fillStyle=E,x.fill()}}}),x.restore()}function o(){var l=Ln(n.linkDirectionalParticles),u=Ln(n.linkDirectionalParticleSpeed),d=Ln(n.linkDirectionalParticleOffset),p=Ln(n.linkDirectionalParticleWidth),f=Ln(n.linkVisibility),g=Ln(n.linkDirectionalParticleColor||n.linkColor),_=n.ctx;_.save(),n.graphData.links.filter(f).forEach(function(x){var v=l(x);if(!(!x.hasOwnProperty("__photons")||!x.__photons.length)){var S=x.source,w=x.target;if(!(!S||!w||!S.hasOwnProperty("x")||!w.hasOwnProperty("x"))){var N=u(x),C=Math.abs(d(x)),T=x.__photons||[],A=Math.max(0,p(x)/2)/Math.sqrt(n.globalScale),E=g(x)||"rgba(0,0,0,0.28)";_.fillStyle=E;var D=x.__controlPoints?OI(or,[S.x,S.y].concat(ka(x.__controlPoints),[w.x,w.y])):null,F=0,B=!1;T.forEach(function(H){var $=!!H.__singleHop;if(H.hasOwnProperty("__progressRatio")||(H.__progressRatio=$?0:(F+C)/v),!$&&F++,H.__progressRatio+=N,H.__progressRatio>=1)if(!$)H.__progressRatio=H.__progressRatio%1;else{B=!0;return}var z=H.__progressRatio,W=D?D.get(z):{x:S.x+(w.x-S.x)*z||0,y:S.y+(w.y-S.y)*z||0};n.linkDirectionalParticleCanvasObject?n.linkDirectionalParticleCanvasObject(W.x,W.y,x,_,n.globalScale):(_.beginPath(),_.arc(W.x,W.y,A,0,2*Math.PI,!1),_.fill())}),B&&(x.__photons=x.__photons.filter(function(H){return!H.__singleHop||H.__progressRatio<=1}))}}}),_.restore()}},emitParticle:function(n,r){return r&&(!r.__photons&&(r.__photons=[]),r.__photons.push({__singleHop:!0})),this}},stateInit:function(){return{forceLayout:qRe().force("link",LRe()).force("charge",URe()).force("center",BMe()).force("dagRadial",null).stop(),engineRunning:!1}},init:function(n,r){r.ctx=n},update:function(n,r){n.engineRunning=!1,n.onUpdate(),n.nodeAutoColorBy!==null&&PI(n.graphData.nodes,Ln(n.nodeAutoColorBy),n.nodeColor),n.linkAutoColorBy!==null&&PI(n.graphData.links,Ln(n.linkAutoColorBy),n.linkColor),n.graphData.links.forEach(function(g){g.source=g[n.linkSource],g.target=g[n.linkTarget]}),n.forceLayout.stop().alpha(1).nodes(n.graphData.nodes);var i=n.forceLayout.force("link");i&&i.id(function(g){return g[n.nodeId]}).links(n.graphData.links);var s=n.dagMode&&N5e(n.graphData,function(g){return g[n.nodeId]},{nodeFilter:n.dagNodeFilter,onLoopError:n.onDagError||void 0}),a=Math.max.apply(Math,ka(Object.values(s||[]))),o=n.dagLevelDistance||n.graphData.nodes.length/(a||1)*E5e*(["radialin","radialout"].indexOf(n.dagMode)!==-1?.7:1);if(["lr","rl","td","bu"].includes(r.dagMode)){var l=["lr","rl"].includes(r.dagMode)?"fx":"fy";n.graphData.nodes.filter(n.dagNodeFilter).forEach(function(g){return delete g[l]})}if(["lr","rl","td","bu"].includes(n.dagMode)){var u=["rl","bu"].includes(n.dagMode),d=function(_){return(s[_[n.nodeId]]-a/2)*o*(u?-1:1)},p=["lr","rl"].includes(n.dagMode)?"fx":"fy";n.graphData.nodes.filter(n.dagNodeFilter).forEach(function(g){return g[p]=d(g)})}n.forceLayout.force("dagRadial",["radialin","radialout"].indexOf(n.dagMode)!==-1?VRe(function(g){var _=s[g[n.nodeId]]||-1;return(n.dagMode==="radialin"?a-_:_)*o}).strength(function(g){return n.dagNodeFilter(g)?1:0}):null);for(var f=0;f<n.warmupTicks&&!(n.d3AlphaMin>0&&n.forceLayout.alpha()<n.d3AlphaMin);f++)n.forceLayout.tick();this.resetCountdown(),n.onFinishUpdate()}});function OV(e,n){var r=e instanceof Array?e:[e],i=new n;return i._destructor&&i._destructor(),{linkProp:function(a){return{default:i[a](),onChange:function(l,u){r.forEach(function(d){return u[d][a](l)})},triggerUpdate:!1}},linkMethod:function(a){return function(o){for(var l=arguments.length,u=new Array(l>1?l-1:0),d=1;d<l;d++)u[d-1]=arguments[d];var p=[];return r.forEach(function(f){var g=o[f],_=g[a].apply(g,u);_!==g&&p.push(_)}),p.length?p[0]:this}}}}var A5e=800,T5e=4,M5e=5,DV=OV("forceGraph",Yb),R5e=OV(["forceGraph","shadowGraph"],Yb),O5e=Object.assign.apply(Object,ka(["nodeColor","nodeAutoColorBy","nodeCanvasObject","nodeCanvasObjectMode","linkColor","linkAutoColorBy","linkLineDash","linkWidth","linkCanvasObject","linkCanvasObjectMode","linkDirectionalArrowLength","linkDirectionalArrowColor","linkDirectionalArrowRelPos","linkDirectionalParticles","linkDirectionalParticleSpeed","linkDirectionalParticleOffset","linkDirectionalParticleWidth","linkDirectionalParticleColor","linkDirectionalParticleCanvasObject","dagMode","dagLevelDistance","dagNodeFilter","onDagError","d3AlphaMin","d3AlphaDecay","d3VelocityDecay","warmupTicks","cooldownTicks","cooldownTime","onEngineTick","onEngineStop"].map(function(e){return Kg({},e,DV.linkProp(e))})).concat(ka(["nodeRelSize","nodeId","nodeVal","nodeVisibility","linkSource","linkTarget","linkVisibility","linkCurvature"].map(function(e){return Kg({},e,R5e.linkProp(e))})))),D5e=Object.assign.apply(Object,ka(["d3Force","d3ReheatSimulation","emitParticle"].map(function(e){return Kg({},e,DV.linkMethod(e))})));function _2(e){if(e.canvas){var n=e.canvas.width,r=e.canvas.height;n===300&&r===150&&(n=r=0);var i=window.devicePixelRatio;n/=i,r/=i,[e.canvas,e.shadowCanvas].forEach(function(a){a.style.width="".concat(e.width,"px"),a.style.height="".concat(e.height,"px"),a.width=e.width*i,a.height=e.height*i,!n&&!r&&a.getContext("2d").scale(i,i)});var s=Ba(e.canvas).k;e.zoom.translateBy(e.zoom.__baseElem,(e.width-n)/2/s,(e.height-r)/2/s),e.needsRedraw=!0}}function PV(e){var n=window.devicePixelRatio;e.setTransform(n,0,0,n,0,0)}function II(e,n,r){e.save(),PV(e),e.clearRect(0,0,n,r),e.restore()}var P5e=bT({props:Oh({width:{default:window.innerWidth,onChange:function(n,r){return _2(r)},triggerUpdate:!1},height:{default:window.innerHeight,onChange:function(n,r){return _2(r)},triggerUpdate:!1},graphData:{default:{nodes:[],links:[]},onChange:function(n,r){[n.nodes,n.links].every(function(s){return(s||[]).every(function(a){return!a.hasOwnProperty("__indexColor")})})&&r.colorTracker.reset(),[{type:"Node",objs:n.nodes},{type:"Link",objs:n.links}].forEach(i),r.forceGraph.graphData(n),r.shadowGraph.graphData(n);function i(s){var a=s.type,o=s.objs;o.filter(function(l){if(!l.hasOwnProperty("__indexColor"))return!0;var u=r.colorTracker.lookup(l.__indexColor);return!u||!u.hasOwnProperty("d")||u.d!==l}).forEach(function(l){l.__indexColor=r.colorTracker.register({type:a,d:l})})}},triggerUpdate:!1},backgroundColor:{onChange:function(n,r){r.canvas&&n&&(r.canvas.style.background=n)},triggerUpdate:!1},nodeLabel:{default:"name",triggerUpdate:!1},nodePointerAreaPaint:{onChange:function(n,r){r.shadowGraph.nodeCanvasObject(n?function(i,s,a){return n(i,i.__indexColor,s,a)}:null),r.flushShadowCanvas&&r.flushShadowCanvas()},triggerUpdate:!1},linkPointerAreaPaint:{onChange:function(n,r){r.shadowGraph.linkCanvasObject(n?function(i,s,a){return n(i,i.__indexColor,s,a)}:null),r.flushShadowCanvas&&r.flushShadowCanvas()},triggerUpdate:!1},linkLabel:{default:"name",triggerUpdate:!1},linkHoverPrecision:{default:4,triggerUpdate:!1},minZoom:{default:.01,onChange:function(n,r){r.zoom.scaleExtent([n,r.zoom.scaleExtent()[1]])},triggerUpdate:!1},maxZoom:{default:1e3,onChange:function(n,r){r.zoom.scaleExtent([r.zoom.scaleExtent()[0],n])},triggerUpdate:!1},enableNodeDrag:{default:!0,triggerUpdate:!1},enableZoomInteraction:{default:!0,triggerUpdate:!1},enablePanInteraction:{default:!0,triggerUpdate:!1},enableZoomPanInteraction:{default:!0,triggerUpdate:!1},enablePointerInteraction:{default:!0,onChange:function(n,r){r.hoverObj=null},triggerUpdate:!1},autoPauseRedraw:{default:!0,triggerUpdate:!1},onNodeDrag:{default:function(){},triggerUpdate:!1},onNodeDragEnd:{default:function(){},triggerUpdate:!1},onNodeClick:{triggerUpdate:!1},onNodeRightClick:{triggerUpdate:!1},onNodeHover:{triggerUpdate:!1},onLinkClick:{triggerUpdate:!1},onLinkRightClick:{triggerUpdate:!1},onLinkHover:{triggerUpdate:!1},onBackgroundClick:{triggerUpdate:!1},onBackgroundRightClick:{triggerUpdate:!1},showPointerCursor:{default:!0,triggerUpdate:!1},onZoom:{triggerUpdate:!1},onZoomEnd:{triggerUpdate:!1},onRenderFramePre:{triggerUpdate:!1},onRenderFramePost:{triggerUpdate:!1}},O5e),aliases:{stopAnimation:"pauseAnimation"},methods:Oh({graph2ScreenCoords:function(n,r,i){var s=Ba(n.canvas);return{x:r*s.k+s.x,y:i*s.k+s.y}},screen2GraphCoords:function(n,r,i){var s=Ba(n.canvas);return{x:(r-s.x)/s.k,y:(i-s.y)/s.k}},centerAt:function(n,r,i,s){if(!n.canvas)return null;if(r!==void 0||i!==void 0){var a=Object.assign({},r!==void 0?{x:r}:{},i!==void 0?{y:i}:{});return s?n.tweenGroup.add(new aI(o()).to(a,s).easing(_d.Quadratic.Out).onUpdate(l).onComplete(function(){n.tweenGroup.remove(this)}).start()):l(a),this}return o();function o(){var u=Ba(n.canvas);return{x:(n.width/2-u.x)/u.k,y:(n.height/2-u.y)/u.k}}function l(u){var d=u.x,p=u.y;n.zoom.translateTo(n.zoom.__baseElem,d===void 0?o().x:d,p===void 0?o().y:p),n.needsRedraw=!0}},zoom:function(n,r,i){if(!n.canvas)return null;if(r!==void 0)return i?n.tweenGroup.add(new aI({k:s()}).to({k:r},i).easing(_d.Quadratic.Out).onUpdate(function(o){var l=o.k;return a(l)}).onComplete(function(){n.tweenGroup.remove(this)}).start()):a(r),this;return s();function s(){return Ba(n.canvas).k}function a(o){n.zoom.scaleTo(n.zoom.__baseElem,o),n.needsRedraw=!0}},zoomToFit:function(n){for(var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:10,s=arguments.length,a=new Array(s>3?s-3:0),o=3;o<s;o++)a[o-3]=arguments[o];var l=this.getGraphBbox.apply(this,a);if(l){var u={x:(l.x[0]+l.x[1])/2,y:(l.y[0]+l.y[1])/2},d=Math.max(1e-12,Math.min(1e12,(n.width-i*2)/(l.x[1]-l.x[0]),(n.height-i*2)/(l.y[1]-l.y[0])));this.centerAt(u.x,u.y,r),this.zoom(d,r)}return this},getGraphBbox:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:function(){return!0},i=Ln(n.nodeVal),s=function(l){return Math.sqrt(Math.max(0,i(l)||1))*n.nodeRelSize},a=n.graphData.nodes.filter(r).map(function(o){return{x:o.x,y:o.y,r:s(o)}});return a.length?{x:[nI(a,function(o){return o.x-o.r}),tI(a,function(o){return o.x+o.r})],y:[nI(a,function(o){return o.y-o.r}),tI(a,function(o){return o.y+o.r})]}:null},pauseAnimation:function(n){return n.animationFrameRequestId&&(cancelAnimationFrame(n.animationFrameRequestId),n.animationFrameRequestId=null),this},resumeAnimation:function(n){return n.animationFrameRequestId||this._animationCycle(),this},_destructor:function(){this.pauseAnimation(),this.graphData({nodes:[],links:[]})}},D5e),stateInit:function(){return{lastSetZoom:1,zoom:fA(),forceGraph:new Yb,shadowGraph:new Yb().cooldownTicks(0).nodeColor("__indexColor").linkColor("__indexColor").isShadow(!0),colorTracker:new mMe,tweenGroup:new iV}},init:function(n,r){var i=this;n.innerHTML="";var s=document.createElement("div");s.classList.add("force-graph-container"),s.style.position="relative",n.appendChild(s),r.canvas=document.createElement("canvas"),r.backgroundColor&&(r.canvas.style.background=r.backgroundColor),s.appendChild(r.canvas),r.shadowCanvas=document.createElement("canvas");var a=r.canvas.getContext("2d"),o=r.shadowCanvas.getContext("2d",{willReadFrequently:!0}),l={x:-1e12,y:-1e12},u=function(){var f=null,g=window.devicePixelRatio,_=l.x>0&&l.y>0?o.getImageData(l.x*g,l.y*g,1,1):null;return _&&(f=r.colorTracker.lookup(_.data)),f};Fi(r.canvas).call(aA().subject(function(){if(!r.enableNodeDrag)return null;var p=u();return p&&p.type==="Node"?p.d:null}).on("start",function(p){var f=p.subject;f.__initialDragPos={x:f.x,y:f.y,fx:f.fx,fy:f.fy},p.active||(f.fx=f.x,f.fy=f.y),r.canvas.classList.add("grabbable")}).on("drag",function(p){var f=p.subject,g=f.__initialDragPos,_=p,x=Ba(r.canvas).k,v={x:g.x+(_.x-g.x)/x-f.x,y:g.y+(_.y-g.y)/x-f.y};["x","y"].forEach(function(S){return f["f".concat(S)]=f[S]=g[S]+(_[S]-g[S])/x}),!(!f.__dragged&&M5e>=Math.sqrt(GAe(["x","y"].map(function(S){return Math.pow(p[S]-g[S],2)}))))&&(r.forceGraph.d3AlphaTarget(.3).resetCountdown(),r.isPointerDragging=!0,f.__dragged=!0,r.onNodeDrag(f,v))}).on("end",function(p){var f=p.subject,g=f.__initialDragPos,_={x:f.x-g.x,y:f.y-g.y};g.fx===void 0&&(f.fx=void 0),g.fy===void 0&&(f.fy=void 0),delete f.__initialDragPos,r.forceGraph.d3AlphaTarget()&&r.forceGraph.d3AlphaTarget(0).resetCountdown(),r.canvas.classList.remove("grabbable"),r.isPointerDragging=!1,f.__dragged&&(delete f.__dragged,r.onNodeDragEnd(f,_))})),r.zoom(r.zoom.__baseElem=Fi(r.canvas)),r.zoom.__baseElem.on("dblclick.zoom",null),r.zoom.filter(function(p){return!p.button&&r.enableZoomPanInteraction&&(p.type!=="wheel"||Ln(r.enableZoomInteraction)(p))&&(p.type==="wheel"||Ln(r.enablePanInteraction)(p))}).on("zoom",function(p){var f=p.transform;[a,o].forEach(function(g){PV(g),g.translate(f.x,f.y),g.scale(f.k,f.k)}),r.isPointerDragging=!0,r.onZoom&&r.onZoom(Oh(Oh({},f),i.centerAt())),r.needsRedraw=!0}).on("end",function(p){r.isPointerDragging=!1,r.onZoomEnd&&r.onZoomEnd(Oh(Oh({},p.transform),i.centerAt()))}),_2(r),r.forceGraph.onNeedsRedraw(function(){return r.needsRedraw=!0}).onFinishUpdate(function(){Ba(r.canvas).k===r.lastSetZoom&&r.graphData.nodes.length&&(r.zoom.scaleTo(r.zoom.__baseElem,r.lastSetZoom=T5e/Math.cbrt(r.graphData.nodes.length)),r.needsRedraw=!0)}),r.tooltip=new IMe(s),["pointermove","pointerdown"].forEach(function(p){return s.addEventListener(p,function(f){p==="pointerdown"&&(r.isPointerPressed=!0,r.pointerDownEvent=f),!r.isPointerDragging&&f.type==="pointermove"&&r.onBackgroundClick&&(f.pressure>0||r.isPointerPressed)&&(f.pointerType==="mouse"||f.movementX===void 0||[f.movementX,f.movementY].some(function(x){return Math.abs(x)>1}))&&(r.isPointerDragging=!0);var g=_(s);l.x=f.pageX-g.left,l.y=f.pageY-g.top;function _(x){var v=x.getBoundingClientRect(),S=window.pageXOffset||document.documentElement.scrollLeft,w=window.pageYOffset||document.documentElement.scrollTop;return{top:v.top+w,left:v.left+S}}},{passive:!0})}),s.addEventListener("pointerup",function(p){if(r.isPointerPressed){if(r.isPointerPressed=!1,r.isPointerDragging){r.isPointerDragging=!1;return}var f=[p,r.pointerDownEvent];requestAnimationFrame(function(){if(p.button===0)if(r.hoverObj){var g=r["on".concat(r.hoverObj.type,"Click")];g&&g.apply(void 0,[r.hoverObj.d].concat(f))}else r.onBackgroundClick&&r.onBackgroundClick.apply(r,f);if(p.button===2)if(r.hoverObj){var _=r["on".concat(r.hoverObj.type,"RightClick")];_&&_.apply(void 0,[r.hoverObj.d].concat(f))}else r.onBackgroundRightClick&&r.onBackgroundRightClick.apply(r,f)})}},{passive:!0}),s.addEventListener("contextmenu",function(p){return!r.onBackgroundRightClick&&!r.onNodeRightClick&&!r.onLinkRightClick?!0:(p.preventDefault(),!1)}),r.forceGraph(a),r.shadowGraph(o);var d=kTe(function(){II(o,r.width,r.height),r.shadowGraph.linkWidth(function(f){return Ln(r.linkWidth)(f)+r.linkHoverPrecision});var p=Ba(r.canvas);r.shadowGraph.globalScale(p.k).tickFrame()},A5e);r.flushShadowCanvas=d.flush,(this._animationCycle=function p(){var f=!r.autoPauseRedraw||!!r.needsRedraw||r.forceGraph.isEngineRunning()||r.graphData.links.some(function(C){return C.__photons&&C.__photons.length});if(r.needsRedraw=!1,r.enablePointerInteraction){var g=r.isPointerDragging?null:u();if(g!==r.hoverObj){var _=r.hoverObj,x=_?_.type:null,v=g?g.type:null;if(x&&x!==v){var S=r["on".concat(x,"Hover")];S&&S(null,_.d)}if(v){var w=r["on".concat(v,"Hover")];w&&w(g.d,x===v?_.d:null)}r.tooltip.content(g&&Ln(r["".concat(g.type.toLowerCase(),"Label")])(g.d)||null),r.canvas.classList[(g&&r["on".concat(v,"Click")]||!g&&r.onBackgroundClick)&&Ln(r.showPointerCursor)(g==null?void 0:g.d)?"add":"remove"]("clickable"),r.hoverObj=g}f&&d()}if(f){II(a,r.width,r.height);var N=Ba(r.canvas).k;r.onRenderFramePre&&r.onRenderFramePre(a,N),r.forceGraph.globalScale(N).tickFrame(),r.onRenderFramePost&&r.onRenderFramePost(a,N)}r.tweenGroup.update(),r.animationFrameRequestId=requestAnimationFrame(p)})()},update:function(n){}}),x2={exports:{}},b2,BI;function L5e(){if(BI)return b2;BI=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return b2=e,b2}var k2,zI;function I5e(){if(zI)return k2;zI=1;var e=L5e();function n(){}function r(){}return r.resetWarningCache=n,k2=function(){function i(o,l,u,d,p,f){if(f!==e){var g=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw g.name="Invariant Violation",g}}i.isRequired=i;function s(){return i}var a={array:i,bigint:i,bool:i,func:i,number:i,object:i,string:i,symbol:i,any:i,arrayOf:s,element:i,elementType:i,instanceOf:s,node:i,objectOf:s,oneOf:s,oneOfType:s,shape:s,exact:s,checkPropTypes:r,resetWarningCache:n};return a.PropTypes=a,a},k2}var $I;function B5e(){return $I||($I=1,x2.exports=I5e()()),x2.exports}var z5e=B5e();const we=pu(z5e),sk={width:we.number,height:we.number,graphData:we.shape({nodes:we.arrayOf(we.object).isRequired,links:we.arrayOf(we.object).isRequired}),backgroundColor:we.string,nodeRelSize:we.number,nodeId:we.string,nodeLabel:we.oneOfType([we.string,we.func]),nodeVal:we.oneOfType([we.number,we.string,we.func]),nodeVisibility:we.oneOfType([we.bool,we.string,we.func]),nodeColor:we.oneOfType([we.string,we.func]),nodeAutoColorBy:we.oneOfType([we.string,we.func]),onNodeHover:we.func,onNodeClick:we.func,linkSource:we.string,linkTarget:we.string,linkLabel:we.oneOfType([we.string,we.func]),linkVisibility:we.oneOfType([we.bool,we.string,we.func]),linkColor:we.oneOfType([we.string,we.func]),linkAutoColorBy:we.oneOfType([we.string,we.func]),linkWidth:we.oneOfType([we.number,we.string,we.func]),linkCurvature:we.oneOfType([we.number,we.string,we.func]),linkDirectionalArrowLength:we.oneOfType([we.number,we.string,we.func]),linkDirectionalArrowColor:we.oneOfType([we.string,we.func]),linkDirectionalArrowRelPos:we.oneOfType([we.number,we.string,we.func]),linkDirectionalParticles:we.oneOfType([we.number,we.string,we.func]),linkDirectionalParticleSpeed:we.oneOfType([we.number,we.string,we.func]),linkDirectionalParticleOffset:we.oneOfType([we.number,we.string,we.func]),linkDirectionalParticleWidth:we.oneOfType([we.number,we.string,we.func]),linkDirectionalParticleColor:we.oneOfType([we.string,we.func]),onLinkHover:we.func,onLinkClick:we.func,dagMode:we.oneOf(["td","bu","lr","rl","zin","zout","radialin","radialout"]),dagLevelDistance:we.number,dagNodeFilter:we.func,onDagError:we.func,d3AlphaMin:we.number,d3AlphaDecay:we.number,d3VelocityDecay:we.number,warmupTicks:we.number,cooldownTicks:we.number,cooldownTime:we.number,onEngineTick:we.func,onEngineStop:we.func,getGraphBbox:we.func},LV={zoomToFit:we.func,onNodeRightClick:we.func,onNodeDrag:we.func,onNodeDragEnd:we.func,onLinkRightClick:we.func,linkHoverPrecision:we.number,onBackgroundClick:we.func,onBackgroundRightClick:we.func,showPointerCursor:we.oneOfType([we.bool,we.func]),enablePointerInteraction:we.bool,enableNodeDrag:we.bool},AT={showNavInfo:we.bool,nodeOpacity:we.number,nodeResolution:we.number,nodeThreeObject:we.oneOfType([we.object,we.string,we.func]),nodeThreeObjectExtend:we.oneOfType([we.bool,we.string,we.func]),nodePositionUpdate:we.func,linkOpacity:we.number,linkResolution:we.number,linkCurveRotation:we.oneOfType([we.number,we.string,we.func]),linkMaterial:we.oneOfType([we.object,we.string,we.func]),linkThreeObject:we.oneOfType([we.object,we.string,we.func]),linkThreeObjectExtend:we.oneOfType([we.bool,we.string,we.func]),linkPositionUpdate:we.func,linkDirectionalArrowResolution:we.number,linkDirectionalParticleResolution:we.number,linkDirectionalParticleThreeObject:we.oneOfType([we.object,we.string,we.func]),forceEngine:we.oneOf(["d3","ngraph"]),ngraphPhysics:we.object,numDimensions:we.oneOf([1,2,3])},$5e=Object.assign({},sk,LV,{linkLineDash:we.oneOfType([we.arrayOf(we.number),we.string,we.func]),nodeCanvasObjectMode:we.oneOfType([we.string,we.func]),nodeCanvasObject:we.func,nodePointerAreaPaint:we.func,linkCanvasObjectMode:we.oneOfType([we.string,we.func]),linkCanvasObject:we.func,linkPointerAreaPaint:we.func,linkDirectionalParticleCanvasObject:we.func,autoPauseRedraw:we.bool,minZoom:we.number,maxZoom:we.number,enableZoomInteraction:we.oneOfType([we.bool,we.func]),enablePanInteraction:we.oneOfType([we.bool,we.func]),onZoom:we.func,onZoomEnd:we.func,onRenderFramePre:we.func,onRenderFramePost:we.func});Object.assign({},sk,LV,AT,{enableNavigationControls:we.bool,controlType:we.oneOf(["trackball","orbit","fly"]),rendererConfig:we.object,extraRenderers:we.arrayOf(we.shape({render:we.func.isRequired}))});Object.assign({},sk,AT,{nodeDesc:we.oneOfType([we.string,we.func]),linkDesc:we.oneOfType([we.string,we.func])});Object.assign({},sk,AT,{markerAttrs:we.object,yOffset:we.number,glScale:we.number});const ak=UAe(P5e,{methodNames:["emitParticle","d3Force","d3ReheatSimulation","stopAnimation","pauseAnimation","resumeAnimation","centerAt","zoom","zoomToFit","getGraphBbox","screen2GraphCoords","graph2ScreenCoords"]});ak.displayName="ForceGraph2D";ak.propTypes=$5e;const F5e={agent:{icon:zl,color:"#22d3ee",bg:"rgba(34, 211, 238, 0.1)",border:"rgba(34, 211, 238, 0.25)"},skill:{icon:iu,color:"#a78bfa",bg:"rgba(167, 139, 250, 0.1)",border:"rgba(167, 139, 250, 0.25)"},conversation:{icon:fg,color:"#60a5fa",bg:"rgba(96, 165, 250, 0.1)",border:"rgba(96, 165, 250, 0.25)"},decision:{icon:xd,color:"#fbbf24",bg:"rgba(251, 191, 36, 0.1)",border:"rgba(251, 191, 36, 0.25)"},fact:{icon:sC,color:"#34d399",bg:"rgba(52, 211, 153, 0.1)",border:"rgba(52, 211, 153, 0.25)"},bundle:{icon:Ul,color:"#2dd4bf",bg:"rgba(45, 212, 191, 0.1)",border:"rgba(45, 212, 191, 0.25)"},config:{icon:i0,color:"#a1a1aa",bg:"rgba(161, 161, 170, 0.1)",border:"rgba(161, 161, 170, 0.25)"},workflow:{icon:o0,color:"#fb923c",bg:"rgba(251, 146, 60, 0.1)",border:"rgba(251, 146, 60, 0.25)"},character:{icon:zl,color:"#38bdf8",bg:"rgba(56, 189, 248, 0.1)",border:"rgba(56, 189, 248, 0.25)"},"character-state":{icon:zl,color:"#2dd4bf",bg:"rgba(45, 212, 191, 0.1)",border:"rgba(45, 212, 191, 0.25)"},storyline:{icon:xd,color:"#f59e0b",bg:"rgba(245, 158, 11, 0.1)",border:"rgba(245, 158, 11, 0.25)"},"foreshadow-thread":{icon:iu,color:"#c084fc",bg:"rgba(192, 132, 252, 0.1)",border:"rgba(192, 132, 252, 0.25)"},"canon-rule":{icon:ex,color:"#f87171",bg:"rgba(248, 113, 113, 0.1)",border:"rgba(248, 113, 113, 0.25)"},"timeline-event":{icon:TB,color:"#60a5fa",bg:"rgba(96, 165, 250, 0.1)",border:"rgba(96, 165, 250, 0.25)"},"webnovel-episode":{icon:sC,color:"#34d399",bg:"rgba(52, 211, 153, 0.1)",border:"rgba(52, 211, 153, 0.25)"},"canon-patch":{icon:OB,color:"#fb7185",bg:"rgba(251, 113, 133, 0.1)",border:"rgba(251, 113, 133, 0.25)"},"context-pack":{icon:Ul,color:"#818cf8",bg:"rgba(129, 140, 248, 0.1)",border:"rgba(129, 140, 248, 0.25)"}},H5e={icon:rv,color:"#a1a1aa",bg:"rgba(161, 161, 170, 0.1)",border:"rgba(161, 161, 170, 0.25)"},W5e=["main-canon","current-character-states","active-storylines","active-foreshadow"],IV=["DEPENDS_ON","DERIVED_FROM","REFERENCES","ADVANCES","FORESHADOWS","PAYOFF_TARGET","UPDATES","CONTRADICTS","BLOCKS","RELATED_TO","RESOLVES"],w2=[1,2,3],q5e=[80,120,160,200],U5e={DEPENDS_ON:{color:"#f59e0b",glow:"rgba(245,158,11,0.18)",label:"depends"},DERIVED_FROM:{color:"#22d3ee",glow:"rgba(34,211,238,0.18)",label:"derived"},REFERENCES:{color:"#60a5fa",glow:"rgba(96,165,250,0.18)",label:"refs"},ADVANCES:{color:"#34d399",glow:"rgba(52,211,153,0.18)",label:"advances"},FORESHADOWS:{color:"#a78bfa",glow:"rgba(167,139,250,0.18)",label:"foreshadows"},PAYOFF_TARGET:{color:"#f472b6",glow:"rgba(244,114,182,0.18)",label:"payoff"},UPDATES:{color:"#2dd4bf",glow:"rgba(45,212,191,0.18)",label:"updates"},CONTRADICTS:{color:"#f87171",glow:"rgba(248,113,113,0.22)",label:"contradicts"},BLOCKS:{color:"#fb7185",glow:"rgba(251,113,133,0.22)",label:"blocks"},RELATED_TO:{color:"#a1a1aa",glow:"rgba(161,161,170,0.14)",label:"related"},RESOLVES:{color:"#84cc16",glow:"rgba(132,204,22,0.18)",label:"resolves"}},V5e={color:"#94a3b8",glow:"rgba(148,163,184,0.14)",label:"edge"},U_={character:["---","character_id:","display_name:","role:","first_seen_episode:","core_traits:","constraints:","---","","## Canon Summary",""].join(`
`),"character-state":["---","character_id:","timeline_position:","current_location:","current_goal:","known_information:","emotional_state:","relationship_state:","open_threads:","last_updated_by_episode:","---","","## Current State",""].join(`
`),storyline:["---","storyline_id:","status: active","current_pressure:","next_pressure:","payoff_target:","---","","## Storyline",""].join(`
`),"foreshadow-thread":["---","thread_id:","status: active","allowed_use:","forbidden_use:","payoff_target:","---","","## Foreshadow Thread",""].join(`
`),"canon-rule":["---","rule_id:","severity: hard","scope:","---","","## Rule",""].join(`
`),"timeline-event":["---","event_id:","timeline_position:","episode:","participants:","---","","## Event",""].join(`
`),"webnovel-episode":["---","episode_number:","volume:","status: draft","source_context_pack:","---","","## Episode",""].join(`
`),"canon-patch":["---","patch_id:","patch_status: candidate","source_episode:","source_context_pack:","---","","## Proposed Revision Updates","","## Proposed Edges",""].join(`
`)};function Hc(e){return F5e[e.toLowerCase()]??H5e}function qu(e){var n;return!!(e.published||(n=e.tags)!=null&&n.includes("published"))}function K5e(e){if(!e)return"--";try{return new Date(e).toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"})}catch{return e}}function S2(e){if(!e)return"--";try{return new Date(e).toLocaleDateString(void 0,{month:"short",day:"numeric"})}catch{return e}}function Y5e(e){return!!(e&&/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e))}function FI(e){var r,i,s;return[e.author_display,e.username,(r=e.metadata)==null?void 0:r.username,(i=e.metadata)==null?void 0:i.updated_by,(s=e.metadata)==null?void 0:s.created_by,e.author].find(a=>a&&!Y5e(a))??"--"}function V_(e){const n=e!=null&&e.startsWith("asset://")?e.slice(8):e;if(!(n!=null&&n.startsWith("kref://")))return null;const r=n.indexOf("?"),i=r>=0?n.slice(0,r):n,s=r>=0?n.slice(r+1):"",a=new URLSearchParams(s),o=a.has("r")||a.has("t")?n:null,u=i.slice(7).split("/").filter(Boolean);if(u.length<2)return null;const d=u[0]??"";if(!d)return null;const p=u.slice(1,-1),f=`/${[d,...p].join("/")}`;return{project:d,spacePath:f,itemKref:i,revisionKref:o}}function Dh(e){if(!e)return[];const n=e.split("/").filter(Boolean);return n.map((r,i)=>({name:r,path:`/${n.slice(0,i+1).join("/")}`}))}function Hf(e){if(!e)return"";const n=e.split("?")[0]??e,r=n.split("/").pop()??n;return r.split(".")[0]||r}function G5e(e,n){return e===n||e.endsWith(`-${n}`)}function TT(e){return W5e.some(n=>G5e(e,n))}function K_(e){return e.item_name||Hf(e.kref)||e.kref}function C2(e){return`${e.source_kref}
${e.edge_type}
${e.target_kref}`}function HI(e){return`${e.source_kref}
${e.target_kref}`}function Uu(e){return U5e[e]??V5e}function X5e(e,n){return e.length<=n?e:`${e.slice(0,Math.max(0,n-1))}...`}function WI(e,n,r,i,s,a){const o=Math.min(a,i/2,s/2);e.beginPath(),e.moveTo(n+o,r),e.arcTo(n+i,r,n+i,r+s,o),e.arcTo(n+i,r+s,n,r+s,o),e.arcTo(n,r+s,n,r,o),e.arcTo(n,r,n+i,r,o),e.closePath()}function Q5e(e,n){return n.some(r=>e.x1<r.x2&&e.x2>r.x1&&e.y1<r.y2&&e.y2>r.y1)}function tf(e){var n;return(e==null?void 0:e.item_name)||(e==null?void 0:e.name)||((n=e==null?void 0:e.kref.split("/").pop())==null?void 0:n.split(".")[0])||"item"}function qI(e){return e?`r${e.number}`:"--"}function Z5e(e){const n={},r=e.trim();if(!r)return n;try{const i=JSON.parse(r);if(i&&typeof i=="object"&&!Array.isArray(i)){for(const[s,a]of Object.entries(i))n[s]=typeof a=="string"?a:JSON.stringify(a);return n}}catch{}for(const i of r.split(/\r?\n/)){const s=i.trim();if(!s||s.startsWith("#"))continue;const[a,...o]=s.includes("=")?s.split("="):s.split(":");a!=null&&a.trim()&&(n[a.trim()]=o.join(s.includes("=")?"=":":").trim())}return n}function BV({kref:e}){const{t:n}=cn(),[r,i]=b.useState(!1);return c.jsx("button",{type:"button",onClick:async()=>{await Ja(e)&&(i(!0),setTimeout(()=>i(!1),1500))},className:"truncate text-left text-xs font-mono",style:{color:r?"var(--revka-status-success)":"var(--revka-text-faint)"},title:n("assets.copy_kref"),children:e})}function qa({label:e,tone:n}){return c.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[10px] font-semibold uppercase",style:{color:n,border:`1px solid color-mix(in srgb, ${n} 20%, transparent)`},children:[c.jsx(Bx,{className:"h-2.5 w-2.5"}),e]})}const UI=["source_heading","title","summary","role_summary","status","timeline_position","current_location","current_goal","known_information","open_threads","embedding_text","_search_text","updated_by","created_by","tenant_id"];function J5e(e){return Object.entries(e??{}).sort(([r],[i])=>{const s=UI.indexOf(r),a=UI.indexOf(i);return s!==-1||a!==-1?(s===-1?Number.MAX_SAFE_INTEGER:s)-(a===-1?Number.MAX_SAFE_INTEGER:a):r.localeCompare(i)})}function e3e(e){return e.replace(/^_+/,"").replace(/_/g," ")}function t3e(e){return e.length>220?`${e.slice(0,217)}...`:e}function Y_({label:e,value:n,tone:r}){return c.jsxs("div",{className:"rounded-[8px] border px-3 py-2",style:{borderColor:"var(--revka-border-soft)",background:"rgba(255,255,255,0.025)"},children:[c.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-[0.08em]",style:{color:"var(--revka-text-faint)"},children:e}),c.jsx("div",{className:"mt-1 truncate text-sm font-semibold",style:{color:r??"var(--revka-text-primary)"},children:n})]})}function VI({metadata:e,maxVisible:n=8}){const r=J5e(e),i=r.slice(0,n),s=Math.max(0,r.length-i.length);return c.jsxs("section",{className:"space-y-2",children:[c.jsxs("div",{className:"flex items-center justify-between gap-2",children:[c.jsx("div",{className:"text-xs font-semibold uppercase tracking-[0.12em]",style:{color:"var(--revka-text-faint)"},children:"Metadata"}),c.jsxs("span",{className:"rounded-full border px-2 py-0.5 text-[10px] font-semibold",style:{borderColor:"var(--revka-border-soft)",color:"var(--revka-text-muted)"},children:[r.length," keys"]})]}),i.length>0?c.jsxs("div",{className:"space-y-2",children:[i.map(([a,o])=>c.jsxs("div",{className:"rounded-[8px] border p-2.5",style:{borderColor:"var(--revka-border-soft)",background:"rgba(255,255,255,0.025)"},children:[c.jsx("div",{className:"mb-1 truncate text-[10px] font-semibold uppercase tracking-[0.08em]",style:{color:"var(--revka-signal-selected)"},children:e3e(a)}),c.jsx("div",{className:"break-words text-xs leading-5",style:{color:"var(--revka-text-secondary)"},children:t3e(o)})]},a)),s>0?c.jsxs("div",{className:"text-[11px]",style:{color:"var(--revka-text-faint)"},children:["+",s," more metadata keys in raw view"]}):null]}):c.jsx("div",{className:"rounded-[8px] border px-3 py-4 text-xs",style:{borderColor:"var(--revka-border-soft)",color:"var(--revka-text-faint)"},children:"No metadata on this node."}),r.length>0?c.jsxs("details",{className:"rounded-[8px] border",style:{borderColor:"var(--revka-border-soft)"},children:[c.jsx("summary",{className:"cursor-pointer px-3 py-2 text-xs font-semibold",style:{color:"var(--revka-text-muted)"},children:"Raw JSON"}),c.jsx("pre",{className:"max-h-56 overflow-auto border-t p-3 text-[11px] leading-5",style:{borderColor:"var(--revka-border-soft)",background:"var(--revka-bg-elevated)",color:"var(--revka-text-secondary)"},children:JSON.stringify(e??{},null,2)})]}):null]})}function n3e({artifacts:e}){return e.length===0?c.jsx("div",{className:"text-xs",style:{color:"var(--revka-text-faint)"},children:"No artifacts attached."}):c.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[e.slice(0,4).map(n=>c.jsx("span",{className:"max-w-full truncate rounded-full border px-2 py-1 text-[10px] font-semibold",style:{borderColor:"var(--revka-border-soft)",color:"var(--revka-text-secondary)"},title:n.location||n.kref,children:n.name||Hf(n.kref)},n.kref)),e.length>4?c.jsxs("span",{className:"rounded-full border px-2 py-1 text-[10px] font-semibold",style:{borderColor:"var(--revka-border-soft)",color:"var(--revka-text-faint)"},children:["+",e.length-4]}):null]})}function j2({label:e,kref:n}){return c.jsxs("div",{className:"rounded-[8px] border p-2.5",style:{borderColor:"var(--revka-border-soft)",background:"rgba(255,255,255,0.025)"},children:[c.jsx("div",{className:"mb-1 text-[10px] font-semibold uppercase tracking-[0.08em]",style:{color:"var(--revka-text-faint)"},children:e}),c.jsx(BV,{kref:n})]})}function G_({title:e,count:n,defaultOpen:r=!1,children:i}){const[s,a]=b.useState(r);return c.jsxs("div",{className:"border-t",style:{borderColor:"var(--revka-border-soft)"},children:[c.jsxs("button",{type:"button",onClick:()=>a(o=>!o),className:"flex w-full items-center justify-between gap-2 py-3 text-left",children:[c.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-[0.14em]",style:{color:"var(--revka-text-secondary)"},children:e}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsxs("span",{className:"text-[11px]",style:{color:"var(--revka-text-faint)"},children:["(",n,")"]}),c.jsx(ru,{className:"h-3.5 w-3.5 transition-transform",style:{color:"var(--revka-text-faint)",transform:s?"rotate(90deg)":void 0}})]})]}),s?c.jsx("div",{className:"pb-3",children:i}):null]})}function r3e({bundles:e,members:n,childSpaces:r,currentSpacePath:i,selectedBundleKref:s,selectedBundleProtected:a,loadingBundles:o,loadingMembers:l,onNavigateSpace:u,onSelectBundle:d,onOpenMember:p,onCopyKref:f}){return c.jsxs("div",{className:"grid min-h-full grid-cols-[minmax(14rem,0.38fr)_minmax(0,1fr)]",children:[c.jsxs("div",{className:"border-r",style:{borderColor:"var(--revka-border-soft)"},children:[c.jsx("div",{className:"border-b px-4 py-2.5 text-[11px] font-semibold uppercase tracking-[0.12em]",style:{borderColor:"var(--revka-border-soft)",color:"var(--revka-text-faint)"},children:"Spaces"}),r.length===0?c.jsx("div",{className:"border-b px-4 py-3 text-xs",style:{borderColor:"var(--revka-border-soft)",color:"var(--revka-text-faint)"},children:"No child spaces"}):r.map(g=>c.jsxs("button",{type:"button",onClick:()=>u(g),className:"flex w-full items-center gap-2 border-b px-4 py-3 text-left transition hover:brightness-125",style:{borderColor:"var(--revka-border-soft)"},children:[c.jsx(NB,{className:"h-4 w-4 shrink-0",style:{color:"#38bdf8"}}),c.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",style:{color:"var(--revka-text-primary)"},children:g.name}),c.jsx(ru,{className:"h-3.5 w-3.5 shrink-0",style:{color:"var(--revka-text-faint)"}})]},g.path)),c.jsxs("div",{className:"border-b px-4 py-2.5 text-[11px] font-semibold uppercase tracking-[0.12em]",style:{borderColor:"var(--revka-border-soft)",color:"var(--revka-text-faint)"},children:["Bundles in ",i??"selected space"]}),o?c.jsx("div",{className:"p-4",children:c.jsx(Ct,{tone:"loading",compact:!0,title:"Loading bundles..."})}):e.length===0?c.jsx("div",{className:"p-4",children:c.jsx(Ct,{compact:!0,title:"No bundles",description:"No Kumiho bundle items were found in this space."})}):e.map(g=>{const _=g.kref===s,x=TT(Hf(g.kref));return c.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 border-b px-4 py-3 text-left transition",onClick:()=>d(g),style:{borderColor:"var(--revka-border-soft)",background:_?"color-mix(in srgb, var(--revka-signal-selected) 14%, transparent)":"transparent"},children:[c.jsx(Ul,{className:"h-4 w-4 shrink-0",style:{color:"#2dd4bf"}}),c.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",style:{color:"var(--revka-text-primary)"},children:tf(g)}),x?c.jsx(Cs,{className:"h-3.5 w-3.5",style:{color:"var(--revka-status-warning)"}}):null]},g.kref)})]}),c.jsx("div",{className:"min-w-0",children:s?c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"border-b px-4 py-3",style:{borderColor:"var(--revka-border-soft)"},children:c.jsxs("div",{className:"flex items-center justify-between gap-2",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsx("div",{className:"text-xs font-semibold uppercase tracking-[0.12em]",style:{color:"var(--revka-text-faint)"},children:"Bundle Members"}),c.jsx("button",{type:"button",className:"mt-1 truncate text-left text-xs font-mono",style:{color:"var(--revka-text-faint)"},onClick:()=>f(s),children:s})]}),a?c.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full px-2 py-1 text-[10px] font-semibold uppercase",style:{color:"var(--revka-status-warning)",border:"1px solid color-mix(in srgb, var(--revka-status-warning) 24%, transparent)"},children:[c.jsx(Cs,{className:"h-3 w-3"}),"Protected"]}):null]})}),l?c.jsx("div",{className:"p-4",children:c.jsx(Ct,{tone:"loading",compact:!0,title:"Loading members..."})}):n.length===0?c.jsx("div",{className:"p-4",children:c.jsx(Ct,{compact:!0,title:"No members",description:"This bundle has no item members."})}):c.jsx("div",{children:n.map(g=>{var w;const _=g.item,x=g.latest_revision,v=g.current_revision,S=(w=v==null?void 0:v.tags)!=null&&w.length?v.tags:(x==null?void 0:x.tags)??[];return c.jsxs("button",{type:"button",className:"w-full border-b px-4 py-3 text-left transition hover:brightness-125",onClick:()=>p(g),style:{borderColor:"var(--revka-border-soft)"},children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"truncate text-sm font-semibold",style:{color:"var(--revka-text-primary)"},children:_?tf(_):g.membership.item_kref}),_?c.jsx("span",{className:"rounded-full px-2 py-0.5 text-[10px] font-semibold",style:{color:"#2dd4bf",background:"rgba(45,212,191,0.1)"},children:_.kind}):null,v?c.jsx(qa,{label:"current",tone:"var(--revka-status-success)"}):null]}),c.jsx("div",{className:"mt-1 truncate text-xs font-mono",style:{color:"var(--revka-text-faint)"},children:g.membership.item_kref}),c.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-1.5",children:[c.jsxs("span",{className:"text-[10px]",style:{color:"var(--revka-text-faint)"},children:["latest ",x?qI(x):"--"," / current ",v?qI(v):"--"]}),S.slice(0,8).map(N=>c.jsx(qa,{label:N,tone:"var(--revka-text-faint)"},N))]})]},g.membership.item_kref)})})]}):c.jsx("div",{className:"p-4",children:c.jsx(Ct,{compact:!0,title:"Select a bundle",description:"Bundle membership is item-level; locked revision manifests preserve exact reproducibility."})})})]})}function i3e({action:e,project:n,spacePath:r,selectedItem:i,selectedRevision:s,selectedBundle:a,bundleMembers:o,onClose:l,onCreated:u}){const[d,p]=b.useState(!1),[f,g]=b.useState(null),[_,x]=b.useState(""),[v,S]=b.useState((i==null?void 0:i.kind)??"character-state"),[w,N]=b.useState(""),[C,T]=b.useState(e==="context-pack"?"CONTEXT_PACK.md":"content.md"),[A,E]=b.useState(""),[D,F]=b.useState(U_[v]??""),[B,H]=b.useState(["item","artifact","context-pack"].includes(e)),[$,z]=b.useState(!1),[W,P]=b.useState((s==null?void 0:s.kref)??""),[q,I]=b.useState((i==null?void 0:i.kref)??""),[Q,K]=b.useState("active"),[Z,Y]=b.useState(""),[R,U]=b.useState("REFERENCES"),[V,ie]=b.useState(""),[te,X]=b.useState(!1);b.useEffect(()=>{(!D.trim()||Object.values(U_).includes(D))&&F(U_[v]??"")},[v]);const se={project:"Create Project",space:"Create Space",subspace:"Create Subspace",item:"Create Item",bundle:"Create Bundle",revision:"Create Revision",artifact:"Attach or Link Artifact",edge:"Create Edge",tag:"Manage Revision Tags","bundle-member-add":"Add Item to Bundle","bundle-member-remove":"Remove Bundle Member","context-pack":"Create Context Pack from Bundle"}[e],re=r??(n?`/${n}`:""),de=a?TT(Hf(a.kref)):!1,ue=async()=>{p(!0),g(null);try{const ae=Z5e(w);if(e==="project"){await cZ({name:_,description:ae.description}),u();return}if(e==="space"||e==="subspace"){await uZ({parent_path:e==="space"&&n?`/${n}`:re,name:_}),u();return}if(e==="item"){const pe=await B3({space_path:re,item_name:_,kind:v,metadata:ae});let J;const me=B||!!A.trim();(D.trim()||me)&&(J=await gw({item_kref:pe.kref,metadata:{created_by:"revka-asset-browser"}}),me&&await vw({revision_kref:J.kref,name:C,location:A,content:D,write_file:B,overwrite:$,metadata:{mime:C.endsWith(".md")?"text/markdown":"text/plain"}})),u({item:pe,revision:J});return}if(e==="bundle"){const pe=await dZ({space_path:re,bundle_name:_,metadata:ae});u({bundle:pe});return}if(e==="revision"){const pe=await gw({item_kref:q||(i==null?void 0:i.kref)||"",metadata:ae});u({revision:pe});return}if(e==="artifact"){await vw({revision_kref:W||(s==null?void 0:s.kref)||"",name:C,location:A,content:D,write_file:B,overwrite:$,validate_exists:!B,metadata:ae}),u();return}if(e==="edge"){await gZ({source_kref:(s==null?void 0:s.kref)||W,target_kref:V,edge_type:R,metadata:ae}),u();return}if(e==="tag"){let pe;Q.trim()&&(pe=await vZ((s==null?void 0:s.kref)||W,Q.trim())),Z.trim()&&(pe=await yZ((s==null?void 0:s.kref)||W,Z.trim())),u({revision:pe});return}if(e==="bundle-member-add"){await pZ({bundle_kref:(a==null?void 0:a.kref)||"",item_kref:q||(i==null?void 0:i.kref)||"",metadata:ae,allow_protected:te}),u();return}if(e==="bundle-member-remove"){await mZ({bundle_kref:(a==null?void 0:a.kref)||"",item_kref:q||(i==null?void 0:i.kref)||"",allow_protected:te}),u();return}if(e==="context-pack"){const pe=_||`${Hf(a==null?void 0:a.kref)}-context-pack`,J=await B3({space_path:re,item_name:pe,kind:"context-pack",metadata:{source_bundle:(a==null?void 0:a.kref)??"",created_by:"revka-asset-browser"}}),me=await gw({item_kref:J.kref,metadata:{source_bundle:(a==null?void 0:a.kref)??""}}),fe=[`# Kumiho Context Pack: ${pe}`,"","## Source Bundle",(a==null?void 0:a.kref)??"","","## Locked Manifest Candidates",...o.map(ve=>{var Ke,ge;return`- ${((Ke=ve.current_revision)==null?void 0:Ke.kref)??((ge=ve.latest_revision)==null?void 0:ge.kref)??ve.membership.item_kref}`}),"","## Notes","Bundle membership is item-level. Review and lock exact revisions before using this context pack for reproducible generation."].join(`
`);await vw({revision_kref:me.kref,name:C||"CONTEXT_PACK.md",location:A,content:fe,write_file:B,overwrite:$,metadata:{source_bundle:(a==null?void 0:a.kref)??"",mime:"text/markdown"}}),u({item:J,revision:me})}}catch(ae){g(ae instanceof Error?ae.message:"Asset creation failed.")}finally{p(!1)}};return c.jsxs(yu,{title:se,description:"Kumiho-native authoring actions are prefilled from the current Asset Browser context.",onClose:d?()=>{}:l,size:"2xl",children:[c.jsxs("div",{className:"grid gap-3 md:grid-cols-2",children:[e==="project"?c.jsxs("label",{className:"text-xs font-semibold uppercase tracking-[0.1em]",style:{color:"var(--revka-text-faint)"},children:["Project name",c.jsx("input",{className:"revka-input mt-1",value:_,onChange:ae=>x(ae.target.value),autoFocus:!0})]}):null,["space","subspace","item","bundle","context-pack"].includes(e)?c.jsxs("label",{className:"text-xs font-semibold uppercase tracking-[0.1em]",style:{color:"var(--revka-text-faint)"},children:["Name",c.jsx("input",{className:"revka-input mt-1",value:_,onChange:ae=>x(ae.target.value),autoFocus:!0})]}):null,e==="item"?c.jsxs("label",{className:"text-xs font-semibold uppercase tracking-[0.1em]",style:{color:"var(--revka-text-faint)"},children:["Kind",c.jsx("input",{className:"revka-input mt-1",value:v,list:"asset-kind-templates",onChange:ae=>S(ae.target.value)}),c.jsx("datalist",{id:"asset-kind-templates",children:Object.keys(U_).map(ae=>c.jsx("option",{value:ae},ae))})]}):null,["revision","bundle-member-add","bundle-member-remove"].includes(e)?c.jsxs("label",{className:"text-xs font-semibold uppercase tracking-[0.1em]",style:{color:"var(--revka-text-faint)"},children:["Item kref",c.jsx("input",{className:"revka-input mt-1 font-mono text-xs",value:q,onChange:ae=>I(ae.target.value)})]}):null,["artifact","tag"].includes(e)?c.jsxs("label",{className:"text-xs font-semibold uppercase tracking-[0.1em]",style:{color:"var(--revka-text-faint)"},children:["Revision kref",c.jsx("input",{className:"revka-input mt-1 font-mono text-xs",value:W,onChange:ae=>P(ae.target.value)})]}):null,e==="edge"?c.jsxs(c.Fragment,{children:[c.jsxs("label",{className:"text-xs font-semibold uppercase tracking-[0.1em]",style:{color:"var(--revka-text-faint)"},children:["Edge type",c.jsx("input",{className:"revka-input mt-1",value:R,list:"asset-edge-types",onChange:ae=>U(ae.target.value)}),c.jsx("datalist",{id:"asset-edge-types",children:IV.map(ae=>c.jsx("option",{value:ae},ae))})]}),c.jsxs("label",{className:"text-xs font-semibold uppercase tracking-[0.1em]",style:{color:"var(--revka-text-faint)"},children:["Target revision kref",c.jsx("input",{className:"revka-input mt-1 font-mono text-xs",value:V,onChange:ae=>ie(ae.target.value)})]})]}):null,e==="tag"?c.jsxs(c.Fragment,{children:[c.jsxs("label",{className:"text-xs font-semibold uppercase tracking-[0.1em]",style:{color:"var(--revka-text-faint)"},children:["Add tag",c.jsx("input",{className:"revka-input mt-1",value:Q,onChange:ae=>K(ae.target.value)})]}),c.jsxs("label",{className:"text-xs font-semibold uppercase tracking-[0.1em]",style:{color:"var(--revka-text-faint)"},children:["Remove tag",c.jsx("input",{className:"revka-input mt-1",value:Z,onChange:ae=>Y(ae.target.value),placeholder:"current is blocked"})]})]}):null,["artifact","item","context-pack"].includes(e)?c.jsxs(c.Fragment,{children:[c.jsxs("label",{className:"text-xs font-semibold uppercase tracking-[0.1em]",style:{color:"var(--revka-text-faint)"},children:["Artifact name",c.jsx("input",{className:"revka-input mt-1",value:C,onChange:ae=>T(ae.target.value)})]}),c.jsxs("label",{className:"text-xs font-semibold uppercase tracking-[0.1em]",style:{color:"var(--revka-text-faint)"},children:["Location / path reference",c.jsx("input",{className:"revka-input mt-1 font-mono text-xs",value:A,onChange:ae=>E(ae.target.value),placeholder:B?"Auto: Revka workspace/artifacts/kumiho/... when blank":"file:///G:/path/content.md"})]})]}):null]}),["item","artifact","context-pack"].includes(e)?c.jsxs("div",{className:"mt-3 space-y-2",children:[c.jsxs("div",{className:"flex flex-wrap gap-3 text-xs",style:{color:"var(--revka-text-secondary)"},children:[c.jsxs("label",{className:"inline-flex items-center gap-2",children:[c.jsx("input",{type:"checkbox",checked:B,onChange:ae=>H(ae.target.checked)})," Create/write file under Revka workspace when location is blank"]}),c.jsxs("label",{className:"inline-flex items-center gap-2",children:[c.jsx("input",{type:"checkbox",checked:$,onChange:ae=>z(ae.target.checked)})," Overwrite existing file"]})]}),B&&!A.trim()?c.jsxs("div",{className:"rounded-[8px] border px-3 py-2 text-xs",style:{borderColor:"var(--revka-border-soft)",color:"var(--revka-text-faint)"},children:["The gateway will store this artifact under the configured Revka workspace at ",c.jsx("span",{className:"font-mono",children:"artifacts/kumiho/<project>/<space>/<item>/r<revision>/<artifact>"}),"."]}):null,c.jsx("textarea",{className:"revka-input min-h-[14rem] w-full resize-y font-mono text-xs leading-5",value:D,onChange:ae=>F(ae.target.value),spellCheck:!1})]}):null,["item","bundle","revision","artifact","edge","project","bundle-member-add"].includes(e)?c.jsxs("label",{className:"mt-3 block text-xs font-semibold uppercase tracking-[0.1em]",style:{color:"var(--revka-text-faint)"},children:["Metadata JSON or key: value lines",c.jsx("textarea",{className:"revka-input mt-1 min-h-[6rem] w-full resize-y font-mono text-xs leading-5",value:w,onChange:ae=>N(ae.target.value),spellCheck:!1})]}):null,de&&["bundle-member-add","bundle-member-remove"].includes(e)?c.jsxs("label",{className:"mt-3 flex items-center gap-2 rounded-[8px] border px-3 py-2 text-xs",style:{borderColor:"color-mix(in srgb, var(--revka-status-warning) 24%, transparent)",color:"var(--revka-status-warning)"},children:[c.jsx("input",{type:"checkbox",checked:te,onChange:ae=>X(ae.target.checked)}),"Confirm protected canon bundle mutation"]}):null,f?c.jsx("div",{className:"mt-3 text-sm",style:{color:"var(--revka-status-danger)"},children:f}):null,c.jsxs("div",{className:"mt-4 flex justify-end gap-2",children:[c.jsx("button",{type:"button",className:"revka-button",onClick:l,disabled:d,children:"Cancel"}),c.jsxs("button",{type:"button",className:"revka-button revka-button-primary",onClick:ue,disabled:d,children:[d?c.jsx(Rr,{className:"h-4 w-4 animate-spin"}):c.jsx(yE,{className:"h-4 w-4"}),"Apply"]})]})]})}function s3e({revision:e,onClose:n,onOpenKref:r}){const i=b.useRef(null),s=b.useRef([]),a=b.useRef(null),[o,l]=b.useState(null),[u,d]=b.useState(!1),[p,f]=b.useState(null),[g,_]=b.useState("both"),[x,v]=b.useState(2),[S,w]=b.useState(120),[N,C]=b.useState("all"),[T,A]=b.useState(null),[E,D]=b.useState(null),[F,B]=b.useState(null),[H,$]=b.useState(null),[z,W]=b.useState({width:720,height:460}),P=b.useCallback(()=>{d(!0),f(null),_Z({revision_kref:e.kref,direction:g,depth:x,edge_type:N==="all"?void 0:N,node_limit:S}).then(R=>{l(R),A(R.nodes.find(U=>U.kref===R.center_kref)??R.nodes[0]??null),D(null),B(null),$(null)}).catch(R=>f(R instanceof Error?R.message:"Failed to load dependency graph.")).finally(()=>d(!1))},[x,g,N,S,e.kref]);b.useEffect(()=>{P()},[P]),b.useEffect(()=>{const R=a.current;if(!R)return;const U=()=>W({width:Math.max(320,R.clientWidth),height:Math.max(360,R.clientHeight)});U();const V=new ResizeObserver(U);return V.observe(R),()=>V.disconnect()},[]);const q=b.useMemo(()=>{var J,me;if(!o)return{nodes:[],links:[]};const R=new Set(o.nodes.map(fe=>fe.kref)),U=o.edges.filter(fe=>R.has(fe.source_kref)&&R.has(fe.target_kref)).map(fe=>({source:fe.source_kref,target:fe.target_kref,edge:fe})),V=new Map,ie=new Map;for(const fe of o.nodes)V.set(fe.kref,[]),ie.set(fe.kref,0);for(const fe of U)(J=V.get(fe.edge.source_kref))==null||J.push(fe.edge.target_kref),(me=V.get(fe.edge.target_kref))==null||me.push(fe.edge.source_kref),ie.set(fe.edge.source_kref,(ie.get(fe.edge.source_kref)??0)+1),ie.set(fe.edge.target_kref,(ie.get(fe.edge.target_kref)??0)+1);const te=new Map([[o.center_kref,0]]),X=[o.center_kref];for(let fe=0;fe<X.length;fe+=1){const ve=X[fe],Ke=te.get(ve)??0;if(!(Ke>=o.depth))for(const ge of V.get(ve)??[])te.has(ge)||(te.set(ge,Ke+1),X.push(ge))}const se=new Map;for(const fe of o.nodes){const ve=te.get(fe.kref)??o.depth,Ke=se.get(ve)??[];Ke.push(fe.kref),se.set(ve,Ke)}const re=new Map;for(const fe of se.values())for(const[ve,Ke]of fe.entries())re.set(Ke,{index:ve,total:Math.max(1,fe.length)});const de=o.nodes.map(fe=>{const ve=te.get(fe.kref)??o.depth,Ke=ie.get(fe.kref)??0,ge=re.get(fe.kref),Ue=ge?ge.index/ge.total*Math.PI*2-Math.PI/2:0,$e=ve===0?0:160+ve*150;return{...fe,id:fe.kref,graphDepth:ve,graphDegree:Ke,val:ve===0?9:Math.min(8,3.5+Ke*.22),x:ve===0?0:Math.cos(Ue)*$e,y:ve===0?0:Math.sin(Ue)*$e}}),ue=new Map;for(const fe of U){const ve=HI(fe.edge);ue.set(ve,(ue.get(ve)??0)+1)}const ae=new Map,pe=U.map(fe=>{const ve=HI(fe.edge),Ke=ae.get(ve)??0;ae.set(ve,Ke+1);const ge=ue.get(ve)??1;return{...fe,curveOffset:ge>1?(Ke-(ge-1)/2)*18:0}});return{nodes:de,links:pe}},[o]),I=E?C2(E):null,Q=b.useMemo(()=>{if(!o)return[];const R=new Map;for(const U of o.edges)R.set(U.edge_type,(R.get(U.edge_type)??0)+1);return Array.from(R.entries()).sort((U,V)=>V[1]-U[1]).slice(0,6)},[o]),K=b.useMemo(()=>{if(!o)return[];const R=new Map;for(const U of o.nodes){const V=U.kind||"unknown";R.set(V,(R.get(V)??0)+1)}return Array.from(R.entries()).sort((U,V)=>V[1]-U[1]).slice(0,6)},[o]);b.useEffect(()=>{var V,ie,te,X,se,re,de,ue,ae,pe,J,me;const R=i.current;if(!R||q.nodes.length===0)return;(te=(ie=(V=R.d3Force)==null?void 0:V.call(R,"charge"))==null?void 0:ie.strength)==null||te.call(ie,-360),(re=(se=(X=R.d3Force)==null?void 0:X.call(R,"collide"))==null?void 0:se.radius)==null||re.call(se,fe=>fe.graphDepth===0?34:24),(J=(pe=(ae=(ue=(de=R.d3Force)==null?void 0:de.call(R,"link"))==null?void 0:ue.distance)==null?void 0:ae.call(ue,fe=>{const ve=typeof fe.source=="object"?fe.source:null,Ke=typeof fe.target=="object"?fe.target:null;return 120+Math.max((ve==null?void 0:ve.graphDepth)??1,(Ke==null?void 0:Ke.graphDepth)??1)*50}))==null?void 0:pe.strength)==null||J.call(pe,.35),(me=R.d3ReheatSimulation)==null||me.call(R);const U=window.setTimeout(()=>{var fe;return(fe=R.zoomToFit)==null?void 0:fe.call(R,450,96)},650);return()=>window.clearTimeout(U)},[q]);const Z=b.useCallback((R,U,V)=>{const ie=R.x??0,te=R.y??0,X=R.kref===e.kref,se=R.kref===(T==null?void 0:T.kref),re=R.kref===F,de=X?9:Math.max(5,Math.min(8,4+R.graphDegree*.12)),ue=Hc(R.kind??"");(X||se||re)&&(U.beginPath(),U.arc(ie,te,de+(X?10:7),0,2*Math.PI),U.fillStyle=X?"rgba(45,212,191,0.18)":`${ue.color}26`,U.fill(),U.beginPath(),U.arc(ie,te,de+(X?4:3),0,2*Math.PI),U.strokeStyle=X?"rgba(45,212,191,0.7)":`${ue.color}80`,U.lineWidth=X?1.8:1.2,U.stroke()),U.beginPath(),U.arc(ie,te,de,0,2*Math.PI),U.fillStyle=R.missing?"#f59e0b":ue.color,U.fill(),U.lineWidth=X||se?2:1,U.strokeStyle=X?"#ffffff":se?ue.color:"rgba(255,255,255,0.38)",U.stroke();const ae=X||se||re;if(!(ae||V>1.16||V>.82&&R.graphDepth<=1&&R.graphDegree>=2))return;const J=X5e(K_(R),X||se||re?34:24),me=Math.max(9,Math.min(12,11/V));U.font=`${X||se?"700":"600"} ${me}px Inter, system-ui, sans-serif`;const ve=U.measureText(J).width+14,Ke=me+8,ge=ie+de+8,Ue=te-Ke/2,$e={x1:ge-4,y1:Ue-3,x2:ge+ve+4,y2:Ue+Ke+3};!ae&&Q5e($e,s.current)||(s.current.push($e),WI(U,ge,Ue,ve,Ke,7),U.fillStyle=X||se?"rgba(4, 17, 18, 0.92)":"rgba(7, 16, 18, 0.82)",U.fill(),U.strokeStyle=X||se?`${ue.color}88`:"rgba(148,163,184,0.22)",U.lineWidth=1,U.stroke(),U.fillStyle="rgba(235, 245, 245, 0.94)",U.textAlign="left",U.textBaseline="middle",U.fillText(J,ge+7,te))},[F,e.kref,T==null?void 0:T.kref]),Y=b.useCallback((R,U,V)=>{const ie=R.source,te=R.target;if(ie.x==null||ie.y==null||te.x==null||te.y==null)return;const X=C2(R.edge),se=X===I||X===H,re=Uu(R.edge.edge_type),de=te.x-ie.x,ue=te.y-ie.y,ae=Math.max(1,Math.hypot(de,ue)),pe=-ue/ae,J=de/ae,me=(ie.x+te.x)/2+pe*R.curveOffset,fe=(ie.y+te.y)/2+J*R.curveOffset;se&&(U.beginPath(),U.moveTo(ie.x,ie.y),U.quadraticCurveTo(me,fe,te.x,te.y),U.strokeStyle=re.glow,U.lineWidth=7,U.stroke()),U.beginPath(),U.moveTo(ie.x,ie.y),U.quadraticCurveTo(me,fe,te.x,te.y),U.strokeStyle=re.color,U.globalAlpha=se?.92:.5,U.lineWidth=se?2.3:1.2,U.stroke(),U.globalAlpha=1;const ve=.82,Ke=(1-ve)**2*ie.x+2*(1-ve)*ve*me+ve**2*te.x,ge=(1-ve)**2*ie.y+2*(1-ve)*ve*fe+ve**2*te.y,Ue=2*(1-ve)*(me-ie.x)+2*ve*(te.x-me),$e=2*(1-ve)*(fe-ie.y)+2*ve*(te.y-fe),Bt=Math.atan2($e,Ue),ct=se?6:4.5;if(U.beginPath(),U.moveTo(Ke,ge),U.lineTo(Ke-ct*Math.cos(Bt-.55),ge-ct*Math.sin(Bt-.55)),U.lineTo(Ke-ct*Math.cos(Bt+.55),ge-ct*Math.sin(Bt+.55)),U.closePath(),U.fillStyle=re.color,U.globalAlpha=se?1:.62,U.fill(),U.globalAlpha=1,!(se||V>1.55&&q.links.length<=30))return;const Tt=re.label||R.edge.edge_type.toLowerCase(),Dt=Math.max(8,Math.min(10,9/V));U.font=`700 ${Dt}px Inter, system-ui, sans-serif`;const Re=U.measureText(Tt).width+12,et=Dt+7,bt=me-Re/2,yt=fe-et/2;WI(U,bt,yt,Re,et,6),U.fillStyle="rgba(5, 14, 16, 0.88)",U.fill(),U.strokeStyle=`${re.color}88`,U.lineWidth=1,U.stroke(),U.fillStyle="rgba(235, 245, 245, 0.9)",U.textAlign="center",U.textBaseline="middle",U.fillText(Tt,me,fe+.5)},[q.links.length,H,I]);return c.jsxs(yu,{title:"Dependency Graph",description:"A local revision-centered graph for dependency, provenance, and impact analysis.",onClose:n,size:"2xl",children:[c.jsxs("div",{className:"mb-3 flex flex-wrap items-center gap-2",children:[c.jsxs("select",{className:"revka-input h-9 py-0 text-xs",value:g,onChange:R=>_(R.target.value),children:[c.jsx("option",{value:"outgoing",children:"Dependencies"}),c.jsx("option",{value:"incoming",children:"Dependents"}),c.jsx("option",{value:"both",children:"Both"})]}),c.jsx("div",{className:"inline-flex h-9 overflow-hidden rounded-[8px] border",style:{borderColor:"var(--revka-border-soft)"},children:w2.map(R=>c.jsxs("button",{type:"button",className:"px-3 text-xs font-semibold transition",style:{color:x===R?"var(--revka-text-primary)":"var(--revka-text-muted)",background:x===R?"color-mix(in srgb, var(--revka-signal-selected) 18%, transparent)":"transparent",borderRight:R===w2[w2.length-1]?"none":"1px solid var(--revka-border-soft)"},onClick:()=>v(R),children:["Depth ",R]},R))}),c.jsx("select",{className:"revka-input h-9 py-0 text-xs",value:S,onChange:R=>w(Number(R.target.value)),children:q5e.map(R=>c.jsxs("option",{value:R,children:["Nodes ",R]},R))}),c.jsxs("select",{className:"revka-input h-9 py-0 text-xs",value:N,onChange:R=>C(R.target.value),children:[c.jsx("option",{value:"all",children:"All edge types"}),IV.map(R=>c.jsx("option",{value:R,children:R},R))]}),c.jsxs("button",{type:"button",className:"revka-button h-9 px-3 text-xs",onClick:P,disabled:u,children:[u?c.jsx(Rr,{className:"h-3.5 w-3.5 animate-spin"}):c.jsx(PB,{className:"h-3.5 w-3.5"}),"Reload graph"]}),c.jsxs("button",{type:"button",className:"revka-button h-9 px-3 text-xs",onClick:()=>Ja(e.kref),children:[c.jsx(Xl,{className:"h-3.5 w-3.5"}),"Copy center kref"]})]}),c.jsxs("div",{className:"grid min-h-[32rem] gap-4 lg:grid-cols-[minmax(0,1fr)_24rem]",children:[c.jsxs("div",{ref:a,className:"relative min-h-[30rem] overflow-hidden rounded-[12px] border",style:{borderColor:"var(--revka-border-soft)",background:"color-mix(in srgb, var(--revka-bg-panel-strong) 94%, transparent)"},children:[u?c.jsx("div",{className:"absolute inset-0 z-10 flex items-center justify-center",children:c.jsx(Ct,{tone:"loading",title:"Loading graph..."})}):null,p?c.jsx("div",{className:"absolute inset-0 z-10 flex items-center justify-center p-6",children:c.jsx(Ct,{tone:"error",title:"Graph failed",description:p})}):null,!u&&!p&&q.nodes.length>0?c.jsx(ak,{ref:i,graphData:q,width:z.width,height:z.height,backgroundColor:"transparent",nodeRelSize:4,nodeVal:R=>R.val,nodeLabel:R=>`${[K_(R),R.kind,`r${R.revision_number??"?"}`].filter(Boolean).join(" · ")}
${R.kref}`,nodeCanvasObject:Z,nodePointerAreaPaint:(R,U,V)=>{const ie=R.x??0,te=R.y??0;V.beginPath(),V.arc(ie,te,18,0,2*Math.PI),V.fillStyle=U,V.fill()},linkLabel:R=>`${R.edge.edge_type}
${R.edge.source_kref}
-> ${R.edge.target_kref}`,linkCanvasObject:Y,linkCanvasObjectMode:()=>"replace",onRenderFramePre:()=>{s.current=[]},onNodeClick:R=>{A(R),D(null)},onLinkClick:R=>{D(R.edge)},onNodeHover:R=>B((R==null?void 0:R.kref)??null),onLinkHover:R=>$(R?C2(R.edge):null),cooldownTicks:160,d3AlphaDecay:.018,d3VelocityDecay:.28,warmupTicks:40}):null,!u&&!p&&o?c.jsxs("div",{className:"pointer-events-none absolute left-3 top-3 z-10 flex flex-wrap items-center gap-2 rounded-[10px] border px-3 py-2 text-[11px] font-medium",style:{borderColor:"var(--revka-border-soft)",background:"color-mix(in srgb, var(--revka-bg-panel-strong) 92%, transparent)",color:"var(--revka-text-secondary)"},children:[c.jsxs("span",{children:[c.jsx("strong",{style:{color:"var(--revka-text-primary)"},children:o.nodes.length})," nodes"]}),c.jsxs("span",{children:[c.jsx("strong",{style:{color:"var(--revka-text-primary)"},children:o.edges.length})," edges"]}),c.jsxs("span",{children:["depth ",o.depth]})]}):null,!u&&!p&&(o!=null&&o.truncated)?c.jsxs("div",{className:"pointer-events-none absolute right-3 top-3 z-10 rounded-[10px] border px-3 py-2 text-[11px] font-semibold",style:{borderColor:"color-mix(in srgb, var(--revka-status-warning) 35%, transparent)",background:"rgba(67, 52, 18, 0.72)",color:"var(--revka-status-warning)"},children:["Truncated at ",o.node_limit]}):null,!u&&!p&&(K.length>0||Q.length>0)?c.jsxs("div",{className:"pointer-events-none absolute bottom-3 left-3 z-10 flex max-w-[78%] flex-col gap-2 rounded-[10px] border px-3 py-2",style:{borderColor:"var(--revka-border-soft)",background:"color-mix(in srgb, var(--revka-bg-panel-strong) 92%, transparent)"},children:[K.length>0?c.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[c.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-[0.08em]",style:{color:"var(--revka-text-faint)"},children:"Nodes"}),K.map(([R,U])=>{const V=Hc(R);return c.jsxs("span",{className:"inline-flex items-center gap-1.5 text-[10px] font-semibold uppercase",style:{color:"var(--revka-text-secondary)"},children:[c.jsx("span",{className:"h-2.5 w-2.5 rounded-full",style:{background:V.color,boxShadow:`0 0 10px ${V.color}`}}),R," ",U]},R)})]}):null,Q.length>0?c.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[c.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-[0.08em]",style:{color:"var(--revka-text-faint)"},children:"Edges"}),Q.map(([R,U])=>{const V=Uu(R);return c.jsxs("span",{className:"inline-flex items-center gap-1.5 text-[10px] font-semibold uppercase",style:{color:"var(--revka-text-secondary)"},children:[c.jsx("span",{className:"h-0.5 w-5 rounded-full",style:{background:V.color,boxShadow:`0 0 10px ${V.color}`}}),R," ",U]},R)})]}):null]}):null]}),c.jsx("div",{className:"min-h-0 overflow-y-auto rounded-[12px] border p-4",style:{borderColor:"var(--revka-border-soft)",background:"linear-gradient(180deg, rgba(255,255,255,0.035), rgba(255,255,255,0.015))"},children:E?c.jsxs("div",{className:"space-y-4",children:[c.jsx("div",{className:"rounded-[10px] border p-3",style:{borderColor:`${Uu(E.edge_type).color}55`,background:Uu(E.edge_type).glow},children:c.jsxs("div",{className:"flex items-center justify-between gap-2",children:[c.jsxs("div",{children:[c.jsx("div",{className:"text-xs font-semibold uppercase tracking-[0.12em]",style:{color:"var(--revka-text-faint)"},children:"Relationship"}),c.jsx("div",{className:"mt-2 text-lg font-semibold",style:{color:"var(--revka-text-primary)"},children:Uu(E.edge_type).label})]}),c.jsx(qa,{label:E.edge_type,tone:Uu(E.edge_type).color})]})}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(j2,{label:"Source",kref:E.source_kref}),c.jsx("div",{className:"flex justify-center",children:c.jsx("div",{className:"rounded-full border p-1.5",style:{borderColor:"var(--revka-border-soft)",color:Uu(E.edge_type).color},children:c.jsx(sf,{className:"h-4 w-4"})})}),c.jsx(j2,{label:"Target",kref:E.target_kref})]}),c.jsx(VI,{metadata:E.metadata,maxVisible:6})]}):T?c.jsxs("div",{className:"space-y-4",children:[c.jsx("div",{className:"rounded-[10px] border p-3",style:{borderColor:`${Hc(T.kind??"").color}55`,background:Hc(T.kind??"").bg},children:c.jsxs("div",{className:"flex items-start justify-between gap-3",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsx("div",{className:"text-xs font-semibold uppercase tracking-[0.12em]",style:{color:"var(--revka-text-faint)"},children:"Revision Node"}),c.jsx("div",{className:"mt-2 truncate text-lg font-semibold",style:{color:"var(--revka-text-primary)"},title:K_(T),children:K_(T)}),c.jsxs("div",{className:"mt-2 flex flex-wrap gap-1.5",children:[T.kind?c.jsx(qa,{label:T.kind,tone:Hc(T.kind).color}):null,T.revision_number?c.jsx(qa,{label:`r${T.revision_number}`,tone:"var(--revka-text-faint)"}):null,T.tags.slice(0,3).map(R=>c.jsx(qa,{label:R,tone:"var(--revka-text-faint)"},R)),T.tags.length>3?c.jsx(qa,{label:`+${T.tags.length-3}`,tone:"var(--revka-text-faint)"}):null]})]}),c.jsxs("button",{type:"button",className:"revka-button h-8 px-2 text-xs",onClick:()=>r(T.kref),children:[c.jsx(sf,{className:"h-3.5 w-3.5"}),"Open"]})]})}),c.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[c.jsx(Y_,{label:"Artifacts",value:T.artifacts.length,tone:Hc(T.kind??"").color}),c.jsx(Y_,{label:"Revision",value:T.revision_number?`r${T.revision_number}`:"--"}),c.jsx(Y_,{label:"Incoming",value:T.incoming_edges.length}),c.jsx(Y_,{label:"Outgoing",value:T.outgoing_edges.length})]}),c.jsx(j2,{label:"Revision kref",kref:T.kref}),c.jsxs("section",{className:"space-y-2",children:[c.jsx("div",{className:"text-xs font-semibold uppercase tracking-[0.12em]",style:{color:"var(--revka-text-faint)"},children:"Artifacts"}),c.jsx(n3e,{artifacts:T.artifacts})]}),c.jsx(VI,{metadata:T.metadata})]}):c.jsx(Ct,{compact:!0,title:"Select a node",description:"Click a node or edge to inspect its Kumiho details."})})]})]})}function a3e(){var co;const{t:e,tpl:n}=cn(),[r,i]=Jg(),s=V_(r.get("kref")),a=r.get("project")??(s==null?void 0:s.project)??null,o=r.get("space")??(s==null?void 0:s.spacePath)??(a?`/${a}`:null),[l,u]=b.useState([]),[d,p]=b.useState(a),[f,g]=b.useState(!1),[_,x]=b.useState(()=>Dh(o)),[v,S]=b.useState([]),[w,N]=b.useState([]),[C,T]=b.useState(null),[A,E]=b.useState(r.get("item")??(s==null?void 0:s.itemKref)??null),[D,F]=b.useState([]),[B,H]=b.useState(null),[$,z]=b.useState(r.get("revision")??(s==null?void 0:s.revisionKref)??null),[W,P]=b.useState([]),[q,I]=b.useState(null),[Q,K]=b.useState(null),[Z,Y]=b.useState([]),[R,U]=b.useState(r.get("q")??""),[V,ie]=b.useState([]),[te,X]=b.useState(!1),[se,re]=b.useState(r.get("tab")==="bundles"?"bundles":"items"),[de,ue]=b.useState(r.get("sort")??"name"),[ae,pe]=b.useState(Number(r.get("page")??"1")||1),[J,me]=b.useState([]),[fe,ve]=b.useState(r.get("bundle")),[Ke,ge]=b.useState([]),[Ue,$e]=b.useState(!1),[Bt,ct]=b.useState(!1),[Mt,Tt]=b.useState(0),[Dt,Re]=b.useState(!1),[et,bt]=b.useState(!0),[yt,O]=b.useState(!1),[ke,Le]=b.useState(!1),[ye,_e]=b.useState(!1),[Pe,ee]=b.useState(null),[le,je]=b.useState(null),[Te,Me]=b.useState(null),[Ne,Ee]=b.useState(null),[rt,Ye]=b.useState(""),[it,kt]=b.useState(!1),[mt,zt]=b.useState(!1),[xe,qe]=b.useState(null),[dt,sn]=b.useState(!1),[nn,Kt]=b.useState(()=>{try{return JSON.parse(sessionStorage.getItem("revka.assetBrowser.expanded")??"[]")}catch{return[]}}),rr=b.useRef(null),yi=b.useRef(null),un=b.useRef(null),Yt=((co=_[_.length-1])==null?void 0:co.path)??null;b.useEffect(()=>{function ce(Be){yi.current&&!yi.current.contains(Be.target)&&g(!1),un.current&&!un.current.contains(Be.target)&&zt(!1)}return document.addEventListener("mousedown",ce),()=>document.removeEventListener("mousedown",ce)},[]),b.useEffect(()=>{bt(!0),Eo("/projects").then(ce=>{const Be=ce.map(xt=>xt.name);u(ce),p(xt=>xt&&Be.includes(xt)?xt:a&&Be.includes(a)?a:Be[0]??null),ee(null)}).catch(ce=>{console.error("[Assets] Failed to load projects:",ce),ee(e("assets.err.load"))}).finally(()=>bt(!1))},[a,Mt,e]),b.useEffect(()=>()=>{rr.current&&clearTimeout(rr.current)},[]),b.useEffect(()=>{const ce=V_(r.get("kref")),Be=r.get("project")??(ce==null?void 0:ce.project)??d,xt=r.get("space")??(ce==null?void 0:ce.spacePath),Ft=r.get("item")??(ce==null?void 0:ce.itemKref)??null,Yn=r.get("revision")??(ce==null?void 0:ce.revisionKref)??null;Be&&Be!==d&&p(Be),xt&&xt!==Yt&&x(Dh(xt)),Ft&&Ft!==A&&E(Ft),Yn&&Yn!==$&&z(Yn);const Oi=r.get("bundle");Oi!==fe&&ve(Oi);const Di=r.get("tab")==="bundles"?"bundles":"items";Di!==se&&re(Di)},[r]),b.useEffect(()=>{sessionStorage.setItem("revka.assetBrowser.expanded",JSON.stringify(nn))},[nn]),b.useEffect(()=>{var ce;d&&(_.length===0||((ce=_[0])==null?void 0:ce.name)!==d)&&x(Dh(`/${d}`))},[_,d]);const L=b.useCallback((ce,Be)=>{je({tone:ce,message:Be}),setTimeout(()=>{je(xt=>(xt==null?void 0:xt.message)===Be?null:xt)},4500)},[]);b.useEffect(()=>{i(ce=>{const Be=new URLSearchParams(ce);return Be.delete("kref"),d?Be.set("project",d):Be.delete("project"),Yt?Be.set("space",Yt):Be.delete("space"),C!=null&&C.kref?Be.set("item",C.kref):Be.delete("item"),B!=null&&B.kref?Be.set("revision",B.kref):Be.delete("revision"),se!=="items"?Be.set("tab",se):Be.delete("tab"),R.trim()?Be.set("q",R):Be.delete("q"),fe?Be.set("bundle",fe):Be.delete("bundle"),de!=="name"?Be.set("sort",de):Be.delete("sort"),ae>1?Be.set("page",String(ae)):Be.delete("page"),Be},{replace:!0})},[se,Yt,ae,de,R,fe,C==null?void 0:C.kref,d,B==null?void 0:B.kref,i]);const Qe=b.useCallback(async(ce,Be)=>{_e(!0);try{const[xt,Ft]=await Promise.all([Eo("/artifacts",{revision_kref:ce.kref}).catch(()=>[]),Eo("/edges",{kref:ce.kref,direction:"both"}).catch(()=>[])]);P(xt),I(xt.find(Yn=>Yn.kref===Be)??xt[0]??null),Y(Ft)}finally{_e(!1)}},[]);b.useEffect(()=>{Yt&&(O(!0),Promise.all([Eo("/spaces",{parent_path:Yt,recursive:!1}).catch(()=>[]),Eo("/items",{space_path:Yt}).catch(()=>[])]).then(([ce,Be])=>{S(ce),N(Be);const xt=A?Be.find(Ft=>Ft.kref===A):null;xt?T(xt):!A&&C&&!Be.some(Ft=>Ft.kref===C.kref)&&(T(null),F([]),H(null),P([]),I(null),Y([]))}).catch(()=>{S([]),N([]),L("error","Failed to reload the current Asset Browser view.")}).finally(()=>O(!1)))},[Yt,Mt,A,C==null?void 0:C.kref,L]),b.useEffect(()=>{if(!C){F([]),H(null),P([]),I(null),Y([]);return}Le(!0),H(null),P([]),I(null),Y([]),Eo("/revisions",{item_kref:C.kref}).then(async ce=>{let Be=[...ce].sort((Ft,Yn)=>Yn.number-Ft.number),xt=$?Be.find(Ft=>Ft.kref===$):null;if(!xt&&$)try{const Ft=await Eo("/revisions/by-kref",{kref:$});Ft.item_kref===C.kref&&(Be=[Ft,...Be.filter(Yn=>Yn.kref!==Ft.kref)].sort((Yn,Oi)=>Oi.number-Yn.number),xt=Ft)}catch{}F(Be),H(xt??Be[0]??null)}).catch(()=>F([])).finally(()=>Le(!1))},[Mt,$,C==null?void 0:C.kref]),b.useEffect(()=>{if(!B){P([]),I(null),Y([]);return}I(null),Qe(B).catch(()=>{P([]),I(null),Y([]),_e(!1)})},[Qe,Mt,B==null?void 0:B.kref]),b.useEffect(()=>{if(rr.current&&clearTimeout(rr.current),!R.trim()){ie([]),X(!1);return}X(!0),rr.current=setTimeout(async()=>{try{const ce=await Eo("/items/fulltext-search",{query:R,context:d??void 0,include_revision_metadata:!0});ie(ce)}catch(ce){console.error("[Assets] Search failed:",ce),ie([])}finally{X(!1)}},250)},[Mt,R,d]),b.useEffect(()=>{if(!d){me([]),ve(null),ge([]);return}$e(!0),hZ(d,Yt??`/${d}`).then(ce=>{me(ce),ve(Be=>Be&&ce.some(xt=>xt.kref===Be)?Be:null)}).catch(ce=>{console.error("[Assets] Failed to load bundles:",ce),me([]),ve(null)}).finally(()=>$e(!1))},[Yt,Mt,d]),b.useEffect(()=>{if(!fe){ge([]);return}ct(!0),fZ(fe).then(ce=>ge(ce.members)).catch(ce=>{console.error("[Assets] Failed to load bundle members:",ce),ge([])}).finally(()=>ct(!1))},[Mt,fe]);const _t=b.useCallback(ce=>{Kt(Be=>Be.includes(Yt??"")?Be:[...Be,Yt??""].filter(Boolean)),x(Be=>[...Be,{name:ce.name,path:ce.path}]),E(null),z(null),T(null),H(null),U(""),ie([]),X(!1),ve(null),ge([])},[Yt]),Gt=b.useCallback(ce=>{x(Be=>Be.slice(0,ce+1)),E(null),z(null),T(null),H(null),U(""),ie([]),X(!1),ve(null),ge([])},[]),jr=b.useCallback(ce=>{U(ce),pe(1)},[]),Qr=b.useCallback(ce=>{if(ce===d){g(!1);return}rr.current&&clearTimeout(rr.current),g(!1),p(ce),x(Dh(`/${ce}`)),E(null),z(null),T(null),H(null),P([]),I(null),Y([]),U(""),ie([]),ve(null),re("items")},[d]),oo=b.useCallback(()=>{x(ce=>ce.length<=1?ce:ce.slice(0,-1)),E(null),z(null),T(null),H(null),U(""),ie([]),X(!1),ve(null),ge([])},[]),cs=b.useCallback(ce=>{const Be=V_(ce.kref);Be&&(p(Be.project),x(Dh(Be.spacePath))),T(ce),E(ce.kref),z(null),re("items")},[]),rl=b.useCallback(ce=>{H(ce),z(ce.kref)},[]),us=b.useCallback(async ce=>{const Be=V_(ce);if(!Be){L("error","Invalid kref.");return}p(Be.project),x(Dh(Be.spacePath)),E(Be.itemKref),z(Be.revisionKref),re("items")},[L]),Ri=b.useCallback(()=>{Re(!0),Tt(ce=>ce+1),window.setTimeout(()=>Re(!1),700)},[]),Ki=b.useCallback(ce=>{N(Be=>Be.map(xt=>xt.kref===ce.kref?ce:xt)),ie(Be=>Be.map(xt=>xt.item.kref===ce.kref?{...xt,item:ce}:xt)),T(Be=>(Be==null?void 0:Be.kref)===ce.kref?ce:Be)},[]),Fr=b.useCallback((ce,Be=!1)=>{const xt={...ce,published:qu(ce),tags:qu(ce)&&!ce.tags.includes("published")?[...ce.tags,"published"]:ce.tags};F(Ft=>Ft.map(Yn=>Yn.kref===xt.kref?xt:Be?{...Yn,published:!1,tags:Yn.tags.filter(Oi=>Oi!=="published")}:Yn)),H(Ft=>(Ft==null?void 0:Ft.kref)===xt.kref?xt:Ft)},[]),Kn=b.useCallback(ce=>{P(Be=>Be.map(xt=>xt.kref===ce.kref?ce:xt)),I(Be=>(Be==null?void 0:Be.kref)===ce.kref?ce:Be)},[]),il=b.useCallback(async()=>{if(!C)return;const ce=!C.deprecated;Me("item-deprecate");try{const Be=await xZ(C.kref,ce);Ki(Be),L("success",e(ce?"assets.toast.item_deprecated":"assets.toast.item_restored"))}catch(Be){L("error",Be instanceof Error?Be.message:e("assets.err.action"))}finally{Me(null)}},[Ki,C,L,e]),tc=b.useCallback(async()=>{if(!B)return;const ce=!B.deprecated;Me("revision-deprecate");try{const Be=await bZ(B.kref,ce);Fr(Be),L("success",e(ce?"assets.toast.revision_deprecated":"assets.toast.revision_restored"))}catch(Be){L("error",Be instanceof Error?Be.message:e("assets.err.action"))}finally{Me(null)}},[Fr,B,L,e]),Rs=b.useCallback(async()=>{if(B){Me("revision-publish");try{const ce=await kZ(B.kref);Fr(ce,!0),L("success",e("assets.toast.revision_published"))}catch(ce){L("error",ce instanceof Error?ce.message:e("assets.err.action"))}finally{Me(null)}}},[Fr,B,L,e]),ra=b.useCallback(async ce=>{const Be=!ce.deprecated;Me(`artifact-deprecate:${ce.kref}`);try{const xt=await wZ(ce.kref,Be);Kn(xt),L("success",e(Be?"assets.toast.artifact_deprecated":"assets.toast.artifact_restored"))}catch(xt){L("error",xt instanceof Error?xt.message:e("assets.err.action"))}finally{Me(null)}},[Kn,L,e]),_u=b.useCallback(async ce=>{Ee(ce),Ye(""),kt(!0);try{const Be=await CZ(ce.location);Ye(Be)}catch(Be){L("error",Be instanceof Error?Be.message:e("assets.err.load_artifact")),Ee(null)}finally{kt(!1)}},[L,e]),sl=b.useCallback(async()=>{if(!(!Ne||!B)){Me("artifact-save");try{const ce=await SZ(Ne.kref,B.kref,rt);if(ce.created_revision){const Be={...ce.revision,latest:!0,published:qu(ce.revision)};F(xt=>[Be,...xt.filter(Ft=>Ft.kref!==Be.kref).map(Ft=>({...Ft,latest:!1,tags:Ft.tags.filter(Yn=>Yn!=="latest")}))].sort((Ft,Yn)=>Yn.number-Ft.number)),H(Be),await Qe(Be,ce.artifact.kref),L("success",e("assets.toast.artifact_saved_new_revision"))}else await Qe(B,Ne.kref),L("success",e("assets.toast.artifact_saved"));Ee(null)}catch(ce){L("error",ce instanceof Error?ce.message:e("assets.err.action"))}finally{Me(null)}}},[rt,Ne,Qe,B,L,e]),Os=R.trim().length>0,al=b.useMemo(()=>[...Os?V.map(Be=>Be.item):w].sort((Be,xt)=>de==="kind"?Be.kind.localeCompare(xt.kind)||tf(Be).localeCompare(tf(xt)):de==="created"?String(xt.created_at??"").localeCompare(String(Be.created_at??"")):tf(Be).localeCompare(tf(xt))),[Os,de,w,V]),hr=75,Ds=Math.max(1,Math.ceil(al.length/hr)),Zr=Math.min(Math.max(1,ae),Ds),ai=al.slice((Zr-1)*hr,Zr*hr),lo=J.find(ce=>ce.kref===fe)??null,xu=lo?TT(Hf(lo.kref)):!1,_i=Object.entries((q==null?void 0:q.metadata)??(B==null?void 0:B.metadata)??(C==null?void 0:C.metadata)??{});return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"flex h-[calc(100vh-6rem)] flex-col gap-3",children:[c.jsxs("div",{className:"flex items-start justify-between gap-4",children:[c.jsx(si,{kicker:e("assets.kicker"),title:e("assets.title")}),c.jsxs("div",{className:"relative min-w-[14rem] max-w-[22rem] flex-1",children:[c.jsx(Aa,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2",style:{color:"var(--revka-text-faint)"}}),c.jsx("input",{type:"text",value:R,onChange:ce=>jr(ce.target.value),placeholder:e("assets.search_placeholder"),className:"revka-input pl-10 pr-10"}),te?c.jsx("div",{className:"absolute right-3 top-1/2 h-4 w-4 -translate-y-1/2 animate-spin rounded-full border-2",style:{borderColor:"var(--revka-border-soft)",borderTopColor:"var(--revka-signal-network)"}}):null]})]}),c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsxs("div",{className:"relative",ref:yi,children:[c.jsxs("button",{type:"button",className:"revka-button justify-between gap-2",onClick:()=>g(ce=>!ce),children:[c.jsx(t0,{className:"h-4 w-4"}),c.jsx("span",{className:"truncate",children:d??e("assets.project")}),c.jsx(qo,{className:"h-3.5 w-3.5"})]}),f?c.jsx("div",{className:"absolute left-0 top-full z-20 mt-2 min-w-[14rem] rounded-[14px] border p-2",style:{borderColor:"var(--revka-border-soft)",background:"var(--revka-bg-panel-strong)"},children:l.map(ce=>c.jsx("button",{type:"button",className:"w-full rounded-[10px] px-3 py-2 text-left text-sm transition",onClick:()=>Qr(ce.name),style:{color:ce.name===d?"var(--revka-text-primary)":"var(--revka-text-secondary)",background:ce.name===d?"var(--revka-signal-selected-soft, color-mix(in srgb, var(--revka-signal-selected) 18%, transparent))":"transparent"},children:ce.name},ce.name))}):null]}),c.jsx("div",{className:"flex min-w-0 flex-1 items-center gap-1 text-sm",children:_.map((ce,Be)=>c.jsxs("span",{className:"inline-flex items-center gap-1",children:[Be>0&&c.jsx(ru,{className:"h-3.5 w-3.5 shrink-0",style:{color:"var(--revka-text-faint)"}}),c.jsx("button",{type:"button",onClick:()=>Gt(Be),className:"rounded px-1.5 py-0.5 hover:underline",style:{color:Be===_.length-1?"var(--revka-text-primary)":"var(--revka-text-secondary)"},children:ce.name})]},ce.path))}),c.jsxs("button",{type:"button",className:"revka-button",onClick:Ri,disabled:Dt,title:"Reload current Asset Browser view",children:[Dt?c.jsx(Rr,{className:"h-4 w-4 animate-spin"}):c.jsx(PB,{className:"h-4 w-4"}),"Reload"]}),c.jsxs("div",{className:"relative",ref:un,children:[c.jsxs("button",{type:"button",className:"revka-button revka-button-primary",onClick:()=>zt(ce=>!ce),children:[c.jsx(rs,{className:"h-4 w-4"}),"Create",c.jsx(qo,{className:"h-3.5 w-3.5"})]}),mt?c.jsx("div",{className:"absolute right-0 top-full z-20 mt-2 w-72 rounded-[14px] border p-2",style:{borderColor:"var(--revka-border-soft)",background:"var(--revka-bg-panel-strong)"},children:[["project","Create Project"],["space","Create Space"],["subspace","Create Subspace"],["item","Create Item in this Space"],["bundle","Create Bundle"],["revision","Create Revision"],["artifact","Attach or Link Artifact"],["edge","Create Edge from Revision"],["tag","Tag Revision"],["bundle-member-add","Add Item to Bundle"],["bundle-member-remove","Remove Bundle Member"],["context-pack","Create Context Pack from Bundle"]].map(([ce,Be])=>c.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 rounded-[10px] px-3 py-2 text-left text-sm transition hover:brightness-125",onClick:()=>{qe(ce),zt(!1)},style:{color:"var(--revka-text-secondary)"},children:[c.jsx(rs,{className:"h-3.5 w-3.5"}),Be]},ce))}):null]}),c.jsxs("button",{type:"button",className:"revka-button",onClick:oo,disabled:_.length<=1,children:[c.jsx(F3,{className:"h-4 w-4"}),e("assets.up")]})]}),Pe?c.jsxs("div",{className:"flex items-center gap-2 text-sm",style:{color:"var(--revka-status-danger)"},children:[c.jsx(Cs,{className:"h-4 w-4 shrink-0"}),Pe]}):null,le?c.jsxs("div",{className:"flex items-center gap-2 rounded-[8px] border px-3 py-2 text-sm",style:{borderColor:le.tone==="success"?"color-mix(in srgb, var(--revka-status-success) 24%, transparent)":"color-mix(in srgb, var(--revka-status-danger) 24%, transparent)",color:le.tone==="success"?"var(--revka-status-success)":"var(--revka-status-danger)",background:le.tone==="success"?"color-mix(in srgb, var(--revka-status-success) 8%, transparent)":"color-mix(in srgb, var(--revka-status-danger) 8%, transparent)"},children:[le.tone==="success"?c.jsx(Za,{className:"h-4 w-4 shrink-0"}):c.jsx(Cs,{className:"h-4 w-4 shrink-0"}),le.message]}):null,c.jsxs("div",{className:"grid min-h-0 flex-1 gap-4",style:{gridTemplateColumns:C?"minmax(0,1fr) 32rem":"1fr"},children:[c.jsxs(st,{className:"flex flex-col overflow-hidden p-0",children:[c.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3 border-b px-4 py-3",style:{borderColor:"var(--revka-border-soft)"},children:[c.jsx("div",{className:"inline-flex rounded-[8px] border p-0.5",style:{borderColor:"var(--revka-border-soft)",background:"var(--revka-bg-elevated)"},children:["items","bundles"].map(ce=>c.jsx("button",{type:"button",className:"rounded-[6px] px-3 py-1.5 text-xs font-semibold uppercase tracking-[0.08em]",onClick:()=>re(ce),style:{background:se===ce?"var(--revka-signal-selected-soft, color-mix(in srgb, var(--revka-signal-selected) 18%, transparent))":"transparent",color:se===ce?"var(--revka-text-primary)":"var(--revka-text-faint)"},children:ce==="items"?"Items":"Bundles"},ce))}),se==="items"?c.jsxs("div",{className:"flex items-center gap-2 text-xs",style:{color:"var(--revka-text-faint)"},children:[c.jsx("span",{children:"Sort"}),c.jsxs("select",{className:"revka-input h-8 py-0 text-xs",value:de,onChange:ce=>ue(ce.target.value),children:[c.jsx("option",{value:"name",children:"Name"}),c.jsx("option",{value:"kind",children:"Kind"}),c.jsx("option",{value:"created",children:"Created"})]})]}):c.jsxs("div",{className:"text-xs",style:{color:"var(--revka-text-faint)"},children:[J.length," bundles in space"]})]}),se==="items"?c.jsxs("div",{className:"revka-assets-row shrink-0 border-b px-4 py-2.5",style:{borderColor:"var(--revka-border-soft)",color:"var(--revka-text-faint)"},children:[c.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-[0.14em]",children:e("assets.col.name")}),c.jsx("span",{className:"revka-assets-kind hidden text-[11px] font-semibold uppercase tracking-[0.14em] md:inline",children:e("assets.col.kind")}),c.jsx("span",{className:"revka-assets-author hidden text-[11px] font-semibold uppercase tracking-[0.14em] md:inline",children:e("assets.col.author")}),c.jsx("span",{className:"revka-assets-created hidden text-right text-[11px] font-semibold uppercase tracking-[0.14em] md:inline",children:e("assets.col.created")})]}):null,c.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:se==="bundles"?c.jsx(r3e,{bundles:J,members:Ke,childSpaces:v,currentSpacePath:Yt,selectedBundleKref:fe,selectedBundleProtected:xu,loadingBundles:Ue,loadingMembers:Bt,onNavigateSpace:_t,onSelectBundle:ce=>ve(ce.kref),onOpenMember:ce=>{ce.item&&us(ce.item.kref)},onCopyKref:ce=>Ja(ce)}):et||yt?c.jsx("div",{className:"p-4",children:c.jsx(Ct,{tone:"loading",compact:!0,title:e(et?"assets.loading.projects":"assets.loading.space")})}):c.jsxs(c.Fragment,{children:[!Os&&v.map(ce=>c.jsxs("button",{type:"button",onClick:()=>_t(ce),className:"revka-assets-row w-full border-b px-4 py-2.5 text-left transition hover:brightness-125",style:{borderColor:"var(--revka-border-soft)",background:"color-mix(in srgb, var(--revka-bg-elevated) 50%, transparent)"},children:[c.jsxs("div",{className:"flex min-w-0 items-center gap-2.5",children:[c.jsx(NB,{className:"h-4 w-4 shrink-0",style:{color:"#fbbf24"}}),c.jsx("span",{className:"truncate text-sm font-medium",style:{color:"var(--revka-text-primary)"},children:ce.name})]}),c.jsx("span",{className:"revka-assets-kind text-xs",style:{color:"var(--revka-text-faint)"},children:e("assets.folder")}),c.jsx("span",{className:"revka-assets-author truncate text-xs",style:{color:"var(--revka-text-faint)"},children:"--"}),c.jsx("span",{className:"revka-assets-created text-right text-xs",style:{color:"var(--revka-text-faint)"},children:S2(ce.created_at)})]},ce.path)),Os&&V.length>0?c.jsx("div",{className:"border-b px-4 py-2 text-[11px] font-semibold uppercase tracking-[0.12em]",style:{borderColor:"var(--revka-border-soft)",color:"var(--revka-text-faint)"},children:n("assets.search.result_count",{count:V.length,query:R})}):null,ai.map(ce=>{const Be=Hc(ce.kind),xt=Be.icon,Ft=(C==null?void 0:C.kref)===ce.kref;return c.jsxs("button",{type:"button",onClick:()=>cs(ce),className:"revka-assets-row w-full border-b px-4 py-2.5 text-left transition",style:{borderColor:"var(--revka-border-soft)",background:Ft?"color-mix(in srgb, var(--revka-signal-selected) 14%, var(--revka-bg-panel))":"transparent",opacity:ce.deprecated?.6:1},children:[c.jsxs("div",{className:"flex min-w-0 items-center gap-2.5",children:[c.jsx(xt,{className:"h-4 w-4 shrink-0",style:{color:Be.color}}),c.jsx("span",{className:"truncate text-sm font-medium",style:{color:"var(--revka-text-primary)"},children:ce.item_name||ce.name})]}),c.jsx("span",{className:"revka-assets-kind inline-flex items-center justify-center rounded-full px-2 py-0.5 text-[10px] font-semibold capitalize",style:{background:Be.bg,color:Be.color,border:`1px solid ${Be.border}`},children:ce.kind}),c.jsx("span",{className:"revka-assets-author truncate text-xs font-mono",style:{color:"var(--revka-text-faint)"},children:FI(ce)}),c.jsx("span",{className:"revka-assets-created text-right text-xs",style:{color:"var(--revka-text-faint)"},children:S2(ce.created_at)})]},ce.kref)}),al.length>hr?c.jsxs("div",{className:"flex items-center justify-between border-b px-4 py-2 text-xs",style:{borderColor:"var(--revka-border-soft)",color:"var(--revka-text-faint)"},children:[c.jsxs("span",{children:["Page ",Zr," / ",Ds]}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsxs("button",{type:"button",className:"revka-button h-8 px-2 text-xs",disabled:Zr<=1,onClick:()=>pe(ce=>Math.max(1,ce-1)),children:[c.jsx(F3,{className:"h-3.5 w-3.5"}),"Prev"]}),c.jsxs("button",{type:"button",className:"revka-button h-8 px-2 text-xs",disabled:Zr>=Ds,onClick:()=>pe(ce=>Math.min(Ds,ce+1)),children:["Next",c.jsx(ru,{className:"h-3.5 w-3.5"})]})]})]}):null,!Os&&v.length===0&&w.length===0?c.jsx("div",{className:"p-4",children:c.jsx(Ct,{compact:!0,title:e("assets.empty.title"),description:e("assets.empty.desc")})}):null,Os&&V.length===0&&!te?c.jsx("div",{className:"p-4",children:c.jsx(Ct,{compact:!0,title:e("assets.search.empty_title"),description:n("assets.search.empty_desc",{query:R})})}):null]})})]}),C?c.jsx("div",{className:"min-h-0 overflow-y-auto",children:c.jsxs(st,{className:"p-4",children:[c.jsxs("div",{className:"flex items-start justify-between gap-3",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsx("h3",{className:"text-base font-semibold",style:{color:"var(--revka-text-primary)"},children:C.item_name||C.name}),c.jsx("div",{className:"mt-1.5",children:c.jsx(BV,{kref:C.kref})})]}),c.jsx("button",{type:"button",onClick:()=>{T(null),E(null),z(null)},className:"shrink-0 rounded-[10px] p-1.5 transition",style:{color:"var(--revka-text-faint)"},title:e("assets.close_inspector"),children:c.jsx(mi,{className:"h-4 w-4"})})]}),c.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[(()=>{const ce=Hc(C.kind);return c.jsx("span",{className:"inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-[11px] font-semibold capitalize",style:{background:ce.bg,color:ce.color,border:`1px solid ${ce.border}`},children:C.kind})})(),c.jsx("span",{className:"inline-flex items-center rounded-full px-2.5 py-1 text-[11px] font-semibold",style:{background:C.deprecated?"rgba(245,158,11,0.12)":"rgba(125,255,155,0.12)",color:C.deprecated?"var(--revka-status-warning)":"var(--revka-status-success)"},children:C.deprecated?e("assets.deprecated"):e("assets.active")}),c.jsx("span",{className:"text-xs",style:{color:"var(--revka-text-faint)"},children:n(D.length===1?"assets.rev_count_one":"assets.rev_count",{count:D.length})}),c.jsxs("button",{type:"button",className:"revka-button ml-auto h-8 px-2 text-xs",onClick:il,disabled:Te==="item-deprecate",title:C.deprecated?e("assets.action.restore_item"):e("assets.action.deprecate_item"),children:[Te==="item-deprecate"?c.jsx(Rr,{className:"h-3.5 w-3.5 animate-spin"}):c.jsx(ex,{className:"h-3.5 w-3.5"}),C.deprecated?e("assets.action.restore"):e("assets.action.deprecate")]})]}),c.jsxs("div",{className:"mt-3 flex items-center justify-between gap-2 text-xs",style:{color:"var(--revka-text-secondary)"},children:[c.jsx("span",{className:"truncate font-mono",children:n("assets.by",{author:FI(C)})}),c.jsx("span",{className:"shrink-0",children:K5e(C.created_at)})]}),c.jsxs("div",{className:"mt-4",children:[c.jsx(G_,{title:e("assets.section.revisions"),count:D.length,defaultOpen:!0,children:ke?c.jsx(Ct,{tone:"loading",compact:!0,title:e("assets.loading.generic")}):D.length===0?c.jsx("div",{className:"text-sm",style:{color:"var(--revka-text-faint)"},children:e("assets.section.revisions_empty")}):c.jsxs("div",{className:"space-y-2",children:[B?c.jsxs("div",{className:"flex flex-wrap gap-2 rounded-[10px] border p-2",style:{borderColor:"var(--revka-border-soft)"},children:[c.jsxs("button",{type:"button",className:"revka-button h-8 px-2 text-xs",onClick:Rs,disabled:qu(B)||Te==="revision-publish",title:e("assets.action.publish_revision"),children:[Te==="revision-publish"?c.jsx(Rr,{className:"h-3.5 w-3.5 animate-spin"}):c.jsx(Bx,{className:"h-3.5 w-3.5"}),qu(B)?e("assets.action.published"):e("assets.action.publish")]}),c.jsxs("button",{type:"button",className:"revka-button h-8 px-2 text-xs",onClick:tc,disabled:Te==="revision-deprecate",title:B.deprecated?e("assets.action.restore_revision"):e("assets.action.deprecate_revision"),children:[Te==="revision-deprecate"?c.jsx(Rr,{className:"h-3.5 w-3.5 animate-spin"}):c.jsx(ex,{className:"h-3.5 w-3.5"}),B.deprecated?e("assets.action.restore"):e("assets.action.deprecate")]}),c.jsxs("button",{type:"button",className:"revka-button h-8 px-2 text-xs",onClick:()=>qe("tag"),title:"Add or remove non-current revision tags",children:[c.jsx(Bx,{className:"h-3.5 w-3.5"}),"Tags"]}),c.jsxs("button",{type:"button",className:"revka-button h-8 px-2 text-xs",onClick:()=>qe("artifact"),title:"Attach artifact to this revision",children:[c.jsx(cJ,{className:"h-3.5 w-3.5"}),"Artifact"]}),c.jsxs("button",{type:"button",className:"revka-button h-8 px-2 text-xs",onClick:()=>qe("edge"),title:"Create an edge from this revision",children:[c.jsx(AB,{className:"h-3.5 w-3.5"}),"Edge"]}),c.jsxs("button",{type:"button",className:"revka-button h-8 px-2 text-xs",onClick:()=>sn(!0),title:"View local dependency graph",children:[c.jsx(xf,{className:"h-3.5 w-3.5"}),"Graph"]})]}):null,c.jsx("div",{className:"max-h-[20rem] space-y-1.5 overflow-y-auto",children:D.map(ce=>{const Be=(B==null?void 0:B.kref)===ce.kref,xt=qu(ce);return c.jsxs("button",{type:"button",onClick:()=>rl(ce),className:"flex w-full items-center justify-between gap-2 rounded-[10px] px-3 py-2 text-left transition",style:{background:Be?"var(--revka-signal-selected-soft, color-mix(in srgb, var(--revka-signal-selected) 18%, transparent))":"color-mix(in srgb, var(--revka-bg-elevated) 50%, transparent)",borderLeft:Be?"2px solid var(--revka-signal-selected)":"2px solid transparent"},children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(fE,{className:"h-3 w-3",style:{color:"var(--revka-text-faint)"}}),c.jsxs("span",{className:"text-sm font-semibold",style:{color:"var(--revka-text-primary)"},children:["r",ce.number]}),c.jsxs("div",{className:"flex gap-1",children:[ce.latest?c.jsx(qa,{label:e("assets.tag.latest"),tone:"var(--revka-signal-live)"}):null,xt?c.jsx(qa,{label:e("assets.tag.published"),tone:"var(--revka-status-success)"}):null,ce.deprecated?c.jsx(qa,{label:e("assets.deprecated"),tone:"var(--revka-status-warning)"}):null,ce.tags.filter(Ft=>Ft!=="latest"&&Ft!=="published").map(Ft=>c.jsx(qa,{label:Ft,tone:"var(--revka-text-faint)"},Ft))]})]}),c.jsx("span",{className:"shrink-0 text-xs",style:{color:"var(--revka-text-faint)"},children:S2(ce.created_at)})]},ce.kref)})})]})}),c.jsx(G_,{title:e("assets.section.artifacts"),count:W.length,children:ye?c.jsx(Ct,{tone:"loading",compact:!0,title:e("assets.loading.generic")}):W.length===0?c.jsx("div",{className:"text-sm",style:{color:"var(--revka-text-faint)"},children:e("assets.section.artifacts_empty")}):c.jsx("div",{className:"space-y-1.5",children:W.map(ce=>c.jsxs("div",{role:"button",tabIndex:0,onClick:()=>I(ce),onKeyDown:Be=>{(Be.key==="Enter"||Be.key===" ")&&(Be.preventDefault(),I(ce))},className:"w-full rounded-[10px] px-3 py-2 text-left transition cursor-pointer",style:{background:(q==null?void 0:q.kref)===ce.kref?"var(--revka-signal-selected-soft, color-mix(in srgb, var(--revka-signal-selected) 18%, transparent))":"color-mix(in srgb, var(--revka-bg-elevated) 50%, transparent)",opacity:ce.deprecated?.62:1},children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(Ul,{className:"h-3.5 w-3.5 shrink-0",style:{color:"#2dd4bf"}}),c.jsx("span",{className:"truncate text-sm font-medium flex-1 min-w-0",style:{color:"var(--revka-text-primary)"},children:ce.name}),ce.deprecated?c.jsx("span",{className:"rounded-full px-1.5 py-0.5 text-[9px] font-semibold uppercase",style:{color:"var(--revka-status-warning)",background:"rgba(245,158,11,0.12)"},children:e("assets.deprecated")}):null,ce.location?c.jsxs("button",{type:"button",onClick:Be=>{Be.stopPropagation(),_u(ce)},className:"inline-flex items-center gap-1 rounded-[6px] px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wider shrink-0 transition",style:{background:"var(--revka-bg-elevated)",color:"var(--revka-text-secondary)",border:"1px solid var(--revka-border-strong)"},"aria-label":`${e("assets.action.edit_artifact")} ${ce.name}`,children:[c.jsx(OB,{className:"h-3 w-3"}),e("assets.action.edit")]}):null,ce.location?c.jsxs("button",{type:"button",onClick:Be=>{Be.stopPropagation(),K(ce)},className:"inline-flex items-center gap-1 rounded-[6px] px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wider shrink-0 transition",style:{background:"var(--revka-bg-elevated)",color:"var(--revka-text-secondary)",border:"1px solid var(--revka-border-strong)"},"aria-label":`View ${ce.name}`,children:[c.jsx(nv,{className:"h-3 w-3"}),e("assets.action.view")]}):null,c.jsxs("button",{type:"button",onClick:Be=>{Be.stopPropagation(),ra(ce)},className:"inline-flex items-center gap-1 rounded-[6px] px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wider shrink-0 transition",style:{background:"var(--revka-bg-elevated)",color:ce.deprecated?"var(--revka-status-success)":"var(--revka-status-warning)",border:"1px solid var(--revka-border-strong)"},"aria-label":`${ce.deprecated?e("assets.action.restore_artifact"):e("assets.action.deprecate_artifact")} ${ce.name}`,children:[Te===`artifact-deprecate:${ce.kref}`?c.jsx(Rr,{className:"h-3 w-3 animate-spin"}):c.jsx(ex,{className:"h-3 w-3"}),ce.deprecated?e("assets.action.restore"):e("assets.action.deprecate")]})]}),ce.location?c.jsxs("div",{className:"mt-1 truncate pl-5.5 text-xs",style:{color:"var(--revka-text-faint)",paddingLeft:"1.375rem"},children:[c.jsx(TB,{className:"mr-1 inline-block h-3 w-3"}),ce.location]}):null]},ce.kref))})}),c.jsx(G_,{title:e("assets.section.edges"),count:Z.length,children:Z.length===0?c.jsx("div",{className:"text-sm",style:{color:"var(--revka-text-faint)"},children:e("assets.section.edges_empty")}):c.jsx("div",{className:"space-y-1.5",children:Z.map((ce,Be)=>{var xt,Ft;return c.jsx("div",{className:"rounded-[10px] px-3 py-2",style:{background:"color-mix(in srgb, var(--revka-bg-elevated) 50%, transparent)"},children:c.jsxs("div",{className:"flex items-center gap-1.5 text-xs",children:[c.jsx("span",{className:"truncate font-mono",style:{color:"var(--revka-text-faint)"},children:(xt=ce.source_kref.split("/").pop())==null?void 0:xt.split("?")[0]}),c.jsx("span",{className:"shrink-0 rounded-full px-1.5 py-0.5 text-[9px] font-bold uppercase",style:{background:"rgba(251,146,60,0.1)",color:"#fb923c"},children:ce.edge_type}),c.jsx(sf,{className:"h-3 w-3 shrink-0",style:{color:"var(--revka-text-faint)"}}),c.jsx("span",{className:"truncate font-mono",style:{color:"var(--revka-text-faint)"},children:(Ft=ce.target_kref.split("/").pop())==null?void 0:Ft.split("?")[0]})]})},`${ce.source_kref}-${ce.target_kref}-${ce.edge_type}-${Be}`)})})}),c.jsx(G_,{title:e("assets.section.metadata"),count:_i.length,defaultOpen:_i.length>0,children:_i.length===0?c.jsx("div",{className:"text-sm",style:{color:"var(--revka-text-faint)"},children:e("assets.section.metadata_empty")}):c.jsx("div",{className:"space-y-1.5",children:_i.map(([ce,Be])=>c.jsxs("div",{className:"rounded-[10px] px-3 py-2",style:{background:"color-mix(in srgb, var(--revka-bg-elevated) 50%, transparent)"},children:[c.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-[0.1em]",style:{color:"var(--revka-text-faint)"},children:ce}),c.jsx("div",{className:"mt-1 break-all text-sm leading-5",style:{color:"var(--revka-text-primary)"},children:String(Be)})]},ce))})})]})]})}):null]})]}),Ne?c.jsxs(yu,{title:n("assets.editor.title",{name:Ne.name}),description:B&&qu(B)?e("assets.editor.published_desc"):e("assets.editor.mutable_desc"),onClose:()=>{Te!=="artifact-save"&&Ee(null)},size:"2xl",children:[c.jsxs("div",{className:"mb-3 flex items-center gap-2 text-xs",style:{color:"var(--revka-text-faint)"},children:[c.jsx(rv,{className:"h-3.5 w-3.5"}),c.jsx("span",{className:"truncate font-mono",children:Ne.kref})]}),it?c.jsx(Ct,{tone:"loading",compact:!0,title:e("assets.loading.generic")}):c.jsx("textarea",{className:"revka-input min-h-[24rem] w-full resize-y font-mono text-xs leading-5",value:rt,onChange:ce=>Ye(ce.target.value),spellCheck:!1}),c.jsxs("div",{className:"mt-4 flex justify-end gap-2",children:[c.jsx("button",{type:"button",className:"revka-button",onClick:()=>Ee(null),disabled:Te==="artifact-save",children:e("common.cancel")}),c.jsxs("button",{type:"button",className:"revka-button revka-button-primary",onClick:sl,disabled:it||Te==="artifact-save",children:[Te==="artifact-save"?c.jsx(Rr,{className:"h-4 w-4 animate-spin"}):c.jsx(yE,{className:"h-4 w-4"}),e("assets.action.save_artifact")]})]})]}):null,Q?c.jsx(GU,{artifact:Q,onClose:()=>K(null)}):null,xe?c.jsx(i3e,{action:xe,project:d,spacePath:Yt,selectedItem:C,selectedRevision:B,selectedBundle:lo,bundleMembers:Ke,onClose:()=>qe(null),onCreated:ce=>{qe(null),ce!=null&&ce.item&&(E(ce.item.kref),T(ce.item)),ce!=null&&ce.revision&&(z(ce.revision.kref),H(ce.revision)),ce!=null&&ce.bundle&&(ve(ce.bundle.kref),re("bundles")),Tt(Be=>Be+1),L("success","Kumiho asset operation completed.")}}):null,dt&&B?c.jsx(s3e,{revision:B,onClose:()=>sn(!1),onOpenKref:ce=>{sn(!1),us(ce)}}):null]})}const Yg={conversation:"var(--revka-signal-network)",decision:"var(--revka-status-warning)",fact:"var(--revka-signal-selected)",preference:"var(--revka-signal-selected)",correction:"var(--revka-status-danger)",skill:"var(--revka-signal-network)",summary:"var(--revka-signal-selected)",bundle:"var(--revka-signal-live)",reflection:"var(--revka-signal-selected)",action:"var(--revka-status-warning)",error:"var(--revka-status-danger)",instruction:"var(--revka-status-warning)",plan:"var(--revka-signal-selected)",implementation:"var(--revka-signal-live)",architecture:"var(--revka-signal-network)",synthesis:"var(--revka-signal-selected)",space:"var(--revka-status-idle)",document:"var(--revka-signal-network)",skilldef:"var(--revka-signal-selected)"},o3e={DEPENDS_ON:"var(--revka-status-warning)",DERIVED_FROM:"var(--revka-signal-selected)",REFERENCED:"var(--revka-signal-network)",CONTAINS:"var(--revka-signal-live)",CREATED_FROM:"var(--revka-signal-selected)",BELONGS_TO:"var(--revka-signal-network)",SUPERSEDES:"var(--revka-status-danger)",MEMBER:"var(--revka-status-warning)",USED_TEMPLATE:"var(--revka-status-warning)"},Gb="var(--revka-text-muted)",l3e="var(--revka-text-faint)";function KI(e){if(typeof window>"u")return e;const n=e.match(/^var\((--[^,)]+)/);return n&&getComputedStyle(document.documentElement).getPropertyValue(n[1]).trim()||e}function c3e(e){return e.startsWith("kref://")?e:`kref://${e}`}function u3e(){const{t:e,tpl:n}=cn();return b.useCallback(r=>{if(!r)return"";const i=Date.now(),s=new Date(r).getTime(),a=i-s,o=Math.floor(a/1e3);if(o<60)return e("memory.relative.just_now");const l=Math.floor(o/60);if(l<60)return n("memory.relative.minutes",{count:l});const u=Math.floor(l/60);if(u<24)return n("memory.relative.hours",{count:u});const d=Math.floor(u/24);return d<7?n("memory.relative.days",{count:d}):new Date(r).toLocaleDateString()},[e,n])}function d3e({kinds:e,activeKinds:n,onToggle:r}){return c.jsx("div",{className:"flex flex-wrap gap-1.5",children:e.map(i=>{const s=n.size===0||n.has(i),a=Yg[i]||Gb;return c.jsx("button",{type:"button",onClick:()=>r(i),className:"rounded-full border px-2.5 py-1 text-[10px] font-semibold uppercase tracking-[0.12em]",style:{background:s?`color-mix(in srgb, ${a} 16%, transparent)`:"transparent",color:s?a:"var(--revka-text-faint)",borderColor:s?`color-mix(in srgb, ${a} 30%, transparent)`:"var(--revka-border-soft)",opacity:s?1:.55},children:i},i)})})}function h3e({detail:e,loading:n,onClose:r,onMemberClick:i}){const{t:s}=cn(),a=u3e(),[o,l]=b.useState(!1),u=Yg[e.kind]||Gb,d=async()=>{const p=e.kref.startsWith("kref://")?e.kref:`kref://${e.kref}`;await Ja(p)&&(l(!0),setTimeout(()=>l(!1),1500))};return c.jsxs(st,{className:"p-4",variant:"secondary",children:[c.jsxs("div",{className:"flex items-start justify-between gap-3",children:[c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsx("div",{className:"revka-kicker",children:s("memory.selected_memory")}),c.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[c.jsx("span",{className:"h-2.5 w-2.5 rounded-full",style:{backgroundColor:u}}),c.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-[0.14em]",style:{color:u},children:e.kind})]}),c.jsx("h3",{className:"mt-2 break-words text-lg font-semibold",style:{color:"var(--revka-text-primary)"},children:e.title||e.name})]}),c.jsx("button",{type:"button",className:"revka-button",onClick:r,children:c.jsx(mi,{className:"h-4 w-4"})})]}),n?c.jsx("div",{className:"mt-4",children:c.jsx(Ct,{compact:!0,tone:"loading",title:s("memory.loading_detail")})}):c.jsxs("div",{className:"mt-4 space-y-4",children:[e.summary?c.jsx("p",{className:"text-sm leading-6",style:{color:"var(--revka-text-secondary)"},children:e.summary}):null,c.jsxs("div",{className:"flex flex-wrap gap-2 text-xs",style:{color:"var(--revka-text-faint)"},children:[e.space?c.jsx("span",{className:"rounded-full border px-2 py-1",style:{borderColor:"var(--revka-border-soft)"},children:e.space}):null,e.created_at?c.jsx("span",{children:a(e.created_at)}):null]}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("code",{className:"flex-1 truncate rounded-[10px] border px-3 py-2 text-[11px]",style:{borderColor:"var(--revka-border-soft)",color:"var(--revka-text-faint)"},children:e.kref}),c.jsx("button",{type:"button",className:"revka-button",onClick:d,children:o?c.jsx(Za,{className:"h-4 w-4"}):c.jsx(Xl,{className:"h-4 w-4"})})]}),Object.keys(e.metadata).length>0?c.jsxs("div",{children:[c.jsx("div",{className:"revka-kicker",children:s("memory.detail.metadata")}),c.jsx("div",{className:"mt-2 space-y-2",children:Object.entries(e.metadata).filter(([p])=>p!=="title"&&p!=="summary").map(([p,f])=>c.jsxs("div",{className:"rounded-[12px] border p-3 text-xs",style:{borderColor:"var(--revka-border-soft)"},children:[c.jsx("div",{className:"font-semibold",style:{color:"var(--revka-text-secondary)"},children:p}),c.jsx("div",{className:"mt-1 break-all",style:{color:"var(--revka-text-faint)"},children:f.length>200?`${f.slice(0,200)}...`:f})]},p))})]}):null,e.bundleMembers&&e.bundleMembers.length>0?c.jsxs("div",{children:[c.jsx("div",{className:"revka-kicker",children:s("memory.detail.bundle_members")}),c.jsx("div",{className:"mt-2 space-y-2",children:e.bundleMembers.map(p=>c.jsxs("button",{type:"button",onClick:()=>i(p),className:"block w-full rounded-[12px] border p-3 text-left transition-colors",style:{borderColor:"var(--revka-border-soft)"},children:[c.jsx("div",{className:"text-sm font-semibold",style:{color:"var(--revka-text-primary)"},children:p.name}),c.jsx("div",{className:"mt-1 text-[10px] font-semibold uppercase tracking-[0.14em]",style:{color:Yg[p.kind]||Gb},children:p.kind}),p.summary?c.jsx("div",{className:"mt-2 line-clamp-2 text-xs",style:{color:"var(--revka-text-secondary)"},children:p.summary}):null]},p.itemKref))})]}):null]})]})}function f3e(){const{t:e,tpl:n}=cn(),{resolvedTheme:r}=Ta(),[i,s]=b.useState(null),[a,o]=b.useState(!0),[l,u]=b.useState(null),[d,p]=b.useState(new Set),[f,g]=b.useState(""),[_,x]=b.useState(150),[v,S]=b.useState(150),[w,N]=b.useState(""),[C,T]=b.useState(new Set),A=b.useRef(null),E=b.useRef(null),[D,F]=b.useState({width:0,height:0}),[B,H]=b.useState(null),[$,z]=b.useState(null),[W,P]=b.useState(!1),q=b.useMemo(()=>{if(typeof window>"u")return{primary:"#ffffff",muted:"rgba(255,255,255,0.6)",dim:"rgba(255,255,255,0.1)"};const te=getComputedStyle(document.documentElement),X=te.getPropertyValue("--revka-text-primary").trim()||(r==="light"?"#18181b":"#ffffff"),se=te.getPropertyValue("--revka-text-secondary").trim()||(r==="light"?"#52525b":"rgba(255,255,255,0.6)");return{primary:X,muted:se,dim:r==="light"?"rgba(24,24,27,0.15)":"rgba(255,255,255,0.1)"}},[r]);b.useEffect(()=>{const te=setTimeout(()=>S(_),400);return()=>clearTimeout(te)},[_]);const I=b.useCallback(async()=>{o(!0),u(null);const te=2;for(let X=0;X<=te;X+=1)try{const se={limit:v};d.size>0&&(se.kinds=Array.from(d).join(",")),f&&(se.space=f);const re=await lZ(se);s(re),o(!1);return}catch(se){const re=se instanceof Error?se.message:String(se);if(/API (408|502|503|504)/.test(re)&&X<te){await new Promise(ue=>setTimeout(ue,(X+1)*2e3));continue}u(re||e("memory.err.load"))}o(!1)},[d,v,f,e]);b.useEffect(()=>{I()},[I]),b.useEffect(()=>{const te=A.current;if(!te)return;const X=()=>F({width:te.clientWidth,height:te.clientHeight});X();const se=new ResizeObserver(X);return se.observe(te),()=>se.disconnect()},[]),b.useEffect(()=>{var se,re;if(!w.trim()||!i){T(new Set);return}const te=w.toLowerCase(),X=new Set;for(const de of i.nodes)(de.name.toLowerCase().includes(te)||(se=de.title)!=null&&se.toLowerCase().includes(te)||de.kind.toLowerCase().includes(te)||(re=de.summary)!=null&&re.toLowerCase().includes(te))&&X.add(de.id);T(X)},[i,w]);const Q=b.useMemo(()=>{if(!i)return{nodes:[],links:[]};const te=i.nodes.map(re=>({...re,val:C.has(re.id)?3:1,__highlight:C.has(re.id)})),X=new Set(te.map(re=>re.id)),se=i.edges.filter(re=>X.has(re.source)&&X.has(re.target)).map(re=>({source:re.source,target:re.target,edgeType:re.edge_type}));return{nodes:te,links:se}},[i,C]),K=b.useMemo(()=>i?Object.keys(i.stats.kinds).sort():[],[i]),Z=b.useCallback(te=>{p(X=>{const se=new Set(X);return se.has(te)?se.delete(te):se.add(te),se})},[]),Y=b.useCallback(async te=>{var se,re;P(!0);const X={name:te.name,kind:te.kind,kref:te.id,space:te.space,created_at:te.created_at,title:te.title,summary:te.summary,metadata:{},bundleMembers:null};try{const de=c3e(te.id),ue=await Eo("/revisions",{item_kref:de}),pe=(ue==null?void 0:ue.find(J=>{var me;return(me=J.tags)==null?void 0:me.includes("published")}))??(ue==null?void 0:ue.find(J=>J.latest))??(ue==null?void 0:ue[0]);if(pe&&(X.metadata=pe.metadata??{},X.title=((se=pe.metadata)==null?void 0:se.title)||X.title,X.summary=((re=pe.metadata)==null?void 0:re.summary)||X.summary),te.kind==="bundle")try{const J=await Eo("/bundles/members",{bundle_kref:de});X.bundleMembers=((J==null?void 0:J.members)??[]).map(me=>{const Ke=me.item_kref.replace(/^kref:\/\//,"").split("/").pop()||"",ge=Ke.indexOf("."),Ue=ge>0?Ke.substring(0,ge):Ke,$e=ge>0?Ke.substring(ge+1):"unknown";return{itemKref:me.item_kref,name:Ue,kind:$e,summary:null}})}catch{X.bundleMembers=null}}catch{}z(X),P(!1)},[]),R=b.useCallback(te=>{H(te.id),Y(te)},[Y]),U=b.useCallback(te=>{const X=i==null?void 0:i.nodes.find(se=>se.id===te.itemKref.replace(/^kref:\/\//,""));X&&(H(X.id),Y(X))},[Y,i]),V=b.useCallback((te,X,se)=>{const re=te.x??0,de=te.y??0,ue=KI(Yg[te.kind]||Gb),ae=te.id===B,pe=!!te.__highlight,J=te.kind==="space",me=ae?7:pe?6:J?5:4,ve=C.size>0&&!pe&&!ae;if(ae&&(X.beginPath(),X.arc(re,de,me+5,0,2*Math.PI),X.fillStyle=`${ue}20`,X.fill(),X.beginPath(),X.arc(re,de,me+2.5,0,2*Math.PI),X.strokeStyle=`${ue}50`,X.lineWidth=1.5,X.stroke()),pe&&!ae&&(X.beginPath(),X.arc(re,de,me+3,0,2*Math.PI),X.strokeStyle=q.primary,X.lineWidth=1,X.globalAlpha=.6,X.stroke(),X.globalAlpha=1),X.beginPath(),J){const Ke=me*1.2;X.moveTo(re,de-Ke),X.lineTo(re+Ke,de),X.lineTo(re,de+Ke),X.lineTo(re-Ke,de),X.closePath()}else X.arc(re,de,me,0,2*Math.PI);if(X.fillStyle=ue,X.globalAlpha=ve?.15:1,X.fill(),X.globalAlpha=1,se>.8||ae||pe){const Ke=Math.max(10/se,3);X.font=`${ae?"bold ":""}${Ke}px Inter, system-ui, sans-serif`,X.textAlign="center",X.textBaseline="top",X.fillStyle=ve?q.dim:ae?q.primary:q.muted;const ge=te.name.length>22?`${te.name.slice(0,20)}...`:te.name;X.fillText(ge,re,de+me+2)}},[C,B,q]),ie=b.useCallback((te,X)=>{const se=te.source,re=te.target;if(typeof se!="object"||typeof re!="object"||se.x==null||se.y==null||re.x==null||re.y==null)return;const de=KI(o3e[te.edgeType]||l3e),ue=C.size>0,ae=C.has(se.id)||se.id===B,pe=C.has(re.id)||re.id===B,J=ue&&!ae&&!pe;X.beginPath(),X.moveTo(se.x,se.y),X.lineTo(re.x,re.y),X.strokeStyle=de,X.globalAlpha=J?.05:.4,X.lineWidth=J?.5:1.5,X.stroke(),X.globalAlpha=1},[C,B]);return c.jsx("div",{className:"flex h-[calc(100vh-6rem)] flex-col gap-3",children:c.jsxs("div",{className:"grid min-h-0 flex-1 gap-4 md:grid-cols-[16rem_minmax(0,1fr)_minmax(22rem,26rem)]",children:[c.jsxs("div",{className:"flex min-h-0 flex-col gap-4 overflow-y-auto pr-1",children:[c.jsxs(st,{className:"p-4",children:[c.jsx("div",{className:"revka-kicker",children:e("memory.controls.title")}),c.jsxs("div",{className:"mt-3 space-y-4",children:[c.jsx("div",{children:c.jsxs("div",{className:"relative",children:[c.jsx(Aa,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2",style:{color:"var(--revka-text-faint)"}}),c.jsx("input",{type:"text",value:w,onChange:te=>N(te.target.value),placeholder:e("memory.controls.search_placeholder"),className:"revka-input pl-10 pr-10"}),w?c.jsx("button",{type:"button",className:"absolute right-2 top-1/2 -translate-y-1/2 revka-button px-2 py-2",onClick:()=>N(""),children:c.jsx(mi,{className:"h-3.5 w-3.5"})}):null]})}),i&&i.spaces.length>1?c.jsxs("div",{className:"relative",children:[c.jsxs("select",{value:f,onChange:te=>g(te.target.value),className:"revka-input appearance-none pr-10",children:[c.jsx("option",{value:"",children:e("memory.controls.all_spaces")}),i.spaces.map(te=>c.jsx("option",{value:`/${te}`,children:te.split("/").pop()},te))]}),c.jsx(qo,{className:"pointer-events-none absolute right-3 top-1/2 h-4 w-4 -translate-y-1/2",style:{color:"var(--revka-text-faint)"}})]}):null,c.jsxs("div",{children:[c.jsxs("div",{className:"mb-2 inline-flex items-center gap-2 text-sm",style:{color:"var(--revka-text-secondary)"},children:[c.jsx(EJ,{className:"h-4 w-4"}),e("memory.controls.node_limit")]}),c.jsx("input",{type:"range",min:25,max:500,step:25,value:_,onChange:te=>x(Number(te.target.value)),className:"w-full accent-[var(--revka-signal-selected)]"}),c.jsx("div",{className:"mt-2 text-xs font-mono",style:{color:"var(--revka-text-faint)"},children:_})]})]})]}),c.jsxs(st,{className:"p-4",variant:"secondary",children:[c.jsx("div",{className:"revka-kicker",children:e("memory.filters.title")}),c.jsx("div",{className:"mt-3",children:K.length>0?c.jsx(d3e,{kinds:K,activeKinds:d,onToggle:Z}):c.jsx(Ct,{compact:!0,title:e("memory.filters.empty_title"),description:e("memory.filters.empty_desc")})})]})]}),c.jsxs(st,{className:"flex min-h-0 flex-col p-5",children:[c.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[c.jsxs("div",{children:[c.jsx("div",{className:"revka-kicker",children:e("memory.graph.kicker")}),c.jsx("h3",{className:"mt-2 text-lg font-semibold",children:e("memory.graph.heading")})]}),i?c.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-xs",style:{color:"var(--revka-text-faint)"},children:[c.jsxs("span",{children:[c.jsx("strong",{style:{color:"var(--revka-text-primary)"},children:i.stats.total_items})," ",e("memory.graph.items")]}),c.jsxs("span",{children:[c.jsx("strong",{style:{color:"var(--revka-text-primary)"},children:i.stats.total_edges})," ",e("memory.graph.edges")]}),c.jsxs("span",{children:[c.jsx("strong",{style:{color:"var(--revka-text-primary)"},children:Q.nodes.length})," ",e("memory.graph.shown")]}),C.size>0?c.jsx("span",{style:{color:"var(--revka-status-warning)"},children:n(C.size===1?"memory.graph.match":"memory.graph.matches",{count:C.size})}):null]}):null]}),c.jsxs("div",{ref:A,className:"relative mt-5 min-h-0 flex-1 overflow-hidden rounded-[18px] border",style:{borderColor:"var(--revka-border-soft)",background:"color-mix(in srgb, var(--revka-bg-panel-strong) 94%, transparent)"},children:[a?c.jsx("div",{className:"absolute inset-0 flex items-center justify-center p-6",children:c.jsx(Ct,{tone:"loading",title:e("memory.graph.loading_title"),description:e("memory.graph.loading_desc")})}):null,!a&&l?c.jsx("div",{className:"absolute inset-0 flex items-center justify-center p-6",children:c.jsx(Ct,{tone:"error",title:e("memory.graph.error_title"),description:l,action:c.jsx("button",{className:"revka-button",onClick:I,children:e("memory.graph.retry")})})}):null,!a&&!l&&Q.nodes.length===0?c.jsx("div",{className:"absolute inset-0 flex items-center justify-center p-6",children:c.jsx(Ct,{title:e("memory.graph.empty_title"),description:e("memory.graph.empty_desc")})}):null,!a&&!l&&D.width>0&&D.height>0&&Q.nodes.length>0?c.jsx(ak,{ref:E,graphData:Q,width:D.width,height:D.height,backgroundColor:"transparent",nodeRelSize:4,nodeCanvasObject:V,nodePointerAreaPaint:(te,X,se)=>{const re=te.x??0,de=te.y??0;se.beginPath(),se.arc(re,de,10,0,2*Math.PI),se.fillStyle=X,se.fill()},linkCanvasObject:ie,linkCanvasObjectMode:()=>"replace",onNodeClick:R,cooldownTicks:200,d3AlphaDecay:.015,d3VelocityDecay:.25,warmupTicks:50}):null,!a&&!l&&Q.nodes.length>0?c.jsx("div",{className:"absolute bottom-3 left-3 z-10 flex max-w-[70%] flex-wrap items-center gap-x-3 gap-y-1 rounded-[12px] border px-3 py-2",style:{borderColor:"var(--revka-border-soft)",background:"color-mix(in srgb, var(--revka-bg-panel-strong) 94%, transparent)"},children:Object.entries(Yg).filter(([te])=>i==null?void 0:i.stats.kinds[te]).map(([te,X])=>c.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px]",style:{color:"var(--revka-text-secondary)"},children:[c.jsx("span",{className:"h-2 w-2 rounded-full",style:{backgroundColor:X}}),te]},te))}):null]})]}),c.jsx("div",{className:"flex min-h-0 flex-col gap-4 overflow-y-auto pr-1",children:$?c.jsx(h3e,{detail:$,loading:W,onClose:()=>{z(null),H(null)},onMemberClick:U}):c.jsx(st,{className:"p-5",variant:"secondary",children:c.jsx(Ct,{title:e("memory.none_selected_title"),description:e("memory.none_selected_desc")})})})]})})}function YI(e){switch(e){case"auth_failure":case"policy_violation":return"var(--revka-status-danger)";case"security_event":return"var(--revka-status-warning)";case"auth_success":return"var(--revka-status-success)";default:return"var(--revka-text-secondary)"}}function p3e(){const{t:e,tpl:n}=cn(),[r,i]=b.useState([]),[s,a]=b.useState(!0),[o,l]=b.useState(null),[u,d]=b.useState(!1),[p,f]=b.useState(""),[g,_]=b.useState(!0),x=b.useCallback(N=>{try{const C=Date.now()-new Date(N).getTime(),T=Math.floor(C/1e3);if(T<60)return n("audit.time.seconds_ago",{n:T});const A=Math.floor(T/60);if(A<60)return n("audit.time.minutes_ago",{n:A});const E=Math.floor(A/60);return E<24?n("audit.time.hours_ago",{n:E}):n("audit.time.days_ago",{n:Math.floor(E/24)})}catch{return N}},[n]),v=b.useCallback(N=>{const C=`audit.event.${N}`,T=e(C);return T!==C?T:N.replace(/_/g," ").replace(/\b\w/g,A=>A.toUpperCase())},[e]),S=b.useCallback(()=>{a(!0),SQ({limit:100,event_type:p||void 0}).then(N=>{i(N.events),_(N.audit_enabled)}).catch(()=>i([])).finally(()=>a(!1))},[p]);b.useEffect(()=>{S()},[S]);const w=()=>{d(!0),Dx().then(l).catch(()=>l({verified:!1,error:"Verification request failed"})).finally(()=>d(!1))};return g?c.jsxs("div",{className:"flex min-h-[calc(100vh-6rem)] flex-col gap-3 lg:h-[calc(100vh-6rem)]",children:[c.jsx(si,{kicker:e("audit.kicker"),title:e("audit.title"),description:e("audit.description"),actions:c.jsxs(c.Fragment,{children:[c.jsxs("button",{className:"revka-button",onClick:S,children:[c.jsx($r,{className:`h-4 w-4 ${s?"animate-spin":""}`}),e("audit.refresh")]}),c.jsxs("button",{className:"revka-button",onClick:w,disabled:u,children:[c.jsx(sv,{className:`h-4 w-4 ${u?"animate-spin":""}`}),e("audit.verify_chain")]})]})}),c.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:min-h-0 lg:flex-1 lg:grid-cols-[18rem_minmax(0,1fr)]",children:[c.jsxs(st,{className:"p-4",variant:"secondary",children:[c.jsx("div",{className:"revka-kicker",children:e("audit.filters")}),c.jsxs("div",{className:"mt-3 space-y-3",children:[c.jsxs("select",{value:p,onChange:N=>f(N.target.value),className:"revka-input",children:[c.jsx("option",{value:"",children:e("audit.all_event_types")}),c.jsx("option",{value:"command_execution",children:e("audit.event.command_execution")}),c.jsx("option",{value:"file_access",children:e("audit.event.file_access")}),c.jsx("option",{value:"config_change",children:e("audit.event.config_change")}),c.jsx("option",{value:"auth_success",children:e("audit.event.auth_success")}),c.jsx("option",{value:"auth_failure",children:e("audit.event.auth_failure")}),c.jsx("option",{value:"policy_violation",children:e("audit.event.policy_violation")}),c.jsx("option",{value:"security_event",children:e("audit.event.security_event")})]}),o?c.jsx("div",{className:"rounded-[12px] border p-3 text-sm",style:{borderColor:o.verified?"color-mix(in srgb, var(--revka-status-success) 24%, transparent)":"color-mix(in srgb, var(--revka-status-danger) 24%, transparent)"},children:c.jsxs("div",{className:"flex items-start gap-2",children:[o.verified?c.jsx(_f,{className:"mt-0.5 h-4 w-4",style:{color:"var(--revka-status-success)"}}):c.jsx(Xc,{className:"mt-0.5 h-4 w-4",style:{color:"var(--revka-status-danger)"}}),c.jsxs("div",{children:[c.jsx("div",{style:{color:o.verified?"var(--revka-status-success)":"var(--revka-status-danger)"},children:o.verified?e("audit.chain_verified"):e("audit.chain_invalid")}),c.jsx("div",{className:"mt-1 text-xs",style:{color:"var(--revka-text-secondary)"},children:o.verified?n("audit.entries_verified",{count:o.entry_count??0}):o.error})]})]})}):null]})]}),c.jsxs(st,{className:"p-5 lg:overflow-y-auto",children:[c.jsx("div",{className:"revka-kicker",children:e("audit.stream_title")}),c.jsx("h3",{className:"mt-2 text-lg font-semibold",children:e("audit.stream_subtitle")}),c.jsx("div",{className:"mt-5 space-y-3",children:s?c.jsx(Ct,{tone:"loading",title:e("audit.loading")}):r.length===0?c.jsx(Ct,{title:e("audit.empty_title"),description:e("audit.empty_desc")}):r.map(N=>{var C,T,A,E;return c.jsxs("div",{className:"rounded-[14px] border p-4",style:{borderColor:"var(--revka-border-soft)"},children:[c.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"rounded-full px-2.5 py-1 text-[10px] font-semibold uppercase tracking-[0.12em]",style:{color:YI(N.event_type),background:`color-mix(in srgb, ${YI(N.event_type)} 12%, transparent)`},children:v(N.event_type)}),N.actor?c.jsxs("span",{className:"text-xs",style:{color:"var(--revka-text-secondary)"},children:[N.actor.channel,N.actor.username?` · ${N.actor.username}`:""]}):null]}),c.jsx("span",{className:"text-xs",style:{color:"var(--revka-text-faint)"},children:x(N.timestamp)})]}),c.jsxs("div",{className:"mt-3 grid gap-3 md:grid-cols-2 xl:grid-cols-4 text-xs",children:[c.jsxs("div",{children:[c.jsx("div",{className:"revka-kicker",children:e("audit.col.sequence")}),c.jsx("div",{className:"mt-1",style:{color:"var(--revka-text-primary)"},children:N.sequence})]}),c.jsxs("div",{children:[c.jsx("div",{className:"revka-kicker",children:e("audit.col.action")}),c.jsx("div",{className:"mt-1",style:{color:"var(--revka-text-primary)"},children:((C=N.action)==null?void 0:C.command)||"—"})]}),c.jsxs("div",{children:[c.jsx("div",{className:"revka-kicker",children:e("audit.col.result")}),c.jsx("div",{className:"mt-1",style:{color:(T=N.result)!=null&&T.success?"var(--revka-status-success)":"var(--revka-text-secondary)"},children:(A=N.result)!=null&&A.success?e("audit.result_success"):((E=N.result)==null?void 0:E.error)||e("audit.result_recorded")})]}),c.jsxs("div",{children:[c.jsx("div",{className:"revka-kicker",children:e("audit.col.hash")}),c.jsx("div",{className:"mt-1 font-mono",style:{color:"var(--revka-text-faint)"},children:N.entry_hash.slice(0,16)})]})]}),N.security.policy_violation?c.jsxs("div",{className:"mt-3 inline-flex items-center gap-2 rounded-full px-2.5 py-1 text-[10px] font-semibold uppercase tracking-[0.12em]",style:{color:"var(--revka-status-danger)",background:"color-mix(in srgb, var(--revka-status-danger) 10%, transparent)"},children:[c.jsx(s0,{className:"h-3 w-3"}),e("audit.policy_violation_badge")]}):null]},N.event_id)})})]})]})]}):c.jsxs("div",{className:"flex min-h-[calc(100vh-6rem)] flex-col gap-3",children:[c.jsx(si,{kicker:e("audit.kicker"),title:e("audit.title"),description:e("audit.description")}),c.jsx(st,{className:"p-5",children:c.jsx(Ct,{title:e("audit.disabled_title"),description:e("audit.disabled_desc")})})]})}function m3e(e){return e?new Date(e).toLocaleTimeString():new Date().toLocaleTimeString()}function g3e(e){switch(e.toLowerCase()){case"error":return{color:"var(--revka-status-danger)",bg:"color-mix(in srgb, var(--revka-status-danger) 8%, transparent)",border:"color-mix(in srgb, var(--revka-status-danger) 18%, transparent)"};case"warn":case"warning":return{color:"var(--revka-status-warning)",bg:"color-mix(in srgb, var(--revka-status-warning) 8%, transparent)",border:"color-mix(in srgb, var(--revka-status-warning) 18%, transparent)"};case"tool_call":case"tool_result":case"tool_call_start":return{color:"var(--revka-signal-selected)",bg:"color-mix(in srgb, var(--revka-signal-selected) 8%, transparent)",border:"color-mix(in srgb, var(--revka-signal-selected) 18%, transparent)"};case"llm_request":return{color:"var(--revka-signal-network)",bg:"color-mix(in srgb, var(--revka-signal-network) 8%, transparent)",border:"color-mix(in srgb, var(--revka-signal-network) 18%, transparent)"};case"agent_start":case"agent_end":return{color:"var(--revka-signal-selected)",bg:"color-mix(in srgb, var(--revka-signal-selected) 8%, transparent)",border:"color-mix(in srgb, var(--revka-signal-selected) 18%, transparent)"};case"message":case"chat":return{color:"var(--revka-signal-selected)",bg:"var(--revka-signal-selected-soft, color-mix(in srgb, var(--revka-signal-selected) 18%, transparent))",border:"color-mix(in srgb, var(--revka-signal-selected) 28%, transparent)"};case"log":return{color:"var(--revka-text-secondary)",bg:"color-mix(in srgb, var(--revka-bg-panel-strong) 94%, transparent)",border:"var(--revka-border-soft)"};case"log_unavailable":return{color:"var(--revka-status-danger)",bg:"color-mix(in srgb, var(--revka-status-danger) 8%, transparent)",border:"color-mix(in srgb, var(--revka-status-danger) 18%, transparent)"};default:return{color:"var(--revka-text-secondary)",bg:"color-mix(in srgb, var(--revka-bg-panel-strong) 94%, transparent)",border:"var(--revka-border-soft)"}}}function v3e(){const{t:e,tpl:n}=cn(),[r,i]=b.useState([]),[s,a]=b.useState(!1),[o,l]=b.useState(!1),[u,d]=b.useState(!0),[p,f]=b.useState(new Set),g=b.useRef(null),_=b.useRef(!1),x=b.useRef(0);b.useEffect(()=>{_.current=s},[s]),b.useEffect(()=>{const N=new pv({path:`${Ti}${Gr}/api/daemon/logs`});return N.onConnect=()=>l(!0),N.onError=()=>l(!1),N.onEvent=C=>{if(_.current)return;x.current+=1;const T={id:`log-${x.current}`,event:C};i(A=>{const E=[...A,T];return E.length>500?E.slice(-500):E})},N.connect(),()=>N.disconnect()},[]),b.useEffect(()=>{u&&g.current&&(g.current.scrollTop=g.current.scrollHeight)},[r,u]);const v=b.useCallback(()=>{if(!g.current)return;const{scrollTop:N,scrollHeight:C,clientHeight:T}=g.current;d(C-N-T<50)},[]),S=Array.from(new Set(r.map(N=>N.event.type))).sort(),w=p.size===0?r:r.filter(N=>p.has(N.event.type));return c.jsxs("div",{className:"space-y-6",children:[c.jsx(si,{kicker:e("logs.kicker"),title:e("logs.title"),description:e("logs.description"),actions:c.jsxs(c.Fragment,{children:[c.jsxs("button",{className:"revka-button",onClick:()=>a(N=>!N),children:[s?c.jsx(n0,{className:"h-4 w-4"}):c.jsx(RB,{className:"h-4 w-4"}),e(s?"logs.resume":"logs.pause")]}),u?null:c.jsxs("button",{className:"revka-button",onClick:()=>{g.current&&(g.current.scrollTop=g.current.scrollHeight),d(!0)},children:[c.jsx(qZ,{className:"h-4 w-4"}),e("logs.jump_to_bottom")]})]})}),c.jsxs("div",{className:"grid gap-4 lg:grid-cols-[18rem_minmax(0,1fr)]",children:[c.jsxs("div",{className:"space-y-4",children:[c.jsxs(st,{className:"p-4",children:[c.jsx("div",{className:"revka-kicker",children:e("logs.stream_status")}),c.jsxs("div",{className:"mt-3 inline-flex items-center gap-2 rounded-full px-3 py-1.5 text-xs font-semibold",style:{color:o?"var(--revka-signal-selected)":"var(--revka-status-danger)",background:o?"color-mix(in srgb, var(--revka-signal-selected) 8%, transparent)":"color-mix(in srgb, var(--revka-status-danger) 8%, transparent)"},children:[c.jsx("span",{className:"revka-dot",style:{background:o?"var(--revka-signal-selected)":"var(--revka-status-danger)"}}),e(o?"logs.connected":"logs.disconnected")]}),c.jsx("div",{className:"mt-3 text-sm",style:{color:"var(--revka-text-secondary)"},children:n("logs.visible_lines",{count:w.length})})]}),c.jsxs(st,{className:"p-4",variant:"secondary",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(jB,{className:"h-4 w-4",style:{color:"var(--revka-text-faint)"}}),c.jsx("div",{className:"revka-kicker",children:e("logs.event_filters")})]}),c.jsxs("div",{className:"mt-3 space-y-2",children:[S.length===0?c.jsx(Ct,{compact:!0,title:e("logs.no_event_types"),description:e("logs.no_event_types_desc")}):S.map(N=>c.jsxs("label",{className:"flex items-center gap-2 text-xs",style:{color:"var(--revka-text-secondary)"},children:[c.jsx("input",{type:"checkbox",checked:p.has(N),onChange:()=>f(C=>{const T=new Set(C);return T.has(N)?T.delete(N):T.add(N),T})}),N]},N)),p.size>0?c.jsx("button",{className:"revka-button mt-2",onClick:()=>f(new Set),children:e("logs.clear_filters")}):null]})]})]}),c.jsxs(st,{className:"p-5",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(ev,{className:"h-4 w-4",style:{color:"var(--revka-signal-network)"}}),c.jsx("div",{className:"revka-kicker",children:e("logs.live_event_feed")})]}),c.jsx("div",{ref:g,onScroll:v,className:"mt-4 h-[42rem] overflow-y-auto rounded-[16px] border p-3",style:{borderColor:"var(--revka-border-soft)",background:"color-mix(in srgb, var(--revka-bg-panel-strong) 94%, transparent)"},children:w.length===0?c.jsx(Ct,{title:e("logs.no_events"),description:e("logs.no_events_desc")}):c.jsx("div",{className:"space-y-2",children:w.map(N=>{const C=g3e(N.event.type),T=typeof N.event.line=="string"?N.event.line:typeof N.event.message=="string"?N.event.message:typeof N.event.content=="string"?N.event.content:JSON.stringify(N.event);return c.jsxs("div",{className:"rounded-[12px] border p-3",style:{borderColor:C.border,background:C.bg},children:[c.jsxs("div",{className:"flex items-center justify-between gap-2",children:[c.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-[0.14em]",style:{color:C.color},children:N.event.type}),c.jsx("span",{className:"text-[11px]",style:{color:"var(--revka-text-faint)"},children:m3e(N.event.timestamp)})]}),c.jsx("pre",{className:"mt-2 whitespace-pre-wrap break-words text-xs",style:{color:"var(--revka-text-secondary)",fontFamily:"var(--pc-font-mono)"},children:T})]},N.id)})})})]})]})]})}function Vu(e){return`$${e.toFixed(4)}`}function y3e(){const{t:e,tpl:n}=cn(),[r,i]=b.useState(null),[s,a]=b.useState(!0),[o,l]=b.useState(null),[u,d]=b.useState(null);b.useEffect(()=>{uB().then(i).catch(g=>l(g.message)).finally(()=>a(!1))},[]);const p=b.useMemo(()=>r?Object.values(r.by_model).sort((g,_)=>_.cost_usd-g.cost_usd):[],[r]),f=b.useMemo(()=>p.find(g=>g.model===u)??p[0]??null,[p,u]);return b.useEffect(()=>{var g;p.find(_=>_.model===u)||d(((g=p[0])==null?void 0:g.model)??null)},[p,u]),c.jsxs("div",{className:"flex min-h-[calc(100vh-6rem)] flex-col gap-3 md:h-[calc(100vh-6rem)]",children:[c.jsx(si,{kicker:e("cost.kicker"),title:e("cost.title")}),o?c.jsx("div",{className:"flex min-h-0 flex-1 items-center justify-center",children:c.jsx(Ct,{tone:"error",title:e("cost.error_title"),description:o})}):s||!r?c.jsx("div",{className:"flex min-h-0 flex-1 items-center justify-center",children:c.jsx(Ct,{tone:"loading",title:e("cost.loading_title")})}):c.jsxs("div",{className:"grid gap-4 grid-cols-1 md:min-h-0 md:flex-1 md:grid-cols-[18rem_minmax(0,1fr)] lg:grid-cols-[18rem_minmax(0,1fr)_22rem]",children:[c.jsxs("div",{className:"flex flex-col gap-4 md:overflow-y-auto md:min-h-0",children:[c.jsxs(st,{className:"p-4",variant:"secondary",children:[c.jsx("div",{className:"revka-kicker",children:e("cost.spend_posture")}),c.jsx("div",{className:"mt-4 space-y-3",children:[{icon:uE,tone:"var(--revka-signal-live)",label:e("cost.session_cost"),value:Vu(r.session_cost_usd)},{icon:RJ,tone:"var(--revka-status-success)",label:e("cost.daily_cost"),value:Vu(r.daily_cost_usd)},{icon:vE,tone:"var(--revka-signal-selected)",label:e("cost.monthly_cost"),value:Vu(r.monthly_cost_usd)},{icon:fE,tone:"var(--revka-status-warning)",label:e("cost.requests"),value:r.request_count.toLocaleString()}].map(({icon:g,tone:_,label:x,value:v})=>c.jsx("div",{className:"rounded-[14px] border p-3",style:{borderColor:"var(--revka-border-soft)",background:"color-mix(in srgb, var(--revka-bg-panel-strong) 88%, transparent)"},children:c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx("div",{className:"rounded-[12px] p-2",style:{background:`color-mix(in srgb, ${_} 12%, transparent)`,color:_},children:c.jsx(g,{className:"h-4 w-4"})}),c.jsxs("div",{className:"min-w-0",children:[c.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-[0.14em]",style:{color:"var(--revka-text-faint)"},children:x}),c.jsx("div",{className:"mt-1 font-mono text-sm font-semibold",style:{color:"var(--revka-text-primary)"},children:v})]})]})},x))})]}),c.jsxs(st,{className:"p-4",variant:"secondary",children:[c.jsx("div",{className:"revka-kicker",children:e("cost.token_efficiency")}),c.jsxs("div",{className:"mt-3 space-y-3 text-sm",children:[c.jsx(Nl,{label:e("cost.total_tokens"),value:r.total_tokens.toLocaleString()}),c.jsx(Nl,{label:e("cost.avg_tokens"),value:r.request_count>0?Math.round(r.total_tokens/r.request_count).toLocaleString():"0"}),c.jsx(Nl,{label:e("cost.cost_per_1k"),value:r.total_tokens>0?Vu(r.monthly_cost_usd/r.total_tokens*1e3):"$0.0000"})]})]})]}),c.jsxs(st,{className:"p-5 md:overflow-y-auto",children:[c.jsx("div",{className:"revka-kicker",children:e("cost.model_workspace")}),c.jsx("h3",{className:"mt-2 text-lg font-semibold",children:e("cost.spend_by_model")}),c.jsx("div",{className:"mt-5 space-y-3",children:p.length===0?c.jsx(Ct,{title:e("cost.no_model_data"),description:e("cost.no_model_data_desc")}):p.map(g=>{const _=r.monthly_cost_usd>0?g.cost_usd/r.monthly_cost_usd*100:0;return c.jsxs("button",{type:"button",className:"revka-selection-card text-left","data-active":String((f==null?void 0:f.model)===g.model),"data-accent":"workflow",onClick:()=>d(g.model),children:[c.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[c.jsx("div",{className:"text-sm font-semibold",style:{color:"var(--revka-text-primary)"},children:g.model}),c.jsx("div",{className:"font-mono text-sm",style:{color:"var(--revka-text-secondary)"},children:Vu(g.cost_usd)})]}),c.jsxs("div",{className:"mt-2 grid gap-2 text-xs md:grid-cols-3",style:{color:"var(--revka-text-secondary)"},children:[c.jsx("div",{children:n("cost.tokens_label",{count:g.total_tokens.toLocaleString()})}),c.jsx("div",{children:n("cost.requests_label",{count:g.request_count.toLocaleString()})}),c.jsx("div",{children:n("cost.share_label",{share:_.toFixed(1)})})]}),c.jsx("div",{className:"mt-3 h-2 overflow-hidden rounded-full",style:{background:"color-mix(in srgb, var(--revka-bg-panel-strong) 86%, transparent)"},children:c.jsx("div",{style:{width:`${Math.max(_,2)}%`,background:"var(--revka-signal-selected)",height:"100%"}})})]},g.model)})})]}),c.jsxs("div",{className:"flex flex-col gap-4 lg:overflow-y-auto lg:min-h-0",children:[c.jsxs(st,{className:"p-4",variant:"utility",children:[c.jsx("div",{className:"revka-kicker",children:e("cost.selected_model")}),f?c.jsxs("div",{className:"mt-3 space-y-3",children:[c.jsx("div",{className:"text-sm font-semibold",style:{color:"var(--revka-text-primary)"},children:f.model}),c.jsx(Nl,{label:e("cost.monthly_spend"),value:Vu(f.cost_usd)}),c.jsx(Nl,{label:e("cost.requests"),value:f.request_count.toLocaleString()}),c.jsx(Nl,{label:e("cost.tokens"),value:f.total_tokens.toLocaleString()}),c.jsx(Nl,{label:e("cost.avg_tokens"),value:f.request_count>0?Math.round(f.total_tokens/f.request_count).toLocaleString():"0"}),c.jsx(Nl,{label:e("cost.cost_per_1k"),value:f.total_tokens>0?Vu(f.cost_usd/f.total_tokens*1e3):"$0.0000"}),c.jsx(Nl,{label:e("cost.share_monthly"),value:r.monthly_cost_usd>0?`${(f.cost_usd/r.monthly_cost_usd*100).toFixed(1)}%`:"0.0%"})]}):c.jsx("div",{className:"mt-4",children:c.jsx(Ct,{compact:!0,title:e("cost.no_model_selected"),description:e("cost.no_model_selected_desc")})})]}),c.jsxs(st,{className:"p-4",variant:"secondary",children:[c.jsx("div",{className:"revka-kicker",children:e("cost.interpretation")}),c.jsxs("div",{className:"mt-3 space-y-3 text-sm leading-6",style:{color:"var(--revka-text-secondary)"},children:[c.jsx("p",{children:e("cost.interp_p1")}),c.jsx("p",{children:e("cost.interp_p2")})]})]})]})]})]})}function Nl({label:e,value:n}){return c.jsxs("div",{className:"rounded-[12px] border p-3",style:{borderColor:"var(--revka-border-soft)"},children:[c.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-[0.14em]",style:{color:"var(--revka-text-faint)"},children:e}),c.jsx("div",{className:"mt-1 text-sm font-semibold",style:{color:"var(--revka-text-primary)"},children:n})]})}function _3e(e){switch(e){case"ok":return c.jsx(_f,{className:"h-4 w-4",style:{color:"var(--revka-status-success)"}});case"warn":return c.jsx(Cs,{className:"h-4 w-4",style:{color:"var(--revka-status-warning)"}});case"error":return c.jsx(Xc,{className:"h-4 w-4",style:{color:"var(--revka-status-danger)"}})}}function x3e(){const{t:e,tpl:n}=cn(),[r,i]=b.useState(null),[s,a]=b.useState(!1),[o,l]=b.useState(null),u=async()=>{a(!0),l(null),i(null);try{i(await wQ())}catch(_){l(_ instanceof Error?_.message:e("doctor.run_failed"))}finally{a(!1)}},d=(r==null?void 0:r.filter(_=>_.severity==="ok").length)??0,p=(r==null?void 0:r.filter(_=>_.severity==="warn").length)??0,f=(r==null?void 0:r.filter(_=>_.severity==="error").length)??0,g=(r==null?void 0:r.reduce((_,x)=>{const v=x.category;return _[v]||(_[v]=[]),_[v].push(x),_},{}))??{};return c.jsxs("div",{className:"space-y-6",children:[c.jsx(si,{kicker:e("doctor.kicker"),title:e("doctor.title"),description:e("doctor.description"),actions:c.jsxs("button",{className:"revka-button",onClick:u,disabled:s,children:[s?c.jsx(Rr,{className:"h-4 w-4 animate-spin"}):c.jsx(n0,{className:"h-4 w-4"}),e(s?"doctor.running":"doctor.run")]})}),o?c.jsx(st,{className:"p-5",children:c.jsx(Ct,{tone:"error",title:e("doctor.failed_title"),description:o})}):null,s?c.jsx(st,{className:"p-5",children:c.jsx(Ct,{tone:"loading",title:e("doctor.loading_title"),description:e("doctor.loading_desc")})}):r?c.jsx(c.Fragment,{children:c.jsxs("div",{className:"grid gap-4 lg:grid-cols-[22rem_minmax(0,1fr)]",children:[c.jsxs("div",{className:"space-y-4",children:[c.jsxs(st,{className:"p-4",variant:"secondary",children:[c.jsx("div",{className:"revka-kicker",children:e("doctor.health_summary")}),c.jsxs("div",{className:"mt-4 grid gap-3",children:[c.jsx(N2,{label:e("doctor.passing"),value:`${d}`,tone:"var(--revka-status-success)",icon:c.jsx(_f,{className:"h-4 w-4",style:{color:"var(--revka-status-success)"}})}),c.jsx(N2,{label:e("doctor.warnings"),value:`${p}`,tone:"var(--revka-status-warning)",icon:c.jsx(Cs,{className:"h-4 w-4",style:{color:"var(--revka-status-warning)"}})}),c.jsx(N2,{label:e("doctor.failures"),value:`${f}`,tone:"var(--revka-status-danger)",icon:c.jsx(Xc,{className:"h-4 w-4",style:{color:"var(--revka-status-danger)"}})})]})]}),c.jsxs(st,{className:"p-4",variant:"secondary",children:[c.jsx("div",{className:"revka-kicker",children:e("doctor.run_context")}),c.jsxs("div",{className:"mt-3 space-y-3 text-sm leading-6",style:{color:"var(--revka-text-secondary)"},children:[c.jsx("p",{children:e("doctor.context_p1")}),c.jsx("p",{children:e("doctor.context_p2")})]})]})]}),c.jsx("div",{className:"space-y-4",children:c.jsxs(st,{className:"p-4",variant:"utility",children:[c.jsx("div",{className:"revka-kicker",children:e("doctor.subsystem_boards")}),c.jsx("div",{className:"mt-3 grid gap-3 md:grid-cols-2 xl:grid-cols-2",children:Object.entries(g).sort(([_],[x])=>_.localeCompare(x)).map(([_,x])=>{const v=x.filter(N=>N.severity==="ok").length,S=x.filter(N=>N.severity==="warn").length,w=x.filter(N=>N.severity==="error").length;return c.jsxs("div",{className:"rounded-[16px] border p-4",style:{borderColor:"var(--revka-border-soft)",background:"color-mix(in srgb, var(--revka-bg-panel-strong) 94%, transparent)"},children:[c.jsxs("div",{className:"flex items-start justify-between gap-3",children:[c.jsxs("div",{children:[c.jsx("div",{className:"revka-kicker",children:_}),c.jsx("div",{className:"mt-2 text-sm font-semibold",style:{color:"var(--revka-text-primary)"},children:n("doctor.checks",{count:x.length})})]}),c.jsxs("div",{className:"flex gap-2 text-[10px] font-semibold uppercase tracking-[0.12em]",children:[c.jsxs("span",{style:{color:"var(--revka-status-success)"},children:[v," ",e("doctor.ok")]}),c.jsxs("span",{style:{color:"var(--revka-status-warning)"},children:[S," ",e("doctor.warn")]}),c.jsxs("span",{style:{color:"var(--revka-status-danger)"},children:[w," ",e("doctor.fail")]})]})]}),c.jsx("div",{className:"mt-4 space-y-2",children:x.map((N,C)=>c.jsx("div",{className:"rounded-[12px] border p-3",style:{borderColor:N.severity==="ok"?"color-mix(in srgb, var(--revka-status-success) 24%, transparent)":N.severity==="warn"?"color-mix(in srgb, var(--revka-status-warning) 24%, transparent)":"color-mix(in srgb, var(--revka-status-danger) 24%, transparent)"},children:c.jsxs("div",{className:"flex items-start gap-3",children:[_3e(N.severity),c.jsxs("div",{className:"min-w-0",children:[c.jsx("div",{className:"text-sm",style:{color:"var(--revka-text-primary)"},children:N.message}),c.jsx("div",{className:"mt-1 text-[10px] font-semibold uppercase tracking-[0.14em]",style:{color:"var(--revka-text-faint)"},children:N.severity})]})]})},`${_}-${C}`))})]},_)})})]})})]})}):c.jsx(st,{className:"p-5",children:c.jsx(Ct,{title:e("doctor.system_diag_title"),description:e("doctor.system_diag_desc"),action:c.jsx(BB,{className:"h-5 w-5",style:{color:"var(--revka-signal-network)"}})})})]})}function N2({label:e,value:n,tone:r,icon:i}){return c.jsxs("div",{className:"rounded-[14px] border p-3",style:{borderColor:"var(--revka-border-soft)",background:"color-mix(in srgb, var(--revka-bg-panel-strong) 88%, transparent)"},children:[c.jsxs("div",{className:"flex items-center gap-2 text-[10px] font-semibold uppercase tracking-[0.14em]",style:{color:"var(--revka-text-faint)"},children:[i,e]}),c.jsx("div",{className:"mt-2 text-2xl font-semibold",style:{color:r},children:n})]})}function b3e(){const{t:e,tpl:n}=cn(),[r,i]=b.useState([]),[s,a]=b.useState(!0),[o,l]=b.useState(null),[u,d]=b.useState("all"),[p,f]=b.useState(null),g=w=>{switch(w){case"Active":return{icon:Za,label:e("integrations.badge.active"),color:"var(--revka-signal-selected)",border:"color-mix(in srgb, var(--revka-signal-selected) 24%, transparent)",bg:"color-mix(in srgb, var(--revka-signal-selected) 10%, transparent)"};case"Available":return{icon:c0,label:e("integrations.badge.available"),color:"var(--revka-signal-network)",border:"color-mix(in srgb, var(--revka-signal-network) 24%, transparent)",bg:"color-mix(in srgb, var(--revka-signal-network) 10%, transparent)"};case"ComingSoon":return{icon:Lx,label:e("integrations.badge.coming_soon"),color:"var(--revka-text-faint)",border:"var(--revka-border-soft)",bg:"transparent"};default:return{icon:Lx,label:w,color:"var(--revka-text-faint)",border:"var(--revka-border-soft)",bg:"transparent"}}};b.useEffect(()=>{bQ().then(i).catch(w=>l(w.message)).finally(()=>a(!1))},[]);const _=b.useMemo(()=>["all",...Array.from(new Set(r.map(w=>w.category))).sort()],[r]),x=u==="all"?r:r.filter(w=>w.category===u),v=b.useMemo(()=>x.find(w=>w.name===p)??x[0]??null,[x,p]),S=b.useMemo(()=>({active:r.filter(w=>w.status==="Active").length,available:r.filter(w=>w.status==="Available").length,comingSoon:r.filter(w=>w.status==="ComingSoon").length}),[r]);return b.useEffect(()=>{var w;x.find(N=>N.name===p)||f(((w=x[0])==null?void 0:w.name)??null)},[x,p]),c.jsxs("div",{className:"flex min-h-[calc(100vh-6rem)] flex-col gap-3 lg:h-[calc(100vh-6rem)]",children:[c.jsx(si,{kicker:e("integrations.kicker"),title:e("integrations.title")}),o?c.jsx("div",{className:"text-sm",style:{color:"var(--revka-status-danger)"},children:o}):null,s?c.jsx("div",{className:"flex min-h-0 flex-1 items-center justify-center",children:c.jsx(Ct,{tone:"loading",title:e("integrations.loading")})}):c.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:min-h-0 lg:flex-1 lg:grid-cols-[18rem_minmax(0,1.15fr)_minmax(18rem,0.85fr)]",children:[c.jsxs("div",{className:"flex flex-col gap-4 lg:overflow-y-auto lg:min-h-0",children:[c.jsxs(st,{className:"p-4",variant:"secondary",children:[c.jsx("div",{className:"revka-kicker",children:e("integrations.coverage")}),c.jsxs("div",{className:"mt-4 grid gap-3 sm:grid-cols-3 xl:grid-cols-1",children:[c.jsx(E2,{label:e("integrations.metric.active"),value:S.active,tone:"var(--revka-signal-selected)"}),c.jsx(E2,{label:e("integrations.metric.available"),value:S.available,tone:"var(--revka-signal-network)"}),c.jsx(E2,{label:e("integrations.metric.coming_soon"),value:S.comingSoon,tone:"var(--revka-text-faint)"})]})]}),c.jsxs(st,{className:"p-4",variant:"secondary",children:[c.jsx("div",{className:"revka-kicker",children:e("integrations.categories")}),c.jsx("div",{className:"mt-3 space-y-2",children:_.map(w=>{const N=w==="all"?r.length:r.filter(C=>C.category===w).length;return c.jsx("button",{type:"button",className:"w-full rounded-[14px] border px-3 py-3 text-left transition",onClick:()=>d(w),style:{borderColor:u===w?"var(--revka-border-strong)":"var(--revka-border-soft)",background:u===w?"color-mix(in srgb, var(--revka-signal-selected) 14%, var(--revka-bg-panel-strong))":"color-mix(in srgb, var(--revka-bg-panel-strong) 94%, transparent)"},children:c.jsxs("div",{className:"flex items-center justify-between gap-3",children:[c.jsx("span",{className:"text-sm font-medium capitalize",children:w==="all"?e("integrations.category_all"):w}),c.jsx("span",{className:"text-xs",style:{color:"var(--revka-text-secondary)"},children:N})]})},w)})})]})]}),c.jsxs(st,{className:"p-5 lg:overflow-y-auto",children:[c.jsx("div",{className:"revka-kicker",children:e("integrations.workspace")}),c.jsx("h3",{className:"mt-2 text-lg font-semibold",children:u==="all"?e("integrations.all_integrations"):n("integrations.category_integrations",{category:u})}),c.jsx("div",{className:"mt-5 grid gap-3 grid-cols-1 md:grid-cols-2",children:x.length===0?c.jsx(Ct,{title:e("integrations.empty_title"),description:e("integrations.empty_desc")}):x.map(w=>{const N=g(w.status),C=N.icon;return c.jsxs("button",{type:"button",className:"rounded-[16px] border p-4 text-left transition",onClick:()=>f(w.name),style:{borderColor:(v==null?void 0:v.name)===w.name?"var(--revka-border-strong)":"var(--revka-border-soft)",background:(v==null?void 0:v.name)===w.name?"color-mix(in srgb, var(--revka-signal-selected) 14%, var(--revka-bg-panel-strong))":"color-mix(in srgb, var(--revka-bg-panel-strong) 94%, transparent)"},children:[c.jsxs("div",{className:"flex items-center justify-between gap-2",children:[c.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[c.jsx(DB,{className:"h-4 w-4 shrink-0",style:{color:"var(--revka-signal-network)"}}),c.jsx("h4",{className:"truncate text-sm font-semibold",style:{color:"var(--revka-text-primary)"},children:w.name})]}),c.jsxs("span",{className:"shrink-0 inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-[10px] font-semibold uppercase tracking-[0.12em]",style:{color:N.color,borderColor:N.border,background:N.bg},children:[c.jsx(C,{className:"h-3 w-3"}),N.label]})]}),c.jsx("p",{className:"mt-2 line-clamp-2 text-xs leading-5",style:{color:"var(--revka-text-secondary)"},children:w.description}),c.jsx("div",{className:"mt-2 text-[10px] font-semibold uppercase tracking-[0.14em]",style:{color:"var(--revka-text-faint)"},children:w.category})]},w.name)})})]}),c.jsxs("div",{className:"flex flex-col gap-4 lg:overflow-y-auto lg:min-h-0",children:[c.jsxs(st,{className:"p-4",variant:"utility",children:[c.jsx("div",{className:"revka-kicker",children:e("integrations.selected")}),v?c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[c.jsx(wJ,{className:"h-4 w-4",style:{color:"var(--revka-signal-network)"}}),c.jsx("div",{className:"text-sm font-semibold",style:{color:"var(--revka-text-primary)"},children:v.name})]}),c.jsx("p",{className:"mt-3 text-sm leading-6",style:{color:"var(--revka-text-secondary)"},children:v.description}),c.jsxs("div",{className:"mt-4 space-y-3",children:[c.jsx(A2,{label:e("integrations.detail.category"),value:v.category}),c.jsx(A2,{label:e("integrations.detail.status"),value:v.status==="ComingSoon"?e("integrations.badge.coming_soon"):v.status==="Active"?e("integrations.badge.active"):e("integrations.badge.available")}),c.jsx(A2,{label:e("integrations.detail.operational_readiness"),value:v.status==="Active"?e("integrations.readiness.active"):v.status==="Available"?e("integrations.readiness.available"):e("integrations.readiness.coming_soon")})]})]}):c.jsx("div",{className:"mt-4",children:c.jsx(Ct,{compact:!0,title:e("integrations.no_selected_title"),description:e("integrations.no_selected_desc")})})]}),c.jsxs(st,{className:"p-4",variant:"secondary",children:[c.jsx("div",{className:"revka-kicker",children:e("integrations.legend")}),c.jsxs("div",{className:"mt-3 space-y-3 text-sm leading-6",style:{color:"var(--revka-text-secondary)"},children:[c.jsx("p",{children:e("integrations.legend.p1")}),c.jsx("p",{children:e("integrations.legend.p2")}),c.jsx("p",{children:e("integrations.legend.p3")})]})]})]})]})]})}function E2({label:e,value:n,tone:r}){return c.jsxs("div",{className:"rounded-[14px] border p-3",style:{borderColor:"var(--revka-border-soft)",background:"color-mix(in srgb, var(--revka-bg-panel-strong) 88%, transparent)"},children:[c.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-[0.14em]",style:{color:"var(--revka-text-faint)"},children:e}),c.jsx("div",{className:"mt-2 text-xl font-semibold",style:{color:r},children:n})]})}function A2({label:e,value:n}){return c.jsxs("div",{className:"rounded-[12px] border p-3",style:{borderColor:"var(--revka-border-soft)"},children:[c.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-[0.14em]",style:{color:"var(--revka-text-faint)"},children:e}),c.jsx("div",{className:"mt-1 text-sm leading-6",style:{color:"var(--revka-text-primary)"},children:n})]})}const k3e=["Memory","Creative","Privacy","Graph","Behavioral","Other"];function w3e(){const{t:e,tpl:n}=cn(),[r,i]=b.useState([]),[s,a]=b.useState(!0),[o,l]=b.useState(null),[u,d]=b.useState(null),[p,f]=b.useState(!1),[g,_]=b.useState(null),[x,v]=b.useState(""),[S,w]=b.useState(null),[N,C]=b.useState(!1),[T,A]=b.useState(!1),[E,D]=b.useState(null),[F,B]=b.useState(""),[H,$]=b.useState([]),[z,W]=b.useState(!0),[P,q]=b.useState(null),[I,Q]=b.useState(""),[K,Z]=b.useState(!1),Y=async()=>(a(!0),pB(!0,1,100).then(ae=>{i(ae.skills),l(pe=>pe&&ae.skills.some(J=>J.kref===pe)?pe:null)}).catch(()=>i([])).finally(()=>a(!1))),R=async ae=>{W(!0),q(null);try{const pe=(ae==null?void 0:ae.trim())??"";let J;pe.length>1?J=await O3(pe,12):(J=await qQ(12),J.length===0&&(J=await O3("agent",12))),$(J)}catch(pe){console.error("ClawHub marketplace load failed:",pe),$([]),q(pe instanceof Error?pe.message:String(pe))}finally{W(!1)}};b.useEffect(()=>{Y(),R()},[]);const U=b.useMemo(()=>r.find(ae=>ae.kref===o)??null,[o,r]),V=b.useMemo(()=>!U&&!u?null:(u==null?void 0:u.kref)!==o?U:{...U,...u,deprecated:(U==null?void 0:U.deprecated)??u.deprecated,created_at:(U==null?void 0:U.created_at)??u.created_at},[u,o,U]);b.useEffect(()=>{if(!o){d(null),f(!1),_(null);return}let ae=!1;return f(!0),_(null),d(null),zQ(o).then(pe=>{ae||d(pe)}).catch(pe=>{ae||_(pe instanceof Error?pe.message:String(pe))}).finally(()=>{ae||f(!1)}),()=>{ae=!0}},[o]);const ie=b.useMemo(()=>{const ae=x.trim().toLowerCase();return ae?r.filter(pe=>pe.name.toLowerCase().includes(ae)||pe.description.toLowerCase().includes(ae)||pe.domain.toLowerCase().includes(ae)||pe.tags.some(J=>J.toLowerCase().includes(ae))):r},[x,r]),te=b.useMemo(()=>({total:r.length,active:r.filter(ae=>!ae.deprecated).length,deprecated:r.filter(ae=>ae.deprecated).length,domains:new Set(r.map(ae=>ae.domain)).size}),[r]),X=async ae=>{C(!0);try{if(S==="edit"&&V){const pe={...ae,kref:V.kref},J=await FQ(pe);await Y(),l(J.kref),D({tone:"success",message:n("skills.toast.updated",{name:J.name})})}else{const J=await $Q(ae);await Y(),l(J.kref),D({tone:"success",message:n("skills.toast.created",{name:J.name})})}w(null)}catch(pe){D({tone:"error",message:pe instanceof Error?pe.message:e("skills.err.save")})}finally{C(!1)}},se=async()=>{if(V)try{await HQ(V.kref,!V.deprecated),await Y(),D({tone:"success",message:n(V.deprecated?"skills.toast.reenabled":"skills.toast.deprecated",{name:V.name})})}catch(ae){D({tone:"error",message:ae instanceof Error?ae.message:e("skills.err.toggle")})}},re=async()=>{if(V){A(!0);try{const ae=V.name;await WQ(V.kref),l(null),await Y(),D({tone:"success",message:n("skills.toast.deleted",{name:ae})})}catch(ae){D({tone:"error",message:ae instanceof Error?ae.message:e("skills.err.delete")})}finally{A(!1)}}},de=async ae=>{try{const pe=await D3(ae);await Y(),D({tone:"success",message:n("skills.toast.installed",{name:pe.name})})}catch(pe){D({tone:"error",message:pe instanceof Error?pe.message:e("skills.err.install")})}},ue=async()=>{const ae=I.trim();if(ae){Z(!0);try{const pe=await D3(ae);await Y(),Q(""),D({tone:"success",message:n("skills.toast.installed_github",{name:pe.name})})}catch(pe){D({tone:"error",message:pe instanceof Error?pe.message:e("skills.err.install_github")})}finally{Z(!1)}}};return c.jsxs("div",{className:"flex h-[calc(100vh-6rem)] flex-col gap-3",children:[E?c.jsx(Qo,{tone:E.tone,message:E.message,onDismiss:()=>D(null)}):null,c.jsx(si,{kicker:e("skills.kicker"),title:e("skills.title"),actions:c.jsxs("button",{className:"revka-button","data-variant":"primary",onClick:()=>w("create"),children:[c.jsx(rs,{className:"h-4 w-4"}),e("skills.create_skill")]})}),c.jsxs("div",{className:"revka-skills-grid grid min-h-0 flex-1 gap-4",children:[c.jsxs("div",{className:"flex min-h-0 flex-col gap-4",children:[c.jsxs(st,{className:"p-4",variant:"secondary",children:[c.jsx("div",{className:"revka-kicker",children:e("skills.registry_status")}),c.jsxs("div",{className:"mt-3 grid grid-cols-2 gap-2 xl:grid-cols-4",children:[c.jsx(X_,{label:e("skills.summary.total"),value:te.total}),c.jsx(X_,{label:e("skills.summary.active"),value:te.active}),c.jsx(X_,{label:e("skills.summary.deprecated"),value:te.deprecated}),c.jsx(X_,{label:e("skills.summary.domains"),value:te.domains})]})]}),c.jsxs(st,{className:"flex min-h-0 flex-1 flex-col p-4",variant:"secondary",children:[c.jsxs("div",{className:"flex items-center justify-between gap-2",children:[c.jsx("div",{className:"revka-kicker",children:e("skills.index")}),c.jsxs("span",{className:"text-[11px]",style:{color:"var(--revka-text-faint)"},children:[ie.length," / ",r.length]})]}),c.jsxs("div",{className:"relative mt-3",children:[c.jsx(Aa,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2",style:{color:"var(--revka-text-faint)"}}),c.jsx("input",{value:x,onChange:ae=>v(ae.target.value),className:"revka-input pl-10",placeholder:e("skills.search_placeholder")})]}),c.jsx("div",{className:"mt-3 min-h-0 flex-1 space-y-2 overflow-y-auto pr-1",children:s?c.jsx(Ct,{compact:!0,tone:"loading",title:e("skills.loading")}):ie.length===0?c.jsx(Ct,{compact:!0,title:e("skills.no_skills_title"),description:e("skills.no_skills_desc")}):ie.map(ae=>c.jsx("button",{type:"button",onClick:()=>l(ae.kref),className:"w-full rounded-[14px] border px-3 py-3.5 text-left transition",style:{opacity:ae.deprecated?.65:1,borderColor:ae.kref===o?"var(--revka-border-strong)":"var(--revka-border-soft)",background:ae.kref===o?"color-mix(in srgb, var(--revka-signal-selected) 14%, var(--revka-bg-panel-strong))":"color-mix(in srgb, var(--revka-bg-panel-strong) 94%, transparent)"},children:c.jsxs("div",{className:"flex items-start gap-3",children:[c.jsx("div",{className:"mt-0.5 flex h-9 w-9 shrink-0 items-center justify-center rounded-[10px]",style:{background:"color-mix(in srgb, var(--revka-signal-network) 12%, transparent)",color:"var(--revka-signal-network)"},children:c.jsx(iu,{className:"h-4 w-4"})}),c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsxs("div",{className:"flex items-start justify-between gap-2",children:[c.jsx("div",{className:"text-sm font-semibold leading-5",style:{color:"var(--revka-text-primary)"},children:ae.name}),c.jsx("span",{className:"shrink-0 rounded-full px-2 py-0.5 text-[10px] font-semibold uppercase tracking-[0.12em]",style:{background:ae.deprecated?"color-mix(in srgb, var(--revka-status-warning) 12%, transparent)":"color-mix(in srgb, var(--revka-signal-selected) 12%, transparent)",color:ae.deprecated?"var(--revka-status-warning)":"var(--revka-signal-selected)"},children:ae.deprecated?e("skills.status.deprecated"):e("skills.status.active")})]}),c.jsx("div",{className:"mt-1 text-xs",style:{color:"var(--revka-text-secondary)"},children:ae.domain}),c.jsx("div",{className:"mt-1.5 line-clamp-2 text-[11px] leading-4",style:{color:"var(--revka-text-faint)"},children:ae.description})]})]})},ae.kref))})]})]}),c.jsxs(st,{className:"overflow-y-auto p-5",children:[c.jsx("div",{className:"revka-kicker",children:e("skills.workspace")}),c.jsx("h3",{className:"mt-2 text-lg font-semibold",children:(V==null?void 0:V.name)??e("skills.select_placeholder")}),V?c.jsxs("div",{className:"mt-4 space-y-4",children:[c.jsxs("div",{className:"flex items-start justify-between gap-3",children:[c.jsxs("div",{children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(iu,{className:"h-4 w-4",style:{color:"var(--revka-signal-network)"}}),c.jsx("div",{className:"text-sm font-semibold",style:{color:"var(--revka-text-primary)"},children:V.name})]}),c.jsxs("div",{className:"mt-1 text-xs",style:{color:"var(--revka-text-secondary)"},children:[V.domain," · rev ",V.revision_number," · ",new Date(V.created_at).toLocaleDateString()]})]}),c.jsx("span",{className:"rounded-full px-2.5 py-1 text-[10px] font-semibold uppercase tracking-[0.12em]",style:{background:V.deprecated?"color-mix(in srgb, var(--revka-status-warning) 12%, transparent)":"color-mix(in srgb, var(--revka-signal-selected) 12%, transparent)",color:V.deprecated?"var(--revka-status-warning)":"var(--revka-signal-selected)"},children:V.deprecated?e("skills.status.deprecated"):e("skills.status.active")})]}),c.jsxs("div",{className:"flex flex-wrap gap-2",children:[c.jsx("span",{className:"rounded-full px-2.5 py-1 text-[10px] font-semibold uppercase tracking-[0.12em]",style:{background:"var(--revka-signal-selected-soft, color-mix(in srgb, var(--revka-signal-selected) 18%, transparent))",color:"var(--revka-signal-selected)"},children:V.domain}),V.tags.map(ae=>c.jsx("span",{className:"rounded-full border px-2 py-1 text-[10px] font-semibold uppercase tracking-[0.12em]",style:{borderColor:"var(--revka-border-soft)",color:"var(--revka-text-secondary)"},children:ae},ae))]}),c.jsxs(st,{className:"p-4",variant:"utility",children:[c.jsx("div",{className:"revka-kicker",children:e("skills.description")}),c.jsx("div",{className:"mt-3 text-sm leading-6",style:{color:"var(--revka-text-secondary)"},children:V.description})]}),c.jsxs("div",{children:[c.jsx("div",{className:"revka-kicker",children:e("skills.content")}),p?c.jsx("div",{className:"mt-2 rounded-[14px] border p-4",style:{borderColor:"var(--revka-border-soft)",background:"color-mix(in srgb, var(--revka-bg-panel-strong) 94%, transparent)"},children:c.jsx(Ct,{compact:!0,tone:"loading",title:e("skills.loading")})}):g?c.jsx("div",{className:"mt-2 rounded-[14px] border p-4",style:{borderColor:"var(--revka-border-soft)",background:"color-mix(in srgb, var(--revka-bg-panel-strong) 94%, transparent)"},children:c.jsx(Ct,{compact:!0,tone:"error",title:e("skills.err.load_detail"),description:g})}):u!=null&&u.content.trim()?c.jsx("div",{className:"chat-markdown mt-2 max-h-[24rem] overflow-auto rounded-[14px] border p-4 text-sm leading-6",style:{borderColor:"var(--revka-border-soft)",color:"var(--revka-text-secondary)",background:"color-mix(in srgb, var(--revka-bg-panel-strong) 94%, transparent)"},children:c.jsx(VE,{remarkPlugins:[XE],children:u.content})}):c.jsx("div",{className:"mt-2 rounded-[14px] border p-4",style:{borderColor:"var(--revka-border-soft)",background:"color-mix(in srgb, var(--revka-bg-panel-strong) 94%, transparent)"},children:c.jsx(Ct,{compact:!0,title:e("skills.content"),description:e("skills.content_empty")})})]}),c.jsxs("div",{className:"flex gap-2",children:[c.jsxs("button",{className:"revka-button",onClick:()=>w("edit"),disabled:p||!u,children:[c.jsx(iv,{className:"h-4 w-4"}),e("skills.edit")]}),c.jsxs("button",{className:"revka-button",onClick:se,children:[c.jsx(r0,{className:"h-4 w-4"}),V.deprecated?e("skills.reenable"):e("skills.deprecate")]}),c.jsxs("button",{className:"revka-button",onClick:re,disabled:T,children:[c.jsx(Wi,{className:"h-4 w-4"}),e(T?"skills.deleting":"skills.delete")]})]})]}):c.jsx("div",{className:"mt-4",children:c.jsx(Ct,{title:e("skills.no_selected_title"),description:e("skills.no_selected_desc")})})]}),c.jsxs("div",{className:"flex min-h-0 flex-col gap-4",children:[c.jsxs(st,{className:"p-4",variant:"utility",children:[c.jsx("div",{className:"revka-kicker",children:e("skills.install_github")}),c.jsx("p",{className:"mt-2 text-xs leading-5",style:{color:"var(--revka-text-secondary)"},children:e("skills.install_github_desc")}),c.jsxs("div",{className:"mt-3 flex gap-2",children:[c.jsxs("div",{className:"relative min-w-0 flex-1",children:[c.jsx(CB,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2",style:{color:"var(--revka-text-faint)"}}),c.jsx("input",{className:"revka-input pl-10",value:I,onChange:ae=>Q(ae.target.value),onKeyDown:ae=>{ae.key==="Enter"&&ue()},placeholder:e("skills.github_placeholder")})]}),c.jsx("button",{className:"revka-button shrink-0","data-variant":"primary",disabled:!I.trim()||K,onClick:ue,children:e(K?"skills.installing":"skills.install")})]})]}),c.jsxs(st,{className:"flex min-h-0 flex-1 flex-col p-4",variant:"utility",children:[c.jsxs("div",{className:"flex items-center justify-between gap-3",children:[c.jsx("div",{className:"revka-kicker",children:e("skills.marketplace")}),c.jsx("div",{className:"text-xs",style:{color:"var(--revka-text-secondary)"},children:n("skills.marketplace_shown",{count:H.length})})]}),c.jsxs("div",{className:"relative mt-3",children:[c.jsx(Aa,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2",style:{color:"var(--revka-text-faint)"}}),c.jsx("input",{className:"revka-input pl-10",value:F,onChange:ae=>B(ae.target.value),onKeyDown:ae=>{ae.key==="Enter"&&R(F)},placeholder:e("skills.marketplace_placeholder")})]}),c.jsxs("div",{className:"mt-3 flex gap-2",children:[c.jsx("button",{className:"revka-button",onClick:()=>R(F),children:e("skills.search")}),c.jsx("button",{className:"revka-button",onClick:()=>{B(""),R()},children:e("skills.trending")})]}),c.jsx("div",{className:"mt-3 min-h-0 flex-1 space-y-2 overflow-y-auto pr-1",children:z?c.jsx(Ct,{compact:!0,tone:"loading",title:e("skills.marketplace_loading")}):P?c.jsx(Ct,{compact:!0,tone:"error",title:e("skills.marketplace_empty"),description:P}):H.length===0?c.jsx(Ct,{compact:!0,title:e("skills.marketplace_empty")}):H.map(ae=>c.jsx("div",{className:"rounded-[12px] border p-3",style:{borderColor:"var(--revka-border-soft)"},children:c.jsxs("div",{className:"flex items-start justify-between gap-2",children:[c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsx("div",{className:"truncate text-sm font-semibold",style:{color:"var(--revka-text-primary)"},children:ae.displayName||ae.name||ae.slug}),c.jsx("div",{className:"mt-1 line-clamp-2 text-xs",style:{color:"var(--revka-text-secondary)"},children:ae.description})]}),c.jsx("button",{className:"revka-button shrink-0",onClick:()=>de(ae.slug),children:e("skills.install")})]})},ae.slug))})]})]})]}),S?c.jsx(S3e,{skill:S==="edit"?V:null,saving:N,onClose:()=>w(null),onSave:X}):null]})}function X_({label:e,value:n}){return c.jsxs("div",{className:"rounded-[14px] border p-3",style:{borderColor:"var(--revka-border-soft)",background:"color-mix(in srgb, var(--revka-bg-panel-strong) 88%, transparent)"},children:[c.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-[0.14em]",style:{color:"var(--revka-text-faint)"},children:e}),c.jsx("div",{className:"mt-2 text-xl font-semibold",style:{color:"var(--revka-text-primary)"},children:n})]})}function S3e({skill:e,saving:n,onClose:r,onSave:i}){const{t:s}=cn(),[a,o]=b.useState((e==null?void 0:e.name)??""),[l,u]=b.useState((e==null?void 0:e.description)??""),[d,p]=b.useState((e==null?void 0:e.content)??""),[f,g]=b.useState((e==null?void 0:e.domain)??"Other"),[_,x]=b.useState((e==null?void 0:e.tags.join(", "))??"");return b.useEffect(()=>{o((e==null?void 0:e.name)??""),u((e==null?void 0:e.description)??""),p((e==null?void 0:e.content)??""),g((e==null?void 0:e.domain)??"Other"),x((e==null?void 0:e.tags.join(", "))??"")},[e==null?void 0:e.content,e==null?void 0:e.description,e==null?void 0:e.domain,e==null?void 0:e.name,e==null?void 0:e.tags]),c.jsx(yu,{title:s(e?"skills.modal.edit_title":"skills.modal.create_title"),description:s("skills.modal.description"),onClose:r,children:c.jsxs("div",{className:"grid gap-4",children:[c.jsx("input",{className:"revka-input",value:a,onChange:v=>o(v.target.value),placeholder:s("skills.modal.name_placeholder")}),c.jsx("textarea",{className:"revka-input min-h-24",value:l,onChange:v=>u(v.target.value),placeholder:s("skills.modal.description_placeholder")}),c.jsx("select",{className:"revka-input",value:f,onChange:v=>g(v.target.value),children:k3e.map(v=>c.jsx("option",{value:v,children:v},v))}),c.jsx("input",{className:"revka-input",value:_,onChange:v=>x(v.target.value),placeholder:s("skills.modal.tags_placeholder")}),c.jsx("textarea",{className:"revka-input min-h-72",value:d,onChange:v=>p(v.target.value),placeholder:s("skills.modal.content_placeholder"),style:{fontFamily:"var(--pc-font-mono)"}}),c.jsxs("div",{className:"flex justify-end gap-3",children:[c.jsx("button",{className:"revka-button",onClick:r,children:s("skills.modal.cancel")}),c.jsx("button",{className:"revka-button","data-variant":"primary",disabled:!a.trim()||!l.trim()||!d.trim()||n,onClick:()=>i({name:a.trim(),description:l.trim(),content:d,domain:f,tags:_.split(",").map(v=>v.trim()).filter(Boolean)}),children:s(n?"skills.modal.saving":e?"skills.modal.save_skill":"skills.create_skill")})]})]})})}function zV(e){return e instanceof Error?e.message:String(e)}function GI({skin:e,mode:n}){const r=e.manifest.modes[n],i=(r==null?void 0:r.tokens)??{},s=(r==null?void 0:r.assets)??{},a=r!=null&&r.preview?zm(e.id,r.preview):s.dashboardShowcase?zm(e.id,s.dashboardShowcase):s.dashboardHero?zm(e.id,s.dashboardHero):null,o=i["--revka-bg-base"]??(n==="light"?"#eef1f5":"#0b0d10"),l=i["--revka-bg-surface"]??(n==="light"?"#f7f9fb":"#13161d"),u=i["--revka-text-primary"]??(n==="light"?"#111827":"#f7f8fc"),d=i["--revka-signal-live"]??(n==="light"?"#4f75a8":"#8fa8c8");return c.jsxs("div",{className:"overflow-hidden rounded-[12px] border",style:{borderColor:"var(--revka-border-soft)",background:o,color:u},children:[c.jsx("div",{className:"h-20 bg-cover bg-center",style:{backgroundImage:a?`url("${a.replace(/"/g,"%22")}")`:`linear-gradient(135deg, ${d}33, transparent)`}}),c.jsxs("div",{className:"space-y-2 p-3",style:{background:l},children:[c.jsxs("div",{className:"flex items-center justify-between gap-2",children:[c.jsx("span",{className:"text-xs font-semibold uppercase tracking-[0.14em]",children:n}),c.jsx("span",{className:"h-3 w-3 rounded-full",style:{background:d}})]}),c.jsx("div",{className:"grid grid-cols-4 gap-1.5",children:Object.entries(i).slice(0,4).map(([p,f])=>c.jsx("span",{className:"h-5 rounded-[6px] border",style:{background:f,borderColor:"rgba(0,0,0,0.08)"},title:`${p}: ${f}`},p))})]})]})}function C3e({skin:e}){const{activeSkinId:n,setSkin:r,deleteSkin:i}=Ta(),[s,a]=b.useState(!1),[o,l]=b.useState(null),u=n===e.id,d=async()=>{a(!0),l(null);try{await i(e.id)}catch(p){l(zV(p))}finally{a(!1)}};return c.jsx(st,{className:"p-4",children:c.jsxs("div",{className:"flex flex-col gap-4",children:[c.jsxs("div",{className:"flex items-start justify-between gap-3",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsx("div",{className:"revka-kicker",children:e.id}),c.jsx("h3",{className:"mt-1 truncate text-lg font-semibold",style:{color:"var(--revka-text-primary)"},children:e.name}),c.jsxs("p",{className:"mt-1 text-xs",style:{color:"var(--revka-text-faint)"},children:["v",e.version,e.builtin?" · Built-in":""]})]}),u?c.jsxs("span",{className:"revka-status-pill",style:{color:"var(--revka-signal-live)"},children:[c.jsx(Za,{className:"h-3.5 w-3.5"}),"Active"]}):null]}),c.jsxs("div",{className:"grid gap-3 md:grid-cols-2",children:[c.jsx(GI,{skin:e,mode:"light"}),c.jsx(GI,{skin:e,mode:"dark"})]}),o?c.jsx("div",{className:"rounded-[10px] border px-3 py-2 text-sm",style:{borderColor:"var(--revka-status-danger)",color:"var(--revka-status-danger)"},children:o}):null,c.jsxs("div",{className:"flex flex-wrap gap-2",children:[c.jsxs("button",{type:"button",className:"revka-button text-sm",onClick:()=>r(u?null:e.id),disabled:s,children:[u?c.jsx(dE,{className:"h-4 w-4"}):c.jsx(Za,{className:"h-4 w-4"}),u?"Deactivate":"Activate"]}),e.builtin?null:c.jsxs("button",{type:"button",className:"revka-button text-sm",onClick:d,disabled:s,children:[c.jsx(Wi,{className:"h-4 w-4"}),"Delete"]})]})]})})}function j3e(){const{installedSkins:e,skinsLoading:n,importSkinZip:r,refreshSkins:i}=Ta(),[s,a]=b.useState(!1),[o,l]=b.useState(!1),[u,d]=b.useState(null),p=b.useCallback(async g=>{if(g){l(!0),d(null);try{await r(g)}catch(_){d(zV(_))}finally{l(!1)}}},[r]),f=g=>{g.preventDefault(),a(!1),p(g.dataTransfer.files[0])};return c.jsxs("div",{className:"space-y-4",children:[c.jsx(si,{kicker:"Appearance",title:"Skins",actions:c.jsxs("button",{type:"button",className:"revka-button text-sm",onClick:()=>void i(),disabled:n,children:[c.jsx($r,{className:`h-4 w-4 ${n?"animate-spin":""}`}),"Refresh"]})}),c.jsxs(st,{className:"p-5",children:[c.jsxs("label",{className:"flex min-h-36 cursor-pointer flex-col items-center justify-center rounded-[12px] border border-dashed px-4 py-6 text-center transition",style:{borderColor:s?"var(--revka-border-strong)":"var(--revka-border-soft)",background:s?"var(--revka-signal-live-soft)":"var(--revka-bg-surface)"},onDragEnter:g=>{g.preventDefault(),a(!0)},onDragOver:g=>g.preventDefault(),onDragLeave:()=>a(!1),onDrop:f,children:[c.jsx(nJ,{className:"h-7 w-7",style:{color:"var(--revka-signal-network)"}}),c.jsx("span",{className:"mt-3 text-sm font-semibold",style:{color:"var(--revka-text-primary)"},children:o?"Importing ZIP...":"Upload skin ZIP"}),c.jsx("span",{className:"mt-1 text-xs",style:{color:"var(--revka-text-faint)"},children:"revka-skin.json, tokens, and local image assets"}),c.jsx("input",{className:"sr-only",type:"file",accept:".zip,application/zip",disabled:o,onChange:g=>{var _;p((_=g.currentTarget.files)==null?void 0:_[0]),g.currentTarget.value=""}})]}),u?c.jsx("div",{className:"mt-4 rounded-[10px] border px-3 py-2 text-sm",style:{borderColor:"var(--revka-status-danger)",color:"var(--revka-status-danger)"},"aria-live":"polite",children:u}):null]}),c.jsx("div",{className:"grid gap-4 xl:grid-cols-2",children:e.map(g=>c.jsx(C3e,{skin:g},g.id))}),!n&&e.length===0?c.jsx(st,{className:"p-5",variant:"utility",children:c.jsx("div",{className:"text-sm",style:{color:"var(--revka-text-secondary)"},children:"No skins installed."})}):null]})}function XI(e){let n=!1,r=!1;for(let i=0;i<e.length;i+=1){const s=e[i];if(s==="'"&&!r)n=!n;else if(s==='"'&&!n)r=!r;else if(s==="#"&&!n&&!r)return e.slice(0,i).trimEnd()}return e}function Bm(e){const n=e.trim();return n==="true"?!0:n==="false"?!1:/^-?\d+$/.test(n)?parseInt(n,10):/^-?\d+\.\d+$/.test(n)?parseFloat(n):n.startsWith('"')&&n.endsWith('"')||n.startsWith("'")&&n.endsWith("'")?n.slice(1,-1):n}function N3e(e){const n=e.trim();if(!n.startsWith("[")||!n.endsWith("]"))return[];const r=n.slice(1,-1).trim();return r?r.split(",").map(i=>{const s=i.trim();return s.startsWith('"')&&s.endsWith('"')||s.startsWith("'")&&s.endsWith("'")?s.slice(1,-1):s}).filter(i=>i.length>0):[]}function QI(e){const n=e.trim();if(!n.startsWith("{")||!n.endsWith("}"))return{};const r=n.slice(1,-1).trim();if(!r)return{};const i={},s=[];let a="",o=!1,l=!1;for(let u=0;u<r.length;u+=1){const d=r[u];d==="'"&&!l?o=!o:d==='"'&&!o&&(l=!l),d===","&&!o&&!l?(s.push(a),a=""):a+=d}a.trim()&&s.push(a);for(const u of s){const d=u.indexOf("=");if(d===-1)continue;const p=u.slice(0,d).trim(),f=u.slice(d+1).trim(),g=Bm(f);i[p]=typeof g=="string"?g:String(g)}return i}function nf(e){return`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function E3e(e){return e.length===0?"[]":`[${e.map(nf).join(", ")}]`}function ZI(e){const n=Object.entries(e).filter(([r])=>r.length>0);return n.length===0?"{}":`{ ${n.map(([r,i])=>`${r} = ${nf(i)}`).join(", ")} }`}function A3e(e){const n=e.split(`
`),r={enabled:!1,deferred_loading:!1,servers:[]};let i="none",s=null;const a=()=>{if(s){const o=s.transport??"stdio";r.servers.push({...s,name:s.name??"",transport:o})}s=null};for(let o=0;o<n.length;o+=1){const u=n[o].trim();if(!u||u.startsWith("#"))continue;if(u==="[[mcp.servers]]"){a(),i="server",s={};continue}const d=u.match(/^\[([^\]]+)\]$/);if(d){a(),i=d[1].trim()==="mcp"?"mcp":"none";continue}if(i==="none")continue;const p=u.match(/^([A-Za-z0-9_\-.]+)\s*=\s*(.+)$/);if(!p)continue;const f=p[1];let g=XI(p[2]);if(g.trim().startsWith("[")&&!g.trim().endsWith("]")){let _=g.trim();for(let x=o+1;x<n.length;x+=1){o=x;const v=XI(n[x]).trim();if(_+=` ${v}`,v.endsWith("]"))break}g=_}if(i==="mcp"){if(f==="enabled"){const _=Bm(g);r.enabled=_===!0}else if(f==="deferred_loading"){const _=Bm(g);r.deferred_loading=_===!0}continue}if(i==="server"&&s)switch(f){case"name":case"command":case"url":case"transport":{const _=Bm(g);s[f]=typeof _=="string"?_:String(_);break}case"args":{s.args=N3e(g);break}case"timeout_ms":{const _=Bm(g);typeof _=="number"&&(s.timeout_ms=_);break}case"env":{s.env=QI(g);break}case"headers":{s.headers=QI(g);break}}}return a(),r}function T3e(e){const n=e.split(`
`);let r=-1,i=n.length;for(let l=0;l<n.length;l+=1){const u=n[l].trim();(u==="[mcp]"||u==="[[mcp.servers]]")&&r===-1&&(r=l)}if(r===-1)return{before:e,after:""};for(let l=r+1;l<n.length;l+=1){const d=n[l].trim().match(/^\[\[?([^\]]+)\]?\]$/);if(d){const p=d[1].trim();if(p!=="mcp"&&!p.startsWith("mcp.")){i=l;break}}}let s=r;for(;s>0&&n[s-1].trim()==="";)s-=1;const a=n.slice(0,s).join(`
`),o=n.slice(i).join(`
`);return{before:a,after:o}}function M3e(e){const n=[];n.push("[mcp]"),n.push(`enabled = ${e.enabled?"true":"false"}`),n.push(`deferred_loading = ${e.deferred_loading?"true":"false"}`);for(const r of e.servers)n.push(""),n.push("[[mcp.servers]]"),n.push(`name = ${nf(r.name)}`),n.push(`transport = ${nf(r.transport)}`),r.transport==="stdio"?(r.command!==void 0&&n.push(`command = ${nf(r.command)}`),r.args&&r.args.length>0&&n.push(`args = ${E3e(r.args)}`),r.env&&Object.keys(r.env).length>0&&n.push(`env = ${ZI(r.env)}`)):(r.url!==void 0&&n.push(`url = ${nf(r.url)}`),r.headers&&Object.keys(r.headers).length>0&&n.push(`headers = ${ZI(r.headers)}`),typeof r.timeout_ms=="number"&&n.push(`timeout_ms = ${r.timeout_ms}`));return n.join(`
`)}function R3e(e,n){const{before:r,after:i}=T3e(e),s=M3e(n),a=[];r.trim().length>0&&(a.push(r.replace(/\s+$/,"")),a.push("")),a.push(s),i.trim().length>0&&(a.push(""),a.push(i.replace(/^\s+/,"")));let o=a.join(`
`);return o.endsWith(`
`)||(o+=`
`),o}function O3e(e){const n={},r=new Map;return e.forEach((i,s)=>{const a={},o=i.name.trim();o?r.has(o)?a.name=`Duplicate name (also used by entry ${r.get(o)+1})`:r.set(o,s):a.name="Name is required",i.transport==="stdio"?(!i.command||!i.command.trim())&&(a.command="Command is required for stdio transport"):(!i.url||!i.url.trim())&&(a.url="URL is required for http/sse transport"),(a.name||a.command||a.url)&&(n[s]=a)}),n}function D3e(e){return Object.keys(e).length>0}function $V(e){let n=!1,r=!1;for(let i=0;i<e.length;i+=1){const s=e[i];if(s==="'"&&!r)n=!n;else if(s==='"'&&!n)r=!r;else if(s==="#"&&!n&&!r)return i}return-1}function P3e(e){const n=e.trim();if(n==="true")return!0;if(n==="false")return!1;if(/^-?\d+$/.test(n))return parseInt(n,10);if(/^-?\d+\.\d+$/.test(n))return parseFloat(n);if(n.startsWith('"')&&n.endsWith('"')||n.startsWith("'")&&n.endsWith("'"))return n.slice(1,-1);if(n.startsWith("[")&&n.endsWith("]")){const r=n.slice(1,-1).trim();return r?r.split(",").map(i=>{const s=i.trim();return s.startsWith('"')&&s.endsWith('"')||s.startsWith("'")&&s.endsWith("'")?s.slice(1,-1):s}):[]}return n}function L3e(e){const n={"":{}};let r="";const i=e.split(`
`);for(let a=0;a<i.length;a+=1){const o=i[a].trim();if(!o||o.startsWith("#"))continue;const l=o.match(/^\[([^\]]+)\]$/);if(l){r=l[1].trim(),n[r]||(n[r]={});continue}const u=o.match(/^([A-Za-z0-9_\-.]+)\s*=\s*(.+)$/);if(!u)continue;const d=u[1];let p=u[2];const f=$V(p);f!==-1&&(p=p.slice(0,f).trimEnd());const g=p.trim();if(g.startsWith("[")&&!g.includes("]")){let _=g;for(let x=a+1;x<i.length;x+=1){a=x;const v=i[x].trim();if(_+=` ${v}`,v.endsWith("]"))break}p=_}n[r]||(n[r]={}),n[r][d]=P3e(p)}const s={};Object.assign(s,n[""]??{});for(const[a,o]of Object.entries(n)){if(a==="")continue;const l=a.split(".");let u=s;for(let d=0;d<l.length;d+=1){const p=l[d];d===l.length-1?((!u[p]||typeof u[p]!="object")&&(u[p]={}),Object.assign(u[p],o)):((!u[p]||typeof u[p]!="object")&&(u[p]={}),u=u[p])}}return s}function JI(e){const n=e.trim();return n==="true"||n==="false"?`<span style="color:var(--revka-signal-selected)">${e}</span>`:/^-?\d[\d_]*(\.[\d_]*)?([eE][+-]?\d+)?$/.test(n)?`<span style="color:var(--revka-status-warning)">${e}</span>`:n.startsWith('"')||n.startsWith("'")?`<span style="color:var(--revka-status-success)">${e}</span>`:n.startsWith("[")||n.startsWith("{")?`<span style="color:var(--revka-text-primary)">${e}</span>`:e}function I3e(e){const n=e.trim(),r=$V(n);if(r!==-1){const i=n.slice(0,r).trimEnd(),s=`<span style="color:#6b7280;font-style:italic">${n.slice(r)}</span>`;return`${e.slice(0,e.indexOf(n))}${JI(i)} ${s}`}return JI(e)}function B3e(e){const n=[];for(const r of e.split(`
`)){const i=r.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");if(/^\s*\[/.test(i)){n.push(`<span style="color:var(--revka-signal-network);font-weight:600">${i}</span>`);continue}if(/^\s*#/.test(i)){n.push(`<span style="color:#6b7280;font-style:italic">${i}</span>`);continue}const s=i.match(/^(\s*)([A-Za-z0-9_\-.]+)(\s*=\s*)(.*)$/);if(s){const[,a,o,l,u]=s;n.push(`${a}<span style="color:var(--revka-signal-selected)">${o}</span><span style="color:var(--revka-text-faint)">${l}</span>${I3e(u??"")}`);continue}n.push(i)}return`${n.join(`
`)}
`}function z3e(e){return typeof e=="boolean"?e?"true":"false":typeof e=="number"?String(e):JSON.stringify(e)}function $3e(e,n,r,i){var d;const s=e.split(`
`),a=`${r} = ${z3e(i)}`;if(!n){const p=s.findIndex(g=>g.trim().startsWith("[")),f=p===-1?s.length:p;for(let g=0;g<f;g+=1)if(new RegExp(`^\\s*${r}\\s*=`).test(s[g]??""))return s[g]=a,s.join(`
`);return s.splice(f,0,a),s.join(`
`)}const o=`[${n}]`,l=s.findIndex(p=>p.trim()===o);if(l===-1){const p=e.endsWith(`
`)||e.length===0?"":`
`;return`${e}${p}${e.trim()?`
`:""}${o}
${a}
`}let u=s.length;for(let p=l+1;p<s.length;p+=1)if((d=s[p])!=null&&d.trim().startsWith("[")){u=p;break}for(let p=l+1;p<u;p+=1)if(new RegExp(`^\\s*${r}\\s*=`).test(s[p]??""))return s[p]=a,s.join(`
`);return s.splice(u,0,a),s.join(`
`)}function Ph(e){return e.filter(n=>n!==void 0&&n!=="").length}function FV(e){return e==null||e===""?0:Array.isArray(e)?e.length>0?1:0:typeof e=="object"?Object.values(e).reduce((n,r)=>n+FV(r),0):1}const F3e=new Set(["agent","memory","kumiho","gateway","autonomy","security","cost","channels_config","mcp","operator"]);function H3e(e){if(!e)return[];const n=[];for(const[r,i]of Object.entries(e))F3e.has(r)||i===null||typeof i!="object"||Array.isArray(i)||n.push({id:`ext:${r}`,path:r,data:i});return n.sort((r,i)=>r.path.localeCompare(i.path))}function W3e(e,n,r,i,s){var l,u,d,p,f,g,_,x,v,S,w,N,C,T,A,E,D,F,B,H,$,z,W,P,q,I,Q,K,Z,Y,R;const a=[{id:"provider",title:i("config.section.provider"),description:i("config.section.provider_desc"),populatedCount:Ph([e==null?void 0:e.default_provider,e==null?void 0:e.default_model,e==null?void 0:e.default_temperature,e==null?void 0:e.provider_timeout_secs,e==null?void 0:e.provider_max_tokens]),paths:["default_provider","default_model","default_temperature","provider_timeout_secs","provider_max_tokens"]},{id:"agent",title:i("config.section.agent"),description:i("config.section.agent_desc"),populatedCount:Ph([(l=e==null?void 0:e.agent)==null?void 0:l.max_tool_iterations,(u=e==null?void 0:e.agent)==null?void 0:u.max_context_tokens,(d=e==null?void 0:e.agent)==null?void 0:d.max_history_messages,(f=(p=e==null?void 0:e.agent)==null?void 0:p.model_context_windows)==null?void 0:f["gpt-5_5"],(g=e==null?void 0:e.agent)==null?void 0:g.context_window_safety_ratio,(_=e==null?void 0:e.agent)==null?void 0:_.parallel_tools,(v=(x=e==null?void 0:e.agent)==null?void 0:x.thinking)==null?void 0:v.default_level]),paths:["agent.max_tool_iterations","agent.max_context_tokens","agent.max_history_messages","agent.model_context_windows","agent.context_window_safety_ratio","agent.parallel_tools","agent.thinking.default_level"]},{id:"memory",title:i("config.section.memory"),description:i("config.section.memory_desc"),populatedCount:Ph([(S=e==null?void 0:e.memory)==null?void 0:S.backend,(w=e==null?void 0:e.memory)==null?void 0:w.auto_save,(N=e==null?void 0:e.memory)==null?void 0:N.snapshot_enabled,(C=e==null?void 0:e.kumiho)==null?void 0:C.enabled,(T=e==null?void 0:e.kumiho)==null?void 0:T.memory_project,(A=e==null?void 0:e.kumiho)==null?void 0:A.memory_retrieval_limit]),paths:["memory.backend","memory.auto_save","memory.snapshot_enabled","kumiho.enabled","kumiho.memory_project","kumiho.harness_project","kumiho.memory_retrieval_limit"]},{id:"runtime",title:i("config.section.runtime"),description:i("config.section.runtime_desc"),populatedCount:Ph([(E=e==null?void 0:e.gateway)==null?void 0:E.host,(D=e==null?void 0:e.gateway)==null?void 0:D.port,(F=e==null?void 0:e.gateway)==null?void 0:F.require_pairing,(B=e==null?void 0:e.autonomy)==null?void 0:B.level,(H=e==null?void 0:e.autonomy)==null?void 0:H.max_actions_per_hour]),paths:["gateway.host","gateway.port","gateway.require_pairing","gateway.session_persistence","autonomy.level","autonomy.max_actions_per_hour"]},{id:"security",title:i("config.section.security"),description:i("config.section.security_desc"),populatedCount:Ph([(z=($=e==null?void 0:e.security)==null?void 0:$.audit)==null?void 0:z.enabled,(P=(W=e==null?void 0:e.security)==null?void 0:W.sandbox)==null?void 0:P.backend,(q=e==null?void 0:e.cost)==null?void 0:q.daily_limit_usd,(I=e==null?void 0:e.cost)==null?void 0:I.monthly_limit_usd,(Q=e==null?void 0:e.cost)==null?void 0:Q.warn_at_percent]),paths:["security.audit.enabled","security.sandbox.backend","cost.daily_limit_usd","cost.monthly_limit_usd","cost.warn_at_percent"]},{id:"channels",title:i("config.section.channels"),description:i("config.section.channels_desc"),populatedCount:Ph([(K=e==null?void 0:e.channels_config)==null?void 0:K.cli,(Z=e==null?void 0:e.channels_config)==null?void 0:Z.ack_reactions,(Y=e==null?void 0:e.channels_config)==null?void 0:Y.show_tool_calls,(R=e==null?void 0:e.channels_config)==null?void 0:R.message_timeout_secs]),paths:["channels_config.cli","channels_config.ack_reactions","channels_config.show_tool_calls","channels_config.message_timeout_secs"]},{id:"mcp",title:i("config.section.mcp"),description:i("config.section.mcp_desc"),populatedCount:(r?1:0)+n,paths:["mcp.enabled","mcp.deferred_loading","mcp.servers[]"]}],o=s.map(U=>({id:U.id,title:`[${U.path}]`,description:i("config.section.extra_desc"),populatedCount:FV(U.data),paths:[U.path]}));return[...a,...o]}function q3e(){var W,P,q,I,Q,K,Z,Y,R,U,V,ie,te,X,se,re,de,ue,ae,pe,J,me,fe,ve,Ke,ge,Ue,$e,Bt;const{t:e,tpl:n}=cn(),[r,i]=b.useState(""),[s,a]=b.useState(!0),[o,l]=b.useState(!1),[u,d]=b.useState(!0),[p,f]=b.useState("structured"),[g,_]=b.useState("provider"),[x,v]=b.useState(null),S=b.useRef(e);S.current=e;const w=b.useCallback(async()=>{a(!0);try{const ct=await lQ();i(ct)}catch(ct){v({tone:"error",message:ct instanceof Error?ct.message:S.current("config.err.load")})}finally{a(!1)}},[]);b.useEffect(()=>{w()},[w]);const N=b.useDeferredValue(r),C=b.useMemo(()=>{try{return L3e(N)}catch{return null}},[N]),T=b.useMemo(()=>{try{return A3e(N)}catch{return{enabled:!1,deferred_loading:!1,servers:[]}}},[N]),A=b.useMemo(()=>O3e(T.servers),[T.servers]),E=b.useMemo(()=>B3e(N),[N]),D=b.useMemo(()=>H3e(C),[C]),F=b.useMemo(()=>W3e(C,T.servers.length,T.enabled,e,D),[C,T.servers.length,T.enabled,e,D]),B=F.find(ct=>ct.id===g)??F[0],H=async()=>{if(D3e(A)){v({tone:"error",message:e("config.err.mcp_errors")}),_("mcp");return}l(!0);try{await cQ(r),v({tone:"success",message:e("config.toast.saved")})}catch(ct){v({tone:"error",message:ct instanceof Error?ct.message:e("config.err.save")})}finally{l(!1)}},$=(ct,Mt,Tt)=>{i(Dt=>$3e(Dt,ct,Mt,Tt))},z=ct=>{i(Mt=>R3e(Mt,ct))};return c.jsxs("div",{className:"flex min-h-[calc(100vh-6rem)] flex-col gap-3 md:h-[calc(100vh-6rem)]",children:[x?c.jsx(Qo,{tone:x.tone,message:x.message,onDismiss:()=>v(null)}):null,c.jsx(si,{kicker:e("config.kicker"),title:e("config.page_title"),actions:c.jsxs(c.Fragment,{children:[c.jsxs("button",{className:"revka-button",onClick:()=>void w(),children:[c.jsx($r,{className:`h-4 w-4 ${s?"animate-spin":""}`}),e("config.reload")]}),c.jsxs("button",{className:"revka-button","data-variant":"primary",onClick:H,disabled:o||s,children:[c.jsx(yE,{className:"h-4 w-4"}),e(o?"config.saving_button":"config.save_button")]})]})}),s?c.jsx("div",{className:"flex min-h-0 flex-1 items-center justify-center",children:c.jsx(Ct,{tone:"loading",title:e("config.loading_title")})}):c.jsxs("div",{className:"grid gap-4 grid-cols-1 md:min-h-0 md:flex-1 md:grid-cols-[18rem_minmax(0,1fr)] md:[grid-template-rows:minmax(0,1fr)] lg:grid-cols-[18rem_minmax(0,1fr)_24rem]",children:[c.jsx("div",{className:"flex flex-col gap-4 md:overflow-y-auto md:min-h-0",children:c.jsxs(st,{className:"shrink-0 p-4",variant:"secondary",children:[c.jsx("div",{className:"revka-kicker",children:e("config.map")}),c.jsx("div",{className:"mt-3 space-y-2",children:F.map(ct=>c.jsxs("button",{type:"button",className:"revka-selection-card text-left","data-active":String(g===ct.id),"data-accent":"workflow",onClick:()=>{_(ct.id),f("structured")},children:[c.jsxs("div",{className:"flex items-center justify-between gap-3",children:[c.jsx("span",{className:"text-sm font-medium",children:ct.title}),c.jsx("span",{className:"text-xs",style:{color:"var(--revka-text-secondary)"},children:ct.populatedCount})]}),c.jsx("div",{className:"mt-2 text-xs leading-5",style:{color:"var(--revka-text-secondary)"},children:ct.description})]},ct.id))})]})}),c.jsxs(st,{className:"flex min-h-0 flex-col p-5",children:[c.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3",children:[c.jsxs("div",{children:[c.jsx("div",{className:"revka-kicker",children:e("config.workspace")}),c.jsx("h3",{className:"mt-2 text-lg font-semibold",children:p==="structured"?(B==null?void 0:B.title)??e("config.workspace.structured_heading"):e("config.workspace.source_heading")}),p==="structured"&&B?c.jsx("p",{className:"mt-2 max-w-2xl text-sm leading-6",style:{color:"var(--revka-text-secondary)"},children:B.description}):null]}),c.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[c.jsxs("div",{className:"revka-tab-strip",role:"tablist","aria-label":e("config.tabs_aria"),children:[c.jsx("button",{type:"button",className:"revka-tab-button","data-active":String(p==="structured"),"aria-selected":p==="structured",onClick:()=>f("structured"),children:e("config.tab.structured")}),c.jsx("button",{type:"button",className:"revka-tab-button","data-active":String(p==="source"),"aria-selected":p==="source",onClick:()=>f("source"),children:e("config.tab.source")})]}),c.jsxs("button",{className:"revka-button",onClick:()=>d(ct=>!ct),children:[u?c.jsx(dE,{className:"h-4 w-4"}):c.jsx(nv,{className:"h-4 w-4"}),e(u?"config.hide_preview":"config.show_preview")]})]})]}),p==="structured"?C?c.jsxs("div",{className:"mt-5 min-h-0 flex-1 space-y-4 overflow-y-auto pr-1",children:[U3e(g,C,$,T,A,z,D,e,n),(W=B==null?void 0:B.paths)!=null&&W.length?c.jsxs(st,{className:"p-4",variant:"secondary",children:[c.jsx("div",{className:"revka-kicker",children:e("config.mapped_paths")}),c.jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:B.paths.map(ct=>c.jsx("span",{className:"rounded-full border px-2.5 py-1 text-[10px] font-semibold uppercase tracking-[0.12em]",style:{borderColor:"var(--revka-border-soft)",color:"var(--revka-text-secondary)"},children:ct},ct))})]}):null]}):c.jsx("div",{className:"mt-5",children:c.jsx(Ct,{tone:"error",title:e("config.structured.error_title"),description:e("config.structured.error_desc")})}):c.jsxs("div",{className:`mt-5 grid min-h-0 flex-1 gap-4 ${u?"xl:grid-cols-2":"grid-cols-1"}`,children:[c.jsx("textarea",{value:r,onChange:ct=>i(ct.target.value),className:"revka-input h-full min-h-0 w-full resize-none",style:{fontFamily:"var(--pc-font-mono)",lineHeight:1.65},spellCheck:!1}),u?c.jsx("div",{className:"min-h-0 overflow-auto rounded-[16px] border p-4",style:{borderColor:"var(--revka-border-soft)",background:"color-mix(in srgb, var(--revka-bg-base) 82%, var(--revka-bg-panel-strong))"},children:c.jsx("pre",{className:"whitespace-pre-wrap break-words text-xs leading-7",style:{color:"var(--revka-text-secondary)",fontFamily:"var(--pc-font-mono)"},dangerouslySetInnerHTML:{__html:E}})}):null]})]}),c.jsxs("div",{className:"flex flex-col gap-4 lg:min-h-0 lg:overflow-hidden",children:[c.jsxs(st,{className:"flex min-h-0 flex-1 flex-col p-4",variant:"secondary",children:[c.jsxs("div",{className:"inline-flex shrink-0 items-center gap-2",children:[c.jsx(i0,{className:"h-4 w-4",style:{color:"var(--revka-signal-network)"}}),c.jsx("div",{className:"revka-kicker",children:e("config.summary.title")})]}),C?c.jsxs("div",{className:"mt-4 min-h-0 flex-1 space-y-4 overflow-y-auto pr-1 text-sm",children:[c.jsxs(wm,{title:e("config.section.provider"),children:[c.jsx(xn,{label:e("config.summary.api_url"),value:C.api_url}),c.jsx(xn,{label:e("config.summary.provider"),value:C.default_provider}),c.jsx(xn,{label:e("config.summary.model"),value:C.default_model}),c.jsx(xn,{label:e("config.summary.temperature"),value:C.default_temperature}),c.jsx(xn,{label:e("config.summary.timeout"),value:C.provider_timeout_secs}),c.jsx(xn,{label:e("config.summary.max_tokens"),value:C.provider_max_tokens})]}),c.jsxs(wm,{title:e("config.summary.runtime"),children:[c.jsx(xn,{label:e("config.summary.gateway"),value:(P=C.gateway)!=null&&P.host&&((q=C.gateway)!=null&&q.port)?`${C.gateway.host}:${C.gateway.port}`:void 0}),c.jsx(xn,{label:e("config.summary.pairing_required"),value:(I=C.gateway)==null?void 0:I.require_pairing}),c.jsx(xn,{label:e("config.summary.session_persistence"),value:(Q=C.gateway)==null?void 0:Q.session_persistence}),c.jsx(xn,{label:e("config.summary.autonomy_level"),value:(K=C.autonomy)==null?void 0:K.level}),c.jsx(xn,{label:e("config.summary.workspace_only"),value:(Z=C.autonomy)==null?void 0:Z.workspace_only}),c.jsx(xn,{label:e("config.summary.max_actions_hour"),value:(Y=C.autonomy)==null?void 0:Y.max_actions_per_hour})]}),c.jsxs(wm,{title:e("config.summary.memory"),children:[c.jsx(xn,{label:e("config.summary.backend"),value:(R=C.memory)==null?void 0:R.backend}),c.jsx(xn,{label:e("config.summary.auto_save"),value:(U=C.memory)==null?void 0:U.auto_save}),c.jsx(xn,{label:e("config.summary.hygiene"),value:(V=C.memory)==null?void 0:V.hygiene_enabled}),c.jsx(xn,{label:e("config.summary.snapshots"),value:(ie=C.memory)==null?void 0:ie.snapshot_enabled}),c.jsx(xn,{label:e("config.summary.kumiho_enabled"),value:(te=C.kumiho)==null?void 0:te.enabled}),c.jsx(xn,{label:e("config.summary.memory_project"),value:(X=C.kumiho)==null?void 0:X.memory_project}),c.jsx(xn,{label:e("config.summary.retrieval_limit"),value:((se=C.kumiho)==null?void 0:se.memory_retrieval_limit)??3})]}),c.jsxs(wm,{title:e("config.summary.safety_cost"),children:[c.jsx(xn,{label:e("config.summary.audit_enabled"),value:(de=(re=C.security)==null?void 0:re.audit)==null?void 0:de.enabled}),c.jsx(xn,{label:e("config.summary.sandbox_backend"),value:(ae=(ue=C.security)==null?void 0:ue.sandbox)==null?void 0:ae.backend}),c.jsx(xn,{label:e("config.summary.daily_limit"),value:(pe=C.cost)==null?void 0:pe.daily_limit_usd}),c.jsx(xn,{label:e("config.summary.monthly_limit"),value:(J=C.cost)==null?void 0:J.monthly_limit_usd}),c.jsx(xn,{label:e("config.summary.warn_percent"),value:(me=C.cost)==null?void 0:me.warn_at_percent})]}),c.jsxs(wm,{title:e("config.summary.channels"),children:[c.jsx(xn,{label:e("config.summary.cli"),value:(fe=C.channels_config)==null?void 0:fe.cli}),c.jsx(xn,{label:e("config.summary.telegram"),value:!!((ve=C.channels_config)!=null&&ve.telegram)}),c.jsx(xn,{label:e("config.summary.discord"),value:!!((Ke=C.channels_config)!=null&&Ke.discord)}),c.jsx(xn,{label:e("config.summary.slack"),value:!!((ge=C.channels_config)!=null&&ge.slack)}),c.jsx(xn,{label:e("config.summary.matrix"),value:!!((Ue=C.channels_config)!=null&&Ue.matrix)}),c.jsx(xn,{label:e("config.summary.signal"),value:!!(($e=C.channels_config)!=null&&$e.signal)}),c.jsx(xn,{label:e("config.summary.whatsapp"),value:!!((Bt=C.channels_config)!=null&&Bt.whatsapp)})]})]}):c.jsx("div",{className:"mt-4",children:c.jsx(Ct,{tone:"error",compact:!0,title:e("config.summary.error_title"),description:e("config.summary.error_desc")})})]}),c.jsxs(st,{className:"flex max-h-[22rem] shrink-0 flex-col p-4",variant:"utility",children:[c.jsx("div",{className:"revka-kicker shrink-0",children:e("config.source_health")}),c.jsxs("div",{className:"mt-3 min-h-0 flex-1 space-y-3 overflow-y-auto pr-1 text-sm",children:[c.jsx(xn,{label:e("config.row.workspace_mode"),value:e(p==="structured"?"config.mode.structured":"config.mode.source")}),c.jsx(xn,{label:e("config.row.preview"),value:u}),c.jsx(xn,{label:e("config.row.sections"),value:F.length}),c.jsx(xn,{label:e("config.row.parse_status"),value:e(C?"config.row.parse_valid":"config.row.parse_needs")})]})]})]})]})]})}function U3e(e,n,r,i,s,a,o,l,u){var d,p,f,g,_,x,v,S,w,N,C,T,A,E,D,F,B,H,$,z,W,P,q,I,Q,K,Z,Y,R,U,V,ie,te;if(e.startsWith("ext:")){const X=o.find(se=>se.id===e);return X?c.jsx(X3e,{path:X.path,data:X.data,updateField:r,t:l}):null}switch(e){case"provider":return c.jsxs(Wc,{title:l("config.section.provider"),children:[c.jsx(Rn,{label:l("config.provider.default_provider"),children:c.jsx("input",{className:"revka-input",value:n.default_provider??"",onChange:X=>r(null,"default_provider",X.target.value)})}),c.jsx(Rn,{label:l("config.provider.default_model"),children:c.jsx("input",{className:"revka-input",value:n.default_model??"",onChange:X=>r(null,"default_model",X.target.value)})}),c.jsx(Rn,{label:l("config.provider.temperature"),children:c.jsx("input",{className:"revka-input",type:"number",step:"0.1",value:n.default_temperature??.7,onChange:X=>r(null,"default_temperature",Number(X.target.value))})}),c.jsx(Rn,{label:l("config.provider.timeout"),children:c.jsx("input",{className:"revka-input",type:"number",value:n.provider_timeout_secs??120,onChange:X=>r(null,"provider_timeout_secs",Number(X.target.value))})}),c.jsx(Rn,{label:l("config.provider.max_tokens"),children:c.jsx("input",{className:"revka-input",type:"number",value:n.provider_max_tokens??8192,onChange:X=>r(null,"provider_max_tokens",Number(X.target.value))})})]});case"agent":return c.jsxs(Wc,{title:l("config.section.agent"),children:[c.jsx(Rn,{label:l("config.agent.max_tool_iterations"),children:c.jsx("input",{className:"revka-input",type:"number",value:((d=n.agent)==null?void 0:d.max_tool_iterations)??10,onChange:X=>r("agent","max_tool_iterations",Number(X.target.value))})}),c.jsx(Rn,{label:l("config.agent.max_context_tokens"),children:c.jsx("input",{className:"revka-input",type:"number",value:((p=n.agent)==null?void 0:p.max_context_tokens)??32e3,onChange:X=>r("agent","max_context_tokens",Number(X.target.value))})}),c.jsx(Rn,{label:l("config.agent.max_history_messages"),children:c.jsx("input",{className:"revka-input",type:"number",value:((f=n.agent)==null?void 0:f.max_history_messages)??40,onChange:X=>r("agent","max_history_messages",Number(X.target.value))})}),c.jsx(Rn,{label:l("config.agent.gpt55_context_window"),children:c.jsx("input",{className:"revka-input",type:"number",min:1,value:((_=(g=n.agent)==null?void 0:g.model_context_windows)==null?void 0:_["gpt-5_5"])??105e4,onChange:X=>r("agent.model_context_windows","gpt-5_5",Number(X.target.value))})}),c.jsx(Rn,{label:l("config.agent.context_window_safety_ratio"),children:c.jsx("input",{className:"revka-input",type:"number",min:.1,max:1,step:.01,value:((x=n.agent)==null?void 0:x.context_window_safety_ratio)??.95,onChange:X=>r("agent","context_window_safety_ratio",Number(X.target.value))})}),c.jsx(Gs,{label:l("config.agent.parallel_tools"),checked:((v=n.agent)==null?void 0:v.parallel_tools)??!1,onChange:X=>r("agent","parallel_tools",X),t:l}),c.jsx(Rn,{label:l("config.agent.thinking_level"),children:c.jsx("input",{className:"revka-input",value:((w=(S=n.agent)==null?void 0:S.thinking)==null?void 0:w.default_level)??"medium",onChange:X=>r("agent.thinking","default_level",X.target.value)})})]});case"memory":return c.jsxs(Wc,{title:l("config.section.memory"),children:[c.jsx(Gs,{label:l("config.memory.kumiho_enabled"),checked:((N=n.kumiho)==null?void 0:N.enabled)??!1,onChange:X=>r("kumiho","enabled",X),t:l}),c.jsx(Rn,{label:l("config.memory.memory_project"),children:c.jsx("input",{className:"revka-input",value:((C=n.kumiho)==null?void 0:C.memory_project)??"",onChange:X=>r("kumiho","memory_project",X.target.value)})}),c.jsx(Rn,{label:l("config.memory.harness_project"),children:c.jsx("input",{className:"revka-input",value:((T=n.kumiho)==null?void 0:T.harness_project)??"",onChange:X=>r("kumiho","harness_project",X.target.value)})}),c.jsx(Rn,{label:l("config.memory.retrieval_limit"),children:c.jsx("input",{className:"revka-input",type:"number",min:1,max:50,value:((A=n.kumiho)==null?void 0:A.memory_retrieval_limit)??3,onChange:X=>r("kumiho","memory_retrieval_limit",Number(X.target.value))})}),c.jsx(Rn,{label:l("config.memory.backend"),children:c.jsx("input",{className:"revka-input",value:((E=n.memory)==null?void 0:E.backend)??"",onChange:X=>r("memory","backend",X.target.value)})}),c.jsx(Gs,{label:l("config.memory.auto_save"),checked:((D=n.memory)==null?void 0:D.auto_save)??!1,onChange:X=>r("memory","auto_save",X),t:l}),c.jsx(Gs,{label:l("config.memory.snapshots"),checked:((F=n.memory)==null?void 0:F.snapshot_enabled)??!1,onChange:X=>r("memory","snapshot_enabled",X),t:l})]});case"runtime":return c.jsxs(Wc,{title:l("config.section.runtime"),children:[c.jsx(Rn,{label:l("config.runtime.gateway_host"),children:c.jsx("input",{className:"revka-input",value:((B=n.gateway)==null?void 0:B.host)??"",onChange:X=>r("gateway","host",X.target.value)})}),c.jsx(Rn,{label:l("config.runtime.gateway_port"),children:c.jsx("input",{className:"revka-input",type:"number",value:((H=n.gateway)==null?void 0:H.port)??42617,onChange:X=>r("gateway","port",Number(X.target.value))})}),c.jsx(Gs,{label:l("config.runtime.require_pairing"),checked:(($=n.gateway)==null?void 0:$.require_pairing)??!1,onChange:X=>r("gateway","require_pairing",X),t:l}),c.jsx(Gs,{label:l("config.runtime.session_persistence"),checked:((z=n.gateway)==null?void 0:z.session_persistence)??!1,onChange:X=>r("gateway","session_persistence",X),t:l}),c.jsx(Rn,{label:l("config.runtime.autonomy_level"),children:c.jsx("input",{className:"revka-input",value:((W=n.autonomy)==null?void 0:W.level)??"",onChange:X=>r("autonomy","level",X.target.value)})}),c.jsx(Rn,{label:l("config.runtime.max_actions_hour"),children:c.jsx("input",{className:"revka-input",type:"number",value:((P=n.autonomy)==null?void 0:P.max_actions_per_hour)??0,onChange:X=>r("autonomy","max_actions_per_hour",Number(X.target.value))})})]});case"security":return c.jsxs(Wc,{title:l("config.section.security"),children:[c.jsx(Gs,{label:l("config.security.audit_enabled"),checked:((I=(q=n.security)==null?void 0:q.audit)==null?void 0:I.enabled)??!1,onChange:X=>r("security.audit","enabled",X),t:l}),c.jsx(Rn,{label:l("config.security.sandbox_backend"),children:c.jsx("input",{className:"revka-input",value:((K=(Q=n.security)==null?void 0:Q.sandbox)==null?void 0:K.backend)??"",onChange:X=>r("security.sandbox","backend",X.target.value)})}),c.jsx(Rn,{label:l("config.security.daily_limit"),children:c.jsx("input",{className:"revka-input",type:"number",step:"0.01",value:((Z=n.cost)==null?void 0:Z.daily_limit_usd)??0,onChange:X=>r("cost","daily_limit_usd",Number(X.target.value))})}),c.jsx(Rn,{label:l("config.security.monthly_limit"),children:c.jsx("input",{className:"revka-input",type:"number",step:"0.01",value:((Y=n.cost)==null?void 0:Y.monthly_limit_usd)??0,onChange:X=>r("cost","monthly_limit_usd",Number(X.target.value))})}),c.jsx(Rn,{label:l("config.security.warn_percent"),children:c.jsx("input",{className:"revka-input",type:"number",value:((R=n.cost)==null?void 0:R.warn_at_percent)??80,onChange:X=>r("cost","warn_at_percent",Number(X.target.value))})})]});case"channels":return c.jsxs(Wc,{title:l("config.section.channels"),children:[c.jsx(Gs,{label:l("config.channels.cli"),checked:((U=n.channels_config)==null?void 0:U.cli)??!1,onChange:X=>r("channels_config","cli",X),t:l}),c.jsx(Gs,{label:l("config.channels.ack_reactions"),checked:((V=n.channels_config)==null?void 0:V.ack_reactions)??!1,onChange:X=>r("channels_config","ack_reactions",X),t:l}),c.jsx(Gs,{label:l("config.channels.show_tool_calls"),checked:((ie=n.channels_config)==null?void 0:ie.show_tool_calls)??!1,onChange:X=>r("channels_config","show_tool_calls",X),t:l}),c.jsx(Rn,{label:l("config.channels.message_timeout"),children:c.jsx("input",{className:"revka-input",type:"number",value:((te=n.channels_config)==null?void 0:te.message_timeout_secs)??60,onChange:X=>r("channels_config","message_timeout_secs",Number(X.target.value))})})]});case"mcp":return c.jsx(V3e,{config:i,errors:s,onChange:a,t:l,tpl:u});default:return null}}function Wc({title:e,children:n}){return c.jsxs(st,{className:"p-4",variant:"utility",children:[c.jsx("div",{className:"revka-kicker",children:e}),c.jsx("div",{className:"mt-4 space-y-4",children:n})]})}function Rn({label:e,children:n}){return c.jsxs("label",{className:"grid gap-2 text-sm",children:[c.jsx("span",{style:{color:"var(--revka-text-secondary)"},children:e}),n]})}function Gs({label:e,checked:n,onChange:r,t:i}){return c.jsxs("button",{type:"button",className:"flex items-center justify-between rounded-[12px] border px-3 py-3 text-left",style:{borderColor:"var(--revka-border-soft)",background:"color-mix(in srgb, var(--revka-bg-panel-strong) 88%, transparent)"},onClick:()=>r(!n),children:[c.jsx("span",{className:"text-sm",style:{color:"var(--revka-text-primary)"},children:e}),c.jsx("span",{className:"rounded-full px-2 py-1 text-[10px] font-semibold uppercase tracking-[0.12em]",style:{background:n?"var(--revka-signal-selected-soft, color-mix(in srgb, var(--revka-signal-selected) 18%, transparent))":"color-mix(in srgb, var(--revka-text-faint) 14%, transparent)",color:n?"var(--revka-signal-selected)":"var(--revka-text-faint)"},children:i(n?"config.toggle.enabled":"config.toggle.disabled")})]})}function wm({title:e,children:n}){return c.jsxs("div",{children:[c.jsx("div",{className:"revka-kicker",children:e}),c.jsx("div",{className:"mt-2 space-y-2",children:n})]})}function xn({label:e,value:n}){const{t:r}=cn();return c.jsxs("div",{className:"rounded-[12px] border p-3",style:{borderColor:"var(--revka-border-soft)"},children:[c.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-[0.14em]",style:{color:"var(--revka-text-faint)"},children:e}),c.jsx("div",{className:"mt-1 text-sm font-semibold",style:{color:"var(--revka-text-primary)"},children:n===void 0?"—":typeof n=="boolean"?r(n?"config.row.enabled":"config.row.disabled"):String(n)})]})}function V3e({config:e,errors:n,onChange:r,t:i,tpl:s}){const a=g=>r({...e,enabled:g}),o=g=>r({...e,deferred_loading:g}),l=(g,_)=>{const x=e.servers.slice();x[g]={...x[g],..._},r({...e,servers:x})},u=g=>{var w;const _=e.servers[g],x=(w=_==null?void 0:_.name)!=null&&w.trim()?_.name:s("config.mcp.entry_label",{index:g+1});if(!(typeof window<"u"?window.confirm(s("config.mcp.confirm_remove",{label:x})):!0))return;const S=e.servers.filter((N,C)=>C!==g);r({...e,servers:S})},d=()=>{const g=[...e.servers,{name:"",transport:"stdio",command:"",args:[]}];r({...e,servers:g})},p=e.servers.length<=3,f=e.servers.length===0?i("config.mcp.no_servers"):s(e.servers.length===1?"config.mcp.server_count_one":"config.mcp.server_count",{count:e.servers.length});return c.jsxs("div",{className:"space-y-4",children:[c.jsxs(Wc,{title:i("config.mcp.title"),children:[c.jsx(Gs,{label:i("config.mcp.enabled"),checked:e.enabled,onChange:a,t:i}),c.jsx(Gs,{label:i("config.mcp.deferred"),checked:e.deferred_loading,onChange:o,t:i})]}),c.jsxs(st,{className:"p-4",variant:"utility",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsxs("div",{children:[c.jsx("div",{className:"revka-kicker",children:i("config.mcp.servers")}),c.jsx("p",{className:"mt-1 text-xs",style:{color:"var(--revka-text-secondary)"},children:f})]}),c.jsxs("button",{type:"button",className:"revka-button","data-variant":"primary",onClick:d,children:[c.jsx(rs,{className:"h-4 w-4"}),i("config.mcp.add_server")]})]}),c.jsx("div",{className:"mt-4 space-y-3",children:e.servers.map((g,_)=>c.jsx(K3e,{index:_,server:g,errors:n[_],defaultExpanded:p,onUpdate:x=>l(_,x),onDelete:()=>u(_),t:i,tpl:s},`mcp-server-${_}`))})]})]})}function K3e({index:e,server:n,errors:r,defaultExpanded:i,onUpdate:s,onDelete:a,t:o,tpl:l}){var w,N;const[u,d]=b.useState(i),[p,f]=b.useState({kind:"idle"}),g=!!(r!=null&&r.name||r!=null&&r.command||r!=null&&r.url),_=n.name.trim()||l("config.mcp.server_default",{index:e+1}),x=n.transport==="stdio"?(w=n.command)!=null&&w.trim()?n.command:o("config.mcp.stdio_empty"):(N=n.url)!=null&&N.trim()?n.url:l("config.mcp.transport_empty",{transport:n.transport}),v=async()=>{f({kind:"testing"});try{const C=await kQ({name:n.name,transport:n.transport,command:n.command,args:n.args,env:n.env,url:n.url,headers:n.headers,timeout_ms:n.timeout_ms});f({kind:"done",result:C})}catch(C){const T=C instanceof Error?C.message:String(C);f({kind:"done",result:{ok:!1,latency_ms:0,error:T}})}},S=g||p.kind==="testing";return c.jsxs("div",{className:"rounded-[14px] border",style:{borderColor:g?"var(--revka-status-error, var(--revka-status-danger))":"var(--revka-border-soft)",background:"color-mix(in srgb, var(--revka-bg-panel-strong) 88%, transparent)"},children:[c.jsxs("div",{className:"flex items-center justify-between px-4 py-3",children:[c.jsxs("button",{type:"button",className:"flex flex-1 items-center gap-3 text-left",onClick:()=>d(C=>!C),children:[u?c.jsx(qo,{className:"h-4 w-4",style:{color:"var(--revka-text-secondary)"}}):c.jsx(ru,{className:"h-4 w-4",style:{color:"var(--revka-text-secondary)"}}),c.jsxs("div",{className:"min-w-0",children:[c.jsx("div",{className:"text-sm font-semibold",style:{color:"var(--revka-text-primary)"},children:_}),c.jsxs("div",{className:"truncate text-xs",style:{color:"var(--revka-text-secondary)"},children:[n.transport.toUpperCase()," · ",x]})]})]}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(Y3e,{state:p,t:o,tpl:l}),c.jsx("button",{type:"button",className:"revka-button",onClick:C=>{C.stopPropagation(),v()},disabled:S,title:o(g?"config.mcp.test_blocked":"config.mcp.test_tooltip"),style:S?{opacity:.5,cursor:"not-allowed"}:void 0,children:p.kind==="testing"?o("config.mcp.testing"):o("config.mcp.test")}),c.jsx("button",{type:"button",className:"revka-button",onClick:C=>{C.stopPropagation(),a()},"aria-label":l("config.mcp.delete_label",{label:_}),children:c.jsx(Wi,{className:"h-4 w-4"})})]})]}),u?c.jsxs("div",{className:"space-y-4 border-t px-4 py-4",style:{borderColor:"var(--revka-border-soft)"},children:[c.jsxs(Rn,{label:o("config.mcp.field_name"),children:[c.jsx("input",{className:"revka-input",value:n.name,placeholder:o("config.mcp.field_name_placeholder"),onChange:C=>s({name:C.target.value})}),r!=null&&r.name?c.jsx(T2,{message:r.name}):null]}),c.jsx(Rn,{label:o("config.mcp.field_transport"),children:c.jsxs("select",{className:"revka-input",value:n.transport,onChange:C=>s({transport:C.target.value}),children:[c.jsx("option",{value:"stdio",children:"stdio"}),c.jsx("option",{value:"http",children:"http"}),c.jsx("option",{value:"sse",children:"sse"})]})}),n.transport==="stdio"?c.jsxs(c.Fragment,{children:[c.jsxs(Rn,{label:o("config.mcp.field_command"),children:[c.jsx("input",{className:"revka-input",value:n.command??"",placeholder:o("config.mcp.field_command_placeholder"),onChange:C=>s({command:C.target.value})}),r!=null&&r.command?c.jsx(T2,{message:r.command}):null]}),c.jsx(G3e,{label:o("config.mcp.field_args"),values:n.args??[],placeholder:o("config.mcp.field_args_placeholder"),onChange:C=>s({args:C}),tpl:l}),c.jsx(e8,{label:o("config.mcp.field_env"),entries:n.env??{},keyPlaceholder:o("config.mcp.field_env_key"),valuePlaceholder:o("config.mcp.field_env_value"),onChange:C=>s({env:C}),tpl:l})]}):c.jsxs(c.Fragment,{children:[c.jsxs(Rn,{label:o("config.mcp.field_url"),children:[c.jsx("input",{className:"revka-input",value:n.url??"",placeholder:o("config.mcp.field_url_placeholder"),onChange:C=>s({url:C.target.value})}),r!=null&&r.url?c.jsx(T2,{message:r.url}):null]}),c.jsx(e8,{label:o("config.mcp.field_headers"),entries:n.headers??{},keyPlaceholder:o("config.mcp.field_headers_key"),valuePlaceholder:o("config.mcp.field_headers_value"),onChange:C=>s({headers:C}),tpl:l}),c.jsx(Rn,{label:o("config.mcp.field_timeout"),children:c.jsx("input",{className:"revka-input",type:"number",value:n.timeout_ms??"",placeholder:o("config.mcp.field_timeout_placeholder"),onChange:C=>{const T=C.target.value;if(T==="")s({timeout_ms:void 0});else{const A=Number(T);Number.isFinite(A)&&s({timeout_ms:A})}}})})]})]}):null]})}function Y3e({state:e,t:n,tpl:r}){if(e.kind==="idle")return null;if(e.kind==="testing")return c.jsxs("span",{className:"inline-flex items-center gap-1 text-xs",style:{color:"var(--revka-text-secondary)"},children:[c.jsx($r,{className:"h-3.5 w-3.5 animate-spin"}),n("config.mcp.connecting")]});const{result:i}=e;if(i.ok){const s=i.tool_count??0;return c.jsxs("span",{className:"inline-flex items-center gap-1 rounded border px-2 py-0.5 text-xs",style:{borderColor:"var(--revka-status-ok, var(--revka-status-success))",color:"var(--revka-status-ok, var(--revka-status-success))"},title:i.tools&&i.tools.length>0?r("config.mcp.tools_list",{list:i.tools.join(", ")}):void 0,children:[c.jsx(Za,{className:"h-3.5 w-3.5"}),r(s===1?"config.mcp.tool_count_one":"config.mcp.tool_count",{count:s,latency:i.latency_ms})]})}return c.jsxs("span",{className:"inline-flex max-w-xs items-center gap-1 truncate rounded border px-2 py-0.5 text-xs",style:{borderColor:"var(--revka-status-error, var(--revka-status-danger))",color:"var(--revka-status-error, var(--revka-status-danger))"},title:i.error??n("config.mcp.handshake_failed"),children:[c.jsx(mi,{className:"h-3.5 w-3.5"}),i.error??n("config.mcp.handshake_failed")]})}function T2({message:e}){return c.jsx("span",{className:"text-xs",style:{color:"var(--revka-status-error, #f87171)"},children:e})}function G3e({label:e,values:n,placeholder:r,onChange:i,tpl:s}){const a=(u,d)=>{const p=n.slice();p[u]=d,i(p)},o=u=>i(n.filter((d,p)=>p!==u)),l=()=>i([...n,""]);return c.jsxs("div",{className:"grid gap-2 text-sm",children:[c.jsx("span",{style:{color:"var(--revka-text-secondary)"},children:e}),c.jsxs("div",{className:"space-y-2",children:[n.map((u,d)=>c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("input",{className:"revka-input flex-1",value:u,placeholder:r,onChange:p=>a(d,p.target.value)}),c.jsx("button",{type:"button",className:"revka-button",onClick:()=>o(d),"aria-label":s("config.mcp.remove_entry",{label:e,index:d+1}),children:c.jsx(Wi,{className:"h-4 w-4"})})]},`${e}-${d}`)),c.jsxs("button",{type:"button",className:"revka-button",onClick:l,children:[c.jsx(rs,{className:"h-4 w-4"}),s("config.mcp.add_entry",{label:e})]})]})]})}function e8({label:e,entries:n,keyPlaceholder:r,valuePlaceholder:i,onChange:s,tpl:a}){const o=Object.entries(n),l=g=>{const _={};for(const[x,v]of g)x.length!==0&&(_[x]=v);s(_)},u=(g,_)=>{const x=o.slice();x[g]=[_,x[g][1]],l(x)},d=(g,_)=>{const x=o.slice();x[g]=[x[g][0],_],l(x)},p=g=>l(o.filter((_,x)=>x!==g)),f=()=>{const g=`new_key_${o.length+1}`;l([...o,[g,""]])};return c.jsxs("div",{className:"grid gap-2 text-sm",children:[c.jsx("span",{style:{color:"var(--revka-text-secondary)"},children:e}),c.jsxs("div",{className:"space-y-2",children:[o.map(([g,_],x)=>c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("input",{className:"revka-input flex-1",value:g,placeholder:r,onChange:v=>u(x,v.target.value)}),c.jsx("input",{className:"revka-input flex-1",value:_,placeholder:i,onChange:v=>d(x,v.target.value)}),c.jsx("button",{type:"button",className:"revka-button",onClick:()=>p(x),"aria-label":a("config.mcp.remove_entry",{label:e,index:x+1}),children:c.jsx(Wi,{className:"h-4 w-4"})})]},`${e}-${x}`)),c.jsxs("button",{type:"button",className:"revka-button",onClick:f,children:[c.jsx(rs,{className:"h-4 w-4"}),a("config.mcp.add_entry",{label:e})]})]})]})}function X3e({path:e,data:n,updateField:r,t:i}){return c.jsx(Wc,{title:`[${e}]`,children:c.jsx(HV,{pathPrefix:e,data:n,updateField:r,t:i})})}function HV({pathPrefix:e,data:n,updateField:r,t:i}){const s=Object.entries(n);return s.length===0?c.jsx("div",{className:"text-xs",style:{color:"var(--revka-text-faint)"},children:i("config.generic.empty")}):c.jsx(c.Fragment,{children:s.map(([a,o])=>c.jsx(Q3e,{pathPrefix:e,fieldKey:a,value:o,updateField:r,t:i},a))})}function Q3e({pathPrefix:e,fieldKey:n,value:r,updateField:i,t:s}){return typeof r=="boolean"?c.jsx(Gs,{label:n,checked:r,onChange:a=>i(e,n,a),t:s}):typeof r=="number"?c.jsx(Rn,{label:n,children:c.jsx("input",{className:"revka-input",type:"number",value:r,onChange:a=>{const o=Number(a.target.value);Number.isFinite(o)&&i(e,n,o)}})}):typeof r=="string"?c.jsx(Rn,{label:n,children:c.jsx("input",{className:"revka-input",value:r,onChange:a=>i(e,n,a.target.value)})}):Array.isArray(r)?c.jsxs(Rn,{label:n,children:[c.jsx("div",{className:"rounded-[10px] border px-3 py-2 font-mono text-xs",style:{borderColor:"var(--revka-border-soft)",color:"var(--revka-text-secondary)"},children:r.length===0?s("config.generic.empty_array"):JSON.stringify(r)}),c.jsx("span",{className:"text-[10px]",style:{color:"var(--revka-text-faint)"},children:s("config.generic.array_readonly")})]}):r!==null&&typeof r=="object"?c.jsxs(st,{className:"p-3",variant:"utility",children:[c.jsx("div",{className:"revka-kicker",children:`${e}.${n}`}),c.jsx("div",{className:"mt-3 space-y-3",children:c.jsx(HV,{pathPrefix:`${e}.${n}`,data:r,updateField:i,t:s})})]}):null}function WV(e){return e?new Date(e).toLocaleString():"—"}function Z3e(e){if(e==null)return"—";if(e<1e3)return`${e}ms`;const n=e/1e3;return n<60?`${n.toFixed(1)}s`:`${(n/60).toFixed(1)}m`}function qV(e){if(!e)return null;switch(e.toLowerCase()){case"ok":case"success":return c.jsx(_f,{className:"h-4 w-4",style:{color:"var(--revka-status-success)"}});case"error":case"failed":return c.jsx(Xc,{className:"h-4 w-4",style:{color:"var(--revka-status-danger)"}});default:return c.jsx(tv,{className:"h-4 w-4",style:{color:"var(--revka-status-warning)"}})}}function J3e({jobId:e}){const{t:n,tpl:r}=cn(),[i,s]=b.useState([]),[a,o]=b.useState(!0),[l,u]=b.useState(null),d=b.useCallback(()=>{o(!0),u(null),yQ(e,20).then(s).catch(p=>u(p.message)).finally(()=>o(!1))},[e]);return b.useEffect(()=>{d()},[d]),a?c.jsx(Ct,{compact:!0,tone:"loading",title:n("cron.history.loading")}):l?c.jsx(Ct,{compact:!0,tone:"error",title:n("cron.history.error_title"),description:l,action:c.jsxs("button",{className:"revka-button",onClick:d,children:[c.jsx($r,{className:"h-3.5 w-3.5"}),n("cron.history.retry")]})}):i.length===0?c.jsx(Ct,{compact:!0,title:n("cron.history.no_runs_title"),description:n("cron.history.no_runs_desc"),action:c.jsxs("button",{className:"revka-button",onClick:d,children:[c.jsx($r,{className:"h-3.5 w-3.5"}),n("cron.history.refresh")]})}):c.jsxs("div",{children:[c.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[c.jsx("div",{className:"revka-kicker",children:r("cron.history.recent",{count:i.length})}),c.jsx("button",{className:"revka-button",onClick:d,title:n("cron.history.refresh_title"),children:c.jsx($r,{className:"h-3.5 w-3.5"})})]}),c.jsx("div",{className:"max-h-60 space-y-1.5 overflow-y-auto",children:i.map(p=>c.jsxs("div",{className:"rounded-[10px] border px-3 py-2 text-xs",style:{background:"color-mix(in srgb, var(--revka-bg-panel-strong) 94%, transparent)",borderColor:"var(--revka-border-soft)"},children:[c.jsxs("div",{className:"mb-1 flex items-center justify-between",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[qV(p.status),c.jsx("span",{style:{color:"var(--revka-text-secondary)"},children:p.status})]}),c.jsx("span",{style:{color:"var(--revka-text-faint)"},children:Z3e(p.duration_ms)})]}),c.jsx("div",{className:"flex items-center gap-3",style:{color:"var(--revka-text-faint)"},children:c.jsx("span",{children:WV(p.started_at)})}),p.output?c.jsx("pre",{className:"mt-1.5 max-h-24 overflow-x-auto whitespace-pre-wrap break-words rounded-[8px] p-2 font-mono text-xs",style:{background:"var(--revka-bg-base)",color:"var(--revka-text-secondary)"},children:p.output}):null]},p.id))})]})}function eOe(){const{t:e,tpl:n}=cn(),[r,i]=b.useState([]),[s,a]=b.useState(!0),[o,l]=b.useState(null),[u,d]=b.useState(null),[p,f]=b.useState(null),[g,_]=b.useState(null),[x,v]=b.useState(!1),[S,w]=b.useState(null),[N,C]=b.useState(""),[T,A]=b.useState(""),[E,D]=b.useState(""),[F,B]=b.useState(null),[H,$]=b.useState(!1),z=S!==null&&S!=="add",W=b.useCallback(()=>{a(!0),pQ().then(i).catch(R=>l({tone:"error",message:n("cron.err.load",{message:R.message})})).finally(()=>a(!1))},[n]),P=b.useCallback(()=>{_Q().then(_).catch(()=>{})},[]);b.useEffect(()=>{W(),P()},[W,P]);const q=async()=>{if(g){v(!0);try{const R=await xQ({catch_up_on_startup:!g.catch_up_on_startup});_(R)}catch(R){l({tone:"error",message:R instanceof Error?R.message:e("cron.err.settings")})}finally{v(!1)}}},I=()=>{C(""),A(""),D(""),B(null),w("add")},Q=R=>{C(R.name??""),A(R.expression),D(R.prompt??R.command),B(null),w(R)},K=()=>{w(null),B(null)},Z=async()=>{if(!T.trim()||!E.trim()){B(e("cron.err.form_required"));return}$(!0),B(null);try{if(z){const R=await vQ(S.id,{name:N.trim()||void 0,schedule:T.trim(),command:E.trim()});i(U=>U.map(V=>V.id===R.id?R:V)),l({tone:"success",message:n("cron.toast.updated",{name:R.name??R.id.slice(0,8)})})}else{const R=await mQ({name:N.trim()||void 0,schedule:T.trim(),command:E.trim()});i(U=>[...U,R]),l({tone:"success",message:n("cron.toast.added",{name:R.name??R.id.slice(0,8)})})}K()}catch(R){B(R instanceof Error?R.message:e("cron.err.save"))}finally{$(!1)}},Y=async R=>{try{await gQ(R),i(U=>U.filter(V=>V.id!==R)),l({tone:"success",message:e("cron.toast.deleted")})}catch(U){l({tone:"error",message:U instanceof Error?U.message:e("cron.err.delete")})}finally{d(null)}};return c.jsxs("div",{className:"flex h-[calc(100vh-6rem)] flex-col gap-3",children:[o?c.jsx(Qo,{tone:o.tone,message:o.message,onDismiss:()=>l(null)}):null,c.jsx(si,{kicker:e("cron.kicker"),title:e("cron.title"),description:e("cron.description"),actions:c.jsxs(c.Fragment,{children:[c.jsxs("button",{className:"revka-button",onClick:W,disabled:s,children:[c.jsx($r,{className:`h-4 w-4 ${s?"animate-spin":""}`}),e("cron.reload")]}),c.jsxs("button",{className:"revka-button","data-variant":"primary",onClick:I,children:[c.jsx(rs,{className:"h-4 w-4"}),e("cron.add_job")]})]})}),g?c.jsx(st,{className:"p-4",variant:"secondary",children:c.jsxs("div",{className:"flex items-center justify-between gap-3",children:[c.jsxs("div",{children:[c.jsx("div",{className:"revka-kicker",children:e("cron.startup_behaviour")}),c.jsx("div",{className:"mt-2 text-sm font-semibold",style:{color:"var(--revka-text-primary)"},children:e("cron.catch_up_title")}),c.jsx("p",{className:"mt-1 text-xs",style:{color:"var(--revka-text-secondary)"},children:e("cron.catch_up_desc")})]}),c.jsx("button",{type:"button",onClick:q,disabled:x,className:"relative inline-flex h-6 w-11 items-center rounded-full transition-colors",style:{background:g.catch_up_on_startup?"var(--revka-signal-selected)":"var(--revka-border-strong)",opacity:x?.6:1},"aria-pressed":g.catch_up_on_startup,children:c.jsx("span",{className:"inline-block h-4 w-4 rounded-full bg-white transition-transform",style:{transform:g.catch_up_on_startup?"translateX(1.5rem)":"translateX(0.25rem)"}})})]})}):null,s?c.jsx("div",{className:"flex min-h-0 flex-1 items-center justify-center",children:c.jsx(Ct,{tone:"loading",title:e("cron.loading_jobs")})}):r.length===0?c.jsx(st,{className:"p-6",children:c.jsx(Ct,{tone:"empty",title:e("cron.no_jobs_title"),description:e("cron.no_jobs_desc"),action:c.jsxs("button",{className:"revka-button","data-variant":"primary",onClick:I,children:[c.jsx(rs,{className:"h-4 w-4"}),e("cron.add_job")]})})}):c.jsx(st,{className:"min-h-0 flex-1 overflow-auto p-0",children:c.jsxs("table",{className:"revka-table w-full",children:[c.jsx("thead",{children:c.jsxs("tr",{children:[c.jsx("th",{className:"text-left",children:e("cron.col.id")}),c.jsx("th",{className:"text-left",children:e("cron.col.name")}),c.jsx("th",{className:"text-left",children:e("cron.col.command")}),c.jsx("th",{className:"text-left",children:e("cron.col.next_run")}),c.jsx("th",{className:"text-left",children:e("cron.col.last_status")}),c.jsx("th",{className:"text-left",children:e("cron.col.enabled")}),c.jsx("th",{className:"text-right",children:e("cron.col.actions")})]})}),c.jsx("tbody",{children:r.map(R=>c.jsxs(Wf.Fragment,{children:[c.jsxs("tr",{children:[c.jsx("td",{className:"font-mono text-xs",children:c.jsxs("button",{className:"inline-flex items-center gap-1",style:{color:"var(--revka-text-secondary)"},onClick:()=>f(U=>U===R.id?null:R.id),title:e("cron.toggle_history"),children:[p===R.id?c.jsx(qo,{className:"h-3.5 w-3.5"}):c.jsx(ru,{className:"h-3.5 w-3.5"}),R.id.slice(0,8)]})}),c.jsx("td",{className:"text-sm font-medium",style:{color:"var(--revka-text-primary)"},children:R.name??"—"}),c.jsx("td",{className:"max-w-[240px] truncate font-mono text-xs",style:{color:"var(--revka-text-secondary)"},title:R.prompt??R.command,children:R.prompt??R.command}),c.jsx("td",{className:"text-xs",style:{color:"var(--revka-text-faint)"},children:WV(R.next_run)}),c.jsx("td",{children:c.jsxs("div",{className:"flex items-center gap-1.5",children:[qV(R.last_status),c.jsx("span",{className:"text-xs capitalize",style:{color:"var(--revka-text-secondary)"},children:R.last_status??"—"})]})}),c.jsx("td",{children:c.jsx("span",{className:"inline-flex items-center rounded-full border px-2.5 py-0.5 text-[10px] font-semibold uppercase tracking-wider",style:R.enabled?{color:"var(--revka-signal-selected)",borderColor:"color-mix(in srgb, var(--revka-signal-selected) 28%, transparent)",background:"color-mix(in srgb, var(--revka-signal-selected) 10%, transparent)"}:{color:"var(--revka-text-faint)",borderColor:"var(--revka-border-soft)",background:"transparent"},children:R.enabled?e("cron.enabled_badge"):e("cron.disabled_badge")})}),c.jsx("td",{className:"text-right",children:c.jsxs("div",{className:"inline-flex items-center justify-end gap-1",children:[c.jsx("button",{className:"revka-button",onClick:()=>Q(R),title:e("cron.edit"),children:c.jsx(iv,{className:"h-4 w-4"})}),u===R.id?c.jsxs("div",{className:"inline-flex items-center gap-2",children:[c.jsx("span",{className:"text-xs",style:{color:"var(--revka-status-danger)"},children:e("cron.confirm")}),c.jsx("button",{className:"text-xs font-semibold",style:{color:"var(--revka-status-danger)"},onClick:()=>Y(R.id),children:e("cron.yes")}),c.jsx("button",{className:"text-xs font-semibold",style:{color:"var(--revka-text-secondary)"},onClick:()=>d(null),children:e("cron.no")})]}):c.jsx("button",{className:"revka-button",onClick:()=>d(R.id),title:e("cron.delete"),children:c.jsx(Wi,{className:"h-4 w-4"})})]})})]}),p===R.id?c.jsx("tr",{children:c.jsx("td",{colSpan:7,style:{background:"color-mix(in srgb, var(--revka-bg-panel-strong) 60%, transparent)"},children:c.jsx("div",{className:"px-4 py-3",children:c.jsx(J3e,{jobId:R.id})})})}):null]},R.id))})]})}),S!==null?c.jsx(yu,{title:e(z?"cron.modal.edit_title":"cron.modal.add_title"),description:e("cron.modal.description"),onClose:K,children:c.jsxs("div",{className:"space-y-4",children:[F?c.jsx(Qo,{tone:"error",message:F}):null,c.jsxs("div",{children:[c.jsxs("div",{className:"revka-kicker",children:[e("cron.form.name")," ",c.jsx("span",{style:{color:"var(--revka-text-faint)"},children:e("cron.form.optional")})]}),c.jsx("input",{className:"revka-input mt-2 w-full",value:N,onChange:R=>C(R.target.value),placeholder:e("cron.form.name_placeholder")})]}),c.jsxs("div",{children:[c.jsxs("div",{className:"revka-kicker",children:[e("cron.form.schedule")," ",c.jsx("span",{style:{color:"var(--revka-status-danger)"},children:"*"})]}),c.jsx("input",{className:"revka-input mt-2 w-full font-mono text-sm",value:T,onChange:R=>A(R.target.value),placeholder:"0 0 * * *"})]}),c.jsxs("div",{children:[c.jsxs("div",{className:"revka-kicker",children:[e("cron.form.command")," ",c.jsx("span",{style:{color:"var(--revka-status-danger)"},children:"*"})]}),c.jsx("textarea",{className:"revka-input mt-2 w-full resize-y font-mono text-sm",rows:4,value:E,onChange:R=>D(R.target.value),placeholder:e("cron.form.command_placeholder")})]}),c.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[c.jsx("button",{className:"revka-button",onClick:K,children:e("cron.form.cancel")}),c.jsx("button",{className:"revka-button","data-variant":"primary",onClick:Z,disabled:H,children:e(H?z?"cron.form.saving":"cron.form.adding":z?"cron.form.save":"cron.add_job")})]})]})}):null]})}function tOe(){const{t:e,tpl:n}=cn(),[r,i]=b.useState([]),[s,a]=b.useState([]),[o,l]=b.useState(""),[u,d]=b.useState(null),[p,f]=b.useState(!0),[g,_]=b.useState(!0),[x,v]=b.useState(!0),[S,w]=b.useState(null),N=()=>{v(!0),Promise.all([fQ(),TQ()]).then(([A,E])=>{i(A),a(E)}).catch(A=>w({tone:"error",message:n("tools.failed_load",{message:A.message})})).finally(()=>v(!1))};b.useEffect(()=>{N()},[]);const C=b.useMemo(()=>{const A=o.toLowerCase();return r.filter(E=>E.name.toLowerCase().includes(A)||E.description.toLowerCase().includes(A))},[r,o]),T=b.useMemo(()=>{const A=o.toLowerCase();return s.filter(E=>E.name.toLowerCase().includes(A)||E.category.toLowerCase().includes(A))},[s,o]);return c.jsxs("div",{className:"flex h-[calc(100vh-6rem)] flex-col gap-3",children:[S?c.jsx(Qo,{tone:S.tone,message:S.message,onDismiss:()=>w(null)}):null,c.jsx(si,{kicker:e("tools.kicker"),title:e("tools.title"),description:e("tools.description"),actions:c.jsxs("button",{className:"revka-button",onClick:N,disabled:x,children:[c.jsx($r,{className:`h-4 w-4 ${x?"animate-spin":""}`}),e("tools.reload")]})}),c.jsx(st,{className:"p-3",variant:"secondary",children:c.jsxs("div",{className:"relative",children:[c.jsx(Aa,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2",style:{color:"var(--revka-text-faint)"}}),c.jsx("input",{type:"text",className:"revka-input w-full pl-9",value:o,onChange:A=>l(A.target.value),placeholder:e("tools.search_placeholder")})]})}),x?c.jsx("div",{className:"flex min-h-0 flex-1 items-center justify-center",children:c.jsx(Ct,{tone:"loading",title:e("tools.loading")})}):c.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-4",children:[c.jsxs(st,{className:`flex flex-col p-4 ${p?"min-h-0 flex-1":""}`,children:[c.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 text-left",onClick:()=>f(A=>!A),"aria-expanded":p,children:[c.jsx(l0,{className:"h-4 w-4",style:{color:"var(--revka-signal-network)"}}),c.jsx("span",{className:"revka-kicker flex-1",children:n("tools.agent_tools_count",{count:C.length})}),c.jsx(qo,{className:"h-4 w-4",style:{color:"var(--revka-text-faint)",transform:p?"rotate(0deg)":"rotate(-90deg)",transition:"transform 0.2s ease"}})]}),p?C.length===0?c.jsx("div",{className:"mt-4",children:c.jsx(Ct,{tone:"empty",compact:!0,title:e(o?"tools.no_matches":"tools.no_agent_tools"),description:e(o?"tools.try_different":"tools.agent_tools_empty_desc")})}):c.jsx("div",{className:"mt-4 min-h-0 flex-1 overflow-y-auto pr-1",children:c.jsx("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2 xl:grid-cols-3",children:C.map(A=>{const E=u===A.name;return c.jsxs("div",{className:"overflow-hidden rounded-[12px] border",style:{borderColor:"var(--revka-border-soft)",background:"color-mix(in srgb, var(--revka-bg-panel-strong) 70%, transparent)"},children:[c.jsxs("button",{type:"button",className:"w-full p-3 text-left transition-colors",onClick:()=>d(E?null:A.name),children:[c.jsxs("div",{className:"flex items-start justify-between gap-2",children:[c.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[c.jsx(Ul,{className:"h-4 w-4 shrink-0",style:{color:"var(--revka-signal-network)"}}),c.jsx("h3",{className:"truncate text-sm font-semibold",style:{color:"var(--revka-text-primary)"},children:A.name})]}),E?c.jsx(qo,{className:"h-4 w-4 shrink-0",style:{color:"var(--revka-signal-network)"}}):c.jsx(ru,{className:"h-4 w-4 shrink-0",style:{color:"var(--revka-text-faint)"}})]}),c.jsx("p",{className:"mt-2 line-clamp-2 text-sm",style:{color:"var(--revka-text-secondary)"},children:A.description})]}),E&&A.parameters?c.jsxs("div",{className:"border-t p-3",style:{borderColor:"var(--revka-border-soft)"},children:[c.jsx("div",{className:"revka-kicker mb-2",children:e("tools.parameter_schema")}),c.jsx("pre",{className:"max-h-64 overflow-auto rounded-[8px] p-3 font-mono text-xs",style:{background:"var(--revka-bg-base)",color:"var(--revka-text-secondary)"},children:JSON.stringify(A.parameters,null,2)})]}):null]},A.name)})})}):null]}),c.jsxs(st,{className:`flex flex-col p-4 ${g?"min-h-0 flex-1":""}`,children:[c.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 text-left",onClick:()=>_(A=>!A),"aria-expanded":g,children:[c.jsx(av,{className:"h-4 w-4",style:{color:"var(--revka-signal-selected)"}}),c.jsx("span",{className:"revka-kicker flex-1",children:n("tools.cli_tools_count",{count:T.length})}),c.jsx(qo,{className:"h-4 w-4",style:{color:"var(--revka-text-faint)",transform:g?"rotate(0deg)":"rotate(-90deg)",transition:"transform 0.2s ease"}})]}),g?T.length===0?c.jsx("div",{className:"mt-4",children:c.jsx(Ct,{tone:"empty",compact:!0,title:e(o?"tools.no_matches":"tools.no_cli_tools"),description:e(o?"tools.try_different":"tools.cli_tools_empty_desc")})}):c.jsx("div",{className:"mt-4 min-h-0 flex-1 overflow-auto",children:c.jsxs("table",{className:"revka-table w-full",children:[c.jsx("thead",{children:c.jsxs("tr",{children:[c.jsx("th",{children:e("tools.col.name")}),c.jsx("th",{children:e("tools.col.path")}),c.jsx("th",{children:e("tools.col.version")}),c.jsx("th",{children:e("tools.col.category")})]})}),c.jsx("tbody",{children:T.map(A=>c.jsxs("tr",{children:[c.jsx("td",{className:"text-sm font-medium",style:{color:"var(--revka-text-primary)"},children:A.name}),c.jsx("td",{className:"max-w-[260px] truncate font-mono text-xs",title:A.path,style:{color:"var(--revka-text-faint)"},children:A.path}),c.jsx("td",{style:{color:"var(--revka-text-faint)"},children:A.version??"—"}),c.jsx("td",{children:c.jsx("span",{className:"inline-flex items-center rounded-full border px-2.5 py-0.5 text-[10px] font-semibold capitalize",style:{borderColor:"var(--revka-border-soft)",color:"var(--revka-text-secondary)",background:"color-mix(in srgb, var(--revka-signal-selected) 8%, transparent)"},children:A.category})})]},A.name))})]})}):null]})]})]})}var Lh={},M2,t8;function nOe(){return t8||(t8=1,M2=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}),M2}var R2={},Pc={},n8;function Bd(){if(n8)return Pc;n8=1;let e;const n=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];return Pc.getSymbolSize=function(i){if(!i)throw new Error('"version" cannot be null or undefined');if(i<1||i>40)throw new Error('"version" should be in range from 1 to 40');return i*4+17},Pc.getSymbolTotalCodewords=function(i){return n[i]},Pc.getBCHDigit=function(r){let i=0;for(;r!==0;)i++,r>>>=1;return i},Pc.setToSJISFunction=function(i){if(typeof i!="function")throw new Error('"toSJISFunc" is not a valid function.');e=i},Pc.isKanjiModeEnabled=function(){return typeof e<"u"},Pc.toSJIS=function(i){return e(i)},Pc}var O2={},r8;function MT(){return r8||(r8=1,(function(e){e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function n(r){if(typeof r!="string")throw new Error("Param is not a string");switch(r.toLowerCase()){case"l":case"low":return e.L;case"m":case"medium":return e.M;case"q":case"quartile":return e.Q;case"h":case"high":return e.H;default:throw new Error("Unknown EC Level: "+r)}}e.isValid=function(i){return i&&typeof i.bit<"u"&&i.bit>=0&&i.bit<4},e.from=function(i,s){if(e.isValid(i))return i;try{return n(i)}catch{return s}}})(O2)),O2}var D2,i8;function rOe(){if(i8)return D2;i8=1;function e(){this.buffer=[],this.length=0}return e.prototype={get:function(n){const r=Math.floor(n/8);return(this.buffer[r]>>>7-n%8&1)===1},put:function(n,r){for(let i=0;i<r;i++)this.putBit((n>>>r-i-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(n){const r=Math.floor(this.length/8);this.buffer.length<=r&&this.buffer.push(0),n&&(this.buffer[r]|=128>>>this.length%8),this.length++}},D2=e,D2}var P2,s8;function iOe(){if(s8)return P2;s8=1;function e(n){if(!n||n<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=n,this.data=new Uint8Array(n*n),this.reservedBit=new Uint8Array(n*n)}return e.prototype.set=function(n,r,i,s){const a=n*this.size+r;this.data[a]=i,s&&(this.reservedBit[a]=!0)},e.prototype.get=function(n,r){return this.data[n*this.size+r]},e.prototype.xor=function(n,r,i){this.data[n*this.size+r]^=i},e.prototype.isReserved=function(n,r){return this.reservedBit[n*this.size+r]},P2=e,P2}var L2={},a8;function sOe(){return a8||(a8=1,(function(e){const n=Bd().getSymbolSize;e.getRowColCoords=function(i){if(i===1)return[];const s=Math.floor(i/7)+2,a=n(i),o=a===145?26:Math.ceil((a-13)/(2*s-2))*2,l=[a-7];for(let u=1;u<s-1;u++)l[u]=l[u-1]-o;return l.push(6),l.reverse()},e.getPositions=function(i){const s=[],a=e.getRowColCoords(i),o=a.length;for(let l=0;l<o;l++)for(let u=0;u<o;u++)l===0&&u===0||l===0&&u===o-1||l===o-1&&u===0||s.push([a[l],a[u]]);return s}})(L2)),L2}var I2={},o8;function aOe(){if(o8)return I2;o8=1;const e=Bd().getSymbolSize,n=7;return I2.getPositions=function(i){const s=e(i);return[[0,0],[s-n,0],[0,s-n]]},I2}var B2={},l8;function oOe(){return l8||(l8=1,(function(e){e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const n={N1:3,N2:3,N3:40,N4:10};e.isValid=function(s){return s!=null&&s!==""&&!isNaN(s)&&s>=0&&s<=7},e.from=function(s){return e.isValid(s)?parseInt(s,10):void 0},e.getPenaltyN1=function(s){const a=s.size;let o=0,l=0,u=0,d=null,p=null;for(let f=0;f<a;f++){l=u=0,d=p=null;for(let g=0;g<a;g++){let _=s.get(f,g);_===d?l++:(l>=5&&(o+=n.N1+(l-5)),d=_,l=1),_=s.get(g,f),_===p?u++:(u>=5&&(o+=n.N1+(u-5)),p=_,u=1)}l>=5&&(o+=n.N1+(l-5)),u>=5&&(o+=n.N1+(u-5))}return o},e.getPenaltyN2=function(s){const a=s.size;let o=0;for(let l=0;l<a-1;l++)for(let u=0;u<a-1;u++){const d=s.get(l,u)+s.get(l,u+1)+s.get(l+1,u)+s.get(l+1,u+1);(d===4||d===0)&&o++}return o*n.N2},e.getPenaltyN3=function(s){const a=s.size;let o=0,l=0,u=0;for(let d=0;d<a;d++){l=u=0;for(let p=0;p<a;p++)l=l<<1&2047|s.get(d,p),p>=10&&(l===1488||l===93)&&o++,u=u<<1&2047|s.get(p,d),p>=10&&(u===1488||u===93)&&o++}return o*n.N3},e.getPenaltyN4=function(s){let a=0;const o=s.data.length;for(let u=0;u<o;u++)a+=s.data[u];return Math.abs(Math.ceil(a*100/o/5)-10)*n.N4};function r(i,s,a){switch(i){case e.Patterns.PATTERN000:return(s+a)%2===0;case e.Patterns.PATTERN001:return s%2===0;case e.Patterns.PATTERN010:return a%3===0;case e.Patterns.PATTERN011:return(s+a)%3===0;case e.Patterns.PATTERN100:return(Math.floor(s/2)+Math.floor(a/3))%2===0;case e.Patterns.PATTERN101:return s*a%2+s*a%3===0;case e.Patterns.PATTERN110:return(s*a%2+s*a%3)%2===0;case e.Patterns.PATTERN111:return(s*a%3+(s+a)%2)%2===0;default:throw new Error("bad maskPattern:"+i)}}e.applyMask=function(s,a){const o=a.size;for(let l=0;l<o;l++)for(let u=0;u<o;u++)a.isReserved(u,l)||a.xor(u,l,r(s,u,l))},e.getBestMask=function(s,a){const o=Object.keys(e.Patterns).length;let l=0,u=1/0;for(let d=0;d<o;d++){a(d),e.applyMask(d,s);const p=e.getPenaltyN1(s)+e.getPenaltyN2(s)+e.getPenaltyN3(s)+e.getPenaltyN4(s);e.applyMask(d,s),p<u&&(u=p,l=d)}return l}})(B2)),B2}var Q_={},c8;function UV(){if(c8)return Q_;c8=1;const e=MT(),n=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],r=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];return Q_.getBlocksCount=function(s,a){switch(a){case e.L:return n[(s-1)*4+0];case e.M:return n[(s-1)*4+1];case e.Q:return n[(s-1)*4+2];case e.H:return n[(s-1)*4+3];default:return}},Q_.getTotalCodewordsCount=function(s,a){switch(a){case e.L:return r[(s-1)*4+0];case e.M:return r[(s-1)*4+1];case e.Q:return r[(s-1)*4+2];case e.H:return r[(s-1)*4+3];default:return}},Q_}var z2={},Sm={},u8;function lOe(){if(u8)return Sm;u8=1;const e=new Uint8Array(512),n=new Uint8Array(256);return(function(){let i=1;for(let s=0;s<255;s++)e[s]=i,n[i]=s,i<<=1,i&256&&(i^=285);for(let s=255;s<512;s++)e[s]=e[s-255]})(),Sm.log=function(i){if(i<1)throw new Error("log("+i+")");return n[i]},Sm.exp=function(i){return e[i]},Sm.mul=function(i,s){return i===0||s===0?0:e[n[i]+n[s]]},Sm}var d8;function cOe(){return d8||(d8=1,(function(e){const n=lOe();e.mul=function(i,s){const a=new Uint8Array(i.length+s.length-1);for(let o=0;o<i.length;o++)for(let l=0;l<s.length;l++)a[o+l]^=n.mul(i[o],s[l]);return a},e.mod=function(i,s){let a=new Uint8Array(i);for(;a.length-s.length>=0;){const o=a[0];for(let u=0;u<s.length;u++)a[u]^=n.mul(s[u],o);let l=0;for(;l<a.length&&a[l]===0;)l++;a=a.slice(l)}return a},e.generateECPolynomial=function(i){let s=new Uint8Array([1]);for(let a=0;a<i;a++)s=e.mul(s,new Uint8Array([1,n.exp(a)]));return s}})(z2)),z2}var $2,h8;function uOe(){if(h8)return $2;h8=1;const e=cOe();function n(r){this.genPoly=void 0,this.degree=r,this.degree&&this.initialize(this.degree)}return n.prototype.initialize=function(i){this.degree=i,this.genPoly=e.generateECPolynomial(this.degree)},n.prototype.encode=function(i){if(!this.genPoly)throw new Error("Encoder not initialized");const s=new Uint8Array(i.length+this.degree);s.set(i);const a=e.mod(s,this.genPoly),o=this.degree-a.length;if(o>0){const l=new Uint8Array(this.degree);return l.set(a,o),l}return a},$2=n,$2}var F2={},H2={},W2={},f8;function VV(){return f8||(f8=1,W2.isValid=function(n){return!isNaN(n)&&n>=1&&n<=40}),W2}var So={},p8;function KV(){if(p8)return So;p8=1;const e="[0-9]+",n="[A-Z $%*+\\-./:]+";let r="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";r=r.replace(/u/g,"\\u");const i="(?:(?![A-Z0-9 $%*+\\-./:]|"+r+`)(?:.|[\r
]))+`;So.KANJI=new RegExp(r,"g"),So.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),So.BYTE=new RegExp(i,"g"),So.NUMERIC=new RegExp(e,"g"),So.ALPHANUMERIC=new RegExp(n,"g");const s=new RegExp("^"+r+"$"),a=new RegExp("^"+e+"$"),o=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");return So.testKanji=function(u){return s.test(u)},So.testNumeric=function(u){return a.test(u)},So.testAlphanumeric=function(u){return o.test(u)},So}var m8;function zd(){return m8||(m8=1,(function(e){const n=VV(),r=KV();e.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},e.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},e.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(a,o){if(!a.ccBits)throw new Error("Invalid mode: "+a);if(!n.isValid(o))throw new Error("Invalid version: "+o);return o>=1&&o<10?a.ccBits[0]:o<27?a.ccBits[1]:a.ccBits[2]},e.getBestModeForData=function(a){return r.testNumeric(a)?e.NUMERIC:r.testAlphanumeric(a)?e.ALPHANUMERIC:r.testKanji(a)?e.KANJI:e.BYTE},e.toString=function(a){if(a&&a.id)return a.id;throw new Error("Invalid mode")},e.isValid=function(a){return a&&a.bit&&a.ccBits};function i(s){if(typeof s!="string")throw new Error("Param is not a string");switch(s.toLowerCase()){case"numeric":return e.NUMERIC;case"alphanumeric":return e.ALPHANUMERIC;case"kanji":return e.KANJI;case"byte":return e.BYTE;default:throw new Error("Unknown mode: "+s)}}e.from=function(a,o){if(e.isValid(a))return a;try{return i(a)}catch{return o}}})(H2)),H2}var g8;function dOe(){return g8||(g8=1,(function(e){const n=Bd(),r=UV(),i=MT(),s=zd(),a=VV(),o=7973,l=n.getBCHDigit(o);function u(g,_,x){for(let v=1;v<=40;v++)if(_<=e.getCapacity(v,x,g))return v}function d(g,_){return s.getCharCountIndicator(g,_)+4}function p(g,_){let x=0;return g.forEach(function(v){const S=d(v.mode,_);x+=S+v.getBitsLength()}),x}function f(g,_){for(let x=1;x<=40;x++)if(p(g,x)<=e.getCapacity(x,_,s.MIXED))return x}e.from=function(_,x){return a.isValid(_)?parseInt(_,10):x},e.getCapacity=function(_,x,v){if(!a.isValid(_))throw new Error("Invalid QR Code version");typeof v>"u"&&(v=s.BYTE);const S=n.getSymbolTotalCodewords(_),w=r.getTotalCodewordsCount(_,x),N=(S-w)*8;if(v===s.MIXED)return N;const C=N-d(v,_);switch(v){case s.NUMERIC:return Math.floor(C/10*3);case s.ALPHANUMERIC:return Math.floor(C/11*2);case s.KANJI:return Math.floor(C/13);case s.BYTE:default:return Math.floor(C/8)}},e.getBestVersionForData=function(_,x){let v;const S=i.from(x,i.M);if(Array.isArray(_)){if(_.length>1)return f(_,S);if(_.length===0)return 1;v=_[0]}else v=_;return u(v.mode,v.getLength(),S)},e.getEncodedBits=function(_){if(!a.isValid(_)||_<7)throw new Error("Invalid QR Code version");let x=_<<12;for(;n.getBCHDigit(x)-l>=0;)x^=o<<n.getBCHDigit(x)-l;return _<<12|x}})(F2)),F2}var q2={},v8;function hOe(){if(v8)return q2;v8=1;const e=Bd(),n=1335,r=21522,i=e.getBCHDigit(n);return q2.getEncodedBits=function(a,o){const l=a.bit<<3|o;let u=l<<10;for(;e.getBCHDigit(u)-i>=0;)u^=n<<e.getBCHDigit(u)-i;return(l<<10|u)^r},q2}var U2={},V2,y8;function fOe(){if(y8)return V2;y8=1;const e=zd();function n(r){this.mode=e.NUMERIC,this.data=r.toString()}return n.getBitsLength=function(i){return 10*Math.floor(i/3)+(i%3?i%3*3+1:0)},n.prototype.getLength=function(){return this.data.length},n.prototype.getBitsLength=function(){return n.getBitsLength(this.data.length)},n.prototype.write=function(i){let s,a,o;for(s=0;s+3<=this.data.length;s+=3)a=this.data.substr(s,3),o=parseInt(a,10),i.put(o,10);const l=this.data.length-s;l>0&&(a=this.data.substr(s),o=parseInt(a,10),i.put(o,l*3+1))},V2=n,V2}var K2,_8;function pOe(){if(_8)return K2;_8=1;const e=zd(),n=["0","1","2","3","4","5","6","7","8","9","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"," ","$","%","*","+","-",".","/",":"];function r(i){this.mode=e.ALPHANUMERIC,this.data=i}return r.getBitsLength=function(s){return 11*Math.floor(s/2)+6*(s%2)},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(s){let a;for(a=0;a+2<=this.data.length;a+=2){let o=n.indexOf(this.data[a])*45;o+=n.indexOf(this.data[a+1]),s.put(o,11)}this.data.length%2&&s.put(n.indexOf(this.data[a]),6)},K2=r,K2}var Y2,x8;function mOe(){if(x8)return Y2;x8=1;const e=zd();function n(r){this.mode=e.BYTE,typeof r=="string"?this.data=new TextEncoder().encode(r):this.data=new Uint8Array(r)}return n.getBitsLength=function(i){return i*8},n.prototype.getLength=function(){return this.data.length},n.prototype.getBitsLength=function(){return n.getBitsLength(this.data.length)},n.prototype.write=function(r){for(let i=0,s=this.data.length;i<s;i++)r.put(this.data[i],8)},Y2=n,Y2}var G2,b8;function gOe(){if(b8)return G2;b8=1;const e=zd(),n=Bd();function r(i){this.mode=e.KANJI,this.data=i}return r.getBitsLength=function(s){return s*13},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(i){let s;for(s=0;s<this.data.length;s++){let a=n.toSJIS(this.data[s]);if(a>=33088&&a<=40956)a-=33088;else if(a>=57408&&a<=60351)a-=49472;else throw new Error("Invalid SJIS character: "+this.data[s]+`
Make sure your charset is UTF-8`);a=(a>>>8&255)*192+(a&255),i.put(a,13)}},G2=r,G2}var X2={exports:{}},k8;function vOe(){return k8||(k8=1,(function(e){var n={single_source_shortest_paths:function(r,i,s){var a={},o={};o[i]=0;var l=n.PriorityQueue.make();l.push(i,0);for(var u,d,p,f,g,_,x,v,S;!l.empty();){u=l.pop(),d=u.value,f=u.cost,g=r[d]||{};for(p in g)g.hasOwnProperty(p)&&(_=g[p],x=f+_,v=o[p],S=typeof o[p]>"u",(S||v>x)&&(o[p]=x,l.push(p,x),a[p]=d))}if(typeof s<"u"&&typeof o[s]>"u"){var w=["Could not find a path from ",i," to ",s,"."].join("");throw new Error(w)}return a},extract_shortest_path_from_predecessor_list:function(r,i){for(var s=[],a=i;a;)s.push(a),r[a],a=r[a];return s.reverse(),s},find_path:function(r,i,s){var a=n.single_source_shortest_paths(r,i,s);return n.extract_shortest_path_from_predecessor_list(a,s)},PriorityQueue:{make:function(r){var i=n.PriorityQueue,s={},a;r=r||{};for(a in i)i.hasOwnProperty(a)&&(s[a]=i[a]);return s.queue=[],s.sorter=r.sorter||i.default_sorter,s},default_sorter:function(r,i){return r.cost-i.cost},push:function(r,i){var s={value:r,cost:i};this.queue.push(s),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};e.exports=n})(X2)),X2.exports}var w8;function yOe(){return w8||(w8=1,(function(e){const n=zd(),r=fOe(),i=pOe(),s=mOe(),a=gOe(),o=KV(),l=Bd(),u=vOe();function d(w){return unescape(encodeURIComponent(w)).length}function p(w,N,C){const T=[];let A;for(;(A=w.exec(C))!==null;)T.push({data:A[0],index:A.index,mode:N,length:A[0].length});return T}function f(w){const N=p(o.NUMERIC,n.NUMERIC,w),C=p(o.ALPHANUMERIC,n.ALPHANUMERIC,w);let T,A;return l.isKanjiModeEnabled()?(T=p(o.BYTE,n.BYTE,w),A=p(o.KANJI,n.KANJI,w)):(T=p(o.BYTE_KANJI,n.BYTE,w),A=[]),N.concat(C,T,A).sort(function(D,F){return D.index-F.index}).map(function(D){return{data:D.data,mode:D.mode,length:D.length}})}function g(w,N){switch(N){case n.NUMERIC:return r.getBitsLength(w);case n.ALPHANUMERIC:return i.getBitsLength(w);case n.KANJI:return a.getBitsLength(w);case n.BYTE:return s.getBitsLength(w)}}function _(w){return w.reduce(function(N,C){const T=N.length-1>=0?N[N.length-1]:null;return T&&T.mode===C.mode?(N[N.length-1].data+=C.data,N):(N.push(C),N)},[])}function x(w){const N=[];for(let C=0;C<w.length;C++){const T=w[C];switch(T.mode){case n.NUMERIC:N.push([T,{data:T.data,mode:n.ALPHANUMERIC,length:T.length},{data:T.data,mode:n.BYTE,length:T.length}]);break;case n.ALPHANUMERIC:N.push([T,{data:T.data,mode:n.BYTE,length:T.length}]);break;case n.KANJI:N.push([T,{data:T.data,mode:n.BYTE,length:d(T.data)}]);break;case n.BYTE:N.push([{data:T.data,mode:n.BYTE,length:d(T.data)}])}}return N}function v(w,N){const C={},T={start:{}};let A=["start"];for(let E=0;E<w.length;E++){const D=w[E],F=[];for(let B=0;B<D.length;B++){const H=D[B],$=""+E+B;F.push($),C[$]={node:H,lastCount:0},T[$]={};for(let z=0;z<A.length;z++){const W=A[z];C[W]&&C[W].node.mode===H.mode?(T[W][$]=g(C[W].lastCount+H.length,H.mode)-g(C[W].lastCount,H.mode),C[W].lastCount+=H.length):(C[W]&&(C[W].lastCount=H.length),T[W][$]=g(H.length,H.mode)+4+n.getCharCountIndicator(H.mode,N))}}A=F}for(let E=0;E<A.length;E++)T[A[E]].end=0;return{map:T,table:C}}function S(w,N){let C;const T=n.getBestModeForData(w);if(C=n.from(N,T),C!==n.BYTE&&C.bit<T.bit)throw new Error('"'+w+'" cannot be encoded with mode '+n.toString(C)+`.
 Suggested mode is: `+n.toString(T));switch(C===n.KANJI&&!l.isKanjiModeEnabled()&&(C=n.BYTE),C){case n.NUMERIC:return new r(w);case n.ALPHANUMERIC:return new i(w);case n.KANJI:return new a(w);case n.BYTE:return new s(w)}}e.fromArray=function(N){return N.reduce(function(C,T){return typeof T=="string"?C.push(S(T,null)):T.data&&C.push(S(T.data,T.mode)),C},[])},e.fromString=function(N,C){const T=f(N,l.isKanjiModeEnabled()),A=x(T),E=v(A,C),D=u.find_path(E.map,"start","end"),F=[];for(let B=1;B<D.length-1;B++)F.push(E.table[D[B]].node);return e.fromArray(_(F))},e.rawSplit=function(N){return e.fromArray(f(N,l.isKanjiModeEnabled()))}})(U2)),U2}var S8;function _Oe(){if(S8)return R2;S8=1;const e=Bd(),n=MT(),r=rOe(),i=iOe(),s=sOe(),a=aOe(),o=oOe(),l=UV(),u=uOe(),d=dOe(),p=hOe(),f=zd(),g=yOe();function _(E,D){const F=E.size,B=a.getPositions(D);for(let H=0;H<B.length;H++){const $=B[H][0],z=B[H][1];for(let W=-1;W<=7;W++)if(!($+W<=-1||F<=$+W))for(let P=-1;P<=7;P++)z+P<=-1||F<=z+P||(W>=0&&W<=6&&(P===0||P===6)||P>=0&&P<=6&&(W===0||W===6)||W>=2&&W<=4&&P>=2&&P<=4?E.set($+W,z+P,!0,!0):E.set($+W,z+P,!1,!0))}}function x(E){const D=E.size;for(let F=8;F<D-8;F++){const B=F%2===0;E.set(F,6,B,!0),E.set(6,F,B,!0)}}function v(E,D){const F=s.getPositions(D);for(let B=0;B<F.length;B++){const H=F[B][0],$=F[B][1];for(let z=-2;z<=2;z++)for(let W=-2;W<=2;W++)z===-2||z===2||W===-2||W===2||z===0&&W===0?E.set(H+z,$+W,!0,!0):E.set(H+z,$+W,!1,!0)}}function S(E,D){const F=E.size,B=d.getEncodedBits(D);let H,$,z;for(let W=0;W<18;W++)H=Math.floor(W/3),$=W%3+F-8-3,z=(B>>W&1)===1,E.set(H,$,z,!0),E.set($,H,z,!0)}function w(E,D,F){const B=E.size,H=p.getEncodedBits(D,F);let $,z;for($=0;$<15;$++)z=(H>>$&1)===1,$<6?E.set($,8,z,!0):$<8?E.set($+1,8,z,!0):E.set(B-15+$,8,z,!0),$<8?E.set(8,B-$-1,z,!0):$<9?E.set(8,15-$-1+1,z,!0):E.set(8,15-$-1,z,!0);E.set(B-8,8,1,!0)}function N(E,D){const F=E.size;let B=-1,H=F-1,$=7,z=0;for(let W=F-1;W>0;W-=2)for(W===6&&W--;;){for(let P=0;P<2;P++)if(!E.isReserved(H,W-P)){let q=!1;z<D.length&&(q=(D[z]>>>$&1)===1),E.set(H,W-P,q),$--,$===-1&&(z++,$=7)}if(H+=B,H<0||F<=H){H-=B,B=-B;break}}}function C(E,D,F){const B=new r;F.forEach(function(P){B.put(P.mode.bit,4),B.put(P.getLength(),f.getCharCountIndicator(P.mode,E)),P.write(B)});const H=e.getSymbolTotalCodewords(E),$=l.getTotalCodewordsCount(E,D),z=(H-$)*8;for(B.getLengthInBits()+4<=z&&B.put(0,4);B.getLengthInBits()%8!==0;)B.putBit(0);const W=(z-B.getLengthInBits())/8;for(let P=0;P<W;P++)B.put(P%2?17:236,8);return T(B,E,D)}function T(E,D,F){const B=e.getSymbolTotalCodewords(D),H=l.getTotalCodewordsCount(D,F),$=B-H,z=l.getBlocksCount(D,F),W=B%z,P=z-W,q=Math.floor(B/z),I=Math.floor($/z),Q=I+1,K=q-I,Z=new u(K);let Y=0;const R=new Array(z),U=new Array(z);let V=0;const ie=new Uint8Array(E.buffer);for(let de=0;de<z;de++){const ue=de<P?I:Q;R[de]=ie.slice(Y,Y+ue),U[de]=Z.encode(R[de]),Y+=ue,V=Math.max(V,ue)}const te=new Uint8Array(B);let X=0,se,re;for(se=0;se<V;se++)for(re=0;re<z;re++)se<R[re].length&&(te[X++]=R[re][se]);for(se=0;se<K;se++)for(re=0;re<z;re++)te[X++]=U[re][se];return te}function A(E,D,F,B){let H;if(Array.isArray(E))H=g.fromArray(E);else if(typeof E=="string"){let q=D;if(!q){const I=g.rawSplit(E);q=d.getBestVersionForData(I,F)}H=g.fromString(E,q||40)}else throw new Error("Invalid data");const $=d.getBestVersionForData(H,F);if(!$)throw new Error("The amount of data is too big to be stored in a QR Code");if(!D)D=$;else if(D<$)throw new Error(`
The chosen QR Code version cannot contain this amount of data.
Minimum version required to store current data is: `+$+`.
`);const z=C(D,F,H),W=e.getSymbolSize(D),P=new i(W);return _(P,D),x(P),v(P,D),w(P,F,0),D>=7&&S(P,D),N(P,z),isNaN(B)&&(B=o.getBestMask(P,w.bind(null,P,F))),o.applyMask(B,P),w(P,F,B),{modules:P,version:D,errorCorrectionLevel:F,maskPattern:B,segments:H}}return R2.create=function(D,F){if(typeof D>"u"||D==="")throw new Error("No input text");let B=n.M,H,$;return typeof F<"u"&&(B=n.from(F.errorCorrectionLevel,n.M),H=d.from(F.version),$=o.from(F.maskPattern),F.toSJISFunc&&e.setToSJISFunction(F.toSJISFunc)),A(D,H,B,$)},R2}var Q2={},Z2={},C8;function YV(){return C8||(C8=1,(function(e){function n(r){if(typeof r=="number"&&(r=r.toString()),typeof r!="string")throw new Error("Color should be defined as hex string");let i=r.slice().replace("#","").split("");if(i.length<3||i.length===5||i.length>8)throw new Error("Invalid hex color: "+r);(i.length===3||i.length===4)&&(i=Array.prototype.concat.apply([],i.map(function(a){return[a,a]}))),i.length===6&&i.push("F","F");const s=parseInt(i.join(""),16);return{r:s>>24&255,g:s>>16&255,b:s>>8&255,a:s&255,hex:"#"+i.slice(0,6).join("")}}e.getOptions=function(i){i||(i={}),i.color||(i.color={});const s=typeof i.margin>"u"||i.margin===null||i.margin<0?4:i.margin,a=i.width&&i.width>=21?i.width:void 0,o=i.scale||4;return{width:a,scale:a?4:o,margin:s,color:{dark:n(i.color.dark||"#000000ff"),light:n(i.color.light||"#ffffffff")},type:i.type,rendererOpts:i.rendererOpts||{}}},e.getScale=function(i,s){return s.width&&s.width>=i+s.margin*2?s.width/(i+s.margin*2):s.scale},e.getImageWidth=function(i,s){const a=e.getScale(i,s);return Math.floor((i+s.margin*2)*a)},e.qrToImageData=function(i,s,a){const o=s.modules.size,l=s.modules.data,u=e.getScale(o,a),d=Math.floor((o+a.margin*2)*u),p=a.margin*u,f=[a.color.light,a.color.dark];for(let g=0;g<d;g++)for(let _=0;_<d;_++){let x=(g*d+_)*4,v=a.color.light;if(g>=p&&_>=p&&g<d-p&&_<d-p){const S=Math.floor((g-p)/u),w=Math.floor((_-p)/u);v=f[l[S*o+w]?1:0]}i[x++]=v.r,i[x++]=v.g,i[x++]=v.b,i[x]=v.a}}})(Z2)),Z2}var j8;function xOe(){return j8||(j8=1,(function(e){const n=YV();function r(s,a,o){s.clearRect(0,0,a.width,a.height),a.style||(a.style={}),a.height=o,a.width=o,a.style.height=o+"px",a.style.width=o+"px"}function i(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}e.render=function(a,o,l){let u=l,d=o;typeof u>"u"&&(!o||!o.getContext)&&(u=o,o=void 0),o||(d=i()),u=n.getOptions(u);const p=n.getImageWidth(a.modules.size,u),f=d.getContext("2d"),g=f.createImageData(p,p);return n.qrToImageData(g.data,a,u),r(f,d,p),f.putImageData(g,0,0),d},e.renderToDataURL=function(a,o,l){let u=l;typeof u>"u"&&(!o||!o.getContext)&&(u=o,o=void 0),u||(u={});const d=e.render(a,o,u),p=u.type||"image/png",f=u.rendererOpts||{};return d.toDataURL(p,f.quality)}})(Q2)),Q2}var J2={},N8;function bOe(){if(N8)return J2;N8=1;const e=YV();function n(s,a){const o=s.a/255,l=a+'="'+s.hex+'"';return o<1?l+" "+a+'-opacity="'+o.toFixed(2).slice(1)+'"':l}function r(s,a,o){let l=s+a;return typeof o<"u"&&(l+=" "+o),l}function i(s,a,o){let l="",u=0,d=!1,p=0;for(let f=0;f<s.length;f++){const g=Math.floor(f%a),_=Math.floor(f/a);!g&&!d&&(d=!0),s[f]?(p++,f>0&&g>0&&s[f-1]||(l+=d?r("M",g+o,.5+_+o):r("m",u,0),u=0,d=!1),g+1<a&&s[f+1]||(l+=r("h",p),p=0)):u++}return l}return J2.render=function(a,o,l){const u=e.getOptions(o),d=a.modules.size,p=a.modules.data,f=d+u.margin*2,g=u.color.light.a?"<path "+n(u.color.light,"fill")+' d="M0 0h'+f+"v"+f+'H0z"/>':"",_="<path "+n(u.color.dark,"stroke")+' d="'+i(p,d,u.margin)+'"/>',x='viewBox="0 0 '+f+" "+f+'"',S='<svg xmlns="http://www.w3.org/2000/svg" '+(u.width?'width="'+u.width+'" height="'+u.width+'" ':"")+x+' shape-rendering="crispEdges">'+g+_+`</svg>
`;return typeof l=="function"&&l(null,S),S},J2}var E8;function kOe(){if(E8)return Lh;E8=1;const e=nOe(),n=_Oe(),r=xOe(),i=bOe();function s(a,o,l,u,d){const p=[].slice.call(arguments,1),f=p.length,g=typeof p[f-1]=="function";if(!g&&!e())throw new Error("Callback required as last argument");if(g){if(f<2)throw new Error("Too few arguments provided");f===2?(d=l,l=o,o=u=void 0):f===3&&(o.getContext&&typeof d>"u"?(d=u,u=void 0):(d=u,u=l,l=o,o=void 0))}else{if(f<1)throw new Error("Too few arguments provided");return f===1?(l=o,o=u=void 0):f===2&&!o.getContext&&(u=l,l=o,o=void 0),new Promise(function(_,x){try{const v=n.create(l,u);_(a(v,o,u))}catch(v){x(v)}})}try{const _=n.create(l,u);d(null,a(_,o,u))}catch(_){d(_)}}return Lh.create=n.create,Lh.toCanvas=s.bind(null,r.render),Lh.toDataURL=s.bind(null,r.renderToDataURL),Lh.toString=s.bind(null,function(a,o,l){return i.render(a,l)}),Lh}var wOe=kOe();const SOe=pu(wOe);function COe(e){const n=Ti||window.location.origin;return JSON.stringify({v:1,type:"revka-pair",host:`${n}${Gr||""}`.replace(/\/+$/,""),code:e})}function jOe(){const{t:e,tpl:n}=cn(),[r,i]=b.useState([]),[s,a]=b.useState(!0),[o,l]=b.useState(null),[u,d]=b.useState(null),[p,f]=b.useState(!1),[g,_]=b.useState(!1),[x,v]=b.useState(null),[S,w]=b.useState("Revka CLI"),[N,C]=b.useState(()=>lB("cli").hardware??""),[T,A]=b.useState(null),[E,D]=b.useState(null),F=b.useRef(0),B=b.useCallback(async()=>{a(!0);try{const P=await ut("/api/devices");i(P.devices??[])}catch(P){D({tone:"error",message:P instanceof Error?P.message:e("pairing.err.load_devices")})}finally{a(!1)}},[e]);b.useEffect(()=>{cB().then(P=>{P.pairing_code&&l(P.pairing_code)}).catch(()=>{})},[]),b.useEffect(()=>{B()},[B]),b.useEffect(()=>{if(!o){d(null);return}const P=++F.current;SOe.toDataURL(COe(o),{errorCorrectionLevel:"M",margin:1,width:256,color:{dark:"#0a0a0a",light:"#ffffff"}}).then(q=>{F.current===P&&d(q)}).catch(()=>{F.current===P&&d(null)})},[o]);const H=async()=>{f(!0);try{const P=await ut("/api/pairing/initiate",{method:"POST"});l(P.pairing_code),v(null),D({tone:"success",message:e("pairing.toast.code_generated")})}catch(P){D({tone:"error",message:P instanceof Error?P.message:e("pairing.err.gen_code")})}finally{f(!1)}},$=async()=>{if(o){_(!0),v(null);try{const P=await sQ(o,{device_name:S.trim()||"Revka CLI",device_type:"cli",hardware:N.trim()||void 0});v(P.token),l(null),await B(),D({tone:"success",message:e("pairing.toast.token_minted")})}catch(P){D({tone:"error",message:P instanceof Error?P.message:e("pairing.err.mint_token")})}finally{_(!1)}}},z=P=>{if(!P)return e("pairing.unknown");const q={"legacy-pair":e("pairing.device_type.api_client"),"api-client":e("pairing.device_type.api_client"),browser:e("pairing.device_type.browser"),cli:e("pairing.device_type.cli"),mobile:e("pairing.device_type.mobile"),tablet:e("pairing.device_type.tablet")};return q[P]?q[P]:P.split(/[-_]/).filter(Boolean).map(I=>I.charAt(0).toUpperCase()+I.slice(1)).join(" ")},W=async P=>{try{await ut(`/api/devices/${P}`,{method:"DELETE"}),i(q=>q.filter(I=>I.id!==P)),D({tone:"success",message:e("pairing.toast.device_revoked")})}catch(q){D({tone:"error",message:q instanceof Error?q.message:e("pairing.err.revoke")})}finally{A(null)}};return c.jsxs("div",{className:"flex h-[calc(100vh-6rem)] flex-col gap-3",children:[E?c.jsx(Qo,{tone:E.tone,message:E.message,onDismiss:()=>D(null)}):null,c.jsx(si,{kicker:e("pairing.kicker"),title:e("pairing.title"),description:e("pairing.description"),actions:c.jsxs(c.Fragment,{children:[c.jsxs("button",{className:"revka-button",onClick:B,disabled:s,children:[c.jsx($r,{className:`h-4 w-4 ${s?"animate-spin":""}`}),e("pairing.reload")]}),c.jsxs("button",{className:"revka-button","data-variant":"primary",onClick:H,disabled:p,children:[c.jsx(lC,{className:"h-4 w-4"}),e(p?"pairing.generating":"pairing.pair_new_device")]})]})}),c.jsxs("div",{className:"grid gap-3",style:{gridTemplateColumns:o?"minmax(0, 1fr) 22rem":"minmax(0, 1fr)"},children:[o?c.jsxs(st,{className:"p-5",variant:"secondary",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(kJ,{className:"h-4 w-4",style:{color:"var(--revka-signal-network)"}}),c.jsx("div",{className:"revka-kicker",children:e("pairing.active_code")})]}),c.jsxs("div",{className:"mt-5 grid grid-cols-[auto_minmax(0,1fr)] gap-5",children:[c.jsx("div",{className:"flex h-[224px] w-[224px] items-center justify-center overflow-hidden rounded-[12px] border",style:{borderColor:"var(--revka-border-soft)",background:"#ffffff"},children:u?c.jsx("img",{src:u,alt:"Pairing QR code",className:"h-full w-full object-contain"}):c.jsx("div",{className:"text-xs",style:{color:"#666"},children:e("pairing.rendering")})}),c.jsxs("div",{className:"flex min-w-0 flex-col justify-between",children:[c.jsxs("div",{children:[c.jsx("div",{className:"rounded-[12px] border px-4 py-3 text-center font-mono text-3xl font-bold tracking-[0.4em]",style:{borderColor:"color-mix(in srgb, var(--revka-signal-selected) 35%, transparent)",background:"color-mix(in srgb, var(--revka-signal-selected) 12%, transparent)",color:"var(--revka-text-primary)"},children:o}),c.jsx("p",{className:"mt-3 text-xs leading-5",style:{color:"var(--revka-text-secondary)"},children:e("pairing.code_hint")})]}),c.jsxs("div",{className:"mt-4 grid gap-2 sm:grid-cols-2",children:[c.jsxs("label",{className:"min-w-0 text-xs font-medium",style:{color:"var(--revka-text-secondary)"},children:[e("pairing.cli_device_name"),c.jsx("input",{className:"revka-input mt-1 h-9 w-full",value:S,onChange:P=>w(P.target.value)})]}),c.jsxs("label",{className:"min-w-0 text-xs font-medium",style:{color:"var(--revka-text-secondary)"},children:[e("pairing.cli_hardware"),c.jsx("input",{className:"revka-input mt-1 h-9 w-full",value:N,onChange:P=>C(P.target.value),placeholder:e("pairing.cli_hardware_placeholder")})]})]}),c.jsxs("div",{className:"mt-4 flex flex-wrap gap-2",children:[c.jsx("button",{className:"revka-button",onClick:async()=>{const P=await Ja(o);D(P?{tone:"success",message:e("pairing.toast.code_copied")}:{tone:"error",message:e("pairing.toast.copy_failed")})},children:e("pairing.copy_code")}),c.jsxs("button",{className:"revka-button",onClick:H,disabled:p,children:[c.jsx($r,{className:`h-4 w-4 ${p?"animate-spin":""}`}),e("pairing.rotate")]}),c.jsxs("button",{className:"revka-button","data-variant":"primary",onClick:$,disabled:g,children:[c.jsx(W3,{className:"h-4 w-4"}),e(g?"pairing.minting_token":"pairing.mint_cli_token")]})]})]})]})]}):c.jsx(st,{className:"p-5",children:c.jsx(Ct,{tone:"empty",title:e("pairing.no_code_title"),description:e("pairing.no_code_desc"),action:c.jsxs("button",{className:"revka-button","data-variant":"primary",onClick:H,disabled:p,children:[c.jsx(lC,{className:"h-4 w-4"}),e(p?"pairing.generating":"pairing.pair_new_device")]})})}),o?c.jsxs(st,{className:"p-4",variant:"utility",children:[c.jsx("div",{className:"revka-kicker",children:e("pairing.how_to_scan")}),c.jsxs("ol",{className:"mt-3 list-inside list-decimal space-y-2 text-xs leading-5",style:{color:"var(--revka-text-secondary)"},children:[c.jsx("li",{children:e("pairing.scan_step1")}),c.jsxs("li",{children:[e("pairing.scan_step2_prefix"),c.jsx("span",{style:{color:"var(--revka-text-primary)"},children:e("pairing.scan_step2_action")}),e("pairing.scan_step2_suffix")]}),c.jsx("li",{children:e("pairing.scan_step3")}),c.jsx("li",{children:e("pairing.scan_step4")})]})]}):null]}),x?c.jsx(st,{className:"p-4",variant:"utility",children:c.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(W3,{className:"h-4 w-4",style:{color:"var(--revka-signal-network)"}}),c.jsx("div",{className:"revka-kicker",children:e("pairing.minted_token")})]}),c.jsx("div",{className:"mt-2 max-w-full break-all rounded-[8px] border px-3 py-2 font-mono text-xs",style:{borderColor:"var(--revka-border-soft)",color:"var(--revka-text-primary)"},children:x})]}),c.jsxs("button",{className:"revka-button",onClick:async()=>{const P=await Ja(x);D(P?{tone:"success",message:e("pairing.toast.token_copied")}:{tone:"error",message:e("pairing.toast.copy_failed")})},children:[c.jsx(Xl,{className:"h-4 w-4"}),e("pairing.copy_token")]})]})}):null,c.jsxs(st,{className:"min-h-0 flex-1 overflow-hidden p-0",children:[c.jsx("div",{className:"flex items-center justify-between border-b px-4 py-3",style:{borderColor:"var(--revka-border-soft)"},children:c.jsx("div",{className:"revka-kicker",children:n("pairing.paired_devices",{count:r.length})})}),s?c.jsx("div",{className:"flex min-h-[180px] items-center justify-center",children:c.jsx(Ct,{tone:"loading",title:e("pairing.loading_devices")})}):r.length===0?c.jsx("div",{className:"p-4",children:c.jsx(Ct,{tone:"empty",title:e("pairing.no_devices_title"),description:e("pairing.no_devices_desc")})}):c.jsx("div",{className:"overflow-auto",children:c.jsxs("table",{className:"revka-table w-full",children:[c.jsx("thead",{children:c.jsxs("tr",{children:[c.jsx("th",{children:e("pairing.col.name")}),c.jsx("th",{children:e("pairing.col.type")}),c.jsx("th",{children:e("pairing.col.hardware")}),c.jsx("th",{children:e("pairing.col.paired")}),c.jsx("th",{children:e("pairing.col.last_seen")}),c.jsx("th",{children:e("pairing.col.ip")}),c.jsx("th",{className:"text-right",children:e("pairing.col.actions")})]})}),c.jsx("tbody",{children:r.map(P=>c.jsxs("tr",{children:[c.jsx("td",{className:"text-sm font-medium",style:{color:"var(--revka-text-primary)"},children:P.name||e("pairing.unnamed")}),c.jsx("td",{style:{color:"var(--revka-text-secondary)"},children:z(P.device_type)}),c.jsx("td",{className:"text-xs",style:{color:"var(--revka-text-secondary)"},children:P.hardware||"—"}),c.jsx("td",{className:"text-xs",style:{color:"var(--revka-text-faint)"},children:new Date(P.paired_at).toLocaleDateString()}),c.jsx("td",{className:"text-xs",style:{color:"var(--revka-text-faint)"},children:new Date(P.last_seen).toLocaleString()}),c.jsx("td",{className:"font-mono text-xs",style:{color:"var(--revka-text-secondary)"},children:P.ip_address||"—"}),c.jsx("td",{className:"text-right",children:T===P.id?c.jsxs("div",{className:"inline-flex items-center gap-2",children:[c.jsx("span",{className:"text-xs",style:{color:"var(--revka-status-danger)"},children:e("pairing.revoke")}),c.jsx("button",{className:"text-xs font-semibold",style:{color:"var(--revka-status-danger)"},onClick:()=>W(P.id),children:e("pairing.yes")}),c.jsx("button",{className:"text-xs font-semibold",style:{color:"var(--revka-text-secondary)"},onClick:()=>A(null),children:e("pairing.no")})]}):c.jsx("button",{className:"revka-button",onClick:()=>A(P.id),title:e("pairing.revoke_title"),children:c.jsx(Wi,{className:"h-4 w-4"})})})]},P.id))})]})})]})]})}const RT="revka-agent-events-v1",A8=500,NOe=b.createContext({events:[],pushEvent:()=>{},clearEvents:()=>{}});function EOe(){try{const e=sessionStorage.getItem(RT);if(e){const n=JSON.parse(e);if(Array.isArray(n))return n}}catch{}return[]}function AOe(e){try{sessionStorage.setItem(RT,JSON.stringify(e))}catch{}}function TOe({children:e}){const[n,r]=b.useState(EOe),i=b.useRef(n);i.current=n,b.useEffect(()=>{AOe(n)},[n]);const s=b.useCallback(o=>{r(l=>{if(l.length>0&&l.some(p=>p.agentId===o.agentId&&p.timestamp===o.timestamp&&p.type===o.type))return l;const d=[...l,o];return d.length>A8?d.slice(d.length-A8):d})},[]),a=b.useCallback(()=>{r([]),sessionStorage.removeItem(RT)},[]);return b.useEffect(()=>{const o=new pv;o.onEvent=d=>{if(d.type!=="channel_event")return;const p=d.payload;if(!p||!p.type||!p.agentId)return;const f={type:p.type,agentId:p.agentId,agentTitle:p.agentTitle??"",content:p.content??{},timestamp:p.timestamp??new Date().toISOString()};s(f)},o.connect();const l=()=>{document.visibilityState==="visible"&&o.reconnectNow()},u=()=>o.reconnectNow();return document.addEventListener("visibilitychange",l),window.addEventListener("online",u),()=>{document.removeEventListener("visibilitychange",l),window.removeEventListener("online",u),o.disconnect()}},[s]),c.jsx(NOe.Provider,{value:{events:n,pushEvent:s,clearEvents:a},children:e})}function MOe(){const{toasts:e,dismissToast:n}=ZE();return e.length===0?null:c.jsx("div",{className:"pointer-events-none fixed top-4 right-4 z-50 flex w-[min(22rem,90vw)] flex-col gap-2",children:e.map(r=>c.jsxs("div",{className:"revka-panel pointer-events-auto flex gap-3 p-3 shadow-lg",style:{borderColor:"var(--revka-signal-live)",background:"var(--revka-surface-raised, var(--revka-surface))"},role:"alert",children:[c.jsx(s0,{className:"mt-0.5 h-4 w-4 shrink-0",style:{color:"var(--revka-signal-live)"}}),c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsx("div",{className:"revka-kicker text-[10px]",children:"Approval needed"}),c.jsx("div",{className:"mt-0.5 truncate text-sm font-medium",children:r.workflowName||r.title}),r.message?c.jsx("p",{className:"mt-1 line-clamp-2 text-xs",style:{color:"var(--revka-text-secondary)"},children:r.message}):null,c.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[c.jsx(bs,{to:`/runs?run=${encodeURIComponent(r.runId)}`,className:"revka-button px-2 py-1 text-xs",onClick:()=>n(r.toastId),children:"Review"}),c.jsx("button",{type:"button",className:"text-xs underline-offset-2 hover:underline",style:{color:"var(--revka-text-secondary)"},onClick:()=>n(r.toastId),children:"Dismiss"})]})]}),c.jsx("button",{type:"button","aria-label":"Dismiss",onClick:()=>n(r.toastId),className:"self-start text-[var(--revka-text-secondary)] hover:text-[var(--revka-text)]",children:c.jsx(mi,{className:"h-4 w-4"})})]},r.toastId))})}const GV="revka-locale",ROe="en";function OOe(){const e=localStorage.getItem(GV);return e||ROe}function DOe(e){console.log("saveLocale",e),localStorage.setItem(GV,e)}const XN=b.createContext({locale:"en",setAppLocale:()=>{}}),POe=()=>b.useContext(XN);function LOe({onPair:e}){const[n,r]=b.useState(""),[i,s]=b.useState(""),[a,o]=b.useState(!1),[l,u]=b.useState(null),[d,p]=b.useState(!0);b.useEffect(()=>{let g=!1;return cB().then(_=>{!g&&_.pairing_code&&u(_.pairing_code)}).catch(()=>{}).finally(()=>{g||p(!1)}),()=>{g=!0}},[]);const f=async g=>{g.preventDefault(),o(!0),s("");try{await e(n)}catch(_){s(_ instanceof Error?_.message:"Pairing failed")}finally{o(!1)}};return c.jsx("div",{className:"min-h-screen flex items-center justify-center",style:{background:"var(--pc-bg-base)"},children:c.jsxs("div",{className:"relative surface-panel p-8 w-full max-w-md animate-fade-in-scale",children:[c.jsxs("div",{className:"text-center mb-8",children:[c.jsx("img",{src:id("revka-icon.png"),alt:"Revka",className:"revka-brand-logo h-20 w-20 rounded-2xl object-contain mx-auto mb-4 animate-float",onError:g=>{g.currentTarget.style.display="none"}}),c.jsx("h1",{className:"text-2xl font-bold mb-2 text-gradient-blue",children:"Revka"}),c.jsx("p",{className:"text-sm",style:{color:"var(--pc-text-muted)"},children:l?"Your pairing code":"Enter the pairing code from your terminal"})]}),!d&&l&&c.jsxs("div",{className:"mb-6 p-4 rounded-2xl text-center border",style:{background:"var(--pc-accent-glow)",borderColor:"var(--pc-accent-dim)"},children:[c.jsx("div",{className:"text-4xl font-mono font-bold tracking-[0.4em] py-2",style:{color:"var(--pc-text-primary)"},children:l}),c.jsx("p",{className:"text-xs mt-2",style:{color:"var(--pc-text-muted)"},children:"Enter this code below or on another device"})]}),c.jsxs("form",{onSubmit:f,children:[c.jsx("input",{type:"text",value:n,onChange:g=>r(g.target.value),placeholder:"6-digit code",className:"input-electric w-full px-4 py-4 text-center text-2xl tracking-[0.3em] font-medium mb-4",maxLength:6,autoFocus:!0}),i&&c.jsx("p",{"aria-live":"polite",className:"text-sm mb-4 text-center animate-fade-in",style:{color:"var(--color-status-error)"},children:i}),c.jsx("button",{type:"submit",disabled:a||n.length<6,className:"btn-electric w-full py-3.5 text-sm font-semibold tracking-wide",children:a?c.jsxs("span",{className:"flex items-center justify-center gap-2",children:[c.jsx("span",{className:"h-4 w-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Pairing..."]}):"Pair"})]})]})})}function IOe(){const{pathname:e}=is(),{isAuthenticated:n,requiresPairing:r,loading:i,pair:s,logout:a}=xB(),[o,l]=b.useState(OOe()),u=XJ();K3(o);const d=p=>{l(p),K3(p),DOe(p)};return b.useEffect(()=>{const p=()=>{a()};return window.addEventListener("revka-unauthorized",p),()=>window.removeEventListener("revka-unauthorized",p)},[a]),e==="/"?c.jsx(cC.Provider,{value:u,children:c.jsx(XN.Provider,{value:{locale:o,setAppLocale:d},children:c.jsx(S3,{children:c.jsx(gr,{path:"/",element:c.jsx(UJ,{})})})})}):i?c.jsx("div",{className:"min-h-screen flex items-center justify-center",style:{background:"var(--pc-bg-base)"},children:c.jsxs("div",{className:"flex flex-col items-center gap-4 animate-fade-in",children:[c.jsx("div",{className:"h-10 w-10 border-2 rounded-full animate-spin",style:{borderColor:"var(--pc-border)",borderTopColor:"var(--pc-accent)"}}),c.jsx("p",{className:"text-sm",style:{color:"var(--pc-text-muted)"},children:"Connecting..."})]})}):!n&&r?c.jsx(LOe,{onPair:s}):c.jsx(cC.Provider,{value:u,children:c.jsx(XN.Provider,{value:{locale:o,setAppLocale:d},children:c.jsx(TOe,{children:c.jsxs(Lue,{children:[c.jsx(MOe,{}),c.jsxs(S3,{children:[c.jsx(gr,{path:"/memory-auditor",element:c.jsx(w3,{to:"/memory",replace:!0})}),c.jsxs(gr,{element:c.jsx(Fue,{}),children:[c.jsx(gr,{path:"/dashboard",element:c.jsx(t_e,{})}),c.jsx(gr,{path:"/workflows",element:c.jsx(JEe,{})}),c.jsx(gr,{path:"/runs",element:c.jsx(gAe,{})}),c.jsx(gr,{path:"/teams",element:c.jsx(kAe,{})}),c.jsx(gr,{path:"/canvas",element:c.jsx(SAe,{})}),c.jsx(gr,{path:"/agents",element:c.jsx(CAe,{})}),c.jsx(gr,{path:"/integrations",element:c.jsx(b3e,{})}),c.jsx(gr,{path:"/config",element:c.jsx(q3e,{})}),c.jsx(gr,{path:"/assets",element:c.jsx(a3e,{})}),c.jsx(gr,{path:"/skins",element:c.jsx(j3e,{})}),c.jsx(gr,{path:"/skills",element:c.jsx(w3e,{})}),c.jsx(gr,{path:"/logs",element:c.jsx(v3e,{})}),c.jsx(gr,{path:"/audit",element:c.jsx(p3e,{})}),c.jsx(gr,{path:"/doctor",element:c.jsx(x3e,{})}),c.jsx(gr,{path:"/memory",element:c.jsx(f3e,{})}),c.jsx(gr,{path:"/cost",element:c.jsx(y3e,{})}),c.jsx(gr,{path:"/cron",element:c.jsx(eOe,{})}),c.jsx(gr,{path:"/tools",element:c.jsx(tOe,{})}),c.jsx(gr,{path:"/pairing",element:c.jsx(jOe,{})}),c.jsx(gr,{path:"*",element:c.jsx(w3,{to:"/dashboard",replace:!0})})]})]})]})})})})}function BOe(){return c.jsx(jZ,{children:c.jsx(BZ,{children:c.jsx(IOe,{})})})}cG.createRoot(document.getElementById("root")).render(c.jsx(Wf.StrictMode,{children:c.jsx(PX,{basename:Gr||"/",children:c.jsx(BOe,{})})}));
