spexcode 0.2.1 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/README.md +147 -103
  2. package/README.zh-CN.md +123 -88
  3. package/package.json +1 -1
  4. package/spec-cli/bin/spex.mjs +24 -1
  5. package/spec-cli/src/attach.ts +50 -0
  6. package/spec-cli/src/cli.ts +214 -62
  7. package/spec-cli/src/client.ts +47 -9
  8. package/spec-cli/src/{self.ts → doctor.ts} +26 -25
  9. package/spec-cli/src/guide.ts +63 -11
  10. package/spec-cli/src/harness.ts +48 -19
  11. package/spec-cli/src/help.ts +137 -49
  12. package/spec-cli/src/index.ts +31 -11
  13. package/spec-cli/src/issues.ts +48 -21
  14. package/spec-cli/src/layout.ts +4 -4
  15. package/spec-cli/src/localIssues.ts +44 -60
  16. package/spec-cli/src/materialize.ts +4 -2
  17. package/spec-cli/src/mentions.ts +22 -1
  18. package/spec-cli/src/pty-bridge.ts +39 -4
  19. package/spec-cli/src/ranker.ts +31 -12
  20. package/spec-cli/src/search.bench.mjs +30 -7
  21. package/spec-cli/src/search.ts +39 -0
  22. package/spec-cli/src/sessions.ts +149 -62
  23. package/spec-cli/src/specs.ts +16 -4
  24. package/spec-cli/src/supervise.ts +30 -6
  25. package/spec-cli/src/tree.ts +118 -0
  26. package/spec-cli/templates/hooks/post-merge +2 -2
  27. package/spec-cli/templates/hooks/pre-commit +34 -15
  28. package/spec-cli/templates/hooks/prepare-commit-msg +8 -1
  29. package/spec-dashboard/dist/assets/Dashboard-BwZ2KzxB.js +27 -0
  30. package/spec-dashboard/dist/assets/Dashboard-C5ap-Sga.css +1 -0
  31. package/spec-dashboard/dist/assets/EvalsPage-DV75EdP4.js +3 -0
  32. package/spec-dashboard/dist/assets/FoldToggle-GwE0-k1d.js +1 -0
  33. package/spec-dashboard/dist/assets/IssuesPage-B17pnl9I.js +1 -0
  34. package/spec-dashboard/dist/assets/MobileApp-WEZbR8M1.js +1 -0
  35. package/spec-dashboard/dist/assets/SessionInterface-DYP7pi_n.css +32 -0
  36. package/spec-dashboard/dist/assets/SessionInterface-Sh8kHpnj.js +71 -0
  37. package/spec-dashboard/dist/assets/SessionWindow-EzFq-hLG.js +9 -0
  38. package/spec-dashboard/dist/assets/Settings-Dgtg-Xb9.js +1 -0
  39. package/spec-dashboard/dist/assets/index-CCmnCbKS.css +1 -0
  40. package/spec-dashboard/dist/assets/index-Dd0_U5rk.js +41 -0
  41. package/spec-dashboard/dist/index.html +2 -2
  42. package/spec-yatsu/src/cli.ts +89 -15
  43. package/spec-yatsu/src/scenariofresh.ts +100 -30
  44. package/spec-dashboard/dist/assets/index-Ct_ubwrd.css +0 -32
  45. package/spec-dashboard/dist/assets/index-DehTZ-h9.js +0 -145
@@ -1,145 +0,0 @@
1
- (function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))n(r);new MutationObserver(r=>{for(const o of r)if(o.type==="childList")for(const c of o.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&n(c)}).observe(document,{childList:!0,subtree:!0});function s(r){const o={};return r.integrity&&(o.integrity=r.integrity),r.referrerPolicy&&(o.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?o.credentials="include":r.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function n(r){if(r.ep)return;r.ep=!0;const o=s(r);fetch(r.href,o)}})();function Zp(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Jp={exports:{}},Qa={},eg={exports:{}},Re={};/**
2
- * @license React
3
- * react.production.min.js
4
- *
5
- * Copyright (c) Facebook, Inc. and its affiliates.
6
- *
7
- * This source code is licensed under the MIT license found in the
8
- * LICENSE file in the root directory of this source tree.
9
- */var Ki=Symbol.for("react.element"),Y0=Symbol.for("react.portal"),Q0=Symbol.for("react.fragment"),Z0=Symbol.for("react.strict_mode"),J0=Symbol.for("react.profiler"),ey=Symbol.for("react.provider"),ty=Symbol.for("react.context"),sy=Symbol.for("react.forward_ref"),ny=Symbol.for("react.suspense"),ry=Symbol.for("react.memo"),iy=Symbol.for("react.lazy"),ld=Symbol.iterator;function oy(e){return e===null||typeof e!="object"?null:(e=ld&&e[ld]||e["@@iterator"],typeof e=="function"?e:null)}var tg={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},sg=Object.assign,ng={};function Mr(e,t,s){this.props=e,this.context=t,this.refs=ng,this.updater=s||tg}Mr.prototype.isReactComponent={};Mr.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Mr.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function rg(){}rg.prototype=Mr.prototype;function $u(e,t,s){this.props=e,this.context=t,this.refs=ng,this.updater=s||tg}var Fu=$u.prototype=new rg;Fu.constructor=$u;sg(Fu,Mr.prototype);Fu.isPureReactComponent=!0;var cd=Array.isArray,ig=Object.prototype.hasOwnProperty,Hu={current:null},og={key:!0,ref:!0,__self:!0,__source:!0};function ag(e,t,s){var n,r={},o=null,c=null;if(t!=null)for(n in t.ref!==void 0&&(c=t.ref),t.key!==void 0&&(o=""+t.key),t)ig.call(t,n)&&!og.hasOwnProperty(n)&&(r[n]=t[n]);var i=arguments.length-2;if(i===1)r.children=s;else if(1<i){for(var a=Array(i),d=0;d<i;d++)a[d]=arguments[d+2];r.children=a}if(e&&e.defaultProps)for(n in i=e.defaultProps,i)r[n]===void 0&&(r[n]=i[n]);return{$$typeof:Ki,type:e,key:o,ref:c,props:r,_owner:Hu.current}}function ay(e,t){return{$$typeof:Ki,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function zu(e){return typeof e=="object"&&e!==null&&e.$$typeof===Ki}function ly(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(s){return t[s]})}var ud=/\/+/g;function jl(e,t){return typeof e=="object"&&e!==null&&e.key!=null?ly(""+e.key):t.toString(36)}function Xo(e,t,s,n,r){var o=typeof e;(o==="undefined"||o==="boolean")&&(e=null);var c=!1;if(e===null)c=!0;else switch(o){case"string":case"number":c=!0;break;case"object":switch(e.$$typeof){case Ki:case Y0:c=!0}}if(c)return c=e,r=r(c),e=n===""?"."+jl(c,0):n,cd(r)?(s="",e!=null&&(s=e.replace(ud,"$&/")+"/"),Xo(r,t,s,"",function(d){return d})):r!=null&&(zu(r)&&(r=ay(r,s+(!r.key||c&&c.key===r.key?"":(""+r.key).replace(ud,"$&/")+"/")+e)),t.push(r)),1;if(c=0,n=n===""?".":n+":",cd(e))for(var i=0;i<e.length;i++){o=e[i];var a=n+jl(o,i);c+=Xo(o,t,s,a,r)}else if(a=oy(e),typeof a=="function")for(e=a.call(e),i=0;!(o=e.next()).done;)o=o.value,a=n+jl(o,i++),c+=Xo(o,t,s,a,r);else if(o==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return c}function wo(e,t,s){if(e==null)return e;var n=[],r=0;return Xo(e,n,"","",function(o){return t.call(s,o,r++)}),n}function cy(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(s){(e._status===0||e._status===-1)&&(e._status=1,e._result=s)},function(s){(e._status===0||e._status===-1)&&(e._status=2,e._result=s)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var kt={current:null},Yo={transition:null},uy={ReactCurrentDispatcher:kt,ReactCurrentBatchConfig:Yo,ReactCurrentOwner:Hu};function lg(){throw Error("act(...) is not supported in production builds of React.")}Re.Children={map:wo,forEach:function(e,t,s){wo(e,function(){t.apply(this,arguments)},s)},count:function(e){var t=0;return wo(e,function(){t++}),t},toArray:function(e){return wo(e,function(t){return t})||[]},only:function(e){if(!zu(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Re.Component=Mr;Re.Fragment=Q0;Re.Profiler=J0;Re.PureComponent=$u;Re.StrictMode=Z0;Re.Suspense=ny;Re.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=uy;Re.act=lg;Re.cloneElement=function(e,t,s){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var n=sg({},e.props),r=e.key,o=e.ref,c=e._owner;if(t!=null){if(t.ref!==void 0&&(o=t.ref,c=Hu.current),t.key!==void 0&&(r=""+t.key),e.type&&e.type.defaultProps)var i=e.type.defaultProps;for(a in t)ig.call(t,a)&&!og.hasOwnProperty(a)&&(n[a]=t[a]===void 0&&i!==void 0?i[a]:t[a])}var a=arguments.length-2;if(a===1)n.children=s;else if(1<a){i=Array(a);for(var d=0;d<a;d++)i[d]=arguments[d+2];n.children=i}return{$$typeof:Ki,type:e.type,key:r,ref:o,props:n,_owner:c}};Re.createContext=function(e){return e={$$typeof:ty,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:ey,_context:e},e.Consumer=e};Re.createElement=ag;Re.createFactory=function(e){var t=ag.bind(null,e);return t.type=e,t};Re.createRef=function(){return{current:null}};Re.forwardRef=function(e){return{$$typeof:sy,render:e}};Re.isValidElement=zu;Re.lazy=function(e){return{$$typeof:iy,_payload:{_status:-1,_result:e},_init:cy}};Re.memo=function(e,t){return{$$typeof:ry,type:e,compare:t===void 0?null:t}};Re.startTransition=function(e){var t=Yo.transition;Yo.transition={};try{e()}finally{Yo.transition=t}};Re.unstable_act=lg;Re.useCallback=function(e,t){return kt.current.useCallback(e,t)};Re.useContext=function(e){return kt.current.useContext(e)};Re.useDebugValue=function(){};Re.useDeferredValue=function(e){return kt.current.useDeferredValue(e)};Re.useEffect=function(e,t){return kt.current.useEffect(e,t)};Re.useId=function(){return kt.current.useId()};Re.useImperativeHandle=function(e,t,s){return kt.current.useImperativeHandle(e,t,s)};Re.useInsertionEffect=function(e,t){return kt.current.useInsertionEffect(e,t)};Re.useLayoutEffect=function(e,t){return kt.current.useLayoutEffect(e,t)};Re.useMemo=function(e,t){return kt.current.useMemo(e,t)};Re.useReducer=function(e,t,s){return kt.current.useReducer(e,t,s)};Re.useRef=function(e){return kt.current.useRef(e)};Re.useState=function(e){return kt.current.useState(e)};Re.useSyncExternalStore=function(e,t,s){return kt.current.useSyncExternalStore(e,t,s)};Re.useTransition=function(){return kt.current.useTransition()};Re.version="18.3.1";eg.exports=Re;var B=eg.exports;const cg=Zp(B);/**
10
- * @license React
11
- * react-jsx-runtime.production.min.js
12
- *
13
- * Copyright (c) Facebook, Inc. and its affiliates.
14
- *
15
- * This source code is licensed under the MIT license found in the
16
- * LICENSE file in the root directory of this source tree.
17
- */var hy=B,dy=Symbol.for("react.element"),fy=Symbol.for("react.fragment"),py=Object.prototype.hasOwnProperty,gy=hy.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,my={key:!0,ref:!0,__self:!0,__source:!0};function ug(e,t,s){var n,r={},o=null,c=null;s!==void 0&&(o=""+s),t.key!==void 0&&(o=""+t.key),t.ref!==void 0&&(c=t.ref);for(n in t)py.call(t,n)&&!my.hasOwnProperty(n)&&(r[n]=t[n]);if(e&&e.defaultProps)for(n in t=e.defaultProps,t)r[n]===void 0&&(r[n]=t[n]);return{$$typeof:dy,type:e,key:o,ref:c,props:r,_owner:gy.current}}Qa.Fragment=fy;Qa.jsx=ug;Qa.jsxs=ug;Jp.exports=Qa;var S=Jp.exports,Mc={},hg={exports:{}},zt={},dg={exports:{}},fg={};/**
18
- * @license React
19
- * scheduler.production.min.js
20
- *
21
- * Copyright (c) Facebook, Inc. and its affiliates.
22
- *
23
- * This source code is licensed under the MIT license found in the
24
- * LICENSE file in the root directory of this source tree.
25
- */(function(e){function t(I,L){var T=I.length;I.push(L);e:for(;0<T;){var j=T-1>>>1,O=I[j];if(0<r(O,L))I[j]=L,I[T]=O,T=j;else break e}}function s(I){return I.length===0?null:I[0]}function n(I){if(I.length===0)return null;var L=I[0],T=I.pop();if(T!==L){I[0]=T;e:for(var j=0,O=I.length,V=O>>>1;j<V;){var q=2*(j+1)-1,J=I[q],Q=q+1,z=I[Q];if(0>r(J,T))Q<O&&0>r(z,J)?(I[j]=z,I[Q]=T,j=Q):(I[j]=J,I[q]=T,j=q);else if(Q<O&&0>r(z,T))I[j]=z,I[Q]=T,j=Q;else break e}}return L}function r(I,L){var T=I.sortIndex-L.sortIndex;return T!==0?T:I.id-L.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var c=Date,i=c.now();e.unstable_now=function(){return c.now()-i}}var a=[],d=[],g=1,l=null,m=3,v=!1,w=!1,_=!1,u=typeof setTimeout=="function"?setTimeout:null,f=typeof clearTimeout=="function"?clearTimeout:null,p=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function h(I){for(var L=s(d);L!==null;){if(L.callback===null)n(d);else if(L.startTime<=I)n(d),L.sortIndex=L.expirationTime,t(a,L);else break;L=s(d)}}function y(I){if(_=!1,h(I),!w)if(s(a)!==null)w=!0,F(b);else{var L=s(d);L!==null&&H(y,L.startTime-I)}}function b(I,L){w=!1,_&&(_=!1,f(x),x=-1),v=!0;var T=m;try{for(h(L),l=s(a);l!==null&&(!(l.expirationTime>L)||I&&!D());){var j=l.callback;if(typeof j=="function"){l.callback=null,m=l.priorityLevel;var O=j(l.expirationTime<=L);L=e.unstable_now(),typeof O=="function"?l.callback=O:l===s(a)&&n(a),h(L)}else n(a);l=s(a)}if(l!==null)var V=!0;else{var q=s(d);q!==null&&H(y,q.startTime-L),V=!1}return V}finally{l=null,m=T,v=!1}}var C=!1,E=null,x=-1,k=5,M=-1;function D(){return!(e.unstable_now()-M<k)}function R(){if(E!==null){var I=e.unstable_now();M=I;var L=!0;try{L=E(!0,I)}finally{L?N():(C=!1,E=null)}}else C=!1}var N;if(typeof p=="function")N=function(){p(R)};else if(typeof MessageChannel<"u"){var A=new MessageChannel,$=A.port2;A.port1.onmessage=R,N=function(){$.postMessage(null)}}else N=function(){u(R,0)};function F(I){E=I,C||(C=!0,N())}function H(I,L){x=u(function(){I(e.unstable_now())},L)}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_continueExecution=function(){w||v||(w=!0,F(b))},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"):k=0<I?Math.floor(1e3/I):5},e.unstable_getCurrentPriorityLevel=function(){return m},e.unstable_getFirstCallbackNode=function(){return s(a)},e.unstable_next=function(I){switch(m){case 1:case 2:case 3:var L=3;break;default:L=m}var T=m;m=L;try{return I()}finally{m=T}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(I,L){switch(I){case 1:case 2:case 3:case 4:case 5:break;default:I=3}var T=m;m=I;try{return L()}finally{m=T}},e.unstable_scheduleCallback=function(I,L,T){var j=e.unstable_now();switch(typeof T=="object"&&T!==null?(T=T.delay,T=typeof T=="number"&&0<T?j+T:j):T=j,I){case 1:var O=-1;break;case 2:O=250;break;case 5:O=1073741823;break;case 4:O=1e4;break;default:O=5e3}return O=T+O,I={id:g++,callback:L,priorityLevel:I,startTime:T,expirationTime:O,sortIndex:-1},T>j?(I.sortIndex=T,t(d,I),s(a)===null&&I===s(d)&&(_?(f(x),x=-1):_=!0,H(y,T-j))):(I.sortIndex=O,t(a,I),w||v||(w=!0,F(b))),I},e.unstable_shouldYield=D,e.unstable_wrapCallback=function(I){var L=m;return function(){var T=m;m=L;try{return I.apply(this,arguments)}finally{m=T}}}})(fg);dg.exports=fg;var _y=dg.exports;/**
26
- * @license React
27
- * react-dom.production.min.js
28
- *
29
- * Copyright (c) Facebook, Inc. and its affiliates.
30
- *
31
- * This source code is licensed under the MIT license found in the
32
- * LICENSE file in the root directory of this source tree.
33
- */var vy=B,Ft=_y;function oe(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,s=1;s<arguments.length;s++)t+="&args[]="+encodeURIComponent(arguments[s]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var pg=new Set,gi={};function Pn(e,t){dr(e,t),dr(e+"Capture",t)}function dr(e,t){for(gi[e]=t,e=0;e<t.length;e++)pg.add(t[e])}var Rs=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Rc=Object.prototype.hasOwnProperty,yy=/^[: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]*$/,hd={},dd={};function wy(e){return Rc.call(dd,e)?!0:Rc.call(hd,e)?!1:yy.test(e)?dd[e]=!0:(hd[e]=!0,!1)}function Sy(e,t,s,n){if(s!==null&&s.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return n?!1:s!==null?!s.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function xy(e,t,s,n){if(t===null||typeof t>"u"||Sy(e,t,s,n))return!0;if(n)return!1;if(s!==null)switch(s.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Lt(e,t,s,n,r,o,c){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=n,this.attributeNamespace=r,this.mustUseProperty=s,this.propertyName=e,this.type=t,this.sanitizeURL=o,this.removeEmptyString=c}var _t={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){_t[e]=new Lt(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];_t[t]=new Lt(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){_t[e]=new Lt(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){_t[e]=new Lt(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){_t[e]=new Lt(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){_t[e]=new Lt(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){_t[e]=new Lt(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){_t[e]=new Lt(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){_t[e]=new Lt(e,5,!1,e.toLowerCase(),null,!1,!1)});var Wu=/[\-:]([a-z])/g;function Uu(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(Wu,Uu);_t[t]=new Lt(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(Wu,Uu);_t[t]=new Lt(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(Wu,Uu);_t[t]=new Lt(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){_t[e]=new Lt(e,1,!1,e.toLowerCase(),null,!1,!1)});_t.xlinkHref=new Lt("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){_t[e]=new Lt(e,1,!1,e.toLowerCase(),null,!0,!0)});function Vu(e,t,s,n){var r=_t.hasOwnProperty(t)?_t[t]:null;(r!==null?r.type!==0:n||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(xy(t,s,r,n)&&(s=null),n||r===null?wy(t)&&(s===null?e.removeAttribute(t):e.setAttribute(t,""+s)):r.mustUseProperty?e[r.propertyName]=s===null?r.type===3?!1:"":s:(t=r.attributeName,n=r.attributeNamespace,s===null?e.removeAttribute(t):(r=r.type,s=r===3||r===4&&s===!0?"":""+s,n?e.setAttributeNS(n,t,s):e.setAttribute(t,s))))}var Is=vy.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,So=Symbol.for("react.element"),Wn=Symbol.for("react.portal"),Un=Symbol.for("react.fragment"),Ku=Symbol.for("react.strict_mode"),Dc=Symbol.for("react.profiler"),gg=Symbol.for("react.provider"),mg=Symbol.for("react.context"),qu=Symbol.for("react.forward_ref"),Ac=Symbol.for("react.suspense"),Tc=Symbol.for("react.suspense_list"),Gu=Symbol.for("react.memo"),Hs=Symbol.for("react.lazy"),_g=Symbol.for("react.offscreen"),fd=Symbol.iterator;function Or(e){return e===null||typeof e!="object"?null:(e=fd&&e[fd]||e["@@iterator"],typeof e=="function"?e:null)}var Je=Object.assign,Ol;function Yr(e){if(Ol===void 0)try{throw Error()}catch(s){var t=s.stack.trim().match(/\n( *(at )?)/);Ol=t&&t[1]||""}return`
34
- `+Ol+e}var $l=!1;function Fl(e,t){if(!e||$l)return"";$l=!0;var s=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(d){var n=d}Reflect.construct(e,[],t)}else{try{t.call()}catch(d){n=d}e.call(t.prototype)}else{try{throw Error()}catch(d){n=d}e()}}catch(d){if(d&&n&&typeof d.stack=="string"){for(var r=d.stack.split(`
35
- `),o=n.stack.split(`
36
- `),c=r.length-1,i=o.length-1;1<=c&&0<=i&&r[c]!==o[i];)i--;for(;1<=c&&0<=i;c--,i--)if(r[c]!==o[i]){if(c!==1||i!==1)do if(c--,i--,0>i||r[c]!==o[i]){var a=`
37
- `+r[c].replace(" at new "," at ");return e.displayName&&a.includes("<anonymous>")&&(a=a.replace("<anonymous>",e.displayName)),a}while(1<=c&&0<=i);break}}}finally{$l=!1,Error.prepareStackTrace=s}return(e=e?e.displayName||e.name:"")?Yr(e):""}function Cy(e){switch(e.tag){case 5:return Yr(e.type);case 16:return Yr("Lazy");case 13:return Yr("Suspense");case 19:return Yr("SuspenseList");case 0:case 2:case 15:return e=Fl(e.type,!1),e;case 11:return e=Fl(e.type.render,!1),e;case 1:return e=Fl(e.type,!0),e;default:return""}}function Nc(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Un:return"Fragment";case Wn:return"Portal";case Dc:return"Profiler";case Ku:return"StrictMode";case Ac:return"Suspense";case Tc:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case mg:return(e.displayName||"Context")+".Consumer";case gg:return(e._context.displayName||"Context")+".Provider";case qu:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Gu:return t=e.displayName||null,t!==null?t:Nc(e.type)||"Memo";case Hs:t=e._payload,e=e._init;try{return Nc(e(t))}catch{}}return null}function by(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Nc(t);case 8:return t===Ku?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function nn(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function vg(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Ey(e){var t=vg(e)?"checked":"value",s=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),n=""+e[t];if(!e.hasOwnProperty(t)&&typeof s<"u"&&typeof s.get=="function"&&typeof s.set=="function"){var r=s.get,o=s.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return r.call(this)},set:function(c){n=""+c,o.call(this,c)}}),Object.defineProperty(e,t,{enumerable:s.enumerable}),{getValue:function(){return n},setValue:function(c){n=""+c},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function xo(e){e._valueTracker||(e._valueTracker=Ey(e))}function yg(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var s=t.getValue(),n="";return e&&(n=vg(e)?e.checked?"true":"false":e.value),e=n,e!==s?(t.setValue(e),!0):!1}function pa(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Pc(e,t){var s=t.checked;return Je({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:s??e._wrapperState.initialChecked})}function pd(e,t){var s=t.defaultValue==null?"":t.defaultValue,n=t.checked!=null?t.checked:t.defaultChecked;s=nn(t.value!=null?t.value:s),e._wrapperState={initialChecked:n,initialValue:s,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function wg(e,t){t=t.checked,t!=null&&Vu(e,"checked",t,!1)}function Ic(e,t){wg(e,t);var s=nn(t.value),n=t.type;if(s!=null)n==="number"?(s===0&&e.value===""||e.value!=s)&&(e.value=""+s):e.value!==""+s&&(e.value=""+s);else if(n==="submit"||n==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Bc(e,t.type,s):t.hasOwnProperty("defaultValue")&&Bc(e,t.type,nn(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function gd(e,t,s){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var n=t.type;if(!(n!=="submit"&&n!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,s||t===e.value||(e.value=t),e.defaultValue=t}s=e.name,s!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,s!==""&&(e.name=s)}function Bc(e,t,s){(t!=="number"||pa(e.ownerDocument)!==e)&&(s==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+s&&(e.defaultValue=""+s))}var Qr=Array.isArray;function nr(e,t,s,n){if(e=e.options,t){t={};for(var r=0;r<s.length;r++)t["$"+s[r]]=!0;for(s=0;s<e.length;s++)r=t.hasOwnProperty("$"+e[s].value),e[s].selected!==r&&(e[s].selected=r),r&&n&&(e[s].defaultSelected=!0)}else{for(s=""+nn(s),t=null,r=0;r<e.length;r++){if(e[r].value===s){e[r].selected=!0,n&&(e[r].defaultSelected=!0);return}t!==null||e[r].disabled||(t=e[r])}t!==null&&(t.selected=!0)}}function jc(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(oe(91));return Je({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function md(e,t){var s=t.value;if(s==null){if(s=t.children,t=t.defaultValue,s!=null){if(t!=null)throw Error(oe(92));if(Qr(s)){if(1<s.length)throw Error(oe(93));s=s[0]}t=s}t==null&&(t=""),s=t}e._wrapperState={initialValue:nn(s)}}function Sg(e,t){var s=nn(t.value),n=nn(t.defaultValue);s!=null&&(s=""+s,s!==e.value&&(e.value=s),t.defaultValue==null&&e.defaultValue!==s&&(e.defaultValue=s)),n!=null&&(e.defaultValue=""+n)}function _d(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function xg(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function Oc(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?xg(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var Co,Cg=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,s,n,r){MSApp.execUnsafeLocalFunction(function(){return e(t,s,n,r)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(Co=Co||document.createElement("div"),Co.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Co.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function mi(e,t){if(t){var s=e.firstChild;if(s&&s===e.lastChild&&s.nodeType===3){s.nodeValue=t;return}}e.textContent=t}var ri={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},ky=["Webkit","ms","Moz","O"];Object.keys(ri).forEach(function(e){ky.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),ri[t]=ri[e]})});function bg(e,t,s){return t==null||typeof t=="boolean"||t===""?"":s||typeof t!="number"||t===0||ri.hasOwnProperty(e)&&ri[e]?(""+t).trim():t+"px"}function Eg(e,t){e=e.style;for(var s in t)if(t.hasOwnProperty(s)){var n=s.indexOf("--")===0,r=bg(s,t[s],n);s==="float"&&(s="cssFloat"),n?e.setProperty(s,r):e[s]=r}}var Ly=Je({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function $c(e,t){if(t){if(Ly[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(oe(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(oe(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(oe(61))}if(t.style!=null&&typeof t.style!="object")throw Error(oe(62))}}function Fc(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){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 Hc=null;function Xu(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var zc=null,rr=null,ir=null;function vd(e){if(e=Xi(e)){if(typeof zc!="function")throw Error(oe(280));var t=e.stateNode;t&&(t=sl(t),zc(e.stateNode,e.type,t))}}function kg(e){rr?ir?ir.push(e):ir=[e]:rr=e}function Lg(){if(rr){var e=rr,t=ir;if(ir=rr=null,vd(e),t)for(e=0;e<t.length;e++)vd(t[e])}}function Mg(e,t){return e(t)}function Rg(){}var Hl=!1;function Dg(e,t,s){if(Hl)return e(t,s);Hl=!0;try{return Mg(e,t,s)}finally{Hl=!1,(rr!==null||ir!==null)&&(Rg(),Lg())}}function _i(e,t){var s=e.stateNode;if(s===null)return null;var n=sl(s);if(n===null)return null;s=n[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(n=!n.disabled)||(e=e.type,n=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!n;break e;default:e=!1}if(e)return null;if(s&&typeof s!="function")throw Error(oe(231,t,typeof s));return s}var Wc=!1;if(Rs)try{var $r={};Object.defineProperty($r,"passive",{get:function(){Wc=!0}}),window.addEventListener("test",$r,$r),window.removeEventListener("test",$r,$r)}catch{Wc=!1}function My(e,t,s,n,r,o,c,i,a){var d=Array.prototype.slice.call(arguments,3);try{t.apply(s,d)}catch(g){this.onError(g)}}var ii=!1,ga=null,ma=!1,Uc=null,Ry={onError:function(e){ii=!0,ga=e}};function Dy(e,t,s,n,r,o,c,i,a){ii=!1,ga=null,My.apply(Ry,arguments)}function Ay(e,t,s,n,r,o,c,i,a){if(Dy.apply(this,arguments),ii){if(ii){var d=ga;ii=!1,ga=null}else throw Error(oe(198));ma||(ma=!0,Uc=d)}}function In(e){var t=e,s=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(s=t.return),e=t.return;while(e)}return t.tag===3?s:null}function Ag(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function yd(e){if(In(e)!==e)throw Error(oe(188))}function Ty(e){var t=e.alternate;if(!t){if(t=In(e),t===null)throw Error(oe(188));return t!==e?null:e}for(var s=e,n=t;;){var r=s.return;if(r===null)break;var o=r.alternate;if(o===null){if(n=r.return,n!==null){s=n;continue}break}if(r.child===o.child){for(o=r.child;o;){if(o===s)return yd(r),e;if(o===n)return yd(r),t;o=o.sibling}throw Error(oe(188))}if(s.return!==n.return)s=r,n=o;else{for(var c=!1,i=r.child;i;){if(i===s){c=!0,s=r,n=o;break}if(i===n){c=!0,n=r,s=o;break}i=i.sibling}if(!c){for(i=o.child;i;){if(i===s){c=!0,s=o,n=r;break}if(i===n){c=!0,n=o,s=r;break}i=i.sibling}if(!c)throw Error(oe(189))}}if(s.alternate!==n)throw Error(oe(190))}if(s.tag!==3)throw Error(oe(188));return s.stateNode.current===s?e:t}function Tg(e){return e=Ty(e),e!==null?Ng(e):null}function Ng(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=Ng(e);if(t!==null)return t;e=e.sibling}return null}var Pg=Ft.unstable_scheduleCallback,wd=Ft.unstable_cancelCallback,Ny=Ft.unstable_shouldYield,Py=Ft.unstable_requestPaint,nt=Ft.unstable_now,Iy=Ft.unstable_getCurrentPriorityLevel,Yu=Ft.unstable_ImmediatePriority,Ig=Ft.unstable_UserBlockingPriority,_a=Ft.unstable_NormalPriority,By=Ft.unstable_LowPriority,Bg=Ft.unstable_IdlePriority,Za=null,_s=null;function jy(e){if(_s&&typeof _s.onCommitFiberRoot=="function")try{_s.onCommitFiberRoot(Za,e,void 0,(e.current.flags&128)===128)}catch{}}var os=Math.clz32?Math.clz32:Fy,Oy=Math.log,$y=Math.LN2;function Fy(e){return e>>>=0,e===0?32:31-(Oy(e)/$y|0)|0}var bo=64,Eo=4194304;function Zr(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function va(e,t){var s=e.pendingLanes;if(s===0)return 0;var n=0,r=e.suspendedLanes,o=e.pingedLanes,c=s&268435455;if(c!==0){var i=c&~r;i!==0?n=Zr(i):(o&=c,o!==0&&(n=Zr(o)))}else c=s&~r,c!==0?n=Zr(c):o!==0&&(n=Zr(o));if(n===0)return 0;if(t!==0&&t!==n&&!(t&r)&&(r=n&-n,o=t&-t,r>=o||r===16&&(o&4194240)!==0))return t;if(n&4&&(n|=s&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=n;0<t;)s=31-os(t),r=1<<s,n|=e[s],t&=~r;return n}function Hy(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function zy(e,t){for(var s=e.suspendedLanes,n=e.pingedLanes,r=e.expirationTimes,o=e.pendingLanes;0<o;){var c=31-os(o),i=1<<c,a=r[c];a===-1?(!(i&s)||i&n)&&(r[c]=Hy(i,t)):a<=t&&(e.expiredLanes|=i),o&=~i}}function Vc(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function jg(){var e=bo;return bo<<=1,!(bo&4194240)&&(bo=64),e}function zl(e){for(var t=[],s=0;31>s;s++)t.push(e);return t}function qi(e,t,s){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-os(t),e[t]=s}function Wy(e,t){var s=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var n=e.eventTimes;for(e=e.expirationTimes;0<s;){var r=31-os(s),o=1<<r;t[r]=0,n[r]=-1,e[r]=-1,s&=~o}}function Qu(e,t){var s=e.entangledLanes|=t;for(e=e.entanglements;s;){var n=31-os(s),r=1<<n;r&t|e[n]&t&&(e[n]|=t),s&=~r}}var Oe=0;function Og(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var $g,Zu,Fg,Hg,zg,Kc=!1,ko=[],Gs=null,Xs=null,Ys=null,vi=new Map,yi=new Map,Ws=[],Uy="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function Sd(e,t){switch(e){case"focusin":case"focusout":Gs=null;break;case"dragenter":case"dragleave":Xs=null;break;case"mouseover":case"mouseout":Ys=null;break;case"pointerover":case"pointerout":vi.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":yi.delete(t.pointerId)}}function Fr(e,t,s,n,r,o){return e===null||e.nativeEvent!==o?(e={blockedOn:t,domEventName:s,eventSystemFlags:n,nativeEvent:o,targetContainers:[r]},t!==null&&(t=Xi(t),t!==null&&Zu(t)),e):(e.eventSystemFlags|=n,t=e.targetContainers,r!==null&&t.indexOf(r)===-1&&t.push(r),e)}function Vy(e,t,s,n,r){switch(t){case"focusin":return Gs=Fr(Gs,e,t,s,n,r),!0;case"dragenter":return Xs=Fr(Xs,e,t,s,n,r),!0;case"mouseover":return Ys=Fr(Ys,e,t,s,n,r),!0;case"pointerover":var o=r.pointerId;return vi.set(o,Fr(vi.get(o)||null,e,t,s,n,r)),!0;case"gotpointercapture":return o=r.pointerId,yi.set(o,Fr(yi.get(o)||null,e,t,s,n,r)),!0}return!1}function Wg(e){var t=pn(e.target);if(t!==null){var s=In(t);if(s!==null){if(t=s.tag,t===13){if(t=Ag(s),t!==null){e.blockedOn=t,zg(e.priority,function(){Fg(s)});return}}else if(t===3&&s.stateNode.current.memoizedState.isDehydrated){e.blockedOn=s.tag===3?s.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Qo(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var s=qc(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(s===null){s=e.nativeEvent;var n=new s.constructor(s.type,s);Hc=n,s.target.dispatchEvent(n),Hc=null}else return t=Xi(s),t!==null&&Zu(t),e.blockedOn=s,!1;t.shift()}return!0}function xd(e,t,s){Qo(e)&&s.delete(t)}function Ky(){Kc=!1,Gs!==null&&Qo(Gs)&&(Gs=null),Xs!==null&&Qo(Xs)&&(Xs=null),Ys!==null&&Qo(Ys)&&(Ys=null),vi.forEach(xd),yi.forEach(xd)}function Hr(e,t){e.blockedOn===t&&(e.blockedOn=null,Kc||(Kc=!0,Ft.unstable_scheduleCallback(Ft.unstable_NormalPriority,Ky)))}function wi(e){function t(r){return Hr(r,e)}if(0<ko.length){Hr(ko[0],e);for(var s=1;s<ko.length;s++){var n=ko[s];n.blockedOn===e&&(n.blockedOn=null)}}for(Gs!==null&&Hr(Gs,e),Xs!==null&&Hr(Xs,e),Ys!==null&&Hr(Ys,e),vi.forEach(t),yi.forEach(t),s=0;s<Ws.length;s++)n=Ws[s],n.blockedOn===e&&(n.blockedOn=null);for(;0<Ws.length&&(s=Ws[0],s.blockedOn===null);)Wg(s),s.blockedOn===null&&Ws.shift()}var or=Is.ReactCurrentBatchConfig,ya=!0;function qy(e,t,s,n){var r=Oe,o=or.transition;or.transition=null;try{Oe=1,Ju(e,t,s,n)}finally{Oe=r,or.transition=o}}function Gy(e,t,s,n){var r=Oe,o=or.transition;or.transition=null;try{Oe=4,Ju(e,t,s,n)}finally{Oe=r,or.transition=o}}function Ju(e,t,s,n){if(ya){var r=qc(e,t,s,n);if(r===null)Zl(e,t,n,wa,s),Sd(e,n);else if(Vy(r,e,t,s,n))n.stopPropagation();else if(Sd(e,n),t&4&&-1<Uy.indexOf(e)){for(;r!==null;){var o=Xi(r);if(o!==null&&$g(o),o=qc(e,t,s,n),o===null&&Zl(e,t,n,wa,s),o===r)break;r=o}r!==null&&n.stopPropagation()}else Zl(e,t,n,null,s)}}var wa=null;function qc(e,t,s,n){if(wa=null,e=Xu(n),e=pn(e),e!==null)if(t=In(e),t===null)e=null;else if(s=t.tag,s===13){if(e=Ag(t),e!==null)return e;e=null}else if(s===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return wa=e,null}function Ug(e){switch(e){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(Iy()){case Yu:return 1;case Ig:return 4;case _a:case By:return 16;case Bg:return 536870912;default:return 16}default:return 16}}var Ks=null,eh=null,Zo=null;function Vg(){if(Zo)return Zo;var e,t=eh,s=t.length,n,r="value"in Ks?Ks.value:Ks.textContent,o=r.length;for(e=0;e<s&&t[e]===r[e];e++);var c=s-e;for(n=1;n<=c&&t[s-n]===r[o-n];n++);return Zo=r.slice(e,1<n?1-n:void 0)}function Jo(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function Lo(){return!0}function Cd(){return!1}function Wt(e){function t(s,n,r,o,c){this._reactName=s,this._targetInst=r,this.type=n,this.nativeEvent=o,this.target=c,this.currentTarget=null;for(var i in e)e.hasOwnProperty(i)&&(s=e[i],this[i]=s?s(o):o[i]);return this.isDefaultPrevented=(o.defaultPrevented!=null?o.defaultPrevented:o.returnValue===!1)?Lo:Cd,this.isPropagationStopped=Cd,this}return Je(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var s=this.nativeEvent;s&&(s.preventDefault?s.preventDefault():typeof s.returnValue!="unknown"&&(s.returnValue=!1),this.isDefaultPrevented=Lo)},stopPropagation:function(){var s=this.nativeEvent;s&&(s.stopPropagation?s.stopPropagation():typeof s.cancelBubble!="unknown"&&(s.cancelBubble=!0),this.isPropagationStopped=Lo)},persist:function(){},isPersistent:Lo}),t}var Rr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},th=Wt(Rr),Gi=Je({},Rr,{view:0,detail:0}),Xy=Wt(Gi),Wl,Ul,zr,Ja=Je({},Gi,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:sh,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==zr&&(zr&&e.type==="mousemove"?(Wl=e.screenX-zr.screenX,Ul=e.screenY-zr.screenY):Ul=Wl=0,zr=e),Wl)},movementY:function(e){return"movementY"in e?e.movementY:Ul}}),bd=Wt(Ja),Yy=Je({},Ja,{dataTransfer:0}),Qy=Wt(Yy),Zy=Je({},Gi,{relatedTarget:0}),Vl=Wt(Zy),Jy=Je({},Rr,{animationName:0,elapsedTime:0,pseudoElement:0}),e1=Wt(Jy),t1=Je({},Rr,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),s1=Wt(t1),n1=Je({},Rr,{data:0}),Ed=Wt(n1),r1={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},i1={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"},o1={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function a1(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=o1[e])?!!t[e]:!1}function sh(){return a1}var l1=Je({},Gi,{key:function(e){if(e.key){var t=r1[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Jo(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?i1[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:sh,charCode:function(e){return e.type==="keypress"?Jo(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Jo(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),c1=Wt(l1),u1=Je({},Ja,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),kd=Wt(u1),h1=Je({},Gi,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:sh}),d1=Wt(h1),f1=Je({},Rr,{propertyName:0,elapsedTime:0,pseudoElement:0}),p1=Wt(f1),g1=Je({},Ja,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),m1=Wt(g1),_1=[9,13,27,32],nh=Rs&&"CompositionEvent"in window,oi=null;Rs&&"documentMode"in document&&(oi=document.documentMode);var v1=Rs&&"TextEvent"in window&&!oi,Kg=Rs&&(!nh||oi&&8<oi&&11>=oi),Ld=" ",Md=!1;function qg(e,t){switch(e){case"keyup":return _1.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Gg(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Vn=!1;function y1(e,t){switch(e){case"compositionend":return Gg(t);case"keypress":return t.which!==32?null:(Md=!0,Ld);case"textInput":return e=t.data,e===Ld&&Md?null:e;default:return null}}function w1(e,t){if(Vn)return e==="compositionend"||!nh&&qg(e,t)?(e=Vg(),Zo=eh=Ks=null,Vn=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Kg&&t.locale!=="ko"?null:t.data;default:return null}}var S1={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 Rd(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!S1[e.type]:t==="textarea"}function Xg(e,t,s,n){kg(n),t=Sa(t,"onChange"),0<t.length&&(s=new th("onChange","change",null,s,n),e.push({event:s,listeners:t}))}var ai=null,Si=null;function x1(e){om(e,0)}function el(e){var t=Gn(e);if(yg(t))return e}function C1(e,t){if(e==="change")return t}var Yg=!1;if(Rs){var Kl;if(Rs){var ql="oninput"in document;if(!ql){var Dd=document.createElement("div");Dd.setAttribute("oninput","return;"),ql=typeof Dd.oninput=="function"}Kl=ql}else Kl=!1;Yg=Kl&&(!document.documentMode||9<document.documentMode)}function Ad(){ai&&(ai.detachEvent("onpropertychange",Qg),Si=ai=null)}function Qg(e){if(e.propertyName==="value"&&el(Si)){var t=[];Xg(t,Si,e,Xu(e)),Dg(x1,t)}}function b1(e,t,s){e==="focusin"?(Ad(),ai=t,Si=s,ai.attachEvent("onpropertychange",Qg)):e==="focusout"&&Ad()}function E1(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return el(Si)}function k1(e,t){if(e==="click")return el(t)}function L1(e,t){if(e==="input"||e==="change")return el(t)}function M1(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var ls=typeof Object.is=="function"?Object.is:M1;function xi(e,t){if(ls(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var s=Object.keys(e),n=Object.keys(t);if(s.length!==n.length)return!1;for(n=0;n<s.length;n++){var r=s[n];if(!Rc.call(t,r)||!ls(e[r],t[r]))return!1}return!0}function Td(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Nd(e,t){var s=Td(e);e=0;for(var n;s;){if(s.nodeType===3){if(n=e+s.textContent.length,e<=t&&n>=t)return{node:s,offset:t-e};e=n}e:{for(;s;){if(s.nextSibling){s=s.nextSibling;break e}s=s.parentNode}s=void 0}s=Td(s)}}function Zg(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Zg(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Jg(){for(var e=window,t=pa();t instanceof e.HTMLIFrameElement;){try{var s=typeof t.contentWindow.location.href=="string"}catch{s=!1}if(s)e=t.contentWindow;else break;t=pa(e.document)}return t}function rh(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function R1(e){var t=Jg(),s=e.focusedElem,n=e.selectionRange;if(t!==s&&s&&s.ownerDocument&&Zg(s.ownerDocument.documentElement,s)){if(n!==null&&rh(s)){if(t=n.start,e=n.end,e===void 0&&(e=t),"selectionStart"in s)s.selectionStart=t,s.selectionEnd=Math.min(e,s.value.length);else if(e=(t=s.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var r=s.textContent.length,o=Math.min(n.start,r);n=n.end===void 0?o:Math.min(n.end,r),!e.extend&&o>n&&(r=n,n=o,o=r),r=Nd(s,o);var c=Nd(s,n);r&&c&&(e.rangeCount!==1||e.anchorNode!==r.node||e.anchorOffset!==r.offset||e.focusNode!==c.node||e.focusOffset!==c.offset)&&(t=t.createRange(),t.setStart(r.node,r.offset),e.removeAllRanges(),o>n?(e.addRange(t),e.extend(c.node,c.offset)):(t.setEnd(c.node,c.offset),e.addRange(t)))}}for(t=[],e=s;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof s.focus=="function"&&s.focus(),s=0;s<t.length;s++)e=t[s],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var D1=Rs&&"documentMode"in document&&11>=document.documentMode,Kn=null,Gc=null,li=null,Xc=!1;function Pd(e,t,s){var n=s.window===s?s.document:s.nodeType===9?s:s.ownerDocument;Xc||Kn==null||Kn!==pa(n)||(n=Kn,"selectionStart"in n&&rh(n)?n={start:n.selectionStart,end:n.selectionEnd}:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection(),n={anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset}),li&&xi(li,n)||(li=n,n=Sa(Gc,"onSelect"),0<n.length&&(t=new th("onSelect","select",null,t,s),e.push({event:t,listeners:n}),t.target=Kn)))}function Mo(e,t){var s={};return s[e.toLowerCase()]=t.toLowerCase(),s["Webkit"+e]="webkit"+t,s["Moz"+e]="moz"+t,s}var qn={animationend:Mo("Animation","AnimationEnd"),animationiteration:Mo("Animation","AnimationIteration"),animationstart:Mo("Animation","AnimationStart"),transitionend:Mo("Transition","TransitionEnd")},Gl={},em={};Rs&&(em=document.createElement("div").style,"AnimationEvent"in window||(delete qn.animationend.animation,delete qn.animationiteration.animation,delete qn.animationstart.animation),"TransitionEvent"in window||delete qn.transitionend.transition);function tl(e){if(Gl[e])return Gl[e];if(!qn[e])return e;var t=qn[e],s;for(s in t)if(t.hasOwnProperty(s)&&s in em)return Gl[e]=t[s];return e}var tm=tl("animationend"),sm=tl("animationiteration"),nm=tl("animationstart"),rm=tl("transitionend"),im=new Map,Id="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function on(e,t){im.set(e,t),Pn(t,[e])}for(var Xl=0;Xl<Id.length;Xl++){var Yl=Id[Xl],A1=Yl.toLowerCase(),T1=Yl[0].toUpperCase()+Yl.slice(1);on(A1,"on"+T1)}on(tm,"onAnimationEnd");on(sm,"onAnimationIteration");on(nm,"onAnimationStart");on("dblclick","onDoubleClick");on("focusin","onFocus");on("focusout","onBlur");on(rm,"onTransitionEnd");dr("onMouseEnter",["mouseout","mouseover"]);dr("onMouseLeave",["mouseout","mouseover"]);dr("onPointerEnter",["pointerout","pointerover"]);dr("onPointerLeave",["pointerout","pointerover"]);Pn("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Pn("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Pn("onBeforeInput",["compositionend","keypress","textInput","paste"]);Pn("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Pn("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Pn("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Jr="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(" "),N1=new Set("cancel close invalid load scroll toggle".split(" ").concat(Jr));function Bd(e,t,s){var n=e.type||"unknown-event";e.currentTarget=s,Ay(n,t,void 0,e),e.currentTarget=null}function om(e,t){t=(t&4)!==0;for(var s=0;s<e.length;s++){var n=e[s],r=n.event;n=n.listeners;e:{var o=void 0;if(t)for(var c=n.length-1;0<=c;c--){var i=n[c],a=i.instance,d=i.currentTarget;if(i=i.listener,a!==o&&r.isPropagationStopped())break e;Bd(r,i,d),o=a}else for(c=0;c<n.length;c++){if(i=n[c],a=i.instance,d=i.currentTarget,i=i.listener,a!==o&&r.isPropagationStopped())break e;Bd(r,i,d),o=a}}}if(ma)throw e=Uc,ma=!1,Uc=null,e}function Ve(e,t){var s=t[eu];s===void 0&&(s=t[eu]=new Set);var n=e+"__bubble";s.has(n)||(am(t,e,2,!1),s.add(n))}function Ql(e,t,s){var n=0;t&&(n|=4),am(s,e,n,t)}var Ro="_reactListening"+Math.random().toString(36).slice(2);function Ci(e){if(!e[Ro]){e[Ro]=!0,pg.forEach(function(s){s!=="selectionchange"&&(N1.has(s)||Ql(s,!1,e),Ql(s,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Ro]||(t[Ro]=!0,Ql("selectionchange",!1,t))}}function am(e,t,s,n){switch(Ug(t)){case 1:var r=qy;break;case 4:r=Gy;break;default:r=Ju}s=r.bind(null,t,s,e),r=void 0,!Wc||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(r=!0),n?r!==void 0?e.addEventListener(t,s,{capture:!0,passive:r}):e.addEventListener(t,s,!0):r!==void 0?e.addEventListener(t,s,{passive:r}):e.addEventListener(t,s,!1)}function Zl(e,t,s,n,r){var o=n;if(!(t&1)&&!(t&2)&&n!==null)e:for(;;){if(n===null)return;var c=n.tag;if(c===3||c===4){var i=n.stateNode.containerInfo;if(i===r||i.nodeType===8&&i.parentNode===r)break;if(c===4)for(c=n.return;c!==null;){var a=c.tag;if((a===3||a===4)&&(a=c.stateNode.containerInfo,a===r||a.nodeType===8&&a.parentNode===r))return;c=c.return}for(;i!==null;){if(c=pn(i),c===null)return;if(a=c.tag,a===5||a===6){n=o=c;continue e}i=i.parentNode}}n=n.return}Dg(function(){var d=o,g=Xu(s),l=[];e:{var m=im.get(e);if(m!==void 0){var v=th,w=e;switch(e){case"keypress":if(Jo(s)===0)break e;case"keydown":case"keyup":v=c1;break;case"focusin":w="focus",v=Vl;break;case"focusout":w="blur",v=Vl;break;case"beforeblur":case"afterblur":v=Vl;break;case"click":if(s.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":v=bd;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":v=Qy;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":v=d1;break;case tm:case sm:case nm:v=e1;break;case rm:v=p1;break;case"scroll":v=Xy;break;case"wheel":v=m1;break;case"copy":case"cut":case"paste":v=s1;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":v=kd}var _=(t&4)!==0,u=!_&&e==="scroll",f=_?m!==null?m+"Capture":null:m;_=[];for(var p=d,h;p!==null;){h=p;var y=h.stateNode;if(h.tag===5&&y!==null&&(h=y,f!==null&&(y=_i(p,f),y!=null&&_.push(bi(p,y,h)))),u)break;p=p.return}0<_.length&&(m=new v(m,w,null,s,g),l.push({event:m,listeners:_}))}}if(!(t&7)){e:{if(m=e==="mouseover"||e==="pointerover",v=e==="mouseout"||e==="pointerout",m&&s!==Hc&&(w=s.relatedTarget||s.fromElement)&&(pn(w)||w[Ds]))break e;if((v||m)&&(m=g.window===g?g:(m=g.ownerDocument)?m.defaultView||m.parentWindow:window,v?(w=s.relatedTarget||s.toElement,v=d,w=w?pn(w):null,w!==null&&(u=In(w),w!==u||w.tag!==5&&w.tag!==6)&&(w=null)):(v=null,w=d),v!==w)){if(_=bd,y="onMouseLeave",f="onMouseEnter",p="mouse",(e==="pointerout"||e==="pointerover")&&(_=kd,y="onPointerLeave",f="onPointerEnter",p="pointer"),u=v==null?m:Gn(v),h=w==null?m:Gn(w),m=new _(y,p+"leave",v,s,g),m.target=u,m.relatedTarget=h,y=null,pn(g)===d&&(_=new _(f,p+"enter",w,s,g),_.target=h,_.relatedTarget=u,y=_),u=y,v&&w)t:{for(_=v,f=w,p=0,h=_;h;h=Hn(h))p++;for(h=0,y=f;y;y=Hn(y))h++;for(;0<p-h;)_=Hn(_),p--;for(;0<h-p;)f=Hn(f),h--;for(;p--;){if(_===f||f!==null&&_===f.alternate)break t;_=Hn(_),f=Hn(f)}_=null}else _=null;v!==null&&jd(l,m,v,_,!1),w!==null&&u!==null&&jd(l,u,w,_,!0)}}e:{if(m=d?Gn(d):window,v=m.nodeName&&m.nodeName.toLowerCase(),v==="select"||v==="input"&&m.type==="file")var b=C1;else if(Rd(m))if(Yg)b=L1;else{b=E1;var C=b1}else(v=m.nodeName)&&v.toLowerCase()==="input"&&(m.type==="checkbox"||m.type==="radio")&&(b=k1);if(b&&(b=b(e,d))){Xg(l,b,s,g);break e}C&&C(e,m,d),e==="focusout"&&(C=m._wrapperState)&&C.controlled&&m.type==="number"&&Bc(m,"number",m.value)}switch(C=d?Gn(d):window,e){case"focusin":(Rd(C)||C.contentEditable==="true")&&(Kn=C,Gc=d,li=null);break;case"focusout":li=Gc=Kn=null;break;case"mousedown":Xc=!0;break;case"contextmenu":case"mouseup":case"dragend":Xc=!1,Pd(l,s,g);break;case"selectionchange":if(D1)break;case"keydown":case"keyup":Pd(l,s,g)}var E;if(nh)e:{switch(e){case"compositionstart":var x="onCompositionStart";break e;case"compositionend":x="onCompositionEnd";break e;case"compositionupdate":x="onCompositionUpdate";break e}x=void 0}else Vn?qg(e,s)&&(x="onCompositionEnd"):e==="keydown"&&s.keyCode===229&&(x="onCompositionStart");x&&(Kg&&s.locale!=="ko"&&(Vn||x!=="onCompositionStart"?x==="onCompositionEnd"&&Vn&&(E=Vg()):(Ks=g,eh="value"in Ks?Ks.value:Ks.textContent,Vn=!0)),C=Sa(d,x),0<C.length&&(x=new Ed(x,e,null,s,g),l.push({event:x,listeners:C}),E?x.data=E:(E=Gg(s),E!==null&&(x.data=E)))),(E=v1?y1(e,s):w1(e,s))&&(d=Sa(d,"onBeforeInput"),0<d.length&&(g=new Ed("onBeforeInput","beforeinput",null,s,g),l.push({event:g,listeners:d}),g.data=E))}om(l,t)})}function bi(e,t,s){return{instance:e,listener:t,currentTarget:s}}function Sa(e,t){for(var s=t+"Capture",n=[];e!==null;){var r=e,o=r.stateNode;r.tag===5&&o!==null&&(r=o,o=_i(e,s),o!=null&&n.unshift(bi(e,o,r)),o=_i(e,t),o!=null&&n.push(bi(e,o,r))),e=e.return}return n}function Hn(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function jd(e,t,s,n,r){for(var o=t._reactName,c=[];s!==null&&s!==n;){var i=s,a=i.alternate,d=i.stateNode;if(a!==null&&a===n)break;i.tag===5&&d!==null&&(i=d,r?(a=_i(s,o),a!=null&&c.unshift(bi(s,a,i))):r||(a=_i(s,o),a!=null&&c.push(bi(s,a,i)))),s=s.return}c.length!==0&&e.push({event:t,listeners:c})}var P1=/\r\n?/g,I1=/\u0000|\uFFFD/g;function Od(e){return(typeof e=="string"?e:""+e).replace(P1,`
38
- `).replace(I1,"")}function Do(e,t,s){if(t=Od(t),Od(e)!==t&&s)throw Error(oe(425))}function xa(){}var Yc=null,Qc=null;function Zc(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Jc=typeof setTimeout=="function"?setTimeout:void 0,B1=typeof clearTimeout=="function"?clearTimeout:void 0,$d=typeof Promise=="function"?Promise:void 0,j1=typeof queueMicrotask=="function"?queueMicrotask:typeof $d<"u"?function(e){return $d.resolve(null).then(e).catch(O1)}:Jc;function O1(e){setTimeout(function(){throw e})}function Jl(e,t){var s=t,n=0;do{var r=s.nextSibling;if(e.removeChild(s),r&&r.nodeType===8)if(s=r.data,s==="/$"){if(n===0){e.removeChild(r),wi(t);return}n--}else s!=="$"&&s!=="$?"&&s!=="$!"||n++;s=r}while(s);wi(t)}function Qs(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?")break;if(t==="/$")return null}}return e}function Fd(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var s=e.data;if(s==="$"||s==="$!"||s==="$?"){if(t===0)return e;t--}else s==="/$"&&t++}e=e.previousSibling}return null}var Dr=Math.random().toString(36).slice(2),ms="__reactFiber$"+Dr,Ei="__reactProps$"+Dr,Ds="__reactContainer$"+Dr,eu="__reactEvents$"+Dr,$1="__reactListeners$"+Dr,F1="__reactHandles$"+Dr;function pn(e){var t=e[ms];if(t)return t;for(var s=e.parentNode;s;){if(t=s[Ds]||s[ms]){if(s=t.alternate,t.child!==null||s!==null&&s.child!==null)for(e=Fd(e);e!==null;){if(s=e[ms])return s;e=Fd(e)}return t}e=s,s=e.parentNode}return null}function Xi(e){return e=e[ms]||e[Ds],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Gn(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(oe(33))}function sl(e){return e[Ei]||null}var tu=[],Xn=-1;function an(e){return{current:e}}function Ke(e){0>Xn||(e.current=tu[Xn],tu[Xn]=null,Xn--)}function ze(e,t){Xn++,tu[Xn]=e.current,e.current=t}var rn={},Ct=an(rn),Tt=an(!1),Cn=rn;function fr(e,t){var s=e.type.contextTypes;if(!s)return rn;var n=e.stateNode;if(n&&n.__reactInternalMemoizedUnmaskedChildContext===t)return n.__reactInternalMemoizedMaskedChildContext;var r={},o;for(o in s)r[o]=t[o];return n&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=r),r}function Nt(e){return e=e.childContextTypes,e!=null}function Ca(){Ke(Tt),Ke(Ct)}function Hd(e,t,s){if(Ct.current!==rn)throw Error(oe(168));ze(Ct,t),ze(Tt,s)}function lm(e,t,s){var n=e.stateNode;if(t=t.childContextTypes,typeof n.getChildContext!="function")return s;n=n.getChildContext();for(var r in n)if(!(r in t))throw Error(oe(108,by(e)||"Unknown",r));return Je({},s,n)}function ba(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||rn,Cn=Ct.current,ze(Ct,e),ze(Tt,Tt.current),!0}function zd(e,t,s){var n=e.stateNode;if(!n)throw Error(oe(169));s?(e=lm(e,t,Cn),n.__reactInternalMemoizedMergedChildContext=e,Ke(Tt),Ke(Ct),ze(Ct,e)):Ke(Tt),ze(Tt,s)}var Cs=null,nl=!1,ec=!1;function cm(e){Cs===null?Cs=[e]:Cs.push(e)}function H1(e){nl=!0,cm(e)}function ln(){if(!ec&&Cs!==null){ec=!0;var e=0,t=Oe;try{var s=Cs;for(Oe=1;e<s.length;e++){var n=s[e];do n=n(!0);while(n!==null)}Cs=null,nl=!1}catch(r){throw Cs!==null&&(Cs=Cs.slice(e+1)),Pg(Yu,ln),r}finally{Oe=t,ec=!1}}return null}var Yn=[],Qn=0,Ea=null,ka=0,Ut=[],Vt=0,bn=null,Es=1,ks="";function hn(e,t){Yn[Qn++]=ka,Yn[Qn++]=Ea,Ea=e,ka=t}function um(e,t,s){Ut[Vt++]=Es,Ut[Vt++]=ks,Ut[Vt++]=bn,bn=e;var n=Es;e=ks;var r=32-os(n)-1;n&=~(1<<r),s+=1;var o=32-os(t)+r;if(30<o){var c=r-r%5;o=(n&(1<<c)-1).toString(32),n>>=c,r-=c,Es=1<<32-os(t)+r|s<<r|n,ks=o+e}else Es=1<<o|s<<r|n,ks=e}function ih(e){e.return!==null&&(hn(e,1),um(e,1,0))}function oh(e){for(;e===Ea;)Ea=Yn[--Qn],Yn[Qn]=null,ka=Yn[--Qn],Yn[Qn]=null;for(;e===bn;)bn=Ut[--Vt],Ut[Vt]=null,ks=Ut[--Vt],Ut[Vt]=null,Es=Ut[--Vt],Ut[Vt]=null}var $t=null,Ot=null,qe=!1,ss=null;function hm(e,t){var s=Kt(5,null,null,0);s.elementType="DELETED",s.stateNode=t,s.return=e,t=e.deletions,t===null?(e.deletions=[s],e.flags|=16):t.push(s)}function Wd(e,t){switch(e.tag){case 5:var s=e.type;return t=t.nodeType!==1||s.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,$t=e,Ot=Qs(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,$t=e,Ot=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(s=bn!==null?{id:Es,overflow:ks}:null,e.memoizedState={dehydrated:t,treeContext:s,retryLane:1073741824},s=Kt(18,null,null,0),s.stateNode=t,s.return=e,e.child=s,$t=e,Ot=null,!0):!1;default:return!1}}function su(e){return(e.mode&1)!==0&&(e.flags&128)===0}function nu(e){if(qe){var t=Ot;if(t){var s=t;if(!Wd(e,t)){if(su(e))throw Error(oe(418));t=Qs(s.nextSibling);var n=$t;t&&Wd(e,t)?hm(n,s):(e.flags=e.flags&-4097|2,qe=!1,$t=e)}}else{if(su(e))throw Error(oe(418));e.flags=e.flags&-4097|2,qe=!1,$t=e}}}function Ud(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;$t=e}function Ao(e){if(e!==$t)return!1;if(!qe)return Ud(e),qe=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!Zc(e.type,e.memoizedProps)),t&&(t=Ot)){if(su(e))throw dm(),Error(oe(418));for(;t;)hm(e,t),t=Qs(t.nextSibling)}if(Ud(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(oe(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var s=e.data;if(s==="/$"){if(t===0){Ot=Qs(e.nextSibling);break e}t--}else s!=="$"&&s!=="$!"&&s!=="$?"||t++}e=e.nextSibling}Ot=null}}else Ot=$t?Qs(e.stateNode.nextSibling):null;return!0}function dm(){for(var e=Ot;e;)e=Qs(e.nextSibling)}function pr(){Ot=$t=null,qe=!1}function ah(e){ss===null?ss=[e]:ss.push(e)}var z1=Is.ReactCurrentBatchConfig;function Wr(e,t,s){if(e=s.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(s._owner){if(s=s._owner,s){if(s.tag!==1)throw Error(oe(309));var n=s.stateNode}if(!n)throw Error(oe(147,e));var r=n,o=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===o?t.ref:(t=function(c){var i=r.refs;c===null?delete i[o]:i[o]=c},t._stringRef=o,t)}if(typeof e!="string")throw Error(oe(284));if(!s._owner)throw Error(oe(290,e))}return e}function To(e,t){throw e=Object.prototype.toString.call(t),Error(oe(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function Vd(e){var t=e._init;return t(e._payload)}function fm(e){function t(f,p){if(e){var h=f.deletions;h===null?(f.deletions=[p],f.flags|=16):h.push(p)}}function s(f,p){if(!e)return null;for(;p!==null;)t(f,p),p=p.sibling;return null}function n(f,p){for(f=new Map;p!==null;)p.key!==null?f.set(p.key,p):f.set(p.index,p),p=p.sibling;return f}function r(f,p){return f=tn(f,p),f.index=0,f.sibling=null,f}function o(f,p,h){return f.index=h,e?(h=f.alternate,h!==null?(h=h.index,h<p?(f.flags|=2,p):h):(f.flags|=2,p)):(f.flags|=1048576,p)}function c(f){return e&&f.alternate===null&&(f.flags|=2),f}function i(f,p,h,y){return p===null||p.tag!==6?(p=ac(h,f.mode,y),p.return=f,p):(p=r(p,h),p.return=f,p)}function a(f,p,h,y){var b=h.type;return b===Un?g(f,p,h.props.children,y,h.key):p!==null&&(p.elementType===b||typeof b=="object"&&b!==null&&b.$$typeof===Hs&&Vd(b)===p.type)?(y=r(p,h.props),y.ref=Wr(f,p,h),y.return=f,y):(y=oa(h.type,h.key,h.props,null,f.mode,y),y.ref=Wr(f,p,h),y.return=f,y)}function d(f,p,h,y){return p===null||p.tag!==4||p.stateNode.containerInfo!==h.containerInfo||p.stateNode.implementation!==h.implementation?(p=lc(h,f.mode,y),p.return=f,p):(p=r(p,h.children||[]),p.return=f,p)}function g(f,p,h,y,b){return p===null||p.tag!==7?(p=wn(h,f.mode,y,b),p.return=f,p):(p=r(p,h),p.return=f,p)}function l(f,p,h){if(typeof p=="string"&&p!==""||typeof p=="number")return p=ac(""+p,f.mode,h),p.return=f,p;if(typeof p=="object"&&p!==null){switch(p.$$typeof){case So:return h=oa(p.type,p.key,p.props,null,f.mode,h),h.ref=Wr(f,null,p),h.return=f,h;case Wn:return p=lc(p,f.mode,h),p.return=f,p;case Hs:var y=p._init;return l(f,y(p._payload),h)}if(Qr(p)||Or(p))return p=wn(p,f.mode,h,null),p.return=f,p;To(f,p)}return null}function m(f,p,h,y){var b=p!==null?p.key:null;if(typeof h=="string"&&h!==""||typeof h=="number")return b!==null?null:i(f,p,""+h,y);if(typeof h=="object"&&h!==null){switch(h.$$typeof){case So:return h.key===b?a(f,p,h,y):null;case Wn:return h.key===b?d(f,p,h,y):null;case Hs:return b=h._init,m(f,p,b(h._payload),y)}if(Qr(h)||Or(h))return b!==null?null:g(f,p,h,y,null);To(f,h)}return null}function v(f,p,h,y,b){if(typeof y=="string"&&y!==""||typeof y=="number")return f=f.get(h)||null,i(p,f,""+y,b);if(typeof y=="object"&&y!==null){switch(y.$$typeof){case So:return f=f.get(y.key===null?h:y.key)||null,a(p,f,y,b);case Wn:return f=f.get(y.key===null?h:y.key)||null,d(p,f,y,b);case Hs:var C=y._init;return v(f,p,h,C(y._payload),b)}if(Qr(y)||Or(y))return f=f.get(h)||null,g(p,f,y,b,null);To(p,y)}return null}function w(f,p,h,y){for(var b=null,C=null,E=p,x=p=0,k=null;E!==null&&x<h.length;x++){E.index>x?(k=E,E=null):k=E.sibling;var M=m(f,E,h[x],y);if(M===null){E===null&&(E=k);break}e&&E&&M.alternate===null&&t(f,E),p=o(M,p,x),C===null?b=M:C.sibling=M,C=M,E=k}if(x===h.length)return s(f,E),qe&&hn(f,x),b;if(E===null){for(;x<h.length;x++)E=l(f,h[x],y),E!==null&&(p=o(E,p,x),C===null?b=E:C.sibling=E,C=E);return qe&&hn(f,x),b}for(E=n(f,E);x<h.length;x++)k=v(E,f,x,h[x],y),k!==null&&(e&&k.alternate!==null&&E.delete(k.key===null?x:k.key),p=o(k,p,x),C===null?b=k:C.sibling=k,C=k);return e&&E.forEach(function(D){return t(f,D)}),qe&&hn(f,x),b}function _(f,p,h,y){var b=Or(h);if(typeof b!="function")throw Error(oe(150));if(h=b.call(h),h==null)throw Error(oe(151));for(var C=b=null,E=p,x=p=0,k=null,M=h.next();E!==null&&!M.done;x++,M=h.next()){E.index>x?(k=E,E=null):k=E.sibling;var D=m(f,E,M.value,y);if(D===null){E===null&&(E=k);break}e&&E&&D.alternate===null&&t(f,E),p=o(D,p,x),C===null?b=D:C.sibling=D,C=D,E=k}if(M.done)return s(f,E),qe&&hn(f,x),b;if(E===null){for(;!M.done;x++,M=h.next())M=l(f,M.value,y),M!==null&&(p=o(M,p,x),C===null?b=M:C.sibling=M,C=M);return qe&&hn(f,x),b}for(E=n(f,E);!M.done;x++,M=h.next())M=v(E,f,x,M.value,y),M!==null&&(e&&M.alternate!==null&&E.delete(M.key===null?x:M.key),p=o(M,p,x),C===null?b=M:C.sibling=M,C=M);return e&&E.forEach(function(R){return t(f,R)}),qe&&hn(f,x),b}function u(f,p,h,y){if(typeof h=="object"&&h!==null&&h.type===Un&&h.key===null&&(h=h.props.children),typeof h=="object"&&h!==null){switch(h.$$typeof){case So:e:{for(var b=h.key,C=p;C!==null;){if(C.key===b){if(b=h.type,b===Un){if(C.tag===7){s(f,C.sibling),p=r(C,h.props.children),p.return=f,f=p;break e}}else if(C.elementType===b||typeof b=="object"&&b!==null&&b.$$typeof===Hs&&Vd(b)===C.type){s(f,C.sibling),p=r(C,h.props),p.ref=Wr(f,C,h),p.return=f,f=p;break e}s(f,C);break}else t(f,C);C=C.sibling}h.type===Un?(p=wn(h.props.children,f.mode,y,h.key),p.return=f,f=p):(y=oa(h.type,h.key,h.props,null,f.mode,y),y.ref=Wr(f,p,h),y.return=f,f=y)}return c(f);case Wn:e:{for(C=h.key;p!==null;){if(p.key===C)if(p.tag===4&&p.stateNode.containerInfo===h.containerInfo&&p.stateNode.implementation===h.implementation){s(f,p.sibling),p=r(p,h.children||[]),p.return=f,f=p;break e}else{s(f,p);break}else t(f,p);p=p.sibling}p=lc(h,f.mode,y),p.return=f,f=p}return c(f);case Hs:return C=h._init,u(f,p,C(h._payload),y)}if(Qr(h))return w(f,p,h,y);if(Or(h))return _(f,p,h,y);To(f,h)}return typeof h=="string"&&h!==""||typeof h=="number"?(h=""+h,p!==null&&p.tag===6?(s(f,p.sibling),p=r(p,h),p.return=f,f=p):(s(f,p),p=ac(h,f.mode,y),p.return=f,f=p),c(f)):s(f,p)}return u}var gr=fm(!0),pm=fm(!1),La=an(null),Ma=null,Zn=null,lh=null;function ch(){lh=Zn=Ma=null}function uh(e){var t=La.current;Ke(La),e._currentValue=t}function ru(e,t,s){for(;e!==null;){var n=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,n!==null&&(n.childLanes|=t)):n!==null&&(n.childLanes&t)!==t&&(n.childLanes|=t),e===s)break;e=e.return}}function ar(e,t){Ma=e,lh=Zn=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Dt=!0),e.firstContext=null)}function Gt(e){var t=e._currentValue;if(lh!==e)if(e={context:e,memoizedValue:t,next:null},Zn===null){if(Ma===null)throw Error(oe(308));Zn=e,Ma.dependencies={lanes:0,firstContext:e}}else Zn=Zn.next=e;return t}var gn=null;function hh(e){gn===null?gn=[e]:gn.push(e)}function gm(e,t,s,n){var r=t.interleaved;return r===null?(s.next=s,hh(t)):(s.next=r.next,r.next=s),t.interleaved=s,As(e,n)}function As(e,t){e.lanes|=t;var s=e.alternate;for(s!==null&&(s.lanes|=t),s=e,e=e.return;e!==null;)e.childLanes|=t,s=e.alternate,s!==null&&(s.childLanes|=t),s=e,e=e.return;return s.tag===3?s.stateNode:null}var zs=!1;function dh(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function mm(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Ms(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Zs(e,t,s){var n=e.updateQueue;if(n===null)return null;if(n=n.shared,Ne&2){var r=n.pending;return r===null?t.next=t:(t.next=r.next,r.next=t),n.pending=t,As(e,s)}return r=n.interleaved,r===null?(t.next=t,hh(n)):(t.next=r.next,r.next=t),n.interleaved=t,As(e,s)}function ea(e,t,s){if(t=t.updateQueue,t!==null&&(t=t.shared,(s&4194240)!==0)){var n=t.lanes;n&=e.pendingLanes,s|=n,t.lanes=s,Qu(e,s)}}function Kd(e,t){var s=e.updateQueue,n=e.alternate;if(n!==null&&(n=n.updateQueue,s===n)){var r=null,o=null;if(s=s.firstBaseUpdate,s!==null){do{var c={eventTime:s.eventTime,lane:s.lane,tag:s.tag,payload:s.payload,callback:s.callback,next:null};o===null?r=o=c:o=o.next=c,s=s.next}while(s!==null);o===null?r=o=t:o=o.next=t}else r=o=t;s={baseState:n.baseState,firstBaseUpdate:r,lastBaseUpdate:o,shared:n.shared,effects:n.effects},e.updateQueue=s;return}e=s.lastBaseUpdate,e===null?s.firstBaseUpdate=t:e.next=t,s.lastBaseUpdate=t}function Ra(e,t,s,n){var r=e.updateQueue;zs=!1;var o=r.firstBaseUpdate,c=r.lastBaseUpdate,i=r.shared.pending;if(i!==null){r.shared.pending=null;var a=i,d=a.next;a.next=null,c===null?o=d:c.next=d,c=a;var g=e.alternate;g!==null&&(g=g.updateQueue,i=g.lastBaseUpdate,i!==c&&(i===null?g.firstBaseUpdate=d:i.next=d,g.lastBaseUpdate=a))}if(o!==null){var l=r.baseState;c=0,g=d=a=null,i=o;do{var m=i.lane,v=i.eventTime;if((n&m)===m){g!==null&&(g=g.next={eventTime:v,lane:0,tag:i.tag,payload:i.payload,callback:i.callback,next:null});e:{var w=e,_=i;switch(m=t,v=s,_.tag){case 1:if(w=_.payload,typeof w=="function"){l=w.call(v,l,m);break e}l=w;break e;case 3:w.flags=w.flags&-65537|128;case 0:if(w=_.payload,m=typeof w=="function"?w.call(v,l,m):w,m==null)break e;l=Je({},l,m);break e;case 2:zs=!0}}i.callback!==null&&i.lane!==0&&(e.flags|=64,m=r.effects,m===null?r.effects=[i]:m.push(i))}else v={eventTime:v,lane:m,tag:i.tag,payload:i.payload,callback:i.callback,next:null},g===null?(d=g=v,a=l):g=g.next=v,c|=m;if(i=i.next,i===null){if(i=r.shared.pending,i===null)break;m=i,i=m.next,m.next=null,r.lastBaseUpdate=m,r.shared.pending=null}}while(!0);if(g===null&&(a=l),r.baseState=a,r.firstBaseUpdate=d,r.lastBaseUpdate=g,t=r.shared.interleaved,t!==null){r=t;do c|=r.lane,r=r.next;while(r!==t)}else o===null&&(r.shared.lanes=0);kn|=c,e.lanes=c,e.memoizedState=l}}function qd(e,t,s){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var n=e[t],r=n.callback;if(r!==null){if(n.callback=null,n=s,typeof r!="function")throw Error(oe(191,r));r.call(n)}}}var Yi={},vs=an(Yi),ki=an(Yi),Li=an(Yi);function mn(e){if(e===Yi)throw Error(oe(174));return e}function fh(e,t){switch(ze(Li,t),ze(ki,e),ze(vs,Yi),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Oc(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Oc(t,e)}Ke(vs),ze(vs,t)}function mr(){Ke(vs),Ke(ki),Ke(Li)}function _m(e){mn(Li.current);var t=mn(vs.current),s=Oc(t,e.type);t!==s&&(ze(ki,e),ze(vs,s))}function ph(e){ki.current===e&&(Ke(vs),Ke(ki))}var Qe=an(0);function Da(e){for(var t=e;t!==null;){if(t.tag===13){var s=t.memoizedState;if(s!==null&&(s=s.dehydrated,s===null||s.data==="$?"||s.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var tc=[];function gh(){for(var e=0;e<tc.length;e++)tc[e]._workInProgressVersionPrimary=null;tc.length=0}var ta=Is.ReactCurrentDispatcher,sc=Is.ReactCurrentBatchConfig,En=0,Ze=null,lt=null,ht=null,Aa=!1,ci=!1,Mi=0,W1=0;function yt(){throw Error(oe(321))}function mh(e,t){if(t===null)return!1;for(var s=0;s<t.length&&s<e.length;s++)if(!ls(e[s],t[s]))return!1;return!0}function _h(e,t,s,n,r,o){if(En=o,Ze=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,ta.current=e===null||e.memoizedState===null?q1:G1,e=s(n,r),ci){o=0;do{if(ci=!1,Mi=0,25<=o)throw Error(oe(301));o+=1,ht=lt=null,t.updateQueue=null,ta.current=X1,e=s(n,r)}while(ci)}if(ta.current=Ta,t=lt!==null&&lt.next!==null,En=0,ht=lt=Ze=null,Aa=!1,t)throw Error(oe(300));return e}function vh(){var e=Mi!==0;return Mi=0,e}function ps(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ht===null?Ze.memoizedState=ht=e:ht=ht.next=e,ht}function Xt(){if(lt===null){var e=Ze.alternate;e=e!==null?e.memoizedState:null}else e=lt.next;var t=ht===null?Ze.memoizedState:ht.next;if(t!==null)ht=t,lt=e;else{if(e===null)throw Error(oe(310));lt=e,e={memoizedState:lt.memoizedState,baseState:lt.baseState,baseQueue:lt.baseQueue,queue:lt.queue,next:null},ht===null?Ze.memoizedState=ht=e:ht=ht.next=e}return ht}function Ri(e,t){return typeof t=="function"?t(e):t}function nc(e){var t=Xt(),s=t.queue;if(s===null)throw Error(oe(311));s.lastRenderedReducer=e;var n=lt,r=n.baseQueue,o=s.pending;if(o!==null){if(r!==null){var c=r.next;r.next=o.next,o.next=c}n.baseQueue=r=o,s.pending=null}if(r!==null){o=r.next,n=n.baseState;var i=c=null,a=null,d=o;do{var g=d.lane;if((En&g)===g)a!==null&&(a=a.next={lane:0,action:d.action,hasEagerState:d.hasEagerState,eagerState:d.eagerState,next:null}),n=d.hasEagerState?d.eagerState:e(n,d.action);else{var l={lane:g,action:d.action,hasEagerState:d.hasEagerState,eagerState:d.eagerState,next:null};a===null?(i=a=l,c=n):a=a.next=l,Ze.lanes|=g,kn|=g}d=d.next}while(d!==null&&d!==o);a===null?c=n:a.next=i,ls(n,t.memoizedState)||(Dt=!0),t.memoizedState=n,t.baseState=c,t.baseQueue=a,s.lastRenderedState=n}if(e=s.interleaved,e!==null){r=e;do o=r.lane,Ze.lanes|=o,kn|=o,r=r.next;while(r!==e)}else r===null&&(s.lanes=0);return[t.memoizedState,s.dispatch]}function rc(e){var t=Xt(),s=t.queue;if(s===null)throw Error(oe(311));s.lastRenderedReducer=e;var n=s.dispatch,r=s.pending,o=t.memoizedState;if(r!==null){s.pending=null;var c=r=r.next;do o=e(o,c.action),c=c.next;while(c!==r);ls(o,t.memoizedState)||(Dt=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),s.lastRenderedState=o}return[o,n]}function vm(){}function ym(e,t){var s=Ze,n=Xt(),r=t(),o=!ls(n.memoizedState,r);if(o&&(n.memoizedState=r,Dt=!0),n=n.queue,yh(xm.bind(null,s,n,e),[e]),n.getSnapshot!==t||o||ht!==null&&ht.memoizedState.tag&1){if(s.flags|=2048,Di(9,Sm.bind(null,s,n,r,t),void 0,null),dt===null)throw Error(oe(349));En&30||wm(s,t,r)}return r}function wm(e,t,s){e.flags|=16384,e={getSnapshot:t,value:s},t=Ze.updateQueue,t===null?(t={lastEffect:null,stores:null},Ze.updateQueue=t,t.stores=[e]):(s=t.stores,s===null?t.stores=[e]:s.push(e))}function Sm(e,t,s,n){t.value=s,t.getSnapshot=n,Cm(t)&&bm(e)}function xm(e,t,s){return s(function(){Cm(t)&&bm(e)})}function Cm(e){var t=e.getSnapshot;e=e.value;try{var s=t();return!ls(e,s)}catch{return!0}}function bm(e){var t=As(e,1);t!==null&&as(t,e,1,-1)}function Gd(e){var t=ps();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Ri,lastRenderedState:e},t.queue=e,e=e.dispatch=K1.bind(null,Ze,e),[t.memoizedState,e]}function Di(e,t,s,n){return e={tag:e,create:t,destroy:s,deps:n,next:null},t=Ze.updateQueue,t===null?(t={lastEffect:null,stores:null},Ze.updateQueue=t,t.lastEffect=e.next=e):(s=t.lastEffect,s===null?t.lastEffect=e.next=e:(n=s.next,s.next=e,e.next=n,t.lastEffect=e)),e}function Em(){return Xt().memoizedState}function sa(e,t,s,n){var r=ps();Ze.flags|=e,r.memoizedState=Di(1|t,s,void 0,n===void 0?null:n)}function rl(e,t,s,n){var r=Xt();n=n===void 0?null:n;var o=void 0;if(lt!==null){var c=lt.memoizedState;if(o=c.destroy,n!==null&&mh(n,c.deps)){r.memoizedState=Di(t,s,o,n);return}}Ze.flags|=e,r.memoizedState=Di(1|t,s,o,n)}function Xd(e,t){return sa(8390656,8,e,t)}function yh(e,t){return rl(2048,8,e,t)}function km(e,t){return rl(4,2,e,t)}function Lm(e,t){return rl(4,4,e,t)}function Mm(e,t){if(typeof t=="function")return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Rm(e,t,s){return s=s!=null?s.concat([e]):null,rl(4,4,Mm.bind(null,t,e),s)}function wh(){}function Dm(e,t){var s=Xt();t=t===void 0?null:t;var n=s.memoizedState;return n!==null&&t!==null&&mh(t,n[1])?n[0]:(s.memoizedState=[e,t],e)}function Am(e,t){var s=Xt();t=t===void 0?null:t;var n=s.memoizedState;return n!==null&&t!==null&&mh(t,n[1])?n[0]:(e=e(),s.memoizedState=[e,t],e)}function Tm(e,t,s){return En&21?(ls(s,t)||(s=jg(),Ze.lanes|=s,kn|=s,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Dt=!0),e.memoizedState=s)}function U1(e,t){var s=Oe;Oe=s!==0&&4>s?s:4,e(!0);var n=sc.transition;sc.transition={};try{e(!1),t()}finally{Oe=s,sc.transition=n}}function Nm(){return Xt().memoizedState}function V1(e,t,s){var n=en(e);if(s={lane:n,action:s,hasEagerState:!1,eagerState:null,next:null},Pm(e))Im(t,s);else if(s=gm(e,t,s,n),s!==null){var r=Et();as(s,e,n,r),Bm(s,t,n)}}function K1(e,t,s){var n=en(e),r={lane:n,action:s,hasEagerState:!1,eagerState:null,next:null};if(Pm(e))Im(t,r);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var c=t.lastRenderedState,i=o(c,s);if(r.hasEagerState=!0,r.eagerState=i,ls(i,c)){var a=t.interleaved;a===null?(r.next=r,hh(t)):(r.next=a.next,a.next=r),t.interleaved=r;return}}catch{}finally{}s=gm(e,t,r,n),s!==null&&(r=Et(),as(s,e,n,r),Bm(s,t,n))}}function Pm(e){var t=e.alternate;return e===Ze||t!==null&&t===Ze}function Im(e,t){ci=Aa=!0;var s=e.pending;s===null?t.next=t:(t.next=s.next,s.next=t),e.pending=t}function Bm(e,t,s){if(s&4194240){var n=t.lanes;n&=e.pendingLanes,s|=n,t.lanes=s,Qu(e,s)}}var Ta={readContext:Gt,useCallback:yt,useContext:yt,useEffect:yt,useImperativeHandle:yt,useInsertionEffect:yt,useLayoutEffect:yt,useMemo:yt,useReducer:yt,useRef:yt,useState:yt,useDebugValue:yt,useDeferredValue:yt,useTransition:yt,useMutableSource:yt,useSyncExternalStore:yt,useId:yt,unstable_isNewReconciler:!1},q1={readContext:Gt,useCallback:function(e,t){return ps().memoizedState=[e,t===void 0?null:t],e},useContext:Gt,useEffect:Xd,useImperativeHandle:function(e,t,s){return s=s!=null?s.concat([e]):null,sa(4194308,4,Mm.bind(null,t,e),s)},useLayoutEffect:function(e,t){return sa(4194308,4,e,t)},useInsertionEffect:function(e,t){return sa(4,2,e,t)},useMemo:function(e,t){var s=ps();return t=t===void 0?null:t,e=e(),s.memoizedState=[e,t],e},useReducer:function(e,t,s){var n=ps();return t=s!==void 0?s(t):t,n.memoizedState=n.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},n.queue=e,e=e.dispatch=V1.bind(null,Ze,e),[n.memoizedState,e]},useRef:function(e){var t=ps();return e={current:e},t.memoizedState=e},useState:Gd,useDebugValue:wh,useDeferredValue:function(e){return ps().memoizedState=e},useTransition:function(){var e=Gd(!1),t=e[0];return e=U1.bind(null,e[1]),ps().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,s){var n=Ze,r=ps();if(qe){if(s===void 0)throw Error(oe(407));s=s()}else{if(s=t(),dt===null)throw Error(oe(349));En&30||wm(n,t,s)}r.memoizedState=s;var o={value:s,getSnapshot:t};return r.queue=o,Xd(xm.bind(null,n,o,e),[e]),n.flags|=2048,Di(9,Sm.bind(null,n,o,s,t),void 0,null),s},useId:function(){var e=ps(),t=dt.identifierPrefix;if(qe){var s=ks,n=Es;s=(n&~(1<<32-os(n)-1)).toString(32)+s,t=":"+t+"R"+s,s=Mi++,0<s&&(t+="H"+s.toString(32)),t+=":"}else s=W1++,t=":"+t+"r"+s.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},G1={readContext:Gt,useCallback:Dm,useContext:Gt,useEffect:yh,useImperativeHandle:Rm,useInsertionEffect:km,useLayoutEffect:Lm,useMemo:Am,useReducer:nc,useRef:Em,useState:function(){return nc(Ri)},useDebugValue:wh,useDeferredValue:function(e){var t=Xt();return Tm(t,lt.memoizedState,e)},useTransition:function(){var e=nc(Ri)[0],t=Xt().memoizedState;return[e,t]},useMutableSource:vm,useSyncExternalStore:ym,useId:Nm,unstable_isNewReconciler:!1},X1={readContext:Gt,useCallback:Dm,useContext:Gt,useEffect:yh,useImperativeHandle:Rm,useInsertionEffect:km,useLayoutEffect:Lm,useMemo:Am,useReducer:rc,useRef:Em,useState:function(){return rc(Ri)},useDebugValue:wh,useDeferredValue:function(e){var t=Xt();return lt===null?t.memoizedState=e:Tm(t,lt.memoizedState,e)},useTransition:function(){var e=rc(Ri)[0],t=Xt().memoizedState;return[e,t]},useMutableSource:vm,useSyncExternalStore:ym,useId:Nm,unstable_isNewReconciler:!1};function Jt(e,t){if(e&&e.defaultProps){t=Je({},t),e=e.defaultProps;for(var s in e)t[s]===void 0&&(t[s]=e[s]);return t}return t}function iu(e,t,s,n){t=e.memoizedState,s=s(n,t),s=s==null?t:Je({},t,s),e.memoizedState=s,e.lanes===0&&(e.updateQueue.baseState=s)}var il={isMounted:function(e){return(e=e._reactInternals)?In(e)===e:!1},enqueueSetState:function(e,t,s){e=e._reactInternals;var n=Et(),r=en(e),o=Ms(n,r);o.payload=t,s!=null&&(o.callback=s),t=Zs(e,o,r),t!==null&&(as(t,e,r,n),ea(t,e,r))},enqueueReplaceState:function(e,t,s){e=e._reactInternals;var n=Et(),r=en(e),o=Ms(n,r);o.tag=1,o.payload=t,s!=null&&(o.callback=s),t=Zs(e,o,r),t!==null&&(as(t,e,r,n),ea(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var s=Et(),n=en(e),r=Ms(s,n);r.tag=2,t!=null&&(r.callback=t),t=Zs(e,r,n),t!==null&&(as(t,e,n,s),ea(t,e,n))}};function Yd(e,t,s,n,r,o,c){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(n,o,c):t.prototype&&t.prototype.isPureReactComponent?!xi(s,n)||!xi(r,o):!0}function jm(e,t,s){var n=!1,r=rn,o=t.contextType;return typeof o=="object"&&o!==null?o=Gt(o):(r=Nt(t)?Cn:Ct.current,n=t.contextTypes,o=(n=n!=null)?fr(e,r):rn),t=new t(s,o),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=il,e.stateNode=t,t._reactInternals=e,n&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=r,e.__reactInternalMemoizedMaskedChildContext=o),t}function Qd(e,t,s,n){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(s,n),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(s,n),t.state!==e&&il.enqueueReplaceState(t,t.state,null)}function ou(e,t,s,n){var r=e.stateNode;r.props=s,r.state=e.memoizedState,r.refs={},dh(e);var o=t.contextType;typeof o=="object"&&o!==null?r.context=Gt(o):(o=Nt(t)?Cn:Ct.current,r.context=fr(e,o)),r.state=e.memoizedState,o=t.getDerivedStateFromProps,typeof o=="function"&&(iu(e,t,o,s),r.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof r.getSnapshotBeforeUpdate=="function"||typeof r.UNSAFE_componentWillMount!="function"&&typeof r.componentWillMount!="function"||(t=r.state,typeof r.componentWillMount=="function"&&r.componentWillMount(),typeof r.UNSAFE_componentWillMount=="function"&&r.UNSAFE_componentWillMount(),t!==r.state&&il.enqueueReplaceState(r,r.state,null),Ra(e,s,r,n),r.state=e.memoizedState),typeof r.componentDidMount=="function"&&(e.flags|=4194308)}function _r(e,t){try{var s="",n=t;do s+=Cy(n),n=n.return;while(n);var r=s}catch(o){r=`
39
- Error generating stack: `+o.message+`
40
- `+o.stack}return{value:e,source:t,stack:r,digest:null}}function ic(e,t,s){return{value:e,source:null,stack:s??null,digest:t??null}}function au(e,t){try{console.error(t.value)}catch(s){setTimeout(function(){throw s})}}var Y1=typeof WeakMap=="function"?WeakMap:Map;function Om(e,t,s){s=Ms(-1,s),s.tag=3,s.payload={element:null};var n=t.value;return s.callback=function(){Pa||(Pa=!0,_u=n),au(e,t)},s}function $m(e,t,s){s=Ms(-1,s),s.tag=3;var n=e.type.getDerivedStateFromError;if(typeof n=="function"){var r=t.value;s.payload=function(){return n(r)},s.callback=function(){au(e,t)}}var o=e.stateNode;return o!==null&&typeof o.componentDidCatch=="function"&&(s.callback=function(){au(e,t),typeof n!="function"&&(Js===null?Js=new Set([this]):Js.add(this));var c=t.stack;this.componentDidCatch(t.value,{componentStack:c!==null?c:""})}),s}function Zd(e,t,s){var n=e.pingCache;if(n===null){n=e.pingCache=new Y1;var r=new Set;n.set(t,r)}else r=n.get(t),r===void 0&&(r=new Set,n.set(t,r));r.has(s)||(r.add(s),e=uw.bind(null,e,t,s),t.then(e,e))}function Jd(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function ef(e,t,s,n,r){return e.mode&1?(e.flags|=65536,e.lanes=r,e):(e===t?e.flags|=65536:(e.flags|=128,s.flags|=131072,s.flags&=-52805,s.tag===1&&(s.alternate===null?s.tag=17:(t=Ms(-1,1),t.tag=2,Zs(s,t,1))),s.lanes|=1),e)}var Q1=Is.ReactCurrentOwner,Dt=!1;function bt(e,t,s,n){t.child=e===null?pm(t,null,s,n):gr(t,e.child,s,n)}function tf(e,t,s,n,r){s=s.render;var o=t.ref;return ar(t,r),n=_h(e,t,s,n,o,r),s=vh(),e!==null&&!Dt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~r,Ts(e,t,r)):(qe&&s&&ih(t),t.flags|=1,bt(e,t,n,r),t.child)}function sf(e,t,s,n,r){if(e===null){var o=s.type;return typeof o=="function"&&!Mh(o)&&o.defaultProps===void 0&&s.compare===null&&s.defaultProps===void 0?(t.tag=15,t.type=o,Fm(e,t,o,n,r)):(e=oa(s.type,null,n,t,t.mode,r),e.ref=t.ref,e.return=t,t.child=e)}if(o=e.child,!(e.lanes&r)){var c=o.memoizedProps;if(s=s.compare,s=s!==null?s:xi,s(c,n)&&e.ref===t.ref)return Ts(e,t,r)}return t.flags|=1,e=tn(o,n),e.ref=t.ref,e.return=t,t.child=e}function Fm(e,t,s,n,r){if(e!==null){var o=e.memoizedProps;if(xi(o,n)&&e.ref===t.ref)if(Dt=!1,t.pendingProps=n=o,(e.lanes&r)!==0)e.flags&131072&&(Dt=!0);else return t.lanes=e.lanes,Ts(e,t,r)}return lu(e,t,s,n,r)}function Hm(e,t,s){var n=t.pendingProps,r=n.children,o=e!==null?e.memoizedState:null;if(n.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},ze(er,Bt),Bt|=s;else{if(!(s&1073741824))return e=o!==null?o.baseLanes|s:s,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,ze(er,Bt),Bt|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},n=o!==null?o.baseLanes:s,ze(er,Bt),Bt|=n}else o!==null?(n=o.baseLanes|s,t.memoizedState=null):n=s,ze(er,Bt),Bt|=n;return bt(e,t,r,s),t.child}function zm(e,t){var s=t.ref;(e===null&&s!==null||e!==null&&e.ref!==s)&&(t.flags|=512,t.flags|=2097152)}function lu(e,t,s,n,r){var o=Nt(s)?Cn:Ct.current;return o=fr(t,o),ar(t,r),s=_h(e,t,s,n,o,r),n=vh(),e!==null&&!Dt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~r,Ts(e,t,r)):(qe&&n&&ih(t),t.flags|=1,bt(e,t,s,r),t.child)}function nf(e,t,s,n,r){if(Nt(s)){var o=!0;ba(t)}else o=!1;if(ar(t,r),t.stateNode===null)na(e,t),jm(t,s,n),ou(t,s,n,r),n=!0;else if(e===null){var c=t.stateNode,i=t.memoizedProps;c.props=i;var a=c.context,d=s.contextType;typeof d=="object"&&d!==null?d=Gt(d):(d=Nt(s)?Cn:Ct.current,d=fr(t,d));var g=s.getDerivedStateFromProps,l=typeof g=="function"||typeof c.getSnapshotBeforeUpdate=="function";l||typeof c.UNSAFE_componentWillReceiveProps!="function"&&typeof c.componentWillReceiveProps!="function"||(i!==n||a!==d)&&Qd(t,c,n,d),zs=!1;var m=t.memoizedState;c.state=m,Ra(t,n,c,r),a=t.memoizedState,i!==n||m!==a||Tt.current||zs?(typeof g=="function"&&(iu(t,s,g,n),a=t.memoizedState),(i=zs||Yd(t,s,i,n,m,a,d))?(l||typeof c.UNSAFE_componentWillMount!="function"&&typeof c.componentWillMount!="function"||(typeof c.componentWillMount=="function"&&c.componentWillMount(),typeof c.UNSAFE_componentWillMount=="function"&&c.UNSAFE_componentWillMount()),typeof c.componentDidMount=="function"&&(t.flags|=4194308)):(typeof c.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=n,t.memoizedState=a),c.props=n,c.state=a,c.context=d,n=i):(typeof c.componentDidMount=="function"&&(t.flags|=4194308),n=!1)}else{c=t.stateNode,mm(e,t),i=t.memoizedProps,d=t.type===t.elementType?i:Jt(t.type,i),c.props=d,l=t.pendingProps,m=c.context,a=s.contextType,typeof a=="object"&&a!==null?a=Gt(a):(a=Nt(s)?Cn:Ct.current,a=fr(t,a));var v=s.getDerivedStateFromProps;(g=typeof v=="function"||typeof c.getSnapshotBeforeUpdate=="function")||typeof c.UNSAFE_componentWillReceiveProps!="function"&&typeof c.componentWillReceiveProps!="function"||(i!==l||m!==a)&&Qd(t,c,n,a),zs=!1,m=t.memoizedState,c.state=m,Ra(t,n,c,r);var w=t.memoizedState;i!==l||m!==w||Tt.current||zs?(typeof v=="function"&&(iu(t,s,v,n),w=t.memoizedState),(d=zs||Yd(t,s,d,n,m,w,a)||!1)?(g||typeof c.UNSAFE_componentWillUpdate!="function"&&typeof c.componentWillUpdate!="function"||(typeof c.componentWillUpdate=="function"&&c.componentWillUpdate(n,w,a),typeof c.UNSAFE_componentWillUpdate=="function"&&c.UNSAFE_componentWillUpdate(n,w,a)),typeof c.componentDidUpdate=="function"&&(t.flags|=4),typeof c.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof c.componentDidUpdate!="function"||i===e.memoizedProps&&m===e.memoizedState||(t.flags|=4),typeof c.getSnapshotBeforeUpdate!="function"||i===e.memoizedProps&&m===e.memoizedState||(t.flags|=1024),t.memoizedProps=n,t.memoizedState=w),c.props=n,c.state=w,c.context=a,n=d):(typeof c.componentDidUpdate!="function"||i===e.memoizedProps&&m===e.memoizedState||(t.flags|=4),typeof c.getSnapshotBeforeUpdate!="function"||i===e.memoizedProps&&m===e.memoizedState||(t.flags|=1024),n=!1)}return cu(e,t,s,n,o,r)}function cu(e,t,s,n,r,o){zm(e,t);var c=(t.flags&128)!==0;if(!n&&!c)return r&&zd(t,s,!1),Ts(e,t,o);n=t.stateNode,Q1.current=t;var i=c&&typeof s.getDerivedStateFromError!="function"?null:n.render();return t.flags|=1,e!==null&&c?(t.child=gr(t,e.child,null,o),t.child=gr(t,null,i,o)):bt(e,t,i,o),t.memoizedState=n.state,r&&zd(t,s,!0),t.child}function Wm(e){var t=e.stateNode;t.pendingContext?Hd(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Hd(e,t.context,!1),fh(e,t.containerInfo)}function rf(e,t,s,n,r){return pr(),ah(r),t.flags|=256,bt(e,t,s,n),t.child}var uu={dehydrated:null,treeContext:null,retryLane:0};function hu(e){return{baseLanes:e,cachePool:null,transitions:null}}function Um(e,t,s){var n=t.pendingProps,r=Qe.current,o=!1,c=(t.flags&128)!==0,i;if((i=c)||(i=e!==null&&e.memoizedState===null?!1:(r&2)!==0),i?(o=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(r|=1),ze(Qe,r&1),e===null)return nu(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(c=n.children,e=n.fallback,o?(n=t.mode,o=t.child,c={mode:"hidden",children:c},!(n&1)&&o!==null?(o.childLanes=0,o.pendingProps=c):o=ll(c,n,0,null),e=wn(e,n,s,null),o.return=t,e.return=t,o.sibling=e,t.child=o,t.child.memoizedState=hu(s),t.memoizedState=uu,e):Sh(t,c));if(r=e.memoizedState,r!==null&&(i=r.dehydrated,i!==null))return Z1(e,t,c,n,i,r,s);if(o){o=n.fallback,c=t.mode,r=e.child,i=r.sibling;var a={mode:"hidden",children:n.children};return!(c&1)&&t.child!==r?(n=t.child,n.childLanes=0,n.pendingProps=a,t.deletions=null):(n=tn(r,a),n.subtreeFlags=r.subtreeFlags&14680064),i!==null?o=tn(i,o):(o=wn(o,c,s,null),o.flags|=2),o.return=t,n.return=t,n.sibling=o,t.child=n,n=o,o=t.child,c=e.child.memoizedState,c=c===null?hu(s):{baseLanes:c.baseLanes|s,cachePool:null,transitions:c.transitions},o.memoizedState=c,o.childLanes=e.childLanes&~s,t.memoizedState=uu,n}return o=e.child,e=o.sibling,n=tn(o,{mode:"visible",children:n.children}),!(t.mode&1)&&(n.lanes=s),n.return=t,n.sibling=null,e!==null&&(s=t.deletions,s===null?(t.deletions=[e],t.flags|=16):s.push(e)),t.child=n,t.memoizedState=null,n}function Sh(e,t){return t=ll({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function No(e,t,s,n){return n!==null&&ah(n),gr(t,e.child,null,s),e=Sh(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Z1(e,t,s,n,r,o,c){if(s)return t.flags&256?(t.flags&=-257,n=ic(Error(oe(422))),No(e,t,c,n)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(o=n.fallback,r=t.mode,n=ll({mode:"visible",children:n.children},r,0,null),o=wn(o,r,c,null),o.flags|=2,n.return=t,o.return=t,n.sibling=o,t.child=n,t.mode&1&&gr(t,e.child,null,c),t.child.memoizedState=hu(c),t.memoizedState=uu,o);if(!(t.mode&1))return No(e,t,c,null);if(r.data==="$!"){if(n=r.nextSibling&&r.nextSibling.dataset,n)var i=n.dgst;return n=i,o=Error(oe(419)),n=ic(o,n,void 0),No(e,t,c,n)}if(i=(c&e.childLanes)!==0,Dt||i){if(n=dt,n!==null){switch(c&-c){case 4:r=2;break;case 16:r=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:r=32;break;case 536870912:r=268435456;break;default:r=0}r=r&(n.suspendedLanes|c)?0:r,r!==0&&r!==o.retryLane&&(o.retryLane=r,As(e,r),as(n,e,r,-1))}return Lh(),n=ic(Error(oe(421))),No(e,t,c,n)}return r.data==="$?"?(t.flags|=128,t.child=e.child,t=hw.bind(null,e),r._reactRetry=t,null):(e=o.treeContext,Ot=Qs(r.nextSibling),$t=t,qe=!0,ss=null,e!==null&&(Ut[Vt++]=Es,Ut[Vt++]=ks,Ut[Vt++]=bn,Es=e.id,ks=e.overflow,bn=t),t=Sh(t,n.children),t.flags|=4096,t)}function of(e,t,s){e.lanes|=t;var n=e.alternate;n!==null&&(n.lanes|=t),ru(e.return,t,s)}function oc(e,t,s,n,r){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:n,tail:s,tailMode:r}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=n,o.tail=s,o.tailMode=r)}function Vm(e,t,s){var n=t.pendingProps,r=n.revealOrder,o=n.tail;if(bt(e,t,n.children,s),n=Qe.current,n&2)n=n&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&of(e,s,t);else if(e.tag===19)of(e,s,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}n&=1}if(ze(Qe,n),!(t.mode&1))t.memoizedState=null;else switch(r){case"forwards":for(s=t.child,r=null;s!==null;)e=s.alternate,e!==null&&Da(e)===null&&(r=s),s=s.sibling;s=r,s===null?(r=t.child,t.child=null):(r=s.sibling,s.sibling=null),oc(t,!1,r,s,o);break;case"backwards":for(s=null,r=t.child,t.child=null;r!==null;){if(e=r.alternate,e!==null&&Da(e)===null){t.child=r;break}e=r.sibling,r.sibling=s,s=r,r=e}oc(t,!0,s,null,o);break;case"together":oc(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function na(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Ts(e,t,s){if(e!==null&&(t.dependencies=e.dependencies),kn|=t.lanes,!(s&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(oe(153));if(t.child!==null){for(e=t.child,s=tn(e,e.pendingProps),t.child=s,s.return=t;e.sibling!==null;)e=e.sibling,s=s.sibling=tn(e,e.pendingProps),s.return=t;s.sibling=null}return t.child}function J1(e,t,s){switch(t.tag){case 3:Wm(t),pr();break;case 5:_m(t);break;case 1:Nt(t.type)&&ba(t);break;case 4:fh(t,t.stateNode.containerInfo);break;case 10:var n=t.type._context,r=t.memoizedProps.value;ze(La,n._currentValue),n._currentValue=r;break;case 13:if(n=t.memoizedState,n!==null)return n.dehydrated!==null?(ze(Qe,Qe.current&1),t.flags|=128,null):s&t.child.childLanes?Um(e,t,s):(ze(Qe,Qe.current&1),e=Ts(e,t,s),e!==null?e.sibling:null);ze(Qe,Qe.current&1);break;case 19:if(n=(s&t.childLanes)!==0,e.flags&128){if(n)return Vm(e,t,s);t.flags|=128}if(r=t.memoizedState,r!==null&&(r.rendering=null,r.tail=null,r.lastEffect=null),ze(Qe,Qe.current),n)break;return null;case 22:case 23:return t.lanes=0,Hm(e,t,s)}return Ts(e,t,s)}var Km,du,qm,Gm;Km=function(e,t){for(var s=t.child;s!==null;){if(s.tag===5||s.tag===6)e.appendChild(s.stateNode);else if(s.tag!==4&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break;for(;s.sibling===null;){if(s.return===null||s.return===t)return;s=s.return}s.sibling.return=s.return,s=s.sibling}};du=function(){};qm=function(e,t,s,n){var r=e.memoizedProps;if(r!==n){e=t.stateNode,mn(vs.current);var o=null;switch(s){case"input":r=Pc(e,r),n=Pc(e,n),o=[];break;case"select":r=Je({},r,{value:void 0}),n=Je({},n,{value:void 0}),o=[];break;case"textarea":r=jc(e,r),n=jc(e,n),o=[];break;default:typeof r.onClick!="function"&&typeof n.onClick=="function"&&(e.onclick=xa)}$c(s,n);var c;s=null;for(d in r)if(!n.hasOwnProperty(d)&&r.hasOwnProperty(d)&&r[d]!=null)if(d==="style"){var i=r[d];for(c in i)i.hasOwnProperty(c)&&(s||(s={}),s[c]="")}else d!=="dangerouslySetInnerHTML"&&d!=="children"&&d!=="suppressContentEditableWarning"&&d!=="suppressHydrationWarning"&&d!=="autoFocus"&&(gi.hasOwnProperty(d)?o||(o=[]):(o=o||[]).push(d,null));for(d in n){var a=n[d];if(i=r!=null?r[d]:void 0,n.hasOwnProperty(d)&&a!==i&&(a!=null||i!=null))if(d==="style")if(i){for(c in i)!i.hasOwnProperty(c)||a&&a.hasOwnProperty(c)||(s||(s={}),s[c]="");for(c in a)a.hasOwnProperty(c)&&i[c]!==a[c]&&(s||(s={}),s[c]=a[c])}else s||(o||(o=[]),o.push(d,s)),s=a;else d==="dangerouslySetInnerHTML"?(a=a?a.__html:void 0,i=i?i.__html:void 0,a!=null&&i!==a&&(o=o||[]).push(d,a)):d==="children"?typeof a!="string"&&typeof a!="number"||(o=o||[]).push(d,""+a):d!=="suppressContentEditableWarning"&&d!=="suppressHydrationWarning"&&(gi.hasOwnProperty(d)?(a!=null&&d==="onScroll"&&Ve("scroll",e),o||i===a||(o=[])):(o=o||[]).push(d,a))}s&&(o=o||[]).push("style",s);var d=o;(t.updateQueue=d)&&(t.flags|=4)}};Gm=function(e,t,s,n){s!==n&&(t.flags|=4)};function Ur(e,t){if(!qe)switch(e.tailMode){case"hidden":t=e.tail;for(var s=null;t!==null;)t.alternate!==null&&(s=t),t=t.sibling;s===null?e.tail=null:s.sibling=null;break;case"collapsed":s=e.tail;for(var n=null;s!==null;)s.alternate!==null&&(n=s),s=s.sibling;n===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:n.sibling=null}}function wt(e){var t=e.alternate!==null&&e.alternate.child===e.child,s=0,n=0;if(t)for(var r=e.child;r!==null;)s|=r.lanes|r.childLanes,n|=r.subtreeFlags&14680064,n|=r.flags&14680064,r.return=e,r=r.sibling;else for(r=e.child;r!==null;)s|=r.lanes|r.childLanes,n|=r.subtreeFlags,n|=r.flags,r.return=e,r=r.sibling;return e.subtreeFlags|=n,e.childLanes=s,t}function ew(e,t,s){var n=t.pendingProps;switch(oh(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return wt(t),null;case 1:return Nt(t.type)&&Ca(),wt(t),null;case 3:return n=t.stateNode,mr(),Ke(Tt),Ke(Ct),gh(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Ao(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,ss!==null&&(wu(ss),ss=null))),du(e,t),wt(t),null;case 5:ph(t);var r=mn(Li.current);if(s=t.type,e!==null&&t.stateNode!=null)qm(e,t,s,n,r),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!n){if(t.stateNode===null)throw Error(oe(166));return wt(t),null}if(e=mn(vs.current),Ao(t)){n=t.stateNode,s=t.type;var o=t.memoizedProps;switch(n[ms]=t,n[Ei]=o,e=(t.mode&1)!==0,s){case"dialog":Ve("cancel",n),Ve("close",n);break;case"iframe":case"object":case"embed":Ve("load",n);break;case"video":case"audio":for(r=0;r<Jr.length;r++)Ve(Jr[r],n);break;case"source":Ve("error",n);break;case"img":case"image":case"link":Ve("error",n),Ve("load",n);break;case"details":Ve("toggle",n);break;case"input":pd(n,o),Ve("invalid",n);break;case"select":n._wrapperState={wasMultiple:!!o.multiple},Ve("invalid",n);break;case"textarea":md(n,o),Ve("invalid",n)}$c(s,o),r=null;for(var c in o)if(o.hasOwnProperty(c)){var i=o[c];c==="children"?typeof i=="string"?n.textContent!==i&&(o.suppressHydrationWarning!==!0&&Do(n.textContent,i,e),r=["children",i]):typeof i=="number"&&n.textContent!==""+i&&(o.suppressHydrationWarning!==!0&&Do(n.textContent,i,e),r=["children",""+i]):gi.hasOwnProperty(c)&&i!=null&&c==="onScroll"&&Ve("scroll",n)}switch(s){case"input":xo(n),gd(n,o,!0);break;case"textarea":xo(n),_d(n);break;case"select":case"option":break;default:typeof o.onClick=="function"&&(n.onclick=xa)}n=r,t.updateQueue=n,n!==null&&(t.flags|=4)}else{c=r.nodeType===9?r:r.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=xg(s)),e==="http://www.w3.org/1999/xhtml"?s==="script"?(e=c.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof n.is=="string"?e=c.createElement(s,{is:n.is}):(e=c.createElement(s),s==="select"&&(c=e,n.multiple?c.multiple=!0:n.size&&(c.size=n.size))):e=c.createElementNS(e,s),e[ms]=t,e[Ei]=n,Km(e,t,!1,!1),t.stateNode=e;e:{switch(c=Fc(s,n),s){case"dialog":Ve("cancel",e),Ve("close",e),r=n;break;case"iframe":case"object":case"embed":Ve("load",e),r=n;break;case"video":case"audio":for(r=0;r<Jr.length;r++)Ve(Jr[r],e);r=n;break;case"source":Ve("error",e),r=n;break;case"img":case"image":case"link":Ve("error",e),Ve("load",e),r=n;break;case"details":Ve("toggle",e),r=n;break;case"input":pd(e,n),r=Pc(e,n),Ve("invalid",e);break;case"option":r=n;break;case"select":e._wrapperState={wasMultiple:!!n.multiple},r=Je({},n,{value:void 0}),Ve("invalid",e);break;case"textarea":md(e,n),r=jc(e,n),Ve("invalid",e);break;default:r=n}$c(s,r),i=r;for(o in i)if(i.hasOwnProperty(o)){var a=i[o];o==="style"?Eg(e,a):o==="dangerouslySetInnerHTML"?(a=a?a.__html:void 0,a!=null&&Cg(e,a)):o==="children"?typeof a=="string"?(s!=="textarea"||a!=="")&&mi(e,a):typeof a=="number"&&mi(e,""+a):o!=="suppressContentEditableWarning"&&o!=="suppressHydrationWarning"&&o!=="autoFocus"&&(gi.hasOwnProperty(o)?a!=null&&o==="onScroll"&&Ve("scroll",e):a!=null&&Vu(e,o,a,c))}switch(s){case"input":xo(e),gd(e,n,!1);break;case"textarea":xo(e),_d(e);break;case"option":n.value!=null&&e.setAttribute("value",""+nn(n.value));break;case"select":e.multiple=!!n.multiple,o=n.value,o!=null?nr(e,!!n.multiple,o,!1):n.defaultValue!=null&&nr(e,!!n.multiple,n.defaultValue,!0);break;default:typeof r.onClick=="function"&&(e.onclick=xa)}switch(s){case"button":case"input":case"select":case"textarea":n=!!n.autoFocus;break e;case"img":n=!0;break e;default:n=!1}}n&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return wt(t),null;case 6:if(e&&t.stateNode!=null)Gm(e,t,e.memoizedProps,n);else{if(typeof n!="string"&&t.stateNode===null)throw Error(oe(166));if(s=mn(Li.current),mn(vs.current),Ao(t)){if(n=t.stateNode,s=t.memoizedProps,n[ms]=t,(o=n.nodeValue!==s)&&(e=$t,e!==null))switch(e.tag){case 3:Do(n.nodeValue,s,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&Do(n.nodeValue,s,(e.mode&1)!==0)}o&&(t.flags|=4)}else n=(s.nodeType===9?s:s.ownerDocument).createTextNode(n),n[ms]=t,t.stateNode=n}return wt(t),null;case 13:if(Ke(Qe),n=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(qe&&Ot!==null&&t.mode&1&&!(t.flags&128))dm(),pr(),t.flags|=98560,o=!1;else if(o=Ao(t),n!==null&&n.dehydrated!==null){if(e===null){if(!o)throw Error(oe(318));if(o=t.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(oe(317));o[ms]=t}else pr(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;wt(t),o=!1}else ss!==null&&(wu(ss),ss=null),o=!0;if(!o)return t.flags&65536?t:null}return t.flags&128?(t.lanes=s,t):(n=n!==null,n!==(e!==null&&e.memoizedState!==null)&&n&&(t.child.flags|=8192,t.mode&1&&(e===null||Qe.current&1?ct===0&&(ct=3):Lh())),t.updateQueue!==null&&(t.flags|=4),wt(t),null);case 4:return mr(),du(e,t),e===null&&Ci(t.stateNode.containerInfo),wt(t),null;case 10:return uh(t.type._context),wt(t),null;case 17:return Nt(t.type)&&Ca(),wt(t),null;case 19:if(Ke(Qe),o=t.memoizedState,o===null)return wt(t),null;if(n=(t.flags&128)!==0,c=o.rendering,c===null)if(n)Ur(o,!1);else{if(ct!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(c=Da(e),c!==null){for(t.flags|=128,Ur(o,!1),n=c.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),t.subtreeFlags=0,n=s,s=t.child;s!==null;)o=s,e=n,o.flags&=14680066,c=o.alternate,c===null?(o.childLanes=0,o.lanes=e,o.child=null,o.subtreeFlags=0,o.memoizedProps=null,o.memoizedState=null,o.updateQueue=null,o.dependencies=null,o.stateNode=null):(o.childLanes=c.childLanes,o.lanes=c.lanes,o.child=c.child,o.subtreeFlags=0,o.deletions=null,o.memoizedProps=c.memoizedProps,o.memoizedState=c.memoizedState,o.updateQueue=c.updateQueue,o.type=c.type,e=c.dependencies,o.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),s=s.sibling;return ze(Qe,Qe.current&1|2),t.child}e=e.sibling}o.tail!==null&&nt()>vr&&(t.flags|=128,n=!0,Ur(o,!1),t.lanes=4194304)}else{if(!n)if(e=Da(c),e!==null){if(t.flags|=128,n=!0,s=e.updateQueue,s!==null&&(t.updateQueue=s,t.flags|=4),Ur(o,!0),o.tail===null&&o.tailMode==="hidden"&&!c.alternate&&!qe)return wt(t),null}else 2*nt()-o.renderingStartTime>vr&&s!==1073741824&&(t.flags|=128,n=!0,Ur(o,!1),t.lanes=4194304);o.isBackwards?(c.sibling=t.child,t.child=c):(s=o.last,s!==null?s.sibling=c:t.child=c,o.last=c)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=nt(),t.sibling=null,s=Qe.current,ze(Qe,n?s&1|2:s&1),t):(wt(t),null);case 22:case 23:return kh(),n=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==n&&(t.flags|=8192),n&&t.mode&1?Bt&1073741824&&(wt(t),t.subtreeFlags&6&&(t.flags|=8192)):wt(t),null;case 24:return null;case 25:return null}throw Error(oe(156,t.tag))}function tw(e,t){switch(oh(t),t.tag){case 1:return Nt(t.type)&&Ca(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return mr(),Ke(Tt),Ke(Ct),gh(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return ph(t),null;case 13:if(Ke(Qe),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(oe(340));pr()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Ke(Qe),null;case 4:return mr(),null;case 10:return uh(t.type._context),null;case 22:case 23:return kh(),null;case 24:return null;default:return null}}var Po=!1,St=!1,sw=typeof WeakSet=="function"?WeakSet:Set,de=null;function Jn(e,t){var s=e.ref;if(s!==null)if(typeof s=="function")try{s(null)}catch(n){tt(e,t,n)}else s.current=null}function fu(e,t,s){try{s()}catch(n){tt(e,t,n)}}var af=!1;function nw(e,t){if(Yc=ya,e=Jg(),rh(e)){if("selectionStart"in e)var s={start:e.selectionStart,end:e.selectionEnd};else e:{s=(s=e.ownerDocument)&&s.defaultView||window;var n=s.getSelection&&s.getSelection();if(n&&n.rangeCount!==0){s=n.anchorNode;var r=n.anchorOffset,o=n.focusNode;n=n.focusOffset;try{s.nodeType,o.nodeType}catch{s=null;break e}var c=0,i=-1,a=-1,d=0,g=0,l=e,m=null;t:for(;;){for(var v;l!==s||r!==0&&l.nodeType!==3||(i=c+r),l!==o||n!==0&&l.nodeType!==3||(a=c+n),l.nodeType===3&&(c+=l.nodeValue.length),(v=l.firstChild)!==null;)m=l,l=v;for(;;){if(l===e)break t;if(m===s&&++d===r&&(i=c),m===o&&++g===n&&(a=c),(v=l.nextSibling)!==null)break;l=m,m=l.parentNode}l=v}s=i===-1||a===-1?null:{start:i,end:a}}else s=null}s=s||{start:0,end:0}}else s=null;for(Qc={focusedElem:e,selectionRange:s},ya=!1,de=t;de!==null;)if(t=de,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,de=e;else for(;de!==null;){t=de;try{var w=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(w!==null){var _=w.memoizedProps,u=w.memoizedState,f=t.stateNode,p=f.getSnapshotBeforeUpdate(t.elementType===t.type?_:Jt(t.type,_),u);f.__reactInternalSnapshotBeforeUpdate=p}break;case 3:var h=t.stateNode.containerInfo;h.nodeType===1?h.textContent="":h.nodeType===9&&h.documentElement&&h.removeChild(h.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(oe(163))}}catch(y){tt(t,t.return,y)}if(e=t.sibling,e!==null){e.return=t.return,de=e;break}de=t.return}return w=af,af=!1,w}function ui(e,t,s){var n=t.updateQueue;if(n=n!==null?n.lastEffect:null,n!==null){var r=n=n.next;do{if((r.tag&e)===e){var o=r.destroy;r.destroy=void 0,o!==void 0&&fu(t,s,o)}r=r.next}while(r!==n)}}function ol(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var s=t=t.next;do{if((s.tag&e)===e){var n=s.create;s.destroy=n()}s=s.next}while(s!==t)}}function pu(e){var t=e.ref;if(t!==null){var s=e.stateNode;switch(e.tag){case 5:e=s;break;default:e=s}typeof t=="function"?t(e):t.current=e}}function Xm(e){var t=e.alternate;t!==null&&(e.alternate=null,Xm(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[ms],delete t[Ei],delete t[eu],delete t[$1],delete t[F1])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Ym(e){return e.tag===5||e.tag===3||e.tag===4}function lf(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Ym(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function gu(e,t,s){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?s.nodeType===8?s.parentNode.insertBefore(e,t):s.insertBefore(e,t):(s.nodeType===8?(t=s.parentNode,t.insertBefore(e,s)):(t=s,t.appendChild(e)),s=s._reactRootContainer,s!=null||t.onclick!==null||(t.onclick=xa));else if(n!==4&&(e=e.child,e!==null))for(gu(e,t,s),e=e.sibling;e!==null;)gu(e,t,s),e=e.sibling}function mu(e,t,s){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?s.insertBefore(e,t):s.appendChild(e);else if(n!==4&&(e=e.child,e!==null))for(mu(e,t,s),e=e.sibling;e!==null;)mu(e,t,s),e=e.sibling}var gt=null,es=!1;function Os(e,t,s){for(s=s.child;s!==null;)Qm(e,t,s),s=s.sibling}function Qm(e,t,s){if(_s&&typeof _s.onCommitFiberUnmount=="function")try{_s.onCommitFiberUnmount(Za,s)}catch{}switch(s.tag){case 5:St||Jn(s,t);case 6:var n=gt,r=es;gt=null,Os(e,t,s),gt=n,es=r,gt!==null&&(es?(e=gt,s=s.stateNode,e.nodeType===8?e.parentNode.removeChild(s):e.removeChild(s)):gt.removeChild(s.stateNode));break;case 18:gt!==null&&(es?(e=gt,s=s.stateNode,e.nodeType===8?Jl(e.parentNode,s):e.nodeType===1&&Jl(e,s),wi(e)):Jl(gt,s.stateNode));break;case 4:n=gt,r=es,gt=s.stateNode.containerInfo,es=!0,Os(e,t,s),gt=n,es=r;break;case 0:case 11:case 14:case 15:if(!St&&(n=s.updateQueue,n!==null&&(n=n.lastEffect,n!==null))){r=n=n.next;do{var o=r,c=o.destroy;o=o.tag,c!==void 0&&(o&2||o&4)&&fu(s,t,c),r=r.next}while(r!==n)}Os(e,t,s);break;case 1:if(!St&&(Jn(s,t),n=s.stateNode,typeof n.componentWillUnmount=="function"))try{n.props=s.memoizedProps,n.state=s.memoizedState,n.componentWillUnmount()}catch(i){tt(s,t,i)}Os(e,t,s);break;case 21:Os(e,t,s);break;case 22:s.mode&1?(St=(n=St)||s.memoizedState!==null,Os(e,t,s),St=n):Os(e,t,s);break;default:Os(e,t,s)}}function cf(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var s=e.stateNode;s===null&&(s=e.stateNode=new sw),t.forEach(function(n){var r=dw.bind(null,e,n);s.has(n)||(s.add(n),n.then(r,r))})}}function Zt(e,t){var s=t.deletions;if(s!==null)for(var n=0;n<s.length;n++){var r=s[n];try{var o=e,c=t,i=c;e:for(;i!==null;){switch(i.tag){case 5:gt=i.stateNode,es=!1;break e;case 3:gt=i.stateNode.containerInfo,es=!0;break e;case 4:gt=i.stateNode.containerInfo,es=!0;break e}i=i.return}if(gt===null)throw Error(oe(160));Qm(o,c,r),gt=null,es=!1;var a=r.alternate;a!==null&&(a.return=null),r.return=null}catch(d){tt(r,t,d)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)Zm(t,e),t=t.sibling}function Zm(e,t){var s=e.alternate,n=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Zt(t,e),fs(e),n&4){try{ui(3,e,e.return),ol(3,e)}catch(_){tt(e,e.return,_)}try{ui(5,e,e.return)}catch(_){tt(e,e.return,_)}}break;case 1:Zt(t,e),fs(e),n&512&&s!==null&&Jn(s,s.return);break;case 5:if(Zt(t,e),fs(e),n&512&&s!==null&&Jn(s,s.return),e.flags&32){var r=e.stateNode;try{mi(r,"")}catch(_){tt(e,e.return,_)}}if(n&4&&(r=e.stateNode,r!=null)){var o=e.memoizedProps,c=s!==null?s.memoizedProps:o,i=e.type,a=e.updateQueue;if(e.updateQueue=null,a!==null)try{i==="input"&&o.type==="radio"&&o.name!=null&&wg(r,o),Fc(i,c);var d=Fc(i,o);for(c=0;c<a.length;c+=2){var g=a[c],l=a[c+1];g==="style"?Eg(r,l):g==="dangerouslySetInnerHTML"?Cg(r,l):g==="children"?mi(r,l):Vu(r,g,l,d)}switch(i){case"input":Ic(r,o);break;case"textarea":Sg(r,o);break;case"select":var m=r._wrapperState.wasMultiple;r._wrapperState.wasMultiple=!!o.multiple;var v=o.value;v!=null?nr(r,!!o.multiple,v,!1):m!==!!o.multiple&&(o.defaultValue!=null?nr(r,!!o.multiple,o.defaultValue,!0):nr(r,!!o.multiple,o.multiple?[]:"",!1))}r[Ei]=o}catch(_){tt(e,e.return,_)}}break;case 6:if(Zt(t,e),fs(e),n&4){if(e.stateNode===null)throw Error(oe(162));r=e.stateNode,o=e.memoizedProps;try{r.nodeValue=o}catch(_){tt(e,e.return,_)}}break;case 3:if(Zt(t,e),fs(e),n&4&&s!==null&&s.memoizedState.isDehydrated)try{wi(t.containerInfo)}catch(_){tt(e,e.return,_)}break;case 4:Zt(t,e),fs(e);break;case 13:Zt(t,e),fs(e),r=e.child,r.flags&8192&&(o=r.memoizedState!==null,r.stateNode.isHidden=o,!o||r.alternate!==null&&r.alternate.memoizedState!==null||(bh=nt())),n&4&&cf(e);break;case 22:if(g=s!==null&&s.memoizedState!==null,e.mode&1?(St=(d=St)||g,Zt(t,e),St=d):Zt(t,e),fs(e),n&8192){if(d=e.memoizedState!==null,(e.stateNode.isHidden=d)&&!g&&e.mode&1)for(de=e,g=e.child;g!==null;){for(l=de=g;de!==null;){switch(m=de,v=m.child,m.tag){case 0:case 11:case 14:case 15:ui(4,m,m.return);break;case 1:Jn(m,m.return);var w=m.stateNode;if(typeof w.componentWillUnmount=="function"){n=m,s=m.return;try{t=n,w.props=t.memoizedProps,w.state=t.memoizedState,w.componentWillUnmount()}catch(_){tt(n,s,_)}}break;case 5:Jn(m,m.return);break;case 22:if(m.memoizedState!==null){hf(l);continue}}v!==null?(v.return=m,de=v):hf(l)}g=g.sibling}e:for(g=null,l=e;;){if(l.tag===5){if(g===null){g=l;try{r=l.stateNode,d?(o=r.style,typeof o.setProperty=="function"?o.setProperty("display","none","important"):o.display="none"):(i=l.stateNode,a=l.memoizedProps.style,c=a!=null&&a.hasOwnProperty("display")?a.display:null,i.style.display=bg("display",c))}catch(_){tt(e,e.return,_)}}}else if(l.tag===6){if(g===null)try{l.stateNode.nodeValue=d?"":l.memoizedProps}catch(_){tt(e,e.return,_)}}else if((l.tag!==22&&l.tag!==23||l.memoizedState===null||l===e)&&l.child!==null){l.child.return=l,l=l.child;continue}if(l===e)break e;for(;l.sibling===null;){if(l.return===null||l.return===e)break e;g===l&&(g=null),l=l.return}g===l&&(g=null),l.sibling.return=l.return,l=l.sibling}}break;case 19:Zt(t,e),fs(e),n&4&&cf(e);break;case 21:break;default:Zt(t,e),fs(e)}}function fs(e){var t=e.flags;if(t&2){try{e:{for(var s=e.return;s!==null;){if(Ym(s)){var n=s;break e}s=s.return}throw Error(oe(160))}switch(n.tag){case 5:var r=n.stateNode;n.flags&32&&(mi(r,""),n.flags&=-33);var o=lf(e);mu(e,o,r);break;case 3:case 4:var c=n.stateNode.containerInfo,i=lf(e);gu(e,i,c);break;default:throw Error(oe(161))}}catch(a){tt(e,e.return,a)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function rw(e,t,s){de=e,Jm(e)}function Jm(e,t,s){for(var n=(e.mode&1)!==0;de!==null;){var r=de,o=r.child;if(r.tag===22&&n){var c=r.memoizedState!==null||Po;if(!c){var i=r.alternate,a=i!==null&&i.memoizedState!==null||St;i=Po;var d=St;if(Po=c,(St=a)&&!d)for(de=r;de!==null;)c=de,a=c.child,c.tag===22&&c.memoizedState!==null?df(r):a!==null?(a.return=c,de=a):df(r);for(;o!==null;)de=o,Jm(o),o=o.sibling;de=r,Po=i,St=d}uf(e)}else r.subtreeFlags&8772&&o!==null?(o.return=r,de=o):uf(e)}}function uf(e){for(;de!==null;){var t=de;if(t.flags&8772){var s=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:St||ol(5,t);break;case 1:var n=t.stateNode;if(t.flags&4&&!St)if(s===null)n.componentDidMount();else{var r=t.elementType===t.type?s.memoizedProps:Jt(t.type,s.memoizedProps);n.componentDidUpdate(r,s.memoizedState,n.__reactInternalSnapshotBeforeUpdate)}var o=t.updateQueue;o!==null&&qd(t,o,n);break;case 3:var c=t.updateQueue;if(c!==null){if(s=null,t.child!==null)switch(t.child.tag){case 5:s=t.child.stateNode;break;case 1:s=t.child.stateNode}qd(t,c,s)}break;case 5:var i=t.stateNode;if(s===null&&t.flags&4){s=i;var a=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":a.autoFocus&&s.focus();break;case"img":a.src&&(s.src=a.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var d=t.alternate;if(d!==null){var g=d.memoizedState;if(g!==null){var l=g.dehydrated;l!==null&&wi(l)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(oe(163))}St||t.flags&512&&pu(t)}catch(m){tt(t,t.return,m)}}if(t===e){de=null;break}if(s=t.sibling,s!==null){s.return=t.return,de=s;break}de=t.return}}function hf(e){for(;de!==null;){var t=de;if(t===e){de=null;break}var s=t.sibling;if(s!==null){s.return=t.return,de=s;break}de=t.return}}function df(e){for(;de!==null;){var t=de;try{switch(t.tag){case 0:case 11:case 15:var s=t.return;try{ol(4,t)}catch(a){tt(t,s,a)}break;case 1:var n=t.stateNode;if(typeof n.componentDidMount=="function"){var r=t.return;try{n.componentDidMount()}catch(a){tt(t,r,a)}}var o=t.return;try{pu(t)}catch(a){tt(t,o,a)}break;case 5:var c=t.return;try{pu(t)}catch(a){tt(t,c,a)}}}catch(a){tt(t,t.return,a)}if(t===e){de=null;break}var i=t.sibling;if(i!==null){i.return=t.return,de=i;break}de=t.return}}var iw=Math.ceil,Na=Is.ReactCurrentDispatcher,xh=Is.ReactCurrentOwner,qt=Is.ReactCurrentBatchConfig,Ne=0,dt=null,ot=null,mt=0,Bt=0,er=an(0),ct=0,Ai=null,kn=0,al=0,Ch=0,hi=null,Rt=null,bh=0,vr=1/0,xs=null,Pa=!1,_u=null,Js=null,Io=!1,qs=null,Ia=0,di=0,vu=null,ra=-1,ia=0;function Et(){return Ne&6?nt():ra!==-1?ra:ra=nt()}function en(e){return e.mode&1?Ne&2&&mt!==0?mt&-mt:z1.transition!==null?(ia===0&&(ia=jg()),ia):(e=Oe,e!==0||(e=window.event,e=e===void 0?16:Ug(e.type)),e):1}function as(e,t,s,n){if(50<di)throw di=0,vu=null,Error(oe(185));qi(e,s,n),(!(Ne&2)||e!==dt)&&(e===dt&&(!(Ne&2)&&(al|=s),ct===4&&Us(e,mt)),Pt(e,n),s===1&&Ne===0&&!(t.mode&1)&&(vr=nt()+500,nl&&ln()))}function Pt(e,t){var s=e.callbackNode;zy(e,t);var n=va(e,e===dt?mt:0);if(n===0)s!==null&&wd(s),e.callbackNode=null,e.callbackPriority=0;else if(t=n&-n,e.callbackPriority!==t){if(s!=null&&wd(s),t===1)e.tag===0?H1(ff.bind(null,e)):cm(ff.bind(null,e)),j1(function(){!(Ne&6)&&ln()}),s=null;else{switch(Og(n)){case 1:s=Yu;break;case 4:s=Ig;break;case 16:s=_a;break;case 536870912:s=Bg;break;default:s=_a}s=a_(s,e_.bind(null,e))}e.callbackPriority=t,e.callbackNode=s}}function e_(e,t){if(ra=-1,ia=0,Ne&6)throw Error(oe(327));var s=e.callbackNode;if(lr()&&e.callbackNode!==s)return null;var n=va(e,e===dt?mt:0);if(n===0)return null;if(n&30||n&e.expiredLanes||t)t=Ba(e,n);else{t=n;var r=Ne;Ne|=2;var o=s_();(dt!==e||mt!==t)&&(xs=null,vr=nt()+500,yn(e,t));do try{lw();break}catch(i){t_(e,i)}while(!0);ch(),Na.current=o,Ne=r,ot!==null?t=0:(dt=null,mt=0,t=ct)}if(t!==0){if(t===2&&(r=Vc(e),r!==0&&(n=r,t=yu(e,r))),t===1)throw s=Ai,yn(e,0),Us(e,n),Pt(e,nt()),s;if(t===6)Us(e,n);else{if(r=e.current.alternate,!(n&30)&&!ow(r)&&(t=Ba(e,n),t===2&&(o=Vc(e),o!==0&&(n=o,t=yu(e,o))),t===1))throw s=Ai,yn(e,0),Us(e,n),Pt(e,nt()),s;switch(e.finishedWork=r,e.finishedLanes=n,t){case 0:case 1:throw Error(oe(345));case 2:dn(e,Rt,xs);break;case 3:if(Us(e,n),(n&130023424)===n&&(t=bh+500-nt(),10<t)){if(va(e,0)!==0)break;if(r=e.suspendedLanes,(r&n)!==n){Et(),e.pingedLanes|=e.suspendedLanes&r;break}e.timeoutHandle=Jc(dn.bind(null,e,Rt,xs),t);break}dn(e,Rt,xs);break;case 4:if(Us(e,n),(n&4194240)===n)break;for(t=e.eventTimes,r=-1;0<n;){var c=31-os(n);o=1<<c,c=t[c],c>r&&(r=c),n&=~o}if(n=r,n=nt()-n,n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*iw(n/1960))-n,10<n){e.timeoutHandle=Jc(dn.bind(null,e,Rt,xs),n);break}dn(e,Rt,xs);break;case 5:dn(e,Rt,xs);break;default:throw Error(oe(329))}}}return Pt(e,nt()),e.callbackNode===s?e_.bind(null,e):null}function yu(e,t){var s=hi;return e.current.memoizedState.isDehydrated&&(yn(e,t).flags|=256),e=Ba(e,t),e!==2&&(t=Rt,Rt=s,t!==null&&wu(t)),e}function wu(e){Rt===null?Rt=e:Rt.push.apply(Rt,e)}function ow(e){for(var t=e;;){if(t.flags&16384){var s=t.updateQueue;if(s!==null&&(s=s.stores,s!==null))for(var n=0;n<s.length;n++){var r=s[n],o=r.getSnapshot;r=r.value;try{if(!ls(o(),r))return!1}catch{return!1}}}if(s=t.child,t.subtreeFlags&16384&&s!==null)s.return=t,t=s;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Us(e,t){for(t&=~Ch,t&=~al,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var s=31-os(t),n=1<<s;e[s]=-1,t&=~n}}function ff(e){if(Ne&6)throw Error(oe(327));lr();var t=va(e,0);if(!(t&1))return Pt(e,nt()),null;var s=Ba(e,t);if(e.tag!==0&&s===2){var n=Vc(e);n!==0&&(t=n,s=yu(e,n))}if(s===1)throw s=Ai,yn(e,0),Us(e,t),Pt(e,nt()),s;if(s===6)throw Error(oe(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,dn(e,Rt,xs),Pt(e,nt()),null}function Eh(e,t){var s=Ne;Ne|=1;try{return e(t)}finally{Ne=s,Ne===0&&(vr=nt()+500,nl&&ln())}}function Ln(e){qs!==null&&qs.tag===0&&!(Ne&6)&&lr();var t=Ne;Ne|=1;var s=qt.transition,n=Oe;try{if(qt.transition=null,Oe=1,e)return e()}finally{Oe=n,qt.transition=s,Ne=t,!(Ne&6)&&ln()}}function kh(){Bt=er.current,Ke(er)}function yn(e,t){e.finishedWork=null,e.finishedLanes=0;var s=e.timeoutHandle;if(s!==-1&&(e.timeoutHandle=-1,B1(s)),ot!==null)for(s=ot.return;s!==null;){var n=s;switch(oh(n),n.tag){case 1:n=n.type.childContextTypes,n!=null&&Ca();break;case 3:mr(),Ke(Tt),Ke(Ct),gh();break;case 5:ph(n);break;case 4:mr();break;case 13:Ke(Qe);break;case 19:Ke(Qe);break;case 10:uh(n.type._context);break;case 22:case 23:kh()}s=s.return}if(dt=e,ot=e=tn(e.current,null),mt=Bt=t,ct=0,Ai=null,Ch=al=kn=0,Rt=hi=null,gn!==null){for(t=0;t<gn.length;t++)if(s=gn[t],n=s.interleaved,n!==null){s.interleaved=null;var r=n.next,o=s.pending;if(o!==null){var c=o.next;o.next=r,n.next=c}s.pending=n}gn=null}return e}function t_(e,t){do{var s=ot;try{if(ch(),ta.current=Ta,Aa){for(var n=Ze.memoizedState;n!==null;){var r=n.queue;r!==null&&(r.pending=null),n=n.next}Aa=!1}if(En=0,ht=lt=Ze=null,ci=!1,Mi=0,xh.current=null,s===null||s.return===null){ct=1,Ai=t,ot=null;break}e:{var o=e,c=s.return,i=s,a=t;if(t=mt,i.flags|=32768,a!==null&&typeof a=="object"&&typeof a.then=="function"){var d=a,g=i,l=g.tag;if(!(g.mode&1)&&(l===0||l===11||l===15)){var m=g.alternate;m?(g.updateQueue=m.updateQueue,g.memoizedState=m.memoizedState,g.lanes=m.lanes):(g.updateQueue=null,g.memoizedState=null)}var v=Jd(c);if(v!==null){v.flags&=-257,ef(v,c,i,o,t),v.mode&1&&Zd(o,d,t),t=v,a=d;var w=t.updateQueue;if(w===null){var _=new Set;_.add(a),t.updateQueue=_}else w.add(a);break e}else{if(!(t&1)){Zd(o,d,t),Lh();break e}a=Error(oe(426))}}else if(qe&&i.mode&1){var u=Jd(c);if(u!==null){!(u.flags&65536)&&(u.flags|=256),ef(u,c,i,o,t),ah(_r(a,i));break e}}o=a=_r(a,i),ct!==4&&(ct=2),hi===null?hi=[o]:hi.push(o),o=c;do{switch(o.tag){case 3:o.flags|=65536,t&=-t,o.lanes|=t;var f=Om(o,a,t);Kd(o,f);break e;case 1:i=a;var p=o.type,h=o.stateNode;if(!(o.flags&128)&&(typeof p.getDerivedStateFromError=="function"||h!==null&&typeof h.componentDidCatch=="function"&&(Js===null||!Js.has(h)))){o.flags|=65536,t&=-t,o.lanes|=t;var y=$m(o,i,t);Kd(o,y);break e}}o=o.return}while(o!==null)}r_(s)}catch(b){t=b,ot===s&&s!==null&&(ot=s=s.return);continue}break}while(!0)}function s_(){var e=Na.current;return Na.current=Ta,e===null?Ta:e}function Lh(){(ct===0||ct===3||ct===2)&&(ct=4),dt===null||!(kn&268435455)&&!(al&268435455)||Us(dt,mt)}function Ba(e,t){var s=Ne;Ne|=2;var n=s_();(dt!==e||mt!==t)&&(xs=null,yn(e,t));do try{aw();break}catch(r){t_(e,r)}while(!0);if(ch(),Ne=s,Na.current=n,ot!==null)throw Error(oe(261));return dt=null,mt=0,ct}function aw(){for(;ot!==null;)n_(ot)}function lw(){for(;ot!==null&&!Ny();)n_(ot)}function n_(e){var t=o_(e.alternate,e,Bt);e.memoizedProps=e.pendingProps,t===null?r_(e):ot=t,xh.current=null}function r_(e){var t=e;do{var s=t.alternate;if(e=t.return,t.flags&32768){if(s=tw(s,t),s!==null){s.flags&=32767,ot=s;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{ct=6,ot=null;return}}else if(s=ew(s,t,Bt),s!==null){ot=s;return}if(t=t.sibling,t!==null){ot=t;return}ot=t=e}while(t!==null);ct===0&&(ct=5)}function dn(e,t,s){var n=Oe,r=qt.transition;try{qt.transition=null,Oe=1,cw(e,t,s,n)}finally{qt.transition=r,Oe=n}return null}function cw(e,t,s,n){do lr();while(qs!==null);if(Ne&6)throw Error(oe(327));s=e.finishedWork;var r=e.finishedLanes;if(s===null)return null;if(e.finishedWork=null,e.finishedLanes=0,s===e.current)throw Error(oe(177));e.callbackNode=null,e.callbackPriority=0;var o=s.lanes|s.childLanes;if(Wy(e,o),e===dt&&(ot=dt=null,mt=0),!(s.subtreeFlags&2064)&&!(s.flags&2064)||Io||(Io=!0,a_(_a,function(){return lr(),null})),o=(s.flags&15990)!==0,s.subtreeFlags&15990||o){o=qt.transition,qt.transition=null;var c=Oe;Oe=1;var i=Ne;Ne|=4,xh.current=null,nw(e,s),Zm(s,e),R1(Qc),ya=!!Yc,Qc=Yc=null,e.current=s,rw(s),Py(),Ne=i,Oe=c,qt.transition=o}else e.current=s;if(Io&&(Io=!1,qs=e,Ia=r),o=e.pendingLanes,o===0&&(Js=null),jy(s.stateNode),Pt(e,nt()),t!==null)for(n=e.onRecoverableError,s=0;s<t.length;s++)r=t[s],n(r.value,{componentStack:r.stack,digest:r.digest});if(Pa)throw Pa=!1,e=_u,_u=null,e;return Ia&1&&e.tag!==0&&lr(),o=e.pendingLanes,o&1?e===vu?di++:(di=0,vu=e):di=0,ln(),null}function lr(){if(qs!==null){var e=Og(Ia),t=qt.transition,s=Oe;try{if(qt.transition=null,Oe=16>e?16:e,qs===null)var n=!1;else{if(e=qs,qs=null,Ia=0,Ne&6)throw Error(oe(331));var r=Ne;for(Ne|=4,de=e.current;de!==null;){var o=de,c=o.child;if(de.flags&16){var i=o.deletions;if(i!==null){for(var a=0;a<i.length;a++){var d=i[a];for(de=d;de!==null;){var g=de;switch(g.tag){case 0:case 11:case 15:ui(8,g,o)}var l=g.child;if(l!==null)l.return=g,de=l;else for(;de!==null;){g=de;var m=g.sibling,v=g.return;if(Xm(g),g===d){de=null;break}if(m!==null){m.return=v,de=m;break}de=v}}}var w=o.alternate;if(w!==null){var _=w.child;if(_!==null){w.child=null;do{var u=_.sibling;_.sibling=null,_=u}while(_!==null)}}de=o}}if(o.subtreeFlags&2064&&c!==null)c.return=o,de=c;else e:for(;de!==null;){if(o=de,o.flags&2048)switch(o.tag){case 0:case 11:case 15:ui(9,o,o.return)}var f=o.sibling;if(f!==null){f.return=o.return,de=f;break e}de=o.return}}var p=e.current;for(de=p;de!==null;){c=de;var h=c.child;if(c.subtreeFlags&2064&&h!==null)h.return=c,de=h;else e:for(c=p;de!==null;){if(i=de,i.flags&2048)try{switch(i.tag){case 0:case 11:case 15:ol(9,i)}}catch(b){tt(i,i.return,b)}if(i===c){de=null;break e}var y=i.sibling;if(y!==null){y.return=i.return,de=y;break e}de=i.return}}if(Ne=r,ln(),_s&&typeof _s.onPostCommitFiberRoot=="function")try{_s.onPostCommitFiberRoot(Za,e)}catch{}n=!0}return n}finally{Oe=s,qt.transition=t}}return!1}function pf(e,t,s){t=_r(s,t),t=Om(e,t,1),e=Zs(e,t,1),t=Et(),e!==null&&(qi(e,1,t),Pt(e,t))}function tt(e,t,s){if(e.tag===3)pf(e,e,s);else for(;t!==null;){if(t.tag===3){pf(t,e,s);break}else if(t.tag===1){var n=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof n.componentDidCatch=="function"&&(Js===null||!Js.has(n))){e=_r(s,e),e=$m(t,e,1),t=Zs(t,e,1),e=Et(),t!==null&&(qi(t,1,e),Pt(t,e));break}}t=t.return}}function uw(e,t,s){var n=e.pingCache;n!==null&&n.delete(t),t=Et(),e.pingedLanes|=e.suspendedLanes&s,dt===e&&(mt&s)===s&&(ct===4||ct===3&&(mt&130023424)===mt&&500>nt()-bh?yn(e,0):Ch|=s),Pt(e,t)}function i_(e,t){t===0&&(e.mode&1?(t=Eo,Eo<<=1,!(Eo&130023424)&&(Eo=4194304)):t=1);var s=Et();e=As(e,t),e!==null&&(qi(e,t,s),Pt(e,s))}function hw(e){var t=e.memoizedState,s=0;t!==null&&(s=t.retryLane),i_(e,s)}function dw(e,t){var s=0;switch(e.tag){case 13:var n=e.stateNode,r=e.memoizedState;r!==null&&(s=r.retryLane);break;case 19:n=e.stateNode;break;default:throw Error(oe(314))}n!==null&&n.delete(t),i_(e,s)}var o_;o_=function(e,t,s){if(e!==null)if(e.memoizedProps!==t.pendingProps||Tt.current)Dt=!0;else{if(!(e.lanes&s)&&!(t.flags&128))return Dt=!1,J1(e,t,s);Dt=!!(e.flags&131072)}else Dt=!1,qe&&t.flags&1048576&&um(t,ka,t.index);switch(t.lanes=0,t.tag){case 2:var n=t.type;na(e,t),e=t.pendingProps;var r=fr(t,Ct.current);ar(t,s),r=_h(null,t,n,e,r,s);var o=vh();return t.flags|=1,typeof r=="object"&&r!==null&&typeof r.render=="function"&&r.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Nt(n)?(o=!0,ba(t)):o=!1,t.memoizedState=r.state!==null&&r.state!==void 0?r.state:null,dh(t),r.updater=il,t.stateNode=r,r._reactInternals=t,ou(t,n,e,s),t=cu(null,t,n,!0,o,s)):(t.tag=0,qe&&o&&ih(t),bt(null,t,r,s),t=t.child),t;case 16:n=t.elementType;e:{switch(na(e,t),e=t.pendingProps,r=n._init,n=r(n._payload),t.type=n,r=t.tag=pw(n),e=Jt(n,e),r){case 0:t=lu(null,t,n,e,s);break e;case 1:t=nf(null,t,n,e,s);break e;case 11:t=tf(null,t,n,e,s);break e;case 14:t=sf(null,t,n,Jt(n.type,e),s);break e}throw Error(oe(306,n,""))}return t;case 0:return n=t.type,r=t.pendingProps,r=t.elementType===n?r:Jt(n,r),lu(e,t,n,r,s);case 1:return n=t.type,r=t.pendingProps,r=t.elementType===n?r:Jt(n,r),nf(e,t,n,r,s);case 3:e:{if(Wm(t),e===null)throw Error(oe(387));n=t.pendingProps,o=t.memoizedState,r=o.element,mm(e,t),Ra(t,n,null,s);var c=t.memoizedState;if(n=c.element,o.isDehydrated)if(o={element:n,isDehydrated:!1,cache:c.cache,pendingSuspenseBoundaries:c.pendingSuspenseBoundaries,transitions:c.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){r=_r(Error(oe(423)),t),t=rf(e,t,n,s,r);break e}else if(n!==r){r=_r(Error(oe(424)),t),t=rf(e,t,n,s,r);break e}else for(Ot=Qs(t.stateNode.containerInfo.firstChild),$t=t,qe=!0,ss=null,s=pm(t,null,n,s),t.child=s;s;)s.flags=s.flags&-3|4096,s=s.sibling;else{if(pr(),n===r){t=Ts(e,t,s);break e}bt(e,t,n,s)}t=t.child}return t;case 5:return _m(t),e===null&&nu(t),n=t.type,r=t.pendingProps,o=e!==null?e.memoizedProps:null,c=r.children,Zc(n,r)?c=null:o!==null&&Zc(n,o)&&(t.flags|=32),zm(e,t),bt(e,t,c,s),t.child;case 6:return e===null&&nu(t),null;case 13:return Um(e,t,s);case 4:return fh(t,t.stateNode.containerInfo),n=t.pendingProps,e===null?t.child=gr(t,null,n,s):bt(e,t,n,s),t.child;case 11:return n=t.type,r=t.pendingProps,r=t.elementType===n?r:Jt(n,r),tf(e,t,n,r,s);case 7:return bt(e,t,t.pendingProps,s),t.child;case 8:return bt(e,t,t.pendingProps.children,s),t.child;case 12:return bt(e,t,t.pendingProps.children,s),t.child;case 10:e:{if(n=t.type._context,r=t.pendingProps,o=t.memoizedProps,c=r.value,ze(La,n._currentValue),n._currentValue=c,o!==null)if(ls(o.value,c)){if(o.children===r.children&&!Tt.current){t=Ts(e,t,s);break e}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var i=o.dependencies;if(i!==null){c=o.child;for(var a=i.firstContext;a!==null;){if(a.context===n){if(o.tag===1){a=Ms(-1,s&-s),a.tag=2;var d=o.updateQueue;if(d!==null){d=d.shared;var g=d.pending;g===null?a.next=a:(a.next=g.next,g.next=a),d.pending=a}}o.lanes|=s,a=o.alternate,a!==null&&(a.lanes|=s),ru(o.return,s,t),i.lanes|=s;break}a=a.next}}else if(o.tag===10)c=o.type===t.type?null:o.child;else if(o.tag===18){if(c=o.return,c===null)throw Error(oe(341));c.lanes|=s,i=c.alternate,i!==null&&(i.lanes|=s),ru(c,s,t),c=o.sibling}else c=o.child;if(c!==null)c.return=o;else for(c=o;c!==null;){if(c===t){c=null;break}if(o=c.sibling,o!==null){o.return=c.return,c=o;break}c=c.return}o=c}bt(e,t,r.children,s),t=t.child}return t;case 9:return r=t.type,n=t.pendingProps.children,ar(t,s),r=Gt(r),n=n(r),t.flags|=1,bt(e,t,n,s),t.child;case 14:return n=t.type,r=Jt(n,t.pendingProps),r=Jt(n.type,r),sf(e,t,n,r,s);case 15:return Fm(e,t,t.type,t.pendingProps,s);case 17:return n=t.type,r=t.pendingProps,r=t.elementType===n?r:Jt(n,r),na(e,t),t.tag=1,Nt(n)?(e=!0,ba(t)):e=!1,ar(t,s),jm(t,n,r),ou(t,n,r,s),cu(null,t,n,!0,e,s);case 19:return Vm(e,t,s);case 22:return Hm(e,t,s)}throw Error(oe(156,t.tag))};function a_(e,t){return Pg(e,t)}function fw(e,t,s,n){this.tag=e,this.key=s,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=n,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Kt(e,t,s,n){return new fw(e,t,s,n)}function Mh(e){return e=e.prototype,!(!e||!e.isReactComponent)}function pw(e){if(typeof e=="function")return Mh(e)?1:0;if(e!=null){if(e=e.$$typeof,e===qu)return 11;if(e===Gu)return 14}return 2}function tn(e,t){var s=e.alternate;return s===null?(s=Kt(e.tag,t,e.key,e.mode),s.elementType=e.elementType,s.type=e.type,s.stateNode=e.stateNode,s.alternate=e,e.alternate=s):(s.pendingProps=t,s.type=e.type,s.flags=0,s.subtreeFlags=0,s.deletions=null),s.flags=e.flags&14680064,s.childLanes=e.childLanes,s.lanes=e.lanes,s.child=e.child,s.memoizedProps=e.memoizedProps,s.memoizedState=e.memoizedState,s.updateQueue=e.updateQueue,t=e.dependencies,s.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},s.sibling=e.sibling,s.index=e.index,s.ref=e.ref,s}function oa(e,t,s,n,r,o){var c=2;if(n=e,typeof e=="function")Mh(e)&&(c=1);else if(typeof e=="string")c=5;else e:switch(e){case Un:return wn(s.children,r,o,t);case Ku:c=8,r|=8;break;case Dc:return e=Kt(12,s,t,r|2),e.elementType=Dc,e.lanes=o,e;case Ac:return e=Kt(13,s,t,r),e.elementType=Ac,e.lanes=o,e;case Tc:return e=Kt(19,s,t,r),e.elementType=Tc,e.lanes=o,e;case _g:return ll(s,r,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case gg:c=10;break e;case mg:c=9;break e;case qu:c=11;break e;case Gu:c=14;break e;case Hs:c=16,n=null;break e}throw Error(oe(130,e==null?e:typeof e,""))}return t=Kt(c,s,t,r),t.elementType=e,t.type=n,t.lanes=o,t}function wn(e,t,s,n){return e=Kt(7,e,n,t),e.lanes=s,e}function ll(e,t,s,n){return e=Kt(22,e,n,t),e.elementType=_g,e.lanes=s,e.stateNode={isHidden:!1},e}function ac(e,t,s){return e=Kt(6,e,null,t),e.lanes=s,e}function lc(e,t,s){return t=Kt(4,e.children!==null?e.children:[],e.key,t),t.lanes=s,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function gw(e,t,s,n,r){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=zl(0),this.expirationTimes=zl(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=zl(0),this.identifierPrefix=n,this.onRecoverableError=r,this.mutableSourceEagerHydrationData=null}function Rh(e,t,s,n,r,o,c,i,a){return e=new gw(e,t,s,i,a),t===1?(t=1,o===!0&&(t|=8)):t=0,o=Kt(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:n,isDehydrated:s,cache:null,transitions:null,pendingSuspenseBoundaries:null},dh(o),e}function mw(e,t,s){var n=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Wn,key:n==null?null:""+n,children:e,containerInfo:t,implementation:s}}function l_(e){if(!e)return rn;e=e._reactInternals;e:{if(In(e)!==e||e.tag!==1)throw Error(oe(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(Nt(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(oe(171))}if(e.tag===1){var s=e.type;if(Nt(s))return lm(e,s,t)}return t}function c_(e,t,s,n,r,o,c,i,a){return e=Rh(s,n,!0,e,r,o,c,i,a),e.context=l_(null),s=e.current,n=Et(),r=en(s),o=Ms(n,r),o.callback=t??null,Zs(s,o,r),e.current.lanes=r,qi(e,r,n),Pt(e,n),e}function cl(e,t,s,n){var r=t.current,o=Et(),c=en(r);return s=l_(s),t.context===null?t.context=s:t.pendingContext=s,t=Ms(o,c),t.payload={element:e},n=n===void 0?null:n,n!==null&&(t.callback=n),e=Zs(r,t,c),e!==null&&(as(e,r,c,o),ea(e,r,c)),c}function ja(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function gf(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var s=e.retryLane;e.retryLane=s!==0&&s<t?s:t}}function Dh(e,t){gf(e,t),(e=e.alternate)&&gf(e,t)}function _w(){return null}var u_=typeof reportError=="function"?reportError:function(e){console.error(e)};function Ah(e){this._internalRoot=e}ul.prototype.render=Ah.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(oe(409));cl(e,t,null,null)};ul.prototype.unmount=Ah.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Ln(function(){cl(null,e,null,null)}),t[Ds]=null}};function ul(e){this._internalRoot=e}ul.prototype.unstable_scheduleHydration=function(e){if(e){var t=Hg();e={blockedOn:null,target:e,priority:t};for(var s=0;s<Ws.length&&t!==0&&t<Ws[s].priority;s++);Ws.splice(s,0,e),s===0&&Wg(e)}};function Th(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function hl(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function mf(){}function vw(e,t,s,n,r){if(r){if(typeof n=="function"){var o=n;n=function(){var d=ja(c);o.call(d)}}var c=c_(t,n,e,0,null,!1,!1,"",mf);return e._reactRootContainer=c,e[Ds]=c.current,Ci(e.nodeType===8?e.parentNode:e),Ln(),c}for(;r=e.lastChild;)e.removeChild(r);if(typeof n=="function"){var i=n;n=function(){var d=ja(a);i.call(d)}}var a=Rh(e,0,!1,null,null,!1,!1,"",mf);return e._reactRootContainer=a,e[Ds]=a.current,Ci(e.nodeType===8?e.parentNode:e),Ln(function(){cl(t,a,s,n)}),a}function dl(e,t,s,n,r){var o=s._reactRootContainer;if(o){var c=o;if(typeof r=="function"){var i=r;r=function(){var a=ja(c);i.call(a)}}cl(t,c,e,r)}else c=vw(s,t,e,r,n);return ja(c)}$g=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var s=Zr(t.pendingLanes);s!==0&&(Qu(t,s|1),Pt(t,nt()),!(Ne&6)&&(vr=nt()+500,ln()))}break;case 13:Ln(function(){var n=As(e,1);if(n!==null){var r=Et();as(n,e,1,r)}}),Dh(e,1)}};Zu=function(e){if(e.tag===13){var t=As(e,134217728);if(t!==null){var s=Et();as(t,e,134217728,s)}Dh(e,134217728)}};Fg=function(e){if(e.tag===13){var t=en(e),s=As(e,t);if(s!==null){var n=Et();as(s,e,t,n)}Dh(e,t)}};Hg=function(){return Oe};zg=function(e,t){var s=Oe;try{return Oe=e,t()}finally{Oe=s}};zc=function(e,t,s){switch(t){case"input":if(Ic(e,s),t=s.name,s.type==="radio"&&t!=null){for(s=e;s.parentNode;)s=s.parentNode;for(s=s.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<s.length;t++){var n=s[t];if(n!==e&&n.form===e.form){var r=sl(n);if(!r)throw Error(oe(90));yg(n),Ic(n,r)}}}break;case"textarea":Sg(e,s);break;case"select":t=s.value,t!=null&&nr(e,!!s.multiple,t,!1)}};Mg=Eh;Rg=Ln;var yw={usingClientEntryPoint:!1,Events:[Xi,Gn,sl,kg,Lg,Eh]},Vr={findFiberByHostInstance:pn,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},ww={bundleType:Vr.bundleType,version:Vr.version,rendererPackageName:Vr.rendererPackageName,rendererConfig:Vr.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Is.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=Tg(e),e===null?null:e.stateNode},findFiberByHostInstance:Vr.findFiberByHostInstance||_w,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Bo=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Bo.isDisabled&&Bo.supportsFiber)try{Za=Bo.inject(ww),_s=Bo}catch{}}zt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=yw;zt.createPortal=function(e,t){var s=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Th(t))throw Error(oe(200));return mw(e,t,null,s)};zt.createRoot=function(e,t){if(!Th(e))throw Error(oe(299));var s=!1,n="",r=u_;return t!=null&&(t.unstable_strictMode===!0&&(s=!0),t.identifierPrefix!==void 0&&(n=t.identifierPrefix),t.onRecoverableError!==void 0&&(r=t.onRecoverableError)),t=Rh(e,1,!1,null,null,s,!1,n,r),e[Ds]=t.current,Ci(e.nodeType===8?e.parentNode:e),new Ah(t)};zt.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(oe(188)):(e=Object.keys(e).join(","),Error(oe(268,e)));return e=Tg(t),e=e===null?null:e.stateNode,e};zt.flushSync=function(e){return Ln(e)};zt.hydrate=function(e,t,s){if(!hl(t))throw Error(oe(200));return dl(null,e,t,!0,s)};zt.hydrateRoot=function(e,t,s){if(!Th(e))throw Error(oe(405));var n=s!=null&&s.hydratedSources||null,r=!1,o="",c=u_;if(s!=null&&(s.unstable_strictMode===!0&&(r=!0),s.identifierPrefix!==void 0&&(o=s.identifierPrefix),s.onRecoverableError!==void 0&&(c=s.onRecoverableError)),t=c_(t,null,e,1,s??null,r,!1,o,c),e[Ds]=t.current,Ci(e),n)for(e=0;e<n.length;e++)s=n[e],r=s._getVersion,r=r(s._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[s,r]:t.mutableSourceEagerHydrationData.push(s,r);return new ul(t)};zt.render=function(e,t,s){if(!hl(t))throw Error(oe(200));return dl(null,e,t,!1,s)};zt.unmountComponentAtNode=function(e){if(!hl(e))throw Error(oe(40));return e._reactRootContainer?(Ln(function(){dl(null,null,e,!1,function(){e._reactRootContainer=null,e[Ds]=null})}),!0):!1};zt.unstable_batchedUpdates=Eh;zt.unstable_renderSubtreeIntoContainer=function(e,t,s,n){if(!hl(s))throw Error(oe(200));if(e==null||e._reactInternals===void 0)throw Error(oe(38));return dl(e,t,s,!1,n)};zt.version="18.3.1-next-f1338f8080-20240426";function h_(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(h_)}catch(e){console.error(e)}}h_(),hg.exports=zt;var Sw=hg.exports,_f=Sw;Mc.createRoot=_f.createRoot,Mc.hydrateRoot=_f.hydrateRoot;function at(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let s=0,n;s<e.length;s++)(n=at(e[s]))!==""&&(t+=(t&&" ")+n);else for(let s in e)e[s]&&(t+=(t&&" ")+s);return t}var xw={value:()=>{}};function fl(){for(var e=0,t=arguments.length,s={},n;e<t;++e){if(!(n=arguments[e]+"")||n in s||/[\s.]/.test(n))throw new Error("illegal type: "+n);s[n]=[]}return new aa(s)}function aa(e){this._=e}function Cw(e,t){return e.trim().split(/^|\s+/).map(function(s){var n="",r=s.indexOf(".");if(r>=0&&(n=s.slice(r+1),s=s.slice(0,r)),s&&!t.hasOwnProperty(s))throw new Error("unknown type: "+s);return{type:s,name:n}})}aa.prototype=fl.prototype={constructor:aa,on:function(e,t){var s=this._,n=Cw(e+"",s),r,o=-1,c=n.length;if(arguments.length<2){for(;++o<c;)if((r=(e=n[o]).type)&&(r=bw(s[r],e.name)))return r;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++o<c;)if(r=(e=n[o]).type)s[r]=vf(s[r],e.name,t);else if(t==null)for(r in s)s[r]=vf(s[r],e.name,null);return this},copy:function(){var e={},t=this._;for(var s in t)e[s]=t[s].slice();return new aa(e)},call:function(e,t){if((r=arguments.length-2)>0)for(var s=new Array(r),n=0,r,o;n<r;++n)s[n]=arguments[n+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(o=this._[e],n=0,r=o.length;n<r;++n)o[n].value.apply(t,s)},apply:function(e,t,s){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var n=this._[e],r=0,o=n.length;r<o;++r)n[r].value.apply(t,s)}};function bw(e,t){for(var s=0,n=e.length,r;s<n;++s)if((r=e[s]).name===t)return r.value}function vf(e,t,s){for(var n=0,r=e.length;n<r;++n)if(e[n].name===t){e[n]=xw,e=e.slice(0,n).concat(e.slice(n+1));break}return s!=null&&e.push({name:t,value:s}),e}var Su="http://www.w3.org/1999/xhtml";const yf={svg:"http://www.w3.org/2000/svg",xhtml:Su,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function pl(e){var t=e+="",s=t.indexOf(":");return s>=0&&(t=e.slice(0,s))!=="xmlns"&&(e=e.slice(s+1)),yf.hasOwnProperty(t)?{space:yf[t],local:e}:e}function Ew(e){return function(){var t=this.ownerDocument,s=this.namespaceURI;return s===Su&&t.documentElement.namespaceURI===Su?t.createElement(e):t.createElementNS(s,e)}}function kw(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function d_(e){var t=pl(e);return(t.local?kw:Ew)(t)}function Lw(){}function Nh(e){return e==null?Lw:function(){return this.querySelector(e)}}function Mw(e){typeof e!="function"&&(e=Nh(e));for(var t=this._groups,s=t.length,n=new Array(s),r=0;r<s;++r)for(var o=t[r],c=o.length,i=n[r]=new Array(c),a,d,g=0;g<c;++g)(a=o[g])&&(d=e.call(a,a.__data__,g,o))&&("__data__"in a&&(d.__data__=a.__data__),i[g]=d);return new Ht(n,this._parents)}function Rw(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Dw(){return[]}function f_(e){return e==null?Dw:function(){return this.querySelectorAll(e)}}function Aw(e){return function(){return Rw(e.apply(this,arguments))}}function Tw(e){typeof e=="function"?e=Aw(e):e=f_(e);for(var t=this._groups,s=t.length,n=[],r=[],o=0;o<s;++o)for(var c=t[o],i=c.length,a,d=0;d<i;++d)(a=c[d])&&(n.push(e.call(a,a.__data__,d,c)),r.push(a));return new Ht(n,r)}function p_(e){return function(){return this.matches(e)}}function g_(e){return function(t){return t.matches(e)}}var Nw=Array.prototype.find;function Pw(e){return function(){return Nw.call(this.children,e)}}function Iw(){return this.firstElementChild}function Bw(e){return this.select(e==null?Iw:Pw(typeof e=="function"?e:g_(e)))}var jw=Array.prototype.filter;function Ow(){return Array.from(this.children)}function $w(e){return function(){return jw.call(this.children,e)}}function Fw(e){return this.selectAll(e==null?Ow:$w(typeof e=="function"?e:g_(e)))}function Hw(e){typeof e!="function"&&(e=p_(e));for(var t=this._groups,s=t.length,n=new Array(s),r=0;r<s;++r)for(var o=t[r],c=o.length,i=n[r]=[],a,d=0;d<c;++d)(a=o[d])&&e.call(a,a.__data__,d,o)&&i.push(a);return new Ht(n,this._parents)}function m_(e){return new Array(e.length)}function zw(){return new Ht(this._enter||this._groups.map(m_),this._parents)}function Oa(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Oa.prototype={constructor:Oa,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function Ww(e){return function(){return e}}function Uw(e,t,s,n,r,o){for(var c=0,i,a=t.length,d=o.length;c<d;++c)(i=t[c])?(i.__data__=o[c],n[c]=i):s[c]=new Oa(e,o[c]);for(;c<a;++c)(i=t[c])&&(r[c]=i)}function Vw(e,t,s,n,r,o,c){var i,a,d=new Map,g=t.length,l=o.length,m=new Array(g),v;for(i=0;i<g;++i)(a=t[i])&&(m[i]=v=c.call(a,a.__data__,i,t)+"",d.has(v)?r[i]=a:d.set(v,a));for(i=0;i<l;++i)v=c.call(e,o[i],i,o)+"",(a=d.get(v))?(n[i]=a,a.__data__=o[i],d.delete(v)):s[i]=new Oa(e,o[i]);for(i=0;i<g;++i)(a=t[i])&&d.get(m[i])===a&&(r[i]=a)}function Kw(e){return e.__data__}function qw(e,t){if(!arguments.length)return Array.from(this,Kw);var s=t?Vw:Uw,n=this._parents,r=this._groups;typeof e!="function"&&(e=Ww(e));for(var o=r.length,c=new Array(o),i=new Array(o),a=new Array(o),d=0;d<o;++d){var g=n[d],l=r[d],m=l.length,v=Gw(e.call(g,g&&g.__data__,d,n)),w=v.length,_=i[d]=new Array(w),u=c[d]=new Array(w),f=a[d]=new Array(m);s(g,l,_,u,f,v,t);for(var p=0,h=0,y,b;p<w;++p)if(y=_[p]){for(p>=h&&(h=p+1);!(b=u[h])&&++h<w;);y._next=b||null}}return c=new Ht(c,n),c._enter=i,c._exit=a,c}function Gw(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Xw(){return new Ht(this._exit||this._groups.map(m_),this._parents)}function Yw(e,t,s){var n=this.enter(),r=this,o=this.exit();return typeof e=="function"?(n=e(n),n&&(n=n.selection())):n=n.append(e+""),t!=null&&(r=t(r),r&&(r=r.selection())),s==null?o.remove():s(o),n&&r?n.merge(r).order():r}function Qw(e){for(var t=e.selection?e.selection():e,s=this._groups,n=t._groups,r=s.length,o=n.length,c=Math.min(r,o),i=new Array(r),a=0;a<c;++a)for(var d=s[a],g=n[a],l=d.length,m=i[a]=new Array(l),v,w=0;w<l;++w)(v=d[w]||g[w])&&(m[w]=v);for(;a<r;++a)i[a]=s[a];return new Ht(i,this._parents)}function Zw(){for(var e=this._groups,t=-1,s=e.length;++t<s;)for(var n=e[t],r=n.length-1,o=n[r],c;--r>=0;)(c=n[r])&&(o&&c.compareDocumentPosition(o)^4&&o.parentNode.insertBefore(c,o),o=c);return this}function Jw(e){e||(e=eS);function t(l,m){return l&&m?e(l.__data__,m.__data__):!l-!m}for(var s=this._groups,n=s.length,r=new Array(n),o=0;o<n;++o){for(var c=s[o],i=c.length,a=r[o]=new Array(i),d,g=0;g<i;++g)(d=c[g])&&(a[g]=d);a.sort(t)}return new Ht(r,this._parents).order()}function eS(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function tS(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function sS(){return Array.from(this)}function nS(){for(var e=this._groups,t=0,s=e.length;t<s;++t)for(var n=e[t],r=0,o=n.length;r<o;++r){var c=n[r];if(c)return c}return null}function rS(){let e=0;for(const t of this)++e;return e}function iS(){return!this.node()}function oS(e){for(var t=this._groups,s=0,n=t.length;s<n;++s)for(var r=t[s],o=0,c=r.length,i;o<c;++o)(i=r[o])&&e.call(i,i.__data__,o,r);return this}function aS(e){return function(){this.removeAttribute(e)}}function lS(e){return function(){this.removeAttributeNS(e.space,e.local)}}function cS(e,t){return function(){this.setAttribute(e,t)}}function uS(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function hS(e,t){return function(){var s=t.apply(this,arguments);s==null?this.removeAttribute(e):this.setAttribute(e,s)}}function dS(e,t){return function(){var s=t.apply(this,arguments);s==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,s)}}function fS(e,t){var s=pl(e);if(arguments.length<2){var n=this.node();return s.local?n.getAttributeNS(s.space,s.local):n.getAttribute(s)}return this.each((t==null?s.local?lS:aS:typeof t=="function"?s.local?dS:hS:s.local?uS:cS)(s,t))}function __(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function pS(e){return function(){this.style.removeProperty(e)}}function gS(e,t,s){return function(){this.style.setProperty(e,t,s)}}function mS(e,t,s){return function(){var n=t.apply(this,arguments);n==null?this.style.removeProperty(e):this.style.setProperty(e,n,s)}}function _S(e,t,s){return arguments.length>1?this.each((t==null?pS:typeof t=="function"?mS:gS)(e,t,s??"")):yr(this.node(),e)}function yr(e,t){return e.style.getPropertyValue(t)||__(e).getComputedStyle(e,null).getPropertyValue(t)}function vS(e){return function(){delete this[e]}}function yS(e,t){return function(){this[e]=t}}function wS(e,t){return function(){var s=t.apply(this,arguments);s==null?delete this[e]:this[e]=s}}function SS(e,t){return arguments.length>1?this.each((t==null?vS:typeof t=="function"?wS:yS)(e,t)):this.node()[e]}function v_(e){return e.trim().split(/^|\s+/)}function Ph(e){return e.classList||new y_(e)}function y_(e){this._node=e,this._names=v_(e.getAttribute("class")||"")}y_.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function w_(e,t){for(var s=Ph(e),n=-1,r=t.length;++n<r;)s.add(t[n])}function S_(e,t){for(var s=Ph(e),n=-1,r=t.length;++n<r;)s.remove(t[n])}function xS(e){return function(){w_(this,e)}}function CS(e){return function(){S_(this,e)}}function bS(e,t){return function(){(t.apply(this,arguments)?w_:S_)(this,e)}}function ES(e,t){var s=v_(e+"");if(arguments.length<2){for(var n=Ph(this.node()),r=-1,o=s.length;++r<o;)if(!n.contains(s[r]))return!1;return!0}return this.each((typeof t=="function"?bS:t?xS:CS)(s,t))}function kS(){this.textContent=""}function LS(e){return function(){this.textContent=e}}function MS(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function RS(e){return arguments.length?this.each(e==null?kS:(typeof e=="function"?MS:LS)(e)):this.node().textContent}function DS(){this.innerHTML=""}function AS(e){return function(){this.innerHTML=e}}function TS(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function NS(e){return arguments.length?this.each(e==null?DS:(typeof e=="function"?TS:AS)(e)):this.node().innerHTML}function PS(){this.nextSibling&&this.parentNode.appendChild(this)}function IS(){return this.each(PS)}function BS(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function jS(){return this.each(BS)}function OS(e){var t=typeof e=="function"?e:d_(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function $S(){return null}function FS(e,t){var s=typeof e=="function"?e:d_(e),n=t==null?$S:typeof t=="function"?t:Nh(t);return this.select(function(){return this.insertBefore(s.apply(this,arguments),n.apply(this,arguments)||null)})}function HS(){var e=this.parentNode;e&&e.removeChild(this)}function zS(){return this.each(HS)}function WS(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function US(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function VS(e){return this.select(e?US:WS)}function KS(e){return arguments.length?this.property("__data__",e):this.node().__data__}function qS(e){return function(t){e.call(this,t,this.__data__)}}function GS(e){return e.trim().split(/^|\s+/).map(function(t){var s="",n=t.indexOf(".");return n>=0&&(s=t.slice(n+1),t=t.slice(0,n)),{type:t,name:s}})}function XS(e){return function(){var t=this.__on;if(t){for(var s=0,n=-1,r=t.length,o;s<r;++s)o=t[s],(!e.type||o.type===e.type)&&o.name===e.name?this.removeEventListener(o.type,o.listener,o.options):t[++n]=o;++n?t.length=n:delete this.__on}}}function YS(e,t,s){return function(){var n=this.__on,r,o=qS(t);if(n){for(var c=0,i=n.length;c<i;++c)if((r=n[c]).type===e.type&&r.name===e.name){this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=o,r.options=s),r.value=t;return}}this.addEventListener(e.type,o,s),r={type:e.type,name:e.name,value:t,listener:o,options:s},n?n.push(r):this.__on=[r]}}function QS(e,t,s){var n=GS(e+""),r,o=n.length,c;if(arguments.length<2){var i=this.node().__on;if(i){for(var a=0,d=i.length,g;a<d;++a)for(r=0,g=i[a];r<o;++r)if((c=n[r]).type===g.type&&c.name===g.name)return g.value}return}for(i=t?YS:XS,r=0;r<o;++r)this.each(i(n[r],t,s));return this}function x_(e,t,s){var n=__(e),r=n.CustomEvent;typeof r=="function"?r=new r(t,s):(r=n.document.createEvent("Event"),s?(r.initEvent(t,s.bubbles,s.cancelable),r.detail=s.detail):r.initEvent(t,!1,!1)),e.dispatchEvent(r)}function ZS(e,t){return function(){return x_(this,e,t)}}function JS(e,t){return function(){return x_(this,e,t.apply(this,arguments))}}function ex(e,t){return this.each((typeof t=="function"?JS:ZS)(e,t))}function*tx(){for(var e=this._groups,t=0,s=e.length;t<s;++t)for(var n=e[t],r=0,o=n.length,c;r<o;++r)(c=n[r])&&(yield c)}var C_=[null];function Ht(e,t){this._groups=e,this._parents=t}function Qi(){return new Ht([[document.documentElement]],C_)}function sx(){return this}Ht.prototype=Qi.prototype={constructor:Ht,select:Mw,selectAll:Tw,selectChild:Bw,selectChildren:Fw,filter:Hw,data:qw,enter:zw,exit:Xw,join:Yw,merge:Qw,selection:sx,order:Zw,sort:Jw,call:tS,nodes:sS,node:nS,size:rS,empty:iS,each:oS,attr:fS,style:_S,property:SS,classed:ES,text:RS,html:NS,raise:IS,lower:jS,append:OS,insert:FS,remove:zS,clone:VS,datum:KS,on:QS,dispatch:ex,[Symbol.iterator]:tx};function jt(e){return typeof e=="string"?new Ht([[document.querySelector(e)]],[document.documentElement]):new Ht([[e]],C_)}function nx(e){let t;for(;t=e.sourceEvent;)e=t;return e}function ts(e,t){if(e=nx(e),t===void 0&&(t=e.currentTarget),t){var s=t.ownerSVGElement||t;if(s.createSVGPoint){var n=s.createSVGPoint();return n.x=e.clientX,n.y=e.clientY,n=n.matrixTransform(t.getScreenCTM().inverse()),[n.x,n.y]}if(t.getBoundingClientRect){var r=t.getBoundingClientRect();return[e.clientX-r.left-t.clientLeft,e.clientY-r.top-t.clientTop]}}return[e.pageX,e.pageY]}const rx={passive:!1},Ti={capture:!0,passive:!1};function cc(e){e.stopImmediatePropagation()}function cr(e){e.preventDefault(),e.stopImmediatePropagation()}function b_(e){var t=e.document.documentElement,s=jt(e).on("dragstart.drag",cr,Ti);"onselectstart"in t?s.on("selectstart.drag",cr,Ti):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function E_(e,t){var s=e.document.documentElement,n=jt(e).on("dragstart.drag",null);t&&(n.on("click.drag",cr,Ti),setTimeout(function(){n.on("click.drag",null)},0)),"onselectstart"in s?n.on("selectstart.drag",null):(s.style.MozUserSelect=s.__noselect,delete s.__noselect)}const jo=e=>()=>e;function xu(e,{sourceEvent:t,subject:s,target:n,identifier:r,active:o,x:c,y:i,dx:a,dy:d,dispatch:g}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:s,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:o,enumerable:!0,configurable:!0},x:{value:c,enumerable:!0,configurable:!0},y:{value:i,enumerable:!0,configurable:!0},dx:{value:a,enumerable:!0,configurable:!0},dy:{value:d,enumerable:!0,configurable:!0},_:{value:g}})}xu.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function ix(e){return!e.ctrlKey&&!e.button}function ox(){return this.parentNode}function ax(e,t){return t??{x:e.x,y:e.y}}function lx(){return navigator.maxTouchPoints||"ontouchstart"in this}function k_(){var e=ix,t=ox,s=ax,n=lx,r={},o=fl("start","drag","end"),c=0,i,a,d,g,l=0;function m(y){y.on("mousedown.drag",v).filter(n).on("touchstart.drag",u).on("touchmove.drag",f,rx).on("touchend.drag touchcancel.drag",p).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function v(y,b){if(!(g||!e.call(this,y,b))){var C=h(this,t.call(this,y,b),y,b,"mouse");C&&(jt(y.view).on("mousemove.drag",w,Ti).on("mouseup.drag",_,Ti),b_(y.view),cc(y),d=!1,i=y.clientX,a=y.clientY,C("start",y))}}function w(y){if(cr(y),!d){var b=y.clientX-i,C=y.clientY-a;d=b*b+C*C>l}r.mouse("drag",y)}function _(y){jt(y.view).on("mousemove.drag mouseup.drag",null),E_(y.view,d),cr(y),r.mouse("end",y)}function u(y,b){if(e.call(this,y,b)){var C=y.changedTouches,E=t.call(this,y,b),x=C.length,k,M;for(k=0;k<x;++k)(M=h(this,E,y,b,C[k].identifier,C[k]))&&(cc(y),M("start",y,C[k]))}}function f(y){var b=y.changedTouches,C=b.length,E,x;for(E=0;E<C;++E)(x=r[b[E].identifier])&&(cr(y),x("drag",y,b[E]))}function p(y){var b=y.changedTouches,C=b.length,E,x;for(g&&clearTimeout(g),g=setTimeout(function(){g=null},500),E=0;E<C;++E)(x=r[b[E].identifier])&&(cc(y),x("end",y,b[E]))}function h(y,b,C,E,x,k){var M=o.copy(),D=ts(k||C,b),R,N,A;if((A=s.call(y,new xu("beforestart",{sourceEvent:C,target:m,identifier:x,active:c,x:D[0],y:D[1],dx:0,dy:0,dispatch:M}),E))!=null)return R=A.x-D[0]||0,N=A.y-D[1]||0,function $(F,H,I){var L=D,T;switch(F){case"start":r[x]=$,T=c++;break;case"end":delete r[x],--c;case"drag":D=ts(I||H,b),T=c;break}M.call(F,y,new xu(F,{sourceEvent:H,subject:A,target:m,identifier:x,active:T,x:D[0]+R,y:D[1]+N,dx:D[0]-L[0],dy:D[1]-L[1],dispatch:M}),E)}}return m.filter=function(y){return arguments.length?(e=typeof y=="function"?y:jo(!!y),m):e},m.container=function(y){return arguments.length?(t=typeof y=="function"?y:jo(y),m):t},m.subject=function(y){return arguments.length?(s=typeof y=="function"?y:jo(y),m):s},m.touchable=function(y){return arguments.length?(n=typeof y=="function"?y:jo(!!y),m):n},m.on=function(){var y=o.on.apply(o,arguments);return y===o?m:y},m.clickDistance=function(y){return arguments.length?(l=(y=+y)*y,m):Math.sqrt(l)},m}function Ih(e,t,s){e.prototype=t.prototype=s,s.constructor=e}function L_(e,t){var s=Object.create(e.prototype);for(var n in t)s[n]=t[n];return s}function Zi(){}var Ni=.7,$a=1/Ni,ur="\\s*([+-]?\\d+)\\s*",Pi="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",ys="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",cx=/^#([0-9a-f]{3,8})$/,ux=new RegExp(`^rgb\\(${ur},${ur},${ur}\\)$`),hx=new RegExp(`^rgb\\(${ys},${ys},${ys}\\)$`),dx=new RegExp(`^rgba\\(${ur},${ur},${ur},${Pi}\\)$`),fx=new RegExp(`^rgba\\(${ys},${ys},${ys},${Pi}\\)$`),px=new RegExp(`^hsl\\(${Pi},${ys},${ys}\\)$`),gx=new RegExp(`^hsla\\(${Pi},${ys},${ys},${Pi}\\)$`),wf={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};Ih(Zi,Mn,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Sf,formatHex:Sf,formatHex8:mx,formatHsl:_x,formatRgb:xf,toString:xf});function Sf(){return this.rgb().formatHex()}function mx(){return this.rgb().formatHex8()}function _x(){return M_(this).formatHsl()}function xf(){return this.rgb().formatRgb()}function Mn(e){var t,s;return e=(e+"").trim().toLowerCase(),(t=cx.exec(e))?(s=t[1].length,t=parseInt(t[1],16),s===6?Cf(t):s===3?new At(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):s===8?Oo(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):s===4?Oo(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=ux.exec(e))?new At(t[1],t[2],t[3],1):(t=hx.exec(e))?new At(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=dx.exec(e))?Oo(t[1],t[2],t[3],t[4]):(t=fx.exec(e))?Oo(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=px.exec(e))?kf(t[1],t[2]/100,t[3]/100,1):(t=gx.exec(e))?kf(t[1],t[2]/100,t[3]/100,t[4]):wf.hasOwnProperty(e)?Cf(wf[e]):e==="transparent"?new At(NaN,NaN,NaN,0):null}function Cf(e){return new At(e>>16&255,e>>8&255,e&255,1)}function Oo(e,t,s,n){return n<=0&&(e=t=s=NaN),new At(e,t,s,n)}function vx(e){return e instanceof Zi||(e=Mn(e)),e?(e=e.rgb(),new At(e.r,e.g,e.b,e.opacity)):new At}function Cu(e,t,s,n){return arguments.length===1?vx(e):new At(e,t,s,n??1)}function At(e,t,s,n){this.r=+e,this.g=+t,this.b=+s,this.opacity=+n}Ih(At,Cu,L_(Zi,{brighter(e){return e=e==null?$a:Math.pow($a,e),new At(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Ni:Math.pow(Ni,e),new At(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new At(Sn(this.r),Sn(this.g),Sn(this.b),Fa(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:bf,formatHex:bf,formatHex8:yx,formatRgb:Ef,toString:Ef}));function bf(){return`#${_n(this.r)}${_n(this.g)}${_n(this.b)}`}function yx(){return`#${_n(this.r)}${_n(this.g)}${_n(this.b)}${_n((isNaN(this.opacity)?1:this.opacity)*255)}`}function Ef(){const e=Fa(this.opacity);return`${e===1?"rgb(":"rgba("}${Sn(this.r)}, ${Sn(this.g)}, ${Sn(this.b)}${e===1?")":`, ${e})`}`}function Fa(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Sn(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function _n(e){return e=Sn(e),(e<16?"0":"")+e.toString(16)}function kf(e,t,s,n){return n<=0?e=t=s=NaN:s<=0||s>=1?e=t=NaN:t<=0&&(e=NaN),new ns(e,t,s,n)}function M_(e){if(e instanceof ns)return new ns(e.h,e.s,e.l,e.opacity);if(e instanceof Zi||(e=Mn(e)),!e)return new ns;if(e instanceof ns)return e;e=e.rgb();var t=e.r/255,s=e.g/255,n=e.b/255,r=Math.min(t,s,n),o=Math.max(t,s,n),c=NaN,i=o-r,a=(o+r)/2;return i?(t===o?c=(s-n)/i+(s<n)*6:s===o?c=(n-t)/i+2:c=(t-s)/i+4,i/=a<.5?o+r:2-o-r,c*=60):i=a>0&&a<1?0:c,new ns(c,i,a,e.opacity)}function wx(e,t,s,n){return arguments.length===1?M_(e):new ns(e,t,s,n??1)}function ns(e,t,s,n){this.h=+e,this.s=+t,this.l=+s,this.opacity=+n}Ih(ns,wx,L_(Zi,{brighter(e){return e=e==null?$a:Math.pow($a,e),new ns(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Ni:Math.pow(Ni,e),new ns(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,s=this.l,n=s+(s<.5?s:1-s)*t,r=2*s-n;return new At(uc(e>=240?e-240:e+120,r,n),uc(e,r,n),uc(e<120?e+240:e-120,r,n),this.opacity)},clamp(){return new ns(Lf(this.h),$o(this.s),$o(this.l),Fa(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=Fa(this.opacity);return`${e===1?"hsl(":"hsla("}${Lf(this.h)}, ${$o(this.s)*100}%, ${$o(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Lf(e){return e=(e||0)%360,e<0?e+360:e}function $o(e){return Math.max(0,Math.min(1,e||0))}function uc(e,t,s){return(e<60?t+(s-t)*e/60:e<180?s:e<240?t+(s-t)*(240-e)/60:t)*255}const Bh=e=>()=>e;function Sx(e,t){return function(s){return e+s*t}}function xx(e,t,s){return e=Math.pow(e,s),t=Math.pow(t,s)-e,s=1/s,function(n){return Math.pow(e+n*t,s)}}function Cx(e){return(e=+e)==1?R_:function(t,s){return s-t?xx(t,s,e):Bh(isNaN(t)?s:t)}}function R_(e,t){var s=t-e;return s?Sx(e,s):Bh(isNaN(e)?t:e)}const Ha=function e(t){var s=Cx(t);function n(r,o){var c=s((r=Cu(r)).r,(o=Cu(o)).r),i=s(r.g,o.g),a=s(r.b,o.b),d=R_(r.opacity,o.opacity);return function(g){return r.r=c(g),r.g=i(g),r.b=a(g),r.opacity=d(g),r+""}}return n.gamma=e,n}(1);function bx(e,t){t||(t=[]);var s=e?Math.min(t.length,e.length):0,n=t.slice(),r;return function(o){for(r=0;r<s;++r)n[r]=e[r]*(1-o)+t[r]*o;return n}}function Ex(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function kx(e,t){var s=t?t.length:0,n=e?Math.min(s,e.length):0,r=new Array(n),o=new Array(s),c;for(c=0;c<n;++c)r[c]=fi(e[c],t[c]);for(;c<s;++c)o[c]=t[c];return function(i){for(c=0;c<n;++c)o[c]=r[c](i);return o}}function Lx(e,t){var s=new Date;return e=+e,t=+t,function(n){return s.setTime(e*(1-n)+t*n),s}}function gs(e,t){return e=+e,t=+t,function(s){return e*(1-s)+t*s}}function Mx(e,t){var s={},n={},r;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(r in t)r in e?s[r]=fi(e[r],t[r]):n[r]=t[r];return function(o){for(r in s)n[r]=s[r](o);return n}}var bu=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,hc=new RegExp(bu.source,"g");function Rx(e){return function(){return e}}function Dx(e){return function(t){return e(t)+""}}function D_(e,t){var s=bu.lastIndex=hc.lastIndex=0,n,r,o,c=-1,i=[],a=[];for(e=e+"",t=t+"";(n=bu.exec(e))&&(r=hc.exec(t));)(o=r.index)>s&&(o=t.slice(s,o),i[c]?i[c]+=o:i[++c]=o),(n=n[0])===(r=r[0])?i[c]?i[c]+=r:i[++c]=r:(i[++c]=null,a.push({i:c,x:gs(n,r)})),s=hc.lastIndex;return s<t.length&&(o=t.slice(s),i[c]?i[c]+=o:i[++c]=o),i.length<2?a[0]?Dx(a[0].x):Rx(t):(t=a.length,function(d){for(var g=0,l;g<t;++g)i[(l=a[g]).i]=l.x(d);return i.join("")})}function fi(e,t){var s=typeof t,n;return t==null||s==="boolean"?Bh(t):(s==="number"?gs:s==="string"?(n=Mn(t))?(t=n,Ha):D_:t instanceof Mn?Ha:t instanceof Date?Lx:Ex(t)?bx:Array.isArray(t)?kx:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?Mx:gs)(e,t)}var Mf=180/Math.PI,Eu={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function A_(e,t,s,n,r,o){var c,i,a;return(c=Math.sqrt(e*e+t*t))&&(e/=c,t/=c),(a=e*s+t*n)&&(s-=e*a,n-=t*a),(i=Math.sqrt(s*s+n*n))&&(s/=i,n/=i,a/=i),e*n<t*s&&(e=-e,t=-t,a=-a,c=-c),{translateX:r,translateY:o,rotate:Math.atan2(t,e)*Mf,skewX:Math.atan(a)*Mf,scaleX:c,scaleY:i}}var Fo;function Ax(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Eu:A_(t.a,t.b,t.c,t.d,t.e,t.f)}function Tx(e){return e==null||(Fo||(Fo=document.createElementNS("http://www.w3.org/2000/svg","g")),Fo.setAttribute("transform",e),!(e=Fo.transform.baseVal.consolidate()))?Eu:(e=e.matrix,A_(e.a,e.b,e.c,e.d,e.e,e.f))}function T_(e,t,s,n){function r(d){return d.length?d.pop()+" ":""}function o(d,g,l,m,v,w){if(d!==l||g!==m){var _=v.push("translate(",null,t,null,s);w.push({i:_-4,x:gs(d,l)},{i:_-2,x:gs(g,m)})}else(l||m)&&v.push("translate("+l+t+m+s)}function c(d,g,l,m){d!==g?(d-g>180?g+=360:g-d>180&&(d+=360),m.push({i:l.push(r(l)+"rotate(",null,n)-2,x:gs(d,g)})):g&&l.push(r(l)+"rotate("+g+n)}function i(d,g,l,m){d!==g?m.push({i:l.push(r(l)+"skewX(",null,n)-2,x:gs(d,g)}):g&&l.push(r(l)+"skewX("+g+n)}function a(d,g,l,m,v,w){if(d!==l||g!==m){var _=v.push(r(v)+"scale(",null,",",null,")");w.push({i:_-4,x:gs(d,l)},{i:_-2,x:gs(g,m)})}else(l!==1||m!==1)&&v.push(r(v)+"scale("+l+","+m+")")}return function(d,g){var l=[],m=[];return d=e(d),g=e(g),o(d.translateX,d.translateY,g.translateX,g.translateY,l,m),c(d.rotate,g.rotate,l,m),i(d.skewX,g.skewX,l,m),a(d.scaleX,d.scaleY,g.scaleX,g.scaleY,l,m),d=g=null,function(v){for(var w=-1,_=m.length,u;++w<_;)l[(u=m[w]).i]=u.x(v);return l.join("")}}}var Nx=T_(Ax,"px, ","px)","deg)"),Px=T_(Tx,", ",")",")"),Ix=1e-12;function Rf(e){return((e=Math.exp(e))+1/e)/2}function Bx(e){return((e=Math.exp(e))-1/e)/2}function jx(e){return((e=Math.exp(2*e))-1)/(e+1)}const la=function e(t,s,n){function r(o,c){var i=o[0],a=o[1],d=o[2],g=c[0],l=c[1],m=c[2],v=g-i,w=l-a,_=v*v+w*w,u,f;if(_<Ix)f=Math.log(m/d)/t,u=function(E){return[i+E*v,a+E*w,d*Math.exp(t*E*f)]};else{var p=Math.sqrt(_),h=(m*m-d*d+n*_)/(2*d*s*p),y=(m*m-d*d-n*_)/(2*m*s*p),b=Math.log(Math.sqrt(h*h+1)-h),C=Math.log(Math.sqrt(y*y+1)-y);f=(C-b)/t,u=function(E){var x=E*f,k=Rf(b),M=d/(s*p)*(k*jx(t*x+b)-Bx(b));return[i+M*v,a+M*w,d*k/Rf(t*x+b)]}}return u.duration=f*1e3*t/Math.SQRT2,u}return r.rho=function(o){var c=Math.max(.001,+o),i=c*c,a=i*i;return e(c,i,a)},r}(Math.SQRT2,2,4);var wr=0,ei=0,Kr=0,N_=1e3,za,ti,Wa=0,Rn=0,gl=0,Ii=typeof performance=="object"&&performance.now?performance:Date,P_=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function jh(){return Rn||(P_(Ox),Rn=Ii.now()+gl)}function Ox(){Rn=0}function Ua(){this._call=this._time=this._next=null}Ua.prototype=I_.prototype={constructor:Ua,restart:function(e,t,s){if(typeof e!="function")throw new TypeError("callback is not a function");s=(s==null?jh():+s)+(t==null?0:+t),!this._next&&ti!==this&&(ti?ti._next=this:za=this,ti=this),this._call=e,this._time=s,ku()},stop:function(){this._call&&(this._call=null,this._time=1/0,ku())}};function I_(e,t,s){var n=new Ua;return n.restart(e,t,s),n}function $x(){jh(),++wr;for(var e=za,t;e;)(t=Rn-e._time)>=0&&e._call.call(void 0,t),e=e._next;--wr}function Df(){Rn=(Wa=Ii.now())+gl,wr=ei=0;try{$x()}finally{wr=0,Hx(),Rn=0}}function Fx(){var e=Ii.now(),t=e-Wa;t>N_&&(gl-=t,Wa=e)}function Hx(){for(var e,t=za,s,n=1/0;t;)t._call?(n>t._time&&(n=t._time),e=t,t=t._next):(s=t._next,t._next=null,t=e?e._next=s:za=s);ti=e,ku(n)}function ku(e){if(!wr){ei&&(ei=clearTimeout(ei));var t=e-Rn;t>24?(e<1/0&&(ei=setTimeout(Df,e-Ii.now()-gl)),Kr&&(Kr=clearInterval(Kr))):(Kr||(Wa=Ii.now(),Kr=setInterval(Fx,N_)),wr=1,P_(Df))}}function Af(e,t,s){var n=new Ua;return t=t==null?0:+t,n.restart(r=>{n.stop(),e(r+t)},t,s),n}var zx=fl("start","end","cancel","interrupt"),Wx=[],B_=0,Tf=1,Lu=2,ca=3,Nf=4,Mu=5,ua=6;function ml(e,t,s,n,r,o){var c=e.__transition;if(!c)e.__transition={};else if(s in c)return;Ux(e,s,{name:t,index:n,group:r,on:zx,tween:Wx,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:B_})}function Oh(e,t){var s=us(e,t);if(s.state>B_)throw new Error("too late; already scheduled");return s}function ws(e,t){var s=us(e,t);if(s.state>ca)throw new Error("too late; already running");return s}function us(e,t){var s=e.__transition;if(!s||!(s=s[t]))throw new Error("transition not found");return s}function Ux(e,t,s){var n=e.__transition,r;n[t]=s,s.timer=I_(o,0,s.time);function o(d){s.state=Tf,s.timer.restart(c,s.delay,s.time),s.delay<=d&&c(d-s.delay)}function c(d){var g,l,m,v;if(s.state!==Tf)return a();for(g in n)if(v=n[g],v.name===s.name){if(v.state===ca)return Af(c);v.state===Nf?(v.state=ua,v.timer.stop(),v.on.call("interrupt",e,e.__data__,v.index,v.group),delete n[g]):+g<t&&(v.state=ua,v.timer.stop(),v.on.call("cancel",e,e.__data__,v.index,v.group),delete n[g])}if(Af(function(){s.state===ca&&(s.state=Nf,s.timer.restart(i,s.delay,s.time),i(d))}),s.state=Lu,s.on.call("start",e,e.__data__,s.index,s.group),s.state===Lu){for(s.state=ca,r=new Array(m=s.tween.length),g=0,l=-1;g<m;++g)(v=s.tween[g].value.call(e,e.__data__,s.index,s.group))&&(r[++l]=v);r.length=l+1}}function i(d){for(var g=d<s.duration?s.ease.call(null,d/s.duration):(s.timer.restart(a),s.state=Mu,1),l=-1,m=r.length;++l<m;)r[l].call(e,g);s.state===Mu&&(s.on.call("end",e,e.__data__,s.index,s.group),a())}function a(){s.state=ua,s.timer.stop(),delete n[t];for(var d in n)return;delete e.__transition}}function ha(e,t){var s=e.__transition,n,r,o=!0,c;if(s){t=t==null?null:t+"";for(c in s){if((n=s[c]).name!==t){o=!1;continue}r=n.state>Lu&&n.state<Mu,n.state=ua,n.timer.stop(),n.on.call(r?"interrupt":"cancel",e,e.__data__,n.index,n.group),delete s[c]}o&&delete e.__transition}}function Vx(e){return this.each(function(){ha(this,e)})}function Kx(e,t){var s,n;return function(){var r=ws(this,e),o=r.tween;if(o!==s){n=s=o;for(var c=0,i=n.length;c<i;++c)if(n[c].name===t){n=n.slice(),n.splice(c,1);break}}r.tween=n}}function qx(e,t,s){var n,r;if(typeof s!="function")throw new Error;return function(){var o=ws(this,e),c=o.tween;if(c!==n){r=(n=c).slice();for(var i={name:t,value:s},a=0,d=r.length;a<d;++a)if(r[a].name===t){r[a]=i;break}a===d&&r.push(i)}o.tween=r}}function Gx(e,t){var s=this._id;if(e+="",arguments.length<2){for(var n=us(this.node(),s).tween,r=0,o=n.length,c;r<o;++r)if((c=n[r]).name===e)return c.value;return null}return this.each((t==null?Kx:qx)(s,e,t))}function $h(e,t,s){var n=e._id;return e.each(function(){var r=ws(this,n);(r.value||(r.value={}))[t]=s.apply(this,arguments)}),function(r){return us(r,n).value[t]}}function j_(e,t){var s;return(typeof t=="number"?gs:t instanceof Mn?Ha:(s=Mn(t))?(t=s,Ha):D_)(e,t)}function Xx(e){return function(){this.removeAttribute(e)}}function Yx(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Qx(e,t,s){var n,r=s+"",o;return function(){var c=this.getAttribute(e);return c===r?null:c===n?o:o=t(n=c,s)}}function Zx(e,t,s){var n,r=s+"",o;return function(){var c=this.getAttributeNS(e.space,e.local);return c===r?null:c===n?o:o=t(n=c,s)}}function Jx(e,t,s){var n,r,o;return function(){var c,i=s(this),a;return i==null?void this.removeAttribute(e):(c=this.getAttribute(e),a=i+"",c===a?null:c===n&&a===r?o:(r=a,o=t(n=c,i)))}}function eC(e,t,s){var n,r,o;return function(){var c,i=s(this),a;return i==null?void this.removeAttributeNS(e.space,e.local):(c=this.getAttributeNS(e.space,e.local),a=i+"",c===a?null:c===n&&a===r?o:(r=a,o=t(n=c,i)))}}function tC(e,t){var s=pl(e),n=s==="transform"?Px:j_;return this.attrTween(e,typeof t=="function"?(s.local?eC:Jx)(s,n,$h(this,"attr."+e,t)):t==null?(s.local?Yx:Xx)(s):(s.local?Zx:Qx)(s,n,t))}function sC(e,t){return function(s){this.setAttribute(e,t.call(this,s))}}function nC(e,t){return function(s){this.setAttributeNS(e.space,e.local,t.call(this,s))}}function rC(e,t){var s,n;function r(){var o=t.apply(this,arguments);return o!==n&&(s=(n=o)&&nC(e,o)),s}return r._value=t,r}function iC(e,t){var s,n;function r(){var o=t.apply(this,arguments);return o!==n&&(s=(n=o)&&sC(e,o)),s}return r._value=t,r}function oC(e,t){var s="attr."+e;if(arguments.length<2)return(s=this.tween(s))&&s._value;if(t==null)return this.tween(s,null);if(typeof t!="function")throw new Error;var n=pl(e);return this.tween(s,(n.local?rC:iC)(n,t))}function aC(e,t){return function(){Oh(this,e).delay=+t.apply(this,arguments)}}function lC(e,t){return t=+t,function(){Oh(this,e).delay=t}}function cC(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?aC:lC)(t,e)):us(this.node(),t).delay}function uC(e,t){return function(){ws(this,e).duration=+t.apply(this,arguments)}}function hC(e,t){return t=+t,function(){ws(this,e).duration=t}}function dC(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?uC:hC)(t,e)):us(this.node(),t).duration}function fC(e,t){if(typeof t!="function")throw new Error;return function(){ws(this,e).ease=t}}function pC(e){var t=this._id;return arguments.length?this.each(fC(t,e)):us(this.node(),t).ease}function gC(e,t){return function(){var s=t.apply(this,arguments);if(typeof s!="function")throw new Error;ws(this,e).ease=s}}function mC(e){if(typeof e!="function")throw new Error;return this.each(gC(this._id,e))}function _C(e){typeof e!="function"&&(e=p_(e));for(var t=this._groups,s=t.length,n=new Array(s),r=0;r<s;++r)for(var o=t[r],c=o.length,i=n[r]=[],a,d=0;d<c;++d)(a=o[d])&&e.call(a,a.__data__,d,o)&&i.push(a);return new Ns(n,this._parents,this._name,this._id)}function vC(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,s=e._groups,n=t.length,r=s.length,o=Math.min(n,r),c=new Array(n),i=0;i<o;++i)for(var a=t[i],d=s[i],g=a.length,l=c[i]=new Array(g),m,v=0;v<g;++v)(m=a[v]||d[v])&&(l[v]=m);for(;i<n;++i)c[i]=t[i];return new Ns(c,this._parents,this._name,this._id)}function yC(e){return(e+"").trim().split(/^|\s+/).every(function(t){var s=t.indexOf(".");return s>=0&&(t=t.slice(0,s)),!t||t==="start"})}function wC(e,t,s){var n,r,o=yC(t)?Oh:ws;return function(){var c=o(this,e),i=c.on;i!==n&&(r=(n=i).copy()).on(t,s),c.on=r}}function SC(e,t){var s=this._id;return arguments.length<2?us(this.node(),s).on.on(e):this.each(wC(s,e,t))}function xC(e){return function(){var t=this.parentNode;for(var s in this.__transition)if(+s!==e)return;t&&t.removeChild(this)}}function CC(){return this.on("end.remove",xC(this._id))}function bC(e){var t=this._name,s=this._id;typeof e!="function"&&(e=Nh(e));for(var n=this._groups,r=n.length,o=new Array(r),c=0;c<r;++c)for(var i=n[c],a=i.length,d=o[c]=new Array(a),g,l,m=0;m<a;++m)(g=i[m])&&(l=e.call(g,g.__data__,m,i))&&("__data__"in g&&(l.__data__=g.__data__),d[m]=l,ml(d[m],t,s,m,d,us(g,s)));return new Ns(o,this._parents,t,s)}function EC(e){var t=this._name,s=this._id;typeof e!="function"&&(e=f_(e));for(var n=this._groups,r=n.length,o=[],c=[],i=0;i<r;++i)for(var a=n[i],d=a.length,g,l=0;l<d;++l)if(g=a[l]){for(var m=e.call(g,g.__data__,l,a),v,w=us(g,s),_=0,u=m.length;_<u;++_)(v=m[_])&&ml(v,t,s,_,m,w);o.push(m),c.push(g)}return new Ns(o,c,t,s)}var kC=Qi.prototype.constructor;function LC(){return new kC(this._groups,this._parents)}function MC(e,t){var s,n,r;return function(){var o=yr(this,e),c=(this.style.removeProperty(e),yr(this,e));return o===c?null:o===s&&c===n?r:r=t(s=o,n=c)}}function O_(e){return function(){this.style.removeProperty(e)}}function RC(e,t,s){var n,r=s+"",o;return function(){var c=yr(this,e);return c===r?null:c===n?o:o=t(n=c,s)}}function DC(e,t,s){var n,r,o;return function(){var c=yr(this,e),i=s(this),a=i+"";return i==null&&(a=i=(this.style.removeProperty(e),yr(this,e))),c===a?null:c===n&&a===r?o:(r=a,o=t(n=c,i))}}function AC(e,t){var s,n,r,o="style."+t,c="end."+o,i;return function(){var a=ws(this,e),d=a.on,g=a.value[o]==null?i||(i=O_(t)):void 0;(d!==s||r!==g)&&(n=(s=d).copy()).on(c,r=g),a.on=n}}function TC(e,t,s){var n=(e+="")=="transform"?Nx:j_;return t==null?this.styleTween(e,MC(e,n)).on("end.style."+e,O_(e)):typeof t=="function"?this.styleTween(e,DC(e,n,$h(this,"style."+e,t))).each(AC(this._id,e)):this.styleTween(e,RC(e,n,t),s).on("end.style."+e,null)}function NC(e,t,s){return function(n){this.style.setProperty(e,t.call(this,n),s)}}function PC(e,t,s){var n,r;function o(){var c=t.apply(this,arguments);return c!==r&&(n=(r=c)&&NC(e,c,s)),n}return o._value=t,o}function IC(e,t,s){var n="style."+(e+="");if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;return this.tween(n,PC(e,t,s??""))}function BC(e){return function(){this.textContent=e}}function jC(e){return function(){var t=e(this);this.textContent=t??""}}function OC(e){return this.tween("text",typeof e=="function"?jC($h(this,"text",e)):BC(e==null?"":e+""))}function $C(e){return function(t){this.textContent=e.call(this,t)}}function FC(e){var t,s;function n(){var r=e.apply(this,arguments);return r!==s&&(t=(s=r)&&$C(r)),t}return n._value=e,n}function HC(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,FC(e))}function zC(){for(var e=this._name,t=this._id,s=$_(),n=this._groups,r=n.length,o=0;o<r;++o)for(var c=n[o],i=c.length,a,d=0;d<i;++d)if(a=c[d]){var g=us(a,t);ml(a,e,s,d,c,{time:g.time+g.delay+g.duration,delay:0,duration:g.duration,ease:g.ease})}return new Ns(n,this._parents,e,s)}function WC(){var e,t,s=this,n=s._id,r=s.size();return new Promise(function(o,c){var i={value:c},a={value:function(){--r===0&&o()}};s.each(function(){var d=ws(this,n),g=d.on;g!==e&&(t=(e=g).copy(),t._.cancel.push(i),t._.interrupt.push(i),t._.end.push(a)),d.on=t}),r===0&&o()})}var UC=0;function Ns(e,t,s,n){this._groups=e,this._parents=t,this._name=s,this._id=n}function $_(){return++UC}var Ss=Qi.prototype;Ns.prototype={constructor:Ns,select:bC,selectAll:EC,selectChild:Ss.selectChild,selectChildren:Ss.selectChildren,filter:_C,merge:vC,selection:LC,transition:zC,call:Ss.call,nodes:Ss.nodes,node:Ss.node,size:Ss.size,empty:Ss.empty,each:Ss.each,on:SC,attr:tC,attrTween:oC,style:TC,styleTween:IC,text:OC,textTween:HC,remove:CC,tween:Gx,delay:cC,duration:dC,ease:pC,easeVarying:mC,end:WC,[Symbol.iterator]:Ss[Symbol.iterator]};function VC(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var KC={time:null,delay:0,duration:250,ease:VC};function qC(e,t){for(var s;!(s=e.__transition)||!(s=s[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return s}function GC(e){var t,s;e instanceof Ns?(t=e._id,e=e._name):(t=$_(),(s=KC).time=jh(),e=e==null?null:e+"");for(var n=this._groups,r=n.length,o=0;o<r;++o)for(var c=n[o],i=c.length,a,d=0;d<i;++d)(a=c[d])&&ml(a,e,t,d,c,s||qC(a,t));return new Ns(n,this._parents,e,t)}Qi.prototype.interrupt=Vx;Qi.prototype.transition=GC;const Ho=e=>()=>e;function XC(e,{sourceEvent:t,target:s,transform:n,dispatch:r}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:s,enumerable:!0,configurable:!0},transform:{value:n,enumerable:!0,configurable:!0},_:{value:r}})}function Ls(e,t,s){this.k=e,this.x=t,this.y=s}Ls.prototype={constructor:Ls,scale:function(e){return e===1?this:new Ls(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Ls(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var _l=new Ls(1,0,0);F_.prototype=Ls.prototype;function F_(e){for(;!e.__zoom;)if(!(e=e.parentNode))return _l;return e.__zoom}function dc(e){e.stopImmediatePropagation()}function qr(e){e.preventDefault(),e.stopImmediatePropagation()}function YC(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function QC(){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 Pf(){return this.__zoom||_l}function ZC(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function JC(){return navigator.maxTouchPoints||"ontouchstart"in this}function eb(e,t,s){var n=e.invertX(t[0][0])-s[0][0],r=e.invertX(t[1][0])-s[1][0],o=e.invertY(t[0][1])-s[0][1],c=e.invertY(t[1][1])-s[1][1];return e.translate(r>n?(n+r)/2:Math.min(0,n)||Math.max(0,r),c>o?(o+c)/2:Math.min(0,o)||Math.max(0,c))}function H_(){var e=YC,t=QC,s=eb,n=ZC,r=JC,o=[0,1/0],c=[[-1/0,-1/0],[1/0,1/0]],i=250,a=la,d=fl("start","zoom","end"),g,l,m,v=500,w=150,_=0,u=10;function f(A){A.property("__zoom",Pf).on("wheel.zoom",x,{passive:!1}).on("mousedown.zoom",k).on("dblclick.zoom",M).filter(r).on("touchstart.zoom",D).on("touchmove.zoom",R).on("touchend.zoom touchcancel.zoom",N).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}f.transform=function(A,$,F,H){var I=A.selection?A.selection():A;I.property("__zoom",Pf),A!==I?b(A,$,F,H):I.interrupt().each(function(){C(this,arguments).event(H).start().zoom(null,typeof $=="function"?$.apply(this,arguments):$).end()})},f.scaleBy=function(A,$,F,H){f.scaleTo(A,function(){var I=this.__zoom.k,L=typeof $=="function"?$.apply(this,arguments):$;return I*L},F,H)},f.scaleTo=function(A,$,F,H){f.transform(A,function(){var I=t.apply(this,arguments),L=this.__zoom,T=F==null?y(I):typeof F=="function"?F.apply(this,arguments):F,j=L.invert(T),O=typeof $=="function"?$.apply(this,arguments):$;return s(h(p(L,O),T,j),I,c)},F,H)},f.translateBy=function(A,$,F,H){f.transform(A,function(){return s(this.__zoom.translate(typeof $=="function"?$.apply(this,arguments):$,typeof F=="function"?F.apply(this,arguments):F),t.apply(this,arguments),c)},null,H)},f.translateTo=function(A,$,F,H,I){f.transform(A,function(){var L=t.apply(this,arguments),T=this.__zoom,j=H==null?y(L):typeof H=="function"?H.apply(this,arguments):H;return s(_l.translate(j[0],j[1]).scale(T.k).translate(typeof $=="function"?-$.apply(this,arguments):-$,typeof F=="function"?-F.apply(this,arguments):-F),L,c)},H,I)};function p(A,$){return $=Math.max(o[0],Math.min(o[1],$)),$===A.k?A:new Ls($,A.x,A.y)}function h(A,$,F){var H=$[0]-F[0]*A.k,I=$[1]-F[1]*A.k;return H===A.x&&I===A.y?A:new Ls(A.k,H,I)}function y(A){return[(+A[0][0]+ +A[1][0])/2,(+A[0][1]+ +A[1][1])/2]}function b(A,$,F,H){A.on("start.zoom",function(){C(this,arguments).event(H).start()}).on("interrupt.zoom end.zoom",function(){C(this,arguments).event(H).end()}).tween("zoom",function(){var I=this,L=arguments,T=C(I,L).event(H),j=t.apply(I,L),O=F==null?y(j):typeof F=="function"?F.apply(I,L):F,V=Math.max(j[1][0]-j[0][0],j[1][1]-j[0][1]),q=I.__zoom,J=typeof $=="function"?$.apply(I,L):$,Q=a(q.invert(O).concat(V/q.k),J.invert(O).concat(V/J.k));return function(z){if(z===1)z=J;else{var P=Q(z),K=V/P[2];z=new Ls(K,O[0]-P[0]*K,O[1]-P[1]*K)}T.zoom(null,z)}})}function C(A,$,F){return!F&&A.__zooming||new E(A,$)}function E(A,$){this.that=A,this.args=$,this.active=0,this.sourceEvent=null,this.extent=t.apply(A,$),this.taps=0}E.prototype={event:function(A){return A&&(this.sourceEvent=A),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(A,$){return this.mouse&&A!=="mouse"&&(this.mouse[1]=$.invert(this.mouse[0])),this.touch0&&A!=="touch"&&(this.touch0[1]=$.invert(this.touch0[0])),this.touch1&&A!=="touch"&&(this.touch1[1]=$.invert(this.touch1[0])),this.that.__zoom=$,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(A){var $=jt(this.that).datum();d.call(A,this.that,new XC(A,{sourceEvent:this.sourceEvent,target:f,transform:this.that.__zoom,dispatch:d}),$)}};function x(A,...$){if(!e.apply(this,arguments))return;var F=C(this,$).event(A),H=this.__zoom,I=Math.max(o[0],Math.min(o[1],H.k*Math.pow(2,n.apply(this,arguments)))),L=ts(A);if(F.wheel)(F.mouse[0][0]!==L[0]||F.mouse[0][1]!==L[1])&&(F.mouse[1]=H.invert(F.mouse[0]=L)),clearTimeout(F.wheel);else{if(H.k===I)return;F.mouse=[L,H.invert(L)],ha(this),F.start()}qr(A),F.wheel=setTimeout(T,w),F.zoom("mouse",s(h(p(H,I),F.mouse[0],F.mouse[1]),F.extent,c));function T(){F.wheel=null,F.end()}}function k(A,...$){if(m||!e.apply(this,arguments))return;var F=A.currentTarget,H=C(this,$,!0).event(A),I=jt(A.view).on("mousemove.zoom",O,!0).on("mouseup.zoom",V,!0),L=ts(A,F),T=A.clientX,j=A.clientY;b_(A.view),dc(A),H.mouse=[L,this.__zoom.invert(L)],ha(this),H.start();function O(q){if(qr(q),!H.moved){var J=q.clientX-T,Q=q.clientY-j;H.moved=J*J+Q*Q>_}H.event(q).zoom("mouse",s(h(H.that.__zoom,H.mouse[0]=ts(q,F),H.mouse[1]),H.extent,c))}function V(q){I.on("mousemove.zoom mouseup.zoom",null),E_(q.view,H.moved),qr(q),H.event(q).end()}}function M(A,...$){if(e.apply(this,arguments)){var F=this.__zoom,H=ts(A.changedTouches?A.changedTouches[0]:A,this),I=F.invert(H),L=F.k*(A.shiftKey?.5:2),T=s(h(p(F,L),H,I),t.apply(this,$),c);qr(A),i>0?jt(this).transition().duration(i).call(b,T,H,A):jt(this).call(f.transform,T,H,A)}}function D(A,...$){if(e.apply(this,arguments)){var F=A.touches,H=F.length,I=C(this,$,A.changedTouches.length===H).event(A),L,T,j,O;for(dc(A),T=0;T<H;++T)j=F[T],O=ts(j,this),O=[O,this.__zoom.invert(O),j.identifier],I.touch0?!I.touch1&&I.touch0[2]!==O[2]&&(I.touch1=O,I.taps=0):(I.touch0=O,L=!0,I.taps=1+!!g);g&&(g=clearTimeout(g)),L&&(I.taps<2&&(l=O[0],g=setTimeout(function(){g=null},v)),ha(this),I.start())}}function R(A,...$){if(this.__zooming){var F=C(this,$).event(A),H=A.changedTouches,I=H.length,L,T,j,O;for(qr(A),L=0;L<I;++L)T=H[L],j=ts(T,this),F.touch0&&F.touch0[2]===T.identifier?F.touch0[0]=j:F.touch1&&F.touch1[2]===T.identifier&&(F.touch1[0]=j);if(T=F.that.__zoom,F.touch1){var V=F.touch0[0],q=F.touch0[1],J=F.touch1[0],Q=F.touch1[1],z=(z=J[0]-V[0])*z+(z=J[1]-V[1])*z,P=(P=Q[0]-q[0])*P+(P=Q[1]-q[1])*P;T=p(T,Math.sqrt(z/P)),j=[(V[0]+J[0])/2,(V[1]+J[1])/2],O=[(q[0]+Q[0])/2,(q[1]+Q[1])/2]}else if(F.touch0)j=F.touch0[0],O=F.touch0[1];else return;F.zoom("touch",s(h(T,j,O),F.extent,c))}}function N(A,...$){if(this.__zooming){var F=C(this,$).event(A),H=A.changedTouches,I=H.length,L,T;for(dc(A),m&&clearTimeout(m),m=setTimeout(function(){m=null},v),L=0;L<I;++L)T=H[L],F.touch0&&F.touch0[2]===T.identifier?delete F.touch0:F.touch1&&F.touch1[2]===T.identifier&&delete F.touch1;if(F.touch1&&!F.touch0&&(F.touch0=F.touch1,delete F.touch1),F.touch0)F.touch0[1]=this.__zoom.invert(F.touch0[0]);else if(F.end(),F.taps===2&&(T=ts(T,this),Math.hypot(l[0]-T[0],l[1]-T[1])<u)){var j=jt(this).on("dblclick.zoom");j&&j.apply(this,arguments)}}}return f.wheelDelta=function(A){return arguments.length?(n=typeof A=="function"?A:Ho(+A),f):n},f.filter=function(A){return arguments.length?(e=typeof A=="function"?A:Ho(!!A),f):e},f.touchable=function(A){return arguments.length?(r=typeof A=="function"?A:Ho(!!A),f):r},f.extent=function(A){return arguments.length?(t=typeof A=="function"?A:Ho([[+A[0][0],+A[0][1]],[+A[1][0],+A[1][1]]]),f):t},f.scaleExtent=function(A){return arguments.length?(o[0]=+A[0],o[1]=+A[1],f):[o[0],o[1]]},f.translateExtent=function(A){return arguments.length?(c[0][0]=+A[0][0],c[1][0]=+A[1][0],c[0][1]=+A[0][1],c[1][1]=+A[1][1],f):[[c[0][0],c[0][1]],[c[1][0],c[1][1]]]},f.constrain=function(A){return arguments.length?(s=A,f):s},f.duration=function(A){return arguments.length?(i=+A,f):i},f.interpolate=function(A){return arguments.length?(a=A,f):a},f.on=function(){var A=d.on.apply(d,arguments);return A===d?f:A},f.clickDistance=function(A){return arguments.length?(_=(A=+A)*A,f):Math.sqrt(_)},f.tapDistance=function(A){return arguments.length?(u=+A,f):u},f}const cs={error001:(e="react")=>`Seems like you have not used zustand provider as an ancestor. Help: https://${e}flow.dev/error#001`,error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:s,targetHandle:n})=>`Couldn't create edge for ${e} handle id: "${e==="source"?s:n}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.",error016:e=>`Edge with id "${e}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`},Bi=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],z_=["Enter"," ","Escape"],W_={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:s})=>`Moved selected node ${e}. New position, x: ${t}, y: ${s}`,"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 Sr;(function(e){e.Strict="strict",e.Loose="loose"})(Sr||(Sr={}));var xn;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(xn||(xn={}));var ji;(function(e){e.Partial="partial",e.Full="full"})(ji||(ji={}));const U_={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Vs;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Vs||(Vs={}));var Oi;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Oi||(Oi={}));var we;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(we||(we={}));const If={[we.Left]:we.Right,[we.Right]:we.Left,[we.Top]:we.Bottom,[we.Bottom]:we.Top};function V_(e){return e===null?null:e?"valid":"invalid"}const K_=e=>"id"in e&&"source"in e&&"target"in e,tb=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),Fh=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),Ji=(e,t=[0,0])=>{const{width:s,height:n}=Bs(e),r=e.origin??t,o=s*r[0],c=n*r[1];return{x:e.position.x-o,y:e.position.y-c}},sb=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const s=e.reduce((n,r)=>{const o=typeof r=="string";let c=!t.nodeLookup&&!o?r:void 0;t.nodeLookup&&(c=o?t.nodeLookup.get(r):Fh(r)?r:t.nodeLookup.get(r.id));const i=c?Va(c,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return vl(n,i)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return yl(s)},eo=(e,t={})=>{let s={x:1/0,y:1/0,x2:-1/0,y2:-1/0},n=!1;return e.forEach(r=>{(t.filter===void 0||t.filter(r))&&(s=vl(s,Va(r)),n=!0)}),n?yl(s):{x:0,y:0,width:0,height:0}},Hh=(e,t,[s,n,r]=[0,0,1],o=!1,c=!1)=>{const i={...Ar(t,[s,n,r]),width:t.width/r,height:t.height/r},a=[];for(const d of e.values()){const{measured:g,selectable:l=!0,hidden:m=!1}=d;if(c&&!l||m)continue;const v=g.width??d.width??d.initialWidth??null,w=g.height??d.height??d.initialHeight??null,_=$i(i,Cr(d)),u=(v??0)*(w??0),f=o&&_>0;(!d.internals.handleBounds||f||_>=u||d.dragging)&&a.push(d)}return a},nb=(e,t)=>{const s=new Set;return e.forEach(n=>{s.add(n.id)}),t.filter(n=>s.has(n.source)||s.has(n.target))};function rb(e,t){const s=new Map,n=t!=null&&t.nodes?new Set(t.nodes.map(r=>r.id)):null;return e.forEach(r=>{r.measured.width&&r.measured.height&&((t==null?void 0:t.includeHiddenNodes)||!r.hidden)&&(!n||n.has(r.id))&&s.set(r.id,r)}),s}async function ib({nodes:e,width:t,height:s,panZoom:n,minZoom:r,maxZoom:o},c){if(e.size===0)return!0;const i=rb(e,c),a=eo(i),d=Wh(a,t,s,(c==null?void 0:c.minZoom)??r,(c==null?void 0:c.maxZoom)??o,(c==null?void 0:c.padding)??.1);return await n.setViewport(d,{duration:c==null?void 0:c.duration,ease:c==null?void 0:c.ease,interpolate:c==null?void 0:c.interpolate}),!0}function q_({nodeId:e,nextPosition:t,nodeLookup:s,nodeOrigin:n=[0,0],nodeExtent:r,onError:o}){const c=s.get(e),i=c.parentId?s.get(c.parentId):void 0,{x:a,y:d}=i?i.internals.positionAbsolute:{x:0,y:0},g=c.origin??n;let l=c.extent||r;if(c.extent==="parent"&&!c.expandParent)if(!i)o==null||o("005",cs.error005());else{const v=i.measured.width,w=i.measured.height;v&&w&&(l=[[a,d],[a+v,d+w]])}else i&&An(c.extent)&&(l=[[c.extent[0][0]+a,c.extent[0][1]+d],[c.extent[1][0]+a,c.extent[1][1]+d]]);const m=An(l)?Dn(t,l,c.measured):t;return(c.measured.width===void 0||c.measured.height===void 0)&&(o==null||o("015",cs.error015())),{position:{x:m.x-a+(c.measured.width??0)*g[0],y:m.y-d+(c.measured.height??0)*g[1]},positionAbsolute:m}}async function ob({nodesToRemove:e=[],edgesToRemove:t=[],nodes:s,edges:n,onBeforeDelete:r}){const o=new Set(e.map(m=>m.id)),c=[];for(const m of s){if(m.deletable===!1)continue;const v=o.has(m.id),w=!v&&m.parentId&&c.find(_=>_.id===m.parentId);(v||w)&&c.push(m)}const i=new Set(t.map(m=>m.id)),a=n.filter(m=>m.deletable!==!1),g=nb(c,a);for(const m of a)i.has(m.id)&&!g.find(w=>w.id===m.id)&&g.push(m);if(!r)return{edges:g,nodes:c};const l=await r({nodes:c,edges:g});return typeof l=="boolean"?l?{edges:g,nodes:c}:{edges:[],nodes:[]}:l}const xr=(e,t=0,s=1)=>Math.min(Math.max(e,t),s),Dn=(e={x:0,y:0},t,s)=>({x:xr(e.x,t[0][0],t[1][0]-((s==null?void 0:s.width)??0)),y:xr(e.y,t[0][1],t[1][1]-((s==null?void 0:s.height)??0))});function G_(e,t,s){const{width:n,height:r}=Bs(s),{x:o,y:c}=s.internals.positionAbsolute;return Dn(e,[[o,c],[o+n,c+r]],t)}const Bf=(e,t,s)=>e<t?xr(Math.abs(e-t),1,t)/t:e>s?-xr(Math.abs(e-s),1,t)/t:0,zh=(e,t,s=15,n=40)=>{const r=Bf(e.x,n,t.width-n)*s,o=Bf(e.y,n,t.height-n)*s;return[r,o]},vl=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),Ru=({x:e,y:t,width:s,height:n})=>({x:e,y:t,x2:e+s,y2:t+n}),yl=({x:e,y:t,x2:s,y2:n})=>({x:e,y:t,width:s-e,height:n-t}),Cr=(e,t=[0,0])=>{var r,o;const{x:s,y:n}=Fh(e)?e.internals.positionAbsolute:Ji(e,t);return{x:s,y:n,width:((r=e.measured)==null?void 0:r.width)??e.width??e.initialWidth??0,height:((o=e.measured)==null?void 0:o.height)??e.height??e.initialHeight??0}},Va=(e,t=[0,0])=>{var r,o;const{x:s,y:n}=Fh(e)?e.internals.positionAbsolute:Ji(e,t);return{x:s,y:n,x2:s+(((r=e.measured)==null?void 0:r.width)??e.width??e.initialWidth??0),y2:n+(((o=e.measured)==null?void 0:o.height)??e.height??e.initialHeight??0)}},X_=(e,t)=>yl(vl(Ru(e),Ru(t))),$i=(e,t)=>{const s=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),n=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(s*n)},jf=e=>rs(e.width)&&rs(e.height)&&rs(e.x)&&rs(e.y),rs=e=>!isNaN(e)&&isFinite(e),Y_=(e,t)=>(s,n)=>{},to=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Ar=({x:e,y:t},[s,n,r],o=!1,c=[1,1])=>{const i={x:(e-s)/r,y:(t-n)/r};return o?to(i,c):i},br=({x:e,y:t},[s,n,r])=>({x:e*r+s,y:t*r+n});function zn(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const s=parseFloat(e);if(!Number.isNaN(s))return Math.floor(s)}if(typeof e=="string"&&e.endsWith("%")){const s=parseFloat(e);if(!Number.isNaN(s))return Math.floor(t*s*.01)}return console.error(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function ab(e,t,s){if(typeof e=="string"||typeof e=="number"){const n=zn(e,s),r=zn(e,t);return{top:n,right:r,bottom:n,left:r,x:r*2,y:n*2}}if(typeof e=="object"){const n=zn(e.top??e.y??0,s),r=zn(e.bottom??e.y??0,s),o=zn(e.left??e.x??0,t),c=zn(e.right??e.x??0,t);return{top:n,right:c,bottom:r,left:o,x:o+c,y:n+r}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function lb(e,t,s,n,r,o){const{x:c,y:i}=br(e,[t,s,n]),{x:a,y:d}=br({x:e.x+e.width,y:e.y+e.height},[t,s,n]),g=r-a,l=o-d;return{left:Math.floor(c),top:Math.floor(i),right:Math.floor(g),bottom:Math.floor(l)}}const Wh=(e,t,s,n,r,o)=>{const c=ab(o,t,s),i=(t-c.x)/e.width,a=(s-c.y)/e.height,d=Math.min(i,a),g=xr(d,n,r),l=e.x+e.width/2,m=e.y+e.height/2,v=t/2-l*g,w=s/2-m*g,_=lb(e,v,w,g,t,s),u={left:Math.min(_.left-c.left,0),top:Math.min(_.top-c.top,0),right:Math.min(_.right-c.right,0),bottom:Math.min(_.bottom-c.bottom,0)};return{x:v-u.left+u.right,y:w-u.top+u.bottom,zoom:g}},Fi=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function An(e){return e!=null&&e!=="parent"}function Bs(e){var t,s;return{width:((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth??0,height:((s=e.measured)==null?void 0:s.height)??e.height??e.initialHeight??0}}function Q_(e){var t,s;return(((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth)!==void 0&&(((s=e.measured)==null?void 0:s.height)??e.height??e.initialHeight)!==void 0}function Z_(e,t={width:0,height:0},s,n,r){const o={...e},c=n.get(s);if(c){const i=c.origin||r;o.x+=c.internals.positionAbsolute.x-(t.width??0)*i[0],o.y+=c.internals.positionAbsolute.y-(t.height??0)*i[1]}return o}function Of(e,t){if(e.size!==t.size)return!1;for(const s of e)if(!t.has(s))return!1;return!0}function cb(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}function ub(e){return{...W_,...e||{}}}function pi(e,{snapGrid:t=[0,0],snapToGrid:s=!1,transform:n,containerBounds:r}){const{x:o,y:c}=is(e),i=Ar({x:o-((r==null?void 0:r.left)??0),y:c-((r==null?void 0:r.top)??0)},n),{x:a,y:d}=s?to(i,t):i;return{xSnapped:a,ySnapped:d,...i}}const Uh=e=>({width:e.offsetWidth,height:e.offsetHeight}),J_=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},hb=["INPUT","SELECT","TEXTAREA"];function ev(e){var n,r;const t=((r=(n=e.composedPath)==null?void 0:n.call(e))==null?void 0:r[0])||e.target;return(t==null?void 0:t.nodeType)!==1?!1:hb.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const tv=e=>"clientX"in e,is=(e,t)=>{var o,c;const s=tv(e),n=s?e.clientX:(o=e.touches)==null?void 0:o[0].clientX,r=s?e.clientY:(c=e.touches)==null?void 0:c[0].clientY;return{x:n-((t==null?void 0:t.left)??0),y:r-((t==null?void 0:t.top)??0)}},$f=(e,t,s,n,r)=>{const o=t.querySelectorAll(`.${e}`);return!o||!o.length?null:Array.from(o).map(c=>{const i=c.getBoundingClientRect();return{id:c.getAttribute("data-handleid"),type:e,nodeId:r,position:c.getAttribute("data-handlepos"),x:(i.left-s.left)/n,y:(i.top-s.top)/n,...Uh(c)}})};function sv({sourceX:e,sourceY:t,targetX:s,targetY:n,sourceControlX:r,sourceControlY:o,targetControlX:c,targetControlY:i}){const a=e*.125+r*.375+c*.375+s*.125,d=t*.125+o*.375+i*.375+n*.125,g=Math.abs(a-e),l=Math.abs(d-t);return[a,d,g,l]}function zo(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Ff({pos:e,x1:t,y1:s,x2:n,y2:r,c:o}){switch(e){case we.Left:return[t-zo(t-n,o),s];case we.Right:return[t+zo(n-t,o),s];case we.Top:return[t,s-zo(s-r,o)];case we.Bottom:return[t,s+zo(r-s,o)]}}function nv({sourceX:e,sourceY:t,sourcePosition:s=we.Bottom,targetX:n,targetY:r,targetPosition:o=we.Top,curvature:c=.25}){const[i,a]=Ff({pos:s,x1:e,y1:t,x2:n,y2:r,c}),[d,g]=Ff({pos:o,x1:n,y1:r,x2:e,y2:t,c}),[l,m,v,w]=sv({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:i,sourceControlY:a,targetControlX:d,targetControlY:g});return[`M${e},${t} C${i},${a} ${d},${g} ${n},${r}`,l,m,v,w]}function rv({sourceX:e,sourceY:t,targetX:s,targetY:n}){const r=Math.abs(s-e)/2,o=s<e?s+r:s-r,c=Math.abs(n-t)/2,i=n<t?n+c:n-c;return[o,i,r,c]}function db({sourceNode:e,targetNode:t,selected:s=!1,zIndex:n=0,elevateOnSelect:r=!1,zIndexMode:o="basic"}){if(o==="manual")return n;const c=r&&s?n+1e3:n,i=Math.max(e.parentId||r&&e.selected?e.internals.z:0,t.parentId||r&&t.selected?t.internals.z:0);return c+i}function fb({sourceNode:e,targetNode:t,width:s,height:n,transform:r}){const o=vl(Va(e),Va(t));o.x===o.x2&&(o.x2+=1),o.y===o.y2&&(o.y2+=1);const c={x:-r[0]/r[2],y:-r[1]/r[2],width:s/r[2],height:n/r[2]};return $i(c,yl(o))>0}const pb=({source:e,sourceHandle:t,target:s,targetHandle:n})=>`xy-edge__${e}${t||""}-${s}${n||""}`,gb=(e,t)=>t.some(s=>s.source===e.source&&s.target===e.target&&(s.sourceHandle===e.sourceHandle||!s.sourceHandle&&!e.sourceHandle)&&(s.targetHandle===e.targetHandle||!s.targetHandle&&!e.targetHandle)),mb=(e,t,s={})=>{var o;if(!e.source||!e.target)return(o=s.onError)==null||o.call(s,"006",cs.error006()),t;const n=s.getEdgeId||pb;let r;return K_(e)?r={...e}:r={...e,id:n(e)},gb(r,t)?t:(r.sourceHandle===null&&delete r.sourceHandle,r.targetHandle===null&&delete r.targetHandle,t.concat(r))};function iv({sourceX:e,sourceY:t,targetX:s,targetY:n}){const[r,o,c,i]=rv({sourceX:e,sourceY:t,targetX:s,targetY:n});return[`M ${e},${t}L ${s},${n}`,r,o,c,i]}const Hf={[we.Left]:{x:-1,y:0},[we.Right]:{x:1,y:0},[we.Top]:{x:0,y:-1},[we.Bottom]:{x:0,y:1}},_b=({source:e,sourcePosition:t=we.Bottom,target:s})=>t===we.Left||t===we.Right?e.x<s.x?{x:1,y:0}:{x:-1,y:0}:e.y<s.y?{x:0,y:1}:{x:0,y:-1},zf=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function vb({source:e,sourcePosition:t=we.Bottom,target:s,targetPosition:n=we.Top,center:r,offset:o,stepPosition:c}){const i=Hf[t],a=Hf[n],d={x:e.x+i.x*o,y:e.y+i.y*o},g={x:s.x+a.x*o,y:s.y+a.y*o},l=_b({source:d,sourcePosition:t,target:g}),m=l.x!==0?"x":"y",v=l[m];let w=[],_,u;const f={x:0,y:0},p={x:0,y:0},[,,h,y]=rv({sourceX:e.x,sourceY:e.y,targetX:s.x,targetY:s.y});if(i[m]*a[m]===-1){m==="x"?(_=r.x??d.x+(g.x-d.x)*c,u=r.y??(d.y+g.y)/2):(_=r.x??(d.x+g.x)/2,u=r.y??d.y+(g.y-d.y)*c);const x=[{x:_,y:d.y},{x:_,y:g.y}],k=[{x:d.x,y:u},{x:g.x,y:u}];i[m]===v?w=m==="x"?x:k:w=m==="x"?k:x}else{const x=[{x:d.x,y:g.y}],k=[{x:g.x,y:d.y}];if(m==="x"?w=i.x===v?k:x:w=i.y===v?x:k,t===n){const A=Math.abs(e[m]-s[m]);if(A<=o){const $=Math.min(o-1,o-A);i[m]===v?f[m]=(d[m]>e[m]?-1:1)*$:p[m]=(g[m]>s[m]?-1:1)*$}}if(t!==n){const A=m==="x"?"y":"x",$=i[m]===a[A],F=d[A]>g[A],H=d[A]<g[A];(i[m]===1&&(!$&&F||$&&H)||i[m]!==1&&(!$&&H||$&&F))&&(w=m==="x"?x:k)}const M={x:d.x+f.x,y:d.y+f.y},D={x:g.x+p.x,y:g.y+p.y},R=Math.max(Math.abs(M.x-w[0].x),Math.abs(D.x-w[0].x)),N=Math.max(Math.abs(M.y-w[0].y),Math.abs(D.y-w[0].y));R>=N?(_=(M.x+D.x)/2,u=w[0].y):(_=w[0].x,u=(M.y+D.y)/2)}const b={x:d.x+f.x,y:d.y+f.y},C={x:g.x+p.x,y:g.y+p.y};return[[e,...b.x!==w[0].x||b.y!==w[0].y?[b]:[],...w,...C.x!==w[w.length-1].x||C.y!==w[w.length-1].y?[C]:[],s],_,u,h,y]}function yb(e,t,s,n){const r=Math.min(zf(e,t)/2,zf(t,s)/2,n),{x:o,y:c}=t;if(e.x===o&&o===s.x||e.y===c&&c===s.y)return`L${o} ${c}`;if(e.y===c){const d=e.x<s.x?-1:1,g=e.y<s.y?1:-1;return`L ${o+r*d},${c}Q ${o},${c} ${o},${c+r*g}`}const i=e.x<s.x?1:-1,a=e.y<s.y?-1:1;return`L ${o},${c+r*a}Q ${o},${c} ${o+r*i},${c}`}function Du({sourceX:e,sourceY:t,sourcePosition:s=we.Bottom,targetX:n,targetY:r,targetPosition:o=we.Top,borderRadius:c=5,centerX:i,centerY:a,offset:d=20,stepPosition:g=.5}){const[l,m,v,w,_]=vb({source:{x:e,y:t},sourcePosition:s,target:{x:n,y:r},targetPosition:o,center:{x:i,y:a},offset:d,stepPosition:g});let u=`M${l[0].x} ${l[0].y}`;for(let f=1;f<l.length-1;f++)u+=yb(l[f-1],l[f],l[f+1],c);return u+=`L${l[l.length-1].x} ${l[l.length-1].y}`,[u,m,v,w,_]}function Wf(e){var t;return e&&!!(e.internals.handleBounds||(t=e.handles)!=null&&t.length)&&!!(e.measured.width||e.width||e.initialWidth)}function wb(e){var l;const{sourceNode:t,targetNode:s}=e;if(!Wf(t)||!Wf(s))return null;const n=t.internals.handleBounds||Uf(t.handles),r=s.internals.handleBounds||Uf(s.handles),o=Vf((n==null?void 0:n.source)??[],e.sourceHandle),c=Vf(e.connectionMode===Sr.Strict?(r==null?void 0:r.target)??[]:((r==null?void 0:r.target)??[]).concat((r==null?void 0:r.source)??[]),e.targetHandle);if(!o||!c)return(l=e.onError)==null||l.call(e,"008",cs.error008(o?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const i=(o==null?void 0:o.position)||we.Bottom,a=(c==null?void 0:c.position)||we.Top,d=Tn(t,o,i),g=Tn(s,c,a);return{sourceX:d.x,sourceY:d.y,targetX:g.x,targetY:g.y,sourcePosition:i,targetPosition:a}}function Uf(e){if(!e)return null;const t=[],s=[];for(const n of e)n.width=n.width??1,n.height=n.height??1,n.type==="source"?t.push(n):n.type==="target"&&s.push(n);return{source:t,target:s}}function Tn(e,t,s=we.Left,n=!1){const r=((t==null?void 0:t.x)??0)+e.internals.positionAbsolute.x,o=((t==null?void 0:t.y)??0)+e.internals.positionAbsolute.y,{width:c,height:i}=t??Bs(e);if(n)return{x:r+c/2,y:o+i/2};switch((t==null?void 0:t.position)??s){case we.Top:return{x:r+c/2,y:o};case we.Right:return{x:r+c,y:o+i/2};case we.Bottom:return{x:r+c/2,y:o+i};case we.Left:return{x:r,y:o+i/2}}}function Vf(e,t){return e&&(t?e.find(s=>s.id===t):e[0])||null}function Au(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(n=>`${n}=${e[n]}`).join("&")}`:""}function Sb(e,{id:t,defaultColor:s,defaultMarkerStart:n,defaultMarkerEnd:r}){const o=new Set;return e.reduce((c,i)=>([i.markerStart||n,i.markerEnd||r].forEach(a=>{if(a&&typeof a=="object"){const d=Au(a,t);o.has(d)||(c.push({id:d,color:a.color||s,...a}),o.add(d))}}),c),[]).sort((c,i)=>c.id.localeCompare(i.id))}const ov=1e3,xb=10,Vh={nodeOrigin:[0,0],nodeExtent:Bi,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},Cb={...Vh,checkEquality:!0};function Kh(e,t){const s={...e};for(const n in t)t[n]!==void 0&&(s[n]=t[n]);return s}function bb(e,t,s){const n=Kh(Vh,s);for(const r of e.values())if(r.parentId)Gh(r,e,t,n);else{const o=Ji(r,n.nodeOrigin),c=An(r.extent)?r.extent:n.nodeExtent,i=Dn(o,c,Bs(r));r.internals.positionAbsolute=i}}function Eb(e,t){if(!e.handles)return e.measured?t==null?void 0:t.internals.handleBounds:void 0;const s=[],n=[];for(const r of e.handles){const o={id:r.id,width:r.width??1,height:r.height??1,nodeId:e.id,x:r.x,y:r.y,position:r.position,type:r.type};r.type==="source"?s.push(o):r.type==="target"&&n.push(o)}return{source:s,target:n}}function qh(e){return e==="manual"}function Tu(e,t,s,n={}){var g,l;const r=Kh(Cb,n),o={i:0},c=new Map(t),i=r!=null&&r.elevateNodesOnSelect&&!qh(r.zIndexMode)?ov:0;let a=e.length>0,d=!1;t.clear(),s.clear();for(const m of e){let v=c.get(m.id);if(r.checkEquality&&m===(v==null?void 0:v.internals.userNode))t.set(m.id,v);else{const w=Ji(m,r.nodeOrigin),_=An(m.extent)?m.extent:r.nodeExtent,u=Dn(w,_,Bs(m));v={...r.defaults,...m,measured:{width:(g=m.measured)==null?void 0:g.width,height:(l=m.measured)==null?void 0:l.height},internals:{positionAbsolute:u,handleBounds:Eb(m,v),z:av(m,i,r.zIndexMode),userNode:m}},t.set(m.id,v)}(v.measured===void 0||v.measured.width===void 0||v.measured.height===void 0)&&!v.hidden&&(a=!1),m.parentId&&Gh(v,t,s,n,o),d||(d=m.selected??!1)}return{nodesInitialized:a,hasSelectedNodes:d}}function kb(e,t){if(!e.parentId)return;const s=t.get(e.parentId);s?s.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function Gh(e,t,s,n,r){const{elevateNodesOnSelect:o,nodeOrigin:c,nodeExtent:i,zIndexMode:a}=Kh(Vh,n),d=e.parentId,g=t.get(d);if(!g){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}kb(e,s),r&&!g.parentId&&g.internals.rootParentIndex===void 0&&a==="auto"&&(g.internals.rootParentIndex=++r.i,g.internals.z=g.internals.z+r.i*xb),r&&g.internals.rootParentIndex!==void 0&&(r.i=g.internals.rootParentIndex);const l=o&&!qh(a)?ov:0,{x:m,y:v,z:w}=Lb(e,g,c,i,l,a),{positionAbsolute:_}=e.internals,u=m!==_.x||v!==_.y;(u||w!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:u?{x:m,y:v}:_,z:w}})}function av(e,t,s){const n=rs(e.zIndex)?e.zIndex:0;return qh(s)?n:n+(e.selected?t:0)}function Lb(e,t,s,n,r,o){const{x:c,y:i}=t.internals.positionAbsolute,a=Bs(e),d=Ji(e,s),g=An(e.extent)?Dn(d,e.extent,a):d;let l=Dn({x:c+g.x,y:i+g.y},n,a);e.extent==="parent"&&(l=G_(l,a,t));const m=av(e,r,o),v=t.internals.z??0;return{x:l.x,y:l.y,z:v>=m?v+1:m}}function Xh(e,t,s,n=[0,0]){var c;const r=[],o=new Map;for(const i of e){const a=t.get(i.parentId);if(!a)continue;const d=((c=o.get(i.parentId))==null?void 0:c.expandedRect)??Cr(a),g=X_(d,i.rect);o.set(i.parentId,{expandedRect:g,parent:a})}return o.size>0&&o.forEach(({expandedRect:i,parent:a},d)=>{var h;const g=a.internals.positionAbsolute,l=Bs(a),m=a.origin??n,v=i.x<g.x?Math.round(Math.abs(g.x-i.x)):0,w=i.y<g.y?Math.round(Math.abs(g.y-i.y)):0,_=Math.max(l.width,Math.round(i.width)),u=Math.max(l.height,Math.round(i.height)),f=(_-l.width)*m[0],p=(u-l.height)*m[1];(v>0||w>0||f||p)&&(r.push({id:d,type:"position",position:{x:a.position.x-v+f,y:a.position.y-w+p}}),(h=s.get(d))==null||h.forEach(y=>{e.some(b=>b.id===y.id)||r.push({id:y.id,type:"position",position:{x:y.position.x+v,y:y.position.y+w}})})),(l.width<i.width||l.height<i.height||v||w)&&r.push({id:d,type:"dimensions",setAttributes:!0,dimensions:{width:_+(v?m[0]*v-f:0),height:u+(w?m[1]*w-p:0)}})}),r}function Mb(e,t,s,n,r,o,c){const i=n==null?void 0:n.querySelector(".xyflow__viewport");let a=!1;if(!i)return{changes:[],updatedInternals:a};const d=[],g=window.getComputedStyle(i),{m22:l}=new window.DOMMatrixReadOnly(g.transform),m=[];for(const v of e.values()){const w=t.get(v.id);if(!w)continue;if(w.hidden){t.set(w.id,{...w,internals:{...w.internals,handleBounds:void 0}}),a=!0;continue}const _=Uh(v.nodeElement),u=w.measured.width!==_.width||w.measured.height!==_.height;if(!!(_.width&&_.height&&(u||!w.internals.handleBounds||v.force))){const p=v.nodeElement.getBoundingClientRect(),h=An(w.extent)?w.extent:o;let{positionAbsolute:y}=w.internals;w.parentId&&w.extent==="parent"?y=G_(y,_,t.get(w.parentId)):h&&(y=Dn(y,h,_));const b={...w,measured:_,internals:{...w.internals,positionAbsolute:y,handleBounds:{source:$f("source",v.nodeElement,p,l,w.id),target:$f("target",v.nodeElement,p,l,w.id)}}};t.set(w.id,b),w.parentId&&Gh(b,t,s,{nodeOrigin:r,zIndexMode:c}),a=!0,u&&(d.push({id:w.id,type:"dimensions",dimensions:_}),w.expandParent&&w.parentId&&m.push({id:w.id,parentId:w.parentId,rect:Cr(b,r)}))}}if(m.length>0){const v=Xh(m,t,s,r);d.push(...v)}return{changes:d,updatedInternals:a}}async function Rb({delta:e,panZoom:t,transform:s,translateExtent:n,width:r,height:o}){if(!t||!e.x&&!e.y)return!1;const c=await t.setViewportConstrained({x:s[0]+e.x,y:s[1]+e.y,zoom:s[2]},[[0,0],[r,o]],n);return!!c&&(c.x!==s[0]||c.y!==s[1]||c.k!==s[2])}function Kf(e,t,s,n,r,o){let c=r;const i=n.get(c)||new Map;n.set(c,i.set(s,t)),c=`${r}-${e}`;const a=n.get(c)||new Map;if(n.set(c,a.set(s,t)),o){c=`${r}-${e}-${o}`;const d=n.get(c)||new Map;n.set(c,d.set(s,t))}}function lv(e,t,s){e.clear(),t.clear();for(const n of s){const{source:r,target:o,sourceHandle:c=null,targetHandle:i=null}=n,a={edgeId:n.id,source:r,target:o,sourceHandle:c,targetHandle:i},d=`${r}-${c}--${o}-${i}`,g=`${o}-${i}--${r}-${c}`;Kf("source",a,g,e,r,c),Kf("target",a,d,e,o,i),t.set(n.id,n)}}function cv(e,t){if(!e.parentId)return!1;const s=t.get(e.parentId);return s?s.selected?!0:cv(s,t):!1}function qf(e,t,s){var r;let n=e;do{if((r=n==null?void 0:n.matches)!=null&&r.call(n,t))return!0;if(n===s)return!1;n=n==null?void 0:n.parentElement}while(n);return!1}function Db(e,t,s,n){const r=new Map;for(const[o,c]of e)if((c.selected||c.id===n)&&(!c.parentId||!cv(c,e))&&(c.draggable||t&&typeof c.draggable>"u")){const i=e.get(o);i&&r.set(o,{id:o,position:i.position||{x:0,y:0},distance:{x:s.x-i.internals.positionAbsolute.x,y:s.y-i.internals.positionAbsolute.y},extent:i.extent,parentId:i.parentId,origin:i.origin,expandParent:i.expandParent,internals:{positionAbsolute:i.internals.positionAbsolute||{x:0,y:0}},measured:{width:i.measured.width??0,height:i.measured.height??0}})}return r}function fc({nodeId:e,dragItems:t,nodeLookup:s,dragging:n=!0}){var c,i,a;const r=[];for(const[d,g]of t){const l=(c=s.get(d))==null?void 0:c.internals.userNode;l&&r.push({...l,position:g.position,dragging:n})}if(!e)return[r[0],r];const o=(i=s.get(e))==null?void 0:i.internals.userNode;return[o?{...o,position:((a=t.get(e))==null?void 0:a.position)||o.position,dragging:n}:r[0],r]}function Ab({dragItems:e,snapGrid:t,x:s,y:n}){const r=e.values().next().value;if(!r)return null;const o={x:s-r.distance.x,y:n-r.distance.y},c=to(o,t);return{x:c.x-o.x,y:c.y-o.y}}function Tb({onNodeMouseDown:e,getStoreItems:t,onDragStart:s,onDrag:n,onDragStop:r}){let o={x:null,y:null},c=0,i=new Map,a=!1,d={x:0,y:0},g=null,l=!1,m=null,v=!1,w=!1,_=null;function u({noDragClassName:p,handleSelector:h,domNode:y,isSelectable:b,nodeId:C,nodeClickDistance:E=0}){m=jt(y);function x({x:R,y:N}){const{nodeLookup:A,nodeExtent:$,snapGrid:F,snapToGrid:H,nodeOrigin:I,onNodeDrag:L,onSelectionDrag:T,onError:j,updateNodePositions:O}=t();o={x:R,y:N};let V=!1;const q=i.size>1,J=q&&$?Ru(eo(i)):null,Q=q&&H?Ab({dragItems:i,snapGrid:F,x:R,y:N}):null;for(const[z,P]of i){if(!A.has(z))continue;let K={x:R-P.distance.x,y:N-P.distance.y};H&&(K=Q?{x:Math.round(K.x+Q.x),y:Math.round(K.y+Q.y)}:to(K,F));let U=null;if(q&&$&&!P.extent&&J){const{positionAbsolute:ne}=P.internals,ie=ne.x-J.x+$[0][0],ce=ne.x+P.measured.width-J.x2+$[1][0],fe=ne.y-J.y+$[0][1],ae=ne.y+P.measured.height-J.y2+$[1][1];U=[[ie,fe],[ce,ae]]}const{position:Z,positionAbsolute:Y}=q_({nodeId:z,nextPosition:K,nodeLookup:A,nodeExtent:U||$,nodeOrigin:I,onError:j});V=V||P.position.x!==Z.x||P.position.y!==Z.y,P.position=Z,P.internals.positionAbsolute=Y}if(w=w||V,!!V&&(O(i,!0),_&&(n||L||!C&&T))){const[z,P]=fc({nodeId:C,dragItems:i,nodeLookup:A});n==null||n(_,i,z,P),L==null||L(_,z,P),C||T==null||T(_,P)}}async function k(){if(!g)return;const{transform:R,panBy:N,autoPanSpeed:A,autoPanOnNodeDrag:$}=t();if(!$){a=!1,cancelAnimationFrame(c);return}const[F,H]=zh(d,g,A);(F!==0||H!==0)&&(o.x=(o.x??0)-F/R[2],o.y=(o.y??0)-H/R[2],await N({x:F,y:H})&&x(o)),c=requestAnimationFrame(k)}function M(R){var q;const{nodeLookup:N,multiSelectionActive:A,nodesDraggable:$,transform:F,snapGrid:H,snapToGrid:I,selectNodesOnDrag:L,onNodeDragStart:T,onSelectionDragStart:j,unselectNodesAndEdges:O}=t();l=!0,(!L||!b)&&!A&&C&&((q=N.get(C))!=null&&q.selected||O()),b&&L&&C&&(e==null||e(C));const V=pi(R.sourceEvent,{transform:F,snapGrid:H,snapToGrid:I,containerBounds:g});if(o=V,i=Db(N,$,V,C),i.size>0&&(s||T||!C&&j)){const[J,Q]=fc({nodeId:C,dragItems:i,nodeLookup:N});s==null||s(R.sourceEvent,i,J,Q),T==null||T(R.sourceEvent,J,Q),C||j==null||j(R.sourceEvent,Q)}}const D=k_().clickDistance(E).on("start",R=>{const{domNode:N,nodeDragThreshold:A,transform:$,snapGrid:F,snapToGrid:H}=t();g=(N==null?void 0:N.getBoundingClientRect())||null,v=!1,w=!1,_=R.sourceEvent,A===0&&M(R),o=pi(R.sourceEvent,{transform:$,snapGrid:F,snapToGrid:H,containerBounds:g}),d=is(R.sourceEvent,g)}).on("drag",R=>{const{autoPanOnNodeDrag:N,transform:A,snapGrid:$,snapToGrid:F,nodeDragThreshold:H,nodeLookup:I}=t(),L=pi(R.sourceEvent,{transform:A,snapGrid:$,snapToGrid:F,containerBounds:g});if(_=R.sourceEvent,(R.sourceEvent.type==="touchmove"&&R.sourceEvent.touches.length>1||C&&!I.has(C))&&(v=!0),!v){if(!a&&N&&l&&(a=!0,k()),!l){const T=is(R.sourceEvent,g),j=T.x-d.x,O=T.y-d.y;Math.sqrt(j*j+O*O)>H&&M(R)}(o.x!==L.xSnapped||o.y!==L.ySnapped)&&i&&l&&(d=is(R.sourceEvent,g),x(L))}}).on("end",R=>{if(!l||v){v&&i.size>0&&t().updateNodePositions(i,!1);return}if(a=!1,l=!1,cancelAnimationFrame(c),i.size>0){const{nodeLookup:N,updateNodePositions:A,onNodeDragStop:$,onSelectionDragStop:F}=t();if(w&&(A(i,!1),w=!1),r||$||!C&&F){const[H,I]=fc({nodeId:C,dragItems:i,nodeLookup:N,dragging:!1});r==null||r(R.sourceEvent,i,H,I),$==null||$(R.sourceEvent,H,I),C||F==null||F(R.sourceEvent,I)}}}).filter(R=>{const N=R.target;return!R.button&&(!p||!qf(N,`.${p}`,y))&&(!h||qf(N,h,y))});m.call(D)}function f(){m==null||m.on(".drag",null)}return{update:u,destroy:f}}function Nb(e,t,s){const n=[],r={x:e.x-s,y:e.y-s,width:s*2,height:s*2};for(const o of t.values())$i(r,Cr(o))>0&&n.push(o);return n}const Pb=250;function Ib(e,t,s,n){var i,a;let r=[],o=1/0;const c=Nb(e,s,t+Pb);for(const d of c){const g=[...((i=d.internals.handleBounds)==null?void 0:i.source)??[],...((a=d.internals.handleBounds)==null?void 0:a.target)??[]];for(const l of g){if(n.nodeId===l.nodeId&&n.type===l.type&&n.id===l.id)continue;const{x:m,y:v}=Tn(d,l,l.position,!0),w=Math.sqrt(Math.pow(m-e.x,2)+Math.pow(v-e.y,2));w>t||(w<o?(r=[{...l,x:m,y:v}],o=w):w===o&&r.push({...l,x:m,y:v}))}}if(!r.length)return null;if(r.length>1){const d=n.type==="source"?"target":"source";return r.find(g=>g.type===d)??r[0]}return r[0]}function uv(e,t,s,n,r,o=!1){var d,g,l;const c=n.get(e);if(!c)return null;const i=r==="strict"?(d=c.internals.handleBounds)==null?void 0:d[t]:[...((g=c.internals.handleBounds)==null?void 0:g.source)??[],...((l=c.internals.handleBounds)==null?void 0:l.target)??[]],a=(s?i==null?void 0:i.find(m=>m.id===s):i==null?void 0:i[0])??null;return a&&o?{...a,...Tn(c,a,a.position,!0)}:a}function hv(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function Bb(e,t){let s=null;return t?s=!0:e&&!t&&(s=!1),s}const dv=()=>!0;function jb(e,{connectionMode:t,connectionRadius:s,handleId:n,nodeId:r,edgeUpdaterType:o,isTarget:c,domNode:i,nodeLookup:a,lib:d,autoPanOnConnect:g,flowId:l,panBy:m,cancelConnection:v,onConnectStart:w,onConnect:_,onConnectEnd:u,isValidConnection:f=dv,onReconnectEnd:p,updateConnection:h,getTransform:y,getFromHandle:b,autoPanSpeed:C,dragThreshold:E=1,handleDomNode:x}){const k=J_(e.target);let M=0,D;const{x:R,y:N}=is(e),A=hv(o,x),$=i==null?void 0:i.getBoundingClientRect();let F=!1;if(!$||!A)return;const H=uv(r,A,n,a,t);if(!H)return;let I=is(e,$),L=!1,T=null,j=!1,O=null;function V(){if(!g||!$)return;const[Z,Y]=zh(I,$,C);m({x:Z,y:Y}),M=requestAnimationFrame(V)}const q={...H,nodeId:r,type:A,position:H.position},J=a.get(r);let z={inProgress:!0,isValid:null,from:Tn(J,q,we.Left,!0),fromHandle:q,fromPosition:q.position,fromNode:J,to:I,toHandle:null,toPosition:If[q.position],toNode:null,pointer:I};function P(){F=!0,h(z),w==null||w(e,{nodeId:r,handleId:n,handleType:A})}E===0&&P();function K(Z){if(!F){const{x:ae,y:Pe}=is(Z),We=ae-R,ve=Pe-N;if(!(We*We+ve*ve>E*E))return;P()}if(!b()||!q){U(Z);return}const Y=y();I=is(Z,$),D=Ib(Ar(I,Y,!1,[1,1]),s,a,q),L||(V(),L=!0);const ne=fv(Z,{handle:D,connectionMode:t,fromNodeId:r,fromHandleId:n,fromType:c?"target":"source",isValidConnection:f,doc:k,lib:d,flowId:l,nodeLookup:a});O=ne.handleDomNode,T=ne.connection,j=Bb(!!D,ne.isValid);const ie=a.get(r),ce=ie?Tn(ie,q,we.Left,!0):z.from,fe={...z,from:ce,isValid:j,to:ne.toHandle&&j?br({x:ne.toHandle.x,y:ne.toHandle.y},Y):I,toHandle:ne.toHandle,toPosition:j&&ne.toHandle?ne.toHandle.position:If[q.position],toNode:ne.toHandle?a.get(ne.toHandle.nodeId):null,pointer:I};h(fe),z=fe}function U(Z){if(!("touches"in Z&&Z.touches.length>0)){if(F){(D||O)&&T&&j&&(_==null||_(T));const{inProgress:Y,...ne}=z,ie={...ne,toPosition:z.toHandle?z.toPosition:null};u==null||u(Z,ie),o&&(p==null||p(Z,ie))}v(),cancelAnimationFrame(M),L=!1,j=!1,T=null,O=null,k.removeEventListener("mousemove",K),k.removeEventListener("mouseup",U),k.removeEventListener("touchmove",K),k.removeEventListener("touchend",U)}}k.addEventListener("mousemove",K),k.addEventListener("mouseup",U),k.addEventListener("touchmove",K),k.addEventListener("touchend",U)}function fv(e,{handle:t,connectionMode:s,fromNodeId:n,fromHandleId:r,fromType:o,doc:c,lib:i,flowId:a,isValidConnection:d=dv,nodeLookup:g}){const l=o==="target",m=t?c.querySelector(`.${i}-flow__handle[data-id="${a}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:v,y:w}=is(e),_=c.elementFromPoint(v,w),u=_!=null&&_.classList.contains(`${i}-flow__handle`)?_:m,f={handleDomNode:u,isValid:!1,connection:null,toHandle:null};if(u){const p=hv(void 0,u),h=u.getAttribute("data-nodeid"),y=u.getAttribute("data-handleid"),b=u.classList.contains("connectable"),C=u.classList.contains("connectableend");if(!h||!p)return f;const E={source:l?h:n,sourceHandle:l?y:r,target:l?n:h,targetHandle:l?r:y};f.connection=E;const k=b&&C&&(s===Sr.Strict?l&&p==="source"||!l&&p==="target":h!==n||y!==r);f.isValid=k&&d(E),f.toHandle=uv(h,p,y,g,s,!0)}return f}const Nu={onPointerDown:jb,isValid:fv};function Ob({domNode:e,panZoom:t,getTransform:s,getViewScale:n}){const r=jt(e);function o({translateExtent:i,width:a,height:d,zoomStep:g=1,pannable:l=!0,zoomable:m=!0,inversePan:v=!1}){const w=h=>{if(h.sourceEvent.type!=="wheel"||!t)return;const y=s(),b=h.sourceEvent.ctrlKey&&Fi()?10:1,C=-h.sourceEvent.deltaY*(h.sourceEvent.deltaMode===1?.05:h.sourceEvent.deltaMode?1:.002)*g,E=y[2]*Math.pow(2,C*b);t.scaleTo(E)};let _=[0,0];const u=h=>{(h.sourceEvent.type==="mousedown"||h.sourceEvent.type==="touchstart")&&(_=[h.sourceEvent.clientX??h.sourceEvent.touches[0].clientX,h.sourceEvent.clientY??h.sourceEvent.touches[0].clientY])},f=h=>{const y=s();if(h.sourceEvent.type!=="mousemove"&&h.sourceEvent.type!=="touchmove"||!t)return;const b=[h.sourceEvent.clientX??h.sourceEvent.touches[0].clientX,h.sourceEvent.clientY??h.sourceEvent.touches[0].clientY],C=[b[0]-_[0],b[1]-_[1]];_=b;const E=n()*Math.max(y[2],Math.log(y[2]))*(v?-1:1),x={x:y[0]-C[0]*E,y:y[1]-C[1]*E},k=[[0,0],[a,d]];t.setViewportConstrained({x:x.x,y:x.y,zoom:y[2]},k,i)},p=H_().on("start",u).on("zoom",l?f:null).on("zoom.wheel",m?w:null);r.call(p,{})}function c(){r.on("zoom",null)}return{update:o,destroy:c,pointer:ts}}const wl=e=>({x:e.x,y:e.y,zoom:e.k}),pc=({x:e,y:t,zoom:s})=>_l.translate(e,t).scale(s),tr=(e,t)=>e.target.closest(`.${t}`),pv=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),$b=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,gc=(e,t=0,s=$b,n=()=>{})=>{const r=typeof t=="number"&&t>0;return r||n(),r?e.transition().duration(t).ease(s).on("end",n):e},gv=e=>{const t=e.ctrlKey&&Fi()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function Fb({zoomPanValues:e,noWheelClassName:t,d3Selection:s,d3Zoom:n,panOnScrollMode:r,panOnScrollSpeed:o,zoomOnPinch:c,onPanZoomStart:i,onPanZoom:a,onPanZoomEnd:d}){return g=>{if(tr(g,t))return g.ctrlKey&&g.preventDefault(),!1;g.preventDefault(),g.stopImmediatePropagation();const l=s.property("__zoom").k||1;if(g.ctrlKey&&c){const u=ts(g),f=gv(g),p=l*Math.pow(2,f);n.scaleTo(s,p,u,g);return}const m=g.deltaMode===1?20:1;let v=r===xn.Vertical?0:g.deltaX*m,w=r===xn.Horizontal?0:g.deltaY*m;!Fi()&&g.shiftKey&&r!==xn.Vertical&&(v=g.deltaY*m,w=0),n.translateBy(s,-(v/l)*o,-(w/l)*o,{internal:!0});const _=wl(s.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(a==null||a(g,_),e.panScrollTimeout=setTimeout(()=>{d==null||d(g,_),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,i==null||i(g,_))}}function Hb({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:s}){return function(n,r){const o=n.type==="wheel",c=!t&&o&&!n.ctrlKey,i=tr(n,e);if(n.ctrlKey&&o&&i&&n.preventDefault(),c||i)return null;n.preventDefault(),s.call(this,n,r)}}function zb({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:s}){return n=>{var o,c,i;if((o=n.sourceEvent)!=null&&o.internal)return;const r=wl(n.transform);e.mouseButton=((c=n.sourceEvent)==null?void 0:c.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=r,((i=n.sourceEvent)==null?void 0:i.type)==="mousedown"&&t(!0),s&&(s==null||s(n.sourceEvent,r))}}function Wb({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:s,onTransformChange:n,onPanZoom:r}){return o=>{var c,i;e.usedRightMouseButton=!!(s&&pv(t,e.mouseButton??0)),(c=o.sourceEvent)!=null&&c.sync||n([o.transform.x,o.transform.y,o.transform.k]),r&&!((i=o.sourceEvent)!=null&&i.internal)&&(r==null||r(o.sourceEvent,wl(o.transform)))}}function Ub({zoomPanValues:e,panOnDrag:t,panOnScroll:s,onDraggingChange:n,onPanZoomEnd:r,onPaneContextMenu:o}){return c=>{var i;if(!((i=c.sourceEvent)!=null&&i.internal)&&(e.isZoomingOrPanning=!1,o&&pv(t,e.mouseButton??0)&&!e.usedRightMouseButton&&c.sourceEvent&&o(c.sourceEvent),e.usedRightMouseButton=!1,n(!1),r)){const a=wl(c.transform);e.prevViewport=a,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{r==null||r(c.sourceEvent,a)},s?150:0)}}}function Vb({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:s,panOnDrag:n,panOnScroll:r,zoomOnDoubleClick:o,userSelectionActive:c,noWheelClassName:i,noPanClassName:a,lib:d,connectionInProgress:g}){return l=>{var u;const m=e||t,v=s&&l.ctrlKey,w=l.type==="wheel";if(l.button===1&&l.type==="mousedown"&&(tr(l,`${d}-flow__node`)||tr(l,`${d}-flow__edge`)))return!0;if(!n&&!m&&!r&&!o&&!s||c||g&&!w||tr(l,i)&&w||tr(l,a)&&(!w||r&&w&&!e)||!s&&l.ctrlKey&&w)return!1;if(!s&&l.type==="touchstart"&&((u=l.touches)==null?void 0:u.length)>1)return l.preventDefault(),!1;if(!m&&!r&&!v&&w||!n&&(l.type==="mousedown"||l.type==="touchstart")||Array.isArray(n)&&!n.includes(l.button)&&l.type==="mousedown")return!1;const _=Array.isArray(n)&&n.includes(l.button)||!l.button||l.button<=1;return(!l.ctrlKey||w)&&_}}function Kb({domNode:e,minZoom:t,maxZoom:s,translateExtent:n,viewport:r,onPanZoom:o,onPanZoomStart:c,onPanZoomEnd:i,onDraggingChange:a}){const d={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},g=e.getBoundingClientRect(),l=H_().scaleExtent([t,s]).translateExtent(n),m=jt(e).call(l);p({x:r.x,y:r.y,zoom:xr(r.zoom,t,s)},[[0,0],[g.width,g.height]],n);const v=m.on("wheel.zoom"),w=m.on("dblclick.zoom");l.wheelDelta(gv);async function _(D,R){return m?new Promise(N=>{l==null||l.interpolate((R==null?void 0:R.interpolate)==="linear"?fi:la).transform(gc(m,R==null?void 0:R.duration,R==null?void 0:R.ease,()=>N(!0)),D)}):!1}function u({noWheelClassName:D,noPanClassName:R,onPaneContextMenu:N,userSelectionActive:A,panOnScroll:$,panOnDrag:F,panOnScrollMode:H,panOnScrollSpeed:I,preventScrolling:L,zoomOnPinch:T,zoomOnScroll:j,zoomOnDoubleClick:O,zoomActivationKeyPressed:V,lib:q,onTransformChange:J,connectionInProgress:Q,paneClickDistance:z,selectionOnDrag:P}){A&&!d.isZoomingOrPanning&&f();const K=$&&!V&&!A;l.clickDistance(P?1/0:!rs(z)||z<0?0:z);const U=K?Fb({zoomPanValues:d,noWheelClassName:D,d3Selection:m,d3Zoom:l,panOnScrollMode:H,panOnScrollSpeed:I,zoomOnPinch:T,onPanZoomStart:c,onPanZoom:o,onPanZoomEnd:i}):Hb({noWheelClassName:D,preventScrolling:L,d3ZoomHandler:v});m.on("wheel.zoom",U,{passive:!1});const Z=zb({zoomPanValues:d,onDraggingChange:a,onPanZoomStart:c});l.on("start",Z);const Y=Wb({zoomPanValues:d,panOnDrag:F,onPaneContextMenu:!!N,onPanZoom:o,onTransformChange:J});l.on("zoom",Y);const ne=Ub({zoomPanValues:d,panOnDrag:F,panOnScroll:$,onPaneContextMenu:N,onPanZoomEnd:i,onDraggingChange:a});l.on("end",ne);const ie=Vb({zoomActivationKeyPressed:V,panOnDrag:F,zoomOnScroll:j,panOnScroll:$,zoomOnDoubleClick:O,zoomOnPinch:T,userSelectionActive:A,noPanClassName:R,noWheelClassName:D,lib:q,connectionInProgress:Q});l.filter(ie),O?m.on("dblclick.zoom",w):m.on("dblclick.zoom",null)}function f(){l.on("zoom",null)}async function p(D,R,N){const A=pc(D),$=l==null?void 0:l.constrain()(A,R,N);return $&&await _($),$}async function h(D,R){const N=pc(D);return await _(N,R),N}function y(D){if(m){const R=pc(D),N=m.property("__zoom");(N.k!==D.zoom||N.x!==D.x||N.y!==D.y)&&(l==null||l.transform(m,R,null,{sync:!0}))}}function b(){const D=m?F_(m.node()):{x:0,y:0,k:1};return{x:D.x,y:D.y,zoom:D.k}}async function C(D,R){return m?new Promise(N=>{l==null||l.interpolate((R==null?void 0:R.interpolate)==="linear"?fi:la).scaleTo(gc(m,R==null?void 0:R.duration,R==null?void 0:R.ease,()=>N(!0)),D)}):!1}async function E(D,R){return m?new Promise(N=>{l==null||l.interpolate((R==null?void 0:R.interpolate)==="linear"?fi:la).scaleBy(gc(m,R==null?void 0:R.duration,R==null?void 0:R.ease,()=>N(!0)),D)}):!1}function x(D){l==null||l.scaleExtent(D)}function k(D){l==null||l.translateExtent(D)}function M(D){const R=!rs(D)||D<0?0:D;l==null||l.clickDistance(R)}return{update:u,destroy:f,setViewport:h,setViewportConstrained:p,getViewport:b,scaleTo:C,scaleBy:E,setScaleExtent:x,setTranslateExtent:k,syncViewport:y,setClickDistance:M}}var Er;(function(e){e.Line="line",e.Handle="handle"})(Er||(Er={}));function qb({width:e,prevWidth:t,height:s,prevHeight:n,affectsX:r,affectsY:o}){const c=e-t,i=s-n,a=[c>0?1:c<0?-1:0,i>0?1:i<0?-1:0];return c&&r&&(a[0]=a[0]*-1),i&&o&&(a[1]=a[1]*-1),a}function Gf(e){const t=e.includes("right")||e.includes("left"),s=e.includes("bottom")||e.includes("top"),n=e.includes("left"),r=e.includes("top");return{isHorizontal:t,isVertical:s,affectsX:n,affectsY:r}}function $s(e,t){return Math.max(0,t-e)}function Fs(e,t){return Math.max(0,e-t)}function Wo(e,t,s){return Math.max(0,t-e,e-s)}function Xf(e,t){return e?!t:t}function Gb(e,t,s,n,r,o,c,i){let{affectsX:a,affectsY:d}=t;const{isHorizontal:g,isVertical:l}=t,m=g&&l,{xSnapped:v,ySnapped:w}=s,{minWidth:_,maxWidth:u,minHeight:f,maxHeight:p}=n,{x:h,y,width:b,height:C,aspectRatio:E}=e;let x=Math.floor(g?v-e.pointerX:0),k=Math.floor(l?w-e.pointerY:0);const M=b+(a?-x:x),D=C+(d?-k:k),R=-o[0]*b,N=-o[1]*C;let A=Wo(M,_,u),$=Wo(D,f,p);if(c){let I=0,L=0;a&&x<0?I=$s(h+x+R,c[0][0]):!a&&x>0&&(I=Fs(h+M+R,c[1][0])),d&&k<0?L=$s(y+k+N,c[0][1]):!d&&k>0&&(L=Fs(y+D+N,c[1][1])),A=Math.max(A,I),$=Math.max($,L)}if(i){let I=0,L=0;a&&x>0?I=Fs(h+x,i[0][0]):!a&&x<0&&(I=$s(h+M,i[1][0])),d&&k>0?L=Fs(y+k,i[0][1]):!d&&k<0&&(L=$s(y+D,i[1][1])),A=Math.max(A,I),$=Math.max($,L)}if(r){if(g){const I=Wo(M/E,f,p)*E;if(A=Math.max(A,I),c){let L=0;!a&&!d||a&&!d&&m?L=Fs(y+N+M/E,c[1][1])*E:L=$s(y+N+(a?x:-x)/E,c[0][1])*E,A=Math.max(A,L)}if(i){let L=0;!a&&!d||a&&!d&&m?L=$s(y+M/E,i[1][1])*E:L=Fs(y+(a?x:-x)/E,i[0][1])*E,A=Math.max(A,L)}}if(l){const I=Wo(D*E,_,u)/E;if($=Math.max($,I),c){let L=0;!a&&!d||d&&!a&&m?L=Fs(h+D*E+R,c[1][0])/E:L=$s(h+(d?k:-k)*E+R,c[0][0])/E,$=Math.max($,L)}if(i){let L=0;!a&&!d||d&&!a&&m?L=$s(h+D*E,i[1][0])/E:L=Fs(h+(d?k:-k)*E,i[0][0])/E,$=Math.max($,L)}}}k=k+(k<0?$:-$),x=x+(x<0?A:-A),r&&(m?M>D*E?k=(Xf(a,d)?-x:x)/E:x=(Xf(a,d)?-k:k)*E:g?(k=x/E,d=a):(x=k*E,a=d));const F=a?h+x:h,H=d?y+k:y;return{width:b+(a?-x:x),height:C+(d?-k:k),x:o[0]*x*(a?-1:1)+F,y:o[1]*k*(d?-1:1)+H}}const mv={width:0,height:0,x:0,y:0},Xb={...mv,pointerX:0,pointerY:0,aspectRatio:1};function Yb(e,t,s){const n=t.position.x+e.position.x,r=t.position.y+e.position.y,o=e.measured.width??0,c=e.measured.height??0,i=s[0]*o,a=s[1]*c;return[[n-i,r-a],[n+o-i,r+c-a]]}function Qb({domNode:e,nodeId:t,getStoreItems:s,onChange:n,onEnd:r}){const o=jt(e);let c={controlDirection:Gf("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function i({controlPosition:d,boundaries:g,keepAspectRatio:l,resizeDirection:m,onResizeStart:v,onResize:w,onResizeEnd:_,shouldResize:u}){let f={...mv},p={...Xb};c={boundaries:g,resizeDirection:m,keepAspectRatio:l,controlDirection:Gf(d)};let h,y=null,b=[],C,E,x,k=!1;const M=k_().on("start",D=>{const{nodeLookup:R,transform:N,snapGrid:A,snapToGrid:$,nodeOrigin:F,paneDomNode:H}=s();if(h=R.get(t),!h)return;y=(H==null?void 0:H.getBoundingClientRect())??null;const{xSnapped:I,ySnapped:L}=pi(D.sourceEvent,{transform:N,snapGrid:A,snapToGrid:$,containerBounds:y});f={width:h.measured.width??0,height:h.measured.height??0,x:h.position.x??0,y:h.position.y??0},p={...f,pointerX:I,pointerY:L,aspectRatio:f.width/f.height},C=void 0,E=An(h.extent)?h.extent:void 0,h.parentId&&(h.extent==="parent"||h.expandParent)&&(C=R.get(h.parentId)),C&&h.extent==="parent"&&(E=[[0,0],[C.measured.width,C.measured.height]]),b=[],x=void 0;for(const[T,j]of R)if(j.parentId===t&&(b.push({id:T,position:{...j.position},extent:j.extent}),j.extent==="parent"||j.expandParent)){const O=Yb(j,h,j.origin??F);x?x=[[Math.min(O[0][0],x[0][0]),Math.min(O[0][1],x[0][1])],[Math.max(O[1][0],x[1][0]),Math.max(O[1][1],x[1][1])]]:x=O}v==null||v(D,{...f})}).on("drag",D=>{const{transform:R,snapGrid:N,snapToGrid:A,nodeOrigin:$}=s(),F=pi(D.sourceEvent,{transform:R,snapGrid:N,snapToGrid:A,containerBounds:y}),H=[];if(!h)return;const{x:I,y:L,width:T,height:j}=f,O={},V=h.origin??$,{width:q,height:J,x:Q,y:z}=Gb(p,c.controlDirection,F,c.boundaries,c.keepAspectRatio,V,E,x),P=q!==T,K=J!==j,U=Q!==I&&P,Z=z!==L&&K;if(!U&&!Z&&!P&&!K)return;if((U||Z||V[0]===1||V[1]===1)&&(O.x=U?Q:f.x,O.y=Z?z:f.y,f.x=O.x,f.y=O.y,b.length>0)){const ce=Q-I,fe=z-L;for(const ae of b)ae.position={x:ae.position.x-ce+V[0]*(q-T),y:ae.position.y-fe+V[1]*(J-j)},H.push(ae)}if((P||K)&&(O.width=P&&(!c.resizeDirection||c.resizeDirection==="horizontal")?q:f.width,O.height=K&&(!c.resizeDirection||c.resizeDirection==="vertical")?J:f.height,f.width=O.width,f.height=O.height),C&&h.expandParent){const ce=V[0]*(O.width??0);O.x&&O.x<ce&&(f.x=ce,p.x=p.x-(O.x-ce));const fe=V[1]*(O.height??0);O.y&&O.y<fe&&(f.y=fe,p.y=p.y-(O.y-fe))}const Y=qb({width:f.width,prevWidth:T,height:f.height,prevHeight:j,affectsX:c.controlDirection.affectsX,affectsY:c.controlDirection.affectsY}),ne={...f,direction:Y};(u==null?void 0:u(D,ne))!==!1&&(k=!0,w==null||w(D,ne),n(O,H))}).on("end",D=>{k&&(_==null||_(D,{...f}),r==null||r({...f}),k=!1)});o.call(M)}function a(){o.on(".drag",null)}return{update:i,destroy:a}}var _v={exports:{}},vv={},yv={exports:{}},wv={};/**
41
- * @license React
42
- * use-sync-external-store-shim.production.js
43
- *
44
- * Copyright (c) Meta Platforms, Inc. and affiliates.
45
- *
46
- * This source code is licensed under the MIT license found in the
47
- * LICENSE file in the root directory of this source tree.
48
- */var kr=B;function Zb(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Jb=typeof Object.is=="function"?Object.is:Zb,eE=kr.useState,tE=kr.useEffect,sE=kr.useLayoutEffect,nE=kr.useDebugValue;function rE(e,t){var s=t(),n=eE({inst:{value:s,getSnapshot:t}}),r=n[0].inst,o=n[1];return sE(function(){r.value=s,r.getSnapshot=t,mc(r)&&o({inst:r})},[e,s,t]),tE(function(){return mc(r)&&o({inst:r}),e(function(){mc(r)&&o({inst:r})})},[e]),nE(s),s}function mc(e){var t=e.getSnapshot;e=e.value;try{var s=t();return!Jb(e,s)}catch{return!0}}function iE(e,t){return t()}var oE=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?iE:rE;wv.useSyncExternalStore=kr.useSyncExternalStore!==void 0?kr.useSyncExternalStore:oE;yv.exports=wv;var aE=yv.exports;/**
49
- * @license React
50
- * use-sync-external-store-shim/with-selector.production.js
51
- *
52
- * Copyright (c) Meta Platforms, Inc. and affiliates.
53
- *
54
- * This source code is licensed under the MIT license found in the
55
- * LICENSE file in the root directory of this source tree.
56
- */var Sl=B,lE=aE;function cE(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var uE=typeof Object.is=="function"?Object.is:cE,hE=lE.useSyncExternalStore,dE=Sl.useRef,fE=Sl.useEffect,pE=Sl.useMemo,gE=Sl.useDebugValue;vv.useSyncExternalStoreWithSelector=function(e,t,s,n,r){var o=dE(null);if(o.current===null){var c={hasValue:!1,value:null};o.current=c}else c=o.current;o=pE(function(){function a(v){if(!d){if(d=!0,g=v,v=n(v),r!==void 0&&c.hasValue){var w=c.value;if(r(w,v))return l=w}return l=v}if(w=l,uE(g,v))return w;var _=n(v);return r!==void 0&&r(w,_)?(g=v,w):(g=v,l=_)}var d=!1,g,l,m=s===void 0?null:s;return[function(){return a(t())},m===null?void 0:function(){return a(m())}]},[t,s,n,r]);var i=hE(e,o[0],o[1]);return fE(function(){c.hasValue=!0,c.value=i},[i]),gE(i),i};_v.exports=vv;var mE=_v.exports;const _E=Zp(mE),vE={},Yf=e=>{let t;const s=new Set,n=(g,l)=>{const m=typeof g=="function"?g(t):g;if(!Object.is(m,t)){const v=t;t=l??(typeof m!="object"||m===null)?m:Object.assign({},t,m),s.forEach(w=>w(t,v))}},r=()=>t,a={setState:n,getState:r,getInitialState:()=>d,subscribe:g=>(s.add(g),()=>s.delete(g)),destroy:()=>{(vE?"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."),s.clear()}},d=t=e(n,r,a);return a},yE=e=>e?Yf(e):Yf,{useDebugValue:wE}=cg,{useSyncExternalStoreWithSelector:SE}=_E,xE=e=>e;function Sv(e,t=xE,s){const n=SE(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,s);return wE(n),n}const Qf=(e,t)=>{const s=yE(e),n=(r,o=t)=>Sv(s,r,o);return Object.assign(n,s),n},CE=(e,t)=>e?Qf(e,t):Qf;function Ge(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[n,r]of e)if(!Object.is(r,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}const s=Object.keys(e);if(s.length!==Object.keys(t).length)return!1;for(const n of s)if(!Object.prototype.hasOwnProperty.call(t,n)||!Object.is(e[n],t[n]))return!1;return!0}const xl=B.createContext(null),bE=xl.Provider,xv=cs.error001("react");function Ae(e,t){const s=B.useContext(xl);if(s===null)throw new Error(xv);return Sv(s,e,t)}function Xe(){const e=B.useContext(xl);if(e===null)throw new Error(xv);return B.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const Zf={display:"none"},EE={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},Cv="react-flow__node-desc",bv="react-flow__edge-desc",kE="react-flow__aria-live",LE=e=>e.ariaLiveMessage,ME=e=>e.ariaLabelConfig;function RE({rfId:e}){const t=Ae(LE);return S.jsx("div",{id:`${kE}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:EE,children:t})}function DE({rfId:e,disableKeyboardA11y:t}){const s=Ae(ME);return S.jsxs(S.Fragment,{children:[S.jsx("div",{id:`${Cv}-${e}`,style:Zf,children:t?s["node.a11yDescription.default"]:s["node.a11yDescription.keyboardDisabled"]}),S.jsx("div",{id:`${bv}-${e}`,style:Zf,children:s["edge.a11yDescription.default"]}),!t&&S.jsx(RE,{rfId:e})]})}const Cl=B.forwardRef(({position:e="top-left",children:t,className:s,style:n,...r},o)=>{const c=`${e}`.split("-");return S.jsx("div",{className:at(["react-flow__panel",s,...c]),style:n,ref:o,...r,children:t})});Cl.displayName="Panel";function AE({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:S.jsx(Cl,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:S.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const TE=e=>{const t=[],s=[];for(const[,n]of e.nodeLookup)n.selected&&t.push(n.internals.userNode);for(const[,n]of e.edgeLookup)n.selected&&s.push(n);return{selectedNodes:t,selectedEdges:s}},Uo=e=>e.id;function NE(e,t){return Ge(e.selectedNodes.map(Uo),t.selectedNodes.map(Uo))&&Ge(e.selectedEdges.map(Uo),t.selectedEdges.map(Uo))}function PE({onSelectionChange:e}){const t=Xe(),{selectedNodes:s,selectedEdges:n}=Ae(TE,NE);return B.useEffect(()=>{const r={nodes:s,edges:n};e==null||e(r),t.getState().onSelectionChangeHandlers.forEach(o=>o(r))},[s,n,e]),null}const IE=e=>!!e.onSelectionChangeHandlers;function BE({onSelectionChange:e}){const t=Ae(IE);return e||t?S.jsx(PE,{onSelectionChange:e}):null}const Ev=[0,0],jE={x:0,y:0,zoom:1},OE=["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"],Jf=[...OE,"rfId"],$E=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}),ep={translateExtent:Bi,nodeOrigin:Ev,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function FE(e){const{setNodes:t,setEdges:s,setMinZoom:n,setMaxZoom:r,setTranslateExtent:o,setNodeExtent:c,reset:i,setDefaultNodesAndEdges:a}=Ae($E,Ge),d=Xe();B.useEffect(()=>(a(e.defaultNodes,e.defaultEdges),()=>{g.current=ep,i()}),[]);const g=B.useRef(ep);return B.useEffect(()=>{for(const l of Jf){const m=e[l],v=g.current[l];m!==v&&(typeof e[l]>"u"||(l==="nodes"?t(m):l==="edges"?s(m):l==="minZoom"?n(m):l==="maxZoom"?r(m):l==="translateExtent"?o(m):l==="nodeExtent"?c(m):l==="ariaLabelConfig"?d.setState({ariaLabelConfig:ub(m)}):l==="fitView"?d.setState({fitViewQueued:m}):l==="fitViewOptions"?d.setState({fitViewOptions:m}):d.setState({[l]:m})))}g.current=e},Jf.map(l=>e[l])),null}function tp(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function HE(e){var n;const[t,s]=B.useState(e==="system"?null:e);return B.useEffect(()=>{if(e!=="system"){s(e);return}const r=tp(),o=()=>s(r!=null&&r.matches?"dark":"light");return o(),r==null||r.addEventListener("change",o),()=>{r==null||r.removeEventListener("change",o)}},[e]),t!==null?t:(n=tp())!=null&&n.matches?"dark":"light"}const sp=typeof document<"u"?document:null;function Hi(e=null,t={target:sp,actInsideInputWithModifier:!0}){const[s,n]=B.useState(!1),r=B.useRef(!1),o=B.useRef(new Set([])),[c,i]=B.useMemo(()=>{if(e!==null){const d=(Array.isArray(e)?e:[e]).filter(l=>typeof l=="string").map(l=>l.replace("+",`
57
- `).replace(`
58
-
59
- `,`
60
- +`).split(`
61
- `)),g=d.reduce((l,m)=>l.concat(...m),[]);return[d,g]}return[[],[]]},[e]);return B.useEffect(()=>{const a=(t==null?void 0:t.target)??sp,d=(t==null?void 0:t.actInsideInputWithModifier)??!0;if(e!==null){const g=v=>{var u,f;if(r.current=v.ctrlKey||v.metaKey||v.shiftKey||v.altKey,(!r.current||r.current&&!d)&&ev(v))return!1;const _=rp(v.code,i);if(o.current.add(v[_]),np(c,o.current,!1)){const p=((f=(u=v.composedPath)==null?void 0:u.call(v))==null?void 0:f[0])||v.target,h=(p==null?void 0:p.nodeName)==="BUTTON"||(p==null?void 0:p.nodeName)==="A";t.preventDefault!==!1&&(r.current||!h)&&v.preventDefault(),n(!0)}},l=v=>{const w=rp(v.code,i);np(c,o.current,!0)?(n(!1),o.current.clear()):o.current.delete(v[w]),v.key==="Meta"&&o.current.clear(),r.current=!1},m=()=>{o.current.clear(),n(!1)};return a==null||a.addEventListener("keydown",g),a==null||a.addEventListener("keyup",l),window.addEventListener("blur",m),window.addEventListener("contextmenu",m),()=>{a==null||a.removeEventListener("keydown",g),a==null||a.removeEventListener("keyup",l),window.removeEventListener("blur",m),window.removeEventListener("contextmenu",m)}}},[e,n]),s}function np(e,t,s){return e.filter(n=>s||n.length===t.size).some(n=>n.every(r=>t.has(r)))}function rp(e,t){return t.includes(e)?"code":"key"}const zE=()=>{const e=Xe();return B.useMemo(()=>({zoomIn:async t=>{const{panZoom:s}=e.getState();return s?s.scaleBy(1.2,t):!1},zoomOut:async t=>{const{panZoom:s}=e.getState();return s?s.scaleBy(1/1.2,t):!1},zoomTo:async(t,s)=>{const{panZoom:n}=e.getState();return n?n.scaleTo(t,s):!1},getZoom:()=>e.getState().transform[2],setViewport:async(t,s)=>{const{transform:[n,r,o],panZoom:c}=e.getState();return c?(await c.setViewport({x:t.x??n,y:t.y??r,zoom:t.zoom??o},s),!0):!1},getViewport:()=>{const[t,s,n]=e.getState().transform;return{x:t,y:s,zoom:n}},setCenter:async(t,s,n)=>e.getState().setCenter(t,s,n),fitBounds:async(t,s)=>{const{width:n,height:r,minZoom:o,maxZoom:c,panZoom:i}=e.getState(),a=Wh(t,n,r,o,c,(s==null?void 0:s.padding)??.1);return i?(await i.setViewport(a,{duration:s==null?void 0:s.duration,ease:s==null?void 0:s.ease,interpolate:s==null?void 0:s.interpolate}),!0):!1},screenToFlowPosition:(t,s={})=>{const{transform:n,snapGrid:r,snapToGrid:o,domNode:c}=e.getState();if(!c)return t;const{x:i,y:a}=c.getBoundingClientRect(),d={x:t.x-i,y:t.y-a},g=s.snapGrid??r,l=s.snapToGrid??o;return Ar(d,n,l,g)},flowToScreenPosition:t=>{const{transform:s,domNode:n}=e.getState();if(!n)return t;const{x:r,y:o}=n.getBoundingClientRect(),c=br(t,s);return{x:c.x+r,y:c.y+o}}}),[])};function kv(e,t){const s=[],n=new Map,r=[];for(const o of e)if(o.type==="add"){r.push(o);continue}else if(o.type==="remove"||o.type==="replace")n.set(o.id,[o]);else{const c=n.get(o.id);c?c.push(o):n.set(o.id,[o])}for(const o of t){const c=n.get(o.id);if(!c){s.push(o);continue}if(c[0].type==="remove")continue;if(c[0].type==="replace"){s.push({...c[0].item});continue}const i={...o};for(const a of c)WE(a,i);s.push(i)}return r.length&&r.forEach(o=>{o.index!==void 0?s.splice(o.index,0,{...o.item}):s.push({...o.item})}),s}function WE(e,t){switch(e.type){case"select":{t.selected=e.selected;break}case"position":{typeof e.position<"u"&&(t.position=e.position),typeof e.dragging<"u"&&(t.dragging=e.dragging);break}case"dimensions":{typeof e.dimensions<"u"&&(t.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes==="width")&&(t.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes==="height")&&(t.height=e.dimensions.height))),typeof e.resizing=="boolean"&&(t.resizing=e.resizing);break}}}function UE(e,t){return kv(e,t)}function VE(e,t){return kv(e,t)}function fn(e,t){return{id:e,type:"select",selected:t}}function sr(e,t=new Set,s=!1){const n=[];for(const[r,o]of e){const c=t.has(r);!(o.selected===void 0&&!c)&&o.selected!==c&&(s&&(o.selected=c),n.push(fn(o.id,c)))}return n}function ip({items:e=[],lookup:t}){var r;const s=[],n=new Map(e.map(o=>[o.id,o]));for(const[o,c]of e.entries()){const i=t.get(c.id),a=((r=i==null?void 0:i.internals)==null?void 0:r.userNode)??i;a!==void 0&&a!==c&&s.push({id:c.id,item:c,type:"replace"}),a===void 0&&s.push({item:c,type:"add",index:o})}for(const[o]of t)n.get(o)===void 0&&s.push({id:o,type:"remove"});return s}function op(e){return{id:e.id,type:"remove"}}const KE=Y_();function qE(e,t,s={}){return mb(e,t,{...s,onError:s.onError??KE})}const ap=e=>tb(e),GE=e=>K_(e);function Lv(e){return B.forwardRef(e)}const XE=typeof window<"u"?B.useLayoutEffect:B.useEffect;function lp(e){const[t,s]=B.useState(BigInt(0)),[n]=B.useState(()=>YE(()=>s(r=>r+BigInt(1))));return XE(()=>{const r=n.get();r.length&&(e(r),n.reset())},[t]),n}function YE(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:s=>{t.push(s),e()}}}const Mv=B.createContext(null);function QE({children:e}){const t=Xe(),s=B.useCallback(i=>{const{nodes:a=[],setNodes:d,hasDefaultNodes:g,onNodesChange:l,nodeLookup:m,fitViewQueued:v,onNodesChangeMiddlewareMap:w}=t.getState();let _=a;for(const f of i)_=typeof f=="function"?f(_):f;let u=ip({items:_,lookup:m});for(const f of w.values())u=f(u);g&&d(_),u.length>0?l==null||l(u):v&&window.requestAnimationFrame(()=>{const{fitViewQueued:f,nodes:p,setNodes:h}=t.getState();f&&h(p)})},[]),n=lp(s),r=B.useCallback(i=>{const{edges:a=[],setEdges:d,hasDefaultEdges:g,onEdgesChange:l,edgeLookup:m}=t.getState();let v=a;for(const w of i)v=typeof w=="function"?w(v):w;g?d(v):l&&l(ip({items:v,lookup:m}))},[]),o=lp(r),c=B.useMemo(()=>({nodeQueue:n,edgeQueue:o}),[]);return S.jsx(Mv.Provider,{value:c,children:e})}function ZE(){const e=B.useContext(Mv);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const JE=e=>!!e.panZoom;function bl(){const e=zE(),t=Xe(),s=ZE(),n=Ae(JE),r=B.useMemo(()=>{const o=l=>t.getState().nodeLookup.get(l),c=l=>{s.nodeQueue.push(l)},i=l=>{s.edgeQueue.push(l)},a=l=>{var f,p;const{nodeLookup:m,nodeOrigin:v}=t.getState(),w=ap(l)?l:m.get(l.id),_=w.parentId?Z_(w.position,w.measured,w.parentId,m,v):w.position,u={...w,position:_,width:((f=w.measured)==null?void 0:f.width)??w.width,height:((p=w.measured)==null?void 0:p.height)??w.height};return Cr(u)},d=(l,m,v={replace:!1})=>{c(w=>w.map(_=>{if(_.id===l){const u=typeof m=="function"?m(_):m;return v.replace&&ap(u)?u:{..._,...u}}return _}))},g=(l,m,v={replace:!1})=>{i(w=>w.map(_=>{if(_.id===l){const u=typeof m=="function"?m(_):m;return v.replace&&GE(u)?u:{..._,...u}}return _}))};return{getNodes:()=>t.getState().nodes.map(l=>({...l})),getNode:l=>{var m;return(m=o(l))==null?void 0:m.internals.userNode},getInternalNode:o,getEdges:()=>{const{edges:l=[]}=t.getState();return l.map(m=>({...m}))},getEdge:l=>t.getState().edgeLookup.get(l),setNodes:c,setEdges:i,addNodes:l=>{const m=Array.isArray(l)?l:[l];s.nodeQueue.push(v=>[...v,...m])},addEdges:l=>{const m=Array.isArray(l)?l:[l];s.edgeQueue.push(v=>[...v,...m])},toObject:()=>{const{nodes:l=[],edges:m=[],transform:v}=t.getState(),[w,_,u]=v;return{nodes:l.map(f=>({...f})),edges:m.map(f=>({...f})),viewport:{x:w,y:_,zoom:u}}},deleteElements:async({nodes:l=[],edges:m=[]})=>{const{nodes:v,edges:w,onNodesDelete:_,onEdgesDelete:u,triggerNodeChanges:f,triggerEdgeChanges:p,onDelete:h,onBeforeDelete:y}=t.getState(),{nodes:b,edges:C}=await ob({nodesToRemove:l,edgesToRemove:m,nodes:v,edges:w,onBeforeDelete:y}),E=C.length>0,x=b.length>0;if(E){const k=C.map(op);u==null||u(C),p(k)}if(x){const k=b.map(op);_==null||_(b),f(k)}return(x||E)&&(h==null||h({nodes:b,edges:C})),{deletedNodes:b,deletedEdges:C}},getIntersectingNodes:(l,m=!0,v)=>{const w=jf(l),_=w?l:a(l),u=v!==void 0;return _?(v||t.getState().nodes).filter(f=>{const p=t.getState().nodeLookup.get(f.id);if(p&&!w&&(f.id===l.id||!p.internals.positionAbsolute))return!1;const h=Cr(u?f:p),y=$i(h,_);return m&&y>0||y>=h.width*h.height||y>=_.width*_.height}):[]},isNodeIntersecting:(l,m,v=!0)=>{const _=jf(l)?l:a(l);if(!_)return!1;const u=$i(_,m);return v&&u>0||u>=m.width*m.height||u>=_.width*_.height},updateNode:d,updateNodeData:(l,m,v={replace:!1})=>{d(l,w=>{const _=typeof m=="function"?m(w):m;return v.replace?{...w,data:_}:{...w,data:{...w.data,..._}}},v)},updateEdge:g,updateEdgeData:(l,m,v={replace:!1})=>{g(l,w=>{const _=typeof m=="function"?m(w):m;return v.replace?{...w,data:_}:{...w,data:{...w.data,..._}}},v)},getNodesBounds:l=>{const{nodeLookup:m,nodeOrigin:v}=t.getState();return sb(l,{nodeLookup:m,nodeOrigin:v})},getHandleConnections:({type:l,id:m,nodeId:v})=>{var w;return Array.from(((w=t.getState().connectionLookup.get(`${v}-${l}${m?`-${m}`:""}`))==null?void 0:w.values())??[])},getNodeConnections:({type:l,handleId:m,nodeId:v})=>{var w;return Array.from(((w=t.getState().connectionLookup.get(`${v}${l?m?`-${l}-${m}`:`-${l}`:""}`))==null?void 0:w.values())??[])},fitView:async l=>{const m=t.getState().fitViewResolver??cb();return t.setState({fitViewQueued:!0,fitViewOptions:l,fitViewResolver:m}),s.nodeQueue.push(v=>[...v]),m.promise}}},[]);return B.useMemo(()=>({...r,...e,viewportInitialized:n}),[n])}const cp=e=>e.selected,e5=typeof window<"u"?window:void 0;function t5({deleteKeyCode:e,multiSelectionKeyCode:t}){const s=Xe(),{deleteElements:n}=bl(),r=Hi(e,{actInsideInputWithModifier:!1}),o=Hi(t,{target:e5});B.useEffect(()=>{if(r){const{edges:c,nodes:i}=s.getState();n({nodes:i.filter(cp),edges:c.filter(cp)}),s.setState({nodesSelectionActive:!1})}},[r]),B.useEffect(()=>{s.setState({multiSelectionActive:o})},[o])}function s5(e){const t=Xe();B.useEffect(()=>{const s=()=>{var r,o,c,i;if(!e.current||!(((o=(r=e.current).checkVisibility)==null?void 0:o.call(r))??!0))return!1;const n=Uh(e.current);(n.height===0||n.width===0)&&((i=(c=t.getState()).onError)==null||i.call(c,"004",cs.error004())),t.setState({width:n.width||500,height:n.height||500})};if(e.current){s(),window.addEventListener("resize",s);const n=new ResizeObserver(()=>s());return n.observe(e.current),()=>{window.removeEventListener("resize",s),n&&e.current&&n.unobserve(e.current)}}},[])}const El={position:"absolute",width:"100%",height:"100%",top:0,left:0},n5=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function r5({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:s=!0,panOnScroll:n=!1,panOnScrollSpeed:r=.5,panOnScrollMode:o=xn.Free,zoomOnDoubleClick:c=!0,panOnDrag:i=!0,defaultViewport:a,translateExtent:d,minZoom:g,maxZoom:l,zoomActivationKeyCode:m,preventScrolling:v=!0,children:w,noWheelClassName:_,noPanClassName:u,onViewportChange:f,isControlledViewport:p,paneClickDistance:h,selectionOnDrag:y}){const b=Xe(),C=B.useRef(null),{userSelectionActive:E,lib:x,connectionInProgress:k}=Ae(n5,Ge),M=Hi(m),D=B.useRef();s5(C);const R=B.useCallback(N=>{f==null||f({x:N[0],y:N[1],zoom:N[2]}),p||b.setState({transform:N})},[f,p]);return B.useEffect(()=>{if(C.current){D.current=Kb({domNode:C.current,minZoom:g,maxZoom:l,translateExtent:d,viewport:a,onDraggingChange:F=>b.setState(H=>H.paneDragging===F?H:{paneDragging:F}),onPanZoomStart:(F,H)=>{const{onViewportChangeStart:I,onMoveStart:L}=b.getState();L==null||L(F,H),I==null||I(H)},onPanZoom:(F,H)=>{const{onViewportChange:I,onMove:L}=b.getState();L==null||L(F,H),I==null||I(H)},onPanZoomEnd:(F,H)=>{const{onViewportChangeEnd:I,onMoveEnd:L}=b.getState();L==null||L(F,H),I==null||I(H)}});const{x:N,y:A,zoom:$}=D.current.getViewport();return b.setState({panZoom:D.current,transform:[N,A,$],domNode:C.current.closest(".react-flow")}),()=>{var F;(F=D.current)==null||F.destroy()}}},[]),B.useEffect(()=>{var N;(N=D.current)==null||N.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:s,panOnScroll:n,panOnScrollSpeed:r,panOnScrollMode:o,zoomOnDoubleClick:c,panOnDrag:i,zoomActivationKeyPressed:M,preventScrolling:v,noPanClassName:u,userSelectionActive:E,noWheelClassName:_,lib:x,onTransformChange:R,connectionInProgress:k,selectionOnDrag:y,paneClickDistance:h})},[e,t,s,n,r,o,c,i,M,v,u,E,_,x,R,k,y,h]),S.jsx("div",{className:"react-flow__renderer",ref:C,style:El,children:w})}const i5=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function o5(){const{userSelectionActive:e,userSelectionRect:t}=Ae(i5,Ge);return e&&t?S.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}const _c=(e,t)=>s=>{s.target===t.current&&(e==null||e(s))},a5=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function l5({isSelecting:e,selectionKeyPressed:t,selectionMode:s=ji.Full,panOnDrag:n,autoPanOnSelection:r,paneClickDistance:o,selectionOnDrag:c,onSelectionStart:i,onSelectionEnd:a,onPaneClick:d,onPaneContextMenu:g,onPaneScroll:l,onPaneMouseEnter:m,onPaneMouseMove:v,onPaneMouseLeave:w,children:_}){const u=B.useRef(0),f=Xe(),{userSelectionActive:p,elementsSelectable:h,dragging:y,connectionInProgress:b,panBy:C,autoPanSpeed:E}=Ae(a5,Ge),x=h&&(e||p),k=B.useRef(null),M=B.useRef(),D=B.useRef(new Set),R=B.useRef(new Set),N=B.useRef(!1),A=B.useRef({x:0,y:0}),$=B.useRef(!1),F=P=>{if(N.current||b){N.current=!1;return}d==null||d(P),f.getState().resetSelectedElements(),f.setState({nodesSelectionActive:!1})},H=P=>{if(Array.isArray(n)&&(n!=null&&n.includes(2))){P.preventDefault();return}g==null||g(P)},I=l?P=>l(P):void 0,L=P=>{N.current&&(P.stopPropagation(),N.current=!1)},T=P=>{var ae,Pe;const{domNode:K,transform:U}=f.getState();if(M.current=K==null?void 0:K.getBoundingClientRect(),!M.current)return;const Z=P.target===k.current;if(!Z&&!!P.target.closest(".nokey")||!e||!(c&&Z||t)||P.button!==0||!P.isPrimary)return;(Pe=(ae=P.target)==null?void 0:ae.setPointerCapture)==null||Pe.call(ae,P.pointerId),N.current=!1;const{x:ie,y:ce}=is(P.nativeEvent,M.current),fe=Ar({x:ie,y:ce},U);f.setState({userSelectionRect:{width:0,height:0,startX:fe.x,startY:fe.y,x:ie,y:ce}}),Z||(P.stopPropagation(),P.preventDefault())};function j(P,K){const{userSelectionRect:U}=f.getState();if(!U)return;const{transform:Z,nodeLookup:Y,edgeLookup:ne,connectionLookup:ie,triggerNodeChanges:ce,triggerEdgeChanges:fe,defaultEdgeOptions:ae}=f.getState(),Pe={x:U.startX,y:U.startY},{x:We,y:ve}=br(Pe,Z),me={startX:Pe.x,startY:Pe.y,x:P<We?P:We,y:K<ve?K:ve,width:Math.abs(P-We),height:Math.abs(K-ve)},xe=D.current,le=R.current;D.current=new Set(Hh(Y,me,Z,s===ji.Partial,!0).map(Ce=>Ce.id)),R.current=new Set;const _e=(ae==null?void 0:ae.selectable)??!0;for(const Ce of D.current){const ke=ie.get(Ce);if(ke)for(const{edgeId:$e}of ke.values()){const Be=ne.get($e);Be&&(Be.selectable??_e)&&R.current.add($e)}}if(!Of(xe,D.current)){const Ce=sr(Y,D.current,!0);ce(Ce)}if(!Of(le,R.current)){const Ce=sr(ne,R.current);fe(Ce)}f.setState({userSelectionRect:me,userSelectionActive:!0,nodesSelectionActive:!1})}function O(){if(!r||!M.current)return;const[P,K]=zh(A.current,M.current,E);C({x:P,y:K}).then(U=>{if(!N.current||!U){u.current=requestAnimationFrame(O);return}const{x:Z,y:Y}=A.current;j(Z,Y),u.current=requestAnimationFrame(O)})}const V=()=>{cancelAnimationFrame(u.current),u.current=0,$.current=!1};B.useEffect(()=>()=>V(),[]);const q=P=>{const{userSelectionRect:K,transform:U,resetSelectedElements:Z}=f.getState();if(!M.current||!K)return;const{x:Y,y:ne}=is(P.nativeEvent,M.current);A.current={x:Y,y:ne};const ie=br({x:K.startX,y:K.startY},U);if(!N.current){const ce=t?0:o;if(Math.hypot(Y-ie.x,ne-ie.y)<=ce)return;Z(),i==null||i(P)}N.current=!0,$.current||(O(),$.current=!0),j(Y,ne)},J=P=>{var K,U;P.button===0&&((U=(K=P.target)==null?void 0:K.releasePointerCapture)==null||U.call(K,P.pointerId),!p&&P.target===k.current&&f.getState().userSelectionRect&&(F==null||F(P)),f.setState({userSelectionActive:!1,userSelectionRect:null}),N.current&&(a==null||a(P),f.setState({nodesSelectionActive:D.current.size>0})),V())},Q=P=>{var K,U;(U=(K=P.target)==null?void 0:K.releasePointerCapture)==null||U.call(K,P.pointerId),V()},z=n===!0||Array.isArray(n)&&n.includes(0);return S.jsxs("div",{className:at(["react-flow__pane",{draggable:z,dragging:y,selection:e}]),onClick:x?void 0:_c(F,k),onContextMenu:_c(H,k),onWheel:_c(I,k),onPointerEnter:x?void 0:m,onPointerMove:x?q:v,onPointerUp:x?J:void 0,onPointerCancel:x?Q:void 0,onPointerDownCapture:x?T:void 0,onClickCapture:x?L:void 0,onPointerLeave:w,ref:k,style:El,children:[_,S.jsx(o5,{})]})}function Pu({id:e,store:t,unselect:s=!1,nodeRef:n}){const{addSelectedNodes:r,unselectNodesAndEdges:o,multiSelectionActive:c,nodeLookup:i,onError:a}=t.getState(),d=i.get(e);if(!d){a==null||a("012",cs.error012(e));return}t.setState({nodesSelectionActive:!1}),d.selected?(s||d.selected&&c)&&(o({nodes:[d],edges:[]}),requestAnimationFrame(()=>{var g;return(g=n==null?void 0:n.current)==null?void 0:g.blur()})):r([e])}function Rv({nodeRef:e,disabled:t=!1,noDragClassName:s,handleSelector:n,nodeId:r,isSelectable:o,nodeClickDistance:c}){const i=Xe(),[a,d]=B.useState(!1),g=B.useRef();return B.useEffect(()=>{g.current=Tb({getStoreItems:()=>i.getState(),onNodeMouseDown:l=>{Pu({id:l,store:i,nodeRef:e})},onDragStart:()=>{d(!0)},onDragStop:()=>{d(!1)}})},[]),B.useEffect(()=>{if(!(t||!e.current||!g.current))return g.current.update({noDragClassName:s,handleSelector:n,domNode:e.current,isSelectable:o,nodeId:r,nodeClickDistance:c}),()=>{var l;(l=g.current)==null||l.destroy()}},[s,n,t,o,e,r,c]),a}const c5=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function Dv(){const e=Xe();return B.useCallback(s=>{const{nodeExtent:n,snapToGrid:r,snapGrid:o,nodesDraggable:c,onError:i,updateNodePositions:a,nodeLookup:d,nodeOrigin:g}=e.getState(),l=new Map,m=c5(c),v=r?o[0]:5,w=r?o[1]:5,_=s.direction.x*v*s.factor,u=s.direction.y*w*s.factor;for(const[,f]of d){if(!m(f))continue;let p={x:f.internals.positionAbsolute.x+_,y:f.internals.positionAbsolute.y+u};r&&(p=to(p,o));const{position:h,positionAbsolute:y}=q_({nodeId:f.id,nextPosition:p,nodeLookup:d,nodeExtent:n,nodeOrigin:g,onError:i});f.position=h,f.internals.positionAbsolute=y,l.set(f.id,f)}a(l)},[])}const Yh=B.createContext(null),u5=Yh.Provider;Yh.Consumer;const Av=()=>B.useContext(Yh),h5=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),d5=(e,t,s)=>n=>{const{connectionClickStartHandle:r,connectionMode:o,connection:c}=n,{fromHandle:i,toHandle:a,isValid:d}=c,g=(a==null?void 0:a.nodeId)===e&&(a==null?void 0:a.id)===t&&(a==null?void 0:a.type)===s;return{connectingFrom:(i==null?void 0:i.nodeId)===e&&(i==null?void 0:i.id)===t&&(i==null?void 0:i.type)===s,connectingTo:g,clickConnecting:(r==null?void 0:r.nodeId)===e&&(r==null?void 0:r.id)===t&&(r==null?void 0:r.type)===s,isPossibleEndHandle:o===Sr.Strict?(i==null?void 0:i.type)!==s:e!==(i==null?void 0:i.nodeId)||t!==(i==null?void 0:i.id),connectionInProcess:!!i,clickConnectionInProcess:!!r,valid:g&&d}};function f5({type:e="source",position:t=we.Top,isValidConnection:s,isConnectable:n=!0,isConnectableStart:r=!0,isConnectableEnd:o=!0,id:c,onConnect:i,children:a,className:d,onMouseDown:g,onTouchStart:l,...m},v){var $,F;const w=c||null,_=e==="target",u=Xe(),f=Av(),{connectOnClick:p,noPanClassName:h,rfId:y}=Ae(h5,Ge),{connectingFrom:b,connectingTo:C,clickConnecting:E,isPossibleEndHandle:x,connectionInProcess:k,clickConnectionInProcess:M,valid:D}=Ae(d5(f,w,e),Ge);f||(F=($=u.getState()).onError)==null||F.call($,"010",cs.error010());const R=H=>{const{defaultEdgeOptions:I,onConnect:L,hasDefaultEdges:T}=u.getState(),j={...I,...H};if(T){const{edges:O,setEdges:V,onError:q}=u.getState();V(qE(j,O,{onError:q}))}L==null||L(j),i==null||i(j)},N=H=>{if(!f)return;const I=tv(H.nativeEvent);if(r&&(I&&H.button===0||!I)){const L=u.getState();Nu.onPointerDown(H.nativeEvent,{handleDomNode:H.currentTarget,autoPanOnConnect:L.autoPanOnConnect,connectionMode:L.connectionMode,connectionRadius:L.connectionRadius,domNode:L.domNode,nodeLookup:L.nodeLookup,lib:L.lib,isTarget:_,handleId:w,nodeId:f,flowId:L.rfId,panBy:L.panBy,cancelConnection:L.cancelConnection,onConnectStart:L.onConnectStart,onConnectEnd:(...T)=>{var j,O;return(O=(j=u.getState()).onConnectEnd)==null?void 0:O.call(j,...T)},updateConnection:L.updateConnection,onConnect:R,isValidConnection:s||((...T)=>{var j,O;return((O=(j=u.getState()).isValidConnection)==null?void 0:O.call(j,...T))??!0}),getTransform:()=>u.getState().transform,getFromHandle:()=>u.getState().connection.fromHandle,autoPanSpeed:L.autoPanSpeed,dragThreshold:L.connectionDragThreshold})}I?g==null||g(H):l==null||l(H)},A=H=>{const{onClickConnectStart:I,onClickConnectEnd:L,connectionClickStartHandle:T,connectionMode:j,isValidConnection:O,lib:V,rfId:q,nodeLookup:J,connection:Q}=u.getState();if(!f||!T&&!r)return;if(!T){I==null||I(H.nativeEvent,{nodeId:f,handleId:w,handleType:e}),u.setState({connectionClickStartHandle:{nodeId:f,type:e,id:w}});return}const z=J_(H.target),P=s||O,{connection:K,isValid:U}=Nu.isValid(H.nativeEvent,{handle:{nodeId:f,id:w,type:e},connectionMode:j,fromNodeId:T.nodeId,fromHandleId:T.id||null,fromType:T.type,isValidConnection:P,flowId:q,doc:z,lib:V,nodeLookup:J});U&&K&&R(K);const Z=structuredClone(Q);delete Z.inProgress,Z.toPosition=Z.toHandle?Z.toHandle.position:null,L==null||L(H,Z),u.setState({connectionClickStartHandle:null})};return S.jsx("div",{"data-handleid":w,"data-nodeid":f,"data-handlepos":t,"data-id":`${y}-${f}-${w}-${e}`,className:at(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",h,d,{source:!_,target:_,connectable:n,connectablestart:r,connectableend:o,clickconnecting:E,connectingfrom:b,connectingto:C,valid:D,connectionindicator:n&&(!k||x)&&(k||M?o:r)}]),onMouseDown:N,onTouchStart:N,onClick:p?A:void 0,ref:v,...m,children:a})}const Lr=B.memo(Lv(f5));function p5({data:e,isConnectable:t,sourcePosition:s=we.Bottom}){return S.jsxs(S.Fragment,{children:[e==null?void 0:e.label,S.jsx(Lr,{type:"source",position:s,isConnectable:t})]})}function g5({data:e,isConnectable:t,targetPosition:s=we.Top,sourcePosition:n=we.Bottom}){return S.jsxs(S.Fragment,{children:[S.jsx(Lr,{type:"target",position:s,isConnectable:t}),e==null?void 0:e.label,S.jsx(Lr,{type:"source",position:n,isConnectable:t})]})}function m5(){return null}function _5({data:e,isConnectable:t,targetPosition:s=we.Top}){return S.jsxs(S.Fragment,{children:[S.jsx(Lr,{type:"target",position:s,isConnectable:t}),e==null?void 0:e.label]})}const Ka={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},up={input:p5,default:g5,output:_5,group:m5};function v5(e){var t,s,n,r;return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??((t=e.style)==null?void 0:t.width),height:e.height??e.initialHeight??((s=e.style)==null?void 0:s.height)}:{width:e.width??((n=e.style)==null?void 0:n.width),height:e.height??((r=e.style)==null?void 0:r.height)}}const y5=e=>{const{width:t,height:s,x:n,y:r}=eo(e.nodeLookup,{filter:o=>!!o.selected});return{width:rs(t)?t:null,height:rs(s)?s:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${n}px,${r}px)`}};function w5({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:s}){const n=Xe(),{width:r,height:o,transformString:c,userSelectionActive:i}=Ae(y5,Ge),a=Dv(),d=B.useRef(null);B.useEffect(()=>{var v;s||(v=d.current)==null||v.focus({preventScroll:!0})},[s]);const g=!i&&r!==null&&o!==null;if(Rv({nodeRef:d,disabled:!g}),!g)return null;const l=e?v=>{const w=n.getState().nodes.filter(_=>_.selected);e(v,w)}:void 0,m=v=>{Object.prototype.hasOwnProperty.call(Ka,v.key)&&(v.preventDefault(),a({direction:Ka[v.key],factor:v.shiftKey?4:1}))};return S.jsx("div",{className:at(["react-flow__nodesselection","react-flow__container",t]),style:{transform:c},children:S.jsx("div",{ref:d,className:"react-flow__nodesselection-rect",onContextMenu:l,tabIndex:s?void 0:-1,onKeyDown:s?void 0:m,style:{width:r,height:o}})})}const hp=typeof window<"u"?window:void 0,S5=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function Tv({children:e,onPaneClick:t,onPaneMouseEnter:s,onPaneMouseMove:n,onPaneMouseLeave:r,onPaneContextMenu:o,onPaneScroll:c,paneClickDistance:i,deleteKeyCode:a,selectionKeyCode:d,selectionOnDrag:g,selectionMode:l,onSelectionStart:m,onSelectionEnd:v,multiSelectionKeyCode:w,panActivationKeyCode:_,zoomActivationKeyCode:u,elementsSelectable:f,zoomOnScroll:p,zoomOnPinch:h,panOnScroll:y,panOnScrollSpeed:b,panOnScrollMode:C,zoomOnDoubleClick:E,panOnDrag:x,autoPanOnSelection:k,defaultViewport:M,translateExtent:D,minZoom:R,maxZoom:N,preventScrolling:A,onSelectionContextMenu:$,noWheelClassName:F,noPanClassName:H,disableKeyboardA11y:I,onViewportChange:L,isControlledViewport:T}){const{nodesSelectionActive:j,userSelectionActive:O}=Ae(S5,Ge),V=Hi(d,{target:hp}),q=Hi(_,{target:hp}),J=q||x,Q=q||y,z=g&&J!==!0,P=V||O||z;return t5({deleteKeyCode:a,multiSelectionKeyCode:w}),S.jsx(r5,{onPaneContextMenu:o,elementsSelectable:f,zoomOnScroll:p,zoomOnPinch:h,panOnScroll:Q,panOnScrollSpeed:b,panOnScrollMode:C,zoomOnDoubleClick:E,panOnDrag:!V&&J,defaultViewport:M,translateExtent:D,minZoom:R,maxZoom:N,zoomActivationKeyCode:u,preventScrolling:A,noWheelClassName:F,noPanClassName:H,onViewportChange:L,isControlledViewport:T,paneClickDistance:i,selectionOnDrag:z,children:S.jsxs(l5,{onSelectionStart:m,onSelectionEnd:v,onPaneClick:t,onPaneMouseEnter:s,onPaneMouseMove:n,onPaneMouseLeave:r,onPaneContextMenu:o,onPaneScroll:c,panOnDrag:J,autoPanOnSelection:k,isSelecting:!!P,selectionMode:l,selectionKeyPressed:V,paneClickDistance:i,selectionOnDrag:z,children:[e,j&&S.jsx(w5,{onSelectionContextMenu:$,noPanClassName:H,disableKeyboardA11y:I})]})})}Tv.displayName="FlowRenderer";const x5=B.memo(Tv),C5=e=>t=>e?Hh(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(s=>s.id):Array.from(t.nodeLookup.keys());function b5(e){return Ae(B.useCallback(C5(e),[e]),Ge)}const E5=e=>e.updateNodeInternals;function k5(){const e=Ae(E5),[t]=B.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(s=>{const n=new Map;s.forEach(r=>{const o=r.target.getAttribute("data-id");n.set(o,{id:o,nodeElement:r.target,force:!0})}),e(n)}));return B.useEffect(()=>()=>{t==null||t.disconnect()},[t]),t}function L5({node:e,nodeType:t,hasDimensions:s,resizeObserver:n}){const r=Xe(),o=B.useRef(null),c=B.useRef(null),i=B.useRef(e.sourcePosition),a=B.useRef(e.targetPosition),d=B.useRef(t),g=s&&!!e.internals.handleBounds;return B.useEffect(()=>{o.current&&!e.hidden&&(!g||c.current!==o.current)&&(c.current&&(n==null||n.unobserve(c.current)),n==null||n.observe(o.current),c.current=o.current)},[g,e.hidden]),B.useEffect(()=>()=>{c.current&&(n==null||n.unobserve(c.current),c.current=null)},[]),B.useEffect(()=>{if(o.current){const l=d.current!==t,m=i.current!==e.sourcePosition,v=a.current!==e.targetPosition;(l||m||v)&&(d.current=t,i.current=e.sourcePosition,a.current=e.targetPosition,r.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:o.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),o}function M5({id:e,onClick:t,onMouseEnter:s,onMouseMove:n,onMouseLeave:r,onContextMenu:o,onDoubleClick:c,nodesDraggable:i,elementsSelectable:a,nodesConnectable:d,nodesFocusable:g,resizeObserver:l,noDragClassName:m,noPanClassName:v,disableKeyboardA11y:w,rfId:_,nodeTypes:u,nodeClickDistance:f,onError:p}){const{node:h,internals:y,isParent:b}=Ae(P=>{const K=P.nodeLookup.get(e),U=P.parentLookup.has(e);return{node:K,internals:K.internals,isParent:U}},Ge);let C=h.type||"default",E=(u==null?void 0:u[C])||up[C];E===void 0&&(p==null||p("003",cs.error003(C)),C="default",E=(u==null?void 0:u.default)||up.default);const x=!!(h.draggable||i&&typeof h.draggable>"u"),k=!!(h.selectable||a&&typeof h.selectable>"u"),M=!!(h.connectable||d&&typeof h.connectable>"u"),D=!!(h.focusable||g&&typeof h.focusable>"u"),R=Xe(),N=Q_(h),A=L5({node:h,nodeType:C,hasDimensions:N,resizeObserver:l}),$=Rv({nodeRef:A,disabled:h.hidden||!x,noDragClassName:m,handleSelector:h.dragHandle,nodeId:e,isSelectable:k,nodeClickDistance:f}),F=Dv();if(h.hidden)return null;const H=Bs(h),I=v5(h),L=k||x||t||s||n||r,T=s?P=>s(P,{...y.userNode}):void 0,j=n?P=>n(P,{...y.userNode}):void 0,O=r?P=>r(P,{...y.userNode}):void 0,V=o?P=>o(P,{...y.userNode}):void 0,q=c?P=>c(P,{...y.userNode}):void 0,J=P=>{const{selectNodesOnDrag:K,nodeDragThreshold:U}=R.getState();k&&(!K||!x||U>0)&&Pu({id:e,store:R,nodeRef:A}),t&&t(P,{...y.userNode})},Q=P=>{if(!(ev(P.nativeEvent)||w)){if(z_.includes(P.key)&&k){const K=P.key==="Escape";Pu({id:e,store:R,unselect:K,nodeRef:A})}else if(x&&h.selected&&Object.prototype.hasOwnProperty.call(Ka,P.key)){P.preventDefault();const{ariaLabelConfig:K}=R.getState();R.setState({ariaLiveMessage:K["node.a11yDescription.ariaLiveMessage"]({direction:P.key.replace("Arrow","").toLowerCase(),x:~~y.positionAbsolute.x,y:~~y.positionAbsolute.y})}),F({direction:Ka[P.key],factor:P.shiftKey?4:1})}}},z=()=>{var ie;if(w||!((ie=A.current)!=null&&ie.matches(":focus-visible")))return;const{transform:P,width:K,height:U,autoPanOnNodeFocus:Z,setCenter:Y}=R.getState();if(!Z)return;Hh(new Map([[e,h]]),{x:0,y:0,width:K,height:U},P,!0).length>0||Y(h.position.x+H.width/2,h.position.y+H.height/2,{zoom:P[2]})};return S.jsx("div",{className:at(["react-flow__node",`react-flow__node-${C}`,{[v]:x},h.className,{selected:h.selected,selectable:k,parent:b,draggable:x,dragging:$}]),ref:A,style:{zIndex:y.z,transform:`translate(${y.positionAbsolute.x}px,${y.positionAbsolute.y}px)`,pointerEvents:L?"all":"none",visibility:N?"visible":"hidden",...h.style,...I},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:T,onMouseMove:j,onMouseLeave:O,onContextMenu:V,onClick:J,onDoubleClick:q,onKeyDown:D?Q:void 0,tabIndex:D?0:void 0,onFocus:D?z:void 0,role:h.ariaRole??(D?"group":void 0),"aria-roledescription":"node","aria-describedby":w?void 0:`${Cv}-${_}`,"aria-label":h.ariaLabel,...h.domAttributes,children:S.jsx(u5,{value:e,children:S.jsx(E,{id:e,data:h.data,type:C,positionAbsoluteX:y.positionAbsolute.x,positionAbsoluteY:y.positionAbsolute.y,selected:h.selected??!1,selectable:k,draggable:x,deletable:h.deletable??!0,isConnectable:M,sourcePosition:h.sourcePosition,targetPosition:h.targetPosition,dragging:$,dragHandle:h.dragHandle,zIndex:y.z,parentId:h.parentId,...H})})})}var R5=B.memo(M5);const D5=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function Nv(e){const{nodesDraggable:t,nodesConnectable:s,nodesFocusable:n,elementsSelectable:r,onError:o}=Ae(D5,Ge),c=b5(e.onlyRenderVisibleElements),i=k5();return S.jsx("div",{className:"react-flow__nodes",style:El,children:c.map(a=>S.jsx(R5,{id:a,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:i,nodesDraggable:t,nodesConnectable:s,nodesFocusable:n,elementsSelectable:r,nodeClickDistance:e.nodeClickDistance,onError:o},a))})}Nv.displayName="NodeRenderer";const A5=B.memo(Nv);function T5(e){return Ae(B.useCallback(s=>{if(!e)return s.edges.map(r=>r.id);const n=[];if(s.width&&s.height)for(const r of s.edges){const o=s.nodeLookup.get(r.source),c=s.nodeLookup.get(r.target);o&&c&&fb({sourceNode:o,targetNode:c,width:s.width,height:s.height,transform:s.transform})&&n.push(r.id)}return n},[e]),Ge)}const N5=({color:e="none",strokeWidth:t=1})=>{const s={strokeWidth:t,...e&&{stroke:e}};return S.jsx("polyline",{className:"arrow",style:s,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},P5=({color:e="none",strokeWidth:t=1})=>{const s={strokeWidth:t,...e&&{stroke:e,fill:e}};return S.jsx("polyline",{className:"arrowclosed",style:s,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},dp={[Oi.Arrow]:N5,[Oi.ArrowClosed]:P5};function I5(e){const t=Xe();return B.useMemo(()=>{var r,o;return Object.prototype.hasOwnProperty.call(dp,e)?dp[e]:((o=(r=t.getState()).onError)==null||o.call(r,"009",cs.error009(e)),null)},[e])}const B5=({id:e,type:t,color:s,width:n=12.5,height:r=12.5,markerUnits:o="strokeWidth",strokeWidth:c,orient:i="auto-start-reverse"})=>{const a=I5(t);return a?S.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${n}`,markerHeight:`${r}`,viewBox:"-10 -10 20 20",markerUnits:o,orient:i,refX:"0",refY:"0",children:S.jsx(a,{color:s,strokeWidth:c})}):null},Pv=({defaultColor:e,rfId:t})=>{const s=Ae(o=>o.edges),n=Ae(o=>o.defaultEdgeOptions),r=B.useMemo(()=>Sb(s,{id:t,defaultColor:e,defaultMarkerStart:n==null?void 0:n.markerStart,defaultMarkerEnd:n==null?void 0:n.markerEnd}),[s,n,t,e]);return r.length?S.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:S.jsx("defs",{children:r.map(o=>S.jsx(B5,{id:o.id,type:o.type,color:o.color,width:o.width,height:o.height,markerUnits:o.markerUnits,strokeWidth:o.strokeWidth,orient:o.orient},o.id))})}):null};Pv.displayName="MarkerDefinitions";var j5=B.memo(Pv);function Iv({x:e,y:t,label:s,labelStyle:n,labelShowBg:r=!0,labelBgStyle:o,labelBgPadding:c=[2,4],labelBgBorderRadius:i=2,children:a,className:d,...g}){const[l,m]=B.useState({x:1,y:0,width:0,height:0}),v=at(["react-flow__edge-textwrapper",d]),w=B.useRef(null);return B.useEffect(()=>{if(w.current){const _=w.current.getBBox();m({x:_.x,y:_.y,width:_.width,height:_.height})}},[s]),s?S.jsxs("g",{transform:`translate(${e-l.width/2} ${t-l.height/2})`,className:v,visibility:l.width?"visible":"hidden",...g,children:[r&&S.jsx("rect",{width:l.width+2*c[0],x:-c[0],y:-c[1],height:l.height+2*c[1],className:"react-flow__edge-textbg",style:o,rx:i,ry:i}),S.jsx("text",{className:"react-flow__edge-text",y:l.height/2,dy:"0.3em",ref:w,style:n,children:s}),a]}):null}Iv.displayName="EdgeText";const O5=B.memo(Iv);function kl({path:e,labelX:t,labelY:s,label:n,labelStyle:r,labelShowBg:o,labelBgStyle:c,labelBgPadding:i,labelBgBorderRadius:a,interactionWidth:d=20,...g}){return S.jsxs(S.Fragment,{children:[S.jsx("path",{...g,d:e,fill:"none",className:at(["react-flow__edge-path",g.className])}),d?S.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:d,className:"react-flow__edge-interaction"}):null,n&&rs(t)&&rs(s)?S.jsx(O5,{x:t,y:s,label:n,labelStyle:r,labelShowBg:o,labelBgStyle:c,labelBgPadding:i,labelBgBorderRadius:a}):null]})}function fp({pos:e,x1:t,y1:s,x2:n,y2:r}){return e===we.Left||e===we.Right?[.5*(t+n),s]:[t,.5*(s+r)]}function Bv({sourceX:e,sourceY:t,sourcePosition:s=we.Bottom,targetX:n,targetY:r,targetPosition:o=we.Top}){const[c,i]=fp({pos:s,x1:e,y1:t,x2:n,y2:r}),[a,d]=fp({pos:o,x1:n,y1:r,x2:e,y2:t}),[g,l,m,v]=sv({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:c,sourceControlY:i,targetControlX:a,targetControlY:d});return[`M${e},${t} C${c},${i} ${a},${d} ${n},${r}`,g,l,m,v]}function jv(e){return B.memo(({id:t,sourceX:s,sourceY:n,targetX:r,targetY:o,sourcePosition:c,targetPosition:i,label:a,labelStyle:d,labelShowBg:g,labelBgStyle:l,labelBgPadding:m,labelBgBorderRadius:v,style:w,markerEnd:_,markerStart:u,interactionWidth:f})=>{const[p,h,y]=Bv({sourceX:s,sourceY:n,sourcePosition:c,targetX:r,targetY:o,targetPosition:i}),b=e.isInternal?void 0:t;return S.jsx(kl,{id:b,path:p,labelX:h,labelY:y,label:a,labelStyle:d,labelShowBg:g,labelBgStyle:l,labelBgPadding:m,labelBgBorderRadius:v,style:w,markerEnd:_,markerStart:u,interactionWidth:f})})}const $5=jv({isInternal:!1}),Ov=jv({isInternal:!0});$5.displayName="SimpleBezierEdge";Ov.displayName="SimpleBezierEdgeInternal";function $v(e){return B.memo(({id:t,sourceX:s,sourceY:n,targetX:r,targetY:o,label:c,labelStyle:i,labelShowBg:a,labelBgStyle:d,labelBgPadding:g,labelBgBorderRadius:l,style:m,sourcePosition:v=we.Bottom,targetPosition:w=we.Top,markerEnd:_,markerStart:u,pathOptions:f,interactionWidth:p})=>{const[h,y,b]=Du({sourceX:s,sourceY:n,sourcePosition:v,targetX:r,targetY:o,targetPosition:w,borderRadius:f==null?void 0:f.borderRadius,offset:f==null?void 0:f.offset,stepPosition:f==null?void 0:f.stepPosition}),C=e.isInternal?void 0:t;return S.jsx(kl,{id:C,path:h,labelX:y,labelY:b,label:c,labelStyle:i,labelShowBg:a,labelBgStyle:d,labelBgPadding:g,labelBgBorderRadius:l,style:m,markerEnd:_,markerStart:u,interactionWidth:p})})}const Fv=$v({isInternal:!1}),Hv=$v({isInternal:!0});Fv.displayName="SmoothStepEdge";Hv.displayName="SmoothStepEdgeInternal";function zv(e){return B.memo(({id:t,...s})=>{var r;const n=e.isInternal?void 0:t;return S.jsx(Fv,{...s,id:n,pathOptions:B.useMemo(()=>{var o;return{borderRadius:0,offset:(o=s.pathOptions)==null?void 0:o.offset}},[(r=s.pathOptions)==null?void 0:r.offset])})})}const F5=zv({isInternal:!1}),Wv=zv({isInternal:!0});F5.displayName="StepEdge";Wv.displayName="StepEdgeInternal";function Uv(e){return B.memo(({id:t,sourceX:s,sourceY:n,targetX:r,targetY:o,label:c,labelStyle:i,labelShowBg:a,labelBgStyle:d,labelBgPadding:g,labelBgBorderRadius:l,style:m,markerEnd:v,markerStart:w,interactionWidth:_})=>{const[u,f,p]=iv({sourceX:s,sourceY:n,targetX:r,targetY:o}),h=e.isInternal?void 0:t;return S.jsx(kl,{id:h,path:u,labelX:f,labelY:p,label:c,labelStyle:i,labelShowBg:a,labelBgStyle:d,labelBgPadding:g,labelBgBorderRadius:l,style:m,markerEnd:v,markerStart:w,interactionWidth:_})})}const H5=Uv({isInternal:!1}),Vv=Uv({isInternal:!0});H5.displayName="StraightEdge";Vv.displayName="StraightEdgeInternal";function Kv(e){return B.memo(({id:t,sourceX:s,sourceY:n,targetX:r,targetY:o,sourcePosition:c=we.Bottom,targetPosition:i=we.Top,label:a,labelStyle:d,labelShowBg:g,labelBgStyle:l,labelBgPadding:m,labelBgBorderRadius:v,style:w,markerEnd:_,markerStart:u,pathOptions:f,interactionWidth:p})=>{const[h,y,b]=nv({sourceX:s,sourceY:n,sourcePosition:c,targetX:r,targetY:o,targetPosition:i,curvature:f==null?void 0:f.curvature}),C=e.isInternal?void 0:t;return S.jsx(kl,{id:C,path:h,labelX:y,labelY:b,label:a,labelStyle:d,labelShowBg:g,labelBgStyle:l,labelBgPadding:m,labelBgBorderRadius:v,style:w,markerEnd:_,markerStart:u,interactionWidth:p})})}const z5=Kv({isInternal:!1}),qv=Kv({isInternal:!0});z5.displayName="BezierEdge";qv.displayName="BezierEdgeInternal";const pp={default:qv,straight:Vv,step:Wv,smoothstep:Hv,simplebezier:Ov},gp={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},W5=(e,t,s)=>s===we.Left?e-t:s===we.Right?e+t:e,U5=(e,t,s)=>s===we.Top?e-t:s===we.Bottom?e+t:e,mp="react-flow__edgeupdater";function _p({position:e,centerX:t,centerY:s,radius:n=10,onMouseDown:r,onMouseEnter:o,onMouseOut:c,type:i}){return S.jsx("circle",{onMouseDown:r,onMouseEnter:o,onMouseOut:c,className:at([mp,`${mp}-${i}`]),cx:W5(t,n,e),cy:U5(s,n,e),r:n,stroke:"transparent",fill:"transparent"})}function V5({isReconnectable:e,reconnectRadius:t,edge:s,sourceX:n,sourceY:r,targetX:o,targetY:c,sourcePosition:i,targetPosition:a,onReconnect:d,onReconnectStart:g,onReconnectEnd:l,setReconnecting:m,setUpdateHover:v}){const w=Xe(),_=(y,b)=>{if(y.button!==0)return;const{autoPanOnConnect:C,domNode:E,connectionMode:x,connectionRadius:k,lib:M,onConnectStart:D,cancelConnection:R,nodeLookup:N,rfId:A,panBy:$,updateConnection:F}=w.getState(),H=b.type==="target",I=(j,O)=>{m(!1),l==null||l(j,s,b.type,O)},L=j=>d==null?void 0:d(s,j),T=(j,O)=>{m(!0),g==null||g(y,s,b.type),D==null||D(j,O)};Nu.onPointerDown(y.nativeEvent,{autoPanOnConnect:C,connectionMode:x,connectionRadius:k,domNode:E,handleId:b.id,nodeId:b.nodeId,nodeLookup:N,isTarget:H,edgeUpdaterType:b.type,lib:M,flowId:A,cancelConnection:R,panBy:$,isValidConnection:(...j)=>{var O,V;return((V=(O=w.getState()).isValidConnection)==null?void 0:V.call(O,...j))??!0},onConnect:L,onConnectStart:T,onConnectEnd:(...j)=>{var O,V;return(V=(O=w.getState()).onConnectEnd)==null?void 0:V.call(O,...j)},onReconnectEnd:I,updateConnection:F,getTransform:()=>w.getState().transform,getFromHandle:()=>w.getState().connection.fromHandle,dragThreshold:w.getState().connectionDragThreshold,handleDomNode:y.currentTarget})},u=y=>_(y,{nodeId:s.target,id:s.targetHandle??null,type:"target"}),f=y=>_(y,{nodeId:s.source,id:s.sourceHandle??null,type:"source"}),p=()=>v(!0),h=()=>v(!1);return S.jsxs(S.Fragment,{children:[(e===!0||e==="source")&&S.jsx(_p,{position:i,centerX:n,centerY:r,radius:t,onMouseDown:u,onMouseEnter:p,onMouseOut:h,type:"source"}),(e===!0||e==="target")&&S.jsx(_p,{position:a,centerX:o,centerY:c,radius:t,onMouseDown:f,onMouseEnter:p,onMouseOut:h,type:"target"})]})}function K5({id:e,edgesFocusable:t,edgesReconnectable:s,elementsSelectable:n,onClick:r,onDoubleClick:o,onContextMenu:c,onMouseEnter:i,onMouseMove:a,onMouseLeave:d,reconnectRadius:g,onReconnect:l,onReconnectStart:m,onReconnectEnd:v,rfId:w,edgeTypes:_,noPanClassName:u,onError:f,disableKeyboardA11y:p}){let h=Ae(Y=>Y.edgeLookup.get(e));const y=Ae(Y=>Y.defaultEdgeOptions);h=y?{...y,...h}:h;let b=h.type||"default",C=(_==null?void 0:_[b])||pp[b];C===void 0&&(f==null||f("011",cs.error011(b)),b="default",C=(_==null?void 0:_.default)||pp.default);const E=!!(h.focusable||t&&typeof h.focusable>"u"),x=typeof l<"u"&&(h.reconnectable||s&&typeof h.reconnectable>"u"),k=!!(h.selectable||n&&typeof h.selectable>"u"),M=B.useRef(null),[D,R]=B.useState(!1),[N,A]=B.useState(!1),$=Xe(),{zIndex:F,sourceX:H,sourceY:I,targetX:L,targetY:T,sourcePosition:j,targetPosition:O}=Ae(B.useCallback(Y=>{const ne=Y.nodeLookup.get(h.source),ie=Y.nodeLookup.get(h.target);if(!ne||!ie)return{zIndex:h.zIndex,...gp};const ce=wb({id:e,sourceNode:ne,targetNode:ie,sourceHandle:h.sourceHandle||null,targetHandle:h.targetHandle||null,connectionMode:Y.connectionMode,onError:f});return{zIndex:db({selected:h.selected,zIndex:h.zIndex,sourceNode:ne,targetNode:ie,elevateOnSelect:Y.elevateEdgesOnSelect,zIndexMode:Y.zIndexMode}),...ce||gp}},[h.source,h.target,h.sourceHandle,h.targetHandle,h.selected,h.zIndex]),Ge),V=B.useMemo(()=>h.markerStart?`url('#${Au(h.markerStart,w)}')`:void 0,[h.markerStart,w]),q=B.useMemo(()=>h.markerEnd?`url('#${Au(h.markerEnd,w)}')`:void 0,[h.markerEnd,w]);if(h.hidden||H===null||I===null||L===null||T===null)return null;const J=Y=>{var fe;const{addSelectedEdges:ne,unselectNodesAndEdges:ie,multiSelectionActive:ce}=$.getState();k&&($.setState({nodesSelectionActive:!1}),h.selected&&ce?(ie({nodes:[],edges:[h]}),(fe=M.current)==null||fe.blur()):ne([e])),r&&r(Y,h)},Q=o?Y=>{o(Y,{...h})}:void 0,z=c?Y=>{c(Y,{...h})}:void 0,P=i?Y=>{i(Y,{...h})}:void 0,K=a?Y=>{a(Y,{...h})}:void 0,U=d?Y=>{d(Y,{...h})}:void 0,Z=Y=>{var ne;if(!p&&z_.includes(Y.key)&&k){const{unselectNodesAndEdges:ie,addSelectedEdges:ce}=$.getState();Y.key==="Escape"?((ne=M.current)==null||ne.blur(),ie({edges:[h]})):ce([e])}};return S.jsx("svg",{style:{zIndex:F},children:S.jsxs("g",{className:at(["react-flow__edge",`react-flow__edge-${b}`,h.className,u,{selected:h.selected,animated:h.animated,inactive:!k&&!r,updating:D,selectable:k}]),onClick:J,onDoubleClick:Q,onContextMenu:z,onMouseEnter:P,onMouseMove:K,onMouseLeave:U,onKeyDown:E?Z:void 0,tabIndex:E?0:void 0,role:h.ariaRole??(E?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":h.ariaLabel===null?void 0:h.ariaLabel||`Edge from ${h.source} to ${h.target}`,"aria-describedby":E?`${bv}-${w}`:void 0,ref:M,...h.domAttributes,children:[!N&&S.jsx(C,{id:e,source:h.source,target:h.target,type:h.type,selected:h.selected,animated:h.animated,selectable:k,deletable:h.deletable??!0,label:h.label,labelStyle:h.labelStyle,labelShowBg:h.labelShowBg,labelBgStyle:h.labelBgStyle,labelBgPadding:h.labelBgPadding,labelBgBorderRadius:h.labelBgBorderRadius,sourceX:H,sourceY:I,targetX:L,targetY:T,sourcePosition:j,targetPosition:O,data:h.data,style:h.style,sourceHandleId:h.sourceHandle,targetHandleId:h.targetHandle,markerStart:V,markerEnd:q,pathOptions:"pathOptions"in h?h.pathOptions:void 0,interactionWidth:h.interactionWidth}),x&&S.jsx(V5,{edge:h,isReconnectable:x,reconnectRadius:g,onReconnect:l,onReconnectStart:m,onReconnectEnd:v,sourceX:H,sourceY:I,targetX:L,targetY:T,sourcePosition:j,targetPosition:O,setUpdateHover:R,setReconnecting:A})]})})}var q5=B.memo(K5);const G5=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function Gv({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:s,edgeTypes:n,noPanClassName:r,onReconnect:o,onEdgeContextMenu:c,onEdgeMouseEnter:i,onEdgeMouseMove:a,onEdgeMouseLeave:d,onEdgeClick:g,reconnectRadius:l,onEdgeDoubleClick:m,onReconnectStart:v,onReconnectEnd:w,disableKeyboardA11y:_}){const{edgesFocusable:u,edgesReconnectable:f,elementsSelectable:p,onError:h}=Ae(G5,Ge),y=T5(t);return S.jsxs("div",{className:"react-flow__edges",children:[S.jsx(j5,{defaultColor:e,rfId:s}),y.map(b=>S.jsx(q5,{id:b,edgesFocusable:u,edgesReconnectable:f,elementsSelectable:p,noPanClassName:r,onReconnect:o,onContextMenu:c,onMouseEnter:i,onMouseMove:a,onMouseLeave:d,onClick:g,reconnectRadius:l,onDoubleClick:m,onReconnectStart:v,onReconnectEnd:w,rfId:s,onError:h,edgeTypes:n,disableKeyboardA11y:_},b))]})}Gv.displayName="EdgeRenderer";const X5=B.memo(Gv),Y5=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function Q5({children:e}){const t=Ae(Y5);return S.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function Z5(e){const t=bl(),s=B.useRef(!1);B.useEffect(()=>{!s.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),s.current=!0)},[e,t.viewportInitialized])}const J5=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function e2(e){const t=Ae(J5),s=Xe();return B.useEffect(()=>{e&&(t==null||t(e),s.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function t2(e){return e.connection.inProgress?{...e.connection,to:Ar(e.connection.to,e.transform)}:{...e.connection}}function s2(e){return t2}function n2(e){const t=s2();return Ae(t,Ge)}const r2=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function i2({containerStyle:e,style:t,type:s,component:n}){const{nodesConnectable:r,width:o,height:c,isValid:i,inProgress:a}=Ae(r2,Ge);return!(o&&r&&a)?null:S.jsx("svg",{style:e,width:o,height:c,className:"react-flow__connectionline react-flow__container",children:S.jsx("g",{className:at(["react-flow__connection",V_(i)]),children:S.jsx(Xv,{style:t,type:s,CustomComponent:n,isValid:i})})})}const Xv=({style:e,type:t=Vs.Bezier,CustomComponent:s,isValid:n})=>{const{inProgress:r,from:o,fromNode:c,fromHandle:i,fromPosition:a,to:d,toNode:g,toHandle:l,toPosition:m,pointer:v}=n2();if(!r)return;if(s)return S.jsx(s,{connectionLineType:t,connectionLineStyle:e,fromNode:c,fromHandle:i,fromX:o.x,fromY:o.y,toX:d.x,toY:d.y,fromPosition:a,toPosition:m,connectionStatus:V_(n),toNode:g,toHandle:l,pointer:v});let w="";const _={sourceX:o.x,sourceY:o.y,sourcePosition:a,targetX:d.x,targetY:d.y,targetPosition:m};switch(t){case Vs.Bezier:[w]=nv(_);break;case Vs.SimpleBezier:[w]=Bv(_);break;case Vs.Step:[w]=Du({..._,borderRadius:0});break;case Vs.SmoothStep:[w]=Du(_);break;default:[w]=iv(_)}return S.jsx("path",{d:w,fill:"none",className:"react-flow__connection-path",style:e})};Xv.displayName="ConnectionLine";const o2={};function vp(e=o2){B.useRef(e),Xe(),B.useEffect(()=>{},[e])}function a2(){Xe(),B.useRef(!1),B.useEffect(()=>{},[])}function Yv({nodeTypes:e,edgeTypes:t,onInit:s,onNodeClick:n,onEdgeClick:r,onNodeDoubleClick:o,onEdgeDoubleClick:c,onNodeMouseEnter:i,onNodeMouseMove:a,onNodeMouseLeave:d,onNodeContextMenu:g,onSelectionContextMenu:l,onSelectionStart:m,onSelectionEnd:v,connectionLineType:w,connectionLineStyle:_,connectionLineComponent:u,connectionLineContainerStyle:f,selectionKeyCode:p,selectionOnDrag:h,selectionMode:y,multiSelectionKeyCode:b,panActivationKeyCode:C,zoomActivationKeyCode:E,deleteKeyCode:x,onlyRenderVisibleElements:k,elementsSelectable:M,defaultViewport:D,translateExtent:R,minZoom:N,maxZoom:A,preventScrolling:$,defaultMarkerColor:F,zoomOnScroll:H,zoomOnPinch:I,panOnScroll:L,panOnScrollSpeed:T,panOnScrollMode:j,zoomOnDoubleClick:O,panOnDrag:V,autoPanOnSelection:q,onPaneClick:J,onPaneMouseEnter:Q,onPaneMouseMove:z,onPaneMouseLeave:P,onPaneScroll:K,onPaneContextMenu:U,paneClickDistance:Z,nodeClickDistance:Y,onEdgeContextMenu:ne,onEdgeMouseEnter:ie,onEdgeMouseMove:ce,onEdgeMouseLeave:fe,reconnectRadius:ae,onReconnect:Pe,onReconnectStart:We,onReconnectEnd:ve,noDragClassName:me,noWheelClassName:xe,noPanClassName:le,disableKeyboardA11y:_e,nodeExtent:Ce,rfId:ke,viewport:$e,onViewportChange:Be}){return vp(e),vp(t),a2(),Z5(s),e2($e),S.jsx(x5,{onPaneClick:J,onPaneMouseEnter:Q,onPaneMouseMove:z,onPaneMouseLeave:P,onPaneContextMenu:U,onPaneScroll:K,paneClickDistance:Z,deleteKeyCode:x,selectionKeyCode:p,selectionOnDrag:h,selectionMode:y,onSelectionStart:m,onSelectionEnd:v,multiSelectionKeyCode:b,panActivationKeyCode:C,zoomActivationKeyCode:E,elementsSelectable:M,zoomOnScroll:H,zoomOnPinch:I,zoomOnDoubleClick:O,panOnScroll:L,panOnScrollSpeed:T,panOnScrollMode:j,panOnDrag:V,autoPanOnSelection:q,defaultViewport:D,translateExtent:R,minZoom:N,maxZoom:A,onSelectionContextMenu:l,preventScrolling:$,noDragClassName:me,noWheelClassName:xe,noPanClassName:le,disableKeyboardA11y:_e,onViewportChange:Be,isControlledViewport:!!$e,children:S.jsxs(Q5,{children:[S.jsx(X5,{edgeTypes:t,onEdgeClick:r,onEdgeDoubleClick:c,onReconnect:Pe,onReconnectStart:We,onReconnectEnd:ve,onlyRenderVisibleElements:k,onEdgeContextMenu:ne,onEdgeMouseEnter:ie,onEdgeMouseMove:ce,onEdgeMouseLeave:fe,reconnectRadius:ae,defaultMarkerColor:F,noPanClassName:le,disableKeyboardA11y:_e,rfId:ke}),S.jsx(i2,{style:_,type:w,component:u,containerStyle:f}),S.jsx("div",{className:"react-flow__edgelabel-renderer"}),S.jsx(A5,{nodeTypes:e,onNodeClick:n,onNodeDoubleClick:o,onNodeMouseEnter:i,onNodeMouseMove:a,onNodeMouseLeave:d,onNodeContextMenu:g,nodeClickDistance:Y,onlyRenderVisibleElements:k,noPanClassName:le,noDragClassName:me,disableKeyboardA11y:_e,nodeExtent:Ce,rfId:ke}),S.jsx("div",{className:"react-flow__viewport-portal"})]})})}Yv.displayName="GraphView";const l2=B.memo(Yv),c2=Y_(),yp=({nodes:e,edges:t,defaultNodes:s,defaultEdges:n,width:r,height:o,fitView:c,fitViewOptions:i,minZoom:a=.5,maxZoom:d=2,nodeOrigin:g,nodeExtent:l,zIndexMode:m="basic"}={})=>{const v=new Map,w=new Map,_=new Map,u=new Map,f=n??t??[],p=s??e??[],h=g??[0,0],y=l??Bi;lv(_,u,f);const{nodesInitialized:b}=Tu(p,v,w,{nodeOrigin:h,nodeExtent:y,zIndexMode:m});let C=[0,0,1];if(c&&r&&o){const E=eo(v,{filter:D=>!!((D.width||D.initialWidth)&&(D.height||D.initialHeight))}),{x,y:k,zoom:M}=Wh(E,r,o,a,d,(i==null?void 0:i.padding)??.1);C=[x,k,M]}return{rfId:"1",width:r??0,height:o??0,transform:C,nodes:p,nodesInitialized:b,nodeLookup:v,parentLookup:w,edges:f,edgeLookup:u,connectionLookup:_,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:s!==void 0,hasDefaultEdges:n!==void 0,panZoom:null,minZoom:a,maxZoom:d,translateExtent:Bi,nodeExtent:y,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:Sr.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:h,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:c??!1,fitViewOptions:i,fitViewResolver:null,connection:{...U_},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:c2,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:W_,zIndexMode:m,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},u2=({nodes:e,edges:t,defaultNodes:s,defaultEdges:n,width:r,height:o,fitView:c,fitViewOptions:i,minZoom:a,maxZoom:d,nodeOrigin:g,nodeExtent:l,zIndexMode:m})=>CE((v,w)=>{async function _(){const{nodeLookup:u,panZoom:f,fitViewOptions:p,fitViewResolver:h,width:y,height:b,minZoom:C,maxZoom:E}=w();f&&(await ib({nodes:u,width:y,height:b,panZoom:f,minZoom:C,maxZoom:E},p),h==null||h.resolve(!0),v({fitViewResolver:null}))}return{...yp({nodes:e,edges:t,width:r,height:o,fitView:c,fitViewOptions:i,minZoom:a,maxZoom:d,nodeOrigin:g,nodeExtent:l,defaultNodes:s,defaultEdges:n,zIndexMode:m}),setNodes:u=>{const{nodeLookup:f,parentLookup:p,nodeOrigin:h,elevateNodesOnSelect:y,fitViewQueued:b,zIndexMode:C,nodesSelectionActive:E}=w(),{nodesInitialized:x,hasSelectedNodes:k}=Tu(u,f,p,{nodeOrigin:h,nodeExtent:l,elevateNodesOnSelect:y,checkEquality:!0,zIndexMode:C}),M=E&&k;b&&x?(_(),v({nodes:u,nodesInitialized:x,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:M})):v({nodes:u,nodesInitialized:x,nodesSelectionActive:M})},setEdges:u=>{const{connectionLookup:f,edgeLookup:p}=w();lv(f,p,u),v({edges:u})},setDefaultNodesAndEdges:(u,f)=>{if(u){const{setNodes:p}=w();p(u),v({hasDefaultNodes:!0})}if(f){const{setEdges:p}=w();p(f),v({hasDefaultEdges:!0})}},updateNodeInternals:u=>{const{triggerNodeChanges:f,nodeLookup:p,parentLookup:h,domNode:y,nodeOrigin:b,nodeExtent:C,debug:E,fitViewQueued:x,zIndexMode:k}=w(),{changes:M,updatedInternals:D}=Mb(u,p,h,y,b,C,k);D&&(bb(p,h,{nodeOrigin:b,nodeExtent:C,zIndexMode:k}),x?(_(),v({fitViewQueued:!1,fitViewOptions:void 0})):v({}),(M==null?void 0:M.length)>0&&(E&&console.log("React Flow: trigger node changes",M),f==null||f(M)))},updateNodePositions:(u,f=!1)=>{const p=[];let h=[];const{nodeLookup:y,triggerNodeChanges:b,connection:C,updateConnection:E,onNodesChangeMiddlewareMap:x}=w();for(const[k,M]of u){const D=y.get(k),R=!!(D!=null&&D.expandParent&&(D!=null&&D.parentId)&&(M!=null&&M.position)),N={id:k,type:"position",position:R?{x:Math.max(0,M.position.x),y:Math.max(0,M.position.y)}:M.position,dragging:f};if(D&&C.inProgress&&C.fromNode.id===D.id){const A=Tn(D,C.fromHandle,we.Left,!0);E({...C,from:A})}R&&D.parentId&&p.push({id:k,parentId:D.parentId,rect:{...M.internals.positionAbsolute,width:M.measured.width??0,height:M.measured.height??0}}),h.push(N)}if(p.length>0){const{parentLookup:k,nodeOrigin:M}=w(),D=Xh(p,y,k,M);h.push(...D)}for(const k of x.values())h=k(h);b(h)},triggerNodeChanges:u=>{const{onNodesChange:f,setNodes:p,nodes:h,hasDefaultNodes:y,debug:b}=w();if(u!=null&&u.length){if(y){const C=UE(u,h);p(C)}b&&console.log("React Flow: trigger node changes",u),f==null||f(u)}},triggerEdgeChanges:u=>{const{onEdgesChange:f,setEdges:p,edges:h,hasDefaultEdges:y,debug:b}=w();if(u!=null&&u.length){if(y){const C=VE(u,h);p(C)}b&&console.log("React Flow: trigger edge changes",u),f==null||f(u)}},addSelectedNodes:u=>{const{multiSelectionActive:f,edgeLookup:p,nodeLookup:h,triggerNodeChanges:y,triggerEdgeChanges:b}=w();if(f){const C=u.map(E=>fn(E,!0));y(C);return}y(sr(h,new Set([...u]),!0)),b(sr(p))},addSelectedEdges:u=>{const{multiSelectionActive:f,edgeLookup:p,nodeLookup:h,triggerNodeChanges:y,triggerEdgeChanges:b}=w();if(f){const C=u.map(E=>fn(E,!0));b(C);return}b(sr(p,new Set([...u]))),y(sr(h,new Set,!0))},unselectNodesAndEdges:({nodes:u,edges:f}={})=>{const{edges:p,nodes:h,nodeLookup:y,triggerNodeChanges:b,triggerEdgeChanges:C}=w(),E=u||h,x=f||p,k=[];for(const D of E){if(!D.selected)continue;const R=y.get(D.id);R&&(R.selected=!1),k.push(fn(D.id,!1))}const M=[];for(const D of x)D.selected&&M.push(fn(D.id,!1));b(k),C(M)},setMinZoom:u=>{const{panZoom:f,maxZoom:p}=w();f==null||f.setScaleExtent([u,p]),v({minZoom:u})},setMaxZoom:u=>{const{panZoom:f,minZoom:p}=w();f==null||f.setScaleExtent([p,u]),v({maxZoom:u})},setTranslateExtent:u=>{var f;(f=w().panZoom)==null||f.setTranslateExtent(u),v({translateExtent:u})},resetSelectedElements:()=>{const{edges:u,nodes:f,triggerNodeChanges:p,triggerEdgeChanges:h,elementsSelectable:y}=w();if(!y)return;const b=f.reduce((E,x)=>x.selected?[...E,fn(x.id,!1)]:E,[]),C=u.reduce((E,x)=>x.selected?[...E,fn(x.id,!1)]:E,[]);p(b),h(C)},setNodeExtent:u=>{const{nodes:f,nodeLookup:p,parentLookup:h,nodeOrigin:y,elevateNodesOnSelect:b,nodeExtent:C,zIndexMode:E}=w();u[0][0]===C[0][0]&&u[0][1]===C[0][1]&&u[1][0]===C[1][0]&&u[1][1]===C[1][1]||(Tu(f,p,h,{nodeOrigin:y,nodeExtent:u,elevateNodesOnSelect:b,checkEquality:!1,zIndexMode:E}),v({nodeExtent:u}))},panBy:u=>{const{transform:f,width:p,height:h,panZoom:y,translateExtent:b}=w();return Rb({delta:u,panZoom:y,transform:f,translateExtent:b,width:p,height:h})},setCenter:async(u,f,p)=>{const{width:h,height:y,maxZoom:b,panZoom:C}=w();if(!C)return!1;const E=typeof(p==null?void 0:p.zoom)<"u"?p.zoom:b;return await C.setViewport({x:h/2-u*E,y:y/2-f*E,zoom:E},{duration:p==null?void 0:p.duration,ease:p==null?void 0:p.ease,interpolate:p==null?void 0:p.interpolate}),!0},cancelConnection:()=>{v({connection:{...U_}})},updateConnection:u=>{v({connection:u})},reset:()=>v({...yp()})}},Object.is);function Qv({initialNodes:e,initialEdges:t,defaultNodes:s,defaultEdges:n,initialWidth:r,initialHeight:o,initialMinZoom:c,initialMaxZoom:i,initialFitViewOptions:a,fitView:d,nodeOrigin:g,nodeExtent:l,zIndexMode:m,children:v}){const[w]=B.useState(()=>u2({nodes:e,edges:t,defaultNodes:s,defaultEdges:n,width:r,height:o,fitView:d,minZoom:c,maxZoom:i,fitViewOptions:a,nodeOrigin:g,nodeExtent:l,zIndexMode:m}));return S.jsx(bE,{value:w,children:S.jsx(QE,{children:v})})}function h2({children:e,nodes:t,edges:s,defaultNodes:n,defaultEdges:r,width:o,height:c,fitView:i,fitViewOptions:a,minZoom:d,maxZoom:g,nodeOrigin:l,nodeExtent:m,zIndexMode:v}){return B.useContext(xl)?S.jsx(S.Fragment,{children:e}):S.jsx(Qv,{initialNodes:t,initialEdges:s,defaultNodes:n,defaultEdges:r,initialWidth:o,initialHeight:c,fitView:i,initialFitViewOptions:a,initialMinZoom:d,initialMaxZoom:g,nodeOrigin:l,nodeExtent:m,zIndexMode:v,children:e})}const d2={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function f2({nodes:e,edges:t,defaultNodes:s,defaultEdges:n,className:r,nodeTypes:o,edgeTypes:c,onNodeClick:i,onEdgeClick:a,onInit:d,onMove:g,onMoveStart:l,onMoveEnd:m,onConnect:v,onConnectStart:w,onConnectEnd:_,onClickConnectStart:u,onClickConnectEnd:f,onNodeMouseEnter:p,onNodeMouseMove:h,onNodeMouseLeave:y,onNodeContextMenu:b,onNodeDoubleClick:C,onNodeDragStart:E,onNodeDrag:x,onNodeDragStop:k,onNodesDelete:M,onEdgesDelete:D,onDelete:R,onSelectionChange:N,onSelectionDragStart:A,onSelectionDrag:$,onSelectionDragStop:F,onSelectionContextMenu:H,onSelectionStart:I,onSelectionEnd:L,onBeforeDelete:T,connectionMode:j,connectionLineType:O=Vs.Bezier,connectionLineStyle:V,connectionLineComponent:q,connectionLineContainerStyle:J,deleteKeyCode:Q="Backspace",selectionKeyCode:z="Shift",selectionOnDrag:P=!1,selectionMode:K=ji.Full,panActivationKeyCode:U="Space",multiSelectionKeyCode:Z=Fi()?"Meta":"Control",zoomActivationKeyCode:Y=Fi()?"Meta":"Control",snapToGrid:ne,snapGrid:ie,onlyRenderVisibleElements:ce=!1,selectNodesOnDrag:fe,nodesDraggable:ae,autoPanOnNodeFocus:Pe,nodesConnectable:We,nodesFocusable:ve,nodeOrigin:me=Ev,edgesFocusable:xe,edgesReconnectable:le,elementsSelectable:_e=!0,defaultViewport:Ce=jE,minZoom:ke=.5,maxZoom:$e=2,translateExtent:Be=Bi,preventScrolling:Fe=!0,nodeExtent:Me,defaultMarkerColor:De="#b1b1b7",zoomOnScroll:Se=!0,zoomOnPinch:vt=!0,panOnScroll:ft=!1,panOnScrollSpeed:X=.5,panOnScrollMode:te=xn.Free,zoomOnDoubleClick:ue=!0,panOnDrag:Ee=!0,onPaneClick:ye,onPaneMouseEnter:et,onPaneMouseMove:It,onPaneMouseLeave:rt,onPaneScroll:ut,onPaneContextMenu:js,paneClickDistance:se=1,nodeClickDistance:he=0,children:ge,onReconnect:Le,onReconnectStart:Ue,onReconnectEnd:ee,onEdgeContextMenu:st,onEdgeDoubleClick:He,onEdgeMouseEnter:Tr,onEdgeMouseMove:Ml,onEdgeMouseLeave:Rl,reconnectRadius:jn=10,onNodesChange:Dl,onEdgesChange:Nr,noDragClassName:oo="nodrag",noWheelClassName:ao="nowheel",noPanClassName:lo="nopan",fitView:co,fitViewOptions:Pr,connectOnClick:Ir,attributionPosition:uo,proOptions:ho,defaultEdgeOptions:fo,elevateNodesOnSelect:po=!0,elevateEdgesOnSelect:cn=!1,disableKeyboardA11y:go=!1,autoPanOnConnect:mo,autoPanOnNodeDrag:Al,autoPanOnSelection:Tl=!0,autoPanSpeed:Nl,connectionRadius:On,isValidConnection:_o,onError:Pl,style:Il,id:vo,nodeDragThreshold:W,connectionDragThreshold:G,viewport:re,onViewportChange:pe,width:Te,height:je,colorMode:Ye="light",debug:it,onScroll:Ie,ariaLabelConfig:hs,zIndexMode:un="basic",...Qt},Br){const $n=vo||"1",yo=HE(Ye),Bl=B.useCallback(jr=>{jr.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),Ie==null||Ie(jr)},[Ie]);return S.jsx("div",{"data-testid":"rf__wrapper",...Qt,onScroll:Bl,style:{...Il,...d2},ref:Br,className:at(["react-flow",r,yo]),id:vo,role:"application",children:S.jsxs(h2,{nodes:e,edges:t,width:Te,height:je,fitView:co,fitViewOptions:Pr,minZoom:ke,maxZoom:$e,nodeOrigin:me,nodeExtent:Me,zIndexMode:un,children:[S.jsx(FE,{nodes:e,edges:t,defaultNodes:s,defaultEdges:n,onConnect:v,onConnectStart:w,onConnectEnd:_,onClickConnectStart:u,onClickConnectEnd:f,nodesDraggable:ae,autoPanOnNodeFocus:Pe,nodesConnectable:We,nodesFocusable:ve,edgesFocusable:xe,edgesReconnectable:le,elementsSelectable:_e,elevateNodesOnSelect:po,elevateEdgesOnSelect:cn,minZoom:ke,maxZoom:$e,nodeExtent:Me,onNodesChange:Dl,onEdgesChange:Nr,snapToGrid:ne,snapGrid:ie,connectionMode:j,translateExtent:Be,connectOnClick:Ir,defaultEdgeOptions:fo,fitView:co,fitViewOptions:Pr,onNodesDelete:M,onEdgesDelete:D,onDelete:R,onNodeDragStart:E,onNodeDrag:x,onNodeDragStop:k,onSelectionDrag:$,onSelectionDragStart:A,onSelectionDragStop:F,onMove:g,onMoveStart:l,onMoveEnd:m,noPanClassName:lo,nodeOrigin:me,rfId:$n,autoPanOnConnect:mo,autoPanOnNodeDrag:Al,autoPanSpeed:Nl,onError:Pl,connectionRadius:On,isValidConnection:_o,selectNodesOnDrag:fe,nodeDragThreshold:W,connectionDragThreshold:G,onBeforeDelete:T,debug:it,ariaLabelConfig:hs,zIndexMode:un}),S.jsx(l2,{onInit:d,onNodeClick:i,onEdgeClick:a,onNodeMouseEnter:p,onNodeMouseMove:h,onNodeMouseLeave:y,onNodeContextMenu:b,onNodeDoubleClick:C,nodeTypes:o,edgeTypes:c,connectionLineType:O,connectionLineStyle:V,connectionLineComponent:q,connectionLineContainerStyle:J,selectionKeyCode:z,selectionOnDrag:P,selectionMode:K,deleteKeyCode:Q,multiSelectionKeyCode:Z,panActivationKeyCode:U,zoomActivationKeyCode:Y,onlyRenderVisibleElements:ce,defaultViewport:Ce,translateExtent:Be,minZoom:ke,maxZoom:$e,preventScrolling:Fe,zoomOnScroll:Se,zoomOnPinch:vt,zoomOnDoubleClick:ue,panOnScroll:ft,panOnScrollSpeed:X,panOnScrollMode:te,panOnDrag:Ee,autoPanOnSelection:Tl,onPaneClick:ye,onPaneMouseEnter:et,onPaneMouseMove:It,onPaneMouseLeave:rt,onPaneScroll:ut,onPaneContextMenu:js,paneClickDistance:se,nodeClickDistance:he,onSelectionContextMenu:H,onSelectionStart:I,onSelectionEnd:L,onReconnect:Le,onReconnectStart:Ue,onReconnectEnd:ee,onEdgeContextMenu:st,onEdgeDoubleClick:He,onEdgeMouseEnter:Tr,onEdgeMouseMove:Ml,onEdgeMouseLeave:Rl,reconnectRadius:jn,defaultMarkerColor:De,noDragClassName:oo,noWheelClassName:ao,noPanClassName:lo,rfId:$n,disableKeyboardA11y:go,nodeExtent:Me,viewport:re,onViewportChange:pe}),S.jsx(BE,{onSelectionChange:N}),ge,S.jsx(AE,{proOptions:ho,position:uo}),S.jsx(DE,{rfId:$n,disableKeyboardA11y:go})]})})}var p2=Lv(f2);function g2({dimensions:e,lineWidth:t,variant:s,className:n}){return S.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:at(["react-flow__background-pattern",s,n])})}function m2({radius:e,className:t}){return S.jsx("circle",{cx:e,cy:e,r:e,className:at(["react-flow__background-pattern","dots",t])})}var sn;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(sn||(sn={}));const _2={[sn.Dots]:1,[sn.Lines]:1,[sn.Cross]:6},v2=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function Zv({id:e,variant:t=sn.Dots,gap:s=20,size:n,lineWidth:r=1,offset:o=0,color:c,bgColor:i,style:a,className:d,patternClassName:g}){const l=B.useRef(null),{transform:m,patternId:v}=Ae(v2,Ge),w=n||_2[t],_=t===sn.Dots,u=t===sn.Cross,f=Array.isArray(s)?s:[s,s],p=[f[0]*m[2]||1,f[1]*m[2]||1],h=w*m[2],y=Array.isArray(o)?o:[o,o],b=u?[h,h]:p,C=[y[0]*m[2]||1+b[0]/2,y[1]*m[2]||1+b[1]/2],E=`${v}${e||""}`;return S.jsxs("svg",{className:at(["react-flow__background",d]),style:{...a,...El,"--xy-background-color-props":i,"--xy-background-pattern-color-props":c},ref:l,"data-testid":"rf__background",children:[S.jsx("pattern",{id:E,x:m[0]%p[0],y:m[1]%p[1],width:p[0],height:p[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${C[0]},-${C[1]})`,children:_?S.jsx(m2,{radius:h/2,className:g}):S.jsx(g2,{dimensions:b,lineWidth:r,variant:t,className:g})}),S.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${E})`})]})}Zv.displayName="Background";B.memo(Zv);function y2(){return S.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:S.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function w2(){return S.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:S.jsx("path",{d:"M0 0h32v4.2H0z"})})}function S2(){return S.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:S.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 x2(){return S.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:S.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 C2(){return S.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:S.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 Vo({children:e,className:t,...s}){return S.jsx("button",{type:"button",className:at(["react-flow__controls-button",t]),...s,children:e})}const b2=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function Jv({style:e,showZoom:t=!0,showFitView:s=!0,showInteractive:n=!0,fitViewOptions:r,onZoomIn:o,onZoomOut:c,onFitView:i,onInteractiveChange:a,className:d,children:g,position:l="bottom-left",orientation:m="vertical","aria-label":v}){const w=Xe(),{isInteractive:_,minZoomReached:u,maxZoomReached:f,ariaLabelConfig:p}=Ae(b2,Ge),{zoomIn:h,zoomOut:y,fitView:b}=bl(),C=()=>{h(),o==null||o()},E=()=>{y(),c==null||c()},x=()=>{b(r),i==null||i()},k=()=>{w.setState({nodesDraggable:!_,nodesConnectable:!_,elementsSelectable:!_}),a==null||a(!_)},M=m==="horizontal"?"horizontal":"vertical";return S.jsxs(Cl,{className:at(["react-flow__controls",M,d]),position:l,style:e,"data-testid":"rf__controls","aria-label":v??p["controls.ariaLabel"],children:[t&&S.jsxs(S.Fragment,{children:[S.jsx(Vo,{onClick:C,className:"react-flow__controls-zoomin",title:p["controls.zoomIn.ariaLabel"],"aria-label":p["controls.zoomIn.ariaLabel"],disabled:f,children:S.jsx(y2,{})}),S.jsx(Vo,{onClick:E,className:"react-flow__controls-zoomout",title:p["controls.zoomOut.ariaLabel"],"aria-label":p["controls.zoomOut.ariaLabel"],disabled:u,children:S.jsx(w2,{})})]}),s&&S.jsx(Vo,{className:"react-flow__controls-fitview",onClick:x,title:p["controls.fitView.ariaLabel"],"aria-label":p["controls.fitView.ariaLabel"],children:S.jsx(S2,{})}),n&&S.jsx(Vo,{className:"react-flow__controls-interactive",onClick:k,title:p["controls.interactive.ariaLabel"],"aria-label":p["controls.interactive.ariaLabel"],children:_?S.jsx(C2,{}):S.jsx(x2,{})}),g]})}Jv.displayName="Controls";B.memo(Jv);function E2({id:e,x:t,y:s,width:n,height:r,style:o,color:c,strokeColor:i,strokeWidth:a,className:d,borderRadius:g,shapeRendering:l,selected:m,onClick:v}){const{background:w,backgroundColor:_}=o||{},u=c||w||_;return S.jsx("rect",{className:at(["react-flow__minimap-node",{selected:m},d]),x:t,y:s,rx:g,ry:g,width:n,height:r,style:{fill:u,stroke:i,strokeWidth:a},shapeRendering:l,onClick:v?f=>v(f,e):void 0})}const k2=B.memo(E2),L2=e=>e.nodes.map(t=>t.id),vc=e=>e instanceof Function?e:()=>e;function M2({nodeStrokeColor:e,nodeColor:t,nodeClassName:s="",nodeBorderRadius:n=5,nodeStrokeWidth:r,nodeComponent:o=k2,onClick:c}){const i=Ae(L2,Ge),a=vc(t),d=vc(e),g=vc(s),l=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return S.jsx(S.Fragment,{children:i.map(m=>S.jsx(D2,{id:m,nodeColorFunc:a,nodeStrokeColorFunc:d,nodeClassNameFunc:g,nodeBorderRadius:n,nodeStrokeWidth:r,NodeComponent:o,onClick:c,shapeRendering:l},m))})}function R2({id:e,nodeColorFunc:t,nodeStrokeColorFunc:s,nodeClassNameFunc:n,nodeBorderRadius:r,nodeStrokeWidth:o,shapeRendering:c,NodeComponent:i,onClick:a}){const{node:d,x:g,y:l,width:m,height:v}=Ae(w=>{const _=w.nodeLookup.get(e);if(!_)return{node:void 0,x:0,y:0,width:0,height:0};const u=_.internals.userNode,{x:f,y:p}=_.internals.positionAbsolute,{width:h,height:y}=Bs(u);return{node:u,x:f,y:p,width:h,height:y}},Ge);return!d||d.hidden||!Q_(d)?null:S.jsx(i,{x:g,y:l,width:m,height:v,style:d.style,selected:!!d.selected,className:n(d),color:t(d),borderRadius:r,strokeColor:s(d),strokeWidth:o,shapeRendering:c,onClick:a,id:d.id})}const D2=B.memo(R2);var A2=B.memo(M2);const T2=200,N2=150,P2=e=>!e.hidden,I2=e=>{const t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:t,boundingRect:e.nodeLookup.size>0?X_(eo(e.nodeLookup,{filter:P2}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},B2="react-flow__minimap-desc";function e0({style:e,className:t,nodeStrokeColor:s,nodeColor:n,nodeClassName:r="",nodeBorderRadius:o=5,nodeStrokeWidth:c,nodeComponent:i,bgColor:a,maskColor:d,maskStrokeColor:g,maskStrokeWidth:l,position:m="bottom-right",onClick:v,onNodeClick:w,pannable:_=!1,zoomable:u=!1,ariaLabel:f,inversePan:p,zoomStep:h=1,offsetScale:y=5}){const b=Xe(),C=B.useRef(null),{boundingRect:E,viewBB:x,rfId:k,panZoom:M,translateExtent:D,flowWidth:R,flowHeight:N,ariaLabelConfig:A}=Ae(I2,Ge),$=(e==null?void 0:e.width)??T2,F=(e==null?void 0:e.height)??N2,H=E.width/$,I=E.height/F,L=Math.max(H,I),T=L*$,j=L*F,O=y*L,V=E.x-(T-E.width)/2-O,q=E.y-(j-E.height)/2-O,J=T+O*2,Q=j+O*2,z=`${B2}-${k}`,P=B.useRef(0),K=B.useRef();P.current=L,B.useEffect(()=>{if(C.current&&M)return K.current=Ob({domNode:C.current,panZoom:M,getTransform:()=>b.getState().transform,getViewScale:()=>P.current}),()=>{var ne;(ne=K.current)==null||ne.destroy()}},[M]),B.useEffect(()=>{var ne;(ne=K.current)==null||ne.update({translateExtent:D,width:R,height:N,inversePan:p,pannable:_,zoomStep:h,zoomable:u})},[_,u,p,h,D,R,N]);const U=v?ne=>{var fe;const[ie,ce]=((fe=K.current)==null?void 0:fe.pointer(ne))||[0,0];v(ne,{x:ie,y:ce})}:void 0,Z=w?B.useCallback((ne,ie)=>{const ce=b.getState().nodeLookup.get(ie).internals.userNode;w(ne,ce)},[]):void 0,Y=f??A["minimap.ariaLabel"];return S.jsx(Cl,{position:m,style:{...e,"--xy-minimap-background-color-props":typeof a=="string"?a:void 0,"--xy-minimap-mask-background-color-props":typeof d=="string"?d:void 0,"--xy-minimap-mask-stroke-color-props":typeof g=="string"?g:void 0,"--xy-minimap-mask-stroke-width-props":typeof l=="number"?l*L:void 0,"--xy-minimap-node-background-color-props":typeof n=="string"?n:void 0,"--xy-minimap-node-stroke-color-props":typeof s=="string"?s:void 0,"--xy-minimap-node-stroke-width-props":typeof c=="number"?c:void 0},className:at(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:S.jsxs("svg",{width:$,height:F,viewBox:`${V} ${q} ${J} ${Q}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":z,ref:C,onClick:U,children:[Y&&S.jsx("title",{id:z,children:Y}),S.jsx(A2,{onClick:Z,nodeColor:n,nodeStrokeColor:s,nodeBorderRadius:o,nodeClassName:r,nodeStrokeWidth:c,nodeComponent:i}),S.jsx("path",{className:"react-flow__minimap-mask",d:`M${V-O},${q-O}h${J+O*2}v${Q+O*2}h${-J-O*2}z
62
- M${x.x},${x.y}h${x.width}v${x.height}h${-x.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}e0.displayName="MiniMap";B.memo(e0);const j2=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,O2={[Er.Line]:"right",[Er.Handle]:"bottom-right"};function $2({nodeId:e,position:t,variant:s=Er.Handle,className:n,style:r=void 0,children:o,color:c,minWidth:i=10,minHeight:a=10,maxWidth:d=Number.MAX_VALUE,maxHeight:g=Number.MAX_VALUE,keepAspectRatio:l=!1,resizeDirection:m,autoScale:v=!0,shouldResize:w,onResizeStart:_,onResize:u,onResizeEnd:f}){const p=Av(),h=typeof e=="string"?e:p,y=Xe(),b=B.useRef(null),C=s===Er.Handle,E=Ae(B.useCallback(j2(C&&v),[C,v]),Ge),x=B.useRef(null),k=t??O2[s];B.useEffect(()=>{if(!(!b.current||!h))return x.current||(x.current=Qb({domNode:b.current,nodeId:h,getStoreItems:()=>{const{nodeLookup:D,transform:R,snapGrid:N,snapToGrid:A,nodeOrigin:$,domNode:F}=y.getState();return{nodeLookup:D,transform:R,snapGrid:N,snapToGrid:A,nodeOrigin:$,paneDomNode:F}},onChange:(D,R)=>{const{triggerNodeChanges:N,nodeLookup:A,parentLookup:$,nodeOrigin:F}=y.getState(),H=[],I={x:D.x,y:D.y},L=A.get(h);if(L&&L.expandParent&&L.parentId){const T=L.origin??F,j=D.width??L.measured.width??0,O=D.height??L.measured.height??0,V={id:L.id,parentId:L.parentId,rect:{width:j,height:O,...Z_({x:D.x??L.position.x,y:D.y??L.position.y},{width:j,height:O},L.parentId,A,T)}},q=Xh([V],A,$,F);H.push(...q),I.x=D.x?Math.max(T[0]*j,D.x):void 0,I.y=D.y?Math.max(T[1]*O,D.y):void 0}if(I.x!==void 0&&I.y!==void 0){const T={id:h,type:"position",position:{...I}};H.push(T)}if(D.width!==void 0&&D.height!==void 0){const j={id:h,type:"dimensions",resizing:!0,setAttributes:m?m==="horizontal"?"width":"height":!0,dimensions:{width:D.width,height:D.height}};H.push(j)}for(const T of R){const j={...T,type:"position"};H.push(j)}N(H)},onEnd:({width:D,height:R})=>{const N={id:h,type:"dimensions",resizing:!1,dimensions:{width:D,height:R}};y.getState().triggerNodeChanges([N])}})),x.current.update({controlPosition:k,boundaries:{minWidth:i,minHeight:a,maxWidth:d,maxHeight:g},keepAspectRatio:l,resizeDirection:m,onResizeStart:_,onResize:u,onResizeEnd:f,shouldResize:w}),()=>{var D;(D=x.current)==null||D.destroy()}},[k,i,a,d,g,l,_,u,f,w]);const M=k.split("-");return S.jsx("div",{className:at(["react-flow__resize-control","nodrag",...M,s,n]),ref:b,style:{...r,scale:E,...c&&{[C?"backgroundColor":"borderColor"]:c}},children:o})}B.memo($2);function t0(e){let t=2166136261;for(let s=0;s<(e||"").length;s++)t^=e.charCodeAt(s),t=Math.imul(t,16777619);return t>>>0}function s0(e){return t0(e)%360}function F2(e){const t=s0(e);return{bg:`hsl(${t} 55% 42%)`,fg:`hsl(${t} 70% 92%)`}}function zi(e){return`hsl(${s0(e)} 65% 50%)`}const wp=["◆","▲","●","■","★","✦","⬟","⬢","❖","◈","✸","⟡","✚","❂","◐","◑","⬣","▰","✶","⬤","✹","◇","⊛","✺"],Sp=["circle","rounded","square","hex"];function H2(e){const t=t0(e);return{seed:e,glyph:wp[(t>>>9)%wp.length],shape:Sp[(t>>>17)%Sp.length],...F2(e)}}function so({seed:e,status:t,title:s,size:n=16}){const r=H2(e),o={width:n,height:n};return S.jsx("span",{className:`avatar av-st-${t||"none"}`,title:s,style:o,children:S.jsx("span",{className:`av-face av-gen av-${r.shape}`,style:{...o,background:r.bg,color:r.fg,fontSize:n*.62},children:r.glyph})})}const Qh={common:{new:"new",none:"none",idle:"idle",sessions:"sessions",session:"session",loading:"loading…",noVersions:"no versions yet — this spec is the latest ground truth.",cancel:"cancel",save:"save",close:"close"},status:{working:"working",idle:"idle",offline:"offline",starting:"starting",review:"review",done:"done","close-pending":"close-pending",parked:"parked",error:"error",asking:"asking",queued:"queued",merged:"merged",active:"active",drift:"drift",pending:"pending"},sessionZone:{need:"needs you",run:"running",offline:"offline"},nav:{railLabel:"main navigation",graph:"Spec Node Graph (⌥1)",sessions:"Session Board (⌥2)",evals:"Evals (⌥3 / ⌥F)",issues:"Issues (⌥4)",settings:"Settings (⌥5)"},hud:{helpTitle:"help — keymap & legend (?)",loading:"loading specs from git…"},evalsFeed:{title:"evals",kind:{video:"video",image:"image",note:"note",all:"all"},staleN:({n:e})=>`${e} stale`,staleOnlyTitle:"show only stale readings (default shows fresh and stale together, newest first)",summary:({n:e})=>`${e} current`,empty:"no current readings match — measure a scenario or switch the filter.",annotate:"open & annotate"},masterList:{fold:"fold the list — the detail owns the width",unfold:"unfold the list"},annotator:{title:"annotator",hint:"click the frame to play/pause · drag to circle a problem — it becomes an anchored comment below; or ⏱ to anchor a bare note to the moment.",keys:"space play/pause · ←→ 5s (⇧ 1s) · , . frame · ↑↓ jump comment · a annotate frame",play:"play",pause:"pause",fullscreen:"fullscreen",exitFullscreen:"exit fullscreen",capturing:"capturing frame…",failed:"failed — is the backend up?",comments:({n:e})=>e?`review track (${e})`:"review track",abOlder:"older reading (‹ toward the A / reproduced bug)",abNewer:"newer reading (toward the B / verified fix ›)",abLatest:"latest",abPos:({i:e,n:t})=>`${e} / ${t}`},thread:{anchorNow:"anchor",anchorTitle:"anchor this comment to the current frame",resolved:"resolved",resolvedBy:"resolved by {by}",openRemark:"open",anchorDegraded:"this step is gone from the current reading — the m:ss is the frozen original, not seekable",originatorAlive:"alive · replies reach it live",originatorOffline:"offline · replies skip it",originatorIssue:"session that filed this issue: {by} — un-@’d replies courtesy-deliver to it while alive",originatorEval:"session that filed this eval: {by} — un-@’d remarks courtesy-deliver to it while alive"},sessionEval:{btn:"eval",btnTitle:"switch to this session's eval tab — the measured yatsu evidence, the diff, and the merge gates",none:"no evaluation for this session yet",sessionN:({n:e})=>`✦ this session: ${e}`,inherited:"inherited · latest readings by other sessions",export:"export ↗",exportTitle:"export this evaluation as a self-contained HTML report",empty:"nothing measured for this session yet.",blindHint:"declared but never measured — this is the outstanding loss; measure it with spex yatsu eval.",unmeasured:"unmeasured",noYatsu:"UI code · no yatsu.md"},time:{justNow:"now",minutes:({n:e})=>`${e}m`,hours:({n:e})=>`${e}h`,days:({n:e})=>`${e}d`,weeks:({n:e})=>`${e}w`},legend:{title:"help · keymap & legend",close:"close (esc or ?)",secBoard:"board keys",secPopup:"node-info popup",secStatus:"status dot",secOp:"overlay op",secOpSub:"(a worktree's pending change)",secBadges:"badges",secRing:"node ring",board:{move:"move up / down the focused column (siblings)",parent:"to the parent",child:"to the nearest child",zoom:"zoom in / out · reset to overview",info:"open the node-info popup (or double-click a node)",search:"search & jump across nodes, sessions, issues & scenarios",overlayCycle:"cycle through nodes a worktree is changing (⇧ reverse)",fresh:"start a fresh session on the focus node",evals:"open the evals page (the project’s current measured loss)",newChild:"new child node under the focus (chord)",del:"delete the focused node (chord)",settings:"open settings (language…)",help:"open this help"},popup:{switch:"switch pane (spec / history)",scroll:"scroll · reveal the next version",enter:"cross to the node’s session",esc:"close the popup"},statusRows:{merged:"spec & code in sync",active:"in-flight — the dot pulses",drift:"governed code is ahead of its spec",pending:"no committed version yet"},opRows:{added:"added",edited:"edited",deleted:"deleted",moved:"moved"},badgeDrift:"drift: N commits of code ahead of the spec",badgeVer:"version: N content commits to the node's spec.md",ringDashed:"dashed = uncommitted overlay",ringSolid:"solid = committed; ring colour = the author session",ringGhost:"translucent “ghost” = an added node not yet on main"},sessionWindow:{rowTitle:"click to lock the graph onto this session · double-click to open it · right-click to rename or close",lockedTitle:"graph locked to this session — click again to release",emptyBefore:"no live worktrees — press ",emptyAfter:" to start one",rename:"rename",select:"select…",close:"close",closeTitle:"close “{name}”?",closeConfirm:"This closes the session and removes its worktree. Any uncommitted changes are lost.",renameTitle:"rename “{name}”",renamePlaceholder:"display name (blank to reset)"},sessionSelect:{selected:({n:e})=>`${e} selected`,close:"close",closeTitle:({n:e})=>e===1?"close 1 session?":`close ${e} sessions?`,closeConfirm:"This closes every selected session and removes its worktree. Any uncommitted changes are lost."},lockHint:{cycleBefore:"press ",cycleAfter:({n:e})=>` to cycle its ${e} changed node${e===1?"":"s"}`,empty:"this session has no pending spec changes",release:"release",releaseTitle:"release the lock (or click the session again)"},nodeView:{paneSpec:"spec",paneHistory:"history",paneIssues:"issues",paneEval:"eval",paneEdit:"edit",noEdit:"no pending change — this node has no live edit in flight.",editCommitted:"committed",editDirty:"uncommitted",pendingEdits:({n:e})=>`${e} session${e===1?"":"s"} editing this node`,openIssues:({n:e})=>`${e} open`,closedIssues:({n:e})=>`${e} closed`,noIssues:"no issues linked to this node yet.",hint:"←→/hl/tab switch · j/k/↑↓ scroll · ⏎ session · esc back",statusLabel:"status:",versionLabel:"version:",lastEditedBy:"last edited by:",governs:"// governs",proseNode:"// no file owned · prose node",rawTitle:"raw source",rawOwner:"human",rawNote:"rarely changed · needs approval",expandedTitle:"expanded spec",expandedOwner:"agent",expandedNote:"versioned often · must match raw source",filesChanged:({n:e})=>`${e} file${e===1?"":"s"} changed`,loadingChange:"loading diff…",noChange:"no recorded change yet — this spec is the latest ground truth.",diffLabel:"spec line diff",loadingHistory:"loading history…",eval:{noScenarios:"no scenarios declared — this node has no yatsu.md to measure.",noReadings:"no measurements yet — run `spex yatsu eval` to file one. The declared scenarios:",staleAxes:({axes:e})=>`stale: ${e} moved since this reading`,staleLabel:"stale:",staleReadoutTitle:"this reading is behind — the axes that moved since it, and for the code axis which governed files drifted and by how many commits (+N)",danglingTitle:"this scenario was renamed or deleted — its remarks have no reading to attach to, but stay resolvable via their refs",danglingGone:"scenario gone",pass:"✓ pass",fail:"✗ fail",note:"≈ note",legacy:"legacy",expected:"expected:",noteLabel:"note:",loadingTranscript:"loading transcript…",miss:"miss original file — the evidence was pruned from the cache.",noImage:"no evidence — the agent attested without a capture.",shotAlt:({scenario:e})=>`captured evidence for ${e}`}},stats:{aria:"board statistics",totalTitle:({n:e})=>`${e} spec node${e===1?"":"s"} in the tree`,statusTitle:({n:e,status:t})=>`${e} ${t} — click to walk them`,driftTitle:({n:e})=>`${e} node${e===1?"":"s"} whose code is ahead of its spec — click to walk them`,issueTitle:({n:e})=>`${e} distinct open issue${e===1?"":"s"} linked to the tree — click to walk the nodes carrying them`,scorePass:({n:e})=>`${e} scenario${e===1?"":"s"} measured fresh & passing — click to walk the nodes carrying them`,scoreFail:({n:e})=>`${e} scenario${e===1?"":"s"} measured fresh & failing — click to walk the nodes carrying them`,scoreStalePass:({n:e})=>`${e} scenario${e===1?"":"s"} with a stale pass (code moved since the last passing measurement) — click to walk the nodes carrying them`,scoreStaleFail:({n:e})=>`${e} scenario${e===1?"":"s"} with a stale fail (code moved since the last failing measurement) — click to walk the nodes carrying them`,scoreEmpty:({n:e})=>`${e} unmeasured or unscored scenario${e===1?"":"s"} (a blind spot) — click to walk the nodes carrying them`},score:{pass:"current pass — measured, fresh, and passing",fail:"current fail — measured, fresh, and failing",stalePass:"stale — last measured a pass, now out of date",staleFail:"stale — last measured a fail, now out of date",empty:"no current score — never measured, or no pass/fail verdict",missing:"not measured yet — no reading filed for this scenario",count:({satisfied:e,total:t,outstanding:s})=>`${e} of ${t} scenario${t===1?"":"s"} satisfied (fresh & passing)`+(s?` · ${s} outstanding — failing, stale, or unmeasured`:"")},focusPanel:{scenarios:"scenarios",issues:"issues",noScenarios:"no scenarios — this node declares no yatsu.md to measure.",noIssues:"no issues linked to this node.",noFocus:"no node focused.",openEval:"open this node’s eval tab — the full reading timeline",open:({n:e})=>`${e} open`,closed:({n:e})=>`${e} closed`,tracks:({files:e})=>`tracks ${e}`},specNode:{liveEditors:({n:e})=>`${e} live editor${e===1?"":"s"}`,more:({n:e})=>`${e} more`,editorTitle:({node:e,status:t,id:s})=>`${e} · ${t} — ${s}`,driftAhead:({n:e})=>`${e} ahead`,opTitle:({op:e,label:t,uncommitted:s})=>`${e} · ${t}${s?" (uncommitted)":""}`,openIssues:({n:e})=>`${e} open issue${e===1?"":"s"} — focus the node to list them in the panel`,expandable:({n:e})=>`${e} child${e===1?"":"ren"} — focus to drill in`},nodeMenu:{info:"node info",newSession:"new session",newChild:"new child node…",del:"delete node…"},session:{opsTitle:"nodes this session is changing — double-click the tab to lock + focus them",newSession:"New Session",newSessionTitle:"New Session (⌥+N)",searchTitle:"Search (⌘+/)",issuesOff:"The issues workflow is off.",issuesEmpty:"No issues yet.",issuesLoading:"loading issues…",issuesFocusNode:"focus this node on the board",issuesSigned:({n:e})=>`+${e} signed`,issuesReplies:({n:e})=>`${e} ${e===1?"reply":"replies"}`,issuesOpenOnForge:"open on forge ↗",issuesThreadsTitle:"threads",issuesThreadsSummary:({open:e,total:t})=>`${e} open · ${t} total`,issuesStoreAll:"all stores",issuesStoreLabel:"store",issuesNew:"New",issuesCancel:"Cancel",issuesSend:"Send",issuesPost:"Post",issuesSending:"sending…",issuesPostFailed:"post failed",issuesClosing:"closing…",issuesCloseIssue:"Close issue",issuesMentionHint:"@session to summon · [[node]] to link",issuesReplyPlaceholder:"reply…",issuesConcernPlaceholder:"concern — one line",issuesBodyPlaceholder:"details (optional)",ask:"What would you like to do?",inputPlaceholder:"describe the work · @ spec · / command · ⏎ to launch · ⇧⏎ newline",menuCommands:"commands",menuPresets:"config presets",menuSpecNodes:"spec nodes",menuSessions:"sessions",menuHint:"↑↓ pick · ⏎ insert",hint:{before:"type ",mid:" to reference a spec · ",after:" to apply a config preset"},harnessLabel:"agent launcher",launcherLabel:"launcher",tabTerminal:"terminal",tabEval:"eval",navBtn:"nav",navTitle:"nav mode — forward raw keystrokes incl. ⌃/⌥/⌘ combos to drive the agent's terminal (⌥/⌘+I)",relaunch:"relaunch",merge:"merge",relaunchResume:"⏵ relaunch & resume",merges:({n:e})=>`merged ×${e}`,mergesTitle:"times merged to main",offlineMsg:"⏻ offline — no live process for this worktree.",offlineSubBefore:"the worktree and its session ",offlineSubAfter:" are intact. relaunch to resume the same conversation.",navInd:"⌨ nav mode",navHelp:"keys (incl. ⌃/⌥/⌘ combos) go to the session · ⌥/⌘+I, Esc-Esc, or click to exit",navExit:"click to exit nav mode",msgOffline:"relaunch to message this session",msgPlaceholder:"message this session · ⏎ to send",msgError:"⚠ not delivered — retry",attachTitle:"attach a file (or paste / drop) — uploaded to the session machine, its /tmp path inserted",attachError:"⚠ upload failed",cmd:{navDesc:"nav mode — forward raw keystrokes to the agent",evalDesc:"switch to this session's eval tab — yatsu evidence, diff, merge gates",mergeTitle:"merge this session to main",mergeDesc:"merge this session to main",exitTitle:"exit this session (stop the agent, keep the worktree — resumable)",exitDesc:"exit — stop the agent + tmux but KEEP the worktree, so it can be resumed",closeTitle:"close this session (removes the worktree)",closeDesc:"close — remove the worktree + branch, discarding the work (= row menu → Close)"}},settings:{title:"settings",close:"close (esc or ,)",secLanguage:"language",secTheme:"theme",theme:{light:"light",dark:"dark"},secShortcuts:"shortcuts",bindPrompt:"press a key…",shortcutsHint:"click a key to rebind it. nav & chord keys are fixed. (a game controller binds to actions, not keys — rebinding here never touches the pad.)",reset:"reset to defaults"},search:{title:"search nodes, sessions, issues & scenarios",placeholder:"search nodes, sessions, issues, scenarios…",empty:"no match",hint:"↑↓ pick · ⏎ jump · esc close",kind:{spec:"node",session:"session",issue:"issue",scenario:"scenario"}},mobile:{specsTab:"specs",sessionsTab:"sessions",childrenTab:({n:e})=>`children ${e}`,liveEditors:({n:e})=>`${e} live editor${e===1?"":"s"}`,changing:({n:e})=>`changing ${e} node${e===1?"":"s"}`,noChanges:"no pending spec changes",noSessions:"no live sessions — start one from a desktop board",back:"back"}},z2={common:{new:"新建",none:"无",idle:"空闲",sessions:"会话",session:"会话",loading:"加载中…",noVersions:"尚无版本——此规格即最新的事实依据。",cancel:"取消",save:"保存",close:"关闭"},status:{working:"工作中",idle:"空闲",offline:"离线",starting:"启动中",review:"待审查",done:"已完成","close-pending":"待关闭",parked:"驻留",error:"错误",asking:"待答",queued:"排队中",merged:"已合并",active:"进行中",drift:"偏移",pending:"待定"},sessionZone:{need:"待你处理",run:"自运行",offline:"离线"},nav:{railLabel:"主导航",graph:"规格节点图(⌥1)",sessions:"会话面板(⌥2)",evals:"Evals(⌥3 / ⌥F)",issues:"议题(⌥4)",settings:"设置(⌥5)"},hud:{helpTitle:"帮助 — 按键与图例(?)",loading:"正在从 git 加载规格…"},evalsFeed:{title:"评测",kind:{video:"视频",image:"图片",note:"备注",all:"全部"},staleN:({n:e})=>`${e} 条已过期`,staleOnlyTitle:"只看已过期的读取(默认将新鲜与过期一起、按时间倒序显示)",summary:({n:e})=>`${e} 条当前`,empty:"没有匹配的当前读数 — 先测量一个场景,或切换筛选。",annotate:"打开并标注"},masterList:{fold:"折叠列表 — 让详情占满宽度",unfold:"展开列表"},annotator:{title:"标注器",hint:"点击画面 播放/暂停 · 拖拽圈出问题 — 它会成为下方一条锚定到该时刻的评论;或点 ⏱ 把一条纯文字备注锚到当前帧。",keys:"空格 播放/暂停 · ←→ 5秒(⇧ 1秒)· , . 逐帧 · ↑↓ 跳评论 · a 标注当前帧",play:"播放",pause:"暂停",fullscreen:"全屏",exitFullscreen:"退出全屏",capturing:"正在截取画面…",failed:"失败 — 后端在跑吗?",comments:({n:e})=>e?`评审轨道(${e})`:"评审轨道",abOlder:"更早的 reading(‹ 靠近 A / 复现出的 bug)",abNewer:"更新的 reading(靠近 B / 验证过的修复 ›)",abLatest:"最新",abPos:({i:e,n:t})=>`${e} / ${t}`},thread:{anchorNow:"锚定",anchorTitle:"把这条评论锚定到当前帧",resolved:"已解决",resolvedBy:"由 {by} 解决",openRemark:"未解决",anchorDegraded:"该步骤已不在当前测量中——此 m:ss 为原始冻结值,无法跳转",originatorAlive:"在线 · 回复可实时送达",originatorOffline:"离线 · 回复不会送达",originatorIssue:"发起此 issue 的会话:{by} — 未 @ 的回复会在其在线时顺带送达",originatorEval:"记录此评测的会话:{by} — 未 @ 的评注会在其在线时顺带送达"},sessionEval:{btn:"评测",btnTitle:"切换到此会话的评测页 —— 测得的 yatsu 证据、改动与合并门禁",none:"此会话暂无评测",sessionN:({n:e})=>`✦ 本会话 ${e} 条`,inherited:"继承基线 · 其他会话的最新读数",export:"导出 ↗",exportTitle:"导出本次评测为自包含的 HTML 报告",empty:"该会话尚无测量。",blindHint:"已声明但从未测量 —— 这就是未清的 loss;用 spex yatsu eval 测一次。",unmeasured:"未测量",noYatsu:"UI 代码 · 无 yatsu.md"},time:{justNow:"刚刚",minutes:({n:e})=>`${e} 分钟`,hours:({n:e})=>`${e} 小时`,days:({n:e})=>`${e} 天`,weeks:({n:e})=>`${e} 周`},legend:{title:"帮助 · 按键与图例",close:"关闭(esc 或 ?)",secBoard:"面板按键",secPopup:"节点信息弹窗",secStatus:"状态点",secOp:"叠加操作",secOpSub:"(工作树的待定改动)",secBadges:"徽标",secRing:"节点边框",board:{move:"在聚焦列内上/下移动(同级节点)",parent:"前往父节点",child:"前往最近的子节点",zoom:"放大 / 缩小 · 重置为概览",info:"打开节点信息弹窗(或双击节点)",search:"跨节点、会话、议题与场景搜索并跳转",overlayCycle:"在工作树正在修改的节点间循环(⇧ 反向)",fresh:"在聚焦节点上开启一个全新会话",evals:"打开 evals 页(项目当前的实测损失)",newChild:"在聚焦节点下新建子节点(连击)",del:"删除聚焦节点(连击)",settings:"打开设置(语言…)",help:"打开此帮助"},popup:{switch:"切换页签(规格 / 历史)",scroll:"滚动 · 展开下一版本",enter:"进入该节点的会话",esc:"关闭弹窗"},statusRows:{merged:"规格与代码一致",active:"进行中——状态点会闪动",drift:"受管代码领先于其规格",pending:"尚无已提交的版本"},opRows:{added:"新增",edited:"编辑",deleted:"删除",moved:"移动"},badgeDrift:"偏移:代码领先于规格 N 次提交",badgeVer:"版本:该节点 spec.md 的 N 次内容提交",ringDashed:"虚线 = 未提交的叠加",ringSolid:"实线 = 已提交;边框颜色 = 作者会话",ringGhost:"半透明“幽灵” = 尚未进入 main 的新增节点"},sessionWindow:{rowTitle:"单击将图锁定到此会话 · 双击打开它 · 右键重命名或关闭",lockedTitle:"图已锁定到此会话——再次单击解除",emptyBefore:"没有活动的工作树——按 ",emptyAfter:" 开始一个",rename:"重命名",select:"多选…",close:"关闭",closeTitle:"关闭“{name}”?",closeConfirm:"这将关闭会话并删除其工作树。任何未提交的更改都会丢失。",renameTitle:"重命名“{name}”",renamePlaceholder:"显示名称(留空以重置)"},sessionSelect:{selected:({n:e})=>`已选 ${e} 个`,close:"关闭",closeTitle:({n:e})=>`关闭 ${e} 个会话?`,closeConfirm:"这将关闭每个选中的会话并删除其工作树。任何未提交的更改都会丢失。"},lockHint:{cycleBefore:"按 ",cycleAfter:({n:e})=>` 循环浏览它更改的 ${e} 个节点`,empty:"此会话没有待处理的规格更改",release:"解除",releaseTitle:"解除锁定(或再次单击该会话)"},nodeView:{paneSpec:"规格",paneHistory:"历史",paneIssues:"issue",paneEval:"评测",paneEdit:"改动",noEdit:"暂无进行中的改动 —— 此节点没有正在编辑的会话。",editCommitted:"已提交",editDirty:"未提交",pendingEdits:({n:e})=>`${e} 个会话正在编辑此节点`,openIssues:({n:e})=>`${e} 个待办`,closedIssues:({n:e})=>`${e} 个已关闭`,noIssues:"尚无关联到此节点的 issue。",hint:"←→/hl/tab 切换 · j/k/↑↓ 滚动 · ⏎ 会话 · esc 返回",statusLabel:"状态:",versionLabel:"版本:",lastEditedBy:"最后编辑者:",governs:"// 管辖",proseNode:"// 无管辖文件 · 纯文档节点",rawTitle:"原始来源",rawOwner:"人工",rawNote:"极少改动 · 需要审批",expandedTitle:"展开规格",expandedOwner:"智能体",expandedNote:"经常更新版本 · 须与原始来源一致",filesChanged:({n:e})=>`改动 ${e} 个文件`,loadingChange:"正在加载差异…",noChange:"尚无记录的改动——此规格即最新的事实依据。",diffLabel:"规格行差异",loadingHistory:"正在加载历史…",eval:{noScenarios:"尚未声明场景 —— 此节点没有可测量的 yatsu.md。",noReadings:"尚无测量 —— 运行 `spex yatsu eval` 归档一次。已声明的场景:",staleAxes:({axes:e})=>`已过期:自本次读取以来 ${e} 已变动`,staleLabel:"已过期:",staleReadoutTitle:"这条读取已落后——列出自它以来变动的轴;对于 code 轴,还显示是哪些受管文件漂移了、以及落后了几个提交(+N)",danglingTitle:"该场景已被重命名或删除——其评注无读取可依附,但仍可通过 ref 解决",danglingGone:"场景已失",pass:"✓ 通过",fail:"✗ 未通过",note:"≈ 备注",legacy:"旧版",expected:"预期:",noteLabel:"备注:",loadingTranscript:"正在加载文本记录…",miss:"原始文件缺失 —— 证据已从缓存中清除。",noImage:"无证据 —— 代理未捕获即作出判定。",shotAlt:({scenario:e})=>`${e} 的捕获证据`}},stats:{aria:"看板统计",totalTitle:({n:e})=>`树中共有 ${e} 个规格节点`,statusTitle:({n:e,status:t})=>`${e} 个${t} —— 点击逐个走查`,driftTitle:({n:e})=>`${e} 个节点的代码领先于其规格 —— 点击逐个走查`,issueTitle:({n:e})=>`链接到树上的不同未关闭议题共 ${e} 个 —— 点击逐个走查承载它们的节点`,scorePass:({n:e})=>`${e} 个场景测量为最新且通过 —— 点击逐个走查承载它们的节点`,scoreFail:({n:e})=>`${e} 个场景测量为最新且未通过 —— 点击逐个走查承载它们的节点`,scoreStalePass:({n:e})=>`${e} 个场景为过期通过(最近一次通过测量后代码有变动)—— 点击逐个走查承载它们的节点`,scoreStaleFail:({n:e})=>`${e} 个场景为过期未通过(最近一次未通过测量后代码有变动)—— 点击逐个走查承载它们的节点`,scoreEmpty:({n:e})=>`${e} 个场景未测量或未评分(盲点)—— 点击逐个走查承载它们的节点`},score:{pass:"当前通过 —— 已测量、最新且通过",fail:"当前未通过 —— 已测量、最新且未通过",stalePass:"已过期 —— 上次测量为通过,现已过时",staleFail:"已过期 —— 上次测量为未通过,现已过时",empty:"暂无当前评分 —— 从未测量,或无通过/未通过判定",missing:"尚未测量 —— 该场景还没有任何读数",count:({satisfied:e,total:t,outstanding:s})=>`${t} 个场景中有 ${e} 个已满足(最新且通过)`+(s?` · ${s} 个待处理 —— 未通过、已过期或未测量`:"")},focusPanel:{scenarios:"场景",issues:"issue",noScenarios:"无场景 —— 该节点没有用于测量的 yatsu.md。",noIssues:"该节点暂无关联 issue。",noFocus:"未聚焦任何节点。",openEval:"打开该节点的 eval 标签页 —— 完整的读数时间线",open:({n:e})=>`${e} 个待办`,closed:({n:e})=>`${e} 个已关闭`,tracks:({files:e})=>`跟踪 ${e}`},specNode:{liveEditors:({n:e})=>`${e} 个实时编辑者`,more:({n:e})=>`还有 ${e} 个`,editorTitle:({node:e,status:t,id:s})=>`${e} · ${t} — ${s}`,driftAhead:({n:e})=>`领先 ${e}`,opTitle:({op:e,label:t,uncommitted:s})=>`${e} · ${t}${s?"(未提交)":""}`,openIssues:({n:e})=>`${e} 个待办 issue——聚焦该节点后在面板中查看`,expandable:({n:e})=>`${e} 个子节点——聚焦展开`},nodeMenu:{info:"查看详情",newSession:"新建会话",newChild:"新建子节点…",del:"删除节点…"},session:{opsTitle:"此会话正在改动的节点 —— 双击标签锁定并聚焦它们",newSession:"新建会话",newSessionTitle:"新建会话(⌥+N)",searchTitle:"搜索(⌘+/)",issuesOff:"issues 工作流已关闭。",issuesEmpty:"暂无 issue。",issuesLoading:"正在加载 issues……",issuesFocusNode:"在看板上聚焦此节点",issuesSigned:({n:e})=>`+${e} 已签署`,issuesReplies:({n:e})=>`${e} 条回复`,issuesOpenOnForge:"在 forge 上打开 ↗",issuesThreadsTitle:"讨论帖",issuesThreadsSummary:({open:e,total:t})=>`${e} 开放 · 共 ${t}`,issuesStoreAll:"所有来源",issuesStoreLabel:"来源",issuesNew:"新建",issuesCancel:"取消",issuesSend:"发送",issuesPost:"发布",issuesSending:"发送中……",issuesPostFailed:"发布失败",issuesClosing:"关闭中……",issuesCloseIssue:"关闭 issue",issuesMentionHint:"@会话 召唤 · [[节点]] 关联",issuesReplyPlaceholder:"回复……",issuesConcernPlaceholder:"关切 —— 一行概述",issuesBodyPlaceholder:"详情(可选)",ask:"你想做点什么?",inputPlaceholder:"描述工作 · @ 规格 · / 命令 · ⏎ 启动 · ⇧⏎ 换行",menuCommands:"命令",menuPresets:"配置预设",menuSpecNodes:"规格节点",menuSessions:"会话",menuHint:"↑↓ 选择 · ⏎ 插入",hint:{before:"输入 ",mid:" 以引用规格 · ",after:" 以套用配置预设"},harnessLabel:"启动智能体",launcherLabel:"启动器",tabTerminal:"终端",tabEval:"评测",navBtn:"导航",navTitle:"导航模式——转发原始按键(含 ⌃/⌥/⌘ 组合键)以驱动智能体的终端(⌥/⌘+I)",relaunch:"重新启动",merge:"合并",relaunchResume:"⏵ 重新启动并恢复",merges:({n:e})=>`已合并 ×${e}`,mergesTitle:"合并到 main 的次数",offlineMsg:"⏻ 离线——此工作树没有活动进程。",offlineSubBefore:"工作树及其会话 ",offlineSubAfter:" 仍然完好。重新启动以恢复同一对话。",navInd:"⌨ 导航模式",navHelp:"按键(含 ⌃/⌥/⌘ 组合键)将发送给会话 · ⌥/⌘+I、Esc-Esc 或点击退出",navExit:"点击退出导航模式",msgOffline:"重新启动以向此会话发送消息",msgPlaceholder:"向此会话发送消息 · ⏎ 发送",msgError:"⚠ 未送达 — 重试",attachTitle:"附加文件(或粘贴 / 拖入)—— 上传到会话所在机器,并插入其 /tmp 路径",attachError:"⚠ 上传失败",cmd:{navDesc:"导航模式 —— 转发原始按键给智能体",evalDesc:"切换到此会话的评测页 —— yatsu 证据、改动、合并门禁",mergeTitle:"将此会话合并到 main",mergeDesc:"将此会话合并到 main",exitTitle:"退出此会话(停止智能体,保留工作树 —— 可恢复)",exitDesc:"退出 —— 停止智能体与 tmux,但保留工作树,之后可恢复",closeTitle:"关闭此会话(移除工作树)",closeDesc:"关闭 —— 移除工作树与分支,丢弃此工作(等同右键菜单 → 关闭)"}},settings:{title:"设置",close:"关闭(esc 或 ,)",secLanguage:"语言",secTheme:"主题",theme:{light:"浅色",dark:"深色"},secShortcuts:"快捷键",bindPrompt:"按一个键…",shortcutsHint:"点击某个键即可重绑定。导航键与连击键固定不可改。(手柄绑定的是动作而非按键——这里的重绑定不影响手柄。)",reset:"恢复默认"},search:{title:"搜索节点、会话、议题与场景",placeholder:"搜索节点、会话、议题、场景…",empty:"没有匹配项",hint:"↑↓ 选择 · ⏎ 跳转 · esc 关闭",kind:{spec:"节点",session:"会话",issue:"议题",scenario:"场景"}},mobile:{specsTab:"规格",sessionsTab:"会话",childrenTab:({n:e})=>`子节点 ${e}`,liveEditors:({n:e})=>`${e} 个在线编辑者`,changing:({n:e})=>`正在修改 ${e} 个节点`,noChanges:"没有待提交的规格更改",noSessions:"没有运行中的会话 —— 请在桌面看板上启动",back:"返回"}},Iu={en:Qh,zh:z2},n0="spexcode.lang",W2=[{code:"en",label:"English"},{code:"zh",label:"中文"}];function U2(){return(typeof navigator<"u"&&navigator.language||"en").toLowerCase().startsWith("zh")?"zh":"en"}function V2(){try{const e=localStorage.getItem(n0);if(e&&Iu[e])return e}catch{}return U2()}function xp(e,t){if(typeof t=="string")return t.split(".").reduce((s,n)=>s==null?void 0:s[n],e)}function K2(e,t){return t?e.replace(/\{(\w+)\}/g,(s,n)=>t[n]!=null?t[n]:`{${n}}`):e}function q2(e,t,s){let n=xp(e,t);return n===void 0&&(n=xp(Qh,t)),typeof n=="function"?n(s||{}):typeof n=="string"?K2(n,s):t}const r0=B.createContext(null);function G2({children:e}){const[t,s]=B.useState(V2);B.useEffect(()=>{try{document.documentElement.lang=t}catch{}},[t]);const n=B.useCallback(o=>{if(Iu[o]){try{localStorage.setItem(n0,o)}catch{}s(o)}},[]),r=B.useMemo(()=>{const o=Iu[t]||Qh;return{lang:t,setLang:n,t:(c,i)=>q2(o,c,i)}},[t,n]);return S.jsx(r0.Provider,{value:r,children:e})}function i0(){const e=B.useContext(r0);if(!e)throw new Error("useI18n must be used within <I18nProvider>");return e}function be(){return i0().t}function X2(e){var t,s;return((t=e==null?void 0:e.verdict)==null?void 0:t.status)==="pass"?"check":((s=e==null?void 0:e.verdict)==null?void 0:s.status)==="fail"?"cross":null}const Y2={pass:"✓",fail:"✗",stalePass:"✓",staleFail:"✗",empty:""};function o0(e){const t=X2(e);return t?e.fresh?t==="cross"?"fail":"pass":t==="cross"?"staleFail":"stalePass":"empty"}function Bn(e,t){if(!e)return[];const s=new Map;for(const n of t||[])s.has(n.scenario)||s.set(n.scenario,n);return e.map(n=>{const r=s.get(n.name)||null;return{...n,reading:r,state:r?o0(r):"missing"}})}function a0(e){return e.length?e.some(t=>t.state==="fail")?"fail":e.some(t=>t.state==="staleFail")?"staleFail":e.some(t=>t.state==="stalePass")?"stalePass":e.some(t=>t.state==="empty"||t.state==="missing")?"empty":"pass":null}function l0({scenarios:e,evals:t}){const s=be(),n=Bn(e,t);if(!n.length)return null;const r=a0(n),o=n.filter(a=>a.state==="pass").length,c=n.length,i=s("score.count",{satisfied:o,total:c,outstanding:c-o});return S.jsxs("span",{className:`scenario-count ${r}`,title:i,"aria-label":i,children:["✓",o,"/",c]})}function Zh({tags:e}){return e!=null&&e.length?S.jsx("span",{className:"tag-chips",children:e.map(t=>S.jsx("span",{className:"tag-chip",children:t},t))}):null}function no({state:e,title:t}){const s=be();if(!e)return null;const n=t??s(`score.${e}`);return S.jsx("span",{className:`score-badge ${e}`,title:n,"aria-label":n,children:Y2[e]})}function Q2(e,t){if(!e)return null;const s=Date.parse(e);if(Number.isNaN(s))return null;const n=Math.max(0,(Date.now()-s)/1e3);if(n<45)return t("time.justNow");const r=n/60,o=r/60,c=o/24;return r<45?t("time.minutes",{n:Math.round(r)}):o<22?t("time.hours",{n:Math.round(o)}):c<7?t("time.days",{n:Math.round(c)}):t("time.weeks",{n:Math.round(c/7)})}const Z2=4,Ps={merged:{color:"#859900"},active:{color:"#cb4b16"},drift:{color:"#b58900"},pending:{color:"#93a1a1"}},Ll={added:"+",edited:"~",deleted:"✕",moved:"→"};function J2({data:e}){const t=be(),s=[...new Map((e.editors||[]).map(o=>[o.id,o])).values()];if(s.length===0)return null;const n=s.slice(0,Z2),r=s.length-n.length;return S.jsxs("span",{className:"node-editors",title:t("specNode.liveEditors",{n:s.length}),children:[n.map(o=>S.jsx(so,{seed:o.id,status:o.status,title:t("specNode.editorTitle",{node:o.node||t("common.session"),status:t(`status.${o.status}`),id:o.id.slice(0,8)})},o.id)),r>0&&S.jsxs("span",{className:"av-more",title:t("specNode.more",{n:r}),children:["+",r]})]})}function ek({issues:e,t}){return!e||e.length===0?null:S.jsxs("span",{className:"issue-badge",title:t("specNode.openIssues",{n:e.length}),children:["◆",e.length]})}function tk({data:e,selected:t}){const s=be(),n=Ps[e.status]||Ps.pending,r=Q2(e.lastEdited,s),o=e.overlays||[],c=o[0],i=o.some(l=>l.op==="deleted"),a=c&&!c.committed,d=[...new Set(o.map(l=>l.op))],g=["spec-node",e.status,t?"focused":"",e.ghost?"ghost":"",i?"deleted":"",o.length?"has-overlay":"",a?"ov-dirty":""].filter(Boolean).join(" ");return S.jsxs("div",{className:g,style:c?{"--ov":zi(c.seed)}:void 0,children:[S.jsx(Lr,{type:"target",position:we.Left}),S.jsxs("div",{className:"node-row1",children:[S.jsx("span",{className:"node-dot",style:{background:n.color},children:e.status==="active"&&S.jsx("span",{className:"pulse",style:{background:n.color}})}),S.jsx("span",{className:"node-title",children:e.title}),d.length>0?S.jsx("span",{className:"ov-marks",title:o.map(l=>s("specNode.opTitle",{op:s(`legend.opRows.${l.op}`),label:l.label,uncommitted:!l.committed})).join(`
63
- `),children:d.map(l=>S.jsx("span",{className:`ov-mark ov-${l}`,children:Ll[l]},l))}):r?S.jsx("span",{className:"node-ago",children:r}):null]}),S.jsxs("div",{className:"node-row2",children:[S.jsx("span",{className:"node-ver",children:e.version?`v${e.version}`:""}),e.drift>0&&S.jsxs("span",{className:"drift-badge",title:(e.driftFiles||[]).map(l=>`${l.file}: ${s("specNode.driftAhead",{n:l.behind})}`).join(`
64
- `),children:["⚠",e.drift]}),S.jsx(ek,{issues:e.openIssues,t:s}),S.jsx(l0,{scenarios:e.scenarios,evals:e.evals}),S.jsx(J2,{data:e})]}),e.collapsed&&S.jsxs("span",{className:"node-expand",title:s("specNode.expandable",{n:e.childCount}),children:["▸",e.childCount]}),S.jsx(Lr,{type:"source",position:we.Right})]})}const yc=typeof window<"u"?window.__escStack||(window.__escStack=[]):[];typeof window<"u"&&!window.__escStackBound&&(window.__escStackBound=!0,window.addEventListener("keydown",e=>{const t=window.__escStack;e.key!=="Escape"||!t||t.length===0||(e.preventDefault(),e.stopImmediatePropagation(),t[t.length-1].close())},!0));function hr(e,t){const s=B.useRef(t);s.current=t,B.useEffect(()=>{if(!e)return;const n={close:()=>{var r;return(r=s.current)==null?void 0:r.call(s)}};return yc.push(n),()=>{const r=yc.indexOf(n);r>=0&&yc.splice(r,1)}},[e])}const xt={working:"var(--green)",parked:"var(--green)",asking:"var(--yellow)",review:"var(--yellow)",done:"var(--yellow)",error:"var(--red)",idle:"var(--muted)",starting:"var(--muted)",queued:"var(--muted)","close-pending":"var(--muted)",offline:"var(--muted)",unknown:"var(--yellow)"},c0={working:"●",parked:"‖",asking:"?",review:"◑",done:"✓",error:"✕",idle:"·",starting:"◌",queued:"⋯","close-pending":"⊘",offline:"○",unknown:"⁇"},u0=new Set(["asking","review","done","close-pending","error"]),qa=e=>(e==null?void 0:e.liveness)==="offline"||(e==null?void 0:e.status)==="offline"?"offline":u0.has(e==null?void 0:e.status)?"need":"run",Cp=e=>(e==null?void 0:e.sortKey)!=null?e.sortKey:(e==null?void 0:e.created)??0,bp=e=>{const t={need:0,run:1,offline:2};return[...e].sort((s,n)=>t[qa(s)]-t[qa(n)]||Cp(n)-Cp(s))},ro=e=>(e==null?void 0:e.label)||(e==null?void 0:e.name)||(e==null?void 0:e.node)||(e==null?void 0:e.title)||(e==null?void 0:e.branch)||(e==null?void 0:e.id),Nn=e=>(e==null?void 0:e.headline)||(e==null?void 0:e.name)||(e==null?void 0:e.activity)||(e==null?void 0:e.promptPreview)||(e==null?void 0:e.node)||(e==null?void 0:e.title)||(e==null?void 0:e.branch)||(e==null?void 0:e.id);function sk(e){const t=new Set(e.map(r=>r==null?void 0:r.id)),s=new Map,n=[];for(const r of e){const o=r!=null&&r.parent&&r.parent!==r.id&&t.has(r.parent)?r.parent:null;if(o){const c=s.get(o)||[];c.push(r),s.set(o,c)}else n.push(r)}return{roots:n,childrenOf:s}}function nk(e,t){let s=!1,n=!1,r=0;const o=(c,i)=>{for(const a of t.get(c)||[])i.has(a.id)||(i.add(a.id),r++,u0.has(a.status)?s=!0:xt[a.status]===xt.working&&(n=!0),o(a.id,i))};return o(e,new Set([e])),{color:s?xt.asking:n?xt.working:xt.idle,count:r}}function h0(e,t){const{roots:s,childrenOf:n}=sk(e),r=[],o=(a,d,g,l)=>{const m=n.get(a.id)||[],v=m.length>0,w=v&&!!t(a.id),_=v?nk(a.id,n):null;if(r.push({type:"row",s:a,depth:d,expandable:v,expanded:w,rollup:(_==null?void 0:_.color)??null,kin:(_==null?void 0:_.count)??0,guides:l}),w){const u=bp(m).filter(f=>!g.has(f.id));u.forEach((f,p)=>{g.add(f.id),o(f,d+1,g,[...l,p<u.length-1])})}},c=new Set;let i=null;for(const a of bp(s)){if(c.has(a.id))continue;c.add(a.id);const d=qa(a);d!==i&&(r.push({type:"zone",zone:d}),i=d),o(a,0,c,[])}return r}function rk({menu:e,onClose:t,onInfo:s,onFresh:n,onNewChild:r,onDelete:o,sessions:c=[],onOpenSession:i}){const a=be();if(B.useEffect(()=>{if(e)return window.addEventListener("click",t),window.addEventListener("contextmenu",t,!0),()=>{window.removeEventListener("click",t),window.removeEventListener("contextmenu",t,!0)}},[e,t]),hr(!!e,t),!e)return null;const d=l=>m=>{m.stopPropagation(),t(),l(e.id)},g=l=>m=>{m.stopPropagation(),t(),i==null||i(l)};return S.jsxs("div",{className:"sess-menu",style:{left:e.x,top:e.y},onClick:l=>l.stopPropagation(),children:[S.jsx("button",{className:"sess-menu-item",onClick:d(s),children:a("nodeMenu.info")}),S.jsx("button",{className:"sess-menu-item",onClick:d(n),children:a("nodeMenu.newSession")}),S.jsx("button",{className:"sess-menu-item",onClick:d(r),children:a("nodeMenu.newChild")}),S.jsx("button",{className:"sess-menu-item danger",onClick:d(o),children:a("nodeMenu.del")}),c.length>0&&S.jsx("div",{className:"sess-menu-sep"}),c.map(l=>S.jsxs("button",{className:"sess-menu-item sess-menu-sess",onClick:g(l.id),children:[S.jsx("span",{className:"sess-glyph",style:{color:xt[l.status]},"aria-hidden":"true",children:c0[l.status]}),Nn(l)]},l.id))]})}const ik={video:"vid",image:"img",transcript:"txt",note:"note"},Jh=e=>{var t;return(t=e.evidence)!=null&&t.length?e.evidence:e.blob!=null?[{hash:e.blob,kind:e.blobKind||"image",state:e.blobState||"present"}]:[]},da=e=>{const t=Jh(e);return t.length?["video","image","transcript"].filter(s=>t.some(n=>n.kind===s)):["note"]};function d0(e){var s;const t=[];for(const n of e)if((s=n.evals)!=null&&s.length)for(const r of Bn(n.scenarios,n.evals))r.reading&&t.push({...r.reading,expected:r.expected??r.reading.expected,state:r.state,node:n.id,hue:n.hue});return t.sort((n,r)=>n.ts<r.ts?1:-1),t}const bs=e=>`eval:${e.node}·${e.scenario}`;function f0({e,selected:t,onClick:s}){return S.jsxs("button",{className:`ef-row ${t?"sel":""}`,onClick:s,children:[S.jsx(no,{state:e.state}),e.inSession&&S.jsx("span",{className:"ef-insession",title:"measured by this session",children:"✦"}),S.jsx("span",{className:"ef-scenario",children:e.scenario}),S.jsx("span",{className:"ef-node",style:{color:`hsl(${e.hue??210} 60% 70%)`},children:e.node}),S.jsx("span",{className:"ef-kind",children:da(e).map(n=>ik[n]).join("·")}),S.jsx("span",{className:"ef-time",children:ok(e.ts)})]})}const ok=e=>{const t=Math.max(0,(Date.now()-new Date(e).getTime())/1e3);return t<3600?`${Math.max(1,Math.floor(t/60))}m`:t<86400?`${Math.floor(t/3600)}h`:`${Math.floor(t/86400)}d`};function ak({nodes:e=[],sel:t,onSel:s,onRows:n,mustShow:r=null}){const o=be(),[c,i]=B.useState(null),[a,d]=B.useState(!1),g=B.useMemo(()=>d0(e),[e]),l=g.some(f=>da(f).includes("video")),m=g.some(f=>da(f).includes("image")),v=c??(l?"video":m?"image":"all"),w=B.useMemo(()=>a?g.filter(f=>!f.fresh):g,[g,a]),_=B.useMemo(()=>w.filter(f=>v==="all"||da(f).includes(v)),[w,v]),u=g.filter(f=>!f.fresh).length;return B.useEffect(()=>{n==null||n(_)},[_,n]),B.useEffect(()=>{r&&(_.some(f=>bs(f)===r)||g.some(f=>bs(f)===r)&&(i("all"),d(!1)))},[r,_,g]),S.jsxs("section",{className:"fv-group",children:[S.jsx("header",{className:"fv-group-head",children:S.jsxs("span",{className:"ef-chipbar",children:[["video","image","note","all"].map(f=>S.jsx("button",{className:`ef-chip ${v===f?"on":""}`,onClick:()=>i(f),children:o(`evalsFeed.kind.${f}`)},f)),u>0&&S.jsx("button",{className:`ef-chip ef-stale ${a?"on":""}`,onClick:()=>d(f=>!f),title:o("evalsFeed.staleOnlyTitle"),children:o("evalsFeed.staleN",{n:u})})]})}),_.length===0&&S.jsx("div",{className:"ef-empty",children:o("evalsFeed.empty")}),_.map(f=>S.jsx(f0,{e:f,selected:t===bs(f),onClick:()=>s(bs(f),f)},bs(f)))]})}const Wi=e=>`/api/yatsu/blob/${e}`;function lk({src:e,alt:t,onClose:s}){return B.useEffect(()=>{const n=r=>{r.key==="Escape"&&(r.preventDefault(),r.stopPropagation(),s())};return window.addEventListener("keydown",n,!0),()=>window.removeEventListener("keydown",n,!0)},[s]),S.jsx("div",{className:"lightbox",onClick:s,children:S.jsx("img",{src:e,alt:t})})}function ck({hash:e}){const t=be(),[s,n]=B.useState(null);return B.useEffect(()=>{let r=!0;return fetch(Wi(e)).then(o=>o.ok?o.text():Promise.reject(new Error("miss"))).then(o=>{r&&n(o)}).catch(()=>{r&&n("")}),()=>{r=!1}},[e]),s===null?S.jsx("pre",{className:"eval-transcript loading",children:t("nodeView.eval.loadingTranscript")}):S.jsx("pre",{className:"eval-transcript",children:s})}function uk({hash:e,alt:t}){const[s,n]=B.useState(!1);return S.jsxs(S.Fragment,{children:[S.jsx("img",{className:"an-image",src:Wi(e),alt:t,loading:"lazy",onClick:()=>n(!0)}),s&&S.jsx(lk,{src:Wi(e),alt:t,onClose:()=>n(!1)})]})}function hk({exit:e}){return S.jsx("svg",{width:"15",height:"15",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e?S.jsxs(S.Fragment,{children:[S.jsx("path",{d:"M6 2v4H2"}),S.jsx("path",{d:"M10 2v4h4"}),S.jsx("path",{d:"M6 14v-4H2"}),S.jsx("path",{d:"M10 14v-4h4"})]}):S.jsxs(S.Fragment,{children:[S.jsx("path",{d:"M2 6V2h4"}),S.jsx("path",{d:"M14 6V2h-4"}),S.jsx("path",{d:"M2 10v4h4"}),S.jsx("path",{d:"M14 10v4h-4"})]})})}function dk({target:e,className:t=""}){const s=be(),[n,r]=B.useState(!1);B.useEffect(()=>{const c=()=>{const i=document.fullscreenElement,a=e==null?void 0:e.current;r(!!i&&!!a&&(i===a||a.contains(i)))};return document.addEventListener("fullscreenchange",c),()=>document.removeEventListener("fullscreenchange",c)},[e]);const o=()=>{var i,a;const c=e==null?void 0:e.current;c&&(document.fullscreenElement?(i=document.exitFullscreen||document.webkitExitFullscreen)==null||i.call(document):(a=c.requestFullscreen||c.webkitRequestFullscreen)==null||a.call(c))};return S.jsx("button",{type:"button",className:`an-fs ${t}`,onClick:o,title:s(n?"annotator.exitFullscreen":"annotator.fullscreen"),"aria-label":s(n?"annotator.exitFullscreen":"annotator.fullscreen"),children:S.jsx(hk,{exit:n})})}function Ga({e,alt:t=""}){const s=be();return e.state==="miss"?S.jsx("div",{className:"eval-noimg",children:s("nodeView.eval.miss")}):e.kind==="transcript"?S.jsx(ck,{hash:e.hash}):e.kind==="video"?S.jsx("video",{className:"eval-video",src:Wi(e.hash),controls:!0,preload:"metadata",playsInline:!0}):S.jsx(uk,{hash:e.hash,alt:t})}const Ko=new Map;function fk(e){const[t,s]=B.useState(()=>Ko.get(e)??null);return B.useEffect(()=>{if(Ko.has(e)){s(Ko.get(e));return}let n=!0;return fetch(Wi(e),{headers:{Range:"bytes=0-0"}}).then(r=>{const o=r.headers.get("content-type")||"",c=r.ok?{kind:o.startsWith("video/")?"video":o.startsWith("image/")?"image":"transcript",state:"present"}:{kind:"image",state:"miss"};Ko.set(e,c),n&&s(c)}).catch(()=>{n&&s({kind:"image",state:"miss"})}),()=>{n=!1}},[e]),t}function p0({hash:e,alt:t=""}){const s=fk(e);return s?S.jsx(Ga,{e:{hash:e,...s},alt:t}):null}const Ep=/\[\[(\.?[A-Za-z0-9_-]+)\]\]/g,ed=e=>(e||"").replace(/^\.spec\//,"").replace(/\/spec\.md$/,"");function pk(e,t,s){const n=t.toLowerCase(),r=[];for(const o of e){const c=o.id.toLowerCase(),i=ed(o.path).toLowerCase();let a;if(!n)a=3;else if(c.startsWith(n))a=0;else if(c.includes(n))a=1;else if(i.includes(n))a=2;else continue;o.id===s&&(a=-1),r.push({s:o,score:a})}return r.sort((o,c)=>o.score-c.score||o.s.id.length-c.s.id.length||o.s.id.localeCompare(c.s.id)),r.slice(0,8).map(o=>o.s)}function gk(e,t){const s=t.toLowerCase(),n=i=>Nn(i)||(i.id||"").slice(0,8),r=[];for(const i of e||[]){if(i.liveness!=="online")continue;const a=(i.id||"").toLowerCase(),d=n(i).toLowerCase();let g;if(!s)g=3;else if(a===s||d===s)g=0;else if(a.startsWith(s)||d.startsWith(s))g=1;else if(a.includes(s)||d.includes(s))g=2;else continue;r.push({s:i,score:g})}r.sort((i,a)=>i.score-a.score||(a.s.created||0)-(i.s.created||0));const o=r.map(i=>({id:i.s.id,label:n(i.s),sub:i.s.node||i.s.status})),c=r.filter(i=>i.score===0).length;return o.splice(c,0,{id:"new",label:"new",sub:"spawn a fresh worker"}),o.slice(0,8)}function Bu(e,t){if(!t)return e;const s=e.toLowerCase().indexOf(t.toLowerCase());return s<0?e:S.jsxs(S.Fragment,{children:[e.slice(0,s),S.jsx("b",{className:"mention-hit",children:e.slice(s,s+t.length)}),e.slice(s+t.length)]})}function g0(e,t,s,n){let r=t-1;for(;r>=0&&/[A-Za-z0-9_.\-]/.test(e[r]);)r--;if(r>=1&&e[r-1]==="["&&e[r]==="["){const o=e.slice(r+1,t),c=pk(s,o,n);return c.length?{kind:"mention",items:c,index:0,start:r-1,end:t,query:o}:null}return null}function m0(e,t,s){let n=t-1;for(;n>=0&&/[A-Za-z0-9_.\-]/.test(e[n]);)n--;if(n>=0&&e[n]==="@"&&(n===0||/\s/.test(e[n-1]))){const r=e.slice(n+1,t),o=gk(s,r);return o.length?{kind:"actor",items:o,index:0,start:n,end:t,query:r}:null}return null}function _0({menu:e,up:t,fixedStyle:s,onPick:n,onHover:r}){const o=be(),c=e.kind==="actor",i=e.query?c?`@${e.query}`:`[[${e.query}]]`:o(c?"session.menuSessions":"session.menuSpecNodes");return S.jsxs("ul",{className:`${t?"mention-menu up":"mention-menu"}${s?" fixed":""}`,style:s||void 0,role:"listbox",children:[S.jsxs("li",{className:"mention-head",children:["// ",i," — ",o("session.menuHint")]}),e.items.map((a,d)=>S.jsxs("li",{role:"option","aria-selected":d===e.index,className:`${d===e.index?"mention-item on":"mention-item"}${c&&a.id==="new"?" new":""}`,onMouseDown:g=>{g.preventDefault(),n(a)},onMouseEnter:()=>r(d),children:[!c&&S.jsx("span",{className:"mention-dot",style:{background:xt[a.status]||xt.offline}}),S.jsx("span",{className:"mention-id",children:c?S.jsxs(S.Fragment,{children:["@",Bu(a.label,e.query)]}):Bu(a.id,e.query)}),S.jsx("span",{className:"mention-path",children:c?a.sub:ed(a.path)})]},a.id))]})}function v0({inputRef:e,value:t,setValue:s,specs:n=[],sessions:r=[],focusId:o=null,up:c=!1,fixedAbove:i=null}){const[a,d]=B.useState(null),[g,l]=B.useState(null),m=p=>{var x;if(!p){d(null),l(null);return}const h=p.selectionStart,y=g0(p.value,h,n,o)||m0(p.value,h,r);if(d(y),!y||!i){l(null);return}const b=p.getBoundingClientRect(),C=(x=p.closest(i))==null?void 0:x.getBoundingClientRect(),E=(C==null?void 0:C.top)??b.top;l({left:`${b.left}px`,width:`${b.width}px`,right:"auto",bottom:`${Math.max(8,window.innerHeight-E+8)}px`})},v=p=>d(h=>h&&{...h,index:(h.index+p+h.items.length)%h.items.length}),w=p=>{if(!p||!a)return;const h=a.kind==="actor"?`@${p.id} `:`[[${p.id}]] `,y=t.slice(0,a.start);s(y+h+t.slice(a.end)),d(null),l(null);const b=y.length+h.length;requestAnimationFrame(()=>{const C=e.current;C&&(C.focus(),C.setSelectionRange(b,b))})};return{menu:a,sync:m,onKeyDown:p=>a?p.key==="ArrowDown"?(p.preventDefault(),p.stopPropagation(),v(1),!0):p.key==="ArrowUp"?(p.preventDefault(),p.stopPropagation(),v(-1),!0):p.key==="Enter"||p.key==="Tab"?(p.preventDefault(),p.stopPropagation(),w(a.items[a.index]),!0):p.key==="Escape"?(p.preventDefault(),p.stopPropagation(),d(null),l(null),!0):!1:!1,close:()=>{d(null),l(null)},menuEl:a?S.jsx(_0,{menu:a,up:c,fixedStyle:g,onPick:w,onHover:p=>d(h=>h&&{...h,index:p})}):null}}function ju(e,t){e&&(e.style.height="auto",e.style.overflowY=e.scrollHeight>t?"auto":"hidden",e.style.height=`${Math.min(e.scrollHeight,t)}px`)}const mk=/^▶\s*(\d+):([0-5]?\d)(?:\s*·\s*([^\n]*))?/,_k=/\/api\/yatsu\/blob\/([0-9a-f]{64})/g,kp=/!\[[^\]]*\]\(\/api\/yatsu\/blob\/([0-9a-f]{64})\)/g,si=e=>{const t=Math.floor(e/1e3);return`${Math.floor(t/60)}:${String(t%60).padStart(2,"0")}`};function td(e){var o;const t=e||"",s=t.split(`
65
- `,1)[0],n=mk.exec(s);return n?{tMs:(parseInt(n[1],10)*60+parseInt(n[2],10))*1e3,step:((o=n[3])==null?void 0:o.trim())||null,label:s.trim(),rest:t.slice(s.length).replace(/^\n/,"")}:null}const Xa=(e,t)=>`▶${si(e)}${t?` · ${t}`:""}`,Lp=e=>[...(e||"").matchAll(_k)].map(t=>t[1]);function y0(e,t){if(!e)return null;if(e.step&&(t!=null&&t.length)){const s=t.find(n=>n.step===e.step);return s?{tMs:s.tMs,step:e.step,label:Xa(s.tMs,e.step),seekable:!0,degraded:!1}:{tMs:e.tMs,step:e.step,label:e.label,seekable:!1,degraded:!0}}return{tMs:e.tMs,step:e.step,label:e.label,seekable:!0,degraded:!1}}function w0({originator:e,sessions:t=[],kind:s="issue"}){const n=be();if(!e)return null;const r=(t||[]).find(i=>i.id===e),o=!!r&&qa(r)!=="offline",c=o?xt[r.status]||xt.working:xt.offline;return S.jsxs("span",{className:`fv-originator ${o?"alive":"offline"}`,title:n(s==="eval"?"thread.originatorEval":"thread.originatorIssue",{by:e}),children:[S.jsx("span",{className:"fv-originator-dot",style:{background:c},"aria-hidden":"true"}),S.jsx("span",{className:"fv-originator-who",children:e}),S.jsx("span",{className:"fv-originator-reach",children:n(o?"thread.originatorAlive":"thread.originatorOffline")})]})}function sd({replies:e,onSeek:t,selIdx:s=null,activeIdx:n=null,onSelect:r=null,events:o=null}){const c=be();return e.map((i,a)=>{const d=td(i.body),g=y0(d,o),l=d?d.rest:i.body,m=[...l.matchAll(kp)].map(p=>p[1]),v=(m.length?l.replace(kp,""):l).trim(),w=i.rid!==void 0,_=w?i.resolved?" remark resolved":" remark open":"",u=`fv-reply${s===a?" sel":""}${n===a?" active":""}${_}`,f=g&&g.seekable&&t?()=>r?r(a,g.tMs):t(g.tMs):null;return S.jsxs("div",{className:u,children:[S.jsxs("div",{className:"fv-reply-meta",children:[S.jsx("span",{className:"fv-reply-by",children:i.by}),i.at&&S.jsx("span",{className:"fv-reply-at",children:i.at}),g&&(f?S.jsx("button",{type:"button",className:"fv-anchor",onClick:f,title:"seek the clip to this moment",children:g.label}):S.jsxs("span",{className:`fv-anchor static${g.degraded?" degraded":""}`,title:g.degraded?c("thread.anchorDegraded"):void 0,children:[g.label,g.degraded?" ⚠":""]})),w&&(i.resolved?S.jsxs("span",{className:"fv-remark-state resolved",title:i.resolvedBy?c("thread.resolvedBy",{by:i.resolvedBy}):c("thread.resolved"),children:["✓ ",c("thread.resolved")]}):S.jsxs("span",{className:"fv-remark-state open",title:c("thread.openRemark"),children:["● ",c("thread.openRemark")]}))]}),v&&S.jsx("div",{className:"fvd-body",children:S.jsx(Ui,{body:v})}),m.length>0&&S.jsx("div",{className:"fv-reply-media",children:m.map((p,h)=>S.jsx(p0,{hash:p,alt:"evidence"},`${p}-${h}`))})]},a)})}function S0({onSend:e,specs:t=[],sessions:s=[],focusId:n=null,onDone:r,anchorNow:o=null,draft:c=null,actionsEnd:i=null}){const a=be(),[d,g]=B.useState(""),[l,m]=B.useState(!1),[v,w]=B.useState(""),[_,u]=B.useState(!1),f=B.useRef(null),p=v0({inputRef:f,value:d,setValue:g,specs:t,sessions:s,focusId:n,up:!0}),h=Lp(d),y=_||!!d||h.length>0||!!v,b=y||!!i;B.useEffect(()=>{const x=f.current;x&&ju(x,parseFloat(getComputedStyle(x).maxHeight)||1/0)},[d,b]),B.useEffect(()=>{var x;if(!c){g("");return}g(c.body||""),(x=f.current)==null||x.focus()},[c==null?void 0:c.seq]);const C=()=>{var M;const x=o==null?void 0:o();if(!x)return;const k=Xa(x.tMs,x.step);g(D=>{const R=td(D);return R?`${k}
66
- ${R.rest}`:D?`${k}
67
- ${D}`:`${k}
68
- `}),(M=f.current)==null||M.focus()},E=async()=>{const x=d.trim();if(!(!x||l)){m(!0);try{const k=await e(x,Lp(x));k!=null&&k.ok?(g(""),w(""),await(r==null?void 0:r(k.outcomes||""))):w((k==null?void 0:k.error)||"reply failed")}finally{m(!1)}}};return S.jsxs("div",{className:`fv-compose${y?" engaged":""}`,children:[h.length>0&&S.jsx("div",{className:"fv-frames",children:h.map(x=>S.jsx(p0,{hash:x,alt:"frame"},x))}),S.jsxs("div",{className:"fv-tawrap",children:[S.jsx("textarea",{ref:f,className:"fv-textarea",rows:1,value:d,placeholder:a("session.issuesReplyPlaceholder"),disabled:l,onChange:x=>{g(x.target.value),p.sync(x.target)},onSelect:x=>p.sync(x.target),onFocus:()=>u(!0),onBlur:()=>{u(!1),p.close()},onKeyDown:x=>{p.onKeyDown(x)||x.key==="Enter"&&(x.metaKey||x.ctrlKey)&&(x.preventDefault(),E())}}),p.menuEl]}),b&&S.jsxs("div",{className:"fv-actions",children:[o&&S.jsxs("button",{type:"button",className:"fv-anchor-btn",title:a("thread.anchorTitle"),onMouseDown:x=>x.preventDefault(),onClick:C,children:["⏱ ",a("thread.anchorNow")]}),S.jsx("span",{className:"fv-hint",children:v||a("session.issuesMentionHint")}),S.jsx("button",{type:"button",className:"fv-send",disabled:l||!d.trim(),onMouseDown:x=>x.preventDefault(),onClick:E,children:a(l?"session.issuesSending":"session.issuesSend")}),i]})]})}const x0=280,fa=54;function vk(e,t){const s={};e.forEach(o=>{var c;o.parent&&(s[c=o.parent]??(s[c]=[])).push(o.id)});const n={},r=(o,c,i)=>{n[o]={x:c*x0,y:i};const a=t.has(o)?s[o]||[]:[];if(!a.length)return;const d=i-(a.length-1)/2*fa;a.forEach((g,l)=>r(g,c+1,d+l*fa))};return e.filter(o=>!o.parent).forEach((o,c)=>r(o.id,0,c*fa)),n}const Mp=[150,350,600,900];async function Yt(e,t){for(let s=0;;s++)try{return await fetch(e,t)}catch(n){if(s>=Mp.length)throw n;await new Promise(r=>setTimeout(r,Mp[s]))}}async function yk(){return(await Yt("/api/board")).json()}const io=(e,...t)=>`/api/specs/${encodeURIComponent(e)}${t.map(s=>"/"+s).join("")}`;function wk({onBoard:e,onLegacyChange:t,onLive:s}){let n=null,r=!1,o=null,c="";const i=l=>{const{nodes:m=[],sessions:v=[],...w}=l,_=new Map([["meta",w],["nodes#order",m.map(u=>u.id)],["sess#order",v.map(u=>u.id)]]);return m.forEach(u=>_.set("node:"+u.id,u)),v.forEach(u=>_.set("sess:"+u.id,u)),_},a=l=>{const m=(v,w)=>(l.get(w)||[]).map(_=>l.get(v+_));return{...l.get("meta")||{},nodes:m("node:","nodes#order"),sessions:m("sess:","sess#order")}},d=()=>{try{n==null||n.close()}catch{}o=null,c="",g()},g=()=>{if(!r){try{n=new EventSource("/api/board/stream?mode=delta")}catch{n=null,s==null||s(!1);return}n.addEventListener("board-full",l=>{const{to:m,board:v}=JSON.parse(l.data);o=i(v),c=m,s==null||s(!0),e(v)}),n.addEventListener("board-delta",l=>{const m=JSON.parse(l.data);if(!o||c!==m.from){d();return}for(const v of m.del||[])o.delete(v);for(const[v,w]of Object.entries(m.set||{}))o.set(v,w);c=m.to,s==null||s(!0),e(a(o))}),n.addEventListener("board-changed",()=>{s==null||s(!1),t==null||t()}),n.addEventListener("error",()=>s==null?void 0:s(!1))}};return g(),()=>{r=!0;try{n==null||n.close()}catch{}}}const wc=e=>(e==null?void 0:e.project)||"",Sk=e=>(e==null?void 0:e.projectIcon)||"";function xk(e){return e?/^https?:\/\//.test(e)?e:/^[a-z0-9-]+[:/][a-z0-9-]+$/i.test(e)?`https://api.iconify.design/${e.replace(":","/")}.svg`:"data:image/svg+xml,"+encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><text y=".9em" font-size="90">${e}</text></svg>`):""}async function Ck(){return(await Yt("/api/config")).json()}async function bk(){return(await Yt("/api/launchers")).json()}async function Ek(){return(await Yt("/api/issues")).json()}async function kk(e,t,s){return(await Yt(`/api/issues/${encodeURIComponent(e)}/reply`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({body:t,...s!=null&&s.length?{evidence:s}:{}})})).json()}async function Lk(e){return(await Yt(`/api/issues/${encodeURIComponent(e)}/close`,{method:"POST"})).json()}async function Mk({concern:e,body:t,evidence:s,store:n}){return(await Yt("/api/issues",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({concern:e,body:t,store:n,...s!=null&&s.length?{evidence:s}:{}})})).json()}async function Rk({node:e,scenario:t,issue:s,body:n,codeSha:r,evidence:o}){return(await Yt("/api/remarks",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({node:e,scenario:t,issue:s,body:n,...r?{codeSha:r}:{},...o!=null&&o.length?{evidence:o}:{}})})).json()}async function Dk(e){return(await Yt("/api/yatsu/blob",{method:"POST",headers:{"Content-Type":"image/png"},body:e})).json()}const Rp=[{key:"spec",label:"spec"},{key:"history",label:"history"},{key:"issues",label:"issues"},{key:"eval",label:"eval"}];function nd(e){var t;return(t=e==null?void 0:e.overlays)!=null&&t.length?[{key:"edit",label:"edit"},...Rp]:Rp}const Ak={added:"+",edited:"~",deleted:"✕",moved:"→"};function Gr(e){const t=[],s=/`([^`]+)`|\*\*([^*]+)\*\*|\[\[([^\]]+)\]\]/g;let n=0,r,o=0;for(;r=s.exec(e);)r.index>n&&t.push(e.slice(n,r.index)),r[1]!=null?t.push(S.jsx("code",{children:r[1]},o++)):r[2]!=null?t.push(S.jsx("strong",{children:r[2]},o++)):t.push(S.jsx("span",{className:"doc-link",children:r[3]},o++)),n=s.lastIndex;return n<e.length&&t.push(e.slice(n)),t}function Dp(e){const t=e.trim();return t.includes("|")&&/^\|?(\s*:?-+:?\s*\|)+(\s*:?-+:?\s*)?$/.test(t)}function Sc(e){let t=e.trim();return t.startsWith("|")&&(t=t.slice(1)),t.endsWith("|")&&(t=t.slice(0,-1)),t.split("|").map(s=>s.trim())}function Tk(e){const t=e.startsWith(":"),s=e.endsWith(":");return t&&s?"center":s?"right":null}function Ui({body:e}){if(!e)return null;const t=e.replace(/^#\s+[^\n]*\n+/,"").split(`
69
- `),s=[];let n=0,r=0;for(;n<t.length;){const o=t[n].trim();if(/^```/.test(o)){const c=[];for(n++;n<t.length&&!/^```/.test(t[n].trim());)c.push(t[n++]);n++,s.push(S.jsx("pre",{className:"doc-pre",children:S.jsx("code",{children:c.join(`
70
- `)})},r++))}else if(/^#{1,6}\s+/.test(t[n]))s.push(S.jsx("h4",{className:"doc-h",children:Gr(t[n].replace(/^#+\s+/,""))},r++)),n++;else if(o.includes("|")&&n+1<t.length&&Dp(t[n+1])){const c=Sc(t[n]),i=Sc(t[n+1]).map(Tk);n+=2;const a=[];for(;n<t.length&&t[n].includes("|")&&t[n].trim()!==""&&!/^```/.test(t[n].trim());)a.push(Sc(t[n])),n++;s.push(S.jsxs("table",{className:"doc-table",children:[S.jsx("thead",{children:S.jsx("tr",{children:c.map((d,g)=>S.jsx("th",{style:i[g]?{textAlign:i[g]}:void 0,children:Gr(d)},g))})}),S.jsx("tbody",{children:a.map((d,g)=>S.jsx("tr",{children:c.map((l,m)=>S.jsx("td",{style:i[m]?{textAlign:i[m]}:void 0,children:Gr(d[m]??"")},m))},g))})]},r++))}else if(/^-\s+/.test(o)){const c=[];for(;n<t.length&&/^-\s+/.test(t[n].trim());)c.push(t[n++].trim().replace(/^-\s+/,""));s.push(S.jsx("ul",{children:c.map((i,a)=>S.jsx("li",{children:Gr(i)},a))},r++))}else if(o==="")n++;else{const c=[];for(;n<t.length;){const i=t[n];if(i.trim()===""||/^```/.test(i.trim())||/^#{1,6}\s+/.test(i)||/^-\s+/.test(i.trim())||i.includes("|")&&n+1<t.length&&Dp(t[n+1]))break;c.push(i),n++}s.push(S.jsx("p",{children:Gr(c.join(" "))},r++))}}return S.jsx("div",{className:"doc-body",children:s})}function Ap({kind:e,title:t,owner:s,ownerLabel:n,note:r,children:o}){return S.jsxs("section",{className:`spec-part part-${e}`,children:[S.jsxs("header",{className:"part-head",children:[S.jsx("span",{className:"part-title",children:t}),S.jsx("span",{className:`part-owner owner-${s}`,children:n}),r&&S.jsx("span",{className:"part-note",children:r})]}),S.jsx("div",{className:"part-body",children:o})]})}function Nk({parts:e}){const t=be();return S.jsxs("div",{className:"spec-parts",children:[S.jsx(Ap,{kind:"raw",title:t("nodeView.rawTitle"),owner:"human",ownerLabel:t("nodeView.rawOwner"),note:t("nodeView.rawNote"),children:S.jsx(Ui,{body:e.rawSource})}),S.jsx(Ap,{kind:"expanded",title:t("nodeView.expandedTitle"),owner:"agent",ownerLabel:t("nodeView.expandedOwner"),note:t("nodeView.expandedNote"),children:S.jsx(Ui,{body:e.expandedSpec})})]})}const xc=new Map;function Pk(e,t){const s=`${e}@${t??""}`,[n,r]=B.useState(()=>xc.get(s)??null);return B.useEffect(()=>{const o=xc.get(s);if(o){r(o);return}r(null);let c=!0;return fetch(io(e,"content")).then(i=>i.ok?i.json():Promise.reject(i.status)).then(i=>{xc.set(s,i),c&&r(i)}).catch(()=>{c&&r({body:"",parts:null})}),()=>{c=!1}},[e,t,s]),n}function C0({node:e}){var r;const t=be(),s=Pk(e.id,e.version),n=(e.driftFiles||[]).map(o=>`${o.file}: ${t("specNode.driftAhead",{n:o.behind})}`).join(`
71
- `);return S.jsxs("div",{className:"pane-doc",children:[S.jsxs("h1",{children:["# ",e.title]}),S.jsx("blockquote",{children:e.desc}),S.jsxs("div",{className:"doc-stat",children:[S.jsxs("span",{className:`stat-status st-${e.status}`,title:t("nodeView.statusLabel"),children:[S.jsx("i",{className:"stat-dot"}),t(`status.${e.status}`)]}),S.jsxs("span",{className:"stat-chip",title:t("nodeView.versionLabel"),children:["v",e.version||0]}),S.jsx(l0,{scenarios:e.scenarios,evals:e.evals}),e.drift>0&&S.jsxs("span",{className:"stat-chip stat-drift",title:n,children:["⚠",e.drift]}),S.jsxs("span",{className:"stat-sess",title:t("nodeView.lastEditedBy"),children:["✎ ",S.jsx("b",{children:e.session||t("common.none")})]})]}),((r=e.code)==null?void 0:r.length)>0?S.jsxs("div",{className:"doc-gov",children:[S.jsxs("span",{className:"doc-gov-h",children:[t("nodeView.governs")," ",S.jsx("b",{children:e.code.length})]}),S.jsx("div",{className:"doc-gov-files",children:e.code.map(o=>S.jsx("code",{className:"gov-f",children:o},o))})]}):S.jsx("div",{className:"doc-gov prose",children:S.jsx("span",{className:"doc-gov-h",children:t("nodeView.proseNode")})}),(()=>{if(s===null&&e.body==null)return S.jsx("div",{className:"pane-loading",children:S.jsx("span",{className:"spinner","aria-label":t("common.loading")})});const o=e.body??(s==null?void 0:s.body)??"",c=e.parts??(s==null?void 0:s.parts)??null;return c?S.jsx(Nk,{parts:c}):S.jsx(Ui,{body:o})})()]})}function b0(e){const[t,s]=B.useState(null);return B.useEffect(()=>{let n=!0;return fetch(io(e,"history")).then(r=>r.json()).then(r=>{n&&s(r)}).catch(()=>n&&s([])),()=>{n=!1}},[e]),t}const Cc=new Map;function Ik(e,t,s){const n=`${e}/${t}`,[r,o]=B.useState(()=>Cc.get(n)??null);return B.useEffect(()=>{const c=Cc.get(n);if(c){o(c);return}let i=!0;return fetch(io(e,"diff",t)).then(a=>a.json()).then(a=>{Cc.set(n,a),i&&o(a)}).catch(()=>i&&o({patch:""})),()=>{i=!1}},[e,t,s,n]),r}function Bk(e){const t=[];let s=!1;for(const n of e.split(`
72
- `)){if(n.startsWith("@@")){s=!0,t.push({t:"hunk",s:n});continue}!s||n.startsWith("\\")||(n.startsWith("+")?t.push({t:"add",s:n.slice(1)}):n.startsWith("-")?t.push({t:"del",s:n.slice(1)}):t.push({t:"ctx",s:n.slice(1)}))}for(;t.length&&t[t.length-1].t==="ctx"&&t[t.length-1].s==="";)t.pop();return t}function E0({diff:e}){const t=be();if(e==null)return S.jsx("figcaption",{className:"ev-note",children:t("nodeView.loadingChange")});const s=e.patch?Bk(e.patch):[];return s.length?S.jsxs(S.Fragment,{children:[S.jsx("figcaption",{className:"ev-difflabel",children:t("nodeView.diffLabel")}),S.jsx("pre",{className:"ev-diff",children:s.map((n,r)=>S.jsx("div",{className:`dl dl-${n.t}`,children:n.s||" "},r))})]}):S.jsx("figcaption",{className:"ev-note",children:t("nodeView.noChange")})}function k0({items:e,itemKey:t,classes:s,rowClass:n,renderHeader:r,renderEvidence:o,leading:c,trailing:i}){const a=B.useRef(null),[d,g]=B.useState(()=>new Set([0])),l=B.useCallback(v=>g(w=>{const _=new Set(w);return _.has(v)?_.delete(v):_.add(v),_}),[]),m=B.useCallback(()=>g(v=>{const w=a.current;if(!w)return v;let _=-1;for(;v.has(_+1);)_++;if(_<0||_>=e.length-1)return v;const u=w.querySelector(`[data-i="${_}"]`);return!u||u.getBoundingClientRect().bottom-w.getBoundingClientRect().top>w.clientHeight+40?v:new Set(v).add(_+1)}),[e]);return B.useEffect(()=>{const v=a.current;if(!v)return;let w=v.scrollTop;const _=()=>{const f=v.scrollTop,p=f>w;w=f,p&&m()},u=f=>{f.key!=="j"&&f.key!=="ArrowDown"||v.scrollHeight-v.clientHeight-v.scrollTop>1||m()};return v.addEventListener("scroll",_,{passive:!0}),window.addEventListener("keydown",u,!0),()=>{v.removeEventListener("scroll",_),window.removeEventListener("keydown",u,!0)}},[m]),S.jsxs("div",{className:s.pane,ref:a,children:[c,e.map((v,w)=>{const _=d.has(w),u=n?n(v,w):"";return S.jsxs("div",{"data-i":w,className:`${s.row}${u?` ${u}`:""}${_?" open":""}`,children:[S.jsx("button",{className:s.head,onClick:()=>l(w),"aria-expanded":_,children:r(v,w,_)}),_&&S.jsx("figure",{className:s.evidence,children:o(v,w)})]},t(v,w))}),i]})}function jk({node:e,r:t,latest:s}){const n=Ik(e.id,t.hash,!0);return S.jsx(E0,{diff:n})}function L0({node:e,rows:t}){const s=be();return t?t.length?S.jsx(k0,{items:t,itemKey:n=>n.hash,classes:{pane:"pane-hist",row:"ver-row",head:"rec-toggle",evidence:"rec-evidence"},rowClass:(n,r)=>r===0?"latest":"",renderHeader:(n,r,o)=>S.jsxs(S.Fragment,{children:[S.jsxs("div",{className:"rec-head",children:[S.jsx("span",{className:"rec-caret",children:o?"▾":"▸"}),S.jsxs("span",{className:"rec-v",children:["v",t.length-r]}),S.jsx("code",{className:"rec-hash",children:n.hash.slice(0,7)}),S.jsx("span",{className:"rec-date",children:(n.date||"").slice(0,10)}),S.jsxs("span",{className:"rec-diff",children:[S.jsxs("b",{className:"rec-add",children:["+",n.additions??0]}),S.jsxs("b",{className:"rec-del",children:["−",n.deletions??0]})]})]}),S.jsx("div",{className:"rec-msg",children:n.reason}),S.jsxs("div",{className:"rec-sub",children:[s("nodeView.filesChanged",{n:n.files??0})," · ",n.session||s("common.idle")]})]}),renderEvidence:(n,r)=>S.jsx(jk,{node:e,r:n,latest:r===0})}):S.jsx("div",{className:"pane-hist empty",children:s("common.noVersions")}):S.jsx("div",{className:"pane-hist empty",children:s("nodeView.loadingHistory")})}function Tp({i:e}){const t=S.jsxs(S.Fragment,{children:[S.jsxs("span",{className:"issue-card-top",children:[S.jsx("span",{className:"issue-num",children:e.id}),S.jsx("span",{className:`fv-store fv-store-${e.store==="local"?"local":"forge"}`,children:e.store}),S.jsx("span",{className:`issue-state st-${e.status}`,children:e.status})]}),S.jsx("span",{className:"issue-card-title",children:e.concern})]});return e.url?S.jsx("a",{className:"issue-card",href:e.url,target:"_blank",rel:"noreferrer",children:t}):S.jsx("span",{className:"issue-card",children:t})}function M0({node:e}){const t=be(),s=e.issues||[];if(!s.length)return S.jsx("div",{className:"pane-issues empty",children:t("nodeView.noIssues")});const n=s.filter(o=>o.status==="open"),r=s.filter(o=>o.status!=="open");return S.jsxs("div",{className:"pane-issues",children:[n.length>0&&S.jsxs(S.Fragment,{children:[S.jsx("div",{className:"issue-group-head",children:t("nodeView.openIssues",{n:n.length})}),n.map(o=>S.jsx(Tp,{i:o},o.id))]}),r.length>0&&S.jsxs(S.Fragment,{children:[S.jsx("div",{className:"issue-group-head closed",children:t("nodeView.closedIssues",{n:r.length})}),r.map(o=>S.jsx(Tp,{i:o},o.id))]})]})}const bc=new Map;function Ok(e,t,s){const n=`${e} ${t}`,[r,o]=B.useState(()=>bc.get(n)??null);return B.useEffect(()=>{if(!e||!t)return;const c=bc.get(n);c&&o(c);let i=!0;return fetch(`/api/edit?source=${encodeURIComponent(e)}&path=${encodeURIComponent(t)}`).then(a=>a.json()).then(a=>{bc.set(n,a),i&&o(a)}).catch(()=>i&&o(a=>a??{patch:""})),()=>{i=!1}},[e,t,s,n]),r}function $k({node:e,ov:t}){const s=be(),n=Ok(t.source,e.path,!0);return S.jsxs("figure",{className:"edit-rev",children:[S.jsxs("figcaption",{className:"edit-by",children:[S.jsx("span",{className:`ov-mark ov-${t.op}`,children:Ak[t.op]||"•"}),S.jsx("span",{className:"edit-by-label",children:t.label}),S.jsx("span",{className:"edit-state",children:t.committed?s("nodeView.editCommitted"):s("nodeView.editDirty")})]}),S.jsx(E0,{diff:n})]})}function R0({node:e}){const t=be(),s=e.overlays||[];return s.length?S.jsx("div",{className:"pane-edit",children:s.map((n,r)=>S.jsx($k,{node:e,ov:n},r))}):S.jsx("div",{className:"pane-edit empty",children:t("nodeView.noEdit")})}function Fk({verdict:e}){const t=be();return e?e.status==="pass"?S.jsx("span",{className:"eval-verdict pass",children:t("nodeView.eval.pass")}):e.status==="fail"?S.jsx("span",{className:"eval-verdict fail",children:t("nodeView.eval.fail")}):S.jsx("span",{className:"eval-verdict note",title:e.note,children:t("nodeView.eval.note")}):S.jsx("span",{className:"eval-verdict legacy",children:t("nodeView.eval.legacy")})}function Hk({r:e}){var n;const t=be(),s=Jh(e);return S.jsxs(S.Fragment,{children:[e.expected&&S.jsxs("div",{className:"eval-expected",children:[S.jsx("span",{className:"eval-expected-label",children:t("nodeView.eval.expected")})," ",e.expected]}),((n=e.verdict)==null?void 0:n.note)&&S.jsxs("div",{className:"eval-note",children:[S.jsx("span",{className:"eval-expected-label",children:t("nodeView.eval.noteLabel")})," ",e.verdict.note]}),s.length>0?S.jsx("div",{className:"eval-gallery",style:{display:"flex",flexDirection:"column",gap:8},children:s.map((r,o)=>S.jsx(Ga,{e:r,alt:t("nodeView.eval.shotAlt",{scenario:e.scenario})},`${r.hash}-${o}`))}):S.jsx("figcaption",{className:"eval-noimg",children:e.blobState==="miss"?t("nodeView.eval.miss"):t("nodeView.eval.noImage")})]})}function Np({s:e}){var s;const t=be();return S.jsxs("div",{className:"eval-row eval-declared-row",children:[S.jsxs("span",{className:"eval-top",children:[S.jsx(no,{state:"empty",title:t("score.missing")}),S.jsx("span",{className:"eval-scenario",children:e.name}),S.jsx(Zh,{tags:e.tags}),((s=e.code)==null?void 0:s.length)>0&&S.jsx("code",{className:"eval-tracks",children:e.code.join(", ")})]}),e.expected&&S.jsxs("div",{className:"eval-expected",children:[S.jsx("span",{className:"eval-expected-label",children:t("nodeView.eval.expected")})," ",e.expected]})]})}function Pp({track:e}){const t=be();return S.jsxs("div",{className:"eval-row eval-dangling-row",children:[S.jsxs("span",{className:"eval-top",children:[S.jsx("span",{className:"eval-dangling-badge",title:t("nodeView.eval.danglingTitle"),children:"⚠"}),S.jsx("span",{className:"eval-scenario eval-dangling-name",children:e.scenario}),S.jsx("span",{className:"eval-dangling-tag",children:t("nodeView.eval.danglingGone")})]}),S.jsx("div",{className:"eval-dangling-remarks",children:S.jsx(sd,{replies:e.remarks})})]})}const qo=new Map;function zk({node:e}){var a,d,g;const t=be(),s=`${e.id}@${((d=(a=e.evals)==null?void 0:a[0])==null?void 0:d.ts)||""}:${((g=e.evals)==null?void 0:g.length)||0}`,[n,r]=B.useState(()=>qo.get(s)??null);if(B.useEffect(()=>{if(qo.has(s)){r(qo.get(s));return}let l=!0;return r(null),fetch(io(e.id,"evals")).then(m=>m.ok?m.json():Promise.reject(m.status)).then(m=>{const v={scenarios:m.scenarios||e.scenarios||[],readings:m.readings||[],dangling:m.dangling||[]};qo.set(s,v),l&&r(v)}).catch(()=>{l&&r({scenarios:e.scenarios||[],readings:e.evals||[],dangling:[]})}),()=>{l=!1}},[s,e.id]),!e.evals)return S.jsx("div",{className:"pane-eval empty",children:t("nodeView.eval.noScenarios")});if(n===null)return S.jsx("div",{className:"pane-eval pane-loading",children:S.jsx("span",{className:"spinner","aria-label":t("common.loading")})});const o=n.readings,c=n.dangling||[],i=Bn(n.scenarios,o).filter(l=>!l.reading);return o.length?S.jsx(k0,{items:o,leading:i.map(l=>S.jsx(Np,{s:l},l.name)),trailing:c.map(l=>S.jsx(Pp,{track:l},l.threadId)),itemKey:(l,m)=>`${l.scenario}-${l.ts}-${m}`,classes:{pane:"pane-eval",row:"eval-row",head:"eval-head",evidence:"eval-shot"},renderHeader:(l,m,v)=>S.jsxs(S.Fragment,{children:[S.jsxs("span",{className:"eval-top",children:[S.jsx("span",{className:"eval-caret",children:v?"▾":"▸"}),S.jsx("span",{className:"eval-scenario",children:l.scenario}),S.jsx(Fk,{verdict:l.verdict}),S.jsx(no,{state:o0(l),title:l.fresh?void 0:t("nodeView.eval.staleAxes",{axes:l.staleAxes.join(", ")})})]}),S.jsxs("span",{className:"eval-meta",children:[S.jsx("span",{className:"eval-evaluator",children:l.evaluator}),S.jsx("code",{className:"eval-sha",children:l.codeSha.slice(0,7)}),S.jsx("span",{className:"eval-ts",children:l.ts.replace("T"," ").slice(0,16)})]})]}),renderEvidence:l=>S.jsx(Hk,{r:l})}):S.jsxs("div",{className:"pane-eval pane-eval-declared",children:[S.jsx("div",{className:"eval-todo-note",children:t("nodeView.eval.noReadings")}),i.map(l=>S.jsx(Np,{s:l},l.name)),c.map(l=>S.jsx(Pp,{track:l},l.threadId))]})}const Wk={spec:"nodeView.paneSpec",history:"nodeView.paneHistory",issues:"nodeView.paneIssues",eval:"nodeView.paneEval",edit:"nodeView.paneEdit"};function Uk({node:e,pane:t,setPane:s,onClose:n}){const r=be(),o=b0(e.id),c=e.issues||[],i=c.filter(m=>m.status==="open").length,a=c.length-i,d=(e.overlays||[]).length,g=nd(e),l=g.some(m=>m.key===t)?t:g[0].key;return S.jsx("div",{className:"ov-backdrop","data-focus-overlay":!0,onMouseDown:n,children:S.jsxs("div",{className:"ov-panel",onMouseDown:m=>m.stopPropagation(),children:[S.jsxs("div",{className:"ov-head",children:[S.jsx("span",{className:"ov-title",children:e.title}),S.jsx("div",{className:"ov-tabs",children:g.map((m,v)=>S.jsxs("button",{className:m.key===l?"ov-tab on":"ov-tab",onClick:()=>s(m.key),children:[S.jsx("kbd",{children:v+1})," ",r(Wk[m.key]),m.key==="issues"&&(i>0||a>0)&&S.jsxs("span",{className:"ov-tab-counts",children:[i>0&&S.jsx("span",{className:"ovc st-open",title:r("nodeView.openIssues",{n:i}),children:i}),a>0&&S.jsx("span",{className:"ovc st-closed",title:r("nodeView.closedIssues",{n:a}),children:a})]}),m.key==="edit"&&d>0&&S.jsx("span",{className:"ov-tab-counts",children:S.jsx("span",{className:"ovc st-edit",title:r("nodeView.pendingEdits",{n:d}),children:d})})]},m.key))}),S.jsx("span",{className:"ov-hint",children:r("nodeView.hint")})]}),S.jsxs("div",{className:"ov-body",children:[l==="spec"&&S.jsx("div",{className:"pane-solo",children:S.jsx(C0,{node:e})}),l==="history"&&S.jsx(L0,{node:e,rows:o}),l==="issues"&&S.jsx(M0,{node:e}),l==="eval"&&S.jsx(zk,{node:e}),l==="edit"&&S.jsx(R0,{node:e})]})]})})}let Ec=null;function D0(e=!0){const[t,s]=B.useState(Ec),n=B.useRef(!1);return B.useEffect(()=>{!e||n.current||(n.current=!0,fetch("/api/specs/lite").then(r=>r.ok?r.json():[]).then(r=>{Ec={bodies:Object.fromEntries((r||[]).map(o=>[o.id,o.body||""])),scenarios:Object.fromEntries((r||[]).filter(o=>{var c;return(c=o.scenarios)==null?void 0:c.length}).map(o=>[o.id,Object.fromEntries(o.scenarios.map(c=>[c.name,c]))]))},s(Ec)}).catch(()=>{}))},[e]),t}const Vk={pass:"✓",fail:"✗",stalePass:"✓",staleFail:"✗",empty:"○",missing:"·"};function Kk({s:e,prose:t,t:s,onOpenEval:n}){const r=(t==null?void 0:t.expected)??e.expected,o=(t==null?void 0:t.code)??e.code;return S.jsxs("button",{type:"button",className:`fp-scenario ${e.state}`,onClick:n,title:s("focusPanel.openEval"),children:[S.jsx("span",{className:"fp-sc-mark",title:s(`score.${e.state}`),children:Vk[e.state]}),S.jsxs("span",{className:"fp-sc-body",children:[S.jsx("span",{className:"fp-sc-name",children:e.name}),S.jsx(Zh,{tags:e.tags}),r&&S.jsx("span",{className:"fp-sc-expected",children:r}),(o==null?void 0:o.length)>0&&S.jsx("span",{className:"fp-sc-code",children:s("focusPanel.tracks",{files:o.join(", ")})})]})]})}function Ip({i:e}){const t=S.jsxs(S.Fragment,{children:[S.jsxs("span",{className:"issue-card-top",children:[S.jsx("span",{className:"issue-num",children:e.id}),S.jsx("span",{className:`fv-store fv-store-${e.store==="local"?"local":"forge"}`,children:e.store}),S.jsx("span",{className:`issue-state st-${e.status}`,children:e.status})]}),S.jsx("span",{className:"issue-card-title",children:e.concern})]});return e.url?S.jsx("a",{className:"issue-card",href:e.url,target:"_blank",rel:"noreferrer",children:t}):S.jsx("span",{className:"issue-card",children:t})}function qk({node:e,onOpenEval:t}){var g;const s=be(),n=Bn(e==null?void 0:e.scenarios,e==null?void 0:e.evals),r=D0(n.length>0),o=e?(g=r==null?void 0:r.scenarios)==null?void 0:g[e.id]:null,c=n.filter(l=>l.state==="pass").length,i=(e==null?void 0:e.issues)||[],a=i.filter(l=>l.status==="open"),d=i.filter(l=>l.status!=="open");return S.jsxs("aside",{className:"focus-panel",children:[S.jsxs("div",{className:"fp-head",children:[S.jsx("span",{className:"fp-title",children:e?e.title:s("focusPanel.noFocus")}),(e==null?void 0:e.desc)&&S.jsx("span",{className:"fp-desc",title:e.desc,children:e.desc})]}),S.jsxs("section",{className:"fp-sec",children:[S.jsxs("div",{className:"fp-sec-head",children:[S.jsx("span",{children:s("focusPanel.scenarios")}),n.length>0&&S.jsxs("span",{className:`fp-count ${a0(n)}`,children:["✓",c,"/",n.length]})]}),n.length?n.map(l=>S.jsx(Kk,{s:l,prose:o==null?void 0:o[l.name],t:s,onOpenEval:t},l.name)):S.jsx("div",{className:"fp-empty",children:s("focusPanel.noScenarios")})]}),S.jsxs("section",{className:"fp-sec",children:[S.jsxs("div",{className:"fp-sec-head",children:[S.jsx("span",{children:s("focusPanel.issues")}),i.length>0&&S.jsxs("span",{className:"fp-issue-counts",children:[a.length>0&&S.jsx("span",{className:"issue-state st-open",children:s("focusPanel.open",{n:a.length})}),d.length>0&&S.jsx("span",{className:"issue-state st-closed",children:s("focusPanel.closed",{n:d.length})})]})]}),i.length?S.jsxs(S.Fragment,{children:[a.map(l=>S.jsx(Ip,{i:l},l.id)),d.length>0&&S.jsx("div",{className:"issue-group-head closed",children:s("focusPanel.closed",{n:d.length})}),d.map(l=>S.jsx(Ip,{i:l},l.id))]}):S.jsx("div",{className:"fp-empty",children:s("focusPanel.noIssues")})]})]})}const A0=({size:e=12})=>S.jsxs("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[S.jsx("rect",{x:"3.5",y:"7",width:"9",height:"6.5",rx:"1.2"}),S.jsx("path",{d:"M5.5 7 V5 a2.5 2.5 0 0 1 5 0 V7"})]});function Gk(e){if(!e.length)return null;const t={};return e.forEach(s=>{t[s.op]=(t[s.op]||0)+1}),Object.entries(t).map(([s,n])=>`${Ll[s]}${n}`).join(" ")}function T0({guides:e=[],expandable:t,expanded:s,rollup:n,kin:r=0,onToggle:o}){return S.jsxs("span",{className:"sess-lead",children:[e.map((c,i)=>{const a=i===e.length-1?c?"tee":"elbow":c?"rail":"gap";return S.jsx("span",{className:`sess-rail ${a}`,"aria-hidden":"true"},i)}),t&&S.jsx("span",{className:`sess-fold pod${s?" open":""}`,role:"button",tabIndex:-1,style:s?{color:n,borderColor:n}:{background:n,borderColor:n},title:`${r} nested session${r===1?"":"s"} — click to ${s?"collapse":"expand"}`,onClick:c=>{c.stopPropagation(),o==null||o()},onMouseDown:c=>c.stopPropagation(),children:r})]})}function N0(){const[e,t]=B.useState(()=>new Set);return{expanded:e,toggle:n=>t(r=>{const o=new Set(r);return o.has(n)?o.delete(n):o.add(n),o})}}function rd({s:e,locked:t,showAvatar:s=!0,compact:n=!1,lead:r=null}){const o=be(),c=Gk(e.ops),i=Nn(e),a=o(`status.${e.status}`);return S.jsxs(S.Fragment,{children:[r,s&&S.jsx(so,{seed:e.id,status:e.status,title:`${ro(e)} · ${a} — ${e.id.slice(0,8)}`}),S.jsxs("span",{className:"sess-meta",children:[n?S.jsx("span",{className:"sess-glyph",style:{color:xt[e.status]},title:a,"aria-label":a,children:c0[e.status]}):S.jsx("span",{className:"sess-status",style:{color:xt[e.status]},children:a}),c&&S.jsx("span",{className:"sess-ops",children:c})]}),S.jsx("span",{className:"sess-id",title:i,children:i}),t&&S.jsx("span",{className:"sess-lock",title:o("sessionWindow.lockedTitle"),children:S.jsx(A0,{})})]})}function Xk({sessions:e,activeId:t,onPick:s,onOpenSession:n}){const r=be(),{expanded:o,toggle:c}=N0(),i=a=>o.has(a);return S.jsx("div",{className:"sesswin",children:e.length===0?S.jsxs("div",{className:"sesswin-empty",children:[r("sessionWindow.emptyBefore"),S.jsx("kbd",{children:"⏎"}),r("sessionWindow.emptyAfter")]}):h0(e,i).map(a=>{if(a.type==="zone")return S.jsx("div",{className:`sesswin-zone sesswin-zone-${a.zone}`,children:r(`sessionZone.${a.zone}`)},`zone-${a.zone}`);const d=a.s,g=d.source===t,l=a.expandable||a.depth?S.jsx(T0,{guides:a.guides,expandable:a.expandable,expanded:a.expanded,rollup:a.rollup,kin:a.kin,onToggle:()=>c(d.id)}):null;return S.jsx("button",{className:g?"sess-row locked":"sess-row",style:{"--ov":zi(d.id)},onClick:()=>s(d),onDoubleClick:()=>n(d.id),title:r("sessionWindow.rowTitle"),children:S.jsx(rd,{s:d,locked:g,compact:!0,lead:l})},d.id)})})}var P0={exports:{}};(function(e,t){(function(s,n){e.exports=n()})(globalThis,()=>(()=>{var s={4567:function(c,i,a){var d=this&&this.__decorate||function(p,h,y,b){var C,E=arguments.length,x=E<3?h:b===null?b=Object.getOwnPropertyDescriptor(h,y):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(p,h,y,b);else for(var k=p.length-1;k>=0;k--)(C=p[k])&&(x=(E<3?C(x):E>3?C(h,y,x):C(h,y))||x);return E>3&&x&&Object.defineProperty(h,y,x),x},g=this&&this.__param||function(p,h){return function(y,b){h(y,b,p)}};Object.defineProperty(i,"__esModule",{value:!0}),i.AccessibilityManager=void 0;const l=a(9042),m=a(9924),v=a(844),w=a(4725),_=a(2585),u=a(3656);let f=i.AccessibilityManager=class extends v.Disposable{constructor(p,h,y,b){super(),this._terminal=p,this._coreBrowserService=y,this._renderService=b,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=this._coreBrowserService.mainDocument.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let C=0;C<this._terminal.rows;C++)this._rowElements[C]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[C]);if(this._topBoundaryFocusListener=C=>this._handleBoundaryFocus(C,0),this._bottomBoundaryFocusListener=C=>this._handleBoundaryFocus(C,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new m.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this.register(this._terminal.onResize(C=>this._handleResize(C.rows))),this.register(this._terminal.onRender(C=>this._refreshRows(C.start,C.end))),this.register(this._terminal.onScroll(()=>this._refreshRows())),this.register(this._terminal.onA11yChar(C=>this._handleChar(C))),this.register(this._terminal.onLineFeed(()=>this._handleChar(`
73
- `))),this.register(this._terminal.onA11yTab(C=>this._handleTab(C))),this.register(this._terminal.onKey(C=>this._handleKey(C.key))),this.register(this._terminal.onBlur(()=>this._clearLiveRegion())),this.register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this.register((0,u.addDisposableDomListener)(document,"selectionchange",()=>this._handleSelectionChange())),this.register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRows(),this.register((0,v.toDisposable)(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(p){for(let h=0;h<p;h++)this._handleChar(" ")}_handleChar(p){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==p&&(this._charsToAnnounce+=p):this._charsToAnnounce+=p,p===`
74
- `&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=l.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(p){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(p)||this._charsToConsume.push(p)}_refreshRows(p,h){this._liveRegionDebouncer.refresh(p,h,this._terminal.rows)}_renderRows(p,h){const y=this._terminal.buffer,b=y.lines.length.toString();for(let C=p;C<=h;C++){const E=y.lines.get(y.ydisp+C),x=[],k=(E==null?void 0:E.translateToString(!0,void 0,void 0,x))||"",M=(y.ydisp+C+1).toString(),D=this._rowElements[C];D&&(k.length===0?(D.innerText=" ",this._rowColumns.set(D,[0,1])):(D.textContent=k,this._rowColumns.set(D,x)),D.setAttribute("aria-posinset",M),D.setAttribute("aria-setsize",b))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(p,h){const y=p.target,b=this._rowElements[h===0?1:this._rowElements.length-2];if(y.getAttribute("aria-posinset")===(h===0?"1":`${this._terminal.buffer.lines.length}`)||p.relatedTarget!==b)return;let C,E;if(h===0?(C=y,E=this._rowElements.pop(),this._rowContainer.removeChild(E)):(C=this._rowElements.shift(),E=y,this._rowContainer.removeChild(C)),C.removeEventListener("focus",this._topBoundaryFocusListener),E.removeEventListener("focus",this._bottomBoundaryFocusListener),h===0){const x=this._createAccessibilityTreeNode();this._rowElements.unshift(x),this._rowContainer.insertAdjacentElement("afterbegin",x)}else{const x=this._createAccessibilityTreeNode();this._rowElements.push(x),this._rowContainer.appendChild(x)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(h===0?-1:1),this._rowElements[h===0?1:this._rowElements.length-2].focus(),p.preventDefault(),p.stopImmediatePropagation()}_handleSelectionChange(){var k;if(this._rowElements.length===0)return;const p=document.getSelection();if(!p)return;if(p.isCollapsed)return void(this._rowContainer.contains(p.anchorNode)&&this._terminal.clearSelection());if(!p.anchorNode||!p.focusNode)return void console.error("anchorNode and/or focusNode are null");let h={node:p.anchorNode,offset:p.anchorOffset},y={node:p.focusNode,offset:p.focusOffset};if((h.node.compareDocumentPosition(y.node)&Node.DOCUMENT_POSITION_PRECEDING||h.node===y.node&&h.offset>y.offset)&&([h,y]=[y,h]),h.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(h={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(h.node))return;const b=this._rowElements.slice(-1)[0];if(y.node.compareDocumentPosition(b)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(y={node:b,offset:((k=b.textContent)==null?void 0:k.length)??0}),!this._rowContainer.contains(y.node))return;const C=({node:M,offset:D})=>{const R=M instanceof Text?M.parentNode:M;let N=parseInt(R==null?void 0:R.getAttribute("aria-posinset"),10)-1;if(isNaN(N))return console.warn("row is invalid. Race condition?"),null;const A=this._rowColumns.get(R);if(!A)return console.warn("columns is null. Race condition?"),null;let $=D<A.length?A[D]:A.slice(-1)[0]+1;return $>=this._terminal.cols&&(++N,$=0),{row:N,column:$}},E=C(h),x=C(y);if(E&&x){if(E.row>x.row||E.row===x.row&&E.column>=x.column)throw new Error("invalid range");this._terminal.select(E.column,E.row,(x.row-E.row)*this._terminal.cols-E.column+x.column)}}_handleResize(p){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let h=this._rowContainer.children.length;h<this._terminal.rows;h++)this._rowElements[h]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[h]);for(;this._rowElements.length>p;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const p=this._coreBrowserService.mainDocument.createElement("div");return p.setAttribute("role","listitem"),p.tabIndex=-1,this._refreshRowDimensions(p),p}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let p=0;p<this._terminal.rows;p++)this._refreshRowDimensions(this._rowElements[p])}}_refreshRowDimensions(p){p.style.height=`${this._renderService.dimensions.css.cell.height}px`}};i.AccessibilityManager=f=d([g(1,_.IInstantiationService),g(2,w.ICoreBrowserService),g(3,w.IRenderService)],f)},3614:(c,i)=>{function a(m){return m.replace(/\r?\n/g,"\r")}function d(m,v){return v?"\x1B[200~"+m+"\x1B[201~":m}function g(m,v,w,_){m=d(m=a(m),w.decPrivateModes.bracketedPasteMode&&_.rawOptions.ignoreBracketedPasteMode!==!0),w.triggerDataEvent(m,!0),v.value=""}function l(m,v,w){const _=w.getBoundingClientRect(),u=m.clientX-_.left-10,f=m.clientY-_.top-10;v.style.width="20px",v.style.height="20px",v.style.left=`${u}px`,v.style.top=`${f}px`,v.style.zIndex="1000",v.focus()}Object.defineProperty(i,"__esModule",{value:!0}),i.rightClickHandler=i.moveTextAreaUnderMouseCursor=i.paste=i.handlePasteEvent=i.copyHandler=i.bracketTextForPaste=i.prepareTextForTerminal=void 0,i.prepareTextForTerminal=a,i.bracketTextForPaste=d,i.copyHandler=function(m,v){m.clipboardData&&m.clipboardData.setData("text/plain",v.selectionText),m.preventDefault()},i.handlePasteEvent=function(m,v,w,_){m.stopPropagation(),m.clipboardData&&g(m.clipboardData.getData("text/plain"),v,w,_)},i.paste=g,i.moveTextAreaUnderMouseCursor=l,i.rightClickHandler=function(m,v,w,_,u){l(m,v,w),u&&_.rightClickSelect(m),v.value=_.selectionText,v.select()}},7239:(c,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.ColorContrastCache=void 0;const d=a(1505);i.ColorContrastCache=class{constructor(){this._color=new d.TwoKeyMap,this._css=new d.TwoKeyMap}setCss(g,l,m){this._css.set(g,l,m)}getCss(g,l){return this._css.get(g,l)}setColor(g,l,m){this._color.set(g,l,m)}getColor(g,l){return this._color.get(g,l)}clear(){this._color.clear(),this._css.clear()}}},3656:(c,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.addDisposableDomListener=void 0,i.addDisposableDomListener=function(a,d,g,l){a.addEventListener(d,g,l);let m=!1;return{dispose:()=>{m||(m=!0,a.removeEventListener(d,g,l))}}}},3551:function(c,i,a){var d=this&&this.__decorate||function(f,p,h,y){var b,C=arguments.length,E=C<3?p:y===null?y=Object.getOwnPropertyDescriptor(p,h):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(f,p,h,y);else for(var x=f.length-1;x>=0;x--)(b=f[x])&&(E=(C<3?b(E):C>3?b(p,h,E):b(p,h))||E);return C>3&&E&&Object.defineProperty(p,h,E),E},g=this&&this.__param||function(f,p){return function(h,y){p(h,y,f)}};Object.defineProperty(i,"__esModule",{value:!0}),i.Linkifier=void 0;const l=a(3656),m=a(8460),v=a(844),w=a(2585),_=a(4725);let u=i.Linkifier=class extends v.Disposable{get currentLink(){return this._currentLink}constructor(f,p,h,y,b){super(),this._element=f,this._mouseService=p,this._renderService=h,this._bufferService=y,this._linkProviderService=b,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new m.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new m.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,v.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,v.toDisposable)(()=>{var C;this._lastMouseEvent=void 0,(C=this._activeProviderReplies)==null||C.clear()})),this.register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this.register((0,l.addDisposableDomListener)(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this.register((0,l.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,l.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,l.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(f){this._lastMouseEvent=f;const p=this._positionFromMouseEvent(f,this._element,this._mouseService);if(!p)return;this._isMouseOut=!1;const h=f.composedPath();for(let y=0;y<h.length;y++){const b=h[y];if(b.classList.contains("xterm"))break;if(b.classList.contains("xterm-hover"))return}this._lastBufferCell&&p.x===this._lastBufferCell.x&&p.y===this._lastBufferCell.y||(this._handleHover(p),this._lastBufferCell=p)}_handleHover(f){if(this._activeLine!==f.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(f,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,f)||(this._clearCurrentLink(),this._askForLink(f,!0))}_askForLink(f,p){var y,b;this._activeProviderReplies&&p||((y=this._activeProviderReplies)==null||y.forEach(C=>{C==null||C.forEach(E=>{E.link.dispose&&E.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=f.y);let h=!1;for(const[C,E]of this._linkProviderService.linkProviders.entries())p?(b=this._activeProviderReplies)!=null&&b.get(C)&&(h=this._checkLinkProviderResult(C,f,h)):E.provideLinks(f.y,x=>{var M,D;if(this._isMouseOut)return;const k=x==null?void 0:x.map(R=>({link:R}));(M=this._activeProviderReplies)==null||M.set(C,k),h=this._checkLinkProviderResult(C,f,h),((D=this._activeProviderReplies)==null?void 0:D.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(f.y,this._activeProviderReplies)})}_removeIntersectingLinks(f,p){const h=new Set;for(let y=0;y<p.size;y++){const b=p.get(y);if(b)for(let C=0;C<b.length;C++){const E=b[C],x=E.link.range.start.y<f?0:E.link.range.start.x,k=E.link.range.end.y>f?this._bufferService.cols:E.link.range.end.x;for(let M=x;M<=k;M++){if(h.has(M)){b.splice(C--,1);break}h.add(M)}}}}_checkLinkProviderResult(f,p,h){var C;if(!this._activeProviderReplies)return h;const y=this._activeProviderReplies.get(f);let b=!1;for(let E=0;E<f;E++)this._activeProviderReplies.has(E)&&!this._activeProviderReplies.get(E)||(b=!0);if(!b&&y){const E=y.find(x=>this._linkAtPosition(x.link,p));E&&(h=!0,this._handleNewLink(E))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!h)for(let E=0;E<this._activeProviderReplies.size;E++){const x=(C=this._activeProviderReplies.get(E))==null?void 0:C.find(k=>this._linkAtPosition(k.link,p));if(x){h=!0,this._handleNewLink(x);break}}return h}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(f){if(!this._currentLink)return;const p=this._positionFromMouseEvent(f,this._element,this._mouseService);p&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,p)&&this._currentLink.link.activate(f,this._currentLink.link.text)}_clearCurrentLink(f,p){this._currentLink&&this._lastMouseEvent&&(!f||!p||this._currentLink.link.range.start.y>=f&&this._currentLink.link.range.end.y<=p)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,v.disposeArray)(this._linkCacheDisposables))}_handleNewLink(f){if(!this._lastMouseEvent)return;const p=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);p&&this._linkAtPosition(f.link,p)&&(this._currentLink=f,this._currentLink.state={decorations:{underline:f.link.decorations===void 0||f.link.decorations.underline,pointerCursor:f.link.decorations===void 0||f.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,f.link,this._lastMouseEvent),f.link.decorations={},Object.defineProperties(f.link.decorations,{pointerCursor:{get:()=>{var h,y;return(y=(h=this._currentLink)==null?void 0:h.state)==null?void 0:y.decorations.pointerCursor},set:h=>{var y;(y=this._currentLink)!=null&&y.state&&this._currentLink.state.decorations.pointerCursor!==h&&(this._currentLink.state.decorations.pointerCursor=h,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",h))}},underline:{get:()=>{var h,y;return(y=(h=this._currentLink)==null?void 0:h.state)==null?void 0:y.decorations.underline},set:h=>{var y,b,C;(y=this._currentLink)!=null&&y.state&&((C=(b=this._currentLink)==null?void 0:b.state)==null?void 0:C.decorations.underline)!==h&&(this._currentLink.state.decorations.underline=h,this._currentLink.state.isHovered&&this._fireUnderlineEvent(f.link,h))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(h=>{if(!this._currentLink)return;const y=h.start===0?0:h.start+1+this._bufferService.buffer.ydisp,b=this._bufferService.buffer.ydisp+1+h.end;if(this._currentLink.link.range.start.y>=y&&this._currentLink.link.range.end.y<=b&&(this._clearCurrentLink(y,b),this._lastMouseEvent)){const C=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);C&&this._askForLink(C,!1)}})))}_linkHover(f,p,h){var y;(y=this._currentLink)!=null&&y.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(p,!0),this._currentLink.state.decorations.pointerCursor&&f.classList.add("xterm-cursor-pointer")),p.hover&&p.hover(h,p.text)}_fireUnderlineEvent(f,p){const h=f.range,y=this._bufferService.buffer.ydisp,b=this._createLinkUnderlineEvent(h.start.x-1,h.start.y-y-1,h.end.x,h.end.y-y-1,void 0);(p?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(b)}_linkLeave(f,p,h){var y;(y=this._currentLink)!=null&&y.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(p,!1),this._currentLink.state.decorations.pointerCursor&&f.classList.remove("xterm-cursor-pointer")),p.leave&&p.leave(h,p.text)}_linkAtPosition(f,p){const h=f.range.start.y*this._bufferService.cols+f.range.start.x,y=f.range.end.y*this._bufferService.cols+f.range.end.x,b=p.y*this._bufferService.cols+p.x;return h<=b&&b<=y}_positionFromMouseEvent(f,p,h){const y=h.getCoords(f,p,this._bufferService.cols,this._bufferService.rows);if(y)return{x:y[0],y:y[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(f,p,h,y,b){return{x1:f,y1:p,x2:h,y2:y,cols:this._bufferService.cols,fg:b}}};i.Linkifier=u=d([g(1,_.IMouseService),g(2,_.IRenderService),g(3,w.IBufferService),g(4,_.ILinkProviderService)],u)},9042:(c,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.tooMuchOutput=i.promptLabel=void 0,i.promptLabel="Terminal input",i.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(c,i,a){var d=this&&this.__decorate||function(_,u,f,p){var h,y=arguments.length,b=y<3?u:p===null?p=Object.getOwnPropertyDescriptor(u,f):p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(_,u,f,p);else for(var C=_.length-1;C>=0;C--)(h=_[C])&&(b=(y<3?h(b):y>3?h(u,f,b):h(u,f))||b);return y>3&&b&&Object.defineProperty(u,f,b),b},g=this&&this.__param||function(_,u){return function(f,p){u(f,p,_)}};Object.defineProperty(i,"__esModule",{value:!0}),i.OscLinkProvider=void 0;const l=a(511),m=a(2585);let v=i.OscLinkProvider=class{constructor(_,u,f){this._bufferService=_,this._optionsService=u,this._oscLinkService=f}provideLinks(_,u){var k;const f=this._bufferService.buffer.lines.get(_-1);if(!f)return void u(void 0);const p=[],h=this._optionsService.rawOptions.linkHandler,y=new l.CellData,b=f.getTrimmedLength();let C=-1,E=-1,x=!1;for(let M=0;M<b;M++)if(E!==-1||f.hasContent(M)){if(f.loadCell(M,y),y.hasExtendedAttrs()&&y.extended.urlId){if(E===-1){E=M,C=y.extended.urlId;continue}x=y.extended.urlId!==C}else E!==-1&&(x=!0);if(x||E!==-1&&M===b-1){const D=(k=this._oscLinkService.getLinkData(C))==null?void 0:k.uri;if(D){const R={start:{x:E+1,y:_},end:{x:M+(x||M!==b-1?0:1),y:_}};let N=!1;if(!(h!=null&&h.allowNonHttpProtocols))try{const A=new URL(D);["http:","https:"].includes(A.protocol)||(N=!0)}catch{N=!0}N||p.push({text:D,range:R,activate:(A,$)=>h?h.activate(A,$,R):w(0,$),hover:(A,$)=>{var F;return(F=h==null?void 0:h.hover)==null?void 0:F.call(h,A,$,R)},leave:(A,$)=>{var F;return(F=h==null?void 0:h.leave)==null?void 0:F.call(h,A,$,R)}})}x=!1,y.hasExtendedAttrs()&&y.extended.urlId?(E=M,C=y.extended.urlId):(E=-1,C=-1)}}u(p)}};function w(_,u){if(confirm(`Do you want to navigate to ${u}?
75
-
76
- WARNING: This link could potentially be dangerous`)){const f=window.open();if(f){try{f.opener=null}catch{}f.location.href=u}else console.warn("Opening link blocked as opener could not be cleared")}}i.OscLinkProvider=v=d([g(0,m.IBufferService),g(1,m.IOptionsService),g(2,m.IOscLinkService)],v)},6193:(c,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.RenderDebouncer=void 0,i.RenderDebouncer=class{constructor(a,d){this._renderCallback=a,this._coreBrowserService=d,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(a){return this._refreshCallbacks.push(a),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(a,d,g){this._rowCount=g,a=a!==void 0?a:0,d=d!==void 0?d:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,a):a,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,d):d,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return void this._runRefreshCallbacks();const a=Math.max(this._rowStart,0),d=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(a,d),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const a of this._refreshCallbacks)a(0);this._refreshCallbacks=[]}}},3236:(c,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.Terminal=void 0;const d=a(3614),g=a(3656),l=a(3551),m=a(9042),v=a(3730),w=a(1680),_=a(3107),u=a(5744),f=a(2950),p=a(1296),h=a(428),y=a(4269),b=a(5114),C=a(8934),E=a(3230),x=a(9312),k=a(4725),M=a(6731),D=a(8055),R=a(8969),N=a(8460),A=a(844),$=a(6114),F=a(8437),H=a(2584),I=a(7399),L=a(5941),T=a(9074),j=a(2585),O=a(5435),V=a(4567),q=a(779);class J extends R.CoreTerminal{get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}constructor(z={}){super(z),this.browser=$,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new A.MutableDisposable),this._onCursorMove=this.register(new N.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new N.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new N.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new N.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new N.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new N.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new N.EventEmitter),this._onBlur=this.register(new N.EventEmitter),this._onA11yCharEmitter=this.register(new N.EventEmitter),this._onA11yTabEmitter=this.register(new N.EventEmitter),this._onWillOpen=this.register(new N.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(T.DecorationService),this._instantiationService.setService(j.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(q.LinkProviderService),this._instantiationService.setService(k.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(v.OscLinkProvider)),this.register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this.register(this._inputHandler.onRequestRefreshRows((P,K)=>this.refresh(P,K))),this.register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this.register(this._inputHandler.onRequestReset(()=>this.reset())),this.register(this._inputHandler.onRequestWindowsOptionsReport(P=>this._reportWindowsOptions(P))),this.register(this._inputHandler.onColor(P=>this._handleColorEvent(P))),this.register((0,N.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,N.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,N.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,N.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize(P=>this._afterResize(P.cols,P.rows))),this.register((0,A.toDisposable)(()=>{var P,K;this._customKeyEventHandler=void 0,(K=(P=this.element)==null?void 0:P.parentNode)==null||K.removeChild(this.element)}))}_handleColorEvent(z){if(this._themeService)for(const P of z){let K,U="";switch(P.index){case 256:K="foreground",U="10";break;case 257:K="background",U="11";break;case 258:K="cursor",U="12";break;default:K="ansi",U="4;"+P.index}switch(P.type){case 0:const Z=D.color.toColorRGB(K==="ansi"?this._themeService.colors.ansi[P.index]:this._themeService.colors[K]);this.coreService.triggerDataEvent(`${H.C0.ESC}]${U};${(0,L.toRgbString)(Z)}${H.C1_ESCAPED.ST}`);break;case 1:if(K==="ansi")this._themeService.modifyColors(Y=>Y.ansi[P.index]=D.channels.toColor(...P.color));else{const Y=K;this._themeService.modifyColors(ne=>ne[Y]=D.channels.toColor(...P.color))}break;case 2:this._themeService.restoreColor(P.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(z){z?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(V.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(z){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(H.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var z;return(z=this.textarea)==null?void 0:z.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(H.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;const z=this.buffer.ybase+this.buffer.y,P=this.buffer.lines.get(z);if(!P)return;const K=Math.min(this.buffer.x,this.cols-1),U=this._renderService.dimensions.css.cell.height,Z=P.getWidth(K),Y=this._renderService.dimensions.css.cell.width*Z,ne=this.buffer.y*this._renderService.dimensions.css.cell.height,ie=K*this._renderService.dimensions.css.cell.width;this.textarea.style.left=ie+"px",this.textarea.style.top=ne+"px",this.textarea.style.width=Y+"px",this.textarea.style.height=U+"px",this.textarea.style.lineHeight=U+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,g.addDisposableDomListener)(this.element,"copy",P=>{this.hasSelection()&&(0,d.copyHandler)(P,this._selectionService)}));const z=P=>(0,d.handlePasteEvent)(P,this.textarea,this.coreService,this.optionsService);this.register((0,g.addDisposableDomListener)(this.textarea,"paste",z)),this.register((0,g.addDisposableDomListener)(this.element,"paste",z)),$.isFirefox?this.register((0,g.addDisposableDomListener)(this.element,"mousedown",P=>{P.button===2&&(0,d.rightClickHandler)(P,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this.register((0,g.addDisposableDomListener)(this.element,"contextmenu",P=>{(0,d.rightClickHandler)(P,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),$.isLinux&&this.register((0,g.addDisposableDomListener)(this.element,"auxclick",P=>{P.button===1&&(0,d.moveTextAreaUnderMouseCursor)(P,this.textarea,this.screenElement)}))}_bindKeys(){this.register((0,g.addDisposableDomListener)(this.textarea,"keyup",z=>this._keyUp(z),!0)),this.register((0,g.addDisposableDomListener)(this.textarea,"keydown",z=>this._keyDown(z),!0)),this.register((0,g.addDisposableDomListener)(this.textarea,"keypress",z=>this._keyPress(z),!0)),this.register((0,g.addDisposableDomListener)(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this.register((0,g.addDisposableDomListener)(this.textarea,"compositionupdate",z=>this._compositionHelper.compositionupdate(z))),this.register((0,g.addDisposableDomListener)(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this.register((0,g.addDisposableDomListener)(this.textarea,"input",z=>this._inputEvent(z),!0)),this.register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(z){var K;if(!z)throw new Error("Terminal requires a parent element.");if(z.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((K=this.element)==null?void 0:K.ownerDocument.defaultView)&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=z.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),z.appendChild(this.element);const P=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),P.appendChild(this._viewportElement),this._viewportScrollArea=this._document.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this.register((0,g.addDisposableDomListener)(this.screenElement,"mousemove",U=>this.updateCursorStyle(U))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),P.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",m.promptLabel),$.isChromeOS||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._coreBrowserService=this.register(this._instantiationService.createInstance(b.CoreBrowserService,this.textarea,z.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(k.ICoreBrowserService,this._coreBrowserService),this.register((0,g.addDisposableDomListener)(this.textarea,"focus",U=>this._handleTextAreaFocus(U))),this.register((0,g.addDisposableDomListener)(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(h.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(k.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(M.ThemeService),this._instantiationService.setService(k.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(y.CharacterJoinerService),this._instantiationService.setService(k.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(E.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(k.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange(U=>this._onRender.fire(U))),this.onResize(U=>this._renderService.resize(U.cols,U.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(f.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(C.MouseService),this._instantiationService.setService(k.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(l.Linkifier,this.screenElement)),this.element.appendChild(P);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(w.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines(U=>this.scrollLines(U.amount,U.suppressScrollEvent,1)),this.register(this._inputHandler.onRequestSyncScrollBar(()=>this.viewport.syncScrollArea())),this.register(this.viewport),this.register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this.register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this.register(this.onBlur(()=>this._renderService.handleBlur())),this.register(this.onFocus(()=>this._renderService.handleFocus())),this.register(this._renderService.onDimensionsChange(()=>this.viewport.syncScrollArea())),this._selectionService=this.register(this._instantiationService.createInstance(x.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(k.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines(U=>this.scrollLines(U.amount,U.suppressScrollEvent))),this.register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this.register(this._selectionService.onRequestRedraw(U=>this._renderService.handleSelectionChanged(U.start,U.end,U.columnSelectMode))),this.register(this._selectionService.onLinuxMouseSelection(U=>{this.textarea.value=U,this.textarea.focus(),this.textarea.select()})),this.register(this._onScroll.event(U=>{this.viewport.syncScrollArea(),this._selectionService.refresh()})),this.register((0,g.addDisposableDomListener)(this._viewportElement,"scroll",()=>this._selectionService.refresh())),this.register(this._instantiationService.createInstance(_.BufferDecorationRenderer,this.screenElement)),this.register((0,g.addDisposableDomListener)(this.element,"mousedown",U=>this._selectionService.handleMouseDown(U))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(V.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",U=>this._handleScreenReaderModeOptionChange(U))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(u.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",U=>{!this._overviewRulerRenderer&&U&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(u.OverviewRulerRenderer,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(p.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const z=this,P=this.element;function K(Y){const ne=z._mouseService.getMouseReportCoords(Y,z.screenElement);if(!ne)return!1;let ie,ce;switch(Y.overrideType||Y.type){case"mousemove":ce=32,Y.buttons===void 0?(ie=3,Y.button!==void 0&&(ie=Y.button<3?Y.button:3)):ie=1&Y.buttons?0:4&Y.buttons?1:2&Y.buttons?2:3;break;case"mouseup":ce=0,ie=Y.button<3?Y.button:3;break;case"mousedown":ce=1,ie=Y.button<3?Y.button:3;break;case"wheel":if(z._customWheelEventHandler&&z._customWheelEventHandler(Y)===!1||z.viewport.getLinesScrolled(Y)===0)return!1;ce=Y.deltaY<0?0:1,ie=4;break;default:return!1}return!(ce===void 0||ie===void 0||ie>4)&&z.coreMouseService.triggerMouseEvent({col:ne.col,row:ne.row,x:ne.x,y:ne.y,button:ie,action:ce,ctrl:Y.ctrlKey,alt:Y.altKey,shift:Y.shiftKey})}const U={mouseup:null,wheel:null,mousedrag:null,mousemove:null},Z={mouseup:Y=>(K(Y),Y.buttons||(this._document.removeEventListener("mouseup",U.mouseup),U.mousedrag&&this._document.removeEventListener("mousemove",U.mousedrag)),this.cancel(Y)),wheel:Y=>(K(Y),this.cancel(Y,!0)),mousedrag:Y=>{Y.buttons&&K(Y)},mousemove:Y=>{Y.buttons||K(Y)}};this.register(this.coreMouseService.onProtocolChange(Y=>{Y?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(Y)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),8&Y?U.mousemove||(P.addEventListener("mousemove",Z.mousemove),U.mousemove=Z.mousemove):(P.removeEventListener("mousemove",U.mousemove),U.mousemove=null),16&Y?U.wheel||(P.addEventListener("wheel",Z.wheel,{passive:!1}),U.wheel=Z.wheel):(P.removeEventListener("wheel",U.wheel),U.wheel=null),2&Y?U.mouseup||(U.mouseup=Z.mouseup):(this._document.removeEventListener("mouseup",U.mouseup),U.mouseup=null),4&Y?U.mousedrag||(U.mousedrag=Z.mousedrag):(this._document.removeEventListener("mousemove",U.mousedrag),U.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,g.addDisposableDomListener)(P,"mousedown",Y=>{if(Y.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(Y))return K(Y),U.mouseup&&this._document.addEventListener("mouseup",U.mouseup),U.mousedrag&&this._document.addEventListener("mousemove",U.mousedrag),this.cancel(Y)})),this.register((0,g.addDisposableDomListener)(P,"wheel",Y=>{if(!U.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(Y)===!1)return!1;if(!this.buffer.hasScrollback){const ne=this.viewport.getLinesScrolled(Y);if(ne===0)return;const ie=H.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(Y.deltaY<0?"A":"B");let ce="";for(let fe=0;fe<Math.abs(ne);fe++)ce+=ie;return this.coreService.triggerDataEvent(ce,!0),this.cancel(Y,!0)}return this.viewport.handleWheel(Y)?this.cancel(Y):void 0}},{passive:!1})),this.register((0,g.addDisposableDomListener)(P,"touchstart",Y=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(Y),this.cancel(Y)},{passive:!0})),this.register((0,g.addDisposableDomListener)(P,"touchmove",Y=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(Y)?void 0:this.cancel(Y)},{passive:!1}))}refresh(z,P){var K;(K=this._renderService)==null||K.refreshRows(z,P)}updateCursorStyle(z){var P;(P=this._selectionService)!=null&&P.shouldColumnSelect(z)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(z,P,K=0){var U;K===1?(super.scrollLines(z,P,K),this.refresh(0,this.rows-1)):(U=this.viewport)==null||U.scrollLines(z)}paste(z){(0,d.paste)(z,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(z){this._customKeyEventHandler=z}attachCustomWheelEventHandler(z){this._customWheelEventHandler=z}registerLinkProvider(z){return this._linkProviderService.registerLinkProvider(z)}registerCharacterJoiner(z){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const P=this._characterJoinerService.register(z);return this.refresh(0,this.rows-1),P}deregisterCharacterJoiner(z){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(z)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(z){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+z)}registerDecoration(z){return this._decorationService.registerDecoration(z)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(z,P,K){this._selectionService.setSelection(z,P,K)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(this._selectionService&&this._selectionService.hasSelection)return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){var z;(z=this._selectionService)==null||z.clearSelection()}selectAll(){var z;(z=this._selectionService)==null||z.selectAll()}selectLines(z,P){var K;(K=this._selectionService)==null||K.selectLines(z,P)}_keyDown(z){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(z)===!1)return!1;const P=this.browser.isMac&&this.options.macOptionIsMeta&&z.altKey;if(!P&&!this._compositionHelper.keydown(z))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;P||z.key!=="Dead"&&z.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const K=(0,I.evaluateKeyboardEvent)(z,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(z),K.type===3||K.type===2){const U=this.rows-1;return this.scrollLines(K.type===2?-U:U),this.cancel(z,!0)}return K.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,z)||(K.cancel&&this.cancel(z,!0),!K.key||!!(z.key&&!z.ctrlKey&&!z.altKey&&!z.metaKey&&z.key.length===1&&z.key.charCodeAt(0)>=65&&z.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(K.key!==H.C0.ETX&&K.key!==H.C0.CR||(this.textarea.value=""),this._onKey.fire({key:K.key,domEvent:z}),this._showCursor(),this.coreService.triggerDataEvent(K.key,!0),!this.optionsService.rawOptions.screenReaderMode||z.altKey||z.ctrlKey?this.cancel(z,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(z,P){const K=z.isMac&&!this.options.macOptionIsMeta&&P.altKey&&!P.ctrlKey&&!P.metaKey||z.isWindows&&P.altKey&&P.ctrlKey&&!P.metaKey||z.isWindows&&P.getModifierState("AltGraph");return P.type==="keypress"?K:K&&(!P.keyCode||P.keyCode>47)}_keyUp(z){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(z)===!1||(function(P){return P.keyCode===16||P.keyCode===17||P.keyCode===18}(z)||this.focus(),this.updateCursorStyle(z),this._keyPressHandled=!1)}_keyPress(z){let P;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(z)===!1)return!1;if(this.cancel(z),z.charCode)P=z.charCode;else if(z.which===null||z.which===void 0)P=z.keyCode;else{if(z.which===0||z.charCode===0)return!1;P=z.which}return!(!P||(z.altKey||z.ctrlKey||z.metaKey)&&!this._isThirdLevelShift(this.browser,z)||(P=String.fromCharCode(P),this._onKey.fire({key:P,domEvent:z}),this._showCursor(),this.coreService.triggerDataEvent(P,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(z){if(z.data&&z.inputType==="insertText"&&(!z.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const P=z.data;return this.coreService.triggerDataEvent(P,!0),this.cancel(z),!0}return!1}resize(z,P){z!==this.cols||P!==this.rows?super.resize(z,P):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(z,P){var K,U;(K=this._charSizeService)==null||K.measure(),(U=this.viewport)==null||U.syncScrollArea(!0)}clear(){var z;if(this.buffer.ybase!==0||this.buffer.y!==0){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let P=1;P<this.rows;P++)this.buffer.lines.push(this.buffer.getBlankLine(F.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),(z=this.viewport)==null||z.reset(),this.refresh(0,this.rows-1)}}reset(){var P,K;this.options.rows=this.rows,this.options.cols=this.cols;const z=this._customKeyEventHandler;this._setup(),super.reset(),(P=this._selectionService)==null||P.reset(),this._decorationService.reset(),(K=this.viewport)==null||K.reset(),this._customKeyEventHandler=z,this.refresh(0,this.rows-1)}clearTextureAtlas(){var z;(z=this._renderService)==null||z.clearTextureAtlas()}_reportFocus(){var z;(z=this.element)!=null&&z.classList.contains("focus")?this.coreService.triggerDataEvent(H.C0.ESC+"[I"):this.coreService.triggerDataEvent(H.C0.ESC+"[O")}_reportWindowsOptions(z){if(this._renderService)switch(z){case O.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const P=this._renderService.dimensions.css.canvas.width.toFixed(0),K=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${H.C0.ESC}[4;${K};${P}t`);break;case O.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const U=this._renderService.dimensions.css.cell.width.toFixed(0),Z=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${H.C0.ESC}[6;${Z};${U}t`)}}cancel(z,P){if(this.options.cancelEvents||P)return z.preventDefault(),z.stopPropagation(),!1}}i.Terminal=J},9924:(c,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.TimeBasedDebouncer=void 0,i.TimeBasedDebouncer=class{constructor(a,d=1e3){this._renderCallback=a,this._debounceThresholdMS=d,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(a,d,g){this._rowCount=g,a=a!==void 0?a:0,d=d!==void 0?d:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,a):a,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,d):d;const l=Date.now();if(l-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=l,this._innerRefresh();else if(!this._additionalRefreshRequested){const m=l-this._lastRefreshMs,v=this._debounceThresholdMS-m;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},v)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const a=Math.max(this._rowStart,0),d=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(a,d)}}},1680:function(c,i,a){var d=this&&this.__decorate||function(f,p,h,y){var b,C=arguments.length,E=C<3?p:y===null?y=Object.getOwnPropertyDescriptor(p,h):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(f,p,h,y);else for(var x=f.length-1;x>=0;x--)(b=f[x])&&(E=(C<3?b(E):C>3?b(p,h,E):b(p,h))||E);return C>3&&E&&Object.defineProperty(p,h,E),E},g=this&&this.__param||function(f,p){return function(h,y){p(h,y,f)}};Object.defineProperty(i,"__esModule",{value:!0}),i.Viewport=void 0;const l=a(3656),m=a(4725),v=a(8460),w=a(844),_=a(2585);let u=i.Viewport=class extends w.Disposable{constructor(f,p,h,y,b,C,E,x){super(),this._viewportElement=f,this._scrollArea=p,this._bufferService=h,this._optionsService=y,this._charSizeService=b,this._renderService=C,this._coreBrowserService=E,this.scrollBarWidth=0,this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._wheelPartialScroll=0,this._refreshAnimationFrame=null,this._ignoreNextScrollEvent=!1,this._smoothScrollState={startTime:0,origin:-1,target:-1},this._onRequestScrollLines=this.register(new v.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,l.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate(k=>this._activeBuffer=k.activeBuffer)),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange(k=>this._renderDimensions=k)),this._handleThemeChange(x.colors),this.register(x.onChangeColors(k=>this._handleThemeChange(k))),this.register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.syncScrollArea())),setTimeout(()=>this.syncScrollArea())}_handleThemeChange(f){this._viewportElement.style.backgroundColor=f.background.css}reset(){this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._coreBrowserService.window.requestAnimationFrame(()=>this.syncScrollArea())}_refresh(f){if(f)return this._innerRefresh(),void(this._refreshAnimationFrame!==null&&this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));this._refreshAnimationFrame===null&&(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderDimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderDimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;const p=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==p&&(this._lastRecordedBufferHeight=p,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const f=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==f&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=f),this._refreshAnimationFrame=null}syncScrollArea(f=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(f);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(f)}_handleScroll(f){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._onRequestScrollLines.fire({amount:0,suppressScrollEvent:!0});const p=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:p,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const f=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(f*(this._smoothScrollState.target-this._smoothScrollState.origin)),f<1?this._coreBrowserService.window.requestAnimationFrame(()=>this._smoothScroll()):this._clearSmoothScrollState()}_smoothScrollPercent(){return this._optionsService.rawOptions.smoothScrollDuration&&this._smoothScrollState.startTime?Math.max(Math.min((Date.now()-this._smoothScrollState.startTime)/this._optionsService.rawOptions.smoothScrollDuration,1),0):1}_clearSmoothScrollState(){this._smoothScrollState.startTime=0,this._smoothScrollState.origin=-1,this._smoothScrollState.target=-1}_bubbleScroll(f,p){const h=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(p<0&&this._viewportElement.scrollTop!==0||p>0&&h<this._lastRecordedBufferHeight)||(f.cancelable&&f.preventDefault(),!1)}handleWheel(f){const p=this._getPixelsScrolled(f);return p!==0&&(this._optionsService.rawOptions.smoothScrollDuration?(this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target===-1?this._smoothScrollState.target=this._viewportElement.scrollTop+p:this._smoothScrollState.target+=p,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=p,this._bubbleScroll(f,p))}scrollLines(f){if(f!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const p=f*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+p,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:f,suppressScrollEvent:!1})}_getPixelsScrolled(f){if(f.deltaY===0||f.shiftKey)return 0;let p=this._applyScrollModifier(f.deltaY,f);return f.deltaMode===WheelEvent.DOM_DELTA_LINE?p*=this._currentRowHeight:f.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(p*=this._currentRowHeight*this._bufferService.rows),p}getBufferElements(f,p){var x;let h,y="";const b=[],C=p??this._bufferService.buffer.lines.length,E=this._bufferService.buffer.lines;for(let k=f;k<C;k++){const M=E.get(k);if(!M)continue;const D=(x=E.get(k+1))==null?void 0:x.isWrapped;if(y+=M.translateToString(!D),!D||k===E.length-1){const R=document.createElement("div");R.textContent=y,b.push(R),y.length>0&&(h=R),y=""}}return{bufferElements:b,cursorElement:h}}getLinesScrolled(f){if(f.deltaY===0||f.shiftKey)return 0;let p=this._applyScrollModifier(f.deltaY,f);return f.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(p/=this._currentRowHeight+0,this._wheelPartialScroll+=p,p=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):f.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(p*=this._bufferService.rows),p}_applyScrollModifier(f,p){const h=this._optionsService.rawOptions.fastScrollModifier;return h==="alt"&&p.altKey||h==="ctrl"&&p.ctrlKey||h==="shift"&&p.shiftKey?f*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:f*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(f){this._lastTouchY=f.touches[0].pageY}handleTouchMove(f){const p=this._lastTouchY-f.touches[0].pageY;return this._lastTouchY=f.touches[0].pageY,p!==0&&(this._viewportElement.scrollTop+=p,this._bubbleScroll(f,p))}};i.Viewport=u=d([g(2,_.IBufferService),g(3,_.IOptionsService),g(4,m.ICharSizeService),g(5,m.IRenderService),g(6,m.ICoreBrowserService),g(7,m.IThemeService)],u)},3107:function(c,i,a){var d=this&&this.__decorate||function(_,u,f,p){var h,y=arguments.length,b=y<3?u:p===null?p=Object.getOwnPropertyDescriptor(u,f):p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(_,u,f,p);else for(var C=_.length-1;C>=0;C--)(h=_[C])&&(b=(y<3?h(b):y>3?h(u,f,b):h(u,f))||b);return y>3&&b&&Object.defineProperty(u,f,b),b},g=this&&this.__param||function(_,u){return function(f,p){u(f,p,_)}};Object.defineProperty(i,"__esModule",{value:!0}),i.BufferDecorationRenderer=void 0;const l=a(4725),m=a(844),v=a(2585);let w=i.BufferDecorationRenderer=class extends m.Disposable{constructor(_,u,f,p,h){super(),this._screenElement=_,this._bufferService=u,this._coreBrowserService=f,this._decorationService=p,this._renderService=h,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(y=>this._removeDecoration(y))),this.register((0,m.toDisposable)(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(const _ of this._decorationService.decorations)this._renderDecoration(_);this._dimensionsChanged=!1}_renderDecoration(_){this._refreshStyle(_),this._dimensionsChanged&&this._refreshXPosition(_)}_createElement(_){var p;const u=this._coreBrowserService.mainDocument.createElement("div");u.classList.add("xterm-decoration"),u.classList.toggle("xterm-decoration-top-layer",((p=_==null?void 0:_.options)==null?void 0:p.layer)==="top"),u.style.width=`${Math.round((_.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,u.style.height=(_.options.height||1)*this._renderService.dimensions.css.cell.height+"px",u.style.top=(_.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",u.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const f=_.options.x??0;return f&&f>this._bufferService.cols&&(u.style.display="none"),this._refreshXPosition(_,u),u}_refreshStyle(_){const u=_.marker.line-this._bufferService.buffers.active.ydisp;if(u<0||u>=this._bufferService.rows)_.element&&(_.element.style.display="none",_.onRenderEmitter.fire(_.element));else{let f=this._decorationElements.get(_);f||(f=this._createElement(_),_.element=f,this._decorationElements.set(_,f),this._container.appendChild(f),_.onDispose(()=>{this._decorationElements.delete(_),f.remove()})),f.style.top=u*this._renderService.dimensions.css.cell.height+"px",f.style.display=this._altBufferIsActive?"none":"block",_.onRenderEmitter.fire(f)}}_refreshXPosition(_,u=_.element){if(!u)return;const f=_.options.x??0;(_.options.anchor||"left")==="right"?u.style.right=f?f*this._renderService.dimensions.css.cell.width+"px":"":u.style.left=f?f*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(_){var u;(u=this._decorationElements.get(_))==null||u.remove(),this._decorationElements.delete(_),_.dispose()}};i.BufferDecorationRenderer=w=d([g(1,v.IBufferService),g(2,l.ICoreBrowserService),g(3,v.IDecorationService),g(4,l.IRenderService)],w)},5871:(c,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.ColorZoneStore=void 0,i.ColorZoneStore=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(a){if(a.options.overviewRulerOptions){for(const d of this._zones)if(d.color===a.options.overviewRulerOptions.color&&d.position===a.options.overviewRulerOptions.position){if(this._lineIntersectsZone(d,a.marker.line))return;if(this._lineAdjacentToZone(d,a.marker.line,a.options.overviewRulerOptions.position))return void this._addLineToZone(d,a.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=a.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=a.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=a.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=a.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:a.options.overviewRulerOptions.color,position:a.options.overviewRulerOptions.position,startBufferLine:a.marker.line,endBufferLine:a.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(a){this._linePadding=a}_lineIntersectsZone(a,d){return d>=a.startBufferLine&&d<=a.endBufferLine}_lineAdjacentToZone(a,d,g){return d>=a.startBufferLine-this._linePadding[g||"full"]&&d<=a.endBufferLine+this._linePadding[g||"full"]}_addLineToZone(a,d){a.startBufferLine=Math.min(a.startBufferLine,d),a.endBufferLine=Math.max(a.endBufferLine,d)}}},5744:function(c,i,a){var d=this&&this.__decorate||function(h,y,b,C){var E,x=arguments.length,k=x<3?y:C===null?C=Object.getOwnPropertyDescriptor(y,b):C;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(h,y,b,C);else for(var M=h.length-1;M>=0;M--)(E=h[M])&&(k=(x<3?E(k):x>3?E(y,b,k):E(y,b))||k);return x>3&&k&&Object.defineProperty(y,b,k),k},g=this&&this.__param||function(h,y){return function(b,C){y(b,C,h)}};Object.defineProperty(i,"__esModule",{value:!0}),i.OverviewRulerRenderer=void 0;const l=a(5871),m=a(4725),v=a(844),w=a(2585),_={full:0,left:0,center:0,right:0},u={full:0,left:0,center:0,right:0},f={full:0,left:0,center:0,right:0};let p=i.OverviewRulerRenderer=class extends v.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(h,y,b,C,E,x,k){var D;super(),this._viewportElement=h,this._screenElement=y,this._bufferService=b,this._decorationService=C,this._renderService=E,this._optionsService=x,this._coreBrowserService=k,this._colorZoneStore=new l.ColorZoneStore,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),(D=this._viewportElement.parentElement)==null||D.insertBefore(this._canvas,this._viewportElement);const M=this._canvas.getContext("2d");if(!M)throw new Error("Ctx cannot be null");this._ctx=M,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,v.toDisposable)(()=>{var R;(R=this._canvas)==null||R.remove()}))}_registerDecorationListeners(){this.register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this.register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0)))}_registerBufferChangeListeners(){this.register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this.register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"})),this.register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())}))}_registerDimensionChangeListeners(){this.register(this._renderService.onRender(()=>{this._containerHeight&&this._containerHeight===this._screenElement.clientHeight||(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this.register(this._optionsService.onSpecificOptionChange("overviewRulerWidth",()=>this._queueRefresh(!0))),this.register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._queueRefresh(!0)}_refreshDrawConstants(){const h=Math.floor(this._canvas.width/3),y=Math.ceil(this._canvas.width/3);u.full=this._canvas.width,u.left=h,u.center=y,u.right=h,this._refreshDrawHeightConstants(),f.full=0,f.left=0,f.center=u.left,f.right=u.left+u.center}_refreshDrawHeightConstants(){_.full=Math.round(2*this._coreBrowserService.dpr);const h=this._canvas.height/this._bufferService.buffer.lines.length,y=Math.round(Math.max(Math.min(h,12),6)*this._coreBrowserService.dpr);_.left=y,_.center=y,_.right=y}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*_.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*_.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*_.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*_.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(const y of this._decorationService.decorations)this._colorZoneStore.addDecoration(y);this._ctx.lineWidth=1;const h=this._colorZoneStore.zones;for(const y of h)y.position!=="full"&&this._renderColorZone(y);for(const y of h)y.position==="full"&&this._renderColorZone(y);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(h){this._ctx.fillStyle=h.color,this._ctx.fillRect(f[h.position||"full"],Math.round((this._canvas.height-1)*(h.startBufferLine/this._bufferService.buffers.active.lines.length)-_[h.position||"full"]/2),u[h.position||"full"],Math.round((this._canvas.height-1)*((h.endBufferLine-h.startBufferLine)/this._bufferService.buffers.active.lines.length)+_[h.position||"full"]))}_queueRefresh(h,y){this._shouldUpdateDimensions=h||this._shouldUpdateDimensions,this._shouldUpdateAnchor=y||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};i.OverviewRulerRenderer=p=d([g(2,w.IBufferService),g(3,w.IDecorationService),g(4,m.IRenderService),g(5,w.IOptionsService),g(6,m.ICoreBrowserService)],p)},2950:function(c,i,a){var d=this&&this.__decorate||function(_,u,f,p){var h,y=arguments.length,b=y<3?u:p===null?p=Object.getOwnPropertyDescriptor(u,f):p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(_,u,f,p);else for(var C=_.length-1;C>=0;C--)(h=_[C])&&(b=(y<3?h(b):y>3?h(u,f,b):h(u,f))||b);return y>3&&b&&Object.defineProperty(u,f,b),b},g=this&&this.__param||function(_,u){return function(f,p){u(f,p,_)}};Object.defineProperty(i,"__esModule",{value:!0}),i.CompositionHelper=void 0;const l=a(4725),m=a(2585),v=a(2584);let w=i.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(_,u,f,p,h,y){this._textarea=_,this._compositionView=u,this._bufferService=f,this._optionsService=p,this._coreService=h,this._renderService=y,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(_){this._compositionView.textContent=_.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(_){if(this._isComposing||this._isSendingComposition){if(_.keyCode===229||_.keyCode===16||_.keyCode===17||_.keyCode===18)return!1;this._finalizeComposition(!1)}return _.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(_){if(this._compositionView.classList.remove("active"),this._isComposing=!1,_){const u={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){let f;this._isSendingComposition=!1,u.start+=this._dataAlreadySent.length,f=this._isComposing?this._textarea.value.substring(u.start,u.end):this._textarea.value.substring(u.start),f.length>0&&this._coreService.triggerDataEvent(f,!0)}},0)}else{this._isSendingComposition=!1;const u=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(u,!0)}}_handleAnyTextareaChanges(){const _=this._textarea.value;setTimeout(()=>{if(!this._isComposing){const u=this._textarea.value,f=u.replace(_,"");this._dataAlreadySent=f,u.length>_.length?this._coreService.triggerDataEvent(f,!0):u.length<_.length?this._coreService.triggerDataEvent(`${v.C0.DEL}`,!0):u.length===_.length&&u!==_&&this._coreService.triggerDataEvent(u,!0)}},0)}updateCompositionElements(_){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const u=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),f=this._renderService.dimensions.css.cell.height,p=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,h=u*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=h+"px",this._compositionView.style.top=p+"px",this._compositionView.style.height=f+"px",this._compositionView.style.lineHeight=f+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";const y=this._compositionView.getBoundingClientRect();this._textarea.style.left=h+"px",this._textarea.style.top=p+"px",this._textarea.style.width=Math.max(y.width,1)+"px",this._textarea.style.height=Math.max(y.height,1)+"px",this._textarea.style.lineHeight=y.height+"px"}_||setTimeout(()=>this.updateCompositionElements(!0),0)}}};i.CompositionHelper=w=d([g(2,m.IBufferService),g(3,m.IOptionsService),g(4,m.ICoreService),g(5,l.IRenderService)],w)},9806:(c,i)=>{function a(d,g,l){const m=l.getBoundingClientRect(),v=d.getComputedStyle(l),w=parseInt(v.getPropertyValue("padding-left")),_=parseInt(v.getPropertyValue("padding-top"));return[g.clientX-m.left-w,g.clientY-m.top-_]}Object.defineProperty(i,"__esModule",{value:!0}),i.getCoords=i.getCoordsRelativeToElement=void 0,i.getCoordsRelativeToElement=a,i.getCoords=function(d,g,l,m,v,w,_,u,f){if(!w)return;const p=a(d,g,l);return p?(p[0]=Math.ceil((p[0]+(f?_/2:0))/_),p[1]=Math.ceil(p[1]/u),p[0]=Math.min(Math.max(p[0],1),m+(f?1:0)),p[1]=Math.min(Math.max(p[1],1),v),p):void 0}},9504:(c,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.moveToCellSequence=void 0;const d=a(2584);function g(u,f,p,h){const y=u-l(u,p),b=f-l(f,p),C=Math.abs(y-b)-function(E,x,k){let M=0;const D=E-l(E,k),R=x-l(x,k);for(let N=0;N<Math.abs(D-R);N++){const A=m(E,x)==="A"?-1:1,$=k.buffer.lines.get(D+A*N);$!=null&&$.isWrapped&&M++}return M}(u,f,p);return _(C,w(m(u,f),h))}function l(u,f){let p=0,h=f.buffer.lines.get(u),y=h==null?void 0:h.isWrapped;for(;y&&u>=0&&u<f.rows;)p++,h=f.buffer.lines.get(--u),y=h==null?void 0:h.isWrapped;return p}function m(u,f){return u>f?"A":"B"}function v(u,f,p,h,y,b){let C=u,E=f,x="";for(;C!==p||E!==h;)C+=y?1:-1,y&&C>b.cols-1?(x+=b.buffer.translateBufferLineToString(E,!1,u,C),C=0,u=0,E++):!y&&C<0&&(x+=b.buffer.translateBufferLineToString(E,!1,0,u+1),C=b.cols-1,u=C,E--);return x+b.buffer.translateBufferLineToString(E,!1,u,C)}function w(u,f){const p=f?"O":"[";return d.C0.ESC+p+u}function _(u,f){u=Math.floor(u);let p="";for(let h=0;h<u;h++)p+=f;return p}i.moveToCellSequence=function(u,f,p,h){const y=p.buffer.x,b=p.buffer.y;if(!p.buffer.hasScrollback)return function(x,k,M,D,R,N){return g(k,D,R,N).length===0?"":_(v(x,k,x,k-l(k,R),!1,R).length,w("D",N))}(y,b,0,f,p,h)+g(b,f,p,h)+function(x,k,M,D,R,N){let A;A=g(k,D,R,N).length>0?D-l(D,R):k;const $=D,F=function(H,I,L,T,j,O){let V;return V=g(L,T,j,O).length>0?T-l(T,j):I,H<L&&V<=T||H>=L&&V<T?"C":"D"}(x,k,M,D,R,N);return _(v(x,A,M,$,F==="C",R).length,w(F,N))}(y,b,u,f,p,h);let C;if(b===f)return C=y>u?"D":"C",_(Math.abs(y-u),w(C,h));C=b>f?"D":"C";const E=Math.abs(b-f);return _(function(x,k){return k.cols-x}(b>f?u:y,p)+(E-1)*p.cols+1+((b>f?y:u)-1),w(C,h))}},1296:function(c,i,a){var d=this&&this.__decorate||function(N,A,$,F){var H,I=arguments.length,L=I<3?A:F===null?F=Object.getOwnPropertyDescriptor(A,$):F;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")L=Reflect.decorate(N,A,$,F);else for(var T=N.length-1;T>=0;T--)(H=N[T])&&(L=(I<3?H(L):I>3?H(A,$,L):H(A,$))||L);return I>3&&L&&Object.defineProperty(A,$,L),L},g=this&&this.__param||function(N,A){return function($,F){A($,F,N)}};Object.defineProperty(i,"__esModule",{value:!0}),i.DomRenderer=void 0;const l=a(3787),m=a(2550),v=a(2223),w=a(6171),_=a(6052),u=a(4725),f=a(8055),p=a(8460),h=a(844),y=a(2585),b="xterm-dom-renderer-owner-",C="xterm-rows",E="xterm-fg-",x="xterm-bg-",k="xterm-focus",M="xterm-selection";let D=1,R=i.DomRenderer=class extends h.Disposable{constructor(N,A,$,F,H,I,L,T,j,O,V,q,J){super(),this._terminal=N,this._document=A,this._element=$,this._screenElement=F,this._viewportElement=H,this._helperContainer=I,this._linkifier2=L,this._charSizeService=j,this._optionsService=O,this._bufferService=V,this._coreBrowserService=q,this._themeService=J,this._terminalClass=D++,this._rowElements=[],this._selectionRenderModel=(0,_.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new p.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(C),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(M),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,w.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this.register(this._themeService.onChangeColors(Q=>this._injectCss(Q))),this._injectCss(this._themeService.colors),this._rowFactory=T.createInstance(l.DomRendererRowFactory,document),this._element.classList.add(b+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline(Q=>this._handleLinkHover(Q))),this.register(this._linkifier2.onHideLinkUnderline(Q=>this._handleLinkLeave(Q))),this.register((0,h.toDisposable)(()=>{this._element.classList.remove(b+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new m.WidthCache(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){const N=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*N,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*N),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/N),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/N),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(const $ of this._rowElements)$.style.width=`${this.dimensions.css.canvas.width}px`,$.style.height=`${this.dimensions.css.cell.height}px`,$.style.lineHeight=`${this.dimensions.css.cell.height}px`,$.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const A=`${this._terminalSelector} .${C} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=A,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(N){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let A=`${this._terminalSelector} .${C} { color: ${N.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;A+=`${this._terminalSelector} .${C} .xterm-dim { color: ${f.color.multiplyOpacity(N.foreground,.5).css};}`,A+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;const $=`blink_underline_${this._terminalClass}`,F=`blink_bar_${this._terminalClass}`,H=`blink_block_${this._terminalClass}`;A+=`@keyframes ${$} { 50% { border-bottom-style: hidden; }}`,A+=`@keyframes ${F} { 50% { box-shadow: none; }}`,A+=`@keyframes ${H} { 0% { background-color: ${N.cursor.css}; color: ${N.cursorAccent.css}; } 50% { background-color: inherit; color: ${N.cursor.css}; }}`,A+=`${this._terminalSelector} .${C}.${k} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${$} 1s step-end infinite;}${this._terminalSelector} .${C}.${k} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${F} 1s step-end infinite;}${this._terminalSelector} .${C}.${k} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${H} 1s step-end infinite;}${this._terminalSelector} .${C} .xterm-cursor.xterm-cursor-block { background-color: ${N.cursor.css}; color: ${N.cursorAccent.css};}${this._terminalSelector} .${C} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${N.cursor.css} !important; color: ${N.cursorAccent.css} !important;}${this._terminalSelector} .${C} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${N.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${C} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${N.cursor.css} inset;}${this._terminalSelector} .${C} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${N.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,A+=`${this._terminalSelector} .${M} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${M} div { position: absolute; background-color: ${N.selectionBackgroundOpaque.css};}${this._terminalSelector} .${M} div { position: absolute; background-color: ${N.selectionInactiveBackgroundOpaque.css};}`;for(const[I,L]of N.ansi.entries())A+=`${this._terminalSelector} .${E}${I} { color: ${L.css}; }${this._terminalSelector} .${E}${I}.xterm-dim { color: ${f.color.multiplyOpacity(L,.5).css}; }${this._terminalSelector} .${x}${I} { background-color: ${L.css}; }`;A+=`${this._terminalSelector} .${E}${v.INVERTED_DEFAULT_COLOR} { color: ${f.color.opaque(N.background).css}; }${this._terminalSelector} .${E}${v.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${f.color.multiplyOpacity(f.color.opaque(N.background),.5).css}; }${this._terminalSelector} .${x}${v.INVERTED_DEFAULT_COLOR} { background-color: ${N.foreground.css}; }`,this._themeStyleElement.textContent=A}_setDefaultSpacing(){const N=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${N}px`,this._rowFactory.defaultSpacing=N}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(N,A){for(let $=this._rowElements.length;$<=A;$++){const F=this._document.createElement("div");this._rowContainer.appendChild(F),this._rowElements.push(F)}for(;this._rowElements.length>A;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(N,A){this._refreshRowElements(N,A),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(k),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(k),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(N,A,$){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(N,A,$),this.renderRows(0,this._bufferService.rows-1),!N||!A)return;this._selectionRenderModel.update(this._terminal,N,A,$);const F=this._selectionRenderModel.viewportStartRow,H=this._selectionRenderModel.viewportEndRow,I=this._selectionRenderModel.viewportCappedStartRow,L=this._selectionRenderModel.viewportCappedEndRow;if(I>=this._bufferService.rows||L<0)return;const T=this._document.createDocumentFragment();if($){const j=N[0]>A[0];T.appendChild(this._createSelectionElement(I,j?A[0]:N[0],j?N[0]:A[0],L-I+1))}else{const j=F===I?N[0]:0,O=I===H?A[0]:this._bufferService.cols;T.appendChild(this._createSelectionElement(I,j,O));const V=L-I-1;if(T.appendChild(this._createSelectionElement(I+1,0,this._bufferService.cols,V)),I!==L){const q=H===L?A[0]:this._bufferService.cols;T.appendChild(this._createSelectionElement(L,0,q))}}this._selectionContainer.appendChild(T)}_createSelectionElement(N,A,$,F=1){const H=this._document.createElement("div"),I=A*this.dimensions.css.cell.width;let L=this.dimensions.css.cell.width*($-A);return I+L>this.dimensions.css.canvas.width&&(L=this.dimensions.css.canvas.width-I),H.style.height=F*this.dimensions.css.cell.height+"px",H.style.top=N*this.dimensions.css.cell.height+"px",H.style.left=`${I}px`,H.style.width=`${L}px`,H}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(const N of this._rowElements)N.replaceChildren()}renderRows(N,A){const $=this._bufferService.buffer,F=$.ybase+$.y,H=Math.min($.x,this._bufferService.cols-1),I=this._optionsService.rawOptions.cursorBlink,L=this._optionsService.rawOptions.cursorStyle,T=this._optionsService.rawOptions.cursorInactiveStyle;for(let j=N;j<=A;j++){const O=j+$.ydisp,V=this._rowElements[j],q=$.lines.get(O);if(!V||!q)break;V.replaceChildren(...this._rowFactory.createRow(q,O,O===F,L,T,H,I,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${b}${this._terminalClass}`}_handleLinkHover(N){this._setCellUnderline(N.x1,N.x2,N.y1,N.y2,N.cols,!0)}_handleLinkLeave(N){this._setCellUnderline(N.x1,N.x2,N.y1,N.y2,N.cols,!1)}_setCellUnderline(N,A,$,F,H,I){$<0&&(N=0),F<0&&(A=0);const L=this._bufferService.rows-1;$=Math.max(Math.min($,L),0),F=Math.max(Math.min(F,L),0),H=Math.min(H,this._bufferService.cols);const T=this._bufferService.buffer,j=T.ybase+T.y,O=Math.min(T.x,H-1),V=this._optionsService.rawOptions.cursorBlink,q=this._optionsService.rawOptions.cursorStyle,J=this._optionsService.rawOptions.cursorInactiveStyle;for(let Q=$;Q<=F;++Q){const z=Q+T.ydisp,P=this._rowElements[Q],K=T.lines.get(z);if(!P||!K)break;P.replaceChildren(...this._rowFactory.createRow(K,z,z===j,q,J,O,V,this.dimensions.css.cell.width,this._widthCache,I?Q===$?N:0:-1,I?(Q===F?A:H)-1:-1))}}};i.DomRenderer=R=d([g(7,y.IInstantiationService),g(8,u.ICharSizeService),g(9,y.IOptionsService),g(10,y.IBufferService),g(11,u.ICoreBrowserService),g(12,u.IThemeService)],R)},3787:function(c,i,a){var d=this&&this.__decorate||function(C,E,x,k){var M,D=arguments.length,R=D<3?E:k===null?k=Object.getOwnPropertyDescriptor(E,x):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(C,E,x,k);else for(var N=C.length-1;N>=0;N--)(M=C[N])&&(R=(D<3?M(R):D>3?M(E,x,R):M(E,x))||R);return D>3&&R&&Object.defineProperty(E,x,R),R},g=this&&this.__param||function(C,E){return function(x,k){E(x,k,C)}};Object.defineProperty(i,"__esModule",{value:!0}),i.DomRendererRowFactory=void 0;const l=a(2223),m=a(643),v=a(511),w=a(2585),_=a(8055),u=a(4725),f=a(4269),p=a(6171),h=a(3734);let y=i.DomRendererRowFactory=class{constructor(C,E,x,k,M,D,R){this._document=C,this._characterJoinerService=E,this._optionsService=x,this._coreBrowserService=k,this._coreService=M,this._decorationService=D,this._themeService=R,this._workCell=new v.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(C,E,x){this._selectionStart=C,this._selectionEnd=E,this._columnSelectMode=x}createRow(C,E,x,k,M,D,R,N,A,$,F){const H=[],I=this._characterJoinerService.getJoinedCharacters(E),L=this._themeService.colors;let T,j=C.getNoBgTrimmedLength();x&&j<D+1&&(j=D+1);let O=0,V="",q=0,J=0,Q=0,z=!1,P=0,K=!1,U=0;const Z=[],Y=$!==-1&&F!==-1;for(let ne=0;ne<j;ne++){C.loadCell(ne,this._workCell);let ie=this._workCell.getWidth();if(ie===0)continue;let ce=!1,fe=ne,ae=this._workCell;if(I.length>0&&ne===I[0][0]){ce=!0;const Se=I.shift();ae=new f.JoinedCellData(this._workCell,C.translateToString(!0,Se[0],Se[1]),Se[1]-Se[0]),fe=Se[1]-1,ie=ae.getWidth()}const Pe=this._isCellInSelection(ne,E),We=x&&ne===D,ve=Y&&ne>=$&&ne<=F;let me=!1;this._decorationService.forEachDecorationAtCell(ne,E,void 0,Se=>{me=!0});let xe=ae.getChars()||m.WHITESPACE_CELL_CHAR;if(xe===" "&&(ae.isUnderline()||ae.isOverline())&&(xe=" "),U=ie*N-A.get(xe,ae.isBold(),ae.isItalic()),T){if(O&&(Pe&&K||!Pe&&!K&&ae.bg===q)&&(Pe&&K&&L.selectionForeground||ae.fg===J)&&ae.extended.ext===Q&&ve===z&&U===P&&!We&&!ce&&!me){ae.isInvisible()?V+=m.WHITESPACE_CELL_CHAR:V+=xe,O++;continue}O&&(T.textContent=V),T=this._document.createElement("span"),O=0,V=""}else T=this._document.createElement("span");if(q=ae.bg,J=ae.fg,Q=ae.extended.ext,z=ve,P=U,K=Pe,ce&&D>=ne&&D<=fe&&(D=ne),!this._coreService.isCursorHidden&&We&&this._coreService.isCursorInitialized){if(Z.push("xterm-cursor"),this._coreBrowserService.isFocused)R&&Z.push("xterm-cursor-blink"),Z.push(k==="bar"?"xterm-cursor-bar":k==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(M)switch(M){case"outline":Z.push("xterm-cursor-outline");break;case"block":Z.push("xterm-cursor-block");break;case"bar":Z.push("xterm-cursor-bar");break;case"underline":Z.push("xterm-cursor-underline")}}if(ae.isBold()&&Z.push("xterm-bold"),ae.isItalic()&&Z.push("xterm-italic"),ae.isDim()&&Z.push("xterm-dim"),V=ae.isInvisible()?m.WHITESPACE_CELL_CHAR:ae.getChars()||m.WHITESPACE_CELL_CHAR,ae.isUnderline()&&(Z.push(`xterm-underline-${ae.extended.underlineStyle}`),V===" "&&(V=" "),!ae.isUnderlineColorDefault()))if(ae.isUnderlineColorRGB())T.style.textDecorationColor=`rgb(${h.AttributeData.toColorRGB(ae.getUnderlineColor()).join(",")})`;else{let Se=ae.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&ae.isBold()&&Se<8&&(Se+=8),T.style.textDecorationColor=L.ansi[Se].css}ae.isOverline()&&(Z.push("xterm-overline"),V===" "&&(V=" ")),ae.isStrikethrough()&&Z.push("xterm-strikethrough"),ve&&(T.style.textDecoration="underline");let le=ae.getFgColor(),_e=ae.getFgColorMode(),Ce=ae.getBgColor(),ke=ae.getBgColorMode();const $e=!!ae.isInverse();if($e){const Se=le;le=Ce,Ce=Se;const vt=_e;_e=ke,ke=vt}let Be,Fe,Me,De=!1;switch(this._decorationService.forEachDecorationAtCell(ne,E,void 0,Se=>{Se.options.layer!=="top"&&De||(Se.backgroundColorRGB&&(ke=50331648,Ce=Se.backgroundColorRGB.rgba>>8&16777215,Be=Se.backgroundColorRGB),Se.foregroundColorRGB&&(_e=50331648,le=Se.foregroundColorRGB.rgba>>8&16777215,Fe=Se.foregroundColorRGB),De=Se.options.layer==="top")}),!De&&Pe&&(Be=this._coreBrowserService.isFocused?L.selectionBackgroundOpaque:L.selectionInactiveBackgroundOpaque,Ce=Be.rgba>>8&16777215,ke=50331648,De=!0,L.selectionForeground&&(_e=50331648,le=L.selectionForeground.rgba>>8&16777215,Fe=L.selectionForeground)),De&&Z.push("xterm-decoration-top"),ke){case 16777216:case 33554432:Me=L.ansi[Ce],Z.push(`xterm-bg-${Ce}`);break;case 50331648:Me=_.channels.toColor(Ce>>16,Ce>>8&255,255&Ce),this._addStyle(T,`background-color:#${b((Ce>>>0).toString(16),"0",6)}`);break;default:$e?(Me=L.foreground,Z.push(`xterm-bg-${l.INVERTED_DEFAULT_COLOR}`)):Me=L.background}switch(Be||ae.isDim()&&(Be=_.color.multiplyOpacity(Me,.5)),_e){case 16777216:case 33554432:ae.isBold()&&le<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(le+=8),this._applyMinimumContrast(T,Me,L.ansi[le],ae,Be,void 0)||Z.push(`xterm-fg-${le}`);break;case 50331648:const Se=_.channels.toColor(le>>16&255,le>>8&255,255&le);this._applyMinimumContrast(T,Me,Se,ae,Be,Fe)||this._addStyle(T,`color:#${b(le.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(T,Me,L.foreground,ae,Be,Fe)||$e&&Z.push(`xterm-fg-${l.INVERTED_DEFAULT_COLOR}`)}Z.length&&(T.className=Z.join(" "),Z.length=0),We||ce||me?T.textContent=V:O++,U!==this.defaultSpacing&&(T.style.letterSpacing=`${U}px`),H.push(T),ne=fe}return T&&O&&(T.textContent=V),H}_applyMinimumContrast(C,E,x,k,M,D){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,p.treatGlyphAsBackgroundColor)(k.getCode()))return!1;const R=this._getContrastCache(k);let N;if(M||D||(N=R.getColor(E.rgba,x.rgba)),N===void 0){const A=this._optionsService.rawOptions.minimumContrastRatio/(k.isDim()?2:1);N=_.color.ensureContrastRatio(M||E,D||x,A),R.setColor((M||E).rgba,(D||x).rgba,N??null)}return!!N&&(this._addStyle(C,`color:${N.css}`),!0)}_getContrastCache(C){return C.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(C,E){C.setAttribute("style",`${C.getAttribute("style")||""}${E};`)}_isCellInSelection(C,E){const x=this._selectionStart,k=this._selectionEnd;return!(!x||!k)&&(this._columnSelectMode?x[0]<=k[0]?C>=x[0]&&E>=x[1]&&C<k[0]&&E<=k[1]:C<x[0]&&E>=x[1]&&C>=k[0]&&E<=k[1]:E>x[1]&&E<k[1]||x[1]===k[1]&&E===x[1]&&C>=x[0]&&C<k[0]||x[1]<k[1]&&E===k[1]&&C<k[0]||x[1]<k[1]&&E===x[1]&&C>=x[0])}};function b(C,E,x){for(;C.length<x;)C=E+C;return C}i.DomRendererRowFactory=y=d([g(1,u.ICharacterJoinerService),g(2,w.IOptionsService),g(3,u.ICoreBrowserService),g(4,w.ICoreService),g(5,w.IDecorationService),g(6,u.IThemeService)],y)},2550:(c,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.WidthCache=void 0,i.WidthCache=class{constructor(a,d){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=a.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";const g=a.createElement("span");g.classList.add("xterm-char-measure-element");const l=a.createElement("span");l.classList.add("xterm-char-measure-element"),l.style.fontWeight="bold";const m=a.createElement("span");m.classList.add("xterm-char-measure-element"),m.style.fontStyle="italic";const v=a.createElement("span");v.classList.add("xterm-char-measure-element"),v.style.fontWeight="bold",v.style.fontStyle="italic",this._measureElements=[g,l,m,v],this._container.appendChild(g),this._container.appendChild(l),this._container.appendChild(m),this._container.appendChild(v),d.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(a,d,g,l){a===this._font&&d===this._fontSize&&g===this._weight&&l===this._weightBold||(this._font=a,this._fontSize=d,this._weight=g,this._weightBold=l,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${g}`,this._measureElements[1].style.fontWeight=`${l}`,this._measureElements[2].style.fontWeight=`${g}`,this._measureElements[3].style.fontWeight=`${l}`,this.clear())}get(a,d,g){let l=0;if(!d&&!g&&a.length===1&&(l=a.charCodeAt(0))<256){if(this._flat[l]!==-9999)return this._flat[l];const w=this._measure(a,0);return w>0&&(this._flat[l]=w),w}let m=a;d&&(m+="B"),g&&(m+="I");let v=this._holey.get(m);if(v===void 0){let w=0;d&&(w|=1),g&&(w|=2),v=this._measure(a,w),v>0&&this._holey.set(m,v)}return v}_measure(a,d){const g=this._measureElements[d];return g.textContent=a.repeat(32),g.offsetWidth/32}}},2223:(c,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.TEXT_BASELINE=i.DIM_OPACITY=i.INVERTED_DEFAULT_COLOR=void 0;const d=a(6114);i.INVERTED_DEFAULT_COLOR=257,i.DIM_OPACITY=.5,i.TEXT_BASELINE=d.isFirefox||d.isLegacyEdge?"bottom":"ideographic"},6171:(c,i)=>{function a(g){return 57508<=g&&g<=57558}function d(g){return g>=128512&&g<=128591||g>=127744&&g<=128511||g>=128640&&g<=128767||g>=9728&&g<=9983||g>=9984&&g<=10175||g>=65024&&g<=65039||g>=129280&&g<=129535||g>=127462&&g<=127487}Object.defineProperty(i,"__esModule",{value:!0}),i.computeNextVariantOffset=i.createRenderDimensions=i.treatGlyphAsBackgroundColor=i.allowRescaling=i.isEmoji=i.isRestrictedPowerlineGlyph=i.isPowerlineGlyph=i.throwIfFalsy=void 0,i.throwIfFalsy=function(g){if(!g)throw new Error("value must not be falsy");return g},i.isPowerlineGlyph=a,i.isRestrictedPowerlineGlyph=function(g){return 57520<=g&&g<=57527},i.isEmoji=d,i.allowRescaling=function(g,l,m,v){return l===1&&m>Math.ceil(1.5*v)&&g!==void 0&&g>255&&!d(g)&&!a(g)&&!function(w){return 57344<=w&&w<=63743}(g)},i.treatGlyphAsBackgroundColor=function(g){return a(g)||function(l){return 9472<=l&&l<=9631}(g)},i.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},i.computeNextVariantOffset=function(g,l,m=0){return(g-(2*Math.round(l)-m))%(2*Math.round(l))}},6052:(c,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.createSelectionRenderModel=void 0;class a{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(g,l,m,v=!1){if(this.selectionStart=l,this.selectionEnd=m,!l||!m||l[0]===m[0]&&l[1]===m[1])return void this.clear();const w=g.buffers.active.ydisp,_=l[1]-w,u=m[1]-w,f=Math.max(_,0),p=Math.min(u,g.rows-1);f>=g.rows||p<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=v,this.viewportStartRow=_,this.viewportEndRow=u,this.viewportCappedStartRow=f,this.viewportCappedEndRow=p,this.startCol=l[0],this.endCol=m[0])}isCellSelected(g,l,m){return!!this.hasSelection&&(m-=g.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?l>=this.startCol&&m>=this.viewportCappedStartRow&&l<this.endCol&&m<=this.viewportCappedEndRow:l<this.startCol&&m>=this.viewportCappedStartRow&&l>=this.endCol&&m<=this.viewportCappedEndRow:m>this.viewportStartRow&&m<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&m===this.viewportStartRow&&l>=this.startCol&&l<this.endCol||this.viewportStartRow<this.viewportEndRow&&m===this.viewportEndRow&&l<this.endCol||this.viewportStartRow<this.viewportEndRow&&m===this.viewportStartRow&&l>=this.startCol)}}i.createSelectionRenderModel=function(){return new a}},456:(c,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.SelectionModel=void 0,i.SelectionModel=class{constructor(a){this._bufferService=a,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){const a=this.selectionStart[0]+this.selectionStartLength;return a>this._bufferService.cols?a%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(a/this._bufferService.cols)-1]:[a%this._bufferService.cols,this.selectionStart[1]+Math.floor(a/this._bufferService.cols)]:[a,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){const a=this.selectionStart[0]+this.selectionStartLength;return a>this._bufferService.cols?[a%this._bufferService.cols,this.selectionStart[1]+Math.floor(a/this._bufferService.cols)]:[Math.max(a,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){const a=this.selectionStart,d=this.selectionEnd;return!(!a||!d)&&(a[1]>d[1]||a[1]===d[1]&&a[0]>d[0])}handleTrim(a){return this.selectionStart&&(this.selectionStart[1]-=a),this.selectionEnd&&(this.selectionEnd[1]-=a),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(c,i,a){var d=this&&this.__decorate||function(p,h,y,b){var C,E=arguments.length,x=E<3?h:b===null?b=Object.getOwnPropertyDescriptor(h,y):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(p,h,y,b);else for(var k=p.length-1;k>=0;k--)(C=p[k])&&(x=(E<3?C(x):E>3?C(h,y,x):C(h,y))||x);return E>3&&x&&Object.defineProperty(h,y,x),x},g=this&&this.__param||function(p,h){return function(y,b){h(y,b,p)}};Object.defineProperty(i,"__esModule",{value:!0}),i.CharSizeService=void 0;const l=a(2585),m=a(8460),v=a(844);let w=i.CharSizeService=class extends v.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(p,h,y){super(),this._optionsService=y,this.width=0,this.height=0,this._onCharSizeChange=this.register(new m.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new f(this._optionsService))}catch{this._measureStrategy=this.register(new u(p,h,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}measure(){const p=this._measureStrategy.measure();p.width===this.width&&p.height===this.height||(this.width=p.width,this.height=p.height,this._onCharSizeChange.fire())}};i.CharSizeService=w=d([g(2,l.IOptionsService)],w);class _ extends v.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(h,y){h!==void 0&&h>0&&y!==void 0&&y>0&&(this._result.width=h,this._result.height=y)}}class u extends _{constructor(h,y,b){super(),this._document=h,this._parentElement=y,this._optionsService=b,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}}class f extends _{constructor(h){super(),this._optionsService=h,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");const y=this._ctx.measureText("W");if(!("width"in y&&"fontBoundingBoxAscent"in y&&"fontBoundingBoxDescent"in y))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;const h=this._ctx.measureText("W");return this._validateAndSet(h.width,h.fontBoundingBoxAscent+h.fontBoundingBoxDescent),this._result}}},4269:function(c,i,a){var d=this&&this.__decorate||function(f,p,h,y){var b,C=arguments.length,E=C<3?p:y===null?y=Object.getOwnPropertyDescriptor(p,h):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(f,p,h,y);else for(var x=f.length-1;x>=0;x--)(b=f[x])&&(E=(C<3?b(E):C>3?b(p,h,E):b(p,h))||E);return C>3&&E&&Object.defineProperty(p,h,E),E},g=this&&this.__param||function(f,p){return function(h,y){p(h,y,f)}};Object.defineProperty(i,"__esModule",{value:!0}),i.CharacterJoinerService=i.JoinedCellData=void 0;const l=a(3734),m=a(643),v=a(511),w=a(2585);class _ extends l.AttributeData{constructor(p,h,y){super(),this.content=0,this.combinedData="",this.fg=p.fg,this.bg=p.bg,this.combinedData=h,this._width=y}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(p){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}i.JoinedCellData=_;let u=i.CharacterJoinerService=class I0{constructor(p){this._bufferService=p,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new v.CellData}register(p){const h={id:this._nextCharacterJoinerId++,handler:p};return this._characterJoiners.push(h),h.id}deregister(p){for(let h=0;h<this._characterJoiners.length;h++)if(this._characterJoiners[h].id===p)return this._characterJoiners.splice(h,1),!0;return!1}getJoinedCharacters(p){if(this._characterJoiners.length===0)return[];const h=this._bufferService.buffer.lines.get(p);if(!h||h.length===0)return[];const y=[],b=h.translateToString(!0);let C=0,E=0,x=0,k=h.getFg(0),M=h.getBg(0);for(let D=0;D<h.getTrimmedLength();D++)if(h.loadCell(D,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==k||this._workCell.bg!==M){if(D-C>1){const R=this._getJoinedRanges(b,x,E,h,C);for(let N=0;N<R.length;N++)y.push(R[N])}C=D,x=E,k=this._workCell.fg,M=this._workCell.bg}E+=this._workCell.getChars().length||m.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-C>1){const D=this._getJoinedRanges(b,x,E,h,C);for(let R=0;R<D.length;R++)y.push(D[R])}return y}_getJoinedRanges(p,h,y,b,C){const E=p.substring(h,y);let x=[];try{x=this._characterJoiners[0].handler(E)}catch(k){console.error(k)}for(let k=1;k<this._characterJoiners.length;k++)try{const M=this._characterJoiners[k].handler(E);for(let D=0;D<M.length;D++)I0._mergeRanges(x,M[D])}catch(M){console.error(M)}return this._stringRangesToCellRanges(x,b,C),x}_stringRangesToCellRanges(p,h,y){let b=0,C=!1,E=0,x=p[b];if(x){for(let k=y;k<this._bufferService.cols;k++){const M=h.getWidth(k),D=h.getString(k).length||m.WHITESPACE_CELL_CHAR.length;if(M!==0){if(!C&&x[0]<=E&&(x[0]=k,C=!0),x[1]<=E){if(x[1]=k,x=p[++b],!x)break;x[0]<=E?(x[0]=k,C=!0):C=!1}E+=D}}x&&(x[1]=this._bufferService.cols)}}static _mergeRanges(p,h){let y=!1;for(let b=0;b<p.length;b++){const C=p[b];if(y){if(h[1]<=C[0])return p[b-1][1]=h[1],p;if(h[1]<=C[1])return p[b-1][1]=Math.max(h[1],C[1]),p.splice(b,1),p;p.splice(b,1),b--}else{if(h[1]<=C[0])return p.splice(b,0,h),p;if(h[1]<=C[1])return C[0]=Math.min(h[0],C[0]),p;h[0]<C[1]&&(C[0]=Math.min(h[0],C[0]),y=!0)}}return y?p[p.length-1][1]=h[1]:p.push(h),p}};i.CharacterJoinerService=u=d([g(0,w.IBufferService)],u)},5114:(c,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.CoreBrowserService=void 0;const d=a(844),g=a(8460),l=a(3656);class m extends d.Disposable{constructor(_,u,f){super(),this._textarea=_,this._window=u,this.mainDocument=f,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new v(this._window),this._onDprChange=this.register(new g.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new g.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange(p=>this._screenDprMonitor.setWindow(p))),this.register((0,g.forwardEvent)(this._screenDprMonitor.onDprChange,this._onDprChange)),this._textarea.addEventListener("focus",()=>this._isFocused=!0),this._textarea.addEventListener("blur",()=>this._isFocused=!1)}get window(){return this._window}set window(_){this._window!==_&&(this._window=_,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}}i.CoreBrowserService=m;class v extends d.Disposable{constructor(_){super(),this._parentWindow=_,this._windowResizeListener=this.register(new d.MutableDisposable),this._onDprChange=this.register(new g.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,d.toDisposable)(()=>this.clearListener()))}setWindow(_){this._parentWindow=_,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,l.addDisposableDomListener)(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var _;this._outerListener&&((_=this._resolutionMediaMatchList)==null||_.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){this._resolutionMediaMatchList&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}}},779:(c,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.LinkProviderService=void 0;const d=a(844);class g extends d.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,d.toDisposable)(()=>this.linkProviders.length=0))}registerLinkProvider(m){return this.linkProviders.push(m),{dispose:()=>{const v=this.linkProviders.indexOf(m);v!==-1&&this.linkProviders.splice(v,1)}}}}i.LinkProviderService=g},8934:function(c,i,a){var d=this&&this.__decorate||function(w,_,u,f){var p,h=arguments.length,y=h<3?_:f===null?f=Object.getOwnPropertyDescriptor(_,u):f;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")y=Reflect.decorate(w,_,u,f);else for(var b=w.length-1;b>=0;b--)(p=w[b])&&(y=(h<3?p(y):h>3?p(_,u,y):p(_,u))||y);return h>3&&y&&Object.defineProperty(_,u,y),y},g=this&&this.__param||function(w,_){return function(u,f){_(u,f,w)}};Object.defineProperty(i,"__esModule",{value:!0}),i.MouseService=void 0;const l=a(4725),m=a(9806);let v=i.MouseService=class{constructor(w,_){this._renderService=w,this._charSizeService=_}getCoords(w,_,u,f,p){return(0,m.getCoords)(window,w,_,u,f,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,p)}getMouseReportCoords(w,_){const u=(0,m.getCoordsRelativeToElement)(window,w,_);if(this._charSizeService.hasValidSize)return u[0]=Math.min(Math.max(u[0],0),this._renderService.dimensions.css.canvas.width-1),u[1]=Math.min(Math.max(u[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(u[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(u[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(u[0]),y:Math.floor(u[1])}}};i.MouseService=v=d([g(0,l.IRenderService),g(1,l.ICharSizeService)],v)},3230:function(c,i,a){var d=this&&this.__decorate||function(p,h,y,b){var C,E=arguments.length,x=E<3?h:b===null?b=Object.getOwnPropertyDescriptor(h,y):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(p,h,y,b);else for(var k=p.length-1;k>=0;k--)(C=p[k])&&(x=(E<3?C(x):E>3?C(h,y,x):C(h,y))||x);return E>3&&x&&Object.defineProperty(h,y,x),x},g=this&&this.__param||function(p,h){return function(y,b){h(y,b,p)}};Object.defineProperty(i,"__esModule",{value:!0}),i.RenderService=void 0;const l=a(6193),m=a(4725),v=a(8460),w=a(844),_=a(7226),u=a(2585);let f=i.RenderService=class extends w.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(p,h,y,b,C,E,x,k){super(),this._rowCount=p,this._charSizeService=b,this._renderer=this.register(new w.MutableDisposable),this._pausedResizeTask=new _.DebouncedIdleTask,this._observerDisposable=this.register(new w.MutableDisposable),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this.register(new v.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new v.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new v.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new v.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new l.RenderDebouncer((M,D)=>this._renderRows(M,D),x),this.register(this._renderDebouncer),this.register(x.onDprChange(()=>this.handleDevicePixelRatioChange())),this.register(E.onResize(()=>this._fullRefresh())),this.register(E.buffers.onBufferActivate(()=>{var M;return(M=this._renderer.value)==null?void 0:M.clear()})),this.register(y.onOptionChange(()=>this._handleOptionsChanged())),this.register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this.register(C.onDecorationRegistered(()=>this._fullRefresh())),this.register(C.onDecorationRemoved(()=>this._fullRefresh())),this.register(y.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(E.cols,E.rows),this._fullRefresh()})),this.register(y.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(E.buffer.y,E.buffer.y,!0))),this.register(k.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(x.window,h),this.register(x.onWindowChange(M=>this._registerIntersectionObserver(M,h)))}_registerIntersectionObserver(p,h){if("IntersectionObserver"in p){const y=new p.IntersectionObserver(b=>this._handleIntersectionChange(b[b.length-1]),{threshold:0});y.observe(h),this._observerDisposable.value=(0,w.toDisposable)(()=>y.disconnect())}}_handleIntersectionChange(p){this._isPaused=p.isIntersecting===void 0?p.intersectionRatio===0:!p.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(p,h,y=!1){this._isPaused?this._needsFullRefresh=!0:(y||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(p,h,this._rowCount))}_renderRows(p,h){this._renderer.value&&(p=Math.min(p,this._rowCount-1),h=Math.min(h,this._rowCount-1),this._renderer.value.renderRows(p,h),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:p,end:h}),this._onRender.fire({start:p,end:h}),this._isNextRenderRedrawOnly=!0)}resize(p,h){this._rowCount=h,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(p){this._renderer.value=p,this._renderer.value&&(this._renderer.value.onRequestRedraw(h=>this.refreshRows(h.start,h.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(p){return this._renderDebouncer.addRefreshCallback(p)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var p,h;this._renderer.value&&((h=(p=this._renderer.value).clearTextureAtlas)==null||h.call(p),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(p,h){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>{var y;return(y=this._renderer.value)==null?void 0:y.handleResize(p,h)}):this._renderer.value.handleResize(p,h),this._fullRefresh())}handleCharSizeChanged(){var p;(p=this._renderer.value)==null||p.handleCharSizeChanged()}handleBlur(){var p;(p=this._renderer.value)==null||p.handleBlur()}handleFocus(){var p;(p=this._renderer.value)==null||p.handleFocus()}handleSelectionChanged(p,h,y){var b;this._selectionState.start=p,this._selectionState.end=h,this._selectionState.columnSelectMode=y,(b=this._renderer.value)==null||b.handleSelectionChanged(p,h,y)}handleCursorMove(){var p;(p=this._renderer.value)==null||p.handleCursorMove()}clear(){var p;(p=this._renderer.value)==null||p.clear()}};i.RenderService=f=d([g(2,u.IOptionsService),g(3,m.ICharSizeService),g(4,u.IDecorationService),g(5,u.IBufferService),g(6,m.ICoreBrowserService),g(7,m.IThemeService)],f)},9312:function(c,i,a){var d=this&&this.__decorate||function(x,k,M,D){var R,N=arguments.length,A=N<3?k:D===null?D=Object.getOwnPropertyDescriptor(k,M):D;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(x,k,M,D);else for(var $=x.length-1;$>=0;$--)(R=x[$])&&(A=(N<3?R(A):N>3?R(k,M,A):R(k,M))||A);return N>3&&A&&Object.defineProperty(k,M,A),A},g=this&&this.__param||function(x,k){return function(M,D){k(M,D,x)}};Object.defineProperty(i,"__esModule",{value:!0}),i.SelectionService=void 0;const l=a(9806),m=a(9504),v=a(456),w=a(4725),_=a(8460),u=a(844),f=a(6114),p=a(4841),h=a(511),y=a(2585),b=" ",C=new RegExp(b,"g");let E=i.SelectionService=class extends u.Disposable{constructor(x,k,M,D,R,N,A,$,F){super(),this._element=x,this._screenElement=k,this._linkifier=M,this._bufferService=D,this._coreService=R,this._mouseService=N,this._optionsService=A,this._renderService=$,this._coreBrowserService=F,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new h.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new _.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new _.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new _.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new _.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=H=>this._handleMouseMove(H),this._mouseUpListener=H=>this._handleMouseUp(H),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(H=>this._handleTrim(H)),this.register(this._bufferService.buffers.onBufferActivate(H=>this._handleBufferActivate(H))),this.enable(),this._model=new v.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,u.toDisposable)(()=>{this._removeMouseDownListeners()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){const x=this._model.finalSelectionStart,k=this._model.finalSelectionEnd;return!(!x||!k||x[0]===k[0]&&x[1]===k[1])}get selectionText(){const x=this._model.finalSelectionStart,k=this._model.finalSelectionEnd;if(!x||!k)return"";const M=this._bufferService.buffer,D=[];if(this._activeSelectionMode===3){if(x[0]===k[0])return"";const R=x[0]<k[0]?x[0]:k[0],N=x[0]<k[0]?k[0]:x[0];for(let A=x[1];A<=k[1];A++){const $=M.translateBufferLineToString(A,!0,R,N);D.push($)}}else{const R=x[1]===k[1]?k[0]:void 0;D.push(M.translateBufferLineToString(x[1],!0,x[0],R));for(let N=x[1]+1;N<=k[1]-1;N++){const A=M.lines.get(N),$=M.translateBufferLineToString(N,!0);A!=null&&A.isWrapped?D[D.length-1]+=$:D.push($)}if(x[1]!==k[1]){const N=M.lines.get(k[1]),A=M.translateBufferLineToString(k[1],!0,0,k[0]);N&&N.isWrapped?D[D.length-1]+=A:D.push(A)}}return D.map(R=>R.replace(C," ")).join(f.isWindows?`\r
77
- `:`
78
- `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(x){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),f.isLinux&&x&&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(x){const k=this._getMouseBufferCoords(x),M=this._model.finalSelectionStart,D=this._model.finalSelectionEnd;return!!(M&&D&&k)&&this._areCoordsInSelection(k,M,D)}isCellInSelection(x,k){const M=this._model.finalSelectionStart,D=this._model.finalSelectionEnd;return!(!M||!D)&&this._areCoordsInSelection([x,k],M,D)}_areCoordsInSelection(x,k,M){return x[1]>k[1]&&x[1]<M[1]||k[1]===M[1]&&x[1]===k[1]&&x[0]>=k[0]&&x[0]<M[0]||k[1]<M[1]&&x[1]===M[1]&&x[0]<M[0]||k[1]<M[1]&&x[1]===k[1]&&x[0]>=k[0]}_selectWordAtCursor(x,k){var R,N;const M=(N=(R=this._linkifier.currentLink)==null?void 0:R.link)==null?void 0:N.range;if(M)return this._model.selectionStart=[M.start.x-1,M.start.y-1],this._model.selectionStartLength=(0,p.getRangeLength)(M,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const D=this._getMouseBufferCoords(x);return!!D&&(this._selectWordAt(D,k),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(x,k){this._model.clearSelection(),x=Math.max(x,0),k=Math.min(k,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,x],this._model.selectionEnd=[this._bufferService.cols,k],this.refresh(),this._onSelectionChange.fire()}_handleTrim(x){this._model.handleTrim(x)&&this.refresh()}_getMouseBufferCoords(x){const k=this._mouseService.getCoords(x,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(k)return k[0]--,k[1]--,k[1]+=this._bufferService.buffer.ydisp,k}_getMouseEventScrollAmount(x){let k=(0,l.getCoordsRelativeToElement)(this._coreBrowserService.window,x,this._screenElement)[1];const M=this._renderService.dimensions.css.canvas.height;return k>=0&&k<=M?0:(k>M&&(k-=M),k=Math.min(Math.max(k,-50),50),k/=50,k/Math.abs(k)+Math.round(14*k))}shouldForceSelection(x){return f.isMac?x.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:x.shiftKey}handleMouseDown(x){if(this._mouseDownTimeStamp=x.timeStamp,(x.button!==2||!this.hasSelection)&&x.button===0){if(!this._enabled){if(!this.shouldForceSelection(x))return;x.stopPropagation()}x.preventDefault(),this._dragScrollAmount=0,this._enabled&&x.shiftKey?this._handleIncrementalClick(x):x.detail===1?this._handleSingleClick(x):x.detail===2?this._handleDoubleClick(x):x.detail===3&&this._handleTripleClick(x),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),50)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(x){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(x))}_handleSingleClick(x){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(x)?3:0,this._model.selectionStart=this._getMouseBufferCoords(x),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const k=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);k&&k.length!==this._model.selectionStart[0]&&k.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(x){this._selectWordAtCursor(x,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(x){const k=this._getMouseBufferCoords(x);k&&(this._activeSelectionMode=2,this._selectLineAt(k[1]))}shouldColumnSelect(x){return x.altKey&&!(f.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(x){if(x.stopImmediatePropagation(),!this._model.selectionStart)return;const k=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(x),!this._model.selectionEnd)return void this.refresh(!0);this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(x),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const M=this._bufferService.buffer;if(this._model.selectionEnd[1]<M.lines.length){const D=M.lines.get(this._model.selectionEnd[1]);D&&D.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}k&&k[0]===this._model.selectionEnd[0]&&k[1]===this._model.selectionEnd[1]||this.refresh(!0)}_dragScroll(){if(this._model.selectionEnd&&this._model.selectionStart&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});const x=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(x.ydisp+this._bufferService.rows,x.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=x.ydisp),this.refresh()}}_handleMouseUp(x){const k=x.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&k<500&&x.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const M=this._mouseService.getCoords(x,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(M&&M[0]!==void 0&&M[1]!==void 0){const D=(0,m.moveToCellSequence)(M[0]-1,M[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(D,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const x=this._model.finalSelectionStart,k=this._model.finalSelectionEnd,M=!(!x||!k||x[0]===k[0]&&x[1]===k[1]);M?x&&k&&(this._oldSelectionStart&&this._oldSelectionEnd&&x[0]===this._oldSelectionStart[0]&&x[1]===this._oldSelectionStart[1]&&k[0]===this._oldSelectionEnd[0]&&k[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(x,k,M)):this._oldHasSelection&&this._fireOnSelectionChange(x,k,M)}_fireOnSelectionChange(x,k,M){this._oldSelectionStart=x,this._oldSelectionEnd=k,this._oldHasSelection=M,this._onSelectionChange.fire()}_handleBufferActivate(x){this.clearSelection(),this._trimListener.dispose(),this._trimListener=x.activeBuffer.lines.onTrim(k=>this._handleTrim(k))}_convertViewportColToCharacterIndex(x,k){let M=k;for(let D=0;k>=D;D++){const R=x.loadCell(D,this._workCell).getChars().length;this._workCell.getWidth()===0?M--:R>1&&k!==D&&(M+=R-1)}return M}setSelection(x,k,M){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[x,k],this._model.selectionStartLength=M,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(x){this._isClickInSelection(x)||(this._selectWordAtCursor(x,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(x,k,M=!0,D=!0){if(x[0]>=this._bufferService.cols)return;const R=this._bufferService.buffer,N=R.lines.get(x[1]);if(!N)return;const A=R.translateBufferLineToString(x[1],!1);let $=this._convertViewportColToCharacterIndex(N,x[0]),F=$;const H=x[0]-$;let I=0,L=0,T=0,j=0;if(A.charAt($)===" "){for(;$>0&&A.charAt($-1)===" ";)$--;for(;F<A.length&&A.charAt(F+1)===" ";)F++}else{let q=x[0],J=x[0];N.getWidth(q)===0&&(I++,q--),N.getWidth(J)===2&&(L++,J++);const Q=N.getString(J).length;for(Q>1&&(j+=Q-1,F+=Q-1);q>0&&$>0&&!this._isCharWordSeparator(N.loadCell(q-1,this._workCell));){N.loadCell(q-1,this._workCell);const z=this._workCell.getChars().length;this._workCell.getWidth()===0?(I++,q--):z>1&&(T+=z-1,$-=z-1),$--,q--}for(;J<N.length&&F+1<A.length&&!this._isCharWordSeparator(N.loadCell(J+1,this._workCell));){N.loadCell(J+1,this._workCell);const z=this._workCell.getChars().length;this._workCell.getWidth()===2?(L++,J++):z>1&&(j+=z-1,F+=z-1),F++,J++}}F++;let O=$+H-I+T,V=Math.min(this._bufferService.cols,F-$+I+L-T-j);if(k||A.slice($,F).trim()!==""){if(M&&O===0&&N.getCodePoint(0)!==32){const q=R.lines.get(x[1]-1);if(q&&N.isWrapped&&q.getCodePoint(this._bufferService.cols-1)!==32){const J=this._getWordAt([this._bufferService.cols-1,x[1]-1],!1,!0,!1);if(J){const Q=this._bufferService.cols-J.start;O-=Q,V+=Q}}}if(D&&O+V===this._bufferService.cols&&N.getCodePoint(this._bufferService.cols-1)!==32){const q=R.lines.get(x[1]+1);if(q!=null&&q.isWrapped&&q.getCodePoint(0)!==32){const J=this._getWordAt([0,x[1]+1],!1,!1,!0);J&&(V+=J.length)}}return{start:O,length:V}}}_selectWordAt(x,k){const M=this._getWordAt(x,k);if(M){for(;M.start<0;)M.start+=this._bufferService.cols,x[1]--;this._model.selectionStart=[M.start,x[1]],this._model.selectionStartLength=M.length}}_selectToWordAt(x){const k=this._getWordAt(x,!0);if(k){let M=x[1];for(;k.start<0;)k.start+=this._bufferService.cols,M--;if(!this._model.areSelectionValuesReversed())for(;k.start+k.length>this._bufferService.cols;)k.length-=this._bufferService.cols,M++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?k.start:k.start+k.length,M]}}_isCharWordSeparator(x){return x.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(x.getChars())>=0}_selectLineAt(x){const k=this._bufferService.buffer.getWrappedRangeForLine(x),M={start:{x:0,y:k.first},end:{x:this._bufferService.cols-1,y:k.last}};this._model.selectionStart=[0,k.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,p.getRangeLength)(M,this._bufferService.cols)}};i.SelectionService=E=d([g(3,y.IBufferService),g(4,y.ICoreService),g(5,w.IMouseService),g(6,y.IOptionsService),g(7,w.IRenderService),g(8,w.ICoreBrowserService)],E)},4725:(c,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.ILinkProviderService=i.IThemeService=i.ICharacterJoinerService=i.ISelectionService=i.IRenderService=i.IMouseService=i.ICoreBrowserService=i.ICharSizeService=void 0;const d=a(8343);i.ICharSizeService=(0,d.createDecorator)("CharSizeService"),i.ICoreBrowserService=(0,d.createDecorator)("CoreBrowserService"),i.IMouseService=(0,d.createDecorator)("MouseService"),i.IRenderService=(0,d.createDecorator)("RenderService"),i.ISelectionService=(0,d.createDecorator)("SelectionService"),i.ICharacterJoinerService=(0,d.createDecorator)("CharacterJoinerService"),i.IThemeService=(0,d.createDecorator)("ThemeService"),i.ILinkProviderService=(0,d.createDecorator)("LinkProviderService")},6731:function(c,i,a){var d=this&&this.__decorate||function(E,x,k,M){var D,R=arguments.length,N=R<3?x:M===null?M=Object.getOwnPropertyDescriptor(x,k):M;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(E,x,k,M);else for(var A=E.length-1;A>=0;A--)(D=E[A])&&(N=(R<3?D(N):R>3?D(x,k,N):D(x,k))||N);return R>3&&N&&Object.defineProperty(x,k,N),N},g=this&&this.__param||function(E,x){return function(k,M){x(k,M,E)}};Object.defineProperty(i,"__esModule",{value:!0}),i.ThemeService=i.DEFAULT_ANSI_COLORS=void 0;const l=a(7239),m=a(8055),v=a(8460),w=a(844),_=a(2585),u=m.css.toColor("#ffffff"),f=m.css.toColor("#000000"),p=m.css.toColor("#ffffff"),h=m.css.toColor("#000000"),y={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};i.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const E=[m.css.toColor("#2e3436"),m.css.toColor("#cc0000"),m.css.toColor("#4e9a06"),m.css.toColor("#c4a000"),m.css.toColor("#3465a4"),m.css.toColor("#75507b"),m.css.toColor("#06989a"),m.css.toColor("#d3d7cf"),m.css.toColor("#555753"),m.css.toColor("#ef2929"),m.css.toColor("#8ae234"),m.css.toColor("#fce94f"),m.css.toColor("#729fcf"),m.css.toColor("#ad7fa8"),m.css.toColor("#34e2e2"),m.css.toColor("#eeeeec")],x=[0,95,135,175,215,255];for(let k=0;k<216;k++){const M=x[k/36%6|0],D=x[k/6%6|0],R=x[k%6];E.push({css:m.channels.toCss(M,D,R),rgba:m.channels.toRgba(M,D,R)})}for(let k=0;k<24;k++){const M=8+10*k;E.push({css:m.channels.toCss(M,M,M),rgba:m.channels.toRgba(M,M,M)})}return E})());let b=i.ThemeService=class extends w.Disposable{get colors(){return this._colors}constructor(E){super(),this._optionsService=E,this._contrastCache=new l.ColorContrastCache,this._halfContrastCache=new l.ColorContrastCache,this._onChangeColors=this.register(new v.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:u,background:f,cursor:p,cursorAccent:h,selectionForeground:void 0,selectionBackgroundTransparent:y,selectionBackgroundOpaque:m.color.blend(f,y),selectionInactiveBackgroundTransparent:y,selectionInactiveBackgroundOpaque:m.color.blend(f,y),ansi:i.DEFAULT_ANSI_COLORS.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this.register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",()=>this._contrastCache.clear())),this.register(this._optionsService.onSpecificOptionChange("theme",()=>this._setTheme(this._optionsService.rawOptions.theme)))}_setTheme(E={}){const x=this._colors;if(x.foreground=C(E.foreground,u),x.background=C(E.background,f),x.cursor=C(E.cursor,p),x.cursorAccent=C(E.cursorAccent,h),x.selectionBackgroundTransparent=C(E.selectionBackground,y),x.selectionBackgroundOpaque=m.color.blend(x.background,x.selectionBackgroundTransparent),x.selectionInactiveBackgroundTransparent=C(E.selectionInactiveBackground,x.selectionBackgroundTransparent),x.selectionInactiveBackgroundOpaque=m.color.blend(x.background,x.selectionInactiveBackgroundTransparent),x.selectionForeground=E.selectionForeground?C(E.selectionForeground,m.NULL_COLOR):void 0,x.selectionForeground===m.NULL_COLOR&&(x.selectionForeground=void 0),m.color.isOpaque(x.selectionBackgroundTransparent)&&(x.selectionBackgroundTransparent=m.color.opacity(x.selectionBackgroundTransparent,.3)),m.color.isOpaque(x.selectionInactiveBackgroundTransparent)&&(x.selectionInactiveBackgroundTransparent=m.color.opacity(x.selectionInactiveBackgroundTransparent,.3)),x.ansi=i.DEFAULT_ANSI_COLORS.slice(),x.ansi[0]=C(E.black,i.DEFAULT_ANSI_COLORS[0]),x.ansi[1]=C(E.red,i.DEFAULT_ANSI_COLORS[1]),x.ansi[2]=C(E.green,i.DEFAULT_ANSI_COLORS[2]),x.ansi[3]=C(E.yellow,i.DEFAULT_ANSI_COLORS[3]),x.ansi[4]=C(E.blue,i.DEFAULT_ANSI_COLORS[4]),x.ansi[5]=C(E.magenta,i.DEFAULT_ANSI_COLORS[5]),x.ansi[6]=C(E.cyan,i.DEFAULT_ANSI_COLORS[6]),x.ansi[7]=C(E.white,i.DEFAULT_ANSI_COLORS[7]),x.ansi[8]=C(E.brightBlack,i.DEFAULT_ANSI_COLORS[8]),x.ansi[9]=C(E.brightRed,i.DEFAULT_ANSI_COLORS[9]),x.ansi[10]=C(E.brightGreen,i.DEFAULT_ANSI_COLORS[10]),x.ansi[11]=C(E.brightYellow,i.DEFAULT_ANSI_COLORS[11]),x.ansi[12]=C(E.brightBlue,i.DEFAULT_ANSI_COLORS[12]),x.ansi[13]=C(E.brightMagenta,i.DEFAULT_ANSI_COLORS[13]),x.ansi[14]=C(E.brightCyan,i.DEFAULT_ANSI_COLORS[14]),x.ansi[15]=C(E.brightWhite,i.DEFAULT_ANSI_COLORS[15]),E.extendedAnsi){const k=Math.min(x.ansi.length-16,E.extendedAnsi.length);for(let M=0;M<k;M++)x.ansi[M+16]=C(E.extendedAnsi[M],i.DEFAULT_ANSI_COLORS[M+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(E){this._restoreColor(E),this._onChangeColors.fire(this.colors)}_restoreColor(E){if(E!==void 0)switch(E){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[E]=this._restoreColors.ansi[E]}else for(let x=0;x<this._restoreColors.ansi.length;++x)this._colors.ansi[x]=this._restoreColors.ansi[x]}modifyColors(E){E(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};function C(E,x){if(E!==void 0)try{return m.css.toColor(E)}catch{}return x}i.ThemeService=b=d([g(0,_.IOptionsService)],b)},6349:(c,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.CircularList=void 0;const d=a(8460),g=a(844);class l extends g.Disposable{constructor(v){super(),this._maxLength=v,this.onDeleteEmitter=this.register(new d.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new d.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new d.EventEmitter),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(v){if(this._maxLength===v)return;const w=new Array(v);for(let _=0;_<Math.min(v,this.length);_++)w[_]=this._array[this._getCyclicIndex(_)];this._array=w,this._maxLength=v,this._startIndex=0}get length(){return this._length}set length(v){if(v>this._length)for(let w=this._length;w<v;w++)this._array[w]=void 0;this._length=v}get(v){return this._array[this._getCyclicIndex(v)]}set(v,w){this._array[this._getCyclicIndex(v)]=w}push(v){this._array[this._getCyclicIndex(this._length)]=v,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(v,w,..._){if(w){for(let u=v;u<this._length-w;u++)this._array[this._getCyclicIndex(u)]=this._array[this._getCyclicIndex(u+w)];this._length-=w,this.onDeleteEmitter.fire({index:v,amount:w})}for(let u=this._length-1;u>=v;u--)this._array[this._getCyclicIndex(u+_.length)]=this._array[this._getCyclicIndex(u)];for(let u=0;u<_.length;u++)this._array[this._getCyclicIndex(v+u)]=_[u];if(_.length&&this.onInsertEmitter.fire({index:v,amount:_.length}),this._length+_.length>this._maxLength){const u=this._length+_.length-this._maxLength;this._startIndex+=u,this._length=this._maxLength,this.onTrimEmitter.fire(u)}else this._length+=_.length}trimStart(v){v>this._length&&(v=this._length),this._startIndex+=v,this._length-=v,this.onTrimEmitter.fire(v)}shiftElements(v,w,_){if(!(w<=0)){if(v<0||v>=this._length)throw new Error("start argument out of range");if(v+_<0)throw new Error("Cannot shift elements in list beyond index 0");if(_>0){for(let f=w-1;f>=0;f--)this.set(v+f+_,this.get(v+f));const u=v+w+_-this._length;if(u>0)for(this._length+=u;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let u=0;u<w;u++)this.set(v+u+_,this.get(v+u))}}_getCyclicIndex(v){return(this._startIndex+v)%this._maxLength}}i.CircularList=l},1439:(c,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.clone=void 0,i.clone=function a(d,g=5){if(typeof d!="object")return d;const l=Array.isArray(d)?[]:{};for(const m in d)l[m]=g<=1?d[m]:d[m]&&a(d[m],g-1);return l}},8055:(c,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.contrastRatio=i.toPaddedHex=i.rgba=i.rgb=i.css=i.color=i.channels=i.NULL_COLOR=void 0;let a=0,d=0,g=0,l=0;var m,v,w,_,u;function f(h){const y=h.toString(16);return y.length<2?"0"+y:y}function p(h,y){return h<y?(y+.05)/(h+.05):(h+.05)/(y+.05)}i.NULL_COLOR={css:"#00000000",rgba:0},function(h){h.toCss=function(y,b,C,E){return E!==void 0?`#${f(y)}${f(b)}${f(C)}${f(E)}`:`#${f(y)}${f(b)}${f(C)}`},h.toRgba=function(y,b,C,E=255){return(y<<24|b<<16|C<<8|E)>>>0},h.toColor=function(y,b,C,E){return{css:h.toCss(y,b,C,E),rgba:h.toRgba(y,b,C,E)}}}(m||(i.channels=m={})),function(h){function y(b,C){return l=Math.round(255*C),[a,d,g]=u.toChannels(b.rgba),{css:m.toCss(a,d,g,l),rgba:m.toRgba(a,d,g,l)}}h.blend=function(b,C){if(l=(255&C.rgba)/255,l===1)return{css:C.css,rgba:C.rgba};const E=C.rgba>>24&255,x=C.rgba>>16&255,k=C.rgba>>8&255,M=b.rgba>>24&255,D=b.rgba>>16&255,R=b.rgba>>8&255;return a=M+Math.round((E-M)*l),d=D+Math.round((x-D)*l),g=R+Math.round((k-R)*l),{css:m.toCss(a,d,g),rgba:m.toRgba(a,d,g)}},h.isOpaque=function(b){return(255&b.rgba)==255},h.ensureContrastRatio=function(b,C,E){const x=u.ensureContrastRatio(b.rgba,C.rgba,E);if(x)return m.toColor(x>>24&255,x>>16&255,x>>8&255)},h.opaque=function(b){const C=(255|b.rgba)>>>0;return[a,d,g]=u.toChannels(C),{css:m.toCss(a,d,g),rgba:C}},h.opacity=y,h.multiplyOpacity=function(b,C){return l=255&b.rgba,y(b,l*C/255)},h.toColorRGB=function(b){return[b.rgba>>24&255,b.rgba>>16&255,b.rgba>>8&255]}}(v||(i.color=v={})),function(h){let y,b;try{const C=document.createElement("canvas");C.width=1,C.height=1;const E=C.getContext("2d",{willReadFrequently:!0});E&&(y=E,y.globalCompositeOperation="copy",b=y.createLinearGradient(0,0,1,1))}catch{}h.toColor=function(C){if(C.match(/#[\da-f]{3,8}/i))switch(C.length){case 4:return a=parseInt(C.slice(1,2).repeat(2),16),d=parseInt(C.slice(2,3).repeat(2),16),g=parseInt(C.slice(3,4).repeat(2),16),m.toColor(a,d,g);case 5:return a=parseInt(C.slice(1,2).repeat(2),16),d=parseInt(C.slice(2,3).repeat(2),16),g=parseInt(C.slice(3,4).repeat(2),16),l=parseInt(C.slice(4,5).repeat(2),16),m.toColor(a,d,g,l);case 7:return{css:C,rgba:(parseInt(C.slice(1),16)<<8|255)>>>0};case 9:return{css:C,rgba:parseInt(C.slice(1),16)>>>0}}const E=C.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(E)return a=parseInt(E[1]),d=parseInt(E[2]),g=parseInt(E[3]),l=Math.round(255*(E[5]===void 0?1:parseFloat(E[5]))),m.toColor(a,d,g,l);if(!y||!b)throw new Error("css.toColor: Unsupported css format");if(y.fillStyle=b,y.fillStyle=C,typeof y.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(y.fillRect(0,0,1,1),[a,d,g,l]=y.getImageData(0,0,1,1).data,l!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:m.toRgba(a,d,g,l),css:C}}}(w||(i.css=w={})),function(h){function y(b,C,E){const x=b/255,k=C/255,M=E/255;return .2126*(x<=.03928?x/12.92:Math.pow((x+.055)/1.055,2.4))+.7152*(k<=.03928?k/12.92:Math.pow((k+.055)/1.055,2.4))+.0722*(M<=.03928?M/12.92:Math.pow((M+.055)/1.055,2.4))}h.relativeLuminance=function(b){return y(b>>16&255,b>>8&255,255&b)},h.relativeLuminance2=y}(_||(i.rgb=_={})),function(h){function y(C,E,x){const k=C>>24&255,M=C>>16&255,D=C>>8&255;let R=E>>24&255,N=E>>16&255,A=E>>8&255,$=p(_.relativeLuminance2(R,N,A),_.relativeLuminance2(k,M,D));for(;$<x&&(R>0||N>0||A>0);)R-=Math.max(0,Math.ceil(.1*R)),N-=Math.max(0,Math.ceil(.1*N)),A-=Math.max(0,Math.ceil(.1*A)),$=p(_.relativeLuminance2(R,N,A),_.relativeLuminance2(k,M,D));return(R<<24|N<<16|A<<8|255)>>>0}function b(C,E,x){const k=C>>24&255,M=C>>16&255,D=C>>8&255;let R=E>>24&255,N=E>>16&255,A=E>>8&255,$=p(_.relativeLuminance2(R,N,A),_.relativeLuminance2(k,M,D));for(;$<x&&(R<255||N<255||A<255);)R=Math.min(255,R+Math.ceil(.1*(255-R))),N=Math.min(255,N+Math.ceil(.1*(255-N))),A=Math.min(255,A+Math.ceil(.1*(255-A))),$=p(_.relativeLuminance2(R,N,A),_.relativeLuminance2(k,M,D));return(R<<24|N<<16|A<<8|255)>>>0}h.blend=function(C,E){if(l=(255&E)/255,l===1)return E;const x=E>>24&255,k=E>>16&255,M=E>>8&255,D=C>>24&255,R=C>>16&255,N=C>>8&255;return a=D+Math.round((x-D)*l),d=R+Math.round((k-R)*l),g=N+Math.round((M-N)*l),m.toRgba(a,d,g)},h.ensureContrastRatio=function(C,E,x){const k=_.relativeLuminance(C>>8),M=_.relativeLuminance(E>>8);if(p(k,M)<x){if(M<k){const N=y(C,E,x),A=p(k,_.relativeLuminance(N>>8));if(A<x){const $=b(C,E,x);return A>p(k,_.relativeLuminance($>>8))?N:$}return N}const D=b(C,E,x),R=p(k,_.relativeLuminance(D>>8));if(R<x){const N=y(C,E,x);return R>p(k,_.relativeLuminance(N>>8))?D:N}return D}},h.reduceLuminance=y,h.increaseLuminance=b,h.toChannels=function(C){return[C>>24&255,C>>16&255,C>>8&255,255&C]}}(u||(i.rgba=u={})),i.toPaddedHex=f,i.contrastRatio=p},8969:(c,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.CoreTerminal=void 0;const d=a(844),g=a(2585),l=a(4348),m=a(7866),v=a(744),w=a(7302),_=a(6975),u=a(8460),f=a(1753),p=a(1480),h=a(7994),y=a(9282),b=a(5435),C=a(5981),E=a(2660);let x=!1;class k extends d.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new u.EventEmitter),this._onScroll.event(D=>{var R;(R=this._onScrollApi)==null||R.fire(D.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(D){for(const R in D)this.optionsService.options[R]=D[R]}constructor(D){super(),this._windowsWrappingHeuristics=this.register(new d.MutableDisposable),this._onBinary=this.register(new u.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new u.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new u.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new u.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new u.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new u.EventEmitter),this._instantiationService=new l.InstantiationService,this.optionsService=this.register(new w.OptionsService(D)),this._instantiationService.setService(g.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(v.BufferService)),this._instantiationService.setService(g.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(m.LogService)),this._instantiationService.setService(g.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(_.CoreService)),this._instantiationService.setService(g.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(f.CoreMouseService)),this._instantiationService.setService(g.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(p.UnicodeService)),this._instantiationService.setService(g.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(h.CharsetService),this._instantiationService.setService(g.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(E.OscLinkService),this._instantiationService.setService(g.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new b.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,u.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,u.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,u.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,u.forwardEvent)(this.coreService.onBinary,this._onBinary)),this.register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom())),this.register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this.register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],()=>this._handleWindowsPtyOptionChange())),this.register(this._bufferService.onScroll(R=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this.register(this._inputHandler.onScroll(R=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this.register(new C.WriteBuffer((R,N)=>this._inputHandler.parse(R,N))),this.register((0,u.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(D,R){this._writeBuffer.write(D,R)}writeSync(D,R){this._logService.logLevel<=g.LogLevelEnum.WARN&&!x&&(this._logService.warn("writeSync is unreliable and will be removed soon."),x=!0),this._writeBuffer.writeSync(D,R)}input(D,R=!0){this.coreService.triggerDataEvent(D,R)}resize(D,R){isNaN(D)||isNaN(R)||(D=Math.max(D,v.MINIMUM_COLS),R=Math.max(R,v.MINIMUM_ROWS),this._bufferService.resize(D,R))}scroll(D,R=!1){this._bufferService.scroll(D,R)}scrollLines(D,R,N){this._bufferService.scrollLines(D,R,N)}scrollPages(D){this.scrollLines(D*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(D){const R=D-this._bufferService.buffer.ydisp;R!==0&&this.scrollLines(R)}registerEscHandler(D,R){return this._inputHandler.registerEscHandler(D,R)}registerDcsHandler(D,R){return this._inputHandler.registerDcsHandler(D,R)}registerCsiHandler(D,R){return this._inputHandler.registerCsiHandler(D,R)}registerOscHandler(D,R){return this._inputHandler.registerOscHandler(D,R)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let D=!1;const R=this.optionsService.rawOptions.windowsPty;R&&R.buildNumber!==void 0&&R.buildNumber!==void 0?D=R.backend==="conpty"&&R.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(D=!0),D?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const D=[];D.push(this.onLineFeed(y.updateWindowsModeWrappedState.bind(null,this._bufferService))),D.push(this.registerCsiHandler({final:"H"},()=>((0,y.updateWindowsModeWrappedState)(this._bufferService),!1))),this._windowsWrappingHeuristics.value=(0,d.toDisposable)(()=>{for(const R of D)R.dispose()})}}}i.CoreTerminal=k},8460:(c,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.runAndSubscribe=i.forwardEvent=i.EventEmitter=void 0,i.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=a=>(this._listeners.push(a),{dispose:()=>{if(!this._disposed){for(let d=0;d<this._listeners.length;d++)if(this._listeners[d]===a)return void this._listeners.splice(d,1)}}})),this._event}fire(a,d){const g=[];for(let l=0;l<this._listeners.length;l++)g.push(this._listeners[l]);for(let l=0;l<g.length;l++)g[l].call(void 0,a,d)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},i.forwardEvent=function(a,d){return a(g=>d.fire(g))},i.runAndSubscribe=function(a,d){return d(void 0),a(g=>d(g))}},5435:function(c,i,a){var d=this&&this.__decorate||function(I,L,T,j){var O,V=arguments.length,q=V<3?L:j===null?j=Object.getOwnPropertyDescriptor(L,T):j;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")q=Reflect.decorate(I,L,T,j);else for(var J=I.length-1;J>=0;J--)(O=I[J])&&(q=(V<3?O(q):V>3?O(L,T,q):O(L,T))||q);return V>3&&q&&Object.defineProperty(L,T,q),q},g=this&&this.__param||function(I,L){return function(T,j){L(T,j,I)}};Object.defineProperty(i,"__esModule",{value:!0}),i.InputHandler=i.WindowsOptionsReportType=void 0;const l=a(2584),m=a(7116),v=a(2015),w=a(844),_=a(482),u=a(8437),f=a(8460),p=a(643),h=a(511),y=a(3734),b=a(2585),C=a(1480),E=a(6242),x=a(6351),k=a(5941),M={"(":0,")":1,"*":2,"+":3,"-":1,".":2},D=131072;function R(I,L){if(I>24)return L.setWinLines||!1;switch(I){case 1:return!!L.restoreWin;case 2:return!!L.minimizeWin;case 3:return!!L.setWinPosition;case 4:return!!L.setWinSizePixels;case 5:return!!L.raiseWin;case 6:return!!L.lowerWin;case 7:return!!L.refreshWin;case 8:return!!L.setWinSizeChars;case 9:return!!L.maximizeWin;case 10:return!!L.fullscreenWin;case 11:return!!L.getWinState;case 13:return!!L.getWinPosition;case 14:return!!L.getWinSizePixels;case 15:return!!L.getScreenSizePixels;case 16:return!!L.getCellSizePixels;case 18:return!!L.getWinSizeChars;case 19:return!!L.getScreenSizeChars;case 20:return!!L.getIconTitle;case 21:return!!L.getWinTitle;case 22:return!!L.pushTitle;case 23:return!!L.popTitle;case 24:return!!L.setWinLines}return!1}var N;(function(I){I[I.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",I[I.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(N||(i.WindowsOptionsReportType=N={}));let A=0;class $ extends w.Disposable{getAttrData(){return this._curAttrData}constructor(L,T,j,O,V,q,J,Q,z=new v.EscapeSequenceParser){super(),this._bufferService=L,this._charsetService=T,this._coreService=j,this._logService=O,this._optionsService=V,this._oscLinkService=q,this._coreMouseService=J,this._unicodeService=Q,this._parser=z,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new _.StringToUtf32,this._utf8Decoder=new _.Utf8ToUtf32,this._workCell=new h.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=u.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=u.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new f.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new f.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new f.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new f.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new f.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new f.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new f.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new f.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new f.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new f.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new f.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new f.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new f.EventEmitter),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this.register(this._parser),this._dirtyRowTracker=new F(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate(P=>this._activeBuffer=P.activeBuffer)),this._parser.setCsiHandlerFallback((P,K)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(P),params:K.toArray()})}),this._parser.setEscHandlerFallback(P=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(P)})}),this._parser.setExecuteHandlerFallback(P=>{this._logService.debug("Unknown EXECUTE code: ",{code:P})}),this._parser.setOscHandlerFallback((P,K,U)=>{this._logService.debug("Unknown OSC code: ",{identifier:P,action:K,data:U})}),this._parser.setDcsHandlerFallback((P,K,U)=>{K==="HOOK"&&(U=U.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(P),action:K,payload:U})}),this._parser.setPrintHandler((P,K,U)=>this.print(P,K,U)),this._parser.registerCsiHandler({final:"@"},P=>this.insertChars(P)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},P=>this.scrollLeft(P)),this._parser.registerCsiHandler({final:"A"},P=>this.cursorUp(P)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},P=>this.scrollRight(P)),this._parser.registerCsiHandler({final:"B"},P=>this.cursorDown(P)),this._parser.registerCsiHandler({final:"C"},P=>this.cursorForward(P)),this._parser.registerCsiHandler({final:"D"},P=>this.cursorBackward(P)),this._parser.registerCsiHandler({final:"E"},P=>this.cursorNextLine(P)),this._parser.registerCsiHandler({final:"F"},P=>this.cursorPrecedingLine(P)),this._parser.registerCsiHandler({final:"G"},P=>this.cursorCharAbsolute(P)),this._parser.registerCsiHandler({final:"H"},P=>this.cursorPosition(P)),this._parser.registerCsiHandler({final:"I"},P=>this.cursorForwardTab(P)),this._parser.registerCsiHandler({final:"J"},P=>this.eraseInDisplay(P,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},P=>this.eraseInDisplay(P,!0)),this._parser.registerCsiHandler({final:"K"},P=>this.eraseInLine(P,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},P=>this.eraseInLine(P,!0)),this._parser.registerCsiHandler({final:"L"},P=>this.insertLines(P)),this._parser.registerCsiHandler({final:"M"},P=>this.deleteLines(P)),this._parser.registerCsiHandler({final:"P"},P=>this.deleteChars(P)),this._parser.registerCsiHandler({final:"S"},P=>this.scrollUp(P)),this._parser.registerCsiHandler({final:"T"},P=>this.scrollDown(P)),this._parser.registerCsiHandler({final:"X"},P=>this.eraseChars(P)),this._parser.registerCsiHandler({final:"Z"},P=>this.cursorBackwardTab(P)),this._parser.registerCsiHandler({final:"`"},P=>this.charPosAbsolute(P)),this._parser.registerCsiHandler({final:"a"},P=>this.hPositionRelative(P)),this._parser.registerCsiHandler({final:"b"},P=>this.repeatPrecedingCharacter(P)),this._parser.registerCsiHandler({final:"c"},P=>this.sendDeviceAttributesPrimary(P)),this._parser.registerCsiHandler({prefix:">",final:"c"},P=>this.sendDeviceAttributesSecondary(P)),this._parser.registerCsiHandler({final:"d"},P=>this.linePosAbsolute(P)),this._parser.registerCsiHandler({final:"e"},P=>this.vPositionRelative(P)),this._parser.registerCsiHandler({final:"f"},P=>this.hVPosition(P)),this._parser.registerCsiHandler({final:"g"},P=>this.tabClear(P)),this._parser.registerCsiHandler({final:"h"},P=>this.setMode(P)),this._parser.registerCsiHandler({prefix:"?",final:"h"},P=>this.setModePrivate(P)),this._parser.registerCsiHandler({final:"l"},P=>this.resetMode(P)),this._parser.registerCsiHandler({prefix:"?",final:"l"},P=>this.resetModePrivate(P)),this._parser.registerCsiHandler({final:"m"},P=>this.charAttributes(P)),this._parser.registerCsiHandler({final:"n"},P=>this.deviceStatus(P)),this._parser.registerCsiHandler({prefix:"?",final:"n"},P=>this.deviceStatusPrivate(P)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},P=>this.softReset(P)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},P=>this.setCursorStyle(P)),this._parser.registerCsiHandler({final:"r"},P=>this.setScrollRegion(P)),this._parser.registerCsiHandler({final:"s"},P=>this.saveCursor(P)),this._parser.registerCsiHandler({final:"t"},P=>this.windowOptions(P)),this._parser.registerCsiHandler({final:"u"},P=>this.restoreCursor(P)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},P=>this.insertColumns(P)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},P=>this.deleteColumns(P)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},P=>this.selectProtected(P)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},P=>this.requestMode(P,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},P=>this.requestMode(P,!1)),this._parser.setExecuteHandler(l.C0.BEL,()=>this.bell()),this._parser.setExecuteHandler(l.C0.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(l.C0.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(l.C0.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(l.C0.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(l.C0.BS,()=>this.backspace()),this._parser.setExecuteHandler(l.C0.HT,()=>this.tab()),this._parser.setExecuteHandler(l.C0.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(l.C0.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(l.C1.IND,()=>this.index()),this._parser.setExecuteHandler(l.C1.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(l.C1.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new E.OscHandler(P=>(this.setTitle(P),this.setIconName(P),!0))),this._parser.registerOscHandler(1,new E.OscHandler(P=>this.setIconName(P))),this._parser.registerOscHandler(2,new E.OscHandler(P=>this.setTitle(P))),this._parser.registerOscHandler(4,new E.OscHandler(P=>this.setOrReportIndexedColor(P))),this._parser.registerOscHandler(8,new E.OscHandler(P=>this.setHyperlink(P))),this._parser.registerOscHandler(10,new E.OscHandler(P=>this.setOrReportFgColor(P))),this._parser.registerOscHandler(11,new E.OscHandler(P=>this.setOrReportBgColor(P))),this._parser.registerOscHandler(12,new E.OscHandler(P=>this.setOrReportCursorColor(P))),this._parser.registerOscHandler(104,new E.OscHandler(P=>this.restoreIndexedColor(P))),this._parser.registerOscHandler(110,new E.OscHandler(P=>this.restoreFgColor(P))),this._parser.registerOscHandler(111,new E.OscHandler(P=>this.restoreBgColor(P))),this._parser.registerOscHandler(112,new E.OscHandler(P=>this.restoreCursorColor(P))),this._parser.registerEscHandler({final:"7"},()=>this.saveCursor()),this._parser.registerEscHandler({final:"8"},()=>this.restoreCursor()),this._parser.registerEscHandler({final:"D"},()=>this.index()),this._parser.registerEscHandler({final:"E"},()=>this.nextLine()),this._parser.registerEscHandler({final:"H"},()=>this.tabSet()),this._parser.registerEscHandler({final:"M"},()=>this.reverseIndex()),this._parser.registerEscHandler({final:"="},()=>this.keypadApplicationMode()),this._parser.registerEscHandler({final:">"},()=>this.keypadNumericMode()),this._parser.registerEscHandler({final:"c"},()=>this.fullReset()),this._parser.registerEscHandler({final:"n"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"o"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"|"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"}"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"~"},()=>this.setgLevel(1)),this._parser.registerEscHandler({intermediates:"%",final:"@"},()=>this.selectDefaultCharset()),this._parser.registerEscHandler({intermediates:"%",final:"G"},()=>this.selectDefaultCharset());for(const P in m.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:P},()=>this.selectCharset("("+P)),this._parser.registerEscHandler({intermediates:")",final:P},()=>this.selectCharset(")"+P)),this._parser.registerEscHandler({intermediates:"*",final:P},()=>this.selectCharset("*"+P)),this._parser.registerEscHandler({intermediates:"+",final:P},()=>this.selectCharset("+"+P)),this._parser.registerEscHandler({intermediates:"-",final:P},()=>this.selectCharset("-"+P)),this._parser.registerEscHandler({intermediates:".",final:P},()=>this.selectCharset("."+P)),this._parser.registerEscHandler({intermediates:"/",final:P},()=>this.selectCharset("/"+P));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(P=>(this._logService.error("Parsing error: ",P),P)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new x.DcsHandler((P,K)=>this.requestStatusString(P,K)))}_preserveStack(L,T,j,O){this._parseStack.paused=!0,this._parseStack.cursorStartX=L,this._parseStack.cursorStartY=T,this._parseStack.decodedLength=j,this._parseStack.position=O}_logSlowResolvingAsync(L){this._logService.logLevel<=b.LogLevelEnum.WARN&&Promise.race([L,new Promise((T,j)=>setTimeout(()=>j("#SLOW_TIMEOUT"),5e3))]).catch(T=>{if(T!=="#SLOW_TIMEOUT")throw T;console.warn("async parser handler taking longer than 5000 ms")})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(L,T){let j,O=this._activeBuffer.x,V=this._activeBuffer.y,q=0;const J=this._parseStack.paused;if(J){if(j=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,T))return this._logSlowResolvingAsync(j),j;O=this._parseStack.cursorStartX,V=this._parseStack.cursorStartY,this._parseStack.paused=!1,L.length>D&&(q=this._parseStack.position+D)}if(this._logService.logLevel<=b.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof L=="string"?` "${L}"`:` "${Array.prototype.map.call(L,P=>String.fromCharCode(P)).join("")}"`),typeof L=="string"?L.split("").map(P=>P.charCodeAt(0)):L),this._parseBuffer.length<L.length&&this._parseBuffer.length<D&&(this._parseBuffer=new Uint32Array(Math.min(L.length,D))),J||this._dirtyRowTracker.clearRange(),L.length>D)for(let P=q;P<L.length;P+=D){const K=P+D<L.length?P+D:L.length,U=typeof L=="string"?this._stringDecoder.decode(L.substring(P,K),this._parseBuffer):this._utf8Decoder.decode(L.subarray(P,K),this._parseBuffer);if(j=this._parser.parse(this._parseBuffer,U))return this._preserveStack(O,V,U,P),this._logSlowResolvingAsync(j),j}else if(!J){const P=typeof L=="string"?this._stringDecoder.decode(L,this._parseBuffer):this._utf8Decoder.decode(L,this._parseBuffer);if(j=this._parser.parse(this._parseBuffer,P))return this._preserveStack(O,V,P,0),this._logSlowResolvingAsync(j),j}this._activeBuffer.x===O&&this._activeBuffer.y===V||this._onCursorMove.fire();const Q=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),z=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);z<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(z,this._bufferService.rows-1),Math.min(Q,this._bufferService.rows-1))}print(L,T,j){let O,V;const q=this._charsetService.charset,J=this._optionsService.rawOptions.screenReaderMode,Q=this._bufferService.cols,z=this._coreService.decPrivateModes.wraparound,P=this._coreService.modes.insertMode,K=this._curAttrData;let U=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&j-T>0&&U.getWidth(this._activeBuffer.x-1)===2&&U.setCellFromCodepoint(this._activeBuffer.x-1,0,1,K);let Z=this._parser.precedingJoinState;for(let Y=T;Y<j;++Y){if(O=L[Y],O<127&&q){const fe=q[String.fromCharCode(O)];fe&&(O=fe.charCodeAt(0))}const ne=this._unicodeService.charProperties(O,Z);V=C.UnicodeService.extractWidth(ne);const ie=C.UnicodeService.extractShouldJoin(ne),ce=ie?C.UnicodeService.extractWidth(Z):0;if(Z=ne,J&&this._onA11yChar.fire((0,_.stringFromCodePoint)(O)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+V-ce>Q){if(z){const fe=U;let ae=this._activeBuffer.x-ce;for(this._activeBuffer.x=ce,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),U=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),ce>0&&U instanceof u.BufferLine&&U.copyCellsFrom(fe,ae,0,ce,!1);ae<Q;)fe.setCellFromCodepoint(ae++,0,1,K)}else if(this._activeBuffer.x=Q-1,V===2)continue}if(ie&&this._activeBuffer.x){const fe=U.getWidth(this._activeBuffer.x-1)?1:2;U.addCodepointToCell(this._activeBuffer.x-fe,O,V);for(let ae=V-ce;--ae>=0;)U.setCellFromCodepoint(this._activeBuffer.x++,0,0,K)}else if(P&&(U.insertCells(this._activeBuffer.x,V-ce,this._activeBuffer.getNullCell(K)),U.getWidth(Q-1)===2&&U.setCellFromCodepoint(Q-1,p.NULL_CELL_CODE,p.NULL_CELL_WIDTH,K)),U.setCellFromCodepoint(this._activeBuffer.x++,O,V,K),V>0)for(;--V;)U.setCellFromCodepoint(this._activeBuffer.x++,0,0,K)}this._parser.precedingJoinState=Z,this._activeBuffer.x<Q&&j-T>0&&U.getWidth(this._activeBuffer.x)===0&&!U.hasContent(this._activeBuffer.x)&&U.setCellFromCodepoint(this._activeBuffer.x,0,1,K),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(L,T){return L.final!=="t"||L.prefix||L.intermediates?this._parser.registerCsiHandler(L,T):this._parser.registerCsiHandler(L,j=>!R(j.params[0],this._optionsService.rawOptions.windowOptions)||T(j))}registerDcsHandler(L,T){return this._parser.registerDcsHandler(L,new x.DcsHandler(T))}registerEscHandler(L,T){return this._parser.registerEscHandler(L,T)}registerOscHandler(L,T){return this._parser.registerOscHandler(L,new E.OscHandler(T))}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 L;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&&((L=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&L.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const T=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);T.hasWidth(this._activeBuffer.x)&&!T.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const L=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-L),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(L=this._bufferService.cols-1){this._activeBuffer.x=Math.min(L,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(L,T){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=L,this._activeBuffer.y=this._activeBuffer.scrollTop+T):(this._activeBuffer.x=L,this._activeBuffer.y=T),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(L,T){this._restrictCursor(),this._setCursor(this._activeBuffer.x+L,this._activeBuffer.y+T)}cursorUp(L){const T=this._activeBuffer.y-this._activeBuffer.scrollTop;return T>=0?this._moveCursor(0,-Math.min(T,L.params[0]||1)):this._moveCursor(0,-(L.params[0]||1)),!0}cursorDown(L){const T=this._activeBuffer.scrollBottom-this._activeBuffer.y;return T>=0?this._moveCursor(0,Math.min(T,L.params[0]||1)):this._moveCursor(0,L.params[0]||1),!0}cursorForward(L){return this._moveCursor(L.params[0]||1,0),!0}cursorBackward(L){return this._moveCursor(-(L.params[0]||1),0),!0}cursorNextLine(L){return this.cursorDown(L),this._activeBuffer.x=0,!0}cursorPrecedingLine(L){return this.cursorUp(L),this._activeBuffer.x=0,!0}cursorCharAbsolute(L){return this._setCursor((L.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(L){return this._setCursor(L.length>=2?(L.params[1]||1)-1:0,(L.params[0]||1)-1),!0}charPosAbsolute(L){return this._setCursor((L.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(L){return this._moveCursor(L.params[0]||1,0),!0}linePosAbsolute(L){return this._setCursor(this._activeBuffer.x,(L.params[0]||1)-1),!0}vPositionRelative(L){return this._moveCursor(0,L.params[0]||1),!0}hVPosition(L){return this.cursorPosition(L),!0}tabClear(L){const T=L.params[0];return T===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:T===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(L){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let T=L.params[0]||1;for(;T--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(L){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let T=L.params[0]||1;for(;T--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(L){const T=L.params[0];return T===1&&(this._curAttrData.bg|=536870912),T!==2&&T!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(L,T,j,O=!1,V=!1){const q=this._activeBuffer.lines.get(this._activeBuffer.ybase+L);q.replaceCells(T,j,this._activeBuffer.getNullCell(this._eraseAttrData()),V),O&&(q.isWrapped=!1)}_resetBufferLine(L,T=!1){const j=this._activeBuffer.lines.get(this._activeBuffer.ybase+L);j&&(j.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),T),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+L),j.isWrapped=!1)}eraseInDisplay(L,T=!1){let j;switch(this._restrictCursor(this._bufferService.cols),L.params[0]){case 0:for(j=this._activeBuffer.y,this._dirtyRowTracker.markDirty(j),this._eraseInBufferLine(j++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,T);j<this._bufferService.rows;j++)this._resetBufferLine(j,T);this._dirtyRowTracker.markDirty(j);break;case 1:for(j=this._activeBuffer.y,this._dirtyRowTracker.markDirty(j),this._eraseInBufferLine(j,0,this._activeBuffer.x+1,!0,T),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(j+1).isWrapped=!1);j--;)this._resetBufferLine(j,T);this._dirtyRowTracker.markDirty(0);break;case 2:for(j=this._bufferService.rows,this._dirtyRowTracker.markDirty(j-1);j--;)this._resetBufferLine(j,T);this._dirtyRowTracker.markDirty(0);break;case 3:const O=this._activeBuffer.lines.length-this._bufferService.rows;O>0&&(this._activeBuffer.lines.trimStart(O),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-O,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-O,0),this._onScroll.fire(0))}return!0}eraseInLine(L,T=!1){switch(this._restrictCursor(this._bufferService.cols),L.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,T);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,T);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,T)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(L){this._restrictCursor();let T=L.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const j=this._activeBuffer.ybase+this._activeBuffer.y,O=this._bufferService.rows-1-this._activeBuffer.scrollBottom,V=this._bufferService.rows-1+this._activeBuffer.ybase-O+1;for(;T--;)this._activeBuffer.lines.splice(V-1,1),this._activeBuffer.lines.splice(j,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(L){this._restrictCursor();let T=L.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const j=this._activeBuffer.ybase+this._activeBuffer.y;let O;for(O=this._bufferService.rows-1-this._activeBuffer.scrollBottom,O=this._bufferService.rows-1+this._activeBuffer.ybase-O;T--;)this._activeBuffer.lines.splice(j,1),this._activeBuffer.lines.splice(O,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(L){this._restrictCursor();const T=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return T&&(T.insertCells(this._activeBuffer.x,L.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(L){this._restrictCursor();const T=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return T&&(T.deleteCells(this._activeBuffer.x,L.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(L){let T=L.params[0]||1;for(;T--;)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(L){let T=L.params[0]||1;for(;T--;)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(u.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(L){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const T=L.params[0]||1;for(let j=this._activeBuffer.scrollTop;j<=this._activeBuffer.scrollBottom;++j){const O=this._activeBuffer.lines.get(this._activeBuffer.ybase+j);O.deleteCells(0,T,this._activeBuffer.getNullCell(this._eraseAttrData())),O.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(L){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const T=L.params[0]||1;for(let j=this._activeBuffer.scrollTop;j<=this._activeBuffer.scrollBottom;++j){const O=this._activeBuffer.lines.get(this._activeBuffer.ybase+j);O.insertCells(0,T,this._activeBuffer.getNullCell(this._eraseAttrData())),O.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(L){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const T=L.params[0]||1;for(let j=this._activeBuffer.scrollTop;j<=this._activeBuffer.scrollBottom;++j){const O=this._activeBuffer.lines.get(this._activeBuffer.ybase+j);O.insertCells(this._activeBuffer.x,T,this._activeBuffer.getNullCell(this._eraseAttrData())),O.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(L){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const T=L.params[0]||1;for(let j=this._activeBuffer.scrollTop;j<=this._activeBuffer.scrollBottom;++j){const O=this._activeBuffer.lines.get(this._activeBuffer.ybase+j);O.deleteCells(this._activeBuffer.x,T,this._activeBuffer.getNullCell(this._eraseAttrData())),O.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(L){this._restrictCursor();const T=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return T&&(T.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(L.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(L){const T=this._parser.precedingJoinState;if(!T)return!0;const j=L.params[0]||1,O=C.UnicodeService.extractWidth(T),V=this._activeBuffer.x-O,q=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(V),J=new Uint32Array(q.length*j);let Q=0;for(let P=0;P<q.length;){const K=q.codePointAt(P)||0;J[Q++]=K,P+=K>65535?2:1}let z=Q;for(let P=1;P<j;++P)J.copyWithin(z,0,Q),z+=Q;return this.print(J,0,z),!0}sendDeviceAttributesPrimary(L){return L.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(l.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(l.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(L){return L.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(l.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(l.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(L.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(l.C0.ESC+"[>83;40003;0c")),!0}_is(L){return(this._optionsService.rawOptions.termName+"").indexOf(L)===0}setMode(L){for(let T=0;T<L.length;T++)switch(L.params[T]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(L){for(let T=0;T<L.length;T++)switch(L.params[T]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,m.DEFAULT_CHARSET),this._charsetService.setgCharset(1,m.DEFAULT_CHARSET),this._charsetService.setgCharset(2,m.DEFAULT_CHARSET),this._charsetService.setgCharset(3,m.DEFAULT_CHARSET);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0}return!0}resetMode(L){for(let T=0;T<L.length;T++)switch(L.params[T]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(L){for(let T=0;T<L.length;T++)switch(L.params[T]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),L.params[T]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1}return!0}requestMode(L,T){const j=this._coreService.decPrivateModes,{activeProtocol:O,activeEncoding:V}=this._coreMouseService,q=this._coreService,{buffers:J,cols:Q}=this._bufferService,{active:z,alt:P}=J,K=this._optionsService.rawOptions,U=ie=>ie?1:2,Z=L.params[0];return Y=Z,ne=T?Z===2?4:Z===4?U(q.modes.insertMode):Z===12?3:Z===20?U(K.convertEol):0:Z===1?U(j.applicationCursorKeys):Z===3?K.windowOptions.setWinLines?Q===80?2:Q===132?1:0:0:Z===6?U(j.origin):Z===7?U(j.wraparound):Z===8?3:Z===9?U(O==="X10"):Z===12?U(K.cursorBlink):Z===25?U(!q.isCursorHidden):Z===45?U(j.reverseWraparound):Z===66?U(j.applicationKeypad):Z===67?4:Z===1e3?U(O==="VT200"):Z===1002?U(O==="DRAG"):Z===1003?U(O==="ANY"):Z===1004?U(j.sendFocus):Z===1005?4:Z===1006?U(V==="SGR"):Z===1015?4:Z===1016?U(V==="SGR_PIXELS"):Z===1048?1:Z===47||Z===1047||Z===1049?U(z===P):Z===2004?U(j.bracketedPasteMode):0,q.triggerDataEvent(`${l.C0.ESC}[${T?"":"?"}${Y};${ne}$y`),!0;var Y,ne}_updateAttrColor(L,T,j,O,V){return T===2?(L|=50331648,L&=-16777216,L|=y.AttributeData.fromColorRGB([j,O,V])):T===5&&(L&=-50331904,L|=33554432|255&j),L}_extractColor(L,T,j){const O=[0,0,-1,0,0,0];let V=0,q=0;do{if(O[q+V]=L.params[T+q],L.hasSubParams(T+q)){const J=L.getSubParams(T+q);let Q=0;do O[1]===5&&(V=1),O[q+Q+1+V]=J[Q];while(++Q<J.length&&Q+q+1+V<O.length);break}if(O[1]===5&&q+V>=2||O[1]===2&&q+V>=5)break;O[1]&&(V=1)}while(++q+T<L.length&&q+V<O.length);for(let J=2;J<O.length;++J)O[J]===-1&&(O[J]=0);switch(O[0]){case 38:j.fg=this._updateAttrColor(j.fg,O[1],O[3],O[4],O[5]);break;case 48:j.bg=this._updateAttrColor(j.bg,O[1],O[3],O[4],O[5]);break;case 58:j.extended=j.extended.clone(),j.extended.underlineColor=this._updateAttrColor(j.extended.underlineColor,O[1],O[3],O[4],O[5])}return q}_processUnderline(L,T){T.extended=T.extended.clone(),(!~L||L>5)&&(L=1),T.extended.underlineStyle=L,T.fg|=268435456,L===0&&(T.fg&=-268435457),T.updateExtended()}_processSGR0(L){L.fg=u.DEFAULT_ATTR_DATA.fg,L.bg=u.DEFAULT_ATTR_DATA.bg,L.extended=L.extended.clone(),L.extended.underlineStyle=0,L.extended.underlineColor&=-67108864,L.updateExtended()}charAttributes(L){if(L.length===1&&L.params[0]===0)return this._processSGR0(this._curAttrData),!0;const T=L.length;let j;const O=this._curAttrData;for(let V=0;V<T;V++)j=L.params[V],j>=30&&j<=37?(O.fg&=-50331904,O.fg|=16777216|j-30):j>=40&&j<=47?(O.bg&=-50331904,O.bg|=16777216|j-40):j>=90&&j<=97?(O.fg&=-50331904,O.fg|=16777224|j-90):j>=100&&j<=107?(O.bg&=-50331904,O.bg|=16777224|j-100):j===0?this._processSGR0(O):j===1?O.fg|=134217728:j===3?O.bg|=67108864:j===4?(O.fg|=268435456,this._processUnderline(L.hasSubParams(V)?L.getSubParams(V)[0]:1,O)):j===5?O.fg|=536870912:j===7?O.fg|=67108864:j===8?O.fg|=1073741824:j===9?O.fg|=2147483648:j===2?O.bg|=134217728:j===21?this._processUnderline(2,O):j===22?(O.fg&=-134217729,O.bg&=-134217729):j===23?O.bg&=-67108865:j===24?(O.fg&=-268435457,this._processUnderline(0,O)):j===25?O.fg&=-536870913:j===27?O.fg&=-67108865:j===28?O.fg&=-1073741825:j===29?O.fg&=2147483647:j===39?(O.fg&=-67108864,O.fg|=16777215&u.DEFAULT_ATTR_DATA.fg):j===49?(O.bg&=-67108864,O.bg|=16777215&u.DEFAULT_ATTR_DATA.bg):j===38||j===48||j===58?V+=this._extractColor(L,V,O):j===53?O.bg|=1073741824:j===55?O.bg&=-1073741825:j===59?(O.extended=O.extended.clone(),O.extended.underlineColor=-1,O.updateExtended()):j===100?(O.fg&=-67108864,O.fg|=16777215&u.DEFAULT_ATTR_DATA.fg,O.bg&=-67108864,O.bg|=16777215&u.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",j);return!0}deviceStatus(L){switch(L.params[0]){case 5:this._coreService.triggerDataEvent(`${l.C0.ESC}[0n`);break;case 6:const T=this._activeBuffer.y+1,j=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${l.C0.ESC}[${T};${j}R`)}return!0}deviceStatusPrivate(L){if(L.params[0]===6){const T=this._activeBuffer.y+1,j=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${l.C0.ESC}[?${T};${j}R`)}return!0}softReset(L){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=u.DEFAULT_ATTR_DATA.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(L){const T=L.params[0]||1;switch(T){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}const j=T%2==1;return this._optionsService.options.cursorBlink=j,!0}setScrollRegion(L){const T=L.params[0]||1;let j;return(L.length<2||(j=L.params[1])>this._bufferService.rows||j===0)&&(j=this._bufferService.rows),j>T&&(this._activeBuffer.scrollTop=T-1,this._activeBuffer.scrollBottom=j-1,this._setCursor(0,0)),!0}windowOptions(L){if(!R(L.params[0],this._optionsService.rawOptions.windowOptions))return!0;const T=L.length>1?L.params[1]:0;switch(L.params[0]){case 14:T!==2&&this._onRequestWindowsOptionsReport.fire(N.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(N.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${l.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:T!==0&&T!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),T!==0&&T!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:T!==0&&T!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),T!==0&&T!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(L){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(L){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(L){return this._windowTitle=L,this._onTitleChange.fire(L),!0}setIconName(L){return this._iconName=L,!0}setOrReportIndexedColor(L){const T=[],j=L.split(";");for(;j.length>1;){const O=j.shift(),V=j.shift();if(/^\d+$/.exec(O)){const q=parseInt(O);if(H(q))if(V==="?")T.push({type:0,index:q});else{const J=(0,k.parseColor)(V);J&&T.push({type:1,index:q,color:J})}}}return T.length&&this._onColor.fire(T),!0}setHyperlink(L){const T=L.split(";");return!(T.length<2)&&(T[1]?this._createHyperlink(T[0],T[1]):!T[0]&&this._finishHyperlink())}_createHyperlink(L,T){this._getCurrentLinkId()&&this._finishHyperlink();const j=L.split(":");let O;const V=j.findIndex(q=>q.startsWith("id="));return V!==-1&&(O=j[V].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:O,uri:T}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(L,T){const j=L.split(";");for(let O=0;O<j.length&&!(T>=this._specialColors.length);++O,++T)if(j[O]==="?")this._onColor.fire([{type:0,index:this._specialColors[T]}]);else{const V=(0,k.parseColor)(j[O]);V&&this._onColor.fire([{type:1,index:this._specialColors[T],color:V}])}return!0}setOrReportFgColor(L){return this._setOrReportSpecialColor(L,0)}setOrReportBgColor(L){return this._setOrReportSpecialColor(L,1)}setOrReportCursorColor(L){return this._setOrReportSpecialColor(L,2)}restoreIndexedColor(L){if(!L)return this._onColor.fire([{type:2}]),!0;const T=[],j=L.split(";");for(let O=0;O<j.length;++O)if(/^\d+$/.exec(j[O])){const V=parseInt(j[O]);H(V)&&T.push({type:2,index:V})}return T.length&&this._onColor.fire(T),!0}restoreFgColor(L){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(L){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(L){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,m.DEFAULT_CHARSET),!0}selectCharset(L){return L.length!==2?(this.selectDefaultCharset(),!0):(L[0]==="/"||this._charsetService.setgCharset(M[L[0]],m.CHARSETS[L[1]]||m.DEFAULT_CHARSET),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){const L=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,L,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=u.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=u.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(L){return this._charsetService.setgLevel(L),!0}screenAlignmentPattern(){const L=new h.CellData;L.content=4194373,L.fg=this._curAttrData.fg,L.bg=this._curAttrData.bg,this._setCursor(0,0);for(let T=0;T<this._bufferService.rows;++T){const j=this._activeBuffer.ybase+this._activeBuffer.y+T,O=this._activeBuffer.lines.get(j);O&&(O.fill(L),O.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(L,T){const j=this._bufferService.buffer,O=this._optionsService.rawOptions;return(V=>(this._coreService.triggerDataEvent(`${l.C0.ESC}${V}${l.C0.ESC}\\`),!0))(L==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:L==='"p'?'P1$r61;1"p':L==="r"?`P1$r${j.scrollTop+1};${j.scrollBottom+1}r`:L==="m"?"P1$r0m":L===" q"?`P1$r${{block:2,underline:4,bar:6}[O.cursorStyle]-(O.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(L,T){this._dirtyRowTracker.markRangeDirty(L,T)}}i.InputHandler=$;let F=class{constructor(I){this._bufferService=I,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(I){I<this.start?this.start=I:I>this.end&&(this.end=I)}markRangeDirty(I,L){I>L&&(A=I,I=L,L=A),I<this.start&&(this.start=I),L>this.end&&(this.end=L)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function H(I){return 0<=I&&I<256}F=d([g(0,b.IBufferService)],F)},844:(c,i)=>{function a(d){for(const g of d)g.dispose();d.length=0}Object.defineProperty(i,"__esModule",{value:!0}),i.getDisposeArrayDisposable=i.disposeArray=i.toDisposable=i.MutableDisposable=i.Disposable=void 0,i.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const d of this._disposables)d.dispose();this._disposables.length=0}register(d){return this._disposables.push(d),d}unregister(d){const g=this._disposables.indexOf(d);g!==-1&&this._disposables.splice(g,1)}},i.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(d){var g;this._isDisposed||d===this._value||((g=this._value)==null||g.dispose(),this._value=d)}clear(){this.value=void 0}dispose(){var d;this._isDisposed=!0,(d=this._value)==null||d.dispose(),this._value=void 0}},i.toDisposable=function(d){return{dispose:d}},i.disposeArray=a,i.getDisposeArrayDisposable=function(d){return{dispose:()=>a(d)}}},1505:(c,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.FourKeyMap=i.TwoKeyMap=void 0;class a{constructor(){this._data={}}set(g,l,m){this._data[g]||(this._data[g]={}),this._data[g][l]=m}get(g,l){return this._data[g]?this._data[g][l]:void 0}clear(){this._data={}}}i.TwoKeyMap=a,i.FourKeyMap=class{constructor(){this._data=new a}set(d,g,l,m,v){this._data.get(d,g)||this._data.set(d,g,new a),this._data.get(d,g).set(l,m,v)}get(d,g,l,m){var v;return(v=this._data.get(d,g))==null?void 0:v.get(l,m)}clear(){this._data.clear()}}},6114:(c,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.isChromeOS=i.isLinux=i.isWindows=i.isIphone=i.isIpad=i.isMac=i.getSafariVersion=i.isSafari=i.isLegacyEdge=i.isFirefox=i.isNode=void 0,i.isNode=typeof process<"u"&&"title"in process;const a=i.isNode?"node":navigator.userAgent,d=i.isNode?"node":navigator.platform;i.isFirefox=a.includes("Firefox"),i.isLegacyEdge=a.includes("Edge"),i.isSafari=/^((?!chrome|android).)*safari/i.test(a),i.getSafariVersion=function(){if(!i.isSafari)return 0;const g=a.match(/Version\/(\d+)/);return g===null||g.length<2?0:parseInt(g[1])},i.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(d),i.isIpad=d==="iPad",i.isIphone=d==="iPhone",i.isWindows=["Windows","Win16","Win32","WinCE"].includes(d),i.isLinux=d.indexOf("Linux")>=0,i.isChromeOS=/\bCrOS\b/.test(a)},6106:(c,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.SortedList=void 0;let a=0;i.SortedList=class{constructor(d){this._getKey=d,this._array=[]}clear(){this._array.length=0}insert(d){this._array.length!==0?(a=this._search(this._getKey(d)),this._array.splice(a,0,d)):this._array.push(d)}delete(d){if(this._array.length===0)return!1;const g=this._getKey(d);if(g===void 0||(a=this._search(g),a===-1)||this._getKey(this._array[a])!==g)return!1;do if(this._array[a]===d)return this._array.splice(a,1),!0;while(++a<this._array.length&&this._getKey(this._array[a])===g);return!1}*getKeyIterator(d){if(this._array.length!==0&&(a=this._search(d),!(a<0||a>=this._array.length)&&this._getKey(this._array[a])===d))do yield this._array[a];while(++a<this._array.length&&this._getKey(this._array[a])===d)}forEachByKey(d,g){if(this._array.length!==0&&(a=this._search(d),!(a<0||a>=this._array.length)&&this._getKey(this._array[a])===d))do g(this._array[a]);while(++a<this._array.length&&this._getKey(this._array[a])===d)}values(){return[...this._array].values()}_search(d){let g=0,l=this._array.length-1;for(;l>=g;){let m=g+l>>1;const v=this._getKey(this._array[m]);if(v>d)l=m-1;else{if(!(v<d)){for(;m>0&&this._getKey(this._array[m-1])===d;)m--;return m}g=m+1}}return g}}},7226:(c,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.DebouncedIdleTask=i.IdleTaskQueue=i.PriorityTaskQueue=void 0;const d=a(6114);class g{constructor(){this._tasks=[],this._i=0}enqueue(v){this._tasks.push(v),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(v){this._idleCallback=void 0;let w=0,_=0,u=v.timeRemaining(),f=0;for(;this._i<this._tasks.length;){if(w=Date.now(),this._tasks[this._i]()||this._i++,w=Math.max(1,Date.now()-w),_=Math.max(w,_),f=v.timeRemaining(),1.5*_>f)return u-w<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(u-w))}ms`),void this._start();u=f}this.clear()}}class l extends g{_requestCallback(v){return setTimeout(()=>v(this._createDeadline(16)))}_cancelCallback(v){clearTimeout(v)}_createDeadline(v){const w=Date.now()+v;return{timeRemaining:()=>Math.max(0,w-Date.now())}}}i.PriorityTaskQueue=l,i.IdleTaskQueue=!d.isNode&&"requestIdleCallback"in window?class extends g{_requestCallback(m){return requestIdleCallback(m)}_cancelCallback(m){cancelIdleCallback(m)}}:l,i.DebouncedIdleTask=class{constructor(){this._queue=new i.IdleTaskQueue}set(m){this._queue.clear(),this._queue.enqueue(m)}flush(){this._queue.flush()}}},9282:(c,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.updateWindowsModeWrappedState=void 0;const d=a(643);i.updateWindowsModeWrappedState=function(g){const l=g.buffer.lines.get(g.buffer.ybase+g.buffer.y-1),m=l==null?void 0:l.get(g.cols-1),v=g.buffer.lines.get(g.buffer.ybase+g.buffer.y);v&&m&&(v.isWrapped=m[d.CHAR_DATA_CODE_INDEX]!==d.NULL_CELL_CODE&&m[d.CHAR_DATA_CODE_INDEX]!==d.WHITESPACE_CELL_CODE)}},3734:(c,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.ExtendedAttrs=i.AttributeData=void 0;class a{constructor(){this.fg=0,this.bg=0,this.extended=new d}static toColorRGB(l){return[l>>>16&255,l>>>8&255,255&l]}static fromColorRGB(l){return(255&l[0])<<16|(255&l[1])<<8|255&l[2]}clone(){const l=new a;return l.fg=this.fg,l.bg=this.bg,l.extended=this.extended.clone(),l}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}i.AttributeData=a;class d{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(l){this._ext=l}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(l){this._ext&=-469762049,this._ext|=l<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(l){this._ext&=-67108864,this._ext|=67108863&l}get urlId(){return this._urlId}set urlId(l){this._urlId=l}get underlineVariantOffset(){const l=(3758096384&this._ext)>>29;return l<0?4294967288^l:l}set underlineVariantOffset(l){this._ext&=536870911,this._ext|=l<<29&3758096384}constructor(l=0,m=0){this._ext=0,this._urlId=0,this._ext=l,this._urlId=m}clone(){return new d(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}i.ExtendedAttrs=d},9092:(c,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.Buffer=i.MAX_BUFFER_SIZE=void 0;const d=a(6349),g=a(7226),l=a(3734),m=a(8437),v=a(4634),w=a(511),_=a(643),u=a(4863),f=a(7116);i.MAX_BUFFER_SIZE=4294967295,i.Buffer=class{constructor(p,h,y){this._hasScrollback=p,this._optionsService=h,this._bufferService=y,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=m.DEFAULT_ATTR_DATA.clone(),this.savedCharset=f.DEFAULT_CHARSET,this.markers=[],this._nullCell=w.CellData.fromCharData([0,_.NULL_CELL_CHAR,_.NULL_CELL_WIDTH,_.NULL_CELL_CODE]),this._whitespaceCell=w.CellData.fromCharData([0,_.WHITESPACE_CELL_CHAR,_.WHITESPACE_CELL_WIDTH,_.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new g.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new d.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(p){return p?(this._nullCell.fg=p.fg,this._nullCell.bg=p.bg,this._nullCell.extended=p.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new l.ExtendedAttrs),this._nullCell}getWhitespaceCell(p){return p?(this._whitespaceCell.fg=p.fg,this._whitespaceCell.bg=p.bg,this._whitespaceCell.extended=p.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new l.ExtendedAttrs),this._whitespaceCell}getBlankLine(p,h){return new m.BufferLine(this._bufferService.cols,this.getNullCell(p),h)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const p=this.ybase+this.y-this.ydisp;return p>=0&&p<this._rows}_getCorrectBufferLength(p){if(!this._hasScrollback)return p;const h=p+this._optionsService.rawOptions.scrollback;return h>i.MAX_BUFFER_SIZE?i.MAX_BUFFER_SIZE:h}fillViewportRows(p){if(this.lines.length===0){p===void 0&&(p=m.DEFAULT_ATTR_DATA);let h=this._rows;for(;h--;)this.lines.push(this.getBlankLine(p))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new d.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(p,h){const y=this.getNullCell(m.DEFAULT_ATTR_DATA);let b=0;const C=this._getCorrectBufferLength(h);if(C>this.lines.maxLength&&(this.lines.maxLength=C),this.lines.length>0){if(this._cols<p)for(let x=0;x<this.lines.length;x++)b+=+this.lines.get(x).resize(p,y);let E=0;if(this._rows<h)for(let x=this._rows;x<h;x++)this.lines.length<h+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new m.BufferLine(p,y)):this.ybase>0&&this.lines.length<=this.ybase+this.y+E+1?(this.ybase--,E++,this.ydisp>0&&this.ydisp--):this.lines.push(new m.BufferLine(p,y)));else for(let x=this._rows;x>h;x--)this.lines.length>h+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(C<this.lines.maxLength){const x=this.lines.length-C;x>0&&(this.lines.trimStart(x),this.ybase=Math.max(this.ybase-x,0),this.ydisp=Math.max(this.ydisp-x,0),this.savedY=Math.max(this.savedY-x,0)),this.lines.maxLength=C}this.x=Math.min(this.x,p-1),this.y=Math.min(this.y,h-1),E&&(this.y+=E),this.savedX=Math.min(this.savedX,p-1),this.scrollTop=0}if(this.scrollBottom=h-1,this._isReflowEnabled&&(this._reflow(p,h),this._cols>p))for(let E=0;E<this.lines.length;E++)b+=+this.lines.get(E).resize(p,y);this._cols=p,this._rows=h,this._memoryCleanupQueue.clear(),b>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let p=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,p=!1);let h=0;for(;this._memoryCleanupPosition<this.lines.length;)if(h+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),h>100)return!0;return p}get _isReflowEnabled(){const p=this._optionsService.rawOptions.windowsPty;return p&&p.buildNumber?this._hasScrollback&&p.backend==="conpty"&&p.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(p,h){this._cols!==p&&(p>this._cols?this._reflowLarger(p,h):this._reflowSmaller(p,h))}_reflowLarger(p,h){const y=(0,v.reflowLargerGetLinesToRemove)(this.lines,this._cols,p,this.ybase+this.y,this.getNullCell(m.DEFAULT_ATTR_DATA));if(y.length>0){const b=(0,v.reflowLargerCreateNewLayout)(this.lines,y);(0,v.reflowLargerApplyNewLayout)(this.lines,b.layout),this._reflowLargerAdjustViewport(p,h,b.countRemoved)}}_reflowLargerAdjustViewport(p,h,y){const b=this.getNullCell(m.DEFAULT_ATTR_DATA);let C=y;for(;C-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<h&&this.lines.push(new m.BufferLine(p,b))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-y,0)}_reflowSmaller(p,h){const y=this.getNullCell(m.DEFAULT_ATTR_DATA),b=[];let C=0;for(let E=this.lines.length-1;E>=0;E--){let x=this.lines.get(E);if(!x||!x.isWrapped&&x.getTrimmedLength()<=p)continue;const k=[x];for(;x.isWrapped&&E>0;)x=this.lines.get(--E),k.unshift(x);const M=this.ybase+this.y;if(M>=E&&M<E+k.length)continue;const D=k[k.length-1].getTrimmedLength(),R=(0,v.reflowSmallerGetNewLineLengths)(k,this._cols,p),N=R.length-k.length;let A;A=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+N):Math.max(0,this.lines.length-this.lines.maxLength+N);const $=[];for(let j=0;j<N;j++){const O=this.getBlankLine(m.DEFAULT_ATTR_DATA,!0);$.push(O)}$.length>0&&(b.push({start:E+k.length+C,newLines:$}),C+=$.length),k.push(...$);let F=R.length-1,H=R[F];H===0&&(F--,H=R[F]);let I=k.length-N-1,L=D;for(;I>=0;){const j=Math.min(L,H);if(k[F]===void 0)break;if(k[F].copyCellsFrom(k[I],L-j,H-j,j,!0),H-=j,H===0&&(F--,H=R[F]),L-=j,L===0){I--;const O=Math.max(I,0);L=(0,v.getWrappedLineTrimmedLength)(k,O,this._cols)}}for(let j=0;j<k.length;j++)R[j]<p&&k[j].setCell(R[j],y);let T=N-A;for(;T-- >0;)this.ybase===0?this.y<h-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+C)-h&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+N,this.ybase+h-1)}if(b.length>0){const E=[],x=[];for(let F=0;F<this.lines.length;F++)x.push(this.lines.get(F));const k=this.lines.length;let M=k-1,D=0,R=b[D];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+C);let N=0;for(let F=Math.min(this.lines.maxLength-1,k+C-1);F>=0;F--)if(R&&R.start>M+N){for(let H=R.newLines.length-1;H>=0;H--)this.lines.set(F--,R.newLines[H]);F++,E.push({index:M+1,amount:R.newLines.length}),N+=R.newLines.length,R=b[++D]}else this.lines.set(F,x[M--]);let A=0;for(let F=E.length-1;F>=0;F--)E[F].index+=A,this.lines.onInsertEmitter.fire(E[F]),A+=E[F].amount;const $=Math.max(0,k+C-this.lines.maxLength);$>0&&this.lines.onTrimEmitter.fire($)}}translateBufferLineToString(p,h,y=0,b){const C=this.lines.get(p);return C?C.translateToString(h,y,b):""}getWrappedRangeForLine(p){let h=p,y=p;for(;h>0&&this.lines.get(h).isWrapped;)h--;for(;y+1<this.lines.length&&this.lines.get(y+1).isWrapped;)y++;return{first:h,last:y}}setupTabStops(p){for(p!=null?this.tabs[p]||(p=this.prevStop(p)):(this.tabs={},p=0);p<this._cols;p+=this._optionsService.rawOptions.tabStopWidth)this.tabs[p]=!0}prevStop(p){for(p==null&&(p=this.x);!this.tabs[--p]&&p>0;);return p>=this._cols?this._cols-1:p<0?0:p}nextStop(p){for(p==null&&(p=this.x);!this.tabs[++p]&&p<this._cols;);return p>=this._cols?this._cols-1:p<0?0:p}clearMarkers(p){this._isClearing=!0;for(let h=0;h<this.markers.length;h++)this.markers[h].line===p&&(this.markers[h].dispose(),this.markers.splice(h--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let p=0;p<this.markers.length;p++)this.markers[p].dispose(),this.markers.splice(p--,1);this._isClearing=!1}addMarker(p){const h=new u.Marker(p);return this.markers.push(h),h.register(this.lines.onTrim(y=>{h.line-=y,h.line<0&&h.dispose()})),h.register(this.lines.onInsert(y=>{h.line>=y.index&&(h.line+=y.amount)})),h.register(this.lines.onDelete(y=>{h.line>=y.index&&h.line<y.index+y.amount&&h.dispose(),h.line>y.index&&(h.line-=y.amount)})),h.register(h.onDispose(()=>this._removeMarker(h))),h}_removeMarker(p){this._isClearing||this.markers.splice(this.markers.indexOf(p),1)}}},8437:(c,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.BufferLine=i.DEFAULT_ATTR_DATA=void 0;const d=a(3734),g=a(511),l=a(643),m=a(482);i.DEFAULT_ATTR_DATA=Object.freeze(new d.AttributeData);let v=0;class w{constructor(u,f,p=!1){this.isWrapped=p,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*u);const h=f||g.CellData.fromCharData([0,l.NULL_CELL_CHAR,l.NULL_CELL_WIDTH,l.NULL_CELL_CODE]);for(let y=0;y<u;++y)this.setCell(y,h);this.length=u}get(u){const f=this._data[3*u+0],p=2097151&f;return[this._data[3*u+1],2097152&f?this._combined[u]:p?(0,m.stringFromCodePoint)(p):"",f>>22,2097152&f?this._combined[u].charCodeAt(this._combined[u].length-1):p]}set(u,f){this._data[3*u+1]=f[l.CHAR_DATA_ATTR_INDEX],f[l.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[u]=f[1],this._data[3*u+0]=2097152|u|f[l.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*u+0]=f[l.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|f[l.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(u){return this._data[3*u+0]>>22}hasWidth(u){return 12582912&this._data[3*u+0]}getFg(u){return this._data[3*u+1]}getBg(u){return this._data[3*u+2]}hasContent(u){return 4194303&this._data[3*u+0]}getCodePoint(u){const f=this._data[3*u+0];return 2097152&f?this._combined[u].charCodeAt(this._combined[u].length-1):2097151&f}isCombined(u){return 2097152&this._data[3*u+0]}getString(u){const f=this._data[3*u+0];return 2097152&f?this._combined[u]:2097151&f?(0,m.stringFromCodePoint)(2097151&f):""}isProtected(u){return 536870912&this._data[3*u+2]}loadCell(u,f){return v=3*u,f.content=this._data[v+0],f.fg=this._data[v+1],f.bg=this._data[v+2],2097152&f.content&&(f.combinedData=this._combined[u]),268435456&f.bg&&(f.extended=this._extendedAttrs[u]),f}setCell(u,f){2097152&f.content&&(this._combined[u]=f.combinedData),268435456&f.bg&&(this._extendedAttrs[u]=f.extended),this._data[3*u+0]=f.content,this._data[3*u+1]=f.fg,this._data[3*u+2]=f.bg}setCellFromCodepoint(u,f,p,h){268435456&h.bg&&(this._extendedAttrs[u]=h.extended),this._data[3*u+0]=f|p<<22,this._data[3*u+1]=h.fg,this._data[3*u+2]=h.bg}addCodepointToCell(u,f,p){let h=this._data[3*u+0];2097152&h?this._combined[u]+=(0,m.stringFromCodePoint)(f):2097151&h?(this._combined[u]=(0,m.stringFromCodePoint)(2097151&h)+(0,m.stringFromCodePoint)(f),h&=-2097152,h|=2097152):h=f|4194304,p&&(h&=-12582913,h|=p<<22),this._data[3*u+0]=h}insertCells(u,f,p){if((u%=this.length)&&this.getWidth(u-1)===2&&this.setCellFromCodepoint(u-1,0,1,p),f<this.length-u){const h=new g.CellData;for(let y=this.length-u-f-1;y>=0;--y)this.setCell(u+f+y,this.loadCell(u+y,h));for(let y=0;y<f;++y)this.setCell(u+y,p)}else for(let h=u;h<this.length;++h)this.setCell(h,p);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,p)}deleteCells(u,f,p){if(u%=this.length,f<this.length-u){const h=new g.CellData;for(let y=0;y<this.length-u-f;++y)this.setCell(u+y,this.loadCell(u+f+y,h));for(let y=this.length-f;y<this.length;++y)this.setCell(y,p)}else for(let h=u;h<this.length;++h)this.setCell(h,p);u&&this.getWidth(u-1)===2&&this.setCellFromCodepoint(u-1,0,1,p),this.getWidth(u)!==0||this.hasContent(u)||this.setCellFromCodepoint(u,0,1,p)}replaceCells(u,f,p,h=!1){if(h)for(u&&this.getWidth(u-1)===2&&!this.isProtected(u-1)&&this.setCellFromCodepoint(u-1,0,1,p),f<this.length&&this.getWidth(f-1)===2&&!this.isProtected(f)&&this.setCellFromCodepoint(f,0,1,p);u<f&&u<this.length;)this.isProtected(u)||this.setCell(u,p),u++;else for(u&&this.getWidth(u-1)===2&&this.setCellFromCodepoint(u-1,0,1,p),f<this.length&&this.getWidth(f-1)===2&&this.setCellFromCodepoint(f,0,1,p);u<f&&u<this.length;)this.setCell(u++,p)}resize(u,f){if(u===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const p=3*u;if(u>this.length){if(this._data.buffer.byteLength>=4*p)this._data=new Uint32Array(this._data.buffer,0,p);else{const h=new Uint32Array(p);h.set(this._data),this._data=h}for(let h=this.length;h<u;++h)this.setCell(h,f)}else{this._data=this._data.subarray(0,p);const h=Object.keys(this._combined);for(let b=0;b<h.length;b++){const C=parseInt(h[b],10);C>=u&&delete this._combined[C]}const y=Object.keys(this._extendedAttrs);for(let b=0;b<y.length;b++){const C=parseInt(y[b],10);C>=u&&delete this._extendedAttrs[C]}}return this.length=u,4*p*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const u=new Uint32Array(this._data.length);return u.set(this._data),this._data=u,1}return 0}fill(u,f=!1){if(f)for(let p=0;p<this.length;++p)this.isProtected(p)||this.setCell(p,u);else{this._combined={},this._extendedAttrs={};for(let p=0;p<this.length;++p)this.setCell(p,u)}}copyFrom(u){this.length!==u.length?this._data=new Uint32Array(u._data):this._data.set(u._data),this.length=u.length,this._combined={};for(const f in u._combined)this._combined[f]=u._combined[f];this._extendedAttrs={};for(const f in u._extendedAttrs)this._extendedAttrs[f]=u._extendedAttrs[f];this.isWrapped=u.isWrapped}clone(){const u=new w(0);u._data=new Uint32Array(this._data),u.length=this.length;for(const f in this._combined)u._combined[f]=this._combined[f];for(const f in this._extendedAttrs)u._extendedAttrs[f]=this._extendedAttrs[f];return u.isWrapped=this.isWrapped,u}getTrimmedLength(){for(let u=this.length-1;u>=0;--u)if(4194303&this._data[3*u+0])return u+(this._data[3*u+0]>>22);return 0}getNoBgTrimmedLength(){for(let u=this.length-1;u>=0;--u)if(4194303&this._data[3*u+0]||50331648&this._data[3*u+2])return u+(this._data[3*u+0]>>22);return 0}copyCellsFrom(u,f,p,h,y){const b=u._data;if(y)for(let E=h-1;E>=0;E--){for(let x=0;x<3;x++)this._data[3*(p+E)+x]=b[3*(f+E)+x];268435456&b[3*(f+E)+2]&&(this._extendedAttrs[p+E]=u._extendedAttrs[f+E])}else for(let E=0;E<h;E++){for(let x=0;x<3;x++)this._data[3*(p+E)+x]=b[3*(f+E)+x];268435456&b[3*(f+E)+2]&&(this._extendedAttrs[p+E]=u._extendedAttrs[f+E])}const C=Object.keys(u._combined);for(let E=0;E<C.length;E++){const x=parseInt(C[E],10);x>=f&&(this._combined[x-f+p]=u._combined[x])}}translateToString(u,f,p,h){f=f??0,p=p??this.length,u&&(p=Math.min(p,this.getTrimmedLength())),h&&(h.length=0);let y="";for(;f<p;){const b=this._data[3*f+0],C=2097151&b,E=2097152&b?this._combined[f]:C?(0,m.stringFromCodePoint)(C):l.WHITESPACE_CELL_CHAR;if(y+=E,h)for(let x=0;x<E.length;++x)h.push(f);f+=b>>22||1}return h&&h.push(f),y}}i.BufferLine=w},4841:(c,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.getRangeLength=void 0,i.getRangeLength=function(a,d){if(a.start.y>a.end.y)throw new Error(`Buffer range end (${a.end.x}, ${a.end.y}) cannot be before start (${a.start.x}, ${a.start.y})`);return d*(a.end.y-a.start.y)+(a.end.x-a.start.x+1)}},4634:(c,i)=>{function a(d,g,l){if(g===d.length-1)return d[g].getTrimmedLength();const m=!d[g].hasContent(l-1)&&d[g].getWidth(l-1)===1,v=d[g+1].getWidth(0)===2;return m&&v?l-1:l}Object.defineProperty(i,"__esModule",{value:!0}),i.getWrappedLineTrimmedLength=i.reflowSmallerGetNewLineLengths=i.reflowLargerApplyNewLayout=i.reflowLargerCreateNewLayout=i.reflowLargerGetLinesToRemove=void 0,i.reflowLargerGetLinesToRemove=function(d,g,l,m,v){const w=[];for(let _=0;_<d.length-1;_++){let u=_,f=d.get(++u);if(!f.isWrapped)continue;const p=[d.get(_)];for(;u<d.length&&f.isWrapped;)p.push(f),f=d.get(++u);if(m>=_&&m<u){_+=p.length-1;continue}let h=0,y=a(p,h,g),b=1,C=0;for(;b<p.length;){const x=a(p,b,g),k=x-C,M=l-y,D=Math.min(k,M);p[h].copyCellsFrom(p[b],C,y,D,!1),y+=D,y===l&&(h++,y=0),C+=D,C===x&&(b++,C=0),y===0&&h!==0&&p[h-1].getWidth(l-1)===2&&(p[h].copyCellsFrom(p[h-1],l-1,y++,1,!1),p[h-1].setCell(l-1,v))}p[h].replaceCells(y,l,v);let E=0;for(let x=p.length-1;x>0&&(x>h||p[x].getTrimmedLength()===0);x--)E++;E>0&&(w.push(_+p.length-E),w.push(E)),_+=p.length-1}return w},i.reflowLargerCreateNewLayout=function(d,g){const l=[];let m=0,v=g[m],w=0;for(let _=0;_<d.length;_++)if(v===_){const u=g[++m];d.onDeleteEmitter.fire({index:_-w,amount:u}),_+=u-1,w+=u,v=g[++m]}else l.push(_);return{layout:l,countRemoved:w}},i.reflowLargerApplyNewLayout=function(d,g){const l=[];for(let m=0;m<g.length;m++)l.push(d.get(g[m]));for(let m=0;m<l.length;m++)d.set(m,l[m]);d.length=g.length},i.reflowSmallerGetNewLineLengths=function(d,g,l){const m=[],v=d.map((f,p)=>a(d,p,g)).reduce((f,p)=>f+p);let w=0,_=0,u=0;for(;u<v;){if(v-u<l){m.push(v-u);break}w+=l;const f=a(d,_,g);w>f&&(w-=f,_++);const p=d[_].getWidth(w-1)===2;p&&w--;const h=p?l-1:l;m.push(h),u+=h}return m},i.getWrappedLineTrimmedLength=a},5295:(c,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.BufferSet=void 0;const d=a(8460),g=a(844),l=a(9092);class m extends g.Disposable{constructor(w,_){super(),this._optionsService=w,this._bufferService=_,this._onBufferActivate=this.register(new d.EventEmitter),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this.register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.resize(this._bufferService.cols,this._bufferService.rows))),this.register(this._optionsService.onSpecificOptionChange("tabStopWidth",()=>this.setupTabStops()))}reset(){this._normal=new l.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new l.Buffer(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(w){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(w),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(w,_){this._normal.resize(w,_),this._alt.resize(w,_),this.setupTabStops(w)}setupTabStops(w){this._normal.setupTabStops(w),this._alt.setupTabStops(w)}}i.BufferSet=m},511:(c,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.CellData=void 0;const d=a(482),g=a(643),l=a(3734);class m extends l.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new l.ExtendedAttrs,this.combinedData=""}static fromCharData(w){const _=new m;return _.setFromCharData(w),_}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,d.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(w){this.fg=w[g.CHAR_DATA_ATTR_INDEX],this.bg=0;let _=!1;if(w[g.CHAR_DATA_CHAR_INDEX].length>2)_=!0;else if(w[g.CHAR_DATA_CHAR_INDEX].length===2){const u=w[g.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=u&&u<=56319){const f=w[g.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=f&&f<=57343?this.content=1024*(u-55296)+f-56320+65536|w[g.CHAR_DATA_WIDTH_INDEX]<<22:_=!0}else _=!0}else this.content=w[g.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|w[g.CHAR_DATA_WIDTH_INDEX]<<22;_&&(this.combinedData=w[g.CHAR_DATA_CHAR_INDEX],this.content=2097152|w[g.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}i.CellData=m},643:(c,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.WHITESPACE_CELL_CODE=i.WHITESPACE_CELL_WIDTH=i.WHITESPACE_CELL_CHAR=i.NULL_CELL_CODE=i.NULL_CELL_WIDTH=i.NULL_CELL_CHAR=i.CHAR_DATA_CODE_INDEX=i.CHAR_DATA_WIDTH_INDEX=i.CHAR_DATA_CHAR_INDEX=i.CHAR_DATA_ATTR_INDEX=i.DEFAULT_EXT=i.DEFAULT_ATTR=i.DEFAULT_COLOR=void 0,i.DEFAULT_COLOR=0,i.DEFAULT_ATTR=256|i.DEFAULT_COLOR<<9,i.DEFAULT_EXT=0,i.CHAR_DATA_ATTR_INDEX=0,i.CHAR_DATA_CHAR_INDEX=1,i.CHAR_DATA_WIDTH_INDEX=2,i.CHAR_DATA_CODE_INDEX=3,i.NULL_CELL_CHAR="",i.NULL_CELL_WIDTH=1,i.NULL_CELL_CODE=0,i.WHITESPACE_CELL_CHAR=" ",i.WHITESPACE_CELL_WIDTH=1,i.WHITESPACE_CELL_CODE=32},4863:(c,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.Marker=void 0;const d=a(8460),g=a(844);class l{get id(){return this._id}constructor(v){this.line=v,this.isDisposed=!1,this._disposables=[],this._id=l._nextId++,this._onDispose=this.register(new d.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,g.disposeArray)(this._disposables),this._disposables.length=0)}register(v){return this._disposables.push(v),v}}i.Marker=l,l._nextId=1},7116:(c,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.DEFAULT_CHARSET=i.CHARSETS=void 0,i.CHARSETS={},i.DEFAULT_CHARSET=i.CHARSETS.B,i.CHARSETS[0]={"`":"◆",a:"▒",b:"␉",c:"␌",d:"␍",e:"␊",f:"°",g:"±",h:"␤",i:"␋",j:"┘",k:"┐",l:"┌",m:"└",n:"┼",o:"⎺",p:"⎻",q:"─",r:"⎼",s:"⎽",t:"├",u:"┤",v:"┴",w:"┬",x:"│",y:"≤",z:"≥","{":"π","|":"≠","}":"£","~":"·"},i.CHARSETS.A={"#":"£"},i.CHARSETS.B=void 0,i.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},i.CHARSETS.C=i.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},i.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},i.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},i.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},i.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},i.CHARSETS.E=i.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},i.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},i.CHARSETS.H=i.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},i.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(c,i)=>{var a,d,g;Object.defineProperty(i,"__esModule",{value:!0}),i.C1_ESCAPED=i.C1=i.C0=void 0,function(l){l.NUL="\0",l.SOH="",l.STX="",l.ETX="",l.EOT="",l.ENQ="",l.ACK="",l.BEL="\x07",l.BS="\b",l.HT=" ",l.LF=`
79
- `,l.VT="\v",l.FF="\f",l.CR="\r",l.SO="",l.SI="",l.DLE="",l.DC1="",l.DC2="",l.DC3="",l.DC4="",l.NAK="",l.SYN="",l.ETB="",l.CAN="",l.EM="",l.SUB="",l.ESC="\x1B",l.FS="",l.GS="",l.RS="",l.US="",l.SP=" ",l.DEL=""}(a||(i.C0=a={})),function(l){l.PAD="€",l.HOP="",l.BPH="‚",l.NBH="ƒ",l.IND="„",l.NEL="…",l.SSA="†",l.ESA="‡",l.HTS="ˆ",l.HTJ="‰",l.VTS="Š",l.PLD="‹",l.PLU="Œ",l.RI="",l.SS2="Ž",l.SS3="",l.DCS="",l.PU1="‘",l.PU2="’",l.STS="“",l.CCH="”",l.MW="•",l.SPA="–",l.EPA="—",l.SOS="˜",l.SGCI="™",l.SCI="š",l.CSI="›",l.ST="œ",l.OSC="",l.PM="ž",l.APC="Ÿ"}(d||(i.C1=d={})),function(l){l.ST=`${a.ESC}\\`}(g||(i.C1_ESCAPED=g={}))},7399:(c,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.evaluateKeyboardEvent=void 0;const d=a(2584),g={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:["'",'"']};i.evaluateKeyboardEvent=function(l,m,v,w){const _={type:0,cancel:!1,key:void 0},u=(l.shiftKey?1:0)|(l.altKey?2:0)|(l.ctrlKey?4:0)|(l.metaKey?8:0);switch(l.keyCode){case 0:l.key==="UIKeyInputUpArrow"?_.key=m?d.C0.ESC+"OA":d.C0.ESC+"[A":l.key==="UIKeyInputLeftArrow"?_.key=m?d.C0.ESC+"OD":d.C0.ESC+"[D":l.key==="UIKeyInputRightArrow"?_.key=m?d.C0.ESC+"OC":d.C0.ESC+"[C":l.key==="UIKeyInputDownArrow"&&(_.key=m?d.C0.ESC+"OB":d.C0.ESC+"[B");break;case 8:_.key=l.ctrlKey?"\b":d.C0.DEL,l.altKey&&(_.key=d.C0.ESC+_.key);break;case 9:if(l.shiftKey){_.key=d.C0.ESC+"[Z";break}_.key=d.C0.HT,_.cancel=!0;break;case 13:_.key=l.altKey?d.C0.ESC+d.C0.CR:d.C0.CR,_.cancel=!0;break;case 27:_.key=d.C0.ESC,l.altKey&&(_.key=d.C0.ESC+d.C0.ESC),_.cancel=!0;break;case 37:if(l.metaKey)break;u?(_.key=d.C0.ESC+"[1;"+(u+1)+"D",_.key===d.C0.ESC+"[1;3D"&&(_.key=d.C0.ESC+(v?"b":"[1;5D"))):_.key=m?d.C0.ESC+"OD":d.C0.ESC+"[D";break;case 39:if(l.metaKey)break;u?(_.key=d.C0.ESC+"[1;"+(u+1)+"C",_.key===d.C0.ESC+"[1;3C"&&(_.key=d.C0.ESC+(v?"f":"[1;5C"))):_.key=m?d.C0.ESC+"OC":d.C0.ESC+"[C";break;case 38:if(l.metaKey)break;u?(_.key=d.C0.ESC+"[1;"+(u+1)+"A",v||_.key!==d.C0.ESC+"[1;3A"||(_.key=d.C0.ESC+"[1;5A")):_.key=m?d.C0.ESC+"OA":d.C0.ESC+"[A";break;case 40:if(l.metaKey)break;u?(_.key=d.C0.ESC+"[1;"+(u+1)+"B",v||_.key!==d.C0.ESC+"[1;3B"||(_.key=d.C0.ESC+"[1;5B")):_.key=m?d.C0.ESC+"OB":d.C0.ESC+"[B";break;case 45:l.shiftKey||l.ctrlKey||(_.key=d.C0.ESC+"[2~");break;case 46:_.key=u?d.C0.ESC+"[3;"+(u+1)+"~":d.C0.ESC+"[3~";break;case 36:_.key=u?d.C0.ESC+"[1;"+(u+1)+"H":m?d.C0.ESC+"OH":d.C0.ESC+"[H";break;case 35:_.key=u?d.C0.ESC+"[1;"+(u+1)+"F":m?d.C0.ESC+"OF":d.C0.ESC+"[F";break;case 33:l.shiftKey?_.type=2:l.ctrlKey?_.key=d.C0.ESC+"[5;"+(u+1)+"~":_.key=d.C0.ESC+"[5~";break;case 34:l.shiftKey?_.type=3:l.ctrlKey?_.key=d.C0.ESC+"[6;"+(u+1)+"~":_.key=d.C0.ESC+"[6~";break;case 112:_.key=u?d.C0.ESC+"[1;"+(u+1)+"P":d.C0.ESC+"OP";break;case 113:_.key=u?d.C0.ESC+"[1;"+(u+1)+"Q":d.C0.ESC+"OQ";break;case 114:_.key=u?d.C0.ESC+"[1;"+(u+1)+"R":d.C0.ESC+"OR";break;case 115:_.key=u?d.C0.ESC+"[1;"+(u+1)+"S":d.C0.ESC+"OS";break;case 116:_.key=u?d.C0.ESC+"[15;"+(u+1)+"~":d.C0.ESC+"[15~";break;case 117:_.key=u?d.C0.ESC+"[17;"+(u+1)+"~":d.C0.ESC+"[17~";break;case 118:_.key=u?d.C0.ESC+"[18;"+(u+1)+"~":d.C0.ESC+"[18~";break;case 119:_.key=u?d.C0.ESC+"[19;"+(u+1)+"~":d.C0.ESC+"[19~";break;case 120:_.key=u?d.C0.ESC+"[20;"+(u+1)+"~":d.C0.ESC+"[20~";break;case 121:_.key=u?d.C0.ESC+"[21;"+(u+1)+"~":d.C0.ESC+"[21~";break;case 122:_.key=u?d.C0.ESC+"[23;"+(u+1)+"~":d.C0.ESC+"[23~";break;case 123:_.key=u?d.C0.ESC+"[24;"+(u+1)+"~":d.C0.ESC+"[24~";break;default:if(!l.ctrlKey||l.shiftKey||l.altKey||l.metaKey)if(v&&!w||!l.altKey||l.metaKey)!v||l.altKey||l.ctrlKey||l.shiftKey||!l.metaKey?l.key&&!l.ctrlKey&&!l.altKey&&!l.metaKey&&l.keyCode>=48&&l.key.length===1?_.key=l.key:l.key&&l.ctrlKey&&(l.key==="_"&&(_.key=d.C0.US),l.key==="@"&&(_.key=d.C0.NUL)):l.keyCode===65&&(_.type=1);else{const f=g[l.keyCode],p=f==null?void 0:f[l.shiftKey?1:0];if(p)_.key=d.C0.ESC+p;else if(l.keyCode>=65&&l.keyCode<=90){const h=l.ctrlKey?l.keyCode-64:l.keyCode+32;let y=String.fromCharCode(h);l.shiftKey&&(y=y.toUpperCase()),_.key=d.C0.ESC+y}else if(l.keyCode===32)_.key=d.C0.ESC+(l.ctrlKey?d.C0.NUL:" ");else if(l.key==="Dead"&&l.code.startsWith("Key")){let h=l.code.slice(3,4);l.shiftKey||(h=h.toLowerCase()),_.key=d.C0.ESC+h,_.cancel=!0}}else l.keyCode>=65&&l.keyCode<=90?_.key=String.fromCharCode(l.keyCode-64):l.keyCode===32?_.key=d.C0.NUL:l.keyCode>=51&&l.keyCode<=55?_.key=String.fromCharCode(l.keyCode-51+27):l.keyCode===56?_.key=d.C0.DEL:l.keyCode===219?_.key=d.C0.ESC:l.keyCode===220?_.key=d.C0.FS:l.keyCode===221&&(_.key=d.C0.GS)}return _}},482:(c,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.Utf8ToUtf32=i.StringToUtf32=i.utf32ToString=i.stringFromCodePoint=void 0,i.stringFromCodePoint=function(a){return a>65535?(a-=65536,String.fromCharCode(55296+(a>>10))+String.fromCharCode(a%1024+56320)):String.fromCharCode(a)},i.utf32ToString=function(a,d=0,g=a.length){let l="";for(let m=d;m<g;++m){let v=a[m];v>65535?(v-=65536,l+=String.fromCharCode(55296+(v>>10))+String.fromCharCode(v%1024+56320)):l+=String.fromCharCode(v)}return l},i.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(a,d){const g=a.length;if(!g)return 0;let l=0,m=0;if(this._interim){const v=a.charCodeAt(m++);56320<=v&&v<=57343?d[l++]=1024*(this._interim-55296)+v-56320+65536:(d[l++]=this._interim,d[l++]=v),this._interim=0}for(let v=m;v<g;++v){const w=a.charCodeAt(v);if(55296<=w&&w<=56319){if(++v>=g)return this._interim=w,l;const _=a.charCodeAt(v);56320<=_&&_<=57343?d[l++]=1024*(w-55296)+_-56320+65536:(d[l++]=w,d[l++]=_)}else w!==65279&&(d[l++]=w)}return l}},i.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(a,d){const g=a.length;if(!g)return 0;let l,m,v,w,_=0,u=0,f=0;if(this.interim[0]){let y=!1,b=this.interim[0];b&=(224&b)==192?31:(240&b)==224?15:7;let C,E=0;for(;(C=63&this.interim[++E])&&E<4;)b<<=6,b|=C;const x=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,k=x-E;for(;f<k;){if(f>=g)return 0;if(C=a[f++],(192&C)!=128){f--,y=!0;break}this.interim[E++]=C,b<<=6,b|=63&C}y||(x===2?b<128?f--:d[_++]=b:x===3?b<2048||b>=55296&&b<=57343||b===65279||(d[_++]=b):b<65536||b>1114111||(d[_++]=b)),this.interim.fill(0)}const p=g-4;let h=f;for(;h<g;){for(;!(!(h<p)||128&(l=a[h])||128&(m=a[h+1])||128&(v=a[h+2])||128&(w=a[h+3]));)d[_++]=l,d[_++]=m,d[_++]=v,d[_++]=w,h+=4;if(l=a[h++],l<128)d[_++]=l;else if((224&l)==192){if(h>=g)return this.interim[0]=l,_;if(m=a[h++],(192&m)!=128){h--;continue}if(u=(31&l)<<6|63&m,u<128){h--;continue}d[_++]=u}else if((240&l)==224){if(h>=g)return this.interim[0]=l,_;if(m=a[h++],(192&m)!=128){h--;continue}if(h>=g)return this.interim[0]=l,this.interim[1]=m,_;if(v=a[h++],(192&v)!=128){h--;continue}if(u=(15&l)<<12|(63&m)<<6|63&v,u<2048||u>=55296&&u<=57343||u===65279)continue;d[_++]=u}else if((248&l)==240){if(h>=g)return this.interim[0]=l,_;if(m=a[h++],(192&m)!=128){h--;continue}if(h>=g)return this.interim[0]=l,this.interim[1]=m,_;if(v=a[h++],(192&v)!=128){h--;continue}if(h>=g)return this.interim[0]=l,this.interim[1]=m,this.interim[2]=v,_;if(w=a[h++],(192&w)!=128){h--;continue}if(u=(7&l)<<18|(63&m)<<12|(63&v)<<6|63&w,u<65536||u>1114111)continue;d[_++]=u}}return _}}},225:(c,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.UnicodeV6=void 0;const d=a(1480),g=[[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]],l=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]];let m;i.UnicodeV6=class{constructor(){if(this.version="6",!m){m=new Uint8Array(65536),m.fill(1),m[0]=0,m.fill(0,1,32),m.fill(0,127,160),m.fill(2,4352,4448),m[9001]=2,m[9002]=2,m.fill(2,11904,42192),m[12351]=1,m.fill(2,44032,55204),m.fill(2,63744,64256),m.fill(2,65040,65050),m.fill(2,65072,65136),m.fill(2,65280,65377),m.fill(2,65504,65511);for(let v=0;v<g.length;++v)m.fill(0,g[v][0],g[v][1]+1)}}wcwidth(v){return v<32?0:v<127?1:v<65536?m[v]:function(w,_){let u,f=0,p=_.length-1;if(w<_[0][0]||w>_[p][1])return!1;for(;p>=f;)if(u=f+p>>1,w>_[u][1])f=u+1;else{if(!(w<_[u][0]))return!0;p=u-1}return!1}(v,l)?0:v>=131072&&v<=196605||v>=196608&&v<=262141?2:1}charProperties(v,w){let _=this.wcwidth(v),u=_===0&&w!==0;if(u){const f=d.UnicodeService.extractWidth(w);f===0?u=!1:f>_&&(_=f)}return d.UnicodeService.createPropertyValue(0,_,u)}}},5981:(c,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.WriteBuffer=void 0;const d=a(8460),g=a(844);class l extends g.Disposable{constructor(v){super(),this._action=v,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new d.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(v,w){if(w!==void 0&&this._syncCalls>w)return void(this._syncCalls=0);if(this._pendingData+=v.length,this._writeBuffer.push(v),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let _;for(this._isSyncWriting=!0;_=this._writeBuffer.shift();){this._action(_);const u=this._callbacks.shift();u&&u()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(v,w){if(this._pendingData>5e7)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput)return this._didUserInput=!1,this._pendingData+=v.length,this._writeBuffer.push(v),this._callbacks.push(w),void this._innerWrite();setTimeout(()=>this._innerWrite())}this._pendingData+=v.length,this._writeBuffer.push(v),this._callbacks.push(w)}_innerWrite(v=0,w=!0){const _=v||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const u=this._writeBuffer[this._bufferOffset],f=this._action(u,w);if(f){const h=y=>Date.now()-_>=12?setTimeout(()=>this._innerWrite(0,y)):this._innerWrite(_,y);return void f.catch(y=>(queueMicrotask(()=>{throw y}),Promise.resolve(!1))).then(h)}const p=this._callbacks[this._bufferOffset];if(p&&p(),this._bufferOffset++,this._pendingData-=u.length,Date.now()-_>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout(()=>this._innerWrite())):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}}i.WriteBuffer=l},5941:(c,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.toRgbString=i.parseColor=void 0;const a=/^([\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})$/,d=/^[\da-f]+$/;function g(l,m){const v=l.toString(16),w=v.length<2?"0"+v:v;switch(m){case 4:return v[0];case 8:return w;case 12:return(w+w).slice(0,3);default:return w+w}}i.parseColor=function(l){if(!l)return;let m=l.toLowerCase();if(m.indexOf("rgb:")===0){m=m.slice(4);const v=a.exec(m);if(v){const w=v[1]?15:v[4]?255:v[7]?4095:65535;return[Math.round(parseInt(v[1]||v[4]||v[7]||v[10],16)/w*255),Math.round(parseInt(v[2]||v[5]||v[8]||v[11],16)/w*255),Math.round(parseInt(v[3]||v[6]||v[9]||v[12],16)/w*255)]}}else if(m.indexOf("#")===0&&(m=m.slice(1),d.exec(m)&&[3,6,9,12].includes(m.length))){const v=m.length/3,w=[0,0,0];for(let _=0;_<3;++_){const u=parseInt(m.slice(v*_,v*_+v),16);w[_]=v===1?u<<4:v===2?u:v===3?u>>4:u>>8}return w}},i.toRgbString=function(l,m=16){const[v,w,_]=l;return`rgb:${g(v,m)}/${g(w,m)}/${g(_,m)}`}},5770:(c,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.PAYLOAD_LIMIT=void 0,i.PAYLOAD_LIMIT=1e7},6351:(c,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.DcsHandler=i.DcsParser=void 0;const d=a(482),g=a(8742),l=a(5770),m=[];i.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=m,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=m}registerHandler(w,_){this._handlers[w]===void 0&&(this._handlers[w]=[]);const u=this._handlers[w];return u.push(_),{dispose:()=>{const f=u.indexOf(_);f!==-1&&u.splice(f,1)}}}clearHandler(w){this._handlers[w]&&delete this._handlers[w]}setHandlerFallback(w){this._handlerFb=w}reset(){if(this._active.length)for(let w=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;w>=0;--w)this._active[w].unhook(!1);this._stack.paused=!1,this._active=m,this._ident=0}hook(w,_){if(this.reset(),this._ident=w,this._active=this._handlers[w]||m,this._active.length)for(let u=this._active.length-1;u>=0;u--)this._active[u].hook(_);else this._handlerFb(this._ident,"HOOK",_)}put(w,_,u){if(this._active.length)for(let f=this._active.length-1;f>=0;f--)this._active[f].put(w,_,u);else this._handlerFb(this._ident,"PUT",(0,d.utf32ToString)(w,_,u))}unhook(w,_=!0){if(this._active.length){let u=!1,f=this._active.length-1,p=!1;if(this._stack.paused&&(f=this._stack.loopPosition-1,u=_,p=this._stack.fallThrough,this._stack.paused=!1),!p&&u===!1){for(;f>=0&&(u=this._active[f].unhook(w),u!==!0);f--)if(u instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=f,this._stack.fallThrough=!1,u;f--}for(;f>=0;f--)if(u=this._active[f].unhook(!1),u instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=f,this._stack.fallThrough=!0,u}else this._handlerFb(this._ident,"UNHOOK",w);this._active=m,this._ident=0}};const v=new g.Params;v.addParam(0),i.DcsHandler=class{constructor(w){this._handler=w,this._data="",this._params=v,this._hitLimit=!1}hook(w){this._params=w.length>1||w.params[0]?w.clone():v,this._data="",this._hitLimit=!1}put(w,_,u){this._hitLimit||(this._data+=(0,d.utf32ToString)(w,_,u),this._data.length>l.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(w){let _=!1;if(this._hitLimit)_=!1;else if(w&&(_=this._handler(this._data,this._params),_ instanceof Promise))return _.then(u=>(this._params=v,this._data="",this._hitLimit=!1,u));return this._params=v,this._data="",this._hitLimit=!1,_}}},2015:(c,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.EscapeSequenceParser=i.VT500_TRANSITION_TABLE=i.TransitionTable=void 0;const d=a(844),g=a(8742),l=a(6242),m=a(6351);class v{constructor(f){this.table=new Uint8Array(f)}setDefault(f,p){this.table.fill(f<<4|p)}add(f,p,h,y){this.table[p<<8|f]=h<<4|y}addMany(f,p,h,y){for(let b=0;b<f.length;b++)this.table[p<<8|f[b]]=h<<4|y}}i.TransitionTable=v;const w=160;i.VT500_TRANSITION_TABLE=function(){const u=new v(4095),f=Array.apply(null,Array(256)).map((E,x)=>x),p=(E,x)=>f.slice(E,x),h=p(32,127),y=p(0,24);y.push(25),y.push.apply(y,p(28,32));const b=p(0,14);let C;for(C in u.setDefault(1,0),u.addMany(h,0,2,0),b)u.addMany([24,26,153,154],C,3,0),u.addMany(p(128,144),C,3,0),u.addMany(p(144,152),C,3,0),u.add(156,C,0,0),u.add(27,C,11,1),u.add(157,C,4,8),u.addMany([152,158,159],C,0,7),u.add(155,C,11,3),u.add(144,C,11,9);return u.addMany(y,0,3,0),u.addMany(y,1,3,1),u.add(127,1,0,1),u.addMany(y,8,0,8),u.addMany(y,3,3,3),u.add(127,3,0,3),u.addMany(y,4,3,4),u.add(127,4,0,4),u.addMany(y,6,3,6),u.addMany(y,5,3,5),u.add(127,5,0,5),u.addMany(y,2,3,2),u.add(127,2,0,2),u.add(93,1,4,8),u.addMany(h,8,5,8),u.add(127,8,5,8),u.addMany([156,27,24,26,7],8,6,0),u.addMany(p(28,32),8,0,8),u.addMany([88,94,95],1,0,7),u.addMany(h,7,0,7),u.addMany(y,7,0,7),u.add(156,7,0,0),u.add(127,7,0,7),u.add(91,1,11,3),u.addMany(p(64,127),3,7,0),u.addMany(p(48,60),3,8,4),u.addMany([60,61,62,63],3,9,4),u.addMany(p(48,60),4,8,4),u.addMany(p(64,127),4,7,0),u.addMany([60,61,62,63],4,0,6),u.addMany(p(32,64),6,0,6),u.add(127,6,0,6),u.addMany(p(64,127),6,0,0),u.addMany(p(32,48),3,9,5),u.addMany(p(32,48),5,9,5),u.addMany(p(48,64),5,0,6),u.addMany(p(64,127),5,7,0),u.addMany(p(32,48),4,9,5),u.addMany(p(32,48),1,9,2),u.addMany(p(32,48),2,9,2),u.addMany(p(48,127),2,10,0),u.addMany(p(48,80),1,10,0),u.addMany(p(81,88),1,10,0),u.addMany([89,90,92],1,10,0),u.addMany(p(96,127),1,10,0),u.add(80,1,11,9),u.addMany(y,9,0,9),u.add(127,9,0,9),u.addMany(p(28,32),9,0,9),u.addMany(p(32,48),9,9,12),u.addMany(p(48,60),9,8,10),u.addMany([60,61,62,63],9,9,10),u.addMany(y,11,0,11),u.addMany(p(32,128),11,0,11),u.addMany(p(28,32),11,0,11),u.addMany(y,10,0,10),u.add(127,10,0,10),u.addMany(p(28,32),10,0,10),u.addMany(p(48,60),10,8,10),u.addMany([60,61,62,63],10,0,11),u.addMany(p(32,48),10,9,12),u.addMany(y,12,0,12),u.add(127,12,0,12),u.addMany(p(28,32),12,0,12),u.addMany(p(32,48),12,9,12),u.addMany(p(48,64),12,0,11),u.addMany(p(64,127),12,12,13),u.addMany(p(64,127),10,12,13),u.addMany(p(64,127),9,12,13),u.addMany(y,13,13,13),u.addMany(h,13,13,13),u.add(127,13,0,13),u.addMany([27,156,24,26],13,14,0),u.add(w,0,2,0),u.add(w,8,5,8),u.add(w,6,0,6),u.add(w,11,0,11),u.add(w,13,13,13),u}();class _ extends d.Disposable{constructor(f=i.VT500_TRANSITION_TABLE){super(),this._transitions=f,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new g.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(p,h,y)=>{},this._executeHandlerFb=p=>{},this._csiHandlerFb=(p,h)=>{},this._escHandlerFb=p=>{},this._errorHandlerFb=p=>p,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,d.toDisposable)(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this.register(new l.OscParser),this._dcsParser=this.register(new m.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(f,p=[64,126]){let h=0;if(f.prefix){if(f.prefix.length>1)throw new Error("only one byte as prefix supported");if(h=f.prefix.charCodeAt(0),h&&60>h||h>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(f.intermediates){if(f.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let b=0;b<f.intermediates.length;++b){const C=f.intermediates.charCodeAt(b);if(32>C||C>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");h<<=8,h|=C}}if(f.final.length!==1)throw new Error("final must be a single byte");const y=f.final.charCodeAt(0);if(p[0]>y||y>p[1])throw new Error(`final must be in range ${p[0]} .. ${p[1]}`);return h<<=8,h|=y,h}identToString(f){const p=[];for(;f;)p.push(String.fromCharCode(255&f)),f>>=8;return p.reverse().join("")}setPrintHandler(f){this._printHandler=f}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(f,p){const h=this._identifier(f,[48,126]);this._escHandlers[h]===void 0&&(this._escHandlers[h]=[]);const y=this._escHandlers[h];return y.push(p),{dispose:()=>{const b=y.indexOf(p);b!==-1&&y.splice(b,1)}}}clearEscHandler(f){this._escHandlers[this._identifier(f,[48,126])]&&delete this._escHandlers[this._identifier(f,[48,126])]}setEscHandlerFallback(f){this._escHandlerFb=f}setExecuteHandler(f,p){this._executeHandlers[f.charCodeAt(0)]=p}clearExecuteHandler(f){this._executeHandlers[f.charCodeAt(0)]&&delete this._executeHandlers[f.charCodeAt(0)]}setExecuteHandlerFallback(f){this._executeHandlerFb=f}registerCsiHandler(f,p){const h=this._identifier(f);this._csiHandlers[h]===void 0&&(this._csiHandlers[h]=[]);const y=this._csiHandlers[h];return y.push(p),{dispose:()=>{const b=y.indexOf(p);b!==-1&&y.splice(b,1)}}}clearCsiHandler(f){this._csiHandlers[this._identifier(f)]&&delete this._csiHandlers[this._identifier(f)]}setCsiHandlerFallback(f){this._csiHandlerFb=f}registerDcsHandler(f,p){return this._dcsParser.registerHandler(this._identifier(f),p)}clearDcsHandler(f){this._dcsParser.clearHandler(this._identifier(f))}setDcsHandlerFallback(f){this._dcsParser.setHandlerFallback(f)}registerOscHandler(f,p){return this._oscParser.registerHandler(f,p)}clearOscHandler(f){this._oscParser.clearHandler(f)}setOscHandlerFallback(f){this._oscParser.setHandlerFallback(f)}setErrorHandler(f){this._errorHandler=f}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(f,p,h,y,b){this._parseStack.state=f,this._parseStack.handlers=p,this._parseStack.handlerPos=h,this._parseStack.transition=y,this._parseStack.chunkPos=b}parse(f,p,h){let y,b=0,C=0,E=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,E=this._parseStack.chunkPos+1;else{if(h===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const x=this._parseStack.handlers;let k=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(h===!1&&k>-1){for(;k>=0&&(y=x[k](this._params),y!==!0);k--)if(y instanceof Promise)return this._parseStack.handlerPos=k,y}this._parseStack.handlers=[];break;case 4:if(h===!1&&k>-1){for(;k>=0&&(y=x[k](),y!==!0);k--)if(y instanceof Promise)return this._parseStack.handlerPos=k,y}this._parseStack.handlers=[];break;case 6:if(b=f[this._parseStack.chunkPos],y=this._dcsParser.unhook(b!==24&&b!==26,h),y)return y;b===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(b=f[this._parseStack.chunkPos],y=this._oscParser.end(b!==24&&b!==26,h),y)return y;b===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,E=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let x=E;x<p;++x){switch(b=f[x],C=this._transitions.table[this.currentState<<8|(b<160?b:w)],C>>4){case 2:for(let N=x+1;;++N){if(N>=p||(b=f[N])<32||b>126&&b<w){this._printHandler(f,x,N),x=N-1;break}if(++N>=p||(b=f[N])<32||b>126&&b<w){this._printHandler(f,x,N),x=N-1;break}if(++N>=p||(b=f[N])<32||b>126&&b<w){this._printHandler(f,x,N),x=N-1;break}if(++N>=p||(b=f[N])<32||b>126&&b<w){this._printHandler(f,x,N),x=N-1;break}}break;case 3:this._executeHandlers[b]?this._executeHandlers[b]():this._executeHandlerFb(b),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:x,code:b,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const k=this._csiHandlers[this._collect<<8|b];let M=k?k.length-1:-1;for(;M>=0&&(y=k[M](this._params),y!==!0);M--)if(y instanceof Promise)return this._preserveStack(3,k,M,C,x),y;M<0&&this._csiHandlerFb(this._collect<<8|b,this._params),this.precedingJoinState=0;break;case 8:do switch(b){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(b-48)}while(++x<p&&(b=f[x])>47&&b<60);x--;break;case 9:this._collect<<=8,this._collect|=b;break;case 10:const D=this._escHandlers[this._collect<<8|b];let R=D?D.length-1:-1;for(;R>=0&&(y=D[R](),y!==!0);R--)if(y instanceof Promise)return this._preserveStack(4,D,R,C,x),y;R<0&&this._escHandlerFb(this._collect<<8|b),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|b,this._params);break;case 13:for(let N=x+1;;++N)if(N>=p||(b=f[N])===24||b===26||b===27||b>127&&b<w){this._dcsParser.put(f,x,N),x=N-1;break}break;case 14:if(y=this._dcsParser.unhook(b!==24&&b!==26),y)return this._preserveStack(6,[],0,C,x),y;b===27&&(C|=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 N=x+1;;N++)if(N>=p||(b=f[N])<32||b>127&&b<w){this._oscParser.put(f,x,N),x=N-1;break}break;case 6:if(y=this._oscParser.end(b!==24&&b!==26),y)return this._preserveStack(5,[],0,C,x),y;b===27&&(C|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&C}}}i.EscapeSequenceParser=_},6242:(c,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.OscHandler=i.OscParser=void 0;const d=a(5770),g=a(482),l=[];i.OscParser=class{constructor(){this._state=0,this._active=l,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(m,v){this._handlers[m]===void 0&&(this._handlers[m]=[]);const w=this._handlers[m];return w.push(v),{dispose:()=>{const _=w.indexOf(v);_!==-1&&w.splice(_,1)}}}clearHandler(m){this._handlers[m]&&delete this._handlers[m]}setHandlerFallback(m){this._handlerFb=m}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=l}reset(){if(this._state===2)for(let m=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;m>=0;--m)this._active[m].end(!1);this._stack.paused=!1,this._active=l,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||l,this._active.length)for(let m=this._active.length-1;m>=0;m--)this._active[m].start();else this._handlerFb(this._id,"START")}_put(m,v,w){if(this._active.length)for(let _=this._active.length-1;_>=0;_--)this._active[_].put(m,v,w);else this._handlerFb(this._id,"PUT",(0,g.utf32ToString)(m,v,w))}start(){this.reset(),this._state=1}put(m,v,w){if(this._state!==3){if(this._state===1)for(;v<w;){const _=m[v++];if(_===59){this._state=2,this._start();break}if(_<48||57<_)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+_-48}this._state===2&&w-v>0&&this._put(m,v,w)}}end(m,v=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let w=!1,_=this._active.length-1,u=!1;if(this._stack.paused&&(_=this._stack.loopPosition-1,w=v,u=this._stack.fallThrough,this._stack.paused=!1),!u&&w===!1){for(;_>=0&&(w=this._active[_].end(m),w!==!0);_--)if(w instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=_,this._stack.fallThrough=!1,w;_--}for(;_>=0;_--)if(w=this._active[_].end(!1),w instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=_,this._stack.fallThrough=!0,w}else this._handlerFb(this._id,"END",m);this._active=l,this._id=-1,this._state=0}}},i.OscHandler=class{constructor(m){this._handler=m,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(m,v,w){this._hitLimit||(this._data+=(0,g.utf32ToString)(m,v,w),this._data.length>d.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(m){let v=!1;if(this._hitLimit)v=!1;else if(m&&(v=this._handler(this._data),v instanceof Promise))return v.then(w=>(this._data="",this._hitLimit=!1,w));return this._data="",this._hitLimit=!1,v}}},8742:(c,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.Params=void 0;const a=2147483647;class d{static fromArray(l){const m=new d;if(!l.length)return m;for(let v=Array.isArray(l[0])?1:0;v<l.length;++v){const w=l[v];if(Array.isArray(w))for(let _=0;_<w.length;++_)m.addSubParam(w[_]);else m.addParam(w)}return m}constructor(l=32,m=32){if(this.maxLength=l,this.maxSubParamsLength=m,m>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(l),this.length=0,this._subParams=new Int32Array(m),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(l),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const l=new d(this.maxLength,this.maxSubParamsLength);return l.params.set(this.params),l.length=this.length,l._subParams.set(this._subParams),l._subParamsLength=this._subParamsLength,l._subParamsIdx.set(this._subParamsIdx),l._rejectDigits=this._rejectDigits,l._rejectSubDigits=this._rejectSubDigits,l._digitIsSub=this._digitIsSub,l}toArray(){const l=[];for(let m=0;m<this.length;++m){l.push(this.params[m]);const v=this._subParamsIdx[m]>>8,w=255&this._subParamsIdx[m];w-v>0&&l.push(Array.prototype.slice.call(this._subParams,v,w))}return l}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(l){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(l<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=l>a?a:l}}addSubParam(l){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(l<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=l>a?a:l,this._subParamsIdx[this.length-1]++}}hasSubParams(l){return(255&this._subParamsIdx[l])-(this._subParamsIdx[l]>>8)>0}getSubParams(l){const m=this._subParamsIdx[l]>>8,v=255&this._subParamsIdx[l];return v-m>0?this._subParams.subarray(m,v):null}getSubParamsAll(){const l={};for(let m=0;m<this.length;++m){const v=this._subParamsIdx[m]>>8,w=255&this._subParamsIdx[m];w-v>0&&(l[m]=this._subParams.slice(v,w))}return l}addDigit(l){let m;if(this._rejectDigits||!(m=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const v=this._digitIsSub?this._subParams:this.params,w=v[m-1];v[m-1]=~w?Math.min(10*w+l,a):l}}i.Params=d},5741:(c,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.AddonManager=void 0,i.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let a=this._addons.length-1;a>=0;a--)this._addons[a].instance.dispose()}loadAddon(a,d){const g={instance:d,dispose:d.dispose,isDisposed:!1};this._addons.push(g),d.dispose=()=>this._wrappedAddonDispose(g),d.activate(a)}_wrappedAddonDispose(a){if(a.isDisposed)return;let d=-1;for(let g=0;g<this._addons.length;g++)if(this._addons[g]===a){d=g;break}if(d===-1)throw new Error("Could not dispose an addon that has not been loaded");a.isDisposed=!0,a.dispose.apply(a.instance),this._addons.splice(d,1)}}},8771:(c,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.BufferApiView=void 0;const d=a(3785),g=a(511);i.BufferApiView=class{constructor(l,m){this._buffer=l,this.type=m}init(l){return this._buffer=l,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(l){const m=this._buffer.lines.get(l);if(m)return new d.BufferLineApiView(m)}getNullCell(){return new g.CellData}}},3785:(c,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.BufferLineApiView=void 0;const d=a(511);i.BufferLineApiView=class{constructor(g){this._line=g}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(g,l){if(!(g<0||g>=this._line.length))return l?(this._line.loadCell(g,l),l):this._line.loadCell(g,new d.CellData)}translateToString(g,l,m){return this._line.translateToString(g,l,m)}}},8285:(c,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.BufferNamespaceApi=void 0;const d=a(8771),g=a(8460),l=a(844);class m extends l.Disposable{constructor(w){super(),this._core=w,this._onBufferChange=this.register(new g.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new d.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new d.BufferApiView(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate(()=>this._onBufferChange.fire(this.active))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}}i.BufferNamespaceApi=m},7975:(c,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.ParserApi=void 0,i.ParserApi=class{constructor(a){this._core=a}registerCsiHandler(a,d){return this._core.registerCsiHandler(a,g=>d(g.toArray()))}addCsiHandler(a,d){return this.registerCsiHandler(a,d)}registerDcsHandler(a,d){return this._core.registerDcsHandler(a,(g,l)=>d(g,l.toArray()))}addDcsHandler(a,d){return this.registerDcsHandler(a,d)}registerEscHandler(a,d){return this._core.registerEscHandler(a,d)}addEscHandler(a,d){return this.registerEscHandler(a,d)}registerOscHandler(a,d){return this._core.registerOscHandler(a,d)}addOscHandler(a,d){return this.registerOscHandler(a,d)}}},7090:(c,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.UnicodeApi=void 0,i.UnicodeApi=class{constructor(a){this._core=a}register(a){this._core.unicodeService.register(a)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(a){this._core.unicodeService.activeVersion=a}}},744:function(c,i,a){var d=this&&this.__decorate||function(u,f,p,h){var y,b=arguments.length,C=b<3?f:h===null?h=Object.getOwnPropertyDescriptor(f,p):h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(u,f,p,h);else for(var E=u.length-1;E>=0;E--)(y=u[E])&&(C=(b<3?y(C):b>3?y(f,p,C):y(f,p))||C);return b>3&&C&&Object.defineProperty(f,p,C),C},g=this&&this.__param||function(u,f){return function(p,h){f(p,h,u)}};Object.defineProperty(i,"__esModule",{value:!0}),i.BufferService=i.MINIMUM_ROWS=i.MINIMUM_COLS=void 0;const l=a(8460),m=a(844),v=a(5295),w=a(2585);i.MINIMUM_COLS=2,i.MINIMUM_ROWS=1;let _=i.BufferService=class extends m.Disposable{get buffer(){return this.buffers.active}constructor(u){super(),this.isUserScrolling=!1,this._onResize=this.register(new l.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new l.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(u.rawOptions.cols||0,i.MINIMUM_COLS),this.rows=Math.max(u.rawOptions.rows||0,i.MINIMUM_ROWS),this.buffers=this.register(new v.BufferSet(u,this))}resize(u,f){this.cols=u,this.rows=f,this.buffers.resize(u,f),this._onResize.fire({cols:u,rows:f})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(u,f=!1){const p=this.buffer;let h;h=this._cachedBlankLine,h&&h.length===this.cols&&h.getFg(0)===u.fg&&h.getBg(0)===u.bg||(h=p.getBlankLine(u,f),this._cachedBlankLine=h),h.isWrapped=f;const y=p.ybase+p.scrollTop,b=p.ybase+p.scrollBottom;if(p.scrollTop===0){const C=p.lines.isFull;b===p.lines.length-1?C?p.lines.recycle().copyFrom(h):p.lines.push(h.clone()):p.lines.splice(b+1,0,h.clone()),C?this.isUserScrolling&&(p.ydisp=Math.max(p.ydisp-1,0)):(p.ybase++,this.isUserScrolling||p.ydisp++)}else{const C=b-y+1;p.lines.shiftElements(y+1,C-1,-1),p.lines.set(b,h.clone())}this.isUserScrolling||(p.ydisp=p.ybase),this._onScroll.fire(p.ydisp)}scrollLines(u,f,p){const h=this.buffer;if(u<0){if(h.ydisp===0)return;this.isUserScrolling=!0}else u+h.ydisp>=h.ybase&&(this.isUserScrolling=!1);const y=h.ydisp;h.ydisp=Math.max(Math.min(h.ydisp+u,h.ybase),0),y!==h.ydisp&&(f||this._onScroll.fire(h.ydisp))}};i.BufferService=_=d([g(0,w.IOptionsService)],_)},7994:(c,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.CharsetService=void 0,i.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(a){this.glevel=a,this.charset=this._charsets[a]}setgCharset(a,d){this._charsets[a]=d,this.glevel===a&&(this.charset=d)}}},1753:function(c,i,a){var d=this&&this.__decorate||function(h,y,b,C){var E,x=arguments.length,k=x<3?y:C===null?C=Object.getOwnPropertyDescriptor(y,b):C;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(h,y,b,C);else for(var M=h.length-1;M>=0;M--)(E=h[M])&&(k=(x<3?E(k):x>3?E(y,b,k):E(y,b))||k);return x>3&&k&&Object.defineProperty(y,b,k),k},g=this&&this.__param||function(h,y){return function(b,C){y(b,C,h)}};Object.defineProperty(i,"__esModule",{value:!0}),i.CoreMouseService=void 0;const l=a(2585),m=a(8460),v=a(844),w={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:h=>h.button!==4&&h.action===1&&(h.ctrl=!1,h.alt=!1,h.shift=!1,!0)},VT200:{events:19,restrict:h=>h.action!==32},DRAG:{events:23,restrict:h=>h.action!==32||h.button!==3},ANY:{events:31,restrict:h=>!0}};function _(h,y){let b=(h.ctrl?16:0)|(h.shift?4:0)|(h.alt?8:0);return h.button===4?(b|=64,b|=h.action):(b|=3&h.button,4&h.button&&(b|=64),8&h.button&&(b|=128),h.action===32?b|=32:h.action!==0||y||(b|=3)),b}const u=String.fromCharCode,f={DEFAULT:h=>{const y=[_(h,!1)+32,h.col+32,h.row+32];return y[0]>255||y[1]>255||y[2]>255?"":`\x1B[M${u(y[0])}${u(y[1])}${u(y[2])}`},SGR:h=>{const y=h.action===0&&h.button!==4?"m":"M";return`\x1B[<${_(h,!0)};${h.col};${h.row}${y}`},SGR_PIXELS:h=>{const y=h.action===0&&h.button!==4?"m":"M";return`\x1B[<${_(h,!0)};${h.x};${h.y}${y}`}};let p=i.CoreMouseService=class extends v.Disposable{constructor(h,y){super(),this._bufferService=h,this._coreService=y,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new m.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const b of Object.keys(w))this.addProtocol(b,w[b]);for(const b of Object.keys(f))this.addEncoding(b,f[b]);this.reset()}addProtocol(h,y){this._protocols[h]=y}addEncoding(h,y){this._encodings[h]=y}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(h){if(!this._protocols[h])throw new Error(`unknown protocol "${h}"`);this._activeProtocol=h,this._onProtocolChange.fire(this._protocols[h].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(h){if(!this._encodings[h])throw new Error(`unknown encoding "${h}"`);this._activeEncoding=h}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(h){if(h.col<0||h.col>=this._bufferService.cols||h.row<0||h.row>=this._bufferService.rows||h.button===4&&h.action===32||h.button===3&&h.action!==32||h.button!==4&&(h.action===2||h.action===3)||(h.col++,h.row++,h.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,h,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(h))return!1;const y=this._encodings[this._activeEncoding](h);return y&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(y):this._coreService.triggerDataEvent(y,!0)),this._lastEvent=h,!0}explainEvents(h){return{down:!!(1&h),up:!!(2&h),drag:!!(4&h),move:!!(8&h),wheel:!!(16&h)}}_equalEvents(h,y,b){if(b){if(h.x!==y.x||h.y!==y.y)return!1}else if(h.col!==y.col||h.row!==y.row)return!1;return h.button===y.button&&h.action===y.action&&h.ctrl===y.ctrl&&h.alt===y.alt&&h.shift===y.shift}};i.CoreMouseService=p=d([g(0,l.IBufferService),g(1,l.ICoreService)],p)},6975:function(c,i,a){var d=this&&this.__decorate||function(p,h,y,b){var C,E=arguments.length,x=E<3?h:b===null?b=Object.getOwnPropertyDescriptor(h,y):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(p,h,y,b);else for(var k=p.length-1;k>=0;k--)(C=p[k])&&(x=(E<3?C(x):E>3?C(h,y,x):C(h,y))||x);return E>3&&x&&Object.defineProperty(h,y,x),x},g=this&&this.__param||function(p,h){return function(y,b){h(y,b,p)}};Object.defineProperty(i,"__esModule",{value:!0}),i.CoreService=void 0;const l=a(1439),m=a(8460),v=a(844),w=a(2585),_=Object.freeze({insertMode:!1}),u=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let f=i.CoreService=class extends v.Disposable{constructor(p,h,y){super(),this._bufferService=p,this._logService=h,this._optionsService=y,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new m.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new m.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new m.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new m.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,l.clone)(_),this.decPrivateModes=(0,l.clone)(u)}reset(){this.modes=(0,l.clone)(_),this.decPrivateModes=(0,l.clone)(u)}triggerDataEvent(p,h=!1){if(this._optionsService.rawOptions.disableStdin)return;const y=this._bufferService.buffer;h&&this._optionsService.rawOptions.scrollOnUserInput&&y.ybase!==y.ydisp&&this._onRequestScrollToBottom.fire(),h&&this._onUserInput.fire(),this._logService.debug(`sending data "${p}"`,()=>p.split("").map(b=>b.charCodeAt(0))),this._onData.fire(p)}triggerBinaryEvent(p){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${p}"`,()=>p.split("").map(h=>h.charCodeAt(0))),this._onBinary.fire(p))}};i.CoreService=f=d([g(0,w.IBufferService),g(1,w.ILogService),g(2,w.IOptionsService)],f)},9074:(c,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.DecorationService=void 0;const d=a(8055),g=a(8460),l=a(844),m=a(6106);let v=0,w=0;class _ extends l.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new m.SortedList(p=>p==null?void 0:p.marker.line),this._onDecorationRegistered=this.register(new g.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new g.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,l.toDisposable)(()=>this.reset()))}registerDecoration(p){if(p.marker.isDisposed)return;const h=new u(p);if(h){const y=h.marker.onDispose(()=>h.dispose());h.onDispose(()=>{h&&(this._decorations.delete(h)&&this._onDecorationRemoved.fire(h),y.dispose())}),this._decorations.insert(h),this._onDecorationRegistered.fire(h)}return h}reset(){for(const p of this._decorations.values())p.dispose();this._decorations.clear()}*getDecorationsAtCell(p,h,y){let b=0,C=0;for(const E of this._decorations.getKeyIterator(h))b=E.options.x??0,C=b+(E.options.width??1),p>=b&&p<C&&(!y||(E.options.layer??"bottom")===y)&&(yield E)}forEachDecorationAtCell(p,h,y,b){this._decorations.forEachByKey(h,C=>{v=C.options.x??0,w=v+(C.options.width??1),p>=v&&p<w&&(!y||(C.options.layer??"bottom")===y)&&b(C)})}}i.DecorationService=_;class u extends l.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=d.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=d.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(p){super(),this.options=p,this.onRenderEmitter=this.register(new g.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new g.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=p.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(c,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.InstantiationService=i.ServiceCollection=void 0;const d=a(2585),g=a(8343);class l{constructor(...v){this._entries=new Map;for(const[w,_]of v)this.set(w,_)}set(v,w){const _=this._entries.get(v);return this._entries.set(v,w),_}forEach(v){for(const[w,_]of this._entries.entries())v(w,_)}has(v){return this._entries.has(v)}get(v){return this._entries.get(v)}}i.ServiceCollection=l,i.InstantiationService=class{constructor(){this._services=new l,this._services.set(d.IInstantiationService,this)}setService(m,v){this._services.set(m,v)}getService(m){return this._services.get(m)}createInstance(m,...v){const w=(0,g.getServiceDependencies)(m).sort((f,p)=>f.index-p.index),_=[];for(const f of w){const p=this._services.get(f.id);if(!p)throw new Error(`[createInstance] ${m.name} depends on UNKNOWN service ${f.id}.`);_.push(p)}const u=w.length>0?w[0].index:v.length;if(v.length!==u)throw new Error(`[createInstance] First service dependency of ${m.name} at position ${u+1} conflicts with ${v.length} static arguments`);return new m(...v,..._)}}},7866:function(c,i,a){var d=this&&this.__decorate||function(u,f,p,h){var y,b=arguments.length,C=b<3?f:h===null?h=Object.getOwnPropertyDescriptor(f,p):h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(u,f,p,h);else for(var E=u.length-1;E>=0;E--)(y=u[E])&&(C=(b<3?y(C):b>3?y(f,p,C):y(f,p))||C);return b>3&&C&&Object.defineProperty(f,p,C),C},g=this&&this.__param||function(u,f){return function(p,h){f(p,h,u)}};Object.defineProperty(i,"__esModule",{value:!0}),i.traceCall=i.setTraceLogger=i.LogService=void 0;const l=a(844),m=a(2585),v={trace:m.LogLevelEnum.TRACE,debug:m.LogLevelEnum.DEBUG,info:m.LogLevelEnum.INFO,warn:m.LogLevelEnum.WARN,error:m.LogLevelEnum.ERROR,off:m.LogLevelEnum.OFF};let w,_=i.LogService=class extends l.Disposable{get logLevel(){return this._logLevel}constructor(u){super(),this._optionsService=u,this._logLevel=m.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel())),w=this}_updateLogLevel(){this._logLevel=v[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(u){for(let f=0;f<u.length;f++)typeof u[f]=="function"&&(u[f]=u[f]())}_log(u,f,p){this._evalLazyOptionalParams(p),u.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+f,...p)}trace(u,...f){var p;this._logLevel<=m.LogLevelEnum.TRACE&&this._log(((p=this._optionsService.options.logger)==null?void 0:p.trace.bind(this._optionsService.options.logger))??console.log,u,f)}debug(u,...f){var p;this._logLevel<=m.LogLevelEnum.DEBUG&&this._log(((p=this._optionsService.options.logger)==null?void 0:p.debug.bind(this._optionsService.options.logger))??console.log,u,f)}info(u,...f){var p;this._logLevel<=m.LogLevelEnum.INFO&&this._log(((p=this._optionsService.options.logger)==null?void 0:p.info.bind(this._optionsService.options.logger))??console.info,u,f)}warn(u,...f){var p;this._logLevel<=m.LogLevelEnum.WARN&&this._log(((p=this._optionsService.options.logger)==null?void 0:p.warn.bind(this._optionsService.options.logger))??console.warn,u,f)}error(u,...f){var p;this._logLevel<=m.LogLevelEnum.ERROR&&this._log(((p=this._optionsService.options.logger)==null?void 0:p.error.bind(this._optionsService.options.logger))??console.error,u,f)}};i.LogService=_=d([g(0,m.IOptionsService)],_),i.setTraceLogger=function(u){w=u},i.traceCall=function(u,f,p){if(typeof p.value!="function")throw new Error("not supported");const h=p.value;p.value=function(...y){if(w.logLevel!==m.LogLevelEnum.TRACE)return h.apply(this,y);w.trace(`GlyphRenderer#${h.name}(${y.map(C=>JSON.stringify(C)).join(", ")})`);const b=h.apply(this,y);return w.trace(`GlyphRenderer#${h.name} return`,b),b}}},7302:(c,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.OptionsService=i.DEFAULT_OPTIONS=void 0;const d=a(8460),g=a(844),l=a(6114);i.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"courier-new, courier, monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},rescaleOverlappingGlyphs:!1,rightClickSelectsWord:l.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const m=["normal","bold","100","200","300","400","500","600","700","800","900"];class v extends g.Disposable{constructor(_){super(),this._onOptionChange=this.register(new d.EventEmitter),this.onOptionChange=this._onOptionChange.event;const u={...i.DEFAULT_OPTIONS};for(const f in _)if(f in u)try{const p=_[f];u[f]=this._sanitizeAndValidateOption(f,p)}catch(p){console.error(p)}this.rawOptions=u,this.options={...u},this._setupOptions(),this.register((0,g.toDisposable)(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(_,u){return this.onOptionChange(f=>{f===_&&u(this.rawOptions[_])})}onMultipleOptionChange(_,u){return this.onOptionChange(f=>{_.indexOf(f)!==-1&&u()})}_setupOptions(){const _=f=>{if(!(f in i.DEFAULT_OPTIONS))throw new Error(`No option with key "${f}"`);return this.rawOptions[f]},u=(f,p)=>{if(!(f in i.DEFAULT_OPTIONS))throw new Error(`No option with key "${f}"`);p=this._sanitizeAndValidateOption(f,p),this.rawOptions[f]!==p&&(this.rawOptions[f]=p,this._onOptionChange.fire(f))};for(const f in this.rawOptions){const p={get:_.bind(this,f),set:u.bind(this,f)};Object.defineProperty(this.options,f,p)}}_sanitizeAndValidateOption(_,u){switch(_){case"cursorStyle":if(u||(u=i.DEFAULT_OPTIONS[_]),!function(f){return f==="block"||f==="underline"||f==="bar"}(u))throw new Error(`"${u}" is not a valid value for ${_}`);break;case"wordSeparator":u||(u=i.DEFAULT_OPTIONS[_]);break;case"fontWeight":case"fontWeightBold":if(typeof u=="number"&&1<=u&&u<=1e3)break;u=m.includes(u)?u:i.DEFAULT_OPTIONS[_];break;case"cursorWidth":u=Math.floor(u);case"lineHeight":case"tabStopWidth":if(u<1)throw new Error(`${_} cannot be less than 1, value: ${u}`);break;case"minimumContrastRatio":u=Math.max(1,Math.min(21,Math.round(10*u)/10));break;case"scrollback":if((u=Math.min(u,4294967295))<0)throw new Error(`${_} cannot be less than 0, value: ${u}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(u<=0)throw new Error(`${_} cannot be less than or equal to 0, value: ${u}`);break;case"rows":case"cols":if(!u&&u!==0)throw new Error(`${_} must be numeric, value: ${u}`);break;case"windowsPty":u=u??{}}return u}}i.OptionsService=v},2660:function(c,i,a){var d=this&&this.__decorate||function(v,w,_,u){var f,p=arguments.length,h=p<3?w:u===null?u=Object.getOwnPropertyDescriptor(w,_):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")h=Reflect.decorate(v,w,_,u);else for(var y=v.length-1;y>=0;y--)(f=v[y])&&(h=(p<3?f(h):p>3?f(w,_,h):f(w,_))||h);return p>3&&h&&Object.defineProperty(w,_,h),h},g=this&&this.__param||function(v,w){return function(_,u){w(_,u,v)}};Object.defineProperty(i,"__esModule",{value:!0}),i.OscLinkService=void 0;const l=a(2585);let m=i.OscLinkService=class{constructor(v){this._bufferService=v,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(v){const w=this._bufferService.buffer;if(v.id===void 0){const y=w.addMarker(w.ybase+w.y),b={data:v,id:this._nextId++,lines:[y]};return y.onDispose(()=>this._removeMarkerFromLink(b,y)),this._dataByLinkId.set(b.id,b),b.id}const _=v,u=this._getEntryIdKey(_),f=this._entriesWithId.get(u);if(f)return this.addLineToLink(f.id,w.ybase+w.y),f.id;const p=w.addMarker(w.ybase+w.y),h={id:this._nextId++,key:this._getEntryIdKey(_),data:_,lines:[p]};return p.onDispose(()=>this._removeMarkerFromLink(h,p)),this._entriesWithId.set(h.key,h),this._dataByLinkId.set(h.id,h),h.id}addLineToLink(v,w){const _=this._dataByLinkId.get(v);if(_&&_.lines.every(u=>u.line!==w)){const u=this._bufferService.buffer.addMarker(w);_.lines.push(u),u.onDispose(()=>this._removeMarkerFromLink(_,u))}}getLinkData(v){var w;return(w=this._dataByLinkId.get(v))==null?void 0:w.data}_getEntryIdKey(v){return`${v.id};;${v.uri}`}_removeMarkerFromLink(v,w){const _=v.lines.indexOf(w);_!==-1&&(v.lines.splice(_,1),v.lines.length===0&&(v.data.id!==void 0&&this._entriesWithId.delete(v.key),this._dataByLinkId.delete(v.id)))}};i.OscLinkService=m=d([g(0,l.IBufferService)],m)},8343:(c,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.createDecorator=i.getServiceDependencies=i.serviceRegistry=void 0;const a="di$target",d="di$dependencies";i.serviceRegistry=new Map,i.getServiceDependencies=function(g){return g[d]||[]},i.createDecorator=function(g){if(i.serviceRegistry.has(g))return i.serviceRegistry.get(g);const l=function(m,v,w){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(_,u,f){u[a]===u?u[d].push({id:_,index:f}):(u[d]=[{id:_,index:f}],u[a]=u)})(l,m,w)};return l.toString=()=>g,i.serviceRegistry.set(g,l),l}},2585:(c,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.IDecorationService=i.IUnicodeService=i.IOscLinkService=i.IOptionsService=i.ILogService=i.LogLevelEnum=i.IInstantiationService=i.ICharsetService=i.ICoreService=i.ICoreMouseService=i.IBufferService=void 0;const d=a(8343);var g;i.IBufferService=(0,d.createDecorator)("BufferService"),i.ICoreMouseService=(0,d.createDecorator)("CoreMouseService"),i.ICoreService=(0,d.createDecorator)("CoreService"),i.ICharsetService=(0,d.createDecorator)("CharsetService"),i.IInstantiationService=(0,d.createDecorator)("InstantiationService"),function(l){l[l.TRACE=0]="TRACE",l[l.DEBUG=1]="DEBUG",l[l.INFO=2]="INFO",l[l.WARN=3]="WARN",l[l.ERROR=4]="ERROR",l[l.OFF=5]="OFF"}(g||(i.LogLevelEnum=g={})),i.ILogService=(0,d.createDecorator)("LogService"),i.IOptionsService=(0,d.createDecorator)("OptionsService"),i.IOscLinkService=(0,d.createDecorator)("OscLinkService"),i.IUnicodeService=(0,d.createDecorator)("UnicodeService"),i.IDecorationService=(0,d.createDecorator)("DecorationService")},1480:(c,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.UnicodeService=void 0;const d=a(8460),g=a(225);class l{static extractShouldJoin(v){return(1&v)!=0}static extractWidth(v){return v>>1&3}static extractCharKind(v){return v>>3}static createPropertyValue(v,w,_=!1){return(16777215&v)<<3|(3&w)<<1|(_?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new d.EventEmitter,this.onChange=this._onChange.event;const v=new g.UnicodeV6;this.register(v),this._active=v.version,this._activeProvider=v}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(v){if(!this._providers[v])throw new Error(`unknown Unicode version "${v}"`);this._active=v,this._activeProvider=this._providers[v],this._onChange.fire(v)}register(v){this._providers[v.version]=v}wcwidth(v){return this._activeProvider.wcwidth(v)}getStringCellWidth(v){let w=0,_=0;const u=v.length;for(let f=0;f<u;++f){let p=v.charCodeAt(f);if(55296<=p&&p<=56319){if(++f>=u)return w+this.wcwidth(p);const b=v.charCodeAt(f);56320<=b&&b<=57343?p=1024*(p-55296)+b-56320+65536:w+=this.wcwidth(b)}const h=this.charProperties(p,_);let y=l.extractWidth(h);l.extractShouldJoin(h)&&(y-=l.extractWidth(_)),w+=y,_=h}return w}charProperties(v,w){return this._activeProvider.charProperties(v,w)}}i.UnicodeService=l}},n={};function r(c){var i=n[c];if(i!==void 0)return i.exports;var a=n[c]={exports:{}};return s[c].call(a.exports,a,a.exports,r),a.exports}var o={};return(()=>{var c=o;Object.defineProperty(c,"__esModule",{value:!0}),c.Terminal=void 0;const i=r(9042),a=r(3236),d=r(844),g=r(5741),l=r(8285),m=r(7975),v=r(7090),w=["cols","rows"];class _ extends d.Disposable{constructor(f){super(),this._core=this.register(new a.Terminal(f)),this._addonManager=this.register(new g.AddonManager),this._publicOptions={...this._core.options};const p=y=>this._core.options[y],h=(y,b)=>{this._checkReadonlyOptions(y),this._core.options[y]=b};for(const y in this._core.options){const b={get:p.bind(this,y),set:h.bind(this,y)};Object.defineProperty(this._publicOptions,y,b)}}_checkReadonlyOptions(f){if(w.includes(f))throw new Error(`Option "${f}" 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 m.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new v.UnicodeApi(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this.register(new l.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const f=this._core.coreService.decPrivateModes;let p="none";switch(this._core.coreMouseService.activeProtocol){case"X10":p="x10";break;case"VT200":p="vt200";break;case"DRAG":p="drag";break;case"ANY":p="any"}return{applicationCursorKeysMode:f.applicationCursorKeys,applicationKeypadMode:f.applicationKeypad,bracketedPasteMode:f.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:p,originMode:f.origin,reverseWraparoundMode:f.reverseWraparound,sendFocusMode:f.sendFocus,wraparoundMode:f.wraparound}}get options(){return this._publicOptions}set options(f){for(const p in f)this._publicOptions[p]=f[p]}blur(){this._core.blur()}focus(){this._core.focus()}input(f,p=!0){this._core.input(f,p)}resize(f,p){this._verifyIntegers(f,p),this._core.resize(f,p)}open(f){this._core.open(f)}attachCustomKeyEventHandler(f){this._core.attachCustomKeyEventHandler(f)}attachCustomWheelEventHandler(f){this._core.attachCustomWheelEventHandler(f)}registerLinkProvider(f){return this._core.registerLinkProvider(f)}registerCharacterJoiner(f){return this._checkProposedApi(),this._core.registerCharacterJoiner(f)}deregisterCharacterJoiner(f){this._checkProposedApi(),this._core.deregisterCharacterJoiner(f)}registerMarker(f=0){return this._verifyIntegers(f),this._core.registerMarker(f)}registerDecoration(f){return this._checkProposedApi(),this._verifyPositiveIntegers(f.x??0,f.width??0,f.height??0),this._core.registerDecoration(f)}hasSelection(){return this._core.hasSelection()}select(f,p,h){this._verifyIntegers(f,p,h),this._core.select(f,p,h)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(f,p){this._verifyIntegers(f,p),this._core.selectLines(f,p)}dispose(){super.dispose()}scrollLines(f){this._verifyIntegers(f),this._core.scrollLines(f)}scrollPages(f){this._verifyIntegers(f),this._core.scrollPages(f)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(f){this._verifyIntegers(f),this._core.scrollToLine(f)}clear(){this._core.clear()}write(f,p){this._core.write(f,p)}writeln(f,p){this._core.write(f),this._core.write(`\r
80
- `,p)}paste(f){this._core.paste(f)}refresh(f,p){this._verifyIntegers(f,p),this._core.refresh(f,p)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(f){this._addonManager.loadAddon(this,f)}static get strings(){return i}_verifyIntegers(...f){for(const p of f)if(p===1/0||isNaN(p)||p%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...f){for(const p of f)if(p&&(p===1/0||isNaN(p)||p%1!=0||p<0))throw new Error("This API only accepts positive integers")}}c.Terminal=_})(),o})())})(P0);var Yk=P0.exports,B0={exports:{}};(function(e,t){(function(s,n){e.exports=n()})(self,()=>(()=>{var s={};return(()=>{var n=s;Object.defineProperty(n,"__esModule",{value:!0}),n.FitAddon=void 0,n.FitAddon=class{activate(r){this._terminal=r}dispose(){}fit(){const r=this.proposeDimensions();if(!r||!this._terminal||isNaN(r.cols)||isNaN(r.rows))return;const o=this._terminal._core;this._terminal.rows===r.rows&&this._terminal.cols===r.cols||(o._renderService.clear(),this._terminal.resize(r.cols,r.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const r=this._terminal._core,o=r._renderService.dimensions;if(o.css.cell.width===0||o.css.cell.height===0)return;const c=this._terminal.options.scrollback===0?0:r.viewport.scrollBarWidth,i=window.getComputedStyle(this._terminal.element.parentElement),a=parseInt(i.getPropertyValue("height")),d=Math.max(0,parseInt(i.getPropertyValue("width"))),g=window.getComputedStyle(this._terminal.element),l=a-(parseInt(g.getPropertyValue("padding-top"))+parseInt(g.getPropertyValue("padding-bottom"))),m=d-(parseInt(g.getPropertyValue("padding-right"))+parseInt(g.getPropertyValue("padding-left")))-c;return{cols:Math.max(2,Math.floor(m/o.css.cell.width)),rows:Math.max(1,Math.floor(l/o.css.cell.height))}}}})(),s})())})(B0);var Qk=B0.exports,j0={exports:{}};(function(e,t){(function(s,n){e.exports=n()})(self,()=>(()=>{var s={965:(c,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.GlyphRenderer=void 0;const d=a(374),g=a(509),l=a(855),m=a(859),v=a(381),w=11,_=w*Float32Array.BYTES_PER_ELEMENT;let u,f=0,p=0,h=0;class y extends m.Disposable{constructor(C,E,x,k){super(),this._terminal=C,this._gl=E,this._dimensions=x,this._optionsService=k,this._activeBuffer=0,this._vertices={count:0,attributes:new Float32Array(0),attributesBuffers:[new Float32Array(0),new Float32Array(0)]};const M=this._gl;g.TextureAtlas.maxAtlasPages===void 0&&(g.TextureAtlas.maxAtlasPages=Math.min(32,(0,d.throwIfFalsy)(M.getParameter(M.MAX_TEXTURE_IMAGE_UNITS))),g.TextureAtlas.maxTextureSize=(0,d.throwIfFalsy)(M.getParameter(M.MAX_TEXTURE_SIZE))),this._program=(0,d.throwIfFalsy)((0,v.createProgram)(M,`#version 300 es
81
- layout (location = 0) in vec2 a_unitquad;
82
- layout (location = 1) in vec2 a_cellpos;
83
- layout (location = 2) in vec2 a_offset;
84
- layout (location = 3) in vec2 a_size;
85
- layout (location = 4) in float a_texpage;
86
- layout (location = 5) in vec2 a_texcoord;
87
- layout (location = 6) in vec2 a_texsize;
88
-
89
- uniform mat4 u_projection;
90
- uniform vec2 u_resolution;
91
-
92
- out vec2 v_texcoord;
93
- flat out int v_texpage;
94
-
95
- void main() {
96
- vec2 zeroToOne = (a_offset / u_resolution) + a_cellpos + (a_unitquad * a_size);
97
- gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
98
- v_texpage = int(a_texpage);
99
- v_texcoord = a_texcoord + a_unitquad * a_texsize;
100
- }`,function(F){let H="";for(let I=1;I<F;I++)H+=` else if (v_texpage == ${I}) { outColor = texture(u_texture[${I}], v_texcoord); }`;return`#version 300 es
101
- precision lowp float;
102
-
103
- in vec2 v_texcoord;
104
- flat in int v_texpage;
105
-
106
- uniform sampler2D u_texture[${F}];
107
-
108
- out vec4 outColor;
109
-
110
- void main() {
111
- if (v_texpage == 0) {
112
- outColor = texture(u_texture[0], v_texcoord);
113
- } ${H}
114
- }`}(g.TextureAtlas.maxAtlasPages))),this.register((0,m.toDisposable)(()=>M.deleteProgram(this._program))),this._projectionLocation=(0,d.throwIfFalsy)(M.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=(0,d.throwIfFalsy)(M.getUniformLocation(this._program,"u_resolution")),this._textureLocation=(0,d.throwIfFalsy)(M.getUniformLocation(this._program,"u_texture")),this._vertexArrayObject=M.createVertexArray(),M.bindVertexArray(this._vertexArrayObject);const D=new Float32Array([0,0,1,0,0,1,1,1]),R=M.createBuffer();this.register((0,m.toDisposable)(()=>M.deleteBuffer(R))),M.bindBuffer(M.ARRAY_BUFFER,R),M.bufferData(M.ARRAY_BUFFER,D,M.STATIC_DRAW),M.enableVertexAttribArray(0),M.vertexAttribPointer(0,2,this._gl.FLOAT,!1,0,0);const N=new Uint8Array([0,1,2,3]),A=M.createBuffer();this.register((0,m.toDisposable)(()=>M.deleteBuffer(A))),M.bindBuffer(M.ELEMENT_ARRAY_BUFFER,A),M.bufferData(M.ELEMENT_ARRAY_BUFFER,N,M.STATIC_DRAW),this._attributesBuffer=(0,d.throwIfFalsy)(M.createBuffer()),this.register((0,m.toDisposable)(()=>M.deleteBuffer(this._attributesBuffer))),M.bindBuffer(M.ARRAY_BUFFER,this._attributesBuffer),M.enableVertexAttribArray(2),M.vertexAttribPointer(2,2,M.FLOAT,!1,_,0),M.vertexAttribDivisor(2,1),M.enableVertexAttribArray(3),M.vertexAttribPointer(3,2,M.FLOAT,!1,_,2*Float32Array.BYTES_PER_ELEMENT),M.vertexAttribDivisor(3,1),M.enableVertexAttribArray(4),M.vertexAttribPointer(4,1,M.FLOAT,!1,_,4*Float32Array.BYTES_PER_ELEMENT),M.vertexAttribDivisor(4,1),M.enableVertexAttribArray(5),M.vertexAttribPointer(5,2,M.FLOAT,!1,_,5*Float32Array.BYTES_PER_ELEMENT),M.vertexAttribDivisor(5,1),M.enableVertexAttribArray(6),M.vertexAttribPointer(6,2,M.FLOAT,!1,_,7*Float32Array.BYTES_PER_ELEMENT),M.vertexAttribDivisor(6,1),M.enableVertexAttribArray(1),M.vertexAttribPointer(1,2,M.FLOAT,!1,_,9*Float32Array.BYTES_PER_ELEMENT),M.vertexAttribDivisor(1,1),M.useProgram(this._program);const $=new Int32Array(g.TextureAtlas.maxAtlasPages);for(let F=0;F<g.TextureAtlas.maxAtlasPages;F++)$[F]=F;M.uniform1iv(this._textureLocation,$),M.uniformMatrix4fv(this._projectionLocation,!1,v.PROJECTION_MATRIX),this._atlasTextures=[];for(let F=0;F<g.TextureAtlas.maxAtlasPages;F++){const H=new v.GLTexture((0,d.throwIfFalsy)(M.createTexture()));this.register((0,m.toDisposable)(()=>M.deleteTexture(H.texture))),M.activeTexture(M.TEXTURE0+F),M.bindTexture(M.TEXTURE_2D,H.texture),M.texParameteri(M.TEXTURE_2D,M.TEXTURE_WRAP_S,M.CLAMP_TO_EDGE),M.texParameteri(M.TEXTURE_2D,M.TEXTURE_WRAP_T,M.CLAMP_TO_EDGE),M.texImage2D(M.TEXTURE_2D,0,M.RGBA,1,1,0,M.RGBA,M.UNSIGNED_BYTE,new Uint8Array([255,0,0,255])),this._atlasTextures[F]=H}M.enable(M.BLEND),M.blendFunc(M.SRC_ALPHA,M.ONE_MINUS_SRC_ALPHA),this.handleResize()}beginFrame(){return!this._atlas||this._atlas.beginFrame()}updateCell(C,E,x,k,M,D,R,N,A){this._updateCell(this._vertices.attributes,C,E,x,k,M,D,R,N,A)}_updateCell(C,E,x,k,M,D,R,N,A,$){f=(x*this._terminal.cols+E)*w,k!==l.NULL_CELL_CODE&&k!==void 0?this._atlas&&(u=N&&N.length>1?this._atlas.getRasterizedGlyphCombinedChar(N,M,D,R,!1):this._atlas.getRasterizedGlyph(k,M,D,R,!1),p=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),M!==$&&u.offset.x>p?(h=u.offset.x-p,C[f]=-(u.offset.x-h)+this._dimensions.device.char.left,C[f+1]=-u.offset.y+this._dimensions.device.char.top,C[f+2]=(u.size.x-h)/this._dimensions.device.canvas.width,C[f+3]=u.size.y/this._dimensions.device.canvas.height,C[f+4]=u.texturePage,C[f+5]=u.texturePositionClipSpace.x+h/this._atlas.pages[u.texturePage].canvas.width,C[f+6]=u.texturePositionClipSpace.y,C[f+7]=u.sizeClipSpace.x-h/this._atlas.pages[u.texturePage].canvas.width,C[f+8]=u.sizeClipSpace.y):(C[f]=-u.offset.x+this._dimensions.device.char.left,C[f+1]=-u.offset.y+this._dimensions.device.char.top,C[f+2]=u.size.x/this._dimensions.device.canvas.width,C[f+3]=u.size.y/this._dimensions.device.canvas.height,C[f+4]=u.texturePage,C[f+5]=u.texturePositionClipSpace.x,C[f+6]=u.texturePositionClipSpace.y,C[f+7]=u.sizeClipSpace.x,C[f+8]=u.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&(0,d.allowRescaling)(k,A,u.size.x,this._dimensions.device.cell.width)&&(C[f+2]=(this._dimensions.device.cell.width-1)/this._dimensions.device.canvas.width)):C.fill(0,f,f+w-1-2)}clear(){const C=this._terminal,E=C.cols*C.rows*w;this._vertices.count!==E?this._vertices.attributes=new Float32Array(E):this._vertices.attributes.fill(0);let x=0;for(;x<this._vertices.attributesBuffers.length;x++)this._vertices.count!==E?this._vertices.attributesBuffers[x]=new Float32Array(E):this._vertices.attributesBuffers[x].fill(0);this._vertices.count=E,x=0;for(let k=0;k<C.rows;k++)for(let M=0;M<C.cols;M++)this._vertices.attributes[x+9]=M/C.cols,this._vertices.attributes[x+10]=k/C.rows,x+=w}handleResize(){const C=this._gl;C.useProgram(this._program),C.viewport(0,0,C.canvas.width,C.canvas.height),C.uniform2f(this._resolutionLocation,C.canvas.width,C.canvas.height),this.clear()}render(C){if(!this._atlas)return;const E=this._gl;E.useProgram(this._program),E.bindVertexArray(this._vertexArrayObject),this._activeBuffer=(this._activeBuffer+1)%2;const x=this._vertices.attributesBuffers[this._activeBuffer];let k=0;for(let M=0;M<C.lineLengths.length;M++){const D=M*this._terminal.cols*w,R=this._vertices.attributes.subarray(D,D+C.lineLengths[M]*w);x.set(R,k),k+=R.length}E.bindBuffer(E.ARRAY_BUFFER,this._attributesBuffer),E.bufferData(E.ARRAY_BUFFER,x.subarray(0,k),E.STREAM_DRAW);for(let M=0;M<this._atlas.pages.length;M++)this._atlas.pages[M].version!==this._atlasTextures[M].version&&this._bindAtlasPageTexture(E,this._atlas,M);E.drawElementsInstanced(E.TRIANGLE_STRIP,4,E.UNSIGNED_BYTE,0,k/w)}setAtlas(C){this._atlas=C;for(const E of this._atlasTextures)E.version=-1}_bindAtlasPageTexture(C,E,x){C.activeTexture(C.TEXTURE0+x),C.bindTexture(C.TEXTURE_2D,this._atlasTextures[x].texture),C.texParameteri(C.TEXTURE_2D,C.TEXTURE_WRAP_S,C.CLAMP_TO_EDGE),C.texParameteri(C.TEXTURE_2D,C.TEXTURE_WRAP_T,C.CLAMP_TO_EDGE),C.texImage2D(C.TEXTURE_2D,0,C.RGBA,C.RGBA,C.UNSIGNED_BYTE,E.pages[x].canvas),C.generateMipmap(C.TEXTURE_2D),this._atlasTextures[x].version=E.pages[x].version}setDimensions(C){this._dimensions=C}}i.GlyphRenderer=y},742:(c,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.RectangleRenderer=void 0;const d=a(374),g=a(859),l=a(310),m=a(381),v=8*Float32Array.BYTES_PER_ELEMENT;class w{constructor(){this.attributes=new Float32Array(160),this.count=0}}let _=0,u=0,f=0,p=0,h=0,y=0,b=0;class C extends g.Disposable{constructor(x,k,M,D){super(),this._terminal=x,this._gl=k,this._dimensions=M,this._themeService=D,this._vertices=new w,this._verticesCursor=new w;const R=this._gl;this._program=(0,d.throwIfFalsy)((0,m.createProgram)(R,`#version 300 es
115
- layout (location = 0) in vec2 a_position;
116
- layout (location = 1) in vec2 a_size;
117
- layout (location = 2) in vec4 a_color;
118
- layout (location = 3) in vec2 a_unitquad;
119
-
120
- uniform mat4 u_projection;
121
-
122
- out vec4 v_color;
123
-
124
- void main() {
125
- vec2 zeroToOne = a_position + (a_unitquad * a_size);
126
- gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
127
- v_color = a_color;
128
- }`,`#version 300 es
129
- precision lowp float;
130
-
131
- in vec4 v_color;
132
-
133
- out vec4 outColor;
134
-
135
- void main() {
136
- outColor = v_color;
137
- }`)),this.register((0,g.toDisposable)(()=>R.deleteProgram(this._program))),this._projectionLocation=(0,d.throwIfFalsy)(R.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=R.createVertexArray(),R.bindVertexArray(this._vertexArrayObject);const N=new Float32Array([0,0,1,0,0,1,1,1]),A=R.createBuffer();this.register((0,g.toDisposable)(()=>R.deleteBuffer(A))),R.bindBuffer(R.ARRAY_BUFFER,A),R.bufferData(R.ARRAY_BUFFER,N,R.STATIC_DRAW),R.enableVertexAttribArray(3),R.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);const $=new Uint8Array([0,1,2,3]),F=R.createBuffer();this.register((0,g.toDisposable)(()=>R.deleteBuffer(F))),R.bindBuffer(R.ELEMENT_ARRAY_BUFFER,F),R.bufferData(R.ELEMENT_ARRAY_BUFFER,$,R.STATIC_DRAW),this._attributesBuffer=(0,d.throwIfFalsy)(R.createBuffer()),this.register((0,g.toDisposable)(()=>R.deleteBuffer(this._attributesBuffer))),R.bindBuffer(R.ARRAY_BUFFER,this._attributesBuffer),R.enableVertexAttribArray(0),R.vertexAttribPointer(0,2,R.FLOAT,!1,v,0),R.vertexAttribDivisor(0,1),R.enableVertexAttribArray(1),R.vertexAttribPointer(1,2,R.FLOAT,!1,v,2*Float32Array.BYTES_PER_ELEMENT),R.vertexAttribDivisor(1,1),R.enableVertexAttribArray(2),R.vertexAttribPointer(2,4,R.FLOAT,!1,v,4*Float32Array.BYTES_PER_ELEMENT),R.vertexAttribDivisor(2,1),this._updateCachedColors(D.colors),this.register(this._themeService.onChangeColors(H=>{this._updateCachedColors(H),this._updateViewportRectangle()}))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(x){const k=this._gl;k.useProgram(this._program),k.bindVertexArray(this._vertexArrayObject),k.uniformMatrix4fv(this._projectionLocation,!1,m.PROJECTION_MATRIX),k.bindBuffer(k.ARRAY_BUFFER,this._attributesBuffer),k.bufferData(k.ARRAY_BUFFER,x.attributes,k.DYNAMIC_DRAW),k.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,k.UNSIGNED_BYTE,0,x.count)}handleResize(){this._updateViewportRectangle()}setDimensions(x){this._dimensions=x}_updateCachedColors(x){this._bgFloat=this._colorToFloat32Array(x.background),this._cursorFloat=this._colorToFloat32Array(x.cursor)}_updateViewportRectangle(){this._addRectangleFloat(this._vertices.attributes,0,0,0,this._terminal.cols*this._dimensions.device.cell.width,this._terminal.rows*this._dimensions.device.cell.height,this._bgFloat)}updateBackgrounds(x){const k=this._terminal,M=this._vertices;let D,R,N,A,$,F,H,I,L,T,j,O=1;for(D=0;D<k.rows;D++){for(N=-1,A=0,$=0,F=!1,R=0;R<k.cols;R++)H=(D*k.cols+R)*l.RENDER_MODEL_INDICIES_PER_CELL,I=x.cells[H+l.RENDER_MODEL_BG_OFFSET],L=x.cells[H+l.RENDER_MODEL_FG_OFFSET],T=!!(67108864&L),(I!==A||L!==$&&(F||T))&&((A!==0||F&&$!==0)&&(j=8*O++,this._updateRectangle(M,j,$,A,N,R,D)),N=R,A=I,$=L,F=T);(A!==0||F&&$!==0)&&(j=8*O++,this._updateRectangle(M,j,$,A,N,k.cols,D))}M.count=O}updateCursor(x){const k=this._verticesCursor,M=x.cursor;if(!M||M.style==="block")return void(k.count=0);let D,R=0;M.style!=="bar"&&M.style!=="outline"||(D=8*R++,this._addRectangleFloat(k.attributes,D,M.x*this._dimensions.device.cell.width,M.y*this._dimensions.device.cell.height,M.style==="bar"?M.dpr*M.cursorWidth:M.dpr,this._dimensions.device.cell.height,this._cursorFloat)),M.style!=="underline"&&M.style!=="outline"||(D=8*R++,this._addRectangleFloat(k.attributes,D,M.x*this._dimensions.device.cell.width,(M.y+1)*this._dimensions.device.cell.height-M.dpr,M.width*this._dimensions.device.cell.width,M.dpr,this._cursorFloat)),M.style==="outline"&&(D=8*R++,this._addRectangleFloat(k.attributes,D,M.x*this._dimensions.device.cell.width,M.y*this._dimensions.device.cell.height,M.width*this._dimensions.device.cell.width,M.dpr,this._cursorFloat),D=8*R++,this._addRectangleFloat(k.attributes,D,(M.x+M.width)*this._dimensions.device.cell.width-M.dpr,M.y*this._dimensions.device.cell.height,M.dpr,this._dimensions.device.cell.height,this._cursorFloat)),k.count=R}_updateRectangle(x,k,M,D,R,N,A){if(67108864&M)switch(50331648&M){case 16777216:case 33554432:_=this._themeService.colors.ansi[255&M].rgba;break;case 50331648:_=(16777215&M)<<8;break;default:_=this._themeService.colors.foreground.rgba}else switch(50331648&D){case 16777216:case 33554432:_=this._themeService.colors.ansi[255&D].rgba;break;case 50331648:_=(16777215&D)<<8;break;default:_=this._themeService.colors.background.rgba}x.attributes.length<k+4&&(x.attributes=(0,m.expandFloat32Array)(x.attributes,this._terminal.rows*this._terminal.cols*8)),u=R*this._dimensions.device.cell.width,f=A*this._dimensions.device.cell.height,p=(_>>24&255)/255,h=(_>>16&255)/255,y=(_>>8&255)/255,b=1,this._addRectangle(x.attributes,k,u,f,(N-R)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,p,h,y,b)}_addRectangle(x,k,M,D,R,N,A,$,F,H){x[k]=M/this._dimensions.device.canvas.width,x[k+1]=D/this._dimensions.device.canvas.height,x[k+2]=R/this._dimensions.device.canvas.width,x[k+3]=N/this._dimensions.device.canvas.height,x[k+4]=A,x[k+5]=$,x[k+6]=F,x[k+7]=H}_addRectangleFloat(x,k,M,D,R,N,A){x[k]=M/this._dimensions.device.canvas.width,x[k+1]=D/this._dimensions.device.canvas.height,x[k+2]=R/this._dimensions.device.canvas.width,x[k+3]=N/this._dimensions.device.canvas.height,x[k+4]=A[0],x[k+5]=A[1],x[k+6]=A[2],x[k+7]=A[3]}_colorToFloat32Array(x){return new Float32Array([(x.rgba>>24&255)/255,(x.rgba>>16&255)/255,(x.rgba>>8&255)/255,(255&x.rgba)/255])}}i.RectangleRenderer=C},310:(c,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.RenderModel=i.COMBINED_CHAR_BIT_MASK=i.RENDER_MODEL_EXT_OFFSET=i.RENDER_MODEL_FG_OFFSET=i.RENDER_MODEL_BG_OFFSET=i.RENDER_MODEL_INDICIES_PER_CELL=void 0;const d=a(296);i.RENDER_MODEL_INDICIES_PER_CELL=4,i.RENDER_MODEL_BG_OFFSET=1,i.RENDER_MODEL_FG_OFFSET=2,i.RENDER_MODEL_EXT_OFFSET=3,i.COMBINED_CHAR_BIT_MASK=2147483648,i.RenderModel=class{constructor(){this.cells=new Uint32Array(0),this.lineLengths=new Uint32Array(0),this.selection=(0,d.createSelectionRenderModel)()}resize(g,l){const m=g*l*i.RENDER_MODEL_INDICIES_PER_CELL;m!==this.cells.length&&(this.cells=new Uint32Array(m),this.lineLengths=new Uint32Array(l))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}}},666:(c,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.JoinedCellData=i.WebglRenderer=void 0;const d=a(820),g=a(274),l=a(627),m=a(457),v=a(56),w=a(374),_=a(345),u=a(859),f=a(147),p=a(782),h=a(855),y=a(965),b=a(742),C=a(310),E=a(733);class x extends u.Disposable{constructor(R,N,A,$,F,H,I,L,T){super(),this._terminal=R,this._characterJoinerService=N,this._charSizeService=A,this._coreBrowserService=$,this._coreService=F,this._decorationService=H,this._optionsService=I,this._themeService=L,this._cursorBlinkStateManager=new u.MutableDisposable,this._charAtlasDisposable=this.register(new u.MutableDisposable),this._observerDisposable=this.register(new u.MutableDisposable),this._model=new C.RenderModel,this._workCell=new p.CellData,this._workCell2=new p.CellData,this._rectangleRenderer=this.register(new u.MutableDisposable),this._glyphRenderer=this.register(new u.MutableDisposable),this._onChangeTextureAtlas=this.register(new _.EventEmitter),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this.register(new _.EventEmitter),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this.register(new _.EventEmitter),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this.register(new _.EventEmitter),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this.register(new _.EventEmitter),this.onContextLoss=this._onContextLoss.event,this.register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new g.CellColorResolver(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new E.LinkRenderLayer(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,I,this._themeService)],this.dimensions=(0,w.createRenderDimensions)(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this.register(I.onOptionChange(()=>this._handleOptionsChanged())),this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");const j={antialias:!1,depth:!1,preserveDrawingBuffer:T};if(this._gl=this._canvas.getContext("webgl2",j),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this.register((0,d.addDisposableDomListener)(this._canvas,"webglcontextlost",O=>{console.log("webglcontextlost event received"),O.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,console.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(O)},3e3)})),this.register((0,d.addDisposableDomListener)(this._canvas,"webglcontextrestored",O=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,(0,l.removeTerminalFromCache)(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=(0,v.observeDevicePixelDimensions)(this._canvas,this._coreBrowserService.window,(O,V)=>this._setCanvasDevicePixelDimensions(O,V)),this.register(this._coreBrowserService.onWindowChange(O=>{this._observerDisposable.value=(0,v.observeDevicePixelDimensions)(this._canvas,O,(V,q)=>this._setCanvasDevicePixelDimensions(V,q))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._coreBrowserService.window.document.body.contains(this._core.screenElement),this.register((0,u.toDisposable)(()=>{var O;for(const V of this._renderLayers)V.dispose();(O=this._canvas.parentElement)==null||O.removeChild(this._canvas),(0,l.removeTerminalFromCache)(this._terminal)}))}get textureAtlas(){var R;return(R=this._charAtlas)==null?void 0:R.pages[0].canvas}_handleColorChange(){this._refreshCharAtlas(),this._clearModel(!0)}handleDevicePixelRatioChange(){this._devicePixelRatio!==this._coreBrowserService.dpr&&(this._devicePixelRatio=this._coreBrowserService.dpr,this.handleResize(this._terminal.cols,this._terminal.rows))}handleResize(R,N){var A,$,F,H;this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(const I of this._renderLayers)I.resize(this._terminal,this.dimensions);this._canvas.width=this.dimensions.device.canvas.width,this._canvas.height=this.dimensions.device.canvas.height,this._canvas.style.width=`${this.dimensions.css.canvas.width}px`,this._canvas.style.height=`${this.dimensions.css.canvas.height}px`,this._core.screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._core.screenElement.style.height=`${this.dimensions.css.canvas.height}px`,(A=this._rectangleRenderer.value)==null||A.setDimensions(this.dimensions),($=this._rectangleRenderer.value)==null||$.handleResize(),(F=this._glyphRenderer.value)==null||F.setDimensions(this.dimensions),(H=this._glyphRenderer.value)==null||H.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){var R;for(const N of this._renderLayers)N.handleBlur(this._terminal);(R=this._cursorBlinkStateManager.value)==null||R.pause(),this._requestRedrawViewport()}handleFocus(){var R;for(const N of this._renderLayers)N.handleFocus(this._terminal);(R=this._cursorBlinkStateManager.value)==null||R.resume(),this._requestRedrawViewport()}handleSelectionChanged(R,N,A){for(const $ of this._renderLayers)$.handleSelectionChanged(this._terminal,R,N,A);this._model.selection.update(this._core,R,N,A),this._requestRedrawViewport()}handleCursorMove(){var R;for(const N of this._renderLayers)N.handleCursorMove(this._terminal);(R=this._cursorBlinkStateManager.value)==null||R.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new b.RectangleRenderer(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new y.GlyphRenderer(this._terminal,this._gl,this.dimensions,this._optionsService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){var N;if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0)return void(this._isAttached=!1);const R=(0,l.acquireTextureAtlas)(this._terminal,this._optionsService.rawOptions,this._themeService.colors,this.dimensions.device.cell.width,this.dimensions.device.cell.height,this.dimensions.device.char.width,this.dimensions.device.char.height,this._coreBrowserService.dpr);this._charAtlas!==R&&(this._onChangeTextureAtlas.fire(R.pages[0].canvas),this._charAtlasDisposable.value=(0,u.getDisposeArrayDisposable)([(0,_.forwardEvent)(R.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),(0,_.forwardEvent)(R.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)])),this._charAtlas=R,this._charAtlas.warmUp(),(N=this._glyphRenderer.value)==null||N.setAtlas(this._charAtlas)}_clearModel(R){var N;this._model.clear(),R&&((N=this._glyphRenderer.value)==null||N.clear())}clearTextureAtlas(){var R;(R=this._charAtlas)==null||R.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){var R;this._clearModel(!0);for(const N of this._renderLayers)N.reset(this._terminal);(R=this._cursorBlinkStateManager.value)==null||R.restartBlinkAnimation(),this._updateCursorBlink()}registerCharacterJoiner(R){return-1}deregisterCharacterJoiner(R){return!1}renderRows(R,N){if(!this._isAttached){if(!(this._coreBrowserService.window.document.body.contains(this._core.screenElement)&&this._charSizeService.width&&this._charSizeService.height))return;this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0}for(const A of this._renderLayers)A.handleGridChanged(this._terminal,R,N);this._glyphRenderer.value&&this._rectangleRenderer.value&&(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(R,N),this._rectangleRenderer.value.renderBackgrounds(),this._glyphRenderer.value.render(this._model),this._cursorBlinkStateManager.value&&!this._cursorBlinkStateManager.value.isCursorVisible||this._rectangleRenderer.value.renderCursor())}_updateCursorBlink(){this._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new m.CursorBlinkStateManager(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(R,N){const A=this._core;let $,F,H,I,L,T,j,O,V,q,J,Q,z,P,K=this._workCell;R=M(R,A.rows-1,0),N=M(N,A.rows-1,0);const U=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,Z=U-A.buffer.ydisp,Y=Math.min(this._terminal.buffer.active.cursorX,A.cols-1);let ne=-1;const ie=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let ce=!1;for(F=R;F<=N;F++)for(H=F+A.buffer.ydisp,I=A.buffer.lines.get(H),this._model.lineLengths[F]=0,L=this._characterJoinerService.getJoinedCharacters(H),z=0;z<A.cols;z++)if($=this._cellColorResolver.result.bg,I.loadCell(z,K),z===0&&($=this._cellColorResolver.result.bg),T=!1,j=z,L.length>0&&z===L[0][0]&&(T=!0,O=L.shift(),K=new k(K,I.translateToString(!0,O[0],O[1]),O[1]-O[0]),j=O[1]-1),V=K.getChars(),q=K.getCode(),Q=(F*A.cols+z)*C.RENDER_MODEL_INDICIES_PER_CELL,this._cellColorResolver.resolve(K,z,H,this.dimensions.device.cell.width),ie&&H===U&&(z===Y&&(this._model.cursor={x:Y,y:Z,width:K.getWidth(),style:this._coreBrowserService.isFocused?A.options.cursorStyle||"block":A.options.cursorInactiveStyle,cursorWidth:A.options.cursorWidth,dpr:this._devicePixelRatio},ne=Y+K.getWidth()-1),z>=Y&&z<=ne&&(this._coreBrowserService.isFocused&&(A.options.cursorStyle||"block")==="block"||this._coreBrowserService.isFocused===!1&&A.options.cursorInactiveStyle==="block")&&(this._cellColorResolver.result.fg=50331648|this._themeService.colors.cursorAccent.rgba>>8&16777215,this._cellColorResolver.result.bg=50331648|this._themeService.colors.cursor.rgba>>8&16777215)),q!==h.NULL_CELL_CODE&&(this._model.lineLengths[F]=z+1),(this._model.cells[Q]!==q||this._model.cells[Q+C.RENDER_MODEL_BG_OFFSET]!==this._cellColorResolver.result.bg||this._model.cells[Q+C.RENDER_MODEL_FG_OFFSET]!==this._cellColorResolver.result.fg||this._model.cells[Q+C.RENDER_MODEL_EXT_OFFSET]!==this._cellColorResolver.result.ext)&&(ce=!0,V.length>1&&(q|=C.COMBINED_CHAR_BIT_MASK),this._model.cells[Q]=q,this._model.cells[Q+C.RENDER_MODEL_BG_OFFSET]=this._cellColorResolver.result.bg,this._model.cells[Q+C.RENDER_MODEL_FG_OFFSET]=this._cellColorResolver.result.fg,this._model.cells[Q+C.RENDER_MODEL_EXT_OFFSET]=this._cellColorResolver.result.ext,J=K.getWidth(),this._glyphRenderer.value.updateCell(z,F,q,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,V,J,$),T))for(K=this._workCell,z++;z<j;z++)P=(F*A.cols+z)*C.RENDER_MODEL_INDICIES_PER_CELL,this._glyphRenderer.value.updateCell(z,F,h.NULL_CELL_CODE,0,0,0,h.NULL_CELL_CHAR,0,0),this._model.cells[P]=h.NULL_CELL_CODE,this._model.cells[P+C.RENDER_MODEL_BG_OFFSET]=this._cellColorResolver.result.bg,this._model.cells[P+C.RENDER_MODEL_FG_OFFSET]=this._cellColorResolver.result.fg,this._model.cells[P+C.RENDER_MODEL_EXT_OFFSET]=this._cellColorResolver.result.ext;ce&&this._rectangleRenderer.value.updateBackgrounds(this._model),this._rectangleRenderer.value.updateCursor(this._model)}_updateDimensions(){this._charSizeService.width&&this._charSizeService.height&&(this.dimensions.device.char.width=Math.floor(this._charSizeService.width*this._devicePixelRatio),this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*this._devicePixelRatio),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.top=this._optionsService.rawOptions.lineHeight===1?0:Math.round((this.dimensions.device.cell.height-this.dimensions.device.char.height)/2),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.char.left=Math.floor(this._optionsService.rawOptions.letterSpacing/2),this.dimensions.device.canvas.height=this._terminal.rows*this.dimensions.device.cell.height,this.dimensions.device.canvas.width=this._terminal.cols*this.dimensions.device.cell.width,this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/this._devicePixelRatio),this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/this._devicePixelRatio),this.dimensions.css.cell.height=this.dimensions.device.cell.height/this._devicePixelRatio,this.dimensions.css.cell.width=this.dimensions.device.cell.width/this._devicePixelRatio)}_setCanvasDevicePixelDimensions(R,N){this._canvas.width===R&&this._canvas.height===N||(this._canvas.width=R,this._canvas.height=N,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){const R=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:R,end:R})}}i.WebglRenderer=x;class k extends f.AttributeData{constructor(R,N,A){super(),this.content=0,this.combinedData="",this.fg=R.fg,this.bg=R.bg,this.combinedData=N,this._width=A}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(R){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}function M(D,R,N=0){return Math.max(Math.min(D,R),N)}i.JoinedCellData=k},381:(c,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.GLTexture=i.expandFloat32Array=i.createShader=i.createProgram=i.PROJECTION_MATRIX=void 0;const d=a(374);function g(l,m,v){const w=(0,d.throwIfFalsy)(l.createShader(m));if(l.shaderSource(w,v),l.compileShader(w),l.getShaderParameter(w,l.COMPILE_STATUS))return w;console.error(l.getShaderInfoLog(w)),l.deleteShader(w)}i.PROJECTION_MATRIX=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]),i.createProgram=function(l,m,v){const w=(0,d.throwIfFalsy)(l.createProgram());if(l.attachShader(w,(0,d.throwIfFalsy)(g(l,l.VERTEX_SHADER,m))),l.attachShader(w,(0,d.throwIfFalsy)(g(l,l.FRAGMENT_SHADER,v))),l.linkProgram(w),l.getProgramParameter(w,l.LINK_STATUS))return w;console.error(l.getProgramInfoLog(w)),l.deleteProgram(w)},i.createShader=g,i.expandFloat32Array=function(l,m){const v=Math.min(2*l.length,m),w=new Float32Array(v);for(let _=0;_<l.length;_++)w[_]=l[_];return w},i.GLTexture=class{constructor(l){this.texture=l,this.version=-1}}},592:(c,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.BaseRenderLayer=void 0;const d=a(627),g=a(237),l=a(374),m=a(859);class v extends m.Disposable{constructor(_,u,f,p,h,y,b,C){super(),this._container=u,this._alpha=h,this._coreBrowserService=y,this._optionsService=b,this._themeService=C,this._deviceCharWidth=0,this._deviceCharHeight=0,this._deviceCellWidth=0,this._deviceCellHeight=0,this._deviceCharLeft=0,this._deviceCharTop=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add(`xterm-${f}-layer`),this._canvas.style.zIndex=p.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this.register(this._themeService.onChangeColors(E=>{this._refreshCharAtlas(_,E),this.reset(_)})),this.register((0,m.toDisposable)(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=(0,l.throwIfFalsy)(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(_){}handleFocus(_){}handleCursorMove(_){}handleGridChanged(_,u,f){}handleSelectionChanged(_,u,f,p=!1){}_setTransparency(_,u){if(u===this._alpha)return;const f=this._canvas;this._alpha=u,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,f),this._refreshCharAtlas(_,this._themeService.colors),this.handleGridChanged(_,0,_.rows-1)}_refreshCharAtlas(_,u){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=(0,d.acquireTextureAtlas)(_,this._optionsService.rawOptions,u,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr),this._charAtlas.warmUp())}resize(_,u){this._deviceCellWidth=u.device.cell.width,this._deviceCellHeight=u.device.cell.height,this._deviceCharWidth=u.device.char.width,this._deviceCharHeight=u.device.char.height,this._deviceCharLeft=u.device.char.left,this._deviceCharTop=u.device.char.top,this._canvas.width=u.device.canvas.width,this._canvas.height=u.device.canvas.height,this._canvas.style.width=`${u.css.canvas.width}px`,this._canvas.style.height=`${u.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(_,this._themeService.colors)}_fillBottomLineAtCells(_,u,f=1){this._ctx.fillRect(_*this._deviceCellWidth,(u+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,f*this._deviceCellWidth,this._coreBrowserService.dpr)}_clearAll(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))}_clearCells(_,u,f,p){this._alpha?this._ctx.clearRect(_*this._deviceCellWidth,u*this._deviceCellHeight,f*this._deviceCellWidth,p*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(_*this._deviceCellWidth,u*this._deviceCellHeight,f*this._deviceCellWidth,p*this._deviceCellHeight))}_fillCharTrueColor(_,u,f,p){this._ctx.font=this._getFont(_,!1,!1),this._ctx.textBaseline=g.TEXT_BASELINE,this._clipCell(f,p,u.getWidth()),this._ctx.fillText(u.getChars(),f*this._deviceCellWidth+this._deviceCharLeft,p*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(_,u,f){this._ctx.beginPath(),this._ctx.rect(_*this._deviceCellWidth,u*this._deviceCellHeight,f*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(_,u,f){return`${f?"italic":""} ${u?_.options.fontWeightBold:_.options.fontWeight} ${_.options.fontSize*this._coreBrowserService.dpr}px ${_.options.fontFamily}`}}i.BaseRenderLayer=v},733:(c,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.LinkRenderLayer=void 0;const d=a(197),g=a(237),l=a(592);class m extends l.BaseRenderLayer{constructor(w,_,u,f,p,h,y){super(u,w,"link",_,!0,p,h,y),this.register(f.onShowLinkUnderline(b=>this._handleShowLinkUnderline(b))),this.register(f.onHideLinkUnderline(b=>this._handleHideLinkUnderline(b)))}resize(w,_){super.resize(w,_),this._state=void 0}reset(w){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);const w=this._state.y2-this._state.y1-1;w>0&&this._clearCells(0,this._state.y1+1,this._state.cols,w),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(w){if(w.fg===g.INVERTED_DEFAULT_COLOR?this._ctx.fillStyle=this._themeService.colors.background.css:w.fg!==void 0&&(0,d.is256Color)(w.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[w.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,w.y1===w.y2)this._fillBottomLineAtCells(w.x1,w.y1,w.x2-w.x1);else{this._fillBottomLineAtCells(w.x1,w.y1,w.cols-w.x1);for(let _=w.y1+1;_<w.y2;_++)this._fillBottomLineAtCells(0,_,w.cols);this._fillBottomLineAtCells(0,w.y2,w.x2)}this._state=w}_handleHideLinkUnderline(w){this._clearCurrentLink()}}i.LinkRenderLayer=m},820:(c,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.addDisposableDomListener=void 0,i.addDisposableDomListener=function(a,d,g,l){a.addEventListener(d,g,l);let m=!1;return{dispose:()=>{m||(m=!0,a.removeEventListener(d,g,l))}}}},274:(c,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.CellColorResolver=void 0;const d=a(855),g=a(160),l=a(374);let m,v=0,w=0,_=!1,u=!1,f=!1,p=0;i.CellColorResolver=class{constructor(h,y,b,C,E,x){this._terminal=h,this._optionService=y,this._selectionRenderModel=b,this._decorationService=C,this._coreBrowserService=E,this._themeService=x,this.result={fg:0,bg:0,ext:0}}resolve(h,y,b,C){if(this.result.bg=h.bg,this.result.fg=h.fg,this.result.ext=268435456&h.bg?h.extended.ext:0,w=0,v=0,u=!1,_=!1,f=!1,m=this._themeService.colors,p=0,h.getCode()!==d.NULL_CELL_CODE&&h.extended.underlineStyle===4){const E=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));p=y*C%(2*Math.round(E))}if(this._decorationService.forEachDecorationAtCell(y,b,"bottom",E=>{E.backgroundColorRGB&&(w=E.backgroundColorRGB.rgba>>8&16777215,u=!0),E.foregroundColorRGB&&(v=E.foregroundColorRGB.rgba>>8&16777215,_=!0)}),f=this._selectionRenderModel.isCellSelected(this._terminal,y,b),f){if(67108864&this.result.fg||50331648&this.result.bg){if(67108864&this.result.fg)switch(50331648&this.result.fg){case 16777216:case 33554432:w=this._themeService.colors.ansi[255&this.result.fg].rgba;break;case 50331648:w=(16777215&this.result.fg)<<8|255;break;default:w=this._themeService.colors.foreground.rgba}else switch(50331648&this.result.bg){case 16777216:case 33554432:w=this._themeService.colors.ansi[255&this.result.bg].rgba;break;case 50331648:w=(16777215&this.result.bg)<<8|255}w=g.rgba.blend(w,4294967040&(this._coreBrowserService.isFocused?m.selectionBackgroundOpaque:m.selectionInactiveBackgroundOpaque).rgba|128)>>8&16777215}else w=(this._coreBrowserService.isFocused?m.selectionBackgroundOpaque:m.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(u=!0,m.selectionForeground&&(v=m.selectionForeground.rgba>>8&16777215,_=!0),(0,l.treatGlyphAsBackgroundColor)(h.getCode())){if(67108864&this.result.fg&&!(50331648&this.result.bg))v=(this._coreBrowserService.isFocused?m.selectionBackgroundOpaque:m.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(67108864&this.result.fg)switch(50331648&this.result.bg){case 16777216:case 33554432:v=this._themeService.colors.ansi[255&this.result.bg].rgba;break;case 50331648:v=(16777215&this.result.bg)<<8|255}else switch(50331648&this.result.fg){case 16777216:case 33554432:v=this._themeService.colors.ansi[255&this.result.fg].rgba;break;case 50331648:v=(16777215&this.result.fg)<<8|255;break;default:v=this._themeService.colors.foreground.rgba}v=g.rgba.blend(v,4294967040&(this._coreBrowserService.isFocused?m.selectionBackgroundOpaque:m.selectionInactiveBackgroundOpaque).rgba|128)>>8&16777215}_=!0}}this._decorationService.forEachDecorationAtCell(y,b,"top",E=>{E.backgroundColorRGB&&(w=E.backgroundColorRGB.rgba>>8&16777215,u=!0),E.foregroundColorRGB&&(v=E.foregroundColorRGB.rgba>>8&16777215,_=!0)}),u&&(w=f?-16777216&h.bg&-134217729|w|50331648:-16777216&h.bg|w|50331648),_&&(v=-16777216&h.fg&-67108865|v|50331648),67108864&this.result.fg&&(u&&!_&&(v=50331648&this.result.bg?-134217728&this.result.fg|67108863&this.result.bg:-134217728&this.result.fg|16777215&m.background.rgba>>8|50331648,_=!0),!u&&_&&(w=50331648&this.result.fg?-67108864&this.result.bg|67108863&this.result.fg:-67108864&this.result.bg|16777215&m.foreground.rgba>>8|50331648,u=!0)),m=void 0,this.result.bg=u?w:this.result.bg,this.result.fg=_?v:this.result.fg,this.result.ext&=536870911,this.result.ext|=p<<29&3758096384}}},627:(c,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.removeTerminalFromCache=i.acquireTextureAtlas=void 0;const d=a(509),g=a(197),l=[];i.acquireTextureAtlas=function(m,v,w,_,u,f,p,h){const y=(0,g.generateConfig)(_,u,f,p,v,w,h);for(let E=0;E<l.length;E++){const x=l[E],k=x.ownedBy.indexOf(m);if(k>=0){if((0,g.configEquals)(x.config,y))return x.atlas;x.ownedBy.length===1?(x.atlas.dispose(),l.splice(E,1)):x.ownedBy.splice(k,1);break}}for(let E=0;E<l.length;E++){const x=l[E];if((0,g.configEquals)(x.config,y))return x.ownedBy.push(m),x.atlas}const b=m._core,C={atlas:new d.TextureAtlas(document,y,b.unicodeService),config:y,ownedBy:[m]};return l.push(C),C.atlas},i.removeTerminalFromCache=function(m){for(let v=0;v<l.length;v++){const w=l[v].ownedBy.indexOf(m);if(w!==-1){l[v].ownedBy.length===1?(l[v].atlas.dispose(),l.splice(v,1)):l[v].ownedBy.splice(w,1);break}}}},197:(c,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.is256Color=i.configEquals=i.generateConfig=void 0;const d=a(160);i.generateConfig=function(g,l,m,v,w,_,u){const f={foreground:_.foreground,background:_.background,cursor:d.NULL_COLOR,cursorAccent:d.NULL_COLOR,selectionForeground:d.NULL_COLOR,selectionBackgroundTransparent:d.NULL_COLOR,selectionBackgroundOpaque:d.NULL_COLOR,selectionInactiveBackgroundTransparent:d.NULL_COLOR,selectionInactiveBackgroundOpaque:d.NULL_COLOR,ansi:_.ansi.slice(),contrastCache:_.contrastCache,halfContrastCache:_.halfContrastCache};return{customGlyphs:w.customGlyphs,devicePixelRatio:u,letterSpacing:w.letterSpacing,lineHeight:w.lineHeight,deviceCellWidth:g,deviceCellHeight:l,deviceCharWidth:m,deviceCharHeight:v,fontFamily:w.fontFamily,fontSize:w.fontSize,fontWeight:w.fontWeight,fontWeightBold:w.fontWeightBold,allowTransparency:w.allowTransparency,drawBoldTextInBrightColors:w.drawBoldTextInBrightColors,minimumContrastRatio:w.minimumContrastRatio,colors:f}},i.configEquals=function(g,l){for(let m=0;m<g.colors.ansi.length;m++)if(g.colors.ansi[m].rgba!==l.colors.ansi[m].rgba)return!1;return g.devicePixelRatio===l.devicePixelRatio&&g.customGlyphs===l.customGlyphs&&g.lineHeight===l.lineHeight&&g.letterSpacing===l.letterSpacing&&g.fontFamily===l.fontFamily&&g.fontSize===l.fontSize&&g.fontWeight===l.fontWeight&&g.fontWeightBold===l.fontWeightBold&&g.allowTransparency===l.allowTransparency&&g.deviceCharWidth===l.deviceCharWidth&&g.deviceCharHeight===l.deviceCharHeight&&g.drawBoldTextInBrightColors===l.drawBoldTextInBrightColors&&g.minimumContrastRatio===l.minimumContrastRatio&&g.colors.foreground.rgba===l.colors.foreground.rgba&&g.colors.background.rgba===l.colors.background.rgba},i.is256Color=function(g){return(50331648&g)==16777216||(50331648&g)==33554432}},237:(c,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.TEXT_BASELINE=i.DIM_OPACITY=i.INVERTED_DEFAULT_COLOR=void 0;const d=a(399);i.INVERTED_DEFAULT_COLOR=257,i.DIM_OPACITY=.5,i.TEXT_BASELINE=d.isFirefox||d.isLegacyEdge?"bottom":"ideographic"},457:(c,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.CursorBlinkStateManager=void 0,i.CursorBlinkStateManager=class{constructor(a,d){this._renderCallback=a,this._coreBrowserService=d,this.isCursorVisible=!0,this._coreBrowserService.isFocused&&this._restartInterval()}get isPaused(){return!(this._blinkStartTimeout||this._blinkInterval)}dispose(){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}restartBlinkAnimation(){this.isPaused||(this._animationTimeRestarted=Date.now(),this.isCursorVisible=!0,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})))}_restartInterval(a=600){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout(()=>{if(this._animationTimeRestarted){const d=600-(Date.now()-this._animationTimeRestarted);if(this._animationTimeRestarted=void 0,d>0)return void this._restartInterval(d)}this.isCursorVisible=!1,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0}),this._blinkInterval=this._coreBrowserService.window.setInterval(()=>{if(this._animationTimeRestarted){const d=600-(Date.now()-this._animationTimeRestarted);return this._animationTimeRestarted=void 0,void this._restartInterval(d)}this.isCursorVisible=!this.isCursorVisible,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})},600)},a)}pause(){this.isCursorVisible=!0,this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}resume(){this.pause(),this._animationTimeRestarted=void 0,this._restartInterval(),this.restartBlinkAnimation()}}},860:(c,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.tryDrawCustomChar=i.powerlineDefinitions=i.boxDrawingDefinitions=i.blockElementDefinitions=void 0;const d=a(374);i.blockElementDefinitions={"▀":[{x:0,y:0,w:8,h:4}],"▁":[{x:0,y:7,w:8,h:1}],"▂":[{x:0,y:6,w:8,h:2}],"▃":[{x:0,y:5,w:8,h:3}],"▄":[{x:0,y:4,w:8,h:4}],"▅":[{x:0,y:3,w:8,h:5}],"▆":[{x:0,y:2,w:8,h:6}],"▇":[{x:0,y:1,w:8,h:7}],"█":[{x:0,y:0,w:8,h:8}],"▉":[{x:0,y:0,w:7,h:8}],"▊":[{x:0,y:0,w:6,h:8}],"▋":[{x:0,y:0,w:5,h:8}],"▌":[{x:0,y:0,w:4,h:8}],"▍":[{x:0,y:0,w:3,h:8}],"▎":[{x:0,y:0,w:2,h:8}],"▏":[{x:0,y:0,w:1,h:8}],"▐":[{x:4,y:0,w:4,h:8}],"▔":[{x:0,y:0,w:8,h:1}],"▕":[{x:7,y:0,w:1,h:8}],"▖":[{x:0,y:4,w:4,h:4}],"▗":[{x:4,y:4,w:4,h:4}],"▘":[{x:0,y:0,w:4,h:4}],"▙":[{x:0,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"▚":[{x:0,y:0,w:4,h:4},{x:4,y:4,w:4,h:4}],"▛":[{x:0,y:0,w:4,h:8},{x:4,y:0,w:4,h:4}],"▜":[{x:0,y:0,w:8,h:4},{x:4,y:0,w:4,h:8}],"▝":[{x:4,y:0,w:4,h:4}],"▞":[{x:4,y:0,w:4,h:4},{x:0,y:4,w:4,h:4}],"▟":[{x:4,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"🭰":[{x:1,y:0,w:1,h:8}],"🭱":[{x:2,y:0,w:1,h:8}],"🭲":[{x:3,y:0,w:1,h:8}],"🭳":[{x:4,y:0,w:1,h:8}],"🭴":[{x:5,y:0,w:1,h:8}],"🭵":[{x:6,y:0,w:1,h:8}],"🭶":[{x:0,y:1,w:8,h:1}],"🭷":[{x:0,y:2,w:8,h:1}],"🭸":[{x:0,y:3,w:8,h:1}],"🭹":[{x:0,y:4,w:8,h:1}],"🭺":[{x:0,y:5,w:8,h:1}],"🭻":[{x:0,y:6,w:8,h:1}],"🭼":[{x:0,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🭽":[{x:0,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭾":[{x:7,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭿":[{x:7,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🮀":[{x:0,y:0,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮁":[{x:0,y:0,w:8,h:1},{x:0,y:2,w:8,h:1},{x:0,y:4,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮂":[{x:0,y:0,w:8,h:2}],"🮃":[{x:0,y:0,w:8,h:3}],"🮄":[{x:0,y:0,w:8,h:5}],"🮅":[{x:0,y:0,w:8,h:6}],"🮆":[{x:0,y:0,w:8,h:7}],"🮇":[{x:6,y:0,w:2,h:8}],"🮈":[{x:5,y:0,w:3,h:8}],"🮉":[{x:3,y:0,w:5,h:8}],"🮊":[{x:2,y:0,w:6,h:8}],"🮋":[{x:1,y:0,w:7,h:8}],"🮕":[{x:0,y:0,w:2,h:2},{x:4,y:0,w:2,h:2},{x:2,y:2,w:2,h:2},{x:6,y:2,w:2,h:2},{x:0,y:4,w:2,h:2},{x:4,y:4,w:2,h:2},{x:2,y:6,w:2,h:2},{x:6,y:6,w:2,h:2}],"🮖":[{x:2,y:0,w:2,h:2},{x:6,y:0,w:2,h:2},{x:0,y:2,w:2,h:2},{x:4,y:2,w:2,h:2},{x:2,y:4,w:2,h:2},{x:6,y:4,w:2,h:2},{x:0,y:6,w:2,h:2},{x:4,y:6,w:2,h:2}],"🮗":[{x:0,y:2,w:8,h:2},{x:0,y:6,w:8,h:2}]};const g={"░":[[1,0,0,0],[0,0,0,0],[0,0,1,0],[0,0,0,0]],"▒":[[1,0],[0,0],[0,1],[0,0]],"▓":[[0,1],[1,1],[1,0],[1,1]]};i.boxDrawingDefinitions={"─":{1:"M0,.5 L1,.5"},"━":{3:"M0,.5 L1,.5"},"│":{1:"M.5,0 L.5,1"},"┃":{3:"M.5,0 L.5,1"},"┌":{1:"M0.5,1 L.5,.5 L1,.5"},"┏":{3:"M0.5,1 L.5,.5 L1,.5"},"┐":{1:"M0,.5 L.5,.5 L.5,1"},"┓":{3:"M0,.5 L.5,.5 L.5,1"},"└":{1:"M.5,0 L.5,.5 L1,.5"},"┗":{3:"M.5,0 L.5,.5 L1,.5"},"┘":{1:"M.5,0 L.5,.5 L0,.5"},"┛":{3:"M.5,0 L.5,.5 L0,.5"},"├":{1:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┣":{3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┤":{1:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┫":{3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┬":{1:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┳":{3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┴":{1:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┻":{3:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┼":{1:"M0,.5 L1,.5 M.5,0 L.5,1"},"╋":{3:"M0,.5 L1,.5 M.5,0 L.5,1"},"╴":{1:"M.5,.5 L0,.5"},"╸":{3:"M.5,.5 L0,.5"},"╵":{1:"M.5,.5 L.5,0"},"╹":{3:"M.5,.5 L.5,0"},"╶":{1:"M.5,.5 L1,.5"},"╺":{3:"M.5,.5 L1,.5"},"╷":{1:"M.5,.5 L.5,1"},"╻":{3:"M.5,.5 L.5,1"},"═":{1:(_,u)=>`M0,${.5-u} L1,${.5-u} M0,${.5+u} L1,${.5+u}`},"║":{1:(_,u)=>`M${.5-_},0 L${.5-_},1 M${.5+_},0 L${.5+_},1`},"╒":{1:(_,u)=>`M.5,1 L.5,${.5-u} L1,${.5-u} M.5,${.5+u} L1,${.5+u}`},"╓":{1:(_,u)=>`M${.5-_},1 L${.5-_},.5 L1,.5 M${.5+_},.5 L${.5+_},1`},"╔":{1:(_,u)=>`M1,${.5-u} L${.5-_},${.5-u} L${.5-_},1 M1,${.5+u} L${.5+_},${.5+u} L${.5+_},1`},"╕":{1:(_,u)=>`M0,${.5-u} L.5,${.5-u} L.5,1 M0,${.5+u} L.5,${.5+u}`},"╖":{1:(_,u)=>`M${.5+_},1 L${.5+_},.5 L0,.5 M${.5-_},.5 L${.5-_},1`},"╗":{1:(_,u)=>`M0,${.5+u} L${.5-_},${.5+u} L${.5-_},1 M0,${.5-u} L${.5+_},${.5-u} L${.5+_},1`},"╘":{1:(_,u)=>`M.5,0 L.5,${.5+u} L1,${.5+u} M.5,${.5-u} L1,${.5-u}`},"╙":{1:(_,u)=>`M1,.5 L${.5-_},.5 L${.5-_},0 M${.5+_},.5 L${.5+_},0`},"╚":{1:(_,u)=>`M1,${.5-u} L${.5+_},${.5-u} L${.5+_},0 M1,${.5+u} L${.5-_},${.5+u} L${.5-_},0`},"╛":{1:(_,u)=>`M0,${.5+u} L.5,${.5+u} L.5,0 M0,${.5-u} L.5,${.5-u}`},"╜":{1:(_,u)=>`M0,.5 L${.5+_},.5 L${.5+_},0 M${.5-_},.5 L${.5-_},0`},"╝":{1:(_,u)=>`M0,${.5-u} L${.5-_},${.5-u} L${.5-_},0 M0,${.5+u} L${.5+_},${.5+u} L${.5+_},0`},"╞":{1:(_,u)=>`M.5,0 L.5,1 M.5,${.5-u} L1,${.5-u} M.5,${.5+u} L1,${.5+u}`},"╟":{1:(_,u)=>`M${.5-_},0 L${.5-_},1 M${.5+_},0 L${.5+_},1 M${.5+_},.5 L1,.5`},"╠":{1:(_,u)=>`M${.5-_},0 L${.5-_},1 M1,${.5+u} L${.5+_},${.5+u} L${.5+_},1 M1,${.5-u} L${.5+_},${.5-u} L${.5+_},0`},"╡":{1:(_,u)=>`M.5,0 L.5,1 M0,${.5-u} L.5,${.5-u} M0,${.5+u} L.5,${.5+u}`},"╢":{1:(_,u)=>`M0,.5 L${.5-_},.5 M${.5-_},0 L${.5-_},1 M${.5+_},0 L${.5+_},1`},"╣":{1:(_,u)=>`M${.5+_},0 L${.5+_},1 M0,${.5+u} L${.5-_},${.5+u} L${.5-_},1 M0,${.5-u} L${.5-_},${.5-u} L${.5-_},0`},"╤":{1:(_,u)=>`M0,${.5-u} L1,${.5-u} M0,${.5+u} L1,${.5+u} M.5,${.5+u} L.5,1`},"╥":{1:(_,u)=>`M0,.5 L1,.5 M${.5-_},.5 L${.5-_},1 M${.5+_},.5 L${.5+_},1`},"╦":{1:(_,u)=>`M0,${.5-u} L1,${.5-u} M0,${.5+u} L${.5-_},${.5+u} L${.5-_},1 M1,${.5+u} L${.5+_},${.5+u} L${.5+_},1`},"╧":{1:(_,u)=>`M.5,0 L.5,${.5-u} M0,${.5-u} L1,${.5-u} M0,${.5+u} L1,${.5+u}`},"╨":{1:(_,u)=>`M0,.5 L1,.5 M${.5-_},.5 L${.5-_},0 M${.5+_},.5 L${.5+_},0`},"╩":{1:(_,u)=>`M0,${.5+u} L1,${.5+u} M0,${.5-u} L${.5-_},${.5-u} L${.5-_},0 M1,${.5-u} L${.5+_},${.5-u} L${.5+_},0`},"╪":{1:(_,u)=>`M.5,0 L.5,1 M0,${.5-u} L1,${.5-u} M0,${.5+u} L1,${.5+u}`},"╫":{1:(_,u)=>`M0,.5 L1,.5 M${.5-_},0 L${.5-_},1 M${.5+_},0 L${.5+_},1`},"╬":{1:(_,u)=>`M0,${.5+u} L${.5-_},${.5+u} L${.5-_},1 M1,${.5+u} L${.5+_},${.5+u} L${.5+_},1 M0,${.5-u} L${.5-_},${.5-u} L${.5-_},0 M1,${.5-u} L${.5+_},${.5-u} L${.5+_},0`},"╱":{1:"M1,0 L0,1"},"╲":{1:"M0,0 L1,1"},"╳":{1:"M1,0 L0,1 M0,0 L1,1"},"╼":{1:"M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"╽":{1:"M.5,.5 L.5,0",3:"M.5,.5 L.5,1"},"╾":{1:"M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"╿":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┍":{1:"M.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┎":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┑":{1:"M.5,.5 L.5,1",3:"M.5,.5 L0,.5"},"┒":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┕":{1:"M.5,.5 L.5,0",3:"M.5,.5 L1,.5"},"┖":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┙":{1:"M.5,.5 L.5,0",3:"M.5,.5 L0,.5"},"┚":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,0"},"┝":{1:"M.5,0 L.5,1",3:"M.5,.5 L1,.5"},"┞":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┟":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┠":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1"},"┡":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"┢":{1:"M.5,.5 L.5,0",3:"M0.5,1 L.5,.5 L1,.5"},"┥":{1:"M.5,0 L.5,1",3:"M.5,.5 L0,.5"},"┦":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┧":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┨":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1"},"┩":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L0,.5"},"┪":{1:"M.5,.5 L.5,0",3:"M0,.5 L.5,.5 L.5,1"},"┭":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┮":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┯":{1:"M.5,.5 L.5,1",3:"M0,.5 L1,.5"},"┰":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"┱":{1:"M.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"┲":{1:"M.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"┵":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┶":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┷":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5"},"┸":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,0"},"┹":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"┺":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,.5 L1,.5"},"┽":{1:"M.5,0 L.5,1 M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┾":{1:"M.5,0 L.5,1 M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┿":{1:"M.5,0 L.5,1",3:"M0,.5 L1,.5"},"╀":{1:"M0,.5 L1,.5 M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"╁":{1:"M.5,.5 L.5,0 M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"╂":{1:"M0,.5 L1,.5",3:"M.5,0 L.5,1"},"╃":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"╄":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"╅":{1:"M.5,0 L.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"╆":{1:"M.5,0 L.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"╇":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0 M0,.5 L1,.5"},"╈":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"╉":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"╊":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"╌":{1:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"╍":{3:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"┄":{1:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┅":{3:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┈":{1:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"┉":{3:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"╎":{1:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"╏":{3:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"┆":{1:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┇":{3:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┊":{1:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"┋":{3:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"╭":{1:(_,u)=>`M.5,1 L.5,${.5+u/.15*.5} C.5,${.5+u/.15*.5},.5,.5,1,.5`},"╮":{1:(_,u)=>`M.5,1 L.5,${.5+u/.15*.5} C.5,${.5+u/.15*.5},.5,.5,0,.5`},"╯":{1:(_,u)=>`M.5,0 L.5,${.5-u/.15*.5} C.5,${.5-u/.15*.5},.5,.5,0,.5`},"╰":{1:(_,u)=>`M.5,0 L.5,${.5-u/.15*.5} C.5,${.5-u/.15*.5},.5,.5,1,.5`}},i.powerlineDefinitions={"":{d:"M0,0 L1,.5 L0,1",type:0,rightPadding:2},"":{d:"M-1,-.5 L1,.5 L-1,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1,0 L0,.5 L1,1",type:0,leftPadding:2},"":{d:"M2,-.5 L0,.5 L2,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M0,0 L0,1 C0.552,1,1,0.776,1,.5 C1,0.224,0.552,0,0,0",type:0,rightPadding:1},"":{d:"M.2,1 C.422,1,.8,.826,.78,.5 C.8,.174,0.422,0,.2,0",type:1,rightPadding:1},"":{d:"M1,0 L1,1 C0.448,1,0,0.776,0,.5 C0,0.224,0.448,0,1,0",type:0,leftPadding:1},"":{d:"M.8,1 C0.578,1,0.2,.826,.22,.5 C0.2,0.174,0.578,0,0.8,0",type:1,leftPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L-.5,1.5",type:0},"":{d:"M-.5,-.5 L1.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1.5,-.5 L-.5,1.5 L1.5,1.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5 L-.5,-.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L1.5,-.5",type:0}},i.powerlineDefinitions[""]=i.powerlineDefinitions[""],i.powerlineDefinitions[""]=i.powerlineDefinitions[""],i.tryDrawCustomChar=function(_,u,f,p,h,y,b,C){const E=i.blockElementDefinitions[u];if(E)return function(D,R,N,A,$,F){for(let H=0;H<R.length;H++){const I=R[H],L=$/8,T=F/8;D.fillRect(N+I.x*L,A+I.y*T,I.w*L,I.h*T)}}(_,E,f,p,h,y),!0;const x=g[u];if(x)return function(D,R,N,A,$,F){let H=l.get(R);H||(H=new Map,l.set(R,H));const I=D.fillStyle;if(typeof I!="string")throw new Error(`Unexpected fillStyle type "${I}"`);let L=H.get(I);if(!L){const T=R[0].length,j=R.length,O=D.canvas.ownerDocument.createElement("canvas");O.width=T,O.height=j;const V=(0,d.throwIfFalsy)(O.getContext("2d")),q=new ImageData(T,j);let J,Q,z,P;if(I.startsWith("#"))J=parseInt(I.slice(1,3),16),Q=parseInt(I.slice(3,5),16),z=parseInt(I.slice(5,7),16),P=I.length>7&&parseInt(I.slice(7,9),16)||1;else{if(!I.startsWith("rgba"))throw new Error(`Unexpected fillStyle color format "${I}" when drawing pattern glyph`);[J,Q,z,P]=I.substring(5,I.length-1).split(",").map(K=>parseFloat(K))}for(let K=0;K<j;K++)for(let U=0;U<T;U++)q.data[4*(K*T+U)]=J,q.data[4*(K*T+U)+1]=Q,q.data[4*(K*T+U)+2]=z,q.data[4*(K*T+U)+3]=R[K][U]*(255*P);V.putImageData(q,0,0),L=(0,d.throwIfFalsy)(D.createPattern(O,null)),H.set(I,L)}D.fillStyle=L,D.fillRect(N,A,$,F)}(_,x,f,p,h,y),!0;const k=i.boxDrawingDefinitions[u];if(k)return function(D,R,N,A,$,F,H){D.strokeStyle=D.fillStyle;for(const[I,L]of Object.entries(R)){let T;D.beginPath(),D.lineWidth=H*Number.parseInt(I),T=typeof L=="function"?L(.15,.15/F*$):L;for(const j of T.split(" ")){const O=j[0],V=v[O];if(!V){console.error(`Could not find drawing instructions for "${O}"`);continue}const q=j.substring(1).split(",");q[0]&&q[1]&&V(D,w(q,$,F,N,A,!0,H))}D.stroke(),D.closePath()}}(_,k,f,p,h,y,C),!0;const M=i.powerlineDefinitions[u];return!!M&&(function(D,R,N,A,$,F,H,I){const L=new Path2D;L.rect(N,A,$,F),D.clip(L),D.beginPath();const T=H/12;D.lineWidth=I*T;for(const j of R.d.split(" ")){const O=j[0],V=v[O];if(!V){console.error(`Could not find drawing instructions for "${O}"`);continue}const q=j.substring(1).split(",");q[0]&&q[1]&&V(D,w(q,$,F,N,A,!1,I,(R.leftPadding??0)*(T/2),(R.rightPadding??0)*(T/2)))}R.type===1?(D.strokeStyle=D.fillStyle,D.stroke()):D.fill(),D.closePath()}(_,M,f,p,h,y,b,C),!0)};const l=new Map;function m(_,u,f=0){return Math.max(Math.min(_,u),f)}const v={C:(_,u)=>_.bezierCurveTo(u[0],u[1],u[2],u[3],u[4],u[5]),L:(_,u)=>_.lineTo(u[0],u[1]),M:(_,u)=>_.moveTo(u[0],u[1])};function w(_,u,f,p,h,y,b,C=0,E=0){const x=_.map(k=>parseFloat(k)||parseInt(k));if(x.length<2)throw new Error("Too few arguments for instruction");for(let k=0;k<x.length;k+=2)x[k]*=u-C*b-E*b,y&&x[k]!==0&&(x[k]=m(Math.round(x[k]+.5)-.5,u,0)),x[k]+=p+C*b;for(let k=1;k<x.length;k+=2)x[k]*=f,y&&x[k]!==0&&(x[k]=m(Math.round(x[k]+.5)-.5,f,0)),x[k]+=h;return x}},56:(c,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.observeDevicePixelDimensions=void 0;const d=a(859);i.observeDevicePixelDimensions=function(g,l,m){let v=new l.ResizeObserver(w=>{const _=w.find(p=>p.target===g);if(!_)return;if(!("devicePixelContentBoxSize"in _))return v==null||v.disconnect(),void(v=void 0);const u=_.devicePixelContentBoxSize[0].inlineSize,f=_.devicePixelContentBoxSize[0].blockSize;u>0&&f>0&&m(u,f)});try{v.observe(g,{box:["device-pixel-content-box"]})}catch{v.disconnect(),v=void 0}return(0,d.toDisposable)(()=>v==null?void 0:v.disconnect())}},374:(c,i)=>{function a(g){return 57508<=g&&g<=57558}function d(g){return g>=128512&&g<=128591||g>=127744&&g<=128511||g>=128640&&g<=128767||g>=9728&&g<=9983||g>=9984&&g<=10175||g>=65024&&g<=65039||g>=129280&&g<=129535||g>=127462&&g<=127487}Object.defineProperty(i,"__esModule",{value:!0}),i.computeNextVariantOffset=i.createRenderDimensions=i.treatGlyphAsBackgroundColor=i.allowRescaling=i.isEmoji=i.isRestrictedPowerlineGlyph=i.isPowerlineGlyph=i.throwIfFalsy=void 0,i.throwIfFalsy=function(g){if(!g)throw new Error("value must not be falsy");return g},i.isPowerlineGlyph=a,i.isRestrictedPowerlineGlyph=function(g){return 57520<=g&&g<=57527},i.isEmoji=d,i.allowRescaling=function(g,l,m,v){return l===1&&m>Math.ceil(1.5*v)&&g!==void 0&&g>255&&!d(g)&&!a(g)&&!function(w){return 57344<=w&&w<=63743}(g)},i.treatGlyphAsBackgroundColor=function(g){return a(g)||function(l){return 9472<=l&&l<=9631}(g)},i.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},i.computeNextVariantOffset=function(g,l,m=0){return(g-(2*Math.round(l)-m))%(2*Math.round(l))}},296:(c,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.createSelectionRenderModel=void 0;class a{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(g,l,m,v=!1){if(this.selectionStart=l,this.selectionEnd=m,!l||!m||l[0]===m[0]&&l[1]===m[1])return void this.clear();const w=g.buffers.active.ydisp,_=l[1]-w,u=m[1]-w,f=Math.max(_,0),p=Math.min(u,g.rows-1);f>=g.rows||p<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=v,this.viewportStartRow=_,this.viewportEndRow=u,this.viewportCappedStartRow=f,this.viewportCappedEndRow=p,this.startCol=l[0],this.endCol=m[0])}isCellSelected(g,l,m){return!!this.hasSelection&&(m-=g.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?l>=this.startCol&&m>=this.viewportCappedStartRow&&l<this.endCol&&m<=this.viewportCappedEndRow:l<this.startCol&&m>=this.viewportCappedStartRow&&l>=this.endCol&&m<=this.viewportCappedEndRow:m>this.viewportStartRow&&m<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&m===this.viewportStartRow&&l>=this.startCol&&l<this.endCol||this.viewportStartRow<this.viewportEndRow&&m===this.viewportEndRow&&l<this.endCol||this.viewportStartRow<this.viewportEndRow&&m===this.viewportStartRow&&l>=this.startCol)}}i.createSelectionRenderModel=function(){return new a}},509:(c,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.TextureAtlas=void 0;const d=a(237),g=a(860),l=a(374),m=a(160),v=a(345),w=a(485),_=a(385),u=a(147),f=a(855),p={texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},offset:{x:0,y:0},size:{x:0,y:0},sizeClipSpace:{x:0,y:0}};let h;class y{get pages(){return this._pages}constructor(k,M,D){this._document=k,this._config=M,this._unicodeService=D,this._didWarmUp=!1,this._cacheMap=new w.FourKeyMap,this._cacheMapCombined=new w.FourKeyMap,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new u.AttributeData,this._textureSize=512,this._onAddTextureAtlasCanvas=new v.EventEmitter,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new v.EventEmitter,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=E(k,4*this._config.deviceCellWidth+4,this._config.deviceCellHeight+4),this._tmpCtx=(0,l.throwIfFalsy)(this._tmpCanvas.getContext("2d",{alpha:this._config.allowTransparency,willReadFrequently:!0}))}dispose(){for(const k of this.pages)k.canvas.remove();this._onAddTextureAtlasCanvas.dispose()}warmUp(){this._didWarmUp||(this._doWarmUp(),this._didWarmUp=!0)}_doWarmUp(){const k=new _.IdleTaskQueue;for(let M=33;M<126;M++)k.enqueue(()=>{if(!this._cacheMap.get(M,f.DEFAULT_COLOR,f.DEFAULT_COLOR,f.DEFAULT_EXT)){const D=this._drawToCache(M,f.DEFAULT_COLOR,f.DEFAULT_COLOR,f.DEFAULT_EXT);this._cacheMap.set(M,f.DEFAULT_COLOR,f.DEFAULT_COLOR,f.DEFAULT_EXT,D)}})}beginFrame(){return this._requestClearModel}clearTexture(){if(this._pages[0].currentRow.x!==0||this._pages[0].currentRow.y!==0){for(const k of this._pages)k.clear();this._cacheMap.clear(),this._cacheMapCombined.clear(),this._didWarmUp=!1}}_createNewPage(){if(y.maxAtlasPages&&this._pages.length>=Math.max(4,y.maxAtlasPages)){const M=this._pages.filter(H=>2*H.canvas.width<=(y.maxTextureSize||4096)).sort((H,I)=>I.canvas.width!==H.canvas.width?I.canvas.width-H.canvas.width:I.percentageUsed-H.percentageUsed);let D=-1,R=0;for(let H=0;H<M.length;H++)if(M[H].canvas.width!==R)D=H,R=M[H].canvas.width;else if(H-D==3)break;const N=M.slice(D,D+4),A=N.map(H=>H.glyphs[0].texturePage).sort((H,I)=>H>I?1:-1),$=this.pages.length-N.length,F=this._mergePages(N,$);F.version++;for(let H=A.length-1;H>=0;H--)this._deletePage(A[H]);this.pages.push(F),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(F.canvas)}const k=new b(this._document,this._textureSize);return this._pages.push(k),this._activePages.push(k),this._onAddTextureAtlasCanvas.fire(k.canvas),k}_mergePages(k,M){const D=2*k[0].canvas.width,R=new b(this._document,D,k);for(const[N,A]of k.entries()){const $=N*A.canvas.width%D,F=Math.floor(N/2)*A.canvas.height;R.ctx.drawImage(A.canvas,$,F);for(const I of A.glyphs)I.texturePage=M,I.sizeClipSpace.x=I.size.x/D,I.sizeClipSpace.y=I.size.y/D,I.texturePosition.x+=$,I.texturePosition.y+=F,I.texturePositionClipSpace.x=I.texturePosition.x/D,I.texturePositionClipSpace.y=I.texturePosition.y/D;this._onRemoveTextureAtlasCanvas.fire(A.canvas);const H=this._activePages.indexOf(A);H!==-1&&this._activePages.splice(H,1)}return R}_deletePage(k){this._pages.splice(k,1);for(let M=k;M<this._pages.length;M++){const D=this._pages[M];for(const R of D.glyphs)R.texturePage--;D.version++}}getRasterizedGlyphCombinedChar(k,M,D,R,N){return this._getFromCacheMap(this._cacheMapCombined,k,M,D,R,N)}getRasterizedGlyph(k,M,D,R,N){return this._getFromCacheMap(this._cacheMap,k,M,D,R,N)}_getFromCacheMap(k,M,D,R,N,A=!1){return h=k.get(M,D,R,N),h||(h=this._drawToCache(M,D,R,N,A),k.set(M,D,R,N,h)),h}_getColorFromAnsiIndex(k){if(k>=this._config.colors.ansi.length)throw new Error("No color found for idx "+k);return this._config.colors.ansi[k]}_getBackgroundColor(k,M,D,R){if(this._config.allowTransparency)return m.NULL_COLOR;let N;switch(k){case 16777216:case 33554432:N=this._getColorFromAnsiIndex(M);break;case 50331648:const A=u.AttributeData.toColorRGB(M);N=m.channels.toColor(A[0],A[1],A[2]);break;default:N=D?m.color.opaque(this._config.colors.foreground):this._config.colors.background}return N}_getForegroundColor(k,M,D,R,N,A,$,F,H,I){const L=this._getMinimumContrastColor(k,M,D,R,N,A,$,H,F,I);if(L)return L;let T;switch(N){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&H&&A<8&&(A+=8),T=this._getColorFromAnsiIndex(A);break;case 50331648:const j=u.AttributeData.toColorRGB(A);T=m.channels.toColor(j[0],j[1],j[2]);break;default:T=$?this._config.colors.background:this._config.colors.foreground}return this._config.allowTransparency&&(T=m.color.opaque(T)),F&&(T=m.color.multiplyOpacity(T,d.DIM_OPACITY)),T}_resolveBackgroundRgba(k,M,D){switch(k){case 16777216:case 33554432:return this._getColorFromAnsiIndex(M).rgba;case 50331648:return M<<8;default:return D?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(k,M,D,R){switch(k){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&R&&M<8&&(M+=8),this._getColorFromAnsiIndex(M).rgba;case 50331648:return M<<8;default:return D?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(k,M,D,R,N,A,$,F,H,I){if(this._config.minimumContrastRatio===1||I)return;const L=this._getContrastCache(H),T=L.getColor(k,R);if(T!==void 0)return T||void 0;const j=this._resolveBackgroundRgba(M,D,$),O=this._resolveForegroundRgba(N,A,$,F),V=m.rgba.ensureContrastRatio(j,O,this._config.minimumContrastRatio/(H?2:1));if(!V)return void L.setColor(k,R,null);const q=m.channels.toColor(V>>24&255,V>>16&255,V>>8&255);return L.setColor(k,R,q),q}_getContrastCache(k){return k?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(k,M,D,R,N=!1){const A=typeof k=="number"?String.fromCharCode(k):k,$=Math.min(this._config.deviceCellWidth*Math.max(A.length,2)+4,this._textureSize);this._tmpCanvas.width<$&&(this._tmpCanvas.width=$);const F=Math.min(this._config.deviceCellHeight+8,this._textureSize);if(this._tmpCanvas.height<F&&(this._tmpCanvas.height=F),this._tmpCtx.save(),this._workAttributeData.fg=D,this._workAttributeData.bg=M,this._workAttributeData.extended.ext=R,this._workAttributeData.isInvisible())return p;const H=!!this._workAttributeData.isBold(),I=!!this._workAttributeData.isInverse(),L=!!this._workAttributeData.isDim(),T=!!this._workAttributeData.isItalic(),j=!!this._workAttributeData.isUnderline(),O=!!this._workAttributeData.isStrikethrough(),V=!!this._workAttributeData.isOverline();let q=this._workAttributeData.getFgColor(),J=this._workAttributeData.getFgColorMode(),Q=this._workAttributeData.getBgColor(),z=this._workAttributeData.getBgColorMode();if(I){const le=q;q=Q,Q=le;const _e=J;J=z,z=_e}const P=this._getBackgroundColor(z,Q,I,L);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=P.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";const K=H?this._config.fontWeightBold:this._config.fontWeight,U=T?"italic":"";this._tmpCtx.font=`${U} ${K} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=d.TEXT_BASELINE;const Z=A.length===1&&(0,l.isPowerlineGlyph)(A.charCodeAt(0)),Y=A.length===1&&(0,l.isRestrictedPowerlineGlyph)(A.charCodeAt(0)),ne=this._getForegroundColor(M,z,Q,D,J,q,I,L,H,(0,l.treatGlyphAsBackgroundColor)(A.charCodeAt(0)));this._tmpCtx.fillStyle=ne.css;const ie=Y?0:4;let ce=!1;this._config.customGlyphs!==!1&&(ce=(0,g.tryDrawCustomChar)(this._tmpCtx,A,ie,ie,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let fe,ae=!Z;if(fe=typeof k=="number"?this._unicodeService.wcwidth(k):this._unicodeService.getStringCellWidth(k),j){this._tmpCtx.save();const le=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),_e=le%2==1?.5:0;if(this._tmpCtx.lineWidth=le,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())ae=!1,this._tmpCtx.strokeStyle=`rgb(${u.AttributeData.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{ae=!1;let Me=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&Me<8&&(Me+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(Me).css}this._tmpCtx.beginPath();const Ce=ie,ke=Math.ceil(ie+this._config.deviceCharHeight)-_e-(N?2*le:0),$e=ke+le,Be=ke+2*le;let Fe=this._workAttributeData.getUnderlineVariantOffset();for(let Me=0;Me<fe;Me++){this._tmpCtx.save();const De=Ce+Me*this._config.deviceCellWidth,Se=Ce+(Me+1)*this._config.deviceCellWidth,vt=De+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(De,ke),this._tmpCtx.lineTo(Se,ke),this._tmpCtx.moveTo(De,Be),this._tmpCtx.lineTo(Se,Be);break;case 3:const ft=le<=1?Be:Math.ceil(ie+this._config.deviceCharHeight-le/2)-_e,X=le<=1?ke:Math.ceil(ie+this._config.deviceCharHeight+le/2)-_e,te=new Path2D;te.rect(De,ke,this._config.deviceCellWidth,Be-ke),this._tmpCtx.clip(te),this._tmpCtx.moveTo(De-this._config.deviceCellWidth/2,$e),this._tmpCtx.bezierCurveTo(De-this._config.deviceCellWidth/2,X,De,X,De,$e),this._tmpCtx.bezierCurveTo(De,ft,vt,ft,vt,$e),this._tmpCtx.bezierCurveTo(vt,X,Se,X,Se,$e),this._tmpCtx.bezierCurveTo(Se,ft,Se+this._config.deviceCellWidth/2,ft,Se+this._config.deviceCellWidth/2,$e);break;case 4:const ue=Fe===0?0:Fe>=le?2*le-Fe:le-Fe;Fe>=le||ue===0?(this._tmpCtx.setLineDash([Math.round(le),Math.round(le)]),this._tmpCtx.moveTo(De+ue,ke),this._tmpCtx.lineTo(Se,ke)):(this._tmpCtx.setLineDash([Math.round(le),Math.round(le)]),this._tmpCtx.moveTo(De,ke),this._tmpCtx.lineTo(De+ue,ke),this._tmpCtx.moveTo(De+ue+le,ke),this._tmpCtx.lineTo(Se,ke)),Fe=(0,l.computeNextVariantOffset)(Se-De,le,Fe);break;case 5:const Ee=.6,ye=.3,et=Se-De,It=Math.floor(Ee*et),rt=Math.floor(ye*et),ut=et-It-rt;this._tmpCtx.setLineDash([It,rt,ut]),this._tmpCtx.moveTo(De,ke),this._tmpCtx.lineTo(Se,ke);break;default:this._tmpCtx.moveTo(De,ke),this._tmpCtx.lineTo(Se,ke)}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!ce&&this._config.fontSize>=12&&!this._config.allowTransparency&&A!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";const Me=this._tmpCtx.measureText(A);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in Me&&Me.actualBoundingBoxDescent>0){this._tmpCtx.save();const De=new Path2D;De.rect(Ce,ke-Math.ceil(le/2),this._config.deviceCellWidth*fe,Be-ke+Math.ceil(le/2)),this._tmpCtx.clip(De),this._tmpCtx.lineWidth=3*this._config.devicePixelRatio,this._tmpCtx.strokeStyle=P.css,this._tmpCtx.strokeText(A,ie,ie+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(V){const le=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),_e=le%2==1?.5:0;this._tmpCtx.lineWidth=le,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(ie,ie+_e),this._tmpCtx.lineTo(ie+this._config.deviceCharWidth*fe,ie+_e),this._tmpCtx.stroke()}if(ce||this._tmpCtx.fillText(A,ie,ie+this._config.deviceCharHeight),A==="_"&&!this._config.allowTransparency){let le=C(this._tmpCtx.getImageData(ie,ie,this._config.deviceCellWidth,this._config.deviceCellHeight),P,ne,ae);if(le)for(let _e=1;_e<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=P.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(A,ie,ie+this._config.deviceCharHeight-_e),le=C(this._tmpCtx.getImageData(ie,ie,this._config.deviceCellWidth,this._config.deviceCellHeight),P,ne,ae),le);_e++);}if(O){const le=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),_e=this._tmpCtx.lineWidth%2==1?.5:0;this._tmpCtx.lineWidth=le,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(ie,ie+Math.floor(this._config.deviceCharHeight/2)-_e),this._tmpCtx.lineTo(ie+this._config.deviceCharWidth*fe,ie+Math.floor(this._config.deviceCharHeight/2)-_e),this._tmpCtx.stroke()}this._tmpCtx.restore();const Pe=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height);let We;if(We=this._config.allowTransparency?function(le){for(let _e=0;_e<le.data.length;_e+=4)if(le.data[_e+3]>0)return!1;return!0}(Pe):C(Pe,P,ne,ae),We)return p;const ve=this._findGlyphBoundingBox(Pe,this._workBoundingBox,$,Y,ce,ie);let me,xe;for(;;){if(this._activePages.length===0){const le=this._createNewPage();me=le,xe=le.currentRow,xe.height=ve.size.y;break}me=this._activePages[this._activePages.length-1],xe=me.currentRow;for(const le of this._activePages)ve.size.y<=le.currentRow.height&&(me=le,xe=le.currentRow);for(let le=this._activePages.length-1;le>=0;le--)for(const _e of this._activePages[le].fixedRows)_e.height<=xe.height&&ve.size.y<=_e.height&&(me=this._activePages[le],xe=_e);if(xe.y+ve.size.y>=me.canvas.height||xe.height>ve.size.y+2){let le=!1;if(me.currentRow.y+me.currentRow.height+ve.size.y>=me.canvas.height){let _e;for(const Ce of this._activePages)if(Ce.currentRow.y+Ce.currentRow.height+ve.size.y<Ce.canvas.height){_e=Ce;break}if(_e)me=_e;else if(y.maxAtlasPages&&this._pages.length>=y.maxAtlasPages&&xe.y+ve.size.y<=me.canvas.height&&xe.height>=ve.size.y&&xe.x+ve.size.x<=me.canvas.width)le=!0;else{const Ce=this._createNewPage();me=Ce,xe=Ce.currentRow,xe.height=ve.size.y,le=!0}}le||(me.currentRow.height>0&&me.fixedRows.push(me.currentRow),xe={x:0,y:me.currentRow.y+me.currentRow.height,height:ve.size.y},me.fixedRows.push(xe),me.currentRow={x:0,y:xe.y+xe.height,height:0})}if(xe.x+ve.size.x<=me.canvas.width)break;xe===me.currentRow?(xe.x=0,xe.y+=xe.height,xe.height=0):me.fixedRows.splice(me.fixedRows.indexOf(xe),1)}return ve.texturePage=this._pages.indexOf(me),ve.texturePosition.x=xe.x,ve.texturePosition.y=xe.y,ve.texturePositionClipSpace.x=xe.x/me.canvas.width,ve.texturePositionClipSpace.y=xe.y/me.canvas.height,ve.sizeClipSpace.x/=me.canvas.width,ve.sizeClipSpace.y/=me.canvas.height,xe.height=Math.max(xe.height,ve.size.y),xe.x+=ve.size.x,me.ctx.putImageData(Pe,ve.texturePosition.x-this._workBoundingBox.left,ve.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,ve.size.x,ve.size.y),me.addGlyph(ve),me.version++,ve}_findGlyphBoundingBox(k,M,D,R,N,A){M.top=0;const $=R?this._config.deviceCellHeight:this._tmpCanvas.height,F=R?this._config.deviceCellWidth:D;let H=!1;for(let I=0;I<$;I++){for(let L=0;L<F;L++){const T=I*this._tmpCanvas.width*4+4*L+3;if(k.data[T]!==0){M.top=I,H=!0;break}}if(H)break}M.left=0,H=!1;for(let I=0;I<A+F;I++){for(let L=0;L<$;L++){const T=L*this._tmpCanvas.width*4+4*I+3;if(k.data[T]!==0){M.left=I,H=!0;break}}if(H)break}M.right=F,H=!1;for(let I=A+F-1;I>=A;I--){for(let L=0;L<$;L++){const T=L*this._tmpCanvas.width*4+4*I+3;if(k.data[T]!==0){M.right=I,H=!0;break}}if(H)break}M.bottom=$,H=!1;for(let I=$-1;I>=0;I--){for(let L=0;L<F;L++){const T=I*this._tmpCanvas.width*4+4*L+3;if(k.data[T]!==0){M.bottom=I,H=!0;break}}if(H)break}return{texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:M.right-M.left+1,y:M.bottom-M.top+1},sizeClipSpace:{x:M.right-M.left+1,y:M.bottom-M.top+1},offset:{x:-M.left+A+(R||N?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-M.top+A+(R||N?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}}i.TextureAtlas=y;class b{get percentageUsed(){return this._usedPixels/(this.canvas.width*this.canvas.height)}get glyphs(){return this._glyphs}addGlyph(k){this._glyphs.push(k),this._usedPixels+=k.size.x*k.size.y}constructor(k,M,D){if(this._usedPixels=0,this._glyphs=[],this.version=0,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],D)for(const R of D)this._glyphs.push(...R.glyphs),this._usedPixels+=R._usedPixels;this.canvas=E(k,M,M),this.ctx=(0,l.throwIfFalsy)(this.canvas.getContext("2d",{alpha:!0}))}clear(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.currentRow.x=0,this.currentRow.y=0,this.currentRow.height=0,this.fixedRows.length=0,this.version++}}function C(x,k,M,D){const R=k.rgba>>>24,N=k.rgba>>>16&255,A=k.rgba>>>8&255,$=M.rgba>>>24,F=M.rgba>>>16&255,H=M.rgba>>>8&255,I=Math.floor((Math.abs(R-$)+Math.abs(N-F)+Math.abs(A-H))/12);let L=!0;for(let T=0;T<x.data.length;T+=4)x.data[T]===R&&x.data[T+1]===N&&x.data[T+2]===A||D&&Math.abs(x.data[T]-R)+Math.abs(x.data[T+1]-N)+Math.abs(x.data[T+2]-A)<I?x.data[T+3]=0:L=!1;return L}function E(x,k,M){const D=x.createElement("canvas");return D.width=k,D.height=M,D}},160:(c,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.contrastRatio=i.toPaddedHex=i.rgba=i.rgb=i.css=i.color=i.channels=i.NULL_COLOR=void 0;let a=0,d=0,g=0,l=0;var m,v,w,_,u;function f(h){const y=h.toString(16);return y.length<2?"0"+y:y}function p(h,y){return h<y?(y+.05)/(h+.05):(h+.05)/(y+.05)}i.NULL_COLOR={css:"#00000000",rgba:0},function(h){h.toCss=function(y,b,C,E){return E!==void 0?`#${f(y)}${f(b)}${f(C)}${f(E)}`:`#${f(y)}${f(b)}${f(C)}`},h.toRgba=function(y,b,C,E=255){return(y<<24|b<<16|C<<8|E)>>>0},h.toColor=function(y,b,C,E){return{css:h.toCss(y,b,C,E),rgba:h.toRgba(y,b,C,E)}}}(m||(i.channels=m={})),function(h){function y(b,C){return l=Math.round(255*C),[a,d,g]=u.toChannels(b.rgba),{css:m.toCss(a,d,g,l),rgba:m.toRgba(a,d,g,l)}}h.blend=function(b,C){if(l=(255&C.rgba)/255,l===1)return{css:C.css,rgba:C.rgba};const E=C.rgba>>24&255,x=C.rgba>>16&255,k=C.rgba>>8&255,M=b.rgba>>24&255,D=b.rgba>>16&255,R=b.rgba>>8&255;return a=M+Math.round((E-M)*l),d=D+Math.round((x-D)*l),g=R+Math.round((k-R)*l),{css:m.toCss(a,d,g),rgba:m.toRgba(a,d,g)}},h.isOpaque=function(b){return(255&b.rgba)==255},h.ensureContrastRatio=function(b,C,E){const x=u.ensureContrastRatio(b.rgba,C.rgba,E);if(x)return m.toColor(x>>24&255,x>>16&255,x>>8&255)},h.opaque=function(b){const C=(255|b.rgba)>>>0;return[a,d,g]=u.toChannels(C),{css:m.toCss(a,d,g),rgba:C}},h.opacity=y,h.multiplyOpacity=function(b,C){return l=255&b.rgba,y(b,l*C/255)},h.toColorRGB=function(b){return[b.rgba>>24&255,b.rgba>>16&255,b.rgba>>8&255]}}(v||(i.color=v={})),function(h){let y,b;try{const C=document.createElement("canvas");C.width=1,C.height=1;const E=C.getContext("2d",{willReadFrequently:!0});E&&(y=E,y.globalCompositeOperation="copy",b=y.createLinearGradient(0,0,1,1))}catch{}h.toColor=function(C){if(C.match(/#[\da-f]{3,8}/i))switch(C.length){case 4:return a=parseInt(C.slice(1,2).repeat(2),16),d=parseInt(C.slice(2,3).repeat(2),16),g=parseInt(C.slice(3,4).repeat(2),16),m.toColor(a,d,g);case 5:return a=parseInt(C.slice(1,2).repeat(2),16),d=parseInt(C.slice(2,3).repeat(2),16),g=parseInt(C.slice(3,4).repeat(2),16),l=parseInt(C.slice(4,5).repeat(2),16),m.toColor(a,d,g,l);case 7:return{css:C,rgba:(parseInt(C.slice(1),16)<<8|255)>>>0};case 9:return{css:C,rgba:parseInt(C.slice(1),16)>>>0}}const E=C.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(E)return a=parseInt(E[1]),d=parseInt(E[2]),g=parseInt(E[3]),l=Math.round(255*(E[5]===void 0?1:parseFloat(E[5]))),m.toColor(a,d,g,l);if(!y||!b)throw new Error("css.toColor: Unsupported css format");if(y.fillStyle=b,y.fillStyle=C,typeof y.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(y.fillRect(0,0,1,1),[a,d,g,l]=y.getImageData(0,0,1,1).data,l!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:m.toRgba(a,d,g,l),css:C}}}(w||(i.css=w={})),function(h){function y(b,C,E){const x=b/255,k=C/255,M=E/255;return .2126*(x<=.03928?x/12.92:Math.pow((x+.055)/1.055,2.4))+.7152*(k<=.03928?k/12.92:Math.pow((k+.055)/1.055,2.4))+.0722*(M<=.03928?M/12.92:Math.pow((M+.055)/1.055,2.4))}h.relativeLuminance=function(b){return y(b>>16&255,b>>8&255,255&b)},h.relativeLuminance2=y}(_||(i.rgb=_={})),function(h){function y(C,E,x){const k=C>>24&255,M=C>>16&255,D=C>>8&255;let R=E>>24&255,N=E>>16&255,A=E>>8&255,$=p(_.relativeLuminance2(R,N,A),_.relativeLuminance2(k,M,D));for(;$<x&&(R>0||N>0||A>0);)R-=Math.max(0,Math.ceil(.1*R)),N-=Math.max(0,Math.ceil(.1*N)),A-=Math.max(0,Math.ceil(.1*A)),$=p(_.relativeLuminance2(R,N,A),_.relativeLuminance2(k,M,D));return(R<<24|N<<16|A<<8|255)>>>0}function b(C,E,x){const k=C>>24&255,M=C>>16&255,D=C>>8&255;let R=E>>24&255,N=E>>16&255,A=E>>8&255,$=p(_.relativeLuminance2(R,N,A),_.relativeLuminance2(k,M,D));for(;$<x&&(R<255||N<255||A<255);)R=Math.min(255,R+Math.ceil(.1*(255-R))),N=Math.min(255,N+Math.ceil(.1*(255-N))),A=Math.min(255,A+Math.ceil(.1*(255-A))),$=p(_.relativeLuminance2(R,N,A),_.relativeLuminance2(k,M,D));return(R<<24|N<<16|A<<8|255)>>>0}h.blend=function(C,E){if(l=(255&E)/255,l===1)return E;const x=E>>24&255,k=E>>16&255,M=E>>8&255,D=C>>24&255,R=C>>16&255,N=C>>8&255;return a=D+Math.round((x-D)*l),d=R+Math.round((k-R)*l),g=N+Math.round((M-N)*l),m.toRgba(a,d,g)},h.ensureContrastRatio=function(C,E,x){const k=_.relativeLuminance(C>>8),M=_.relativeLuminance(E>>8);if(p(k,M)<x){if(M<k){const N=y(C,E,x),A=p(k,_.relativeLuminance(N>>8));if(A<x){const $=b(C,E,x);return A>p(k,_.relativeLuminance($>>8))?N:$}return N}const D=b(C,E,x),R=p(k,_.relativeLuminance(D>>8));if(R<x){const N=y(C,E,x);return R>p(k,_.relativeLuminance(N>>8))?D:N}return D}},h.reduceLuminance=y,h.increaseLuminance=b,h.toChannels=function(C){return[C>>24&255,C>>16&255,C>>8&255,255&C]}}(u||(i.rgba=u={})),i.toPaddedHex=f,i.contrastRatio=p},345:(c,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.runAndSubscribe=i.forwardEvent=i.EventEmitter=void 0,i.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=a=>(this._listeners.push(a),{dispose:()=>{if(!this._disposed){for(let d=0;d<this._listeners.length;d++)if(this._listeners[d]===a)return void this._listeners.splice(d,1)}}})),this._event}fire(a,d){const g=[];for(let l=0;l<this._listeners.length;l++)g.push(this._listeners[l]);for(let l=0;l<g.length;l++)g[l].call(void 0,a,d)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},i.forwardEvent=function(a,d){return a(g=>d.fire(g))},i.runAndSubscribe=function(a,d){return d(void 0),a(g=>d(g))}},859:(c,i)=>{function a(d){for(const g of d)g.dispose();d.length=0}Object.defineProperty(i,"__esModule",{value:!0}),i.getDisposeArrayDisposable=i.disposeArray=i.toDisposable=i.MutableDisposable=i.Disposable=void 0,i.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const d of this._disposables)d.dispose();this._disposables.length=0}register(d){return this._disposables.push(d),d}unregister(d){const g=this._disposables.indexOf(d);g!==-1&&this._disposables.splice(g,1)}},i.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(d){var g;this._isDisposed||d===this._value||((g=this._value)==null||g.dispose(),this._value=d)}clear(){this.value=void 0}dispose(){var d;this._isDisposed=!0,(d=this._value)==null||d.dispose(),this._value=void 0}},i.toDisposable=function(d){return{dispose:d}},i.disposeArray=a,i.getDisposeArrayDisposable=function(d){return{dispose:()=>a(d)}}},485:(c,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.FourKeyMap=i.TwoKeyMap=void 0;class a{constructor(){this._data={}}set(g,l,m){this._data[g]||(this._data[g]={}),this._data[g][l]=m}get(g,l){return this._data[g]?this._data[g][l]:void 0}clear(){this._data={}}}i.TwoKeyMap=a,i.FourKeyMap=class{constructor(){this._data=new a}set(d,g,l,m,v){this._data.get(d,g)||this._data.set(d,g,new a),this._data.get(d,g).set(l,m,v)}get(d,g,l,m){var v;return(v=this._data.get(d,g))==null?void 0:v.get(l,m)}clear(){this._data.clear()}}},399:(c,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.isChromeOS=i.isLinux=i.isWindows=i.isIphone=i.isIpad=i.isMac=i.getSafariVersion=i.isSafari=i.isLegacyEdge=i.isFirefox=i.isNode=void 0,i.isNode=typeof process<"u"&&"title"in process;const a=i.isNode?"node":navigator.userAgent,d=i.isNode?"node":navigator.platform;i.isFirefox=a.includes("Firefox"),i.isLegacyEdge=a.includes("Edge"),i.isSafari=/^((?!chrome|android).)*safari/i.test(a),i.getSafariVersion=function(){if(!i.isSafari)return 0;const g=a.match(/Version\/(\d+)/);return g===null||g.length<2?0:parseInt(g[1])},i.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(d),i.isIpad=d==="iPad",i.isIphone=d==="iPhone",i.isWindows=["Windows","Win16","Win32","WinCE"].includes(d),i.isLinux=d.indexOf("Linux")>=0,i.isChromeOS=/\bCrOS\b/.test(a)},385:(c,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.DebouncedIdleTask=i.IdleTaskQueue=i.PriorityTaskQueue=void 0;const d=a(399);class g{constructor(){this._tasks=[],this._i=0}enqueue(v){this._tasks.push(v),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(v){this._idleCallback=void 0;let w=0,_=0,u=v.timeRemaining(),f=0;for(;this._i<this._tasks.length;){if(w=Date.now(),this._tasks[this._i]()||this._i++,w=Math.max(1,Date.now()-w),_=Math.max(w,_),f=v.timeRemaining(),1.5*_>f)return u-w<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(u-w))}ms`),void this._start();u=f}this.clear()}}class l extends g{_requestCallback(v){return setTimeout(()=>v(this._createDeadline(16)))}_cancelCallback(v){clearTimeout(v)}_createDeadline(v){const w=Date.now()+v;return{timeRemaining:()=>Math.max(0,w-Date.now())}}}i.PriorityTaskQueue=l,i.IdleTaskQueue=!d.isNode&&"requestIdleCallback"in window?class extends g{_requestCallback(m){return requestIdleCallback(m)}_cancelCallback(m){cancelIdleCallback(m)}}:l,i.DebouncedIdleTask=class{constructor(){this._queue=new i.IdleTaskQueue}set(m){this._queue.clear(),this._queue.enqueue(m)}flush(){this._queue.flush()}}},147:(c,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.ExtendedAttrs=i.AttributeData=void 0;class a{constructor(){this.fg=0,this.bg=0,this.extended=new d}static toColorRGB(l){return[l>>>16&255,l>>>8&255,255&l]}static fromColorRGB(l){return(255&l[0])<<16|(255&l[1])<<8|255&l[2]}clone(){const l=new a;return l.fg=this.fg,l.bg=this.bg,l.extended=this.extended.clone(),l}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}i.AttributeData=a;class d{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(l){this._ext=l}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(l){this._ext&=-469762049,this._ext|=l<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(l){this._ext&=-67108864,this._ext|=67108863&l}get urlId(){return this._urlId}set urlId(l){this._urlId=l}get underlineVariantOffset(){const l=(3758096384&this._ext)>>29;return l<0?4294967288^l:l}set underlineVariantOffset(l){this._ext&=536870911,this._ext|=l<<29&3758096384}constructor(l=0,m=0){this._ext=0,this._urlId=0,this._ext=l,this._urlId=m}clone(){return new d(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}i.ExtendedAttrs=d},782:(c,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.CellData=void 0;const d=a(133),g=a(855),l=a(147);class m extends l.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new l.ExtendedAttrs,this.combinedData=""}static fromCharData(w){const _=new m;return _.setFromCharData(w),_}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,d.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(w){this.fg=w[g.CHAR_DATA_ATTR_INDEX],this.bg=0;let _=!1;if(w[g.CHAR_DATA_CHAR_INDEX].length>2)_=!0;else if(w[g.CHAR_DATA_CHAR_INDEX].length===2){const u=w[g.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=u&&u<=56319){const f=w[g.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=f&&f<=57343?this.content=1024*(u-55296)+f-56320+65536|w[g.CHAR_DATA_WIDTH_INDEX]<<22:_=!0}else _=!0}else this.content=w[g.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|w[g.CHAR_DATA_WIDTH_INDEX]<<22;_&&(this.combinedData=w[g.CHAR_DATA_CHAR_INDEX],this.content=2097152|w[g.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}i.CellData=m},855:(c,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.WHITESPACE_CELL_CODE=i.WHITESPACE_CELL_WIDTH=i.WHITESPACE_CELL_CHAR=i.NULL_CELL_CODE=i.NULL_CELL_WIDTH=i.NULL_CELL_CHAR=i.CHAR_DATA_CODE_INDEX=i.CHAR_DATA_WIDTH_INDEX=i.CHAR_DATA_CHAR_INDEX=i.CHAR_DATA_ATTR_INDEX=i.DEFAULT_EXT=i.DEFAULT_ATTR=i.DEFAULT_COLOR=void 0,i.DEFAULT_COLOR=0,i.DEFAULT_ATTR=256|i.DEFAULT_COLOR<<9,i.DEFAULT_EXT=0,i.CHAR_DATA_ATTR_INDEX=0,i.CHAR_DATA_CHAR_INDEX=1,i.CHAR_DATA_WIDTH_INDEX=2,i.CHAR_DATA_CODE_INDEX=3,i.NULL_CELL_CHAR="",i.NULL_CELL_WIDTH=1,i.NULL_CELL_CODE=0,i.WHITESPACE_CELL_CHAR=" ",i.WHITESPACE_CELL_WIDTH=1,i.WHITESPACE_CELL_CODE=32},133:(c,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.Utf8ToUtf32=i.StringToUtf32=i.utf32ToString=i.stringFromCodePoint=void 0,i.stringFromCodePoint=function(a){return a>65535?(a-=65536,String.fromCharCode(55296+(a>>10))+String.fromCharCode(a%1024+56320)):String.fromCharCode(a)},i.utf32ToString=function(a,d=0,g=a.length){let l="";for(let m=d;m<g;++m){let v=a[m];v>65535?(v-=65536,l+=String.fromCharCode(55296+(v>>10))+String.fromCharCode(v%1024+56320)):l+=String.fromCharCode(v)}return l},i.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(a,d){const g=a.length;if(!g)return 0;let l=0,m=0;if(this._interim){const v=a.charCodeAt(m++);56320<=v&&v<=57343?d[l++]=1024*(this._interim-55296)+v-56320+65536:(d[l++]=this._interim,d[l++]=v),this._interim=0}for(let v=m;v<g;++v){const w=a.charCodeAt(v);if(55296<=w&&w<=56319){if(++v>=g)return this._interim=w,l;const _=a.charCodeAt(v);56320<=_&&_<=57343?d[l++]=1024*(w-55296)+_-56320+65536:(d[l++]=w,d[l++]=_)}else w!==65279&&(d[l++]=w)}return l}},i.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(a,d){const g=a.length;if(!g)return 0;let l,m,v,w,_=0,u=0,f=0;if(this.interim[0]){let y=!1,b=this.interim[0];b&=(224&b)==192?31:(240&b)==224?15:7;let C,E=0;for(;(C=63&this.interim[++E])&&E<4;)b<<=6,b|=C;const x=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,k=x-E;for(;f<k;){if(f>=g)return 0;if(C=a[f++],(192&C)!=128){f--,y=!0;break}this.interim[E++]=C,b<<=6,b|=63&C}y||(x===2?b<128?f--:d[_++]=b:x===3?b<2048||b>=55296&&b<=57343||b===65279||(d[_++]=b):b<65536||b>1114111||(d[_++]=b)),this.interim.fill(0)}const p=g-4;let h=f;for(;h<g;){for(;!(!(h<p)||128&(l=a[h])||128&(m=a[h+1])||128&(v=a[h+2])||128&(w=a[h+3]));)d[_++]=l,d[_++]=m,d[_++]=v,d[_++]=w,h+=4;if(l=a[h++],l<128)d[_++]=l;else if((224&l)==192){if(h>=g)return this.interim[0]=l,_;if(m=a[h++],(192&m)!=128){h--;continue}if(u=(31&l)<<6|63&m,u<128){h--;continue}d[_++]=u}else if((240&l)==224){if(h>=g)return this.interim[0]=l,_;if(m=a[h++],(192&m)!=128){h--;continue}if(h>=g)return this.interim[0]=l,this.interim[1]=m,_;if(v=a[h++],(192&v)!=128){h--;continue}if(u=(15&l)<<12|(63&m)<<6|63&v,u<2048||u>=55296&&u<=57343||u===65279)continue;d[_++]=u}else if((248&l)==240){if(h>=g)return this.interim[0]=l,_;if(m=a[h++],(192&m)!=128){h--;continue}if(h>=g)return this.interim[0]=l,this.interim[1]=m,_;if(v=a[h++],(192&v)!=128){h--;continue}if(h>=g)return this.interim[0]=l,this.interim[1]=m,this.interim[2]=v,_;if(w=a[h++],(192&w)!=128){h--;continue}if(u=(7&l)<<18|(63&m)<<12|(63&v)<<6|63&w,u<65536||u>1114111)continue;d[_++]=u}}return _}}},776:function(c,i,a){var d=this&&this.__decorate||function(u,f,p,h){var y,b=arguments.length,C=b<3?f:h===null?h=Object.getOwnPropertyDescriptor(f,p):h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(u,f,p,h);else for(var E=u.length-1;E>=0;E--)(y=u[E])&&(C=(b<3?y(C):b>3?y(f,p,C):y(f,p))||C);return b>3&&C&&Object.defineProperty(f,p,C),C},g=this&&this.__param||function(u,f){return function(p,h){f(p,h,u)}};Object.defineProperty(i,"__esModule",{value:!0}),i.traceCall=i.setTraceLogger=i.LogService=void 0;const l=a(859),m=a(97),v={trace:m.LogLevelEnum.TRACE,debug:m.LogLevelEnum.DEBUG,info:m.LogLevelEnum.INFO,warn:m.LogLevelEnum.WARN,error:m.LogLevelEnum.ERROR,off:m.LogLevelEnum.OFF};let w,_=i.LogService=class extends l.Disposable{get logLevel(){return this._logLevel}constructor(u){super(),this._optionsService=u,this._logLevel=m.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel())),w=this}_updateLogLevel(){this._logLevel=v[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(u){for(let f=0;f<u.length;f++)typeof u[f]=="function"&&(u[f]=u[f]())}_log(u,f,p){this._evalLazyOptionalParams(p),u.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+f,...p)}trace(u,...f){var p;this._logLevel<=m.LogLevelEnum.TRACE&&this._log(((p=this._optionsService.options.logger)==null?void 0:p.trace.bind(this._optionsService.options.logger))??console.log,u,f)}debug(u,...f){var p;this._logLevel<=m.LogLevelEnum.DEBUG&&this._log(((p=this._optionsService.options.logger)==null?void 0:p.debug.bind(this._optionsService.options.logger))??console.log,u,f)}info(u,...f){var p;this._logLevel<=m.LogLevelEnum.INFO&&this._log(((p=this._optionsService.options.logger)==null?void 0:p.info.bind(this._optionsService.options.logger))??console.info,u,f)}warn(u,...f){var p;this._logLevel<=m.LogLevelEnum.WARN&&this._log(((p=this._optionsService.options.logger)==null?void 0:p.warn.bind(this._optionsService.options.logger))??console.warn,u,f)}error(u,...f){var p;this._logLevel<=m.LogLevelEnum.ERROR&&this._log(((p=this._optionsService.options.logger)==null?void 0:p.error.bind(this._optionsService.options.logger))??console.error,u,f)}};i.LogService=_=d([g(0,m.IOptionsService)],_),i.setTraceLogger=function(u){w=u},i.traceCall=function(u,f,p){if(typeof p.value!="function")throw new Error("not supported");const h=p.value;p.value=function(...y){if(w.logLevel!==m.LogLevelEnum.TRACE)return h.apply(this,y);w.trace(`GlyphRenderer#${h.name}(${y.map(C=>JSON.stringify(C)).join(", ")})`);const b=h.apply(this,y);return w.trace(`GlyphRenderer#${h.name} return`,b),b}}},726:(c,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.createDecorator=i.getServiceDependencies=i.serviceRegistry=void 0;const a="di$target",d="di$dependencies";i.serviceRegistry=new Map,i.getServiceDependencies=function(g){return g[d]||[]},i.createDecorator=function(g){if(i.serviceRegistry.has(g))return i.serviceRegistry.get(g);const l=function(m,v,w){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(_,u,f){u[a]===u?u[d].push({id:_,index:f}):(u[d]=[{id:_,index:f}],u[a]=u)})(l,m,w)};return l.toString=()=>g,i.serviceRegistry.set(g,l),l}},97:(c,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.IDecorationService=i.IUnicodeService=i.IOscLinkService=i.IOptionsService=i.ILogService=i.LogLevelEnum=i.IInstantiationService=i.ICharsetService=i.ICoreService=i.ICoreMouseService=i.IBufferService=void 0;const d=a(726);var g;i.IBufferService=(0,d.createDecorator)("BufferService"),i.ICoreMouseService=(0,d.createDecorator)("CoreMouseService"),i.ICoreService=(0,d.createDecorator)("CoreService"),i.ICharsetService=(0,d.createDecorator)("CharsetService"),i.IInstantiationService=(0,d.createDecorator)("InstantiationService"),function(l){l[l.TRACE=0]="TRACE",l[l.DEBUG=1]="DEBUG",l[l.INFO=2]="INFO",l[l.WARN=3]="WARN",l[l.ERROR=4]="ERROR",l[l.OFF=5]="OFF"}(g||(i.LogLevelEnum=g={})),i.ILogService=(0,d.createDecorator)("LogService"),i.IOptionsService=(0,d.createDecorator)("OptionsService"),i.IOscLinkService=(0,d.createDecorator)("OscLinkService"),i.IUnicodeService=(0,d.createDecorator)("UnicodeService"),i.IDecorationService=(0,d.createDecorator)("DecorationService")}},n={};function r(c){var i=n[c];if(i!==void 0)return i.exports;var a=n[c]={exports:{}};return s[c].call(a.exports,a,a.exports,r),a.exports}var o={};return(()=>{var c=o;Object.defineProperty(c,"__esModule",{value:!0}),c.WebglAddon=void 0;const i=r(345),a=r(859),d=r(399),g=r(666),l=r(776);class m extends a.Disposable{constructor(w){if(d.isSafari&&(0,d.getSafariVersion)()<16){const _={antialias:!1,depth:!1,preserveDrawingBuffer:!0};if(!document.createElement("canvas").getContext("webgl2",_))throw new Error("Webgl2 is only supported on Safari 16 and above")}super(),this._preserveDrawingBuffer=w,this._onChangeTextureAtlas=this.register(new i.EventEmitter),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this.register(new i.EventEmitter),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this.register(new i.EventEmitter),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this.register(new i.EventEmitter),this.onContextLoss=this._onContextLoss.event}activate(w){const _=w._core;if(!w.element)return void this.register(_.onWillOpen(()=>this.activate(w)));this._terminal=w;const u=_.coreService,f=_.optionsService,p=_,h=p._renderService,y=p._characterJoinerService,b=p._charSizeService,C=p._coreBrowserService,E=p._decorationService,x=p._logService,k=p._themeService;(0,l.setTraceLogger)(x),this._renderer=this.register(new g.WebglRenderer(w,y,b,C,u,E,f,k,this._preserveDrawingBuffer)),this.register((0,i.forwardEvent)(this._renderer.onContextLoss,this._onContextLoss)),this.register((0,i.forwardEvent)(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this.register((0,i.forwardEvent)(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this.register((0,i.forwardEvent)(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),h.setRenderer(this._renderer),this.register((0,a.toDisposable)(()=>{const M=this._terminal._core._renderService;M.setRenderer(this._terminal._core._createRenderer()),M.handleResize(w.cols,w.rows)}))}get textureAtlas(){var w;return(w=this._renderer)==null?void 0:w.textureAtlas}clearTextureAtlas(){var w;(w=this._renderer)==null||w.clearTextureAtlas()}}c.WebglAddon=m})(),o})())})(j0);var Zk=j0.exports;const Bp=1,Jk=[500,1e3,2e3,4e3,8e3],eL=3e3;function tL({url:e,binaryType:t="arraybuffer",WebSocketImpl:s=typeof WebSocket<"u"?WebSocket:void 0,setTimeoutImpl:n=setTimeout,clearTimeoutImpl:r=clearTimeout,backoff:o=Jk,stableMs:c=eL,onOpen:i=()=>{},onMessage:a=()=>{},onState:d=()=>{}}){let g=null,l=0,m=!1,v=0,w=0;const _=typeof e=="function"?e:()=>e,u=()=>{w&&(r(w),w=0)},f=()=>{d(l===0?"connecting":"reconnecting");let b;try{b=new s(_())}catch{h();return}g=b;try{b.binaryType=t}catch{}b.onopen=()=>{b===g&&(d("open"),w=n(()=>{l=0,w=0},c),i(y))},b.onmessage=C=>{b===g&&a(C)},b.onclose=()=>{b===g&&p()},b.onerror=()=>{}},p=()=>{u(),!m&&h()},h=()=>{d("reconnecting");const b=o[Math.min(l,o.length-1)];l++,v=n(()=>{v=0,f()},b)},y={send(b){return g&&g.readyState===Bp?(g.send(b),!0):!1},isOpen(){return!!g&&g.readyState===Bp},close(){if(m=!0,v&&(r(v),v=0),u(),g)try{g.close()}catch{}g=null},get raw(){return g}};return f(),y}function sL(e){var r;const t=e.buffer.active;let s=!1,n=!1;for(let o=t.baseY;o<t.baseY+e.rows;o++){const c=((r=t.getLine(o))==null?void 0:r.translateToString(!0))||"";/^\s{0,6}❯\s+\S/.test(c)&&(s=!0),/esc/i.test(c)&&/(enter|↵|↑|↓|select|confirm)/i.test(c)&&(n=!0)}return s&&n}function nL(e){var t;return(t=navigator.clipboard)!=null&&t.writeText?navigator.clipboard.writeText(e).then(()=>!0).catch(()=>jp(e)):Promise.resolve(jp(e))}function jp(e){var r;const t=document.activeElement,s=document.createElement("textarea");s.value=e,s.setAttribute("readonly",""),s.style.cssText="position:fixed;top:0;left:0;width:1px;height:1px;opacity:0;pointer-events:none",document.body.appendChild(s);let n=!1;try{s.select(),s.setSelectionRange(0,e.length),n=document.execCommand("copy")}catch{n=!1}s.remove();try{(r=t==null?void 0:t.focus)==null||r.call(t)}catch{}return n||console.warn("[SessionTerm] clipboard copy failed — selection left intact for manual copy"),n}function rL({sessionId:e,active:t=!0,onMenu:s}){const n=B.useRef(null),r=B.useRef(null),o=B.useRef(null),c=B.useRef({cols:0,rows:0}),i=B.useRef(null),a=B.useRef(!1),d=B.useRef(!1),g=B.useRef(!0),[l,m]=B.useState(!1),[v,w]=B.useState("connecting"),_=B.useRef(s);return _.current=s,B.useEffect(()=>{a.current=!1,d.current=!1;const u=new Yk.Terminal({fontSize:11,fontFamily:"Menlo, monospace",cursorBlink:!1,disableStdin:!0,scrollback:0,macOptionClickForcesSelection:!0,theme:{background:"#0d1117",foreground:"#c9d1d9",cursor:"#c9d1d9",selectionBackground:"#264f78",selectionForeground:"#f0f6fc",selectionInactiveBackground:"#264f78",black:"#484f58",red:"#ff7b72",green:"#3fb950",yellow:"#d29922",blue:"#58a6ff",magenta:"#bc8cff",cyan:"#39c5cf",white:"#b1bac4",brightBlack:"#6e7681",brightRed:"#ffa198",brightGreen:"#56d364",brightYellow:"#e3b341",brightBlue:"#79c0ff",brightMagenta:"#d2a8ff",brightCyan:"#56d4dd",brightWhite:"#f0f6fc"}});r.current=u;const f=new Qk.FitAddon;u.loadAddon(f),u.open(n.current);try{u._core._selectionService.shouldForceSelection=()=>!0}catch{}try{u._core.focus=()=>{}}catch{}const h=`${location.protocol==="https:"?"wss":"ws"}://${location.host}/api/sessions/${e}/socket`,y=()=>{try{const I=n.current;if(I&&I.clientWidth>=40&&I.clientHeight>=40){const L=f.proposeDimensions();if(L&&L.cols>0&&L.rows>0&&!(L.cols<20&&I.clientWidth>200))return a.current=!0,`${h}?cols=${L.cols}&rows=${L.rows}`}}catch{}return a.current=!1,h};let b=null;const C=()=>{const I=n.current;if(!I||I.clientWidth<40||I.clientHeight<40)return;try{f.fit()}catch{return}const{cols:L,rows:T}=u;if(!L||!T||L<20&&I.clientWidth>200)return;const j=c.current;if(L===j.cols&&T===j.rows)return;c.current={cols:L,rows:T};const O=g.current;g.current=!1,b!=null&&b.isOpen()&&b.send(JSON.stringify({t:"resize",cols:L,rows:T,full:O}))};i.current=C;let E=[],x=0;const k=()=>{if(x=0,!E.length)return;let I=0;for(const j of E)I+=j.length;const L=new Uint8Array(I);let T=0;for(const j of E)L.set(j,T),T+=j.length;E=[],u.write(L)};b=tL({url:y,onState:w,onOpen:()=>{E=[],x&&(cancelAnimationFrame(x),x=0),u.reset(),g.current=!0,c.current={cols:0,rows:0},C()},onMessage:I=>{I.data instanceof ArrayBuffer&&(E.push(new Uint8Array(I.data)),x||(x=requestAnimationFrame(k)))}}),u.attachCustomWheelEventHandler(I=>{const L=n.current;if(L&&u.cols&&u.rows){const T=L.getBoundingClientRect(),j=(J,Q)=>Math.min(Q,Math.max(1,J)),O=j(Math.floor((I.clientX-T.left)/(T.width/u.cols))+1,u.cols),V=j(Math.floor((I.clientY-T.top)/(T.height/u.rows))+1,u.rows),q=Math.min(5,Math.max(1,Math.round(Math.abs(I.deltaY)/40)));b!=null&&b.isOpen()&&b.send(JSON.stringify({t:"wheel",up:I.deltaY<0,col:O,row:V,ticks:q}))}return I.preventDefault(),!1});let M;const D=n.current,R=I=>{if(!(I.metaKey||I.ctrlKey)||I.key!=="c"&&I.key!=="C"||!D||D.offsetParent===null)return;const L=u.getSelection();if(!L)return;const T=document.activeElement;T&&(T.tagName==="TEXTAREA"||T.tagName==="INPUT")&&T.selectionStart!==T.selectionEnd||(I.preventDefault(),I.stopPropagation(),nL(L).then(j=>{j&&(m(!0),clearTimeout(M),M=setTimeout(()=>m(!1),1200))}))};document.addEventListener("keydown",R);const N=setInterval(()=>{var I;try{(I=_.current)==null||I.call(_,e,sL(u))}catch{}},700),A=requestAnimationFrame(C),$=n.current.closest(".si-term");$&&$.addEventListener("animationend",C);const F=[60,180,320].map(I=>setTimeout(C,I)),H=new ResizeObserver(C);return H.observe(n.current),window.addEventListener("resize",C),()=>{var I;cancelAnimationFrame(A),x&&cancelAnimationFrame(x),clearInterval(N),clearTimeout(M),document.removeEventListener("keydown",R),(I=_.current)==null||I.call(_,e,!1),F.forEach(clearTimeout),$&&$.removeEventListener("animationend",C),H.disconnect(),window.removeEventListener("resize",C),b.close(),u.dispose(),r.current=null,o.current=null,i.current=null}},[e]),B.useEffect(()=>{const u=r.current;if(u){if(t){if(!o.current)try{const f=new Zk.WebglAddon;f.onContextLoss(()=>{try{f.dispose()}catch{}o.current=null,c.current={cols:0,rows:0},requestAnimationFrame(()=>{var p;(p=i.current)==null||p.call(i);try{u.refresh(0,u.rows-1)}catch{}})}),u.loadAddon(f),o.current=f}catch{o.current=null}d.current||(d.current=!0,a.current||(u.reset(),g.current=!0,c.current={cols:0,rows:0})),requestAnimationFrame(()=>{var f;(f=i.current)==null||f.call(i);try{u.refresh(0,u.rows-1)}catch{}})}else if(o.current){try{o.current.dispose()}catch{}o.current=null}}},[e,t]),S.jsxs("div",{className:"st-wrap",children:[S.jsx("div",{className:"st-host",ref:n}),l&&S.jsx("div",{className:"st-copyhint copied",children:"copied ✓"}),!l&&v==="reconnecting"&&S.jsx("div",{className:"st-copyhint reconnecting",children:"reconnecting…"})]})}const iL=()=>S.jsx("svg",{className:"si-agent-glyph",viewBox:"0 0 24 24","aria-hidden":"true",children:S.jsx("path",{d:"M17.3041 3.541h-3.6718l6.696 16.918H24Zm-10.6082 0L0 20.459h3.7442l1.3693-3.5527h7.0052l1.3693 3.5528h3.7442L10.5363 3.5409Zm-.3712 10.2232 2.2914-5.9456 2.2914 5.9456Z"})}),oL=()=>S.jsx("svg",{className:"si-agent-glyph",viewBox:"0 0 24 24","aria-hidden":"true",children:S.jsx("path",{d:"M22.282 9.821a6 6 0 0 0-.516-4.91a6.05 6.05 0 0 0-6.51-2.9A6.065 6.065 0 0 0 4.981 4.18a6 6 0 0 0-3.998 2.9a6.05 6.05 0 0 0 .743 7.097a5.98 5.98 0 0 0 .51 4.911a6.05 6.05 0 0 0 6.515 2.9A6 6 0 0 0 13.26 24a6.06 6.06 0 0 0 5.772-4.206a6 6 0 0 0 3.997-2.9a6.06 6.06 0 0 0-.747-7.073M13.26 22.43a4.48 4.48 0 0 1-2.876-1.04l.141-.081l4.779-2.758a.8.8 0 0 0 .392-.681v-6.737l2.02 1.168a.07.07 0 0 1 .038.052v5.583a4.504 4.504 0 0 1-4.494 4.494M3.6 18.304a4.47 4.47 0 0 1-.535-3.014l.142.085l4.783 2.759a.77.77 0 0 0 .78 0l5.843-3.369v2.332a.08.08 0 0 1-.033.062L9.74 19.95a4.5 4.5 0 0 1-6.14-1.646M2.34 7.896a4.5 4.5 0 0 1 2.366-1.973V11.6a.77.77 0 0 0 .388.677l5.815 3.354l-2.02 1.168a.08.08 0 0 1-.071 0l-4.83-2.786A4.504 4.504 0 0 1 2.34 7.872zm16.597 3.855l-5.833-3.387L15.119 7.2a.08.08 0 0 1 .071 0l4.83 2.791a4.494 4.494 0 0 1-.676 8.105v-5.678a.79.79 0 0 0-.407-.667m2.01-3.023l-.141-.085l-4.774-2.782a.78.78 0 0 0-.785 0L9.409 9.23V6.897a.07.07 0 0 1 .028-.061l4.83-2.787a4.5 4.5 0 0 1 6.68 4.66zm-12.64 4.135l-2.02-1.164a.08.08 0 0 1-.038-.057V6.075a4.5 4.5 0 0 1 7.375-3.453l-.142.08L8.704 5.46a.8.8 0 0 0-.393.681zm1.097-2.365l2.602-1.5l2.607 1.5v2.999l-2.597 1.5l-2.607-1.5Z"})}),O0=[{id:"claude",label:"Claude Code",Glyph:iL},{id:"codex",label:"Codex",Glyph:oL}],Op=Object.fromEntries(O0.map(e=>[e.id,e]));function Vi({title:e,closeLabel:t,onClose:s,className:n,children:r}){return S.jsx("div",{className:"legend-backdrop","data-focus-overlay":!0,onClick:s,children:S.jsxs("div",{className:n?`legend ${n}`:"legend",role:"dialog","aria-modal":"true","aria-label":e,onClick:o=>o.stopPropagation(),children:[S.jsxs("div",{className:"legend-head",children:[S.jsx("span",{className:"legend-title",children:e}),S.jsx("button",{className:"legend-close",onClick:s,title:t,children:"×"})]}),S.jsx("div",{className:"legend-body",children:r})]})})}function aL({menu:e,onClose:t,onChanged:s,onMultiSelect:n}){const r=be(),[o,c]=B.useState(null),[i,a]=B.useState(null),[d,g]=B.useState(""),[l,m]=B.useState(!1),v=B.useRef(null);B.useEffect(()=>{if(e)return window.addEventListener("click",t),()=>window.removeEventListener("click",t)},[e,t]),hr(!!e,t),hr(!!o,()=>c(null)),hr(!!i,()=>a(null)),B.useEffect(()=>{o&&requestAnimationFrame(()=>{var h;return(h=v.current)==null?void 0:h.select()})},[o]);const w=h=>{var y;h.stopPropagation(),g((((y=e.session.raw)==null?void 0:y.name)??e.session.name)||""),c(e.session),t()},_=h=>{h.stopPropagation(),n==null||n(e.session),t()},u=h=>{h.stopPropagation(),a(e.session),t()},f=()=>{const{id:h}=i;a(null),Yt(`/api/sessions/${h}/close`,{method:"POST"}).catch(()=>{}).finally(()=>s==null?void 0:s())},p=async h=>{if(h.preventDefault(),!l){m(!0);try{await Yt(`/api/sessions/${o.id}/rename`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:d})}),s==null||s()}catch{}finally{m(!1),c(null)}}};return S.jsxs(S.Fragment,{children:[e&&S.jsxs("div",{className:"sess-menu",style:{left:e.x,top:e.y},onClick:h=>h.stopPropagation(),children:[S.jsx("button",{className:"sess-menu-item",onClick:w,children:r("sessionWindow.rename")}),S.jsx("button",{className:"sess-menu-item",onClick:_,children:r("sessionWindow.select")}),S.jsx("button",{className:"sess-menu-item danger",onClick:u,children:r("sessionWindow.close")})]}),o&&S.jsx(Vi,{title:r("sessionWindow.renameTitle",{name:Nn(o)}),closeLabel:r("common.close"),className:"sess-rename-modal",onClose:()=>c(null),children:S.jsxs("form",{className:"sess-rename",onSubmit:p,children:[S.jsx("input",{ref:v,className:"sess-rename-input",value:d,autoFocus:!0,placeholder:r("sessionWindow.renamePlaceholder"),onChange:h=>g(h.target.value)}),S.jsxs("div",{className:"sess-rename-actions",children:[S.jsx("button",{type:"button",className:"sess-rename-btn",onClick:()=>c(null),children:r("common.cancel")}),S.jsx("button",{type:"submit",className:"sess-rename-btn sess-rename-save",disabled:l,children:r("common.save")})]})]})}),i&&S.jsx(Vi,{title:r("sessionWindow.closeTitle",{name:Nn(i)}),closeLabel:r("common.close"),className:"sess-rename-modal",onClose:()=>a(null),children:S.jsxs("div",{className:"sess-confirm",children:[S.jsx("p",{className:"sess-confirm-msg",children:r("sessionWindow.closeConfirm")}),S.jsxs("div",{className:"sess-rename-actions",children:[S.jsx("button",{type:"button",className:"sess-rename-btn",onClick:()=>a(null),children:r("common.cancel")}),S.jsx("button",{type:"button",className:"sess-rename-btn danger",onClick:f,children:r("sessionWindow.close")})]})]})})]})}function lL({ids:e,onCancel:t,onClosed:s}){const n=be(),[r,o]=B.useState(!1),c=e.length;hr(r,()=>o(!1));const i=()=>{o(!1),Promise.all(e.map(a=>Yt(`/api/sessions/${a}/close`,{method:"POST"}).catch(()=>{}))).finally(()=>s==null?void 0:s())};return S.jsxs(S.Fragment,{children:[S.jsxs("div",{className:"si-selbar",children:[S.jsx("span",{className:"si-selcount",children:n("sessionSelect.selected",{n:c})}),S.jsx("button",{type:"button",className:"sess-rename-btn danger",disabled:c===0,onClick:()=>o(!0),children:n("sessionSelect.close")}),S.jsx("button",{type:"button",className:"sess-rename-btn",onClick:t,children:n("common.cancel")})]}),r&&S.jsx(Vi,{title:n("sessionSelect.closeTitle",{n:c}),closeLabel:n("common.close"),className:"sess-rename-modal",onClose:()=>o(!1),children:S.jsxs("div",{className:"sess-confirm",children:[S.jsx("p",{className:"sess-confirm-msg",children:n("sessionSelect.closeConfirm")}),S.jsxs("div",{className:"sess-rename-actions",children:[S.jsx("button",{type:"button",className:"sess-rename-btn",onClick:()=>o(!1),children:n("common.cancel")}),S.jsx("button",{type:"button",className:"sess-rename-btn danger",onClick:i,children:n("sessionSelect.close")})]})]})})]})}const Xr=(e,t)=>{let s=null;for(const n of e)if(n.tMs<=t)s=n;else break;return s},kc=e=>{var t,s;return((t=e.verdict)==null?void 0:t.status)==="pass"?"✓":((s=e.verdict)==null?void 0:s.status)==="fail"?"✗":"·"},$p=e=>{var t,s;return((t=e.verdict)==null?void 0:t.status)==="pass"?"pass":((s=e.verdict)==null?void 0:s.status)==="fail"?"fail":"legacy"};function $0({entry:e,specs:t=[],sessions:s=[],onWrite:n}){var Me,De,Se,vt,ft;const r=be(),o=B.useRef(null),c=B.useRef(null),i=B.useRef(null),a=B.useRef(null),d=B.useRef(0),[g,l]=B.useState([]),[m,v]=B.useState(null),[w,_]=B.useState(""),[u,f]=B.useState(!1),[p,h]=B.useState(null),[y,b]=B.useState(0),[C,E]=B.useState(0),[x,k]=B.useState(!1),[M,D]=B.useState(!1),[R,N]=B.useState(null),[A,$]=B.useState(null),[F,H]=B.useState(null),[I,L]=B.useState(0),T=F&&F[I]||e;B.useEffect(()=>{v(null),_(""),l([]),h(null),L(0),H(null);let X=!0;return fetch(io(e.node,"evals")).then(te=>te.ok?te.json():null).then(te=>{X&&Array.isArray(te==null?void 0:te.readings)&&H(te.readings.filter(ue=>ue.scenario===e.scenario))}).catch(()=>{}),()=>{X=!1}},[e.node,e.scenario,e.ts,e.blob]),B.useEffect(()=>{v(null),h(null)},[I]);const j=Jh(T),O=j.find(X=>X.kind==="video"&&X.state==="present"),V=j.filter(X=>X.kind==="image"),q=j.filter(X=>X.kind==="transcript"),J=!!O,Q=e.thread??null,z=Q?[{by:Q.by,at:Q.created,body:Q.body},...Q.replies||[]]:[],P=F&&((Me=F[0])==null?void 0:Me.by)||e.by||null,K=z.map((X,te)=>{const ue=y0(td(X.body),g);return ue&&ue.seekable?{i:te,tMs:ue.tMs,step:ue.step,label:ue.label}:null}).filter(Boolean).sort((X,te)=>X.tMs-te.tMs);B.useEffect(()=>{b(0),E(0),k(!1),D(!1),N(null),$(null)},[e.blob,e.scenario,e.node]),B.useEffect(()=>{if(l([]),!T.timelineBlob||!J)return;let X=!0;return fetch(`/api/yatsu/blob/${T.timelineBlob}`).then(te=>te.ok?te.json():null).then(te=>{X&&Array.isArray(te==null?void 0:te.events)&&l(te.events)}).catch(()=>{}),()=>{X=!1}},[T.timelineBlob,J]),B.useEffect(()=>{const X=o.current;if(!X)return;const te=()=>b(X.currentTime||0),ue=()=>E(X.duration||0),Ee=()=>k(!0),ye=()=>k(!1);return X.addEventListener("timeupdate",te),X.addEventListener("seeked",te),X.addEventListener("loadedmetadata",ue),X.addEventListener("durationchange",ue),X.addEventListener("play",Ee),X.addEventListener("pause",ye),()=>{X.removeEventListener("timeupdate",te),X.removeEventListener("seeked",te),X.removeEventListener("loadedmetadata",ue),X.removeEventListener("durationchange",ue),X.removeEventListener("play",Ee),X.removeEventListener("pause",ye)}},[O==null?void 0:O.hash]);const U=Math.round(y*1e3),Z=Math.round(C*1e3),Y=Z?U/Z*100:0,ne=Xr(g,U);let ie=null;for(const X of K)if(X.tMs<=U)ie=X.i;else break;const ce=B.useCallback(X=>{const te=o.current;te&&(te.currentTime=X/1e3)},[]),fe=B.useCallback(()=>{const X=o.current;X&&(X.paused?X.play():X.pause())},[]),ae=(X,te)=>{$(X),te!=null&&ce(te)},Pe=B.useCallback(()=>{var te,ue;const X=Math.round((((te=o.current)==null?void 0:te.currentTime)??0)*1e3);return{tMs:X,step:((ue=Xr(g,X))==null?void 0:ue.step)??null}},[g]),We=B.useCallback(()=>{const X=o.current;if(!X)return;X.pause();const te=Math.round((X.currentTime||0)*1e3),ue=Xr(g,te),Ee=[Xa(te,ue==null?void 0:ue.step)];ue!=null&&ue.node&&ue.node!==e.node&&Ee.push(`re: [[${ue.node}]]`),Ee.push(""),h({seq:++d.current,body:Ee.join(`
138
- `)})},[g,e.node]),ve=B.useCallback(X=>{var Ee;if(!K.length)return;let te=K.findIndex(ye=>ye.i===A);if(te<0){const ye=Math.round((((Ee=o.current)==null?void 0:Ee.currentTime)||0)*1e3);te=K.reduce((et,It,rt)=>It.tMs<=ye?rt:et,-1)}te=Math.min(K.length-1,Math.max(0,te+X));const ue=K[te];$(ue.i),ce(ue.tMs)},[K,A,ce]);B.useEffect(()=>{if(!J)return;const X=te=>{const ue=document.activeElement;if(ue&&(ue.tagName==="INPUT"||ue.tagName==="TEXTAREA"||ue.tagName==="SELECT"||ue.isContentEditable))return;const Ee=o.current;Ee&&(te.key===" "?(te.preventDefault(),fe()):te.key==="ArrowRight"?(te.preventDefault(),Ee.currentTime=Math.min(Ee.duration||Ee.currentTime,Ee.currentTime+(te.shiftKey?1:5))):te.key==="ArrowLeft"?(te.preventDefault(),Ee.currentTime=Math.max(0,Ee.currentTime-(te.shiftKey?1:5))):te.key===","?(te.preventDefault(),Ee.currentTime=Math.max(0,Ee.currentTime-1/30)):te.key==="."?(te.preventDefault(),Ee.duration&&(Ee.currentTime=Math.min(Ee.duration,Ee.currentTime+1/30))):te.key==="ArrowDown"?(te.preventDefault(),ve(1)):te.key==="ArrowUp"?(te.preventDefault(),ve(-1)):(te.key==="a"||te.key==="A")&&(te.preventDefault(),We()))};return window.addEventListener("keydown",X),()=>window.removeEventListener("keydown",X)},[J,fe,ve,We]);const me=X=>{var Ee;const te=(Ee=i.current)==null?void 0:Ee.getBoundingClientRect(),ue=o.current;!te||!te.width||!ue||!ue.duration||(ue.currentTime=Math.min(1,Math.max(0,(X-te.left)/te.width))*ue.duration)},xe=X=>{X.preventDefault(),D(!0),me(X.clientX)},le=X=>{var ue;const te=(ue=i.current)==null?void 0:ue.getBoundingClientRect();te!=null&&te.width&&N(Math.min(100,Math.max(0,(X.clientX-te.left)/te.width*100)))};B.useEffect(()=>{if(!M)return;const X=ue=>me(ue.clientX),te=()=>D(!1);return window.addEventListener("mousemove",X),window.addEventListener("mouseup",te),()=>{window.removeEventListener("mousemove",X),window.removeEventListener("mouseup",te)}},[M]);const _e=X=>{const te=c.current.getBoundingClientRect();return{x:(X.clientX-te.left)/te.width*100,y:(X.clientY-te.top)/te.height*100}},Ce=X=>{if(X.button!==0||u)return;const te=_e(X);v({x0:te.x,y0:te.y,x:te.x,y:te.y})},ke=X=>{var ue,Ee;if(!m)return;const te=_e(X);!((ue=o.current)!=null&&ue.paused)&&(Math.abs(te.x-m.x0)>1||Math.abs(te.y-m.y0)>1)&&((Ee=o.current)==null||Ee.pause()),v({...m,x:te.x,y:te.y})},$e=async X=>{const te=o.current;if(!(te!=null&&te.videoWidth))return;const ue=Math.round((te.currentTime??0)*1e3),Ee=Xr(g,ue);f(!0),_(r("annotator.capturing"));try{const ye=document.createElement("canvas");ye.width=te.videoWidth,ye.height=te.videoHeight;const et=ye.getContext("2d");et.drawImage(te,0,0,ye.width,ye.height),et.strokeStyle="#ff9a3c",et.lineWidth=Math.max(2,ye.width/300),et.strokeRect(X.x/100*ye.width,X.y/100*ye.height,X.w/100*ye.width,X.h/100*ye.height);const It=await new Promise(js=>ye.toBlob(js,"image/png")),{hash:rt}=await Dk(It);if(!rt)throw new Error("no hash");const ut=[Xa(ue,Ee==null?void 0:Ee.step),`![frame](/api/yatsu/blob/${rt})`];Ee!=null&&Ee.node&&Ee.node!==e.node&&ut.push(`re: [[${Ee.node}]]`),ut.push(""),h({seq:++d.current,body:ut.join(`
139
- `)}),_("")}catch{_(r("annotator.failed"))}finally{f(!1)}},Be=()=>{if(!m)return;const X={x:Math.min(m.x0,m.x),y:Math.min(m.y0,m.y),w:Math.abs(m.x-m.x0),h:Math.abs(m.y-m.y0)};if(v(null),X.w<1&&X.h<1){fe();return}$e(X)},Fe=m&&{x:Math.min(m.x0,m.x),y:Math.min(m.y0,m.y),w:Math.abs(m.x-m.x0),h:Math.abs(m.y-m.y0)};return S.jsxs("div",{className:"an-detail",children:[S.jsxs("header",{className:"an-head",children:[S.jsx("span",{className:"an-title",children:e.scenario}),S.jsx("span",{className:"an-node",children:e.node}),S.jsx("span",{className:`an-verdict-badge ${$p(T)}`,children:kc(T)}),T.evaluator&&S.jsx("span",{className:"an-meta",children:T.evaluator}),S.jsx("span",{className:"an-meta",children:new Date(T.ts).toLocaleString()}),S.jsx(w0,{originator:P,sessions:s,kind:"eval"}),F&&F.length>1&&S.jsxs("div",{className:"an-ab",children:[S.jsx("button",{type:"button",className:"an-ab-nav",disabled:I>=F.length-1,onClick:()=>L(X=>Math.min(F.length-1,X+1)),title:r("annotator.abOlder"),children:"‹"}),S.jsx("div",{className:"an-ab-track",children:F.slice().reverse().map((X,te)=>{const ue=F.length-1-te;return S.jsx("button",{type:"button",className:`an-ab-pip ${$p(X)} ${ue===I?"on":""}`,onClick:()=>L(ue),title:`${kc(X)} ${new Date(X.ts).toLocaleString()}`,children:kc(X)},`${X.ts}-${ue}`)})}),S.jsx("button",{type:"button",className:"an-ab-nav",disabled:I<=0,onClick:()=>L(X=>Math.max(0,X-1)),title:r("annotator.abNewer"),children:"›"}),S.jsx("span",{className:"an-ab-pos",children:I===0?r("annotator.abLatest"):r("annotator.abPos",{i:F.length-I,n:F.length})})]})]}),S.jsxs("div",{className:"an-work",children:[S.jsxs("div",{className:"an-stage-col",children:[T.expected&&S.jsxs("div",{className:"an-expected",children:[S.jsx("b",{children:r("nodeView.eval.expected")})," ",T.expected]}),j.length>0&&((De=T.verdict)==null?void 0:De.note)&&S.jsxs("div",{className:"an-expected an-prior-note",children:[S.jsx("b",{children:r("nodeView.eval.noteLabel")})," ",T.verdict.note]}),!T.fresh&&(((Se=T.staleAxes)==null?void 0:Se.length)??0)>0&&S.jsxs("div",{className:"an-expected an-stale",title:r("nodeView.eval.staleReadoutTitle"),children:[S.jsx("b",{children:r("nodeView.eval.staleLabel")})," ",T.staleAxes.join(" · "),(((vt=T.codeDrift)==null?void 0:vt.length)??0)>0&&S.jsxs("span",{className:"an-stale-files",children:[" — ",T.codeDrift.map(X=>`${X.file.split("/").pop()} +${X.behind}`).join(", ")]})]}),O&&S.jsxs(S.Fragment,{children:[S.jsxs("div",{className:"an-player",ref:a,children:[S.jsxs("div",{className:`an-stage ${x?"playing":"paused"}`,ref:c,onMouseDown:Ce,onMouseMove:ke,onMouseUp:Be,children:[S.jsx("video",{className:"an-video",ref:o,src:`/api/yatsu/blob/${O.hash}`,preload:"metadata",playsInline:!0}),Fe&&S.jsx("div",{className:"an-rect live",style:{left:`${Fe.x}%`,top:`${Fe.y}%`,width:`${Fe.w}%`,height:`${Fe.h}%`}}),!x&&!m&&S.jsx("div",{className:"an-bigplay","aria-hidden":!0,children:"▶"})]}),S.jsxs("div",{className:"an-bar",children:[S.jsx("button",{className:"an-play",onClick:fe,title:r(x?"annotator.pause":"annotator.play"),children:x?"⏸":"▶"}),S.jsxs("div",{className:"an-seek",ref:i,onMouseDown:xe,onMouseMove:le,onMouseLeave:()=>N(null),children:[S.jsx("div",{className:"an-seek-trk"}),Z>0&&g.map((X,te)=>S.jsx("div",{className:"an-band",style:{left:`${X.tMs/Z*100}%`},title:X.step},`band-${te}`)),S.jsx("div",{className:"an-seek-play",style:{width:`${Y}%`}}),Z>0&&K.map(X=>S.jsx("button",{type:"button",className:`an-mk ${A===X.i?"on":""} ${ie===X.i?"active":""}`,style:{left:`${X.tMs/Z*100}%`},title:X.label,onMouseDown:te=>te.stopPropagation(),onClick:te=>{te.stopPropagation(),ae(X.i,X.tMs)}},`mk-${X.i}`)),S.jsx("div",{className:"an-knob",style:{left:`${Y}%`}}),R!=null&&Z>0&&S.jsx("div",{className:"an-seek-hov",style:{left:`${R}%`},children:si(R/100*Z)})]}),S.jsxs("span",{className:"an-time",children:[si(U)," / ",si(Z)]}),ne&&S.jsx("span",{className:"an-curstep",title:ne.node?`→ ${ne.node}`:void 0,children:ne.step}),S.jsx(dk,{target:a})]})]}),g.length>0&&S.jsx("div",{className:"an-ruler",children:g.map((X,te)=>S.jsxs("button",{className:`an-step ${Xr(g,U)===X?"on":""}`,onClick:()=>ce(X.tMs),title:X.node?`→ ${X.node}`:void 0,children:[si(X.tMs)," ",X.step]},te))}),S.jsx("div",{className:"an-hint",children:r("annotator.hint")}),S.jsx("div",{className:"an-keys",children:r("annotator.keys")}),w&&S.jsx("div",{className:"an-flash",children:w})]}),V.length>0&&S.jsx("div",{className:"an-gallery",children:V.map((X,te)=>S.jsx(Ga,{e:X,alt:e.scenario},`${X.hash}-${te}`))}),q.map((X,te)=>S.jsx(Ga,{e:X,alt:e.scenario},`${X.hash}-${te}`)),j.length===0&&((ft=T.verdict)!=null&&ft.note?S.jsx("pre",{className:"eval-transcript",children:T.verdict.note}):S.jsx("div",{className:"an-hint",children:r("nodeView.eval.noImage")}))]}),S.jsx(cL,{entry:e,comments:z,specs:t,sessions:s,onWrite:n,codeSha:T.codeSha,seekMs:J?ce:null,anchorNow:J?Pe:null,draft:p,selIdx:A,activeIdx:ie,onSelect:J?ae:null,events:J?g:null})]})]})}function cL({entry:e,comments:t,codeSha:s,specs:n,sessions:r,onWrite:o,seekMs:c,anchorNow:i,draft:a,selIdx:d,activeIdx:g,onSelect:l,events:m}){const v=be(),w=(_,u)=>Rk({node:e.node,scenario:e.scenario,body:_,codeSha:s,evidence:u});return S.jsxs("aside",{className:"an-rail",children:[S.jsx("div",{className:"an-comments-head",children:v("annotator.comments",{n:t.length})}),S.jsx("div",{className:"an-rail-list",children:S.jsx(sd,{replies:t,onSeek:c,selIdx:d,activeIdx:g,onSelect:l,events:m})}),S.jsx("div",{className:"an-rail-compose",children:S.jsx(S0,{onSend:w,specs:n,sessions:r,focusId:e.node,onDone:o,anchorNow:i,draft:a},`${e.node}·${e.scenario}`)})]})}const uL=["graph","sessions","evals","issues","settings"];function Fp(e){const t=(e||"").replace(/^#\/?/,"").split("/").filter(Boolean),s=uL.includes(t[0])?t[0]:"graph",n=s==="sessions"?t[1]||null:s==="evals"&&t.length>1?t.slice(1).map(decodeURIComponent).join("/"):null;return{page:s,param:n}}const hL=(e,t)=>`#/${e}${t?`/${String(t).split("/").map(encodeURIComponent).join("/")}`:""}`;function Mt(e,t=null,{replace:s=!1}={}){const n=hL(e,t);window.location.hash!==n&&(s?window.history.replaceState(null,"",n):window.location.hash=n)}function F0(){const[e,t]=B.useState(()=>Fp(window.location.hash));return B.useEffect(()=>{const s=()=>t(Fp(window.location.hash));return window.addEventListener("hashchange",s),()=>window.removeEventListener("hashchange",s)},[]),e}function H0({rowKeys:e,sel:t,onSel:s,detail:n,children:r}){const o=be(),[c,i]=B.useState(!1),a=B.useRef({});return a.current={rowKeys:e,sel:t},B.useEffect(()=>{const d=g=>{var u;const l=(u=g.target)==null?void 0:u.tagName;if(l==="INPUT"||l==="TEXTAREA"||g.metaKey||g.ctrlKey||g.altKey||g.key!=="j"&&g.key!=="k")return;g.preventDefault(),g.stopPropagation();const{rowKeys:m,sel:v}=a.current;if(!m.length)return;const w=m.indexOf(v),_=w<0?g.key==="j"?0:m.length-1:Math.max(0,Math.min(m.length-1,w+(g.key==="j"?1:-1)));s(m[_])};return window.addEventListener("keydown",d,!0),()=>window.removeEventListener("keydown",d,!0)},[s]),B.useEffect(()=>{var d;(d=document.querySelector(".fv-list-col .sel"))==null||d.scrollIntoView({block:"nearest"})},[t]),S.jsxs("div",{className:`fv-master ${c?"folded":""}`,children:[c&&S.jsx("button",{type:"button",className:"fv-unfold",title:o("masterList.unfold"),onClick:()=>i(!1),children:"›"}),S.jsxs("div",{className:"fv-list-col",style:c?{display:"none"}:void 0,children:[S.jsx("button",{type:"button",className:"fv-fold",title:o("masterList.fold"),onClick:()=>i(!0),children:"‹"}),r]}),S.jsx("div",{className:"fv-detail",children:n})]})}function dL({specs:e=[],sessions:t=[],reloadBoard:s}){const n=be(),{page:r,param:o}=F0(),[c,i]=B.useState(null),[a,d]=B.useState(""),[g,l]=B.useState([]),m=B.useRef([]),v=B.useMemo(()=>new Map(g.map(b=>[bs(b),b])),[g]);m.current=g.map(bs);const w=c&&v.has(c)?c:m.current[0]??null,_=B.useMemo(()=>{if(!o)return null;const b=o.indexOf("/");return b>0?`eval:${o.slice(0,b)}·${o.slice(b+1)}`:null},[o]);B.useEffect(()=>{r==="evals"&&_&&i(_)},[r,_]);const u=c&&!v.has(c),f=B.useMemo(()=>!u||d0(e).some(b=>bs(b)===c),[u,e,c]);B.useEffect(()=>{u&&!f&&i(null)},[u,f]),B.useEffect(()=>{if(r!=="evals"||!w||u)return;const b=/^eval:([^·]+)·(.+)$/.exec(w);b&&Mt("evals",`${b[1]}/${b[2]}`,{replace:!0})},[r,w,u]);const p=B.useCallback(b=>l(b),[]),h=b=>{b&&(d(b),setTimeout(()=>d(""),6e3))},y=w?v.get(w):null;return S.jsxs(H0,{rowKeys:m.current,sel:w,onSel:i,detail:y?S.jsx($0,{entry:y,specs:e,sessions:t,onWrite:async b=>{h(b),await(s==null?void 0:s())}}):S.jsx("div",{className:"fv-note",children:n("evalsFeed.empty")}),children:[a&&S.jsx("div",{className:"fv-notice",children:a}),S.jsx(ak,{nodes:e,sel:w,onSel:b=>i(b),onRows:p,mustShow:u?c:null})]})}function fL({sessionId:e,specs:t=[],sessions:s=[]}){var p;const n=be(),[r,o]=B.useState(null),[c,i]=B.useState(!1),[a,d]=B.useState(null),g=B.useRef(0),l=B.useCallback(()=>{const h=++g.current;return fetch(`/api/sessions/${encodeURIComponent(e)}/evals`).then(y=>y.ok?y.json():Promise.reject()).then(y=>{h===g.current&&o(y)}).catch(()=>{h===g.current&&o(!1)})},[e]);B.useEffect(()=>{o(null),d(null),i(!1),l()},[e,l]);const m=B.useMemo(()=>r?r.nodes.map(h=>{const y=Bn(h.scenarios,h.evals),b=y.filter(E=>!E.reading).map(E=>({blind:!0,scenario:E.name,expected:E.expected,tags:E.tags,node:h.id,hue:h.hue,state:"missing"})),C=y.filter(E=>E.reading).map(E=>({...E.reading,expected:E.expected??E.reading.expected,state:E.state,node:h.id,hue:h.hue})).sort((E,x)=>Number(x.inSession)-Number(E.inSession)||(E.ts<x.ts?1:-1));return{node:h,blind:b,rows:C,sessionN:C.filter(E=>E.inSession).length}}):[],[r]),v=m.reduce((h,y)=>h+y.sessionN,0),w=B.useMemo(()=>m.flatMap(h=>[...h.blind.map(y=>({kind:"blind",key:`blind:${y.node}·${y.scenario}`,item:y})),...h.rows.filter(y=>!c||y.inSession).map(y=>({kind:"eval",key:bs(y),item:y}))]),[m,c]),_=a&&w.some(h=>h.key===a)?a:((p=w[0])==null?void 0:p.key)??null,u=w.find(h=>h.key===_);if(r===null)return S.jsx("div",{className:"fv-note",children:n("common.loading")});if(r===!1)return S.jsx("div",{className:"fv-note",children:n("sessionEval.none")});const f=(u==null?void 0:u.kind)==="eval"?S.jsx($0,{entry:u.item,specs:t,sessions:s,onWrite:l}):(u==null?void 0:u.kind)==="blind"?S.jsxs("div",{className:"an-detail",children:[S.jsxs("header",{className:"an-head",children:[S.jsx("span",{className:"an-title",children:u.item.scenario}),S.jsx("span",{className:"an-node",children:u.item.node})]}),u.item.expected&&S.jsxs("div",{className:"an-expected",children:[S.jsx("b",{children:n("nodeView.eval.expected")})," ",u.item.expected]}),S.jsx("div",{className:"an-hint",children:n("sessionEval.blindHint")})]}):S.jsx("div",{className:"fv-note",children:n("sessionEval.empty")});return S.jsxs("div",{className:"se-pane",children:[S.jsxs("div",{className:"se-gates",children:[r.gates.map(h=>S.jsxs("span",{className:`se-gate ${h.ok?"ok":"bad"}`,title:h.detail,children:[h.ok?"✓":"✗"," ",h.label]},h.label)),v>0&&S.jsx("button",{className:`ef-chip ef-stale ${c?"on":""}`,onClick:()=>i(h=>!h),children:n("sessionEval.sessionN",{n:v})}),S.jsx("a",{className:"se-export",href:`/api/sessions/${encodeURIComponent(e)}/proof`,target:"_blank",rel:"noreferrer",title:n("sessionEval.exportTitle"),children:n("sessionEval.export")})]}),S.jsx(H0,{rowKeys:w.map(h=>h.key),sel:_,onSel:d,detail:f,children:S.jsxs("div",{className:"fv-scroll",children:[w.length===0&&S.jsx("div",{className:"fv-note",children:n("sessionEval.empty")}),m.map(h=>{const y=w.filter(b=>b.item.node===h.node.id);return!y.length&&!h.node.uncoveredFrontend?null:S.jsxs("section",{className:"fv-group",children:[S.jsxs("header",{className:"fv-group-head",children:[S.jsx("span",{className:"fv-group-title",style:{color:`hsl(${h.node.hue} 60% 60%)`},children:h.node.title}),h.node.uncoveredFrontend&&S.jsx("span",{className:"se-warn",children:n("sessionEval.noYatsu")})]}),y.map((b,C)=>{const E=b.kind==="eval"&&!b.item.inSession&&C>0&&y[C-1].kind==="eval"&&y[C-1].item.inSession,x=b.kind==="blind"?S.jsxs("button",{className:`ef-row se-blind ${_===b.key?"sel":""}`,onClick:()=>d(b.key),children:[S.jsx(no,{state:"missing"}),S.jsx("span",{className:"ef-scenario",children:b.item.scenario}),S.jsx("span",{className:"ef-time",children:n("sessionEval.unmeasured")})]},b.key):S.jsx(f0,{e:b.item,selected:_===b.key,onClick:()=>d(b.key)},b.key);return E?[S.jsx("div",{className:"se-divider",children:n("sessionEval.inherited")},`div:${h.node.id}`),x]:x})]},h.node.id)})]})})]})}function z0(e,t,{min:s,max:n,dir:r=1}={}){const[o,c]=B.useState(()=>{try{const d=parseInt(localStorage.getItem(e),10);if(Number.isFinite(d))return Math.max(s,Math.min(n,d))}catch{}return t}),i=B.useRef(null),a=B.useCallback(d=>{d.preventDefault(),i.current={x:d.clientX,w:o};const g=m=>{const v=i.current;if(!v)return;const w=Math.max(s,Math.min(n,v.w+(m.clientX-v.x)*r));c(w)},l=()=>{i.current=null,window.removeEventListener("mousemove",g),window.removeEventListener("mouseup",l),document.body.classList.remove("is-resizing"),c(m=>{try{localStorage.setItem(e,String(Math.round(m)))}catch{}return m})};window.addEventListener("mousemove",g),window.addEventListener("mouseup",l),document.body.classList.add("is-resizing")},[e,o,s,n,r]);return[o,a]}const pL=[{name:"nav",color:"yellow",button:!0,when:e=>!!e&&e!=="offline",labelKey:"session.navBtn",titleKey:"session.navTitle",descKey:"session.cmd.navDesc"},{name:"eval",color:"cyan",button:!1,when:e=>!!e&&e!=="offline",labelKey:"sessionEval.btn",titleKey:"sessionEval.btnTitle",descKey:"session.cmd.evalDesc"},{name:"merge",color:"green",button:!0,when:e=>e==="review"||e==="done",labelKey:"session.merge",titleKey:"session.cmd.mergeTitle",descKey:"session.cmd.mergeDesc"},{name:"exit",color:"muted",button:!1,when:e=>!!e&&e!=="offline",titleKey:"session.cmd.exitTitle",descKey:"session.cmd.exitDesc"},{name:"close",color:"red",button:!1,when:e=>!!e&&e!=="offline",titleKey:"session.cmd.closeTitle",descKey:"session.cmd.closeDesc"}];function gL(e,t){return pL.filter(s=>s.when(e)).map(s=>({...s,run:t[s.name]}))}const Hp=()=>S.jsx("svg",{width:"15",height:"15",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:S.jsx("path",{d:"M12.5 7.2 L7 12.6 a2.6 2.6 0 0 1-3.7-3.7 L9 3.2 a1.7 1.7 0 0 1 2.4 2.4 L5.8 11.2 a0.8 0.8 0 0 1-1.2-1.2 L9.7 5"})}),zp=()=>S.jsxs("svg",{className:"si-attach-busy",width:"15",height:"15",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5","aria-hidden":"true",children:[S.jsx("circle",{cx:"8",cy:"8",r:"5.5",opacity:"0.3"}),S.jsx("path",{d:"M8 2.5 a5.5 5.5 0 0 1 5.5 5.5"})]}),mL={ArrowUp:"Up",ArrowDown:"Down",ArrowLeft:"Left",ArrowRight:"Right",Enter:"Enter",Tab:"Tab",Backspace:"Backspace",Delete:"Delete",Home:"Home",End:"End"," ":"Space"};function _L(e){const t=mL[e.key],s=e.ctrlKey||e.altKey||e.metaKey;let n=null;if(t?n=t:s?/^Key[A-Z]$/.test(e.code)?n=e.shiftKey?e.code.slice(3):e.code.slice(3).toLowerCase():/^Digit[0-9]$/.test(e.code)?n=e.code.slice(5):e.key.length===1&&(n=e.key):e.key.length===1&&(n=e.key),n==null)return null;let r="";return e.ctrlKey&&(r+="C-"),(e.altKey||e.metaKey)&&(r+="M-"),e.shiftKey&&t&&(r+="S-"),r+n}function vL(e,t){const s=t.toLowerCase(),n=[];for(const r of e){const o=r.name.toLowerCase();let c;if(!s)c=1;else if(o.startsWith(s))c=0;else if(o.includes(s))c=1;else continue;n.push({c:r,score:c})}return n.sort((r,o)=>r.score-o.score),n.slice(0,10).map(r=>r.c)}const yL=e=>e&&e[0].toUpperCase()+e.slice(1);function wL(e,t){const s=t.toLowerCase(),n=[];for(const r of e){const o=r.name.toLowerCase();let c;if(!s)c=1;else if(o.startsWith(s))c=0;else if(o.includes(s))c=1;else continue;n.push({p:r,score:c})}return n.sort((r,o)=>r.score-o.score),n.slice(0,10).map(r=>r.p)}const SL={user:"(user)",project:"(project)",skill:"[skill]","built-in":"built-in",board:"[board]"};function xL({sessions:e,specs:t=[],focusNode:s,open:n,searchOpen:r=!1,sel:o,setSel:c,seed:i,onSeedConsumed:a,onClose:d,onPickSession:g,onOpenSearch:l,reload:m}){const v=be(),[w,_]=B.useState(""),[u,f]=B.useState(null),[p,h]=B.useState(null),[y,b]=B.useState(!1),[C,E]=B.useState(()=>new Set),[x,k]=B.useState([]),[M,D]=B.useState([]),[R,N]=B.useState({}),[A,$]=B.useState(()=>{try{return localStorage.getItem("si.harness")||"claude"}catch{return"claude"}}),F=W=>{$(W);try{localStorage.setItem("si.harness",W)}catch{}},[H,I]=B.useState([]),[L,T]=B.useState(()=>{try{return localStorage.getItem("si.launcher")||""}catch{return""}}),j=W=>{T(W);try{localStorage.setItem("si.launcher",W)}catch{}},[O,V]=B.useState(!1),[q,J]=B.useState(null),[Q,z]=B.useState(!1),[P,K]=B.useState({}),[U,Z]=B.useState("terminal"),[Y,ne]=B.useState(!1),ie=Y&&U==="eval",[ce,fe]=B.useState(!1),[ae,Pe]=B.useState(!1),[We,ve]=B.useState(null),[me,xe]=B.useState(null),le=B.useRef(0),_e=B.useRef(null),Ce=B.useRef(null),ke=B.useRef(null),$e=B.useRef(null),Be=B.useRef(null),Fe=B.useRef("new"),{expanded:Me,toggle:De}=N0(),Se=B.useMemo(()=>h0(e,W=>Me.has(W)),[e,Me]),vt=B.useMemo(()=>Se.filter(W=>W.type==="row").map(W=>W.s),[Se]),ft=B.useMemo(()=>["new",...vt.map(W=>W.id)],[vt]),X=ft.includes(o)?o:"new";B.useEffect(()=>{n&&!ft.includes(o)&&c("new")},[n,ft,o,c]);const[te,ue]=z0("spex.siListWidth",240,{min:180,max:480}),Ee=(s==null?void 0:s.id)||null,ye=e.find(W=>W.id===X),et=(ye==null?void 0:ye.liveness)==="offline",It=et&&(ye==null?void 0:ye.status)!=="queued",rt=R[X]||"",ut=W=>N(G=>({...G,[X]:W}));B.useEffect(()=>{const W=(ye==null?void 0:ye.harness)||"claude";fetch(`/api/slash-commands?harness=${W}`).then(G=>G.json()).then(G=>{Array.isArray(G)&&k(G)}).catch(()=>{})},[ye==null?void 0:ye.harness]),B.useEffect(()=>{Ck().then(W=>{Array.isArray(W)&&D(W)}).catch(()=>{})},[]),B.useEffect(()=>{bk().then(W=>{const G=W==null?void 0:W.launchers;!Array.isArray(G)||!G.length||(I(G),T(re=>G.some(pe=>pe.name===re)?re:W.default&&G.some(pe=>pe.name===W.default)?W.default:G[0].name))}).catch(()=>{})},[]);const js=M;B.useEffect(()=>{z(!1),V(!1),f(null),Z("terminal")},[X]),B.useEffect(()=>{ne(U==="eval")},[U]),B.useEffect(()=>{U==="terminal"&&X!=="new"&&!Q&&ye&&ye.liveness!=="offline"&&requestAnimationFrame(()=>{var W;return(W=Ce.current)==null?void 0:W.focus()})},[U]),B.useEffect(()=>{(ye==null?void 0:ye.liveness)==="offline"&&z(!1)},[ye==null?void 0:ye.liveness]),B.useEffect(()=>{J(null)},[X]);const se=B.useRef(!1);B.useEffect(()=>{var W;se.current&&!Q&&X!=="new"&&(ye==null?void 0:ye.liveness)!=="offline"&&((W=Ce.current)==null||W.focus()),se.current=Q},[Q]);const he=B.useRef(new Map),ge=W=>{const G=he.current.get(W);if(!G||G.busy||G.keys.length===0)return;const re=G.keys;G.keys=[],G.busy=!0,fetch(`/api/sessions/${W}/rawkey`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({keys:re})}).catch(()=>{}).finally(()=>{G.busy=!1,ge(W)})},Le=W=>{const G=X;let re=he.current.get(G);re||(re={keys:[],busy:!1},he.current.set(G,re)),re.keys.push(W),ge(G)},Ue=(W,G)=>K(re=>re[W]===G?re:{...re,[W]:G}),[ee,st]=B.useState(()=>new Set);B.useEffect(()=>{st(W=>{const G=new Set;for(const re of e)re.liveness!=="offline"&&G.add(re.id);if(G.size!==W.size)return G;for(const re of G)if(!W.has(re))return G;return W})},[e]),B.useEffect(()=>{i!=null&&(c("new"),_(i),f(null),a==null||a(),requestAnimationFrame(()=>{const W=_e.current;W&&(W.focus(),W.setSelectionRange(i.length,i.length))}))},[i]),B.useEffect(()=>{if(!n)return;const W=setTimeout(()=>{var G,re;X==="new"?(G=_e.current)==null||G.focus():ye&&ye.liveness!=="offline"&&((re=Ce.current)==null||re.focus())},0);return()=>clearTimeout(W)},[n,X,ye==null?void 0:ye.liveness]),B.useEffect(()=>{const W=_e.current;!W||X!=="new"||!n||ju(W,parseFloat(getComputedStyle(W).maxHeight)||1/0)},[w,X,n]),B.useEffect(()=>{var re;const W=Ce.current;if(!W||X==="new"||!n)return;const G=Math.round((((re=$e.current)==null?void 0:re.clientHeight)||360)*.5);W.style.maxHeight=`${G}px`,ju(W,G)},[rt,X,n,U,Q]);const He=W=>{const G=W.match(/^\/(\S+)\s*([\s\S]*)$/);if(!G)return W;const re=js.find(it=>it.name===G[1]);if(!re)return W;const pe=[],Te=G[2].replace(Ep,(it,Ie)=>(pe.push(Ie),"")).trim(),je=pe.length?pe.map(it=>{const Ie=t.find(hs=>hs.id===it);return Ie?`- [[${Ie.id}]] — ${ed(Ie.path)}`:`- [[${it}]]`}).join(`
140
- `):"(No target was mentioned. If the prompt names the scope, use it; otherwise ask the human to define the scope before proceeding — unless this task needs no scope, in which case proceed.)",Ye=re.body.includes("{{targets}}")?re.body.replace("{{targets}}",je):`${re.body}
141
-
142
- ${je}`;return Te?`${Ye}
143
-
144
- ${Te}`:Ye},Tr=W=>W.replace(Ep,(G,re)=>{const pe=t.find(Te=>Te.id===re);return pe?`[[${pe.id}]] (${pe.path})`:G}),Ml=()=>{const W=w.trim();if(!W)return;const G=He(W);_("");const re=H.length?{prompt:G,launcher:L}:{prompt:G,harness:A};fetch("/api/sessions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(re)}).then(pe=>pe.json().catch(()=>null)).then(()=>m==null?void 0:m()).catch(()=>{})},Rl=(W,G)=>{const re=g0(W,G,t,Ee);if(re)return re;const pe=m0(W,G,e);if(pe)return pe;if(X==="new"){const je=W.match(/^\/(\S*)$/);if(je){const Ye=wL(js,je[1]);return Ye.length?{kind:"config",items:Ye,index:0,start:0,end:W.length,query:je[1]}:null}return null}const Te=W.match(/^\/(\S*)$/);if(Te){const je=On.map(Ie=>({name:Ie.name,description:v(Ie.descKey),board:!0,color:Ie.color})),Ye=new Set(je.map(Ie=>Ie.name)),it=vL([...je,...x.filter(Ie=>!Ye.has(Ie.name))],Te[1]);return it.length?{kind:"slash",items:it,index:0,start:0,end:W.length,query:Te[1]}:null}return null},jn=W=>f(W?Rl(W.value,W.selectionStart):null),Dl=W=>f(G=>G&&{...G,index:(G.index+W+G.items.length)%G.items.length}),Nr=W=>{if(!W||!u)return;if(u.kind==="slash"){if(W.board){const Qt=On.find(Br=>Br.name===W.name);ut(""),f(null),Qt==null||Qt.run();return}const Ie=`/${W.name} `,hs=rt.slice(0,u.start);ut(hs+Ie+rt.slice(u.end)),f(null);const un=hs.length+Ie.length;requestAnimationFrame(()=>{const Qt=Ce.current;Qt&&(Qt.focus(),Qt.setSelectionRange(un,un))});return}const G=u.kind==="config"?`/${W.name} `:u.kind==="actor"?`@${W.id} `:`[[${W.id}]] `,re=(u.kind==="mention"||u.kind==="actor")&&X!=="new",pe=re?Ce:_e,Te=re?rt:w,je=re?ut:_,Ye=Te.slice(0,u.start);je(Ye+G+Te.slice(u.end)),f(null);const it=Ye.length+G.length;requestAnimationFrame(()=>{const Ie=pe.current;Ie&&(Ie.focus(),Ie.setSelectionRange(it,it))})},oo=(W,G)=>S.jsxs("ul",{className:W?"mention-menu up":"mention-menu",role:"listbox",children:[S.jsxs("li",{className:"mention-head",children:["// ",G," — ",v("session.menuHint")]}),u.items.map((re,pe)=>{const Te=re.board?"board":re.source??re.kind,je=re.board?` sc-${re.color}`:"";return S.jsxs("li",{role:"option","aria-selected":pe===u.index,className:`${pe===u.index?"mention-item on":"mention-item"}${je}`,onMouseDown:Ye=>{Ye.preventDefault(),Nr(re)},onMouseEnter:()=>f(Ye=>Ye&&{...Ye,index:pe}),children:[S.jsxs("span",{className:re.board?"slash-name board":"slash-name",children:["/",Bu(re.name,u.query)]}),S.jsx("span",{className:"slash-desc",children:yL(re.description??re.desc)}),S.jsx("span",{className:`slash-src src-${Te}`,children:SL[Te]||Te})]},`${Te}:${re.name}`)})]}),ao=W=>S.jsx(_0,{menu:u,up:W,onPick:Nr,onHover:G=>f(re=>re&&{...re,index:G})}),lo=async()=>{const W=rt;if(!W.trim()||X==="new")return;const G=On.find(pe=>W.trim()===`/${pe.name}`);if(G){ut(""),f(null),G.run();return}const re=Tr(W);ut(""),V(!1);try{const pe=await fetch(`/api/sessions/${X}/keys`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:re,enter:!0})});if(!pe.ok)throw new Error(`keys ${pe.status}`)}catch{ut(W),V(!0)}},co=async W=>{const G=new FormData;G.append("file",W,W.name||"pasted");const re=await fetch("/api/uploads",{method:"POST",body:G});if(!re.ok)throw new Error(`upload ${re.status}`);const pe=await re.json().catch(()=>null);if(!(pe!=null&&pe.path))throw new Error("upload: no path");return pe.path},Pr=(W,G,re,pe)=>{const Te=W.current,je=Te?Te.selectionStart:G.length,Ye=Te?Te.selectionEnd:G.length,it=G.slice(0,je),Ie=(it&&!/\s$/.test(it)?" ":"")+pe+" ";re(it+Ie+G.slice(Ye)),requestAnimationFrame(()=>{if(!Te)return;Te.focus();const hs=it.length+Ie.length;Te.setSelectionRange(hs,hs)})},Ir=async(W,G)=>{const re=[...W||[]];if(!(!re.length||ce)){Pe(!1),xe(G),fe(!0);try{const pe=[];for(const Te of re)pe.push(await co(Te));G==="new"?Pr(_e,w,_,pe.join(" ")):Pr(Ce,rt,ut,pe.join(" "))}catch{Pe(!0)}finally{fe(!1)}}},uo=(W,G)=>{var pe;const re=(pe=W.clipboardData)==null?void 0:pe.files;re&&re.length&&(W.preventDefault(),Ir(re,G))},ho=(W,G)=>{var re;W.preventDefault(),ve(null),Ir((re=W.dataTransfer)==null?void 0:re.files,G)},fo=(W,G)=>{var re;[...((re=W.dataTransfer)==null?void 0:re.types)||[]].includes("Files")&&(W.preventDefault(),ve(G))},po=W=>{var G;Fe.current=W,(G=Be.current)==null||G.click()},cn=async W=>{J(null);try{const G=await fetch(`/api/sessions/${X}/${W}`,{method:"POST"});if(!G.ok){const re=await G.json().catch(()=>null);re!=null&&re.error&&J(re.error)}}catch{}await(m==null?void 0:m())},go=W=>{b(!0),E(new Set([W.id]))},mo=()=>{b(!1),E(new Set)},Al=W=>E(G=>{const re=new Set(G);return re.has(W)?re.delete(W):re.add(W),re}),Tl=()=>{mo(),m==null||m()},Nl={nav:()=>z(W=>!W),eval:()=>Z("eval"),merge:()=>cn("merge"),exit:()=>cn("exit"),close:()=>cn("close")},On=gL(ye==null?void 0:ye.status,Nl),_o=B.useRef({});_o.current={order:ft,active:X,submit:Ml,menu:u,navMenu:Dl,accept:Nr,setMenu:f,onClose:d,open:n,searchOpen:r,navMode:Q,setNavMode:z,sendRawKey:Le},B.useEffect(()=>{const W=G=>{var jr;const{order:re,active:pe,submit:Te,menu:je,navMenu:Ye,accept:it,setMenu:Ie,onClose:hs,open:un,searchOpen:Qt,navMode:Br,setNavMode:$n,sendRawKey:yo}=_o.current;if(!un||Qt)return;const Bl=G.code==="KeyI"||G.key==="i"||G.key==="I";if(G.altKey!==G.metaKey&&Bl&&pe!=="new"){G.preventDefault(),G.stopPropagation(),$n(ds=>!ds);return}if(!(G.altKey&&!G.metaKey&&!G.ctrlKey&&["KeyN","KeyF","Digit1","Digit2","Digit3","Digit4"].includes(G.code))){if((G.metaKey||G.altKey||G.ctrlKey)&&(G.key==="ArrowUp"||G.key==="ArrowDown")){G.preventDefault(),G.stopPropagation();let ds=re.indexOf(pe);ds<0&&(ds=0);const Fn=Math.max(0,Math.min(re.length-1,ds+(G.key==="ArrowDown"?1:-1)));c(re[Fn]);return}if(Br&&pe!=="new"){if(G.preventDefault(),G.stopPropagation(),G.key==="Escape"){yo("Escape");const Fn=Date.now();Fn-le.current<600&&$n(!1),le.current=Fn;return}const ds=_L(G);ds&&yo(ds);return}if(je){if(G.key==="ArrowDown"){G.preventDefault(),G.stopPropagation(),Ye(1);return}if(G.key==="ArrowUp"){G.preventDefault(),G.stopPropagation(),Ye(-1);return}if(G.key==="Enter"||G.key==="Tab"){G.preventDefault(),G.stopPropagation(),it(je.items[je.index]);return}if(G.key==="Escape"){G.preventDefault(),G.stopPropagation(),Ie(null);return}}if(G.key==="ArrowUp"||G.key==="ArrowDown"){if(((jr=G.target)==null?void 0:jr.tagName)==="TEXTAREA")return;G.preventDefault(),G.stopPropagation();const ds=re.indexOf(pe),Fn=Math.max(0,Math.min(re.length-1,ds+(G.key==="ArrowDown"?1:-1)));c(re[Fn]);return}G.key==="Enter"&&!G.shiftKey&&pe==="new"&&(G.preventDefault(),G.stopPropagation(),Te())}};return window.addEventListener("keydown",W,!0),()=>window.removeEventListener("keydown",W,!0)},[c]);const Pl=W=>W&&(W.tagName==="TEXTAREA"||W.tagName==="INPUT"||W.isContentEditable),Il=()=>{const W=_e.current||Ce.current;W&&requestAnimationFrame(()=>W.focus())},vo=W=>{if(W.stopPropagation(),W.button!==0)return;const G=W.target;Pl(G)||G.closest&&G.closest("select")||G.closest&&G.closest(".si-term-body")||G.closest&&G.closest(".se-pane")||W.preventDefault()};return B.useEffect(()=>{if(!n)return;const W=G=>{var re;(re=ke.current)!=null&&re.contains(G.target)&&(G.preventDefault(),Il())};return window.addEventListener("contextmenu",W,!0),()=>window.removeEventListener("contextmenu",W,!0)},[n]),S.jsxs(S.Fragment,{children:[S.jsx("div",{className:"si-page",style:n?void 0:{display:"none"},children:S.jsxs("div",{className:"si-panel",ref:ke,onMouseDown:vo,children:[S.jsx("input",{ref:Be,type:"file",multiple:!0,style:{display:"none"},onChange:W=>{Ir(W.target.files,Fe.current),W.target.value=""}}),ie&&S.jsx("button",{type:"button",className:"si-list-unfold",title:v("masterList.unfold"),onClick:()=>ne(!1),children:"›"}),S.jsxs("aside",{className:"si-list",style:ie?{display:"none"}:{flex:`0 0 ${te}px`},children:[y?S.jsx(lL,{ids:[...C],onCancel:mo,onClosed:Tl}):S.jsxs("div",{className:"si-toprow",children:[S.jsx("button",{className:X==="new"?"si-pill new on":"si-pill new",title:v("session.newSessionTitle"),onClick:()=>c("new"),children:S.jsx("span",{className:"si-pill-glyph",children:"+"})}),S.jsx("button",{className:"si-pill search",title:v("session.searchTitle"),onClick:l,children:S.jsx("span",{className:"si-pill-glyph",children:S.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 18 18",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[S.jsx("circle",{cx:"7.6",cy:"7.6",r:"5.1"}),S.jsx("path",{d:"M11.4 11.4 L15.6 15.6"})]})})})]}),Se.map(W=>{var Te;if(W.type==="zone")return S.jsx("div",{className:`si-zone si-zone-${W.zone}`,children:v(`sessionZone.${W.zone}`)},`zone-${W.zone}`);const G=W.s,re=W.expandable||W.depth?S.jsx(T0,{guides:W.guides,expandable:W.expandable,expanded:W.expanded,rollup:W.rollup,kin:W.kin,onToggle:()=>De(G.id)}):null,pe=y&&C.has(G.id);return S.jsxs("button",{"data-sid":G.id,className:`si-item${!y&&X===G.id?" on":""}${pe?" picked":""}`,style:{"--ov":zi(G.id)},onClick:()=>y?Al(G.id):c(G.id),onDoubleClick:()=>{var je;!y&&((je=G.ops)!=null&&je.length)&&g&&(g(G,!1),d())},onContextMenu:je=>{je.preventDefault(),je.stopPropagation(),y||h({x:je.clientX,y:je.clientY,session:G})},title:(Te=G.ops)!=null&&Te.length?v("session.opsTitle"):void 0,children:[y&&S.jsx("span",{className:`si-check${pe?" on":""}`,"aria-hidden":"true"}),S.jsx(rd,{s:G,locked:!1,showAvatar:!1,compact:!0,lead:re})]},G.id)})]}),!ie&&S.jsx("div",{className:"pane-resizer si-resizer",onMouseDown:ue,role:"separator","aria-orientation":"vertical"}),S.jsxs("section",{className:X==="new"?"si-content is-new":"si-content is-session",children:[X==="new"&&S.jsxs("div",{className:"si-new-center",children:[S.jsx("div",{className:"si-avatar","aria-hidden":"true",children:S.jsxs("svg",{viewBox:"0 0 64 64",width:"52",height:"52",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",style:{display:"block"},children:[S.jsx("path",{d:"M15 35 Q32 44 49 35",strokeWidth:"2.8"}),S.jsx("path",{d:"M32 17 L20 42",strokeWidth:"3.2"}),S.jsx("path",{d:"M32 17 L44 42",strokeWidth:"3.2"}),S.jsxs("g",{fill:"currentColor",stroke:"none",children:[S.jsx("circle",{cx:"32",cy:"16.5",r:"5"}),S.jsx("circle",{cx:"20",cy:"42.6",r:"5"}),S.jsx("circle",{cx:"44",cy:"42.6",r:"5"})]})]})}),S.jsx("div",{className:"si-ask",children:v("session.ask")}),S.jsxs("div",{className:We==="new"?"si-inputwrap dragover":"si-inputwrap",onDragOver:W=>fo(W,"new"),onDragLeave:()=>ve(null),onDrop:W=>ho(W,"new"),children:[S.jsx("textarea",{ref:_e,className:"si-input","data-focus-sink":!0,rows:1,value:w,onChange:W=>{_(W.target.value),jn(W.target)},onSelect:W=>jn(W.target),onPaste:W=>uo(W,"new"),onBlur:()=>f(null),placeholder:v("session.inputPlaceholder"),spellCheck:!1}),S.jsx("button",{type:"button",className:"si-attach",title:v("session.attachTitle"),onClick:()=>po("new"),disabled:ce,children:ce&&me==="new"?S.jsx(zp,{}):S.jsx(Hp,{})}),ae&&me==="new"&&S.jsx("span",{className:"si-attach-err",role:"alert",children:v("session.attachError")}),u&&(u.kind==="mention"||u.kind==="actor")&&ao(!1),u&&u.kind==="config"&&oo(!1,u.query?`/${u.query}`:v("session.menuPresets"))]}),H.length?(()=>{var re;const W=Op[((re=H.find(pe=>pe.name===L))==null?void 0:re.harness)||"claude"]||Op.claude,G=W.Glyph;return S.jsxs("label",{className:"si-launcher-picker",title:v("session.launcherLabel"),children:[S.jsx("span",{className:"si-launcher-label",children:v("session.launcherLabel")}),S.jsx("span",{className:"si-launcher-harness",title:W.label,"aria-hidden":"true",children:S.jsx(G,{})}),S.jsx("select",{className:"si-launcher-select",value:L,onChange:pe=>j(pe.target.value),"aria-label":v("session.launcherLabel"),children:H.map(pe=>S.jsx("option",{value:pe.name,children:pe.name},pe.name))})]})})():S.jsx("div",{className:"si-agent-picker",role:"radiogroup","aria-label":v("session.harnessLabel"),children:O0.map(W=>{const G=W.Glyph;return S.jsx("button",{type:"button",role:"radio","aria-checked":A===W.id,"aria-label":W.label,title:W.label,className:A===W.id?"si-agent-opt on":"si-agent-opt",onClick:()=>F(W.id),children:S.jsx(G,{})},W.id)})}),S.jsxs("div",{className:"si-hint",children:[v("session.hint.before"),S.jsx("code",{children:"[["}),v("session.hint.mid"),S.jsx("code",{children:"/"}),v("session.hint.after")]})]}),S.jsxs("div",{className:"si-session-wrap",style:{display:X==="new"?"none":"flex",flexDirection:"column",flex:1,minWidth:0,minHeight:0,position:"relative"},children:[S.jsxs("div",{className:"si-tabbar",children:[S.jsxs("div",{className:"si-tabs",role:"tablist",children:[S.jsx("button",{role:"tab","aria-selected":U==="terminal",className:U==="terminal"?"si-tab on":"si-tab",onClick:()=>Z("terminal"),children:v("session.tabTerminal")}),S.jsx("button",{role:"tab","aria-selected":U==="eval",className:U==="eval"?"si-tab on":"si-tab",onClick:()=>Z("eval"),children:v("session.tabEval")})]}),S.jsx("div",{className:"si-actions",children:It?S.jsx("button",{className:"si-act go",onClick:()=>cn("resume"),children:v("session.relaunch")}):On.filter(W=>W.button).map(W=>{const G=W.name==="nav"?Q?" on":P[X]?" suggest":"":"";return S.jsx("button",{className:`si-act board sc-${W.color} ${W.name}${G}`,title:v(W.titleKey),onClick:W.run,children:v(W.labelKey)},W.name)})})]}),S.jsxs("div",{className:"si-term-body",ref:$e,style:{position:"relative",display:U==="terminal"?void 0:"none"},children:[[...ee].map(W=>S.jsx("div",{className:"si-term-layer",style:{position:"absolute",inset:0,display:W===X?"block":"none"},children:S.jsx(rL,{sessionId:W,active:W===X,onMenu:Ue})},W)),It&&S.jsxs("div",{className:"si-offline",children:[S.jsx("div",{className:"si-offline-msg",children:v("session.offlineMsg")}),S.jsxs("div",{className:"si-offline-sub",children:[v("session.offlineSubBefore"),S.jsxs("code",{children:[X.slice(0,8),"…"]}),v("session.offlineSubAfter")]}),S.jsx("button",{className:"si-act go big",onClick:()=>cn("resume"),children:v("session.relaunchResume")}),q&&S.jsx("div",{className:"si-offline-err",role:"alert",children:q})]})]}),U==="terminal"&&(Q?S.jsxs("div",{className:"si-bottom nav",onClick:()=>z(!1),title:v("session.navExit"),children:[S.jsx("span",{className:"si-nav-ind",children:v("session.navInd")}),S.jsx("span",{className:"si-nav-help",children:v("session.navHelp")})]}):S.jsxs("div",{className:`${O?"si-bottom err":"si-bottom"}${We==="msg"?" dragover":""}`,onDragOver:W=>{et||fo(W,"msg")},onDragLeave:()=>ve(null),onDrop:W=>{et||ho(W,"msg")},children:[S.jsx("span",{className:"si-prompt",children:"❯"}),S.jsx("textarea",{ref:Ce,className:"si-input","data-focus-sink":!0,rows:1,value:rt,onChange:W=>{ut(W.target.value),O&&V(!1),jn(W.target)},onSelect:W=>jn(W.target),onPaste:W=>{et||uo(W,"msg")},onBlur:()=>f(null),onKeyDown:W=>{W.key==="Enter"&&!W.shiftKey&&(W.preventDefault(),W.stopPropagation(),lo())},placeholder:v(et?"session.msgOffline":"session.msgPlaceholder"),spellCheck:!1,disabled:et}),S.jsx("button",{type:"button",className:"si-attach",title:v("session.attachTitle"),onClick:()=>po("msg"),disabled:ce||et,children:ce&&me==="msg"?S.jsx(zp,{}):S.jsx(Hp,{})}),ae&&me==="msg"&&S.jsx("span",{className:"si-attach-err",role:"alert",children:v("session.attachError")}),O&&S.jsx("span",{className:"si-send-err",role:"alert",children:v("session.msgError")}),u&&u.kind==="slash"&&oo(!0,u.query?`/${u.query}`:v("session.menuCommands")),u&&(u.kind==="mention"||u.kind==="actor")&&ao(!0)]})),U==="eval"&&S.jsx(fL,{sessionId:X,specs:t,sessions:e})]})]})]})}),S.jsx(aL,{menu:p,onClose:()=>h(null),onChanged:m,onMultiSelect:go})]})}const id=[{id:"nav.up",keys:["ArrowUp","k"],rebind:!1,desc:"legend.board.move"},{id:"nav.down",keys:["ArrowDown","j"],rebind:!1,desc:"legend.board.move"},{id:"nav.parent",keys:["ArrowLeft","h"],rebind:!1,desc:"legend.board.parent"},{id:"nav.child",keys:["ArrowRight","l"],rebind:!1,desc:"legend.board.child"},{id:"board.zoomIn",keys:["+","="],rebind:!0,desc:"legend.board.zoom"},{id:"board.zoomOut",keys:["-","_"],rebind:!0,desc:"legend.board.zoom"},{id:"board.zoomReset",keys:["0"],rebind:!0,desc:"legend.board.zoom"},{id:"board.info",keys:["i","I","Enter"],rebind:!0,desc:"legend.board.info"},{id:"board.search",keys:["/"],rebind:!0,desc:"legend.board.search"},{id:"board.cycle",keys:["o"],rebind:!0,desc:"legend.board.overlayCycle"},{id:"board.cycleRev",keys:["O"],rebind:!0,desc:"legend.board.overlayCycle"},{id:"board.fresh",keys:["["],rebind:!0,desc:"legend.board.fresh"},{id:"board.evals",keys:["f"],rebind:!0,desc:"legend.board.evals"},{id:"board.newChild",keys:["n"],rebind:!1,desc:"legend.board.newChild"},{id:"board.del",keys:["d"],rebind:!1,desc:"legend.board.del"},{id:"board.settings",keys:[","],rebind:!0,desc:"legend.board.settings"},{id:"board.help",keys:["?"],rebind:!0,desc:"legend.board.help"}],CL={ArrowUp:"↑",ArrowDown:"↓",ArrowLeft:"←",ArrowRight:"→",Enter:"⏎",Escape:"esc"," ":"␣","-":"−"},W0=e=>CL[e]||e,od="spex.keybindings.v1",bL=Object.fromEntries(id.map(e=>[e.id,e]));function EL(){try{return JSON.parse(localStorage.getItem(od))||{}}catch{return{}}}let vn=EL();function ad(e){var s;const t=vn[e];return t&&t.keys||((s=bL[e])==null?void 0:s.keys)||[]}function kL(e){return!!vn[e]}function pt(e,t){return ad(e).includes(t)}function LL(e,t){vn={...vn,[e]:{...vn[e],...t}},localStorage.setItem(od,JSON.stringify(vn))}function ML(){vn={},localStorage.removeItem(od)}const RL=new Set(["=","_","I"]),DL=(()=>{const e=[];for(const t of id){const s=ad(t.id).filter(r=>!RL.has(r)).map(W0),n=e[e.length-1];n&&n.desc===t.desc?n.keys.push(...s):e.push({desc:t.desc,keys:s})}return e})(),AL=[[["←","→","h","l","⇥","1","2"],"legend.popup.switch"],[["j","k","↑","↓"],"legend.popup.scroll"],[["⏎"],"legend.popup.enter"],[["esc"],"legend.popup.esc"]],TL=["merged","active","drift","pending"],NL=["added","edited","deleted","moved"];function PL({t:e}){return S.jsxs("section",{className:"legend-sec",children:[S.jsx("div",{className:"legend-h",children:e("legend.secBoard")}),DL.map(t=>S.jsxs("div",{className:"legend-row",children:[S.jsx("span",{className:"keymap-keys",children:t.keys.map((s,n)=>S.jsx("kbd",{children:s},n))}),S.jsx("span",{className:"legend-desc",children:e(t.desc)})]},t.desc))]})}function IL({title:e,rows:t,t:s}){return S.jsxs("section",{className:"legend-sec",children:[S.jsx("div",{className:"legend-h",children:e}),t.map(([n,r])=>S.jsxs("div",{className:"legend-row",children:[S.jsx("span",{className:"keymap-keys",children:n.map((o,c)=>S.jsx("kbd",{children:o},c))}),S.jsx("span",{className:"legend-desc",children:s(r)})]},r))]})}function BL({onClose:e}){const t=be();return S.jsxs(Vi,{title:t("legend.title"),closeLabel:t("legend.close"),onClose:e,children:[S.jsx(PL,{t}),S.jsx(IL,{title:t("legend.secPopup"),rows:AL,t}),S.jsxs("section",{className:"legend-sec",children:[S.jsx("div",{className:"legend-h",children:t("legend.secStatus")}),TL.map(s=>S.jsxs("div",{className:"legend-row",children:[S.jsx("span",{className:"node-dot",style:{background:Ps[s].color},children:s==="active"&&S.jsx("span",{className:"pulse",style:{background:Ps[s].color}})}),S.jsx("span",{className:"legend-name",children:t(`status.${s}`)}),S.jsx("span",{className:"legend-desc",children:t(`legend.statusRows.${s}`)})]},s))]}),S.jsxs("section",{className:"legend-sec",children:[S.jsxs("div",{className:"legend-h",children:[t("legend.secOp")," ",S.jsx("span",{className:"legend-sub",children:t("legend.secOpSub")})]}),NL.map(s=>S.jsxs("div",{className:"legend-row",children:[S.jsx("span",{className:`ov-mark ov-${s}`,children:Ll[s]}),S.jsx("span",{className:"legend-desc",children:t(`legend.opRows.${s}`)})]},s))]}),S.jsxs("section",{className:"legend-sec",children:[S.jsx("div",{className:"legend-h",children:t("legend.secBadges")}),S.jsxs("div",{className:"legend-row",children:[S.jsx("span",{className:"drift-badge",children:"⚠N"}),S.jsx("span",{className:"legend-desc",children:t("legend.badgeDrift")})]}),S.jsxs("div",{className:"legend-row",children:[S.jsx("span",{className:"legend-glyph legend-ver",children:"vN"}),S.jsx("span",{className:"legend-desc",children:t("legend.badgeVer")})]})]}),S.jsxs("section",{className:"legend-sec",children:[S.jsx("div",{className:"legend-h",children:t("legend.secRing")}),S.jsxs("div",{className:"legend-row",children:[S.jsx("span",{className:"legend-ring ring-dashed"}),S.jsx("span",{className:"legend-desc",children:t("legend.ringDashed")})]}),S.jsxs("div",{className:"legend-row",children:[S.jsx("span",{className:"legend-ring ring-solid"}),S.jsx("span",{className:"legend-desc",children:t("legend.ringSolid")})]}),S.jsxs("div",{className:"legend-row",children:[S.jsx("span",{className:"legend-ring ring-ghost"}),S.jsx("span",{className:"legend-desc",children:t("legend.ringGhost")})]})]})]})}const U0="spexcode.theme",jL=[{code:"light",label:"settings.theme.light"},{code:"dark",label:"settings.theme.dark"}];function V0(){try{if(typeof matchMedia=="function"&&matchMedia("(prefers-color-scheme: dark)").matches)return"dark"}catch{}return"light"}function OL(){try{const e=localStorage.getItem(U0);if(e==="light"||e==="dark")return e}catch{}return V0()}function $L(e){const t=e==="light"||e==="dark"?e:V0();try{document.documentElement.setAttribute("data-theme",t)}catch{}try{localStorage.setItem(U0,t)}catch{}return t}function FL({t:e}){const[t,s]=B.useState(0),[n,r]=B.useState(null),o=()=>s(c=>c+1);return B.useEffect(()=>{if(!n)return;const c=i=>{if(i.preventDefault(),i.stopPropagation(),i.key==="Escape"){r(null);return}["Shift","Control","Alt","Meta"].includes(i.key)||(LL(n,{keys:[i.key]}),r(null),o())};return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[n]),S.jsxs("section",{className:"legend-sec",children:[S.jsx("div",{className:"legend-h",children:e("settings.secShortcuts")}),S.jsx("div",{className:"set-keys",children:id.map(c=>S.jsxs("div",{className:"set-key-row",children:[S.jsx("span",{className:"legend-desc",children:e(c.desc)}),S.jsx("button",{className:`bind-cell${n===c.id?" capturing":""}${c.rebind?"":" fixed"}${kL(c.id)?" custom":""}`,disabled:!c.rebind,onClick:()=>c.rebind&&r(c.id),children:n===c.id?S.jsx("span",{className:"bind-hint",children:e("settings.bindPrompt")}):ad(c.id).map((i,a)=>S.jsx("kbd",{children:W0(i)},a))})]},c.id))}),S.jsxs("div",{className:"set-foot",children:[S.jsx("span",{className:"legend-desc set-hint",children:e("settings.shortcutsHint")}),S.jsx("button",{className:"set-reset",onClick:()=>{ML(),r(null),o()},children:e("settings.reset")})]})]})}function HL(){const{t:e,lang:t,setLang:s}=i0(),[n,r]=B.useState(OL),o=c=>{$L(c),r(c)};return S.jsx("div",{className:"page-pane page-settings",children:S.jsxs("div",{className:"settings-body",children:[S.jsx("h1",{className:"page-title",children:e("settings.title")}),S.jsxs("section",{className:"legend-sec",children:[S.jsx("div",{className:"legend-h",children:e("settings.secLanguage")}),S.jsx("div",{className:"set-langs",children:W2.map(c=>S.jsx("button",{className:c.code===t?"set-lang on":"set-lang",onClick:()=>s(c.code),"aria-pressed":c.code===t,children:c.label},c.code))})]}),S.jsxs("section",{className:"legend-sec",children:[S.jsx("div",{className:"legend-h",children:e("settings.secTheme")}),S.jsx("div",{className:"set-langs",children:jL.map(c=>S.jsx("button",{className:c.code===n?"set-lang on":"set-lang",onClick:()=>o(c.code),"aria-pressed":c.code===n,children:e(c.label)},c.code))})]}),S.jsx(FL,{t:e})]})})}const zL=8,WL=5,UL=3,VL=1,KL=new Set(["the","a","an","and","or","of","to","in","on","is","it","its","as","at","by","for","how","does","do","what","which","that","this","these","those","with","from","into","are","be","can","just","them","they","their","so","if","not","no","but","vs","us","we","you"]);function qL(e){const t=new Set;for(const s of e.toLowerCase().split(/[^a-z0-9]+/))s.length>1&&!KL.has(s)&&t.add(s);return[...t]}function Lc(e){return e.toLowerCase().split(/[^a-z0-9]+/).filter(Boolean)}function K0(e,t){return t.startsWith(e)}function Ya(e,t){return t.startsWith(e)||t.length>=3&&e.startsWith(t)}const Wp=1.2,Up=.4;function GL(e,t,s){return e<=0?0:e*(Wp+1)/(e+Wp*(1-Up+Up*t/(s||1)))}function XL(e,t,s){if(t.nameWords.some(r=>K0(e,r)))return zL;if(t.name.includes(e))return WL;if(t.descWords.some(r=>Ya(e,r)))return UL;const n=t.bodyWords.reduce((r,o)=>r+(Ya(e,o)?1:0),0);return VL*GL(n,t.bodyWords.length,s)}function YL(e,t,s,n=140){const r=e.replace(/\s+/g," ").trim(),o=r.toLowerCase();let c=-1;for(const d of s){const g=o.match(new RegExp("\\b"+d.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")));g&&g.index!==void 0&&(c<0||g.index<c)&&(c=g.index)}if(c<0){const d=(t||r).replace(/\s+/g," ").trim();return d.length>n?d.slice(0,n).trimEnd()+"…":d}const i=Math.max(0,c-Math.floor(n/3));let a=r.slice(i,i+n).trim();return i>0&&(a="…"+a),i+n<r.length&&(a=a+"…"),a}function QL(e,t,s={}){const n=s.limit??10,r=qL(e);if(!r.length)return[];const o=t.map(g=>{const l=g.name.toLowerCase();return{ref:g.ref,name:l,nameWords:Lc(l),desc:g.desc.toLowerCase(),descWords:Lc(g.desc),bodyWords:Lc(g.body),snippetText:`${g.desc}
145
- ${g.body}`}}),c=o.length,i=o.reduce((g,l)=>g+l.bodyWords.length,0)/(c||1),a={};for(const g of r){let l=0;for(const m of o)(m.nameWords.some(v=>K0(g,v))||m.descWords.some(v=>Ya(g,v))||m.bodyWords.some(v=>Ya(g,v)))&&l++;a[g]=l>0?Math.log(c/l):0}const d=[];for(const g of o){let l=0;for(const m of r)l+=XL(m,g,i)*a[m];l<=0||d.push({ref:g.ref,score:Math.round(l*100)/100,snippet:YL(g.snippetText,g.desc,r)})}return d.sort((g,l)=>l.score-g.score),d.slice(0,n)}const ZL={pass:"var(--green)",fail:"var(--red)",stalePass:"var(--muted)",staleFail:"var(--muted)",empty:"var(--muted)",missing:"var(--muted)"},JL=e=>(e||"").replace(/^\.spec\//,"").replace(/\/spec\.md$/,""),Vp=["spec","session","issue","scenario"],eM=e=>e?[e,...Vp.filter(t=>t!==e)]:Vp;function tM(e,t,s){var o,c;const n=s==null?void 0:s.bodies,r=[];for(const i of e){const a=JL(i.path);r.push({kind:"spec",key:`spec:${i.id}`,target:i.id,color:(Ps[i.status]||Ps.pending).color,title:i.title||i.id,sub:a,name:`${i.title||i.id} ${i.id}`,desc:i.desc||"",body:(n==null?void 0:n[i.id])??i.body??""});for(const d of i.issues||[]){const g=d.status==="open";r.push({kind:"issue",key:`issue:${i.id}:${d.id}`,target:i.id,color:g?"var(--green)":"var(--muted)",title:d.concern,sub:`${d.id} · ${a}`,name:d.concern||"",desc:d.id,body:""})}for(const d of Bn(i.scenarios,i.evals)){const g=(c=(o=s==null?void 0:s.scenarios)==null?void 0:o[i.id])==null?void 0:c[d.name];r.push({kind:"scenario",key:`scenario:${i.id}:${d.name}`,target:i.id,color:ZL[d.state]||"var(--cyan)",title:d.name,sub:a,tags:d.tags,name:d.name||"",desc:"",body:g?`${g.description||""} ${g.expected||""}`.trim():d.expected||""})}}for(const i of t){const a=Nn(i),d=ro(i),g=i.status||i.promptPreview||i.note||"";r.push({kind:"session",key:`session:${i.id}`,target:i.id,color:xt[i.status]||xt.offline,title:a,sub:g,name:a||"",desc:i.status||"",body:`${i.promptPreview||i.note||""} ${d}`.trim()})}return r}function sM(e,t,s){const n=Object.fromEntries(s.map((i,a)=>[i,a])),r=(i,a)=>n[i.kind]-n[a.kind]||i.name.length-a.name.length||i.key.localeCompare(a.key);if(!t.trim())return e.slice().sort(r).slice(0,15);const o={};for(const i of s){const a=e.filter(d=>d.kind===i).sort((d,g)=>d.name.length-g.name.length||d.key.localeCompare(g.key));o[i]=QL(t,a.map(d=>({ref:d,name:d.name,desc:d.desc,body:d.body})),{limit:15}).map(d=>d.ref)}const c=[];for(let i=0;c.length<15;i++){let a=!1;for(const d of s)o[d][i]&&c.length<15&&(c.push(o[d][i]),a=!0);if(!a)break}return c}function nM({specs:e,sessions:t,onPick:s,onClose:n,boost:r=null}){const o=be(),c=D0(),[i,a]=B.useState(""),[d,g]=B.useState(0),l=B.useRef(null),m=B.useRef(null),v=B.useMemo(()=>eM(r),[r]),w=B.useMemo(()=>tM(e,t,c),[e,t,c]),_=B.useMemo(()=>sM(w,i,v),[w,i,v]);B.useEffect(()=>{var p;(p=l.current)==null||p.focus()},[]),B.useEffect(()=>{g(0)},[i]),B.useEffect(()=>{var p,h;(h=(p=m.current)==null?void 0:p.querySelector(".search-item.on"))==null||h.scrollIntoView({block:"nearest"})},[d,_]);const u=p=>{p&&(s(p),n())},f=p=>{p.key==="ArrowDown"?(p.preventDefault(),g(h=>Math.min(_.length-1,h+1))):p.key==="ArrowUp"?(p.preventDefault(),g(h=>Math.max(0,h-1))):p.key==="Enter"?(p.preventDefault(),u(_[d])):p.key==="Escape"&&(p.preventDefault(),n())};return S.jsx("div",{className:"search-backdrop","data-focus-overlay":!0,onClick:n,children:S.jsxs("div",{className:"search-panel",role:"dialog","aria-modal":"true","aria-label":o("search.title"),onClick:p=>p.stopPropagation(),children:[S.jsxs("div",{className:"search-bar",children:[S.jsx("span",{className:"search-icon",children:"⌕"}),S.jsx("input",{ref:l,className:"search-input",value:i,placeholder:o("search.placeholder"),onChange:p=>a(p.target.value),onKeyDown:f})]}),S.jsxs("ul",{className:"search-results",ref:m,children:[_.length===0&&S.jsx("li",{className:"search-empty",children:o("search.empty")}),_.map((p,h)=>S.jsxs("li",{className:`search-item${h===d?" on":""}`,onMouseEnter:()=>g(h),onClick:()=>u(p),children:[S.jsx("span",{className:"node-dot",style:{background:p.color}}),S.jsx("span",{className:`search-kind k-${p.kind}`,children:o(`search.kind.${p.kind}`)}),S.jsx("span",{className:"search-title",children:p.title||p.target}),S.jsx(Zh,{tags:p.tags}),S.jsx("span",{className:"search-path",children:p.sub})]},p.key))]}),S.jsx("div",{className:"search-foot",children:o("search.hint")})]})})}function q0(e,t,s=1,n=r=>r){if(!e.length)return null;const r=e.findIndex(o=>n(o)===t);return r===-1?s>0?e[0]:e[e.length-1]:e[(r+s+e.length)%e.length]}const rM=["merged","active","drift","pending"],iM=[{state:"pass",always:!0,titleKey:"scorePass"},{state:"fail",always:!0,titleKey:"scoreFail"},{state:"stalePass",always:!1,titleKey:"scoreStalePass"},{state:"staleFail",always:!1,titleKey:"scoreStaleFail"},{state:"empty",always:!1,titleKey:"scoreEmpty"}];function oM(e){const t={merged:[],active:[],drift:[],pending:[]},s=[],n=[],r=new Set,o={pass:0,fail:0,stalePass:0,staleFail:0,empty:0},c={pass:[],fail:[],stalePass:[],staleFail:[],empty:[]};for(const i of e){t[i.status]&&t[i.status].push(i.id),i.drift>0&&s.push(i.id);const a=i.openIssues||[];if(a.length){n.push(i.id);for(const g of a)r.add(g.id)}const d=new Set;for(const g of Bn(i.scenarios,i.evals)){const l=g.state==="missing"?"empty":g.state;o[l]!==void 0&&(o[l]++,d.has(l)||(d.add(l),c[l].push(i.id)))}}return{total:e.length,status:t,driftIds:s,issueIds:n,issueCount:r.size,scoreCount:o,scoreNodes:c}}function Go({count:e,ids:t,focusId:s,onJump:n,title:r,cls:o="",children:c}){const i=t.length>0;return S.jsxs("button",{type:"button",className:`bstat ${o}`.trim(),disabled:!i,title:r,onClick:i?()=>n(q0(t,s)):void 0,children:[c,e]})}function aM({specs:e,focusId:t,onJump:s}){const n=be(),r=B.useMemo(()=>oM(e),[e]),o=c=>c&&(s==null?void 0:s(c));return S.jsxs("div",{className:"board-stats",role:"group","aria-label":n("stats.aria"),children:[S.jsx("span",{className:"bstat-total",title:n("stats.totalTitle",{n:r.total}),children:r.total}),rM.map(c=>S.jsx(Go,{count:r.status[c].length,ids:r.status[c],focusId:t,onJump:o,title:n("stats.statusTitle",{n:r.status[c].length,status:n(`status.${c}`)}),children:S.jsx("span",{className:"bstat-dot",style:{background:Ps[c].color}})},c)),S.jsx("span",{className:"bstat-sep"}),S.jsx(Go,{count:r.driftIds.length,ids:r.driftIds,focusId:t,onJump:o,cls:"bstat-drift",title:n("stats.driftTitle",{n:r.driftIds.length}),children:"⚠"}),S.jsx(Go,{count:r.issueCount,ids:r.issueIds,focusId:t,onJump:o,cls:"bstat-issue",title:n("stats.issueTitle",{n:r.issueCount}),children:"◆"}),S.jsx("span",{className:"bstat-sep"}),iM.map(({state:c,always:i,titleKey:a})=>{const d=r.scoreCount[c],g=r.scoreNodes[c];return!d&&!i?null:S.jsx(Go,{count:d,ids:g,focusId:t,onJump:o,title:n(`stats.${a}`,{n:d}),children:S.jsx(no,{state:c})},c)})]})}const lM=()=>S.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[S.jsx("rect",{x:"1.5",y:"6.5",width:"5",height:"4.4",rx:"1"}),S.jsx("rect",{x:"11.5",y:"1.8",width:"5",height:"4.4",rx:"1"}),S.jsx("rect",{x:"11.5",y:"11.8",width:"5",height:"4.4",rx:"1"}),S.jsx("path",{d:"M6.5 8.7 h2.2 M11.5 4 h-1.3 q-1.5 0-1.5 1.5 v7 q0 1.5 1.5 1.5 h1.3"})]}),cM=()=>S.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[S.jsx("rect",{x:"1.5",y:"2.5",width:"15",height:"13",rx:"1.6"}),S.jsx("path",{d:"M4.6 6.5 l2.6 2.3 -2.6 2.3 M9 12.4 h4"})]}),uM=()=>S.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[S.jsx("path",{d:"M2.5 15.5 v-11"}),S.jsx("path",{d:"M2.5 15.5 h13"}),S.jsx("rect",{x:"4.6",y:"10",width:"2.6",height:"3.5",rx:"0.5"}),S.jsx("rect",{x:"8.7",y:"7",width:"2.6",height:"6.5",rx:"0.5"}),S.jsx("path",{d:"M13 6 l1.4 1.4 L16.5 3.6"})]}),hM=()=>S.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[S.jsx("path",{d:"M2.5 3.5 h13 v8.4 h-7 l-3.6 3 v-3 h-2.4 z"}),S.jsx("path",{d:"M5.4 6.7 h7.2 M5.4 9.2 h4.8"})]}),dM=()=>S.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[S.jsx("circle",{cx:"12",cy:"12",r:"3"}),S.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"})]}),fM=[{page:"graph",Glyph:lM},{page:"sessions",Glyph:cM},{page:"evals",Glyph:uM},{page:"issues",Glyph:hM}];function Kp({page:e,Glyph:t,active:s,onNav:n,label:r}){return S.jsx("button",{type:"button",className:s?"rail-btn on":"rail-btn",title:r,"aria-label":r,"aria-current":s?"page":void 0,onClick:()=>n(e),children:S.jsx(t,{})})}function pM({page:e,onNav:t}){const s=be();return S.jsxs("nav",{className:"side-rail","aria-label":s("nav.railLabel"),children:[fM.map(n=>S.jsx(Kp,{page:n.page,Glyph:n.Glyph,active:e===n.page,onNav:t,label:s(`nav.${n.page}`)},n.page)),S.jsx("div",{className:"rail-spacer"}),S.jsx(Kp,{page:"settings",Glyph:dM,active:e==="settings",onNav:t,label:s("nav.settings")})]})}function gM({onFocusNode:e,specs:t=[],sessions:s=[],issuesData:n=null,reloadIssues:r}){const o=be(),c=n,[i,a]=B.useState(!1),[d,g]=B.useState(!1),[l,m]=B.useState(!1),[v,w]=B.useState("all"),[_,u]=B.useState(""),[f,p]=B.useState(null),h=B.useRef([]),y=B.useCallback(()=>r==null?void 0:r(!0),[r]),b=I=>{I&&(u(I),setTimeout(()=>u(""),6e3))},C=Array.isArray(c==null?void 0:c.issues)?c.issues:[],E=I=>I.status==="closed"||I.status==="rejected"||I.status==="landed",x=[...new Set(C.map(I=>I.store).filter(Boolean))],k=Array.isArray(c==null?void 0:c.stores)&&c.stores.length?c.stores:[{id:"local",label:"local",kind:"local"}],M=v==="all"?C:C.filter(I=>I.store===v),D=l?M:M.filter(I=>!E(I)),R=M.filter(I=>I.status==="open").length,N=M.filter(E).length,A=B.useMemo(()=>new Map(D.map(I=>[`issue:${I.id}`,I])),[D]);h.current=D.map(I=>`issue:${I.id}`);const $=f&&A.has(f)?f:h.current[0]??null,F=B.useRef({});if(F.current={effSel:$},hr(i,()=>a(!1)),B.useEffect(()=>{const I=L=>{var q;const T=(q=L.target)==null?void 0:q.tagName;if(T==="INPUT"||T==="TEXTAREA"||L.metaKey||L.ctrlKey||L.altKey||L.key!=="j"&&L.key!=="k")return;L.preventDefault(),L.stopPropagation();const j=h.current;if(!j.length)return;const O=j.indexOf(F.current.effSel),V=O<0?L.key==="j"?0:j.length-1:Math.max(0,Math.min(j.length-1,O+(L.key==="j"?1:-1)));p(j[V])};return window.addEventListener("keydown",I,!0),()=>window.removeEventListener("keydown",I,!0)},[]),B.useEffect(()=>{var I;(I=document.querySelector(".fv-list-col .sel"))==null||I.scrollIntoView({block:"nearest"})},[$]),c==null)return S.jsx("div",{className:"fv-note",children:o("session.issuesLoading")});if(!c.enabled)return S.jsx("div",{className:"fv-note",children:o("session.issuesOff")});const H=$?A.get($):null;return S.jsxs("div",{className:`fv-master ${d?"folded":""}`,children:[d&&S.jsx("button",{type:"button",className:"fv-unfold",title:o("masterList.unfold"),onClick:()=>g(!1),children:"›"}),S.jsxs("div",{className:"fv-list-col",style:d?{display:"none"}:void 0,children:[S.jsx("button",{type:"button",className:"fv-fold",title:o("masterList.fold"),onClick:()=>g(!0),children:"‹"}),_&&S.jsx("div",{className:"fv-notice",children:_}),S.jsxs("section",{className:"fv-group",children:[S.jsxs("header",{className:"fv-group-head",children:[S.jsxs("span",{className:"ef-chipbar",children:[x.length>1&&S.jsxs("select",{className:"fv-store-filter",value:v,onChange:I=>w(I.target.value),children:[S.jsx("option",{value:"all",children:o("session.issuesStoreAll")}),x.map(I=>S.jsx("option",{value:I,children:I},I))]}),S.jsx("button",{type:"button",className:"fv-new-btn",onClick:()=>a(!0),children:o("session.issuesNew")}),N>0&&S.jsx("button",{type:"button",className:`ef-chip fv-concluded ${l?"on":""}`,onClick:()=>m(I=>!I),children:o("nodeView.closedIssues",{n:N})})]}),S.jsx("span",{className:"fv-group-meta",children:o("session.issuesThreadsSummary",{open:R,total:M.length})})]}),!D.length&&S.jsx("div",{className:"fv-note",children:o("session.issuesEmpty")}),D.map(I=>{var T;const L=`issue:${I.id}`;return S.jsxs("button",{className:`fv-row ${$===L?"sel":""}`,onClick:()=>p(L),children:[S.jsx("span",{className:`fv-dot st-${I.status||"open"}`,title:I.status}),S.jsx("span",{className:"fv-concern",children:I.concern}),(((T=I.replies)==null?void 0:T.length)??0)>0&&S.jsx("span",{className:"fv-replies",title:o("session.issuesReplies",{n:I.replies.length}),children:I.replies.length}),x.length>1&&S.jsx("span",{className:`fv-store fv-store-${I.store==="local"?"local":"forge"}`,children:I.store})]},I.id)})]})]}),S.jsx("div",{className:"fv-detail",children:H?S.jsx(mM,{issue:H,specs:t,sessions:s,onFocusNode:e,onWrite:async I=>{b(I),await y()}}):S.jsx("div",{className:"fv-note",children:o("session.issuesEmpty")})}),i&&S.jsx(Vi,{title:o("session.issuesNew"),closeLabel:o("common.close"),onClose:()=>a(!1),className:"fv-new-modal",children:S.jsx(vM,{specs:t,sessions:s,stores:k,onCancel:()=>a(!1),onDone:async I=>{a(!1),b(I),await y()}})})]})}function mM({issue:e,specs:t,sessions:s,onFocusNode:n,onWrite:r}){const o=be(),c=e.store==="local",i=e.status==="closed"||e.status==="rejected"||e.status==="landed",[a,d]=B.useState(!1),[g,l]=B.useState(""),m=Array.isArray(e.nodes)?e.nodes:[],v=Array.isArray(e.signers)?e.signers:[],w=Array.isArray(e.replies)?e.replies:[],_=async()=>{if(!a){d(!0);try{const u=await Lk(e.id);u!=null&&u.ok?(l(""),await(r==null?void 0:r(""))):l((u==null?void 0:u.error)||"close failed")}finally{d(!1)}}};return S.jsxs("div",{className:"fvd",children:[S.jsxs("div",{className:"fvd-scroll",children:[S.jsx("header",{className:"fvd-head",children:S.jsx("span",{className:"fvd-concern",children:e.concern})}),S.jsxs("div",{className:"fvd-meta",children:[e.status&&S.jsx("span",{className:`fv-status fv-st-${e.status}`,children:e.status}),S.jsx("span",{className:`fv-store fv-store-${c?"local":"forge"}`,children:e.store}),c?S.jsx(w0,{originator:e.by,sessions:s,kind:"issue"}):e.by&&S.jsx("span",{className:"fv-by",children:e.by}),c&&v.length>0&&S.jsx("span",{className:"fv-count",children:o("session.issuesSigned",{n:v.length})}),m.map(u=>S.jsx("button",{type:"button",className:"fv-chip",onClick:()=>n==null?void 0:n(u),title:o("session.issuesFocusNode"),children:u},u)),e.url&&S.jsx("a",{className:"fv-link",href:e.url,target:"_blank",rel:"noreferrer",children:o("session.issuesOpenOnForge")})]}),e.body&&S.jsx("div",{className:"fvd-body",children:S.jsx(Ui,{body:e.body})}),S.jsx(sd,{replies:w})]}),S.jsx("div",{className:"fvd-compose",children:S.jsx(S0,{onSend:(u,f)=>kk(e.id,u,f),specs:t,sessions:s,focusId:m[0]||null,onDone:r,actionsEnd:!i&&S.jsxs(S.Fragment,{children:[g&&S.jsx("span",{className:"fv-error",children:g}),S.jsx("button",{type:"button",className:"fv-close-issue",disabled:a,onMouseDown:u=>u.preventDefault(),onClick:_,children:o(a?"session.issuesClosing":"session.issuesCloseIssue")})]})},e.id)})]})}const _M=e=>e.id==="local"?"L":e.id==="github"?"GH":e.id==="gitlab"?"GL":(e.id||"?").slice(0,2).toUpperCase();function vM({specs:e,sessions:t,stores:s,onCancel:n,onDone:r}){var h;const o=be(),[c,i]=B.useState(((h=s[0])==null?void 0:h.id)||"local"),[a,d]=B.useState(""),[g,l]=B.useState(""),[m,v]=B.useState(!1),[w,_]=B.useState(""),u=B.useRef(null),f=v0({inputRef:u,value:g,setValue:l,specs:e,sessions:t,up:!0,fixedAbove:".fv-new-modal"});B.useEffect(()=>{var y;s.some(b=>b.id===c)||i(((y=s[0])==null?void 0:y.id)||"local")},[s,c]);const p=async()=>{const y=a.trim();if(!(!y||m)){v(!0),_("");try{const b=await Mk({concern:y,body:g.trim()||void 0,store:c});b!=null&&b.ok?(d(""),l(""),await(r==null?void 0:r(b.outcomes||""))):_((b==null?void 0:b.error)||o("session.issuesPostFailed"))}finally{v(!1)}}};return S.jsxs("div",{className:"fv-new-form",children:[S.jsxs("label",{className:"fv-store-pick",children:[S.jsx("span",{children:o("session.issuesStoreLabel")}),S.jsx("select",{value:c,disabled:m,onChange:y=>i(y.target.value),children:s.map(y=>S.jsxs("option",{value:y.id,children:[_M(y)," · ",y.label||y.id]},y.id))})]}),S.jsx("input",{className:"fv-input",value:a,placeholder:o("session.issuesConcernPlaceholder"),disabled:m,onChange:y=>d(y.target.value)}),S.jsxs("div",{className:"fv-tawrap",children:[S.jsx("textarea",{ref:u,className:"fv-textarea",rows:3,value:g,placeholder:o("session.issuesBodyPlaceholder"),disabled:m,onChange:y=>{l(y.target.value),f.sync(y.target)},onSelect:y=>f.sync(y.target),onBlur:f.close,onKeyDown:y=>{f.onKeyDown(y)||y.key==="Enter"&&(y.metaKey||y.ctrlKey)&&(y.preventDefault(),p())}}),f.menuEl]}),S.jsxs("div",{className:"fv-actions",children:[S.jsx("span",{className:w?"fv-error":"fv-hint",children:w||o("session.issuesMentionHint")}),S.jsx("button",{type:"button",className:"fv-cancel",disabled:m,onClick:n,children:o("common.cancel")}),S.jsx("button",{type:"button",className:"fv-send",disabled:m||!a.trim(),onClick:p,children:o(m?"session.issuesSending":"session.issuesPost")})]})]})}const yM={spec:"nodeView.paneSpec",history:"nodeView.paneHistory",issues:"nodeView.paneIssues",eval:"nodeView.paneEval",edit:"nodeView.paneEdit"},qp=(e,t)=>t.filter(s=>{var n;return(n=s.ops)==null?void 0:n.some(r=>r.nodeId===e.id)});function G0({status:e}){const t=Ps[e]||Ps.pending;return S.jsx("span",{className:"m-dot",style:{background:t.color}})}function wM({node:e,kids:t,editors:s,onTap:n}){return S.jsxs("button",{className:"m-row",onClick:n,children:[S.jsx(G0,{status:e.status}),S.jsx("span",{className:"m-row-title",children:e.title}),s.length>0&&S.jsx("span",{className:"m-row-faces",children:s.slice(0,3).map(r=>S.jsx(so,{seed:r.id,status:r.status,title:ro(r)},r.id))}),e.version?S.jsxs("span",{className:"m-row-ver",children:["v",e.version]}):null,t>0&&S.jsxs("span",{className:"m-row-kids",children:["▸",t]}),S.jsx("span",{className:"m-row-chev",children:"›"})]})}function SM({node:e,childrenOf:t,sessions:s,onOpenChild:n}){const r=be(),o=b0(e.id),c=t(e.id),i=nd(e),a=[...c.length?[{key:"children",label:r("mobile.childrenTab",{n:c.length})}]:[],...i.map(v=>({key:v.key,label:r(yM[v.key])}))],[d,g]=B.useState(null);B.useEffect(()=>{g(null)},[e.id]);const l=d&&a.some(v=>v.key===d)?d:a[0].key,m=qp(e,s);return S.jsxs("div",{className:"m-node",children:[S.jsxs("div",{className:"m-node-head",children:[S.jsx(G0,{status:e.status}),S.jsx("span",{className:"m-node-title",children:e.title}),e.version?S.jsxs("span",{className:"m-node-ver",children:["v",e.version]}):null,S.jsx("span",{className:"m-node-status",children:r(`status.${e.status}`)}),m.length>0&&S.jsx("span",{className:"m-node-faces",title:r("mobile.liveEditors",{n:m.length}),children:m.map(v=>S.jsx(so,{seed:v.id,status:v.status,title:ro(v)},v.id))})]}),e.desc&&S.jsx("div",{className:"m-node-desc",children:e.desc}),S.jsx("div",{className:"m-tabs",children:a.map(v=>S.jsx("button",{className:v.key===l?"m-tab on":"m-tab",onClick:()=>g(v.key),children:v.label},v.key))}),S.jsxs("div",{className:l==="history"?"m-pane-host fixed":"m-pane-host",children:[l==="children"&&S.jsx("div",{className:"m-children",children:c.map(v=>S.jsx(wM,{node:v,kids:t(v.id).length,editors:qp(v,s),onTap:()=>n(v.id)},v.id))}),l==="spec"&&S.jsx(C0,{node:e}),l==="history"&&S.jsx(L0,{node:e,rows:o}),l==="issues"&&S.jsx(M0,{node:e}),l==="edit"&&S.jsx(R0,{node:e})]})]})}function xM({sessions:e,openId:t,setOpenId:s,byId:n,goToNode:r}){const o=be(),c=t?e.find(i=>i.id===t):null;if(c){const i=c.ops||[];return S.jsxs("div",{className:"m-sessdetail",children:[S.jsxs("div",{className:"m-sess-card",children:[S.jsx(so,{seed:c.id,status:c.status}),S.jsxs("div",{className:"m-sess-meta",children:[S.jsx("span",{className:"m-sess-name",children:ro(c)}),S.jsx("span",{className:"m-sess-status",style:{color:xt[c.status]},children:o(`status.${c.status}`)})]})]}),c.activity&&S.jsx("div",{className:"m-sess-activity",children:c.activity}),S.jsx("div",{className:"m-sess-section",children:o("mobile.changing",{n:i.length})}),i.length===0?S.jsx("div",{className:"m-empty",children:o("mobile.noChanges")}):i.map((a,d)=>{const g=n[a.nodeId];return S.jsxs("button",{className:"m-row",disabled:!g,onClick:()=>g&&r(a.nodeId),children:[S.jsx("span",{className:`ov-mark ov-${a.op}`,children:Ll[a.op]||"•"}),S.jsx("span",{className:"m-row-title",children:g?g.title:a.nodeId}),g&&S.jsx("span",{className:"m-row-chev",children:"›"})]},d)})]})}return e.length?S.jsx("div",{className:"m-sesslist",children:e.map(i=>S.jsx("button",{className:"m-sess-row",onClick:()=>s(i.id),children:S.jsx(rd,{s:i,locked:!1})},i.id))}):S.jsx("div",{className:"m-empty big",children:o("mobile.noSessions")})}function CM({specs:e,sessions:t,project:s}){const n=be(),r=B.useMemo(()=>Object.fromEntries(e.map(b=>[b.id,b])),[e]),o=B.useMemo(()=>e.find(b=>!b.parent)||e[0],[e]),c=B.useMemo(()=>{const b={};return e.forEach(C=>{var E;C.parent&&(b[E=C.parent]??(b[E]=[])).push(C)}),C=>b[C]||[]},[e]),i=B.useMemo(()=>b=>{const C=[];for(let E=r[b];E;E=E.parent?r[E.parent]:null)C.unshift(E.id);return C},[r]),[a,d]=B.useState("specs"),[g,l]=B.useState(()=>o?[o.id]:[]),[m,v]=B.useState(null),w=g.filter(b=>r[b]),_=w[w.length-1]||(o==null?void 0:o.id),u=_?r[_]:null,f=b=>l(C=>[...C.filter(E=>r[E]),b]),p=b=>{l(i(b)),v(null),d("specs")},h=a==="specs"?w.length>1:!!m,y=()=>{a==="specs"?l(b=>b.slice(0,-1)):v(null)};return S.jsxs("div",{className:"m-app",children:[S.jsxs("header",{className:"m-topbar",children:[h?S.jsx("button",{className:"m-back",onClick:y,"aria-label":n("mobile.back"),children:"‹"}):S.jsx("span",{className:"m-back ghost","aria-hidden":"true"}),S.jsx("span",{className:"m-brand",children:s||"SpexCode"})]}),S.jsx("main",{className:"m-main",children:a==="specs"?S.jsxs("div",{className:"m-specs",children:[S.jsx("nav",{className:"m-crumbs",children:w.map((b,C)=>S.jsxs("span",{className:"m-crumb",children:[C>0&&S.jsx("span",{className:"m-crumb-sep",children:"›"}),S.jsx("button",{className:C===w.length-1?"m-crumb-btn cur":"m-crumb-btn",onClick:()=>l(w.slice(0,C+1)),children:r[b].title})]},b))}),u&&S.jsx(SM,{node:u,childrenOf:c,sessions:t,onOpenChild:f},u.id)]}):S.jsx(xM,{sessions:t,openId:m,setOpenId:v,byId:r,goToNode:p})}),S.jsxs("nav",{className:"m-tabbar",children:[S.jsxs("button",{className:a==="specs"?"m-tabbar-btn on":"m-tabbar-btn",onClick:()=>d("specs"),children:[S.jsx("span",{className:"m-tabbar-ico",children:"❯_"}),n("mobile.specsTab")]}),S.jsxs("button",{className:a==="sessions"?"m-tabbar-btn on":"m-tabbar-btn",onClick:()=>d("sessions"),children:[S.jsx("span",{className:"m-tabbar-ico",children:"◐"}),n("mobile.sessionsTab"),t.length>0&&S.jsx("span",{className:"m-tabbar-badge",children:t.length})]})]})]})}const Gp="(max-width: 640px)";function bM(){const[e,t]=B.useState(()=>typeof window<"u"&&window.matchMedia(Gp).matches);return B.useEffect(()=>{const s=window.matchMedia(Gp),n=()=>t(s.matches);return s.addEventListener("change",n),()=>s.removeEventListener("change",n)},[]),e}function Xp(){let e=0,t=null,s=null,n=null;return function(o,c){if(!o)return;const i=n!=null&&Math.abs(o.scrollTop-n)>1;(o!==s||i)&&(s=o,t=null,n=null);const a=o.scrollHeight-o.clientHeight,d=t??o.scrollTop;t=Math.max(0,Math.min(a,d+c)),cancelAnimationFrame(e);const g=()=>{if(n!=null&&Math.abs(o.scrollTop-n)>1){cancelAnimationFrame(e),t=null,n=null;return}const l=t-o.scrollTop;if(Math.abs(l)<.5){o.scrollTop=t,n=o.scrollTop;return}o.scrollTop+=l*.2,n=o.scrollTop,e=requestAnimationFrame(g)};e=requestAnimationFrame(g)}}let Ou=null;const EM=e=>!!(e&&e.closest&&e.closest("[data-focus-overlay]")),Yp=e=>!!(e&&e.isConnected&&!e.disabled&&e.getClientRects().length);typeof window<"u"&&window.addEventListener("focusin",e=>{const t=e.target;t&&t!==document.body&&!EM(t)&&(Ou=t)},!0);function kM(){requestAnimationFrame(()=>{if(Yp(Ou)){Ou.focus();return}const e=document.querySelector("[data-focus-sink]");Yp(e)&&e.focus()})}const LM={spec:tk},MM=220,RM=46,Qp=e=>Math.max(.4,Math.min(1.6,e)),ni={nn:e=>`Create a new spec node under [[${e}]] — choose a kebab-case id, write its spec.md at contract altitude with a code: list, implement it, then propose merge. What it should be: `,dd:e=>`Delete the [[${e}]] spec node — remove its dir, repoint or fold its governed code, fix any [[…]] refs, recover its intent from git history, then propose merge. Why: `},X0=Object.keys(ni),DM=new Set(X0.map(e=>e[0]));function AM({specs:e,sessions:t,reload:s,project:n,issuesData:r,reloadIssues:o}){const{page:c,param:i}=F0(),[a,d]=B.useState(()=>{var se;return(se=e.find(he=>!he.parent))==null?void 0:se.id}),[g,l]=B.useState(!1),[m,v]=B.useState("spec"),[w,_]=B.useState(!1),[u,f]=B.useState(null),[p,h]=B.useState("new"),[y,b]=B.useState(null),[C,E]=B.useState(null),[x,k]=B.useState(null),{getViewport:M,setViewport:D}=bl(),R=be(),N=B.useRef(null),A=B.useRef(0),$=B.useRef({buf:"",timer:0}),[F,H]=B.useState(!1),I=B.useRef(!1);I.current=F;const L=B.useRef({x:-1,y:-1}),T=B.useMemo(()=>Xp(),[]),j=B.useMemo(()=>Xp(),[]),O=B.useMemo(()=>Object.fromEntries(e.map(se=>[se.id,se])),[e]),V=O[a]||e.find(se=>!se.parent)||e[0],q=B.useMemo(()=>{const se=new Set;for(let he=V;he;he=he.parent?O[he.parent]:null)se.add(he.id);return se},[V,O]),J=B.useMemo(()=>vk(e,q),[e,q]),Q=B.useMemo(()=>e.filter(se=>J[se.id]).map(se=>({...se,...J[se.id]})),[e,J]),z=B.useMemo(()=>Object.fromEntries(Q.map(se=>[se.id,se])),[Q]),P=z[V.id],K=B.useMemo(()=>{const se={};return e.forEach(he=>{he.parent&&(se[he.parent]=(se[he.parent]||0)+1)}),se},[e]),U=B.useMemo(()=>e.filter(se=>{var he;return(he=se.overlays)==null?void 0:he.length}),[e]),Z=B.useMemo(()=>y?t.find(se=>se.source===y):null,[t,y]),Y=B.useMemo(()=>y?e.filter(se=>(se.overlays||[]).some(he=>he.source===y)):[],[e,y]),ne=B.useMemo(()=>y?Y:U,[y,Y,U]),ie=B.useCallback(se=>se?t.filter(he=>{var ge;return(ge=he.ops)==null?void 0:ge.some(Le=>Le.nodeId===se.id)}):[],[t]),ce=B.useCallback(()=>{v("eval"),l(!0)},[]),fe=B.useCallback(se=>{h(se),Mt("sessions",se)},[]),ae=B.useCallback(se=>{h("new"),E(se),Mt("sessions","new")},[]),Pe=B.useMemo(()=>{var ge;if(!x)return[];const se=e.find(Le=>Le.id===x.id);return(ge=se==null?void 0:se.overlays)!=null&&ge.length?[...new Set(se.overlays.map(Le=>Le.source))].map(Le=>t.find(Ue=>Ue.source===Le)).filter(Boolean):[]},[x,e,t]),We=B.useCallback(se=>{se.kind==="session"?fe(se.target):(Mt("graph"),d(se.target))},[fe]);B.useEffect(()=>{c==="sessions"&&i&&i!==p&&h(i)},[c,i]),B.useEffect(()=>{c==="sessions"&&Mt("sessions",p,{replace:!0})},[c,p]),B.useEffect(()=>{c!=="graph"&&(l(!1),_(!1),f(null),k(null))},[c]);const ve=B.useMemo(()=>Q.filter(se=>se.parent===P.id),[Q,P]),me=P.parent?z[P.parent]:null,xe=B.useMemo(()=>ve.length?ve.reduce((se,he)=>Math.abs(he.y-P.y)<Math.abs(se.y-P.y)?he:se):null,[ve,P]),le=B.useMemo(()=>{if(xe)return xe;let se=null,he=1/0;for(const ge of Q){const Le=ge.x-P.x;if(Le<=0)continue;const Ue=ge.y-P.y,ee=(Le/x0)**2+(Ue/fa)**2;ee<he&&(he=ee,se=ge)}return se},[xe,Q,P]),_e=B.useCallback(se=>{let he=null;for(const ge of Q){if(ge.id===P.id||ge.x!==P.x)continue;const Le=ge.y-P.y;(se==="down"?Le<=0:Le>=0)||(!he||Math.abs(Le)<Math.abs(he.y-P.y))&&(he=ge)}return he},[Q,P]),Ce=B.useMemo(()=>_e("down"),[_e]),ke=B.useMemo(()=>_e("up"),[_e]),$e=B.useMemo(()=>Q.map(se=>{const he=se.id===a||se.id===P.parent||se.parent===a||se.parent===P.parent;let ge;y&&Y.length?ge=(se.overlays||[]).some(He=>He.source===y)?"ov-hot":"ov-dim":ge=he?void 0:"is-far";const Ue=ie(se).map(He=>({id:He.id,status:He.status,node:He.node})),ee=K[se.id]||0,st={editors:Ue,collapsed:ee>0&&!q.has(se.id),childCount:ee};return{id:se.id,type:"spec",position:{x:se.x,y:se.y},data:{...se,...st},draggable:!1,selected:se.id===a,className:ge}}),[a,P.parent,y,Y,Q,ie,K,q]),Be=B.useMemo(()=>{const se=Q.filter(ge=>ge.parent).map(ge=>{const Le=ge.id===a||ge.parent===a;return{id:`${ge.parent}-${ge.id}`,source:ge.parent,target:ge.id,type:"smoothstep",style:{stroke:Le?"var(--blue)":"var(--line)",strokeWidth:Le?2:1},zIndex:Le?1:0}}),he=[];for(const ge of Q){const Le=(ge.overlays||[]).find(ee=>ee.op==="moved"&&ee.toParent&&z[ee.toParent]);if(!Le)continue;const Ue=zi(Le.seed);he.push({id:`move-${ge.id}-${Le.toParent}`,source:ge.id,target:Le.toParent,type:"smoothstep",animated:!0,zIndex:2,className:"move-edge",style:{stroke:Ue,strokeWidth:1.5,strokeDasharray:"4 4",opacity:.6},markerEnd:{type:Oi.ArrowClosed,color:Ue,width:14,height:14}})}return[...se,...he]},[a,Q,z]),Fe=B.useCallback((se,he)=>{const ge=M(),Le=performance.now();cancelAnimationFrame(A.current);const Ue=ee=>{const st=he?Math.min(1,(ee-Le)/he):1,He=1-Math.pow(1-st,3);D({x:ge.x+(se.x-ge.x)*He,y:ge.y+(se.y-ge.y)*He,zoom:ge.zoom+(se.zoom-ge.zoom)*He}),st<1&&(A.current=requestAnimationFrame(Ue))};A.current=requestAnimationFrame(Ue)},[M,D]),Me=B.useCallback((se,he,ge=300)=>{const Le=N.current;if(!Le)return;const Ue=he??M().zoom;Fe({x:Le.clientWidth/2-(se.x+MM/2)*Ue,y:Le.clientHeight/2-(se.y+RM/2)*Ue,zoom:Ue},ge)},[Fe,M]),De=B.useRef(!1);B.useEffect(()=>{if(De.current||c!=="graph")return;De.current=!0;const se=requestAnimationFrame(()=>Me(P,void 0,0));return()=>cancelAnimationFrame(se)},[Me,P,c]);const Se=B.useRef(P);Se.current=P;const vt=B.useRef(Me);vt.current=Me;const ft=B.useRef(!1),X=B.useRef(!1),te=B.useRef(null);B.useEffect(()=>{if(c==="graph"){if(!ft.current){ft.current=!0,te.current=a;return}if(X.current){X.current=!1,te.current=a;return}te.current!==a&&(te.current=a,vt.current(Se.current))}},[a,c]);const ue=g||w||!!u,Ee=B.useRef(ue);B.useEffect(()=>{Ee.current&&!ue&&kM(),Ee.current=ue},[ue]),B.useEffect(()=>{const se=nd(P).map(ee=>ee.key),he=ee=>v(st=>{const He=se.indexOf(st);return se[((He<0?0:He)+ee+se.length)%se.length]}),ge=(ee,st)=>{ee&&(st.preventDefault(),st.stopPropagation(),H(!0),d(ee.id))},Le=ee=>T(document.querySelector(".ov-body .pane-doc, .ov-body .pane-hist, .ov-body .pane-issues, .ov-body .pane-eval, .ov-body .pane-edit"),ee),Ue=ee=>{if(ee.altKey&&!ee.metaKey&&!ee.ctrlKey){const He={Digit1:"graph",Digit2:"sessions",Digit3:"evals",Digit4:"issues",Digit5:"settings"}[ee.code];if(He){ee.preventDefault(),ee.stopPropagation(),f(null),Mt(He);return}if(ee.code==="KeyN"){ee.preventDefault(),ee.stopPropagation(),f(null),h("new"),Mt("sessions","new");return}if(ee.code==="KeyF"){ee.preventDefault(),ee.stopPropagation(),f(null),Mt("evals");return}}if(u){ee.key==="Escape"&&(ee.preventDefault(),ee.stopPropagation(),f(null));return}if((ee.metaKey||ee.ctrlKey)&&ee.key==="/"){ee.preventDefault(),ee.stopPropagation(),f("sessions");return}if(c!=="sessions"&&!(c==="evals"||c==="issues")){if(c==="settings"){pt("board.settings",ee.key)&&(ee.preventDefault(),ee.stopPropagation(),Mt("graph"));return}if(g){if(ee.key==="Escape"){ee.preventDefault(),l(!1);return}if(ee.key==="Tab"){ee.preventDefault(),ee.stopPropagation(),he(ee.shiftKey?-1:1);return}if(ee.key==="ArrowLeft"||ee.key==="h"){ee.preventDefault(),ee.stopPropagation(),he(-1);return}if(ee.key==="ArrowRight"||ee.key==="l"){ee.preventDefault(),ee.stopPropagation(),he(1);return}if(/^[1-9]$/.test(ee.key)&&+ee.key<=se.length){ee.preventDefault(),ee.stopPropagation(),v(se[+ee.key-1]);return}if(ee.key==="j"||ee.key==="k"||ee.key==="ArrowDown"||ee.key==="ArrowUp"){ee.preventDefault(),ee.stopPropagation(),Le(ee.key==="j"||ee.key==="ArrowDown"?120:-120);return}return}if(w){if(ee.key==="Escape"||ee.key==="?"){ee.preventDefault(),_(!1);return}if(ee.key==="j"||ee.key==="k"||ee.key==="ArrowDown"||ee.key==="ArrowUp"){ee.preventDefault(),ee.stopPropagation(),j(document.querySelector(".legend"),ee.key==="j"||ee.key==="ArrowDown"?120:-120);return}return}if(pt("board.help",ee.key)){ee.preventDefault(),_(!0);return}if(ee.key==="Escape"&&y){ee.preventDefault(),ee.stopPropagation(),b(null);return}if(pt("board.settings",ee.key)){ee.preventDefault(),Mt("settings");return}if(pt("board.search",ee.key)){ee.preventDefault(),ee.stopPropagation(),f("board");return}if(!ee.metaKey&&!ee.ctrlKey&&!ee.altKey&&/^[a-zA-Z]$/.test(ee.key)){const st=$.current;if(st.buf||DM.has(ee.key)){clearTimeout(st.timer);const He=st.buf+ee.key;if(ni[He]){ee.preventDefault(),ee.stopPropagation(),$.current={buf:"",timer:0},ae(ni[He](P.id));return}if(X0.some(Tr=>Tr.startsWith(He))){ee.preventDefault(),ee.stopPropagation(),$.current={buf:He,timer:setTimeout(()=>{$.current={buf:"",timer:0}},700)};return}$.current={buf:"",timer:0}}}if(pt("nav.up",ee.key))return ge(ke,ee);if(pt("nav.down",ee.key))return ge(Ce,ee);if(pt("nav.parent",ee.key))return ge(me,ee);if(pt("nav.child",ee.key))return ge(le,ee);if(pt("board.zoomIn",ee.key))ee.preventDefault(),H(!0),Me(P,Qp(M().zoom*1.2),160);else if(pt("board.zoomOut",ee.key))ee.preventDefault(),H(!0),Me(P,Qp(M().zoom/1.2),160);else if(pt("board.zoomReset",ee.key))ee.preventDefault(),H(!0),Me(P,.85,200);else if(pt("board.info",ee.key))ee.preventDefault(),l(!0);else if(pt("board.cycle",ee.key)||pt("board.cycleRev",ee.key)){if(ee.preventDefault(),!ne.length)return;H(!0);const st=q0(ne,P.id,pt("board.cycleRev",ee.key)?-1:1,He=>He.id);st&&d(st.id)}else pt("board.fresh",ee.key)?(ee.preventDefault(),ae(`[[${P.id}]] `)):pt("board.evals",ee.key)&&(ee.preventDefault(),Mt("evals"))}};return window.addEventListener("keydown",Ue,!0),()=>window.removeEventListener("keydown",Ue,!0)},[g,c,w,u,y,P,ne,ke,Ce,le,me,Me,M,fe,ae,T,j]),B.useEffect(()=>{const se=he=>{const ge=L.current,Le=he.clientX!==ge.x||he.clientY!==ge.y;ge.x=he.clientX,ge.y=he.clientY,Le&&I.current&&H(!1)};return window.addEventListener("mousemove",se,!0),()=>window.removeEventListener("mousemove",se,!0)},[]);const ye=B.useCallback((se,he)=>{he.id!==Se.current.id&&(X.current=!0),d(he.id)},[]),et=B.useCallback((se,he)=>{he.id!==Se.current.id&&(X.current=!0),d(he.id),l(!0)},[]),It=B.useCallback((se,he)=>{se.preventDefault(),he.id!==Se.current.id&&(X.current=!0),d(he.id),k({x:se.clientX,y:se.clientY,id:he.id})},[]),rt=B.useCallback((se,he=!0)=>{const ge=he&&y===se.source;if(b(ge?null:se.source),ge)return;const Le=new Set((se.ops||[]).map(ee=>ee.nodeId)),Ue=e.find(ee=>Le.has(ee.id));Ue&&d(Ue.id)},[y,e]),[ut,js]=z0("spex.fpWidth",250,{min:190,max:520,dir:-1});return S.jsxs("div",{className:F?"app kbd-mode":"app",children:[S.jsx(pM,{page:c,onNav:Mt}),S.jsxs("div",{className:"app-main",children:[S.jsxs("div",{className:"page-graph",style:{"--fp-w":`${ut}px`,display:c==="graph"?void 0:"none"},children:[S.jsxs("div",{className:"graph",ref:N,children:[S.jsx(p2,{nodes:$e,edges:Be,nodeTypes:LM,onNodeClick:ye,onNodeDoubleClick:et,onNodeContextMenu:It,zoomOnDoubleClick:!1,nodesDraggable:!1,nodesFocusable:!1,disableKeyboardA11y:!0,defaultViewport:{x:0,y:0,zoom:.85},minZoom:.4,maxZoom:1.6,proOptions:{hideAttribution:!0}}),S.jsxs("div",{className:"hud",children:[S.jsxs("span",{className:"brand",children:["$ ",n||"spec-dashboard"]}),S.jsx("button",{className:"hud-help",onClick:()=>_(se=>!se),title:R("hud.helpTitle"),children:"?"})]}),S.jsx(Xk,{sessions:t,activeId:y,onPick:rt,onOpenSession:fe}),S.jsx(aM,{specs:e,focusId:a,onJump:d}),S.jsx(rk,{menu:x,onClose:()=>k(null),onInfo:()=>l(!0),onFresh:se=>ae(`[[${se}]] `),onNewChild:se=>ae(ni.nn(se)),onDelete:se=>ae(ni.dd(se)),sessions:Pe,onOpenSession:fe}),Z&&S.jsxs("div",{className:"lock-hint",style:{"--ov":zi(Z.id)},children:[S.jsxs("span",{className:"lock-hint-lead",children:[S.jsx(A0,{})," ",Nn(Z)]}),Y.length?S.jsxs("span",{className:"lock-hint-body",children:[R("lockHint.cycleBefore"),S.jsx("kbd",{children:"o"}),S.jsx("kbd",{children:"O"}),R("lockHint.cycleAfter",{n:Y.length})]}):S.jsx("span",{className:"lock-hint-body",children:R("lockHint.empty")}),S.jsx("button",{className:"lock-hint-release",onClick:()=>b(null),title:R("lockHint.releaseTitle"),children:R("lockHint.release")})]}),w&&S.jsx(BL,{onClose:()=>_(!1)})]}),S.jsx("div",{className:"pane-resizer",onMouseDown:js,role:"separator","aria-orientation":"vertical"}),S.jsx(qk,{node:P,onOpenEval:ce})]}),g&&S.jsx(Uk,{node:P,pane:m,setPane:v,onClose:()=>l(!1)},P.id),S.jsx(xL,{sessions:t,specs:e,focusNode:P,open:c==="sessions",searchOpen:!!u,sel:p,setSel:h,seed:C,onSeedConsumed:()=>E(null),onClose:()=>Mt("graph"),onPickSession:rt,onOpenSearch:()=>f("sessions"),reload:s}),c==="evals"&&S.jsx("div",{className:"page-pane page-evals",children:S.jsx(dL,{specs:e,sessions:t,reloadBoard:s})}),c==="issues"&&S.jsx("div",{className:"page-pane page-issues",children:S.jsx(gM,{specs:e,sessions:t,issuesData:r,reloadIssues:o,onFocusNode:se=>{d(se),Mt("graph")}})}),c==="settings"&&S.jsx(HL,{}),u&&S.jsx(nM,{specs:e,sessions:t,onPick:We,onClose:()=>f(null),boost:u==="sessions"?"session":null})]})]})}function TM(){const e=be(),t=bM(),[s,n]=B.useState(null),[r,o]=B.useState(null),c=B.useRef(0),i=B.useRef(0),a=B.useCallback((m=!1)=>{const v=Date.now();if(!m&&v-i.current<5e3)return Promise.resolve();i.current=v;const w=++c.current;return Ek().then(_=>{w===c.current&&o(_)}).catch(()=>{})},[]),d=B.useRef(0),g=B.useCallback(()=>{const m=++d.current;return yk().then(v=>{m===d.current&&n(v)}).catch(()=>{})},[]),l=B.useRef(!1);return B.useEffect(()=>{g(),a(!0);const m=wk({onBoard:w=>{d.current++,n(w),a()},onLegacyChange:()=>{g(),a()},onLive:w=>{l.current=w}}),v=setInterval(()=>{l.current||g(),a()},15e3);return()=>{m(),clearInterval(v)}},[g,a]),B.useEffect(()=>{const m=wc(s);m&&(document.title=`${m} · SpexCode`)},[s==null?void 0:s.project]),B.useEffect(()=>{const m=xk(Sk(s));if(!m)return;let v=document.querySelector("link[rel~='icon']");v||(v=document.createElement("link"),v.rel="icon",document.head.appendChild(v)),v.setAttribute("href",m)},[s==null?void 0:s.projectIcon]),s?t?S.jsx(CM,{specs:s.nodes,sessions:s.sessions,project:wc(s)}):S.jsx(AM,{specs:s.nodes,sessions:s.sessions,reload:g,project:wc(s),issuesData:r,reloadIssues:a}):S.jsx("div",{className:"loading",children:e("hud.loading")})}Mc.createRoot(document.getElementById("root")).render(S.jsx(cg.StrictMode,{children:S.jsx(G2,{children:S.jsx(Qv,{children:S.jsx(TM,{})})})}));